mirage-engine 0.3.20 → 0.3.22

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.
@@ -1,47 +1,47 @@
1
- var Xe = Object.defineProperty, Ve = Object.defineProperties;
2
- var Ye = Object.getOwnPropertyDescriptors;
3
- var Ee = Object.getOwnPropertySymbols;
4
- var We = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
5
- var ye = (s, e, t) => e in s ? Xe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, te = (s, e) => {
6
- for (var t in e || (e = {}))
7
- We.call(e, t) && ye(s, t, e[t]);
8
- if (Ee)
9
- for (var t of Ee(e))
10
- He.call(e, t) && ye(s, t, e[t]);
11
- return s;
12
- }, Ce = (s, e) => Ve(s, Ye(e));
13
- var u = (s, e, t) => (ye(s, typeof e != "symbol" ? e + "" : e, t), t);
14
- var Te = (s, e, t) => new Promise((i, r) => {
15
- var c = (l) => {
1
+ var Ce = Object.defineProperty, Be = Object.defineProperties;
2
+ var de = Object.getOwnPropertyDescriptors;
3
+ var jA = Object.getOwnPropertySymbols;
4
+ var Ee = Object.prototype.hasOwnProperty, Qe = Object.prototype.propertyIsEnumerable;
5
+ var RA = (t, A, e) => A in t ? Ce(t, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[A] = e, aA = (t, A) => {
6
+ for (var e in A || (A = {}))
7
+ Ee.call(A, e) && RA(t, e, A[e]);
8
+ if (jA)
9
+ for (var e of jA(A))
10
+ Qe.call(A, e) && RA(t, e, A[e]);
11
+ return t;
12
+ }, qA = (t, A) => Be(t, de(A));
13
+ var l = (t, A, e) => (RA(t, typeof A != "symbol" ? A + "" : A, e), e);
14
+ var eA = (t, A, e) => new Promise((s, i) => {
15
+ var o = (n) => {
16
16
  try {
17
- a(t.next(l));
18
- } catch (o) {
19
- r(o);
17
+ g(e.next(n));
18
+ } catch (a) {
19
+ i(a);
20
20
  }
21
- }, n = (l) => {
21
+ }, r = (n) => {
22
22
  try {
23
- a(t.throw(l));
24
- } catch (o) {
25
- r(o);
23
+ g(e.throw(n));
24
+ } catch (a) {
25
+ i(a);
26
26
  }
27
- }, a = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(c, n);
28
- a((t = t.apply(s, e)).next());
27
+ }, g = (n) => n.done ? s(n.value) : Promise.resolve(n.value).then(o, r);
28
+ g((e = e.apply(t, A)).next());
29
29
  });
30
- import * as w from "three";
31
- const Ie = {
30
+ import * as E from "three";
31
+ const iA = 5, LA = 0, mA = 1, pA = 2, ie = 3, re = 4, se = {
32
32
  INCLUDE_TREE: "include-tree",
33
33
  EXCLUDE_TREE: "exclude-tree",
34
34
  INCLUDE_SELF: "include-self",
35
35
  EXCLUDE_SELF: "exclude-self",
36
36
  END: "end"
37
- }, ee = {
37
+ }, tA = {
38
38
  NAME: "data-mirage-dom",
39
39
  KEY: "mirageDom",
40
40
  VALUES: {
41
41
  HIDE: "hide",
42
42
  SHOW: "show"
43
43
  }
44
- }, Re = {
44
+ }, VA = {
45
45
  TRAVELER: "traveler",
46
46
  NATIVE: "native",
47
47
  CAPTURE_1: "1",
@@ -54,78 +54,78 @@ const Ie = {
54
54
  CAPTURE_8: "8",
55
55
  CAPTURE_9: "9",
56
56
  CAPTURE_10: "10"
57
- }, N = {
57
+ }, H = {
58
58
  NAME: "data-mirage-travel",
59
59
  KEY: "mirageTravel",
60
- VALUES: Re,
61
- MAX_LAYERS: Object.keys(Re).length - 1
62
- }, P = {
60
+ VALUES: VA,
61
+ MAX_LAYERS: Object.keys(VA).length - 1
62
+ }, j = {
63
63
  NAME: "data-mirage-filter",
64
64
  KEY: "mirageFilter",
65
- VALUES: Ie
66
- }, q = {
65
+ VALUES: se
66
+ }, Z = {
67
67
  NAME: "data-mirage-select",
68
68
  KEY: "mirageSelect",
69
- VALUES: Ie
70
- }, Pe = {
69
+ VALUES: se
70
+ }, ue = {
71
71
  NAME: "data-mirage-shader",
72
72
  KEY: "mirageShader"
73
- }, Le = {
73
+ }, ZA = {
74
74
  NAME: "data-mirage-sandwich",
75
75
  KEY: "mirageSandwich",
76
76
  VALUES: {
77
77
  FRONT: "front"
78
78
  }
79
- }, ge = 0, re = 1, ue = 2, $e = 4, pe = 8, be = 16;
80
- function Ge(s) {
81
- const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
82
- return e ? {
83
- r: parseInt(e[1]) / 255,
84
- g: parseInt(e[2]) / 255,
85
- b: parseInt(e[3]) / 255,
86
- a: e[4] !== void 0 ? parseFloat(e[4]) : 1
79
+ }, DA = 0, nA = 1, fA = 2, fe = 4, SA = 8, TA = 16;
80
+ function we(t) {
81
+ const A = t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
82
+ return A ? {
83
+ r: parseInt(A[1]) / 255,
84
+ g: parseInt(A[2]) / 255,
85
+ b: parseInt(A[3]) / 255,
86
+ a: A[4] !== void 0 ? parseFloat(A[4]) : 1
87
87
  } : { r: 1, g: 1, b: 1, a: 1 };
88
88
  }
89
- function qe(s) {
90
- const e = {};
91
- if (s.opacity && (e.opacity = parseFloat(s.opacity)), s.backgroundColor) {
92
- const t = Ge(s.backgroundColor);
93
- e.backgroundColor = [t.r, t.g, t.b, t.a];
89
+ function me(t) {
90
+ const A = {};
91
+ if (t.opacity && (A.opacity = parseFloat(t.opacity)), t.backgroundColor) {
92
+ const e = we(t.backgroundColor);
93
+ A.backgroundColor = [e.r, e.g, e.b, e.a];
94
94
  }
95
- if (s.backgroundImage ? e.backgroundImage = s.backgroundImage : s.background && (e.backgroundImage = s.background), s.boxShadow && (e.boxShadow = s.boxShadow), s.borderRadius && (e.borderRadius = parseFloat(s.borderRadius)), s.width && (e.width = parseFloat(s.width)), s.height && (e.height = parseFloat(s.height)), s.transform && s.transform !== "none") {
96
- const t = new DOMMatrix(s.transform);
97
- e.x = t.m41, e.y = t.m42, e.z = t.m43;
95
+ if (t.backgroundImage ? A.backgroundImage = t.backgroundImage : t.background && (A.backgroundImage = t.background), t.boxShadow && (A.boxShadow = t.boxShadow), t.borderRadius && (A.borderRadius = parseFloat(t.borderRadius)), t.width && (A.width = parseFloat(t.width)), t.height && (A.height = parseFloat(t.height)), t.transform && t.transform !== "none") {
96
+ const e = new DOMMatrix(t.transform);
97
+ A.x = e.m41, A.y = e.m42, A.z = e.m43, A.scaleX = Math.sqrt(e.m11 * e.m11 + e.m12 * e.m12 + e.m13 * e.m13), A.scaleY = Math.sqrt(e.m21 * e.m21 + e.m22 * e.m22 + e.m23 * e.m23), A.scaleZ = Math.sqrt(e.m31 * e.m31 + e.m32 * e.m32 + e.m33 * e.m33);
98
98
  }
99
- return e;
99
+ return (t.left || t.right || t.top || t.bottom || t.margin || t.marginLeft || t.marginTop || t.marginRight || t.marginBottom || t.padding || t.paddingLeft || t.paddingTop || t.paddingRight || t.paddingBottom) && (A.layoutChanged = !0), A;
100
100
  }
101
- class Be {
102
- constructor(e, t) {
103
- u(this, "target");
104
- u(this, "observer");
105
- u(this, "pendingDeletions", /* @__PURE__ */ new Set());
106
- u(this, "pendingStyles", /* @__PURE__ */ new Map());
107
- u(this, "isDomDirty", !1);
108
- u(this, "isRunning", !1);
109
- u(this, "pendingMask", ge);
110
- u(this, "mutationTimer", null);
111
- u(this, "cssTimer", null);
112
- u(this, "resizeConfig");
113
- u(this, "resizeTimer", null);
114
- u(this, "isResizing", !1);
115
- u(this, "lastScrollX", 0);
116
- u(this, "lastScrollY", 0);
117
- u(this, "scrollTimer", null);
118
- u(this, "onBeforeRender", /* @__PURE__ */ new Set());
119
- u(this, "onLayoutChange", /* @__PURE__ */ new Set());
120
- u(this, "onStyleChange", /* @__PURE__ */ new Set());
121
- u(this, "onScrollChange", /* @__PURE__ */ new Set());
122
- u(this, "onRender", /* @__PURE__ */ new Set());
123
- u(this, "onTransitionFinished", (e) => {
124
- this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= re | ue, this.cssTimer = window.setTimeout(() => {
101
+ class oe {
102
+ constructor(A, e) {
103
+ l(this, "target");
104
+ l(this, "observer");
105
+ l(this, "pendingDeletions", /* @__PURE__ */ new Set());
106
+ l(this, "pendingStyles", /* @__PURE__ */ new Map());
107
+ l(this, "isDomDirty", !1);
108
+ l(this, "isRunning", !1);
109
+ l(this, "pendingMask", DA);
110
+ l(this, "mutationTimer", null);
111
+ l(this, "cssTimer", null);
112
+ l(this, "resizeConfig");
113
+ l(this, "resizeTimer", null);
114
+ l(this, "isResizing", !1);
115
+ l(this, "lastScrollX", 0);
116
+ l(this, "lastScrollY", 0);
117
+ l(this, "scrollTimer", null);
118
+ l(this, "onBeforeRender", /* @__PURE__ */ new Set());
119
+ l(this, "onLayoutChange", /* @__PURE__ */ new Set());
120
+ l(this, "onStyleChange", /* @__PURE__ */ new Set());
121
+ l(this, "onScrollChange", /* @__PURE__ */ new Set());
122
+ l(this, "onRender", /* @__PURE__ */ new Set());
123
+ l(this, "onTransitionFinished", (A) => {
124
+ this.target.contains(A.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= nA | fA, this.cssTimer = window.setTimeout(() => {
125
125
  this.isDomDirty = !0, this.cssTimer = null;
126
126
  }, 50)));
127
127
  });
128
- u(this, "onWindowResize", () => {
128
+ l(this, "onWindowResize", () => {
129
129
  if (!this.resizeConfig.enabled) {
130
130
  this.isDomDirty = !0;
131
131
  return;
@@ -134,41 +134,41 @@ class Be {
134
134
  this.isDomDirty = !0, this.resizeConfig.onEnd && this.resizeConfig.onEnd(), this.isResizing = !1, this.resizeTimer = null;
135
135
  }, this.resizeConfig.delay);
136
136
  });
137
- u(this, "renderLoop", () => {
137
+ l(this, "renderLoop", () => {
138
138
  if (!this.isRunning)
139
139
  return;
140
- this.onBeforeRender.forEach((i) => i()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((i) => i(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = ge);
141
- const e = window.scrollX, t = window.scrollY;
142
- (e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((i) => i(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
143
- this.pendingMask |= re, this.isDomDirty = !0, this.scrollTimer = null;
144
- }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((i) => i(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((i) => i()), requestAnimationFrame(this.renderLoop);
140
+ this.onBeforeRender.forEach((s) => s()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((s) => s(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = DA);
141
+ const A = window.scrollX, e = window.scrollY;
142
+ (A !== this.lastScrollX || e !== this.lastScrollY) && (this.onScrollChange.forEach((s) => s(A, e)), this.lastScrollX = A, this.lastScrollY = e, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
143
+ this.pendingMask |= nA, this.isDomDirty = !0, this.scrollTimer = null;
144
+ }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((s) => s(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((s) => s()), requestAnimationFrame(this.renderLoop);
145
145
  });
146
- var r, c;
147
- this.target = e;
148
- const i = (r = t.resizeDebounce) != null ? r : !0;
149
- i === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : i === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
146
+ var i, o;
147
+ this.target = A;
148
+ const s = (i = e.resizeDebounce) != null ? i : !0;
149
+ s === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : s === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
150
150
  enabled: !0,
151
- delay: (c = i.delay) != null ? c : 150,
152
- onStart: i.onStart,
153
- onEnd: i.onEnd
154
- }, this.observer = new MutationObserver((n) => {
155
- let a = ge;
156
- for (const l of n)
157
- if (l.type === "childList")
158
- a |= pe, l.removedNodes.length > 0 && l.removedNodes.forEach((o) => {
159
- o instanceof HTMLElement && this.pendingDeletions.add(o);
151
+ delay: (o = s.delay) != null ? o : 150,
152
+ onStart: s.onStart,
153
+ onEnd: s.onEnd
154
+ }, this.observer = new MutationObserver((r) => {
155
+ let g = DA;
156
+ for (const n of r)
157
+ if (n.type === "childList")
158
+ g |= SA, n.removedNodes.length > 0 && n.removedNodes.forEach((a) => {
159
+ a instanceof HTMLElement && this.pendingDeletions.add(a);
160
160
  });
161
- else if (l.type === "attributes")
162
- if (l.attributeName === "style") {
163
- a |= re | ue;
164
- const o = l.target, f = qe(o.style);
165
- this.pendingStyles.set(o, f);
161
+ else if (n.type === "attributes")
162
+ if (n.attributeName === "style") {
163
+ g |= nA | fA;
164
+ const a = n.target, I = me(a.style);
165
+ this.pendingStyles.set(a, I);
166
166
  } else
167
- l.attributeName === "class" ? a |= re | ue : l.attributeName && l.attributeName.startsWith("data-") && (a |= re | ue, l.attributeName.startsWith("data-mirage") && (a |= pe));
167
+ n.attributeName === "class" ? g |= nA | fA : n.attributeName && n.attributeName.startsWith("data-") && (g |= nA | fA, n.attributeName.startsWith("data-mirage") && (g |= SA));
168
168
  else
169
- l.type === "characterData" && (a |= be | re);
170
- if (a !== ge) {
171
- if (this.pendingMask |= a, a & pe) {
169
+ n.type === "characterData" && (g |= TA | nA);
170
+ if (g !== DA) {
171
+ if (this.pendingMask |= g, g & SA) {
172
172
  this.clearTimers(), this.isDomDirty = !0;
173
173
  return;
174
174
  }
@@ -193,187 +193,187 @@ class Be {
193
193
  this.mutationTimer && (clearTimeout(this.mutationTimer), this.mutationTimer = null), this.cssTimer && (clearTimeout(this.cssTimer), this.cssTimer = null), this.scrollTimer && (clearTimeout(this.scrollTimer), this.scrollTimer = null);
194
194
  }
195
195
  }
196
- const $ = 1, ae = 2, O = {
196
+ const q = 1, lA = 2, L = {
197
197
  BASE: 0,
198
198
  SELECTED: 1,
199
- getCaptureLayer: (s) => 31 - s,
199
+ getCaptureLayer: (t) => 31 - t,
200
200
  HIDDEN: 31
201
- }, Me = Object.values(P.VALUES);
202
- class Ue {
201
+ }, PA = Object.values(j.VALUES);
202
+ class ae {
203
203
  /**
204
204
  * Calculates or retrieves the exact alphabetic baseline (in pixels) for the given font.
205
205
  * @param font CSS font shorthand string (e.g., "400 16px Inter")
206
206
  * @returns Baseline Y offset in pixels
207
207
  */
208
- static getBaseline(e) {
209
- if (this.cache.has(e))
210
- return this.cache.get(e);
211
- const t = this.calculateBaselineFromDOM(e);
212
- return this.cache.set(e, t), t;
208
+ static getBaseline(A) {
209
+ if (this.cache.has(A))
210
+ return this.cache.get(A);
211
+ const e = this.calculateBaselineFromDOM(A);
212
+ return this.cache.set(A, e), e;
213
213
  }
214
- static calculateBaselineFromDOM(e) {
214
+ static calculateBaselineFromDOM(A) {
215
215
  if (typeof document == "undefined")
216
216
  return 0;
217
- const t = document.createElement("div"), i = document.createElement("span"), r = document.createElement("img");
218
- t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none", i.style.margin = "0", i.style.padding = "0", i.style.border = "none", i.style.lineHeight = "normal", r.width = 1, r.height = 1, r.style.verticalAlign = "baseline", i.appendChild(document.createTextNode("Hidden Text")), t.appendChild(i), t.appendChild(r), document.body.appendChild(t);
219
- const c = r.offsetTop - i.offsetTop;
220
- return document.body.removeChild(t), c;
217
+ const e = document.createElement("div"), s = document.createElement("span"), i = document.createElement("img");
218
+ e.style.visibility = "hidden", e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.style.font = A, e.style.margin = "0", e.style.padding = "0", e.style.border = "none", s.style.margin = "0", s.style.padding = "0", s.style.border = "none", s.style.lineHeight = "normal", i.width = 1, i.height = 1, i.style.verticalAlign = "baseline", s.appendChild(document.createTextNode("Hidden Text")), e.appendChild(s), e.appendChild(i), document.body.appendChild(e);
219
+ const o = i.offsetTop - s.offsetTop;
220
+ return document.body.removeChild(e), o;
221
221
  }
222
222
  }
223
- u(Ue, "cache", /* @__PURE__ */ new Map());
224
- class je extends w.MeshBasicMaterial {
225
- constructor(t, i, r, c, n = 2) {
223
+ l(ae, "cache", /* @__PURE__ */ new Map());
224
+ class pe extends E.MeshBasicMaterial {
225
+ constructor(e, s, i, o, r = 2) {
226
226
  super({
227
227
  transparent: !0,
228
- side: w.FrontSide,
228
+ side: E.FrontSide,
229
229
  color: 16777215
230
230
  });
231
- u(this, "canvas");
232
- u(this, "ctx");
233
- u(this, "qualityFactor");
231
+ l(this, "canvas");
232
+ l(this, "ctx");
233
+ l(this, "qualityFactor");
234
234
  if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
235
235
  throw new Error("[Mirage] Failed to create canvas context");
236
- this.qualityFactor = n, this.map = new w.CanvasTexture(this.canvas), this.map.colorSpace = w.LinearSRGBColorSpace, this.map.minFilter = w.LinearFilter, this.map.magFilter = w.LinearFilter, this.updateText(t, i, r, c);
237
- }
238
- wrapText(t, i) {
239
- const r = t.split(`
240
- `), c = [];
241
- return r.forEach((n) => {
242
- const a = n.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
- if (a.length === 0) {
244
- c.push("");
236
+ this.qualityFactor = r, this.map = new E.CanvasTexture(this.canvas), this.map.colorSpace = E.LinearSRGBColorSpace, this.map.minFilter = E.LinearFilter, this.map.magFilter = E.LinearFilter, this.updateText(e, s, i, o);
237
+ }
238
+ wrapText(e, s) {
239
+ const i = e.split(`
240
+ `), o = [];
241
+ return i.forEach((r) => {
242
+ const g = r.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
+ if (g.length === 0) {
244
+ o.push("");
245
245
  return;
246
246
  }
247
- let l = a[0];
248
- for (let o = 1; o < a.length; o++) {
249
- const f = a[o];
250
- this.ctx.measureText(l + f).width <= i + 2 ? l += f : (l && c.push(l), l = f.trimStart());
247
+ let n = g[0];
248
+ for (let a = 1; a < g.length; a++) {
249
+ const I = g[a];
250
+ this.ctx.measureText(n + I).width <= s + 2 ? n += I : (n && o.push(n), n = I.trimStart());
251
251
  }
252
- l && c.push(l);
253
- }), c;
254
- }
255
- updateText(t, i, r, c, n) {
256
- n !== void 0 && (this.qualityFactor = n);
257
- const l = (window.devicePixelRatio || 1) * this.qualityFactor, o = r * l, f = c * l;
258
- this.canvas.width !== o || this.canvas.height !== f ? (this.canvas.width = o, this.canvas.height = f) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(l, 0, 0, l, 0, 0), this.ctx.font = i.font, this.ctx.fillStyle = i.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
259
- const h = this.wrapText(t, r), d = i.lineHeight, p = Ue.getBaseline(i.font);
260
- h.forEach((g, M) => {
261
- const m = M * d + p;
252
+ n && o.push(n);
253
+ }), o;
254
+ }
255
+ updateText(e, s, i, o, r) {
256
+ r !== void 0 && (this.qualityFactor = r);
257
+ const n = (window.devicePixelRatio || 1) * this.qualityFactor, a = i * n, I = o * n;
258
+ this.canvas.width !== a || this.canvas.height !== I ? (this.canvas.width = a, this.canvas.height = I) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(n, 0, 0, n, 0, 0), this.ctx.font = s.font, this.ctx.fillStyle = s.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
259
+ const c = this.wrapText(e, i), h = s.lineHeight, B = ae.getBaseline(s.font);
260
+ c.forEach((C, w) => {
261
+ const Q = w * h + B;
262
262
  let b = 0;
263
- i.textAlign === "center" ? b = r / 2 : i.textAlign === "right" && (b = r), this.ctx.textAlign = i.textAlign, this.ctx.fillText(g, b, m);
263
+ s.textAlign === "center" ? b = i / 2 : s.textAlign === "right" && (b = i), this.ctx.textAlign = s.textAlign, this.ctx.fillText(C, b, Q);
264
264
  }), this.map && (this.map.needsUpdate = !0);
265
265
  }
266
266
  dispose() {
267
267
  this.map && this.map.dispose(), super.dispose();
268
268
  }
269
269
  }
270
- function le(s, e = 0) {
271
- if (typeof s == "number")
272
- return s;
273
- const t = parseFloat(s) || 0;
274
- return typeof s == "string" && s.includes("%") ? t / 100 * e : t;
270
+ function hA(t, A = 0) {
271
+ if (typeof t == "number")
272
+ return t;
273
+ const e = parseFloat(t) || 0;
274
+ return typeof t == "string" && t.includes("%") ? e / 100 * A : e;
275
275
  }
276
- function ce(s) {
277
- if (!s || s === "transparent")
278
- return { color: new w.Color(16777215), alpha: 0 };
279
- const e = s.match(
276
+ function CA(t) {
277
+ if (!t || t === "transparent")
278
+ return { color: new E.Color(16777215), alpha: 0 };
279
+ const A = t.match(
280
280
  /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
281
281
  );
282
- if (e) {
283
- const t = parseInt(e[1], 10), i = parseInt(e[2], 10), r = parseInt(e[3], 10), c = e[4] !== void 0 ? parseFloat(e[4]) : 1;
284
- return { color: new w.Color(`rgb(${t}, ${i}, ${r})`), alpha: c };
282
+ if (A) {
283
+ const e = parseInt(A[1], 10), s = parseInt(A[2], 10), i = parseInt(A[3], 10), o = A[4] !== void 0 ? parseFloat(A[4]) : 1;
284
+ return { color: new E.Color(`rgb(${e}, ${s}, ${i})`), alpha: o };
285
285
  }
286
- return { color: new w.Color(s), alpha: 1 };
286
+ return { color: new E.Color(t), alpha: 1 };
287
287
  }
288
- function Oe(s) {
289
- const e = [];
290
- let t = "", i = 0;
291
- for (let r = 0; r < s.length; r++) {
292
- const c = s[r];
293
- if (c === "(")
294
- i++;
295
- else if (c === ")")
296
- i--;
297
- else if (c === "," && i === 0) {
298
- e.push(t.trim()), t = "";
288
+ function ne(t) {
289
+ const A = [];
290
+ let e = "", s = 0;
291
+ for (let i = 0; i < t.length; i++) {
292
+ const o = t[i];
293
+ if (o === "(")
294
+ s++;
295
+ else if (o === ")")
296
+ s--;
297
+ else if (o === "," && s === 0) {
298
+ A.push(e.trim()), e = "";
299
299
  continue;
300
300
  }
301
- t += c;
301
+ e += o;
302
302
  }
303
- return t && e.push(t.trim()), e;
303
+ return e && A.push(e.trim()), A;
304
304
  }
305
- function Ke(s) {
306
- if (!s || typeof s != "string" || !s.includes("linear-gradient"))
305
+ function ye(t) {
306
+ if (!t || typeof t != "string" || !t.includes("linear-gradient"))
307
307
  return null;
308
- const e = s.match(/linear-gradient\((.*)\)/);
309
- if (!e)
308
+ const A = t.match(/linear-gradient\((.*)\)/);
309
+ if (!A)
310
310
  return null;
311
- const t = e[1], i = Oe(t);
312
- let r = Math.PI, c = 0;
313
- const n = i[0].trim();
314
- if (n.startsWith("to "))
315
- n === "to top" ? r = 0 : n === "to right" ? r = Math.PI / 2 : n === "to bottom" ? r = Math.PI : n === "to left" ? r = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? r = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? r = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? r = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (r = Math.PI * 1.75), c = 1;
316
- else if (n.endsWith("deg") || n.endsWith("rad") || n.endsWith("turn")) {
317
- const l = parseFloat(n);
318
- n.endsWith("deg") ? r = l * (Math.PI / 180) : n.endsWith("rad") ? r = l : n.endsWith("turn") && (r = l * Math.PI * 2), c = 1;
319
- }
320
- const a = [];
321
- for (let l = c; l < i.length && !(a.length >= 8); l++) {
322
- const o = i[l].trim(), f = o.lastIndexOf(" ");
323
- let h = o, d = null;
324
- if (f !== -1 && !o.endsWith(")")) {
325
- const g = o.substring(f + 1);
326
- (g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = o.substring(0, f).trim(), d = g);
311
+ const e = A[1], s = ne(e);
312
+ let i = Math.PI, o = 0;
313
+ const r = s[0].trim();
314
+ if (r.startsWith("to "))
315
+ r === "to top" ? i = 0 : r === "to right" ? i = Math.PI / 2 : r === "to bottom" ? i = Math.PI : r === "to left" ? i = Math.PI * 1.5 : r === "to top right" || r === "to right top" ? i = Math.PI / 4 : r === "to bottom right" || r === "to right bottom" ? i = Math.PI * 0.75 : r === "to bottom left" || r === "to left bottom" ? i = Math.PI * 1.25 : (r === "to top left" || r === "to left top") && (i = Math.PI * 1.75), o = 1;
316
+ else if (r.endsWith("deg") || r.endsWith("rad") || r.endsWith("turn")) {
317
+ const n = parseFloat(r);
318
+ r.endsWith("deg") ? i = n * (Math.PI / 180) : r.endsWith("rad") ? i = n : r.endsWith("turn") && (i = n * Math.PI * 2), o = 1;
319
+ }
320
+ const g = [];
321
+ for (let n = o; n < s.length && !(g.length >= 8); n++) {
322
+ const a = s[n].trim(), I = a.lastIndexOf(" ");
323
+ let c = a, h = null;
324
+ if (I !== -1 && !a.endsWith(")")) {
325
+ const C = a.substring(I + 1);
326
+ (C.endsWith("%") || C.endsWith("px") || !isNaN(parseFloat(C))) && (c = a.substring(0, I).trim(), h = C);
327
327
  }
328
- const p = ce(h);
329
- a.push({
330
- color: p.color,
331
- alpha: p.alpha,
332
- rawStop: d,
328
+ const B = CA(c);
329
+ g.push({
330
+ color: B.color,
331
+ alpha: B.alpha,
332
+ rawStop: h,
333
333
  stop: 0
334
334
  });
335
335
  }
336
- if (a.length > 0) {
337
- for (let o = 0; o < a.length; o++)
338
- a[o].rawStop !== null && (a[o].stop = parseFloat(a[o].rawStop) / 100);
339
- a[0].rawStop === null && (a[0].stop = 0), a.length > 1 && a[a.length - 1].rawStop === null && (a[a.length - 1].stop = 1);
340
- let l = 0;
341
- for (let o = 1; o < a.length; o++)
342
- if (a[o].rawStop !== null || o === a.length - 1) {
343
- const f = o - l;
344
- if (f > 1) {
345
- const h = a[l].stop, p = (a[o].stop - h) / f;
346
- for (let g = 1; g < f; g++)
347
- a[l + g].stop = h + p * g;
336
+ if (g.length > 0) {
337
+ for (let a = 0; a < g.length; a++)
338
+ g[a].rawStop !== null && (g[a].stop = parseFloat(g[a].rawStop) / 100);
339
+ g[0].rawStop === null && (g[0].stop = 0), g.length > 1 && g[g.length - 1].rawStop === null && (g[g.length - 1].stop = 1);
340
+ let n = 0;
341
+ for (let a = 1; a < g.length; a++)
342
+ if (g[a].rawStop !== null || a === g.length - 1) {
343
+ const I = a - n;
344
+ if (I > 1) {
345
+ const c = g[n].stop, B = (g[a].stop - c) / I;
346
+ for (let C = 1; C < I; C++)
347
+ g[n + C].stop = c + B * C;
348
348
  }
349
- l = o;
349
+ n = a;
350
350
  }
351
351
  }
352
- return { angle: r, stops: a };
352
+ return { angle: i, stops: g };
353
353
  }
354
- function Je(s) {
355
- if (!s || s === "none")
354
+ function De(t) {
355
+ if (!t || t === "none")
356
356
  return null;
357
- const e = Oe(s);
358
- if (e.length === 0)
357
+ const A = ne(t);
358
+ if (A.length === 0)
359
359
  return null;
360
- const t = e[0].trim(), i = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, r = t.match(i);
361
- let c = "transparent", n = t;
362
- if (r && r[1] !== "inset") {
363
- const p = r[1];
364
- (p.startsWith("rgb") || p.startsWith("#") || p === "black" || p === "white" || p === "transparent") && (c = p, n = t.replace(p, "").trim());
365
- }
366
- n = n.replace("inset", "").trim();
367
- const a = n.split(/\s+/).map((p) => parseFloat(p) || 0), l = a[0] || 0, o = a[1] || 0, f = a[2] || 0, h = a[3] || 0, d = ce(c);
368
- return { offsetX: l, offsetY: o, blurRadius: f, spreadRadius: h, color: d.color, alpha: d.alpha };
360
+ const e = A[0].trim(), s = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, i = e.match(s);
361
+ let o = "transparent", r = e;
362
+ if (i && i[1] !== "inset") {
363
+ const B = i[1];
364
+ (B.startsWith("rgb") || B.startsWith("#") || B === "black" || B === "white" || B === "transparent") && (o = B, r = e.replace(B, "").trim());
365
+ }
366
+ r = r.replace("inset", "").trim();
367
+ const g = r.split(/\s+/).map((B) => parseFloat(B) || 0), n = g[0] || 0, a = g[1] || 0, I = g[2] || 0, c = g[3] || 0, h = CA(o);
368
+ return { offsetX: n, offsetY: a, blurRadius: I, spreadRadius: c, color: h.color, alpha: h.alpha };
369
369
  }
370
- const Ze = `varying vec2 vUv;
370
+ const Se = `varying vec2 vUv;
371
371
  varying vec4 vScreenPos;
372
372
  void main() {
373
373
  vUv = uv;
374
374
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
375
375
  vScreenPos = gl_Position;
376
- }`, Qe = `varying vec2 vUv;
376
+ }`, ve = `varying vec2 vUv;
377
377
  uniform vec2 uSize;
378
378
  uniform vec2 uMeshSize;
379
379
  uniform vec4 uShadowColor;
@@ -532,388 +532,395 @@ void main() {
532
532
 
533
533
  // #include <colorspace_fragment>
534
534
  }
535
- `, et = `uniform sampler2D uTexture;
535
+ `, be = `uniform sampler2D uTexture;
536
536
  varying vec4 vScreenPos;
537
537
  uniform vec2 uTextureRepeat;
538
- uniform vec2 uTextureOffset;`, tt = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
538
+ uniform vec2 uTextureOffset;`, Ne = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
539
539
  vec2 resultUv = screenUv;
540
540
 
541
- `, rt = `vec4 texColor = texture2D(uTexture, resultUv);
542
- baseColor = blendSrcOver(baseColor, texColor);`, De = {
543
- vertexShader: Ze,
544
- fragmentShader: Qe
541
+ `, Me = `vec4 texColor = texture2D(uTexture, resultUv);
542
+ baseColor = blendSrcOver(baseColor, texColor);`, $A = {
543
+ vertexShader: Se,
544
+ fragmentShader: ve
545
545
  }, Ae = {
546
- declChunk: et,
547
- uvChunk: tt,
548
- baseColorChunk: rt
546
+ declChunk: be,
547
+ uvChunk: Ne,
548
+ baseColorChunk: Me
549
549
  };
550
- function it(s, e, t, i = null, r) {
551
- var C;
552
- const c = i !== null || !!s.imageSrc;
553
- let n = "";
554
- const a = {};
555
- if (r != null && r.uniforms)
556
- for (const [y, S] of Object.entries(r.uniforms))
557
- typeof S == "number" ? (n += `uniform float ${y};
558
- `, a[y] = { value: S }) : Array.isArray(S) ? S.length === 2 ? (n += `uniform vec2 ${y};
559
- `, a[y] = { value: new w.Vector2(...S) }) : S.length === 3 ? (n += `uniform vec3 ${y};
560
- `, a[y] = { value: new w.Vector3(...S) }) : S.length === 4 && (n += `uniform vec4 ${y};
561
- `, a[y] = { value: new w.Vector4(...S) }) : S && typeof S == "object" && S.type ? (n += `uniform ${S.type} ${y};
562
- `, a[y] = S) : (n += `uniform float ${y};
563
- `, a[y] = { value: S });
564
- const l = r !== void 0, o = (c || l ? Ae.declChunk : "") + `
565
- ` + n, f = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
566
- `, h = s.isTraveler ? `vec2 resultUv = screenUv;
550
+ function Re(t, A, e, s = null, i) {
551
+ var U;
552
+ const o = s !== null || !!t.imageSrc;
553
+ let r = "";
554
+ const g = {};
555
+ if (i != null && i.uniforms)
556
+ for (const [S, D] of Object.entries(i.uniforms))
557
+ typeof D == "number" ? (r += `uniform float ${S};
558
+ `, g[S] = { value: D }) : Array.isArray(D) ? D.length === 2 ? (r += `uniform vec2 ${S};
559
+ `, g[S] = { value: new E.Vector2(...D) }) : D.length === 3 ? (r += `uniform vec3 ${S};
560
+ `, g[S] = { value: new E.Vector3(...D) }) : D.length === 4 && (r += `uniform vec4 ${S};
561
+ `, g[S] = { value: new E.Vector4(...D) }) : D && typeof D == "object" && D.type ? (r += `uniform ${D.type} ${S};
562
+ `, g[S] = D) : (r += `uniform float ${S};
563
+ `, g[S] = { value: D });
564
+ const n = i !== void 0, a = (o || n ? Ae.declChunk : "") + `
565
+ ` + r, I = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
566
+ `, c = t.isTraveler ? `vec2 resultUv = screenUv;
567
567
  ` : `vec2 localUv = (p / uSize) + 0.5;
568
568
  vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
569
- `, d = c || l ? f + h + ((r == null ? void 0 : r.uvModifier) || "") : "", p = c || l ? Ae.baseColorChunk : "", g = (r == null ? void 0 : r.colorModifier) || "", M = De.fragmentShader.replace("#INJECT_DECLARATIONS", o).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", g), m = ce(s.backgroundColor), b = ce(s.borderColor), E = {
570
- uSize: { value: new w.Vector2(e, t) },
571
- uMeshSize: { value: new w.Vector2(e, t) },
572
- uShadowColor: { value: new w.Vector4(0, 0, 0, 0) },
573
- uShadowOffset: { value: new w.Vector2(0, 0) },
569
+ `, h = o || n ? I + c + ((i == null ? void 0 : i.uvModifier) || "") : "", B = o || n ? Ae.baseColorChunk : "", C = (i == null ? void 0 : i.colorModifier) || "", w = $A.fragmentShader.replace("#INJECT_DECLARATIONS", a).replace("#INJECT_UV_MODIFIER", h).replace("#INJECT_BASE_COLOR", B).replace("#INJECT_COLOR_MODIFIER", C), Q = CA(t.backgroundColor), b = CA(t.borderColor), f = {
570
+ uSize: { value: new E.Vector2(A, e) },
571
+ uMeshSize: { value: new E.Vector2(A, e) },
572
+ uShadowColor: { value: new E.Vector4(0, 0, 0, 0) },
573
+ uShadowOffset: { value: new E.Vector2(0, 0) },
574
574
  uShadowBlur: { value: 0 },
575
575
  uShadowSpread: { value: 0 },
576
576
  uBgColor: {
577
- value: new w.Vector4(
578
- m.color.r,
579
- m.color.g,
580
- m.color.b,
581
- m.alpha
577
+ value: new E.Vector4(
578
+ Q.color.r,
579
+ Q.color.g,
580
+ Q.color.b,
581
+ Q.alpha
582
582
  )
583
583
  },
584
584
  uBorderColor: {
585
- value: new w.Vector4(
585
+ value: new E.Vector4(
586
586
  b.color.r,
587
587
  b.color.g,
588
588
  b.color.b,
589
589
  b.alpha
590
590
  )
591
591
  },
592
- uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
593
- uBorderWidth: { value: le(s.borderWidth) },
594
- uOpacity: { value: (C = s.opacity) != null ? C : 1 },
592
+ uBorderRadius: { value: new E.Vector4(0, 0, 0, 0) },
593
+ uBorderWidth: { value: hA(t.borderWidth) },
594
+ uOpacity: { value: (U = t.opacity) != null ? U : 1 },
595
595
  uTexture: { value: null },
596
- uTextureRepeat: { value: new w.Vector2(1, 1) },
597
- uTextureOffset: { value: new w.Vector2(0, 0) },
596
+ uTextureRepeat: { value: new E.Vector2(1, 1) },
597
+ uTextureOffset: { value: new E.Vector2(0, 0) },
598
598
  uGradientCount: { value: 0 },
599
599
  uGradientAngle: { value: 0 },
600
600
  uGradientColors: {
601
- value: Array.from({ length: 8 }, () => new w.Vector4(0, 0, 0, 0))
601
+ value: Array.from({ length: 8 }, () => new E.Vector4(0, 0, 0, 0))
602
602
  },
603
603
  uGradientStops: { value: new Float32Array(8) }
604
604
  };
605
- _e(E.uBorderRadius.value, s.borderRadius, Math.min(e, t)), c && (E.uTexture.value = i);
606
- const A = new w.ShaderMaterial({
607
- uniforms: te(te({}, E), a),
608
- vertexShader: De.vertexShader,
609
- fragmentShader: M,
605
+ ge(f.uBorderRadius.value, t.borderRadius, Math.min(A, e)), o && (f.uTexture.value = s);
606
+ const y = new E.ShaderMaterial({
607
+ uniforms: aA(aA({}, f), g),
608
+ vertexShader: $A.vertexShader,
609
+ fragmentShader: w,
610
610
  transparent: !0,
611
- side: w.FrontSide
611
+ side: E.FrontSide
612
612
  // for better performance
613
613
  });
614
- return s.backgroundImage && xe(A, { backgroundImage: s.backgroundImage }), A;
614
+ return t.backgroundImage && YA(y, { backgroundImage: t.backgroundImage }), y;
615
615
  }
616
- function st(s, e, t, i, r) {
617
- const c = le(e.borderWidth);
618
- xe(s, {
619
- width: t,
620
- height: i,
621
- borderRadius: e.borderRadius,
622
- borderWidth: c,
623
- backgroundColor: e.backgroundColor,
624
- borderColor: e.borderColor,
625
- opacity: e.opacity,
626
- texture: r,
627
- backgroundImage: e.backgroundImage,
628
- boxShadow: e.boxShadow
616
+ function xe(t, A, e, s, i) {
617
+ const o = hA(A.borderWidth);
618
+ YA(t, {
619
+ width: e,
620
+ height: s,
621
+ borderRadius: A.borderRadius,
622
+ borderWidth: o,
623
+ backgroundColor: A.backgroundColor,
624
+ borderColor: A.borderColor,
625
+ opacity: A.opacity,
626
+ texture: i,
627
+ backgroundImage: A.backgroundImage,
628
+ boxShadow: A.boxShadow
629
629
  });
630
630
  }
631
- function xe(s, e) {
632
- var i, r, c;
633
- if (e.boxShadow !== void 0) {
634
- const n = Je(e.boxShadow);
635
- n ? (s.uniforms.uShadowColor.value.set(n.color.r, n.color.g, n.color.b, n.alpha), s.uniforms.uShadowOffset.value.set(n.offsetX, n.offsetY), s.uniforms.uShadowBlur.value = n.blurRadius, s.uniforms.uShadowSpread.value = n.spreadRadius, s.userData.shadowPadding = n.blurRadius + n.spreadRadius + Math.max(Math.abs(n.offsetX), Math.abs(n.offsetY))) : (s.uniforms.uShadowColor.value.w = 0, s.userData.shadowPadding = 0);
636
- }
637
- if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), s.uniforms.uMeshSize) {
638
- const n = s.userData.shadowPadding || 0, a = e.width !== void 0 ? e.width : s.uniforms.uSize.value.x, l = e.height !== void 0 ? e.height : s.uniforms.uSize.value.y;
639
- s.uniforms.uMeshSize.value.set(a + n * 2, l + n * 2);
640
- }
641
- if (e.borderRadius !== void 0) {
642
- const n = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(s.uniforms.uSize.value.x, s.uniforms.uSize.value.y);
643
- _e(s.uniforms.uBorderRadius.value, e.borderRadius, n);
644
- }
645
- if (e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
646
- if (Array.isArray(e.backgroundColor)) {
647
- const n = e.backgroundColor[3] !== void 0 ? e.backgroundColor[3] : s.uniforms.uBgColor.value.w;
648
- s.uniforms.uBgColor.value.set(
649
- e.backgroundColor[0],
650
- e.backgroundColor[1],
651
- e.backgroundColor[2],
652
- n
631
+ function YA(t, A) {
632
+ var s, i, o;
633
+ if (A.boxShadow !== void 0) {
634
+ const r = De(A.boxShadow);
635
+ r ? (t.uniforms.uShadowColor.value.set(r.color.r, r.color.g, r.color.b, r.alpha), t.uniforms.uShadowOffset.value.set(r.offsetX, r.offsetY), t.uniforms.uShadowBlur.value = r.blurRadius, t.uniforms.uShadowSpread.value = r.spreadRadius, t.userData.shadowPadding = r.blurRadius + r.spreadRadius + Math.max(Math.abs(r.offsetX), Math.abs(r.offsetY))) : (t.uniforms.uShadowColor.value.w = 0, t.userData.shadowPadding = 0);
636
+ }
637
+ if (A.width !== void 0 && A.height !== void 0 && t.uniforms.uSize.value.set(A.width, A.height), t.uniforms.uMeshSize) {
638
+ const r = t.userData.shadowPadding || 0, g = A.width !== void 0 ? A.width : t.uniforms.uSize.value.x, n = A.height !== void 0 ? A.height : t.uniforms.uSize.value.y;
639
+ t.uniforms.uMeshSize.value.set(g + r * 2, n + r * 2);
640
+ }
641
+ if (A.borderRadius !== void 0) {
642
+ const r = A.width !== void 0 && A.height !== void 0 ? Math.min(A.width, A.height) : Math.min(t.uniforms.uSize.value.x, t.uniforms.uSize.value.y);
643
+ ge(t.uniforms.uBorderRadius.value, A.borderRadius, r);
644
+ }
645
+ if (A.borderWidth !== void 0 && (t.uniforms.uBorderWidth.value = A.borderWidth), A.backgroundColor !== void 0)
646
+ if (Array.isArray(A.backgroundColor)) {
647
+ const r = A.backgroundColor[3] !== void 0 ? A.backgroundColor[3] : t.uniforms.uBgColor.value.w;
648
+ t.uniforms.uBgColor.value.set(
649
+ A.backgroundColor[0],
650
+ A.backgroundColor[1],
651
+ A.backgroundColor[2],
652
+ r
653
653
  );
654
- } else if (typeof e.backgroundColor == "string") {
655
- const n = ce(e.backgroundColor);
656
- s.uniforms.uBgColor.value.set(
657
- n.color.r,
658
- n.color.g,
659
- n.color.b,
660
- n.alpha
654
+ } else if (typeof A.backgroundColor == "string") {
655
+ const r = CA(A.backgroundColor);
656
+ t.uniforms.uBgColor.value.set(
657
+ r.color.r,
658
+ r.color.g,
659
+ r.color.b,
660
+ r.alpha
661
661
  );
662
662
  } else {
663
- const n = s.uniforms.uBgColor.value.w;
664
- s.uniforms.uBgColor.value.set(
665
- e.backgroundColor.r,
666
- e.backgroundColor.g,
667
- e.backgroundColor.b,
668
- n
663
+ const r = t.uniforms.uBgColor.value.w;
664
+ t.uniforms.uBgColor.value.set(
665
+ A.backgroundColor.r,
666
+ A.backgroundColor.g,
667
+ A.backgroundColor.b,
668
+ r
669
669
  );
670
670
  }
671
- if (e.borderColor !== void 0)
672
- if (Array.isArray(e.borderColor)) {
673
- const n = s.uniforms.uBorderColor.value.w;
674
- s.uniforms.uBorderColor.value.set(
675
- e.borderColor[0],
676
- e.borderColor[1],
677
- e.borderColor[2],
678
- n
671
+ if (A.borderColor !== void 0)
672
+ if (Array.isArray(A.borderColor)) {
673
+ const r = t.uniforms.uBorderColor.value.w;
674
+ t.uniforms.uBorderColor.value.set(
675
+ A.borderColor[0],
676
+ A.borderColor[1],
677
+ A.borderColor[2],
678
+ r
679
679
  );
680
- } else if (typeof e.borderColor == "string") {
681
- const n = ce(e.borderColor);
682
- s.uniforms.uBorderColor.value.set(
683
- n.color.r,
684
- n.color.g,
685
- n.color.b,
686
- n.alpha
680
+ } else if (typeof A.borderColor == "string") {
681
+ const r = CA(A.borderColor);
682
+ t.uniforms.uBorderColor.value.set(
683
+ r.color.r,
684
+ r.color.g,
685
+ r.color.b,
686
+ r.alpha
687
687
  );
688
688
  } else {
689
- const n = s.uniforms.uBorderColor.value.w;
690
- s.uniforms.uBorderColor.value.set(
691
- e.borderColor.r,
692
- e.borderColor.g,
693
- e.borderColor.b,
694
- n
689
+ const r = t.uniforms.uBorderColor.value.w;
690
+ t.uniforms.uBorderColor.value.set(
691
+ A.borderColor.r,
692
+ A.borderColor.g,
693
+ A.borderColor.b,
694
+ r
695
695
  );
696
696
  }
697
- e.opacity !== void 0 && (s.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (s.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (s.uniforms.uBorderColor.value.w = e.borderOpacity), s.uniforms.uTexture && e.texture !== void 0 && (s.uniforms.uTexture.value = e.texture);
698
- const t = e.texture !== void 0 ? e.texture : (i = s.uniforms.uTexture) == null ? void 0 : i.value;
699
- if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
700
- const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, a = t.image.naturalHeight || t.image.videoHeight || t.image.height, l = (r = e.width) != null ? r : s.uniforms.uSize.value.x, o = (c = e.height) != null ? c : s.uniforms.uSize.value.y;
701
- if (n && a && l && o) {
702
- const f = n / a, h = l / o;
703
- if (f > h) {
704
- const d = h / f;
705
- s.uniforms.uTextureRepeat.value.set(d, 1), s.uniforms.uTextureOffset.value.set((1 - d) / 2, 0);
697
+ A.opacity !== void 0 && (t.uniforms.uOpacity.value = A.opacity), A.bgOpacity !== void 0 && (t.uniforms.uBgColor.value.w = A.bgOpacity), A.borderOpacity !== void 0 && (t.uniforms.uBorderColor.value.w = A.borderOpacity), t.uniforms.uTexture && A.texture !== void 0 && (t.uniforms.uTexture.value = A.texture);
698
+ const e = A.texture !== void 0 ? A.texture : (s = t.uniforms.uTexture) == null ? void 0 : s.value;
699
+ if (e && (e.image instanceof ImageBitmap || e.image instanceof HTMLImageElement || e.image instanceof HTMLCanvasElement)) {
700
+ const r = e.image.naturalWidth || e.image.videoWidth || e.image.width, g = e.image.naturalHeight || e.image.videoHeight || e.image.height, n = (i = A.width) != null ? i : t.uniforms.uSize.value.x, a = (o = A.height) != null ? o : t.uniforms.uSize.value.y;
701
+ if (r && g && n && a) {
702
+ const I = r / g, c = n / a;
703
+ if (I > c) {
704
+ const h = c / I;
705
+ t.uniforms.uTextureRepeat.value.set(h, 1), t.uniforms.uTextureOffset.value.set((1 - h) / 2, 0);
706
706
  } else {
707
- const d = f / h;
708
- s.uniforms.uTextureRepeat.value.set(1, d), s.uniforms.uTextureOffset.value.set(0, (1 - d) / 2);
707
+ const h = I / c;
708
+ t.uniforms.uTextureRepeat.value.set(1, h), t.uniforms.uTextureOffset.value.set(0, (1 - h) / 2);
709
709
  }
710
710
  }
711
711
  } else
712
- s.uniforms.uTextureRepeat && (s.uniforms.uTextureRepeat.value.set(1, 1), s.uniforms.uTextureOffset.value.set(0, 0));
713
- if (e.backgroundImage !== void 0) {
714
- const n = Ke(e.backgroundImage);
715
- if (n) {
716
- s.uniforms.uGradientCount.value = n.stops.length, s.uniforms.uGradientAngle.value = n.angle;
717
- for (let a = 0; a < 8; a++)
718
- if (a < n.stops.length) {
719
- const l = n.stops[a];
720
- s.uniforms.uGradientColors.value[a].set(
721
- l.color.r,
722
- l.color.g,
723
- l.color.b,
724
- l.alpha
725
- ), s.uniforms.uGradientStops.value[a] = l.stop;
712
+ t.uniforms.uTextureRepeat && (t.uniforms.uTextureRepeat.value.set(1, 1), t.uniforms.uTextureOffset.value.set(0, 0));
713
+ if (A.backgroundImage !== void 0) {
714
+ const r = ye(A.backgroundImage);
715
+ if (r) {
716
+ t.uniforms.uGradientCount.value = r.stops.length, t.uniforms.uGradientAngle.value = r.angle;
717
+ for (let g = 0; g < 8; g++)
718
+ if (g < r.stops.length) {
719
+ const n = r.stops[g];
720
+ t.uniforms.uGradientColors.value[g].set(
721
+ n.color.r,
722
+ n.color.g,
723
+ n.color.b,
724
+ n.alpha
725
+ ), t.uniforms.uGradientStops.value[g] = n.stop;
726
726
  } else
727
- s.uniforms.uGradientColors.value[a].set(0, 0, 0, 0), s.uniforms.uGradientStops.value[a] = 1;
727
+ t.uniforms.uGradientColors.value[g].set(0, 0, 0, 0), t.uniforms.uGradientStops.value[g] = 1;
728
728
  } else
729
- s.uniforms.uGradientCount.value = 0;
729
+ t.uniforms.uGradientCount.value = 0;
730
730
  }
731
- for (const n of Object.keys(e))
732
- n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && n !== "boxShadow" && s.uniforms[n] !== void 0 && (s.uniforms[n].value !== void 0 && s.uniforms[n].value !== null && typeof s.uniforms[n].value.set == "function" ? Array.isArray(e[n]) ? s.uniforms[n].value.set(...e[n]) : e[n] !== void 0 && (e[n].copy ? s.uniforms[n].value.copy(e[n]) : s.uniforms[n].value = e[n]) : s.uniforms[n].value = e[n]);
731
+ for (const r of Object.keys(A))
732
+ r !== "width" && r !== "height" && r !== "borderRadius" && r !== "borderWidth" && r !== "backgroundColor" && r !== "borderColor" && r !== "opacity" && r !== "bgOpacity" && r !== "borderOpacity" && r !== "texture" && r !== "backgroundImage" && r !== "boxShadow" && t.uniforms[r] !== void 0 && (t.uniforms[r].value !== void 0 && t.uniforms[r].value !== null && typeof t.uniforms[r].value.set == "function" ? Array.isArray(A[r]) ? t.uniforms[r].value.set(...A[r]) : A[r] !== void 0 && (A[r].copy ? t.uniforms[r].value.copy(A[r]) : t.uniforms[r].value = A[r]) : t.uniforms[r].value = A[r]);
733
733
  }
734
- function _e(s, e, t = 0) {
735
- var l, o, f, h;
736
- if (e == null) {
737
- s.set(0, 0, 0, 0);
734
+ function ge(t, A, e = 0) {
735
+ var n, a, I, c;
736
+ if (A == null) {
737
+ t.set(0, 0, 0, 0);
738
738
  return;
739
739
  }
740
- if (typeof e == "number") {
741
- s.set(e, e, e, e);
740
+ if (typeof A == "number") {
741
+ t.set(A, A, A, A);
742
742
  return;
743
743
  }
744
- if (Array.isArray(e)) {
745
- s.set(e[0], e[1], e[2], e[3]);
744
+ if (Array.isArray(A)) {
745
+ t.set(A[0], A[1], A[2], A[3]);
746
746
  return;
747
747
  }
748
- const i = e.split("/")[0].trim().split(/\s+/), r = le(i[0], t), c = le((l = i[1]) != null ? l : i[0], t), n = le((o = i[2]) != null ? o : i[0], t), a = le((h = (f = i[3]) != null ? f : i[1]) != null ? h : i[0], t);
749
- s.set(r, c, n, a);
748
+ const s = A.split("/")[0].trim().split(/\s+/), i = hA(s[0], e), o = hA((n = s[1]) != null ? n : s[0], e), r = hA((a = s[2]) != null ? a : s[0], e), g = hA((c = (I = s[3]) != null ? I : s[1]) != null ? c : s[0], e);
749
+ t.set(i, o, r, g);
750
750
  }
751
- const W = {
752
- create(s, e, t, i, r, c = 2, n = null, a) {
753
- return s === "BOX" ? it(
754
- e,
751
+ const K = {
752
+ create(t, A, e, s, i, o = 2, r = null, g) {
753
+ return t === "BOX" ? Re(
754
+ A,
755
+ s,
755
756
  i,
756
757
  r,
757
- n,
758
- a
759
- ) : s === "TEXT" ? new je(
760
- t || "",
761
- e,
758
+ g
759
+ ) : t === "TEXT" ? new pe(
760
+ e || "",
761
+ A,
762
+ s,
762
763
  i,
763
- r,
764
- c
765
- ) : new w.MeshBasicMaterial({ visible: !1 });
764
+ o
765
+ ) : new E.MeshBasicMaterial({ visible: !1 });
766
766
  },
767
- update(s, e, t, i, r, c, n = 2, a) {
768
- e === "BOX" ? st(
769
- s,
767
+ update(t, A, e, s, i, o, r = 2, g) {
768
+ A === "BOX" ? xe(
770
769
  t,
771
- r,
772
- c,
773
- a
774
- ) : e === "TEXT" && s.updateText(
775
- i || "",
776
- t,
777
- r,
778
- c,
779
- n
770
+ e,
771
+ i,
772
+ o,
773
+ g
774
+ ) : A === "TEXT" && t.updateText(
775
+ s || "",
776
+ e,
777
+ i,
778
+ o,
779
+ r
780
780
  );
781
781
  },
782
- forceUpdateUniforms(s, e) {
783
- xe(s, e);
782
+ forceUpdateUniforms(t, A) {
783
+ YA(t, A);
784
784
  }
785
785
  };
786
- class nt {
787
- constructor(e, t = !0) {
788
- u(this, "observer");
789
- u(this, "textures", /* @__PURE__ */ new WeakMap());
790
- u(this, "loadStatus", /* @__PURE__ */ new WeakMap());
791
- u(this, "elementUrls", /* @__PURE__ */ new WeakMap());
792
- u(this, "onUpdate");
793
- this.onUpdate = e, t && (this.observer = new IntersectionObserver(
794
- (i) => {
795
- for (const r of i) {
796
- const c = r.target;
797
- r.isIntersecting ? this.loadTexture(c) : this.disposeTexture(c);
786
+ class Le {
787
+ constructor(A, e = !0) {
788
+ l(this, "observer");
789
+ l(this, "textures", /* @__PURE__ */ new WeakMap());
790
+ l(this, "loadStatus", /* @__PURE__ */ new WeakMap());
791
+ l(this, "elementUrls", /* @__PURE__ */ new WeakMap());
792
+ l(this, "onUpdate");
793
+ this.onUpdate = A, e && (this.observer = new IntersectionObserver(
794
+ (s) => {
795
+ for (const i of s) {
796
+ const o = i.target;
797
+ i.isIntersecting ? this.loadTexture(o) : this.disposeTexture(o);
798
798
  }
799
799
  },
800
800
  { rootMargin: "300px" }
801
801
  ));
802
802
  }
803
- register(e, t) {
804
- if (e.nodeType !== Node.ELEMENT_NODE)
803
+ register(A, e) {
804
+ if (A.nodeType !== Node.ELEMENT_NODE)
805
805
  return;
806
- this.elementUrls.get(e) !== t && (this.elementUrls.set(e, t), this.observer ? (this.observer.unobserve(e), this.observer.observe(e)) : this.loadTexture(e));
806
+ this.elementUrls.get(A) !== e && (this.elementUrls.set(A, e), this.observer ? (this.observer.unobserve(A), this.observer.observe(A)) : this.loadTexture(A));
807
807
  }
808
- unregister(e) {
809
- e.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(e), this.disposeTexture(e), this.elementUrls.delete(e), this.loadStatus.delete(e);
808
+ unregister(A) {
809
+ A.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(A), this.disposeTexture(A), this.elementUrls.delete(A), this.loadStatus.delete(A);
810
810
  }
811
- loadTexture(e) {
812
- return Te(this, null, function* () {
813
- if (this.loadStatus.get(e) || this.textures.has(e))
811
+ loadTexture(A) {
812
+ return eA(this, null, function* () {
813
+ if (this.loadStatus.get(A) || this.textures.has(A))
814
814
  return;
815
- const t = this.elementUrls.get(e);
816
- if (t) {
817
- this.loadStatus.set(e, !0);
815
+ const e = this.elementUrls.get(A);
816
+ if (e) {
817
+ this.loadStatus.set(A, !0);
818
818
  try {
819
- let i;
820
- if (t.startsWith("data:image/svg+xml"))
821
- i = yield new Promise((c, n) => {
822
- const a = new Image();
823
- a.onload = () => c(a), a.onerror = n, a.src = t;
819
+ let s;
820
+ if (e.startsWith("data:image/svg+xml"))
821
+ s = yield new Promise((o, r) => {
822
+ const g = new Image();
823
+ g.onload = () => o(g), g.onerror = r, g.src = e;
824
824
  });
825
825
  else {
826
- const n = yield (yield fetch(t)).blob();
827
- i = yield createImageBitmap(n, { imageOrientation: "flipY" });
826
+ const r = yield (yield fetch(e)).blob();
827
+ s = yield createImageBitmap(r, { imageOrientation: "flipY" });
828
828
  }
829
- if (this.elementUrls.get(e) !== t) {
830
- "close" in i && i.close();
829
+ if (this.elementUrls.get(A) !== e) {
830
+ "close" in s && s.close();
831
831
  return;
832
832
  }
833
- const r = new w.Texture(i);
834
- i instanceof HTMLImageElement || (r.flipY = !1), r.colorSpace = w.LinearSRGBColorSpace, r.needsUpdate = !0, this.textures.set(e, r), this.onUpdate(e, r);
835
- } catch (i) {
836
- console.warn("[MirageEngine] Failed to load texture:", t, i);
833
+ const i = new E.Texture(s);
834
+ s instanceof HTMLImageElement || (i.flipY = !1), i.colorSpace = E.LinearSRGBColorSpace, i.needsUpdate = !0, this.textures.set(A, i), this.onUpdate(A, i);
835
+ } catch (s) {
836
+ console.warn("[MirageEngine] Failed to load texture:", e, s);
837
837
  } finally {
838
- this.elementUrls.has(e) && this.loadStatus.set(e, !1);
838
+ this.elementUrls.has(A) && this.loadStatus.set(A, !1);
839
839
  }
840
840
  }
841
841
  });
842
842
  }
843
- disposeTexture(e) {
844
- const t = this.textures.get(e);
845
- t && (t.dispose(), this.textures.delete(e), this.onUpdate(e, null)), this.loadStatus.set(e, !1);
843
+ disposeTexture(A) {
844
+ const e = this.textures.get(A);
845
+ e && (e.dispose(), this.textures.delete(A), this.onUpdate(A, null)), this.loadStatus.set(A, !1);
846
846
  }
847
- get(e) {
848
- return this.textures.get(e);
847
+ get(A) {
848
+ return this.textures.get(A);
849
849
  }
850
850
  disposeAll() {
851
851
  this.observer && this.observer.disconnect();
852
852
  }
853
853
  }
854
- class ot {
855
- constructor(e, t, i, r) {
856
- u(this, "canvas");
857
- u(this, "scene");
858
- u(this, "camera");
859
- u(this, "renderer");
860
- u(this, "renderTargets", []);
861
- u(this, "renderOrder", 0);
862
- u(this, "qualityFactor", 2);
863
- u(this, "mode", "overlay");
864
- u(this, "canvasSize", "viewport");
865
- u(this, "clipArea", 1);
866
- u(this, "targetLayer", "base");
867
- u(this, "overscan", 200);
868
- u(this, "target");
869
- u(this, "mountContainer");
870
- u(this, "registry");
871
- u(this, "targetRect");
872
- u(this, "travelersByLayer", Array.from(
873
- { length: N.MAX_LAYERS },
854
+ class Fe {
855
+ constructor(A, e, s, i) {
856
+ l(this, "canvas");
857
+ l(this, "scene");
858
+ l(this, "camera");
859
+ l(this, "renderer");
860
+ l(this, "renderTargets", []);
861
+ l(this, "renderOrder", 0);
862
+ l(this, "qualityFactor", 2);
863
+ l(this, "mode", "overlay");
864
+ l(this, "canvasSize", "viewport");
865
+ l(this, "clipArea", 1);
866
+ l(this, "targetLayer", "base");
867
+ l(this, "overscan", 200);
868
+ l(this, "target");
869
+ l(this, "mountContainer");
870
+ l(this, "registry");
871
+ l(this, "targetRect");
872
+ l(this, "targetPageX", 0);
873
+ l(this, "targetPageY", 0);
874
+ l(this, "size", { width: 0, height: 0 });
875
+ l(this, "currentScrollX", 0);
876
+ l(this, "currentScrollY", 0);
877
+ l(this, "lastTargetLeft", 0);
878
+ l(this, "lastTargetTop", 0);
879
+ l(this, "travelersByLayer", Array.from(
880
+ { length: H.MAX_LAYERS },
874
881
  () => /* @__PURE__ */ new Set()
875
882
  ));
876
- u(this, "textureManager");
883
+ l(this, "textureManager");
877
884
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
878
- u(this, "fixedMeshes", /* @__PURE__ */ new Set());
879
- var a, l, o, f, h;
880
- this.target = e, this.mountContainer = i, this.registry = r, this.mode = (a = t.mode) != null ? a : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (o = t.travelerClipArea) != null ? o : 1, this.targetLayer = (f = t.layer) != null ? f : "base", this.textureManager = new nt((d, p) => {
881
- const g = this.registry.get(d);
882
- g && g.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(g.material, { texture: p });
883
- }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new w.Scene(), this.targetRect = this.target.getBoundingClientRect();
884
- const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
885
- this.camera = new w.OrthographicCamera(
886
- c / -2,
887
- c / 2,
888
- n / 2,
889
- n / -2,
885
+ l(this, "fixedMeshes", /* @__PURE__ */ new Set());
886
+ var g, n, a, I, c;
887
+ this.target = A, this.mountContainer = s, this.registry = i, this.mode = (g = e.mode) != null ? g : "overlay", this.canvasSize = (n = e.canvasSize) != null ? n : "viewport", this.clipArea = (a = e.travelerClipArea) != null ? a : 1, this.targetLayer = (I = e.layer) != null ? I : "base", this.textureManager = new Le((h, B) => {
888
+ const C = this.registry.get(h);
889
+ C && C.material instanceof E.ShaderMaterial && K.forceUpdateUniforms(C.material, { texture: B });
890
+ }, this.isViewport), this.qualityFactor = this.getQualityFactor(e.quality), this.canvas = document.createElement("canvas"), this.scene = new E.Scene(), this.targetRect = this.target.getBoundingClientRect(), this.lastTargetLeft = this.targetRect.left, this.lastTargetTop = this.targetRect.top, this.targetPageX = this.targetRect.left + this.getScrollX(), this.targetPageY = this.targetRect.top + this.getScrollY();
891
+ const o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
892
+ this.camera = new E.OrthographicCamera(
893
+ o / -2,
894
+ o / 2,
895
+ r / 2,
896
+ r / -2,
890
897
  1,
891
898
  1e3
892
- ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new w.WebGLRenderer({
899
+ ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new E.WebGLRenderer({
893
900
  canvas: this.canvas,
894
901
  alpha: !0,
895
902
  antialias: !0
896
903
  // [new]
897
904
  // premultipliedAlpha: true
898
- }), w.ColorManagement.enabled = !1, this.renderer.outputColorSpace = w.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(c, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
905
+ }), E.ColorManagement.enabled = !1, this.renderer.outputColorSpace = E.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(o, r), this.applyTextQuality((c = e.quality) != null ? c : "medium");
899
906
  }
900
907
  get isViewport() {
901
908
  return this.mode === "overlay" && this.canvasSize === "viewport";
902
909
  }
903
910
  getSceneLayer() {
904
- return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? O.SELECTED : O.BASE;
911
+ return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? L.SELECTED : L.BASE;
905
912
  }
906
913
  createRenderTarget() {
907
- for (let e = 0; e < N.MAX_LAYERS; e++) {
908
- const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, i = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
914
+ for (let A = 0; A < H.MAX_LAYERS; A++) {
915
+ const e = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, s = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
909
916
  this.renderTargets.push(
910
- new w.WebGLRenderTarget(
911
- t * this.qualityFactor,
912
- i * this.qualityFactor,
917
+ new E.WebGLRenderTarget(
918
+ e * this.qualityFactor,
919
+ s * this.qualityFactor,
913
920
  {
914
- minFilter: w.LinearFilter,
915
- magFilter: w.LinearFilter,
916
- format: w.RGBAFormat,
921
+ minFilter: E.LinearFilter,
922
+ magFilter: E.LinearFilter,
923
+ format: E.RGBAFormat,
917
924
  stencilBuffer: !1,
918
925
  depthBuffer: !0
919
926
  }
@@ -921,12 +928,12 @@ class ot {
921
928
  );
922
929
  }
923
930
  }
924
- applyTextQuality(e) {
925
- if (typeof e == "number") {
926
- this.qualityFactor = Math.max(0.1, e);
931
+ applyTextQuality(A) {
932
+ if (typeof A == "number") {
933
+ this.qualityFactor = Math.max(0.1, A);
927
934
  return;
928
935
  }
929
- switch (e) {
936
+ switch (A) {
930
937
  case "low":
931
938
  this.qualityFactor = 1;
932
939
  break;
@@ -941,49 +948,71 @@ class ot {
941
948
  break;
942
949
  }
943
950
  }
951
+ getQualityFactor(A) {
952
+ if (typeof A == "number")
953
+ return Math.max(0.1, A);
954
+ switch (A) {
955
+ case "low":
956
+ return 1;
957
+ case "high":
958
+ return 4;
959
+ default:
960
+ return 2;
961
+ }
962
+ }
963
+ updateScroll() {
964
+ const A = this.target.getBoundingClientRect();
965
+ this.currentScrollX += this.lastTargetLeft - A.left, this.currentScrollY += this.lastTargetTop - A.top, this.lastTargetLeft = A.left, this.lastTargetTop = A.top;
966
+ }
967
+ getScrollX() {
968
+ return this.currentScrollX;
969
+ }
970
+ getScrollY() {
971
+ return this.currentScrollY;
972
+ }
944
973
  mount() {
945
974
  this.mountContainer.prepend(this.canvas), this.canvas.style.pointerEvents = this.mode === "overlay" ? "none" : "auto", this.updateCanvasLayout();
946
975
  }
947
976
  updateCanvasLayout() {
948
- const e = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, t = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
949
- this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`, this.mode === "duplicate" ? (this.canvas.style.position = "", this.canvas.style.top = "", this.canvas.style.left = "", this.canvas.style.display = "block") : (this.canvas.style.position = this.isViewport ? "fixed" : "absolute", this.canvas.style.top = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetTop}px`, this.canvas.style.left = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetLeft}px`, this.canvas.style.display = "block");
950
- }
951
- updateUniforms(e, t) {
952
- const i = this.registry.get(e);
953
- i && (i.traverse((r) => {
954
- r.isMesh && r.material && W.forceUpdateUniforms(
955
- r.material,
956
- t
977
+ const A = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, e = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
978
+ this.canvas.style.width = `${A}px`, this.canvas.style.height = `${e}px`, this.mode === "duplicate" ? (this.canvas.style.position = "", this.canvas.style.top = "", this.canvas.style.left = "", this.canvas.style.display = "block") : (this.canvas.style.position = this.isViewport ? "fixed" : "absolute", this.canvas.style.top = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetTop}px`, this.canvas.style.left = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetLeft}px`, this.canvas.style.display = "block");
979
+ }
980
+ updateUniforms(A, e) {
981
+ const s = this.registry.get(A);
982
+ s && (s.traverse((i) => {
983
+ i.isMesh && i.material && K.forceUpdateUniforms(
984
+ i.material,
985
+ e
957
986
  );
958
- }), i.userData.nativeMesh && i.userData.nativeMesh.traverse((r) => {
959
- r.isMesh && r.material && W.forceUpdateUniforms(
960
- r.material,
961
- t
987
+ }), s.userData.nativeMesh && s.userData.nativeMesh.traverse((i) => {
988
+ i.isMesh && i.material && K.forceUpdateUniforms(
989
+ i.material,
990
+ e
962
991
  );
963
992
  }));
964
993
  }
965
994
  dispose() {
966
995
  this.renderer.dispose(), this.canvas.remove(), this.textureManager.disposeAll();
967
996
  }
968
- setSize(e, t) {
969
- this.renderer.setSize(e, t);
970
- for (const i of this.renderTargets)
971
- i.setSize(e * this.qualityFactor, t * this.qualityFactor);
972
- this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
973
- }
974
- syncScene(e, t) {
975
- const i = this.target.getBoundingClientRect(), r = this.isViewport ? window.innerWidth + this.overscan * 2 : i.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : i.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, a = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, l = Math.abs(r - n) > 0.1 || Math.abs(c - a) > 0.1, o = this.mode === "overlay" && (Math.abs(i.top - this.targetRect.top) > 0.1 || Math.abs(i.left - this.targetRect.left) > 0.1);
976
- l ? (this.targetRect = i, this.setSize(r, c), this.updateCanvasLayout()) : o ? (this.targetRect = i, this.updateCanvasLayout()) : this.targetRect = i, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((f) => {
977
- const h = this.registry.get(f);
978
- if (h) {
979
- this.scene.remove(h);
980
- for (const d of this.travelersByLayer)
981
- d.delete(h);
982
- this.fixedMeshes.delete(h), h.geometry.dispose(), h.userData.nativeMesh && (this.scene.remove(h.userData.nativeMesh), Array.isArray(h.userData.nativeMesh.material) ? h.userData.nativeMesh.material.forEach(
983
- (d) => d.dispose()
984
- ) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((d) => {
985
- d instanceof w.Mesh && (d.geometry && d.geometry.dispose(), d.material && (Array.isArray(d.material) ? d.material.forEach((p) => p.dispose()) : d.material.dispose()));
986
- }), this.registry.remove(f), this.textureManager.unregister(f);
997
+ setSize(A, e) {
998
+ this.renderer.setSize(A, e);
999
+ for (const s of this.renderTargets)
1000
+ s.setSize(A * this.qualityFactor, e * this.qualityFactor);
1001
+ this.camera.left = A / -2, this.camera.right = A / 2, this.camera.top = e / 2, this.camera.bottom = e / -2, this.camera.updateProjectionMatrix();
1002
+ }
1003
+ syncScene(A, e) {
1004
+ const s = this.target.getBoundingClientRect(), i = this.isViewport ? window.innerWidth + this.overscan * 2 : s.width, o = this.isViewport ? window.innerHeight + this.overscan * 2 : s.height, r = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, g = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, n = Math.abs(i - r) > 0.1 || Math.abs(o - g) > 0.1, a = this.mode === "overlay" && (Math.abs(s.top - this.targetRect.top) > 0.1 || Math.abs(s.left - this.targetRect.left) > 0.1);
1005
+ n ? (this.targetRect = s, this.targetPageX = s.left + this.getScrollX(), this.targetPageY = s.top + this.getScrollY(), this.setSize(i, o), this.updateCanvasLayout()) : a ? (this.targetRect = s, this.targetPageX = s.left + this.getScrollX(), this.targetPageY = s.top + this.getScrollY(), this.updateCanvasLayout()) : (this.targetRect = s, this.targetPageX = s.left + this.getScrollX(), this.targetPageY = s.top + this.getScrollY()), this.renderOrder = 0, this.reconcileNode(A), e.size > 0 && e.forEach((I) => {
1006
+ const c = this.registry.get(I);
1007
+ if (c) {
1008
+ this.scene.remove(c);
1009
+ for (const h of this.travelersByLayer)
1010
+ h.delete(c);
1011
+ this.fixedMeshes.delete(c), c.geometry.dispose(), c.userData.nativeMesh && (this.scene.remove(c.userData.nativeMesh), Array.isArray(c.userData.nativeMesh.material) ? c.userData.nativeMesh.material.forEach(
1012
+ (h) => h.dispose()
1013
+ ) : c.userData.nativeMesh.material.dispose(), c.userData.nativeMesh.geometry.dispose()), c.traverse((h) => {
1014
+ h instanceof E.Mesh && (h.geometry && h.geometry.dispose(), h.material && (Array.isArray(h.material) ? h.material.forEach((B) => B.dispose()) : h.material.dispose()));
1015
+ }), this.registry.remove(I), this.textureManager.unregister(I);
987
1016
  }
988
1017
  });
989
1018
  }
@@ -991,800 +1020,975 @@ class ot {
991
1020
  // => 이 과정에서 scene node에 있는 ele를 넣은 hash => activeElements
992
1021
  // => 이후 activeElements를 이용하여 mesh를 정리!!!+ map에서도 삭제
993
1022
  // private reconcileNode(node: SceneNode, activeElements: Set<HTMLElement>) {
994
- reconcileNode(e) {
995
- var r, c;
996
- let t = this.registry.get(e.element);
997
- const i = JSON.stringify(e.shaderHooks || null);
998
- if (t && t.userData.shaderHash !== i && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof w.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
999
- const n = new w.PlaneGeometry(1, 1), a = e.isTraveler ? (r = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : r.texture : this.textureManager.get(e.element), l = W.create(
1023
+ reconcileNode(A) {
1024
+ var i, o;
1025
+ let e = this.registry.get(A.element);
1026
+ const s = JSON.stringify(A.shaderHooks || null);
1027
+ if (e && e.userData.shaderHash !== s && (this.scene.remove(e), e.geometry.dispose(), e.material instanceof E.Material && e.material.dispose(), this.registry.remove(A.element), e = void 0), !e) {
1028
+ const r = new E.PlaneGeometry(1, 1), g = A.isTraveler ? (i = this.renderTargets[A.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(A.element), n = K.create(
1000
1029
  "BOX",
1001
- e.styles,
1030
+ A.styles,
1002
1031
  "",
1003
- e.rect.width,
1004
- e.rect.height,
1032
+ A.rect.width,
1033
+ A.rect.height,
1005
1034
  this.qualityFactor,
1006
- a,
1007
- e.shaderHooks
1035
+ g,
1036
+ A.shaderHooks
1008
1037
  );
1009
- t = new w.Mesh(n, l), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = l, t.userData.domElement = e.element, t.userData.shaderHash = i;
1038
+ e = new E.Mesh(r, n), A.type === "TEXT" && (e.name = "BG_MESH"), this.scene.add(e), this.registry.register(A.element, e), e.userData.baseMaterial = n, e.userData.domElement = A.element, e.userData.shaderHash = s;
1010
1039
  }
1011
- if (t.userData.clipElements = e.clipElements, (c = e.nativeStyles) != null && c.transform ? t.userData.nativeTransform = e.nativeStyles.transform : t.userData.nativeTransform = void 0, this.updateMeshProperties(t, e), this.updateMeshLayers(t, e), e.isTraveler)
1012
- for (let n = 0; n < N.MAX_LAYERS; n++)
1013
- n === e.captureLayer - 2 ? this.travelersByLayer[n].add(t) : this.travelersByLayer[n].delete(t);
1040
+ if (e.userData.clipElements = A.clipElements, e.userData.wasmIndex = A.wasmIndex, (o = A.nativeStyles) != null && o.transform ? e.userData.nativeTransform = A.nativeStyles.transform : e.userData.nativeTransform = void 0, this.updateMeshProperties(e, A), this.updateMeshLayers(e, A), A.isTraveler)
1041
+ for (let r = 0; r < H.MAX_LAYERS; r++)
1042
+ r === A.captureLayer - 2 ? this.travelersByLayer[r].add(e) : this.travelersByLayer[r].delete(e);
1014
1043
  else
1015
- for (const n of this.travelersByLayer)
1016
- n.delete(t);
1017
- if (e.isFixed ? this.fixedMeshes.add(t) : this.fixedMeshes.delete(t), e.styles.imageSrc ? this.textureManager.register(e.element, e.styles.imageSrc) : this.textureManager.unregister(e.element), e.type === "BOX")
1018
- for (const n of e.children)
1019
- this.reconcileNode(n);
1044
+ for (const r of this.travelersByLayer)
1045
+ r.delete(e);
1046
+ if (A.isFixed ? this.fixedMeshes.add(e) : this.fixedMeshes.delete(e), A.styles.imageSrc ? this.textureManager.register(A.element, A.styles.imageSrc) : this.textureManager.unregister(A.element), A.type === "BOX")
1047
+ for (const r of A.children)
1048
+ this.reconcileNode(r);
1020
1049
  else
1021
- e.type === "TEXT" && (this.reconcileTextChild(t, e, !1), t.userData.nativeMesh && e.nativeStyles && this.reconcileTextChild(
1022
- t.userData.nativeMesh,
1023
- e,
1050
+ A.type === "TEXT" && (this.reconcileTextChild(e, A, !1), e.userData.nativeMesh && A.nativeStyles && this.reconcileTextChild(
1051
+ e.userData.nativeMesh,
1052
+ A,
1024
1053
  !0
1025
1054
  ));
1026
1055
  }
1027
- reconcileTextChild(e, t, i) {
1028
- var o;
1029
- const r = t.textLines || [
1030
- { text: t.textContent || "", rect: t.rect }
1031
- ], c = i ? t.nativeStyles : t.textStyles, n = JSON.stringify(c) + t.textContent + r.map((f) => f.text).join("|"), a = (o = e.userData) == null ? void 0 : o.textChildStyleHash;
1032
- if (t.dirtyMask & be || n !== a) {
1033
- e.children.filter(
1034
- (g) => g.name.startsWith("TEXT_CHILD")
1035
- ).forEach((g) => {
1036
- var m;
1037
- const M = g;
1038
- (m = M.material.map) == null || m.dispose(), M.geometry.dispose(), e.remove(M);
1056
+ reconcileTextChild(A, e, s) {
1057
+ var a;
1058
+ const i = e.textLines || [
1059
+ { text: e.textContent || "", rect: e.rect }
1060
+ ], o = s ? e.nativeStyles : e.textStyles, r = JSON.stringify(o) + e.textContent + i.map((I) => I.text).join("|"), g = (a = A.userData) == null ? void 0 : a.textChildStyleHash;
1061
+ if (e.dirtyMask & TA || r !== g) {
1062
+ A.children.filter(
1063
+ (C) => C.name.startsWith("TEXT_CHILD")
1064
+ ).forEach((C) => {
1065
+ var Q;
1066
+ const w = C;
1067
+ (Q = w.material.map) == null || Q.dispose(), w.geometry.dispose(), A.remove(w);
1039
1068
  });
1040
- const h = t.rect, d = h.x + h.width / 2, p = h.y + h.height / 2;
1041
- r.forEach((g, M) => {
1042
- const m = W.create(
1069
+ const c = e.rect, h = c.x + c.width / 2, B = c.y + c.height / 2;
1070
+ i.forEach((C, w) => {
1071
+ const Q = K.create(
1043
1072
  "TEXT",
1044
- c,
1045
- g.text,
1046
- g.rect.width,
1047
- g.rect.height,
1073
+ o,
1074
+ C.text,
1075
+ C.rect.width,
1076
+ C.rect.height,
1048
1077
  this.qualityFactor
1049
- ), b = new w.PlaneGeometry(1, 1), E = new w.Mesh(b, m);
1050
- E.name = `TEXT_CHILD_${M}`;
1051
- const A = t.rect.width === 0 ? 1 : g.rect.width / t.rect.width, C = t.rect.height === 0 ? 1 : g.rect.height / t.rect.height;
1052
- E.scale.set(A, C, 1);
1053
- const y = g.rect.x + g.rect.width / 2, S = g.rect.y + g.rect.height / 2, z = y - d, X = -(S - p);
1054
- E.position.set(
1055
- t.rect.width === 0 ? 0 : z / t.rect.width,
1056
- t.rect.height === 0 ? 0 : X / t.rect.height,
1078
+ ), b = new E.PlaneGeometry(1, 1), f = new E.Mesh(b, Q);
1079
+ f.name = `TEXT_CHILD_${w}`;
1080
+ const y = e.rect.width === 0 ? 1 : C.rect.width / e.rect.width, U = e.rect.height === 0 ? 1 : C.rect.height / e.rect.height;
1081
+ f.scale.set(y, U, 1);
1082
+ const S = C.rect.x + C.rect.width / 2, D = C.rect.y + C.rect.height / 2, u = S - h, Y = -(D - B);
1083
+ f.position.set(
1084
+ e.rect.width === 0 ? 0 : u / e.rect.width,
1085
+ e.rect.height === 0 ? 0 : Y / e.rect.height,
1057
1086
  5e-3
1058
- ), e.add(E);
1059
- }), e.userData.textChildStyleHash = n;
1087
+ ), A.add(f);
1088
+ }), A.userData.textChildStyleHash = r;
1060
1089
  }
1061
- e.children.forEach((f) => {
1062
- if (!f.name.startsWith("TEXT_CHILD"))
1090
+ A.children.forEach((I) => {
1091
+ if (!I.name.startsWith("TEXT_CHILD"))
1063
1092
  return;
1064
- const h = f;
1065
- if (i && t.nativeLayer !== void 0)
1066
- h.layers.set(O.HIDDEN), t.visibility & $ && h.layers.enable(O.getCaptureLayer(t.nativeLayer));
1093
+ const c = I;
1094
+ if (s && e.nativeLayer !== void 0)
1095
+ c.layers.set(L.HIDDEN), e.visibility & q && c.layers.enable(L.getCaptureLayer(e.nativeLayer));
1067
1096
  else {
1068
- const d = t.visibility & $ ? O.BASE : O.HIDDEN;
1069
- if (h.layers.set(d), t.visibility & ae && h.layers.enable(O.SELECTED), t.visibility & $)
1070
- if (!i && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1071
- for (let p = t.captureLayer; p <= N.MAX_LAYERS + 1; p++)
1072
- p !== t.nativeLayer && h.layers.enable(O.getCaptureLayer(p));
1097
+ const h = e.visibility & q ? L.BASE : L.HIDDEN;
1098
+ if (c.layers.set(h), e.visibility & lA && c.layers.enable(L.SELECTED), e.visibility & q)
1099
+ if (!s && e.nativeLayer !== void 0 && e.nativeStyles !== void 0)
1100
+ for (let B = e.captureLayer; B <= H.MAX_LAYERS + 1; B++)
1101
+ B !== e.nativeLayer && c.layers.enable(L.getCaptureLayer(B));
1073
1102
  else
1074
- for (let p = t.captureLayer; p <= N.MAX_LAYERS + 1; p++)
1075
- h.layers.enable(O.getCaptureLayer(p));
1103
+ for (let B = e.captureLayer; B <= H.MAX_LAYERS + 1; B++)
1104
+ c.layers.enable(L.getCaptureLayer(B));
1076
1105
  }
1077
1106
  });
1078
1107
  }
1079
- updateMeshProperties(e, t) {
1080
- var C, y, S, z, X;
1081
- const { rect: i, styles: r } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c, a = this.renderer.domElement.height / c;
1082
- e.material = e.userData.baseMaterial;
1083
- let l = ((C = e.material.userData) == null ? void 0 : C.shadowPadding) || 0;
1084
- e.scale.set(i.width + l * 2, i.height + l * 2, 1), e.userData.domRect = {
1085
- x: i.x,
1086
- y: i.y,
1087
- width: i.width,
1088
- height: i.height
1089
- };
1090
- const o = 1e-3;
1108
+ updateMeshProperties(A, e) {
1109
+ var f, y, U, S, D;
1110
+ const { rect: s, styles: i } = e, o = this.renderer.getPixelRatio(), r = this.renderer.domElement.width / o, g = this.renderer.domElement.height / o;
1111
+ A.material = A.userData.baseMaterial;
1112
+ let n = ((f = A.material.userData) == null ? void 0 : f.shadowPadding) || 0;
1113
+ A.scale.set(s.width + n * 2, s.height + n * 2, 1), A.userData.domRect = {
1114
+ x: s.x,
1115
+ y: s.y,
1116
+ width: s.width,
1117
+ height: s.height
1118
+ }, A.userData.needsNativeReset = !0;
1119
+ const a = 1e-3;
1091
1120
  this.renderOrder++;
1092
- const f = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
1093
- let d, p;
1121
+ let I, c;
1094
1122
  if (this.isViewport)
1095
- d = i.x - window.innerWidth / 2 + i.width / 2, p = -i.y + window.innerHeight / 2 - i.height / 2;
1123
+ I = s.x - window.innerWidth / 2 + s.width / 2, c = -s.y + window.innerHeight / 2 - s.height / 2;
1096
1124
  else {
1097
- const B = i.x - f, k = i.y - h;
1098
- d = B - n / 2 + i.width / 2, p = -k + a / 2 - i.height / 2;
1125
+ const u = s.x - this.targetPageX, Y = s.y - this.targetPageY;
1126
+ I = u - r / 2 + s.width / 2, c = -Y + g / 2 - s.height / 2;
1099
1127
  }
1100
- e.position.set(
1101
- d,
1102
- p,
1103
- r.zIndex + this.renderOrder * o
1128
+ A.position.set(
1129
+ I,
1130
+ c,
1131
+ i.zIndex + this.renderOrder * a
1104
1132
  );
1105
- const g = i.x, M = i.y;
1106
- e.userData.basePosition = { x: d, y: p }, e.userData.originalBasePosition = { x: d, y: p }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: g, y: M }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1107
- const m = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, b = window.getComputedStyle(m);
1108
- let E = 0, A = 0;
1109
- if (b.transform && b.transform !== "none") {
1110
- const B = new DOMMatrix(b.transform);
1111
- E = B.m41, A = B.m42;
1133
+ const h = s.x, B = s.y;
1134
+ A.userData.basePosition = { x: I, y: c }, A.userData.originalBasePosition = { x: I, y: c }, A.userData.baseSize = { width: s.width, height: s.height }, A.userData.baseDOM = { x: h, y: B }, A.userData.isFixed = e.isFixed, A.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1135
+ const C = e.element.nodeType === Node.TEXT_NODE ? e.element.parentElement : e.element, w = window.getComputedStyle(C);
1136
+ let Q = 0, b = 0;
1137
+ if (w.transform && w.transform !== "none") {
1138
+ const u = new DOMMatrix(w.transform);
1139
+ Q = u.m41, b = u.m42;
1112
1140
  }
1113
- if (e.userData.baseTransform = { x: E, y: A }, delete e.userData.originRatioX, delete e.userData.originRatioY, W.update(
1114
- e.userData.baseMaterial,
1141
+ if (A.userData.baseTransform = { x: Q, y: b }, delete A.userData.originRatioX, delete A.userData.originRatioY, K.update(
1142
+ A.userData.baseMaterial,
1115
1143
  "BOX",
1116
- r,
1144
+ i,
1117
1145
  "",
1118
- i.width,
1119
- i.height,
1146
+ s.width,
1147
+ s.height,
1120
1148
  this.qualityFactor,
1121
- t.isTraveler ? (y = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : y.texture : this.textureManager.get(t.element)
1122
- ), t.nativeStyles && t.nativeRect) {
1123
- if (!e.userData.nativeMesh) {
1124
- const U = W.create(
1149
+ e.isTraveler ? (y = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : y.texture : this.textureManager.get(e.element)
1150
+ ), e.nativeStyles && e.nativeRect) {
1151
+ if (!A.userData.nativeMesh) {
1152
+ const X = K.create(
1125
1153
  "BOX",
1126
- t.nativeStyles,
1154
+ e.nativeStyles,
1127
1155
  "",
1128
- t.nativeRect.width,
1129
- t.nativeRect.height,
1156
+ e.nativeRect.width,
1157
+ e.nativeRect.height,
1130
1158
  this.qualityFactor,
1131
- t.isTraveler ? (S = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : S.texture : this.textureManager.get(t.element),
1132
- t.shaderHooks
1133
- ), V = new w.Mesh(e.geometry, U);
1134
- t.type === "TEXT" && (V.name = "BG_MESH"), this.scene.add(V), e.userData.nativeMesh = V;
1159
+ e.isTraveler ? (U = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : U.texture : e.nativeStyles.imageSrc && e.nativeStyles.imageSrc !== e.styles.imageSrc ? new E.TextureLoader().load(e.nativeStyles.imageSrc) : this.textureManager.get(e.element),
1160
+ e.shaderHooks
1161
+ ), G = new E.Mesh(A.geometry, X);
1162
+ e.type === "TEXT" && (G.name = "BG_MESH"), this.scene.add(G), A.userData.nativeMesh = G;
1135
1163
  }
1136
- const B = e.userData.nativeMesh;
1137
- let k, j;
1164
+ const u = A.userData.nativeMesh;
1165
+ let Y, gA;
1138
1166
  if (this.isViewport)
1139
- k = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, j = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1167
+ Y = e.nativeRect.x - window.innerWidth / 2 + e.nativeRect.width / 2, gA = -e.nativeRect.y + window.innerHeight / 2 - e.nativeRect.height / 2;
1140
1168
  else {
1141
- const U = t.nativeRect.x - f, V = t.nativeRect.y - h;
1142
- k = U - n / 2 + t.nativeRect.width / 2, j = -V + a / 2 - t.nativeRect.height / 2;
1169
+ const X = e.nativeRect.x - this.targetPageX, G = e.nativeRect.y - this.targetPageY;
1170
+ Y = X - r / 2 + e.nativeRect.width / 2, gA = -G + g / 2 - e.nativeRect.height / 2;
1143
1171
  }
1144
- let J = t.nativeRect.width, Z = t.nativeRect.height, L = k, _ = j;
1145
- if (t.nativeStyles.transform) {
1146
- const U = t.nativeStyles.transform, V = U.match(/scale\(([\d.]+%?)\)/);
1147
- if (V) {
1148
- let x = parseFloat(V[1]);
1149
- V[1].includes("%") && (x /= 100), J *= x, Z *= x;
1172
+ let cA = e.nativeRect.width, F = e.nativeRect.height, M = Y, P = gA;
1173
+ if (e.nativeStyles.transform) {
1174
+ const X = e.nativeStyles.transform, G = X.match(/scale\(([\d.]+%?)\)/);
1175
+ if (G) {
1176
+ let p = parseFloat(G[1]);
1177
+ G[1].includes("%") && (p /= 100), cA *= p, F *= p;
1150
1178
  }
1151
- const ie = U.match(/scaleX\(([\d.]+%?)\)/);
1152
- if (ie) {
1153
- let x = parseFloat(ie[1]);
1154
- ie[1].includes("%") && (x /= 100), J *= x;
1179
+ const $ = X.match(/scaleX\(([\d.]+%?)\)/);
1180
+ if ($) {
1181
+ let p = parseFloat($[1]);
1182
+ $[1].includes("%") && (p /= 100), cA *= p;
1155
1183
  }
1156
- const se = U.match(/scaleY\(([\d.]+%?)\)/);
1157
- if (se) {
1158
- let x = parseFloat(se[1]);
1159
- se[1].includes("%") && (x /= 100), Z *= x;
1184
+ const IA = X.match(/scaleY\(([\d.]+%?)\)/);
1185
+ if (IA) {
1186
+ let p = parseFloat(IA[1]);
1187
+ IA[1].includes("%") && (p /= 100), F *= p;
1160
1188
  }
1161
- const ne = U.match(/translate\(([^,]+),\s*([^)]+)\)/);
1162
- if (ne) {
1163
- const x = ne[1].trim(), T = ne[2].trim();
1164
- let F = parseFloat(x);
1165
- x.includes("%") && (F = F / 100 * t.nativeRect.width);
1166
- let D = parseFloat(T);
1167
- T.includes("%") && (D = D / 100 * t.nativeRect.height), L += F, _ -= D;
1189
+ const rA = X.match(/translate\(([^,]+),\s*([^)]+)\)/);
1190
+ if (rA) {
1191
+ const p = rA[1].trim(), z = rA[2].trim();
1192
+ let dA = parseFloat(p);
1193
+ p.includes("%") && (dA = dA / 100 * e.nativeRect.width);
1194
+ let EA = parseFloat(z);
1195
+ z.includes("%") && (EA = EA / 100 * e.nativeRect.height), M += dA, P -= EA;
1168
1196
  }
1169
- const he = U.match(/translateX\(([^)]+)\)/);
1170
- if (he) {
1171
- const x = he[1].trim();
1172
- let T = parseFloat(x);
1173
- x.includes("%") && (T = T / 100 * t.nativeRect.width), L += T;
1197
+ const AA = X.match(/translateX\(([^)]+)\)/);
1198
+ if (AA) {
1199
+ const p = AA[1].trim();
1200
+ let z = parseFloat(p);
1201
+ p.includes("%") && (z = z / 100 * e.nativeRect.width), M += z;
1174
1202
  }
1175
- const v = U.match(/translateY\(([^)]+)\)/);
1176
- if (v) {
1177
- const x = v[1].trim();
1178
- let T = parseFloat(x);
1179
- x.includes("%") && (T = T / 100 * t.nativeRect.height), _ -= T;
1203
+ const sA = X.match(/translateY\(([^)]+)\)/);
1204
+ if (sA) {
1205
+ const p = sA[1].trim();
1206
+ let z = parseFloat(p);
1207
+ p.includes("%") && (z = z / 100 * e.nativeRect.height), P -= z;
1180
1208
  }
1181
1209
  }
1182
- let K = ((z = B.material.userData) == null ? void 0 : z.shadowPadding) || 0;
1183
- B.scale.set(J + K * 2, Z + K * 2, 1), B.position.set(
1184
- L,
1185
- _,
1186
- t.nativeStyles.zIndex + this.renderOrder * o
1187
- ), W.update(
1188
- B.material,
1210
+ let BA = ((S = u.material.userData) == null ? void 0 : S.shadowPadding) || 0;
1211
+ u.scale.set(cA + BA * 2, F + BA * 2, 1), u.position.set(
1212
+ M,
1213
+ P,
1214
+ e.nativeStyles.zIndex + this.renderOrder * a
1215
+ ), K.update(
1216
+ u.material,
1189
1217
  "BOX",
1190
- t.nativeStyles,
1218
+ e.nativeStyles,
1191
1219
  "",
1192
- t.nativeRect.width,
1193
- t.nativeRect.height,
1220
+ e.nativeRect.width,
1221
+ e.nativeRect.height,
1194
1222
  this.qualityFactor,
1195
- t.isTraveler ? (X = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : X.texture : this.textureManager.get(t.element)
1223
+ e.isTraveler ? (D = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : D.texture : u.material.uniforms.uTexture.value || this.textureManager.get(e.element)
1196
1224
  );
1197
1225
  } else
1198
- e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof w.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1199
- }
1200
- updateMeshLayers(e, t) {
1201
- const i = t.visibility & $ ? O.BASE : O.HIDDEN;
1202
- if (e.layers.set(i), t.visibility & ae && e.layers.enable(O.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1203
- const r = e.userData.nativeMesh;
1204
- if (r.layers.set(O.HIDDEN), t.visibility & $) {
1205
- r.layers.enable(O.getCaptureLayer(t.nativeLayer));
1206
- for (let c = t.captureLayer; c <= N.MAX_LAYERS + 1; c++)
1207
- c !== t.nativeLayer && e.layers.enable(O.getCaptureLayer(c));
1226
+ A.userData.nativeMesh && (this.scene.remove(A.userData.nativeMesh), A.userData.nativeMesh.material instanceof E.Material && A.userData.nativeMesh.material.dispose(), delete A.userData.nativeMesh);
1227
+ }
1228
+ updateMeshLayers(A, e) {
1229
+ const s = e.visibility & q ? L.BASE : L.HIDDEN;
1230
+ if (A.layers.set(s), e.visibility & lA && A.layers.enable(L.SELECTED), A.userData.nativeMesh && e.nativeLayer !== void 0) {
1231
+ const i = A.userData.nativeMesh;
1232
+ if (i.layers.set(L.HIDDEN), e.visibility & q) {
1233
+ i.layers.enable(L.getCaptureLayer(e.nativeLayer));
1234
+ for (let o = e.captureLayer; o <= H.MAX_LAYERS + 1; o++)
1235
+ o !== e.nativeLayer && A.layers.enable(L.getCaptureLayer(o));
1208
1236
  }
1209
- } else if (t.visibility & $)
1210
- for (let r = t.captureLayer; r <= N.MAX_LAYERS + 1; r++)
1211
- e.layers.enable(O.getCaptureLayer(r));
1237
+ } else if (e.visibility & q)
1238
+ for (let i = e.captureLayer; i <= H.MAX_LAYERS + 1; i++)
1239
+ A.layers.enable(L.getCaptureLayer(i));
1212
1240
  }
1213
- captureRenderTarget(e, t, i) {
1214
- if (e.size === 0 || !i)
1241
+ captureRenderTarget(A, e, s) {
1242
+ if (A.size === 0 || !s)
1215
1243
  return;
1216
- const r = new w.Color(), c = this.renderer.getClearAlpha();
1217
- this.renderer.getClearColor(r), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(i), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1218
- const n = new w.Vector3(), a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, o = this.renderer.getPixelRatio();
1219
- for (const f of e) {
1220
- n.setFromMatrixPosition(f.matrixWorld), n.project(this.camera);
1221
- const h = (n.x + 1) / 2 * a, d = (n.y + 1) / 2 * l;
1222
- let p = 0, g = 1;
1223
- typeof this.clipArea == "number" ? g = this.clipArea : this.clipArea.endsWith("%") ? g = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1224
- const M = f.scale.x * g + 0.5, m = f.scale.y * g + 0.5, b = h - M / 2, E = d - m / 2, A = (b * this.qualityFactor - p) / o, C = (E * this.qualityFactor - p) / o, y = (M * this.qualityFactor + p * 2) / o, S = (m * this.qualityFactor + p * 2) / o;
1225
- this.renderer.setScissor(A, C, y, S), this.renderer.render(this.scene, this.camera);
1244
+ const i = new E.Color(), o = this.renderer.getClearAlpha();
1245
+ this.renderer.getClearColor(i), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(s), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(e);
1246
+ const r = new E.Vector3(), g = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, a = this.renderer.getPixelRatio();
1247
+ for (const I of A) {
1248
+ r.setFromMatrixPosition(I.matrixWorld), r.project(this.camera);
1249
+ const c = (r.x + 1) / 2 * g, h = (r.y + 1) / 2 * n;
1250
+ let B = 0, C = 1;
1251
+ typeof this.clipArea == "number" ? C = this.clipArea : this.clipArea.endsWith("%") ? C = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (B = parseFloat(this.clipArea));
1252
+ const w = I.scale.x * C + 0.5, Q = I.scale.y * C + 0.5, b = c - w / 2, f = h - Q / 2, y = (b * this.qualityFactor - B) / a, U = (f * this.qualityFactor - B) / a, S = (w * this.qualityFactor + B * 2) / a, D = (Q * this.qualityFactor + B * 2) / a;
1253
+ this.renderer.setScissor(y, U, S, D), this.renderer.render(this.scene, this.camera);
1226
1254
  }
1227
- this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(r, c);
1255
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, o);
1228
1256
  }
1229
1257
  render() {
1230
- for (let l = 0; l < N.MAX_LAYERS; l++) {
1231
- const o = l + 1;
1258
+ for (let n = 0; n < H.MAX_LAYERS; n++) {
1259
+ const a = n + 1;
1232
1260
  this.captureRenderTarget(
1233
- this.travelersByLayer[l],
1234
- O.getCaptureLayer(o),
1235
- this.renderTargets[l]
1261
+ this.travelersByLayer[n],
1262
+ L.getCaptureLayer(a),
1263
+ this.renderTargets[n]
1236
1264
  );
1237
1265
  }
1238
- const e = this.renderer.getContext(), t = this.renderer.getPixelRatio(), i = this.renderer.domElement.height / t, r = this.renderer.domElement, c = r.getBoundingClientRect().top, n = r.getBoundingClientRect().left, a = (l, o) => {
1239
- if (o && o.width > 0 && o.height > 0) {
1240
- const f = Math.floor((o.x - n) * t), h = Math.floor(
1241
- (i - (o.y - c + o.height)) * t
1242
- ), d = Math.ceil(o.width * t), p = Math.ceil(o.height * t);
1243
- l.onBeforeRender = () => {
1244
- e.enable(e.SCISSOR_TEST), e.scissor(f, h, d, p);
1245
- }, l.onAfterRender = () => {
1246
- e.disable(e.SCISSOR_TEST);
1247
- }, l.__hasScissorHook = !0;
1266
+ const A = this.renderer.getContext(), e = this.renderer.getPixelRatio(), s = this.renderer.domElement.height / e, i = this.renderer.domElement, o = i.getBoundingClientRect().top, r = i.getBoundingClientRect().left, g = (n, a) => {
1267
+ if (a && a.width > 0 && a.height > 0) {
1268
+ const I = Math.floor((a.x - r) * e), c = Math.floor(
1269
+ (s - (a.y - o + a.height)) * e
1270
+ ), h = Math.ceil(a.width * e), B = Math.ceil(a.height * e);
1271
+ n.onBeforeRender = () => {
1272
+ A.enable(A.SCISSOR_TEST), A.scissor(I, c, h, B);
1273
+ }, n.onAfterRender = () => {
1274
+ A.disable(A.SCISSOR_TEST);
1275
+ }, n.__hasScissorHook = !0;
1248
1276
  } else
1249
- l.__hasScissorHook && (l.onBeforeRender = () => {
1250
- }, l.onAfterRender = () => {
1251
- }, l.__hasScissorHook = !1);
1277
+ n.__hasScissorHook && (n.onBeforeRender = () => {
1278
+ }, n.onAfterRender = () => {
1279
+ }, n.__hasScissorHook = !1);
1252
1280
  };
1253
- this.scene.children.forEach((l) => {
1254
- var h;
1255
- const o = l, f = (h = o.userData) == null ? void 0 : h.scissorRect;
1256
- a(o, f), o.children.forEach((d) => {
1257
- d.name.startsWith("TEXT_CHILD") && a(d, f);
1281
+ this.scene.children.forEach((n) => {
1282
+ var c;
1283
+ const a = n, I = (c = a.userData) == null ? void 0 : c.scissorRect;
1284
+ g(a, I), a.children.forEach((h) => {
1285
+ h.name.startsWith("TEXT_CHILD") && g(h, I);
1258
1286
  });
1259
1287
  }), this.renderer.render(this.scene, this.camera);
1260
1288
  }
1261
- syncMeshesByDOM() {
1262
- const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, i = this.renderer.getPixelRatio(), r = this.renderer.domElement.width / i, c = this.renderer.domElement.height / i;
1263
- this.scene.children.forEach((n) => {
1264
- var h, d;
1265
- const a = n;
1266
- if (!a.userData || !a.userData.domElement)
1289
+ saveInitialLocals(A) {
1290
+ this.scene.children.forEach((e) => {
1291
+ const s = e;
1292
+ if (s.userData.wasmIndex !== void 0) {
1293
+ const i = s.userData.wasmIndex * iA;
1294
+ s.userData.initialLocalX = A[i + mA], s.userData.initialLocalY = A[i + pA];
1295
+ }
1296
+ });
1297
+ }
1298
+ syncMeshesByWasm(A) {
1299
+ const e = this.renderer.getPixelRatio(), s = this.renderer.domElement.width / e, i = this.renderer.domElement.height / e;
1300
+ this.scene.children.forEach((o) => {
1301
+ const r = o;
1302
+ if (!r.userData || r.userData.wasmIndex === void 0)
1267
1303
  return;
1268
- const l = a.userData.domElement;
1269
- if (!l.isConnected)
1304
+ const n = r.userData.wasmIndex * iA, a = A[n + ie], I = A[n + re], c = r.userData.domRect;
1305
+ if (!c)
1270
1306
  return;
1271
- let o;
1272
- if (l.nodeType === Node.TEXT_NODE) {
1273
- const p = document.createRange();
1274
- p.selectNode(l), o = p.getBoundingClientRect();
1275
- } else
1276
- o = l.getBoundingClientRect();
1277
- const f = a.userData.domRect;
1278
- if (!f || Math.abs(o.x - f.x) > 0.5 || Math.abs(o.y - f.y) > 0.5 || Math.abs(o.width - f.width) > 0.5 || Math.abs(o.height - f.height) > 0.5) {
1279
- a.userData.domRect = {
1280
- x: o.x,
1281
- y: o.y,
1282
- width: o.width,
1283
- height: o.height
1284
- };
1285
- const p = a.userData.clipElements;
1286
- if (p && p.length > 0) {
1287
- let b = -1 / 0, E = -1 / 0, A = 1 / 0, C = 1 / 0;
1288
- for (const y of p) {
1289
- const S = y.getBoundingClientRect();
1290
- b = Math.max(b, S.left), E = Math.max(E, S.top), A = Math.min(A, S.right), C = Math.min(C, S.bottom);
1291
- }
1292
- a.userData.scissorRect = {
1293
- x: b,
1294
- y: E,
1295
- width: Math.max(0, A - b),
1296
- height: Math.max(0, C - E)
1297
- };
1298
- } else
1299
- a.userData.scissorRect = void 0;
1300
- let g, M;
1301
- if (this.isViewport)
1302
- g = o.x - window.innerWidth / 2 + o.width / 2, M = -o.y + window.innerHeight / 2 - o.height / 2;
1307
+ const h = this.fixedMeshes.has(r), B = h ? 0 : this.getScrollX(), C = h ? 0 : this.getScrollY();
1308
+ let w, Q;
1309
+ if (this.isViewport) {
1310
+ const f = a - B, y = I - C;
1311
+ w = f - window.innerWidth / 2 + c.width / 2, Q = -y + window.innerHeight / 2 - c.height / 2;
1312
+ } else {
1313
+ const f = a - this.targetPageX, y = I - this.targetPageY;
1314
+ w = f - s / 2 + c.width / 2, Q = -y + i / 2 - c.height / 2;
1315
+ }
1316
+ const b = r.position.z;
1317
+ if (r.position.set(w, Q, b), r.userData.nativeMesh) {
1318
+ const f = r.userData.nativeMesh;
1319
+ if (r.userData.needsNativeReset)
1320
+ r.userData.needsNativeReset = !1;
1303
1321
  else {
1304
- const b = o.x - e, E = o.y - t;
1305
- g = b - r / 2 + o.width / 2, M = -E + c / 2 - o.height / 2;
1306
- }
1307
- a.position.setX(g), a.position.setY(M);
1308
- let m = ((h = a.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1309
- if (a.scale.set(o.width + m * 2, o.height + m * 2, 1), a.updateMatrixWorld(), a.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(a.material, {
1310
- width: o.width,
1311
- height: o.height
1312
- }), a.userData.nativeMesh) {
1313
- const b = a.userData.nativeMesh;
1314
- let E = o.width, A = o.height, C = g, y = M;
1315
- if (a.userData.nativeTransform) {
1316
- const z = a.userData.nativeTransform, X = z.match(/scale\(([\d.]+%?)\)/);
1317
- if (X) {
1318
- let L = parseFloat(X[1]);
1319
- X[1].includes("%") && (L /= 100), E *= L, A *= L;
1320
- }
1321
- const B = z.match(/scaleX\(([\d.]+%?)\)/);
1322
- if (B) {
1323
- let L = parseFloat(B[1]);
1324
- B[1].includes("%") && (L /= 100), E *= L;
1325
- }
1326
- const k = z.match(/scaleY\(([\d.]+%?)\)/);
1327
- if (k) {
1328
- let L = parseFloat(k[1]);
1329
- k[1].includes("%") && (L /= 100), A *= L;
1330
- }
1331
- const j = z.match(/translate\(([^,]+),\s*([^)]+)\)/);
1332
- if (j) {
1333
- const L = j[1].trim(), _ = j[2].trim();
1334
- let K = parseFloat(L);
1335
- L.includes("%") && (K = K / 100 * o.width);
1336
- let U = parseFloat(_);
1337
- _.includes("%") && (U = U / 100 * o.height), C += K, y -= U;
1338
- }
1339
- const J = z.match(/translateX\(([^)]+)\)/);
1340
- if (J) {
1341
- const L = J[1].trim();
1342
- let _ = parseFloat(L);
1343
- L.includes("%") && (_ = _ / 100 * o.width), C += _;
1344
- }
1345
- const Z = z.match(/translateY\(([^)]+)\)/);
1346
- if (Z) {
1347
- const L = Z[1].trim();
1348
- let _ = parseFloat(L);
1349
- L.includes("%") && (_ = _ / 100 * o.height), y -= _;
1350
- }
1351
- }
1352
- let S = ((d = b.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1353
- b.position.setX(C), b.position.setY(y), b.scale.set(E + S * 2, A + S * 2, 1), b.updateMatrixWorld(), b.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(b.material, {
1354
- width: E,
1355
- height: A
1356
- });
1322
+ const y = w - r.userData.basePosition.x, U = Q - r.userData.basePosition.y;
1323
+ f.position.setX(f.position.x + y), f.position.setY(f.position.y + U);
1357
1324
  }
1358
1325
  }
1326
+ r.userData.basePosition.x = w, r.userData.basePosition.y = Q;
1359
1327
  });
1360
1328
  }
1361
1329
  }
1362
- function at(s) {
1363
- const e = s.textContent || "", t = [];
1364
- let i = "", r = null, c = -1;
1365
- const n = (o, f) => {
1366
- for (let h = 0; h < o.length; h++) {
1367
- const d = o[h], p = document.createRange();
1368
- p.setStart(s, f + h), p.setEnd(s, f + h + 1);
1369
- const g = p.getBoundingClientRect();
1370
- if (g.width === 0 && g.height === 0) {
1371
- i += d;
1330
+ function Te(t) {
1331
+ const A = t.textContent || "", e = [];
1332
+ let s = "", i = null, o = -1;
1333
+ const r = (a, I) => {
1334
+ for (let c = 0; c < a.length; c++) {
1335
+ const h = a[c], B = document.createRange();
1336
+ B.setStart(t, I + c), B.setEnd(t, I + c + 1);
1337
+ const C = B.getBoundingClientRect();
1338
+ if (C.width === 0 && C.height === 0) {
1339
+ s += h;
1372
1340
  continue;
1373
1341
  }
1374
- c === -1 || Math.abs(g.top - c) > g.height / 2 ? (i && r && t.push({
1375
- text: i,
1342
+ o === -1 || Math.abs(C.top - o) > C.height / 2 ? (s && i && e.push({
1343
+ text: s,
1376
1344
  rect: {
1377
- left: r.left,
1378
- top: r.top,
1379
- width: r.right - r.left,
1380
- height: r.bottom - r.top
1345
+ left: i.left,
1346
+ top: i.top,
1347
+ width: i.right - i.left,
1348
+ height: i.bottom - i.top
1381
1349
  }
1382
- }), i = d, r = {
1383
- left: g.left,
1384
- top: g.top,
1385
- right: g.right,
1386
- bottom: g.bottom
1387
- }, c = g.top) : (i += d, r && (r.left = Math.min(r.left, g.left), r.top = Math.min(r.top, g.top), r.right = Math.max(r.right, g.right), r.bottom = Math.max(
1388
- r.bottom,
1389
- g.bottom
1350
+ }), s = h, i = {
1351
+ left: C.left,
1352
+ top: C.top,
1353
+ right: C.right,
1354
+ bottom: C.bottom
1355
+ }, o = C.top) : (s += h, i && (i.left = Math.min(i.left, C.left), i.top = Math.min(i.top, C.top), i.right = Math.max(i.right, C.right), i.bottom = Math.max(
1356
+ i.bottom,
1357
+ C.bottom
1390
1358
  )));
1391
1359
  }
1392
- }, a = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1393
- let l = 0;
1394
- for (const o of a) {
1395
- const f = document.createRange();
1396
- f.setStart(s, l), f.setEnd(s, l + o.length);
1397
- const h = f.getClientRects();
1398
- if (h.length > 1)
1399
- n(o, l);
1360
+ }, g = A.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1361
+ let n = 0;
1362
+ for (const a of g) {
1363
+ const I = document.createRange();
1364
+ I.setStart(t, n), I.setEnd(t, n + a.length);
1365
+ const c = I.getClientRects();
1366
+ if (c.length > 1)
1367
+ r(a, n);
1400
1368
  else {
1401
- const d = h.length === 1 ? h[0] : f.getBoundingClientRect();
1402
- if (d.width === 0 && d.height === 0) {
1403
- i += o, l += o.length;
1369
+ const h = c.length === 1 ? c[0] : I.getBoundingClientRect();
1370
+ if (h.width === 0 && h.height === 0) {
1371
+ s += a, n += a.length;
1404
1372
  continue;
1405
1373
  }
1406
- c === -1 || Math.abs(d.top - c) > d.height / 2 ? (i && r && t.push({
1407
- text: i,
1374
+ o === -1 || Math.abs(h.top - o) > h.height / 2 ? (s && i && e.push({
1375
+ text: s,
1408
1376
  rect: {
1409
- left: r.left,
1410
- top: r.top,
1411
- width: r.right - r.left,
1412
- height: r.bottom - r.top
1377
+ left: i.left,
1378
+ top: i.top,
1379
+ width: i.right - i.left,
1380
+ height: i.bottom - i.top
1413
1381
  }
1414
- }), i = o, r = {
1415
- left: d.left,
1416
- top: d.top,
1417
- right: d.right,
1418
- bottom: d.bottom
1419
- }, c = d.top) : (i += o, r && (r.left = Math.min(r.left, d.left), r.top = Math.min(r.top, d.top), r.right = Math.max(r.right, d.right), r.bottom = Math.max(
1420
- r.bottom,
1421
- d.bottom
1382
+ }), s = a, i = {
1383
+ left: h.left,
1384
+ top: h.top,
1385
+ right: h.right,
1386
+ bottom: h.bottom
1387
+ }, o = h.top) : (s += a, i && (i.left = Math.min(i.left, h.left), i.top = Math.min(i.top, h.top), i.right = Math.max(i.right, h.right), i.bottom = Math.max(
1388
+ i.bottom,
1389
+ h.bottom
1422
1390
  )));
1423
1391
  }
1424
- l += o.length;
1392
+ n += a.length;
1425
1393
  }
1426
- return i && r && t.push({
1427
- text: i,
1394
+ return s && i && e.push({
1395
+ text: s,
1428
1396
  rect: {
1429
- left: r.left,
1430
- top: r.top,
1431
- width: r.right - r.left,
1432
- height: r.bottom - r.top
1397
+ left: i.left,
1398
+ top: i.top,
1399
+ width: i.right - i.left,
1400
+ height: i.bottom - i.top
1433
1401
  }
1434
- }), t.filter(
1435
- (o) => o.text.trim().length > 0 && o.rect.width > 0 && o.rect.height > 0
1402
+ }), e.filter(
1403
+ (a) => a.text.trim().length > 0 && a.rect.width > 0 && a.rect.height > 0
1436
1404
  );
1437
1405
  }
1438
- function ke(s) {
1439
- const e = parseFloat(s.fontSize);
1440
- let t = parseFloat(s.lineHeight);
1441
- isNaN(t) && (t = e * 1.2);
1442
- let i = parseFloat(s.letterSpacing);
1443
- return isNaN(i) && (i = 0), {
1444
- font: `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`,
1445
- fontSize: s.fontSize,
1446
- color: s.color,
1447
- textAlign: s.textAlign || "start",
1406
+ function ee(t) {
1407
+ const A = parseFloat(t.fontSize);
1408
+ let e = parseFloat(t.lineHeight);
1409
+ isNaN(e) && (e = A * 1.2);
1410
+ let s = parseFloat(t.letterSpacing);
1411
+ return isNaN(s) && (s = 0), {
1412
+ font: `${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily}`,
1413
+ fontSize: t.fontSize,
1414
+ color: t.color,
1415
+ textAlign: t.textAlign || "start",
1448
1416
  textBaseline: "alphabetic",
1449
- direction: s.direction || "inherit",
1450
- lineHeight: t,
1451
- letterSpacing: i
1417
+ direction: t.direction || "inherit",
1418
+ lineHeight: e,
1419
+ letterSpacing: s
1452
1420
  };
1453
1421
  }
1454
- function Fe(s, e = re | ue | $e | be | pe, t, i = 1, r = 0, c = 2, n, a, l) {
1455
- var K, U, V, ie, se, ne, he;
1456
- if (s.nodeType === Node.TEXT_NODE) {
1457
- const v = s;
1458
- if (!v.textContent || !v.textContent.trim())
1422
+ function ce(t, A = nA | fA | fe | TA | SA, e, s = 1, i = 0, o = 2, r, g, n, a, I = -1, c = 0, h = 0, B = !1) {
1423
+ var kA, UA, HA, XA, JA, zA, _A, WA, KA;
1424
+ const C = (kA = a == null ? void 0 : a.scrollX) != null ? kA : window.scrollX, w = (UA = a == null ? void 0 : a.scrollY) != null ? UA : window.scrollY;
1425
+ if (t.nodeType === Node.TEXT_NODE) {
1426
+ const d = t;
1427
+ if (!d.textContent || !d.textContent.trim())
1459
1428
  return null;
1460
- const x = v.textContent.replace(/\s+/g, " ");
1461
- if (x.length === 0)
1429
+ const R = d.textContent.replace(/\s+/g, " ");
1430
+ if (R.length === 0)
1462
1431
  return null;
1463
- const T = at(v);
1432
+ const T = Te(d);
1464
1433
  if (T.length === 0)
1465
1434
  return null;
1466
- const F = v.parentElement, D = F ? window.getComputedStyle(F) : null;
1467
- if (!D)
1435
+ const _ = d.parentElement, N = _ ? window.getComputedStyle(_) : null;
1436
+ if (!N)
1468
1437
  return null;
1469
- const G = Math.min(...T.map((R) => R.rect.left)), Y = Math.min(...T.map((R) => R.rect.top)), Q = Math.max(...T.map((R) => R.rect.left + R.rect.width)), I = Math.max(...T.map((R) => R.rect.top + R.rect.height));
1438
+ const x = B || N.position === "fixed", k = Math.min(...T.map((m) => m.rect.left)), O = Math.min(...T.map((m) => m.rect.top)), v = Math.max(...T.map((m) => m.rect.left + m.rect.width)), W = Math.max(...T.map((m) => m.rect.top + m.rect.height)), V = k + (x ? 0 : C), QA = O + (x ? 0 : w);
1439
+ let oA = -1;
1440
+ if (a && a.sharedArray) {
1441
+ oA = a.currentIndex++;
1442
+ const m = oA * iA;
1443
+ a.sharedArray[m + LA] = I, a.sharedArray[m + mA] = V - c, a.sharedArray[m + pA] = QA - h;
1444
+ }
1470
1445
  return {
1471
1446
  id: Math.random().toString(36).substring(2, 9),
1472
1447
  type: "TEXT",
1473
- element: v,
1448
+ element: d,
1474
1449
  rect: {
1475
- x: G + window.scrollX,
1476
- y: Y + window.scrollY,
1477
- width: Q - G,
1478
- height: I - Y
1450
+ x: k + (x ? 0 : C),
1451
+ y: O + (x ? 0 : w),
1452
+ width: v - k,
1453
+ height: W - O
1479
1454
  },
1480
1455
  styles: {
1481
1456
  backgroundColor: "transparent",
1482
1457
  backgroundImage: "",
1483
- opacity: F && F.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1484
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + r,
1458
+ opacity: _ && _.dataset[tA.KEY] === tA.VALUES.HIDE ? 1 : parseFloat(N.opacity),
1459
+ zIndex: (isNaN(parseInt(N.zIndex)) ? 0 : parseInt(N.zIndex)) + i,
1485
1460
  borderRadius: "0px",
1486
1461
  borderColor: "transparent",
1487
1462
  borderWidth: "0px",
1488
1463
  isTraveler: !1
1489
1464
  },
1490
- textContent: x,
1491
- textLines: T.map((R) => ({
1492
- text: R.text.trim(),
1465
+ textContent: R,
1466
+ textLines: T.map((m) => ({
1467
+ text: m.text.trim(),
1493
1468
  rect: {
1494
- x: R.rect.left + window.scrollX,
1495
- y: R.rect.top + window.scrollY,
1496
- width: R.rect.width,
1497
- height: R.rect.height
1469
+ x: m.rect.left + (x ? 0 : C),
1470
+ y: m.rect.top + (x ? 0 : w),
1471
+ width: m.rect.width,
1472
+ height: m.rect.height
1498
1473
  }
1499
1474
  })),
1500
- textStyles: ke(D),
1501
- dirtyMask: e,
1502
- visibility: t,
1475
+ textStyles: ee(N),
1476
+ dirtyMask: A,
1477
+ visibility: e,
1503
1478
  isTraveler: !1,
1504
- captureLayer: i,
1505
- isFixed: D.position === "fixed",
1506
- nativeLayer: n,
1507
- nativeStyles: a ? te(te({
1479
+ captureLayer: s,
1480
+ isFixed: x,
1481
+ nativeLayer: r,
1482
+ nativeStyles: g ? aA(aA({
1508
1483
  backgroundColor: "transparent",
1509
1484
  backgroundImage: "",
1510
- opacity: F && F.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1511
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + r,
1485
+ opacity: _ && _.dataset[tA.KEY] === tA.VALUES.HIDE ? 1 : parseFloat(N.opacity),
1486
+ zIndex: (isNaN(parseInt(N.zIndex)) ? 0 : parseInt(N.zIndex)) + i,
1512
1487
  borderRadius: "0px",
1513
1488
  borderColor: "transparent",
1514
1489
  borderWidth: "0px",
1515
1490
  isTraveler: !1
1516
- }, ke(D)), a) : void 0,
1517
- nativeRect: a ? {
1518
- x: G + window.scrollX,
1519
- y: Y + window.scrollY,
1520
- width: Q - G,
1521
- height: I - Y
1491
+ }, ee(N)), g) : void 0,
1492
+ nativeRect: g ? {
1493
+ x: k + (x ? 0 : C),
1494
+ y: O + (x ? 0 : w),
1495
+ width: v - k,
1496
+ height: W - O
1522
1497
  } : void 0,
1523
- clipElements: l,
1498
+ clipElements: n,
1499
+ wasmIndex: oA !== -1 ? oA : void 0,
1524
1500
  children: []
1525
1501
  };
1526
1502
  }
1527
- if (s.nodeType !== Node.ELEMENT_NODE)
1503
+ if (t.nodeType !== Node.ELEMENT_NODE)
1528
1504
  return null;
1529
- const o = s, f = o.dataset[P.KEY];
1530
- let h = t, d = t;
1531
- if (f) {
1532
- const v = new Set(f.split(/\s+/));
1533
- for (const x of v)
1534
- if (!Me.includes(x))
1505
+ const Q = t, b = Q.dataset[j.KEY];
1506
+ let f = e, y = e;
1507
+ if (b) {
1508
+ const d = new Set(b.split(/\s+/));
1509
+ for (const R of d)
1510
+ if (!PA.includes(R))
1535
1511
  throw new Error(
1536
- `[MirageEngine] Invalid filter token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1512
+ `[MirageEngine] Invalid filter token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1537
1513
  );
1538
- if (v.has(P.VALUES.END))
1514
+ if (d.has(j.VALUES.END))
1539
1515
  return null;
1540
- if (v.has(P.VALUES.INCLUDE_TREE) && v.has(P.VALUES.EXCLUDE_TREE))
1516
+ if (d.has(j.VALUES.INCLUDE_TREE) && d.has(j.VALUES.EXCLUDE_TREE))
1541
1517
  throw new Error(
1542
1518
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1543
1519
  );
1544
- if (v.has(P.VALUES.INCLUDE_SELF) && v.has(P.VALUES.EXCLUDE_SELF))
1520
+ if (d.has(j.VALUES.INCLUDE_SELF) && d.has(j.VALUES.EXCLUDE_SELF))
1545
1521
  throw new Error(
1546
1522
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1547
1523
  );
1548
- v.has(P.VALUES.INCLUDE_TREE) ? h = h | $ : v.has(P.VALUES.EXCLUDE_TREE) && (h = h & ~$), d = h, v.has(P.VALUES.INCLUDE_SELF) ? d = d | $ : v.has(P.VALUES.EXCLUDE_SELF) && (d = d & ~$);
1524
+ d.has(j.VALUES.INCLUDE_TREE) ? f = f | q : d.has(j.VALUES.EXCLUDE_TREE) && (f = f & ~q), y = f, d.has(j.VALUES.INCLUDE_SELF) ? y = y | q : d.has(j.VALUES.EXCLUDE_SELF) && (y = y & ~q);
1549
1525
  }
1550
- const p = o.dataset[q.KEY];
1551
- if (p) {
1552
- const v = new Set(p.split(/\s+/));
1553
- for (const x of v)
1554
- if (!Me.includes(x))
1526
+ const U = Q.dataset[Z.KEY];
1527
+ if (U) {
1528
+ const d = new Set(U.split(/\s+/));
1529
+ for (const R of d)
1530
+ if (!PA.includes(R))
1555
1531
  throw new Error(
1556
- `[MirageEngine] Invalid select token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1532
+ `[MirageEngine] Invalid select token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1557
1533
  );
1558
- if (v.has(q.VALUES.END))
1534
+ if (d.has(Z.VALUES.END))
1559
1535
  return null;
1560
- if (v.has(q.VALUES.INCLUDE_TREE) && v.has(q.VALUES.EXCLUDE_TREE))
1536
+ if (d.has(Z.VALUES.INCLUDE_TREE) && d.has(Z.VALUES.EXCLUDE_TREE))
1561
1537
  throw new Error(
1562
1538
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1563
1539
  );
1564
- if (v.has(q.VALUES.INCLUDE_SELF) && v.has(q.VALUES.EXCLUDE_SELF))
1540
+ if (d.has(Z.VALUES.INCLUDE_SELF) && d.has(Z.VALUES.EXCLUDE_SELF))
1565
1541
  throw new Error(
1566
1542
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1567
1543
  );
1568
- v.has(q.VALUES.INCLUDE_TREE) ? h = h | ae : v.has(q.VALUES.EXCLUDE_TREE) && (h = h & ~ae), d = h, v.has(q.VALUES.INCLUDE_SELF) ? d = d | ae : v.has(q.VALUES.EXCLUDE_SELF) && (d = d & ~ae);
1569
- }
1570
- const g = o.dataset[N.KEY];
1571
- let M = !1, m = a ? te({}, a) : {}, b = n;
1572
- if (g) {
1573
- let v = 1;
1574
- const x = g.indexOf("{"), T = g.lastIndexOf("}");
1575
- let F = g;
1576
- if (x !== -1 && T !== -1 && T > x) {
1577
- F = g.substring(0, x).trim();
1578
- const I = g.substring(x, T + 1);
1544
+ d.has(Z.VALUES.INCLUDE_TREE) ? f = f | lA : d.has(Z.VALUES.EXCLUDE_TREE) && (f = f & ~lA), y = f, d.has(Z.VALUES.INCLUDE_SELF) ? y = y | lA : d.has(Z.VALUES.EXCLUDE_SELF) && (y = y & ~lA);
1545
+ }
1546
+ const S = Q.dataset[H.KEY];
1547
+ let D = !1, u = g ? aA({}, g) : {}, Y = r;
1548
+ if (S) {
1549
+ let d = 1;
1550
+ const R = S.indexOf("{"), T = S.lastIndexOf("}");
1551
+ let _ = S;
1552
+ if (R !== -1 && T !== -1 && T > R) {
1553
+ _ = S.substring(0, R).trim();
1554
+ const v = S.substring(R, T + 1);
1579
1555
  try {
1580
- m = new Function("return " + I)();
1581
- } catch (R) {
1556
+ u = new Function("return " + v)();
1557
+ } catch (W) {
1582
1558
  console.warn(
1583
- `[MirageEngine] Failed to parse travel styles JSON: ${I}`
1559
+ `[MirageEngine] Failed to parse travel styles JSON: ${v}`
1584
1560
  );
1585
1561
  }
1586
1562
  }
1587
- const D = F.split(/\s+/);
1588
- let G = !1;
1589
- const Y = D.indexOf(N.VALUES.TRAVELER);
1590
- if (Y !== -1) {
1591
- M = !0, G = !0;
1592
- const I = D[Y + 1];
1593
- if (I && !isNaN(parseInt(I, 10)))
1594
- v = parseInt(I, 10);
1563
+ const N = _.split(/\s+/);
1564
+ let x = !1;
1565
+ const k = N.indexOf(H.VALUES.TRAVELER);
1566
+ if (k !== -1) {
1567
+ D = !0, x = !0;
1568
+ const v = N[k + 1];
1569
+ if (v && !isNaN(parseInt(v, 10)))
1570
+ d = parseInt(v, 10);
1595
1571
  else {
1596
- const R = D.find((oe) => !isNaN(parseInt(oe, 10)));
1597
- R && (v = parseInt(R, 10));
1572
+ const W = N.find((V) => !isNaN(parseInt(V, 10)));
1573
+ W && (d = parseInt(W, 10));
1598
1574
  }
1599
1575
  }
1600
- const Q = D.indexOf(N.VALUES.NATIVE);
1601
- if (Q !== -1) {
1602
- const I = D[Q + 1];
1603
- if (I && !isNaN(parseInt(I, 10)))
1604
- b = parseInt(I, 10);
1605
- else if (!M) {
1606
- const R = D.find((oe) => !isNaN(parseInt(oe, 10)));
1607
- R && (b = parseInt(R, 10));
1576
+ const O = N.indexOf(H.VALUES.NATIVE);
1577
+ if (O !== -1) {
1578
+ const v = N[O + 1];
1579
+ if (v && !isNaN(parseInt(v, 10)))
1580
+ Y = parseInt(v, 10);
1581
+ else if (!D) {
1582
+ const W = N.find((V) => !isNaN(parseInt(V, 10)));
1583
+ W && (Y = parseInt(W, 10));
1608
1584
  }
1609
1585
  }
1610
- if (G) {
1611
- const I = v + 1;
1612
- if (I < i)
1586
+ if (x) {
1587
+ const v = d + 1;
1588
+ if (v < s)
1613
1589
  throw new Error(
1614
- `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${i - 1}).`
1590
+ `[MirageEngine] Traveler layer (${d}) cannot be smaller than inherited capture layer (${s - 1}).`
1615
1591
  );
1616
- i = Math.min(I, N.MAX_LAYERS + 1);
1592
+ s = Math.min(v, H.MAX_LAYERS + 1);
1617
1593
  }
1618
1594
  }
1619
- const E = o.dataset[Pe.KEY];
1620
- let A;
1621
- E && (A = JSON.parse(E));
1622
- const C = o.getBoundingClientRect(), y = window.getComputedStyle(o);
1623
- if (C.width === 0 || C.height === 0 || y.display === "none")
1595
+ const gA = Q.dataset[ue.KEY];
1596
+ let cA;
1597
+ gA && (cA = JSON.parse(gA));
1598
+ const F = Q.getBoundingClientRect(), M = window.getComputedStyle(Q);
1599
+ if (F.width === 0 || F.height === 0 || M.display === "none")
1624
1600
  return null;
1625
- let S = o.getAttribute("data-mid");
1626
- S || (S = Math.random().toString(36).substring(2, 11), o.setAttribute("data-mid", S));
1627
- const z = parseInt(y.zIndex), X = (isNaN(z) ? 0 : z) + r;
1628
- let B;
1629
- if (o.tagName === "IMG")
1630
- B = o.src;
1631
- else if (o.tagName.toLowerCase() === "svg") {
1632
- const v = o.cloneNode(!0), x = m == null ? void 0 : m.color, T = m == null ? void 0 : m.fill, F = m == null ? void 0 : m.stroke, D = m == null ? void 0 : m.opacity, G = (R, oe) => {
1633
- const H = window.getComputedStyle(R), de = oe, ze = H.fill === H.color, Ne = H.stroke === H.color, me = T || (ze ? x : void 0) || H.fill;
1634
- me && me !== "none" && (de.style.fill = me);
1635
- const ve = F || (Ne ? x : void 0) || H.stroke;
1636
- ve && ve !== "none" && (de.style.stroke = ve), H.strokeWidth && H.strokeWidth !== "0px" && (de.style.strokeWidth = H.strokeWidth);
1637
- const Se = x || H.color;
1638
- Se && (de.style.color = Se);
1639
- const we = D || H.opacity;
1640
- we && we !== "1" && (de.style.opacity = we);
1641
- for (let fe = 0; fe < R.children.length; fe++)
1642
- G(R.children[fe], oe.children[fe]);
1601
+ const P = B || M.position === "fixed", BA = F.left + (P ? 0 : C), X = F.top + (P ? 0 : w);
1602
+ let G = -1;
1603
+ if (a && a.sharedArray) {
1604
+ G = a.currentIndex++;
1605
+ const d = G * iA;
1606
+ a.sharedArray[d + LA] = I, a.sharedArray[d + mA] = BA - c, a.sharedArray[d + pA] = X - h;
1607
+ }
1608
+ let $ = Q.getAttribute("data-mid");
1609
+ $ || ($ = Math.random().toString(36).substring(2, 11), Q.setAttribute("data-mid", $));
1610
+ const IA = parseInt(M.zIndex), rA = (isNaN(IA) ? 0 : IA) + i;
1611
+ let AA, sA;
1612
+ if (Q.tagName === "IMG")
1613
+ AA = Q.src;
1614
+ else if (Q.tagName.toLowerCase() === "svg") {
1615
+ const d = u == null ? void 0 : u.color, R = u == null ? void 0 : u.fill, T = u == null ? void 0 : u.stroke, _ = u == null ? void 0 : u.opacity, N = (x) => {
1616
+ const k = Q.cloneNode(!0), O = (QA, oA) => {
1617
+ const m = window.getComputedStyle(QA), uA = oA, le = m.fill === m.color, he = m.stroke === m.color, bA = (x ? R || (le ? d : void 0) : void 0) || m.fill;
1618
+ bA && bA !== "none" && (uA.style.fill = bA);
1619
+ const NA = (x ? T || (he ? d : void 0) : void 0) || m.stroke;
1620
+ NA && NA !== "none" && (uA.style.stroke = NA), m.strokeWidth && m.strokeWidth !== "0px" && (uA.style.strokeWidth = m.strokeWidth);
1621
+ const OA = (x ? d : void 0) || m.color;
1622
+ OA && (uA.style.color = OA);
1623
+ const MA = (x ? _ : void 0) || m.opacity;
1624
+ MA && MA !== "1" && (uA.style.opacity = MA);
1625
+ for (let yA = 0; yA < QA.children.length; yA++)
1626
+ O(QA.children[yA], oA.children[yA]);
1627
+ };
1628
+ O(Q, k);
1629
+ const v = Q.getBoundingClientRect(), W = window.devicePixelRatio * o;
1630
+ k.hasAttribute("viewBox") || k.setAttribute("viewBox", `0 0 ${v.width} ${v.height}`), k.setAttribute("width", (v.width * W).toString()), k.setAttribute("height", (v.height * W).toString());
1631
+ let V = new XMLSerializer().serializeToString(k);
1632
+ return V.includes("xmlns=") || (V = V.replace(
1633
+ "<svg",
1634
+ '<svg xmlns="http://www.w3.org/2000/svg"'
1635
+ )), `data:image/svg+xml;utf8,${encodeURIComponent(V)}`;
1643
1636
  };
1644
- G(o, v);
1645
- const Y = o.getBoundingClientRect(), Q = window.devicePixelRatio * c;
1646
- v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${Y.width} ${Y.height}`), v.setAttribute("width", (Y.width * Q).toString()), v.setAttribute("height", (Y.height * Q).toString());
1647
- let I = new XMLSerializer().serializeToString(v);
1648
- I.includes("xmlns=") || (I = I.replace(
1649
- "<svg",
1650
- '<svg xmlns="http://www.w3.org/2000/svg"'
1651
- )), B = `data:image/svg+xml;utf8,${encodeURIComponent(I)}`;
1652
- } else if (y.backgroundImage && y.backgroundImage !== "none") {
1653
- const v = y.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1654
- v && (B = v[1]);
1655
- }
1656
- const k = {
1657
- backgroundColor: y.backgroundColor,
1658
- backgroundImage: y.backgroundImage,
1659
- opacity: o.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(y.opacity),
1660
- zIndex: X,
1661
- borderRadius: y.borderRadius,
1662
- borderColor: y.borderColor,
1663
- borderWidth: y.borderWidth,
1664
- boxShadow: y.boxShadow,
1665
- imageSrc: B,
1666
- isTraveler: M
1667
- }, j = k;
1668
- let J, Z;
1669
- const L = [], _ = y.overflow === "hidden" ? [...l || [], o] : l;
1670
- return o.tagName.toLowerCase() !== "svg" && Array.from(o.childNodes).forEach((v) => {
1671
- const x = v.nodeType === Node.TEXT_NODE ? d : h, T = Fe(
1672
- v,
1673
- e,
1674
- x,
1675
- i,
1637
+ AA = N(!1), Y !== void 0 && (d || R || T || _) && (sA = N(!0));
1638
+ } else if (M.backgroundImage && M.backgroundImage !== "none") {
1639
+ const d = M.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1640
+ d && (AA = d[1]);
1641
+ }
1642
+ const p = {
1643
+ backgroundColor: M.backgroundColor,
1644
+ backgroundImage: M.backgroundImage,
1645
+ opacity: Q.dataset[tA.KEY] === tA.VALUES.HIDE ? 1 : parseFloat(M.opacity),
1646
+ zIndex: rA,
1647
+ borderRadius: M.borderRadius,
1648
+ borderColor: M.borderColor,
1649
+ borderWidth: M.borderWidth,
1650
+ boxShadow: M.boxShadow,
1651
+ imageSrc: AA,
1652
+ isTraveler: D
1653
+ }, z = p;
1654
+ let dA, EA;
1655
+ const GA = [], Ie = M.overflow === "hidden" ? [...n || [], Q] : n;
1656
+ return Q.tagName.toLowerCase() !== "svg" && Array.from(Q.childNodes).forEach((d) => {
1657
+ const R = d.nodeType === Node.TEXT_NODE ? y : f, T = ce(
1658
+ d,
1659
+ A,
1660
+ R,
1661
+ s,
1662
+ rA,
1663
+ o,
1664
+ d.nodeType === Node.TEXT_NODE ? Y : void 0,
1665
+ d.nodeType === Node.TEXT_NODE && Object.keys(u).length > 0 ? u : void 0,
1666
+ Ie,
1667
+ a,
1668
+ G,
1669
+ BA,
1676
1670
  X,
1677
- c,
1678
- v.nodeType === Node.TEXT_NODE ? b : void 0,
1679
- v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0,
1680
- _
1671
+ P
1681
1672
  );
1682
- T && L.push(T);
1673
+ T && GA.push(T);
1683
1674
  }), {
1684
- id: S,
1675
+ id: $,
1685
1676
  type: "BOX",
1686
- element: o,
1677
+ element: Q,
1687
1678
  rect: {
1688
- x: C.left + window.scrollX,
1689
- y: C.top + window.scrollY,
1690
- width: C.width,
1691
- height: C.height
1679
+ x: F.left + C,
1680
+ y: F.top + w,
1681
+ width: F.width,
1682
+ height: F.height
1692
1683
  },
1693
- styles: j,
1694
- textContent: J,
1695
- textStyles: Z,
1696
- dirtyMask: e,
1697
- visibility: d,
1698
- isTraveler: M,
1699
- captureLayer: i,
1700
- nativeLayer: b,
1701
- nativeStyles: b !== void 0 ? Ce(te({}, k), {
1702
- backgroundColor: (K = m.backgroundColor) != null ? K : k.backgroundColor,
1703
- backgroundImage: (U = m.backgroundImage) != null ? U : k.backgroundImage,
1704
- opacity: (V = m.opacity) != null ? V : k.opacity,
1705
- zIndex: m.zIndex !== void 0 ? m.zIndex + X : k.zIndex,
1706
- borderRadius: (ie = m.borderRadius) != null ? ie : k.borderRadius,
1707
- borderColor: (se = m.borderColor) != null ? se : k.borderColor,
1708
- borderWidth: (ne = m.borderWidth) != null ? ne : k.borderWidth,
1709
- boxShadow: (he = m.boxShadow) != null ? he : k.boxShadow,
1710
- isTraveler: k.isTraveler,
1711
- transform: m.transform
1684
+ styles: z,
1685
+ textContent: dA,
1686
+ textStyles: EA,
1687
+ dirtyMask: A,
1688
+ visibility: y,
1689
+ isTraveler: D,
1690
+ captureLayer: s,
1691
+ nativeLayer: Y,
1692
+ nativeStyles: Y !== void 0 ? qA(aA({}, p), {
1693
+ backgroundColor: (HA = u.backgroundColor) != null ? HA : p.backgroundColor,
1694
+ backgroundImage: (XA = u.backgroundImage) != null ? XA : p.backgroundImage,
1695
+ opacity: (JA = u.opacity) != null ? JA : p.opacity,
1696
+ zIndex: u.zIndex !== void 0 ? u.zIndex + rA : p.zIndex,
1697
+ borderRadius: (zA = u.borderRadius) != null ? zA : p.borderRadius,
1698
+ borderColor: (_A = u.borderColor) != null ? _A : p.borderColor,
1699
+ borderWidth: (WA = u.borderWidth) != null ? WA : p.borderWidth,
1700
+ boxShadow: (KA = u.boxShadow) != null ? KA : p.boxShadow,
1701
+ isTraveler: p.isTraveler,
1702
+ transform: u.transform,
1703
+ imageSrc: sA != null ? sA : AA
1712
1704
  }) : void 0,
1713
- nativeRect: b !== void 0 ? {
1714
- x: m.x !== void 0 ? parseFloat(m.x) : C.left + window.scrollX,
1715
- y: m.y !== void 0 ? parseFloat(m.y) : C.top + window.scrollY,
1716
- width: m.width !== void 0 ? parseFloat(m.width) : C.width,
1717
- height: m.height !== void 0 ? parseFloat(m.height) : C.height
1705
+ nativeRect: Y !== void 0 ? {
1706
+ x: u.x !== void 0 ? parseFloat(u.x) : F.left + C,
1707
+ y: u.y !== void 0 ? parseFloat(u.y) : F.top + w,
1708
+ width: u.width !== void 0 ? parseFloat(u.width) : F.width,
1709
+ height: u.height !== void 0 ? parseFloat(u.height) : F.height
1718
1710
  } : void 0,
1719
- isFixed: y.position === "fixed",
1720
- clipElements: l,
1721
- children: L,
1722
- shaderHooks: A
1711
+ isFixed: P,
1712
+ clipElements: n,
1713
+ wasmIndex: G !== -1 ? G : void 0,
1714
+ children: GA,
1715
+ shaderHooks: cA
1723
1716
  };
1724
1717
  }
1725
- function lt(s, e) {
1726
- e.size !== 0 && e.forEach((t, i) => {
1727
- var c, n, a, l;
1728
- const r = s.get(i);
1729
- !r || !r.userData.basePosition || (W.forceUpdateUniforms(r.material, {
1730
- backgroundColor: t.backgroundColor,
1731
- backgroundImage: t.backgroundImage,
1732
- boxShadow: t.boxShadow,
1733
- opacity: t.opacity,
1734
- borderRadius: (n = t.borderRadius) != null ? n : (c = r.userData.baseStyles) == null ? void 0 : c.borderRadius
1735
- // width and height are no longer updated here, they are updated in syncMeshesByDOM
1736
- }), r.userData.nativeMesh && W.forceUpdateUniforms(r.userData.nativeMesh.material, {
1737
- backgroundColor: t.backgroundColor,
1738
- backgroundImage: t.backgroundImage,
1739
- boxShadow: t.boxShadow,
1740
- opacity: t.opacity,
1741
- borderRadius: (l = t.borderRadius) != null ? l : (a = r.userData.baseStyles) == null ? void 0 : a.borderRadius
1742
- }));
1718
+ function Ye(t, A, e) {
1719
+ if (A.size === 0)
1720
+ return;
1721
+ const s = /* @__PURE__ */ new Set();
1722
+ A.forEach((i, o) => {
1723
+ var g, n, a, I;
1724
+ const r = t.get(o);
1725
+ if (!(!r || !r.userData.basePosition)) {
1726
+ if (K.forceUpdateUniforms(r.material, {
1727
+ backgroundColor: i.backgroundColor,
1728
+ backgroundImage: i.backgroundImage,
1729
+ boxShadow: i.boxShadow,
1730
+ opacity: i.opacity,
1731
+ borderRadius: (n = i.borderRadius) != null ? n : (g = r.userData.baseStyles) == null ? void 0 : g.borderRadius
1732
+ }), r.userData.nativeMesh && (K.forceUpdateUniforms(r.userData.nativeMesh.material, {
1733
+ backgroundColor: i.backgroundColor,
1734
+ backgroundImage: i.backgroundImage,
1735
+ boxShadow: i.boxShadow,
1736
+ opacity: i.opacity,
1737
+ borderRadius: (I = i.borderRadius) != null ? I : (a = r.userData.baseStyles) == null ? void 0 : a.borderRadius
1738
+ }), i.scaleX !== void 0 || i.scaleY !== void 0)) {
1739
+ const c = r.userData.nativeMesh, h = c.scale.x, B = c.scale.y, C = c.scale.z;
1740
+ c.scale.set(
1741
+ i.scaleX !== void 0 ? i.scaleX * h : h,
1742
+ i.scaleY !== void 0 ? i.scaleY * B : B,
1743
+ i.scaleZ !== void 0 ? i.scaleZ * C : C
1744
+ );
1745
+ }
1746
+ if (i.layoutChanged || i.width !== void 0 || i.height !== void 0) {
1747
+ s.add(o);
1748
+ const c = o.querySelectorAll("*");
1749
+ for (let h = 0; h < c.length; h++) {
1750
+ const B = c[h];
1751
+ t.has(B) && s.add(B);
1752
+ }
1753
+ } else if ((i.x !== void 0 || i.y !== void 0) && e && r.userData.wasmIndex !== void 0) {
1754
+ const c = r.userData.wasmIndex * iA;
1755
+ i.x !== void 0 && r.userData.initialLocalX !== void 0 && (e[c + mA] = r.userData.initialLocalX + i.x), i.y !== void 0 && r.userData.initialLocalY !== void 0 && (e[c + pA] = r.userData.initialLocalY + i.y);
1756
+ }
1757
+ }
1758
+ }), s.forEach((i) => {
1759
+ var n, a;
1760
+ const o = t.get(i);
1761
+ if (!o)
1762
+ return;
1763
+ const r = i.getBoundingClientRect();
1764
+ o.userData.domRect && (o.userData.domRect.width = r.width, o.userData.domRect.height = r.height);
1765
+ let g = ((n = o.material.userData) == null ? void 0 : n.shadowPadding) || 0;
1766
+ if (o.scale.set(r.width + g * 2, r.height + g * 2, 1), K.forceUpdateUniforms(o.material, {
1767
+ width: r.width,
1768
+ height: r.height
1769
+ }), e && o.userData.wasmIndex !== void 0) {
1770
+ const I = o.userData.wasmIndex * iA, c = r.left + (o.userData.isFixed ? 0 : window.scrollX), h = r.top + (o.userData.isFixed ? 0 : window.scrollY), B = e[I + LA];
1771
+ let C = 0, w = 0;
1772
+ if (B !== -1) {
1773
+ const Q = B * iA;
1774
+ C = e[Q + ie], w = e[Q + re];
1775
+ }
1776
+ e[I + mA] = c - C, e[I + pA] = h - w;
1777
+ }
1778
+ if (o.userData.nativeMesh) {
1779
+ const I = o.userData.nativeMesh;
1780
+ let c = ((a = I.material.userData) == null ? void 0 : a.shadowPadding) || 0;
1781
+ I.scale.set(r.width + c * 2, r.height + c * 2, 1), K.forceUpdateUniforms(I.material, {
1782
+ width: r.width,
1783
+ height: r.height
1784
+ }), o.userData.nativeRect && (o.userData.nativeRect.width = r.width, o.userData.nativeRect.height = r.height);
1785
+ }
1786
+ });
1787
+ }
1788
+ class FA {
1789
+ __destroy_into_raw() {
1790
+ const A = this.__wbg_ptr;
1791
+ return this.__wbg_ptr = 0, te.unregister(this), A;
1792
+ }
1793
+ free() {
1794
+ const A = this.__destroy_into_raw();
1795
+ J.__wbg_memorymanager_free(A, 0);
1796
+ }
1797
+ /**
1798
+ * @returns {number}
1799
+ */
1800
+ get_length() {
1801
+ return J.memorymanager_get_length(this.__wbg_ptr) >>> 0;
1802
+ }
1803
+ /**
1804
+ * @returns {number}
1805
+ */
1806
+ get_pointer() {
1807
+ return J.memorymanager_get_pointer(this.__wbg_ptr) >>> 0;
1808
+ }
1809
+ /**
1810
+ * @param {number} capacity
1811
+ */
1812
+ constructor(A) {
1813
+ const e = J.memorymanager_new(A);
1814
+ return this.__wbg_ptr = e, te.register(this, this.__wbg_ptr, this), this;
1815
+ }
1816
+ /**
1817
+ * @param {number} node_count
1818
+ */
1819
+ update_physics(A) {
1820
+ J.memorymanager_update_physics(this.__wbg_ptr, A);
1821
+ }
1822
+ }
1823
+ Symbol.dispose && (FA.prototype[Symbol.dispose] = FA.prototype.free);
1824
+ function Ge() {
1825
+ return {
1826
+ __proto__: null,
1827
+ "./wasm_compute_bg.js": {
1828
+ __proto__: null,
1829
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(A, e) {
1830
+ throw new Error(ke(A, e));
1831
+ },
1832
+ __wbindgen_init_externref_table: function() {
1833
+ const A = J.__wbindgen_externrefs, e = A.grow(4);
1834
+ A.set(0, void 0), A.set(e + 0, void 0), A.set(e + 1, null), A.set(e + 2, !0), A.set(e + 3, !1);
1835
+ }
1836
+ }
1837
+ };
1838
+ }
1839
+ const te = typeof FinalizationRegistry == "undefined" ? { register: () => {
1840
+ }, unregister: () => {
1841
+ } } : new FinalizationRegistry((t) => J.__wbg_memorymanager_free(t, 1));
1842
+ function ke(t, A) {
1843
+ return Xe(t >>> 0, A);
1844
+ }
1845
+ let wA = null;
1846
+ function Ue() {
1847
+ return (wA === null || wA.byteLength === 0) && (wA = new Uint8Array(J.memory.buffer)), wA;
1848
+ }
1849
+ let vA = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
1850
+ vA.decode();
1851
+ const He = 2146435072;
1852
+ let xA = 0;
1853
+ function Xe(t, A) {
1854
+ return xA += A, xA >= He && (vA = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), vA.decode(), xA = A), vA.decode(Ue().subarray(t, t + A));
1855
+ }
1856
+ let J;
1857
+ function Je(t, A) {
1858
+ return J = t.exports, wA = null, J.__wbindgen_start(), J;
1859
+ }
1860
+ function ze(t, A) {
1861
+ return eA(this, null, function* () {
1862
+ if (typeof Response == "function" && t instanceof Response) {
1863
+ if (!t.ok)
1864
+ throw new Error(`failed to fetch Wasm: ${t.status} ${t.statusText} fetching '${t.url}'`);
1865
+ if (typeof WebAssembly.instantiateStreaming == "function")
1866
+ try {
1867
+ return yield WebAssembly.instantiateStreaming(t, A);
1868
+ } catch (i) {
1869
+ if (e(t.type) && t.headers.get("Content-Type") !== "application/wasm")
1870
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", i);
1871
+ else
1872
+ throw i;
1873
+ }
1874
+ const s = yield t.arrayBuffer();
1875
+ return yield WebAssembly.instantiate(s, A);
1876
+ } else {
1877
+ const s = yield WebAssembly.instantiate(t, A);
1878
+ return s instanceof WebAssembly.Instance ? { instance: s, module: t } : s;
1879
+ }
1880
+ function e(s) {
1881
+ switch (s) {
1882
+ case "basic":
1883
+ case "cors":
1884
+ case "default":
1885
+ return !0;
1886
+ }
1887
+ return !1;
1888
+ }
1889
+ });
1890
+ }
1891
+ function _e(t) {
1892
+ return eA(this, null, function* () {
1893
+ if (J !== void 0)
1894
+ return J;
1895
+ t !== void 0 && (Object.getPrototypeOf(t) === Object.prototype ? { module_or_path: t } = t : console.warn("using deprecated parameters for the initialization function; pass a single object instead")), t === void 0 && (t = new URL("data:application/wasm;base64,AGFzbQEAAAABNQlgAn9/AGACf38Bf2ADf39/AX9gAABgAX8Bf2ABfwBgA39/fwBgBH9/f38Bf2AFf39/f38AAncCFC4vd2FzbV9jb21wdXRlX2JnLmpzJ19fd2JnX19fd2JpbmRnZW5fdGhyb3dfNWQ5ZTgxNWU2ZmRmMTUwZgAAFC4vd2FzbV9jb21wdXRlX2JnLmpzH19fd2JpbmRnZW5faW5pdF9leHRlcm5yZWZfdGFibGUAAwMuLQQFBwAAAAEBCAAEAAYAAAIGBQQEAAYBBwUFAAAAAAIAAQEGAgEAAwMAAAAAAwQJAnABFBRvAIAIBQMBABEGGQN/AUGAgMAAC38AQbiJwAALfwBB3InAAAsH5AEKBm1lbW9yeQIAGF9fd2JnX21lbW9yeW1hbmFnZXJfZnJlZQALGG1lbW9yeW1hbmFnZXJfZ2V0X2xlbmd0aAAUGW1lbW9yeW1hbmFnZXJfZ2V0X3BvaW50ZXIAFRFtZW1vcnltYW5hZ2VyX25ldwAMHG1lbW9yeW1hbmFn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UEFbCIHQQNqIgggAk8NBSAHQQRqIgcgAk8NBiACIANBA2oiCk0EQCAKIAJBjIPAABASAAsgCSAHQQJ0aioCACELIARBDGogDCAJIAhBAnRqKgIAkjgCACADQQRqIgggAkkNByAIIAJBnIPAABASAAsgA0EBaiACQZyCwAAQEgALIANBAmogAkGsgsAAEBIACyADIAJBvILAABASAAsgA0EDaiACQcyCwAAQEgALIANBBGogAkHcgsAAEBIACyAIIAJB7ILAABASAAsgByACQfyCwAAQEgALIARBEGogDSALkjgCAAsgBEEUaiEEIANBBWohAyABQQFrIgENAAsLIAAgACgCAEEBajYCACAGIAYoAgBBAWsiADYCACAARQRAIAVBDGoQEwsgBUEQaiQADwsQKAsACxApAAuNAQICfwF+IwBBIGsiAiQAIAEoAgBBf0YEQCABKAIMIQMgAkEANgIcIAJCgICAgBA3AhQgAkEUakHYhMAAIAMoAgAiAygCACADKAIEEAQaIAIgAigCHCIDNgIQIAIgAikCFCIENwMIIAEgAzYCCCABIAQ3AgALIABBhIfAADYCBCAAIAE2AgAgAkEgaiQAC1QBAX8CQAJAIAAoAgAgACgCCCIDayACSQRAIAAgAyACEA4gACgCCCEDDAELIAJFDQELIAJFDQAgACgCBCADaiABIAL8CgAACyAAIAIgA2o2AghBAAtPAgF/AX4jAEEgayIDJAAgAyABNgIMIAMgADYCCCADQoCAgICgAiIEIANBCGqthDcDGCADIAQgA0EMaq2ENwMQQYCAwAAgA0EQaiACEBcAC0wBAX8gACgCACIAQQxqKAIAIgEEQCAAQRBqKAIAIAFBAnRBBBAkCwJAIABBf0YNACAAIAAoAgRBAWsiATYCBCABDQAgAEEYQQQQJAsLSwEDfwJAAkAgAARAIABBCGsiASABKAIAIgJBAWoiAzYCACADRQ0BIAAoAgBB/////wdPDQIgACgCDCABIAI2AgAPCxAoCwALECkAC0sBA38CQAJAIAAEQCAAQQhrIgEgASgCACICQQFqIgM2AgAgA0UNASAAKAIAQf////8HTw0CIAAoAgggASACNgIADwsQKAsACxApAAtEAQJ/I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pZ24tZXh0Kw9yZWZlcmVuY2UtdHlwZXMrCm11bHRpdmFsdWU=", self.location));
1896
+ const A = Ge();
1897
+ (typeof t == "string" || typeof Request == "function" && t instanceof Request || typeof URL == "function" && t instanceof URL) && (t = fetch(t));
1898
+ const { instance: e, module: s } = yield ze(yield t, A);
1899
+ return Je(e);
1743
1900
  });
1744
1901
  }
1745
- class ct {
1746
- constructor(e, t, i, r) {
1747
- u(this, "target");
1748
- u(this, "renderer");
1749
- u(this, "registry");
1750
- u(this, "isTravelEnabled", !1);
1751
- u(this, "tracker");
1752
- this.target = e, this.renderer = t, this.registry = i, this.tracker = new Be(e, {
1753
- resizeDebounce: r.resizeDebounce
1754
- }), this.tracker.onLayoutChange.add((c, n) => {
1755
- document.querySelector(`[${N.NAME}~='${N.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1756
- const l = Fe(
1902
+ class We {
1903
+ constructor() {
1904
+ l(this, "memoryManager", null);
1905
+ l(this, "sharedArray", null);
1906
+ l(this, "isInitialized", !1);
1907
+ }
1908
+ /**
1909
+ * Initialize Wasm instance and allocate a 1D Float32Array shared memory
1910
+ * @param capacity The number of Float32 elements to allocate
1911
+ */
1912
+ initialize(A) {
1913
+ return eA(this, null, function* () {
1914
+ if (!this.isInitialized)
1915
+ try {
1916
+ const e = yield _e();
1917
+ this.memoryManager = new FA(A);
1918
+ const s = this.memoryManager.get_pointer(), i = this.memoryManager.get_length();
1919
+ this.sharedArray = new Float32Array(e.memory.buffer, s, i), this.isInitialized = !0, console.log(`[WasmSynchronizer] Initialized with capacity: ${A} floats (${A * 4} bytes)`);
1920
+ } catch (e) {
1921
+ throw console.error("[WasmSynchronizer] Failed to initialize Wasm:", e), e;
1922
+ }
1923
+ });
1924
+ }
1925
+ getSharedArray() {
1926
+ if (!this.isInitialized || !this.sharedArray)
1927
+ throw new Error("WasmSynchronizer is not initialized yet. Call initialize() first.");
1928
+ return this.sharedArray;
1929
+ }
1930
+ updatePhysics(A) {
1931
+ this.isInitialized && this.memoryManager && this.memoryManager.update_physics(A);
1932
+ }
1933
+ }
1934
+ class Ke {
1935
+ constructor(A, e, s, i) {
1936
+ l(this, "target");
1937
+ l(this, "renderer");
1938
+ l(this, "registry");
1939
+ l(this, "isTravelEnabled", !1);
1940
+ l(this, "wasmSync");
1941
+ l(this, "lastWasmNodeCount", 0);
1942
+ l(this, "tracker");
1943
+ this.target = A, this.renderer = e, this.registry = s, this.wasmSync = new We(), this.tracker = new oe(A, {
1944
+ resizeDebounce: i.resizeDebounce
1945
+ }), this.tracker.onLayoutChange.add((o, r) => {
1946
+ document.querySelector(`[${H.NAME}~='${H.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1947
+ const n = this.wasmSync.sharedArray;
1948
+ this.renderer.updateScroll();
1949
+ const a = {
1950
+ sharedArray: n || new Float32Array(),
1951
+ currentIndex: 0,
1952
+ scrollX: this.renderer.getScrollX(),
1953
+ scrollY: this.renderer.getScrollY()
1954
+ }, I = ce(
1757
1955
  this.target,
1758
- c,
1759
- $,
1956
+ o,
1957
+ q,
1760
1958
  1,
1761
1959
  0,
1762
- this.renderer.qualityFactor
1960
+ this.renderer.qualityFactor,
1961
+ void 0,
1962
+ void 0,
1963
+ void 0,
1964
+ a
1763
1965
  );
1764
- l && this.renderer.syncScene(l, n);
1765
- }), this.tracker.onStyleChange.add((c) => {
1766
- lt(this.registry, c);
1966
+ I && (this.lastWasmNodeCount = a.currentIndex, this.renderer.syncScene(I, r), n && this.renderer.saveInitialLocals(n));
1967
+ }), this.tracker.onStyleChange.add((o) => {
1968
+ Ye(this.registry, o, this.wasmSync.sharedArray || void 0);
1767
1969
  }), this.tracker.onRender.add(() => {
1768
- this.renderer.syncMeshesByDOM(), this.renderer.render();
1970
+ this.renderer.updateScroll(), this.wasmSync.updatePhysics(this.lastWasmNodeCount), this.wasmSync.sharedArray && this.renderer.syncMeshesByWasm(this.wasmSync.sharedArray), this.renderer.render();
1769
1971
  });
1770
1972
  }
1771
1973
  start() {
1772
- this.tracker.start();
1974
+ return eA(this, null, function* () {
1975
+ yield this.wasmSync.initialize(1e4 * iA), this.tracker.start();
1976
+ });
1773
1977
  }
1774
1978
  stop() {
1775
1979
  this.tracker.stop();
1776
1980
  }
1777
1981
  }
1778
- class ht {
1982
+ class Oe {
1779
1983
  constructor() {
1780
- u(this, "store");
1984
+ l(this, "store");
1781
1985
  this.store = /* @__PURE__ */ new WeakMap();
1782
1986
  }
1783
- register(e, t) {
1784
- this.store.set(e, t);
1987
+ register(A, e) {
1988
+ this.store.set(A, e);
1785
1989
  }
1786
- get(e) {
1787
- return this.store.get(e);
1990
+ get(A) {
1991
+ return this.store.get(A);
1788
1992
  }
1789
1993
  // public register(element: HTMLElement, meshGroup: THREE.Group): void {
1790
1994
  // this.store.set(element, meshGroup);
@@ -1792,41 +1996,43 @@ class ht {
1792
1996
  // public get(element: HTMLElement): THREE.Group | undefined {
1793
1997
  // return this.store.get(element);
1794
1998
  // }
1795
- has(e) {
1796
- return this.store.has(e);
1999
+ has(A) {
2000
+ return this.store.has(A);
1797
2001
  }
1798
2002
  // Optional
1799
- remove(e) {
1800
- this.store.delete(e);
2003
+ remove(A) {
2004
+ this.store.delete(A);
1801
2005
  }
1802
2006
  }
1803
- class dt {
1804
- constructor(e, t) {
1805
- u(this, "renderer");
1806
- u(this, "syncer");
1807
- u(this, "target");
1808
- u(this, "registry");
1809
- var r, c, n;
1810
- if (this.target = e, this.registry = new ht(), !document.getElementById("mirage-engine-styles")) {
1811
- const a = document.createElement("style");
1812
- a.id = "mirage-engine-styles", a.textContent = `
1813
- [${ee.NAME}="${ee.VALUES.HIDE}"] {
2007
+ class je {
2008
+ constructor(A, e) {
2009
+ l(this, "renderer");
2010
+ l(this, "syncer");
2011
+ l(this, "target");
2012
+ l(this, "registry");
2013
+ var i, o, r;
2014
+ if (this.target = A, this.registry = new Oe(), !document.getElementById("mirage-engine-styles")) {
2015
+ const g = document.createElement("style");
2016
+ g.id = "mirage-engine-styles", g.textContent = `
2017
+ [${tA.NAME}="${tA.VALUES.HIDE}"] {
1814
2018
  opacity: 0 !important;
1815
2019
  }
1816
- `, document.head.appendChild(a);
2020
+ `, document.head.appendChild(g);
1817
2021
  }
1818
- let i;
1819
- if (t.mode === "duplicate" ? i = (c = (r = t.container) != null ? r : this.target.parentElement) != null ? c : void 0 : i = (n = this.target.parentElement) != null ? n : void 0, !i)
2022
+ let s;
2023
+ if (e.mode === "duplicate" ? s = (o = (i = e.container) != null ? i : this.target.parentElement) != null ? o : void 0 : s = (r = this.target.parentElement) != null ? r : void 0, !s)
1820
2024
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1821
- this.renderer = new ot(
2025
+ this.renderer = new Fe(
1822
2026
  this.target,
1823
- t,
1824
- i,
2027
+ e,
2028
+ s,
1825
2029
  this.registry
1826
- ), this.renderer.mount(), this.syncer = new ct(this.target, this.renderer, this.registry, t);
2030
+ ), this.renderer.mount(), this.syncer = new Ke(this.target, this.renderer, this.registry, e);
1827
2031
  }
1828
2032
  start() {
1829
- this.syncer.start();
2033
+ return eA(this, null, function* () {
2034
+ yield this.syncer.start();
2035
+ });
1830
2036
  }
1831
2037
  stop() {
1832
2038
  this.syncer.stop();
@@ -1837,53 +2043,53 @@ class dt {
1837
2043
  getTracker() {
1838
2044
  return this.syncer.tracker;
1839
2045
  }
1840
- updateUniforms(e, t) {
1841
- this.renderer.updateUniforms(e, t);
2046
+ updateUniforms(A, e) {
2047
+ this.renderer.updateUniforms(A, e);
1842
2048
  }
1843
2049
  getCanvas() {
1844
2050
  return this.renderer.canvas;
1845
2051
  }
1846
2052
  test() {
1847
- const e = this.registry.get(
2053
+ const A = this.registry.get(
1848
2054
  document.querySelector("#box2")
1849
2055
  );
1850
- if (!e)
2056
+ if (!A)
1851
2057
  return;
1852
- const t = {
2058
+ const e = {
1853
2059
  ArrowRight: !1,
1854
2060
  ArrowLeft: !1,
1855
2061
  ArrowUp: !1,
1856
2062
  ArrowDown: !1
1857
2063
  };
1858
- window.addEventListener("keydown", (c) => {
1859
- t[c.key] !== void 0 && (t[c.key] = !0);
1860
- }), window.addEventListener("keyup", (c) => {
1861
- t[c.key] !== void 0 && (t[c.key] = !1);
2064
+ window.addEventListener("keydown", (o) => {
2065
+ e[o.key] !== void 0 && (e[o.key] = !0);
2066
+ }), window.addEventListener("keyup", (o) => {
2067
+ e[o.key] !== void 0 && (e[o.key] = !1);
1862
2068
  });
1863
- const i = 2, r = () => {
1864
- requestAnimationFrame(r), t.ArrowRight && e.position.setX(e.position.x + i), t.ArrowLeft && e.position.setX(e.position.x - i), t.ArrowUp && e.position.setY(e.position.y + i), t.ArrowDown && e.position.setY(e.position.y - i);
2069
+ const s = 2, i = () => {
2070
+ requestAnimationFrame(i), e.ArrowRight && A.position.setX(A.position.x + s), e.ArrowLeft && A.position.setX(A.position.x - s), e.ArrowUp && A.position.setY(A.position.y + s), e.ArrowDown && A.position.setY(A.position.y - s);
1865
2071
  };
1866
- r();
2072
+ i();
1867
2073
  }
1868
2074
  }
1869
- class ut {
1870
- constructor(e = {}) {
1871
- u(this, "frontSelector");
1872
- u(this, "midLayerElement");
1873
- u(this, "items", []);
1874
- u(this, "isInitialized", !1);
1875
- u(this, "midLayer", null);
1876
- u(this, "frontLayer", null);
1877
- u(this, "tracker", null);
1878
- this.frontSelector = e.frontSelector || ".front", this.midLayerElement = e.midLayerElement || null, this.items = [], this.isInitialized = !1, this.tracker = new Be(document.body, e.trackerConfig || { resizeDebounce: !0 });
2075
+ class qe {
2076
+ constructor(A = {}) {
2077
+ l(this, "frontSelector");
2078
+ l(this, "midLayerElement");
2079
+ l(this, "items", []);
2080
+ l(this, "isInitialized", !1);
2081
+ l(this, "midLayer", null);
2082
+ l(this, "frontLayer", null);
2083
+ l(this, "tracker", null);
2084
+ this.frontSelector = A.frontSelector || ".front", this.midLayerElement = A.midLayerElement || null, this.items = [], this.isInitialized = !1, this.tracker = new oe(document.body, A.trackerConfig || { resizeDebounce: !0 });
1879
2085
  }
1880
2086
  init() {
1881
- var e;
1882
- this.isInitialized || (this.createLayers(), this.setupMidLayer(), this.hijackFrontElements(), this.setupHooks(), (e = this.tracker) == null || e.start(), this.isInitialized = !0, console.log("🥪 sand-telepochi initialized!"));
2087
+ var A;
2088
+ this.isInitialized || (this.createLayers(), this.setupMidLayer(), this.hijackFrontElements(), this.setupHooks(), (A = this.tracker) == null || A.start(), this.isInitialized = !0, console.log("🥪 sand-telepochi initialized!"));
1883
2089
  }
1884
2090
  // Allow passing an existing tracker (e.g. from mirage-engine/core)
1885
- useTracker(e) {
1886
- this.tracker = e, this.setupHooks();
2091
+ useTracker(A) {
2092
+ this.tracker = A, this.setupHooks();
1887
2093
  }
1888
2094
  createLayers() {
1889
2095
  this.midLayer = document.createElement("div"), this.midLayer.id = "sand-layer-mid", Object.assign(this.midLayer.style, {
@@ -1902,56 +2108,58 @@ class ut {
1902
2108
  this.midLayerElement && this.midLayer && (this.midLayer.appendChild(this.midLayerElement), this.midLayerElement.style.pointerEvents = "auto");
1903
2109
  }
1904
2110
  hijackFrontElements() {
1905
- const e = document.querySelectorAll(this.frontSelector);
1906
- this.frontLayer && e.forEach((t) => {
1907
- var n;
1908
- const i = t.getBoundingClientRect(), r = window.getComputedStyle(t), c = document.createElement("div");
1909
- c.className = "sand-placeholder", Object.assign(c.style, {
1910
- display: r.display === "inline" ? "inline-block" : r.display,
1911
- width: `${i.width}px`,
1912
- height: `${i.height}px`,
2111
+ const A = document.querySelectorAll(this.frontSelector);
2112
+ this.frontLayer && A.forEach((e) => {
2113
+ var r;
2114
+ const s = e.getBoundingClientRect(), i = window.getComputedStyle(e), o = document.createElement("div");
2115
+ o.className = "sand-placeholder", Object.assign(o.style, {
2116
+ display: i.display === "inline" ? "inline-block" : i.display,
2117
+ width: `${s.width}px`,
2118
+ height: `${s.height}px`,
1913
2119
  boxSizing: "border-box",
1914
- marginTop: r.marginTop,
1915
- marginBottom: r.marginBottom,
1916
- marginLeft: r.marginLeft,
1917
- marginRight: r.marginRight,
2120
+ marginTop: i.marginTop,
2121
+ marginBottom: i.marginBottom,
2122
+ marginLeft: i.marginLeft,
2123
+ marginRight: i.marginRight,
1918
2124
  visibility: "hidden",
1919
2125
  pointerEvents: "none"
1920
- }), (n = t.parentNode) == null || n.insertBefore(c, t), this.frontLayer.appendChild(t), Object.assign(t.style, {
2126
+ }), (r = e.parentNode) == null || r.insertBefore(o, e), this.frontLayer.appendChild(e), Object.assign(e.style, {
1921
2127
  position: "fixed",
1922
2128
  margin: "0",
1923
2129
  boxSizing: "border-box",
1924
- width: `${i.width}px`,
1925
- height: `${i.height}px`,
2130
+ width: `${s.width}px`,
2131
+ height: `${s.height}px`,
1926
2132
  pointerEvents: "auto"
1927
- }), this.items.push({ placeholder: c, original: t });
2133
+ }), this.items.push({ placeholder: o, original: e });
1928
2134
  });
1929
2135
  }
1930
2136
  setupHooks() {
1931
2137
  this.tracker && this.tracker.onBeforeRender.add(() => {
1932
- const e = this.items.map(({ placeholder: t }) => t.getBoundingClientRect());
1933
- this.items.forEach(({ original: t }, i) => {
1934
- const r = e[i];
1935
- t.style.top = `${r.top}px`, t.style.left = `${r.left}px`, t.style.width = `${r.width}px`, t.style.height = `${r.height}px`;
2138
+ const A = this.items.map(({ placeholder: e }) => e.getBoundingClientRect());
2139
+ this.items.forEach(({ original: e }, s) => {
2140
+ const i = A[s];
2141
+ e.style.top = `${i.top}px`, e.style.left = `${i.left}px`, e.style.width = `${i.width}px`, e.style.height = `${i.height}px`;
1936
2142
  });
1937
2143
  });
1938
2144
  }
1939
2145
  }
1940
- class gt {
1941
- constructor(e, t) {
1942
- u(this, "_engine");
1943
- u(this, "_sandwich");
1944
- if (!e)
2146
+ class Ze {
2147
+ constructor(A, e) {
2148
+ l(this, "_engine");
2149
+ l(this, "_sandwich");
2150
+ if (!A)
1945
2151
  throw new Error("[Mirage] Target element is required.");
1946
- if (this._engine = new dt(e, t), t.sandwich !== !1) {
1947
- const i = typeof t.sandwich == "object" ? t.sandwich : {};
1948
- this._sandwich = new ut({
1949
- frontSelector: i.frontSelector || `[${Le.NAME}='${Le.VALUES.FRONT}']`
2152
+ if (this._engine = new je(A, e), e.sandwich !== !1) {
2153
+ const s = typeof e.sandwich == "object" ? e.sandwich : {};
2154
+ this._sandwich = new qe({
2155
+ frontSelector: s.frontSelector || `[${ZA.NAME}='${ZA.VALUES.FRONT}']`
1950
2156
  }), this._sandwich.useTracker(this._engine.getTracker());
1951
2157
  }
1952
2158
  }
1953
2159
  start() {
1954
- this._engine.start(), this._sandwich && this._sandwich.init();
2160
+ return eA(this, null, function* () {
2161
+ yield this._engine.start(), this._sandwich && this._sandwich.init();
2162
+ });
1955
2163
  }
1956
2164
  stop() {
1957
2165
  this._engine.stop();
@@ -1965,13 +2173,13 @@ class gt {
1965
2173
  getCanvas() {
1966
2174
  return this._engine.getCanvas();
1967
2175
  }
1968
- updateUniforms(e, t) {
1969
- this._engine.updateUniforms(e, t);
2176
+ updateUniforms(A, e) {
2177
+ this._engine.updateUniforms(A, e);
1970
2178
  }
1971
2179
  test() {
1972
2180
  this._engine.test();
1973
2181
  }
1974
2182
  }
1975
2183
  export {
1976
- gt as Mirage
2184
+ Ze as Mirage
1977
2185
  };