@canvasengine/presets 2.0.0-beta.59 → 2.0.0-beta.60

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.
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { Container as e, DisplayObject as t, Graphics as n, Mesh as r, Sprite as i, TilingSprite as a, createComponent as o, effect as s, h as c, loop as l, mount as u, on as d, registerComponent as f, signal as p, tick as m, useProps as h } from "canvasengine";
2
- import { AnimatedSprite as g, Assets as _, BindGroup as v, BlurFilter as y, Bounds as b, Buffer as x, BufferUsage as S, Container as C, ExtensionType as w, Filter as T, Geometry as E, GlProgram as D, GpuProgram as O, Graphics as k, Matrix as A, NOOP as j, Rectangle as M, Shader as ee, Sprite as N, State as P, Texture as F, TextureSource as I, UniformGroup as L, ViewContainer as te, extensions as R, groupD8 as z } from "pixi.js";
2
+ import { AnimatedSprite as g, Assets as _, BindGroup as v, BlurFilter as y, Bounds as b, Buffer as x, BufferUsage as S, Container as C, ExtensionType as w, Filter as T, Geometry as E, GlProgram as D, GpuProgram as O, Graphics as k, Matrix as A, NOOP as j, Rectangle as M, Shader as ee, Sprite as N, State as P, Texture as F, TextureSource as I, TilingSprite as L, UniformGroup as te, ViewContainer as ne, extensions as re, groupD8 as R } from "pixi.js";
3
3
  //#region src/Bar.ts
4
- function ne(e) {
4
+ function ie(e) {
5
5
  var t = e.toString(16);
6
6
  return t.length == 1 ? "0" + t : t;
7
7
  }
8
- function re(e, t, n) {
9
- return "#" + ne(e) + ne(t) + ne(n);
8
+ function ae(e, t, n) {
9
+ return "#" + ie(e) + ie(t) + ie(n);
10
10
  }
11
- function ie(e) {
11
+ function oe(e) {
12
12
  let { width: t, height: r, value: i, maxValue: a, backgroundColor: o, foregroundColor: s, border: l, innerMargin: u, borderRadius: d } = h(e, {
13
13
  backgroundColor: "#000000",
14
14
  foregroundColor: "#FFFFFF",
@@ -32,7 +32,7 @@ function ie(e) {
32
32
  if (f.startsWith("rgba")) {
33
33
  let [t, n, r, i] = f.match(/\d+(\.\d+)?/g).map(Number);
34
34
  e.fill({
35
- color: re(t, n, r),
35
+ color: ae(t, n, r),
36
36
  alpha: i
37
37
  });
38
38
  } else e.fill(f);
@@ -41,7 +41,7 @@ function ie(e) {
41
41
  }
42
42
  //#endregion
43
43
  //#region src/fx/presets.ts
44
- var ae = {
44
+ var se = {
45
45
  hitSpark: {
46
46
  duration: 180,
47
47
  emitters: [{
@@ -382,11 +382,11 @@ var ae = {
382
382
  }
383
383
  }]
384
384
  }
385
- }, oe = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map();
386
- function ce(e = "softCircle") {
387
- return oe.has(e) || oe.set(e, le(e)), oe.get(e);
385
+ }, ce = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Map();
386
+ function ue(e = "softCircle") {
387
+ return ce.has(e) || ce.set(e, de(e)), ce.get(e);
388
388
  }
389
- function le(e) {
389
+ function de(e) {
390
390
  if (typeof document > "u") return F.WHITE;
391
391
  let t = document.createElement("canvas");
392
392
  t.width = e === "spark" ? 64 : 48, t.height = e === "spark" ? 16 : 48;
@@ -396,7 +396,7 @@ function le(e) {
396
396
  let e = n.createLinearGradient(0, 0, t.width, 0);
397
397
  e.addColorStop(0, "rgba(255,255,255,0)"), e.addColorStop(.22, "rgba(255,255,255,1)"), e.addColorStop(1, "rgba(255,255,255,0)"), n.strokeStyle = e, n.lineWidth = 4, n.lineCap = "round", n.beginPath(), n.moveTo(3, t.height / 2), n.lineTo(t.width - 3, t.height / 2), n.stroke();
398
398
  } else if (e === "square") n.fillRect(8, 8, 32, 32);
399
- else if (e === "star") ue(n, 24, 24, 5, 20, 8);
399
+ else if (e === "star") fe(n, 24, 24, 5, 20, 8);
400
400
  else if (e === "circle") n.beginPath(), n.arc(24, 24, 18, 0, Math.PI * 2), n.fill();
401
401
  else {
402
402
  let e = n.createRadialGradient(24, 24, 2, 24, 24, 22);
@@ -404,7 +404,7 @@ function le(e) {
404
404
  }
405
405
  return F.from(t);
406
406
  }
407
- function ue(e, t, n, r, i, a) {
407
+ function fe(e, t, n, r, i, a) {
408
408
  e.beginPath();
409
409
  for (let o = 0; o < r * 2; o++) {
410
410
  let s = o % 2 == 0 ? i : a, c = o * Math.PI / r - Math.PI / 2, l = t + Math.cos(c) * s, u = n + Math.sin(c) * s;
@@ -412,20 +412,20 @@ function ue(e, t, n, r, i, a) {
412
412
  }
413
413
  e.closePath(), e.fill();
414
414
  }
415
- async function de(e = {}) {
415
+ async function pe(e = {}) {
416
416
  let t = [];
417
- if (e.image && !se.has(e.image)) {
417
+ if (e.image && !le.has(e.image)) {
418
418
  let n = _.load(e.image);
419
- se.set(e.image, n), t.push(n.then((t) => {
420
- se.set(e.image, t);
419
+ le.set(e.image, n), t.push(n.then((t) => {
420
+ le.set(e.image, t);
421
421
  }));
422
422
  }
423
423
  e.spritesheet && t.push(Promise.resolve(_.load(e.spritesheet))), await Promise.all(t);
424
424
  }
425
- async function fe(e) {
426
- await Promise.all((e?.emitters ?? []).map((e) => de(e.particle)));
425
+ async function me(e) {
426
+ await Promise.all((e?.emitters ?? []).map((e) => pe(e.particle)));
427
427
  }
428
- function pe(e = {}, t = Math.random) {
428
+ function he(e = {}, t = Math.random) {
429
429
  if (e.texture) return [e.texture];
430
430
  if (e.frames?.length) {
431
431
  let n = e.frames.map((e) => F.from(e));
@@ -433,48 +433,48 @@ function pe(e = {}, t = Math.random) {
433
433
  }
434
434
  if (e.frame) return [F.from(e.frame)];
435
435
  if (e.image) {
436
- let t = se.get(e.image);
436
+ let t = le.get(e.image);
437
437
  return t && !(t instanceof Promise) ? [t] : [];
438
438
  }
439
- return [ce(e.shape)];
439
+ return [ue(e.shape)];
440
440
  }
441
441
  //#endregion
442
442
  //#region src/fx/utils.ts
443
- function me(e = Date.now()) {
443
+ function ge(e = Date.now()) {
444
444
  let t = e >>> 0;
445
445
  return () => (t = t * 1664525 + 1013904223 >>> 0, t / 4294967296);
446
446
  }
447
- function B(e, t, n) {
447
+ function z(e, t, n) {
448
448
  return e === void 0 ? n : Array.isArray(e) ? e[0] + (e[1] - e[0]) * t() : e;
449
449
  }
450
- function V(e, t) {
451
- return B(e, t, 0) * Math.PI / 180;
450
+ function _e(e, t) {
451
+ return z(e, t, 0) * Math.PI / 180;
452
452
  }
453
- function he(e, t = 16777215) {
453
+ function B(e, t = 16777215) {
454
454
  if (e === void 0) return t;
455
455
  if (typeof e == "number") return e;
456
456
  let n = e.trim().replace("#", "");
457
457
  return n.length === 3 ? parseInt(n.split("").map((e) => e + e).join(""), 16) : parseInt(n, 16);
458
458
  }
459
- function H(e, t, n) {
459
+ function ve(e, t, n) {
460
460
  return e + (t - e) * n;
461
461
  }
462
- function ge(e, t, n) {
463
- let r = e >> 16 & 255, i = e >> 8 & 255, a = e & 255, o = t >> 16 & 255, s = t >> 8 & 255, c = t & 255, l = Math.round(H(r, o, n)), u = Math.round(H(i, s, n)), d = Math.round(H(a, c, n));
462
+ function V(e, t, n) {
463
+ let r = e >> 16 & 255, i = e >> 8 & 255, a = e & 255, o = t >> 16 & 255, s = t >> 8 & 255, c = t & 255, l = Math.round(ve(r, o, n)), u = Math.round(ve(i, s, n)), d = Math.round(ve(a, c, n));
464
464
  return (l << 16) + (u << 8) + d;
465
465
  }
466
- function _e(e, t) {
466
+ function ye(e, t) {
467
467
  let n = Math.max(0, Math.min(1, t));
468
468
  return e === "outQuad" ? 1 - (1 - n) * (1 - n) : e === "outCubic" ? 1 - (1 - n) ** 3 : e === "inQuad" ? n * n : n;
469
469
  }
470
470
  //#endregion
471
471
  //#region src/fx/runtime.ts
472
- var ve = class {
472
+ var be = class {
473
473
  constructor(e = {}) {
474
- this.instances = /* @__PURE__ */ new Set(), this.pool = [], this.activeCount = 0, this.random = me(e.seed), this.maxParticles = e.maxParticles ?? 600;
474
+ this.instances = /* @__PURE__ */ new Set(), this.pool = [], this.activeCount = 0, this.random = ge(e.seed), this.maxParticles = e.maxParticles ?? 600;
475
475
  }
476
476
  async preload(e) {
477
- await fe(e);
477
+ await me(e);
478
478
  }
479
479
  spawn(e, t, n = {}) {
480
480
  let r = {
@@ -547,20 +547,20 @@ var ve = class {
547
547
  spawnParticle(e, t) {
548
548
  let n = t.maxParticles ?? e.options.maxParticles ?? this.maxParticles;
549
549
  if (this.activeCount >= n || t.particles.length >= n) return;
550
- let r = t.particle ?? {}, i = pe(r, this.random);
550
+ let r = t.particle ?? {}, i = he(r, this.random);
551
551
  if (!i.length) {
552
552
  if (e.options.missingTexture === "skip") return;
553
553
  if (e.options.missingTexture === "error") throw Error("Fx particle texture is not loaded");
554
- i.push(ce(r.shape));
554
+ i.push(ue(r.shape));
555
555
  }
556
556
  let a = this.pool.pop() ?? new N(F.WHITE);
557
- a.texture = i[0], a.visible = !0, a.anchor.set(r.anchor?.x ?? .5, r.anchor?.y ?? .5), a.x = (t.x ?? 0) + B([-(t.spreadX ?? 0), t.spreadX ?? 0], this.random, 0), a.y = (t.y ?? 0) + B([-(t.spreadY ?? 0), t.spreadY ?? 0], this.random, 0), a.rotation = B(r.rotation, this.random, 0) * Math.PI / 180, a.blendMode = r.blendMode ?? "normal";
558
- let o = V(t.angle, this.random), s = B(t.speed, this.random, 0), c = r.alpha ?? [1, 0], l = r.scale ?? [1, 0], u = r.tint ?? r.color ?? 16777215, d = he(Array.isArray(u) ? u[0] : u), f = he(Array.isArray(u) ? u[1] : u, d), p = B(Array.isArray(l) ? l[0] : l, this.random, 1), m = Array.isArray(l) ? B(l[1], this.random, 0) : p, h = B(Array.isArray(c) ? c[0] : c, this.random, 1), g = Array.isArray(c) ? B(c[1], this.random, 0) : h;
557
+ a.texture = i[0], a.visible = !0, a.anchor.set(r.anchor?.x ?? .5, r.anchor?.y ?? .5), a.x = (t.x ?? 0) + z([-(t.spreadX ?? 0), t.spreadX ?? 0], this.random, 0), a.y = (t.y ?? 0) + z([-(t.spreadY ?? 0), t.spreadY ?? 0], this.random, 0), a.rotation = z(r.rotation, this.random, 0) * Math.PI / 180, a.blendMode = r.blendMode ?? "normal";
558
+ let o = _e(t.angle, this.random), s = z(t.speed, this.random, 0), c = r.alpha ?? [1, 0], l = r.scale ?? [1, 0], u = r.tint ?? r.color ?? 16777215, d = B(Array.isArray(u) ? u[0] : u), f = B(Array.isArray(u) ? u[1] : u, d), p = z(Array.isArray(l) ? l[0] : l, this.random, 1), m = Array.isArray(l) ? z(l[1], this.random, 0) : p, h = z(Array.isArray(c) ? c[0] : c, this.random, 1), g = Array.isArray(c) ? z(c[1], this.random, 0) : h;
559
559
  a.alpha = h, a.tint = d, a.scale.set(p), e.container.addChild(a);
560
560
  let _ = {
561
561
  sprite: a,
562
562
  age: 0,
563
- lifetime: B(r.lifetime, this.random, 600),
563
+ lifetime: z(r.lifetime, this.random, 600),
564
564
  vx: Math.cos(o) * s,
565
565
  vy: Math.sin(o) * s,
566
566
  ax: t.accelerationX ?? 0,
@@ -572,7 +572,7 @@ var ve = class {
572
572
  endScale: m,
573
573
  startTint: d,
574
574
  endTint: f,
575
- rotationSpeed: B(r.rotationSpeed, this.random, 0) * Math.PI / 180,
575
+ rotationSpeed: z(r.rotationSpeed, this.random, 0) * Math.PI / 180,
576
576
  frameRate: r.frameRate ?? 12,
577
577
  frames: i,
578
578
  ease: r.ease ?? "linear"
@@ -580,8 +580,8 @@ var ve = class {
580
580
  t.particles.push(_), this.activeCount++, e.options.onParticleSpawn?.(_);
581
581
  }
582
582
  updateParticle(e, t) {
583
- let n = t / 1e3, r = e.age / e.lifetime, i = _e(e.ease, r);
584
- if (e.vx += e.ax * n, e.vy += (e.ay + e.gravity) * n, e.sprite.x += e.vx * n, e.sprite.y += e.vy * n, e.sprite.rotation += e.rotationSpeed * n, e.sprite.alpha = H(e.startAlpha, e.endAlpha, i), e.sprite.scale.set(H(e.startScale, e.endScale, i)), e.sprite.tint = ge(e.startTint, e.endTint, i), e.frames.length > 1) {
583
+ let n = t / 1e3, r = e.age / e.lifetime, i = ye(e.ease, r);
584
+ if (e.vx += e.ax * n, e.vy += (e.ay + e.gravity) * n, e.sprite.x += e.vx * n, e.sprite.y += e.vy * n, e.sprite.rotation += e.rotationSpeed * n, e.sprite.alpha = ve(e.startAlpha, e.endAlpha, i), e.sprite.scale.set(ve(e.startScale, e.endScale, i)), e.sprite.tint = V(e.startTint, e.endTint, i), e.frames.length > 1) {
585
585
  let t = Math.min(e.frames.length - 1, Math.floor(e.age / 1e3 * e.frameRate) % e.frames.length);
586
586
  e.sprite.texture = e.frames[t];
587
587
  }
@@ -595,15 +595,15 @@ var ve = class {
595
595
  t.particles = [];
596
596
  }
597
597
  }
598
- }, U = (e) => typeof e == "function" ? e() : e;
599
- function ye(e, t) {
600
- let n = U(t);
598
+ }, H = (e) => typeof e == "function" ? e() : e;
599
+ function xe(e, t) {
600
+ let n = H(t);
601
601
  if (n) return n;
602
- let r = U(e), i = ae[r];
602
+ let r = H(e), i = se[r];
603
603
  if (!i) throw Error(`Unknown Fx preset: ${r}`);
604
604
  return i;
605
605
  }
606
- function be(t) {
606
+ function Se(t) {
607
607
  let { name: n, preset: r, trigger: i, autostart: a, loop: o, enabled: s, x: l, y: f, rotation: p, scale: g, alpha: _, seed: v, maxParticles: y, timeScale: b, preload: x, missingTexture: S, onStart: C, onComplete: w, onParticleSpawn: T, ...E } = h(t, {
608
608
  name: "hitSpark",
609
609
  autostart: !1,
@@ -617,29 +617,29 @@ function be(t) {
617
617
  timeScale: 1,
618
618
  preload: !0,
619
619
  missingTexture: "shape"
620
- }), D, O = new ve({
621
- seed: U(v),
622
- maxParticles: U(y)
620
+ }), D, O = new be({
621
+ seed: H(v),
622
+ maxParticles: H(y)
623
623
  }), k = async (e = {}) => {
624
- if (!D || !U(s)) return;
625
- let t = ye(n, r);
626
- return U(x) && await O.preload(t), O.spawn(D, t, {
627
- loop: U(o),
628
- seed: U(v),
629
- maxParticles: U(y),
630
- missingTexture: U(S),
624
+ if (!D || !H(s)) return;
625
+ let t = xe(n, r);
626
+ return H(x) && await O.preload(t), O.spawn(D, t, {
627
+ loop: H(o),
628
+ seed: H(v),
629
+ maxParticles: H(y),
630
+ missingTexture: H(S),
631
631
  onStart: C,
632
632
  onComplete: w,
633
633
  onParticleSpawn: T,
634
634
  ...e
635
635
  });
636
636
  };
637
- return u((e) => (D = e.componentInstance, (U(a) || U(o)) && k(), () => {
637
+ return u((e) => (D = e.componentInstance, (H(a) || H(o)) && k(), () => {
638
638
  O.clear();
639
639
  })), i?.listen && d(i, async (e) => {
640
640
  await k(e);
641
641
  }), m(({ deltaTime: e }) => {
642
- O.update((e ?? 16.67) * U(b));
642
+ O.update((e ?? 16.67) * H(b));
643
643
  }), c(e, {
644
644
  ...E,
645
645
  x: l,
@@ -651,20 +651,20 @@ function be(t) {
651
651
  }
652
652
  //#endregion
653
653
  //#region src/Particle.ts
654
- function xe(e) {
654
+ function Ce(e) {
655
655
  let { emit: t, ...n } = e;
656
- return be({
656
+ return Se({
657
657
  ...n,
658
658
  trigger: n.trigger ?? t
659
659
  });
660
660
  }
661
661
  //#endregion
662
662
  //#region src/shaders/nightSpot.frag.glsl?raw
663
- var Se = "/**\n * Night + spot light + fog fragment shader.\n * - Supports multiple circular spots (uSpots) in screen-pixel space.\n * - Each spot is vec4(xPx, yPx, radiusPx, intensity).\n * - Fog is based on the nearest light source so illuminated areas stay readable.\n * - Dark zones are tinted with uDarkColor for colored night effects.\n */\nprecision highp float;\nprecision highp int;\n\nin vec2 vTextureCoord;\n\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform highp vec4 uInputSize;\nuniform vec4 uSpots[24];\nuniform float uDarkness;\nuniform vec3 uDarkColor;\nuniform vec3 uFogColor;\nuniform float uFogRadius;\nuniform float uFogSoftness;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n float light = 0.0;\n float nearestDist = 1.0;\n vec2 fragPx = vTextureCoord * uInputSize.xy;\n float minInputDim = max(min(uInputSize.x, uInputSize.y), 1.0);\n\n for (int i = 0; i < 24; i++) {\n vec4 spotData = uSpots[i];\n vec2 lightPosPx = spotData.xy;\n float radiusPx = max(spotData.z, 0.0001);\n float intensity = max(spotData.w, 0.0);\n if (intensity <= 0.0001) continue;\n\n vec2 deltaPx = fragPx - lightPosPx;\n float distPx = length(deltaPx);\n float spot = (1.0 - smoothstep(0.0, radiusPx, distPx)) * intensity;\n light = clamp(light + spot, 0.0, 1.0);\n nearestDist = min(nearestDist, distPx / minInputDim);\n }\n\n // Night: full brightness where light is strong, darker elsewhere.\n // Apply dark color tint in unlit areas.\n float factor = mix(1.0 - uDarkness, 1.0, light);\n vec3 darkened = color.rgb * factor;\n // Blend towards dark color in unlit areas (when factor < 1)\n float darkTint = (1.0 - factor) * uDarkness;\n color.rgb = mix(darkened, uDarkColor, darkTint);\n\n // Fog fades in with distance to nearest light, but less inside lit areas.\n float fogFactor = smoothstep(uFogRadius, uFogRadius + uFogSoftness, nearestDist);\n fogFactor *= (1.0 - light * 0.7);\n color.rgb = mix(color.rgb, uFogColor, clamp(fogFactor, 0.0, 1.0));\n\n finalColor = color;\n}\n", Ce = "/**\n * Default Pixi filter vertex shader.\n * Outputs vTextureCoord (0-1) for sampling the input texture in fragment shader.\n */\nin vec2 aPosition;\nout vec2 vTextureCoord;\n\nuniform highp vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition(void) {\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord(void) {\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void) {\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n", we = 24, Te = 180, Ee = .75, De = .5, Oe = .35, ke = new Float32Array([
663
+ var we = "/**\n * Night + spot light + fog fragment shader.\n * - Supports multiple circular spots (uSpots) in screen-pixel space.\n * - Each spot is vec4(xPx, yPx, radiusPx, intensity).\n * - Fog is based on the nearest light source so illuminated areas stay readable.\n * - Dark zones are tinted with uDarkColor for colored night effects.\n */\nprecision highp float;\nprecision highp int;\n\nin vec2 vTextureCoord;\n\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform highp vec4 uInputSize;\nuniform vec4 uSpots[24];\nuniform float uDarkness;\nuniform vec3 uDarkColor;\nuniform vec3 uFogColor;\nuniform float uFogRadius;\nuniform float uFogSoftness;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n float light = 0.0;\n float nearestDist = 1.0;\n vec2 fragPx = vTextureCoord * uInputSize.xy;\n float minInputDim = max(min(uInputSize.x, uInputSize.y), 1.0);\n\n for (int i = 0; i < 24; i++) {\n vec4 spotData = uSpots[i];\n vec2 lightPosPx = spotData.xy;\n float radiusPx = max(spotData.z, 0.0001);\n float intensity = max(spotData.w, 0.0);\n if (intensity <= 0.0001) continue;\n\n vec2 deltaPx = fragPx - lightPosPx;\n float distPx = length(deltaPx);\n float spot = (1.0 - smoothstep(0.0, radiusPx, distPx)) * intensity;\n light = clamp(light + spot, 0.0, 1.0);\n nearestDist = min(nearestDist, distPx / minInputDim);\n }\n\n // Night: full brightness where light is strong, darker elsewhere.\n // Apply dark color tint in unlit areas.\n float factor = mix(1.0 - uDarkness, 1.0, light);\n vec3 darkened = color.rgb * factor;\n // Blend towards dark color in unlit areas (when factor < 1)\n float darkTint = (1.0 - factor) * uDarkness;\n color.rgb = mix(darkened, uDarkColor, darkTint);\n\n // Fog fades in with distance to nearest light, but less inside lit areas.\n float fogFactor = smoothstep(uFogRadius, uFogRadius + uFogSoftness, nearestDist);\n fogFactor *= (1.0 - light * 0.7);\n color.rgb = mix(color.rgb, uFogColor, clamp(fogFactor, 0.0, 1.0));\n\n finalColor = color;\n}\n", Te = "/**\n * Default Pixi filter vertex shader.\n * Outputs vTextureCoord (0-1) for sampling the input texture in fragment shader.\n */\nin vec2 aPosition;\nout vec2 vTextureCoord;\n\nuniform highp vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition(void) {\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord(void) {\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void) {\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n", Ee = 24, De = 180, Oe = .75, ke = .5, Ae = .35, je = new Float32Array([
664
664
  .08,
665
665
  .08,
666
666
  .14
667
- ]), Ae = (e) => {
667
+ ]), Me = (e, t, n) => Math.min(Math.max(e, t), n), Ne = (e) => Me(e, 0, 1), Pe = (e) => {
668
668
  if (typeof e == "string") {
669
669
  let t = e.replace(/^#/, "");
670
670
  t.length === 3 && (t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]);
@@ -690,25 +690,25 @@ var Se = "/**\n * Night + spot light + fog fragment shader.\n * - Supports multi
690
690
  0
691
691
  ]);
692
692
  };
693
- function je(e, t) {
694
- let n = new Float32Array(we * 4), r = {
693
+ function Fe(e, t) {
694
+ let n = new Float32Array(Ee * 4), r = {
695
695
  value: n,
696
696
  type: "vec4<f32>",
697
- size: we
697
+ size: Ee
698
698
  }, i = {
699
- value: t?.darkness ?? Ee,
699
+ value: Ne(t?.darkness ?? Oe),
700
700
  type: "f32"
701
701
  }, a = {
702
- value: t?.fogColor ? Ae(t.fogColor) : ke,
702
+ value: t?.fogColor ? Pe(t.fogColor) : je,
703
703
  type: "vec3<f32>"
704
704
  }, o = {
705
- value: t?.fogRadius ?? De,
705
+ value: t?.fogRadius ?? ke,
706
706
  type: "f32"
707
707
  }, s = {
708
- value: t?.fogSoftness ?? Oe,
708
+ value: t?.fogSoftness ?? Ae,
709
709
  type: "f32"
710
710
  }, c = {
711
- value: t?.darkColor ? Ae(t.darkColor) : new Float32Array([
711
+ value: t?.darkColor ? Pe(t.darkColor) : new Float32Array([
712
712
  0,
713
713
  0,
714
714
  0
@@ -716,8 +716,8 @@ function je(e, t) {
716
716
  type: "vec3<f32>"
717
717
  }, l = t?.spots ? [...t.spots] : [], u = t?.lightWorldPosition ?? null, d = T.from({
718
718
  gl: {
719
- vertex: Ce,
720
- fragment: Se
719
+ vertex: Te,
720
+ fragment: we
721
721
  },
722
722
  resources: { nightUniforms: {
723
723
  uSpots: r,
@@ -727,76 +727,79 @@ function je(e, t) {
727
727
  uFogRadius: o,
728
728
  uFogSoftness: s
729
729
  } }
730
- }), f = (e, t, n) => Math.min(Math.max(e, t), n), p = () => Date.now() / 1e3, m = () => u ? [{
730
+ }), f = d.resources.nightUniforms.uniforms, p = () => Date.now() / 1e3, m = (e, t) => {
731
+ let n = f[e];
732
+ n instanceof Float32Array && n.length >= t.length ? n.set(t) : f[e] = t;
733
+ }, h = () => u ? [{
731
734
  x: u.x,
732
735
  y: u.y
733
- }, ...l] : l, h = () => {
734
- let i = m(), a = Math.min(i.length, we), o = e?.getVisibleBounds?.() ?? t?.getBounds?.(), s = !!o && o.width > 0 && o.height > 0, c = e?.toScreen?.bind(e), l = s && typeof c == "function", u = 0, d = 0;
735
- if (l) {
736
- let e = c(o.x, o.y);
737
- G(e?.x) && G(e?.y) && (u = e.x, d = e.y);
736
+ }, ...l] : l, g = () => {
737
+ let r = h(), i = Math.min(r.length, Ee), a = e?.getVisibleBounds?.() ?? t?.getBounds?.(), o = !!a && a.width > 0 && a.height > 0, s = e?.toScreen?.bind(e), c = o && typeof s == "function", l = 0, u = 0;
738
+ if (c) {
739
+ let e = s(a.x, a.y);
740
+ W(e?.x) && W(e?.y) && (l = e.x, u = e.y);
738
741
  }
739
- let h = p();
742
+ let d = p();
740
743
  n.fill(0);
741
- for (let e = 0; e < a; e++) {
742
- let t = i[e], r = t.radius ?? Te, a = f(t.intensity ?? 1, 0, 2), p = t.phase ?? e * .7, m = a;
744
+ for (let e = 0; e < i; e++) {
745
+ let t = r[e], i = t.radius ?? De, f = Me(t.intensity ?? 1, 0, 2), p = t.phase ?? e * .7, m = f;
743
746
  if (t.flicker) {
744
747
  let e = t.flickerSpeed ?? 12;
745
- m *= .88 + .12 * Math.sin(h * e + p);
748
+ m *= .88 + .12 * Math.sin(d * e + p);
746
749
  }
747
750
  if (t.pulse) {
748
751
  let e = t.pulseSpeed ?? 2;
749
- m *= .8 + .2 * Math.sin(h * e + p);
752
+ m *= .8 + .2 * Math.sin(d * e + p);
750
753
  }
751
- let g = t.x, _ = t.y, v = r;
752
- if (l) {
753
- let e = c(t.x, t.y);
754
- g = e.x - u, _ = e.y - d;
755
- } else s && (g = t.x - o.x, _ = t.y - o.y);
756
- let y = e * 4;
757
- n[y] = g, n[y + 1] = _, n[y + 2] = v, n[y + 3] = f(m, 0, 2);
754
+ let h = t.x, g = t.y, _ = i;
755
+ if (c) {
756
+ let e = s(t.x, t.y);
757
+ h = e.x - l, g = e.y - u;
758
+ } else o && (h = t.x - a.x, g = t.y - a.y);
759
+ let v = e * 4;
760
+ n[v] = h, n[v + 1] = g, n[v + 2] = _, n[v + 3] = Me(m, 0, 2);
758
761
  }
759
- r.value = n;
760
- }, g = d.apply.bind(d);
761
- d.apply = ((...e) => (h(), g(...e)));
762
- let _ = d;
763
- return _.setLightWorldPosition = (e) => {
764
- u = e, h();
765
- }, _.getLightWorldPosition = () => u, _.setSpots = (e) => {
766
- l = [...e], h();
767
- }, _.getSpots = () => m().map((e) => ({ ...e })), _.syncLightToViewport = h, _.setDarkness = (e) => {
768
- i.value = e;
769
- }, _.setDarkColor = (e) => {
770
- c.value = Ae(e);
771
- }, _.setFogColor = (e) => {
772
- a.value = Ae(e);
773
- }, _.setFogRadius = (e) => {
774
- o.value = e;
775
- }, _.setFogSoftness = (e) => {
776
- s.value = e;
777
- }, h(), _;
762
+ f.uSpots = n;
763
+ }, _ = d.apply.bind(d);
764
+ d.apply = ((...e) => (g(), _(...e)));
765
+ let v = d;
766
+ return v.setLightWorldPosition = (e) => {
767
+ u = e, g();
768
+ }, v.getLightWorldPosition = () => u, v.setSpots = (e) => {
769
+ l = [...e], g();
770
+ }, v.getSpots = () => h().map((e) => ({ ...e })), v.syncLightToViewport = g, v.setDarkness = (e) => {
771
+ f.uDarkness = Ne(e);
772
+ }, v.setDarkColor = (e) => {
773
+ m("uDarkColor", Pe(e));
774
+ }, v.setFogColor = (e) => {
775
+ m("uFogColor", Pe(e));
776
+ }, v.setFogRadius = (e) => {
777
+ f.uFogRadius = e;
778
+ }, v.setFogSoftness = (e) => {
779
+ f.uFogSoftness = e;
780
+ }, g(), v;
778
781
  }
779
- var W = (e) => typeof e == "function" ? e() : e, G = (e) => typeof e == "number" && Number.isFinite(e), Me = (e) => {
780
- let t = W(e);
782
+ var U = (e) => typeof e == "function" ? e() : e, W = (e) => typeof e == "number" && Number.isFinite(e), Ie = (e) => {
783
+ let t = U(e);
781
784
  if (!t) return null;
782
- let n = W(t.x), r = W(t.y);
783
- if (!G(n) || !G(r)) return null;
784
- let i = W(t.radius), a = W(t.intensity), o = W(t.flickerSpeed), s = W(t.pulseSpeed), c = W(t.phase);
785
+ let n = U(t.x), r = U(t.y);
786
+ if (!W(n) || !W(r)) return null;
787
+ let i = U(t.radius), a = U(t.intensity), o = U(t.flickerSpeed), s = U(t.pulseSpeed), c = U(t.phase);
785
788
  return {
786
789
  x: n,
787
790
  y: r,
788
- radius: G(i) ? i : void 0,
789
- intensity: G(a) ? a : void 0,
790
- flicker: !!W(t.flicker),
791
- flickerSpeed: G(o) ? o : void 0,
792
- pulse: !!W(t.pulse),
793
- pulseSpeed: G(s) ? s : void 0,
794
- phase: G(c) ? c : void 0
791
+ radius: W(i) ? i : void 0,
792
+ intensity: W(a) ? a : void 0,
793
+ flicker: !!U(t.flicker),
794
+ flickerSpeed: W(o) ? o : void 0,
795
+ pulse: !!U(t.pulse),
796
+ pulseSpeed: W(s) ? s : void 0,
797
+ phase: W(c) ? c : void 0
795
798
  };
796
- }, Ne = (e) => {
797
- let t = W(e);
798
- return Array.isArray(t) ? t.map(Me).filter((e) => !!e) : [];
799
- }, Pe = (e) => {
799
+ }, Le = (e) => {
800
+ let t = U(e);
801
+ return Array.isArray(t) ? t.map(Ie).filter((e) => !!e) : [];
802
+ }, Re = (e) => {
800
803
  if (!e) return null;
801
804
  if (typeof e.getVisibleBounds == "function") {
802
805
  let t = e.getVisibleBounds();
@@ -806,14 +809,14 @@ var W = (e) => typeof e == "function" ? e() : e, G = (e) => typeof e == "number"
806
809
  let t = e.getLocalBounds();
807
810
  if (t) return t;
808
811
  }
809
- return G(e.width) && G(e.height) ? {
812
+ return W(e.width) && W(e.height) ? {
810
813
  x: 0,
811
814
  y: 0,
812
815
  width: e.width,
813
816
  height: e.height
814
817
  } : null;
815
818
  };
816
- function Fe(t = {}) {
819
+ function ze(t = {}) {
817
820
  let n = h(t), r = () => n.lightSpots ?? n.spots;
818
821
  return u((e) => {
819
822
  let t = e.props.context, i = t?.viewport, a = i ?? e.parent?.componentInstance;
@@ -821,40 +824,40 @@ function Fe(t = {}) {
821
824
  let o = t?.canvasSize, c = () => {
822
825
  if (!i && typeof o == "function") {
823
826
  let e = o();
824
- if (e && G(e.width) && G(e.height) && e.width > 0 && e.height > 0) return {
827
+ if (e && W(e.width) && W(e.height) && e.width > 0 && e.height > 0) return {
825
828
  x: 0,
826
829
  y: 0,
827
830
  width: e.width,
828
831
  height: e.height
829
832
  };
830
833
  }
831
- return Pe(a);
832
- }, l = W(n.darkness), u = W(n.darkColor), d = W(n.fogColor), f = W(n.fogRadius), p = W(n.fogSoftness), m = je(i, {
833
- spots: Ne(r()),
834
+ return Re(a);
835
+ }, l = U(n.darkness), u = U(n.darkColor), d = U(n.fogColor), f = U(n.fogRadius), p = U(n.fogSoftness), m = Fe(i, {
836
+ spots: Le(r()),
834
837
  getBounds: c,
835
- darkness: G(l) ? l : void 0,
838
+ darkness: W(l) ? l : void 0,
836
839
  darkColor: u ?? void 0,
837
840
  fogColor: d ?? void 0,
838
- fogRadius: G(f) ? f : void 0,
839
- fogSoftness: G(p) ? p : void 0
841
+ fogRadius: W(f) ? f : void 0,
842
+ fogSoftness: W(p) ? p : void 0
840
843
  }), h = Array.isArray(a.filters) ? a.filters : [];
841
844
  return h.includes(m) || (a.filters = [...h, m]), s(() => {
842
- m.setSpots(Ne(r()));
845
+ m.setSpots(Le(r()));
843
846
  }), s(() => {
844
- let e = W(n.darkness);
845
- G(e) && m.setDarkness(e);
847
+ let e = U(n.darkness);
848
+ W(e) && m.setDarkness(e);
846
849
  }), s(() => {
847
- let e = W(n.darkColor);
850
+ let e = U(n.darkColor);
848
851
  e !== void 0 && m.setDarkColor(e);
849
852
  }), s(() => {
850
- let e = W(n.fogColor);
853
+ let e = U(n.fogColor);
851
854
  e !== void 0 && m.setFogColor(e);
852
855
  }), s(() => {
853
- let e = W(n.fogRadius);
854
- G(e) && m.setFogRadius(e);
856
+ let e = U(n.fogRadius);
857
+ W(e) && m.setFogRadius(e);
855
858
  }), s(() => {
856
- let e = W(n.fogSoftness);
857
- G(e) && m.setFogSoftness(e);
859
+ let e = U(n.fogSoftness);
860
+ W(e) && m.setFogSoftness(e);
858
861
  }), () => {
859
862
  let e = (Array.isArray(a.filters) ? a.filters : []).filter((e) => e !== m);
860
863
  a.filters = e.length > 0 ? e : null;
@@ -863,7 +866,7 @@ function Fe(t = {}) {
863
866
  }
864
867
  //#endregion
865
868
  //#region src/Loading.ts
866
- function Ie(t = {}) {
869
+ function Be(t = {}) {
867
870
  let { size: r = 30, color: i = "#3498db", backgroundColor: a, speed: o = 180, segments: l = 8, segmentWidth: u = 3, inactiveAlpha: d = .15 } = h(t, {
868
871
  size: 30,
869
872
  color: "#3498db",
@@ -901,15 +904,15 @@ function Ie(t = {}) {
901
904
  }
902
905
  //#endregion
903
906
  //#region ../tiled/dist/index.js
904
- var Le = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), Re = /* @__PURE__ */ function(e) {
907
+ var Ve = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), He = /* @__PURE__ */ function(e) {
905
908
  return e.Tile = "tilelayer", e.ObjectGroup = "objectgroup", e.Image = "imagelayer", e.Group = "group", e;
906
909
  }({});
907
- function ze(...e) {
910
+ function Ue(...e) {
908
911
  return e.filter((e) => e && e.length > 0).join("/").replace(/\/+/g, "/");
909
912
  }
910
- var Be = /* @__PURE__ */ Le(((e, t) => {
913
+ var We = /* @__PURE__ */ Ve(((e, t) => {
911
914
  t.exports = {};
912
- })), Ve = /* @__PURE__ */ Le(((e) => {
915
+ })), Ge = /* @__PURE__ */ Ve(((e) => {
913
916
  (function(e) {
914
917
  e.parser = function(e, t) {
915
918
  return new n(e, t);
@@ -990,7 +993,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
990
993
  end: function() {
991
994
  j(this);
992
995
  },
993
- write: z,
996
+ write: re,
994
997
  resume: function() {
995
998
  return this.error = null, this;
996
999
  },
@@ -1003,7 +1006,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1003
1006
  };
1004
1007
  var o;
1005
1008
  try {
1006
- o = Be().Stream;
1009
+ o = We().Stream;
1007
1010
  } catch {
1008
1011
  o = function() {};
1009
1012
  }
@@ -1039,7 +1042,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1039
1042
  l.prototype = Object.create(o.prototype, { constructor: { value: l } }), l.prototype.write = function(e) {
1040
1043
  if (typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(e)) {
1041
1044
  if (!this._decoder) {
1042
- var t = Be().StringDecoder;
1045
+ var t = We().StringDecoder;
1043
1046
  this._decoder = new t("utf8");
1044
1047
  }
1045
1048
  e = this._decoder.write(e);
@@ -1501,17 +1504,17 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1501
1504
  function te(e, t) {
1502
1505
  t === "<" ? (e.state = w.OPEN_WAKA, e.startTagPosition = e.position) : y(t) || (M(e, "Non-whitespace before first tag."), e.textNode = t, e.state = w.TEXT);
1503
1506
  }
1504
- function R(e, t) {
1507
+ function ne(e, t) {
1505
1508
  var n = "";
1506
1509
  return t < e.length && (n = e.charAt(t)), n;
1507
1510
  }
1508
- function z(t) {
1511
+ function re(t) {
1509
1512
  var n = this;
1510
1513
  if (this.error) throw this.error;
1511
1514
  if (n.closed) return A(n, "Cannot write after close. Assign an onready handler.");
1512
1515
  if (t === null) return j(n);
1513
1516
  typeof t == "object" && (t = t.toString());
1514
- for (var i = 0, a = ""; a = R(t, i++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++), n.state) {
1517
+ for (var i = 0, a = ""; a = ne(t, i++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++), n.state) {
1515
1518
  case w.BEGIN:
1516
1519
  if (n.state = w.BEGIN_WHITESPACE, a === "") continue;
1517
1520
  te(n, a);
@@ -1521,7 +1524,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1521
1524
  continue;
1522
1525
  case w.TEXT:
1523
1526
  if (n.sawRoot && !n.closedRoot) {
1524
- for (var o = i - 1; a && a !== "<" && a !== "&";) a = R(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
1527
+ for (var o = i - 1; a && a !== "<" && a !== "&";) a = ne(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
1525
1528
  n.textNode += t.substring(o, i - 1);
1526
1529
  }
1527
1530
  a === "<" && !(n.sawRoot && n.closedRoot && !n.strict) ? (n.state = w.OPEN_WAKA, n.startTagPosition = n.position) : (!y(a) && (!n.sawRoot || n.closedRoot) && M(n, "Text data outside of root node."), a === "&" ? n.state = w.TEXT_ENTITY : n.textNode += a);
@@ -1695,12 +1698,12 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1695
1698
  }) : String.fromCodePoint = n;
1696
1699
  })();
1697
1700
  })(e === void 0 ? e.sax = {} : e);
1698
- })), He = /* @__PURE__ */ Le(((e, t) => {
1701
+ })), Ke = /* @__PURE__ */ Ve(((e, t) => {
1699
1702
  t.exports = { isArray: function(e) {
1700
1703
  return Array.isArray ? Array.isArray(e) : Object.prototype.toString.call(e) === "[object Array]";
1701
1704
  } };
1702
- })), Ue = /* @__PURE__ */ Le(((e, t) => {
1703
- var n = He().isArray;
1705
+ })), qe = /* @__PURE__ */ Ve(((e, t) => {
1706
+ var n = Ke().isArray;
1704
1707
  t.exports = {
1705
1708
  copyOptions: function(e) {
1706
1709
  var t, n = {};
@@ -1723,11 +1726,11 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1723
1726
  return e + "Fn" in t;
1724
1727
  }
1725
1728
  };
1726
- })), We = /* @__PURE__ */ Le(((e, t) => {
1727
- var n = Ve(), r = {
1729
+ })), Je = /* @__PURE__ */ Ve(((e, t) => {
1730
+ var n = Ge(), r = {
1728
1731
  on: function() {},
1729
1732
  parse: function() {}
1730
- }, i = Ue(), a = He().isArray, o, s = !0, c;
1733
+ }, i = qe(), a = Ke().isArray, o, s = !0, c;
1731
1734
  function l(e) {
1732
1735
  return o = i.copyOptions(e), i.ensureFlagExists("ignoreDeclaration", o), i.ensureFlagExists("ignoreInstruction", o), i.ensureFlagExists("ignoreAttributes", o), i.ensureFlagExists("ignoreText", o), i.ensureFlagExists("ignoreComment", o), i.ensureFlagExists("ignoreCdata", o), i.ensureFlagExists("ignoreDoctype", o), i.ensureFlagExists("compact", o), i.ensureFlagExists("alwaysChildren", o), i.ensureFlagExists("addParent", o), i.ensureFlagExists("trim", o), i.ensureFlagExists("nativeType", o), i.ensureFlagExists("nativeTypeAttributes", o), i.ensureFlagExists("sanitize", o), i.ensureFlagExists("instructionHasAttributes", o), i.ensureFlagExists("captureSpacesBetweenElements", o), i.ensureAlwaysArrayExists(o), i.ensureKeyExists("declaration", o), i.ensureKeyExists("instruction", o), i.ensureKeyExists("attributes", o), i.ensureKeyExists("text", o), i.ensureKeyExists("comment", o), i.ensureKeyExists("cdata", o), i.ensureKeyExists("doctype", o), i.ensureKeyExists("type", o), i.ensureKeyExists("name", o), i.ensureKeyExists("elements", o), i.ensureKeyExists("parent", o), i.checkFnExists("doctype", o), i.checkFnExists("instruction", o), i.checkFnExists("cdata", o), i.checkFnExists("comment", o), i.checkFnExists("text", o), i.checkFnExists("instructionName", o), i.checkFnExists("elementName", o), i.checkFnExists("attributeName", o), i.checkFnExists("attributeValue", o), i.checkFnExists("attributes", o), o;
1733
1736
  }
@@ -1820,8 +1823,8 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1820
1823
  }
1821
1824
  return a;
1822
1825
  };
1823
- })), Ge = /* @__PURE__ */ Le(((e, t) => {
1824
- var n = Ue(), r = We();
1826
+ })), Ye = /* @__PURE__ */ Ve(((e, t) => {
1827
+ var n = qe(), r = Je();
1825
1828
  function i(e) {
1826
1829
  var t = n.copyOptions(e);
1827
1830
  return n.ensureSpacesExists(t), t;
@@ -1832,8 +1835,8 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1832
1835
  return e === s ? "_" : t;
1833
1836
  }, n.spaces) : JSON.stringify(a, null, n.spaces), o.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
1834
1837
  };
1835
- })), Ke = /* @__PURE__ */ Le(((e, t) => {
1836
- var n = Ue(), r = He().isArray, i, a;
1838
+ })), Xe = /* @__PURE__ */ Ve(((e, t) => {
1839
+ var n = qe(), r = Ke().isArray, i, a;
1837
1840
  function o(e) {
1838
1841
  var t = n.copyOptions(e);
1839
1842
  return n.ensureFlagExists("ignoreDeclaration", t), n.ensureFlagExists("ignoreInstruction", t), n.ensureFlagExists("ignoreAttributes", t), n.ensureFlagExists("ignoreText", t), n.ensureFlagExists("ignoreComment", t), n.ensureFlagExists("ignoreCdata", t), n.ensureFlagExists("ignoreDoctype", t), n.ensureFlagExists("compact", t), n.ensureFlagExists("indentText", t), n.ensureFlagExists("indentCdata", t), n.ensureFlagExists("indentAttributes", t), n.ensureFlagExists("indentInstruction", t), n.ensureFlagExists("fullTagEmptyElement", t), n.ensureFlagExists("noQuotesForNativeAttributes", t), n.ensureSpacesExists(t), typeof t.spaces == "number" && (t.spaces = Array(t.spaces + 1).join(" ")), n.ensureKeyExists("declaration", t), n.ensureKeyExists("instruction", t), n.ensureKeyExists("attributes", t), n.ensureKeyExists("text", t), n.ensureKeyExists("comment", t), n.ensureKeyExists("cdata", t), n.ensureKeyExists("doctype", t), n.ensureKeyExists("type", t), n.ensureKeyExists("name", t), n.ensureKeyExists("elements", t), n.checkFnExists("doctype", t), n.checkFnExists("instruction", t), n.checkFnExists("cdata", t), n.checkFnExists("comment", t), n.checkFnExists("text", t), n.checkFnExists("instructionName", t), n.checkFnExists("elementName", t), n.checkFnExists("attributeName", t), n.checkFnExists("attributeValue", t), n.checkFnExists("attributes", t), n.checkFnExists("fullTagEmptyElement", t), t;
@@ -1980,8 +1983,8 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1980
1983
  var n = [];
1981
1984
  return i = e, a = "_root_", t.compact ? n.push(b(e, t, 0, !0)) : (e[t.declarationKey] && n.push(l(e[t.declarationKey], t, 0)), e[t.elementsKey] && e[t.elementsKey].length && n.push(_(e[t.elementsKey], t, 0, !n.length))), n.join("");
1982
1985
  };
1983
- })), qe = /* @__PURE__ */ Le(((e, t) => {
1984
- var n = Ke();
1986
+ })), Ze = /* @__PURE__ */ Ve(((e, t) => {
1987
+ var n = Xe();
1985
1988
  t.exports = function(e, t) {
1986
1989
  e instanceof Buffer && (e = e.toString());
1987
1990
  var r = null;
@@ -1993,14 +1996,14 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
1993
1996
  else r = e;
1994
1997
  return n(r, t);
1995
1998
  };
1996
- })), Je = /* @__PURE__ */ Le(((e, t) => {
1999
+ })), Qe = /* @__PURE__ */ Ve(((e, t) => {
1997
2000
  t.exports = {
1998
- xml2js: We(),
1999
- xml2json: Ge(),
2000
- js2xml: Ke(),
2001
- json2xml: qe()
2001
+ xml2js: Je(),
2002
+ xml2json: Ye(),
2003
+ js2xml: Xe(),
2004
+ json2xml: Ze()
2002
2005
  };
2003
- })), Ye = /* @__PURE__ */ Le(((e) => {
2006
+ })), $e = /* @__PURE__ */ Ve(((e) => {
2004
2007
  e.byteLength = c, e.toByteArray = u, e.fromByteArray = p;
2005
2008
  for (var t = [], n = [], r = typeof Uint8Array < "u" ? Uint8Array : Array, i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, o = i.length; a < o; ++a) t[a] = i[a], n[i.charCodeAt(a)] = a;
2006
2009
  n[45] = 62, n[95] = 63;
@@ -2035,7 +2038,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2035
2038
  for (var n, r = e.length, i = r % 3, a = [], o = 16383, s = 0, c = r - i; s < c; s += o) a.push(f(e, s, s + o > c ? c : s + o));
2036
2039
  return i === 1 ? (n = e[r - 1], a.push(t[n >> 2] + t[n << 4 & 63] + "==")) : i === 2 && (n = (e[r - 2] << 8) + e[r - 1], a.push(t[n >> 10] + t[n >> 4 & 63] + t[n << 2 & 63] + "=")), a.join("");
2037
2040
  }
2038
- })), Xe = /* @__PURE__ */ Le(((e) => {
2041
+ })), et = /* @__PURE__ */ Ve(((e) => {
2039
2042
  e.read = function(e, t, n, r, i) {
2040
2043
  var a, o, s = i * 8 - r - 1, c = (1 << s) - 1, l = c >> 1, u = -7, d = n ? i - 1 : 0, f = n ? -1 : 1, p = e[t + d];
2041
2044
  for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
@@ -2050,8 +2053,8 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2050
2053
  for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
2051
2054
  e[n + p - m] |= h * 128;
2052
2055
  };
2053
- })), Ze = /* @__PURE__ */ Le(((e) => {
2054
- var t = Ye(), n = Xe(), r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
2056
+ })), tt = /* @__PURE__ */ Ve(((e) => {
2057
+ var t = $e(), n = et(), r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
2055
2058
  e.Buffer = s, e.SlowBuffer = v, e.INSPECT_MAX_BYTES = 50;
2056
2059
  var i = 2147483647;
2057
2060
  e.kMaxLength = i, s.TYPED_ARRAY_SUPPORT = a(), !s.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
@@ -2093,7 +2096,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2093
2096
  if (typeof e == "string") return f(e, t);
2094
2097
  if (ArrayBuffer.isView(e)) return m(e);
2095
2098
  if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
2096
- if (H(e, ArrayBuffer) || e && H(e.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (H(e, SharedArrayBuffer) || e && H(e.buffer, SharedArrayBuffer))) return h(e, t, n);
2099
+ if (B(e, ArrayBuffer) || e && B(e.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (B(e, SharedArrayBuffer) || e && B(e.buffer, SharedArrayBuffer))) return h(e, t, n);
2097
2100
  if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
2098
2101
  let r = e.valueOf && e.valueOf();
2099
2102
  if (r != null && r !== e) return s.from(r, t, n);
@@ -2134,7 +2137,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2134
2137
  return n;
2135
2138
  }
2136
2139
  function m(e) {
2137
- if (H(e, Uint8Array)) {
2140
+ if (B(e, Uint8Array)) {
2138
2141
  let t = new Uint8Array(e);
2139
2142
  return h(t.buffer, t.byteOffset, t.byteLength);
2140
2143
  }
@@ -2151,7 +2154,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2151
2154
  let t = _(e.length) | 0, n = o(t);
2152
2155
  return n.length === 0 || e.copy(n, 0, 0, t), n;
2153
2156
  }
2154
- if (e.length !== void 0) return typeof e.length != "number" || ge(e.length) ? o(0) : p(e);
2157
+ if (e.length !== void 0) return typeof e.length != "number" || ve(e.length) ? o(0) : p(e);
2155
2158
  if (e.type === "Buffer" && Array.isArray(e.data)) return p(e.data);
2156
2159
  }
2157
2160
  function _(e) {
@@ -2164,7 +2167,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2164
2167
  s.isBuffer = function(e) {
2165
2168
  return e != null && e._isBuffer === !0 && e !== s.prototype;
2166
2169
  }, s.compare = function(e, t) {
2167
- if (H(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), H(t, Uint8Array) && (t = s.from(t, t.offset, t.byteLength)), !s.isBuffer(e) || !s.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
2170
+ if (B(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), B(t, Uint8Array) && (t = s.from(t, t.offset, t.byteLength)), !s.isBuffer(e) || !s.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
2168
2171
  if (e === t) return 0;
2169
2172
  let n = e.length, r = t.length;
2170
2173
  for (let i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
@@ -2195,7 +2198,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2195
2198
  let r = s.allocUnsafe(t), i = 0;
2196
2199
  for (n = 0; n < e.length; ++n) {
2197
2200
  let t = e[n];
2198
- if (H(t, Uint8Array)) i + t.length > r.length ? (s.isBuffer(t) || (t = s.from(t)), t.copy(r, i)) : Uint8Array.prototype.set.call(r, t, i);
2201
+ if (B(t, Uint8Array)) i + t.length > r.length ? (s.isBuffer(t) || (t = s.from(t)), t.copy(r, i)) : Uint8Array.prototype.set.call(r, t, i);
2199
2202
  else if (s.isBuffer(t)) t.copy(r, i);
2200
2203
  else throw TypeError("\"list\" argument must be an Array of Buffers");
2201
2204
  i += t.length;
@@ -2204,7 +2207,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2204
2207
  };
2205
2208
  function y(e, t) {
2206
2209
  if (s.isBuffer(e)) return e.length;
2207
- if (ArrayBuffer.isView(e) || H(e, ArrayBuffer)) return e.byteLength;
2210
+ if (ArrayBuffer.isView(e) || B(e, ArrayBuffer)) return e.byteLength;
2208
2211
  if (typeof e != "string") throw TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof e);
2209
2212
  let n = e.length, r = arguments.length > 2 && arguments[2] === !0;
2210
2213
  if (!r && n === 0) return 0;
@@ -2214,15 +2217,15 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2214
2217
  case "latin1":
2215
2218
  case "binary": return n;
2216
2219
  case "utf8":
2217
- case "utf-8": return pe(e).length;
2220
+ case "utf-8": return me(e).length;
2218
2221
  case "ucs2":
2219
2222
  case "ucs-2":
2220
2223
  case "utf16le":
2221
2224
  case "utf-16le": return n * 2;
2222
2225
  case "hex": return n >>> 1;
2223
- case "base64": return V(e).length;
2226
+ case "base64": return z(e).length;
2224
2227
  default:
2225
- if (i) return r ? -1 : pe(e).length;
2228
+ if (i) return r ? -1 : me(e).length;
2226
2229
  t = ("" + t).toLowerCase(), i = !0;
2227
2230
  }
2228
2231
  }
@@ -2277,7 +2280,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2277
2280
  let t = "", n = e.INSPECT_MAX_BYTES;
2278
2281
  return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
2279
2282
  }, r && (s.prototype[r] = s.prototype.inspect), s.prototype.compare = function(e, t, n, r, i) {
2280
- if (H(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), !s.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
2283
+ if (B(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), !s.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
2281
2284
  if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
2282
2285
  if (r >= i && t >= n) return 0;
2283
2286
  if (r >= i) return -1;
@@ -2292,7 +2295,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2292
2295
  };
2293
2296
  function S(e, t, n, r, i) {
2294
2297
  if (e.length === 0) return -1;
2295
- if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, ge(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
2298
+ if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, ve(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
2296
2299
  if (i) return -1;
2297
2300
  n = e.length - 1;
2298
2301
  } else if (n < 0) if (i) n = 0;
@@ -2342,22 +2345,22 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2342
2345
  let o;
2343
2346
  for (o = 0; o < r; ++o) {
2344
2347
  let r = parseInt(t.substr(o * 2, 2), 16);
2345
- if (ge(r)) return o;
2348
+ if (ve(r)) return o;
2346
2349
  e[n + o] = r;
2347
2350
  }
2348
2351
  return o;
2349
2352
  }
2350
2353
  function T(e, t, n, r) {
2351
- return he(pe(t, e.length - n), e, n, r);
2354
+ return _e(me(t, e.length - n), e, n, r);
2352
2355
  }
2353
2356
  function E(e, t, n, r) {
2354
- return he(me(t), e, n, r);
2357
+ return _e(he(t), e, n, r);
2355
2358
  }
2356
2359
  function D(e, t, n, r) {
2357
- return he(V(t), e, n, r);
2360
+ return _e(z(t), e, n, r);
2358
2361
  }
2359
2362
  function O(e, t, n, r) {
2360
- return he(B(t, e.length - n), e, n, r);
2363
+ return _e(ge(t, e.length - n), e, n, r);
2361
2364
  }
2362
2365
  s.prototype.write = function(e, t, n, r) {
2363
2366
  if (t === void 0) r = "utf8", n = this.length, t = 0;
@@ -2441,7 +2444,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2441
2444
  let r = e.length;
2442
2445
  (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
2443
2446
  let i = "";
2444
- for (let r = t; r < n; ++r) i += _e[e[r]];
2447
+ for (let r = t; r < n; ++r) i += V[e[r]];
2445
2448
  return i;
2446
2449
  }
2447
2450
  function F(e, t, n) {
@@ -2479,16 +2482,16 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2479
2482
  return e >>>= 0, t || I(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
2480
2483
  }, s.prototype.readUint32BE = s.prototype.readUInt32BE = function(e, t) {
2481
2484
  return e >>>= 0, t || I(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
2482
- }, s.prototype.readBigUInt64LE = ve(function(e) {
2483
- e >>>= 0, le(e, "offset");
2485
+ }, s.prototype.readBigUInt64LE = ye(function(e) {
2486
+ e >>>= 0, ue(e, "offset");
2484
2487
  let t = this[e], n = this[e + 7];
2485
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
2488
+ (t === void 0 || n === void 0) && de(e, this.length - 8);
2486
2489
  let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
2487
2490
  return BigInt(r) + (BigInt(i) << BigInt(32));
2488
- }), s.prototype.readBigUInt64BE = ve(function(e) {
2489
- e >>>= 0, le(e, "offset");
2491
+ }), s.prototype.readBigUInt64BE = ye(function(e) {
2492
+ e >>>= 0, ue(e, "offset");
2490
2493
  let t = this[e], n = this[e + 7];
2491
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
2494
+ (t === void 0 || n === void 0) && de(e, this.length - 8);
2492
2495
  let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
2493
2496
  return (BigInt(r) << BigInt(32)) + BigInt(i);
2494
2497
  }), s.prototype.readIntLE = function(e, t, n) {
@@ -2515,16 +2518,16 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2515
2518
  return e >>>= 0, t || I(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
2516
2519
  }, s.prototype.readInt32BE = function(e, t) {
2517
2520
  return e >>>= 0, t || I(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
2518
- }, s.prototype.readBigInt64LE = ve(function(e) {
2519
- e >>>= 0, le(e, "offset");
2521
+ }, s.prototype.readBigInt64LE = ye(function(e) {
2522
+ e >>>= 0, ue(e, "offset");
2520
2523
  let t = this[e], n = this[e + 7];
2521
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
2524
+ (t === void 0 || n === void 0) && de(e, this.length - 8);
2522
2525
  let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
2523
2526
  return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
2524
- }), s.prototype.readBigInt64BE = ve(function(e) {
2525
- e >>>= 0, le(e, "offset");
2527
+ }), s.prototype.readBigInt64BE = ye(function(e) {
2528
+ e >>>= 0, ue(e, "offset");
2526
2529
  let t = this[e], n = this[e + 7];
2527
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
2530
+ (t === void 0 || n === void 0) && de(e, this.length - 8);
2528
2531
  let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
2529
2532
  return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
2530
2533
  }), s.prototype.readFloatLE = function(e, t) {
@@ -2569,23 +2572,23 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2569
2572
  return e = +e, t >>>= 0, n || L(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
2570
2573
  };
2571
2574
  function te(e, t, n, r, i) {
2572
- ce(t, r, i, e, n, 7);
2575
+ le(t, r, i, e, n, 7);
2573
2576
  let a = Number(t & BigInt(4294967295));
2574
2577
  e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
2575
2578
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
2576
2579
  return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
2577
2580
  }
2578
- function R(e, t, n, r, i) {
2579
- ce(t, r, i, e, n, 7);
2581
+ function ne(e, t, n, r, i) {
2582
+ le(t, r, i, e, n, 7);
2580
2583
  let a = Number(t & BigInt(4294967295));
2581
2584
  e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
2582
2585
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
2583
2586
  return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
2584
2587
  }
2585
- s.prototype.writeBigUInt64LE = ve(function(e, t = 0) {
2588
+ s.prototype.writeBigUInt64LE = ye(function(e, t = 0) {
2586
2589
  return te(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
2587
- }), s.prototype.writeBigUInt64BE = ve(function(e, t = 0) {
2588
- return R(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
2590
+ }), s.prototype.writeBigUInt64BE = ye(function(e, t = 0) {
2591
+ return ne(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
2589
2592
  }), s.prototype.writeIntLE = function(e, t, n, r) {
2590
2593
  if (e = +e, t >>>= 0, !r) {
2591
2594
  let r = 2 ** (8 * n - 1);
@@ -2612,29 +2615,29 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2612
2615
  return e = +e, t >>>= 0, n || L(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
2613
2616
  }, s.prototype.writeInt32BE = function(e, t, n) {
2614
2617
  return e = +e, t >>>= 0, n || L(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
2615
- }, s.prototype.writeBigInt64LE = ve(function(e, t = 0) {
2618
+ }, s.prototype.writeBigInt64LE = ye(function(e, t = 0) {
2616
2619
  return te(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
2617
- }), s.prototype.writeBigInt64BE = ve(function(e, t = 0) {
2618
- return R(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
2620
+ }), s.prototype.writeBigInt64BE = ye(function(e, t = 0) {
2621
+ return ne(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
2619
2622
  });
2620
- function z(e, t, n, r, i, a) {
2623
+ function re(e, t, n, r, i, a) {
2621
2624
  if (n + r > e.length || n < 0) throw RangeError("Index out of range");
2622
2625
  }
2623
- function ne(e, t, r, i, a) {
2624
- return t = +t, r >>>= 0, a || z(e, t, r, 4, 34028234663852886e22, -34028234663852886e22), n.write(e, t, r, i, 23, 4), r + 4;
2626
+ function R(e, t, r, i, a) {
2627
+ return t = +t, r >>>= 0, a || re(e, t, r, 4, 34028234663852886e22, -34028234663852886e22), n.write(e, t, r, i, 23, 4), r + 4;
2625
2628
  }
2626
2629
  s.prototype.writeFloatLE = function(e, t, n) {
2627
- return ne(this, e, t, !0, n);
2630
+ return R(this, e, t, !0, n);
2628
2631
  }, s.prototype.writeFloatBE = function(e, t, n) {
2629
- return ne(this, e, t, !1, n);
2632
+ return R(this, e, t, !1, n);
2630
2633
  };
2631
- function re(e, t, r, i, a) {
2632
- return t = +t, r >>>= 0, a || z(e, t, r, 8, 17976931348623157e292, -17976931348623157e292), n.write(e, t, r, i, 52, 8), r + 8;
2634
+ function ie(e, t, r, i, a) {
2635
+ return t = +t, r >>>= 0, a || re(e, t, r, 8, 17976931348623157e292, -17976931348623157e292), n.write(e, t, r, i, 52, 8), r + 8;
2633
2636
  }
2634
2637
  s.prototype.writeDoubleLE = function(e, t, n) {
2635
- return re(this, e, t, !0, n);
2638
+ return ie(this, e, t, !0, n);
2636
2639
  }, s.prototype.writeDoubleBE = function(e, t, n) {
2637
- return re(this, e, t, !1, n);
2640
+ return ie(this, e, t, !1, n);
2638
2641
  }, s.prototype.copy = function(e, t, n, r) {
2639
2642
  if (!s.isBuffer(e)) throw TypeError("argument should be a Buffer");
2640
2643
  if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
@@ -2665,9 +2668,9 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2665
2668
  }
2666
2669
  return this;
2667
2670
  };
2668
- var ie = {};
2669
- function ae(e, t, n) {
2670
- ie[e] = class extends n {
2671
+ var ae = {};
2672
+ function oe(e, t, n) {
2673
+ ae[e] = class extends n {
2671
2674
  constructor() {
2672
2675
  super(), Object.defineProperty(this, "message", {
2673
2676
  value: t.apply(this, arguments),
@@ -2691,42 +2694,42 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2691
2694
  }
2692
2695
  };
2693
2696
  }
2694
- ae("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
2697
+ oe("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
2695
2698
  return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
2696
- }, RangeError), ae("ERR_INVALID_ARG_TYPE", function(e, t) {
2699
+ }, RangeError), oe("ERR_INVALID_ARG_TYPE", function(e, t) {
2697
2700
  return `The "${e}" argument must be of type number. Received type ${typeof t}`;
2698
- }, TypeError), ae("ERR_OUT_OF_RANGE", function(e, t, n) {
2701
+ }, TypeError), oe("ERR_OUT_OF_RANGE", function(e, t, n) {
2699
2702
  let r = `The value of "${e}" is out of range.`, i = n;
2700
- return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = oe(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = oe(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
2703
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = se(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = se(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
2701
2704
  }, RangeError);
2702
- function oe(e) {
2705
+ function se(e) {
2703
2706
  let t = "", n = e.length, r = +(e[0] === "-");
2704
2707
  for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
2705
2708
  return `${e.slice(0, n)}${t}`;
2706
2709
  }
2707
- function se(e, t, n) {
2708
- le(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && ue(t, e.length - (n + 1));
2710
+ function ce(e, t, n) {
2711
+ ue(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && de(t, e.length - (n + 1));
2709
2712
  }
2710
- function ce(e, t, n, r, i, a) {
2713
+ function le(e, t, n, r, i, a) {
2711
2714
  if (e > n || e < t) {
2712
2715
  let r = typeof t == "bigint" ? "n" : "", i;
2713
- throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new ie.ERR_OUT_OF_RANGE("value", i, e);
2716
+ throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new ae.ERR_OUT_OF_RANGE("value", i, e);
2714
2717
  }
2715
- se(r, i, a);
2718
+ ce(r, i, a);
2716
2719
  }
2717
- function le(e, t) {
2718
- if (typeof e != "number") throw new ie.ERR_INVALID_ARG_TYPE(t, "number", e);
2720
+ function ue(e, t) {
2721
+ if (typeof e != "number") throw new ae.ERR_INVALID_ARG_TYPE(t, "number", e);
2719
2722
  }
2720
- function ue(e, t, n) {
2721
- throw Math.floor(e) === e ? t < 0 ? new ie.ERR_BUFFER_OUT_OF_BOUNDS() : new ie.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (le(e, n), new ie.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
2723
+ function de(e, t, n) {
2724
+ throw Math.floor(e) === e ? t < 0 ? new ae.ERR_BUFFER_OUT_OF_BOUNDS() : new ae.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (ue(e, n), new ae.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
2722
2725
  }
2723
- var de = /[^+/0-9A-Za-z-_]/g;
2724
- function fe(e) {
2725
- if (e = e.split("=")[0], e = e.trim().replace(de, ""), e.length < 2) return "";
2726
+ var fe = /[^+/0-9A-Za-z-_]/g;
2727
+ function pe(e) {
2728
+ if (e = e.split("=")[0], e = e.trim().replace(fe, ""), e.length < 2) return "";
2726
2729
  for (; e.length % 4 != 0;) e += "=";
2727
2730
  return e;
2728
2731
  }
2729
- function pe(e, t) {
2732
+ function me(e, t) {
2730
2733
  t ||= Infinity;
2731
2734
  let n, r = e.length, i = null, a = [];
2732
2735
  for (let o = 0; o < r; ++o) {
@@ -2764,31 +2767,31 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2764
2767
  }
2765
2768
  return a;
2766
2769
  }
2767
- function me(e) {
2770
+ function he(e) {
2768
2771
  let t = [];
2769
2772
  for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
2770
2773
  return t;
2771
2774
  }
2772
- function B(e, t) {
2775
+ function ge(e, t) {
2773
2776
  let n, r, i, a = [];
2774
2777
  for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
2775
2778
  return a;
2776
2779
  }
2777
- function V(e) {
2778
- return t.toByteArray(fe(e));
2780
+ function z(e) {
2781
+ return t.toByteArray(pe(e));
2779
2782
  }
2780
- function he(e, t, n, r) {
2783
+ function _e(e, t, n, r) {
2781
2784
  let i;
2782
2785
  for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
2783
2786
  return i;
2784
2787
  }
2785
- function H(e, t) {
2788
+ function B(e, t) {
2786
2789
  return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
2787
2790
  }
2788
- function ge(e) {
2791
+ function ve(e) {
2789
2792
  return e !== e;
2790
2793
  }
2791
- var _e = (function() {
2794
+ var V = (function() {
2792
2795
  let e = "0123456789abcdef", t = Array(256);
2793
2796
  for (let n = 0; n < 16; ++n) {
2794
2797
  let r = n * 16;
@@ -2796,13 +2799,13 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2796
2799
  }
2797
2800
  return t;
2798
2801
  })();
2799
- function ve(e) {
2800
- return typeof BigInt > "u" ? U : e;
2802
+ function ye(e) {
2803
+ return typeof BigInt > "u" ? be : e;
2801
2804
  }
2802
- function U() {
2805
+ function be() {
2803
2806
  throw Error("BigInt not supported");
2804
2807
  }
2805
- })), Qe = Je(), $e = Ze(), et = class e {
2808
+ })), nt = Qe(), rt = tt(), it = class e {
2806
2809
  constructor(t, n = "", r = "") {
2807
2810
  this.xml = t, this.filePath = n, this.basePath = r, this.layers = /* @__PURE__ */ new Map(), this.transform = (t) => {
2808
2811
  if (!t) return;
@@ -2884,7 +2887,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2884
2887
  return e ? Array.isArray(e) ? e : [e] : [];
2885
2888
  }
2886
2889
  getImagePath(e) {
2887
- return this.filePath.startsWith("http") ? new URL(e, this.filePath).href : ze(this.basePath, e);
2890
+ return this.filePath.startsWith("http") ? new URL(e, this.filePath).href : Ue(this.basePath, e);
2888
2891
  }
2889
2892
  isTilesetSource(e) {
2890
2893
  return e.firstgid !== void 0 || e.tilewidth !== void 0 || e.tileheight !== void 0 || e.tilecount !== void 0 || e.columns !== void 0;
@@ -2898,10 +2901,10 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2898
2901
  }
2899
2902
  static decode(t, n) {
2900
2903
  let { encoding: r, data: i } = t;
2901
- return r == "base64" ? e.unpackTileBytes($e.Buffer.from(i.trim(), "base64"), n) : r == "csv" ? i.trim().split(",").map((e) => +e) : i;
2904
+ return r == "base64" ? e.unpackTileBytes(rt.Buffer.from(i.trim(), "base64"), n) : r == "csv" ? i.trim().split(",").map((e) => +e) : i;
2902
2905
  }
2903
2906
  parseMap() {
2904
- let t = (0, Qe.xml2js)(this.xml, { compact: !0 }), n = (0, Qe.xml2js)(this.xml), r = t.map.tileset;
2907
+ let t = (0, nt.xml2js)(this.xml, { compact: !0 }), n = (0, nt.xml2js)(this.xml), r = t.map.tileset;
2905
2908
  t.map.group;
2906
2909
  let i = (t) => {
2907
2910
  let { objectgroup: n, group: r, layer: a, imagelayer: o } = t, s = (t) => {
@@ -2944,7 +2947,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2944
2947
  return delete c.layer, delete c.tileset, delete c.group, delete c.imagelayer, c;
2945
2948
  }
2946
2949
  parseTileset() {
2947
- let { tileset: t } = (0, Qe.xml2js)(this.xml, { compact: !0 }), n = {
2950
+ let { tileset: t } = (0, nt.xml2js)(this.xml, { compact: !0 }), n = {
2948
2951
  ...this.transform(t),
2949
2952
  image: this.transform(t.image),
2950
2953
  tiles: e.toArray(t.tile).map((t) => {
@@ -2954,7 +2957,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2954
2957
  };
2955
2958
  return delete n.tile, n;
2956
2959
  }
2957
- }, tt = class {
2960
+ }, at = class {
2958
2961
  constructor(e) {
2959
2962
  this.properties = {}, this.properties = e?.properties ?? {};
2960
2963
  }
@@ -2971,7 +2974,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2971
2974
  getType() {
2972
2975
  return this.class || this.type;
2973
2976
  }
2974
- }, nt = 2147483648, rt = 1073741824, it = 536870912, at = 268435456, ot = class e extends tt {
2977
+ }, ot = 2147483648, st = 1073741824, ct = 536870912, lt = 268435456, ut = class e extends at {
2975
2978
  constructor(e) {
2976
2979
  super(e), this.obj = e, this._gid = e?.gid;
2977
2980
  }
@@ -2979,16 +2982,16 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2979
2982
  return e & 268435455;
2980
2983
  }
2981
2984
  get horizontalFlip() {
2982
- return !!(this._gid & nt);
2985
+ return !!(this._gid & ot);
2983
2986
  }
2984
2987
  get verticalFlip() {
2985
- return !!(this._gid & rt);
2988
+ return !!(this._gid & st);
2986
2989
  }
2987
2990
  get diagonalFlip() {
2988
- return !!(this._gid & it);
2991
+ return !!(this._gid & ct);
2989
2992
  }
2990
2993
  get rotatedHex120() {
2991
- return !!(this._gid & at);
2994
+ return !!(this._gid & lt);
2992
2995
  }
2993
2996
  get gid() {
2994
2997
  return e.getRealGid(this._gid);
@@ -2996,7 +2999,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
2996
2999
  set gid(e) {
2997
3000
  this._gid = e;
2998
3001
  }
2999
- }, st = class extends ot {
3002
+ }, dt = class extends ut {
3000
3003
  constructor(e) {
3001
3004
  super(e), this.tile = e;
3002
3005
  let t = this.properties;
@@ -3005,11 +3008,11 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3005
3008
  ...this.properties
3006
3009
  });
3007
3010
  }
3008
- }, ct = class extends ot {
3011
+ }, ft = class extends ut {
3009
3012
  constructor(e) {
3010
3013
  super(e), this.layerName = "", Object.assign(this, e), e?.gid && (this.y -= this.height);
3011
3014
  }
3012
- }, lt = class e extends tt {
3015
+ }, pt = class e extends at {
3013
3016
  get size() {
3014
3017
  return this.data.length;
3015
3018
  }
@@ -3018,15 +3021,15 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3018
3021
  }
3019
3022
  createTile(t, n, r) {
3020
3023
  if (t == 0) return;
3021
- let i = ot.getRealGid(t), a = e.findTileSet(i, this.tilesets);
3024
+ let i = ut.getRealGid(t), a = e.findTileSet(i, this.tilesets);
3022
3025
  if (!a) return;
3023
3026
  let o = a.getTile(i - a.firstgid);
3024
- return o ? new st({
3027
+ return o ? new dt({
3025
3028
  ...o.tile,
3026
3029
  gid: t,
3027
3030
  index: n,
3028
3031
  layerIndex: r
3029
- }) : new st({
3032
+ }) : new dt({
3030
3033
  gid: t,
3031
3034
  index: n,
3032
3035
  layerIndex: r
@@ -3054,7 +3057,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3054
3057
  }
3055
3058
  mapObjects() {
3056
3059
  this.objects &&= this.objects.map((e) => {
3057
- let t = new ct(e);
3060
+ let t = new ft(e);
3058
3061
  return t.layerName = this.name, t;
3059
3062
  });
3060
3063
  }
@@ -3081,7 +3084,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3081
3084
  setData(e, t) {
3082
3085
  this.data[e] = t;
3083
3086
  }
3084
- }, ut = class extends tt {
3087
+ }, mt = class extends at {
3085
3088
  constructor(e) {
3086
3089
  super(e), this.tileset = e, this.cacheTileId = /* @__PURE__ */ new Map(), Object.assign(this, e), this.margin = this.margin ?? 0, this.spacing = this.spacing ?? 0;
3087
3090
  let t = e.tiles || e.tile || [];
@@ -3089,13 +3092,13 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3089
3092
  Reflect.deleteProperty(this, "tiles"), Reflect.deleteProperty(this, "tile");
3090
3093
  }
3091
3094
  addTile(e) {
3092
- let t = new st(e);
3095
+ let t = new dt(e);
3093
3096
  return this.cacheTileId.set(t.id, t), t;
3094
3097
  }
3095
3098
  getTile(e) {
3096
3099
  return this.cacheTileId.get(+e);
3097
3100
  }
3098
- }, dt = class e {
3101
+ }, ht = class e {
3099
3102
  constructor(e, { basePath: t = "", staticDir: n = "", relativePath: r = "" } = {}) {
3100
3103
  this.file = e, this.basePath = t;
3101
3104
  }
@@ -3118,7 +3121,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3118
3121
  let i = (t) => e.typeOfFile(t).isXml, a = (e) => {
3119
3122
  if (!e) return r(null);
3120
3123
  if (i(e)) {
3121
- let i = new et(e, t, this.basePath);
3124
+ let i = new it(e, t, this.basePath);
3122
3125
  if (n == "map") return r(i.parseMap());
3123
3126
  if (n == "tileset") return r(i.parseTileset());
3124
3127
  }
@@ -3128,7 +3131,7 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3128
3131
  let { isHttp: o } = e.typeOfFile(t);
3129
3132
  if (i(t)) a(t);
3130
3133
  else if (o || e.isBrowser()) {
3131
- let n = o ? t : ze(this.basePath, t);
3134
+ let n = o ? t : Ue(this.basePath, t);
3132
3135
  e.isBrowser() && window.urlCache && (n = window.urlCache[t]), fetch(n, { headers: { "Content-Type": "application/xml" } }).then((e) => e.text()).then(a).catch((e) => r(null, e));
3133
3136
  }
3134
3137
  }
@@ -3165,16 +3168,16 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3165
3168
  }, e);
3166
3169
  });
3167
3170
  }
3168
- }, ft = {
3171
+ }, gt = {
3169
3172
  TEXTURES_PER_TILEMAP: 16,
3170
3173
  TEXTILE_SCALE_MODE: "linear",
3171
3174
  use32bitIndex: !1
3172
- }, pt = Object.defineProperty, mt = (e, t, n) => t in e ? pt(e, t, {
3175
+ }, _t = Object.defineProperty, vt = (e, t, n) => t in e ? _t(e, t, {
3173
3176
  enumerable: !0,
3174
3177
  configurable: !0,
3175
3178
  writable: !0,
3176
3179
  value: n
3177
- }) : e[t] = n, ht = (e, t, n) => (mt(e, typeof t == "symbol" ? t : t + "", n), n), gt = class e extends E {
3180
+ }) : e[t] = n, yt = (e, t, n) => (vt(e, typeof t == "symbol" ? t : t + "", n), n), bt = class e extends E {
3178
3181
  constructor(t) {
3179
3182
  let n = new x({
3180
3183
  data: new Float32Array(2),
@@ -3228,18 +3231,18 @@ var Be = /* @__PURE__ */ Le(((e, t) => {
3228
3231
  offset: 48
3229
3232
  }
3230
3233
  }
3231
- }), ht(this, "lastTimeAccess", 0), ht(this, "vertSize", e.vertSize), ht(this, "vertPerQuad", e.vertPerQuad), ht(this, "stride", e.stride), ht(this, "buf"), this.buf = n;
3234
+ }), yt(this, "lastTimeAccess", 0), yt(this, "vertSize", e.vertSize), yt(this, "vertPerQuad", e.vertPerQuad), yt(this, "stride", e.stride), yt(this, "buf"), this.buf = n;
3232
3235
  }
3233
3236
  };
3234
- ht(gt, "vertSize", 13), ht(gt, "vertPerQuad", 4), ht(gt, "stride", gt.vertSize * 4);
3235
- var _t = gt, vt = Object.defineProperty, yt = (e, t, n) => t in e ? vt(e, t, {
3237
+ yt(bt, "vertSize", 13), yt(bt, "vertPerQuad", 4), yt(bt, "stride", bt.vertSize * 4);
3238
+ var xt = bt, St = Object.defineProperty, Ct = (e, t, n) => t in e ? St(e, t, {
3236
3239
  enumerable: !0,
3237
3240
  configurable: !0,
3238
3241
  writable: !0,
3239
3242
  value: n
3240
- }) : e[t] = n, bt = (e, t, n) => (yt(e, typeof t == "symbol" ? t : t + "", n), n), xt = class {
3243
+ }) : e[t] = n, wt = (e, t, n) => (Ct(e, typeof t == "symbol" ? t : t + "", n), n), Tt = class {
3241
3244
  constructor() {
3242
- bt(this, "pipe_uniforms", new L({
3245
+ wt(this, "pipe_uniforms", new te({
3243
3246
  u_proj_trans: {
3244
3247
  value: new A(),
3245
3248
  type: "mat3x3<f32>"
@@ -3250,9 +3253,9 @@ var _t = gt, vt = Object.defineProperty, yt = (e, t, n) => t in e ? vt(e, t, {
3250
3253
  }
3251
3254
  }));
3252
3255
  }
3253
- }, St = class {
3256
+ }, Et = class {
3254
3257
  constructor(e, t) {
3255
- bt(this, "renderer"), bt(this, "tileAnim", [0, 0]), bt(this, "ibLen", 0), bt(this, "indexBuffer", null), bt(this, "shader"), bt(this, "adaptor"), this.renderer = e, this.adaptor = t, this.adaptor.init(), this.indexBuffer = new x({
3258
+ wt(this, "renderer"), wt(this, "tileAnim", [0, 0]), wt(this, "ibLen", 0), wt(this, "indexBuffer", null), wt(this, "shader"), wt(this, "adaptor"), this.renderer = e, this.adaptor = t, this.adaptor.init(), this.indexBuffer = new x({
3256
3259
  data: new Uint16Array([
3257
3260
  0,
3258
3261
  1,
@@ -3267,7 +3270,7 @@ var _t = gt, vt = Object.defineProperty, yt = (e, t, n) => t in e ? vt(e, t, {
3267
3270
  }
3268
3271
  start() {}
3269
3272
  createVb() {
3270
- let e = new _t(this.indexBuffer);
3273
+ let e = new xt(this.indexBuffer);
3271
3274
  return e.lastTimeAccess = Date.now(), e;
3272
3275
  }
3273
3276
  getShader() {
@@ -3278,7 +3281,7 @@ var _t = gt, vt = Object.defineProperty, yt = (e, t, n) => t in e ? vt(e, t, {
3278
3281
  }
3279
3282
  checkIndexBuffer(e) {
3280
3283
  let t = e * 6;
3281
- t <= this.ibLen || (this.ibLen = t, this.indexBuffer.data = Ct(e, ft.use32bitIndex ? new Uint32Array(t) : new Uint16Array(t)));
3284
+ t <= this.ibLen || (this.ibLen = t, this.indexBuffer.data = Dt(e, gt.use32bitIndex ? new Uint32Array(t) : new Uint16Array(t)));
3282
3285
  }
3283
3286
  destroyRenderable(e) {
3284
3287
  e.vb.destroy(!0), e.vb = null;
@@ -3300,11 +3303,11 @@ var _t = gt, vt = Object.defineProperty, yt = (e, t, n) => t in e ? vt(e, t, {
3300
3303
  r.uProjectionMatrix.copyTo(n).append(r.uWorldTransformMatrix).append(e.worldTransform), e.compositeParent && (i = e.parent.tileAnim || i), a[0] = i[0], a[1] = i[1], t.update(), this.adaptor.execute(this, e);
3301
3304
  }
3302
3305
  };
3303
- bt(St, "extension", {
3306
+ wt(Et, "extension", {
3304
3307
  type: [w.WebGLPipes, w.WebGPUPipes],
3305
3308
  name: "tilemap"
3306
3309
  });
3307
- function Ct(e, t) {
3310
+ function Dt(e, t) {
3308
3311
  let n = e * 6;
3309
3312
  if (t.length !== n) throw Error(`Out buffer length is incorrect, got ${t.length} and expected ${n}`);
3310
3313
  for (let e = 0, r = 0; e < n; e += 6, r += 4) t[e + 0] = r + 0, t[e + 1] = r + 1, t[e + 2] = r + 2, t[e + 3] = r + 0, t[e + 4] = r + 2, t[e + 5] = r + 3;
@@ -3312,19 +3315,19 @@ function Ct(e, t) {
3312
3315
  }
3313
3316
  //#endregion
3314
3317
  //#region ../../node_modules/.pnpm/@canvasengine+tilemap@5.0.1_pixi.js@8.9.2/node_modules/@canvasengine/tilemap/lib/TileTextureArray.mjs
3315
- var wt = Object.defineProperty, Tt = (e, t, n) => t in e ? wt(e, t, {
3318
+ var Ot = Object.defineProperty, kt = (e, t, n) => t in e ? Ot(e, t, {
3316
3319
  enumerable: !0,
3317
3320
  configurable: !0,
3318
3321
  writable: !0,
3319
3322
  value: n
3320
- }) : e[t] = n, Et = (e, t, n) => (Tt(e, typeof t == "symbol" ? t : t + "", n), n), Dt = class {
3323
+ }) : e[t] = n, At = (e, t, n) => (kt(e, typeof t == "symbol" ? t : t + "", n), n), jt = class {
3321
3324
  constructor(e) {
3322
- Et(this, "max_textures"), Et(this, "arr", []), Et(this, "count", 0), Et(this, "dirty", !1), Et(this, "dirty_gpu", !1), Et(this, "bind_group", null), Et(this, "bind_group_resources", {}), Et(this, "tex_sizes", null), Et(this, "null_color", new Float32Array([
3325
+ At(this, "max_textures"), At(this, "arr", []), At(this, "count", 0), At(this, "dirty", !1), At(this, "dirty_gpu", !1), At(this, "bind_group", null), At(this, "bind_group_resources", {}), At(this, "tex_sizes", null), At(this, "null_color", new Float32Array([
3323
3326
  0,
3324
3327
  0,
3325
3328
  0,
3326
3329
  .5
3327
- ])), Et(this, "tex_buf", null), this.max_textures = e, this.tex_sizes = new Float32Array(this.max_textures * 4 + 4), this.tex_buf = new x({ usage: S.UNIFORM | S.COPY_DST });
3330
+ ])), At(this, "tex_buf", null), this.max_textures = e, this.tex_sizes = new Float32Array(this.max_textures * 4 + 4), this.tex_buf = new x({ usage: S.UNIFORM | S.COPY_DST });
3328
3331
  }
3329
3332
  get length() {
3330
3333
  return this.count;
@@ -3351,7 +3354,7 @@ var wt = Object.defineProperty, Tt = (e, t, n) => t in e ? wt(e, t, {
3351
3354
  getBindGroup() {
3352
3355
  if (this.update(), !this.dirty_gpu) return this.bind_group;
3353
3356
  let { bind_group_resources: e, max_textures: t, arr: n, count: r } = this, i = 0;
3354
- e[i++] = new L({
3357
+ e[i++] = new te({
3355
3358
  u_texture_size: {
3356
3359
  value: this.tex_sizes,
3357
3360
  type: "vec4<f32>",
@@ -3400,14 +3403,14 @@ var wt = Object.defineProperty, Tt = (e, t, n) => t in e ? wt(e, t, {
3400
3403
  }
3401
3404
  };
3402
3405
  }
3403
- }, Ot = Object.defineProperty, kt = (e, t, n) => t in e ? Ot(e, t, {
3406
+ }, Mt = Object.defineProperty, Nt = (e, t, n) => t in e ? Mt(e, t, {
3404
3407
  enumerable: !0,
3405
3408
  configurable: !0,
3406
3409
  writable: !0,
3407
3410
  value: n
3408
- }) : e[t] = n, At = (e, t, n) => (kt(e, typeof t == "symbol" ? t : t + "", n), n), jt = "\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\nin vec4 aFrame;\nin vec2 aAnim;\nin float aAnimDivisor;\nin float aTextureId;\nin float aAlpha;\n\nuniform mat3 u_proj_trans;\nuniform vec2 u_anim_frame;\n\nout vec2 vTextureCoord;\nout float vTextureId;\nout vec4 vFrame;\nout float vAlpha;\n\nvoid main(void)\n{\n gl_Position = vec4((u_proj_trans * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 currentFrame = floor(u_anim_frame / aAnimDivisor);\n vec2 loop_num = floor((currentFrame + 0.5) / animCount);\n vec2 animOffset = animFrameOffset * floor(currentFrame - loop_num * animCount);\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n vAlpha = aAlpha;\n}\n", Mt = "\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nin vec2 vTextureCoord;\nin vec4 vFrame;\nin float vTextureId;\nin float vAlpha;\n\n//include_textures\n\nvoid main(void)\n{\n float textureId = floor(vTextureId + 0.5);\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n vec4 color = sampleMultiTexture(textureId, textureCoord);\n finalColor = color * vAlpha;\n}\n", Nt = class extends xt {
3411
+ }) : e[t] = n, Pt = (e, t, n) => (Nt(e, typeof t == "symbol" ? t : t + "", n), n), Ft = "\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\nin vec4 aFrame;\nin vec2 aAnim;\nin float aAnimDivisor;\nin float aTextureId;\nin float aAlpha;\n\nuniform mat3 u_proj_trans;\nuniform vec2 u_anim_frame;\n\nout vec2 vTextureCoord;\nout float vTextureId;\nout vec4 vFrame;\nout float vAlpha;\n\nvoid main(void)\n{\n gl_Position = vec4((u_proj_trans * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 currentFrame = floor(u_anim_frame / aAnimDivisor);\n vec2 loop_num = floor((currentFrame + 0.5) / animCount);\n vec2 animOffset = animFrameOffset * floor(currentFrame - loop_num * animCount);\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n vAlpha = aAlpha;\n}\n", It = "\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nin vec2 vTextureCoord;\nin vec4 vFrame;\nin float vTextureId;\nin float vAlpha;\n\n//include_textures\n\nvoid main(void)\n{\n float textureId = floor(vTextureId + 0.5);\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n vec4 color = sampleMultiTexture(textureId, textureCoord);\n finalColor = color * vAlpha;\n}\n", Lt = class extends Tt {
3409
3412
  constructor() {
3410
- super(...arguments), At(this, "_shader", null), At(this, "max_textures", ft.TEXTURES_PER_TILEMAP);
3413
+ super(...arguments), Pt(this, "_shader", null), Pt(this, "max_textures", gt.TEXTURES_PER_TILEMAP);
3411
3414
  }
3412
3415
  destroy() {
3413
3416
  this._shader.destroy(!0), this._shader = null;
@@ -3426,30 +3429,30 @@ var wt = Object.defineProperty, Tt = (e, t, n) => t in e ? wt(e, t, {
3426
3429
  init() {
3427
3430
  this._shader = new ee({
3428
3431
  glProgram: D.from({
3429
- vertex: jt,
3430
- fragment: Mt.replace("//include_textures", Dt.generate_gl_textures(this.max_textures))
3432
+ vertex: Ft,
3433
+ fragment: It.replace("//include_textures", jt.generate_gl_textures(this.max_textures))
3431
3434
  }),
3432
3435
  resources: {
3433
- texture_uniforms: new L(Dt.gl_gen_resources(this.max_textures), { isStatic: !0 }),
3436
+ texture_uniforms: new te(jt.gl_gen_resources(this.max_textures), { isStatic: !0 }),
3434
3437
  pipe_uniforms: this.pipe_uniforms.uniformStructures
3435
3438
  }
3436
3439
  });
3437
3440
  }
3438
3441
  };
3439
- At(Nt, "extension", {
3442
+ Pt(Lt, "extension", {
3440
3443
  type: [w.WebGLPipesAdaptor],
3441
3444
  name: "tilemap"
3442
3445
  });
3443
3446
  //#endregion
3444
3447
  //#region ../../node_modules/.pnpm/@canvasengine+tilemap@5.0.1_pixi.js@8.9.2/node_modules/@canvasengine/tilemap/lib/gpu_tilemap.mjs
3445
- var Pt = Object.defineProperty, Ft = (e, t, n) => t in e ? Pt(e, t, {
3448
+ var Rt = Object.defineProperty, zt = (e, t, n) => t in e ? Rt(e, t, {
3446
3449
  enumerable: !0,
3447
3450
  configurable: !0,
3448
3451
  writable: !0,
3449
3452
  value: n
3450
- }) : e[t] = n, It = (e, t, n) => (Ft(e, typeof t == "symbol" ? t : t + "", n), n), Lt = "\nstruct GlobalUniforms {\n uProjectionMatrix:mat3x3f,\n uWorldTransformMatrix:mat3x3f,\n uWorldColorAlpha: vec4f,\n uResolution: vec2f,\n}\n\nstruct TilemapUniforms {\n u_proj_trans:mat3x3f,\n u_anim_frame:vec2f\n}\n\n@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n@group(2) @binding(0) var<uniform> loc: TilemapUniforms;\n\nstruct VSOutput {\n @builtin(position) vPosition: vec4f,\n @location(0) @interpolate(flat) vTextureId : i32,\n @location(1) vTextureCoord : vec2f,\n @location(2) @interpolate(flat) vFrame : vec4f,\n @location(3) vAlpha : f32\n};\n\n@vertex\nfn mainVert(\n @location(6) aVertexPosition: vec2f,\n @location(4) aTextureCoord: vec2f,\n @location(3) aFrame: vec4f,\n @location(1) aAnim: vec2f,\n @location(2) aAnimDivisor: f32,\n @location(5) aTextureId: i32,\n @location(0) aAlpha: f32,\n ) -> VSOutput {\n\n var vPosition = vec4((loc.u_proj_trans * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n var animCount = floor((aAnim + 0.5) / 2048.0);\n var animFrameOffset = aAnim - animCount * 2048.0;\n var currentFrame = floor(loc.u_anim_frame / aAnimDivisor);\n var loop_num = floor((currentFrame + 0.5) / animCount);\n var animOffset = animFrameOffset * floor(currentFrame - loop_num * animCount);\n var vTextureCoord = aTextureCoord + animOffset;\n var vFrame = aFrame + vec4(animOffset, animOffset);\n\n return VSOutput(vPosition, aTextureId, vTextureCoord, vFrame, aAlpha);\n};\n", Rt = "\n//include_textures\n\n@fragment\nfn mainFrag(\n @location(0) @interpolate(flat) vTextureId : i32,\n @location(1) vTextureCoord : vec2f,\n @location(2) @interpolate(flat) vFrame : vec4f,\n @location(3) vAlpha : f32,\n ) -> @location(0) vec4f {\n var textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n var uv = textureCoord * taf.u_texture_size[vTextureId].zw;\n var dx = dpdx(uv);\n var dy = dpdy(uv);\n var color = sampleMultiTexture(vTextureId, uv, dx, dy);\n return color * vAlpha;\n};\n", zt = class extends xt {
3453
+ }) : e[t] = n, Bt = (e, t, n) => (zt(e, typeof t == "symbol" ? t : t + "", n), n), Vt = "\nstruct GlobalUniforms {\n uProjectionMatrix:mat3x3f,\n uWorldTransformMatrix:mat3x3f,\n uWorldColorAlpha: vec4f,\n uResolution: vec2f,\n}\n\nstruct TilemapUniforms {\n u_proj_trans:mat3x3f,\n u_anim_frame:vec2f\n}\n\n@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n@group(2) @binding(0) var<uniform> loc: TilemapUniforms;\n\nstruct VSOutput {\n @builtin(position) vPosition: vec4f,\n @location(0) @interpolate(flat) vTextureId : i32,\n @location(1) vTextureCoord : vec2f,\n @location(2) @interpolate(flat) vFrame : vec4f,\n @location(3) vAlpha : f32\n};\n\n@vertex\nfn mainVert(\n @location(6) aVertexPosition: vec2f,\n @location(4) aTextureCoord: vec2f,\n @location(3) aFrame: vec4f,\n @location(1) aAnim: vec2f,\n @location(2) aAnimDivisor: f32,\n @location(5) aTextureId: i32,\n @location(0) aAlpha: f32,\n ) -> VSOutput {\n\n var vPosition = vec4((loc.u_proj_trans * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n var animCount = floor((aAnim + 0.5) / 2048.0);\n var animFrameOffset = aAnim - animCount * 2048.0;\n var currentFrame = floor(loc.u_anim_frame / aAnimDivisor);\n var loop_num = floor((currentFrame + 0.5) / animCount);\n var animOffset = animFrameOffset * floor(currentFrame - loop_num * animCount);\n var vTextureCoord = aTextureCoord + animOffset;\n var vFrame = aFrame + vec4(animOffset, animOffset);\n\n return VSOutput(vPosition, aTextureId, vTextureCoord, vFrame, aAlpha);\n};\n", Ht = "\n//include_textures\n\n@fragment\nfn mainFrag(\n @location(0) @interpolate(flat) vTextureId : i32,\n @location(1) vTextureCoord : vec2f,\n @location(2) @interpolate(flat) vFrame : vec4f,\n @location(3) vAlpha : f32,\n ) -> @location(0) vec4f {\n var textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n var uv = textureCoord * taf.u_texture_size[vTextureId].zw;\n var dx = dpdx(uv);\n var dy = dpdy(uv);\n var color = sampleMultiTexture(vTextureId, uv, dx, dy);\n return color * vAlpha;\n};\n", Ut = class extends Tt {
3451
3454
  constructor() {
3452
- super(...arguments), It(this, "_shader", null), It(this, "max_textures", ft.TEXTURES_PER_TILEMAP), It(this, "bind_group", null);
3455
+ super(...arguments), Bt(this, "_shader", null), Bt(this, "max_textures", gt.TEXTURES_PER_TILEMAP), Bt(this, "bind_group", null);
3453
3456
  }
3454
3457
  destroy() {
3455
3458
  this._shader.destroy(!0), this._shader = null;
@@ -3466,35 +3469,35 @@ var Pt = Object.defineProperty, Ft = (e, t, n) => t in e ? Pt(e, t, {
3466
3469
  init() {
3467
3470
  this._shader = new ee({ gpuProgram: O.from({
3468
3471
  vertex: {
3469
- source: Lt,
3472
+ source: Vt,
3470
3473
  entryPoint: "mainVert"
3471
3474
  },
3472
- fragment: { source: Rt.replace("//include_textures", Dt.generate_gpu_textures(this.max_textures)) }
3475
+ fragment: { source: Ht.replace("//include_textures", jt.generate_gpu_textures(this.max_textures)) }
3473
3476
  }) }), this.bind_group = new v({ ut: this.pipe_uniforms });
3474
3477
  }
3475
3478
  };
3476
- It(zt, "extension", {
3479
+ Bt(Ut, "extension", {
3477
3480
  type: [w.WebGPUPipesAdaptor],
3478
3481
  name: "tilemap"
3479
3482
  });
3480
3483
  //#endregion
3481
3484
  //#region ../../node_modules/.pnpm/@canvasengine+tilemap@5.0.1_pixi.js@8.9.2/node_modules/@canvasengine/tilemap/lib/Tilemap.mjs
3482
- var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3485
+ var Wt = Object.defineProperty, Gt = (e, t, n) => t in e ? Wt(e, t, {
3483
3486
  enumerable: !0,
3484
3487
  configurable: !0,
3485
3488
  writable: !0,
3486
3489
  value: n
3487
- }) : e[t] = n, K = (e, t, n) => (Vt(e, typeof t == "symbol" ? t : t + "", n), n), Ht = /* @__PURE__ */ ((e) => (e[e.U = 0] = "U", e[e.V = 1] = "V", e[e.X = 2] = "X", e[e.Y = 3] = "Y", e[e.TILE_WIDTH = 4] = "TILE_WIDTH", e[e.TILE_HEIGHT = 5] = "TILE_HEIGHT", e[e.ROTATE = 6] = "ROTATE", e[e.ANIM_X = 7] = "ANIM_X", e[e.ANIM_Y = 8] = "ANIM_Y", e[e.TEXTURE_INDEX = 9] = "TEXTURE_INDEX", e[e.ANIM_COUNT_X = 10] = "ANIM_COUNT_X", e[e.ANIM_COUNT_Y = 11] = "ANIM_COUNT_Y", e[e.ANIM_DIVISOR = 12] = "ANIM_DIVISOR", e[e.ALPHA = 13] = "ALPHA", e))(Ht || {}), Ut = Object.keys(Ht).length / 2, Wt = class extends te {
3490
+ }) : e[t] = n, G = (e, t, n) => (Gt(e, typeof t == "symbol" ? t : t + "", n), n), Kt = /* @__PURE__ */ ((e) => (e[e.U = 0] = "U", e[e.V = 1] = "V", e[e.X = 2] = "X", e[e.Y = 3] = "Y", e[e.TILE_WIDTH = 4] = "TILE_WIDTH", e[e.TILE_HEIGHT = 5] = "TILE_HEIGHT", e[e.ROTATE = 6] = "ROTATE", e[e.ANIM_X = 7] = "ANIM_X", e[e.ANIM_Y = 8] = "ANIM_Y", e[e.TEXTURE_INDEX = 9] = "TEXTURE_INDEX", e[e.ANIM_COUNT_X = 10] = "ANIM_COUNT_X", e[e.ANIM_COUNT_Y = 11] = "ANIM_COUNT_Y", e[e.ANIM_DIVISOR = 12] = "ANIM_DIVISOR", e[e.ALPHA = 13] = "ALPHA", e))(Kt || {}), qt = Object.keys(Kt).length / 2, Jt = class extends ne {
3488
3491
  constructor(e) {
3489
- super({}), K(this, "shadowColor", new Float32Array([
3492
+ super({}), G(this, "shadowColor", new Float32Array([
3490
3493
  0,
3491
3494
  0,
3492
3495
  0,
3493
3496
  .5
3494
- ])), K(this, "state", P.for2d()), K(this, "is_valid", !1), K(this, "renderPipeId", "tilemap"), K(this, "canBundle", !0), K(this, "_instruction", {
3497
+ ])), G(this, "state", P.for2d()), G(this, "is_valid", !1), G(this, "renderPipeId", "tilemap"), G(this, "canBundle", !0), G(this, "_instruction", {
3495
3498
  renderPipeId: "tilemap",
3496
3499
  tilemap: this
3497
- }), K(this, "tileAnim", null), K(this, "rects_count", 0), K(this, "compositeParent", !1), K(this, "tileset", new Dt(ft.TEXTURES_PER_TILEMAP)), K(this, "tilemapBounds", new b()), K(this, "hasAnimatedTile", !1), K(this, "pointsBuf", []), K(this, "batched"), K(this, "vbId", 0), K(this, "vb", null), K(this, "vbBuffer", null), K(this, "vbArray", null), K(this, "vbInts", null), this.setTileset(e);
3500
+ }), G(this, "tileAnim", null), G(this, "rects_count", 0), G(this, "compositeParent", !1), G(this, "tileset", new jt(gt.TEXTURES_PER_TILEMAP)), G(this, "tilemapBounds", new b()), G(this, "hasAnimatedTile", !1), G(this, "pointsBuf", []), G(this, "batched"), G(this, "vbId", 0), G(this, "vb", null), G(this, "vbBuffer", null), G(this, "vbArray", null), G(this, "vbInts", null), this.setTileset(e);
3498
3501
  }
3499
3502
  checkValid() {
3500
3503
  let e = this.tileset.count > 0 && this.pointsBuf.length > 0, t = this.is_valid !== e;
@@ -3509,10 +3512,10 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3509
3512
  }
3510
3513
  setTileset(e = []) {
3511
3514
  let t = this.tileset;
3512
- if (e instanceof Dt) this.tileset = e, this.didViewUpdate = !0;
3515
+ if (e instanceof jt) this.tileset = e, this.didViewUpdate = !0;
3513
3516
  else if (e instanceof I) {
3514
3517
  if (t.count === 1 && t.arr[0] === e) return this;
3515
- t = this.tileset = new Dt(ft.TEXTURES_PER_TILEMAP), t.push(e), this.didViewUpdate = !0;
3518
+ t = this.tileset = new jt(gt.TEXTURES_PER_TILEMAP), t.push(e), this.didViewUpdate = !0;
3516
3519
  } else {
3517
3520
  if (e.length === t.count) {
3518
3521
  let n = !0;
@@ -3522,7 +3525,7 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3522
3525
  }
3523
3526
  if (n) return this;
3524
3527
  }
3525
- t = this.tileset = new Dt(ft.TEXTURES_PER_TILEMAP);
3528
+ t = this.tileset = new jt(gt.TEXTURES_PER_TILEMAP);
3526
3529
  for (let n = 0; n < e.length; n++) t.push(e[n]?.source);
3527
3530
  this.didViewUpdate = !0;
3528
3531
  }
@@ -3551,29 +3554,29 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3551
3554
  }
3552
3555
  tileRotate(e) {
3553
3556
  let t = this.pointsBuf;
3554
- t[t.length - (Ut - 9)] = e;
3557
+ t[t.length - (qt - 9)] = e;
3555
3558
  }
3556
3559
  tileAnimX(e, t) {
3557
3560
  let n = this.pointsBuf;
3558
- n[n.length - (Ut - 7)] = e, n[n.length - (Ut - 10)] = t;
3561
+ n[n.length - (qt - 7)] = e, n[n.length - (qt - 10)] = t;
3559
3562
  }
3560
3563
  tileAnimY(e, t) {
3561
3564
  let n = this.pointsBuf;
3562
- n[n.length - (Ut - 8)] = e, n[n.length - (Ut - 11)] = t;
3565
+ n[n.length - (qt - 8)] = e, n[n.length - (qt - 11)] = t;
3563
3566
  }
3564
3567
  tileAnimDivisor(e) {
3565
3568
  let t = this.pointsBuf;
3566
- t[t.length - (Ut - 12)] = e;
3569
+ t[t.length - (qt - 12)] = e;
3567
3570
  }
3568
3571
  tileAlpha(e) {
3569
3572
  let t = this.pointsBuf;
3570
- t[t.length - (Ut - 13)] = e;
3573
+ t[t.length - (qt - 13)] = e;
3571
3574
  }
3572
3575
  destroyVb() {
3573
3576
  this.vb &&= (this.vb.destroy(), null);
3574
3577
  }
3575
3578
  updateBuffer(e) {
3576
- let t = this.pointsBuf, n = t.length / Ut, r = this.vb;
3579
+ let t = this.pointsBuf, n = t.length / qt, r = this.vb;
3577
3580
  if (this.tileset.count === 0 || n === 0 || this.rects_count === n && r) return;
3578
3581
  this.rects_count = n, r || (r = e.createVb(), this.vb = r, this.vbId = r.id, this.vbBuffer = null);
3579
3582
  let i = n * r.vertPerQuad;
@@ -3585,7 +3588,7 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3585
3588
  this.vbBuffer = new ArrayBuffer(e), this.vbArray = new Float32Array(this.vbBuffer), this.vbInts = new Uint32Array(this.vbBuffer);
3586
3589
  }
3587
3590
  let s = this.vbArray, c = this.vbInts, l = 0, u = 0;
3588
- for (let e = 0; e < t.length; e += Ut) {
3591
+ for (let e = 0; e < t.length; e += qt) {
3589
3592
  let n = .5;
3590
3593
  this.compositeParent && (u = t[e + 9]);
3591
3594
  let r = t[e + 2], i = t[e + 3], a = t[e + 4], o = t[e + 5], d = t[e + 0], f = t[e + 1], p = t[e + 6], m = t[e + 7], h = t[e + 8], g = t[e + 10] || 1024, _ = t[e + 11] || 1024, v = m + g * 2048, y = h + _ * 2048, b = t[e + 12], x = t[e + 13], S, C, w, T, E, D, O, k;
@@ -3594,17 +3597,17 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3594
3597
  let e = a / 2, t = o / 2;
3595
3598
  p % 4 != 0 && (e = o / 2, t = a / 2);
3596
3599
  let n = d + e, r = f + t;
3597
- p = z.add(p, z.NW), S = n + e * z.uX(p), C = r + t * z.uY(p), p = z.add(p, 2), w = n + e * z.uX(p), T = r + t * z.uY(p), p = z.add(p, 2), E = n + e * z.uX(p), D = r + t * z.uY(p), p = z.add(p, 2), O = n + e * z.uX(p), k = r + t * z.uY(p);
3600
+ p = R.add(p, R.NW), S = n + e * R.uX(p), C = r + t * R.uY(p), p = R.add(p, 2), w = n + e * R.uX(p), T = r + t * R.uY(p), p = R.add(p, 2), E = n + e * R.uX(p), D = r + t * R.uY(p), p = R.add(p, 2), O = n + e * R.uX(p), k = r + t * R.uY(p);
3598
3601
  }
3599
3602
  s[l++] = r, s[l++] = i, s[l++] = S, s[l++] = C, s[l++] = d + n, s[l++] = f + n, s[l++] = d + a - n, s[l++] = f + o - n, s[l++] = v, s[l++] = y, c[l++] = u, s[l++] = b, s[l++] = x, s[l++] = r + a, s[l++] = i, s[l++] = w, s[l++] = T, s[l++] = d + n, s[l++] = f + n, s[l++] = d + a - n, s[l++] = f + o - n, s[l++] = v, s[l++] = y, c[l++] = u, s[l++] = b, s[l++] = x, s[l++] = r + a, s[l++] = i + o, s[l++] = E, s[l++] = D, s[l++] = d + n, s[l++] = f + n, s[l++] = d + a - n, s[l++] = f + o - n, s[l++] = v, s[l++] = y, c[l++] = u, s[l++] = b, s[l++] = x, s[l++] = r, s[l++] = i + o, s[l++] = O, s[l++] = k, s[l++] = d + n, s[l++] = f + n, s[l++] = d + a - n, s[l++] = f + o - n, s[l++] = v, s[l++] = y, c[l++] = u, s[l++] = b, s[l++] = x;
3600
3603
  }
3601
3604
  a.data = s;
3602
3605
  }
3603
3606
  isModified(e) {
3604
- return !!(this.rects_count * Ut !== this.pointsBuf.length || e && this.hasAnimatedTile);
3607
+ return !!(this.rects_count * qt !== this.pointsBuf.length || e && this.hasAnimatedTile);
3605
3608
  }
3606
3609
  clearModify() {
3607
- this.rects_count = this.pointsBuf.length / Ut;
3610
+ this.rects_count = this.pointsBuf.length / qt;
3608
3611
  }
3609
3612
  addBounds(e) {
3610
3613
  let t = this.tilemapBounds;
@@ -3637,21 +3640,21 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3637
3640
  alpha: p
3638
3641
  });
3639
3642
  }
3640
- }, Gt = Object.defineProperty, Kt = (e, t, n) => t in e ? Gt(e, t, {
3643
+ }, Yt = Object.defineProperty, Xt = (e, t, n) => t in e ? Yt(e, t, {
3641
3644
  enumerable: !0,
3642
3645
  configurable: !0,
3643
3646
  writable: !0,
3644
3647
  value: n
3645
- }) : e[t] = n, qt = (e, t, n) => (Kt(e, typeof t == "symbol" ? t : t + "", n), n), Jt = class extends C {
3648
+ }) : e[t] = n, Zt = (e, t, n) => (Xt(e, typeof t == "symbol" ? t : t + "", n), n), Qt = class extends C {
3646
3649
  constructor(e) {
3647
- super(), qt(this, "texturesPerTilemap"), qt(this, "tileAnim", null), qt(this, "lastModifiedTilemap", null), qt(this, "modificationMarker", 0), qt(this, "setBitmaps", this.tileset), this.texturesPerTilemap = ft.TEXTURES_PER_TILEMAP, this.tileset(e);
3650
+ super(), Zt(this, "texturesPerTilemap"), Zt(this, "tileAnim", null), Zt(this, "lastModifiedTilemap", null), Zt(this, "modificationMarker", 0), Zt(this, "setBitmaps", this.tileset), this.texturesPerTilemap = gt.TEXTURES_PER_TILEMAP, this.tileset(e);
3648
3651
  }
3649
3652
  tileset(e) {
3650
3653
  e ||= [];
3651
3654
  let t = this.texturesPerTilemap, n = this.children.length, r = Math.ceil(e.length / t);
3652
3655
  for (let i = 0; i < Math.min(n, r); i++) this.children[i].setTileset(e.slice(i * t, (i + 1) * t));
3653
3656
  for (let i = n; i < r; i++) {
3654
- let n = new Wt(e.slice(i * t, (i + 1) * t));
3657
+ let n = new Jt(e.slice(i * t, (i + 1) * t));
3655
3658
  n.compositeParent = !0, this.addChild(n);
3656
3659
  }
3657
3660
  return this;
@@ -3700,7 +3703,7 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3700
3703
  break;
3701
3704
  }
3702
3705
  }
3703
- i || (i = new Wt(e.source), i.compositeParent = !0, this.addChild(i));
3706
+ i || (i = new Jt(e.source), i.compositeParent = !0, this.addChild(i));
3704
3707
  }
3705
3708
  i.tile(e, t, n, r);
3706
3709
  }
@@ -3735,10 +3738,10 @@ var Bt = Object.defineProperty, Vt = (e, t, n) => t in e ? Bt(e, t, {
3735
3738
  return this.texturesPerTilemap;
3736
3739
  }
3737
3740
  };
3738
- R.add(St), R.add(Nt), R.add(zt);
3741
+ re.add(Et), re.add(Lt), re.add(Ut);
3739
3742
  //#endregion
3740
3743
  //#region src/Tilemap/Tile.ts
3741
- var Yt = class e extends g {
3744
+ var $t = class e extends g {
3742
3745
  static getTextures(e, t) {
3743
3746
  let n = [];
3744
3747
  return e.animations && e.animations.length ? e.animations.forEach((e) => {
@@ -3763,12 +3766,12 @@ var Yt = class e extends g {
3763
3766
  }
3764
3767
  flip() {
3765
3768
  let e, t = 0, n = (n) => {
3766
- t++, e = e ? z.add(e, n) : n;
3769
+ t++, e = e ? R.add(e, n) : n;
3767
3770
  };
3768
- this.tile.horizontalFlip && n(z.MIRROR_HORIZONTAL), this.tile.verticalFlip && n(z.MIRROR_VERTICAL), this.tile.diagonalFlip && (t % 2 == 0 ? n(z.MAIN_DIAGONAL) : n(z.REVERSE_DIAGONAL));
3771
+ this.tile.horizontalFlip && n(R.MIRROR_HORIZONTAL), this.tile.verticalFlip && n(R.MIRROR_VERTICAL), this.tile.diagonalFlip && (t % 2 == 0 ? n(R.MAIN_DIAGONAL) : n(R.REVERSE_DIAGONAL));
3769
3772
  }
3770
3773
  };
3771
- ft.use32bitIndex = !0, f("CompositeTileLayer", class e extends t(Jt) {
3774
+ gt.use32bitIndex = !0, f("CompositeTileLayer", class e extends t(Qt) {
3772
3775
  constructor(...e) {
3773
3776
  super(...e), this._tiles = {}, this.frameTile = 0, this.frameRateAnimation = 10;
3774
3777
  }
@@ -3784,7 +3787,7 @@ ft.use32bitIndex = !0, f("CompositeTileLayer", class e extends t(Jt) {
3784
3787
  if (!u || u && u.gid == 0) return;
3785
3788
  let d = e.findTileSet(u.gid, this.tileSets);
3786
3789
  if (!d) return;
3787
- let f = new Yt(u, d);
3790
+ let f = new $t(u, d);
3788
3791
  if (f.x = t * o, f.y = n * s + (s - f.texture.height), f._x = t, f._y = n, d.tileoffset && (f.x += d.tileoffset.x ?? 0, f.y += d.tileoffset.y ?? 0), !(a && !a(f))) return f;
3789
3792
  }
3790
3793
  _addFrame(e, t, n) {
@@ -3793,7 +3796,7 @@ ft.use32bitIndex = !0, f("CompositeTileLayer", class e extends t(Jt) {
3793
3796
  }
3794
3797
  async onMount(e) {
3795
3798
  let { props: t } = e;
3796
- this.tileSets = t.tilesets, this._layer = new lt({ ...t }, this.tileSets);
3799
+ this.tileSets = t.tilesets, this._layer = new pt({ ...t }, this.tileSets);
3797
3800
  let n = t.context.tick;
3798
3801
  this.subscriptionTick = n.observable.subscribe(({ value: e }) => {
3799
3802
  e.frame % this.frameRateAnimation == 0 && (this.tileAnim = [this.frameTile, this.frameTile], this.frameTile++);
@@ -3812,12 +3815,12 @@ ft.use32bitIndex = !0, f("CompositeTileLayer", class e extends t(Jt) {
3812
3815
  this.subscriptionTick.unsubscribe(), await super.onDestroy(e);
3813
3816
  }
3814
3817
  });
3815
- function Xt(e) {
3818
+ function en(e) {
3816
3819
  return o("CompositeTileLayer", e);
3817
3820
  }
3818
3821
  //#endregion
3819
3822
  //#region src/Tilemap/TileSet.ts
3820
- var Zt = class extends ut {
3823
+ var tn = class extends mt {
3821
3824
  constructor(e) {
3822
3825
  super(e), this.textures = [], this.tileGroups = {};
3823
3826
  }
@@ -3833,10 +3836,10 @@ var Zt = class extends ut {
3833
3836
  };
3834
3837
  //#endregion
3835
3838
  //#region src/Tilemap/index.ts
3836
- function Qt(e, t, n) {
3839
+ function nn(e, t, n) {
3837
3840
  let r = [];
3838
3841
  for (let n of e) {
3839
- if (n.type !== Re.Tile) {
3842
+ if (n.type !== He.Tile) {
3840
3843
  r.push(n);
3841
3844
  continue;
3842
3845
  }
@@ -3882,23 +3885,23 @@ function Qt(e, t, n) {
3882
3885
  }
3883
3886
  return r.sort((e, t) => (e.properties?.z ?? .5) - (t.properties?.z ?? .5)), r;
3884
3887
  }
3885
- function $t(t) {
3888
+ function rn(t) {
3886
3889
  let { map: n, basePath: r, createLayersPerTilesZ: i } = h(t, {
3887
3890
  createLayersPerTilesZ: !1,
3888
3891
  basePath: ""
3889
- }), o = p([]), u = t.objectLayer, d = [], f = {}, m = async (e, t = "") => typeof e == "string" ? await new dt(e, { basePath: t }).parseFilePromise({ getOnlyBasename: !1 }) : e;
3892
+ }), o = p([]), u = t.objectLayer, d = [], f = {}, m = async (e, t = "") => typeof e == "string" ? await new ht(e, { basePath: t }).parseFilePromise({ getOnlyBasename: !1 }) : e;
3890
3893
  s(async () => {
3891
3894
  let e = n();
3892
3895
  if (e) {
3893
3896
  f = await m(e, r()), d = [];
3894
- for (let e of f.tilesets) e.tile && (e.tiles = e.tile), e.tiles ||= [], d.push(await new Zt(e).load(e.image.source));
3897
+ for (let e of f.tilesets) e.tile && (e.tiles = e.tile), e.tiles ||= [], d.push(await new tn(e).load(e.image.source));
3895
3898
  let t = f.layers;
3896
- i() && (t = Qt(f.layers, d, f)), o.set(t);
3899
+ i() && (t = nn(f.layers, d, f)), o.set(t);
3897
3900
  }
3898
3901
  });
3899
3902
  let g = (t, n = {}) => c(e, n, l(t, (t) => {
3900
3903
  switch (t.type) {
3901
- case Re.Tile: return c(Xt, {
3904
+ case He.Tile: return c(en, {
3902
3905
  tilewidth: f.tilewidth,
3903
3906
  tileheight: f.tileheight,
3904
3907
  width: f.width,
@@ -3906,7 +3909,7 @@ function $t(t) {
3906
3909
  ...t,
3907
3910
  tilesets: d
3908
3911
  });
3909
- case Re.Image:
3912
+ case He.Image:
3910
3913
  let { width: n, height: r, source: i } = t.image;
3911
3914
  return c(a, {
3912
3915
  image: i,
@@ -3914,8 +3917,8 @@ function $t(t) {
3914
3917
  width: t.repeatx ? t.width * t.tilewidth : n,
3915
3918
  height: t.repeaty ? t.height * t.tileheight : r
3916
3919
  });
3917
- case Re.Group: return g(p(t.layers), t);
3918
- case Re.ObjectGroup:
3920
+ case He.Group: return g(p(t.layers), t);
3921
+ case He.ObjectGroup:
3919
3922
  let o = u?.(t);
3920
3923
  return c(e, t, o);
3921
3924
  default: return c(e);
@@ -3924,16 +3927,8 @@ function $t(t) {
3924
3927
  return c(e, t, g(o));
3925
3928
  }
3926
3929
  //#endregion
3927
- //#region src/Weathers/rain.ts
3928
- function en() {
3929
- return new D({
3930
- vertex: "\n precision mediump float;\n in vec2 aPosition;\n in vec2 aUV;\n out vec2 vUV;\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform mat3 uTransformMatrix;\n void main(void) {\n vUV = aUV;\n mat3 modelViewProjectionMatrix = uProjectionMatrix * uWorldTransformMatrix * uTransformMatrix;\n gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);\n }\n ",
3931
- fragment: "\n precision mediump float;\n in vec2 vUV;\n out vec4 finalColor;\n\n uniform float uTime;\n uniform vec2 uResolution;\n uniform float uRainSpeed;\n uniform float uWindDirection;\n uniform float uWindStrength;\n uniform float uRainDensity;\n uniform float uMaxDrops;\n\n float hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n float rainLayer(\n vec2 uv,\n float t,\n float scale,\n float speed,\n float slant,\n float density,\n float width,\n float length\n ) {\n vec2 dir = normalize(vec2(slant, 1.0));\n vec2 perp = vec2(-dir.y, dir.x);\n\n float along = dot(uv, dir) * scale - t * speed;\n float across = dot(uv, perp) * scale;\n\n vec2 p = vec2(across, along);\n vec2 cell = floor(p);\n vec2 f = fract(p);\n\n float rnd = hash(cell);\n float rnd2 = hash(cell + 13.17);\n\n float x = rnd;\n float dropWidth = width * (0.7 + rnd2 * 0.6);\n float dropLength = length * (0.5 + rnd * 0.6);\n\n float line = 1.0 - smoothstep(0.0, dropWidth, abs(f.x - x));\n float segment = smoothstep(0.0, 0.03, f.y)\n * (1.0 - smoothstep(dropLength, dropLength + 0.03, f.y));\n\n float visible = step(rnd, density);\n float intensity = line * segment * visible;\n return intensity * (0.6 + 0.4 * rnd2);\n }\n\n void main() {\n vec2 safeResolution = max(uResolution, vec2(1.0));\n vec2 uv = vUV;\n float aspect = safeResolution.x / safeResolution.y;\n uv.x *= aspect;\n\n float pixelCount = safeResolution.x * safeResolution.y;\n float resolutionFactor = clamp(pixelCount / 700000.0, 0.7, 1.1);\n\n float densityFactor = clamp(uRainDensity / 180.0, 0.35, 1.4);\n float maxDropFactor = clamp(uMaxDrops / 90.0, 0.45, 1.1);\n float density = clamp(densityFactor * maxDropFactor * resolutionFactor, 0.15, 1.0);\n\n float slant = uWindDirection * uWindStrength * 0.6;\n float speed = 1.3 * uRainSpeed + 0.4;\n\n float rain = 0.0;\n rain += rainLayer(uv, uTime, 24.0, speed * 1.2, slant, density, 0.026, 0.9);\n rain += rainLayer(uv, uTime, 36.0, speed * 1.5, slant * 1.2, density * 0.85, 0.02, 0.72);\n rain += rainLayer(uv, uTime, 52.0, speed * 1.8, slant * 1.4, density * 0.7, 0.016, 0.58);\n\n float heightFade = mix(0.65, 1.0, uv.y);\n rain *= heightFade;\n\n vec3 rainColor = vec3(0.75, 0.85, 1.0);\n float alpha = clamp(rain * 1.15, 0.0, 0.95);\n finalColor = vec4(rainColor * alpha, alpha);\n }\n "
3932
- });
3933
- }
3934
- //#endregion
3935
3930
  //#region src/Weathers/snow.ts
3936
- function tn() {
3931
+ function an() {
3937
3932
  return new D({
3938
3933
  vertex: "\n precision mediump float;\n in vec2 aPosition;\n in vec2 aUV;\n out vec2 vUV;\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform mat3 uTransformMatrix;\n void main(void) {\n vUV = aUV;\n mat3 modelViewProjectionMatrix = uProjectionMatrix * uWorldTransformMatrix * uTransformMatrix;\n gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);\n }\n ",
3939
3934
  fragment: "\n precision mediump float;\n in vec2 vUV;\n out vec4 finalColor;\n\n uniform float uTime;\n uniform vec2 uResolution;\n uniform float uSnowSpeed;\n uniform float uWindDirection;\n uniform float uWindStrength;\n uniform float uSnowDensity;\n uniform float uMaxFlakes;\n\n float hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n vec2 hash2(vec2 p) {\n return vec2(\n hash(p),\n hash(p + 19.19)\n );\n }\n\n float snowLayer(\n vec2 uv,\n float t,\n float scale,\n float speed,\n float wind,\n float density,\n float sizeMin,\n float sizeMax\n ) {\n vec2 p = uv;\n p.x -= wind * t;\n p.y -= t * speed;\n\n p *= scale;\n vec2 cell = floor(p);\n vec2 f = fract(p);\n\n float rnd = hash(cell);\n if (rnd > density) {\n return 0.0;\n }\n\n vec2 jitter = hash2(cell + 3.7);\n float wobble = (hash(cell + 9.1) - 0.5) * 0.3;\n vec2 center = jitter;\n center.x += sin(t * 0.7 + jitter.y * 6.283) * 0.15 + wobble;\n center.y += cos(t * 0.5 + jitter.x * 6.283) * 0.12;\n\n float size = mix(sizeMin, sizeMax, rnd);\n float dist = length(f - center);\n float alpha = 1.0 - smoothstep(size * 0.4, size, dist);\n float twinkle = 0.7 + 0.3 * sin(t * 1.2 + rnd * 6.283);\n return alpha * twinkle;\n }\n\n void main() {\n vec2 safeResolution = max(uResolution, vec2(1.0));\n vec2 uv = vUV;\n float aspect = safeResolution.x / safeResolution.y;\n uv.x *= aspect;\n\n float pixelCount = safeResolution.x * safeResolution.y;\n float resolutionFactor = clamp(pixelCount / 900000.0, 0.6, 1.1);\n\n float densityFactor = clamp(uSnowDensity / 180.0, 0.25, 1.3);\n float maxFlakeFactor = clamp(uMaxFlakes / 90.0, 0.4, 1.1);\n float density = clamp(densityFactor * maxFlakeFactor * resolutionFactor, 0.08, 1.0);\n\n float wind = uWindDirection * uWindStrength * 0.45;\n float speed = uSnowSpeed * 0.9 + 0.15;\n\n float snow = 0.0;\n snow += snowLayer(uv, uTime, 18.0, speed * 0.5, wind * 0.6, density, 0.1, 0.22) * 0.65;\n snow += snowLayer(uv, uTime, 28.0, speed * 0.75, wind * 0.9, density * 0.9, 0.075, 0.16) * 0.8;\n snow += snowLayer(uv, uTime, 40.0, speed, wind, density * 0.75, 0.05, 0.12);\n\n float heightFade = mix(0.7, 1.0, uv.y);\n snow *= heightFade;\n\n vec3 snowColor = vec3(0.92, 0.95, 1.0);\n float alpha = clamp(snow * 1.1, 0.0, 0.92);\n finalColor = vec4(snowColor * alpha, alpha);\n }\n "
@@ -3941,13 +3936,13 @@ function tn() {
3941
3936
  }
3942
3937
  //#endregion
3943
3938
  //#region src/Weathers/fog.ts
3944
- function nn() {
3939
+ function on() {
3945
3940
  return new D({
3946
3941
  vertex: "\n precision mediump float;\n in vec2 aPosition;\n in vec2 aUV;\n out vec2 vUV;\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform mat3 uTransformMatrix;\n void main(void) {\n vUV = aUV;\n mat3 modelViewProjectionMatrix = uProjectionMatrix * uWorldTransformMatrix * uTransformMatrix;\n gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);\n }\n ",
3947
3942
  fragment: "\n precision mediump float;\n in vec2 vUV;\n out vec4 finalColor;\n\n uniform float uTime;\n uniform vec2 uResolution;\n uniform float uSpeed;\n uniform float uScale;\n uniform float uDensity;\n uniform float uHeight;\n uniform vec2 uViewportOrigin;\n\n float hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n float noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n float a = hash(i);\n float b = hash(i + vec2(1.0, 0.0));\n float c = hash(i + vec2(0.0, 1.0));\n float d = hash(i + vec2(1.0, 1.0));\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;\n }\n\n float fbm(vec2 p) {\n float value = 0.0;\n float amp = 0.5;\n value += amp * noise(p);\n p = p * 2.03 + vec2(17.13, 9.37);\n amp *= 0.55;\n value += amp * noise(p);\n p = p * 2.01 + vec2(31.71, 4.23);\n amp *= 0.55;\n value += amp * noise(p);\n p = p * 2.02 + vec2(15.41, 27.19);\n amp *= 0.55;\n value += amp * noise(p);\n return value;\n }\n\n void main() {\n vec2 safeResolution = max(uResolution, vec2(1.0));\n vec2 rawUv = vUV;\n vec2 uv = rawUv;\n float aspect = safeResolution.x / safeResolution.y;\n uv.x *= aspect;\n vec2 viewportShift = vec2(\n (uViewportOrigin.x / safeResolution.x) * aspect,\n uViewportOrigin.y / safeResolution.y\n );\n vec2 worldUv = uv + viewportShift;\n\n float normalizedDensity = uDensity;\n if (normalizedDensity > 4.0) {\n normalizedDensity = normalizedDensity / 120.0;\n }\n float density = clamp(normalizedDensity, 0.0, 2.4);\n float scale = clamp(uScale, 0.25, 4.0);\n float speed = max(uSpeed * 8.0, 0.18);\n\n vec2 driftA = vec2(uTime * 0.06 * speed, uTime * 0.02 * speed);\n vec2 driftB = vec2(-uTime * 0.042 * speed, uTime * 0.016 * speed);\n vec2 wobble = vec2(\n sin(uTime * 0.23 * speed + worldUv.y * 4.0) * 0.03,\n cos(uTime * 0.17 * speed + worldUv.x * 3.2) * 0.018\n );\n vec2 flowUv = worldUv + wobble;\n\n float layerA = fbm(flowUv * scale + driftA);\n float layerB = fbm(flowUv * (scale * 1.7) + driftB);\n float layerC = fbm(vec2(flowUv.x * 0.75, flowUv.y * 1.35) * (scale * 1.2) + vec2(driftA.x * 0.6, -driftA.y * 0.8));\n\n float wisps = smoothstep(0.2, 0.82, layerA);\n float detail = smoothstep(0.28, 0.9, layerB);\n float fogPattern = clamp(wisps * 0.55 + detail * 0.3 + layerC * 0.35, 0.0, 1.2);\n\n float heightControl = clamp(uHeight, 0.0, 1.0);\n float fullScreen = step(0.99, heightControl);\n float groundFog = pow(clamp(rawUv.y, 0.0, 1.0), 0.42);\n float heightFactor = mix(groundFog, 1.0, heightControl);\n heightFactor = mix(heightFactor, 1.0, fullScreen);\n\n float breathing = 0.9 + 0.1 * sin(uTime * 0.25 * speed);\n float fog = fogPattern * density * heightFactor * breathing;\n float alpha = clamp(fog * 0.82, 0.0, 0.82);\n\n vec3 baseColor = vec3(0.84, 0.88, 0.94);\n vec3 brightColor = vec3(0.95, 0.97, 1.0);\n vec3 fogColor = mix(baseColor, brightColor, detail * 0.45);\n finalColor = vec4(fogColor * alpha, alpha);\n }\n "
3948
3943
  });
3949
3944
  }
3950
- function rn() {
3945
+ function sn() {
3951
3946
  return new D({
3952
3947
  vertex: "\n precision mediump float;\n in vec2 aPosition;\n in vec2 aUV;\n out vec2 vUV;\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform mat3 uTransformMatrix;\n void main(void) {\n vUV = aUV;\n mat3 modelViewProjectionMatrix = uProjectionMatrix * uWorldTransformMatrix * uTransformMatrix;\n gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);\n }\n ",
3953
3948
  fragment: "\n precision mediump float;\n in vec2 vUV;\n out vec4 finalColor;\n\n uniform float uTime;\n uniform vec2 uResolution;\n uniform float uSpeed;\n uniform float uScale;\n uniform float uDensity;\n uniform float uHeight;\n uniform vec2 uViewportOrigin;\n uniform float uSunIntensity;\n uniform vec2 uSunDirection;\n uniform float uRaySpread;\n uniform float uRayTwinkle;\n uniform float uRayTwinkleSpeed;\n\n float hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n float noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n float a = hash(i);\n float b = hash(i + vec2(1.0, 0.0));\n float c = hash(i + vec2(0.0, 1.0));\n float d = hash(i + vec2(1.0, 1.0));\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;\n }\n\n float fbm(vec2 p) {\n float v = 0.0;\n float a = 0.7;\n v += a * noise(p);\n p *= 2.1;\n a *= 0.5;\n v += a * noise(p + 17.0);\n p *= 2.2;\n a *= 0.5;\n v += a * noise(p + 29.0);\n return v;\n }\n\n void main() {\n vec2 safeResolution = max(uResolution, vec2(1.0));\n vec2 uv = vUV;\n float aspect = safeResolution.x / safeResolution.y;\n uv.x *= aspect;\n vec2 viewportShift = vec2(\n (uViewportOrigin.x / safeResolution.x) * aspect,\n uViewportOrigin.y / safeResolution.y\n );\n vec2 worldUv = uv + viewportShift;\n\n float normalizedDensity = uDensity;\n if (normalizedDensity > 4.0) {\n normalizedDensity = normalizedDensity / 100.0;\n }\n float density = clamp(normalizedDensity, 0.0, 2.0);\n float scale = clamp(uScale, 0.2, 4.0);\n float speed = max(uSpeed * 6.0, 0.12);\n vec2 driftMain = vec2(uTime * 0.04 * speed, uTime * 0.012 * speed);\n vec2 driftDetail = vec2(-uTime * 0.028 * speed, uTime * 0.01 * speed);\n vec2 wobble = vec2(\n sin(uTime * 0.18 * speed + worldUv.y * 4.8) * 0.035,\n cos(uTime * 0.16 * speed + worldUv.x * 3.7) * 0.02\n );\n vec2 flowUv = worldUv + wobble;\n\n float cloudNoise = fbm(flowUv * scale + driftMain);\n float detailNoise = fbm(flowUv * (scale * 2.4) + driftDetail);\n\n float shape = smoothstep(0.4, 0.93, cloudNoise);\n float detail = smoothstep(0.36, 0.9, detailNoise);\n float puff = shape * (0.55 + 0.45 * detail);\n\n float heightControl = clamp(uHeight, 0.0, 1.0);\n float fullScreen = step(0.99, heightControl);\n float skyHeight = pow(clamp(1.0 - vUV.y, 0.0, 1.0), 0.68);\n float heightFactor = mix(skyHeight, 1.0, heightControl);\n heightFactor = mix(heightFactor, 1.0, fullScreen);\n float cloud = puff * density * 0.72 * heightFactor;\n float cloudAlpha = clamp(cloud, 0.0, 0.68);\n\n vec2 sunDir = uSunDirection;\n if (length(sunDir) < 0.0001) {\n sunDir = vec2(0.55, 1.0);\n }\n sunDir = normalize(sunDir);\n vec2 rayUv = worldUv;\n float spread = clamp(uRaySpread, 0.35, 2.5);\n float rayCoord = dot(rayUv, sunDir) * (6.5 / spread);\n float rayNoise = fbm(vec2(rayCoord, rayUv.y * 0.55));\n float shafts = smoothstep(0.5, 0.9, rayNoise);\n float skyFade = pow(clamp(1.0 - vUV.y, 0.0, 1.0), 1.25);\n float cloudGap = clamp(1.0 - cloudAlpha * 1.05, 0.0, 1.0);\n float twinkleAmount = clamp(uRayTwinkle, 0.0, 1.5);\n float twinkleSpeed = max(uRayTwinkleSpeed, 0.01);\n float twinklePulse = 0.5 + 0.5 * sin(uTime * 1.9 * twinkleSpeed + rayCoord * 1.8);\n float twinkleNoise = fbm(vec2(rayCoord * 1.35 + 13.7, uTime * 0.1 * twinkleSpeed));\n float twinkle = mix(\n 1.0,\n clamp(0.7 + 0.35 * twinklePulse + 0.25 * twinkleNoise, 0.35, 1.55),\n twinkleAmount\n );\n float rayAlpha = shafts * skyFade * cloudGap * clamp(uSunIntensity, 0.0, 2.0) * twinkle * 0.58;\n\n vec3 cloudDark = vec3(0.82, 0.87, 0.94);\n vec3 cloudBright = vec3(0.98, 0.99, 1.0);\n vec3 cloudColor = mix(cloudDark, cloudBright, detail * 0.55);\n vec3 rayColor = vec3(1.0, 0.95, 0.8);\n\n float totalAlpha = cloudAlpha + rayAlpha;\n float alpha = clamp(totalAlpha, 0.0, 0.86);\n vec3 premulColor = cloudColor * cloudAlpha + rayColor * rayAlpha;\n if (totalAlpha > 0.0001) {\n premulColor *= (alpha / totalAlpha);\n }\n finalColor = vec4(premulColor, alpha);\n }\n "
@@ -3955,7 +3950,118 @@ function rn() {
3955
3950
  }
3956
3951
  //#endregion
3957
3952
  //#region src/Weathers/index.ts
3958
- var an = {
3953
+ var cn = /* @__PURE__ */ new Map(), K = (e) => typeof e == "function" ? e() : e;
3954
+ function ln(e) {
3955
+ let t = e * 9301 + 49297;
3956
+ return () => (t = (t * 9301 + 49297) % 233280, t / 233280);
3957
+ }
3958
+ function un(e = 1) {
3959
+ if (cn.has(e)) return cn.get(e);
3960
+ if (typeof document > "u") return F.WHITE;
3961
+ let t = ln(e), n = document.createElement("canvas");
3962
+ n.width = 192, n.height = 192;
3963
+ let r = n.getContext("2d");
3964
+ if (!r) return F.WHITE;
3965
+ r.clearRect(0, 0, n.width, n.height), r.lineCap = "round";
3966
+ for (let e = 0; e < 62; e++) {
3967
+ let e = t() * n.width, i = t() * n.height, a = 18 + t() * 24, o = 4 + t() * 8, s = .2 + t() * .22, c = t() > .76 ? 1.9 : 1.15, l = r.createLinearGradient(e, i, e + o, i + a);
3968
+ l.addColorStop(0, "rgba(220,235,255,0)"), l.addColorStop(.28, `rgba(220,235,255,${s})`), l.addColorStop(.72, `rgba(235,245,255,${s * .86})`), l.addColorStop(1, "rgba(220,235,255,0)"), r.strokeStyle = l, r.lineWidth = c, r.beginPath(), r.moveTo(e, i), r.lineTo(e + o, i + a), r.stroke();
3969
+ }
3970
+ let i = F.from(n);
3971
+ return cn.set(e, i), i;
3972
+ }
3973
+ f("RainTextureLayer", class extends t(L) {
3974
+ constructor(...e) {
3975
+ super(...e), this.widthInput = 1e3, this.heightInput = 1e3, this.speedInput = 1, this.windInput = 0, this.windStrengthInput = 0, this.fallScaleInput = 1, this.densityInput = 120, this.maxDropsInput = 80, this.topDownInput = !0, this.topDownTileScale = {
3976
+ x: 1,
3977
+ y: 1
3978
+ }, this.sideTileScale = {
3979
+ x: 1,
3980
+ y: 1
3981
+ }, this.topDownAlpha = .5, this.sideAlpha = .4, this.offsetX = 0, this.offsetY = 0;
3982
+ }
3983
+ onUpdate(e) {
3984
+ super.onUpdate(e), e.texture && (this.texture = e.texture), e.topDownTileScale && (this.topDownTileScale = e.topDownTileScale), e.sideTileScale && (this.sideTileScale = e.sideTileScale), e.topDownAlpha !== void 0 && (this.topDownAlpha = e.topDownAlpha), e.sideAlpha !== void 0 && (this.sideAlpha = e.sideAlpha), e.startX !== void 0 && (this.offsetX = e.startX), e.startY !== void 0 && (this.offsetY = e.startY), e.speed !== void 0 && (this.speedInput = e.speed), e.windDirection !== void 0 && (this.windInput = e.windDirection), e.windStrength !== void 0 && (this.windStrengthInput = e.windStrength), e.fallScale !== void 0 && (this.fallScaleInput = e.fallScale), e.density !== void 0 && (this.densityInput = e.density), e.maxDrops !== void 0 && (this.maxDropsInput = e.maxDrops), e.topDown !== void 0 && (this.topDownInput = e.topDown), e.width !== void 0 && (this.widthInput = e.width, this.width = Number(K(e.width)) || this.width), e.height !== void 0 && (this.heightInput = e.height, this.height = Number(K(e.height)) || this.height);
3985
+ }
3986
+ async onMount(e, t) {
3987
+ await super.onMount(e, t), this.widthInput = e.propObservables?.width ?? e.props.width ?? this.widthInput, this.heightInput = e.propObservables?.height ?? e.props.height ?? this.heightInput, this.speedInput = e.propObservables?.speed ?? e.props.speed ?? this.speedInput, this.windInput = e.propObservables?.windDirection ?? e.props.windDirection ?? this.windInput, this.windStrengthInput = e.propObservables?.windStrength ?? e.props.windStrength ?? this.windStrengthInput, this.densityInput = e.propObservables?.density ?? e.props.density ?? this.densityInput, this.maxDropsInput = e.propObservables?.maxDrops ?? e.props.maxDrops ?? this.maxDropsInput, this.topDownInput = e.propObservables?.topDown ?? e.props.topDown ?? this.topDownInput, this.tickSubscription = e.props.context?.tick?.observable?.subscribe(({ value: e }) => {
3988
+ let t = Math.min(e?.deltaTime ?? 16.67, 50) / 16.67, n = Number(K(this.speedInput)) || 0, r = Number(K(this.windInput)) || 0, i = Number(K(this.windStrengthInput)) || 0, a = Number(K(this.fallScaleInput)) || 1, o = Number(K(this.densityInput)) || 120, s = Number(K(this.maxDropsInput)) || 80, c = K(this.topDownInput) !== !1 && K(this.topDownInput) !== 0, l = Number(K(this.widthInput)) || this.width, u = Number(K(this.heightInput)) || this.height, d = Math.min(Math.max(s / 100, .45), 1.65), f = Math.min(Math.max(o / 180 * d, .35), 1.55), p = c ? this.topDownTileScale : this.sideTileScale, m = (7.2 + n * 4.8) * a * t, h = r * i * 3.8 * t;
3989
+ this.width = l, this.height = u, this.alpha = (c ? this.topDownAlpha : this.sideAlpha) * f, this.tileScale.set(p.x, p.y), this.offsetX += h + m * .12, this.offsetY += m, this.tilePosition.set(this.offsetX, this.offsetY);
3990
+ });
3991
+ }
3992
+ async onDestroy(e, t) {
3993
+ this.tickSubscription?.unsubscribe?.(), await super.onDestroy(e, t);
3994
+ }
3995
+ });
3996
+ var dn = (e) => o("RainTextureLayer", e);
3997
+ f("RainImpactLayer", class extends t(C) {
3998
+ constructor(...e) {
3999
+ super(...e), this.graphics = new k(), this.widthInput = 1e3, this.heightInput = 1e3, this.speedInput = 1, this.densityInput = 120, this.maxDropsInput = 80, this.topDownInput = !0, this.windInput = 0, this.windStrengthInput = 0, this.lastTopDown = null, this.splashes = [];
4000
+ }
4001
+ onUpdate(e) {
4002
+ super.onUpdate(e), e.width !== void 0 && (this.widthInput = e.width, this.width = Number(K(e.width)) || this.width), e.height !== void 0 && (this.heightInput = e.height, this.height = Number(K(e.height)) || this.height), e.speed !== void 0 && (this.speedInput = e.speed), e.density !== void 0 && (this.densityInput = e.density), e.maxDrops !== void 0 && (this.maxDropsInput = e.maxDrops), e.topDown !== void 0 && (this.topDownInput = e.topDown), e.windDirection !== void 0 && (this.windInput = e.windDirection), e.windStrength !== void 0 && (this.windStrengthInput = e.windStrength);
4003
+ }
4004
+ async onMount(e, t) {
4005
+ await super.onMount(e, t), this.addChild(this.graphics), this.widthInput = e.propObservables?.width ?? e.props.width ?? this.widthInput, this.heightInput = e.propObservables?.height ?? e.props.height ?? this.heightInput, this.speedInput = e.propObservables?.speed ?? e.props.speed ?? this.speedInput, this.densityInput = e.propObservables?.density ?? e.props.density ?? this.densityInput, this.maxDropsInput = e.propObservables?.maxDrops ?? e.props.maxDrops ?? this.maxDropsInput, this.topDownInput = e.propObservables?.topDown ?? e.props.topDown ?? this.topDownInput, this.windInput = e.propObservables?.windDirection ?? e.props.windDirection ?? this.windInput, this.windStrengthInput = e.propObservables?.windStrength ?? e.props.windStrength ?? this.windStrengthInput, this.tickSubscription = e.props.context?.tick?.observable?.subscribe(({ value: e }) => {
4006
+ let t = Math.min(e?.deltaTime ?? 16.67, 50) / 16.67;
4007
+ this.drawImpacts(t);
4008
+ });
4009
+ }
4010
+ numberValue(e, t) {
4011
+ let n = Number(K(e));
4012
+ return Number.isFinite(n) && n > 0 ? n : t;
4013
+ }
4014
+ booleanValue(e) {
4015
+ let t = K(e);
4016
+ return t !== !1 && t !== 0;
4017
+ }
4018
+ resetSplash(e, t, n, r, i = !1) {
4019
+ e.x = Math.random() * t, e.y = r ? n * (.12 + Math.random() * .78) : n * (.78 + Math.random() * .12), e.life = .24 + Math.random() * .22, e.radius = r ? 2.2 + Math.random() * 3.2 : 3.4 + Math.random() * 4.4, e.delay = .12 + Math.random() * .55, e.age = i ? Math.random() * e.life : -Math.random() * e.delay;
4020
+ }
4021
+ ensureSplashCount(e, t, n, r) {
4022
+ for (; this.splashes.length < e;) {
4023
+ let e = {
4024
+ x: 0,
4025
+ y: 0,
4026
+ age: 0,
4027
+ life: .35,
4028
+ radius: 3,
4029
+ delay: .25
4030
+ };
4031
+ this.resetSplash(e, t, n, r, !0), this.splashes.push(e);
4032
+ }
4033
+ this.splashes.length > e && (this.splashes.length = e);
4034
+ }
4035
+ drawImpacts(e) {
4036
+ let t = this.numberValue(this.widthInput, 1e3), n = this.numberValue(this.heightInput, 1e3), r = this.numberValue(this.speedInput, 1), i = this.numberValue(this.densityInput, 120), a = this.numberValue(this.maxDropsInput, 80), o = this.booleanValue(this.topDownInput), s = Number(K(this.windInput)) || 0, c = Number(K(this.windStrengthInput)) || 0, l = Math.min(Math.max(i / 180, .45), 1.55), u = Math.min(Math.round(a), Math.round((o ? 54 : 34) * l)), d = this.graphics;
4037
+ this.lastTopDown !== o && (this.splashes.length = 0, this.lastTopDown = o), this.alpha = o ? .9 : .82, this.ensureSplashCount(u, t, n, o), d.clear();
4038
+ for (let i of this.splashes) {
4039
+ if (i.age += (.045 + r * .018) * e, i.age > i.life) {
4040
+ this.resetSplash(i, t, n, o);
4041
+ continue;
4042
+ }
4043
+ if (i.age < 0) continue;
4044
+ let a = i.age / i.life, u = (1 - a) ** 1.7 * l, f = i.radius * (.65 + a * 2.6), p = o ? a * .8 : a * 1.6, m = s * c * 7 * a, h = i.x + m, g = i.y - p, _ = Math.min(.62, .44 * u);
4045
+ d.ellipse(h, g, f, i.radius * (.18 + a * .16)).stroke({
4046
+ color: 13625855,
4047
+ alpha: _,
4048
+ width: o ? 1.15 : 1.35
4049
+ }), d.moveTo(h - f * 1.15, g - .4).lineTo(h - f * .35, g - i.radius * .24).stroke({
4050
+ color: 15070975,
4051
+ alpha: _ * .78,
4052
+ width: 1
4053
+ }), d.moveTo(h + f * .35, g - i.radius * .24).lineTo(h + f * 1.15, g - .4).stroke({
4054
+ color: 15070975,
4055
+ alpha: _ * .78,
4056
+ width: 1
4057
+ });
4058
+ }
4059
+ }
4060
+ async onDestroy(e, t) {
4061
+ this.tickSubscription?.unsubscribe?.(), await super.onDestroy(e, t);
4062
+ }
4063
+ });
4064
+ var fn = (e) => o("RainImpactLayer", e), pn = {
3959
4065
  lightRain: {
3960
4066
  effect: "rain",
3961
4067
  speed: .35,
@@ -3980,7 +4086,7 @@ var an = {
3980
4086
  density: 300,
3981
4087
  maxDrops: 150
3982
4088
  }
3983
- }, on = {
4089
+ }, mn = {
3984
4090
  lightSnow: {
3985
4091
  effect: "snow",
3986
4092
  speed: .35,
@@ -4005,7 +4111,7 @@ var an = {
4005
4111
  density: 290,
4006
4112
  maxDrops: 160
4007
4113
  }
4008
- }, sn = {
4114
+ }, hn = {
4009
4115
  rpgMorningMist: {
4010
4116
  effect: "fog",
4011
4117
  speed: .16,
@@ -4041,7 +4147,7 @@ var an = {
4041
4147
  height: .72,
4042
4148
  scale: 2.3
4043
4149
  }
4044
- }, cn = {
4150
+ }, gn = {
4045
4151
  lightClouds: {
4046
4152
  effect: "cloud",
4047
4153
  speed: .16,
@@ -4138,13 +4244,13 @@ var an = {
4138
4244
  rayTwinkle: .42,
4139
4245
  rayTwinkleSpeed: .8
4140
4246
  }
4141
- }, ln = {
4142
- rain: an,
4143
- snow: on,
4144
- fog: sn,
4145
- cloud: cn
4146
- }, un = (e) => {
4147
- let { effect: t = p("rain"), speed: n = p(.5), windDirection: i = p(0), windStrength: a = p(.2), density: o = p(120), maxDrops: l = p(80), height: d = p(1), scale: f = p(2), sunIntensity: g = p(.85), sunAngle: _ = p(.85), raySpread: v = p(1), rayTwinkle: y = p(.45), rayTwinkleSpeed: b = p(1), resolution: x, ...S } = h(e), C = p([1e3, 1e3]), w = p(C()[0]), T = p(C()[1]), D = p(0), O = p(0), k, A = typeof t == "function" ? t : p(t), j = x ? typeof x == "function" ? x : p(x) : C;
4247
+ }, _n = {
4248
+ rain: pn,
4249
+ snow: mn,
4250
+ fog: hn,
4251
+ cloud: gn
4252
+ }, vn = (t) => {
4253
+ let { effect: n = p("rain"), speed: i = p(.5), windDirection: a = p(0), windStrength: o = p(.2), density: l = p(120), maxDrops: d = p(80), topDown: f = p(!0), height: g = p(1), scale: _ = p(2), sunIntensity: v = p(.85), sunAngle: y = p(.85), raySpread: b = p(1), rayTwinkle: x = p(.45), rayTwinkleSpeed: S = p(1), resolution: C, ...w } = h(t), T = p([1e3, 1e3]), D = p(T()[0]), O = p(T()[1]), k = p(0), A = p(0), j, M = typeof n == "function" ? n : p(n), N = C ? typeof C == "function" ? C : p(C) : T;
4148
4254
  u((e) => {
4149
4255
  let t = e.props.context, n = e.parent, r = !1;
4150
4256
  for (; n;) {
@@ -4154,163 +4260,223 @@ var an = {
4154
4260
  }
4155
4261
  n = n.parent;
4156
4262
  }
4157
- if (k = r ? t?.viewport : void 0, k?.getVisibleBounds) {
4158
- let e = k.getVisibleBounds();
4159
- e && e.width > 0 && e.height > 0 && (C.set([e.width, e.height]), w.set(e.width), T.set(e.height), D.set(e.x), O.set(e.y));
4263
+ if (j = r ? t?.viewport : void 0, j?.getVisibleBounds) {
4264
+ let e = j.getVisibleBounds();
4265
+ e && e.width > 0 && e.height > 0 && (T.set([e.width, e.height]), D.set(e.width), O.set(e.height), k.set(e.x), A.set(e.y));
4160
4266
  }
4161
4267
  t?.canvasSize && s(() => {
4162
4268
  let e = t.canvasSize();
4163
- e && e.width > 0 && e.height > 0 && (k?.getVisibleBounds || (C.set([e.width, e.height]), w.set(e.width), T.set(e.height), D.set(0), O.set(0)));
4269
+ e && e.width > 0 && e.height > 0 && (j?.getVisibleBounds || (T.set([e.width, e.height]), D.set(e.width), O.set(e.height), k.set(0), A.set(0)));
4164
4270
  });
4165
4271
  });
4166
- let M = typeof n == "function" ? n : p(n), N = typeof i == "function" ? i : p(i), P = typeof a == "function" ? a : p(a), F = typeof o == "function" ? o : p(o), I = typeof l == "function" ? l : p(l), te = typeof d == "function" ? d : p(d), R = typeof f == "function" ? f : p(f), z = typeof g == "function" ? g : p(g), ne = typeof _ == "function" ? _ : p(_), re = typeof v == "function" ? v : p(v), ie = typeof y == "function" ? y : p(y), ae = typeof b == "function" ? b : p(b), oe = (e) => typeof e == "number" && Number.isFinite(e) ? e : 1, se = (e) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : .85, ce = (e) => typeof e == "number" && Number.isFinite(e) ? e : .85, le = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : 1, ue = (e) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : .45, de = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : 1, fe = (e) => [Math.cos(e), Math.sin(e)], pe = (e) => Array.isArray(e) ? [typeof e[0] == "number" && Number.isFinite(e[0]) && e[0] > 0 ? e[0] : 1, typeof e[1] == "number" && Number.isFinite(e[1]) && e[1] > 0 ? e[1] : 1] : [1, 1], me, B;
4167
- if (A() === "rain") me = en(), B = {
4168
- uTime: {
4169
- value: 0,
4170
- type: "f32"
4272
+ let P = typeof i == "function" ? i : p(i), F = typeof a == "function" ? a : p(a), I = typeof o == "function" ? o : p(o), L = typeof l == "function" ? l : p(l), ne = typeof d == "function" ? d : p(d), re = typeof f == "function" ? f : p(f), R = typeof g == "function" ? g : p(g), ie = typeof _ == "function" ? _ : p(_), ae = typeof v == "function" ? v : p(v), oe = typeof y == "function" ? y : p(y), se = typeof b == "function" ? b : p(b), ce = typeof x == "function" ? x : p(x), le = typeof S == "function" ? S : p(S), ue = (e) => typeof e == "number" && Number.isFinite(e) ? e : 1, de = (e) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : .85, fe = (e) => typeof e == "number" && Number.isFinite(e) ? e : .85, pe = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : 1, me = (e) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : .45, he = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : 1, ge = (e) => e === !1 || e === 0 ? 0 : 1, z = (e) => [Math.cos(e), Math.sin(e)], _e = (e) => Array.isArray(e) ? [typeof e[0] == "number" && Number.isFinite(e[0]) && e[0] > 0 ? e[0] : 1, typeof e[1] == "number" && Number.isFinite(e[1]) && e[1] > 0 ? e[1] : 1] : [1, 1];
4273
+ if (M() === "rain") return c(e, {
4274
+ ...w,
4275
+ width: D,
4276
+ height: O,
4277
+ x: k,
4278
+ y: A
4279
+ }, c(dn, {
4280
+ texture: un(11),
4281
+ width: D,
4282
+ height: O,
4283
+ speed: P,
4284
+ windDirection: F,
4285
+ windStrength: I,
4286
+ density: L,
4287
+ maxDrops: ne,
4288
+ topDown: re,
4289
+ fallScale: 1.08,
4290
+ topDownTileScale: {
4291
+ x: .92,
4292
+ y: .92
4171
4293
  },
4172
- uResolution: {
4173
- value: pe(j()),
4174
- type: "vec2<f32>"
4294
+ sideTileScale: {
4295
+ x: 1.08,
4296
+ y: 1.18
4175
4297
  },
4176
- uRainSpeed: {
4177
- value: M(),
4178
- type: "f32"
4298
+ topDownAlpha: .58,
4299
+ sideAlpha: .48,
4300
+ blendMode: "screen",
4301
+ startX: 0,
4302
+ startY: 0
4303
+ }), c(dn, {
4304
+ texture: un(29),
4305
+ width: D,
4306
+ height: O,
4307
+ speed: P,
4308
+ windDirection: F,
4309
+ windStrength: I,
4310
+ density: L,
4311
+ maxDrops: ne,
4312
+ topDown: re,
4313
+ fallScale: .82,
4314
+ topDownTileScale: {
4315
+ x: 1.25,
4316
+ y: 1.25
4179
4317
  },
4180
- uWindDirection: {
4181
- value: N(),
4182
- type: "f32"
4318
+ sideTileScale: {
4319
+ x: 1.42,
4320
+ y: 1.55
4183
4321
  },
4184
- uWindStrength: {
4185
- value: P(),
4186
- type: "f32"
4322
+ topDownAlpha: .38,
4323
+ sideAlpha: .3,
4324
+ blendMode: "screen",
4325
+ startX: 53,
4326
+ startY: 37
4327
+ }), c(dn, {
4328
+ texture: un(47),
4329
+ width: D,
4330
+ height: O,
4331
+ speed: P,
4332
+ windDirection: F,
4333
+ windStrength: I,
4334
+ density: L,
4335
+ maxDrops: ne,
4336
+ topDown: re,
4337
+ fallScale: .64,
4338
+ topDownTileScale: {
4339
+ x: 1.7,
4340
+ y: 1.7
4187
4341
  },
4188
- uRainDensity: {
4189
- value: F(),
4190
- type: "f32"
4342
+ sideTileScale: {
4343
+ x: 1.9,
4344
+ y: 2.1
4191
4345
  },
4192
- uMaxDrops: {
4193
- value: I(),
4194
- type: "f32"
4195
- }
4196
- };
4197
- else if (A() === "snow") me = tn(), B = {
4346
+ topDownAlpha: .24,
4347
+ sideAlpha: .18,
4348
+ blendMode: "screen",
4349
+ startX: 101,
4350
+ startY: 73
4351
+ }), c(fn, {
4352
+ width: D,
4353
+ height: O,
4354
+ speed: P,
4355
+ density: L,
4356
+ maxDrops: ne,
4357
+ topDown: re,
4358
+ windDirection: F,
4359
+ windStrength: I,
4360
+ blendMode: "screen"
4361
+ }));
4362
+ let B, ve;
4363
+ if (M() === "snow") B = an(), ve = {
4198
4364
  uTime: {
4199
4365
  value: 0,
4200
4366
  type: "f32"
4201
4367
  },
4202
4368
  uResolution: {
4203
- value: pe(j()),
4369
+ value: _e(N()),
4204
4370
  type: "vec2<f32>"
4205
4371
  },
4206
4372
  uSnowSpeed: {
4207
- value: M(),
4373
+ value: P(),
4208
4374
  type: "f32"
4209
4375
  },
4210
4376
  uWindDirection: {
4211
- value: N(),
4377
+ value: F(),
4212
4378
  type: "f32"
4213
4379
  },
4214
4380
  uWindStrength: {
4215
- value: P(),
4381
+ value: I(),
4216
4382
  type: "f32"
4217
4383
  },
4218
4384
  uSnowDensity: {
4219
- value: F(),
4385
+ value: L(),
4220
4386
  type: "f32"
4221
4387
  },
4222
4388
  uMaxFlakes: {
4223
- value: I(),
4389
+ value: ne(),
4224
4390
  type: "f32"
4225
4391
  }
4226
4392
  };
4227
- else if (A() === "fog") me = nn(), B = {
4393
+ else if (M() === "fog") B = on(), ve = {
4228
4394
  uTime: {
4229
4395
  value: 0,
4230
4396
  type: "f32"
4231
4397
  },
4232
4398
  uResolution: {
4233
- value: pe(j()),
4399
+ value: _e(N()),
4234
4400
  type: "vec2<f32>"
4235
4401
  },
4236
4402
  uSpeed: {
4237
- value: M(),
4403
+ value: P(),
4238
4404
  type: "f32"
4239
4405
  },
4240
4406
  uScale: {
4241
- value: R(),
4407
+ value: ie(),
4242
4408
  type: "f32"
4243
4409
  },
4244
4410
  uDensity: {
4245
- value: F(),
4411
+ value: L(),
4246
4412
  type: "f32"
4247
4413
  },
4248
4414
  uHeight: {
4249
- value: oe(te()),
4415
+ value: ue(R()),
4250
4416
  type: "f32"
4251
4417
  },
4252
4418
  uViewportOrigin: {
4253
- value: [D(), O()],
4419
+ value: [k(), A()],
4254
4420
  type: "vec2<f32>"
4255
4421
  }
4256
4422
  };
4257
- else if (A() === "cloud") {
4258
- let e = ce(ne());
4259
- me = rn(), B = {
4423
+ else if (M() === "cloud") {
4424
+ let e = fe(oe());
4425
+ B = sn(), ve = {
4260
4426
  uTime: {
4261
4427
  value: 0,
4262
4428
  type: "f32"
4263
4429
  },
4264
4430
  uResolution: {
4265
- value: pe(j()),
4431
+ value: _e(N()),
4266
4432
  type: "vec2<f32>"
4267
4433
  },
4268
4434
  uSpeed: {
4269
- value: M(),
4435
+ value: P(),
4270
4436
  type: "f32"
4271
4437
  },
4272
4438
  uScale: {
4273
- value: R(),
4439
+ value: ie(),
4274
4440
  type: "f32"
4275
4441
  },
4276
4442
  uDensity: {
4277
- value: F(),
4443
+ value: L(),
4278
4444
  type: "f32"
4279
4445
  },
4280
4446
  uHeight: {
4281
- value: oe(te()),
4447
+ value: ue(R()),
4282
4448
  type: "f32"
4283
4449
  },
4284
4450
  uViewportOrigin: {
4285
- value: [D(), O()],
4451
+ value: [k(), A()],
4286
4452
  type: "vec2<f32>"
4287
4453
  },
4288
4454
  uSunIntensity: {
4289
- value: se(z()),
4455
+ value: de(ae()),
4290
4456
  type: "f32"
4291
4457
  },
4292
4458
  uSunDirection: {
4293
- value: fe(e),
4459
+ value: z(e),
4294
4460
  type: "vec2<f32>"
4295
4461
  },
4296
4462
  uRaySpread: {
4297
- value: le(re()),
4463
+ value: pe(se()),
4298
4464
  type: "f32"
4299
4465
  },
4300
4466
  uRayTwinkle: {
4301
- value: ue(ie()),
4467
+ value: me(ce()),
4302
4468
  type: "f32"
4303
4469
  },
4304
4470
  uRayTwinkleSpeed: {
4305
- value: de(ae()),
4471
+ value: he(le()),
4306
4472
  type: "f32"
4307
4473
  }
4308
4474
  };
4309
- } else throw Error(`Unknown weather effect: ${A()}. Supported: rain, snow, fog, cloud`);
4310
- let V = new L(B), he = new ee({
4311
- glProgram: me,
4475
+ } else throw Error(`Unknown weather effect: ${M()}. Supported: rain, snow, fog, cloud`);
4476
+ let V = new te(ve), ye = new ee({
4477
+ glProgram: B,
4312
4478
  resources: { uniforms: V }
4313
- }), H = new E({
4479
+ }), be = new E({
4314
4480
  attributes: {
4315
4481
  aPosition: [
4316
4482
  0,
@@ -4341,126 +4507,128 @@ var an = {
4341
4507
  2,
4342
4508
  3
4343
4509
  ]
4344
- }), ge = Math.random() * 10, _e = [...pe(j())], ve = N(), U = P(), ye = M(), be = F(), xe = I(), Se = te(), Ce = R(), we = se(z()), Te = ce(ne()), Ee = le(re()), De = ue(ie()), Oe = de(ae()), ke = D(), Ae = O();
4510
+ }), H = Math.random() * 10, xe = [..._e(N())], Se = F(), Ce = I(), we = P(), Te = L(), Ee = ne(), De = ge(re()), Oe = R(), ke = ie(), Ae = de(ae()), je = fe(oe()), Me = pe(se()), Ne = me(ce()), Pe = he(le()), Fe = k(), U = A();
4345
4511
  return m(({ deltaTime: e }) => {
4346
- if (k?.getVisibleBounds) {
4347
- let e = k.getVisibleBounds();
4512
+ if (j?.getVisibleBounds) {
4513
+ let e = j.getVisibleBounds();
4348
4514
  if (e && e.width > 0 && e.height > 0) {
4349
4515
  let t = e.width, n = e.height, r = e.x, i = e.y;
4350
- t !== w() && w.set(t), n !== T() && T.set(n), r !== D() && D.set(r), i !== O() && O.set(i);
4351
- let a = C();
4352
- (a[0] !== t || a[1] !== n) && C.set([t, n]);
4516
+ t !== D() && D.set(t), n !== O() && O.set(n), r !== k() && k.set(r), i !== A() && A.set(i);
4517
+ let a = T();
4518
+ (a[0] !== t || a[1] !== n) && T.set([t, n]);
4353
4519
  }
4354
4520
  }
4355
- ge += e / 600, V.uniforms.uTime = ge;
4356
- let t = pe(j());
4357
- if ((t[0] !== _e[0] || t[1] !== _e[1]) && (V.uniforms.uResolution = t, _e = [...t]), A() === "fog" || A() === "cloud") {
4358
- let e = D(), t = O();
4359
- (e !== ke || t !== Ae) && (V.uniforms.uViewportOrigin = [e, t], ke = e, Ae = t);
4521
+ H += e / 600, V.uniforms.uTime = H;
4522
+ let t = _e(N());
4523
+ if ((t[0] !== xe[0] || t[1] !== xe[1]) && (V.uniforms.uResolution = t, xe = [...t]), M() === "fog" || M() === "cloud") {
4524
+ let e = k(), t = A();
4525
+ (e !== Fe || t !== U) && (V.uniforms.uViewportOrigin = [e, t], Fe = e, U = t);
4360
4526
  }
4361
- let n = N();
4362
- if (n !== ve && (V.uniforms.uWindDirection = n, ve = n), A() === "rain" || A() === "snow") {
4363
- let e = P();
4364
- e !== U && (V.uniforms.uWindStrength = e, U = e);
4527
+ let n = F();
4528
+ if (n !== Se && (V.uniforms.uWindDirection = n, Se = n), M() === "rain" || M() === "snow") {
4529
+ let e = I();
4530
+ e !== Ce && (V.uniforms.uWindStrength = e, Ce = e);
4365
4531
  }
4366
- if (A() === "rain") {
4367
- let e = M();
4368
- e !== ye && (V.uniforms.uRainSpeed = e, ye = e);
4369
- let t = F();
4370
- t !== be && (V.uniforms.uRainDensity = t, be = t);
4371
- let n = I();
4372
- n !== xe && (V.uniforms.uMaxDrops = n, xe = n);
4373
- } else if (A() === "snow") {
4374
- let e = M();
4375
- e !== ye && (V.uniforms.uSnowSpeed = e, ye = e);
4376
- let t = F();
4377
- t !== be && (V.uniforms.uSnowDensity = t, be = t);
4378
- let n = I();
4379
- n !== xe && (V.uniforms.uMaxFlakes = n, xe = n);
4380
- } else if (A() === "fog" || A() === "cloud") {
4381
- let e = M();
4382
- e !== ye && (V.uniforms.uSpeed = e, ye = e);
4383
- let t = R();
4384
- t !== Ce && (V.uniforms.uScale = t, Ce = t);
4385
- let n = F();
4386
- n !== be && (V.uniforms.uDensity = n, be = n);
4387
- let r = oe(te());
4388
- if (r !== Se && (V.uniforms.uHeight = r, Se = r), A() === "cloud") {
4389
- let e = se(z());
4390
- e !== we && (V.uniforms.uSunIntensity = e, we = e);
4391
- let t = ce(ne());
4392
- t !== Te && (V.uniforms.uSunDirection = fe(t), Te = t);
4393
- let n = le(re());
4394
- n !== Ee && (V.uniforms.uRaySpread = n, Ee = n);
4395
- let r = ue(ie());
4396
- r !== De && (V.uniforms.uRayTwinkle = r, De = r);
4397
- let i = de(ae());
4398
- i !== Oe && (V.uniforms.uRayTwinkleSpeed = i, Oe = i);
4532
+ if (M() === "rain") {
4533
+ let e = P();
4534
+ e !== we && (V.uniforms.uRainSpeed = e, we = e);
4535
+ let t = L();
4536
+ t !== Te && (V.uniforms.uRainDensity = t, Te = t);
4537
+ let n = ne();
4538
+ n !== Ee && (V.uniforms.uMaxDrops = n, Ee = n);
4539
+ let r = ge(re());
4540
+ r !== De && (V.uniforms.uRainTopDown = r, De = r);
4541
+ } else if (M() === "snow") {
4542
+ let e = P();
4543
+ e !== we && (V.uniforms.uSnowSpeed = e, we = e);
4544
+ let t = L();
4545
+ t !== Te && (V.uniforms.uSnowDensity = t, Te = t);
4546
+ let n = ne();
4547
+ n !== Ee && (V.uniforms.uMaxFlakes = n, Ee = n);
4548
+ } else if (M() === "fog" || M() === "cloud") {
4549
+ let e = P();
4550
+ e !== we && (V.uniforms.uSpeed = e, we = e);
4551
+ let t = ie();
4552
+ t !== ke && (V.uniforms.uScale = t, ke = t);
4553
+ let n = L();
4554
+ n !== Te && (V.uniforms.uDensity = n, Te = n);
4555
+ let r = ue(R());
4556
+ if (r !== Oe && (V.uniforms.uHeight = r, Oe = r), M() === "cloud") {
4557
+ let e = de(ae());
4558
+ e !== Ae && (V.uniforms.uSunIntensity = e, Ae = e);
4559
+ let t = fe(oe());
4560
+ t !== je && (V.uniforms.uSunDirection = z(t), je = t);
4561
+ let n = pe(se());
4562
+ n !== Me && (V.uniforms.uRaySpread = n, Me = n);
4563
+ let r = me(ce());
4564
+ r !== Ne && (V.uniforms.uRayTwinkle = r, Ne = r);
4565
+ let i = he(le());
4566
+ i !== Pe && (V.uniforms.uRayTwinkleSpeed = i, Pe = i);
4399
4567
  }
4400
4568
  }
4401
4569
  }), c(r, {
4402
- ...S,
4403
- geometry: H,
4404
- shader: he,
4405
- width: w,
4406
- height: T,
4407
- x: D,
4408
- y: O
4570
+ ...w,
4571
+ geometry: be,
4572
+ shader: ye,
4573
+ width: D,
4574
+ height: O,
4575
+ x: k,
4576
+ y: A
4409
4577
  });
4410
- }, dn = un, fn = [
4578
+ }, yn = vn, bn = [
4411
4579
  0,
4412
4580
  0,
4413
4581
  0,
4414
4582
  1
4415
- ], pn = [
4583
+ ], xn = [
4416
4584
  0,
4417
4585
  0,
4418
4586
  0,
4419
4587
  .55
4420
- ], mn = {
4588
+ ], Sn = {
4421
4589
  clarity: 0,
4422
4590
  explored: !1
4423
- }, hn = () => mn, gn = /* @__PURE__ */ new WeakMap(), _n = (e, t, n) => Math.max(t, Math.min(n, e)), vn = (e, t, n) => {
4591
+ }, Cn = () => Sn, wn = /* @__PURE__ */ new WeakMap(), Tn = (e, t, n) => Math.max(t, Math.min(n, e)), En = (e, t, n) => {
4424
4592
  if (t <= e) return +(n >= t);
4425
- let r = _n((n - e) / (t - e), 0, 1);
4593
+ let r = Tn((n - e) / (t - e), 0, 1);
4426
4594
  return r * r * (3 - 2 * r);
4427
4595
  }, q = (e) => typeof e == "function" ? e() : e;
4428
- function yn() {
4429
- let e = p(0), t = hn, n = (n, r) => (e(), !Number.isFinite(n) || !Number.isFinite(r) ? mn : t(n, r)), r = {
4596
+ function Dn() {
4597
+ let e = p(0), t = Cn, n = (n, r) => (e(), !Number.isFinite(n) || !Number.isFinite(r) ? Sn : t(n, r)), r = {
4430
4598
  version: () => e(),
4431
- clarityAt: (e, t) => _n(n(e, t).clarity, 0, 1),
4432
- isVisibleAt: (e, t, r = .65) => n(e, t).clarity >= _n(r, 0, 1),
4599
+ clarityAt: (e, t) => Tn(n(e, t).clarity, 0, 1),
4600
+ isVisibleAt: (e, t, r = .65) => n(e, t).clarity >= Tn(r, 0, 1),
4433
4601
  isExploredAt: (e, t) => {
4434
4602
  let r = n(e, t);
4435
4603
  return r.explored || r.clarity > 0;
4436
4604
  },
4437
4605
  stateAt: (e, t, r = .65) => {
4438
4606
  let i = n(e, t);
4439
- return i.clarity >= _n(r, 0, 1) ? "visible" : i.explored || i.clarity > 0 ? "explored" : "unknown";
4607
+ return i.clarity >= Tn(r, 0, 1) ? "visible" : i.explored || i.clarity > 0 ? "explored" : "unknown";
4440
4608
  }
4441
4609
  };
4442
- return gn.set(r, {
4610
+ return wn.set(r, {
4443
4611
  setSampler(e) {
4444
- t = typeof e == "function" ? e : hn;
4612
+ t = typeof e == "function" ? e : Cn;
4445
4613
  },
4446
4614
  notifyUpdate() {
4447
4615
  e.update((e) => e + 1);
4448
4616
  }
4449
4617
  }), r;
4450
4618
  }
4451
- var bn = (e, t) => {
4452
- let [n, r, i, a] = Array.isArray(e) ? e : t, o = (e, t = !1) => Number.isFinite(e) ? e >= 0 && e <= 1 ? Math.round(e * 255) : _n(Math.round(e), 0, 255) : t ? 255 : 0;
4619
+ var On = (e, t) => {
4620
+ let [n, r, i, a] = Array.isArray(e) ? e : t, o = (e, t = !1) => Number.isFinite(e) ? e >= 0 && e <= 1 ? Math.round(e * 255) : Tn(Math.round(e), 0, 255) : t ? 255 : 0;
4453
4621
  return {
4454
4622
  r: o(n),
4455
4623
  g: o(r),
4456
4624
  b: o(i),
4457
4625
  a: o(a, !0)
4458
4626
  };
4459
- }, xn = (e) => {
4627
+ }, kn = (e) => {
4460
4628
  let t = q(e);
4461
4629
  return Array.isArray(t) ? t : [];
4462
4630
  };
4463
- function Sn(e) {
4631
+ function An(e) {
4464
4632
  let { mapWidth: t, mapHeight: n, tileSize: r = p(32), smooth: a = p(!0), renderScale: o = p(2), edgeSoftness: s = p(22), visionSources: l = p([]), colors: u = p({}), updateHz: d = p(15), initialExplored: f = p(!1), controller: g = void 0, obstacleMap: _ = void 0, ...v } = h(e), y, b = null, x = F.WHITE, S = null, C = null, w = new Float32Array(), T = new Uint8Array(), E = 1, D = 1, O = 1, k = 1, A = 1, j = 1, M = 1, ee = 1, N = 0, P = !0, I = null, L = null, te = [];
4465
4633
  if (y = (() => {
4466
4634
  if (typeof document > "u") throw Error("FogOfWar: document is undefined, canvas cannot be created.");
@@ -4468,18 +4636,18 @@ function Sn(e) {
4468
4636
  return e.width = 1, e.height = 1, e;
4469
4637
  })(), b = y.getContext("2d", { willReadFrequently: !0 }), !b) throw Error("FogOfWar: unable to create 2D context for fog canvas.");
4470
4638
  x = F.from(y);
4471
- let R = () => {
4639
+ let ne = () => {
4472
4640
  let e = q(a) === !1 ? 1 : 2, t = Number(q(o));
4473
- return Number.isFinite(t) ? _n(Math.round(t), 1, 8) : e;
4474
- }, z = () => {
4641
+ return Number.isFinite(t) ? Tn(Math.round(t), 1, 8) : e;
4642
+ }, re = () => {
4475
4643
  if (q(a) === !1) return 0;
4476
4644
  let e = Number(q(s));
4477
4645
  return Number.isFinite(e) ? Math.max(0, e) : Math.max(M * .9, 2);
4478
- }, ne = () => {
4646
+ }, R = () => {
4479
4647
  let e = q(g);
4480
4648
  return e && typeof e == "object" ? e : void 0;
4481
- }, re = () => {
4482
- let e = xn(l), t = [];
4649
+ }, ie = () => {
4650
+ let e = kn(l), t = [];
4483
4651
  for (let n = 0; n < e.length; n++) {
4484
4652
  let r = e[n];
4485
4653
  t.push({
@@ -4490,7 +4658,7 @@ function Sn(e) {
4490
4658
  });
4491
4659
  }
4492
4660
  return t;
4493
- }, ie = (e) => {
4661
+ }, ae = (e) => {
4494
4662
  let t = Array(e.length * 4), n = 0;
4495
4663
  for (let r = 0; r < e.length; r++) {
4496
4664
  let i = e[r];
@@ -4505,54 +4673,54 @@ function Sn(e) {
4505
4673
  }
4506
4674
  }
4507
4675
  return te = t, r;
4508
- }, ae = (e, t) => {
4509
- if (!Number.isFinite(e) || !Number.isFinite(t) || O <= 0 || E <= 0 || D <= 0) return mn;
4510
- let n = _n(e, 0, Math.max(0, k - 1)), r = _n(t, 0, Math.max(0, A - 1)), i = Math.min(E - 1, Math.max(0, Math.floor(n / M))), a = Math.min(D - 1, Math.max(0, Math.floor(r / M))) * E + i;
4676
+ }, oe = (e, t) => {
4677
+ if (!Number.isFinite(e) || !Number.isFinite(t) || O <= 0 || E <= 0 || D <= 0) return Sn;
4678
+ let n = Tn(e, 0, Math.max(0, k - 1)), r = Tn(t, 0, Math.max(0, A - 1)), i = Math.min(E - 1, Math.max(0, Math.floor(n / M))), a = Math.min(D - 1, Math.max(0, Math.floor(r / M))) * E + i;
4511
4679
  return {
4512
- clarity: _n(w[a] ?? 0, 0, 1),
4680
+ clarity: Tn(w[a] ?? 0, 0, 1),
4513
4681
  explored: T[a] === 1
4514
4682
  };
4515
- }, oe = (e) => {
4516
- let t = ne() ?? null;
4517
- t !== I && (L && L.setSampler(hn), I = t, L = I ? gn.get(I) ?? null : null, L && L.setSampler(ae), e = !0), e && L && L.notifyUpdate();
4518
- }, se = () => {
4683
+ }, se = (e) => {
4684
+ let t = R() ?? null;
4685
+ t !== I && (L && L.setSampler(Cn), I = t, L = I ? wn.get(I) ?? null : null, L && L.setSampler(oe), e = !0), e && L && L.notifyUpdate();
4686
+ }, ce = () => {
4519
4687
  let e = x.source;
4520
4688
  e && (e.scaleMode = q(a) === !1 ? "nearest" : "linear");
4521
- }, ce = (e, t, n, r) => {
4522
- k = Math.max(1, Math.floor(e)), A = Math.max(1, Math.floor(t)), j = Math.max(1, Math.floor(n)), ee = _n(r, 1, 8), M = Math.max(1, j / ee), E = Math.max(1, Math.ceil(k / M)), D = Math.max(1, Math.ceil(A / M)), O = E * D, "width" in y && (y.width = E, y.height = D), w = new Float32Array(O), T = new Uint8Array(O), q(f) && T.fill(1), S = b?.createImageData(E, D) ?? null, C = S?.data ?? null, se(), P = !0;
4523
- }, le = (e, t) => {
4689
+ }, le = (e, t, n, r) => {
4690
+ k = Math.max(1, Math.floor(e)), A = Math.max(1, Math.floor(t)), j = Math.max(1, Math.floor(n)), ee = Tn(r, 1, 8), M = Math.max(1, j / ee), E = Math.max(1, Math.ceil(k / M)), D = Math.max(1, Math.ceil(A / M)), O = E * D, "width" in y && (y.width = E, y.height = D), w = new Float32Array(O), T = new Uint8Array(O), q(f) && T.fill(1), S = b?.createImageData(E, D) ?? null, C = S?.data ?? null, ce(), P = !0;
4691
+ }, ue = (e, t) => {
4524
4692
  if (e.enabled === !1 || !Number.isFinite(e.x) || !Number.isFinite(e.y) || !Number.isFinite(e.radius) || e.radius <= 0) return;
4525
4693
  let n = e.x, r = e.y, i = e.radius / M, a = Math.max(0, i - t), o = Math.max(i, i + t), s = a * a, c = o * o, l = Math.max(0, Math.floor(n / M - o)), u = Math.min(E - 1, Math.ceil(n / M + o)), d = Math.max(0, Math.floor(r / M - o)), f = Math.min(D - 1, Math.ceil(r / M + o));
4526
4694
  for (let e = d; e <= f; e++) for (let t = l; t <= u; t++) {
4527
4695
  let i = (t + .5) * M, l = (e + .5) * M, u = i - n, d = l - r, f = (u * u + d * d) / (M * M);
4528
4696
  if (f > c) continue;
4529
4697
  let p = 1;
4530
- if (o > a && f > s && (p = 1 - vn(a, o, Math.sqrt(f))), p <= .001) continue;
4698
+ if (o > a && f > s && (p = 1 - En(a, o, Math.sqrt(f))), p <= .001) continue;
4531
4699
  let m = e * E + t;
4532
4700
  p > w[m] && (w[m] = p), p > .02 && (T[m] = 1);
4533
4701
  }
4534
- }, ue = (e) => {
4702
+ }, de = (e) => {
4535
4703
  if (!S || !C || !b) return;
4536
- let t = q(u) || {}, n = bn(t.unknown, fn), r = bn(t.explored, pn);
4704
+ let t = q(u) || {}, n = On(t.unknown, bn), r = On(t.explored, xn);
4537
4705
  w.fill(0);
4538
- let i = e ?? re(), a = z() / M;
4539
- for (let e = 0; e < i.length; e++) le(i[e], a);
4706
+ let i = e ?? ie(), a = re() / M;
4707
+ for (let e = 0; e < i.length; e++) ue(i[e], a);
4540
4708
  for (let e = 0; e < O; e++) {
4541
- let t = e * 4, i = _n(w[e], 0, 1), a = T[e] === 1 ? r : n;
4709
+ let t = e * 4, i = Tn(w[e], 0, 1), a = T[e] === 1 ? r : n;
4542
4710
  C[t] = a.r, C[t + 1] = a.g, C[t + 2] = a.b, C[t + 3] = Math.round(a.a * (1 - i));
4543
4711
  }
4544
4712
  b.putImageData(S, 0, 0);
4545
4713
  let o = x.source;
4546
- o && typeof o.update == "function" ? o.update() : typeof x.update == "function" && x.update(), oe(!0);
4714
+ o && typeof o.update == "function" ? o.update() : typeof x.update == "function" && x.update(), se(!0);
4547
4715
  };
4548
- return ce(Number(q(t)) || 1, Number(q(n)) || 1, Number(q(r)) || 32, R()), ue(), m(({ deltaTime: e }) => {
4716
+ return le(Number(q(t)) || 1, Number(q(n)) || 1, Number(q(r)) || 32, ne()), de(), m(({ deltaTime: e }) => {
4549
4717
  if (!b) return;
4550
- let i = Math.max(1, Number(q(t)) || 1), a = Math.max(1, Number(q(n)) || 1), o = Math.max(1, Number(q(r)) || 32), s = R();
4551
- (i !== k || a !== A || o !== j || s !== ee) && ce(i, a, o, s), se(), oe(!1);
4552
- let c = re(), l = ie(c);
4718
+ let i = Math.max(1, Number(q(t)) || 1), a = Math.max(1, Number(q(n)) || 1), o = Math.max(1, Number(q(r)) || 32), s = ne();
4719
+ (i !== k || a !== A || o !== j || s !== ee) && le(i, a, o, s), ce(), se(!1);
4720
+ let c = ie(), l = ae(c);
4553
4721
  l && (P = !0);
4554
4722
  let u = 1e3 / Math.max(1, Number(q(d)) || 15);
4555
- N += e, (P || l || N >= u) && (N = 0, P = !1, ue(c));
4723
+ N += e, (P || l || N >= u) && (N = 0, P = !1, de(c));
4556
4724
  }), c(i, {
4557
4725
  ...v,
4558
4726
  texture: x,
@@ -4565,7 +4733,7 @@ function Sn(e) {
4565
4733
  }
4566
4734
  //#endregion
4567
4735
  //#region src/shaders/shadowGradient.frag.glsl?raw
4568
- var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha near the caster's feet (vTextureCoord.y ~ 1),\n * softer alpha at the shadow tip (vTextureCoord.y ~ 0).\n */\nprecision highp float;\nprecision highp int;\n\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uPower;\nuniform float uFloor;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n float gradient = pow(clamp(vTextureCoord.y, 0.0, 1.0), max(0.001, uPower));\n float alphaMul = mix(clamp(uFloor, 0.0, 1.0), 1.0, gradient);\n finalColor = vec4(color.rgb, color.a * alphaMul);\n}\n", wn = "__spriteShadowManaged", Tn = 220, En = 360, Dn = 1, On = "strongest", kn = 30, An = 0, jn = {
4736
+ var jn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha near the caster's feet (vTextureCoord.y ~ 1),\n * softer alpha at the shadow tip (vTextureCoord.y ~ 0).\n */\nprecision highp float;\nprecision highp int;\n\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uPower;\nuniform float uFloor;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n float gradient = pow(clamp(vTextureCoord.y, 0.0, 1.0), max(0.001, uPower));\n float alphaMul = mix(clamp(uFloor, 0.0, 1.0), 1.0, gradient);\n finalColor = vec4(color.rgb, color.a * alphaMul);\n}\n", Mn = "__spriteShadowManaged", Nn = 220, Pn = 360, Fn = 1, In = "strongest", Ln = 30, Rn = 0, zn = {
4569
4737
  height: 72,
4570
4738
  footOffset: {
4571
4739
  x: 0,
@@ -4591,20 +4759,20 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4591
4759
  return;
4592
4760
  }
4593
4761
  return e;
4594
- }, Mn = (e) => {
4762
+ }, Bn = (e) => {
4595
4763
  if (typeof e == "number" && Number.isFinite(e)) return Math.max(0, Math.floor(e)) & 16777215;
4596
4764
  if (typeof e == "string") {
4597
4765
  let t = e.trim().replace(/^#/, ""), n = t.length === 3 ? `${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}` : t, r = parseInt(n, 16);
4598
4766
  if (Number.isFinite(r)) return r & 16777215;
4599
4767
  }
4600
- return An;
4601
- }, Nn = (e, t) => {
4768
+ return Rn;
4769
+ }, Vn = (e, t) => {
4602
4770
  let n = X(e), r = Number(n?.x), i = Number(n?.y);
4603
4771
  return {
4604
4772
  x: Y(r) ? r : t.x,
4605
4773
  y: Y(i) ? i : t.y
4606
4774
  };
4607
- }, Pn = (e, t) => {
4775
+ }, Hn = (e, t) => {
4608
4776
  if (e && typeof e.toGlobal == "function") {
4609
4777
  let n = e.toGlobal(t);
4610
4778
  if (Y(n?.x) && Y(n?.y)) return {
@@ -4613,7 +4781,7 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4613
4781
  };
4614
4782
  }
4615
4783
  return t;
4616
- }, Fn = (e, t) => {
4784
+ }, Un = (e, t) => {
4617
4785
  if (e && typeof e.toLocal == "function") {
4618
4786
  let n = e.toLocal(t);
4619
4787
  if (Y(n?.x) && Y(n?.y)) return {
@@ -4622,7 +4790,7 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4622
4790
  };
4623
4791
  }
4624
4792
  return t;
4625
- }, In = (e = 2, t = .06) => {
4793
+ }, Wn = (e = 2, t = .06) => {
4626
4794
  let n = {
4627
4795
  value: e,
4628
4796
  type: "f32"
@@ -4631,8 +4799,8 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4631
4799
  type: "f32"
4632
4800
  }, i = T.from({
4633
4801
  gl: {
4634
- vertex: Ce,
4635
- fragment: Cn
4802
+ vertex: Te,
4803
+ fragment: jn
4636
4804
  },
4637
4805
  resources: { shadowGradientUniforms: {
4638
4806
  uPower: n,
@@ -4642,37 +4810,37 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4642
4810
  return i.setGradient = (e, t) => {
4643
4811
  n.value = Y(e) ? Math.max(.001, e) : 2, r.value = Y(t) ? J(t, 0, 1) : .06;
4644
4812
  }, i;
4645
- }, Ln = (e) => {
4813
+ }, Gn = (e) => {
4646
4814
  if (e === !1 || e == null) return null;
4647
4815
  let t = e === !0 || typeof e != "object" ? {} : e;
4648
4816
  if (X(t.enabled) === !1) return null;
4649
4817
  let n = Number(X(t.height)), r = Number(X(t.alpha)), i = Number(X(t.blur)), a = Number(X(t.gradientPower)), o = Number(X(t.hardness)), s = Number(X(t.minLength)), c = Number(X(t.maxLength)), l = Number(X(t.contactAlpha)), u = Number(X(t.contactScale)), d = Number(X(t.anchorX));
4650
4818
  return {
4651
- height: Y(n) ? Math.max(2, n) : jn.height,
4652
- footOffset: Nn(t.footOffset, jn.footOffset),
4653
- footAnchor: Nn(t.footAnchor, jn.footAnchor),
4654
- alpha: Y(r) ? J(r, 0, 1.5) : jn.alpha,
4655
- blur: Y(i) ? Math.max(0, i) : jn.blur,
4656
- gradientPower: Y(a) ? J(a, .2, 8) : jn.gradientPower,
4657
- hardness: Y(o) ? J(o, 0, 1) : jn.hardness,
4658
- minLength: Y(s) ? Math.max(0, s) : jn.minLength,
4659
- maxLength: Y(c) ? Math.max(2, c) : jn.maxLength,
4660
- contactAlpha: Y(l) ? J(l, 0, 1) : jn.contactAlpha,
4661
- contactScale: Y(u) ? Math.max(.05, u) : jn.contactScale,
4819
+ height: Y(n) ? Math.max(2, n) : zn.height,
4820
+ footOffset: Vn(t.footOffset, zn.footOffset),
4821
+ footAnchor: Vn(t.footAnchor, zn.footAnchor),
4822
+ alpha: Y(r) ? J(r, 0, 1.5) : zn.alpha,
4823
+ blur: Y(i) ? Math.max(0, i) : zn.blur,
4824
+ gradientPower: Y(a) ? J(a, .2, 8) : zn.gradientPower,
4825
+ hardness: Y(o) ? J(o, 0, 1) : zn.hardness,
4826
+ minLength: Y(s) ? Math.max(0, s) : zn.minLength,
4827
+ maxLength: Y(c) ? Math.max(2, c) : zn.maxLength,
4828
+ contactAlpha: Y(l) ? J(l, 0, 1) : zn.contactAlpha,
4829
+ contactScale: Y(u) ? Math.max(.05, u) : zn.contactScale,
4662
4830
  anchorX: Y(d) ? J(d, 0, 1) : void 0
4663
4831
  };
4664
- }, Rn = (e) => {
4665
- if (!e || e[wn]) return null;
4832
+ }, Kn = (e) => {
4833
+ if (!e || e[Mn]) return null;
4666
4834
  let t = typeof e.getElement == "function" ? e.getElement() : null, n = X(e.shadowCaster) ?? X(e.fullProps?.shadowCaster) ?? X(t?.props?.shadowCaster) ?? X(t?.propObservables?.shadowCaster);
4667
- return n === void 0 ? null : Ln(n);
4668
- }, zn = (e) => {
4835
+ return n === void 0 ? null : Gn(n);
4836
+ }, qn = (e) => {
4669
4837
  let t = [], n = [e];
4670
4838
  for (; n.length > 0;) {
4671
4839
  let e = n.pop(), r = Array.isArray(e?.children) ? e.children : [];
4672
4840
  for (let e = 0; e < r.length; e++) {
4673
4841
  let i = r[e];
4674
- if (!i || i[wn]) continue;
4675
- let a = Rn(i);
4842
+ if (!i || i[Mn]) continue;
4843
+ let a = Kn(i);
4676
4844
  a && i.parent && t.push({
4677
4845
  instance: i,
4678
4846
  caster: a
@@ -4680,7 +4848,7 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4680
4848
  }
4681
4849
  }
4682
4850
  return t;
4683
- }, Bn = (e, t) => {
4851
+ }, Jn = (e, t) => {
4684
4852
  let n = X(e);
4685
4853
  if (!Array.isArray(n)) return [];
4686
4854
  let r = [];
@@ -4689,7 +4857,7 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4689
4857
  if (X(i.enabled) === !1) continue;
4690
4858
  let a = Number(X(i.x)), o = Number(X(i.y));
4691
4859
  if (!Y(a) || !Y(o)) continue;
4692
- let s = Number(X(i.z)), c = Number(X(i.radius)), l = Number(X(i.intensity)), u = Number(X(i.shadowWeight)), d = Pn(t, {
4860
+ let s = Number(X(i.z)), c = Number(X(i.radius)), l = Number(X(i.intensity)), u = Number(X(i.shadowWeight)), d = Hn(t, {
4693
4861
  x: a,
4694
4862
  y: o
4695
4863
  });
@@ -4698,14 +4866,14 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4698
4866
  y: o,
4699
4867
  globalX: d.x,
4700
4868
  globalY: d.y,
4701
- z: Y(s) ? Math.max(2, s) : Tn,
4702
- radius: Y(c) ? Math.max(1, c) : En,
4703
- intensity: Y(l) ? J(l, 0, 2) : Dn,
4869
+ z: Y(s) ? Math.max(2, s) : Nn,
4870
+ radius: Y(c) ? Math.max(1, c) : Pn,
4871
+ intensity: Y(l) ? J(l, 0, 2) : Fn,
4704
4872
  shadowWeight: Y(u) ? J(u, 0, 4) : 1
4705
4873
  });
4706
4874
  }
4707
4875
  return r;
4708
- }, Vn = (e, t) => {
4876
+ }, Yn = (e, t) => {
4709
4877
  if (e.length === 0) return null;
4710
4878
  if (e.sort((e, t) => t.influence - e.influence), t === "strongest" || e.length === 1) return e[0];
4711
4879
  let n = e.slice(0, 2), r = 0, i = 0, a = 0, o = 0;
@@ -4721,11 +4889,11 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4721
4889
  length: a / o,
4722
4890
  influence: J(o / n.length, 0, 2)
4723
4891
  };
4724
- }, Hn = (e) => {
4892
+ }, Xn = (e) => {
4725
4893
  e.near.visible = !1, e.far.visible = !1, e.contact.visible = !1;
4726
- }, Un = (e) => {
4894
+ }, Zn = (e) => {
4727
4895
  e.near.destroy(), e.far.destroy(), e.contact.destroy();
4728
- }, Wn = (e, t, n) => {
4896
+ }, Qn = (e, t, n) => {
4729
4897
  let r = new N(), i = new N(), a = new N(), o = new y({
4730
4898
  strength: 2.5,
4731
4899
  quality: 2
@@ -4735,8 +4903,8 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4735
4903
  }), c = new y({
4736
4904
  strength: 2.8,
4737
4905
  quality: 2
4738
- }), l = In(2, .08), u = In(2.8, .02);
4739
- return r.filters = [l, o], i.filters = [u, s], a.filters = [c], r.tint = n, i.tint = n, a.tint = n, r.blendMode = "multiply", i.blendMode = "multiply", a.blendMode = "multiply", r.eventMode = "none", i.eventMode = "none", a.eventMode = "none", r.roundPixels = !0, i.roundPixels = !0, a.roundPixels = !0, r.visible = !1, i.visible = !1, a.visible = !1, r.alpha = 0, i.alpha = 0, r[wn] = !0, i[wn] = !0, a[wn] = !0, t.addChild(a), t.addChild(i), t.addChild(r), {
4906
+ }), l = Wn(2, .08), u = Wn(2.8, .02);
4907
+ return r.filters = [l, o], i.filters = [u, s], a.filters = [c], r.tint = n, i.tint = n, a.tint = n, r.blendMode = "multiply", i.blendMode = "multiply", a.blendMode = "multiply", r.eventMode = "none", i.eventMode = "none", a.eventMode = "none", r.roundPixels = !0, i.roundPixels = !0, a.roundPixels = !0, r.visible = !1, i.visible = !1, a.visible = !1, r.alpha = 0, i.alpha = 0, r[Mn] = !0, i[Mn] = !0, a[Mn] = !0, t.addChild(a), t.addChild(i), t.addChild(r), {
4740
4908
  caster: e,
4741
4909
  parent: t,
4742
4910
  near: r,
@@ -4751,7 +4919,7 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4751
4919
  dirY: 1,
4752
4920
  length: 0
4753
4921
  };
4754
- }, Gn = (e) => {
4922
+ }, $n = (e) => {
4755
4923
  let { caster: t, parent: n, near: r, far: i, contact: a } = e;
4756
4924
  if (!t || t.destroyed || !n) return;
4757
4925
  let o = Y(t.zIndex) ? t.zIndex : 0;
@@ -4762,32 +4930,32 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4762
4930
  n.getChildIndex(e) !== i && n.setChildIndex(e, i);
4763
4931
  };
4764
4932
  s(a), s(i), s(r);
4765
- }, Kn = (e, t, n, r, i) => {
4933
+ }, er = (e, t, n, r, i) => {
4766
4934
  let a = e.caster, o = e.parent;
4767
4935
  if (!a || a.destroyed || !o || o.destroyed) {
4768
- Hn(e);
4936
+ Xn(e);
4769
4937
  return;
4770
4938
  }
4771
4939
  if (a.visible === !1 || Y(a.worldAlpha) && a.worldAlpha <= .001) {
4772
- Hn(e);
4940
+ Xn(e);
4773
4941
  return;
4774
4942
  }
4775
4943
  let s = typeof a.getBounds == "function" ? a.getBounds() : null;
4776
4944
  if (!(s && Y(s.x) && Y(s.y) && Y(s.width) && Y(s.height) && s.width > 0 && s.height > 0)) {
4777
- Hn(e);
4945
+ Xn(e);
4778
4946
  return;
4779
4947
  }
4780
- let c = Math.max(1, Math.abs(Number(a.width)) || Math.abs(s.width)), l = Math.max(1, Math.abs(Number(a.height)) || Math.abs(s.height)), u = Number(a.anchor?.x), d = Number(a.anchor?.y), f = Y(u) ? J(u, 0, 1) : .5, p = Y(d) ? J(d, 0, 1) : 1, m = Y(t.anchorX) ? t.anchorX : f, h = Fn(o, Pn(a, {
4948
+ let c = Math.max(1, Math.abs(Number(a.width)) || Math.abs(s.width)), l = Math.max(1, Math.abs(Number(a.height)) || Math.abs(s.height)), u = Number(a.anchor?.x), d = Number(a.anchor?.y), f = Y(u) ? J(u, 0, 1) : .5, p = Y(d) ? J(d, 0, 1) : 1, m = Y(t.anchorX) ? t.anchorX : f, h = Un(o, Hn(a, {
4781
4949
  x: (t.footAnchor.x - f) * c + t.footOffset.x,
4782
4950
  y: (t.footAnchor.y - p) * l + t.footOffset.y
4783
4951
  })), g = [];
4784
4952
  for (let e = 0; e < n.length; e++) {
4785
4953
  let r = n[e];
4786
4954
  if (r.intensity <= .001 || r.radius <= .001) continue;
4787
- let i = Fn(o, {
4955
+ let i = Un(o, {
4788
4956
  x: r.globalX,
4789
4957
  y: r.globalY
4790
- }), a = h.x - i.x, s = h.y - i.y, c = Math.hypot(a, s), l = J(1 - c / r.radius, 0, 1), u = J(Tn / Math.max(12, r.z), .35, 2.4), d = J(l * l * r.intensity * r.shadowWeight * u, 0, 2.2);
4958
+ }), a = h.x - i.x, s = h.y - i.y, c = Math.hypot(a, s), l = J(1 - c / r.radius, 0, 1), u = J(Nn / Math.max(12, r.z), .35, 2.4), d = J(l * l * r.intensity * r.shadowWeight * u, 0, 2.2);
4791
4959
  if (d <= .001) continue;
4792
4960
  let f = c > 1e-4 ? c : 1, p = a / f, m = s / f, _ = J(c * t.height / Math.max(14, r.z), t.minLength, t.maxLength);
4793
4961
  g.push({
@@ -4797,14 +4965,14 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4797
4965
  length: Y(_) ? _ : t.minLength
4798
4966
  });
4799
4967
  }
4800
- let _ = Vn(g, r);
4968
+ let _ = Yn(g, r);
4801
4969
  if (!_) {
4802
- Hn(e);
4970
+ Xn(e);
4803
4971
  return;
4804
4972
  }
4805
4973
  let v = a.texture;
4806
4974
  if (!v) {
4807
- Hn(e);
4975
+ Xn(e);
4808
4976
  return;
4809
4977
  }
4810
4978
  let y = .34, b = e.dirX + (_.dirX - e.dirX) * y, x = e.dirY + (_.dirY - e.dirY) * y, S = Math.hypot(b, x), C = S > 1e-4 ? b / S : _.dirX, w = S > 1e-4 ? x / S : _.dirY, T = e.length + (_.length - e.length) * .32;
@@ -4812,37 +4980,37 @@ var Cn = "/**\n * Gradient alpha for projected sprite shadows.\n * Strong alpha
4812
4980
  let E = J(T / l, .08, 6), D = J(.62 + E * .08, .5, 1.2), O = J(t.hardness, 0, 1), k = J(_.influence, 0, 1.35), A = J(t.alpha * k, 0, 1), j = Math.max(0, t.blur * (1.15 - O * .55)), M = J(t.gradientPower + (1 - O) * .7, .2, 8), ee = Math.atan2(w, C) + Math.PI / 2;
4813
4981
  e.near.texture = v, e.far.texture = v, e.contact.texture = v, e.near.tint = i, e.far.tint = i, e.contact.tint = i, e.near.anchor.set(m, 1), e.far.anchor.set(m, 1), e.contact.anchor.set(m, 1), e.near.width = c * D, e.near.height = l * Math.max(.12, E * 1.06), e.far.width = e.near.width * 1.02, e.far.height = e.near.height * 1.22, e.near.position.set(h.x, h.y), e.far.position.set(h.x + C * T * .34, h.y + w * T * .34), e.contact.position.set(h.x + C * Math.min(4, T * .06), h.y + w * Math.min(4, T * .06)), e.near.rotation = ee, e.far.rotation = ee, e.contact.rotation = ee, e.near.alpha = J(A * (.74 + O * .2), 0, 1), e.far.alpha = J(A * (.3 + (1 - O) * .2), 0, 1), e.near.visible = e.near.alpha > .001, e.far.visible = e.far.alpha > .001, e.nearBlur.strength = j * (.72 + (1 - k) * .45), e.farBlur.strength = j * (1.45 + (1 - k) * 1.1), e.nearGradient.setGradient(M, .08), e.farGradient.setGradient(M + .65, .03);
4814
4982
  let N = J(t.contactAlpha * k * .85, 0, 1), P = Math.max(4, c * J(t.contactScale * 1.8, .25, 1.3)), F = Math.max(2, l * J(t.contactScale * .62, .08, .56));
4815
- e.contact.width = P * (.92 + E * .18), e.contact.height = F, e.contact.alpha = J(N * (.6 + O * .2), 0, 1), e.contactBlur.strength = j * (.85 + (1 - O) * .25), e.contact.visible = e.contact.alpha > .001, Gn(e);
4983
+ e.contact.width = P * (.92 + E * .18), e.contact.height = F, e.contact.alpha = J(N * (.6 + O * .2), 0, 1), e.contactBlur.strength = j * (.85 + (1 - O) * .25), e.contact.visible = e.contact.alpha > .001, $n(e);
4816
4984
  };
4817
- function qn(t = {}) {
4985
+ function tr(t = {}) {
4818
4986
  let n = h(t), r = () => n.lights ?? n.sources;
4819
4987
  return u((e) => {
4820
4988
  let t = e.props.context, i = t?.viewport ?? e.parent?.componentInstance;
4821
4989
  if (!i || typeof i.addChild != "function") return;
4822
4990
  let a = t?.tick, o = /* @__PURE__ */ new Map(), s = 0, c = !0, l = null, u = () => {
4823
- let e = Mn(X(n.shadowColor)), t = X(n.mode) === "blend2" ? "blend2" : On, a = Bn(r(), i), s = zn(i), c = /* @__PURE__ */ new Set();
4991
+ let e = Bn(X(n.shadowColor)), t = X(n.mode) === "blend2" ? "blend2" : In, a = Jn(r(), i), s = qn(i), c = /* @__PURE__ */ new Set();
4824
4992
  for (let n = 0; n < s.length; n++) {
4825
4993
  let { instance: r, caster: i } = s[n];
4826
4994
  if (!r || !r.parent || r.destroyed) continue;
4827
4995
  c.add(r);
4828
4996
  let l = o.get(r);
4829
- (!l || l.parent !== r.parent) && (l && Un(l), l = Wn(r, r.parent, e), o.set(r, l)), Kn(l, i, a, t, e);
4997
+ (!l || l.parent !== r.parent) && (l && Zn(l), l = Qn(r, r.parent, e), o.set(r, l)), er(l, i, a, t, e);
4830
4998
  }
4831
- for (let [e, t] of o.entries()) (!c.has(e) || !e || e.destroyed) && (Un(t), o.delete(e));
4999
+ for (let [e, t] of o.entries()) (!c.has(e) || !e || e.destroyed) && (Zn(t), o.delete(e));
4832
5000
  };
4833
5001
  return l = a?.observable?.subscribe((e) => {
4834
- let t = e?.value ?? e, r = Number(t?.deltaTime), i = Y(r) ? r : 16.67, a = Number(X(n.updateHz)), o = 1e3 / J(Y(a) ? a : kn, 1, 120);
5002
+ let t = e?.value ?? e, r = Number(t?.deltaTime), i = Y(r) ? r : 16.67, a = Number(X(n.updateHz)), o = 1e3 / J(Y(a) ? a : Ln, 1, 120);
4835
5003
  s += i, (c || s >= o) && (s = 0, c = !1, u());
4836
5004
  }), u(), () => {
4837
5005
  l?.unsubscribe?.();
4838
- for (let e of o.values()) Un(e);
5006
+ for (let e of o.values()) Zn(e);
4839
5007
  o.clear();
4840
5008
  };
4841
5009
  }), c(e);
4842
5010
  }
4843
5011
  //#endregion
4844
5012
  //#region src/Footprints.ts
4845
- var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
5013
+ var nr = "__footprintManaged", rr = "default", ir = 30, ar = 260, or = {
4846
5014
  footAnchor: {
4847
5015
  x: .5,
4848
5016
  y: 1
@@ -4861,10 +5029,10 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
4861
5029
  size: 1,
4862
5030
  alpha: 1,
4863
5031
  blur: 0,
4864
- surface: Yn,
5032
+ surface: rr,
4865
5033
  angleOffset: 0,
4866
5034
  jitter: 8
4867
- }, $n = {
5035
+ }, sr = {
4868
5036
  lifetimeMs: 1800,
4869
5037
  startAlpha: .32,
4870
5038
  endAlpha: 0,
@@ -4876,8 +5044,8 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
4876
5044
  erosionStart: .54,
4877
5045
  depth: .58,
4878
5046
  rimStrength: .14
4879
- }, er = {
4880
- [Yn]: $n,
5047
+ }, cr = {
5048
+ [rr]: sr,
4881
5049
  sand: {
4882
5050
  lifetimeMs: 1650,
4883
5051
  startAlpha: .31,
@@ -4904,10 +5072,10 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
4904
5072
  depth: .72,
4905
5073
  rimStrength: .28
4906
5074
  }
4907
- }, Z = (e, t, n) => Math.max(t, Math.min(n, e)), tr = (e, t, n) => e + (t - e) * n, nr = (e, t, n) => {
5075
+ }, Z = (e, t, n) => Math.max(t, Math.min(n, e)), lr = (e, t, n) => e + (t - e) * n, ur = (e, t, n) => {
4908
5076
  let r = Z((n - e) / Math.max(1e-4, t - e), 0, 1);
4909
5077
  return r * r * (3 - 2 * r);
4910
- }, Q = (e) => typeof e == "number" && Number.isFinite(e), rr = (e) => e === "left" ? "right" : "left", ir = (e) => e * Math.PI / 180, $ = (e) => {
5078
+ }, Q = (e) => typeof e == "number" && Number.isFinite(e), dr = (e) => e === "left" ? "right" : "left", fr = (e) => e * Math.PI / 180, $ = (e) => {
4911
5079
  if (e && typeof e == "object" && "value" in e && Object.keys(e).length <= 2) return e.value;
4912
5080
  if (typeof e == "function") try {
4913
5081
  return e();
@@ -4915,26 +5083,26 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
4915
5083
  return;
4916
5084
  }
4917
5085
  return e;
4918
- }, ar = (e, t) => {
5086
+ }, pr = (e, t) => {
4919
5087
  if (typeof e == "number" && Number.isFinite(e)) return Math.max(0, Math.floor(e)) & 16777215;
4920
5088
  if (typeof e == "string") {
4921
5089
  let t = e.trim().replace(/^#/, ""), n = t.length === 3 ? `${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}` : t, r = parseInt(n, 16);
4922
5090
  if (Number.isFinite(r)) return r & 16777215;
4923
5091
  }
4924
5092
  return t;
4925
- }, or = (e, t) => {
5093
+ }, mr = (e, t) => {
4926
5094
  let n = Z(t, 0, 1), r = Math.round((e >> 16 & 255) * (1 - n)), i = Math.round((e >> 8 & 255) * (1 - n)), a = Math.round((e & 255) * (1 - n));
4927
5095
  return r << 16 | i << 8 | a;
4928
- }, sr = (e, t) => {
5096
+ }, hr = (e, t) => {
4929
5097
  let n = Z(t, 0, 1), r = Math.round((e >> 16 & 255) + (255 - (e >> 16 & 255)) * n), i = Math.round((e >> 8 & 255) + (255 - (e >> 8 & 255)) * n), a = Math.round((e & 255) + (255 - (e & 255)) * n);
4930
5098
  return r << 16 | i << 8 | a;
4931
- }, cr = (e, t) => {
5099
+ }, gr = (e, t) => {
4932
5100
  let n = $(e), r = Number(n?.x), i = Number(n?.y);
4933
5101
  return {
4934
5102
  x: Q(r) ? r : t.x,
4935
5103
  y: Q(i) ? i : t.y
4936
5104
  };
4937
- }, lr = (e, t) => {
5105
+ }, _r = (e, t) => {
4938
5106
  if (e && typeof e.toGlobal == "function") {
4939
5107
  let n = e.toGlobal(t);
4940
5108
  if (Q(n?.x) && Q(n?.y)) return {
@@ -4943,7 +5111,7 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
4943
5111
  };
4944
5112
  }
4945
5113
  return t;
4946
- }, ur = (e, t) => {
5114
+ }, vr = (e, t) => {
4947
5115
  if (e && typeof e.toLocal == "function") {
4948
5116
  let n = e.toLocal(t);
4949
5117
  if (Q(n?.x) && Q(n?.y)) return {
@@ -4952,13 +5120,13 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
4952
5120
  };
4953
5121
  }
4954
5122
  return t;
4955
- }, dr = (e, t) => {
5123
+ }, yr = (e, t) => {
4956
5124
  let n = Number($(e?.lifetimeMs)), r = Number($(e?.startAlpha)), i = Number($(e?.endAlpha)), a = Number($(e?.scale)), o = Number($(e?.blurStart)), s = Number($(e?.blurEnd)), c = Number($(e?.erosionStart)), l = Number($(e?.depth)), u = Number($(e?.rimStrength)), d = $(e?.tint), f = $(e?.blendMode);
4957
5125
  return {
4958
5126
  lifetimeMs: Q(n) ? Math.max(120, n) : t.lifetimeMs,
4959
5127
  startAlpha: Q(r) ? Z(r, 0, 1.5) : t.startAlpha,
4960
5128
  endAlpha: Q(i) ? Z(i, 0, 1.5) : t.endAlpha,
4961
- tint: ar(d, t.tint),
5129
+ tint: pr(d, t.tint),
4962
5130
  blendMode: f ?? t.blendMode,
4963
5131
  scale: Q(a) ? Math.max(.05, a) : t.scale,
4964
5132
  blurStart: Q(o) ? Math.max(0, o) : t.blurStart,
@@ -4967,42 +5135,42 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
4967
5135
  depth: Q(l) ? Z(l, 0, 1) : t.depth,
4968
5136
  rimStrength: Q(u) ? Z(u, 0, 1) : t.rimStrength
4969
5137
  };
4970
- }, fr = (e) => {
5138
+ }, br = (e) => {
4971
5139
  let t = $(e) ?? {}, n = {};
4972
- for (let [e, r] of Object.entries(er)) n[e] = dr(t[e], r);
4973
- for (let [e, r] of Object.entries(t)) n[e] || (n[e] = dr(r, $n));
4974
- return n[Yn] || (n[Yn] = $n), n;
4975
- }, pr = (e, t) => {
5140
+ for (let [e, r] of Object.entries(cr)) n[e] = yr(t[e], r);
5141
+ for (let [e, r] of Object.entries(t)) n[e] || (n[e] = yr(r, sr));
5142
+ return n[rr] || (n[rr] = sr), n;
5143
+ }, xr = (e, t) => {
4976
5144
  if (e === !1 || e == null) return null;
4977
5145
  let n = e === !0 || typeof e != "object" ? {} : e;
4978
5146
  if ($(n.enabled) === !1) return null;
4979
5147
  let r = Number($(n.minStepDistance)), i = Number($(n.minSpeed)), a = Number($(n.stepIntervalMs)), o = Number($(n.size)), s = Number($(n.alpha)), c = Number($(n.blur)), l = Number($(n.angleOffset)), u = Number($(n.jitter)), d = $(n.surface);
4980
5148
  return {
4981
- footAnchor: cr(n.footAnchor, Qn.footAnchor),
4982
- leftOffset: cr(n.leftOffset, Qn.leftOffset),
4983
- rightOffset: cr(n.rightOffset, Qn.rightOffset),
4984
- minStepDistance: Q(r) ? Math.max(2, r) : Qn.minStepDistance,
4985
- minSpeed: Q(i) ? Math.max(0, i) : Qn.minSpeed,
4986
- stepIntervalMs: Q(a) ? Math.max(0, a) : Qn.stepIntervalMs,
4987
- size: Q(o) ? Math.max(.1, o) : Qn.size,
4988
- alpha: Q(s) ? Z(s, 0, 2) : Qn.alpha,
4989
- blur: Q(c) ? Math.max(0, c) : Qn.blur,
5149
+ footAnchor: gr(n.footAnchor, or.footAnchor),
5150
+ leftOffset: gr(n.leftOffset, or.leftOffset),
5151
+ rightOffset: gr(n.rightOffset, or.rightOffset),
5152
+ minStepDistance: Q(r) ? Math.max(2, r) : or.minStepDistance,
5153
+ minSpeed: Q(i) ? Math.max(0, i) : or.minSpeed,
5154
+ stepIntervalMs: Q(a) ? Math.max(0, a) : or.stepIntervalMs,
5155
+ size: Q(o) ? Math.max(.1, o) : or.size,
5156
+ alpha: Q(s) ? Z(s, 0, 2) : or.alpha,
5157
+ blur: Q(c) ? Math.max(0, c) : or.blur,
4990
5158
  surface: typeof d == "string" && d.trim().length > 0 ? d.trim() : t,
4991
- angleOffset: Q(l) ? l : Qn.angleOffset,
4992
- jitter: Q(u) ? Math.max(0, u) : Qn.jitter
5159
+ angleOffset: Q(l) ? l : or.angleOffset,
5160
+ jitter: Q(u) ? Math.max(0, u) : or.jitter
4993
5161
  };
4994
- }, mr = (e, t) => {
4995
- if (!e || e[Jn]) return null;
5162
+ }, Sr = (e, t) => {
5163
+ if (!e || e[nr]) return null;
4996
5164
  let n = typeof e.getElement == "function" ? e.getElement() : null, r = $(e.footprintCaster) ?? $(e.fullProps?.footprintCaster) ?? $(n?.props?.footprintCaster) ?? $(n?.propObservables?.footprintCaster);
4997
- return r === void 0 ? null : pr(r, t);
4998
- }, hr = (e, t) => {
5165
+ return r === void 0 ? null : xr(r, t);
5166
+ }, Cr = (e, t) => {
4999
5167
  let n = [], r = [e];
5000
5168
  for (; r.length > 0;) {
5001
5169
  let e = r.pop(), i = Array.isArray(e?.children) ? e.children : [];
5002
5170
  for (let e = 0; e < i.length; e++) {
5003
5171
  let a = i[e];
5004
- if (!a || a[Jn]) continue;
5005
- let o = mr(a, t);
5172
+ if (!a || a[nr]) continue;
5173
+ let o = Sr(a, t);
5006
5174
  o && a.parent && n.push({
5007
5175
  instance: a,
5008
5176
  caster: o
@@ -5010,7 +5178,7 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
5010
5178
  }
5011
5179
  }
5012
5180
  return n;
5013
- }, gr = (e) => {
5181
+ }, wr = (e) => {
5014
5182
  let t = e?.app;
5015
5183
  if (typeof t == "function") try {
5016
5184
  let e = t();
@@ -5018,18 +5186,18 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
5018
5186
  } catch {}
5019
5187
  let n = globalThis.__PIXI_RENDERER__;
5020
5188
  return n && typeof n.generateTexture == "function" ? n : null;
5021
- }, _r = (e) => {
5189
+ }, Tr = (e) => {
5022
5190
  let t = new k();
5023
5191
  t.ellipse(0, 10, 8.4, 6.1).fill(16777215), t.ellipse(0, -1.4, 6.8, 9.4).fill(16777215), t.circle(-4.7, -12.8, 2).fill(16777215), t.circle(-1.5, -14.6, 1.9).fill(16777215), t.circle(1.5, -15.3, 1.75).fill(16777215), t.circle(4.5, -14.1, 1.45).fill(16777215);
5024
5192
  let n = e.generateTexture(t);
5025
5193
  return t.destroy(), n;
5026
- }, vr = (e, t, n) => {
5194
+ }, Er = (e, t, n) => {
5027
5195
  let r = typeof e.getBounds == "function" ? e.getBounds() : null, i = Math.max(1, Math.abs(Number(e.width)) || Math.abs(Number(r?.width)) || 1), a = Math.max(1, Math.abs(Number(e.height)) || Math.abs(Number(r?.height)) || 1), o = Number(e.anchor?.x), s = Number(e.anchor?.y), c = Q(o) ? Z(o, 0, 1) : .5, l = Q(s) ? Z(s, 0, 1) : 1;
5028
- return ur(t, lr(e, {
5196
+ return vr(t, _r(e, {
5029
5197
  x: (n.footAnchor.x - c) * i,
5030
5198
  y: (n.footAnchor.y - l) * a
5031
5199
  }));
5032
- }, yr = (e, t, n) => {
5200
+ }, Dr = (e, t, n) => {
5033
5201
  let r = Q(t?.zIndex) ? t.zIndex : 0;
5034
5202
  if (e.rimSprite.zIndex = r - .2, e.baseSprite.zIndex = r - .18, e.depthSprite.zIndex = r - .16, n.sortableChildren || !Array.isArray(n.children) || !n.children.includes(t)) return;
5035
5203
  let i = [
@@ -5044,15 +5212,15 @@ var Jn = "__footprintManaged", Yn = "default", Xn = 30, Zn = 260, Qn = {
5044
5212
  n.getChildIndex(r) !== o && n.setChildIndex(r, o);
5045
5213
  }
5046
5214
  };
5047
- function br(t = {}) {
5215
+ function Or(t = {}) {
5048
5216
  let n = h(t);
5049
5217
  return u((e) => {
5050
5218
  let t = e.props.context, r = t?.viewport ?? e.parent?.componentInstance;
5051
5219
  if (!r || typeof r.addChild != "function") return;
5052
5220
  let i = t?.tick, a = /* @__PURE__ */ new Map(), o = [], s = [], c = 0, l = 0, u = !0, d = null, f = null, p = () => {
5053
5221
  if (f && !f.destroyed) return f;
5054
- let e = gr(t);
5055
- return e ? (f = _r(e), f) : null;
5222
+ let e = wr(t);
5223
+ return e ? (f = Tr(e), f) : null;
5056
5224
  }, m = (e) => {
5057
5225
  let t = [
5058
5226
  e.baseSprite,
@@ -5094,7 +5262,7 @@ function br(t = {}) {
5094
5262
  ];
5095
5263
  for (let e = 0; e < c.length; e++) {
5096
5264
  let t = c[e];
5097
- t.anchor.set(.5, .84), t.roundPixels = !0, t.eventMode = "none", t.visible = !1, t[Jn] = !0;
5265
+ t.anchor.set(.5, .84), t.roundPixels = !0, t.eventMode = "none", t.visible = !1, t[nr] = !0;
5098
5266
  }
5099
5267
  n.filters = [a], r.filters = [o], i.filters = [s], r.blendMode = "multiply", i.blendMode = "screen", t = {
5100
5268
  baseSprite: n,
@@ -5104,16 +5272,16 @@ function br(t = {}) {
5104
5272
  depthBlurFilter: o,
5105
5273
  rimBlurFilter: s,
5106
5274
  bornAt: 0,
5107
- lifetimeMs: $n.lifetimeMs,
5108
- startAlpha: $n.startAlpha,
5109
- endAlpha: $n.endAlpha,
5275
+ lifetimeMs: sr.lifetimeMs,
5276
+ startAlpha: sr.startAlpha,
5277
+ endAlpha: sr.endAlpha,
5110
5278
  baseScaleX: 1,
5111
5279
  baseScaleY: 1,
5112
- blurStart: $n.blurStart,
5113
- blurEnd: $n.blurEnd,
5114
- erosionStart: $n.erosionStart,
5115
- depth: $n.depth,
5116
- rimStrength: $n.rimStrength
5280
+ blurStart: sr.blurStart,
5281
+ blurEnd: sr.blurEnd,
5282
+ erosionStart: sr.erosionStart,
5283
+ depth: sr.depth,
5284
+ rimStrength: sr.rimStrength
5117
5285
  };
5118
5286
  }
5119
5287
  return t;
@@ -5130,18 +5298,18 @@ function br(t = {}) {
5130
5298
  o.splice(t, 1);
5131
5299
  continue;
5132
5300
  }
5133
- let s = Z((e - n.bornAt) / Math.max(1, n.lifetimeMs), 0, 1), c = 1 - nr(0, 1, s), l = s <= n.erosionStart ? 1 : 1 - nr(n.erosionStart, 1, s), u = Z(tr(n.startAlpha, n.endAlpha, s) * c * l, 0, 1.5);
5301
+ let s = Z((e - n.bornAt) / Math.max(1, n.lifetimeMs), 0, 1), c = 1 - ur(0, 1, s), l = s <= n.erosionStart ? 1 : 1 - ur(n.erosionStart, 1, s), u = Z(lr(n.startAlpha, n.endAlpha, s) * c * l, 0, 1.5);
5134
5302
  if (s >= 1 || u <= .001) {
5135
5303
  o.splice(t, 1), m(n);
5136
5304
  continue;
5137
5305
  }
5138
5306
  let d = 1 + s * .08, f = 1 + s * .05, p = 1 + s * .12, h = .78 - n.depth * .1, g = 1.05 + n.depth * .12;
5139
- r.scale.set(n.baseScaleX * d, n.baseScaleY * d), i.scale.set(n.baseScaleX * h * f, n.baseScaleY * h * f), a.scale.set(n.baseScaleX * g * p, n.baseScaleY * g * p), r.alpha = u, i.alpha = Z(u * (.58 + n.depth * .34), 0, 1.2), a.alpha = Z(u * n.rimStrength, 0, .65), n.baseBlurFilter.strength = tr(n.blurStart, n.blurEnd, s), n.depthBlurFilter.strength = tr(n.blurStart * (.45 + (1 - n.depth) * .25), n.blurEnd * (.72 + (1 - n.depth) * .22), s), n.rimBlurFilter.strength = tr(n.blurStart * .8, n.blurEnd * (1.28 + n.depth * .24), s), r.visible = !0, i.visible = !0, a.visible = a.alpha > .001;
5307
+ r.scale.set(n.baseScaleX * d, n.baseScaleY * d), i.scale.set(n.baseScaleX * h * f, n.baseScaleY * h * f), a.scale.set(n.baseScaleX * g * p, n.baseScaleY * g * p), r.alpha = u, i.alpha = Z(u * (.58 + n.depth * .34), 0, 1.2), a.alpha = Z(u * n.rimStrength, 0, .65), n.baseBlurFilter.strength = lr(n.blurStart, n.blurEnd, s), n.depthBlurFilter.strength = lr(n.blurStart * (.45 + (1 - n.depth) * .25), n.blurEnd * (.72 + (1 - n.depth) * .22), s), n.rimBlurFilter.strength = lr(n.blurStart * .8, n.blurEnd * (1.28 + n.depth * .24), s), r.visible = !0, i.visible = !0, a.visible = a.alpha > .001;
5140
5308
  }
5141
5309
  }, b = (e, t, n, r, i, a) => {
5142
5310
  let s = p(), c = e.parent;
5143
5311
  if (!s || !c || c.destroyed) return;
5144
- let l = vr(e, c, t), u = n.nextFoot === "left" ? t.leftOffset : t.rightOffset, d = n.heading, f = -Math.sin(d), m = Math.cos(d), h = Math.cos(d), v = Math.sin(d), y = l.x + f * u.x + h * u.y, b = l.y + m * u.x + v * u.y, x = g(s), S = [
5312
+ let l = Er(e, c, t), u = n.nextFoot === "left" ? t.leftOffset : t.rightOffset, d = n.heading, f = -Math.sin(d), m = Math.cos(d), h = Math.cos(d), v = Math.sin(d), y = l.x + f * u.x + h * u.y, b = l.y + m * u.x + v * u.y, x = g(s), S = [
5145
5313
  x.rimSprite,
5146
5314
  x.baseSprite,
5147
5315
  x.depthSprite
@@ -5150,10 +5318,10 @@ function br(t = {}) {
5150
5318
  let t = S[e];
5151
5319
  t.parent && t.parent !== c && t.parent.removeChild(t), t.parent || c.addChild(t);
5152
5320
  }
5153
- let C = ir(t.jitter), w = (Math.random() * 2 - 1) * C, T = ir(t.angleOffset), E = d - Math.PI / 2 + T + w, D = r.scale * t.size, O = (n.nextFoot === "left" ? 1 : -1) * Math.max(.01, D), k = Math.max(.01, D), A = Z(r.startAlpha * t.alpha, 0, 1.5), j = or(r.tint, .38 + r.depth * .26), M = sr(r.tint, .22 + r.depth * .38);
5154
- x.baseSprite.position.set(y, b), x.depthSprite.position.set(y, b), x.rimSprite.position.set(y, b), x.baseSprite.rotation = E, x.depthSprite.rotation = E, x.rimSprite.rotation = E, x.baseSprite.scale.set(O, k), x.depthSprite.scale.set(O * .82, k * .82), x.rimSprite.scale.set(O * 1.08, k * 1.08), x.baseSprite.tint = r.tint, x.depthSprite.tint = j, x.rimSprite.tint = M, x.baseSprite.blendMode = r.blendMode, x.baseSprite.alpha = A, x.depthSprite.alpha = Z(A * (.58 + r.depth * .34), 0, 1.2), x.rimSprite.alpha = Z(A * r.rimStrength, 0, .65), x.baseSprite.visible = !0, x.depthSprite.visible = !0, x.rimSprite.visible = x.rimSprite.alpha > .001, yr(x, e, c), x.bornAt = i, x.lifetimeMs = r.lifetimeMs, x.startAlpha = A, x.endAlpha = Z(r.endAlpha * t.alpha, 0, 1.5), x.baseScaleX = O, x.baseScaleY = k, x.blurStart = Math.max(0, r.blurStart + t.blur), x.blurEnd = Math.max(x.blurStart, r.blurEnd + t.blur), x.depth = r.depth, x.rimStrength = r.rimStrength, x.erosionStart = Z(r.erosionStart + (Math.random() * 2 - 1) * .11, .05, .95), x.baseBlurFilter.strength = x.blurStart, x.depthBlurFilter.strength = x.blurStart * (.45 + (1 - r.depth) * .25), x.rimBlurFilter.strength = x.blurStart * .8, o.push(x), _(a), n.nextFoot = rr(n.nextFoot), n.lastStepMs = i, n.distanceSinceStep = Math.max(0, n.distanceSinceStep - t.minStepDistance);
5321
+ let C = fr(t.jitter), w = (Math.random() * 2 - 1) * C, T = fr(t.angleOffset), E = d - Math.PI / 2 + T + w, D = r.scale * t.size, O = (n.nextFoot === "left" ? 1 : -1) * Math.max(.01, D), k = Math.max(.01, D), A = Z(r.startAlpha * t.alpha, 0, 1.5), j = mr(r.tint, .38 + r.depth * .26), M = hr(r.tint, .22 + r.depth * .38);
5322
+ x.baseSprite.position.set(y, b), x.depthSprite.position.set(y, b), x.rimSprite.position.set(y, b), x.baseSprite.rotation = E, x.depthSprite.rotation = E, x.rimSprite.rotation = E, x.baseSprite.scale.set(O, k), x.depthSprite.scale.set(O * .82, k * .82), x.rimSprite.scale.set(O * 1.08, k * 1.08), x.baseSprite.tint = r.tint, x.depthSprite.tint = j, x.rimSprite.tint = M, x.baseSprite.blendMode = r.blendMode, x.baseSprite.alpha = A, x.depthSprite.alpha = Z(A * (.58 + r.depth * .34), 0, 1.2), x.rimSprite.alpha = Z(A * r.rimStrength, 0, .65), x.baseSprite.visible = !0, x.depthSprite.visible = !0, x.rimSprite.visible = x.rimSprite.alpha > .001, Dr(x, e, c), x.bornAt = i, x.lifetimeMs = r.lifetimeMs, x.startAlpha = A, x.endAlpha = Z(r.endAlpha * t.alpha, 0, 1.5), x.baseScaleX = O, x.baseScaleY = k, x.blurStart = Math.max(0, r.blurStart + t.blur), x.blurEnd = Math.max(x.blurStart, r.blurEnd + t.blur), x.depth = r.depth, x.rimStrength = r.rimStrength, x.erosionStart = Z(r.erosionStart + (Math.random() * 2 - 1) * .11, .05, .95), x.baseBlurFilter.strength = x.blurStart, x.depthBlurFilter.strength = x.blurStart * (.45 + (1 - r.depth) * .25), x.rimBlurFilter.strength = x.blurStart * .8, o.push(x), _(a), n.nextFoot = dr(n.nextFoot), n.lastStepMs = i, n.distanceSinceStep = Math.max(0, n.distanceSinceStep - t.minStepDistance);
5155
5323
  }, x = (e) => {
5156
- let t = $(n.defaultSurface), i = typeof t == "string" && t.trim().length > 0 ? t.trim() : Yn, o = fr(n.profiles), s = Number($(n.maxFootprints)), c = Z(Q(s) ? s : Zn, 10, 1200), l = hr(r, i), u = /* @__PURE__ */ new Set();
5324
+ let t = $(n.defaultSurface), i = typeof t == "string" && t.trim().length > 0 ? t.trim() : rr, o = br(n.profiles), s = Number($(n.maxFootprints)), c = Z(Q(s) ? s : ar, 10, 1200), l = Cr(r, i), u = /* @__PURE__ */ new Set();
5157
5325
  for (let t = 0; t < l.length; t++) {
5158
5326
  let { instance: n, caster: r } = l[t];
5159
5327
  if (!n || n.destroyed || !n.parent) continue;
@@ -5167,14 +5335,14 @@ function br(t = {}) {
5167
5335
  nextFoot: "left",
5168
5336
  heading: Number(n.rotation) || 0
5169
5337
  }, a.set(n, s));
5170
- let d = n.parent, f = vr(n, d, r);
5338
+ let d = n.parent, f = Er(n, d, r);
5171
5339
  if (!s.lastPoint) {
5172
5340
  s.lastPoint = f, s.lastUpdateMs = e;
5173
5341
  continue;
5174
5342
  }
5175
5343
  let p = Math.max(1, e - s.lastUpdateMs), m = f.x - s.lastPoint.x, h = f.y - s.lastPoint.y, g = Math.hypot(m, h);
5176
5344
  g > 1e-4 && (s.heading = Math.atan2(h, m)), s.distanceSinceStep += g;
5177
- let _ = g * 1e3 / p, v = o[r.surface] ?? o[i] ?? $n;
5345
+ let _ = g * 1e3 / p, v = o[r.surface] ?? o[i] ?? sr;
5178
5346
  _ >= r.minSpeed && s.distanceSinceStep >= r.minStepDistance && e - s.lastStepMs >= r.stepIntervalMs && b(n, r, s, v, e, c), s.lastPoint = f, s.lastUpdateMs = e;
5179
5347
  }
5180
5348
  for (let [e] of a.entries()) (!u.has(e) || e?.destroyed) && a.delete(e);
@@ -5183,7 +5351,7 @@ function br(t = {}) {
5183
5351
  return d = i?.observable?.subscribe((e) => {
5184
5352
  let t = e?.value ?? e, r = Number(t?.deltaTime), i = Q(r) ? r : 16.67;
5185
5353
  l += i, c += i;
5186
- let a = Number($(n.updateHz)), o = 1e3 / Z(Q(a) ? a : Xn, 1, 120);
5354
+ let a = Number($(n.updateHz)), o = 1e3 / Z(Q(a) ? a : ir, 1, 120);
5187
5355
  (u || c >= o) && (c = 0, u = !1, x(l));
5188
5356
  }), x(0), () => {
5189
5357
  d?.unsubscribe?.();
@@ -5194,6 +5362,6 @@ function br(t = {}) {
5194
5362
  }), c(e);
5195
5363
  }
5196
5364
  //#endregion
5197
- export { ie as Bar, cn as CLOUD_PRESETS, sn as FOG_PRESETS, ae as FX_PRESETS, Sn as FogOfWar, br as Footprints, be as Fx, ve as FxRuntime, Ie as Loading, Fe as NightAmbiant, xe as Particle, an as RAIN_PRESETS, on as SNOW_PRESETS, qn as SpriteShadows, $t as TiledMap, ln as WEATHER_PRESETS, dn as Weather, un as WeatherEffect, yn as createFogOfWarController, je as createNightFilter };
5365
+ export { oe as Bar, gn as CLOUD_PRESETS, hn as FOG_PRESETS, se as FX_PRESETS, An as FogOfWar, Or as Footprints, Se as Fx, be as FxRuntime, Be as Loading, ze as NightAmbiant, Ce as Particle, pn as RAIN_PRESETS, mn as SNOW_PRESETS, tr as SpriteShadows, rn as TiledMap, _n as WEATHER_PRESETS, yn as Weather, vn as WeatherEffect, Dn as createFogOfWarController, Fe as createNightFilter };
5198
5366
 
5199
5367
  //# sourceMappingURL=index.js.map