@reffy/infinite-canvas 0.1.2 → 0.1.3

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
@@ -2,7 +2,7 @@ var Zo = (t) => {
2
2
  throw TypeError(t);
3
3
  };
4
4
  var Fo = (t, e, r) => e.has(t) || Zo("Cannot " + r);
5
- var v = (t, e, r) => (Fo(t, e, "read from private field"), r ? r.call(t) : e.get(t)), V = (t, e, r) => e.has(t) ? Zo("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), F = (t, e, r, i) => (Fo(t, e, "write to private field"), i ? i.call(t, r) : e.set(t, r), r);
5
+ var v = (t, e, r) => (Fo(t, e, "read from private field"), r ? r.call(t) : e.get(t)), V = (t, e, r) => e.has(t) ? Zo("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), B = (t, e, r, i) => (Fo(t, e, "write to private field"), i ? i.call(t, r) : e.set(t, r), r);
6
6
  import { makeObservable as Oa, computed as at, action as M, observable as ee, reaction as Xh } from "mobx";
7
7
  import { css as Jh, LitElement as Vh } from "lit";
8
8
  import Oe from "dexie";
@@ -17,7 +17,7 @@ const Nt = ["TOP", "BOTTOM", "LEFT", "RIGHT"], yn = ["TOPLEFT", "TOPRIGHT", "BOT
17
17
  function Wo(t) {
18
18
  return Bo[t] ? Bo[t] : t;
19
19
  }
20
- const Ea = 8, Yr = 2, Z = {
20
+ const Ea = 8, Yr = 2, F = {
21
21
  identity: function() {
22
22
  return [1, 0, 0, 0, 1, 0, 0, 0, 1];
23
23
  },
@@ -76,10 +76,10 @@ function Go(t, e, r) {
76
76
  throw t.deleteShader(i), new Error("Shader was not created.");
77
77
  }
78
78
  function Kh(t, e, r, i, n, o) {
79
- const a = n.getBoundingClientRect(), s = window.devicePixelRatio || 1, u = (t - a.left) * s, c = (e - a.top) * s, l = u / r * 2 - 1, d = c / i * -2 + 1, m = Z.projection(r, i), f = Z.multiply(m, o), $ = Z.inverse(f), [w, P] = Z.transformPoint($, [l, d]);
79
+ const a = n.getBoundingClientRect(), s = window.devicePixelRatio || 1, u = (t - a.left) * s, c = (e - a.top) * s, l = u / r * 2 - 1, d = c / i * -2 + 1, m = F.projection(r, i), f = F.multiply(m, o), $ = F.inverse(f), [w, P] = F.transformPoint($, [l, d]);
80
80
  return [w, P];
81
81
  }
82
- function Be(t, e, r) {
82
+ function We(t, e, r) {
83
83
  const { gl: i, canvas: n } = r;
84
84
  return Kh(
85
85
  t,
@@ -103,7 +103,7 @@ function qh(t) {
103
103
  function Qh(t) {
104
104
  return Math.hypot(t[3], t[4]);
105
105
  }
106
- function Ve(t) {
106
+ function Ye(t) {
107
107
  return [qh(t), Qh(t)];
108
108
  }
109
109
  function Xo(t) {
@@ -280,7 +280,7 @@ function h(t, e, r) {
280
280
  }), Object.defineProperty(a, "name", { value: t }), a;
281
281
  }
282
282
  const Ua = Symbol("zod_brand");
283
- class Ye extends Error {
283
+ class He extends Error {
284
284
  constructor() {
285
285
  super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
286
286
  }
@@ -327,7 +327,7 @@ function Zt(t) {
327
327
  }
328
328
  };
329
329
  }
330
- function et(t) {
330
+ function tt(t) {
331
331
  return t == null;
332
332
  }
333
333
  function Zn(t) {
@@ -364,7 +364,7 @@ function O(t, e, r) {
364
364
  function mm(t) {
365
365
  return Object.create(Object.getPrototypeOf(t), Object.getOwnPropertyDescriptors(t));
366
366
  }
367
- function Le(t, e, r) {
367
+ function Ze(t, e, r) {
368
368
  Object.defineProperty(t, e, {
369
369
  value: r,
370
370
  writable: !0,
@@ -423,7 +423,7 @@ const Da = Zt(() => {
423
423
  return !1;
424
424
  }
425
425
  });
426
- function He(t) {
426
+ function Ke(t) {
427
427
  if (dt(t) === !1)
428
428
  return !1;
429
429
  const e = t.constructor;
@@ -433,7 +433,7 @@ function He(t) {
433
433
  return !(dt(r) === !1 || Object.prototype.hasOwnProperty.call(r, "isPrototypeOf") === !1);
434
434
  }
435
435
  function Fn(t) {
436
- return He(t) ? { ...t } : Array.isArray(t) ? [...t] : t;
436
+ return Ke(t) ? { ...t } : Array.isArray(t) ? [...t] : t;
437
437
  }
438
438
  function ym(t) {
439
439
  let e = 0;
@@ -535,7 +535,7 @@ function Za(t, e) {
535
535
  throw new Error(`Unrecognized key: "${o}"`);
536
536
  e[o] && (n[o] = r.shape[o]);
537
537
  }
538
- return Le(this, "shape", n), n;
538
+ return Ze(this, "shape", n), n;
539
539
  },
540
540
  checks: []
541
541
  });
@@ -550,14 +550,14 @@ function Fa(t, e) {
550
550
  throw new Error(`Unrecognized key: "${o}"`);
551
551
  e[o] && delete n[o];
552
552
  }
553
- return Le(this, "shape", n), n;
553
+ return Ze(this, "shape", n), n;
554
554
  },
555
555
  checks: []
556
556
  });
557
557
  return ae(t, i);
558
558
  }
559
559
  function Ba(t, e) {
560
- if (!He(e))
560
+ if (!Ke(e))
561
561
  throw new Error("Invalid input to extend: expected a plain object");
562
562
  const r = t._zod.def.checks;
563
563
  if (r && r.length > 0)
@@ -565,20 +565,20 @@ function Ba(t, e) {
565
565
  const n = Te(t._zod.def, {
566
566
  get shape() {
567
567
  const o = { ...t._zod.def.shape, ...e };
568
- return Le(this, "shape", o), o;
568
+ return Ze(this, "shape", o), o;
569
569
  },
570
570
  checks: []
571
571
  });
572
572
  return ae(t, n);
573
573
  }
574
574
  function Wa(t, e) {
575
- if (!He(e))
575
+ if (!Ke(e))
576
576
  throw new Error("Invalid input to safeExtend: expected a plain object");
577
577
  const r = {
578
578
  ...t._zod.def,
579
579
  get shape() {
580
580
  const i = { ...t._zod.def.shape, ...e };
581
- return Le(this, "shape", i), i;
581
+ return Ze(this, "shape", i), i;
582
582
  },
583
583
  checks: t._zod.def.checks
584
584
  };
@@ -588,7 +588,7 @@ function Ga(t, e) {
588
588
  const r = Te(t._zod.def, {
589
589
  get shape() {
590
590
  const i = { ...t._zod.def.shape, ...e._zod.def.shape };
591
- return Le(this, "shape", i), i;
591
+ return Ze(this, "shape", i), i;
592
592
  },
593
593
  get catchall() {
594
594
  return e._zod.def.catchall;
@@ -617,7 +617,7 @@ function Xa(t, e, r) {
617
617
  type: "optional",
618
618
  innerType: n[a]
619
619
  }) : n[a];
620
- return Le(this, "shape", o), o;
620
+ return Ze(this, "shape", o), o;
621
621
  },
622
622
  checks: []
623
623
  });
@@ -642,13 +642,13 @@ function Ja(t, e, r) {
642
642
  type: "nonoptional",
643
643
  innerType: n[a]
644
644
  });
645
- return Le(this, "shape", o), o;
645
+ return Ze(this, "shape", o), o;
646
646
  },
647
647
  checks: []
648
648
  });
649
649
  return ae(e, i);
650
650
  }
651
- function We(t, e = 0) {
651
+ function Ge(t, e = 0) {
652
652
  if (t.aborted === !0)
653
653
  return !0;
654
654
  for (let r = e; r < t.issues.length; r++)
@@ -731,14 +731,14 @@ const Ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
731
731
  BIGINT_FORMAT_RANGES: La,
732
732
  Class: km,
733
733
  NUMBER_FORMAT_RANGES: Ra,
734
- aborted: We,
734
+ aborted: Ge,
735
735
  allowsEval: Da,
736
736
  assert: hm,
737
737
  assertEqual: cm,
738
738
  assertIs: lm,
739
739
  assertNever: dm,
740
740
  assertNotEqual: um,
741
- assignProp: Le,
741
+ assignProp: Ze,
742
742
  base64ToUint8Array: Va,
743
743
  base64urlToUint8Array: wm,
744
744
  cached: Zt,
@@ -761,14 +761,14 @@ const Ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
761
761
  getSizableOrigin: Bn,
762
762
  hexToUint8Array: xm,
763
763
  isObject: dt,
764
- isPlainObject: He,
764
+ isPlainObject: Ke,
765
765
  issue: ht,
766
766
  joinValues: y,
767
767
  jsonStringifyReplacer: Tn,
768
768
  merge: Ga,
769
769
  mergeDefs: Te,
770
770
  normalizeParams: p,
771
- nullish: et,
771
+ nullish: tt,
772
772
  numKeys: ym,
773
773
  objectClone: mm,
774
774
  omit: Fa,
@@ -869,7 +869,7 @@ function es(t) {
869
869
  const Ft = (t) => (e, r, i, n) => {
870
870
  const o = i ? Object.assign(i, { async: !1 }) : { async: !1 }, a = e._zod.run({ value: r, issues: [] }, o);
871
871
  if (a instanceof Promise)
872
- throw new Ye();
872
+ throw new He();
873
873
  if (a.issues.length) {
874
874
  const s = new (n?.Err ?? t)(a.issues.map((u) => oe(u, o, H())));
875
875
  throw qr(s, n?.callee), s;
@@ -886,7 +886,7 @@ const Ft = (t) => (e, r, i, n) => {
886
886
  }, Fr = /* @__PURE__ */ Bt(ne), Wt = (t) => (e, r, i) => {
887
887
  const n = i ? { ...i, async: !1 } : { async: !1 }, o = e._zod.run({ value: r, issues: [] }, n);
888
888
  if (o instanceof Promise)
889
- throw new Ye();
889
+ throw new He();
890
890
  return o.issues.length ? {
891
891
  success: !1,
892
892
  error: new (t ?? Qr)(o.issues.map((a) => oe(a, n, H())))
@@ -1143,7 +1143,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1143
1143
  var r;
1144
1144
  R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1145
1145
  const n = i.value;
1146
- return !et(n) && n.size !== void 0;
1146
+ return !tt(n) && n.size !== void 0;
1147
1147
  }), t._zod.onattach.push((i) => {
1148
1148
  const n = i._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1149
1149
  e.maximum < n && (i._zod.bag.maximum = e.maximum);
@@ -1163,7 +1163,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1163
1163
  var r;
1164
1164
  R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1165
1165
  const n = i.value;
1166
- return !et(n) && n.size !== void 0;
1166
+ return !tt(n) && n.size !== void 0;
1167
1167
  }), t._zod.onattach.push((i) => {
1168
1168
  const n = i._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1169
1169
  e.minimum > n && (i._zod.bag.minimum = e.minimum);
@@ -1183,7 +1183,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1183
1183
  var r;
1184
1184
  R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1185
1185
  const n = i.value;
1186
- return !et(n) && n.size !== void 0;
1186
+ return !tt(n) && n.size !== void 0;
1187
1187
  }), t._zod.onattach.push((i) => {
1188
1188
  const n = i._zod.bag;
1189
1189
  n.minimum = e.size, n.maximum = e.size, n.size = e.size;
@@ -1206,7 +1206,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1206
1206
  var r;
1207
1207
  R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1208
1208
  const n = i.value;
1209
- return !et(n) && n.length !== void 0;
1209
+ return !tt(n) && n.length !== void 0;
1210
1210
  }), t._zod.onattach.push((i) => {
1211
1211
  const n = i._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1212
1212
  e.maximum < n && (i._zod.bag.maximum = e.maximum);
@@ -1229,7 +1229,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1229
1229
  var r;
1230
1230
  R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1231
1231
  const n = i.value;
1232
- return !et(n) && n.length !== void 0;
1232
+ return !tt(n) && n.length !== void 0;
1233
1233
  }), t._zod.onattach.push((i) => {
1234
1234
  const n = i._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1235
1235
  e.minimum > n && (i._zod.bag.minimum = e.minimum);
@@ -1252,7 +1252,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1252
1252
  var r;
1253
1253
  R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1254
1254
  const n = i.value;
1255
- return !et(n) && n.length !== void 0;
1255
+ return !tt(n) && n.length !== void 0;
1256
1256
  }), t._zod.onattach.push((i) => {
1257
1257
  const n = i._zod.bag;
1258
1258
  n.minimum = e.length, n.maximum = e.length, n.length = e.length;
@@ -1429,7 +1429,7 @@ const ic = {
1429
1429
  });
1430
1430
  else {
1431
1431
  const n = (a, s, u) => {
1432
- let c = We(a), l;
1432
+ let c = Ge(a), l;
1433
1433
  for (const d of s) {
1434
1434
  if (d._zod.def.when) {
1435
1435
  if (!d._zod.def.when(a))
@@ -1438,25 +1438,25 @@ const ic = {
1438
1438
  continue;
1439
1439
  const m = a.issues.length, f = d._zod.check(a);
1440
1440
  if (f instanceof Promise && u?.async === !1)
1441
- throw new Ye();
1441
+ throw new He();
1442
1442
  if (l || f instanceof Promise)
1443
1443
  l = (l ?? Promise.resolve()).then(async () => {
1444
- await f, a.issues.length !== m && (c || (c = We(a, m)));
1444
+ await f, a.issues.length !== m && (c || (c = Ge(a, m)));
1445
1445
  });
1446
1446
  else {
1447
1447
  if (a.issues.length === m)
1448
1448
  continue;
1449
- c || (c = We(a, m));
1449
+ c || (c = Ge(a, m));
1450
1450
  }
1451
1451
  }
1452
1452
  return l ? l.then(() => a) : a;
1453
1453
  }, o = (a, s, u) => {
1454
- if (We(a))
1454
+ if (Ge(a))
1455
1455
  return a.aborted = !0, a;
1456
1456
  const c = n(s, i, u);
1457
1457
  if (c instanceof Promise) {
1458
1458
  if (u.async === !1)
1459
- throw new Ye();
1459
+ throw new He();
1460
1460
  return c.then((l) => t._zod.parse(l, u));
1461
1461
  }
1462
1462
  return t._zod.parse(c, u);
@@ -1471,7 +1471,7 @@ const ic = {
1471
1471
  const u = t._zod.parse(a, s);
1472
1472
  if (u instanceof Promise) {
1473
1473
  if (s.async === !1)
1474
- throw new Ye();
1474
+ throw new He();
1475
1475
  return u.then((c) => n(c, i, s));
1476
1476
  }
1477
1477
  return n(u, i, s);
@@ -1984,7 +1984,7 @@ function Ho(t, e, r, i) {
1984
1984
  for (const o of t)
1985
1985
  if (o.issues.length === 0)
1986
1986
  return e.value = o.value, e;
1987
- const n = t.filter((o) => !We(o));
1987
+ const n = t.filter((o) => !Ge(o));
1988
1988
  return n.length === 1 ? (e.value = n[0].value, n[0]) : (e.issues.push({
1989
1989
  code: "invalid_union",
1990
1990
  input: e.value,
@@ -2118,7 +2118,7 @@ function Br(t, e) {
2118
2118
  return { valid: !0, data: t };
2119
2119
  if (t instanceof Date && e instanceof Date && +t == +e)
2120
2120
  return { valid: !0, data: t };
2121
- if (He(t) && He(e)) {
2121
+ if (Ke(t) && Ke(e)) {
2122
2122
  const r = Object.keys(e), i = Object.keys(t).filter((o) => r.indexOf(o) !== -1), n = { ...t, ...e };
2123
2123
  for (const o of i) {
2124
2124
  const a = Br(t[o], e[o]);
@@ -2149,7 +2149,7 @@ function Br(t, e) {
2149
2149
  return { valid: !1, mergeErrorPath: [] };
2150
2150
  }
2151
2151
  function qo(t, e, r) {
2152
- if (e.issues.length && t.issues.push(...e.issues), r.issues.length && t.issues.push(...r.issues), We(t))
2152
+ if (e.issues.length && t.issues.push(...e.issues), r.issues.length && t.issues.push(...r.issues), Ge(t))
2153
2153
  return t;
2154
2154
  const i = Br(e.value, r.value);
2155
2155
  if (!i.valid)
@@ -2210,7 +2210,7 @@ function mn(t, e, r) {
2210
2210
  const Hc = /* @__PURE__ */ h("$ZodRecord", (t, e) => {
2211
2211
  I.init(t, e), t._zod.parse = (r, i) => {
2212
2212
  const n = r.value;
2213
- if (!He(n))
2213
+ if (!Ke(n))
2214
2214
  return r.issues.push({
2215
2215
  expected: "record",
2216
2216
  code: "invalid_type",
@@ -2367,7 +2367,7 @@ const Qc = /* @__PURE__ */ h("$ZodEnum", (t, e) => {
2367
2367
  if (i.async)
2368
2368
  return (n instanceof Promise ? n : Promise.resolve(n)).then((a) => (r.value = a, r));
2369
2369
  if (n instanceof Promise)
2370
- throw new Ye();
2370
+ throw new He();
2371
2371
  return r.value = n, r;
2372
2372
  };
2373
2373
  });
@@ -7611,7 +7611,7 @@ function tl(t, e) {
7611
7611
  ...p(e)
7612
7612
  });
7613
7613
  }
7614
- function Me(t, e) {
7614
+ function Re(t, e) {
7615
7615
  return new hi({
7616
7616
  check: "less_than",
7617
7617
  ...p(e),
@@ -7627,7 +7627,7 @@ function ie(t, e) {
7627
7627
  inclusive: !0
7628
7628
  });
7629
7629
  }
7630
- function Re(t, e) {
7630
+ function Le(t, e) {
7631
7631
  return new mi({
7632
7632
  check: "greater_than",
7633
7633
  ...p(e),
@@ -7644,10 +7644,10 @@ function te(t, e) {
7644
7644
  });
7645
7645
  }
7646
7646
  function Zi(t) {
7647
- return Re(0, t);
7647
+ return Le(0, t);
7648
7648
  }
7649
7649
  function Fi(t) {
7650
- return Me(0, t);
7650
+ return Re(0, t);
7651
7651
  }
7652
7652
  function Bi(t) {
7653
7653
  return ie(0, t);
@@ -7690,7 +7690,7 @@ function Kt(t, e) {
7690
7690
  maximum: t
7691
7691
  });
7692
7692
  }
7693
- function Ke(t, e) {
7693
+ function qe(t, e) {
7694
7694
  return new Xs({
7695
7695
  check: "min_length",
7696
7696
  ...p(e),
@@ -8615,7 +8615,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8615
8615
  __proto__: null,
8616
8616
  $ZodAny: Ac,
8617
8617
  $ZodArray: Fc,
8618
- $ZodAsyncError: Ye,
8618
+ $ZodAsyncError: He,
8619
8619
  $ZodBase64: Ic,
8620
8620
  $ZodBase64URL: zc,
8621
8621
  $ZodBigInt: vi,
@@ -8754,7 +8754,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8754
8754
  _file: rl,
8755
8755
  _float32: Du,
8756
8756
  _float64: Au,
8757
- _gt: Re,
8757
+ _gt: Le,
8758
8758
  _gte: te,
8759
8759
  _guid: Un,
8760
8760
  _includes: Kn,
@@ -8774,7 +8774,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8774
8774
  _length: qt,
8775
8775
  _literal: ip,
8776
8776
  _lowercase: Yn,
8777
- _lt: Me,
8777
+ _lt: Re,
8778
8778
  _lte: ie,
8779
8779
  _mac: zu,
8780
8780
  _map: ep,
@@ -8783,7 +8783,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8783
8783
  _maxSize: Ht,
8784
8784
  _mime: er,
8785
8785
  _min: te,
8786
- _minLength: Ke,
8786
+ _minLength: qe,
8787
8787
  _minSize: gt,
8788
8788
  _multipleOf: ft,
8789
8789
  _nan: tl,
@@ -8888,17 +8888,17 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8888
8888
  }, Symbol.toStringTag, { value: "Module" })), $p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8889
8889
  __proto__: null,
8890
8890
  endsWith: Qn,
8891
- gt: Re,
8891
+ gt: Le,
8892
8892
  gte: te,
8893
8893
  includes: Kn,
8894
8894
  length: qt,
8895
8895
  lowercase: Yn,
8896
- lt: Me,
8896
+ lt: Re,
8897
8897
  lte: ie,
8898
8898
  maxLength: Kt,
8899
8899
  maxSize: Ht,
8900
8900
  mime: er,
8901
- minLength: Ke,
8901
+ minLength: qe,
8902
8902
  minSize: gt,
8903
8903
  multipleOf: ft,
8904
8904
  negative: Fi,
@@ -9007,11 +9007,11 @@ const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9007
9007
  }, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)), ar = /* @__PURE__ */ h("_ZodString", (t, e) => {
9008
9008
  Yt.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => hl(t, i, n);
9009
9009
  const r = t._zod.bag;
9010
- t.format = r.format ?? null, t.minLength = r.minimum ?? null, t.maxLength = r.maximum ?? null, t.regex = (...i) => t.check(Vn(...i)), t.includes = (...i) => t.check(Kn(...i)), t.startsWith = (...i) => t.check(qn(...i)), t.endsWith = (...i) => t.check(Qn(...i)), t.min = (...i) => t.check(Ke(...i)), t.max = (...i) => t.check(Kt(...i)), t.length = (...i) => t.check(qt(...i)), t.nonempty = (...i) => t.check(Ke(1, ...i)), t.lowercase = (i) => t.check(Yn(i)), t.uppercase = (i) => t.check(Hn(i)), t.trim = () => t.check(nr()), t.normalize = (...i) => t.check(tr(...i)), t.toLowerCase = () => t.check(rr()), t.toUpperCase = () => t.check(ir()), t.slugify = () => t.check(or());
9010
+ t.format = r.format ?? null, t.minLength = r.minimum ?? null, t.maxLength = r.maximum ?? null, t.regex = (...i) => t.check(Vn(...i)), t.includes = (...i) => t.check(Kn(...i)), t.startsWith = (...i) => t.check(qn(...i)), t.endsWith = (...i) => t.check(Qn(...i)), t.min = (...i) => t.check(qe(...i)), t.max = (...i) => t.check(Kt(...i)), t.length = (...i) => t.check(qt(...i)), t.nonempty = (...i) => t.check(qe(1, ...i)), t.lowercase = (i) => t.check(Yn(i)), t.uppercase = (i) => t.check(Hn(i)), t.trim = () => t.check(nr()), t.normalize = (...i) => t.check(tr(...i)), t.toLowerCase = () => t.check(rr()), t.toUpperCase = () => t.check(ir()), t.slugify = () => t.check(or());
9011
9011
  }), en = /* @__PURE__ */ h("ZodString", (t, e) => {
9012
9012
  Yt.init(t, e), ar.init(t, e), t.email = (r) => t.check($i(sr, r)), t.url = (r) => t.check(Xn(tn, r)), t.jwt = (r) => t.check(Li(wr, r)), t.emoji = (r) => t.check(ki(cr, r)), t.guid = (r) => t.check(Un(At, r)), t.uuid = (r) => t.check(wi(pe, r)), t.uuidv4 = (r) => t.check(Si(pe, r)), t.uuidv6 = (r) => t.check(xi(pe, r)), t.uuidv7 = (r) => t.check(Ii(pe, r)), t.nanoid = (r) => t.check(zi(ur, r)), t.guid = (r) => t.check(Un(At, r)), t.cuid = (r) => t.check(Oi(lr, r)), t.cuid2 = (r) => t.check(Ei(dr, r)), t.ulid = (r) => t.check(Ti(hr, r)), t.base64 = (r) => t.check(Ai(br, r)), t.base64url = (r) => t.check(Mi(_r, r)), t.xid = (r) => t.check(Pi(mr, r)), t.ksuid = (r) => t.check(ji(fr, r)), t.ipv4 = (r) => t.check(Ui(gr, r)), t.ipv6 = (r) => t.check(Ni(pr, r)), t.cidrv4 = (r) => t.check(Ci(vr, r)), t.cidrv6 = (r) => t.check(Di(yr, r)), t.e164 = (r) => t.check(Ri($r, r)), t.datetime = (r) => t.check(Kl(r)), t.date = (r) => t.check(ql(r)), t.time = (r) => t.check(Ql(r)), t.duration = (r) => t.check(ed(r));
9013
9013
  });
9014
- function De(t) {
9014
+ function Ae(t) {
9015
9015
  return Iu(en, t);
9016
9016
  }
9017
9017
  const N = /* @__PURE__ */ h("ZodStringFormat", (t, e) => {
@@ -9171,30 +9171,30 @@ function Fd(t, e) {
9171
9171
  return Qt($t, i, n, e);
9172
9172
  }
9173
9173
  const nn = /* @__PURE__ */ h("ZodNumber", (t, e) => {
9174
- gi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => ml(t, i, n), t.gt = (i, n) => t.check(Re(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Me(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.int = (i) => t.check(Nn(i)), t.safe = (i) => t.check(Nn(i)), t.positive = (i) => t.check(Re(0, i)), t.nonnegative = (i) => t.check(te(0, i)), t.negative = (i) => t.check(Me(0, i)), t.nonpositive = (i) => t.check(ie(0, i)), t.multipleOf = (i, n) => t.check(ft(i, n)), t.step = (i, n) => t.check(ft(i, n)), t.finite = () => t;
9174
+ gi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => ml(t, i, n), t.gt = (i, n) => t.check(Le(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Re(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.int = (i) => t.check(Nn(i)), t.safe = (i) => t.check(Nn(i)), t.positive = (i) => t.check(Le(0, i)), t.nonnegative = (i) => t.check(te(0, i)), t.negative = (i) => t.check(Re(0, i)), t.nonpositive = (i) => t.check(ie(0, i)), t.multipleOf = (i, n) => t.check(ft(i, n)), t.step = (i, n) => t.check(ft(i, n)), t.finite = () => t;
9175
9175
  const r = t._zod.bag;
9176
9176
  t.minValue = Math.max(r.minimum ?? Number.NEGATIVE_INFINITY, r.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, t.maxValue = Math.min(r.maximum ?? Number.POSITIVE_INFINITY, r.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, t.isInt = (r.format ?? "").includes("int") || Number.isSafeInteger(r.multipleOf ?? 0.5), t.isFinite = !0, t.format = r.format ?? null;
9177
9177
  });
9178
9178
  function z(t) {
9179
9179
  return Uu(nn, t);
9180
9180
  }
9181
- const tt = /* @__PURE__ */ h("ZodNumberFormat", (t, e) => {
9181
+ const nt = /* @__PURE__ */ h("ZodNumberFormat", (t, e) => {
9182
9182
  jc.init(t, e), nn.init(t, e);
9183
9183
  });
9184
9184
  function Nn(t) {
9185
- return Cu(tt, t);
9185
+ return Cu(nt, t);
9186
9186
  }
9187
9187
  function Bd(t) {
9188
- return Du(tt, t);
9188
+ return Du(nt, t);
9189
9189
  }
9190
9190
  function Wd(t) {
9191
- return Au(tt, t);
9191
+ return Au(nt, t);
9192
9192
  }
9193
9193
  function Gd(t) {
9194
- return Mu(tt, t);
9194
+ return Mu(nt, t);
9195
9195
  }
9196
9196
  function Xd(t) {
9197
- return Ru(tt, t);
9197
+ return Ru(nt, t);
9198
9198
  }
9199
9199
  const rn = /* @__PURE__ */ h("ZodBoolean", (t, e) => {
9200
9200
  pi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => fl(t, r, i);
@@ -9203,7 +9203,7 @@ function qi(t) {
9203
9203
  return Lu(rn, t);
9204
9204
  }
9205
9205
  const on = /* @__PURE__ */ h("ZodBigInt", (t, e) => {
9206
- vi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => gl(t, i), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.gt = (i, n) => t.check(Re(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Me(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.positive = (i) => t.check(Re(BigInt(0), i)), t.negative = (i) => t.check(Me(BigInt(0), i)), t.nonpositive = (i) => t.check(ie(BigInt(0), i)), t.nonnegative = (i) => t.check(te(BigInt(0), i)), t.multipleOf = (i, n) => t.check(ft(i, n));
9206
+ vi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => gl(t, i), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.gt = (i, n) => t.check(Le(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Re(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.positive = (i) => t.check(Le(BigInt(0), i)), t.negative = (i) => t.check(Re(BigInt(0), i)), t.nonpositive = (i) => t.check(ie(BigInt(0), i)), t.nonnegative = (i) => t.check(te(BigInt(0), i)), t.multipleOf = (i, n) => t.check(ft(i, n));
9207
9207
  const r = t._zod.bag;
9208
9208
  t.minValue = r.minimum ?? null, t.maxValue = r.maximum ?? null, t.format = r.format ?? null;
9209
9209
  });
@@ -9246,7 +9246,7 @@ function qd() {
9246
9246
  const io = /* @__PURE__ */ h("ZodUnknown", (t, e) => {
9247
9247
  Mc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => wl();
9248
9248
  });
9249
- function qe() {
9249
+ function Qe() {
9250
9250
  return Hu(io);
9251
9251
  }
9252
9252
  const oo = /* @__PURE__ */ h("ZodNever", (t, e) => {
@@ -9270,7 +9270,7 @@ function eh(t) {
9270
9270
  return Qu(Ir, t);
9271
9271
  }
9272
9272
  const so = /* @__PURE__ */ h("ZodArray", (t, e) => {
9273
- Fc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Cl(t, r, i, n), t.element = e.element, t.min = (r, i) => t.check(Ke(r, i)), t.nonempty = (r) => t.check(Ke(1, r)), t.max = (r, i) => t.check(Kt(r, i)), t.length = (r, i) => t.check(qt(r, i)), t.unwrap = () => t.element;
9273
+ Fc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Cl(t, r, i, n), t.element = e.element, t.min = (r, i) => t.check(qe(r, i)), t.nonempty = (r) => t.check(qe(1, r)), t.max = (r, i) => t.check(Kt(r, i)), t.length = (r, i) => t.check(qt(r, i)), t.unwrap = () => t.element;
9274
9274
  });
9275
9275
  function ve(t, e) {
9276
9276
  return nl(so, t, e);
@@ -9280,7 +9280,7 @@ function th(t) {
9280
9280
  return zr(Object.keys(e));
9281
9281
  }
9282
9282
  const an = /* @__PURE__ */ h("ZodObject", (t, e) => {
9283
- Xc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Dl(t, r, i, n), O(t, "shape", () => e.shape), t.keyof = () => zr(Object.keys(t._zod.def.shape)), t.catchall = (r) => t.clone({ ...t._zod.def, catchall: r }), t.passthrough = () => t.clone({ ...t._zod.def, catchall: qe() }), t.loose = () => t.clone({ ...t._zod.def, catchall: qe() }), t.strict = () => t.clone({ ...t._zod.def, catchall: xr() }), t.strip = () => t.clone({ ...t._zod.def, catchall: void 0 }), t.extend = (r) => Ba(t, r), t.safeExtend = (r) => Wa(t, r), t.merge = (r) => Ga(t, r), t.pick = (r) => Za(t, r), t.omit = (r) => Fa(t, r), t.partial = (...r) => Xa(Er, t, r[0]), t.required = (...r) => Ja(Tr, t, r[0]);
9283
+ Xc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Dl(t, r, i, n), O(t, "shape", () => e.shape), t.keyof = () => zr(Object.keys(t._zod.def.shape)), t.catchall = (r) => t.clone({ ...t._zod.def, catchall: r }), t.passthrough = () => t.clone({ ...t._zod.def, catchall: Qe() }), t.loose = () => t.clone({ ...t._zod.def, catchall: Qe() }), t.strict = () => t.clone({ ...t._zod.def, catchall: xr() }), t.strip = () => t.clone({ ...t._zod.def, catchall: void 0 }), t.extend = (r) => Ba(t, r), t.safeExtend = (r) => Wa(t, r), t.merge = (r) => Ga(t, r), t.pick = (r) => Za(t, r), t.omit = (r) => Fa(t, r), t.partial = (...r) => Xa(Er, t, r[0]), t.required = (...r) => Ja(Tr, t, r[0]);
9284
9284
  });
9285
9285
  function me(t, e) {
9286
9286
  const r = {
@@ -9302,7 +9302,7 @@ function rh(t, e) {
9302
9302
  return new an({
9303
9303
  type: "object",
9304
9304
  shape: t,
9305
- catchall: qe(),
9305
+ catchall: Qe(),
9306
9306
  ...p(e)
9307
9307
  });
9308
9308
  }
@@ -9468,7 +9468,7 @@ const yo = /* @__PURE__ */ h("ZodLiteral", (t, e) => {
9468
9468
  }
9469
9469
  });
9470
9470
  });
9471
- function Ge(t, e) {
9471
+ function Xe(t, e) {
9472
9472
  return new yo({
9473
9473
  type: "literal",
9474
9474
  values: Array.isArray(t) ? t : [t],
@@ -9649,8 +9649,8 @@ const Do = /* @__PURE__ */ h("ZodFunction", (t, e) => {
9649
9649
  function Cn(t) {
9650
9650
  return new Do({
9651
9651
  type: "function",
9652
- input: Array.isArray(t?.input) ? kr(t?.input) : t?.input ?? ve(qe()),
9653
- output: t?.output ?? qe()
9652
+ input: Array.isArray(t?.input) ? kr(t?.input) : t?.input ?? ve(Qe()),
9653
+ output: t?.output ?? Qe()
9654
9654
  });
9655
9655
  }
9656
9656
  const un = /* @__PURE__ */ h("ZodCustom", (t, e) => {
@@ -9691,7 +9691,7 @@ const wh = (...t) => ll({
9691
9691
  String: en
9692
9692
  }, ...t);
9693
9693
  function Sh(t) {
9694
- const e = Ur(() => wt([De(t), z(), qi(), no(), ve(e), go(De(), e)]));
9694
+ const e = Ur(() => wt([Ae(t), z(), qi(), no(), ve(e), go(Ae(), e)]));
9695
9695
  return e;
9696
9696
  }
9697
9697
  function xh(t, e) {
@@ -9740,7 +9740,7 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9740
9740
  ZodNull: to,
9741
9741
  ZodNullable: $o,
9742
9742
  ZodNumber: nn,
9743
- ZodNumberFormat: tt,
9743
+ ZodNumberFormat: nt,
9744
9744
  ZodObject: an,
9745
9745
  ZodOptional: Er,
9746
9746
  ZodPipe: Pr,
@@ -9811,7 +9811,7 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9811
9811
  keyof: th,
9812
9812
  ksuid: Ed,
9813
9813
  lazy: Ur,
9814
- literal: Ge,
9814
+ literal: Xe,
9815
9815
  looseObject: rh,
9816
9816
  looseRecord: ah,
9817
9817
  mac: Pd,
@@ -9838,7 +9838,7 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9838
9838
  refine: Ao,
9839
9839
  set: ch,
9840
9840
  strictObject: nh,
9841
- string: De,
9841
+ string: Ae,
9842
9842
  stringFormat: Rd,
9843
9843
  stringbool: wh,
9844
9844
  success: hh,
@@ -9852,7 +9852,7 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9852
9852
  ulid: zd,
9853
9853
  undefined: Kd,
9854
9854
  union: wt,
9855
- unknown: qe,
9855
+ unknown: Qe,
9856
9856
  url: $d,
9857
9857
  uuid: vd,
9858
9858
  uuidv4: yd,
@@ -10164,7 +10164,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10164
10164
  ZodNull: to,
10165
10165
  ZodNullable: $o,
10166
10166
  ZodNumber: nn,
10167
- ZodNumberFormat: tt,
10167
+ ZodNumberFormat: nt,
10168
10168
  ZodObject: an,
10169
10169
  ZodOptional: Er,
10170
10170
  ZodPipe: Pr,
@@ -10233,7 +10233,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10233
10233
  function: Cn,
10234
10234
  getErrorMap: kp,
10235
10235
  globalRegistry: he,
10236
- gt: Re,
10236
+ gt: Le,
10237
10237
  gte: te,
10238
10238
  guid: pd,
10239
10239
  hash: Fd,
@@ -10255,12 +10255,12 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10255
10255
  ksuid: Ed,
10256
10256
  lazy: Ur,
10257
10257
  length: qt,
10258
- literal: Ge,
10258
+ literal: Xe,
10259
10259
  locales: $u,
10260
10260
  looseObject: rh,
10261
10261
  looseRecord: ah,
10262
10262
  lowercase: Yn,
10263
- lt: Me,
10263
+ lt: Re,
10264
10264
  lte: ie,
10265
10265
  mac: Pd,
10266
10266
  map: sh,
@@ -10268,7 +10268,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10268
10268
  maxSize: Ht,
10269
10269
  meta: _h,
10270
10270
  mime: er,
10271
- minLength: Ke,
10271
+ minLength: qe,
10272
10272
  minSize: gt,
10273
10273
  multipleOf: ft,
10274
10274
  nan: mh,
@@ -10315,7 +10315,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10315
10315
  slugify: or,
10316
10316
  startsWith: qn,
10317
10317
  strictObject: nh,
10318
- string: De,
10318
+ string: Ae,
10319
10319
  stringFormat: Rd,
10320
10320
  stringbool: wh,
10321
10321
  success: hh,
@@ -10334,7 +10334,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10334
10334
  ulid: zd,
10335
10335
  undefined: Kd,
10336
10336
  union: wt,
10337
- unknown: qe,
10337
+ unknown: Qe,
10338
10338
  uppercase: Hn,
10339
10339
  url: $d,
10340
10340
  util: Ha,
@@ -10396,7 +10396,7 @@ function Lp(t) {
10396
10396
  return r.remove(), n;
10397
10397
  }
10398
10398
  async function zh(t, e, r, i, n = !0) {
10399
- const o = await navigator.clipboard.read(), a = o[0].types, [s, u] = n ? [t, e] : Be(t, e, r);
10399
+ const o = await navigator.clipboard.read(), a = o[0].types, [s, u] = n ? [t, e] : We(t, e, r);
10400
10400
  for (const c of a) {
10401
10401
  if (!Mp.find(
10402
10402
  (f) => f.endsWith("/") ? c.startsWith(f) : c === f
@@ -10476,7 +10476,7 @@ const ke = {
10476
10476
  }, ze = {
10477
10477
  Save: "save",
10478
10478
  Change: "statechange"
10479
- }, rt = {
10479
+ }, Ue = {
10480
10480
  start: "startloading",
10481
10481
  done: "completeloading"
10482
10482
  }, it = {
@@ -10646,7 +10646,7 @@ class la {
10646
10646
  this.width = (n - i) / this.target.sx * e, this.height = (a - o) / this.target.sy * r;
10647
10647
  }
10648
10648
  getSidesInScreenSpace(e, r) {
10649
- const [i, n] = r ? Ve(r) : [1, 1], { width: o, height: a, borderSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10649
+ const [i, n] = r ? Ye(r) : [1, 1], { width: o, height: a, borderSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10650
10650
  return {
10651
10651
  TOP: {
10652
10652
  x: l > 0 ? u : u - o * i,
@@ -10675,7 +10675,7 @@ class la {
10675
10675
  }[e];
10676
10676
  }
10677
10677
  getCornersInScreenSpace(e, r) {
10678
- const [i, n] = r ? Ve(r) : [1, 1], { width: o, height: a, boxSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10678
+ const [i, n] = r ? Ye(r) : [1, 1], { width: o, height: a, boxSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10679
10679
  return {
10680
10680
  TOPLEFT: {
10681
10681
  x: u - s,
@@ -10717,7 +10717,7 @@ class la {
10717
10717
  */
10718
10718
  hitTest(e, r, i) {
10719
10719
  if (this.mode === ce.PASSIVE) return;
10720
- const [n, o] = Ve(this.target.worldMatrix), [a, s] = kt(this.target.worldMatrix), [u, c] = le(i, e, r), l = 4;
10720
+ const [n, o] = Ye(this.target.worldMatrix), [a, s] = kt(this.target.worldMatrix), [u, c] = le(i, e, r), l = 4;
10721
10721
  for (const E of yn) {
10722
10722
  const S = this.getCornersInScreenSpace(
10723
10723
  E,
@@ -10755,7 +10755,7 @@ class la {
10755
10755
  this.target.updateTranslation(e, r);
10756
10756
  }
10757
10757
  resize(e, r, i) {
10758
- if (this.target instanceof Ae) {
10758
+ if (this.target instanceof Me) {
10759
10759
  const n = Math.abs(this.width), o = Math.abs(this.height), a = n / o, s = this.target.sx, u = this.target.sy, c = 1e-6, l = Math.abs(n * s) < c ? c * kn(n * s || 1, c) : n * s, d = Math.abs(o * u) < c ? c * kn(o * u || 1, c) : o * u, m = e / l, f = r / d, $ = c, w = i === "LEFT" || i === "BOTTOMLEFT" || i === "TOPLEFT" ? 1 - m : i === "RIGHT" || i === "BOTTOMRIGHT" || i === "TOPRIGHT" ? 1 + m : i === "TOP" ? 1 - f : 1 + f;
10760
10760
  if (zn(s, w, $) || zn(u, w, $)) return;
10761
10761
  const P = n * s * w, L = o * u * w;
@@ -10800,7 +10800,7 @@ class la {
10800
10800
  }
10801
10801
  addCorners() {
10802
10802
  for (const e of yn) {
10803
- const r = new Ae(
10803
+ const r = new Me(
10804
10804
  this.getCornersInScreenSpace(e, this.target.worldMatrix)
10805
10805
  );
10806
10806
  r.color = this.mode === ce.ACTIVE ? st : hn, this.corners.set(e, r);
@@ -10820,7 +10820,7 @@ class la {
10820
10820
  }
10821
10821
  addSides() {
10822
10822
  for (const e of Nt) {
10823
- const r = new Ae(
10823
+ const r = new Me(
10824
10824
  this.getSidesInScreenSpace(e, this.target.worldMatrix)
10825
10825
  );
10826
10826
  r.color = this.mode === ce.ACTIVE ? st : hn, this.sides.set(e, r);
@@ -10866,18 +10866,18 @@ class Jp {
10866
10866
  }
10867
10867
  // dx and dy are in world units
10868
10868
  resize(e, r, i, n) {
10869
- const o = this.width, a = this.height, s = i.includes("TOP"), u = i.includes("BOTTOM"), c = i.includes("LEFT"), l = i.includes("RIGHT"), d = c ? this.x + o : l ? this.x : this.x + o / 2, m = s ? this.y + a : u ? this.y : this.y + a / 2, f = 1e-6, $ = Math.abs(o) < f ? o < 0 ? -f : f : o, w = Math.abs(a) < f ? a < 0 ? -f : f : a, [P, L] = Ve(n), A = e * P / $, E = r * L / w, S = i.includes("LEFT") ? 1 - A : i.includes("RIGHT") ? 1 + A : i === "TOP" ? 1 - E : 1 + E;
10869
+ const o = this.width, a = this.height, s = i.includes("TOP"), u = i.includes("BOTTOM"), c = i.includes("LEFT"), l = i.includes("RIGHT"), d = c ? this.x + o : l ? this.x : this.x + o / 2, m = s ? this.y + a : u ? this.y : this.y + a / 2, f = 1e-6, $ = Math.abs(o) < f ? o < 0 ? -f : f : o, w = Math.abs(a) < f ? a < 0 ? -f : f : a, [P, L] = Ye(n), A = e * P / $, E = r * L / w, S = i.includes("LEFT") ? 1 - A : i.includes("RIGHT") ? 1 + A : i === "TOP" ? 1 - E : 1 + E;
10870
10870
  if (zn(this.scale[0], S, f) || zn(this.scale[1], S, f))
10871
10871
  return;
10872
10872
  const se = o * S, St = a * S;
10873
10873
  if (!(Math.abs(se) < f || Math.abs(St) < f))
10874
10874
  for (const J of this.targets) {
10875
- const je = J.x, Ze = J.y, [ln, dn] = le(n, je, Ze), nt = d + (ln - d) * S, Rh = m + (dn - m) * S, Lh = nt - ln, Zh = Rh - dn, Fh = Math.abs(P) < f ? P < 0 ? -f : f : P, Bh = Math.abs(L) < f ? L < 0 ? -f : f : L, Wh = Lh / Fh, Gh = Zh / Bh;
10875
+ const je = J.x, Fe = J.y, [ln, dn] = le(n, je, Fe), rt = d + (ln - d) * S, Rh = m + (dn - m) * S, Lh = rt - ln, Zh = Rh - dn, Fh = Math.abs(P) < f ? P < 0 ? -f : f : P, Bh = Math.abs(L) < f ? L < 0 ? -f : f : L, Wh = Lh / Fh, Gh = Zh / Bh;
10876
10876
  J.updateScale(S, S), J.updateTranslation(Wh, Gh);
10877
10877
  }
10878
10878
  }
10879
10879
  flip(e, r, i) {
10880
- Ve(e);
10880
+ Ye(e);
10881
10881
  const n = [], [o, a] = i(this.x, this.y), [s, u] = i(
10882
10882
  this.x + this.width,
10883
10883
  this.y + this.height
@@ -11019,7 +11019,7 @@ class Jp {
11019
11019
  }
11020
11020
  addHandles() {
11021
11021
  for (const e of Ar) {
11022
- const r = this.getHandleConfig(e), i = new Ae(r);
11022
+ const r = this.getHandleConfig(e), i = new Me(r);
11023
11023
  i.color = st, this.handles.set(e, i);
11024
11024
  }
11025
11025
  }
@@ -11083,7 +11083,7 @@ class Jp {
11083
11083
  }[e];
11084
11084
  }
11085
11085
  }
11086
- class Qe {
11086
+ class et {
11087
11087
  // matrix: number[];
11088
11088
  constructor(e, r, i, n) {
11089
11089
  this.minX = e, this.minY = r, this.maxX = i, this.maxY = n;
@@ -11155,15 +11155,15 @@ class Vp {
11155
11155
  */
11156
11156
  getBoundingBox(e) {
11157
11157
  const [r, i] = e(this.x, this.y), [n, o] = e(this.x + this.width, this.y + this.height), a = Math.min(r, n), s = Math.max(r, n), u = Math.min(i, o), c = Math.max(i, o);
11158
- return new Qe(a, u, s, c);
11158
+ return new et(a, u, s, c);
11159
11159
  }
11160
11160
  resize(e, r, i) {
11161
- const [n, o] = Ve(i);
11161
+ const [n, o] = Ye(i);
11162
11162
  this.width += e * n, this.height += r * o;
11163
11163
  }
11164
11164
  addRects() {
11165
11165
  for (const e of da) {
11166
- const r = this.getRectConfig(e), i = new Ae(r);
11166
+ const r = this.getRectConfig(e), i = new Me(r);
11167
11167
  i.color = st, this.rects.set(e, i);
11168
11168
  }
11169
11169
  }
@@ -11241,20 +11241,20 @@ class Yp {
11241
11241
  return [this.x, this.y, this.width, this.height, this.rotation, this.zoom];
11242
11242
  }
11243
11243
  get translationMatrix() {
11244
- return Z.translation(this.x, this.y);
11244
+ return F.translation(this.x, this.y);
11245
11245
  }
11246
11246
  get rotationMatrix() {
11247
- return Z.rotation(this.rotation);
11247
+ return F.rotation(this.rotation);
11248
11248
  }
11249
11249
  get scaleMatrix() {
11250
- return Z.scaling(this.zoom, this.zoom);
11250
+ return F.scaling(this.zoom, this.zoom);
11251
11251
  }
11252
11252
  get cameraMatrix() {
11253
- const e = Z.multiply(this.translationMatrix, this.rotationMatrix);
11254
- return Z.multiply(e, this.scaleMatrix);
11253
+ const e = F.multiply(this.translationMatrix, this.rotationMatrix);
11254
+ return F.multiply(e, this.scaleMatrix);
11255
11255
  }
11256
11256
  get canvasMatrix() {
11257
- return Z.inverse(this.cameraMatrix);
11257
+ return F.inverse(this.cameraMatrix);
11258
11258
  }
11259
11259
  }
11260
11260
  function ha(t, e) {
@@ -11470,7 +11470,7 @@ class Hp {
11470
11470
  const c = this.getCanvasChildren(), l = this.marqueeBox.getBoundingBox(this.getMarqueeCoords);
11471
11471
  for (const d of c) {
11472
11472
  const m = d.getBoundingBox();
11473
- Qe.isColliding(m, l) && !this.#n.has(d) ? this.add([d]) : !Qe.isColliding(m, l) && this.#n.has(d) && this.remove([d]);
11473
+ et.isColliding(m, l) && !this.#n.has(d) ? this.add([d]) : !et.isColliding(m, l) && this.#n.has(d) && this.remove([d]);
11474
11474
  }
11475
11475
  } else
11476
11476
  this.move(i, n);
@@ -11719,7 +11719,7 @@ class nv {
11719
11719
  class rv {
11720
11720
  // reduces constant work to re-render if there are no changes
11721
11721
  constructor() {
11722
- this.translation = [0, 0], this.angleRadians = 0, this.scale = [1, 1], this.localMatrix = Z.identity(), this.worldMatrix = Z.identity(), this.children = [], this.parent = null, this.renderDirtyFlag = !0, Oa(this, {
11722
+ this.translation = [0, 0], this.angleRadians = 0, this.scale = [1, 1], this.localMatrix = F.identity(), this.worldMatrix = F.identity(), this.children = [], this.parent = null, this.renderDirtyFlag = !0, Oa(this, {
11723
11723
  translation: ee.struct,
11724
11724
  angleRadians: ee,
11725
11725
  scale: ee.struct,
@@ -11825,11 +11825,11 @@ class rv {
11825
11825
  this.renderDirtyFlag && (this.renderDirtyFlag = !1, this.updateLocalMatrix());
11826
11826
  }
11827
11827
  updateLocalMatrix() {
11828
- const e = Z.translation(this.translation[0], this.translation[1]), r = Z.rotation(this.angleRadians), i = Z.scaling(this.scale[0], this.scale[1]);
11829
- this.localMatrix = Z.multiply(Z.multiply(e, r), i);
11828
+ const e = F.translation(this.translation[0], this.translation[1]), r = F.rotation(this.angleRadians), i = F.scaling(this.scale[0], this.scale[1]);
11829
+ this.localMatrix = F.multiply(F.multiply(e, r), i);
11830
11830
  }
11831
11831
  updateWorldMatrix(e) {
11832
- this.worldMatrix = e ? Z.multiply(e, this.localMatrix) : this.localMatrix.slice();
11832
+ this.worldMatrix = e ? F.multiply(e, this.localMatrix) : this.localMatrix.slice();
11833
11833
  const r = this.worldMatrix;
11834
11834
  this.children.forEach((i) => {
11835
11835
  i.updateWorldMatrix(r);
@@ -11996,7 +11996,7 @@ const Mn = class Mn extends Eh {
11996
11996
  };
11997
11997
  Mn._seqCounter = 0;
11998
11998
  let _t = Mn;
11999
- class Ae extends _t {
11999
+ class Me extends _t {
12000
12000
  constructor(e) {
12001
12001
  super(e.x, e.y, e.sx, e.sy), this._width = e.width ?? 100, this._height = e.height ?? 100;
12002
12002
  }
@@ -12044,7 +12044,7 @@ class Ae extends _t {
12044
12044
  */
12045
12045
  getBoundingBox() {
12046
12046
  const e = this.state.translation[0], r = e + this.width * this.state.scaleX, i = this.state.translation[1], n = i + this.height * this.state.scaleY, o = Math.min(e, r), a = Math.max(e, r), s = Math.min(i, n), u = Math.max(i, n);
12047
- return this.AABB = new Qe(o, s, a, u), this.AABB;
12047
+ return this.AABB = new et(o, s, a, u), this.AABB;
12048
12048
  }
12049
12049
  /**
12050
12050
  * edges are unaffected by world zoom factor
@@ -12060,11 +12060,11 @@ class Ae extends _t {
12060
12060
  };
12061
12061
  }
12062
12062
  hitTest(e, r) {
12063
- const [i, n] = Ve(this.worldMatrix), [o, a] = kt(this.worldMatrix), [s, u] = le(this.parent.worldMatrix, e, r), [c, l] = le(this.worldMatrix), d = this.width * i * o, m = this.height * n * a, f = Math.min(c, c + d), $ = Math.max(c, c + d), w = Math.min(l, l + m), P = Math.max(l, l + m);
12063
+ const [i, n] = Ye(this.worldMatrix), [o, a] = kt(this.worldMatrix), [s, u] = le(this.parent.worldMatrix, e, r), [c, l] = le(this.worldMatrix), d = this.width * i * o, m = this.height * n * a, f = Math.min(c, c + d), $ = Math.max(c, c + d), w = Math.min(l, l + m), P = Math.max(l, l + m);
12064
12064
  return s >= f && s <= $ && u >= w && u <= P;
12065
12065
  }
12066
12066
  }
12067
- class Ne extends Ae {
12067
+ class Ce extends Me {
12068
12068
  constructor(e) {
12069
12069
  super(e), this.texCoordArray = new Float32Array([
12070
12070
  0,
@@ -12300,7 +12300,7 @@ class Th extends Eh {
12300
12300
  this.vertexCount = c.length / 2, e.bindBuffer(e.ARRAY_BUFFER, this.buffer), e.bufferData(e.ARRAY_BUFFER, c, e.STATIC_DRAW);
12301
12301
  }
12302
12302
  this.initialized || (this.setUpVertexData(e, r), this.setUpUniforms(e, r), this.initialized = !0);
12303
- const i = e.drawingBufferWidth, n = e.drawingBufferHeight, o = Z.inverse(Z.projection(i, n)), a = Z.inverse(this.worldMatrix), s = Z.multiply(a, o);
12303
+ const i = e.drawingBufferWidth, n = e.drawingBufferHeight, o = F.inverse(F.projection(i, n)), a = F.inverse(this.worldMatrix), s = F.multiply(a, o);
12304
12304
  this.viewProjectionInvLocation && e.uniformMatrix3fv(
12305
12305
  this.viewProjectionInvLocation,
12306
12306
  !1,
@@ -12350,7 +12350,7 @@ class av {
12350
12350
  this.state.width + this.viewportX,
12351
12351
  this.state.height + this.viewportY
12352
12352
  );
12353
- return new Qe(e, r, i, n);
12353
+ return new et(e, r, i, n);
12354
12354
  }
12355
12355
  onWheel(e) {
12356
12356
  e.preventDefault();
@@ -12395,7 +12395,7 @@ function Mr(t) {
12395
12395
  return t.children.map(Ph);
12396
12396
  }
12397
12397
  function Ph(t) {
12398
- return t instanceof Ne ? {
12398
+ return t instanceof Ce ? {
12399
12399
  type: "Img",
12400
12400
  id: t.seq,
12401
12401
  renderOrder: t.renderOrder,
@@ -12404,7 +12404,7 @@ function Ph(t) {
12404
12404
  height: t.height,
12405
12405
  fileId: t.fileId,
12406
12406
  children: t.children?.length ? Mr(t) : void 0
12407
- } : t instanceof Ae ? {
12407
+ } : t instanceof Me ? {
12408
12408
  type: "Rect",
12409
12409
  id: t.seq,
12410
12410
  renderOrder: t.renderOrder,
@@ -12446,7 +12446,7 @@ async function ya(t, e, r, i) {
12446
12446
  let s;
12447
12447
  switch (o.type) {
12448
12448
  case "Rect":
12449
- s = new Ae({
12449
+ s = new Me({
12450
12450
  x: o.transform.x,
12451
12451
  y: o.transform.y,
12452
12452
  width: o.width,
@@ -12456,25 +12456,15 @@ async function ya(t, e, r, i) {
12456
12456
  case "Img":
12457
12457
  let u;
12458
12458
  try {
12459
- u = (() => {
12460
- if (t.files && Array.isArray(t.files)) {
12461
- const m = t.files.find(
12462
- (f) => f.id === o.fileId
12463
- );
12464
- return r(o.fileId).then((f) => {
12465
- f || i(m.dataURL);
12466
- }).catch(
12467
- (f) => console.error("Image not written to database", f)
12468
- ), m?.dataURL ?? pa;
12469
- }
12470
- return pa;
12471
- })();
12459
+ u = t.files && Array.isArray(t.files) ? t.files.find(
12460
+ (f) => f.id === o.fileId
12461
+ )?.dataURL ?? pa : pa;
12472
12462
  const c = o.width, l = o.height, d = await cv(
12473
12463
  u,
12474
12464
  c * o.transform.sx,
12475
12465
  l * o.transform.sy
12476
12466
  );
12477
- if (s = new Ne({
12467
+ if (s = new Ce({
12478
12468
  x: o.transform.x,
12479
12469
  y: o.transform.y,
12480
12470
  src: d,
@@ -12484,7 +12474,11 @@ async function ya(t, e, r, i) {
12484
12474
  const m = t.files.find(
12485
12475
  (f) => f.id === o.fileId
12486
12476
  );
12487
- s.src = m.dataURL;
12477
+ s.src = m.dataURL, r(o.fileId).then((f) => {
12478
+ f || i(m.dataURL);
12479
+ }).catch(
12480
+ (f) => console.error("Failed to write the image to storage", f)
12481
+ );
12488
12482
  } else
12489
12483
  r(o.fileId).then((m) => {
12490
12484
  s.src = m.dataURL;
@@ -12553,18 +12547,18 @@ const Rr = me({
12553
12547
  sx: z(),
12554
12548
  sy: z()
12555
12549
  }).strict(), uv = me({
12556
- id: wt([De(), z()]),
12557
- dataURL: De().regex(
12550
+ id: wt([Ae(), z()]),
12551
+ dataURL: Ae().regex(
12558
12552
  /^data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=\s]+$/,
12559
12553
  "Invalid image data URL"
12560
12554
  ),
12561
- mimetype: De().regex(/^image\/[a-z0-9.+-]+$/i, "Invalid image MIME type"),
12555
+ mimetype: Ae().regex(/^image\/[a-z0-9.+-]+$/i, "Invalid image MIME type"),
12562
12556
  created: z(),
12563
12557
  lastRetrieved: z()
12564
12558
  }).strict(), Tt = Ur(
12565
12559
  () => lo("type", [
12566
12560
  me({
12567
- type: Ge("Rect"),
12561
+ type: Xe("Rect"),
12568
12562
  id: z().int().optional(),
12569
12563
  transform: Rr,
12570
12564
  children: ve(Tt).optional(),
@@ -12575,7 +12569,7 @@ const Rr = me({
12575
12569
  color: kr([z(), z(), z(), z()])
12576
12570
  }).strict(),
12577
12571
  me({
12578
- type: Ge("Img"),
12572
+ type: Xe("Img"),
12579
12573
  id: z().int().optional(),
12580
12574
  transform: Rr,
12581
12575
  children: ve(Tt).optional(),
@@ -12583,16 +12577,16 @@ const Rr = me({
12583
12577
  renderOrder: z().int().optional(),
12584
12578
  width: z().positive(),
12585
12579
  height: z().positive(),
12586
- fileId: wt([De(), z()]).optional()
12580
+ fileId: wt([Ae(), z()]).optional()
12587
12581
  }).strict(),
12588
12582
  me({
12589
- type: Ge("Grid"),
12583
+ type: Xe("Grid"),
12590
12584
  id: z().int().optional(),
12591
12585
  style: z().int().optional(),
12592
12586
  children: ve(Tt).optional()
12593
12587
  }).strict(),
12594
12588
  me({
12595
- type: Ge("Renderable"),
12589
+ type: Xe("Renderable"),
12596
12590
  id: z().int().optional(),
12597
12591
  transform: Rr.optional(),
12598
12592
  children: ve(Tt).optional(),
@@ -12605,7 +12599,7 @@ const Rr = me({
12605
12599
  x: z(),
12606
12600
  y: z()
12607
12601
  }).strict(), dv = me({
12608
- version: Ge(1),
12602
+ version: Xe(1),
12609
12603
  canvas: me({
12610
12604
  width: z().positive(),
12611
12605
  height: z().positive(),
@@ -12622,35 +12616,35 @@ function ba(t) {
12622
12616
  throw new Error(`Invalid canvas data: ${e.error.message}`);
12623
12617
  return e.data;
12624
12618
  }
12625
- var fe, Se, Xe, ge, T, xe, ct, Je, Ie, Q, Ce, X, ut, Rn, lt;
12619
+ var fe, Se, Je, ge, T, xe, ct, Ve, Ie, Q, De, X, ut, Rn, lt;
12626
12620
  const W = class W extends Oh {
12627
12621
  constructor(r, i, n, o, a, s) {
12628
12622
  super();
12629
12623
  V(this, fe);
12630
12624
  V(this, Se);
12631
- V(this, Xe);
12625
+ V(this, Je);
12632
12626
  V(this, ge);
12633
12627
  V(this, T);
12634
12628
  V(this, xe);
12635
12629
  V(this, ct);
12636
- V(this, Je);
12630
+ V(this, Ve);
12637
12631
  V(this, Ie);
12638
12632
  V(this, Q);
12639
- V(this, Ce);
12633
+ V(this, De);
12640
12634
  V(this, X);
12641
12635
  V(this, ut);
12642
12636
  V(this, Rn);
12643
12637
  V(this, lt);
12644
- F(this, Q, null), F(this, Ce, !0), this.orderDirty = !0, this.renderList = [], F(this, fe, r), F(this, Se, n), F(this, Xe, i), F(this, Ie, new Th()), F(this, T, r.getContext("webgl", {
12638
+ B(this, Q, null), B(this, De, !0), this.orderDirty = !0, this.renderList = [], B(this, fe, r), B(this, Se, n), B(this, Je, i), B(this, Ie, new Th()), B(this, T, r.getContext("webgl", {
12645
12639
  alpha: !0,
12646
12640
  premultipliedAlpha: !1
12647
- })), v(this, T).enable(v(this, T).BLEND), v(this, T).blendFunc(v(this, T).SRC_ALPHA, v(this, T).ONE_MINUS_SRC_ALPHA), v(this, T).getExtension("OES_standard_derivatives"), v(this, T).enable(v(this, T).DEPTH_TEST), v(this, T).depthFunc(v(this, T).LEQUAL), F(this, xe, Dr(v(this, T), Zp, Fp)), F(this, ct, Dr(v(this, T), Gp, Xp)), F(this, Je, Dr(v(this, T), Bp, Wp)), this.writeToStorage = o, this.saveImgFileToStorage = a, this.getContainerDimension = s, this.engine = this.engine.bind(this), this.getBoundingClientRect = this.getBoundingClientRect.bind(this), this.appendChild = this.appendChild.bind(this), this.addImageToCanvas = this.addImageToCanvas.bind(this), this.setShapeZOrder = this.setShapeZOrder.bind(this), this.toggleGrid = this.toggleGrid.bind(this), this.changeMode = this.changeMode.bind(this), this.getSelected = this.getSelected.bind(this), this.updateZoomByFixedAmount = this.updateZoomByFixedAmount.bind(this), this.getCenterPoint = this.getCenterPoint.bind(this), this.assignEventListener = this.assignEventListener.bind(this), this.getWorldsCoordsFromCanvas = (m, f) => Be(m, f, this);
12648
- const u = (m, f) => Be(
12641
+ })), v(this, T).enable(v(this, T).BLEND), v(this, T).blendFunc(v(this, T).SRC_ALPHA, v(this, T).ONE_MINUS_SRC_ALPHA), v(this, T).getExtension("OES_standard_derivatives"), v(this, T).enable(v(this, T).DEPTH_TEST), v(this, T).depthFunc(v(this, T).LEQUAL), B(this, xe, Dr(v(this, T), Zp, Fp)), B(this, ct, Dr(v(this, T), Gp, Xp)), B(this, Ve, Dr(v(this, T), Bp, Wp)), this.writeToStorage = o, this.saveImgFileToStorage = a, this.getContainerDimension = s, this.engine = this.engine.bind(this), this.getBoundingClientRect = this.getBoundingClientRect.bind(this), this.appendChild = this.appendChild.bind(this), this.addImageToCanvas = this.addImageToCanvas.bind(this), this.setShapeZOrder = this.setShapeZOrder.bind(this), this.toggleGrid = this.toggleGrid.bind(this), this.changeMode = this.changeMode.bind(this), this.getSelected = this.getSelected.bind(this), this.updateZoomByFixedAmount = this.updateZoomByFixedAmount.bind(this), this.getCenterPoint = this.getCenterPoint.bind(this), this.assignEventListener = this.assignEventListener.bind(this), this.getWorldsCoordsFromCanvas = (m, f) => We(m, f, this);
12642
+ const u = (m, f) => We(
12649
12643
  m + this.camera.viewportX,
12650
12644
  f + this.camera.viewportY,
12651
12645
  this
12652
12646
  );
12653
- this.exportState = this.exportState.bind(this), this.clearChildren = this.clearChildren.bind(this), F(this, X, new Hp(
12647
+ this.exportState = this.exportState.bind(this), this.clearChildren = this.clearChildren.bind(this), B(this, X, new Hp(
12654
12648
  i,
12655
12649
  n,
12656
12650
  this.gl,
@@ -12661,17 +12655,17 @@ const W = class W extends Oh {
12661
12655
  u
12662
12656
  ));
12663
12657
  const c = new Yp({});
12664
- F(this, ge, new av(
12658
+ B(this, ge, new av(
12665
12659
  c,
12666
12660
  this.setWorldMatrix,
12667
12661
  this.updateWorldMatrix,
12668
12662
  this.getWorldsCoordsFromCanvas
12669
- )), F(this, Rn, new Qp(
12663
+ )), B(this, Rn, new Qp(
12670
12664
  i,
12671
12665
  n,
12672
12666
  () => this.selectionManager.deleteSelected(this),
12673
12667
  this.assignEventListener
12674
- )), F(this, lt, new ev(
12668
+ )), B(this, lt, new ev(
12675
12669
  n,
12676
12670
  this.selectionManager.isMultiBoundingBoxHit,
12677
12671
  this.selectionManager.isBoundingBoxHit,
@@ -12712,7 +12706,7 @@ const W = class W extends Oh {
12712
12706
  isSelection: this.selectionManager.isRectSelected,
12713
12707
  hitTestAdjustedCorner: this.selectionManager.hitTestAdjustedCorner
12714
12708
  };
12715
- F(this, ut, new qp(d)), v(this, Se).on("save", this.writeToStorage);
12709
+ B(this, ut, new qp(d)), v(this, Se).on("save", this.writeToStorage);
12716
12710
  }
12717
12711
  // Call this whenever children/layers/z-order change
12718
12712
  markOrderDirty() {
@@ -12725,7 +12719,7 @@ const W = class W extends Oh {
12725
12719
  return v(this, Ie);
12726
12720
  }
12727
12721
  get history() {
12728
- return v(this, Xe);
12722
+ return v(this, Je);
12729
12723
  }
12730
12724
  get eventHub() {
12731
12725
  return v(this, Se);
@@ -12746,10 +12740,10 @@ const W = class W extends Oh {
12746
12740
  return v(this, ge);
12747
12741
  }
12748
12742
  get isGlobalClick() {
12749
- return v(this, Ce);
12743
+ return v(this, De);
12750
12744
  }
12751
12745
  set isGlobalClick(r) {
12752
- F(this, Ce, r);
12746
+ B(this, De, r);
12753
12747
  }
12754
12748
  get basicShapeProgram() {
12755
12749
  return v(this, xe);
@@ -12799,20 +12793,20 @@ const W = class W extends Oh {
12799
12793
  c.height
12800
12794
  );
12801
12795
  }
12802
- v(this, T).useProgram(v(this, Je));
12803
- const r = v(this, T).getUniformLocation(v(this, Je), "u_z");
12804
- v(this, T).uniform1f(r, 0), v(this, Ie).render(v(this, T), v(this, Je));
12796
+ v(this, T).useProgram(v(this, Ve));
12797
+ const r = v(this, T).getUniformLocation(v(this, Ve), "u_z");
12798
+ v(this, T).uniform1f(r, 0), v(this, Ie).render(v(this, T), v(this, Ve));
12805
12799
  const i = this.camera.getBoundingBox();
12806
12800
  this.renderList = [];
12807
12801
  for (const c of this.children)
12808
- !v(this, Q) && !Qe.isColliding(i, c.getBoundingBox()) ? c.culled = !0 : (this.renderList.push(c), c.culled = !1);
12809
- const [n, o] = Be(0, 0, this), [a, s] = Be(
12802
+ !v(this, Q) && !et.isColliding(i, c.getBoundingBox()) ? c.culled = !0 : (this.renderList.push(c), c.culled = !1);
12803
+ const [n, o] = We(0, 0, this), [a, s] = We(
12810
12804
  window.screen.width,
12811
12805
  window.screen.height,
12812
12806
  this
12813
- ), u = new Qe(n, o, a, s);
12807
+ ), u = new et(n, o, a, s);
12814
12808
  this.renderList.forEach((c) => {
12815
- if (c instanceof Ne) {
12809
+ if (c instanceof Ce) {
12816
12810
  const l = c.determineIfLowRes(
12817
12811
  u,
12818
12812
  this.camera.state.zoom
@@ -12825,7 +12819,7 @@ const W = class W extends Oh {
12825
12819
  });
12826
12820
  for (const c of this.renderList) {
12827
12821
  let l;
12828
- c instanceof Ne ? l = v(this, ct) : c instanceof _t && (l = v(this, xe)), v(this, T).useProgram(l);
12822
+ c instanceof Ce ? l = v(this, ct) : c instanceof _t && (l = v(this, xe)), v(this, T).useProgram(l);
12829
12823
  const d = v(this, T).getUniformLocation(l, "u_z");
12830
12824
  v(this, T).uniform1f(d, c.getZ()), c.render(v(this, T), l);
12831
12825
  }
@@ -12843,10 +12837,10 @@ const W = class W extends Oh {
12843
12837
  v(this, fe).addEventListener(r, i, n);
12844
12838
  }
12845
12839
  hitTest(r, i) {
12846
- return F(this, Ce, !0), v(this, Ce);
12840
+ return B(this, De, !0), v(this, De);
12847
12841
  }
12848
12842
  async addImageToCanvas(r, i, n, o = 1, a = 1, s = !1) {
12849
- const u = new Ne({ x: i, y: n, src: r, sx: o, sy: a });
12843
+ const u = new Ce({ x: i, y: n, src: r, sx: o, sy: a });
12850
12844
  if (this.saveImgFileToStorage(r).then((c) => u.fileId = c), s) {
12851
12845
  const c = new Image();
12852
12846
  c.src = r.startsWith("data:image/png") ? r : await Ta(r), c.onload = () => {
@@ -12860,7 +12854,7 @@ const W = class W extends Oh {
12860
12854
  return Jr(this);
12861
12855
  }
12862
12856
  clearChildren() {
12863
- this.selectionManager.clear(), this.state.clearChildren(), v(this, Xe).clear();
12857
+ this.selectionManager.clear(), this.state.clearChildren(), v(this, Je).clear();
12864
12858
  }
12865
12859
  toggleGrid() {
12866
12860
  v(this, Ie).changeGridType(
@@ -12884,7 +12878,7 @@ const W = class W extends Oh {
12884
12878
  const a = Math.max(...o), s = Math.min(...o);
12885
12879
  i.renderOrder = r ? a + 1 : s - 1, n.end = {
12886
12880
  renderOrder: i.renderOrder
12887
- }, this.markOrderDirty(), v(this, Xe).push(tv([n])), v(this, Se).emit(ze.Change);
12881
+ }, this.markOrderDirty(), v(this, Je).push(tv([n])), v(this, Se).emit(ze.Change);
12888
12882
  }
12889
12883
  changeMode() {
12890
12884
  v(this, ut).changeMode(), v(this, X).clear();
@@ -12958,38 +12952,38 @@ const W = class W extends Oh {
12958
12952
  const { scale: l, canvasHeight: d, canvasWidth: m, contentHeight: f, contentWidth: $ } = this.calculateScaleForThumbnail(c, n, o), w = Math.max(1e-4, l);
12959
12953
  this.camera.state.setZoom(w);
12960
12954
  const P = this.getCenterPoint(), L = P[0] - this.canvas.width * w / 2, A = P[1] - this.canvas.height * w / 2;
12961
- v(this, ge).setCameraPos(L, A), F(this, Q, {
12955
+ v(this, ge).setCameraPos(L, A), B(this, Q, {
12962
12956
  x: (n - m) / 2,
12963
12957
  y: (o - d) / 2,
12964
12958
  // ensure that the image stays proportioned - the passed in values of height and width must match the AR of the canvas you're using
12965
12959
  height: d,
12966
12960
  width: m
12967
- }), this.grid.gridType = 0, this.render(), F(this, Q, null);
12961
+ }), this.grid.gridType = 0, this.render(), B(this, Q, null);
12968
12962
  const E = new Uint8Array(n * o * 4);
12969
12963
  i.readPixels(0, 0, n, o, i.RGBA, i.UNSIGNED_BYTE, E);
12970
12964
  const S = n * 4, se = new Uint8ClampedArray(E.length);
12971
12965
  for (let J = 0; J < o; J++) {
12972
- const je = J * S, Ze = (o - 1 - J) * S;
12973
- se.set(E.subarray(je, je + S), Ze);
12966
+ const je = J * S, Fe = (o - 1 - J) * S;
12967
+ se.set(E.subarray(je, je + S), Fe);
12974
12968
  }
12975
12969
  this.camera.state.setZoom(u.zoom), this.camera.setCameraPos(u.x, u.y), this.grid.gridType = u.gridType, this.selectionManager.selected = u.selected, i.bindFramebuffer(i.FRAMEBUFFER, null), i.viewport(0, 0, i.canvas.width, i.canvas.height), i.deleteTexture(s), i.deleteFramebuffer(a);
12976
12970
  const St = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(n, o) : null;
12977
12971
  if (St) {
12978
12972
  const J = St.getContext("2d"), je = new ImageData(se, n, o);
12979
12973
  J.putImageData(je, 0, 0);
12980
- const Ze = await St.convertToBlob({
12974
+ const Fe = await St.convertToBlob({
12981
12975
  type: "image/jpeg",
12982
12976
  quality: 0.92
12983
12977
  });
12984
12978
  return await new Promise((ln, dn) => {
12985
- const nt = new FileReader();
12986
- nt.onloadend = () => ln(nt.result), nt.onerror = dn, nt.readAsDataURL(Ze);
12979
+ const rt = new FileReader();
12980
+ rt.onloadend = () => ln(rt.result), rt.onerror = dn, rt.readAsDataURL(Fe);
12987
12981
  });
12988
12982
  } else {
12989
12983
  const J = document.createElement("canvas");
12990
12984
  J.width = n, J.height = o;
12991
- const je = J.getContext("2d"), Ze = new ImageData(se, n, o);
12992
- return je.putImageData(Ze, 0, 0), J.toDataURL("image/jpeg");
12985
+ const je = J.getContext("2d"), Fe = new ImageData(se, n, o);
12986
+ return je.putImageData(Fe, 0, 0), J.toDataURL("image/jpeg");
12993
12987
  }
12994
12988
  }
12995
12989
  /**
@@ -13015,7 +13009,7 @@ const W = class W extends Oh {
13015
13009
  getContentBound() {
13016
13010
  let r = 1 / 0, i = 1 / 0, n = -1 / 0, o = -1 / 0, a = !1;
13017
13011
  for (const s of this.children) {
13018
- if (!(s instanceof Ne)) continue;
13012
+ if (!(s instanceof Ce)) continue;
13019
13013
  const u = s.getEdge();
13020
13014
  !isFinite(u.minX) || !isFinite(u.minY) || !isFinite(u.maxX) || !isFinite(u.maxY) || (a = !0, r = Math.min(r, u.minX), n = Math.max(n, u.maxX), i = Math.min(i, u.minY), o = Math.max(o, u.maxY));
13021
13015
  }
@@ -13024,7 +13018,7 @@ const W = class W extends Oh {
13024
13018
  getCenterPoint() {
13025
13019
  let r = Number.MAX_SAFE_INTEGER, i = Number.MAX_SAFE_INTEGER, n = Number.MIN_SAFE_INTEGER, o = Number.MIN_SAFE_INTEGER;
13026
13020
  for (const a of this.children) {
13027
- if (!(a instanceof Ne)) continue;
13021
+ if (!(a instanceof Ce)) continue;
13028
13022
  const s = a.getEdge();
13029
13023
  r = Math.min(r, s.minX), n = Math.max(n, s.maxX), i = Math.min(i, s.minY), o = Math.max(o, s.maxY);
13030
13024
  }
@@ -13050,7 +13044,7 @@ const W = class W extends Oh {
13050
13044
  };
13051
13045
  }
13052
13046
  };
13053
- fe = new WeakMap(), Se = new WeakMap(), Xe = new WeakMap(), ge = new WeakMap(), T = new WeakMap(), xe = new WeakMap(), ct = new WeakMap(), Je = new WeakMap(), Ie = new WeakMap(), Q = new WeakMap(), Ce = new WeakMap(), X = new WeakMap(), ut = new WeakMap(), Rn = new WeakMap(), lt = new WeakMap(), W.webglStats = {
13047
+ fe = new WeakMap(), Se = new WeakMap(), Je = new WeakMap(), ge = new WeakMap(), T = new WeakMap(), xe = new WeakMap(), ct = new WeakMap(), Ve = new WeakMap(), Ie = new WeakMap(), Q = new WeakMap(), De = new WeakMap(), X = new WeakMap(), ut = new WeakMap(), Rn = new WeakMap(), lt = new WeakMap(), W.webglStats = {
13054
13048
  buffersCreated: 0,
13055
13049
  buffersDeleted: 0,
13056
13050
  programsCreated: 0,
@@ -13759,7 +13753,7 @@ const Lv = {
13759
13753
  }, Ia = {
13760
13754
  MAX_IMAGE_ENTRIES: 1e3
13761
13755
  };
13762
- class Fe extends Cv {
13756
+ class Be extends Cv {
13763
13757
  constructor() {
13764
13758
  super(), this.dbQueue = new za(), this.cache = /* @__PURE__ */ new Map(), this.CACHE_LIMIT = 500, this.dbQueue = new za(), this.dbPromise = this.initDb();
13765
13759
  }
@@ -14041,10 +14035,10 @@ var Jv = Object.getOwnPropertyDescriptor, Dh = (t) => {
14041
14035
  for (var n = i > 1 ? void 0 : i ? Jv(e, r) : e, o = t.length - 1, a; o >= 0; o--)
14042
14036
  (a = t[o]) && (n = a(n) || n);
14043
14037
  return n;
14044
- }, Ah = (t, e, r) => e.has(t) || Dh("Cannot " + r), g = (t, e, r) => (Ah(t, e, "read from private field"), r ? r.call(t) : e.get(t)), K = (t, e, r) => e.has(t) ? Dh("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), C = (t, e, r, i) => (Ah(t, e, "write to private field"), e.set(t, r), r), _, B, $n, be, D, G, Pt, wn, jt, Ut, _e, Ue, Sn, xn, In;
14038
+ }, Ah = (t, e, r) => e.has(t) || Dh("Cannot " + r), g = (t, e, r) => (Ah(t, e, "read from private field"), r ? r.call(t) : e.get(t)), K = (t, e, r) => e.has(t) ? Dh("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), C = (t, e, r, i) => (Ah(t, e, "write to private field"), e.set(t, r), r), _, Z, $n, be, D, G, Pt, wn, jt, Ut, _e, Ne, Sn, xn, In;
14045
14039
  let An = class extends Vh {
14046
14040
  constructor() {
14047
- super(...arguments), this.name = "Reffy", this.displayMode = "fullscreen", K(this, _), K(this, B), K(this, $n), K(this, be), K(this, D), K(this, G), K(this, Pt, 3e5), K(this, wn), K(this, jt), K(this, Ut), K(this, _e), K(this, Ue, /* @__PURE__ */ new Set()), K(this, Sn), K(this, xn), K(this, In), this.handleGlobalPointerDown = (t) => {
14041
+ super(...arguments), this.name = "Reffy", this.displayMode = "fullscreen", K(this, _), K(this, Z), K(this, $n), K(this, be), K(this, D), K(this, G), K(this, Pt, 3e5), K(this, wn), K(this, jt), K(this, Ut), K(this, _e), K(this, Ne, /* @__PURE__ */ new Set()), K(this, Sn), K(this, xn), K(this, In), this.handleGlobalPointerDown = (t) => {
14048
14042
  !this.contains(t.target) && !this.renderRoot.contains(t.target) && this.clearContextMenu();
14049
14043
  };
14050
14044
  }
@@ -14063,19 +14057,19 @@ let An = class extends Vh {
14063
14057
  * Setting this will replace all registered handlers with the provided one.
14064
14058
  */
14065
14059
  get onCanvasChange() {
14066
- return g(this, Ue).values().next().value;
14060
+ return g(this, Ne).values().next().value;
14067
14061
  }
14068
14062
  set onCanvasChange(t) {
14069
- g(this, Ue).clear(), t && g(this, Ue).add(t);
14063
+ g(this, Ne).clear(), t && g(this, Ne).add(t);
14070
14064
  }
14071
14065
  registerOnCanvasChange(t) {
14072
- typeof t == "function" && g(this, Ue).add(t);
14066
+ typeof t == "function" && g(this, Ne).add(t);
14073
14067
  }
14074
14068
  deregisterOnCanvasChange(t) {
14075
- g(this, Ue).delete(t);
14069
+ g(this, Ne).delete(t);
14076
14070
  }
14077
14071
  get eventHub() {
14078
- return g(this, B);
14072
+ return g(this, Z);
14079
14073
  }
14080
14074
  get rootDiv() {
14081
14075
  return g(this, _e);
@@ -14110,14 +14104,14 @@ let An = class extends Vh {
14110
14104
  r && i && this.resizeCanvas(r, i);
14111
14105
  }
14112
14106
  async initCanvas() {
14113
- await this.warmUpStorage(), C(this, be, new hv()), C(this, B, new Hh());
14107
+ await this.warmUpStorage(), C(this, be, new hv()), C(this, Z, new Hh());
14114
14108
  const t = document.createElement("div");
14115
14109
  t.style.overflow = "hidden", this.renderRoot.appendChild(t), C(this, _e, t);
14116
14110
  const e = document.createElement("canvas");
14117
14111
  this.assignFileStorage = this.assignFileStorage.bind(this), this.getImageFileMetadata = this.getImageFileMetadata.bind(this), this.getAllImageFileMetdata = this.getAllImageFileMetdata.bind(this), this.saveImageFileMetadata = this.saveImageFileMetadata.bind(this), this.restoreStateFromCanvasStorage = this.restoreStateFromCanvasStorage.bind(this), this.assignCanvasStorage = this.assignCanvasStorage.bind(this), this.saveToCanvasStorage = this.saveToCanvasStorage.bind(this), this.debounceSaveToCanvasStorage = this.debounceSaveToCanvasStorage.bind(this), this.importCanvas = this.importCanvas.bind(this), this.exportCanvas = this.exportCanvas.bind(this), this.addContextMenu = Ov.bind(this), this.clearContextMenu = Ev.bind(this), this.isContextMenuActive = Tv.bind(this), this.getContainerSize = this.getContainerSize.bind(this), t.contains(e) || t.appendChild(e), this.registerSignal(), C(this, _, new Dn(
14118
14112
  e,
14119
14113
  g(this, be),
14120
- g(this, B),
14114
+ g(this, Z),
14121
14115
  this.debounceSaveToCanvasStorage,
14122
14116
  this.saveImageFileMetadata,
14123
14117
  this.getContainerSize
@@ -14153,22 +14147,22 @@ let An = class extends Vh {
14153
14147
  }
14154
14148
  // Register signal
14155
14149
  registerSignal() {
14156
- g(this, B).on(rt.start, Gv.bind(this), "spinner"), g(this, B).on(rt.done, Xv.bind(this)), g(this, B).on(ke.Open, this.addContextMenu), g(this, B).on(ke.Close, this.clearContextMenu), g(this, B).on(ze.Change, () => {
14157
- for (const t of g(this, Ue))
14150
+ g(this, Z).on(Ue.start, Gv.bind(this), "spinner"), g(this, Z).on(Ue.done, Xv.bind(this)), g(this, Z).on(ke.Open, this.addContextMenu), g(this, Z).on(ke.Close, this.clearContextMenu), g(this, Z).on(ze.Change, () => {
14151
+ for (const t of g(this, Ne))
14158
14152
  try {
14159
14153
  t();
14160
14154
  } catch (e) {
14161
14155
  console.error("onCanvasChange handler failed", e);
14162
14156
  }
14163
- }), g(this, B).on(it.Save, this.saveToCanvasStorage), g(this, B).on(it.SaveCompleted, () => {
14164
- }), g(this, B).on(
14157
+ }), g(this, Z).on(it.Save, this.saveToCanvasStorage), g(this, Z).on(it.SaveCompleted, () => {
14158
+ }), g(this, Z).on(
14165
14159
  it.SaveFailed,
14166
14160
  () => console.error("Failed to Save!")
14167
14161
  );
14168
14162
  }
14169
14163
  // need to check if this is good practice
14170
14164
  async warmUpStorage() {
14171
- g(this, D) || C(this, D, new Fe());
14165
+ g(this, D) || C(this, D, new Be());
14172
14166
  try {
14173
14167
  await g(this, D).readAll();
14174
14168
  } catch (t) {
@@ -14209,7 +14203,7 @@ let An = class extends Vh {
14209
14203
  * @returns The unique ID that the image has been logged with. This is a hashed version of the image data URL
14210
14204
  */
14211
14205
  async saveImageFileMetadata(t) {
14212
- g(this, D) || C(this, D, new Fe());
14206
+ g(this, D) || C(this, D, new Be());
14213
14207
  try {
14214
14208
  const e = await Hr(t);
14215
14209
  return await g(this, D).checkIfImageStored(e) ? e : await g(this, D).write(t);
@@ -14222,7 +14216,7 @@ let An = class extends Vh {
14222
14216
  * @returns
14223
14217
  */
14224
14218
  async getImageFileMetadata(t) {
14225
- g(this, D) || C(this, D, new Fe());
14219
+ g(this, D) || C(this, D, new Be());
14226
14220
  try {
14227
14221
  return await g(this, D).read(t);
14228
14222
  } catch (e) {
@@ -14233,7 +14227,7 @@ let An = class extends Vh {
14233
14227
  * @returns All file metadata saved in connected storage
14234
14228
  */
14235
14229
  async getAllImageFileMetdata() {
14236
- g(this, D) || C(this, D, new Fe());
14230
+ g(this, D) || C(this, D, new Be());
14237
14231
  try {
14238
14232
  return await g(this, D).readAll();
14239
14233
  } catch (t) {
@@ -14241,7 +14235,7 @@ let An = class extends Vh {
14241
14235
  }
14242
14236
  }
14243
14237
  async deleteAllImageFileMetadata() {
14244
- g(this, D) || C(this, D, new Fe());
14238
+ g(this, D) || C(this, D, new Be());
14245
14239
  try {
14246
14240
  await g(this, D).deleteAll();
14247
14241
  } catch (t) {
@@ -14267,10 +14261,10 @@ let An = class extends Vh {
14267
14261
  g(this, G) || C(this, G, new $e(this.name)), clearTimeout(g(this, wn)), C(this, wn, setTimeout(this.saveToCanvasStorage, t));
14268
14262
  }
14269
14263
  async saveToCanvasStorage() {
14270
- g(this, G) || C(this, G, new $e(this.name)), g(this, G).write(Jr(g(this, _))).then(() => g(this, B).emit(it.SaveCompleted)).catch(() => g(this, B).emit(it.SaveFailed));
14264
+ g(this, G) || C(this, G, new $e(this.name)), g(this, G).write(Jr(g(this, _))).then(() => g(this, Z).emit(it.SaveCompleted)).catch(() => g(this, Z).emit(it.SaveFailed));
14271
14265
  }
14272
14266
  async restoreStateFromCanvasStorage() {
14273
- g(this, G) || C(this, G, new $e(this.name)), g(this, D) || C(this, D, new Fe());
14267
+ g(this, G) || C(this, G, new $e(this.name)), g(this, D) || C(this, D, new Be()), g(this, Z).emit(Ue.start, "spinner");
14274
14268
  const t = await g(this, G).read();
14275
14269
  if (!t) {
14276
14270
  const r = localStorage.getItem(this.name);
@@ -14300,6 +14294,8 @@ let An = class extends Vh {
14300
14294
  );
14301
14295
  } catch (r) {
14302
14296
  console.warn("Saved canvas failed schema validation; ignoring.", r);
14297
+ } finally {
14298
+ g(this, Z).emit(Ue.done);
14303
14299
  }
14304
14300
  }
14305
14301
  async deleteStateFromCanvasStorage() {
@@ -14336,7 +14332,7 @@ let An = class extends Vh {
14336
14332
  }
14337
14333
  async addImages(t) {
14338
14334
  if (!g(this, _)) return;
14339
- const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = Be(r, i, g(this, _)), a = await im(
14335
+ const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = We(r, i, g(this, _)), a = await im(
14340
14336
  t,
14341
14337
  (s) => g(this, _).addImageToCanvas(s, n, o, 1, 1, !0)
14342
14338
  );
@@ -14350,7 +14346,7 @@ let An = class extends Vh {
14350
14346
  removeAllImages() {
14351
14347
  if (!g(this, _)) return;
14352
14348
  const t = Array.from(g(this, _).children).filter(
14353
- (e) => e instanceof Ne
14349
+ (e) => e instanceof Ce
14354
14350
  );
14355
14351
  for (const e of t) g(this, _).removeChild(e);
14356
14352
  g(this, be).push(Pa(g(this, _), t));
@@ -14360,7 +14356,7 @@ let An = class extends Vh {
14360
14356
  */
14361
14357
  async addImageFromUrl(t) {
14362
14358
  if (!g(this, _)) return;
14363
- const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = Be(r, i, g(this, _)), a = await g(this, _).addImageToCanvas(t, n, o, 1, 1, !0);
14359
+ const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = We(r, i, g(this, _)), a = await g(this, _).addImageToCanvas(t, n, o, 1, 1, !0);
14364
14360
  g(this, be).push(On(g(this, _), [a]));
14365
14361
  }
14366
14362
  async copyImage() {
@@ -14394,12 +14390,12 @@ let An = class extends Vh {
14394
14390
  }
14395
14391
  async exportCanvas(t = "infinite-canvas.json") {
14396
14392
  if (!g(this, _)) return;
14397
- g(this, B).emit(rt.start, "spinner");
14393
+ g(this, Z).emit(Ue.start, "spinner");
14398
14394
  const e = await this.getAllImageFileMetdata(), r = Jr(g(this, _), e);
14399
- om(t, r), g(this, B).emit(rt.done);
14395
+ om(t, r), g(this, Z).emit(Ue.done);
14400
14396
  }
14401
14397
  async importCanvas(t) {
14402
- if (g(this, D) || C(this, D, new Fe()), g(this, B).emit(rt.start, "spinner"), !g(this, _) || !t || t.length !== 1) return;
14398
+ if (g(this, D) || C(this, D, new Be()), g(this, Z).emit(Ue.start, "spinner"), !g(this, _) || !t || t.length !== 1) return;
14403
14399
  const e = t[0];
14404
14400
  if (!e.type || !e.type.includes("json") && !e.name.toLowerCase().endsWith(".json"))
14405
14401
  return;
@@ -14418,11 +14414,11 @@ let An = class extends Vh {
14418
14414
  g(this, _),
14419
14415
  this.getImageFileMetadata,
14420
14416
  g(this, D).write
14421
- ), g(this, B).emit(it.Save);
14417
+ ), g(this, Z).emit(it.Save);
14422
14418
  } catch (n) {
14423
14419
  console.warn("Saved canvas failed schema validation; ignoring.", n);
14424
14420
  } finally {
14425
- g(this, B).emit(rt.done);
14421
+ g(this, Z).emit(Ue.done);
14426
14422
  }
14427
14423
  }
14428
14424
  clearCanvas() {
@@ -14444,7 +14440,7 @@ let An = class extends Vh {
14444
14440
  }
14445
14441
  };
14446
14442
  _ = /* @__PURE__ */ new WeakMap();
14447
- B = /* @__PURE__ */ new WeakMap();
14443
+ Z = /* @__PURE__ */ new WeakMap();
14448
14444
  $n = /* @__PURE__ */ new WeakMap();
14449
14445
  be = /* @__PURE__ */ new WeakMap();
14450
14446
  D = /* @__PURE__ */ new WeakMap();
@@ -14454,7 +14450,7 @@ wn = /* @__PURE__ */ new WeakMap();
14454
14450
  jt = /* @__PURE__ */ new WeakMap();
14455
14451
  Ut = /* @__PURE__ */ new WeakMap();
14456
14452
  _e = /* @__PURE__ */ new WeakMap();
14457
- Ue = /* @__PURE__ */ new WeakMap();
14453
+ Ne = /* @__PURE__ */ new WeakMap();
14458
14454
  Sn = /* @__PURE__ */ new WeakMap();
14459
14455
  xn = /* @__PURE__ */ new WeakMap();
14460
14456
  In = /* @__PURE__ */ new WeakMap();