@snowcone-app/canvas 0.16.0 → 0.17.1

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 (70) hide show
  1. package/dist/{CanvasStateV1-BQD8fCBU.js → CanvasStateV1-C6i6vU6p.js} +63 -63
  2. package/dist/{CanvasStateV1-BQD8fCBU.js.map → CanvasStateV1-C6i6vU6p.js.map} +1 -1
  3. package/dist/EditorCanvasImpl-C8SsT3C2.js +68 -0
  4. package/dist/EditorCanvasImpl-C8SsT3C2.js.map +1 -0
  5. package/dist/EditorContext-CyanYzo2.js +1131 -0
  6. package/dist/EditorContext-CyanYzo2.js.map +1 -0
  7. package/dist/{ImportManager-eotl7r5d.js → ElementFactory-C05JJkRp.js} +1510 -5121
  8. package/dist/ElementFactory-C05JJkRp.js.map +1 -0
  9. package/dist/{HybridHistoryManager-NL3zyEl4.js → HybridHistoryManager-Bht98XRv.js} +98 -98
  10. package/dist/{HybridHistoryManager-NL3zyEl4.js.map → HybridHistoryManager-Bht98XRv.js.map} +1 -1
  11. package/dist/ImportManager-kRYfIX-D.js +3617 -0
  12. package/dist/ImportManager-kRYfIX-D.js.map +1 -0
  13. package/dist/SnowconeCanvas-C3eZ9PP8.js +1047 -0
  14. package/dist/SnowconeCanvas-C3eZ9PP8.js.map +1 -0
  15. package/dist/ThemeContext-Rjz25x9X.js +75 -0
  16. package/dist/ThemeContext-Rjz25x9X.js.map +1 -0
  17. package/dist/UnifiedFontService-BAtqqkU4.js +1478 -0
  18. package/dist/UnifiedFontService-BAtqqkU4.js.map +1 -0
  19. package/dist/advanced.mjs +210 -207
  20. package/dist/advanced.mjs.map +1 -1
  21. package/dist/api/embed.d.ts +8 -4
  22. package/dist/api/testing.d.ts +1 -0
  23. package/dist/components/editor/EditorBuy.d.ts +49 -0
  24. package/dist/components/editor/EditorCanvas.d.ts +30 -0
  25. package/dist/components/editor/EditorCanvasImpl.d.ts +33 -0
  26. package/dist/components/editor/EditorPreview.d.ts +39 -0
  27. package/dist/components/editor/EditorRoot.d.ts +86 -0
  28. package/dist/components/editor/EditorTextField.d.ts +22 -0
  29. package/dist/components/editor/RootInternals.d.ts +77 -0
  30. package/dist/components/editor/designStateStore.d.ts +45 -0
  31. package/dist/components/editor/index.d.ts +23 -0
  32. package/dist/components/embed-realtime/RealtimeCanvas.d.ts +1 -1
  33. package/dist/components/embed-realtime/RealtimeEmbed.d.ts +5 -78
  34. package/dist/components/embed-realtime/RealtimeMockup.d.ts +5 -34
  35. package/dist/components/embed-realtime/context.d.ts +12 -2
  36. package/dist/components/embed-realtime/validateEmbed.d.ts +17 -3
  37. package/dist/design/design-builder.d.ts +81 -6
  38. package/dist/editorError-DMENTZ-3.js +19 -0
  39. package/dist/editorError-DMENTZ-3.js.map +1 -0
  40. package/dist/editorErrors-DbIEtCTt.js +29 -0
  41. package/dist/editorErrors-DbIEtCTt.js.map +1 -0
  42. package/dist/embed-B5kewSQY.js +738 -0
  43. package/dist/embed-B5kewSQY.js.map +1 -0
  44. package/dist/embed.mjs +38 -230
  45. package/dist/embed.mjs.map +1 -1
  46. package/dist/errors/editorError.d.ts +57 -0
  47. package/dist/iconify-D6eVIEy4.js +1089 -0
  48. package/dist/iconify-D6eVIEy4.js.map +1 -0
  49. package/dist/index.mjs +48 -46
  50. package/dist/index.mjs.map +1 -1
  51. package/dist/internals.mjs +105 -104
  52. package/dist/internals.mjs.map +1 -1
  53. package/dist/template-fields-GOM4MNfq.js +643 -0
  54. package/dist/template-fields-GOM4MNfq.js.map +1 -0
  55. package/dist/testing/editorErrors.d.ts +30 -0
  56. package/dist/testing.mjs +28 -23
  57. package/dist/testing.mjs.map +1 -1
  58. package/dist/{usePieceGuideBundle-Cyl695jv.js → usePieceGuideBundle-CGERAQJl.js} +2 -2
  59. package/dist/{usePieceGuideBundle-Cyl695jv.js.map → usePieceGuideBundle-CGERAQJl.js.map} +1 -1
  60. package/dist/validation-DEd6EOCP.js +19947 -0
  61. package/dist/validation-DEd6EOCP.js.map +1 -0
  62. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  63. package/package.json +12 -4
  64. package/dist/ImportManager-eotl7r5d.js.map +0 -1
  65. package/dist/ThemeContext-D9AaUw9v.js +0 -1200
  66. package/dist/ThemeContext-D9AaUw9v.js.map +0 -1
  67. package/dist/template-fields-PcSPApl5.js +0 -1632
  68. package/dist/template-fields-PcSPApl5.js.map +0 -1
  69. package/dist/validation-BpEod0Rn.js +0 -22953
  70. package/dist/validation-BpEod0Rn.js.map +0 -1
@@ -0,0 +1,1089 @@
1
+ import { forwardRef as se, useState as R, useEffect as W, createElement as H } from "react";
2
+ function Ie(e, n) {
3
+ const o = e.icons, i = e.aliases || /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null);
4
+ function r(s) {
5
+ if (o[s]) return t[s] = [];
6
+ if (!(s in t)) {
7
+ t[s] = null;
8
+ const l = i[s] && i[s].parent, c = l && r(l);
9
+ c && (t[s] = [l].concat(c));
10
+ }
11
+ return t[s];
12
+ }
13
+ return Object.keys(o).concat(Object.keys(i)).forEach(r), t;
14
+ }
15
+ const ce = Object.freeze({
16
+ left: 0,
17
+ top: 0,
18
+ width: 16,
19
+ height: 16
20
+ }), A = Object.freeze({
21
+ rotate: 0,
22
+ vFlip: !1,
23
+ hFlip: !1
24
+ }), $ = Object.freeze({
25
+ ...ce,
26
+ ...A
27
+ }), Q = Object.freeze({
28
+ ...$,
29
+ body: "",
30
+ hidden: !1
31
+ });
32
+ function we(e, n) {
33
+ const o = {};
34
+ !e.hFlip != !n.hFlip && (o.hFlip = !0), !e.vFlip != !n.vFlip && (o.vFlip = !0);
35
+ const i = ((e.rotate || 0) + (n.rotate || 0)) % 4;
36
+ return i && (o.rotate = i), o;
37
+ }
38
+ function J(e, n) {
39
+ const o = we(e, n);
40
+ for (const i in Q) i in A ? i in e && !(i in o) && (o[i] = A[i]) : i in n ? o[i] = n[i] : i in e && (o[i] = e[i]);
41
+ return o;
42
+ }
43
+ function ve(e, n, o) {
44
+ const i = e.icons, t = e.aliases || /* @__PURE__ */ Object.create(null);
45
+ let r = {};
46
+ function s(l) {
47
+ r = J(i[l] || t[l], r);
48
+ }
49
+ return s(n), o.forEach(s), J(e, r);
50
+ }
51
+ function le(e, n) {
52
+ const o = [];
53
+ if (typeof e != "object" || typeof e.icons != "object") return o;
54
+ e.not_found instanceof Array && e.not_found.forEach((t) => {
55
+ n(t, null), o.push(t);
56
+ });
57
+ const i = Ie(e);
58
+ for (const t in i) {
59
+ const r = i[t];
60
+ r && (n(t, ve(e, t, r)), o.push(t));
61
+ }
62
+ return o;
63
+ }
64
+ const ke = {
65
+ provider: "",
66
+ aliases: {},
67
+ not_found: {},
68
+ ...ce
69
+ };
70
+ function D(e, n) {
71
+ for (const o in n) if (o in e && typeof e[o] != typeof n[o]) return !1;
72
+ return !0;
73
+ }
74
+ function fe(e) {
75
+ if (typeof e != "object" || e === null) return null;
76
+ const n = e;
77
+ if (typeof n.prefix != "string" || !e.icons || typeof e.icons != "object" || !D(e, ke)) return null;
78
+ const o = n.icons;
79
+ for (const t in o) {
80
+ const r = o[t];
81
+ if (!t || typeof r.body != "string" || !D(r, Q)) return null;
82
+ }
83
+ const i = n.aliases || /* @__PURE__ */ Object.create(null);
84
+ for (const t in i) {
85
+ const r = i[t], s = r.parent;
86
+ if (!t || typeof s != "string" || !o[s] && !i[s] || !D(r, Q)) return null;
87
+ }
88
+ return n;
89
+ }
90
+ const K = /* @__PURE__ */ Object.create(null);
91
+ function Se(e, n) {
92
+ return {
93
+ provider: e,
94
+ prefix: n,
95
+ icons: /* @__PURE__ */ Object.create(null),
96
+ missing: /* @__PURE__ */ new Set()
97
+ };
98
+ }
99
+ function S(e, n) {
100
+ const o = K[e] || (K[e] = /* @__PURE__ */ Object.create(null));
101
+ return o[n] || (o[n] = Se(e, n));
102
+ }
103
+ function ue(e, n) {
104
+ return fe(n) ? le(n, (o, i) => {
105
+ i ? e.icons[o] = i : e.missing.add(o);
106
+ }) : [];
107
+ }
108
+ function Te(e, n, o) {
109
+ try {
110
+ if (typeof o.body == "string")
111
+ return e.icons[n] = { ...o }, !0;
112
+ } catch {
113
+ }
114
+ return !1;
115
+ }
116
+ const ae = /^[a-z0-9]+(-[a-z0-9]+)*$/, M = (e, n, o, i = "") => {
117
+ const t = e.split(":");
118
+ if (e.slice(0, 1) === "@") {
119
+ if (t.length < 2 || t.length > 3) return null;
120
+ i = t.shift().slice(1);
121
+ }
122
+ if (t.length > 3 || !t.length) return null;
123
+ if (t.length > 1) {
124
+ const l = t.pop(), c = t.pop(), f = {
125
+ provider: t.length > 0 ? t[0] : i,
126
+ prefix: c,
127
+ name: l
128
+ };
129
+ return n && !F(f) ? null : f;
130
+ }
131
+ const r = t[0], s = r.split("-");
132
+ if (s.length > 1) {
133
+ const l = {
134
+ provider: i,
135
+ prefix: s.shift(),
136
+ name: s.join("-")
137
+ };
138
+ return n && !F(l) ? null : l;
139
+ }
140
+ if (o && i === "") {
141
+ const l = {
142
+ provider: i,
143
+ prefix: "",
144
+ name: r
145
+ };
146
+ return n && !F(l, o) ? null : l;
147
+ }
148
+ return null;
149
+ }, F = (e, n) => e ? !!((n && e.prefix === "" || e.prefix) && e.name) : !1;
150
+ let E = !1;
151
+ function de(e) {
152
+ return typeof e == "boolean" && (E = e), E;
153
+ }
154
+ function X(e) {
155
+ const n = typeof e == "string" ? M(e, !0, E) : e;
156
+ if (n) {
157
+ const o = S(n.provider, n.prefix), i = n.name;
158
+ return o.icons[i] || (o.missing.has(i) ? null : void 0);
159
+ }
160
+ }
161
+ function Pe(e, n) {
162
+ const o = M(e, !0, E);
163
+ if (!o) return !1;
164
+ const i = S(o.provider, o.prefix);
165
+ return n ? Te(i, o.name, n) : (i.missing.add(o.name), !0);
166
+ }
167
+ function Ce(e, n) {
168
+ if (typeof e != "object") return !1;
169
+ if (typeof n != "string" && (n = e.provider || ""), E && !n && !e.prefix) {
170
+ let t = !1;
171
+ return fe(e) && (e.prefix = "", le(e, (r, s) => {
172
+ Pe(r, s) && (t = !0);
173
+ })), t;
174
+ }
175
+ const o = e.prefix;
176
+ if (!F({
177
+ prefix: o,
178
+ name: "a"
179
+ })) return !1;
180
+ const i = S(n, o);
181
+ return !!ue(i, e);
182
+ }
183
+ const he = Object.freeze({
184
+ width: null,
185
+ height: null
186
+ }), pe = Object.freeze({
187
+ ...he,
188
+ ...A
189
+ }), je = /(-?[0-9.]*[0-9]+[0-9.]*)/g, Ee = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
190
+ function Y(e, n, o) {
191
+ if (n === 1) return e;
192
+ if (o = o || 100, typeof e == "number") return Math.ceil(e * n * o) / o;
193
+ if (typeof e != "string") return e;
194
+ const i = e.split(je);
195
+ if (i === null || !i.length) return e;
196
+ const t = [];
197
+ let r = i.shift(), s = Ee.test(r);
198
+ for (; ; ) {
199
+ if (s) {
200
+ const l = parseFloat(r);
201
+ isNaN(l) ? t.push(r) : t.push(Math.ceil(l * n * o) / o);
202
+ } else t.push(r);
203
+ if (r = i.shift(), r === void 0) return t.join("");
204
+ s = !s;
205
+ }
206
+ }
207
+ function Oe(e, n = "defs") {
208
+ let o = "";
209
+ const i = e.indexOf("<" + n);
210
+ for (; i >= 0; ) {
211
+ const t = e.indexOf(">", i), r = e.indexOf("</" + n);
212
+ if (t === -1 || r === -1) break;
213
+ const s = e.indexOf(">", r);
214
+ if (s === -1) break;
215
+ o += e.slice(t + 1, r).trim(), e = e.slice(0, i).trim() + e.slice(s + 1);
216
+ }
217
+ return {
218
+ defs: o,
219
+ content: e
220
+ };
221
+ }
222
+ function Fe(e, n) {
223
+ return e ? "<defs>" + e + "</defs>" + n : n;
224
+ }
225
+ function Le(e, n, o) {
226
+ const i = Oe(e);
227
+ return Fe(i.defs, n + i.content + o);
228
+ }
229
+ const Ae = (e) => e === "unset" || e === "undefined" || e === "none";
230
+ function Me(e, n) {
231
+ const o = {
232
+ ...$,
233
+ ...e
234
+ }, i = {
235
+ ...pe,
236
+ ...n
237
+ }, t = {
238
+ left: o.left,
239
+ top: o.top,
240
+ width: o.width,
241
+ height: o.height
242
+ };
243
+ let r = o.body;
244
+ [o, i].forEach((b) => {
245
+ const a = [], h = b.hFlip, v = b.vFlip;
246
+ let x = b.rotate;
247
+ h ? v ? x += 2 : (a.push("translate(" + (t.width + t.left).toString() + " " + (0 - t.top).toString() + ")"), a.push("scale(-1 1)"), t.top = t.left = 0) : v && (a.push("translate(" + (0 - t.left).toString() + " " + (t.height + t.top).toString() + ")"), a.push("scale(1 -1)"), t.top = t.left = 0);
248
+ let I;
249
+ switch (x < 0 && (x -= Math.floor(x / 4) * 4), x = x % 4, x) {
250
+ case 1:
251
+ I = t.height / 2 + t.top, a.unshift("rotate(90 " + I.toString() + " " + I.toString() + ")");
252
+ break;
253
+ case 2:
254
+ a.unshift("rotate(180 " + (t.width / 2 + t.left).toString() + " " + (t.height / 2 + t.top).toString() + ")");
255
+ break;
256
+ case 3:
257
+ I = t.width / 2 + t.left, a.unshift("rotate(-90 " + I.toString() + " " + I.toString() + ")");
258
+ break;
259
+ }
260
+ x % 2 === 1 && (t.left !== t.top && (I = t.left, t.left = t.top, t.top = I), t.width !== t.height && (I = t.width, t.width = t.height, t.height = I)), a.length && (r = Le(r, '<g transform="' + a.join(" ") + '">', "</g>"));
261
+ });
262
+ const s = i.width, l = i.height, c = t.width, f = t.height;
263
+ let u, d;
264
+ s === null ? (d = l === null ? "1em" : l === "auto" ? f : l, u = Y(d, c / f)) : (u = s === "auto" ? c : s, d = l === null ? Y(u, f / c) : l === "auto" ? f : l);
265
+ const p = {}, g = (b, a) => {
266
+ Ae(a) || (p[b] = a.toString());
267
+ };
268
+ g("width", u), g("height", d);
269
+ const y = [
270
+ t.left,
271
+ t.top,
272
+ c,
273
+ f
274
+ ];
275
+ return p.viewBox = y.join(" "), {
276
+ attributes: p,
277
+ viewBox: y,
278
+ body: r
279
+ };
280
+ }
281
+ const Ne = /\sid="(\S+)"/g, Re = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
282
+ let De = 0;
283
+ function _e(e, n = Re) {
284
+ const o = [];
285
+ let i;
286
+ for (; i = Ne.exec(e); ) o.push(i[1]);
287
+ if (!o.length) return e;
288
+ const t = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
289
+ return o.forEach((r) => {
290
+ const s = typeof n == "function" ? n(r) : n + (De++).toString(), l = r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
291
+ e = e.replace(new RegExp('([#;"])(' + l + ')([")]|\\.[a-z])', "g"), "$1" + s + t + "$3");
292
+ }), e = e.replace(new RegExp(t, "g"), ""), e;
293
+ }
294
+ const U = /* @__PURE__ */ Object.create(null);
295
+ function He(e, n) {
296
+ U[e] = n;
297
+ }
298
+ function q(e) {
299
+ return U[e] || U[""];
300
+ }
301
+ function V(e) {
302
+ let n;
303
+ if (typeof e.resources == "string") n = [e.resources];
304
+ else if (n = e.resources, !(n instanceof Array) || !n.length) return null;
305
+ return {
306
+ resources: n,
307
+ path: e.path || "/",
308
+ maxURL: e.maxURL || 500,
309
+ rotate: e.rotate || 750,
310
+ timeout: e.timeout || 5e3,
311
+ random: e.random === !0,
312
+ index: e.index || 0,
313
+ dataAfterTimeout: e.dataAfterTimeout !== !1
314
+ };
315
+ }
316
+ const G = /* @__PURE__ */ Object.create(null), P = ["https://api.simplesvg.com", "https://api.unisvg.com"], L = [];
317
+ for (; P.length > 0; ) P.length === 1 || Math.random() > 0.5 ? L.push(P.shift()) : L.push(P.pop());
318
+ G[""] = V({ resources: ["https://api.iconify.design"].concat(L) });
319
+ function Qe(e, n) {
320
+ const o = V(n);
321
+ return o === null ? !1 : (G[e] = o, !0);
322
+ }
323
+ function B(e) {
324
+ return G[e];
325
+ }
326
+ const Ue = () => {
327
+ let e;
328
+ try {
329
+ if (e = fetch, typeof e == "function") return e;
330
+ } catch {
331
+ }
332
+ };
333
+ let Z = Ue();
334
+ function qe(e, n) {
335
+ const o = B(e);
336
+ if (!o) return 0;
337
+ let i;
338
+ if (!o.maxURL) i = 0;
339
+ else {
340
+ let t = 0;
341
+ o.resources.forEach((s) => {
342
+ t = Math.max(t, s.length);
343
+ });
344
+ const r = n + ".json?icons=";
345
+ i = o.maxURL - t - o.path.length - r.length;
346
+ }
347
+ return i;
348
+ }
349
+ function ze(e) {
350
+ return e === 404;
351
+ }
352
+ const $e = (e, n, o) => {
353
+ const i = [], t = qe(e, n), r = "icons";
354
+ let s = {
355
+ type: r,
356
+ provider: e,
357
+ prefix: n,
358
+ icons: []
359
+ }, l = 0;
360
+ return o.forEach((c, f) => {
361
+ l += c.length + 1, l >= t && f > 0 && (i.push(s), s = {
362
+ type: r,
363
+ provider: e,
364
+ prefix: n,
365
+ icons: []
366
+ }, l = c.length), s.icons.push(c);
367
+ }), i.push(s), i;
368
+ };
369
+ function Ve(e) {
370
+ if (typeof e == "string") {
371
+ const n = B(e);
372
+ if (n) return n.path;
373
+ }
374
+ return "/";
375
+ }
376
+ const Ge = (e, n, o) => {
377
+ if (!Z) {
378
+ o("abort", 424);
379
+ return;
380
+ }
381
+ let i = Ve(n.provider);
382
+ switch (n.type) {
383
+ case "icons": {
384
+ const r = n.prefix, l = n.icons.join(","), c = new URLSearchParams({ icons: l });
385
+ i += r + ".json?" + c.toString();
386
+ break;
387
+ }
388
+ case "custom": {
389
+ const r = n.uri;
390
+ i += r.slice(0, 1) === "/" ? r.slice(1) : r;
391
+ break;
392
+ }
393
+ default:
394
+ o("abort", 400);
395
+ return;
396
+ }
397
+ let t = 503;
398
+ Z(e + i).then((r) => {
399
+ const s = r.status;
400
+ if (s !== 200) {
401
+ setTimeout(() => {
402
+ o(ze(s) ? "abort" : "next", s);
403
+ });
404
+ return;
405
+ }
406
+ return t = 501, r.json();
407
+ }).then((r) => {
408
+ if (typeof r != "object" || r === null) {
409
+ setTimeout(() => {
410
+ r === 404 ? o("abort", r) : o("next", t);
411
+ });
412
+ return;
413
+ }
414
+ setTimeout(() => {
415
+ o("success", r);
416
+ });
417
+ }).catch(() => {
418
+ o("next", t);
419
+ });
420
+ }, Be = {
421
+ prepare: $e,
422
+ send: Ge
423
+ };
424
+ function ge(e, n) {
425
+ e.forEach((o) => {
426
+ const i = o.loaderCallbacks;
427
+ i && (o.loaderCallbacks = i.filter((t) => t.id !== n));
428
+ });
429
+ }
430
+ function We(e) {
431
+ e.pendingCallbacksFlag || (e.pendingCallbacksFlag = !0, setTimeout(() => {
432
+ e.pendingCallbacksFlag = !1;
433
+ const n = e.loaderCallbacks ? e.loaderCallbacks.slice(0) : [];
434
+ if (!n.length) return;
435
+ let o = !1;
436
+ const i = e.provider, t = e.prefix;
437
+ n.forEach((r) => {
438
+ const s = r.icons, l = s.pending.length;
439
+ s.pending = s.pending.filter((c) => {
440
+ if (c.prefix !== t) return !0;
441
+ const f = c.name;
442
+ if (e.icons[f]) s.loaded.push({
443
+ provider: i,
444
+ prefix: t,
445
+ name: f
446
+ });
447
+ else if (e.missing.has(f)) s.missing.push({
448
+ provider: i,
449
+ prefix: t,
450
+ name: f
451
+ });
452
+ else
453
+ return o = !0, !0;
454
+ return !1;
455
+ }), s.pending.length !== l && (o || ge([e], r.id), r.callback(s.loaded.slice(0), s.missing.slice(0), s.pending.slice(0), r.abort));
456
+ });
457
+ }));
458
+ }
459
+ let Je = 0;
460
+ function Ke(e, n, o) {
461
+ const i = Je++, t = ge.bind(null, o, i);
462
+ if (!n.pending.length) return t;
463
+ const r = {
464
+ id: i,
465
+ icons: n,
466
+ callback: e,
467
+ abort: t
468
+ };
469
+ return o.forEach((s) => {
470
+ (s.loaderCallbacks || (s.loaderCallbacks = [])).push(r);
471
+ }), t;
472
+ }
473
+ function Xe(e) {
474
+ const n = {
475
+ loaded: [],
476
+ missing: [],
477
+ pending: []
478
+ }, o = /* @__PURE__ */ Object.create(null);
479
+ e.sort((t, r) => t.provider !== r.provider ? t.provider.localeCompare(r.provider) : t.prefix !== r.prefix ? t.prefix.localeCompare(r.prefix) : t.name.localeCompare(r.name));
480
+ let i = {
481
+ provider: "",
482
+ prefix: "",
483
+ name: ""
484
+ };
485
+ return e.forEach((t) => {
486
+ if (i.name === t.name && i.prefix === t.prefix && i.provider === t.provider) return;
487
+ i = t;
488
+ const r = t.provider, s = t.prefix, l = t.name, c = o[r] || (o[r] = /* @__PURE__ */ Object.create(null)), f = c[s] || (c[s] = S(r, s));
489
+ let u;
490
+ l in f.icons ? u = n.loaded : s === "" || f.missing.has(l) ? u = n.missing : u = n.pending;
491
+ const d = {
492
+ provider: r,
493
+ prefix: s,
494
+ name: l
495
+ };
496
+ u.push(d);
497
+ }), n;
498
+ }
499
+ function Ye(e, n = !0, o = !1) {
500
+ const i = [];
501
+ return e.forEach((t) => {
502
+ const r = typeof t == "string" ? M(t, n, o) : t;
503
+ r && i.push(r);
504
+ }), i;
505
+ }
506
+ const Ze = {
507
+ resources: [],
508
+ index: 0,
509
+ timeout: 2e3,
510
+ rotate: 750,
511
+ random: !1,
512
+ dataAfterTimeout: !1
513
+ };
514
+ function et(e, n, o, i) {
515
+ const t = e.resources.length, r = e.random ? Math.floor(Math.random() * t) : e.index;
516
+ let s;
517
+ if (e.random) {
518
+ let m = e.resources.slice(0);
519
+ for (s = []; m.length > 1; ) {
520
+ const w = Math.floor(Math.random() * m.length);
521
+ s.push(m[w]), m = m.slice(0, w).concat(m.slice(w + 1));
522
+ }
523
+ s = s.concat(m);
524
+ } else s = e.resources.slice(r).concat(e.resources.slice(0, r));
525
+ const l = Date.now();
526
+ let c = "pending", f = 0, u, d = null, p = [], g = [];
527
+ typeof i == "function" && g.push(i);
528
+ function y() {
529
+ d && (clearTimeout(d), d = null);
530
+ }
531
+ function b() {
532
+ c === "pending" && (c = "aborted"), y(), p.forEach((m) => {
533
+ m.status === "pending" && (m.status = "aborted");
534
+ }), p = [];
535
+ }
536
+ function a(m, w) {
537
+ w && (g = []), typeof m == "function" && g.push(m);
538
+ }
539
+ function h() {
540
+ return {
541
+ startTime: l,
542
+ payload: n,
543
+ status: c,
544
+ queriesSent: f,
545
+ queriesPending: p.length,
546
+ subscribe: a,
547
+ abort: b
548
+ };
549
+ }
550
+ function v() {
551
+ c = "failed", g.forEach((m) => {
552
+ m(void 0, u);
553
+ });
554
+ }
555
+ function x() {
556
+ p.forEach((m) => {
557
+ m.status === "pending" && (m.status = "aborted");
558
+ }), p = [];
559
+ }
560
+ function I(m, w, T) {
561
+ const O = w !== "success";
562
+ switch (p = p.filter((k) => k !== m), c) {
563
+ case "pending":
564
+ break;
565
+ case "failed":
566
+ if (O || !e.dataAfterTimeout) return;
567
+ break;
568
+ default:
569
+ return;
570
+ }
571
+ if (w === "abort") {
572
+ u = T, v();
573
+ return;
574
+ }
575
+ if (O) {
576
+ u = T, p.length || (s.length ? N() : v());
577
+ return;
578
+ }
579
+ if (y(), x(), !e.random) {
580
+ const k = e.resources.indexOf(m.resource);
581
+ k !== -1 && k !== e.index && (e.index = k);
582
+ }
583
+ c = "completed", g.forEach((k) => {
584
+ k(T);
585
+ });
586
+ }
587
+ function N() {
588
+ if (c !== "pending") return;
589
+ y();
590
+ const m = s.shift();
591
+ if (m === void 0) {
592
+ if (p.length) {
593
+ d = setTimeout(() => {
594
+ y(), c === "pending" && (x(), v());
595
+ }, e.timeout);
596
+ return;
597
+ }
598
+ v();
599
+ return;
600
+ }
601
+ const w = {
602
+ status: "pending",
603
+ resource: m,
604
+ callback: (T, O) => {
605
+ I(w, T, O);
606
+ }
607
+ };
608
+ p.push(w), f++, d = setTimeout(N, e.rotate), o(m, n, w.callback);
609
+ }
610
+ return setTimeout(N), h;
611
+ }
612
+ function me(e) {
613
+ const n = {
614
+ ...Ze,
615
+ ...e
616
+ };
617
+ let o = [];
618
+ function i() {
619
+ o = o.filter((l) => l().status === "pending");
620
+ }
621
+ function t(l, c, f) {
622
+ const u = et(n, l, c, (d, p) => {
623
+ i(), f && f(d, p);
624
+ });
625
+ return o.push(u), u;
626
+ }
627
+ function r(l) {
628
+ return o.find((c) => l(c)) || null;
629
+ }
630
+ return {
631
+ query: t,
632
+ find: r,
633
+ setIndex: (l) => {
634
+ n.index = l;
635
+ },
636
+ getIndex: () => n.index,
637
+ cleanup: i
638
+ };
639
+ }
640
+ function ee() {
641
+ }
642
+ const _ = /* @__PURE__ */ Object.create(null);
643
+ function tt(e) {
644
+ if (!_[e]) {
645
+ const n = B(e);
646
+ if (!n) return;
647
+ const o = me(n), i = {
648
+ config: n,
649
+ redundancy: o
650
+ };
651
+ _[e] = i;
652
+ }
653
+ return _[e];
654
+ }
655
+ function nt(e, n, o) {
656
+ let i, t;
657
+ if (typeof e == "string") {
658
+ const r = q(e);
659
+ if (!r)
660
+ return o(void 0, 424), ee;
661
+ t = r.send;
662
+ const s = tt(e);
663
+ s && (i = s.redundancy);
664
+ } else {
665
+ const r = V(e);
666
+ if (r) {
667
+ i = me(r);
668
+ const s = e.resources ? e.resources[0] : "", l = q(s);
669
+ l && (t = l.send);
670
+ }
671
+ }
672
+ return !i || !t ? (o(void 0, 424), ee) : i.query(n, t, o)().abort;
673
+ }
674
+ function te() {
675
+ }
676
+ function ot(e) {
677
+ e.iconsLoaderFlag || (e.iconsLoaderFlag = !0, setTimeout(() => {
678
+ e.iconsLoaderFlag = !1, We(e);
679
+ }));
680
+ }
681
+ function it(e) {
682
+ const n = [], o = [];
683
+ return e.forEach((i) => {
684
+ (i.match(ae) ? n : o).push(i);
685
+ }), {
686
+ valid: n,
687
+ invalid: o
688
+ };
689
+ }
690
+ function C(e, n, o) {
691
+ function i() {
692
+ const t = e.pendingIcons;
693
+ n.forEach((r) => {
694
+ t && t.delete(r), e.icons[r] || e.missing.add(r);
695
+ });
696
+ }
697
+ if (o && typeof o == "object") try {
698
+ if (!ue(e, o).length) {
699
+ i();
700
+ return;
701
+ }
702
+ } catch (t) {
703
+ console.error(t);
704
+ }
705
+ i(), ot(e);
706
+ }
707
+ function ne(e, n) {
708
+ e instanceof Promise ? e.then((o) => {
709
+ n(o);
710
+ }).catch(() => {
711
+ n(null);
712
+ }) : n(e);
713
+ }
714
+ function rt(e, n) {
715
+ e.iconsToLoad ? e.iconsToLoad = e.iconsToLoad.concat(n).sort() : e.iconsToLoad = n, e.iconsQueueFlag || (e.iconsQueueFlag = !0, setTimeout(() => {
716
+ e.iconsQueueFlag = !1;
717
+ const { provider: o, prefix: i } = e, t = e.iconsToLoad;
718
+ if (delete e.iconsToLoad, !t || !t.length) return;
719
+ const r = e.loadIcon;
720
+ if (e.loadIcons && (t.length > 1 || !r)) {
721
+ ne(e.loadIcons(t, i, o), (u) => {
722
+ C(e, t, u);
723
+ });
724
+ return;
725
+ }
726
+ if (r) {
727
+ t.forEach((u) => {
728
+ const d = r(u, i, o);
729
+ ne(d, (p) => {
730
+ const g = p ? {
731
+ prefix: i,
732
+ icons: { [u]: p }
733
+ } : null;
734
+ C(e, [u], g);
735
+ });
736
+ });
737
+ return;
738
+ }
739
+ const { valid: s, invalid: l } = it(t);
740
+ if (l.length && C(e, l, null), !s.length) return;
741
+ const c = i.match(ae) ? q(o) : null;
742
+ if (!c) {
743
+ C(e, s, null);
744
+ return;
745
+ }
746
+ c.prepare(o, i, s).forEach((u) => {
747
+ nt(o, u, (d) => {
748
+ C(e, u.icons, d);
749
+ });
750
+ });
751
+ }));
752
+ }
753
+ const st = (e, n) => {
754
+ const o = Ye(e, !0, de()), i = Xe(o);
755
+ if (!i.pending.length) {
756
+ let c = !0;
757
+ return n && setTimeout(() => {
758
+ c && n(i.loaded, i.missing, i.pending, te);
759
+ }), () => {
760
+ c = !1;
761
+ };
762
+ }
763
+ const t = /* @__PURE__ */ Object.create(null), r = [];
764
+ let s, l;
765
+ return i.pending.forEach((c) => {
766
+ const { provider: f, prefix: u } = c;
767
+ if (u === l && f === s) return;
768
+ s = f, l = u, r.push(S(f, u));
769
+ const d = t[f] || (t[f] = /* @__PURE__ */ Object.create(null));
770
+ d[u] || (d[u] = []);
771
+ }), i.pending.forEach((c) => {
772
+ const { provider: f, prefix: u, name: d } = c, p = S(f, u), g = p.pendingIcons || (p.pendingIcons = /* @__PURE__ */ new Set());
773
+ g.has(d) || (g.add(d), t[f][u].push(d));
774
+ }), r.forEach((c) => {
775
+ const f = t[c.provider][c.prefix];
776
+ f.length && rt(c, f);
777
+ }), n ? Ke(n, i, r) : te;
778
+ };
779
+ function ct(e, n) {
780
+ const o = { ...e };
781
+ for (const i in n) {
782
+ const t = n[i], r = typeof t;
783
+ i in he ? (t === null || t && (r === "string" || r === "number")) && (o[i] = t) : r === typeof o[i] && (o[i] = i === "rotate" ? t % 4 : t);
784
+ }
785
+ return o;
786
+ }
787
+ const lt = /[\s,]+/;
788
+ function ft(e, n) {
789
+ n.split(lt).forEach((o) => {
790
+ switch (o.trim()) {
791
+ case "horizontal":
792
+ e.hFlip = !0;
793
+ break;
794
+ case "vertical":
795
+ e.vFlip = !0;
796
+ break;
797
+ }
798
+ });
799
+ }
800
+ function ut(e, n = 0) {
801
+ const o = e.replace(/^-?[0-9.]*/, "");
802
+ function i(t) {
803
+ for (; t < 0; ) t += 4;
804
+ return t % 4;
805
+ }
806
+ if (o === "") {
807
+ const t = parseInt(e);
808
+ return isNaN(t) ? 0 : i(t);
809
+ } else if (o !== e) {
810
+ let t = 0;
811
+ switch (o) {
812
+ case "%":
813
+ t = 25;
814
+ break;
815
+ case "deg":
816
+ t = 90;
817
+ }
818
+ if (t) {
819
+ let r = parseFloat(e.slice(0, e.length - o.length));
820
+ return isNaN(r) ? 0 : (r = r / t, r % 1 === 0 ? i(r) : 0);
821
+ }
822
+ }
823
+ return n;
824
+ }
825
+ function at(e, n) {
826
+ let o = e.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
827
+ for (const i in n) o += " " + i + '="' + n[i] + '"';
828
+ return '<svg xmlns="http://www.w3.org/2000/svg"' + o + ">" + e + "</svg>";
829
+ }
830
+ function dt(e) {
831
+ return e.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
832
+ }
833
+ function ht(e) {
834
+ return "data:image/svg+xml," + dt(e);
835
+ }
836
+ function pt(e) {
837
+ return 'url("' + ht(e) + '")';
838
+ }
839
+ let j;
840
+ function gt() {
841
+ try {
842
+ j = window.trustedTypes.createPolicy("iconify", { createHTML: (e) => e });
843
+ } catch {
844
+ j = null;
845
+ }
846
+ }
847
+ function mt(e) {
848
+ return j === void 0 && gt(), j ? j.createHTML(e) : e;
849
+ }
850
+ const ye = {
851
+ ...pe,
852
+ inline: !1
853
+ }, yt = {
854
+ xmlns: "http://www.w3.org/2000/svg",
855
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
856
+ "aria-hidden": !0,
857
+ role: "img"
858
+ }, bt = {
859
+ display: "inline-block"
860
+ }, z = {
861
+ backgroundColor: "currentColor"
862
+ }, be = {
863
+ backgroundColor: "transparent"
864
+ }, oe = {
865
+ Image: "var(--svg)",
866
+ Repeat: "no-repeat",
867
+ Size: "100% 100%"
868
+ }, ie = {
869
+ WebkitMask: z,
870
+ mask: z,
871
+ background: be
872
+ };
873
+ for (const e in ie) {
874
+ const n = ie[e];
875
+ for (const o in oe)
876
+ n[e + o] = oe[o];
877
+ }
878
+ const xt = {
879
+ ...ye,
880
+ inline: !0
881
+ };
882
+ function re(e) {
883
+ return e + (e.match(/^[-0-9.]+$/) ? "px" : "");
884
+ }
885
+ const It = (e, n, o) => {
886
+ const i = n.inline ? xt : ye, t = ct(i, n), r = n.mode || "svg", s = {}, l = n.style || {}, c = {
887
+ ...r === "svg" ? yt : {}
888
+ };
889
+ if (o) {
890
+ const a = M(o, !1, !0);
891
+ if (a) {
892
+ const h = ["iconify"], v = [
893
+ "provider",
894
+ "prefix"
895
+ ];
896
+ for (const x of v)
897
+ a[x] && h.push("iconify--" + a[x]);
898
+ c.className = h.join(" ");
899
+ }
900
+ }
901
+ for (let a in n) {
902
+ const h = n[a];
903
+ if (h !== void 0)
904
+ switch (a) {
905
+ // Properties to ignore
906
+ case "icon":
907
+ case "style":
908
+ case "children":
909
+ case "onLoad":
910
+ case "mode":
911
+ case "ssr":
912
+ case "fallback":
913
+ break;
914
+ // Forward ref
915
+ case "_ref":
916
+ c.ref = h;
917
+ break;
918
+ // Merge class names
919
+ case "className":
920
+ c[a] = (c[a] ? c[a] + " " : "") + h;
921
+ break;
922
+ // Boolean attributes
923
+ case "inline":
924
+ case "hFlip":
925
+ case "vFlip":
926
+ t[a] = h === !0 || h === "true" || h === 1;
927
+ break;
928
+ // Flip as string: 'horizontal,vertical'
929
+ case "flip":
930
+ typeof h == "string" && ft(t, h);
931
+ break;
932
+ // Color: copy to style
933
+ case "color":
934
+ s.color = h;
935
+ break;
936
+ // Rotation as string
937
+ case "rotate":
938
+ typeof h == "string" ? t[a] = ut(h) : typeof h == "number" && (t[a] = h);
939
+ break;
940
+ // Remove aria-hidden
941
+ case "ariaHidden":
942
+ case "aria-hidden":
943
+ h !== !0 && h !== "true" && delete c["aria-hidden"];
944
+ break;
945
+ // Copy missing property if it does not exist in customisations
946
+ default:
947
+ i[a] === void 0 && (c[a] = h);
948
+ }
949
+ }
950
+ const f = Me(e, t), u = f.attributes;
951
+ if (t.inline && (s.verticalAlign = "-0.125em"), r === "svg") {
952
+ c.style = {
953
+ ...s,
954
+ ...l
955
+ }, Object.assign(c, u);
956
+ let a = 0, h = n.id;
957
+ return typeof h == "string" && (h = h.replace(/-/g, "_")), c.dangerouslySetInnerHTML = {
958
+ __html: mt(_e(f.body, h ? () => h + "ID" + a++ : "iconifyReact"))
959
+ }, H("svg", c);
960
+ }
961
+ const { body: d, width: p, height: g } = e, y = r === "mask" || (r === "bg" ? !1 : d.indexOf("currentColor") !== -1), b = at(d, {
962
+ ...u,
963
+ width: p + "",
964
+ height: g + ""
965
+ });
966
+ return c.style = {
967
+ ...s,
968
+ "--svg": pt(b),
969
+ width: re(u.width),
970
+ height: re(u.height),
971
+ ...bt,
972
+ ...y ? z : be,
973
+ ...l
974
+ }, H("span", c);
975
+ };
976
+ de(!0);
977
+ He("", Be);
978
+ if (typeof document < "u" && typeof window < "u") {
979
+ const e = window;
980
+ if (e.IconifyPreload !== void 0) {
981
+ const n = e.IconifyPreload, o = "Invalid IconifyPreload syntax.";
982
+ typeof n == "object" && n !== null && (n instanceof Array ? n : [n]).forEach((i) => {
983
+ try {
984
+ // Check if item is an object and not null/array
985
+ (typeof i != "object" || i === null || i instanceof Array || // Check for 'icons' and 'prefix'
986
+ typeof i.icons != "object" || typeof i.prefix != "string" || // Add icon set
987
+ !Ce(i)) && console.error(o);
988
+ } catch {
989
+ console.error(o);
990
+ }
991
+ });
992
+ }
993
+ if (e.IconifyProviders !== void 0) {
994
+ const n = e.IconifyProviders;
995
+ if (typeof n == "object" && n !== null)
996
+ for (let o in n) {
997
+ const i = "IconifyProviders[" + o + "] is invalid.";
998
+ try {
999
+ const t = n[o];
1000
+ if (typeof t != "object" || !t || t.resources === void 0)
1001
+ continue;
1002
+ Qe(o, t) || console.error(i);
1003
+ } catch {
1004
+ console.error(i);
1005
+ }
1006
+ }
1007
+ }
1008
+ }
1009
+ function xe(e) {
1010
+ const [n, o] = R(!!e.ssr), [i, t] = R({});
1011
+ function r(g) {
1012
+ if (g) {
1013
+ const y = e.icon;
1014
+ if (typeof y == "object")
1015
+ return {
1016
+ name: "",
1017
+ data: y
1018
+ };
1019
+ const b = X(y);
1020
+ if (b)
1021
+ return {
1022
+ name: y,
1023
+ data: b
1024
+ };
1025
+ }
1026
+ return {
1027
+ name: ""
1028
+ };
1029
+ }
1030
+ const [s, l] = R(r(!!e.ssr));
1031
+ function c() {
1032
+ const g = i.callback;
1033
+ g && (g(), t({}));
1034
+ }
1035
+ function f(g) {
1036
+ if (JSON.stringify(s) !== JSON.stringify(g))
1037
+ return c(), l(g), !0;
1038
+ }
1039
+ function u() {
1040
+ var g;
1041
+ const y = e.icon;
1042
+ if (typeof y == "object") {
1043
+ f({
1044
+ name: "",
1045
+ data: y
1046
+ });
1047
+ return;
1048
+ }
1049
+ const b = X(y);
1050
+ if (f({
1051
+ name: y,
1052
+ data: b
1053
+ }))
1054
+ if (b === void 0) {
1055
+ const a = st([y], u);
1056
+ t({
1057
+ callback: a
1058
+ });
1059
+ } else b && ((g = e.onLoad) === null || g === void 0 || g.call(e, y));
1060
+ }
1061
+ W(() => (o(!0), c), []), W(() => {
1062
+ n && u();
1063
+ }, [e.icon, n]);
1064
+ const { name: d, data: p } = s;
1065
+ return p ? It({
1066
+ ...$,
1067
+ ...p
1068
+ }, e, d) : e.children ? e.children : e.fallback ? e.fallback : H("span", {});
1069
+ }
1070
+ const vt = se((e, n) => xe({
1071
+ ...e,
1072
+ _ref: n
1073
+ }));
1074
+ se((e, n) => xe({
1075
+ inline: !0,
1076
+ ...e,
1077
+ _ref: n
1078
+ }));
1079
+ export {
1080
+ vt as Icon,
1081
+ Qe as addAPIProvider,
1082
+ Ce as addCollection,
1083
+ Pe as addIcon,
1084
+ Me as buildIcon,
1085
+ Y as calculateSize,
1086
+ st as loadIcons,
1087
+ _e as replaceIDs
1088
+ };
1089
+ //# sourceMappingURL=iconify-D6eVIEy4.js.map