monobill-mintui 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type StackDirection = 'horizontal' | 'vertical';
|
|
2
2
|
type TextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
3
|
-
type StackAlignContent = '
|
|
3
|
+
type StackAlignContent = 'start' | 'end' | 'middle';
|
|
4
4
|
declare class MintStack extends HTMLElement {
|
|
5
5
|
static get observedAttributes(): string[];
|
|
6
6
|
private _childObserver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/components/stack/Stack.ts"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG,YAAY,GAAG,UAAU,CAAA;AAC/C,KAAK,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;AACxD,KAAK,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/components/stack/Stack.ts"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG,YAAY,GAAG,UAAU,CAAA;AAC/C,KAAK,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;AACxD,KAAK,iBAAiB,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEnD,cAAM,SAAU,SAAQ,WAAW;IACjC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,cAAc,CAAgC;;IAOtD,iBAAiB,IAAI,IAAI;IAWzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAW9F,OAAO,CAAC,gBAAgB;IAgBxB,oBAAoB,IAAI,IAAI;IAO5B,YAAY,IAAI,cAAc;IAK9B,MAAM,IAAI,MAAM;IAKhB,YAAY,IAAI,SAAS,GAAG,EAAE;IAM9B,wGAAwG;IACxG,eAAe,IAAI,iBAAiB,GAAG,EAAE;IAQzC,eAAe,IAAI,MAAM;IAgDzB,MAAM,IAAI,IAAI;IAwCd,OAAO,CAAC,yBAAyB;IAoCjC,OAAO,CAAC,4BAA4B;CAoBrC;AAOD,eAAe,SAAS,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -55,7 +55,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
55
55
|
mint-button[data-variant="link"] .mint-button-active {
|
|
56
56
|
box-shadow: none !important;
|
|
57
57
|
}
|
|
58
|
-
`,document.head.appendChild(t),e._activeShadowStyleInjected=!0}this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add(`w-full`)}disconnectedCallback(){this._disconnectHostChildObserver(),this._hostRenderFromObserverRaf!==null&&(cancelAnimationFrame(this._hostRenderFromObserverRaf),this._hostRenderFromObserverRaf=null),this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-neutral-900`,`dark:!bg-neutral-700`,`hover:!bg-neutral-900`,`dark:hover:!bg-neutral-700`,`!border-t-neutral-900`,`!border-l-neutral-900`,`!border-r-neutral-600`,`!border-b-neutral-600`,`dark:!border-t-neutral-700`,`dark:!border-l-neutral-700`,`dark:!border-r-neutral-500`,`dark:!border-b-neutral-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-mint-divider`,`dark:!border-b-mint-divider`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"link-action":[`!text-neutral-900`,`dark:!text-neutral-300`,`hover:!text-neutral-900`,`dark:hover:!text-neutral-300`],"link-neutral":[`!text-gray-950`,`dark:!text-gray-200`,`hover:!text-gray-950`,`dark:hover:!text-gray-200`],"link-info":[`!text-blue-900`,`dark:!text-blue-200`,`hover:!text-blue-900`,`dark:hover:!text-blue-200`],"link-warning":[`!text-amber-900`,`dark:!text-amber-200`,`hover:!text-amber-900`,`dark:hover:!text-amber-200`],"link-danger":[`!text-red-900`,`dark:!text-red-200`,`hover:!text-red-900`,`dark:hover:!text-red-200`]}[e]||[]}_disconnectHostChildObserver(){this._hostChildObserver?.disconnect()}_connectHostChildObserver(){this.isConnected&&(this._hostChildObserver||=new MutationObserver(e=>{this._onLightDomMutation(e)}),this._hostChildObserver.disconnect(),this._hostChildObserver.observe(this,{childList:!0,subtree:!0,characterData:!0}))}_onLightDomMutation(e){if(this.isConnected){if(this._button&&!this._button.isConnected){this._button=null,this._scheduleRenderFromHostObserver();return}for(let t of e){let e=t.target;if(!(this._button&&(e===this._button||this._button.contains(e)))){this._scheduleRenderFromHostObserver();return}}}}_scheduleRenderFromHostObserver(){this._hostRenderFromObserverRaf===null&&(this._hostRenderFromObserverRaf=requestAnimationFrame(()=>{this._hostRenderFromObserverRaf=null,this.isConnected&&this.render()}))}getButtonClasses(){let e=this.isIconOnly(),t=this.getVariant(),n=this.getAlignment(),r=`justify-center`;n===`left`?r=`justify-start`:n===`right`&&(r=`justify-end`);let i=[`inline-flex`,`items-center`,r,`cursor-pointer`,`font-medium`,`rounded-lg`,`box-border`,...e?[`p-1.5`,`aspect-square`,`w-[2.25rem]`,`h-[2.25rem]`]:[`px-3.5`,`py-1.5`,`min-h-[2.25rem]`],`text-sm`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`[&.mint-button-active:not(:disabled):not([data-loading="true"]):not([data-variant="ghost"]):not([data-variant="link"])>*]:translate-y-[1px]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],a=this.getTone(),o={"solid-action":`bg-neutral-800.dark:bg-neutral-600.text-white.hover:bg-neutral-950.dark:hover:bg-neutral-700.active:bg-neutral-900.dark:active:bg-neutral-700.disabled:active:bg-neutral-800.dark:disabled:active:bg-neutral-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-neutral-600.border-l-neutral-600.border-r-neutral-900.border-b-neutral-900.dark:border-t-neutral-500.dark:border-l-neutral-500.dark:border-r-neutral-700.dark:border-b-neutral-700.active:border-t-neutral-900.active:border-l-neutral-900.active:border-r-neutral-600.active:border-b-neutral-600.dark:active:border-t-neutral-700.dark:active:border-l-neutral-700.dark:active:border-r-neutral-500.dark:active:border-b-neutral-500.disabled:active:border-t-neutral-600.disabled:active:border-l-neutral-600.disabled:active:border-r-neutral-900.disabled:active:border-b-neutral-900.dark:disabled:active:border-t-neutral-500.dark:disabled:active:border-l-neutral-500.dark:disabled:active:border-r-neutral-700.dark:disabled:active:border-b-neutral-700.[&[data-loading="true"]:active]:border-t-neutral-600.[&[data-loading="true"]:active]:border-l-neutral-600.[&[data-loading="true"]:active]:border-r-neutral-900.[&[data-loading="true"]:active]:border-b-neutral-900.[&[data-loading="true"]:active]:dark:border-t-neutral-500.[&[data-loading="true"]:active]:dark:border-l-neutral-500.[&[data-loading="true"]:active]:dark:border-r-neutral-700.[&[data-loading="true"]:active]:dark:border-b-neutral-700`.split(`.`),"solid-neutral":`bg-white.dark:bg-mint-canvas.text-gray-900.dark:text-white.hover:bg-gray-50.dark:hover:bg-mint-hover.active:bg-gray-100.dark:active:bg-mint-hover.disabled:active:bg-white.dark:disabled:active:bg-mint-canvas.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-gray-200.border-l-gray-200.border-r-gray-300.border-b-gray-300.dark:border-t-gray-600.dark:border-l-gray-600.dark:border-r-mint-divider.dark:border-b-mint-divider.active:border-t-gray-400.active:border-l-gray-400.active:border-r-gray-200.active:border-b-gray-200.dark:active:border-t-gray-950.dark:active:border-l-gray-950.dark:active:border-r-mint-divider.dark:active:border-b-mint-divider.disabled:active:border-t-gray-200.disabled:active:border-l-gray-200.disabled:active:border-r-gray-400.disabled:active:border-b-gray-400.dark:disabled:active:border-t-mint-divider.dark:disabled:active:border-l-mint-divider.dark:disabled:active:border-r-gray-950.dark:disabled:active:border-b-gray-950.[&[data-loading="true"]:active]:border-t-gray-200.[&[data-loading="true"]:active]:border-l-gray-200.[&[data-loading="true"]:active]:border-r-gray-400.[&[data-loading="true"]:active]:border-b-gray-400.[&[data-loading="true"]:active]:dark:border-t-mint-divider.[&[data-loading="true"]:active]:dark:border-l-mint-divider.[&[data-loading="true"]:active]:dark:border-r-gray-950.[&[data-loading="true"]:active]:dark:border-b-gray-950`.split(`.`),"solid-info":`bg-blue-800.dark:bg-blue-600.text-white.hover:bg-blue-950.dark:hover:bg-blue-700.active:bg-blue-900.dark:active:bg-blue-700.disabled:active:bg-blue-800.dark:disabled:active:bg-blue-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-blue-600.border-l-blue-600.border-r-blue-900.border-b-blue-900.dark:border-t-blue-500.dark:border-l-blue-500.dark:border-r-blue-700.dark:border-b-blue-700.active:border-t-blue-900.active:border-l-blue-900.active:border-r-blue-600.active:border-b-blue-600.dark:active:border-t-blue-700.dark:active:border-l-blue-700.dark:active:border-r-blue-500.dark:active:border-b-blue-500.disabled:active:border-t-blue-600.disabled:active:border-l-blue-600.disabled:active:border-r-blue-900.disabled:active:border-b-blue-900.dark:disabled:active:border-t-blue-500.dark:disabled:active:border-l-blue-500.dark:disabled:active:border-r-blue-700.dark:disabled:active:border-b-blue-700.[&[data-loading="true"]:active]:border-t-blue-600.[&[data-loading="true"]:active]:border-l-blue-600.[&[data-loading="true"]:active]:border-r-blue-900.[&[data-loading="true"]:active]:border-b-blue-900.[&[data-loading="true"]:active]:dark:border-t-blue-500.[&[data-loading="true"]:active]:dark:border-l-blue-500.[&[data-loading="true"]:active]:dark:border-r-blue-700.[&[data-loading="true"]:active]:dark:border-b-blue-700`.split(`.`),"solid-warning":`bg-amber-800.dark:bg-amber-600.text-white.hover:bg-amber-950.dark:hover:bg-amber-700.active:bg-amber-900.dark:active:bg-amber-700.disabled:active:bg-amber-800.dark:disabled:active:bg-amber-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-amber-600.border-l-amber-600.border-r-amber-900.border-b-amber-900.dark:border-t-amber-500.dark:border-l-amber-500.dark:border-r-amber-700.dark:border-b-amber-700.active:border-t-amber-900.active:border-l-amber-900.active:border-r-amber-600.active:border-b-amber-600.dark:active:border-t-amber-700.dark:active:border-l-amber-700.dark:active:border-r-amber-500.dark:active:border-b-amber-500.disabled:active:border-t-amber-600.disabled:active:border-l-amber-600.disabled:active:border-r-amber-900.disabled:active:border-b-amber-900.dark:disabled:active:border-t-amber-500.dark:disabled:active:border-l-amber-500.dark:disabled:active:border-r-amber-700.dark:disabled:active:border-b-amber-700.[&[data-loading="true"]:active]:border-t-amber-600.[&[data-loading="true"]:active]:border-l-amber-600.[&[data-loading="true"]:active]:border-r-amber-900.[&[data-loading="true"]:active]:border-b-amber-900.[&[data-loading="true"]:active]:dark:border-t-amber-500.[&[data-loading="true"]:active]:dark:border-l-amber-500.[&[data-loading="true"]:active]:dark:border-r-amber-700.[&[data-loading="true"]:active]:dark:border-b-amber-700`.split(`.`),"solid-danger":`bg-red-800.dark:bg-red-600.text-white.hover:bg-red-950.dark:hover:bg-red-700.active:bg-red-900.dark:active:bg-red-700.disabled:active:bg-red-800.dark:disabled:active:bg-red-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-red-600.border-l-red-600.border-r-red-900.border-b-red-900.dark:border-t-red-500.dark:border-l-red-500.dark:border-r-red-700.dark:border-b-red-700.active:border-t-red-900.active:border-l-red-900.active:border-r-red-600.active:border-b-red-600.dark:active:border-t-red-700.dark:active:border-l-red-700.dark:active:border-r-red-500.dark:active:border-b-red-500.disabled:active:border-t-red-600.disabled:active:border-l-red-600.disabled:active:border-r-red-900.disabled:active:border-b-red-900.dark:disabled:active:border-t-red-500.dark:disabled:active:border-l-red-500.dark:disabled:active:border-r-red-700.dark:disabled:active:border-b-red-700.[&[data-loading="true"]:active]:border-t-red-600.[&[data-loading="true"]:active]:border-l-red-600.[&[data-loading="true"]:active]:border-r-red-900.[&[data-loading="true"]:active]:border-b-red-900.[&[data-loading="true"]:active]:dark:border-t-red-500.[&[data-loading="true"]:active]:dark:border-l-red-500.[&[data-loading="true"]:active]:dark:border-r-red-700.[&[data-loading="true"]:active]:dark:border-b-red-700`.split(`.`),"ghost-action":[`bg-transparent`,`text-neutral-800`,`dark:text-neutral-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-200`,`active:bg-gray-50`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`active:text-gray-900`,`dark:active:text-white`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-action":[`bg-transparent`,`text-neutral-800`,`dark:text-neutral-400`,`hover:text-neutral-950`,`dark:hover:text-neutral-200`,`active:text-neutral-900`,`dark:active:text-neutral-300`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-300`,`hover:text-gray-900`,`dark:hover:text-gray-100`,`active:text-gray-950`,`dark:active:text-gray-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`hover:text-blue-950`,`dark:hover:text-blue-300`,`active:text-blue-900`,`dark:active:text-blue-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`hover:text-amber-950`,`dark:hover:text-amber-300`,`active:text-amber-900`,`dark:active:text-amber-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`hover:text-red-950`,`dark:hover:text-red-300`,`active:text-red-900`,`dark:active:text-red-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`]},s=o[`${t}-${a}`]||o[`solid-neutral`],c=[...i,...s];if(this.isActive()){let e=this.getActiveStateClasses();c.push(...e)}return this.isFullWidth()&&c.push(`w-full`),c.join(` `)}render(){this._disconnectHostChildObserver(),this._button&&!this._button.isConnected&&(this._button=null);try{let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`),r=this.isLoading();if(r)if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),`render`in n&&typeof n.render==`function`&&n.render();else{let e=document.createElement(`span`);e.className=`mr-2 inline-flex items-center`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.className===`mr-2`&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();if(a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),r?a.style.display=`none`:a.style.display=``,a.classList.remove(`mr-1.5`,`ml-1.5`),c?a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`)):o===`left`?a.classList.add(`mr-1.5`):a.classList.add(`ml-1.5`)),r){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(c?(e.classList.remove(`mr-2`),e.classList.add(`mr-0`)):e.classList.contains(`mr-2`)||(e.classList.remove(`mr-0`),e.classList.add(`mr-2`)))}let l=this.getButtonClasses();this._button.className=l,this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),r?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}finally{queueMicrotask(()=>{this.isConnected&&this._connectHostChildObserver()})}}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||customElements.define(`mint-button`,r);var i=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`icon`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._button=null,this._checked=!1}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}_getSwitchContainer(){let e=this.querySelector(`.mint-switch-container`);return e||(e=document.createElement(`div`),e.className=`mint-switch-container flex items-center gap-2`,this.insertBefore(e,this.firstChild)),e}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this.render()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getIcon(){return this.getAttribute(`icon`)||``}hasIcon(){return!!this.getIcon()}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getSwitchClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`cursor-pointer`,`rounded-full`,`h-5`,`w-10`,`border`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-neutral-900`,`dark:bg-neutral-700`,e?`border-red-300 dark:border-red-300`:`border-neutral-800 dark:border-neutral-600`]:[`bg-neutral-200`,`dark:bg-neutral-600`,e?`border-red-300 dark:border-red-300`:`border-neutral-300 dark:border-neutral-500`];return[...t,...n].join(` `)}getThumbClasses(){let e=[`relative`,`inline-block`,`rounded-full`,`bg-white`,`dark:bg-gray-50`,`h-4`,`w-4`,`shadow-lg`,`transform`,`transition-transform`,`duration-200`,`ease-in-out`,`pointer-events-none`,`overflow-hidden`],t=this._checked?`translate-x-5`:`translate-x-0.5`;return[...e,t].join(` `)}getIconClasses(){return[`absolute`,`inset-0`,`flex`,`items-center`,`justify-center`,`pointer-events-none`].join(` `)}render(){let e=this.isLoading(),t=this.getSwitchClasses(),n=this.getThumbClasses(),r=this.getLabel(),i=this.getInfo(),a=this.getIcon(),o=this.getAttribute(`id`)||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute(`id`)||this.setAttribute(`id`,o);let s=this._getSwitchContainer();this._button?this._button.parentElement!==s&&s.appendChild(this._button):(this._button=document.createElement(`button`),s.appendChild(this._button),this.setupEventListeners());let c=s.querySelector(`.mint-switch-label`);r?(c||(c=document.createElement(`label`),c.className=`mint-switch-label cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,this._button&&this._button.parentElement===s?s.insertBefore(c,this._button.nextSibling):s.appendChild(c)),c.textContent=r,c.setAttribute(`for`,o),this.isDisabled()?(c.classList.add(`opacity-40`,`cursor-not-allowed`),c.classList.remove(`cursor-pointer`)):(c.classList.remove(`opacity-40`,`cursor-not-allowed`),c.classList.add(`cursor-pointer`))):c&&c.remove(),this._button.className=t,this._button.disabled=this.isDisabled(),this._button.id=o,this._button.setAttribute(`aria-checked`,String(this._checked)),this._button.setAttribute(`aria-label`,r||`Toggle switch`),this._button.setAttribute(`role`,`switch`),this._button.type=`button`;let l=this._button.querySelector(`span`);l||(l=document.createElement(`span`),this._button.appendChild(l)),l.className=n;let u=l.querySelector(`span`);if(a){let e=u;e||(e=document.createElement(`span`),e.className=this.getIconClasses(),l.appendChild(e));let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a)}else u&&u.remove();let d=this.querySelector(`.mint-switch-info`);i?(d||(d=document.createElement(`span`),d.className=`mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block`,s&&s.parentElement===this?this.insertBefore(d,s.nextSibling):this.appendChild(d)),d.textContent=i,this.isDisabled()?d.classList.add(`opacity-40`):d.classList.remove(`opacity-40`)):d&&d.remove(),this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this._button&&this._button.addEventListener(`click`,this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener(`click`,this.handleToggle.bind(this))}handleToggle(e){if(!this.isDisabled()){this.checked=!this._checked;let e=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(e){let t=this._getSwitchContainer(),n=this.getLabel(),r=this.getInfo(),i=t.querySelector(`.mint-switch-skeleton-container`),a=this.querySelector(`.mint-switch-info-skeleton`);if(e){t.classList.contains(`relative`)||t.classList.add(`relative`),i||(i=document.createElement(`div`),i.className=`mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,t.appendChild(i));let e=i.querySelector(`.mint-switch-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,i.appendChild(e)),n){let e=i.querySelector(`.mint-switch-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,i.appendChild(e))}else{let e=i.querySelector(`.mint-switch-skeleton-label`);e&&e.remove()}i.style.display=`flex`,this._button&&(this._button.style.visibility=`hidden`,this._button.style.pointerEvents=`none`);let o=t.querySelector(`.mint-switch-label`);if(o&&(o.style.visibility=`hidden`,o.style.pointerEvents=`none`),r){a||(a=document.createElement(`div`),a.className=`mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-mint-hover animate-pulse mt-2`,t&&t.parentElement===this?this.insertBefore(a,t.nextSibling):this.appendChild(a)),a.style.display=`block`;let e=this.querySelector(`.mint-switch-info`);e&&(e.style.display=`none`)}else a&&(a.style.display=`none`)}else{i&&(i.style.display=`none`),a&&(a.style.display=`none`),this._button&&(this._button.style.visibility=`visible`,this._button.style.pointerEvents=`auto`);let e=t.querySelector(`.mint-switch-label`);e&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`);let n=this.querySelector(`.mint-switch-info`);n&&(n.style.display=``)}}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-switch-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._button&&(this._button.className=this.getSwitchClasses())}};customElements.get(`mint-switch`)||customElements.define(`mint-switch`,i);var a=class extends HTMLElement{static get observedAttributes(){return[`variant`,`size`,`bold`,`underline`,`strike`,`italic`,`display`,`inline`]}constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(e=>this._userClasses.add(e))}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}getVariant(){return this.getAttribute(`variant`)||`default`}getSize(){return this.getAttribute(`size`)||`regular`}isBold(){return this.getAttribute(`bold`)===`true`}isUnderline(){return this.getAttribute(`underline`)===`true`}isStrike(){return this.getAttribute(`strike`)===`true`}isItalic(){return this.getAttribute(`italic`)===`true`}getDisplay(){return this.getAttribute(`display`)||(this.getAttribute(`inline`)===`true`?`inline-block`:`block`)}getTextClasses(){let e=this.getSize(),t=this.getVariant(),n=document.documentElement.classList.contains(`dark`),r={heading:[`font-semibold`],"sub-heading":[`font-medium`],regular:[]},i={default:n?[`text-gray-100`]:[`text-gray-900`],muted:[`text-gray-400`],danger:n?[`text-red-400`]:[`text-red-600`],success:n?[`text-green-400`]:[`text-green-600`]},a=[];this.isBold()&&a.push(`font-bold`),this.isUnderline()&&a.push(`underline`),this.isStrike()&&a.push(`line-through`),this.isItalic()&&a.push(`italic`);let o=this.getDisplay();return[o===`block`?`block`:o===`inline`?`inline`:`inline-block`,...r[e]||r.regular,...i[t]||i.default,...a].join(` `)}render(){let e=this.getSize(),t=[`text-gray-100`,`text-gray-900`,`text-gray-400`,`text-red-400`,`text-red-600`,`text-green-400`,`text-green-600`],n=[`text-2xl`,`text-lg`,`text-sm`];n.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)}),t.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)});let r=this.getTextClasses().split(` `).filter(e=>e.trim());Array.from(this.classList).forEach(e=>{!t.includes(e)&&!n.includes(e)&&this._userClasses.add(e)}),this.className=[...new Set([...r,...Array.from(this._userClasses)])].join(` `);let i={heading:`clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)`,"sub-heading":`clamp(1rem, 1.5vw + 0.5rem, 1.125rem)`,regular:`clamp(0.875rem, 1vw + 0.5rem, 0.875rem)`},a=i[e]||i.regular;this.style.setProperty(`font-size`,a)}};customElements.get(`mint-text`)||customElements.define(`mint-text`,a);var o=class extends HTMLElement{static get observedAttributes(){return[`direction`,`text-align`,`gap`,`align-content`]}constructor(){super(),this._childObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`text-align`&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{let e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&=(this._childObserver.disconnect(),null)}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`;return parseFloat(e)}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`left`||e===`right`||e===`center`?e:``}getStackClasses(){let e=this.getDirection(),t=this.getTextAlign(),n=this.getGap(),r=this.getAlignContent(),i=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${n}`];return r&&(e===`horizontal`?r===`left`?i.push(`justify-start`):r===`right`?i.push(`justify-end`):i.push(`justify-center`):r===`left`?i.push(`items-start`):r===`right`?i.push(`items-end`):i.push(`items-center`)),t&&(i.push(`text-${t}`),i.push(`[&>*]:text-${t}`),i.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?(i.push(`[&>mint-button]:!justify-start`),i.push(`[&>mint-button>button]:!justify-start`)):t===`right`?(i.push(`[&>mint-button]:!justify-end`),i.push(`[&>mint-button>button]:!justify-end`)):t===`center`&&(i.push(`[&>mint-button]:!justify-center`),i.push(`[&>mint-button>button]:!justify-center`))),i.join(` `)}render(){let e=this.getStackClasses(),t=this.getTextAlign();`flex,flex-row,flex-col,gap-1,gap-2,gap-3,gap-4,gap-5,gap-6,gap-7,gap-8,gap-9,gap-10,gap-11,gap-12,items-start,items-end,items-center,justify-start,justify-end,justify-center,text-left,text-center,text-right,text-justify,[&>*]:text-left,[&>*]:text-center,[&>*]:text-right,[&>*]:text-justify,[&>*_.mint-button-content]:text-left,[&>*_.mint-button-content]:text-center,[&>*_.mint-button-content]:text-right,[&>*_.mint-button-content]:text-justify,[&>mint-button]:!justify-start,[&>mint-button]:!justify-center,[&>mint-button]:!justify-end,[&>mint-button>button]:!justify-start,[&>mint-button>button]:!justify-center,[&>mint-button>button]:!justify-end`.split(`,`).forEach(e=>this.classList.remove(e)),e.split(` `).forEach(e=>{e&&this.classList.add(e)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(t=>{if(t.tagName===`MINT-BUTTON`){let n=t.querySelector(`button`);if(n){n.classList.remove(`justify-start`,`justify-center`,`justify-end`),e===`left`?n.classList.add(`justify-start`):e===`right`?n.classList.add(`justify-end`):e===`center`&&n.classList.add(`justify-center`);let t=n.querySelector(`.mint-button-content`);t&&(t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`))}}else t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(e=>{if(e.tagName===`MINT-BUTTON`){let t=e.querySelector(`button`);if(t){t.classList.remove(`justify-start`,`justify-end`),t.classList.add(`justify-center`);let e=t.querySelector(`.mint-button-content`);e&&e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)}}else e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)})}};customElements.get(`mint-stack`)||customElements.define(`mint-stack`,o);var s=`mint-sortable-placeholder`,c=`mint-sortable-dragging`;function l(e,t,n,r){let i=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${Number.isFinite(n)?Math.min(12,Math.max(1,Math.round(n))):3}`,`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`min-w-0`];return r&&(e===`horizontal`?r===`left`?i.push(`justify-start`):r===`right`?i.push(`justify-end`):i.push(`justify-center`):r===`left`?i.push(`items-start`):r===`right`?i.push(`items-end`):i.push(`items-center`)),t&&(i.push(`text-${t}`),i.push(`[&>*]:text-${t}`),i.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?i.push(`[&>mint-button]:!justify-start`,`[&>mint-button>button]:!justify-start`):t===`right`?i.push(`[&>mint-button]:!justify-end`,`[&>mint-button>button]:!justify-end`):t===`center`&&i.push(`[&>mint-button]:!justify-center`,`[&>mint-button>button]:!justify-center`)),i}var u=class extends HTMLElement{static get observedAttributes(){return[`direction`,`gap`,`text-align`,`align-content`,`scroll-max-height`,`disabled`,`handle-selector`,`scroll-sensitivity`,`scroll-speed`,`animation-duration`,`item-key-attribute`]}constructor(){super(),this._pointerId=null,this._dragEl=null,this._placeholder=null,this._listRoot=this,this._startIndex=0,this._pointerStartX=0,this._pointerStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._scrollRaf=null,this._childObserver=null,this._pointerBoundRoot=null,this._restoreAfter=null,this._onListPointerDown=e=>{let t=e;if(this._isDisabled()||this._pointerId!==null||t.button!==0)return;let n=t.target;if(!n||!this.contains(n))return;let r=this._closestSortableItem(n);if(!r||!this._listRoot.contains(r)||r.hasAttribute(`data-sortable-disabled`))return;let i=this._getHandleSelector();if(i){let e=t.target.closest(i);if(!e||!r.contains(e))return}t.preventDefault(),this._startDrag(t,r)},this._boundPointerMove=this._onPointerMove.bind(this),this._boundPointerUp=this._onPointerUp.bind(this),this._boundPointerCancel=this._onPointerCancel.bind(this)}connectedCallback(){this.classList.add(`relative`,`block`),this._syncInnerStackAttributes(),this._applyHostScrollAndLayout(),this._observeInnerStack()}disconnectedCallback(){this._unobserveInnerStack(),this._teardownDrag(),this._pointerBoundRoot&&=(this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),null)}attributeChangedCallback(e,t,n){t!==n&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}_observeInnerStack(){this._childObserver||(this._childObserver=new MutationObserver(()=>{this._pointerId===null&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}),this._childObserver.observe(this,{childList:!0}))}_unobserveInnerStack(){this._childObserver&&=(this._childObserver.disconnect(),null)}_getInnerStack(){for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-STACK`)return t}return null}_resolveListRoot(){return this._getInnerStack()??this}_getItemKeyAttribute(){return this.getAttribute(`item-key-attribute`)?.trim()||`data-sortable-id`}_collectOrderedKeys(){let e=this._resolveListRoot(),t=this._getItemKeyAttribute(),n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r];if(i.nodeType!==Node.ELEMENT_NODE)continue;let a=i;a.classList.contains(s)||n.push(a.getAttribute(t)??``)}return n}_syncInnerStackAttributes(){let e=this._getInnerStack();if(!e)return;let t=this.getDirection(),n=this.getGap(),r=this.getTextAlign();e.setAttribute(`direction`,t),e.setAttribute(`gap`,String(n)),r?e.setAttribute(`text-align`,r):e.removeAttribute(`text-align`);let i=this.getAlignContent();i?e.setAttribute(`align-content`,i):e.removeAttribute(`align-content`)}_applyHostScrollAndLayout(){this._listRoot=this._resolveListRoot();let e=this.getAttribute(`scroll-max-height`);e?(this.style.maxHeight=e,this.style.overflowY=`auto`,this.style.overflowX=`hidden`,this.classList.add(`overscroll-y-contain`)):(this.style.maxHeight=``,this.style.overflowY=``,this.style.overflowX=``,this.classList.remove(`overscroll-y-contain`));let t=this._getInnerStack();this._stripHostLayoutClasses(),t||l(this.getDirection(),this.getTextAlign(),this.getGap(),this.getAlignContent()).forEach(e=>{e&&this.classList.add(e)}),this._ensureListPointerBinding()}_stripHostLayoutClasses(){Array.from(this.classList).filter(e=>e===`flex`||e===`flex-row`||e===`flex-col`||e.startsWith(`gap-`)||e===`items-start`||e===`items-end`||e===`items-center`||e===`justify-start`||e===`justify-end`||e===`justify-center`||e.startsWith(`text-`)||e.startsWith(`[&`)).forEach(e=>this.classList.remove(e))}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`,t=parseFloat(e);return Number.isFinite(t)?t:3}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`left`||e===`right`||e===`center`?e:``}_isDisabled(){return this.hasAttribute(`disabled`)&&this.getAttribute(`disabled`)!==`false`}_getHandleSelector(){let e=this.getAttribute(`handle-selector`);return e&&e.trim()?e.trim():null}_getScrollSensitivity(){let e=parseFloat(this.getAttribute(`scroll-sensitivity`)||`48`);return Number.isFinite(e)?e:48}_getScrollSpeed(){let e=parseFloat(this.getAttribute(`scroll-speed`)||`12`);return Number.isFinite(e)?e:12}_getAnimationDurationMs(){let e=parseFloat(this.getAttribute(`animation-duration`)||`220`);return Number.isFinite(e)?Math.max(0,e):220}_ensureListPointerBinding(){let e=this._resolveListRoot();this._pointerBoundRoot!==e&&(this._pointerBoundRoot&&this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),e.addEventListener(`pointerdown`,this._onListPointerDown),this._pointerBoundRoot=e,this._listRoot=e)}_closestSortableItem(e){let t=e;for(;t&&t!==this._listRoot;){if(t.nodeType===Node.ELEMENT_NODE){let e=t;if(e.classList.contains(s)||e.classList.contains(c))return null;if(t.parentElement===this._listRoot)return e}t=t.parentElement}return null}_startDrag(e,t){this._listRoot=this._resolveListRoot(),this._restoreAfter=t.nextElementSibling,this._dragEl=t,this._pointerId=e.pointerId,this._startIndex=this._indexOfItem(t);let n=t.getBoundingClientRect();this._pointerStartX=e.clientX,this._pointerStartY=e.clientY,this._dragStartLeft=n.left,this._dragStartTop=n.top;let r=document.createElement(`div`);r.className=[s,`box-border`,`shrink-0`,`rounded-lg`,`border-2`,`border-dashed`,`border-gray-300`,`bg-gray-50/80`,`dark:border-mint-divider`,`dark:bg-mint-hover/40`].join(` `),r.style.minHeight=`${n.height}px`,r.style.minWidth=`${n.width}px`,r.setAttribute(`aria-hidden`,`true`),this._placeholder=r,this._listRoot.insertBefore(r,t),t.classList.add(c),t.style.position=`fixed`,t.style.left=`${n.left}px`,t.style.top=`${n.top}px`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,t.style.margin=`0`,t.style.zIndex=`10000`,t.style.boxSizing=`border-box`,t.style.pointerEvents=`none`,t.style.touchAction=`none`,t.style.willChange=`transform, left, top`,t.setPointerCapture(e.pointerId);let i=this._collectOrderedKeys(),a={index:this._startIndex,keys:i};this.dispatchEvent(new CustomEvent(`mint-sortable-start`,{bubbles:!0,composed:!0,detail:a})),this.dispatchEvent(new CustomEvent(`sort-start`,{bubbles:!0,composed:!0,detail:a})),window.addEventListener(`pointermove`,this._boundPointerMove,{passive:!1}),window.addEventListener(`pointerup`,this._boundPointerUp),window.addEventListener(`pointercancel`,this._boundPointerCancel)}_indexOfItem(e){let t=0;for(let n=0;n<this._listRoot.children.length;n++){let r=this._listRoot.children[n];if(r.nodeType!==Node.ELEMENT_NODE)continue;let i=r;if(!i.classList.contains(s)){if(i===e)return t;t++}}return-1}_getLayoutChildren(){return Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE)}_onPointerMove(e){if(e.pointerId!==this._pointerId||!this._dragEl||!this._placeholder)return;e.preventDefault();let t=e.clientX-this._pointerStartX,n=e.clientY-this._pointerStartY;this._dragEl.style.left=`${this._dragStartLeft+t}px`,this._dragEl.style.top=`${this._dragStartTop+n}px`,this._autoScroll(e),this._maybeMovePlaceholder(e)}_autoScroll(e){let t=this;if(!t.style.maxHeight)return;let n=this._getScrollSensitivity(),r=this._getScrollSpeed(),i=t.getBoundingClientRect();this._scrollRaf!==null&&cancelAnimationFrame(this._scrollRaf),this._scrollRaf=requestAnimationFrame(()=>{this._scrollRaf=null;let a=0;e.clientY<i.top+n?a=-r:e.clientY>i.bottom-n&&(a=r),a!==0&&(t.scrollTop+=a,this._maybeMovePlaceholder(e))})}_maybeMovePlaceholder(e){let t=this._placeholder,n=this._dragEl;if(!t||!n)return;let r=this.getDirection()===`horizontal`,i=r?e.clientX:e.clientY,a=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n&&e!==t),o=null;for(let e of a){let t=e.getBoundingClientRect();if(i<(r?t.left+t.width/2:t.top+t.height/2)){o=e;break}}let s=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n),c=s.length>0&&s[s.length-1]===t;(o?!(t.nextSibling===o&&t.parentNode===this._listRoot):!c)&&this._flipAnimate(()=>{o?this._listRoot.insertBefore(t,o):this._listRoot.appendChild(t)})}_flipAnimate(e){let t=this._dragEl,n=this._getAnimationDurationMs(),r=this._getLayoutChildren().filter(e=>e!==t),i=new Map;r.forEach(e=>i.set(e,e.getBoundingClientRect())),e(),!(n<=0)&&r.forEach(e=>{let t=i.get(e);if(!t)return;let r=e.getBoundingClientRect(),a=t.left-r.left,o=t.top-r.top;Math.abs(a)<.5&&Math.abs(o)<.5||(e.style.transition=`none`,e.style.transform=`translate(${a}px, ${o}px)`,requestAnimationFrame(()=>{e.style.transition=`transform ${n}ms cubic-bezier(0.2, 0.8, 0.2, 1)`,e.style.transform=``;let t=()=>{e.removeEventListener(`transitionend`,t),e.style.transition=``,e.style.transform=``};e.addEventListener(`transitionend`,t,{once:!0}),setTimeout(t,n+40)}))})}_onPointerUp(e){e.pointerId===this._pointerId&&this._finishDrag(!1)}_onPointerCancel(e){e.pointerId===this._pointerId&&this._finishDrag(!0)}_finishDrag(e){let t=this._dragEl,n=this._placeholder;if(!t||this._pointerId===null){this._teardownDrag();return}try{t.releasePointerCapture(this._pointerId)}catch{}if(window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),e){let e=this._restoreAfter;e&&e.parentNode===this._listRoot?this._listRoot.insertBefore(t,e):this._listRoot.appendChild(t)}else n?.parentNode&&this._listRoot.insertBefore(t,n);n?.remove(),this._placeholder=null,t.classList.remove(c),t.style.cssText=``;let r=this._indexOfItem(t),i=this._startIndex;this._pointerId=null,this._dragEl=null,this._restoreAfter=null;let a=this._collectOrderedKeys(),o={oldIndex:i,newIndex:r,cancelled:e,keys:a};this.dispatchEvent(new CustomEvent(`mint-sortable-end`,{bubbles:!0,composed:!0,detail:o})),this.dispatchEvent(new CustomEvent(`sort-stop`,{bubbles:!0,composed:!0,detail:o})),!e&&r!==i&&(this.dispatchEvent(new CustomEvent(`mint-sortable-change`,{bubbles:!0,composed:!0,detail:{oldIndex:i,newIndex:r,keys:a}})),this.dispatchEvent(new CustomEvent(`mint-sortable-order`,{bubbles:!0,composed:!0,detail:{keys:a}})))}_teardownDrag(){if(this._scrollRaf!==null&&(cancelAnimationFrame(this._scrollRaf),this._scrollRaf=null),window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),this._dragEl){try{this._pointerId!==null&&this._dragEl.releasePointerCapture(this._pointerId)}catch{}this._dragEl.classList.remove(c),this._dragEl.style.cssText=``}this._placeholder?.remove(),this._placeholder=null,this._dragEl=null,this._pointerId=null,this._restoreAfter=null}};customElements.get(`mint-sortable`)||customElements.define(`mint-sortable`,u);var d=class extends HTMLElement{static get observedAttributes(){return[`heading`]}constructor(){super(),this._headingElement=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}hasPaddingClass(){return Array.from(this.classList).some(e=>/^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e))}render(){this.classList.add(`rounded-lg`,`shadow`,`bg-white`,`dark:bg-mint-elevated`,`border`,`border-gray-200`,`dark:border-mint-divider`),this.hasPaddingClass()||this.classList.add(`p-4`);let e=this.getHeading();e?(this._headingElement||(this._headingElement=document.createElement(`mint-text`),this._headingElement.setAttribute(`size`,`sub-heading`),this.insertBefore(this._headingElement,this.firstChild)),this._headingElement.textContent=e):this._headingElement&&this._headingElement.parentNode&&(this._headingElement.remove(),this._headingElement=null)}};customElements.get(`mint-card`)||customElements.define(`mint-card`,d);var f=class extends HTMLElement{static get observedAttributes(){return[`href`,`target`]}constructor(){super(),this._link=null,this._contentObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._observeContent()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHref(){return this.getAttribute(`href`)||`#`}getTarget(){return this.getAttribute(`target`)||``}hasIcon(){return!!(this.querySelector(`mint-icon`)||this._link?.querySelector(`mint-icon`))}render(){let e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement(`a`);this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t===`_blank`&&(this._link.rel=`noopener noreferrer`)):(this._link.removeAttribute(`target`),this._link.removeAttribute(`rel`));let n=this.hasIcon(),r=[`text-slate-800`,`dark:text-slate-200`,`underline`,`hover:text-slate-950`,`dark:hover:text-slate-100`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`rounded`];n&&r.push(`inline-flex`,`items-center`,`gap-2`),this._link.className=r.join(` `),this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)})}};customElements.get(`mint-link`)||customElements.define(`mint-link`,f);var p=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._button=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`,`flex`,`items-center`,`justify-center`),this.render()}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this.render()}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}_getTargetUrl(){let e=document.referrer,t=window.location.origin;if(e)try{let n=new URL(e);if(n.origin===t)return n.pathname+n.search}catch{}return this.getFallbackHref()}handleClick(e){e.preventDefault(),e.stopPropagation();let t=this._getTargetUrl(),n=document.referrer,r=n&&(()=>{try{return new URL(n).origin===window.location.origin}catch{return!1}})(),i=new CustomEvent(`back`,{detail:{url:t,isFromReferrer:r,referrer:n||null,fallbackHref:this.getFallbackHref()},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};customElements.get(`mint-back-button`)||customElements.define(`mint-back-button`,p);var m=class extends HTMLElement{static get observedAttributes(){return[`heading`,`fallback-href`,`show-back-button`,`containered`]}constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null,this._contentObserver=null,this._backButton=null,this._backButtonHandler=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this._observeDarkMode(),this._observeContentMutations(),this._setupBackButtonListener()}attributeChangedCallback(e,t,n){t!==n&&(e===`containered`&&this._applyContainerClasses(),this.render())}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._removeBackButtonListener()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}render(){let e=this.getHeading();this._pageContainer||(this._pageContainer=document.createElement(`div`),this.appendChild(this._pageContainer)),this._applyContainerClasses(),this._header||(this._header=document.createElement(`div`),this._header.className=`flex justify-between mb-8`,this._pageContainer.appendChild(this._header)),this._titleElement||(this._titleElement=document.createElement(`div`),this._titleElement.className=`flex gap-4 min-w-0 flex-1`,this._header.appendChild(this._titleElement));let t=this._titleElement.querySelector(`mint-back-button`);if(this.shouldShowBackButton()){t||(t=document.createElement(`mint-back-button`),this._titleElement.insertBefore(t,this._titleElement.firstChild));let e=this.getFallbackHref();t.setAttribute(`fallback-href`,e),this._backButton=t}else t&&(t.remove(),t=null,this._backButton=null);e?(this._headingText?(this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._headingText.previousSibling!==t&&this._titleElement.insertBefore(this._headingText,t.nextSibling):this._headingText.previousSibling&&this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)):(this._headingText=document.createElement(`mint-text`),this._headingText.setAttribute(`size`,`heading`),this._headingText.setAttribute(`bold`,`true`),this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,t.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=e):this._headingText&&=(this._headingText.remove(),null),this._actionsSlot?this._actionsSlot.classList.contains(`ml-4`)||this._actionsSlot.classList.add(`ml-4`):(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`flex gap-2 items-center ml-4`,this._actionsSlot.setAttribute(`slot`,`actions`),this._header.appendChild(this._actionsSlot)),Array.from(this.children).filter(e=>e!==this._pageContainer&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{this._actionsSlot&&e.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(e)}),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(e=>{e!==this._pageContainer&&e.getAttribute(`slot`)!==`actions`&&e!==this._actionsSlot&&e!==this._header&&e!==this._bodySlot&&e!==this._headingText&&e.parentElement!==this._bodySlot&&e.parentElement!==this._pageContainer&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add(`p-5`),this.getAttribute(`containered`)===`true`?this._pageContainer.classList.add(`max-w-6xl`,`mx-auto`,`w-full`):this._pageContainer.classList.remove(`max-w-6xl`,`mx-auto`,`w-full`))}_updateBackgroundColor(){this._pageContainer&&(document.documentElement.classList.contains(`dark`)?(this._pageContainer.classList.remove(`bg-gray-20`),this._pageContainer.classList.add(`bg-mint-canvas`)):(this._pageContainer.classList.remove(`bg-mint-canvas`),this._pageContainer.classList.add(`bg-gray-20`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_setupBackButtonListener(){this._backButtonHandler||=e=>{let t=e.target;if(t&&t.tagName===`MINT-BACK-BUTTON`){e.stopPropagation();let t=new CustomEvent(`back`,{detail:e.detail,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t)}},this.addEventListener(`back`,this._backButtonHandler,!0)}_removeBackButtonListener(){this._backButtonHandler&&=(this.removeEventListener(`back`,this._backButtonHandler,!0),null)}};customElements.get(`mint-page`)||customElements.define(`mint-page`,m);var h=class extends HTMLElement{static get observedAttributes(){return[`columns`,`sm`,`md`,`lg`,`xl`,`gap`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getColumns(){return this.getAttribute(`columns`)||`1`}getSm(){return this.getAttribute(`sm`)}getMd(){return this.getAttribute(`md`)}getLg(){return this.getAttribute(`lg`)}getXl(){return this.getAttribute(`xl`)}getGap(){return`3`}getGridClasses(){let e=[`grid`],t=this.getColumns();e.push(`grid-cols-${t}`);let n=this.getSm();n&&e.push(`sm:grid-cols-${n}`);let r=this.getMd();r&&e.push(`md:grid-cols-${r}`);let i=this.getLg();i&&e.push(`lg:grid-cols-${i}`);let a=this.getXl();a&&e.push(`xl:grid-cols-${a}`);let o=this.getGap();return e.push(`gap-${o}`),e}render(){Array.from(this.classList).filter(e=>e.startsWith(`grid-cols-`)||e.startsWith(`sm:grid-cols-`)||e.startsWith(`md:grid-cols-`)||e.startsWith(`lg:grid-cols-`)||e.startsWith(`xl:grid-cols-`)||e.startsWith(`gap-`)).forEach(e=>this.classList.remove(e)),this.classList.contains(`grid`)||this.classList.add(`grid`),this.getGridClasses().forEach(e=>{e&&e!==`grid`&&this.classList.add(e)})}};customElements.get(`mint-grid`)||customElements.define(`mint-grid`,h);var g=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null,this._contentObserver=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`inset-0`,`z-[120]`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._observeDarkMode(),this._observeContentMutations()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`fixed inset-0 bg-black/50 transition-opacity duration-200 z-[120]`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-[130]`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transform`,this._modal.appendChild(e)),this._animateEnter()}else this._animateExit();let r=this._modal.querySelector(`.modal-content`);r||(r=document.createElement(`div`),r.className=`modal-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transform`,this._modal.appendChild(r)),this._header||(this._header=document.createElement(`div`),this._header.className=`flex items-center justify-between p-4 border-b border-gray-200 dark:border-mint-divider`,r.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`flex-1`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let i=this._headingSlot.querySelector(`mint-text`);t?(i||(i=document.createElement(`mint-text`),i.setAttribute(`size`,`sub-heading`),i.setAttribute(`bold`,`true`),this._headingSlot.appendChild(i)),i.textContent=t):i&&i.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-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=`flex-1 overflow-y-auto p-4`,this._bodySlot.setAttribute(`slot`,`body`),r.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),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`),r.appendChild(this._actionsSlot));let a=this._actionsSlot.querySelector(`mint-stack`);a||(a=document.createElement(`mint-stack`),a.setAttribute(`direction`,`horizontal`),a.className=`justify-end`,this._actionsSlot.appendChild(a)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==a&&a.appendChild(e)}),e.parentElement&&e.remove()}),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;let e=document.documentElement.classList.contains(`dark`),t=this._modal.querySelector(`.modal-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-mint-elevated`,`border`,`border-mint-divider`)):(t.classList.remove(`bg-mint-elevated`,`border`,`border-mint-divider`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,this.classList.remove(`hidden`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})}))}_animateExit(){let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`hidden`);return}e.style.transition=`opacity 200ms ease-in, transform 200ms ease-in`,e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,setTimeout(()=>{this.classList.add(`hidden`),e.style.transform=``,e.style.opacity=``,e.style.transition=``},200)}};customElements.get(`mint-modal`)||customElements.define(`mint-modal`,g);var _=class extends HTMLElement{static get observedAttributes(){return[`id`,`direction`,`open`,`trigger-id`,`padding`,`hover`,`distance`]}constructor(){super(),this._overlay=null,this._popover=null,this._triggerElement=null,this._darkModeObserver=null,this._clickOutsideHandler=null,this._triggerClickHandler=null,this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._hoverCloseTimeout=null,this._scrollHandler=null,this._resizeHandler=null}connectedCallback(){let e=this._isInsideModal()?`z-[60]`:`z-50`;this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`top-0`,`left-0`,e,`pointer-events-none`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._setupTrigger(),this._observeDarkMode()}_ownsNode(e){return e?!!(this.contains(e)||this._triggerElement?.contains(e)):!1}_isInsideModal(){let e=this;for(;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}if(this._triggerElement)for(e=this._triggerElement;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}return!1}disconnectedCallback(){this._removeHoverListeners(),this._overlay?.remove(),this._popover?.remove(),this._overlay=null,this._popover=null,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&this._triggerElement.removeAttribute(`active`),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}attributeChangedCallback(e,t,n){if(t!==n){if(this.isConnected){let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this.classList.remove(`z-50`,`z-[60]`,`z-[80]`),this.classList.add(e)}this.render(),(e===`trigger-id`||e===`hover`)&&this._setupTrigger(),e===`open`&&this.isOpen()&&this._closeOtherPopovers()}}getId(){return this.getAttribute(`id`)||``}getPadding(){let e=this.getAttribute(`padding`)||`4`;return{0:`p-0`,"0.5":`p-0.5`,1:`p-1`,"1.5":`p-1.5`,2:`p-2`,"2.5":`p-2.5`,3:`p-3`,"3.5":`p-3.5`,4:`p-4`,5:`p-5`,6:`p-6`,8:`p-8`,10:`p-10`,12:`p-12`,16:`p-16`,20:`p-20`,24:`p-24`}[e]||`p-4`}getDirection(){return this.getAttribute(`direction`)||`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}getDistance(){return(this.getAttribute(`distance`)||``).trim()}_getDistancePx(){let e=this.getDistance();if(!e)return 8;let t=e.match(/^(-?\d*\.?\d+)\s*(px|rem)$/i);if(!t)return 8;let n=parseFloat(t[1]),r=t[2].toLowerCase();if(!Number.isFinite(n))return 8;let i=Math.max(0,n);if(r===`px`)return i;let a=parseFloat(getComputedStyle(document.documentElement).fontSize||`16`);return i*(Number.isFinite(a)?a:16)}isHoverEnabled(){return this.getAttribute(`hover`)===`true`}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_setupTrigger(){let e=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),e&&(this._triggerElement=document.getElementById(e),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(e),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){let e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.getAttribute(`open`)===`true`?e.removeAttribute(`open`):e.setAttribute(`open`,`true`)},this._triggerElement.addEventListener(`click`,this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();let e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._triggerElement.addEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement.addEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){e._cancelHoverClose()},this._popoverHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._popover.addEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover.addEventListener(`mouseleave`,this._popoverHoverLeaveHandler))}_removeHoverListeners(){this._triggerElement&&this._triggerHoverEnterHandler&&this._triggerElement.removeEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement&&this._triggerHoverLeaveHandler&&this._triggerElement.removeEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&this._popoverHoverEnterHandler&&this._popover.removeEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover&&this._popoverHoverLeaveHandler&&this._popover.removeEventListener(`mouseleave`,this._popoverHoverLeaveHandler),this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._cancelHoverClose()}_scheduleHoverClose(){this._cancelHoverClose(),this._hoverCloseTimeout=window.setTimeout(()=>{this._isHovering()||this.close()},120)}_cancelHoverClose(){this._hoverCloseTimeout!==null&&(clearTimeout(this._hoverCloseTimeout),this._hoverCloseTimeout=null)}_isHovering(){let e=this._triggerElement?this._triggerElement.matches(`:hover`):!1,t=this._popover?this._popover.matches(`:hover`):!1;return e||t}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:`down`};let e=this._triggerElement.getBoundingClientRect(),t=this._popover.querySelector(`.popover-content`);if(!t)return{top:0,left:0,direction:`down`};this.classList.contains(`hidden`)&&(this.classList.remove(`hidden`),this._popover.style.visibility=`hidden`);let n=t.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=this._getDistancePx(),o=this.getDirection(),s=0,c=0;switch(o){case`down`:if(s=e.bottom+a,c=e.left+e.width/2-n.width/2,s+n.height>i){let t=e.top-n.height-a;t>=0?(o=`up`,s=t):(s=Math.max(0,i-n.height-a),s+n.height>i&&(s=0))}c<0&&(c=a),c+n.width>r&&(c=Math.max(a,r-n.width-a),c+n.width>r&&(c=r-n.width));break;case`up`:if(s=e.top-n.height-a,c=e.left+e.width/2-n.width/2,s<0){let t=e.bottom+a;t+n.height<=i?(o=`down`,s=t):(s=Math.min(i-n.height-a,i-n.height),s<0&&(s=i-n.height))}c<0&&(c=a),c+n.width>r&&(c=Math.max(a,r-n.width-a),c+n.width>r&&(c=r-n.width));break;case`right`:if(s=e.top+e.height/2-n.height/2,c=e.right+a,c+n.width>r){let t=e.left-n.width-a;t>=0?(o=`left`,c=t):(c=Math.max(0,r-n.width-a),c+n.width>r&&(c=r-n.width))}s<0&&(s=a),s+n.height>i&&(s=Math.max(a,i-n.height-a),s+n.height>i&&(s=i-n.height));break;case`left`:if(s=e.top+e.height/2-n.height/2,c=e.left-n.width-a,c<0){let t=e.right+a;t+n.width<=r?(o=`right`,c=t):(c=Math.min(r-n.width-a,r-n.width),c<0&&(c=0))}s<0&&(s=a),s+n.height>i&&(s=Math.max(a,i-n.height-a),s+n.height>i&&(s=i-n.height));break}return{top:s,left:c,direction:o}}render(){let e=this.getId(),t=this.isOpen(),n=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove(`hidden`),this.style.pointerEvents=`auto`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.setAttribute(`active`,`true`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),!this._clickOutsideHandler){let e=this;this._clickOutsideHandler=function(t){let n=t.composedPath(),r=n.some(t=>t===e?!0:t instanceof Node?e._ownsNode(t):!1);if(!(e._triggerElement&&n.includes(e._triggerElement))&&!r){e.close();return}},setTimeout(()=>{document.addEventListener(`click`,this._clickOutsideHandler,!1)},100)}}else this.classList.add(`hidden`),this.style.pointerEvents=`none`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.removeAttribute(`active`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null);if(this._overlay){let e=this._isInsideModal()?`z-[75]`:`z-[55]`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this._overlay.parentElement!==this&&this.appendChild(this._overlay)}else{this._overlay=document.createElement(`div`);let e=this._isInsideModal()?`z-[75]`:`z-[55]`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this.appendChild(this._overlay)}if(this._popover){let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this._popover.className=`fixed ${e} pointer-events-auto`,this._popover.parentElement!==this&&this.appendChild(this._popover)}else{this._popover=document.createElement(`div`);let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this._popover.className=`fixed ${e} pointer-events-auto`,this.appendChild(this._popover)}this.isHoverEnabled()&&this._attachHoverListeners();let r=this._popover.querySelector(`.popover-content`);if(!r)r=document.createElement(`div`),r.className=`popover-content bg-white dark:bg-mint-elevated border border-gray-200 dark:border-mint-divider rounded-lg shadow-xl ${n} transform`,this._popover.appendChild(r);else{let e=r.className.split(/\s+/).filter(Boolean),t=[`p-0`,`p-0.5`,`p-1`,`p-1.5`,`p-2`,`p-2.5`,`p-3`,`p-3.5`,`p-4`,`p-5`,`p-6`,`p-8`,`p-10`,`p-12`,`p-16`,`p-20`,`p-24`],i=e.filter(e=>!t.includes(e)),a=[`border`,`border-gray-200`,`dark:border-mint-divider`],o=[...i];for(let e of a)o.includes(e)||o.push(e);r.className=[...o,n].join(` `)}Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._popover&&e.parentElement===this&&r.appendChild(e)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(r):(this._popover.style.top=`50%`,this._popover.style.left=`50%`,this._popover.style.transform=`translate(-50%, -50%)`,this._popover.style.visibility=`visible`,this._popover.style.display=`block`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,r.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.transform=`scale(1) translateY(0)`,r.style.opacity=`1`})}))):!t&&r&&(this._removePositionListeners(),r.style.opacity!==`0`&&r.style.opacity!==``&&(r.style.transition=`opacity 200ms ease-in, transform 200ms ease-in`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,setTimeout(()=>{r.style.transform=``,r.style.opacity=``,r.style.transition=``,this._popover.style.visibility=``,this._popover.style.display=``},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;let e=document.documentElement.classList.contains(`dark`),t=this._popover.querySelector(`.popover-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-mint-elevated`)):(t.classList.remove(`bg-mint-elevated`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_updatePosition(e){if(!this._triggerElement||!this._popover)return;let t=this._popover.style.visibility!==`hidden`;t||(this._popover.style.visibility=`hidden`,this._popover.style.display=`block`,this._popover.style.top=`0`,this._popover.style.left=`0`),this._popover.offsetHeight;let n=this._calculatePosition();this._popover.style.top=`${n.top}px`,this._popover.style.left=`${n.left}px`,t||(this._popover.style.visibility=`visible`,e&&(!e.style.opacity||e.style.opacity===``)&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){let e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`scroll`,this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){let e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`resize`,this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_closeOtherPopovers(){Array.from(document.querySelectorAll(`mint-popover[open]`)).forEach(e=>{if(e!==this){let t=e;typeof t.close==`function`?t.close():e.removeAttribute(`open`)}})}};customElements.get(`mint-popover`)||customElements.define(`mint-popover`,_);var v=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`error`,`error-message`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null,this._changeHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-flex`,`items-start`,`gap-2`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render(),e===`checked`&&this._checkbox&&this.updateVisualState()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`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`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getCheckboxClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`justify-center`,`flex-shrink-0`,`w-5`,`h-5`,`rounded`,`border-2`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`cursor-pointer`,`disabled:opacity-40`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-neutral-800`,`dark:bg-neutral-600`,e?`border-red-300 dark:border-red-300`:`border-neutral-800 dark:border-neutral-600`]:[`bg-white`,`dark:bg-mint-elevated`,e?`border-red-300 dark:border-red-300`:`border-gray-300 dark:border-gray-500`];return[...t,...n].join(` `)}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-container`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-container relative inline-flex items-start gap-2`,this.insertBefore(i,this.firstChild));let a=this.querySelector(`.mint-checkbox-wrapper`);a?a.parentElement!==i&&i.appendChild(a):(a=document.createElement(`div`),a.className=`mint-checkbox-wrapper`,i.appendChild(a)),this._checkbox?this._checkbox.parentElement!==a&&a.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,a.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,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 o=this.getId();o?this._checkbox.id=o:this._checkbox.removeAttribute(`id`);let s=this.getName();s?this._checkbox.name=s:this._checkbox.removeAttribute(`name`);let c=this.getValue();c?this._checkbox.value=c:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),a.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,a.style.cursor=`pointer`,a.style.pointerEvents=`auto`,this._checkbox.style.pointerEvents=`auto`;let l=a;l._wrapperClickHandler||(l._wrapperClickHandler=e=>{e.target===a&&!r&&(e.preventDefault(),e.stopPropagation(),this.toggle())},a.addEventListener(`click`,l._wrapperClickHandler));let u=a.querySelector(`mint-icon`);u||(u=document.createElement(`mint-icon`),u.setAttribute(`name`,`check`),u.className=`w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto`,u.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,u.style.zIndex=`1`,a.appendChild(u)),this.updateVisualState();let d=this.querySelector(`.mint-checkbox-label-container`),f=this.querySelector(`.mint-checkbox-container`);if(t||n){d?f&&d.parentElement!==f&&f.appendChild(d):(d=document.createElement(`div`),d.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,f?f.appendChild(d):this.appendChild(d));let e=d.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none`,d.insertBefore(e,d.firstChild)),e.textContent=t,r?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let i=d.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none`,d.appendChild(i)),i.textContent=n,r?i.classList.add(`opacity-40`):i.classList.remove(`opacity-40`)):i&&i.remove(),r)d.style.cursor=`default`,d._clickHandler&&(d.removeEventListener(`click`,d._clickHandler),d._clickHandler=null);else{d.style.cursor=`pointer`;let e=d._clickHandler;e&&d.removeEventListener(`click`,e),d._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},d.addEventListener(`click`,d._clickHandler)}}else d&&d.remove();this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState();let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0}));let n=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(n)},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=`rgb(38 38 38)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(64 64 64)`:t.style.backgroundColor=`rgb(48 48 48)`))},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._focusHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(`:focus-visible`)&&t?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{let e=this.querySelector(`.mint-checkbox-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._checkbox.addEventListener(`focus`,this._focusHandler),this._checkbox.addEventListener(`blur`,this._blurHandler),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=`rgb(38 38 38)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(64 64 64)`:t.style.backgroundColor=`rgb(48 48 48)`))},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),this._focusHandler&&=(this._checkbox.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._checkbox.removeEventListener(`blur`,this._blurHandler),null));let e=this.querySelector(`.mint-checkbox-wrapper`);if(e){let t=e;t._wrapperClickHandler&&=(e.removeEventListener(`click`,t._wrapperClickHandler),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.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState(),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0}));let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}_renderSkeleton(e){let t=this.querySelector(`.mint-checkbox-skeleton-container`),n=this.querySelector(`.mint-checkbox-container`),r=this.querySelector(`.mint-checkbox-wrapper`),i=this.querySelector(`.mint-checkbox-label-container`);if(e){t||(t=document.createElement(`div`),t.className=`mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-checkbox-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e)),i){let e=t.querySelector(`.mint-checkbox-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e))}t.style.display=`flex`,r&&(r.style.visibility=`hidden`,r.style.pointerEvents=`none`),i&&(i.style.visibility=`hidden`,i.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.visibility=`visible`,r.style.pointerEvents=`auto`),i&&(i.style.visibility=`visible`,i.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-checkbox-label-container`);!n&&e&&t&&(n=document.createElement(`div`),n.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,this.appendChild(n));let r=this.querySelector(`.mint-checkbox-error`);e&&t?(r?(r.classList.add(`block`,`w-full`),r.style.display=`block`,(n&&r.parentElement!==n||n&&r.parentElement===n)&&n.appendChild(r)):(r=document.createElement(`div`),r.className=`mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full`,r.style.display=`block`,n?n.appendChild(r):this.appendChild(r)),r.textContent=t):r&&r.remove();let i=this.querySelector(`.mint-checkbox-wrapper`);i&&(i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`)}};customElements.get(`mint-checkbox`)||customElements.define(`mint-checkbox`,v);var y=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`,`loading`,`info`]}constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._clickHandler=null,this._focusHandler=null,this._blurHandler=null,this._keydownHandler=null}connectedCallback(){this.classList.add(`inline-flex`,`items-start`,`gap-2`,`cursor-pointer`,`select-none`);let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render(),this._setupClickHandler()}disconnectedCallback(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null),this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._focusHandler&&=(this._radio.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._radio.removeEventListener(`blur`,this._blurHandler),null),this._keydownHandler&&=(this._radio.removeEventListener(`keydown`,this._keydownHandler),null))}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._radio&&(this._radio.checked=this._checked),this._updateVisualState()),t!==n){if(e===`loading`){this.render();return}if(e===`info`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{this._checked=!!e,e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._radio&&(this._radio.checked=this._checked),this.isConnected?requestAnimationFrame(()=>{this._updateVisualState()}):this._updateVisualState()}catch{}}getValue(){return this.getAttribute(`value`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){let e=this.getAttribute(`disabled`)===`true`,t=this.closest(`mint-choice`)?.getAttribute(`disabled`)===`true`;return e||t}_setupClickHandler(){this._clickHandler||(this._clickHandler=e=>{e.target!==this._radio&&(this.isDisabled()||this._radio&&(this._radio.click(),requestAnimationFrame(()=>{if(this._radio&&this._radio.checked!==this._checked){this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let e=this.closest(`mint-choice`);e&&e.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))}})))},this.addEventListener(`click`,this._clickHandler))}render(){let e=this.isLoading(),t=this.isDisabled(),n=this.getValue(),r=this.closest(`mint-choice`)?.getAttribute(`name`)||``,i=``,a=this.querySelector(`.mint-choice-option-label`);if(a)i=a.textContent?.trim()||``;else{let e=this.querySelector(`.mint-choice-option-label-container`);Array.from(this.childNodes).forEach(t=>{if(t!==e&&t.nodeType===Node.TEXT_NODE){let e=t.textContent?.trim();e&&(i+=e)}})}let o=this.querySelectorAll(`.mint-choice-option-wrapper`),s=null;o.length>0&&(this._radio&&(s=Array.from(o).find(e=>e.contains(this._radio))),s||=o[0],o.forEach((e,t)=>{e!==s&&e.remove()})),s||(s=document.createElement(`div`),s.className=`mint-choice-option-wrapper`,s.style.position=`relative`,this.insertBefore(s,this.firstChild)),s.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`,s.style.position=`relative`,this.querySelectorAll(`input[type="radio"]`).forEach(e=>{e!==this._radio&&e.remove()}),this._radio?(this._radio.parentElement!==s&&s.appendChild(this._radio),this._radio&&this._changeHandler&&(this._radio.removeEventListener(`change`,this._changeHandler),this._radio.addEventListener(`change`,this._changeHandler)),this._radio&&(this._focusHandler||=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._blurHandler||=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._keydownHandler||=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.removeEventListener(`focus`,this._focusHandler),this._radio.removeEventListener(`blur`,this._blurHandler),this._radio.removeEventListener(`keydown`,this._keydownHandler),this._radio.addEventListener(`focus`,this._focusHandler),this._radio.addEventListener(`blur`,this._blurHandler),this._radio.addEventListener(`keydown`,this._keydownHandler))):(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`sr-only`,this._radio.style.position=`absolute`,this._radio.style.width=`1px`,this._radio.style.height=`1px`,this._radio.style.padding=`0`,this._radio.style.margin=`-1px`,this._radio.style.overflow=`hidden`,this._radio.style.clip=`rect(0, 0, 0, 0)`,this._radio.style.whiteSpace=`nowrap`,this._radio.style.border=`0`,s.appendChild(this._radio),this._changeHandler=e=>{let t=this._checked;this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let n=this.closest(`mint-choice`);t!==this._checked&&n&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))},0)},this._radio.addEventListener(`change`,this._changeHandler),this._radio.addEventListener(`click`,()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState())}),this._focusHandler=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`focus`,this._focusHandler),this._blurHandler=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`blur`,this._blurHandler),this._keydownHandler=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.addEventListener(`keydown`,this._keydownHandler)),this._radio.name=r,this._radio.value=n,this._radio.checked===this._checked?this._radio.checked=this._checked:(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`)),this._radio.disabled=t,t?this._radio.setAttribute(`tabindex`,`-1`):this._radio.removeAttribute(`tabindex`),i?this._radio.setAttribute(`aria-label`,i):this._radio.removeAttribute(`aria-label`),s.querySelectorAll(`.mint-choice-option-indicator`).forEach((e,t)=>{t>0&&e.remove()});let c=s.querySelector(`.mint-choice-option-indicator`);c||(c=document.createElement(`div`),c.className=`mint-choice-option-indicator`,s.appendChild(c)),c.className=`mint-choice-option-indicator w-2 h-2 rounded-full bg-white pointer-events-none`,c.style.position=`absolute`,c.style.top=`50%`,c.style.left=`50%`,c.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`,c.style.opacity=this._checked?`1`:`0`,this._updateVisualState(),this._renderSkeleton(e);let l=this.getInfo(),u=this.querySelector(`.mint-choice-option-label-container`);if(i||l){u||(u=document.createElement(`div`),u.className=`mint-choice-option-label-container flex flex-col gap-0.5`,this.appendChild(u),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.textContent?.trim()&&e!==u&&(e.textContent=``)}));let e=u.querySelector(`.mint-choice-option-label`);i?(e||(e=document.createElement(`span`),e.className=`mint-choice-option-label`,u.appendChild(e)),e.className=`mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t?`opacity-40`:``}`,e.textContent=i):e&&e.remove();let n=u.querySelector(`.mint-choice-option-info`);l?(n||(n=document.createElement(`span`),n.className=`mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none`,u.appendChild(n)),n.textContent=l,t?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else u&&u.remove();t?(this.classList.add(`cursor-not-allowed`),this.classList.remove(`cursor-pointer`)):(this.classList.add(`cursor-pointer`),this.classList.remove(`cursor-not-allowed`)),this._updateVisualState()}_getWrapperClasses(){let e=this.isDisabled(),t=[`inline-flex`,`items-center`,`justify-center`,`w-[1rem]`,`h-[1rem]`,`rounded-full`,`border-2`,`flex-shrink-0`,`mt-0.5`];return e&&t.push(`opacity-40`,`cursor-not-allowed`),this._checked?t.push(`bg-slate-800`,`dark:bg-slate-600`,`border-slate-800`,`dark:border-slate-600`):t.push(`bg-white`,`dark:bg-mint-elevated`,`border-gray-300`,`dark:border-gray-500`),t.join(` `)}_updateVisualState(){let e=this.querySelector(`.mint-choice-option-wrapper`);e&&(e.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`);let t=this.querySelector(`.mint-choice-option-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-option-skeleton-container`),n=this.querySelector(`.mint-choice-option-wrapper`);if(e){t||(t=document.createElement(`div`),t.className=`mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-choice-option-skeleton-radio`);if(e||(e=document.createElement(`div`),e.className=`mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e)),t.style.display=`flex`,n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`hidden`),t&&(t.style.visibility=`hidden`),n.style.pointerEvents=`none`}}else{if(t&&(t.style.display=`none`),n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`visible`),t&&(t.style.visibility=`visible`),n.style.pointerEvents=`auto`}let e=this.querySelector(`.mint-choice-option-label`);e&&!n?.contains(e)&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`)}}_updateGroupState(){this._radio?.name&&document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`).forEach(e=>{if(e===this._radio)return;let t=e.closest(`mint-choice-option`);t&&t!==this&&(t._checked=e.checked,e.checked?t.setAttribute(`checked`,`true`):t.removeAttribute(`checked`),t._updateVisualState())})}_focusNextOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>=0&&t<e.length-1?n=e[t+1]:e.length>0&&(n=e[0]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}_focusPreviousOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>0?n=e[t-1]:e.length>0&&(n=e[e.length-1]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}};customElements.get(`mint-choice-option`)||customElements.define(`mint-choice-option`,y);var b=class extends HTMLElement{static get observedAttributes(){return[`label`,`name`,`info`,`error`,`error-message`,`id`,`disabled`,`required`,`loading`]}constructor(){super(),this._optionsContainer=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.addEventListener(`choice-change`,e=>{let t=e.detail?.value||this.getValue();(this.getAttribute(`value`)||``)!==t&&(t?this.setAttribute(`value`,t):this.removeAttribute(`value`));let n=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0}))})}disconnectedCallback(){}isLoading(){return this.hasAttribute(`loading`)}attributeChangedCallback(e,t,n){t!==n&&(e===`error`||e===`error-message`?this._renderErrorState():e===`loading`?(this.render(),this.querySelectorAll(`mint-choice-option`).forEach(e=>{this.isLoading()?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`)})):(this.render(),e===`name`&&this.querySelectorAll(`mint-choice-option`).forEach(e=>{typeof e.render==`function`&&e.render()})))}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}getValue(){return this.querySelector(`input[type="radio"]:checked`)?.value||``}setValue(e){let t=this.querySelectorAll(`mint-choice-option`);t.forEach(t=>{if((t.getAttribute(`value`)||``)===e){let e=t;e.checked=!0;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!0,n.dispatchEvent(new Event(`change`,{bubbles:!0})))}else{let e=t;e.checked=!1;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!1)}}),requestAnimationFrame(()=>{t.forEach(e=>{typeof e._updateVisualState==`function`&&e._updateVisualState();let t=e.querySelector(`input[type="radio"]`);if(t){let n=e;t.checked!==n.checked&&(t.checked=n.checked)}})})}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getId()||`mint-choice-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute(`id`,r);let i=this.isDisabled(),a=this.querySelector(`.mint-choice-label-container`);if(t||n){a||(a=document.createElement(`div`),a.className=`mint-choice-label-container flex flex-col gap-0.5 mb-2`,this.insertBefore(a,this.firstChild));let e=a.querySelector(`.mint-choice-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,a.insertBefore(e,a.firstChild)),e.textContent=t,e.setAttribute(`for`,r),i?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let o=a.querySelector(`.mint-choice-info`);n?(o||(o=document.createElement(`span`),o.className=`mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none`,a.appendChild(o)),o.textContent=n,i?o.classList.add(`opacity-40`):o.classList.remove(`opacity-40`)):o&&o.remove()}else a&&a.remove();let o=this.querySelector(`.mint-choice-options-wrapper`);if(!o){o=document.createElement(`div`),o.className=`mint-choice-options-wrapper relative`;let e=this.querySelector(`.mint-choice-label-container`);e&&e.parentElement===this?this.insertBefore(o,e.nextSibling):this.insertBefore(o,this.firstChild)}this._optionsContainer?this._optionsContainer.parentElement!==o&&o.appendChild(this._optionsContainer):(this._optionsContainer=document.createElement(`div`),this._optionsContainer.className=`mint-choice-options-container flex flex-col gap-3`,o.appendChild(this._optionsContainer)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==this._optionsContainer).forEach(e=>{this._optionsContainer.appendChild(e)}),this._renderErrorState(),this._renderSkeleton(e)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-skeleton-container`),n=this.querySelector(`.mint-choice-options-wrapper`),r=this.querySelector(`.mint-choice-options-container`);if(e){if(t||(t=document.createElement(`div`),t.className=`mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t))),t.querySelectorAll(`.mint-choice-option-skeleton`).length===0)for(let e=0;e<3;e++){let e=document.createElement(`div`);e.className=`mint-choice-option-skeleton flex items-center gap-3`;let n=document.createElement(`div`);n.className=`flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,e.appendChild(n);let r=document.createElement(`div`);r.className=`h-4 w-20 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,e.appendChild(r),t.appendChild(e)}t.style.display=`flex`,r&&(r.style.opacity=`0`,r.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.opacity=`1`,r.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-choice-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}};customElements.get(`mint-choice`)||customElements.define(`mint-choice`,b);var x=class extends HTMLElement{static get observedAttributes(){return[`type`,`placeholder`,`value`,`disabled`,`id`,`name`,`required`,`readonly`,`rows`,`icon`,`label`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._prependSlotContainer=null,this._appendSlotContainer=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._slotResizeObserver=null,this._slotMutationObserver=null,this._contentObserver=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._observeContentMutations()}disconnectedCallback(){this.removeEventListeners(),this._slotResizeObserver&&=(this._slotResizeObserver.disconnect(),null),this._slotMutationObserver&&=(this._slotMutationObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(e===`loading`){this.render();return}this.render()}}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}getType(){return this.getAttribute(`type`)||`text`}getRows(){let e=this.getAttribute(`rows`);return e?parseInt(e,10):3}_getNormalizedType(){let e=this.getType();return e===`datetime`?`datetime-local`:e===`money`?`text`:e===`textarea`?`textarea`:e}_isTextarea(){return this.getType()===`textarea`}_isMoney(){return this.getType()===`money`}_isColor(){return this.getType()===`color`}_isNumber(){return this.getType()===`number`}getPlaceholder(){return this.getAttribute(`placeholder`)||``}getValue(){return this._isColor()?this._colorTextInput?this._colorTextInput.value:this._colorPicker?this._colorPicker.value:this.getAttribute(`value`)||`#000000`:this._element?this._element.value:this.getAttribute(`value`)||``}set value(e){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||`#000000`),this._colorTextInput&&(this._colorTextInput.value=e||`#000000`)):this._element&&(this._element.value=e),e?this.setAttribute(`value`,e):this.removeAttribute(`value`)}catch{}}get value(){try{return this.getValue()||``}catch{return``}}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getIcon(){return this.getAttribute(`icon`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getInputClasses(){let e=this._isTextarea(),t=!!this.getIcon(),n=this.querySelector(`[slot="prepend"]`)!==null,r=this.querySelector(`[slot="append"]`)!==null,i=this._isColor(),a=this._isNumber(),o=this.hasError(),s=[`w-full`,t||i||n?`pl-10`:`px-3.5`,r?`pr-10`:t||i?`pr-3.5`:a?`pr-10`:``,e?`py-2`:`py-1.5`,e?`min-h-[6rem]`:`min-h-[2rem]`,`text-base`,`min-[1100px]:text-sm`,`font-medium`,`rounded-lg`,`box-border`,`bg-white`,`dark:bg-mint-elevated`,`text-gray-900`,`dark:text-white`,`outline-none`,`focus:outline-none`,`disabled:opacity-40`,`disabled:cursor-not-allowed`,`readonly:cursor-default`,e?`resize-y`:``,a?`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`:``],c=[`border-2`,o?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`],l=[`focus-visible:ring-2`,`focus-visible:ring-offset-1`,o?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`];return[...s,...c,...l].filter(Boolean).join(` `)}_syncSlotAdornments(e,t){if(!this._wrapper||e||this._isColor()){this._prependSlotContainer&&=(this._prependSlotContainer.remove(),null),this._appendSlotContainer&&=(this._appendSlotContainer.remove(),null),this._clearAdornmentPadding();return}this._prependSlotContainer||(this._prependSlotContainer=document.createElement(`div`),this._prependSlotContainer.className=`mint-input-prepend-slot absolute top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto`,this._wrapper.appendChild(this._prependSlotContainer)),this._appendSlotContainer||(this._appendSlotContainer=document.createElement(`div`),this._appendSlotContainer.className=`mint-input-append-slot absolute right-3 top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto`,this._wrapper.appendChild(this._appendSlotContainer)),this._prependSlotContainer.classList.remove(`left-3`,`left-10`),this._prependSlotContainer.classList.add(t?`left-10`:`left-3`);let n=Array.from(this.querySelectorAll(`[slot="prepend"]`)),r=Array.from(this.querySelectorAll(`[slot="append"]`));this._prependSlotContainer.replaceChildren(),this._appendSlotContainer.replaceChildren(),n.forEach(e=>this._prependSlotContainer.appendChild(e)),r.forEach(e=>this._appendSlotContainer.appendChild(e)),this._prependSlotContainer.classList.toggle(`hidden`,n.length===0),this._appendSlotContainer.classList.toggle(`hidden`,r.length===0),this._ensureSlotObservers(),this._applyAdornmentPadding(t)}_clearAdornmentPadding(){this._element&&(this._element.style.removeProperty(`padding-left`),this._element.style.removeProperty(`padding-right`)),this._colorTextInput&&(this._colorTextInput.style.removeProperty(`padding-left`),this._colorTextInput.style.removeProperty(`padding-right`))}_applyAdornmentPadding(e){this._element&&requestAnimationFrame(()=>{if(this._element){if(this._prependSlotContainer&&!this._prependSlotContainer.classList.contains(`hidden`)){let t=(e?40:12)+this._prependSlotContainer.offsetWidth+8;this._element.style.paddingLeft=`${t}px`}else this._element.style.removeProperty(`padding-left`);if(this._appendSlotContainer&&!this._appendSlotContainer.classList.contains(`hidden`)){let e=12+this._appendSlotContainer.offsetWidth+8;this._element.style.paddingRight=`${e}px`}else this._element.style.removeProperty(`padding-right`)}})}_ensureSlotObservers(){!this._prependSlotContainer&&!this._appendSlotContainer||(this._slotResizeObserver||=new ResizeObserver(()=>{this._applyAdornmentPadding(!!this.getIcon())}),this._slotResizeObserver.disconnect(),this._prependSlotContainer&&this._slotResizeObserver.observe(this._prependSlotContainer),this._appendSlotContainer&&this._slotResizeObserver.observe(this._appendSlotContainer),this._slotMutationObserver||=new MutationObserver(()=>{this._applyAdornmentPadding(!!this.getIcon())}),this._slotMutationObserver.disconnect(),this._prependSlotContainer&&this._slotMutationObserver.observe(this._prependSlotContainer,{childList:!0,subtree:!0,characterData:!0}),this._appendSlotContainer&&this._slotMutationObserver.observe(this._appendSlotContainer,{childList:!0,subtree:!0,characterData:!0}))}isLoading(){return this.getAttribute(`loading`)===`true`}render(){this.getType();let e=this._getNormalizedType(),t=this._isTextarea(),n=this._isMoney(),r=this._isColor(),i=this.getPlaceholder(),a=this.isDisabled(),o=this.isReadonly(),s=this.isRequired(),c=this.getId(),l=this.getName(),u=this.getAttribute(`value`)||(r?`#000000`:``),d=this.getRows(),f=this.getIcon(),p=this.getLabel(),m=this.getInfo(),h=this.isLoading();if(this._renderSkeleton(h),r){this._input&&=(this._input.remove(),null),this._textarea&&=(this._textarea.remove(),null),this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&=(this._colorContainer.remove(),null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement(`div`),this._colorPickerWrapper.className=`mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,this._colorPickerWrapper.style.backgroundColor=u||`#000000`,this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement(`input`),this._colorPicker.type=`color`,this._colorPicker.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._colorPicker.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;`,this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=e=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&requestAnimationFrame(()=>{this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&this._colorPickerWrapper?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._colorPicker.addEventListener(`focus`,this._focusHandler),this._colorPicker.addEventListener(`blur`,this._blurHandler),this._colorPicker.addEventListener(`input`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&(this._colorTextInput.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener(`change`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement(`input`),this._colorTextInput.type=`text`,this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=i||`#000000`,this._colorTextInput.pattern=`^#[0-9A-Fa-f]{6}$`,this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener(`input`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)&&(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener(`blur`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)?(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this._colorPicker?.value||`#000000`},bubbles:!0,cancelable:!0}))}));let e=u||`#000000`;if(this._colorPicker&&this._colorPicker.value!==e&&(this._colorPicker.value=e),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&this._colorTextInput.value!==e&&(this._colorTextInput.value=e),this._colorPicker&&(this._colorPicker.disabled=a),this._colorPickerWrapper&&(a?(this._colorPickerWrapper.classList.add(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.remove(`cursor-pointer`)):(this._colorPickerWrapper.classList.remove(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.add(`cursor-pointer`))),this._colorTextInput&&(this._colorTextInput.disabled=a,this._colorTextInput.readOnly=o,this._colorTextInput.required=s),this._colorTextInput){let e=this._colorTextInput;c?e.id=c:e.removeAttribute(`id`),l?e.name=l:e.removeAttribute(`name`),e.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._element=e}this._renderErrorState();let t=this.querySelector(`.mint-input-label-container`);if(p||m){t||(t=document.createElement(`div`),t.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(t,this._wrapper):this.insertBefore(t,this.firstChild));let e=t.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,t.insertBefore(e,t.firstChild)),e.textContent=p;let n=c||this._colorTextInput?.id;if(n)e.setAttribute(`for`,n);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._colorTextInput&&(this._colorTextInput.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let n=t.querySelector(`.mint-input-info`);m?(n||(n=document.createElement(`span`),n.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,t.appendChild(n)),n.textContent=m,a?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else t&&t.remove();return}if(this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),f&&!t?this._icon?this._icon.setAttribute(`name`,f):(this._icon=document.createElement(`mint-icon`),this._icon.setAttribute(`name`,f),this._icon.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none`,this._wrapper.appendChild(this._icon)):this._icon&&=(this._icon.remove(),null),this._syncSlotAdornments(t,!!f),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement(`div`),this._numberSpinnerContainer.className=`absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none`,this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement(`button`),this._numberIncrementButton.type=`button`,this._numberIncrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed pointer-events-auto bg-gray-100 dark:bg-mint-hover active:bg-gray-200 dark:active:bg-mint-elevated rounded`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`caret-up`),e.className=`w-[1rem] h-[1rem]`,this._numberIncrementButton.appendChild(e),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement(`button`),this._numberDecrementButton.type=`button`,this._numberDecrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed pointer-events-auto bg-gray-100 dark:bg-mint-hover active:bg-gray-200 dark:active:bg-mint-elevated rounded`;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`caret-down`),t.className=`w-[1rem] h-[1rem]`,this._numberDecrementButton.appendChild(t),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e+t;r!==void 0&&i>r&&(i=r),n!==void 0&&i<n&&(i=n),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}}),this._numberDecrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e-t;n!==void 0&&i<n&&(i=n),r!==void 0&&i>r&&(i=r),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=a||o),this._numberDecrementButton&&(this._numberDecrementButton.disabled=a||o)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&=(this._input.remove(),null),this._textarea||(this._textarea=document.createElement(`textarea`),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=i,this._textarea.disabled=a,this._textarea.readOnly=o,this._textarea.required=s,this._textarea.rows=d,this._textarea.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),u!==this._textarea.value&&(this._textarea.value=u),c?this._textarea.id=c:this._textarea.removeAttribute(`id`),l?this._textarea.name=l:this._textarea.removeAttribute(`name`),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._textarea.value&&(this._textarea.value=e.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&=(this._textarea.remove(),null),this._input||(this._input=document.createElement(`input`),this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=i,this._input.disabled=a,this._input.readOnly=o,this._input.required=s,this._input.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),n?(this._input.inputMode=`decimal`,this._input.pattern=`[0-9]*\\.?[0-9]*`):(this._input.removeAttribute(`inputmode`),this._input.removeAttribute(`pattern`)),u!==this._input.value&&(this._input.value=u),c?this._input.id=c:this._input.removeAttribute(`id`),l?this._input.name=l:this._input.removeAttribute(`name`),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._input.value&&(this._input.value=e.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(`.mint-input-label-container`);if(p||m){g||(g=document.createElement(`div`),g.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let e=g.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,g.insertBefore(e,g.firstChild)),e.textContent=p;let t=c||this._element?.id||this._colorTextInput?.id||this._input?.id||this._textarea?.id;if(t)e.setAttribute(`for`,t);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=t:this._colorTextInput?this._colorTextInput.id=t:this._input?this._input.id=t:this._textarea&&(this._textarea.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let t=g.querySelector(`.mint-input-info`);m?(t||(t=document.createElement(`span`),t.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,g.appendChild(t)),t.textContent=m,a?t.classList.add(`opacity-40`):t.classList.remove(`opacity-40`)):t&&t.remove()}else g&&g.remove();this._syncSlotAdornments(t,!!f),this._renderErrorState(),this._renderSkeleton(h)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-input-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-input-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}setupEventListeners(){this._element&&(this._element.addEventListener(`input`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`);let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener(`blur`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&=(this._colorPicker.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._colorPicker.removeEventListener(`blur`,this._blurHandler),null))}focus(){this._isColor()&&this._colorTextInput?this._colorTextInput.focus():this._element?.focus()}blur(){this._isColor()&&this._colorTextInput?this._colorTextInput.blur():this._element?.blur()}_renderSkeleton(e){let t=this.querySelector(`.mint-input-skeleton-container`),n=this._wrapper||this.querySelector(`.relative.w-full`);if(e){t||(t=document.createElement(`div`),t.className=`mint-input-skeleton-container absolute inset-0 z-10 pointer-events-none`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-input-skeleton`);if(!e){e=document.createElement(`div`),e.className=`mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-mint-hover animate-pulse`;let n=this._isTextarea(),r=this.getRows();if(n){let t=r*24+12;e.style.height=`${t}px`}else e.style.height=`2.2rem`;t.appendChild(e)}t.style.display=`block`,this._element&&(this._element.style.opacity=`0`,this._element.style.pointerEvents=`none`),this._colorTextInput&&(this._colorTextInput.style.opacity=`0`,this._colorTextInput.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),this._element&&(this._element.style.opacity=`1`,this._element.style.pointerEvents=`auto`),this._colorTextInput&&(this._colorTextInput.style.opacity=`1`,this._colorTextInput.style.pointerEvents=`auto`)}};customElements.get(`mint-input`)||customElements.define(`mint-input`,x);var S=class extends HTMLElement{static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`format`,`min`,`max`,`range`,`shortcuts`,`display-format`,`error`,`error-message`,`loading`,`selection-mode`,`week-start-day`,`mode`,`disabled-dates`]}constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode=`calendar`,this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._hoveredDate=null,this._isHandlingClick=!1,this._touchStartDate=null,this._touchStartElement=null,this._isTouchActive=!1,this._resizeObserver=null,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._removeFocusTrap(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){let e=this.hasError(),t=this.getErrorMessage();this._applyErrorVisuals(e,t,this.isDisabled());return}if(e===`loading`){this.render();return}if(e===`mode`||e===`format`){let e=this.getMode();e===`month`?this._viewMode=`month`:e===`year`?this._viewMode=`year`:this._viewMode=`calendar`,this._popover&&this._calendarContainer&&this._buildCalendar()}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?(this.setAttribute(`value`,e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute(`value`),this._textInput&&(this._textInput.value=``),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}getFormat(){return this.getAttribute(`format`)||`mm/dd/yyyy`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isRange(){return this.getAttribute(`range`)===`true`}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getMin(){return this.getAttribute(`min`)||``}getMax(){return this.getAttribute(`max`)||``}getDisabledDates(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{let t=JSON.parse(e),n=this.getFormat();return t.map(e=>this._parseDateString(e,n)).filter(e=>e!==null)}catch{return[]}}getDisabledDateStrings(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{return JSON.parse(e)}catch{return[]}}disableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=this._parseDateString(e,t);if(r){let e=this._formatDate(r,t);n.includes(e)||i.push(e)}}if(i.length>0){let e=[...n,...i];this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}enableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);i.push(e)}}if(i.length>0){let e=n.filter(e=>!i.includes(e));e.length===0?this.removeAttribute(`disabled-dates`):this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}getSelectionMode(){let e=this.getAttribute(`selection-mode`);return e===`week`||e===`month`?e:`day`}getMode(){let e=this.getAttribute(`mode`);if(e===`month`||e===`year`)return e;let t=this.getFormat().toLowerCase(),n=t.includes(`d`),r=t.includes(`m`);return!n&&!r?`year`:!n&&r?`month`:`default`}getWeekStartDay(){return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[this.getAttribute(`week-start-day`)?.toLowerCase()||`sunday`]??0}getDisplayFormat(){return this.getAttribute(`display-format`)||`F j, Y`}getShortcuts(){let e=this.getAttribute(`shortcuts`);if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>({label:e.label,action:this._createShortcutAction(e.action)}))}catch{let t=e.trim();if(t&&typeof window[t]==`function`){let e=window[t]();if(Array.isArray(e))return e.map(e=>({label:e.label,action:typeof e.action==`function`?e.action:this._createShortcutAction(e.action)}))}}return[]}_createShortcutAction(e){return typeof e==`function`?e:typeof e==`string`&&typeof window[e]==`function`?window[e]:()=>null}_getDefaultShortcuts(){let e=[{label:`Today`,action:()=>new Date}];return this._isRange&&e.push({label:`This Week`,action:()=>{let e=new Date,t=e.getDay(),n=new Date(e);n.setDate(e.getDate()-t),n.setHours(0,0,0,0);let r=new Date(n);return r.setDate(n.getDate()+6),r.setHours(23,59,59,999),{start:n,end:r}}},{label:`This Month`,action:()=>{let e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return n.setHours(23,59,59,999),{start:t,end:n}}}),e}_getFormatTokens(e){let t=[],n=0,r=e.toLowerCase();for(;n<r.length;){let i=r[n];if(i===`d`||i===`m`||i===`y`){let e=1,a=n+1;for(;a<r.length&&r[a]===i;)e++,a++;t.push({type:`part`,part:i,len:e}),n=a}else t.push({type:`sep`,value:e[n]}),n++}return t}_createPartInput(e,t,n,r,i){let a=document.createElement(`input`);return a.type=`text`,a.inputMode=`numeric`,a.pattern=`\\d*`,a.maxLength=e,a.placeholder=t,a.className=`bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed`,a.disabled=n||r,a.readOnly=r,a.required=i,e===4?a.className+=` w-[40px]`:e===2&&(a.className+=` w-[30px]`),a}_buildValueFromParts(e,t){let n=0;return t.map(t=>{if(t.type===`sep`)return t.value;let r=e[n]?.value||``;return n++,r}).join(``)}_applyDateToParts(e,t,n,r){if(!t.length)return;if(!e){t.forEach(e=>e.value=``);return}let i=this._formatDate(e,r),a=0,o=0;n.forEach(e=>{if(e.type===`sep`)a+=e.value.length;else{let n=i.substr(a,e.len);t[o]&&(t[o].value=n),o++,a+=e.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;let e=this.getFormat(),t=this._getFormatTokens(e),n=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){let e=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=e?`${n} - ${e}`:n}else this._hiddenInput.value=n}_focusNext(e,t){if(t+1<e.length){let n=e[t+1];n.focus(),n.setSelectionRange(0,n.value.length)}}_focusPrev(e,t){if(t-1>=0){let n=e[t-1];n.focus(),n.setSelectionRange(n.value.length,n.value.length)}}_attachPartInputHandlers(e,t,n){e.forEach((t,n)=>{let r=t.maxLength||2;t.addEventListener(`input`,()=>{t.value=t.value.replace(/\D/g,``).slice(0,r),t.value.length>=r&&this._focusNext(e,n),this._syncHiddenInput()}),t.addEventListener(`keydown`,r=>{r.key===`Backspace`&&t.selectionStart===0&&t.selectionEnd===0&&this._focusPrev(e,n),r.key===`ArrowLeft`&&t.selectionStart===0&&t.selectionEnd===0&&(this._focusPrev(e,n),r.preventDefault()),r.key===`ArrowRight`&&t.selectionStart===t.value.length&&t.selectionEnd===t.value.length&&(this._focusNext(e,n),r.preventDefault())}),t.addEventListener(`blur`,e=>{this._syncHiddenInput();let t=e.relatedTarget,n=t&&(this._startPartInputs.includes(t)||this._endPartInputs.includes(t));setTimeout(()=>{if(!(this._startPartInputs.some(e=>e===document.activeElement)||this._endPartInputs.some(e=>e===document.activeElement))&&(n||this._handleBlur(this._hiddenInput?.value||``),this._exitInputMode(),!n&&this._hiddenInput)){let t=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:e.relatedTarget});this._hiddenInput.dispatchEvent(t)}},0)})})}_splitRangeInput(e,t){let n=e.split(/\s*-\s*/);return n.length>=2?[n[0],n.slice(1).join(`-`)]:[e]}_parseValue(e){let t=this.getFormat(),n=this._getFormatTokens(t),r=this.getSelectionMode();if(this._isRange||r===`week`||r===`month`){let[r,i]=this._splitRangeInput(e,t),a=r?this._parseDateString(r,t):null,o=i?this._parseDateString(i,t):null;if(a&&o){let[e,t]=a<=o?[a,o]:[o,a];this._selectedStartDate=e,this._selectedEndDate=t,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else a&&(this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,n,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,n,t)}else{let r=this._parseDateString(e,t);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,n,t)):this._applyDateToParts(null,this._startPartInputs,n,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){let n=/[\/\-\.\s]+/;if(n.test(e)){let r=e.split(n).filter(e=>e.length>0),i=t.split(/[\/\-\.\s]+/).filter(e=>e.length>0);if(r.length===i.length){let e=0,t=0,n=0;for(let a=0;a<i.length;a++){let o=i[a].toLowerCase(),s=r[a];if(o.includes(`d`))e=parseInt(s,10);else if(o.includes(`m`))t=parseInt(s,10)-1;else if(o.includes(`y`)){let e=parseInt(s,10),t=o.length,r=s.length;(r===2&&t===4||r===2&&t===2)&&(e=Math.floor(new Date().getFullYear()/100)*100+e),n=e}}let a=i.some(e=>e.toLowerCase().includes(`d`)),o=i.some(e=>e.toLowerCase().includes(`m`));if(a||(e=1),o||(t=0),t>=0&&t<=11&&n){let r=new Date(n,t,e);if(!isNaN(r.getTime()))return a&&r.getDate()!==e||r.getMonth()!==t||r.getFullYear()!==n?null:r}}}let r=e.replace(/[\/\-\.]/g,``),i=t.replace(/[\/\-\.]/g,``).toLowerCase(),a=i.indexOf(`d`),o=i.indexOf(`m`),s=i.indexOf(`y`),c=[{char:`d`,index:a},{char:`m`,index:o},{char:`y`,index:s}].sort((e,t)=>e.index-t.index),l=0,u=0,d=0,f=0;i.length,r.length;for(let e of c)if(e.char===`d`){let e=i.lastIndexOf(`d`)-i.indexOf(`d`)+1,t=r.substr(f,e);if(t.length===0)return null;l=parseInt(t,10),f+=t.length}else if(e.char===`m`){let e=i.lastIndexOf(`m`)-i.indexOf(`m`)+1,t=r.substr(f,e);if(t.length===0)return null;u=parseInt(t,10)-1,f+=t.length}else if(e.char===`y`){let e=i.lastIndexOf(`y`)-i.indexOf(`y`)+1,t=r.substr(f),n=Math.min(e,t.length),a=t.substr(0,n);if(a.length===0)return null;let o=parseInt(a,10);(n===2&&e===4||n===2&&e===2)&&(o=Math.floor(new Date().getFullYear()/100)*100+o),d=o,f+=n}let p=t.toLowerCase(),m=p.includes(`d`),h=p.includes(`m`);if(m||(l=1),h||(u=0),u<0||u>11||!d)return null;let g=new Date(d,u,l);return isNaN(g.getTime())||m&&g.getDate()!==l||g.getMonth()!==u||g.getFullYear()!==d?null:g}_formatDate(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=t.toLowerCase(),o=t;return a.includes(`dd`)?o=o.replace(/dd/gi,String(n).padStart(2,`0`)):a.includes(`d`)&&(o=o.replace(/d/gi,String(n))),a.includes(`mm`)?o=o.replace(/mm/gi,String(r).padStart(2,`0`)):a.includes(`m`)&&(o=o.replace(/m/gi,String(r))),a.includes(`yyyy`)?o=o.replace(/yyyy/gi,String(i)):a.includes(`yy`)&&(o=o.replace(/yy/gi,String(i).substr(2))),o}_formatDatePhp(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=(e,t=2)=>e.toString().padStart(t,`0`),u=e=>{let t=e%10,n=e%100;return t===1&&n!==11?`st`:t===2&&n!==12?`nd`:t===3&&n!==13?`rd`:`th`},d=``;for(let f=0;f<t.length;f++){let p=t[f];if(p===`\\`&&f+1<t.length){d+=t[f+1],f++;continue}switch(p){case`Y`:d+=i.toString();break;case`y`:d+=i.toString().slice(-2);break;case`m`:d+=l(r);break;case`n`:d+=r.toString();break;case`M`:d+=c[r-1];break;case`F`:d+=s[r-1];break;case`d`:d+=l(n);break;case`j`:d+=n.toString();break;case`D`:d+=o[e.getDay()];break;case`l`:d+=a[e.getDay()];break;case`S`:d+=u(n);break;default:d+=p;break}}return d}_validateDateString(e,t){let n=this._parseDateString(e,t);return n!==null&&!isNaN(n.getTime())}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getValue(),i=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),s=this.getId(),c=this.getName(),l=this.getFormat(),u=this.hasError(),d=this.getErrorMessage(),f=this.getSelectionMode();this._isRange=this.isRange()||f===`week`||f===`month`,this._input||(this._input=document.createElement(`div`),this._input.className=`relative w-full`,this.appendChild(this._input));let p=this.querySelector(`.mint-date-picker-label-container`);if(t||n){p||(p=document.createElement(`div`),p.className=`mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]`,this.contains(this._input)?this.insertBefore(p,this._input):this.appendChild(p));let e=p.querySelector(`.mint-date-picker-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,p.insertBefore(e,p.firstChild)),e.textContent=t,s&&this._textInput&&e.setAttribute(`for`,s)):e&&e.remove();let r=p.querySelector(`.mint-date-picker-info`);n?(r||(r=document.createElement(`span`),r.className=`mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none`,p.appendChild(r)),r.textContent=n):r&&r.remove()}else p&&p.remove();this._hiddenInput||(this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.value=r||``,this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),s&&(this._hiddenInput.id=s),c&&(this._hiddenInput.name=c),this._hiddenInput.value=r||``,this._hiddenInput.setAttribute(`aria-invalid`,u?`true`:`false`);let m=this._input.querySelector(`.mint-date-fields`);m||(m=document.createElement(`div`),this._input.appendChild(m)),this._fieldsContainer=m,this._applyErrorVisuals(u,d,i),m.innerHTML=``,this._displayEl=document.createElement(`div`);let h=a?`select-text`:`select-none`;this._displayEl.className=`flex-1 text-gray-900 dark:text-white ${a?`cursor-default`:`cursor-text`} ${h} focus:outline-none`,this._displayEl.tabIndex=i||a?-1:0,this._displayEl.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._displayEl.addEventListener(`keydown`,e=>{i||a||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement(`div`),this._isRange,this._inputsWrapperEl.className=`flex items-center gap-1 w-full`;let g=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];let _=e=>{let t=document.createDocumentFragment();return g.forEach(n=>{if(n.type===`sep`){let e=document.createElement(`span`);e.textContent=n.value,e.className=`text-gray-400 dark:text-gray-500 select-none`,t.appendChild(e)}else{let r=n.part===`d`?`dd`:n.part===`m`?`mm`:n.len===2?`yy`:`yyyy`,s=this._createPartInput(n.len,r,i,a,o);e===`start`?this._startPartInputs.push(s):this._endPartInputs.push(s),t.appendChild(s)}}),t};if(this._isRange){let e=document.createElement(`div`);e.className=`flex items-center gap-1 flex-shrink-0`,e.appendChild(_(`start`)),this._inputsWrapperEl.appendChild(e);let t=document.createElement(`span`);t.textContent=` - `,t.className=`text-gray-400 dark:text-gray-500 select-none flex-shrink-0`,this._inputsWrapperEl.appendChild(t);let n=document.createElement(`div`);n.className=`flex items-center gap-1 flex-shrink-0`,n.appendChild(_(`end`)),this._inputsWrapperEl.appendChild(n)}else this._inputsWrapperEl.appendChild(_(`start`));let v=document.createElement(`div`);if(v.className=`flex flex-col w-full`,this._displayEl.style.display=this._isInputMode?`none`:`flex`,this._inputsWrapperEl.style.display=this._isInputMode?`flex`:`none`,v.appendChild(this._displayEl),v.appendChild(this._inputsWrapperEl),m.appendChild(v),this._isRange&&this._inputsWrapperEl&&this._setupContainerObserver(),m.addEventListener(`click`,()=>{this._isInputMode||i||a||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,g,m),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,g,m),this._parseValue(r),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=i||a,!i&&!a?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement(`button`),this._iconButton.type=`button`,this._iconButton.tabIndex=0,this._iconButton.className=`absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm`;let e=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`calendar`),t.className=`w-4 h-4 pointer-events-none`,this._iconButton.appendChild(t),this._iconButton.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=i||a}this._renderErrorState(u,d),this._renderSkeleton(e)}_renderErrorState(e,t){let n=this.querySelector(`.mint-date-picker-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_applyErrorVisuals(e,t,n){if(this._renderErrorState(e,t),this._fieldsContainer){let t=this._getFieldContainerClass(e,n);this._fieldsContainer.className=t}this._hiddenInput&&this._hiddenInput.setAttribute(`aria-invalid`,e?`true`:`false`)}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(``),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,``,this.isDisabled())},e.addEventListener(`reset`,this._resetHandler))}_clearPartInputs(e){e.forEach(e=>{e.value=``})}_getFieldContainerClass(e,t){return[`mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider text-gray-900 dark:text-white`,`border-2`,e?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`,`outline-none focus-within:ring-2 focus-within:ring-offset-1`,e?`focus-within:ring-red-400 dark:focus-within:ring-red-500`:`focus-within:ring-gray-400 dark:focus-within:ring-gray-500`,`flex items-center gap-1`].join(` `)+(t?` opacity-40 cursor-not-allowed`:``)}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){let t=this.getFormat(),n=this.getSelectionMode(),r=this._isRange||n===`week`||n===`month`;if(!e){this.setValue(``),this._updateDisplayText();return}if(r){let[n,r]=this._splitRangeInput(e,t),i=n?this._parseDateString(n,t):null,a=r?this._parseDateString(r,t):null;if(i&&a){let[e,n]=i<=a?[i,a]:[a,i],r=`${this._formatDate(e,t)} - ${this._formatDate(n,t)}`;this.setValue(r),this._applyDateToParts(e,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(n,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=e,this._selectedEndDate=n,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else if(i){let e=this._formatDate(i,t);this.setValue(e),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);this.setValue(e),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}let t=this._iconButton.id;t&&this._iconButton.isConnected&&document.getElementById(t)?this._createPopover(t):e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(e){if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(this._popover){if(this._popover.getAttribute(`trigger-id`)!==e){this._popover.setAttribute(`trigger-id`,e);let t=this._popover;typeof t._setupTrigger==`function`&&t._setupTrigger()}this._buildCalendar()}else{this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`);let t=this.closest(`mint-modal`),n=this.closest(`mint-off-canvas`);t||n?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute(`trigger-id`,e),this._popoverObserver||(this._popoverObserver=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`open`)if(this._popover?.hasAttribute(`open`))requestAnimationFrame(()=>{this._buildCalendar();let e=this._popover;typeof e.render==`function`&&e.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{this._iconButton?.focus()}),this._viewMode=`calendar`,this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{let e=new Date;this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{let e=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:null});this._hiddenInput?.dispatchEvent(e)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]})),requestAnimationFrame(()=>{this._buildCalendar()}))})})}}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement(`div`),this._calendarContainer.className=`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]`;let e=this.getMode();e===`month`&&this._viewMode===`calendar`?this._viewMode=`month`:e===`year`&&this._viewMode===`calendar`?this._viewMode=`year`:e===`default`&&this._viewMode!==`month`&&this._viewMode!==`year`&&(this._viewMode=`calendar`),this._viewMode===`calendar`?this._buildCalendarView():this._viewMode===`month`?this._buildMonthView():this._viewMode===`year`&&this._buildYearView();let t=this._popover.querySelector(`.popover-content`);if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;let e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),n=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],r=this.getWeekStartDay(),i=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],a=[...i.slice(r),...i.slice(0,r)],o=this.getShortcuts(),s=o.length>0;this._calendarContainer.className=s?`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]`:`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[18rem] md:min-w-[18rem]`;let c=document.createElement(`div`);c.className=`flex flex-col md:flex-row md:gap-6 md:items-start`;let l=document.createElement(`div`);l.className=`flex-1 min-w-0`;let u=document.createElement(`div`);u.className=`flex items-center justify-between mb-4`;let d=document.createElement(`button`);d.type=`button`,d.tabIndex=0,d.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,d.setAttribute(`data-keep-popover-open`,`true`);let f=document.createElement(`mint-icon`);f.setAttribute(`name`,`caret-left`),f.className=`w-4 h-4`,d.appendChild(f),d.addEventListener(`click`,()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}),u.appendChild(d);let p=document.createElement(`div`);p.className=`flex items-center gap-2`;let m=document.createElement(`button`);m.type=`button`,m.tabIndex=0,m.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,m.setAttribute(`data-keep-popover-open`,`true`),m.textContent=n[this._currentMonth];let h=()=>{let e=this.getMode();e!==`month`&&e!==`year`&&(this._viewMode=`month`,this._buildCalendar())};m.addEventListener(`click`,h),m.addEventListener(`touchend`,e=>{e.preventDefault(),h()},{passive:!1}),p.appendChild(m);let g=document.createElement(`button`);g.type=`button`,g.tabIndex=0,g.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,g.setAttribute(`data-keep-popover-open`,`true`),g.textContent=String(this._currentYear),g.addEventListener(`click`,()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())}),p.appendChild(g),u.appendChild(p);let _=document.createElement(`button`);_.type=`button`,_.tabIndex=0,_.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_.setAttribute(`data-keep-popover-open`,`true`);let v=document.createElement(`mint-icon`);v.setAttribute(`name`,`caret-right`),v.className=`w-4 h-4`,_.appendChild(v);let y=()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};_.addEventListener(`click`,y),_.addEventListener(`touchend`,e=>{e.preventDefault(),y()},{passive:!1}),u.appendChild(_);let b=document.createElement(`div`);b.className=`grid grid-cols-7 mb-2`,a.forEach(e=>{let t=document.createElement(`div`);t.className=`text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1`,t.textContent=e,b.appendChild(t)});let x=document.createElement(`div`);x.className=`grid grid-cols-7`;let S=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,C=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;this.getDisabledDates();let w=this._currentMonth===0?11:this._currentMonth-1,T=this._currentMonth===0?this._currentYear-1:this._currentYear,E=this._getDaysInMonth(w,T),D=this._currentMonth===11?0:this._currentMonth+1,O=this._currentMonth===11?this._currentYear+1:this._currentYear,k=t+e,A=Math.ceil(k/7)*7-k,j=(e,t,n)=>{let r=this._isToday(e),i=this._isDateSelected(e),a=this._isDateInRange(e),o=S&&e<S||C&&e>C||this._isDateDisabled(e),s=`rounded-md`,c=this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate,l=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._selectedStartDate:c&&this._hoveredDate?this._hoveredDate:null,u=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._hoveredDate:c&&this._selectedStartDate?this._selectedStartDate:null,d=l!==null&&this._isSameDate(e,l),f=u!==null&&this._isSameDate(e,u),p=this._hoveredDate!==null&&this._isSameDate(e,this._hoveredDate),m=c&&this._hoveredDate&&this._selectedStartDate?!this._rangeIncludesDisabledDates(this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate):!1;if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){let t=this._isSameDate(e,this._selectedStartDate),n=this._isSameDate(e,this._selectedEndDate);t&&n?s=`rounded-md`:t?s=`rounded-l-md`:n?s=`rounded-r-md`:a&&(s=`rounded-none`)}else c&&(d||f)&&m?d&&f?s=`rounded-md`:d?s=`rounded-l-md`:f&&(s=`rounded-r-md`):i&&!this._isRange||i&&this._isRange&&!this._selectedEndDate?s=`rounded-md`:a&&c&&m&&(s=`rounded-none`);let h=document.createElement(`button`);h.type=`button`,h.disabled=!!o,h.tabIndex=o?-1:0;let g=`w-full h-8 ${s} border-0 text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_=i||c&&p&&m;return n?g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:r?` text-gray-900 dark:text-gray-100 font-semibold`:` text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-mint-hover`:g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:` text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-mint-hover`,g+=o?` opacity-40 cursor-not-allowed`:``,h.className=g,h.textContent=t.toString(),o||(h.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),this._handleDateClick(e)}),h.addEventListener(`touchstart`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive=!0,this._touchStartDate=e,this._touchStartElement=h,h.classList.add(`active`,`bg-gray-200`,`dark:bg-gray-600`)},{passive:!1}),h.addEventListener(`touchend`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive&&this._touchStartDate&&this._isSameDate(this._touchStartDate,e)&&this._handleDateClick(e),this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null},{passive:!1}),h.addEventListener(`touchcancel`,()=>{this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null}),this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&!o&&(h.addEventListener(`mouseenter`,()=>{this._isHandlingClick||this._isTouchActive||this._isDateDisabled(e)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,e))&&(this._hoveredDate=e,this._buildCalendar())}),h.addEventListener(`touchmove`,e=>{if(!this._isTouchActive||!this._touchStartDate)return;let t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);for(;n&&!n.classList.contains(`mint-date-picker-day`);)n=n.parentElement;if(n&&n!==h){let e=n.getAttribute(`data-date`);if(e){let t=new Date(e);this._isDateDisabled(t)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,t))&&(this._hoveredDate=t,this._buildCalendar())}}},{passive:!0}))),h};for(let e=t-1;e>=0;e--){let t=E-e,n=j(new Date(T,w,t),t,!1);x.appendChild(n)}for(let t=1;t<=e;t++){let e=j(new Date(this._currentYear,this._currentMonth,t),t,!0);x.appendChild(e)}for(let e=1;e<=A;e++){let t=j(new Date(O,D,e),e,!1);x.appendChild(t)}if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&(x.addEventListener(`mouseleave`,()=>{this._isTouchActive||(this._hoveredDate=null,this._buildCalendar())}),x.addEventListener(`touchend`,e=>{let t=e.changedTouches[0],n=document.elementFromPoint(t.clientX,t.clientY);n&&!x.contains(n)&&(this._hoveredDate=null,this._buildCalendar())},{passive:!0})),s){let e=document.createElement(`div`);e.className=`mb-4 pb-4 border-b border-gray-200 dark:border-mint-divider md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-mint-divider md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col`;let t=document.createElement(`div`);t.className=`relative md:relative md:flex-1 md:min-h-0`;let n=document.createElement(`div`);n.className=`flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2`,n.style.scrollbarWidth=`none`,n.style.msOverflowStyle=`none`,n.style.setProperty(`-webkit-overflow-scrolling`,`touch`);let r=document.createElement(`style`);r.textContent=`
|
|
58
|
+
`,document.head.appendChild(t),e._activeShadowStyleInjected=!0}this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add(`w-full`)}disconnectedCallback(){this._disconnectHostChildObserver(),this._hostRenderFromObserverRaf!==null&&(cancelAnimationFrame(this._hostRenderFromObserverRaf),this._hostRenderFromObserverRaf=null),this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-neutral-900`,`dark:!bg-neutral-700`,`hover:!bg-neutral-900`,`dark:hover:!bg-neutral-700`,`!border-t-neutral-900`,`!border-l-neutral-900`,`!border-r-neutral-600`,`!border-b-neutral-600`,`dark:!border-t-neutral-700`,`dark:!border-l-neutral-700`,`dark:!border-r-neutral-500`,`dark:!border-b-neutral-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-mint-divider`,`dark:!border-b-mint-divider`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"link-action":[`!text-neutral-900`,`dark:!text-neutral-300`,`hover:!text-neutral-900`,`dark:hover:!text-neutral-300`],"link-neutral":[`!text-gray-950`,`dark:!text-gray-200`,`hover:!text-gray-950`,`dark:hover:!text-gray-200`],"link-info":[`!text-blue-900`,`dark:!text-blue-200`,`hover:!text-blue-900`,`dark:hover:!text-blue-200`],"link-warning":[`!text-amber-900`,`dark:!text-amber-200`,`hover:!text-amber-900`,`dark:hover:!text-amber-200`],"link-danger":[`!text-red-900`,`dark:!text-red-200`,`hover:!text-red-900`,`dark:hover:!text-red-200`]}[e]||[]}_disconnectHostChildObserver(){this._hostChildObserver?.disconnect()}_connectHostChildObserver(){this.isConnected&&(this._hostChildObserver||=new MutationObserver(e=>{this._onLightDomMutation(e)}),this._hostChildObserver.disconnect(),this._hostChildObserver.observe(this,{childList:!0,subtree:!0,characterData:!0}))}_onLightDomMutation(e){if(this.isConnected){if(this._button&&!this._button.isConnected){this._button=null,this._scheduleRenderFromHostObserver();return}for(let t of e){let e=t.target;if(!(this._button&&(e===this._button||this._button.contains(e)))){this._scheduleRenderFromHostObserver();return}}}}_scheduleRenderFromHostObserver(){this._hostRenderFromObserverRaf===null&&(this._hostRenderFromObserverRaf=requestAnimationFrame(()=>{this._hostRenderFromObserverRaf=null,this.isConnected&&this.render()}))}getButtonClasses(){let e=this.isIconOnly(),t=this.getVariant(),n=this.getAlignment(),r=`justify-center`;n===`left`?r=`justify-start`:n===`right`&&(r=`justify-end`);let i=[`inline-flex`,`items-center`,r,`cursor-pointer`,`font-medium`,`rounded-lg`,`box-border`,...e?[`p-1.5`,`aspect-square`,`w-[2.25rem]`,`h-[2.25rem]`]:[`px-3.5`,`py-1.5`,`min-h-[2.25rem]`],`text-sm`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`[&.mint-button-active:not(:disabled):not([data-loading="true"]):not([data-variant="ghost"]):not([data-variant="link"])>*]:translate-y-[1px]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],a=this.getTone(),o={"solid-action":`bg-neutral-800.dark:bg-neutral-600.text-white.hover:bg-neutral-950.dark:hover:bg-neutral-700.active:bg-neutral-900.dark:active:bg-neutral-700.disabled:active:bg-neutral-800.dark:disabled:active:bg-neutral-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-neutral-600.border-l-neutral-600.border-r-neutral-900.border-b-neutral-900.dark:border-t-neutral-500.dark:border-l-neutral-500.dark:border-r-neutral-700.dark:border-b-neutral-700.active:border-t-neutral-900.active:border-l-neutral-900.active:border-r-neutral-600.active:border-b-neutral-600.dark:active:border-t-neutral-700.dark:active:border-l-neutral-700.dark:active:border-r-neutral-500.dark:active:border-b-neutral-500.disabled:active:border-t-neutral-600.disabled:active:border-l-neutral-600.disabled:active:border-r-neutral-900.disabled:active:border-b-neutral-900.dark:disabled:active:border-t-neutral-500.dark:disabled:active:border-l-neutral-500.dark:disabled:active:border-r-neutral-700.dark:disabled:active:border-b-neutral-700.[&[data-loading="true"]:active]:border-t-neutral-600.[&[data-loading="true"]:active]:border-l-neutral-600.[&[data-loading="true"]:active]:border-r-neutral-900.[&[data-loading="true"]:active]:border-b-neutral-900.[&[data-loading="true"]:active]:dark:border-t-neutral-500.[&[data-loading="true"]:active]:dark:border-l-neutral-500.[&[data-loading="true"]:active]:dark:border-r-neutral-700.[&[data-loading="true"]:active]:dark:border-b-neutral-700`.split(`.`),"solid-neutral":`bg-white.dark:bg-mint-canvas.text-gray-900.dark:text-white.hover:bg-gray-50.dark:hover:bg-mint-hover.active:bg-gray-100.dark:active:bg-mint-hover.disabled:active:bg-white.dark:disabled:active:bg-mint-canvas.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-gray-200.border-l-gray-200.border-r-gray-300.border-b-gray-300.dark:border-t-gray-600.dark:border-l-gray-600.dark:border-r-mint-divider.dark:border-b-mint-divider.active:border-t-gray-400.active:border-l-gray-400.active:border-r-gray-200.active:border-b-gray-200.dark:active:border-t-gray-950.dark:active:border-l-gray-950.dark:active:border-r-mint-divider.dark:active:border-b-mint-divider.disabled:active:border-t-gray-200.disabled:active:border-l-gray-200.disabled:active:border-r-gray-400.disabled:active:border-b-gray-400.dark:disabled:active:border-t-mint-divider.dark:disabled:active:border-l-mint-divider.dark:disabled:active:border-r-gray-950.dark:disabled:active:border-b-gray-950.[&[data-loading="true"]:active]:border-t-gray-200.[&[data-loading="true"]:active]:border-l-gray-200.[&[data-loading="true"]:active]:border-r-gray-400.[&[data-loading="true"]:active]:border-b-gray-400.[&[data-loading="true"]:active]:dark:border-t-mint-divider.[&[data-loading="true"]:active]:dark:border-l-mint-divider.[&[data-loading="true"]:active]:dark:border-r-gray-950.[&[data-loading="true"]:active]:dark:border-b-gray-950`.split(`.`),"solid-info":`bg-blue-800.dark:bg-blue-600.text-white.hover:bg-blue-950.dark:hover:bg-blue-700.active:bg-blue-900.dark:active:bg-blue-700.disabled:active:bg-blue-800.dark:disabled:active:bg-blue-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-blue-600.border-l-blue-600.border-r-blue-900.border-b-blue-900.dark:border-t-blue-500.dark:border-l-blue-500.dark:border-r-blue-700.dark:border-b-blue-700.active:border-t-blue-900.active:border-l-blue-900.active:border-r-blue-600.active:border-b-blue-600.dark:active:border-t-blue-700.dark:active:border-l-blue-700.dark:active:border-r-blue-500.dark:active:border-b-blue-500.disabled:active:border-t-blue-600.disabled:active:border-l-blue-600.disabled:active:border-r-blue-900.disabled:active:border-b-blue-900.dark:disabled:active:border-t-blue-500.dark:disabled:active:border-l-blue-500.dark:disabled:active:border-r-blue-700.dark:disabled:active:border-b-blue-700.[&[data-loading="true"]:active]:border-t-blue-600.[&[data-loading="true"]:active]:border-l-blue-600.[&[data-loading="true"]:active]:border-r-blue-900.[&[data-loading="true"]:active]:border-b-blue-900.[&[data-loading="true"]:active]:dark:border-t-blue-500.[&[data-loading="true"]:active]:dark:border-l-blue-500.[&[data-loading="true"]:active]:dark:border-r-blue-700.[&[data-loading="true"]:active]:dark:border-b-blue-700`.split(`.`),"solid-warning":`bg-amber-800.dark:bg-amber-600.text-white.hover:bg-amber-950.dark:hover:bg-amber-700.active:bg-amber-900.dark:active:bg-amber-700.disabled:active:bg-amber-800.dark:disabled:active:bg-amber-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-amber-600.border-l-amber-600.border-r-amber-900.border-b-amber-900.dark:border-t-amber-500.dark:border-l-amber-500.dark:border-r-amber-700.dark:border-b-amber-700.active:border-t-amber-900.active:border-l-amber-900.active:border-r-amber-600.active:border-b-amber-600.dark:active:border-t-amber-700.dark:active:border-l-amber-700.dark:active:border-r-amber-500.dark:active:border-b-amber-500.disabled:active:border-t-amber-600.disabled:active:border-l-amber-600.disabled:active:border-r-amber-900.disabled:active:border-b-amber-900.dark:disabled:active:border-t-amber-500.dark:disabled:active:border-l-amber-500.dark:disabled:active:border-r-amber-700.dark:disabled:active:border-b-amber-700.[&[data-loading="true"]:active]:border-t-amber-600.[&[data-loading="true"]:active]:border-l-amber-600.[&[data-loading="true"]:active]:border-r-amber-900.[&[data-loading="true"]:active]:border-b-amber-900.[&[data-loading="true"]:active]:dark:border-t-amber-500.[&[data-loading="true"]:active]:dark:border-l-amber-500.[&[data-loading="true"]:active]:dark:border-r-amber-700.[&[data-loading="true"]:active]:dark:border-b-amber-700`.split(`.`),"solid-danger":`bg-red-800.dark:bg-red-600.text-white.hover:bg-red-950.dark:hover:bg-red-700.active:bg-red-900.dark:active:bg-red-700.disabled:active:bg-red-800.dark:disabled:active:bg-red-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-red-600.border-l-red-600.border-r-red-900.border-b-red-900.dark:border-t-red-500.dark:border-l-red-500.dark:border-r-red-700.dark:border-b-red-700.active:border-t-red-900.active:border-l-red-900.active:border-r-red-600.active:border-b-red-600.dark:active:border-t-red-700.dark:active:border-l-red-700.dark:active:border-r-red-500.dark:active:border-b-red-500.disabled:active:border-t-red-600.disabled:active:border-l-red-600.disabled:active:border-r-red-900.disabled:active:border-b-red-900.dark:disabled:active:border-t-red-500.dark:disabled:active:border-l-red-500.dark:disabled:active:border-r-red-700.dark:disabled:active:border-b-red-700.[&[data-loading="true"]:active]:border-t-red-600.[&[data-loading="true"]:active]:border-l-red-600.[&[data-loading="true"]:active]:border-r-red-900.[&[data-loading="true"]:active]:border-b-red-900.[&[data-loading="true"]:active]:dark:border-t-red-500.[&[data-loading="true"]:active]:dark:border-l-red-500.[&[data-loading="true"]:active]:dark:border-r-red-700.[&[data-loading="true"]:active]:dark:border-b-red-700`.split(`.`),"ghost-action":[`bg-transparent`,`text-neutral-800`,`dark:text-neutral-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-200`,`active:bg-gray-50`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`active:text-gray-900`,`dark:active:text-white`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-mint-hover`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-action":[`bg-transparent`,`text-neutral-800`,`dark:text-neutral-400`,`hover:text-neutral-950`,`dark:hover:text-neutral-200`,`active:text-neutral-900`,`dark:active:text-neutral-300`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-300`,`hover:text-gray-900`,`dark:hover:text-gray-100`,`active:text-gray-950`,`dark:active:text-gray-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`hover:text-blue-950`,`dark:hover:text-blue-300`,`active:text-blue-900`,`dark:active:text-blue-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`hover:text-amber-950`,`dark:hover:text-amber-300`,`active:text-amber-900`,`dark:active:text-amber-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`hover:text-red-950`,`dark:hover:text-red-300`,`active:text-red-900`,`dark:active:text-red-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`]},s=o[`${t}-${a}`]||o[`solid-neutral`],c=[...i,...s];if(this.isActive()){let e=this.getActiveStateClasses();c.push(...e)}return this.isFullWidth()&&c.push(`w-full`),c.join(` `)}render(){this._disconnectHostChildObserver(),this._button&&!this._button.isConnected&&(this._button=null);try{let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`),r=this.isLoading();if(r)if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),`render`in n&&typeof n.render==`function`&&n.render();else{let e=document.createElement(`span`);e.className=`mr-2 inline-flex items-center`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.className===`mr-2`&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();if(a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),r?a.style.display=`none`:a.style.display=``,a.classList.remove(`mr-1.5`,`ml-1.5`),c?a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`)):o===`left`?a.classList.add(`mr-1.5`):a.classList.add(`ml-1.5`)),r){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(c?(e.classList.remove(`mr-2`),e.classList.add(`mr-0`)):e.classList.contains(`mr-2`)||(e.classList.remove(`mr-0`),e.classList.add(`mr-2`)))}let l=this.getButtonClasses();this._button.className=l,this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),r?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}finally{queueMicrotask(()=>{this.isConnected&&this._connectHostChildObserver()})}}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||customElements.define(`mint-button`,r);var i=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`icon`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._button=null,this._checked=!1}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}_getSwitchContainer(){let e=this.querySelector(`.mint-switch-container`);return e||(e=document.createElement(`div`),e.className=`mint-switch-container flex items-center gap-2`,this.insertBefore(e,this.firstChild)),e}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this.render()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getIcon(){return this.getAttribute(`icon`)||``}hasIcon(){return!!this.getIcon()}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getSwitchClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`cursor-pointer`,`rounded-full`,`h-5`,`w-10`,`border`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-neutral-900`,`dark:bg-neutral-700`,e?`border-red-300 dark:border-red-300`:`border-neutral-800 dark:border-neutral-600`]:[`bg-neutral-200`,`dark:bg-neutral-600`,e?`border-red-300 dark:border-red-300`:`border-neutral-300 dark:border-neutral-500`];return[...t,...n].join(` `)}getThumbClasses(){let e=[`relative`,`inline-block`,`rounded-full`,`bg-white`,`dark:bg-gray-50`,`h-4`,`w-4`,`shadow-lg`,`transform`,`transition-transform`,`duration-200`,`ease-in-out`,`pointer-events-none`,`overflow-hidden`],t=this._checked?`translate-x-5`:`translate-x-0.5`;return[...e,t].join(` `)}getIconClasses(){return[`absolute`,`inset-0`,`flex`,`items-center`,`justify-center`,`pointer-events-none`].join(` `)}render(){let e=this.isLoading(),t=this.getSwitchClasses(),n=this.getThumbClasses(),r=this.getLabel(),i=this.getInfo(),a=this.getIcon(),o=this.getAttribute(`id`)||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute(`id`)||this.setAttribute(`id`,o);let s=this._getSwitchContainer();this._button?this._button.parentElement!==s&&s.appendChild(this._button):(this._button=document.createElement(`button`),s.appendChild(this._button),this.setupEventListeners());let c=s.querySelector(`.mint-switch-label`);r?(c||(c=document.createElement(`label`),c.className=`mint-switch-label cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,this._button&&this._button.parentElement===s?s.insertBefore(c,this._button.nextSibling):s.appendChild(c)),c.textContent=r,c.setAttribute(`for`,o),this.isDisabled()?(c.classList.add(`opacity-40`,`cursor-not-allowed`),c.classList.remove(`cursor-pointer`)):(c.classList.remove(`opacity-40`,`cursor-not-allowed`),c.classList.add(`cursor-pointer`))):c&&c.remove(),this._button.className=t,this._button.disabled=this.isDisabled(),this._button.id=o,this._button.setAttribute(`aria-checked`,String(this._checked)),this._button.setAttribute(`aria-label`,r||`Toggle switch`),this._button.setAttribute(`role`,`switch`),this._button.type=`button`;let l=this._button.querySelector(`span`);l||(l=document.createElement(`span`),this._button.appendChild(l)),l.className=n;let u=l.querySelector(`span`);if(a){let e=u;e||(e=document.createElement(`span`),e.className=this.getIconClasses(),l.appendChild(e));let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a)}else u&&u.remove();let d=this.querySelector(`.mint-switch-info`);i?(d||(d=document.createElement(`span`),d.className=`mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block`,s&&s.parentElement===this?this.insertBefore(d,s.nextSibling):this.appendChild(d)),d.textContent=i,this.isDisabled()?d.classList.add(`opacity-40`):d.classList.remove(`opacity-40`)):d&&d.remove(),this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this._button&&this._button.addEventListener(`click`,this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener(`click`,this.handleToggle.bind(this))}handleToggle(e){if(!this.isDisabled()){this.checked=!this._checked;let e=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(e){let t=this._getSwitchContainer(),n=this.getLabel(),r=this.getInfo(),i=t.querySelector(`.mint-switch-skeleton-container`),a=this.querySelector(`.mint-switch-info-skeleton`);if(e){t.classList.contains(`relative`)||t.classList.add(`relative`),i||(i=document.createElement(`div`),i.className=`mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,t.appendChild(i));let e=i.querySelector(`.mint-switch-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,i.appendChild(e)),n){let e=i.querySelector(`.mint-switch-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,i.appendChild(e))}else{let e=i.querySelector(`.mint-switch-skeleton-label`);e&&e.remove()}i.style.display=`flex`,this._button&&(this._button.style.visibility=`hidden`,this._button.style.pointerEvents=`none`);let o=t.querySelector(`.mint-switch-label`);if(o&&(o.style.visibility=`hidden`,o.style.pointerEvents=`none`),r){a||(a=document.createElement(`div`),a.className=`mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-mint-hover animate-pulse mt-2`,t&&t.parentElement===this?this.insertBefore(a,t.nextSibling):this.appendChild(a)),a.style.display=`block`;let e=this.querySelector(`.mint-switch-info`);e&&(e.style.display=`none`)}else a&&(a.style.display=`none`)}else{i&&(i.style.display=`none`),a&&(a.style.display=`none`),this._button&&(this._button.style.visibility=`visible`,this._button.style.pointerEvents=`auto`);let e=t.querySelector(`.mint-switch-label`);e&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`);let n=this.querySelector(`.mint-switch-info`);n&&(n.style.display=``)}}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-switch-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._button&&(this._button.className=this.getSwitchClasses())}};customElements.get(`mint-switch`)||customElements.define(`mint-switch`,i);var a=class extends HTMLElement{static get observedAttributes(){return[`variant`,`size`,`bold`,`underline`,`strike`,`italic`,`display`,`inline`]}constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(e=>this._userClasses.add(e))}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}getVariant(){return this.getAttribute(`variant`)||`default`}getSize(){return this.getAttribute(`size`)||`regular`}isBold(){return this.getAttribute(`bold`)===`true`}isUnderline(){return this.getAttribute(`underline`)===`true`}isStrike(){return this.getAttribute(`strike`)===`true`}isItalic(){return this.getAttribute(`italic`)===`true`}getDisplay(){return this.getAttribute(`display`)||(this.getAttribute(`inline`)===`true`?`inline-block`:`block`)}getTextClasses(){let e=this.getSize(),t=this.getVariant(),n=document.documentElement.classList.contains(`dark`),r={heading:[`font-semibold`],"sub-heading":[`font-medium`],regular:[]},i={default:n?[`text-gray-100`]:[`text-gray-900`],muted:[`text-gray-400`],danger:n?[`text-red-400`]:[`text-red-600`],success:n?[`text-green-400`]:[`text-green-600`]},a=[];this.isBold()&&a.push(`font-bold`),this.isUnderline()&&a.push(`underline`),this.isStrike()&&a.push(`line-through`),this.isItalic()&&a.push(`italic`);let o=this.getDisplay();return[o===`block`?`block`:o===`inline`?`inline`:`inline-block`,...r[e]||r.regular,...i[t]||i.default,...a].join(` `)}render(){let e=this.getSize(),t=[`text-gray-100`,`text-gray-900`,`text-gray-400`,`text-red-400`,`text-red-600`,`text-green-400`,`text-green-600`],n=[`text-2xl`,`text-lg`,`text-sm`];n.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)}),t.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)});let r=this.getTextClasses().split(` `).filter(e=>e.trim());Array.from(this.classList).forEach(e=>{!t.includes(e)&&!n.includes(e)&&this._userClasses.add(e)}),this.className=[...new Set([...r,...Array.from(this._userClasses)])].join(` `);let i={heading:`clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)`,"sub-heading":`clamp(1rem, 1.5vw + 0.5rem, 1.125rem)`,regular:`clamp(0.875rem, 1vw + 0.5rem, 0.875rem)`},a=i[e]||i.regular;this.style.setProperty(`font-size`,a)}};customElements.get(`mint-text`)||customElements.define(`mint-text`,a);var o=class extends HTMLElement{static get observedAttributes(){return[`direction`,`text-align`,`gap`,`align-content`]}constructor(){super(),this._childObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`text-align`&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{let e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&=(this._childObserver.disconnect(),null)}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`;return parseFloat(e)}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`start`||e===`end`||e===`middle`?e:``}getStackClasses(){let e=this.getDirection(),t=this.getTextAlign(),n=this.getGap(),r=this.getAlignContent(),i=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${n}`];return r&&(e===`horizontal`?r===`start`?i.push(`justify-start`):r===`end`?i.push(`justify-end`):i.push(`justify-center`):r===`start`?i.push(`items-start`):r===`end`?i.push(`items-end`):i.push(`items-center`)),t&&(i.push(`text-${t}`),i.push(`[&>*]:text-${t}`),i.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?(i.push(`[&>mint-button]:!justify-start`),i.push(`[&>mint-button>button]:!justify-start`)):t===`right`?(i.push(`[&>mint-button]:!justify-end`),i.push(`[&>mint-button>button]:!justify-end`)):t===`center`&&(i.push(`[&>mint-button]:!justify-center`),i.push(`[&>mint-button>button]:!justify-center`))),i.join(` `)}render(){let e=this.getStackClasses(),t=this.getTextAlign();`flex,flex-row,flex-col,gap-1,gap-2,gap-3,gap-4,gap-5,gap-6,gap-7,gap-8,gap-9,gap-10,gap-11,gap-12,items-start,items-end,items-center,justify-start,justify-end,justify-center,text-left,text-center,text-right,text-justify,[&>*]:text-left,[&>*]:text-center,[&>*]:text-right,[&>*]:text-justify,[&>*_.mint-button-content]:text-left,[&>*_.mint-button-content]:text-center,[&>*_.mint-button-content]:text-right,[&>*_.mint-button-content]:text-justify,[&>mint-button]:!justify-start,[&>mint-button]:!justify-center,[&>mint-button]:!justify-end,[&>mint-button>button]:!justify-start,[&>mint-button>button]:!justify-center,[&>mint-button>button]:!justify-end`.split(`,`).forEach(e=>this.classList.remove(e)),e.split(` `).forEach(e=>{e&&this.classList.add(e)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(t=>{if(t.tagName===`MINT-BUTTON`){let n=t.querySelector(`button`);if(n){n.classList.remove(`justify-start`,`justify-center`,`justify-end`),e===`left`?n.classList.add(`justify-start`):e===`right`?n.classList.add(`justify-end`):e===`center`&&n.classList.add(`justify-center`);let t=n.querySelector(`.mint-button-content`);t&&(t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`))}}else t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(e=>{if(e.tagName===`MINT-BUTTON`){let t=e.querySelector(`button`);if(t){t.classList.remove(`justify-start`,`justify-end`),t.classList.add(`justify-center`);let e=t.querySelector(`.mint-button-content`);e&&e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)}}else e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)})}};customElements.get(`mint-stack`)||customElements.define(`mint-stack`,o);var s=`mint-sortable-placeholder`,c=`mint-sortable-dragging`;function l(e,t,n,r){let i=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${Number.isFinite(n)?Math.min(12,Math.max(1,Math.round(n))):3}`,`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`min-w-0`];return r&&(e===`horizontal`?r===`left`?i.push(`justify-start`):r===`right`?i.push(`justify-end`):i.push(`justify-center`):r===`left`?i.push(`items-start`):r===`right`?i.push(`items-end`):i.push(`items-center`)),t&&(i.push(`text-${t}`),i.push(`[&>*]:text-${t}`),i.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?i.push(`[&>mint-button]:!justify-start`,`[&>mint-button>button]:!justify-start`):t===`right`?i.push(`[&>mint-button]:!justify-end`,`[&>mint-button>button]:!justify-end`):t===`center`&&i.push(`[&>mint-button]:!justify-center`,`[&>mint-button>button]:!justify-center`)),i}var u=class extends HTMLElement{static get observedAttributes(){return[`direction`,`gap`,`text-align`,`align-content`,`scroll-max-height`,`disabled`,`handle-selector`,`scroll-sensitivity`,`scroll-speed`,`animation-duration`,`item-key-attribute`]}constructor(){super(),this._pointerId=null,this._dragEl=null,this._placeholder=null,this._listRoot=this,this._startIndex=0,this._pointerStartX=0,this._pointerStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._scrollRaf=null,this._childObserver=null,this._pointerBoundRoot=null,this._restoreAfter=null,this._onListPointerDown=e=>{let t=e;if(this._isDisabled()||this._pointerId!==null||t.button!==0)return;let n=t.target;if(!n||!this.contains(n))return;let r=this._closestSortableItem(n);if(!r||!this._listRoot.contains(r)||r.hasAttribute(`data-sortable-disabled`))return;let i=this._getHandleSelector();if(i){let e=t.target.closest(i);if(!e||!r.contains(e))return}t.preventDefault(),this._startDrag(t,r)},this._boundPointerMove=this._onPointerMove.bind(this),this._boundPointerUp=this._onPointerUp.bind(this),this._boundPointerCancel=this._onPointerCancel.bind(this)}connectedCallback(){this.classList.add(`relative`,`block`),this._syncInnerStackAttributes(),this._applyHostScrollAndLayout(),this._observeInnerStack()}disconnectedCallback(){this._unobserveInnerStack(),this._teardownDrag(),this._pointerBoundRoot&&=(this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),null)}attributeChangedCallback(e,t,n){t!==n&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}_observeInnerStack(){this._childObserver||(this._childObserver=new MutationObserver(()=>{this._pointerId===null&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}),this._childObserver.observe(this,{childList:!0}))}_unobserveInnerStack(){this._childObserver&&=(this._childObserver.disconnect(),null)}_getInnerStack(){for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-STACK`)return t}return null}_resolveListRoot(){return this._getInnerStack()??this}_getItemKeyAttribute(){return this.getAttribute(`item-key-attribute`)?.trim()||`data-sortable-id`}_collectOrderedKeys(){let e=this._resolveListRoot(),t=this._getItemKeyAttribute(),n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r];if(i.nodeType!==Node.ELEMENT_NODE)continue;let a=i;a.classList.contains(s)||n.push(a.getAttribute(t)??``)}return n}_syncInnerStackAttributes(){let e=this._getInnerStack();if(!e)return;let t=this.getDirection(),n=this.getGap(),r=this.getTextAlign();e.setAttribute(`direction`,t),e.setAttribute(`gap`,String(n)),r?e.setAttribute(`text-align`,r):e.removeAttribute(`text-align`);let i=this.getAlignContent();i?e.setAttribute(`align-content`,i):e.removeAttribute(`align-content`)}_applyHostScrollAndLayout(){this._listRoot=this._resolveListRoot();let e=this.getAttribute(`scroll-max-height`);e?(this.style.maxHeight=e,this.style.overflowY=`auto`,this.style.overflowX=`hidden`,this.classList.add(`overscroll-y-contain`)):(this.style.maxHeight=``,this.style.overflowY=``,this.style.overflowX=``,this.classList.remove(`overscroll-y-contain`));let t=this._getInnerStack();this._stripHostLayoutClasses(),t||l(this.getDirection(),this.getTextAlign(),this.getGap(),this.getAlignContent()).forEach(e=>{e&&this.classList.add(e)}),this._ensureListPointerBinding()}_stripHostLayoutClasses(){Array.from(this.classList).filter(e=>e===`flex`||e===`flex-row`||e===`flex-col`||e.startsWith(`gap-`)||e===`items-start`||e===`items-end`||e===`items-center`||e===`justify-start`||e===`justify-end`||e===`justify-center`||e.startsWith(`text-`)||e.startsWith(`[&`)).forEach(e=>this.classList.remove(e))}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`,t=parseFloat(e);return Number.isFinite(t)?t:3}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`left`||e===`right`||e===`center`?e:``}_isDisabled(){return this.hasAttribute(`disabled`)&&this.getAttribute(`disabled`)!==`false`}_getHandleSelector(){let e=this.getAttribute(`handle-selector`);return e&&e.trim()?e.trim():null}_getScrollSensitivity(){let e=parseFloat(this.getAttribute(`scroll-sensitivity`)||`48`);return Number.isFinite(e)?e:48}_getScrollSpeed(){let e=parseFloat(this.getAttribute(`scroll-speed`)||`12`);return Number.isFinite(e)?e:12}_getAnimationDurationMs(){let e=parseFloat(this.getAttribute(`animation-duration`)||`220`);return Number.isFinite(e)?Math.max(0,e):220}_ensureListPointerBinding(){let e=this._resolveListRoot();this._pointerBoundRoot!==e&&(this._pointerBoundRoot&&this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),e.addEventListener(`pointerdown`,this._onListPointerDown),this._pointerBoundRoot=e,this._listRoot=e)}_closestSortableItem(e){let t=e;for(;t&&t!==this._listRoot;){if(t.nodeType===Node.ELEMENT_NODE){let e=t;if(e.classList.contains(s)||e.classList.contains(c))return null;if(t.parentElement===this._listRoot)return e}t=t.parentElement}return null}_startDrag(e,t){this._listRoot=this._resolveListRoot(),this._restoreAfter=t.nextElementSibling,this._dragEl=t,this._pointerId=e.pointerId,this._startIndex=this._indexOfItem(t);let n=t.getBoundingClientRect();this._pointerStartX=e.clientX,this._pointerStartY=e.clientY,this._dragStartLeft=n.left,this._dragStartTop=n.top;let r=document.createElement(`div`);r.className=[s,`box-border`,`shrink-0`,`rounded-lg`,`border-2`,`border-dashed`,`border-gray-300`,`bg-gray-50/80`,`dark:border-mint-divider`,`dark:bg-mint-hover/40`].join(` `),r.style.minHeight=`${n.height}px`,r.style.minWidth=`${n.width}px`,r.setAttribute(`aria-hidden`,`true`),this._placeholder=r,this._listRoot.insertBefore(r,t),t.classList.add(c),t.style.position=`fixed`,t.style.left=`${n.left}px`,t.style.top=`${n.top}px`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,t.style.margin=`0`,t.style.zIndex=`10000`,t.style.boxSizing=`border-box`,t.style.pointerEvents=`none`,t.style.touchAction=`none`,t.style.willChange=`transform, left, top`,t.setPointerCapture(e.pointerId);let i=this._collectOrderedKeys(),a={index:this._startIndex,keys:i};this.dispatchEvent(new CustomEvent(`mint-sortable-start`,{bubbles:!0,composed:!0,detail:a})),this.dispatchEvent(new CustomEvent(`sort-start`,{bubbles:!0,composed:!0,detail:a})),window.addEventListener(`pointermove`,this._boundPointerMove,{passive:!1}),window.addEventListener(`pointerup`,this._boundPointerUp),window.addEventListener(`pointercancel`,this._boundPointerCancel)}_indexOfItem(e){let t=0;for(let n=0;n<this._listRoot.children.length;n++){let r=this._listRoot.children[n];if(r.nodeType!==Node.ELEMENT_NODE)continue;let i=r;if(!i.classList.contains(s)){if(i===e)return t;t++}}return-1}_getLayoutChildren(){return Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE)}_onPointerMove(e){if(e.pointerId!==this._pointerId||!this._dragEl||!this._placeholder)return;e.preventDefault();let t=e.clientX-this._pointerStartX,n=e.clientY-this._pointerStartY;this._dragEl.style.left=`${this._dragStartLeft+t}px`,this._dragEl.style.top=`${this._dragStartTop+n}px`,this._autoScroll(e),this._maybeMovePlaceholder(e)}_autoScroll(e){let t=this;if(!t.style.maxHeight)return;let n=this._getScrollSensitivity(),r=this._getScrollSpeed(),i=t.getBoundingClientRect();this._scrollRaf!==null&&cancelAnimationFrame(this._scrollRaf),this._scrollRaf=requestAnimationFrame(()=>{this._scrollRaf=null;let a=0;e.clientY<i.top+n?a=-r:e.clientY>i.bottom-n&&(a=r),a!==0&&(t.scrollTop+=a,this._maybeMovePlaceholder(e))})}_maybeMovePlaceholder(e){let t=this._placeholder,n=this._dragEl;if(!t||!n)return;let r=this.getDirection()===`horizontal`,i=r?e.clientX:e.clientY,a=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n&&e!==t),o=null;for(let e of a){let t=e.getBoundingClientRect();if(i<(r?t.left+t.width/2:t.top+t.height/2)){o=e;break}}let s=Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n),c=s.length>0&&s[s.length-1]===t;(o?!(t.nextSibling===o&&t.parentNode===this._listRoot):!c)&&this._flipAnimate(()=>{o?this._listRoot.insertBefore(t,o):this._listRoot.appendChild(t)})}_flipAnimate(e){let t=this._dragEl,n=this._getAnimationDurationMs(),r=this._getLayoutChildren().filter(e=>e!==t),i=new Map;r.forEach(e=>i.set(e,e.getBoundingClientRect())),e(),!(n<=0)&&r.forEach(e=>{let t=i.get(e);if(!t)return;let r=e.getBoundingClientRect(),a=t.left-r.left,o=t.top-r.top;Math.abs(a)<.5&&Math.abs(o)<.5||(e.style.transition=`none`,e.style.transform=`translate(${a}px, ${o}px)`,requestAnimationFrame(()=>{e.style.transition=`transform ${n}ms cubic-bezier(0.2, 0.8, 0.2, 1)`,e.style.transform=``;let t=()=>{e.removeEventListener(`transitionend`,t),e.style.transition=``,e.style.transform=``};e.addEventListener(`transitionend`,t,{once:!0}),setTimeout(t,n+40)}))})}_onPointerUp(e){e.pointerId===this._pointerId&&this._finishDrag(!1)}_onPointerCancel(e){e.pointerId===this._pointerId&&this._finishDrag(!0)}_finishDrag(e){let t=this._dragEl,n=this._placeholder;if(!t||this._pointerId===null){this._teardownDrag();return}try{t.releasePointerCapture(this._pointerId)}catch{}if(window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),e){let e=this._restoreAfter;e&&e.parentNode===this._listRoot?this._listRoot.insertBefore(t,e):this._listRoot.appendChild(t)}else n?.parentNode&&this._listRoot.insertBefore(t,n);n?.remove(),this._placeholder=null,t.classList.remove(c),t.style.cssText=``;let r=this._indexOfItem(t),i=this._startIndex;this._pointerId=null,this._dragEl=null,this._restoreAfter=null;let a=this._collectOrderedKeys(),o={oldIndex:i,newIndex:r,cancelled:e,keys:a};this.dispatchEvent(new CustomEvent(`mint-sortable-end`,{bubbles:!0,composed:!0,detail:o})),this.dispatchEvent(new CustomEvent(`sort-stop`,{bubbles:!0,composed:!0,detail:o})),!e&&r!==i&&(this.dispatchEvent(new CustomEvent(`mint-sortable-change`,{bubbles:!0,composed:!0,detail:{oldIndex:i,newIndex:r,keys:a}})),this.dispatchEvent(new CustomEvent(`mint-sortable-order`,{bubbles:!0,composed:!0,detail:{keys:a}})))}_teardownDrag(){if(this._scrollRaf!==null&&(cancelAnimationFrame(this._scrollRaf),this._scrollRaf=null),window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),this._dragEl){try{this._pointerId!==null&&this._dragEl.releasePointerCapture(this._pointerId)}catch{}this._dragEl.classList.remove(c),this._dragEl.style.cssText=``}this._placeholder?.remove(),this._placeholder=null,this._dragEl=null,this._pointerId=null,this._restoreAfter=null}};customElements.get(`mint-sortable`)||customElements.define(`mint-sortable`,u);var d=class extends HTMLElement{static get observedAttributes(){return[`heading`]}constructor(){super(),this._headingElement=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}hasPaddingClass(){return Array.from(this.classList).some(e=>/^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e))}render(){this.classList.add(`rounded-lg`,`shadow`,`bg-white`,`dark:bg-mint-elevated`,`border`,`border-gray-200`,`dark:border-mint-divider`),this.hasPaddingClass()||this.classList.add(`p-4`);let e=this.getHeading();e?(this._headingElement||(this._headingElement=document.createElement(`mint-text`),this._headingElement.setAttribute(`size`,`sub-heading`),this.insertBefore(this._headingElement,this.firstChild)),this._headingElement.textContent=e):this._headingElement&&this._headingElement.parentNode&&(this._headingElement.remove(),this._headingElement=null)}};customElements.get(`mint-card`)||customElements.define(`mint-card`,d);var f=class extends HTMLElement{static get observedAttributes(){return[`href`,`target`]}constructor(){super(),this._link=null,this._contentObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._observeContent()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHref(){return this.getAttribute(`href`)||`#`}getTarget(){return this.getAttribute(`target`)||``}hasIcon(){return!!(this.querySelector(`mint-icon`)||this._link?.querySelector(`mint-icon`))}render(){let e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement(`a`);this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t===`_blank`&&(this._link.rel=`noopener noreferrer`)):(this._link.removeAttribute(`target`),this._link.removeAttribute(`rel`));let n=this.hasIcon(),r=[`text-slate-800`,`dark:text-slate-200`,`underline`,`hover:text-slate-950`,`dark:hover:text-slate-100`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`rounded`];n&&r.push(`inline-flex`,`items-center`,`gap-2`),this._link.className=r.join(` `),this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)})}};customElements.get(`mint-link`)||customElements.define(`mint-link`,f);var p=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._button=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`,`flex`,`items-center`,`justify-center`),this.render()}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this.render()}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}_getTargetUrl(){let e=document.referrer,t=window.location.origin;if(e)try{let n=new URL(e);if(n.origin===t)return n.pathname+n.search}catch{}return this.getFallbackHref()}handleClick(e){e.preventDefault(),e.stopPropagation();let t=this._getTargetUrl(),n=document.referrer,r=n&&(()=>{try{return new URL(n).origin===window.location.origin}catch{return!1}})(),i=new CustomEvent(`back`,{detail:{url:t,isFromReferrer:r,referrer:n||null,fallbackHref:this.getFallbackHref()},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};customElements.get(`mint-back-button`)||customElements.define(`mint-back-button`,p);var m=class extends HTMLElement{static get observedAttributes(){return[`heading`,`fallback-href`,`show-back-button`,`containered`]}constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null,this._contentObserver=null,this._backButton=null,this._backButtonHandler=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this._observeDarkMode(),this._observeContentMutations(),this._setupBackButtonListener()}attributeChangedCallback(e,t,n){t!==n&&(e===`containered`&&this._applyContainerClasses(),this.render())}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._removeBackButtonListener()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}render(){let e=this.getHeading();this._pageContainer||(this._pageContainer=document.createElement(`div`),this.appendChild(this._pageContainer)),this._applyContainerClasses(),this._header||(this._header=document.createElement(`div`),this._header.className=`flex justify-between mb-8`,this._pageContainer.appendChild(this._header)),this._titleElement||(this._titleElement=document.createElement(`div`),this._titleElement.className=`flex gap-4 min-w-0 flex-1`,this._header.appendChild(this._titleElement));let t=this._titleElement.querySelector(`mint-back-button`);if(this.shouldShowBackButton()){t||(t=document.createElement(`mint-back-button`),this._titleElement.insertBefore(t,this._titleElement.firstChild));let e=this.getFallbackHref();t.setAttribute(`fallback-href`,e),this._backButton=t}else t&&(t.remove(),t=null,this._backButton=null);e?(this._headingText?(this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._headingText.previousSibling!==t&&this._titleElement.insertBefore(this._headingText,t.nextSibling):this._headingText.previousSibling&&this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)):(this._headingText=document.createElement(`mint-text`),this._headingText.setAttribute(`size`,`heading`),this._headingText.setAttribute(`bold`,`true`),this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,t.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=e):this._headingText&&=(this._headingText.remove(),null),this._actionsSlot?this._actionsSlot.classList.contains(`ml-4`)||this._actionsSlot.classList.add(`ml-4`):(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`flex gap-2 items-center ml-4`,this._actionsSlot.setAttribute(`slot`,`actions`),this._header.appendChild(this._actionsSlot)),Array.from(this.children).filter(e=>e!==this._pageContainer&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{this._actionsSlot&&e.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(e)}),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(e=>{e!==this._pageContainer&&e.getAttribute(`slot`)!==`actions`&&e!==this._actionsSlot&&e!==this._header&&e!==this._bodySlot&&e!==this._headingText&&e.parentElement!==this._bodySlot&&e.parentElement!==this._pageContainer&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add(`p-5`),this.getAttribute(`containered`)===`true`?this._pageContainer.classList.add(`max-w-6xl`,`mx-auto`,`w-full`):this._pageContainer.classList.remove(`max-w-6xl`,`mx-auto`,`w-full`))}_updateBackgroundColor(){this._pageContainer&&(document.documentElement.classList.contains(`dark`)?(this._pageContainer.classList.remove(`bg-gray-20`),this._pageContainer.classList.add(`bg-mint-canvas`)):(this._pageContainer.classList.remove(`bg-mint-canvas`),this._pageContainer.classList.add(`bg-gray-20`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_setupBackButtonListener(){this._backButtonHandler||=e=>{let t=e.target;if(t&&t.tagName===`MINT-BACK-BUTTON`){e.stopPropagation();let t=new CustomEvent(`back`,{detail:e.detail,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t)}},this.addEventListener(`back`,this._backButtonHandler,!0)}_removeBackButtonListener(){this._backButtonHandler&&=(this.removeEventListener(`back`,this._backButtonHandler,!0),null)}};customElements.get(`mint-page`)||customElements.define(`mint-page`,m);var h=class extends HTMLElement{static get observedAttributes(){return[`columns`,`sm`,`md`,`lg`,`xl`,`gap`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getColumns(){return this.getAttribute(`columns`)||`1`}getSm(){return this.getAttribute(`sm`)}getMd(){return this.getAttribute(`md`)}getLg(){return this.getAttribute(`lg`)}getXl(){return this.getAttribute(`xl`)}getGap(){return`3`}getGridClasses(){let e=[`grid`],t=this.getColumns();e.push(`grid-cols-${t}`);let n=this.getSm();n&&e.push(`sm:grid-cols-${n}`);let r=this.getMd();r&&e.push(`md:grid-cols-${r}`);let i=this.getLg();i&&e.push(`lg:grid-cols-${i}`);let a=this.getXl();a&&e.push(`xl:grid-cols-${a}`);let o=this.getGap();return e.push(`gap-${o}`),e}render(){Array.from(this.classList).filter(e=>e.startsWith(`grid-cols-`)||e.startsWith(`sm:grid-cols-`)||e.startsWith(`md:grid-cols-`)||e.startsWith(`lg:grid-cols-`)||e.startsWith(`xl:grid-cols-`)||e.startsWith(`gap-`)).forEach(e=>this.classList.remove(e)),this.classList.contains(`grid`)||this.classList.add(`grid`),this.getGridClasses().forEach(e=>{e&&e!==`grid`&&this.classList.add(e)})}};customElements.get(`mint-grid`)||customElements.define(`mint-grid`,h);var g=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null,this._contentObserver=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`inset-0`,`z-[120]`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._observeDarkMode(),this._observeContentMutations()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`fixed inset-0 bg-black/50 transition-opacity duration-200 z-[120]`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-[130]`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transform`,this._modal.appendChild(e)),this._animateEnter()}else this._animateExit();let r=this._modal.querySelector(`.modal-content`);r||(r=document.createElement(`div`),r.className=`modal-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transform`,this._modal.appendChild(r)),this._header||(this._header=document.createElement(`div`),this._header.className=`flex items-center justify-between p-4 border-b border-gray-200 dark:border-mint-divider`,r.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`flex-1`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let i=this._headingSlot.querySelector(`mint-text`);t?(i||(i=document.createElement(`mint-text`),i.setAttribute(`size`,`sub-heading`),i.setAttribute(`bold`,`true`),this._headingSlot.appendChild(i)),i.textContent=t):i&&i.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-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=`flex-1 overflow-y-auto p-4`,this._bodySlot.setAttribute(`slot`,`body`),r.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),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`),r.appendChild(this._actionsSlot));let a=this._actionsSlot.querySelector(`mint-stack`);a||(a=document.createElement(`mint-stack`),a.setAttribute(`direction`,`horizontal`),a.className=`justify-end`,this._actionsSlot.appendChild(a)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==a&&a.appendChild(e)}),e.parentElement&&e.remove()}),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;let e=document.documentElement.classList.contains(`dark`),t=this._modal.querySelector(`.modal-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-mint-elevated`,`border`,`border-mint-divider`)):(t.classList.remove(`bg-mint-elevated`,`border`,`border-mint-divider`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,this.classList.remove(`hidden`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})}))}_animateExit(){let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`hidden`);return}e.style.transition=`opacity 200ms ease-in, transform 200ms ease-in`,e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,setTimeout(()=>{this.classList.add(`hidden`),e.style.transform=``,e.style.opacity=``,e.style.transition=``},200)}};customElements.get(`mint-modal`)||customElements.define(`mint-modal`,g);var _=class extends HTMLElement{static get observedAttributes(){return[`id`,`direction`,`open`,`trigger-id`,`padding`,`hover`,`distance`]}constructor(){super(),this._overlay=null,this._popover=null,this._triggerElement=null,this._darkModeObserver=null,this._clickOutsideHandler=null,this._triggerClickHandler=null,this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._hoverCloseTimeout=null,this._scrollHandler=null,this._resizeHandler=null}connectedCallback(){let e=this._isInsideModal()?`z-[60]`:`z-50`;this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`top-0`,`left-0`,e,`pointer-events-none`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._setupTrigger(),this._observeDarkMode()}_ownsNode(e){return e?!!(this.contains(e)||this._triggerElement?.contains(e)):!1}_isInsideModal(){let e=this;for(;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}if(this._triggerElement)for(e=this._triggerElement;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}return!1}disconnectedCallback(){this._removeHoverListeners(),this._overlay?.remove(),this._popover?.remove(),this._overlay=null,this._popover=null,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&this._triggerElement.removeAttribute(`active`),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}attributeChangedCallback(e,t,n){if(t!==n){if(this.isConnected){let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this.classList.remove(`z-50`,`z-[60]`,`z-[80]`),this.classList.add(e)}this.render(),(e===`trigger-id`||e===`hover`)&&this._setupTrigger(),e===`open`&&this.isOpen()&&this._closeOtherPopovers()}}getId(){return this.getAttribute(`id`)||``}getPadding(){let e=this.getAttribute(`padding`)||`4`;return{0:`p-0`,"0.5":`p-0.5`,1:`p-1`,"1.5":`p-1.5`,2:`p-2`,"2.5":`p-2.5`,3:`p-3`,"3.5":`p-3.5`,4:`p-4`,5:`p-5`,6:`p-6`,8:`p-8`,10:`p-10`,12:`p-12`,16:`p-16`,20:`p-20`,24:`p-24`}[e]||`p-4`}getDirection(){return this.getAttribute(`direction`)||`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}getDistance(){return(this.getAttribute(`distance`)||``).trim()}_getDistancePx(){let e=this.getDistance();if(!e)return 8;let t=e.match(/^(-?\d*\.?\d+)\s*(px|rem)$/i);if(!t)return 8;let n=parseFloat(t[1]),r=t[2].toLowerCase();if(!Number.isFinite(n))return 8;let i=Math.max(0,n);if(r===`px`)return i;let a=parseFloat(getComputedStyle(document.documentElement).fontSize||`16`);return i*(Number.isFinite(a)?a:16)}isHoverEnabled(){return this.getAttribute(`hover`)===`true`}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_setupTrigger(){let e=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),e&&(this._triggerElement=document.getElementById(e),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(e),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){let e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.getAttribute(`open`)===`true`?e.removeAttribute(`open`):e.setAttribute(`open`,`true`)},this._triggerElement.addEventListener(`click`,this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();let e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._triggerElement.addEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement.addEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){e._cancelHoverClose()},this._popoverHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._popover.addEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover.addEventListener(`mouseleave`,this._popoverHoverLeaveHandler))}_removeHoverListeners(){this._triggerElement&&this._triggerHoverEnterHandler&&this._triggerElement.removeEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement&&this._triggerHoverLeaveHandler&&this._triggerElement.removeEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&this._popoverHoverEnterHandler&&this._popover.removeEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover&&this._popoverHoverLeaveHandler&&this._popover.removeEventListener(`mouseleave`,this._popoverHoverLeaveHandler),this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._cancelHoverClose()}_scheduleHoverClose(){this._cancelHoverClose(),this._hoverCloseTimeout=window.setTimeout(()=>{this._isHovering()||this.close()},120)}_cancelHoverClose(){this._hoverCloseTimeout!==null&&(clearTimeout(this._hoverCloseTimeout),this._hoverCloseTimeout=null)}_isHovering(){let e=this._triggerElement?this._triggerElement.matches(`:hover`):!1,t=this._popover?this._popover.matches(`:hover`):!1;return e||t}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:`down`};let e=this._triggerElement.getBoundingClientRect(),t=this._popover.querySelector(`.popover-content`);if(!t)return{top:0,left:0,direction:`down`};this.classList.contains(`hidden`)&&(this.classList.remove(`hidden`),this._popover.style.visibility=`hidden`);let n=t.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=this._getDistancePx(),o=this.getDirection(),s=0,c=0;switch(o){case`down`:if(s=e.bottom+a,c=e.left+e.width/2-n.width/2,s+n.height>i){let t=e.top-n.height-a;t>=0?(o=`up`,s=t):(s=Math.max(0,i-n.height-a),s+n.height>i&&(s=0))}c<0&&(c=a),c+n.width>r&&(c=Math.max(a,r-n.width-a),c+n.width>r&&(c=r-n.width));break;case`up`:if(s=e.top-n.height-a,c=e.left+e.width/2-n.width/2,s<0){let t=e.bottom+a;t+n.height<=i?(o=`down`,s=t):(s=Math.min(i-n.height-a,i-n.height),s<0&&(s=i-n.height))}c<0&&(c=a),c+n.width>r&&(c=Math.max(a,r-n.width-a),c+n.width>r&&(c=r-n.width));break;case`right`:if(s=e.top+e.height/2-n.height/2,c=e.right+a,c+n.width>r){let t=e.left-n.width-a;t>=0?(o=`left`,c=t):(c=Math.max(0,r-n.width-a),c+n.width>r&&(c=r-n.width))}s<0&&(s=a),s+n.height>i&&(s=Math.max(a,i-n.height-a),s+n.height>i&&(s=i-n.height));break;case`left`:if(s=e.top+e.height/2-n.height/2,c=e.left-n.width-a,c<0){let t=e.right+a;t+n.width<=r?(o=`right`,c=t):(c=Math.min(r-n.width-a,r-n.width),c<0&&(c=0))}s<0&&(s=a),s+n.height>i&&(s=Math.max(a,i-n.height-a),s+n.height>i&&(s=i-n.height));break}return{top:s,left:c,direction:o}}render(){let e=this.getId(),t=this.isOpen(),n=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove(`hidden`),this.style.pointerEvents=`auto`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.setAttribute(`active`,`true`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),!this._clickOutsideHandler){let e=this;this._clickOutsideHandler=function(t){let n=t.composedPath(),r=n.some(t=>t===e?!0:t instanceof Node?e._ownsNode(t):!1);if(!(e._triggerElement&&n.includes(e._triggerElement))&&!r){e.close();return}},setTimeout(()=>{document.addEventListener(`click`,this._clickOutsideHandler,!1)},100)}}else this.classList.add(`hidden`),this.style.pointerEvents=`none`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.removeAttribute(`active`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null);if(this._overlay){let e=this._isInsideModal()?`z-[75]`:`z-[55]`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this._overlay.parentElement!==this&&this.appendChild(this._overlay)}else{this._overlay=document.createElement(`div`);let e=this._isInsideModal()?`z-[75]`:`z-[55]`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this.appendChild(this._overlay)}if(this._popover){let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this._popover.className=`fixed ${e} pointer-events-auto`,this._popover.parentElement!==this&&this.appendChild(this._popover)}else{this._popover=document.createElement(`div`);let e=this._isInsideModal()?`z-[80]`:`z-[60]`;this._popover.className=`fixed ${e} pointer-events-auto`,this.appendChild(this._popover)}this.isHoverEnabled()&&this._attachHoverListeners();let r=this._popover.querySelector(`.popover-content`);if(!r)r=document.createElement(`div`),r.className=`popover-content bg-white dark:bg-mint-elevated border border-gray-200 dark:border-mint-divider rounded-lg shadow-xl ${n} transform`,this._popover.appendChild(r);else{let e=r.className.split(/\s+/).filter(Boolean),t=[`p-0`,`p-0.5`,`p-1`,`p-1.5`,`p-2`,`p-2.5`,`p-3`,`p-3.5`,`p-4`,`p-5`,`p-6`,`p-8`,`p-10`,`p-12`,`p-16`,`p-20`,`p-24`],i=e.filter(e=>!t.includes(e)),a=[`border`,`border-gray-200`,`dark:border-mint-divider`],o=[...i];for(let e of a)o.includes(e)||o.push(e);r.className=[...o,n].join(` `)}Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._popover&&e.parentElement===this&&r.appendChild(e)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(r):(this._popover.style.top=`50%`,this._popover.style.left=`50%`,this._popover.style.transform=`translate(-50%, -50%)`,this._popover.style.visibility=`visible`,this._popover.style.display=`block`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,r.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.transform=`scale(1) translateY(0)`,r.style.opacity=`1`})}))):!t&&r&&(this._removePositionListeners(),r.style.opacity!==`0`&&r.style.opacity!==``&&(r.style.transition=`opacity 200ms ease-in, transform 200ms ease-in`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,setTimeout(()=>{r.style.transform=``,r.style.opacity=``,r.style.transition=``,this._popover.style.visibility=``,this._popover.style.display=``},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;let e=document.documentElement.classList.contains(`dark`),t=this._popover.querySelector(`.popover-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-mint-elevated`)):(t.classList.remove(`bg-mint-elevated`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_updatePosition(e){if(!this._triggerElement||!this._popover)return;let t=this._popover.style.visibility!==`hidden`;t||(this._popover.style.visibility=`hidden`,this._popover.style.display=`block`,this._popover.style.top=`0`,this._popover.style.left=`0`),this._popover.offsetHeight;let n=this._calculatePosition();this._popover.style.top=`${n.top}px`,this._popover.style.left=`${n.left}px`,t||(this._popover.style.visibility=`visible`,e&&(!e.style.opacity||e.style.opacity===``)&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){let e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`scroll`,this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){let e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`resize`,this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_closeOtherPopovers(){Array.from(document.querySelectorAll(`mint-popover[open]`)).forEach(e=>{if(e!==this){let t=e;typeof t.close==`function`?t.close():e.removeAttribute(`open`)}})}};customElements.get(`mint-popover`)||customElements.define(`mint-popover`,_);var v=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`error`,`error-message`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null,this._changeHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-flex`,`items-start`,`gap-2`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render(),e===`checked`&&this._checkbox&&this.updateVisualState()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`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`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getCheckboxClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`justify-center`,`flex-shrink-0`,`w-5`,`h-5`,`rounded`,`border-2`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`cursor-pointer`,`disabled:opacity-40`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-neutral-800`,`dark:bg-neutral-600`,e?`border-red-300 dark:border-red-300`:`border-neutral-800 dark:border-neutral-600`]:[`bg-white`,`dark:bg-mint-elevated`,e?`border-red-300 dark:border-red-300`:`border-gray-300 dark:border-gray-500`];return[...t,...n].join(` `)}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-container`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-container relative inline-flex items-start gap-2`,this.insertBefore(i,this.firstChild));let a=this.querySelector(`.mint-checkbox-wrapper`);a?a.parentElement!==i&&i.appendChild(a):(a=document.createElement(`div`),a.className=`mint-checkbox-wrapper`,i.appendChild(a)),this._checkbox?this._checkbox.parentElement!==a&&a.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,a.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,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 o=this.getId();o?this._checkbox.id=o:this._checkbox.removeAttribute(`id`);let s=this.getName();s?this._checkbox.name=s:this._checkbox.removeAttribute(`name`);let c=this.getValue();c?this._checkbox.value=c:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),a.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,a.style.cursor=`pointer`,a.style.pointerEvents=`auto`,this._checkbox.style.pointerEvents=`auto`;let l=a;l._wrapperClickHandler||(l._wrapperClickHandler=e=>{e.target===a&&!r&&(e.preventDefault(),e.stopPropagation(),this.toggle())},a.addEventListener(`click`,l._wrapperClickHandler));let u=a.querySelector(`mint-icon`);u||(u=document.createElement(`mint-icon`),u.setAttribute(`name`,`check`),u.className=`w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto`,u.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,u.style.zIndex=`1`,a.appendChild(u)),this.updateVisualState();let d=this.querySelector(`.mint-checkbox-label-container`),f=this.querySelector(`.mint-checkbox-container`);if(t||n){d?f&&d.parentElement!==f&&f.appendChild(d):(d=document.createElement(`div`),d.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,f?f.appendChild(d):this.appendChild(d));let e=d.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none`,d.insertBefore(e,d.firstChild)),e.textContent=t,r?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let i=d.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none`,d.appendChild(i)),i.textContent=n,r?i.classList.add(`opacity-40`):i.classList.remove(`opacity-40`)):i&&i.remove(),r)d.style.cursor=`default`,d._clickHandler&&(d.removeEventListener(`click`,d._clickHandler),d._clickHandler=null);else{d.style.cursor=`pointer`;let e=d._clickHandler;e&&d.removeEventListener(`click`,e),d._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},d.addEventListener(`click`,d._clickHandler)}}else d&&d.remove();this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState();let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0}));let n=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(n)},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=`rgb(38 38 38)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(64 64 64)`:t.style.backgroundColor=`rgb(48 48 48)`))},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._focusHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(`:focus-visible`)&&t?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{let e=this.querySelector(`.mint-checkbox-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._checkbox.addEventListener(`focus`,this._focusHandler),this._checkbox.addEventListener(`blur`,this._blurHandler),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=`rgb(38 38 38)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(64 64 64)`:t.style.backgroundColor=`rgb(48 48 48)`))},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),this._focusHandler&&=(this._checkbox.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._checkbox.removeEventListener(`blur`,this._blurHandler),null));let e=this.querySelector(`.mint-checkbox-wrapper`);if(e){let t=e;t._wrapperClickHandler&&=(e.removeEventListener(`click`,t._wrapperClickHandler),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.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState(),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0}));let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}_renderSkeleton(e){let t=this.querySelector(`.mint-checkbox-skeleton-container`),n=this.querySelector(`.mint-checkbox-container`),r=this.querySelector(`.mint-checkbox-wrapper`),i=this.querySelector(`.mint-checkbox-label-container`);if(e){t||(t=document.createElement(`div`),t.className=`mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-checkbox-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e)),i){let e=t.querySelector(`.mint-checkbox-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e))}t.style.display=`flex`,r&&(r.style.visibility=`hidden`,r.style.pointerEvents=`none`),i&&(i.style.visibility=`hidden`,i.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.visibility=`visible`,r.style.pointerEvents=`auto`),i&&(i.style.visibility=`visible`,i.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-checkbox-label-container`);!n&&e&&t&&(n=document.createElement(`div`),n.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,this.appendChild(n));let r=this.querySelector(`.mint-checkbox-error`);e&&t?(r?(r.classList.add(`block`,`w-full`),r.style.display=`block`,(n&&r.parentElement!==n||n&&r.parentElement===n)&&n.appendChild(r)):(r=document.createElement(`div`),r.className=`mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full`,r.style.display=`block`,n?n.appendChild(r):this.appendChild(r)),r.textContent=t):r&&r.remove();let i=this.querySelector(`.mint-checkbox-wrapper`);i&&(i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`)}};customElements.get(`mint-checkbox`)||customElements.define(`mint-checkbox`,v);var y=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`,`loading`,`info`]}constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._clickHandler=null,this._focusHandler=null,this._blurHandler=null,this._keydownHandler=null}connectedCallback(){this.classList.add(`inline-flex`,`items-start`,`gap-2`,`cursor-pointer`,`select-none`);let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render(),this._setupClickHandler()}disconnectedCallback(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null),this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._focusHandler&&=(this._radio.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._radio.removeEventListener(`blur`,this._blurHandler),null),this._keydownHandler&&=(this._radio.removeEventListener(`keydown`,this._keydownHandler),null))}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._radio&&(this._radio.checked=this._checked),this._updateVisualState()),t!==n){if(e===`loading`){this.render();return}if(e===`info`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{this._checked=!!e,e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._radio&&(this._radio.checked=this._checked),this.isConnected?requestAnimationFrame(()=>{this._updateVisualState()}):this._updateVisualState()}catch{}}getValue(){return this.getAttribute(`value`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){let e=this.getAttribute(`disabled`)===`true`,t=this.closest(`mint-choice`)?.getAttribute(`disabled`)===`true`;return e||t}_setupClickHandler(){this._clickHandler||(this._clickHandler=e=>{e.target!==this._radio&&(this.isDisabled()||this._radio&&(this._radio.click(),requestAnimationFrame(()=>{if(this._radio&&this._radio.checked!==this._checked){this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let e=this.closest(`mint-choice`);e&&e.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))}})))},this.addEventListener(`click`,this._clickHandler))}render(){let e=this.isLoading(),t=this.isDisabled(),n=this.getValue(),r=this.closest(`mint-choice`)?.getAttribute(`name`)||``,i=``,a=this.querySelector(`.mint-choice-option-label`);if(a)i=a.textContent?.trim()||``;else{let e=this.querySelector(`.mint-choice-option-label-container`);Array.from(this.childNodes).forEach(t=>{if(t!==e&&t.nodeType===Node.TEXT_NODE){let e=t.textContent?.trim();e&&(i+=e)}})}let o=this.querySelectorAll(`.mint-choice-option-wrapper`),s=null;o.length>0&&(this._radio&&(s=Array.from(o).find(e=>e.contains(this._radio))),s||=o[0],o.forEach((e,t)=>{e!==s&&e.remove()})),s||(s=document.createElement(`div`),s.className=`mint-choice-option-wrapper`,s.style.position=`relative`,this.insertBefore(s,this.firstChild)),s.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`,s.style.position=`relative`,this.querySelectorAll(`input[type="radio"]`).forEach(e=>{e!==this._radio&&e.remove()}),this._radio?(this._radio.parentElement!==s&&s.appendChild(this._radio),this._radio&&this._changeHandler&&(this._radio.removeEventListener(`change`,this._changeHandler),this._radio.addEventListener(`change`,this._changeHandler)),this._radio&&(this._focusHandler||=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._blurHandler||=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._keydownHandler||=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.removeEventListener(`focus`,this._focusHandler),this._radio.removeEventListener(`blur`,this._blurHandler),this._radio.removeEventListener(`keydown`,this._keydownHandler),this._radio.addEventListener(`focus`,this._focusHandler),this._radio.addEventListener(`blur`,this._blurHandler),this._radio.addEventListener(`keydown`,this._keydownHandler))):(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`sr-only`,this._radio.style.position=`absolute`,this._radio.style.width=`1px`,this._radio.style.height=`1px`,this._radio.style.padding=`0`,this._radio.style.margin=`-1px`,this._radio.style.overflow=`hidden`,this._radio.style.clip=`rect(0, 0, 0, 0)`,this._radio.style.whiteSpace=`nowrap`,this._radio.style.border=`0`,s.appendChild(this._radio),this._changeHandler=e=>{let t=this._checked;this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let n=this.closest(`mint-choice`);t!==this._checked&&n&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))},0)},this._radio.addEventListener(`change`,this._changeHandler),this._radio.addEventListener(`click`,()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState())}),this._focusHandler=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`focus`,this._focusHandler),this._blurHandler=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`blur`,this._blurHandler),this._keydownHandler=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.addEventListener(`keydown`,this._keydownHandler)),this._radio.name=r,this._radio.value=n,this._radio.checked===this._checked?this._radio.checked=this._checked:(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`)),this._radio.disabled=t,t?this._radio.setAttribute(`tabindex`,`-1`):this._radio.removeAttribute(`tabindex`),i?this._radio.setAttribute(`aria-label`,i):this._radio.removeAttribute(`aria-label`),s.querySelectorAll(`.mint-choice-option-indicator`).forEach((e,t)=>{t>0&&e.remove()});let c=s.querySelector(`.mint-choice-option-indicator`);c||(c=document.createElement(`div`),c.className=`mint-choice-option-indicator`,s.appendChild(c)),c.className=`mint-choice-option-indicator w-2 h-2 rounded-full bg-white pointer-events-none`,c.style.position=`absolute`,c.style.top=`50%`,c.style.left=`50%`,c.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`,c.style.opacity=this._checked?`1`:`0`,this._updateVisualState(),this._renderSkeleton(e);let l=this.getInfo(),u=this.querySelector(`.mint-choice-option-label-container`);if(i||l){u||(u=document.createElement(`div`),u.className=`mint-choice-option-label-container flex flex-col gap-0.5`,this.appendChild(u),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.textContent?.trim()&&e!==u&&(e.textContent=``)}));let e=u.querySelector(`.mint-choice-option-label`);i?(e||(e=document.createElement(`span`),e.className=`mint-choice-option-label`,u.appendChild(e)),e.className=`mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t?`opacity-40`:``}`,e.textContent=i):e&&e.remove();let n=u.querySelector(`.mint-choice-option-info`);l?(n||(n=document.createElement(`span`),n.className=`mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none`,u.appendChild(n)),n.textContent=l,t?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else u&&u.remove();t?(this.classList.add(`cursor-not-allowed`),this.classList.remove(`cursor-pointer`)):(this.classList.add(`cursor-pointer`),this.classList.remove(`cursor-not-allowed`)),this._updateVisualState()}_getWrapperClasses(){let e=this.isDisabled(),t=[`inline-flex`,`items-center`,`justify-center`,`w-[1rem]`,`h-[1rem]`,`rounded-full`,`border-2`,`flex-shrink-0`,`mt-0.5`];return e&&t.push(`opacity-40`,`cursor-not-allowed`),this._checked?t.push(`bg-slate-800`,`dark:bg-slate-600`,`border-slate-800`,`dark:border-slate-600`):t.push(`bg-white`,`dark:bg-mint-elevated`,`border-gray-300`,`dark:border-gray-500`),t.join(` `)}_updateVisualState(){let e=this.querySelector(`.mint-choice-option-wrapper`);e&&(e.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`);let t=this.querySelector(`.mint-choice-option-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-option-skeleton-container`),n=this.querySelector(`.mint-choice-option-wrapper`);if(e){t||(t=document.createElement(`div`),t.className=`mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-choice-option-skeleton-radio`);if(e||(e=document.createElement(`div`),e.className=`mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,t.appendChild(e)),t.style.display=`flex`,n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`hidden`),t&&(t.style.visibility=`hidden`),n.style.pointerEvents=`none`}}else{if(t&&(t.style.display=`none`),n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`visible`),t&&(t.style.visibility=`visible`),n.style.pointerEvents=`auto`}let e=this.querySelector(`.mint-choice-option-label`);e&&!n?.contains(e)&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`)}}_updateGroupState(){this._radio?.name&&document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`).forEach(e=>{if(e===this._radio)return;let t=e.closest(`mint-choice-option`);t&&t!==this&&(t._checked=e.checked,e.checked?t.setAttribute(`checked`,`true`):t.removeAttribute(`checked`),t._updateVisualState())})}_focusNextOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>=0&&t<e.length-1?n=e[t+1]:e.length>0&&(n=e[0]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}_focusPreviousOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>0?n=e[t-1]:e.length>0&&(n=e[e.length-1]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}};customElements.get(`mint-choice-option`)||customElements.define(`mint-choice-option`,y);var b=class extends HTMLElement{static get observedAttributes(){return[`label`,`name`,`info`,`error`,`error-message`,`id`,`disabled`,`required`,`loading`]}constructor(){super(),this._optionsContainer=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.addEventListener(`choice-change`,e=>{let t=e.detail?.value||this.getValue();(this.getAttribute(`value`)||``)!==t&&(t?this.setAttribute(`value`,t):this.removeAttribute(`value`));let n=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0}))})}disconnectedCallback(){}isLoading(){return this.hasAttribute(`loading`)}attributeChangedCallback(e,t,n){t!==n&&(e===`error`||e===`error-message`?this._renderErrorState():e===`loading`?(this.render(),this.querySelectorAll(`mint-choice-option`).forEach(e=>{this.isLoading()?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`)})):(this.render(),e===`name`&&this.querySelectorAll(`mint-choice-option`).forEach(e=>{typeof e.render==`function`&&e.render()})))}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}getValue(){return this.querySelector(`input[type="radio"]:checked`)?.value||``}setValue(e){let t=this.querySelectorAll(`mint-choice-option`);t.forEach(t=>{if((t.getAttribute(`value`)||``)===e){let e=t;e.checked=!0;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!0,n.dispatchEvent(new Event(`change`,{bubbles:!0})))}else{let e=t;e.checked=!1;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!1)}}),requestAnimationFrame(()=>{t.forEach(e=>{typeof e._updateVisualState==`function`&&e._updateVisualState();let t=e.querySelector(`input[type="radio"]`);if(t){let n=e;t.checked!==n.checked&&(t.checked=n.checked)}})})}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getId()||`mint-choice-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute(`id`,r);let i=this.isDisabled(),a=this.querySelector(`.mint-choice-label-container`);if(t||n){a||(a=document.createElement(`div`),a.className=`mint-choice-label-container flex flex-col gap-0.5 mb-2`,this.insertBefore(a,this.firstChild));let e=a.querySelector(`.mint-choice-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,a.insertBefore(e,a.firstChild)),e.textContent=t,e.setAttribute(`for`,r),i?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let o=a.querySelector(`.mint-choice-info`);n?(o||(o=document.createElement(`span`),o.className=`mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none`,a.appendChild(o)),o.textContent=n,i?o.classList.add(`opacity-40`):o.classList.remove(`opacity-40`)):o&&o.remove()}else a&&a.remove();let o=this.querySelector(`.mint-choice-options-wrapper`);if(!o){o=document.createElement(`div`),o.className=`mint-choice-options-wrapper relative`;let e=this.querySelector(`.mint-choice-label-container`);e&&e.parentElement===this?this.insertBefore(o,e.nextSibling):this.insertBefore(o,this.firstChild)}this._optionsContainer?this._optionsContainer.parentElement!==o&&o.appendChild(this._optionsContainer):(this._optionsContainer=document.createElement(`div`),this._optionsContainer.className=`mint-choice-options-container flex flex-col gap-3`,o.appendChild(this._optionsContainer)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==this._optionsContainer).forEach(e=>{this._optionsContainer.appendChild(e)}),this._renderErrorState(),this._renderSkeleton(e)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-skeleton-container`),n=this.querySelector(`.mint-choice-options-wrapper`),r=this.querySelector(`.mint-choice-options-container`);if(e){if(t||(t=document.createElement(`div`),t.className=`mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t))),t.querySelectorAll(`.mint-choice-option-skeleton`).length===0)for(let e=0;e<3;e++){let e=document.createElement(`div`);e.className=`mint-choice-option-skeleton flex items-center gap-3`;let n=document.createElement(`div`);n.className=`flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-mint-hover animate-pulse`,e.appendChild(n);let r=document.createElement(`div`);r.className=`h-4 w-20 rounded bg-gray-200 dark:bg-mint-hover animate-pulse`,e.appendChild(r),t.appendChild(e)}t.style.display=`flex`,r&&(r.style.opacity=`0`,r.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.opacity=`1`,r.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-choice-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}};customElements.get(`mint-choice`)||customElements.define(`mint-choice`,b);var x=class extends HTMLElement{static get observedAttributes(){return[`type`,`placeholder`,`value`,`disabled`,`id`,`name`,`required`,`readonly`,`rows`,`icon`,`label`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._prependSlotContainer=null,this._appendSlotContainer=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._slotResizeObserver=null,this._slotMutationObserver=null,this._contentObserver=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null,this._renderFrame=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._observeContentMutations()}disconnectedCallback(){this.removeEventListeners(),this._slotResizeObserver&&=(this._slotResizeObserver.disconnect(),null),this._slotMutationObserver&&=(this._slotMutationObserver.disconnect(),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(e===`loading`){this.render();return}this.render()}}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}getType(){return this.getAttribute(`type`)||`text`}getRows(){let e=this.getAttribute(`rows`);return e?parseInt(e,10):3}_getNormalizedType(){let e=this.getType();return e===`datetime`?`datetime-local`:e===`money`?`text`:e===`textarea`?`textarea`:e}_isTextarea(){return this.getType()===`textarea`}_isMoney(){return this.getType()===`money`}_isColor(){return this.getType()===`color`}_isNumber(){return this.getType()===`number`}getPlaceholder(){return this.getAttribute(`placeholder`)||``}getValue(){return this._isColor()?this._colorTextInput?this._colorTextInput.value:this._colorPicker?this._colorPicker.value:this.getAttribute(`value`)||`#000000`:this._element?this._element.value:this.getAttribute(`value`)||``}set value(e){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||`#000000`),this._colorTextInput&&(this._colorTextInput.value=e||`#000000`)):this._element&&(this._element.value=e),e?this.setAttribute(`value`,e):this.removeAttribute(`value`)}catch{}}get value(){try{return this.getValue()||``}catch{return``}}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getIcon(){return this.getAttribute(`icon`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getInputClasses(){let e=this._isTextarea(),t=!!this.getIcon(),n=this.querySelector(`[slot="prepend"]`)!==null,r=this.querySelector(`[slot="append"]`)!==null,i=this._isColor(),a=this._isNumber(),o=this.hasError(),s=[`w-full`,t||i||n?`pl-10`:`px-3.5`,r?`pr-10`:t||i?`pr-3.5`:a?`pr-10`:``,e?`py-2`:`py-1.5`,e?`min-h-[6rem]`:`min-h-[2rem]`,`text-base`,`min-[1100px]:text-sm`,`font-medium`,`rounded-lg`,`box-border`,`bg-white`,`dark:bg-mint-elevated`,`text-gray-900`,`dark:text-white`,`outline-none`,`focus:outline-none`,`disabled:opacity-40`,`disabled:cursor-not-allowed`,`readonly:cursor-default`,e?`resize-y`:``,a?`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`:``],c=[`border-2`,o?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`],l=[`focus-visible:ring-2`,`focus-visible:ring-offset-1`,o?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`];return[...s,...c,...l].filter(Boolean).join(` `)}_syncSlotAdornments(e,t){if(!this._wrapper||e||this._isColor()){this._prependSlotContainer&&=(this._prependSlotContainer.remove(),null),this._appendSlotContainer&&=(this._appendSlotContainer.remove(),null),this._clearAdornmentPadding();return}this._prependSlotContainer||(this._prependSlotContainer=document.createElement(`div`),this._prependSlotContainer.className=`mint-input-prepend-slot absolute top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto`,this._wrapper.appendChild(this._prependSlotContainer)),this._appendSlotContainer||(this._appendSlotContainer=document.createElement(`div`),this._appendSlotContainer.className=`mint-input-append-slot absolute right-3 top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto`,this._wrapper.appendChild(this._appendSlotContainer)),this._prependSlotContainer.classList.remove(`left-3`,`left-10`),this._prependSlotContainer.classList.add(t?`left-10`:`left-3`);let n=Array.from(this.querySelectorAll(`[slot="prepend"]`)),r=Array.from(this.querySelectorAll(`[slot="append"]`));this._prependSlotContainer.replaceChildren(),this._appendSlotContainer.replaceChildren(),n.forEach(e=>this._prependSlotContainer.appendChild(e)),r.forEach(e=>this._appendSlotContainer.appendChild(e)),this._prependSlotContainer.classList.toggle(`hidden`,n.length===0),this._appendSlotContainer.classList.toggle(`hidden`,r.length===0),this._ensureSlotObservers(),this._applyAdornmentPadding(t)}_clearAdornmentPadding(){this._element&&(this._element.style.removeProperty(`padding-left`),this._element.style.removeProperty(`padding-right`)),this._colorTextInput&&(this._colorTextInput.style.removeProperty(`padding-left`),this._colorTextInput.style.removeProperty(`padding-right`))}_applyAdornmentPadding(e){this._element&&requestAnimationFrame(()=>{if(this._element){if(this._prependSlotContainer&&!this._prependSlotContainer.classList.contains(`hidden`)){let t=(e?40:12)+this._prependSlotContainer.offsetWidth+8;this._element.style.paddingLeft=`${t}px`}else this._element.style.removeProperty(`padding-left`);if(this._appendSlotContainer&&!this._appendSlotContainer.classList.contains(`hidden`)){let e=12+this._appendSlotContainer.offsetWidth+8;this._element.style.paddingRight=`${e}px`}else this._element.style.removeProperty(`padding-right`)}})}_ensureSlotObservers(){!this._prependSlotContainer&&!this._appendSlotContainer||(this._slotResizeObserver||=new ResizeObserver(()=>{this._applyAdornmentPadding(!!this.getIcon())}),this._slotResizeObserver.disconnect(),this._prependSlotContainer&&this._slotResizeObserver.observe(this._prependSlotContainer),this._appendSlotContainer&&this._slotResizeObserver.observe(this._appendSlotContainer),this._slotMutationObserver||=new MutationObserver(()=>{this._applyAdornmentPadding(!!this.getIcon())}),this._slotMutationObserver.disconnect(),this._prependSlotContainer&&this._slotMutationObserver.observe(this._prependSlotContainer,{childList:!0,subtree:!0,characterData:!0}),this._appendSlotContainer&&this._slotMutationObserver.observe(this._appendSlotContainer,{childList:!0,subtree:!0,characterData:!0}))}isLoading(){return this.getAttribute(`loading`)===`true`}render(){this.getType();let e=this._getNormalizedType(),t=this._isTextarea(),n=this._isMoney(),r=this._isColor(),i=this.getPlaceholder(),a=this.isDisabled(),o=this.isReadonly(),s=this.isRequired(),c=this.getId(),l=this.getName(),u=this.getAttribute(`value`)||(r?`#000000`:``),d=this.getRows(),f=this.getIcon(),p=this.getLabel(),m=this.getInfo(),h=this.isLoading();if(this._renderSkeleton(h),r){this._input&&=(this._input.remove(),null),this._textarea&&=(this._textarea.remove(),null),this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&=(this._colorContainer.remove(),null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement(`div`),this._colorPickerWrapper.className=`mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,this._colorPickerWrapper.style.backgroundColor=u||`#000000`,this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement(`input`),this._colorPicker.type=`color`,this._colorPicker.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._colorPicker.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;`,this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=e=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&requestAnimationFrame(()=>{this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&this._colorPickerWrapper?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._colorPicker.addEventListener(`focus`,this._focusHandler),this._colorPicker.addEventListener(`blur`,this._blurHandler),this._colorPicker.addEventListener(`input`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&(this._colorTextInput.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener(`change`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement(`input`),this._colorTextInput.type=`text`,this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=i||`#000000`,this._colorTextInput.pattern=`^#[0-9A-Fa-f]{6}$`,this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener(`input`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)&&(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener(`blur`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)?(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this._colorPicker?.value||`#000000`},bubbles:!0,cancelable:!0}))}));let e=u||`#000000`;if(this._colorPicker&&this._colorPicker.value!==e&&(this._colorPicker.value=e),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&this._colorTextInput.value!==e&&(this._colorTextInput.value=e),this._colorPicker&&(this._colorPicker.disabled=a),this._colorPickerWrapper&&(a?(this._colorPickerWrapper.classList.add(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.remove(`cursor-pointer`)):(this._colorPickerWrapper.classList.remove(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.add(`cursor-pointer`))),this._colorTextInput&&(this._colorTextInput.disabled=a,this._colorTextInput.readOnly=o,this._colorTextInput.required=s),this._colorTextInput){let e=this._colorTextInput;c?e.id=c:e.removeAttribute(`id`),l?e.name=l:e.removeAttribute(`name`),e.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._element=e}this._renderErrorState();let t=this.querySelector(`.mint-input-label-container`);if(p||m){t||(t=document.createElement(`div`),t.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(t,this._wrapper):this.insertBefore(t,this.firstChild));let e=t.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,t.insertBefore(e,t.firstChild)),e.textContent=p;let n=c||this._colorTextInput?.id;if(n)e.setAttribute(`for`,n);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._colorTextInput&&(this._colorTextInput.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let n=t.querySelector(`.mint-input-info`);m?(n||(n=document.createElement(`span`),n.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,t.appendChild(n)),n.textContent=m,a?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else t&&t.remove();return}if(this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),f&&!t?this._icon?this._icon.setAttribute(`name`,f):(this._icon=document.createElement(`mint-icon`),this._icon.setAttribute(`name`,f),this._icon.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none`,this._wrapper.appendChild(this._icon)):this._icon&&=(this._icon.remove(),null),this._syncSlotAdornments(t,!!f),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement(`div`),this._numberSpinnerContainer.className=`absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none`,this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement(`button`),this._numberIncrementButton.type=`button`,this._numberIncrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed pointer-events-auto bg-gray-100 dark:bg-mint-hover active:bg-gray-200 dark:active:bg-mint-elevated rounded`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`caret-up`),e.className=`w-[1rem] h-[1rem]`,this._numberIncrementButton.appendChild(e),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement(`button`),this._numberDecrementButton.type=`button`,this._numberDecrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed pointer-events-auto bg-gray-100 dark:bg-mint-hover active:bg-gray-200 dark:active:bg-mint-elevated rounded`;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`caret-down`),t.className=`w-[1rem] h-[1rem]`,this._numberDecrementButton.appendChild(t),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e+t;r!==void 0&&i>r&&(i=r),n!==void 0&&i<n&&(i=n),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}}),this._numberDecrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e-t;n!==void 0&&i<n&&(i=n),r!==void 0&&i>r&&(i=r),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=a||o),this._numberDecrementButton&&(this._numberDecrementButton.disabled=a||o)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&=(this._input.remove(),null),this._textarea||(this._textarea=document.createElement(`textarea`),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=i,this._textarea.disabled=a,this._textarea.readOnly=o,this._textarea.required=s,this._textarea.rows=d,this._textarea.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),u!==this._textarea.value&&(this._textarea.value=u),c?this._textarea.id=c:this._textarea.removeAttribute(`id`),l?this._textarea.name=l:this._textarea.removeAttribute(`name`),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._textarea.value&&(this._textarea.value=e.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&=(this._textarea.remove(),null),this._input||(this._input=document.createElement(`input`),this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=i,this._input.disabled=a,this._input.readOnly=o,this._input.required=s,this._input.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),n?(this._input.inputMode=`decimal`,this._input.pattern=`[0-9]*\\.?[0-9]*`):(this._input.removeAttribute(`inputmode`),this._input.removeAttribute(`pattern`)),u!==this._input.value&&(this._input.value=u),c?this._input.id=c:this._input.removeAttribute(`id`),l?this._input.name=l:this._input.removeAttribute(`name`),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._input.value&&(this._input.value=e.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(`.mint-input-label-container`);if(p||m){g||(g=document.createElement(`div`),g.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let e=g.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,g.insertBefore(e,g.firstChild)),e.textContent=p;let t=c||this._element?.id||this._colorTextInput?.id||this._input?.id||this._textarea?.id;if(t)e.setAttribute(`for`,t);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=t:this._colorTextInput?this._colorTextInput.id=t:this._input?this._input.id=t:this._textarea&&(this._textarea.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let t=g.querySelector(`.mint-input-info`);m?(t||(t=document.createElement(`span`),t.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,g.appendChild(t)),t.textContent=m,a?t.classList.add(`opacity-40`):t.classList.remove(`opacity-40`)):t&&t.remove()}else g&&g.remove();this._syncSlotAdornments(t,!!f),this._renderErrorState(),this._renderSkeleton(h)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-input-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-input-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}setupEventListeners(){this._element&&(this._element.addEventListener(`input`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`);let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener(`blur`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&=(this._colorPicker.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._colorPicker.removeEventListener(`blur`,this._blurHandler),null))}focus(){this._isColor()&&this._colorTextInput?this._colorTextInput.focus():this._element?.focus()}blur(){this._isColor()&&this._colorTextInput?this._colorTextInput.blur():this._element?.blur()}_renderSkeleton(e){let t=this.querySelector(`.mint-input-skeleton-container`),n=this._wrapper||this.querySelector(`.relative.w-full`);if(e){t||(t=document.createElement(`div`),t.className=`mint-input-skeleton-container absolute inset-0 z-10 pointer-events-none`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-input-skeleton`);if(!e){e=document.createElement(`div`),e.className=`mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-mint-hover animate-pulse`;let n=this._isTextarea(),r=this.getRows();if(n){let t=r*24+12;e.style.height=`${t}px`}else e.style.height=`2.2rem`;t.appendChild(e)}t.style.display=`block`,this._element&&(this._element.style.opacity=`0`,this._element.style.pointerEvents=`none`),this._colorTextInput&&(this._colorTextInput.style.opacity=`0`,this._colorTextInput.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),this._element&&(this._element.style.opacity=`1`,this._element.style.pointerEvents=`auto`),this._colorTextInput&&(this._colorTextInput.style.opacity=`1`,this._colorTextInput.style.pointerEvents=`auto`)}};customElements.get(`mint-input`)||customElements.define(`mint-input`,x);var S=class extends HTMLElement{static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`format`,`min`,`max`,`range`,`shortcuts`,`display-format`,`error`,`error-message`,`loading`,`selection-mode`,`week-start-day`,`mode`,`disabled-dates`]}constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode=`calendar`,this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._hoveredDate=null,this._isHandlingClick=!1,this._touchStartDate=null,this._touchStartElement=null,this._isTouchActive=!1,this._resizeObserver=null,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._removeFocusTrap(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){let e=this.hasError(),t=this.getErrorMessage();this._applyErrorVisuals(e,t,this.isDisabled());return}if(e===`loading`){this.render();return}if(e===`mode`||e===`format`){let e=this.getMode();e===`month`?this._viewMode=`month`:e===`year`?this._viewMode=`year`:this._viewMode=`calendar`,this._popover&&this._calendarContainer&&this._buildCalendar()}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?(this.setAttribute(`value`,e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute(`value`),this._textInput&&(this._textInput.value=``),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}getFormat(){return this.getAttribute(`format`)||`mm/dd/yyyy`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isRange(){return this.getAttribute(`range`)===`true`}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getMin(){return this.getAttribute(`min`)||``}getMax(){return this.getAttribute(`max`)||``}getDisabledDates(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{let t=JSON.parse(e),n=this.getFormat();return t.map(e=>this._parseDateString(e,n)).filter(e=>e!==null)}catch{return[]}}getDisabledDateStrings(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{return JSON.parse(e)}catch{return[]}}disableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=this._parseDateString(e,t);if(r){let e=this._formatDate(r,t);n.includes(e)||i.push(e)}}if(i.length>0){let e=[...n,...i];this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}enableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);i.push(e)}}if(i.length>0){let e=n.filter(e=>!i.includes(e));e.length===0?this.removeAttribute(`disabled-dates`):this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}getSelectionMode(){let e=this.getAttribute(`selection-mode`);return e===`week`||e===`month`?e:`day`}getMode(){let e=this.getAttribute(`mode`);if(e===`month`||e===`year`)return e;let t=this.getFormat().toLowerCase(),n=t.includes(`d`),r=t.includes(`m`);return!n&&!r?`year`:!n&&r?`month`:`default`}getWeekStartDay(){return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[this.getAttribute(`week-start-day`)?.toLowerCase()||`sunday`]??0}getDisplayFormat(){return this.getAttribute(`display-format`)||`F j, Y`}getShortcuts(){let e=this.getAttribute(`shortcuts`);if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>({label:e.label,action:this._createShortcutAction(e.action)}))}catch{let t=e.trim();if(t&&typeof window[t]==`function`){let e=window[t]();if(Array.isArray(e))return e.map(e=>({label:e.label,action:typeof e.action==`function`?e.action:this._createShortcutAction(e.action)}))}}return[]}_createShortcutAction(e){return typeof e==`function`?e:typeof e==`string`&&typeof window[e]==`function`?window[e]:()=>null}_getDefaultShortcuts(){let e=[{label:`Today`,action:()=>new Date}];return this._isRange&&e.push({label:`This Week`,action:()=>{let e=new Date,t=e.getDay(),n=new Date(e);n.setDate(e.getDate()-t),n.setHours(0,0,0,0);let r=new Date(n);return r.setDate(n.getDate()+6),r.setHours(23,59,59,999),{start:n,end:r}}},{label:`This Month`,action:()=>{let e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return n.setHours(23,59,59,999),{start:t,end:n}}}),e}_getFormatTokens(e){let t=[],n=0,r=e.toLowerCase();for(;n<r.length;){let i=r[n];if(i===`d`||i===`m`||i===`y`){let e=1,a=n+1;for(;a<r.length&&r[a]===i;)e++,a++;t.push({type:`part`,part:i,len:e}),n=a}else t.push({type:`sep`,value:e[n]}),n++}return t}_createPartInput(e,t,n,r,i){let a=document.createElement(`input`);return a.type=`text`,a.inputMode=`numeric`,a.pattern=`\\d*`,a.maxLength=e,a.placeholder=t,a.className=`bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed`,a.disabled=n||r,a.readOnly=r,a.required=i,e===4?a.className+=` w-[40px]`:e===2&&(a.className+=` w-[30px]`),a}_buildValueFromParts(e,t){let n=0;return t.map(t=>{if(t.type===`sep`)return t.value;let r=e[n]?.value||``;return n++,r}).join(``)}_applyDateToParts(e,t,n,r){if(!t.length)return;if(!e){t.forEach(e=>e.value=``);return}let i=this._formatDate(e,r),a=0,o=0;n.forEach(e=>{if(e.type===`sep`)a+=e.value.length;else{let n=i.substr(a,e.len);t[o]&&(t[o].value=n),o++,a+=e.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;let e=this.getFormat(),t=this._getFormatTokens(e),n=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){let e=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=e?`${n} - ${e}`:n}else this._hiddenInput.value=n}_focusNext(e,t){if(t+1<e.length){let n=e[t+1];n.focus(),n.setSelectionRange(0,n.value.length)}}_focusPrev(e,t){if(t-1>=0){let n=e[t-1];n.focus(),n.setSelectionRange(n.value.length,n.value.length)}}_attachPartInputHandlers(e,t,n){e.forEach((t,n)=>{let r=t.maxLength||2;t.addEventListener(`input`,()=>{t.value=t.value.replace(/\D/g,``).slice(0,r),t.value.length>=r&&this._focusNext(e,n),this._syncHiddenInput()}),t.addEventListener(`keydown`,r=>{r.key===`Backspace`&&t.selectionStart===0&&t.selectionEnd===0&&this._focusPrev(e,n),r.key===`ArrowLeft`&&t.selectionStart===0&&t.selectionEnd===0&&(this._focusPrev(e,n),r.preventDefault()),r.key===`ArrowRight`&&t.selectionStart===t.value.length&&t.selectionEnd===t.value.length&&(this._focusNext(e,n),r.preventDefault())}),t.addEventListener(`blur`,e=>{this._syncHiddenInput();let t=e.relatedTarget,n=t&&(this._startPartInputs.includes(t)||this._endPartInputs.includes(t));setTimeout(()=>{if(!(this._startPartInputs.some(e=>e===document.activeElement)||this._endPartInputs.some(e=>e===document.activeElement))&&(n||this._handleBlur(this._hiddenInput?.value||``),this._exitInputMode(),!n&&this._hiddenInput)){let t=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:e.relatedTarget});this._hiddenInput.dispatchEvent(t)}},0)})})}_splitRangeInput(e,t){let n=e.split(/\s*-\s*/);return n.length>=2?[n[0],n.slice(1).join(`-`)]:[e]}_parseValue(e){let t=this.getFormat(),n=this._getFormatTokens(t),r=this.getSelectionMode();if(this._isRange||r===`week`||r===`month`){let[r,i]=this._splitRangeInput(e,t),a=r?this._parseDateString(r,t):null,o=i?this._parseDateString(i,t):null;if(a&&o){let[e,t]=a<=o?[a,o]:[o,a];this._selectedStartDate=e,this._selectedEndDate=t,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else a&&(this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,n,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,n,t)}else{let r=this._parseDateString(e,t);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,n,t)):this._applyDateToParts(null,this._startPartInputs,n,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){let n=/[\/\-\.\s]+/;if(n.test(e)){let r=e.split(n).filter(e=>e.length>0),i=t.split(/[\/\-\.\s]+/).filter(e=>e.length>0);if(r.length===i.length){let e=0,t=0,n=0;for(let a=0;a<i.length;a++){let o=i[a].toLowerCase(),s=r[a];if(o.includes(`d`))e=parseInt(s,10);else if(o.includes(`m`))t=parseInt(s,10)-1;else if(o.includes(`y`)){let e=parseInt(s,10),t=o.length,r=s.length;(r===2&&t===4||r===2&&t===2)&&(e=Math.floor(new Date().getFullYear()/100)*100+e),n=e}}let a=i.some(e=>e.toLowerCase().includes(`d`)),o=i.some(e=>e.toLowerCase().includes(`m`));if(a||(e=1),o||(t=0),t>=0&&t<=11&&n){let r=new Date(n,t,e);if(!isNaN(r.getTime()))return a&&r.getDate()!==e||r.getMonth()!==t||r.getFullYear()!==n?null:r}}}let r=e.replace(/[\/\-\.]/g,``),i=t.replace(/[\/\-\.]/g,``).toLowerCase(),a=i.indexOf(`d`),o=i.indexOf(`m`),s=i.indexOf(`y`),c=[{char:`d`,index:a},{char:`m`,index:o},{char:`y`,index:s}].sort((e,t)=>e.index-t.index),l=0,u=0,d=0,f=0;i.length,r.length;for(let e of c)if(e.char===`d`){let e=i.lastIndexOf(`d`)-i.indexOf(`d`)+1,t=r.substr(f,e);if(t.length===0)return null;l=parseInt(t,10),f+=t.length}else if(e.char===`m`){let e=i.lastIndexOf(`m`)-i.indexOf(`m`)+1,t=r.substr(f,e);if(t.length===0)return null;u=parseInt(t,10)-1,f+=t.length}else if(e.char===`y`){let e=i.lastIndexOf(`y`)-i.indexOf(`y`)+1,t=r.substr(f),n=Math.min(e,t.length),a=t.substr(0,n);if(a.length===0)return null;let o=parseInt(a,10);(n===2&&e===4||n===2&&e===2)&&(o=Math.floor(new Date().getFullYear()/100)*100+o),d=o,f+=n}let p=t.toLowerCase(),m=p.includes(`d`),h=p.includes(`m`);if(m||(l=1),h||(u=0),u<0||u>11||!d)return null;let g=new Date(d,u,l);return isNaN(g.getTime())||m&&g.getDate()!==l||g.getMonth()!==u||g.getFullYear()!==d?null:g}_formatDate(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=t.toLowerCase(),o=t;return a.includes(`dd`)?o=o.replace(/dd/gi,String(n).padStart(2,`0`)):a.includes(`d`)&&(o=o.replace(/d/gi,String(n))),a.includes(`mm`)?o=o.replace(/mm/gi,String(r).padStart(2,`0`)):a.includes(`m`)&&(o=o.replace(/m/gi,String(r))),a.includes(`yyyy`)?o=o.replace(/yyyy/gi,String(i)):a.includes(`yy`)&&(o=o.replace(/yy/gi,String(i).substr(2))),o}_formatDatePhp(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=(e,t=2)=>e.toString().padStart(t,`0`),u=e=>{let t=e%10,n=e%100;return t===1&&n!==11?`st`:t===2&&n!==12?`nd`:t===3&&n!==13?`rd`:`th`},d=``;for(let f=0;f<t.length;f++){let p=t[f];if(p===`\\`&&f+1<t.length){d+=t[f+1],f++;continue}switch(p){case`Y`:d+=i.toString();break;case`y`:d+=i.toString().slice(-2);break;case`m`:d+=l(r);break;case`n`:d+=r.toString();break;case`M`:d+=c[r-1];break;case`F`:d+=s[r-1];break;case`d`:d+=l(n);break;case`j`:d+=n.toString();break;case`D`:d+=o[e.getDay()];break;case`l`:d+=a[e.getDay()];break;case`S`:d+=u(n);break;default:d+=p;break}}return d}_validateDateString(e,t){let n=this._parseDateString(e,t);return n!==null&&!isNaN(n.getTime())}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getValue(),i=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),s=this.getId(),c=this.getName(),l=this.getFormat(),u=this.hasError(),d=this.getErrorMessage(),f=this.getSelectionMode();this._isRange=this.isRange()||f===`week`||f===`month`,this._input||(this._input=document.createElement(`div`),this._input.className=`relative w-full`,this.appendChild(this._input));let p=this.querySelector(`.mint-date-picker-label-container`);if(t||n){p||(p=document.createElement(`div`),p.className=`mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]`,this.contains(this._input)?this.insertBefore(p,this._input):this.appendChild(p));let e=p.querySelector(`.mint-date-picker-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,p.insertBefore(e,p.firstChild)),e.textContent=t,s&&this._textInput&&e.setAttribute(`for`,s)):e&&e.remove();let r=p.querySelector(`.mint-date-picker-info`);n?(r||(r=document.createElement(`span`),r.className=`mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none`,p.appendChild(r)),r.textContent=n):r&&r.remove()}else p&&p.remove();this._hiddenInput||(this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.value=r||``,this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),s&&(this._hiddenInput.id=s),c&&(this._hiddenInput.name=c),this._hiddenInput.value=r||``,this._hiddenInput.setAttribute(`aria-invalid`,u?`true`:`false`);let m=this._input.querySelector(`.mint-date-fields`);m||(m=document.createElement(`div`),this._input.appendChild(m)),this._fieldsContainer=m,this._applyErrorVisuals(u,d,i),m.innerHTML=``,this._displayEl=document.createElement(`div`);let h=a?`select-text`:`select-none`;this._displayEl.className=`flex-1 text-gray-900 dark:text-white ${a?`cursor-default`:`cursor-text`} ${h} focus:outline-none`,this._displayEl.tabIndex=i||a?-1:0,this._displayEl.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._displayEl.addEventListener(`keydown`,e=>{i||a||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement(`div`),this._isRange,this._inputsWrapperEl.className=`flex items-center gap-1 w-full`;let g=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];let _=e=>{let t=document.createDocumentFragment();return g.forEach(n=>{if(n.type===`sep`){let e=document.createElement(`span`);e.textContent=n.value,e.className=`text-gray-400 dark:text-gray-500 select-none`,t.appendChild(e)}else{let r=n.part===`d`?`dd`:n.part===`m`?`mm`:n.len===2?`yy`:`yyyy`,s=this._createPartInput(n.len,r,i,a,o);e===`start`?this._startPartInputs.push(s):this._endPartInputs.push(s),t.appendChild(s)}}),t};if(this._isRange){let e=document.createElement(`div`);e.className=`flex items-center gap-1 flex-shrink-0`,e.appendChild(_(`start`)),this._inputsWrapperEl.appendChild(e);let t=document.createElement(`span`);t.textContent=` - `,t.className=`text-gray-400 dark:text-gray-500 select-none flex-shrink-0`,this._inputsWrapperEl.appendChild(t);let n=document.createElement(`div`);n.className=`flex items-center gap-1 flex-shrink-0`,n.appendChild(_(`end`)),this._inputsWrapperEl.appendChild(n)}else this._inputsWrapperEl.appendChild(_(`start`));let v=document.createElement(`div`);if(v.className=`flex flex-col w-full`,this._displayEl.style.display=this._isInputMode?`none`:`flex`,this._inputsWrapperEl.style.display=this._isInputMode?`flex`:`none`,v.appendChild(this._displayEl),v.appendChild(this._inputsWrapperEl),m.appendChild(v),this._isRange&&this._inputsWrapperEl&&this._setupContainerObserver(),m.addEventListener(`click`,()=>{this._isInputMode||i||a||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,g,m),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,g,m),this._parseValue(r),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=i||a,!i&&!a?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement(`button`),this._iconButton.type=`button`,this._iconButton.tabIndex=0,this._iconButton.className=`absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm`;let e=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`calendar`),t.className=`w-4 h-4 pointer-events-none`,this._iconButton.appendChild(t),this._iconButton.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=i||a}this._renderErrorState(u,d),this._renderSkeleton(e)}_renderErrorState(e,t){let n=this.querySelector(`.mint-date-picker-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_applyErrorVisuals(e,t,n){if(this._renderErrorState(e,t),this._fieldsContainer){let t=this._getFieldContainerClass(e,n);this._fieldsContainer.className=t}this._hiddenInput&&this._hiddenInput.setAttribute(`aria-invalid`,e?`true`:`false`)}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(``),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,``,this.isDisabled())},e.addEventListener(`reset`,this._resetHandler))}_clearPartInputs(e){e.forEach(e=>{e.value=``})}_getFieldContainerClass(e,t){return[`mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider text-gray-900 dark:text-white`,`border-2`,e?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-mint-divider`,`outline-none focus-within:ring-2 focus-within:ring-offset-1`,e?`focus-within:ring-red-400 dark:focus-within:ring-red-500`:`focus-within:ring-gray-400 dark:focus-within:ring-gray-500`,`flex items-center gap-1`].join(` `)+(t?` opacity-40 cursor-not-allowed`:``)}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){let t=this.getFormat(),n=this.getSelectionMode(),r=this._isRange||n===`week`||n===`month`;if(!e){this.setValue(``),this._updateDisplayText();return}if(r){let[n,r]=this._splitRangeInput(e,t),i=n?this._parseDateString(n,t):null,a=r?this._parseDateString(r,t):null;if(i&&a){let[e,n]=i<=a?[i,a]:[a,i],r=`${this._formatDate(e,t)} - ${this._formatDate(n,t)}`;this.setValue(r),this._applyDateToParts(e,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(n,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=e,this._selectedEndDate=n,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else if(i){let e=this._formatDate(i,t);this.setValue(e),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);this.setValue(e),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}let t=this._iconButton.id;t&&this._iconButton.isConnected&&document.getElementById(t)?this._createPopover(t):e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(e){if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(this._popover){if(this._popover.getAttribute(`trigger-id`)!==e){this._popover.setAttribute(`trigger-id`,e);let t=this._popover;typeof t._setupTrigger==`function`&&t._setupTrigger()}this._buildCalendar()}else{this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`);let t=this.closest(`mint-modal`),n=this.closest(`mint-off-canvas`);t||n?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute(`trigger-id`,e),this._popoverObserver||(this._popoverObserver=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`open`)if(this._popover?.hasAttribute(`open`))requestAnimationFrame(()=>{this._buildCalendar();let e=this._popover;typeof e.render==`function`&&e.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{this._iconButton?.focus()}),this._viewMode=`calendar`,this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{let e=new Date;this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{let e=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:null});this._hiddenInput?.dispatchEvent(e)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]})),requestAnimationFrame(()=>{this._buildCalendar()}))})})}}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement(`div`),this._calendarContainer.className=`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]`;let e=this.getMode();e===`month`&&this._viewMode===`calendar`?this._viewMode=`month`:e===`year`&&this._viewMode===`calendar`?this._viewMode=`year`:e===`default`&&this._viewMode!==`month`&&this._viewMode!==`year`&&(this._viewMode=`calendar`),this._viewMode===`calendar`?this._buildCalendarView():this._viewMode===`month`?this._buildMonthView():this._viewMode===`year`&&this._buildYearView();let t=this._popover.querySelector(`.popover-content`);if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;let e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),n=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],r=this.getWeekStartDay(),i=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],a=[...i.slice(r),...i.slice(0,r)],o=this.getShortcuts(),s=o.length>0;this._calendarContainer.className=s?`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]`:`mint-date-calendar bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg p-4 w-[18rem] md:min-w-[18rem]`;let c=document.createElement(`div`);c.className=`flex flex-col md:flex-row md:gap-6 md:items-start`;let l=document.createElement(`div`);l.className=`flex-1 min-w-0`;let u=document.createElement(`div`);u.className=`flex items-center justify-between mb-4`;let d=document.createElement(`button`);d.type=`button`,d.tabIndex=0,d.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,d.setAttribute(`data-keep-popover-open`,`true`);let f=document.createElement(`mint-icon`);f.setAttribute(`name`,`caret-left`),f.className=`w-4 h-4`,d.appendChild(f),d.addEventListener(`click`,()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}),u.appendChild(d);let p=document.createElement(`div`);p.className=`flex items-center gap-2`;let m=document.createElement(`button`);m.type=`button`,m.tabIndex=0,m.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,m.setAttribute(`data-keep-popover-open`,`true`),m.textContent=n[this._currentMonth];let h=()=>{let e=this.getMode();e!==`month`&&e!==`year`&&(this._viewMode=`month`,this._buildCalendar())};m.addEventListener(`click`,h),m.addEventListener(`touchend`,e=>{e.preventDefault(),h()},{passive:!1}),p.appendChild(m);let g=document.createElement(`button`);g.type=`button`,g.tabIndex=0,g.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,g.setAttribute(`data-keep-popover-open`,`true`),g.textContent=String(this._currentYear),g.addEventListener(`click`,()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())}),p.appendChild(g),u.appendChild(p);let _=document.createElement(`button`);_.type=`button`,_.tabIndex=0,_.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-mint-hover text-gray-600 dark:text-gray-300 flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_.setAttribute(`data-keep-popover-open`,`true`);let v=document.createElement(`mint-icon`);v.setAttribute(`name`,`caret-right`),v.className=`w-4 h-4`,_.appendChild(v);let y=()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};_.addEventListener(`click`,y),_.addEventListener(`touchend`,e=>{e.preventDefault(),y()},{passive:!1}),u.appendChild(_);let b=document.createElement(`div`);b.className=`grid grid-cols-7 mb-2`,a.forEach(e=>{let t=document.createElement(`div`);t.className=`text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1`,t.textContent=e,b.appendChild(t)});let x=document.createElement(`div`);x.className=`grid grid-cols-7`;let S=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,C=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;this.getDisabledDates();let w=this._currentMonth===0?11:this._currentMonth-1,T=this._currentMonth===0?this._currentYear-1:this._currentYear,E=this._getDaysInMonth(w,T),D=this._currentMonth===11?0:this._currentMonth+1,O=this._currentMonth===11?this._currentYear+1:this._currentYear,k=t+e,A=Math.ceil(k/7)*7-k,j=(e,t,n)=>{let r=this._isToday(e),i=this._isDateSelected(e),a=this._isDateInRange(e),o=S&&e<S||C&&e>C||this._isDateDisabled(e),s=`rounded-md`,c=this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate,l=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._selectedStartDate:c&&this._hoveredDate?this._hoveredDate:null,u=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._hoveredDate:c&&this._selectedStartDate?this._selectedStartDate:null,d=l!==null&&this._isSameDate(e,l),f=u!==null&&this._isSameDate(e,u),p=this._hoveredDate!==null&&this._isSameDate(e,this._hoveredDate),m=c&&this._hoveredDate&&this._selectedStartDate?!this._rangeIncludesDisabledDates(this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate):!1;if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){let t=this._isSameDate(e,this._selectedStartDate),n=this._isSameDate(e,this._selectedEndDate);t&&n?s=`rounded-md`:t?s=`rounded-l-md`:n?s=`rounded-r-md`:a&&(s=`rounded-none`)}else c&&(d||f)&&m?d&&f?s=`rounded-md`:d?s=`rounded-l-md`:f&&(s=`rounded-r-md`):i&&!this._isRange||i&&this._isRange&&!this._selectedEndDate?s=`rounded-md`:a&&c&&m&&(s=`rounded-none`);let h=document.createElement(`button`);h.type=`button`,h.disabled=!!o,h.tabIndex=o?-1:0;let g=`w-full h-8 ${s} border-0 text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_=i||c&&p&&m;return n?g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:r?` text-gray-900 dark:text-gray-100 font-semibold`:` text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-mint-hover`:g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:` text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-mint-hover`,g+=o?` opacity-40 cursor-not-allowed`:``,h.className=g,h.textContent=t.toString(),o||(h.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),this._handleDateClick(e)}),h.addEventListener(`touchstart`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive=!0,this._touchStartDate=e,this._touchStartElement=h,h.classList.add(`active`,`bg-gray-200`,`dark:bg-gray-600`)},{passive:!1}),h.addEventListener(`touchend`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive&&this._touchStartDate&&this._isSameDate(this._touchStartDate,e)&&this._handleDateClick(e),this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null},{passive:!1}),h.addEventListener(`touchcancel`,()=>{this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null}),this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&!o&&(h.addEventListener(`mouseenter`,()=>{this._isHandlingClick||this._isTouchActive||this._isDateDisabled(e)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,e))&&(this._hoveredDate=e,this._buildCalendar())}),h.addEventListener(`touchmove`,e=>{if(!this._isTouchActive||!this._touchStartDate)return;let t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);for(;n&&!n.classList.contains(`mint-date-picker-day`);)n=n.parentElement;if(n&&n!==h){let e=n.getAttribute(`data-date`);if(e){let t=new Date(e);this._isDateDisabled(t)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,t))&&(this._hoveredDate=t,this._buildCalendar())}}},{passive:!0}))),h};for(let e=t-1;e>=0;e--){let t=E-e,n=j(new Date(T,w,t),t,!1);x.appendChild(n)}for(let t=1;t<=e;t++){let e=j(new Date(this._currentYear,this._currentMonth,t),t,!0);x.appendChild(e)}for(let e=1;e<=A;e++){let t=j(new Date(O,D,e),e,!1);x.appendChild(t)}if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&(x.addEventListener(`mouseleave`,()=>{this._isTouchActive||(this._hoveredDate=null,this._buildCalendar())}),x.addEventListener(`touchend`,e=>{let t=e.changedTouches[0],n=document.elementFromPoint(t.clientX,t.clientY);n&&!x.contains(n)&&(this._hoveredDate=null,this._buildCalendar())},{passive:!0})),s){let e=document.createElement(`div`);e.className=`mb-4 pb-4 border-b border-gray-200 dark:border-mint-divider md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-mint-divider md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col`;let t=document.createElement(`div`);t.className=`relative md:relative md:flex-1 md:min-h-0`;let n=document.createElement(`div`);n.className=`flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2`,n.style.scrollbarWidth=`none`,n.style.msOverflowStyle=`none`,n.style.setProperty(`-webkit-overflow-scrolling`,`touch`);let r=document.createElement(`style`);r.textContent=`
|
|
59
59
|
.mint-date-shortcuts-row::-webkit-scrollbar {
|
|
60
60
|
display: none;
|
|
61
61
|
}
|
package/dist/index.js
CHANGED
|
@@ -1173,7 +1173,7 @@ var o = class extends HTMLElement {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
getAlignContent() {
|
|
1175
1175
|
let e = (this.getAttribute("align-content") || "").trim().toLowerCase();
|
|
1176
|
-
return e === "
|
|
1176
|
+
return e === "start" || e === "end" || e === "middle" ? e : "";
|
|
1177
1177
|
}
|
|
1178
1178
|
getStackClasses() {
|
|
1179
1179
|
let e = this.getDirection(), t = this.getTextAlign(), n = this.getGap(), r = this.getAlignContent(), i = [
|
|
@@ -1181,7 +1181,7 @@ var o = class extends HTMLElement {
|
|
|
1181
1181
|
e === "horizontal" ? "flex-row" : "flex-col",
|
|
1182
1182
|
`gap-${n}`
|
|
1183
1183
|
];
|
|
1184
|
-
return r && (e === "horizontal" ? r === "
|
|
1184
|
+
return r && (e === "horizontal" ? r === "start" ? i.push("justify-start") : r === "end" ? i.push("justify-end") : i.push("justify-center") : r === "start" ? i.push("items-start") : r === "end" ? i.push("items-end") : i.push("items-center")), t && (i.push(`text-${t}`), i.push(`[&>*]:text-${t}`), i.push(`[&>*_.mint-button-content]:text-${t}`), t === "left" ? (i.push("[&>mint-button]:!justify-start"), i.push("[&>mint-button>button]:!justify-start")) : t === "right" ? (i.push("[&>mint-button]:!justify-end"), i.push("[&>mint-button>button]:!justify-end")) : t === "center" && (i.push("[&>mint-button]:!justify-center"), i.push("[&>mint-button>button]:!justify-center"))), i.join(" ");
|
|
1185
1185
|
}
|
|
1186
1186
|
render() {
|
|
1187
1187
|
let e = this.getStackClasses(), t = this.getTextAlign();
|