@sheetxl/sdk 0.1.98

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.
Files changed (106) hide show
  1. package/LICENSE.md +11 -0
  2. package/README.md +30 -0
  3. package/build/browser/cjs/7Yh1PqgSd93uKFOq.cjs +6 -0
  4. package/build/browser/cjs/AbBzPqrBe_7Scafy.cjs +6 -0
  5. package/build/browser/cjs/B2jt9h-29UhlG-ir.cjs +6 -0
  6. package/build/browser/cjs/BAY6G2idlFTr3aXF.cjs +6 -0
  7. package/build/browser/cjs/BJAOd8ki61yYMUO8.cjs +6 -0
  8. package/build/browser/cjs/BNfn1no9QwiHEFwd.cjs +6 -0
  9. package/build/browser/cjs/BUkgy8lQRuxtyPlh.cjs +6 -0
  10. package/build/browser/cjs/B_O3B0P2cyGD9Rbm.cjs +6 -0
  11. package/build/browser/cjs/BkmEUMAKvuzsSqbR.cjs +7 -0
  12. package/build/browser/cjs/BlllxPbkhoY0sEC4.cjs +23 -0
  13. package/build/browser/cjs/BmT4qU5bgAIPFNTH.cjs +124 -0
  14. package/build/browser/cjs/BqZnbFL2t1u1XgPn.cjs +6 -0
  15. package/build/browser/cjs/Bs6xUWpBc0gC2FqH.cjs +6 -0
  16. package/build/browser/cjs/Bsv5BCVCW5dIA5It.cjs +1511 -0
  17. package/build/browser/cjs/ByZLM15SpxjqWDYX.cjs +6 -0
  18. package/build/browser/cjs/CaHv2p0pVvOc7XPO.cjs +42 -0
  19. package/build/browser/cjs/CcIliks7z_TMUXOM.cjs +6 -0
  20. package/build/browser/cjs/CpbUnis3pqWrW9H4.cjs +11 -0
  21. package/build/browser/cjs/CvGHijwHYOsCppoo.cjs +6 -0
  22. package/build/browser/cjs/D5m2Wlak7m4vG0kA.cjs +6 -0
  23. package/build/browser/cjs/DSNXa0HNC7bG9qZw.cjs +6 -0
  24. package/build/browser/cjs/DZ-H3oz78Mjq38DI.cjs +6 -0
  25. package/build/browser/cjs/Da34iNTZrWBA6OUT.cjs +6 -0
  26. package/build/browser/cjs/DfMNPyGio0O0RToU.cjs +6 -0
  27. package/build/browser/cjs/Dghi8Yq5nXZtUpoV.cjs +80 -0
  28. package/build/browser/cjs/Dk63Co0TJejVtNXp.cjs +6 -0
  29. package/build/browser/cjs/ErSjtO5fMJzUVHk4.cjs +6 -0
  30. package/build/browser/cjs/G-xZJIN6jjcTuQXA.cjs +6 -0
  31. package/build/browser/cjs/GPfZ0ZpBee250ywR.cjs +20 -0
  32. package/build/browser/cjs/IHypcrtWCiX_F0RJ.cjs +11 -0
  33. package/build/browser/cjs/X-HIF0659hMdI4Fu.cjs +6 -0
  34. package/build/browser/cjs/index.cjs +6 -0
  35. package/build/browser/cjs/qhBvSFMQ_DepDCwv.cjs +6 -0
  36. package/build/browser/cjs/wYOZ6mjOO7MbdyBZ.cjs +6 -0
  37. package/build/browser/esm/70LlV-Ub5gQiHal4.mjs +10 -0
  38. package/build/browser/esm/71Qocy3xStWv_56t.mjs +10 -0
  39. package/build/browser/esm/B9-WgxZWcZj4jdUC.mjs +10 -0
  40. package/build/browser/esm/BAKRnfUqPzHyyiLx.mjs +3966 -0
  41. package/build/browser/esm/BChNW8QNTMP8QXKM.mjs +484 -0
  42. package/build/browser/esm/BCzBxiWxCFs-jcmK.mjs +5651 -0
  43. package/build/browser/esm/BOn1aDBCyrMSMmVr.mjs +10 -0
  44. package/build/browser/esm/BPqJ7trmE53kA4iD.mjs +10 -0
  45. package/build/browser/esm/B_XqbIeKalrEkjs7.mjs +10 -0
  46. package/build/browser/esm/B_b5FIYJnm4UKAEc.mjs +28 -0
  47. package/build/browser/esm/BoWGCLoCBi99JpFs.mjs +10 -0
  48. package/build/browser/esm/Bq9W-xButcfpjGEk.mjs +433 -0
  49. package/build/browser/esm/ByxOyRbOjkmiHT8z.mjs +10 -0
  50. package/build/browser/esm/CAxIV1vPiKW9r_Yh.mjs +10 -0
  51. package/build/browser/esm/CFw23OkHfPquoVEk.mjs +10 -0
  52. package/build/browser/esm/CG8a93kgahRemVJe.mjs +10 -0
  53. package/build/browser/esm/CN45di2IcbM8P0Qu.mjs +10 -0
  54. package/build/browser/esm/COgfNXNmX_PF_eWZ.mjs +35 -0
  55. package/build/browser/esm/CPv7OpinaYcwbA_W.mjs +10 -0
  56. package/build/browser/esm/Cfhp3FCr7wP0Rnfu.mjs +10 -0
  57. package/build/browser/esm/D4GeLOfATuEzvjPr.mjs +1586 -0
  58. package/build/browser/esm/DMas1DZMe9F5tPaN.mjs +23970 -0
  59. package/build/browser/esm/DS4xBjO2TN0rQ1lJ.mjs +10 -0
  60. package/build/browser/esm/DTM0pK30PrZRsXYw.mjs +10 -0
  61. package/build/browser/esm/DgslJ1_vlPooGZHU.mjs +10 -0
  62. package/build/browser/esm/DmEPCZ9FSKO_TRTA.mjs +10 -0
  63. package/build/browser/esm/Do_EO3eQIyPgc7uz.mjs +30 -0
  64. package/build/browser/esm/ERMewE78C__HUblm.mjs +10 -0
  65. package/build/browser/esm/Qib5_XvQHWOPzGrm.mjs +10 -0
  66. package/build/browser/esm/SSYRYFzxzHWQzdAN.mjs +12 -0
  67. package/build/browser/esm/V_ha0oCA5_oDPanz.mjs +832 -0
  68. package/build/browser/esm/gTh1PiesKrQblf8O.mjs +10 -0
  69. package/build/browser/esm/g_p1uVDePbDJJ4nX.mjs +10 -0
  70. package/build/browser/esm/index.mjs +89 -0
  71. package/build/licenses/dependencies.txt +1239 -0
  72. package/build/node/esm/4HPektqH91Rh-rsq.mjs +2445 -0
  73. package/build/node/esm/70LlV-Ub5gQiHal4.mjs +10 -0
  74. package/build/node/esm/B9-WgxZWcZj4jdUC.mjs +10 -0
  75. package/build/node/esm/BDxewg-utn4BhUXl.mjs +35 -0
  76. package/build/node/esm/BPqJ7trmE53kA4iD.mjs +10 -0
  77. package/build/node/esm/BUOg554dxBM0VWFi.mjs +22 -0
  78. package/build/node/esm/B_XqbIeKalrEkjs7.mjs +10 -0
  79. package/build/node/esm/BoWGCLoCBi99JpFs.mjs +10 -0
  80. package/build/node/esm/ByxOyRbOjkmiHT8z.mjs +10 -0
  81. package/build/node/esm/CFw23OkHfPquoVEk.mjs +10 -0
  82. package/build/node/esm/CG8a93kgahRemVJe.mjs +10 -0
  83. package/build/node/esm/CN45di2IcbM8P0Qu.mjs +10 -0
  84. package/build/node/esm/CNOiP4baOWSizP6F.mjs +1070 -0
  85. package/build/node/esm/CPv7OpinaYcwbA_W.mjs +10 -0
  86. package/build/node/esm/CVAFJAiy4lznWzaG.mjs +10 -0
  87. package/build/node/esm/CZd8SSXlusZy49FM.mjs +10 -0
  88. package/build/node/esm/CZw7SgmfxSHhZZe0.mjs +10 -0
  89. package/build/node/esm/Cdjab80o1WocCHgN.mjs +13 -0
  90. package/build/node/esm/CfWoSrOmaP9LrFja.mjs +466 -0
  91. package/build/node/esm/CnaBpzYiURAKhAxF.mjs +825 -0
  92. package/build/node/esm/Cp5ea9Hpxse8B4mC.mjs +10 -0
  93. package/build/node/esm/DH_fbhyW3PwE1rYa.mjs +10 -0
  94. package/build/node/esm/DNHqdv3-ufdcF5zc.mjs +20 -0
  95. package/build/node/esm/DS4xBjO2TN0rQ1lJ.mjs +10 -0
  96. package/build/node/esm/DTM0pK30PrZRsXYw.mjs +10 -0
  97. package/build/node/esm/DlFgt0KLeXDowatv.mjs +10 -0
  98. package/build/node/esm/ERMewE78C__HUblm.mjs +10 -0
  99. package/build/node/esm/GTFYlX2Atw10TdFe.mjs +86 -0
  100. package/build/node/esm/Qib5_XvQHWOPzGrm.mjs +10 -0
  101. package/build/node/esm/gTh1PiesKrQblf8O.mjs +10 -0
  102. package/build/node/esm/g_p1uVDePbDJJ4nX.mjs +10 -0
  103. package/build/node/esm/index.mjs +23412 -0
  104. package/build/package.json +58 -0
  105. package/build/types/index.d.ts +20624 -0
  106. package/package.json +85 -0
@@ -0,0 +1,832 @@
1
+ /**
2
+ * @license @sheetxl/sdk - A high-performance, embeddable spreadsheet engine. - v0.0.0
3
+ *
4
+ * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ /**
8
+ * @license @sheetxl/scripting - SheetXL scripting utilities including TypeScript compilation. - v0.0.0
9
+ *
10
+ * (C) 2025-present SheetXL Inc. & Michael T. Ford
11
+ * License: The license can be found at https://www.sheetxl.com/license.
12
+ */
13
+ /**
14
+ * @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.1.93
15
+ *
16
+ * (C) 2025-present SheetXL Inc. & Michael T. Ford
17
+ * License: The license can be found at https://www.sheetxl.com/license.
18
+ */
19
+ const h = "text/html", b = "text/plain", L = "image/png", Tt = Object.freeze({ left: 0, top: 0 }), Ct = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Mt = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
20
+ Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Mt, EmptyRect: Ct, EmptyTopLeft: Tt }, Symbol.toStringTag, { value: "Module" }));
21
+ const m = "column", j = "row", Rt = Object.freeze({ colIndex: 0, rowIndex: 0 }), At = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), yt = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, gt = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, Ft = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Lt = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, J = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, H = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, bt = (e = j, t = !1) => t ? e !== m ? Ft : Lt : e !== m ? gt : yt, K = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, D = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, $ = (e, t) => !(!e || !t || e.colStart > t.colEnd || t.colStart > e.colEnd || e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), Y = (e, t) => {
22
+ if (e === t) return !0;
23
+ if (!e || !t || e.length !== t.length) return !1;
24
+ for (let r = 0; r < e.length; r++) if (!D(e[r], t[r])) return !1;
25
+ return !0;
26
+ }, U = (e, t, r) => {
27
+ if (!e && !t) return null;
28
+ if (!e) return r ? t : { ...t };
29
+ if (!t) return r ? e : { ...e };
30
+ const n = Math.min(e.colStart, t.colStart), o = Math.min(e.rowStart, t.rowStart), a = Math.max(e.colEnd, t.colEnd), i = Math.max(e.rowEnd, t.rowEnd);
31
+ let l = r;
32
+ return l ? (l.colStart = n, l.rowStart = o, l.colEnd = a, l.rowEnd = i) : l = { colStart: n, rowStart: o, colEnd: a, rowEnd: i }, l;
33
+ }, Z = (e, t) => {
34
+ if (!t || t.length === 0) return e;
35
+ const r = { ...e };
36
+ for (let n = 0; n < t.length; n++) {
37
+ const o = t[n];
38
+ $(r, o) && (r.rowStart = Math.min(r.rowStart, o.rowStart), r.colStart = Math.min(r.colStart, o.colStart), r.rowEnd = Math.max(r.rowEnd, o.rowEnd), r.colEnd = Math.max(r.colEnd, o.colEnd));
39
+ }
40
+ return r;
41
+ }, Ut = [null, null], Pt = (e, t, r) => {
42
+ if (e[0].value === e[1].value) return t;
43
+ };
44
+ function X(e, t = 2, r, n = j, o) {
45
+ let a = [...e];
46
+ if (t <= 0 || e.length <= 1) return a;
47
+ let i = n === m, l = 0, s = !1;
48
+ do {
49
+ const c = a.sort(bt(i ? j : m));
50
+ a = [], a.push(c[0]);
51
+ const d = c.length;
52
+ let w = 0, u = c[0], f = u.colStart, p = u.rowStart, x = u.colEnd, _ = u.rowEnd;
53
+ for (let A = 1; A < d; A++) {
54
+ const g = c[A];
55
+ let G = !1;
56
+ if (G = i ? u && p === g.rowStart && _ === g.rowEnd && x + 1 === g.colStart : u && f === g.colStart && x === g.colEnd && _ + 1 === g.rowStart, G) {
57
+ let S = { colStart: f, rowStart: p, colEnd: i ? g.colEnd : x, rowEnd: i ? _ : g.rowEnd };
58
+ if (u.value !== void 0 && (S.value = u.value), r) {
59
+ const F = o ?? [null, null];
60
+ F[0] = u, F[1] = g, S = r(F, S, n);
61
+ }
62
+ if (S) {
63
+ a[w] = S, s = !0, u = S, f = u.colStart, p = u.rowStart, x = u.colEnd, _ = u.rowEnd;
64
+ continue;
65
+ }
66
+ }
67
+ a[++w] = g, u = g, f = u.colStart, p = u.rowStart, x = u.colEnd, _ = u.rowEnd;
68
+ }
69
+ l++, i = !i, l === 1 && (s = !0);
70
+ } while (l < t && s && a.length > 1);
71
+ return a;
72
+ }
73
+ Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Rt, EmptyRange: At, cellToRange: (e, t) => {
74
+ if (!e) return null;
75
+ let r = t;
76
+ return r || (r = { ...e }, delete r.colIndex, delete r.rowIndex), r.colStart = e.colIndex ?? 0, r.rowStart = e.rowIndex ?? 0, r.colEnd = e.colIndex ?? 0, r.rowEnd = e.rowIndex ?? 0, r;
77
+ }, columnFirstCellComparator: J, columnFirstRangeComparator: yt, createCellComparator: (e = j, t = !1) => t ? e !== m ? (r, n) => r.rowIndex === n.rowIndex ? n.colIndex - r.colIndex : n.rowIndex - r.rowIndex : (r, n) => r.colIndex === n.colIndex ? n.rowIndex - r.rowIndex : n.colIndex - r.colIndex : e !== m ? H : J, createConflatingRanges: (e, t = !1) => {
78
+ const r = [];
79
+ let n, o, a = Number.MIN_SAFE_INTEGER, i = Number.MIN_SAFE_INTEGER;
80
+ return { append: (l, s, c) => {
81
+ let d = !0;
82
+ const w = c !== void 0;
83
+ if (w) {
84
+ const p = e ? e(o, c, t) : o === c ? c : void 0;
85
+ p === void 0 ? d = !1 : c = p;
86
+ }
87
+ if (d && s === i + 1 && l === a) return t ? n.rowEnd = s : n.colEnd = s, i = s, void (o = c);
88
+ n && r.push(n);
89
+ const u = t ? l : s, f = t ? s : l;
90
+ n = { colStart: u, rowStart: f, colEnd: u, rowEnd: f }, w && (n.value = c), a = l, i = s, o = c;
91
+ }, done: (l) => (n && (r.push(n), n = null), l ? X(r, 3, l === !0 ? Pt : l, t ? m : j, Ut) : r) };
92
+ }, createRangeComparator: bt, defaultRange: (e, t, r) => e ? r ? (r.colStart = e.colStart ?? t.colStart, r.rowStart = e.rowStart ?? t.rowStart, r.colEnd = e.colEnd ?? t.colEnd, r.rowEnd = e.rowEnd ?? t.rowEnd, r) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: Z, extendRangeToUnionRanges: (e, t) => {
93
+ if (!t || t.length === 0) return e;
94
+ let r = e, n = null;
95
+ for (; !D(r, n); ) n = r, r = Z(n, t);
96
+ return r;
97
+ }, indexOfCoords: (e, t) => {
98
+ const r = { colStart: e.colIndex, rowStart: e.rowIndex, colEnd: e.colIndex, rowEnd: e.rowIndex };
99
+ for (let n = t.length - 1; n >= 0; n--) if ($(r, t[n])) return n;
100
+ return -1;
101
+ }, intersectRanges: (e, t, r) => {
102
+ if (!e) return r ? t : { ...t };
103
+ if (!t) return r ? e : { ...e };
104
+ if (!e && !t || e.rowStart > t.rowEnd || e.rowEnd < t.rowStart || e.colStart > t.colEnd || e.colEnd < t.colStart) return null;
105
+ const n = Math.max(e.colStart, t.colStart), o = Math.max(e.rowStart, t.rowStart), a = Math.min(e.colEnd, t.colEnd), i = Math.min(e.rowEnd, t.rowEnd);
106
+ let l = r;
107
+ return l ? (l.colStart = n, l.rowStart = o, l.colEnd = a, l.rowEnd = i) : l = { colStart: n, rowStart: o, colEnd: a, rowEnd: i }, l;
108
+ }, isCellWithinRange: (e, t) => !(!e || !t || e.rowIndex < t.rowStart || e.rowIndex > t.rowEnd || e.colIndex < t.colStart || e.colIndex > t.colEnd), isEqualCells: K, isEqualRanges: D, isEqualRangesArrays: Y, isEqualSelectionCoords: (e, t) => e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!K(e.cell, t.cell) && Y(e.ranges, t.ranges), isRangeWithinRange: (e, t) => !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd || e.colStart < t.colStart || e.colEnd > t.colEnd), isRangesIntersect: $, isSingleCell: (e) => !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd, isValidRange: (e) => !(!e || typeof e.colStart != "number" || e.colStart < 0 || typeof e.colEnd != "number" || e.colEnd < e.colStart || typeof e.rowStart != "number" || e.rowStart < 0 || typeof e.rowEnd != "number" || e.rowEnd < e.rowStart), mergeRangedValues: X, rowFirstCellComparator: H, rowFirstRangeComparator: gt, sanitizeRange: (e) => e ? { colStart: e.colIndex ?? e.colStart ?? 0, rowStart: e.rowIndex ?? e.rowStart ?? 0, colEnd: e.colIndex ?? e.colEnd ?? 0, rowEnd: e.rowIndex ?? e.rowEnd ?? 0 } : null, translateRange: (e, t = -e.rowStart, r = -e.colStart, n) => n ? (n.colStart = e.colStart + r, n.rowStart = e.rowStart + t, n.colEnd = e.colEnd + r, n.rowEnd = e.rowEnd + t, n) : { colStart: e.colStart + r, rowStart: e.rowStart + t, colEnd: e.colEnd + r, rowEnd: e.rowEnd + t }, unionRanges: U, unionRangesArrays: (e, t, r) => {
109
+ if (!e || e.length === 0) return null;
110
+ if (e.length === 1 && !t) return e[0];
111
+ let n = e[0];
112
+ for (let o = 1; o < e.length; o++) n = U(n, e[o], r);
113
+ return t && (n = U(n, t, r)), n;
114
+ } }, Symbol.toStringTag, { value: "Module" }));
115
+ const kt = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
116
+ function Nt(e) {
117
+ return /* @__PURE__ */ function(t) {
118
+ return !!t && typeof t == "object";
119
+ }(e) && !function(t) {
120
+ const r = Object.prototype.toString.call(t);
121
+ return r === "[object RegExp]" || r === "[object Date]" || t.$$typeof === kt;
122
+ }(e);
123
+ }
124
+ function I(e, t) {
125
+ return t.clone !== !1 && t.isMergeableObject(e) ? E((r = e, Array.isArray(r) ? [] : {}), e, t) : e;
126
+ var r;
127
+ }
128
+ function Bt(e, t, r) {
129
+ return e.concat(t).map(function(n) {
130
+ return I(n, r);
131
+ });
132
+ }
133
+ function Q(e) {
134
+ return Object.keys(e).concat((t = e, Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(r) {
135
+ return Object.propertyIsEnumerable.call(t, r);
136
+ }) : []));
137
+ var t;
138
+ }
139
+ function tt(e, t) {
140
+ try {
141
+ return t in e;
142
+ } catch {
143
+ return !1;
144
+ }
145
+ }
146
+ function E(e, t, r) {
147
+ (r = r || {}).arrayMerge = r.arrayMerge || Bt, r.isMergeableObject = r.isMergeableObject || Nt, r.cloneUnlessOtherwiseSpecified = I;
148
+ const n = Array.isArray(t);
149
+ return n === Array.isArray(e) ? n ? r.arrayMerge(e, t, r) : function(o, a, i) {
150
+ const l = {};
151
+ return i.isMergeableObject(o) && Q(o).forEach(function(s) {
152
+ l[s] = I(o[s], i);
153
+ }), Q(a).forEach(function(s) {
154
+ var c, d;
155
+ tt(c = o, d = s) && (!Object.hasOwnProperty.call(c, d) || !Object.propertyIsEnumerable.call(c, d)) || (tt(o, s) && i.isMergeableObject(a[s]) ? l[s] = function(w, u) {
156
+ if (!u.customMerge) return E;
157
+ const f = u.customMerge(w);
158
+ return typeof f == "function" ? f : E;
159
+ }(s, i)(o[s], a[s], i) : l[s] = I(a[s], i));
160
+ }), l;
161
+ }(e, t, r) : I(t, r);
162
+ }
163
+ E.all = function(e, t) {
164
+ if (!Array.isArray(e)) throw new Error("first argument should be an array");
165
+ return e.reduce(function(r, n) {
166
+ return E(r, n, t);
167
+ }, {});
168
+ };
169
+ const zt = Object.freeze([]), qt = Object.freeze({}), et = (e) => e, R = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
170
+ let t = 16 * Math.random() | 0;
171
+ return (e === "x" ? t : 3 & t | 8).toString(16);
172
+ }), mt = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((r, n) => r === t[n]), O = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, Et = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
173
+ e[t] && typeof e[t] == "object" ? Et(e[t]) : e[t] !== null && e[t] !== void 0 || delete e[t], typeof e[t] == "object" && Object.keys(e[t]).length === 0 && delete e[t];
174
+ }), Object.keys(e).length === 0 ? null : e), Dt = (e, t) => !(e !== t && !mt(e, t) && !e.isEqual?.(t)), St = (e, t, r = Dt) => {
175
+ if (e == null || e === t) return null;
176
+ if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return r(e, t) ? null : e;
177
+ const n = Object.keys(e);
178
+ if (n.length === 0) return null;
179
+ let o = !1;
180
+ for (let a = 0; a < n.length; a++) {
181
+ const i = n[a];
182
+ St(e[i], t?.[i], r) === null && (o = !0, delete e[i]);
183
+ }
184
+ return o && Object.keys(e).length === 0 ? null : void 0;
185
+ }, rt = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), nt = (e) => e == null, ot = (e, t) => !(t.left > e.right || t.right < e.left || t.top > e.bottom || t.bottom < e.top), at = !(typeof window > "u" || !window.document || !window.document.createElement), y = { Windows: "windows", MacOS: "macos", IOS: "ios", Linux: "linux", Android: "android", Safari: "safari", Firefox: "firefox", Node: "node", Unknown: "unknown" }, T = () => {
186
+ if (vt()) return y.Node;
187
+ const e = globalThis.navigator !== void 0 && globalThis.navigator.userAgent ? globalThis.navigator.userAgent.toLowerCase() : "";
188
+ return e ? /(win32|win64|windows|wince)/i.test(e) ? y.Windows : /(macintosh|macintel|macppc|mac68k|macos)/i.test(e) ? y.MacOS : /(iphone|ipad|ipod)/i.test(e) ? y.IOS : /android/.test(e) ? y.Android : /linux/.test(e) ? y.Linux : /^((?!chrome|android|).)*safari/i.test(e) ? y.Safari : /^((?!chrome|android|Seamonkey).)*firefox/i.test(e) ? y.Firefox : y.Unknown : y.Unknown;
189
+ };
190
+ function vt() {
191
+ return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
192
+ }
193
+ const it = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), $t = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: zt, EmptyObject: qt, OSType: y, arrayMove: function(e, t, r) {
194
+ const n = e.slice();
195
+ return n.splice(r < 0 ? n.length + r : r, 0, n.splice(t, 1)[0]), n;
196
+ }, asNumber: (e) => {
197
+ const t = 1 * e;
198
+ return Number.isFinite(t) ? t : 0;
199
+ }, camelToPrettyCase: (e) => e.length === 1 ? e.toUpperCase() : e.replace(/([A-Z])/g, " $1").replace(/^./, function(t) {
200
+ return t.toUpperCase();
201
+ }).trim(), canUseDOM: at, cancelTimeout: (e) => {
202
+ cancelAnimationFrame(e.id);
203
+ }, castToString: (e) => e == null || e === void 0 ? "" : typeof e != "string" ? "" + e : e, cloneObject: (e) => nt(e) ? e : JSON.parse(JSON.stringify(e)), consoleWithNoSource: (...e) => new Promise((t) => {
204
+ setTimeout(() => {
205
+ Function("console.log.apply(console, arguments)").apply(null, e), t();
206
+ });
207
+ }), debounce: function(e, t = 300, r = !1) {
208
+ let n, o, a, i, l = 0;
209
+ function s() {
210
+ let d = Date.now() - l;
211
+ d < t && d >= 0 ? n = setTimeout(s, t - d) : (n = null, r || (i = e.apply(a, o), a = o = null));
212
+ }
213
+ t == null && (t = 100);
214
+ const c = function() {
215
+ a = globalThis, o = arguments, l = Date.now();
216
+ var d = r && !n;
217
+ return n || (n = setTimeout(s, t)), d && (i = e.apply(a, o), a = o = null), i;
218
+ };
219
+ return c.clear = function() {
220
+ n && (clearTimeout(n), n = null);
221
+ }, c.flush = function() {
222
+ n && (i = e.apply(a, o), a = o = null, clearTimeout(n), n = null);
223
+ }, c;
224
+ }, deepEqual: function e(t, r) {
225
+ if (t === r) return !0;
226
+ if (t && r && typeof t == "object" && typeof r == "object") {
227
+ if (t.constructor !== r.constructor) return !1;
228
+ let n, o, a;
229
+ if (Array.isArray(t)) {
230
+ if (n = t.length, n != r.length) return !1;
231
+ for (o = n; o-- !== 0; ) if (!e(t[o], r[o])) return !1;
232
+ return !0;
233
+ }
234
+ if (t instanceof Map && r instanceof Map) {
235
+ if (t.size !== r.size) return !1;
236
+ for (o of t.entries()) if (!r.has(o[0])) return !1;
237
+ for (o of t.entries()) if (!e(o[1], r.get(o[0]))) return !1;
238
+ return !0;
239
+ }
240
+ if (t instanceof Set && r instanceof Set) {
241
+ if (t.size !== r.size) return !1;
242
+ for (o of t.entries()) if (!r.has(o[0])) return !1;
243
+ return !0;
244
+ }
245
+ if (ArrayBuffer.isView(t) && ArrayBuffer.isView(r)) {
246
+ if (n = t.length, n != r.length) return !1;
247
+ for (o = n; o-- !== 0; ) if (t[o] !== r[o]) return !1;
248
+ return !0;
249
+ }
250
+ if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
251
+ if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
252
+ if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
253
+ if (a = Object.keys(t), n = a.length, n !== Object.keys(r).length) return !1;
254
+ for (o = n; o-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(r, a[o])) return !1;
255
+ for (o = n; o-- !== 0; ) {
256
+ let i = a[o];
257
+ if (!(i === "_owner" && t.$$typeof || e(t[i], r[i]))) return !1;
258
+ }
259
+ return !0;
260
+ }
261
+ return t != t && r != r;
262
+ }, deepFreeze: function e(t) {
263
+ return Object.freeze(t), Object.keys(t).forEach((r) => {
264
+ typeof t[r] != "object" || t[r] === null || Object.isFrozen(t[r]) || e(t[r]);
265
+ }), t;
266
+ }, deepMerge: E, diffValues: (e, t) => {
267
+ const r = {}, n = Object.keys(t), o = n.length;
268
+ for (let a = 0; a < o; a++) {
269
+ const i = n[a];
270
+ e[i] !== t[i] && (e[i] === void 0 ? r[i] = t[i] : r[i] = e[i]);
271
+ }
272
+ return Object.keys(r).length === 0 ? null : r;
273
+ }, findEqualOrGreater: function(e, t, r = et) {
274
+ let n = 0, o = e.length - 1;
275
+ for (; n <= o; ) {
276
+ let a = Math.floor((n + o) / 2), i = r(e[a]);
277
+ if (i === t) return a;
278
+ i < t ? n = a + 1 : o = a - 1;
279
+ }
280
+ return n;
281
+ }, findEqualOrLesser: function(e, t, r = et) {
282
+ let n = e.length - 1, o = 0;
283
+ for (; n >= o; ) {
284
+ let a = Math.floor((n + o) / 2), i = r(e[a]);
285
+ if (i === t) return a;
286
+ i > t ? n = a - 1 : o = a + 1;
287
+ }
288
+ return n;
289
+ }, findNextStep: (e, t = !0, r = 15, n = 10, o = 400) => {
290
+ const a = Math.max(e - n, 0) + (t ? 1 : -1);
291
+ return Math.min(o, Math[t ? "ceil" : "floor"](a / r) * r + n);
292
+ }, getBuildEnv: () => "browser2-build", getDPI: () => {
293
+ let e = 1;
294
+ return typeof window == "object" && (e = window.devicePixelRatio || 1), e;
295
+ }, getFromPath: (e, t) => {
296
+ const r = t.split(".");
297
+ let n = e;
298
+ for (let o = 0; o < r.length; o++) {
299
+ const a = r[o];
300
+ if (!n) return null;
301
+ let i = n[a];
302
+ if (typeof i == "function" && (i = i.bind(n)()), !i || !O(i)) return i;
303
+ n = i;
304
+ }
305
+ return n ?? null;
306
+ }, getOS: T, hasFocus: it, isDefined: (e) => e != null, isEmpty: (e) => e == null || e === "", isEqualArrays: mt, isEqualBounds: (e, t) => e === t || !(e && !t || t && !e) && e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height, isEqualObjectKeys: (e, t) => {
307
+ if (e === t) return !0;
308
+ if (e && !t || t && !e) return !1;
309
+ const r = Object.keys(e);
310
+ if (r.length !== Object.keys(t).length) return !1;
311
+ for (let n = 0; n < r.length; n++) if (e[r[n]] !== t[r[n]]) return !1;
312
+ return !0;
313
+ }, isNode: vt, isNullOrUndefined: nt, isNumeric: (e) => {
314
+ const t = 1 * e;
315
+ return Number.isFinite(t) && typeof t == "number";
316
+ }, isObject: O, isPromiseLike: (e) => !!e && typeof e.then == "function", isRectInsideRect: (e, t) => e.top >= t.top && e.bottom <= t.bottom && e.left >= t.left && e.right <= t.right, isRectIntersect: ot, mergeContentful: (...e) => {
317
+ const t = e.length;
318
+ if (t > 0 && e[t - 1] !== void 0 && !O(e[t - 1])) return e[t - 1];
319
+ let r = e[0] || {};
320
+ for (let n = 1; n < t; n++) r = E(r, e[n] || {}, { arrayMerge: (o, a) => [...a] });
321
+ return r;
322
+ }, nextTick: (e) => {
323
+ typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(() => {
324
+ e();
325
+ }) : (typeof setImmediate == "function" ? setImmediate : setTimeout)(() => {
326
+ e();
327
+ });
328
+ }, openFileDialog: (e = "*.*") => new Promise((t, r) => {
329
+ if (!at) return void r("Unable to open dialog with no dom.");
330
+ const n = document.createElement("input");
331
+ n.type = "file", n.accept = e;
332
+ let o = null, a = !1;
333
+ globalThis.addEventListener?.("focus", () => {
334
+ setTimeout(() => {
335
+ o || a || (a = !0, t(null));
336
+ }, 1e3);
337
+ }, { once: !0, passive: !0 }), n.onchange = () => {
338
+ if (o = n.files[0], o) {
339
+ if (a) return void console.warn("File open detected after faux cancel.", o);
340
+ t(o);
341
+ }
342
+ }, n.autofocus = !0, n.click();
343
+ }), rafThrottle: (e) => {
344
+ let t, r = !1, n = function() {
345
+ r = !1, e(t);
346
+ };
347
+ return function(o) {
348
+ t = o, t && t.persist && t.persist(), r || (r = !0, requestAnimationFrame(n));
349
+ };
350
+ }, removeEmptyProperties: Et, removeEqualValues: St, removeListenerAll: (e) => {
351
+ if (!e) return [];
352
+ for (let t = 0; t < e.length; t++) e[t] && e[t]();
353
+ return [];
354
+ }, requestTimeout: (e, t) => {
355
+ const r = rt(), n = { id: requestAnimationFrame(function o() {
356
+ rt() - r >= t ? e.call(null) : n.id = requestAnimationFrame(o);
357
+ }) };
358
+ return n;
359
+ }, roundAccurately: (e, t = 0) => {
360
+ if (e == null || !isFinite(e)) return null;
361
+ const r = 10 ** t;
362
+ return Number(Math.round(e * r) / r);
363
+ }, setToPath: (e, t, r) => {
364
+ const n = t.split(".");
365
+ let o = e;
366
+ if (!o) throw new Error("Can not set path to a null path.");
367
+ for (let a = 0; o && a < n.length - 1; a++) {
368
+ const i = n[a];
369
+ let l = o[i];
370
+ if (l == null && (l = {}, o[i] = l), !O(l)) throw new Error("Can not set path to a non object path.");
371
+ o = l;
372
+ }
373
+ if (typeof r != "number" && typeof r != "boolean" && typeof r != "string" && !O(r)) throw new Error(`Can not set path to ${r} that is not a a supported primitive.`);
374
+ return o[n[n.length - 1]] = r, e;
375
+ }, splitNumber: (e) => {
376
+ let t = Math.abs(e);
377
+ if (isNaN(t) || !isFinite(e)) return null;
378
+ let r = 0 | t, n = t - r, o = 0, a = 0, i = 1;
379
+ if (n > 5e-8) for (; a < 8 && Math.abs(o / i - n) > 5e-8; ) a++, i *= 10, o = Math.round(n * i);
380
+ return { ip: Math.trunc(e), fp: o, ipLength: Math.ceil(Math.log10(r + 1)), fpLength: a };
381
+ }, subtractRect: (e, t, r = !1) => {
382
+ if (!t) return [e];
383
+ if (!ot(e, t)) return [];
384
+ const n = [];
385
+ let o = e;
386
+ const a = () => {
387
+ t.top > o.top && t.top < o.bottom && (n.push({ ...o, bottom: t.top }), o = { ...o, top: t.top });
388
+ }, i = () => {
389
+ t.bottom > o.top && t.bottom < o.bottom && (n.push({ ...o, top: t.bottom }), o = { ...o, bottom: t.bottom });
390
+ }, l = () => {
391
+ t.right > o.left && t.right < o.right && (n.push({ ...o, left: t.right }), o = { ...o, right: t.right });
392
+ }, s = () => {
393
+ t.left > o.left && t.left < o.right && (n.push({ ...o, right: t.left }), o = { ...o, left: t.left });
394
+ };
395
+ return r ? (s(), l(), a(), i()) : (a(), i(), l(), s()), n;
396
+ }, textToKey: (e) => e.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(), throttle: function(e, t) {
397
+ let r = null;
398
+ return (...n) => {
399
+ const o = Date.now();
400
+ (!r || o - r >= t) && (r = o, e(...n));
401
+ };
402
+ }, toSafeJSON: function e(t) {
403
+ if (t === null || typeof t != "object") return t;
404
+ if (typeof t.toJSON == "function") return t.toJSON();
405
+ if (Array.isArray(t)) return t.map((n) => e(n));
406
+ if (typeof t.toString == "function" && t.toString !== Object.prototype.toString) return t.toString();
407
+ const r = {};
408
+ for (const n in t) t.hasOwnProperty(n) && (r[n] = e(t[n]));
409
+ return r;
410
+ }, transpose: (e) => {
411
+ if (!e) return e;
412
+ const t = e.length, r = e[0].length, n = [];
413
+ for (let o = 0; o < r; o++) n[o] = Array(t);
414
+ for (let o = 0; o < t; o++) for (let a = 0; a < r; a++) n[a][o] = e[o][a];
415
+ return n;
416
+ }, uuidV4: R, validEnumValue: (e, t) => {
417
+ if (!Object.values(e).includes(t)) throw new Error(`Invalid type: ${t ?? "null"}. Must be one of: ${Object.values(t).join(", ")}.`);
418
+ }, whenFocus: async (e, t = !1) => new Promise((r) => {
419
+ it(e, t) ? r(!0) : e.addEventListener("focusin", () => {
420
+ r(!0);
421
+ }, { once: !0 }), e.focus();
422
+ }) }, Symbol.toStringTag, { value: "Module" }));
423
+ Object.freeze(Object.defineProperty({ __proto__: null, MESSAGE_ERROR_INVALID_ARG: (e) => `Invalid argument: '${e}'.` }, Symbol.toStringTag, { value: "Module" }));
424
+ const xt = (e) => {
425
+ const t = new Uint8Array(e), r = t.byteLength;
426
+ let n = "";
427
+ for (let o = 0; o < r; o++) n += String.fromCharCode(t[o]);
428
+ if (typeof window < "u" && typeof globalThis.btoa == "function") return globalThis.btoa(n);
429
+ if (typeof Buffer < "u") return Buffer.from(n, "binary").toString("base64");
430
+ throw new Error("Unsupported environment");
431
+ }, W = (e) => new Promise((t, r) => {
432
+ if (e) if (typeof FileReader < "u") {
433
+ const n = new FileReader();
434
+ n.onload = () => {
435
+ t(n.result);
436
+ }, n.onerror = () => {
437
+ r(n.error);
438
+ }, n.readAsText(e);
439
+ } else if (typeof Buffer < "u") {
440
+ const n = (o) => Buffer.from(o).toString("utf-8");
441
+ e.arrayBuffer().then((o) => {
442
+ t(n(o));
443
+ }).catch((o) => {
444
+ r(o);
445
+ });
446
+ } else r(new Error("Unsupported environment"));
447
+ else t("");
448
+ });
449
+ Object.freeze(Object.defineProperty({ __proto__: null, DEFAULT_MIME_TYPE: "*/*", arrayBufferToBase64: xt, base64ToArrayBuffer: (e) => {
450
+ const t = typeof window < "u" && typeof globalThis.atob == "function" ? globalThis.atob(e) : Buffer.from(e, "base64").toString("binary"), r = t.length, n = new Uint8Array(r);
451
+ for (let o = 0; o < r; o++) n[o] = t.charCodeAt(o);
452
+ return n.buffer;
453
+ }, blobToString: W }, Symbol.toStringTag, { value: "Module" }));
454
+ const _t = "data:image/png;base64,", Ot = "Unable to resolve image.", lt = (e) => new Promise(async (t, r) => {
455
+ let n = null;
456
+ try {
457
+ n = new Image(), n.src = e, n.addEventListener("load", function() {
458
+ t({ width: n.naturalWidth, height: n.naturalHeight });
459
+ }, { once: !0 }), n.addEventListener("error", function() {
460
+ URL.revokeObjectURL(e), r("Invalid Image");
461
+ }, { once: !0 }), await n.decode("sync");
462
+ } catch {
463
+ n?.src && URL.revokeObjectURL(n.src);
464
+ }
465
+ n || r(Ot);
466
+ }), P = "image/svg+xml";
467
+ var st, ct;
468
+ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: _t, getImageDataUrl: (e, t = 1) => new Promise(async (r, n) => {
469
+ let o = null;
470
+ try {
471
+ o = new Image(), o.src = e, o.addEventListener("load", function() {
472
+ try {
473
+ const a = document.createElement("canvas");
474
+ a.width = o.naturalWidth, a.height = o.naturalHeight, a.getContext("2d").drawImage(o, 0, 0);
475
+ const i = a.toDataURL("image/png", t);
476
+ r({ elemImg: o, dataUrl: i });
477
+ } catch (a) {
478
+ URL.revokeObjectURL(e), n(a);
479
+ }
480
+ }, { once: !0 }), o.addEventListener("error", function() {
481
+ URL.revokeObjectURL(e), n("Invalid Image");
482
+ }, { once: !0 }), await o.decode("sync");
483
+ } catch {
484
+ o?.src && URL.revokeObjectURL(o.src);
485
+ }
486
+ o || n(Ot);
487
+ }), loadImageDetails: async (e, t = null) => {
488
+ let r = null;
489
+ const n = async () => {
490
+ try {
491
+ const a = t ?? "image/*", i = URL.createObjectURL(new Blob([e], { type: a })), l = await lt(i);
492
+ r = { mimeType: a, naturalDimensions: l, asUrl: i };
493
+ } catch {
494
+ }
495
+ }, o = async () => {
496
+ try {
497
+ const a = new TextDecoder().decode(e), i = URL.createObjectURL(new Blob([a], { type: P })), l = await lt(i);
498
+ r = { mimeType: t ?? P, naturalDimensions: l, asUrl: i, asSVGText: a };
499
+ } catch {
500
+ }
501
+ };
502
+ if (t === P ? await o() : t.startsWith("image/") ? await n() : (await n(), r || await o()), !r) throw new Error("Failed to load image");
503
+ return r;
504
+ } }, Symbol.toStringTag, { value: "Module" })), (ct = st || (st = {})).resolveTypedUpdates = (e, t, r, n) => {
505
+ if (e === null) return e;
506
+ if (e === void 0) return n;
507
+ let o = e;
508
+ if (t?.shorthand) {
509
+ const s = t?.shorthand(e, r);
510
+ s !== void 0 && (o = s);
511
+ }
512
+ if (o !== null && t?.getSubType) {
513
+ const s = t.getSubType(o);
514
+ s && (t = s);
515
+ }
516
+ const a = t?.properties, i = t?.arrayType ?? !1;
517
+ let l = o;
518
+ if (t && t.merge && l && n) l = t.merge(l, n, r);
519
+ else if (!i && a) {
520
+ const s = Object.keys({ ...o, ...n });
521
+ l = null;
522
+ for (let c = 0; c < s.length; c++) {
523
+ const d = s[c];
524
+ let w, u = o[d];
525
+ if (u !== void 0) {
526
+ const f = a[d];
527
+ w = f ? (0, ct.resolveTypedUpdates)(u, f, r, n?.[d]) : u;
528
+ } else w = n?.[d];
529
+ w != null && (l = l ?? {}, l[d] = w);
530
+ }
531
+ }
532
+ return l;
533
+ };
534
+ const ut = `The Safari browser does not support advanced copy and paste.
535
+ Copy and paste will be limited to within the browser tab.
536
+
537
+ Please use Chrome or Edge if external copy and paste is required.`, k = `You do not have permissions to access the clipboard.
538
+ All copy and paste operations will be limited to the browser tab.`, It = { Safari: `The Safari browser does not support advanced copy and paste.
539
+ Copy and paste will be limited to within the browser tab.
540
+
541
+ Please use Chrome or Edge if external copy and paste is required.`, Perms: k, PermsWrite: T() === y.Safari ? ut : k, PermsRead: T() === y.Safari ? ut : k }, N = async () => new Promise((e) => {
542
+ document.hasFocus() ? e() : globalThis.addEventListener?.("focus", () => {
543
+ e();
544
+ }, { once: !0 }), document.activeElement.focus?.();
545
+ }), B = async (e, t, r) => {
546
+ if (T() === y.Safari) return await r(new Error(It.Safari));
547
+ try {
548
+ const n = async (i) => {
549
+ try {
550
+ return await i();
551
+ } catch (l) {
552
+ if (l.message?.includes("Document is not focused")) return !1;
553
+ throw l;
554
+ }
555
+ }, o = await globalThis?.navigator?.permissions?.query({ name: e, allowWithoutGesture: !0, allowWithoutSanitization: !0 });
556
+ let a = !1;
557
+ if (o.state === "prompt" && (a = await n(t)), a || o.state !== "granted" || (a = await t()), !a) return await r(new Error(o.state));
558
+ } catch (n) {
559
+ return n.message === "No valid data on clipboard" || n.name === "DataError" ? void 0 : await r(n);
560
+ }
561
+ }, jt = async (e) => {
562
+ try {
563
+ return await e.read({ unsanitized: [h] });
564
+ } catch {
565
+ }
566
+ return await e.read();
567
+ };
568
+ if (!globalThis.ClipboardItem) {
569
+ const e = (r, n) => new Blob([n], { type: r });
570
+ class t {
571
+ constructor(n, o) {
572
+ this._items = {}, this._types = Object.keys(n);
573
+ const a = {}, i = Object.keys(n);
574
+ for (let l = 0; l < i.length; l++) {
575
+ const s = i[l];
576
+ let c = n[s];
577
+ a[s] = typeof c == "string" ? e(s, c) : c;
578
+ }
579
+ this._items = a, this._presentationStyle = o?.presentationStyle ?? "unspecified";
580
+ }
581
+ get types() {
582
+ return this._types;
583
+ }
584
+ getType(n) {
585
+ return Promise.resolve(this._items[n]);
586
+ }
587
+ supports(n) {
588
+ return !0;
589
+ }
590
+ }
591
+ globalThis.ClipboardItem = t;
592
+ }
593
+ const V = async (e, t = h) => new Promise(async (r, n) => {
594
+ try {
595
+ const o = await (async (a, i) => {
596
+ if (!a) return null;
597
+ const l = await jt(a);
598
+ let s = !1;
599
+ for (let c = 0; !s && l && c < l.length; c++) if (s = l[c].types.includes(i), s) return await l[c].getType(i);
600
+ return s ? void 0 : null;
601
+ })(e, t);
602
+ if (o) {
603
+ const a = new FileReader();
604
+ a.onload = () => {
605
+ r(a.result);
606
+ }, a.onerror = () => {
607
+ r("");
608
+ }, a.readAsText(o);
609
+ } else r("");
610
+ } catch (o) {
611
+ n(o);
612
+ }
613
+ }), dt = async (e, t = h) => {
614
+ const r = await V(e, t);
615
+ if (!r) return null;
616
+ let n = null;
617
+ try {
618
+ n = new DOMParser().parseFromString(r, h);
619
+ } catch {
620
+ console.warn("Can't parse html from clipboard.");
621
+ }
622
+ return n;
623
+ }, C = "clipboard-uuid", v = "web text/uuid", ft = (e) => `<div style="display:none" ${C}="${e}"/>`, Wt = (e, t) => {
624
+ let r = null;
625
+ try {
626
+ const n = new DOMParser().parseFromString(t, h);
627
+ n.body.firstElementChild.setAttribute(C, e), r = n.getElementsByTagName("body")[0].innerHTML;
628
+ } catch (n) {
629
+ console.warn("Can't embed uuid.", n);
630
+ }
631
+ return r;
632
+ }, pt = (e, t) => {
633
+ if (!t || !e) return !1;
634
+ try {
635
+ const r = t.querySelectorAll(`[${C}="${e}"]`);
636
+ if (r && r.length === 1) return !0;
637
+ if (t.querySelector("parsererror")) throw new Error("We are unable to parse node");
638
+ return !1;
639
+ } catch {
640
+ return !1;
641
+ }
642
+ };
643
+ class wt {
644
+ constructor(t) {
645
+ if (t?.nativeClipboard === void 0 || t?.nativeClipboard === !0) try {
646
+ this._nativeClipboard = globalThis?.navigator.clipboard;
647
+ } catch {
648
+ t?.nativeClipboard === !0 && console.warn("NativeClipboard option set to true but no native clipboard available.");
649
+ }
650
+ else this._nativeClipboard = t?.nativeClipboard === !1 ? null : t?.nativeClipboard;
651
+ this._disableCheckOnFocus = t?.disableCheckOnFocus ?? !1, this._init();
652
+ }
653
+ async _checkForChanges() {
654
+ this._nativeClipboard && this._state && !this._disableCheckOnFocus && await B("clipboard-read", async () => {
655
+ await N();
656
+ const t = await V(this._nativeClipboard, v);
657
+ if (!this._state || t && t === this._state.uuid) return !0;
658
+ const r = await dt(this._nativeClipboard, h);
659
+ return !this._state || (pt(this._state.uuid, r) || this.clear(), !0);
660
+ }, async (t) => {
661
+ t?.message === "denied" || t.message?.includes("Document is not focused") || T() === y.Safari || console.warn("Unable to detect clipboard changes: ", t);
662
+ });
663
+ }
664
+ _init() {
665
+ const t = this;
666
+ this._listeners = /* @__PURE__ */ new Map(), this._listenersCapture = /* @__PURE__ */ new Map(), this._state = null, this._nativeClipboard && (this._onFocus = () => {
667
+ t._checkForChanges();
668
+ }, this._onBlur = () => {
669
+ globalThis.addEventListener?.("focus", t._onFocus, { once: !0 });
670
+ }, globalThis.addEventListener?.("blur", this._onBlur), this._nativeClipboard.addEventListener("clipboardchange", (r) => {
671
+ t._checkForChanges();
672
+ }));
673
+ }
674
+ async read() {
675
+ if (!this._nativeClipboard) return this._state?.items ?? null;
676
+ const t = this;
677
+ return await B("clipboard-read", async () => {
678
+ if (await N(), this._state?.uuid) {
679
+ const r = await V(this._nativeClipboard, v);
680
+ if (r && r === t._state.uuid) return !0;
681
+ const n = await dt(this._nativeClipboard, h);
682
+ if (pt(t._state?.uuid, n)) return !0;
683
+ }
684
+ return t._state = { items: await jt(this._nativeClipboard), uuid: null, ref: null }, this.dispatchEvent(new Event("clipboardread")), !0;
685
+ }, async (r) => {
686
+ this.dispatchEvent(new Event("clipboarderrorread"));
687
+ }), this._state?.items ?? [];
688
+ }
689
+ async write(t) {
690
+ return this._write({ uuid: R(), items: t, ref: null });
691
+ }
692
+ async _write(t) {
693
+ if (!this._nativeClipboard) return this._state = t, this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")), null;
694
+ const r = this, n = [], o = t.uuid;
695
+ let a = t.items ?? [];
696
+ const i = () => {
697
+ r._state = { uuid: o, ref: t.ref, items: n }, r.dispatchEvent(new Event("clipboardwrite")), r.dispatchEvent(new Event("clipboardchange"));
698
+ };
699
+ await B("clipboard-write", async () => {
700
+ await N(), o && a.length === 0 && (a.push(new ClipboardItem({ [v]: new Blob([o], { type: v }) })), a.push(new ClipboardItem({ [h]: new Blob([ft(o)], { type: h }) })));
701
+ for (let l = 0; l < Math.min(1, a.length); l++) {
702
+ const s = a[l];
703
+ let c = s.types.indexOf(h), d = null;
704
+ if (c !== -1) {
705
+ const f = await s.getType(h);
706
+ d = await W(f), d && (d = Wt(o, d));
707
+ }
708
+ if (!d && s.types.includes(b)) {
709
+ const f = await s.getType(b);
710
+ if (f) {
711
+ let p = null;
712
+ typeof f == "string" ? (console.warn("text as string", f), p = f) : p = await W(f), p && (d = `<div ${C}="${o}">${p}</div>`);
713
+ }
714
+ }
715
+ if (!d && s.types.includes(L)) {
716
+ const f = await s.getType(L), p = xt(await f.arrayBuffer());
717
+ d = `<div ${C}="${o}"><img src="${_t + p}"/></div>`;
718
+ }
719
+ !d && o && (d = ft(o));
720
+ const w = new Blob([d ?? ""], { type: h }), u = {};
721
+ for (let f = 0; f < s.types.length; f++) {
722
+ const p = s.types[f];
723
+ u[p] = f === c ? w : s.getType(p);
724
+ }
725
+ d && c === -1 && (u[h] = w), o && (u[v] = new Blob([o], { type: v })), n.push(new ClipboardItem(u));
726
+ }
727
+ try {
728
+ n && n.length !== 0 ? await this._nativeClipboard.write(n) : await (async (l) => {
729
+ l && await l.writeText("");
730
+ })(this._nativeClipboard);
731
+ } catch (l) {
732
+ l.message?.includes("Document is not focused") || console.warn("Unable to write to native clipboard: ", l);
733
+ }
734
+ return i(), !0;
735
+ }, async (l) => {
736
+ this.dispatchEvent(new Event("clipboarderrorwrite")), i();
737
+ });
738
+ }
739
+ async writeReference(t) {
740
+ if (!t) return void this.clear();
741
+ let r = null;
742
+ const n = {};
743
+ try {
744
+ const a = await t.toText?.() ?? null;
745
+ a && (n[b] = new Blob([a ?? ""], { type: b }));
746
+ } catch (a) {
747
+ r = a;
748
+ }
749
+ try {
750
+ const a = await t.toHtml?.() ?? null;
751
+ a && (n[h] = new Blob([a], { type: h }));
752
+ } catch (a) {
753
+ r = a, console.warn("export to html", a);
754
+ }
755
+ try {
756
+ const a = await t.toImage?.() ?? null;
757
+ a && (n[L] = a);
758
+ } catch (a) {
759
+ r = a, console.warn("export to png", a);
760
+ }
761
+ const o = this._write({ uuid: R(), ref: t, items: Object.keys(n).length > 0 ? [new ClipboardItem(n)] : null });
762
+ if (r) throw r;
763
+ return o;
764
+ }
765
+ clear(t = !1) {
766
+ this._state && (this._state = null, t && this._write({ uuid: null, ref: null, items: null }), this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")));
767
+ }
768
+ async readReference() {
769
+ return await this.read(), this._state?.ref ?? null;
770
+ }
771
+ readText() {
772
+ return new Promise(async (t, r) => {
773
+ const n = await this.read();
774
+ let o = null;
775
+ for (let i = 0; !o && n && i < n.length; i++) n[i].types.includes(b) && (o = await n[i].getType(b));
776
+ if (!o) return void t("");
777
+ const a = new FileReader();
778
+ a.onload = () => {
779
+ t(a.result);
780
+ }, a.readAsText(o), a.onerror = (i) => {
781
+ r(i);
782
+ };
783
+ });
784
+ }
785
+ async writeText(t) {
786
+ const r = [new ClipboardItem({ [b]: new Blob([t], { type: b }) })];
787
+ return this._write({ uuid: R(), items: r, ref: null });
788
+ }
789
+ addEventListener(t, r, n = {}) {
790
+ const o = n?.capture ? this._listenersCapture : this._listeners;
791
+ let a = o.get(t);
792
+ a || (a = /* @__PURE__ */ new Map(), o.set(t, a)), a.set(r, typeof n == "boolean" ? {} : n);
793
+ }
794
+ dispatchEvent(t) {
795
+ if (!t) return;
796
+ const r = (n) => {
797
+ const o = n.get(t.type);
798
+ o && o.forEach((a, i) => {
799
+ try {
800
+ typeof i == "function" ? i(t) : i.handleEvent && i.handleEvent(t), a.once && o.delete(i);
801
+ } catch (l) {
802
+ console.warn(l);
803
+ }
804
+ });
805
+ };
806
+ return r(this._listenersCapture), r(this._listeners), !0;
807
+ }
808
+ removeEventListener(t, r, n) {
809
+ const o = n?.capture ? this._listenersCapture : this._listeners, a = o.get(t);
810
+ a && (a.delete(r), a.size === 0 && o.delete(t));
811
+ }
812
+ close() {
813
+ globalThis.removeEventListener?.("focus", this._onFocus), globalThis.removeEventListener?.("blur", this._onBlur);
814
+ }
815
+ }
816
+ var z;
817
+ (z = wt || (wt = {})).ErrorMessages = It, z.Global = new z();
818
+ let ht = null, q = null, M = null;
819
+ const Vt = Object.freeze({ compileTypescript: async function(e) {
820
+ if (!e?.source) return null;
821
+ if (q && $t.deepEqual(q, e)) return ht;
822
+ const t = await async function() {
823
+ if (M) return M;
824
+ const { TypeScriptCompiler: n } = await import("./COgfNXNmX_PF_eWZ.mjs");
825
+ return M = new n(), M;
826
+ }(), r = await t.compileModule(e);
827
+ return ht = r, q = e, r;
828
+ } }), Gt = Object.freeze(Object.defineProperty({ __proto__: null, ScriptingUtils: Vt }, Symbol.toStringTag, { value: "Module" }));
829
+ export {
830
+ $t as $,
831
+ Gt as i
832
+ };