monobill-mintui 0.6.699 → 0.6.701

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.
@@ -6,6 +6,7 @@ declare class MintPage extends HTMLElement {
6
6
  static get observedAttributes(): string[];
7
7
  private _root;
8
8
  private _headingElement;
9
+ private _headingFallbackElement;
9
10
  private _backButton;
10
11
  private _actionsSlot;
11
12
  private _overflowActionsSlot;
@@ -1 +1 @@
1
- {"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/page/Page.ts"],"names":[],"mappings":"AACA,OAAO,iBAAiB,CAAA;AACxB,OAAO,eAAe,CAAA;AACtB,OAAO,wBAAwB,CAAA;AAC/B,OAAO,kBAAkB,CAAA;AAEzB,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,eAAe,CAAoB;IAC3C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,oBAAoB,CAAiB;IAC7C,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,sBAAsB,CAA8B;IAC5D,OAAO,CAAC,wBAAwB,CAAgC;IAChE,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,wBAAwB,CAA4C;IAC5E,OAAO,CAAC,mBAAmB,CAA6B;IACxD,OAAO,CAAC,wBAAwB,CAA6B;;IAmI7D,iBAAiB,IAAI,IAAI;IAczB,oBAAoB,IAAI,IAAI;IAO5B,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAI/F,UAAU,IAAI,MAAM;IAIpB,eAAe,IAAI,MAAM;IAIzB,oBAAoB,IAAI,OAAO;IAI/B,aAAa,IAAI,OAAO;IAIxB,MAAM,IAAI,IAAI;IAMd,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,aAAa;IAmFrB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,yBAAyB;IAoBjC,OAAO,CAAC,WAAW;CAyBpB;AAMD,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/page/Page.ts"],"names":[],"mappings":"AACA,OAAO,iBAAiB,CAAA;AACxB,OAAO,eAAe,CAAA;AACtB,OAAO,wBAAwB,CAAA;AAC/B,OAAO,kBAAkB,CAAA;AAEzB,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,eAAe,CAAoB;IAC3C,OAAO,CAAC,uBAAuB,CAAa;IAC5C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,oBAAoB,CAAiB;IAC7C,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,sBAAsB,CAA8B;IAC5D,OAAO,CAAC,wBAAwB,CAAgC;IAChE,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,wBAAwB,CAA4C;IAC5E,OAAO,CAAC,mBAAmB,CAA6B;IACxD,OAAO,CAAC,wBAAwB,CAA6B;;IAoI7D,iBAAiB,IAAI,IAAI;IAczB,oBAAoB,IAAI,IAAI;IAO5B,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAI/F,UAAU,IAAI,MAAM;IAIpB,eAAe,IAAI,MAAM;IAIzB,oBAAoB,IAAI,OAAO;IAI/B,aAAa,IAAI,OAAO;IAIxB,MAAM,IAAI,IAAI;IAMd,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,aAAa;IAqFrB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,yBAAyB;IAoBjC,OAAO,CAAC,WAAW;CAyBpB;AAMD,eAAe,QAAQ,CAAA"}
@@ -34,18 +34,19 @@ var t = class extends HTMLElement {
34
34
  ];
35
35
  }
36
36
  constructor() {
37
- super(), this._actionsResizeObserver = null, this._actionsMutationObserver = null, this._actionsFrame = null, this._groupingActions = !1, this._actionFullWidthOriginal = /* @__PURE__ */ new WeakMap(), this._autoGroupedActions = /* @__PURE__ */ new WeakSet(), this._explicitOverflowActions = /* @__PURE__ */ new WeakSet(), this._root = this.attachShadow({ mode: "open" }), this._root.innerHTML = "\n <style>\n /* The built-in back button lives inside this component's shadow root,\n so document-level button.css cannot reach its light-DOM button. */\n /* Avoid an inline baseline line box below the native button core. */\n .mint-page-back mint-button {\n box-sizing: border-box;\n display: flex !important;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n line-height: 0;\n vertical-align: middle;\n }\n .mint-page-back mint-button .mint-button-core {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n min-width: 2.25rem;\n min-height: 2.25rem;\n padding: .375rem;\n border: 2px solid var(--mint-color-border, #dfe6e0);\n border-top-color: #e5e7eb;\n border-left-color: #e5e7eb;\n border-right-color: #d1d5db;\n border-bottom-color: #d1d5db;\n border-radius: .5rem;\n background: var(--mint-color-surface, #fff);\n color: var(--mint-color-text, #28372d);\n font: inherit;\n box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n cursor: pointer;\n transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;\n }\n .mint-page-back mint-button .mint-button-core:hover:not(:disabled) { filter: brightness(.98); }\n .mint-page-back mint-button .mint-button-core:active:not(:disabled) {\n border-top-color: #9ca3af;\n border-left-color: #9ca3af;\n border-right-color: #e5e7eb;\n border-bottom-color: #e5e7eb;\n background: #f3f4f6;\n box-shadow: inset 0 2px 4px rgb(16 32 21 / 26%), inset 0 1px 2px rgb(6 25 15 / 14%);\n filter: brightness(.97);\n }\n .mint-page-back mint-button .mint-button-core:focus-visible {\n outline: 3px solid var(--mint-color-focus, #6eaa86);\n outline-offset: 2px;\n }\n .mint-page-actions-menu { box-sizing: border-box; display: flex; min-width: 14rem; flex-direction: column; gap: .25rem; padding: .375rem; }\n .mint-page-actions-primary { display: flex; align-items: center; gap: .5rem; min-width: 0; }\n .mint-page-actions-menu ::slotted(*) { box-sizing: border-box; display: block; width: 100%; }\n .mint-page-actions-menu ::slotted(div) { display: flex; flex-direction: column !important; align-items: stretch !important; gap: .25rem !important; }\n .mint-page-actions-trigger { display: inline-flex; vertical-align: middle; }\n .mint-page-actions-trigger[hidden] { display: none !important; }\n .mint-page-actions-trigger .mint-button-core {\n box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;\n width: 2.5rem; height: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; padding: .5rem;\n border: 2px solid var(--mint-color-border, #dfe6e0); border-radius: .625rem;\n background: var(--mint-color-surface, #fff); color: var(--mint-color-text, #28372d);\n font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n }\n .mint-page-actions-trigger .mint-button-icon { display: inline-flex; width: 1.125rem; height: 1.125rem; }\n .mint-page-actions-trigger .mint-button-icon mint-icon { width: 100% !important; height: 100% !important; }\n .mint-page-actions-popover { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; }\n .mint-page-actions-popover:not([data-open]):not([data-state=\"closing\"]),\n .mint-page-actions-popover.hidden { display: none !important; }\n .mint-page-actions-popover[data-open],\n .mint-page-actions-popover[data-state=\"closing\"] {\n display: block; box-sizing: border-box; width: max-content; height: max-content;\n min-height: 0; max-width: calc(100vw - 24px); max-height: min(500px, calc(100vh - 24px));\n max-height: min(500px, calc(100svh - 24px)); overflow: auto; padding: 0;\n border: 1px solid var(--mint-color-border, #dfe6e0); border-radius: .75rem;\n background: var(--mint-color-surface-raised, #fff); color: var(--mint-color-text, #28372d);\n box-shadow: 0 12px 36px rgb(16 32 21 / 13%); pointer-events: auto;\n transform-origin: var(--mint-popover-origin-x, 50%) var(--mint-popover-origin-y, 0%);\n }\n .mint-page-actions-popover[data-state=\"closing\"] { pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-none { position: fixed; inset: 0; z-index: 55; pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-auto {\n position: fixed; z-index: 60; min-width: 14rem; border-radius: .75rem;\n background: var(--mint-color-surface, #fff); pointer-events: auto;\n }\n .mint-page-actions-popover .popover-content {\n min-height: 0; overflow: visible; border: 1px solid var(--mint-color-border, #dfe6e0);\n border-radius: .75rem; background: var(--mint-color-surface, #fff);\n box-shadow: 0 12px 30px rgb(15 23 42 / 16%); padding: 0;\n }\n .mint-page-actions[hidden] { display: none !important; }\n </style>\n <div part=\"container\" class=\"mint-page-container\">\n <header part=\"header\" class=\"mint-page-header\">\n <div part=\"title\" class=\"mint-page-title\">\n <mint-back-button part=\"back-button\" class=\"mint-page-back\" aria-label=\"Go back\" hidden></mint-back-button>\n <h1 part=\"heading\" class=\"mint-page-heading\"></h1>\n </div>\n <div part=\"actions\" class=\"mint-page-actions\" hidden>\n <div class=\"mint-page-actions-primary\"><slot name=\"actions\"></slot></div>\n <mint-button id=\"mint-page-actions-trigger\" class=\"mint-page-actions-trigger\" variant=\"outline\" icon=\"ellipsis\" aria-label=\"Page actions\"></mint-button>\n <mint-popover id=\"mint-page-actions-popover\" class=\"mint-page-actions-popover\" trigger-id=\"mint-page-actions-trigger\" direction=\"down\" trigger-align=\"end\" padding=\"0\">\n <div class=\"mint-page-actions-menu\"><slot name=\"overflow-actions\"></slot></div>\n </mint-popover>\n </div>\n </header>\n <main part=\"body\" class=\"mint-page-body\"><slot></slot></main>\n </div>\n ", this._headingElement = this._root.querySelector(".mint-page-heading"), this._backButton = this._root.querySelector(".mint-page-back"), this._actionsSlot = this._root.querySelector("slot[name=\"actions\"]"), this._overflowActionsSlot = this._root.querySelector("slot[name=\"overflow-actions\"]"), this._actionsWrapper = this._root.querySelector(".mint-page-actions"), this._actionsTrigger = this._root.querySelector("#mint-page-actions-trigger"), this._actionsPopover = this._root.querySelector("#mint-page-actions-popover"), this._actionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._overflowActionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._backButton.addEventListener("click", (e) => this._handleBack(e), !0);
37
+ super(), this._actionsResizeObserver = null, this._actionsMutationObserver = null, this._actionsFrame = null, this._groupingActions = !1, this._actionFullWidthOriginal = /* @__PURE__ */ new WeakMap(), this._autoGroupedActions = /* @__PURE__ */ new WeakSet(), this._explicitOverflowActions = /* @__PURE__ */ new WeakSet(), this._root = this.attachShadow({ mode: "open" }), this._root.innerHTML = "\n <style>\n /* The built-in back button lives inside this component's shadow root,\n so document-level button.css cannot reach its light-DOM button. */\n /* Avoid an inline baseline line box below the native button core. */\n .mint-page-back mint-button {\n box-sizing: border-box;\n display: flex !important;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n line-height: 0;\n vertical-align: middle;\n }\n .mint-page-back mint-button .mint-button-core {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n min-width: 2.25rem;\n min-height: 2.25rem;\n padding: .375rem;\n border: 2px solid var(--mint-color-border, #dfe6e0);\n border-top-color: #e5e7eb;\n border-left-color: #e5e7eb;\n border-right-color: #d1d5db;\n border-bottom-color: #d1d5db;\n border-radius: .5rem;\n background: var(--mint-color-surface, #fff);\n color: var(--mint-color-text, #28372d);\n font: inherit;\n box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n cursor: pointer;\n transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;\n }\n .mint-page-back mint-button .mint-button-core:hover:not(:disabled) { filter: brightness(.98); }\n .mint-page-back mint-button .mint-button-core:active:not(:disabled) {\n border-top-color: #9ca3af;\n border-left-color: #9ca3af;\n border-right-color: #e5e7eb;\n border-bottom-color: #e5e7eb;\n background: #f3f4f6;\n box-shadow: inset 0 2px 4px rgb(16 32 21 / 26%), inset 0 1px 2px rgb(6 25 15 / 14%);\n filter: brightness(.97);\n }\n .mint-page-back mint-button .mint-button-core:focus-visible {\n outline: 3px solid var(--mint-color-focus, #6eaa86);\n outline-offset: 2px;\n }\n .mint-page-actions-menu { box-sizing: border-box; display: flex; min-width: 14rem; flex-direction: column; gap: .25rem; padding: .375rem; }\n .mint-page-actions-primary { display: flex; align-items: center; gap: .5rem; min-width: 0; }\n .mint-page-actions-menu ::slotted(*) { box-sizing: border-box; display: block; width: 100%; }\n .mint-page-actions-menu ::slotted(div) { display: flex; flex-direction: column !important; align-items: stretch !important; gap: .25rem !important; }\n .mint-page-actions-trigger { display: inline-flex; vertical-align: middle; }\n .mint-page-actions-trigger[hidden] { display: none !important; }\n .mint-page-actions-trigger .mint-button-core {\n box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;\n width: 2.5rem; height: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; padding: .5rem;\n border: 2px solid var(--mint-color-border, #dfe6e0); border-radius: .625rem;\n background: var(--mint-color-surface, #fff); color: var(--mint-color-text, #28372d);\n font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n }\n .mint-page-actions-trigger .mint-button-icon { display: inline-flex; width: 1.125rem; height: 1.125rem; }\n .mint-page-actions-trigger .mint-button-icon mint-icon { width: 100% !important; height: 100% !important; }\n .mint-page-actions-popover { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; }\n .mint-page-actions-popover:not([data-open]):not([data-state=\"closing\"]),\n .mint-page-actions-popover.hidden { display: none !important; }\n .mint-page-actions-popover[data-open],\n .mint-page-actions-popover[data-state=\"closing\"] {\n display: block; box-sizing: border-box; width: max-content; height: max-content;\n min-height: 0; max-width: calc(100vw - 24px); max-height: min(500px, calc(100vh - 24px));\n max-height: min(500px, calc(100svh - 24px)); overflow: auto; padding: 0;\n border: 1px solid var(--mint-color-border, #dfe6e0); border-radius: .75rem;\n background: var(--mint-color-surface-raised, #fff); color: var(--mint-color-text, #28372d);\n box-shadow: 0 12px 36px rgb(16 32 21 / 13%); pointer-events: auto;\n transform-origin: var(--mint-popover-origin-x, 50%) var(--mint-popover-origin-y, 0%);\n }\n .mint-page-actions-popover[data-state=\"closing\"] { pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-none { position: fixed; inset: 0; z-index: 55; pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-auto {\n position: fixed; z-index: 60; min-width: 14rem; border-radius: .75rem;\n background: var(--mint-color-surface, #fff); pointer-events: auto;\n }\n .mint-page-actions-popover .popover-content {\n min-height: 0; overflow: visible; border: 1px solid var(--mint-color-border, #dfe6e0);\n border-radius: .75rem; background: var(--mint-color-surface, #fff);\n box-shadow: 0 12px 30px rgb(15 23 42 / 16%); padding: 0;\n }\n .mint-page-actions[hidden] { display: none !important; }\n </style>\n <div part=\"container\" class=\"mint-page-container\">\n <header part=\"header\" class=\"mint-page-header\">\n <div part=\"title\" class=\"mint-page-title\">\n <mint-back-button part=\"back-button\" class=\"mint-page-back\" aria-label=\"Go back\" hidden></mint-back-button>\n <h1 part=\"heading\" class=\"mint-page-heading\"><slot name=\"heading\"><span class=\"mint-page-heading-fallback\"></span></slot></h1>\n </div>\n <div part=\"actions\" class=\"mint-page-actions\" hidden>\n <div class=\"mint-page-actions-primary\"><slot name=\"actions\"></slot></div>\n <mint-button id=\"mint-page-actions-trigger\" class=\"mint-page-actions-trigger\" variant=\"outline\" icon=\"ellipsis\" aria-label=\"Page actions\"></mint-button>\n <mint-popover id=\"mint-page-actions-popover\" class=\"mint-page-actions-popover\" trigger-id=\"mint-page-actions-trigger\" direction=\"down\" trigger-align=\"end\" padding=\"0\">\n <div class=\"mint-page-actions-menu\"><slot name=\"overflow-actions\"></slot></div>\n </mint-popover>\n </div>\n </header>\n <main part=\"body\" class=\"mint-page-body\"><slot></slot></main>\n </div>\n ", this._headingElement = this._root.querySelector(".mint-page-heading"), this._headingFallbackElement = this._root.querySelector(".mint-page-heading-fallback"), this._backButton = this._root.querySelector(".mint-page-back"), this._actionsSlot = this._root.querySelector("slot[name=\"actions\"]"), this._overflowActionsSlot = this._root.querySelector("slot[name=\"overflow-actions\"]"), this._actionsWrapper = this._root.querySelector(".mint-page-actions"), this._actionsTrigger = this._root.querySelector("#mint-page-actions-trigger"), this._actionsPopover = this._root.querySelector("#mint-page-actions-popover"), this._actionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._overflowActionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._backButton.addEventListener("click", (e) => this._handleBack(e), !0);
38
38
  }
39
39
  connectedCallback() {
40
40
  this.render(), this._actionsResizeObserver = new ResizeObserver(() => this._scheduleActionGrouping()), this._actionsResizeObserver.observe(this._root.querySelector(".mint-page-header")), this._actionsMutationObserver = new MutationObserver((e) => {
41
- e.some((e) => e.type === "childList" || e.attributeName === "importance" || e.attributeName === "always-grouped" || e.attributeName === "slot" && !["actions", "overflow-actions"].includes(e.target.getAttribute("slot") || "")) && this._scheduleActionGrouping();
41
+ e.some((e) => e.type === "childList" || e.attributeName === "importance" || e.attributeName === "always-grouped" || e.attributeName === "always-visible" || e.attributeName === "slot" && !["actions", "overflow-actions"].includes(e.target.getAttribute("slot") || "")) && this._scheduleActionGrouping();
42
42
  }), this._actionsMutationObserver.observe(this, {
43
43
  childList: !0,
44
44
  attributes: !0,
45
45
  attributeFilter: [
46
46
  "slot",
47
47
  "importance",
48
- "always-grouped"
48
+ "always-grouped",
49
+ "always-visible"
49
50
  ]
50
51
  }), this._scheduleActionGrouping();
51
52
  }
@@ -68,7 +69,7 @@ var t = class extends HTMLElement {
68
69
  return this.hasAttribute("containered") && this.getAttribute("containered") !== "false";
69
70
  }
70
71
  render() {
71
- this._headingElement.textContent = this.getHeading(), this._backButton.setAttribute("fallback-href", this.getFallbackHref()), this._backButton.hidden = !this.shouldShowBackButton();
72
+ this._headingFallbackElement.textContent = this.getHeading(), this._backButton.setAttribute("fallback-href", this.getFallbackHref()), this._backButton.hidden = !this.shouldShowBackButton();
72
73
  }
73
74
  _scheduleActionGrouping() {
74
75
  this._actionsFrame !== null || !this.isConnected || (this._actionsFrame = requestAnimationFrame(() => {
@@ -86,29 +87,29 @@ var t = class extends HTMLElement {
86
87
  e.forEach((e) => {
87
88
  e.getAttribute("slot") === "overflow-actions" && !this._autoGroupedActions.has(e) && this._explicitOverflowActions.add(e);
88
89
  });
89
- let t = e.filter((e) => e.hasAttribute("always-grouped") || this._explicitOverflowActions.has(e)), n = e.filter((e) => !t.includes(e));
90
- if (e.length === 1 && t.length === 0) {
90
+ let t = e.filter((e) => e.hasAttribute("always-visible")), n = e.filter((e) => !t.includes(e) && (e.hasAttribute("always-grouped") || this._explicitOverflowActions.has(e))), r = e.filter((e) => !n.includes(e) && !t.includes(e));
91
+ if (e.length === 1 && n.length === 0) {
91
92
  this._setActionSlot(e[0], "actions"), this._syncOverflowButtonWidths([]), this._actionsTrigger.hidden = !0, this._actionsPopover.style.display = "none", this._groupingActions = !1;
92
93
  return;
93
94
  }
94
- n.forEach((e) => this._setActionSlot(e, "actions")), t.forEach((e) => this._setActionSlot(e, "overflow-actions")), this._syncOverflowButtonWidths([]), this._actionsPopover.style.display = "", this._actionsTrigger.hidden = !0;
95
- let r = this._root.querySelector(".mint-page-actions-primary"), i = this._root.querySelector(".mint-page-header"), a = this._root.querySelector(".mint-page-heading");
96
- this._actionsResizeObserver?.observe(r), e.forEach((e) => this._actionsResizeObserver?.observe(e));
97
- let o = i.clientWidth <= 767, s = n.reduce((e, t, n) => e + t.getBoundingClientRect().width + (n ? 8 : 0), 0), c = this._backButton.hidden ? 0 : this._backButton.getBoundingClientRect().width + 16, l = Math.min(i.clientWidth, a.scrollWidth + c), u = Math.max(0, i.clientWidth - l - 16), d = [...t], f = (e) => {
95
+ r.forEach((e) => this._setActionSlot(e, "actions")), n.forEach((e) => this._setActionSlot(e, "overflow-actions")), this._syncOverflowButtonWidths([]), this._actionsPopover.style.display = "", this._actionsTrigger.hidden = !0;
96
+ let i = this._root.querySelector(".mint-page-actions-primary"), a = this._root.querySelector(".mint-page-header"), o = this._root.querySelector(".mint-page-heading");
97
+ this._actionsResizeObserver?.observe(i), e.forEach((e) => this._actionsResizeObserver?.observe(e));
98
+ let s = a.clientWidth <= 767, c = e.filter((e) => !n.includes(e)).reduce((e, t, n) => e + t.getBoundingClientRect().width + (n ? 8 : 0), 0), l = this._backButton.hidden ? 0 : this._backButton.getBoundingClientRect().width + 16, u = Math.min(a.clientWidth, o.scrollWidth + l), d = Math.max(0, a.clientWidth - u - 16), f = [...n], p = (e) => {
98
99
  let t = e.getAttribute("importance"), n = e.querySelector("[importance]")?.getAttribute("importance"), r = Number(t ?? n ?? 1);
99
100
  return Number.isFinite(r) && r > 0 ? r : 1;
100
101
  };
101
- !o && s > u && (u = Math.max(0, u - 48));
102
- let p = s;
103
- for (; o ? n.length > d.length - t.length : p > u && d.length < e.length;) {
104
- let t = n.filter((e) => !d.includes(e));
105
- t.sort((t, n) => f(n) - f(t) || e.indexOf(n) - e.indexOf(t));
106
- let r = t[0];
107
- if (!r) break;
108
- d.push(r), p -= r.getBoundingClientRect().width + (d.length < e.length ? 8 : 0);
102
+ !s && c > d && (d = Math.max(0, d - 48));
103
+ let m = c;
104
+ for (; s ? r.length > f.length - n.length : m > d && f.length < e.length;) {
105
+ let t = r.filter((e) => !f.includes(e));
106
+ t.sort((t, n) => p(n) - p(t) || e.indexOf(n) - e.indexOf(t));
107
+ let n = t[0];
108
+ if (!n) break;
109
+ f.push(n), m -= n.getBoundingClientRect().width + (f.length < e.length ? 8 : 0);
109
110
  }
110
- let m = new Set(d);
111
- e.forEach((e) => this._setActionSlot(e, m.has(e) ? "overflow-actions" : "actions")), this._actionsTrigger.hidden = d.length === 0, this._actionsPopover.style.display = d.length === 0 ? "none" : "", this._syncOverflowButtonWidths(d), this._actionsResizeObserver?.observe(this._actionsTrigger), this._groupingActions = !1;
111
+ let h = new Set(f);
112
+ e.forEach((e) => this._setActionSlot(e, h.has(e) ? "overflow-actions" : "actions")), this._actionsTrigger.hidden = f.length === 0, this._actionsPopover.style.display = f.length === 0 ? "none" : "", this._syncOverflowButtonWidths(f), this._actionsResizeObserver?.observe(this._actionsTrigger), this._groupingActions = !1;
112
113
  }
113
114
  _setActionSlot(e, t) {
114
115
  t === "overflow-actions" ? this._autoGroupedActions.add(e) : this._autoGroupedActions.delete(e), e.getAttribute("slot") !== t && e.setAttribute("slot", t);
@@ -95,7 +95,7 @@ require(`../chunks/icon-B8hR_TFn.js`);const e=require(`../chunks/register-elemen
95
95
  <header part="header" class="mint-page-header">
96
96
  <div part="title" class="mint-page-title">
97
97
  <mint-back-button part="back-button" class="mint-page-back" aria-label="Go back" hidden></mint-back-button>
98
- <h1 part="heading" class="mint-page-heading"></h1>
98
+ <h1 part="heading" class="mint-page-heading"><slot name="heading"><span class="mint-page-heading-fallback"></span></slot></h1>
99
99
  </div>
100
100
  <div part="actions" class="mint-page-actions" hidden>
101
101
  <div class="mint-page-actions-primary"><slot name="actions"></slot></div>
@@ -107,4 +107,4 @@ require(`../chunks/icon-B8hR_TFn.js`);const e=require(`../chunks/register-elemen
107
107
  </header>
108
108
  <main part="body" class="mint-page-body"><slot></slot></main>
109
109
  </div>
110
- `,this._headingElement=this._root.querySelector(`.mint-page-heading`),this._backButton=this._root.querySelector(`.mint-page-back`),this._actionsSlot=this._root.querySelector(`slot[name="actions"]`),this._overflowActionsSlot=this._root.querySelector(`slot[name="overflow-actions"]`),this._actionsWrapper=this._root.querySelector(`.mint-page-actions`),this._actionsTrigger=this._root.querySelector(`#mint-page-actions-trigger`),this._actionsPopover=this._root.querySelector(`#mint-page-actions-popover`),this._actionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._overflowActionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._backButton.addEventListener(`click`,e=>this._handleBack(e),!0)}connectedCallback(){this.render(),this._actionsResizeObserver=new ResizeObserver(()=>this._scheduleActionGrouping()),this._actionsResizeObserver.observe(this._root.querySelector(`.mint-page-header`)),this._actionsMutationObserver=new MutationObserver(e=>{e.some(e=>e.type===`childList`||e.attributeName===`importance`||e.attributeName===`always-grouped`||e.attributeName===`slot`&&![`actions`,`overflow-actions`].includes(e.target.getAttribute(`slot`)||``))&&this._scheduleActionGrouping()}),this._actionsMutationObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`,`importance`,`always-grouped`]}),this._scheduleActionGrouping()}disconnectedCallback(){this._actionsResizeObserver?.disconnect(),this._actionsMutationObserver?.disconnect(),this._actionsFrame!==null&&cancelAnimationFrame(this._actionsFrame),this._actionsFrame=null}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}isContainered(){return this.hasAttribute(`containered`)&&this.getAttribute(`containered`)!==`false`}render(){this._headingElement.textContent=this.getHeading(),this._backButton.setAttribute(`fallback-href`,this.getFallbackHref()),this._backButton.hidden=!this.shouldShowBackButton()}_scheduleActionGrouping(){this._actionsFrame!==null||!this.isConnected||(this._actionsFrame=requestAnimationFrame(()=>{this._actionsFrame=null,this._groupActions()}))}_groupActions(){if(this._groupingActions)return;this._groupingActions=!0;let e=Array.from(this.children).filter(e=>e instanceof HTMLElement&&(e.getAttribute(`slot`)===`actions`||e.getAttribute(`slot`)===`overflow-actions`));if(this._actionsWrapper.hidden=e.length===0,!e.length){this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._actionsWrapper.hidden=!0,this._groupingActions=!1;return}e.forEach(e=>{e.getAttribute(`slot`)===`overflow-actions`&&!this._autoGroupedActions.has(e)&&this._explicitOverflowActions.add(e)});let t=e.filter(e=>e.hasAttribute(`always-grouped`)||this._explicitOverflowActions.has(e)),n=e.filter(e=>!t.includes(e));if(e.length===1&&t.length===0){this._setActionSlot(e[0],`actions`),this._syncOverflowButtonWidths([]),this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._groupingActions=!1;return}n.forEach(e=>this._setActionSlot(e,`actions`)),t.forEach(e=>this._setActionSlot(e,`overflow-actions`)),this._syncOverflowButtonWidths([]),this._actionsPopover.style.display=``,this._actionsTrigger.hidden=!0;let r=this._root.querySelector(`.mint-page-actions-primary`),i=this._root.querySelector(`.mint-page-header`),a=this._root.querySelector(`.mint-page-heading`);this._actionsResizeObserver?.observe(r),e.forEach(e=>this._actionsResizeObserver?.observe(e));let o=i.clientWidth<=767,s=n.reduce((e,t,n)=>e+t.getBoundingClientRect().width+(n?8:0),0),c=this._backButton.hidden?0:this._backButton.getBoundingClientRect().width+16,l=Math.min(i.clientWidth,a.scrollWidth+c),u=Math.max(0,i.clientWidth-l-16),d=[...t],f=e=>{let t=e.getAttribute(`importance`),n=e.querySelector(`[importance]`)?.getAttribute(`importance`),r=Number(t??n??1);return Number.isFinite(r)&&r>0?r:1};!o&&s>u&&(u=Math.max(0,u-48));let p=s;for(;o?n.length>d.length-t.length:p>u&&d.length<e.length;){let t=n.filter(e=>!d.includes(e));t.sort((t,n)=>f(n)-f(t)||e.indexOf(n)-e.indexOf(t));let r=t[0];if(!r)break;d.push(r),p-=r.getBoundingClientRect().width+(d.length<e.length?8:0)}let m=new Set(d);e.forEach(e=>this._setActionSlot(e,m.has(e)?`overflow-actions`:`actions`)),this._actionsTrigger.hidden=d.length===0,this._actionsPopover.style.display=d.length===0?`none`:``,this._syncOverflowButtonWidths(d),this._actionsResizeObserver?.observe(this._actionsTrigger),this._groupingActions=!1}_setActionSlot(e,t){t===`overflow-actions`?this._autoGroupedActions.add(e):this._autoGroupedActions.delete(e),e.getAttribute(`slot`)!==t&&e.setAttribute(`slot`,t)}_syncOverflowButtonWidths(e){let t=new Set;e.forEach(e=>{e.matches(`mint-button`)&&t.add(e),e.querySelectorAll(`mint-button`).forEach(e=>t.add(e))}),Array.from(this.querySelectorAll(`mint-button[slot="actions"], mint-button[slot="overflow-actions"], [slot="actions"] mint-button, [slot="overflow-actions"] mint-button`)).forEach(e=>{if(t.has(e))this._actionFullWidthOriginal.has(e)||this._actionFullWidthOriginal.set(e,e.getAttribute(`full-width`)),e.setAttribute(`full-width`,`true`);else if(this._actionFullWidthOriginal.has(e)){let t=this._actionFullWidthOriginal.get(e);t===null?e.removeAttribute(`full-width`):t!==void 0&&e.setAttribute(`full-width`,t),this._actionFullWidthOriginal.delete(e)}})}_handleBack(e){e.preventDefault(),e.stopPropagation();let t=document.referrer,n=!!(t&&(()=>{try{return new URL(t).origin===window.location.origin}catch{return!1}})()),r={url:n?t:this.getFallbackHref(),isFromReferrer:n,referrer:t||null,fallbackHref:this.getFallbackHref()},i=new CustomEvent(`back`,{detail:r,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)&&(n&&window.history.length>1?window.history.back():window.location.href=this.getFallbackHref())}};typeof customElements<`u`&&!customElements.get(`mint-page`)&&e.t(`mint-page`,t),module.exports=t;
110
+ `,this._headingElement=this._root.querySelector(`.mint-page-heading`),this._headingFallbackElement=this._root.querySelector(`.mint-page-heading-fallback`),this._backButton=this._root.querySelector(`.mint-page-back`),this._actionsSlot=this._root.querySelector(`slot[name="actions"]`),this._overflowActionsSlot=this._root.querySelector(`slot[name="overflow-actions"]`),this._actionsWrapper=this._root.querySelector(`.mint-page-actions`),this._actionsTrigger=this._root.querySelector(`#mint-page-actions-trigger`),this._actionsPopover=this._root.querySelector(`#mint-page-actions-popover`),this._actionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._overflowActionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._backButton.addEventListener(`click`,e=>this._handleBack(e),!0)}connectedCallback(){this.render(),this._actionsResizeObserver=new ResizeObserver(()=>this._scheduleActionGrouping()),this._actionsResizeObserver.observe(this._root.querySelector(`.mint-page-header`)),this._actionsMutationObserver=new MutationObserver(e=>{e.some(e=>e.type===`childList`||e.attributeName===`importance`||e.attributeName===`always-grouped`||e.attributeName===`always-visible`||e.attributeName===`slot`&&![`actions`,`overflow-actions`].includes(e.target.getAttribute(`slot`)||``))&&this._scheduleActionGrouping()}),this._actionsMutationObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`,`importance`,`always-grouped`,`always-visible`]}),this._scheduleActionGrouping()}disconnectedCallback(){this._actionsResizeObserver?.disconnect(),this._actionsMutationObserver?.disconnect(),this._actionsFrame!==null&&cancelAnimationFrame(this._actionsFrame),this._actionsFrame=null}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}isContainered(){return this.hasAttribute(`containered`)&&this.getAttribute(`containered`)!==`false`}render(){this._headingFallbackElement.textContent=this.getHeading(),this._backButton.setAttribute(`fallback-href`,this.getFallbackHref()),this._backButton.hidden=!this.shouldShowBackButton()}_scheduleActionGrouping(){this._actionsFrame!==null||!this.isConnected||(this._actionsFrame=requestAnimationFrame(()=>{this._actionsFrame=null,this._groupActions()}))}_groupActions(){if(this._groupingActions)return;this._groupingActions=!0;let e=Array.from(this.children).filter(e=>e instanceof HTMLElement&&(e.getAttribute(`slot`)===`actions`||e.getAttribute(`slot`)===`overflow-actions`));if(this._actionsWrapper.hidden=e.length===0,!e.length){this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._actionsWrapper.hidden=!0,this._groupingActions=!1;return}e.forEach(e=>{e.getAttribute(`slot`)===`overflow-actions`&&!this._autoGroupedActions.has(e)&&this._explicitOverflowActions.add(e)});let t=e.filter(e=>e.hasAttribute(`always-visible`)),n=e.filter(e=>!t.includes(e)&&(e.hasAttribute(`always-grouped`)||this._explicitOverflowActions.has(e))),r=e.filter(e=>!n.includes(e)&&!t.includes(e));if(e.length===1&&n.length===0){this._setActionSlot(e[0],`actions`),this._syncOverflowButtonWidths([]),this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._groupingActions=!1;return}r.forEach(e=>this._setActionSlot(e,`actions`)),n.forEach(e=>this._setActionSlot(e,`overflow-actions`)),this._syncOverflowButtonWidths([]),this._actionsPopover.style.display=``,this._actionsTrigger.hidden=!0;let i=this._root.querySelector(`.mint-page-actions-primary`),a=this._root.querySelector(`.mint-page-header`),o=this._root.querySelector(`.mint-page-heading`);this._actionsResizeObserver?.observe(i),e.forEach(e=>this._actionsResizeObserver?.observe(e));let s=a.clientWidth<=767,c=e.filter(e=>!n.includes(e)).reduce((e,t,n)=>e+t.getBoundingClientRect().width+(n?8:0),0),l=this._backButton.hidden?0:this._backButton.getBoundingClientRect().width+16,u=Math.min(a.clientWidth,o.scrollWidth+l),d=Math.max(0,a.clientWidth-u-16),f=[...n],p=e=>{let t=e.getAttribute(`importance`),n=e.querySelector(`[importance]`)?.getAttribute(`importance`),r=Number(t??n??1);return Number.isFinite(r)&&r>0?r:1};!s&&c>d&&(d=Math.max(0,d-48));let m=c;for(;s?r.length>f.length-n.length:m>d&&f.length<e.length;){let t=r.filter(e=>!f.includes(e));t.sort((t,n)=>p(n)-p(t)||e.indexOf(n)-e.indexOf(t));let n=t[0];if(!n)break;f.push(n),m-=n.getBoundingClientRect().width+(f.length<e.length?8:0)}let h=new Set(f);e.forEach(e=>this._setActionSlot(e,h.has(e)?`overflow-actions`:`actions`)),this._actionsTrigger.hidden=f.length===0,this._actionsPopover.style.display=f.length===0?`none`:``,this._syncOverflowButtonWidths(f),this._actionsResizeObserver?.observe(this._actionsTrigger),this._groupingActions=!1}_setActionSlot(e,t){t===`overflow-actions`?this._autoGroupedActions.add(e):this._autoGroupedActions.delete(e),e.getAttribute(`slot`)!==t&&e.setAttribute(`slot`,t)}_syncOverflowButtonWidths(e){let t=new Set;e.forEach(e=>{e.matches(`mint-button`)&&t.add(e),e.querySelectorAll(`mint-button`).forEach(e=>t.add(e))}),Array.from(this.querySelectorAll(`mint-button[slot="actions"], mint-button[slot="overflow-actions"], [slot="actions"] mint-button, [slot="overflow-actions"] mint-button`)).forEach(e=>{if(t.has(e))this._actionFullWidthOriginal.has(e)||this._actionFullWidthOriginal.set(e,e.getAttribute(`full-width`)),e.setAttribute(`full-width`,`true`);else if(this._actionFullWidthOriginal.has(e)){let t=this._actionFullWidthOriginal.get(e);t===null?e.removeAttribute(`full-width`):t!==void 0&&e.setAttribute(`full-width`,t),this._actionFullWidthOriginal.delete(e)}})}_handleBack(e){e.preventDefault(),e.stopPropagation();let t=document.referrer,n=!!(t&&(()=>{try{return new URL(t).origin===window.location.origin}catch{return!1}})()),r={url:n?t:this.getFallbackHref(),isFromReferrer:n,referrer:t||null,fallbackHref:this.getFallbackHref()},i=new CustomEvent(`back`,{detail:r,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)&&(n&&window.history.length>1?window.history.back():window.location.href=this.getFallbackHref())}};typeof customElements<`u`&&!customElements.get(`mint-page`)&&e.t(`mint-page`,t),module.exports=t;
@@ -22,18 +22,19 @@ var t = class extends HTMLElement {
22
22
  ];
23
23
  }
24
24
  constructor() {
25
- super(), this._actionsResizeObserver = null, this._actionsMutationObserver = null, this._actionsFrame = null, this._groupingActions = !1, this._actionFullWidthOriginal = /* @__PURE__ */ new WeakMap(), this._autoGroupedActions = /* @__PURE__ */ new WeakSet(), this._explicitOverflowActions = /* @__PURE__ */ new WeakSet(), this._root = this.attachShadow({ mode: "open" }), this._root.innerHTML = "\n <style>\n /* The built-in back button lives inside this component's shadow root,\n so document-level button.css cannot reach its light-DOM button. */\n /* Avoid an inline baseline line box below the native button core. */\n .mint-page-back mint-button {\n box-sizing: border-box;\n display: flex !important;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n line-height: 0;\n vertical-align: middle;\n }\n .mint-page-back mint-button .mint-button-core {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n min-width: 2.25rem;\n min-height: 2.25rem;\n padding: .375rem;\n border: 2px solid var(--mint-color-border, #dfe6e0);\n border-top-color: #e5e7eb;\n border-left-color: #e5e7eb;\n border-right-color: #d1d5db;\n border-bottom-color: #d1d5db;\n border-radius: .5rem;\n background: var(--mint-color-surface, #fff);\n color: var(--mint-color-text, #28372d);\n font: inherit;\n box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n cursor: pointer;\n transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;\n }\n .mint-page-back mint-button .mint-button-core:hover:not(:disabled) { filter: brightness(.98); }\n .mint-page-back mint-button .mint-button-core:active:not(:disabled) {\n border-top-color: #9ca3af;\n border-left-color: #9ca3af;\n border-right-color: #e5e7eb;\n border-bottom-color: #e5e7eb;\n background: #f3f4f6;\n box-shadow: inset 0 2px 4px rgb(16 32 21 / 26%), inset 0 1px 2px rgb(6 25 15 / 14%);\n filter: brightness(.97);\n }\n .mint-page-back mint-button .mint-button-core:focus-visible {\n outline: 3px solid var(--mint-color-focus, #6eaa86);\n outline-offset: 2px;\n }\n .mint-page-actions-menu { box-sizing: border-box; display: flex; min-width: 14rem; flex-direction: column; gap: .25rem; padding: .375rem; }\n .mint-page-actions-primary { display: flex; align-items: center; gap: .5rem; min-width: 0; }\n .mint-page-actions-menu ::slotted(*) { box-sizing: border-box; display: block; width: 100%; }\n .mint-page-actions-menu ::slotted(div) { display: flex; flex-direction: column !important; align-items: stretch !important; gap: .25rem !important; }\n .mint-page-actions-trigger { display: inline-flex; vertical-align: middle; }\n .mint-page-actions-trigger[hidden] { display: none !important; }\n .mint-page-actions-trigger .mint-button-core {\n box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;\n width: 2.5rem; height: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; padding: .5rem;\n border: 2px solid var(--mint-color-border, #dfe6e0); border-radius: .625rem;\n background: var(--mint-color-surface, #fff); color: var(--mint-color-text, #28372d);\n font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n }\n .mint-page-actions-trigger .mint-button-icon { display: inline-flex; width: 1.125rem; height: 1.125rem; }\n .mint-page-actions-trigger .mint-button-icon mint-icon { width: 100% !important; height: 100% !important; }\n .mint-page-actions-popover { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; }\n .mint-page-actions-popover:not([data-open]):not([data-state=\"closing\"]),\n .mint-page-actions-popover.hidden { display: none !important; }\n .mint-page-actions-popover[data-open],\n .mint-page-actions-popover[data-state=\"closing\"] {\n display: block; box-sizing: border-box; width: max-content; height: max-content;\n min-height: 0; max-width: calc(100vw - 24px); max-height: min(500px, calc(100vh - 24px));\n max-height: min(500px, calc(100svh - 24px)); overflow: auto; padding: 0;\n border: 1px solid var(--mint-color-border, #dfe6e0); border-radius: .75rem;\n background: var(--mint-color-surface-raised, #fff); color: var(--mint-color-text, #28372d);\n box-shadow: 0 12px 36px rgb(16 32 21 / 13%); pointer-events: auto;\n transform-origin: var(--mint-popover-origin-x, 50%) var(--mint-popover-origin-y, 0%);\n }\n .mint-page-actions-popover[data-state=\"closing\"] { pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-none { position: fixed; inset: 0; z-index: 55; pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-auto {\n position: fixed; z-index: 60; min-width: 14rem; border-radius: .75rem;\n background: var(--mint-color-surface, #fff); pointer-events: auto;\n }\n .mint-page-actions-popover .popover-content {\n min-height: 0; overflow: visible; border: 1px solid var(--mint-color-border, #dfe6e0);\n border-radius: .75rem; background: var(--mint-color-surface, #fff);\n box-shadow: 0 12px 30px rgb(15 23 42 / 16%); padding: 0;\n }\n .mint-page-actions[hidden] { display: none !important; }\n </style>\n <div part=\"container\" class=\"mint-page-container\">\n <header part=\"header\" class=\"mint-page-header\">\n <div part=\"title\" class=\"mint-page-title\">\n <mint-back-button part=\"back-button\" class=\"mint-page-back\" aria-label=\"Go back\" hidden></mint-back-button>\n <h1 part=\"heading\" class=\"mint-page-heading\"></h1>\n </div>\n <div part=\"actions\" class=\"mint-page-actions\" hidden>\n <div class=\"mint-page-actions-primary\"><slot name=\"actions\"></slot></div>\n <mint-button id=\"mint-page-actions-trigger\" class=\"mint-page-actions-trigger\" variant=\"outline\" icon=\"ellipsis\" aria-label=\"Page actions\"></mint-button>\n <mint-popover id=\"mint-page-actions-popover\" class=\"mint-page-actions-popover\" trigger-id=\"mint-page-actions-trigger\" direction=\"down\" trigger-align=\"end\" padding=\"0\">\n <div class=\"mint-page-actions-menu\"><slot name=\"overflow-actions\"></slot></div>\n </mint-popover>\n </div>\n </header>\n <main part=\"body\" class=\"mint-page-body\"><slot></slot></main>\n </div>\n ", this._headingElement = this._root.querySelector(".mint-page-heading"), this._backButton = this._root.querySelector(".mint-page-back"), this._actionsSlot = this._root.querySelector("slot[name=\"actions\"]"), this._overflowActionsSlot = this._root.querySelector("slot[name=\"overflow-actions\"]"), this._actionsWrapper = this._root.querySelector(".mint-page-actions"), this._actionsTrigger = this._root.querySelector("#mint-page-actions-trigger"), this._actionsPopover = this._root.querySelector("#mint-page-actions-popover"), this._actionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._overflowActionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._backButton.addEventListener("click", (e) => this._handleBack(e), !0);
25
+ super(), this._actionsResizeObserver = null, this._actionsMutationObserver = null, this._actionsFrame = null, this._groupingActions = !1, this._actionFullWidthOriginal = /* @__PURE__ */ new WeakMap(), this._autoGroupedActions = /* @__PURE__ */ new WeakSet(), this._explicitOverflowActions = /* @__PURE__ */ new WeakSet(), this._root = this.attachShadow({ mode: "open" }), this._root.innerHTML = "\n <style>\n /* The built-in back button lives inside this component's shadow root,\n so document-level button.css cannot reach its light-DOM button. */\n /* Avoid an inline baseline line box below the native button core. */\n .mint-page-back mint-button {\n box-sizing: border-box;\n display: flex !important;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n line-height: 0;\n vertical-align: middle;\n }\n .mint-page-back mint-button .mint-button-core {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n min-width: 2.25rem;\n min-height: 2.25rem;\n padding: .375rem;\n border: 2px solid var(--mint-color-border, #dfe6e0);\n border-top-color: #e5e7eb;\n border-left-color: #e5e7eb;\n border-right-color: #d1d5db;\n border-bottom-color: #d1d5db;\n border-radius: .5rem;\n background: var(--mint-color-surface, #fff);\n color: var(--mint-color-text, #28372d);\n font: inherit;\n box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n cursor: pointer;\n transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;\n }\n .mint-page-back mint-button .mint-button-core:hover:not(:disabled) { filter: brightness(.98); }\n .mint-page-back mint-button .mint-button-core:active:not(:disabled) {\n border-top-color: #9ca3af;\n border-left-color: #9ca3af;\n border-right-color: #e5e7eb;\n border-bottom-color: #e5e7eb;\n background: #f3f4f6;\n box-shadow: inset 0 2px 4px rgb(16 32 21 / 26%), inset 0 1px 2px rgb(6 25 15 / 14%);\n filter: brightness(.97);\n }\n .mint-page-back mint-button .mint-button-core:focus-visible {\n outline: 3px solid var(--mint-color-focus, #6eaa86);\n outline-offset: 2px;\n }\n .mint-page-actions-menu { box-sizing: border-box; display: flex; min-width: 14rem; flex-direction: column; gap: .25rem; padding: .375rem; }\n .mint-page-actions-primary { display: flex; align-items: center; gap: .5rem; min-width: 0; }\n .mint-page-actions-menu ::slotted(*) { box-sizing: border-box; display: block; width: 100%; }\n .mint-page-actions-menu ::slotted(div) { display: flex; flex-direction: column !important; align-items: stretch !important; gap: .25rem !important; }\n .mint-page-actions-trigger { display: inline-flex; vertical-align: middle; }\n .mint-page-actions-trigger[hidden] { display: none !important; }\n .mint-page-actions-trigger .mint-button-core {\n box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;\n width: 2.5rem; height: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; padding: .5rem;\n border: 2px solid var(--mint-color-border, #dfe6e0); border-radius: .625rem;\n background: var(--mint-color-surface, #fff); color: var(--mint-color-text, #28372d);\n font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n }\n .mint-page-actions-trigger .mint-button-icon { display: inline-flex; width: 1.125rem; height: 1.125rem; }\n .mint-page-actions-trigger .mint-button-icon mint-icon { width: 100% !important; height: 100% !important; }\n .mint-page-actions-popover { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; }\n .mint-page-actions-popover:not([data-open]):not([data-state=\"closing\"]),\n .mint-page-actions-popover.hidden { display: none !important; }\n .mint-page-actions-popover[data-open],\n .mint-page-actions-popover[data-state=\"closing\"] {\n display: block; box-sizing: border-box; width: max-content; height: max-content;\n min-height: 0; max-width: calc(100vw - 24px); max-height: min(500px, calc(100vh - 24px));\n max-height: min(500px, calc(100svh - 24px)); overflow: auto; padding: 0;\n border: 1px solid var(--mint-color-border, #dfe6e0); border-radius: .75rem;\n background: var(--mint-color-surface-raised, #fff); color: var(--mint-color-text, #28372d);\n box-shadow: 0 12px 36px rgb(16 32 21 / 13%); pointer-events: auto;\n transform-origin: var(--mint-popover-origin-x, 50%) var(--mint-popover-origin-y, 0%);\n }\n .mint-page-actions-popover[data-state=\"closing\"] { pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-none { position: fixed; inset: 0; z-index: 55; pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-auto {\n position: fixed; z-index: 60; min-width: 14rem; border-radius: .75rem;\n background: var(--mint-color-surface, #fff); pointer-events: auto;\n }\n .mint-page-actions-popover .popover-content {\n min-height: 0; overflow: visible; border: 1px solid var(--mint-color-border, #dfe6e0);\n border-radius: .75rem; background: var(--mint-color-surface, #fff);\n box-shadow: 0 12px 30px rgb(15 23 42 / 16%); padding: 0;\n }\n .mint-page-actions[hidden] { display: none !important; }\n </style>\n <div part=\"container\" class=\"mint-page-container\">\n <header part=\"header\" class=\"mint-page-header\">\n <div part=\"title\" class=\"mint-page-title\">\n <mint-back-button part=\"back-button\" class=\"mint-page-back\" aria-label=\"Go back\" hidden></mint-back-button>\n <h1 part=\"heading\" class=\"mint-page-heading\"><slot name=\"heading\"><span class=\"mint-page-heading-fallback\"></span></slot></h1>\n </div>\n <div part=\"actions\" class=\"mint-page-actions\" hidden>\n <div class=\"mint-page-actions-primary\"><slot name=\"actions\"></slot></div>\n <mint-button id=\"mint-page-actions-trigger\" class=\"mint-page-actions-trigger\" variant=\"outline\" icon=\"ellipsis\" aria-label=\"Page actions\"></mint-button>\n <mint-popover id=\"mint-page-actions-popover\" class=\"mint-page-actions-popover\" trigger-id=\"mint-page-actions-trigger\" direction=\"down\" trigger-align=\"end\" padding=\"0\">\n <div class=\"mint-page-actions-menu\"><slot name=\"overflow-actions\"></slot></div>\n </mint-popover>\n </div>\n </header>\n <main part=\"body\" class=\"mint-page-body\"><slot></slot></main>\n </div>\n ", this._headingElement = this._root.querySelector(".mint-page-heading"), this._headingFallbackElement = this._root.querySelector(".mint-page-heading-fallback"), this._backButton = this._root.querySelector(".mint-page-back"), this._actionsSlot = this._root.querySelector("slot[name=\"actions\"]"), this._overflowActionsSlot = this._root.querySelector("slot[name=\"overflow-actions\"]"), this._actionsWrapper = this._root.querySelector(".mint-page-actions"), this._actionsTrigger = this._root.querySelector("#mint-page-actions-trigger"), this._actionsPopover = this._root.querySelector("#mint-page-actions-popover"), this._actionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._overflowActionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._backButton.addEventListener("click", (e) => this._handleBack(e), !0);
26
26
  }
27
27
  connectedCallback() {
28
28
  this.render(), this._actionsResizeObserver = new ResizeObserver(() => this._scheduleActionGrouping()), this._actionsResizeObserver.observe(this._root.querySelector(".mint-page-header")), this._actionsMutationObserver = new MutationObserver((e) => {
29
- e.some((e) => e.type === "childList" || e.attributeName === "importance" || e.attributeName === "always-grouped" || e.attributeName === "slot" && !["actions", "overflow-actions"].includes(e.target.getAttribute("slot") || "")) && this._scheduleActionGrouping();
29
+ e.some((e) => e.type === "childList" || e.attributeName === "importance" || e.attributeName === "always-grouped" || e.attributeName === "always-visible" || e.attributeName === "slot" && !["actions", "overflow-actions"].includes(e.target.getAttribute("slot") || "")) && this._scheduleActionGrouping();
30
30
  }), this._actionsMutationObserver.observe(this, {
31
31
  childList: !0,
32
32
  attributes: !0,
33
33
  attributeFilter: [
34
34
  "slot",
35
35
  "importance",
36
- "always-grouped"
36
+ "always-grouped",
37
+ "always-visible"
37
38
  ]
38
39
  }), this._scheduleActionGrouping();
39
40
  }
@@ -56,7 +57,7 @@ var t = class extends HTMLElement {
56
57
  return this.hasAttribute("containered") && this.getAttribute("containered") !== "false";
57
58
  }
58
59
  render() {
59
- this._headingElement.textContent = this.getHeading(), this._backButton.setAttribute("fallback-href", this.getFallbackHref()), this._backButton.hidden = !this.shouldShowBackButton();
60
+ this._headingFallbackElement.textContent = this.getHeading(), this._backButton.setAttribute("fallback-href", this.getFallbackHref()), this._backButton.hidden = !this.shouldShowBackButton();
60
61
  }
61
62
  _scheduleActionGrouping() {
62
63
  this._actionsFrame !== null || !this.isConnected || (this._actionsFrame = requestAnimationFrame(() => {
@@ -74,29 +75,29 @@ var t = class extends HTMLElement {
74
75
  e.forEach((e) => {
75
76
  e.getAttribute("slot") === "overflow-actions" && !this._autoGroupedActions.has(e) && this._explicitOverflowActions.add(e);
76
77
  });
77
- let t = e.filter((e) => e.hasAttribute("always-grouped") || this._explicitOverflowActions.has(e)), n = e.filter((e) => !t.includes(e));
78
- if (e.length === 1 && t.length === 0) {
78
+ let t = e.filter((e) => e.hasAttribute("always-visible")), n = e.filter((e) => !t.includes(e) && (e.hasAttribute("always-grouped") || this._explicitOverflowActions.has(e))), r = e.filter((e) => !n.includes(e) && !t.includes(e));
79
+ if (e.length === 1 && n.length === 0) {
79
80
  this._setActionSlot(e[0], "actions"), this._syncOverflowButtonWidths([]), this._actionsTrigger.hidden = !0, this._actionsPopover.style.display = "none", this._groupingActions = !1;
80
81
  return;
81
82
  }
82
- n.forEach((e) => this._setActionSlot(e, "actions")), t.forEach((e) => this._setActionSlot(e, "overflow-actions")), this._syncOverflowButtonWidths([]), this._actionsPopover.style.display = "", this._actionsTrigger.hidden = !0;
83
- let r = this._root.querySelector(".mint-page-actions-primary"), i = this._root.querySelector(".mint-page-header"), a = this._root.querySelector(".mint-page-heading");
84
- this._actionsResizeObserver?.observe(r), e.forEach((e) => this._actionsResizeObserver?.observe(e));
85
- let o = i.clientWidth <= 767, s = n.reduce((e, t, n) => e + t.getBoundingClientRect().width + (n ? 8 : 0), 0), c = this._backButton.hidden ? 0 : this._backButton.getBoundingClientRect().width + 16, l = Math.min(i.clientWidth, a.scrollWidth + c), u = Math.max(0, i.clientWidth - l - 16), d = [...t], f = (e) => {
83
+ r.forEach((e) => this._setActionSlot(e, "actions")), n.forEach((e) => this._setActionSlot(e, "overflow-actions")), this._syncOverflowButtonWidths([]), this._actionsPopover.style.display = "", this._actionsTrigger.hidden = !0;
84
+ let i = this._root.querySelector(".mint-page-actions-primary"), a = this._root.querySelector(".mint-page-header"), o = this._root.querySelector(".mint-page-heading");
85
+ this._actionsResizeObserver?.observe(i), e.forEach((e) => this._actionsResizeObserver?.observe(e));
86
+ let s = a.clientWidth <= 767, c = e.filter((e) => !n.includes(e)).reduce((e, t, n) => e + t.getBoundingClientRect().width + (n ? 8 : 0), 0), l = this._backButton.hidden ? 0 : this._backButton.getBoundingClientRect().width + 16, u = Math.min(a.clientWidth, o.scrollWidth + l), d = Math.max(0, a.clientWidth - u - 16), f = [...n], p = (e) => {
86
87
  let t = e.getAttribute("importance"), n = e.querySelector("[importance]")?.getAttribute("importance"), r = Number(t ?? n ?? 1);
87
88
  return Number.isFinite(r) && r > 0 ? r : 1;
88
89
  };
89
- !o && s > u && (u = Math.max(0, u - 48));
90
- let p = s;
91
- for (; o ? n.length > d.length - t.length : p > u && d.length < e.length;) {
92
- let t = n.filter((e) => !d.includes(e));
93
- t.sort((t, n) => f(n) - f(t) || e.indexOf(n) - e.indexOf(t));
94
- let r = t[0];
95
- if (!r) break;
96
- d.push(r), p -= r.getBoundingClientRect().width + (d.length < e.length ? 8 : 0);
90
+ !s && c > d && (d = Math.max(0, d - 48));
91
+ let m = c;
92
+ for (; s ? r.length > f.length - n.length : m > d && f.length < e.length;) {
93
+ let t = r.filter((e) => !f.includes(e));
94
+ t.sort((t, n) => p(n) - p(t) || e.indexOf(n) - e.indexOf(t));
95
+ let n = t[0];
96
+ if (!n) break;
97
+ f.push(n), m -= n.getBoundingClientRect().width + (f.length < e.length ? 8 : 0);
97
98
  }
98
- let m = new Set(d);
99
- e.forEach((e) => this._setActionSlot(e, m.has(e) ? "overflow-actions" : "actions")), this._actionsTrigger.hidden = d.length === 0, this._actionsPopover.style.display = d.length === 0 ? "none" : "", this._syncOverflowButtonWidths(d), this._actionsResizeObserver?.observe(this._actionsTrigger), this._groupingActions = !1;
99
+ let h = new Set(f);
100
+ e.forEach((e) => this._setActionSlot(e, h.has(e) ? "overflow-actions" : "actions")), this._actionsTrigger.hidden = f.length === 0, this._actionsPopover.style.display = f.length === 0 ? "none" : "", this._syncOverflowButtonWidths(f), this._actionsResizeObserver?.observe(this._actionsTrigger), this._groupingActions = !1;
100
101
  }
101
102
  _setActionSlot(e, t) {
102
103
  t === "overflow-actions" ? this._autoGroupedActions.add(e) : this._autoGroupedActions.delete(e), e.getAttribute("slot") !== t && e.setAttribute("slot", t);
package/dist/index.cjs CHANGED
@@ -207,7 +207,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
207
207
  <header part="header" class="mint-page-header">
208
208
  <div part="title" class="mint-page-title">
209
209
  <mint-back-button part="back-button" class="mint-page-back" aria-label="Go back" hidden></mint-back-button>
210
- <h1 part="heading" class="mint-page-heading"></h1>
210
+ <h1 part="heading" class="mint-page-heading"><slot name="heading"><span class="mint-page-heading-fallback"></span></slot></h1>
211
211
  </div>
212
212
  <div part="actions" class="mint-page-actions" hidden>
213
213
  <div class="mint-page-actions-primary"><slot name="actions"></slot></div>
@@ -219,7 +219,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
219
219
  </header>
220
220
  <main part="body" class="mint-page-body"><slot></slot></main>
221
221
  </div>
222
- `,this._headingElement=this._root.querySelector(`.mint-page-heading`),this._backButton=this._root.querySelector(`.mint-page-back`),this._actionsSlot=this._root.querySelector(`slot[name="actions"]`),this._overflowActionsSlot=this._root.querySelector(`slot[name="overflow-actions"]`),this._actionsWrapper=this._root.querySelector(`.mint-page-actions`),this._actionsTrigger=this._root.querySelector(`#mint-page-actions-trigger`),this._actionsPopover=this._root.querySelector(`#mint-page-actions-popover`),this._actionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._overflowActionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._backButton.addEventListener(`click`,e=>this._handleBack(e),!0)}connectedCallback(){this.render(),this._actionsResizeObserver=new ResizeObserver(()=>this._scheduleActionGrouping()),this._actionsResizeObserver.observe(this._root.querySelector(`.mint-page-header`)),this._actionsMutationObserver=new MutationObserver(e=>{e.some(e=>e.type===`childList`||e.attributeName===`importance`||e.attributeName===`always-grouped`||e.attributeName===`slot`&&![`actions`,`overflow-actions`].includes(e.target.getAttribute(`slot`)||``))&&this._scheduleActionGrouping()}),this._actionsMutationObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`,`importance`,`always-grouped`]}),this._scheduleActionGrouping()}disconnectedCallback(){this._actionsResizeObserver?.disconnect(),this._actionsMutationObserver?.disconnect(),this._actionsFrame!==null&&cancelAnimationFrame(this._actionsFrame),this._actionsFrame=null}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}isContainered(){return this.hasAttribute(`containered`)&&this.getAttribute(`containered`)!==`false`}render(){this._headingElement.textContent=this.getHeading(),this._backButton.setAttribute(`fallback-href`,this.getFallbackHref()),this._backButton.hidden=!this.shouldShowBackButton()}_scheduleActionGrouping(){this._actionsFrame!==null||!this.isConnected||(this._actionsFrame=requestAnimationFrame(()=>{this._actionsFrame=null,this._groupActions()}))}_groupActions(){if(this._groupingActions)return;this._groupingActions=!0;let e=Array.from(this.children).filter(e=>e instanceof HTMLElement&&(e.getAttribute(`slot`)===`actions`||e.getAttribute(`slot`)===`overflow-actions`));if(this._actionsWrapper.hidden=e.length===0,!e.length){this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._actionsWrapper.hidden=!0,this._groupingActions=!1;return}e.forEach(e=>{e.getAttribute(`slot`)===`overflow-actions`&&!this._autoGroupedActions.has(e)&&this._explicitOverflowActions.add(e)});let t=e.filter(e=>e.hasAttribute(`always-grouped`)||this._explicitOverflowActions.has(e)),n=e.filter(e=>!t.includes(e));if(e.length===1&&t.length===0){this._setActionSlot(e[0],`actions`),this._syncOverflowButtonWidths([]),this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._groupingActions=!1;return}n.forEach(e=>this._setActionSlot(e,`actions`)),t.forEach(e=>this._setActionSlot(e,`overflow-actions`)),this._syncOverflowButtonWidths([]),this._actionsPopover.style.display=``,this._actionsTrigger.hidden=!0;let r=this._root.querySelector(`.mint-page-actions-primary`),i=this._root.querySelector(`.mint-page-header`),a=this._root.querySelector(`.mint-page-heading`);this._actionsResizeObserver?.observe(r),e.forEach(e=>this._actionsResizeObserver?.observe(e));let o=i.clientWidth<=767,s=n.reduce((e,t,n)=>e+t.getBoundingClientRect().width+(n?8:0),0),c=this._backButton.hidden?0:this._backButton.getBoundingClientRect().width+16,l=Math.min(i.clientWidth,a.scrollWidth+c),u=Math.max(0,i.clientWidth-l-16),d=[...t],f=e=>{let t=e.getAttribute(`importance`),n=e.querySelector(`[importance]`)?.getAttribute(`importance`),r=Number(t??n??1);return Number.isFinite(r)&&r>0?r:1};!o&&s>u&&(u=Math.max(0,u-48));let p=s;for(;o?n.length>d.length-t.length:p>u&&d.length<e.length;){let t=n.filter(e=>!d.includes(e));t.sort((t,n)=>f(n)-f(t)||e.indexOf(n)-e.indexOf(t));let r=t[0];if(!r)break;d.push(r),p-=r.getBoundingClientRect().width+(d.length<e.length?8:0)}let m=new Set(d);e.forEach(e=>this._setActionSlot(e,m.has(e)?`overflow-actions`:`actions`)),this._actionsTrigger.hidden=d.length===0,this._actionsPopover.style.display=d.length===0?`none`:``,this._syncOverflowButtonWidths(d),this._actionsResizeObserver?.observe(this._actionsTrigger),this._groupingActions=!1}_setActionSlot(e,t){t===`overflow-actions`?this._autoGroupedActions.add(e):this._autoGroupedActions.delete(e),e.getAttribute(`slot`)!==t&&e.setAttribute(`slot`,t)}_syncOverflowButtonWidths(e){let t=new Set;e.forEach(e=>{e.matches(`mint-button`)&&t.add(e),e.querySelectorAll(`mint-button`).forEach(e=>t.add(e))}),Array.from(this.querySelectorAll(`mint-button[slot="actions"], mint-button[slot="overflow-actions"], [slot="actions"] mint-button, [slot="overflow-actions"] mint-button`)).forEach(e=>{if(t.has(e))this._actionFullWidthOriginal.has(e)||this._actionFullWidthOriginal.set(e,e.getAttribute(`full-width`)),e.setAttribute(`full-width`,`true`);else if(this._actionFullWidthOriginal.has(e)){let t=this._actionFullWidthOriginal.get(e);t===null?e.removeAttribute(`full-width`):t!==void 0&&e.setAttribute(`full-width`,t),this._actionFullWidthOriginal.delete(e)}})}_handleBack(e){e.preventDefault(),e.stopPropagation();let t=document.referrer,n=!!(t&&(()=>{try{return new URL(t).origin===window.location.origin}catch{return!1}})()),r={url:n?t:this.getFallbackHref(),isFromReferrer:n,referrer:t||null,fallbackHref:this.getFallbackHref()},i=new CustomEvent(`back`,{detail:r,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)&&(n&&window.history.length>1?window.history.back():window.location.href=this.getFallbackHref())}};typeof customElements<`u`&&!customElements.get(`mint-page`)&&a(`mint-page`,mn);var hn=class extends HTMLElement{constructor(){super()}};typeof customElements<`u`&&!customElements.get(`mint-grid`)&&a(`mint-grid`,hn);var P=new Set,F=null;function gn(e){if(!P.has(e)){if(P.size===0){let e=document.documentElement;F={scrollY:window.scrollY||window.pageYOffset||0,rootOverflow:e.style.overflow,rootOverscrollBehavior:e.style.overscrollBehavior},e.style.overflow=`hidden`,e.style.overscrollBehavior=`none`}P.add(e)}}function I(e){if(!P.delete(e)||P.size>0||!F)return;let t=F;F=null;let n=document.documentElement;n.style.overflow=t.rootOverflow,n.style.overscrollBehavior=t.rootOverscrollBehavior,window.scrollTo({left:0,top:t.scrollY,behavior:`instant`})}var _n=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`size`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._triggerElement=null,this._triggerPoint=null,this._renderedOpen=!1,this._lastPointerPoint=null,this._pointerDownHandler=null,this._darkModeObserver=null,this._exitTimer=null,this._backdropTimer=null}connectedCallback(){this.isOpen()||this.classList.add(`mint-hidden`),this.render(),this._observeDarkMode(),this._pointerDownHandler=e=>{this._lastPointerPoint={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()}},document.addEventListener(`pointerdown`,this._pointerDownHandler,!0)}disconnectedCallback(){I(this),this._pointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._pointerDownHandler,!0),null),this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&(e===`open`&&n!==null&&!this._triggerElement&&(this._triggerElement=this._findTriggerElement(),this._triggerPoint=this._findTriggerPoint(this._triggerElement)),this.render())}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getSize(){let e=this.getAttribute(`size`);return e===`small`||e===`large`?e:`default`}isOpen(){return this.hasAttribute(`open`)}open(e){this._triggerElement=this._findTriggerElement(e),this._triggerPoint=this._findTriggerPoint(this._triggerElement),this.setAttribute(`open`,``)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getSize();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-modal-overlay`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`mint-modal-shell`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content`,this._modal.appendChild(e)),this._renderedOpen||(this._renderedOpen=!0,gn(this),this._animateEnter())}else this._renderedOpen&&(this._renderedOpen=!1,this._animateExit());let i=this._modal.querySelector(`.modal-content`);i||(i=document.createElement(`div`),i.className=`modal-content`,this._modal.appendChild(i)),i.classList.remove(`modal-content--small`,`modal-content--large`),r!==`default`&&i.classList.add(`modal-content--${r}`),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-modal-header`,i.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-modal-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let a=this._headingSlot.querySelector(`mint-text`);t?(a||(a=document.createElement(`mint-text`),a.setAttribute(`size`,`sub-heading`),a.setAttribute(`bold`,``),this._headingSlot.appendChild(a)),a.textContent=t):a&&a.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.classList.add(`mint-modal-close-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-modal-body`,this._bodySlot.setAttribute(`slot`,`body`),i.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)});let o=Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`),s=this._actionsSlot?.querySelector(`mint-stack`),c=!!s&&s.children.length>0;if(o.length||c){this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`p-4 border-t border-gray-200 dark:border-mint-divider`,this._actionsSlot.setAttribute(`slot`,`actions`),i.appendChild(this._actionsSlot));let e=this._actionsSlot.querySelector(`mint-stack`);e||(e=document.createElement(`mint-stack`),e.setAttribute(`direction`,`horizontal`),e.setAttribute(`align-content`,`right`),e.className=`mint-actions-stack`,this._actionsSlot.appendChild(e)),o.forEach(t=>{Array.from(t.children).forEach(t=>e.appendChild(t)),t.remove()})}else this._actionsSlot&&=(this._actionsSlot.remove(),null);Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._modal&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;document.documentElement?.classList.contains(`dark`)||document.documentElement?.dataset.mintTheme;let e=this._modal.querySelector(`.modal-content`);e&&(e.style.background=`var(--mint-color-surface-raised)`)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this.classList.remove(`mint-modal-closing`),this.classList.remove(`mint-modal-open`),this.classList.add(`mint-modal-open`),this.classList.remove(`mint-hidden`),e.style.transform=`none`,e.style.opacity=`0`,e.style.transition=`none`,requestAnimationFrame(()=>{if(!this.isOpen())return;let t=window.getComputedStyle(e).borderRadius;this._setTransformOrigin(e),e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,e.getBoundingClientRect(),e.style.transition=`opacity 320ms ease-out, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 360ms cubic-bezier(0.2, 0.8, 0.2, 1)`,requestAnimationFrame(()=>{this.isOpen()&&(e.style.transform=`scale(1)`,e.style.opacity=`1`,e.style.borderRadius=t,window.setTimeout(()=>{this.isOpen()&&(e.style.transition=``,e.style.transform=`none`)},380))})}))}_findTriggerElement(e){if(typeof e==`string`){let t=document.getElementById(e);return t&&!this.contains(t)?t:null}if(e instanceof HTMLElement)return e.isConnected&&!this.contains(e)?e:null;let t=this.getAttribute(`trigger-id`);if(t){let e=document.getElementById(t);if(e&&!this.contains(e))return e}let n=document.activeElement;return n instanceof HTMLElement&&n.isConnected&&n!==document.body&&!this.contains(n)?n:null}_findTriggerPoint(e){if(!e)return null;let t=this._lastPointerPoint;if(!t||Date.now()-t.time>1e3)return null;let n=t.target instanceof Node?t.target:null;return n===e||n&&e.contains(n)?{x:t.x,y:t.y}:null}_setTransformOrigin(e){let t=this._findTriggerElement(this._triggerElement);this._triggerElement=t;let n=this._findTriggerPoint(t);if(n){let t=e.getBoundingClientRect();e.style.transformOrigin=`${n.x-t.left}px ${n.y-t.top}px`,this._triggerPoint=n;return}this._triggerPoint={x:window.innerWidth/2,y:0};let r=e.getBoundingClientRect();e.style.transformOrigin=`${this._triggerPoint.x-r.left}px ${this._triggerPoint.y-r.top}px`}_animateExit(){this.classList.remove(`mint-modal-open`),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null);let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`),I(this);return}this._exitTimer&&clearTimeout(this._exitTimer),this.classList.add(`mint-modal-closing`),e.style.transition=`opacity 220ms ease-in, transform 260ms cubic-bezier(0.4, 0, 1, 1), border-radius 260ms cubic-bezier(0.4, 0, 1, 1)`,e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,this._exitTimer=setTimeout(()=>{this._exitTimer=null,!this.isOpen()&&(this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`),e.style.transform=``,e.style.opacity=``,e.style.borderRadius=``,e.style.transition=``,I(this))},280)}};typeof customElements<`u`&&!customElements.get(`mint-modal`)&&a(`mint-modal`,_n),s({name:`check`,viewBox:`0 0 24 24`,path:`M5 13l4 4L19 7`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var vn=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null}connectedCallback(){let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=n!==null&&n!==`false`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n&&(this.render(),e===`checked`&&this._checkbox&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute(`checked`,``):this.removeAttribute(`checked`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute(`disabled`)||this.getAttribute(`loading`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this.getAttribute(`value`)||``}getCheckboxClasses(){return`mint-checkbox-control`}render(){let e=this.getAttribute(`loading`)===`true`;this.toggleAttribute(`aria-busy`,e);let t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-wrapper`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-wrapper`,this.insertBefore(i,this.firstChild)),this._checkbox?this._checkbox.parentElement!==i&&i.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,i.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`mint-input-overlay`,this._checkbox.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._checkbox.checked=this._checked,this._checkbox.disabled=r,this._changeHandler||this.setupEventListeners();let a=this.getId();a?this._checkbox.id=a:this._checkbox.removeAttribute(`id`);let o=this.getName();o?this._checkbox.name=o:this._checkbox.removeAttribute(`name`);let s=this.getValue();s?this._checkbox.value=s:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,i.style.pointerEvents=`none`,this._checkbox.style.pointerEvents=`auto`;let c=i.querySelector(`mint-icon`);c||(c=document.createElement(`mint-icon`),c.setAttribute(`name`,`check`),c.className=`mint-checkbox-check`,c.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,c.style.zIndex=`1`,i.appendChild(c)),this.updateVisualState();let l=this.querySelector(`.mint-checkbox-label-container`);if(t||n){l||(l=document.createElement(`div`),l.className=`mint-checkbox-label-container`,this.appendChild(l));let e=l.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label`,l.insertBefore(e,l.firstChild)),e.textContent=t,r?e.style.opacity=`0.5`:e.style.opacity=``):e&&e.remove();let i=l.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info`,l.appendChild(i)),i.textContent=n,r?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),r)l.style.cursor=`default`,l._clickHandler&&(l.removeEventListener(`click`,l._clickHandler),l._clickHandler=null);else{l.style.cursor=`pointer`;let e=l._clickHandler;e&&l.removeEventListener(`click`,e),l._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},l.addEventListener(`click`,l._clickHandler)}}else l&&l.remove();let u=this.querySelector(`:scope > .mint-checkbox-loading-skeleton`);if(e){if(!u){u=document.createElement(`div`),u.className=`mint-checkbox-loading-skeleton`,u.setAttribute(`aria-hidden`,`true`),Object.assign(u.style,{position:`absolute`,inset:`0`,display:`flex`,alignItems:`center`,gap:`0.5rem`,pointerEvents:`none`,zIndex:`20`});let e=document.createElement(`span`);if(Object.assign(e.style,{display:`block`,width:`1.25rem`,height:`1.25rem`,flex:`none`,borderRadius:`0.25rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite`}),u.appendChild(e),t){let e=document.createElement(`span`);Object.assign(e.style,{display:`block`,width:`6rem`,height:`1rem`,borderRadius:`0.35rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite`}),u.appendChild(e)}this.appendChild(u)}this.style.position=`relative`,u.style.display=`flex`,i.style.visibility=`hidden`,l&&(l.style.visibility=`hidden`)}else u&&(u.style.display=`none`),i.style.visibility=``,l&&(l.style.visibility=``)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener(`change`,this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`mousedown`,this._mousedownHandler),this._checkbox.addEventListener(`mouseup`,this._mouseupHandler),this._checkbox.addEventListener(`mouseleave`,this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`touchstart`,this._touchstartHandler),this._checkbox.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&=(this._checkbox.removeEventListener(`change`,this._changeHandler),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=e?.querySelector(`mint-icon`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains(`mint-checkbox-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}};typeof customElements<`u`&&!customElements.get(`mint-checkbox`)&&a(`mint-checkbox`,vn);var yn=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`required`,`loading`]}constructor(){super(),this._radio=null,this._checked=!1,this._groupMode=!1,this._groupChangeHandler=null,this._groupObserver=null}connectedCallback(){if(this._activateGroupModeIfNeeded(),this._groupObserver=new MutationObserver(()=>this._activateGroupModeIfNeeded()),this._groupObserver.observe(this,{childList:!0,subtree:!0}),this._groupMode)return;let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners(),this._groupChangeHandler&&=(this.removeEventListener(`choice-option-change`,this._groupChangeHandler),null),this._groupObserver?.disconnect(),this._groupObserver=null}attributeChangedCallback(e,t,n){if(this._groupMode){t!==n&&this.renderGroup();return}e===`checked`&&(this._checked=n!==null&&n!==`false`,this._radio&&(this._radio.checked=this._checked)),t!==n&&(this.render(),e===`checked`&&this._radio&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute(`checked`,``):this.removeAttribute(`checked`),this._checked=!!e,this._radio&&(this._radio.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute(`disabled`)||this.getAttribute(`loading`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this._groupMode?this.querySelector(`mint-choice-option input[type="radio"]:checked`)?.value||this.getAttribute(`value`)||``:this.getAttribute(`value`)||``}set value(e){this.setValue(e)}get value(){return this.getValue()}setValue(e){if(!this._groupMode){e?this.setAttribute(`value`,e):this.removeAttribute(`value`);return}let t=e==null?``:String(e);this.querySelectorAll(`mint-choice-option`).forEach(e=>{let n=e.getAttribute(`value`)===t,r=e.querySelector(`input[type="radio"]`);r&&(r.checked=n),e.toggleAttribute(`checked`,n)}),t?this.setAttribute(`value`,t):this.removeAttribute(`value`)}renderGroup(){let e=this.getAttribute(`loading`)===`true`;this.toggleAttribute(`aria-busy`,e),this.classList.add(`mint-choice-group`),this.setAttribute(`role`,`radiogroup`);let t=this.getAttribute(`label`)||``,n=this.querySelector(`:scope > .mint-choice-group-label`);t&&!n&&(n=document.createElement(`div`),n.className=`mint-choice-group-label`,this.insertBefore(n,this.firstChild)),n&&(t?n.textContent=t:n.remove());let r=this.querySelector(`:scope > .mint-choice-options`);r||(r=document.createElement(`div`),r.className=`mint-choice-options`,n?.parentElement===this?this.insertBefore(r,n.nextSibling):this.insertBefore(r,this.firstChild)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==r).forEach(e=>r.appendChild(e)),this.querySelectorAll(`mint-choice-option`).forEach(t=>{t.toggleAttribute(`loading`,e),t.render()});let i=this.getAttribute(`value`);i&&this.setValue(i);let a=r.querySelector(`:scope > .mint-choice-loading-skeleton`);if(e){r.style.position=`relative`,a||(a=document.createElement(`div`),a.className=`mint-choice-loading-skeleton`,a.setAttribute(`aria-hidden`,`true`),Object.assign(a.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,pointerEvents:`none`,zIndex:`20`}),r.appendChild(a)),a.style.gap=r.querySelector(`:scope > mint-choice-option[info]`)?`0.75rem`:`0.55rem`;let e=r.querySelectorAll(`:scope > mint-choice-option`).length,t=Array.from(a.children);for(;t.length>e;)t.pop()?.remove();for(;t.length<e;){let e=t.length,n=document.createElement(`div`);Object.assign(n.style,{display:`flex`,alignItems:`center`,gap:`0.55rem`,minHeight:`1.25rem`,flex:`none`});let r=document.createElement(`span`);Object.assign(r.style,{display:`block`,width:`1.1rem`,height:`1.1rem`,flex:`none`,borderRadius:`50%`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-choice-skeleton-pulse 1.4s ease-in-out infinite`});let i=document.createElement(`span`);Object.assign(i.style,{display:`block`,width:`${e%2?`5rem`:`6rem`}`,height:`1rem`,borderRadius:`0.35rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-choice-skeleton-pulse 1.4s ease-in-out infinite`}),n.append(r,i),a.appendChild(n),t.push(n)}a.style.display=`flex`,r.querySelectorAll(`:scope > mint-choice-option`).forEach(e=>{e.style.visibility=`hidden`})}else a&&(a.style.display=`none`),r.style.position=``,r.querySelectorAll(`:scope > mint-choice-option`).forEach(e=>{e.style.visibility=``})}_activateGroupModeIfNeeded(){this._groupMode||!this.querySelector(`mint-choice-option`)||(this._groupMode=!0,this.removeEventListeners(),this.querySelector(`.mint-choice-wrapper`)?.remove(),this.querySelector(`.mint-choice-label-container`)?.remove(),this._radio=null,this._groupChangeHandler=e=>{let t=e.target.closest?.(`mint-choice-option`);if(!t||!this.contains(t))return;let n=t.getAttribute(`value`)||``;n?this.setAttribute(`value`,n):this.removeAttribute(`value`),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this.addEventListener(`choice-option-change`,this._groupChangeHandler),this.renderGroup())}getChoiceClasses(){return`mint-choice-control`}render(){if(this._groupMode){this.renderGroup();return}let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-choice-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-choice-wrapper`,this.insertBefore(r,this.firstChild)),this._radio?this._radio.parentElement!==r&&r.appendChild(this._radio):(this._radio=document.createElement(`input`),this._radio.type=`radio`,r.appendChild(this._radio),this.setupEventListeners()),this._radio.className=`mint-input-overlay`,this._radio.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._radio.checked=this._checked,this._radio.disabled=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._radio.id=i:this._radio.removeAttribute(`id`);let a=this.getName();a?this._radio.name=a:this._radio.removeAttribute(`name`);let o=this.getValue();o?this._radio.value=o:this._radio.removeAttribute(`value`),e?this._radio.setAttribute(`aria-label`,e):this._radio.removeAttribute(`aria-label`),r.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,r.style.pointerEvents=`none`,this._radio.style.pointerEvents=`auto`;let s=r.querySelector(`.mint-choice-indicator`);s||(s=document.createElement(`div`),s.className=`mint-choice-indicator`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),s.style.opacity=this._checked?`1`:`0`,s.style.transform=this._checked?`scale(1)`:`scale(0.8)`,this.updateVisualState();let c=this.querySelector(`.mint-choice-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-choice-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-choice-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-choice-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-choice-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-choice-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._radio&&(e.target===this._radio||this._radio.contains(e.target)||e.composedPath().includes(this._radio))||this.select()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();let t=this._checked;if(this._checked=this._radio.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState(),this._checked){let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}})}if(t!==this._checked){let e=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}},this._radio.addEventListener(`change`,this._changeHandler),this._groupChangeHandler=e=>{e.target!==this._radio&&e.target.type===`radio`&&e.target.name===this._radio.name&&e.target.checked&&setTimeout(()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState())},0)},document.addEventListener(`change`,this._groupChangeHandler,!0),this._clickHandler=e=>{let t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),requestAnimationFrame(()=>{this._checked=this._radio.checked,this.updateVisualState()})},this._radio.addEventListener(`click`,this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._radio.addEventListener(`mousedown`,this._mousedownHandler),this._radio.addEventListener(`mouseup`,this._mouseupHandler),this._radio.addEventListener(`mouseleave`,this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._radio.addEventListener(`touchstart`,this._touchstartHandler),this._radio.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._groupChangeHandler&&=(document.removeEventListener(`change`,this._groupChangeHandler),null),this._clickHandler&&=(this._radio.removeEventListener(`click`,this._clickHandler),null),this._mousedownHandler&&=(this._radio.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._radio.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._radio.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._radio.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._radio.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-choice-wrapper`),t=e?.querySelector(`.mint-choice-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,e.classList.contains(`mint-choice-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}select(){if(this._radio&&!this.isDisabled()){this._radio.checked=!0,this._radio.dispatchEvent(new Event(`change`,{bubbles:!0})),this._checked=!0,this.hasAttribute(`checked`)||this.setAttribute(`checked`,``);let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}},bn=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`,`loading`]}constructor(){super(),this._labelText=``,this._radio=null,this._changeHandler=null}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}render(){let e=this.closest(`mint-choice`),t=this.querySelector(`.mint-choice-option-label`);this._labelText||=t?.textContent?.trim()||this.textContent.trim();let n=this.querySelector(`:scope > .mint-choice-option-control`);n||(n=document.createElement(`label`),n.className=`mint-choice-option-control`,this.replaceChildren(n)),this._radio||(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`mint-choice-option-input`,n.appendChild(this._radio),this._changeHandler=()=>{this._radio?.checked&&e&&(e.setValue(this.getAttribute(`value`)||``),e.dispatchEvent(new CustomEvent(`choice-option-change`,{detail:{value:this.getAttribute(`value`)||``,option:this},bubbles:!1})))},this._radio.addEventListener(`change`,this._changeHandler)),this._radio.name=e?.getAttribute(`name`)||``,this._radio.value=this.getAttribute(`value`)||``,this._radio.disabled=this.hasAttribute(`disabled`)||this.hasAttribute(`loading`)||e?.hasAttribute(`disabled`)||e?.hasAttribute(`loading`)||!1,this._radio.required=e?.hasAttribute(`required`)||!1,this._radio.checked=this.hasAttribute(`checked`)||e?.getAttribute(`value`)===this._radio.value;let r=n.querySelector(`.mint-choice-option-label`);r||(r=document.createElement(`span`),r.className=`mint-choice-option-label`,n.appendChild(r)),r.textContent=this._labelText}};typeof customElements<`u`&&!customElements.get(`mint-choice`)&&a(`mint-choice`,yn),typeof customElements<`u`&&!customElements.get(`mint-choice-option`)&&a(`mint-choice-option`,bn);var xn=0,Sn=class extends HTMLElement{static get observedAttributes(){return[`brand`,`brand-href`,`direction`,`label`,`open`,`fixed`]}constructor(){super(),this._built=!1,this._brand=null,this._brandLink=null,this._leadingActions=null,this._items=null,this._toggle=null,this._toggleLabel=null,this._mobileActions=null,this._mobileActionNodes=[],this._instanceId=++xn,this._dropdowns=[],this._content=null,this._actions=null,this._activeDropdown=null,this._layoutObserver=null}connectedCallback(){this._built||this._build(),this._observeDropdowns(),this._syncResponsiveDropdowns(),this._syncMobileActions(),typeof ResizeObserver<`u`&&(this._layoutObserver=new ResizeObserver(()=>{this._syncResponsiveDropdowns(),this._syncMobileActions()}),this._layoutObserver.observe(this)),this._syncAttributes()}disconnectedCallback(){for(let e of this._dropdowns)e.observer?.disconnect();this._layoutObserver?.disconnect(),this._layoutObserver=null}attributeChangedCallback(e,t,n){t===n||!this._built||(e===`open`?this._syncOpenState():this._syncAttributes())}getDirection(){return this.getAttribute(`direction`)===`vertical`?`vertical`:`horizontal`}getBrand(){return this.getAttribute(`brand`)||``}getBrandHref(){return this.getAttribute(`brand-href`)||`/`}getLabel(){return this.getAttribute(`label`)||`Primary navigation`}_build(){let e=Array.from(this.childNodes),t=e.find(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`brand`),n=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`leading-actions`),r=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&[`actions`,`mobile-actions`].includes(e.getAttribute(`slot`)));this._mobileActionNodes=r.filter(e=>e.getAttribute(`slot`)===`mobile-actions`);let i=e.filter(e=>e!==t&&!n.includes(e)&&!r.includes(e));this.replaceChildren();let a=document.createElement(`div`);a.className=`mint-navigation-shell`;let o=document.createElement(`div`);o.className=`mint-navigation-bar`,this._leadingActions=document.createElement(`div`),this._leadingActions.className=`mint-navigation-leading-actions`;for(let e of n)e.removeAttribute(`slot`),this._leadingActions.appendChild(e);this._brand=document.createElement(`div`),this._brand.className=`mint-navigation-brand`,t?(t.removeAttribute(`slot`),this._brand.appendChild(t)):this.getBrand()&&(this._brandLink=document.createElement(`mint-link`),this._brandLink.className=`mint-navigation-brand-link`,this._brandLink.textContent=this.getBrand(),this._brandLink.setAttribute(`href`,this.getBrandHref()),this._brand.appendChild(this._brandLink)),this._toggle=document.createElement(`mint-button`),this._toggle.className=`mint-navigation-toggle`,this._toggle.setAttribute(`aria-expanded`,`false`),this._toggle.addEventListener(`click`,()=>this.toggleMenu()),this._toggleLabel=document.createElement(`span`),this._toggleLabel.className=`mint-navigation-visually-hidden`,this._toggleLabel.textContent=`Open navigation menu`,this._toggle.append(this._toggleLabel),this._toggle.setAttribute(`variant`,`ghost`),this._toggle.setAttribute(`tone`,`action`),this._toggle.setAttribute(`button-type`,`button`),this._toggle.setAttribute(`icon`,`menu`),this._mobileActions=document.createElement(`div`),this._mobileActions.className=`mint-navigation-mobile-actions`,o.append(this._leadingActions,this._brand,this._mobileActions,this._toggle);let s=document.createElement(`div`);this._content=s,s.className=`mint-navigation-content`,this._items=document.createElement(`nav`),this._items.className=`mint-navigation-items`,this._items.setAttribute(`aria-label`,this.getLabel()),this._items.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()});let c=0;for(let e of i)if(e.nodeType!==Node.ELEMENT_NODE)this._items.appendChild(e);else if(e.tagName===`DETAILS`){let t=this._createDropdown(e,c++);this._items.append(t.trigger,t.popover),this._registerDropdown(t.trigger,t.popover)}else{let t=this._toMintLink(e);if(this._items.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-POPOVER`){let e=t.getAttribute(`trigger-id`),n=Array.from(this._items.querySelectorAll(`mint-button`)).find(t=>t.id===e);this._registerDropdown(n,t)}}let l=document.createElement(`div`);this._actions=l,l.className=`mint-navigation-actions`;for(let e of r)e.removeAttribute(`slot`),l.appendChild(e);let u=document.createElement(`section`);u.className=`mint-navigation-submenu`,u.setAttribute(`aria-label`,`Navigation submenu`);let d=document.createElement(`div`);d.className=`mint-navigation-submenu-header`;let f=document.createElement(`mint-button`);f.className=`mint-navigation-submenu-back`,f.setAttribute(`variant`,`ghost`),f.setAttribute(`tone`,`action`),f.setAttribute(`button-type`,`button`),f.setAttribute(`icon`,`arrow-left`),f.setAttribute(`aria-label`,`Back to main navigation`),f.addEventListener(`click`,()=>this._closeSubmenu());let p=document.createElement(`h3`);p.className=`mint-navigation-submenu-title`,d.append(f,p);let m=document.createElement(`nav`);m.className=`mint-navigation-submenu-items`,m.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()}),u.append(d,m),this._submenu=u,this._submenuTitle=p,this._submenuItems=m;for(let e of this._dropdowns)m.append(...e.submenuItems);s.append(this._items,l,u),a.append(o,s),this.appendChild(a),this._built=!0,this._syncMobileActions()}_syncMobileActions(){if(!this._mobileActions||!this._actions)return;let e=this._isMobileLayout()?this._mobileActions:this._actions;for(let t of this._mobileActionNodes)e.appendChild(t)}_toMintLink(e){if(e.nodeType!==Node.ELEMENT_NODE||e.tagName!==`A`)return e;let t=document.createElement(`mint-link`);for(;e.firstChild;)t.appendChild(e.firstChild);for(let n of Array.from(e.attributes))n.name!==`slot`&&t.setAttribute(n.name,n.value);return t}_createDropdown(e,t){let n=e.querySelector(`:scope > summary`),r=document.createElement(`mint-button`),i=`mint-navigation-${this._instanceId}-dropdown-${t}`,a=`${i}-popover`;if(r.id=i,r.className=`mint-navigation-dropdown-trigger`,r.setAttribute(`aria-haspopup`,`dialog`),r.setAttribute(`aria-expanded`,`false`),r.setAttribute(`aria-controls`,a),n){for(;n.firstChild;)r.appendChild(n.firstChild);n.remove()}else r.textContent=e.getAttribute(`label`)||`More`;r.setAttribute(`variant`,`ghost`),r.setAttribute(`tone`,`action`),r.setAttribute(`button-type`,`button`),r.setAttribute(`icon-position`,`right`);let o=document.createElement(`mint-popover`);o.id=a,o.className=`mint-navigation-dropdown`,o.setAttribute(`trigger-id`,i),o.setAttribute(`direction`,`down`),o.setAttribute(`aria-label`,`${r.textContent.trim()} links`);for(let t of Array.from(e.childNodes))o.appendChild(this._toMintLink(t));return{trigger:r,popover:o,observer:null}}_registerDropdown(e,t){if(!e||!t)return;t.id||=`mint-navigation-${this._instanceId}-popover-${this._dropdowns.length}`,e.classList.add(`mint-navigation-dropdown-trigger`),e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,String(t.hasAttribute(`open`))),e.setAttribute(`aria-controls`,t.id),t.classList.add(`mint-navigation-dropdown`),t.hasAttribute(`role`)||t.setAttribute(`role`,`group`),t.hasAttribute(`aria-label`)||t.setAttribute(`aria-label`,`${e.textContent.trim()} links`);let n=Array.from(t.querySelectorAll(`mint-link`)).map(e=>e.cloneNode(!0)),r={trigger:e,popover:t,observer:null,triggerId:t.getAttribute(`trigger-id`)||e.id,submenuItems:n};e.addEventListener(`click`,()=>{this._isMobileLayout()&&this._openSubmenu(r)}),this._dropdowns.push(r)}_observeDropdowns(){for(let e of this._dropdowns)e.observer||(e.observer=new MutationObserver(()=>{e.trigger.setAttribute(`aria-expanded`,String(e.popover.hasAttribute(`open`)))}),e.observer.observe(e.popover,{attributes:!0,attributeFilter:[`open`]}))}_isMobileLayout(){return this.getBoundingClientRect().width<=640}_syncResponsiveDropdowns(){let e=this._isMobileLayout();for(let t of this._dropdowns)e?(t.popover.hasAttribute(`open`)&&t.popover.close(),t.popover.getAttribute(`trigger-id`)&&t.popover.setAttribute(`trigger-id`,``)):t.triggerId&&t.popover.getAttribute(`trigger-id`)!==t.triggerId&&t.popover.setAttribute(`trigger-id`,t.triggerId);!e&&this._activeDropdown&&this._closeSubmenu()}_openSubmenu(e){this._isMobileLayout()&&(this._activeDropdown&&this._activeDropdown!==e&&this._activeDropdown.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=e,e.trigger.setAttribute(`aria-expanded`,`true`),this._submenuTitle.textContent=e.trigger.textContent.trim(),this._submenuItems.replaceChildren(...e.submenuItems),this._content.setAttribute(`data-submenu-open`,``))}_closeSubmenu(){this._activeDropdown?.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=null,this._content?.removeAttribute(`data-submenu-open`)}_syncAttributes(){if(this._brandLink){this._brandLink.setAttribute(`href`,this.getBrandHref());let e=this._brandLink.querySelector(`a`);e?e.textContent=this.getBrand():this._brandLink.textContent=this.getBrand()}this._items&&this._items.setAttribute(`aria-label`,this.getLabel()),this._syncOpenState()}_syncOpenState(){if(!this._toggle)return;let e=this.hasAttribute(`open`);this._toggle.setAttribute(`aria-expanded`,String(e));let t=e?`Close navigation menu`:`Open navigation menu`;this._toggle.setAttribute(`aria-label`,t),this._toggleLabel&&(this._toggleLabel.textContent=t),this._toggle.setAttribute(`icon`,e?`close`:`menu`)}openMenu(){this.setAttribute(`open`,``)}closeMenu(){this._closeSubmenu(),this.removeAttribute(`open`)}toggleMenu(){this.hasAttribute(`open`)?this.closeMenu():this.openMenu()}};typeof customElements<`u`&&!customElements.get(`mint-navigation`)&&a(`mint-navigation`,Sn),s({name:`info`,viewBox:`0 0 24 24`,path:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`success`,viewBox:`0 0 24 24`,path:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`error`,viewBox:`0 0 24 24`,path:`M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`close`,viewBox:`0 0 24 24`,path:`M6 18L18 6M6 6l12 12`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var Cn=class extends HTMLElement{static get observedAttributes(){return[`heading`,`dismissable`,`tone`]}constructor(){super(),this._headingElement=null,this._iconElement=null,this._dismissButton=null,this._headerWrapper=null,this._bodyWrapper=null,this._dismissHandler=null,this._rendering=!1,this._childObserver=null,this._normalizingChildren=!1}connectedCallback(){this.render()}disconnectedCallback(){this._childObserver?.disconnect(),this._dismissButton?.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,String(e??``))}get tone(){return this.getTone()}set tone(e){this.setAttribute(`tone`,e)}get dismissable(){return this.isDismissable()}set dismissable(e){this.setAttribute(`dismissable`,String(!!e))}get dismissible(){return this.dismissable}set dismissible(e){this.dismissable=e}cleanupDismissListener(){this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getTone(){let e=this.getAttribute(`tone`);return e===`info`||e===`success`||e===`warning`||e===`danger`?e:`info`}isDismissable(){return this.getAttribute(`dismissable`)===`true`}getIconName(){switch(this.getTone()){case`info`:return`info`;case`success`:return`success`;case`warning`:return`warning`;case`danger`:return`error`;default:return`info`}}getAriaLive(){return this.getTone()===`danger`?`assertive`:`polite`}render(){if(!(this._rendering||!this.isConnected)){this._rendering=!0;try{this.renderContent()}finally{this._rendering=!1}}}renderContent(){this._childObserver?.disconnect();let e=this.getTone(),t=this.getHeading(),n=this.isDismissable(),r=this.getAriaLive();this.setAttribute(`role`,e===`danger`?`alert`:`status`),this.setAttribute(`aria-live`,r),e===`danger`?this.setAttribute(`aria-atomic`,`true`):this.removeAttribute(`aria-atomic`);let i=[];for(this._bodyWrapper?Array.from(this._bodyWrapper.childNodes).forEach(e=>{i.push(e)}):Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&e!==this._iconElement&&e!==this._headingElement&&e!==this._dismissButton&&i.push(e)}),this.cleanupDismissListener();this.firstChild;)this.removeChild(this.firstChild);if(this._headerWrapper=null,this._bodyWrapper=null,this._iconElement=null,this._headingElement=null,this._dismissButton=null,this._headerWrapper=document.createElement(`div`),this._headerWrapper.className=`mint-alert-header`,this._iconElement=document.createElement(`mint-icon`),this._iconElement.setAttribute(`name`,this.getIconName()),this._iconElement.className=`mint-alert-icon`,this._headerWrapper.appendChild(this._iconElement),this._headingElement=document.createElement(`mint-text`),this._headingElement.className=`mint-alert-heading`,this._headingElement.textContent=t||``,this._headerWrapper.appendChild(this._headingElement),n){this._dismissButton=document.createElement(`button`),this._dismissButton.className=`mint-alert-dismiss`,this._dismissButton.setAttribute(`aria-label`,`Dismiss alert`),this._dismissButton.setAttribute(`type`,`button`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`close`),e.className=`mint-alert-close-icon`,this._dismissButton.appendChild(e),this._dismissHandler=e=>{e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},this._dismissButton.addEventListener(`click`,this._dismissHandler),this._headerWrapper.appendChild(this._dismissButton)}this._bodyWrapper=document.createElement(`div`),this._bodyWrapper.className=`mint-alert-body`,i.forEach(e=>{this._bodyWrapper.appendChild(e)}),this.appendChild(this._headerWrapper),this.appendChild(this._bodyWrapper),this._childObserver||=new MutationObserver(()=>this.normalizeConsumerChildren()),this._childObserver.observe(this,{childList:!0})}normalizeConsumerChildren(){if(!(this._normalizingChildren||!this._bodyWrapper)){this._normalizingChildren=!0;try{Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&this._bodyWrapper.appendChild(e)})}finally{this._normalizingChildren=!1}}}};customElements.get(`mint-alert`)||a(`mint-alert`,Cn);var L=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`mint-bottom-navigation`),this.setAttribute(`role`,`navigation`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this.hasAttribute(`data-preview`)||this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`is-hidden`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?this.classList.add(`is-hidden`):this.classList.remove(`is-hidden`),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||a(`mint-bottom-navigation`,L);var wn=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`mint-bottom-nav-item`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.hasAttribute(`active`)&&this.getAttribute(`active`)!==`false`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i;e?(i=document.createElement(`a`),i.href=e):(i=document.createElement(`button`),i.type=`button`),i.className=`mint-bottom-nav-link`,i.setAttribute(`aria-current`,r?`page`:`false`);let a=n.split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);i.setAttribute(`aria-label`,t||a||`Navigation item`);let o=document.createElement(`span`);if(o.className=`mint-bottom-nav-icon`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=`mint-bottom-nav-icon-glyph`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`mint-bottom-nav-label`,s.textContent=t,i.appendChild(o),i.appendChild(s),this.replaceChildren(i),this._root=i}};customElements.get(`mint-bottom-nav-item`)||a(`mint-bottom-nav-item`,wn);var Tn=L,En=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.5,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._animateNextRender=!1,this._observedDataReference=null,this._observedDataFingerprint=``,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_setupDataObserver(){let e=()=>{if(!this.isConnected)return;let e=this.data,t=null;e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(t=e);let n=``;if(t)try{n=JSON.stringify(t)}catch{n=``}t&&(t!==this._observedDataReference||n&&n!==this._observedDataFingerprint)&&(this._observedDataReference=t,this._observedDataFingerprint=n,this._chartData=t,this._animateNextRender=!0,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{e(),requestAnimationFrame(()=>{e()})});let t=setInterval(()=>{if(!this.isConnected){clearInterval(t);return}e()},250);this._dataCheckInterval=t}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`data`){if(n)try{this._chartData=JSON.parse(n)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=null;this._invalidateDataCaches(),this._animateNextRender=!0}(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()})}}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this._invalidateDataCaches(),this._animateNextRender=!0,this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._animateNextRender=!0,this._syncObservedData(),!this._renderScheduled&&(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_invalidateDataCaches(){this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent?.clear()}_syncObservedData(){this._observedDataReference=this._chartData;try{this._observedDataFingerprint=this._chartData?JSON.stringify(this._chartData):``}catch{this._observedDataFingerprint=``}}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;let e=this._animateNextRender&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches&&this._svg?this._svg.cloneNode(!0):null;this._animateNextRender=!1,this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let t=this.data;if(t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(this._chartData=t),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let n=this.getBoundingClientRect(),r=n.width||this.parentElement?.clientWidth||800,i=n.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,r,r),this._height=this._calculateDimension(this._heightValue,i,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let a=this.getAttribute(`curve-tension`);if(a!==null){let e=parseFloat(a);this._curveTension=isNaN(e)?.5:Math.max(0,Math.min(1,e))}else this._curveTension=.5;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,this._chartContainer.style.position=`relative`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._svg.setAttribute(`role`,`img`);let o=this._chartData.datasets.map(e=>e.name).filter(Boolean),s=this.getAttribute(`aria-label`)?.trim()||`${this.type} chart${o.length?` showing ${o.join(`, `)}`:``}. ${Math.max(0,...this._chartData.datasets.map(e=>e.data.length))} data points.`,c=`${this.id||`mint-chart-${Math.random().toString(36).slice(2,10)}`}-data`;this._svg.setAttribute(`aria-label`,s),this._svg.setAttribute(`aria-describedby`,c),this._chartContainer&&this._svg&&(e&&(e.style.position=`absolute`,e.style.inset=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`none`,e.style.zIndex=`1`,e.style.opacity=`1`,e.style.transition=`opacity 260ms ease`,this._chartContainer.appendChild(e),this._svg.style.position=`relative`,this._svg.style.zIndex=`0`,this._svg.style.opacity=`0`,this._svg.style.transition=`opacity 260ms ease`),this._chartContainer.appendChild(this._svg));let l=document.createElement(`table`);l.id=c,Object.assign(l.style,{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,top:`0`,left:`0`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:`0`});let u=document.createElement(`caption`);u.textContent=`Data for ${s}`,l.appendChild(u);let d=document.createElement(`thead`),f=document.createElement(`tr`),p=document.createElement(`th`);p.scope=`col`,p.textContent=`Category`,f.appendChild(p),this._chartData.datasets.forEach(e=>{let t=document.createElement(`th`);t.scope=`col`,t.textContent=e.name||`Series`,f.appendChild(t)}),d.appendChild(f),l.appendChild(d);let m=document.createElement(`tbody`),h=Math.max(0,...this._chartData.datasets.map(e=>e.data.length));for(let e=0;e<h;e+=1){let t=document.createElement(`tr`),n=document.createElement(`th`);n.scope=`row`,n.textContent=String(this._chartData.datasets.find(t=>t.data[e])?.data[e]?.x??e+1),t.appendChild(n),this._chartData.datasets.forEach(n=>{let r=document.createElement(`td`),i=n.data[e];r.textContent=i?this._formatValue(i.y,n):``,t.appendChild(r)}),m.appendChild(t)}switch(l.appendChild(m),this.appendChild(l),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}if(this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine(),e&&this._svg){let t=this._svg;requestAnimationFrame(()=>requestAnimationFrame(()=>{t.isConnected&&(e.style.opacity=`0`,t.style.opacity=`1`,window.setTimeout(()=>e.remove(),280))}))}}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.max(1,Math.min(5,r)),a=this._getYRange();if(this._hasOnlyZeroValues())return Math.ceil(e.measureText(this._formatYAxisValue(0)).width)+20;let o=0;for(let t=0;t<=i;t++){let n=a.max-(a.max-a.min)/i*t,r=this._formatYAxisValue(n),s=e.measureText(r);o=Math.max(o,s.width)}return Math.ceil(o)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_hasOnlyZeroValues(){let e=this._getAllDataPoints();return e.length>0&&e.every(e=>e.y===0)}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
222
+ `,this._headingElement=this._root.querySelector(`.mint-page-heading`),this._headingFallbackElement=this._root.querySelector(`.mint-page-heading-fallback`),this._backButton=this._root.querySelector(`.mint-page-back`),this._actionsSlot=this._root.querySelector(`slot[name="actions"]`),this._overflowActionsSlot=this._root.querySelector(`slot[name="overflow-actions"]`),this._actionsWrapper=this._root.querySelector(`.mint-page-actions`),this._actionsTrigger=this._root.querySelector(`#mint-page-actions-trigger`),this._actionsPopover=this._root.querySelector(`#mint-page-actions-popover`),this._actionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._overflowActionsSlot.addEventListener(`slotchange`,()=>this._scheduleActionGrouping()),this._backButton.addEventListener(`click`,e=>this._handleBack(e),!0)}connectedCallback(){this.render(),this._actionsResizeObserver=new ResizeObserver(()=>this._scheduleActionGrouping()),this._actionsResizeObserver.observe(this._root.querySelector(`.mint-page-header`)),this._actionsMutationObserver=new MutationObserver(e=>{e.some(e=>e.type===`childList`||e.attributeName===`importance`||e.attributeName===`always-grouped`||e.attributeName===`always-visible`||e.attributeName===`slot`&&![`actions`,`overflow-actions`].includes(e.target.getAttribute(`slot`)||``))&&this._scheduleActionGrouping()}),this._actionsMutationObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`,`importance`,`always-grouped`,`always-visible`]}),this._scheduleActionGrouping()}disconnectedCallback(){this._actionsResizeObserver?.disconnect(),this._actionsMutationObserver?.disconnect(),this._actionsFrame!==null&&cancelAnimationFrame(this._actionsFrame),this._actionsFrame=null}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}isContainered(){return this.hasAttribute(`containered`)&&this.getAttribute(`containered`)!==`false`}render(){this._headingFallbackElement.textContent=this.getHeading(),this._backButton.setAttribute(`fallback-href`,this.getFallbackHref()),this._backButton.hidden=!this.shouldShowBackButton()}_scheduleActionGrouping(){this._actionsFrame!==null||!this.isConnected||(this._actionsFrame=requestAnimationFrame(()=>{this._actionsFrame=null,this._groupActions()}))}_groupActions(){if(this._groupingActions)return;this._groupingActions=!0;let e=Array.from(this.children).filter(e=>e instanceof HTMLElement&&(e.getAttribute(`slot`)===`actions`||e.getAttribute(`slot`)===`overflow-actions`));if(this._actionsWrapper.hidden=e.length===0,!e.length){this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._actionsWrapper.hidden=!0,this._groupingActions=!1;return}e.forEach(e=>{e.getAttribute(`slot`)===`overflow-actions`&&!this._autoGroupedActions.has(e)&&this._explicitOverflowActions.add(e)});let t=e.filter(e=>e.hasAttribute(`always-visible`)),n=e.filter(e=>!t.includes(e)&&(e.hasAttribute(`always-grouped`)||this._explicitOverflowActions.has(e))),r=e.filter(e=>!n.includes(e)&&!t.includes(e));if(e.length===1&&n.length===0){this._setActionSlot(e[0],`actions`),this._syncOverflowButtonWidths([]),this._actionsTrigger.hidden=!0,this._actionsPopover.style.display=`none`,this._groupingActions=!1;return}r.forEach(e=>this._setActionSlot(e,`actions`)),n.forEach(e=>this._setActionSlot(e,`overflow-actions`)),this._syncOverflowButtonWidths([]),this._actionsPopover.style.display=``,this._actionsTrigger.hidden=!0;let i=this._root.querySelector(`.mint-page-actions-primary`),a=this._root.querySelector(`.mint-page-header`),o=this._root.querySelector(`.mint-page-heading`);this._actionsResizeObserver?.observe(i),e.forEach(e=>this._actionsResizeObserver?.observe(e));let s=a.clientWidth<=767,c=e.filter(e=>!n.includes(e)).reduce((e,t,n)=>e+t.getBoundingClientRect().width+(n?8:0),0),l=this._backButton.hidden?0:this._backButton.getBoundingClientRect().width+16,u=Math.min(a.clientWidth,o.scrollWidth+l),d=Math.max(0,a.clientWidth-u-16),f=[...n],p=e=>{let t=e.getAttribute(`importance`),n=e.querySelector(`[importance]`)?.getAttribute(`importance`),r=Number(t??n??1);return Number.isFinite(r)&&r>0?r:1};!s&&c>d&&(d=Math.max(0,d-48));let m=c;for(;s?r.length>f.length-n.length:m>d&&f.length<e.length;){let t=r.filter(e=>!f.includes(e));t.sort((t,n)=>p(n)-p(t)||e.indexOf(n)-e.indexOf(t));let n=t[0];if(!n)break;f.push(n),m-=n.getBoundingClientRect().width+(f.length<e.length?8:0)}let h=new Set(f);e.forEach(e=>this._setActionSlot(e,h.has(e)?`overflow-actions`:`actions`)),this._actionsTrigger.hidden=f.length===0,this._actionsPopover.style.display=f.length===0?`none`:``,this._syncOverflowButtonWidths(f),this._actionsResizeObserver?.observe(this._actionsTrigger),this._groupingActions=!1}_setActionSlot(e,t){t===`overflow-actions`?this._autoGroupedActions.add(e):this._autoGroupedActions.delete(e),e.getAttribute(`slot`)!==t&&e.setAttribute(`slot`,t)}_syncOverflowButtonWidths(e){let t=new Set;e.forEach(e=>{e.matches(`mint-button`)&&t.add(e),e.querySelectorAll(`mint-button`).forEach(e=>t.add(e))}),Array.from(this.querySelectorAll(`mint-button[slot="actions"], mint-button[slot="overflow-actions"], [slot="actions"] mint-button, [slot="overflow-actions"] mint-button`)).forEach(e=>{if(t.has(e))this._actionFullWidthOriginal.has(e)||this._actionFullWidthOriginal.set(e,e.getAttribute(`full-width`)),e.setAttribute(`full-width`,`true`);else if(this._actionFullWidthOriginal.has(e)){let t=this._actionFullWidthOriginal.get(e);t===null?e.removeAttribute(`full-width`):t!==void 0&&e.setAttribute(`full-width`,t),this._actionFullWidthOriginal.delete(e)}})}_handleBack(e){e.preventDefault(),e.stopPropagation();let t=document.referrer,n=!!(t&&(()=>{try{return new URL(t).origin===window.location.origin}catch{return!1}})()),r={url:n?t:this.getFallbackHref(),isFromReferrer:n,referrer:t||null,fallbackHref:this.getFallbackHref()},i=new CustomEvent(`back`,{detail:r,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)&&(n&&window.history.length>1?window.history.back():window.location.href=this.getFallbackHref())}};typeof customElements<`u`&&!customElements.get(`mint-page`)&&a(`mint-page`,mn);var hn=class extends HTMLElement{constructor(){super()}};typeof customElements<`u`&&!customElements.get(`mint-grid`)&&a(`mint-grid`,hn);var P=new Set,F=null;function gn(e){if(!P.has(e)){if(P.size===0){let e=document.documentElement;F={scrollY:window.scrollY||window.pageYOffset||0,rootOverflow:e.style.overflow,rootOverscrollBehavior:e.style.overscrollBehavior},e.style.overflow=`hidden`,e.style.overscrollBehavior=`none`}P.add(e)}}function I(e){if(!P.delete(e)||P.size>0||!F)return;let t=F;F=null;let n=document.documentElement;n.style.overflow=t.rootOverflow,n.style.overscrollBehavior=t.rootOverscrollBehavior,window.scrollTo({left:0,top:t.scrollY,behavior:`instant`})}var _n=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`size`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._triggerElement=null,this._triggerPoint=null,this._renderedOpen=!1,this._lastPointerPoint=null,this._pointerDownHandler=null,this._darkModeObserver=null,this._exitTimer=null,this._backdropTimer=null}connectedCallback(){this.isOpen()||this.classList.add(`mint-hidden`),this.render(),this._observeDarkMode(),this._pointerDownHandler=e=>{this._lastPointerPoint={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()}},document.addEventListener(`pointerdown`,this._pointerDownHandler,!0)}disconnectedCallback(){I(this),this._pointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._pointerDownHandler,!0),null),this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&(e===`open`&&n!==null&&!this._triggerElement&&(this._triggerElement=this._findTriggerElement(),this._triggerPoint=this._findTriggerPoint(this._triggerElement)),this.render())}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getSize(){let e=this.getAttribute(`size`);return e===`small`||e===`large`?e:`default`}isOpen(){return this.hasAttribute(`open`)}open(e){this._triggerElement=this._findTriggerElement(e),this._triggerPoint=this._findTriggerPoint(this._triggerElement),this.setAttribute(`open`,``)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getSize();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-modal-overlay`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`mint-modal-shell`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content`,this._modal.appendChild(e)),this._renderedOpen||(this._renderedOpen=!0,gn(this),this._animateEnter())}else this._renderedOpen&&(this._renderedOpen=!1,this._animateExit());let i=this._modal.querySelector(`.modal-content`);i||(i=document.createElement(`div`),i.className=`modal-content`,this._modal.appendChild(i)),i.classList.remove(`modal-content--small`,`modal-content--large`),r!==`default`&&i.classList.add(`modal-content--${r}`),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-modal-header`,i.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-modal-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let a=this._headingSlot.querySelector(`mint-text`);t?(a||(a=document.createElement(`mint-text`),a.setAttribute(`size`,`sub-heading`),a.setAttribute(`bold`,``),this._headingSlot.appendChild(a)),a.textContent=t):a&&a.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.classList.add(`mint-modal-close-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-modal-body`,this._bodySlot.setAttribute(`slot`,`body`),i.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)});let o=Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`),s=this._actionsSlot?.querySelector(`mint-stack`),c=!!s&&s.children.length>0;if(o.length||c){this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`p-4 border-t border-gray-200 dark:border-mint-divider`,this._actionsSlot.setAttribute(`slot`,`actions`),i.appendChild(this._actionsSlot));let e=this._actionsSlot.querySelector(`mint-stack`);e||(e=document.createElement(`mint-stack`),e.setAttribute(`direction`,`horizontal`),e.setAttribute(`align-content`,`right`),e.className=`mint-actions-stack`,this._actionsSlot.appendChild(e)),o.forEach(t=>{Array.from(t.children).forEach(t=>e.appendChild(t)),t.remove()})}else this._actionsSlot&&=(this._actionsSlot.remove(),null);Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._modal&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;document.documentElement?.classList.contains(`dark`)||document.documentElement?.dataset.mintTheme;let e=this._modal.querySelector(`.modal-content`);e&&(e.style.background=`var(--mint-color-surface-raised)`)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this.classList.remove(`mint-modal-closing`),this.classList.remove(`mint-modal-open`),this.classList.add(`mint-modal-open`),this.classList.remove(`mint-hidden`),e.style.transform=`none`,e.style.opacity=`0`,e.style.transition=`none`,requestAnimationFrame(()=>{if(!this.isOpen())return;let t=window.getComputedStyle(e).borderRadius;this._setTransformOrigin(e),e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,e.getBoundingClientRect(),e.style.transition=`opacity 320ms ease-out, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 360ms cubic-bezier(0.2, 0.8, 0.2, 1)`,requestAnimationFrame(()=>{this.isOpen()&&(e.style.transform=`scale(1)`,e.style.opacity=`1`,e.style.borderRadius=t,window.setTimeout(()=>{this.isOpen()&&(e.style.transition=``,e.style.transform=`none`)},380))})}))}_findTriggerElement(e){if(typeof e==`string`){let t=document.getElementById(e);return t&&!this.contains(t)?t:null}if(e instanceof HTMLElement)return e.isConnected&&!this.contains(e)?e:null;let t=this.getAttribute(`trigger-id`);if(t){let e=document.getElementById(t);if(e&&!this.contains(e))return e}let n=document.activeElement;return n instanceof HTMLElement&&n.isConnected&&n!==document.body&&!this.contains(n)?n:null}_findTriggerPoint(e){if(!e)return null;let t=this._lastPointerPoint;if(!t||Date.now()-t.time>1e3)return null;let n=t.target instanceof Node?t.target:null;return n===e||n&&e.contains(n)?{x:t.x,y:t.y}:null}_setTransformOrigin(e){let t=this._findTriggerElement(this._triggerElement);this._triggerElement=t;let n=this._findTriggerPoint(t);if(n){let t=e.getBoundingClientRect();e.style.transformOrigin=`${n.x-t.left}px ${n.y-t.top}px`,this._triggerPoint=n;return}this._triggerPoint={x:window.innerWidth/2,y:0};let r=e.getBoundingClientRect();e.style.transformOrigin=`${this._triggerPoint.x-r.left}px ${this._triggerPoint.y-r.top}px`}_animateExit(){this.classList.remove(`mint-modal-open`),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null);let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`),I(this);return}this._exitTimer&&clearTimeout(this._exitTimer),this.classList.add(`mint-modal-closing`),e.style.transition=`opacity 220ms ease-in, transform 260ms cubic-bezier(0.4, 0, 1, 1), border-radius 260ms cubic-bezier(0.4, 0, 1, 1)`,e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,this._exitTimer=setTimeout(()=>{this._exitTimer=null,!this.isOpen()&&(this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`),e.style.transform=``,e.style.opacity=``,e.style.borderRadius=``,e.style.transition=``,I(this))},280)}};typeof customElements<`u`&&!customElements.get(`mint-modal`)&&a(`mint-modal`,_n),s({name:`check`,viewBox:`0 0 24 24`,path:`M5 13l4 4L19 7`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var vn=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null}connectedCallback(){let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=n!==null&&n!==`false`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n&&(this.render(),e===`checked`&&this._checkbox&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute(`checked`,``):this.removeAttribute(`checked`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute(`disabled`)||this.getAttribute(`loading`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this.getAttribute(`value`)||``}getCheckboxClasses(){return`mint-checkbox-control`}render(){let e=this.getAttribute(`loading`)===`true`;this.toggleAttribute(`aria-busy`,e);let t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-wrapper`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-wrapper`,this.insertBefore(i,this.firstChild)),this._checkbox?this._checkbox.parentElement!==i&&i.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,i.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`mint-input-overlay`,this._checkbox.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._checkbox.checked=this._checked,this._checkbox.disabled=r,this._changeHandler||this.setupEventListeners();let a=this.getId();a?this._checkbox.id=a:this._checkbox.removeAttribute(`id`);let o=this.getName();o?this._checkbox.name=o:this._checkbox.removeAttribute(`name`);let s=this.getValue();s?this._checkbox.value=s:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,i.style.pointerEvents=`none`,this._checkbox.style.pointerEvents=`auto`;let c=i.querySelector(`mint-icon`);c||(c=document.createElement(`mint-icon`),c.setAttribute(`name`,`check`),c.className=`mint-checkbox-check`,c.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,c.style.zIndex=`1`,i.appendChild(c)),this.updateVisualState();let l=this.querySelector(`.mint-checkbox-label-container`);if(t||n){l||(l=document.createElement(`div`),l.className=`mint-checkbox-label-container`,this.appendChild(l));let e=l.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label`,l.insertBefore(e,l.firstChild)),e.textContent=t,r?e.style.opacity=`0.5`:e.style.opacity=``):e&&e.remove();let i=l.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info`,l.appendChild(i)),i.textContent=n,r?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),r)l.style.cursor=`default`,l._clickHandler&&(l.removeEventListener(`click`,l._clickHandler),l._clickHandler=null);else{l.style.cursor=`pointer`;let e=l._clickHandler;e&&l.removeEventListener(`click`,e),l._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},l.addEventListener(`click`,l._clickHandler)}}else l&&l.remove();let u=this.querySelector(`:scope > .mint-checkbox-loading-skeleton`);if(e){if(!u){u=document.createElement(`div`),u.className=`mint-checkbox-loading-skeleton`,u.setAttribute(`aria-hidden`,`true`),Object.assign(u.style,{position:`absolute`,inset:`0`,display:`flex`,alignItems:`center`,gap:`0.5rem`,pointerEvents:`none`,zIndex:`20`});let e=document.createElement(`span`);if(Object.assign(e.style,{display:`block`,width:`1.25rem`,height:`1.25rem`,flex:`none`,borderRadius:`0.25rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite`}),u.appendChild(e),t){let e=document.createElement(`span`);Object.assign(e.style,{display:`block`,width:`6rem`,height:`1rem`,borderRadius:`0.35rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite`}),u.appendChild(e)}this.appendChild(u)}this.style.position=`relative`,u.style.display=`flex`,i.style.visibility=`hidden`,l&&(l.style.visibility=`hidden`)}else u&&(u.style.display=`none`),i.style.visibility=``,l&&(l.style.visibility=``)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener(`change`,this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`mousedown`,this._mousedownHandler),this._checkbox.addEventListener(`mouseup`,this._mouseupHandler),this._checkbox.addEventListener(`mouseleave`,this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`touchstart`,this._touchstartHandler),this._checkbox.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&=(this._checkbox.removeEventListener(`change`,this._changeHandler),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=e?.querySelector(`mint-icon`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains(`mint-checkbox-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}};typeof customElements<`u`&&!customElements.get(`mint-checkbox`)&&a(`mint-checkbox`,vn);var yn=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`required`,`loading`]}constructor(){super(),this._radio=null,this._checked=!1,this._groupMode=!1,this._groupChangeHandler=null,this._groupObserver=null}connectedCallback(){if(this._activateGroupModeIfNeeded(),this._groupObserver=new MutationObserver(()=>this._activateGroupModeIfNeeded()),this._groupObserver.observe(this,{childList:!0,subtree:!0}),this._groupMode)return;let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners(),this._groupChangeHandler&&=(this.removeEventListener(`choice-option-change`,this._groupChangeHandler),null),this._groupObserver?.disconnect(),this._groupObserver=null}attributeChangedCallback(e,t,n){if(this._groupMode){t!==n&&this.renderGroup();return}e===`checked`&&(this._checked=n!==null&&n!==`false`,this._radio&&(this._radio.checked=this._checked)),t!==n&&(this.render(),e===`checked`&&this._radio&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute(`checked`,``):this.removeAttribute(`checked`),this._checked=!!e,this._radio&&(this._radio.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute(`disabled`)||this.getAttribute(`loading`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this._groupMode?this.querySelector(`mint-choice-option input[type="radio"]:checked`)?.value||this.getAttribute(`value`)||``:this.getAttribute(`value`)||``}set value(e){this.setValue(e)}get value(){return this.getValue()}setValue(e){if(!this._groupMode){e?this.setAttribute(`value`,e):this.removeAttribute(`value`);return}let t=e==null?``:String(e);this.querySelectorAll(`mint-choice-option`).forEach(e=>{let n=e.getAttribute(`value`)===t,r=e.querySelector(`input[type="radio"]`);r&&(r.checked=n),e.toggleAttribute(`checked`,n)}),t?this.setAttribute(`value`,t):this.removeAttribute(`value`)}renderGroup(){let e=this.getAttribute(`loading`)===`true`;this.toggleAttribute(`aria-busy`,e),this.classList.add(`mint-choice-group`),this.setAttribute(`role`,`radiogroup`);let t=this.getAttribute(`label`)||``,n=this.querySelector(`:scope > .mint-choice-group-label`);t&&!n&&(n=document.createElement(`div`),n.className=`mint-choice-group-label`,this.insertBefore(n,this.firstChild)),n&&(t?n.textContent=t:n.remove());let r=this.querySelector(`:scope > .mint-choice-options`);r||(r=document.createElement(`div`),r.className=`mint-choice-options`,n?.parentElement===this?this.insertBefore(r,n.nextSibling):this.insertBefore(r,this.firstChild)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==r).forEach(e=>r.appendChild(e)),this.querySelectorAll(`mint-choice-option`).forEach(t=>{t.toggleAttribute(`loading`,e),t.render()});let i=this.getAttribute(`value`);i&&this.setValue(i);let a=r.querySelector(`:scope > .mint-choice-loading-skeleton`);if(e){r.style.position=`relative`,a||(a=document.createElement(`div`),a.className=`mint-choice-loading-skeleton`,a.setAttribute(`aria-hidden`,`true`),Object.assign(a.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,pointerEvents:`none`,zIndex:`20`}),r.appendChild(a)),a.style.gap=r.querySelector(`:scope > mint-choice-option[info]`)?`0.75rem`:`0.55rem`;let e=r.querySelectorAll(`:scope > mint-choice-option`).length,t=Array.from(a.children);for(;t.length>e;)t.pop()?.remove();for(;t.length<e;){let e=t.length,n=document.createElement(`div`);Object.assign(n.style,{display:`flex`,alignItems:`center`,gap:`0.55rem`,minHeight:`1.25rem`,flex:`none`});let r=document.createElement(`span`);Object.assign(r.style,{display:`block`,width:`1.1rem`,height:`1.1rem`,flex:`none`,borderRadius:`50%`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-choice-skeleton-pulse 1.4s ease-in-out infinite`});let i=document.createElement(`span`);Object.assign(i.style,{display:`block`,width:`${e%2?`5rem`:`6rem`}`,height:`1rem`,borderRadius:`0.35rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-choice-skeleton-pulse 1.4s ease-in-out infinite`}),n.append(r,i),a.appendChild(n),t.push(n)}a.style.display=`flex`,r.querySelectorAll(`:scope > mint-choice-option`).forEach(e=>{e.style.visibility=`hidden`})}else a&&(a.style.display=`none`),r.style.position=``,r.querySelectorAll(`:scope > mint-choice-option`).forEach(e=>{e.style.visibility=``})}_activateGroupModeIfNeeded(){this._groupMode||!this.querySelector(`mint-choice-option`)||(this._groupMode=!0,this.removeEventListeners(),this.querySelector(`.mint-choice-wrapper`)?.remove(),this.querySelector(`.mint-choice-label-container`)?.remove(),this._radio=null,this._groupChangeHandler=e=>{let t=e.target.closest?.(`mint-choice-option`);if(!t||!this.contains(t))return;let n=t.getAttribute(`value`)||``;n?this.setAttribute(`value`,n):this.removeAttribute(`value`),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this.addEventListener(`choice-option-change`,this._groupChangeHandler),this.renderGroup())}getChoiceClasses(){return`mint-choice-control`}render(){if(this._groupMode){this.renderGroup();return}let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-choice-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-choice-wrapper`,this.insertBefore(r,this.firstChild)),this._radio?this._radio.parentElement!==r&&r.appendChild(this._radio):(this._radio=document.createElement(`input`),this._radio.type=`radio`,r.appendChild(this._radio),this.setupEventListeners()),this._radio.className=`mint-input-overlay`,this._radio.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._radio.checked=this._checked,this._radio.disabled=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._radio.id=i:this._radio.removeAttribute(`id`);let a=this.getName();a?this._radio.name=a:this._radio.removeAttribute(`name`);let o=this.getValue();o?this._radio.value=o:this._radio.removeAttribute(`value`),e?this._radio.setAttribute(`aria-label`,e):this._radio.removeAttribute(`aria-label`),r.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,r.style.pointerEvents=`none`,this._radio.style.pointerEvents=`auto`;let s=r.querySelector(`.mint-choice-indicator`);s||(s=document.createElement(`div`),s.className=`mint-choice-indicator`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),s.style.opacity=this._checked?`1`:`0`,s.style.transform=this._checked?`scale(1)`:`scale(0.8)`,this.updateVisualState();let c=this.querySelector(`.mint-choice-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-choice-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-choice-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-choice-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-choice-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-choice-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._radio&&(e.target===this._radio||this._radio.contains(e.target)||e.composedPath().includes(this._radio))||this.select()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();let t=this._checked;if(this._checked=this._radio.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState(),this._checked){let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}})}if(t!==this._checked){let e=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}},this._radio.addEventListener(`change`,this._changeHandler),this._groupChangeHandler=e=>{e.target!==this._radio&&e.target.type===`radio`&&e.target.name===this._radio.name&&e.target.checked&&setTimeout(()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState())},0)},document.addEventListener(`change`,this._groupChangeHandler,!0),this._clickHandler=e=>{let t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),requestAnimationFrame(()=>{this._checked=this._radio.checked,this.updateVisualState()})},this._radio.addEventListener(`click`,this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._radio.addEventListener(`mousedown`,this._mousedownHandler),this._radio.addEventListener(`mouseup`,this._mouseupHandler),this._radio.addEventListener(`mouseleave`,this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._radio.addEventListener(`touchstart`,this._touchstartHandler),this._radio.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._groupChangeHandler&&=(document.removeEventListener(`change`,this._groupChangeHandler),null),this._clickHandler&&=(this._radio.removeEventListener(`click`,this._clickHandler),null),this._mousedownHandler&&=(this._radio.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._radio.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._radio.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._radio.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._radio.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-choice-wrapper`),t=e?.querySelector(`.mint-choice-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,e.classList.contains(`mint-choice-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}select(){if(this._radio&&!this.isDisabled()){this._radio.checked=!0,this._radio.dispatchEvent(new Event(`change`,{bubbles:!0})),this._checked=!0,this.hasAttribute(`checked`)||this.setAttribute(`checked`,``);let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}},bn=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`,`loading`]}constructor(){super(),this._labelText=``,this._radio=null,this._changeHandler=null}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}render(){let e=this.closest(`mint-choice`),t=this.querySelector(`.mint-choice-option-label`);this._labelText||=t?.textContent?.trim()||this.textContent.trim();let n=this.querySelector(`:scope > .mint-choice-option-control`);n||(n=document.createElement(`label`),n.className=`mint-choice-option-control`,this.replaceChildren(n)),this._radio||(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`mint-choice-option-input`,n.appendChild(this._radio),this._changeHandler=()=>{this._radio?.checked&&e&&(e.setValue(this.getAttribute(`value`)||``),e.dispatchEvent(new CustomEvent(`choice-option-change`,{detail:{value:this.getAttribute(`value`)||``,option:this},bubbles:!1})))},this._radio.addEventListener(`change`,this._changeHandler)),this._radio.name=e?.getAttribute(`name`)||``,this._radio.value=this.getAttribute(`value`)||``,this._radio.disabled=this.hasAttribute(`disabled`)||this.hasAttribute(`loading`)||e?.hasAttribute(`disabled`)||e?.hasAttribute(`loading`)||!1,this._radio.required=e?.hasAttribute(`required`)||!1,this._radio.checked=this.hasAttribute(`checked`)||e?.getAttribute(`value`)===this._radio.value;let r=n.querySelector(`.mint-choice-option-label`);r||(r=document.createElement(`span`),r.className=`mint-choice-option-label`,n.appendChild(r)),r.textContent=this._labelText}};typeof customElements<`u`&&!customElements.get(`mint-choice`)&&a(`mint-choice`,yn),typeof customElements<`u`&&!customElements.get(`mint-choice-option`)&&a(`mint-choice-option`,bn);var xn=0,Sn=class extends HTMLElement{static get observedAttributes(){return[`brand`,`brand-href`,`direction`,`label`,`open`,`fixed`]}constructor(){super(),this._built=!1,this._brand=null,this._brandLink=null,this._leadingActions=null,this._items=null,this._toggle=null,this._toggleLabel=null,this._mobileActions=null,this._mobileActionNodes=[],this._instanceId=++xn,this._dropdowns=[],this._content=null,this._actions=null,this._activeDropdown=null,this._layoutObserver=null}connectedCallback(){this._built||this._build(),this._observeDropdowns(),this._syncResponsiveDropdowns(),this._syncMobileActions(),typeof ResizeObserver<`u`&&(this._layoutObserver=new ResizeObserver(()=>{this._syncResponsiveDropdowns(),this._syncMobileActions()}),this._layoutObserver.observe(this)),this._syncAttributes()}disconnectedCallback(){for(let e of this._dropdowns)e.observer?.disconnect();this._layoutObserver?.disconnect(),this._layoutObserver=null}attributeChangedCallback(e,t,n){t===n||!this._built||(e===`open`?this._syncOpenState():this._syncAttributes())}getDirection(){return this.getAttribute(`direction`)===`vertical`?`vertical`:`horizontal`}getBrand(){return this.getAttribute(`brand`)||``}getBrandHref(){return this.getAttribute(`brand-href`)||`/`}getLabel(){return this.getAttribute(`label`)||`Primary navigation`}_build(){let e=Array.from(this.childNodes),t=e.find(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`brand`),n=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`leading-actions`),r=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&[`actions`,`mobile-actions`].includes(e.getAttribute(`slot`)));this._mobileActionNodes=r.filter(e=>e.getAttribute(`slot`)===`mobile-actions`);let i=e.filter(e=>e!==t&&!n.includes(e)&&!r.includes(e));this.replaceChildren();let a=document.createElement(`div`);a.className=`mint-navigation-shell`;let o=document.createElement(`div`);o.className=`mint-navigation-bar`,this._leadingActions=document.createElement(`div`),this._leadingActions.className=`mint-navigation-leading-actions`;for(let e of n)e.removeAttribute(`slot`),this._leadingActions.appendChild(e);this._brand=document.createElement(`div`),this._brand.className=`mint-navigation-brand`,t?(t.removeAttribute(`slot`),this._brand.appendChild(t)):this.getBrand()&&(this._brandLink=document.createElement(`mint-link`),this._brandLink.className=`mint-navigation-brand-link`,this._brandLink.textContent=this.getBrand(),this._brandLink.setAttribute(`href`,this.getBrandHref()),this._brand.appendChild(this._brandLink)),this._toggle=document.createElement(`mint-button`),this._toggle.className=`mint-navigation-toggle`,this._toggle.setAttribute(`aria-expanded`,`false`),this._toggle.addEventListener(`click`,()=>this.toggleMenu()),this._toggleLabel=document.createElement(`span`),this._toggleLabel.className=`mint-navigation-visually-hidden`,this._toggleLabel.textContent=`Open navigation menu`,this._toggle.append(this._toggleLabel),this._toggle.setAttribute(`variant`,`ghost`),this._toggle.setAttribute(`tone`,`action`),this._toggle.setAttribute(`button-type`,`button`),this._toggle.setAttribute(`icon`,`menu`),this._mobileActions=document.createElement(`div`),this._mobileActions.className=`mint-navigation-mobile-actions`,o.append(this._leadingActions,this._brand,this._mobileActions,this._toggle);let s=document.createElement(`div`);this._content=s,s.className=`mint-navigation-content`,this._items=document.createElement(`nav`),this._items.className=`mint-navigation-items`,this._items.setAttribute(`aria-label`,this.getLabel()),this._items.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()});let c=0;for(let e of i)if(e.nodeType!==Node.ELEMENT_NODE)this._items.appendChild(e);else if(e.tagName===`DETAILS`){let t=this._createDropdown(e,c++);this._items.append(t.trigger,t.popover),this._registerDropdown(t.trigger,t.popover)}else{let t=this._toMintLink(e);if(this._items.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-POPOVER`){let e=t.getAttribute(`trigger-id`),n=Array.from(this._items.querySelectorAll(`mint-button`)).find(t=>t.id===e);this._registerDropdown(n,t)}}let l=document.createElement(`div`);this._actions=l,l.className=`mint-navigation-actions`;for(let e of r)e.removeAttribute(`slot`),l.appendChild(e);let u=document.createElement(`section`);u.className=`mint-navigation-submenu`,u.setAttribute(`aria-label`,`Navigation submenu`);let d=document.createElement(`div`);d.className=`mint-navigation-submenu-header`;let f=document.createElement(`mint-button`);f.className=`mint-navigation-submenu-back`,f.setAttribute(`variant`,`ghost`),f.setAttribute(`tone`,`action`),f.setAttribute(`button-type`,`button`),f.setAttribute(`icon`,`arrow-left`),f.setAttribute(`aria-label`,`Back to main navigation`),f.addEventListener(`click`,()=>this._closeSubmenu());let p=document.createElement(`h3`);p.className=`mint-navigation-submenu-title`,d.append(f,p);let m=document.createElement(`nav`);m.className=`mint-navigation-submenu-items`,m.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()}),u.append(d,m),this._submenu=u,this._submenuTitle=p,this._submenuItems=m;for(let e of this._dropdowns)m.append(...e.submenuItems);s.append(this._items,l,u),a.append(o,s),this.appendChild(a),this._built=!0,this._syncMobileActions()}_syncMobileActions(){if(!this._mobileActions||!this._actions)return;let e=this._isMobileLayout()?this._mobileActions:this._actions;for(let t of this._mobileActionNodes)e.appendChild(t)}_toMintLink(e){if(e.nodeType!==Node.ELEMENT_NODE||e.tagName!==`A`)return e;let t=document.createElement(`mint-link`);for(;e.firstChild;)t.appendChild(e.firstChild);for(let n of Array.from(e.attributes))n.name!==`slot`&&t.setAttribute(n.name,n.value);return t}_createDropdown(e,t){let n=e.querySelector(`:scope > summary`),r=document.createElement(`mint-button`),i=`mint-navigation-${this._instanceId}-dropdown-${t}`,a=`${i}-popover`;if(r.id=i,r.className=`mint-navigation-dropdown-trigger`,r.setAttribute(`aria-haspopup`,`dialog`),r.setAttribute(`aria-expanded`,`false`),r.setAttribute(`aria-controls`,a),n){for(;n.firstChild;)r.appendChild(n.firstChild);n.remove()}else r.textContent=e.getAttribute(`label`)||`More`;r.setAttribute(`variant`,`ghost`),r.setAttribute(`tone`,`action`),r.setAttribute(`button-type`,`button`),r.setAttribute(`icon-position`,`right`);let o=document.createElement(`mint-popover`);o.id=a,o.className=`mint-navigation-dropdown`,o.setAttribute(`trigger-id`,i),o.setAttribute(`direction`,`down`),o.setAttribute(`aria-label`,`${r.textContent.trim()} links`);for(let t of Array.from(e.childNodes))o.appendChild(this._toMintLink(t));return{trigger:r,popover:o,observer:null}}_registerDropdown(e,t){if(!e||!t)return;t.id||=`mint-navigation-${this._instanceId}-popover-${this._dropdowns.length}`,e.classList.add(`mint-navigation-dropdown-trigger`),e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,String(t.hasAttribute(`open`))),e.setAttribute(`aria-controls`,t.id),t.classList.add(`mint-navigation-dropdown`),t.hasAttribute(`role`)||t.setAttribute(`role`,`group`),t.hasAttribute(`aria-label`)||t.setAttribute(`aria-label`,`${e.textContent.trim()} links`);let n=Array.from(t.querySelectorAll(`mint-link`)).map(e=>e.cloneNode(!0)),r={trigger:e,popover:t,observer:null,triggerId:t.getAttribute(`trigger-id`)||e.id,submenuItems:n};e.addEventListener(`click`,()=>{this._isMobileLayout()&&this._openSubmenu(r)}),this._dropdowns.push(r)}_observeDropdowns(){for(let e of this._dropdowns)e.observer||(e.observer=new MutationObserver(()=>{e.trigger.setAttribute(`aria-expanded`,String(e.popover.hasAttribute(`open`)))}),e.observer.observe(e.popover,{attributes:!0,attributeFilter:[`open`]}))}_isMobileLayout(){return this.getBoundingClientRect().width<=640}_syncResponsiveDropdowns(){let e=this._isMobileLayout();for(let t of this._dropdowns)e?(t.popover.hasAttribute(`open`)&&t.popover.close(),t.popover.getAttribute(`trigger-id`)&&t.popover.setAttribute(`trigger-id`,``)):t.triggerId&&t.popover.getAttribute(`trigger-id`)!==t.triggerId&&t.popover.setAttribute(`trigger-id`,t.triggerId);!e&&this._activeDropdown&&this._closeSubmenu()}_openSubmenu(e){this._isMobileLayout()&&(this._activeDropdown&&this._activeDropdown!==e&&this._activeDropdown.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=e,e.trigger.setAttribute(`aria-expanded`,`true`),this._submenuTitle.textContent=e.trigger.textContent.trim(),this._submenuItems.replaceChildren(...e.submenuItems),this._content.setAttribute(`data-submenu-open`,``))}_closeSubmenu(){this._activeDropdown?.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=null,this._content?.removeAttribute(`data-submenu-open`)}_syncAttributes(){if(this._brandLink){this._brandLink.setAttribute(`href`,this.getBrandHref());let e=this._brandLink.querySelector(`a`);e?e.textContent=this.getBrand():this._brandLink.textContent=this.getBrand()}this._items&&this._items.setAttribute(`aria-label`,this.getLabel()),this._syncOpenState()}_syncOpenState(){if(!this._toggle)return;let e=this.hasAttribute(`open`);this._toggle.setAttribute(`aria-expanded`,String(e));let t=e?`Close navigation menu`:`Open navigation menu`;this._toggle.setAttribute(`aria-label`,t),this._toggleLabel&&(this._toggleLabel.textContent=t),this._toggle.setAttribute(`icon`,e?`close`:`menu`)}openMenu(){this.setAttribute(`open`,``)}closeMenu(){this._closeSubmenu(),this.removeAttribute(`open`)}toggleMenu(){this.hasAttribute(`open`)?this.closeMenu():this.openMenu()}};typeof customElements<`u`&&!customElements.get(`mint-navigation`)&&a(`mint-navigation`,Sn),s({name:`info`,viewBox:`0 0 24 24`,path:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`success`,viewBox:`0 0 24 24`,path:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`error`,viewBox:`0 0 24 24`,path:`M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`close`,viewBox:`0 0 24 24`,path:`M6 18L18 6M6 6l12 12`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var Cn=class extends HTMLElement{static get observedAttributes(){return[`heading`,`dismissable`,`tone`]}constructor(){super(),this._headingElement=null,this._iconElement=null,this._dismissButton=null,this._headerWrapper=null,this._bodyWrapper=null,this._dismissHandler=null,this._rendering=!1,this._childObserver=null,this._normalizingChildren=!1}connectedCallback(){this.render()}disconnectedCallback(){this._childObserver?.disconnect(),this._dismissButton?.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,String(e??``))}get tone(){return this.getTone()}set tone(e){this.setAttribute(`tone`,e)}get dismissable(){return this.isDismissable()}set dismissable(e){this.setAttribute(`dismissable`,String(!!e))}get dismissible(){return this.dismissable}set dismissible(e){this.dismissable=e}cleanupDismissListener(){this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getTone(){let e=this.getAttribute(`tone`);return e===`info`||e===`success`||e===`warning`||e===`danger`?e:`info`}isDismissable(){return this.getAttribute(`dismissable`)===`true`}getIconName(){switch(this.getTone()){case`info`:return`info`;case`success`:return`success`;case`warning`:return`warning`;case`danger`:return`error`;default:return`info`}}getAriaLive(){return this.getTone()===`danger`?`assertive`:`polite`}render(){if(!(this._rendering||!this.isConnected)){this._rendering=!0;try{this.renderContent()}finally{this._rendering=!1}}}renderContent(){this._childObserver?.disconnect();let e=this.getTone(),t=this.getHeading(),n=this.isDismissable(),r=this.getAriaLive();this.setAttribute(`role`,e===`danger`?`alert`:`status`),this.setAttribute(`aria-live`,r),e===`danger`?this.setAttribute(`aria-atomic`,`true`):this.removeAttribute(`aria-atomic`);let i=[];for(this._bodyWrapper?Array.from(this._bodyWrapper.childNodes).forEach(e=>{i.push(e)}):Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&e!==this._iconElement&&e!==this._headingElement&&e!==this._dismissButton&&i.push(e)}),this.cleanupDismissListener();this.firstChild;)this.removeChild(this.firstChild);if(this._headerWrapper=null,this._bodyWrapper=null,this._iconElement=null,this._headingElement=null,this._dismissButton=null,this._headerWrapper=document.createElement(`div`),this._headerWrapper.className=`mint-alert-header`,this._iconElement=document.createElement(`mint-icon`),this._iconElement.setAttribute(`name`,this.getIconName()),this._iconElement.className=`mint-alert-icon`,this._headerWrapper.appendChild(this._iconElement),this._headingElement=document.createElement(`mint-text`),this._headingElement.className=`mint-alert-heading`,this._headingElement.textContent=t||``,this._headerWrapper.appendChild(this._headingElement),n){this._dismissButton=document.createElement(`button`),this._dismissButton.className=`mint-alert-dismiss`,this._dismissButton.setAttribute(`aria-label`,`Dismiss alert`),this._dismissButton.setAttribute(`type`,`button`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`close`),e.className=`mint-alert-close-icon`,this._dismissButton.appendChild(e),this._dismissHandler=e=>{e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},this._dismissButton.addEventListener(`click`,this._dismissHandler),this._headerWrapper.appendChild(this._dismissButton)}this._bodyWrapper=document.createElement(`div`),this._bodyWrapper.className=`mint-alert-body`,i.forEach(e=>{this._bodyWrapper.appendChild(e)}),this.appendChild(this._headerWrapper),this.appendChild(this._bodyWrapper),this._childObserver||=new MutationObserver(()=>this.normalizeConsumerChildren()),this._childObserver.observe(this,{childList:!0})}normalizeConsumerChildren(){if(!(this._normalizingChildren||!this._bodyWrapper)){this._normalizingChildren=!0;try{Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&this._bodyWrapper.appendChild(e)})}finally{this._normalizingChildren=!1}}}};customElements.get(`mint-alert`)||a(`mint-alert`,Cn);var L=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`mint-bottom-navigation`),this.setAttribute(`role`,`navigation`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this.hasAttribute(`data-preview`)||this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`is-hidden`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?this.classList.add(`is-hidden`):this.classList.remove(`is-hidden`),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||a(`mint-bottom-navigation`,L);var wn=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`mint-bottom-nav-item`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.hasAttribute(`active`)&&this.getAttribute(`active`)!==`false`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i;e?(i=document.createElement(`a`),i.href=e):(i=document.createElement(`button`),i.type=`button`),i.className=`mint-bottom-nav-link`,i.setAttribute(`aria-current`,r?`page`:`false`);let a=n.split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);i.setAttribute(`aria-label`,t||a||`Navigation item`);let o=document.createElement(`span`);if(o.className=`mint-bottom-nav-icon`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=`mint-bottom-nav-icon-glyph`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`mint-bottom-nav-label`,s.textContent=t,i.appendChild(o),i.appendChild(s),this.replaceChildren(i),this._root=i}};customElements.get(`mint-bottom-nav-item`)||a(`mint-bottom-nav-item`,wn);var Tn=L,En=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.5,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._animateNextRender=!1,this._observedDataReference=null,this._observedDataFingerprint=``,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_setupDataObserver(){let e=()=>{if(!this.isConnected)return;let e=this.data,t=null;e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(t=e);let n=``;if(t)try{n=JSON.stringify(t)}catch{n=``}t&&(t!==this._observedDataReference||n&&n!==this._observedDataFingerprint)&&(this._observedDataReference=t,this._observedDataFingerprint=n,this._chartData=t,this._animateNextRender=!0,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{e(),requestAnimationFrame(()=>{e()})});let t=setInterval(()=>{if(!this.isConnected){clearInterval(t);return}e()},250);this._dataCheckInterval=t}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`data`){if(n)try{this._chartData=JSON.parse(n)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=null;this._invalidateDataCaches(),this._animateNextRender=!0}(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()})}}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this._invalidateDataCaches(),this._animateNextRender=!0,this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._animateNextRender=!0,this._syncObservedData(),!this._renderScheduled&&(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_invalidateDataCaches(){this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent?.clear()}_syncObservedData(){this._observedDataReference=this._chartData;try{this._observedDataFingerprint=this._chartData?JSON.stringify(this._chartData):``}catch{this._observedDataFingerprint=``}}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;let e=this._animateNextRender&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches&&this._svg?this._svg.cloneNode(!0):null;this._animateNextRender=!1,this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let t=this.data;if(t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(this._chartData=t),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let n=this.getBoundingClientRect(),r=n.width||this.parentElement?.clientWidth||800,i=n.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,r,r),this._height=this._calculateDimension(this._heightValue,i,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let a=this.getAttribute(`curve-tension`);if(a!==null){let e=parseFloat(a);this._curveTension=isNaN(e)?.5:Math.max(0,Math.min(1,e))}else this._curveTension=.5;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,this._chartContainer.style.position=`relative`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._svg.setAttribute(`role`,`img`);let o=this._chartData.datasets.map(e=>e.name).filter(Boolean),s=this.getAttribute(`aria-label`)?.trim()||`${this.type} chart${o.length?` showing ${o.join(`, `)}`:``}. ${Math.max(0,...this._chartData.datasets.map(e=>e.data.length))} data points.`,c=`${this.id||`mint-chart-${Math.random().toString(36).slice(2,10)}`}-data`;this._svg.setAttribute(`aria-label`,s),this._svg.setAttribute(`aria-describedby`,c),this._chartContainer&&this._svg&&(e&&(e.style.position=`absolute`,e.style.inset=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`none`,e.style.zIndex=`1`,e.style.opacity=`1`,e.style.transition=`opacity 260ms ease`,this._chartContainer.appendChild(e),this._svg.style.position=`relative`,this._svg.style.zIndex=`0`,this._svg.style.opacity=`0`,this._svg.style.transition=`opacity 260ms ease`),this._chartContainer.appendChild(this._svg));let l=document.createElement(`table`);l.id=c,Object.assign(l.style,{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,top:`0`,left:`0`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:`0`});let u=document.createElement(`caption`);u.textContent=`Data for ${s}`,l.appendChild(u);let d=document.createElement(`thead`),f=document.createElement(`tr`),p=document.createElement(`th`);p.scope=`col`,p.textContent=`Category`,f.appendChild(p),this._chartData.datasets.forEach(e=>{let t=document.createElement(`th`);t.scope=`col`,t.textContent=e.name||`Series`,f.appendChild(t)}),d.appendChild(f),l.appendChild(d);let m=document.createElement(`tbody`),h=Math.max(0,...this._chartData.datasets.map(e=>e.data.length));for(let e=0;e<h;e+=1){let t=document.createElement(`tr`),n=document.createElement(`th`);n.scope=`row`,n.textContent=String(this._chartData.datasets.find(t=>t.data[e])?.data[e]?.x??e+1),t.appendChild(n),this._chartData.datasets.forEach(n=>{let r=document.createElement(`td`),i=n.data[e];r.textContent=i?this._formatValue(i.y,n):``,t.appendChild(r)}),m.appendChild(t)}switch(l.appendChild(m),this.appendChild(l),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}if(this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine(),e&&this._svg){let t=this._svg;requestAnimationFrame(()=>requestAnimationFrame(()=>{t.isConnected&&(e.style.opacity=`0`,t.style.opacity=`1`,window.setTimeout(()=>e.remove(),280))}))}}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.max(1,Math.min(5,r)),a=this._getYRange();if(this._hasOnlyZeroValues())return Math.ceil(e.measureText(this._formatYAxisValue(0)).width)+20;let o=0;for(let t=0;t<=i;t++){let n=a.max-(a.max-a.min)/i*t,r=this._formatYAxisValue(n),s=e.measureText(r);o=Math.max(o,s.width)}return Math.ceil(o)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_hasOnlyZeroValues(){let e=this._getAllDataPoints();return e.length>0&&e.every(e=>e.y===0)}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
223
223
  <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
224
224
  <span>${e.name}: ${e.formattedValue}</span>
225
225
  </div>`}),this._cachedTooltipContent.set(e,a)),this._updateTooltipPosition(n,r),this._lastTooltipContent!==a&&this._showTooltipAt(n,r,a);return}}if(this._activeXValue===s){this._updateTooltipPosition(n,r);return}let c=this._getAllDatasetsAtX(s);if(c.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=s,this._showPlotPointsForX(s),this._showVerticalLineAtX(s,t);let l=this._cachedTooltipContent.get(s);if(!l){if(l=this._tooltipXHeadingHtml(s),c.forEach(e=>{l+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
package/dist/index.js CHANGED
@@ -3117,18 +3117,19 @@ var mn = class extends HTMLElement {
3117
3117
  ];
3118
3118
  }
3119
3119
  constructor() {
3120
- super(), this._actionsResizeObserver = null, this._actionsMutationObserver = null, this._actionsFrame = null, this._groupingActions = !1, this._actionFullWidthOriginal = /* @__PURE__ */ new WeakMap(), this._autoGroupedActions = /* @__PURE__ */ new WeakSet(), this._explicitOverflowActions = /* @__PURE__ */ new WeakSet(), this._root = this.attachShadow({ mode: "open" }), this._root.innerHTML = "\n <style>\n /* The built-in back button lives inside this component's shadow root,\n so document-level button.css cannot reach its light-DOM button. */\n /* Avoid an inline baseline line box below the native button core. */\n .mint-page-back mint-button {\n box-sizing: border-box;\n display: flex !important;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n line-height: 0;\n vertical-align: middle;\n }\n .mint-page-back mint-button .mint-button-core {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n min-width: 2.25rem;\n min-height: 2.25rem;\n padding: .375rem;\n border: 2px solid var(--mint-color-border, #dfe6e0);\n border-top-color: #e5e7eb;\n border-left-color: #e5e7eb;\n border-right-color: #d1d5db;\n border-bottom-color: #d1d5db;\n border-radius: .5rem;\n background: var(--mint-color-surface, #fff);\n color: var(--mint-color-text, #28372d);\n font: inherit;\n box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n cursor: pointer;\n transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;\n }\n .mint-page-back mint-button .mint-button-core:hover:not(:disabled) { filter: brightness(.98); }\n .mint-page-back mint-button .mint-button-core:active:not(:disabled) {\n border-top-color: #9ca3af;\n border-left-color: #9ca3af;\n border-right-color: #e5e7eb;\n border-bottom-color: #e5e7eb;\n background: #f3f4f6;\n box-shadow: inset 0 2px 4px rgb(16 32 21 / 26%), inset 0 1px 2px rgb(6 25 15 / 14%);\n filter: brightness(.97);\n }\n .mint-page-back mint-button .mint-button-core:focus-visible {\n outline: 3px solid var(--mint-color-focus, #6eaa86);\n outline-offset: 2px;\n }\n .mint-page-actions-menu { box-sizing: border-box; display: flex; min-width: 14rem; flex-direction: column; gap: .25rem; padding: .375rem; }\n .mint-page-actions-primary { display: flex; align-items: center; gap: .5rem; min-width: 0; }\n .mint-page-actions-menu ::slotted(*) { box-sizing: border-box; display: block; width: 100%; }\n .mint-page-actions-menu ::slotted(div) { display: flex; flex-direction: column !important; align-items: stretch !important; gap: .25rem !important; }\n .mint-page-actions-trigger { display: inline-flex; vertical-align: middle; }\n .mint-page-actions-trigger[hidden] { display: none !important; }\n .mint-page-actions-trigger .mint-button-core {\n box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;\n width: 2.5rem; height: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; padding: .5rem;\n border: 2px solid var(--mint-color-border, #dfe6e0); border-radius: .625rem;\n background: var(--mint-color-surface, #fff); color: var(--mint-color-text, #28372d);\n font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n }\n .mint-page-actions-trigger .mint-button-icon { display: inline-flex; width: 1.125rem; height: 1.125rem; }\n .mint-page-actions-trigger .mint-button-icon mint-icon { width: 100% !important; height: 100% !important; }\n .mint-page-actions-popover { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; }\n .mint-page-actions-popover:not([data-open]):not([data-state=\"closing\"]),\n .mint-page-actions-popover.hidden { display: none !important; }\n .mint-page-actions-popover[data-open],\n .mint-page-actions-popover[data-state=\"closing\"] {\n display: block; box-sizing: border-box; width: max-content; height: max-content;\n min-height: 0; max-width: calc(100vw - 24px); max-height: min(500px, calc(100vh - 24px));\n max-height: min(500px, calc(100svh - 24px)); overflow: auto; padding: 0;\n border: 1px solid var(--mint-color-border, #dfe6e0); border-radius: .75rem;\n background: var(--mint-color-surface-raised, #fff); color: var(--mint-color-text, #28372d);\n box-shadow: 0 12px 36px rgb(16 32 21 / 13%); pointer-events: auto;\n transform-origin: var(--mint-popover-origin-x, 50%) var(--mint-popover-origin-y, 0%);\n }\n .mint-page-actions-popover[data-state=\"closing\"] { pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-none { position: fixed; inset: 0; z-index: 55; pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-auto {\n position: fixed; z-index: 60; min-width: 14rem; border-radius: .75rem;\n background: var(--mint-color-surface, #fff); pointer-events: auto;\n }\n .mint-page-actions-popover .popover-content {\n min-height: 0; overflow: visible; border: 1px solid var(--mint-color-border, #dfe6e0);\n border-radius: .75rem; background: var(--mint-color-surface, #fff);\n box-shadow: 0 12px 30px rgb(15 23 42 / 16%); padding: 0;\n }\n .mint-page-actions[hidden] { display: none !important; }\n </style>\n <div part=\"container\" class=\"mint-page-container\">\n <header part=\"header\" class=\"mint-page-header\">\n <div part=\"title\" class=\"mint-page-title\">\n <mint-back-button part=\"back-button\" class=\"mint-page-back\" aria-label=\"Go back\" hidden></mint-back-button>\n <h1 part=\"heading\" class=\"mint-page-heading\"></h1>\n </div>\n <div part=\"actions\" class=\"mint-page-actions\" hidden>\n <div class=\"mint-page-actions-primary\"><slot name=\"actions\"></slot></div>\n <mint-button id=\"mint-page-actions-trigger\" class=\"mint-page-actions-trigger\" variant=\"outline\" icon=\"ellipsis\" aria-label=\"Page actions\"></mint-button>\n <mint-popover id=\"mint-page-actions-popover\" class=\"mint-page-actions-popover\" trigger-id=\"mint-page-actions-trigger\" direction=\"down\" trigger-align=\"end\" padding=\"0\">\n <div class=\"mint-page-actions-menu\"><slot name=\"overflow-actions\"></slot></div>\n </mint-popover>\n </div>\n </header>\n <main part=\"body\" class=\"mint-page-body\"><slot></slot></main>\n </div>\n ", this._headingElement = this._root.querySelector(".mint-page-heading"), this._backButton = this._root.querySelector(".mint-page-back"), this._actionsSlot = this._root.querySelector("slot[name=\"actions\"]"), this._overflowActionsSlot = this._root.querySelector("slot[name=\"overflow-actions\"]"), this._actionsWrapper = this._root.querySelector(".mint-page-actions"), this._actionsTrigger = this._root.querySelector("#mint-page-actions-trigger"), this._actionsPopover = this._root.querySelector("#mint-page-actions-popover"), this._actionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._overflowActionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._backButton.addEventListener("click", (e) => this._handleBack(e), !0);
3120
+ super(), this._actionsResizeObserver = null, this._actionsMutationObserver = null, this._actionsFrame = null, this._groupingActions = !1, this._actionFullWidthOriginal = /* @__PURE__ */ new WeakMap(), this._autoGroupedActions = /* @__PURE__ */ new WeakSet(), this._explicitOverflowActions = /* @__PURE__ */ new WeakSet(), this._root = this.attachShadow({ mode: "open" }), this._root.innerHTML = "\n <style>\n /* The built-in back button lives inside this component's shadow root,\n so document-level button.css cannot reach its light-DOM button. */\n /* Avoid an inline baseline line box below the native button core. */\n .mint-page-back mint-button {\n box-sizing: border-box;\n display: flex !important;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n line-height: 0;\n vertical-align: middle;\n }\n .mint-page-back mint-button .mint-button-core {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n min-width: 2.25rem;\n min-height: 2.25rem;\n padding: .375rem;\n border: 2px solid var(--mint-color-border, #dfe6e0);\n border-top-color: #e5e7eb;\n border-left-color: #e5e7eb;\n border-right-color: #d1d5db;\n border-bottom-color: #d1d5db;\n border-radius: .5rem;\n background: var(--mint-color-surface, #fff);\n color: var(--mint-color-text, #28372d);\n font: inherit;\n box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n cursor: pointer;\n transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;\n }\n .mint-page-back mint-button .mint-button-core:hover:not(:disabled) { filter: brightness(.98); }\n .mint-page-back mint-button .mint-button-core:active:not(:disabled) {\n border-top-color: #9ca3af;\n border-left-color: #9ca3af;\n border-right-color: #e5e7eb;\n border-bottom-color: #e5e7eb;\n background: #f3f4f6;\n box-shadow: inset 0 2px 4px rgb(16 32 21 / 26%), inset 0 1px 2px rgb(6 25 15 / 14%);\n filter: brightness(.97);\n }\n .mint-page-back mint-button .mint-button-core:focus-visible {\n outline: 3px solid var(--mint-color-focus, #6eaa86);\n outline-offset: 2px;\n }\n .mint-page-actions-menu { box-sizing: border-box; display: flex; min-width: 14rem; flex-direction: column; gap: .25rem; padding: .375rem; }\n .mint-page-actions-primary { display: flex; align-items: center; gap: .5rem; min-width: 0; }\n .mint-page-actions-menu ::slotted(*) { box-sizing: border-box; display: block; width: 100%; }\n .mint-page-actions-menu ::slotted(div) { display: flex; flex-direction: column !important; align-items: stretch !important; gap: .25rem !important; }\n .mint-page-actions-trigger { display: inline-flex; vertical-align: middle; }\n .mint-page-actions-trigger[hidden] { display: none !important; }\n .mint-page-actions-trigger .mint-button-core {\n box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;\n width: 2.5rem; height: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; padding: .5rem;\n border: 2px solid var(--mint-color-border, #dfe6e0); border-radius: .625rem;\n background: var(--mint-color-surface, #fff); color: var(--mint-color-text, #28372d);\n font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgb(21 36 26 / 8%);\n }\n .mint-page-actions-trigger .mint-button-icon { display: inline-flex; width: 1.125rem; height: 1.125rem; }\n .mint-page-actions-trigger .mint-button-icon mint-icon { width: 100% !important; height: 100% !important; }\n .mint-page-actions-popover { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; }\n .mint-page-actions-popover:not([data-open]):not([data-state=\"closing\"]),\n .mint-page-actions-popover.hidden { display: none !important; }\n .mint-page-actions-popover[data-open],\n .mint-page-actions-popover[data-state=\"closing\"] {\n display: block; box-sizing: border-box; width: max-content; height: max-content;\n min-height: 0; max-width: calc(100vw - 24px); max-height: min(500px, calc(100vh - 24px));\n max-height: min(500px, calc(100svh - 24px)); overflow: auto; padding: 0;\n border: 1px solid var(--mint-color-border, #dfe6e0); border-radius: .75rem;\n background: var(--mint-color-surface-raised, #fff); color: var(--mint-color-text, #28372d);\n box-shadow: 0 12px 36px rgb(16 32 21 / 13%); pointer-events: auto;\n transform-origin: var(--mint-popover-origin-x, 50%) var(--mint-popover-origin-y, 0%);\n }\n .mint-page-actions-popover[data-state=\"closing\"] { pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-none { position: fixed; inset: 0; z-index: 55; pointer-events: none; }\n .mint-page-actions-popover > .pointer-events-auto {\n position: fixed; z-index: 60; min-width: 14rem; border-radius: .75rem;\n background: var(--mint-color-surface, #fff); pointer-events: auto;\n }\n .mint-page-actions-popover .popover-content {\n min-height: 0; overflow: visible; border: 1px solid var(--mint-color-border, #dfe6e0);\n border-radius: .75rem; background: var(--mint-color-surface, #fff);\n box-shadow: 0 12px 30px rgb(15 23 42 / 16%); padding: 0;\n }\n .mint-page-actions[hidden] { display: none !important; }\n </style>\n <div part=\"container\" class=\"mint-page-container\">\n <header part=\"header\" class=\"mint-page-header\">\n <div part=\"title\" class=\"mint-page-title\">\n <mint-back-button part=\"back-button\" class=\"mint-page-back\" aria-label=\"Go back\" hidden></mint-back-button>\n <h1 part=\"heading\" class=\"mint-page-heading\"><slot name=\"heading\"><span class=\"mint-page-heading-fallback\"></span></slot></h1>\n </div>\n <div part=\"actions\" class=\"mint-page-actions\" hidden>\n <div class=\"mint-page-actions-primary\"><slot name=\"actions\"></slot></div>\n <mint-button id=\"mint-page-actions-trigger\" class=\"mint-page-actions-trigger\" variant=\"outline\" icon=\"ellipsis\" aria-label=\"Page actions\"></mint-button>\n <mint-popover id=\"mint-page-actions-popover\" class=\"mint-page-actions-popover\" trigger-id=\"mint-page-actions-trigger\" direction=\"down\" trigger-align=\"end\" padding=\"0\">\n <div class=\"mint-page-actions-menu\"><slot name=\"overflow-actions\"></slot></div>\n </mint-popover>\n </div>\n </header>\n <main part=\"body\" class=\"mint-page-body\"><slot></slot></main>\n </div>\n ", this._headingElement = this._root.querySelector(".mint-page-heading"), this._headingFallbackElement = this._root.querySelector(".mint-page-heading-fallback"), this._backButton = this._root.querySelector(".mint-page-back"), this._actionsSlot = this._root.querySelector("slot[name=\"actions\"]"), this._overflowActionsSlot = this._root.querySelector("slot[name=\"overflow-actions\"]"), this._actionsWrapper = this._root.querySelector(".mint-page-actions"), this._actionsTrigger = this._root.querySelector("#mint-page-actions-trigger"), this._actionsPopover = this._root.querySelector("#mint-page-actions-popover"), this._actionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._overflowActionsSlot.addEventListener("slotchange", () => this._scheduleActionGrouping()), this._backButton.addEventListener("click", (e) => this._handleBack(e), !0);
3121
3121
  }
3122
3122
  connectedCallback() {
3123
3123
  this.render(), this._actionsResizeObserver = new ResizeObserver(() => this._scheduleActionGrouping()), this._actionsResizeObserver.observe(this._root.querySelector(".mint-page-header")), this._actionsMutationObserver = new MutationObserver((e) => {
3124
- e.some((e) => e.type === "childList" || e.attributeName === "importance" || e.attributeName === "always-grouped" || e.attributeName === "slot" && !["actions", "overflow-actions"].includes(e.target.getAttribute("slot") || "")) && this._scheduleActionGrouping();
3124
+ e.some((e) => e.type === "childList" || e.attributeName === "importance" || e.attributeName === "always-grouped" || e.attributeName === "always-visible" || e.attributeName === "slot" && !["actions", "overflow-actions"].includes(e.target.getAttribute("slot") || "")) && this._scheduleActionGrouping();
3125
3125
  }), this._actionsMutationObserver.observe(this, {
3126
3126
  childList: !0,
3127
3127
  attributes: !0,
3128
3128
  attributeFilter: [
3129
3129
  "slot",
3130
3130
  "importance",
3131
- "always-grouped"
3131
+ "always-grouped",
3132
+ "always-visible"
3132
3133
  ]
3133
3134
  }), this._scheduleActionGrouping();
3134
3135
  }
@@ -3151,7 +3152,7 @@ var mn = class extends HTMLElement {
3151
3152
  return this.hasAttribute("containered") && this.getAttribute("containered") !== "false";
3152
3153
  }
3153
3154
  render() {
3154
- this._headingElement.textContent = this.getHeading(), this._backButton.setAttribute("fallback-href", this.getFallbackHref()), this._backButton.hidden = !this.shouldShowBackButton();
3155
+ this._headingFallbackElement.textContent = this.getHeading(), this._backButton.setAttribute("fallback-href", this.getFallbackHref()), this._backButton.hidden = !this.shouldShowBackButton();
3155
3156
  }
3156
3157
  _scheduleActionGrouping() {
3157
3158
  this._actionsFrame !== null || !this.isConnected || (this._actionsFrame = requestAnimationFrame(() => {
@@ -3169,29 +3170,29 @@ var mn = class extends HTMLElement {
3169
3170
  e.forEach((e) => {
3170
3171
  e.getAttribute("slot") === "overflow-actions" && !this._autoGroupedActions.has(e) && this._explicitOverflowActions.add(e);
3171
3172
  });
3172
- let t = e.filter((e) => e.hasAttribute("always-grouped") || this._explicitOverflowActions.has(e)), n = e.filter((e) => !t.includes(e));
3173
- if (e.length === 1 && t.length === 0) {
3173
+ let t = e.filter((e) => e.hasAttribute("always-visible")), n = e.filter((e) => !t.includes(e) && (e.hasAttribute("always-grouped") || this._explicitOverflowActions.has(e))), r = e.filter((e) => !n.includes(e) && !t.includes(e));
3174
+ if (e.length === 1 && n.length === 0) {
3174
3175
  this._setActionSlot(e[0], "actions"), this._syncOverflowButtonWidths([]), this._actionsTrigger.hidden = !0, this._actionsPopover.style.display = "none", this._groupingActions = !1;
3175
3176
  return;
3176
3177
  }
3177
- n.forEach((e) => this._setActionSlot(e, "actions")), t.forEach((e) => this._setActionSlot(e, "overflow-actions")), this._syncOverflowButtonWidths([]), this._actionsPopover.style.display = "", this._actionsTrigger.hidden = !0;
3178
- let r = this._root.querySelector(".mint-page-actions-primary"), i = this._root.querySelector(".mint-page-header"), a = this._root.querySelector(".mint-page-heading");
3179
- this._actionsResizeObserver?.observe(r), e.forEach((e) => this._actionsResizeObserver?.observe(e));
3180
- let o = i.clientWidth <= 767, s = n.reduce((e, t, n) => e + t.getBoundingClientRect().width + (n ? 8 : 0), 0), c = this._backButton.hidden ? 0 : this._backButton.getBoundingClientRect().width + 16, l = Math.min(i.clientWidth, a.scrollWidth + c), u = Math.max(0, i.clientWidth - l - 16), d = [...t], f = (e) => {
3178
+ r.forEach((e) => this._setActionSlot(e, "actions")), n.forEach((e) => this._setActionSlot(e, "overflow-actions")), this._syncOverflowButtonWidths([]), this._actionsPopover.style.display = "", this._actionsTrigger.hidden = !0;
3179
+ let i = this._root.querySelector(".mint-page-actions-primary"), a = this._root.querySelector(".mint-page-header"), o = this._root.querySelector(".mint-page-heading");
3180
+ this._actionsResizeObserver?.observe(i), e.forEach((e) => this._actionsResizeObserver?.observe(e));
3181
+ let s = a.clientWidth <= 767, c = e.filter((e) => !n.includes(e)).reduce((e, t, n) => e + t.getBoundingClientRect().width + (n ? 8 : 0), 0), l = this._backButton.hidden ? 0 : this._backButton.getBoundingClientRect().width + 16, u = Math.min(a.clientWidth, o.scrollWidth + l), d = Math.max(0, a.clientWidth - u - 16), f = [...n], p = (e) => {
3181
3182
  let t = e.getAttribute("importance"), n = e.querySelector("[importance]")?.getAttribute("importance"), r = Number(t ?? n ?? 1);
3182
3183
  return Number.isFinite(r) && r > 0 ? r : 1;
3183
3184
  };
3184
- !o && s > u && (u = Math.max(0, u - 48));
3185
- let p = s;
3186
- for (; o ? n.length > d.length - t.length : p > u && d.length < e.length;) {
3187
- let t = n.filter((e) => !d.includes(e));
3188
- t.sort((t, n) => f(n) - f(t) || e.indexOf(n) - e.indexOf(t));
3189
- let r = t[0];
3190
- if (!r) break;
3191
- d.push(r), p -= r.getBoundingClientRect().width + (d.length < e.length ? 8 : 0);
3192
- }
3193
- let m = new Set(d);
3194
- e.forEach((e) => this._setActionSlot(e, m.has(e) ? "overflow-actions" : "actions")), this._actionsTrigger.hidden = d.length === 0, this._actionsPopover.style.display = d.length === 0 ? "none" : "", this._syncOverflowButtonWidths(d), this._actionsResizeObserver?.observe(this._actionsTrigger), this._groupingActions = !1;
3185
+ !s && c > d && (d = Math.max(0, d - 48));
3186
+ let m = c;
3187
+ for (; s ? r.length > f.length - n.length : m > d && f.length < e.length;) {
3188
+ let t = r.filter((e) => !f.includes(e));
3189
+ t.sort((t, n) => p(n) - p(t) || e.indexOf(n) - e.indexOf(t));
3190
+ let n = t[0];
3191
+ if (!n) break;
3192
+ f.push(n), m -= n.getBoundingClientRect().width + (f.length < e.length ? 8 : 0);
3193
+ }
3194
+ let h = new Set(f);
3195
+ e.forEach((e) => this._setActionSlot(e, h.has(e) ? "overflow-actions" : "actions")), this._actionsTrigger.hidden = f.length === 0, this._actionsPopover.style.display = f.length === 0 ? "none" : "", this._syncOverflowButtonWidths(f), this._actionsResizeObserver?.observe(this._actionsTrigger), this._groupingActions = !1;
3195
3196
  }
3196
3197
  _setActionSlot(e, t) {
3197
3198
  t === "overflow-actions" ? this._autoGroupedActions.add(e) : this._autoGroupedActions.delete(e), e.getAttribute("slot") !== t && e.setAttribute("slot", t);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monobill-mintui",
3
- "version": "0.6.699",
3
+ "version": "0.6.701",
4
4
  "description": "Framework-independent HTML custom elements with component-scoped CSS.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",