@solid-labs/fab-one-widget 1.0.4 → 1.0.6
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/{GirthManagerWidget-CwgHrdSO.js → GirthManagerWidget-CwByeFeV.js} +443 -416
- package/dist/{GirthManagerWidget-CwgHrdSO.js.map → GirthManagerWidget-CwByeFeV.js.map} +1 -1
- package/dist/girth-manager-web-widget/src/web-component.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/web-component.js +40 -18
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,13 +19,17 @@ declare class GirthManagerWidgetElement extends HTMLElement {
|
|
|
19
19
|
private _request;
|
|
20
20
|
private _wasmModule;
|
|
21
21
|
private _wasmLoading;
|
|
22
|
+
private _wasmStatus;
|
|
22
23
|
static get observedAttributes(): string[];
|
|
23
24
|
get request(): WidgetRequest | null;
|
|
24
25
|
set request(value: WidgetRequest | string | null);
|
|
25
26
|
/** Set a pre-loaded WASM module (optional — auto-loaded from bundle if not set). */
|
|
26
27
|
get wasmModule(): unknown;
|
|
27
28
|
set wasmModule(value: unknown);
|
|
28
|
-
/**
|
|
29
|
+
/** Current WASM loading status: "idle" | "loading" | "ready" | "error" */
|
|
30
|
+
get wasmStatus(): "error" | "idle" | "loading" | "ready";
|
|
31
|
+
private _setWasmStatus;
|
|
32
|
+
/** Auto-load WASM from the bundled package export with retry */
|
|
29
33
|
private _autoLoadWasm;
|
|
30
34
|
connectedCallback(): void;
|
|
31
35
|
disconnectedCallback(): void;
|
package/dist/index.js
CHANGED
package/dist/web-component.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createElement as
|
|
1
|
+
import { createElement as o } from "react";
|
|
2
2
|
import { createRoot as i } from "react-dom/client";
|
|
3
|
-
import { G as n, __tla as __tla_0 } from "./GirthManagerWidget-
|
|
4
|
-
let
|
|
3
|
+
import { G as n, __tla as __tla_0 } from "./GirthManagerWidget-CwByeFeV.js";
|
|
4
|
+
let u;
|
|
5
5
|
let __tla = Promise.all([
|
|
6
6
|
(() => {
|
|
7
7
|
try {
|
|
@@ -10,9 +10,9 @@ let __tla = Promise.all([
|
|
|
10
10
|
}
|
|
11
11
|
})()
|
|
12
12
|
]).then(async () => {
|
|
13
|
-
|
|
13
|
+
u = class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
15
|
-
super(...arguments), this._root = null, this._request = null, this._wasmModule = void 0, this._wasmLoading = false, this._handleComplete = (t) => {
|
|
15
|
+
super(...arguments), this._root = null, this._request = null, this._wasmModule = void 0, this._wasmLoading = false, this._wasmStatus = "idle", this._handleComplete = (t) => {
|
|
16
16
|
this.dispatchEvent(new CustomEvent("widgetComplete", {
|
|
17
17
|
detail: t,
|
|
18
18
|
bubbles: true,
|
|
@@ -42,16 +42,38 @@ let __tla = Promise.all([
|
|
|
42
42
|
return this._wasmModule;
|
|
43
43
|
}
|
|
44
44
|
set wasmModule(t) {
|
|
45
|
-
this._wasmModule = t, this._render();
|
|
45
|
+
this._wasmModule = t, this._setWasmStatus("ready"), this._render();
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
get wasmStatus() {
|
|
48
|
+
return this._wasmStatus;
|
|
49
|
+
}
|
|
50
|
+
_setWasmStatus(t) {
|
|
51
|
+
this._wasmStatus = t, this.setAttribute("wasm-status", t), this.dispatchEvent(new CustomEvent("wasmStatusChange", {
|
|
52
|
+
detail: {
|
|
53
|
+
status: t
|
|
54
|
+
},
|
|
55
|
+
bubbles: true,
|
|
56
|
+
composed: true
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
async _autoLoadWasm(t = 0) {
|
|
48
60
|
if (!(this._wasmModule || this._wasmLoading)) {
|
|
49
|
-
this._wasmLoading = true;
|
|
61
|
+
this._wasmLoading = true, this._setWasmStatus("loading");
|
|
50
62
|
try {
|
|
51
|
-
const
|
|
52
|
-
await
|
|
53
|
-
} catch (
|
|
54
|
-
|
|
63
|
+
const e = await import("./geo_wasm-CDwm1q1Z.js");
|
|
64
|
+
await e.default(), this._wasmModule = e, this._setWasmStatus("ready"), this._render();
|
|
65
|
+
} catch (e) {
|
|
66
|
+
if (t < 2) {
|
|
67
|
+
const s = (t + 1) * 1e3 + t * 1e3;
|
|
68
|
+
return console.warn(`[GirthManagerWidget] WASM load failed (attempt ${t + 1}/3), retrying in ${s}ms...`, e), this._wasmLoading = false, await new Promise((r) => setTimeout(r, s)), this._autoLoadWasm(t + 1);
|
|
69
|
+
}
|
|
70
|
+
console.error("[GirthManagerWidget] WASM load failed after 3 attempts:", e), this._setWasmStatus("error"), this.dispatchEvent(new CustomEvent("wasmError", {
|
|
71
|
+
detail: {
|
|
72
|
+
error: e instanceof Error ? e.message : String(e)
|
|
73
|
+
},
|
|
74
|
+
bubbles: true,
|
|
75
|
+
composed: true
|
|
76
|
+
}));
|
|
55
77
|
} finally {
|
|
56
78
|
this._wasmLoading = false;
|
|
57
79
|
}
|
|
@@ -66,8 +88,8 @@ let __tla = Promise.all([
|
|
|
66
88
|
"request",
|
|
67
89
|
"wasmModule"
|
|
68
90
|
]) if (Object.prototype.hasOwnProperty.call(this, r)) {
|
|
69
|
-
const
|
|
70
|
-
delete this[r], this[r] =
|
|
91
|
+
const a = this[r];
|
|
92
|
+
delete this[r], this[r] = a;
|
|
71
93
|
}
|
|
72
94
|
const s = this.getAttribute("request");
|
|
73
95
|
if (s && !this._request) try {
|
|
@@ -96,16 +118,16 @@ let __tla = Promise.all([
|
|
|
96
118
|
}
|
|
97
119
|
}
|
|
98
120
|
_render() {
|
|
99
|
-
!this._root || !this._request || this._root.render(
|
|
121
|
+
!this._root || !this._request || this._root.render(o(n, {
|
|
100
122
|
request: this._request,
|
|
101
123
|
onComplete: this._handleComplete,
|
|
102
|
-
wasmModule: this._wasmModule
|
|
124
|
+
wasmModule: this._wasmModule === void 0 && this._wasmStatus === "loading" ? void 0 : this._wasmModule
|
|
103
125
|
}));
|
|
104
126
|
}
|
|
105
127
|
};
|
|
106
|
-
customElements.get("girth-manager-widget") || customElements.define("girth-manager-widget",
|
|
128
|
+
customElements.get("girth-manager-widget") || customElements.define("girth-manager-widget", u);
|
|
107
129
|
});
|
|
108
130
|
export {
|
|
109
|
-
|
|
131
|
+
u as GirthManagerWidgetElement,
|
|
110
132
|
__tla
|
|
111
133
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-component.js","sources":["../src/web-component.ts"],"sourcesContent":["import { createElement } from \"react\"\nimport { createRoot, type Root } from \"react-dom/client\"\nimport { GirthManagerWidget } from \"./GirthManagerWidget\"\nimport type { WidgetRequest, WidgetResponse } from \"./types\"\n\n/**\n * Custom Element wrapper for Angular / vanilla JS integration.\n *\n * WASM is loaded automatically from the bundled package — no manual\n * loading required. Just set the `request` property:\n *\n * Usage in Angular:\n * async ngAfterViewInit() {\n * this.widgetEl.nativeElement.request = { spacing_type: 'BK', scan_url: '...' };\n * }\n *\n * <girth-manager-widget #widgetEl (widgetComplete)=\"onComplete($event)\"></girth-manager-widget>\n *\n * To provide your own WASM module (advanced), set `wasmModule` before `request`.\n */\nclass GirthManagerWidgetElement extends HTMLElement {\n private _root: Root | null = null\n private _request: WidgetRequest | null = null\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _wasmModule: any = undefined\n private _wasmLoading = false\n\n static get observedAttributes() {\n return [\"request\"]\n }\n\n get request(): WidgetRequest | null {\n return this._request\n }\n\n set request(value: WidgetRequest | string | null) {\n if (typeof value === \"string\") {\n try {\n this._request = JSON.parse(value)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON for request attribute:\", value)\n return\n }\n } else {\n this._request = value\n }\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n this._render()\n }\n\n /** Set a pre-loaded WASM module (optional — auto-loaded from bundle if not set). */\n get wasmModule() {\n return this._wasmModule\n }\n\n set wasmModule(value: unknown) {\n this._wasmModule = value\n this._render()\n }\n\n /** Auto-load WASM from the bundled package export */\n private async _autoLoadWasm() {\n if (this._wasmModule || this._wasmLoading) return\n this._wasmLoading = true\n try {\n const wasm = await import(\"geo-wasm\")\n await wasm.default()\n this._wasmModule = wasm\n this._render()\n } catch (err) {\n console.error(\"[GirthManagerWidget] Failed to auto-load WASM:\", err)\n } finally {\n this._wasmLoading = false\n }\n }\n\n connectedCallback() {\n const shadow = this.attachShadow({ mode: \"open\" })\n const container = document.createElement(\"div\")\n container.style.width = \"100%\"\n container.style.height = \"100%\"\n shadow.appendChild(container)\n this._root = createRoot(container)\n\n // Recover properties set before custom element upgrade.\n // When the element is created in HTML before customElements.define() runs,\n // property assignments (el.request = {...}) become own-properties on the\n // HTMLElement instance and bypass the class setters. We must pick them up.\n for (const prop of [\"request\", \"wasmModule\"] as const) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = (this as any)[prop]\n delete (this as any)[prop] // remove own-property so setter is reachable\n ;(this as any)[prop] = value // re-assign through the class setter\n }\n }\n\n // Parse request from attribute if set before connection\n const attrValue = this.getAttribute(\"request\")\n if (attrValue && !this._request) {\n try {\n this._request = JSON.parse(attrValue)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n\n this._render()\n }\n\n disconnectedCallback() {\n this._root?.unmount()\n this._root = null\n }\n\n /**\n * Reset the widget to its initial state without removing it from the DOM.\n * Unmounts and re-mounts the React tree, clearing all internal state\n * (Zustand store, WASM memory, landmarks, measurements).\n *\n * Usage in Angular:\n * this.widgetEl.nativeElement.reset();\n * this.widgetEl.nativeElement.request = { ... }; // re-initialize\n */\n reset() {\n if (!this._root) return\n // Unmount the current React tree (clears all component state)\n this._root.unmount()\n // Re-create the root on the same container\n const container = this.shadowRoot?.querySelector(\"div\")\n if (container) {\n this._root = createRoot(container)\n }\n this._request = null\n // Keep _wasmModule — it's reusable across resets\n }\n\n attributeChangedCallback(name: string, _oldValue: string, newValue: string) {\n if (name === \"request\" && newValue) {\n try {\n this._request = JSON.parse(newValue)\n this._render()\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n }\n\n private _handleComplete = (response: WidgetResponse) => {\n this.dispatchEvent(\n new CustomEvent(\"widgetComplete\", {\n detail: response,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n private _render() {\n if (!this._root || !this._request) return\n\n this._root.render(\n createElement(GirthManagerWidget, {\n request: this._request,\n onComplete: this._handleComplete,\n wasmModule: this._wasmModule,\n })\n )\n }\n}\n\n// Register the custom element\nif (!customElements.get(\"girth-manager-widget\")) {\n customElements.define(\"girth-manager-widget\", GirthManagerWidgetElement)\n}\n\nexport { GirthManagerWidgetElement }\nexport type { WidgetRequest, WidgetResponse }\n"],"names":["GirthManagerWidgetElement","response","value","wasm","err","shadow","container","createRoot","prop","attrValue","name","_oldValue","newValue","createElement","GirthManagerWidget"],"mappings":";;;AAoBA,MAAMA,UAAkC,YAAY;AAAA,EAApD,cAAA;AAAA,UAAA,GAAA,SAAA,GACI,KAAQ,QAAqB,MAC7B,KAAQ,WAAiC,MAEzC,KAAQ,cAAmB,QAC3B,KAAQ,eAAe,IAkIvB,KAAQ,kBAAkB,CAACC,MAA6B;AACpD,WAAK;AAAA,QACD,IAAI,YAAY,kBAAkB;AAAA,UAC9B,QAAQA;AAAA,UACR,SAAS;AAAA,UACT,UAAU;AAAA,QAAA,CACb;AAAA,MAAA;AAAA,IAET;AAAA,EAAA;AAAA,EAxIA,WAAW,qBAAqB;AAC5B,WAAO,CAAC,SAAS;AAAA,EACrB;AAAA,EAEA,IAAI,UAAgC;AAChC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,QAAQC,GAAsC;AAC9C,QAAI,OAAOA,KAAU;AACjB,UAAI;AACA,aAAK,WAAW,KAAK,MAAMA,CAAK;AAAA,MACpC,QAAQ;AACJ,gBAAQ,MAAM,4DAA4DA,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ACvB,KAAK,cAAA,GAGT,KAAK,QAAA;AAAA,EACT;AAAA,EAEA,uBAAuB;AACnB,SAAK,OAAO,QAAA,GACZ,KAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,QAAQ;AACJ,QAAI,CAAC,KAAK,MAAO;AAEjB,SAAK,MAAM,QAAA;AAEX,UAAMH,IAAY,KAAK,YAAY,cAAc,KAAK;AACtD,IAAIA,MACA,KAAK,QAAQC,EAAWD,CAAS,IAErC,KAAK,WAAW;AAAA,EAEpB;AAAA,EAEA,yBAAyBI,GAAcC,GAAmBC,GAAkB;AACxE,QAAIF,MAAS,aAAaE;AACtB,UAAI;AACA,aAAK,WAAW,KAAK,MAAMA,CAAQ,GACnC,KAAK,QAAA;AAAA,MACT,QAAQ;AACJ,gBAAQ,MAAM,wDAAwD;AAAA,MAC1E;AAAA,EAER;AAAA,EAYQ,UAAU;AACd,IAAI,CAAC,KAAK,SAAS,CAAC,KAAK,YAEzB,KAAK,MAAM;AAAA,MACPC,EAAcC,GAAoB;AAAA,QAC9B,SAAS,KAAK;AAAA,QACd,YAAY,KAAK;AAAA,QACjB,YAAY,KAAK;AAAA,MAAA,CACpB;AAAA,IAAA;AAAA,EAET;AACJ;AAGK,eAAe,IAAI,sBAAsB,KAC1C,eAAe,OAAO,wBAAwBd,CAAyB;"}
|
|
1
|
+
{"version":3,"file":"web-component.js","sources":["../src/web-component.ts"],"sourcesContent":["import { createElement } from \"react\"\nimport { createRoot, type Root } from \"react-dom/client\"\nimport { GirthManagerWidget } from \"./GirthManagerWidget\"\nimport type { WidgetRequest, WidgetResponse } from \"./types\"\n\n/**\n * Custom Element wrapper for Angular / vanilla JS integration.\n *\n * WASM is loaded automatically from the bundled package — no manual\n * loading required. Just set the `request` property:\n *\n * Usage in Angular:\n * async ngAfterViewInit() {\n * this.widgetEl.nativeElement.request = { spacing_type: 'BK', scan_url: '...' };\n * }\n *\n * <girth-manager-widget #widgetEl (widgetComplete)=\"onComplete($event)\"></girth-manager-widget>\n *\n * To provide your own WASM module (advanced), set `wasmModule` before `request`.\n */\nclass GirthManagerWidgetElement extends HTMLElement {\n private _root: Root | null = null\n private _request: WidgetRequest | null = null\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _wasmModule: any = undefined\n private _wasmLoading = false\n private _wasmStatus: \"idle\" | \"loading\" | \"ready\" | \"error\" = \"idle\"\n\n static get observedAttributes() {\n return [\"request\"]\n }\n\n get request(): WidgetRequest | null {\n return this._request\n }\n\n set request(value: WidgetRequest | string | null) {\n if (typeof value === \"string\") {\n try {\n this._request = JSON.parse(value)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON for request attribute:\", value)\n return\n }\n } else {\n this._request = value\n }\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n this._render()\n }\n\n /** Set a pre-loaded WASM module (optional — auto-loaded from bundle if not set). */\n get wasmModule() {\n return this._wasmModule\n }\n\n set wasmModule(value: unknown) {\n this._wasmModule = value\n this._setWasmStatus(\"ready\")\n this._render()\n }\n\n /** Current WASM loading status: \"idle\" | \"loading\" | \"ready\" | \"error\" */\n get wasmStatus() {\n return this._wasmStatus\n }\n\n private _setWasmStatus(status: typeof this._wasmStatus) {\n this._wasmStatus = status\n this.setAttribute(\"wasm-status\", status)\n this.dispatchEvent(new CustomEvent(\"wasmStatusChange\", {\n detail: { status },\n bubbles: true,\n composed: true,\n }))\n }\n\n /** Auto-load WASM from the bundled package export with retry */\n private async _autoLoadWasm(attempt = 0): Promise<void> {\n if (this._wasmModule || this._wasmLoading) return\n this._wasmLoading = true\n this._setWasmStatus(\"loading\")\n try {\n const wasm = await import(\"geo-wasm\")\n await wasm.default()\n this._wasmModule = wasm\n this._setWasmStatus(\"ready\")\n this._render()\n } catch (err) {\n if (attempt < 2) {\n // Retry after backoff: 1s, 3s\n const delay = (attempt + 1) * 1000 + attempt * 1000\n console.warn(`[GirthManagerWidget] WASM load failed (attempt ${attempt + 1}/3), retrying in ${delay}ms...`, err)\n this._wasmLoading = false\n await new Promise(r => setTimeout(r, delay))\n return this._autoLoadWasm(attempt + 1)\n }\n console.error(\"[GirthManagerWidget] WASM load failed after 3 attempts:\", err)\n this._setWasmStatus(\"error\")\n this.dispatchEvent(new CustomEvent(\"wasmError\", {\n detail: { error: err instanceof Error ? err.message : String(err) },\n bubbles: true,\n composed: true,\n }))\n } finally {\n this._wasmLoading = false\n }\n }\n\n connectedCallback() {\n const shadow = this.attachShadow({ mode: \"open\" })\n const container = document.createElement(\"div\")\n container.style.width = \"100%\"\n container.style.height = \"100%\"\n shadow.appendChild(container)\n this._root = createRoot(container)\n\n // Recover properties set before custom element upgrade.\n // When the element is created in HTML before customElements.define() runs,\n // property assignments (el.request = {...}) become own-properties on the\n // HTMLElement instance and bypass the class setters. We must pick them up.\n for (const prop of [\"request\", \"wasmModule\"] as const) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = (this as any)[prop]\n delete (this as any)[prop] // remove own-property so setter is reachable\n ;(this as any)[prop] = value // re-assign through the class setter\n }\n }\n\n // Parse request from attribute if set before connection\n const attrValue = this.getAttribute(\"request\")\n if (attrValue && !this._request) {\n try {\n this._request = JSON.parse(attrValue)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n\n this._render()\n }\n\n disconnectedCallback() {\n this._root?.unmount()\n this._root = null\n }\n\n /**\n * Reset the widget to its initial state without removing it from the DOM.\n * Unmounts and re-mounts the React tree, clearing all internal state\n * (Zustand store, WASM memory, landmarks, measurements).\n *\n * Usage in Angular:\n * this.widgetEl.nativeElement.reset();\n * this.widgetEl.nativeElement.request = { ... }; // re-initialize\n */\n reset() {\n if (!this._root) return\n // Unmount the current React tree (clears all component state)\n this._root.unmount()\n // Re-create the root on the same container\n const container = this.shadowRoot?.querySelector(\"div\")\n if (container) {\n this._root = createRoot(container)\n }\n this._request = null\n // Keep _wasmModule — it's reusable across resets\n }\n\n attributeChangedCallback(name: string, _oldValue: string, newValue: string) {\n if (name === \"request\" && newValue) {\n try {\n this._request = JSON.parse(newValue)\n this._render()\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n }\n\n private _handleComplete = (response: WidgetResponse) => {\n this.dispatchEvent(\n new CustomEvent(\"widgetComplete\", {\n detail: response,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n private _render() {\n if (!this._root || !this._request) return\n\n this._root.render(\n createElement(GirthManagerWidget, {\n request: this._request,\n onComplete: this._handleComplete,\n // Pass undefined while loading so GirthManagerCore shows \"Loading WASM...\"\n // Pass null only if consumer explicitly set wasmModule=null (JS fallback)\n wasmModule: this._wasmModule === undefined && this._wasmStatus === \"loading\"\n ? undefined\n : this._wasmModule,\n })\n )\n }\n}\n\n// Register the custom element\nif (!customElements.get(\"girth-manager-widget\")) {\n customElements.define(\"girth-manager-widget\", GirthManagerWidgetElement)\n}\n\nexport { GirthManagerWidgetElement }\nexport type { WidgetRequest, WidgetResponse }\n"],"names":["GirthManagerWidgetElement","response","value","status","attempt","wasm","err","delay","shadow","container","createRoot","prop","attrValue","name","_oldValue","newValue","createElement","GirthManagerWidget"],"mappings":";;;AAoBA,MAAMA,UAAkC,YAAY;AAAA,EAApD,cAAA;AAAA,UAAA,GAAA,SAAA,GACI,KAAQ,QAAqB,MAC7B,KAAQ,WAAiC,MAEzC,KAAQ,cAAmB,QAC3B,KAAQ,eAAe,IACvB,KAAQ,cAAsD,QAkK9D,KAAQ,kBAAkB,CAACC,MAA6B;AACpD,WAAK;AAAA,QACD,IAAI,YAAY,kBAAkB;AAAA,UAC9B,QAAQA;AAAA,UACR,SAAS;AAAA,UACT,UAAU;AAAA,QAAA,CACb;AAAA,MAAA;AAAA,IAET;AAAA,EAAA;AAAA,EAxKA,WAAW,qBAAqB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