@mirage-engine/core 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,33 @@
1
1
  var Oe = Object.defineProperty, Be = Object.defineProperties;
2
2
  var Fe = Object.getOwnPropertyDescriptors;
3
- var be = Object.getOwnPropertySymbols;
3
+ var ye = Object.getOwnPropertySymbols;
4
4
  var _e = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
5
5
  var oe = (s, e, t) => e in s ? Oe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, q = (s, e) => {
6
6
  for (var t in e || (e = {}))
7
7
  _e.call(e, t) && oe(s, t, e[t]);
8
- if (be)
9
- for (var t of be(e))
8
+ if (ye)
9
+ for (var t of ye(e))
10
10
  Ne.call(e, t) && oe(s, t, e[t]);
11
11
  return s;
12
12
  }, we = (s, e) => Be(s, Fe(e));
13
13
  var g = (s, e, t) => (oe(s, typeof e != "symbol" ? e + "" : e, t), t);
14
- var Ee = (s, e, t) => new Promise((r, i) => {
15
- var a = (l) => {
14
+ var Ee = (s, e, t) => new Promise((i, r) => {
15
+ var a = (c) => {
16
16
  try {
17
- o(t.next(l));
18
- } catch (c) {
19
- i(c);
17
+ o(t.next(c));
18
+ } catch (l) {
19
+ r(l);
20
20
  }
21
- }, n = (l) => {
21
+ }, n = (c) => {
22
22
  try {
23
- o(t.throw(l));
24
- } catch (c) {
25
- i(c);
23
+ o(t.throw(c));
24
+ } catch (l) {
25
+ r(l);
26
26
  }
27
- }, o = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(a, n);
27
+ }, o = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(a, n);
28
28
  o((t = t.apply(s, e)).next());
29
29
  });
30
- import * as y from "three";
30
+ import * as b from "three";
31
31
  const Re = {
32
32
  INCLUDE_TREE: "include-tree",
33
33
  EXCLUDE_TREE: "exclude-tree",
@@ -58,7 +58,7 @@ const Re = {
58
58
  NAME: "data-mirage-filter",
59
59
  KEY: "mirageFilter",
60
60
  VALUES: Re
61
- }, V = {
61
+ }, Y = {
62
62
  NAME: "data-mirage-select",
63
63
  KEY: "mirageSelect",
64
64
  VALUES: Re
@@ -71,7 +71,7 @@ const Re = {
71
71
  VALUES: {
72
72
  FRONT: "front"
73
73
  }
74
- }, te = 0, $ = 1, Q = 2, ze = 4, re = 8, le = 16;
74
+ }, te = 0, $ = 1, Q = 2, ze = 4, re = 8, ce = 16;
75
75
  function Ve(s) {
76
76
  const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
77
77
  return e ? {
@@ -131,36 +131,36 @@ class We {
131
131
  g(this, "renderLoop", () => {
132
132
  if (!this.isRunning)
133
133
  return;
134
- this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = te);
134
+ this.onBeforeRender.forEach((i) => i()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((i) => i(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = te);
135
135
  const e = window.scrollX, t = window.scrollY;
136
- (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(() => {
136
+ (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(() => {
137
137
  this.pendingMask |= $, this.isDomDirty = !0, this.scrollTimer = null;
138
- }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((r) => r(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((r) => r()), requestAnimationFrame(this.renderLoop);
138
+ }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((i) => i(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((i) => i()), requestAnimationFrame(this.renderLoop);
139
139
  });
140
- var i, a;
140
+ var r, a;
141
141
  this.target = e;
142
- const r = (i = t.resizeDebounce) != null ? i : !0;
143
- r === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : r === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
142
+ const i = (r = t.resizeDebounce) != null ? r : !0;
143
+ i === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : i === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
144
144
  enabled: !0,
145
- delay: (a = r.delay) != null ? a : 150,
146
- onStart: r.onStart,
147
- onEnd: r.onEnd
145
+ delay: (a = i.delay) != null ? a : 150,
146
+ onStart: i.onStart,
147
+ onEnd: i.onEnd
148
148
  }, this.observer = new MutationObserver((n) => {
149
149
  let o = te;
150
- for (const l of n)
151
- if (l.type === "childList")
152
- o |= re, l.removedNodes.length > 0 && l.removedNodes.forEach((c) => {
153
- c instanceof HTMLElement && this.pendingDeletions.add(c);
150
+ for (const c of n)
151
+ if (c.type === "childList")
152
+ o |= re, c.removedNodes.length > 0 && c.removedNodes.forEach((l) => {
153
+ l instanceof HTMLElement && this.pendingDeletions.add(l);
154
154
  });
155
- else if (l.type === "attributes")
156
- if (l.attributeName === "style") {
155
+ else if (c.type === "attributes")
156
+ if (c.attributeName === "style") {
157
157
  o |= $ | Q;
158
- const c = l.target, d = Ye(c.style);
159
- this.pendingStyles.set(c, d);
158
+ const l = c.target, d = Ye(l.style);
159
+ this.pendingStyles.set(l, d);
160
160
  } else
161
- l.attributeName === "class" ? o |= $ | Q : l.attributeName && l.attributeName.startsWith("data-") && (o |= $ | Q, l.attributeName.startsWith("data-mirage") && (o |= re));
161
+ c.attributeName === "class" ? o |= $ | Q : c.attributeName && c.attributeName.startsWith("data-") && (o |= $ | Q, c.attributeName.startsWith("data-mirage") && (o |= re));
162
162
  else
163
- l.type === "characterData" && (o |= le | $);
163
+ c.type === "characterData" && (o |= ce | $);
164
164
  if (o !== te) {
165
165
  if (this.pendingMask |= o, o & re) {
166
166
  this.clearTimers(), this.isDomDirty = !0;
@@ -187,7 +187,7 @@ class We {
187
187
  this.mutationTimer && (clearTimeout(this.mutationTimer), this.mutationTimer = null), this.cssTimer && (clearTimeout(this.cssTimer), this.cssTimer = null), this.scrollTimer && (clearTimeout(this.scrollTimer), this.scrollTimer = null);
188
188
  }
189
189
  }
190
- const W = 1, j = 2, lt = 0, L = {
190
+ const W = 1, j = 2, ct = 0, L = {
191
191
  BASE: 0,
192
192
  SELECTED: 1,
193
193
  getCaptureLayer: (s) => 31 - s,
@@ -208,18 +208,18 @@ class Le {
208
208
  static calculateBaselineFromDOM(e) {
209
209
  if (typeof document == "undefined")
210
210
  return 0;
211
- const t = document.createElement("div"), r = document.createElement("span"), i = document.createElement("img");
212
- 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", i.width = 1, i.height = 1, i.style.verticalAlign = "baseline", r.appendChild(document.createTextNode("Hidden Text")), t.appendChild(r), t.appendChild(i), document.body.appendChild(t);
213
- const a = i.offsetTop - r.offsetTop;
211
+ const t = document.createElement("div"), i = document.createElement("span"), r = document.createElement("img");
212
+ t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none", i.style.margin = "0", i.style.padding = "0", i.style.border = "none", i.style.lineHeight = "normal", r.width = 1, r.height = 1, r.style.verticalAlign = "baseline", i.appendChild(document.createTextNode("Hidden Text")), t.appendChild(i), t.appendChild(r), document.body.appendChild(t);
213
+ const a = r.offsetTop - i.offsetTop;
214
214
  return document.body.removeChild(t), a;
215
215
  }
216
216
  }
217
217
  g(Le, "cache", /* @__PURE__ */ new Map());
218
- class He extends y.MeshBasicMaterial {
219
- constructor(t, r, i, a, n = 2) {
218
+ class He extends b.MeshBasicMaterial {
219
+ constructor(t, i, r, a, n = 2) {
220
220
  super({
221
221
  transparent: !0,
222
- side: y.FrontSide,
222
+ side: b.FrontSide,
223
223
  color: 16777215
224
224
  });
225
225
  g(this, "canvas");
@@ -227,34 +227,34 @@ class He extends y.MeshBasicMaterial {
227
227
  g(this, "qualityFactor");
228
228
  if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
229
229
  throw new Error("[Mirage] Failed to create canvas context");
230
- this.qualityFactor = n, this.map = new y.CanvasTexture(this.canvas), this.map.colorSpace = y.LinearSRGBColorSpace, this.map.minFilter = y.LinearFilter, this.map.magFilter = y.LinearFilter, this.updateText(t, r, i, a);
230
+ this.qualityFactor = n, this.map = new b.CanvasTexture(this.canvas), this.map.colorSpace = b.LinearSRGBColorSpace, this.map.minFilter = b.LinearFilter, this.map.magFilter = b.LinearFilter, this.updateText(t, i, r, a);
231
231
  }
232
- wrapText(t, r) {
233
- const i = t.split(`
232
+ wrapText(t, i) {
233
+ const r = t.split(`
234
234
  `), a = [];
235
- return i.forEach((n) => {
235
+ return r.forEach((n) => {
236
236
  const o = n.match(/[^\s\-]+\-?|\-|\s+/g) || [];
237
237
  if (o.length === 0) {
238
238
  a.push("");
239
239
  return;
240
240
  }
241
- let l = o[0];
242
- for (let c = 1; c < o.length; c++) {
243
- const d = o[c];
244
- this.ctx.measureText(l + d).width <= r + 2 ? l += d : (l && a.push(l), l = d.trimStart());
241
+ let c = o[0];
242
+ for (let l = 1; l < o.length; l++) {
243
+ const d = o[l];
244
+ this.ctx.measureText(c + d).width <= i + 2 ? c += d : (c && a.push(c), c = d.trimStart());
245
245
  }
246
- l && a.push(l);
246
+ c && a.push(c);
247
247
  }), a;
248
248
  }
249
- updateText(t, r, i, a, n) {
249
+ updateText(t, i, r, a, n) {
250
250
  n !== void 0 && (this.qualityFactor = n);
251
- const l = (window.devicePixelRatio || 1) * this.qualityFactor, c = i * l, d = a * l;
252
- this.canvas.width !== c || this.canvas.height !== d ? (this.canvas.width = c, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(l, 0, 0, l, 0, 0), this.ctx.font = r.font, this.ctx.fillStyle = r.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
253
- const h = this.wrapText(t, i), u = r.lineHeight, p = Le.getBaseline(r.font);
251
+ const c = (window.devicePixelRatio || 1) * this.qualityFactor, l = r * c, d = a * c;
252
+ 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(c, 0, 0, c, 0, 0), this.ctx.font = i.font, this.ctx.fillStyle = i.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
253
+ const h = this.wrapText(t, r), u = i.lineHeight, p = Le.getBaseline(i.font);
254
254
  h.forEach((f, m) => {
255
255
  const E = m * u + p;
256
256
  let R = 0;
257
- r.textAlign === "center" ? R = i / 2 : r.textAlign === "right" && (R = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(f, R, E);
257
+ i.textAlign === "center" ? R = r / 2 : i.textAlign === "right" && (R = r), this.ctx.textAlign = i.textAlign, this.ctx.fillText(f, R, E);
258
258
  }), this.map && (this.map.needsUpdate = !0);
259
259
  }
260
260
  dispose() {
@@ -266,26 +266,26 @@ function K(s) {
266
266
  }
267
267
  function Z(s) {
268
268
  if (!s || s === "transparent")
269
- return { color: new y.Color(16777215), alpha: 0 };
269
+ return { color: new b.Color(16777215), alpha: 0 };
270
270
  const e = s.match(
271
271
  /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
272
272
  );
273
273
  if (e) {
274
- const t = parseInt(e[1], 10), r = parseInt(e[2], 10), i = parseInt(e[3], 10), a = e[4] !== void 0 ? parseFloat(e[4]) : 1;
275
- return { color: new y.Color(`rgb(${t}, ${r}, ${i})`), alpha: a };
274
+ const t = parseInt(e[1], 10), i = parseInt(e[2], 10), r = parseInt(e[3], 10), a = e[4] !== void 0 ? parseFloat(e[4]) : 1;
275
+ return { color: new b.Color(`rgb(${t}, ${i}, ${r})`), alpha: a };
276
276
  }
277
- return { color: new y.Color(s), alpha: 1 };
277
+ return { color: new b.Color(s), alpha: 1 };
278
278
  }
279
279
  function Pe(s) {
280
280
  const e = [];
281
- let t = "", r = 0;
282
- for (let i = 0; i < s.length; i++) {
283
- const a = s[i];
281
+ let t = "", i = 0;
282
+ for (let r = 0; r < s.length; r++) {
283
+ const a = s[r];
284
284
  if (a === "(")
285
- r++;
285
+ i++;
286
286
  else if (a === ")")
287
- r--;
288
- else if (a === "," && r === 0) {
287
+ i--;
288
+ else if (a === "," && i === 0) {
289
289
  e.push(t.trim()), t = "";
290
290
  continue;
291
291
  }
@@ -299,22 +299,22 @@ function Ge(s) {
299
299
  const e = s.match(/linear-gradient\((.*)\)/);
300
300
  if (!e)
301
301
  return null;
302
- const t = e[1], r = Pe(t);
303
- let i = Math.PI, a = 0;
304
- const n = r[0].trim();
302
+ const t = e[1], i = Pe(t);
303
+ let r = Math.PI, a = 0;
304
+ const n = i[0].trim();
305
305
  if (n.startsWith("to "))
306
- n === "to top" ? i = 0 : n === "to right" ? i = Math.PI / 2 : n === "to bottom" ? i = Math.PI : n === "to left" ? i = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? i = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? i = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? i = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (i = Math.PI * 1.75), a = 1;
306
+ n === "to top" ? r = 0 : n === "to right" ? r = Math.PI / 2 : n === "to bottom" ? r = Math.PI : n === "to left" ? r = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? r = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? r = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? r = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (r = Math.PI * 1.75), a = 1;
307
307
  else if (n.endsWith("deg") || n.endsWith("rad") || n.endsWith("turn")) {
308
- const l = parseFloat(n);
309
- n.endsWith("deg") ? i = l * (Math.PI / 180) : n.endsWith("rad") ? i = l : n.endsWith("turn") && (i = l * Math.PI * 2), a = 1;
308
+ const c = parseFloat(n);
309
+ n.endsWith("deg") ? r = c * (Math.PI / 180) : n.endsWith("rad") ? r = c : n.endsWith("turn") && (r = c * Math.PI * 2), a = 1;
310
310
  }
311
311
  const o = [];
312
- for (let l = a; l < r.length && !(o.length >= 8); l++) {
313
- const c = r[l].trim(), d = c.lastIndexOf(" ");
314
- let h = c, u = null;
315
- if (d !== -1 && !c.endsWith(")")) {
316
- const f = c.substring(d + 1);
317
- (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = c.substring(0, d).trim(), u = f);
312
+ for (let c = a; c < i.length && !(o.length >= 8); c++) {
313
+ const l = i[c].trim(), d = l.lastIndexOf(" ");
314
+ let h = l, u = null;
315
+ if (d !== -1 && !l.endsWith(")")) {
316
+ const f = l.substring(d + 1);
317
+ (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = l.substring(0, d).trim(), u = f);
318
318
  }
319
319
  const p = Z(h);
320
320
  o.push({
@@ -325,22 +325,22 @@ function Ge(s) {
325
325
  });
326
326
  }
327
327
  if (o.length > 0) {
328
- for (let c = 0; c < o.length; c++)
329
- o[c].rawStop !== null && (o[c].stop = parseFloat(o[c].rawStop) / 100);
328
+ for (let l = 0; l < o.length; l++)
329
+ o[l].rawStop !== null && (o[l].stop = parseFloat(o[l].rawStop) / 100);
330
330
  o[0].rawStop === null && (o[0].stop = 0), o.length > 1 && o[o.length - 1].rawStop === null && (o[o.length - 1].stop = 1);
331
- let l = 0;
332
- for (let c = 1; c < o.length; c++)
333
- if (o[c].rawStop !== null || c === o.length - 1) {
334
- const d = c - l;
331
+ let c = 0;
332
+ for (let l = 1; l < o.length; l++)
333
+ if (o[l].rawStop !== null || l === o.length - 1) {
334
+ const d = l - c;
335
335
  if (d > 1) {
336
- const h = o[l].stop, p = (o[c].stop - h) / d;
336
+ const h = o[c].stop, p = (o[l].stop - h) / d;
337
337
  for (let f = 1; f < d; f++)
338
- o[l + f].stop = h + p * f;
338
+ o[c + f].stop = h + p * f;
339
339
  }
340
- l = c;
340
+ c = l;
341
341
  }
342
342
  }
343
- return { angle: i, stops: o };
343
+ return { angle: r, stops: o };
344
344
  }
345
345
  const qe = `varying vec2 vUv;
346
346
  varying vec4 vScreenPos;
@@ -492,25 +492,25 @@ baseColor = blendSrcOver(baseColor, texColor);`, Te = {
492
492
  uvChunk: Ke,
493
493
  baseColorChunk: Je
494
494
  };
495
- function Qe(s, e, t, r = null, i) {
495
+ function Qe(s, e, t, i = null, r) {
496
496
  var M;
497
- const a = r !== null || !!s.imageSrc;
497
+ const a = i !== null || !!s.imageSrc;
498
498
  let n = "";
499
499
  const o = {};
500
- if (i != null && i.uniforms)
501
- for (const [w, b] of Object.entries(i.uniforms))
502
- typeof b == "number" ? (n += `uniform float ${w};
503
- `, o[w] = { value: b }) : Array.isArray(b) ? b.length === 2 ? (n += `uniform vec2 ${w};
504
- `, o[w] = { value: new y.Vector2(...b) }) : b.length === 3 ? (n += `uniform vec3 ${w};
505
- `, o[w] = { value: new y.Vector3(...b) }) : b.length === 4 && (n += `uniform vec4 ${w};
506
- `, o[w] = { value: new y.Vector4(...b) }) : (n += `uniform float ${w};
507
- `, o[w] = { value: b });
508
- const l = (a ? ae.declChunk : "") + `
509
- ` + n, c = s.isTraveler ? ae.uvChunk : `vec2 resultUv = vUv * uTextureRepeat + uTextureOffset;
510
- `, d = a ? c + ((i == null ? void 0 : i.uvModifier) || "") : "", h = a ? ae.baseColorChunk : "", u = (i == null ? void 0 : i.colorModifier) || "", p = Te.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", h).replace("#INJECT_COLOR_MODIFIER", u), f = Z(s.backgroundColor), m = Z(s.borderColor), E = {
511
- uSize: { value: new y.Vector2(e, t) },
500
+ if (r != null && r.uniforms)
501
+ for (const [w, y] of Object.entries(r.uniforms))
502
+ typeof y == "number" ? (n += `uniform float ${w};
503
+ `, o[w] = { value: y }) : Array.isArray(y) ? y.length === 2 ? (n += `uniform vec2 ${w};
504
+ `, o[w] = { value: new b.Vector2(...y) }) : y.length === 3 ? (n += `uniform vec3 ${w};
505
+ `, o[w] = { value: new b.Vector3(...y) }) : y.length === 4 && (n += `uniform vec4 ${w};
506
+ `, o[w] = { value: new b.Vector4(...y) }) : (n += `uniform float ${w};
507
+ `, o[w] = { value: y });
508
+ const c = (a ? ae.declChunk : "") + `
509
+ ` + n, l = s.isTraveler ? ae.uvChunk : `vec2 resultUv = vUv * uTextureRepeat + uTextureOffset;
510
+ `, d = a ? l + ((r == null ? void 0 : r.uvModifier) || "") : "", h = a ? ae.baseColorChunk : "", u = (r == null ? void 0 : r.colorModifier) || "", p = Te.fragmentShader.replace("#INJECT_DECLARATIONS", c).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", h).replace("#INJECT_COLOR_MODIFIER", u), f = Z(s.backgroundColor), m = Z(s.borderColor), E = {
511
+ uSize: { value: new b.Vector2(e, t) },
512
512
  uBgColor: {
513
- value: new y.Vector4(
513
+ value: new b.Vector4(
514
514
  f.color.r,
515
515
  f.color.g,
516
516
  f.color.b,
@@ -518,53 +518,53 @@ function Qe(s, e, t, r = null, i) {
518
518
  )
519
519
  },
520
520
  uBorderColor: {
521
- value: new y.Vector4(
521
+ value: new b.Vector4(
522
522
  m.color.r,
523
523
  m.color.g,
524
524
  m.color.b,
525
525
  m.alpha
526
526
  )
527
527
  },
528
- uBorderRadius: { value: new y.Vector4(0, 0, 0, 0) },
528
+ uBorderRadius: { value: new b.Vector4(0, 0, 0, 0) },
529
529
  uBorderWidth: { value: K(s.borderWidth) },
530
530
  uOpacity: { value: (M = s.opacity) != null ? M : 1 },
531
531
  uTexture: { value: null },
532
- uTextureRepeat: { value: new y.Vector2(1, 1) },
533
- uTextureOffset: { value: new y.Vector2(0, 0) },
532
+ uTextureRepeat: { value: new b.Vector2(1, 1) },
533
+ uTextureOffset: { value: new b.Vector2(0, 0) },
534
534
  uGradientCount: { value: 0 },
535
535
  uGradientAngle: { value: 0 },
536
536
  uGradientColors: {
537
- value: Array.from({ length: 8 }, () => new y.Vector4(0, 0, 0, 0))
537
+ value: Array.from({ length: 8 }, () => new b.Vector4(0, 0, 0, 0))
538
538
  },
539
539
  uGradientStops: { value: new Float32Array(8) }
540
540
  };
541
- Me(E.uBorderRadius.value, s.borderRadius), a && (E.uTexture.value = r);
542
- const R = new y.ShaderMaterial({
541
+ Me(E.uBorderRadius.value, s.borderRadius), a && (E.uTexture.value = i);
542
+ const R = new b.ShaderMaterial({
543
543
  uniforms: q(q({}, E), o),
544
544
  vertexShader: Te.vertexShader,
545
545
  fragmentShader: p,
546
546
  transparent: !0,
547
- side: y.FrontSide
547
+ side: b.FrontSide
548
548
  // for better performance
549
549
  });
550
- return s.backgroundImage && ce(R, { backgroundImage: s.backgroundImage }), R;
550
+ return s.backgroundImage && le(R, { backgroundImage: s.backgroundImage }), R;
551
551
  }
552
- function Ze(s, e, t, r, i) {
552
+ function Ze(s, e, t, i, r) {
553
553
  const a = K(e.borderWidth);
554
- ce(s, {
554
+ le(s, {
555
555
  width: t,
556
- height: r,
556
+ height: i,
557
557
  borderRadius: e.borderRadius,
558
558
  borderWidth: a,
559
559
  backgroundColor: e.backgroundColor,
560
560
  borderColor: e.borderColor,
561
561
  opacity: e.opacity,
562
- texture: i,
562
+ texture: r,
563
563
  backgroundImage: e.backgroundImage
564
564
  });
565
565
  }
566
- function ce(s, e) {
567
- var r, i, a;
566
+ function le(s, e) {
567
+ var i, r, a;
568
568
  if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), e.borderRadius !== void 0 && Me(s.uniforms.uBorderRadius.value, e.borderRadius), e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
569
569
  if (Array.isArray(e.backgroundColor)) {
570
570
  const n = s.uniforms.uBgColor.value.w;
@@ -618,11 +618,11 @@ function ce(s, e) {
618
618
  );
619
619
  }
620
620
  e.opacity !== void 0 && (s.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (s.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (s.uniforms.uBorderColor.value.w = e.borderOpacity), s.uniforms.uTexture && e.texture !== void 0 && (s.uniforms.uTexture.value = e.texture);
621
- const t = e.texture !== void 0 ? e.texture : (r = s.uniforms.uTexture) == null ? void 0 : r.value;
621
+ const t = e.texture !== void 0 ? e.texture : (i = s.uniforms.uTexture) == null ? void 0 : i.value;
622
622
  if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
623
- const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, o = t.image.naturalHeight || t.image.videoHeight || t.image.height, l = (i = e.width) != null ? i : s.uniforms.uSize.value.x, c = (a = e.height) != null ? a : s.uniforms.uSize.value.y;
624
- if (n && o && l && c) {
625
- const d = n / o, h = l / c;
623
+ const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, o = t.image.naturalHeight || t.image.videoHeight || t.image.height, c = (r = e.width) != null ? r : s.uniforms.uSize.value.x, l = (a = e.height) != null ? a : s.uniforms.uSize.value.y;
624
+ if (n && o && c && l) {
625
+ const d = n / o, h = c / l;
626
626
  if (d > h) {
627
627
  const u = h / d;
628
628
  s.uniforms.uTextureRepeat.value.set(u, 1), s.uniforms.uTextureOffset.value.set((1 - u) / 2, 0);
@@ -639,13 +639,13 @@ function ce(s, e) {
639
639
  s.uniforms.uGradientCount.value = n.stops.length, s.uniforms.uGradientAngle.value = n.angle;
640
640
  for (let o = 0; o < 8; o++)
641
641
  if (o < n.stops.length) {
642
- const l = n.stops[o];
642
+ const c = n.stops[o];
643
643
  s.uniforms.uGradientColors.value[o].set(
644
- l.color.r,
645
- l.color.g,
646
- l.color.b,
647
- l.alpha
648
- ), s.uniforms.uGradientStops.value[o] = l.stop;
644
+ c.color.r,
645
+ c.color.g,
646
+ c.color.b,
647
+ c.alpha
648
+ ), s.uniforms.uGradientStops.value[o] = c.stop;
649
649
  } else
650
650
  s.uniforms.uGradientColors.value[o].set(0, 0, 0, 0), s.uniforms.uGradientStops.value[o] = 1;
651
651
  } else
@@ -655,7 +655,7 @@ function ce(s, e) {
655
655
  n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && s.uniforms[n] !== void 0 && (s.uniforms[n].value !== void 0 && s.uniforms[n].value !== null && typeof s.uniforms[n].value.set == "function" ? Array.isArray(e[n]) ? s.uniforms[n].value.set(...e[n]) : e[n] !== void 0 && (e[n].copy ? s.uniforms[n].value.copy(e[n]) : s.uniforms[n].value = e[n]) : s.uniforms[n].value = e[n]);
656
656
  }
657
657
  function Me(s, e) {
658
- var o, l, c, d;
658
+ var o, c, l, d;
659
659
  if (e == null) {
660
660
  s.set(0, 0, 0, 0);
661
661
  return;
@@ -668,42 +668,42 @@ function Me(s, e) {
668
668
  s.set(e[0], e[1], e[2], e[3]);
669
669
  return;
670
670
  }
671
- const t = e.split("/")[0].trim().split(/\s+/), r = K(t[0]), i = K((o = t[1]) != null ? o : t[0]), a = K((l = t[2]) != null ? l : t[0]), n = K((d = (c = t[3]) != null ? c : t[1]) != null ? d : t[0]);
672
- s.set(r, i, a, n);
671
+ const t = e.split("/")[0].trim().split(/\s+/), i = K(t[0]), r = K((o = t[1]) != null ? o : t[0]), a = K((c = t[2]) != null ? c : t[0]), n = K((d = (l = t[3]) != null ? l : t[1]) != null ? d : t[0]);
672
+ s.set(i, r, a, n);
673
673
  }
674
- const Y = {
675
- create(s, e, t, r, i, a = 2, n = null, o) {
674
+ const N = {
675
+ create(s, e, t, i, r, a = 2, n = null, o) {
676
676
  return s === "BOX" ? Qe(
677
677
  e,
678
- r,
679
678
  i,
679
+ r,
680
680
  n,
681
681
  o
682
682
  ) : s === "TEXT" ? new He(
683
683
  t || "",
684
684
  e,
685
- r,
686
685
  i,
686
+ r,
687
687
  a
688
- ) : new y.MeshBasicMaterial({ visible: !1 });
688
+ ) : new b.MeshBasicMaterial({ visible: !1 });
689
689
  },
690
- update(s, e, t, r, i, a, n = 2, o) {
690
+ update(s, e, t, i, r, a, n = 2, o) {
691
691
  e === "BOX" ? Ze(
692
692
  s,
693
693
  t,
694
- i,
694
+ r,
695
695
  a,
696
696
  o
697
697
  ) : e === "TEXT" && s.updateText(
698
- r || "",
698
+ i || "",
699
699
  t,
700
- i,
700
+ r,
701
701
  a,
702
702
  n
703
703
  );
704
704
  },
705
705
  forceUpdateUniforms(s, e) {
706
- ce(s, e);
706
+ le(s, e);
707
707
  }
708
708
  };
709
709
  class et {
@@ -714,10 +714,10 @@ class et {
714
714
  g(this, "elementUrls", /* @__PURE__ */ new WeakMap());
715
715
  g(this, "onUpdate");
716
716
  this.onUpdate = e, t && (this.observer = new IntersectionObserver(
717
- (r) => {
718
- for (const i of r) {
719
- const a = i.target;
720
- i.isIntersecting ? this.loadTexture(a) : this.disposeTexture(a);
717
+ (i) => {
718
+ for (const r of i) {
719
+ const a = r.target;
720
+ r.isIntersecting ? this.loadTexture(a) : this.disposeTexture(a);
721
721
  }
722
722
  },
723
723
  { rootMargin: "300px" }
@@ -739,24 +739,24 @@ class et {
739
739
  if (t) {
740
740
  this.loadStatus.set(e, !0);
741
741
  try {
742
- let r;
742
+ let i;
743
743
  if (t.startsWith("data:image/svg+xml"))
744
- r = yield new Promise((a, n) => {
744
+ i = yield new Promise((a, n) => {
745
745
  const o = new Image();
746
746
  o.onload = () => a(o), o.onerror = n, o.src = t;
747
747
  });
748
748
  else {
749
749
  const n = yield (yield fetch(t)).blob();
750
- r = yield createImageBitmap(n, { imageOrientation: "flipY" });
750
+ i = yield createImageBitmap(n, { imageOrientation: "flipY" });
751
751
  }
752
752
  if (this.elementUrls.get(e) !== t) {
753
- "close" in r && r.close();
753
+ "close" in i && i.close();
754
754
  return;
755
755
  }
756
- const i = new y.Texture(r);
757
- r instanceof HTMLImageElement || (i.flipY = !1), i.colorSpace = y.LinearSRGBColorSpace, i.needsUpdate = !0, this.textures.set(e, i), this.onUpdate(e, i);
758
- } catch (r) {
759
- console.warn("[MirageEngine] Failed to load texture:", t, r);
756
+ const r = new b.Texture(i);
757
+ i instanceof HTMLImageElement || (r.flipY = !1), r.colorSpace = b.LinearSRGBColorSpace, r.needsUpdate = !0, this.textures.set(e, r), this.onUpdate(e, r);
758
+ } catch (i) {
759
+ console.warn("[MirageEngine] Failed to load texture:", t, i);
760
760
  } finally {
761
761
  this.elementUrls.has(e) && this.loadStatus.set(e, !1);
762
762
  }
@@ -775,7 +775,7 @@ class et {
775
775
  }
776
776
  }
777
777
  class tt {
778
- constructor(e, t, r, i) {
778
+ constructor(e, t, i, r) {
779
779
  g(this, "canvas");
780
780
  g(this, "scene");
781
781
  g(this, "camera");
@@ -799,26 +799,26 @@ class tt {
799
799
  g(this, "textureManager");
800
800
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
801
801
  g(this, "fixedMeshes", /* @__PURE__ */ new Set());
802
- var o, l, c, d, h;
803
- this.target = e, this.mountContainer = r, this.registry = i, this.mode = (o = t.mode) != null ? o : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (c = t.travelerClipArea) != null ? c : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new et((u, p) => {
802
+ var o, c, l, d, h;
803
+ this.target = e, this.mountContainer = i, this.registry = r, this.mode = (o = t.mode) != null ? o : "overlay", this.canvasSize = (c = t.canvasSize) != null ? c : "viewport", this.clipArea = (l = t.travelerClipArea) != null ? l : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new et((u, p) => {
804
804
  const f = this.registry.get(u);
805
- f && f.material instanceof y.ShaderMaterial && Y.forceUpdateUniforms(f.material, { texture: p });
806
- }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new y.Scene(), this.targetRect = this.target.getBoundingClientRect();
805
+ f && f.material instanceof b.ShaderMaterial && N.forceUpdateUniforms(f.material, { texture: p });
806
+ }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new b.Scene(), this.targetRect = this.target.getBoundingClientRect();
807
807
  const a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
808
- this.camera = new y.OrthographicCamera(
808
+ this.camera = new b.OrthographicCamera(
809
809
  a / -2,
810
810
  a / 2,
811
811
  n / 2,
812
812
  n / -2,
813
813
  1,
814
814
  1e3
815
- ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new y.WebGLRenderer({
815
+ ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new b.WebGLRenderer({
816
816
  canvas: this.canvas,
817
817
  alpha: !0,
818
818
  antialias: !0
819
819
  // [new]
820
820
  // premultipliedAlpha: true
821
- }), y.ColorManagement.enabled = !1, this.renderer.outputColorSpace = y.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(a, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
821
+ }), b.ColorManagement.enabled = !1, this.renderer.outputColorSpace = b.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(a, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
822
822
  }
823
823
  get isViewport() {
824
824
  return this.mode === "overlay" && this.canvasSize === "viewport";
@@ -828,15 +828,15 @@ class tt {
828
828
  }
829
829
  createRenderTarget() {
830
830
  for (let e = 0; e < k.MAX_LAYERS; e++) {
831
- const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
831
+ const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, i = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
832
832
  this.renderTargets.push(
833
- new y.WebGLRenderTarget(
833
+ new b.WebGLRenderTarget(
834
834
  t * this.qualityFactor,
835
- r * this.qualityFactor,
835
+ i * this.qualityFactor,
836
836
  {
837
- minFilter: y.LinearFilter,
838
- magFilter: y.LinearFilter,
839
- format: y.RGBAFormat,
837
+ minFilter: b.LinearFilter,
838
+ magFilter: b.LinearFilter,
839
+ format: b.RGBAFormat,
840
840
  stencilBuffer: !1,
841
841
  depthBuffer: !0
842
842
  }
@@ -872,15 +872,15 @@ class tt {
872
872
  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");
873
873
  }
874
874
  updateUniforms(e, t) {
875
- const r = this.registry.get(e);
876
- r && (r.traverse((i) => {
877
- i.isMesh && i.material && Y.forceUpdateUniforms(
878
- i.material,
875
+ const i = this.registry.get(e);
876
+ i && (i.traverse((r) => {
877
+ r.isMesh && r.material && N.forceUpdateUniforms(
878
+ r.material,
879
879
  t
880
880
  );
881
- }), r.userData.nativeMesh && r.userData.nativeMesh.traverse((i) => {
882
- i.isMesh && i.material && Y.forceUpdateUniforms(
883
- i.material,
881
+ }), i.userData.nativeMesh && i.userData.nativeMesh.traverse((r) => {
882
+ r.isMesh && r.material && N.forceUpdateUniforms(
883
+ r.material,
884
884
  t
885
885
  );
886
886
  }));
@@ -890,20 +890,22 @@ class tt {
890
890
  }
891
891
  setSize(e, t) {
892
892
  this.renderer.setSize(e, t);
893
- for (const r of this.renderTargets)
894
- r.setSize(e * this.qualityFactor, t * this.qualityFactor);
893
+ for (const i of this.renderTargets)
894
+ i.setSize(e * this.qualityFactor, t * this.qualityFactor);
895
895
  this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
896
896
  }
897
897
  syncScene(e, t) {
898
- const r = this.target.getBoundingClientRect(), i = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, a = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, o = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, l = Math.abs(i - n) > 0.1 || Math.abs(a - o) > 0.1, c = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
899
- l ? (this.targetRect = r, this.setSize(i, a), this.updateCanvasLayout()) : c ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
898
+ const i = this.target.getBoundingClientRect(), r = this.isViewport ? window.innerWidth + this.overscan * 2 : i.width, a = this.isViewport ? window.innerHeight + this.overscan * 2 : i.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, o = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, c = Math.abs(r - n) > 0.1 || Math.abs(a - o) > 0.1, l = this.mode === "overlay" && (Math.abs(i.top - this.targetRect.top) > 0.1 || Math.abs(i.left - this.targetRect.left) > 0.1);
899
+ c ? (this.targetRect = i, this.setSize(r, a), this.updateCanvasLayout()) : l ? (this.targetRect = i, this.updateCanvasLayout()) : this.targetRect = i, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
900
900
  const h = this.registry.get(d);
901
901
  if (h) {
902
902
  this.scene.remove(h);
903
903
  for (const u of this.travelersByLayer)
904
904
  u.delete(h);
905
- 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((u) => u.dispose()) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((u) => {
906
- u instanceof y.Mesh && (u.geometry && u.geometry.dispose(), u.material && (Array.isArray(u.material) ? u.material.forEach((p) => p.dispose()) : u.material.dispose()));
905
+ 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(
906
+ (u) => u.dispose()
907
+ ) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((u) => {
908
+ u instanceof b.Mesh && (u.geometry && u.geometry.dispose(), u.material && (Array.isArray(u.material) ? u.material.forEach((p) => p.dispose()) : u.material.dispose()));
907
909
  }), this.registry.remove(d), this.textureManager.unregister(d);
908
910
  }
909
911
  });
@@ -913,11 +915,11 @@ class tt {
913
915
  // => 이후 activeElements를 이용하여 mesh를 정리!!!+ map에서도 삭제
914
916
  // private reconcileNode(node: SceneNode, activeElements: Set<HTMLElement>) {
915
917
  reconcileNode(e) {
916
- var i;
918
+ var r;
917
919
  let t = this.registry.get(e.element);
918
- const r = JSON.stringify(e.shaderHooks || null);
919
- if (t && t.userData.shaderHash !== r && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof y.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
920
- const a = new y.PlaneGeometry(1, 1), n = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), o = Y.create(
920
+ const i = JSON.stringify(e.shaderHooks || null);
921
+ if (t && t.userData.shaderHash !== i && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof b.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
922
+ const a = new b.PlaneGeometry(1, 1), n = e.isTraveler ? (r = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : r.texture : this.textureManager.get(e.element), o = N.create(
921
923
  "BOX",
922
924
  e.styles,
923
925
  "",
@@ -927,7 +929,7 @@ class tt {
927
929
  n,
928
930
  e.shaderHooks
929
931
  );
930
- t = new y.Mesh(a, o), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = o, t.userData.domElement = e.element, t.userData.shaderHash = r;
932
+ t = new b.Mesh(a, o), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = o, t.userData.domElement = e.element, t.userData.shaderHash = i;
931
933
  }
932
934
  if (this.updateMeshProperties(t, e), this.updateMeshLayers(t, e), e.isTraveler)
933
935
  for (let a = 0; a < k.MAX_LAYERS; a++)
@@ -939,14 +941,18 @@ class tt {
939
941
  for (const a of e.children)
940
942
  this.reconcileNode(a);
941
943
  else
942
- e.type === "TEXT" && (this.reconcileTextChild(t, e, !1), t.userData.nativeMesh && e.nativeStyles && this.reconcileTextChild(t.userData.nativeMesh, e, !0));
943
- }
944
- reconcileTextChild(e, t, r) {
945
- var c;
946
- const i = t.textLines || [
944
+ e.type === "TEXT" && (this.reconcileTextChild(t, e, !1), t.userData.nativeMesh && e.nativeStyles && this.reconcileTextChild(
945
+ t.userData.nativeMesh,
946
+ e,
947
+ !0
948
+ ));
949
+ }
950
+ reconcileTextChild(e, t, i) {
951
+ var l;
952
+ const r = t.textLines || [
947
953
  { text: t.textContent || "", rect: t.rect }
948
- ], a = r ? t.nativeStyles : t.textStyles, n = JSON.stringify(a) + t.textContent + i.map((d) => d.text).join("|"), o = (c = e.userData) == null ? void 0 : c.textChildStyleHash;
949
- if (t.dirtyMask & le || n !== o) {
954
+ ], a = i ? t.nativeStyles : t.textStyles, n = JSON.stringify(a) + t.textContent + r.map((d) => d.text).join("|"), o = (l = e.userData) == null ? void 0 : l.textChildStyleHash;
955
+ if (t.dirtyMask & ce || n !== o) {
950
956
  e.children.filter(
951
957
  (f) => f.name.startsWith("TEXT_CHILD")
952
958
  ).forEach((f) => {
@@ -955,22 +961,22 @@ class tt {
955
961
  (E = m.material.map) == null || E.dispose(), m.geometry.dispose(), e.remove(m);
956
962
  });
957
963
  const h = t.rect, u = h.x + h.width / 2, p = h.y + h.height / 2;
958
- i.forEach((f, m) => {
959
- const E = Y.create(
964
+ r.forEach((f, m) => {
965
+ const E = N.create(
960
966
  "TEXT",
961
967
  a,
962
968
  f.text,
963
969
  f.rect.width,
964
970
  f.rect.height,
965
971
  this.qualityFactor
966
- ), R = new y.PlaneGeometry(1, 1), M = new y.Mesh(R, E);
972
+ ), R = new b.PlaneGeometry(1, 1), M = new b.Mesh(R, E);
967
973
  M.name = `TEXT_CHILD_${m}`;
968
- const w = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, b = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
969
- M.scale.set(w, b, 1);
970
- const U = f.rect.x + f.rect.width / 2, D = f.rect.y + f.rect.height / 2, O = U - u, N = -(D - p);
974
+ const w = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, y = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
975
+ M.scale.set(w, y, 1);
976
+ const U = f.rect.x + f.rect.width / 2, A = f.rect.y + f.rect.height / 2, O = U - u, X = -(A - p);
971
977
  M.position.set(
972
978
  t.rect.width === 0 ? 0 : O / t.rect.width,
973
- t.rect.height === 0 ? 0 : N / t.rect.height,
979
+ t.rect.height === 0 ? 0 : X / t.rect.height,
974
980
  5e-3
975
981
  ), e.add(M);
976
982
  }), e.userData.textChildStyleHash = n;
@@ -980,10 +986,10 @@ class tt {
980
986
  return;
981
987
  const h = d, u = t.visibility & W ? L.BASE : L.HIDDEN;
982
988
  if (h.layers.set(u), t.visibility & j && h.layers.enable(L.SELECTED), t.visibility & W)
983
- if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
989
+ if (!i && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
984
990
  for (let p = t.captureLayer; p < t.nativeLayer; p++)
985
991
  h.layers.enable(L.getCaptureLayer(p));
986
- else if (r && t.nativeLayer !== void 0)
992
+ else if (i && t.nativeLayer !== void 0)
987
993
  for (let p = Math.max(t.captureLayer, t.nativeLayer); p <= k.MAX_LAYERS + 1; p++)
988
994
  h.layers.enable(L.getCaptureLayer(p));
989
995
  else
@@ -992,74 +998,74 @@ class tt {
992
998
  });
993
999
  }
994
1000
  updateMeshProperties(e, t) {
995
- var w, b, U;
996
- const { rect: r, styles: i } = t, a = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / a, o = this.renderer.domElement.height / a;
997
- e.material = e.userData.baseMaterial, e.scale.set(r.width, r.height, 1), e.userData.domRect = {
998
- x: r.x,
999
- y: r.y,
1000
- width: r.width,
1001
- height: r.height
1001
+ var w, y, U;
1002
+ const { rect: i, styles: r } = t, a = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / a, o = this.renderer.domElement.height / a;
1003
+ e.material = e.userData.baseMaterial, e.scale.set(i.width, i.height, 1), e.userData.domRect = {
1004
+ x: i.x,
1005
+ y: i.y,
1006
+ width: i.width,
1007
+ height: i.height
1002
1008
  };
1003
- const l = 1e-3;
1009
+ const c = 1e-3;
1004
1010
  this.renderOrder++;
1005
- const c = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1011
+ const l = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1006
1012
  let h, u;
1007
1013
  if (this.isViewport)
1008
- h = r.x - window.innerWidth / 2 + r.width / 2, u = -r.y + window.innerHeight / 2 - r.height / 2;
1014
+ h = i.x - window.innerWidth / 2 + i.width / 2, u = -i.y + window.innerHeight / 2 - i.height / 2;
1009
1015
  else {
1010
- const D = r.x - c, O = r.y - d;
1011
- h = D - n / 2 + r.width / 2, u = -O + o / 2 - r.height / 2;
1016
+ const A = i.x - l, O = i.y - d;
1017
+ h = A - n / 2 + i.width / 2, u = -O + o / 2 - i.height / 2;
1012
1018
  }
1013
1019
  e.position.set(
1014
1020
  h,
1015
1021
  u,
1016
- i.zIndex + this.renderOrder * l
1022
+ r.zIndex + this.renderOrder * c
1017
1023
  );
1018
- const p = r.x, f = r.y;
1019
- e.userData.basePosition = { x: h, y: u }, e.userData.originalBasePosition = { x: h, y: u }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: p, y: f }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1024
+ const p = i.x, f = i.y;
1025
+ e.userData.basePosition = { x: h, y: u }, e.userData.originalBasePosition = { x: h, y: u }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: p, y: f }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1020
1026
  const m = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, E = window.getComputedStyle(m);
1021
1027
  let R = 0, M = 0;
1022
1028
  if (E.transform && E.transform !== "none") {
1023
- const D = new DOMMatrix(E.transform);
1024
- R = D.m41, M = D.m42;
1029
+ const A = new DOMMatrix(E.transform);
1030
+ R = A.m41, M = A.m42;
1025
1031
  }
1026
- if (e.userData.baseTransform = { x: R, y: M }, delete e.userData.originRatioX, delete e.userData.originRatioY, Y.update(
1032
+ if (e.userData.baseTransform = { x: R, y: M }, delete e.userData.originRatioX, delete e.userData.originRatioY, N.update(
1027
1033
  e.userData.baseMaterial,
1028
1034
  "BOX",
1029
- i,
1035
+ r,
1030
1036
  "",
1031
- r.width,
1032
- r.height,
1037
+ i.width,
1038
+ i.height,
1033
1039
  this.qualityFactor,
1034
1040
  t.isTraveler ? (w = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : w.texture : this.textureManager.get(t.element)
1035
1041
  ), t.nativeStyles && t.nativeRect) {
1036
1042
  if (!e.userData.nativeMesh) {
1037
- const I = Y.create(
1043
+ const I = N.create(
1038
1044
  "BOX",
1039
1045
  t.nativeStyles,
1040
1046
  "",
1041
1047
  t.nativeRect.width,
1042
1048
  t.nativeRect.height,
1043
1049
  this.qualityFactor,
1044
- t.isTraveler ? (b = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : b.texture : this.textureManager.get(t.element),
1050
+ t.isTraveler ? (y = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : y.texture : this.textureManager.get(t.element),
1045
1051
  t.shaderHooks
1046
- ), P = new y.Mesh(e.geometry, I);
1052
+ ), P = new b.Mesh(e.geometry, I);
1047
1053
  t.type === "TEXT" && (P.name = "BG_MESH"), this.scene.add(P), e.userData.nativeMesh = P;
1048
1054
  }
1049
- const D = e.userData.nativeMesh;
1050
- let O, N;
1055
+ const A = e.userData.nativeMesh;
1056
+ let O, X;
1051
1057
  if (this.isViewport)
1052
- O = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, N = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1058
+ O = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, X = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1053
1059
  else {
1054
- const I = t.nativeRect.x - c, P = t.nativeRect.y - d;
1055
- O = I - n / 2 + t.nativeRect.width / 2, N = -P + o / 2 - t.nativeRect.height / 2;
1060
+ const I = t.nativeRect.x - l, P = t.nativeRect.y - d;
1061
+ O = I - n / 2 + t.nativeRect.width / 2, X = -P + o / 2 - t.nativeRect.height / 2;
1056
1062
  }
1057
- D.scale.set(t.nativeRect.width, t.nativeRect.height, 1), D.position.set(
1063
+ A.scale.set(t.nativeRect.width, t.nativeRect.height, 1), A.position.set(
1058
1064
  O,
1059
- N,
1060
- t.nativeStyles.zIndex + this.renderOrder * l
1061
- ), Y.update(
1062
- D.material,
1065
+ X,
1066
+ t.nativeStyles.zIndex + this.renderOrder * c
1067
+ ), N.update(
1068
+ A.material,
1063
1069
  "BOX",
1064
1070
  t.nativeStyles,
1065
1071
  "",
@@ -1069,37 +1075,37 @@ class tt {
1069
1075
  t.isTraveler ? (U = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : U.texture : this.textureManager.get(t.element)
1070
1076
  );
1071
1077
  } else
1072
- e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof y.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1078
+ e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof b.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1073
1079
  }
1074
1080
  updateMeshLayers(e, t) {
1075
- const r = t.visibility & W ? L.BASE : L.HIDDEN;
1076
- if (e.layers.set(r), t.visibility & j && e.layers.enable(L.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1077
- const i = e.userData.nativeMesh;
1078
- if (i.layers.set(L.HIDDEN), t.visibility & W) {
1081
+ const i = t.visibility & W ? L.BASE : L.HIDDEN;
1082
+ if (e.layers.set(i), t.visibility & j && e.layers.enable(L.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1083
+ const r = e.userData.nativeMesh;
1084
+ if (r.layers.set(L.HIDDEN), t.visibility & W) {
1079
1085
  for (let a = t.captureLayer; a < t.nativeLayer; a++)
1080
1086
  e.layers.enable(L.getCaptureLayer(a));
1081
1087
  for (let a = Math.max(t.captureLayer, t.nativeLayer); a <= k.MAX_LAYERS + 1; a++)
1082
- i.layers.enable(L.getCaptureLayer(a));
1088
+ r.layers.enable(L.getCaptureLayer(a));
1083
1089
  }
1084
1090
  } else if (t.visibility & W)
1085
- for (let i = t.captureLayer; i <= k.MAX_LAYERS + 1; i++)
1086
- e.layers.enable(L.getCaptureLayer(i));
1091
+ for (let r = t.captureLayer; r <= k.MAX_LAYERS + 1; r++)
1092
+ e.layers.enable(L.getCaptureLayer(r));
1087
1093
  }
1088
- captureRenderTarget(e, t, r) {
1089
- if (e.size === 0 || !r)
1094
+ captureRenderTarget(e, t, i) {
1095
+ if (e.size === 0 || !i)
1090
1096
  return;
1091
- const i = new y.Color(), a = this.renderer.getClearAlpha();
1092
- this.renderer.getClearColor(i), 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);
1093
- const n = new y.Vector3(), o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, c = this.renderer.getPixelRatio();
1097
+ const r = new b.Color(), a = this.renderer.getClearAlpha();
1098
+ this.renderer.getClearColor(r), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(i), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1099
+ const n = new b.Vector3(), o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, l = this.renderer.getPixelRatio();
1094
1100
  for (const d of e) {
1095
1101
  n.setFromMatrixPosition(d.matrixWorld), n.project(this.camera);
1096
- const h = (n.x + 1) / 2 * o, u = (n.y + 1) / 2 * l;
1102
+ const h = (n.x + 1) / 2 * o, u = (n.y + 1) / 2 * c;
1097
1103
  let p = 0, f = 1;
1098
1104
  typeof this.clipArea == "number" ? f = this.clipArea : this.clipArea.endsWith("%") ? f = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1099
- const m = d.scale.x * f + 0.5, E = d.scale.y * f + 0.5, R = h - m / 2, M = u - E / 2, w = (R * this.qualityFactor - p) / c, b = (M * this.qualityFactor - p) / c, U = (m * this.qualityFactor + p * 2) / c, D = (E * this.qualityFactor + p * 2) / c;
1100
- this.renderer.setScissor(w, b, U, D), this.renderer.render(this.scene, this.camera);
1105
+ const m = d.scale.x * f + 0.5, E = d.scale.y * f + 0.5, R = h - m / 2, M = u - E / 2, w = (R * this.qualityFactor - p) / l, y = (M * this.qualityFactor - p) / l, U = (m * this.qualityFactor + p * 2) / l, A = (E * this.qualityFactor + p * 2) / l;
1106
+ this.renderer.setScissor(w, y, U, A), this.renderer.render(this.scene, this.camera);
1101
1107
  }
1102
- this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, a);
1108
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(r, a);
1103
1109
  }
1104
1110
  render() {
1105
1111
  for (let e = 0; e < k.MAX_LAYERS; e++) {
@@ -1113,34 +1119,39 @@ class tt {
1113
1119
  this.renderer.render(this.scene, this.camera);
1114
1120
  }
1115
1121
  syncMeshesByDOM() {
1116
- const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, r = this.renderer.getPixelRatio(), i = this.renderer.domElement.width / r, a = this.renderer.domElement.height / r;
1122
+ const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, i = this.renderer.getPixelRatio(), r = this.renderer.domElement.width / i, a = this.renderer.domElement.height / i;
1117
1123
  this.scene.children.forEach((n) => {
1118
1124
  const o = n;
1119
1125
  if (!o.userData || !o.userData.domElement)
1120
1126
  return;
1121
- const l = o.userData.domElement;
1122
- let c;
1123
- if (l.nodeType === Node.TEXT_NODE) {
1127
+ const c = o.userData.domElement;
1128
+ let l;
1129
+ if (c.nodeType === Node.TEXT_NODE) {
1124
1130
  const h = document.createRange();
1125
- h.selectNode(l), c = h.getBoundingClientRect();
1131
+ h.selectNode(c), l = h.getBoundingClientRect();
1126
1132
  } else
1127
- c = l.getBoundingClientRect();
1133
+ l = c.getBoundingClientRect();
1128
1134
  const d = o.userData.domRect;
1129
- if (!d || Math.abs(c.x - d.x) > 0.5 || Math.abs(c.y - d.y) > 0.5 || Math.abs(c.width - d.width) > 0.5 || Math.abs(c.height - d.height) > 0.5) {
1130
- o.userData.domRect = { x: c.x, y: c.y, width: c.width, height: c.height };
1135
+ 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) {
1136
+ o.userData.domRect = {
1137
+ x: l.x,
1138
+ y: l.y,
1139
+ width: l.width,
1140
+ height: l.height
1141
+ };
1131
1142
  let h, u;
1132
1143
  if (this.isViewport)
1133
- h = c.x - window.innerWidth / 2 + c.width / 2, u = -c.y + window.innerHeight / 2 - c.height / 2;
1144
+ h = l.x - window.innerWidth / 2 + l.width / 2, u = -l.y + window.innerHeight / 2 - l.height / 2;
1134
1145
  else {
1135
- const p = c.x - e, f = c.y - t;
1136
- h = p - i / 2 + c.width / 2, u = -f + a / 2 - c.height / 2;
1146
+ const p = l.x - e, f = l.y - t;
1147
+ h = p - r / 2 + l.width / 2, u = -f + a / 2 - l.height / 2;
1137
1148
  }
1138
- if (o.position.setX(h), o.position.setY(u), o.scale.set(c.width, c.height, 1), o.material instanceof y.ShaderMaterial && Y.forceUpdateUniforms(o.material, {
1139
- width: c.width,
1140
- height: c.height
1149
+ if (o.position.setX(h), o.position.setY(u), o.scale.set(l.width, l.height, 1), o.material instanceof b.ShaderMaterial && N.forceUpdateUniforms(o.material, {
1150
+ width: l.width,
1151
+ height: l.height
1141
1152
  }), o.userData.nativeMesh) {
1142
1153
  const p = o.userData.nativeMesh;
1143
- p.position.setX(h), p.position.setY(u), p.scale.set(c.width, c.height, 1);
1154
+ p.position.setX(h), p.position.setY(u), p.scale.set(l.width, l.height, 1);
1144
1155
  }
1145
1156
  }
1146
1157
  });
@@ -1148,86 +1159,86 @@ class tt {
1148
1159
  }
1149
1160
  function rt(s) {
1150
1161
  const e = s.textContent || "", t = [];
1151
- let r = "", i = null, a = -1;
1152
- const n = (c, d) => {
1153
- for (let h = 0; h < c.length; h++) {
1154
- const u = c[h], p = document.createRange();
1162
+ let i = "", r = null, a = -1;
1163
+ const n = (l, d) => {
1164
+ for (let h = 0; h < l.length; h++) {
1165
+ const u = l[h], p = document.createRange();
1155
1166
  p.setStart(s, d + h), p.setEnd(s, d + h + 1);
1156
1167
  const f = p.getBoundingClientRect();
1157
1168
  if (f.width === 0 && f.height === 0) {
1158
- r += u;
1169
+ i += u;
1159
1170
  continue;
1160
1171
  }
1161
- a === -1 || Math.abs(f.top - a) > f.height / 2 ? (r && i && t.push({
1162
- text: r,
1172
+ a === -1 || Math.abs(f.top - a) > f.height / 2 ? (i && r && t.push({
1173
+ text: i,
1163
1174
  rect: {
1164
- left: i.left,
1165
- top: i.top,
1166
- width: i.right - i.left,
1167
- height: i.bottom - i.top
1175
+ left: r.left,
1176
+ top: r.top,
1177
+ width: r.right - r.left,
1178
+ height: r.bottom - r.top
1168
1179
  }
1169
- }), r = u, i = {
1180
+ }), i = u, r = {
1170
1181
  left: f.left,
1171
1182
  top: f.top,
1172
1183
  right: f.right,
1173
1184
  bottom: f.bottom
1174
- }, a = f.top) : (r += u, i && (i.left = Math.min(i.left, f.left), i.top = Math.min(i.top, f.top), i.right = Math.max(i.right, f.right), i.bottom = Math.max(
1175
- i.bottom,
1185
+ }, a = f.top) : (i += u, r && (r.left = Math.min(r.left, f.left), r.top = Math.min(r.top, f.top), r.right = Math.max(r.right, f.right), r.bottom = Math.max(
1186
+ r.bottom,
1176
1187
  f.bottom
1177
1188
  )));
1178
1189
  }
1179
1190
  }, o = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1180
- let l = 0;
1181
- for (const c of o) {
1191
+ let c = 0;
1192
+ for (const l of o) {
1182
1193
  const d = document.createRange();
1183
- d.setStart(s, l), d.setEnd(s, l + c.length);
1194
+ d.setStart(s, c), d.setEnd(s, c + l.length);
1184
1195
  const h = d.getClientRects();
1185
1196
  if (h.length > 1)
1186
- n(c, l);
1197
+ n(l, c);
1187
1198
  else {
1188
1199
  const u = h.length === 1 ? h[0] : d.getBoundingClientRect();
1189
1200
  if (u.width === 0 && u.height === 0) {
1190
- r += c, l += c.length;
1201
+ i += l, c += l.length;
1191
1202
  continue;
1192
1203
  }
1193
- a === -1 || Math.abs(u.top - a) > u.height / 2 ? (r && i && t.push({
1194
- text: r,
1204
+ a === -1 || Math.abs(u.top - a) > u.height / 2 ? (i && r && t.push({
1205
+ text: i,
1195
1206
  rect: {
1196
- left: i.left,
1197
- top: i.top,
1198
- width: i.right - i.left,
1199
- height: i.bottom - i.top
1207
+ left: r.left,
1208
+ top: r.top,
1209
+ width: r.right - r.left,
1210
+ height: r.bottom - r.top
1200
1211
  }
1201
- }), r = c, i = {
1212
+ }), i = l, r = {
1202
1213
  left: u.left,
1203
1214
  top: u.top,
1204
1215
  right: u.right,
1205
1216
  bottom: u.bottom
1206
- }, a = u.top) : (r += c, i && (i.left = Math.min(i.left, u.left), i.top = Math.min(i.top, u.top), i.right = Math.max(i.right, u.right), i.bottom = Math.max(
1207
- i.bottom,
1217
+ }, a = u.top) : (i += l, r && (r.left = Math.min(r.left, u.left), r.top = Math.min(r.top, u.top), r.right = Math.max(r.right, u.right), r.bottom = Math.max(
1218
+ r.bottom,
1208
1219
  u.bottom
1209
1220
  )));
1210
1221
  }
1211
- l += c.length;
1222
+ c += l.length;
1212
1223
  }
1213
- return r && i && t.push({
1214
- text: r,
1224
+ return i && r && t.push({
1225
+ text: i,
1215
1226
  rect: {
1216
- left: i.left,
1217
- top: i.top,
1218
- width: i.right - i.left,
1219
- height: i.bottom - i.top
1227
+ left: r.left,
1228
+ top: r.top,
1229
+ width: r.right - r.left,
1230
+ height: r.bottom - r.top
1220
1231
  }
1221
1232
  }), t.filter(
1222
- (c) => c.text.trim().length > 0 && c.rect.width > 0 && c.rect.height > 0
1233
+ (l) => l.text.trim().length > 0 && l.rect.width > 0 && l.rect.height > 0
1223
1234
  );
1224
1235
  }
1225
1236
  function Se(s) {
1226
1237
  const e = parseFloat(s.fontSize);
1227
1238
  let t = parseFloat(s.lineHeight);
1228
1239
  isNaN(t) && (t = e * 1.2);
1229
- let r = parseFloat(s.letterSpacing);
1230
- return isNaN(r) && (r = 0), {
1240
+ let i = parseFloat(s.letterSpacing);
1241
+ return isNaN(i) && (i = 0), {
1231
1242
  font: `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`,
1232
1243
  fontSize: s.fontSize,
1233
1244
  color: s.color,
@@ -1235,10 +1246,10 @@ function Se(s) {
1235
1246
  textBaseline: "alphabetic",
1236
1247
  direction: s.direction || "inherit",
1237
1248
  lineHeight: t,
1238
- letterSpacing: r
1249
+ letterSpacing: i
1239
1250
  };
1240
1251
  }
1241
- function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1252
+ function Ae(s, e = $ | Q | ze | ce | re, t, i = 1, r = 0, a = 2, n, o) {
1242
1253
  var de, ue, fe, ge, pe, me;
1243
1254
  if (s.nodeType === Node.TEXT_NODE) {
1244
1255
  const v = s;
@@ -1247,35 +1258,35 @@ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1247
1258
  const C = v.textContent.replace(/\s+/g, " ");
1248
1259
  if (C.length === 0)
1249
1260
  return null;
1250
- const A = rt(v);
1251
- if (A.length === 0)
1261
+ const D = rt(v);
1262
+ if (D.length === 0)
1252
1263
  return null;
1253
1264
  const B = v.parentElement, S = B ? window.getComputedStyle(B) : null;
1254
1265
  if (!S)
1255
1266
  return null;
1256
- const X = Math.min(...A.map((T) => T.rect.left)), x = Math.min(...A.map((T) => T.rect.top)), z = Math.max(...A.map((T) => T.rect.left + T.rect.width)), G = Math.max(...A.map((T) => T.rect.top + T.rect.height));
1267
+ const z = Math.min(...D.map((T) => T.rect.left)), x = Math.min(...D.map((T) => T.rect.top)), V = Math.max(...D.map((T) => T.rect.left + T.rect.width)), G = Math.max(...D.map((T) => T.rect.top + T.rect.height));
1257
1268
  return {
1258
1269
  id: Math.random().toString(36).substring(2, 9),
1259
1270
  type: "TEXT",
1260
1271
  element: v,
1261
1272
  rect: {
1262
- x: X + window.scrollX,
1273
+ x: z + window.scrollX,
1263
1274
  y: x + window.scrollY,
1264
- width: z - X,
1275
+ width: V - z,
1265
1276
  height: G - x
1266
1277
  },
1267
1278
  styles: {
1268
1279
  backgroundColor: "transparent",
1269
1280
  backgroundImage: "",
1270
1281
  opacity: B && B.dataset[H.KEY] === H.VALUES.HIDE ? 1 : parseFloat(S.opacity),
1271
- zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + i,
1282
+ zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + r,
1272
1283
  borderRadius: "0px",
1273
1284
  borderColor: "transparent",
1274
1285
  borderWidth: "0px",
1275
1286
  isTraveler: !1
1276
1287
  },
1277
1288
  textContent: C,
1278
- textLines: A.map((T) => ({
1289
+ textLines: D.map((T) => ({
1279
1290
  text: T.text.trim(),
1280
1291
  rect: {
1281
1292
  x: T.rect.left + window.scrollX,
@@ -1288,23 +1299,23 @@ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1288
1299
  dirtyMask: e,
1289
1300
  visibility: t,
1290
1301
  isTraveler: !1,
1291
- captureLayer: r,
1302
+ captureLayer: i,
1292
1303
  isFixed: S.position === "fixed",
1293
1304
  nativeLayer: n,
1294
1305
  nativeStyles: o ? q(q({
1295
1306
  backgroundColor: "transparent",
1296
1307
  backgroundImage: "",
1297
1308
  opacity: B && B.dataset[H.KEY] === H.VALUES.HIDE ? 1 : parseFloat(S.opacity),
1298
- zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + i,
1309
+ zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + r,
1299
1310
  borderRadius: "0px",
1300
1311
  borderColor: "transparent",
1301
1312
  borderWidth: "0px",
1302
1313
  isTraveler: !1
1303
1314
  }, Se(S)), o) : void 0,
1304
1315
  nativeRect: o ? {
1305
- x: X + window.scrollX,
1316
+ x: z + window.scrollX,
1306
1317
  y: x + window.scrollY,
1307
- width: z - X,
1318
+ width: V - z,
1308
1319
  height: G - x
1309
1320
  } : void 0,
1310
1321
  children: []
@@ -1312,10 +1323,10 @@ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1312
1323
  }
1313
1324
  if (s.nodeType !== Node.ELEMENT_NODE)
1314
1325
  return null;
1315
- const l = s, c = l.dataset[_.KEY];
1326
+ const c = s, l = c.dataset[_.KEY];
1316
1327
  let d = t, h = t;
1317
- if (c) {
1318
- const v = new Set(c.split(/\s+/));
1328
+ if (l) {
1329
+ const v = new Set(l.split(/\s+/));
1319
1330
  for (const C of v)
1320
1331
  if (!Ce.includes(C))
1321
1332
  throw new Error(
@@ -1333,7 +1344,7 @@ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1333
1344
  );
1334
1345
  v.has(_.VALUES.INCLUDE_TREE) ? d = d | W : v.has(_.VALUES.EXCLUDE_TREE) && (d = d & ~W), h = d, v.has(_.VALUES.INCLUDE_SELF) ? h = h | W : v.has(_.VALUES.EXCLUDE_SELF) && (h = h & ~W);
1335
1346
  }
1336
- const u = l.dataset[V.KEY];
1347
+ const u = c.dataset[Y.KEY];
1337
1348
  if (u) {
1338
1349
  const v = new Set(u.split(/\s+/));
1339
1350
  for (const C of v)
@@ -1341,121 +1352,121 @@ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1341
1352
  throw new Error(
1342
1353
  `[MirageEngine] Invalid select token: '${C}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1343
1354
  );
1344
- if (v.has(V.VALUES.END))
1355
+ if (v.has(Y.VALUES.END))
1345
1356
  return null;
1346
- if (v.has(V.VALUES.INCLUDE_TREE) && v.has(V.VALUES.EXCLUDE_TREE))
1357
+ if (v.has(Y.VALUES.INCLUDE_TREE) && v.has(Y.VALUES.EXCLUDE_TREE))
1347
1358
  throw new Error(
1348
1359
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1349
1360
  );
1350
- if (v.has(V.VALUES.INCLUDE_SELF) && v.has(V.VALUES.EXCLUDE_SELF))
1361
+ if (v.has(Y.VALUES.INCLUDE_SELF) && v.has(Y.VALUES.EXCLUDE_SELF))
1351
1362
  throw new Error(
1352
1363
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1353
1364
  );
1354
- v.has(V.VALUES.INCLUDE_TREE) ? d = d | j : v.has(V.VALUES.EXCLUDE_TREE) && (d = d & ~j), h = d, v.has(V.VALUES.INCLUDE_SELF) ? h = h | j : v.has(V.VALUES.EXCLUDE_SELF) && (h = h & ~j);
1365
+ v.has(Y.VALUES.INCLUDE_TREE) ? d = d | j : v.has(Y.VALUES.EXCLUDE_TREE) && (d = d & ~j), h = d, v.has(Y.VALUES.INCLUDE_SELF) ? h = h | j : v.has(Y.VALUES.EXCLUDE_SELF) && (h = h & ~j);
1355
1366
  }
1356
- const p = l.dataset[k.KEY];
1367
+ const p = c.dataset[k.KEY];
1357
1368
  let f = !1, m = o ? q({}, o) : {}, E = n;
1358
1369
  if (p) {
1359
1370
  let v = 1;
1360
- const C = p.indexOf("{"), A = p.lastIndexOf("}");
1371
+ const C = p.indexOf("{"), D = p.lastIndexOf("}");
1361
1372
  let B = p;
1362
- if (C !== -1 && A !== -1 && A > C) {
1373
+ if (C !== -1 && D !== -1 && D > C) {
1363
1374
  B = p.substring(0, C).trim();
1364
- const x = p.substring(C, A + 1);
1375
+ const x = p.substring(C, D + 1);
1365
1376
  try {
1366
1377
  m = new Function("return " + x)();
1367
- } catch (z) {
1378
+ } catch (V) {
1368
1379
  console.warn(
1369
1380
  `[MirageEngine] Failed to parse travel styles JSON: ${x}`
1370
1381
  );
1371
1382
  }
1372
1383
  }
1373
1384
  const S = B.split(/\s+/);
1374
- let X = !1;
1385
+ let z = !1;
1375
1386
  if (S.includes(k.VALUES.TRAVELER)) {
1376
- f = !0, X = !0;
1377
- const x = S.find((z) => !isNaN(parseInt(z, 10)));
1387
+ f = !0, z = !0;
1388
+ const x = S.find((V) => !isNaN(parseInt(V, 10)));
1378
1389
  x && (v = parseInt(x, 10));
1379
1390
  } else if (S.includes(k.VALUES.NATIVE)) {
1380
1391
  f = !1;
1381
- const x = S.find((z) => !isNaN(parseInt(z, 10)));
1392
+ const x = S.find((V) => !isNaN(parseInt(V, 10)));
1382
1393
  x && (E = parseInt(x, 10));
1383
1394
  }
1384
- if (X) {
1395
+ if (z) {
1385
1396
  const x = v + 1;
1386
- if (x < r)
1397
+ if (x < i)
1387
1398
  throw new Error(
1388
- `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${r - 1}).`
1399
+ `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${i - 1}).`
1389
1400
  );
1390
- r = Math.min(x, k.MAX_LAYERS + 1);
1401
+ i = Math.min(x, k.MAX_LAYERS + 1);
1391
1402
  }
1392
1403
  }
1393
- const R = l.dataset[Xe.KEY];
1404
+ const R = c.dataset[Xe.KEY];
1394
1405
  let M;
1395
1406
  R && (M = JSON.parse(R));
1396
- const w = l.getBoundingClientRect(), b = window.getComputedStyle(l);
1397
- if (w.width === 0 || w.height === 0 || b.display === "none")
1407
+ const w = c.getBoundingClientRect(), y = window.getComputedStyle(c);
1408
+ if (w.width === 0 || w.height === 0 || y.display === "none")
1398
1409
  return null;
1399
- let U = l.getAttribute("data-mid");
1400
- U || (U = Math.random().toString(36).substring(2, 11), l.setAttribute("data-mid", U));
1401
- const D = parseInt(b.zIndex), O = (isNaN(D) ? 0 : D) + i;
1402
- let N;
1403
- if (l.tagName === "IMG")
1404
- N = l.src;
1405
- else if (l.tagName.toLowerCase() === "svg") {
1406
- const v = l.cloneNode(!0), C = m == null ? void 0 : m.color, A = m == null ? void 0 : m.fill, B = m == null ? void 0 : m.stroke, S = m == null ? void 0 : m.opacity, X = (T, ve) => {
1407
- const F = window.getComputedStyle(T), J = ve, ke = F.fill === F.color, Ue = F.stroke === F.color, ie = A || (ke ? C : void 0) || F.fill;
1410
+ let U = c.getAttribute("data-mid");
1411
+ U || (U = Math.random().toString(36).substring(2, 11), c.setAttribute("data-mid", U));
1412
+ const A = parseInt(y.zIndex), O = (isNaN(A) ? 0 : A) + r;
1413
+ let X;
1414
+ if (c.tagName === "IMG")
1415
+ X = c.src;
1416
+ else if (c.tagName.toLowerCase() === "svg") {
1417
+ const v = c.cloneNode(!0), C = m == null ? void 0 : m.color, D = m == null ? void 0 : m.fill, B = m == null ? void 0 : m.stroke, S = m == null ? void 0 : m.opacity, z = (T, ve) => {
1418
+ const F = window.getComputedStyle(T), J = ve, ke = F.fill === F.color, Ue = F.stroke === F.color, ie = D || (ke ? C : void 0) || F.fill;
1408
1419
  ie && ie !== "none" && (J.style.fill = ie);
1409
1420
  const se = B || (Ue ? C : void 0) || F.stroke;
1410
1421
  se && se !== "none" && (J.style.stroke = se), F.strokeWidth && F.strokeWidth !== "0px" && (J.style.strokeWidth = F.strokeWidth);
1411
- const ye = C || F.color;
1412
- ye && (J.style.color = ye);
1422
+ const be = C || F.color;
1423
+ be && (J.style.color = be);
1413
1424
  const ne = S || F.opacity;
1414
1425
  ne && ne !== "1" && (J.style.opacity = ne);
1415
1426
  for (let ee = 0; ee < T.children.length; ee++)
1416
- X(T.children[ee], ve.children[ee]);
1427
+ z(T.children[ee], ve.children[ee]);
1417
1428
  };
1418
- X(l, v);
1419
- const x = l.getBoundingClientRect(), z = window.devicePixelRatio * a;
1420
- v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${x.width} ${x.height}`), v.setAttribute("width", (x.width * z).toString()), v.setAttribute("height", (x.height * z).toString());
1429
+ z(c, v);
1430
+ const x = c.getBoundingClientRect(), V = window.devicePixelRatio * a;
1431
+ v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${x.width} ${x.height}`), v.setAttribute("width", (x.width * V).toString()), v.setAttribute("height", (x.height * V).toString());
1421
1432
  let G = new XMLSerializer().serializeToString(v);
1422
1433
  G.includes("xmlns=") || (G = G.replace(
1423
1434
  "<svg",
1424
1435
  '<svg xmlns="http://www.w3.org/2000/svg"'
1425
- )), N = `data:image/svg+xml;utf8,${encodeURIComponent(G)}`;
1426
- } else if (b.backgroundImage && b.backgroundImage !== "none") {
1427
- const v = b.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1428
- v && (N = v[1]);
1436
+ )), X = `data:image/svg+xml;utf8,${encodeURIComponent(G)}`;
1437
+ } else if (y.backgroundImage && y.backgroundImage !== "none") {
1438
+ const v = y.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1439
+ v && (X = v[1]);
1429
1440
  }
1430
1441
  const I = {
1431
- backgroundColor: b.backgroundColor,
1432
- backgroundImage: b.backgroundImage,
1433
- opacity: l.dataset[H.KEY] === H.VALUES.HIDE ? 1 : parseFloat(b.opacity),
1442
+ backgroundColor: y.backgroundColor,
1443
+ backgroundImage: y.backgroundImage,
1444
+ opacity: c.dataset[H.KEY] === H.VALUES.HIDE ? 1 : parseFloat(y.opacity),
1434
1445
  zIndex: O,
1435
- borderRadius: b.borderRadius,
1436
- borderColor: b.borderColor,
1437
- borderWidth: b.borderWidth,
1438
- imageSrc: N,
1446
+ borderRadius: y.borderRadius,
1447
+ borderColor: y.borderColor,
1448
+ borderWidth: y.borderWidth,
1449
+ imageSrc: X,
1439
1450
  isTraveler: f
1440
1451
  }, P = I;
1441
- let Ae, Ie;
1452
+ let De, Ie;
1442
1453
  const he = [];
1443
- return l.tagName.toLowerCase() !== "svg" && Array.from(l.childNodes).forEach((v) => {
1444
- const C = v.nodeType === Node.TEXT_NODE ? h : d, A = De(
1454
+ return c.tagName.toLowerCase() !== "svg" && Array.from(c.childNodes).forEach((v) => {
1455
+ const C = v.nodeType === Node.TEXT_NODE ? h : d, D = Ae(
1445
1456
  v,
1446
1457
  e,
1447
1458
  C,
1448
- r,
1459
+ i,
1449
1460
  O,
1450
1461
  a,
1451
1462
  E,
1452
1463
  v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0
1453
1464
  );
1454
- A && he.push(A);
1465
+ D && he.push(D);
1455
1466
  }), {
1456
1467
  id: U,
1457
1468
  type: "BOX",
1458
- element: l,
1469
+ element: c,
1459
1470
  rect: {
1460
1471
  x: w.left + window.scrollX,
1461
1472
  y: w.top + window.scrollY,
@@ -1463,12 +1474,12 @@ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1463
1474
  height: w.height
1464
1475
  },
1465
1476
  styles: P,
1466
- textContent: Ae,
1477
+ textContent: De,
1467
1478
  textStyles: Ie,
1468
1479
  dirtyMask: e,
1469
1480
  visibility: h,
1470
1481
  isTraveler: f,
1471
- captureLayer: r,
1482
+ captureLayer: i,
1472
1483
  nativeLayer: E,
1473
1484
  nativeStyles: E !== void 0 ? we(q({}, I), {
1474
1485
  backgroundColor: (de = m.backgroundColor) != null ? de : I.backgroundColor,
@@ -1486,36 +1497,41 @@ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1486
1497
  width: m.width !== void 0 ? parseFloat(m.width) : w.width,
1487
1498
  height: m.height !== void 0 ? parseFloat(m.height) : w.height
1488
1499
  } : void 0,
1489
- isFixed: b.position === "fixed",
1500
+ isFixed: y.position === "fixed",
1490
1501
  children: he,
1491
1502
  shaderHooks: M
1492
1503
  };
1493
1504
  }
1494
1505
  function it(s, e) {
1495
- e.size !== 0 && e.forEach((t, r) => {
1496
- var a, n;
1497
- const i = s.get(r);
1498
- !i || !i.userData.basePosition || Y.forceUpdateUniforms(i.material, {
1506
+ e.size !== 0 && e.forEach((t, i) => {
1507
+ var a, n, o, c;
1508
+ const r = s.get(i);
1509
+ !r || !r.userData.basePosition || (N.forceUpdateUniforms(r.material, {
1499
1510
  backgroundColor: t.backgroundColor,
1500
1511
  backgroundImage: t.backgroundImage,
1501
1512
  opacity: t.opacity,
1502
- borderRadius: (n = t.borderRadius) != null ? n : (a = i.userData.baseStyles) == null ? void 0 : a.borderRadius
1513
+ borderRadius: (n = t.borderRadius) != null ? n : (a = r.userData.baseStyles) == null ? void 0 : a.borderRadius
1503
1514
  // width and height are no longer updated here, they are updated in syncMeshesByDOM
1504
- });
1515
+ }), r.userData.nativeMesh && N.forceUpdateUniforms(r.userData.nativeMesh.material, {
1516
+ backgroundColor: t.backgroundColor,
1517
+ backgroundImage: t.backgroundImage,
1518
+ opacity: t.opacity,
1519
+ borderRadius: (c = t.borderRadius) != null ? c : (o = r.userData.baseStyles) == null ? void 0 : o.borderRadius
1520
+ }));
1505
1521
  });
1506
1522
  }
1507
1523
  class st {
1508
- constructor(e, t, r, i) {
1524
+ constructor(e, t, i, r) {
1509
1525
  g(this, "target");
1510
1526
  g(this, "renderer");
1511
1527
  g(this, "registry");
1512
1528
  g(this, "isTravelEnabled", !1);
1513
1529
  g(this, "tracker");
1514
- this.target = e, this.renderer = t, this.registry = r, this.tracker = new We(e, {
1515
- resizeDebounce: i.resizeDebounce
1530
+ this.target = e, this.renderer = t, this.registry = i, this.tracker = new We(e, {
1531
+ resizeDebounce: r.resizeDebounce
1516
1532
  }), this.tracker.onLayoutChange.add((a, n) => {
1517
1533
  document.querySelector(`[${k.NAME}~='${k.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1518
- const l = De(
1534
+ const c = Ae(
1519
1535
  this.target,
1520
1536
  a,
1521
1537
  W,
@@ -1523,7 +1539,7 @@ class st {
1523
1539
  0,
1524
1540
  this.renderer.qualityFactor
1525
1541
  );
1526
- l && this.renderer.syncScene(l, n);
1542
+ c && this.renderer.syncScene(c, n);
1527
1543
  }), this.tracker.onStyleChange.add((a) => {
1528
1544
  it(this.registry, a);
1529
1545
  }), this.tracker.onRender.add(() => {
@@ -1562,13 +1578,13 @@ class nt {
1562
1578
  this.store.delete(e);
1563
1579
  }
1564
1580
  }
1565
- class ct {
1581
+ class lt {
1566
1582
  constructor(e, t) {
1567
1583
  g(this, "renderer");
1568
1584
  g(this, "syncer");
1569
1585
  g(this, "target");
1570
1586
  g(this, "registry");
1571
- var i, a, n;
1587
+ var r, a, n;
1572
1588
  if (this.target = e, this.registry = new nt(), !document.getElementById("mirage-engine-styles")) {
1573
1589
  const o = document.createElement("style");
1574
1590
  o.id = "mirage-engine-styles", o.textContent = `
@@ -1577,13 +1593,13 @@ class ct {
1577
1593
  }
1578
1594
  `, document.head.appendChild(o);
1579
1595
  }
1580
- let r;
1581
- if (t.mode === "duplicate" ? r = (a = (i = t.container) != null ? i : this.target.parentElement) != null ? a : void 0 : r = (n = this.target.parentElement) != null ? n : void 0, !r)
1596
+ let i;
1597
+ if (t.mode === "duplicate" ? i = (a = (r = t.container) != null ? r : this.target.parentElement) != null ? a : void 0 : i = (n = this.target.parentElement) != null ? n : void 0, !i)
1582
1598
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1583
1599
  this.renderer = new tt(
1584
1600
  this.target,
1585
1601
  t,
1586
- r,
1602
+ i,
1587
1603
  this.registry
1588
1604
  ), this.renderer.mount(), this.syncer = new st(this.target, this.renderer, this.registry, t);
1589
1605
  }
@@ -1622,10 +1638,10 @@ class ct {
1622
1638
  }), window.addEventListener("keyup", (a) => {
1623
1639
  t[a.key] !== void 0 && (t[a.key] = !1);
1624
1640
  });
1625
- const r = 2, i = () => {
1626
- requestAnimationFrame(i), 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);
1641
+ const i = 2, r = () => {
1642
+ requestAnimationFrame(r), t.ArrowRight && e.position.setX(e.position.x + i), t.ArrowLeft && e.position.setX(e.position.x - i), t.ArrowUp && e.position.setY(e.position.y + i), t.ArrowDown && e.position.setY(e.position.y - i);
1627
1643
  };
1628
- i();
1644
+ r();
1629
1645
  }
1630
1646
  }
1631
1647
  export {
@@ -1633,17 +1649,17 @@ export {
1633
1649
  H as ATTR_DOM,
1634
1650
  _ as ATTR_FILTER,
1635
1651
  at as ATTR_SANDWICH,
1636
- V as ATTR_SELECT,
1652
+ Y as ATTR_SELECT,
1637
1653
  Xe as ATTR_SHADER,
1638
1654
  k as ATTR_TRAVEL,
1639
- le as DIRTY_CONTENT,
1655
+ ce as DIRTY_CONTENT,
1640
1656
  te as DIRTY_NONE,
1641
1657
  $ as DIRTY_RECT,
1642
1658
  re as DIRTY_STRUCTURE,
1643
1659
  Q as DIRTY_STYLE,
1644
1660
  ze as DIRTY_ZINDEX,
1645
- lt as EXCLUDED,
1646
- ct as Engine,
1661
+ ct as EXCLUDED,
1662
+ lt as Engine,
1647
1663
  j as SELECT_LAYER,
1648
1664
  L as THREE_LAYERS,
1649
1665
  xe as TRAVEL_VALUES,