@mirage-engine/core 0.3.17 → 0.3.18

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,34 +1,34 @@
1
- var Oe = Object.defineProperty, Xe = Object.defineProperties;
2
- var _e = Object.getOwnPropertyDescriptors;
3
- var xe = Object.getOwnPropertySymbols;
4
- var Ne = Object.prototype.hasOwnProperty, ze = Object.prototype.propertyIsEnumerable;
5
- var ve = (r, e, t) => e in r ? Oe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, te = (r, e) => {
1
+ var Xe = Object.defineProperty, Ne = Object.defineProperties;
2
+ var ze = Object.getOwnPropertyDescriptors;
3
+ var Ee = Object.getOwnPropertySymbols;
4
+ var Ve = Object.prototype.hasOwnProperty, Ye = Object.prototype.propertyIsEnumerable;
5
+ var be = (i, e, t) => e in i ? Xe(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, te = (i, e) => {
6
6
  for (var t in e || (e = {}))
7
- Ne.call(e, t) && ve(r, t, e[t]);
8
- if (xe)
9
- for (var t of xe(e))
10
- ze.call(e, t) && ve(r, t, e[t]);
11
- return r;
12
- }, Se = (r, e) => Xe(r, _e(e));
13
- var p = (r, e, t) => (ve(r, typeof e != "symbol" ? e + "" : e, t), t);
14
- var Ee = (r, e, t) => new Promise((i, s) => {
15
- var c = (n) => {
7
+ Ve.call(e, t) && be(i, t, e[t]);
8
+ if (Ee)
9
+ for (var t of Ee(e))
10
+ Ye.call(e, t) && be(i, t, e[t]);
11
+ return i;
12
+ }, Ce = (i, e) => Ne(i, ze(e));
13
+ var g = (i, e, t) => (be(i, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var Te = (i, e, t) => new Promise((r, s) => {
15
+ var l = (c) => {
16
16
  try {
17
- a(t.next(n));
18
- } catch (l) {
19
- s(l);
17
+ n(t.next(c));
18
+ } catch (a) {
19
+ s(a);
20
20
  }
21
- }, o = (n) => {
21
+ }, o = (c) => {
22
22
  try {
23
- a(t.throw(n));
24
- } catch (l) {
25
- s(l);
23
+ n(t.throw(c));
24
+ } catch (a) {
25
+ s(a);
26
26
  }
27
- }, a = (n) => n.done ? i(n.value) : Promise.resolve(n.value).then(c, o);
28
- a((t = t.apply(r, e)).next());
27
+ }, n = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(l, o);
28
+ n((t = t.apply(i, e)).next());
29
29
  });
30
30
  import * as w from "three";
31
- const De = {
31
+ const Ie = {
32
32
  INCLUDE_TREE: "include-tree",
33
33
  EXCLUDE_TREE: "exclude-tree",
34
34
  INCLUDE_SELF: "include-self",
@@ -41,7 +41,7 @@ const De = {
41
41
  HIDE: "hide",
42
42
  SHOW: "show"
43
43
  }
44
- }, Ce = {
44
+ }, Re = {
45
45
  TRAVELER: "traveler",
46
46
  NATIVE: "native",
47
47
  CAPTURE_1: "1",
@@ -54,31 +54,31 @@ const De = {
54
54
  CAPTURE_8: "8",
55
55
  CAPTURE_9: "9",
56
56
  CAPTURE_10: "10"
57
- }, _ = {
57
+ }, N = {
58
58
  NAME: "data-mirage-travel",
59
59
  KEY: "mirageTravel",
60
- VALUES: Ce,
61
- MAX_LAYERS: Object.keys(Ce).length - 1
62
- }, G = {
60
+ VALUES: Re,
61
+ MAX_LAYERS: Object.keys(Re).length - 1
62
+ }, H = {
63
63
  NAME: "data-mirage-filter",
64
64
  KEY: "mirageFilter",
65
- VALUES: De
66
- }, j = {
65
+ VALUES: Ie
66
+ }, $ = {
67
67
  NAME: "data-mirage-select",
68
68
  KEY: "mirageSelect",
69
- VALUES: De
70
- }, Ve = {
69
+ VALUES: Ie
70
+ }, Pe = {
71
71
  NAME: "data-mirage-shader",
72
72
  KEY: "mirageShader"
73
- }, ct = {
73
+ }, dt = {
74
74
  NAME: "data-mirage-sandwich",
75
75
  KEY: "mirageSandwich",
76
76
  VALUES: {
77
77
  FRONT: "front"
78
78
  }
79
- }, ue = 0, re = 1, he = 2, Ye = 4, fe = 8, we = 16;
80
- function We(r) {
81
- const e = r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
79
+ }, ge = 0, re = 1, ue = 2, We = 4, pe = 8, ye = 16;
80
+ function He(i) {
81
+ const e = i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
82
82
  return e ? {
83
83
  r: parseInt(e[1]) / 255,
84
84
  g: parseInt(e[2]) / 255,
@@ -86,46 +86,46 @@ function We(r) {
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 Pe(r) {
89
+ function Ge(i) {
90
90
  const e = {};
91
- if (r.opacity && (e.opacity = parseFloat(r.opacity)), r.backgroundColor) {
92
- const t = We(r.backgroundColor);
91
+ if (i.opacity && (e.opacity = parseFloat(i.opacity)), i.backgroundColor) {
92
+ const t = He(i.backgroundColor);
93
93
  e.backgroundColor = [t.r, t.g, t.b, t.a];
94
94
  }
95
- if (r.backgroundImage ? e.backgroundImage = r.backgroundImage : r.background && (e.backgroundImage = r.background), r.boxShadow && (e.boxShadow = r.boxShadow), r.borderRadius && (e.borderRadius = parseFloat(r.borderRadius)), r.width && (e.width = parseFloat(r.width)), r.height && (e.height = parseFloat(r.height)), r.transform && r.transform !== "none") {
96
- const t = new DOMMatrix(r.transform);
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
97
  e.x = t.m41, e.y = t.m42, e.z = t.m43;
98
98
  }
99
99
  return e;
100
100
  }
101
- class He {
101
+ class qe {
102
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", ue);
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 |= re | he, this.cssTimer = window.setTimeout(() => {
103
+ g(this, "target");
104
+ g(this, "observer");
105
+ g(this, "pendingDeletions", /* @__PURE__ */ new Set());
106
+ g(this, "pendingStyles", /* @__PURE__ */ new Map());
107
+ g(this, "isDomDirty", !1);
108
+ g(this, "isRunning", !1);
109
+ g(this, "pendingMask", ge);
110
+ g(this, "mutationTimer", null);
111
+ g(this, "cssTimer", null);
112
+ g(this, "resizeConfig");
113
+ g(this, "resizeTimer", null);
114
+ g(this, "isResizing", !1);
115
+ g(this, "lastScrollX", 0);
116
+ g(this, "lastScrollY", 0);
117
+ g(this, "scrollTimer", null);
118
+ g(this, "onBeforeRender", /* @__PURE__ */ new Set());
119
+ g(this, "onLayoutChange", /* @__PURE__ */ new Set());
120
+ g(this, "onStyleChange", /* @__PURE__ */ new Set());
121
+ g(this, "onScrollChange", /* @__PURE__ */ new Set());
122
+ g(this, "onRender", /* @__PURE__ */ new Set());
123
+ g(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(() => {
125
125
  this.isDomDirty = !0, this.cssTimer = null;
126
126
  }, 50)));
127
127
  });
128
- p(this, "onWindowResize", () => {
128
+ g(this, "onWindowResize", () => {
129
129
  if (!this.resizeConfig.enabled) {
130
130
  this.isDomDirty = !0;
131
131
  return;
@@ -134,41 +134,41 @@ class He {
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
+ g(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 = ue);
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 = ge);
141
141
  const e = window.scrollX, t = window.scrollY;
142
- (e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((i) => i(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
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
143
  this.pendingMask |= re, this.isDomDirty = !0, this.scrollTimer = null;
144
- }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((i) => i(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((i) => i()), requestAnimationFrame(this.renderLoop);
144
+ }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((r) => r(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((r) => r()), requestAnimationFrame(this.renderLoop);
145
145
  });
146
- var s, c;
146
+ var s, l;
147
147
  this.target = e;
148
- const i = (s = t.resizeDebounce) != null ? s : !0;
149
- i === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : i === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
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 = {
150
150
  enabled: !0,
151
- delay: (c = i.delay) != null ? c : 150,
152
- onStart: i.onStart,
153
- onEnd: i.onEnd
151
+ delay: (l = r.delay) != null ? l : 150,
152
+ onStart: r.onStart,
153
+ onEnd: r.onEnd
154
154
  }, this.observer = new MutationObserver((o) => {
155
- let a = ue;
156
- for (const n of o)
157
- if (n.type === "childList")
158
- a |= fe, n.removedNodes.length > 0 && n.removedNodes.forEach((l) => {
159
- l instanceof HTMLElement && this.pendingDeletions.add(l);
155
+ let n = ge;
156
+ for (const c of o)
157
+ if (c.type === "childList")
158
+ n |= pe, c.removedNodes.length > 0 && c.removedNodes.forEach((a) => {
159
+ a instanceof HTMLElement && this.pendingDeletions.add(a);
160
160
  });
161
- else if (n.type === "attributes")
162
- if (n.attributeName === "style") {
163
- a |= re | he;
164
- const l = n.target, d = Pe(l.style);
165
- this.pendingStyles.set(l, d);
161
+ else if (c.type === "attributes")
162
+ if (c.attributeName === "style") {
163
+ n |= re | ue;
164
+ const a = c.target, u = Ge(a.style);
165
+ this.pendingStyles.set(a, u);
166
166
  } else
167
- n.attributeName === "class" ? a |= re | he : n.attributeName && n.attributeName.startsWith("data-") && (a |= re | he, n.attributeName.startsWith("data-mirage") && (a |= fe));
167
+ c.attributeName === "class" ? n |= re | ue : c.attributeName && c.attributeName.startsWith("data-") && (n |= re | ue, c.attributeName.startsWith("data-mirage") && (n |= pe));
168
168
  else
169
- n.type === "characterData" && (a |= we | re);
170
- if (a !== ue) {
171
- if (this.pendingMask |= a, a & fe) {
169
+ c.type === "characterData" && (n |= ye | re);
170
+ if (n !== ge) {
171
+ if (this.pendingMask |= n, n & pe) {
172
172
  this.clearTimers(), this.isDomDirty = !0;
173
173
  return;
174
174
  }
@@ -193,13 +193,13 @@ class He {
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 q = 1, ae = 2, ht = 0, B = {
196
+ const G = 1, ae = 2, ut = 0, F = {
197
197
  BASE: 0,
198
198
  SELECTED: 1,
199
- getCaptureLayer: (r) => 31 - r,
199
+ getCaptureLayer: (i) => 31 - i,
200
200
  HIDDEN: 31
201
- }, Te = Object.values(G.VALUES);
202
- class Ae {
201
+ }, Me = Object.values(H.VALUES);
202
+ class ke {
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")
@@ -214,166 +214,166 @@ class Ae {
214
214
  static calculateBaselineFromDOM(e) {
215
215
  if (typeof document == "undefined")
216
216
  return 0;
217
- const t = document.createElement("div"), i = 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", i.style.margin = "0", i.style.padding = "0", i.style.border = "none", i.style.lineHeight = "normal", s.width = 1, s.height = 1, s.style.verticalAlign = "baseline", i.appendChild(document.createTextNode("Hidden Text")), t.appendChild(i), t.appendChild(s), document.body.appendChild(t);
219
- const c = s.offsetTop - i.offsetTop;
220
- return document.body.removeChild(t), c;
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 l = s.offsetTop - r.offsetTop;
220
+ return document.body.removeChild(t), l;
221
221
  }
222
222
  }
223
- p(Ae, "cache", /* @__PURE__ */ new Map());
224
- class Ge extends w.MeshBasicMaterial {
225
- constructor(t, i, s, c, o = 2) {
223
+ g(ke, "cache", /* @__PURE__ */ new Map());
224
+ class $e extends w.MeshBasicMaterial {
225
+ constructor(t, r, s, l, o = 2) {
226
226
  super({
227
227
  transparent: !0,
228
228
  side: w.FrontSide,
229
229
  color: 16777215
230
230
  });
231
- p(this, "canvas");
232
- p(this, "ctx");
233
- p(this, "qualityFactor");
231
+ g(this, "canvas");
232
+ g(this, "ctx");
233
+ g(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, i, s, c);
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, l);
237
237
  }
238
- wrapText(t, i) {
238
+ wrapText(t, r) {
239
239
  const s = t.split(`
240
- `), c = [];
240
+ `), l = [];
241
241
  return s.forEach((o) => {
242
- const a = o.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
- if (a.length === 0) {
244
- c.push("");
242
+ const n = o.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
+ if (n.length === 0) {
244
+ l.push("");
245
245
  return;
246
246
  }
247
- let n = a[0];
248
- for (let l = 1; l < a.length; l++) {
249
- const d = a[l];
250
- this.ctx.measureText(n + d).width <= i + 2 ? n += d : (n && c.push(n), n = d.trimStart());
247
+ let c = n[0];
248
+ for (let a = 1; a < n.length; a++) {
249
+ const u = n[a];
250
+ this.ctx.measureText(c + u).width <= r + 2 ? c += u : (c && l.push(c), c = u.trimStart());
251
251
  }
252
- n && c.push(n);
253
- }), c;
252
+ c && l.push(c);
253
+ }), l;
254
254
  }
255
- updateText(t, i, s, c, o) {
255
+ updateText(t, r, s, l, o) {
256
256
  o !== void 0 && (this.qualityFactor = o);
257
- const n = (window.devicePixelRatio || 1) * this.qualityFactor, l = s * n, d = c * n;
258
- this.canvas.width !== l || this.canvas.height !== d ? (this.canvas.width = l, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(n, 0, 0, n, 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, s), u = i.lineHeight, f = Ae.getBaseline(i.font);
260
- h.forEach((g, v) => {
261
- const b = v * u + f;
262
- let C = 0;
263
- i.textAlign === "center" ? C = s / 2 : i.textAlign === "right" && (C = s), this.ctx.textAlign = i.textAlign, this.ctx.fillText(g, C, b);
257
+ const c = (window.devicePixelRatio || 1) * this.qualityFactor, a = s * c, u = l * c;
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(c, 0, 0, c, 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, p = ke.getBaseline(r.font);
260
+ h.forEach((f, L) => {
261
+ const m = L * d + p;
262
+ let b = 0;
263
+ r.textAlign === "center" ? b = s / 2 : r.textAlign === "right" && (b = s), this.ctx.textAlign = r.textAlign, this.ctx.fillText(f, b, m);
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 ne(r, e = 0) {
271
- if (typeof r == "number")
272
- return r;
273
- const t = parseFloat(r) || 0;
274
- return typeof r == "string" && r.includes("%") ? t / 100 * e : t;
270
+ function ce(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;
275
275
  }
276
- function le(r) {
277
- if (!r || r === "transparent")
276
+ function le(i) {
277
+ if (!i || i === "transparent")
278
278
  return { color: new w.Color(16777215), alpha: 0 };
279
- const e = r.match(
279
+ const e = i.match(
280
280
  /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
281
281
  );
282
282
  if (e) {
283
- const t = parseInt(e[1], 10), i = 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}, ${i}, ${s})`), alpha: c };
283
+ const t = parseInt(e[1], 10), r = parseInt(e[2], 10), s = parseInt(e[3], 10), l = e[4] !== void 0 ? parseFloat(e[4]) : 1;
284
+ return { color: new w.Color(`rgb(${t}, ${r}, ${s})`), alpha: l };
285
285
  }
286
- return { color: new w.Color(r), alpha: 1 };
286
+ return { color: new w.Color(i), alpha: 1 };
287
287
  }
288
- function Ie(r) {
288
+ function Ue(i) {
289
289
  const e = [];
290
- let t = "", i = 0;
291
- for (let s = 0; s < r.length; s++) {
292
- const c = r[s];
293
- if (c === "(")
294
- i++;
295
- else if (c === ")")
296
- i--;
297
- else if (c === "," && i === 0) {
290
+ let t = "", r = 0;
291
+ for (let s = 0; s < i.length; s++) {
292
+ const l = i[s];
293
+ if (l === "(")
294
+ r++;
295
+ else if (l === ")")
296
+ r--;
297
+ else if (l === "," && r === 0) {
298
298
  e.push(t.trim()), t = "";
299
299
  continue;
300
300
  }
301
- t += c;
301
+ t += l;
302
302
  }
303
303
  return t && e.push(t.trim()), e;
304
304
  }
305
- function qe(r) {
306
- if (!r || typeof r != "string" || !r.includes("linear-gradient"))
305
+ function je(i) {
306
+ if (!i || typeof i != "string" || !i.includes("linear-gradient"))
307
307
  return null;
308
- const e = r.match(/linear-gradient\((.*)\)/);
308
+ const e = i.match(/linear-gradient\((.*)\)/);
309
309
  if (!e)
310
310
  return null;
311
- const t = e[1], i = Ie(t);
312
- let s = Math.PI, c = 0;
313
- const o = i[0].trim();
311
+ const t = e[1], r = Ue(t);
312
+ let s = Math.PI, l = 0;
313
+ const o = r[0].trim();
314
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;
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), l = 1;
316
316
  else if (o.endsWith("deg") || o.endsWith("rad") || o.endsWith("turn")) {
317
- const n = parseFloat(o);
318
- o.endsWith("deg") ? s = n * (Math.PI / 180) : o.endsWith("rad") ? s = n : o.endsWith("turn") && (s = n * Math.PI * 2), c = 1;
319
- }
320
- const a = [];
321
- for (let n = c; n < i.length && !(a.length >= 8); n++) {
322
- const l = i[n].trim(), d = l.lastIndexOf(" ");
323
- let h = l, u = null;
324
- if (d !== -1 && !l.endsWith(")")) {
325
- const g = l.substring(d + 1);
326
- (g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = l.substring(0, d).trim(), u = g);
317
+ const c = parseFloat(o);
318
+ o.endsWith("deg") ? s = c * (Math.PI / 180) : o.endsWith("rad") ? s = c : o.endsWith("turn") && (s = c * Math.PI * 2), l = 1;
319
+ }
320
+ const n = [];
321
+ for (let c = l; c < r.length && !(n.length >= 8); c++) {
322
+ const a = r[c].trim(), u = a.lastIndexOf(" ");
323
+ let h = a, d = null;
324
+ if (u !== -1 && !a.endsWith(")")) {
325
+ const f = a.substring(u + 1);
326
+ (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = a.substring(0, u).trim(), d = f);
327
327
  }
328
- const f = le(h);
329
- a.push({
330
- color: f.color,
331
- alpha: f.alpha,
332
- rawStop: u,
328
+ const p = le(h);
329
+ n.push({
330
+ color: p.color,
331
+ alpha: p.alpha,
332
+ rawStop: d,
333
333
  stop: 0
334
334
  });
335
335
  }
336
- if (a.length > 0) {
337
- for (let l = 0; l < a.length; l++)
338
- a[l].rawStop !== null && (a[l].stop = parseFloat(a[l].rawStop) / 100);
339
- a[0].rawStop === null && (a[0].stop = 0), a.length > 1 && a[a.length - 1].rawStop === null && (a[a.length - 1].stop = 1);
340
- let n = 0;
341
- for (let l = 1; l < a.length; l++)
342
- if (a[l].rawStop !== null || l === a.length - 1) {
343
- const d = l - n;
344
- if (d > 1) {
345
- const h = a[n].stop, f = (a[l].stop - h) / d;
346
- for (let g = 1; g < d; g++)
347
- a[n + g].stop = h + f * g;
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 c = 0;
341
+ for (let a = 1; a < n.length; a++)
342
+ if (n[a].rawStop !== null || a === n.length - 1) {
343
+ const u = a - c;
344
+ if (u > 1) {
345
+ const h = n[c].stop, p = (n[a].stop - h) / u;
346
+ for (let f = 1; f < u; f++)
347
+ n[c + f].stop = h + p * f;
348
348
  }
349
- n = l;
349
+ c = a;
350
350
  }
351
351
  }
352
- return { angle: s, stops: a };
352
+ return { angle: s, stops: n };
353
353
  }
354
- function $e(r) {
355
- if (!r || r === "none")
354
+ function Ke(i) {
355
+ if (!i || i === "none")
356
356
  return null;
357
- const e = Ie(r);
357
+ const e = Ue(i);
358
358
  if (e.length === 0)
359
359
  return null;
360
- const t = e[0].trim(), i = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, s = t.match(i);
361
- let c = "transparent", o = t;
360
+ const t = e[0].trim(), r = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, s = t.match(r);
361
+ let l = "transparent", o = t;
362
362
  if (s && s[1] !== "inset") {
363
- const f = s[1];
364
- (f.startsWith("rgb") || f.startsWith("#") || f === "black" || f === "white" || f === "transparent") && (c = f, o = t.replace(f, "").trim());
363
+ const p = s[1];
364
+ (p.startsWith("rgb") || p.startsWith("#") || p === "black" || p === "white" || p === "transparent") && (l = p, o = t.replace(p, "").trim());
365
365
  }
366
366
  o = o.replace("inset", "").trim();
367
- const a = o.split(/\s+/).map((f) => parseFloat(f) || 0), n = a[0] || 0, l = a[1] || 0, d = a[2] || 0, h = a[3] || 0, u = le(c);
368
- return { offsetX: n, offsetY: l, blurRadius: d, spreadRadius: h, color: u.color, alpha: u.alpha };
367
+ const n = o.split(/\s+/).map((p) => parseFloat(p) || 0), c = n[0] || 0, a = n[1] || 0, u = n[2] || 0, h = n[3] || 0, d = le(l);
368
+ return { offsetX: c, offsetY: a, blurRadius: u, spreadRadius: h, color: d.color, alpha: d.alpha };
369
369
  }
370
- const je = `varying vec2 vUv;
370
+ const Je = `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
- }`, Ke = `varying vec2 vUv;
376
+ }`, Ze = `varying vec2 vUv;
377
377
  uniform vec2 uSize;
378
378
  uniform vec2 uMeshSize;
379
379
  uniform vec4 uShadowColor;
@@ -532,40 +532,40 @@ void main() {
532
532
 
533
533
  // #include <colorspace_fragment>
534
534
  }
535
- `, Je = `uniform sampler2D uTexture;
535
+ `, Qe = `uniform sampler2D uTexture;
536
536
  varying vec4 vScreenPos;
537
537
  uniform vec2 uTextureRepeat;
538
- uniform vec2 uTextureOffset;`, Ze = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
538
+ uniform vec2 uTextureOffset;`, et = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
539
539
  vec2 resultUv = screenUv;
540
540
 
541
- `, Qe = `vec4 texColor = texture2D(uTexture, resultUv);
542
- baseColor = blendSrcOver(baseColor, texColor);`, Re = {
543
- vertexShader: je,
544
- fragmentShader: Ke
545
- }, Me = {
546
- declChunk: Je,
547
- uvChunk: Ze,
548
- baseColorChunk: Qe
541
+ `, tt = `vec4 texColor = texture2D(uTexture, resultUv);
542
+ baseColor = blendSrcOver(baseColor, texColor);`, Le = {
543
+ vertexShader: Je,
544
+ fragmentShader: Ze
545
+ }, De = {
546
+ declChunk: Qe,
547
+ uvChunk: et,
548
+ baseColorChunk: tt
549
549
  };
550
- function et(r, e, t, i = null, s) {
551
- var S;
552
- const c = i !== null || !!r.imageSrc;
550
+ function rt(i, e, t, r = null, s) {
551
+ var C;
552
+ const l = r !== null || !!i.imageSrc;
553
553
  let o = "";
554
- const a = {};
554
+ const n = {};
555
555
  if (s != null && s.uniforms)
556
- for (const [R, E] of Object.entries(s.uniforms))
557
- typeof E == "number" ? (o += `uniform float ${R};
558
- `, a[R] = { value: E }) : Array.isArray(E) ? E.length === 2 ? (o += `uniform vec2 ${R};
559
- `, a[R] = { value: new w.Vector2(...E) }) : E.length === 3 ? (o += `uniform vec3 ${R};
560
- `, a[R] = { value: new w.Vector3(...E) }) : E.length === 4 && (o += `uniform vec4 ${R};
561
- `, a[R] = { value: new w.Vector4(...E) }) : (o += `uniform float ${R};
562
- `, a[R] = { value: E });
563
- const n = s !== void 0, l = (c || n ? Me.declChunk : "") + `
564
- ` + o, d = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
565
- `, h = r.isTraveler ? `vec2 resultUv = screenUv;
556
+ for (const [y, S] of Object.entries(s.uniforms))
557
+ typeof S == "number" ? (o += `uniform float ${y};
558
+ `, n[y] = { value: S }) : Array.isArray(S) ? S.length === 2 ? (o += `uniform vec2 ${y};
559
+ `, n[y] = { value: new w.Vector2(...S) }) : S.length === 3 ? (o += `uniform vec3 ${y};
560
+ `, n[y] = { value: new w.Vector3(...S) }) : S.length === 4 && (o += `uniform vec4 ${y};
561
+ `, n[y] = { value: new w.Vector4(...S) }) : (o += `uniform float ${y};
562
+ `, n[y] = { value: S });
563
+ const c = s !== void 0, a = (l || c ? De.declChunk : "") + `
564
+ ` + o, u = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
565
+ `, h = i.isTraveler ? `vec2 resultUv = screenUv;
566
566
  ` : `vec2 localUv = (p / uSize) + 0.5;
567
567
  vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
568
- `, u = c || n ? d + h + ((s == null ? void 0 : s.uvModifier) || "") : "", f = c || n ? Me.baseColorChunk : "", g = (s == null ? void 0 : s.colorModifier) || "", v = Re.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", u).replace("#INJECT_BASE_COLOR", f).replace("#INJECT_COLOR_MODIFIER", g), b = le(r.backgroundColor), C = le(r.borderColor), I = {
568
+ `, d = l || c ? u + h + ((s == null ? void 0 : s.uvModifier) || "") : "", p = l || c ? De.baseColorChunk : "", f = (s == null ? void 0 : s.colorModifier) || "", L = Le.fragmentShader.replace("#INJECT_DECLARATIONS", a).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", f), m = le(i.backgroundColor), b = le(i.borderColor), E = {
569
569
  uSize: { value: new w.Vector2(e, t) },
570
570
  uMeshSize: { value: new w.Vector2(e, t) },
571
571
  uShadowColor: { value: new w.Vector4(0, 0, 0, 0) },
@@ -574,23 +574,23 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
574
574
  uShadowSpread: { value: 0 },
575
575
  uBgColor: {
576
576
  value: new w.Vector4(
577
- b.color.r,
578
- b.color.g,
579
- b.color.b,
580
- b.alpha
577
+ m.color.r,
578
+ m.color.g,
579
+ m.color.b,
580
+ m.alpha
581
581
  )
582
582
  },
583
583
  uBorderColor: {
584
584
  value: new w.Vector4(
585
- C.color.r,
586
- C.color.g,
587
- C.color.b,
588
- C.alpha
585
+ b.color.r,
586
+ b.color.g,
587
+ b.color.b,
588
+ b.alpha
589
589
  )
590
590
  },
591
591
  uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
592
- uBorderWidth: { value: ne(r.borderWidth) },
593
- uOpacity: { value: (S = r.opacity) != null ? S : 1 },
592
+ uBorderWidth: { value: ce(i.borderWidth) },
593
+ uOpacity: { value: (C = i.opacity) != null ? C : 1 },
594
594
  uTexture: { value: null },
595
595
  uTextureRepeat: { value: new w.Vector2(1, 1) },
596
596
  uTextureOffset: { value: new w.Vector2(0, 0) },
@@ -601,24 +601,24 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
601
601
  },
602
602
  uGradientStops: { value: new Float32Array(8) }
603
603
  };
604
- ke(I.uBorderRadius.value, r.borderRadius, Math.min(e, t)), c && (I.uTexture.value = i);
605
- const D = new w.ShaderMaterial({
606
- uniforms: te(te({}, I), a),
607
- vertexShader: Re.vertexShader,
608
- fragmentShader: v,
604
+ Be(E.uBorderRadius.value, i.borderRadius, Math.min(e, t)), l && (E.uTexture.value = r);
605
+ const A = new w.ShaderMaterial({
606
+ uniforms: te(te({}, E), n),
607
+ vertexShader: Le.vertexShader,
608
+ fragmentShader: L,
609
609
  transparent: !0,
610
610
  side: w.FrontSide
611
611
  // for better performance
612
612
  });
613
- return r.backgroundImage && be(D, { backgroundImage: r.backgroundImage }), D;
613
+ return i.backgroundImage && xe(A, { backgroundImage: i.backgroundImage }), A;
614
614
  }
615
- function tt(r, e, t, i, s) {
616
- const c = ne(e.borderWidth);
617
- be(r, {
615
+ function it(i, e, t, r, s) {
616
+ const l = ce(e.borderWidth);
617
+ xe(i, {
618
618
  width: t,
619
- height: i,
619
+ height: r,
620
620
  borderRadius: e.borderRadius,
621
- borderWidth: c,
621
+ borderWidth: l,
622
622
  backgroundColor: e.backgroundColor,
623
623
  borderColor: e.borderColor,
624
624
  opacity: e.opacity,
@@ -627,24 +627,24 @@ function tt(r, e, t, i, s) {
627
627
  boxShadow: e.boxShadow
628
628
  });
629
629
  }
630
- function be(r, e) {
631
- var i, s, c;
630
+ function xe(i, e) {
631
+ var r, s, l;
632
632
  if (e.boxShadow !== void 0) {
633
- const o = $e(e.boxShadow);
634
- o ? (r.uniforms.uShadowColor.value.set(o.color.r, o.color.g, o.color.b, o.alpha), r.uniforms.uShadowOffset.value.set(o.offsetX, o.offsetY), r.uniforms.uShadowBlur.value = o.blurRadius, r.uniforms.uShadowSpread.value = o.spreadRadius, r.userData.shadowPadding = o.blurRadius + o.spreadRadius + Math.max(Math.abs(o.offsetX), Math.abs(o.offsetY))) : (r.uniforms.uShadowColor.value.w = 0, r.userData.shadowPadding = 0);
633
+ const o = Ke(e.boxShadow);
634
+ 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);
635
635
  }
636
- if (e.width !== void 0 && e.height !== void 0 && r.uniforms.uSize.value.set(e.width, e.height), r.uniforms.uMeshSize) {
637
- const o = r.userData.shadowPadding || 0, a = e.width !== void 0 ? e.width : r.uniforms.uSize.value.x, n = e.height !== void 0 ? e.height : r.uniforms.uSize.value.y;
638
- r.uniforms.uMeshSize.value.set(a + o * 2, n + o * 2);
636
+ if (e.width !== void 0 && e.height !== void 0 && i.uniforms.uSize.value.set(e.width, e.height), i.uniforms.uMeshSize) {
637
+ const o = i.userData.shadowPadding || 0, n = e.width !== void 0 ? e.width : i.uniforms.uSize.value.x, c = e.height !== void 0 ? e.height : i.uniforms.uSize.value.y;
638
+ i.uniforms.uMeshSize.value.set(n + o * 2, c + o * 2);
639
639
  }
640
640
  if (e.borderRadius !== void 0) {
641
- const o = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(r.uniforms.uSize.value.x, r.uniforms.uSize.value.y);
642
- ke(r.uniforms.uBorderRadius.value, e.borderRadius, o);
641
+ 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);
642
+ Be(i.uniforms.uBorderRadius.value, e.borderRadius, o);
643
643
  }
644
- if (e.borderWidth !== void 0 && (r.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
644
+ if (e.borderWidth !== void 0 && (i.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
645
645
  if (Array.isArray(e.backgroundColor)) {
646
- const o = e.backgroundColor[3] !== void 0 ? e.backgroundColor[3] : r.uniforms.uBgColor.value.w;
647
- r.uniforms.uBgColor.value.set(
646
+ const o = e.backgroundColor[3] !== void 0 ? e.backgroundColor[3] : i.uniforms.uBgColor.value.w;
647
+ i.uniforms.uBgColor.value.set(
648
648
  e.backgroundColor[0],
649
649
  e.backgroundColor[1],
650
650
  e.backgroundColor[2],
@@ -652,15 +652,15 @@ function be(r, e) {
652
652
  );
653
653
  } else if (typeof e.backgroundColor == "string") {
654
654
  const o = le(e.backgroundColor);
655
- r.uniforms.uBgColor.value.set(
655
+ i.uniforms.uBgColor.value.set(
656
656
  o.color.r,
657
657
  o.color.g,
658
658
  o.color.b,
659
659
  o.alpha
660
660
  );
661
661
  } else {
662
- const o = r.uniforms.uBgColor.value.w;
663
- r.uniforms.uBgColor.value.set(
662
+ const o = i.uniforms.uBgColor.value.w;
663
+ i.uniforms.uBgColor.value.set(
664
664
  e.backgroundColor.r,
665
665
  e.backgroundColor.g,
666
666
  e.backgroundColor.b,
@@ -669,8 +669,8 @@ function be(r, e) {
669
669
  }
670
670
  if (e.borderColor !== void 0)
671
671
  if (Array.isArray(e.borderColor)) {
672
- const o = r.uniforms.uBorderColor.value.w;
673
- r.uniforms.uBorderColor.value.set(
672
+ const o = i.uniforms.uBorderColor.value.w;
673
+ i.uniforms.uBorderColor.value.set(
674
674
  e.borderColor[0],
675
675
  e.borderColor[1],
676
676
  e.borderColor[2],
@@ -678,122 +678,122 @@ function be(r, e) {
678
678
  );
679
679
  } else if (typeof e.borderColor == "string") {
680
680
  const o = le(e.borderColor);
681
- r.uniforms.uBorderColor.value.set(
681
+ i.uniforms.uBorderColor.value.set(
682
682
  o.color.r,
683
683
  o.color.g,
684
684
  o.color.b,
685
685
  o.alpha
686
686
  );
687
687
  } else {
688
- const o = r.uniforms.uBorderColor.value.w;
689
- r.uniforms.uBorderColor.value.set(
688
+ const o = i.uniforms.uBorderColor.value.w;
689
+ i.uniforms.uBorderColor.value.set(
690
690
  e.borderColor.r,
691
691
  e.borderColor.g,
692
692
  e.borderColor.b,
693
693
  o
694
694
  );
695
695
  }
696
- e.opacity !== void 0 && (r.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (r.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (r.uniforms.uBorderColor.value.w = e.borderOpacity), r.uniforms.uTexture && e.texture !== void 0 && (r.uniforms.uTexture.value = e.texture);
697
- const t = e.texture !== void 0 ? e.texture : (i = r.uniforms.uTexture) == null ? void 0 : i.value;
696
+ 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);
697
+ const t = e.texture !== void 0 ? e.texture : (r = i.uniforms.uTexture) == null ? void 0 : r.value;
698
698
  if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
699
- const o = t.image.naturalWidth || t.image.videoWidth || t.image.width, a = t.image.naturalHeight || t.image.videoHeight || t.image.height, n = (s = e.width) != null ? s : r.uniforms.uSize.value.x, l = (c = e.height) != null ? c : r.uniforms.uSize.value.y;
700
- if (o && a && n && l) {
701
- const d = o / a, h = n / l;
702
- if (d > h) {
703
- const u = h / d;
704
- r.uniforms.uTextureRepeat.value.set(u, 1), r.uniforms.uTextureOffset.value.set((1 - u) / 2, 0);
699
+ const o = t.image.naturalWidth || t.image.videoWidth || t.image.width, n = t.image.naturalHeight || t.image.videoHeight || t.image.height, c = (s = e.width) != null ? s : i.uniforms.uSize.value.x, a = (l = e.height) != null ? l : i.uniforms.uSize.value.y;
700
+ if (o && n && c && a) {
701
+ const u = o / n, h = c / a;
702
+ if (u > h) {
703
+ const d = h / u;
704
+ i.uniforms.uTextureRepeat.value.set(d, 1), i.uniforms.uTextureOffset.value.set((1 - d) / 2, 0);
705
705
  } else {
706
- const u = d / h;
707
- r.uniforms.uTextureRepeat.value.set(1, u), r.uniforms.uTextureOffset.value.set(0, (1 - u) / 2);
706
+ const d = u / h;
707
+ i.uniforms.uTextureRepeat.value.set(1, d), i.uniforms.uTextureOffset.value.set(0, (1 - d) / 2);
708
708
  }
709
709
  }
710
710
  } else
711
- r.uniforms.uTextureRepeat && (r.uniforms.uTextureRepeat.value.set(1, 1), r.uniforms.uTextureOffset.value.set(0, 0));
711
+ i.uniforms.uTextureRepeat && (i.uniforms.uTextureRepeat.value.set(1, 1), i.uniforms.uTextureOffset.value.set(0, 0));
712
712
  if (e.backgroundImage !== void 0) {
713
- const o = qe(e.backgroundImage);
713
+ const o = je(e.backgroundImage);
714
714
  if (o) {
715
- r.uniforms.uGradientCount.value = o.stops.length, r.uniforms.uGradientAngle.value = o.angle;
716
- for (let a = 0; a < 8; a++)
717
- if (a < o.stops.length) {
718
- const n = o.stops[a];
719
- r.uniforms.uGradientColors.value[a].set(
720
- n.color.r,
721
- n.color.g,
722
- n.color.b,
723
- n.alpha
724
- ), r.uniforms.uGradientStops.value[a] = n.stop;
715
+ i.uniforms.uGradientCount.value = o.stops.length, i.uniforms.uGradientAngle.value = o.angle;
716
+ for (let n = 0; n < 8; n++)
717
+ if (n < o.stops.length) {
718
+ const c = o.stops[n];
719
+ i.uniforms.uGradientColors.value[n].set(
720
+ c.color.r,
721
+ c.color.g,
722
+ c.color.b,
723
+ c.alpha
724
+ ), i.uniforms.uGradientStops.value[n] = c.stop;
725
725
  } else
726
- r.uniforms.uGradientColors.value[a].set(0, 0, 0, 0), r.uniforms.uGradientStops.value[a] = 1;
726
+ i.uniforms.uGradientColors.value[n].set(0, 0, 0, 0), i.uniforms.uGradientStops.value[n] = 1;
727
727
  } else
728
- r.uniforms.uGradientCount.value = 0;
728
+ i.uniforms.uGradientCount.value = 0;
729
729
  }
730
730
  for (const o of Object.keys(e))
731
- o !== "width" && o !== "height" && o !== "borderRadius" && o !== "borderWidth" && o !== "backgroundColor" && o !== "borderColor" && o !== "opacity" && o !== "bgOpacity" && o !== "borderOpacity" && o !== "texture" && o !== "backgroundImage" && o !== "boxShadow" && r.uniforms[o] !== void 0 && (r.uniforms[o].value !== void 0 && r.uniforms[o].value !== null && typeof r.uniforms[o].value.set == "function" ? Array.isArray(e[o]) ? r.uniforms[o].value.set(...e[o]) : e[o] !== void 0 && (e[o].copy ? r.uniforms[o].value.copy(e[o]) : r.uniforms[o].value = e[o]) : r.uniforms[o].value = e[o]);
731
+ 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]);
732
732
  }
733
- function ke(r, e, t = 0) {
734
- var n, l, d, h;
733
+ function Be(i, e, t = 0) {
734
+ var c, a, u, h;
735
735
  if (e == null) {
736
- r.set(0, 0, 0, 0);
736
+ i.set(0, 0, 0, 0);
737
737
  return;
738
738
  }
739
739
  if (typeof e == "number") {
740
- r.set(e, e, e, e);
740
+ i.set(e, e, e, e);
741
741
  return;
742
742
  }
743
743
  if (Array.isArray(e)) {
744
- r.set(e[0], e[1], e[2], e[3]);
744
+ i.set(e[0], e[1], e[2], e[3]);
745
745
  return;
746
746
  }
747
- const i = e.split("/")[0].trim().split(/\s+/), s = ne(i[0], t), c = ne((n = i[1]) != null ? n : i[0], t), o = ne((l = i[2]) != null ? l : i[0], t), a = ne((h = (d = i[3]) != null ? d : i[1]) != null ? h : i[0], t);
748
- r.set(s, c, o, a);
747
+ const r = e.split("/")[0].trim().split(/\s+/), s = ce(r[0], t), l = ce((c = r[1]) != null ? c : r[0], t), o = ce((a = r[2]) != null ? a : r[0], t), n = ce((h = (u = r[3]) != null ? u : r[1]) != null ? h : r[0], t);
748
+ i.set(s, l, o, n);
749
749
  }
750
- const W = {
751
- create(r, e, t, i, s, c = 2, o = null, a) {
752
- return r === "BOX" ? et(
750
+ const P = {
751
+ create(i, e, t, r, s, l = 2, o = null, n) {
752
+ return i === "BOX" ? rt(
753
753
  e,
754
- i,
754
+ r,
755
755
  s,
756
756
  o,
757
- a
758
- ) : r === "TEXT" ? new Ge(
757
+ n
758
+ ) : i === "TEXT" ? new $e(
759
759
  t || "",
760
760
  e,
761
- i,
761
+ r,
762
762
  s,
763
- c
763
+ l
764
764
  ) : new w.MeshBasicMaterial({ visible: !1 });
765
765
  },
766
- update(r, e, t, i, s, c, o = 2, a) {
767
- e === "BOX" ? tt(
768
- r,
766
+ update(i, e, t, r, s, l, o = 2, n) {
767
+ e === "BOX" ? it(
768
+ i,
769
769
  t,
770
770
  s,
771
- c,
772
- a
773
- ) : e === "TEXT" && r.updateText(
774
- i || "",
771
+ l,
772
+ n
773
+ ) : e === "TEXT" && i.updateText(
774
+ r || "",
775
775
  t,
776
776
  s,
777
- c,
777
+ l,
778
778
  o
779
779
  );
780
780
  },
781
- forceUpdateUniforms(r, e) {
782
- be(r, e);
781
+ forceUpdateUniforms(i, e) {
782
+ xe(i, e);
783
783
  }
784
784
  };
785
- class rt {
785
+ class st {
786
786
  constructor(e, t = !0) {
787
- p(this, "observer");
788
- p(this, "textures", /* @__PURE__ */ new WeakMap());
789
- p(this, "loadStatus", /* @__PURE__ */ new WeakMap());
790
- p(this, "elementUrls", /* @__PURE__ */ new WeakMap());
791
- p(this, "onUpdate");
787
+ g(this, "observer");
788
+ g(this, "textures", /* @__PURE__ */ new WeakMap());
789
+ g(this, "loadStatus", /* @__PURE__ */ new WeakMap());
790
+ g(this, "elementUrls", /* @__PURE__ */ new WeakMap());
791
+ g(this, "onUpdate");
792
792
  this.onUpdate = e, t && (this.observer = new IntersectionObserver(
793
- (i) => {
794
- for (const s of i) {
795
- const c = s.target;
796
- s.isIntersecting ? this.loadTexture(c) : this.disposeTexture(c);
793
+ (r) => {
794
+ for (const s of r) {
795
+ const l = s.target;
796
+ s.isIntersecting ? this.loadTexture(l) : this.disposeTexture(l);
797
797
  }
798
798
  },
799
799
  { rootMargin: "300px" }
@@ -808,31 +808,31 @@ class rt {
808
808
  e.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(e), this.disposeTexture(e), this.elementUrls.delete(e), this.loadStatus.delete(e);
809
809
  }
810
810
  loadTexture(e) {
811
- return Ee(this, null, function* () {
811
+ return Te(this, null, function* () {
812
812
  if (this.loadStatus.get(e) || this.textures.has(e))
813
813
  return;
814
814
  const t = this.elementUrls.get(e);
815
815
  if (t) {
816
816
  this.loadStatus.set(e, !0);
817
817
  try {
818
- let i;
818
+ let r;
819
819
  if (t.startsWith("data:image/svg+xml"))
820
- i = yield new Promise((c, o) => {
821
- const a = new Image();
822
- a.onload = () => c(a), a.onerror = o, a.src = t;
820
+ r = yield new Promise((l, o) => {
821
+ const n = new Image();
822
+ n.onload = () => l(n), n.onerror = o, n.src = t;
823
823
  });
824
824
  else {
825
825
  const o = yield (yield fetch(t)).blob();
826
- i = yield createImageBitmap(o, { imageOrientation: "flipY" });
826
+ r = yield createImageBitmap(o, { imageOrientation: "flipY" });
827
827
  }
828
828
  if (this.elementUrls.get(e) !== t) {
829
- "close" in i && i.close();
829
+ "close" in r && r.close();
830
830
  return;
831
831
  }
832
- const s = new w.Texture(i);
833
- i instanceof HTMLImageElement || (s.flipY = !1), s.colorSpace = w.LinearSRGBColorSpace, s.needsUpdate = !0, this.textures.set(e, s), this.onUpdate(e, s);
834
- } catch (i) {
835
- console.warn("[MirageEngine] Failed to load texture:", t, i);
832
+ const s = new w.Texture(r);
833
+ r instanceof HTMLImageElement || (s.flipY = !1), s.colorSpace = w.LinearSRGBColorSpace, s.needsUpdate = !0, this.textures.set(e, s), this.onUpdate(e, s);
834
+ } catch (r) {
835
+ console.warn("[MirageEngine] Failed to load texture:", t, r);
836
836
  } finally {
837
837
  this.elementUrls.has(e) && this.loadStatus.set(e, !1);
838
838
  }
@@ -850,40 +850,40 @@ class rt {
850
850
  this.observer && this.observer.disconnect();
851
851
  }
852
852
  }
853
- class it {
854
- constructor(e, t, i, s) {
855
- p(this, "canvas");
856
- p(this, "scene");
857
- p(this, "camera");
858
- p(this, "renderer");
859
- p(this, "renderTargets", []);
860
- p(this, "renderOrder", 0);
861
- p(this, "qualityFactor", 2);
862
- p(this, "mode", "overlay");
863
- p(this, "canvasSize", "viewport");
864
- p(this, "clipArea", 1);
865
- p(this, "targetLayer", "base");
866
- p(this, "overscan", 200);
867
- p(this, "target");
868
- p(this, "mountContainer");
869
- p(this, "registry");
870
- p(this, "targetRect");
871
- p(this, "travelersByLayer", Array.from(
872
- { length: _.MAX_LAYERS },
853
+ class ot {
854
+ constructor(e, t, r, s) {
855
+ g(this, "canvas");
856
+ g(this, "scene");
857
+ g(this, "camera");
858
+ g(this, "renderer");
859
+ g(this, "renderTargets", []);
860
+ g(this, "renderOrder", 0);
861
+ g(this, "qualityFactor", 2);
862
+ g(this, "mode", "overlay");
863
+ g(this, "canvasSize", "viewport");
864
+ g(this, "clipArea", 1);
865
+ g(this, "targetLayer", "base");
866
+ g(this, "overscan", 200);
867
+ g(this, "target");
868
+ g(this, "mountContainer");
869
+ g(this, "registry");
870
+ g(this, "targetRect");
871
+ g(this, "travelersByLayer", Array.from(
872
+ { length: N.MAX_LAYERS },
873
873
  () => /* @__PURE__ */ new Set()
874
874
  ));
875
- p(this, "textureManager");
875
+ g(this, "textureManager");
876
876
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
877
- p(this, "fixedMeshes", /* @__PURE__ */ new Set());
878
- var a, n, l, d, h;
879
- this.target = e, this.mountContainer = i, this.registry = s, this.mode = (a = t.mode) != null ? a : "overlay", this.canvasSize = (n = t.canvasSize) != null ? n : "viewport", this.clipArea = (l = t.travelerClipArea) != null ? l : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new rt((u, f) => {
880
- const g = this.registry.get(u);
881
- g && g.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(g.material, { texture: f });
877
+ g(this, "fixedMeshes", /* @__PURE__ */ new Set());
878
+ var n, c, a, u, h;
879
+ this.target = e, this.mountContainer = r, this.registry = s, this.mode = (n = t.mode) != null ? n : "overlay", this.canvasSize = (c = t.canvasSize) != null ? c : "viewport", this.clipArea = (a = t.travelerClipArea) != null ? a : 1, this.targetLayer = (u = t.layer) != null ? u : "base", this.textureManager = new st((d, p) => {
880
+ const f = this.registry.get(d);
881
+ f && f.material instanceof w.ShaderMaterial && P.forceUpdateUniforms(f.material, { texture: p });
882
882
  }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new w.Scene(), this.targetRect = this.target.getBoundingClientRect();
883
- const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, o = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
883
+ const l = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, o = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
884
884
  this.camera = new w.OrthographicCamera(
885
- c / -2,
886
- c / 2,
885
+ l / -2,
886
+ l / 2,
887
887
  o / 2,
888
888
  o / -2,
889
889
  1,
@@ -894,21 +894,21 @@ class it {
894
894
  antialias: !0
895
895
  // [new]
896
896
  // premultipliedAlpha: true
897
- }), 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");
897
+ }), w.ColorManagement.enabled = !1, this.renderer.outputColorSpace = w.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(l, o), this.applyTextQuality((h = t.quality) != null ? h : "medium");
898
898
  }
899
899
  get isViewport() {
900
900
  return this.mode === "overlay" && this.canvasSize === "viewport";
901
901
  }
902
902
  getSceneLayer() {
903
- return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? B.SELECTED : B.BASE;
903
+ return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? F.SELECTED : F.BASE;
904
904
  }
905
905
  createRenderTarget() {
906
- for (let e = 0; e < _.MAX_LAYERS; e++) {
907
- const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, i = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
906
+ for (let e = 0; e < N.MAX_LAYERS; e++) {
907
+ const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
908
908
  this.renderTargets.push(
909
909
  new w.WebGLRenderTarget(
910
910
  t * this.qualityFactor,
911
- i * this.qualityFactor,
911
+ r * this.qualityFactor,
912
912
  {
913
913
  minFilter: w.LinearFilter,
914
914
  magFilter: w.LinearFilter,
@@ -948,14 +948,14 @@ class it {
948
948
  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");
949
949
  }
950
950
  updateUniforms(e, t) {
951
- const i = this.registry.get(e);
952
- i && (i.traverse((s) => {
953
- s.isMesh && s.material && W.forceUpdateUniforms(
951
+ const r = this.registry.get(e);
952
+ r && (r.traverse((s) => {
953
+ s.isMesh && s.material && P.forceUpdateUniforms(
954
954
  s.material,
955
955
  t
956
956
  );
957
- }), i.userData.nativeMesh && i.userData.nativeMesh.traverse((s) => {
958
- s.isMesh && s.material && W.forceUpdateUniforms(
957
+ }), r.userData.nativeMesh && r.userData.nativeMesh.traverse((s) => {
958
+ s.isMesh && s.material && P.forceUpdateUniforms(
959
959
  s.material,
960
960
  t
961
961
  );
@@ -966,23 +966,23 @@ class it {
966
966
  }
967
967
  setSize(e, t) {
968
968
  this.renderer.setSize(e, t);
969
- for (const i of this.renderTargets)
970
- i.setSize(e * this.qualityFactor, t * this.qualityFactor);
969
+ for (const r of this.renderTargets)
970
+ r.setSize(e * this.qualityFactor, t * this.qualityFactor);
971
971
  this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
972
972
  }
973
973
  syncScene(e, t) {
974
- const i = this.target.getBoundingClientRect(), s = this.isViewport ? window.innerWidth + this.overscan * 2 : i.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : i.height, o = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, a = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, n = Math.abs(s - o) > 0.1 || Math.abs(c - a) > 0.1, l = this.mode === "overlay" && (Math.abs(i.top - this.targetRect.top) > 0.1 || Math.abs(i.left - this.targetRect.left) > 0.1);
975
- n ? (this.targetRect = i, this.setSize(s, c), this.updateCanvasLayout()) : l ? (this.targetRect = i, this.updateCanvasLayout()) : this.targetRect = i, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
976
- const h = this.registry.get(d);
974
+ const r = this.target.getBoundingClientRect(), s = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, l = 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, c = Math.abs(s - o) > 0.1 || Math.abs(l - 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);
975
+ c ? (this.targetRect = r, this.setSize(s, l), this.updateCanvasLayout()) : a ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((u) => {
976
+ const h = this.registry.get(u);
977
977
  if (h) {
978
978
  this.scene.remove(h);
979
- for (const u of this.travelersByLayer)
980
- u.delete(h);
979
+ for (const d of this.travelersByLayer)
980
+ d.delete(h);
981
981
  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
- (u) => u.dispose()
983
- ) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((u) => {
984
- u instanceof w.Mesh && (u.geometry && u.geometry.dispose(), u.material && (Array.isArray(u.material) ? u.material.forEach((f) => f.dispose()) : u.material.dispose()));
985
- }), this.registry.remove(d), this.textureManager.unregister(d);
982
+ (d) => d.dispose()
983
+ ) : 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
+ }), this.registry.remove(u), this.textureManager.unregister(u);
986
986
  }
987
987
  });
988
988
  }
@@ -991,24 +991,24 @@ class it {
991
991
  // => 이후 activeElements를 이용하여 mesh를 정리!!!+ map에서도 삭제
992
992
  // private reconcileNode(node: SceneNode, activeElements: Set<HTMLElement>) {
993
993
  reconcileNode(e) {
994
- var s, c;
994
+ var s, l;
995
995
  let t = this.registry.get(e.element);
996
- 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 o = new w.PlaneGeometry(1, 1), a = e.isTraveler ? (s = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : s.texture : this.textureManager.get(e.element), n = W.create(
996
+ const r = JSON.stringify(e.shaderHooks || null);
997
+ 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) {
998
+ 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), c = P.create(
999
999
  "BOX",
1000
1000
  e.styles,
1001
1001
  "",
1002
1002
  e.rect.width,
1003
1003
  e.rect.height,
1004
1004
  this.qualityFactor,
1005
- a,
1005
+ n,
1006
1006
  e.shaderHooks
1007
1007
  );
1008
- t = new w.Mesh(o, n), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = n, t.userData.domElement = e.element, t.userData.shaderHash = i;
1008
+ t = new w.Mesh(o, c), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = c, t.userData.domElement = e.element, t.userData.shaderHash = r;
1009
1009
  }
1010
- if ((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 o = 0; o < _.MAX_LAYERS; o++)
1010
+ if (t.userData.clipElements = e.clipElements, (l = e.nativeStyles) != null && l.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 o = 0; o < N.MAX_LAYERS; o++)
1012
1012
  o === e.captureLayer - 2 ? this.travelersByLayer[o].add(t) : this.travelersByLayer[o].delete(t);
1013
1013
  else
1014
1014
  for (const o of this.travelersByLayer)
@@ -1023,371 +1023,404 @@ class it {
1023
1023
  !0
1024
1024
  ));
1025
1025
  }
1026
- reconcileTextChild(e, t, i) {
1027
- var l;
1026
+ reconcileTextChild(e, t, r) {
1027
+ var a;
1028
1028
  const s = t.textLines || [
1029
1029
  { text: t.textContent || "", rect: t.rect }
1030
- ], c = i ? t.nativeStyles : t.textStyles, o = JSON.stringify(c) + t.textContent + s.map((d) => d.text).join("|"), a = (l = e.userData) == null ? void 0 : l.textChildStyleHash;
1031
- if (t.dirtyMask & we || o !== a) {
1030
+ ], l = r ? t.nativeStyles : t.textStyles, o = JSON.stringify(l) + t.textContent + s.map((u) => u.text).join("|"), n = (a = e.userData) == null ? void 0 : a.textChildStyleHash;
1031
+ if (t.dirtyMask & ye || o !== n) {
1032
1032
  e.children.filter(
1033
- (g) => g.name.startsWith("TEXT_CHILD")
1034
- ).forEach((g) => {
1035
- var b;
1036
- const v = g;
1037
- (b = v.material.map) == null || b.dispose(), v.geometry.dispose(), e.remove(v);
1033
+ (f) => f.name.startsWith("TEXT_CHILD")
1034
+ ).forEach((f) => {
1035
+ var m;
1036
+ const L = f;
1037
+ (m = L.material.map) == null || m.dispose(), L.geometry.dispose(), e.remove(L);
1038
1038
  });
1039
- const h = t.rect, u = h.x + h.width / 2, f = h.y + h.height / 2;
1040
- s.forEach((g, v) => {
1041
- const b = W.create(
1039
+ const h = t.rect, d = h.x + h.width / 2, p = h.y + h.height / 2;
1040
+ s.forEach((f, L) => {
1041
+ const m = P.create(
1042
1042
  "TEXT",
1043
- c,
1044
- g.text,
1045
- g.rect.width,
1046
- g.rect.height,
1043
+ l,
1044
+ f.text,
1045
+ f.rect.width,
1046
+ f.rect.height,
1047
1047
  this.qualityFactor
1048
- ), C = new w.PlaneGeometry(1, 1), I = new w.Mesh(C, b);
1049
- I.name = `TEXT_CHILD_${v}`;
1050
- const D = t.rect.width === 0 ? 1 : g.rect.width / t.rect.width, S = t.rect.height === 0 ? 1 : g.rect.height / t.rect.height;
1051
- I.scale.set(D, S, 1);
1052
- const R = g.rect.x + g.rect.width / 2, E = g.rect.y + g.rect.height / 2, V = R - u, N = -(E - f);
1053
- I.position.set(
1054
- t.rect.width === 0 ? 0 : V / t.rect.width,
1055
- t.rect.height === 0 ? 0 : N / t.rect.height,
1048
+ ), b = new w.PlaneGeometry(1, 1), E = new w.Mesh(b, m);
1049
+ E.name = `TEXT_CHILD_${L}`;
1050
+ const A = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, C = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
1051
+ E.scale.set(A, C, 1);
1052
+ const y = f.rect.x + f.rect.width / 2, S = f.rect.y + f.rect.height / 2, X = y - d, z = -(S - p);
1053
+ E.position.set(
1054
+ t.rect.width === 0 ? 0 : X / t.rect.width,
1055
+ t.rect.height === 0 ? 0 : z / t.rect.height,
1056
1056
  5e-3
1057
- ), e.add(I);
1057
+ ), e.add(E);
1058
1058
  }), e.userData.textChildStyleHash = o;
1059
1059
  }
1060
- e.children.forEach((d) => {
1061
- if (!d.name.startsWith("TEXT_CHILD"))
1060
+ e.children.forEach((u) => {
1061
+ if (!u.name.startsWith("TEXT_CHILD"))
1062
1062
  return;
1063
- const h = d;
1064
- if (i && t.nativeLayer !== void 0)
1065
- h.layers.set(B.HIDDEN), t.visibility & q && h.layers.enable(B.getCaptureLayer(t.nativeLayer));
1063
+ const h = u;
1064
+ if (r && t.nativeLayer !== void 0)
1065
+ h.layers.set(F.HIDDEN), t.visibility & G && h.layers.enable(F.getCaptureLayer(t.nativeLayer));
1066
1066
  else {
1067
- const u = t.visibility & q ? B.BASE : B.HIDDEN;
1068
- if (h.layers.set(u), t.visibility & ae && h.layers.enable(B.SELECTED), t.visibility & q)
1069
- if (!i && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1070
- for (let f = t.captureLayer; f <= _.MAX_LAYERS + 1; f++)
1071
- f !== t.nativeLayer && h.layers.enable(B.getCaptureLayer(f));
1067
+ const d = t.visibility & G ? F.BASE : F.HIDDEN;
1068
+ if (h.layers.set(d), t.visibility & ae && h.layers.enable(F.SELECTED), t.visibility & G)
1069
+ if (!r && 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(F.getCaptureLayer(p));
1072
1072
  else
1073
- for (let f = t.captureLayer; f <= _.MAX_LAYERS + 1; f++)
1074
- h.layers.enable(B.getCaptureLayer(f));
1073
+ for (let p = t.captureLayer; p <= N.MAX_LAYERS + 1; p++)
1074
+ h.layers.enable(F.getCaptureLayer(p));
1075
1075
  }
1076
1076
  });
1077
1077
  }
1078
1078
  updateMeshProperties(e, t) {
1079
- var S, R, E, V, N;
1080
- const { rect: i, styles: s } = t, c = this.renderer.getPixelRatio(), o = this.renderer.domElement.width / c, a = this.renderer.domElement.height / c;
1079
+ var C, y, S, X, z;
1080
+ const { rect: r, styles: s } = t, l = this.renderer.getPixelRatio(), o = this.renderer.domElement.width / l, n = this.renderer.domElement.height / l;
1081
1081
  e.material = e.userData.baseMaterial;
1082
- let n = ((S = e.material.userData) == null ? void 0 : S.shadowPadding) || 0;
1083
- e.scale.set(i.width + n * 2, i.height + n * 2, 1), e.userData.domRect = {
1084
- x: i.x,
1085
- y: i.y,
1086
- width: i.width,
1087
- height: i.height
1082
+ let c = ((C = e.material.userData) == null ? void 0 : C.shadowPadding) || 0;
1083
+ e.scale.set(r.width + c * 2, r.height + c * 2, 1), e.userData.domRect = {
1084
+ x: r.x,
1085
+ y: r.y,
1086
+ width: r.width,
1087
+ height: r.height
1088
1088
  };
1089
- const l = 1e-3;
1089
+ const a = 1e-3;
1090
1090
  this.renderOrder++;
1091
- const d = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
1092
- let u, f;
1091
+ const u = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
1092
+ let d, p;
1093
1093
  if (this.isViewport)
1094
- u = i.x - window.innerWidth / 2 + i.width / 2, f = -i.y + window.innerHeight / 2 - i.height / 2;
1094
+ d = r.x - window.innerWidth / 2 + r.width / 2, p = -r.y + window.innerHeight / 2 - r.height / 2;
1095
1095
  else {
1096
- const M = i.x - d, P = i.y - h;
1097
- u = M - o / 2 + i.width / 2, f = -P + a / 2 - i.height / 2;
1096
+ const U = r.x - u, I = r.y - h;
1097
+ d = U - o / 2 + r.width / 2, p = -I + n / 2 - r.height / 2;
1098
1098
  }
1099
1099
  e.position.set(
1100
- u,
1101
- f,
1102
- s.zIndex + this.renderOrder * l
1100
+ d,
1101
+ p,
1102
+ s.zIndex + this.renderOrder * a
1103
1103
  );
1104
- const g = i.x, v = i.y;
1105
- e.userData.basePosition = { x: u, y: f }, e.userData.originalBasePosition = { x: u, y: f }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: g, y: v }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1106
- const b = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, C = window.getComputedStyle(b);
1107
- let I = 0, D = 0;
1108
- if (C.transform && C.transform !== "none") {
1109
- const M = new DOMMatrix(C.transform);
1110
- I = M.m41, D = M.m42;
1104
+ const f = r.x, L = r.y;
1105
+ e.userData.basePosition = { x: d, y: p }, e.userData.originalBasePosition = { x: d, y: p }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: f, y: L }, 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, b = window.getComputedStyle(m);
1107
+ let E = 0, A = 0;
1108
+ if (b.transform && b.transform !== "none") {
1109
+ const U = new DOMMatrix(b.transform);
1110
+ E = U.m41, A = U.m42;
1111
1111
  }
1112
- if (e.userData.baseTransform = { x: I, y: D }, delete e.userData.originRatioX, delete e.userData.originRatioY, W.update(
1112
+ if (e.userData.baseTransform = { x: E, y: A }, delete e.userData.originRatioX, delete e.userData.originRatioY, P.update(
1113
1113
  e.userData.baseMaterial,
1114
1114
  "BOX",
1115
1115
  s,
1116
1116
  "",
1117
- i.width,
1118
- i.height,
1117
+ r.width,
1118
+ r.height,
1119
1119
  this.qualityFactor,
1120
- t.isTraveler ? (R = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : R.texture : this.textureManager.get(t.element)
1120
+ t.isTraveler ? (y = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : y.texture : this.textureManager.get(t.element)
1121
1121
  ), t.nativeStyles && t.nativeRect) {
1122
1122
  if (!e.userData.nativeMesh) {
1123
- const z = W.create(
1123
+ const B = P.create(
1124
1124
  "BOX",
1125
1125
  t.nativeStyles,
1126
1126
  "",
1127
1127
  t.nativeRect.width,
1128
1128
  t.nativeRect.height,
1129
1129
  this.qualityFactor,
1130
- t.isTraveler ? (E = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : E.texture : this.textureManager.get(t.element),
1130
+ t.isTraveler ? (S = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : S.texture : this.textureManager.get(t.element),
1131
1131
  t.shaderHooks
1132
- ), Y = new w.Mesh(e.geometry, z);
1133
- t.type === "TEXT" && (Y.name = "BG_MESH"), this.scene.add(Y), e.userData.nativeMesh = Y;
1132
+ ), V = new w.Mesh(e.geometry, B);
1133
+ t.type === "TEXT" && (V.name = "BG_MESH"), this.scene.add(V), e.userData.nativeMesh = V;
1134
1134
  }
1135
- const M = e.userData.nativeMesh;
1136
- let P, J;
1135
+ const U = e.userData.nativeMesh;
1136
+ let I, j;
1137
1137
  if (this.isViewport)
1138
- P = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, J = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1138
+ I = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, j = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1139
1139
  else {
1140
- const z = t.nativeRect.x - d, Y = t.nativeRect.y - h;
1141
- P = z - o / 2 + t.nativeRect.width / 2, J = -Y + a / 2 - t.nativeRect.height / 2;
1140
+ const B = t.nativeRect.x - u, V = t.nativeRect.y - h;
1141
+ I = B - o / 2 + t.nativeRect.width / 2, j = -V + n / 2 - t.nativeRect.height / 2;
1142
1142
  }
1143
- let Z = t.nativeRect.width, L = t.nativeRect.height, F = P, $ = J;
1143
+ let J = t.nativeRect.width, Z = t.nativeRect.height, M = I, O = j;
1144
1144
  if (t.nativeStyles.transform) {
1145
- const z = t.nativeStyles.transform, Y = z.match(/scale\(([\d.]+%?)\)/);
1146
- if (Y) {
1147
- let y = parseFloat(Y[1]);
1148
- Y[1].includes("%") && (y /= 100), Z *= y, L *= y;
1145
+ const B = t.nativeStyles.transform, V = B.match(/scale\(([\d.]+%?)\)/);
1146
+ if (V) {
1147
+ let x = parseFloat(V[1]);
1148
+ V[1].includes("%") && (x /= 100), J *= x, Z *= x;
1149
1149
  }
1150
- const ie = z.match(/scaleX\(([\d.]+%?)\)/);
1150
+ const ie = B.match(/scaleX\(([\d.]+%?)\)/);
1151
1151
  if (ie) {
1152
- let y = parseFloat(ie[1]);
1153
- ie[1].includes("%") && (y /= 100), Z *= y;
1152
+ let x = parseFloat(ie[1]);
1153
+ ie[1].includes("%") && (x /= 100), J *= x;
1154
1154
  }
1155
- const se = z.match(/scaleY\(([\d.]+%?)\)/);
1155
+ const se = B.match(/scaleY\(([\d.]+%?)\)/);
1156
1156
  if (se) {
1157
- let y = parseFloat(se[1]);
1158
- se[1].includes("%") && (y /= 100), L *= y;
1157
+ let x = parseFloat(se[1]);
1158
+ se[1].includes("%") && (x /= 100), Z *= x;
1159
1159
  }
1160
- const m = z.match(/translate\(([^,]+),\s*([^)]+)\)/);
1161
- if (m) {
1162
- const y = m[1].trim(), x = m[2].trim();
1163
- let X = parseFloat(y);
1164
- y.includes("%") && (X = X / 100 * t.nativeRect.width);
1165
- let O = parseFloat(x);
1166
- x.includes("%") && (O = O / 100 * t.nativeRect.height), F += X, $ -= O;
1160
+ const oe = B.match(/translate\(([^,]+),\s*([^)]+)\)/);
1161
+ if (oe) {
1162
+ const x = oe[1].trim(), T = oe[2].trim();
1163
+ let _ = parseFloat(x);
1164
+ x.includes("%") && (_ = _ / 100 * t.nativeRect.width);
1165
+ let D = parseFloat(T);
1166
+ T.includes("%") && (D = D / 100 * t.nativeRect.height), M += _, O -= D;
1167
1167
  }
1168
- const A = z.match(/translateX\(([^)]+)\)/);
1169
- if (A) {
1170
- const y = A[1].trim();
1171
- let x = parseFloat(y);
1172
- y.includes("%") && (x = x / 100 * t.nativeRect.width), F += x;
1168
+ const he = B.match(/translateX\(([^)]+)\)/);
1169
+ if (he) {
1170
+ const x = he[1].trim();
1171
+ let T = parseFloat(x);
1172
+ x.includes("%") && (T = T / 100 * t.nativeRect.width), M += T;
1173
1173
  }
1174
- const U = z.match(/translateY\(([^)]+)\)/);
1175
- if (U) {
1176
- const y = U[1].trim();
1177
- let x = parseFloat(y);
1178
- y.includes("%") && (x = x / 100 * t.nativeRect.height), $ -= x;
1174
+ const v = B.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), O -= T;
1179
1179
  }
1180
1180
  }
1181
- let K = ((V = M.material.userData) == null ? void 0 : V.shadowPadding) || 0;
1182
- M.scale.set(Z + K * 2, L + K * 2, 1), M.position.set(
1183
- F,
1184
- $,
1185
- t.nativeStyles.zIndex + this.renderOrder * l
1186
- ), W.update(
1187
- M.material,
1181
+ let K = ((X = U.material.userData) == null ? void 0 : X.shadowPadding) || 0;
1182
+ U.scale.set(J + K * 2, Z + K * 2, 1), U.position.set(
1183
+ M,
1184
+ O,
1185
+ t.nativeStyles.zIndex + this.renderOrder * a
1186
+ ), P.update(
1187
+ U.material,
1188
1188
  "BOX",
1189
1189
  t.nativeStyles,
1190
1190
  "",
1191
1191
  t.nativeRect.width,
1192
1192
  t.nativeRect.height,
1193
1193
  this.qualityFactor,
1194
- t.isTraveler ? (N = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : N.texture : this.textureManager.get(t.element)
1194
+ t.isTraveler ? (z = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : z.texture : this.textureManager.get(t.element)
1195
1195
  );
1196
1196
  } else
1197
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
1198
  }
1199
1199
  updateMeshLayers(e, t) {
1200
- const i = t.visibility & q ? B.BASE : B.HIDDEN;
1201
- if (e.layers.set(i), t.visibility & ae && e.layers.enable(B.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1200
+ const r = t.visibility & G ? F.BASE : F.HIDDEN;
1201
+ if (e.layers.set(r), t.visibility & ae && e.layers.enable(F.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1202
1202
  const s = e.userData.nativeMesh;
1203
- if (s.layers.set(B.HIDDEN), t.visibility & q) {
1204
- s.layers.enable(B.getCaptureLayer(t.nativeLayer));
1205
- for (let c = t.captureLayer; c <= _.MAX_LAYERS + 1; c++)
1206
- c !== t.nativeLayer && e.layers.enable(B.getCaptureLayer(c));
1203
+ if (s.layers.set(F.HIDDEN), t.visibility & G) {
1204
+ s.layers.enable(F.getCaptureLayer(t.nativeLayer));
1205
+ for (let l = t.captureLayer; l <= N.MAX_LAYERS + 1; l++)
1206
+ l !== t.nativeLayer && e.layers.enable(F.getCaptureLayer(l));
1207
1207
  }
1208
- } else if (t.visibility & q)
1209
- for (let s = t.captureLayer; s <= _.MAX_LAYERS + 1; s++)
1210
- e.layers.enable(B.getCaptureLayer(s));
1208
+ } else if (t.visibility & G)
1209
+ for (let s = t.captureLayer; s <= N.MAX_LAYERS + 1; s++)
1210
+ e.layers.enable(F.getCaptureLayer(s));
1211
1211
  }
1212
- captureRenderTarget(e, t, i) {
1213
- if (e.size === 0 || !i)
1212
+ captureRenderTarget(e, t, r) {
1213
+ if (e.size === 0 || !r)
1214
1214
  return;
1215
- const s = new w.Color(), c = this.renderer.getClearAlpha();
1216
- this.renderer.getClearColor(s), 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 o = new w.Vector3(), a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, l = this.renderer.getPixelRatio();
1218
- for (const d of e) {
1219
- o.setFromMatrixPosition(d.matrixWorld), o.project(this.camera);
1220
- const h = (o.x + 1) / 2 * a, u = (o.y + 1) / 2 * n;
1221
- let f = 0, g = 1;
1222
- typeof this.clipArea == "number" ? g = this.clipArea : this.clipArea.endsWith("%") ? g = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (f = parseFloat(this.clipArea));
1223
- const v = d.scale.x * g + 0.5, b = d.scale.y * g + 0.5, C = h - v / 2, I = u - b / 2, D = (C * this.qualityFactor - f) / l, S = (I * this.qualityFactor - f) / l, R = (v * this.qualityFactor + f * 2) / l, E = (b * this.qualityFactor + f * 2) / l;
1224
- this.renderer.setScissor(D, S, R, E), this.renderer.render(this.scene, this.camera);
1215
+ const s = new w.Color(), l = this.renderer.getClearAlpha();
1216
+ 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);
1217
+ const o = new w.Vector3(), n = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, a = this.renderer.getPixelRatio();
1218
+ for (const u of e) {
1219
+ o.setFromMatrixPosition(u.matrixWorld), o.project(this.camera);
1220
+ const h = (o.x + 1) / 2 * n, d = (o.y + 1) / 2 * c;
1221
+ let p = 0, f = 1;
1222
+ typeof this.clipArea == "number" ? f = this.clipArea : this.clipArea.endsWith("%") ? f = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1223
+ const L = u.scale.x * f + 0.5, m = u.scale.y * f + 0.5, b = h - L / 2, E = d - m / 2, A = (b * this.qualityFactor - p) / a, C = (E * this.qualityFactor - p) / a, y = (L * this.qualityFactor + p * 2) / a, S = (m * this.qualityFactor + p * 2) / a;
1224
+ this.renderer.setScissor(A, C, y, S), this.renderer.render(this.scene, this.camera);
1225
1225
  }
1226
- this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(s, c);
1226
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(s, l);
1227
1227
  }
1228
1228
  render() {
1229
- for (let e = 0; e < _.MAX_LAYERS; e++) {
1230
- const t = e + 1;
1229
+ for (let n = 0; n < N.MAX_LAYERS; n++) {
1230
+ const c = n + 1;
1231
1231
  this.captureRenderTarget(
1232
- this.travelersByLayer[e],
1233
- B.getCaptureLayer(t),
1234
- this.renderTargets[e]
1232
+ this.travelersByLayer[n],
1233
+ F.getCaptureLayer(c),
1234
+ this.renderTargets[n]
1235
1235
  );
1236
1236
  }
1237
- this.renderer.render(this.scene, this.camera);
1237
+ const e = this.renderer.getContext(), t = this.renderer.getPixelRatio(), r = this.renderer.domElement.height / t, s = this.renderer.domElement, l = s.getBoundingClientRect().top, o = s.getBoundingClientRect().left;
1238
+ this.scene.children.forEach((n) => {
1239
+ var u;
1240
+ const c = n, a = (u = c.userData) == null ? void 0 : u.scissorRect;
1241
+ if (a && a.width > 0 && a.height > 0) {
1242
+ const h = Math.floor((a.x - o) * t), d = Math.floor(
1243
+ (r - (a.y - l + a.height)) * t
1244
+ ), p = Math.ceil(a.width * t), f = Math.ceil(a.height * t);
1245
+ c.onBeforeRender = () => {
1246
+ e.enable(e.SCISSOR_TEST), e.scissor(h, d, p, f);
1247
+ }, c.onAfterRender = () => {
1248
+ e.disable(e.SCISSOR_TEST);
1249
+ };
1250
+ } else
1251
+ c.onBeforeRender && c.__hasScissorHook && (c.onBeforeRender = () => {
1252
+ }, c.onAfterRender = () => {
1253
+ }, c.__hasScissorHook = !1);
1254
+ a && (c.__hasScissorHook = !0);
1255
+ }), this.renderer.render(this.scene, this.camera);
1238
1256
  }
1239
1257
  syncMeshesByDOM() {
1240
- const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, i = this.renderer.getPixelRatio(), s = this.renderer.domElement.width / i, c = this.renderer.domElement.height / i;
1258
+ const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, r = this.renderer.getPixelRatio(), s = this.renderer.domElement.width / r, l = this.renderer.domElement.height / r;
1241
1259
  this.scene.children.forEach((o) => {
1242
- var h, u;
1243
- const a = o;
1244
- if (!a.userData || !a.userData.domElement)
1260
+ var h, d;
1261
+ const n = o;
1262
+ if (!n.userData || !n.userData.domElement)
1245
1263
  return;
1246
- const n = a.userData.domElement;
1247
- if (!n.isConnected)
1264
+ const c = n.userData.domElement;
1265
+ if (!c.isConnected)
1248
1266
  return;
1249
- let l;
1250
- if (n.nodeType === Node.TEXT_NODE) {
1251
- const f = document.createRange();
1252
- f.selectNode(n), l = f.getBoundingClientRect();
1267
+ let a;
1268
+ if (c.nodeType === Node.TEXT_NODE) {
1269
+ const p = document.createRange();
1270
+ p.selectNode(c), a = p.getBoundingClientRect();
1253
1271
  } else
1254
- l = n.getBoundingClientRect();
1255
- const d = a.userData.domRect;
1256
- if (!d || Math.abs(l.x - d.x) > 0.5 || Math.abs(l.y - d.y) > 0.5 || Math.abs(l.width - d.width) > 0.5 || Math.abs(l.height - d.height) > 0.5) {
1257
- a.userData.domRect = {
1258
- x: l.x,
1259
- y: l.y,
1260
- width: l.width,
1261
- height: l.height
1272
+ a = c.getBoundingClientRect();
1273
+ const u = n.userData.domRect;
1274
+ 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) {
1275
+ n.userData.domRect = {
1276
+ x: a.x,
1277
+ y: a.y,
1278
+ width: a.width,
1279
+ height: a.height
1262
1280
  };
1263
- let f, g;
1281
+ const p = n.userData.clipElements;
1282
+ if (p && p.length > 0) {
1283
+ let b = -1 / 0, E = -1 / 0, A = 1 / 0, C = 1 / 0;
1284
+ for (const y of p) {
1285
+ const S = y.getBoundingClientRect();
1286
+ b = Math.max(b, S.left), E = Math.max(E, S.top), A = Math.min(A, S.right), C = Math.min(C, S.bottom);
1287
+ }
1288
+ n.userData.scissorRect = {
1289
+ x: b,
1290
+ y: E,
1291
+ width: Math.max(0, A - b),
1292
+ height: Math.max(0, C - E)
1293
+ };
1294
+ } else
1295
+ n.userData.scissorRect = void 0;
1296
+ let f, L;
1264
1297
  if (this.isViewport)
1265
- f = l.x - window.innerWidth / 2 + l.width / 2, g = -l.y + window.innerHeight / 2 - l.height / 2;
1298
+ f = a.x - window.innerWidth / 2 + a.width / 2, L = -a.y + window.innerHeight / 2 - a.height / 2;
1266
1299
  else {
1267
- const b = l.x - e, C = l.y - t;
1268
- f = b - s / 2 + l.width / 2, g = -C + c / 2 - l.height / 2;
1300
+ const b = a.x - e, E = a.y - t;
1301
+ f = b - s / 2 + a.width / 2, L = -E + l / 2 - a.height / 2;
1269
1302
  }
1270
- a.position.setX(f), a.position.setY(g);
1271
- let v = ((h = a.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1272
- if (a.scale.set(l.width + v * 2, l.height + v * 2, 1), a.updateMatrixWorld(), a.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(a.material, {
1273
- width: l.width,
1274
- height: l.height
1275
- }), a.userData.nativeMesh) {
1276
- const b = a.userData.nativeMesh;
1277
- let C = l.width, I = l.height, D = f, S = g;
1278
- if (a.userData.nativeTransform) {
1279
- const E = a.userData.nativeTransform, V = E.match(/scale\(([\d.]+%?)\)/);
1280
- if (V) {
1281
- let L = parseFloat(V[1]);
1282
- V[1].includes("%") && (L /= 100), C *= L, I *= L;
1303
+ n.position.setX(f), n.position.setY(L);
1304
+ let m = ((h = n.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1305
+ if (n.scale.set(a.width + m * 2, a.height + m * 2, 1), n.updateMatrixWorld(), n.material instanceof w.ShaderMaterial && P.forceUpdateUniforms(n.material, {
1306
+ width: a.width,
1307
+ height: a.height
1308
+ }), n.userData.nativeMesh) {
1309
+ const b = n.userData.nativeMesh;
1310
+ let E = a.width, A = a.height, C = f, y = L;
1311
+ if (n.userData.nativeTransform) {
1312
+ const X = n.userData.nativeTransform, z = X.match(/scale\(([\d.]+%?)\)/);
1313
+ if (z) {
1314
+ let M = parseFloat(z[1]);
1315
+ z[1].includes("%") && (M /= 100), E *= M, A *= M;
1283
1316
  }
1284
- const N = E.match(/scaleX\(([\d.]+%?)\)/);
1285
- if (N) {
1286
- let L = parseFloat(N[1]);
1287
- N[1].includes("%") && (L /= 100), C *= L;
1317
+ const U = X.match(/scaleX\(([\d.]+%?)\)/);
1318
+ if (U) {
1319
+ let M = parseFloat(U[1]);
1320
+ U[1].includes("%") && (M /= 100), E *= M;
1288
1321
  }
1289
- const M = E.match(/scaleY\(([\d.]+%?)\)/);
1290
- if (M) {
1291
- let L = parseFloat(M[1]);
1292
- M[1].includes("%") && (L /= 100), I *= L;
1322
+ const I = X.match(/scaleY\(([\d.]+%?)\)/);
1323
+ if (I) {
1324
+ let M = parseFloat(I[1]);
1325
+ I[1].includes("%") && (M /= 100), A *= M;
1293
1326
  }
1294
- const P = E.match(/translate\(([^,]+),\s*([^)]+)\)/);
1295
- if (P) {
1296
- const L = P[1].trim(), F = P[2].trim();
1297
- let $ = parseFloat(L);
1298
- L.includes("%") && ($ = $ / 100 * l.width);
1299
- let K = parseFloat(F);
1300
- F.includes("%") && (K = K / 100 * l.height), D += $, S -= K;
1327
+ const j = X.match(/translate\(([^,]+),\s*([^)]+)\)/);
1328
+ if (j) {
1329
+ const M = j[1].trim(), O = j[2].trim();
1330
+ let K = parseFloat(M);
1331
+ M.includes("%") && (K = K / 100 * a.width);
1332
+ let B = parseFloat(O);
1333
+ O.includes("%") && (B = B / 100 * a.height), C += K, y -= B;
1301
1334
  }
1302
- const J = E.match(/translateX\(([^)]+)\)/);
1335
+ const J = X.match(/translateX\(([^)]+)\)/);
1303
1336
  if (J) {
1304
- const L = J[1].trim();
1305
- let F = parseFloat(L);
1306
- L.includes("%") && (F = F / 100 * l.width), D += F;
1337
+ const M = J[1].trim();
1338
+ let O = parseFloat(M);
1339
+ M.includes("%") && (O = O / 100 * a.width), C += O;
1307
1340
  }
1308
- const Z = E.match(/translateY\(([^)]+)\)/);
1341
+ const Z = X.match(/translateY\(([^)]+)\)/);
1309
1342
  if (Z) {
1310
- const L = Z[1].trim();
1311
- let F = parseFloat(L);
1312
- L.includes("%") && (F = F / 100 * l.height), S -= F;
1343
+ const M = Z[1].trim();
1344
+ let O = parseFloat(M);
1345
+ M.includes("%") && (O = O / 100 * a.height), y -= O;
1313
1346
  }
1314
1347
  }
1315
- let R = ((u = b.material.userData) == null ? void 0 : u.shadowPadding) || 0;
1316
- b.position.setX(D), b.position.setY(S), b.scale.set(C + R * 2, I + R * 2, 1), b.updateMatrixWorld(), b.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(b.material, {
1317
- width: C,
1318
- height: I
1348
+ let S = ((d = b.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1349
+ b.position.setX(C), b.position.setY(y), b.scale.set(E + S * 2, A + S * 2, 1), b.updateMatrixWorld(), b.material instanceof w.ShaderMaterial && P.forceUpdateUniforms(b.material, {
1350
+ width: E,
1351
+ height: A
1319
1352
  });
1320
1353
  }
1321
1354
  }
1322
1355
  });
1323
1356
  }
1324
1357
  }
1325
- function st(r) {
1326
- const e = r.textContent || "", t = [];
1327
- let i = "", s = null, c = -1;
1328
- const o = (l, d) => {
1329
- for (let h = 0; h < l.length; h++) {
1330
- const u = l[h], f = document.createRange();
1331
- f.setStart(r, d + h), f.setEnd(r, d + h + 1);
1332
- const g = f.getBoundingClientRect();
1333
- if (g.width === 0 && g.height === 0) {
1334
- i += u;
1358
+ function nt(i) {
1359
+ const e = i.textContent || "", t = [];
1360
+ let r = "", s = null, l = -1;
1361
+ const o = (a, u) => {
1362
+ for (let h = 0; h < a.length; h++) {
1363
+ const d = a[h], p = document.createRange();
1364
+ p.setStart(i, u + h), p.setEnd(i, u + h + 1);
1365
+ const f = p.getBoundingClientRect();
1366
+ if (f.width === 0 && f.height === 0) {
1367
+ r += d;
1335
1368
  continue;
1336
1369
  }
1337
- c === -1 || Math.abs(g.top - c) > g.height / 2 ? (i && s && t.push({
1338
- text: i,
1370
+ l === -1 || Math.abs(f.top - l) > f.height / 2 ? (r && s && t.push({
1371
+ text: r,
1339
1372
  rect: {
1340
1373
  left: s.left,
1341
1374
  top: s.top,
1342
1375
  width: s.right - s.left,
1343
1376
  height: s.bottom - s.top
1344
1377
  }
1345
- }), i = u, s = {
1346
- left: g.left,
1347
- top: g.top,
1348
- right: g.right,
1349
- bottom: g.bottom
1350
- }, c = g.top) : (i += u, 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(
1378
+ }), r = d, s = {
1379
+ left: f.left,
1380
+ top: f.top,
1381
+ right: f.right,
1382
+ bottom: f.bottom
1383
+ }, l = f.top) : (r += d, s && (s.left = Math.min(s.left, f.left), s.top = Math.min(s.top, f.top), s.right = Math.max(s.right, f.right), s.bottom = Math.max(
1351
1384
  s.bottom,
1352
- g.bottom
1385
+ f.bottom
1353
1386
  )));
1354
1387
  }
1355
- }, a = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1356
- let n = 0;
1357
- for (const l of a) {
1358
- const d = document.createRange();
1359
- d.setStart(r, n), d.setEnd(r, n + l.length);
1360
- const h = d.getClientRects();
1388
+ }, n = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1389
+ let c = 0;
1390
+ for (const a of n) {
1391
+ const u = document.createRange();
1392
+ u.setStart(i, c), u.setEnd(i, c + a.length);
1393
+ const h = u.getClientRects();
1361
1394
  if (h.length > 1)
1362
- o(l, n);
1395
+ o(a, c);
1363
1396
  else {
1364
- const u = h.length === 1 ? h[0] : d.getBoundingClientRect();
1365
- if (u.width === 0 && u.height === 0) {
1366
- i += l, n += l.length;
1397
+ const d = h.length === 1 ? h[0] : u.getBoundingClientRect();
1398
+ if (d.width === 0 && d.height === 0) {
1399
+ r += a, c += a.length;
1367
1400
  continue;
1368
1401
  }
1369
- c === -1 || Math.abs(u.top - c) > u.height / 2 ? (i && s && t.push({
1370
- text: i,
1402
+ l === -1 || Math.abs(d.top - l) > d.height / 2 ? (r && s && t.push({
1403
+ text: r,
1371
1404
  rect: {
1372
1405
  left: s.left,
1373
1406
  top: s.top,
1374
1407
  width: s.right - s.left,
1375
1408
  height: s.bottom - s.top
1376
1409
  }
1377
- }), i = l, s = {
1378
- left: u.left,
1379
- top: u.top,
1380
- right: u.right,
1381
- bottom: u.bottom
1382
- }, c = u.top) : (i += l, s && (s.left = Math.min(s.left, u.left), s.top = Math.min(s.top, u.top), s.right = Math.max(s.right, u.right), s.bottom = Math.max(
1410
+ }), r = a, s = {
1411
+ left: d.left,
1412
+ top: d.top,
1413
+ right: d.right,
1414
+ bottom: d.bottom
1415
+ }, l = 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(
1383
1416
  s.bottom,
1384
- u.bottom
1417
+ d.bottom
1385
1418
  )));
1386
1419
  }
1387
- n += l.length;
1420
+ c += a.length;
1388
1421
  }
1389
- return i && s && t.push({
1390
- text: i,
1422
+ return r && s && t.push({
1423
+ text: r,
1391
1424
  rect: {
1392
1425
  left: s.left,
1393
1426
  top: s.top,
@@ -1395,335 +1428,338 @@ function st(r) {
1395
1428
  height: s.bottom - s.top
1396
1429
  }
1397
1430
  }), t.filter(
1398
- (l) => l.text.trim().length > 0 && l.rect.width > 0 && l.rect.height > 0
1431
+ (a) => a.text.trim().length > 0 && a.rect.width > 0 && a.rect.height > 0
1399
1432
  );
1400
1433
  }
1401
- function Le(r) {
1402
- const e = parseFloat(r.fontSize);
1403
- let t = parseFloat(r.lineHeight);
1434
+ function Ae(i) {
1435
+ const e = parseFloat(i.fontSize);
1436
+ let t = parseFloat(i.lineHeight);
1404
1437
  isNaN(t) && (t = e * 1.2);
1405
- let i = parseFloat(r.letterSpacing);
1406
- return isNaN(i) && (i = 0), {
1407
- font: `${r.fontStyle} ${r.fontWeight} ${r.fontSize} ${r.fontFamily}`,
1408
- fontSize: r.fontSize,
1409
- color: r.color,
1410
- textAlign: r.textAlign || "start",
1438
+ let r = parseFloat(i.letterSpacing);
1439
+ return isNaN(r) && (r = 0), {
1440
+ font: `${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`,
1441
+ fontSize: i.fontSize,
1442
+ color: i.color,
1443
+ textAlign: i.textAlign || "start",
1411
1444
  textBaseline: "alphabetic",
1412
- direction: r.direction || "inherit",
1445
+ direction: i.direction || "inherit",
1413
1446
  lineHeight: t,
1414
- letterSpacing: i
1447
+ letterSpacing: r
1415
1448
  };
1416
1449
  }
1417
- function Ue(r, e = re | he | Ye | we | fe, t, i = 1, s = 0, c = 2, o, a) {
1418
- var F, $, K, z, Y, ie, se;
1419
- if (r.nodeType === Node.TEXT_NODE) {
1420
- const m = r;
1421
- if (!m.textContent || !m.textContent.trim())
1450
+ function Fe(i, e = re | ue | We | ye | pe, t, r = 1, s = 0, l = 2, o, n, c) {
1451
+ var K, B, V, ie, se, oe, he;
1452
+ if (i.nodeType === Node.TEXT_NODE) {
1453
+ const v = i;
1454
+ if (!v.textContent || !v.textContent.trim())
1422
1455
  return null;
1423
- const A = m.textContent.replace(/\s+/g, " ");
1424
- if (A.length === 0)
1456
+ const x = v.textContent.replace(/\s+/g, " ");
1457
+ if (x.length === 0)
1425
1458
  return null;
1426
- const U = st(m);
1427
- if (U.length === 0)
1459
+ const T = nt(v);
1460
+ if (T.length === 0)
1428
1461
  return null;
1429
- const y = m.parentElement, x = y ? window.getComputedStyle(y) : null;
1430
- if (!x)
1462
+ const _ = v.parentElement, D = _ ? window.getComputedStyle(_) : null;
1463
+ if (!D)
1431
1464
  return null;
1432
- const X = Math.min(...U.map((T) => T.rect.left)), O = Math.min(...U.map((T) => T.rect.top)), Q = Math.max(...U.map((T) => T.rect.left + T.rect.width)), k = Math.max(...U.map((T) => T.rect.top + T.rect.height));
1465
+ const q = 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)), k = Math.max(...T.map((R) => R.rect.top + R.rect.height));
1433
1466
  return {
1434
1467
  id: Math.random().toString(36).substring(2, 9),
1435
1468
  type: "TEXT",
1436
- element: m,
1469
+ element: v,
1437
1470
  rect: {
1438
- x: X + window.scrollX,
1439
- y: O + window.scrollY,
1440
- width: Q - X,
1441
- height: k - O
1471
+ x: q + window.scrollX,
1472
+ y: Y + window.scrollY,
1473
+ width: Q - q,
1474
+ height: k - Y
1442
1475
  },
1443
1476
  styles: {
1444
1477
  backgroundColor: "transparent",
1445
1478
  backgroundImage: "",
1446
- opacity: y && y.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(x.opacity),
1447
- zIndex: (isNaN(parseInt(x.zIndex)) ? 0 : parseInt(x.zIndex)) + s,
1479
+ opacity: _ && _.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1480
+ zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + s,
1448
1481
  borderRadius: "0px",
1449
1482
  borderColor: "transparent",
1450
1483
  borderWidth: "0px",
1451
1484
  isTraveler: !1
1452
1485
  },
1453
- textContent: A,
1454
- textLines: U.map((T) => ({
1455
- text: T.text.trim(),
1486
+ textContent: x,
1487
+ textLines: T.map((R) => ({
1488
+ text: R.text.trim(),
1456
1489
  rect: {
1457
- x: T.rect.left + window.scrollX,
1458
- y: T.rect.top + window.scrollY,
1459
- width: T.rect.width,
1460
- height: T.rect.height
1490
+ x: R.rect.left + window.scrollX,
1491
+ y: R.rect.top + window.scrollY,
1492
+ width: R.rect.width,
1493
+ height: R.rect.height
1461
1494
  }
1462
1495
  })),
1463
- textStyles: Le(x),
1496
+ textStyles: Ae(D),
1464
1497
  dirtyMask: e,
1465
1498
  visibility: t,
1466
1499
  isTraveler: !1,
1467
- captureLayer: i,
1468
- isFixed: x.position === "fixed",
1500
+ captureLayer: r,
1501
+ isFixed: D.position === "fixed",
1469
1502
  nativeLayer: o,
1470
- nativeStyles: a ? te(te({
1503
+ nativeStyles: n ? te(te({
1471
1504
  backgroundColor: "transparent",
1472
1505
  backgroundImage: "",
1473
- opacity: y && y.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(x.opacity),
1474
- zIndex: (isNaN(parseInt(x.zIndex)) ? 0 : parseInt(x.zIndex)) + s,
1506
+ opacity: _ && _.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1507
+ zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + s,
1475
1508
  borderRadius: "0px",
1476
1509
  borderColor: "transparent",
1477
1510
  borderWidth: "0px",
1478
1511
  isTraveler: !1
1479
- }, Le(x)), a) : void 0,
1480
- nativeRect: a ? {
1481
- x: X + window.scrollX,
1482
- y: O + window.scrollY,
1483
- width: Q - X,
1484
- height: k - O
1512
+ }, Ae(D)), n) : void 0,
1513
+ nativeRect: n ? {
1514
+ x: q + window.scrollX,
1515
+ y: Y + window.scrollY,
1516
+ width: Q - q,
1517
+ height: k - Y
1485
1518
  } : void 0,
1519
+ clipElements: c,
1486
1520
  children: []
1487
1521
  };
1488
1522
  }
1489
- if (r.nodeType !== Node.ELEMENT_NODE)
1523
+ if (i.nodeType !== Node.ELEMENT_NODE)
1490
1524
  return null;
1491
- const n = r, l = n.dataset[G.KEY];
1492
- let d = t, h = t;
1493
- if (l) {
1494
- const m = new Set(l.split(/\s+/));
1495
- for (const A of m)
1496
- if (!Te.includes(A))
1525
+ const a = i, u = a.dataset[H.KEY];
1526
+ let h = t, d = t;
1527
+ if (u) {
1528
+ const v = new Set(u.split(/\s+/));
1529
+ for (const x of v)
1530
+ if (!Me.includes(x))
1497
1531
  throw new Error(
1498
- `[MirageEngine] Invalid filter token: '${A}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1532
+ `[MirageEngine] Invalid filter token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1499
1533
  );
1500
- if (m.has(G.VALUES.END))
1534
+ if (v.has(H.VALUES.END))
1501
1535
  return null;
1502
- if (m.has(G.VALUES.INCLUDE_TREE) && m.has(G.VALUES.EXCLUDE_TREE))
1536
+ if (v.has(H.VALUES.INCLUDE_TREE) && v.has(H.VALUES.EXCLUDE_TREE))
1503
1537
  throw new Error(
1504
1538
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1505
1539
  );
1506
- if (m.has(G.VALUES.INCLUDE_SELF) && m.has(G.VALUES.EXCLUDE_SELF))
1540
+ if (v.has(H.VALUES.INCLUDE_SELF) && v.has(H.VALUES.EXCLUDE_SELF))
1507
1541
  throw new Error(
1508
1542
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1509
1543
  );
1510
- m.has(G.VALUES.INCLUDE_TREE) ? d = d | q : m.has(G.VALUES.EXCLUDE_TREE) && (d = d & ~q), h = d, m.has(G.VALUES.INCLUDE_SELF) ? h = h | q : m.has(G.VALUES.EXCLUDE_SELF) && (h = h & ~q);
1544
+ v.has(H.VALUES.INCLUDE_TREE) ? h = h | G : v.has(H.VALUES.EXCLUDE_TREE) && (h = h & ~G), d = h, v.has(H.VALUES.INCLUDE_SELF) ? d = d | G : v.has(H.VALUES.EXCLUDE_SELF) && (d = d & ~G);
1511
1545
  }
1512
- const u = n.dataset[j.KEY];
1513
- if (u) {
1514
- const m = new Set(u.split(/\s+/));
1515
- for (const A of m)
1516
- if (!Te.includes(A))
1546
+ const p = a.dataset[$.KEY];
1547
+ if (p) {
1548
+ const v = new Set(p.split(/\s+/));
1549
+ for (const x of v)
1550
+ if (!Me.includes(x))
1517
1551
  throw new Error(
1518
- `[MirageEngine] Invalid select token: '${A}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1552
+ `[MirageEngine] Invalid select token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1519
1553
  );
1520
- if (m.has(j.VALUES.END))
1554
+ if (v.has($.VALUES.END))
1521
1555
  return null;
1522
- if (m.has(j.VALUES.INCLUDE_TREE) && m.has(j.VALUES.EXCLUDE_TREE))
1556
+ if (v.has($.VALUES.INCLUDE_TREE) && v.has($.VALUES.EXCLUDE_TREE))
1523
1557
  throw new Error(
1524
1558
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1525
1559
  );
1526
- if (m.has(j.VALUES.INCLUDE_SELF) && m.has(j.VALUES.EXCLUDE_SELF))
1560
+ if (v.has($.VALUES.INCLUDE_SELF) && v.has($.VALUES.EXCLUDE_SELF))
1527
1561
  throw new Error(
1528
1562
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1529
1563
  );
1530
- m.has(j.VALUES.INCLUDE_TREE) ? d = d | ae : m.has(j.VALUES.EXCLUDE_TREE) && (d = d & ~ae), h = d, m.has(j.VALUES.INCLUDE_SELF) ? h = h | ae : m.has(j.VALUES.EXCLUDE_SELF) && (h = h & ~ae);
1564
+ v.has($.VALUES.INCLUDE_TREE) ? h = h | ae : v.has($.VALUES.EXCLUDE_TREE) && (h = h & ~ae), d = h, v.has($.VALUES.INCLUDE_SELF) ? d = d | ae : v.has($.VALUES.EXCLUDE_SELF) && (d = d & ~ae);
1531
1565
  }
1532
- const f = n.dataset[_.KEY];
1533
- let g = !1, v = a ? te({}, a) : {}, b = o;
1566
+ const f = a.dataset[N.KEY];
1567
+ let L = !1, m = n ? te({}, n) : {}, b = o;
1534
1568
  if (f) {
1535
- let m = 1;
1536
- const A = f.indexOf("{"), U = f.lastIndexOf("}");
1537
- let y = f;
1538
- if (A !== -1 && U !== -1 && U > A) {
1539
- y = f.substring(0, A).trim();
1540
- const k = f.substring(A, U + 1);
1569
+ let v = 1;
1570
+ const x = f.indexOf("{"), T = f.lastIndexOf("}");
1571
+ let _ = f;
1572
+ if (x !== -1 && T !== -1 && T > x) {
1573
+ _ = f.substring(0, x).trim();
1574
+ const k = f.substring(x, T + 1);
1541
1575
  try {
1542
- v = new Function("return " + k)();
1543
- } catch (T) {
1576
+ m = new Function("return " + k)();
1577
+ } catch (R) {
1544
1578
  console.warn(
1545
1579
  `[MirageEngine] Failed to parse travel styles JSON: ${k}`
1546
1580
  );
1547
1581
  }
1548
1582
  }
1549
- const x = y.split(/\s+/);
1550
- let X = !1;
1551
- const O = x.indexOf(_.VALUES.TRAVELER);
1552
- if (O !== -1) {
1553
- g = !0, X = !0;
1554
- const k = x[O + 1];
1583
+ const D = _.split(/\s+/);
1584
+ let q = !1;
1585
+ const Y = D.indexOf(N.VALUES.TRAVELER);
1586
+ if (Y !== -1) {
1587
+ L = !0, q = !0;
1588
+ const k = D[Y + 1];
1555
1589
  if (k && !isNaN(parseInt(k, 10)))
1556
- m = parseInt(k, 10);
1590
+ v = parseInt(k, 10);
1557
1591
  else {
1558
- const T = x.find((oe) => !isNaN(parseInt(oe, 10)));
1559
- T && (m = parseInt(T, 10));
1592
+ const R = D.find((ne) => !isNaN(parseInt(ne, 10)));
1593
+ R && (v = parseInt(R, 10));
1560
1594
  }
1561
1595
  }
1562
- const Q = x.indexOf(_.VALUES.NATIVE);
1596
+ const Q = D.indexOf(N.VALUES.NATIVE);
1563
1597
  if (Q !== -1) {
1564
- const k = x[Q + 1];
1598
+ const k = D[Q + 1];
1565
1599
  if (k && !isNaN(parseInt(k, 10)))
1566
1600
  b = parseInt(k, 10);
1567
- else if (!g) {
1568
- const T = x.find((oe) => !isNaN(parseInt(oe, 10)));
1569
- T && (b = parseInt(T, 10));
1601
+ else if (!L) {
1602
+ const R = D.find((ne) => !isNaN(parseInt(ne, 10)));
1603
+ R && (b = parseInt(R, 10));
1570
1604
  }
1571
1605
  }
1572
- if (X) {
1573
- const k = m + 1;
1574
- if (k < i)
1606
+ if (q) {
1607
+ const k = v + 1;
1608
+ if (k < r)
1575
1609
  throw new Error(
1576
- `[MirageEngine] Traveler layer (${m}) cannot be smaller than inherited capture layer (${i - 1}).`
1610
+ `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${r - 1}).`
1577
1611
  );
1578
- i = Math.min(k, _.MAX_LAYERS + 1);
1612
+ r = Math.min(k, N.MAX_LAYERS + 1);
1579
1613
  }
1580
1614
  }
1581
- const C = n.dataset[Ve.KEY];
1582
- let I;
1583
- C && (I = JSON.parse(C));
1584
- const D = n.getBoundingClientRect(), S = window.getComputedStyle(n);
1585
- if (D.width === 0 || D.height === 0 || S.display === "none")
1615
+ const E = a.dataset[Pe.KEY];
1616
+ let A;
1617
+ E && (A = JSON.parse(E));
1618
+ const C = a.getBoundingClientRect(), y = window.getComputedStyle(a);
1619
+ if (C.width === 0 || C.height === 0 || y.display === "none")
1586
1620
  return null;
1587
- let R = n.getAttribute("data-mid");
1588
- R || (R = Math.random().toString(36).substring(2, 11), n.setAttribute("data-mid", R));
1589
- const E = parseInt(S.zIndex), V = (isNaN(E) ? 0 : E) + s;
1590
- let N;
1591
- if (n.tagName === "IMG")
1592
- N = n.src;
1593
- else if (n.tagName.toLowerCase() === "svg") {
1594
- const m = n.cloneNode(!0), A = v == null ? void 0 : v.color, U = v == null ? void 0 : v.fill, y = v == null ? void 0 : v.stroke, x = v == null ? void 0 : v.opacity, X = (T, oe) => {
1595
- const H = window.getComputedStyle(T), ce = oe, Fe = H.fill === H.color, Be = H.stroke === H.color, ge = U || (Fe ? A : void 0) || H.fill;
1596
- ge && ge !== "none" && (ce.style.fill = ge);
1597
- const pe = y || (Be ? A : void 0) || H.stroke;
1598
- pe && pe !== "none" && (ce.style.stroke = pe), H.strokeWidth && H.strokeWidth !== "0px" && (ce.style.strokeWidth = H.strokeWidth);
1599
- const ye = A || H.color;
1600
- ye && (ce.style.color = ye);
1601
- const me = x || H.opacity;
1602
- me && me !== "1" && (ce.style.opacity = me);
1603
- for (let de = 0; de < T.children.length; de++)
1604
- X(T.children[de], oe.children[de]);
1621
+ let S = a.getAttribute("data-mid");
1622
+ S || (S = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", S));
1623
+ const X = parseInt(y.zIndex), z = (isNaN(X) ? 0 : X) + s;
1624
+ let U;
1625
+ if (a.tagName === "IMG")
1626
+ U = a.src;
1627
+ else if (a.tagName.toLowerCase() === "svg") {
1628
+ const v = a.cloneNode(!0), x = m == null ? void 0 : m.color, T = m == null ? void 0 : m.fill, _ = m == null ? void 0 : m.stroke, D = m == null ? void 0 : m.opacity, q = (R, ne) => {
1629
+ const W = window.getComputedStyle(R), de = ne, Oe = W.fill === W.color, _e = W.stroke === W.color, me = T || (Oe ? x : void 0) || W.fill;
1630
+ me && me !== "none" && (de.style.fill = me);
1631
+ const ve = _ || (_e ? x : void 0) || W.stroke;
1632
+ ve && ve !== "none" && (de.style.stroke = ve), W.strokeWidth && W.strokeWidth !== "0px" && (de.style.strokeWidth = W.strokeWidth);
1633
+ const Se = x || W.color;
1634
+ Se && (de.style.color = Se);
1635
+ const we = D || W.opacity;
1636
+ we && we !== "1" && (de.style.opacity = we);
1637
+ for (let fe = 0; fe < R.children.length; fe++)
1638
+ q(R.children[fe], ne.children[fe]);
1605
1639
  };
1606
- X(n, m);
1607
- const O = n.getBoundingClientRect(), Q = window.devicePixelRatio * c;
1608
- m.hasAttribute("viewBox") || m.setAttribute("viewBox", `0 0 ${O.width} ${O.height}`), m.setAttribute("width", (O.width * Q).toString()), m.setAttribute("height", (O.height * Q).toString());
1609
- let k = new XMLSerializer().serializeToString(m);
1640
+ q(a, v);
1641
+ const Y = a.getBoundingClientRect(), Q = window.devicePixelRatio * l;
1642
+ 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());
1643
+ let k = new XMLSerializer().serializeToString(v);
1610
1644
  k.includes("xmlns=") || (k = k.replace(
1611
1645
  "<svg",
1612
1646
  '<svg xmlns="http://www.w3.org/2000/svg"'
1613
- )), N = `data:image/svg+xml;utf8,${encodeURIComponent(k)}`;
1614
- } else if (S.backgroundImage && S.backgroundImage !== "none") {
1615
- const m = S.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1616
- m && (N = m[1]);
1617
- }
1618
- const M = {
1619
- backgroundColor: S.backgroundColor,
1620
- backgroundImage: S.backgroundImage,
1621
- opacity: n.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(S.opacity),
1622
- zIndex: V,
1623
- borderRadius: S.borderRadius,
1624
- borderColor: S.borderColor,
1625
- borderWidth: S.borderWidth,
1626
- boxShadow: S.boxShadow,
1627
- imageSrc: N,
1628
- isTraveler: g
1629
- }, P = M;
1647
+ )), U = `data:image/svg+xml;utf8,${encodeURIComponent(k)}`;
1648
+ } else if (y.backgroundImage && y.backgroundImage !== "none") {
1649
+ const v = y.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1650
+ v && (U = v[1]);
1651
+ }
1652
+ const I = {
1653
+ backgroundColor: y.backgroundColor,
1654
+ backgroundImage: y.backgroundImage,
1655
+ opacity: a.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(y.opacity),
1656
+ zIndex: z,
1657
+ borderRadius: y.borderRadius,
1658
+ borderColor: y.borderColor,
1659
+ borderWidth: y.borderWidth,
1660
+ boxShadow: y.boxShadow,
1661
+ imageSrc: U,
1662
+ isTraveler: L
1663
+ }, j = I;
1630
1664
  let J, Z;
1631
- const L = [];
1632
- return n.tagName.toLowerCase() !== "svg" && Array.from(n.childNodes).forEach((m) => {
1633
- const A = m.nodeType === Node.TEXT_NODE ? h : d, U = Ue(
1634
- m,
1665
+ const M = [], O = y.overflow === "hidden" ? [...c || [], a] : c;
1666
+ return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((v) => {
1667
+ const x = v.nodeType === Node.TEXT_NODE ? d : h, T = Fe(
1668
+ v,
1635
1669
  e,
1636
- A,
1637
- i,
1638
- V,
1639
- c,
1640
- m.nodeType === Node.TEXT_NODE ? b : void 0,
1641
- m.nodeType === Node.TEXT_NODE && Object.keys(v).length > 0 ? v : void 0
1670
+ x,
1671
+ r,
1672
+ z,
1673
+ l,
1674
+ v.nodeType === Node.TEXT_NODE ? b : void 0,
1675
+ v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0,
1676
+ O
1642
1677
  );
1643
- U && L.push(U);
1678
+ T && M.push(T);
1644
1679
  }), {
1645
- id: R,
1680
+ id: S,
1646
1681
  type: "BOX",
1647
- element: n,
1682
+ element: a,
1648
1683
  rect: {
1649
- x: D.left + window.scrollX,
1650
- y: D.top + window.scrollY,
1651
- width: D.width,
1652
- height: D.height
1684
+ x: C.left + window.scrollX,
1685
+ y: C.top + window.scrollY,
1686
+ width: C.width,
1687
+ height: C.height
1653
1688
  },
1654
- styles: P,
1689
+ styles: j,
1655
1690
  textContent: J,
1656
1691
  textStyles: Z,
1657
1692
  dirtyMask: e,
1658
- visibility: h,
1659
- isTraveler: g,
1660
- captureLayer: i,
1693
+ visibility: d,
1694
+ isTraveler: L,
1695
+ captureLayer: r,
1661
1696
  nativeLayer: b,
1662
- nativeStyles: b !== void 0 ? Se(te({}, M), {
1663
- backgroundColor: (F = v.backgroundColor) != null ? F : M.backgroundColor,
1664
- backgroundImage: ($ = v.backgroundImage) != null ? $ : M.backgroundImage,
1665
- opacity: (K = v.opacity) != null ? K : M.opacity,
1666
- zIndex: v.zIndex !== void 0 ? v.zIndex + V : M.zIndex,
1667
- borderRadius: (z = v.borderRadius) != null ? z : M.borderRadius,
1668
- borderColor: (Y = v.borderColor) != null ? Y : M.borderColor,
1669
- borderWidth: (ie = v.borderWidth) != null ? ie : M.borderWidth,
1670
- boxShadow: (se = v.boxShadow) != null ? se : M.boxShadow,
1671
- isTraveler: M.isTraveler,
1672
- transform: v.transform
1697
+ nativeStyles: b !== void 0 ? Ce(te({}, I), {
1698
+ backgroundColor: (K = m.backgroundColor) != null ? K : I.backgroundColor,
1699
+ backgroundImage: (B = m.backgroundImage) != null ? B : I.backgroundImage,
1700
+ opacity: (V = m.opacity) != null ? V : I.opacity,
1701
+ zIndex: m.zIndex !== void 0 ? m.zIndex + z : I.zIndex,
1702
+ borderRadius: (ie = m.borderRadius) != null ? ie : I.borderRadius,
1703
+ borderColor: (se = m.borderColor) != null ? se : I.borderColor,
1704
+ borderWidth: (oe = m.borderWidth) != null ? oe : I.borderWidth,
1705
+ boxShadow: (he = m.boxShadow) != null ? he : I.boxShadow,
1706
+ isTraveler: I.isTraveler,
1707
+ transform: m.transform
1673
1708
  }) : void 0,
1674
1709
  nativeRect: b !== void 0 ? {
1675
- x: v.x !== void 0 ? parseFloat(v.x) : D.left + window.scrollX,
1676
- y: v.y !== void 0 ? parseFloat(v.y) : D.top + window.scrollY,
1677
- width: v.width !== void 0 ? parseFloat(v.width) : D.width,
1678
- height: v.height !== void 0 ? parseFloat(v.height) : D.height
1710
+ x: m.x !== void 0 ? parseFloat(m.x) : C.left + window.scrollX,
1711
+ y: m.y !== void 0 ? parseFloat(m.y) : C.top + window.scrollY,
1712
+ width: m.width !== void 0 ? parseFloat(m.width) : C.width,
1713
+ height: m.height !== void 0 ? parseFloat(m.height) : C.height
1679
1714
  } : void 0,
1680
- isFixed: S.position === "fixed",
1681
- children: L,
1682
- shaderHooks: I
1715
+ isFixed: y.position === "fixed",
1716
+ clipElements: c,
1717
+ children: M,
1718
+ shaderHooks: A
1683
1719
  };
1684
1720
  }
1685
- function ot(r, e) {
1686
- e.size !== 0 && e.forEach((t, i) => {
1687
- var c, o, a, n;
1688
- const s = r.get(i);
1689
- !s || !s.userData.basePosition || (W.forceUpdateUniforms(s.material, {
1721
+ function at(i, e) {
1722
+ e.size !== 0 && e.forEach((t, r) => {
1723
+ var l, o, n, c;
1724
+ const s = i.get(r);
1725
+ !s || !s.userData.basePosition || (P.forceUpdateUniforms(s.material, {
1690
1726
  backgroundColor: t.backgroundColor,
1691
1727
  backgroundImage: t.backgroundImage,
1692
1728
  boxShadow: t.boxShadow,
1693
1729
  opacity: t.opacity,
1694
- borderRadius: (o = t.borderRadius) != null ? o : (c = s.userData.baseStyles) == null ? void 0 : c.borderRadius
1730
+ borderRadius: (o = t.borderRadius) != null ? o : (l = s.userData.baseStyles) == null ? void 0 : l.borderRadius
1695
1731
  // width and height are no longer updated here, they are updated in syncMeshesByDOM
1696
- }), s.userData.nativeMesh && W.forceUpdateUniforms(s.userData.nativeMesh.material, {
1732
+ }), s.userData.nativeMesh && P.forceUpdateUniforms(s.userData.nativeMesh.material, {
1697
1733
  backgroundColor: t.backgroundColor,
1698
1734
  backgroundImage: t.backgroundImage,
1699
1735
  boxShadow: t.boxShadow,
1700
1736
  opacity: t.opacity,
1701
- borderRadius: (n = t.borderRadius) != null ? n : (a = s.userData.baseStyles) == null ? void 0 : a.borderRadius
1737
+ borderRadius: (c = t.borderRadius) != null ? c : (n = s.userData.baseStyles) == null ? void 0 : n.borderRadius
1702
1738
  }));
1703
1739
  });
1704
1740
  }
1705
- class at {
1706
- constructor(e, t, i, s) {
1707
- p(this, "target");
1708
- p(this, "renderer");
1709
- p(this, "registry");
1710
- p(this, "isTravelEnabled", !1);
1711
- p(this, "tracker");
1712
- this.target = e, this.renderer = t, this.registry = i, this.tracker = new He(e, {
1741
+ class ct {
1742
+ constructor(e, t, r, s) {
1743
+ g(this, "target");
1744
+ g(this, "renderer");
1745
+ g(this, "registry");
1746
+ g(this, "isTravelEnabled", !1);
1747
+ g(this, "tracker");
1748
+ this.target = e, this.renderer = t, this.registry = r, this.tracker = new qe(e, {
1713
1749
  resizeDebounce: s.resizeDebounce
1714
- }), this.tracker.onLayoutChange.add((c, o) => {
1715
- document.querySelector(`[${_.NAME}~='${_.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1716
- const n = Ue(
1750
+ }), this.tracker.onLayoutChange.add((l, o) => {
1751
+ document.querySelector(`[${N.NAME}~='${N.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1752
+ const c = Fe(
1717
1753
  this.target,
1718
- c,
1719
- q,
1754
+ l,
1755
+ G,
1720
1756
  1,
1721
1757
  0,
1722
1758
  this.renderer.qualityFactor
1723
1759
  );
1724
- n && this.renderer.syncScene(n, o);
1725
- }), this.tracker.onStyleChange.add((c) => {
1726
- ot(this.registry, c);
1760
+ c && this.renderer.syncScene(c, o);
1761
+ }), this.tracker.onStyleChange.add((l) => {
1762
+ at(this.registry, l);
1727
1763
  }), this.tracker.onRender.add(() => {
1728
1764
  this.renderer.syncMeshesByDOM(), this.renderer.render();
1729
1765
  });
@@ -1735,9 +1771,9 @@ class at {
1735
1771
  this.tracker.stop();
1736
1772
  }
1737
1773
  }
1738
- class nt {
1774
+ class lt {
1739
1775
  constructor() {
1740
- p(this, "store");
1776
+ g(this, "store");
1741
1777
  this.store = /* @__PURE__ */ new WeakMap();
1742
1778
  }
1743
1779
  register(e, t) {
@@ -1760,30 +1796,30 @@ class nt {
1760
1796
  this.store.delete(e);
1761
1797
  }
1762
1798
  }
1763
- class dt {
1799
+ class ft {
1764
1800
  constructor(e, t) {
1765
- p(this, "renderer");
1766
- p(this, "syncer");
1767
- p(this, "target");
1768
- p(this, "registry");
1769
- var s, c, o;
1770
- if (this.target = e, this.registry = new nt(), !document.getElementById("mirage-engine-styles")) {
1771
- const a = document.createElement("style");
1772
- a.id = "mirage-engine-styles", a.textContent = `
1801
+ g(this, "renderer");
1802
+ g(this, "syncer");
1803
+ g(this, "target");
1804
+ g(this, "registry");
1805
+ var s, l, o;
1806
+ if (this.target = e, this.registry = new lt(), !document.getElementById("mirage-engine-styles")) {
1807
+ const n = document.createElement("style");
1808
+ n.id = "mirage-engine-styles", n.textContent = `
1773
1809
  [${ee.NAME}="${ee.VALUES.HIDE}"] {
1774
1810
  opacity: 0 !important;
1775
1811
  }
1776
- `, document.head.appendChild(a);
1812
+ `, document.head.appendChild(n);
1777
1813
  }
1778
- let i;
1779
- if (t.mode === "duplicate" ? i = (c = (s = t.container) != null ? s : this.target.parentElement) != null ? c : void 0 : i = (o = this.target.parentElement) != null ? o : void 0, !i)
1814
+ let r;
1815
+ if (t.mode === "duplicate" ? r = (l = (s = t.container) != null ? s : this.target.parentElement) != null ? l : void 0 : r = (o = this.target.parentElement) != null ? o : void 0, !r)
1780
1816
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1781
- this.renderer = new it(
1817
+ this.renderer = new ot(
1782
1818
  this.target,
1783
1819
  t,
1784
- i,
1820
+ r,
1785
1821
  this.registry
1786
- ), this.renderer.mount(), this.syncer = new at(this.target, this.renderer, this.registry, t);
1822
+ ), this.renderer.mount(), this.syncer = new ct(this.target, this.renderer, this.registry, t);
1787
1823
  }
1788
1824
  start() {
1789
1825
  this.syncer.start();
@@ -1815,37 +1851,37 @@ class dt {
1815
1851
  ArrowUp: !1,
1816
1852
  ArrowDown: !1
1817
1853
  };
1818
- window.addEventListener("keydown", (c) => {
1819
- t[c.key] !== void 0 && (t[c.key] = !0);
1820
- }), window.addEventListener("keyup", (c) => {
1821
- t[c.key] !== void 0 && (t[c.key] = !1);
1854
+ window.addEventListener("keydown", (l) => {
1855
+ t[l.key] !== void 0 && (t[l.key] = !0);
1856
+ }), window.addEventListener("keyup", (l) => {
1857
+ t[l.key] !== void 0 && (t[l.key] = !1);
1822
1858
  });
1823
- const i = 2, s = () => {
1824
- requestAnimationFrame(s), t.ArrowRight && e.position.setX(e.position.x + i), t.ArrowLeft && e.position.setX(e.position.x - i), t.ArrowUp && e.position.setY(e.position.y + i), t.ArrowDown && e.position.setY(e.position.y - i);
1859
+ const r = 2, s = () => {
1860
+ 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);
1825
1861
  };
1826
1862
  s();
1827
1863
  }
1828
1864
  }
1829
1865
  export {
1830
- Te as ALLOWED_FILTERS,
1866
+ Me as ALLOWED_FILTERS,
1831
1867
  ee as ATTR_DOM,
1832
- G as ATTR_FILTER,
1833
- ct as ATTR_SANDWICH,
1834
- j as ATTR_SELECT,
1835
- Ve as ATTR_SHADER,
1836
- _ as ATTR_TRAVEL,
1837
- we as DIRTY_CONTENT,
1838
- ue as DIRTY_NONE,
1868
+ H as ATTR_FILTER,
1869
+ dt as ATTR_SANDWICH,
1870
+ $ as ATTR_SELECT,
1871
+ Pe as ATTR_SHADER,
1872
+ N as ATTR_TRAVEL,
1873
+ ye as DIRTY_CONTENT,
1874
+ ge as DIRTY_NONE,
1839
1875
  re as DIRTY_RECT,
1840
- fe as DIRTY_STRUCTURE,
1841
- he as DIRTY_STYLE,
1842
- Ye as DIRTY_ZINDEX,
1843
- ht as EXCLUDED,
1844
- dt as Engine,
1876
+ pe as DIRTY_STRUCTURE,
1877
+ ue as DIRTY_STYLE,
1878
+ We as DIRTY_ZINDEX,
1879
+ ut as EXCLUDED,
1880
+ ft as Engine,
1845
1881
  ae as SELECT_LAYER,
1846
- B as THREE_LAYERS,
1847
- Ce as TRAVEL_VALUES,
1848
- He as Tracker,
1849
- q as USER_LAYER,
1850
- Pe as extractFromStyle
1882
+ F as THREE_LAYERS,
1883
+ Re as TRAVEL_VALUES,
1884
+ qe as Tracker,
1885
+ G as USER_LAYER,
1886
+ Ge as extractFromStyle
1851
1887
  };