@o3r/schematics 8.1.0-rc.4 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/package.json +4 -4
  2. package/src/rule-factories/index.d.ts +1 -0
  3. package/src/rule-factories/index.d.ts.map +1 -1
  4. package/src/rule-factories/index.js +1 -0
  5. package/src/rule-factories/index.js.map +1 -1
  6. package/src/rule-factories/update-imports/index.d.ts +5 -0
  7. package/src/rule-factories/update-imports/index.d.ts.map +1 -0
  8. package/src/rule-factories/update-imports/index.js +8 -0
  9. package/src/rule-factories/update-imports/index.js.map +1 -0
  10. package/src/rule-factories/update-imports/list-of-vars.d.ts +15 -0
  11. package/src/rule-factories/update-imports/list-of-vars.d.ts.map +1 -0
  12. package/src/rule-factories/update-imports/list-of-vars.js +44 -0
  13. package/src/rule-factories/update-imports/list-of-vars.js.map +1 -0
  14. package/src/rule-factories/update-imports/update-imports-with-scope.d.ts +11 -0
  15. package/src/rule-factories/update-imports/update-imports-with-scope.d.ts.map +1 -0
  16. package/src/rule-factories/update-imports/update-imports-with-scope.js +34 -0
  17. package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -0
  18. package/src/rule-factories/update-imports/update-ts-imports.d.ts +10 -0
  19. package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -0
  20. package/src/rule-factories/update-imports/update-ts-imports.js +31 -0
  21. package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -0
  22. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts +8 -0
  23. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts.map +1 -0
  24. package/src/rule-factories/update-imports/v7-to-v8-map-object.js +2049 -0
  25. package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +1 -0
  26. package/src/utility/index.d.ts +1 -0
  27. package/src/utility/index.d.ts.map +1 -1
  28. package/src/utility/index.js +1 -0
  29. package/src/utility/index.js.map +1 -1
  30. package/src/utility/update-imports.d.ts +25 -0
  31. package/src/utility/update-imports.d.ts.map +1 -0
  32. package/src/utility/update-imports.js +86 -0
  33. package/src/utility/update-imports.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/schematics",
3
- "version": "8.1.0-rc.4",
3
+ "version": "8.1.0",
4
4
  "description": "Schematics module of the Otter framework",
5
5
  "main": "./src/index.js",
6
6
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@o3r/dev-tools": "^8.1.0-rc.4",
31
+ "@o3r/dev-tools": "^8.1.0",
32
32
  "comment-json": "^4.1.0",
33
33
  "globby": "^11.1.0",
34
34
  "minimatch": "^6.1.6",
@@ -51,8 +51,8 @@
51
51
  "@nrwl/jest": "~15.8.0",
52
52
  "@nrwl/js": "^15.6.3",
53
53
  "@nrwl/linter": "~15.8.0",
54
- "@o3r/build-helpers": "^8.1.0-rc.4",
55
- "@o3r/eslint-plugin": "^8.1.0-rc.4",
54
+ "@o3r/build-helpers": "^8.1.0",
55
+ "@o3r/eslint-plugin": "^8.1.0",
56
56
  "@schematics/angular": "~15.2.0",
57
57
  "@types/jest": "~28.1.2",
58
58
  "@types/node": "^17.0.45",
@@ -3,4 +3,5 @@ export * from './interfaces';
3
3
  export * from './check-packages-peers/index';
4
4
  export * from './ng-add/index';
5
5
  export * from './remove-packages/index';
6
+ export * from './update-imports/index';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
@@ -6,4 +6,5 @@ tslib_1.__exportStar(require("./interfaces"), exports);
6
6
  tslib_1.__exportStar(require("./check-packages-peers/index"), exports);
7
7
  tslib_1.__exportStar(require("./ng-add/index"), exports);
8
8
  tslib_1.__exportStar(require("./remove-packages/index"), exports);
9
+ tslib_1.__exportStar(require("./update-imports/index"), exports);
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,uDAA6B;AAC7B,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,uDAA6B;AAC7B,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC;AACxC,iEAAuC"}
@@ -0,0 +1,5 @@
1
+ export * from './list-of-vars';
2
+ export * from './update-imports-with-scope';
3
+ export * from './update-ts-imports';
4
+ export * from './v7-to-v8-map-object';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./list-of-vars"), exports);
5
+ tslib_1.__exportStar(require("./update-imports-with-scope"), exports);
6
+ tslib_1.__exportStar(require("./update-ts-imports"), exports);
7
+ tslib_1.__exportStar(require("./v7-to-v8-map-object"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,sEAA4C;AAC5C,8DAAoC;AACpC,gEAAsC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ *
3
+ * Represents an element that is exposed in a Sass import.
4
+ *
5
+ * @property value: The name of the exposed element.
6
+ * @property type: The type of the exposed element, either 'function' or 'var'.
7
+ * @property replacement: The name of the replacement element, if any.
8
+ */
9
+ export interface SassImportExposedElement {
10
+ value: string;
11
+ type: 'function' | 'var';
12
+ replacement?: string | undefined;
13
+ }
14
+ export declare const listOfExposedElements: SassImportExposedElement[];
15
+ //# sourceMappingURL=list-of-vars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-of-vars.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/list-of-vars.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,eAAO,MAAM,qBAAqB,EAAE,wBAAwB,EAuC3D,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listOfExposedElements = void 0;
4
+ exports.listOfExposedElements = [
5
+ // utils
6
+ { value: '$test-mode-enabled', type: 'var' },
7
+ { value: 'error', type: 'function' },
8
+ { value: '$alternative-breakpoints-map', type: 'var' },
9
+ { value: 'get-mandatory', type: 'function' },
10
+ { value: 'multi-map-merge', type: 'function' },
11
+ { value: '$metadata-logging', type: 'var' },
12
+ { value: '$debug', type: 'var' },
13
+ { value: 'log-variable', type: 'function' },
14
+ // theming mixins
15
+ { value: 'apply-theme', type: 'function' },
16
+ { value: 'override-theme', type: 'function' },
17
+ // theming functions
18
+ { value: 'generate-theme-variables', type: 'function' },
19
+ { value: 'revert-palette', type: 'function' },
20
+ { value: 'generate-theme', type: 'function' },
21
+ { value: 'meta-theme-to-otter', type: 'function' },
22
+ { value: 'meta-theme-to-material', type: 'function' },
23
+ { value: 'o3r-var', type: 'function', replacement: 'variable' },
24
+ { value: 'o3r-get', type: 'function', replacement: 'get' },
25
+ { value: 'o3r-color', type: 'function', replacement: 'color' },
26
+ { value: 'o3r-contrast', type: 'function', replacement: 'contrast' },
27
+ { value: 'is-o3r-variable', type: 'function', replacement: 'is-variable' },
28
+ // theming palettes
29
+ { value: '$refx-primary', type: 'var', replacement: '$palettes-refx-primary' },
30
+ { value: '$refx-highlight', type: 'var', replacement: '$palettes-refx-highlight' },
31
+ { value: '$refx-accent', type: 'var', replacement: '$palettes-refx-accent' },
32
+ { value: '$refx-warn', type: 'var', replacement: '$palettes-refx-warn' },
33
+ { value: '$ama-highlight', type: 'var', replacement: '$palettes-ama-highlight' },
34
+ { value: '$ama-accent', type: 'var', replacement: '$palettes-ama-accent' },
35
+ { value: '$ama-primary', type: 'var', replacement: '$palettes-ama-primary' },
36
+ { value: '$ama-warn', type: 'var', replacement: '$palettes-ama-warn' },
37
+ // theming otter-theme
38
+ { value: 'generate-otter-theme', type: 'function' },
39
+ { value: 'generate-otter-dark-theme', type: 'function' },
40
+ // theming dark-theme
41
+ { value: '$private-dark-default', type: 'var' },
42
+ { value: '$otter-dark-default', type: 'var' }
43
+ ];
44
+ //# sourceMappingURL=list-of-vars.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-of-vars.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/list-of-vars.ts"],"names":[],"mappings":";;;AAca,QAAA,qBAAqB,GAA+B;IAC/D,QAAQ;IACR,EAAC,KAAK,EAAE,oBAAoB,E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* Update SASS imports to use a scoped dependency
5
+ *
6
+ * @param alias The name of the otter styling package
7
+ * @param dependencyName The name of the dependency to update imports on
8
+ * @param exposedElements The list of exposed elemeents
9
+ */
10
+ export declare function updateSassImports(alias: string, dependencyName?: string, exposedElements?: SassImportExposedElement[]): Rule;
11
+ //# sourceMappingURL=update-imports-with-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-imports-with-scope.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-imports-with-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EAAyB,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAIjF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,SAAiB,EAAE,eAAe,GAAE,wBAAwB,EAA0B,GAAG,IAAI,CAmB3J"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateSassImports = void 0;
4
+ const utility_1 = require("../../utility");
5
+ const list_of_vars_1 = require("./list-of-vars");
6
+ const imports = new RegExp(/^@import\s+['"]~?@(o3r|otter)\/styling.*\s*/, 'gm');
7
+ /**
8
+ * Update SASS imports to use a scoped dependency
9
+ *
10
+ * @param alias The name of the otter styling package
11
+ * @param dependencyName The name of the dependency to update imports on
12
+ * @param exposedElements The list of exposed elemeents
13
+ */
14
+ function updateSassImports(alias, dependencyName = '@o3r/styling', exposedElements = list_of_vars_1.listOfExposedElements) {
15
+ return (tree, _context) => {
16
+ const files = (0, utility_1.getFilesFromRootOfWorkspaceProjects)(tree, 'scss');
17
+ files
18
+ .forEach((file) => {
19
+ let content = tree.read(file).toString();
20
+ if (content.match(imports)) {
21
+ const contentWithoutImports = content.replace(imports, '');
22
+ content = `@use '${dependencyName}' as ${alias};\n${contentWithoutImports}`;
23
+ exposedElements.forEach(elem => {
24
+ const elemRegex = new RegExp(`(?<![\\w\\d-])${elem.type === 'var' ? '\\' : ''}${elem.value}((?![\\w\\d-])(?!(\\s*\\:)))`, 'g');
25
+ content = content.replace(elemRegex, `${alias}.${(elem.replacement || elem.value)}`);
26
+ });
27
+ tree.overwrite(file, content);
28
+ }
29
+ });
30
+ return tree;
31
+ };
32
+ }
33
+ exports.updateSassImports = updateSassImports;
34
+ //# sourceMappingURL=update-imports-with-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-imports-with-scope.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-imports-with-scope.ts"],"names":[],"mappings":";;;AACA,2CAAoE;AACpE,iDAAiF;AAEjF,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,6CAA6C,EAAE,IAAI,CAAC,CAAC;AAEhF;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,cAAc,GAAG,cAAc,EAAE,kBAA8C,oCAAqB;IACnJ,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,KAAK,GAAG,IAAA,6CAAmC,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChE,KAAK;aACF,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,EAAE,CAAC;YAC1C,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;gBAC1B,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC3D,OAAO,GAAG,SAAS,cAAc,QAAQ,KAAK,MAAM,qBAAqB,EAAE,CAAC;gBAC5E,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,iBAAiB,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,8BAA8B,EAAE,GAAG,CAAC,CAAC;oBAC/H,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACvF,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC,CAAC;QAEL,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAnBD,8CAmBC"}
@@ -0,0 +1,10 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { ImportsMapping } from '../../utility';
3
+ /**
4
+ * Update imports based on mapping
5
+ *
6
+ * @param mapImports Map of the import to replace
7
+ * @param renamedPackages Map of the import package to replace
8
+ */
9
+ export declare function updateImports(mapImports?: ImportsMapping, renamedPackages?: Record<string, string>): Rule;
10
+ //# sourceMappingURL=update-ts-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-ts-imports.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-ts-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAuC,cAAc,EAAuB,MAAM,eAAe,CAAC;AAEzG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,GAAE,cAAmB,EAAE,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,IAAI,CA2BjH"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateImports = void 0;
4
+ const ts = require("typescript");
5
+ const utility_1 = require("../../utility");
6
+ /**
7
+ * Update imports based on mapping
8
+ *
9
+ * @param mapImports Map of the import to replace
10
+ * @param renamedPackages Map of the import package to replace
11
+ */
12
+ function updateImports(mapImports = {}, renamedPackages = {}) {
13
+ return (tree, context) => {
14
+ const files = (0, utility_1.getSourceFilesFromWorkspaceProjects)(tree);
15
+ // exact match on import path
16
+ const importsRegexp = new RegExp(`^(${[...Object.keys(mapImports)].join('|')})$`);
17
+ // match the import path starting with the package to be renamed
18
+ const renamePackagesRegexp = new RegExp(`^(${[...Object.keys(renamedPackages)].join('|')})`);
19
+ let nbOfUnResolvedImports = 0;
20
+ files.forEach((file) => {
21
+ const sourceFile = ts.createSourceFile(file, tree.read(file).toString(), ts.ScriptTarget.ES2015, true);
22
+ nbOfUnResolvedImports += (0, utility_1.updateImportsInFile)(context.logger, tree, sourceFile, importsRegexp, renamePackagesRegexp, mapImports, renamedPackages);
23
+ });
24
+ if (nbOfUnResolvedImports > 0) {
25
+ context.logger.warn(`The migration rule could not resolve a total of ${nbOfUnResolvedImports} imports that you may have to migrate manually (see the details above).`);
26
+ }
27
+ return tree;
28
+ };
29
+ }
30
+ exports.updateImports = updateImports;
31
+ //# sourceMappingURL=update-ts-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-ts-imports.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-ts-imports.ts"],"names":[],"mappings":";;;AACA,iCAAiC;AACjC,2CAAyG;AAEzG;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,aAA6B,EAAE,EAAE,kBAA0C,EAAE;IAEzG,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,IAAA,6CAAmC,EAAC,IAAI,CAAC,CAAC;QAExD,6BAA6B;QAC7B,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClF,gEAAgE;QAChE,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7F,IAAI,qBAAqB,GAAG,CAAC,CAAC;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,EAAE,EAC3B,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;YACF,qBAAqB,IAAI,IAAA,6BAAmB,EAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QACnJ,CAAC,CAAC,CAAC;QAEH,IAAI,qBAAqB,GAAG,CAAC,EAAE;YAC7B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mDAAmD,qBAAqB,yEAAyE,CAAC,CAAC;SACxK;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AA3BD,sCA2BC"}
@@ -0,0 +1,8 @@
1
+ import type { ImportsMapping } from '../../utility';
2
+ /** Packages that were renamed */
3
+ export declare const renamedPackagesV7toV8: {
4
+ [key: string]: string;
5
+ };
6
+ /** Map containing the import changes in otter packages for the exported elements */
7
+ export declare const mapImportV7toV8: ImportsMapping;
8
+ //# sourceMappingURL=v7-to-v8-map-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v7-to-v8-map-object.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/v7-to-v8-map-object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,iCAAiC;AACjC,eAAO,MAAM,qBAAqB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAa1D,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,eAAe,EAAE,cA6+D7B,CAAC"}