@ttoss/components 2.2.16 → 2.2.17

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