mirage-engine 0.3.19 → 0.3.21

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,17 +1,17 @@
1
- var Xe = Object.defineProperty, Ve = Object.defineProperties;
2
- var Ye = Object.getOwnPropertyDescriptors;
3
- var Ee = Object.getOwnPropertySymbols;
4
- var We = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
5
- var ye = (s, e, t) => e in s ? Xe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, te = (s, e) => {
1
+ var We = Object.defineProperty, He = Object.defineProperties;
2
+ var Pe = Object.getOwnPropertyDescriptors;
3
+ var Re = Object.getOwnPropertySymbols;
4
+ var $e = Object.prototype.hasOwnProperty, Ge = Object.prototype.propertyIsEnumerable;
5
+ var xe = (s, e, t) => e in s ? We(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, re = (s, e) => {
6
6
  for (var t in e || (e = {}))
7
- We.call(e, t) && ye(s, t, e[t]);
8
- if (Ee)
9
- for (var t of Ee(e))
10
- He.call(e, t) && ye(s, t, e[t]);
7
+ $e.call(e, t) && xe(s, t, e[t]);
8
+ if (Re)
9
+ for (var t of Re(e))
10
+ Ge.call(e, t) && xe(s, t, e[t]);
11
11
  return s;
12
- }, Ce = (s, e) => Ve(s, Ye(e));
13
- var u = (s, e, t) => (ye(s, typeof e != "symbol" ? e + "" : e, t), t);
14
- var Te = (s, e, t) => new Promise((i, r) => {
12
+ }, Le = (s, e) => He(s, Pe(e));
13
+ var u = (s, e, t) => (xe(s, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var Me = (s, e, t) => new Promise((i, r) => {
15
15
  var c = (l) => {
16
16
  try {
17
17
  a(t.next(l));
@@ -27,21 +27,21 @@ var Te = (s, e, t) => new Promise((i, r) => {
27
27
  }, a = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(c, n);
28
28
  a((t = t.apply(s, e)).next());
29
29
  });
30
- import * as w from "three";
31
- const Ie = {
30
+ import * as y from "three";
31
+ const _e = {
32
32
  INCLUDE_TREE: "include-tree",
33
33
  EXCLUDE_TREE: "exclude-tree",
34
34
  INCLUDE_SELF: "include-self",
35
35
  EXCLUDE_SELF: "exclude-self",
36
36
  END: "end"
37
- }, ee = {
37
+ }, te = {
38
38
  NAME: "data-mirage-dom",
39
39
  KEY: "mirageDom",
40
40
  VALUES: {
41
41
  HIDE: "hide",
42
42
  SHOW: "show"
43
43
  }
44
- }, Re = {
44
+ }, De = {
45
45
  TRAVELER: "traveler",
46
46
  NATIVE: "native",
47
47
  CAPTURE_1: "1",
@@ -54,30 +54,30 @@ const Ie = {
54
54
  CAPTURE_8: "8",
55
55
  CAPTURE_9: "9",
56
56
  CAPTURE_10: "10"
57
- }, N = {
57
+ }, V = {
58
58
  NAME: "data-mirage-travel",
59
59
  KEY: "mirageTravel",
60
- VALUES: Re,
61
- MAX_LAYERS: Object.keys(Re).length - 1
62
- }, P = {
60
+ VALUES: De,
61
+ MAX_LAYERS: Object.keys(De).length - 1
62
+ }, G = {
63
63
  NAME: "data-mirage-filter",
64
64
  KEY: "mirageFilter",
65
- VALUES: Ie
66
- }, q = {
65
+ VALUES: _e
66
+ }, j = {
67
67
  NAME: "data-mirage-select",
68
68
  KEY: "mirageSelect",
69
- VALUES: Ie
70
- }, Pe = {
69
+ VALUES: _e
70
+ }, qe = {
71
71
  NAME: "data-mirage-shader",
72
72
  KEY: "mirageShader"
73
- }, Le = {
73
+ }, Ae = {
74
74
  NAME: "data-mirage-sandwich",
75
75
  KEY: "mirageSandwich",
76
76
  VALUES: {
77
77
  FRONT: "front"
78
78
  }
79
- }, ge = 0, re = 1, ue = 2, Ge = 4, pe = 8, be = 16;
80
- function $e(s) {
79
+ }, pe = 0, ie = 1, fe = 2, je = 4, me = 8, Se = 16;
80
+ function Ke(s) {
81
81
  const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
82
82
  return e ? {
83
83
  r: parseInt(e[1]) / 255,
@@ -86,10 +86,10 @@ function $e(s) {
86
86
  a: e[4] !== void 0 ? parseFloat(e[4]) : 1
87
87
  } : { r: 1, g: 1, b: 1, a: 1 };
88
88
  }
89
- function qe(s) {
89
+ function Je(s) {
90
90
  const e = {};
91
91
  if (s.opacity && (e.opacity = parseFloat(s.opacity)), s.backgroundColor) {
92
- const t = $e(s.backgroundColor);
92
+ const t = Ke(s.backgroundColor);
93
93
  e.backgroundColor = [t.r, t.g, t.b, t.a];
94
94
  }
95
95
  if (s.backgroundImage ? e.backgroundImage = s.backgroundImage : s.background && (e.backgroundImage = s.background), s.boxShadow && (e.boxShadow = s.boxShadow), s.borderRadius && (e.borderRadius = parseFloat(s.borderRadius)), s.width && (e.width = parseFloat(s.width)), s.height && (e.height = parseFloat(s.height)), s.transform && s.transform !== "none") {
@@ -98,7 +98,7 @@ function qe(s) {
98
98
  }
99
99
  return e;
100
100
  }
101
- class Be {
101
+ class Fe {
102
102
  constructor(e, t) {
103
103
  u(this, "target");
104
104
  u(this, "observer");
@@ -106,7 +106,7 @@ class Be {
106
106
  u(this, "pendingStyles", /* @__PURE__ */ new Map());
107
107
  u(this, "isDomDirty", !1);
108
108
  u(this, "isRunning", !1);
109
- u(this, "pendingMask", ge);
109
+ u(this, "pendingMask", pe);
110
110
  u(this, "mutationTimer", null);
111
111
  u(this, "cssTimer", null);
112
112
  u(this, "resizeConfig");
@@ -121,7 +121,7 @@ class Be {
121
121
  u(this, "onScrollChange", /* @__PURE__ */ new Set());
122
122
  u(this, "onRender", /* @__PURE__ */ new Set());
123
123
  u(this, "onTransitionFinished", (e) => {
124
- this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= re | ue, this.cssTimer = window.setTimeout(() => {
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(() => {
125
125
  this.isDomDirty = !0, this.cssTimer = null;
126
126
  }, 50)));
127
127
  });
@@ -137,10 +137,10 @@ class Be {
137
137
  u(this, "renderLoop", () => {
138
138
  if (!this.isRunning)
139
139
  return;
140
- this.onBeforeRender.forEach((i) => i()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((i) => i(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = ge);
140
+ this.onBeforeRender.forEach((i) => i()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((i) => i(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = pe);
141
141
  const e = window.scrollX, t = window.scrollY;
142
142
  (e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((i) => i(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
143
- this.pendingMask |= re, this.isDomDirty = !0, this.scrollTimer = null;
143
+ this.pendingMask |= ie, this.isDomDirty = !0, this.scrollTimer = null;
144
144
  }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((i) => i(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((i) => i()), requestAnimationFrame(this.renderLoop);
145
145
  });
146
146
  var r, c;
@@ -152,23 +152,23 @@ class Be {
152
152
  onStart: i.onStart,
153
153
  onEnd: i.onEnd
154
154
  }, this.observer = new MutationObserver((n) => {
155
- let a = ge;
155
+ let a = pe;
156
156
  for (const l of n)
157
157
  if (l.type === "childList")
158
- a |= pe, l.removedNodes.length > 0 && l.removedNodes.forEach((o) => {
158
+ a |= me, l.removedNodes.length > 0 && l.removedNodes.forEach((o) => {
159
159
  o instanceof HTMLElement && this.pendingDeletions.add(o);
160
160
  });
161
161
  else if (l.type === "attributes")
162
162
  if (l.attributeName === "style") {
163
- a |= re | ue;
164
- const o = l.target, f = qe(o.style);
163
+ a |= ie | fe;
164
+ const o = l.target, f = Je(o.style);
165
165
  this.pendingStyles.set(o, f);
166
166
  } else
167
- l.attributeName === "class" ? a |= re | ue : l.attributeName && l.attributeName.startsWith("data-") && (a |= re | ue, l.attributeName.startsWith("data-mirage") && (a |= pe));
167
+ l.attributeName === "class" ? a |= ie | fe : l.attributeName && l.attributeName.startsWith("data-") && (a |= ie | fe, l.attributeName.startsWith("data-mirage") && (a |= me));
168
168
  else
169
- l.type === "characterData" && (a |= be | re);
170
- if (a !== ge) {
171
- if (this.pendingMask |= a, a & pe) {
169
+ l.type === "characterData" && (a |= Se | ie);
170
+ if (a !== pe) {
171
+ if (this.pendingMask |= a, a & me) {
172
172
  this.clearTimers(), this.isDomDirty = !0;
173
173
  return;
174
174
  }
@@ -193,13 +193,13 @@ class Be {
193
193
  this.mutationTimer && (clearTimeout(this.mutationTimer), this.mutationTimer = null), this.cssTimer && (clearTimeout(this.cssTimer), this.cssTimer = null), this.scrollTimer && (clearTimeout(this.scrollTimer), this.scrollTimer = null);
194
194
  }
195
195
  }
196
- const G = 1, ae = 2, O = {
196
+ const q = 1, ae = 2, F = {
197
197
  BASE: 0,
198
198
  SELECTED: 1,
199
199
  getCaptureLayer: (s) => 31 - s,
200
200
  HIDDEN: 31
201
- }, Me = Object.values(P.VALUES);
202
- class Ue {
201
+ }, ke = Object.values(G.VALUES);
202
+ class Oe {
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")
@@ -220,12 +220,12 @@ class Ue {
220
220
  return document.body.removeChild(t), c;
221
221
  }
222
222
  }
223
- u(Ue, "cache", /* @__PURE__ */ new Map());
224
- class je extends w.MeshBasicMaterial {
223
+ u(Oe, "cache", /* @__PURE__ */ new Map());
224
+ class Ze extends y.MeshBasicMaterial {
225
225
  constructor(t, i, r, c, n = 2) {
226
226
  super({
227
227
  transparent: !0,
228
- side: w.FrontSide,
228
+ side: y.FrontSide,
229
229
  color: 16777215
230
230
  });
231
231
  u(this, "canvas");
@@ -233,7 +233,7 @@ class je extends w.MeshBasicMaterial {
233
233
  u(this, "qualityFactor");
234
234
  if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
235
235
  throw new Error("[Mirage] Failed to create canvas context");
236
- this.qualityFactor = n, this.map = new w.CanvasTexture(this.canvas), this.map.colorSpace = w.LinearSRGBColorSpace, this.map.minFilter = w.LinearFilter, this.map.magFilter = w.LinearFilter, this.updateText(t, i, r, c);
236
+ this.qualityFactor = n, this.map = new y.CanvasTexture(this.canvas), this.map.colorSpace = y.LinearSRGBColorSpace, this.map.minFilter = y.LinearFilter, this.map.magFilter = y.LinearFilter, this.updateText(t, i, r, c);
237
237
  }
238
238
  wrapText(t, i) {
239
239
  const r = t.split(`
@@ -256,11 +256,11 @@ class je extends w.MeshBasicMaterial {
256
256
  n !== void 0 && (this.qualityFactor = n);
257
257
  const l = (window.devicePixelRatio || 1) * this.qualityFactor, o = r * l, f = c * l;
258
258
  this.canvas.width !== o || this.canvas.height !== f ? (this.canvas.width = o, this.canvas.height = f) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(l, 0, 0, l, 0, 0), this.ctx.font = i.font, this.ctx.fillStyle = i.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
259
- const h = this.wrapText(t, r), d = i.lineHeight, p = Ue.getBaseline(i.font);
260
- h.forEach((g, M) => {
261
- const m = M * d + p;
262
- let y = 0;
263
- i.textAlign === "center" ? y = r / 2 : i.textAlign === "right" && (y = r), this.ctx.textAlign = i.textAlign, this.ctx.fillText(g, y, m);
259
+ const h = this.wrapText(t, r), d = i.lineHeight, m = Oe.getBaseline(i.font);
260
+ h.forEach((p, R) => {
261
+ const v = R * d + m;
262
+ let b = 0;
263
+ i.textAlign === "center" ? b = r / 2 : i.textAlign === "right" && (b = r), this.ctx.textAlign = i.textAlign, this.ctx.fillText(p, b, v);
264
264
  }), this.map && (this.map.needsUpdate = !0);
265
265
  }
266
266
  dispose() {
@@ -275,17 +275,17 @@ function le(s, e = 0) {
275
275
  }
276
276
  function ce(s) {
277
277
  if (!s || s === "transparent")
278
- return { color: new w.Color(16777215), alpha: 0 };
278
+ return { color: new y.Color(16777215), alpha: 0 };
279
279
  const e = s.match(
280
280
  /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
281
281
  );
282
282
  if (e) {
283
283
  const t = parseInt(e[1], 10), i = parseInt(e[2], 10), r = parseInt(e[3], 10), c = e[4] !== void 0 ? parseFloat(e[4]) : 1;
284
- return { color: new w.Color(`rgb(${t}, ${i}, ${r})`), alpha: c };
284
+ return { color: new y.Color(`rgb(${t}, ${i}, ${r})`), alpha: c };
285
285
  }
286
- return { color: new w.Color(s), alpha: 1 };
286
+ return { color: new y.Color(s), alpha: 1 };
287
287
  }
288
- function Oe(s) {
288
+ function ze(s) {
289
289
  const e = [];
290
290
  let t = "", i = 0;
291
291
  for (let r = 0; r < s.length; r++) {
@@ -302,13 +302,13 @@ function Oe(s) {
302
302
  }
303
303
  return t && e.push(t.trim()), e;
304
304
  }
305
- function Ke(s) {
305
+ function Qe(s) {
306
306
  if (!s || typeof s != "string" || !s.includes("linear-gradient"))
307
307
  return null;
308
308
  const e = s.match(/linear-gradient\((.*)\)/);
309
309
  if (!e)
310
310
  return null;
311
- const t = e[1], i = Oe(t);
311
+ const t = e[1], i = ze(t);
312
312
  let r = Math.PI, c = 0;
313
313
  const n = i[0].trim();
314
314
  if (n.startsWith("to "))
@@ -322,13 +322,13 @@ function Ke(s) {
322
322
  const o = i[l].trim(), f = o.lastIndexOf(" ");
323
323
  let h = o, d = null;
324
324
  if (f !== -1 && !o.endsWith(")")) {
325
- const g = o.substring(f + 1);
326
- (g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = o.substring(0, f).trim(), d = g);
325
+ const p = o.substring(f + 1);
326
+ (p.endsWith("%") || p.endsWith("px") || !isNaN(parseFloat(p))) && (h = o.substring(0, f).trim(), d = p);
327
327
  }
328
- const p = ce(h);
328
+ const m = ce(h);
329
329
  a.push({
330
- color: p.color,
331
- alpha: p.alpha,
330
+ color: m.color,
331
+ alpha: m.alpha,
332
332
  rawStop: d,
333
333
  stop: 0
334
334
  });
@@ -342,38 +342,38 @@ function Ke(s) {
342
342
  if (a[o].rawStop !== null || o === a.length - 1) {
343
343
  const f = o - l;
344
344
  if (f > 1) {
345
- const h = a[l].stop, p = (a[o].stop - h) / f;
346
- for (let g = 1; g < f; g++)
347
- a[l + g].stop = h + p * g;
345
+ const h = a[l].stop, m = (a[o].stop - h) / f;
346
+ for (let p = 1; p < f; p++)
347
+ a[l + p].stop = h + m * p;
348
348
  }
349
349
  l = o;
350
350
  }
351
351
  }
352
352
  return { angle: r, stops: a };
353
353
  }
354
- function Je(s) {
354
+ function et(s) {
355
355
  if (!s || s === "none")
356
356
  return null;
357
- const e = Oe(s);
357
+ const e = ze(s);
358
358
  if (e.length === 0)
359
359
  return null;
360
360
  const t = e[0].trim(), i = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, r = t.match(i);
361
361
  let c = "transparent", n = t;
362
362
  if (r && r[1] !== "inset") {
363
- const p = r[1];
364
- (p.startsWith("rgb") || p.startsWith("#") || p === "black" || p === "white" || p === "transparent") && (c = p, n = t.replace(p, "").trim());
363
+ const m = r[1];
364
+ (m.startsWith("rgb") || m.startsWith("#") || m === "black" || m === "white" || m === "transparent") && (c = m, n = t.replace(m, "").trim());
365
365
  }
366
366
  n = n.replace("inset", "").trim();
367
- const a = n.split(/\s+/).map((p) => parseFloat(p) || 0), l = a[0] || 0, o = a[1] || 0, f = a[2] || 0, h = a[3] || 0, d = ce(c);
367
+ const a = n.split(/\s+/).map((m) => parseFloat(m) || 0), l = a[0] || 0, o = a[1] || 0, f = a[2] || 0, h = a[3] || 0, d = ce(c);
368
368
  return { offsetX: l, offsetY: o, blurRadius: f, spreadRadius: h, color: d.color, alpha: d.alpha };
369
369
  }
370
- const Ze = `varying vec2 vUv;
370
+ const tt = `varying vec2 vUv;
371
371
  varying vec4 vScreenPos;
372
372
  void main() {
373
373
  vUv = uv;
374
374
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
375
375
  vScreenPos = gl_Position;
376
- }`, Qe = `varying vec2 vUv;
376
+ }`, rt = `varying vec2 vUv;
377
377
  uniform vec2 uSize;
378
378
  uniform vec2 uMeshSize;
379
379
  uniform vec4 uShadowColor;
@@ -532,89 +532,90 @@ void main() {
532
532
 
533
533
  // #include <colorspace_fragment>
534
534
  }
535
- `, et = `uniform sampler2D uTexture;
535
+ `, it = `uniform sampler2D uTexture;
536
536
  varying vec4 vScreenPos;
537
537
  uniform vec2 uTextureRepeat;
538
- uniform vec2 uTextureOffset;`, tt = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
538
+ uniform vec2 uTextureOffset;`, st = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
539
539
  vec2 resultUv = screenUv;
540
540
 
541
- `, rt = `vec4 texColor = texture2D(uTexture, resultUv);
542
- baseColor = blendSrcOver(baseColor, texColor);`, De = {
543
- vertexShader: Ze,
544
- fragmentShader: Qe
545
- }, Ae = {
546
- declChunk: et,
547
- uvChunk: tt,
548
- baseColorChunk: rt
541
+ `, nt = `vec4 texColor = texture2D(uTexture, resultUv);
542
+ baseColor = blendSrcOver(baseColor, texColor);`, Ie = {
543
+ vertexShader: tt,
544
+ fragmentShader: rt
545
+ }, Be = {
546
+ declChunk: it,
547
+ uvChunk: st,
548
+ baseColorChunk: nt
549
549
  };
550
- function it(s, e, t, i = null, r) {
550
+ function ot(s, e, t, i = null, r) {
551
551
  var C;
552
552
  const c = i !== null || !!s.imageSrc;
553
553
  let n = "";
554
554
  const a = {};
555
555
  if (r != null && r.uniforms)
556
- for (const [b, S] of Object.entries(r.uniforms))
557
- typeof S == "number" ? (n += `uniform float ${b};
558
- `, a[b] = { value: S }) : Array.isArray(S) ? S.length === 2 ? (n += `uniform vec2 ${b};
559
- `, a[b] = { value: new w.Vector2(...S) }) : S.length === 3 ? (n += `uniform vec3 ${b};
560
- `, a[b] = { value: new w.Vector3(...S) }) : S.length === 4 && (n += `uniform vec4 ${b};
561
- `, a[b] = { value: new w.Vector4(...S) }) : (n += `uniform float ${b};
562
- `, a[b] = { value: S });
563
- const l = r !== void 0, o = (c || l ? Ae.declChunk : "") + `
556
+ for (const [w, x] of Object.entries(r.uniforms))
557
+ typeof x == "number" ? (n += `uniform float ${w};
558
+ `, a[w] = { value: x }) : Array.isArray(x) ? x.length === 2 ? (n += `uniform vec2 ${w};
559
+ `, a[w] = { value: new y.Vector2(...x) }) : x.length === 3 ? (n += `uniform vec3 ${w};
560
+ `, a[w] = { value: new y.Vector3(...x) }) : x.length === 4 && (n += `uniform vec4 ${w};
561
+ `, a[w] = { value: new y.Vector4(...x) }) : x && typeof x == "object" && x.type ? (n += `uniform ${x.type} ${w};
562
+ `, a[w] = x) : (n += `uniform float ${w};
563
+ `, a[w] = { value: x });
564
+ const l = r !== void 0, o = (c || l ? Be.declChunk : "") + `
564
565
  ` + n, f = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
565
566
  `, h = s.isTraveler ? `vec2 resultUv = screenUv;
566
567
  ` : `vec2 localUv = (p / uSize) + 0.5;
567
568
  vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
568
- `, d = c || l ? f + h + ((r == null ? void 0 : r.uvModifier) || "") : "", p = c || l ? Ae.baseColorChunk : "", g = (r == null ? void 0 : r.colorModifier) || "", M = De.fragmentShader.replace("#INJECT_DECLARATIONS", o).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", g), m = ce(s.backgroundColor), y = ce(s.borderColor), E = {
569
- uSize: { value: new w.Vector2(e, t) },
570
- uMeshSize: { value: new w.Vector2(e, t) },
571
- uShadowColor: { value: new w.Vector4(0, 0, 0, 0) },
572
- uShadowOffset: { value: new w.Vector2(0, 0) },
569
+ `, d = c || l ? f + h + ((r == null ? void 0 : r.uvModifier) || "") : "", m = c || l ? Be.baseColorChunk : "", p = (r == null ? void 0 : r.colorModifier) || "", R = Ie.fragmentShader.replace("#INJECT_DECLARATIONS", o).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", m).replace("#INJECT_COLOR_MODIFIER", p), v = ce(s.backgroundColor), b = ce(s.borderColor), E = {
570
+ uSize: { value: new y.Vector2(e, t) },
571
+ uMeshSize: { value: new y.Vector2(e, t) },
572
+ uShadowColor: { value: new y.Vector4(0, 0, 0, 0) },
573
+ uShadowOffset: { value: new y.Vector2(0, 0) },
573
574
  uShadowBlur: { value: 0 },
574
575
  uShadowSpread: { value: 0 },
575
576
  uBgColor: {
576
- value: new w.Vector4(
577
- m.color.r,
578
- m.color.g,
579
- m.color.b,
580
- m.alpha
577
+ value: new y.Vector4(
578
+ v.color.r,
579
+ v.color.g,
580
+ v.color.b,
581
+ v.alpha
581
582
  )
582
583
  },
583
584
  uBorderColor: {
584
- value: new w.Vector4(
585
- y.color.r,
586
- y.color.g,
587
- y.color.b,
588
- y.alpha
585
+ value: new y.Vector4(
586
+ b.color.r,
587
+ b.color.g,
588
+ b.color.b,
589
+ b.alpha
589
590
  )
590
591
  },
591
- uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
592
+ uBorderRadius: { value: new y.Vector4(0, 0, 0, 0) },
592
593
  uBorderWidth: { value: le(s.borderWidth) },
593
594
  uOpacity: { value: (C = s.opacity) != null ? C : 1 },
594
595
  uTexture: { value: null },
595
- uTextureRepeat: { value: new w.Vector2(1, 1) },
596
- uTextureOffset: { value: new w.Vector2(0, 0) },
596
+ uTextureRepeat: { value: new y.Vector2(1, 1) },
597
+ uTextureOffset: { value: new y.Vector2(0, 0) },
597
598
  uGradientCount: { value: 0 },
598
599
  uGradientAngle: { value: 0 },
599
600
  uGradientColors: {
600
- value: Array.from({ length: 8 }, () => new w.Vector4(0, 0, 0, 0))
601
+ value: Array.from({ length: 8 }, () => new y.Vector4(0, 0, 0, 0))
601
602
  },
602
603
  uGradientStops: { value: new Float32Array(8) }
603
604
  };
604
- _e(E.uBorderRadius.value, s.borderRadius, Math.min(e, t)), c && (E.uTexture.value = i);
605
- const A = new w.ShaderMaterial({
606
- uniforms: te(te({}, E), a),
607
- vertexShader: De.vertexShader,
608
- fragmentShader: M,
605
+ Ne(E.uBorderRadius.value, s.borderRadius, Math.min(e, t)), c && (E.uTexture.value = i);
606
+ const M = new y.ShaderMaterial({
607
+ uniforms: re(re({}, E), a),
608
+ vertexShader: Ie.vertexShader,
609
+ fragmentShader: R,
609
610
  transparent: !0,
610
- side: w.FrontSide
611
+ side: y.FrontSide
611
612
  // for better performance
612
613
  });
613
- return s.backgroundImage && xe(A, { backgroundImage: s.backgroundImage }), A;
614
+ return s.backgroundImage && Ee(M, { backgroundImage: s.backgroundImage }), M;
614
615
  }
615
- function st(s, e, t, i, r) {
616
+ function at(s, e, t, i, r) {
616
617
  const c = le(e.borderWidth);
617
- xe(s, {
618
+ Ee(s, {
618
619
  width: t,
619
620
  height: i,
620
621
  borderRadius: e.borderRadius,
@@ -627,10 +628,10 @@ function st(s, e, t, i, r) {
627
628
  boxShadow: e.boxShadow
628
629
  });
629
630
  }
630
- function xe(s, e) {
631
+ function Ee(s, e) {
631
632
  var i, r, c;
632
633
  if (e.boxShadow !== void 0) {
633
- const n = Je(e.boxShadow);
634
+ const n = et(e.boxShadow);
634
635
  n ? (s.uniforms.uShadowColor.value.set(n.color.r, n.color.g, n.color.b, n.alpha), s.uniforms.uShadowOffset.value.set(n.offsetX, n.offsetY), s.uniforms.uShadowBlur.value = n.blurRadius, s.uniforms.uShadowSpread.value = n.spreadRadius, s.userData.shadowPadding = n.blurRadius + n.spreadRadius + Math.max(Math.abs(n.offsetX), Math.abs(n.offsetY))) : (s.uniforms.uShadowColor.value.w = 0, s.userData.shadowPadding = 0);
635
636
  }
636
637
  if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), s.uniforms.uMeshSize) {
@@ -639,7 +640,7 @@ function xe(s, e) {
639
640
  }
640
641
  if (e.borderRadius !== void 0) {
641
642
  const n = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(s.uniforms.uSize.value.x, s.uniforms.uSize.value.y);
642
- _e(s.uniforms.uBorderRadius.value, e.borderRadius, n);
643
+ Ne(s.uniforms.uBorderRadius.value, e.borderRadius, n);
643
644
  }
644
645
  if (e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
645
646
  if (Array.isArray(e.backgroundColor)) {
@@ -710,7 +711,7 @@ function xe(s, e) {
710
711
  } else
711
712
  s.uniforms.uTextureRepeat && (s.uniforms.uTextureRepeat.value.set(1, 1), s.uniforms.uTextureOffset.value.set(0, 0));
712
713
  if (e.backgroundImage !== void 0) {
713
- const n = Ke(e.backgroundImage);
714
+ const n = Qe(e.backgroundImage);
714
715
  if (n) {
715
716
  s.uniforms.uGradientCount.value = n.stops.length, s.uniforms.uGradientAngle.value = n.angle;
716
717
  for (let a = 0; a < 8; a++)
@@ -730,7 +731,7 @@ function xe(s, e) {
730
731
  for (const n of Object.keys(e))
731
732
  n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && n !== "boxShadow" && s.uniforms[n] !== void 0 && (s.uniforms[n].value !== void 0 && s.uniforms[n].value !== null && typeof s.uniforms[n].value.set == "function" ? Array.isArray(e[n]) ? s.uniforms[n].value.set(...e[n]) : e[n] !== void 0 && (e[n].copy ? s.uniforms[n].value.copy(e[n]) : s.uniforms[n].value = e[n]) : s.uniforms[n].value = e[n]);
732
733
  }
733
- function _e(s, e, t = 0) {
734
+ function Ne(s, e, t = 0) {
734
735
  var l, o, f, h;
735
736
  if (e == null) {
736
737
  s.set(0, 0, 0, 0);
@@ -747,24 +748,24 @@ function _e(s, e, t = 0) {
747
748
  const i = e.split("/")[0].trim().split(/\s+/), r = le(i[0], t), c = le((l = i[1]) != null ? l : i[0], t), n = le((o = i[2]) != null ? o : i[0], t), a = le((h = (f = i[3]) != null ? f : i[1]) != null ? h : i[0], t);
748
749
  s.set(r, c, n, a);
749
750
  }
750
- const W = {
751
+ const P = {
751
752
  create(s, e, t, i, r, c = 2, n = null, a) {
752
- return s === "BOX" ? it(
753
+ return s === "BOX" ? ot(
753
754
  e,
754
755
  i,
755
756
  r,
756
757
  n,
757
758
  a
758
- ) : s === "TEXT" ? new je(
759
+ ) : s === "TEXT" ? new Ze(
759
760
  t || "",
760
761
  e,
761
762
  i,
762
763
  r,
763
764
  c
764
- ) : new w.MeshBasicMaterial({ visible: !1 });
765
+ ) : new y.MeshBasicMaterial({ visible: !1 });
765
766
  },
766
767
  update(s, e, t, i, r, c, n = 2, a) {
767
- e === "BOX" ? st(
768
+ e === "BOX" ? at(
768
769
  s,
769
770
  t,
770
771
  r,
@@ -779,10 +780,10 @@ const W = {
779
780
  );
780
781
  },
781
782
  forceUpdateUniforms(s, e) {
782
- xe(s, e);
783
+ Ee(s, e);
783
784
  }
784
785
  };
785
- class nt {
786
+ class lt {
786
787
  constructor(e, t = !0) {
787
788
  u(this, "observer");
788
789
  u(this, "textures", /* @__PURE__ */ new WeakMap());
@@ -808,7 +809,7 @@ class nt {
808
809
  e.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(e), this.disposeTexture(e), this.elementUrls.delete(e), this.loadStatus.delete(e);
809
810
  }
810
811
  loadTexture(e) {
811
- return Te(this, null, function* () {
812
+ return Me(this, null, function* () {
812
813
  if (this.loadStatus.get(e) || this.textures.has(e))
813
814
  return;
814
815
  const t = this.elementUrls.get(e);
@@ -829,8 +830,8 @@ class nt {
829
830
  "close" in i && i.close();
830
831
  return;
831
832
  }
832
- const r = new w.Texture(i);
833
- i instanceof HTMLImageElement || (r.flipY = !1), r.colorSpace = w.LinearSRGBColorSpace, r.needsUpdate = !0, this.textures.set(e, r), this.onUpdate(e, r);
833
+ const r = new y.Texture(i);
834
+ i instanceof HTMLImageElement || (r.flipY = !1), r.colorSpace = y.LinearSRGBColorSpace, r.needsUpdate = !0, this.textures.set(e, r), this.onUpdate(e, r);
834
835
  } catch (i) {
835
836
  console.warn("[MirageEngine] Failed to load texture:", t, i);
836
837
  } finally {
@@ -850,7 +851,7 @@ class nt {
850
851
  this.observer && this.observer.disconnect();
851
852
  }
852
853
  }
853
- class ot {
854
+ class ct {
854
855
  constructor(e, t, i, r) {
855
856
  u(this, "canvas");
856
857
  u(this, "scene");
@@ -869,50 +870,50 @@ class ot {
869
870
  u(this, "registry");
870
871
  u(this, "targetRect");
871
872
  u(this, "travelersByLayer", Array.from(
872
- { length: N.MAX_LAYERS },
873
+ { length: V.MAX_LAYERS },
873
874
  () => /* @__PURE__ */ new Set()
874
875
  ));
875
876
  u(this, "textureManager");
876
877
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
877
878
  u(this, "fixedMeshes", /* @__PURE__ */ new Set());
878
879
  var a, l, o, f, h;
879
- this.target = e, this.mountContainer = i, this.registry = r, this.mode = (a = t.mode) != null ? a : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (o = t.travelerClipArea) != null ? o : 1, this.targetLayer = (f = t.layer) != null ? f : "base", this.textureManager = new nt((d, p) => {
880
- const g = this.registry.get(d);
881
- g && g.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(g.material, { texture: p });
882
- }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new w.Scene(), this.targetRect = this.target.getBoundingClientRect();
880
+ this.target = e, this.mountContainer = i, this.registry = r, this.mode = (a = t.mode) != null ? a : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (o = t.travelerClipArea) != null ? o : 1, this.targetLayer = (f = t.layer) != null ? f : "base", this.textureManager = new lt((d, m) => {
881
+ const p = this.registry.get(d);
882
+ p && p.material instanceof y.ShaderMaterial && P.forceUpdateUniforms(p.material, { texture: m });
883
+ }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new y.Scene(), this.targetRect = this.target.getBoundingClientRect();
883
884
  const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
884
- this.camera = new w.OrthographicCamera(
885
+ this.camera = new y.OrthographicCamera(
885
886
  c / -2,
886
887
  c / 2,
887
888
  n / 2,
888
889
  n / -2,
889
890
  1,
890
891
  1e3
891
- ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new w.WebGLRenderer({
892
+ ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new y.WebGLRenderer({
892
893
  canvas: this.canvas,
893
894
  alpha: !0,
894
895
  antialias: !0
895
896
  // [new]
896
897
  // premultipliedAlpha: true
897
- }), w.ColorManagement.enabled = !1, this.renderer.outputColorSpace = w.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(c, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
898
+ }), y.ColorManagement.enabled = !1, this.renderer.outputColorSpace = y.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(c, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
898
899
  }
899
900
  get isViewport() {
900
901
  return this.mode === "overlay" && this.canvasSize === "viewport";
901
902
  }
902
903
  getSceneLayer() {
903
- return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? O.SELECTED : O.BASE;
904
+ return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? F.SELECTED : F.BASE;
904
905
  }
905
906
  createRenderTarget() {
906
- for (let e = 0; e < N.MAX_LAYERS; e++) {
907
+ for (let e = 0; e < V.MAX_LAYERS; e++) {
907
908
  const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, i = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
908
909
  this.renderTargets.push(
909
- new w.WebGLRenderTarget(
910
+ new y.WebGLRenderTarget(
910
911
  t * this.qualityFactor,
911
912
  i * this.qualityFactor,
912
913
  {
913
- minFilter: w.LinearFilter,
914
- magFilter: w.LinearFilter,
915
- format: w.RGBAFormat,
914
+ minFilter: y.LinearFilter,
915
+ magFilter: y.LinearFilter,
916
+ format: y.RGBAFormat,
916
917
  stencilBuffer: !1,
917
918
  depthBuffer: !0
918
919
  }
@@ -950,12 +951,12 @@ class ot {
950
951
  updateUniforms(e, t) {
951
952
  const i = this.registry.get(e);
952
953
  i && (i.traverse((r) => {
953
- r.isMesh && r.material && W.forceUpdateUniforms(
954
+ r.isMesh && r.material && P.forceUpdateUniforms(
954
955
  r.material,
955
956
  t
956
957
  );
957
958
  }), i.userData.nativeMesh && i.userData.nativeMesh.traverse((r) => {
958
- r.isMesh && r.material && W.forceUpdateUniforms(
959
+ r.isMesh && r.material && P.forceUpdateUniforms(
959
960
  r.material,
960
961
  t
961
962
  );
@@ -981,7 +982,7 @@ class ot {
981
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(
982
983
  (d) => d.dispose()
983
984
  ) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((d) => {
984
- d instanceof w.Mesh && (d.geometry && d.geometry.dispose(), d.material && (Array.isArray(d.material) ? d.material.forEach((p) => p.dispose()) : d.material.dispose()));
985
+ d instanceof y.Mesh && (d.geometry && d.geometry.dispose(), d.material && (Array.isArray(d.material) ? d.material.forEach((m) => m.dispose()) : d.material.dispose()));
985
986
  }), this.registry.remove(f), this.textureManager.unregister(f);
986
987
  }
987
988
  });
@@ -994,8 +995,8 @@ class ot {
994
995
  var r, c;
995
996
  let t = this.registry.get(e.element);
996
997
  const i = JSON.stringify(e.shaderHooks || null);
997
- if (t && t.userData.shaderHash !== i && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof w.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
998
- const n = new w.PlaneGeometry(1, 1), a = e.isTraveler ? (r = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : r.texture : this.textureManager.get(e.element), l = W.create(
998
+ if (t && t.userData.shaderHash !== i && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof y.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
999
+ const n = new y.PlaneGeometry(1, 1), a = e.isTraveler ? (r = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : r.texture : this.textureManager.get(e.element), l = P.create(
999
1000
  "BOX",
1000
1001
  e.styles,
1001
1002
  "",
@@ -1005,10 +1006,10 @@ class ot {
1005
1006
  a,
1006
1007
  e.shaderHooks
1007
1008
  );
1008
- t = new w.Mesh(n, l), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = l, t.userData.domElement = e.element, t.userData.shaderHash = i;
1009
+ t = new y.Mesh(n, l), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = l, t.userData.domElement = e.element, t.userData.shaderHash = i;
1009
1010
  }
1010
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)
1011
- for (let n = 0; n < N.MAX_LAYERS; n++)
1012
+ for (let n = 0; n < V.MAX_LAYERS; n++)
1012
1013
  n === e.captureLayer - 2 ? this.travelersByLayer[n].add(t) : this.travelersByLayer[n].delete(t);
1013
1014
  else
1014
1015
  for (const n of this.travelersByLayer)
@@ -1028,31 +1029,31 @@ class ot {
1028
1029
  const r = t.textLines || [
1029
1030
  { text: t.textContent || "", rect: t.rect }
1030
1031
  ], c = i ? t.nativeStyles : t.textStyles, n = JSON.stringify(c) + t.textContent + r.map((f) => f.text).join("|"), a = (o = e.userData) == null ? void 0 : o.textChildStyleHash;
1031
- if (t.dirtyMask & be || n !== a) {
1032
+ if (t.dirtyMask & Se || n !== a) {
1032
1033
  e.children.filter(
1033
- (g) => g.name.startsWith("TEXT_CHILD")
1034
- ).forEach((g) => {
1035
- var m;
1036
- const M = g;
1037
- (m = M.material.map) == null || m.dispose(), M.geometry.dispose(), e.remove(M);
1034
+ (p) => p.name.startsWith("TEXT_CHILD")
1035
+ ).forEach((p) => {
1036
+ var v;
1037
+ const R = p;
1038
+ (v = R.material.map) == null || v.dispose(), R.geometry.dispose(), e.remove(R);
1038
1039
  });
1039
- const h = t.rect, d = h.x + h.width / 2, p = h.y + h.height / 2;
1040
- r.forEach((g, M) => {
1041
- const m = W.create(
1040
+ const h = t.rect, d = h.x + h.width / 2, m = h.y + h.height / 2;
1041
+ r.forEach((p, R) => {
1042
+ const v = P.create(
1042
1043
  "TEXT",
1043
1044
  c,
1044
- g.text,
1045
- g.rect.width,
1046
- g.rect.height,
1045
+ p.text,
1046
+ p.rect.width,
1047
+ p.rect.height,
1047
1048
  this.qualityFactor
1048
- ), y = new w.PlaneGeometry(1, 1), E = new w.Mesh(y, m);
1049
- E.name = `TEXT_CHILD_${M}`;
1050
- const A = t.rect.width === 0 ? 1 : g.rect.width / t.rect.width, C = t.rect.height === 0 ? 1 : g.rect.height / t.rect.height;
1051
- E.scale.set(A, C, 1);
1052
- const b = g.rect.x + g.rect.width / 2, S = g.rect.y + g.rect.height / 2, z = b - d, X = -(S - p);
1049
+ ), b = new y.PlaneGeometry(1, 1), E = new y.Mesh(b, v);
1050
+ E.name = `TEXT_CHILD_${R}`;
1051
+ const M = t.rect.width === 0 ? 1 : p.rect.width / t.rect.width, C = t.rect.height === 0 ? 1 : p.rect.height / t.rect.height;
1052
+ E.scale.set(M, C, 1);
1053
+ const w = p.rect.x + p.rect.width / 2, x = p.rect.y + p.rect.height / 2, z = w - d, Y = -(x - m);
1053
1054
  E.position.set(
1054
1055
  t.rect.width === 0 ? 0 : z / t.rect.width,
1055
- t.rect.height === 0 ? 0 : X / t.rect.height,
1056
+ t.rect.height === 0 ? 0 : Y / t.rect.height,
1056
1057
  5e-3
1057
1058
  ), e.add(E);
1058
1059
  }), e.userData.textChildStyleHash = n;
@@ -1062,21 +1063,21 @@ class ot {
1062
1063
  return;
1063
1064
  const h = f;
1064
1065
  if (i && t.nativeLayer !== void 0)
1065
- h.layers.set(O.HIDDEN), t.visibility & G && h.layers.enable(O.getCaptureLayer(t.nativeLayer));
1066
+ h.layers.set(F.HIDDEN), t.visibility & q && h.layers.enable(F.getCaptureLayer(t.nativeLayer));
1066
1067
  else {
1067
- const d = t.visibility & G ? O.BASE : O.HIDDEN;
1068
- if (h.layers.set(d), t.visibility & ae && h.layers.enable(O.SELECTED), t.visibility & G)
1068
+ const d = t.visibility & q ? F.BASE : F.HIDDEN;
1069
+ if (h.layers.set(d), t.visibility & ae && h.layers.enable(F.SELECTED), t.visibility & q)
1069
1070
  if (!i && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1070
- for (let p = t.captureLayer; p <= N.MAX_LAYERS + 1; p++)
1071
- p !== t.nativeLayer && h.layers.enable(O.getCaptureLayer(p));
1071
+ for (let m = t.captureLayer; m <= V.MAX_LAYERS + 1; m++)
1072
+ m !== t.nativeLayer && h.layers.enable(F.getCaptureLayer(m));
1072
1073
  else
1073
- for (let p = t.captureLayer; p <= N.MAX_LAYERS + 1; p++)
1074
- h.layers.enable(O.getCaptureLayer(p));
1074
+ for (let m = t.captureLayer; m <= V.MAX_LAYERS + 1; m++)
1075
+ h.layers.enable(F.getCaptureLayer(m));
1075
1076
  }
1076
1077
  });
1077
1078
  }
1078
1079
  updateMeshProperties(e, t) {
1079
- var C, b, S, z, X;
1080
+ var C, w, x, z, Y;
1080
1081
  const { rect: i, styles: r } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c, a = this.renderer.domElement.height / c;
1081
1082
  e.material = e.userData.baseMaterial;
1082
1083
  let l = ((C = e.material.userData) == null ? void 0 : C.shadowPadding) || 0;
@@ -1089,27 +1090,27 @@ class ot {
1089
1090
  const o = 1e-3;
1090
1091
  this.renderOrder++;
1091
1092
  const f = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
1092
- let d, p;
1093
+ let d, m;
1093
1094
  if (this.isViewport)
1094
- d = i.x - window.innerWidth / 2 + i.width / 2, p = -i.y + window.innerHeight / 2 - i.height / 2;
1095
+ d = i.x - window.innerWidth / 2 + i.width / 2, m = -i.y + window.innerHeight / 2 - i.height / 2;
1095
1096
  else {
1096
- const B = i.x - f, k = i.y - h;
1097
- d = B - n / 2 + i.width / 2, p = -k + a / 2 - i.height / 2;
1097
+ const A = i.x - f, N = i.y - h;
1098
+ d = A - n / 2 + i.width / 2, m = -N + a / 2 - i.height / 2;
1098
1099
  }
1099
1100
  e.position.set(
1100
1101
  d,
1101
- p,
1102
+ m,
1102
1103
  r.zIndex + this.renderOrder * o
1103
1104
  );
1104
- const g = i.x, M = i.y;
1105
- e.userData.basePosition = { x: d, y: p }, e.userData.originalBasePosition = { x: d, y: p }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: g, y: M }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1106
- const m = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, y = window.getComputedStyle(m);
1107
- let E = 0, A = 0;
1108
- if (y.transform && y.transform !== "none") {
1109
- const B = new DOMMatrix(y.transform);
1110
- E = B.m41, A = B.m42;
1105
+ const p = i.x, R = i.y;
1106
+ e.userData.basePosition = { x: d, y: m }, e.userData.originalBasePosition = { x: d, y: m }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: p, 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, b = window.getComputedStyle(v);
1108
+ let E = 0, M = 0;
1109
+ if (b.transform && b.transform !== "none") {
1110
+ const A = new DOMMatrix(b.transform);
1111
+ E = A.m41, M = A.m42;
1111
1112
  }
1112
- if (e.userData.baseTransform = { x: E, y: A }, delete e.userData.originRatioX, delete e.userData.originRatioY, W.update(
1113
+ if (e.userData.baseTransform = { x: E, y: M }, delete e.userData.originRatioX, delete e.userData.originRatioY, P.update(
1113
1114
  e.userData.baseMaterial,
1114
1115
  "BOX",
1115
1116
  r,
@@ -1117,120 +1118,120 @@ class ot {
1117
1118
  i.width,
1118
1119
  i.height,
1119
1120
  this.qualityFactor,
1120
- t.isTraveler ? (b = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : b.texture : this.textureManager.get(t.element)
1121
+ t.isTraveler ? (w = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : w.texture : this.textureManager.get(t.element)
1121
1122
  ), t.nativeStyles && t.nativeRect) {
1122
1123
  if (!e.userData.nativeMesh) {
1123
- const U = W.create(
1124
+ const _ = P.create(
1124
1125
  "BOX",
1125
1126
  t.nativeStyles,
1126
1127
  "",
1127
1128
  t.nativeRect.width,
1128
1129
  t.nativeRect.height,
1129
1130
  this.qualityFactor,
1130
- t.isTraveler ? (S = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : S.texture : this.textureManager.get(t.element),
1131
+ t.isTraveler ? (x = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : x.texture : t.nativeStyles.imageSrc && t.nativeStyles.imageSrc !== t.styles.imageSrc ? new y.TextureLoader().load(t.nativeStyles.imageSrc) : this.textureManager.get(t.element),
1131
1132
  t.shaderHooks
1132
- ), V = new w.Mesh(e.geometry, U);
1133
- t.type === "TEXT" && (V.name = "BG_MESH"), this.scene.add(V), e.userData.nativeMesh = V;
1133
+ ), W = new y.Mesh(e.geometry, _);
1134
+ t.type === "TEXT" && (W.name = "BG_MESH"), this.scene.add(W), e.userData.nativeMesh = W;
1134
1135
  }
1135
- const B = e.userData.nativeMesh;
1136
- let k, j;
1136
+ const A = e.userData.nativeMesh;
1137
+ let N, B;
1137
1138
  if (this.isViewport)
1138
- k = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, j = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1139
+ N = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, B = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1139
1140
  else {
1140
- const U = t.nativeRect.x - f, V = t.nativeRect.y - h;
1141
- k = U - n / 2 + t.nativeRect.width / 2, j = -V + a / 2 - t.nativeRect.height / 2;
1141
+ const _ = t.nativeRect.x - f, W = t.nativeRect.y - h;
1142
+ N = _ - n / 2 + t.nativeRect.width / 2, B = -W + a / 2 - t.nativeRect.height / 2;
1142
1143
  }
1143
- let J = t.nativeRect.width, Z = t.nativeRect.height, L = k, _ = j;
1144
+ let K = t.nativeRect.width, J = t.nativeRect.height, L = N, U = B;
1144
1145
  if (t.nativeStyles.transform) {
1145
- const U = t.nativeStyles.transform, V = U.match(/scale\(([\d.]+%?)\)/);
1146
- if (V) {
1147
- let x = parseFloat(V[1]);
1148
- V[1].includes("%") && (x /= 100), J *= x, Z *= x;
1149
- }
1150
- const ie = U.match(/scaleX\(([\d.]+%?)\)/);
1151
- if (ie) {
1152
- let x = parseFloat(ie[1]);
1153
- ie[1].includes("%") && (x /= 100), J *= x;
1146
+ const _ = t.nativeStyles.transform, W = _.match(/scale\(([\d.]+%?)\)/);
1147
+ if (W) {
1148
+ let g = parseFloat(W[1]);
1149
+ W[1].includes("%") && (g /= 100), K *= g, J *= g;
1154
1150
  }
1155
- const se = U.match(/scaleY\(([\d.]+%?)\)/);
1151
+ const se = _.match(/scaleX\(([\d.]+%?)\)/);
1156
1152
  if (se) {
1157
- let x = parseFloat(se[1]);
1158
- se[1].includes("%") && (x /= 100), Z *= x;
1153
+ let g = parseFloat(se[1]);
1154
+ se[1].includes("%") && (g /= 100), K *= g;
1159
1155
  }
1160
- const ne = U.match(/translate\(([^,]+),\s*([^)]+)\)/);
1156
+ const ne = _.match(/scaleY\(([\d.]+%?)\)/);
1161
1157
  if (ne) {
1162
- const x = ne[1].trim(), T = ne[2].trim();
1163
- let F = parseFloat(x);
1164
- x.includes("%") && (F = F / 100 * t.nativeRect.width);
1165
- let D = parseFloat(T);
1166
- T.includes("%") && (D = D / 100 * t.nativeRect.height), L += F, _ -= D;
1158
+ let g = parseFloat(ne[1]);
1159
+ ne[1].includes("%") && (g /= 100), J *= g;
1160
+ }
1161
+ const oe = _.match(/translate\(([^,]+),\s*([^)]+)\)/);
1162
+ if (oe) {
1163
+ const g = oe[1].trim(), S = oe[2].trim();
1164
+ let k = parseFloat(g);
1165
+ g.includes("%") && (k = k / 100 * t.nativeRect.width);
1166
+ let O = parseFloat(S);
1167
+ S.includes("%") && (O = O / 100 * t.nativeRect.height), L += k, U -= O;
1167
1168
  }
1168
- const he = U.match(/translateX\(([^)]+)\)/);
1169
+ const he = _.match(/translateX\(([^)]+)\)/);
1169
1170
  if (he) {
1170
- const x = he[1].trim();
1171
- let T = parseFloat(x);
1172
- x.includes("%") && (T = T / 100 * t.nativeRect.width), L += T;
1171
+ const g = he[1].trim();
1172
+ let S = parseFloat(g);
1173
+ g.includes("%") && (S = S / 100 * t.nativeRect.width), L += S;
1173
1174
  }
1174
- const v = U.match(/translateY\(([^)]+)\)/);
1175
- if (v) {
1176
- const x = v[1].trim();
1177
- let T = parseFloat(x);
1178
- x.includes("%") && (T = T / 100 * t.nativeRect.height), _ -= T;
1175
+ const de = _.match(/translateY\(([^)]+)\)/);
1176
+ if (de) {
1177
+ const g = de[1].trim();
1178
+ let S = parseFloat(g);
1179
+ g.includes("%") && (S = S / 100 * t.nativeRect.height), U -= S;
1179
1180
  }
1180
1181
  }
1181
- let K = ((z = B.material.userData) == null ? void 0 : z.shadowPadding) || 0;
1182
- B.scale.set(J + K * 2, Z + K * 2, 1), B.position.set(
1182
+ let Z = ((z = A.material.userData) == null ? void 0 : z.shadowPadding) || 0;
1183
+ A.scale.set(K + Z * 2, J + Z * 2, 1), A.position.set(
1183
1184
  L,
1184
- _,
1185
+ U,
1185
1186
  t.nativeStyles.zIndex + this.renderOrder * o
1186
- ), W.update(
1187
- B.material,
1187
+ ), P.update(
1188
+ A.material,
1188
1189
  "BOX",
1189
1190
  t.nativeStyles,
1190
1191
  "",
1191
1192
  t.nativeRect.width,
1192
1193
  t.nativeRect.height,
1193
1194
  this.qualityFactor,
1194
- t.isTraveler ? (X = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : X.texture : this.textureManager.get(t.element)
1195
+ t.isTraveler ? (Y = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : Y.texture : A.material.uniforms.uTexture.value || this.textureManager.get(t.element)
1195
1196
  );
1196
1197
  } else
1197
- 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);
1198
+ e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof y.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1198
1199
  }
1199
1200
  updateMeshLayers(e, t) {
1200
- const i = t.visibility & G ? O.BASE : O.HIDDEN;
1201
- if (e.layers.set(i), t.visibility & ae && e.layers.enable(O.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1201
+ const i = t.visibility & q ? F.BASE : F.HIDDEN;
1202
+ if (e.layers.set(i), t.visibility & ae && e.layers.enable(F.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1202
1203
  const r = e.userData.nativeMesh;
1203
- if (r.layers.set(O.HIDDEN), t.visibility & G) {
1204
- r.layers.enable(O.getCaptureLayer(t.nativeLayer));
1205
- for (let c = t.captureLayer; c <= N.MAX_LAYERS + 1; c++)
1206
- c !== t.nativeLayer && e.layers.enable(O.getCaptureLayer(c));
1204
+ if (r.layers.set(F.HIDDEN), t.visibility & q) {
1205
+ r.layers.enable(F.getCaptureLayer(t.nativeLayer));
1206
+ for (let c = t.captureLayer; c <= V.MAX_LAYERS + 1; c++)
1207
+ c !== t.nativeLayer && e.layers.enable(F.getCaptureLayer(c));
1207
1208
  }
1208
- } else if (t.visibility & G)
1209
- for (let r = t.captureLayer; r <= N.MAX_LAYERS + 1; r++)
1210
- e.layers.enable(O.getCaptureLayer(r));
1209
+ } else if (t.visibility & q)
1210
+ for (let r = t.captureLayer; r <= V.MAX_LAYERS + 1; r++)
1211
+ e.layers.enable(F.getCaptureLayer(r));
1211
1212
  }
1212
1213
  captureRenderTarget(e, t, i) {
1213
1214
  if (e.size === 0 || !i)
1214
1215
  return;
1215
- const r = new w.Color(), c = this.renderer.getClearAlpha();
1216
+ const r = new y.Color(), c = this.renderer.getClearAlpha();
1216
1217
  this.renderer.getClearColor(r), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(i), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1217
- const n = new w.Vector3(), a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, o = this.renderer.getPixelRatio();
1218
+ const n = new y.Vector3(), a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, o = this.renderer.getPixelRatio();
1218
1219
  for (const f of e) {
1219
1220
  n.setFromMatrixPosition(f.matrixWorld), n.project(this.camera);
1220
1221
  const h = (n.x + 1) / 2 * a, d = (n.y + 1) / 2 * l;
1221
- let p = 0, g = 1;
1222
- typeof this.clipArea == "number" ? g = this.clipArea : this.clipArea.endsWith("%") ? g = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1223
- const M = f.scale.x * g + 0.5, m = f.scale.y * g + 0.5, y = h - M / 2, E = d - m / 2, A = (y * this.qualityFactor - p) / o, C = (E * this.qualityFactor - p) / o, b = (M * this.qualityFactor + p * 2) / o, S = (m * this.qualityFactor + p * 2) / o;
1224
- this.renderer.setScissor(A, C, b, S), this.renderer.render(this.scene, this.camera);
1222
+ let m = 0, p = 1;
1223
+ typeof this.clipArea == "number" ? p = this.clipArea : this.clipArea.endsWith("%") ? p = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (m = parseFloat(this.clipArea));
1224
+ const R = f.scale.x * p + 0.5, v = f.scale.y * p + 0.5, b = h - R / 2, E = d - v / 2, M = (b * this.qualityFactor - m) / o, C = (E * this.qualityFactor - m) / o, w = (R * this.qualityFactor + m * 2) / o, x = (v * this.qualityFactor + m * 2) / o;
1225
+ this.renderer.setScissor(M, C, w, x), this.renderer.render(this.scene, this.camera);
1225
1226
  }
1226
1227
  this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(r, c);
1227
1228
  }
1228
1229
  render() {
1229
- for (let l = 0; l < N.MAX_LAYERS; l++) {
1230
+ for (let l = 0; l < V.MAX_LAYERS; l++) {
1230
1231
  const o = l + 1;
1231
1232
  this.captureRenderTarget(
1232
1233
  this.travelersByLayer[l],
1233
- O.getCaptureLayer(o),
1234
+ F.getCaptureLayer(o),
1234
1235
  this.renderTargets[l]
1235
1236
  );
1236
1237
  }
@@ -1238,9 +1239,9 @@ class ot {
1238
1239
  if (o && o.width > 0 && o.height > 0) {
1239
1240
  const f = Math.floor((o.x - n) * t), h = Math.floor(
1240
1241
  (i - (o.y - c + o.height)) * t
1241
- ), d = Math.ceil(o.width * t), p = Math.ceil(o.height * t);
1242
+ ), d = Math.ceil(o.width * t), m = Math.ceil(o.height * t);
1242
1243
  l.onBeforeRender = () => {
1243
- e.enable(e.SCISSOR_TEST), e.scissor(f, h, d, p);
1244
+ e.enable(e.SCISSOR_TEST), e.scissor(f, h, d, m);
1244
1245
  }, l.onAfterRender = () => {
1245
1246
  e.disable(e.SCISSOR_TEST);
1246
1247
  }, l.__hasScissorHook = !0;
@@ -1269,8 +1270,8 @@ class ot {
1269
1270
  return;
1270
1271
  let o;
1271
1272
  if (l.nodeType === Node.TEXT_NODE) {
1272
- const p = document.createRange();
1273
- p.selectNode(l), o = p.getBoundingClientRect();
1273
+ const m = document.createRange();
1274
+ m.selectNode(l), o = m.getBoundingClientRect();
1274
1275
  } else
1275
1276
  o = l.getBoundingClientRect();
1276
1277
  const f = a.userData.domRect;
@@ -1281,96 +1282,96 @@ class ot {
1281
1282
  width: o.width,
1282
1283
  height: o.height
1283
1284
  };
1284
- const p = a.userData.clipElements;
1285
- if (p && p.length > 0) {
1286
- let y = -1 / 0, E = -1 / 0, A = 1 / 0, C = 1 / 0;
1287
- for (const b of p) {
1288
- const S = b.getBoundingClientRect();
1289
- y = Math.max(y, S.left), E = Math.max(E, S.top), A = Math.min(A, S.right), C = Math.min(C, S.bottom);
1285
+ const m = a.userData.clipElements;
1286
+ if (m && m.length > 0) {
1287
+ let b = -1 / 0, E = -1 / 0, M = 1 / 0, C = 1 / 0;
1288
+ for (const w of m) {
1289
+ const x = w.getBoundingClientRect();
1290
+ b = Math.max(b, x.left), E = Math.max(E, x.top), M = Math.min(M, x.right), C = Math.min(C, x.bottom);
1290
1291
  }
1291
1292
  a.userData.scissorRect = {
1292
- x: y,
1293
+ x: b,
1293
1294
  y: E,
1294
- width: Math.max(0, A - y),
1295
+ width: Math.max(0, M - b),
1295
1296
  height: Math.max(0, C - E)
1296
1297
  };
1297
1298
  } else
1298
1299
  a.userData.scissorRect = void 0;
1299
- let g, M;
1300
+ let p, R;
1300
1301
  if (this.isViewport)
1301
- g = o.x - window.innerWidth / 2 + o.width / 2, M = -o.y + window.innerHeight / 2 - o.height / 2;
1302
+ p = o.x - window.innerWidth / 2 + o.width / 2, R = -o.y + window.innerHeight / 2 - o.height / 2;
1302
1303
  else {
1303
- const y = o.x - e, E = o.y - t;
1304
- g = y - r / 2 + o.width / 2, M = -E + c / 2 - o.height / 2;
1304
+ const b = o.x - e, E = o.y - t;
1305
+ p = b - r / 2 + o.width / 2, R = -E + c / 2 - o.height / 2;
1305
1306
  }
1306
- a.position.setX(g), a.position.setY(M);
1307
- let m = ((h = a.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1308
- if (a.scale.set(o.width + m * 2, o.height + m * 2, 1), a.updateMatrixWorld(), a.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(a.material, {
1307
+ a.position.setX(p), a.position.setY(R);
1308
+ let v = ((h = a.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1309
+ if (a.scale.set(o.width + v * 2, o.height + v * 2, 1), a.updateMatrixWorld(), a.material instanceof y.ShaderMaterial && P.forceUpdateUniforms(a.material, {
1309
1310
  width: o.width,
1310
1311
  height: o.height
1311
1312
  }), a.userData.nativeMesh) {
1312
- const y = a.userData.nativeMesh;
1313
- let E = o.width, A = o.height, C = g, b = M;
1313
+ const b = a.userData.nativeMesh;
1314
+ let E = o.width, M = o.height, C = p, w = R;
1314
1315
  if (a.userData.nativeTransform) {
1315
- const z = a.userData.nativeTransform, X = z.match(/scale\(([\d.]+%?)\)/);
1316
- if (X) {
1317
- let L = parseFloat(X[1]);
1318
- X[1].includes("%") && (L /= 100), E *= L, A *= L;
1316
+ const z = a.userData.nativeTransform, Y = z.match(/scale\(([\d.]+%?)\)/);
1317
+ if (Y) {
1318
+ let L = parseFloat(Y[1]);
1319
+ Y[1].includes("%") && (L /= 100), E *= L, M *= L;
1319
1320
  }
1320
- const B = z.match(/scaleX\(([\d.]+%?)\)/);
1321
- if (B) {
1322
- let L = parseFloat(B[1]);
1323
- B[1].includes("%") && (L /= 100), E *= L;
1321
+ const A = z.match(/scaleX\(([\d.]+%?)\)/);
1322
+ if (A) {
1323
+ let L = parseFloat(A[1]);
1324
+ A[1].includes("%") && (L /= 100), E *= L;
1324
1325
  }
1325
- const k = z.match(/scaleY\(([\d.]+%?)\)/);
1326
- if (k) {
1327
- let L = parseFloat(k[1]);
1328
- k[1].includes("%") && (L /= 100), A *= L;
1326
+ const N = z.match(/scaleY\(([\d.]+%?)\)/);
1327
+ if (N) {
1328
+ let L = parseFloat(N[1]);
1329
+ N[1].includes("%") && (L /= 100), M *= L;
1329
1330
  }
1330
- const j = z.match(/translate\(([^,]+),\s*([^)]+)\)/);
1331
- if (j) {
1332
- const L = j[1].trim(), _ = j[2].trim();
1333
- let K = parseFloat(L);
1334
- L.includes("%") && (K = K / 100 * o.width);
1335
- let U = parseFloat(_);
1336
- _.includes("%") && (U = U / 100 * o.height), C += K, b -= U;
1331
+ const B = z.match(/translate\(([^,]+),\s*([^)]+)\)/);
1332
+ if (B) {
1333
+ const L = B[1].trim(), U = B[2].trim();
1334
+ let Z = parseFloat(L);
1335
+ L.includes("%") && (Z = Z / 100 * o.width);
1336
+ let _ = parseFloat(U);
1337
+ U.includes("%") && (_ = _ / 100 * o.height), C += Z, w -= _;
1337
1338
  }
1338
- const J = z.match(/translateX\(([^)]+)\)/);
1339
+ const K = z.match(/translateX\(([^)]+)\)/);
1340
+ if (K) {
1341
+ const L = K[1].trim();
1342
+ let U = parseFloat(L);
1343
+ L.includes("%") && (U = U / 100 * o.width), C += U;
1344
+ }
1345
+ const J = z.match(/translateY\(([^)]+)\)/);
1339
1346
  if (J) {
1340
1347
  const L = J[1].trim();
1341
- let _ = parseFloat(L);
1342
- L.includes("%") && (_ = _ / 100 * o.width), C += _;
1343
- }
1344
- const Z = z.match(/translateY\(([^)]+)\)/);
1345
- if (Z) {
1346
- const L = Z[1].trim();
1347
- let _ = parseFloat(L);
1348
- L.includes("%") && (_ = _ / 100 * o.height), b -= _;
1348
+ let U = parseFloat(L);
1349
+ L.includes("%") && (U = U / 100 * o.height), w -= U;
1349
1350
  }
1350
1351
  }
1351
- let S = ((d = y.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1352
- y.position.setX(C), y.position.setY(b), y.scale.set(E + S * 2, A + S * 2, 1), y.updateMatrixWorld(), y.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(y.material, {
1352
+ let x = ((d = b.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1353
+ b.position.setX(C), b.position.setY(w), b.scale.set(E + x * 2, M + x * 2, 1), b.updateMatrixWorld(), b.material instanceof y.ShaderMaterial && P.forceUpdateUniforms(b.material, {
1353
1354
  width: E,
1354
- height: A
1355
+ height: M
1355
1356
  });
1356
1357
  }
1357
1358
  }
1358
1359
  });
1359
1360
  }
1360
1361
  }
1361
- function at(s) {
1362
+ function ht(s) {
1362
1363
  const e = s.textContent || "", t = [];
1363
1364
  let i = "", r = null, c = -1;
1364
1365
  const n = (o, f) => {
1365
1366
  for (let h = 0; h < o.length; h++) {
1366
- const d = o[h], p = document.createRange();
1367
- p.setStart(s, f + h), p.setEnd(s, f + h + 1);
1368
- const g = p.getBoundingClientRect();
1369
- if (g.width === 0 && g.height === 0) {
1367
+ const d = o[h], m = document.createRange();
1368
+ m.setStart(s, f + h), m.setEnd(s, f + h + 1);
1369
+ const p = m.getBoundingClientRect();
1370
+ if (p.width === 0 && p.height === 0) {
1370
1371
  i += d;
1371
1372
  continue;
1372
1373
  }
1373
- c === -1 || Math.abs(g.top - c) > g.height / 2 ? (i && r && t.push({
1374
+ c === -1 || Math.abs(p.top - c) > p.height / 2 ? (i && r && t.push({
1374
1375
  text: i,
1375
1376
  rect: {
1376
1377
  left: r.left,
@@ -1379,13 +1380,13 @@ function at(s) {
1379
1380
  height: r.bottom - r.top
1380
1381
  }
1381
1382
  }), i = d, r = {
1382
- left: g.left,
1383
- top: g.top,
1384
- right: g.right,
1385
- bottom: g.bottom
1386
- }, c = g.top) : (i += d, r && (r.left = Math.min(r.left, g.left), r.top = Math.min(r.top, g.top), r.right = Math.max(r.right, g.right), r.bottom = Math.max(
1383
+ left: p.left,
1384
+ top: p.top,
1385
+ right: p.right,
1386
+ bottom: p.bottom
1387
+ }, c = p.top) : (i += d, r && (r.left = Math.min(r.left, p.left), r.top = Math.min(r.top, p.top), r.right = Math.max(r.right, p.right), r.bottom = Math.max(
1387
1388
  r.bottom,
1388
- g.bottom
1389
+ p.bottom
1389
1390
  )));
1390
1391
  }
1391
1392
  }, a = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
@@ -1434,7 +1435,7 @@ function at(s) {
1434
1435
  (o) => o.text.trim().length > 0 && o.rect.width > 0 && o.rect.height > 0
1435
1436
  );
1436
1437
  }
1437
- function ke(s) {
1438
+ function Ue(s) {
1438
1439
  const e = parseFloat(s.fontSize);
1439
1440
  let t = parseFloat(s.lineHeight);
1440
1441
  isNaN(t) && (t = e * 1.2);
@@ -1450,74 +1451,74 @@ function ke(s) {
1450
1451
  letterSpacing: i
1451
1452
  };
1452
1453
  }
1453
- function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, c = 2, n, a, l) {
1454
- var K, U, V, ie, se, ne, he;
1454
+ function Xe(s, e = ie | fe | je | Se | me, t, i = 1, r = 0, c = 2, n, a, l) {
1455
+ var _, W, se, ne, oe, he, de;
1455
1456
  if (s.nodeType === Node.TEXT_NODE) {
1456
- const v = s;
1457
- if (!v.textContent || !v.textContent.trim())
1457
+ const g = s;
1458
+ if (!g.textContent || !g.textContent.trim())
1458
1459
  return null;
1459
- const x = v.textContent.replace(/\s+/g, " ");
1460
- if (x.length === 0)
1460
+ const S = g.textContent.replace(/\s+/g, " ");
1461
+ if (S.length === 0)
1461
1462
  return null;
1462
- const T = at(v);
1463
- if (T.length === 0)
1463
+ const k = ht(g);
1464
+ if (k.length === 0)
1464
1465
  return null;
1465
- const F = v.parentElement, D = F ? window.getComputedStyle(F) : null;
1466
- if (!D)
1466
+ const O = g.parentElement, I = O ? window.getComputedStyle(O) : null;
1467
+ if (!I)
1467
1468
  return null;
1468
- const $ = Math.min(...T.map((R) => R.rect.left)), Y = Math.min(...T.map((R) => R.rect.top)), Q = Math.max(...T.map((R) => R.rect.left + R.rect.width)), I = Math.max(...T.map((R) => R.rect.top + R.rect.height));
1469
+ const H = Math.min(...k.map((T) => T.rect.left)), X = Math.min(...k.map((T) => T.rect.top)), Q = Math.max(...k.map((T) => T.rect.left + T.rect.width)), D = Math.max(...k.map((T) => T.rect.top + T.rect.height));
1469
1470
  return {
1470
1471
  id: Math.random().toString(36).substring(2, 9),
1471
1472
  type: "TEXT",
1472
- element: v,
1473
+ element: g,
1473
1474
  rect: {
1474
- x: $ + window.scrollX,
1475
- y: Y + window.scrollY,
1476
- width: Q - $,
1477
- height: I - Y
1475
+ x: H + window.scrollX,
1476
+ y: X + window.scrollY,
1477
+ width: Q - H,
1478
+ height: D - X
1478
1479
  },
1479
1480
  styles: {
1480
1481
  backgroundColor: "transparent",
1481
1482
  backgroundImage: "",
1482
- opacity: F && F.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1483
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + r,
1483
+ opacity: O && O.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1484
+ zIndex: (isNaN(parseInt(I.zIndex)) ? 0 : parseInt(I.zIndex)) + r,
1484
1485
  borderRadius: "0px",
1485
1486
  borderColor: "transparent",
1486
1487
  borderWidth: "0px",
1487
1488
  isTraveler: !1
1488
1489
  },
1489
- textContent: x,
1490
- textLines: T.map((R) => ({
1491
- text: R.text.trim(),
1490
+ textContent: S,
1491
+ textLines: k.map((T) => ({
1492
+ text: T.text.trim(),
1492
1493
  rect: {
1493
- x: R.rect.left + window.scrollX,
1494
- y: R.rect.top + window.scrollY,
1495
- width: R.rect.width,
1496
- height: R.rect.height
1494
+ x: T.rect.left + window.scrollX,
1495
+ y: T.rect.top + window.scrollY,
1496
+ width: T.rect.width,
1497
+ height: T.rect.height
1497
1498
  }
1498
1499
  })),
1499
- textStyles: ke(D),
1500
+ textStyles: Ue(I),
1500
1501
  dirtyMask: e,
1501
1502
  visibility: t,
1502
1503
  isTraveler: !1,
1503
1504
  captureLayer: i,
1504
- isFixed: D.position === "fixed",
1505
+ isFixed: I.position === "fixed",
1505
1506
  nativeLayer: n,
1506
- nativeStyles: a ? te(te({
1507
+ nativeStyles: a ? re(re({
1507
1508
  backgroundColor: "transparent",
1508
1509
  backgroundImage: "",
1509
- opacity: F && F.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1510
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + r,
1510
+ opacity: O && O.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1511
+ zIndex: (isNaN(parseInt(I.zIndex)) ? 0 : parseInt(I.zIndex)) + r,
1511
1512
  borderRadius: "0px",
1512
1513
  borderColor: "transparent",
1513
1514
  borderWidth: "0px",
1514
1515
  isTraveler: !1
1515
- }, ke(D)), a) : void 0,
1516
+ }, Ue(I)), a) : void 0,
1516
1517
  nativeRect: a ? {
1517
- x: $ + window.scrollX,
1518
- y: Y + window.scrollY,
1519
- width: Q - $,
1520
- height: I - Y
1518
+ x: H + window.scrollX,
1519
+ y: X + window.scrollY,
1520
+ width: Q - H,
1521
+ height: D - X
1521
1522
  } : void 0,
1522
1523
  clipElements: l,
1523
1524
  children: []
@@ -1525,162 +1526,165 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, c = 2, n, a, l) {
1525
1526
  }
1526
1527
  if (s.nodeType !== Node.ELEMENT_NODE)
1527
1528
  return null;
1528
- const o = s, f = o.dataset[P.KEY];
1529
+ const o = s, f = o.dataset[G.KEY];
1529
1530
  let h = t, d = t;
1530
1531
  if (f) {
1531
- const v = new Set(f.split(/\s+/));
1532
- for (const x of v)
1533
- if (!Me.includes(x))
1532
+ const g = new Set(f.split(/\s+/));
1533
+ for (const S of g)
1534
+ if (!ke.includes(S))
1534
1535
  throw new Error(
1535
- `[MirageEngine] Invalid filter token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1536
+ `[MirageEngine] Invalid filter token: '${S}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1536
1537
  );
1537
- if (v.has(P.VALUES.END))
1538
+ if (g.has(G.VALUES.END))
1538
1539
  return null;
1539
- if (v.has(P.VALUES.INCLUDE_TREE) && v.has(P.VALUES.EXCLUDE_TREE))
1540
+ if (g.has(G.VALUES.INCLUDE_TREE) && g.has(G.VALUES.EXCLUDE_TREE))
1540
1541
  throw new Error(
1541
1542
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1542
1543
  );
1543
- if (v.has(P.VALUES.INCLUDE_SELF) && v.has(P.VALUES.EXCLUDE_SELF))
1544
+ if (g.has(G.VALUES.INCLUDE_SELF) && g.has(G.VALUES.EXCLUDE_SELF))
1544
1545
  throw new Error(
1545
1546
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1546
1547
  );
1547
- v.has(P.VALUES.INCLUDE_TREE) ? h = h | G : v.has(P.VALUES.EXCLUDE_TREE) && (h = h & ~G), d = h, v.has(P.VALUES.INCLUDE_SELF) ? d = d | G : v.has(P.VALUES.EXCLUDE_SELF) && (d = d & ~G);
1548
+ g.has(G.VALUES.INCLUDE_TREE) ? h = h | q : g.has(G.VALUES.EXCLUDE_TREE) && (h = h & ~q), d = h, g.has(G.VALUES.INCLUDE_SELF) ? d = d | q : g.has(G.VALUES.EXCLUDE_SELF) && (d = d & ~q);
1548
1549
  }
1549
- const p = o.dataset[q.KEY];
1550
- if (p) {
1551
- const v = new Set(p.split(/\s+/));
1552
- for (const x of v)
1553
- if (!Me.includes(x))
1550
+ const m = o.dataset[j.KEY];
1551
+ if (m) {
1552
+ const g = new Set(m.split(/\s+/));
1553
+ for (const S of g)
1554
+ if (!ke.includes(S))
1554
1555
  throw new Error(
1555
- `[MirageEngine] Invalid select token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1556
+ `[MirageEngine] Invalid select token: '${S}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1556
1557
  );
1557
- if (v.has(q.VALUES.END))
1558
+ if (g.has(j.VALUES.END))
1558
1559
  return null;
1559
- if (v.has(q.VALUES.INCLUDE_TREE) && v.has(q.VALUES.EXCLUDE_TREE))
1560
+ if (g.has(j.VALUES.INCLUDE_TREE) && g.has(j.VALUES.EXCLUDE_TREE))
1560
1561
  throw new Error(
1561
1562
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1562
1563
  );
1563
- if (v.has(q.VALUES.INCLUDE_SELF) && v.has(q.VALUES.EXCLUDE_SELF))
1564
+ if (g.has(j.VALUES.INCLUDE_SELF) && g.has(j.VALUES.EXCLUDE_SELF))
1564
1565
  throw new Error(
1565
1566
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1566
1567
  );
1567
- v.has(q.VALUES.INCLUDE_TREE) ? h = h | ae : v.has(q.VALUES.EXCLUDE_TREE) && (h = h & ~ae), d = h, v.has(q.VALUES.INCLUDE_SELF) ? d = d | ae : v.has(q.VALUES.EXCLUDE_SELF) && (d = d & ~ae);
1568
- }
1569
- const g = o.dataset[N.KEY];
1570
- let M = !1, m = a ? te({}, a) : {}, y = n;
1571
- if (g) {
1572
- let v = 1;
1573
- const x = g.indexOf("{"), T = g.lastIndexOf("}");
1574
- let F = g;
1575
- if (x !== -1 && T !== -1 && T > x) {
1576
- F = g.substring(0, x).trim();
1577
- const I = g.substring(x, T + 1);
1568
+ g.has(j.VALUES.INCLUDE_TREE) ? h = h | ae : g.has(j.VALUES.EXCLUDE_TREE) && (h = h & ~ae), d = h, g.has(j.VALUES.INCLUDE_SELF) ? d = d | ae : g.has(j.VALUES.EXCLUDE_SELF) && (d = d & ~ae);
1569
+ }
1570
+ const p = o.dataset[V.KEY];
1571
+ let R = !1, v = a ? re({}, a) : {}, b = n;
1572
+ if (p) {
1573
+ let g = 1;
1574
+ const S = p.indexOf("{"), k = p.lastIndexOf("}");
1575
+ let O = p;
1576
+ if (S !== -1 && k !== -1 && k > S) {
1577
+ O = p.substring(0, S).trim();
1578
+ const D = p.substring(S, k + 1);
1578
1579
  try {
1579
- m = new Function("return " + I)();
1580
- } catch (R) {
1580
+ v = new Function("return " + D)();
1581
+ } catch (T) {
1581
1582
  console.warn(
1582
- `[MirageEngine] Failed to parse travel styles JSON: ${I}`
1583
+ `[MirageEngine] Failed to parse travel styles JSON: ${D}`
1583
1584
  );
1584
1585
  }
1585
1586
  }
1586
- const D = F.split(/\s+/);
1587
- let $ = !1;
1588
- const Y = D.indexOf(N.VALUES.TRAVELER);
1589
- if (Y !== -1) {
1590
- M = !0, $ = !0;
1591
- const I = D[Y + 1];
1592
- if (I && !isNaN(parseInt(I, 10)))
1593
- v = parseInt(I, 10);
1587
+ const I = O.split(/\s+/);
1588
+ let H = !1;
1589
+ const X = I.indexOf(V.VALUES.TRAVELER);
1590
+ if (X !== -1) {
1591
+ R = !0, H = !0;
1592
+ const D = I[X + 1];
1593
+ if (D && !isNaN(parseInt(D, 10)))
1594
+ g = parseInt(D, 10);
1594
1595
  else {
1595
- const R = D.find((oe) => !isNaN(parseInt(oe, 10)));
1596
- R && (v = parseInt(R, 10));
1596
+ const T = I.find((ee) => !isNaN(parseInt(ee, 10)));
1597
+ T && (g = parseInt(T, 10));
1597
1598
  }
1598
1599
  }
1599
- const Q = D.indexOf(N.VALUES.NATIVE);
1600
+ const Q = I.indexOf(V.VALUES.NATIVE);
1600
1601
  if (Q !== -1) {
1601
- const I = D[Q + 1];
1602
- if (I && !isNaN(parseInt(I, 10)))
1603
- y = parseInt(I, 10);
1604
- else if (!M) {
1605
- const R = D.find((oe) => !isNaN(parseInt(oe, 10)));
1606
- R && (y = parseInt(R, 10));
1602
+ const D = I[Q + 1];
1603
+ if (D && !isNaN(parseInt(D, 10)))
1604
+ b = parseInt(D, 10);
1605
+ else if (!R) {
1606
+ const T = I.find((ee) => !isNaN(parseInt(ee, 10)));
1607
+ T && (b = parseInt(T, 10));
1607
1608
  }
1608
1609
  }
1609
- if ($) {
1610
- const I = v + 1;
1611
- if (I < i)
1610
+ if (H) {
1611
+ const D = g + 1;
1612
+ if (D < i)
1612
1613
  throw new Error(
1613
- `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${i - 1}).`
1614
+ `[MirageEngine] Traveler layer (${g}) cannot be smaller than inherited capture layer (${i - 1}).`
1614
1615
  );
1615
- i = Math.min(I, N.MAX_LAYERS + 1);
1616
+ i = Math.min(D, V.MAX_LAYERS + 1);
1616
1617
  }
1617
1618
  }
1618
- const E = o.dataset[Pe.KEY];
1619
- let A;
1620
- E && (A = JSON.parse(E));
1621
- const C = o.getBoundingClientRect(), b = window.getComputedStyle(o);
1622
- if (C.width === 0 || C.height === 0 || b.display === "none")
1619
+ const E = o.dataset[qe.KEY];
1620
+ let M;
1621
+ E && (M = JSON.parse(E));
1622
+ const C = o.getBoundingClientRect(), w = window.getComputedStyle(o);
1623
+ if (C.width === 0 || C.height === 0 || w.display === "none")
1623
1624
  return null;
1624
- let S = o.getAttribute("data-mid");
1625
- S || (S = Math.random().toString(36).substring(2, 11), o.setAttribute("data-mid", S));
1626
- const z = parseInt(b.zIndex), X = (isNaN(z) ? 0 : z) + r;
1627
- let B;
1625
+ let x = o.getAttribute("data-mid");
1626
+ x || (x = Math.random().toString(36).substring(2, 11), o.setAttribute("data-mid", x));
1627
+ const z = parseInt(w.zIndex), Y = (isNaN(z) ? 0 : z) + r;
1628
+ let A, N;
1628
1629
  if (o.tagName === "IMG")
1629
- B = o.src;
1630
+ A = o.src;
1630
1631
  else if (o.tagName.toLowerCase() === "svg") {
1631
- const v = o.cloneNode(!0), x = m == null ? void 0 : m.color, T = m == null ? void 0 : m.fill, F = m == null ? void 0 : m.stroke, D = m == null ? void 0 : m.opacity, $ = (R, oe) => {
1632
- const H = window.getComputedStyle(R), de = oe, ze = H.fill === H.color, Ne = H.stroke === H.color, me = T || (ze ? x : void 0) || H.fill;
1633
- me && me !== "none" && (de.style.fill = me);
1634
- const ve = F || (Ne ? x : void 0) || H.stroke;
1635
- ve && ve !== "none" && (de.style.stroke = ve), H.strokeWidth && H.strokeWidth !== "0px" && (de.style.strokeWidth = H.strokeWidth);
1636
- const Se = x || H.color;
1637
- Se && (de.style.color = Se);
1638
- const we = D || H.opacity;
1639
- we && we !== "1" && (de.style.opacity = we);
1640
- for (let fe = 0; fe < R.children.length; fe++)
1641
- $(R.children[fe], oe.children[fe]);
1632
+ const g = v == null ? void 0 : v.color, S = v == null ? void 0 : v.fill, k = v == null ? void 0 : v.stroke, O = v == null ? void 0 : v.opacity, I = (H) => {
1633
+ const X = o.cloneNode(!0), Q = (ve, Ce) => {
1634
+ const $ = window.getComputedStyle(ve), ue = Ce, Ve = $.fill === $.color, Ye = $.stroke === $.color, ye = (H ? S || (Ve ? g : void 0) : void 0) || $.fill;
1635
+ ye && ye !== "none" && (ue.style.fill = ye);
1636
+ const we = (H ? k || (Ye ? g : void 0) : void 0) || $.stroke;
1637
+ we && we !== "none" && (ue.style.stroke = we), $.strokeWidth && $.strokeWidth !== "0px" && (ue.style.strokeWidth = $.strokeWidth);
1638
+ const Te = (H ? g : void 0) || $.color;
1639
+ Te && (ue.style.color = Te);
1640
+ const be = (H ? O : void 0) || $.opacity;
1641
+ be && be !== "1" && (ue.style.opacity = be);
1642
+ for (let ge = 0; ge < ve.children.length; ge++)
1643
+ Q(ve.children[ge], Ce.children[ge]);
1644
+ };
1645
+ Q(o, X);
1646
+ const D = o.getBoundingClientRect(), T = window.devicePixelRatio * c;
1647
+ X.hasAttribute("viewBox") || X.setAttribute("viewBox", `0 0 ${D.width} ${D.height}`), X.setAttribute("width", (D.width * T).toString()), X.setAttribute("height", (D.height * T).toString());
1648
+ let ee = new XMLSerializer().serializeToString(X);
1649
+ return ee.includes("xmlns=") || (ee = ee.replace(
1650
+ "<svg",
1651
+ '<svg xmlns="http://www.w3.org/2000/svg"'
1652
+ )), `data:image/svg+xml;utf8,${encodeURIComponent(ee)}`;
1642
1653
  };
1643
- $(o, v);
1644
- const Y = o.getBoundingClientRect(), Q = window.devicePixelRatio * c;
1645
- v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${Y.width} ${Y.height}`), v.setAttribute("width", (Y.width * Q).toString()), v.setAttribute("height", (Y.height * Q).toString());
1646
- let I = new XMLSerializer().serializeToString(v);
1647
- I.includes("xmlns=") || (I = I.replace(
1648
- "<svg",
1649
- '<svg xmlns="http://www.w3.org/2000/svg"'
1650
- )), B = `data:image/svg+xml;utf8,${encodeURIComponent(I)}`;
1651
- } else if (b.backgroundImage && b.backgroundImage !== "none") {
1652
- const v = b.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1653
- v && (B = v[1]);
1654
- }
1655
- const k = {
1656
- backgroundColor: b.backgroundColor,
1657
- backgroundImage: b.backgroundImage,
1658
- opacity: o.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(b.opacity),
1659
- zIndex: X,
1660
- borderRadius: b.borderRadius,
1661
- borderColor: b.borderColor,
1662
- borderWidth: b.borderWidth,
1663
- boxShadow: b.boxShadow,
1664
- imageSrc: B,
1665
- isTraveler: M
1666
- }, j = k;
1667
- let J, Z;
1668
- const L = [], _ = b.overflow === "hidden" ? [...l || [], o] : l;
1669
- return o.tagName.toLowerCase() !== "svg" && Array.from(o.childNodes).forEach((v) => {
1670
- const x = v.nodeType === Node.TEXT_NODE ? d : h, T = Fe(
1671
- v,
1654
+ A = I(!1), b !== void 0 && (g || S || k || O) && (N = I(!0));
1655
+ } else if (w.backgroundImage && w.backgroundImage !== "none") {
1656
+ const g = w.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1657
+ g && (A = g[1]);
1658
+ }
1659
+ const B = {
1660
+ backgroundColor: w.backgroundColor,
1661
+ backgroundImage: w.backgroundImage,
1662
+ opacity: o.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(w.opacity),
1663
+ zIndex: Y,
1664
+ borderRadius: w.borderRadius,
1665
+ borderColor: w.borderColor,
1666
+ borderWidth: w.borderWidth,
1667
+ boxShadow: w.boxShadow,
1668
+ imageSrc: A,
1669
+ isTraveler: R
1670
+ }, K = B;
1671
+ let J, L;
1672
+ const U = [], Z = w.overflow === "hidden" ? [...l || [], o] : l;
1673
+ return o.tagName.toLowerCase() !== "svg" && Array.from(o.childNodes).forEach((g) => {
1674
+ const S = g.nodeType === Node.TEXT_NODE ? d : h, k = Xe(
1675
+ g,
1672
1676
  e,
1673
- x,
1677
+ S,
1674
1678
  i,
1675
- X,
1679
+ Y,
1676
1680
  c,
1677
- v.nodeType === Node.TEXT_NODE ? y : void 0,
1678
- v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0,
1679
- _
1681
+ g.nodeType === Node.TEXT_NODE ? b : void 0,
1682
+ g.nodeType === Node.TEXT_NODE && Object.keys(v).length > 0 ? v : void 0,
1683
+ Z
1680
1684
  );
1681
- T && L.push(T);
1685
+ k && U.push(k);
1682
1686
  }), {
1683
- id: S,
1687
+ id: x,
1684
1688
  type: "BOX",
1685
1689
  element: o,
1686
1690
  rect: {
@@ -1689,50 +1693,51 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, c = 2, n, a, l) {
1689
1693
  width: C.width,
1690
1694
  height: C.height
1691
1695
  },
1692
- styles: j,
1696
+ styles: K,
1693
1697
  textContent: J,
1694
- textStyles: Z,
1698
+ textStyles: L,
1695
1699
  dirtyMask: e,
1696
1700
  visibility: d,
1697
- isTraveler: M,
1701
+ isTraveler: R,
1698
1702
  captureLayer: i,
1699
- nativeLayer: y,
1700
- nativeStyles: y !== void 0 ? Ce(te({}, k), {
1701
- backgroundColor: (K = m.backgroundColor) != null ? K : k.backgroundColor,
1702
- backgroundImage: (U = m.backgroundImage) != null ? U : k.backgroundImage,
1703
- opacity: (V = m.opacity) != null ? V : k.opacity,
1704
- zIndex: m.zIndex !== void 0 ? m.zIndex + X : k.zIndex,
1705
- borderRadius: (ie = m.borderRadius) != null ? ie : k.borderRadius,
1706
- borderColor: (se = m.borderColor) != null ? se : k.borderColor,
1707
- borderWidth: (ne = m.borderWidth) != null ? ne : k.borderWidth,
1708
- boxShadow: (he = m.boxShadow) != null ? he : k.boxShadow,
1709
- isTraveler: k.isTraveler,
1710
- transform: m.transform
1703
+ nativeLayer: b,
1704
+ nativeStyles: b !== void 0 ? Le(re({}, B), {
1705
+ backgroundColor: (_ = v.backgroundColor) != null ? _ : B.backgroundColor,
1706
+ backgroundImage: (W = v.backgroundImage) != null ? W : B.backgroundImage,
1707
+ opacity: (se = v.opacity) != null ? se : B.opacity,
1708
+ zIndex: v.zIndex !== void 0 ? v.zIndex + Y : B.zIndex,
1709
+ borderRadius: (ne = v.borderRadius) != null ? ne : B.borderRadius,
1710
+ borderColor: (oe = v.borderColor) != null ? oe : B.borderColor,
1711
+ borderWidth: (he = v.borderWidth) != null ? he : B.borderWidth,
1712
+ boxShadow: (de = v.boxShadow) != null ? de : B.boxShadow,
1713
+ isTraveler: B.isTraveler,
1714
+ transform: v.transform,
1715
+ imageSrc: N != null ? N : A
1711
1716
  }) : void 0,
1712
- nativeRect: y !== void 0 ? {
1713
- x: m.x !== void 0 ? parseFloat(m.x) : C.left + window.scrollX,
1714
- y: m.y !== void 0 ? parseFloat(m.y) : C.top + window.scrollY,
1715
- width: m.width !== void 0 ? parseFloat(m.width) : C.width,
1716
- height: m.height !== void 0 ? parseFloat(m.height) : C.height
1717
+ nativeRect: b !== 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
1717
1722
  } : void 0,
1718
- isFixed: b.position === "fixed",
1723
+ isFixed: w.position === "fixed",
1719
1724
  clipElements: l,
1720
- children: L,
1721
- shaderHooks: A
1725
+ children: U,
1726
+ shaderHooks: M
1722
1727
  };
1723
1728
  }
1724
- function lt(s, e) {
1729
+ function dt(s, e) {
1725
1730
  e.size !== 0 && e.forEach((t, i) => {
1726
1731
  var c, n, a, l;
1727
1732
  const r = s.get(i);
1728
- !r || !r.userData.basePosition || (W.forceUpdateUniforms(r.material, {
1733
+ !r || !r.userData.basePosition || (P.forceUpdateUniforms(r.material, {
1729
1734
  backgroundColor: t.backgroundColor,
1730
1735
  backgroundImage: t.backgroundImage,
1731
1736
  boxShadow: t.boxShadow,
1732
1737
  opacity: t.opacity,
1733
1738
  borderRadius: (n = t.borderRadius) != null ? n : (c = r.userData.baseStyles) == null ? void 0 : c.borderRadius
1734
1739
  // width and height are no longer updated here, they are updated in syncMeshesByDOM
1735
- }), r.userData.nativeMesh && W.forceUpdateUniforms(r.userData.nativeMesh.material, {
1740
+ }), r.userData.nativeMesh && P.forceUpdateUniforms(r.userData.nativeMesh.material, {
1736
1741
  backgroundColor: t.backgroundColor,
1737
1742
  backgroundImage: t.backgroundImage,
1738
1743
  boxShadow: t.boxShadow,
@@ -1741,28 +1746,28 @@ function lt(s, e) {
1741
1746
  }));
1742
1747
  });
1743
1748
  }
1744
- class ct {
1749
+ class ut {
1745
1750
  constructor(e, t, i, r) {
1746
1751
  u(this, "target");
1747
1752
  u(this, "renderer");
1748
1753
  u(this, "registry");
1749
1754
  u(this, "isTravelEnabled", !1);
1750
1755
  u(this, "tracker");
1751
- this.target = e, this.renderer = t, this.registry = i, this.tracker = new Be(e, {
1756
+ this.target = e, this.renderer = t, this.registry = i, this.tracker = new Fe(e, {
1752
1757
  resizeDebounce: r.resizeDebounce
1753
1758
  }), this.tracker.onLayoutChange.add((c, n) => {
1754
- document.querySelector(`[${N.NAME}~='${N.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1755
- const l = Fe(
1759
+ document.querySelector(`[${V.NAME}~='${V.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1760
+ const l = Xe(
1756
1761
  this.target,
1757
1762
  c,
1758
- G,
1763
+ q,
1759
1764
  1,
1760
1765
  0,
1761
1766
  this.renderer.qualityFactor
1762
1767
  );
1763
1768
  l && this.renderer.syncScene(l, n);
1764
1769
  }), this.tracker.onStyleChange.add((c) => {
1765
- lt(this.registry, c);
1770
+ dt(this.registry, c);
1766
1771
  }), this.tracker.onRender.add(() => {
1767
1772
  this.renderer.syncMeshesByDOM(), this.renderer.render();
1768
1773
  });
@@ -1774,7 +1779,7 @@ class ct {
1774
1779
  this.tracker.stop();
1775
1780
  }
1776
1781
  }
1777
- class ht {
1782
+ class ft {
1778
1783
  constructor() {
1779
1784
  u(this, "store");
1780
1785
  this.store = /* @__PURE__ */ new WeakMap();
@@ -1799,17 +1804,17 @@ class ht {
1799
1804
  this.store.delete(e);
1800
1805
  }
1801
1806
  }
1802
- class dt {
1807
+ class gt {
1803
1808
  constructor(e, t) {
1804
1809
  u(this, "renderer");
1805
1810
  u(this, "syncer");
1806
1811
  u(this, "target");
1807
1812
  u(this, "registry");
1808
1813
  var r, c, n;
1809
- if (this.target = e, this.registry = new ht(), !document.getElementById("mirage-engine-styles")) {
1814
+ if (this.target = e, this.registry = new ft(), !document.getElementById("mirage-engine-styles")) {
1810
1815
  const a = document.createElement("style");
1811
1816
  a.id = "mirage-engine-styles", a.textContent = `
1812
- [${ee.NAME}="${ee.VALUES.HIDE}"] {
1817
+ [${te.NAME}="${te.VALUES.HIDE}"] {
1813
1818
  opacity: 0 !important;
1814
1819
  }
1815
1820
  `, document.head.appendChild(a);
@@ -1817,12 +1822,12 @@ class dt {
1817
1822
  let i;
1818
1823
  if (t.mode === "duplicate" ? i = (c = (r = t.container) != null ? r : this.target.parentElement) != null ? c : void 0 : i = (n = this.target.parentElement) != null ? n : void 0, !i)
1819
1824
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1820
- this.renderer = new ot(
1825
+ this.renderer = new ct(
1821
1826
  this.target,
1822
1827
  t,
1823
1828
  i,
1824
1829
  this.registry
1825
- ), this.renderer.mount(), this.syncer = new ct(this.target, this.renderer, this.registry, t);
1830
+ ), this.renderer.mount(), this.syncer = new ut(this.target, this.renderer, this.registry, t);
1826
1831
  }
1827
1832
  start() {
1828
1833
  this.syncer.start();
@@ -1865,7 +1870,7 @@ class dt {
1865
1870
  r();
1866
1871
  }
1867
1872
  }
1868
- class ut {
1873
+ class pt {
1869
1874
  constructor(e = {}) {
1870
1875
  u(this, "frontSelector");
1871
1876
  u(this, "midLayerElement");
@@ -1874,7 +1879,7 @@ class ut {
1874
1879
  u(this, "midLayer", null);
1875
1880
  u(this, "frontLayer", null);
1876
1881
  u(this, "tracker", null);
1877
- this.frontSelector = e.frontSelector || ".front", this.midLayerElement = e.midLayerElement || null, this.items = [], this.isInitialized = !1, this.tracker = new Be(document.body, e.trackerConfig || { resizeDebounce: !0 });
1882
+ this.frontSelector = e.frontSelector || ".front", this.midLayerElement = e.midLayerElement || null, this.items = [], this.isInitialized = !1, this.tracker = new Fe(document.body, e.trackerConfig || { resizeDebounce: !0 });
1878
1883
  }
1879
1884
  init() {
1880
1885
  var e;
@@ -1936,16 +1941,16 @@ class ut {
1936
1941
  });
1937
1942
  }
1938
1943
  }
1939
- class gt {
1944
+ class vt {
1940
1945
  constructor(e, t) {
1941
1946
  u(this, "_engine");
1942
1947
  u(this, "_sandwich");
1943
1948
  if (!e)
1944
1949
  throw new Error("[Mirage] Target element is required.");
1945
- if (this._engine = new dt(e, t), t.sandwich !== !1) {
1950
+ if (this._engine = new gt(e, t), t.sandwich !== !1) {
1946
1951
  const i = typeof t.sandwich == "object" ? t.sandwich : {};
1947
- this._sandwich = new ut({
1948
- frontSelector: i.frontSelector || `[${Le.NAME}='${Le.VALUES.FRONT}']`
1952
+ this._sandwich = new pt({
1953
+ frontSelector: i.frontSelector || `[${Ae.NAME}='${Ae.VALUES.FRONT}']`
1949
1954
  }), this._sandwich.useTracker(this._engine.getTracker());
1950
1955
  }
1951
1956
  }
@@ -1972,5 +1977,5 @@ class gt {
1972
1977
  }
1973
1978
  }
1974
1979
  export {
1975
- gt as Mirage
1980
+ vt as Mirage
1976
1981
  };