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,UAAC,CAAS;gBAC1B,OAAA,6BAAW,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;YAArD,CAAqD,KACnD,OAAkB,CACvB,CAAC;QAEF,IAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,OAAO,CAAC,SAAS;gBACf,CAAC,CAAC,IAAA,mBAAM,EAAC,UAAC,IAAI,IAAK,OAAA,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAnC,CAAmC,CAAC;gBACvD,CAAC,CAAC,IAAA,iBAAI,GAAE;YACV,IAAA,2BAAc,EAAC,eAAe,CAAC;YAC/B,IAAA,iBAAI,EAAC,UAAU,CAAC,IAAI,CAAC;SACtB,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,mCAAiB,wBAAM,OAAO,KAAE,MAAM,EAAE,IAAI,IAAG;YAC/C,IAAA,4CAA0B,wBAAM,OAAO,KAAE,MAAM,EAAE,IAAI,IAAG;YACxD,IAAA,2BAAc,EAAC,IAAA,sBAAS,EAAC,cAAc,CAAC,CAAC;SAC1C,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAvCD,4BAuCC","sourcesContent":["import {\n Rule,\n SchematicsException,\n apply,\n applyTemplates,\n branchAndMerge,\n chain,\n filter,\n mergeWith,\n move,\n noop,\n template,\n url,\n Tree,\n SchematicContext,\n} from '@angular-devkit/schematics';\nimport {\n stringUtils,\n addReducerToState,\n addReducerImportToNgModule,\n getProjectPath,\n findModuleFromOptions,\n parseName,\n getProject,\n} from '../../schematics-core';\nimport { Schema as EntityOptions } from './schema';\n\nexport default function (options: EntityOptions): Rule {\n return (host: Tree, context: SchematicContext) => {\n const projectConfig = getProject(host, options);\n options.path = getProjectPath(host, options);\n\n const parsedPath = parseName(options.path, options.name);\n options.name = parsedPath.name;\n options.path = parsedPath.path;\n\n if (options.module) {\n options.module = findModuleFromOptions(host, options);\n }\n\n const templateOptions = {\n ...stringUtils,\n 'if-flat': (s: string) => (options.flat ? '' : s),\n 'group-actions': (name: string) =>\n stringUtils.group(name, options.group ? 'actions' : ''),\n 'group-models': (name: string) =>\n stringUtils.group(name, options.group ? 'models' : ''),\n 'group-reducers': (s: string) =>\n stringUtils.group(s, options.group ? 'reducers' : ''),\n ...(options as object),\n };\n\n const templateSource = apply(url('./files'), [\n options.skipTests\n ? filter((path) => !path.endsWith('.spec.ts.template'))\n : noop(),\n applyTemplates(templateOptions),\n move(parsedPath.path),\n ]);\n\n return chain([\n addReducerToState({ ...options, plural: true }),\n addReducerImportToNgModule({ ...options, plural: true }),\n branchAndMerge(mergeWith(templateSource)),\n ])(host, context);\n };\n}\n"]}
\No newline at end of file