@toyz/loom 0.19.7 → 0.19.8
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/router/index.d.ts +1 -0
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +2 -0
- package/dist/router/index.js.map +1 -1
- package/dist/router/url.d.ts +71 -0
- package/dist/router/url.d.ts.map +1 -0
- package/dist/router/url.js +138 -0
- package/dist/router/url.js.map +1 -0
- package/package.json +1 -1
package/dist/router/index.d.ts
CHANGED
|
@@ -14,4 +14,5 @@ export type { RouterOptions, RouteInfo, RouteTarget } from "./router";
|
|
|
14
14
|
export { LoomOutlet } from "./outlet";
|
|
15
15
|
export { LoomLink } from "./link";
|
|
16
16
|
export { onRouteEnter, onRouteLeave } from "./route-lifecycle";
|
|
17
|
+
export { subdomain, domain, tld } from "./url";
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,KAAK,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpF,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGlD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OA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,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/router/index.js
CHANGED
|
@@ -20,4 +20,6 @@ export { LoomOutlet } from "./outlet";
|
|
|
20
20
|
export { LoomLink } from "./link";
|
|
21
21
|
// Route lifecycle
|
|
22
22
|
export { onRouteEnter, onRouteLeave } from "./route-lifecycle";
|
|
23
|
+
// URL part decorators
|
|
24
|
+
export { subdomain, domain, tld } from "./url";
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
package/dist/router/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO;AACP,OAAO,EAAmB,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhE,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElD,mBAAmB;AACnB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE/E,4EAA4E;AAC5E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,iBAAiB;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,aAAa;AACb,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,kBAAkB;AAClB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO;AACP,OAAO,EAAmB,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhE,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElD,mBAAmB;AACnB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE/E,4EAA4E;AAC5E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,iBAAiB;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,aAAa;AACb,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,kBAAkB;AAClB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,sBAAsB;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loom Router — URL part decorators (TC39 Stage 3)
|
|
3
|
+
*
|
|
4
|
+
* @subdomain — auto-accessor initialised to the subdomain of the current hostname
|
|
5
|
+
* @domain — auto-accessor initialised to the domain label
|
|
6
|
+
* @tld — auto-accessor initialised to the effective TLD (handles .co.uk etc.)
|
|
7
|
+
*
|
|
8
|
+
* These are "set-and-forget" decorators: the value is derived once at
|
|
9
|
+
* construction time from `window.location.hostname` and never changes.
|
|
10
|
+
* No reactive backing, no connect hooks — just override `init()`.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* @subdomain accessor tenant = ""; // "tenant.app.co.uk" → "tenant"
|
|
14
|
+
* @domain accessor host = ""; // "tenant.app.co.uk" → "app"
|
|
15
|
+
* @tld accessor ext = ""; // "tenant.app.co.uk" → "co.uk"
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
interface ParsedHostname {
|
|
19
|
+
subdomain: string;
|
|
20
|
+
domain: string;
|
|
21
|
+
tld: string;
|
|
22
|
+
}
|
|
23
|
+
/** @internal — exported for unit tests only */
|
|
24
|
+
export declare function parseHostname(hostname?: string): ParsedHostname;
|
|
25
|
+
/**
|
|
26
|
+
* Auto-accessor initialised to the subdomain of `window.location.hostname`.
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* @subdomain accessor tenant = "";
|
|
30
|
+
* // tenant.app.com → "tenant"
|
|
31
|
+
* // a.b.app.com → "a.b"
|
|
32
|
+
* // app.com → ""
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const subdomain: <This extends object>(_target: ClassAccessorDecoratorTarget<This, string>, _context: ClassAccessorDecoratorContext<This, string>) => ClassAccessorDecoratorResult<This, string>;
|
|
36
|
+
type DomainMode = "full";
|
|
37
|
+
type DomainDecorator = <This extends object>(target: ClassAccessorDecoratorTarget<This, string>, context: ClassAccessorDecoratorContext<This, string>) => ClassAccessorDecoratorResult<This, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Auto-accessor initialised to the domain label of `window.location.hostname`.
|
|
40
|
+
*
|
|
41
|
+
* Bare form — returns just the domain label:
|
|
42
|
+
* ```ts
|
|
43
|
+
* @domain accessor host = "";
|
|
44
|
+
* // tenant.app.com → "app"
|
|
45
|
+
* // app.com → "app"
|
|
46
|
+
* // localhost → "localhost"
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Factory form `"full"` — returns `domain.tld`:
|
|
50
|
+
* ```ts
|
|
51
|
+
* @domain("full") accessor host = "";
|
|
52
|
+
* // tenant.app.com → "app.com"
|
|
53
|
+
* // a.b.app.co.uk → "app.co.uk"
|
|
54
|
+
* // localhost → "localhost" (no TLD → just the label)
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function domain(mode: DomainMode): DomainDecorator;
|
|
58
|
+
export declare function domain<This extends object>(target: ClassAccessorDecoratorTarget<This, string>, context: ClassAccessorDecoratorContext<This, string>): ClassAccessorDecoratorResult<This, string>;
|
|
59
|
+
/**
|
|
60
|
+
* Auto-accessor initialised to the TLD (last hostname label(s)).
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* @tld accessor ext = "";
|
|
64
|
+
* // tenant.app.com → "com"
|
|
65
|
+
* // app.co.uk → "co.uk"
|
|
66
|
+
* // localhost → ""
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare const tld: <This extends object>(_target: ClassAccessorDecoratorTarget<This, string>, _context: ClassAccessorDecoratorContext<This, string>) => ClassAccessorDecoratorResult<This, string>;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/router/url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAuCH,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAK,MAAM,CAAC;IAClB,GAAG,EAAQ,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,CAsB/D;AA8BD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAnCH,IAAI,SAAS,MAAM,WACzB,4BAA4B,CAAC,IAAI,EAAE,MAAM,CAAC,YACzC,6BAA6B,CAAC,IAAI,EAAE,MAAM,CAAC,KACpD,4BAA4B,CAAC,IAAI,EAAE,MAAM,CAgCD,CAAC;AAI9C,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,KAAK,eAAe,GAAG,CAAC,IAAI,SAAS,MAAM,EACzC,MAAM,EAAE,4BAA4B,CAAC,IAAI,EAAE,MAAM,CAAC,EAClD,OAAO,EAAE,6BAA6B,CAAC,IAAI,EAAE,MAAM,CAAC,KACjD,4BAA4B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAuBhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,eAAe,CAAC;AAC1D,wBAAgB,MAAM,CAAC,IAAI,SAAS,MAAM,EACxC,MAAM,EAAE,4BAA4B,CAAC,IAAI,EAAE,MAAM,CAAC,EAClD,OAAO,EAAE,6BAA6B,CAAC,IAAI,EAAE,MAAM,CAAC,GACnD,4BAA4B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAa9C;;;;;;;;;GASG;AACH,eAAO,MAAM,GAAG,GAjHG,IAAI,SAAS,MAAM,WACzB,4BAA4B,CAAC,IAAI,EAAE,MAAM,CAAC,YACzC,6BAA6B,CAAC,IAAI,EAAE,MAAM,CAAC,KACpD,4BAA4B,CAAC,IAAI,EAAE,MAAM,CA8Gb,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loom Router — URL part decorators (TC39 Stage 3)
|
|
3
|
+
*
|
|
4
|
+
* @subdomain — auto-accessor initialised to the subdomain of the current hostname
|
|
5
|
+
* @domain — auto-accessor initialised to the domain label
|
|
6
|
+
* @tld — auto-accessor initialised to the effective TLD (handles .co.uk etc.)
|
|
7
|
+
*
|
|
8
|
+
* These are "set-and-forget" decorators: the value is derived once at
|
|
9
|
+
* construction time from `window.location.hostname` and never changes.
|
|
10
|
+
* No reactive backing, no connect hooks — just override `init()`.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* @subdomain accessor tenant = ""; // "tenant.app.co.uk" → "tenant"
|
|
14
|
+
* @domain accessor host = ""; // "tenant.app.co.uk" → "app"
|
|
15
|
+
* @tld accessor ext = ""; // "tenant.app.co.uk" → "co.uk"
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
// ── Known 2-part TLDs ─────────────────────────────────────────────────────────
|
|
19
|
+
// Covers the most common compound TLDs without shipping the full PSL (~100 kb).
|
|
20
|
+
// Source: IANA + real-world frequency. Add entries as needed.
|
|
21
|
+
const TWO_PART_TLDS = new Set([
|
|
22
|
+
// UK
|
|
23
|
+
"co.uk", "org.uk", "me.uk", "net.uk", "ltd.uk", "plc.uk", "gov.uk", "sch.uk", "ac.uk", "mod.uk",
|
|
24
|
+
// Australia
|
|
25
|
+
"com.au", "net.au", "org.au", "edu.au", "gov.au", "id.au", "asn.au",
|
|
26
|
+
// New Zealand
|
|
27
|
+
"co.nz", "net.nz", "org.nz", "govt.nz", "school.nz", "ac.nz",
|
|
28
|
+
// Japan
|
|
29
|
+
"co.jp", "ne.jp", "or.jp", "ed.jp", "ac.jp", "go.jp", "ad.jp",
|
|
30
|
+
// Brazil
|
|
31
|
+
"com.br", "net.br", "org.br", "gov.br", "edu.br", "ind.br",
|
|
32
|
+
// India
|
|
33
|
+
"co.in", "net.in", "org.in", "gen.in", "firm.in", "gov.in",
|
|
34
|
+
// South Africa
|
|
35
|
+
"co.za", "net.za", "org.za", "gov.za", "edu.za",
|
|
36
|
+
// South Korea
|
|
37
|
+
"co.kr", "or.kr", "go.kr", "ne.kr", "ac.kr",
|
|
38
|
+
// China
|
|
39
|
+
"com.cn", "net.cn", "org.cn", "gov.cn", "edu.cn", "ac.cn",
|
|
40
|
+
// Hong Kong
|
|
41
|
+
"com.hk", "net.hk", "org.hk", "edu.hk", "gov.hk",
|
|
42
|
+
// Singapore
|
|
43
|
+
"com.sg", "net.sg", "org.sg", "edu.sg", "gov.sg",
|
|
44
|
+
// Malaysia
|
|
45
|
+
"com.my", "net.my", "org.my", "edu.my", "gov.my",
|
|
46
|
+
// Others
|
|
47
|
+
"co.id", "co.th", "com.ph", "com.ar", "net.ar", "com.mx", "com.co",
|
|
48
|
+
"co.ie", "com.cy", "com.pk", "net.pk", "com.sg", "co.tt", "co.ke",
|
|
49
|
+
"com.ng", "com.eg", "com.tr", "com.tw", "com.vn", "com.ua",
|
|
50
|
+
]);
|
|
51
|
+
/** @internal — exported for unit tests only */
|
|
52
|
+
export function parseHostname(hostname) {
|
|
53
|
+
const host = hostname ?? (typeof window !== "undefined" ? window.location.hostname : "");
|
|
54
|
+
const parts = host.split(".");
|
|
55
|
+
if (parts.length === 1) {
|
|
56
|
+
return { subdomain: "", domain: parts[0], tld: "" };
|
|
57
|
+
}
|
|
58
|
+
if (parts.length === 2) {
|
|
59
|
+
return { subdomain: "", domain: parts[0], tld: parts[1] };
|
|
60
|
+
}
|
|
61
|
+
// Check if the last two labels form a known compound TLD (e.g. "co.uk")
|
|
62
|
+
const lastTwo = `${parts[parts.length - 2]}.${parts[parts.length - 1]}`;
|
|
63
|
+
const tldLen = TWO_PART_TLDS.has(lastTwo) ? 2 : 1;
|
|
64
|
+
return {
|
|
65
|
+
tld: parts.slice(-tldLen).join("."),
|
|
66
|
+
domain: parts[parts.length - tldLen - 1],
|
|
67
|
+
subdomain: parts.slice(0, -tldLen - 1).join("."),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// ── Factory & helpers ────────────────────────────────────────────────────────
|
|
71
|
+
function urlPart(part) {
|
|
72
|
+
return function (_target, _context) {
|
|
73
|
+
// Per-instance WeakMap — same lazy-init pattern as @store.
|
|
74
|
+
// hostname is read on the FIRST property access and cached; subsequent
|
|
75
|
+
// reads and any set() calls use the cache directly.
|
|
76
|
+
const storage = new WeakMap();
|
|
77
|
+
return {
|
|
78
|
+
get() {
|
|
79
|
+
if (!storage.has(this)) {
|
|
80
|
+
storage.set(this, parseHostname()[part]);
|
|
81
|
+
}
|
|
82
|
+
return storage.get(this);
|
|
83
|
+
},
|
|
84
|
+
set(value) {
|
|
85
|
+
storage.set(this, value);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// ── Public decorators ─────────────────────────────────────────────────────────
|
|
91
|
+
/**
|
|
92
|
+
* Auto-accessor initialised to the subdomain of `window.location.hostname`.
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* @subdomain accessor tenant = "";
|
|
96
|
+
* // tenant.app.com → "tenant"
|
|
97
|
+
* // a.b.app.com → "a.b"
|
|
98
|
+
* // app.com → ""
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export const subdomain = urlPart("subdomain");
|
|
102
|
+
function makeDomainDecorator(full) {
|
|
103
|
+
const storage = new WeakMap();
|
|
104
|
+
return function (_target, _context) {
|
|
105
|
+
return {
|
|
106
|
+
get() {
|
|
107
|
+
if (!storage.has(this)) {
|
|
108
|
+
const { domain: d, tld: t } = parseHostname();
|
|
109
|
+
storage.set(this, full && t ? `${d}.${t}` : d);
|
|
110
|
+
}
|
|
111
|
+
return storage.get(this);
|
|
112
|
+
},
|
|
113
|
+
set(value) {
|
|
114
|
+
storage.set(this, value);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function domain(targetOrMode, context) {
|
|
120
|
+
if (typeof targetOrMode === "string") {
|
|
121
|
+
// @domain("full") — factory form
|
|
122
|
+
return makeDomainDecorator(true);
|
|
123
|
+
}
|
|
124
|
+
// bare @domain
|
|
125
|
+
return makeDomainDecorator(false)(targetOrMode, context);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Auto-accessor initialised to the TLD (last hostname label(s)).
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* @tld accessor ext = "";
|
|
132
|
+
* // tenant.app.com → "com"
|
|
133
|
+
* // app.co.uk → "co.uk"
|
|
134
|
+
* // localhost → ""
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export const tld = urlPart("tld");
|
|
138
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/router/url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,iFAAiF;AACjF,gFAAgF;AAChF,8DAA8D;AAE9D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,KAAK;IACL,OAAO,EAAC,QAAQ,EAAC,OAAO,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,OAAO,EAAC,QAAQ;IACtF,YAAY;IACZ,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,OAAO,EAAC,QAAQ;IAC7D,cAAc;IACd,OAAO,EAAC,QAAQ,EAAC,QAAQ,EAAC,SAAS,EAAC,WAAW,EAAC,OAAO;IACvD,QAAQ;IACR,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO;IACvD,SAAS;IACT,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ;IACrD,QAAQ;IACR,OAAO,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,SAAS,EAAC,QAAQ;IACrD,eAAe;IACf,OAAO,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ;IAC3C,cAAc;IACd,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,OA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