@ttoss/components 2.1.5 → 2.2.0

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