@strapi/utils 5.16.1 → 5.17.0-beta.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.
package/dist/index.d.ts CHANGED
@@ -22,7 +22,6 @@ export * as errors from './errors';
22
22
  export * as contentTypes from './content-types';
23
23
  export * as relations from './relations';
24
24
  export * as hooks from './hooks';
25
- export * as rulesEngine from './rules-engine';
26
25
  export * from './zod';
27
26
  export * from './primitives';
28
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,K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AO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,cAAc,OAAO,CAAC;AAEtB,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -24,7 +24,6 @@ var errors = require('./errors.js');
24
24
  var contentTypes = require('./content-types.js');
25
25
  var relations = require('./relations.js');
26
26
  var hooks = require('./hooks.js');
27
- var rulesEngine = require('./rules-engine.js');
28
27
  var zod = require('./zod.js');
29
28
  var strings = require('./primitives/strings.js');
30
29
  var arrays = require('./primitives/arrays.js');
@@ -59,7 +58,6 @@ exports.errors = errors;
59
58
  exports.contentTypes = contentTypes;
60
59
  exports.relations = relations;
61
60
  exports.hooks = hooks;
62
- exports.rulesEngine = rulesEngine;
63
61
  exports.validateZod = zod.validateZod;
64
62
  exports.strings = strings;
65
63
  exports.arrays = arrays;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs CHANGED
@@ -37,8 +37,6 @@ import * as relations from './relations.mjs';
37
37
  export { relations };
38
38
  import * as hooks from './hooks.mjs';
39
39
  export { hooks };
40
- import * as rulesEngine from './rules-engine.mjs';
41
- export { rulesEngine };
42
40
  export { validateZod } from './zod.mjs';
43
41
  import * as strings from './primitives/strings.mjs';
44
42
  export { strings };
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/utils",
3
- "version": "5.16.1",
3
+ "version": "5.17.0-beta.0",
4
4
  "description": "Shared utilities for the Strapi packages",
5
5
  "keywords": [
6
6
  "strapi",
@@ -50,7 +50,6 @@
50
50
  "date-fns": "2.30.0",
51
51
  "execa": "5.1.1",
52
52
  "http-errors": "2.0.0",
53
- "json-logic-js": "2.0.5",
54
53
  "lodash": "4.17.21",
55
54
  "node-machine-id": "1.1.12",
56
55
  "p-map": "4.0.0",
@@ -60,13 +59,12 @@
60
59
  },
61
60
  "devDependencies": {
62
61
  "@types/http-errors": "2.0.4",
63
- "@types/json-logic-js": "2.0.8",
64
62
  "@types/koa": "2.13.4",
65
63
  "@types/node": "18.19.24",
66
- "eslint-config-custom": "5.16.1",
64
+ "eslint-config-custom": "5.17.0-beta.0",
67
65
  "koa": "2.16.1",
68
66
  "koa-body": "6.0.1",
69
- "tsconfig": "5.16.1"
67
+ "tsconfig": "5.17.0-beta.0"
70
68
  },
71
69
  "engines": {
72
70
  "node": ">=18.0.0 <=22.x.x",
@@ -1,24 +0,0 @@
1
- import jsonLogic from 'json-logic-js';
2
- import { z } from 'zod';
3
- export declare const ConditionSchema: z.ZodObject<{
4
- dependsOn: z.ZodString;
5
- operator: z.ZodEnum<["is", "isNot"]>;
6
- value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
7
- }, "strip", z.ZodTypeAny, {
8
- value: string | number | boolean;
9
- dependsOn: string;
10
- operator: "is" | "isNot";
11
- }, {
12
- value: string | number | boolean;
13
- dependsOn: string;
14
- operator: "is" | "isNot";
15
- }>;
16
- export type Condition = z.infer<typeof ConditionSchema>;
17
- export type JsonLogicCondition = jsonLogic.RulesLogic<jsonLogic.AdditionalOperation>;
18
- export type RulesEngine = {
19
- generate: (condition: Condition) => JsonLogicCondition;
20
- validate: (condition: Condition) => void;
21
- evaluate: (condition: JsonLogicCondition, data: unknown) => boolean;
22
- };
23
- export declare function createRulesEngine(): RulesEngine;
24
- //# sourceMappingURL=rules-engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules-engine.d.ts","sourceRoot":"","sources":["../src/rules-engine.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;AACrF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,kBAAkB,CAAC;IACvD,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;CACrE,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,WAAW,CAuD/C"}
@@ -1,75 +0,0 @@
1
- 'use strict';
2
-
3
- var jsonLogic = require('json-logic-js');
4
- var zod = require('zod');
5
-
6
- const ConditionSchema = zod.z.object({
7
- dependsOn: zod.z.string().min(1),
8
- operator: zod.z.enum([
9
- 'is',
10
- 'isNot'
11
- ]),
12
- value: zod.z.union([
13
- zod.z.string(),
14
- zod.z.number(),
15
- zod.z.boolean()
16
- ])
17
- });
18
- function createRulesEngine() {
19
- /**
20
- * Transforms a high-level `Condition` object into a JSON Logic-compatible condition.
21
- *
22
- * Converts operators like 'is' and 'isNot' into their JSON Logic equivalents ('==' and '!=').
23
- * Throws an error if the operator is not supported.
24
- *
25
- * @param condition - The condition object to convert.
26
- * @returns A JSON Logic AST representing the condition.
27
- * @throws {Error} If the operator is not recognized.
28
- */ const generate = (condition)=>{
29
- const { dependsOn, operator, value } = condition;
30
- const operatorsMap = {
31
- is: '==',
32
- isNot: '!='
33
- };
34
- if (!operatorsMap[operator]) {
35
- throw new Error(`Invalid operator: ${operator}`);
36
- }
37
- return {
38
- [operatorsMap[operator]]: [
39
- {
40
- var: dependsOn
41
- },
42
- value
43
- ]
44
- };
45
- };
46
- /**
47
- * Validates a condition object against the `ConditionSchema`.
48
- *
49
- * Ensures that the condition adheres to the expected structure and types.
50
- *
51
- * @param condition - The condition object to validate.
52
- * @throws {ZodError} If the condition is invalid.
53
- */ const validate = (condition)=>{
54
- ConditionSchema.parse(condition);
55
- };
56
- /**
57
- * Evaluates a JSON Logic condition against provided data.
58
- * @throws {Error} If the condition is invalid.
59
- */ const evaluate = (condition, data)=>{
60
- try {
61
- return jsonLogic.apply(condition, data);
62
- } catch (err) {
63
- throw new Error(`Invalid condition: ${err.message}`);
64
- }
65
- };
66
- return {
67
- generate,
68
- validate,
69
- evaluate
70
- };
71
- }
72
-
73
- exports.ConditionSchema = ConditionSchema;
74
- exports.createRulesEngine = createRulesEngine;
75
- //# sourceMappingURL=rules-engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules-engine.js","sources":["../src/rules-engine.ts"],"sourcesContent":["import jsonLogic from 'json-logic-js';\nimport { z } from 'zod';\n\nexport const ConditionSchema = z.object({\n dependsOn: z.string().min(1),\n operator: z.enum(['is', 'isNot']),\n value: z.union([z.string(), z.number(), z.boolean()]),\n});\n\nexport type Condition = z.infer<typeof ConditionSchema>;\nexport type JsonLogicCondition = jsonLogic.RulesLogic<jsonLogic.AdditionalOperation>;\nexport type RulesEngine = {\n generate: (condition: Condition) => JsonLogicCondition;\n validate: (condition: Condition) => void;\n evaluate: (condition: JsonLogicCondition, data: unknown) => boolean;\n};\n\nexport function createRulesEngine(): RulesEngine {\n /**\n * Transforms a high-level `Condition` object into a JSON Logic-compatible condition.\n *\n * Converts operators like 'is' and 'isNot' into their JSON Logic equivalents ('==' and '!=').\n * Throws an error if the operator is not supported.\n *\n * @param condition - The condition object to convert.\n * @returns A JSON Logic AST representing the condition.\n * @throws {Error} If the operator is not recognized.\n */\n const generate = (condition: Condition): JsonLogicCondition => {\n const { dependsOn, operator, value } = condition;\n const operatorsMap = {\n is: '==',\n isNot: '!=',\n };\n if (!operatorsMap[operator]) {\n throw new Error(`Invalid operator: ${operator}`);\n }\n return { [operatorsMap[operator]]: [{ var: dependsOn }, value] };\n };\n\n /**\n * Validates a condition object against the `ConditionSchema`.\n *\n * Ensures that the condition adheres to the expected structure and types.\n *\n * @param condition - The condition object to validate.\n * @throws {ZodError} If the condition is invalid.\n */\n const validate = (condition: Condition) => {\n ConditionSchema.parse(condition);\n };\n\n /**\n * Evaluates a JSON Logic condition against provided data.\n * @throws {Error} If the condition is invalid.\n */\n const evaluate = (\n condition: jsonLogic.RulesLogic<jsonLogic.AdditionalOperation>,\n data: unknown\n ): boolean => {\n try {\n return jsonLogic.apply(condition, data);\n } catch (err: any) {\n throw new Error(`Invalid condition: ${err.message}`);\n }\n };\n\n return {\n generate,\n validate,\n evaluate,\n };\n}\n"],"names":["ConditionSchema","z","object","dependsOn","string","min","operator","enum","value","union","number","boolean","createRulesEngine","generate","condition","operatorsMap","is","isNot","Error","var","validate","parse","evaluate","data","jsonLogic","apply","err","message"],"mappings":";;;;;AAGaA,MAAAA,eAAAA,GAAkBC,KAAEC,CAAAA,MAAM,CAAC;AACtCC,IAAAA,SAAAA,EAAWF,KAAEG,CAAAA,MAAM,EAAGC,CAAAA,GAAG,CAAC,CAAA,CAAA;IAC1BC,QAAUL,EAAAA,KAAAA,CAAEM,IAAI,CAAC;AAAC,QAAA,IAAA;AAAM,QAAA;AAAQ,KAAA,CAAA;IAChCC,KAAOP,EAAAA,KAAAA,CAAEQ,KAAK,CAAC;AAACR,QAAAA,KAAAA,CAAEG,MAAM,EAAA;AAAIH,QAAAA,KAAAA,CAAES,MAAM,EAAA;AAAIT,QAAAA,KAAAA,CAAEU,OAAO;AAAG,KAAA;AACtD,CAAG;AAUI,SAASC,iBAAAA,GAAAA;AACd;;;;;;;;;MAUA,MAAMC,WAAW,CAACC,SAAAA,GAAAA;AAChB,QAAA,MAAM,EAAEX,SAAS,EAAEG,QAAQ,EAAEE,KAAK,EAAE,GAAGM,SAAAA;AACvC,QAAA,MAAMC,YAAe,GAAA;YACnBC,EAAI,EAAA,IAAA;YACJC,KAAO,EAAA;AACT,SAAA;AACA,QAAA,IAAI,CAACF,YAAY,CAACT,QAAAA,CAAS,EAAE;AAC3B,YAAA,MAAM,IAAIY,KAAM,CAAA,CAAC,kBAAkB,EAAEZ,SAAS,CAAC,CAAA;AACjD;QACA,OAAO;AAAE,YAAA,CAACS,YAAY,CAACT,QAAS,CAAA,GAAG;AAAC,gBAAA;oBAAEa,GAAKhB,EAAAA;AAAU,iBAAA;AAAGK,gBAAAA;AAAM;AAAC,SAAA;AACjE,KAAA;AAEA;;;;;;;MAQA,MAAMY,WAAW,CAACN,SAAAA,GAAAA;AAChBd,QAAAA,eAAAA,CAAgBqB,KAAK,CAACP,SAAAA,CAAAA;AACxB,KAAA;AAEA;;;MAIA,MAAMQ,QAAW,GAAA,CACfR,SACAS,EAAAA,IAAAA,GAAAA;QAEA,IAAI;YACF,OAAOC,SAAAA,CAAUC,KAAK,CAACX,SAAWS,EAAAA,IAAAA,CAAAA;AACpC,SAAA,CAAE,OAAOG,GAAU,EAAA;YACjB,MAAM,IAAIR,MAAM,CAAC,mBAAmB,EAAEQ,GAAIC,CAAAA,OAAO,CAAC,CAAC,CAAA;AACrD;AACF,KAAA;IAEA,OAAO;AACLd,QAAAA,QAAAA;AACAO,QAAAA,QAAAA;AACAE,QAAAA;AACF,KAAA;AACF;;;;;"}
@@ -1,72 +0,0 @@
1
- import jsonLogic from 'json-logic-js';
2
- import { z } from 'zod';
3
-
4
- const ConditionSchema = z.object({
5
- dependsOn: z.string().min(1),
6
- operator: z.enum([
7
- 'is',
8
- 'isNot'
9
- ]),
10
- value: z.union([
11
- z.string(),
12
- z.number(),
13
- z.boolean()
14
- ])
15
- });
16
- function createRulesEngine() {
17
- /**
18
- * Transforms a high-level `Condition` object into a JSON Logic-compatible condition.
19
- *
20
- * Converts operators like 'is' and 'isNot' into their JSON Logic equivalents ('==' and '!=').
21
- * Throws an error if the operator is not supported.
22
- *
23
- * @param condition - The condition object to convert.
24
- * @returns A JSON Logic AST representing the condition.
25
- * @throws {Error} If the operator is not recognized.
26
- */ const generate = (condition)=>{
27
- const { dependsOn, operator, value } = condition;
28
- const operatorsMap = {
29
- is: '==',
30
- isNot: '!='
31
- };
32
- if (!operatorsMap[operator]) {
33
- throw new Error(`Invalid operator: ${operator}`);
34
- }
35
- return {
36
- [operatorsMap[operator]]: [
37
- {
38
- var: dependsOn
39
- },
40
- value
41
- ]
42
- };
43
- };
44
- /**
45
- * Validates a condition object against the `ConditionSchema`.
46
- *
47
- * Ensures that the condition adheres to the expected structure and types.
48
- *
49
- * @param condition - The condition object to validate.
50
- * @throws {ZodError} If the condition is invalid.
51
- */ const validate = (condition)=>{
52
- ConditionSchema.parse(condition);
53
- };
54
- /**
55
- * Evaluates a JSON Logic condition against provided data.
56
- * @throws {Error} If the condition is invalid.
57
- */ const evaluate = (condition, data)=>{
58
- try {
59
- return jsonLogic.apply(condition, data);
60
- } catch (err) {
61
- throw new Error(`Invalid condition: ${err.message}`);
62
- }
63
- };
64
- return {
65
- generate,
66
- validate,
67
- evaluate
68
- };
69
- }
70
-
71
- export { ConditionSchema, createRulesEngine };
72
- //# sourceMappingURL=rules-engine.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules-engine.mjs","sources":["../src/rules-engine.ts"],"sourcesContent":["import jsonLogic from 'json-logic-js';\nimport { z } from 'zod';\n\nexport const ConditionSchema = z.object({\n dependsOn: z.string().min(1),\n operator: z.enum(['is', 'isNot']),\n value: z.union([z.string(), z.number(), z.boolean()]),\n});\n\nexport type Condition = z.infer<typeof ConditionSchema>;\nexport type JsonLogicCondition = jsonLogic.RulesLogic<jsonLogic.AdditionalOperation>;\nexport type RulesEngine = {\n generate: (condition: Condition) => JsonLogicCondition;\n validate: (condition: Condition) => void;\n evaluate: (condition: JsonLogicCondition, data: unknown) => boolean;\n};\n\nexport function createRulesEngine(): RulesEngine {\n /**\n * Transforms a high-level `Condition` object into a JSON Logic-compatible condition.\n *\n * Converts operators like 'is' and 'isNot' into their JSON Logic equivalents ('==' and '!=').\n * Throws an error if the operator is not supported.\n *\n * @param condition - The condition object to convert.\n * @returns A JSON Logic AST representing the condition.\n * @throws {Error} If the operator is not recognized.\n */\n const generate = (condition: Condition): JsonLogicCondition => {\n const { dependsOn, operator, value } = condition;\n const operatorsMap = {\n is: '==',\n isNot: '!=',\n };\n if (!operatorsMap[operator]) {\n throw new Error(`Invalid operator: ${operator}`);\n }\n return { [operatorsMap[operator]]: [{ var: dependsOn }, value] };\n };\n\n /**\n * Validates a condition object against the `ConditionSchema`.\n *\n * Ensures that the condition adheres to the expected structure and types.\n *\n * @param condition - The condition object to validate.\n * @throws {ZodError} If the condition is invalid.\n */\n const validate = (condition: Condition) => {\n ConditionSchema.parse(condition);\n };\n\n /**\n * Evaluates a JSON Logic condition against provided data.\n * @throws {Error} If the condition is invalid.\n */\n const evaluate = (\n condition: jsonLogic.RulesLogic<jsonLogic.AdditionalOperation>,\n data: unknown\n ): boolean => {\n try {\n return jsonLogic.apply(condition, data);\n } catch (err: any) {\n throw new Error(`Invalid condition: ${err.message}`);\n }\n };\n\n return {\n generate,\n validate,\n evaluate,\n };\n}\n"],"names":["ConditionSchema","z","object","dependsOn","string","min","operator","enum","value","union","number","boolean","createRulesEngine","generate","condition","operatorsMap","is","isNot","Error","var","validate","parse","evaluate","data","jsonLogic","apply","err","message"],"mappings":";;;AAGaA,MAAAA,eAAAA,GAAkBC,CAAEC,CAAAA,MAAM,CAAC;AACtCC,IAAAA,SAAAA,EAAWF,CAAEG,CAAAA,MAAM,EAAGC,CAAAA,GAAG,CAAC,CAAA,CAAA;IAC1BC,QAAUL,EAAAA,CAAAA,CAAEM,IAAI,CAAC;AAAC,QAAA,IAAA;AAAM,QAAA;AAAQ,KAAA,CAAA;IAChCC,KAAOP,EAAAA,CAAAA,CAAEQ,KAAK,CAAC;AAACR,QAAAA,CAAAA,CAAEG,MAAM,EAAA;AAAIH,QAAAA,CAAAA,CAAES,MAAM,EAAA;AAAIT,QAAAA,CAAAA,CAAEU,OAAO;AAAG,KAAA;AACtD,CAAG;AAUI,SAASC,iBAAAA,GAAAA;AACd;;;;;;;;;MAUA,MAAMC,WAAW,CAACC,SAAAA,GAAAA;AAChB,QAAA,MAAM,EAAEX,SAAS,EAAEG,QAAQ,EAAEE,KAAK,EAAE,GAAGM,SAAAA;AACvC,QAAA,MAAMC,YAAe,GAAA;YACnBC,EAAI,EAAA,IAAA;YACJC,KAAO,EAAA;AACT,SAAA;AACA,QAAA,IAAI,CAACF,YAAY,CAACT,QAAAA,CAAS,EAAE;AAC3B,YAAA,MAAM,IAAIY,KAAM,CAAA,CAAC,kBAAkB,EAAEZ,SAAS,CAAC,CAAA;AACjD;QACA,OAAO;AAAE,YAAA,CAACS,YAAY,CAAC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