@knime/kds-components 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/KdsIcon-VyfE1YXh.js +596 -0
  3. package/dist/KdsIcon-VyfE1YXh.js.map +1 -0
  4. package/dist/KdsIcon.css +64 -0
  5. package/dist/{KdsPopover-DBU9xVEK.js → KdsPopover-FOQyEkHj.js} +3 -9
  6. package/dist/{KdsPopover-DBU9xVEK.js.map → KdsPopover-FOQyEkHj.js.map} +1 -1
  7. package/dist/_plugin-vue_export-helper-BOaGB7Aw.js +8 -0
  8. package/dist/{collection-set-datatype-CjK0E8Js.js → collection-set-datatype-DUmEUGg4.js} +2 -2
  9. package/dist/{collection-set-datatype-CjK0E8Js.js.map → collection-set-datatype-DUmEUGg4.js.map} +1 -1
  10. package/dist/index.css +626 -9
  11. package/dist/index.js +3918 -577
  12. package/dist/index.js.map +1 -1
  13. package/dist/src/components/forms/inputs/SearchInput/KdsSearchInput.vue.d.ts.map +1 -1
  14. package/dist/src/components/lists/ListContainer/KdsListContainer.vue.d.ts.map +1 -1
  15. package/dist/src/components/lists/ListContainer/types.d.ts +0 -5
  16. package/dist/src/components/lists/ListContainer/types.d.ts.map +1 -1
  17. package/dist/src/components/lists/MenuContainer/KdsMenuContainer.vue.d.ts.map +1 -1
  18. package/dist/src/components/lists/MenuContainer/types.d.ts +0 -5
  19. package/dist/src/components/lists/MenuContainer/types.d.ts.map +1 -1
  20. package/package.json +7 -4
  21. package/dist/overlays-Bai-I-gc.js +0 -3953
  22. package/dist/overlays-Bai-I-gc.js.map +0 -1
  23. package/dist/overlays.css +0 -681
  24. package/dist/src/util/types.d.ts +0 -20
  25. package/dist/src/util/types.d.ts.map +0 -1
  26. package/dist/src/util/useListItemKeyboardNav.d.ts +0 -32
  27. package/dist/src/util/useListItemKeyboardNav.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { a as kdsPopoverRole, c as kdsPopoverTypes, i as kdsPopoverPlacements, l as _plugin_vue_export_helper_default, o as kdsPopoverRoles, r as kdsPopoverPlacement, s as kdsPopoverType, t as KdsPopover_default, u as __exportAll } from "./KdsPopover-DBU9xVEK.js";
2
- import { C as KdsIcon_default, D as useKdsIsTruncated, E as elementOverflowsHorizontally, S as hotkeys, T as vKdsTooltip, _ as KdsButton_default, a as BaseCheckbox_default, b as formatFileSize, c as KdsModalLayout_default, d as kdsModalHeight, f as kdsModalHeightSizes, g as kdsModalWidthSizes, h as kdsModalWidth, i as KdsCheckbox_default, l as kdsModalClosedBy, m as kdsModalVariants, n as KdsDynamicModalProvider_default, o as KdsSubText_default, p as kdsModalVariant, r as useKdsDynamicModal, s as KdsModal_default, t as KdsSideDrawer_default, u as kdsModalClosedByOptions, v as BaseButton_default, w as useIcon, x as getMetaOrCtrlKey, y as KdsLoadingSpinner_default } from "./overlays-Bai-I-gc.js";
1
+ import { a as kdsPopoverRole, c as kdsPopoverTypes, i as kdsPopoverPlacements, l as __exportAll$1, o as kdsPopoverRoles, r as kdsPopoverPlacement, s as kdsPopoverType, t as KdsPopover_default } from "./KdsPopover-FOQyEkHj.js";
2
+ import { a as useKdsIsTruncated, i as elementOverflowsHorizontally, n as useIcon, r as vKdsTooltip, t as KdsIcon_default } from "./KdsIcon-VyfE1YXh.js";
3
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BOaGB7Aw.js";
3
4
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createPropsRestProxy, createSlots, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onUnmounted, openBlock, provide, readonly, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, unref, useAttrs, useCssVars, useId, useModel, useSlots, useTemplateRef, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
4
5
  import { onClickOutside, useDark, useElementSize, useLocalStorage, useMousePressed, usePreferredDark, useResizeObserver, useTemplateRefsList, useVirtualList } from "@vueuse/core";
5
6
  import './index.css';//#region src/components/accessories/Avatar/enums.ts
@@ -12,14 +13,14 @@ var kdsAvatarSize = {
12
13
  var kdsAvatarSizes = Object.values(kdsAvatarSize);
13
14
  //#endregion
14
15
  //#region src/components/accessories/Avatar/KdsAvatar.vue?vue&type=script&setup=true&lang.ts
15
- var _hoisted_1$71 = [
16
+ var _hoisted_1$79 = [
16
17
  "role",
17
18
  "aria-hidden",
18
19
  "aria-label",
19
20
  "data-color"
20
21
  ];
21
- var _hoisted_2$44 = ["src"];
22
- var _hoisted_3$31 = {
22
+ var _hoisted_2$48 = ["src"];
23
+ var _hoisted_3$34 = {
23
24
  key: 1,
24
25
  class: "kds-avatar-initials",
25
26
  "aria-hidden": "true"
@@ -79,15 +80,15 @@ var KdsAvatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
79
80
  alt: "",
80
81
  "aria-hidden": "true",
81
82
  onError: onImageError
82
- }, null, 40, _hoisted_2$44)) : (openBlock(), createElementBlock("div", _hoisted_3$31, [createElementVNode("span", null, toDisplayString(displayedInitials.value), 1)]))], 10, _hoisted_1$71)), [[unref(vKdsTooltip), hasTitle.value ? accessibleTitle.value : void 0]]);
83
+ }, null, 40, _hoisted_2$48)) : (openBlock(), createElementBlock("div", _hoisted_3$34, [createElementVNode("span", null, toDisplayString(displayedInitials.value), 1)]))], 10, _hoisted_1$79)), [[unref(vKdsTooltip), hasTitle.value ? accessibleTitle.value : void 0]]);
83
84
  };
84
85
  }
85
86
  }), [["__scopeId", "data-v-1cc8bb54"]]);
86
87
  //#endregion
87
88
  //#region src/components/accessories/Avatar/KdsAvatarCounter.vue?vue&type=script&setup=true&lang.ts
88
- var _hoisted_1$70 = ["aria-label"];
89
- var _hoisted_2$43 = { class: "avatars" };
90
- var _hoisted_3$30 = {
89
+ var _hoisted_1$78 = ["aria-label"];
90
+ var _hoisted_2$47 = { class: "avatars" };
91
+ var _hoisted_3$33 = {
91
92
  key: 0,
92
93
  class: "more-count",
93
94
  "aria-hidden": "true"
@@ -117,7 +118,7 @@ var KdsAvatarCounter_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
117
118
  class: "kds-avatar-counter",
118
119
  role: "group",
119
120
  "aria-label": ariaLabel.value
120
- }, [createElementVNode("div", _hoisted_2$43, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.avatars, (avatar, index) => {
121
+ }, [createElementVNode("div", _hoisted_2$47, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.avatars, (avatar, index) => {
121
122
  return openBlock(), createBlock(KdsAvatar_default, {
122
123
  key: index,
123
124
  "aria-hidden": "true",
@@ -134,7 +135,7 @@ var KdsAvatarCounter_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
134
135
  "tooltip",
135
136
  "src"
136
137
  ]);
137
- }), 128))]), __props.moreCount > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$30, " +" + toDisplayString(__props.moreCount), 1)) : createCommentVNode("", true)], 8, _hoisted_1$70);
138
+ }), 128))]), __props.moreCount > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$33, " +" + toDisplayString(__props.moreCount), 1)) : createCommentVNode("", true)], 8, _hoisted_1$78);
138
139
  };
139
140
  }
140
141
  }), [["__scopeId", "data-v-ac6925b6"]]);
@@ -482,7 +483,7 @@ var kdsDataTypeSize = {
482
483
  var kdsDataTypeSizes = Object.values(kdsDataTypeSize);
483
484
  //#endregion
484
485
  //#region src/components/accessories/Icon/KdsDataType.vue?vue&type=script&setup=true&lang.ts
485
- var _hoisted_1$69 = ["data-kds-icon-name"];
486
+ var _hoisted_1$77 = ["data-kds-icon-name"];
486
487
  //#endregion
487
488
  //#region src/components/accessories/Icon/KdsDataType.vue
488
489
  var KdsDataType_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -539,7 +540,7 @@ var KdsDataType_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
539
540
  ]),
540
541
  "aria-hidden": "true",
541
542
  focusable: "false"
542
- }, null, 8, ["class"]))], 10, _hoisted_1$69)), [[unref(vKdsTooltip), __props.iconTitle]]);
543
+ }, null, 8, ["class"]))], 10, _hoisted_1$77)), [[unref(vKdsTooltip), __props.iconTitle]]);
543
544
  };
544
545
  }
545
546
  }), [["__scopeId", "data-v-c908ab99"]]);
@@ -561,7 +562,7 @@ var kdsBadgeSize = {
561
562
  var kdsBadgeSizes = Object.values(kdsBadgeSize);
562
563
  //#endregion
563
564
  //#region src/components/accessories/Badge/KdsBadge.vue?vue&type=script&setup=true&lang.ts
564
- var _hoisted_1$68 = { class: "label-wrapper" };
565
+ var _hoisted_1$76 = { class: "label-wrapper" };
565
566
  //#endregion
566
567
  //#region src/components/accessories/Badge/KdsBadge.vue
567
568
  var KdsBadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -586,7 +587,7 @@ var KdsBadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
586
587
  key: 0,
587
588
  name: __props.leadingIcon,
588
589
  size: sizeToIconSize[__props.size]
589
- }, null, 8, ["name", "size"])) : createCommentVNode("", true), createElementVNode("span", _hoisted_1$68, toDisplayString(__props.label), 1)], 2);
590
+ }, null, 8, ["name", "size"])) : createCommentVNode("", true), createElementVNode("span", _hoisted_1$76, toDisplayString(__props.label), 1)], 2);
590
591
  };
591
592
  }
592
593
  }), [["__scopeId", "data-v-ed7689bb"]]);
@@ -6583,7 +6584,7 @@ var kdsColorSwatchSize = {
6583
6584
  var kdsColorSwatchSizes = Object.values(kdsColorSwatchSize);
6584
6585
  //#endregion
6585
6586
  //#region src/components/accessories/ColorSwatch/KdsColorSwatch.vue?vue&type=script&setup=true&lang.ts
6586
- var _hoisted_1$67 = [
6587
+ var _hoisted_1$75 = [
6587
6588
  "role",
6588
6589
  "aria-hidden",
6589
6590
  "aria-label"
@@ -6658,7 +6659,7 @@ var KdsColorSwatch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
6658
6659
  style: normalizeStyle(swatchStyle.value),
6659
6660
  "aria-hidden": hasTitle.value ? void 0 : "true",
6660
6661
  "aria-label": hasTitle.value ? accessibleTitle.value : void 0
6661
- }, null, 14, _hoisted_1$67)), [[unref(vKdsTooltip), hasTitle.value ? accessibleTitle.value : void 0]]);
6662
+ }, null, 14, _hoisted_1$75)), [[unref(vKdsTooltip), hasTitle.value ? accessibleTitle.value : void 0]]);
6662
6663
  };
6663
6664
  }
6664
6665
  }), [["__scopeId", "data-v-2f562103"]]);
@@ -6668,17 +6669,17 @@ var PORT_SIZE = 8;
6668
6669
  var PORT_STROKE_WIDTH = 1.4;
6669
6670
  //#endregion
6670
6671
  //#region src/components/accessories/PortIcon/KdsPortIcon.vue?vue&type=script&setup=true&lang.ts
6671
- var _hoisted_1$66 = [
6672
+ var _hoisted_1$74 = [
6672
6673
  "points",
6673
6674
  "data-type",
6674
6675
  "stroke-width"
6675
6676
  ];
6676
- var _hoisted_2$42 = [
6677
+ var _hoisted_2$46 = [
6677
6678
  "r",
6678
6679
  "data-type",
6679
6680
  "stroke-width"
6680
6681
  ];
6681
- var _hoisted_3$29 = [
6682
+ var _hoisted_3$32 = [
6682
6683
  "width",
6683
6684
  "height",
6684
6685
  "x",
@@ -6738,13 +6739,13 @@ var KdsPortIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
6738
6739
  class: normalizeClass({ optional: __props.optional }),
6739
6740
  "data-type": __props.type,
6740
6741
  "stroke-width": unref(PORT_STROKE_WIDTH)
6741
- }, null, 10, _hoisted_1$66)) : __props.type === "flowVariable" ? (openBlock(), createElementBlock("circle", {
6742
+ }, null, 10, _hoisted_1$74)) : __props.type === "flowVariable" ? (openBlock(), createElementBlock("circle", {
6742
6743
  key: 1,
6743
6744
  r: unref(8) / 2 - unref(PORT_STROKE_WIDTH) / 2,
6744
6745
  class: normalizeClass({ optional: __props.optional }),
6745
6746
  "data-type": __props.type,
6746
6747
  "stroke-width": unref(PORT_STROKE_WIDTH)
6747
- }, null, 10, _hoisted_2$42)) : (openBlock(), createElementBlock("rect", {
6748
+ }, null, 10, _hoisted_2$46)) : (openBlock(), createElementBlock("rect", {
6748
6749
  key: 2,
6749
6750
  width: unref(8) - unref(PORT_STROKE_WIDTH),
6750
6751
  height: unref(8) - unref(PORT_STROKE_WIDTH),
@@ -6753,7 +6754,7 @@ var KdsPortIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
6753
6754
  class: normalizeClass({ optional: __props.optional }),
6754
6755
  "data-type": __props.type,
6755
6756
  "stroke-width": unref(PORT_STROKE_WIDTH)
6756
- }, null, 10, _hoisted_3$29))]),
6757
+ }, null, 10, _hoisted_3$32))]),
6757
6758
  _: 1
6758
6759
  }, 16);
6759
6760
  };
@@ -6769,415 +6770,3772 @@ var kdsPortType = {
6769
6770
  };
6770
6771
  var kdsPortTypes = Object.values(kdsPortType);
6771
6772
  //#endregion
6773
+ //#region ../../node_modules/.pnpm/pretty-bytes@7.1.0/node_modules/pretty-bytes/index.js
6774
+ var BYTE_UNITS = [
6775
+ "B",
6776
+ "kB",
6777
+ "MB",
6778
+ "GB",
6779
+ "TB",
6780
+ "PB",
6781
+ "EB",
6782
+ "ZB",
6783
+ "YB"
6784
+ ];
6785
+ var BIBYTE_UNITS = [
6786
+ "B",
6787
+ "KiB",
6788
+ "MiB",
6789
+ "GiB",
6790
+ "TiB",
6791
+ "PiB",
6792
+ "EiB",
6793
+ "ZiB",
6794
+ "YiB"
6795
+ ];
6796
+ var BIT_UNITS = [
6797
+ "b",
6798
+ "kbit",
6799
+ "Mbit",
6800
+ "Gbit",
6801
+ "Tbit",
6802
+ "Pbit",
6803
+ "Ebit",
6804
+ "Zbit",
6805
+ "Ybit"
6806
+ ];
6807
+ var BIBIT_UNITS = [
6808
+ "b",
6809
+ "kibit",
6810
+ "Mibit",
6811
+ "Gibit",
6812
+ "Tibit",
6813
+ "Pibit",
6814
+ "Eibit",
6815
+ "Zibit",
6816
+ "Yibit"
6817
+ ];
6818
+ var toLocaleString = (number, locale, options) => {
6819
+ let result = number;
6820
+ if (typeof locale === "string" || Array.isArray(locale)) result = number.toLocaleString(locale, options);
6821
+ else if (locale === true || options !== void 0) result = number.toLocaleString(void 0, options);
6822
+ return result;
6823
+ };
6824
+ var log10 = (numberOrBigInt) => {
6825
+ if (typeof numberOrBigInt === "number") return Math.log10(numberOrBigInt);
6826
+ const string = numberOrBigInt.toString(10);
6827
+ return string.length + Math.log10(`0.${string.slice(0, 15)}`);
6828
+ };
6829
+ var log = (numberOrBigInt) => {
6830
+ if (typeof numberOrBigInt === "number") return Math.log(numberOrBigInt);
6831
+ return log10(numberOrBigInt) * Math.log(10);
6832
+ };
6833
+ var divide = (numberOrBigInt, divisor) => {
6834
+ if (typeof numberOrBigInt === "number") return numberOrBigInt / divisor;
6835
+ const integerPart = numberOrBigInt / BigInt(divisor);
6836
+ const remainder = numberOrBigInt % BigInt(divisor);
6837
+ return Number(integerPart) + Number(remainder) / divisor;
6838
+ };
6839
+ var applyFixedWidth = (result, fixedWidth) => {
6840
+ if (fixedWidth === void 0) return result;
6841
+ if (typeof fixedWidth !== "number" || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
6842
+ if (fixedWidth === 0) return result;
6843
+ return result.length < fixedWidth ? result.padStart(fixedWidth, " ") : result;
6844
+ };
6845
+ var buildLocaleOptions = (options) => {
6846
+ const { minimumFractionDigits, maximumFractionDigits } = options;
6847
+ if (minimumFractionDigits === void 0 && maximumFractionDigits === void 0) return;
6848
+ return {
6849
+ ...minimumFractionDigits !== void 0 && { minimumFractionDigits },
6850
+ ...maximumFractionDigits !== void 0 && { maximumFractionDigits },
6851
+ roundingMode: "trunc"
6852
+ };
6853
+ };
6854
+ function prettyBytes(number, options) {
6855
+ if (typeof number !== "bigint" && !Number.isFinite(number)) throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
6856
+ options = {
6857
+ bits: false,
6858
+ binary: false,
6859
+ space: true,
6860
+ nonBreakingSpace: false,
6861
+ ...options
6862
+ };
6863
+ const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
6864
+ const separator = options.space ? options.nonBreakingSpace ? "\xA0" : " " : "";
6865
+ const isZero = typeof number === "number" ? number === 0 : number === 0n;
6866
+ if (options.signed && isZero) return applyFixedWidth(` 0${separator}${UNITS[0]}`, options.fixedWidth);
6867
+ const isNegative = number < 0;
6868
+ const prefix = isNegative ? "-" : options.signed ? "+" : "";
6869
+ if (isNegative) number = -number;
6870
+ const localeOptions = buildLocaleOptions(options);
6871
+ let result;
6872
+ if (number < 1) result = prefix + toLocaleString(number, options.locale, localeOptions) + separator + UNITS[0];
6873
+ else {
6874
+ const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
6875
+ number = divide(number, (options.binary ? 1024 : 1e3) ** exponent);
6876
+ if (!localeOptions) {
6877
+ const minPrecision = Math.max(3, Math.floor(number).toString().length);
6878
+ number = number.toPrecision(minPrecision);
6879
+ }
6880
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
6881
+ const unit = UNITS[exponent];
6882
+ result = prefix + numberString + separator + unit;
6883
+ }
6884
+ return applyFixedWidth(result, options.fixedWidth);
6885
+ }
6886
+ //#endregion
6887
+ //#region ../../node_modules/.pnpm/dompurify@3.4.11/node_modules/dompurify/dist/purify.es.mjs
6888
+ /*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */
6889
+ function _arrayLikeToArray(r, a) {
6890
+ (null == a || a > r.length) && (a = r.length);
6891
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6892
+ return n;
6893
+ }
6894
+ function _arrayWithHoles(r) {
6895
+ if (Array.isArray(r)) return r;
6896
+ }
6897
+ function _iterableToArrayLimit(r, l) {
6898
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
6899
+ if (null != t) {
6900
+ var e, n, i, u, a = [], f = true, o = false;
6901
+ try {
6902
+ if (i = (t = t.call(r)).next, 0 === l);
6903
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
6904
+ } catch (r) {
6905
+ o = true, n = r;
6906
+ } finally {
6907
+ try {
6908
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
6909
+ } finally {
6910
+ if (o) throw n;
6911
+ }
6912
+ }
6913
+ return a;
6914
+ }
6915
+ }
6916
+ function _nonIterableRest() {
6917
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6918
+ }
6919
+ function _slicedToArray(r, e) {
6920
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
6921
+ }
6922
+ function _unsupportedIterableToArray(r, a) {
6923
+ if (r) {
6924
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
6925
+ var t = {}.toString.call(r).slice(8, -1);
6926
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
6927
+ }
6928
+ }
6929
+ var entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
6930
+ var freeze = Object.freeze, seal = Object.seal, create$1 = Object.create;
6931
+ var _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
6932
+ if (!freeze) freeze = function freeze(x) {
6933
+ return x;
6934
+ };
6935
+ if (!seal) seal = function seal(x) {
6936
+ return x;
6937
+ };
6938
+ if (!apply) apply = function apply(func, thisArg) {
6939
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
6940
+ return func.apply(thisArg, args);
6941
+ };
6942
+ if (!construct) construct = function construct(Func) {
6943
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
6944
+ return new Func(...args);
6945
+ };
6946
+ var arrayForEach = unapply(Array.prototype.forEach);
6947
+ var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
6948
+ var arrayPop = unapply(Array.prototype.pop);
6949
+ var arrayPush = unapply(Array.prototype.push);
6950
+ var arraySplice = unapply(Array.prototype.splice);
6951
+ var arrayIsArray = Array.isArray;
6952
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
6953
+ var stringToString = unapply(String.prototype.toString);
6954
+ var stringMatch = unapply(String.prototype.match);
6955
+ var stringReplace = unapply(String.prototype.replace);
6956
+ var stringIndexOf = unapply(String.prototype.indexOf);
6957
+ var stringTrim = unapply(String.prototype.trim);
6958
+ var numberToString = unapply(Number.prototype.toString);
6959
+ var booleanToString = unapply(Boolean.prototype.toString);
6960
+ var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
6961
+ var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
6962
+ var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
6963
+ var objectToString = unapply(Object.prototype.toString);
6964
+ var regExpTest = unapply(RegExp.prototype.test);
6965
+ var typeErrorCreate = unconstruct(TypeError);
6966
+ /**
6967
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
6968
+ *
6969
+ * @param func - The function to be wrapped and called.
6970
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
6971
+ */
6972
+ function unapply(func) {
6973
+ return function(thisArg) {
6974
+ if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
6975
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
6976
+ return apply(func, thisArg, args);
6977
+ };
6978
+ }
6979
+ /**
6980
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
6981
+ *
6982
+ * @param func - The constructor function to be wrapped and called.
6983
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
6984
+ */
6985
+ function unconstruct(Func) {
6986
+ return function() {
6987
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
6988
+ return construct(Func, args);
6989
+ };
6990
+ }
6991
+ /**
6992
+ * Add properties to a lookup table
6993
+ *
6994
+ * @param set - The set to which elements will be added.
6995
+ * @param array - The array containing elements to be added to the set.
6996
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
6997
+ * @returns The modified set with added elements.
6998
+ */
6999
+ function addToSet(set, array) {
7000
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
7001
+ if (setPrototypeOf) setPrototypeOf(set, null);
7002
+ if (!arrayIsArray(array)) return set;
7003
+ let l = array.length;
7004
+ while (l--) {
7005
+ let element = array[l];
7006
+ if (typeof element === "string") {
7007
+ const lcElement = transformCaseFunc(element);
7008
+ if (lcElement !== element) {
7009
+ if (!isFrozen(array)) array[l] = lcElement;
7010
+ element = lcElement;
7011
+ }
7012
+ }
7013
+ set[element] = true;
7014
+ }
7015
+ return set;
7016
+ }
7017
+ /**
7018
+ * Clean up an array to harden against CSPP
7019
+ *
7020
+ * @param array - The array to be cleaned.
7021
+ * @returns The cleaned version of the array
7022
+ */
7023
+ function cleanArray(array) {
7024
+ for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
7025
+ return array;
7026
+ }
7027
+ /**
7028
+ * Shallow clone an object
7029
+ *
7030
+ * @param object - The object to be cloned.
7031
+ * @returns A new object that copies the original.
7032
+ */
7033
+ function clone(object) {
7034
+ const newObject = create$1(null);
7035
+ for (const _ref2 of entries(object)) {
7036
+ var _ref3 = _slicedToArray(_ref2, 2);
7037
+ const property = _ref3[0];
7038
+ const value = _ref3[1];
7039
+ if (objectHasOwnProperty(object, property)) if (arrayIsArray(value)) newObject[property] = cleanArray(value);
7040
+ else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
7041
+ else newObject[property] = value;
7042
+ }
7043
+ return newObject;
7044
+ }
7045
+ /**
7046
+ * Convert non-node values into strings without depending on direct property access.
7047
+ *
7048
+ * @param value - The value to stringify.
7049
+ * @returns A string representation of the provided value.
7050
+ */
7051
+ function stringifyValue(value) {
7052
+ switch (typeof value) {
7053
+ case "string": return value;
7054
+ case "number": return numberToString(value);
7055
+ case "boolean": return booleanToString(value);
7056
+ case "bigint": return bigintToString ? bigintToString(value) : "0";
7057
+ case "symbol": return symbolToString ? symbolToString(value) : "Symbol()";
7058
+ case "undefined": return objectToString(value);
7059
+ case "function":
7060
+ case "object": {
7061
+ if (value === null) return objectToString(value);
7062
+ const valueAsRecord = value;
7063
+ const valueToString = lookupGetter(valueAsRecord, "toString");
7064
+ if (typeof valueToString === "function") {
7065
+ const stringified = valueToString(valueAsRecord);
7066
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
7067
+ }
7068
+ return objectToString(value);
7069
+ }
7070
+ default: return objectToString(value);
7071
+ }
7072
+ }
7073
+ /**
7074
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
7075
+ *
7076
+ * @param object - The object to look up the getter function in its prototype chain.
7077
+ * @param prop - The property name for which to find the getter function.
7078
+ * @returns The getter function found in the prototype chain or a fallback function.
7079
+ */
7080
+ function lookupGetter(object, prop) {
7081
+ while (object !== null) {
7082
+ const desc = getOwnPropertyDescriptor(object, prop);
7083
+ if (desc) {
7084
+ if (desc.get) return unapply(desc.get);
7085
+ if (typeof desc.value === "function") return unapply(desc.value);
7086
+ }
7087
+ object = getPrototypeOf(object);
7088
+ }
7089
+ function fallbackValue() {
7090
+ return null;
7091
+ }
7092
+ return fallbackValue;
7093
+ }
7094
+ function isRegex(value) {
7095
+ try {
7096
+ regExpTest(value, "");
7097
+ return true;
7098
+ } catch (_unused) {
7099
+ return false;
7100
+ }
7101
+ }
7102
+ var html$1 = freeze([
7103
+ "a",
7104
+ "abbr",
7105
+ "acronym",
7106
+ "address",
7107
+ "area",
7108
+ "article",
7109
+ "aside",
7110
+ "audio",
7111
+ "b",
7112
+ "bdi",
7113
+ "bdo",
7114
+ "big",
7115
+ "blink",
7116
+ "blockquote",
7117
+ "body",
7118
+ "br",
7119
+ "button",
7120
+ "canvas",
7121
+ "caption",
7122
+ "center",
7123
+ "cite",
7124
+ "code",
7125
+ "col",
7126
+ "colgroup",
7127
+ "content",
7128
+ "data",
7129
+ "datalist",
7130
+ "dd",
7131
+ "decorator",
7132
+ "del",
7133
+ "details",
7134
+ "dfn",
7135
+ "dialog",
7136
+ "dir",
7137
+ "div",
7138
+ "dl",
7139
+ "dt",
7140
+ "element",
7141
+ "em",
7142
+ "fieldset",
7143
+ "figcaption",
7144
+ "figure",
7145
+ "font",
7146
+ "footer",
7147
+ "form",
7148
+ "h1",
7149
+ "h2",
7150
+ "h3",
7151
+ "h4",
7152
+ "h5",
7153
+ "h6",
7154
+ "head",
7155
+ "header",
7156
+ "hgroup",
7157
+ "hr",
7158
+ "html",
7159
+ "i",
7160
+ "img",
7161
+ "input",
7162
+ "ins",
7163
+ "kbd",
7164
+ "label",
7165
+ "legend",
7166
+ "li",
7167
+ "main",
7168
+ "map",
7169
+ "mark",
7170
+ "marquee",
7171
+ "menu",
7172
+ "menuitem",
7173
+ "meter",
7174
+ "nav",
7175
+ "nobr",
7176
+ "ol",
7177
+ "optgroup",
7178
+ "option",
7179
+ "output",
7180
+ "p",
7181
+ "picture",
7182
+ "pre",
7183
+ "progress",
7184
+ "q",
7185
+ "rp",
7186
+ "rt",
7187
+ "ruby",
7188
+ "s",
7189
+ "samp",
7190
+ "search",
7191
+ "section",
7192
+ "select",
7193
+ "shadow",
7194
+ "slot",
7195
+ "small",
7196
+ "source",
7197
+ "spacer",
7198
+ "span",
7199
+ "strike",
7200
+ "strong",
7201
+ "style",
7202
+ "sub",
7203
+ "summary",
7204
+ "sup",
7205
+ "table",
7206
+ "tbody",
7207
+ "td",
7208
+ "template",
7209
+ "textarea",
7210
+ "tfoot",
7211
+ "th",
7212
+ "thead",
7213
+ "time",
7214
+ "tr",
7215
+ "track",
7216
+ "tt",
7217
+ "u",
7218
+ "ul",
7219
+ "var",
7220
+ "video",
7221
+ "wbr"
7222
+ ]);
7223
+ var svg$1 = freeze([
7224
+ "svg",
7225
+ "a",
7226
+ "altglyph",
7227
+ "altglyphdef",
7228
+ "altglyphitem",
7229
+ "animatecolor",
7230
+ "animatemotion",
7231
+ "animatetransform",
7232
+ "circle",
7233
+ "clippath",
7234
+ "defs",
7235
+ "desc",
7236
+ "ellipse",
7237
+ "enterkeyhint",
7238
+ "exportparts",
7239
+ "filter",
7240
+ "font",
7241
+ "g",
7242
+ "glyph",
7243
+ "glyphref",
7244
+ "hkern",
7245
+ "image",
7246
+ "inputmode",
7247
+ "line",
7248
+ "lineargradient",
7249
+ "marker",
7250
+ "mask",
7251
+ "metadata",
7252
+ "mpath",
7253
+ "part",
7254
+ "path",
7255
+ "pattern",
7256
+ "polygon",
7257
+ "polyline",
7258
+ "radialgradient",
7259
+ "rect",
7260
+ "stop",
7261
+ "style",
7262
+ "switch",
7263
+ "symbol",
7264
+ "text",
7265
+ "textpath",
7266
+ "title",
7267
+ "tref",
7268
+ "tspan",
7269
+ "view",
7270
+ "vkern"
7271
+ ]);
7272
+ var svgFilters = freeze([
7273
+ "feBlend",
7274
+ "feColorMatrix",
7275
+ "feComponentTransfer",
7276
+ "feComposite",
7277
+ "feConvolveMatrix",
7278
+ "feDiffuseLighting",
7279
+ "feDisplacementMap",
7280
+ "feDistantLight",
7281
+ "feDropShadow",
7282
+ "feFlood",
7283
+ "feFuncA",
7284
+ "feFuncB",
7285
+ "feFuncG",
7286
+ "feFuncR",
7287
+ "feGaussianBlur",
7288
+ "feImage",
7289
+ "feMerge",
7290
+ "feMergeNode",
7291
+ "feMorphology",
7292
+ "feOffset",
7293
+ "fePointLight",
7294
+ "feSpecularLighting",
7295
+ "feSpotLight",
7296
+ "feTile",
7297
+ "feTurbulence"
7298
+ ]);
7299
+ var svgDisallowed = freeze([
7300
+ "animate",
7301
+ "color-profile",
7302
+ "cursor",
7303
+ "discard",
7304
+ "font-face",
7305
+ "font-face-format",
7306
+ "font-face-name",
7307
+ "font-face-src",
7308
+ "font-face-uri",
7309
+ "foreignobject",
7310
+ "hatch",
7311
+ "hatchpath",
7312
+ "mesh",
7313
+ "meshgradient",
7314
+ "meshpatch",
7315
+ "meshrow",
7316
+ "missing-glyph",
7317
+ "script",
7318
+ "set",
7319
+ "solidcolor",
7320
+ "unknown",
7321
+ "use"
7322
+ ]);
7323
+ var mathMl$1 = freeze([
7324
+ "math",
7325
+ "menclose",
7326
+ "merror",
7327
+ "mfenced",
7328
+ "mfrac",
7329
+ "mglyph",
7330
+ "mi",
7331
+ "mlabeledtr",
7332
+ "mmultiscripts",
7333
+ "mn",
7334
+ "mo",
7335
+ "mover",
7336
+ "mpadded",
7337
+ "mphantom",
7338
+ "mroot",
7339
+ "mrow",
7340
+ "ms",
7341
+ "mspace",
7342
+ "msqrt",
7343
+ "mstyle",
7344
+ "msub",
7345
+ "msup",
7346
+ "msubsup",
7347
+ "mtable",
7348
+ "mtd",
7349
+ "mtext",
7350
+ "mtr",
7351
+ "munder",
7352
+ "munderover",
7353
+ "mprescripts"
7354
+ ]);
7355
+ var mathMlDisallowed = freeze([
7356
+ "maction",
7357
+ "maligngroup",
7358
+ "malignmark",
7359
+ "mlongdiv",
7360
+ "mscarries",
7361
+ "mscarry",
7362
+ "msgroup",
7363
+ "mstack",
7364
+ "msline",
7365
+ "msrow",
7366
+ "semantics",
7367
+ "annotation",
7368
+ "annotation-xml",
7369
+ "mprescripts",
7370
+ "none"
7371
+ ]);
7372
+ var text = freeze(["#text"]);
7373
+ var html = freeze([
7374
+ "accept",
7375
+ "action",
7376
+ "align",
7377
+ "alt",
7378
+ "autocapitalize",
7379
+ "autocomplete",
7380
+ "autopictureinpicture",
7381
+ "autoplay",
7382
+ "background",
7383
+ "bgcolor",
7384
+ "border",
7385
+ "capture",
7386
+ "cellpadding",
7387
+ "cellspacing",
7388
+ "checked",
7389
+ "cite",
7390
+ "class",
7391
+ "clear",
7392
+ "color",
7393
+ "cols",
7394
+ "colspan",
7395
+ "command",
7396
+ "commandfor",
7397
+ "controls",
7398
+ "controlslist",
7399
+ "coords",
7400
+ "crossorigin",
7401
+ "datetime",
7402
+ "decoding",
7403
+ "default",
7404
+ "dir",
7405
+ "disabled",
7406
+ "disablepictureinpicture",
7407
+ "disableremoteplayback",
7408
+ "download",
7409
+ "draggable",
7410
+ "enctype",
7411
+ "enterkeyhint",
7412
+ "exportparts",
7413
+ "face",
7414
+ "for",
7415
+ "headers",
7416
+ "height",
7417
+ "hidden",
7418
+ "high",
7419
+ "href",
7420
+ "hreflang",
7421
+ "id",
7422
+ "inert",
7423
+ "inputmode",
7424
+ "integrity",
7425
+ "ismap",
7426
+ "kind",
7427
+ "label",
7428
+ "lang",
7429
+ "list",
7430
+ "loading",
7431
+ "loop",
7432
+ "low",
7433
+ "max",
7434
+ "maxlength",
7435
+ "media",
7436
+ "method",
7437
+ "min",
7438
+ "minlength",
7439
+ "multiple",
7440
+ "muted",
7441
+ "name",
7442
+ "nonce",
7443
+ "noshade",
7444
+ "novalidate",
7445
+ "nowrap",
7446
+ "open",
7447
+ "optimum",
7448
+ "part",
7449
+ "pattern",
7450
+ "placeholder",
7451
+ "playsinline",
7452
+ "popover",
7453
+ "popovertarget",
7454
+ "popovertargetaction",
7455
+ "poster",
7456
+ "preload",
7457
+ "pubdate",
7458
+ "radiogroup",
7459
+ "readonly",
7460
+ "rel",
7461
+ "required",
7462
+ "rev",
7463
+ "reversed",
7464
+ "role",
7465
+ "rows",
7466
+ "rowspan",
7467
+ "spellcheck",
7468
+ "scope",
7469
+ "selected",
7470
+ "shape",
7471
+ "size",
7472
+ "sizes",
7473
+ "slot",
7474
+ "span",
7475
+ "srclang",
7476
+ "start",
7477
+ "src",
7478
+ "srcset",
7479
+ "step",
7480
+ "style",
7481
+ "summary",
7482
+ "tabindex",
7483
+ "title",
7484
+ "translate",
7485
+ "type",
7486
+ "usemap",
7487
+ "valign",
7488
+ "value",
7489
+ "width",
7490
+ "wrap",
7491
+ "xmlns"
7492
+ ]);
7493
+ var svg = freeze([
7494
+ "accent-height",
7495
+ "accumulate",
7496
+ "additive",
7497
+ "alignment-baseline",
7498
+ "amplitude",
7499
+ "ascent",
7500
+ "attributename",
7501
+ "attributetype",
7502
+ "azimuth",
7503
+ "basefrequency",
7504
+ "baseline-shift",
7505
+ "begin",
7506
+ "bias",
7507
+ "by",
7508
+ "class",
7509
+ "clip",
7510
+ "clippathunits",
7511
+ "clip-path",
7512
+ "clip-rule",
7513
+ "color",
7514
+ "color-interpolation",
7515
+ "color-interpolation-filters",
7516
+ "color-profile",
7517
+ "color-rendering",
7518
+ "cx",
7519
+ "cy",
7520
+ "d",
7521
+ "dx",
7522
+ "dy",
7523
+ "diffuseconstant",
7524
+ "direction",
7525
+ "display",
7526
+ "divisor",
7527
+ "dur",
7528
+ "edgemode",
7529
+ "elevation",
7530
+ "end",
7531
+ "exponent",
7532
+ "fill",
7533
+ "fill-opacity",
7534
+ "fill-rule",
7535
+ "filter",
7536
+ "filterunits",
7537
+ "flood-color",
7538
+ "flood-opacity",
7539
+ "font-family",
7540
+ "font-size",
7541
+ "font-size-adjust",
7542
+ "font-stretch",
7543
+ "font-style",
7544
+ "font-variant",
7545
+ "font-weight",
7546
+ "fx",
7547
+ "fy",
7548
+ "g1",
7549
+ "g2",
7550
+ "glyph-name",
7551
+ "glyphref",
7552
+ "gradientunits",
7553
+ "gradienttransform",
7554
+ "height",
7555
+ "href",
7556
+ "id",
7557
+ "image-rendering",
7558
+ "in",
7559
+ "in2",
7560
+ "intercept",
7561
+ "k",
7562
+ "k1",
7563
+ "k2",
7564
+ "k3",
7565
+ "k4",
7566
+ "kerning",
7567
+ "keypoints",
7568
+ "keysplines",
7569
+ "keytimes",
7570
+ "lang",
7571
+ "lengthadjust",
7572
+ "letter-spacing",
7573
+ "kernelmatrix",
7574
+ "kernelunitlength",
7575
+ "lighting-color",
7576
+ "local",
7577
+ "marker-end",
7578
+ "marker-mid",
7579
+ "marker-start",
7580
+ "markerheight",
7581
+ "markerunits",
7582
+ "markerwidth",
7583
+ "maskcontentunits",
7584
+ "maskunits",
7585
+ "max",
7586
+ "mask",
7587
+ "mask-type",
7588
+ "media",
7589
+ "method",
7590
+ "mode",
7591
+ "min",
7592
+ "name",
7593
+ "numoctaves",
7594
+ "offset",
7595
+ "operator",
7596
+ "opacity",
7597
+ "order",
7598
+ "orient",
7599
+ "orientation",
7600
+ "origin",
7601
+ "overflow",
7602
+ "paint-order",
7603
+ "path",
7604
+ "pathlength",
7605
+ "patterncontentunits",
7606
+ "patterntransform",
7607
+ "patternunits",
7608
+ "points",
7609
+ "preservealpha",
7610
+ "preserveaspectratio",
7611
+ "primitiveunits",
7612
+ "r",
7613
+ "rx",
7614
+ "ry",
7615
+ "radius",
7616
+ "refx",
7617
+ "refy",
7618
+ "repeatcount",
7619
+ "repeatdur",
7620
+ "restart",
7621
+ "result",
7622
+ "rotate",
7623
+ "scale",
7624
+ "seed",
7625
+ "shape-rendering",
7626
+ "slope",
7627
+ "specularconstant",
7628
+ "specularexponent",
7629
+ "spreadmethod",
7630
+ "startoffset",
7631
+ "stddeviation",
7632
+ "stitchtiles",
7633
+ "stop-color",
7634
+ "stop-opacity",
7635
+ "stroke-dasharray",
7636
+ "stroke-dashoffset",
7637
+ "stroke-linecap",
7638
+ "stroke-linejoin",
7639
+ "stroke-miterlimit",
7640
+ "stroke-opacity",
7641
+ "stroke",
7642
+ "stroke-width",
7643
+ "style",
7644
+ "surfacescale",
7645
+ "systemlanguage",
7646
+ "tabindex",
7647
+ "tablevalues",
7648
+ "targetx",
7649
+ "targety",
7650
+ "transform",
7651
+ "transform-origin",
7652
+ "text-anchor",
7653
+ "text-decoration",
7654
+ "text-rendering",
7655
+ "textlength",
7656
+ "type",
7657
+ "u1",
7658
+ "u2",
7659
+ "unicode",
7660
+ "values",
7661
+ "viewbox",
7662
+ "visibility",
7663
+ "version",
7664
+ "vert-adv-y",
7665
+ "vert-origin-x",
7666
+ "vert-origin-y",
7667
+ "width",
7668
+ "word-spacing",
7669
+ "wrap",
7670
+ "writing-mode",
7671
+ "xchannelselector",
7672
+ "ychannelselector",
7673
+ "x",
7674
+ "x1",
7675
+ "x2",
7676
+ "xmlns",
7677
+ "y",
7678
+ "y1",
7679
+ "y2",
7680
+ "z",
7681
+ "zoomandpan"
7682
+ ]);
7683
+ var mathMl = freeze([
7684
+ "accent",
7685
+ "accentunder",
7686
+ "align",
7687
+ "bevelled",
7688
+ "close",
7689
+ "columnalign",
7690
+ "columnlines",
7691
+ "columnspacing",
7692
+ "columnspan",
7693
+ "denomalign",
7694
+ "depth",
7695
+ "dir",
7696
+ "display",
7697
+ "displaystyle",
7698
+ "encoding",
7699
+ "fence",
7700
+ "frame",
7701
+ "height",
7702
+ "href",
7703
+ "id",
7704
+ "largeop",
7705
+ "length",
7706
+ "linethickness",
7707
+ "lquote",
7708
+ "lspace",
7709
+ "mathbackground",
7710
+ "mathcolor",
7711
+ "mathsize",
7712
+ "mathvariant",
7713
+ "maxsize",
7714
+ "minsize",
7715
+ "movablelimits",
7716
+ "notation",
7717
+ "numalign",
7718
+ "open",
7719
+ "rowalign",
7720
+ "rowlines",
7721
+ "rowspacing",
7722
+ "rowspan",
7723
+ "rspace",
7724
+ "rquote",
7725
+ "scriptlevel",
7726
+ "scriptminsize",
7727
+ "scriptsizemultiplier",
7728
+ "selection",
7729
+ "separator",
7730
+ "separators",
7731
+ "stretchy",
7732
+ "subscriptshift",
7733
+ "supscriptshift",
7734
+ "symmetric",
7735
+ "voffset",
7736
+ "width",
7737
+ "xmlns"
7738
+ ]);
7739
+ var xml = freeze([
7740
+ "xlink:href",
7741
+ "xml:id",
7742
+ "xlink:title",
7743
+ "xml:space",
7744
+ "xmlns:xlink"
7745
+ ]);
7746
+ var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
7747
+ var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
7748
+ var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
7749
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
7750
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
7751
+ var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
7752
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
7753
+ var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
7754
+ var DOCTYPE_NAME = seal(/^html$/i);
7755
+ var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
7756
+ var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
7757
+ var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
7758
+ var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
7759
+ var SELF_CLOSING_TAG = seal(/\/>/i);
7760
+ var NODE_TYPE = {
7761
+ element: 1,
7762
+ attribute: 2,
7763
+ text: 3,
7764
+ cdataSection: 4,
7765
+ entityReference: 5,
7766
+ entityNode: 6,
7767
+ processingInstruction: 7,
7768
+ comment: 8,
7769
+ document: 9,
7770
+ documentType: 10,
7771
+ documentFragment: 11,
7772
+ notation: 12
7773
+ };
7774
+ var getGlobal = function getGlobal() {
7775
+ return typeof window === "undefined" ? null : window;
7776
+ };
7777
+ /**
7778
+ * Creates a no-op policy for internal use only.
7779
+ * Don't export this function outside this module!
7780
+ * @param trustedTypes The policy factory.
7781
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
7782
+ * @return The policy created (or null, if Trusted Types
7783
+ * are not supported or creating the policy failed).
7784
+ */
7785
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
7786
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
7787
+ let suffix = null;
7788
+ const ATTR_NAME = "data-tt-policy-suffix";
7789
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
7790
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
7791
+ try {
7792
+ return trustedTypes.createPolicy(policyName, {
7793
+ createHTML(html) {
7794
+ return html;
7795
+ },
7796
+ createScriptURL(scriptUrl) {
7797
+ return scriptUrl;
7798
+ }
7799
+ });
7800
+ } catch (_) {
7801
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
7802
+ return null;
7803
+ }
7804
+ };
7805
+ var _createHooksMap = function _createHooksMap() {
7806
+ return {
7807
+ afterSanitizeAttributes: [],
7808
+ afterSanitizeElements: [],
7809
+ afterSanitizeShadowDOM: [],
7810
+ beforeSanitizeAttributes: [],
7811
+ beforeSanitizeElements: [],
7812
+ beforeSanitizeShadowDOM: [],
7813
+ uponSanitizeAttribute: [],
7814
+ uponSanitizeElement: [],
7815
+ uponSanitizeShadowNode: []
7816
+ };
7817
+ };
7818
+ /**
7819
+ * Resolve a set-valued configuration option: a fresh set built from
7820
+ * cfg[key] when it is an own array property (seeded with a clone of
7821
+ * options.base when given, case-normalized via options.transform),
7822
+ * the fallback set otherwise.
7823
+ *
7824
+ * @param cfg the cloned, prototype-free configuration object
7825
+ * @param key the configuration property to read
7826
+ * @param fallback the set to use when the option is absent or not an array
7827
+ * @param options transform and optional base set to merge into
7828
+ * @returns the resolved set
7829
+ */
7830
+ var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
7831
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
7832
+ };
7833
+ function createDOMPurify() {
7834
+ let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
7835
+ const DOMPurify = (root) => createDOMPurify(root);
7836
+ DOMPurify.version = "3.4.11";
7837
+ DOMPurify.removed = [];
7838
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
7839
+ DOMPurify.isSupported = false;
7840
+ return DOMPurify;
7841
+ }
7842
+ let document = window.document;
7843
+ const originalDocument = document;
7844
+ const currentScript = originalDocument.currentScript;
7845
+ window.DocumentFragment;
7846
+ const HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter;
7847
+ window.NamedNodeMap === void 0 && (window.NamedNodeMap || window.MozNamedAttrMap);
7848
+ window.HTMLFormElement;
7849
+ const DOMParser = window.DOMParser, trustedTypes = window.trustedTypes;
7850
+ const ElementPrototype = Element.prototype;
7851
+ const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
7852
+ const remove = lookupGetter(ElementPrototype, "remove");
7853
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
7854
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
7855
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
7856
+ const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
7857
+ const getAttributes = lookupGetter(ElementPrototype, "attributes");
7858
+ const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
7859
+ const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
7860
+ if (typeof HTMLTemplateElement === "function") {
7861
+ const template = document.createElement("template");
7862
+ if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
7863
+ }
7864
+ let trustedTypesPolicy;
7865
+ let emptyHTML = "";
7866
+ let defaultTrustedTypesPolicy;
7867
+ let defaultTrustedTypesPolicyResolved = false;
7868
+ let IN_TRUSTED_TYPES_POLICY = 0;
7869
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
7870
+ if (IN_TRUSTED_TYPES_POLICY > 0) throw typeErrorCreate("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
7871
+ };
7872
+ const _createTrustedHTML = function _createTrustedHTML(html) {
7873
+ _assertNotInTrustedTypesPolicy();
7874
+ IN_TRUSTED_TYPES_POLICY++;
7875
+ try {
7876
+ return trustedTypesPolicy.createHTML(html);
7877
+ } finally {
7878
+ IN_TRUSTED_TYPES_POLICY--;
7879
+ }
7880
+ };
7881
+ const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
7882
+ _assertNotInTrustedTypesPolicy();
7883
+ IN_TRUSTED_TYPES_POLICY++;
7884
+ try {
7885
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
7886
+ } finally {
7887
+ IN_TRUSTED_TYPES_POLICY--;
7888
+ }
7889
+ };
7890
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
7891
+ if (!defaultTrustedTypesPolicyResolved) {
7892
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
7893
+ defaultTrustedTypesPolicyResolved = true;
7894
+ }
7895
+ return defaultTrustedTypesPolicy;
7896
+ };
7897
+ const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
7898
+ const importNode = originalDocument.importNode;
7899
+ let hooks = _createHooksMap();
7900
+ /**
7901
+ * Expose whether this browser supports running the full DOMPurify.
7902
+ */
7903
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
7904
+ const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
7905
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
7906
+ /**
7907
+ * We consider the elements and attributes below to be safe. Ideally
7908
+ * don't add any new ones but feel free to remove unwanted ones.
7909
+ */
7910
+ let ALLOWED_TAGS = null;
7911
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [
7912
+ ...html$1,
7913
+ ...svg$1,
7914
+ ...svgFilters,
7915
+ ...mathMl$1,
7916
+ ...text
7917
+ ]);
7918
+ let ALLOWED_ATTR = null;
7919
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [
7920
+ ...html,
7921
+ ...svg,
7922
+ ...mathMl,
7923
+ ...xml
7924
+ ]);
7925
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create$1(null, {
7926
+ tagNameCheck: {
7927
+ writable: true,
7928
+ configurable: false,
7929
+ enumerable: true,
7930
+ value: null
7931
+ },
7932
+ attributeNameCheck: {
7933
+ writable: true,
7934
+ configurable: false,
7935
+ enumerable: true,
7936
+ value: null
7937
+ },
7938
+ allowCustomizedBuiltInElements: {
7939
+ writable: true,
7940
+ configurable: false,
7941
+ enumerable: true,
7942
+ value: false
7943
+ }
7944
+ }));
7945
+ let FORBID_TAGS = null;
7946
+ let FORBID_ATTR = null;
7947
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create$1(null, {
7948
+ tagCheck: {
7949
+ writable: true,
7950
+ configurable: false,
7951
+ enumerable: true,
7952
+ value: null
7953
+ },
7954
+ attributeCheck: {
7955
+ writable: true,
7956
+ configurable: false,
7957
+ enumerable: true,
7958
+ value: null
7959
+ }
7960
+ }));
7961
+ let ALLOW_ARIA_ATTR = true;
7962
+ let ALLOW_DATA_ATTR = true;
7963
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
7964
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
7965
+ let SAFE_FOR_TEMPLATES = false;
7966
+ let SAFE_FOR_XML = true;
7967
+ let WHOLE_DOCUMENT = false;
7968
+ let SET_CONFIG = false;
7969
+ let SET_CONFIG_ALLOWED_TAGS = null;
7970
+ let SET_CONFIG_ALLOWED_ATTR = null;
7971
+ let FORCE_BODY = false;
7972
+ let RETURN_DOM = false;
7973
+ let RETURN_DOM_FRAGMENT = false;
7974
+ let RETURN_TRUSTED_TYPE = false;
7975
+ let SANITIZE_DOM = true;
7976
+ let SANITIZE_NAMED_PROPS = false;
7977
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
7978
+ let KEEP_CONTENT = true;
7979
+ let IN_PLACE = false;
7980
+ let USE_PROFILES = {};
7981
+ let FORBID_CONTENTS = null;
7982
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, [
7983
+ "annotation-xml",
7984
+ "audio",
7985
+ "colgroup",
7986
+ "desc",
7987
+ "foreignobject",
7988
+ "head",
7989
+ "iframe",
7990
+ "math",
7991
+ "mi",
7992
+ "mn",
7993
+ "mo",
7994
+ "ms",
7995
+ "mtext",
7996
+ "noembed",
7997
+ "noframes",
7998
+ "noscript",
7999
+ "plaintext",
8000
+ "script",
8001
+ "selectedcontent",
8002
+ "style",
8003
+ "svg",
8004
+ "template",
8005
+ "thead",
8006
+ "title",
8007
+ "video",
8008
+ "xmp"
8009
+ ]);
8010
+ let DATA_URI_TAGS = null;
8011
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, [
8012
+ "audio",
8013
+ "video",
8014
+ "img",
8015
+ "source",
8016
+ "image",
8017
+ "track"
8018
+ ]);
8019
+ let URI_SAFE_ATTRIBUTES = null;
8020
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
8021
+ "alt",
8022
+ "class",
8023
+ "for",
8024
+ "id",
8025
+ "label",
8026
+ "name",
8027
+ "pattern",
8028
+ "placeholder",
8029
+ "role",
8030
+ "summary",
8031
+ "title",
8032
+ "value",
8033
+ "style",
8034
+ "xmlns"
8035
+ ]);
8036
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
8037
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
8038
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
8039
+ let NAMESPACE = HTML_NAMESPACE;
8040
+ let IS_EMPTY_INPUT = false;
8041
+ let ALLOWED_NAMESPACES = null;
8042
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
8043
+ MATHML_NAMESPACE,
8044
+ SVG_NAMESPACE,
8045
+ HTML_NAMESPACE
8046
+ ], stringToString);
8047
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
8048
+ "mi",
8049
+ "mo",
8050
+ "mn",
8051
+ "ms",
8052
+ "mtext"
8053
+ ]);
8054
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
8055
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
8056
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
8057
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
8058
+ "title",
8059
+ "style",
8060
+ "font",
8061
+ "a",
8062
+ "script"
8063
+ ]);
8064
+ let PARSER_MEDIA_TYPE = null;
8065
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
8066
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
8067
+ let transformCaseFunc = null;
8068
+ let CONFIG = null;
8069
+ const formElement = document.createElement("form");
8070
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
8071
+ return testValue instanceof RegExp || testValue instanceof Function;
8072
+ };
8073
+ /**
8074
+ * _parseConfig
8075
+ *
8076
+ * @param cfg optional config literal
8077
+ */
8078
+ const _parseConfig = function _parseConfig() {
8079
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8080
+ if (CONFIG && CONFIG === cfg) return;
8081
+ if (!cfg || typeof cfg !== "object") cfg = {};
8082
+ cfg = clone(cfg);
8083
+ PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
8084
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
8085
+ ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
8086
+ ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
8087
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
8088
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
8089
+ transform: transformCaseFunc,
8090
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
8091
+ });
8092
+ DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
8093
+ transform: transformCaseFunc,
8094
+ base: DEFAULT_DATA_URI_TAGS
8095
+ });
8096
+ FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
8097
+ FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
8098
+ FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
8099
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
8100
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
8101
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
8102
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
8103
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
8104
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
8105
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
8106
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
8107
+ RETURN_DOM = cfg.RETURN_DOM || false;
8108
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
8109
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
8110
+ FORCE_BODY = cfg.FORCE_BODY || false;
8111
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
8112
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
8113
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
8114
+ IN_PLACE = cfg.IN_PLACE || false;
8115
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
8116
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
8117
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
8118
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
8119
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create$1(null);
8120
+ CUSTOM_ELEMENT_HANDLING = create$1(null);
8121
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
8122
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
8123
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
8124
+ seal(CUSTOM_ELEMENT_HANDLING);
8125
+ if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
8126
+ if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
8127
+ if (USE_PROFILES) {
8128
+ ALLOWED_TAGS = addToSet({}, text);
8129
+ ALLOWED_ATTR = create$1(null);
8130
+ if (USE_PROFILES.html === true) {
8131
+ addToSet(ALLOWED_TAGS, html$1);
8132
+ addToSet(ALLOWED_ATTR, html);
8133
+ }
8134
+ if (USE_PROFILES.svg === true) {
8135
+ addToSet(ALLOWED_TAGS, svg$1);
8136
+ addToSet(ALLOWED_ATTR, svg);
8137
+ addToSet(ALLOWED_ATTR, xml);
8138
+ }
8139
+ if (USE_PROFILES.svgFilters === true) {
8140
+ addToSet(ALLOWED_TAGS, svgFilters);
8141
+ addToSet(ALLOWED_ATTR, svg);
8142
+ addToSet(ALLOWED_ATTR, xml);
8143
+ }
8144
+ if (USE_PROFILES.mathMl === true) {
8145
+ addToSet(ALLOWED_TAGS, mathMl$1);
8146
+ addToSet(ALLOWED_ATTR, mathMl);
8147
+ addToSet(ALLOWED_ATTR, xml);
8148
+ }
8149
+ }
8150
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
8151
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
8152
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
8153
+ if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
8154
+ else if (arrayIsArray(cfg.ADD_TAGS)) {
8155
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
8156
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
8157
+ }
8158
+ }
8159
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
8160
+ if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
8161
+ else if (arrayIsArray(cfg.ADD_ATTR)) {
8162
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
8163
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
8164
+ }
8165
+ }
8166
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
8167
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
8168
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
8169
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
8170
+ }
8171
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
8172
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
8173
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
8174
+ }
8175
+ if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
8176
+ if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
8177
+ "html",
8178
+ "head",
8179
+ "body"
8180
+ ]);
8181
+ if (ALLOWED_TAGS.table) {
8182
+ addToSet(ALLOWED_TAGS, ["tbody"]);
8183
+ delete FORBID_TAGS.tbody;
8184
+ }
8185
+ if (cfg.TRUSTED_TYPES_POLICY) {
8186
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
8187
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
8188
+ const previousTrustedTypesPolicy = trustedTypesPolicy;
8189
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
8190
+ try {
8191
+ emptyHTML = _createTrustedHTML("");
8192
+ } catch (error) {
8193
+ trustedTypesPolicy = previousTrustedTypesPolicy;
8194
+ throw error;
8195
+ }
8196
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
8197
+ trustedTypesPolicy = void 0;
8198
+ emptyHTML = "";
8199
+ } else {
8200
+ if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
8201
+ if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
8202
+ }
8203
+ if (freeze) freeze(cfg);
8204
+ CONFIG = cfg;
8205
+ };
8206
+ const ALL_SVG_TAGS = addToSet({}, [
8207
+ ...svg$1,
8208
+ ...svgFilters,
8209
+ ...svgDisallowed
8210
+ ]);
8211
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
8212
+ /**
8213
+ * Namespace rules for an element in the SVG namespace.
8214
+ *
8215
+ * @param tagName the element's lowercase tag name
8216
+ * @param parent the (possibly simulated) parent node
8217
+ * @param parentTagName the parent's lowercase tag name
8218
+ * @returns true if a spec-compliant parser could produce this element
8219
+ */
8220
+ const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
8221
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
8222
+ if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
8223
+ return Boolean(ALL_SVG_TAGS[tagName]);
8224
+ };
8225
+ /**
8226
+ * Namespace rules for an element in the MathML namespace.
8227
+ *
8228
+ * @param tagName the element's lowercase tag name
8229
+ * @param parent the (possibly simulated) parent node
8230
+ * @param parentTagName the parent's lowercase tag name
8231
+ * @returns true if a spec-compliant parser could produce this element
8232
+ */
8233
+ const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
8234
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
8235
+ if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
8236
+ return Boolean(ALL_MATHML_TAGS[tagName]);
8237
+ };
8238
+ /**
8239
+ * Namespace rules for an element in the HTML namespace.
8240
+ *
8241
+ * @param tagName the element's lowercase tag name
8242
+ * @param parent the (possibly simulated) parent node
8243
+ * @param parentTagName the parent's lowercase tag name
8244
+ * @returns true if a spec-compliant parser could produce this element
8245
+ */
8246
+ const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
8247
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
8248
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
8249
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
8250
+ };
8251
+ /**
8252
+ * @param element a DOM element whose namespace is being checked
8253
+ * @returns Return false if the element has a
8254
+ * namespace that a spec-compliant parser would never
8255
+ * return. Return true otherwise.
8256
+ */
8257
+ const _checkValidNamespace = function _checkValidNamespace(element) {
8258
+ let parent = getParentNode(element);
8259
+ if (!parent || !parent.tagName) parent = {
8260
+ namespaceURI: NAMESPACE,
8261
+ tagName: "template"
8262
+ };
8263
+ const tagName = stringToLowerCase(element.tagName);
8264
+ const parentTagName = stringToLowerCase(parent.tagName);
8265
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
8266
+ if (element.namespaceURI === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
8267
+ if (element.namespaceURI === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
8268
+ if (element.namespaceURI === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
8269
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
8270
+ return false;
8271
+ };
8272
+ /**
8273
+ * _forceRemove
8274
+ *
8275
+ * @param node a DOM node
8276
+ */
8277
+ const _forceRemove = function _forceRemove(node) {
8278
+ arrayPush(DOMPurify.removed, { element: node });
8279
+ try {
8280
+ getParentNode(node).removeChild(node);
8281
+ } catch (_) {
8282
+ remove(node);
8283
+ if (!getParentNode(node)) throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
8284
+ }
8285
+ };
8286
+ /**
8287
+ * _neutralizeRoot
8288
+ *
8289
+ * Fail-closed teardown of an in-place root after the sanitize walk aborts
8290
+ * (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
8291
+ * custom element's reaction detaches a node so `_forceRemove`'s deliberate
8292
+ * parentless guard throws, or any other re-entrant engine mutation — would
8293
+ * otherwise leave the caller's *live* tree half-sanitized, with everything
8294
+ * after the abort point still carrying its handlers. There is no safe way
8295
+ * to resume the walk (the tree mutated under us), so we strip the root bare:
8296
+ * remove every child and every attribute, then let the caller's catch see
8297
+ * the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
8298
+ * getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
8299
+ *
8300
+ * @param root the in-place root to empty
8301
+ */
8302
+ const _neutralizeRoot = function _neutralizeRoot(root) {
8303
+ const childNodes = getChildNodes(root);
8304
+ if (childNodes) {
8305
+ const snapshot = [];
8306
+ arrayForEach(childNodes, (child) => {
8307
+ arrayPush(snapshot, child);
8308
+ });
8309
+ arrayForEach(snapshot, (child) => {
8310
+ try {
8311
+ remove(child);
8312
+ } catch (_) {}
8313
+ });
8314
+ }
8315
+ const attributes = getAttributes(root);
8316
+ if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
8317
+ const attribute = attributes[i];
8318
+ const name = attribute && attribute.name;
8319
+ if (typeof name === "string") try {
8320
+ root.removeAttribute(name);
8321
+ } catch (_) {}
8322
+ }
8323
+ };
8324
+ /**
8325
+ * _removeAttribute
8326
+ *
8327
+ * @param name an Attribute name
8328
+ * @param element a DOM node
8329
+ */
8330
+ const _removeAttribute = function _removeAttribute(name, element) {
8331
+ try {
8332
+ arrayPush(DOMPurify.removed, {
8333
+ attribute: element.getAttributeNode(name),
8334
+ from: element
8335
+ });
8336
+ } catch (_) {
8337
+ arrayPush(DOMPurify.removed, {
8338
+ attribute: null,
8339
+ from: element
8340
+ });
8341
+ }
8342
+ element.removeAttribute(name);
8343
+ if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
8344
+ _forceRemove(element);
8345
+ } catch (_) {}
8346
+ else try {
8347
+ element.setAttribute(name, "");
8348
+ } catch (_) {}
8349
+ };
8350
+ /**
8351
+ * _stripDisallowedAttributes
8352
+ *
8353
+ * Removes every attribute the active configuration does not allow from a
8354
+ * single element, using the same allowlist as the main attribute pass (so
8355
+ * `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
8356
+ * neutralise nodes that are being discarded from an in-place tree.
8357
+ *
8358
+ * @param element the element to strip
8359
+ */
8360
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
8361
+ const attributes = getAttributes(element);
8362
+ if (!attributes) return;
8363
+ for (let i = attributes.length - 1; i >= 0; --i) {
8364
+ const attribute = attributes[i];
8365
+ const name = attribute && attribute.name;
8366
+ if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
8367
+ try {
8368
+ element.removeAttribute(name);
8369
+ } catch (_) {}
8370
+ }
8371
+ };
8372
+ /**
8373
+ * _neutralizeSubtree
8374
+ *
8375
+ * Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
8376
+ * move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
8377
+ * namespace, comment, processing-instruction and KEEP_CONTENT:false removals
8378
+ * all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
8379
+ * those dropped nodes are detached from the caller's LIVE tree but a
8380
+ * handler-bearing original among them (an `<img onerror>`/`<video>` that was
8381
+ * loading) keeps its queued resource event, which fires in page scope after
8382
+ * sanitize returns. This walks a removed subtree and strips every attribute
8383
+ * the active configuration does not allow — so `on*` handlers are cancelled
8384
+ * through the SAME allowlist that governs kept nodes, not a separate `/^on/`
8385
+ * blocklist. Run synchronously before sanitize returns, i.e. before any
8386
+ * queued event can fire. Hook-free by design: these nodes leave the output,
8387
+ * so firing attribute hooks for them would be surprising. Clobber-safe reads;
8388
+ * a doomed clobbered node may shadow `removeAttribute` (its own attributes are
8389
+ * irrelevant — it is discarded — while its non-clobbered descendants, e.g.
8390
+ * the `<img>`, are reached and scrubbed).
8391
+ *
8392
+ * @param root the root of a removed subtree to neutralise
8393
+ */
8394
+ const _neutralizeSubtree = function _neutralizeSubtree(root) {
8395
+ const stack = [root];
8396
+ while (stack.length > 0) {
8397
+ const node = stack.pop();
8398
+ if ((getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element) _stripDisallowedAttributes(node);
8399
+ const childNodes = getChildNodes(node);
8400
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
8401
+ }
8402
+ };
8403
+ /**
8404
+ * _initDocument
8405
+ *
8406
+ * @param dirty - a string of dirty markup
8407
+ * @return a DOM, filled with the dirty markup
8408
+ */
8409
+ const _initDocument = function _initDocument(dirty) {
8410
+ let doc = null;
8411
+ let leadingWhitespace = null;
8412
+ if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
8413
+ else {
8414
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
8415
+ leadingWhitespace = matches && matches[0];
8416
+ }
8417
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) dirty = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + dirty + "</body></html>";
8418
+ const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
8419
+ if (NAMESPACE === HTML_NAMESPACE) try {
8420
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
8421
+ } catch (_) {}
8422
+ if (!doc || !doc.documentElement) {
8423
+ doc = implementation.createDocument(NAMESPACE, "template", null);
8424
+ try {
8425
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
8426
+ } catch (_) {}
8427
+ }
8428
+ const body = doc.body || doc.documentElement;
8429
+ if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
8430
+ if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
8431
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
8432
+ };
8433
+ /**
8434
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
8435
+ *
8436
+ * @param root The root element or node to start traversing on.
8437
+ * @return The created NodeIterator
8438
+ */
8439
+ const _createNodeIterator = function _createNodeIterator(root) {
8440
+ return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
8441
+ };
8442
+ /**
8443
+ * Replace template expression syntax (mustache, ERB, template
8444
+ * literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
8445
+ * sites. Order matters: mustache, then ERB, then template literal.
8446
+ *
8447
+ * @param value the string to scrub
8448
+ * @returns the scrubbed string
8449
+ */
8450
+ const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
8451
+ value = stringReplace(value, MUSTACHE_EXPR$1, " ");
8452
+ value = stringReplace(value, ERB_EXPR$1, " ");
8453
+ value = stringReplace(value, TMPLIT_EXPR$1, " ");
8454
+ return value;
8455
+ };
8456
+ /**
8457
+ * Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
8458
+ * character data of an element subtree. Used as the final safety net for
8459
+ * SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
8460
+ * which only form after text-node normalization (e.g. fragments split across
8461
+ * stripped elements) cannot survive into a template-evaluating framework.
8462
+ *
8463
+ * Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
8464
+ * in place rather than round-tripping through innerHTML. This preserves
8465
+ * descendant node references (important for IN_PLACE callers), avoids a
8466
+ * serialize/reparse cycle, and reads literal character data — which means
8467
+ * `<%...%>` in text content matches the ERB regex against its real bytes
8468
+ * instead of the HTML-entity-escaped form innerHTML would produce.
8469
+ *
8470
+ * Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
8471
+ * attributes is performed during the per-node `_sanitizeAttributes` pass.
8472
+ *
8473
+ * @param node The root element whose character data should be scrubbed.
8474
+ */
8475
+ const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
8476
+ var _node$querySelectorAl;
8477
+ node.normalize();
8478
+ const walker = createNodeIterator.call(node.ownerDocument || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
8479
+ let currentNode = walker.nextNode();
8480
+ while (currentNode) {
8481
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
8482
+ currentNode = walker.nextNode();
8483
+ }
8484
+ const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
8485
+ if (templates) arrayForEach(templates, (tmpl) => {
8486
+ if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
8487
+ });
8488
+ };
8489
+ /**
8490
+ * _isClobbered
8491
+ *
8492
+ * Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
8493
+ * interface with [LegacyOverrideBuiltIns]; a descendant element with a
8494
+ * `name` attribute matching a prototype property shadows that property
8495
+ * on direct reads. We use this check at the IN_PLACE entry-point and
8496
+ * during attribute sanitization to refuse clobbered forms.
8497
+ *
8498
+ * @param element element to check for clobbering attacks
8499
+ * @return true if clobbered, false if safe
8500
+ */
8501
+ const _isClobbered = function _isClobbered(element) {
8502
+ const realTagName = getNodeName ? getNodeName(element) : null;
8503
+ if (typeof realTagName !== "string") return false;
8504
+ if (transformCaseFunc(realTagName) !== "form") return false;
8505
+ return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
8506
+ };
8507
+ /**
8508
+ * Checks whether the given value is a DocumentFragment from any realm.
8509
+ *
8510
+ * The realm-independent replacement reads `nodeType` through the cached
8511
+ * Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
8512
+ * constant (11). nodeType is a numeric value resolved from the node's
8513
+ * internal slot, identical across realms for the same kind of node.
8514
+ *
8515
+ * @param value object to check
8516
+ * @return true if value is a DocumentFragment-shaped node from any realm
8517
+ */
8518
+ const _isDocumentFragment = function _isDocumentFragment(value) {
8519
+ if (!getNodeType || typeof value !== "object" || value === null) return false;
8520
+ try {
8521
+ return getNodeType(value) === NODE_TYPE.documentFragment;
8522
+ } catch (_) {
8523
+ return false;
8524
+ }
8525
+ };
8526
+ /**
8527
+ * Checks whether the given object is a DOM node, including nodes that
8528
+ * originate from a different window/realm (e.g. an iframe's
8529
+ * contentDocument). The previous `value instanceof Node` check was
8530
+ * realm-bound: nodes from a different window failed it, causing
8531
+ * sanitize() to silently stringify them and reset IN_PLACE to false,
8532
+ * returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
8533
+ *
8534
+ * @param value object to check whether it's a DOM node
8535
+ * @return true if value is a DOM node from any realm
8536
+ */
8537
+ const _isNode = function _isNode(value) {
8538
+ if (!getNodeType || typeof value !== "object" || value === null) return false;
8539
+ try {
8540
+ return typeof getNodeType(value) === "number";
8541
+ } catch (_) {
8542
+ return false;
8543
+ }
8544
+ };
8545
+ function _executeHooks(hooks, currentNode, data) {
8546
+ if (hooks.length === 0) return;
8547
+ arrayForEach(hooks, (hook) => {
8548
+ hook.call(DOMPurify, currentNode, data, CONFIG);
8549
+ });
8550
+ }
8551
+ /**
8552
+ * Structural-threat checks that condemn a node regardless of the
8553
+ * allowlists: mXSS via namespace confusion, risky CSS construction,
8554
+ * processing instructions, markup-bearing comments. Pure predicate;
8555
+ * the caller removes. Check order is load-bearing.
8556
+ *
8557
+ * @param currentNode the node to inspect
8558
+ * @param tagName the node's transformCaseFunc'd tag name
8559
+ * @return true if the node must be removed
8560
+ */
8561
+ const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
8562
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
8563
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) return true;
8564
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
8565
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
8566
+ return false;
8567
+ };
8568
+ /**
8569
+ * Handle a node whose tag is forbidden or not allowlisted: keep
8570
+ * allowed custom elements (false return exits _sanitizeElements
8571
+ * early - namespace/fallback checks and the afterSanitizeElements
8572
+ * hook are intentionally skipped for kept custom elements), else
8573
+ * hoist content per KEEP_CONTENT and remove.
8574
+ *
8575
+ * @param currentNode the disallowed node
8576
+ * @param tagName the node's transformCaseFunc'd tag name
8577
+ * @return true if the node was removed, false if kept
8578
+ */
8579
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
8580
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
8581
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
8582
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
8583
+ }
8584
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
8585
+ const parentNode = getParentNode(currentNode);
8586
+ const childNodes = getChildNodes(currentNode);
8587
+ if (childNodes && parentNode) {
8588
+ const childCount = childNodes.length;
8589
+ for (let i = childCount - 1; i >= 0; --i) {
8590
+ const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
8591
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
8592
+ }
8593
+ }
8594
+ }
8595
+ _forceRemove(currentNode);
8596
+ return true;
8597
+ };
8598
+ /**
8599
+ * _sanitizeElements
8600
+ *
8601
+ * @protect nodeName
8602
+ * @protect textContent
8603
+ * @protect removeChild
8604
+ * @param currentNode to check for permission to exist
8605
+ * @return true if node was killed, false if left alive
8606
+ */
8607
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
8608
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
8609
+ if (_isClobbered(currentNode)) {
8610
+ _forceRemove(currentNode);
8611
+ return true;
8612
+ }
8613
+ const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
8614
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
8615
+ tagName,
8616
+ allowedTags: ALLOWED_TAGS
8617
+ });
8618
+ if (_isUnsafeNode(currentNode, tagName)) {
8619
+ _forceRemove(currentNode);
8620
+ return true;
8621
+ }
8622
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) return _sanitizeDisallowedNode(currentNode, tagName);
8623
+ if ((getNodeType ? getNodeType(currentNode) : currentNode.nodeType) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
8624
+ _forceRemove(currentNode);
8625
+ return true;
8626
+ }
8627
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
8628
+ _forceRemove(currentNode);
8629
+ return true;
8630
+ }
8631
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
8632
+ const content = _stripTemplateExpressions(currentNode.textContent);
8633
+ if (currentNode.textContent !== content) {
8634
+ arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
8635
+ currentNode.textContent = content;
8636
+ }
8637
+ }
8638
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
8639
+ return false;
8640
+ };
8641
+ /**
8642
+ * _isValidAttribute
8643
+ *
8644
+ * @param lcTag Lowercase tag name of containing element.
8645
+ * @param lcName Lowercase attribute name.
8646
+ * @param value Attribute value.
8647
+ * @return Returns true if `value` is valid, otherwise false.
8648
+ */
8649
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
8650
+ if (FORBID_ATTR[lcName]) return false;
8651
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
8652
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
8653
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName));
8654
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName));
8655
+ else if (!nameIsPermitted) if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));
8656
+ else return false;
8657
+ else if (URI_SAFE_ATTRIBUTES[lcName]);
8658
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
8659
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]);
8660
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
8661
+ else if (value) return false;
8662
+ return true;
8663
+ };
8664
+ const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
8665
+ "annotation-xml",
8666
+ "color-profile",
8667
+ "font-face",
8668
+ "font-face-format",
8669
+ "font-face-name",
8670
+ "font-face-src",
8671
+ "font-face-uri",
8672
+ "missing-glyph"
8673
+ ]);
8674
+ /**
8675
+ * _isBasicCustomElement
8676
+ * checks if at least one dash is included in tagName, and it's not the first char
8677
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
8678
+ *
8679
+ * @param tagName name of the tag of the node to sanitize
8680
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
8681
+ */
8682
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
8683
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
8684
+ };
8685
+ /**
8686
+ * Wrap an attribute value in the matching Trusted Types object when
8687
+ * the active policy requires it. Namespaced attributes pass through
8688
+ * unchanged (no TT support yet, see
8689
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
8690
+ *
8691
+ * @param lcTag lowercase tag name of the containing element
8692
+ * @param lcName lowercase attribute name
8693
+ * @param namespaceURI the attribute's namespace, if any
8694
+ * @param value the attribute value to wrap
8695
+ * @return the value, wrapped when Trusted Types demand it
8696
+ */
8697
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
8698
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) switch (trustedTypes.getAttributeType(lcTag, lcName)) {
8699
+ case "TrustedHTML": return _createTrustedHTML(value);
8700
+ case "TrustedScriptURL": return _createTrustedScriptURL(value);
8701
+ }
8702
+ return value;
8703
+ };
8704
+ /**
8705
+ * Write a modified attribute value back onto the element. On
8706
+ * success, re-probe for clobbering introduced by the new value and
8707
+ * remove the element when found; otherwise pop the removal entry
8708
+ * recorded by the earlier _removeAttribute (long-standing pairing
8709
+ * with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
8710
+ * failure, remove the attribute instead.
8711
+ *
8712
+ * @param currentNode the element carrying the attribute
8713
+ * @param name the attribute name as present on the element
8714
+ * @param namespaceURI the attribute's namespace, if any
8715
+ * @param value the new attribute value
8716
+ */
8717
+ const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
8718
+ try {
8719
+ if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
8720
+ else currentNode.setAttribute(name, value);
8721
+ if (_isClobbered(currentNode)) _forceRemove(currentNode);
8722
+ else arrayPop(DOMPurify.removed);
8723
+ } catch (_) {
8724
+ _removeAttribute(name, currentNode);
8725
+ }
8726
+ };
8727
+ /**
8728
+ * _sanitizeAttributes
8729
+ *
8730
+ * @protect attributes
8731
+ * @protect nodeName
8732
+ * @protect removeAttribute
8733
+ * @protect setAttribute
8734
+ *
8735
+ * @param currentNode to sanitize
8736
+ */
8737
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
8738
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
8739
+ const attributes = currentNode.attributes;
8740
+ if (!attributes || _isClobbered(currentNode)) return;
8741
+ const hookEvent = {
8742
+ attrName: "",
8743
+ attrValue: "",
8744
+ keepAttr: true,
8745
+ allowedAttributes: ALLOWED_ATTR,
8746
+ forceKeepAttr: void 0
8747
+ };
8748
+ let l = attributes.length;
8749
+ const lcTag = transformCaseFunc(currentNode.nodeName);
8750
+ while (l--) {
8751
+ const attr = attributes[l];
8752
+ const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
8753
+ const lcName = transformCaseFunc(name);
8754
+ const initValue = attrValue;
8755
+ let value = name === "value" ? initValue : stringTrim(initValue);
8756
+ hookEvent.attrName = lcName;
8757
+ hookEvent.attrValue = value;
8758
+ hookEvent.keepAttr = true;
8759
+ hookEvent.forceKeepAttr = void 0;
8760
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
8761
+ value = hookEvent.attrValue;
8762
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
8763
+ _removeAttribute(name, currentNode);
8764
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
8765
+ }
8766
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
8767
+ _removeAttribute(name, currentNode);
8768
+ continue;
8769
+ }
8770
+ if (lcName === "attributename" && stringMatch(value, "href")) {
8771
+ _removeAttribute(name, currentNode);
8772
+ continue;
8773
+ }
8774
+ if (hookEvent.forceKeepAttr) continue;
8775
+ if (!hookEvent.keepAttr) {
8776
+ _removeAttribute(name, currentNode);
8777
+ continue;
8778
+ }
8779
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
8780
+ _removeAttribute(name, currentNode);
8781
+ continue;
8782
+ }
8783
+ if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
8784
+ if (!_isValidAttribute(lcTag, lcName, value)) {
8785
+ _removeAttribute(name, currentNode);
8786
+ continue;
8787
+ }
8788
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
8789
+ if (value !== initValue) _setAttributeValue(currentNode, name, namespaceURI, value);
8790
+ }
8791
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
8792
+ };
8793
+ /**
8794
+ * _sanitizeShadowDOM
8795
+ *
8796
+ * @param fragment to iterate over recursively
8797
+ */
8798
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
8799
+ let shadowNode = null;
8800
+ const shadowIterator = _createNodeIterator(fragment);
8801
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
8802
+ while (shadowNode = shadowIterator.nextNode()) {
8803
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
8804
+ _sanitizeElements(shadowNode);
8805
+ _sanitizeAttributes(shadowNode);
8806
+ if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
8807
+ if ((getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType) === NODE_TYPE.element) {
8808
+ const innerSr = getShadowRoot(shadowNode);
8809
+ if (_isDocumentFragment(innerSr)) {
8810
+ _sanitizeAttachedShadowRoots(innerSr);
8811
+ _sanitizeShadowDOM2(innerSr);
8812
+ }
8813
+ }
8814
+ }
8815
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
8816
+ };
8817
+ /**
8818
+ * _sanitizeAttachedShadowRoots
8819
+ *
8820
+ * Walks `root` and feeds every attached shadow root we encounter into
8821
+ * the existing _sanitizeShadowDOM pipeline. The default node iterator
8822
+ * does not descend into shadow trees, so nodes inside an attached
8823
+ * shadow root would otherwise be skipped entirely.
8824
+ *
8825
+ * Two real input paths put attached shadow roots in front of us:
8826
+ * 1. IN_PLACE on a DOM node that already has shadow roots attached.
8827
+ * 2. DOM-node input where importNode(dirty, true) deep-clones the
8828
+ * shadow root because it was created with `clonable: true`.
8829
+ *
8830
+ * This pass runs once, up front, so the main iteration loop (and the
8831
+ * existing _sanitizeShadowDOM template-content recursion) stay
8832
+ * untouched — string-input paths are not affected.
8833
+ *
8834
+ * @param root the subtree root to walk for attached shadow roots
8835
+ */
8836
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
8837
+ const stack = [{
8838
+ node: root,
8839
+ shadow: null
8840
+ }];
8841
+ while (stack.length > 0) {
8842
+ const item = stack.pop();
8843
+ if (item.shadow) {
8844
+ _sanitizeShadowDOM2(item.shadow);
8845
+ continue;
8846
+ }
8847
+ const node = item.node;
8848
+ const isElement = (getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element;
8849
+ const childNodes = getChildNodes(node);
8850
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
8851
+ node: childNodes[i],
8852
+ shadow: null
8853
+ });
8854
+ if (isElement) {
8855
+ const rootName = getNodeName ? getNodeName(node) : null;
8856
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
8857
+ const content = node.content;
8858
+ if (_isDocumentFragment(content)) stack.push({
8859
+ node: content,
8860
+ shadow: null
8861
+ });
8862
+ }
8863
+ }
8864
+ if (isElement) {
8865
+ const sr = getShadowRoot(node);
8866
+ if (_isDocumentFragment(sr)) stack.push({
8867
+ node: null,
8868
+ shadow: sr
8869
+ }, {
8870
+ node: sr,
8871
+ shadow: null
8872
+ });
8873
+ }
8874
+ }
8875
+ };
8876
+ DOMPurify.sanitize = function(dirty) {
8877
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8878
+ let body = null;
8879
+ let importedNode = null;
8880
+ let currentNode = null;
8881
+ let returnNode = null;
8882
+ IS_EMPTY_INPUT = !dirty;
8883
+ if (IS_EMPTY_INPUT) dirty = "<!-->";
8884
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
8885
+ dirty = stringifyValue(dirty);
8886
+ if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
8887
+ }
8888
+ if (!DOMPurify.isSupported) return dirty;
8889
+ if (SET_CONFIG) {
8890
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
8891
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
8892
+ } else _parseConfig(cfg);
8893
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) ALLOWED_TAGS = clone(ALLOWED_TAGS);
8894
+ if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
8895
+ DOMPurify.removed = [];
8896
+ const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
8897
+ if (inPlace) {
8898
+ const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
8899
+ if (typeof nn === "string") {
8900
+ const tagName = transformCaseFunc(nn);
8901
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
8902
+ }
8903
+ if (_isClobbered(dirty)) throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
8904
+ try {
8905
+ _sanitizeAttachedShadowRoots(dirty);
8906
+ } catch (error) {
8907
+ _neutralizeRoot(dirty);
8908
+ throw error;
8909
+ }
8910
+ } else if (_isNode(dirty)) {
8911
+ body = _initDocument("<!---->");
8912
+ importedNode = body.ownerDocument.importNode(dirty, true);
8913
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
8914
+ else if (importedNode.nodeName === "HTML") body = importedNode;
8915
+ else body.appendChild(importedNode);
8916
+ _sanitizeAttachedShadowRoots(importedNode);
8917
+ } else {
8918
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
8919
+ body = _initDocument(dirty);
8920
+ if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
8921
+ }
8922
+ if (body && FORCE_BODY) _forceRemove(body.firstChild);
8923
+ const nodeIterator = _createNodeIterator(inPlace ? dirty : body);
8924
+ try {
8925
+ while (currentNode = nodeIterator.nextNode()) {
8926
+ _sanitizeElements(currentNode);
8927
+ _sanitizeAttributes(currentNode);
8928
+ if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
8929
+ }
8930
+ } catch (error) {
8931
+ if (inPlace) _neutralizeRoot(dirty);
8932
+ throw error;
8933
+ }
8934
+ if (inPlace) {
8935
+ arrayForEach(DOMPurify.removed, (entry) => {
8936
+ if (entry.element) _neutralizeSubtree(entry.element);
8937
+ });
8938
+ if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
8939
+ return dirty;
8940
+ }
8941
+ if (RETURN_DOM) {
8942
+ if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(body);
8943
+ if (RETURN_DOM_FRAGMENT) {
8944
+ returnNode = createDocumentFragment.call(body.ownerDocument);
8945
+ while (body.firstChild) returnNode.appendChild(body.firstChild);
8946
+ } else returnNode = body;
8947
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
8948
+ return returnNode;
8949
+ }
8950
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
8951
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
8952
+ if (SAFE_FOR_TEMPLATES) serializedHTML = _stripTemplateExpressions(serializedHTML);
8953
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
8954
+ };
8955
+ DOMPurify.setConfig = function() {
8956
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8957
+ _parseConfig(cfg);
8958
+ SET_CONFIG = true;
8959
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
8960
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
8961
+ };
8962
+ DOMPurify.clearConfig = function() {
8963
+ CONFIG = null;
8964
+ SET_CONFIG = false;
8965
+ SET_CONFIG_ALLOWED_TAGS = null;
8966
+ SET_CONFIG_ALLOWED_ATTR = null;
8967
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
8968
+ emptyHTML = "";
8969
+ };
8970
+ DOMPurify.isValidAttribute = function(tag, attr, value) {
8971
+ if (!CONFIG) _parseConfig({});
8972
+ const lcTag = transformCaseFunc(tag);
8973
+ const lcName = transformCaseFunc(attr);
8974
+ return _isValidAttribute(lcTag, lcName, value);
8975
+ };
8976
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
8977
+ if (typeof hookFunction !== "function") return;
8978
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
8979
+ arrayPush(hooks[entryPoint], hookFunction);
8980
+ };
8981
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
8982
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
8983
+ if (hookFunction !== void 0) {
8984
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
8985
+ return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
8986
+ }
8987
+ return arrayPop(hooks[entryPoint]);
8988
+ };
8989
+ DOMPurify.removeHooks = function(entryPoint) {
8990
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
8991
+ hooks[entryPoint] = [];
8992
+ };
8993
+ DOMPurify.removeAllHooks = function() {
8994
+ hooks = _createHooksMap();
8995
+ };
8996
+ return DOMPurify;
8997
+ }
8998
+ createDOMPurify();
8999
+ //#endregion
9000
+ //#region ../utils/dist/index.js
9001
+ var __defProp = Object.defineProperty;
9002
+ var __exportAll = (all, no_symbols) => {
9003
+ let target = {};
9004
+ for (var name in all) __defProp(target, name, {
9005
+ get: all[name],
9006
+ enumerable: true
9007
+ });
9008
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
9009
+ return target;
9010
+ };
9011
+ Object.assign({}, ...[
9012
+ {
9013
+ id: "search",
9014
+ normalize(searchTerm, caseSensitiveSearch) {
9015
+ return caseSensitiveSearch ? searchTerm : searchTerm.toLowerCase();
9016
+ },
9017
+ test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
9018
+ const matches = (caseSensitiveSearch ? text : text.toLowerCase()).includes(normalizedSearchTerm);
9019
+ return inverseSearch ? !matches : matches;
9020
+ }
9021
+ },
9022
+ {
9023
+ id: "wildcard",
9024
+ normalize(searchTerm, caseSensitiveSearch) {
9025
+ if (searchTerm.length > 0) searchTerm = `^${searchTerm.replace(/[-[\]{}()+.,\\^$|#\s]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".?")}$`;
9026
+ else return { test: () => false };
9027
+ try {
9028
+ return new RegExp(searchTerm, caseSensitiveSearch ? "" : "i");
9029
+ } catch (_error) {
9030
+ return /$^/;
9031
+ }
9032
+ },
9033
+ test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
9034
+ const matches = normalizedSearchTerm.test(text);
9035
+ return inverseSearch ? !matches : matches;
9036
+ }
9037
+ },
9038
+ {
9039
+ id: "regex",
9040
+ normalize(searchTerm, caseSensitiveSearch) {
9041
+ try {
9042
+ const flags = caseSensitiveSearch ? "" : "i";
9043
+ return new RegExp(`^(${searchTerm})$`, flags);
9044
+ } catch (_error) {
9045
+ return /$^/;
9046
+ }
9047
+ },
9048
+ test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
9049
+ const matches = normalizedSearchTerm.test(text);
9050
+ return inverseSearch ? !matches : matches;
9051
+ }
9052
+ },
9053
+ {
9054
+ id: "type",
9055
+ normalize(selectedTypes) {
9056
+ return { test: (type) => selectedTypes.includes(type) };
9057
+ },
9058
+ test(type, normalizedSearchTerm) {
9059
+ if (typeof type === "undefined") return false;
9060
+ return normalizedSearchTerm.test(type);
9061
+ }
9062
+ }
9063
+ ].map((obj) => ({ [obj.id]: obj })));
9064
+ var formatFileSize = (bytes) => {
9065
+ return prettyBytes(Number.isFinite(bytes) && bytes >= 0 ? bytes : 0);
9066
+ };
9067
+ var yearsPart$1 = "(\\d+)\\s*y(?:ears?)?";
9068
+ var monthsPart$1 = "(\\d+)\\s*m(?:o(?:nths?)?)?";
9069
+ var weeksPart$1 = "(\\d+)\\s*w(?:eeks?)?";
9070
+ var daysPart$1 = "(\\d+)\\s*d(?:ays?)?";
9071
+ var hoursPart$1 = "(\\d+)\\s*h(?:ours?)?";
9072
+ var minutesPart$1 = "(\\d+)\\s*m(?:in(?:s|utes?)?)?";
9073
+ var secondsPart$1 = "(\\d+)(?:[,.](\\d{1,3}))?\\s*s(?:ec(?:s|onds?)?)?";
9074
+ /**
9075
+ * Matches a human readable period string, e.g. "1y 2mo 3weeks 4day" (each part is optional)
9076
+ */
9077
+ var humanReadablePeriodRegex$1 = new RegExp(`^(?:${yearsPart$1})?\\s*(?:${monthsPart$1})?\\s*(?:${weeksPart$1})?\\s*(?:${daysPart$1})?\\s*$`, "i");
9078
+ /**
9079
+ * Matches a human readable duration string, e.g. "1h 2m 3.456s" (each part is optional)
9080
+ */
9081
+ var humanReadableDurationRegex$1 = new RegExp(`^(?:${hoursPart$1})?\\s*(?:${minutesPart$1})?\\s*(?:${secondsPart$1})?$`, "i");
9082
+ new RegExp(`^\\s*-\\s*\\(\\s*${humanReadablePeriodRegex$1.source.replace(/[$^]/g, "")}\\s*\\)\\s*$`, "i");
9083
+ new RegExp(`^\\s*-\\s*(?:\\s*${yearsPart$1}|${monthsPart$1}|${weeksPart$1}|${daysPart$1})\\s*$`, "i");
9084
+ new RegExp(`^\\s*-\\s*\\(\\s*${humanReadableDurationRegex$1.source.replace(/[$^]/g, "")}\\s*\\)\\s*$`, "i");
9085
+ new RegExp(`^\\s*-\\s*(?:\\s*${hoursPart$1}|${minutesPart$1}|${secondsPart$1})\\s*$`, "i");
9086
+ var AbortError = class extends Error {};
9087
+ /**
9088
+ * Helper to create an abortable promise. Returns an AbortController and a Function
9089
+ * that you can pass your async handler to. Whenever the AbortController signal is
9090
+ * aborted then the async handler's promise will reject with an AbortError
9091
+ *
9092
+ * Example:
9093
+ * ```
9094
+ * import { abortUtils } from "@knime/utils"
9095
+ * const myFetchCall = async (params...) => {...};
9096
+ *
9097
+ * try {
9098
+ * const { runAbortablePromise, abortController } = createAbortablePromise(() =>
9099
+ * myFetchCall(params...),
9100
+ * );
9101
+ * } catch (e) {
9102
+ * if (e instanceof abortUtils.AbortError) {
9103
+ * console.info('ignore due to abort');
9104
+ * return;
9105
+ * }
9106
+ * }
9107
+ *
9108
+ * // somewhere else (while request is in-flight)
9109
+ * abortController.abort(new abortUtils.AbortError('reason here'))
9110
+ * ```
9111
+ */
9112
+ var createAbortablePromise = () => {
9113
+ const abortController = new AbortController();
9114
+ const runAbortablePromise = (request) => {
9115
+ return new Promise((resolve, reject) => {
9116
+ const abortListener = ({ target }) => {
9117
+ abortController.signal.removeEventListener("abort", abortListener);
9118
+ const reason = target.reason;
9119
+ reject(reason instanceof AbortError ? reason : new AbortError(reason));
9120
+ };
9121
+ request().then(resolve).catch((error) => {
9122
+ if (error instanceof AbortError) return;
9123
+ reject(error);
9124
+ });
9125
+ abortController.signal.addEventListener("abort", abortListener);
9126
+ });
9127
+ };
9128
+ return {
9129
+ abortController,
9130
+ runAbortablePromise
9131
+ };
9132
+ };
9133
+ var createUnwrappedPromise = () => {
9134
+ let resolve = () => {};
9135
+ let reject = () => {};
9136
+ const promise = new Promise((res, rej) => {
9137
+ resolve = res;
9138
+ reject = rej;
9139
+ });
9140
+ return {
9141
+ resolve,
9142
+ reject,
9143
+ promise
9144
+ };
9145
+ };
9146
+ /**
9147
+ * Returns promise that resolves after ms.
9148
+ */
9149
+ function sleep(ms) {
9150
+ return new Promise((resolve) => setTimeout(resolve, ms));
9151
+ }
9152
+ /**
9153
+ * Helper to add retry capability to an async function
9154
+ * @param fn async function
9155
+ * @param retryCount max number of retries. defaults to 5
9156
+ * @param retryDelayMS delay in-between retries in millisecs. defaults to 0
9157
+ * @param excludeError predicate fn to exclude specific errors from causing a retry
9158
+ */
9159
+ async function retryPromise({ fn, retryCount = 5, retryDelayMS = 0, excludeError }) {
9160
+ try {
9161
+ return await fn();
9162
+ } catch (error) {
9163
+ if (excludeError?.(error)) throw error;
9164
+ if (retryCount > 0) {
9165
+ await sleep(retryDelayMS);
9166
+ return await retryPromise({
9167
+ fn,
9168
+ retryCount: retryCount - 1,
9169
+ retryDelayMS,
9170
+ excludeError
9171
+ });
9172
+ }
9173
+ throw error;
9174
+ }
9175
+ }
9176
+ var promise_exports = /* @__PURE__ */ __exportAll({
9177
+ AbortError: () => AbortError,
9178
+ DEFAULT_RETRY_COUNT: () => 5,
9179
+ DEFAULT_RETRY_DELAY_MS: () => 0,
9180
+ createAbortablePromise: () => createAbortablePromise,
9181
+ createUnwrappedPromise: () => createUnwrappedPromise,
9182
+ retryPromise: () => retryPromise
9183
+ });
9184
+ /**
9185
+ * Gets the file extension
9186
+ * @param nameOrPath can take a full file name (e.g "file.txt") or a path to a file
9187
+ * (e.g "file://path/to/file.txt" OR "/path/to/file.txt")
9188
+ * @returns just the file extension (e.g "txt")
9189
+ */
9190
+ var getFileExtension = (nameOrPath) => {
9191
+ const basename = nameOrPath.split(/[\\/]/).pop() ?? "";
9192
+ const parts = basename.split(".");
9193
+ if (basename === "" || parts.length === 1) return "";
9194
+ return parts.at(-1) ?? "";
9195
+ };
9196
+ Object.freeze({
9197
+ extension: "knar",
9198
+ mimeType: "application/vnd.knime.workflow-group+zip",
9199
+ matches(file) {
9200
+ return getFileExtension(file.name) === this.extension;
9201
+ }
9202
+ });
9203
+ Object.freeze({
9204
+ extension: "knwf",
9205
+ mimeType: "application/vnd.knime.workflow+zip",
9206
+ matches(file) {
9207
+ return getFileExtension(file.name) === this.extension;
9208
+ },
9209
+ /**
9210
+ * Gets the name of a .knwf file without the extension. If the file is not
9211
+ * matched as a .knwf file then this function will return the default value,
9212
+ * which is empty string ("") if param is not provided
9213
+ */
9214
+ getNameOrDefault(file, defaultValue = "") {
9215
+ if (!this.matches(file)) return defaultValue;
9216
+ return file.name.replace(`.${this.extension}`, "");
9217
+ }
9218
+ });
9219
+ /**
9220
+ * Platforms that influence how modifier keys are rendered. macOS substitutes
9221
+ * dedicated glyphs (`⌘`, `⌥`, `⇧`, …), every other platform uses the textual
9222
+ * rendering (`Ctrl`, `Alt`, `Shift`, …).
9223
+ */
9224
+ var hotkeyPlatform = {
9225
+ MAC_OS: "macOS",
9226
+ OTHER: "other"
9227
+ };
9228
+ Object.values(hotkeyPlatform);
9229
+ /**
9230
+ *
9231
+ * @returns true if the platform of the user is Mac
9232
+ */
9233
+ var isMac = () => navigator?.userAgent?.toLowerCase()?.includes("mac");
9234
+ var globalKeyMap = {
9235
+ ArrowUp: "↑",
9236
+ ArrowDown: "↓",
9237
+ ArrowLeft: "←",
9238
+ ArrowRight: "→",
9239
+ Enter: "↵",
9240
+ " ": "Space",
9241
+ CtrlOrCmd: "Ctrl"
9242
+ };
9243
+ var MacOSkeyMap = {
9244
+ Shift: "⇧",
9245
+ Delete: "⌫",
9246
+ CtrlOrCmd: "⌘",
9247
+ Ctrl: "⌃",
9248
+ Alt: "⌥",
9249
+ Enter: "↩"
9250
+ };
9251
+ /**
9252
+ * Returns a string representation of a single hotkey. Replaces some special key names with symbols.
9253
+ *
9254
+ * By default the platform is auto-detected from the user agent via `isMac()`.
9255
+ * Pass `platform` to force a specific platform's glyphs — useful for SSR,
9256
+ * tests, or rendering multiple platforms on the same page.
9257
+ */
9258
+ var formatHotkey = (hotkey, platform) => {
9259
+ /**
9260
+ * Returns the symbol corresponding to the `key` based on the given
9261
+ * `formatMap`. Otherwise, if not found, returns the same `key` value given
9262
+ */
9263
+ const mapSymbols = (formatMap) => (key) => formatMap[key] ?? key;
9264
+ /**
9265
+ * Pipe function implementation. Receives a list of functions to execute in order
9266
+ * and will pipe the parameter passed at the end to each function returning the final output
9267
+ */
9268
+ const pipe = (...fns) => fns.reduce((f, g) => (arg) => g(f(arg)), (arg) => arg);
9269
+ const macKeyFormatter = pipe(mapSymbols(MacOSkeyMap), mapSymbols(globalKeyMap));
9270
+ const generalKeyFormatter = mapSymbols(globalKeyMap);
9271
+ return (platform === void 0 ? isMac() : platform === hotkeyPlatform.MAC_OS) ? macKeyFormatter(hotkey) : generalKeyFormatter(hotkey);
9272
+ };
9273
+ var getDefaultSeparator = () => isMac() ? " " : "+";
9274
+ /**
9275
+ * Returns a string representation of a list of hotkeys. Replaces some special key names with symbols
9276
+ */
9277
+ var formatHotkeys = (hotkeys, getSeparator = getDefaultSeparator) => hotkeys.map((hotkey) => formatHotkey(hotkey)).join(getSeparator());
9278
+ /**
9279
+ * Appends a formatted hotkey shortcut to the given string. Useful for tooltips
9280
+ */
9281
+ var textWithHotkeys = (text, hotkeys) => {
9282
+ return `${text} – ${formatHotkeys(hotkeys)}`;
9283
+ };
9284
+ /**
9285
+ * Checks whether a pressed `Digit` key falls within a numeric hotkey range such
9286
+ * as `1-9`.
9287
+ * @param keyCode - The `KeyboardEvent.code` to check (e.g. `Digit5`).
9288
+ * @param hotkey - The hotkey token, expected to be a single-digit range like `1-9`.
9289
+ * @returns True if the pressed digit lies within the inclusive range.
9290
+ */
9291
+ var isDigitKeyInRange = (keyCode, hotkey) => {
9292
+ if (hotkey.length !== 3 || !keyCode?.startsWith("Digit")) return false;
9293
+ const keyNumber = Number(keyCode.slice(5));
9294
+ const [lower, upper] = hotkey.split("-");
9295
+ return Boolean(lower) && Boolean(upper) && Number.parseInt(lower, 10) <= keyNumber && keyNumber <= Number.parseInt(upper, 10);
9296
+ };
9297
+ /**
9298
+ * Checks whether a keyboard event matches a hotkey definition. The last token is
9299
+ * treated as the character; any preceding tokens are modifiers. The special
9300
+ * `CtrlOrCmd` modifier resolves to the platform's primary modifier (Meta/`⌘` on
9301
+ * macOS, Ctrl elsewhere).
9302
+ * @param event - The keyboard event to check.
9303
+ * @param hotkeys - The ordered hotkey tokens (modifiers followed by the character).
9304
+ * @returns True if the event matches the given hotkey, otherwise false.
9305
+ */
9306
+ var match = (event, hotkeys) => {
9307
+ const { key, code, metaKey, ctrlKey, shiftKey, altKey } = event;
9308
+ const modifiers = hotkeys.slice();
9309
+ const character = modifiers.pop() ?? "";
9310
+ const ctrlOrMeta = isMac() ? "Meta" : "Ctrl";
9311
+ const platformModifiers = new Set(modifiers.map((modifier) => modifier === "CtrlOrCmd" ? ctrlOrMeta : modifier));
9312
+ const metaMatches = Boolean(metaKey) === platformModifiers.has("Meta");
9313
+ const ctrlMatches = Boolean(ctrlKey) === platformModifiers.has("Ctrl");
9314
+ const shiftMatches = Boolean(shiftKey) === platformModifiers.has("Shift");
9315
+ const altMatches = Boolean(altKey) === platformModifiers.has("Alt");
9316
+ const keysMatch = key.toUpperCase() === character.toUpperCase() || character.includes("-") && isDigitKeyInRange(code, character) || isMac() && character === "Delete" && key === "Backspace";
9317
+ return metaMatches && ctrlMatches && shiftMatches && altMatches && keysMatch;
9318
+ };
9319
+ /**
9320
+ * Returns the name of the primary modifier key for the current platform.
9321
+ */
9322
+ var getMetaOrCtrlKey = () => {
9323
+ return isMac() ? "metaKey" : "ctrlKey";
9324
+ };
9325
+ /**
9326
+ * Grouped keyboard-shortcut helpers, exposed as a single namespace for
9327
+ * ergonomic access (e.g. `hotkeys.formatHotkey`).
9328
+ */
9329
+ var hotkeys = {
9330
+ formatHotkeys,
9331
+ formatHotkey,
9332
+ getDefaultSeparator,
9333
+ hotkeyPlatform,
9334
+ textWithHotkeys,
9335
+ match
9336
+ };
9337
+ //#endregion
6772
9338
  //#region src/components/accessories/KeyboardShortcut/enums.ts
6773
9339
  var kdsKeyboardShortcutSize = {
6774
9340
  SMALL: "small",
6775
- MEDIUM: "medium"
9341
+ MEDIUM: "medium"
9342
+ };
9343
+ var kdsKeyboardShortcutSizes = Object.values(kdsKeyboardShortcutSize);
9344
+ //#endregion
9345
+ //#region src/components/accessories/KeyboardShortcut/KdsKeyboardShortcut.vue
9346
+ var KdsKeyboardShortcut_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9347
+ __name: "KdsKeyboardShortcut",
9348
+ props: {
9349
+ size: { default: () => kdsKeyboardShortcutSize.SMALL },
9350
+ shortcut: {},
9351
+ platform: {}
9352
+ },
9353
+ setup(__props) {
9354
+ const formattedHotkeys = computed(() => __props.shortcut.map((hotkey) => hotkeys.formatHotkey(hotkey, __props.platform)));
9355
+ return (_ctx, _cache) => {
9356
+ return openBlock(), createElementBlock("kbd", { class: normalizeClass(["kds-keyboard-shortcut", __props.size]) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(formattedHotkeys.value, (hotkey) => {
9357
+ return openBlock(), createElementBlock("kbd", {
9358
+ key: hotkey,
9359
+ class: "shortcut-item"
9360
+ }, toDisplayString(hotkey), 1);
9361
+ }), 128))], 2);
9362
+ };
9363
+ }
9364
+ }), [["__scopeId", "data-v-5a9d1e42"]]);
9365
+ //#endregion
9366
+ //#region src/components/accessories/LiveStatus/KdsLiveStatus.vue?vue&type=script&setup=true&lang.ts
9367
+ var _hoisted_1$73 = ["aria-label"];
9368
+ var _hoisted_2$45 = {
9369
+ key: 0,
9370
+ class: "label"
9371
+ };
9372
+ //#endregion
9373
+ //#region src/components/accessories/LiveStatus/KdsLiveStatus.vue
9374
+ var KdsLiveStatus_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9375
+ __name: "KdsLiveStatus",
9376
+ props: {
9377
+ status: { default: "red" },
9378
+ size: { default: "medium" },
9379
+ label: { default: "" },
9380
+ tooltip: {}
9381
+ },
9382
+ setup(__props) {
9383
+ const props = createPropsRestProxy(__props, [
9384
+ "status",
9385
+ "size",
9386
+ "label"
9387
+ ]);
9388
+ const accessibleTitle = computed(() => props.tooltip?.trim() || `Status is ${__props.status}`);
9389
+ return (_ctx, _cache) => {
9390
+ return withDirectives((openBlock(), createElementBlock("span", {
9391
+ class: normalizeClass([
9392
+ "kds-live-status",
9393
+ __props.status,
9394
+ `size-${__props.size}`
9395
+ ]),
9396
+ role: "img",
9397
+ "aria-label": accessibleTitle.value
9398
+ }, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "dot" }, null, -1)), __props.label ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$45, [createTextVNode(toDisplayString(__props.label), 1)])), [[
9399
+ unref(vKdsTooltip),
9400
+ __props.label,
9401
+ "truncated"
9402
+ ]]) : createCommentVNode("", true)], 10, _hoisted_1$73)), [[unref(vKdsTooltip), !__props.label ? accessibleTitle.value : void 0]]);
9403
+ };
9404
+ }
9405
+ }), [["__scopeId", "data-v-d5a7f94a"]]);
9406
+ //#endregion
9407
+ //#region src/components/accessories/LiveStatus/enums.ts
9408
+ var kdsLiveStatusStatus = {
9409
+ RED: "red",
9410
+ ORANGE: "orange",
9411
+ GREEN: "green",
9412
+ DISABLED: "disabled"
9413
+ };
9414
+ var kdsLiveStatusStatuses = Object.values(kdsLiveStatusStatus);
9415
+ var kdsLiveStatusSize = {
9416
+ LARGE: "large",
9417
+ MEDIUM: "medium",
9418
+ SMALL: "small"
9419
+ };
9420
+ var kdsLiveStatusSizes = Object.values(kdsLiveStatusSize);
9421
+ //#endregion
9422
+ //#region src/components/accessories/LoadingSpinner/KdsLoadingSpinner.vue?vue&type=script&setup=true&lang.ts
9423
+ var _hoisted_1$72 = ["data-style"];
9424
+ //#endregion
9425
+ //#region src/components/accessories/LoadingSpinner/KdsLoadingSpinner.vue
9426
+ var KdsLoadingSpinner_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9427
+ __name: "KdsLoadingSpinner",
9428
+ props: {
9429
+ size: { default: "medium" },
9430
+ variant: { default: "onSurface" }
9431
+ },
9432
+ setup(__props) {
9433
+ return (_ctx, _cache) => {
9434
+ return openBlock(), createElementBlock("svg", {
9435
+ class: normalizeClass(["kds-loading-spinner", __props.size]),
9436
+ "data-style": __props.variant,
9437
+ viewBox: "0 0 120 120"
9438
+ }, [..._cache[0] || (_cache[0] = [createElementVNode("circle", {
9439
+ class: "track",
9440
+ cx: "60",
9441
+ cy: "60",
9442
+ r: "50"
9443
+ }, null, -1), createElementVNode("circle", {
9444
+ class: "loader",
9445
+ cx: "60",
9446
+ cy: "60",
9447
+ r: "50"
9448
+ }, null, -1)])], 10, _hoisted_1$72);
9449
+ };
9450
+ }
9451
+ }), [["__scopeId", "data-v-ea91036d"]]);
9452
+ //#endregion
9453
+ //#region src/components/accessories/LoadingSpinner/enums.ts
9454
+ var kdsLoadingSpinnerVariant = {
9455
+ ON_PRIMARY: "onPrimary",
9456
+ ON_SURFACE: "onSurface"
9457
+ };
9458
+ var kdsLoadingSpinnerVariants = Object.values(kdsLoadingSpinnerVariant);
9459
+ //#endregion
9460
+ //#region src/components/accessories/MissingValueIcon/KdsMissingValueIcon.vue
9461
+ var KdsMissingValueIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9462
+ __name: "KdsMissingValueIcon",
9463
+ props: { size: {} },
9464
+ setup(__props) {
9465
+ return (_ctx, _cache) => {
9466
+ return openBlock(), createBlock(KdsIcon_default, {
9467
+ name: "circle-question",
9468
+ size: __props.size,
9469
+ class: "kds-missing-value-icon"
9470
+ }, null, 8, ["size"]);
9471
+ };
9472
+ }
9473
+ }), [["__scopeId", "data-v-e6901949"]]);
9474
+ //#endregion
9475
+ //#region src/components/accessories/DonutChart/KdsDonutChart.vue?vue&type=script&setup=true&lang.ts
9476
+ var _hoisted_1$71 = { class: "donut-container" };
9477
+ var _hoisted_2$44 = [
9478
+ "height",
9479
+ "width",
9480
+ "viewBox"
9481
+ ];
9482
+ var _hoisted_3$31 = ["r", "stroke-width"];
9483
+ var _hoisted_4$27 = [
9484
+ "r",
9485
+ "stroke-width",
9486
+ "stroke-dasharray",
9487
+ "stroke-dashoffset",
9488
+ "transform"
9489
+ ];
9490
+ var _hoisted_5$15 = [
9491
+ "r",
9492
+ "stroke-width",
9493
+ "stroke-dasharray",
9494
+ "stroke-dashoffset",
9495
+ "transform"
9496
+ ];
9497
+ var _hoisted_6$11 = {
9498
+ key: 0,
9499
+ class: "donut-text"
9500
+ };
9501
+ var _hoisted_7$3 = { class: "title" };
9502
+ var _hoisted_8$3 = {
9503
+ key: 0,
9504
+ class: "sub-text"
9505
+ };
9506
+ var radius = 22;
9507
+ var innerRadius = 10;
9508
+ //#endregion
9509
+ //#region src/components/accessories/DonutChart/KdsDonutChart.vue
9510
+ var KdsDonutChart_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9511
+ __name: "KdsDonutChart",
9512
+ props: {
9513
+ value: {},
9514
+ secondaryValue: { default: 0 },
9515
+ maxValue: {},
9516
+ acceptValuesLargerThanMax: {
9517
+ type: Boolean,
9518
+ default: false
9519
+ },
9520
+ animate: {
9521
+ type: Boolean,
9522
+ default: true
9523
+ },
9524
+ label: {},
9525
+ subText: {}
9526
+ },
9527
+ setup(__props) {
9528
+ const clippedValue = computed(() => {
9529
+ const clipValue = Math.max(0, __props.value);
9530
+ return __props.acceptValuesLargerThanMax ? clipValue : Math.min(clipValue, __props.maxValue);
9531
+ });
9532
+ const secondaryClippedValue = computed(() => {
9533
+ const clipValue = Math.max(0, __props.secondaryValue + clippedValue.value);
9534
+ return __props.acceptValuesLargerThanMax ? clipValue : Math.min(clipValue, __props.maxValue);
9535
+ });
9536
+ const strokeWidth = computed(() => radius - innerRadius);
9537
+ const r = computed(() => radius - strokeWidth.value / 2);
9538
+ const diameter = computed(() => 2 * radius);
9539
+ const viewBox = computed(() => `0 0 ${diameter.value} ${diameter.value}`);
9540
+ const circumference = computed(() => 2 * Math.PI * r.value);
9541
+ const calcStrokeDashOffset = (value) => {
9542
+ if (__props.maxValue <= 0 || !Number.isFinite(__props.maxValue)) return circumference.value;
9543
+ const strokeDiff = Math.min(value / __props.maxValue * circumference.value, circumference.value);
9544
+ return Math.max(circumference.value - strokeDiff, 0);
9545
+ };
9546
+ const strokeDashOffset = computed(() => calcStrokeDashOffset(clippedValue.value));
9547
+ const secondaryStrokeDashOffset = computed(() => calcStrokeDashOffset(secondaryClippedValue.value));
9548
+ const transformWedge = computed(() => `rotate(-90, ${radius}, ${radius})`);
9549
+ const disabled = computed(() => !Number.isFinite(__props.maxValue));
9550
+ return (_ctx, _cache) => {
9551
+ return openBlock(), createElementBlock("div", _hoisted_1$71, [(openBlock(), createElementBlock("svg", {
9552
+ height: diameter.value,
9553
+ width: diameter.value,
9554
+ viewBox: viewBox.value,
9555
+ class: "donut-chart"
9556
+ }, [
9557
+ createElementVNode("circle", {
9558
+ class: "background-circle",
9559
+ cx: radius,
9560
+ cy: radius,
9561
+ r: r.value,
9562
+ "stroke-width": strokeWidth.value,
9563
+ fill: "transparent"
9564
+ }, null, 8, _hoisted_3$31),
9565
+ __props.secondaryValue && !disabled.value ? (openBlock(), createElementBlock("circle", {
9566
+ key: 0,
9567
+ class: normalizeClass([
9568
+ "value-wedge",
9569
+ "secondary-circle",
9570
+ { animate: __props.animate }
9571
+ ]),
9572
+ cx: radius,
9573
+ cy: radius,
9574
+ r: r.value,
9575
+ "stroke-width": strokeWidth.value,
9576
+ "stroke-dasharray": circumference.value,
9577
+ "stroke-dashoffset": secondaryStrokeDashOffset.value,
9578
+ fill: "transparent",
9579
+ transform: transformWedge.value
9580
+ }, null, 10, _hoisted_4$27)) : createCommentVNode("", true),
9581
+ !disabled.value ? (openBlock(), createElementBlock("circle", {
9582
+ key: 1,
9583
+ class: normalizeClass([
9584
+ "value-wedge",
9585
+ "primary-circle",
9586
+ { animate: __props.animate }
9587
+ ]),
9588
+ cx: radius,
9589
+ cy: radius,
9590
+ r: r.value,
9591
+ "stroke-width": strokeWidth.value,
9592
+ "stroke-dasharray": circumference.value,
9593
+ "stroke-dashoffset": strokeDashOffset.value,
9594
+ fill: "transparent",
9595
+ transform: transformWedge.value
9596
+ }, null, 10, _hoisted_5$15)) : createCommentVNode("", true)
9597
+ ], 8, _hoisted_2$44)), __props.label ? (openBlock(), createElementBlock("div", _hoisted_6$11, [createElementVNode("div", _hoisted_7$3, toDisplayString(__props.label), 1), __props.subText ? (openBlock(), createElementBlock("div", _hoisted_8$3, toDisplayString(__props.subText), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true)]);
9598
+ };
9599
+ }
9600
+ }), [["__scopeId", "data-v-93590a62"]]);
9601
+ //#endregion
9602
+ //#region src/components/accessories/Text/KdsTextHighlight/KdsTextHighlight.vue?vue&type=script&setup=true&lang.ts
9603
+ var _hoisted_1$70 = { class: "kds-highlighted-text" };
9604
+ var _hoisted_2$43 = {
9605
+ key: 0,
9606
+ class: "kds-highlighted-text-match"
9607
+ };
9608
+ //#endregion
9609
+ //#region src/components/accessories/Text/KdsTextHighlight/KdsTextHighlight.vue
9610
+ var KdsTextHighlight_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9611
+ __name: "KdsTextHighlight",
9612
+ props: {
9613
+ text: {},
9614
+ term: { default: "" }
9615
+ },
9616
+ setup(__props) {
9617
+ const segments = computed(() => {
9618
+ if (!__props.term) return [{
9619
+ text: __props.text,
9620
+ match: false
9621
+ }];
9622
+ const lowerText = __props.text.toLowerCase();
9623
+ const lowerTerm = __props.term.toLowerCase();
9624
+ const result = [];
9625
+ let cursor = 0;
9626
+ while (cursor < __props.text.length) {
9627
+ const index = lowerText.indexOf(lowerTerm, cursor);
9628
+ if (index === -1) {
9629
+ result.push({
9630
+ text: __props.text.slice(cursor),
9631
+ match: false
9632
+ });
9633
+ break;
9634
+ }
9635
+ if (index > cursor) result.push({
9636
+ text: __props.text.slice(cursor, index),
9637
+ match: false
9638
+ });
9639
+ result.push({
9640
+ text: __props.text.slice(index, index + __props.term.length),
9641
+ match: true
9642
+ });
9643
+ cursor = index + __props.term.length;
9644
+ }
9645
+ return result;
9646
+ });
9647
+ return (_ctx, _cache) => {
9648
+ return openBlock(), createElementBlock("span", _hoisted_1$70, [(openBlock(true), createElementBlock(Fragment, null, renderList(segments.value, (segment, index) => {
9649
+ return openBlock(), createElementBlock(Fragment, { key: index }, [segment.match ? (openBlock(), createElementBlock("mark", _hoisted_2$43, toDisplayString(segment.text), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(segment.text), 1)], 64))], 64);
9650
+ }), 128))]);
9651
+ };
9652
+ }
9653
+ }), [["__scopeId", "data-v-a2202598"]]);
9654
+ //#endregion
9655
+ //#region src/components/accessories/Divider/KdsDivider.vue
9656
+ var _sfc_main = {};
9657
+ var _hoisted_1$69 = { class: "kds-divider" };
9658
+ function _sfc_render$1(_ctx, _cache) {
9659
+ return openBlock(), createElementBlock("hr", _hoisted_1$69);
9660
+ }
9661
+ var KdsDivider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render$1], ["__scopeId", "data-v-dead6417"]]);
9662
+ //#endregion
9663
+ //#region src/components/accessories/_Accessory/enums.ts
9664
+ var kdsAccessoryType = {
9665
+ ICON: "icon",
9666
+ DATA_TYPE: "dataType",
9667
+ COLOR_SWATCH: "colorSwatch",
9668
+ LIVE_STATUS: "liveStatus",
9669
+ AVATAR: "avatar",
9670
+ PORT: "port"
9671
+ };
9672
+ var kdsAccessoryTypes = Object.values(kdsAccessoryType);
9673
+ var kdsAccessorySize = {
9674
+ SMALL: "small",
9675
+ MEDIUM: "medium",
9676
+ LARGE: "large"
9677
+ };
9678
+ var kdsAccessorySizes = Object.values(kdsAccessorySize);
9679
+ //#endregion
9680
+ //#region src/components/buttons/BaseButton.vue?vue&type=script&setup=true&lang.ts
9681
+ var _hoisted_1$68 = {
9682
+ key: 0,
9683
+ class: "label"
9684
+ };
9685
+ //#endregion
9686
+ //#region src/components/buttons/BaseButton.vue
9687
+ var BaseButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9688
+ __name: "BaseButton",
9689
+ props: {
9690
+ dataTestId: {},
9691
+ size: { default: "medium" },
9692
+ disabled: {
9693
+ type: Boolean,
9694
+ default: false
9695
+ },
9696
+ tooltip: {},
9697
+ variant: {},
9698
+ label: {},
9699
+ leadingIcon: {},
9700
+ trailingIcon: {},
9701
+ ariaLabel: {},
9702
+ destructive: {
9703
+ type: Boolean,
9704
+ default: false
9705
+ },
9706
+ success: {
9707
+ type: Boolean,
9708
+ default: false
9709
+ },
9710
+ error: {
9711
+ type: Boolean,
9712
+ default: false
9713
+ },
9714
+ toggled: {
9715
+ type: Boolean,
9716
+ default: false
9717
+ },
9718
+ removeBorderRadius: { default: () => void 0 },
9719
+ component: { default: "button" }
9720
+ },
9721
+ emits: ["click"],
9722
+ setup(__props, { emit: __emit }) {
9723
+ const props = createPropsRestProxy(__props, [
9724
+ "component",
9725
+ "size",
9726
+ "destructive",
9727
+ "success",
9728
+ "error",
9729
+ "disabled",
9730
+ "toggled",
9731
+ "removeBorderRadius"
9732
+ ]);
9733
+ const emit = __emit;
9734
+ const classes = computed(() => [
9735
+ "button",
9736
+ __props.size,
9737
+ props.variant,
9738
+ { destructive: __props.destructive },
9739
+ { disabled: __props.disabled },
9740
+ { toggled: __props.toggled },
9741
+ { success: __props.success },
9742
+ { error: __props.error },
9743
+ __props.removeBorderRadius ? `remove-border-radius-${__props.removeBorderRadius}` : void 0
9744
+ ]);
9745
+ const iconSize = computed(() => {
9746
+ if (__props.size === "xsmall") return "small";
9747
+ else return __props.size;
9748
+ });
9749
+ function onClick(e) {
9750
+ if (!__props.disabled) emit("click", e);
9751
+ }
9752
+ return (_ctx, _cache) => {
9753
+ return withDirectives((openBlock(), createBlock(resolveDynamicComponent(__props.component), {
9754
+ type: __props.component === "button" ? "button" : void 0,
9755
+ class: normalizeClass(classes.value),
9756
+ disabled: __props.disabled,
9757
+ "aria-label": props.ariaLabel,
9758
+ "data-test-id": props.dataTestId,
9759
+ onClick: _cache[0] || (_cache[0] = ($event) => onClick($event))
9760
+ }, {
9761
+ default: withCtx(() => [
9762
+ renderSlot(_ctx.$slots, "leading", {}, () => [props.leadingIcon ? (openBlock(), createBlock(KdsIcon_default, {
9763
+ key: 0,
9764
+ name: props.leadingIcon,
9765
+ size: iconSize.value
9766
+ }, null, 8, ["name", "size"])) : createCommentVNode("", true)], true),
9767
+ props.label ? (openBlock(), createElementBlock("span", _hoisted_1$68, toDisplayString(props.label), 1)) : createCommentVNode("", true),
9768
+ props.trailingIcon && props.label ? (openBlock(), createBlock(KdsIcon_default, {
9769
+ key: 1,
9770
+ name: props.trailingIcon,
9771
+ size: iconSize.value
9772
+ }, null, 8, ["name", "size"])) : createCommentVNode("", true)
9773
+ ]),
9774
+ _: 3
9775
+ }, 8, [
9776
+ "type",
9777
+ "class",
9778
+ "disabled",
9779
+ "aria-label",
9780
+ "data-test-id"
9781
+ ])), [[unref(vKdsTooltip), props.tooltip]]);
9782
+ };
9783
+ }
9784
+ }), [["__scopeId", "data-v-afad70c2"]]);
9785
+ //#endregion
9786
+ //#region src/components/buttons/KdsButton/KdsButton.vue
9787
+ var KdsButton_default = /* @__PURE__ */ defineComponent({
9788
+ __name: "KdsButton",
9789
+ props: {
9790
+ dataTestId: {},
9791
+ size: {},
9792
+ disabled: { type: Boolean },
9793
+ tooltip: {},
9794
+ variant: { default: "filled" },
9795
+ label: {},
9796
+ leadingIcon: {},
9797
+ trailingIcon: {},
9798
+ ariaLabel: {},
9799
+ destructive: { type: Boolean }
9800
+ },
9801
+ emits: ["click"],
9802
+ setup(__props, { emit: __emit }) {
9803
+ const props = createPropsRestProxy(__props, ["variant"]);
9804
+ const emit = __emit;
9805
+ return (_ctx, _cache) => {
9806
+ return openBlock(), createBlock(BaseButton_default, mergeProps(props, {
9807
+ variant: __props.variant,
9808
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
9809
+ }), null, 16, ["variant"]);
9810
+ };
9811
+ }
9812
+ });
9813
+ //#endregion
9814
+ //#region src/util/nuxtComponentResolver.ts
9815
+ var getAppInstance = () => {
9816
+ return getCurrentInstance()?.appContext.app;
9817
+ };
9818
+ var resolveNuxtLinkComponent = () => {
9819
+ const app = getAppInstance();
9820
+ const nuxtLinkComponent = app?.component("NuxtLink");
9821
+ if (nuxtLinkComponent) return nuxtLinkComponent;
9822
+ const routerLinkComponent = app?.component("RouterLink");
9823
+ if (routerLinkComponent) return routerLinkComponent;
9824
+ return defineComponent({
9825
+ props: { to: {
9826
+ type: String,
9827
+ default: ""
9828
+ } },
9829
+ render() {
9830
+ return h("a", { href: this.to }, [useSlots().default?.()]);
9831
+ }
9832
+ });
6776
9833
  };
6777
- var kdsKeyboardShortcutSizes = Object.values(kdsKeyboardShortcutSize);
6778
9834
  //#endregion
6779
- //#region src/components/accessories/KeyboardShortcut/KdsKeyboardShortcut.vue
6780
- var KdsKeyboardShortcut_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6781
- __name: "KdsKeyboardShortcut",
9835
+ //#region src/components/buttons/links/linkUtils.ts
9836
+ function isExternalUrl(url) {
9837
+ const normalized = url.trim();
9838
+ if (!normalized) return false;
9839
+ if (normalized.startsWith("#") || normalized.startsWith("/") && !normalized.startsWith("//") || normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("?")) return false;
9840
+ return true;
9841
+ }
9842
+ //#endregion
9843
+ //#region src/components/buttons/links/KdsLinkButton/KdsLinkButton.vue
9844
+ var KdsLinkButton_default = /* @__PURE__ */ defineComponent({
9845
+ __name: "KdsLinkButton",
6782
9846
  props: {
6783
- size: { default: () => kdsKeyboardShortcutSize.SMALL },
6784
- shortcut: {},
6785
- platform: {}
9847
+ dataTestId: {},
9848
+ size: {},
9849
+ disabled: {
9850
+ type: Boolean,
9851
+ default: false
9852
+ },
9853
+ tooltip: {},
9854
+ variant: { default: "filled" },
9855
+ label: {},
9856
+ leadingIcon: {},
9857
+ trailingIcon: {},
9858
+ ariaLabel: {},
9859
+ destructive: { type: Boolean },
9860
+ to: {},
9861
+ download: {
9862
+ type: Boolean,
9863
+ default: () => void 0
9864
+ },
9865
+ target: { default: null },
9866
+ rel: { default: null }
6786
9867
  },
6787
- setup(__props) {
6788
- const formattedHotkeys = computed(() => __props.shortcut.map((hotkey) => hotkeys.formatHotkey(hotkey, __props.platform)));
9868
+ emits: ["click"],
9869
+ setup(__props, { emit: __emit }) {
9870
+ const rawProps = createPropsRestProxy(__props, [
9871
+ "variant",
9872
+ "disabled",
9873
+ "download",
9874
+ "rel",
9875
+ "target"
9876
+ ]);
9877
+ const props = computed(() => {
9878
+ if (isExternalUrl(rawProps.to)) return {
9879
+ ...rawProps,
9880
+ trailingIcon: "external-link"
9881
+ };
9882
+ return rawProps;
9883
+ });
9884
+ const component = computed(() => {
9885
+ if (__props.disabled) return "button";
9886
+ return resolveNuxtLinkComponent();
9887
+ });
9888
+ const emit = __emit;
6789
9889
  return (_ctx, _cache) => {
6790
- return openBlock(), createElementBlock("kbd", { class: normalizeClass(["kds-keyboard-shortcut", __props.size]) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(formattedHotkeys.value, (hotkey) => {
6791
- return openBlock(), createElementBlock("kbd", {
6792
- key: hotkey,
6793
- class: "shortcut-item"
6794
- }, toDisplayString(hotkey), 1);
6795
- }), 128))], 2);
9890
+ return openBlock(), createBlock(BaseButton_default, mergeProps(props.value, {
9891
+ variant: __props.variant,
9892
+ disabled: __props.disabled,
9893
+ download: __props.download,
9894
+ rel: __props.rel,
9895
+ target: __props.target,
9896
+ component: component.value,
9897
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
9898
+ }), null, 16, [
9899
+ "variant",
9900
+ "disabled",
9901
+ "download",
9902
+ "rel",
9903
+ "target",
9904
+ "component"
9905
+ ]);
6796
9906
  };
6797
9907
  }
6798
- }), [["__scopeId", "data-v-5a9d1e42"]]);
9908
+ });
6799
9909
  //#endregion
6800
- //#region src/components/accessories/LiveStatus/KdsLiveStatus.vue?vue&type=script&setup=true&lang.ts
6801
- var _hoisted_1$65 = ["aria-label"];
6802
- var _hoisted_2$41 = {
9910
+ //#region ../styles/dist/img/icons/external-link.svg?url
9911
+ var external_link_default = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20stroke='currentColor'%20stroke-linecap='round'%20stroke-linejoin='round'%20viewBox='0%200%2012%2012'%3e%3cpath%20d='M5.5%201.5h-3a1%201%200%200%200-1%201v7a1%201%200%200%200%201%201h7a1%201%200%200%200%201-1v-3m0-5L6%205.892M10.5%201.5v2.75m0-2.75H7.75'%20vector-effect='non-scaling-stroke'/%3e%3c/svg%3e";
9912
+ //#endregion
9913
+ //#region src/layouts/overlays/Modal/enums.ts
9914
+ var kdsModalClosedBy = {
9915
+ ANY: "any",
9916
+ CLOSEREQUEST: "closerequest",
9917
+ NONE: "none"
9918
+ };
9919
+ var kdsModalClosedByOptions = Object.values(kdsModalClosedBy);
9920
+ var kdsModalWidth = {
9921
+ SMALL: "small",
9922
+ MEDIUM: "medium",
9923
+ LARGE: "large",
9924
+ XLARGE: "xlarge",
9925
+ FULL: "full"
9926
+ };
9927
+ var kdsModalWidthSizes = Object.values(kdsModalWidth);
9928
+ var kdsModalHeight = {
9929
+ AUTO: "auto",
9930
+ FULL: "full"
9931
+ };
9932
+ var kdsModalHeightSizes = Object.values(kdsModalHeight);
9933
+ var kdsModalVariant = {
9934
+ PADDED: "padded",
9935
+ PLAIN: "plain"
9936
+ };
9937
+ var kdsModalVariants = Object.values(kdsModalVariant);
9938
+ var kdsModalLayoutPropsDefault = {
9939
+ headline: "",
9940
+ variant: kdsModalVariant.PADDED,
9941
+ overflow: "auto",
9942
+ leadingIcon: void 0
9943
+ };
9944
+ kdsModalHeight.AUTO, kdsModalWidth.MEDIUM, kdsModalClosedBy.CLOSEREQUEST, { ...kdsModalLayoutPropsDefault };
9945
+ //#endregion
9946
+ //#region src/layouts/overlays/Modal/KdsModalLayout.vue?vue&type=script&setup=true&lang.ts
9947
+ var _hoisted_1$67 = { class: "modal-header" };
9948
+ var _hoisted_2$42 = { class: "modal-header-headline" };
9949
+ var _hoisted_3$30 = ["data-variant"];
9950
+ var _hoisted_4$26 = {
6803
9951
  key: 0,
6804
- class: "label"
9952
+ class: "modal-footer"
6805
9953
  };
6806
9954
  //#endregion
6807
- //#region src/components/accessories/LiveStatus/KdsLiveStatus.vue
6808
- var KdsLiveStatus_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6809
- __name: "KdsLiveStatus",
9955
+ //#region src/layouts/overlays/Modal/KdsModalLayout.vue
9956
+ var KdsModalLayout_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
9957
+ inheritAttrs: false,
9958
+ __name: "KdsModalLayout",
6810
9959
  props: {
6811
- status: { default: "red" },
6812
- size: { default: "medium" },
6813
- label: { default: "" },
6814
- tooltip: {}
9960
+ headline: { default: "" },
9961
+ variant: { default: () => kdsModalVariant.PADDED },
9962
+ leadingIcon: {},
9963
+ overflow: { default: "auto" },
9964
+ onClose: { type: Function }
6815
9965
  },
6816
9966
  setup(__props) {
9967
+ useCssVars((_ctx) => ({ "v4b5bb7fa": _ctx.overflow }));
6817
9968
  const props = createPropsRestProxy(__props, [
6818
- "status",
6819
- "size",
6820
- "label"
9969
+ "headline",
9970
+ "variant",
9971
+ "overflow"
6821
9972
  ]);
6822
- const accessibleTitle = computed(() => props.tooltip?.trim() || `Status is ${__props.status}`);
6823
9973
  return (_ctx, _cache) => {
6824
- return withDirectives((openBlock(), createElementBlock("span", {
6825
- class: normalizeClass([
6826
- "kds-live-status",
6827
- __props.status,
6828
- `size-${__props.size}`
9974
+ return openBlock(), createElementBlock(Fragment, null, [
9975
+ createElementVNode("header", _hoisted_1$67, [
9976
+ props.leadingIcon ? (openBlock(), createBlock(KdsIcon_default, {
9977
+ key: 0,
9978
+ name: props.leadingIcon,
9979
+ size: "medium"
9980
+ }, null, 8, ["name"])) : createCommentVNode("", true),
9981
+ createElementVNode("div", _hoisted_2$42, toDisplayString(__props.headline), 1),
9982
+ createVNode(KdsButton_default, {
9983
+ "leading-icon": "x-close",
9984
+ variant: "transparent",
9985
+ size: "medium",
9986
+ tooltip: "Close",
9987
+ ariaLabel: "Close",
9988
+ onClick: props.onClose
9989
+ }, null, 8, ["onClick"])
6829
9990
  ]),
6830
- role: "img",
6831
- "aria-label": accessibleTitle.value
6832
- }, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "dot" }, null, -1)), __props.label ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$41, [createTextVNode(toDisplayString(__props.label), 1)])), [[
6833
- unref(vKdsTooltip),
6834
- __props.label,
6835
- "truncated"
6836
- ]]) : createCommentVNode("", true)], 10, _hoisted_1$65)), [[unref(vKdsTooltip), !__props.label ? accessibleTitle.value : void 0]]);
9991
+ createElementVNode("div", {
9992
+ class: "modal-body",
9993
+ "data-variant": __props.variant
9994
+ }, [renderSlot(_ctx.$slots, "body", {}, void 0, true)], 8, _hoisted_3$30),
9995
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_4$26, [renderSlot(_ctx.$slots, "footer", {}, void 0, true)])) : createCommentVNode("", true)
9996
+ ], 64);
6837
9997
  };
6838
9998
  }
6839
- }), [["__scopeId", "data-v-d5a7f94a"]]);
9999
+ }), [["__scopeId", "data-v-3e1612e8"]]);
6840
10000
  //#endregion
6841
- //#region src/components/accessories/LiveStatus/enums.ts
6842
- var kdsLiveStatusStatus = {
6843
- RED: "red",
6844
- ORANGE: "orange",
6845
- GREEN: "green",
6846
- DISABLED: "disabled"
6847
- };
6848
- var kdsLiveStatusStatuses = Object.values(kdsLiveStatusStatus);
6849
- var kdsLiveStatusSize = {
6850
- LARGE: "large",
6851
- MEDIUM: "medium",
6852
- SMALL: "small"
6853
- };
6854
- var kdsLiveStatusSizes = Object.values(kdsLiveStatusSize);
10001
+ //#region src/layouts/overlays/Modal/KdsModal.vue?vue&type=script&setup=true&lang.ts
10002
+ var _hoisted_1$66 = ["closedby"];
6855
10003
  //#endregion
6856
- //#region src/components/accessories/LoadingSpinner/enums.ts
6857
- var kdsLoadingSpinnerVariant = {
6858
- ON_PRIMARY: "onPrimary",
6859
- ON_SURFACE: "onSurface"
6860
- };
6861
- var kdsLoadingSpinnerVariants = Object.values(kdsLoadingSpinnerVariant);
10004
+ //#region src/layouts/overlays/Modal/KdsModal.vue
10005
+ var KdsModal_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
10006
+ __name: "KdsModal",
10007
+ props: {
10008
+ leadingIcon: {},
10009
+ headline: { default: "" },
10010
+ variant: { default: () => kdsModalVariant.PADDED },
10011
+ width: { default: () => kdsModalWidth.MEDIUM },
10012
+ height: { default: () => kdsModalHeight.AUTO },
10013
+ active: {
10014
+ type: Boolean,
10015
+ default: false
10016
+ },
10017
+ closedby: { default: () => kdsModalClosedBy.CLOSEREQUEST },
10018
+ overflow: { default: "auto" }
10019
+ },
10020
+ emits: ["close", "closed"],
10021
+ setup(__props, { emit: __emit }) {
10022
+ useCssVars((_ctx) => ({ "v366b75ef": _ctx.overflow }));
10023
+ const emit = __emit;
10024
+ const dialog = useTemplateRef("dialogElement");
10025
+ const onClose = (event) => {
10026
+ emit("close", event);
10027
+ };
10028
+ watch(() => __props.active, async (isActive) => {
10029
+ if (isActive) {
10030
+ await nextTick();
10031
+ dialog.value?.showModal();
10032
+ } else dialog.value?.close();
10033
+ }, { immediate: true });
10034
+ const renderDialog = ref(__props.active);
10035
+ const removeDialog = () => {
10036
+ if (!renderDialog.value) return;
10037
+ renderDialog.value = false;
10038
+ emit("closed");
10039
+ };
10040
+ watch(() => __props.active, async (value, lastValue) => {
10041
+ if (value === false && lastValue === true) if (dialog.value) {
10042
+ Promise.all(dialog.value.getAnimations({ subtree: true }).map((animation) => animation.finished)).then(removeDialog).catch((error) => {
10043
+ if (error.name === "AbortError") {
10044
+ removeDialog();
10045
+ return;
10046
+ }
10047
+ throw error;
10048
+ });
10049
+ await sleep(350);
10050
+ removeDialog();
10051
+ } else removeDialog();
10052
+ else renderDialog.value = value;
10053
+ });
10054
+ return (_ctx, _cache) => {
10055
+ return renderDialog.value ? (openBlock(), createElementBlock("dialog", {
10056
+ key: 0,
10057
+ ref: "dialogElement",
10058
+ class: normalizeClass([
10059
+ "kds-modal",
10060
+ `width-${__props.width}`,
10061
+ `height-${__props.height}`,
10062
+ `overflow-${__props.overflow}`
10063
+ ]),
10064
+ closedby: __props.closedby,
10065
+ onCancel: withModifiers(onClose, ["prevent"])
10066
+ }, [renderSlot(_ctx.$slots, "default", {
10067
+ headline: __props.headline,
10068
+ leadingIcon: __props.leadingIcon,
10069
+ variant: __props.variant,
10070
+ overflow: __props.overflow,
10071
+ onClose
10072
+ }, () => [createVNode(KdsModalLayout_default, {
10073
+ headline: __props.headline,
10074
+ "leading-icon": __props.leadingIcon,
10075
+ variant: __props.variant,
10076
+ overflow: __props.overflow,
10077
+ onClose
10078
+ }, {
10079
+ body: withCtx(() => [renderSlot(_ctx.$slots, "body", {}, void 0, true)]),
10080
+ footer: withCtx(() => [renderSlot(_ctx.$slots, "footer", {}, void 0, true)]),
10081
+ _: 3
10082
+ }, 8, [
10083
+ "headline",
10084
+ "leading-icon",
10085
+ "variant",
10086
+ "overflow"
10087
+ ])], true)], 42, _hoisted_1$66)) : createCommentVNode("", true);
10088
+ };
10089
+ }
10090
+ }), [["__scopeId", "data-v-a56c7085"]]);
6862
10091
  //#endregion
6863
- //#region src/components/accessories/MissingValueIcon/KdsMissingValueIcon.vue
6864
- var KdsMissingValueIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6865
- __name: "KdsMissingValueIcon",
6866
- props: { size: {} },
10092
+ //#region src/components/forms/_helper/KdsSubText.vue?vue&type=script&setup=true&lang.ts
10093
+ var _hoisted_1$65 = ["id"];
10094
+ var _hoisted_2$41 = { class: "subtext-text" };
10095
+ //#endregion
10096
+ //#region src/components/forms/_helper/KdsSubText.vue
10097
+ var KdsSubText_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
10098
+ __name: "KdsSubText",
10099
+ props: {
10100
+ id: {},
10101
+ subText: {},
10102
+ error: {
10103
+ type: Boolean,
10104
+ default: false
10105
+ },
10106
+ warning: {
10107
+ type: Boolean,
10108
+ default: false
10109
+ },
10110
+ validating: {
10111
+ type: Boolean,
10112
+ default: false
10113
+ },
10114
+ preserveSubTextSpace: {
10115
+ type: Boolean,
10116
+ default: false
10117
+ }
10118
+ },
6867
10119
  setup(__props) {
10120
+ const props = createPropsRestProxy(__props, [
10121
+ "error",
10122
+ "warning",
10123
+ "validating",
10124
+ "preserveSubTextSpace"
10125
+ ]);
6868
10126
  return (_ctx, _cache) => {
6869
- return openBlock(), createBlock(KdsIcon_default, {
6870
- name: "circle-question",
6871
- size: __props.size,
6872
- class: "kds-missing-value-icon"
6873
- }, null, 8, ["size"]);
10127
+ return props.subText || __props.preserveSubTextSpace ? (openBlock(), createElementBlock("div", {
10128
+ key: 0,
10129
+ id: props.id,
10130
+ class: normalizeClass({
10131
+ subtext: true,
10132
+ error: __props.error,
10133
+ warning: __props.warning && !__props.error
10134
+ })
10135
+ }, [__props.error && props.subText ? (openBlock(), createBlock(KdsIcon_default, {
10136
+ key: 0,
10137
+ name: "circle-error",
10138
+ size: "small",
10139
+ "aria-label": "Error"
10140
+ })) : __props.warning && props.subText ? (openBlock(), createBlock(KdsIcon_default, {
10141
+ key: 1,
10142
+ name: "warning",
10143
+ size: "small",
10144
+ "aria-label": "Warning"
10145
+ })) : __props.validating && props.subText ? (openBlock(), createBlock(KdsLoadingSpinner_default, {
10146
+ key: 2,
10147
+ size: "small",
10148
+ variant: "onSurface",
10149
+ "aria-hidden": "true"
10150
+ })) : createCommentVNode("", true), createElementVNode("span", _hoisted_2$41, toDisplayString(props.subText), 1)], 10, _hoisted_1$65)) : createCommentVNode("", true);
6874
10151
  };
6875
10152
  }
6876
- }), [["__scopeId", "data-v-e6901949"]]);
10153
+ }), [["__scopeId", "data-v-295b2828"]]);
6877
10154
  //#endregion
6878
- //#region src/components/accessories/DonutChart/KdsDonutChart.vue?vue&type=script&setup=true&lang.ts
6879
- var _hoisted_1$64 = { class: "donut-container" };
6880
- var _hoisted_2$40 = [
6881
- "height",
6882
- "width",
6883
- "viewBox"
6884
- ];
6885
- var _hoisted_3$28 = ["r", "stroke-width"];
6886
- var _hoisted_4$25 = [
6887
- "r",
6888
- "stroke-width",
6889
- "stroke-dasharray",
6890
- "stroke-dashoffset",
6891
- "transform"
6892
- ];
6893
- var _hoisted_5$14 = [
6894
- "r",
6895
- "stroke-width",
6896
- "stroke-dasharray",
6897
- "stroke-dashoffset",
6898
- "transform"
10155
+ //#region src/components/forms/Checkbox/BaseCheckbox.vue?vue&type=script&setup=true&lang.ts
10156
+ var _hoisted_1$64 = [
10157
+ "disabled",
10158
+ "aria-label",
10159
+ "aria-checked",
10160
+ "aria-describedby",
10161
+ "aria-invalid"
6899
10162
  ];
6900
- var _hoisted_6$10 = {
10163
+ var _hoisted_2$40 = { class: "control" };
10164
+ var _hoisted_3$29 = {
6901
10165
  key: 0,
6902
- class: "donut-text"
10166
+ class: "content"
6903
10167
  };
6904
- var _hoisted_7$3 = { class: "title" };
6905
- var _hoisted_8$3 = {
10168
+ var _hoisted_4$25 = { class: "label" };
10169
+ var _hoisted_5$14 = ["id"];
10170
+ var _hoisted_6$10 = {
6906
10171
  key: 0,
6907
- class: "sub-text"
10172
+ class: "subtext-wrapper"
6908
10173
  };
6909
- var radius = 22;
6910
- var innerRadius = 10;
6911
10174
  //#endregion
6912
- //#region src/components/accessories/DonutChart/KdsDonutChart.vue
6913
- var KdsDonutChart_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6914
- __name: "KdsDonutChart",
6915
- props: {
6916
- value: {},
6917
- secondaryValue: { default: 0 },
6918
- maxValue: {},
6919
- acceptValuesLargerThanMax: {
10175
+ //#region src/components/forms/Checkbox/BaseCheckbox.vue
10176
+ var BaseCheckbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
10177
+ __name: "BaseCheckbox",
10178
+ props: /*@__PURE__*/ mergeModels({
10179
+ disabled: {
6920
10180
  type: Boolean,
6921
10181
  default: false
6922
10182
  },
6923
- animate: {
10183
+ error: {
6924
10184
  type: Boolean,
6925
- default: true
10185
+ default: false
6926
10186
  },
10187
+ subText: {},
10188
+ preserveSubTextSpace: { type: Boolean },
6927
10189
  label: {},
6928
- subText: {}
6929
- },
10190
+ tooltip: {},
10191
+ helperText: {}
10192
+ }, {
10193
+ "modelValue": { default: false },
10194
+ "modelModifiers": {}
10195
+ }),
10196
+ emits: ["update:modelValue"],
6930
10197
  setup(__props) {
6931
- const clippedValue = computed(() => {
6932
- const clipValue = Math.max(0, __props.value);
6933
- return __props.acceptValuesLargerThanMax ? clipValue : Math.min(clipValue, __props.maxValue);
10198
+ const props = createPropsRestProxy(__props, ["disabled", "error"]);
10199
+ const modelValue = useModel(__props, "modelValue");
10200
+ const helperId = useId();
10201
+ const descriptionId = useId();
10202
+ const isChecked = computed(() => modelValue.value === true);
10203
+ const isIndeterminate = computed(() => modelValue.value === "indeterminate");
10204
+ const icon = computed(() => {
10205
+ if (isChecked.value) return "checkmark";
10206
+ if (isIndeterminate.value) return "minus";
10207
+ return null;
6934
10208
  });
6935
- const secondaryClippedValue = computed(() => {
6936
- const clipValue = Math.max(0, __props.secondaryValue + clippedValue.value);
6937
- return __props.acceptValuesLargerThanMax ? clipValue : Math.min(clipValue, __props.maxValue);
10209
+ const ariaChecked = computed(() => {
10210
+ if (isIndeterminate.value) return "mixed";
10211
+ return isChecked.value;
6938
10212
  });
6939
- const strokeWidth = computed(() => radius - innerRadius);
6940
- const r = computed(() => radius - strokeWidth.value / 2);
6941
- const diameter = computed(() => 2 * radius);
6942
- const viewBox = computed(() => `0 0 ${diameter.value} ${diameter.value}`);
6943
- const circumference = computed(() => 2 * Math.PI * r.value);
6944
- const calcStrokeDashOffset = (value) => {
6945
- if (__props.maxValue <= 0 || !Number.isFinite(__props.maxValue)) return circumference.value;
6946
- const strokeDiff = Math.min(value / __props.maxValue * circumference.value, circumference.value);
6947
- return Math.max(circumference.value - strokeDiff, 0);
10213
+ const ariaDescribedBy = computed(() => {
10214
+ const ids = [];
10215
+ if (props.helperText) ids.push(helperId);
10216
+ if (props.subText) ids.push(descriptionId);
10217
+ return ids.length > 0 ? ids.join(" ") : void 0;
10218
+ });
10219
+ const handleClick = () => {
10220
+ if (__props.disabled) return;
10221
+ modelValue.value = isIndeterminate.value ? true : !isChecked.value;
6948
10222
  };
6949
- const strokeDashOffset = computed(() => calcStrokeDashOffset(clippedValue.value));
6950
- const secondaryStrokeDashOffset = computed(() => calcStrokeDashOffset(secondaryClippedValue.value));
6951
- const transformWedge = computed(() => `rotate(-90, ${radius}, ${radius})`);
6952
- const disabled = computed(() => !Number.isFinite(__props.maxValue));
6953
10223
  return (_ctx, _cache) => {
6954
- return openBlock(), createElementBlock("div", _hoisted_1$64, [(openBlock(), createElementBlock("svg", {
6955
- height: diameter.value,
6956
- width: diameter.value,
6957
- viewBox: viewBox.value,
6958
- class: "donut-chart"
6959
- }, [
6960
- createElementVNode("circle", {
6961
- class: "background-circle",
6962
- cx: radius,
6963
- cy: radius,
6964
- r: r.value,
6965
- "stroke-width": strokeWidth.value,
6966
- fill: "transparent"
6967
- }, null, 8, _hoisted_3$28),
6968
- __props.secondaryValue && !disabled.value ? (openBlock(), createElementBlock("circle", {
6969
- key: 0,
6970
- class: normalizeClass([
6971
- "value-wedge",
6972
- "secondary-circle",
6973
- { animate: __props.animate }
6974
- ]),
6975
- cx: radius,
6976
- cy: radius,
6977
- r: r.value,
6978
- "stroke-width": strokeWidth.value,
6979
- "stroke-dasharray": circumference.value,
6980
- "stroke-dashoffset": secondaryStrokeDashOffset.value,
6981
- fill: "transparent",
6982
- transform: transformWedge.value
6983
- }, null, 10, _hoisted_4$25)) : createCommentVNode("", true),
6984
- !disabled.value ? (openBlock(), createElementBlock("circle", {
6985
- key: 1,
6986
- class: normalizeClass([
6987
- "value-wedge",
6988
- "primary-circle",
6989
- { animate: __props.animate }
6990
- ]),
6991
- cx: radius,
6992
- cy: radius,
6993
- r: r.value,
6994
- "stroke-width": strokeWidth.value,
6995
- "stroke-dasharray": circumference.value,
6996
- "stroke-dashoffset": strokeDashOffset.value,
6997
- fill: "transparent",
6998
- transform: transformWedge.value
6999
- }, null, 10, _hoisted_5$14)) : createCommentVNode("", true)
7000
- ], 8, _hoisted_2$40)), __props.label ? (openBlock(), createElementBlock("div", _hoisted_6$10, [createElementVNode("div", _hoisted_7$3, toDisplayString(__props.label), 1), __props.subText ? (openBlock(), createElementBlock("div", _hoisted_8$3, toDisplayString(__props.subText), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true)]);
10224
+ return openBlock(), createElementBlock("div", null, [withDirectives((openBlock(), createElementBlock("button", {
10225
+ class: normalizeClass({
10226
+ checkbox: true,
10227
+ checked: isChecked.value,
10228
+ indeterminate: isIndeterminate.value,
10229
+ disabled: __props.disabled,
10230
+ error: __props.error
10231
+ }),
10232
+ disabled: __props.disabled,
10233
+ "aria-label": props.tooltip,
10234
+ "aria-checked": ariaChecked.value,
10235
+ "aria-describedby": ariaDescribedBy.value,
10236
+ "aria-invalid": __props.error,
10237
+ type: "button",
10238
+ role: "checkbox",
10239
+ onClick: handleClick
10240
+ }, [createElementVNode("div", _hoisted_2$40, [icon.value ? (openBlock(), createBlock(KdsIcon_default, {
10241
+ key: 0,
10242
+ name: icon.value,
10243
+ class: "icon",
10244
+ size: "xsmall"
10245
+ }, null, 8, ["name"])) : createCommentVNode("", true)]), props.label || props.helperText ? (openBlock(), createElementBlock("div", _hoisted_3$29, [createElementVNode("div", _hoisted_4$25, toDisplayString(props.label), 1), props.helperText ? (openBlock(), createElementBlock("div", {
10246
+ key: 0,
10247
+ id: unref(helperId),
10248
+ class: "helper-text"
10249
+ }, toDisplayString(props.helperText), 9, _hoisted_5$14)) : createCommentVNode("", true)])) : createCommentVNode("", true)], 10, _hoisted_1$64)), [[unref(vKdsTooltip), props.tooltip]]), props.subText || props.preserveSubTextSpace ? (openBlock(), createElementBlock("div", _hoisted_6$10, [createVNode(KdsSubText_default, {
10250
+ id: unref(descriptionId),
10251
+ "sub-text": props.subText,
10252
+ "preserve-sub-text-space": props.preserveSubTextSpace,
10253
+ error: __props.error
10254
+ }, null, 8, [
10255
+ "id",
10256
+ "sub-text",
10257
+ "preserve-sub-text-space",
10258
+ "error"
10259
+ ])])) : createCommentVNode("", true)]);
7001
10260
  };
7002
10261
  }
7003
- }), [["__scopeId", "data-v-93590a62"]]);
7004
- //#endregion
7005
- //#region src/components/accessories/Text/KdsTextHighlight/KdsTextHighlight.vue?vue&type=script&setup=true&lang.ts
7006
- var _hoisted_1$63 = { class: "kds-highlighted-text" };
7007
- var _hoisted_2$39 = {
7008
- key: 0,
7009
- class: "kds-highlighted-text-match"
7010
- };
10262
+ }), [["__scopeId", "data-v-74caccc8"]]);
7011
10263
  //#endregion
7012
- //#region src/components/accessories/Text/KdsTextHighlight/KdsTextHighlight.vue
7013
- var KdsTextHighlight_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
7014
- __name: "KdsTextHighlight",
7015
- props: {
7016
- text: {},
7017
- term: { default: "" }
7018
- },
10264
+ //#region src/components/forms/Checkbox/KdsCheckbox.vue
10265
+ var KdsCheckbox_default = /* @__PURE__ */ defineComponent({
10266
+ __name: "KdsCheckbox",
10267
+ props: /*@__PURE__*/ mergeModels({
10268
+ disabled: {
10269
+ type: Boolean,
10270
+ default: false
10271
+ },
10272
+ error: {
10273
+ type: Boolean,
10274
+ default: false
10275
+ },
10276
+ subText: {},
10277
+ preserveSubTextSpace: {
10278
+ type: Boolean,
10279
+ default: false
10280
+ },
10281
+ label: {},
10282
+ tooltip: {}
10283
+ }, {
10284
+ "modelValue": { default: false },
10285
+ "modelModifiers": {}
10286
+ }),
10287
+ emits: ["update:modelValue"],
7019
10288
  setup(__props) {
7020
- const segments = computed(() => {
7021
- if (!__props.term) return [{
7022
- text: __props.text,
7023
- match: false
7024
- }];
7025
- const lowerText = __props.text.toLowerCase();
7026
- const lowerTerm = __props.term.toLowerCase();
7027
- const result = [];
7028
- let cursor = 0;
7029
- while (cursor < __props.text.length) {
7030
- const index = lowerText.indexOf(lowerTerm, cursor);
7031
- if (index === -1) {
7032
- result.push({
7033
- text: __props.text.slice(cursor),
7034
- match: false
7035
- });
7036
- break;
7037
- }
7038
- if (index > cursor) result.push({
7039
- text: __props.text.slice(cursor, index),
7040
- match: false
7041
- });
7042
- result.push({
7043
- text: __props.text.slice(index, index + __props.term.length),
7044
- match: true
7045
- });
7046
- cursor = index + __props.term.length;
7047
- }
7048
- return result;
7049
- });
10289
+ const props = createPropsRestProxy(__props, [
10290
+ "disabled",
10291
+ "error",
10292
+ "preserveSubTextSpace"
10293
+ ]);
10294
+ /** The checked state of the checkbox. */
10295
+ const modelValue = useModel(__props, "modelValue");
7050
10296
  return (_ctx, _cache) => {
7051
- return openBlock(), createElementBlock("span", _hoisted_1$63, [(openBlock(true), createElementBlock(Fragment, null, renderList(segments.value, (segment, index) => {
7052
- return openBlock(), createElementBlock(Fragment, { key: index }, [segment.match ? (openBlock(), createElementBlock("mark", _hoisted_2$39, toDisplayString(segment.text), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(segment.text), 1)], 64))], 64);
7053
- }), 128))]);
10297
+ return openBlock(), createBlock(BaseCheckbox_default, mergeProps(props, {
10298
+ modelValue: modelValue.value,
10299
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
10300
+ disabled: __props.disabled,
10301
+ error: __props.error,
10302
+ "preserve-sub-text-space": __props.preserveSubTextSpace
10303
+ }), null, 16, [
10304
+ "modelValue",
10305
+ "disabled",
10306
+ "error",
10307
+ "preserve-sub-text-space"
10308
+ ]);
7054
10309
  };
7055
10310
  }
7056
- }), [["__scopeId", "data-v-a2202598"]]);
7057
- //#endregion
7058
- //#region src/components/accessories/Divider/KdsDivider.vue
7059
- var _sfc_main = {};
7060
- var _hoisted_1$62 = { class: "kds-divider" };
7061
- function _sfc_render$1(_ctx, _cache) {
7062
- return openBlock(), createElementBlock("hr", _hoisted_1$62);
7063
- }
7064
- var KdsDivider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render$1], ["__scopeId", "data-v-dead6417"]]);
10311
+ });
7065
10312
  //#endregion
7066
- //#region src/components/accessories/_Accessory/enums.ts
7067
- var kdsAccessoryType = {
7068
- ICON: "icon",
7069
- DATA_TYPE: "dataType",
7070
- COLOR_SWATCH: "colorSwatch",
7071
- LIVE_STATUS: "liveStatus",
7072
- AVATAR: "avatar",
7073
- PORT: "port"
10313
+ //#region src/layouts/overlays/Modal/useKdsDynamicModal.ts
10314
+ var defaultCancelButton = {
10315
+ type: "cancel",
10316
+ label: "Cancel"
7074
10317
  };
7075
- var kdsAccessoryTypes = Object.values(kdsAccessoryType);
7076
- var kdsAccessorySize = {
7077
- SMALL: "small",
7078
- MEDIUM: "medium",
7079
- LARGE: "large"
10318
+ var defaultConfirmButton = {
10319
+ type: "confirm",
10320
+ label: "Confirm"
7080
10321
  };
7081
- var kdsAccessorySizes = Object.values(kdsAccessorySize);
7082
- //#endregion
7083
- //#region src/util/nuxtComponentResolver.ts
7084
- var getAppInstance = () => {
7085
- return getCurrentInstance()?.appContext.app;
10322
+ var isActive = ref(false);
10323
+ var activeModalConfig = ref(null);
10324
+ var unwrappedPromise = ref(promise_exports.createUnwrappedPromise());
10325
+ var resetInternalState = () => {
10326
+ isActive.value = false;
10327
+ unwrappedPromise.value = promise_exports.createUnwrappedPromise();
10328
+ };
10329
+ var onClosed = () => {
10330
+ activeModalConfig.value = null;
10331
+ };
10332
+ /**
10333
+ * Used to confirm the modal result. Should only used when called via
10334
+ * `askConfirmation`
10335
+ * @param doNotAskAgain
10336
+ */
10337
+ var confirm = (doNotAskAgain = false) => {
10338
+ unwrappedPromise.value.resolve({
10339
+ confirmed: true,
10340
+ doNotAskAgain
10341
+ });
10342
+ resetInternalState();
10343
+ };
10344
+ /**
10345
+ * Close or cancel the dialog
10346
+ */
10347
+ var close = () => {
10348
+ const isConfirm = activeModalConfig.value?.type === "confirm";
10349
+ unwrappedPromise.value.resolve(isConfirm ? { confirmed: false } : void 0);
10350
+ resetInternalState();
10351
+ };
10352
+ var isTemplateBasedConfirm = (config) => {
10353
+ return "component" in config;
7086
10354
  };
7087
- var resolveNuxtLinkComponent = () => {
7088
- const app = getAppInstance();
7089
- const nuxtLinkComponent = app?.component("NuxtLink");
7090
- if (nuxtLinkComponent) return nuxtLinkComponent;
7091
- const routerLinkComponent = app?.component("RouterLink");
7092
- if (routerLinkComponent) return routerLinkComponent;
7093
- return defineComponent({
7094
- props: { to: {
7095
- type: String,
7096
- default: ""
7097
- } },
7098
- render() {
7099
- return h("a", { href: this.to }, [useSlots().default?.()]);
10355
+ var updateConfig = (config) => {
10356
+ if (!isActive.value || !activeModalConfig.value || activeModalConfig.value.type === "confirm") {
10357
+ consola.warn("useKdsDynamicModal: invalid invocation of updateConfig");
10358
+ return;
10359
+ }
10360
+ activeModalConfig.value.value = {
10361
+ ...activeModalConfig.value.value,
10362
+ ...config
10363
+ };
10364
+ };
10365
+ var internal = {
10366
+ confirm,
10367
+ close,
10368
+ isTemplateBasedConfirm,
10369
+ onClosed,
10370
+ updateConfig
10371
+ };
10372
+ function askConfirmation(config) {
10373
+ activeModalConfig.value = {
10374
+ type: "confirm",
10375
+ value: {
10376
+ buttons: [defaultCancelButton, defaultConfirmButton],
10377
+ ...config
7100
10378
  }
7101
- });
10379
+ };
10380
+ isActive.value = true;
10381
+ return unwrappedPromise.value.promise;
10382
+ }
10383
+ var showByTemplate = (config) => {
10384
+ activeModalConfig.value = {
10385
+ type: "dynamic",
10386
+ value: config
10387
+ };
10388
+ isActive.value = true;
10389
+ return unwrappedPromise.value.promise;
10390
+ };
10391
+ var useKdsDynamicModal = () => {
10392
+ return {
10393
+ askConfirmation,
10394
+ showByTemplate,
10395
+ config: computed(() => activeModalConfig.value),
10396
+ isActive: computed(() => isActive.value),
10397
+ close: () => internal.close()
10398
+ };
7102
10399
  };
7103
10400
  //#endregion
7104
- //#region src/components/buttons/links/linkUtils.ts
7105
- function isExternalUrl(url) {
7106
- const normalized = url.trim();
7107
- if (!normalized) return false;
7108
- if (normalized.startsWith("#") || normalized.startsWith("/") && !normalized.startsWith("//") || normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("?")) return false;
7109
- return true;
7110
- }
10401
+ //#region src/layouts/overlays/Modal/KdsDynamicModalProvider.vue?vue&type=script&setup=true&lang.ts
10402
+ var _hoisted_1$63 = {
10403
+ key: 1,
10404
+ class: "confirmation"
10405
+ };
10406
+ var _hoisted_2$39 = { class: "message" };
10407
+ var _hoisted_3$28 = {
10408
+ key: 0,
10409
+ class: "ask-again"
10410
+ };
7111
10411
  //#endregion
7112
- //#region src/components/buttons/links/KdsLinkButton/KdsLinkButton.vue
7113
- var KdsLinkButton_default = /* @__PURE__ */ defineComponent({
7114
- __name: "KdsLinkButton",
10412
+ //#region src/layouts/overlays/Modal/KdsDynamicModalProvider.vue
10413
+ var KdsDynamicModalProvider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
10414
+ __name: "KdsDynamicModalProvider",
10415
+ setup(__props) {
10416
+ const askAgain = ref(false);
10417
+ const { config, isActive } = useKdsDynamicModal();
10418
+ const reset = () => {
10419
+ askAgain.value = false;
10420
+ };
10421
+ const onConfirm = () => {
10422
+ internal.confirm(askAgain.value);
10423
+ reset();
10424
+ };
10425
+ const onClose = () => {
10426
+ internal.close();
10427
+ reset();
10428
+ };
10429
+ const handleConfirmButton = (button) => {
10430
+ if (!button.customHandler) {
10431
+ (button.type === "cancel" ? onClose : onConfirm)();
10432
+ return;
10433
+ }
10434
+ if (button.type === "cancel") button.customHandler({ cancel: onClose });
10435
+ if (button.type === "confirm") button.customHandler({ confirm: onConfirm });
10436
+ };
10437
+ const defaultVariant = (type) => type === "cancel" ? "transparent" : "filled";
10438
+ const kdsModalProps = computed(() => {
10439
+ if (!config.value) return {};
10440
+ const { leadingIcon, headline, height, width, variant, overflow, closedby } = config.value.value;
10441
+ return {
10442
+ leadingIcon,
10443
+ headline,
10444
+ height,
10445
+ width,
10446
+ variant,
10447
+ overflow,
10448
+ closedby,
10449
+ onClose,
10450
+ onClosed: internal.onClosed,
10451
+ active: isActive.value
10452
+ };
10453
+ });
10454
+ return (_ctx, _cache) => {
10455
+ return openBlock(), createBlock(KdsModal_default, mergeProps({ class: "confirm-modal" }, kdsModalProps.value), createSlots({ _: 2 }, [
10456
+ unref(config)?.type === "confirm" ? {
10457
+ name: "body",
10458
+ fn: withCtx(() => [unref(internal).isTemplateBasedConfirm(unref(config).value) ? (openBlock(), createBlock(resolveDynamicComponent(unref(config).value.component), { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1$63, [createElementVNode("div", _hoisted_2$39, toDisplayString(unref(config).value.message), 1), unref(config).value.doNotAskAgain ? (openBlock(), createElementBlock("div", _hoisted_3$28, [createVNode(KdsCheckbox_default, {
10459
+ modelValue: askAgain.value,
10460
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => askAgain.value = $event),
10461
+ label: unref(config).value.doNotAskAgain.label,
10462
+ "sub-text": unref(config).value.doNotAskAgain.subText
10463
+ }, null, 8, [
10464
+ "modelValue",
10465
+ "label",
10466
+ "sub-text"
10467
+ ])])) : createCommentVNode("", true)]))]),
10468
+ key: "0"
10469
+ } : void 0,
10470
+ unref(config)?.type === "confirm" ? {
10471
+ name: "footer",
10472
+ fn: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(config).value.buttons, (button, index) => {
10473
+ return openBlock(), createBlock(KdsButton_default, {
10474
+ key: index,
10475
+ destructive: button.destructive,
10476
+ autofocus: button.autofocus,
10477
+ label: button.label,
10478
+ variant: button.variant ?? defaultVariant(button.type),
10479
+ class: normalizeClass({ "flush-left": button.flushLeft }),
10480
+ "data-test-id": `${button.type}-button`,
10481
+ onClick: ($event) => handleConfirmButton(button)
10482
+ }, null, 8, [
10483
+ "destructive",
10484
+ "autofocus",
10485
+ "label",
10486
+ "variant",
10487
+ "class",
10488
+ "data-test-id",
10489
+ "onClick"
10490
+ ]);
10491
+ }), 128))]),
10492
+ key: "1"
10493
+ } : void 0,
10494
+ unref(config)?.type === "dynamic" ? {
10495
+ name: "default",
10496
+ fn: withCtx((slotProps) => [(openBlock(), createBlock(resolveDynamicComponent(unref(config).value.component), normalizeProps(guardReactiveProps({
10497
+ ...slotProps,
10498
+ context: unref(config).value.context,
10499
+ updateConfig: unref(internal).updateConfig
10500
+ })), null, 16))]),
10501
+ key: "2"
10502
+ } : void 0
10503
+ ]), 1040);
10504
+ };
10505
+ }
10506
+ }), [["__scopeId", "data-v-9937b6b2"]]);
10507
+ //#endregion
10508
+ //#region src/layouts/overlays/SideDrawer/KdsSideDrawer.vue?vue&type=script&setup=true&lang.ts
10509
+ var _hoisted_1$62 = ["data-width"];
10510
+ //#endregion
10511
+ //#region src/layouts/overlays/SideDrawer/KdsSideDrawer.vue
10512
+ var KdsSideDrawer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
10513
+ __name: "KdsSideDrawer",
7115
10514
  props: {
7116
- dataTestId: {},
7117
- size: {},
7118
- disabled: {
10515
+ isExpanded: {
7119
10516
  type: Boolean,
7120
10517
  default: false
7121
10518
  },
7122
- tooltip: {},
7123
- variant: { default: "filled" },
7124
- label: {},
7125
- leadingIcon: {},
7126
- trailingIcon: {},
7127
- ariaLabel: {},
7128
- destructive: { type: Boolean },
7129
- to: {},
7130
- download: {
7131
- type: Boolean,
7132
- default: () => void 0
7133
- },
7134
- target: { default: null },
7135
- rel: { default: null }
10519
+ width: { default: "default" }
7136
10520
  },
7137
- emits: ["click"],
7138
- setup(__props, { emit: __emit }) {
7139
- const rawProps = createPropsRestProxy(__props, [
7140
- "variant",
7141
- "disabled",
7142
- "download",
7143
- "rel",
7144
- "target"
7145
- ]);
7146
- const props = computed(() => {
7147
- if (isExternalUrl(rawProps.to)) return {
7148
- ...rawProps,
7149
- trailingIcon: "external-link"
7150
- };
7151
- return rawProps;
7152
- });
7153
- const component = computed(() => {
7154
- if (__props.disabled) return "button";
7155
- return resolveNuxtLinkComponent();
10521
+ setup(__props) {
10522
+ const drawerRef = useTemplateRef("drawer");
10523
+ onMounted(() => {
10524
+ watch(() => __props.isExpanded, (expanded) => {
10525
+ if (expanded) drawerRef.value?.showPopover();
10526
+ else drawerRef.value?.hidePopover();
10527
+ }, { immediate: true });
7156
10528
  });
7157
- const emit = __emit;
7158
10529
  return (_ctx, _cache) => {
7159
- return openBlock(), createBlock(BaseButton_default, mergeProps(props.value, {
7160
- variant: __props.variant,
7161
- disabled: __props.disabled,
7162
- download: __props.download,
7163
- rel: __props.rel,
7164
- target: __props.target,
7165
- component: component.value,
7166
- onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
7167
- }), null, 16, [
7168
- "variant",
7169
- "disabled",
7170
- "download",
7171
- "rel",
7172
- "target",
7173
- "component"
7174
- ]);
10530
+ return openBlock(), createElementBlock("div", {
10531
+ ref: "drawer",
10532
+ popover: "manual",
10533
+ class: "kds-side-drawer",
10534
+ "data-width": __props.width
10535
+ }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 8, _hoisted_1$62);
7175
10536
  };
7176
10537
  }
7177
- });
7178
- //#endregion
7179
- //#region ../styles/dist/img/icons/external-link.svg?url
7180
- var external_link_default = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20stroke='currentColor'%20stroke-linecap='round'%20stroke-linejoin='round'%20viewBox='0%200%2012%2012'%3e%3cpath%20d='M5.5%201.5h-3a1%201%200%200%200-1%201v7a1%201%200%200%200%201%201h7a1%201%200%200%200%201-1v-3m0-5L6%205.892M10.5%201.5v2.75m0-2.75H7.75'%20vector-effect='non-scaling-stroke'/%3e%3c/svg%3e";
10538
+ }), [["__scopeId", "data-v-2bceb215"]]);
7181
10539
  //#endregion
7182
10540
  //#region src/components/buttons/links/KdsLink/KdsLink.vue?vue&type=script&setup=true&lang.ts
7183
10541
  var _hoisted_1$61 = { class: "label" };
@@ -7417,150 +10775,6 @@ var kdsProgressButtonState = {
7417
10775
  };
7418
10776
  var kdsProgressButtonStates = Object.values(kdsProgressButtonState);
7419
10777
  //#endregion
7420
- //#region src/util/useListItemKeyboardNav.ts
7421
- var isTextInput = (target) => target instanceof HTMLElement && [
7422
- "INPUT",
7423
- "TEXTAREA",
7424
- "SELECT"
7425
- ].includes(target.tagName);
7426
- var diffIds = (a, b) => a.length !== b.length || a.some((id, i) => id !== b[i]);
7427
- var useListItemKeyboardNav = (options) => {
7428
- const { containerEl, selectableItems, enabledItems, itemFocusStrategy = "persistent", shouldNavigate = () => true } = options;
7429
- const activeId = ref(void 0);
7430
- function scrollToView() {
7431
- if (!activeId.value || !containerEl.value) return;
7432
- containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
7433
- }
7434
- const findEnabledIndex = (id) => id === void 0 ? -1 : enabledItems.value.findIndex((o) => o.id === id);
7435
- const moveDown = (currentIndex) => {
7436
- if (currentIndex < 0) return enabledItems.value[0].id;
7437
- if (currentIndex >= enabledItems.value.length - 1) return options.allowNoSelection ? void 0 : enabledItems.value[0].id;
7438
- return enabledItems.value[currentIndex + 1].id;
7439
- };
7440
- const moveUp = (currentIndex) => {
7441
- if (options.allowNoSelection && currentIndex === 0) return;
7442
- if (currentIndex <= 0) return enabledItems.value[enabledItems.value.length - 1].id;
7443
- return enabledItems.value[currentIndex - 1].id;
7444
- };
7445
- const handleKeydown = (event) => {
7446
- if (!shouldNavigate(event)) return;
7447
- if (enabledItems.value.length === 0) {
7448
- activeId.value = selectableItems.value.length === 0 ? options.emptyOptionId : void 0;
7449
- return;
7450
- }
7451
- const currentIndex = findEnabledIndex(activeId.value);
7452
- const targetItem = enabledItems.value.find((item) => item.id === activeId.value);
7453
- switch (event.key) {
7454
- case "ArrowDown":
7455
- activeId.value = moveDown(currentIndex);
7456
- scrollToView();
7457
- event.preventDefault();
7458
- break;
7459
- case "ArrowUp":
7460
- activeId.value = moveUp(currentIndex);
7461
- scrollToView();
7462
- event.preventDefault();
7463
- break;
7464
- case "ArrowLeft":
7465
- options.triggers?.onArrowLeft?.(activeId.value, targetItem);
7466
- event.preventDefault();
7467
- break;
7468
- case "ArrowRight":
7469
- options.triggers?.onArrowRight?.(activeId.value, targetItem);
7470
- event.preventDefault();
7471
- break;
7472
- case "Enter":
7473
- options.triggers?.onEnter?.(activeId.value, targetItem, event);
7474
- event.preventDefault();
7475
- break;
7476
- case " ":
7477
- if (isTextInput(event.target)) break;
7478
- options.triggers?.onSpace?.(activeId.value, targetItem, event);
7479
- event.preventDefault();
7480
- break;
7481
- case "Home":
7482
- activeId.value = enabledItems.value[0].id;
7483
- scrollToView();
7484
- event.preventDefault();
7485
- break;
7486
- case "End":
7487
- activeId.value = enabledItems.value[enabledItems.value.length - 1].id;
7488
- scrollToView();
7489
- event.preventDefault();
7490
- break;
7491
- default: break;
7492
- }
7493
- };
7494
- const isFocused = ref(false);
7495
- const lastActiveId = ref(void 0);
7496
- const updateActiveItemId = (didIdsChange = false) => {
7497
- function assertUnreachable(_) {
7498
- throw new Error("Exhaustive check not met");
7499
- }
7500
- isFocused.value = true;
7501
- switch (itemFocusStrategy) {
7502
- case "always-first":
7503
- activeId.value = enabledItems.value.at(0)?.id;
7504
- return;
7505
- case "persistent": {
7506
- const hasActiveId = activeId.value !== void 0;
7507
- if (!didIdsChange && hasActiveId) return;
7508
- const isStillAvailable = enabledItems.value.find(({ id }) => lastActiveId.value === id);
7509
- activeId.value = isStillAvailable ? lastActiveId.value : enabledItems.value.at(0)?.id;
7510
- lastActiveId.value = activeId.value;
7511
- return;
7512
- }
7513
- case "noop":
7514
- activeId.value = void 0;
7515
- lastActiveId.value = void 0;
7516
- return;
7517
- default: assertUnreachable(itemFocusStrategy);
7518
- }
7519
- };
7520
- /** Reset activeId when possibleValues change */
7521
- watch([enabledItems, () => options.loading], ([currentValues, isLoading], [prevValues]) => {
7522
- if (!isFocused.value) return;
7523
- if (isLoading && options.emptyOptionId) {
7524
- activeId.value = options.emptyOptionId;
7525
- return;
7526
- }
7527
- const didIdsChange = diffIds(currentValues.map(({ id }) => id), prevValues.map(({ id }) => id));
7528
- updateActiveItemId(didIdsChange);
7529
- });
7530
- const blur = () => {
7531
- lastActiveId.value = activeId.value;
7532
- activeId.value = void 0;
7533
- isFocused.value = false;
7534
- };
7535
- const setActiveId = (id) => {
7536
- activeId.value = id;
7537
- };
7538
- const focus = () => updateActiveItemId();
7539
- onMounted(() => {
7540
- containerEl.value?.addEventListener("keydown", handleKeydown);
7541
- containerEl.value?.addEventListener("focus", focus);
7542
- containerEl.value?.addEventListener("blur", blur);
7543
- });
7544
- onUnmounted(() => {
7545
- containerEl.value?.removeEventListener("keydown", handleKeydown);
7546
- containerEl.value?.removeEventListener("focus", focus);
7547
- containerEl.value?.removeEventListener("blur", blur);
7548
- });
7549
- function scrollSelectedIntoView() {
7550
- nextTick(() => {
7551
- (containerEl.value?.querySelector("[aria-selected=\"true\"]"))?.scrollIntoView({ block: "center" });
7552
- });
7553
- }
7554
- return {
7555
- handleKeydown,
7556
- activeId: readonly(activeId),
7557
- focus: updateActiveItemId,
7558
- blur,
7559
- setActiveId,
7560
- scrollSelectedIntoView
7561
- };
7562
- };
7563
- //#endregion
7564
10778
  //#region src/util/useStableItemIds.ts
7565
10779
  /**
7566
10780
  * This composable adds prefixes to the ids of the given list of items.
@@ -8064,16 +11278,14 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
8064
11278
  ariaLabel: { default: "Menu" },
8065
11279
  items: {},
8066
11280
  menuMaxHeight: {},
8067
- variant: { default: () => kdsListItemVariant.SMALL },
8068
- itemFocusStrategy: { default: "noop" }
11281
+ variant: { default: () => kdsListItemVariant.SMALL }
8069
11282
  },
8070
11283
  emits: ["itemClick"],
8071
11284
  setup(__props, { expose: __expose, emit: __emit }) {
8072
11285
  const props = createPropsRestProxy(__props, [
8073
11286
  "ariaLabel",
8074
11287
  "menuMaxHeight",
8075
- "variant",
8076
- "itemFocusStrategy"
11288
+ "variant"
8077
11289
  ]);
8078
11290
  const emit = __emit;
8079
11291
  const { itemsWithPrefix, toUnprefixedId } = useStableItemIds({ items: computed(() => props.items) });
@@ -8140,38 +11352,86 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
8140
11352
  const hasChildren = (item) => {
8141
11353
  return item.children && item.children.length > 0;
8142
11354
  };
8143
- const showPopoverByKeyboard = (activeId) => {
8144
- if (activeId) (showPopover(activeId)?.querySelector("[data-submenu-container]"))?.focus();
8145
- };
8146
- const { activeId, setActiveId } = useListItemKeyboardNav({
8147
- containerEl,
8148
- enabledItems,
8149
- selectableItems,
8150
- listItemRole: "menuitem",
8151
- itemFocusStrategy: __props.itemFocusStrategy,
8152
- shouldNavigate: (event) => {
8153
- const rootNode = containerEl.value?.getRootNode();
8154
- if (!rootNode) return false;
8155
- const activeElement = rootNode.activeElement;
8156
- return activeElement === event.target && activeElement === containerEl.value;
8157
- },
8158
- triggers: {
8159
- onEnter: (activeId, item, event) => {
8160
- if (item && hasChildren(validateItemChildren(item))) showPopoverByKeyboard(activeId);
8161
- else onKeyboardActivate(item, event);
8162
- },
8163
- onSpace: (_activeId, item, event) => {
8164
- onKeyboardActivate(item, event);
8165
- },
8166
- onArrowLeft: () => {
11355
+ const showPopoverByKeyboard = (id) => {
11356
+ if (id) (showPopover(id)?.querySelector("[data-submenu-container]"))?.focus();
11357
+ };
11358
+ const activeId = ref(void 0);
11359
+ function scrollToView() {
11360
+ if (!activeId.value || !containerEl.value) return;
11361
+ containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
11362
+ }
11363
+ const findEnabledIndex = (id) => id === void 0 ? -1 : enabledItems.value.findIndex((o) => o.id === id);
11364
+ const moveDown = (currentIndex) => {
11365
+ if (currentIndex < 0) return enabledItems.value[0]?.id;
11366
+ if (currentIndex >= enabledItems.value.length - 1) return enabledItems.value[0].id;
11367
+ return enabledItems.value[currentIndex + 1].id;
11368
+ };
11369
+ const moveUp = (currentIndex) => {
11370
+ if (currentIndex <= 0) return enabledItems.value[enabledItems.value.length - 1].id;
11371
+ return enabledItems.value[currentIndex - 1].id;
11372
+ };
11373
+ const setActiveId = (id) => {
11374
+ activeId.value = id;
11375
+ };
11376
+ const shouldNavigate = (event) => {
11377
+ const rootNode = containerEl.value?.getRootNode();
11378
+ if (!rootNode) return false;
11379
+ const activeElement = rootNode.activeElement;
11380
+ return activeElement === event.target && activeElement === containerEl.value;
11381
+ };
11382
+ const handleKeydown = (event) => {
11383
+ if (!shouldNavigate(event)) return;
11384
+ if (enabledItems.value.length === 0) return;
11385
+ const currentIndex = findEnabledIndex(activeId.value);
11386
+ const targetItem = enabledItems.value.find((item) => item.id === activeId.value);
11387
+ switch (event.key) {
11388
+ case "ArrowDown":
11389
+ activeId.value = moveDown(currentIndex);
11390
+ scrollToView();
11391
+ event.preventDefault();
11392
+ break;
11393
+ case "ArrowUp":
11394
+ activeId.value = moveUp(currentIndex);
11395
+ scrollToView();
11396
+ event.preventDefault();
11397
+ break;
11398
+ case "ArrowLeft":
8167
11399
  parentList?.closeActiveSubmenu({ requester: props.id });
8168
- },
8169
- onArrowRight: (activeId, item) => {
8170
- if (item && !hasChildren(validateItemChildren(item))) return;
8171
- showPopoverByKeyboard(activeId);
8172
- }
11400
+ event.preventDefault();
11401
+ break;
11402
+ case "ArrowRight":
11403
+ if (targetItem && !hasChildren(validateItemChildren(targetItem))) break;
11404
+ showPopoverByKeyboard(activeId.value);
11405
+ event.preventDefault();
11406
+ break;
11407
+ case "Enter":
11408
+ if (targetItem && hasChildren(validateItemChildren(targetItem))) showPopoverByKeyboard(activeId.value);
11409
+ else onKeyboardActivate(targetItem, event);
11410
+ event.preventDefault();
11411
+ break;
11412
+ case " ":
11413
+ onKeyboardActivate(targetItem, event);
11414
+ event.preventDefault();
11415
+ break;
11416
+ case "Home":
11417
+ activeId.value = enabledItems.value[0].id;
11418
+ scrollToView();
11419
+ event.preventDefault();
11420
+ break;
11421
+ case "End":
11422
+ activeId.value = enabledItems.value[enabledItems.value.length - 1].id;
11423
+ scrollToView();
11424
+ event.preventDefault();
11425
+ break;
11426
+ default: break;
8173
11427
  }
8174
- });
11428
+ };
11429
+ const focus = () => {
11430
+ activeId.value = void 0;
11431
+ };
11432
+ const blur = () => {
11433
+ activeId.value = void 0;
11434
+ };
8175
11435
  provide(ChildItemKey, { closeActiveSubmenu: () => {
8176
11436
  const lastActiveId = activePopoverId.value;
8177
11437
  closePopover();
@@ -8181,7 +11441,7 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
8181
11441
  __expose({
8182
11442
  /**
8183
11443
  * Function to focus the outer container of the menu.
8184
- * It will follow the behavior defined by the `itemFocusStrategy` prop.
11444
+ * No item is activated on focus.
8185
11445
  */
8186
11446
  focus: () => {
8187
11447
  containerEl.value?.focus();
@@ -8207,13 +11467,18 @@ focus: () => {
8207
11467
  "aria-label": __props.ariaLabel,
8208
11468
  tabindex: 0,
8209
11469
  style: normalizeStyle({ maxHeight: __props.menuMaxHeight }),
8210
- "aria-activedescendant": unref(activeId) ?? activePopoverId.value,
8211
- onMouseleave: closePopover,
8212
- onFocusin: _cache[3] || (_cache[3] = withModifiers(($event) => activePopoverId.value = void 0, ["stop"])),
8213
- onFocusout: handleFocusOut,
8214
- onKeydown: _cache[4] || (_cache[4] = withKeys(() => {
11470
+ "aria-activedescendant": activeId.value ?? activePopoverId.value,
11471
+ onKeydown: [handleKeydown, _cache[5] || (_cache[5] = withKeys(() => {
8215
11472
  unref(parentList)?.closeActiveSubmenu({ requester: props.id });
8216
- }, ["esc"]))
11473
+ }, ["esc"]))],
11474
+ onFocus: focus,
11475
+ onBlur: blur,
11476
+ onMouseleave: _cache[3] || (_cache[3] = () => {
11477
+ closePopover();
11478
+ activeId.value = void 0;
11479
+ }),
11480
+ onFocusin: _cache[4] || (_cache[4] = withModifiers(($event) => activePopoverId.value = void 0, ["stop"])),
11481
+ onFocusout: handleFocusOut
8217
11482
  }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(itemsWithPrefix), (item, index) => {
8218
11483
  return openBlock(), createBlock(KdsMenuItem_default, {
8219
11484
  key: item.id,
@@ -8221,11 +11486,12 @@ focus: () => {
8221
11486
  ref: (el) => setItemRef(el, index),
8222
11487
  item: validateItemChildren(item),
8223
11488
  "is-last": index === unref(itemsWithPrefix).length - 1,
8224
- "active-id": unref(activeId) ?? activePopoverId.value,
11489
+ "active-id": activeId.value ?? activePopoverId.value,
8225
11490
  variant: __props.variant,
8226
11491
  onClick: ($event) => handleItemInteraction(item, $event),
8227
11492
  onMouseenter: () => {
8228
11493
  if (activePopoverId.value) closePopover();
11494
+ if (!item.disabled) activeId.value = item.id;
8229
11495
  if (!item.disabled && hasChildren(item)) showPopover(item.id);
8230
11496
  }
8231
11497
  }, {
@@ -8263,7 +11529,7 @@ focus: () => {
8263
11529
  }), 128))], 44, _hoisted_1$57);
8264
11530
  };
8265
11531
  }
8266
- }), [["__scopeId", "data-v-18a8d9e6"]]);
11532
+ }), [["__scopeId", "data-v-7e0346b7"]]);
8267
11533
  //#endregion
8268
11534
  //#region src/components/buttons/KdsMenuButton/KdsMenuButton.vue
8269
11535
  var KdsMenuButton_default = /* @__PURE__ */ defineComponent({
@@ -11388,8 +14654,7 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11388
14654
  allowNoSelection: {
11389
14655
  type: Boolean,
11390
14656
  default: false
11391
- },
11392
- itemFocusStrategy: { default: "persistent" }
14657
+ }
11393
14658
  },
11394
14659
  emits: ["itemClick"],
11395
14660
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -11397,8 +14662,7 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11397
14662
  "emptyText",
11398
14663
  "variant",
11399
14664
  "loading",
11400
- "allowNoSelection",
11401
- "itemFocusStrategy"
14665
+ "allowNoSelection"
11402
14666
  ]);
11403
14667
  const emit = __emit;
11404
14668
  const { itemsWithPrefix, idPrefix, toUnprefixedId } = useStableItemIds({ items: computed(() => __props.loading ? [] : props.possibleValues) });
@@ -11410,24 +14674,96 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11410
14674
  /** Only selectable (non-section-headline) items */
11411
14675
  const selectableValues = computed(() => itemsWithPrefix.value.filter((item) => !item.sectionHeadline));
11412
14676
  const containerEl = useTemplateRef("containerEl");
11413
- const { activeId, handleKeydown, focus, blur, scrollSelectedIntoView } = useListItemKeyboardNav({
11414
- containerEl,
11415
- enabledItems: computed(() => selectableValues.value.filter((o) => !o.disabled)),
11416
- selectableItems: selectableValues,
11417
- allowNoSelection: __props.allowNoSelection,
11418
- emptyOptionId,
11419
- loading: __props.loading,
11420
- itemFocusStrategy: __props.itemFocusStrategy,
11421
- listItemRole: "option",
11422
- triggers: {
11423
- onEnter: () => {
14677
+ const enabledValues = computed(() => selectableValues.value.filter((o) => !o.disabled));
14678
+ const activeId = ref(void 0);
14679
+ const isFocused = ref(false);
14680
+ function scrollToView() {
14681
+ if (!activeId.value || !containerEl.value) return;
14682
+ containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
14683
+ }
14684
+ const findEnabledIndex = (id) => id === void 0 ? -1 : enabledValues.value.findIndex((o) => o.id === id);
14685
+ const moveDown = (currentIndex) => {
14686
+ if (currentIndex < 0) return enabledValues.value[0].id;
14687
+ if (currentIndex >= enabledValues.value.length - 1) return __props.allowNoSelection ? void 0 : enabledValues.value[0].id;
14688
+ return enabledValues.value[currentIndex + 1].id;
14689
+ };
14690
+ const moveUp = (currentIndex) => {
14691
+ if (__props.allowNoSelection && currentIndex === 0) return;
14692
+ if (currentIndex <= 0) return enabledValues.value[enabledValues.value.length - 1].id;
14693
+ return enabledValues.value[currentIndex - 1].id;
14694
+ };
14695
+ const isTextInput = (target) => target instanceof HTMLElement && [
14696
+ "INPUT",
14697
+ "TEXTAREA",
14698
+ "SELECT"
14699
+ ].includes(target.tagName);
14700
+ const handleKeydown = (event) => {
14701
+ if (enabledValues.value.length === 0) {
14702
+ activeId.value = selectableValues.value.length === 0 ? emptyOptionId : void 0;
14703
+ return;
14704
+ }
14705
+ const currentIndex = findEnabledIndex(activeId.value);
14706
+ switch (event.key) {
14707
+ case "ArrowDown":
14708
+ activeId.value = moveDown(currentIndex);
14709
+ scrollToView();
14710
+ event.preventDefault();
14711
+ break;
14712
+ case "ArrowUp":
14713
+ activeId.value = moveUp(currentIndex);
14714
+ scrollToView();
14715
+ event.preventDefault();
14716
+ break;
14717
+ case "Enter":
11424
14718
  emit("itemClick", toOptionId(activeId.value));
11425
- },
11426
- onSpace: () => {
14719
+ event.preventDefault();
14720
+ break;
14721
+ case " ":
14722
+ if (isTextInput(event.target)) break;
11427
14723
  emit("itemClick", toOptionId(activeId.value));
11428
- }
14724
+ event.preventDefault();
14725
+ break;
14726
+ case "Home":
14727
+ activeId.value = enabledValues.value[0].id;
14728
+ scrollToView();
14729
+ event.preventDefault();
14730
+ break;
14731
+ case "End":
14732
+ activeId.value = enabledValues.value[enabledValues.value.length - 1].id;
14733
+ scrollToView();
14734
+ event.preventDefault();
14735
+ break;
14736
+ default: break;
14737
+ }
14738
+ };
14739
+ const activateSelectedItem = () => {
14740
+ const selectedItem = enabledValues.value.find((item) => item.selected);
14741
+ activeId.value = selectedItem?.id;
14742
+ };
14743
+ const focus = () => {
14744
+ isFocused.value = true;
14745
+ activateSelectedItem();
14746
+ };
14747
+ const blur = () => {
14748
+ activeId.value = void 0;
14749
+ isFocused.value = false;
14750
+ };
14751
+ /** Reset activeId when possibleValues change */
14752
+ const diffIds = (a, b) => a.length !== b.length || a.some((id, i) => id !== b[i]);
14753
+ watch([enabledValues, () => __props.loading], ([currentValues, isLoading], [prevValues]) => {
14754
+ if (activeId.value && !selectableValues.value.some((item) => item.id === activeId.value)) activeId.value = void 0;
14755
+ if (!isFocused.value) return;
14756
+ if (isLoading && emptyOptionId) {
14757
+ activeId.value = emptyOptionId;
14758
+ return;
11429
14759
  }
14760
+ if (diffIds(currentValues.map(({ id }) => id), prevValues.map(({ id }) => id))) activateSelectedItem();
11430
14761
  });
14762
+ function scrollSelectedIntoView() {
14763
+ nextTick(() => {
14764
+ (containerEl.value?.querySelector("[aria-selected=\"true\"]"))?.scrollIntoView({ block: "center" });
14765
+ });
14766
+ }
11431
14767
  __expose({
11432
14768
  /** Forward a keydown event to the list for keyboard navigation */
11433
14769
  handleKeydown,
@@ -11435,7 +14771,7 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11435
14771
  handleFocus: focus,
11436
14772
  /** Notify the list that its controlling element lost focus */
11437
14773
  handleBlur: blur,
11438
- activeDescendant: activeId,
14774
+ activeDescendant: readonly(activeId),
11439
14775
  /** Moves focus to the list container element */
11440
14776
  focus: () => {
11441
14777
  containerEl.value?.focus();
@@ -11449,9 +14785,13 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11449
14785
  role: "listbox",
11450
14786
  "aria-busy": __props.loading,
11451
14787
  "aria-label": props.ariaLabel,
11452
- "aria-activedescendant": !props.controlledExternally && unref(activeId) ? unref(activeId) : void 0,
14788
+ "aria-activedescendant": !props.controlledExternally && activeId.value ? activeId.value : void 0,
11453
14789
  class: ["kds-list-container", { standalone: !props.controlledExternally }],
11454
- tabindex: props.controlledExternally ? void 0 : 0
14790
+ tabindex: props.controlledExternally ? void 0 : 0,
14791
+ onKeydown: handleKeydown,
14792
+ onFocus: focus,
14793
+ onBlur: blur,
14794
+ onMouseleave: _cache[1] || (_cache[1] = ($event) => activeId.value = void 0)
11455
14795
  }), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(itemsWithPrefix), (item, index) => {
11456
14796
  return openBlock(), createElementBlock(Fragment, { key: item.id }, [item.sectionHeadline ? (openBlock(), createBlock(ListItemSectionTitle_default, {
11457
14797
  key: 0,
@@ -11467,14 +14807,15 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11467
14807
  "sub-text": item.subText,
11468
14808
  selected: item.selected,
11469
14809
  disabled: item.disabled,
11470
- active: unref(activeId) === item.id,
14810
+ active: activeId.value === item.id,
11471
14811
  special: item.special,
11472
14812
  missing: item.missing,
11473
14813
  variant: __props.variant,
11474
14814
  "trailing-icon": item.missing && !item.disabled ? "trash" : item.selected ? "checkmark" : void 0,
11475
14815
  role: "option",
11476
14816
  onMousedown: _cache[0] || (_cache[0] = ($event) => props.controlledExternally && $event.preventDefault()),
11477
- onClick: ($event) => !item.disabled && emit("itemClick", toOptionId(item.id))
14817
+ onClick: ($event) => !item.disabled && emit("itemClick", toOptionId(item.id)),
14818
+ onMouseenter: ($event) => !item.disabled && (activeId.value = item.id)
11478
14819
  }, null, 8, [
11479
14820
  "id",
11480
14821
  "accessory",
@@ -11487,7 +14828,8 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11487
14828
  "missing",
11488
14829
  "variant",
11489
14830
  "trailing-icon",
11490
- "onClick"
14831
+ "onClick",
14832
+ "onMouseenter"
11491
14833
  ])), item.separator && index < unref(itemsWithPrefix).length - 1 ? (openBlock(), createBlock(unref(KdsDivider_default), {
11492
14834
  key: 2,
11493
14835
  class: "kds-list-item-divider",
@@ -11510,8 +14852,8 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
11510
14852
  });
11511
14853
  //#endregion
11512
14854
  //#region src/components/lists/ListContainer/KdsListContainer.vue
11513
- var KdsListContainer_exports = /* @__PURE__ */ __exportAll({ default: () => KdsListContainer_default });
11514
- var KdsListContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsListContainer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0caa368f"]]);
14855
+ var KdsListContainer_exports = /* @__PURE__ */ __exportAll$1({ default: () => KdsListContainer_default });
14856
+ var KdsListContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsListContainer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-d28d3d15"]]);
11515
14857
  //#endregion
11516
14858
  //#region src/components/forms/inputs/TextInput/KdsTextInput.vue
11517
14859
  var KdsTextInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -17770,7 +21112,7 @@ var KdsSearchInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
17770
21112
  "resultClick"
17771
21113
  ], ["update:modelValue"]),
17772
21114
  setup(__props, { expose: __expose, emit: __emit }) {
17773
- const KdsPopover = defineAsyncComponent(() => import("./KdsPopover-DBU9xVEK.js").then((n) => n.n));
21115
+ const KdsPopover = defineAsyncComponent(() => import("./KdsPopover-FOQyEkHj.js").then((n) => n.n));
17774
21116
  const KdsListContainer = defineAsyncComponent(() => Promise.resolve().then(() => KdsListContainer_exports));
17775
21117
  const props = createPropsRestProxy(__props, [
17776
21118
  "placeholder",
@@ -17894,7 +21236,6 @@ var KdsSearchInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
17894
21236
  "possible-values": __props.results,
17895
21237
  "controlled-externally": "",
17896
21238
  "allow-no-selection": "",
17897
- "item-focus-strategy": "noop",
17898
21239
  "empty-text": "No search results",
17899
21240
  "aria-label": "Search results list",
17900
21241
  onItemClick: onResultClick
@@ -17914,7 +21255,7 @@ var KdsSearchInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
17914
21255
  ]);
17915
21256
  };
17916
21257
  }
17917
- }), [["__scopeId", "data-v-207bc7c1"]]);
21258
+ }), [["__scopeId", "data-v-fe584de9"]]);
17918
21259
  //#endregion
17919
21260
  //#region src/components/forms/inputs/Textarea/KdsTextarea.vue?vue&type=script&setup=true&lang.ts
17920
21261
  var _hoisted_1$35 = [
@@ -21968,7 +25309,7 @@ var KdsInfoToggleButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
21968
25309
  });
21969
25310
  //#endregion
21970
25311
  //#region src/components/forms/_helper/InfoPopover/KdsInfoToggleButton.vue
21971
- var KdsInfoToggleButton_exports = /* @__PURE__ */ __exportAll({ default: () => KdsInfoToggleButton_default });
25312
+ var KdsInfoToggleButton_exports = /* @__PURE__ */ __exportAll$1({ default: () => KdsInfoToggleButton_default });
21972
25313
  var KdsInfoToggleButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsInfoToggleButton_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-e9c62ffb"]]);
21973
25314
  //#endregion
21974
25315
  //#region src/components/forms/_helper/VariablePopover/VariablePopover.vue?vue&type=script&setup=true&lang.ts