@pequity/squirrel 5.4.5 → 5.4.7

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.
@@ -0,0 +1,2181 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { defineComponent, openBlock, createElementBlock, normalizeProps, guardReactiveProps, unref } from "vue";
5
+ import { P_ICON_ALIASES } from "../p-icon.js";
6
+ /**
7
+ * (c) Iconify
8
+ *
9
+ * For the full copyright and license information, please view the license.txt
10
+ * files at https://github.com/iconify/iconify
11
+ *
12
+ * Licensed under MIT.
13
+ *
14
+ * @license MIT
15
+ * @version 2.1.0
16
+ */
17
+ const defaultIconDimensions = Object.freeze(
18
+ {
19
+ left: 0,
20
+ top: 0,
21
+ width: 16,
22
+ height: 16
23
+ }
24
+ );
25
+ const defaultIconTransformations = Object.freeze({
26
+ rotate: 0,
27
+ vFlip: false,
28
+ hFlip: false
29
+ });
30
+ const defaultIconProps = Object.freeze({
31
+ ...defaultIconDimensions,
32
+ ...defaultIconTransformations
33
+ });
34
+ const defaultExtendedIconProps = Object.freeze({
35
+ ...defaultIconProps,
36
+ body: "",
37
+ hidden: false
38
+ });
39
+ const defaultIconSizeCustomisations = Object.freeze({
40
+ width: null,
41
+ height: null
42
+ });
43
+ const defaultIconCustomisations = Object.freeze({
44
+ // Dimensions
45
+ ...defaultIconSizeCustomisations,
46
+ // Transformations
47
+ ...defaultIconTransformations
48
+ });
49
+ function rotateFromString(value, defaultValue = 0) {
50
+ const units = value.replace(/^-?[0-9.]*/, "");
51
+ function cleanup(value2) {
52
+ while (value2 < 0) {
53
+ value2 += 4;
54
+ }
55
+ return value2 % 4;
56
+ }
57
+ if (units === "") {
58
+ const num = parseInt(value);
59
+ return isNaN(num) ? 0 : cleanup(num);
60
+ } else if (units !== value) {
61
+ let split = 0;
62
+ switch (units) {
63
+ case "%":
64
+ split = 25;
65
+ break;
66
+ case "deg":
67
+ split = 90;
68
+ }
69
+ if (split) {
70
+ let num = parseFloat(value.slice(0, value.length - units.length));
71
+ if (isNaN(num)) {
72
+ return 0;
73
+ }
74
+ num = num / split;
75
+ return num % 1 === 0 ? cleanup(num) : 0;
76
+ }
77
+ }
78
+ return defaultValue;
79
+ }
80
+ const separator = /[\s,]+/;
81
+ function flipFromString(custom, flip) {
82
+ flip.split(separator).forEach((str) => {
83
+ const value = str.trim();
84
+ switch (value) {
85
+ case "horizontal":
86
+ custom.hFlip = true;
87
+ break;
88
+ case "vertical":
89
+ custom.vFlip = true;
90
+ break;
91
+ }
92
+ });
93
+ }
94
+ const defaultCustomisations = {
95
+ ...defaultIconCustomisations,
96
+ preserveAspectRatio: ""
97
+ };
98
+ function getCustomisations(node) {
99
+ const customisations = {
100
+ ...defaultCustomisations
101
+ };
102
+ const attr = (key, def) => node.getAttribute(key) || def;
103
+ customisations.width = attr("width", null);
104
+ customisations.height = attr("height", null);
105
+ customisations.rotate = rotateFromString(attr("rotate", ""));
106
+ flipFromString(customisations, attr("flip", ""));
107
+ customisations.preserveAspectRatio = attr("preserveAspectRatio", attr("preserveaspectratio", ""));
108
+ return customisations;
109
+ }
110
+ function haveCustomisationsChanged(value1, value2) {
111
+ for (const key in defaultCustomisations) {
112
+ if (value1[key] !== value2[key]) {
113
+ return true;
114
+ }
115
+ }
116
+ return false;
117
+ }
118
+ const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
119
+ const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
120
+ const colonSeparated = value.split(":");
121
+ if (value.slice(0, 1) === "@") {
122
+ if (colonSeparated.length < 2 || colonSeparated.length > 3) {
123
+ return null;
124
+ }
125
+ provider = colonSeparated.shift().slice(1);
126
+ }
127
+ if (colonSeparated.length > 3 || !colonSeparated.length) {
128
+ return null;
129
+ }
130
+ if (colonSeparated.length > 1) {
131
+ const name2 = colonSeparated.pop();
132
+ const prefix = colonSeparated.pop();
133
+ const result = {
134
+ // Allow provider without '@': "provider:prefix:name"
135
+ provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
136
+ prefix,
137
+ name: name2
138
+ };
139
+ return validate && !validateIconName(result) ? null : result;
140
+ }
141
+ const name = colonSeparated[0];
142
+ const dashSeparated = name.split("-");
143
+ if (dashSeparated.length > 1) {
144
+ const result = {
145
+ provider,
146
+ prefix: dashSeparated.shift(),
147
+ name: dashSeparated.join("-")
148
+ };
149
+ return validate && !validateIconName(result) ? null : result;
150
+ }
151
+ if (allowSimpleName && provider === "") {
152
+ const result = {
153
+ provider,
154
+ prefix: "",
155
+ name
156
+ };
157
+ return validate && !validateIconName(result, allowSimpleName) ? null : result;
158
+ }
159
+ return null;
160
+ };
161
+ const validateIconName = (icon, allowSimpleName) => {
162
+ if (!icon) {
163
+ return false;
164
+ }
165
+ return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
166
+ };
167
+ function mergeIconTransformations(obj1, obj2) {
168
+ const result = {};
169
+ if (!obj1.hFlip !== !obj2.hFlip) {
170
+ result.hFlip = true;
171
+ }
172
+ if (!obj1.vFlip !== !obj2.vFlip) {
173
+ result.vFlip = true;
174
+ }
175
+ const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
176
+ if (rotate) {
177
+ result.rotate = rotate;
178
+ }
179
+ return result;
180
+ }
181
+ function mergeIconData(parent, child) {
182
+ const result = mergeIconTransformations(parent, child);
183
+ for (const key in defaultExtendedIconProps) {
184
+ if (key in defaultIconTransformations) {
185
+ if (key in parent && !(key in result)) {
186
+ result[key] = defaultIconTransformations[key];
187
+ }
188
+ } else if (key in child) {
189
+ result[key] = child[key];
190
+ } else if (key in parent) {
191
+ result[key] = parent[key];
192
+ }
193
+ }
194
+ return result;
195
+ }
196
+ function getIconsTree(data, names) {
197
+ const icons = data.icons;
198
+ const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
199
+ const resolved = /* @__PURE__ */ Object.create(null);
200
+ function resolve(name) {
201
+ if (icons[name]) {
202
+ return resolved[name] = [];
203
+ }
204
+ if (!(name in resolved)) {
205
+ resolved[name] = null;
206
+ const parent = aliases[name] && aliases[name].parent;
207
+ const value = parent && resolve(parent);
208
+ if (value) {
209
+ resolved[name] = [parent].concat(value);
210
+ }
211
+ }
212
+ return resolved[name];
213
+ }
214
+ Object.keys(icons).concat(Object.keys(aliases)).forEach(resolve);
215
+ return resolved;
216
+ }
217
+ function internalGetIconData(data, name, tree) {
218
+ const icons = data.icons;
219
+ const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
220
+ let currentProps = {};
221
+ function parse(name2) {
222
+ currentProps = mergeIconData(
223
+ icons[name2] || aliases[name2],
224
+ currentProps
225
+ );
226
+ }
227
+ parse(name);
228
+ tree.forEach(parse);
229
+ return mergeIconData(data, currentProps);
230
+ }
231
+ function parseIconSet(data, callback) {
232
+ const names = [];
233
+ if (typeof data !== "object" || typeof data.icons !== "object") {
234
+ return names;
235
+ }
236
+ if (data.not_found instanceof Array) {
237
+ data.not_found.forEach((name) => {
238
+ callback(name, null);
239
+ names.push(name);
240
+ });
241
+ }
242
+ const tree = getIconsTree(data);
243
+ for (const name in tree) {
244
+ const item = tree[name];
245
+ if (item) {
246
+ callback(name, internalGetIconData(data, name, item));
247
+ names.push(name);
248
+ }
249
+ }
250
+ return names;
251
+ }
252
+ const optionalPropertyDefaults = {
253
+ provider: "",
254
+ aliases: {},
255
+ not_found: {},
256
+ ...defaultIconDimensions
257
+ };
258
+ function checkOptionalProps(item, defaults) {
259
+ for (const prop in defaults) {
260
+ if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
261
+ return false;
262
+ }
263
+ }
264
+ return true;
265
+ }
266
+ function quicklyValidateIconSet(obj) {
267
+ if (typeof obj !== "object" || obj === null) {
268
+ return null;
269
+ }
270
+ const data = obj;
271
+ if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
272
+ return null;
273
+ }
274
+ if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
275
+ return null;
276
+ }
277
+ const icons = data.icons;
278
+ for (const name in icons) {
279
+ const icon = icons[name];
280
+ if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
281
+ icon,
282
+ defaultExtendedIconProps
283
+ )) {
284
+ return null;
285
+ }
286
+ }
287
+ const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
288
+ for (const name in aliases) {
289
+ const icon = aliases[name];
290
+ const parent = icon.parent;
291
+ if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
292
+ icon,
293
+ defaultExtendedIconProps
294
+ )) {
295
+ return null;
296
+ }
297
+ }
298
+ return data;
299
+ }
300
+ const dataStorage = /* @__PURE__ */ Object.create(null);
301
+ function newStorage(provider, prefix) {
302
+ return {
303
+ provider,
304
+ prefix,
305
+ icons: /* @__PURE__ */ Object.create(null),
306
+ missing: /* @__PURE__ */ new Set()
307
+ };
308
+ }
309
+ function getStorage(provider, prefix) {
310
+ const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
311
+ return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
312
+ }
313
+ function addIconSet(storage2, data) {
314
+ if (!quicklyValidateIconSet(data)) {
315
+ return [];
316
+ }
317
+ return parseIconSet(data, (name, icon) => {
318
+ if (icon) {
319
+ storage2.icons[name] = icon;
320
+ } else {
321
+ storage2.missing.add(name);
322
+ }
323
+ });
324
+ }
325
+ function addIconToStorage(storage2, name, icon) {
326
+ try {
327
+ if (typeof icon.body === "string") {
328
+ storage2.icons[name] = { ...icon };
329
+ return true;
330
+ }
331
+ } catch (err) {
332
+ }
333
+ return false;
334
+ }
335
+ function listIcons$1(provider, prefix) {
336
+ let allIcons = [];
337
+ const providers = typeof provider === "string" ? [provider] : Object.keys(dataStorage);
338
+ providers.forEach((provider2) => {
339
+ const prefixes = typeof provider2 === "string" && typeof prefix === "string" ? [prefix] : Object.keys(dataStorage[provider2] || {});
340
+ prefixes.forEach((prefix2) => {
341
+ const storage2 = getStorage(provider2, prefix2);
342
+ allIcons = allIcons.concat(
343
+ Object.keys(storage2.icons).map(
344
+ (name) => (provider2 !== "" ? "@" + provider2 + ":" : "") + prefix2 + ":" + name
345
+ )
346
+ );
347
+ });
348
+ });
349
+ return allIcons;
350
+ }
351
+ let simpleNames = false;
352
+ function allowSimpleNames(allow) {
353
+ if (typeof allow === "boolean") {
354
+ simpleNames = allow;
355
+ }
356
+ return simpleNames;
357
+ }
358
+ function getIconData(name) {
359
+ const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
360
+ if (icon) {
361
+ const storage2 = getStorage(icon.provider, icon.prefix);
362
+ const iconName = icon.name;
363
+ return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
364
+ }
365
+ }
366
+ function addIcon$1(name, data) {
367
+ const icon = stringToIcon(name, true, simpleNames);
368
+ if (!icon) {
369
+ return false;
370
+ }
371
+ const storage2 = getStorage(icon.provider, icon.prefix);
372
+ return addIconToStorage(storage2, icon.name, data);
373
+ }
374
+ function addCollection$1(data, provider) {
375
+ if (typeof data !== "object") {
376
+ return false;
377
+ }
378
+ if (typeof provider !== "string") {
379
+ provider = data.provider || "";
380
+ }
381
+ if (simpleNames && !provider && !data.prefix) {
382
+ let added = false;
383
+ if (quicklyValidateIconSet(data)) {
384
+ data.prefix = "";
385
+ parseIconSet(data, (name, icon) => {
386
+ if (icon && addIcon$1(name, icon)) {
387
+ added = true;
388
+ }
389
+ });
390
+ }
391
+ return added;
392
+ }
393
+ const prefix = data.prefix;
394
+ if (!validateIconName({
395
+ provider,
396
+ prefix,
397
+ name: "a"
398
+ })) {
399
+ return false;
400
+ }
401
+ const storage2 = getStorage(provider, prefix);
402
+ return !!addIconSet(storage2, data);
403
+ }
404
+ function iconLoaded$1(name) {
405
+ return !!getIconData(name);
406
+ }
407
+ function getIcon$1(name) {
408
+ const result = getIconData(name);
409
+ return result ? {
410
+ ...defaultIconProps,
411
+ ...result
412
+ } : null;
413
+ }
414
+ function sortIcons(icons) {
415
+ const result = {
416
+ loaded: [],
417
+ missing: [],
418
+ pending: []
419
+ };
420
+ const storage2 = /* @__PURE__ */ Object.create(null);
421
+ icons.sort((a, b) => {
422
+ if (a.provider !== b.provider) {
423
+ return a.provider.localeCompare(b.provider);
424
+ }
425
+ if (a.prefix !== b.prefix) {
426
+ return a.prefix.localeCompare(b.prefix);
427
+ }
428
+ return a.name.localeCompare(b.name);
429
+ });
430
+ let lastIcon = {
431
+ provider: "",
432
+ prefix: "",
433
+ name: ""
434
+ };
435
+ icons.forEach((icon) => {
436
+ if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
437
+ return;
438
+ }
439
+ lastIcon = icon;
440
+ const provider = icon.provider;
441
+ const prefix = icon.prefix;
442
+ const name = icon.name;
443
+ const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
444
+ const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
445
+ let list;
446
+ if (name in localStorage.icons) {
447
+ list = result.loaded;
448
+ } else if (prefix === "" || localStorage.missing.has(name)) {
449
+ list = result.missing;
450
+ } else {
451
+ list = result.pending;
452
+ }
453
+ const item = {
454
+ provider,
455
+ prefix,
456
+ name
457
+ };
458
+ list.push(item);
459
+ });
460
+ return result;
461
+ }
462
+ function removeCallback(storages, id) {
463
+ storages.forEach((storage2) => {
464
+ const items = storage2.loaderCallbacks;
465
+ if (items) {
466
+ storage2.loaderCallbacks = items.filter((row) => row.id !== id);
467
+ }
468
+ });
469
+ }
470
+ function updateCallbacks(storage2) {
471
+ if (!storage2.pendingCallbacksFlag) {
472
+ storage2.pendingCallbacksFlag = true;
473
+ setTimeout(() => {
474
+ storage2.pendingCallbacksFlag = false;
475
+ const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
476
+ if (!items.length) {
477
+ return;
478
+ }
479
+ let hasPending = false;
480
+ const provider = storage2.provider;
481
+ const prefix = storage2.prefix;
482
+ items.forEach((item) => {
483
+ const icons = item.icons;
484
+ const oldLength = icons.pending.length;
485
+ icons.pending = icons.pending.filter((icon) => {
486
+ if (icon.prefix !== prefix) {
487
+ return true;
488
+ }
489
+ const name = icon.name;
490
+ if (storage2.icons[name]) {
491
+ icons.loaded.push({
492
+ provider,
493
+ prefix,
494
+ name
495
+ });
496
+ } else if (storage2.missing.has(name)) {
497
+ icons.missing.push({
498
+ provider,
499
+ prefix,
500
+ name
501
+ });
502
+ } else {
503
+ hasPending = true;
504
+ return true;
505
+ }
506
+ return false;
507
+ });
508
+ if (icons.pending.length !== oldLength) {
509
+ if (!hasPending) {
510
+ removeCallback([storage2], item.id);
511
+ }
512
+ item.callback(
513
+ icons.loaded.slice(0),
514
+ icons.missing.slice(0),
515
+ icons.pending.slice(0),
516
+ item.abort
517
+ );
518
+ }
519
+ });
520
+ });
521
+ }
522
+ }
523
+ let idCounter = 0;
524
+ function storeCallback(callback, icons, pendingSources) {
525
+ const id = idCounter++;
526
+ const abort = removeCallback.bind(null, pendingSources, id);
527
+ if (!icons.pending.length) {
528
+ return abort;
529
+ }
530
+ const item = {
531
+ id,
532
+ icons,
533
+ callback,
534
+ abort
535
+ };
536
+ pendingSources.forEach((storage2) => {
537
+ (storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
538
+ });
539
+ return abort;
540
+ }
541
+ const storage = /* @__PURE__ */ Object.create(null);
542
+ function setAPIModule(provider, item) {
543
+ storage[provider] = item;
544
+ }
545
+ function getAPIModule(provider) {
546
+ return storage[provider] || storage[""];
547
+ }
548
+ function listToIcons(list, validate = true, simpleNames2 = false) {
549
+ const result = [];
550
+ list.forEach((item) => {
551
+ const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
552
+ if (icon) {
553
+ result.push(icon);
554
+ }
555
+ });
556
+ return result;
557
+ }
558
+ var defaultConfig = {
559
+ resources: [],
560
+ index: 0,
561
+ timeout: 2e3,
562
+ rotate: 750,
563
+ random: false,
564
+ dataAfterTimeout: false
565
+ };
566
+ function sendQuery(config, payload, query, done) {
567
+ const resourcesCount = config.resources.length;
568
+ const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;
569
+ let resources;
570
+ if (config.random) {
571
+ let list = config.resources.slice(0);
572
+ resources = [];
573
+ while (list.length > 1) {
574
+ const nextIndex = Math.floor(Math.random() * list.length);
575
+ resources.push(list[nextIndex]);
576
+ list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
577
+ }
578
+ resources = resources.concat(list);
579
+ } else {
580
+ resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));
581
+ }
582
+ const startTime = Date.now();
583
+ let status = "pending";
584
+ let queriesSent = 0;
585
+ let lastError;
586
+ let timer = null;
587
+ let queue = [];
588
+ let doneCallbacks = [];
589
+ if (typeof done === "function") {
590
+ doneCallbacks.push(done);
591
+ }
592
+ function resetTimer() {
593
+ if (timer) {
594
+ clearTimeout(timer);
595
+ timer = null;
596
+ }
597
+ }
598
+ function abort() {
599
+ if (status === "pending") {
600
+ status = "aborted";
601
+ }
602
+ resetTimer();
603
+ queue.forEach((item) => {
604
+ if (item.status === "pending") {
605
+ item.status = "aborted";
606
+ }
607
+ });
608
+ queue = [];
609
+ }
610
+ function subscribe(callback, overwrite) {
611
+ if (overwrite) {
612
+ doneCallbacks = [];
613
+ }
614
+ if (typeof callback === "function") {
615
+ doneCallbacks.push(callback);
616
+ }
617
+ }
618
+ function getQueryStatus() {
619
+ return {
620
+ startTime,
621
+ payload,
622
+ status,
623
+ queriesSent,
624
+ queriesPending: queue.length,
625
+ subscribe,
626
+ abort
627
+ };
628
+ }
629
+ function failQuery() {
630
+ status = "failed";
631
+ doneCallbacks.forEach((callback) => {
632
+ callback(void 0, lastError);
633
+ });
634
+ }
635
+ function clearQueue() {
636
+ queue.forEach((item) => {
637
+ if (item.status === "pending") {
638
+ item.status = "aborted";
639
+ }
640
+ });
641
+ queue = [];
642
+ }
643
+ function moduleResponse(item, response, data) {
644
+ const isError = response !== "success";
645
+ queue = queue.filter((queued) => queued !== item);
646
+ switch (status) {
647
+ case "pending":
648
+ break;
649
+ case "failed":
650
+ if (isError || !config.dataAfterTimeout) {
651
+ return;
652
+ }
653
+ break;
654
+ default:
655
+ return;
656
+ }
657
+ if (response === "abort") {
658
+ lastError = data;
659
+ failQuery();
660
+ return;
661
+ }
662
+ if (isError) {
663
+ lastError = data;
664
+ if (!queue.length) {
665
+ if (!resources.length) {
666
+ failQuery();
667
+ } else {
668
+ execNext();
669
+ }
670
+ }
671
+ return;
672
+ }
673
+ resetTimer();
674
+ clearQueue();
675
+ if (!config.random) {
676
+ const index = config.resources.indexOf(item.resource);
677
+ if (index !== -1 && index !== config.index) {
678
+ config.index = index;
679
+ }
680
+ }
681
+ status = "completed";
682
+ doneCallbacks.forEach((callback) => {
683
+ callback(data);
684
+ });
685
+ }
686
+ function execNext() {
687
+ if (status !== "pending") {
688
+ return;
689
+ }
690
+ resetTimer();
691
+ const resource = resources.shift();
692
+ if (resource === void 0) {
693
+ if (queue.length) {
694
+ timer = setTimeout(() => {
695
+ resetTimer();
696
+ if (status === "pending") {
697
+ clearQueue();
698
+ failQuery();
699
+ }
700
+ }, config.timeout);
701
+ return;
702
+ }
703
+ failQuery();
704
+ return;
705
+ }
706
+ const item = {
707
+ status: "pending",
708
+ resource,
709
+ callback: (status2, data) => {
710
+ moduleResponse(item, status2, data);
711
+ }
712
+ };
713
+ queue.push(item);
714
+ queriesSent++;
715
+ timer = setTimeout(execNext, config.rotate);
716
+ query(resource, payload, item.callback);
717
+ }
718
+ setTimeout(execNext);
719
+ return getQueryStatus;
720
+ }
721
+ function initRedundancy(cfg) {
722
+ const config = {
723
+ ...defaultConfig,
724
+ ...cfg
725
+ };
726
+ let queries = [];
727
+ function cleanup() {
728
+ queries = queries.filter((item) => item().status === "pending");
729
+ }
730
+ function query(payload, queryCallback, doneCallback) {
731
+ const query2 = sendQuery(
732
+ config,
733
+ payload,
734
+ queryCallback,
735
+ (data, error) => {
736
+ cleanup();
737
+ if (doneCallback) {
738
+ doneCallback(data, error);
739
+ }
740
+ }
741
+ );
742
+ queries.push(query2);
743
+ return query2;
744
+ }
745
+ function find(callback) {
746
+ return queries.find((value) => {
747
+ return callback(value);
748
+ }) || null;
749
+ }
750
+ const instance = {
751
+ query,
752
+ find,
753
+ setIndex: (index) => {
754
+ config.index = index;
755
+ },
756
+ getIndex: () => config.index,
757
+ cleanup
758
+ };
759
+ return instance;
760
+ }
761
+ function createAPIConfig(source) {
762
+ let resources;
763
+ if (typeof source.resources === "string") {
764
+ resources = [source.resources];
765
+ } else {
766
+ resources = source.resources;
767
+ if (!(resources instanceof Array) || !resources.length) {
768
+ return null;
769
+ }
770
+ }
771
+ const result = {
772
+ // API hosts
773
+ resources,
774
+ // Root path
775
+ path: source.path || "/",
776
+ // URL length limit
777
+ maxURL: source.maxURL || 500,
778
+ // Timeout before next host is used.
779
+ rotate: source.rotate || 750,
780
+ // Timeout before failing query.
781
+ timeout: source.timeout || 5e3,
782
+ // Randomise default API end point.
783
+ random: source.random === true,
784
+ // Start index
785
+ index: source.index || 0,
786
+ // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
787
+ dataAfterTimeout: source.dataAfterTimeout !== false
788
+ };
789
+ return result;
790
+ }
791
+ const configStorage = /* @__PURE__ */ Object.create(null);
792
+ const fallBackAPISources = [
793
+ "https://api.simplesvg.com",
794
+ "https://api.unisvg.com"
795
+ ];
796
+ const fallBackAPI = [];
797
+ while (fallBackAPISources.length > 0) {
798
+ if (fallBackAPISources.length === 1) {
799
+ fallBackAPI.push(fallBackAPISources.shift());
800
+ } else {
801
+ if (Math.random() > 0.5) {
802
+ fallBackAPI.push(fallBackAPISources.shift());
803
+ } else {
804
+ fallBackAPI.push(fallBackAPISources.pop());
805
+ }
806
+ }
807
+ }
808
+ configStorage[""] = createAPIConfig({
809
+ resources: ["https://api.iconify.design"].concat(fallBackAPI)
810
+ });
811
+ function addAPIProvider$1(provider, customConfig) {
812
+ const config = createAPIConfig(customConfig);
813
+ if (config === null) {
814
+ return false;
815
+ }
816
+ configStorage[provider] = config;
817
+ return true;
818
+ }
819
+ function getAPIConfig(provider) {
820
+ return configStorage[provider];
821
+ }
822
+ function listAPIProviders() {
823
+ return Object.keys(configStorage);
824
+ }
825
+ function emptyCallback$1() {
826
+ }
827
+ const redundancyCache = /* @__PURE__ */ Object.create(null);
828
+ function getRedundancyCache(provider) {
829
+ if (!redundancyCache[provider]) {
830
+ const config = getAPIConfig(provider);
831
+ if (!config) {
832
+ return;
833
+ }
834
+ const redundancy = initRedundancy(config);
835
+ const cachedReundancy = {
836
+ config,
837
+ redundancy
838
+ };
839
+ redundancyCache[provider] = cachedReundancy;
840
+ }
841
+ return redundancyCache[provider];
842
+ }
843
+ function sendAPIQuery(target, query, callback) {
844
+ let redundancy;
845
+ let send2;
846
+ if (typeof target === "string") {
847
+ const api = getAPIModule(target);
848
+ if (!api) {
849
+ callback(void 0, 424);
850
+ return emptyCallback$1;
851
+ }
852
+ send2 = api.send;
853
+ const cached = getRedundancyCache(target);
854
+ if (cached) {
855
+ redundancy = cached.redundancy;
856
+ }
857
+ } else {
858
+ const config = createAPIConfig(target);
859
+ if (config) {
860
+ redundancy = initRedundancy(config);
861
+ const moduleKey = target.resources ? target.resources[0] : "";
862
+ const api = getAPIModule(moduleKey);
863
+ if (api) {
864
+ send2 = api.send;
865
+ }
866
+ }
867
+ }
868
+ if (!redundancy || !send2) {
869
+ callback(void 0, 424);
870
+ return emptyCallback$1;
871
+ }
872
+ return redundancy.query(query, send2, callback)().abort;
873
+ }
874
+ const browserCacheVersion = "iconify2";
875
+ const browserCachePrefix = "iconify";
876
+ const browserCacheCountKey = browserCachePrefix + "-count";
877
+ const browserCacheVersionKey = browserCachePrefix + "-version";
878
+ const browserStorageHour = 36e5;
879
+ const browserStorageCacheExpiration = 168;
880
+ const browserStorageLimit = 50;
881
+ function getStoredItem(func, key) {
882
+ try {
883
+ return func.getItem(key);
884
+ } catch (err) {
885
+ }
886
+ }
887
+ function setStoredItem(func, key, value) {
888
+ try {
889
+ func.setItem(key, value);
890
+ return true;
891
+ } catch (err) {
892
+ }
893
+ }
894
+ function removeStoredItem(func, key) {
895
+ try {
896
+ func.removeItem(key);
897
+ } catch (err) {
898
+ }
899
+ }
900
+ function setBrowserStorageItemsCount(storage2, value) {
901
+ return setStoredItem(storage2, browserCacheCountKey, value.toString());
902
+ }
903
+ function getBrowserStorageItemsCount(storage2) {
904
+ return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
905
+ }
906
+ const browserStorageConfig = {
907
+ local: true,
908
+ session: true
909
+ };
910
+ const browserStorageEmptyItems = {
911
+ local: /* @__PURE__ */ new Set(),
912
+ session: /* @__PURE__ */ new Set()
913
+ };
914
+ let browserStorageStatus = false;
915
+ function setBrowserStorageStatus(status) {
916
+ browserStorageStatus = status;
917
+ }
918
+ let _window = typeof window === "undefined" ? {} : window;
919
+ function getBrowserStorage(key) {
920
+ const attr = key + "Storage";
921
+ try {
922
+ if (_window && _window[attr] && typeof _window[attr].length === "number") {
923
+ return _window[attr];
924
+ }
925
+ } catch (err) {
926
+ }
927
+ browserStorageConfig[key] = false;
928
+ }
929
+ function iterateBrowserStorage(key, callback) {
930
+ const func = getBrowserStorage(key);
931
+ if (!func) {
932
+ return;
933
+ }
934
+ const version = getStoredItem(func, browserCacheVersionKey);
935
+ if (version !== browserCacheVersion) {
936
+ if (version) {
937
+ const total2 = getBrowserStorageItemsCount(func);
938
+ for (let i = 0; i < total2; i++) {
939
+ removeStoredItem(func, browserCachePrefix + i.toString());
940
+ }
941
+ }
942
+ setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
943
+ setBrowserStorageItemsCount(func, 0);
944
+ return;
945
+ }
946
+ const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
947
+ const parseItem = (index) => {
948
+ const name = browserCachePrefix + index.toString();
949
+ const item = getStoredItem(func, name);
950
+ if (typeof item !== "string") {
951
+ return;
952
+ }
953
+ try {
954
+ const data = JSON.parse(item);
955
+ if (typeof data === "object" && typeof data.cached === "number" && data.cached > minTime && typeof data.provider === "string" && typeof data.data === "object" && typeof data.data.prefix === "string" && // Valid item: run callback
956
+ callback(data, index)) {
957
+ return true;
958
+ }
959
+ } catch (err) {
960
+ }
961
+ removeStoredItem(func, name);
962
+ };
963
+ let total = getBrowserStorageItemsCount(func);
964
+ for (let i = total - 1; i >= 0; i--) {
965
+ if (!parseItem(i)) {
966
+ if (i === total - 1) {
967
+ total--;
968
+ setBrowserStorageItemsCount(func, total);
969
+ } else {
970
+ browserStorageEmptyItems[key].add(i);
971
+ }
972
+ }
973
+ }
974
+ }
975
+ function initBrowserStorage() {
976
+ if (browserStorageStatus) {
977
+ return;
978
+ }
979
+ setBrowserStorageStatus(true);
980
+ for (const key in browserStorageConfig) {
981
+ iterateBrowserStorage(key, (item) => {
982
+ const iconSet = item.data;
983
+ const provider = item.provider;
984
+ const prefix = iconSet.prefix;
985
+ const storage2 = getStorage(
986
+ provider,
987
+ prefix
988
+ );
989
+ if (!addIconSet(storage2, iconSet).length) {
990
+ return false;
991
+ }
992
+ const lastModified = iconSet.lastModified || -1;
993
+ storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
994
+ return true;
995
+ });
996
+ }
997
+ }
998
+ function updateLastModified(storage2, lastModified) {
999
+ const lastValue = storage2.lastModifiedCached;
1000
+ if (
1001
+ // Matches or newer
1002
+ lastValue && lastValue >= lastModified
1003
+ ) {
1004
+ return lastValue === lastModified;
1005
+ }
1006
+ storage2.lastModifiedCached = lastModified;
1007
+ if (lastValue) {
1008
+ for (const key in browserStorageConfig) {
1009
+ iterateBrowserStorage(key, (item) => {
1010
+ const iconSet = item.data;
1011
+ return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
1012
+ });
1013
+ }
1014
+ }
1015
+ return true;
1016
+ }
1017
+ function storeInBrowserStorage(storage2, data) {
1018
+ if (!browserStorageStatus) {
1019
+ initBrowserStorage();
1020
+ }
1021
+ function store(key) {
1022
+ let func;
1023
+ if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
1024
+ return;
1025
+ }
1026
+ const set = browserStorageEmptyItems[key];
1027
+ let index;
1028
+ if (set.size) {
1029
+ set.delete(index = Array.from(set).shift());
1030
+ } else {
1031
+ index = getBrowserStorageItemsCount(func);
1032
+ if (index >= browserStorageLimit || !setBrowserStorageItemsCount(func, index + 1)) {
1033
+ return;
1034
+ }
1035
+ }
1036
+ const item = {
1037
+ cached: Math.floor(Date.now() / browserStorageHour),
1038
+ provider: storage2.provider,
1039
+ data
1040
+ };
1041
+ return setStoredItem(
1042
+ func,
1043
+ browserCachePrefix + index.toString(),
1044
+ JSON.stringify(item)
1045
+ );
1046
+ }
1047
+ if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
1048
+ return;
1049
+ }
1050
+ if (!Object.keys(data.icons).length) {
1051
+ return;
1052
+ }
1053
+ if (data.not_found) {
1054
+ data = Object.assign({}, data);
1055
+ delete data.not_found;
1056
+ }
1057
+ if (!store("local")) {
1058
+ store("session");
1059
+ }
1060
+ }
1061
+ function emptyCallback() {
1062
+ }
1063
+ function loadedNewIcons(storage2) {
1064
+ if (!storage2.iconsLoaderFlag) {
1065
+ storage2.iconsLoaderFlag = true;
1066
+ setTimeout(() => {
1067
+ storage2.iconsLoaderFlag = false;
1068
+ updateCallbacks(storage2);
1069
+ });
1070
+ }
1071
+ }
1072
+ function loadNewIcons(storage2, icons) {
1073
+ if (!storage2.iconsToLoad) {
1074
+ storage2.iconsToLoad = icons;
1075
+ } else {
1076
+ storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
1077
+ }
1078
+ if (!storage2.iconsQueueFlag) {
1079
+ storage2.iconsQueueFlag = true;
1080
+ setTimeout(() => {
1081
+ storage2.iconsQueueFlag = false;
1082
+ const { provider, prefix } = storage2;
1083
+ const icons2 = storage2.iconsToLoad;
1084
+ delete storage2.iconsToLoad;
1085
+ let api;
1086
+ if (!icons2 || !(api = getAPIModule(provider))) {
1087
+ return;
1088
+ }
1089
+ const params = api.prepare(provider, prefix, icons2);
1090
+ params.forEach((item) => {
1091
+ sendAPIQuery(provider, item, (data) => {
1092
+ if (typeof data !== "object") {
1093
+ item.icons.forEach((name) => {
1094
+ storage2.missing.add(name);
1095
+ });
1096
+ } else {
1097
+ try {
1098
+ const parsed = addIconSet(
1099
+ storage2,
1100
+ data
1101
+ );
1102
+ if (!parsed.length) {
1103
+ return;
1104
+ }
1105
+ const pending = storage2.pendingIcons;
1106
+ if (pending) {
1107
+ parsed.forEach((name) => {
1108
+ pending.delete(name);
1109
+ });
1110
+ }
1111
+ storeInBrowserStorage(storage2, data);
1112
+ } catch (err) {
1113
+ console.error(err);
1114
+ }
1115
+ }
1116
+ loadedNewIcons(storage2);
1117
+ });
1118
+ });
1119
+ });
1120
+ }
1121
+ }
1122
+ const loadIcons$1 = (icons, callback) => {
1123
+ const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
1124
+ const sortedIcons = sortIcons(cleanedIcons);
1125
+ if (!sortedIcons.pending.length) {
1126
+ let callCallback = true;
1127
+ if (callback) {
1128
+ setTimeout(() => {
1129
+ if (callCallback) {
1130
+ callback(
1131
+ sortedIcons.loaded,
1132
+ sortedIcons.missing,
1133
+ sortedIcons.pending,
1134
+ emptyCallback
1135
+ );
1136
+ }
1137
+ });
1138
+ }
1139
+ return () => {
1140
+ callCallback = false;
1141
+ };
1142
+ }
1143
+ const newIcons = /* @__PURE__ */ Object.create(null);
1144
+ const sources = [];
1145
+ let lastProvider, lastPrefix;
1146
+ sortedIcons.pending.forEach((icon) => {
1147
+ const { provider, prefix } = icon;
1148
+ if (prefix === lastPrefix && provider === lastProvider) {
1149
+ return;
1150
+ }
1151
+ lastProvider = provider;
1152
+ lastPrefix = prefix;
1153
+ sources.push(getStorage(provider, prefix));
1154
+ const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
1155
+ if (!providerNewIcons[prefix]) {
1156
+ providerNewIcons[prefix] = [];
1157
+ }
1158
+ });
1159
+ sortedIcons.pending.forEach((icon) => {
1160
+ const { provider, prefix, name } = icon;
1161
+ const storage2 = getStorage(provider, prefix);
1162
+ const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
1163
+ if (!pendingQueue.has(name)) {
1164
+ pendingQueue.add(name);
1165
+ newIcons[provider][prefix].push(name);
1166
+ }
1167
+ });
1168
+ sources.forEach((storage2) => {
1169
+ const { provider, prefix } = storage2;
1170
+ if (newIcons[provider][prefix].length) {
1171
+ loadNewIcons(storage2, newIcons[provider][prefix]);
1172
+ }
1173
+ });
1174
+ return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
1175
+ };
1176
+ const loadIcon$1 = (icon) => {
1177
+ return new Promise((fulfill, reject) => {
1178
+ const iconObj = typeof icon === "string" ? stringToIcon(icon, true) : icon;
1179
+ if (!iconObj) {
1180
+ reject(icon);
1181
+ return;
1182
+ }
1183
+ loadIcons$1([iconObj || icon], (loaded) => {
1184
+ if (loaded.length && iconObj) {
1185
+ const data = getIconData(iconObj);
1186
+ if (data) {
1187
+ fulfill({
1188
+ ...defaultIconProps,
1189
+ ...data
1190
+ });
1191
+ return;
1192
+ }
1193
+ }
1194
+ reject(icon);
1195
+ });
1196
+ });
1197
+ };
1198
+ function testIconObject(value) {
1199
+ try {
1200
+ const obj = typeof value === "string" ? JSON.parse(value) : value;
1201
+ if (typeof obj.body === "string") {
1202
+ return {
1203
+ ...obj
1204
+ };
1205
+ }
1206
+ } catch (err) {
1207
+ }
1208
+ }
1209
+ function parseIconValue(value, onload) {
1210
+ const name = typeof value === "string" ? stringToIcon(value, true, true) : null;
1211
+ if (!name) {
1212
+ const data2 = testIconObject(value);
1213
+ return {
1214
+ value,
1215
+ data: data2
1216
+ };
1217
+ }
1218
+ const data = getIconData(name);
1219
+ if (data !== void 0 || !name.prefix) {
1220
+ return {
1221
+ value,
1222
+ name,
1223
+ data
1224
+ // could be 'null' -> icon is missing
1225
+ };
1226
+ }
1227
+ const loading = loadIcons$1([name], () => onload(value, name, getIconData(name)));
1228
+ return {
1229
+ value,
1230
+ name,
1231
+ loading
1232
+ };
1233
+ }
1234
+ let isBuggedSafari = false;
1235
+ try {
1236
+ isBuggedSafari = navigator.vendor.indexOf("Apple") === 0;
1237
+ } catch (err) {
1238
+ }
1239
+ function getRenderMode(body, mode) {
1240
+ switch (mode) {
1241
+ case "svg":
1242
+ case "bg":
1243
+ case "mask":
1244
+ return mode;
1245
+ }
1246
+ if (mode !== "style" && (isBuggedSafari || body.indexOf("<a") === -1)) {
1247
+ return "svg";
1248
+ }
1249
+ return body.indexOf("currentColor") === -1 ? "bg" : "mask";
1250
+ }
1251
+ const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
1252
+ const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
1253
+ function calculateSize$1(size, ratio, precision) {
1254
+ if (ratio === 1) {
1255
+ return size;
1256
+ }
1257
+ precision = precision || 100;
1258
+ if (typeof size === "number") {
1259
+ return Math.ceil(size * ratio * precision) / precision;
1260
+ }
1261
+ if (typeof size !== "string") {
1262
+ return size;
1263
+ }
1264
+ const oldParts = size.split(unitsSplit);
1265
+ if (oldParts === null || !oldParts.length) {
1266
+ return size;
1267
+ }
1268
+ const newParts = [];
1269
+ let code = oldParts.shift();
1270
+ let isNumber = unitsTest.test(code);
1271
+ while (true) {
1272
+ if (isNumber) {
1273
+ const num = parseFloat(code);
1274
+ if (isNaN(num)) {
1275
+ newParts.push(code);
1276
+ } else {
1277
+ newParts.push(Math.ceil(num * ratio * precision) / precision);
1278
+ }
1279
+ } else {
1280
+ newParts.push(code);
1281
+ }
1282
+ code = oldParts.shift();
1283
+ if (code === void 0) {
1284
+ return newParts.join("");
1285
+ }
1286
+ isNumber = !isNumber;
1287
+ }
1288
+ }
1289
+ function splitSVGDefs(content, tag = "defs") {
1290
+ let defs = "";
1291
+ const index = content.indexOf("<" + tag);
1292
+ while (index >= 0) {
1293
+ const start = content.indexOf(">", index);
1294
+ const end = content.indexOf("</" + tag);
1295
+ if (start === -1 || end === -1) {
1296
+ break;
1297
+ }
1298
+ const endEnd = content.indexOf(">", end);
1299
+ if (endEnd === -1) {
1300
+ break;
1301
+ }
1302
+ defs += content.slice(start + 1, end).trim();
1303
+ content = content.slice(0, index).trim() + content.slice(endEnd + 1);
1304
+ }
1305
+ return {
1306
+ defs,
1307
+ content
1308
+ };
1309
+ }
1310
+ function mergeDefsAndContent(defs, content) {
1311
+ return defs ? "<defs>" + defs + "</defs>" + content : content;
1312
+ }
1313
+ function wrapSVGContent(body, start, end) {
1314
+ const split = splitSVGDefs(body);
1315
+ return mergeDefsAndContent(split.defs, start + split.content + end);
1316
+ }
1317
+ const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
1318
+ function iconToSVG(icon, customisations) {
1319
+ const fullIcon = {
1320
+ ...defaultIconProps,
1321
+ ...icon
1322
+ };
1323
+ const fullCustomisations = {
1324
+ ...defaultIconCustomisations,
1325
+ ...customisations
1326
+ };
1327
+ const box = {
1328
+ left: fullIcon.left,
1329
+ top: fullIcon.top,
1330
+ width: fullIcon.width,
1331
+ height: fullIcon.height
1332
+ };
1333
+ let body = fullIcon.body;
1334
+ [fullIcon, fullCustomisations].forEach((props) => {
1335
+ const transformations = [];
1336
+ const hFlip = props.hFlip;
1337
+ const vFlip = props.vFlip;
1338
+ let rotation = props.rotate;
1339
+ if (hFlip) {
1340
+ if (vFlip) {
1341
+ rotation += 2;
1342
+ } else {
1343
+ transformations.push(
1344
+ "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
1345
+ );
1346
+ transformations.push("scale(-1 1)");
1347
+ box.top = box.left = 0;
1348
+ }
1349
+ } else if (vFlip) {
1350
+ transformations.push(
1351
+ "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
1352
+ );
1353
+ transformations.push("scale(1 -1)");
1354
+ box.top = box.left = 0;
1355
+ }
1356
+ let tempValue;
1357
+ if (rotation < 0) {
1358
+ rotation -= Math.floor(rotation / 4) * 4;
1359
+ }
1360
+ rotation = rotation % 4;
1361
+ switch (rotation) {
1362
+ case 1:
1363
+ tempValue = box.height / 2 + box.top;
1364
+ transformations.unshift(
1365
+ "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
1366
+ );
1367
+ break;
1368
+ case 2:
1369
+ transformations.unshift(
1370
+ "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
1371
+ );
1372
+ break;
1373
+ case 3:
1374
+ tempValue = box.width / 2 + box.left;
1375
+ transformations.unshift(
1376
+ "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
1377
+ );
1378
+ break;
1379
+ }
1380
+ if (rotation % 2 === 1) {
1381
+ if (box.left !== box.top) {
1382
+ tempValue = box.left;
1383
+ box.left = box.top;
1384
+ box.top = tempValue;
1385
+ }
1386
+ if (box.width !== box.height) {
1387
+ tempValue = box.width;
1388
+ box.width = box.height;
1389
+ box.height = tempValue;
1390
+ }
1391
+ }
1392
+ if (transformations.length) {
1393
+ body = wrapSVGContent(
1394
+ body,
1395
+ '<g transform="' + transformations.join(" ") + '">',
1396
+ "</g>"
1397
+ );
1398
+ }
1399
+ });
1400
+ const customisationsWidth = fullCustomisations.width;
1401
+ const customisationsHeight = fullCustomisations.height;
1402
+ const boxWidth = box.width;
1403
+ const boxHeight = box.height;
1404
+ let width;
1405
+ let height;
1406
+ if (customisationsWidth === null) {
1407
+ height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
1408
+ width = calculateSize$1(height, boxWidth / boxHeight);
1409
+ } else {
1410
+ width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
1411
+ height = customisationsHeight === null ? calculateSize$1(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
1412
+ }
1413
+ const attributes = {};
1414
+ const setAttr = (prop, value) => {
1415
+ if (!isUnsetKeyword(value)) {
1416
+ attributes[prop] = value.toString();
1417
+ }
1418
+ };
1419
+ setAttr("width", width);
1420
+ setAttr("height", height);
1421
+ const viewBox = [box.left, box.top, boxWidth, boxHeight];
1422
+ attributes.viewBox = viewBox.join(" ");
1423
+ return {
1424
+ attributes,
1425
+ viewBox,
1426
+ body
1427
+ };
1428
+ }
1429
+ function iconToHTML$1(body, attributes) {
1430
+ let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
1431
+ for (const attr in attributes) {
1432
+ renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
1433
+ }
1434
+ return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
1435
+ }
1436
+ function encodeSVGforURL(svg) {
1437
+ return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
1438
+ }
1439
+ function svgToData(svg) {
1440
+ return "data:image/svg+xml," + encodeSVGforURL(svg);
1441
+ }
1442
+ function svgToURL$1(svg) {
1443
+ return 'url("' + svgToData(svg) + '")';
1444
+ }
1445
+ const detectFetch = () => {
1446
+ let callback;
1447
+ try {
1448
+ callback = fetch;
1449
+ if (typeof callback === "function") {
1450
+ return callback;
1451
+ }
1452
+ } catch (err) {
1453
+ }
1454
+ };
1455
+ let fetchModule = detectFetch();
1456
+ function setFetch(fetch2) {
1457
+ fetchModule = fetch2;
1458
+ }
1459
+ function getFetch() {
1460
+ return fetchModule;
1461
+ }
1462
+ function calculateMaxLength(provider, prefix) {
1463
+ const config = getAPIConfig(provider);
1464
+ if (!config) {
1465
+ return 0;
1466
+ }
1467
+ let result;
1468
+ if (!config.maxURL) {
1469
+ result = 0;
1470
+ } else {
1471
+ let maxHostLength = 0;
1472
+ config.resources.forEach((item) => {
1473
+ const host = item;
1474
+ maxHostLength = Math.max(maxHostLength, host.length);
1475
+ });
1476
+ const url = prefix + ".json?icons=";
1477
+ result = config.maxURL - maxHostLength - config.path.length - url.length;
1478
+ }
1479
+ return result;
1480
+ }
1481
+ function shouldAbort(status) {
1482
+ return status === 404;
1483
+ }
1484
+ const prepare = (provider, prefix, icons) => {
1485
+ const results = [];
1486
+ const maxLength = calculateMaxLength(provider, prefix);
1487
+ const type = "icons";
1488
+ let item = {
1489
+ type,
1490
+ provider,
1491
+ prefix,
1492
+ icons: []
1493
+ };
1494
+ let length = 0;
1495
+ icons.forEach((name, index) => {
1496
+ length += name.length + 1;
1497
+ if (length >= maxLength && index > 0) {
1498
+ results.push(item);
1499
+ item = {
1500
+ type,
1501
+ provider,
1502
+ prefix,
1503
+ icons: []
1504
+ };
1505
+ length = name.length;
1506
+ }
1507
+ item.icons.push(name);
1508
+ });
1509
+ results.push(item);
1510
+ return results;
1511
+ };
1512
+ function getPath(provider) {
1513
+ if (typeof provider === "string") {
1514
+ const config = getAPIConfig(provider);
1515
+ if (config) {
1516
+ return config.path;
1517
+ }
1518
+ }
1519
+ return "/";
1520
+ }
1521
+ const send = (host, params, callback) => {
1522
+ if (!fetchModule) {
1523
+ callback("abort", 424);
1524
+ return;
1525
+ }
1526
+ let path = getPath(params.provider);
1527
+ switch (params.type) {
1528
+ case "icons": {
1529
+ const prefix = params.prefix;
1530
+ const icons = params.icons;
1531
+ const iconsList = icons.join(",");
1532
+ const urlParams = new URLSearchParams({
1533
+ icons: iconsList
1534
+ });
1535
+ path += prefix + ".json?" + urlParams.toString();
1536
+ break;
1537
+ }
1538
+ case "custom": {
1539
+ const uri = params.uri;
1540
+ path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
1541
+ break;
1542
+ }
1543
+ default:
1544
+ callback("abort", 400);
1545
+ return;
1546
+ }
1547
+ let defaultError = 503;
1548
+ fetchModule(host + path).then((response) => {
1549
+ const status = response.status;
1550
+ if (status !== 200) {
1551
+ setTimeout(() => {
1552
+ callback(shouldAbort(status) ? "abort" : "next", status);
1553
+ });
1554
+ return;
1555
+ }
1556
+ defaultError = 501;
1557
+ return response.json();
1558
+ }).then((data) => {
1559
+ if (typeof data !== "object" || data === null) {
1560
+ setTimeout(() => {
1561
+ if (data === 404) {
1562
+ callback("abort", data);
1563
+ } else {
1564
+ callback("next", defaultError);
1565
+ }
1566
+ });
1567
+ return;
1568
+ }
1569
+ setTimeout(() => {
1570
+ callback("success", data);
1571
+ });
1572
+ }).catch(() => {
1573
+ callback("next", defaultError);
1574
+ });
1575
+ };
1576
+ const fetchAPIModule = {
1577
+ prepare,
1578
+ send
1579
+ };
1580
+ function toggleBrowserCache(storage2, value) {
1581
+ switch (storage2) {
1582
+ case "local":
1583
+ case "session":
1584
+ browserStorageConfig[storage2] = value;
1585
+ break;
1586
+ case "all":
1587
+ for (const key in browserStorageConfig) {
1588
+ browserStorageConfig[key] = value;
1589
+ }
1590
+ break;
1591
+ }
1592
+ }
1593
+ const nodeAttr = "data-style";
1594
+ let customStyle = "";
1595
+ function appendCustomStyle(style) {
1596
+ customStyle = style;
1597
+ }
1598
+ function updateStyle(parent, inline) {
1599
+ let styleNode = Array.from(parent.childNodes).find((node) => node.hasAttribute && node.hasAttribute(nodeAttr));
1600
+ if (!styleNode) {
1601
+ styleNode = document.createElement("style");
1602
+ styleNode.setAttribute(nodeAttr, nodeAttr);
1603
+ parent.appendChild(styleNode);
1604
+ }
1605
+ styleNode.textContent = ":host{display:inline-block;vertical-align:" + (inline ? "-0.125em" : "0") + "}span,svg{display:block}" + customStyle;
1606
+ }
1607
+ function exportFunctions() {
1608
+ setAPIModule("", fetchAPIModule);
1609
+ allowSimpleNames(true);
1610
+ let _window2;
1611
+ try {
1612
+ _window2 = window;
1613
+ } catch (err) {
1614
+ }
1615
+ if (_window2) {
1616
+ initBrowserStorage();
1617
+ if (_window2.IconifyPreload !== void 0) {
1618
+ const preload = _window2.IconifyPreload;
1619
+ const err = "Invalid IconifyPreload syntax.";
1620
+ if (typeof preload === "object" && preload !== null) {
1621
+ (preload instanceof Array ? preload : [preload]).forEach((item) => {
1622
+ try {
1623
+ if (
1624
+ // Check if item is an object and not null/array
1625
+ typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
1626
+ typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
1627
+ !addCollection$1(item)
1628
+ ) {
1629
+ console.error(err);
1630
+ }
1631
+ } catch (e) {
1632
+ console.error(err);
1633
+ }
1634
+ });
1635
+ }
1636
+ }
1637
+ if (_window2.IconifyProviders !== void 0) {
1638
+ const providers = _window2.IconifyProviders;
1639
+ if (typeof providers === "object" && providers !== null) {
1640
+ for (const key in providers) {
1641
+ const err = "IconifyProviders[" + key + "] is invalid.";
1642
+ try {
1643
+ const value = providers[key];
1644
+ if (typeof value !== "object" || !value || value.resources === void 0) {
1645
+ continue;
1646
+ }
1647
+ if (!addAPIProvider$1(key, value)) {
1648
+ console.error(err);
1649
+ }
1650
+ } catch (e) {
1651
+ console.error(err);
1652
+ }
1653
+ }
1654
+ }
1655
+ }
1656
+ }
1657
+ const _api = {
1658
+ getAPIConfig,
1659
+ setAPIModule,
1660
+ sendAPIQuery,
1661
+ setFetch,
1662
+ getFetch,
1663
+ listAPIProviders
1664
+ };
1665
+ return {
1666
+ enableCache: (storage2) => toggleBrowserCache(storage2, true),
1667
+ disableCache: (storage2) => toggleBrowserCache(storage2, false),
1668
+ iconLoaded: iconLoaded$1,
1669
+ iconExists: iconLoaded$1,
1670
+ // deprecated, kept to avoid breaking changes
1671
+ getIcon: getIcon$1,
1672
+ listIcons: listIcons$1,
1673
+ addIcon: addIcon$1,
1674
+ addCollection: addCollection$1,
1675
+ calculateSize: calculateSize$1,
1676
+ buildIcon: iconToSVG,
1677
+ iconToHTML: iconToHTML$1,
1678
+ svgToURL: svgToURL$1,
1679
+ loadIcons: loadIcons$1,
1680
+ loadIcon: loadIcon$1,
1681
+ addAPIProvider: addAPIProvider$1,
1682
+ appendCustomStyle,
1683
+ _api
1684
+ };
1685
+ }
1686
+ const monotoneProps = {
1687
+ "background-color": "currentColor"
1688
+ };
1689
+ const coloredProps = {
1690
+ "background-color": "transparent"
1691
+ };
1692
+ const propsToAdd = {
1693
+ image: "var(--svg)",
1694
+ repeat: "no-repeat",
1695
+ size: "100% 100%"
1696
+ };
1697
+ const propsToAddTo = {
1698
+ "-webkit-mask": monotoneProps,
1699
+ "mask": monotoneProps,
1700
+ "background": coloredProps
1701
+ };
1702
+ for (const prefix in propsToAddTo) {
1703
+ const list = propsToAddTo[prefix];
1704
+ for (const prop in propsToAdd) {
1705
+ list[prefix + "-" + prop] = propsToAdd[prop];
1706
+ }
1707
+ }
1708
+ function fixSize(value) {
1709
+ return value ? value + (value.match(/^[-0-9.]+$/) ? "px" : "") : "inherit";
1710
+ }
1711
+ function renderSPAN(data, icon, useMask) {
1712
+ const node = document.createElement("span");
1713
+ let body = data.body;
1714
+ if (body.indexOf("<a") !== -1) {
1715
+ body += "<!-- " + Date.now() + " -->";
1716
+ }
1717
+ const renderAttribs = data.attributes;
1718
+ const html = iconToHTML$1(body, {
1719
+ ...renderAttribs,
1720
+ width: icon.width + "",
1721
+ height: icon.height + ""
1722
+ });
1723
+ const url = svgToURL$1(html);
1724
+ const svgStyle = node.style;
1725
+ const styles = {
1726
+ "--svg": url,
1727
+ "width": fixSize(renderAttribs.width),
1728
+ "height": fixSize(renderAttribs.height),
1729
+ ...useMask ? monotoneProps : coloredProps
1730
+ };
1731
+ for (const prop in styles) {
1732
+ svgStyle.setProperty(prop, styles[prop]);
1733
+ }
1734
+ return node;
1735
+ }
1736
+ let policy;
1737
+ function createPolicy() {
1738
+ try {
1739
+ policy = window.trustedTypes.createPolicy("iconify", {
1740
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
1741
+ createHTML: (s) => s
1742
+ });
1743
+ } catch (err) {
1744
+ policy = null;
1745
+ }
1746
+ }
1747
+ function cleanUpInnerHTML(html) {
1748
+ if (policy === void 0) {
1749
+ createPolicy();
1750
+ }
1751
+ return policy ? policy.createHTML(html) : html;
1752
+ }
1753
+ function renderSVG(data) {
1754
+ const node = document.createElement("span");
1755
+ const attr = data.attributes;
1756
+ let style = "";
1757
+ if (!attr.width) {
1758
+ style = "width: inherit;";
1759
+ }
1760
+ if (!attr.height) {
1761
+ style += "height: inherit;";
1762
+ }
1763
+ if (style) {
1764
+ attr.style = style;
1765
+ }
1766
+ const html = iconToHTML$1(data.body, attr);
1767
+ node.innerHTML = cleanUpInnerHTML(html);
1768
+ return node.firstChild;
1769
+ }
1770
+ function findIconElement(parent) {
1771
+ return Array.from(parent.childNodes).find((node) => {
1772
+ const tag = node.tagName && node.tagName.toUpperCase();
1773
+ return tag === "SPAN" || tag === "SVG";
1774
+ });
1775
+ }
1776
+ function renderIcon(parent, state) {
1777
+ const iconData = state.icon.data;
1778
+ const customisations = state.customisations;
1779
+ const renderData = iconToSVG(iconData, customisations);
1780
+ if (customisations.preserveAspectRatio) {
1781
+ renderData.attributes["preserveAspectRatio"] = customisations.preserveAspectRatio;
1782
+ }
1783
+ const mode = state.renderedMode;
1784
+ let node;
1785
+ switch (mode) {
1786
+ case "svg":
1787
+ node = renderSVG(renderData);
1788
+ break;
1789
+ default:
1790
+ node = renderSPAN(renderData, {
1791
+ ...defaultIconProps,
1792
+ ...iconData
1793
+ }, mode === "mask");
1794
+ }
1795
+ const oldNode = findIconElement(parent);
1796
+ if (oldNode) {
1797
+ if (node.tagName === "SPAN" && oldNode.tagName === node.tagName) {
1798
+ oldNode.setAttribute("style", node.getAttribute("style"));
1799
+ } else {
1800
+ parent.replaceChild(node, oldNode);
1801
+ }
1802
+ } else {
1803
+ parent.appendChild(node);
1804
+ }
1805
+ }
1806
+ function setPendingState(icon, inline, lastState) {
1807
+ const lastRender = lastState && (lastState.rendered ? lastState : lastState.lastRender);
1808
+ return {
1809
+ rendered: false,
1810
+ inline,
1811
+ icon,
1812
+ lastRender
1813
+ };
1814
+ }
1815
+ function defineIconifyIcon(name = "iconify-icon") {
1816
+ let customElements;
1817
+ let ParentClass;
1818
+ try {
1819
+ customElements = window.customElements;
1820
+ ParentClass = window.HTMLElement;
1821
+ } catch (err) {
1822
+ return;
1823
+ }
1824
+ if (!customElements || !ParentClass) {
1825
+ return;
1826
+ }
1827
+ const ConflictingClass = customElements.get(name);
1828
+ if (ConflictingClass) {
1829
+ return ConflictingClass;
1830
+ }
1831
+ const attributes = [
1832
+ // Icon
1833
+ "icon",
1834
+ // Mode
1835
+ "mode",
1836
+ "inline",
1837
+ "noobserver",
1838
+ // Customisations
1839
+ "width",
1840
+ "height",
1841
+ "rotate",
1842
+ "flip"
1843
+ ];
1844
+ const IconifyIcon = class extends ParentClass {
1845
+ /**
1846
+ * Constructor
1847
+ */
1848
+ constructor() {
1849
+ super();
1850
+ // Root
1851
+ __publicField(this, "_shadowRoot");
1852
+ // Initialised
1853
+ __publicField(this, "_initialised", false);
1854
+ // Icon state
1855
+ __publicField(this, "_state");
1856
+ // Attributes check queued
1857
+ __publicField(this, "_checkQueued", false);
1858
+ // Connected
1859
+ __publicField(this, "_connected", false);
1860
+ // Observer
1861
+ __publicField(this, "_observer", null);
1862
+ __publicField(this, "_visible", true);
1863
+ const root = this._shadowRoot = this.attachShadow({
1864
+ mode: "open"
1865
+ });
1866
+ const inline = this.hasAttribute("inline");
1867
+ updateStyle(root, inline);
1868
+ this._state = setPendingState({
1869
+ value: ""
1870
+ }, inline);
1871
+ this._queueCheck();
1872
+ }
1873
+ /**
1874
+ * Connected to DOM
1875
+ */
1876
+ connectedCallback() {
1877
+ this._connected = true;
1878
+ this.startObserver();
1879
+ }
1880
+ /**
1881
+ * Disconnected from DOM
1882
+ */
1883
+ disconnectedCallback() {
1884
+ this._connected = false;
1885
+ this.stopObserver();
1886
+ }
1887
+ /**
1888
+ * Observed attributes
1889
+ */
1890
+ static get observedAttributes() {
1891
+ return attributes.slice(0);
1892
+ }
1893
+ /**
1894
+ * Observed properties that are different from attributes
1895
+ *
1896
+ * Experimental! Need to test with various frameworks that support it
1897
+ */
1898
+ /*
1899
+ static get properties() {
1900
+ return {
1901
+ inline: {
1902
+ type: Boolean,
1903
+ reflect: true,
1904
+ },
1905
+ // Not listing other attributes because they are strings or combination
1906
+ // of string and another type. Cannot have multiple types
1907
+ };
1908
+ }
1909
+ */
1910
+ /**
1911
+ * Attribute has changed
1912
+ */
1913
+ attributeChangedCallback(name2) {
1914
+ switch (name2) {
1915
+ case "inline": {
1916
+ const newInline = this.hasAttribute("inline");
1917
+ const state = this._state;
1918
+ if (newInline !== state.inline) {
1919
+ state.inline = newInline;
1920
+ updateStyle(this._shadowRoot, newInline);
1921
+ }
1922
+ break;
1923
+ }
1924
+ case "noobserver": {
1925
+ const value = this.hasAttribute("noobserver");
1926
+ if (value) {
1927
+ this.startObserver();
1928
+ } else {
1929
+ this.stopObserver();
1930
+ }
1931
+ break;
1932
+ }
1933
+ default:
1934
+ this._queueCheck();
1935
+ }
1936
+ }
1937
+ /**
1938
+ * Get/set icon
1939
+ */
1940
+ get icon() {
1941
+ const value = this.getAttribute("icon");
1942
+ if (value && value.slice(0, 1) === "{") {
1943
+ try {
1944
+ return JSON.parse(value);
1945
+ } catch (err) {
1946
+ }
1947
+ }
1948
+ return value;
1949
+ }
1950
+ set icon(value) {
1951
+ if (typeof value === "object") {
1952
+ value = JSON.stringify(value);
1953
+ }
1954
+ this.setAttribute("icon", value);
1955
+ }
1956
+ /**
1957
+ * Get/set inline
1958
+ */
1959
+ get inline() {
1960
+ return this.hasAttribute("inline");
1961
+ }
1962
+ set inline(value) {
1963
+ if (value) {
1964
+ this.setAttribute("inline", "true");
1965
+ } else {
1966
+ this.removeAttribute("inline");
1967
+ }
1968
+ }
1969
+ /**
1970
+ * Get/set observer
1971
+ */
1972
+ get observer() {
1973
+ return this.hasAttribute("observer");
1974
+ }
1975
+ set observer(value) {
1976
+ if (value) {
1977
+ this.setAttribute("observer", "true");
1978
+ } else {
1979
+ this.removeAttribute("observer");
1980
+ }
1981
+ }
1982
+ /**
1983
+ * Restart animation
1984
+ */
1985
+ restartAnimation() {
1986
+ const state = this._state;
1987
+ if (state.rendered) {
1988
+ const root = this._shadowRoot;
1989
+ if (state.renderedMode === "svg") {
1990
+ try {
1991
+ root.lastChild.setCurrentTime(0);
1992
+ return;
1993
+ } catch (err) {
1994
+ }
1995
+ }
1996
+ renderIcon(root, state);
1997
+ }
1998
+ }
1999
+ /**
2000
+ * Get status
2001
+ */
2002
+ get status() {
2003
+ const state = this._state;
2004
+ return state.rendered ? "rendered" : state.icon.data === null ? "failed" : "loading";
2005
+ }
2006
+ /**
2007
+ * Queue attributes re-check
2008
+ */
2009
+ _queueCheck() {
2010
+ if (!this._checkQueued) {
2011
+ this._checkQueued = true;
2012
+ setTimeout(() => {
2013
+ this._check();
2014
+ });
2015
+ }
2016
+ }
2017
+ /**
2018
+ * Check for changes
2019
+ */
2020
+ _check() {
2021
+ if (!this._checkQueued) {
2022
+ return;
2023
+ }
2024
+ this._checkQueued = false;
2025
+ const state = this._state;
2026
+ const newIcon = this.getAttribute("icon");
2027
+ if (newIcon !== state.icon.value) {
2028
+ this._iconChanged(newIcon);
2029
+ return;
2030
+ }
2031
+ if (!state.rendered || !this._visible) {
2032
+ return;
2033
+ }
2034
+ const mode = this.getAttribute("mode");
2035
+ const customisations = getCustomisations(this);
2036
+ if (state.attrMode !== mode || haveCustomisationsChanged(state.customisations, customisations) || !findIconElement(this._shadowRoot)) {
2037
+ this._renderIcon(state.icon, customisations, mode);
2038
+ }
2039
+ }
2040
+ /**
2041
+ * Icon value has changed
2042
+ */
2043
+ _iconChanged(newValue) {
2044
+ const icon = parseIconValue(newValue, (value, name2, data) => {
2045
+ const state = this._state;
2046
+ if (state.rendered || this.getAttribute("icon") !== value) {
2047
+ return;
2048
+ }
2049
+ const icon2 = {
2050
+ value,
2051
+ name: name2,
2052
+ data
2053
+ };
2054
+ if (icon2.data) {
2055
+ this._gotIconData(icon2);
2056
+ } else {
2057
+ state.icon = icon2;
2058
+ }
2059
+ });
2060
+ if (icon.data) {
2061
+ this._gotIconData(icon);
2062
+ } else {
2063
+ this._state = setPendingState(icon, this._state.inline, this._state);
2064
+ }
2065
+ }
2066
+ /**
2067
+ * Force render icon on state change
2068
+ */
2069
+ _forceRender() {
2070
+ if (!this._visible) {
2071
+ const node = findIconElement(this._shadowRoot);
2072
+ if (node) {
2073
+ this._shadowRoot.removeChild(node);
2074
+ }
2075
+ return;
2076
+ }
2077
+ this._queueCheck();
2078
+ }
2079
+ /**
2080
+ * Got new icon data, icon is ready to (re)render
2081
+ */
2082
+ _gotIconData(icon) {
2083
+ this._checkQueued = false;
2084
+ this._renderIcon(icon, getCustomisations(this), this.getAttribute("mode"));
2085
+ }
2086
+ /**
2087
+ * Re-render based on icon data
2088
+ */
2089
+ _renderIcon(icon, customisations, attrMode) {
2090
+ const renderedMode = getRenderMode(icon.data.body, attrMode);
2091
+ const inline = this._state.inline;
2092
+ renderIcon(this._shadowRoot, this._state = {
2093
+ rendered: true,
2094
+ icon,
2095
+ inline,
2096
+ customisations,
2097
+ attrMode,
2098
+ renderedMode
2099
+ });
2100
+ }
2101
+ /**
2102
+ * Start observer
2103
+ */
2104
+ startObserver() {
2105
+ if (!this._observer && !this.hasAttribute("noobserver")) {
2106
+ try {
2107
+ this._observer = new IntersectionObserver((entries) => {
2108
+ const intersecting = entries.some((entry) => entry.isIntersecting);
2109
+ if (intersecting !== this._visible) {
2110
+ this._visible = intersecting;
2111
+ this._forceRender();
2112
+ }
2113
+ });
2114
+ this._observer.observe(this);
2115
+ } catch (err) {
2116
+ if (this._observer) {
2117
+ try {
2118
+ this._observer.disconnect();
2119
+ } catch (err2) {
2120
+ }
2121
+ this._observer = null;
2122
+ }
2123
+ }
2124
+ }
2125
+ }
2126
+ /**
2127
+ * Stop observer
2128
+ */
2129
+ stopObserver() {
2130
+ if (this._observer) {
2131
+ this._observer.disconnect();
2132
+ this._observer = null;
2133
+ this._visible = true;
2134
+ if (this._connected) {
2135
+ this._forceRender();
2136
+ }
2137
+ }
2138
+ }
2139
+ };
2140
+ attributes.forEach((attr) => {
2141
+ if (!(attr in IconifyIcon.prototype)) {
2142
+ Object.defineProperty(IconifyIcon.prototype, attr, {
2143
+ get: function() {
2144
+ return this.getAttribute(attr);
2145
+ },
2146
+ set: function(value) {
2147
+ if (value !== null) {
2148
+ this.setAttribute(attr, value);
2149
+ } else {
2150
+ this.removeAttribute(attr);
2151
+ }
2152
+ }
2153
+ });
2154
+ }
2155
+ });
2156
+ const functions = exportFunctions();
2157
+ for (const key in functions) {
2158
+ IconifyIcon[key] = IconifyIcon.prototype[key] = functions[key];
2159
+ }
2160
+ customElements.define(name, IconifyIcon);
2161
+ return IconifyIcon;
2162
+ }
2163
+ defineIconifyIcon() || exportFunctions();
2164
+ const _sfc_main = /* @__PURE__ */ defineComponent({
2165
+ ...{
2166
+ name: "PIcon"
2167
+ },
2168
+ __name: "p-icon",
2169
+ props: {
2170
+ icon: {}
2171
+ },
2172
+ setup(__props) {
2173
+ const isPIcon = (icon) => !!P_ICON_ALIASES[icon];
2174
+ return (_ctx, _cache) => {
2175
+ return openBlock(), createElementBlock("iconify-icon", normalizeProps(guardReactiveProps({ ..._ctx.$props, icon: isPIcon(_ctx.icon) ? unref(P_ICON_ALIASES)[_ctx.icon] : _ctx.icon })), null, 16);
2176
+ };
2177
+ }
2178
+ });
2179
+ export {
2180
+ _sfc_main as _
2181
+ };