@ttoss/ui 1.29.0 → 1.30.1

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