@mirage-engine/core 0.3.21 → 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 Ve = Object.defineProperty, Ye = Object.defineProperties;
2
- var We = Object.getOwnPropertyDescriptors;
3
- var Re = Object.getOwnPropertySymbols;
4
- var Pe = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
5
- var xe = (i, e, t) => e in i ? Ve(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, re = (i, e) => {
6
- for (var t in e || (e = {}))
7
- Pe.call(e, t) && xe(i, t, e[t]);
8
- if (Re)
9
- for (var t of Re(e))
10
- He.call(e, t) && xe(i, t, e[t]);
11
- return i;
12
- }, Me = (i, e) => Ye(i, We(e));
13
- var p = (i, e, t) => (xe(i, typeof e != "symbol" ? e + "" : e, t), t);
14
- var Le = (i, e, t) => new Promise((r, s) => {
15
- var c = (l) => {
1
+ var le = Object.defineProperty, he = Object.defineProperties;
2
+ var Ce = Object.getOwnPropertyDescriptors;
3
+ var qA = Object.getOwnPropertySymbols;
4
+ var Be = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable;
5
+ var RA = (t, A, e) => A in t ? le(t, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[A] = e, oA = (t, A) => {
6
+ for (var e in A || (A = {}))
7
+ Be.call(A, e) && RA(t, e, A[e]);
8
+ if (qA)
9
+ for (var e of qA(A))
10
+ Ee.call(A, e) && RA(t, e, A[e]);
11
+ return t;
12
+ }, jA = (t, A) => he(t, Ce(A));
13
+ var h = (t, A, e) => (RA(t, typeof A != "symbol" ? A + "" : A, e), e);
14
+ var aA = (t, A, e) => new Promise((s, r) => {
15
+ var o = (n) => {
16
16
  try {
17
- n(t.next(l));
17
+ g(e.next(n));
18
18
  } catch (a) {
19
- s(a);
19
+ r(a);
20
20
  }
21
- }, o = (l) => {
21
+ }, i = (n) => {
22
22
  try {
23
- n(t.throw(l));
23
+ g(e.throw(n));
24
24
  } catch (a) {
25
- s(a);
25
+ r(a);
26
26
  }
27
- }, n = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(c, o);
28
- n((t = t.apply(i, e)).next());
27
+ }, g = (n) => n.done ? s(n.value) : Promise.resolve(n.value).then(o, i);
28
+ g((e = e.apply(t, A)).next());
29
29
  });
30
- import * as w from "three";
31
- const Be = {
30
+ import * as d from "three";
31
+ const tA = 5, LA = 0, pA = 1, mA = 2, te = 3, ie = 4, re = {
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
- }, te = {
37
+ }, eA = {
38
38
  NAME: "data-mirage-dom",
39
39
  KEY: "mirageDom",
40
40
  VALUES: {
41
41
  HIDE: "hide",
42
42
  SHOW: "show"
43
43
  }
44
- }, De = {
44
+ }, VA = {
45
45
  TRAVELER: "traveler",
46
46
  NATIVE: "native",
47
47
  CAPTURE_1: "1",
@@ -54,78 +54,78 @@ const Be = {
54
54
  CAPTURE_8: "8",
55
55
  CAPTURE_9: "9",
56
56
  CAPTURE_10: "10"
57
- }, V = {
57
+ }, X = {
58
58
  NAME: "data-mirage-travel",
59
59
  KEY: "mirageTravel",
60
- VALUES: De,
61
- MAX_LAYERS: Object.keys(De).length - 1
60
+ VALUES: VA,
61
+ MAX_LAYERS: Object.keys(VA).length - 1
62
62
  }, q = {
63
63
  NAME: "data-mirage-filter",
64
64
  KEY: "mirageFilter",
65
- VALUES: Be
66
- }, j = {
65
+ VALUES: re
66
+ }, Z = {
67
67
  NAME: "data-mirage-select",
68
68
  KEY: "mirageSelect",
69
- VALUES: Be
70
- }, Ge = {
69
+ VALUES: re
70
+ }, de = {
71
71
  NAME: "data-mirage-shader",
72
72
  KEY: "mirageShader"
73
- }, gt = {
73
+ }, qe = {
74
74
  NAME: "data-mirage-sandwich",
75
75
  KEY: "mirageSandwich",
76
76
  VALUES: {
77
77
  FRONT: "front"
78
78
  }
79
- }, pe = 0, ie = 1, fe = 2, qe = 4, me = 8, Se = 16;
80
- function $e(i) {
81
- const e = i.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, Qe = 4, SA = 8, TA = 16;
80
+ function ue(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 je(i) {
90
- const e = {};
91
- if (i.opacity && (e.opacity = parseFloat(i.opacity)), i.backgroundColor) {
92
- const t = $e(i.backgroundColor);
93
- e.backgroundColor = [t.r, t.g, t.b, t.a];
89
+ function fe(t) {
90
+ const A = {};
91
+ if (t.opacity && (A.opacity = parseFloat(t.opacity)), t.backgroundColor) {
92
+ const e = ue(t.backgroundColor);
93
+ A.backgroundColor = [e.r, e.g, e.b, e.a];
94
94
  }
95
- if (i.backgroundImage ? e.backgroundImage = i.backgroundImage : i.background && (e.backgroundImage = i.background), i.boxShadow && (e.boxShadow = i.boxShadow), i.borderRadius && (e.borderRadius = parseFloat(i.borderRadius)), i.width && (e.width = parseFloat(i.width)), i.height && (e.height = parseFloat(i.height)), i.transform && i.transform !== "none") {
96
- const t = new DOMMatrix(i.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 Ke {
102
- constructor(e, t) {
103
- p(this, "target");
104
- p(this, "observer");
105
- p(this, "pendingDeletions", /* @__PURE__ */ new Set());
106
- p(this, "pendingStyles", /* @__PURE__ */ new Map());
107
- p(this, "isDomDirty", !1);
108
- p(this, "isRunning", !1);
109
- p(this, "pendingMask", pe);
110
- p(this, "mutationTimer", null);
111
- p(this, "cssTimer", null);
112
- p(this, "resizeConfig");
113
- p(this, "resizeTimer", null);
114
- p(this, "isResizing", !1);
115
- p(this, "lastScrollX", 0);
116
- p(this, "lastScrollY", 0);
117
- p(this, "scrollTimer", null);
118
- p(this, "onBeforeRender", /* @__PURE__ */ new Set());
119
- p(this, "onLayoutChange", /* @__PURE__ */ new Set());
120
- p(this, "onStyleChange", /* @__PURE__ */ new Set());
121
- p(this, "onScrollChange", /* @__PURE__ */ new Set());
122
- p(this, "onRender", /* @__PURE__ */ new Set());
123
- p(this, "onTransitionFinished", (e) => {
124
- this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= ie | fe, this.cssTimer = window.setTimeout(() => {
101
+ class we {
102
+ constructor(A, e) {
103
+ h(this, "target");
104
+ h(this, "observer");
105
+ h(this, "pendingDeletions", /* @__PURE__ */ new Set());
106
+ h(this, "pendingStyles", /* @__PURE__ */ new Map());
107
+ h(this, "isDomDirty", !1);
108
+ h(this, "isRunning", !1);
109
+ h(this, "pendingMask", DA);
110
+ h(this, "mutationTimer", null);
111
+ h(this, "cssTimer", null);
112
+ h(this, "resizeConfig");
113
+ h(this, "resizeTimer", null);
114
+ h(this, "isResizing", !1);
115
+ h(this, "lastScrollX", 0);
116
+ h(this, "lastScrollY", 0);
117
+ h(this, "scrollTimer", null);
118
+ h(this, "onBeforeRender", /* @__PURE__ */ new Set());
119
+ h(this, "onLayoutChange", /* @__PURE__ */ new Set());
120
+ h(this, "onStyleChange", /* @__PURE__ */ new Set());
121
+ h(this, "onScrollChange", /* @__PURE__ */ new Set());
122
+ h(this, "onRender", /* @__PURE__ */ new Set());
123
+ h(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
- p(this, "onWindowResize", () => {
128
+ h(this, "onWindowResize", () => {
129
129
  if (!this.resizeConfig.enabled) {
130
130
  this.isDomDirty = !0;
131
131
  return;
@@ -134,41 +134,41 @@ class Ke {
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
- p(this, "renderLoop", () => {
137
+ h(this, "renderLoop", () => {
138
138
  if (!this.isRunning)
139
139
  return;
140
- this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = pe);
141
- const e = window.scrollX, t = window.scrollY;
142
- (e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((r) => r(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
143
- this.pendingMask |= ie, this.isDomDirty = !0, this.scrollTimer = null;
144
- }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((r) => r(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((r) => r()), 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 s, c;
147
- this.target = e;
148
- const r = (s = t.resizeDebounce) != null ? s : !0;
149
- r === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : r === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
146
+ var r, o;
147
+ this.target = A;
148
+ const s = (r = e.resizeDebounce) != null ? r : !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 = r.delay) != null ? c : 150,
152
- onStart: r.onStart,
153
- onEnd: r.onEnd
154
- }, this.observer = new MutationObserver((o) => {
155
- let n = pe;
156
- for (const l of o)
157
- if (l.type === "childList")
158
- n |= me, l.removedNodes.length > 0 && l.removedNodes.forEach((a) => {
151
+ delay: (o = s.delay) != null ? o : 150,
152
+ onStart: s.onStart,
153
+ onEnd: s.onEnd
154
+ }, this.observer = new MutationObserver((i) => {
155
+ let g = DA;
156
+ for (const n of i)
157
+ if (n.type === "childList")
158
+ g |= SA, n.removedNodes.length > 0 && n.removedNodes.forEach((a) => {
159
159
  a instanceof HTMLElement && this.pendingDeletions.add(a);
160
160
  });
161
- else if (l.type === "attributes")
162
- if (l.attributeName === "style") {
163
- n |= ie | fe;
164
- const a = l.target, u = je(a.style);
165
- this.pendingStyles.set(a, u);
161
+ else if (n.type === "attributes")
162
+ if (n.attributeName === "style") {
163
+ g |= nA | fA;
164
+ const a = n.target, I = fe(a.style);
165
+ this.pendingStyles.set(a, I);
166
166
  } else
167
- l.attributeName === "class" ? n |= ie | fe : l.attributeName && l.attributeName.startsWith("data-") && (n |= ie | fe, l.attributeName.startsWith("data-mirage") && (n |= me));
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" && (n |= Se | ie);
170
- if (n !== pe) {
171
- if (this.pendingMask |= n, n & me) {
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 Ke {
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, ne = 2, pt = 0, O = {
196
+ const j = 1, lA = 2, je = 0, L = {
197
197
  BASE: 0,
198
198
  SELECTED: 1,
199
- getCaptureLayer: (i) => 31 - i,
199
+ getCaptureLayer: (t) => 31 - t,
200
200
  HIDDEN: 31
201
- }, Ae = Object.values(q.VALUES);
202
- class Fe {
201
+ }, ZA = Object.values(q.VALUES);
202
+ class se {
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"), r = document.createElement("span"), s = 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", r.style.margin = "0", r.style.padding = "0", r.style.border = "none", r.style.lineHeight = "normal", s.width = 1, s.height = 1, s.style.verticalAlign = "baseline", r.appendChild(document.createTextNode("Hidden Text")), t.appendChild(r), t.appendChild(s), document.body.appendChild(t);
219
- const c = s.offsetTop - r.offsetTop;
220
- return document.body.removeChild(t), c;
217
+ const e = document.createElement("div"), s = document.createElement("span"), r = 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", r.width = 1, r.height = 1, r.style.verticalAlign = "baseline", s.appendChild(document.createTextNode("Hidden Text")), e.appendChild(s), e.appendChild(r), document.body.appendChild(e);
219
+ const o = r.offsetTop - s.offsetTop;
220
+ return document.body.removeChild(e), o;
221
221
  }
222
222
  }
223
- p(Fe, "cache", /* @__PURE__ */ new Map());
224
- class Je extends w.MeshBasicMaterial {
225
- constructor(t, r, s, c, o = 2) {
223
+ h(se, "cache", /* @__PURE__ */ new Map());
224
+ class pe extends d.MeshBasicMaterial {
225
+ constructor(e, s, r, o, i = 2) {
226
226
  super({
227
227
  transparent: !0,
228
- side: w.FrontSide,
228
+ side: d.FrontSide,
229
229
  color: 16777215
230
230
  });
231
- p(this, "canvas");
232
- p(this, "ctx");
233
- p(this, "qualityFactor");
231
+ h(this, "canvas");
232
+ h(this, "ctx");
233
+ h(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 = o, 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, r, s, c);
237
- }
238
- wrapText(t, r) {
239
- const s = t.split(`
240
- `), c = [];
241
- return s.forEach((o) => {
242
- const n = o.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
- if (n.length === 0) {
244
- c.push("");
236
+ this.qualityFactor = i, this.map = new d.CanvasTexture(this.canvas), this.map.colorSpace = d.LinearSRGBColorSpace, this.map.minFilter = d.LinearFilter, this.map.magFilter = d.LinearFilter, this.updateText(e, s, r, o);
237
+ }
238
+ wrapText(e, s) {
239
+ const r = e.split(`
240
+ `), o = [];
241
+ return r.forEach((i) => {
242
+ const g = i.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
+ if (g.length === 0) {
244
+ o.push("");
245
245
  return;
246
246
  }
247
- let l = n[0];
248
- for (let a = 1; a < n.length; a++) {
249
- const u = n[a];
250
- this.ctx.measureText(l + u).width <= r + 2 ? l += u : (l && c.push(l), l = u.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, r, s, c, o) {
256
- o !== void 0 && (this.qualityFactor = o);
257
- const l = (window.devicePixelRatio || 1) * this.qualityFactor, a = s * l, u = c * l;
258
- this.canvas.width !== a || this.canvas.height !== u ? (this.canvas.width = a, this.canvas.height = u) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(l, 0, 0, l, 0, 0), this.ctx.font = r.font, this.ctx.fillStyle = r.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
259
- const h = this.wrapText(t, s), d = r.lineHeight, m = Fe.getBaseline(r.font);
260
- h.forEach((g, R) => {
261
- const v = R * d + m;
262
- let y = 0;
263
- r.textAlign === "center" ? y = s / 2 : r.textAlign === "right" && (y = s), this.ctx.textAlign = r.textAlign, this.ctx.fillText(g, y, v);
252
+ n && o.push(n);
253
+ }), o;
254
+ }
255
+ updateText(e, s, r, o, i) {
256
+ i !== void 0 && (this.qualityFactor = i);
257
+ const n = (window.devicePixelRatio || 1) * this.qualityFactor, a = r * 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, r), l = s.lineHeight, B = se.getBaseline(s.font);
260
+ c.forEach((C, w) => {
261
+ const Q = w * l + B;
262
+ let b = 0;
263
+ s.textAlign === "center" ? b = r / 2 : s.textAlign === "right" && (b = r), 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(i, e = 0) {
271
- if (typeof i == "number")
272
- return i;
273
- const t = parseFloat(i) || 0;
274
- return typeof i == "string" && i.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(i) {
277
- if (!i || i === "transparent")
278
- return { color: new w.Color(16777215), alpha: 0 };
279
- const e = i.match(
276
+ function CA(t) {
277
+ if (!t || t === "transparent")
278
+ return { color: new d.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), r = parseInt(e[2], 10), s = parseInt(e[3], 10), c = e[4] !== void 0 ? parseFloat(e[4]) : 1;
284
- return { color: new w.Color(`rgb(${t}, ${r}, ${s})`), alpha: c };
282
+ if (A) {
283
+ const e = parseInt(A[1], 10), s = parseInt(A[2], 10), r = parseInt(A[3], 10), o = A[4] !== void 0 ? parseFloat(A[4]) : 1;
284
+ return { color: new d.Color(`rgb(${e}, ${s}, ${r})`), alpha: o };
285
285
  }
286
- return { color: new w.Color(i), alpha: 1 };
286
+ return { color: new d.Color(t), alpha: 1 };
287
287
  }
288
- function Oe(i) {
289
- const e = [];
290
- let t = "", r = 0;
291
- for (let s = 0; s < i.length; s++) {
292
- const c = i[s];
293
- if (c === "(")
294
- r++;
295
- else if (c === ")")
296
- r--;
297
- else if (c === "," && r === 0) {
298
- e.push(t.trim()), t = "";
288
+ function oe(t) {
289
+ const A = [];
290
+ let e = "", s = 0;
291
+ for (let r = 0; r < t.length; r++) {
292
+ const o = t[r];
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 Ze(i) {
306
- if (!i || typeof i != "string" || !i.includes("linear-gradient"))
305
+ function me(t) {
306
+ if (!t || typeof t != "string" || !t.includes("linear-gradient"))
307
307
  return null;
308
- const e = i.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], r = Oe(t);
312
- let s = Math.PI, c = 0;
313
- const o = r[0].trim();
314
- if (o.startsWith("to "))
315
- o === "to top" ? s = 0 : o === "to right" ? s = Math.PI / 2 : o === "to bottom" ? s = Math.PI : o === "to left" ? s = Math.PI * 1.5 : o === "to top right" || o === "to right top" ? s = Math.PI / 4 : o === "to bottom right" || o === "to right bottom" ? s = Math.PI * 0.75 : o === "to bottom left" || o === "to left bottom" ? s = Math.PI * 1.25 : (o === "to top left" || o === "to left top") && (s = Math.PI * 1.75), c = 1;
316
- else if (o.endsWith("deg") || o.endsWith("rad") || o.endsWith("turn")) {
317
- const l = parseFloat(o);
318
- o.endsWith("deg") ? s = l * (Math.PI / 180) : o.endsWith("rad") ? s = l : o.endsWith("turn") && (s = l * Math.PI * 2), c = 1;
319
- }
320
- const n = [];
321
- for (let l = c; l < r.length && !(n.length >= 8); l++) {
322
- const a = r[l].trim(), u = a.lastIndexOf(" ");
323
- let h = a, d = null;
324
- if (u !== -1 && !a.endsWith(")")) {
325
- const g = a.substring(u + 1);
326
- (g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = a.substring(0, u).trim(), d = g);
311
+ const e = A[1], s = oe(e);
312
+ let r = Math.PI, o = 0;
313
+ const i = s[0].trim();
314
+ if (i.startsWith("to "))
315
+ i === "to top" ? r = 0 : i === "to right" ? r = Math.PI / 2 : i === "to bottom" ? r = Math.PI : i === "to left" ? r = Math.PI * 1.5 : i === "to top right" || i === "to right top" ? r = Math.PI / 4 : i === "to bottom right" || i === "to right bottom" ? r = Math.PI * 0.75 : i === "to bottom left" || i === "to left bottom" ? r = Math.PI * 1.25 : (i === "to top left" || i === "to left top") && (r = Math.PI * 1.75), o = 1;
316
+ else if (i.endsWith("deg") || i.endsWith("rad") || i.endsWith("turn")) {
317
+ const n = parseFloat(i);
318
+ i.endsWith("deg") ? r = n * (Math.PI / 180) : i.endsWith("rad") ? r = n : i.endsWith("turn") && (r = 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, l = 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(), l = C);
327
327
  }
328
- const m = ce(h);
329
- n.push({
330
- color: m.color,
331
- alpha: m.alpha,
332
- rawStop: d,
328
+ const B = CA(c);
329
+ g.push({
330
+ color: B.color,
331
+ alpha: B.alpha,
332
+ rawStop: l,
333
333
  stop: 0
334
334
  });
335
335
  }
336
- if (n.length > 0) {
337
- for (let a = 0; a < n.length; a++)
338
- n[a].rawStop !== null && (n[a].stop = parseFloat(n[a].rawStop) / 100);
339
- n[0].rawStop === null && (n[0].stop = 0), n.length > 1 && n[n.length - 1].rawStop === null && (n[n.length - 1].stop = 1);
340
- let l = 0;
341
- for (let a = 1; a < n.length; a++)
342
- if (n[a].rawStop !== null || a === n.length - 1) {
343
- const u = a - l;
344
- if (u > 1) {
345
- const h = n[l].stop, m = (n[a].stop - h) / u;
346
- for (let g = 1; g < u; g++)
347
- n[l + g].stop = h + m * 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 = a;
349
+ n = a;
350
350
  }
351
351
  }
352
- return { angle: s, stops: n };
352
+ return { angle: r, stops: g };
353
353
  }
354
- function Qe(i) {
355
- if (!i || i === "none")
354
+ function ye(t) {
355
+ if (!t || t === "none")
356
356
  return null;
357
- const e = Oe(i);
358
- if (e.length === 0)
357
+ const A = oe(t);
358
+ if (A.length === 0)
359
359
  return null;
360
- const t = e[0].trim(), r = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, s = t.match(r);
361
- let c = "transparent", o = t;
362
- if (s && s[1] !== "inset") {
363
- const m = s[1];
364
- (m.startsWith("rgb") || m.startsWith("#") || m === "black" || m === "white" || m === "transparent") && (c = m, o = t.replace(m, "").trim());
365
- }
366
- o = o.replace("inset", "").trim();
367
- const n = o.split(/\s+/).map((m) => parseFloat(m) || 0), l = n[0] || 0, a = n[1] || 0, u = n[2] || 0, h = n[3] || 0, d = ce(c);
368
- return { offsetX: l, offsetY: a, blurRadius: u, spreadRadius: h, color: d.color, alpha: d.alpha };
360
+ const e = A[0].trim(), s = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, r = e.match(s);
361
+ let o = "transparent", i = e;
362
+ if (r && r[1] !== "inset") {
363
+ const B = r[1];
364
+ (B.startsWith("rgb") || B.startsWith("#") || B === "black" || B === "white" || B === "transparent") && (o = B, i = e.replace(B, "").trim());
365
+ }
366
+ i = i.replace("inset", "").trim();
367
+ const g = i.split(/\s+/).map((B) => parseFloat(B) || 0), n = g[0] || 0, a = g[1] || 0, I = g[2] || 0, c = g[3] || 0, l = CA(o);
368
+ return { offsetX: n, offsetY: a, blurRadius: I, spreadRadius: c, color: l.color, alpha: l.alpha };
369
369
  }
370
- const et = `varying vec2 vUv;
370
+ const De = `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
- }`, tt = `varying vec2 vUv;
376
+ }`, Se = `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
- `, rt = `uniform sampler2D uTexture;
535
+ `, ve = `uniform sampler2D uTexture;
536
536
  varying vec4 vScreenPos;
537
537
  uniform vec2 uTextureRepeat;
538
- uniform vec2 uTextureOffset;`, it = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
538
+ uniform vec2 uTextureOffset;`, be = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
539
539
  vec2 resultUv = screenUv;
540
540
 
541
- `, st = `vec4 texColor = texture2D(uTexture, resultUv);
542
- baseColor = blendSrcOver(baseColor, texColor);`, Ie = {
543
- vertexShader: et,
544
- fragmentShader: tt
545
- }, ke = {
546
- declChunk: rt,
547
- uvChunk: it,
548
- baseColorChunk: st
541
+ `, Ne = `vec4 texColor = texture2D(uTexture, resultUv);
542
+ baseColor = blendSrcOver(baseColor, texColor);`, PA = {
543
+ vertexShader: De,
544
+ fragmentShader: Se
545
+ }, $A = {
546
+ declChunk: ve,
547
+ uvChunk: be,
548
+ baseColorChunk: Ne
549
549
  };
550
- function ot(i, e, t, r = null, s) {
551
- var C;
552
- const c = r !== null || !!i.imageSrc;
553
- let o = "";
554
- const n = {};
555
- if (s != null && s.uniforms)
556
- for (const [b, x] of Object.entries(s.uniforms))
557
- typeof x == "number" ? (o += `uniform float ${b};
558
- `, n[b] = { value: x }) : Array.isArray(x) ? x.length === 2 ? (o += `uniform vec2 ${b};
559
- `, n[b] = { value: new w.Vector2(...x) }) : x.length === 3 ? (o += `uniform vec3 ${b};
560
- `, n[b] = { value: new w.Vector3(...x) }) : x.length === 4 && (o += `uniform vec4 ${b};
561
- `, n[b] = { value: new w.Vector4(...x) }) : x && typeof x == "object" && x.type ? (o += `uniform ${x.type} ${b};
562
- `, n[b] = x) : (o += `uniform float ${b};
563
- `, n[b] = { value: x });
564
- const l = s !== void 0, a = (c || l ? ke.declChunk : "") + `
565
- ` + o, u = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
566
- `, h = i.isTraveler ? `vec2 resultUv = screenUv;
550
+ function Me(t, A, e, s = null, r) {
551
+ var U;
552
+ const o = s !== null || !!t.imageSrc;
553
+ let i = "";
554
+ const g = {};
555
+ if (r != null && r.uniforms)
556
+ for (const [S, D] of Object.entries(r.uniforms))
557
+ typeof D == "number" ? (i += `uniform float ${S};
558
+ `, g[S] = { value: D }) : Array.isArray(D) ? D.length === 2 ? (i += `uniform vec2 ${S};
559
+ `, g[S] = { value: new d.Vector2(...D) }) : D.length === 3 ? (i += `uniform vec3 ${S};
560
+ `, g[S] = { value: new d.Vector3(...D) }) : D.length === 4 && (i += `uniform vec4 ${S};
561
+ `, g[S] = { value: new d.Vector4(...D) }) : D && typeof D == "object" && D.type ? (i += `uniform ${D.type} ${S};
562
+ `, g[S] = D) : (i += `uniform float ${S};
563
+ `, g[S] = { value: D });
564
+ const n = r !== void 0, a = (o || n ? $A.declChunk : "") + `
565
+ ` + i, 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 ? u + h + ((s == null ? void 0 : s.uvModifier) || "") : "", m = c || l ? ke.baseColorChunk : "", g = (s == null ? void 0 : s.colorModifier) || "", R = Ie.fragmentShader.replace("#INJECT_DECLARATIONS", a).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", m).replace("#INJECT_COLOR_MODIFIER", g), v = ce(i.backgroundColor), y = ce(i.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
+ `, l = o || n ? I + c + ((r == null ? void 0 : r.uvModifier) || "") : "", B = o || n ? $A.baseColorChunk : "", C = (r == null ? void 0 : r.colorModifier) || "", w = PA.fragmentShader.replace("#INJECT_DECLARATIONS", a).replace("#INJECT_UV_MODIFIER", l).replace("#INJECT_BASE_COLOR", B).replace("#INJECT_COLOR_MODIFIER", C), Q = CA(t.backgroundColor), b = CA(t.borderColor), f = {
570
+ uSize: { value: new d.Vector2(A, e) },
571
+ uMeshSize: { value: new d.Vector2(A, e) },
572
+ uShadowColor: { value: new d.Vector4(0, 0, 0, 0) },
573
+ uShadowOffset: { value: new d.Vector2(0, 0) },
574
574
  uShadowBlur: { value: 0 },
575
575
  uShadowSpread: { value: 0 },
576
576
  uBgColor: {
577
- value: new w.Vector4(
578
- v.color.r,
579
- v.color.g,
580
- v.color.b,
581
- v.alpha
577
+ value: new d.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(
586
- y.color.r,
587
- y.color.g,
588
- y.color.b,
589
- y.alpha
585
+ value: new d.Vector4(
586
+ b.color.r,
587
+ b.color.g,
588
+ b.color.b,
589
+ b.alpha
590
590
  )
591
591
  },
592
- uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
593
- uBorderWidth: { value: le(i.borderWidth) },
594
- uOpacity: { value: (C = i.opacity) != null ? C : 1 },
592
+ uBorderRadius: { value: new d.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 d.Vector2(1, 1) },
597
+ uTextureOffset: { value: new d.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 d.Vector4(0, 0, 0, 0))
602
602
  },
603
603
  uGradientStops: { value: new Float32Array(8) }
604
604
  };
605
- _e(E.uBorderRadius.value, i.borderRadius, Math.min(e, t)), c && (E.uTexture.value = r);
606
- const L = new w.ShaderMaterial({
607
- uniforms: re(re({}, E), n),
608
- vertexShader: Ie.vertexShader,
609
- fragmentShader: R,
605
+ ae(f.uBorderRadius.value, t.borderRadius, Math.min(A, e)), o && (f.uTexture.value = s);
606
+ const y = new d.ShaderMaterial({
607
+ uniforms: oA(oA({}, f), g),
608
+ vertexShader: PA.vertexShader,
609
+ fragmentShader: w,
610
610
  transparent: !0,
611
- side: w.FrontSide
611
+ side: d.FrontSide
612
612
  // for better performance
613
613
  });
614
- return i.backgroundImage && Ee(L, { backgroundImage: i.backgroundImage }), L;
614
+ return t.backgroundImage && YA(y, { backgroundImage: t.backgroundImage }), y;
615
615
  }
616
- function at(i, e, t, r, s) {
617
- const c = le(e.borderWidth);
618
- Ee(i, {
619
- width: t,
620
- height: r,
621
- borderRadius: e.borderRadius,
622
- borderWidth: c,
623
- backgroundColor: e.backgroundColor,
624
- borderColor: e.borderColor,
625
- opacity: e.opacity,
626
- texture: s,
627
- backgroundImage: e.backgroundImage,
628
- boxShadow: e.boxShadow
616
+ function Re(t, A, e, s, r) {
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: r,
627
+ backgroundImage: A.backgroundImage,
628
+ boxShadow: A.boxShadow
629
629
  });
630
630
  }
631
- function Ee(i, e) {
632
- var r, s, c;
633
- if (e.boxShadow !== void 0) {
634
- const o = Qe(e.boxShadow);
635
- o ? (i.uniforms.uShadowColor.value.set(o.color.r, o.color.g, o.color.b, o.alpha), i.uniforms.uShadowOffset.value.set(o.offsetX, o.offsetY), i.uniforms.uShadowBlur.value = o.blurRadius, i.uniforms.uShadowSpread.value = o.spreadRadius, i.userData.shadowPadding = o.blurRadius + o.spreadRadius + Math.max(Math.abs(o.offsetX), Math.abs(o.offsetY))) : (i.uniforms.uShadowColor.value.w = 0, i.userData.shadowPadding = 0);
636
- }
637
- if (e.width !== void 0 && e.height !== void 0 && i.uniforms.uSize.value.set(e.width, e.height), i.uniforms.uMeshSize) {
638
- const o = i.userData.shadowPadding || 0, n = e.width !== void 0 ? e.width : i.uniforms.uSize.value.x, l = e.height !== void 0 ? e.height : i.uniforms.uSize.value.y;
639
- i.uniforms.uMeshSize.value.set(n + o * 2, l + o * 2);
640
- }
641
- if (e.borderRadius !== void 0) {
642
- const o = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(i.uniforms.uSize.value.x, i.uniforms.uSize.value.y);
643
- _e(i.uniforms.uBorderRadius.value, e.borderRadius, o);
644
- }
645
- if (e.borderWidth !== void 0 && (i.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
646
- if (Array.isArray(e.backgroundColor)) {
647
- const o = e.backgroundColor[3] !== void 0 ? e.backgroundColor[3] : i.uniforms.uBgColor.value.w;
648
- i.uniforms.uBgColor.value.set(
649
- e.backgroundColor[0],
650
- e.backgroundColor[1],
651
- e.backgroundColor[2],
652
- o
631
+ function YA(t, A) {
632
+ var s, r, o;
633
+ if (A.boxShadow !== void 0) {
634
+ const i = ye(A.boxShadow);
635
+ i ? (t.uniforms.uShadowColor.value.set(i.color.r, i.color.g, i.color.b, i.alpha), t.uniforms.uShadowOffset.value.set(i.offsetX, i.offsetY), t.uniforms.uShadowBlur.value = i.blurRadius, t.uniforms.uShadowSpread.value = i.spreadRadius, t.userData.shadowPadding = i.blurRadius + i.spreadRadius + Math.max(Math.abs(i.offsetX), Math.abs(i.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 i = 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 + i * 2, n + i * 2);
640
+ }
641
+ if (A.borderRadius !== void 0) {
642
+ const i = 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
+ ae(t.uniforms.uBorderRadius.value, A.borderRadius, i);
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 i = 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
+ i
653
653
  );
654
- } else if (typeof e.backgroundColor == "string") {
655
- const o = ce(e.backgroundColor);
656
- i.uniforms.uBgColor.value.set(
657
- o.color.r,
658
- o.color.g,
659
- o.color.b,
660
- o.alpha
654
+ } else if (typeof A.backgroundColor == "string") {
655
+ const i = CA(A.backgroundColor);
656
+ t.uniforms.uBgColor.value.set(
657
+ i.color.r,
658
+ i.color.g,
659
+ i.color.b,
660
+ i.alpha
661
661
  );
662
662
  } else {
663
- const o = i.uniforms.uBgColor.value.w;
664
- i.uniforms.uBgColor.value.set(
665
- e.backgroundColor.r,
666
- e.backgroundColor.g,
667
- e.backgroundColor.b,
668
- o
663
+ const i = t.uniforms.uBgColor.value.w;
664
+ t.uniforms.uBgColor.value.set(
665
+ A.backgroundColor.r,
666
+ A.backgroundColor.g,
667
+ A.backgroundColor.b,
668
+ i
669
669
  );
670
670
  }
671
- if (e.borderColor !== void 0)
672
- if (Array.isArray(e.borderColor)) {
673
- const o = i.uniforms.uBorderColor.value.w;
674
- i.uniforms.uBorderColor.value.set(
675
- e.borderColor[0],
676
- e.borderColor[1],
677
- e.borderColor[2],
678
- o
671
+ if (A.borderColor !== void 0)
672
+ if (Array.isArray(A.borderColor)) {
673
+ const i = t.uniforms.uBorderColor.value.w;
674
+ t.uniforms.uBorderColor.value.set(
675
+ A.borderColor[0],
676
+ A.borderColor[1],
677
+ A.borderColor[2],
678
+ i
679
679
  );
680
- } else if (typeof e.borderColor == "string") {
681
- const o = ce(e.borderColor);
682
- i.uniforms.uBorderColor.value.set(
683
- o.color.r,
684
- o.color.g,
685
- o.color.b,
686
- o.alpha
680
+ } else if (typeof A.borderColor == "string") {
681
+ const i = CA(A.borderColor);
682
+ t.uniforms.uBorderColor.value.set(
683
+ i.color.r,
684
+ i.color.g,
685
+ i.color.b,
686
+ i.alpha
687
687
  );
688
688
  } else {
689
- const o = i.uniforms.uBorderColor.value.w;
690
- i.uniforms.uBorderColor.value.set(
691
- e.borderColor.r,
692
- e.borderColor.g,
693
- e.borderColor.b,
694
- o
689
+ const i = t.uniforms.uBorderColor.value.w;
690
+ t.uniforms.uBorderColor.value.set(
691
+ A.borderColor.r,
692
+ A.borderColor.g,
693
+ A.borderColor.b,
694
+ i
695
695
  );
696
696
  }
697
- e.opacity !== void 0 && (i.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (i.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (i.uniforms.uBorderColor.value.w = e.borderOpacity), i.uniforms.uTexture && e.texture !== void 0 && (i.uniforms.uTexture.value = e.texture);
698
- const t = e.texture !== void 0 ? e.texture : (r = i.uniforms.uTexture) == null ? void 0 : r.value;
699
- if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
700
- const o = t.image.naturalWidth || t.image.videoWidth || t.image.width, n = t.image.naturalHeight || t.image.videoHeight || t.image.height, l = (s = e.width) != null ? s : i.uniforms.uSize.value.x, a = (c = e.height) != null ? c : i.uniforms.uSize.value.y;
701
- if (o && n && l && a) {
702
- const u = o / n, h = l / a;
703
- if (u > h) {
704
- const d = h / u;
705
- i.uniforms.uTextureRepeat.value.set(d, 1), i.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 i = e.image.naturalWidth || e.image.videoWidth || e.image.width, g = e.image.naturalHeight || e.image.videoHeight || e.image.height, n = (r = A.width) != null ? r : t.uniforms.uSize.value.x, a = (o = A.height) != null ? o : t.uniforms.uSize.value.y;
701
+ if (i && g && n && a) {
702
+ const I = i / g, c = n / a;
703
+ if (I > c) {
704
+ const l = c / I;
705
+ t.uniforms.uTextureRepeat.value.set(l, 1), t.uniforms.uTextureOffset.value.set((1 - l) / 2, 0);
706
706
  } else {
707
- const d = u / h;
708
- i.uniforms.uTextureRepeat.value.set(1, d), i.uniforms.uTextureOffset.value.set(0, (1 - d) / 2);
707
+ const l = I / c;
708
+ t.uniforms.uTextureRepeat.value.set(1, l), t.uniforms.uTextureOffset.value.set(0, (1 - l) / 2);
709
709
  }
710
710
  }
711
711
  } else
712
- i.uniforms.uTextureRepeat && (i.uniforms.uTextureRepeat.value.set(1, 1), i.uniforms.uTextureOffset.value.set(0, 0));
713
- if (e.backgroundImage !== void 0) {
714
- const o = Ze(e.backgroundImage);
715
- if (o) {
716
- i.uniforms.uGradientCount.value = o.stops.length, i.uniforms.uGradientAngle.value = o.angle;
717
- for (let n = 0; n < 8; n++)
718
- if (n < o.stops.length) {
719
- const l = o.stops[n];
720
- i.uniforms.uGradientColors.value[n].set(
721
- l.color.r,
722
- l.color.g,
723
- l.color.b,
724
- l.alpha
725
- ), i.uniforms.uGradientStops.value[n] = 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 i = me(A.backgroundImage);
715
+ if (i) {
716
+ t.uniforms.uGradientCount.value = i.stops.length, t.uniforms.uGradientAngle.value = i.angle;
717
+ for (let g = 0; g < 8; g++)
718
+ if (g < i.stops.length) {
719
+ const n = i.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
- i.uniforms.uGradientColors.value[n].set(0, 0, 0, 0), i.uniforms.uGradientStops.value[n] = 1;
727
+ t.uniforms.uGradientColors.value[g].set(0, 0, 0, 0), t.uniforms.uGradientStops.value[g] = 1;
728
728
  } else
729
- i.uniforms.uGradientCount.value = 0;
729
+ t.uniforms.uGradientCount.value = 0;
730
730
  }
731
- for (const o of Object.keys(e))
732
- o !== "width" && o !== "height" && o !== "borderRadius" && o !== "borderWidth" && o !== "backgroundColor" && o !== "borderColor" && o !== "opacity" && o !== "bgOpacity" && o !== "borderOpacity" && o !== "texture" && o !== "backgroundImage" && o !== "boxShadow" && i.uniforms[o] !== void 0 && (i.uniforms[o].value !== void 0 && i.uniforms[o].value !== null && typeof i.uniforms[o].value.set == "function" ? Array.isArray(e[o]) ? i.uniforms[o].value.set(...e[o]) : e[o] !== void 0 && (e[o].copy ? i.uniforms[o].value.copy(e[o]) : i.uniforms[o].value = e[o]) : i.uniforms[o].value = e[o]);
731
+ for (const i of Object.keys(A))
732
+ i !== "width" && i !== "height" && i !== "borderRadius" && i !== "borderWidth" && i !== "backgroundColor" && i !== "borderColor" && i !== "opacity" && i !== "bgOpacity" && i !== "borderOpacity" && i !== "texture" && i !== "backgroundImage" && i !== "boxShadow" && t.uniforms[i] !== void 0 && (t.uniforms[i].value !== void 0 && t.uniforms[i].value !== null && typeof t.uniforms[i].value.set == "function" ? Array.isArray(A[i]) ? t.uniforms[i].value.set(...A[i]) : A[i] !== void 0 && (A[i].copy ? t.uniforms[i].value.copy(A[i]) : t.uniforms[i].value = A[i]) : t.uniforms[i].value = A[i]);
733
733
  }
734
- function _e(i, e, t = 0) {
735
- var l, a, u, h;
736
- if (e == null) {
737
- i.set(0, 0, 0, 0);
734
+ function ae(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
- i.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
- i.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 r = e.split("/")[0].trim().split(/\s+/), s = le(r[0], t), c = le((l = r[1]) != null ? l : r[0], t), o = le((a = r[2]) != null ? a : r[0], t), n = le((h = (u = r[3]) != null ? u : r[1]) != null ? h : r[0], t);
749
- i.set(s, c, o, n);
748
+ const s = A.split("/")[0].trim().split(/\s+/), r = hA(s[0], e), o = hA((n = s[1]) != null ? n : s[0], e), i = 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(r, o, i, g);
750
750
  }
751
- const H = {
752
- create(i, e, t, r, s, c = 2, o = null, n) {
753
- return i === "BOX" ? ot(
754
- e,
755
- r,
751
+ const K = {
752
+ create(t, A, e, s, r, o = 2, i = null, g) {
753
+ return t === "BOX" ? Me(
754
+ A,
756
755
  s,
757
- o,
758
- n
759
- ) : i === "TEXT" ? new Je(
760
- t || "",
761
- e,
762
756
  r,
763
- s,
764
- c
765
- ) : new w.MeshBasicMaterial({ visible: !1 });
766
- },
767
- update(i, e, t, r, s, c, o = 2, n) {
768
- e === "BOX" ? at(
769
757
  i,
770
- t,
758
+ g
759
+ ) : t === "TEXT" ? new pe(
760
+ e || "",
761
+ A,
771
762
  s,
772
- c,
773
- n
774
- ) : e === "TEXT" && i.updateText(
775
- r || "",
776
- t,
777
- s,
778
- c,
763
+ r,
779
764
  o
765
+ ) : new d.MeshBasicMaterial({ visible: !1 });
766
+ },
767
+ update(t, A, e, s, r, o, i = 2, g) {
768
+ A === "BOX" ? Re(
769
+ t,
770
+ e,
771
+ r,
772
+ o,
773
+ g
774
+ ) : A === "TEXT" && t.updateText(
775
+ s || "",
776
+ e,
777
+ r,
778
+ o,
779
+ i
780
780
  );
781
781
  },
782
- forceUpdateUniforms(i, e) {
783
- Ee(i, e);
782
+ forceUpdateUniforms(t, A) {
783
+ YA(t, A);
784
784
  }
785
785
  };
786
- class nt {
787
- constructor(e, t = !0) {
788
- p(this, "observer");
789
- p(this, "textures", /* @__PURE__ */ new WeakMap());
790
- p(this, "loadStatus", /* @__PURE__ */ new WeakMap());
791
- p(this, "elementUrls", /* @__PURE__ */ new WeakMap());
792
- p(this, "onUpdate");
793
- this.onUpdate = e, t && (this.observer = new IntersectionObserver(
794
- (r) => {
795
- for (const s of r) {
796
- const c = s.target;
797
- s.isIntersecting ? this.loadTexture(c) : this.disposeTexture(c);
786
+ class xe {
787
+ constructor(A, e = !0) {
788
+ h(this, "observer");
789
+ h(this, "textures", /* @__PURE__ */ new WeakMap());
790
+ h(this, "loadStatus", /* @__PURE__ */ new WeakMap());
791
+ h(this, "elementUrls", /* @__PURE__ */ new WeakMap());
792
+ h(this, "onUpdate");
793
+ this.onUpdate = A, e && (this.observer = new IntersectionObserver(
794
+ (s) => {
795
+ for (const r of s) {
796
+ const o = r.target;
797
+ r.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 Le(this, null, function* () {
813
- if (this.loadStatus.get(e) || this.textures.has(e))
811
+ loadTexture(A) {
812
+ return aA(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 r;
820
- if (t.startsWith("data:image/svg+xml"))
821
- r = yield new Promise((c, o) => {
822
- const n = new Image();
823
- n.onload = () => c(n), n.onerror = o, n.src = t;
819
+ let s;
820
+ if (e.startsWith("data:image/svg+xml"))
821
+ s = yield new Promise((o, i) => {
822
+ const g = new Image();
823
+ g.onload = () => o(g), g.onerror = i, g.src = e;
824
824
  });
825
825
  else {
826
- const o = yield (yield fetch(t)).blob();
827
- r = yield createImageBitmap(o, { imageOrientation: "flipY" });
826
+ const i = yield (yield fetch(e)).blob();
827
+ s = yield createImageBitmap(i, { imageOrientation: "flipY" });
828
828
  }
829
- if (this.elementUrls.get(e) !== t) {
830
- "close" in r && r.close();
829
+ if (this.elementUrls.get(A) !== e) {
830
+ "close" in s && s.close();
831
831
  return;
832
832
  }
833
- const s = new w.Texture(r);
834
- r instanceof HTMLImageElement || (s.flipY = !1), s.colorSpace = w.LinearSRGBColorSpace, s.needsUpdate = !0, this.textures.set(e, s), this.onUpdate(e, s);
835
- } catch (r) {
836
- console.warn("[MirageEngine] Failed to load texture:", t, r);
833
+ const r = new d.Texture(s);
834
+ s instanceof HTMLImageElement || (r.flipY = !1), r.colorSpace = d.LinearSRGBColorSpace, r.needsUpdate = !0, this.textures.set(A, r), this.onUpdate(A, r);
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 lt {
855
- constructor(e, t, r, s) {
856
- p(this, "canvas");
857
- p(this, "scene");
858
- p(this, "camera");
859
- p(this, "renderer");
860
- p(this, "renderTargets", []);
861
- p(this, "renderOrder", 0);
862
- p(this, "qualityFactor", 2);
863
- p(this, "mode", "overlay");
864
- p(this, "canvasSize", "viewport");
865
- p(this, "clipArea", 1);
866
- p(this, "targetLayer", "base");
867
- p(this, "overscan", 200);
868
- p(this, "target");
869
- p(this, "mountContainer");
870
- p(this, "registry");
871
- p(this, "targetRect");
872
- p(this, "travelersByLayer", Array.from(
873
- { length: V.MAX_LAYERS },
854
+ class Le {
855
+ constructor(A, e, s, r) {
856
+ h(this, "canvas");
857
+ h(this, "scene");
858
+ h(this, "camera");
859
+ h(this, "renderer");
860
+ h(this, "renderTargets", []);
861
+ h(this, "renderOrder", 0);
862
+ h(this, "qualityFactor", 2);
863
+ h(this, "mode", "overlay");
864
+ h(this, "canvasSize", "viewport");
865
+ h(this, "clipArea", 1);
866
+ h(this, "targetLayer", "base");
867
+ h(this, "overscan", 200);
868
+ h(this, "target");
869
+ h(this, "mountContainer");
870
+ h(this, "registry");
871
+ h(this, "targetRect");
872
+ h(this, "targetPageX", 0);
873
+ h(this, "targetPageY", 0);
874
+ h(this, "size", { width: 0, height: 0 });
875
+ h(this, "currentScrollX", 0);
876
+ h(this, "currentScrollY", 0);
877
+ h(this, "lastTargetLeft", 0);
878
+ h(this, "lastTargetTop", 0);
879
+ h(this, "travelersByLayer", Array.from(
880
+ { length: X.MAX_LAYERS },
874
881
  () => /* @__PURE__ */ new Set()
875
882
  ));
876
- p(this, "textureManager");
883
+ h(this, "textureManager");
877
884
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
878
- p(this, "fixedMeshes", /* @__PURE__ */ new Set());
879
- var n, l, a, u, h;
880
- this.target = e, this.mountContainer = r, this.registry = s, this.mode = (n = t.mode) != null ? n : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (a = t.travelerClipArea) != null ? a : 1, this.targetLayer = (u = t.layer) != null ? u : "base", this.textureManager = new nt((d, m) => {
881
- const g = this.registry.get(d);
882
- g && g.material instanceof w.ShaderMaterial && H.forceUpdateUniforms(g.material, { texture: m });
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, o = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
885
- this.camera = new w.OrthographicCamera(
886
- c / -2,
887
- c / 2,
888
- o / 2,
885
+ h(this, "fixedMeshes", /* @__PURE__ */ new Set());
886
+ var g, n, a, I, c;
887
+ this.target = A, this.mountContainer = s, this.registry = r, 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 xe((l, B) => {
888
+ const C = this.registry.get(l);
889
+ C && C.material instanceof d.ShaderMaterial && K.forceUpdateUniforms(C.material, { texture: B });
890
+ }, this.isViewport), this.qualityFactor = this.getQualityFactor(e.quality), this.canvas = document.createElement("canvas"), this.scene = new d.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, i = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
892
+ this.camera = new d.OrthographicCamera(
889
893
  o / -2,
894
+ o / 2,
895
+ i / 2,
896
+ i / -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 d.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, o), this.applyTextQuality((h = t.quality) != null ? h : "medium");
905
+ }), d.ColorManagement.enabled = !1, this.renderer.outputColorSpace = d.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(o, i), 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 < V.MAX_LAYERS; e++) {
908
- const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
914
+ for (let A = 0; A < X.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
- r * this.qualityFactor,
917
+ new d.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: d.LinearFilter,
922
+ magFilter: d.LinearFilter,
923
+ format: d.RGBAFormat,
917
924
  stencilBuffer: !1,
918
925
  depthBuffer: !0
919
926
  }
@@ -921,12 +928,12 @@ class lt {
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 lt {
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 r = this.registry.get(e);
953
- r && (r.traverse((s) => {
954
- s.isMesh && s.material && H.forceUpdateUniforms(
955
- s.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((r) => {
983
+ r.isMesh && r.material && K.forceUpdateUniforms(
984
+ r.material,
985
+ e
957
986
  );
958
- }), r.userData.nativeMesh && r.userData.nativeMesh.traverse((s) => {
959
- s.isMesh && s.material && H.forceUpdateUniforms(
960
- s.material,
961
- t
987
+ }), s.userData.nativeMesh && s.userData.nativeMesh.traverse((r) => {
988
+ r.isMesh && r.material && K.forceUpdateUniforms(
989
+ r.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 r of this.renderTargets)
971
- r.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 r = this.target.getBoundingClientRect(), s = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, o = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, n = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, l = Math.abs(s - o) > 0.1 || Math.abs(c - n) > 0.1, a = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
976
- l ? (this.targetRect = r, this.setSize(s, c), this.updateCanvasLayout()) : a ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((u) => {
977
- const h = this.registry.get(u);
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((m) => m.dispose()) : d.material.dispose()));
986
- }), this.registry.remove(u), this.textureManager.unregister(u);
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(), r = this.isViewport ? window.innerWidth + this.overscan * 2 : s.width, o = this.isViewport ? window.innerHeight + this.overscan * 2 : s.height, i = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, g = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, n = Math.abs(r - i) > 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(r, 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 l of this.travelersByLayer)
1010
+ l.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
+ (l) => l.dispose()
1013
+ ) : c.userData.nativeMesh.material.dispose(), c.userData.nativeMesh.geometry.dispose()), c.traverse((l) => {
1014
+ l instanceof d.Mesh && (l.geometry && l.geometry.dispose(), l.material && (Array.isArray(l.material) ? l.material.forEach((B) => B.dispose()) : l.material.dispose()));
1015
+ }), this.registry.remove(I), this.textureManager.unregister(I);
987
1016
  }
988
1017
  });
989
1018
  }
@@ -991,804 +1020,975 @@ class lt {
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 s, c;
996
- let t = this.registry.get(e.element);
997
- const r = JSON.stringify(e.shaderHooks || null);
998
- if (t && t.userData.shaderHash !== r && (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 o = new w.PlaneGeometry(1, 1), n = e.isTraveler ? (s = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : s.texture : this.textureManager.get(e.element), l = H.create(
1023
+ reconcileNode(A) {
1024
+ var r, 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 d.Material && e.material.dispose(), this.registry.remove(A.element), e = void 0), !e) {
1028
+ const i = new d.PlaneGeometry(1, 1), g = A.isTraveler ? (r = this.renderTargets[A.captureLayer - 2]) == null ? void 0 : r.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
- n,
1007
- e.shaderHooks
1035
+ g,
1036
+ A.shaderHooks
1008
1037
  );
1009
- t = new w.Mesh(o, 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 = r;
1038
+ e = new d.Mesh(i, 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 o = 0; o < V.MAX_LAYERS; o++)
1013
- o === e.captureLayer - 2 ? this.travelersByLayer[o].add(t) : this.travelersByLayer[o].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 i = 0; i < X.MAX_LAYERS; i++)
1042
+ i === A.captureLayer - 2 ? this.travelersByLayer[i].add(e) : this.travelersByLayer[i].delete(e);
1014
1043
  else
1015
- for (const o of this.travelersByLayer)
1016
- o.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 o of e.children)
1019
- this.reconcileNode(o);
1044
+ for (const i of this.travelersByLayer)
1045
+ i.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 i of A.children)
1048
+ this.reconcileNode(i);
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, r) {
1056
+ reconcileTextChild(A, e, s) {
1028
1057
  var a;
1029
- const s = t.textLines || [
1030
- { text: t.textContent || "", rect: t.rect }
1031
- ], c = r ? t.nativeStyles : t.textStyles, o = JSON.stringify(c) + t.textContent + s.map((u) => u.text).join("|"), n = (a = e.userData) == null ? void 0 : a.textChildStyleHash;
1032
- if (t.dirtyMask & Se || o !== n) {
1033
- e.children.filter(
1034
- (g) => g.name.startsWith("TEXT_CHILD")
1035
- ).forEach((g) => {
1036
- var v;
1037
- const R = g;
1038
- (v = R.material.map) == null || v.dispose(), R.geometry.dispose(), e.remove(R);
1058
+ const r = e.textLines || [
1059
+ { text: e.textContent || "", rect: e.rect }
1060
+ ], o = s ? e.nativeStyles : e.textStyles, i = JSON.stringify(o) + e.textContent + r.map((I) => I.text).join("|"), g = (a = A.userData) == null ? void 0 : a.textChildStyleHash;
1061
+ if (e.dirtyMask & TA || i !== 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, m = h.y + h.height / 2;
1041
- s.forEach((g, R) => {
1042
- const v = H.create(
1069
+ const c = e.rect, l = c.x + c.width / 2, B = c.y + c.height / 2;
1070
+ r.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
- ), y = new w.PlaneGeometry(1, 1), E = new w.Mesh(y, v);
1050
- E.name = `TEXT_CHILD_${R}`;
1051
- const L = 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(L, C, 1);
1053
- const b = g.rect.x + g.rect.width / 2, x = g.rect.y + g.rect.height / 2, X = b - d, Y = -(x - m);
1054
- E.position.set(
1055
- t.rect.width === 0 ? 0 : X / t.rect.width,
1056
- t.rect.height === 0 ? 0 : Y / t.rect.height,
1078
+ ), b = new d.PlaneGeometry(1, 1), f = new d.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 - l, 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 = o;
1087
+ ), A.add(f);
1088
+ }), A.userData.textChildStyleHash = i;
1060
1089
  }
1061
- e.children.forEach((u) => {
1062
- if (!u.name.startsWith("TEXT_CHILD"))
1090
+ A.children.forEach((I) => {
1091
+ if (!I.name.startsWith("TEXT_CHILD"))
1063
1092
  return;
1064
- const h = u;
1065
- if (r && 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 & j && 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 & ne && h.layers.enable(O.SELECTED), t.visibility & $)
1070
- if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1071
- for (let m = t.captureLayer; m <= V.MAX_LAYERS + 1; m++)
1072
- m !== t.nativeLayer && h.layers.enable(O.getCaptureLayer(m));
1097
+ const l = e.visibility & j ? L.BASE : L.HIDDEN;
1098
+ if (c.layers.set(l), e.visibility & lA && c.layers.enable(L.SELECTED), e.visibility & j)
1099
+ if (!s && e.nativeLayer !== void 0 && e.nativeStyles !== void 0)
1100
+ for (let B = e.captureLayer; B <= X.MAX_LAYERS + 1; B++)
1101
+ B !== e.nativeLayer && c.layers.enable(L.getCaptureLayer(B));
1073
1102
  else
1074
- for (let m = t.captureLayer; m <= V.MAX_LAYERS + 1; m++)
1075
- h.layers.enable(O.getCaptureLayer(m));
1103
+ for (let B = e.captureLayer; B <= X.MAX_LAYERS + 1; B++)
1104
+ c.layers.enable(L.getCaptureLayer(B));
1076
1105
  }
1077
1106
  });
1078
1107
  }
1079
- updateMeshProperties(e, t) {
1080
- var C, b, x, X, Y;
1081
- const { rect: r, styles: s } = t, c = this.renderer.getPixelRatio(), o = this.renderer.domElement.width / c, n = 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(r.width + l * 2, r.height + l * 2, 1), e.userData.domRect = {
1085
- x: r.x,
1086
- y: r.y,
1087
- width: r.width,
1088
- height: r.height
1089
- };
1108
+ updateMeshProperties(A, e) {
1109
+ var f, y, U, S, D;
1110
+ const { rect: s, styles: r } = e, o = this.renderer.getPixelRatio(), i = 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;
1090
1119
  const a = 1e-3;
1091
1120
  this.renderOrder++;
1092
- const u = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
1093
- let d, m;
1121
+ let I, c;
1094
1122
  if (this.isViewport)
1095
- d = r.x - window.innerWidth / 2 + r.width / 2, m = -r.y + window.innerHeight / 2 - r.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 A = r.x - u, N = r.y - h;
1098
- d = A - o / 2 + r.width / 2, m = -N + n / 2 - r.height / 2;
1125
+ const u = s.x - this.targetPageX, Y = s.y - this.targetPageY;
1126
+ I = u - i / 2 + s.width / 2, c = -Y + g / 2 - s.height / 2;
1099
1127
  }
1100
- e.position.set(
1101
- d,
1102
- m,
1103
- s.zIndex + this.renderOrder * a
1128
+ A.position.set(
1129
+ I,
1130
+ c,
1131
+ r.zIndex + this.renderOrder * a
1104
1132
  );
1105
- const g = r.x, R = r.y;
1106
- e.userData.basePosition = { x: d, y: m }, e.userData.originalBasePosition = { x: d, y: m }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: g, y: R }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1107
- const v = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, y = window.getComputedStyle(v);
1108
- let E = 0, L = 0;
1109
- if (y.transform && y.transform !== "none") {
1110
- const A = new DOMMatrix(y.transform);
1111
- E = A.m41, L = A.m42;
1133
+ const l = 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: l, 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: L }, delete e.userData.originRatioX, delete e.userData.originRatioY, H.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
- s,
1144
+ r,
1117
1145
  "",
1118
- r.width,
1119
- r.height,
1146
+ s.width,
1147
+ s.height,
1120
1148
  this.qualityFactor,
1121
- t.isTraveler ? (b = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : b.texture : this.textureManager.get(t.element)
1122
- ), t.nativeStyles && t.nativeRect) {
1123
- if (!e.userData.nativeMesh) {
1124
- const F = H.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 H = 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 ? (x = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : x.texture : t.nativeStyles.imageSrc && t.nativeStyles.imageSrc !== t.styles.imageSrc ? new w.TextureLoader().load(t.nativeStyles.imageSrc) : this.textureManager.get(t.element),
1132
- t.shaderHooks
1133
- ), W = new w.Mesh(e.geometry, F);
1134
- t.type === "TEXT" && (W.name = "BG_MESH"), this.scene.add(W), e.userData.nativeMesh = W;
1159
+ e.isTraveler ? (U = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : U.texture : e.nativeStyles.imageSrc && e.nativeStyles.imageSrc !== e.styles.imageSrc ? new d.TextureLoader().load(e.nativeStyles.imageSrc) : this.textureManager.get(e.element),
1160
+ e.shaderHooks
1161
+ ), G = new d.Mesh(A.geometry, H);
1162
+ e.type === "TEXT" && (G.name = "BG_MESH"), this.scene.add(G), A.userData.nativeMesh = G;
1135
1163
  }
1136
- const A = e.userData.nativeMesh;
1137
- let N, U;
1164
+ const u = A.userData.nativeMesh;
1165
+ let Y, gA;
1138
1166
  if (this.isViewport)
1139
- N = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, U = -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 F = t.nativeRect.x - u, W = t.nativeRect.y - h;
1142
- N = F - o / 2 + t.nativeRect.width / 2, U = -W + n / 2 - t.nativeRect.height / 2;
1169
+ const H = e.nativeRect.x - this.targetPageX, G = e.nativeRect.y - this.targetPageY;
1170
+ Y = H - i / 2 + e.nativeRect.width / 2, gA = -G + g / 2 - e.nativeRect.height / 2;
1143
1171
  }
1144
- let K = t.nativeRect.width, J = t.nativeRect.height, M = N, B = U;
1145
- if (t.nativeStyles.transform) {
1146
- const F = t.nativeStyles.transform, W = F.match(/scale\(([\d.]+%?)\)/);
1147
- if (W) {
1148
- let f = parseFloat(W[1]);
1149
- W[1].includes("%") && (f /= 100), K *= f, J *= f;
1172
+ let cA = e.nativeRect.width, F = e.nativeRect.height, M = Y, P = gA;
1173
+ if (e.nativeStyles.transform) {
1174
+ const H = e.nativeStyles.transform, G = H.match(/scale\(([\d.]+%?)\)/);
1175
+ if (G) {
1176
+ let m = parseFloat(G[1]);
1177
+ G[1].includes("%") && (m /= 100), cA *= m, F *= m;
1150
1178
  }
1151
- const se = F.match(/scaleX\(([\d.]+%?)\)/);
1152
- if (se) {
1153
- let f = parseFloat(se[1]);
1154
- se[1].includes("%") && (f /= 100), K *= f;
1179
+ const $ = H.match(/scaleX\(([\d.]+%?)\)/);
1180
+ if ($) {
1181
+ let m = parseFloat($[1]);
1182
+ $[1].includes("%") && (m /= 100), cA *= m;
1155
1183
  }
1156
- const oe = F.match(/scaleY\(([\d.]+%?)\)/);
1157
- if (oe) {
1158
- let f = parseFloat(oe[1]);
1159
- oe[1].includes("%") && (f /= 100), J *= f;
1184
+ const IA = H.match(/scaleY\(([\d.]+%?)\)/);
1185
+ if (IA) {
1186
+ let m = parseFloat(IA[1]);
1187
+ IA[1].includes("%") && (m /= 100), F *= m;
1160
1188
  }
1161
- const ae = F.match(/translate\(([^,]+),\s*([^)]+)\)/);
1162
- if (ae) {
1163
- const f = ae[1].trim(), S = ae[2].trim();
1164
- let I = parseFloat(f);
1165
- f.includes("%") && (I = I / 100 * t.nativeRect.width);
1166
- let _ = parseFloat(S);
1167
- S.includes("%") && (_ = _ / 100 * t.nativeRect.height), M += I, B -= _;
1189
+ const iA = H.match(/translate\(([^,]+),\s*([^)]+)\)/);
1190
+ if (iA) {
1191
+ const m = iA[1].trim(), z = iA[2].trim();
1192
+ let EA = parseFloat(m);
1193
+ m.includes("%") && (EA = EA / 100 * e.nativeRect.width);
1194
+ let dA = parseFloat(z);
1195
+ z.includes("%") && (dA = dA / 100 * e.nativeRect.height), M += EA, P -= dA;
1168
1196
  }
1169
- const he = F.match(/translateX\(([^)]+)\)/);
1170
- if (he) {
1171
- const f = he[1].trim();
1172
- let S = parseFloat(f);
1173
- f.includes("%") && (S = S / 100 * t.nativeRect.width), M += S;
1197
+ const AA = H.match(/translateX\(([^)]+)\)/);
1198
+ if (AA) {
1199
+ const m = AA[1].trim();
1200
+ let z = parseFloat(m);
1201
+ m.includes("%") && (z = z / 100 * e.nativeRect.width), M += z;
1174
1202
  }
1175
- const de = F.match(/translateY\(([^)]+)\)/);
1176
- if (de) {
1177
- const f = de[1].trim();
1178
- let S = parseFloat(f);
1179
- f.includes("%") && (S = S / 100 * t.nativeRect.height), B -= S;
1203
+ const rA = H.match(/translateY\(([^)]+)\)/);
1204
+ if (rA) {
1205
+ const m = rA[1].trim();
1206
+ let z = parseFloat(m);
1207
+ m.includes("%") && (z = z / 100 * e.nativeRect.height), P -= z;
1180
1208
  }
1181
1209
  }
1182
- let Z = ((X = A.material.userData) == null ? void 0 : X.shadowPadding) || 0;
1183
- A.scale.set(K + Z * 2, J + Z * 2, 1), A.position.set(
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(
1184
1212
  M,
1185
- B,
1186
- t.nativeStyles.zIndex + this.renderOrder * a
1187
- ), H.update(
1188
- A.material,
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 ? (Y = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : Y.texture : A.material.uniforms.uTexture.value || 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 r = t.visibility & $ ? O.BASE : O.HIDDEN;
1202
- if (e.layers.set(r), t.visibility & ne && e.layers.enable(O.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1203
- const s = e.userData.nativeMesh;
1204
- if (s.layers.set(O.HIDDEN), t.visibility & $) {
1205
- s.layers.enable(O.getCaptureLayer(t.nativeLayer));
1206
- for (let c = t.captureLayer; c <= V.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 d.Material && A.userData.nativeMesh.material.dispose(), delete A.userData.nativeMesh);
1227
+ }
1228
+ updateMeshLayers(A, e) {
1229
+ const s = e.visibility & j ? 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 r = A.userData.nativeMesh;
1232
+ if (r.layers.set(L.HIDDEN), e.visibility & j) {
1233
+ r.layers.enable(L.getCaptureLayer(e.nativeLayer));
1234
+ for (let o = e.captureLayer; o <= X.MAX_LAYERS + 1; o++)
1235
+ o !== e.nativeLayer && A.layers.enable(L.getCaptureLayer(o));
1208
1236
  }
1209
- } else if (t.visibility & $)
1210
- for (let s = t.captureLayer; s <= V.MAX_LAYERS + 1; s++)
1211
- e.layers.enable(O.getCaptureLayer(s));
1237
+ } else if (e.visibility & j)
1238
+ for (let r = e.captureLayer; r <= X.MAX_LAYERS + 1; r++)
1239
+ A.layers.enable(L.getCaptureLayer(r));
1212
1240
  }
1213
- captureRenderTarget(e, t, r) {
1214
- if (e.size === 0 || !r)
1241
+ captureRenderTarget(A, e, s) {
1242
+ if (A.size === 0 || !s)
1215
1243
  return;
1216
- const s = new w.Color(), c = this.renderer.getClearAlpha();
1217
- this.renderer.getClearColor(s), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(r), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1218
- const o = new w.Vector3(), n = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, a = this.renderer.getPixelRatio();
1219
- for (const u of e) {
1220
- o.setFromMatrixPosition(u.matrixWorld), o.project(this.camera);
1221
- const h = (o.x + 1) / 2 * n, d = (o.y + 1) / 2 * l;
1222
- let m = 0, g = 1;
1223
- typeof this.clipArea == "number" ? g = this.clipArea : this.clipArea.endsWith("%") ? g = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (m = parseFloat(this.clipArea));
1224
- const R = u.scale.x * g + 0.5, v = u.scale.y * g + 0.5, y = h - R / 2, E = d - v / 2, L = (y * this.qualityFactor - m) / a, C = (E * this.qualityFactor - m) / a, b = (R * this.qualityFactor + m * 2) / a, x = (v * this.qualityFactor + m * 2) / a;
1225
- this.renderer.setScissor(L, C, b, x), this.renderer.render(this.scene, this.camera);
1244
+ const r = new d.Color(), o = this.renderer.getClearAlpha();
1245
+ this.renderer.getClearColor(r), 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 i = new d.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
+ i.setFromMatrixPosition(I.matrixWorld), i.project(this.camera);
1249
+ const c = (i.x + 1) / 2 * g, l = (i.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 = l - 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(s, c);
1255
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(r, o);
1228
1256
  }
1229
1257
  render() {
1230
- for (let l = 0; l < V.MAX_LAYERS; l++) {
1231
- const a = l + 1;
1258
+ for (let n = 0; n < X.MAX_LAYERS; n++) {
1259
+ const a = n + 1;
1232
1260
  this.captureRenderTarget(
1233
- this.travelersByLayer[l],
1234
- O.getCaptureLayer(a),
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(), r = this.renderer.domElement.height / t, s = this.renderer.domElement, c = s.getBoundingClientRect().top, o = s.getBoundingClientRect().left, n = (l, a) => {
1266
+ const A = this.renderer.getContext(), e = this.renderer.getPixelRatio(), s = this.renderer.domElement.height / e, r = this.renderer.domElement, o = r.getBoundingClientRect().top, i = r.getBoundingClientRect().left, g = (n, a) => {
1239
1267
  if (a && a.width > 0 && a.height > 0) {
1240
- const u = Math.floor((a.x - o) * t), h = Math.floor(
1241
- (r - (a.y - c + a.height)) * t
1242
- ), d = Math.ceil(a.width * t), m = Math.ceil(a.height * t);
1243
- l.onBeforeRender = () => {
1244
- e.enable(e.SCISSOR_TEST), e.scissor(u, h, d, m);
1245
- }, l.onAfterRender = () => {
1246
- e.disable(e.SCISSOR_TEST);
1247
- }, l.__hasScissorHook = !0;
1268
+ const I = Math.floor((a.x - i) * e), c = Math.floor(
1269
+ (s - (a.y - o + a.height)) * e
1270
+ ), l = Math.ceil(a.width * e), B = Math.ceil(a.height * e);
1271
+ n.onBeforeRender = () => {
1272
+ A.enable(A.SCISSOR_TEST), A.scissor(I, c, l, 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 a = l, u = (h = a.userData) == null ? void 0 : h.scissorRect;
1256
- n(a, u), a.children.forEach((d) => {
1257
- d.name.startsWith("TEXT_CHILD") && n(d, u);
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((l) => {
1285
+ l.name.startsWith("TEXT_CHILD") && g(l, 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, r = this.renderer.getPixelRatio(), s = this.renderer.domElement.width / r, c = this.renderer.domElement.height / r;
1289
+ saveInitialLocals(A) {
1290
+ this.scene.children.forEach((e) => {
1291
+ const s = e;
1292
+ if (s.userData.wasmIndex !== void 0) {
1293
+ const r = s.userData.wasmIndex * tA;
1294
+ s.userData.initialLocalX = A[r + pA], s.userData.initialLocalY = A[r + mA];
1295
+ }
1296
+ });
1297
+ }
1298
+ syncMeshesByWasm(A) {
1299
+ const e = this.renderer.getPixelRatio(), s = this.renderer.domElement.width / e, r = this.renderer.domElement.height / e;
1263
1300
  this.scene.children.forEach((o) => {
1264
- var h, d;
1265
- const n = o;
1266
- if (!n.userData || !n.userData.domElement)
1301
+ const i = o;
1302
+ if (!i.userData || i.userData.wasmIndex === void 0)
1267
1303
  return;
1268
- const l = n.userData.domElement;
1269
- if (!l.isConnected)
1304
+ const n = i.userData.wasmIndex * tA, a = A[n + te], I = A[n + ie], c = i.userData.domRect;
1305
+ if (!c)
1270
1306
  return;
1271
- let a;
1272
- if (l.nodeType === Node.TEXT_NODE) {
1273
- const m = document.createRange();
1274
- m.selectNode(l), a = m.getBoundingClientRect();
1275
- } else
1276
- a = l.getBoundingClientRect();
1277
- const u = n.userData.domRect;
1278
- if (!u || Math.abs(a.x - u.x) > 0.5 || Math.abs(a.y - u.y) > 0.5 || Math.abs(a.width - u.width) > 0.5 || Math.abs(a.height - u.height) > 0.5) {
1279
- n.userData.domRect = {
1280
- x: a.x,
1281
- y: a.y,
1282
- width: a.width,
1283
- height: a.height
1284
- };
1285
- const m = n.userData.clipElements;
1286
- if (m && m.length > 0) {
1287
- let y = -1 / 0, E = -1 / 0, L = 1 / 0, C = 1 / 0;
1288
- for (const b of m) {
1289
- const x = b.getBoundingClientRect();
1290
- y = Math.max(y, x.left), E = Math.max(E, x.top), L = Math.min(L, x.right), C = Math.min(C, x.bottom);
1291
- }
1292
- n.userData.scissorRect = {
1293
- x: y,
1294
- y: E,
1295
- width: Math.max(0, L - y),
1296
- height: Math.max(0, C - E)
1297
- };
1298
- } else
1299
- n.userData.scissorRect = void 0;
1300
- let g, R;
1301
- if (this.isViewport)
1302
- g = a.x - window.innerWidth / 2 + a.width / 2, R = -a.y + window.innerHeight / 2 - a.height / 2;
1307
+ const l = this.fixedMeshes.has(i), B = l ? 0 : this.getScrollX(), C = l ? 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 + r / 2 - c.height / 2;
1315
+ }
1316
+ const b = i.position.z;
1317
+ if (i.position.set(w, Q, b), i.userData.nativeMesh) {
1318
+ const f = i.userData.nativeMesh;
1319
+ if (i.userData.needsNativeReset)
1320
+ i.userData.needsNativeReset = !1;
1303
1321
  else {
1304
- const y = a.x - e, E = a.y - t;
1305
- g = y - s / 2 + a.width / 2, R = -E + c / 2 - a.height / 2;
1306
- }
1307
- n.position.setX(g), n.position.setY(R);
1308
- let v = ((h = n.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1309
- if (n.scale.set(a.width + v * 2, a.height + v * 2, 1), n.updateMatrixWorld(), n.material instanceof w.ShaderMaterial && H.forceUpdateUniforms(n.material, {
1310
- width: a.width,
1311
- height: a.height
1312
- }), n.userData.nativeMesh) {
1313
- const y = n.userData.nativeMesh;
1314
- let E = a.width, L = a.height, C = g, b = R;
1315
- if (n.userData.nativeTransform) {
1316
- const X = n.userData.nativeTransform, Y = X.match(/scale\(([\d.]+%?)\)/);
1317
- if (Y) {
1318
- let M = parseFloat(Y[1]);
1319
- Y[1].includes("%") && (M /= 100), E *= M, L *= M;
1320
- }
1321
- const A = X.match(/scaleX\(([\d.]+%?)\)/);
1322
- if (A) {
1323
- let M = parseFloat(A[1]);
1324
- A[1].includes("%") && (M /= 100), E *= M;
1325
- }
1326
- const N = X.match(/scaleY\(([\d.]+%?)\)/);
1327
- if (N) {
1328
- let M = parseFloat(N[1]);
1329
- N[1].includes("%") && (M /= 100), L *= M;
1330
- }
1331
- const U = X.match(/translate\(([^,]+),\s*([^)]+)\)/);
1332
- if (U) {
1333
- const M = U[1].trim(), B = U[2].trim();
1334
- let Z = parseFloat(M);
1335
- M.includes("%") && (Z = Z / 100 * a.width);
1336
- let F = parseFloat(B);
1337
- B.includes("%") && (F = F / 100 * a.height), C += Z, b -= F;
1338
- }
1339
- const K = X.match(/translateX\(([^)]+)\)/);
1340
- if (K) {
1341
- const M = K[1].trim();
1342
- let B = parseFloat(M);
1343
- M.includes("%") && (B = B / 100 * a.width), C += B;
1344
- }
1345
- const J = X.match(/translateY\(([^)]+)\)/);
1346
- if (J) {
1347
- const M = J[1].trim();
1348
- let B = parseFloat(M);
1349
- M.includes("%") && (B = B / 100 * a.height), b -= B;
1350
- }
1351
- }
1352
- let x = ((d = y.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1353
- y.position.setX(C), y.position.setY(b), y.scale.set(E + x * 2, L + x * 2, 1), y.updateMatrixWorld(), y.material instanceof w.ShaderMaterial && H.forceUpdateUniforms(y.material, {
1354
- width: E,
1355
- height: L
1356
- });
1322
+ const y = w - i.userData.basePosition.x, U = Q - i.userData.basePosition.y;
1323
+ f.position.setX(f.position.x + y), f.position.setY(f.position.y + U);
1357
1324
  }
1358
1325
  }
1326
+ i.userData.basePosition.x = w, i.userData.basePosition.y = Q;
1359
1327
  });
1360
1328
  }
1361
1329
  }
1362
- function ct(i) {
1363
- const e = i.textContent || "", t = [];
1364
- let r = "", s = null, c = -1;
1365
- const o = (a, u) => {
1366
- for (let h = 0; h < a.length; h++) {
1367
- const d = a[h], m = document.createRange();
1368
- m.setStart(i, u + h), m.setEnd(i, u + h + 1);
1369
- const g = m.getBoundingClientRect();
1370
- if (g.width === 0 && g.height === 0) {
1371
- r += d;
1330
+ function Fe(t) {
1331
+ const A = t.textContent || "", e = [];
1332
+ let s = "", r = null, o = -1;
1333
+ const i = (a, I) => {
1334
+ for (let c = 0; c < a.length; c++) {
1335
+ const l = 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 += l;
1372
1340
  continue;
1373
1341
  }
1374
- c === -1 || Math.abs(g.top - c) > g.height / 2 ? (r && s && t.push({
1375
- text: r,
1342
+ o === -1 || Math.abs(C.top - o) > C.height / 2 ? (s && r && e.push({
1343
+ text: s,
1376
1344
  rect: {
1377
- left: s.left,
1378
- top: s.top,
1379
- width: s.right - s.left,
1380
- height: s.bottom - s.top
1345
+ left: r.left,
1346
+ top: r.top,
1347
+ width: r.right - r.left,
1348
+ height: r.bottom - r.top
1381
1349
  }
1382
- }), r = d, s = {
1383
- left: g.left,
1384
- top: g.top,
1385
- right: g.right,
1386
- bottom: g.bottom
1387
- }, c = g.top) : (r += d, s && (s.left = Math.min(s.left, g.left), s.top = Math.min(s.top, g.top), s.right = Math.max(s.right, g.right), s.bottom = Math.max(
1388
- s.bottom,
1389
- g.bottom
1350
+ }), s = l, r = {
1351
+ left: C.left,
1352
+ top: C.top,
1353
+ right: C.right,
1354
+ bottom: C.bottom
1355
+ }, o = C.top) : (s += l, r && (r.left = Math.min(r.left, C.left), r.top = Math.min(r.top, C.top), r.right = Math.max(r.right, C.right), r.bottom = Math.max(
1356
+ r.bottom,
1357
+ C.bottom
1390
1358
  )));
1391
1359
  }
1392
- }, n = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1393
- let l = 0;
1394
- for (const a of n) {
1395
- const u = document.createRange();
1396
- u.setStart(i, l), u.setEnd(i, l + a.length);
1397
- const h = u.getClientRects();
1398
- if (h.length > 1)
1399
- o(a, 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
+ i(a, n);
1400
1368
  else {
1401
- const d = h.length === 1 ? h[0] : u.getBoundingClientRect();
1402
- if (d.width === 0 && d.height === 0) {
1403
- r += a, l += a.length;
1369
+ const l = c.length === 1 ? c[0] : I.getBoundingClientRect();
1370
+ if (l.width === 0 && l.height === 0) {
1371
+ s += a, n += a.length;
1404
1372
  continue;
1405
1373
  }
1406
- c === -1 || Math.abs(d.top - c) > d.height / 2 ? (r && s && t.push({
1407
- text: r,
1374
+ o === -1 || Math.abs(l.top - o) > l.height / 2 ? (s && r && e.push({
1375
+ text: s,
1408
1376
  rect: {
1409
- left: s.left,
1410
- top: s.top,
1411
- width: s.right - s.left,
1412
- height: s.bottom - s.top
1377
+ left: r.left,
1378
+ top: r.top,
1379
+ width: r.right - r.left,
1380
+ height: r.bottom - r.top
1413
1381
  }
1414
- }), r = a, s = {
1415
- left: d.left,
1416
- top: d.top,
1417
- right: d.right,
1418
- bottom: d.bottom
1419
- }, c = d.top) : (r += a, s && (s.left = Math.min(s.left, d.left), s.top = Math.min(s.top, d.top), s.right = Math.max(s.right, d.right), s.bottom = Math.max(
1420
- s.bottom,
1421
- d.bottom
1382
+ }), s = a, r = {
1383
+ left: l.left,
1384
+ top: l.top,
1385
+ right: l.right,
1386
+ bottom: l.bottom
1387
+ }, o = l.top) : (s += a, r && (r.left = Math.min(r.left, l.left), r.top = Math.min(r.top, l.top), r.right = Math.max(r.right, l.right), r.bottom = Math.max(
1388
+ r.bottom,
1389
+ l.bottom
1422
1390
  )));
1423
1391
  }
1424
- l += a.length;
1392
+ n += a.length;
1425
1393
  }
1426
- return r && s && t.push({
1427
- text: r,
1394
+ return s && r && e.push({
1395
+ text: s,
1428
1396
  rect: {
1429
- left: s.left,
1430
- top: s.top,
1431
- width: s.right - s.left,
1432
- height: s.bottom - s.top
1397
+ left: r.left,
1398
+ top: r.top,
1399
+ width: r.right - r.left,
1400
+ height: r.bottom - r.top
1433
1401
  }
1434
- }), t.filter(
1402
+ }), e.filter(
1435
1403
  (a) => a.text.trim().length > 0 && a.rect.width > 0 && a.rect.height > 0
1436
1404
  );
1437
1405
  }
1438
- function Ue(i) {
1439
- const e = parseFloat(i.fontSize);
1440
- let t = parseFloat(i.lineHeight);
1441
- isNaN(t) && (t = e * 1.2);
1442
- let r = parseFloat(i.letterSpacing);
1443
- return isNaN(r) && (r = 0), {
1444
- font: `${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`,
1445
- fontSize: i.fontSize,
1446
- color: i.color,
1447
- textAlign: i.textAlign || "start",
1406
+ function Ae(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: i.direction || "inherit",
1450
- lineHeight: t,
1451
- letterSpacing: r
1417
+ direction: t.direction || "inherit",
1418
+ lineHeight: e,
1419
+ letterSpacing: s
1452
1420
  };
1453
1421
  }
1454
- function Xe(i, e = ie | fe | qe | Se | me, t, r = 1, s = 0, c = 2, o, n, l) {
1455
- var F, W, se, oe, ae, he, de;
1456
- if (i.nodeType === Node.TEXT_NODE) {
1457
- const f = i;
1458
- if (!f.textContent || !f.textContent.trim())
1422
+ function ne(t, A = nA | fA | Qe | TA | SA, e, s = 1, r = 0, o = 2, i, g, n, a, I = -1, c = 0, l = 0, B = !1) {
1423
+ var kA, UA, XA, HA, 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 E = t;
1427
+ if (!E.textContent || !E.textContent.trim())
1459
1428
  return null;
1460
- const S = f.textContent.replace(/\s+/g, " ");
1461
- if (S.length === 0)
1429
+ const R = E.textContent.replace(/\s+/g, " ");
1430
+ if (R.length === 0)
1462
1431
  return null;
1463
- const I = ct(f);
1464
- if (I.length === 0)
1432
+ const T = Fe(E);
1433
+ if (T.length === 0)
1465
1434
  return null;
1466
- const _ = f.parentElement, k = _ ? window.getComputedStyle(_) : null;
1467
- if (!k)
1435
+ const _ = E.parentElement, N = _ ? window.getComputedStyle(_) : null;
1436
+ if (!N)
1468
1437
  return null;
1469
- const P = Math.min(...I.map((T) => T.rect.left)), z = Math.min(...I.map((T) => T.rect.top)), Q = Math.max(...I.map((T) => T.rect.left + T.rect.width)), D = Math.max(...I.map((T) => T.rect.top + T.rect.height));
1438
+ const x = B || N.position === "fixed", k = Math.min(...T.map((p) => p.rect.left)), O = Math.min(...T.map((p) => p.rect.top)), v = Math.max(...T.map((p) => p.rect.left + p.rect.width)), W = Math.max(...T.map((p) => p.rect.top + p.rect.height)), V = k + (x ? 0 : C), QA = O + (x ? 0 : w);
1439
+ let sA = -1;
1440
+ if (a && a.sharedArray) {
1441
+ sA = a.currentIndex++;
1442
+ const p = sA * tA;
1443
+ a.sharedArray[p + LA] = I, a.sharedArray[p + pA] = V - c, a.sharedArray[p + mA] = QA - l;
1444
+ }
1470
1445
  return {
1471
1446
  id: Math.random().toString(36).substring(2, 9),
1472
1447
  type: "TEXT",
1473
- element: f,
1448
+ element: E,
1474
1449
  rect: {
1475
- x: P + window.scrollX,
1476
- y: z + window.scrollY,
1477
- width: Q - P,
1478
- height: D - z
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: _ && _.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(k.opacity),
1484
- zIndex: (isNaN(parseInt(k.zIndex)) ? 0 : parseInt(k.zIndex)) + s,
1458
+ opacity: _ && _.dataset[eA.KEY] === eA.VALUES.HIDE ? 1 : parseFloat(N.opacity),
1459
+ zIndex: (isNaN(parseInt(N.zIndex)) ? 0 : parseInt(N.zIndex)) + r,
1485
1460
  borderRadius: "0px",
1486
1461
  borderColor: "transparent",
1487
1462
  borderWidth: "0px",
1488
1463
  isTraveler: !1
1489
1464
  },
1490
- textContent: S,
1491
- textLines: I.map((T) => ({
1492
- text: T.text.trim(),
1465
+ textContent: R,
1466
+ textLines: T.map((p) => ({
1467
+ text: p.text.trim(),
1493
1468
  rect: {
1494
- x: T.rect.left + window.scrollX,
1495
- y: T.rect.top + window.scrollY,
1496
- width: T.rect.width,
1497
- height: T.rect.height
1469
+ x: p.rect.left + (x ? 0 : C),
1470
+ y: p.rect.top + (x ? 0 : w),
1471
+ width: p.rect.width,
1472
+ height: p.rect.height
1498
1473
  }
1499
1474
  })),
1500
- textStyles: Ue(k),
1501
- dirtyMask: e,
1502
- visibility: t,
1475
+ textStyles: Ae(N),
1476
+ dirtyMask: A,
1477
+ visibility: e,
1503
1478
  isTraveler: !1,
1504
- captureLayer: r,
1505
- isFixed: k.position === "fixed",
1506
- nativeLayer: o,
1507
- nativeStyles: n ? re(re({
1479
+ captureLayer: s,
1480
+ isFixed: x,
1481
+ nativeLayer: i,
1482
+ nativeStyles: g ? oA(oA({
1508
1483
  backgroundColor: "transparent",
1509
1484
  backgroundImage: "",
1510
- opacity: _ && _.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(k.opacity),
1511
- zIndex: (isNaN(parseInt(k.zIndex)) ? 0 : parseInt(k.zIndex)) + s,
1485
+ opacity: _ && _.dataset[eA.KEY] === eA.VALUES.HIDE ? 1 : parseFloat(N.opacity),
1486
+ zIndex: (isNaN(parseInt(N.zIndex)) ? 0 : parseInt(N.zIndex)) + r,
1512
1487
  borderRadius: "0px",
1513
1488
  borderColor: "transparent",
1514
1489
  borderWidth: "0px",
1515
1490
  isTraveler: !1
1516
- }, Ue(k)), n) : void 0,
1517
- nativeRect: n ? {
1518
- x: P + window.scrollX,
1519
- y: z + window.scrollY,
1520
- width: Q - P,
1521
- height: D - z
1491
+ }, Ae(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: sA !== -1 ? sA : void 0,
1524
1500
  children: []
1525
1501
  };
1526
1502
  }
1527
- if (i.nodeType !== Node.ELEMENT_NODE)
1503
+ if (t.nodeType !== Node.ELEMENT_NODE)
1528
1504
  return null;
1529
- const a = i, u = a.dataset[q.KEY];
1530
- let h = t, d = t;
1531
- if (u) {
1532
- const f = new Set(u.split(/\s+/));
1533
- for (const S of f)
1534
- if (!Ae.includes(S))
1505
+ const Q = t, b = Q.dataset[q.KEY];
1506
+ let f = e, y = e;
1507
+ if (b) {
1508
+ const E = new Set(b.split(/\s+/));
1509
+ for (const R of E)
1510
+ if (!ZA.includes(R))
1535
1511
  throw new Error(
1536
- `[MirageEngine] Invalid filter token: '${S}'. 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 (f.has(q.VALUES.END))
1514
+ if (E.has(q.VALUES.END))
1539
1515
  return null;
1540
- if (f.has(q.VALUES.INCLUDE_TREE) && f.has(q.VALUES.EXCLUDE_TREE))
1516
+ if (E.has(q.VALUES.INCLUDE_TREE) && E.has(q.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 (f.has(q.VALUES.INCLUDE_SELF) && f.has(q.VALUES.EXCLUDE_SELF))
1520
+ if (E.has(q.VALUES.INCLUDE_SELF) && E.has(q.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
- f.has(q.VALUES.INCLUDE_TREE) ? h = h | $ : f.has(q.VALUES.EXCLUDE_TREE) && (h = h & ~$), d = h, f.has(q.VALUES.INCLUDE_SELF) ? d = d | $ : f.has(q.VALUES.EXCLUDE_SELF) && (d = d & ~$);
1524
+ E.has(q.VALUES.INCLUDE_TREE) ? f = f | j : E.has(q.VALUES.EXCLUDE_TREE) && (f = f & ~j), y = f, E.has(q.VALUES.INCLUDE_SELF) ? y = y | j : E.has(q.VALUES.EXCLUDE_SELF) && (y = y & ~j);
1549
1525
  }
1550
- const m = a.dataset[j.KEY];
1551
- if (m) {
1552
- const f = new Set(m.split(/\s+/));
1553
- for (const S of f)
1554
- if (!Ae.includes(S))
1526
+ const U = Q.dataset[Z.KEY];
1527
+ if (U) {
1528
+ const E = new Set(U.split(/\s+/));
1529
+ for (const R of E)
1530
+ if (!ZA.includes(R))
1555
1531
  throw new Error(
1556
- `[MirageEngine] Invalid select token: '${S}'. 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 (f.has(j.VALUES.END))
1534
+ if (E.has(Z.VALUES.END))
1559
1535
  return null;
1560
- if (f.has(j.VALUES.INCLUDE_TREE) && f.has(j.VALUES.EXCLUDE_TREE))
1536
+ if (E.has(Z.VALUES.INCLUDE_TREE) && E.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 (f.has(j.VALUES.INCLUDE_SELF) && f.has(j.VALUES.EXCLUDE_SELF))
1540
+ if (E.has(Z.VALUES.INCLUDE_SELF) && E.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
- f.has(j.VALUES.INCLUDE_TREE) ? h = h | ne : f.has(j.VALUES.EXCLUDE_TREE) && (h = h & ~ne), d = h, f.has(j.VALUES.INCLUDE_SELF) ? d = d | ne : f.has(j.VALUES.EXCLUDE_SELF) && (d = d & ~ne);
1569
- }
1570
- const g = a.dataset[V.KEY];
1571
- let R = !1, v = n ? re({}, n) : {}, y = o;
1572
- if (g) {
1573
- let f = 1;
1574
- const S = g.indexOf("{"), I = g.lastIndexOf("}");
1575
- let _ = g;
1576
- if (S !== -1 && I !== -1 && I > S) {
1577
- _ = g.substring(0, S).trim();
1578
- const D = g.substring(S, I + 1);
1544
+ E.has(Z.VALUES.INCLUDE_TREE) ? f = f | lA : E.has(Z.VALUES.EXCLUDE_TREE) && (f = f & ~lA), y = f, E.has(Z.VALUES.INCLUDE_SELF) ? y = y | lA : E.has(Z.VALUES.EXCLUDE_SELF) && (y = y & ~lA);
1545
+ }
1546
+ const S = Q.dataset[X.KEY];
1547
+ let D = !1, u = g ? oA({}, g) : {}, Y = i;
1548
+ if (S) {
1549
+ let E = 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
- v = new Function("return " + D)();
1581
- } catch (T) {
1556
+ u = new Function("return " + v)();
1557
+ } catch (W) {
1582
1558
  console.warn(
1583
- `[MirageEngine] Failed to parse travel styles JSON: ${D}`
1559
+ `[MirageEngine] Failed to parse travel styles JSON: ${v}`
1584
1560
  );
1585
1561
  }
1586
1562
  }
1587
- const k = _.split(/\s+/);
1588
- let P = !1;
1589
- const z = k.indexOf(V.VALUES.TRAVELER);
1590
- if (z !== -1) {
1591
- R = !0, P = !0;
1592
- const D = k[z + 1];
1593
- if (D && !isNaN(parseInt(D, 10)))
1594
- f = parseInt(D, 10);
1563
+ const N = _.split(/\s+/);
1564
+ let x = !1;
1565
+ const k = N.indexOf(X.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
+ E = parseInt(v, 10);
1595
1571
  else {
1596
- const T = k.find((ee) => !isNaN(parseInt(ee, 10)));
1597
- T && (f = parseInt(T, 10));
1572
+ const W = N.find((V) => !isNaN(parseInt(V, 10)));
1573
+ W && (E = parseInt(W, 10));
1598
1574
  }
1599
1575
  }
1600
- const Q = k.indexOf(V.VALUES.NATIVE);
1601
- if (Q !== -1) {
1602
- const D = k[Q + 1];
1603
- if (D && !isNaN(parseInt(D, 10)))
1604
- y = parseInt(D, 10);
1605
- else if (!R) {
1606
- const T = k.find((ee) => !isNaN(parseInt(ee, 10)));
1607
- T && (y = parseInt(T, 10));
1576
+ const O = N.indexOf(X.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 (P) {
1611
- const D = f + 1;
1612
- if (D < r)
1586
+ if (x) {
1587
+ const v = E + 1;
1588
+ if (v < s)
1613
1589
  throw new Error(
1614
- `[MirageEngine] Traveler layer (${f}) cannot be smaller than inherited capture layer (${r - 1}).`
1590
+ `[MirageEngine] Traveler layer (${E}) cannot be smaller than inherited capture layer (${s - 1}).`
1615
1591
  );
1616
- r = Math.min(D, V.MAX_LAYERS + 1);
1592
+ s = Math.min(v, X.MAX_LAYERS + 1);
1617
1593
  }
1618
1594
  }
1619
- const E = a.dataset[Ge.KEY];
1620
- let L;
1621
- E && (L = JSON.parse(E));
1622
- const C = a.getBoundingClientRect(), b = window.getComputedStyle(a);
1623
- if (C.width === 0 || C.height === 0 || b.display === "none")
1595
+ const gA = Q.dataset[de.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 x = a.getAttribute("data-mid");
1626
- x || (x = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", x));
1627
- const X = parseInt(b.zIndex), Y = (isNaN(X) ? 0 : X) + s;
1628
- let A, N;
1629
- if (a.tagName === "IMG")
1630
- A = a.src;
1631
- else if (a.tagName.toLowerCase() === "svg") {
1632
- const f = v == null ? void 0 : v.color, S = v == null ? void 0 : v.fill, I = v == null ? void 0 : v.stroke, _ = v == null ? void 0 : v.opacity, k = (P) => {
1633
- const z = a.cloneNode(!0), Q = (ve, Ce) => {
1634
- const G = window.getComputedStyle(ve), ue = Ce, Ne = G.fill === G.color, ze = G.stroke === G.color, we = (P ? S || (Ne ? f : void 0) : void 0) || G.fill;
1635
- we && we !== "none" && (ue.style.fill = we);
1636
- const be = (P ? I || (ze ? f : void 0) : void 0) || G.stroke;
1637
- be && be !== "none" && (ue.style.stroke = be), G.strokeWidth && G.strokeWidth !== "0px" && (ue.style.strokeWidth = G.strokeWidth);
1638
- const Te = (P ? f : void 0) || G.color;
1639
- Te && (ue.style.color = Te);
1640
- const ye = (P ? _ : void 0) || G.opacity;
1641
- ye && ye !== "1" && (ue.style.opacity = ye);
1642
- for (let ge = 0; ge < ve.children.length; ge++)
1643
- Q(ve.children[ge], Ce.children[ge]);
1601
+ const P = B || M.position === "fixed", BA = F.left + (P ? 0 : C), H = F.top + (P ? 0 : w);
1602
+ let G = -1;
1603
+ if (a && a.sharedArray) {
1604
+ G = a.currentIndex++;
1605
+ const E = G * tA;
1606
+ a.sharedArray[E + LA] = I, a.sharedArray[E + pA] = BA - c, a.sharedArray[E + mA] = H - l;
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), iA = (isNaN(IA) ? 0 : IA) + r;
1611
+ let AA, rA;
1612
+ if (Q.tagName === "IMG")
1613
+ AA = Q.src;
1614
+ else if (Q.tagName.toLowerCase() === "svg") {
1615
+ const E = 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, sA) => {
1617
+ const p = window.getComputedStyle(QA), uA = sA, ce = p.fill === p.color, Ie = p.stroke === p.color, bA = (x ? R || (ce ? E : void 0) : void 0) || p.fill;
1618
+ bA && bA !== "none" && (uA.style.fill = bA);
1619
+ const NA = (x ? T || (Ie ? E : void 0) : void 0) || p.stroke;
1620
+ NA && NA !== "none" && (uA.style.stroke = NA), p.strokeWidth && p.strokeWidth !== "0px" && (uA.style.strokeWidth = p.strokeWidth);
1621
+ const OA = (x ? E : void 0) || p.color;
1622
+ OA && (uA.style.color = OA);
1623
+ const MA = (x ? _ : void 0) || p.opacity;
1624
+ MA && MA !== "1" && (uA.style.opacity = MA);
1625
+ for (let yA = 0; yA < QA.children.length; yA++)
1626
+ O(QA.children[yA], sA.children[yA]);
1644
1627
  };
1645
- Q(a, z);
1646
- const D = a.getBoundingClientRect(), T = window.devicePixelRatio * c;
1647
- z.hasAttribute("viewBox") || z.setAttribute("viewBox", `0 0 ${D.width} ${D.height}`), z.setAttribute("width", (D.width * T).toString()), z.setAttribute("height", (D.height * T).toString());
1648
- let ee = new XMLSerializer().serializeToString(z);
1649
- return ee.includes("xmlns=") || (ee = ee.replace(
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(
1650
1633
  "<svg",
1651
1634
  '<svg xmlns="http://www.w3.org/2000/svg"'
1652
- )), `data:image/svg+xml;utf8,${encodeURIComponent(ee)}`;
1635
+ )), `data:image/svg+xml;utf8,${encodeURIComponent(V)}`;
1653
1636
  };
1654
- A = k(!1), y !== void 0 && (f || S || I || _) && (N = k(!0));
1655
- } else if (b.backgroundImage && b.backgroundImage !== "none") {
1656
- const f = b.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1657
- f && (A = f[1]);
1658
- }
1659
- const U = {
1660
- backgroundColor: b.backgroundColor,
1661
- backgroundImage: b.backgroundImage,
1662
- opacity: a.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(b.opacity),
1663
- zIndex: Y,
1664
- borderRadius: b.borderRadius,
1665
- borderColor: b.borderColor,
1666
- borderWidth: b.borderWidth,
1667
- boxShadow: b.boxShadow,
1668
- imageSrc: A,
1669
- isTraveler: R
1670
- }, K = U;
1671
- let J, M;
1672
- const B = [], Z = b.overflow === "hidden" ? [...l || [], a] : l;
1673
- return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((f) => {
1674
- const S = f.nodeType === Node.TEXT_NODE ? d : h, I = Xe(
1675
- f,
1676
- e,
1677
- S,
1678
- r,
1679
- Y,
1680
- c,
1681
- f.nodeType === Node.TEXT_NODE ? y : void 0,
1682
- f.nodeType === Node.TEXT_NODE && Object.keys(v).length > 0 ? v : void 0,
1683
- Z
1637
+ AA = N(!1), Y !== void 0 && (E || R || T || _) && (rA = N(!0));
1638
+ } else if (M.backgroundImage && M.backgroundImage !== "none") {
1639
+ const E = M.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1640
+ E && (AA = E[1]);
1641
+ }
1642
+ const m = {
1643
+ backgroundColor: M.backgroundColor,
1644
+ backgroundImage: M.backgroundImage,
1645
+ opacity: Q.dataset[eA.KEY] === eA.VALUES.HIDE ? 1 : parseFloat(M.opacity),
1646
+ zIndex: iA,
1647
+ borderRadius: M.borderRadius,
1648
+ borderColor: M.borderColor,
1649
+ borderWidth: M.borderWidth,
1650
+ boxShadow: M.boxShadow,
1651
+ imageSrc: AA,
1652
+ isTraveler: D
1653
+ }, z = m;
1654
+ let EA, dA;
1655
+ const GA = [], ge = M.overflow === "hidden" ? [...n || [], Q] : n;
1656
+ return Q.tagName.toLowerCase() !== "svg" && Array.from(Q.childNodes).forEach((E) => {
1657
+ const R = E.nodeType === Node.TEXT_NODE ? y : f, T = ne(
1658
+ E,
1659
+ A,
1660
+ R,
1661
+ s,
1662
+ iA,
1663
+ o,
1664
+ E.nodeType === Node.TEXT_NODE ? Y : void 0,
1665
+ E.nodeType === Node.TEXT_NODE && Object.keys(u).length > 0 ? u : void 0,
1666
+ ge,
1667
+ a,
1668
+ G,
1669
+ BA,
1670
+ H,
1671
+ P
1684
1672
  );
1685
- I && B.push(I);
1673
+ T && GA.push(T);
1686
1674
  }), {
1687
- id: x,
1675
+ id: $,
1688
1676
  type: "BOX",
1689
- element: a,
1677
+ element: Q,
1690
1678
  rect: {
1691
- x: C.left + window.scrollX,
1692
- y: C.top + window.scrollY,
1693
- width: C.width,
1694
- height: C.height
1679
+ x: F.left + C,
1680
+ y: F.top + w,
1681
+ width: F.width,
1682
+ height: F.height
1695
1683
  },
1696
- styles: K,
1697
- textContent: J,
1698
- textStyles: M,
1699
- dirtyMask: e,
1700
- visibility: d,
1701
- isTraveler: R,
1702
- captureLayer: r,
1703
- nativeLayer: y,
1704
- nativeStyles: y !== void 0 ? Me(re({}, U), {
1705
- backgroundColor: (F = v.backgroundColor) != null ? F : U.backgroundColor,
1706
- backgroundImage: (W = v.backgroundImage) != null ? W : U.backgroundImage,
1707
- opacity: (se = v.opacity) != null ? se : U.opacity,
1708
- zIndex: v.zIndex !== void 0 ? v.zIndex + Y : U.zIndex,
1709
- borderRadius: (oe = v.borderRadius) != null ? oe : U.borderRadius,
1710
- borderColor: (ae = v.borderColor) != null ? ae : U.borderColor,
1711
- borderWidth: (he = v.borderWidth) != null ? he : U.borderWidth,
1712
- boxShadow: (de = v.boxShadow) != null ? de : U.boxShadow,
1713
- isTraveler: U.isTraveler,
1714
- transform: v.transform,
1715
- imageSrc: N != null ? N : A
1684
+ styles: z,
1685
+ textContent: EA,
1686
+ textStyles: dA,
1687
+ dirtyMask: A,
1688
+ visibility: y,
1689
+ isTraveler: D,
1690
+ captureLayer: s,
1691
+ nativeLayer: Y,
1692
+ nativeStyles: Y !== void 0 ? jA(oA({}, m), {
1693
+ backgroundColor: (XA = u.backgroundColor) != null ? XA : m.backgroundColor,
1694
+ backgroundImage: (HA = u.backgroundImage) != null ? HA : m.backgroundImage,
1695
+ opacity: (JA = u.opacity) != null ? JA : m.opacity,
1696
+ zIndex: u.zIndex !== void 0 ? u.zIndex + iA : m.zIndex,
1697
+ borderRadius: (zA = u.borderRadius) != null ? zA : m.borderRadius,
1698
+ borderColor: (_A = u.borderColor) != null ? _A : m.borderColor,
1699
+ borderWidth: (WA = u.borderWidth) != null ? WA : m.borderWidth,
1700
+ boxShadow: (KA = u.boxShadow) != null ? KA : m.boxShadow,
1701
+ isTraveler: m.isTraveler,
1702
+ transform: u.transform,
1703
+ imageSrc: rA != null ? rA : AA
1716
1704
  }) : void 0,
1717
- nativeRect: y !== void 0 ? {
1718
- x: v.x !== void 0 ? parseFloat(v.x) : C.left + window.scrollX,
1719
- y: v.y !== void 0 ? parseFloat(v.y) : C.top + window.scrollY,
1720
- width: v.width !== void 0 ? parseFloat(v.width) : C.width,
1721
- height: v.height !== void 0 ? parseFloat(v.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
1722
1710
  } : void 0,
1723
- isFixed: b.position === "fixed",
1724
- clipElements: l,
1725
- children: B,
1726
- shaderHooks: L
1711
+ isFixed: P,
1712
+ clipElements: n,
1713
+ wasmIndex: G !== -1 ? G : void 0,
1714
+ children: GA,
1715
+ shaderHooks: cA
1727
1716
  };
1728
1717
  }
1729
- function ht(i, e) {
1730
- e.size !== 0 && e.forEach((t, r) => {
1731
- var c, o, n, l;
1732
- const s = i.get(r);
1733
- !s || !s.userData.basePosition || (H.forceUpdateUniforms(s.material, {
1734
- backgroundColor: t.backgroundColor,
1735
- backgroundImage: t.backgroundImage,
1736
- boxShadow: t.boxShadow,
1737
- opacity: t.opacity,
1738
- borderRadius: (o = t.borderRadius) != null ? o : (c = s.userData.baseStyles) == null ? void 0 : c.borderRadius
1739
- // width and height are no longer updated here, they are updated in syncMeshesByDOM
1740
- }), s.userData.nativeMesh && H.forceUpdateUniforms(s.userData.nativeMesh.material, {
1741
- backgroundColor: t.backgroundColor,
1742
- backgroundImage: t.backgroundImage,
1743
- boxShadow: t.boxShadow,
1744
- opacity: t.opacity,
1745
- borderRadius: (l = t.borderRadius) != null ? l : (n = s.userData.baseStyles) == null ? void 0 : n.borderRadius
1746
- }));
1718
+ function Te(t, A, e) {
1719
+ if (A.size === 0)
1720
+ return;
1721
+ const s = /* @__PURE__ */ new Set();
1722
+ A.forEach((r, o) => {
1723
+ var g, n, a, I;
1724
+ const i = t.get(o);
1725
+ if (!(!i || !i.userData.basePosition)) {
1726
+ if (K.forceUpdateUniforms(i.material, {
1727
+ backgroundColor: r.backgroundColor,
1728
+ backgroundImage: r.backgroundImage,
1729
+ boxShadow: r.boxShadow,
1730
+ opacity: r.opacity,
1731
+ borderRadius: (n = r.borderRadius) != null ? n : (g = i.userData.baseStyles) == null ? void 0 : g.borderRadius
1732
+ }), i.userData.nativeMesh && (K.forceUpdateUniforms(i.userData.nativeMesh.material, {
1733
+ backgroundColor: r.backgroundColor,
1734
+ backgroundImage: r.backgroundImage,
1735
+ boxShadow: r.boxShadow,
1736
+ opacity: r.opacity,
1737
+ borderRadius: (I = r.borderRadius) != null ? I : (a = i.userData.baseStyles) == null ? void 0 : a.borderRadius
1738
+ }), r.scaleX !== void 0 || r.scaleY !== void 0)) {
1739
+ const c = i.userData.nativeMesh, l = c.scale.x, B = c.scale.y, C = c.scale.z;
1740
+ c.scale.set(
1741
+ r.scaleX !== void 0 ? r.scaleX * l : l,
1742
+ r.scaleY !== void 0 ? r.scaleY * B : B,
1743
+ r.scaleZ !== void 0 ? r.scaleZ * C : C
1744
+ );
1745
+ }
1746
+ if (r.layoutChanged || r.width !== void 0 || r.height !== void 0) {
1747
+ s.add(o);
1748
+ const c = o.querySelectorAll("*");
1749
+ for (let l = 0; l < c.length; l++) {
1750
+ const B = c[l];
1751
+ t.has(B) && s.add(B);
1752
+ }
1753
+ } else if ((r.x !== void 0 || r.y !== void 0) && e && i.userData.wasmIndex !== void 0) {
1754
+ const c = i.userData.wasmIndex * tA;
1755
+ r.x !== void 0 && i.userData.initialLocalX !== void 0 && (e[c + pA] = i.userData.initialLocalX + r.x), r.y !== void 0 && i.userData.initialLocalY !== void 0 && (e[c + mA] = i.userData.initialLocalY + r.y);
1756
+ }
1757
+ }
1758
+ }), s.forEach((r) => {
1759
+ var n, a;
1760
+ const o = t.get(r);
1761
+ if (!o)
1762
+ return;
1763
+ const i = r.getBoundingClientRect();
1764
+ o.userData.domRect && (o.userData.domRect.width = i.width, o.userData.domRect.height = i.height);
1765
+ let g = ((n = o.material.userData) == null ? void 0 : n.shadowPadding) || 0;
1766
+ if (o.scale.set(i.width + g * 2, i.height + g * 2, 1), K.forceUpdateUniforms(o.material, {
1767
+ width: i.width,
1768
+ height: i.height
1769
+ }), e && o.userData.wasmIndex !== void 0) {
1770
+ const I = o.userData.wasmIndex * tA, c = i.left + (o.userData.isFixed ? 0 : window.scrollX), l = i.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 * tA;
1774
+ C = e[Q + te], w = e[Q + ie];
1775
+ }
1776
+ e[I + pA] = c - C, e[I + mA] = l - 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(i.width + c * 2, i.height + c * 2, 1), K.forceUpdateUniforms(I.material, {
1782
+ width: i.width,
1783
+ height: i.height
1784
+ }), o.userData.nativeRect && (o.userData.nativeRect.width = i.width, o.userData.nativeRect.height = i.height);
1785
+ }
1747
1786
  });
1748
1787
  }
1749
- class dt {
1750
- constructor(e, t, r, s) {
1751
- p(this, "target");
1752
- p(this, "renderer");
1753
- p(this, "registry");
1754
- p(this, "isTravelEnabled", !1);
1755
- p(this, "tracker");
1756
- this.target = e, this.renderer = t, this.registry = r, this.tracker = new Ke(e, {
1757
- resizeDebounce: s.resizeDebounce
1758
- }), this.tracker.onLayoutChange.add((c, o) => {
1759
- document.querySelector(`[${V.NAME}~='${V.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1760
- const l = Xe(
1788
+ class FA {
1789
+ __destroy_into_raw() {
1790
+ const A = this.__wbg_ptr;
1791
+ return this.__wbg_ptr = 0, ee.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, ee.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 Ye() {
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(Ge(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 ee = typeof FinalizationRegistry == "undefined" ? { register: () => {
1840
+ }, unregister: () => {
1841
+ } } : new FinalizationRegistry((t) => J.__wbg_memorymanager_free(t, 1));
1842
+ function Ge(t, A) {
1843
+ return Xe(t >>> 0, A);
1844
+ }
1845
+ let wA = null;
1846
+ function ke() {
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 Ue = 2146435072;
1852
+ let xA = 0;
1853
+ function Xe(t, A) {
1854
+ return xA += A, xA >= Ue && (vA = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), vA.decode(), xA = A), vA.decode(ke().subarray(t, t + A));
1855
+ }
1856
+ let J;
1857
+ function He(t, A) {
1858
+ return J = t.exports, wA = null, J.__wbindgen_start(), J;
1859
+ }
1860
+ function Je(t, A) {
1861
+ return aA(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 (r) {
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", r);
1871
+ else
1872
+ throw r;
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 ze(t) {
1892
+ return aA(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/f38AAncCFC4vd2FzbV9jb21wdXRlX2JnLmpzJ19fd2JnX19fd2Jp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ADAELIAUgACABKAIYEQAAAAtB8InAAEHwicAAKAIAIgBBAWs2AgAgAEEATA0CQeiJwABBADoAACADDQMLAAsjAEEQayIAJAAgAEEcNgIEIABByIbAADYCACAAIACtQoCAgICwAoQ3AwhBtYDAACAAQQhqQeSGwAAQFwALQZSHwABBzQBBvIfAABAXAAsAC74BAQN/IwBBEGsiAiQAAkACQAJAIAFFBEAgAEUNASAAQQhrIgEoAgBBAUcNAiAAKAIIIAAoAgQhAyABQQA2AgACQCABQX9GDQAgAEEEayIAIAAoAgBBAWsiADYCACAADQAgAUEYQQQQJAsgA0UNAyADQQJ0QQQQJAwDCyAARQ0AIABBCGsiACAAKAIAQQFrIgE2AgAgAiAANgIMIAENAiACQQxqEBMMAgsQKAALQayDwABBPxAnAAsgAkEQaiQAC8MBAQR/AkACQCAAQf////8DSyAAQQJ0IgNB/P///wdLcg0AAn8gA0UEQEEEIQJBAAwBC0EEIQEgA0EEECYiAkUNASAACyEEIAIhAQJAAkACQCAADgICAQALIANBBGsiAQRAIAJBACAB/AsACyABIAJqIQELIAFBADYCAAtBGEEEECYiAUUNASABIAA2AhQgASACNgIQIAEgBDYCDCABQQA2AgggAUKBgICAEDcCACABQQhqDwsgASADEBwAC0EEQRgQKwAL4gECAn8BfiMAQSBrIgIkACABKAIAQX9GBEAgASgCDCEDIAJBADYCGCACQoCAgIAQNwIQIAJBEGpB2ITAACADKAIAIgMoAgAgAygCBBAEGiACIAIoAhgiAzYCCCACIAIpAhAiBDcDACABIAM2AgggASAENwIACyABKAIIIQMgAUEANgIIIAEpAgAhBCABQoCAgIAQNwIAIAIgAzYCGCACIAQ3AxBBDEEEECYiAUUEQEEEQQwQKwALIAEgAigCGDYCCCABIAIpAxA3AgAgAEGEh8AANgIEIAAgATYCACACQSBqJAAL4wcCC38BfiMAQRBrIgkkACACIAEgAmoiBUsEQEEAQQAQHAALIAlBBGohCyAAKAIEIQpBASEMQQQhAQJAQQggBSAAKAIAIgJBAXQiBiAFIAZLGyIFIAV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ALIAE2AgRBACEMC0EIIQELIAEgC2ogBTYCACALIAw2AgAgCSgCBEEBRgRAIAkoAgggCSgCDBAcAAsgCSgCCCEBIAAgDTYCACAAIAE2AgQgCUEQaiQAC6QEAgl/A30jAEEQayIFJAACQAJAIAAEQCAAQQhrIgYgBigCAEEBaiICNgIAIAJFDQEgACgCAA0CIABBfzYCACAFIAY2AgwgBSAANgIIIAUgAEEEaiIENgIEIAEEQCAEKAIIIQIgBCgCBCIJIQQDQAJAAkACQAJAAkACQAJAAkAgAiADQQFqSwRAIANBAmogAk8NASACIANNDQIgBEEEaioCACEMIARBCGoqAgAhDSAEKgIAIgtDAAAAAGBFBEAgA0EDaiACTw0EIARBDGogDDgCACADQQRqIAJPDQUgBEEQaiANOAIADAkLIAv8AUEFbCIHQQNqIgggAk8NBSAHQQRqIgcgAk8NBiACIANBA2oiCk0EQCAKIAJBjIPAABASAAsgCSAHQQJ0aioCACELIARBDGogDCAJIAhBAnRqKgIAkjgCACADQQRqIgggAkkNByAIIAJBnIPAABASAAsgA0EBaiACQZyCwAAQEgALIANBAmogAkGsgsAAEBIACyADIAJBvILAABASAAsgA0EDaiACQcyCwAAQEgALIANBBGogAkHcgsAAEBIACyAIIAJB7ILAABASAAsgByACQfyCwAAQEgALIARBEGogDSALkjgCAAsgBEEUaiEEIANBBWohAyABQQFrIgENAAsLIAAgACgCAEEBajYCACAGIAYoAgBBAWsiADYCACAARQRAIAVBDGoQEwsgBUEQaiQADwsQKAsACxApAAuNAQICfwF+IwBBIGsiAiQAIAEoAgBBf0YEQCABKAIMIQMgAkEANgIcIAJCgICAgBA3AhQgAkEUakHYhMAAIAMoAgAiAygCACADKAIEEAQaIAIgAigCHCIDNgIQIAIgAikCFCIENwMIIAEgAzYCCCABIAQ3AgALIABBhIfAADYCBCAAIAE2AgAgAkEgaiQAC1QBAX8CQAJAIAAoAgAgACgCCCIDayACSQRAIAAgAyACEA4gACgCCCEDDAELIAJFDQELIAJFDQAgACgCBCADaiABIAL8CgA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0NTU1NjU3NTg1OTYwNjE2MjYzNjQ2NTY2Njc2ODY5NzA3MTcyNzM3NDc1NzY3Nzc4Nzk4MDgxODI4Mzg0ODU4Njg3ODg4OTkwOTE5MjkzOTQ5NTk2OTc5ODk5AEG4icAACwUBAAAABAB8CXByb2R1Y2VycwIIbGFuZ3VhZ2UBBFJ1c3QADHByb2Nlc3NlZC1ieQMFcnVzdGMdMS45OC4xICg0OGEyMjljZWEgMjAyNi0wOS0wMSkGd2FscnVzBjAuMjYuNQx3YXNtLWJpbmRnZW4TMC4yLjEyOCAoMjQ2OTQ2ZmRkKQBrD3RhcmdldF9mZWF0dXJlcwYrD211dGFibGUtZ2xvYmFscysTbm9udHJhcHBpbmctZnB0b2ludCsLYnVsay1tZW1vcnkrCHNpZ24tZXh0Kw9yZWZlcmVuY2UtdHlwZXMrCm11bHRpdmFsdWU=", self.location));
1896
+ const A = Ye();
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 Je(yield t, A);
1899
+ return He(e);
1900
+ });
1901
+ }
1902
+ class _e {
1903
+ constructor() {
1904
+ h(this, "memoryManager", null);
1905
+ h(this, "sharedArray", null);
1906
+ h(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 aA(this, null, function* () {
1914
+ if (!this.isInitialized)
1915
+ try {
1916
+ const e = yield ze();
1917
+ this.memoryManager = new FA(A);
1918
+ const s = this.memoryManager.get_pointer(), r = this.memoryManager.get_length();
1919
+ this.sharedArray = new Float32Array(e.memory.buffer, s, r), 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 We {
1935
+ constructor(A, e, s, r) {
1936
+ h(this, "target");
1937
+ h(this, "renderer");
1938
+ h(this, "registry");
1939
+ h(this, "isTravelEnabled", !1);
1940
+ h(this, "wasmSync");
1941
+ h(this, "lastWasmNodeCount", 0);
1942
+ h(this, "tracker");
1943
+ this.target = A, this.renderer = e, this.registry = s, this.wasmSync = new _e(), this.tracker = new we(A, {
1944
+ resizeDebounce: r.resizeDebounce
1945
+ }), this.tracker.onLayoutChange.add((o, i) => {
1946
+ document.querySelector(`[${X.NAME}~='${X.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 = ne(
1761
1955
  this.target,
1762
- c,
1763
- $,
1956
+ o,
1957
+ j,
1764
1958
  1,
1765
1959
  0,
1766
- this.renderer.qualityFactor
1960
+ this.renderer.qualityFactor,
1961
+ void 0,
1962
+ void 0,
1963
+ void 0,
1964
+ a
1767
1965
  );
1768
- l && this.renderer.syncScene(l, o);
1769
- }), this.tracker.onStyleChange.add((c) => {
1770
- ht(this.registry, c);
1966
+ I && (this.lastWasmNodeCount = a.currentIndex, this.renderer.syncScene(I, i), n && this.renderer.saveInitialLocals(n));
1967
+ }), this.tracker.onStyleChange.add((o) => {
1968
+ Te(this.registry, o, this.wasmSync.sharedArray || void 0);
1771
1969
  }), this.tracker.onRender.add(() => {
1772
- 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();
1773
1971
  });
1774
1972
  }
1775
1973
  start() {
1776
- this.tracker.start();
1974
+ return aA(this, null, function* () {
1975
+ yield this.wasmSync.initialize(1e4 * tA), this.tracker.start();
1976
+ });
1777
1977
  }
1778
1978
  stop() {
1779
1979
  this.tracker.stop();
1780
1980
  }
1781
1981
  }
1782
- class ut {
1982
+ class Ke {
1783
1983
  constructor() {
1784
- p(this, "store");
1984
+ h(this, "store");
1785
1985
  this.store = /* @__PURE__ */ new WeakMap();
1786
1986
  }
1787
- register(e, t) {
1788
- this.store.set(e, t);
1987
+ register(A, e) {
1988
+ this.store.set(A, e);
1789
1989
  }
1790
- get(e) {
1791
- return this.store.get(e);
1990
+ get(A) {
1991
+ return this.store.get(A);
1792
1992
  }
1793
1993
  // public register(element: HTMLElement, meshGroup: THREE.Group): void {
1794
1994
  // this.store.set(element, meshGroup);
@@ -1796,41 +1996,43 @@ class ut {
1796
1996
  // public get(element: HTMLElement): THREE.Group | undefined {
1797
1997
  // return this.store.get(element);
1798
1998
  // }
1799
- has(e) {
1800
- return this.store.has(e);
1999
+ has(A) {
2000
+ return this.store.has(A);
1801
2001
  }
1802
2002
  // Optional
1803
- remove(e) {
1804
- this.store.delete(e);
2003
+ remove(A) {
2004
+ this.store.delete(A);
1805
2005
  }
1806
2006
  }
1807
- class mt {
1808
- constructor(e, t) {
1809
- p(this, "renderer");
1810
- p(this, "syncer");
1811
- p(this, "target");
1812
- p(this, "registry");
1813
- var s, c, o;
1814
- if (this.target = e, this.registry = new ut(), !document.getElementById("mirage-engine-styles")) {
1815
- const n = document.createElement("style");
1816
- n.id = "mirage-engine-styles", n.textContent = `
1817
- [${te.NAME}="${te.VALUES.HIDE}"] {
2007
+ class Ve {
2008
+ constructor(A, e) {
2009
+ h(this, "renderer");
2010
+ h(this, "syncer");
2011
+ h(this, "target");
2012
+ h(this, "registry");
2013
+ var r, o, i;
2014
+ if (this.target = A, this.registry = new Ke(), !document.getElementById("mirage-engine-styles")) {
2015
+ const g = document.createElement("style");
2016
+ g.id = "mirage-engine-styles", g.textContent = `
2017
+ [${eA.NAME}="${eA.VALUES.HIDE}"] {
1818
2018
  opacity: 0 !important;
1819
2019
  }
1820
- `, document.head.appendChild(n);
2020
+ `, document.head.appendChild(g);
1821
2021
  }
1822
- let r;
1823
- if (t.mode === "duplicate" ? r = (c = (s = t.container) != null ? s : this.target.parentElement) != null ? c : void 0 : r = (o = this.target.parentElement) != null ? o : void 0, !r)
2022
+ let s;
2023
+ if (e.mode === "duplicate" ? s = (o = (r = e.container) != null ? r : this.target.parentElement) != null ? o : void 0 : s = (i = this.target.parentElement) != null ? i : void 0, !s)
1824
2024
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1825
- this.renderer = new lt(
2025
+ this.renderer = new Le(
1826
2026
  this.target,
1827
- t,
1828
- r,
2027
+ e,
2028
+ s,
1829
2029
  this.registry
1830
- ), this.renderer.mount(), this.syncer = new dt(this.target, this.renderer, this.registry, t);
2030
+ ), this.renderer.mount(), this.syncer = new We(this.target, this.renderer, this.registry, e);
1831
2031
  }
1832
2032
  start() {
1833
- this.syncer.start();
2033
+ return aA(this, null, function* () {
2034
+ yield this.syncer.start();
2035
+ });
1834
2036
  }
1835
2037
  stop() {
1836
2038
  this.syncer.stop();
@@ -1841,55 +2043,62 @@ class mt {
1841
2043
  getTracker() {
1842
2044
  return this.syncer.tracker;
1843
2045
  }
1844
- updateUniforms(e, t) {
1845
- this.renderer.updateUniforms(e, t);
2046
+ updateUniforms(A, e) {
2047
+ this.renderer.updateUniforms(A, e);
1846
2048
  }
1847
2049
  getCanvas() {
1848
2050
  return this.renderer.canvas;
1849
2051
  }
1850
2052
  test() {
1851
- const e = this.registry.get(
2053
+ const A = this.registry.get(
1852
2054
  document.querySelector("#box2")
1853
2055
  );
1854
- if (!e)
2056
+ if (!A)
1855
2057
  return;
1856
- const t = {
2058
+ const e = {
1857
2059
  ArrowRight: !1,
1858
2060
  ArrowLeft: !1,
1859
2061
  ArrowUp: !1,
1860
2062
  ArrowDown: !1
1861
2063
  };
1862
- window.addEventListener("keydown", (c) => {
1863
- t[c.key] !== void 0 && (t[c.key] = !0);
1864
- }), window.addEventListener("keyup", (c) => {
1865
- 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);
1866
2068
  });
1867
- const r = 2, s = () => {
1868
- requestAnimationFrame(s), t.ArrowRight && e.position.setX(e.position.x + r), t.ArrowLeft && e.position.setX(e.position.x - r), t.ArrowUp && e.position.setY(e.position.y + r), t.ArrowDown && e.position.setY(e.position.y - r);
2069
+ const s = 2, r = () => {
2070
+ requestAnimationFrame(r), 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);
1869
2071
  };
1870
- s();
2072
+ r();
1871
2073
  }
1872
2074
  }
1873
2075
  export {
1874
- Ae as ALLOWED_FILTERS,
1875
- te as ATTR_DOM,
2076
+ ZA as ALLOWED_FILTERS,
2077
+ eA as ATTR_DOM,
1876
2078
  q as ATTR_FILTER,
1877
- gt as ATTR_SANDWICH,
1878
- j as ATTR_SELECT,
1879
- Ge as ATTR_SHADER,
1880
- V as ATTR_TRAVEL,
1881
- Se as DIRTY_CONTENT,
1882
- pe as DIRTY_NONE,
1883
- ie as DIRTY_RECT,
1884
- me as DIRTY_STRUCTURE,
1885
- fe as DIRTY_STYLE,
1886
- qe as DIRTY_ZINDEX,
1887
- pt as EXCLUDED,
1888
- mt as Engine,
1889
- ne as SELECT_LAYER,
1890
- O as THREE_LAYERS,
1891
- De as TRAVEL_VALUES,
1892
- Ke as Tracker,
1893
- $ as USER_LAYER,
1894
- je as extractFromStyle
2079
+ qe as ATTR_SANDWICH,
2080
+ Z as ATTR_SELECT,
2081
+ de as ATTR_SHADER,
2082
+ X as ATTR_TRAVEL,
2083
+ TA as DIRTY_CONTENT,
2084
+ DA as DIRTY_NONE,
2085
+ nA as DIRTY_RECT,
2086
+ SA as DIRTY_STRUCTURE,
2087
+ fA as DIRTY_STYLE,
2088
+ Qe as DIRTY_ZINDEX,
2089
+ je as EXCLUDED,
2090
+ Ve as Engine,
2091
+ pA as OFFSET_LOCAL_X,
2092
+ mA as OFFSET_LOCAL_Y,
2093
+ LA as OFFSET_PARENT,
2094
+ te as OFFSET_WORLD_X,
2095
+ ie as OFFSET_WORLD_Y,
2096
+ lA as SELECT_LAYER,
2097
+ L as THREE_LAYERS,
2098
+ VA as TRAVEL_VALUES,
2099
+ we as Tracker,
2100
+ j as USER_LAYER,
2101
+ tA as WASM_STRIDE,
2102
+ _e as WasmSynchronizer,
2103
+ fe as extractFromStyle
1895
2104
  };