monobill-mintui 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const re=require("./check-BlBVFo8S.cjs");class P extends HTMLElement{constructor(){super(),this._darkModeObserver=null}static get observedAttributes(){return["size","data-button-variant","data-button-tone"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getSize(){const e=this.getAttribute("size")||"default",t={default:"w-4 h-4",large:"w-16 h-16"};return t[e]||t.default}render(){const e=this.getSize(),t=this.getAttribute("size")||"default",i=!!(this.style.width&&this.style.height),s=this.getAttribute("data-button-variant"),r=document.documentElement.classList.contains("dark");let n;if(i){const l=this.getAttribute("data-button-tone")||"neutral";s==="solid"?l==="neutral"?n=r?"#ffffff":"#0f172a":n="#ffffff":n=r?"#ffffff":"#0f172a"}else n=r?"#e2e8f0":"#0f172a";const a=t==="large"?"2":"4",c=!!(this.style.width&&this.style.height),o=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const re=require("./check-BlBVFo8S.cjs");class P extends HTMLElement{constructor(){super(),this._darkModeObserver=null}static get observedAttributes(){return["size","data-button-variant","data-button-tone"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getSize(){const e=this.getAttribute("size")||"default",t={default:"w-4 h-4",large:"w-16 h-16"};return t[e]||t.default}render(){const e=this.getSize(),t=this.getAttribute("size")||"default",i=!!(this.style.width&&this.style.height),s=this.getAttribute("data-button-variant"),r=document.documentElement.classList.contains("dark");let n;if(i){const o=this.getAttribute("data-button-tone")||"neutral";s==="solid"?o==="neutral"?n=r?"#ffffff":"#0f172a":n="#ffffff":n=r?"#ffffff":"#0f172a"}else n=r?"#e2e8f0":"#0f172a";const a=t==="large"?"2":"4",c=!!(this.style.width&&this.style.height),l=`
2
2
  <svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  fill="none"
@@ -41,7 +41,7 @@
41
41
  ></animate>
42
42
  </circle>
43
43
  </svg>
44
- `;this.innerHTML=o.trim()}}customElements.get("mint-spinner")||customElements.define("mint-spinner",P);class O extends HTMLElement{constructor(){super(),this._darkModeObserver=null}static get observedAttributes(){return["name"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","inline-flex","items-center","leading-none"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(e=>{for(const t of e)if(t.type==="attributes"&&t.attributeName==="class"){this.render();break}}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getName(){return this.getAttribute("name")||""}getIconUrl(){var t;const e=document.documentElement.getAttribute("data-icon-base-url")||((t=document.querySelector('meta[name="icon-base-url"]'))==null?void 0:t.getAttribute("content"));return e?`${e}/${this.getName()}.svg`:`/icons/${this.getName()}.svg`}render(){var a,c;const e=this.getName();if(!e){this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}if(!re.getIcon(e)){console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`),this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}const i=this.closest("mint-button")||((a=this.parentElement)==null?void 0:a.closest("mint-button")),s=this.closest("mint-switch")||((c=this.parentElement)==null?void 0:c.closest("mint-switch"));let r;s?r="w-3 h-3":i?r="w-5 h-5":r="w-[1.3em] h-[1.3em]",this.classList.remove("w-4","h-4","w-5","h-5","w-[1em]","h-[1em]"),r.split(" ").forEach(o=>{o&&this.classList.add(o)});const n=this.getIconUrl();if(this.style.maskImage=`url(${n})`,this.style.webkitMaskImage=`url(${n})`,this.style.maskSize="contain",this.style.webkitMaskSize="contain",this.style.maskRepeat="no-repeat",this.style.webkitMaskRepeat="no-repeat",this.style.maskPosition="center",this.style.webkitMaskPosition="center",this.style.aspectRatio="1 / 1",this.style.backgroundColor="currentColor",s)this.classList.remove("text-gray-100","text-gray-900"),this.classList.add("text-gray-900");else if(i)this.classList.remove("text-gray-100","text-gray-900");else{const l=document.documentElement.classList.contains("dark")?"text-gray-100":"text-gray-900";this.classList.remove("text-gray-100","text-gray-900"),this.classList.add(l)}this.innerHTML=""}}customElements.get("mint-icon")||customElements.define("mint-icon",O);class F extends HTMLElement{constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1,this._handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleMouseUp=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleMouseLeave=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleTouchEnd=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchCancel=()=>{this._button&&this._button.classList.remove("mint-button-active")}}static get observedAttributes(){return["variant","tone","disabled","loading","button-type","full-width","icon-position","icon"]}connectedCallback(){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.removeEventListeners()}attributeChangedCallback(e,t,i){t!==i&&this.render()}getVariant(){return this.getAttribute("variant")||"solid"}getTone(){return this.getAttribute("tone")||"neutral"}isDisabled(){return this.hasAttribute("disabled")}isLoading(){return this.hasAttribute("loading")}getType(){return(this.getAttribute("button-type")||"default")==="submit"?"submit":"button"}isFullWidth(){return this.hasAttribute("full-width")}getIconPosition(){return this.getAttribute("icon-position")||"left"}getIcon(){return this.getAttribute("icon")||""}isIconOnly(){var i,s,r,n,a;if(!(this.getIcon()||((i=this._button)==null?void 0:i.querySelector('[slot="icon"], .mint-button-icon, mint-icon'))))return!1;const t=(s=this._button)==null?void 0:s.querySelector(".mint-button-content");if(t&&((r=t.textContent)!=null&&r.trim()))return!1;if(this._button)for(let c=this._button.firstChild;c;c=c.nextSibling){if(c.nodeType===Node.TEXT_NODE&&((n=c.textContent)!=null&&n.trim()))return!1;if(c.nodeType===Node.ELEMENT_NODE){const o=c;if(o.tagName!=="MINT-ICON"&&o.tagName!=="MINT-SPINNER"&&!o.querySelector("mint-spinner")&&!o.hasAttribute("slot")&&o.className!=="mint-button-icon"&&!(o.className==="mr-2"&&o.querySelector("mint-spinner"))&&(a=o.textContent)!=null&&a.trim())return!1}}return!0}getButtonClasses(){const e=this.isIconOnly(),t=this.getVariant(),i=["inline-flex","items-center","justify-center","font-medium","rounded-lg","box-border",...e?["p-1.5","aspect-square","w-[2rem]","h-[2rem]"]:["px-3.5","py-1.5","min-h-[2rem]"],"text-sm","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","[&.mint-button-active>*]:scale-95","[&>*]:transition-transform","[&>*]:duration-100","disabled:opacity-50","disabled:cursor-not-allowed"],s=this.getTone(),r={"solid-action":["bg-slate-800","dark:bg-slate-600","text-white","hover:bg-slate-950","dark:hover:bg-slate-700","active:bg-slate-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-slate-700","disabled:active:bg-slate-800","dark:disabled:active:bg-slate-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-neutral":["bg-white","dark:bg-gray-700","text-gray-900","dark:text-white","hover:bg-gray-50","dark:hover:bg-gray-600","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-white","dark:disabled:active:bg-gray-700","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-gray-200","dark:border-gray-600"],"solid-info":["bg-blue-800","dark:bg-blue-600","text-white","hover:bg-blue-950","dark:hover:bg-blue-700","active:bg-blue-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-blue-700","disabled:active:bg-blue-800","dark:disabled:active:bg-blue-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-warning":["bg-amber-800","dark:bg-amber-600","text-white","hover:bg-amber-950","dark:hover:bg-amber-700","active:bg-amber-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-amber-700","disabled:active:bg-amber-800","dark:disabled:active:bg-amber-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-danger":["bg-red-800","dark:bg-red-600","text-white","hover:bg-red-950","dark:hover:bg-red-700","active:bg-red-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-red-700","disabled:active:bg-red-800","dark:disabled:active:bg-red-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"ghost-action":["bg-transparent","text-slate-800","dark:text-slate-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","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-gray-800","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-gray-800","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-gray-800","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-gray-800","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-slate-800","dark:text-slate-400","hover:text-slate-950","dark:hover:text-slate-200","active:text-slate-900","dark:active:text-slate-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"]},n=`${t}-${s}`,a=r[n]||r["solid-neutral"],c=[...i,...a];return this.isFullWidth()&&c.push("w-full"),c.join(" ")}render(){var l,d,h,u,b;const e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){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 i=this._button.querySelector("mint-spinner");if(this.isLoading())if(i)i.setAttribute("data-button-variant",this.getVariant()),i.setAttribute("data-button-tone",this.getTone()),"render"in i&&typeof i.render=="function"&&i.render();else{const f=document.createElement("span");f.className="mr-2 inline-flex items-center";const _=document.createElement("mint-spinner");_.setAttribute("size","default"),_.setAttribute("data-button-variant",this.getVariant()),_.setAttribute("data-button-tone",this.getTone()),_.style.width="0.875rem",_.style.height="0.875rem",f.appendChild(_),this._button.insertBefore(f,this._button.firstChild)}else i&&((l=i.parentElement)==null||l.remove());for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);const s=this.getIcon();let r=this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');s?(r&&r.tagName!=="MINT-ICON"&&(r.remove(),r=null),!r||r.tagName!=="MINT-ICON"?(r=document.createElement("mint-icon"),r.setAttribute("name",s),r.className="mint-button-icon"):r.setAttribute("name",s)):r&&r.tagName==="MINT-ICON"&&(r.remove(),r=null),r||(r=this._button.querySelector('[slot="icon"], .mint-button-icon'));const n=this.getIconPosition();let a=this._button.querySelector(".mint-button-content");if(a){const f=r&&r.tagName==="MINT-ICON";if(r&&!r.parentElement){const _=(u=this._button.querySelector("mint-spinner"))==null?void 0:u.parentElement;f||n==="left"?_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a):a.insertAdjacentElement("afterend",r)}else if(r&&(f||n==="left")&&r.nextSibling!==a){r.remove();const _=(b=this._button.querySelector("mint-spinner"))==null?void 0:b.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a)}else r&&!f&&n==="right"&&r.previousSibling!==a&&(r.remove(),a.insertAdjacentElement("afterend",r))}else{const f=[];for(let _=this._button.firstChild;_;_=_.nextSibling){if(_.nodeType!==Node.ELEMENT_NODE){f.push(_);continue}const m=_;m.tagName!=="MINT-SPINNER"&&!m.querySelector("mint-spinner")&&_!==r&&!m.hasAttribute("slot")&&!(m.className==="mr-2"&&m.querySelector("mint-spinner"))&&f.push(_)}if(f.length>0){a=document.createElement("span"),a.className="mint-button-content inline-flex items-center",f.forEach(m=>{a.appendChild(m)});const _=(d=this._button.querySelector("mint-spinner"))==null?void 0:d.parentElement;r&&n==="left"?_?(_.insertAdjacentElement("afterend",r),r.insertAdjacentElement("afterend",a)):(this._button.insertBefore(r,this._button.firstChild),r.insertAdjacentElement("afterend",a)):r&&n==="right"?_?(_.insertAdjacentElement("afterend",a),a.insertAdjacentElement("afterend",r)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement("afterend",r)):_?_.insertAdjacentElement("afterend",a):this._button.insertBefore(a,this._button.firstChild)}else if(r&&r.tagName==="MINT-ICON"&&!r.parentElement){const _=(h=this._button.querySelector("mint-spinner"))==null?void 0:h.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,this._button.firstChild)}}const c=this.isIconOnly();r&&(r.classList.contains("mint-button-icon")||r.classList.add("mint-button-icon"),r.classList.remove("mr-1.5","ml-1.5"),c?r.tagName==="MINT-ICON"?(r.style.width="1rem",r.style.height="1rem",r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0"):(r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0",r.tagName==="svg"&&(r.style.width="1rem",r.style.height="1rem")):n==="left"?r.classList.add("mr-1.5"):r.classList.add("ml-1.5"));const o=this.getButtonClasses();this._button.className=o}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),this._clickHandler=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(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",F);class q extends HTMLElement{constructor(){super(),this._button=null,this._checked=!1}static get observedAttributes(){return["checked","disabled","label","icon"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center"),this._checked=this.hasAttribute("checked"),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null),t!==i&&this.render()}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this.render()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getIcon(){return this.getAttribute("icon")||""}hasIcon(){return!!this.getIcon()}getSwitchClasses(){const e=["relative","inline-flex","items-center","rounded-full","h-5","w-10","border","transition-colors","duration-200","ease-in-out","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","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"],t=this._checked?["bg-slate-950","dark:bg-slate-600","border-slate-700","dark:border-slate-500"]:["bg-slate-200","dark:bg-slate-400","border-slate-300","dark:border-slate-500"];return[...e,...t].join(" ")}getThumbClasses(){const 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(){const e=this.getSwitchClasses(),t=this.getThumbClasses(),i=this.getLabel(),s=this.getIcon();this._button||(this._button=document.createElement("button"),this.appendChild(this._button),this.setupEventListeners()),this._button.className=e,this._button.disabled=this.isDisabled(),this._button.setAttribute("aria-checked",String(this._checked)),this._button.setAttribute("aria-label",i),this._button.setAttribute("role","switch"),this._button.type="button";let r=this._button.querySelector("span");r||(r=document.createElement("span"),this._button.appendChild(r)),r.className=t;const n=r.querySelector("span");if(s){let a=n;a||(a=document.createElement("span"),a.className=this.getIconClasses(),r.appendChild(a));let c=a.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),a.appendChild(c)),c.setAttribute("name",s)}else n&&n.remove()}setupEventListeners(){this._button&&this._button.addEventListener("click",this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener("click",this.handleToggle.bind(this))}handleToggle(e){this.isDisabled()||(this.checked=!this._checked,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})))}}customElements.get("mint-switch")||customElements.define("mint-switch",q);class B extends HTMLElement{constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}static get observedAttributes(){return["variant","size","bold","underline","strike","italic","display"]}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(t=>this._userClasses.add(t))}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=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.hasAttribute("bold")}isUnderline(){return this.hasAttribute("underline")}isStrike(){return this.hasAttribute("strike")}isItalic(){return this.hasAttribute("italic")}getDisplay(){return this.hasAttribute("display")?this.getAttribute("display"):this.getSize()==="regular"?"inline-block":"block"}getTextClasses(){const e=this.getSize(),t=this.getVariant(),i=document.documentElement.classList.contains("dark"),s={heading:["font-semibold"],"sub-heading":["font-medium"],regular:[]},r={default:i?["text-gray-100"]:["text-gray-900"],muted:i?["text-gray-400"]:["text-gray-400"],danger:i?["text-red-400"]:["text-red-600"],success:i?["text-green-400"]:["text-green-600"]},n=[];this.isBold()&&n.push("font-bold"),this.isUnderline()&&n.push("underline"),this.isStrike()&&n.push("line-through"),this.isItalic()&&n.push("italic");const a=this.getDisplay();return[a==="block"?"block":a==="inline"?"inline":"inline-block",...s[e]||s.regular,...r[t]||r.default,...n].join(" ")}render(){const 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"],i=["text-2xl","text-lg","text-sm"];i.forEach(o=>{this.classList.remove(o),this._userClasses.delete(o)}),t.forEach(o=>{this.classList.remove(o),this._userClasses.delete(o)});const s=this.getTextClasses().split(" ").filter(o=>o.trim());Array.from(this.classList).forEach(o=>{!t.includes(o)&&!i.includes(o)&&this._userClasses.add(o)});const n=[...new Set([...s,...Array.from(this._userClasses)])];this.className=n.join(" ");const a={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)"},c=a[e]||a.regular;this.style.setProperty("font-size",c)}}customElements.get("mint-text")||customElements.define("mint-text",B);class z extends HTMLElement{constructor(){super(),this._childObserver=null}static get observedAttributes(){return["direction","text-align","gap"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,i){t!==i&&(this.render(),e==="text-align"&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{const e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&(this._childObserver.disconnect(),this._childObserver=null)}getDirection(){return(this.getAttribute("direction")||"vertical")==="horizontal"?"horizontal":"vertical"}getGap(){const e=this.getAttribute("gap")||"3";return parseFloat(e)}getTextAlign(){const e=this.getAttribute("text-align")||"";return["left","center","right","justify"].includes(e)?e:""}getStackClasses(){const e=this.getDirection(),t=this.getTextAlign(),i=this.getGap(),s=["flex",e==="horizontal"?"flex-row":"flex-col",`gap-${i}`];return t&&(s.push(`text-${t}`),s.push(`[&>*]:text-${t}`),s.push(`[&>*_.mint-button-content]:text-${t}`),t==="left"?(s.push("[&>mint-button]:!justify-start"),s.push("[&>mint-button>button]:!justify-start")):t==="right"?(s.push("[&>mint-button]:!justify-end"),s.push("[&>mint-button>button]:!justify-end")):t==="center"&&(s.push("[&>mint-button]:!justify-center"),s.push("[&>mint-button>button]:!justify-center"))),s.join(" ")}render(){const e=this.getStackClasses(),t=this.getTextAlign();["flex","flex-row","flex-col","gap-1","gap-2","gap-3","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"].forEach(r=>this.classList.remove(r)),e.split(" ").forEach(r=>{r&&this.classList.add(r)}),["box-border","m-0","p-0","border-0","align-baseline","block"].forEach(r=>{this.classList.contains(r)||this.classList.add(r)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(i=>{if(i.tagName==="MINT-BUTTON"){const s=i.querySelector("button");if(s){s.classList.remove("justify-start","justify-center","justify-end"),e==="left"?s.classList.add("justify-start"):e==="right"?s.classList.add("justify-end"):e==="center"&&s.classList.add("justify-center");const r=s.querySelector(".mint-button-content");r&&(r.classList.remove("text-left","text-center","text-right","text-justify"),r.classList.add(`text-${e}`))}}else i.classList.remove("text-left","text-center","text-right","text-justify"),i.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(t=>{if(t.tagName==="MINT-BUTTON"){const i=t.querySelector("button");if(i){i.classList.remove("justify-start","justify-end"),i.classList.add("justify-center");const s=i.querySelector(".mint-button-content");s&&s.classList.remove("text-left","text-center","text-right","text-justify")}}else t.classList.remove("text-left","text-center","text-right","text-justify")})}}customElements.get("mint-stack")||customElements.define("mint-stack",z);class V extends HTMLElement{static get observedAttributes(){return[]}constructor(){super()}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(e,t,i){t!==i&&this.render()}render(){this.classList.add("rounded-lg","shadow","bg-white","dark:bg-gray-800","border","border-gray-200","dark:border-gray-700","overflow-hidden","transition-colors","duration-200")}}customElements.get("mint-card")||customElements.define("mint-card",V);class R extends HTMLElement{constructor(){super(),this._link=null,this._contentObserver=null}static get observedAttributes(){return["href","target"]}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(),this._contentObserver=null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll("mint-text").forEach(t=>{t.classList.contains("underline")||t.classList.add("underline")})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,i){t!==i&&this.render()}getHref(){return this.getAttribute("href")||"#"}getTarget(){return this.getAttribute("target")||""}hasIcon(){var e;return!!(this.querySelector("mint-icon")||(e=this._link)!=null&&e.querySelector("mint-icon"))}render(){const 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"));const i=this.hasIcon(),s=["text-slate-800","dark:text-slate-200","underline","hover:text-slate-950","dark:hover:text-slate-100","transition-colors","duration-200","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"];i&&s.push("inline-flex","items-center","gap-2"),this._link.className=s.join(" "),this._link.querySelectorAll("mint-text").forEach(a=>{a.classList.contains("underline")||a.classList.add("underline")}),["box-border","m-0","p-0","border-0","align-baseline","inline-block"].forEach(a=>{this.classList.contains(a)||this.classList.add(a)})}}customElements.get("mint-link")||customElements.define("mint-link",R);class W extends HTMLElement{constructor(){super(),this._button=null,this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0,this._initialUrl="",this._initialOrigin="",this._popstateHandler=null}static get observedAttributes(){return["href","fallback-href"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center","justify-center"),this.render(),this._setupHistoryTracking()}disconnectedCallback(){this._popstateHandler&&(window.removeEventListener("popstate",this._popstateHandler),this._popstateHandler=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}_setupHistoryTracking(){this._initialUrl=window.location.href,this._initialOrigin=window.location.origin,this._historyDepth=window.history.length,this._popstateHandler||(this._popstateHandler=e=>{this._backAttempts=0,setTimeout(()=>{const t=window.location.origin,i=window.location.href;if(t!==this._initialOrigin){this._navigateToFallback();return}if(i.startsWith("chrome://")||i.startsWith("about:")||i.startsWith("edge://")||i==="about:blank"||i==="about:newtab"){this._navigateToFallback();return}},0)},window.addEventListener("popstate",this._popstateHandler))}getFallbackHref(){return this.getAttribute("fallback-href")||this.getAttribute("href")||"/"}handleClick(e){if(e.preventDefault(),e.stopPropagation(),this._wouldBackLeaveApp()){this._navigateToFallback();return}if(window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;const s=window.location.href,r=window.location.origin;window.history.back(),setTimeout(()=>{if(window.location.href===s)this._navigateToFallback();else{if(window.location.origin!==r){this._navigateToFallback();return}const n=window.location.href;if(n.startsWith("chrome://")||n.startsWith("about:")||n.startsWith("edge://")||n==="about:blank"||n==="about:newtab"){this._navigateToFallback();return}setTimeout(()=>{this._backAttempts=0},500)}},200)}else this._navigateToFallback()}_wouldBackLeaveApp(){const e=document.referrer,t=window.location.origin;if(window.history.length<=1||!e&&window.history.length<=2)return!0;if(e)try{if(new URL(e).origin!==t&&window.history.length<=2)return!0}catch{if(window.history.length<=2)return!0}return!1}_navigateToFallback(){var t,i,s;const e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith("/")&&!e.startsWith("//")){const r=document.querySelector("#app");if((s=(i=(t=r==null?void 0:r.__vue_app__)==null?void 0:t.config)==null?void 0:i.globalProperties)!=null&&s.$router)try{r.__vue_app__.config.globalProperties.$router.push(e);return}catch{}try{window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate"));return}catch{}}window.location.href=e}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",W);class j extends HTMLElement{constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null}static get observedAttributes(){return["heading","fallback-href","show-back-button","containered"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}getHeading(){return this.getAttribute("heading")||""}getFallbackHref(){return this.getAttribute("fallback-href")||"/"}shouldShowBackButton(){return this.hasAttribute("show-back-button")}render(){const 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));const n=this.getFallbackHref();t.setAttribute("fallback-href",n)}else t&&(t.remove(),t=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",""),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(),this._headingText=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(n=>n!==this._pageContainer&&n!==this._actionsSlot&&n.getAttribute("slot")==="actions").forEach(n=>{this._actionsSlot&&n.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(n)}),this._bodySlot||(this._bodySlot=document.createElement("div"),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(n=>{n!==this._pageContainer&&n.getAttribute("slot")!=="actions"&&n!==this._actionsSlot&&n!==this._header&&n!==this._bodySlot&&n!==this._headingText&&n.parentElement!==this._bodySlot&&n.parentElement!==this._pageContainer&&this._bodySlot.appendChild(n)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add("min-h-screen","p-8","transition-colors","duration-200"),this.hasAttribute("containered")?this._pageContainer.classList.add("max-w-6xl","mx-auto","w-full"):this._pageContainer.classList.remove("max-w-6xl","mx-auto"))}_updateBackgroundColor(){if(!this._pageContainer)return;document.documentElement.classList.contains("dark")?(this._pageContainer.classList.remove("bg-gray-20"),this._pageContainer.classList.add("bg-gray-900")):(this._pageContainer.classList.remove("bg-gray-900"),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"]}))}}customElements.get("mint-page")||customElements.define("mint-page",j);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,i){t!==i&&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(){const e=["grid"],t=this.getColumns();e.push(`grid-cols-${t}`);const i=this.getSm();i&&e.push(`sm:grid-cols-${i}`);const s=this.getMd();s&&e.push(`md:grid-cols-${s}`);const r=this.getLg();r&&e.push(`lg:grid-cols-${r}`);const n=this.getXl();n&&e.push(`xl:grid-cols-${n}`);const a=this.getGap();return e.push(`gap-${a}`),e}render(){Array.from(this.classList).filter(i=>i.startsWith("grid-cols-")||i.startsWith("sm:grid-cols-")||i.startsWith("md:grid-cols-")||i.startsWith("lg:grid-cols-")||i.startsWith("xl:grid-cols-")||i.startsWith("gap-")).forEach(i=>this.classList.remove(i)),this.classList.contains("grid")||this.classList.add("grid"),this.getGridClasses().forEach(i=>{i&&i!=="grid"&&this.classList.add(i)})}}customElements.get("mint-grid")||customElements.define("mint-grid",$);class Y extends HTMLElement{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}static get observedAttributes(){return["id","heading","open"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","inset-0","z-50"),this.isOpen()||this.classList.add("hidden"),this.render(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}getId(){return this.getAttribute("id")||""}getHeading(){return this.getAttribute("heading")||""}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const e=this.getId(),t=this.getHeading(),i=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-200 z-40",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-50",this.appendChild(this._modal)),i){let d=this._modal.querySelector(".modal-content");d||(d=document.createElement("div"),d.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(d)),this._animateEnter()}else this._animateExit();let s=this._modal.querySelector(".modal-content");s||(s=document.createElement("div"),s.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(s)),this._header||(this._header=document.createElement("div"),this._header.className="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",s.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 r=this._headingSlot.querySelector("mint-text");t?(r||(r=document.createElement("mint-text"),r.setAttribute("size","sub-heading"),r.setAttribute("bold",""),this._headingSlot.appendChild(r)),r.textContent=t):r&&r.remove(),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._headingSlot&&d.getAttribute("slot")==="heading").forEach(d=>{d.parentElement!==this._headingSlot&&this._headingSlot.appendChild(d)}),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"),s.appendChild(this._bodySlot)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._bodySlot&&d.getAttribute("slot")==="body").forEach(d=>{d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._actionsSlot||(this._actionsSlot=document.createElement("div"),this._actionsSlot.className="p-4 border-t border-gray-200 dark:border-gray-700",this._actionsSlot.setAttribute("slot","actions"),s.appendChild(this._actionsSlot));let c=this._actionsSlot.querySelector("mint-stack");c||(c=document.createElement("mint-stack"),c.setAttribute("direction","horizontal"),c.className="justify-end",this._actionsSlot.appendChild(c)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._actionsSlot&&d.getAttribute("slot")==="actions").forEach(d=>{Array.from(d.children).forEach(u=>{u.parentElement!==c&&c.appendChild(u)}),d.parentElement&&d.remove()}),Array.from(this.children).forEach(d=>{d!==this._overlay&&d!==this._modal&&d.getAttribute("slot")!=="heading"&&d.getAttribute("slot")!=="body"&&d.getAttribute("slot")!=="actions"&&d!==this._headingSlot&&d!==this._bodySlot&&d!==this._actionsSlot&&d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;const e=document.documentElement.classList.contains("dark"),t=this._modal.querySelector(".modal-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),t.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_animateEnter(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");e&&(e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",e.style.transition="all 200ms ease-out",this.classList.remove("hidden"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})}))}_animateExit(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");if(!e){this.classList.add("hidden");return}e.style.transition="all 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",Y);class U extends HTMLElement{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}static get observedAttributes(){return["id","direction","open","trigger-id","padding","hover"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","top-0","left-0","z-50","pointer-events-none"),this.isOpen()||this.classList.add("hidden"),this.render(),this._setupTrigger(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null),this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler),this._clickOutsideHandler=null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}attributeChangedCallback(e,t,i){t!==i&&(this.render(),(e==="trigger-id"||e==="hover")&&this._setupTrigger(),e==="open"&&this.isOpen()&&this._closeOtherPopovers())}getId(){return this.getAttribute("id")||""}getPadding(){const 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")||""}isHoverEnabled(){return this.hasAttribute("hover")}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}_setupTrigger(){const 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){const e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.hasAttribute("open")?e.removeAttribute("open"):e.setAttribute("open","")},this._triggerElement.addEventListener("click",this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();const e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||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){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||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(){const 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"};const 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");const s=t.getBoundingClientRect(),r=window.innerWidth,n=window.innerHeight,a=8;let c=this.getDirection(),o=0,l=0;switch(c){case"down":if(o=e.bottom+a,l=e.left+e.width/2-s.width/2,o+s.height>n){const d=e.top-s.height-a;d>=0?(c="up",o=d):(o=Math.max(0,n-s.height-a),o+s.height>n&&(o=0))}l<0&&(l=a),l+s.width>r&&(l=Math.max(a,r-s.width-a),l+s.width>r&&(l=r-s.width));break;case"up":if(o=e.top-s.height-a,l=e.left+e.width/2-s.width/2,o<0){const d=e.bottom+a;d+s.height<=n?(c="down",o=d):(o=Math.min(n-s.height-a,n-s.height),o<0&&(o=n-s.height))}l<0&&(l=a),l+s.width>r&&(l=Math.max(a,r-s.width-a),l+s.width>r&&(l=r-s.width));break;case"right":if(o=e.top+e.height/2-s.height/2,l=e.right+a,l+s.width>r){const d=e.left-s.width-a;d>=0?(c="left",l=d):(l=Math.max(0,r-s.width-a),l+s.width>r&&(l=r-s.width))}o<0&&(o=a),o+s.height>n&&(o=Math.max(a,n-s.height-a),o+s.height>n&&(o=n-s.height));break;case"left":if(o=e.top+e.height/2-s.height/2,l=e.left-s.width-a,l<0){const d=e.right+a;d+s.width<=r?(c="right",l=d):(l=Math.min(r-s.width-a,r-s.width),l<0&&(l=0))}o<0&&(o=a),o+s.height>n&&(o=Math.max(a,n-s.height-a),o+s.height>n&&(o=n-s.height));break}return{top:o,left:l,direction:c}}render(){const e=this.getId(),t=this.isOpen(),i=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove("hidden"),this.style.pointerEvents="auto",!this._clickOutsideHandler){const n=this;this._clickOutsideHandler=function(a){const c=a.composedPath(),o=c.includes(n);if(!(n._triggerElement&&c.includes(n._triggerElement))&&!o){n.close();return}},setTimeout(()=>{document.addEventListener("click",this._clickOutsideHandler,!1)},100)}}else this.classList.add("hidden"),this.style.pointerEvents="none",this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler,!1),this._clickOutsideHandler=null);this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 pointer-events-none z-40",this.appendChild(this._overlay)),this._popover||(this._popover=document.createElement("div"),this._popover.className="fixed z-50 pointer-events-auto",this.appendChild(this._popover)),this.isHoverEnabled()&&this._attachHoverListeners();let s=this._popover.querySelector(".popover-content");if(!s)s=document.createElement("div"),s.className=`popover-content bg-white dark:bg-gray-800 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`,this._popover.appendChild(s);else{const n=s.className.split(" "),a=["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"],c=n.filter(o=>!a.includes(o));s.className=[...c,i].join(" ")}Array.from(this.children).forEach(n=>{n!==this._overlay&&n!==this._popover&&n.parentElement===this&&s.appendChild(n)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(s):(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",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",s.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.style.transform="scale(1) translateY(0)",s.style.opacity="1"})}))):!t&&s&&(this._removePositionListeners(),s.style.opacity!=="0"&&s.style.opacity!==""&&(s.style.transition="all 200ms ease-in",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",setTimeout(()=>{s.style.transform="",s.style.opacity="",s.style.transition="",this._popover.style.visibility="",this._popover.style.display=""},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;const e=document.documentElement.classList.contains("dark"),t=this._popover.querySelector(".popover-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),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;const 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;const i=this._calculatePosition();this._popover.style.top=`${i.top}px`,this._popover.style.left=`${i.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="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){const e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("scroll",this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){const e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("resize",this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}_closeOtherPopovers(){Array.from(document.querySelectorAll("mint-popover[open]")).forEach(t=>{if(t!==this){const i=t;typeof i.close=="function"?i.close():t.removeAttribute("open")}})}}customElements.get("mint-popover")||customElements.define("mint-popover",U);class G extends HTMLElement{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}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._checkbox&&(this._checkbox.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._checkbox&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||""}getCheckboxClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-checkbox-wrapper");s||(s=document.createElement("div"),s.className="mint-checkbox-wrapper",this.insertBefore(s,this.firstChild)),this._checkbox?this._checkbox.parentElement!==s&&s.appendChild(this._checkbox):(this._checkbox=document.createElement("input"),this._checkbox.type="checkbox",s.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=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._checkbox.id=r:this._checkbox.removeAttribute("id");const n=this.getName();n?this._checkbox.name=n:this._checkbox.removeAttribute("name");const a=this.getValue();a?this._checkbox.value=a:this._checkbox.removeAttribute("value"),e?this._checkbox.setAttribute("aria-label",e):this._checkbox.removeAttribute("aria-label"),s.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,s.style.pointerEvents="none",this._checkbox.style.pointerEvents="auto";let c=s.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),c.setAttribute("name","check"),c.className="w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),this.updateVisualState();let o=this.querySelector(".mint-checkbox-label-container");if(e||t){o||(o=document.createElement("div"),o.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",this.appendChild(o));let l=o.querySelector(".mint-checkbox-label");e?(l||(l=document.createElement("span"),l.className="mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",o.insertBefore(l,o.firstChild)),l.textContent=e,i?l.classList.add("opacity-40"):l.classList.remove("opacity-40")):l&&l.remove();let d=o.querySelector(".mint-checkbox-info");if(t?(d||(d=document.createElement("span"),d.className="mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",o.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)o.style.cursor="default",o._clickHandler&&(o.removeEventListener("click",o._clickHandler),o._clickHandler=null);else{o.style.cursor="pointer";const h=o._clickHandler;h&&o.removeEventListener("click",h),o._clickHandler=u=>{this._checkbox&&(u.target===this._checkbox||this._checkbox.contains(u.target)||u.composedPath().includes(this._checkbox))||this.toggle()},o.addEventListener("click",o._clickHandler)}}else o&&o.remove()}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener("change",this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const 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=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const 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();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const 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),this._changeHandler=null),this._mousedownHandler&&(this._checkbox.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._checkbox.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._checkbox.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._checkbox.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._checkbox.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._checkbox.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._checkbox.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-checkbox-wrapper"),t=e==null?void 0:e.querySelector("mint-icon");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains("mint-checkbox-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const e=new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}}customElements.get("mint-checkbox")||customElements.define("mint-checkbox",G);class J extends HTMLElement{constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._groupChangeHandler=null,this._clickHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._radio&&(this._radio.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._radio&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._radio&&(this._radio.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}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")||""}getChoiceClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded-full","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-choice-wrapper");s||(s=document.createElement("div"),s.className="mint-choice-wrapper",this.insertBefore(s,this.firstChild)),this._radio?this._radio.parentElement!==s&&s.appendChild(this._radio):(this._radio=document.createElement("input"),this._radio.type="radio",s.appendChild(this._radio),this.setupEventListeners()),this._radio.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._radio.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;",this._radio.checked=this._checked,this._radio.disabled=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._radio.id=r:this._radio.removeAttribute("id");const n=this.getName();n?this._radio.name=n:this._radio.removeAttribute("name");const a=this.getValue();a?this._radio.value=a:this._radio.removeAttribute("value"),e?this._radio.setAttribute("aria-label",e):this._radio.removeAttribute("aria-label"),s.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,s.style.pointerEvents="none",this._radio.style.pointerEvents="auto";let c=s.querySelector(".mint-choice-indicator");c||(c=document.createElement("div"),c.className="mint-choice-indicator w-2.5 h-2.5 rounded-full bg-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),c.style.opacity=this._checked?"1":"0",c.style.transform=this._checked?"scale(1)":"scale(0.8)",this.updateVisualState();let o=this.querySelector(".mint-choice-label-container");if(e||t){o||(o=document.createElement("div"),o.className="mint-choice-label-container flex flex-col gap-0.5 flex-1",this.appendChild(o));let l=o.querySelector(".mint-choice-label");e?(l||(l=document.createElement("span"),l.className="mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",o.insertBefore(l,o.firstChild)),l.textContent=e,i?l.classList.add("opacity-40"):l.classList.remove("opacity-40")):l&&l.remove();let d=o.querySelector(".mint-choice-info");if(t?(d||(d=document.createElement("span"),d.className="mint-choice-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",o.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)o.style.cursor="default",o._clickHandler&&(o.removeEventListener("click",o._clickHandler),o._clickHandler=null);else{o.style.cursor="pointer";const h=o._clickHandler;h&&o.removeEventListener("click",h),o._clickHandler=u=>{this._radio&&(u.target===this._radio||this._radio.contains(u.target)||u.composedPath().includes(this._radio))||this.select()},o.addEventListener("click",o._clickHandler)}}else o&&o.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();const t=this._checked;if(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState(),this._checked){const i=this._radio.name;i&&document.querySelectorAll(`input[type="radio"][name="${i}"]`).forEach(r=>{if(r!==this._radio){const n=r.closest("mint-choice");n&&n.updateVisualState&&(n._checked=r.checked,r.checked?n.hasAttribute("checked")||n.setAttribute("checked",""):n.hasAttribute("checked")&&n.removeAttribute("checked"),n.updateVisualState())}})}if(t!==this._checked){const i=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(i)}},this._radio.addEventListener("change",this._changeHandler),this._groupChangeHandler=e=>{const t=e.target;t!==this._radio&&t.type==="radio"&&t.name===this._radio.name&&t.checked&&setTimeout(()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState())},0)},document.addEventListener("change",this._groupChangeHandler,!0),this._clickHandler=e=>{const t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),requestAnimationFrame(()=>{this._radio&&(this._checked=this._radio.checked,this.updateVisualState())})},this._radio.addEventListener("click",this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("mousedown",this._mousedownHandler),this._radio.addEventListener("mouseup",this._mouseupHandler),this._radio.addEventListener("mouseleave",this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("touchstart",this._touchstartHandler),this._radio.addEventListener("touchend",this._touchendHandler),this._focusHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&this._radio&&requestAnimationFrame(()=>{this._radio&&this._radio.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const e=this.querySelector(".mint-choice-wrapper");e&&e.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("focus",this._focusHandler),this._radio.addEventListener("blur",this._blurHandler))}removeEventListeners(){this._radio&&(this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._groupChangeHandler&&(document.removeEventListener("change",this._groupChangeHandler,!0),this._groupChangeHandler=null),this._clickHandler&&(this._radio.removeEventListener("click",this._clickHandler),this._clickHandler=null),this._mousedownHandler&&(this._radio.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._radio.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._radio.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._radio.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._radio.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._radio.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._radio.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-choice-wrapper"),t=e==null?void 0:e.querySelector(".mint-choice-indicator");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,e.classList.contains("mint-choice-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}select(){if(this._radio&&!this.isDisabled()){this._radio.checked=!0,this._radio.dispatchEvent(new Event("change",{bubbles:!0})),this._checked=!0,this.hasAttribute("checked")||this.setAttribute("checked","");const e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}}customElements.get("mint-choice")||customElements.define("mint-choice",J);class X extends HTMLElement{constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null}static get observedAttributes(){return["type","placeholder","value","disabled","id","name","required","readonly","rows","icon","label","info","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.getLabel()||console.error('mint-input: The "label" attribute is required. Please provide a label for the input.'),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}this.render()}}getType(){return this.getAttribute("type")||"text"}getRows(){const e=this.getAttribute("rows");return e?parseInt(e,10):3}_getNormalizedType(){const 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(){var e,t,i;return this._isColor()?((e=this._colorPicker)==null?void 0:e.value)||((t=this._colorTextInput)==null?void 0:t.value)||this.getAttribute("value")||"#000000":((i=this._element)==null?void 0:i.value)||this.getAttribute("value")||""}set value(e){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")}get value(){return this.getValue()}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}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(){const e=this._isTextarea(),t=!!this.getIcon(),i=this._isColor(),s=this._isNumber(),r=this.hasError(),n=["w-full",t||i?"pl-10":"px-3.5",t||i?"pr-3.5":s?"pr-10":"",e?"py-2":"py-1.5",e?"min-h-[6rem]":"min-h-[2rem]","text-sm","font-medium","rounded-lg","box-border","bg-white","dark:bg-gray-700","text-gray-900","dark:text-white",e?"transition-colors transition-opacity":"transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","readonly:cursor-default",e?"resize-y":"",s?"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none":""],a=["border-2",r?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],c=["focus-visible:ring-2","focus-visible:ring-offset-1",r?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"];return[...n,...a,...c].filter(Boolean).join(" ")}render(){var v,x,S,y;this.getType();const e=this._getNormalizedType(),t=this._isTextarea(),i=this._isMoney(),s=this._isColor(),r=this.getPlaceholder(),n=this.isDisabled(),a=this.isReadonly(),c=this.isRequired(),o=this.getId(),l=this.getName(),d=this.getAttribute("value")||(s?"#000000":""),h=this.getRows(),u=this.getIcon(),b=this.getLabel(),f=this.getInfo();if(s){this._input&&(this._input.remove(),this._input=null),this._textarea&&(this._textarea.remove(),this._textarea=null),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._colorPickerWrapper&&!s&&(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=d||"#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=p=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(":focus-visible")&&requestAnimationFrame(()=>{var k;this._colorPicker&&this._colorPicker.matches(":focus-visible")&&((k=this._colorPickerWrapper)==null||k.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",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this._colorTextInput&&(this._colorTextInput.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener("change",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("change",{detail:{value:p},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement("input"),this._colorTextInput.type="text",this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=r||"#000000",this._colorTextInput.pattern="^#[0-9A-Fa-f]{6}$",this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener("input",()=>{var k;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)&&(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener("blur",()=>{var k,E;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)?(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:((E=this._colorPicker)==null?void 0:E.value)||"#000000"},bubbles:!0,cancelable:!0}))}));const g=d||"#000000";if(this._colorPicker&&this._colorPicker.value!==g&&(this._colorPicker.value=g),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=g),this._colorTextInput&&this._colorTextInput.value!==g&&(this._colorTextInput.value=g),this._colorPicker&&(this._colorPicker.disabled=n),this._colorPickerWrapper&&(n?(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=n,this._colorTextInput.readOnly=a,this._colorTextInput.required=c),this._colorTextInput){const p=this._colorTextInput;o?p.id=o:p.removeAttribute("id"),l?p.name=l:p.removeAttribute("name"),p.setAttribute("aria-invalid",this.hasError()?"true":"false"),this._element=p}this._renderErrorState();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&&!s&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),u&&!t?this._icon?this._icon.setAttribute("name",u):(this._icon=document.createElement("mint-icon"),this._icon.setAttribute("name",u),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(),this._icon=null),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 transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const g=document.createElement("mint-icon");g.setAttribute("name","caret-up"),g.className="w-[1rem] h-[1rem]",this._numberIncrementButton.appendChild(g),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 transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const p=document.createElement("mint-icon");p.setAttribute("name","caret-down"),p.className="w-[1rem] h-[1rem]",this._numberDecrementButton.appendChild(p),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E+I;w!==void 0&&L>w&&(L=w),C!==void 0&&L<C&&(L=C),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}}),this._numberDecrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E-I;C!==void 0&&L<C&&(L=C),w!==void 0&&L>w&&(L=w),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=n||a),this._numberDecrementButton&&(this._numberDecrementButton.disabled=n||a)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&(this._input.remove(),this._input=null),this._textarea||(this._textarea=document.createElement("textarea"),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=r,this._textarea.disabled=n,this._textarea.readOnly=a,this._textarea.required=c,this._textarea.rows=h,this._textarea.setAttribute("aria-invalid",this.hasError()?"true":"false"),d!==this._textarea.value&&(this._textarea.value=d),o?this._textarea.id=o: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){const g=this.firstChild.textContent;g&&!this._textarea.value&&(this._textarea.value=g.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&(this._textarea.remove(),this._textarea=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=r,this._input.disabled=n,this._input.readOnly=a,this._input.required=c,this._input.setAttribute("aria-invalid",this.hasError()?"true":"false"),i?(this._input.inputMode="decimal",this._input.pattern="[0-9]*\\.?[0-9]*"):(this._input.removeAttribute("inputmode"),this._input.removeAttribute("pattern")),d!==this._input.value&&(this._input.value=d),o?this._input.id=o: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){const g=this.firstChild.textContent;g&&!this._input.value&&(this._input.value=g.trim()),this.removeChild(this.firstChild)}let m=this.querySelector(".mint-input-label-container");if(b||f){m||(m=document.createElement("div"),m.className="mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]",this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(m,this._wrapper):this.insertBefore(m,this.firstChild));let g=m.querySelector(".mint-input-label");if(b){g||(g=document.createElement("label"),g.className="mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",m.insertBefore(g,m.firstChild)),g.textContent=b;const k=o||((v=this._element)==null?void 0:v.id)||((x=this._colorTextInput)==null?void 0:x.id)||((S=this._input)==null?void 0:S.id)||((y=this._textarea)==null?void 0:y.id);if(k)g.setAttribute("for",k);else{const E=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=E:this._colorTextInput?this._colorTextInput.id=E:this._input?this._input.id=E:this._textarea&&(this._textarea.id=E),g.setAttribute("for",E)}n?g.classList.add("opacity-40"):g.classList.remove("opacity-40")}else g&&g.remove();let p=m.querySelector(".mint-input-info");f?(p||(p=document.createElement("span"),p.className="mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none",m.appendChild(p)),p.textContent=f,n?p.classList.add("opacity-40"):p.classList.remove("opacity-40")):p&&p.remove()}else m&&m.remove();this._renderErrorState()}_renderErrorState(){const e=this.hasError(),t=this.getErrorMessage();let i=this.querySelector(".mint-input-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-input-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}setupEventListeners(){this._element&&(this._element.addEventListener("input",()=>{var t;const e=((t=this._element)==null?void 0:t.value)||"";e?this.setAttribute("value",e):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("input",{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._element.addEventListener("blur",()=>{var t;const e=((t=this._element)==null?void 0:t.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),this._focusHandler=null),this._blurHandler&&(this._colorPicker.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}focus(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.focus():(e=this._element)==null||e.focus()}blur(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.blur():(e=this._element)==null||e.blur()}}customElements.get("mint-input")||customElements.define("mint-input",X);class K extends HTMLElement{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._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}static get observedAttributes(){return["value","label","info","disabled","id","name","required","readonly","format","min","max","range","shortcuts","display-format","error","error-message"]}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(),this._popoverObserver=null),this._removeFocusTrap(),this._resetHandler){const e=this.closest("form");e&&e.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){const s=this.hasError(),r=this.getErrorMessage();this._applyErrorVisuals(s,r,this.isDisabled());return}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()}getFormat(){return this.getAttribute("format")||"mm/dd/yyyy"}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}isRange(){return this.hasAttribute("range")}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getMin(){return this.getAttribute("min")||""}getMax(){return this.getAttribute("max")||""}getDisplayFormat(){return this.getAttribute("display-format")||"F j, Y"}getShortcuts(){const e=this.getAttribute("shortcuts");if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(i=>({label:i.label,action:this._createShortcutAction(i.action)}))}catch{const i=e.trim();if(i&&typeof window[i]=="function"){const s=window[i]();if(Array.isArray(s))return s.map(r=>({label:r.label,action:typeof r.action=="function"?r.action:this._createShortcutAction(r.action)}))}}return[]}_createShortcutAction(e){return typeof e=="function"?e:typeof e=="string"&&typeof window[e]=="function"?window[e]:()=>null}_getDefaultShortcuts(){const e=[{label:"Today",action:()=>new Date}];return this._isRange&&e.push({label:"This Week",action:()=>{const t=new Date,i=t.getDay(),s=new Date(t);s.setDate(t.getDate()-i),s.setHours(0,0,0,0);const r=new Date(s);return r.setDate(s.getDate()+6),r.setHours(23,59,59,999),{start:s,end:r}}},{label:"This Month",action:()=>{const t=new Date,i=new Date(t.getFullYear(),t.getMonth(),1),s=new Date(t.getFullYear(),t.getMonth()+1,0);return s.setHours(23,59,59,999),{start:i,end:s}}}),e}_getFormatTokens(e){const t=[];let i=0;const s=e.toLowerCase();for(;i<s.length;){const r=s[i];if(r==="d"||r==="m"||r==="y"){let n=1,a=i+1;for(;a<s.length&&s[a]===r;)n++,a++;t.push({type:"part",part:r,len:n}),i=a}else t.push({type:"sep",value:e[i]}),i++}return t}_createPartInput(e,t,i,s,r){const n=document.createElement("input");return n.type="text",n.inputMode="numeric",n.pattern="\\d*",n.maxLength=e,n.placeholder=t,n.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",n.disabled=i,n.readOnly=s,n.required=r,e===4?n.className+=" w-[40px]":e===2&&(n.className+=" w-[30px]"),n}_buildValueFromParts(e,t){let i=0;return t.map(s=>{var n;if(s.type==="sep")return s.value;const r=((n=e[i])==null?void 0:n.value)||"";return i++,r}).join("")}_applyDateToParts(e,t,i,s){if(!t.length)return;if(!e){t.forEach(c=>c.value="");return}const r=this._formatDate(e,s);let n=0,a=0;i.forEach(c=>{if(c.type==="sep")n+=c.value.length;else{const o=r.substr(n,c.len);t[a]&&(t[a].value=o),a++,n+=c.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;const e=this.getFormat(),t=this._getFormatTokens(e),i=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){const s=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=s?`${i} - ${s}`:i}else this._hiddenInput.value=i}_focusNext(e,t){if(t+1<e.length){const i=e[t+1];i.focus(),i.setSelectionRange(0,i.value.length)}}_focusPrev(e,t){if(t-1>=0){const i=e[t-1];i.focus(),i.setSelectionRange(i.value.length,i.value.length)}}_attachPartInputHandlers(e,t,i){e.forEach((s,r)=>{const n=s.maxLength||2;s.addEventListener("input",()=>{s.value=s.value.replace(/\D/g,"").slice(0,n),s.value.length>=n&&this._focusNext(e,r),this._syncHiddenInput()}),s.addEventListener("keydown",a=>{a.key==="Backspace"&&s.selectionStart===0&&s.selectionEnd===0&&this._focusPrev(e,r),a.key==="ArrowLeft"&&s.selectionStart===0&&s.selectionEnd===0&&(this._focusPrev(e,r),a.preventDefault()),a.key==="ArrowRight"&&s.selectionStart===s.value.length&&s.selectionEnd===s.value.length&&(this._focusNext(e,r),a.preventDefault())}),s.addEventListener("blur",a=>{var o;this._syncHiddenInput();const c=a.relatedTarget;c&&i.contains(c)||(this._handleBlur(((o=this._hiddenInput)==null?void 0:o.value)||""),this._exitInputMode())})})}_splitRangeInput(e,t){const i=e.split(/\s*-\s*/);return i.length>=2?[i[0],i.slice(1).join("-")]:[e]}_parseValue(e){const t=this.getFormat(),i=this._getFormatTokens(t);if(this._isRange){const[s,r]=this._splitRangeInput(e,t),n=s?this._parseDateString(s,t):null,a=r?this._parseDateString(r,t):null;if(n&&a){const[c,o]=n<=a?[n,a]:[a,n];this._selectedStartDate=c,this._selectedEndDate=o,this._currentMonth=c.getMonth(),this._currentYear=c.getFullYear()}else n&&(this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,i,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,i,t)}else{const s=this._parseDateString(e,t);s&&!isNaN(s.getTime())?(this._selectedStartDate=s,this._selectedEndDate=null,this._currentMonth=s.getMonth(),this._currentYear=s.getFullYear(),this._applyDateToParts(s,this._startPartInputs,i,t)):this._applyDateToParts(null,this._startPartInputs,i,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){const i=/[\/\-\.\s]+/;if(i.test(e)){const _=e.split(i).filter(v=>v.length>0),m=t.split(/[\/\-\.\s]+/).filter(v=>v.length>0);if(_.length===m.length){let v=0,x=0,S=0;for(let y=0;y<m.length;y++){const g=m[y].toLowerCase(),p=_[y];if(g.includes("d"))v=parseInt(p,10);else if(g.includes("m"))x=parseInt(p,10)-1;else if(g.includes("y")){let k=parseInt(p,10);const E=g.length,I=p.length;I===2&&E===4?k=Math.floor(new Date().getFullYear()/100)*100+k:I===2&&E===2&&(k=Math.floor(new Date().getFullYear()/100)*100+k),S=k}}if(v&&x>=0&&x<=11&&S){const y=new Date(S,x,v);if(!isNaN(y.getTime())&&y.getDate()===v&&y.getMonth()===x&&y.getFullYear()===S)return y}}}const r=e.replace(/[\/\-\.]/g,""),n=t.replace(/[\/\-\.]/g,"").toLowerCase();let a=n.indexOf("d"),c=n.indexOf("m"),o=n.indexOf("y");const l=[{char:"d",index:a},{char:"m",index:c},{char:"y",index:o}].sort((_,m)=>_.index-m.index);let d=0,h=0,u=0,b=0;n.length,r.length;for(const _ of l)if(_.char==="d"){const m=n.lastIndexOf("d")-n.indexOf("d")+1,v=r.substr(b,m);if(v.length===0)return null;d=parseInt(v,10),b+=v.length}else if(_.char==="m"){const m=n.lastIndexOf("m")-n.indexOf("m")+1,v=r.substr(b,m);if(v.length===0)return null;h=parseInt(v,10)-1,b+=v.length}else if(_.char==="y"){const m=n.lastIndexOf("y")-n.indexOf("y")+1,v=r.substr(b),x=Math.min(m,v.length),S=v.substr(0,x);if(S.length===0)return null;let y=parseInt(S,10);x===2&&m===4?y=Math.floor(new Date().getFullYear()/100)*100+y:x===2&&m===2&&(y=Math.floor(new Date().getFullYear()/100)*100+y),u=y,b+=x}if(!d||h<0||h>11||!u)return null;const f=new Date(u,h,d);return isNaN(f.getTime())||f.getDate()!==d||f.getMonth()!==h||f.getFullYear()!==u?null:f}_formatDate(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=t.toLowerCase();let a=t;return n.includes("dd")?a=a.replace(/dd/gi,String(i).padStart(2,"0")):n.includes("d")&&(a=a.replace(/d/gi,String(i))),n.includes("mm")?a=a.replace(/mm/gi,String(s).padStart(2,"0")):n.includes("m")&&(a=a.replace(/m/gi,String(s))),n.includes("yyyy")?a=a.replace(/yyyy/gi,String(r)):n.includes("yy")&&(a=a.replace(/yy/gi,String(r).substr(2))),a}_formatDatePhp(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l=(u,b=2)=>u.toString().padStart(b,"0"),d=u=>{const b=u%10,f=u%100;return b===1&&f!==11?"st":b===2&&f!==12?"nd":b===3&&f!==13?"rd":"th"};let h="";for(let u=0;u<t.length;u++){const b=t[u];if(b==="\\"&&u+1<t.length){h+=t[u+1],u++;continue}switch(b){case"Y":h+=r.toString();break;case"y":h+=r.toString().slice(-2);break;case"m":h+=l(s);break;case"n":h+=s.toString();break;case"M":h+=o[s-1];break;case"F":h+=c[s-1];break;case"d":h+=l(i);break;case"j":h+=i.toString();break;case"D":h+=a[e.getDay()];break;case"l":h+=n[e.getDay()];break;case"S":h+=d(i);break;default:h+=b;break}}return h}_validateDateString(e,t){const i=this._parseDateString(e,t);return i!==null&&!isNaN(i.getTime())}render(){const e=this.getLabel(),t=this.getInfo(),i=this.getValue(),s=this.isDisabled(),r=this.isReadonly(),n=this.isRequired(),a=this.getId(),c=this.getName(),o=this.getFormat(),l=this.hasError(),d=this.getErrorMessage();this._isRange=this.isRange(),this._input||(this._input=document.createElement("div"),this._input.className="relative w-full",this.appendChild(this._input));let h=this.querySelector(".mint-date-picker-label-container");if(e||t){h||(h=document.createElement("div"),h.className="mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]",this.insertBefore(h,this._input));let m=h.querySelector(".mint-date-picker-label");e?(m||(m=document.createElement("label"),m.className="mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",h.insertBefore(m,h.firstChild)),m.textContent=e,a&&this._textInput&&m.setAttribute("for",a)):m&&m.remove();let v=h.querySelector(".mint-date-picker-info");t?(v||(v=document.createElement("span"),v.className="mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",h.appendChild(v)),v.textContent=t):v&&v.remove()}else h&&h.remove();this._hiddenInput||(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.value=i||"",this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),a&&(this._hiddenInput.id=a),c&&(this._hiddenInput.name=c),this._hiddenInput.value=i||"",this._hiddenInput.setAttribute("aria-invalid",l?"true":"false");let u=this._input.querySelector(".mint-date-fields");u||(u=document.createElement("div"),this._input.appendChild(u)),this._fieldsContainer=u,this._applyErrorVisuals(l,d,s),u.innerHTML="",this._displayEl=document.createElement("div"),this._displayEl.className="flex-1 text-gray-900 dark:text-white cursor-text select-none focus:outline-none",this._displayEl.tabIndex=s?-1:0,this._displayEl.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._displayEl.addEventListener("keydown",m=>{s||r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement("div"),this._inputsWrapperEl.className="flex items-center gap-1 w-full";const b=this._getFormatTokens(o);this._startPartInputs=[],this._endPartInputs=[];const f=m=>{const v=document.createDocumentFragment();return b.forEach(x=>{if(x.type==="sep"){const S=document.createElement("span");S.textContent=x.value,S.className="text-gray-400 dark:text-gray-500 select-none",v.appendChild(S)}else{const S=x.part==="d"?"dd":x.part==="m"?"mm":x.len===2?"yy":"yyyy",y=this._createPartInput(x.len,S,s,r,n);m==="start"?this._startPartInputs.push(y):this._endPartInputs.push(y),v.appendChild(y)}}),v};if(this._inputsWrapperEl.appendChild(f("start")),this._isRange){const m=document.createElement("span");m.textContent=" - ",m.className="text-gray-400 dark:text-gray-500 select-none",this._inputsWrapperEl.appendChild(m),this._inputsWrapperEl.appendChild(f("end"))}const _=document.createElement("div");if(_.className="flex flex-col w-full",this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none",_.appendChild(this._displayEl),_.appendChild(this._inputsWrapperEl),u.appendChild(_),u.addEventListener("click",()=>{this._isInputMode||s||r||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,b,u),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,b,u),this._parseValue(i),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=s||r,!s&&!r?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-2 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";const m=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=m;const v=document.createElement("mint-icon");v.setAttribute("name","calendar"),v.className="w-4 h-4 pointer-events-none",this._iconButton.appendChild(v),this._iconButton.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=s||r}this._renderErrorState(l,d)}_renderErrorState(e,t){let i=this.querySelector(".mint-date-picker-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}_applyErrorVisuals(e,t,i){if(this._renderErrorState(e,t),this._fieldsContainer){const s=this._getFieldContainerClass(e,i);this._fieldsContainer.className=s}this._hiddenInput&&this._hiddenInput.setAttribute("aria-invalid",e?"true":"false")}_attachFormResetListener(){const 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(t=>{t.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-gray-700 text-gray-900 dark:text-white","border-2",e?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600","transition-all duration-200 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){const t=this.getFormat();if(!e){this.setValue(""),this._updateDisplayText();return}if(this._isRange){const[i,s]=this._splitRangeInput(e,t),r=i?this._parseDateString(i,t):null,n=s?this._parseDateString(s,t):null;if(r&&n){const[a,c]=r<=n?[r,n]:[n,r],o=this._formatDate(a,t),l=this._formatDate(c,t),d=`${o} - ${l}`;this.setValue(d),this._applyDateToParts(a,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(c,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=a,this._selectedEndDate=c,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}else if(r){const a=this._formatDate(r,t);this.setValue(a),this._applyDateToParts(r,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.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)){const i=this._parseDateString(e,t);if(i){const s=this._formatDate(i,t);this.setValue(s),this._applyDateToParts(i,this._startPartInputs,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._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}const t=10,i=this._iconButton.id;i&&this._iconButton.isConnected?document.getElementById(i)?this._createPopover(i):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)}):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(!e)return;if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(!this._popover)this._popover=document.createElement("mint-popover"),this._popover.setAttribute("direction","down"),this._popover.setAttribute("padding","0"),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(i=>{i.forEach(s=>{var r;if(s.type==="attributes"&&s.attributeName==="open")if((r=this._popover)==null?void 0:r.hasAttribute("open"))requestAnimationFrame(()=>{this._buildCalendar();const a=this._popover;typeof a.render=="function"&&a.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{var a;(a=this._iconButton)==null||a.focus()}),this._viewMode="calendar",this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{const a=new Date;this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()})}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:["open"]})),requestAnimationFrame(()=>{this._buildCalendar()}))})});else{if(this._popover.getAttribute("trigger-id")!==e){this._popover.setAttribute("trigger-id",e);const s=this._popover;typeof s._setupTrigger=="function"&&s._setupTrigger()}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-gray-800 rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]",this._viewMode==="calendar"?this._buildCalendarView():this._viewMode==="month"?this._buildMonthView():this._viewMode==="year"&&this._buildYearView();const e=this._popover.querySelector(".popover-content");if(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;const e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),i=["January","February","March","April","May","June","July","August","September","October","November","December"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=this.getShortcuts(),n=r.length>0;this._calendarContainer.className=n?"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]":"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";const a=document.createElement("div");a.className="flex flex-col md:flex-row md:gap-6 md:items-start";const c=document.createElement("div");c.className="flex-1 min-w-0";const o=document.createElement("div");o.className="flex items-center justify-between mb-4";const l=document.createElement("button");l.type="button",l.tabIndex=0,l.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors 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",l.setAttribute("data-keep-popover-open","true");const d=document.createElement("mint-icon");d.setAttribute("name","caret-left"),d.className="w-4 h-4",l.appendChild(d),l.addEventListener("click",()=>{this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar()}),o.appendChild(l);const h=document.createElement("div");h.className="flex items-center gap-2";const u=document.createElement("button");u.type="button",u.tabIndex=0,u.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors 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",u.setAttribute("data-keep-popover-open","true"),u.textContent=i[this._currentMonth],u.addEventListener("click",()=>{this._viewMode="month",this._buildCalendar()}),h.appendChild(u);const b=document.createElement("button");b.type="button",b.tabIndex=0,b.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors 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",b.setAttribute("data-keep-popover-open","true"),b.textContent=String(this._currentYear),b.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),h.appendChild(b),o.appendChild(h);const f=document.createElement("button");f.type="button",f.tabIndex=0,f.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors 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",f.setAttribute("data-keep-popover-open","true");const _=document.createElement("mint-icon");_.setAttribute("name","caret-right"),_.className="w-4 h-4",f.appendChild(_),f.addEventListener("click",()=>{this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar()}),o.appendChild(f);const m=document.createElement("div");m.className="grid grid-cols-7 mb-2",s.forEach(y=>{const g=document.createElement("div");g.className="text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1",g.textContent=y,m.appendChild(g)});const v=document.createElement("div");v.className="grid grid-cols-7";for(let y=0;y<t;y++){const g=document.createElement("div");g.className="w-8 h-8",v.appendChild(g)}const x=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,S=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;for(let y=1;y<=e;y++){const g=new Date(this._currentYear,this._currentMonth,y),p=this._isToday(g),k=this._isDateSelected(g),E=this._isDateInRange(g),I=x&&g<x||S&&g>S;let C="rounded-md";if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){const L=this._isSameDate(g,this._selectedStartDate),M=this._isSameDate(g,this._selectedEndDate);L&&M?C="rounded-md":L?C="rounded-l-md":M?C="rounded-r-md":E&&(C="rounded-none")}else k&&!this._isRange&&(C="rounded-md");const w=document.createElement("button");w.type="button",w.disabled=!!I,w.tabIndex=I?-1:0,w.className=`w-full h-8 ${C} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${k?"bg-slate-800 dark:bg-slate-600 text-white":E?"bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":p?"text-gray-900 dark:text-gray-100 font-semibold":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${I?"opacity-40 cursor-not-allowed":""}`,w.textContent=y.toString(),I||w.addEventListener("click",()=>{this._handleDateClick(g)}),v.appendChild(w)}if(n){const y=document.createElement("div");y.className="mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";const g=document.createElement("div");g.className="relative md:relative md:flex-1 md:min-h-0";const p=document.createElement("div");p.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",p.style.scrollbarWidth="none",p.style.msOverflowStyle="none",p.style.setProperty("-webkit-overflow-scrolling","touch");const k=document.createElement("style");k.textContent=`
44
+ `;this.innerHTML=l.trim()}}customElements.get("mint-spinner")||customElements.define("mint-spinner",P);class O extends HTMLElement{constructor(){super(),this._darkModeObserver=null}static get observedAttributes(){return["name"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","inline-flex","items-center","leading-none"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(e=>{for(const t of e)if(t.type==="attributes"&&t.attributeName==="class"){this.render();break}}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getName(){return this.getAttribute("name")||""}getIconUrl(){var t;const e=document.documentElement.getAttribute("data-icon-base-url")||((t=document.querySelector('meta[name="icon-base-url"]'))==null?void 0:t.getAttribute("content"));return e?`${e.endsWith("/")?e:`${e}/`}${this.getName()}.svg`:`/icons/${this.getName()}.svg`}render(){var c,l,o;const e=this.getName();if(!e){this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}if(!re.getIcon(e)){console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`),this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}const i=this.closest("mint-button")||((c=this.parentElement)==null?void 0:c.closest("mint-button")),s=this.closest("mint-switch")||((l=this.parentElement)==null?void 0:l.closest("mint-switch")),r=this.closest("mint-select")||((o=this.parentElement)==null?void 0:o.closest("mint-select"));if(!Array.from(this.classList).some(d=>d.startsWith("w-")||d.startsWith("h-"))&&!r){let d;s?d="w-3 h-3":i?d="w-5 h-5":d="w-[1.3em] h-[1.3em]",this.classList.remove("w-4","h-4","w-5","h-5","w-[1em]","h-[1em]","w-[1.3em]","h-[1.3em]","w-3","h-3"),d.split(" ").forEach(h=>{h&&this.classList.add(h)})}const a=this.getIconUrl();if(this.style.maskImage=`url(${a})`,this.style.webkitMaskImage=`url(${a})`,this.style.maskSize="contain",this.style.webkitMaskSize="contain",this.style.maskRepeat="no-repeat",this.style.webkitMaskRepeat="no-repeat",this.style.maskPosition="center",this.style.webkitMaskPosition="center",this.style.aspectRatio="1 / 1",this.style.backgroundColor="currentColor",this.innerHTML="",s)this.classList.remove("text-gray-100","text-gray-900"),this.classList.add("text-gray-900");else if(i)this.classList.remove("text-gray-100","text-gray-900");else{const h=document.documentElement.classList.contains("dark")?"text-gray-100":"text-gray-900";this.classList.remove("text-gray-100","text-gray-900"),this.classList.add(h)}}}customElements.get("mint-icon")||customElements.define("mint-icon",O);class F extends HTMLElement{constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1,this._handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleMouseUp=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleMouseLeave=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleTouchEnd=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchCancel=()=>{this._button&&this._button.classList.remove("mint-button-active")}}static get observedAttributes(){return["variant","tone","disabled","loading","button-type","full-width","icon-position","icon"]}connectedCallback(){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.removeEventListeners()}attributeChangedCallback(e,t,i){t!==i&&this.render()}getVariant(){return this.getAttribute("variant")||"solid"}getTone(){return this.getAttribute("tone")||"neutral"}isDisabled(){return this.hasAttribute("disabled")}isLoading(){return this.hasAttribute("loading")}getType(){return(this.getAttribute("button-type")||"default")==="submit"?"submit":"button"}isFullWidth(){return this.hasAttribute("full-width")}getIconPosition(){return this.getAttribute("icon-position")||"left"}getIcon(){return this.getAttribute("icon")||""}isIconOnly(){var i,s,r,n,a;if(!(this.getIcon()||((i=this._button)==null?void 0:i.querySelector('[slot="icon"], .mint-button-icon, mint-icon'))))return!1;const t=(s=this._button)==null?void 0:s.querySelector(".mint-button-content");if(t&&((r=t.textContent)!=null&&r.trim()))return!1;if(this._button)for(let c=this._button.firstChild;c;c=c.nextSibling){if(c.nodeType===Node.TEXT_NODE&&((n=c.textContent)!=null&&n.trim()))return!1;if(c.nodeType===Node.ELEMENT_NODE){const l=c;if(l.tagName!=="MINT-ICON"&&l.tagName!=="MINT-SPINNER"&&!l.querySelector("mint-spinner")&&!l.hasAttribute("slot")&&l.className!=="mint-button-icon"&&!(l.className==="mr-2"&&l.querySelector("mint-spinner"))&&(a=l.textContent)!=null&&a.trim())return!1}}return!0}getButtonClasses(){const e=this.isIconOnly(),t=this.getVariant(),i=["inline-flex","items-center","justify-center","font-medium","rounded-lg","box-border",...e?["p-1.5","aspect-square","w-[2rem]","h-[2rem]"]:["px-3.5","py-1.5","min-h-[2rem]"],"text-sm","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","[&.mint-button-active>*]:scale-95","[&>*]:transition-transform","[&>*]:duration-100","disabled:opacity-50","disabled:cursor-not-allowed"],s=this.getTone(),r={"solid-action":["bg-slate-800","dark:bg-slate-600","text-white","hover:bg-slate-950","dark:hover:bg-slate-700","active:bg-slate-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-slate-700","disabled:active:bg-slate-800","dark:disabled:active:bg-slate-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-neutral":["bg-white","dark:bg-gray-700","text-gray-900","dark:text-white","hover:bg-gray-50","dark:hover:bg-gray-600","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-white","dark:disabled:active:bg-gray-700","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-gray-200","dark:border-gray-600"],"solid-info":["bg-blue-800","dark:bg-blue-600","text-white","hover:bg-blue-950","dark:hover:bg-blue-700","active:bg-blue-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-blue-700","disabled:active:bg-blue-800","dark:disabled:active:bg-blue-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-warning":["bg-amber-800","dark:bg-amber-600","text-white","hover:bg-amber-950","dark:hover:bg-amber-700","active:bg-amber-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-amber-700","disabled:active:bg-amber-800","dark:disabled:active:bg-amber-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-danger":["bg-red-800","dark:bg-red-600","text-white","hover:bg-red-950","dark:hover:bg-red-700","active:bg-red-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-red-700","disabled:active:bg-red-800","dark:disabled:active:bg-red-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"ghost-action":["bg-transparent","text-slate-800","dark:text-slate-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","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-gray-800","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-gray-800","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-gray-800","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-gray-800","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-slate-800","dark:text-slate-400","hover:text-slate-950","dark:hover:text-slate-200","active:text-slate-900","dark:active:text-slate-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"]},n=`${t}-${s}`,a=r[n]||r["solid-neutral"],c=[...i,...a];return this.isFullWidth()&&c.push("w-full"),c.join(" ")}render(){var o,d,h,u,b;const e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){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 i=this._button.querySelector("mint-spinner");if(this.isLoading())if(i)i.setAttribute("data-button-variant",this.getVariant()),i.setAttribute("data-button-tone",this.getTone()),"render"in i&&typeof i.render=="function"&&i.render();else{const f=document.createElement("span");f.className="mr-2 inline-flex items-center";const _=document.createElement("mint-spinner");_.setAttribute("size","default"),_.setAttribute("data-button-variant",this.getVariant()),_.setAttribute("data-button-tone",this.getTone()),_.style.width="0.875rem",_.style.height="0.875rem",f.appendChild(_),this._button.insertBefore(f,this._button.firstChild)}else i&&((o=i.parentElement)==null||o.remove());for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);const s=this.getIcon();let r=this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');s?(r&&r.tagName!=="MINT-ICON"&&(r.remove(),r=null),!r||r.tagName!=="MINT-ICON"?(r=document.createElement("mint-icon"),r.setAttribute("name",s),r.className="mint-button-icon"):r.setAttribute("name",s)):r&&r.tagName==="MINT-ICON"&&(r.remove(),r=null),r||(r=this._button.querySelector('[slot="icon"], .mint-button-icon'));const n=this.getIconPosition();let a=this._button.querySelector(".mint-button-content");if(a){const f=r&&r.tagName==="MINT-ICON";if(r&&!r.parentElement){const _=(u=this._button.querySelector("mint-spinner"))==null?void 0:u.parentElement;f||n==="left"?_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a):a.insertAdjacentElement("afterend",r)}else if(r&&(f||n==="left")&&r.nextSibling!==a){r.remove();const _=(b=this._button.querySelector("mint-spinner"))==null?void 0:b.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a)}else r&&!f&&n==="right"&&r.previousSibling!==a&&(r.remove(),a.insertAdjacentElement("afterend",r))}else{const f=[];for(let _=this._button.firstChild;_;_=_.nextSibling){if(_.nodeType!==Node.ELEMENT_NODE){f.push(_);continue}const m=_;m.tagName!=="MINT-SPINNER"&&!m.querySelector("mint-spinner")&&_!==r&&!m.hasAttribute("slot")&&!(m.className==="mr-2"&&m.querySelector("mint-spinner"))&&f.push(_)}if(f.length>0){a=document.createElement("span"),a.className="mint-button-content inline-flex items-center",f.forEach(m=>{a.appendChild(m)});const _=(d=this._button.querySelector("mint-spinner"))==null?void 0:d.parentElement;r&&n==="left"?_?(_.insertAdjacentElement("afterend",r),r.insertAdjacentElement("afterend",a)):(this._button.insertBefore(r,this._button.firstChild),r.insertAdjacentElement("afterend",a)):r&&n==="right"?_?(_.insertAdjacentElement("afterend",a),a.insertAdjacentElement("afterend",r)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement("afterend",r)):_?_.insertAdjacentElement("afterend",a):this._button.insertBefore(a,this._button.firstChild)}else if(r&&r.tagName==="MINT-ICON"&&!r.parentElement){const _=(h=this._button.querySelector("mint-spinner"))==null?void 0:h.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,this._button.firstChild)}}const c=this.isIconOnly();r&&(r.classList.contains("mint-button-icon")||r.classList.add("mint-button-icon"),r.classList.remove("mr-1.5","ml-1.5"),c?r.tagName==="MINT-ICON"?(r.style.width="1rem",r.style.height="1rem",r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0"):(r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0",r.tagName==="svg"&&(r.style.width="1rem",r.style.height="1rem")):n==="left"?r.classList.add("mr-1.5"):r.classList.add("ml-1.5"));const l=this.getButtonClasses();this._button.className=l}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),this._clickHandler=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(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",F);class q extends HTMLElement{constructor(){super(),this._button=null,this._checked=!1}static get observedAttributes(){return["checked","disabled","label","icon"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center"),this._checked=this.hasAttribute("checked"),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null),t!==i&&this.render()}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this.render()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getIcon(){return this.getAttribute("icon")||""}hasIcon(){return!!this.getIcon()}getSwitchClasses(){const e=["relative","inline-flex","items-center","rounded-full","h-5","w-10","border","transition-colors","duration-200","ease-in-out","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","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"],t=this._checked?["bg-slate-950","dark:bg-slate-600","border-slate-700","dark:border-slate-500"]:["bg-slate-200","dark:bg-slate-400","border-slate-300","dark:border-slate-500"];return[...e,...t].join(" ")}getThumbClasses(){const 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(){const e=this.getSwitchClasses(),t=this.getThumbClasses(),i=this.getLabel(),s=this.getIcon();this._button||(this._button=document.createElement("button"),this.appendChild(this._button),this.setupEventListeners()),this._button.className=e,this._button.disabled=this.isDisabled(),this._button.setAttribute("aria-checked",String(this._checked)),this._button.setAttribute("aria-label",i),this._button.setAttribute("role","switch"),this._button.type="button";let r=this._button.querySelector("span");r||(r=document.createElement("span"),this._button.appendChild(r)),r.className=t;const n=r.querySelector("span");if(s){let a=n;a||(a=document.createElement("span"),a.className=this.getIconClasses(),r.appendChild(a));let c=a.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),a.appendChild(c)),c.setAttribute("name",s)}else n&&n.remove()}setupEventListeners(){this._button&&this._button.addEventListener("click",this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener("click",this.handleToggle.bind(this))}handleToggle(e){this.isDisabled()||(this.checked=!this._checked,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})))}}customElements.get("mint-switch")||customElements.define("mint-switch",q);class B extends HTMLElement{constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}static get observedAttributes(){return["variant","size","bold","underline","strike","italic","display"]}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(t=>this._userClasses.add(t))}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=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.hasAttribute("bold")}isUnderline(){return this.hasAttribute("underline")}isStrike(){return this.hasAttribute("strike")}isItalic(){return this.hasAttribute("italic")}getDisplay(){return this.hasAttribute("display")?this.getAttribute("display"):this.getSize()==="regular"?"inline-block":"block"}getTextClasses(){const e=this.getSize(),t=this.getVariant(),i=document.documentElement.classList.contains("dark"),s={heading:["font-semibold"],"sub-heading":["font-medium"],regular:[]},r={default:i?["text-gray-100"]:["text-gray-900"],muted:i?["text-gray-400"]:["text-gray-400"],danger:i?["text-red-400"]:["text-red-600"],success:i?["text-green-400"]:["text-green-600"]},n=[];this.isBold()&&n.push("font-bold"),this.isUnderline()&&n.push("underline"),this.isStrike()&&n.push("line-through"),this.isItalic()&&n.push("italic");const a=this.getDisplay();return[a==="block"?"block":a==="inline"?"inline":"inline-block",...s[e]||s.regular,...r[t]||r.default,...n].join(" ")}render(){const 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"],i=["text-2xl","text-lg","text-sm"];i.forEach(l=>{this.classList.remove(l),this._userClasses.delete(l)}),t.forEach(l=>{this.classList.remove(l),this._userClasses.delete(l)});const s=this.getTextClasses().split(" ").filter(l=>l.trim());Array.from(this.classList).forEach(l=>{!t.includes(l)&&!i.includes(l)&&this._userClasses.add(l)});const n=[...new Set([...s,...Array.from(this._userClasses)])];this.className=n.join(" ");const a={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)"},c=a[e]||a.regular;this.style.setProperty("font-size",c)}}customElements.get("mint-text")||customElements.define("mint-text",B);class z extends HTMLElement{constructor(){super(),this._childObserver=null}static get observedAttributes(){return["direction","text-align","gap"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,i){t!==i&&(this.render(),e==="text-align"&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{const e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&(this._childObserver.disconnect(),this._childObserver=null)}getDirection(){return(this.getAttribute("direction")||"vertical")==="horizontal"?"horizontal":"vertical"}getGap(){const e=this.getAttribute("gap")||"3";return parseFloat(e)}getTextAlign(){const e=this.getAttribute("text-align")||"";return["left","center","right","justify"].includes(e)?e:""}getStackClasses(){const e=this.getDirection(),t=this.getTextAlign(),i=this.getGap(),s=["flex",e==="horizontal"?"flex-row":"flex-col",`gap-${i}`];return t&&(s.push(`text-${t}`),s.push(`[&>*]:text-${t}`),s.push(`[&>*_.mint-button-content]:text-${t}`),t==="left"?(s.push("[&>mint-button]:!justify-start"),s.push("[&>mint-button>button]:!justify-start")):t==="right"?(s.push("[&>mint-button]:!justify-end"),s.push("[&>mint-button>button]:!justify-end")):t==="center"&&(s.push("[&>mint-button]:!justify-center"),s.push("[&>mint-button>button]:!justify-center"))),s.join(" ")}render(){const e=this.getStackClasses(),t=this.getTextAlign();["flex","flex-row","flex-col","gap-1","gap-2","gap-3","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"].forEach(r=>this.classList.remove(r)),e.split(" ").forEach(r=>{r&&this.classList.add(r)}),["box-border","m-0","p-0","border-0","align-baseline","block"].forEach(r=>{this.classList.contains(r)||this.classList.add(r)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(i=>{if(i.tagName==="MINT-BUTTON"){const s=i.querySelector("button");if(s){s.classList.remove("justify-start","justify-center","justify-end"),e==="left"?s.classList.add("justify-start"):e==="right"?s.classList.add("justify-end"):e==="center"&&s.classList.add("justify-center");const r=s.querySelector(".mint-button-content");r&&(r.classList.remove("text-left","text-center","text-right","text-justify"),r.classList.add(`text-${e}`))}}else i.classList.remove("text-left","text-center","text-right","text-justify"),i.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(t=>{if(t.tagName==="MINT-BUTTON"){const i=t.querySelector("button");if(i){i.classList.remove("justify-start","justify-end"),i.classList.add("justify-center");const s=i.querySelector(".mint-button-content");s&&s.classList.remove("text-left","text-center","text-right","text-justify")}}else t.classList.remove("text-left","text-center","text-right","text-justify")})}}customElements.get("mint-stack")||customElements.define("mint-stack",z);class V extends HTMLElement{static get observedAttributes(){return[]}constructor(){super()}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(e,t,i){t!==i&&this.render()}render(){this.classList.add("rounded-lg","shadow","bg-white","dark:bg-gray-800","border","border-gray-200","dark:border-gray-700","overflow-hidden","transition-colors","duration-200")}}customElements.get("mint-card")||customElements.define("mint-card",V);class R extends HTMLElement{constructor(){super(),this._link=null,this._contentObserver=null}static get observedAttributes(){return["href","target"]}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(),this._contentObserver=null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll("mint-text").forEach(t=>{t.classList.contains("underline")||t.classList.add("underline")})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,i){t!==i&&this.render()}getHref(){return this.getAttribute("href")||"#"}getTarget(){return this.getAttribute("target")||""}hasIcon(){var e;return!!(this.querySelector("mint-icon")||(e=this._link)!=null&&e.querySelector("mint-icon"))}render(){const 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"));const i=this.hasIcon(),s=["text-slate-800","dark:text-slate-200","underline","hover:text-slate-950","dark:hover:text-slate-100","transition-colors","duration-200","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"];i&&s.push("inline-flex","items-center","gap-2"),this._link.className=s.join(" "),this._link.querySelectorAll("mint-text").forEach(a=>{a.classList.contains("underline")||a.classList.add("underline")}),["box-border","m-0","p-0","border-0","align-baseline","inline-block"].forEach(a=>{this.classList.contains(a)||this.classList.add(a)})}}customElements.get("mint-link")||customElements.define("mint-link",R);class W extends HTMLElement{constructor(){super(),this._button=null,this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0,this._initialUrl="",this._initialOrigin="",this._popstateHandler=null}static get observedAttributes(){return["href","fallback-href"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center","justify-center"),this.render(),this._setupHistoryTracking()}disconnectedCallback(){this._popstateHandler&&(window.removeEventListener("popstate",this._popstateHandler),this._popstateHandler=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}_setupHistoryTracking(){this._initialUrl=window.location.href,this._initialOrigin=window.location.origin,this._historyDepth=window.history.length,this._popstateHandler||(this._popstateHandler=e=>{this._backAttempts=0,setTimeout(()=>{const t=window.location.origin,i=window.location.href;if(t!==this._initialOrigin){this._navigateToFallback();return}if(i.startsWith("chrome://")||i.startsWith("about:")||i.startsWith("edge://")||i==="about:blank"||i==="about:newtab"){this._navigateToFallback();return}},0)},window.addEventListener("popstate",this._popstateHandler))}getFallbackHref(){return this.getAttribute("fallback-href")||this.getAttribute("href")||"/"}handleClick(e){if(e.preventDefault(),e.stopPropagation(),this._wouldBackLeaveApp()){this._navigateToFallback();return}if(window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;const s=window.location.href,r=window.location.origin;window.history.back(),setTimeout(()=>{if(window.location.href===s)this._navigateToFallback();else{if(window.location.origin!==r){this._navigateToFallback();return}const n=window.location.href;if(n.startsWith("chrome://")||n.startsWith("about:")||n.startsWith("edge://")||n==="about:blank"||n==="about:newtab"){this._navigateToFallback();return}setTimeout(()=>{this._backAttempts=0},500)}},200)}else this._navigateToFallback()}_wouldBackLeaveApp(){const e=document.referrer,t=window.location.origin;if(window.history.length<=1||!e&&window.history.length<=2)return!0;if(e)try{if(new URL(e).origin!==t&&window.history.length<=2)return!0}catch{if(window.history.length<=2)return!0}return!1}_navigateToFallback(){var t,i,s;const e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith("/")&&!e.startsWith("//")){const r=document.querySelector("#app");if((s=(i=(t=r==null?void 0:r.__vue_app__)==null?void 0:t.config)==null?void 0:i.globalProperties)!=null&&s.$router)try{r.__vue_app__.config.globalProperties.$router.push(e);return}catch{}try{window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate"));return}catch{}}window.location.href=e}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",W);class j extends HTMLElement{constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null}static get observedAttributes(){return["heading","fallback-href","show-back-button","containered"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}getHeading(){return this.getAttribute("heading")||""}getFallbackHref(){return this.getAttribute("fallback-href")||"/"}shouldShowBackButton(){return this.hasAttribute("show-back-button")}render(){const 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));const n=this.getFallbackHref();t.setAttribute("fallback-href",n)}else t&&(t.remove(),t=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",""),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(),this._headingText=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(n=>n!==this._pageContainer&&n!==this._actionsSlot&&n.getAttribute("slot")==="actions").forEach(n=>{this._actionsSlot&&n.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(n)}),this._bodySlot||(this._bodySlot=document.createElement("div"),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(n=>{n!==this._pageContainer&&n.getAttribute("slot")!=="actions"&&n!==this._actionsSlot&&n!==this._header&&n!==this._bodySlot&&n!==this._headingText&&n.parentElement!==this._bodySlot&&n.parentElement!==this._pageContainer&&this._bodySlot.appendChild(n)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add("min-h-screen","p-8","transition-colors","duration-200"),this.hasAttribute("containered")?this._pageContainer.classList.add("max-w-6xl","mx-auto","w-full"):this._pageContainer.classList.remove("max-w-6xl","mx-auto"))}_updateBackgroundColor(){if(!this._pageContainer)return;document.documentElement.classList.contains("dark")?(this._pageContainer.classList.remove("bg-gray-20"),this._pageContainer.classList.add("bg-gray-900")):(this._pageContainer.classList.remove("bg-gray-900"),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"]}))}}customElements.get("mint-page")||customElements.define("mint-page",j);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,i){t!==i&&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(){const e=["grid"],t=this.getColumns();e.push(`grid-cols-${t}`);const i=this.getSm();i&&e.push(`sm:grid-cols-${i}`);const s=this.getMd();s&&e.push(`md:grid-cols-${s}`);const r=this.getLg();r&&e.push(`lg:grid-cols-${r}`);const n=this.getXl();n&&e.push(`xl:grid-cols-${n}`);const a=this.getGap();return e.push(`gap-${a}`),e}render(){Array.from(this.classList).filter(i=>i.startsWith("grid-cols-")||i.startsWith("sm:grid-cols-")||i.startsWith("md:grid-cols-")||i.startsWith("lg:grid-cols-")||i.startsWith("xl:grid-cols-")||i.startsWith("gap-")).forEach(i=>this.classList.remove(i)),this.classList.contains("grid")||this.classList.add("grid"),this.getGridClasses().forEach(i=>{i&&i!=="grid"&&this.classList.add(i)})}}customElements.get("mint-grid")||customElements.define("mint-grid",$);class Y extends HTMLElement{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}static get observedAttributes(){return["id","heading","open"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","inset-0","z-50"),this.isOpen()||this.classList.add("hidden"),this.render(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}getId(){return this.getAttribute("id")||""}getHeading(){return this.getAttribute("heading")||""}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const e=this.getId(),t=this.getHeading(),i=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-200 z-40",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-50",this.appendChild(this._modal)),i){let d=this._modal.querySelector(".modal-content");d||(d=document.createElement("div"),d.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(d)),this._animateEnter()}else this._animateExit();let s=this._modal.querySelector(".modal-content");s||(s=document.createElement("div"),s.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(s)),this._header||(this._header=document.createElement("div"),this._header.className="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",s.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 r=this._headingSlot.querySelector("mint-text");t?(r||(r=document.createElement("mint-text"),r.setAttribute("size","sub-heading"),r.setAttribute("bold",""),this._headingSlot.appendChild(r)),r.textContent=t):r&&r.remove(),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._headingSlot&&d.getAttribute("slot")==="heading").forEach(d=>{this._headingSlot&&d.parentElement!==this._headingSlot&&this._headingSlot.appendChild(d)}),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"),s.appendChild(this._bodySlot)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._bodySlot&&d.getAttribute("slot")==="body").forEach(d=>{this._bodySlot&&d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._actionsSlot||(this._actionsSlot=document.createElement("div"),this._actionsSlot.className="p-4 border-t border-gray-200 dark:border-gray-700",this._actionsSlot.setAttribute("slot","actions"),s.appendChild(this._actionsSlot));let c=this._actionsSlot.querySelector("mint-stack");c||(c=document.createElement("mint-stack"),c.setAttribute("direction","horizontal"),c.className="justify-end",this._actionsSlot.appendChild(c)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._actionsSlot&&d.getAttribute("slot")==="actions").forEach(d=>{Array.from(d.children).forEach(u=>{u.parentElement!==c&&c.appendChild(u)}),d.parentElement&&d.remove()}),Array.from(this.children).forEach(d=>{d!==this._overlay&&d!==this._modal&&d.getAttribute("slot")!=="heading"&&d.getAttribute("slot")!=="body"&&d.getAttribute("slot")!=="actions"&&d!==this._headingSlot&&d!==this._bodySlot&&d!==this._actionsSlot&&d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;const e=document.documentElement.classList.contains("dark"),t=this._modal.querySelector(".modal-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),t.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_animateEnter(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");e&&(e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",e.style.transition="all 200ms ease-out",this.classList.remove("hidden"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})}))}_animateExit(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");if(!e){this.classList.add("hidden");return}e.style.transition="all 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",Y);class U extends HTMLElement{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}static get observedAttributes(){return["id","direction","open","trigger-id","padding","hover"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","top-0","left-0","z-50","pointer-events-none"),this.isOpen()||this.classList.add("hidden"),this.render(),this._setupTrigger(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null),this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler),this._clickOutsideHandler=null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}attributeChangedCallback(e,t,i){t!==i&&(this.render(),(e==="trigger-id"||e==="hover")&&this._setupTrigger(),e==="open"&&this.isOpen()&&this._closeOtherPopovers())}getId(){return this.getAttribute("id")||""}getPadding(){const 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")||""}isHoverEnabled(){return this.hasAttribute("hover")}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}_setupTrigger(){const 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){const e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.hasAttribute("open")?e.removeAttribute("open"):e.setAttribute("open","")},this._triggerElement.addEventListener("click",this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();const e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||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){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||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(){const 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"};const 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");const s=t.getBoundingClientRect(),r=window.innerWidth,n=window.innerHeight,a=8;let c=this.getDirection(),l=0,o=0;switch(c){case"down":if(l=e.bottom+a,o=e.left+e.width/2-s.width/2,l+s.height>n){const d=e.top-s.height-a;d>=0?(c="up",l=d):(l=Math.max(0,n-s.height-a),l+s.height>n&&(l=0))}o<0&&(o=a),o+s.width>r&&(o=Math.max(a,r-s.width-a),o+s.width>r&&(o=r-s.width));break;case"up":if(l=e.top-s.height-a,o=e.left+e.width/2-s.width/2,l<0){const d=e.bottom+a;d+s.height<=n?(c="down",l=d):(l=Math.min(n-s.height-a,n-s.height),l<0&&(l=n-s.height))}o<0&&(o=a),o+s.width>r&&(o=Math.max(a,r-s.width-a),o+s.width>r&&(o=r-s.width));break;case"right":if(l=e.top+e.height/2-s.height/2,o=e.right+a,o+s.width>r){const d=e.left-s.width-a;d>=0?(c="left",o=d):(o=Math.max(0,r-s.width-a),o+s.width>r&&(o=r-s.width))}l<0&&(l=a),l+s.height>n&&(l=Math.max(a,n-s.height-a),l+s.height>n&&(l=n-s.height));break;case"left":if(l=e.top+e.height/2-s.height/2,o=e.left-s.width-a,o<0){const d=e.right+a;d+s.width<=r?(c="right",o=d):(o=Math.min(r-s.width-a,r-s.width),o<0&&(o=0))}l<0&&(l=a),l+s.height>n&&(l=Math.max(a,n-s.height-a),l+s.height>n&&(l=n-s.height));break}return{top:l,left:o,direction:c}}render(){const e=this.getId(),t=this.isOpen(),i=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove("hidden"),this.style.pointerEvents="auto",!this._clickOutsideHandler){const n=this;this._clickOutsideHandler=function(a){const c=a.composedPath(),l=c.includes(n);if(!(n._triggerElement&&c.includes(n._triggerElement))&&!l){n.close();return}},setTimeout(()=>{document.addEventListener("click",this._clickOutsideHandler,!1)},100)}}else this.classList.add("hidden"),this.style.pointerEvents="none",this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler,!1),this._clickOutsideHandler=null);this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 pointer-events-none z-40",this.appendChild(this._overlay)),this._popover||(this._popover=document.createElement("div"),this._popover.className="fixed z-50 pointer-events-auto",this.appendChild(this._popover)),this.isHoverEnabled()&&this._attachHoverListeners();let s=this._popover.querySelector(".popover-content");if(!s)s=document.createElement("div"),s.className=`popover-content bg-white dark:bg-gray-800 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`,this._popover.appendChild(s);else{const n=s.className.split(" "),a=["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"],c=n.filter(l=>!a.includes(l));s.className=[...c,i].join(" ")}Array.from(this.children).forEach(n=>{n!==this._overlay&&n!==this._popover&&n.parentElement===this&&s.appendChild(n)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(s):(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",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",s.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.style.transform="scale(1) translateY(0)",s.style.opacity="1"})}))):!t&&s&&(this._removePositionListeners(),s.style.opacity!=="0"&&s.style.opacity!==""&&(s.style.transition="all 200ms ease-in",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",setTimeout(()=>{s.style.transform="",s.style.opacity="",s.style.transition="",this._popover.style.visibility="",this._popover.style.display=""},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;const e=document.documentElement.classList.contains("dark"),t=this._popover.querySelector(".popover-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),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;const 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;const i=this._calculatePosition();this._popover.style.top=`${i.top}px`,this._popover.style.left=`${i.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="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){const e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("scroll",this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){const e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("resize",this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}_closeOtherPopovers(){Array.from(document.querySelectorAll("mint-popover[open]")).forEach(t=>{if(t!==this){const i=t;typeof i.close=="function"?i.close():t.removeAttribute("open")}})}}customElements.get("mint-popover")||customElements.define("mint-popover",U);class G extends HTMLElement{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}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._checkbox&&(this._checkbox.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._checkbox&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||""}getCheckboxClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-checkbox-wrapper");s||(s=document.createElement("div"),s.className="mint-checkbox-wrapper",this.insertBefore(s,this.firstChild)),this._checkbox?this._checkbox.parentElement!==s&&s.appendChild(this._checkbox):(this._checkbox=document.createElement("input"),this._checkbox.type="checkbox",s.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=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._checkbox.id=r:this._checkbox.removeAttribute("id");const n=this.getName();n?this._checkbox.name=n:this._checkbox.removeAttribute("name");const a=this.getValue();a?this._checkbox.value=a:this._checkbox.removeAttribute("value"),e?this._checkbox.setAttribute("aria-label",e):this._checkbox.removeAttribute("aria-label"),s.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,s.style.pointerEvents="none",this._checkbox.style.pointerEvents="auto";let c=s.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),c.setAttribute("name","check"),c.className="w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),this.updateVisualState();let l=this.querySelector(".mint-checkbox-label-container");if(e||t){l||(l=document.createElement("div"),l.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",this.appendChild(l));let o=l.querySelector(".mint-checkbox-label");e?(o||(o=document.createElement("span"),o.className="mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",l.insertBefore(o,l.firstChild)),o.textContent=e,i?o.classList.add("opacity-40"):o.classList.remove("opacity-40")):o&&o.remove();let d=l.querySelector(".mint-checkbox-info");if(t?(d||(d=document.createElement("span"),d.className="mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",l.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)l.style.cursor="default",l._clickHandler&&(l.removeEventListener("click",l._clickHandler),l._clickHandler=null);else{l.style.cursor="pointer";const h=l._clickHandler;h&&l.removeEventListener("click",h),l._clickHandler=u=>{this._checkbox&&(u.target===this._checkbox||this._checkbox.contains(u.target)||u.composedPath().includes(this._checkbox))||this.toggle()},l.addEventListener("click",l._clickHandler)}}else l&&l.remove()}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener("change",this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const 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=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const 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();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const 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),this._changeHandler=null),this._mousedownHandler&&(this._checkbox.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._checkbox.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._checkbox.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._checkbox.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._checkbox.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._checkbox.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._checkbox.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-checkbox-wrapper"),t=e==null?void 0:e.querySelector("mint-icon");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains("mint-checkbox-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const e=new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}}customElements.get("mint-checkbox")||customElements.define("mint-checkbox",G);class J extends HTMLElement{constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._groupChangeHandler=null,this._clickHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._radio&&(this._radio.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._radio&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._radio&&(this._radio.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}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")||""}getChoiceClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded-full","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-choice-wrapper");s||(s=document.createElement("div"),s.className="mint-choice-wrapper",this.insertBefore(s,this.firstChild)),this._radio?this._radio.parentElement!==s&&s.appendChild(this._radio):(this._radio=document.createElement("input"),this._radio.type="radio",s.appendChild(this._radio),this.setupEventListeners()),this._radio.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._radio.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;",this._radio.checked=this._checked,this._radio.disabled=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._radio.id=r:this._radio.removeAttribute("id");const n=this.getName();n?this._radio.name=n:this._radio.removeAttribute("name");const a=this.getValue();a?this._radio.value=a:this._radio.removeAttribute("value"),e?this._radio.setAttribute("aria-label",e):this._radio.removeAttribute("aria-label"),s.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,s.style.pointerEvents="none",this._radio.style.pointerEvents="auto";let c=s.querySelector(".mint-choice-indicator");c||(c=document.createElement("div"),c.className="mint-choice-indicator w-2.5 h-2.5 rounded-full bg-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),c.style.opacity=this._checked?"1":"0",c.style.transform=this._checked?"scale(1)":"scale(0.8)",this.updateVisualState();let l=this.querySelector(".mint-choice-label-container");if(e||t){l||(l=document.createElement("div"),l.className="mint-choice-label-container flex flex-col gap-0.5 flex-1",this.appendChild(l));let o=l.querySelector(".mint-choice-label");e?(o||(o=document.createElement("span"),o.className="mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",l.insertBefore(o,l.firstChild)),o.textContent=e,i?o.classList.add("opacity-40"):o.classList.remove("opacity-40")):o&&o.remove();let d=l.querySelector(".mint-choice-info");if(t?(d||(d=document.createElement("span"),d.className="mint-choice-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",l.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)l.style.cursor="default",l._clickHandler&&(l.removeEventListener("click",l._clickHandler),l._clickHandler=null);else{l.style.cursor="pointer";const h=l._clickHandler;h&&l.removeEventListener("click",h),l._clickHandler=u=>{this._radio&&(u.target===this._radio||this._radio.contains(u.target)||u.composedPath().includes(this._radio))||this.select()},l.addEventListener("click",l._clickHandler)}}else l&&l.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();const t=this._checked;if(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState(),this._checked&&this._radio){const i=this._radio.name;i&&document.querySelectorAll(`input[type="radio"][name="${i}"]`).forEach(r=>{if(r!==this._radio){const n=r.closest("mint-choice");n&&n.updateVisualState&&(n._checked=r.checked,r.checked?n.hasAttribute("checked")||n.setAttribute("checked",""):n.hasAttribute("checked")&&n.removeAttribute("checked"),n.updateVisualState())}})}if(t!==this._checked){const i=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(i)}},this._radio.addEventListener("change",this._changeHandler),this._groupChangeHandler=e=>{const t=e.target;t!==this._radio&&t.type==="radio"&&t.name===this._radio.name&&t.checked&&setTimeout(()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState())},0)},document.addEventListener("change",this._groupChangeHandler,!0),this._clickHandler=e=>{const t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),requestAnimationFrame(()=>{this._radio&&(this._checked=this._radio.checked,this.updateVisualState())})},this._radio.addEventListener("click",this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("mousedown",this._mousedownHandler),this._radio.addEventListener("mouseup",this._mouseupHandler),this._radio.addEventListener("mouseleave",this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",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(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("touchstart",this._touchstartHandler),this._radio.addEventListener("touchend",this._touchendHandler),this._focusHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&this._radio&&requestAnimationFrame(()=>{this._radio&&this._radio.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const e=this.querySelector(".mint-choice-wrapper");e&&e.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("focus",this._focusHandler),this._radio.addEventListener("blur",this._blurHandler))}removeEventListeners(){this._radio&&(this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._groupChangeHandler&&(document.removeEventListener("change",this._groupChangeHandler,!0),this._groupChangeHandler=null),this._clickHandler&&(this._radio.removeEventListener("click",this._clickHandler),this._clickHandler=null),this._mousedownHandler&&(this._radio.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._radio.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._radio.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._radio.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._radio.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._radio.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._radio.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-choice-wrapper"),t=e==null?void 0:e.querySelector(".mint-choice-indicator");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,e.classList.contains("mint-choice-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}select(){if(this._radio&&!this.isDisabled()){this._radio.checked=!0,this._radio.dispatchEvent(new Event("change",{bubbles:!0})),this._checked=!0,this.hasAttribute("checked")||this.setAttribute("checked","");const e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}}customElements.get("mint-choice")||customElements.define("mint-choice",J);class X extends HTMLElement{constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null}static get observedAttributes(){return["type","placeholder","value","disabled","id","name","required","readonly","rows","icon","label","info","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.getLabel()||console.error('mint-input: The "label" attribute is required. Please provide a label for the input.'),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}this.render()}}getType(){return this.getAttribute("type")||"text"}getRows(){const e=this.getAttribute("rows");return e?parseInt(e,10):3}_getNormalizedType(){const 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(){var e,t,i;return this._isColor()?((e=this._colorPicker)==null?void 0:e.value)||((t=this._colorTextInput)==null?void 0:t.value)||this.getAttribute("value")||"#000000":((i=this._element)==null?void 0:i.value)||this.getAttribute("value")||""}set value(e){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")}get value(){return this.getValue()}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}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(){const e=this._isTextarea(),t=!!this.getIcon(),i=this._isColor(),s=this._isNumber(),r=this.hasError(),n=["w-full",t||i?"pl-10":"px-3.5",t||i?"pr-3.5":s?"pr-10":"",e?"py-2":"py-1.5",e?"min-h-[6rem]":"min-h-[2rem]","text-sm","font-medium","rounded-lg","box-border","bg-white","dark:bg-gray-700","text-gray-900","dark:text-white",e?"transition-colors transition-opacity":"transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","readonly:cursor-default",e?"resize-y":"",s?"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none":""],a=["border-2",r?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],c=["focus-visible:ring-2","focus-visible:ring-offset-1",r?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"];return[...n,...a,...c].filter(Boolean).join(" ")}render(){var v,x,S,y;this.getType();const e=this._getNormalizedType(),t=this._isTextarea(),i=this._isMoney(),s=this._isColor(),r=this.getPlaceholder(),n=this.isDisabled(),a=this.isReadonly(),c=this.isRequired(),l=this.getId(),o=this.getName(),d=this.getAttribute("value")||(s?"#000000":""),h=this.getRows(),u=this.getIcon(),b=this.getLabel(),f=this.getInfo();if(s){this._input&&(this._input.remove(),this._input=null),this._textarea&&(this._textarea.remove(),this._textarea=null),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._colorPickerWrapper&&!s&&(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=d||"#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=p=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(":focus-visible")&&requestAnimationFrame(()=>{var k;this._colorPicker&&this._colorPicker.matches(":focus-visible")&&((k=this._colorPickerWrapper)==null||k.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",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this._colorTextInput&&(this._colorTextInput.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener("change",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("change",{detail:{value:p},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement("input"),this._colorTextInput.type="text",this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=r||"#000000",this._colorTextInput.pattern="^#[0-9A-Fa-f]{6}$",this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener("input",()=>{var k;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)&&(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener("blur",()=>{var k,E;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)?(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:((E=this._colorPicker)==null?void 0:E.value)||"#000000"},bubbles:!0,cancelable:!0}))}));const g=d||"#000000";if(this._colorPicker&&this._colorPicker.value!==g&&(this._colorPicker.value=g),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=g),this._colorTextInput&&this._colorTextInput.value!==g&&(this._colorTextInput.value=g),this._colorPicker&&(this._colorPicker.disabled=n),this._colorPickerWrapper&&(n?(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=n,this._colorTextInput.readOnly=a,this._colorTextInput.required=c),this._colorTextInput){const p=this._colorTextInput;l?p.id=l:p.removeAttribute("id"),o?p.name=o:p.removeAttribute("name"),p.setAttribute("aria-invalid",this.hasError()?"true":"false"),this._element=p}this._renderErrorState();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&&!s&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),u&&!t?this._icon?this._icon.setAttribute("name",u):(this._icon=document.createElement("mint-icon"),this._icon.setAttribute("name",u),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(),this._icon=null),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 transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const g=document.createElement("mint-icon");g.setAttribute("name","caret-up"),g.className="w-[1rem] h-[1rem]",this._numberIncrementButton.appendChild(g),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 transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const p=document.createElement("mint-icon");p.setAttribute("name","caret-down"),p.className="w-[1rem] h-[1rem]",this._numberDecrementButton.appendChild(p),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E+I;w!==void 0&&L>w&&(L=w),C!==void 0&&L<C&&(L=C),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}}),this._numberDecrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E-I;C!==void 0&&L<C&&(L=C),w!==void 0&&L>w&&(L=w),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=n||a),this._numberDecrementButton&&(this._numberDecrementButton.disabled=n||a)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&(this._input.remove(),this._input=null),this._textarea||(this._textarea=document.createElement("textarea"),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=r,this._textarea.disabled=n,this._textarea.readOnly=a,this._textarea.required=c,this._textarea.rows=h,this._textarea.setAttribute("aria-invalid",this.hasError()?"true":"false"),d!==this._textarea.value&&(this._textarea.value=d),l?this._textarea.id=l:this._textarea.removeAttribute("id"),o?this._textarea.name=o:this._textarea.removeAttribute("name"),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const g=this.firstChild.textContent;g&&!this._textarea.value&&(this._textarea.value=g.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&(this._textarea.remove(),this._textarea=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=r,this._input.disabled=n,this._input.readOnly=a,this._input.required=c,this._input.setAttribute("aria-invalid",this.hasError()?"true":"false"),i?(this._input.inputMode="decimal",this._input.pattern="[0-9]*\\.?[0-9]*"):(this._input.removeAttribute("inputmode"),this._input.removeAttribute("pattern")),d!==this._input.value&&(this._input.value=d),l?this._input.id=l:this._input.removeAttribute("id"),o?this._input.name=o:this._input.removeAttribute("name"),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const g=this.firstChild.textContent;g&&!this._input.value&&(this._input.value=g.trim()),this.removeChild(this.firstChild)}let m=this.querySelector(".mint-input-label-container");if(b||f){m||(m=document.createElement("div"),m.className="mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]",this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(m,this._wrapper):this.insertBefore(m,this.firstChild));let g=m.querySelector(".mint-input-label");if(b){g||(g=document.createElement("label"),g.className="mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",m.insertBefore(g,m.firstChild)),g.textContent=b;const k=l||((v=this._element)==null?void 0:v.id)||((x=this._colorTextInput)==null?void 0:x.id)||((S=this._input)==null?void 0:S.id)||((y=this._textarea)==null?void 0:y.id);if(k)g.setAttribute("for",k);else{const E=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=E:this._colorTextInput?this._colorTextInput.id=E:this._input?this._input.id=E:this._textarea&&(this._textarea.id=E),g.setAttribute("for",E)}n?g.classList.add("opacity-40"):g.classList.remove("opacity-40")}else g&&g.remove();let p=m.querySelector(".mint-input-info");f?(p||(p=document.createElement("span"),p.className="mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none",m.appendChild(p)),p.textContent=f,n?p.classList.add("opacity-40"):p.classList.remove("opacity-40")):p&&p.remove()}else m&&m.remove();this._renderErrorState()}_renderErrorState(){const e=this.hasError(),t=this.getErrorMessage();let i=this.querySelector(".mint-input-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-input-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}setupEventListeners(){this._element&&(this._element.addEventListener("input",()=>{var t;const e=((t=this._element)==null?void 0:t.value)||"";e?this.setAttribute("value",e):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("input",{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._element.addEventListener("blur",()=>{var t;const e=((t=this._element)==null?void 0:t.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),this._focusHandler=null),this._blurHandler&&(this._colorPicker.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}focus(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.focus():(e=this._element)==null||e.focus()}blur(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.blur():(e=this._element)==null||e.blur()}}customElements.get("mint-input")||customElements.define("mint-input",X);class K extends HTMLElement{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._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}static get observedAttributes(){return["value","label","info","disabled","id","name","required","readonly","format","min","max","range","shortcuts","display-format","error","error-message"]}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(),this._popoverObserver=null),this._removeFocusTrap(),this._resetHandler){const e=this.closest("form");e&&e.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){const s=this.hasError(),r=this.getErrorMessage();this._applyErrorVisuals(s,r,this.isDisabled());return}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()}getFormat(){return this.getAttribute("format")||"mm/dd/yyyy"}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}isRange(){return this.hasAttribute("range")}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getMin(){return this.getAttribute("min")||""}getMax(){return this.getAttribute("max")||""}getDisplayFormat(){return this.getAttribute("display-format")||"F j, Y"}getShortcuts(){const e=this.getAttribute("shortcuts");if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(i=>({label:i.label,action:this._createShortcutAction(i.action)}))}catch{const i=e.trim();if(i&&typeof window[i]=="function"){const s=window[i]();if(Array.isArray(s))return s.map(r=>({label:r.label,action:typeof r.action=="function"?r.action:this._createShortcutAction(r.action)}))}}return[]}_createShortcutAction(e){return typeof e=="function"?e:typeof e=="string"&&typeof window[e]=="function"?window[e]:()=>null}_getDefaultShortcuts(){const e=[{label:"Today",action:()=>new Date}];return this._isRange&&e.push({label:"This Week",action:()=>{const t=new Date,i=t.getDay(),s=new Date(t);s.setDate(t.getDate()-i),s.setHours(0,0,0,0);const r=new Date(s);return r.setDate(s.getDate()+6),r.setHours(23,59,59,999),{start:s,end:r}}},{label:"This Month",action:()=>{const t=new Date,i=new Date(t.getFullYear(),t.getMonth(),1),s=new Date(t.getFullYear(),t.getMonth()+1,0);return s.setHours(23,59,59,999),{start:i,end:s}}}),e}_getFormatTokens(e){const t=[];let i=0;const s=e.toLowerCase();for(;i<s.length;){const r=s[i];if(r==="d"||r==="m"||r==="y"){let n=1,a=i+1;for(;a<s.length&&s[a]===r;)n++,a++;t.push({type:"part",part:r,len:n}),i=a}else t.push({type:"sep",value:e[i]}),i++}return t}_createPartInput(e,t,i,s,r){const n=document.createElement("input");return n.type="text",n.inputMode="numeric",n.pattern="\\d*",n.maxLength=e,n.placeholder=t,n.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",n.disabled=i,n.readOnly=s,n.required=r,e===4?n.className+=" w-[40px]":e===2&&(n.className+=" w-[30px]"),n}_buildValueFromParts(e,t){let i=0;return t.map(s=>{var n;if(s.type==="sep")return s.value;const r=((n=e[i])==null?void 0:n.value)||"";return i++,r}).join("")}_applyDateToParts(e,t,i,s){if(!t.length)return;if(!e){t.forEach(c=>c.value="");return}const r=this._formatDate(e,s);let n=0,a=0;i.forEach(c=>{if(c.type==="sep")n+=c.value.length;else{const l=r.substr(n,c.len);t[a]&&(t[a].value=l),a++,n+=c.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;const e=this.getFormat(),t=this._getFormatTokens(e),i=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){const s=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=s?`${i} - ${s}`:i}else this._hiddenInput.value=i}_focusNext(e,t){if(t+1<e.length){const i=e[t+1];i.focus(),i.setSelectionRange(0,i.value.length)}}_focusPrev(e,t){if(t-1>=0){const i=e[t-1];i.focus(),i.setSelectionRange(i.value.length,i.value.length)}}_attachPartInputHandlers(e,t,i){e.forEach((s,r)=>{const n=s.maxLength||2;s.addEventListener("input",()=>{s.value=s.value.replace(/\D/g,"").slice(0,n),s.value.length>=n&&this._focusNext(e,r),this._syncHiddenInput()}),s.addEventListener("keydown",a=>{a.key==="Backspace"&&s.selectionStart===0&&s.selectionEnd===0&&this._focusPrev(e,r),a.key==="ArrowLeft"&&s.selectionStart===0&&s.selectionEnd===0&&(this._focusPrev(e,r),a.preventDefault()),a.key==="ArrowRight"&&s.selectionStart===s.value.length&&s.selectionEnd===s.value.length&&(this._focusNext(e,r),a.preventDefault())}),s.addEventListener("blur",a=>{var l;this._syncHiddenInput();const c=a.relatedTarget;c&&i.contains(c)||(this._handleBlur(((l=this._hiddenInput)==null?void 0:l.value)||""),this._exitInputMode())})})}_splitRangeInput(e,t){const i=e.split(/\s*-\s*/);return i.length>=2?[i[0],i.slice(1).join("-")]:[e]}_parseValue(e){const t=this.getFormat(),i=this._getFormatTokens(t);if(this._isRange){const[s,r]=this._splitRangeInput(e,t),n=s?this._parseDateString(s,t):null,a=r?this._parseDateString(r,t):null;if(n&&a){const[c,l]=n<=a?[n,a]:[a,n];this._selectedStartDate=c,this._selectedEndDate=l,this._currentMonth=c.getMonth(),this._currentYear=c.getFullYear()}else n&&(this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,i,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,i,t)}else{const s=this._parseDateString(e,t);s&&!isNaN(s.getTime())?(this._selectedStartDate=s,this._selectedEndDate=null,this._currentMonth=s.getMonth(),this._currentYear=s.getFullYear(),this._applyDateToParts(s,this._startPartInputs,i,t)):this._applyDateToParts(null,this._startPartInputs,i,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){const i=/[\/\-\.\s]+/;if(i.test(e)){const _=e.split(i).filter(v=>v.length>0),m=t.split(/[\/\-\.\s]+/).filter(v=>v.length>0);if(_.length===m.length){let v=0,x=0,S=0;for(let y=0;y<m.length;y++){const g=m[y].toLowerCase(),p=_[y];if(g.includes("d"))v=parseInt(p,10);else if(g.includes("m"))x=parseInt(p,10)-1;else if(g.includes("y")){let k=parseInt(p,10);const E=g.length,I=p.length;I===2&&E===4?k=Math.floor(new Date().getFullYear()/100)*100+k:I===2&&E===2&&(k=Math.floor(new Date().getFullYear()/100)*100+k),S=k}}if(v&&x>=0&&x<=11&&S){const y=new Date(S,x,v);if(!isNaN(y.getTime())&&y.getDate()===v&&y.getMonth()===x&&y.getFullYear()===S)return y}}}const r=e.replace(/[\/\-\.]/g,""),n=t.replace(/[\/\-\.]/g,"").toLowerCase();let a=n.indexOf("d"),c=n.indexOf("m"),l=n.indexOf("y");const o=[{char:"d",index:a},{char:"m",index:c},{char:"y",index:l}].sort((_,m)=>_.index-m.index);let d=0,h=0,u=0,b=0;n.length,r.length;for(const _ of o)if(_.char==="d"){const m=n.lastIndexOf("d")-n.indexOf("d")+1,v=r.substr(b,m);if(v.length===0)return null;d=parseInt(v,10),b+=v.length}else if(_.char==="m"){const m=n.lastIndexOf("m")-n.indexOf("m")+1,v=r.substr(b,m);if(v.length===0)return null;h=parseInt(v,10)-1,b+=v.length}else if(_.char==="y"){const m=n.lastIndexOf("y")-n.indexOf("y")+1,v=r.substr(b),x=Math.min(m,v.length),S=v.substr(0,x);if(S.length===0)return null;let y=parseInt(S,10);x===2&&m===4?y=Math.floor(new Date().getFullYear()/100)*100+y:x===2&&m===2&&(y=Math.floor(new Date().getFullYear()/100)*100+y),u=y,b+=x}if(!d||h<0||h>11||!u)return null;const f=new Date(u,h,d);return isNaN(f.getTime())||f.getDate()!==d||f.getMonth()!==h||f.getFullYear()!==u?null:f}_formatDate(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=t.toLowerCase();let a=t;return n.includes("dd")?a=a.replace(/dd/gi,String(i).padStart(2,"0")):n.includes("d")&&(a=a.replace(/d/gi,String(i))),n.includes("mm")?a=a.replace(/mm/gi,String(s).padStart(2,"0")):n.includes("m")&&(a=a.replace(/m/gi,String(s))),n.includes("yyyy")?a=a.replace(/yyyy/gi,String(r)):n.includes("yy")&&(a=a.replace(/yy/gi,String(r).substr(2))),a}_formatDatePhp(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=(u,b=2)=>u.toString().padStart(b,"0"),d=u=>{const b=u%10,f=u%100;return b===1&&f!==11?"st":b===2&&f!==12?"nd":b===3&&f!==13?"rd":"th"};let h="";for(let u=0;u<t.length;u++){const b=t[u];if(b==="\\"&&u+1<t.length){h+=t[u+1],u++;continue}switch(b){case"Y":h+=r.toString();break;case"y":h+=r.toString().slice(-2);break;case"m":h+=o(s);break;case"n":h+=s.toString();break;case"M":h+=l[s-1];break;case"F":h+=c[s-1];break;case"d":h+=o(i);break;case"j":h+=i.toString();break;case"D":h+=a[e.getDay()];break;case"l":h+=n[e.getDay()];break;case"S":h+=d(i);break;default:h+=b;break}}return h}_validateDateString(e,t){const i=this._parseDateString(e,t);return i!==null&&!isNaN(i.getTime())}render(){const e=this.getLabel(),t=this.getInfo(),i=this.getValue(),s=this.isDisabled(),r=this.isReadonly(),n=this.isRequired(),a=this.getId(),c=this.getName(),l=this.getFormat(),o=this.hasError(),d=this.getErrorMessage();this._isRange=this.isRange(),this._input||(this._input=document.createElement("div"),this._input.className="relative w-full",this.appendChild(this._input));let h=this.querySelector(".mint-date-picker-label-container");if(e||t){h||(h=document.createElement("div"),h.className="mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]",this.insertBefore(h,this._input));let m=h.querySelector(".mint-date-picker-label");e?(m||(m=document.createElement("label"),m.className="mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",h.insertBefore(m,h.firstChild)),m.textContent=e,a&&this._textInput&&m.setAttribute("for",a)):m&&m.remove();let v=h.querySelector(".mint-date-picker-info");t?(v||(v=document.createElement("span"),v.className="mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",h.appendChild(v)),v.textContent=t):v&&v.remove()}else h&&h.remove();this._hiddenInput||(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.value=i||"",this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),a&&(this._hiddenInput.id=a),c&&(this._hiddenInput.name=c),this._hiddenInput.value=i||"",this._hiddenInput.setAttribute("aria-invalid",o?"true":"false");let u=this._input.querySelector(".mint-date-fields");u||(u=document.createElement("div"),this._input.appendChild(u)),this._fieldsContainer=u,this._applyErrorVisuals(o,d,s),u.innerHTML="",this._displayEl=document.createElement("div"),this._displayEl.className="flex-1 text-gray-900 dark:text-white cursor-text select-none focus:outline-none",this._displayEl.tabIndex=s?-1:0,this._displayEl.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._displayEl.addEventListener("keydown",m=>{s||r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement("div"),this._inputsWrapperEl.className="flex items-center gap-1 w-full";const b=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];const f=m=>{const v=document.createDocumentFragment();return b.forEach(x=>{if(x.type==="sep"){const S=document.createElement("span");S.textContent=x.value,S.className="text-gray-400 dark:text-gray-500 select-none",v.appendChild(S)}else{const S=x.part==="d"?"dd":x.part==="m"?"mm":x.len===2?"yy":"yyyy",y=this._createPartInput(x.len,S,s,r,n);m==="start"?this._startPartInputs.push(y):this._endPartInputs.push(y),v.appendChild(y)}}),v};if(this._inputsWrapperEl.appendChild(f("start")),this._isRange){const m=document.createElement("span");m.textContent=" - ",m.className="text-gray-400 dark:text-gray-500 select-none",this._inputsWrapperEl.appendChild(m),this._inputsWrapperEl.appendChild(f("end"))}const _=document.createElement("div");if(_.className="flex flex-col w-full",this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none",_.appendChild(this._displayEl),_.appendChild(this._inputsWrapperEl),u.appendChild(_),u.addEventListener("click",()=>{this._isInputMode||s||r||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,b,u),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,b,u),this._parseValue(i),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=s||r,!s&&!r?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-2 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";const m=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=m;const v=document.createElement("mint-icon");v.setAttribute("name","calendar"),v.className="w-4 h-4 pointer-events-none",this._iconButton.appendChild(v),this._iconButton.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=s||r}this._renderErrorState(o,d)}_renderErrorState(e,t){let i=this.querySelector(".mint-date-picker-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}_applyErrorVisuals(e,t,i){if(this._renderErrorState(e,t),this._fieldsContainer){const s=this._getFieldContainerClass(e,i);this._fieldsContainer.className=s}this._hiddenInput&&this._hiddenInput.setAttribute("aria-invalid",e?"true":"false")}_attachFormResetListener(){const 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(t=>{t.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-gray-700 text-gray-900 dark:text-white","border-2",e?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600","transition-all duration-200 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){const t=this.getFormat();if(!e){this.setValue(""),this._updateDisplayText();return}if(this._isRange){const[i,s]=this._splitRangeInput(e,t),r=i?this._parseDateString(i,t):null,n=s?this._parseDateString(s,t):null;if(r&&n){const[a,c]=r<=n?[r,n]:[n,r],l=this._formatDate(a,t),o=this._formatDate(c,t),d=`${l} - ${o}`;this.setValue(d),this._applyDateToParts(a,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(c,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=a,this._selectedEndDate=c,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}else if(r){const a=this._formatDate(r,t);this.setValue(a),this._applyDateToParts(r,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.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)){const i=this._parseDateString(e,t);if(i){const s=this._formatDate(i,t);this.setValue(s),this._applyDateToParts(i,this._startPartInputs,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._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}const t=10,i=this._iconButton.id;i&&this._iconButton.isConnected?document.getElementById(i)?this._createPopover(i):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)}):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(!e)return;if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(!this._popover)this._popover=document.createElement("mint-popover"),this._popover.setAttribute("direction","down"),this._popover.setAttribute("padding","0"),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(i=>{i.forEach(s=>{var r;if(s.type==="attributes"&&s.attributeName==="open")if((r=this._popover)==null?void 0:r.hasAttribute("open"))requestAnimationFrame(()=>{this._buildCalendar();const a=this._popover;typeof a.render=="function"&&a.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{var a;(a=this._iconButton)==null||a.focus()}),this._viewMode="calendar",this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{const a=new Date;this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()})}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:["open"]})),requestAnimationFrame(()=>{this._buildCalendar()}))})});else{if(this._popover.getAttribute("trigger-id")!==e){this._popover.setAttribute("trigger-id",e);const s=this._popover;typeof s._setupTrigger=="function"&&s._setupTrigger()}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-gray-800 rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]",this._viewMode==="calendar"?this._buildCalendarView():this._viewMode==="month"?this._buildMonthView():this._viewMode==="year"&&this._buildYearView();const e=this._popover.querySelector(".popover-content");if(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;const e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),i=["January","February","March","April","May","June","July","August","September","October","November","December"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=this.getShortcuts(),n=r.length>0;this._calendarContainer.className=n?"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]":"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";const a=document.createElement("div");a.className="flex flex-col md:flex-row md:gap-6 md:items-start";const c=document.createElement("div");c.className="flex-1 min-w-0";const l=document.createElement("div");l.className="flex items-center justify-between mb-4";const o=document.createElement("button");o.type="button",o.tabIndex=0,o.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors 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",o.setAttribute("data-keep-popover-open","true");const d=document.createElement("mint-icon");d.setAttribute("name","caret-left"),d.className="w-4 h-4",o.appendChild(d),o.addEventListener("click",()=>{this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar()}),l.appendChild(o);const h=document.createElement("div");h.className="flex items-center gap-2";const u=document.createElement("button");u.type="button",u.tabIndex=0,u.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors 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",u.setAttribute("data-keep-popover-open","true"),u.textContent=i[this._currentMonth],u.addEventListener("click",()=>{this._viewMode="month",this._buildCalendar()}),h.appendChild(u);const b=document.createElement("button");b.type="button",b.tabIndex=0,b.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors 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",b.setAttribute("data-keep-popover-open","true"),b.textContent=String(this._currentYear),b.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),h.appendChild(b),l.appendChild(h);const f=document.createElement("button");f.type="button",f.tabIndex=0,f.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors 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",f.setAttribute("data-keep-popover-open","true");const _=document.createElement("mint-icon");_.setAttribute("name","caret-right"),_.className="w-4 h-4",f.appendChild(_),f.addEventListener("click",()=>{this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar()}),l.appendChild(f);const m=document.createElement("div");m.className="grid grid-cols-7 mb-2",s.forEach(y=>{const g=document.createElement("div");g.className="text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1",g.textContent=y,m.appendChild(g)});const v=document.createElement("div");v.className="grid grid-cols-7";for(let y=0;y<t;y++){const g=document.createElement("div");g.className="w-8 h-8",v.appendChild(g)}const x=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,S=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;for(let y=1;y<=e;y++){const g=new Date(this._currentYear,this._currentMonth,y),p=this._isToday(g),k=this._isDateSelected(g),E=this._isDateInRange(g),I=x&&g<x||S&&g>S;let C="rounded-md";if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){const L=this._isSameDate(g,this._selectedStartDate),M=this._isSameDate(g,this._selectedEndDate);L&&M?C="rounded-md":L?C="rounded-l-md":M?C="rounded-r-md":E&&(C="rounded-none")}else k&&!this._isRange&&(C="rounded-md");const w=document.createElement("button");w.type="button",w.disabled=!!I,w.tabIndex=I?-1:0,w.className=`w-full h-8 ${C} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${k?"bg-slate-800 dark:bg-slate-600 text-white":E?"bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":p?"text-gray-900 dark:text-gray-100 font-semibold":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${I?"opacity-40 cursor-not-allowed":""}`,w.textContent=y.toString(),I||w.addEventListener("click",()=>{this._handleDateClick(g)}),v.appendChild(w)}if(n){const y=document.createElement("div");y.className="mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";const g=document.createElement("div");g.className="relative md:relative md:flex-1 md:min-h-0";const p=document.createElement("div");p.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",p.style.scrollbarWidth="none",p.style.msOverflowStyle="none",p.style.setProperty("-webkit-overflow-scrolling","touch");const k=document.createElement("style");k.textContent=`
45
45
  .mint-date-shortcuts-row::-webkit-scrollbar {
46
46
  display: none;
47
47
  }
@@ -65,4 +65,4 @@
65
65
  background: rgba(255, 255, 255, 0.2);
66
66
  }
67
67
  }
68
- `,p.classList.add("mint-date-shortcuts-row"),document.head.querySelector("style[data-mint-date-shortcuts]")||(k.setAttribute("data-mint-date-shortcuts","true"),document.head.appendChild(k));const E=document.createElement("div");E.className="absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200 md:hidden",g.appendChild(E);const I=document.createElement("div");I.className="absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden",g.appendChild(I);const C=document.createElement("div");C.className="hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200",g.appendChild(C);const w=document.createElement("div");w.className="hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200",g.appendChild(w);const L=()=>{if(window.innerWidth>=768){const T=p.scrollTop,H=p.scrollHeight,D=p.clientHeight;T>0?C.style.opacity="1":C.style.opacity="0",T+D<H-1?w.style.opacity="1":w.style.opacity="0",E.style.opacity="0",I.style.opacity="0"}else{const T=p.scrollLeft,H=p.scrollWidth,D=p.clientWidth;T>0?E.style.opacity="1":E.style.opacity="0",T+D<H-1?I.style.opacity="1":I.style.opacity="0",C.style.opacity="0",w.style.opacity="0"}};p.addEventListener("scroll",L),window.addEventListener("resize",L),setTimeout(L,0),r.forEach(M=>{const T=document.createElement("button");T.type="button",T.tabIndex=0,T.className="px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",T.textContent=M.label,T.setAttribute("data-keep-popover-open","true"),T.addEventListener("click",()=>{const H=M.action();if(H){if(this._isRange&&"start"in H&&"end"in H){this._selectedStartDate=H.start,this._selectedEndDate=H.end;const D=this.getFormat(),N=this._formatDate(H.start,D),ie=this._formatDate(H.end,D),se=`${N} - ${ie}`;this.setValue(se),this._currentMonth=H.start.getMonth(),this._currentYear=H.start.getFullYear()}else if(H instanceof Date){this._selectedStartDate=H,this._selectedEndDate=null;const D=this.getFormat(),N=this._formatDate(H,D);this.setValue(N),this._currentMonth=H.getMonth(),this._currentYear=H.getFullYear()}this._buildCalendar(),this._popover&&typeof this._popover.close=="function"&&this._popover.close(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0}))}}),p.appendChild(T)}),g.appendChild(p),y.appendChild(g),a.appendChild(y)}c.appendChild(o),c.appendChild(m),c.appendChild(v),a.appendChild(c),this._calendarContainer.appendChild(a)}_buildMonthView(){if(!this._calendarContainer)return;const e=["January","February","March","April","May","June","July","August","September","October","November","December"],t=document.createElement("div");t.className="flex items-center justify-between mb-4";const i=document.createElement("button");i.type="button",i.tabIndex=0,i.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",i.setAttribute("data-keep-popover-open","true");const s=document.createElement("mint-icon");s.setAttribute("name","caret-left"),s.className="w-4 h-4",i.appendChild(s),i.addEventListener("click",()=>{this._currentYear--,this._buildCalendar()}),t.appendChild(i);const r=document.createElement("button");r.type="button",r.tabIndex=0,r.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 rounded px-1",r.setAttribute("data-keep-popover-open","true"),r.textContent=String(this._currentYear),r.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),t.appendChild(r);const n=document.createElement("button");n.type="button",n.tabIndex=0,n.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",n.setAttribute("data-keep-popover-open","true");const a=document.createElement("mint-icon");a.setAttribute("name","caret-right"),a.className="w-4 h-4",n.appendChild(a),n.addEventListener("click",()=>{this._currentYear++,this._buildCalendar()}),t.appendChild(n);const c=document.createElement("div");c.className="grid grid-cols-3 gap-2",e.forEach((o,l)=>{const d=document.createElement("button");d.type="button",d.tabIndex=0,d.setAttribute("data-keep-popover-open","true");const h=this._currentMonth===l;d.className=`p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h?"bg-slate-800 dark:bg-slate-600 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,d.textContent=o,d.addEventListener("click",()=>{this._currentMonth=l,this._viewMode="calendar",this._buildCalendar()}),c.appendChild(d)}),this._calendarContainer.appendChild(t),this._calendarContainer.appendChild(c)}_buildYearView(){if(!this._calendarContainer)return;const e=this._currentYear-6,t=this._currentYear+6,i=document.createElement("div");i.className="flex items-center justify-between mb-4";const s=document.createElement("button");s.type="button",s.tabIndex=0,s.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",s.setAttribute("data-keep-popover-open","true");const r=document.createElement("mint-icon");r.setAttribute("name","caret-left"),r.className="w-4 h-4",s.appendChild(r),s.addEventListener("click",()=>{this._currentYear-=12,this._buildCalendar()}),i.appendChild(s);const n=document.createElement("div");n.className="text-sm font-medium text-gray-900 dark:text-gray-100",n.textContent=`${e} - ${t}`,i.appendChild(n);const a=document.createElement("button");a.type="button",a.tabIndex=0,a.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",a.setAttribute("data-keep-popover-open","true");const c=document.createElement("mint-icon");c.setAttribute("name","caret-right"),c.className="w-4 h-4",a.appendChild(c),a.addEventListener("click",()=>{this._currentYear+=12,this._buildCalendar()}),i.appendChild(a);const o=document.createElement("div");o.className="grid grid-cols-3 gap-2";for(let l=e;l<=t;l++){const d=document.createElement("button");d.type="button",d.tabIndex=0,d.setAttribute("data-keep-popover-open","true");const h=this._currentYear===l;d.className=`p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h?"bg-slate-800 dark:bg-slate-600 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,d.textContent=String(l),d.addEventListener("click",()=>{this._currentYear=l,this._viewMode="calendar",this._buildCalendar()}),o.appendChild(d)}this._calendarContainer.appendChild(i),this._calendarContainer.appendChild(o)}_getDaysInMonth(e,t){return new Date(t,e+1,0).getDate()}_getFirstDayOfMonth(e,t){return new Date(t,e,1).getDay()}_isToday(e){const t=new Date;return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isDateSelected(e){return this._isRange?this._selectedStartDate!==null&&this._isSameDate(e,this._selectedStartDate)||this._selectedEndDate!==null&&this._isSameDate(e,this._selectedEndDate):this._selectedStartDate!==null&&this._isSameDate(e,this._selectedStartDate)}_isDateInRange(e){return!this._isRange||!this._selectedStartDate||!this._selectedEndDate?!1:e>=this._selectedStartDate&&e<=this._selectedEndDate}_hasIncompleteRange(){return this._isRange&&this._selectedStartDate!==null&&this._selectedEndDate===null}_isSameDate(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_handleDateClick(e){const t=this.getFormat();if(this._isRange){if(!this._selectedStartDate||this._selectedStartDate&&this._selectedEndDate?(this._selectedStartDate=e,this._selectedEndDate=null):this._selectedStartDate&&!this._selectedEndDate&&(e<this._selectedStartDate?(this._selectedEndDate=this._selectedStartDate,this._selectedStartDate=e):this._selectedEndDate=e),this._selectedStartDate&&this._selectedEndDate){const i=this._formatDate(this._selectedStartDate,t),s=this._formatDate(this._selectedEndDate,t),r=`${i} - ${s}`;this.setValue(r),this._textInput&&(this._textInput.value=r),this._popover&&typeof this._popover.close=="function"&&this._popover.close()}else if(this._selectedStartDate){const i=this._formatDate(this._selectedStartDate,t);this.setValue(i),this._textInput&&(this._textInput.value=i)}}else{this._selectedStartDate=e;const i=this._formatDate(e,t);this.setValue(i),this._textInput&&(this._textInput.value=i),this._popover&&typeof this._popover.close=="function"&&this._popover.close()}this._buildCalendar(),this._updateDisplayText(),this._exitInputMode(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0}))}_updateDisplayText(){if(!this._displayEl)return;const e=this.getDisplayFormat();let t="";this._isRange?this._selectedStartDate&&this._selectedEndDate?t=`${this._formatDatePhp(this._selectedStartDate,e)} - ${this._formatDatePhp(this._selectedEndDate,e)}`:this._selectedStartDate&&(t=this._formatDatePhp(this._selectedStartDate,e)):this._selectedStartDate&&(t=this._formatDatePhp(this._selectedStartDate,e)),t?(this._displayEl.textContent=t,this._displayEl.classList.remove("text-gray-400","dark:text-gray-500"),this._displayEl.classList.add("text-gray-900","dark:text-white")):(this._displayEl.textContent="Select date",this._displayEl.classList.add("text-gray-400","dark:text-gray-500"),this._displayEl.classList.remove("text-gray-900","dark:text-white")),this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none")}_enterInputMode(){if(!this._isInputMode&&(this._isInputMode=!0,this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display="none",this._inputsWrapperEl.style.display="flex"),this._startPartInputs.length>0)){const e=this._startPartInputs[0];requestAnimationFrame(()=>{e.focus();try{e.setSelectionRange(0,e.value.length)}catch{}})}}_exitInputMode(){this._isInputMode&&(this._isInputMode=!1,this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display="flex",this._inputsWrapperEl.style.display="none"),this._updateDisplayText())}_getFocusableElements(){if(!this._calendarContainer)return[];const e=["button:not([disabled])","a[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");return Array.from(this._calendarContainer.querySelectorAll(e)).filter(i=>{const s=window.getComputedStyle(i);return s.display!=="none"&&s.visibility!=="hidden"})}_setupFocusTrap(){if(!this._popover||!this._popover.hasAttribute("open"))return;this._removeFocusTrap();const e=this;this._focusTrapHandler=function(t){var c;if(t.key!=="Tab")return;if(!e._popover||!e._popover.hasAttribute("open")){e._removeFocusTrap();return}const i=e._getFocusableElements();if(i.length===0)return;const s=i[0],r=i[i.length-1],n=document.activeElement;if(!(((c=e._calendarContainer)==null?void 0:c.contains(n))||!1)){t.preventDefault(),s.focus();return}if(t.shiftKey&&n===s){t.preventDefault(),r.focus();return}if(!t.shiftKey&&n===r){t.preventDefault(),s.focus();return}},this._escapeHandler=function(t){(t.key==="Escape"||t.key==="Esc")&&e._popover&&e._popover.hasAttribute("open")&&(t.preventDefault(),t.stopPropagation(),typeof e._popover.close=="function"&&e._popover.close())},document.addEventListener("keydown",this._focusTrapHandler,!0),document.addEventListener("keydown",this._escapeHandler,!0),requestAnimationFrame(()=>{const t=this._getFocusableElements();t.length>0&&t[0].focus()})}_removeFocusTrap(){this._focusTrapHandler&&(document.removeEventListener("keydown",this._focusTrapHandler,!0),this._focusTrapHandler=null),this._escapeHandler&&(document.removeEventListener("keydown",this._escapeHandler,!0),this._escapeHandler=null)}}customElements.get("mint-date-picker")||customElements.define("mint-date-picker",K);class Z extends HTMLElement{constructor(){super(),this._select=null,this._wrapper=null,this._caretUpIcon=null,this._caretDownIcon=null,this._changeHandler=null}static get observedAttributes(){return["name","value","disabled","id","required","label","info","error","error-message","multiple"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","w-full"),this.getLabel()||console.error('mint-select: The "label" attribute is required. Please provide a label for the select.'),this.render()}disconnectedCallback(){this._select&&this._changeHandler&&(this._select.removeEventListener("change",this._changeHandler),this._changeHandler=null)}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._renderErrorState(),this._select&&(this._select.className=this.getSelectClasses(),this._select.setAttribute("aria-invalid",this.hasError()?"true":"false"));return}if(e==="value"&&this._select){this._select.value=i||"";return}this.render()}}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||(this._select?this._select.value:"")}setValue(e){this._select&&(this._select.value=e,this.setAttribute("value",e))}isDisabled(){return this.hasAttribute("disabled")}isMultiple(){return this.hasAttribute("multiple")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getId(){return this.getAttribute("id")||""}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getSelectClasses(){const e=this.hasError(),t=this.isMultiple(),i=["w-full","px-3.5",t?"pr-3.5":"pr-10",t?"py-2":"py-1.5",t?"min-h-[6rem]":"min-h-[2rem]","text-sm","font-medium","rounded-lg","box-border","bg-white","dark:bg-gray-700","text-gray-900","dark:text-white","transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","appearance-none","bg-no-repeat","bg-right","cursor-pointer"],s=["border-2",e?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],r=["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"];return[...i,...s,...r].filter(Boolean).join(" ")}render(){const e=[];this._select&&Array.from(this._select.children).forEach(h=>{(h.tagName==="OPTION"||h.tagName==="OPTGROUP")&&e.push(h.cloneNode(!0))});const t=Array.from(this.children).filter(h=>h.tagName==="OPTION"||h.tagName==="OPTGROUP").map(h=>h.cloneNode(!0));for(;this.firstChild;)this.removeChild(this.firstChild);this._wrapper=null,this._select=null;const i=this.getLabel(),s=this.getInfo(),r=this.getId(),n=this.getName(),a=this.getValue(),c=this.isDisabled(),o=this.isMultiple(),l=this.hasError();if(i){const h=document.createElement("label");h.className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",r&&h.setAttribute("for",r);const u=document.createTextNode(i);h.appendChild(u),this.appendChild(h)}this._wrapper=document.createElement("div"),this._wrapper.className="relative w-full",this.appendChild(this._wrapper),this._select=document.createElement("select"),this._select.className=this.getSelectClasses(),r&&(this._select.id=r),n&&(this._select.name=n),c&&(this._select.disabled=!0),o&&(this._select.multiple=!0),a&&(this._select.value=a),this._select.setAttribute("aria-invalid",l?"true":"false");const d=e.length>0?e:t;if(d.length>0&&d.forEach(h=>{this._select.appendChild(h)}),this._select.options.length===0){const h=document.createElement("option");h.value="",h.textContent="Select an option",h.disabled=!0,h.selected=!0,this._select.appendChild(h)}if(this._changeHandler&&this._select&&this._select.removeEventListener("change",this._changeHandler),this._changeHandler=h=>{const b=h.target.value;b?this.setAttribute("value",b):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:{value:b},bubbles:!0,cancelable:!0,composed:!0}))},this._select.addEventListener("change",this._changeHandler),this._wrapper.appendChild(this._select),o)this._caretUpIcon=null,this._caretDownIcon=null;else{const h=document.createElement("div");h.className="absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col",this._caretUpIcon=document.createElement("mint-icon"),this._caretUpIcon.setAttribute("name","caret-up"),this._caretUpIcon.className="w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]",h.appendChild(this._caretUpIcon),this._caretDownIcon=document.createElement("mint-icon"),this._caretDownIcon.setAttribute("name","caret-down"),this._caretDownIcon.className="w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]",h.appendChild(this._caretDownIcon),this._wrapper.appendChild(h)}if(s){const h=document.createElement("div");h.className="mt-1 text-xs text-gray-500 dark:text-gray-400",h.textContent=s,this.appendChild(h)}this._renderErrorState()}_renderErrorState(){const e=this.hasError(),t=this.getErrorMessage();let i=this.querySelector(".mint-select-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-select-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}}customElements.get("mint-select")||customElements.define("mint-select",Z);class Q extends HTMLElement{constructor(){super(),this._dropzone=null,this._fileInput=null,this._previewContainer=null,this._isDragging=!1,this._wasDragging=!1,this._isUpdatingFiles=!1,this._listenersInitialized=!1,this._selectedFiles=[],this._previewUrls=[],this._resetHandler=null}static get observedAttributes(){return["label","accept","multiple","width","height","disabled","name","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._attachFormResetListener()}disconnectedCallback(){if(this.removeEventListeners(),this._cleanupPreviewUrls(),this._resetHandler){const e=this.closest("form");e&&e.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._updateDragStateClass(),this._renderErrorState(this.hasError(),this.getErrorMessage());return}this.render()}}getLabel(){return this.getAttribute("label")||""}getAccept(){return this.getAttribute("accept")||""}isMultiple(){return this.hasAttribute("multiple")}getWidth(){return this.getAttribute("width")||"200px"}getHeight(){return this.getAttribute("height")||"200px"}getName(){return this.getAttribute("name")||""}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}isDisabled(){return this.hasAttribute("disabled")}render(){const e=this.getLabel(),t=this.getAccept(),i=this.isMultiple(),s=this.isDisabled(),r=this.getWidth(),n=this.getHeight(),a=this.getName(),c=this.hasError(),o=this.getErrorMessage();this._dropzone||(this._dropzone=document.createElement("div"),this.appendChild(this._dropzone)),this._updateDragStateClass(),this._dropzone.setAttribute("aria-invalid",c?"true":"false"),this._dropzone.style.width=r,this._dropzone.style.height=n,this._dropzone.style.minWidth=r,this._dropzone.style.minHeight=n,this._fileInput||(this._fileInput=document.createElement("input"),this._fileInput.type="file",this._fileInput.style.display="none",this._dropzone.appendChild(this._fileInput)),this._fileInput.accept=t,this._fileInput.multiple=i,this._fileInput.disabled=s,a?this._fileInput.name=a:this._fileInput.removeAttribute("name"),this._fileInput.setAttribute("aria-invalid",c?"true":"false");const l=this._dropzone.querySelector(".mint-dropzone-icon"),d=this._dropzone.querySelector(".mint-dropzone-label");l&&l.remove(),d&&d.remove();const h=document.createElement("div");h.className="mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";const u=document.createElement("mint-icon");if(u.setAttribute("name","upload"),u.className="w-12 h-12 text-gray-400 dark:text-gray-500",h.appendChild(u),this._dropzone.appendChild(h),e){const b=document.createElement("div");b.className="mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0",b.textContent=e,this._dropzone.appendChild(b)}this.setupEventListeners(),this._renderErrorState(c,o),this._renderPreviews()}_updateDragState(){this._dropzone&&this._updateDragStateClass()}_renderErrorState(e,t){let i=this.querySelector(".mint-dropzone-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-dropzone-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}_updateDragStateClass(){if(!this._dropzone)return;const e=this.isDisabled(),t=this.hasError(),r=`relative border-2 border-dashed rounded-lg transition-all duration-200 flex flex-col items-center ${this._selectedFiles.length>0?"justify-start":"justify-center"} cursor-pointer overflow-hidden`,n=this._isDragging?"border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-gray-800":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 hover:border-gray-400 dark:hover:border-gray-500",a=t?"border-red-300 dark:border-red-300 bg-red-50/50 dark:bg-red-900/30":"",c=e?"opacity-40 cursor-not-allowed":"";this._dropzone.className=`${r} ${t?a:n} ${c}`.trim()}setupEventListeners(){this._listenersInitialized||(this._listenersInitialized=!0,this.removeEventListeners(),!(!this._dropzone||!this._fileInput||this.isDisabled())&&(this._onDropzoneClick||(this._onDropzoneClick=e=>{if(!(this.isDisabled()||!this._fileInput)&&e.target!==this._fileInput&&(e.stopPropagation(),e.preventDefault(),e.isTrusted))try{this._fileInput.click()}catch(t){console.debug("File chooser blocked:",t)}}),this._onDragOver||(this._onDragOver=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||this._isDragging||(this._isDragging=!0,this._wasDragging=!0,this._updateDragState())}),this._onDragLeave||(this._onDragLeave=e=>{var i;e.preventDefault(),e.stopPropagation();const t=(i=this._dropzone)==null?void 0:i.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState())}),this._onDrop||(this._onDrop=e=>{var i;if(e.preventDefault(),e.stopPropagation(),this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState()),this.isDisabled())return;const t=(i=e.dataTransfer)==null?void 0:i.files;t&&t.length>0&&this._handleFiles(t)}),this._onFileInputInput||(this._onFileInputInput=e=>{e.stopImmediatePropagation(),e.stopPropagation()}),this._onFileInputChange||(this._onFileInputChange=e=>{if(e.stopImmediatePropagation(),e.stopPropagation(),this._isUpdatingFiles)return;const i=e.target.files;if(i&&i.length>0){const s=this.getAccept(),r=this.isMultiple(),n=[],a=[];for(let c=0;c<i.length;c++){const o=i[c];this._isFileAccepted(o,s)?n.push(o):a.push(o)}if(!r&&n.length>1&&(a.push(...n.slice(1)),n.splice(1)),a.length>0){const c=new CustomEvent("dropRejected",{detail:{files:a,reason:"File type not accepted or multiple files not allowed"},bubbles:!0,cancelable:!0});this.dispatchEvent(c)}n.length>0&&this._applyValidFiles(n)}}),this._dropzone.addEventListener("click",this._onDropzoneClick),this._dropzone.addEventListener("dragover",this._onDragOver),this._dropzone.addEventListener("dragleave",this._onDragLeave),this._dropzone.addEventListener("drop",this._onDrop),this._fileInput.addEventListener("change",this._onFileInputChange),this._fileInput.addEventListener("input",this._onFileInputInput,!0)))}removeEventListeners(){this._dropzone&&(this._onDropzoneClick&&this._dropzone.removeEventListener("click",this._onDropzoneClick),this._onDragOver&&this._dropzone.removeEventListener("dragover",this._onDragOver),this._onDragLeave&&this._dropzone.removeEventListener("dragleave",this._onDragLeave),this._onDrop&&this._dropzone.removeEventListener("drop",this._onDrop)),this._fileInput&&(this._onFileInputChange&&this._fileInput.removeEventListener("change",this._onFileInputChange),this._onFileInputInput&&this._fileInput.removeEventListener("input",this._onFileInputInput,!0)),this._isDragging=!1,this._listenersInitialized=!1}_handleFiles(e){const t=this.getAccept(),i=this.isMultiple(),s=[],r=[];for(let n=0;n<e.length;n++){const a=e[n];this._isFileAccepted(a,t)?s.push(a):r.push(a)}if(!i&&s.length>1&&(r.push(...s.slice(1)),s.splice(1)),r.length>0){const n=new CustomEvent("dropRejected",{detail:{files:r,reason:"File type not accepted or multiple files not allowed"},bubbles:!0,cancelable:!0});this.dispatchEvent(n)}s.length>0&&this._applyValidFiles(s)}_isFileAccepted(e,t){var s;if(!t)return!0;const i=t.split(",").map(r=>r.trim().toLowerCase());for(const r of i)if(r.startsWith(".")){if("."+((s=e.name.split(".").pop())==null?void 0:s.toLowerCase())===r)return!0}else if(r.includes("/*")){const n=r.split("/")[0],a=e.type.split("/")[0];if(n===a)return!0}else if(e.type===r)return!0;return!1}_dispatchEvent(e,t){const i=t.target,s=new CustomEvent(e,{detail:{files:i.files?Array.from(i.files):[],value:i.value||""},bubbles:!0,cancelable:!0});this.dispatchEvent(s)}_dispatchSelectionEvents(){const t={files:[...this._selectedFiles],value:""};this.dispatchEvent(new CustomEvent("input",{detail:t,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,cancelable:!0,composed:!0}))}_syncFileInputFromSelected(){if(!this._fileInput)return;const e=new DataTransfer;this._selectedFiles.forEach(t=>{try{e.items.add(t)}catch(i){console.warn("Failed to add file to DataTransfer:",i)}}),this._isUpdatingFiles=!0;try{this._fileInput.files=e.files}catch(t){console.warn("Failed to set files on input:",t)}setTimeout(()=>{this._isUpdatingFiles=!1},0)}get files(){var e;return this._syncFileInputFromSelected(),((e=this._fileInput)==null?void 0:e.files)||null}syncFiles(){this._syncFileInputFromSelected()}_renderPreviews(){if(!this._dropzone)return;if(this._previewContainer&&(this._cleanupPreviewUrls(),this._previewContainer.remove()),this._selectedFiles.length===0){this._previewContainer=null,this._updateDragStateClass();return}const e=document.createElement("div");e.className="mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48";const t=document.createElement("div");t.className="mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2",this._selectedFiles.forEach((o,l)=>{const d=document.createElement("div");if(d.className="flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",o.type.startsWith("image/")){const f=document.createElement("img");f.className="w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";const _=URL.createObjectURL(o);this._previewUrls.push(_),f.src=_,d.appendChild(f)}else{const f=document.createElement("mint-icon");f.setAttribute("name","attach"),f.className="w-5 h-5 text-gray-500 dark:text-gray-300",d.appendChild(f)}const h=document.createElement("div");h.className="flex-1 text-sm text-gray-800 dark:text-gray-100 truncate",h.textContent=o.name,d.appendChild(h);const u=document.createElement("button");u.type="button",u.className="text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors flex items-center justify-center w-6 h-6 rounded-full";const b=document.createElement("mint-icon");b.setAttribute("name","close"),b.className="w-4 h-4",u.appendChild(b),u.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),this._removeFileAt(l)}),d.appendChild(u),t.appendChild(d)});const i=this.hasError(),s=this._isDragging;let r="from-white dark:from-gray-700";i?r="from-red-50 dark:from-red-900/30":s&&(r="from-gray-50 dark:from-gray-800");const n=document.createElement("div");n.className=`absolute top-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-b ${r} to-transparent opacity-0 transition-opacity duration-200`,e.appendChild(n);const a=document.createElement("div");a.className=`absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${r} to-transparent opacity-100 transition-opacity duration-200`,e.appendChild(a);const c=()=>{const o=t.scrollTop,l=t.scrollHeight,d=t.clientHeight;o>0?n.style.opacity="1":n.style.opacity="0",o+d<l-1?a.style.opacity="1":a.style.opacity="0"};c(),t.addEventListener("scroll",c),e.appendChild(t),this._previewContainer=e,this._dropzone.appendChild(e),this._updateDragStateClass()}_removeFileAt(e){if(e<0||e>=this._selectedFiles.length)return;const[t]=this._selectedFiles.splice(e,1);t&&this._cleanupPreviewUrls(),this._syncFileInputFromSelected(),this._renderPreviews(),this._dispatchSelectionEvents()}_cleanupPreviewUrls(){this._previewUrls.forEach(e=>URL.revokeObjectURL(e)),this._previewUrls=[]}_attachFormResetListener(){const e=this.closest("form");!e||this._resetHandler||(this._resetHandler=()=>{this._selectedFiles=[],this._syncFileInputFromSelected(),this._renderPreviews(),this._cleanupPreviewUrls()},e.addEventListener("reset",this._resetHandler))}_applyValidFiles(e){if(this.isMultiple()){const i=e.filter(s=>!this._isDuplicateFile(s));this._selectedFiles.push(...i)}else this._selectedFiles=[e[0]];this._syncFileInputFromSelected(),this._selectedFiles.length>0&&(this.removeAttribute("error"),this.removeAttribute("error-message"),this._fileInput&&this._fileInput.removeAttribute("aria-invalid")),this._renderPreviews(),this._dispatchSelectionEvents()}_isDuplicateFile(e){return this._selectedFiles.some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)}}customElements.get("mint-dropzone")||customElements.define("mint-dropzone",Q);class ee extends HTMLElement{constructor(){super(),this._form=null,this._submitHandler=null,this._hostSubmitHandler=null,this._errors={},this._fieldBlurHandlers=new Map,this._fieldChangeHandlers=new Map,this._observer=null}static get observedAttributes(){return["action","method","enctype"]}connectedCallback(){this._render(),this._setupBlurValidation()}disconnectedCallback(){this._form&&this._submitHandler&&this._form.removeEventListener("submit",this._submitHandler,!0),this._hostSubmitHandler&&this.removeEventListener("submit",this._hostSubmitHandler),this._cleanupBlurValidation()}reset(){this._clearErrors(),this._form&&this._form.reset(),this._resetCustomFields()}attributeChangedCallback(e,t,i){this._applyFormAttributes()}_render(){if(this.classList.add("block","w-full"),!this._form){for(this._form=document.createElement("form"),this._form.noValidate=!0;this.firstChild;)this._form.appendChild(this.firstChild);this.appendChild(this._form),this._submitHandler=e=>this._handleSubmit(e),this._form.addEventListener("submit",function(e){var t;(t=this.closest("mint-form"))==null||t._handleSubmit(e)})}this._applyFormAttributes()}_applyFormAttributes(){if(!this._form)return;const e=this.getAttribute("action")||"",t=(this.getAttribute("method")||"POST").toUpperCase(),i=this.getAttribute("enctype")||"application/x-www-form-urlencoded";e&&(this._form.action=e),this._form.method=t,this._form.enctype=i}async _handleSubmit(e){if(e.preventDefault(),!this._form)return;this._clearErrors(),this._syncDropzoneFiles();const t=this._collectValidationRules(),i=new FormData(this._form),s=this._formDataToValues(i);if(!this._validate(s,t)){this.dispatchEvent(new CustomEvent("invalid",{detail:{errors:this._errors},bubbles:!0,cancelable:!0,composed:!0}));return}const n=new CustomEvent("submit",{detail:{formData:i,values:s},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(n),!n.defaultPrevented)try{const a=await this._submitData(i,s);this.dispatchEvent(new CustomEvent("submitsuccess",{detail:a,bubbles:!0,cancelable:!0}))}catch(a){this.dispatchEvent(new CustomEvent("submiterror",{detail:{error:a},bubbles:!0,cancelable:!0}))}}async _submitData(e,t){const i=this.getAttribute("action"),s=(this.getAttribute("method")||"POST").toUpperCase(),r=this.getAttribute("enctype")||"application/x-www-form-urlencoded";if(!i)return{status:0,ok:!0,data:{values:t}};const n=Array.from(e.values()).some(l=>l instanceof File);let a=null;const c={};let o=i;if(s==="GET"){const l=new URLSearchParams;e.forEach((d,h)=>{d instanceof File||l.append(h,String(d))}),o+=(i.includes("?")?"&":"?")+l.toString()}else if(r==="multipart/form-data"||n)a=e;else if(r==="application/json")a=JSON.stringify(t),c["Content-Type"]="application/json";else{const l=new URLSearchParams;e.forEach((d,h)=>{d instanceof File||l.append(h,String(d))}),a=l,c["Content-Type"]="application/x-www-form-urlencoded"}if(typeof fetch=="function"){const l=await fetch(o,{method:s,body:s==="GET"?null:a,headers:c}),d=await l.text().catch(()=>"");let h=d;try{h=JSON.parse(d)}catch{}if(!l.ok)throw{status:l.status,data:h};return{status:l.status,ok:l.ok,data:h}}return await new Promise((l,d)=>{const h=new XMLHttpRequest;h.open(s,o,!0),Object.entries(c).forEach(([u,b])=>h.setRequestHeader(u,b)),h.onload=function(){const{status:u,responseText:b}=h;if(u>=200&&u<300){let f=b;try{f=JSON.parse(b)}catch{}l({status:u,ok:!0,data:f})}else d({status:u,data:b})},h.onerror=function(){d({status:h.status,data:h.responseText})},h.send(s==="GET"?null:a)})}_formDataToValues(e){const t={};return e.forEach((i,s)=>{i instanceof File?(t[s]||(t[s]=[]),t[s].push(i)):s in t?Array.isArray(t[s])?(t[s].length>0&&t[s][0]instanceof File,t[s].push(i)):t[s]=[t[s],i]:t[s]=i}),this._form&&Array.from(this._form.querySelectorAll("mint-dropzone[name]")).forEach(s=>{const r=s.getAttribute("name");if(r&&typeof s.files<"u"&&s.files){const n=s.files;if(n.length>0){const a=Array.from(n);t[r]&&Array.isArray(t[r])?a.forEach(c=>{t[r].some(l=>l.name===c.name&&l.size===c.size&&l.lastModified===c.lastModified)||t[r].push(c)}):t[r]=a}}}),t}_collectValidationRules(){const e={};return this._form&&Array.from(this._form.querySelectorAll("[name][validation]")).forEach(i=>{const s=i.getAttribute("name")||"",r=i.getAttribute("validation");if(!s||!r)return;const n=this._parseRules(r);n.length&&(e[s]=n)}),e}_parseRules(e){if(!e)return[];try{const t=e.replace(/'/g,'"'),i=JSON.parse(t);if(Array.isArray(i))return i.map(s=>String(s))}catch{}return e.split(",").map(t=>t.trim()).filter(Boolean)}_validate(e,t){let i=!0;return this._errors={},Object.entries(t||{}).forEach(([s,r])=>{const n=Array.isArray(r)?r:[r],a=this._getFieldElements(s),c=this._extractFieldValue(a),o=this._validateRules(c,n);o?(i=!1,this._errors[s]=o,this._flagFieldError(a,o)):this._clearFieldError(a)}),i}_validateField(e){const t=this._collectValidationRules();if(!t[e])return;const i=t[e],s=Array.isArray(i)?i:[i],r=this._getFieldElements(e),n=this._extractFieldValue(r),a=this._validateRules(n,s);a?(this._errors[e]=a,this._flagFieldError(r,a)):(this._clearFieldError(r),delete this._errors[e])}_validateRules(e,t){for(const i of t){const[s,r]=i.split(":");switch(s){case"required":{if(e==null||typeof e=="string"&&e.trim()===""||e instanceof FileList&&e.length===0||Array.isArray(e)&&e.length===0)return"This field is required.";break}case"string":{if(typeof e!="string")return"Must be a string.";break}case"email":{if(typeof e=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()))return"Enter a valid email.";break}case"number":{const n=Number(e);if(Number.isNaN(n))return"Must be a number.";break}case"min":{const n=Number(r);if(Number.isNaN(n))break;if(typeof e=="string"&&e.trim().length<n)return`Must be at least ${n} characters.`;if(Array.isArray(e)&&e.length<n)return`Select at least ${n}.`;if(e instanceof FileList&&e.length<n)return`Upload at least ${n} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)<n)return`Must be at least ${n}.`;break}case"max":{const n=Number(r);if(Number.isNaN(n))break;if(typeof e=="string"&&e.trim().length>n)return`Must be at most ${n} characters.`;if(Array.isArray(e)&&e.length>n)return`Select no more than ${n}.`;if(e instanceof FileList&&e.length>n)return`Upload no more than ${n} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)>n)return`Must be at most ${n}.`;break}}}return null}_getFieldElements(e){if(!this._form)return[];const t=Array.from(this._form.querySelectorAll(`[name="${e}"]`)),i=t.filter(s=>s.tagName==="MINT-SELECT");if(i.length>0){const s=[];return i.forEach(r=>{const n=r.querySelector('select[name="'+e+'"]');n&&s.push(n)}),t.filter(r=>r.tagName!=="MINT-SELECT").concat(s)}return t}_extractFieldValue(e){if(e.length===0)return"";const t=e.find(s=>s instanceof HTMLSelectElement);if(t)return t.value;if(e.length>1){const s=e.filter(n=>n instanceof HTMLInputElement),r=s.filter(n=>n.checked);if(s.every(n=>n.type==="radio"))return r.length>0?r[0].value||"on":"";if(s.every(n=>n.type==="checkbox"))return r.map(n=>n.value||"on")}const i=e[0];if(i instanceof HTMLInputElement)return i.type==="file"?i.files:i.type==="checkbox"||i.type==="radio"?i.checked?i.value||"on":"":i.value;if(i instanceof HTMLTextAreaElement)return i.value;if(i.tagName==="MINT-SELECT"){const s=i.querySelector("select");if(s)return s.value;if(typeof i.getValue=="function"){const n=i.getValue();if(n!=null&&n!=="")return n}const r=i.getAttribute("value");return r||""}return i.tagName==="MINT-DROPZONE"&&typeof i.files<"u"?i.files:typeof i.value<"u"?i.value:i.getAttribute("value")||""}_flagFieldError(e,t){e.length!==0&&e.forEach(i=>{(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement)&&i.setAttribute("aria-invalid","true");const s=this._resolveHost(i);s&&(s.setAttribute("error",""),s.setAttribute("error-message",t),s.setAttribute("data-mint-form-error","true"))})}_clearFieldError(e){e.length!==0&&e.forEach(t=>{(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&t.removeAttribute("aria-invalid");const i=this._resolveHost(t);i&&(i.removeAttribute("error"),i.removeAttribute("error-message"),i.removeAttribute("data-mint-form-error"))})}_clearErrors(){this.querySelectorAll("[data-mint-form-error]").forEach(e=>{const t=e;t.removeAttribute("error"),t.removeAttribute("error-message"),t.removeAttribute("data-mint-form-error")}),this._form&&this._form.querySelectorAll('[aria-invalid="true"]').forEach(e=>{e.removeAttribute("aria-invalid")})}_resetCustomFields(){this.querySelectorAll("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch").forEach(t=>{var s,r;t.removeAttribute("error"),t.removeAttribute("error-message");const i=t.tagName;if(i==="MINT-INPUT")try{t.value=""}catch{}else if(i==="MINT-DATE-PICKER")try{(s=t.setValue)==null||s.call(t,"")}catch{}else if(i==="MINT-SELECT")try{(r=t.setValue)==null||r.call(t,"")}catch{}else if(i==="MINT-DROPZONE"){const n=t.querySelector('input[type="file"]');n&&(n.value="")}else if(i==="MINT-CHECKBOX"||i==="MINT-CHOICE"){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');n&&(n.checked=!1)}else if(i==="MINT-SWITCH"){const n=t.querySelector('input[type="checkbox"]');n&&(n.checked=!1)}})}_resolveHost(e){const t=e.closest("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch");return t||e}_setupBlurValidation(){if(!this._form)return;const e=i=>{const s=i.target;if(!s)return;const r=this._findFieldElement(s);if(!r)return;const n=this._getFieldName(r);if(!n||!this._collectValidationRules()[n])return;const c=this._extractFieldValue([r]),o=c!=null&&(typeof c=="string"?c.trim()!=="":c instanceof FileList||Array.isArray(c)?c.length>0:!0),l=r.hasAttribute("data-mint-form-error")||s instanceof HTMLElement&&(s.hasAttribute("aria-invalid")||s.closest("[data-mint-form-error]"));(o||l)&&setTimeout(()=>{this._validateField(n)},0)};this._form.addEventListener("blur",e,!0),this._fieldBlurHandlers.set(this._form,e);const t=i=>{const s=i.target;if(!s)return;if(s instanceof HTMLSelectElement||s.tagName==="MINT-SELECT"||s.closest("mint-select")){const o=this._findFieldElement(s);if(!o)return;const l=this._getFieldName(o);if(!l||!this._collectValidationRules()[l])return;setTimeout(()=>{this._validateField(l)},0);return}const n=this._findFieldElement(s);if(!n)return;const a=this._getFieldName(n);!a||!this._collectValidationRules()[a]||(n.hasAttribute("data-mint-form-error")||s instanceof HTMLElement&&s.hasAttribute("aria-invalid"))&&setTimeout(()=>{this._validateField(a)},0)};this._form.addEventListener("change",t,!0),this._fieldChangeHandlers.set(this._form,t)}_findFieldElement(e){if(e.hasAttribute("name")&&(e.tagName.startsWith("MINT-")||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement))return e;const t=e.closest("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch");if(t&&t.hasAttribute("name"))return t;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.hasAttribute("name"))return e;let i=e;for(;i&&i!==this._form;){if(i.hasAttribute("name"))return i;i=i.parentElement}return null}_getFieldName(e){return e.hasAttribute("name")||e.tagName.startsWith("MINT-")?e.getAttribute("name"):(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.name||null}_cleanupBlurValidation(){if(this._form&&this._fieldBlurHandlers.has(this._form)){const e=this._fieldBlurHandlers.get(this._form);e&&this._form.removeEventListener("blur",e,!0),this._fieldBlurHandlers.delete(this._form)}if(this._form&&this._fieldChangeHandlers.has(this._form)){const e=this._fieldChangeHandlers.get(this._form);e&&this._form.removeEventListener("change",e,!0),this._fieldChangeHandlers.delete(this._form)}this._observer&&(this._observer.disconnect(),this._observer=null)}_syncDropzoneFiles(){if(!this._form)return;Array.from(this._form.querySelectorAll("mint-dropzone[name]")).forEach(t=>{typeof t.syncFiles=="function"&&t.syncFiles()})}}customElements.get("mint-form")||customElements.define("mint-form",ee);class te extends HTMLElement{constructor(){super(),this._observer=null,this._hoverHandlers=new Map}static get observedAttributes(){return["striped","hover","bordered","compact"]}connectedCallback(){this.style.display="block",this.style.width="100%",this.style.overflowX="auto",this._observeChanges(),this._applyStyles(),requestAnimationFrame(()=>{this._applyStyles(),setTimeout(()=>this._applyStyles(),0),setTimeout(()=>this._applyStyles(),50),setTimeout(()=>this._applyStyles(),100),setTimeout(()=>this._applyStyles(),200)})}disconnectedCallback(){this._observer&&(this._observer.disconnect(),this._observer=null),this._hoverHandlers.forEach((e,t)=>{t.removeEventListener("mouseenter",e.enter),t.removeEventListener("mouseleave",e.leave)}),this._hoverHandlers.clear()}attributeChangedCallback(){this._applyStyles()}_observeChanges(){this._observer=new MutationObserver(()=>{this._applyStyles()}),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!1})}_applyStyles(){const e=this.querySelector("table");if(!e)return;const t=this.hasAttribute("bordered"),i=this.hasAttribute("striped"),s=this.hasAttribute("hover"),r=this.hasAttribute("compact");e.style.width="100%",e.style.borderCollapse="collapse",e.style.fontSize="0.875rem",e.style.fontWeight="500";const n=e.querySelector("thead");n&&(n.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(n.style.backgroundColor="rgb(31 41 55)"),n.querySelectorAll("th").forEach(l=>{l.style.textAlign="left",l.style.fontWeight="600",l.style.color="rgb(17 24 39)",document.documentElement.classList.contains("dark")&&(l.style.color="rgb(255 255 255)"),l.style.textTransform="uppercase",l.style.letterSpacing="0.05em",l.style.fontSize="0.75rem",t&&(l.style.border="1px solid rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(l.style.borderColor="rgb(55 65 81)")),r?l.style.padding="0.375rem 0.75rem":l.style.padding="0.75rem 1rem"}));const a=e.querySelector("tbody");a&&(i&&(a.style.borderTopWidth="1px",a.style.borderTopStyle="solid",a.style.borderTopColor="rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(a.style.borderTopColor="rgb(55 65 81)")),a.querySelectorAll("tr").forEach((l,d)=>{if(t&&(l.style.borderBottomWidth="1px",l.style.borderBottomStyle="solid",l.style.borderBottomColor="rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(l.style.borderBottomColor="rgb(55 65 81)")),i?d%2===0?(l.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(l.style.backgroundColor="rgb(17 24 39)")):(l.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(l.style.backgroundColor="rgb(31 41 55)")):(l.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(l.style.backgroundColor="rgb(17 24 39)")),s){l.style.transition="background-color 150ms";const u=this._hoverHandlers.get(l);u&&(l.removeEventListener("mouseenter",u.enter),l.removeEventListener("mouseleave",u.leave));const b=()=>{l.style.backgroundColor="rgb(243 244 246)",document.documentElement.classList.contains("dark")&&(l.style.backgroundColor="rgb(31 41 55)")},f=()=>{i?d%2===0?(l.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(l.style.backgroundColor="rgb(17 24 39)")):(l.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(l.style.backgroundColor="rgb(31 41 55)")):(l.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(l.style.backgroundColor="rgb(17 24 39)"))};this._hoverHandlers.set(l,{enter:b,leave:f}),l.addEventListener("mouseenter",b),l.addEventListener("mouseleave",f)}else{const u=this._hoverHandlers.get(l);u&&(l.removeEventListener("mouseenter",u.enter),l.removeEventListener("mouseleave",u.leave),this._hoverHandlers.delete(l))}l.querySelectorAll("td").forEach(u=>{u.style.color="rgb(17 24 39)",document.documentElement.classList.contains("dark")&&(u.style.color="rgb(243 244 246)"),t&&(u.style.border="1px solid rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(u.style.borderColor="rgb(55 65 81)")),r?u.style.padding="0.375rem 0.75rem":u.style.padding="0.75rem 1rem"})}));const c=e.querySelector("tfoot");c&&(c.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(c.style.backgroundColor="rgb(31 41 55)"),c.style.fontWeight="600",c.querySelectorAll("td").forEach(l=>{l.style.color="rgb(17 24 39)",document.documentElement.classList.contains("dark")&&(l.style.color="rgb(243 244 246)"),t&&(l.style.border="1px solid rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(l.style.borderColor="rgb(55 65 81)")),r?l.style.padding="0.375rem 0.75rem":l.style.padding="0.75rem 1rem"}))}}customElements.get("mint-table")||customElements.define("mint-table",te);exports.BackButton=W;exports.Button=F;exports.Card=V;exports.Checkbox=G;exports.Choice=J;exports.DatePicker=K;exports.Dropzone=Q;exports.Form=ee;exports.Grid=$;exports.Icon=O;exports.Input=X;exports.Link=R;exports.Modal=Y;exports.Page=j;exports.Popover=U;exports.Select=Z;exports.Spinner=P;exports.Stack=z;exports.Switch=q;exports.Table=te;exports.Text=B;exports.default=F;
68
+ `,p.classList.add("mint-date-shortcuts-row"),document.head.querySelector("style[data-mint-date-shortcuts]")||(k.setAttribute("data-mint-date-shortcuts","true"),document.head.appendChild(k));const E=document.createElement("div");E.className="absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200 md:hidden",g.appendChild(E);const I=document.createElement("div");I.className="absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden",g.appendChild(I);const C=document.createElement("div");C.className="hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200",g.appendChild(C);const w=document.createElement("div");w.className="hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200",g.appendChild(w);const L=()=>{if(window.innerWidth>=768){const T=p.scrollTop,H=p.scrollHeight,D=p.clientHeight;T>0?C.style.opacity="1":C.style.opacity="0",T+D<H-1?w.style.opacity="1":w.style.opacity="0",E.style.opacity="0",I.style.opacity="0"}else{const T=p.scrollLeft,H=p.scrollWidth,D=p.clientWidth;T>0?E.style.opacity="1":E.style.opacity="0",T+D<H-1?I.style.opacity="1":I.style.opacity="0",C.style.opacity="0",w.style.opacity="0"}};p.addEventListener("scroll",L),window.addEventListener("resize",L),setTimeout(L,0),r.forEach(M=>{const T=document.createElement("button");T.type="button",T.tabIndex=0,T.className="px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",T.textContent=M.label,T.setAttribute("data-keep-popover-open","true"),T.addEventListener("click",()=>{const H=M.action();if(H){if(this._isRange&&"start"in H&&"end"in H){this._selectedStartDate=H.start,this._selectedEndDate=H.end;const D=this.getFormat(),N=this._formatDate(H.start,D),ie=this._formatDate(H.end,D),se=`${N} - ${ie}`;this.setValue(se),this._currentMonth=H.start.getMonth(),this._currentYear=H.start.getFullYear()}else if(H instanceof Date){this._selectedStartDate=H,this._selectedEndDate=null;const D=this.getFormat(),N=this._formatDate(H,D);this.setValue(N),this._currentMonth=H.getMonth(),this._currentYear=H.getFullYear()}this._buildCalendar(),this._popover&&typeof this._popover.close=="function"&&this._popover.close(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0}))}}),p.appendChild(T)}),g.appendChild(p),y.appendChild(g),a.appendChild(y)}c.appendChild(l),c.appendChild(m),c.appendChild(v),a.appendChild(c),this._calendarContainer.appendChild(a)}_buildMonthView(){if(!this._calendarContainer)return;const e=["January","February","March","April","May","June","July","August","September","October","November","December"],t=document.createElement("div");t.className="flex items-center justify-between mb-4";const i=document.createElement("button");i.type="button",i.tabIndex=0,i.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",i.setAttribute("data-keep-popover-open","true");const s=document.createElement("mint-icon");s.setAttribute("name","caret-left"),s.className="w-4 h-4",i.appendChild(s),i.addEventListener("click",()=>{this._currentYear--,this._buildCalendar()}),t.appendChild(i);const r=document.createElement("button");r.type="button",r.tabIndex=0,r.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 rounded px-1",r.setAttribute("data-keep-popover-open","true"),r.textContent=String(this._currentYear),r.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),t.appendChild(r);const n=document.createElement("button");n.type="button",n.tabIndex=0,n.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",n.setAttribute("data-keep-popover-open","true");const a=document.createElement("mint-icon");a.setAttribute("name","caret-right"),a.className="w-4 h-4",n.appendChild(a),n.addEventListener("click",()=>{this._currentYear++,this._buildCalendar()}),t.appendChild(n);const c=document.createElement("div");c.className="grid grid-cols-3 gap-2",e.forEach((l,o)=>{const d=document.createElement("button");d.type="button",d.tabIndex=0,d.setAttribute("data-keep-popover-open","true");const h=this._currentMonth===o;d.className=`p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h?"bg-slate-800 dark:bg-slate-600 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,d.textContent=l,d.addEventListener("click",()=>{this._currentMonth=o,this._viewMode="calendar",this._buildCalendar()}),c.appendChild(d)}),this._calendarContainer.appendChild(t),this._calendarContainer.appendChild(c)}_buildYearView(){if(!this._calendarContainer)return;const e=this._currentYear-6,t=this._currentYear+6,i=document.createElement("div");i.className="flex items-center justify-between mb-4";const s=document.createElement("button");s.type="button",s.tabIndex=0,s.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",s.setAttribute("data-keep-popover-open","true");const r=document.createElement("mint-icon");r.setAttribute("name","caret-left"),r.className="w-4 h-4",s.appendChild(r),s.addEventListener("click",()=>{this._currentYear-=12,this._buildCalendar()}),i.appendChild(s);const n=document.createElement("div");n.className="text-sm font-medium text-gray-900 dark:text-gray-100",n.textContent=`${e} - ${t}`,i.appendChild(n);const a=document.createElement("button");a.type="button",a.tabIndex=0,a.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",a.setAttribute("data-keep-popover-open","true");const c=document.createElement("mint-icon");c.setAttribute("name","caret-right"),c.className="w-4 h-4",a.appendChild(c),a.addEventListener("click",()=>{this._currentYear+=12,this._buildCalendar()}),i.appendChild(a);const l=document.createElement("div");l.className="grid grid-cols-3 gap-2";for(let o=e;o<=t;o++){const d=document.createElement("button");d.type="button",d.tabIndex=0,d.setAttribute("data-keep-popover-open","true");const h=this._currentYear===o;d.className=`p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h?"bg-slate-800 dark:bg-slate-600 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,d.textContent=String(o),d.addEventListener("click",()=>{this._currentYear=o,this._viewMode="calendar",this._buildCalendar()}),l.appendChild(d)}this._calendarContainer.appendChild(i),this._calendarContainer.appendChild(l)}_getDaysInMonth(e,t){return new Date(t,e+1,0).getDate()}_getFirstDayOfMonth(e,t){return new Date(t,e,1).getDay()}_isToday(e){const t=new Date;return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isDateSelected(e){return this._isRange?this._selectedStartDate!==null&&this._isSameDate(e,this._selectedStartDate)||this._selectedEndDate!==null&&this._isSameDate(e,this._selectedEndDate):this._selectedStartDate!==null&&this._isSameDate(e,this._selectedStartDate)}_isDateInRange(e){return!this._isRange||!this._selectedStartDate||!this._selectedEndDate?!1:e>=this._selectedStartDate&&e<=this._selectedEndDate}_hasIncompleteRange(){return this._isRange&&this._selectedStartDate!==null&&this._selectedEndDate===null}_isSameDate(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_handleDateClick(e){const t=this.getFormat();if(this._isRange){if(!this._selectedStartDate||this._selectedStartDate&&this._selectedEndDate?(this._selectedStartDate=e,this._selectedEndDate=null):this._selectedStartDate&&!this._selectedEndDate&&(e<this._selectedStartDate?(this._selectedEndDate=this._selectedStartDate,this._selectedStartDate=e):this._selectedEndDate=e),this._selectedStartDate&&this._selectedEndDate){const i=this._formatDate(this._selectedStartDate,t),s=this._formatDate(this._selectedEndDate,t),r=`${i} - ${s}`;this.setValue(r),this._textInput&&(this._textInput.value=r),this._popover&&typeof this._popover.close=="function"&&this._popover.close()}else if(this._selectedStartDate){const i=this._formatDate(this._selectedStartDate,t);this.setValue(i),this._textInput&&(this._textInput.value=i)}}else{this._selectedStartDate=e;const i=this._formatDate(e,t);this.setValue(i),this._textInput&&(this._textInput.value=i),this._popover&&typeof this._popover.close=="function"&&this._popover.close()}this._buildCalendar(),this._updateDisplayText(),this._exitInputMode(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.getValue()},bubbles:!0,cancelable:!0}))}_updateDisplayText(){if(!this._displayEl)return;const e=this.getDisplayFormat();let t="";this._isRange?this._selectedStartDate&&this._selectedEndDate?t=`${this._formatDatePhp(this._selectedStartDate,e)} - ${this._formatDatePhp(this._selectedEndDate,e)}`:this._selectedStartDate&&(t=this._formatDatePhp(this._selectedStartDate,e)):this._selectedStartDate&&(t=this._formatDatePhp(this._selectedStartDate,e)),t?(this._displayEl.textContent=t,this._displayEl.classList.remove("text-gray-400","dark:text-gray-500"),this._displayEl.classList.add("text-gray-900","dark:text-white")):(this._displayEl.textContent="Select date",this._displayEl.classList.add("text-gray-400","dark:text-gray-500"),this._displayEl.classList.remove("text-gray-900","dark:text-white")),this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none")}_enterInputMode(){if(!this._isInputMode&&(this._isInputMode=!0,this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display="none",this._inputsWrapperEl.style.display="flex"),this._startPartInputs.length>0)){const e=this._startPartInputs[0];requestAnimationFrame(()=>{e.focus();try{e.setSelectionRange(0,e.value.length)}catch{}})}}_exitInputMode(){this._isInputMode&&(this._isInputMode=!1,this._displayEl&&this._inputsWrapperEl&&(this._displayEl.style.display="flex",this._inputsWrapperEl.style.display="none"),this._updateDisplayText())}_getFocusableElements(){if(!this._calendarContainer)return[];const e=["button:not([disabled])","a[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");return Array.from(this._calendarContainer.querySelectorAll(e)).filter(i=>{const s=window.getComputedStyle(i);return s.display!=="none"&&s.visibility!=="hidden"})}_setupFocusTrap(){if(!this._popover||!this._popover.hasAttribute("open"))return;this._removeFocusTrap();const e=this;this._focusTrapHandler=function(t){var c;if(t.key!=="Tab")return;if(!e._popover||!e._popover.hasAttribute("open")){e._removeFocusTrap();return}const i=e._getFocusableElements();if(i.length===0)return;const s=i[0],r=i[i.length-1],n=document.activeElement;if(!(((c=e._calendarContainer)==null?void 0:c.contains(n))||!1)){t.preventDefault(),s.focus();return}if(t.shiftKey&&n===s){t.preventDefault(),r.focus();return}if(!t.shiftKey&&n===r){t.preventDefault(),s.focus();return}},this._escapeHandler=function(t){(t.key==="Escape"||t.key==="Esc")&&e._popover&&e._popover.hasAttribute("open")&&(t.preventDefault(),t.stopPropagation(),typeof e._popover.close=="function"&&e._popover.close())},document.addEventListener("keydown",this._focusTrapHandler,!0),document.addEventListener("keydown",this._escapeHandler,!0),requestAnimationFrame(()=>{const t=this._getFocusableElements();t.length>0&&t[0].focus()})}_removeFocusTrap(){this._focusTrapHandler&&(document.removeEventListener("keydown",this._focusTrapHandler,!0),this._focusTrapHandler=null),this._escapeHandler&&(document.removeEventListener("keydown",this._escapeHandler,!0),this._escapeHandler=null)}}customElements.get("mint-date-picker")||customElements.define("mint-date-picker",K);class Z extends HTMLElement{constructor(){super(),this._select=null,this._wrapper=null,this._caretUpIcon=null,this._caretDownIcon=null,this._changeHandler=null}static get observedAttributes(){return["name","value","disabled","id","required","label","info","error","error-message","multiple"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","w-full"),this.getLabel()||console.error('mint-select: The "label" attribute is required. Please provide a label for the select.'),this.render()}disconnectedCallback(){this._select&&this._changeHandler&&(this._select.removeEventListener("change",this._changeHandler),this._changeHandler=null)}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._renderErrorState(),this._select&&(this._select.className=this.getSelectClasses(),this._select.setAttribute("aria-invalid",this.hasError()?"true":"false"));return}if(e==="value"&&this._select){this._select.value=i||"";return}this.render()}}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||(this._select?this._select.value:"")}setValue(e){this._select&&(this._select.value=e,this.setAttribute("value",e))}isDisabled(){return this.hasAttribute("disabled")}isMultiple(){return this.hasAttribute("multiple")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getId(){return this.getAttribute("id")||""}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getSelectClasses(){const e=this.hasError(),t=this.isMultiple(),i=["w-full","px-3.5",t?"pr-3.5":"pr-10",t?"py-2":"py-1.5",t?"min-h-[6rem]":"min-h-[2rem]","text-sm","font-medium","rounded-lg","box-border","bg-white","dark:bg-gray-700","text-gray-900","dark:text-white","transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","appearance-none","bg-no-repeat","bg-right","cursor-pointer"],s=["border-2",e?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],r=["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"];return[...i,...s,...r].filter(Boolean).join(" ")}render(){const e=[];this._select&&Array.from(this._select.children).forEach(h=>{(h.tagName==="OPTION"||h.tagName==="OPTGROUP")&&e.push(h.cloneNode(!0))});const t=Array.from(this.children).filter(h=>h.tagName==="OPTION"||h.tagName==="OPTGROUP").map(h=>h.cloneNode(!0));for(;this.firstChild;)this.removeChild(this.firstChild);this._wrapper=null,this._select=null;const i=this.getLabel(),s=this.getInfo(),r=this.getId(),n=this.getName(),a=this.getValue(),c=this.isDisabled(),l=this.isMultiple(),o=this.hasError();if(i){const h=document.createElement("label");h.className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",r&&h.setAttribute("for",r);const u=document.createTextNode(i);h.appendChild(u),this.appendChild(h)}this._wrapper=document.createElement("div"),this._wrapper.className="relative w-full",this.appendChild(this._wrapper),this._select=document.createElement("select"),this._select.className=this.getSelectClasses(),r&&(this._select.id=r),n&&(this._select.name=n),c&&(this._select.disabled=!0),l&&(this._select.multiple=!0),a&&(this._select.value=a),this._select.setAttribute("aria-invalid",o?"true":"false");const d=e.length>0?e:t;if(d.length>0&&d.forEach(h=>{this._select.appendChild(h)}),this._select.options.length===0){const h=document.createElement("option");h.value="",h.textContent="Select an option",h.disabled=!0,h.selected=!0,this._select.appendChild(h)}if(this._changeHandler&&this._select&&this._select.removeEventListener("change",this._changeHandler),this._changeHandler=h=>{const b=h.target.value;b?this.setAttribute("value",b):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:{value:b},bubbles:!0,cancelable:!0,composed:!0}))},this._select.addEventListener("change",this._changeHandler),this._wrapper.appendChild(this._select),l)this._caretUpIcon=null,this._caretDownIcon=null;else{const h=document.createElement("div");h.className="absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col",this._caretUpIcon=document.createElement("mint-icon"),this._caretUpIcon.setAttribute("name","caret-up"),this._caretUpIcon.className="w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]",h.appendChild(this._caretUpIcon),this._caretDownIcon=document.createElement("mint-icon"),this._caretDownIcon.setAttribute("name","caret-down"),this._caretDownIcon.className="w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]",h.appendChild(this._caretDownIcon),this._wrapper.appendChild(h)}if(s){const h=document.createElement("div");h.className="mt-1 text-xs text-gray-500 dark:text-gray-400",h.textContent=s,this.appendChild(h)}this._renderErrorState()}_renderErrorState(){const e=this.hasError(),t=this.getErrorMessage();let i=this.querySelector(".mint-select-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-select-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}}customElements.get("mint-select")||customElements.define("mint-select",Z);class Q extends HTMLElement{constructor(){super(),this._dropzone=null,this._fileInput=null,this._previewContainer=null,this._isDragging=!1,this._wasDragging=!1,this._isUpdatingFiles=!1,this._listenersInitialized=!1,this._selectedFiles=[],this._previewUrls=[],this._resetHandler=null}static get observedAttributes(){return["label","accept","multiple","width","height","disabled","name","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._attachFormResetListener()}disconnectedCallback(){if(this.removeEventListeners(),this._cleanupPreviewUrls(),this._resetHandler){const e=this.closest("form");e&&e.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._updateDragStateClass(),this._renderErrorState(this.hasError(),this.getErrorMessage());return}this.render()}}getLabel(){return this.getAttribute("label")||""}getAccept(){return this.getAttribute("accept")||""}isMultiple(){return this.hasAttribute("multiple")}getWidth(){return this.getAttribute("width")||"200px"}getHeight(){return this.getAttribute("height")||"200px"}getName(){return this.getAttribute("name")||""}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}isDisabled(){return this.hasAttribute("disabled")}render(){const e=this.getLabel(),t=this.getAccept(),i=this.isMultiple(),s=this.isDisabled(),r=this.getWidth(),n=this.getHeight(),a=this.getName(),c=this.hasError(),l=this.getErrorMessage();this._dropzone||(this._dropzone=document.createElement("div"),this.appendChild(this._dropzone)),this._updateDragStateClass(),this._dropzone.setAttribute("aria-invalid",c?"true":"false"),this._dropzone.style.width=r,this._dropzone.style.height=n,this._dropzone.style.minWidth=r,this._dropzone.style.minHeight=n,this._fileInput||(this._fileInput=document.createElement("input"),this._fileInput.type="file",this._fileInput.style.display="none",this._dropzone.appendChild(this._fileInput)),this._fileInput.accept=t,this._fileInput.multiple=i,this._fileInput.disabled=s,a?this._fileInput.name=a:this._fileInput.removeAttribute("name"),this._fileInput.setAttribute("aria-invalid",c?"true":"false");const o=this._dropzone.querySelector(".mint-dropzone-icon"),d=this._dropzone.querySelector(".mint-dropzone-label");o&&o.remove(),d&&d.remove();const h=document.createElement("div");h.className="mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";const u=document.createElement("mint-icon");if(u.setAttribute("name","upload"),u.className="w-12 h-12 text-gray-400 dark:text-gray-500",h.appendChild(u),this._dropzone.appendChild(h),e){const b=document.createElement("div");b.className="mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0",b.textContent=e,this._dropzone.appendChild(b)}this.setupEventListeners(),this._renderErrorState(c,l),this._renderPreviews()}_updateDragState(){this._dropzone&&this._updateDragStateClass()}_renderErrorState(e,t){let i=this.querySelector(".mint-dropzone-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-dropzone-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}_updateDragStateClass(){if(!this._dropzone)return;const e=this.isDisabled(),t=this.hasError(),r=`relative border-2 border-dashed rounded-lg transition-all duration-200 flex flex-col items-center ${this._selectedFiles.length>0?"justify-start":"justify-center"} cursor-pointer overflow-hidden`,n=this._isDragging?"border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-gray-800":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 hover:border-gray-400 dark:hover:border-gray-500",a=t?"border-red-300 dark:border-red-300 bg-red-50/50 dark:bg-red-900/30":"",c=e?"opacity-40 cursor-not-allowed":"";this._dropzone.className=`${r} ${t?a:n} ${c}`.trim()}setupEventListeners(){this._listenersInitialized||(this._listenersInitialized=!0,this.removeEventListeners(),!(!this._dropzone||!this._fileInput||this.isDisabled())&&(this._onDropzoneClick||(this._onDropzoneClick=e=>{if(!(this.isDisabled()||!this._fileInput)&&e.target!==this._fileInput&&(e.stopPropagation(),e.preventDefault(),e.isTrusted))try{this._fileInput.click()}catch(t){console.debug("File chooser blocked:",t)}}),this._onDragOver||(this._onDragOver=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||this._isDragging||(this._isDragging=!0,this._wasDragging=!0,this._updateDragState())}),this._onDragLeave||(this._onDragLeave=e=>{var i;e.preventDefault(),e.stopPropagation();const t=(i=this._dropzone)==null?void 0:i.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState())}),this._onDrop||(this._onDrop=e=>{var i;if(e.preventDefault(),e.stopPropagation(),this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState()),this.isDisabled())return;const t=(i=e.dataTransfer)==null?void 0:i.files;t&&t.length>0&&this._handleFiles(t)}),this._onFileInputInput||(this._onFileInputInput=e=>{e.stopImmediatePropagation(),e.stopPropagation()}),this._onFileInputChange||(this._onFileInputChange=e=>{if(e.stopImmediatePropagation(),e.stopPropagation(),this._isUpdatingFiles)return;const i=e.target.files;if(i&&i.length>0){const s=this.getAccept(),r=this.isMultiple(),n=[],a=[];for(let c=0;c<i.length;c++){const l=i[c];this._isFileAccepted(l,s)?n.push(l):a.push(l)}if(!r&&n.length>1&&(a.push(...n.slice(1)),n.splice(1)),a.length>0){const c=new CustomEvent("dropRejected",{detail:{files:a,reason:"File type not accepted or multiple files not allowed"},bubbles:!0,cancelable:!0});this.dispatchEvent(c)}n.length>0&&this._applyValidFiles(n)}}),this._dropzone.addEventListener("click",this._onDropzoneClick),this._dropzone.addEventListener("dragover",this._onDragOver),this._dropzone.addEventListener("dragleave",this._onDragLeave),this._dropzone.addEventListener("drop",this._onDrop),this._fileInput.addEventListener("change",this._onFileInputChange),this._fileInput.addEventListener("input",this._onFileInputInput,!0)))}removeEventListeners(){this._dropzone&&(this._onDropzoneClick&&this._dropzone.removeEventListener("click",this._onDropzoneClick),this._onDragOver&&this._dropzone.removeEventListener("dragover",this._onDragOver),this._onDragLeave&&this._dropzone.removeEventListener("dragleave",this._onDragLeave),this._onDrop&&this._dropzone.removeEventListener("drop",this._onDrop)),this._fileInput&&(this._onFileInputChange&&this._fileInput.removeEventListener("change",this._onFileInputChange),this._onFileInputInput&&this._fileInput.removeEventListener("input",this._onFileInputInput,!0)),this._isDragging=!1,this._listenersInitialized=!1}_handleFiles(e){const t=this.getAccept(),i=this.isMultiple(),s=[],r=[];for(let n=0;n<e.length;n++){const a=e[n];this._isFileAccepted(a,t)?s.push(a):r.push(a)}if(!i&&s.length>1&&(r.push(...s.slice(1)),s.splice(1)),r.length>0){const n=new CustomEvent("dropRejected",{detail:{files:r,reason:"File type not accepted or multiple files not allowed"},bubbles:!0,cancelable:!0});this.dispatchEvent(n)}s.length>0&&this._applyValidFiles(s)}_isFileAccepted(e,t){var s;if(!t)return!0;const i=t.split(",").map(r=>r.trim().toLowerCase());for(const r of i)if(r.startsWith(".")){if("."+((s=e.name.split(".").pop())==null?void 0:s.toLowerCase())===r)return!0}else if(r.includes("/*")){const n=r.split("/")[0],a=e.type.split("/")[0];if(n===a)return!0}else if(e.type===r)return!0;return!1}_dispatchEvent(e,t){const i=t.target,s=new CustomEvent(e,{detail:{files:i.files?Array.from(i.files):[],value:i.value||""},bubbles:!0,cancelable:!0});this.dispatchEvent(s)}_dispatchSelectionEvents(){const t={files:[...this._selectedFiles],value:""};this.dispatchEvent(new CustomEvent("input",{detail:t,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,cancelable:!0,composed:!0}))}_syncFileInputFromSelected(){if(!this._fileInput)return;const e=new DataTransfer;this._selectedFiles.forEach(t=>{try{e.items.add(t)}catch(i){console.warn("Failed to add file to DataTransfer:",i)}}),this._isUpdatingFiles=!0;try{this._fileInput.files=e.files}catch(t){console.warn("Failed to set files on input:",t)}setTimeout(()=>{this._isUpdatingFiles=!1},0)}get files(){var e;return this._syncFileInputFromSelected(),((e=this._fileInput)==null?void 0:e.files)||null}syncFiles(){this._syncFileInputFromSelected()}_renderPreviews(){if(!this._dropzone)return;if(this._previewContainer&&(this._cleanupPreviewUrls(),this._previewContainer.remove()),this._selectedFiles.length===0){this._previewContainer=null,this._updateDragStateClass();return}const e=document.createElement("div");e.className="mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48";const t=document.createElement("div");t.className="mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2",this._selectedFiles.forEach((l,o)=>{const d=document.createElement("div");if(d.className="flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",l.type.startsWith("image/")){const f=document.createElement("img");f.className="w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";const _=URL.createObjectURL(l);this._previewUrls.push(_),f.src=_,d.appendChild(f)}else{const f=document.createElement("mint-icon");f.setAttribute("name","attach"),f.className="w-5 h-5 text-gray-500 dark:text-gray-300",d.appendChild(f)}const h=document.createElement("div");h.className="flex-1 text-sm text-gray-800 dark:text-gray-100 truncate",h.textContent=l.name,d.appendChild(h);const u=document.createElement("button");u.type="button",u.className="text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors flex items-center justify-center w-6 h-6 rounded-full";const b=document.createElement("mint-icon");b.setAttribute("name","close"),b.className="w-4 h-4",u.appendChild(b),u.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),this._removeFileAt(o)}),d.appendChild(u),t.appendChild(d)});const i=this.hasError(),s=this._isDragging;let r="from-white dark:from-gray-700";i?r="from-red-50 dark:from-red-900/30":s&&(r="from-gray-50 dark:from-gray-800");const n=document.createElement("div");n.className=`absolute top-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-b ${r} to-transparent opacity-0 transition-opacity duration-200`,e.appendChild(n);const a=document.createElement("div");a.className=`absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${r} to-transparent opacity-100 transition-opacity duration-200`,e.appendChild(a);const c=()=>{const l=t.scrollTop,o=t.scrollHeight,d=t.clientHeight;l>0?n.style.opacity="1":n.style.opacity="0",l+d<o-1?a.style.opacity="1":a.style.opacity="0"};c(),t.addEventListener("scroll",c),e.appendChild(t),this._previewContainer=e,this._dropzone.appendChild(e),this._updateDragStateClass()}_removeFileAt(e){if(e<0||e>=this._selectedFiles.length)return;const[t]=this._selectedFiles.splice(e,1);t&&this._cleanupPreviewUrls(),this._syncFileInputFromSelected(),this._renderPreviews(),this._dispatchSelectionEvents()}_cleanupPreviewUrls(){this._previewUrls.forEach(e=>URL.revokeObjectURL(e)),this._previewUrls=[]}_attachFormResetListener(){const e=this.closest("form");!e||this._resetHandler||(this._resetHandler=()=>{this._selectedFiles=[],this._syncFileInputFromSelected(),this._renderPreviews(),this._cleanupPreviewUrls()},e.addEventListener("reset",this._resetHandler))}_applyValidFiles(e){if(this.isMultiple()){const i=e.filter(s=>!this._isDuplicateFile(s));this._selectedFiles.push(...i)}else this._selectedFiles=[e[0]];this._syncFileInputFromSelected(),this._selectedFiles.length>0&&(this.removeAttribute("error"),this.removeAttribute("error-message"),this._fileInput&&this._fileInput.removeAttribute("aria-invalid")),this._renderPreviews(),this._dispatchSelectionEvents()}_isDuplicateFile(e){return this._selectedFiles.some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)}}customElements.get("mint-dropzone")||customElements.define("mint-dropzone",Q);class ee extends HTMLElement{constructor(){super(),this._form=null,this._submitHandler=null,this._hostSubmitHandler=null,this._errors={},this._fieldBlurHandlers=new Map,this._fieldChangeHandlers=new Map,this._observer=null}static get observedAttributes(){return["action","method","enctype"]}connectedCallback(){this._render(),this._setupBlurValidation()}disconnectedCallback(){this._form&&this._submitHandler&&this._form.removeEventListener("submit",this._submitHandler,!0),this._hostSubmitHandler&&this.removeEventListener("submit",this._hostSubmitHandler),this._cleanupBlurValidation()}reset(){this._clearErrors(),this._form&&this._form.reset(),this._resetCustomFields()}attributeChangedCallback(e,t,i){this._applyFormAttributes()}_render(){if(this.classList.add("block","w-full"),!this._form){for(this._form=document.createElement("form"),this._form.noValidate=!0;this.firstChild;)this._form.appendChild(this.firstChild);this.appendChild(this._form),this._submitHandler=e=>this._handleSubmit(e),this._form.addEventListener("submit",function(e){var t;(t=this.closest("mint-form"))==null||t._handleSubmit(e)})}this._applyFormAttributes()}_applyFormAttributes(){if(!this._form)return;const e=this.getAttribute("action")||"",t=(this.getAttribute("method")||"POST").toUpperCase(),i=this.getAttribute("enctype")||"application/x-www-form-urlencoded";e&&(this._form.action=e),this._form.method=t,this._form.enctype=i}async _handleSubmit(e){if(e.preventDefault(),!this._form)return;this._clearErrors(),this._syncDropzoneFiles();const t=this._collectValidationRules(),i=new FormData(this._form),s=this._formDataToValues(i);if(!this._validate(s,t)){this.dispatchEvent(new CustomEvent("invalid",{detail:{errors:this._errors},bubbles:!0,cancelable:!0,composed:!0}));return}const n=new CustomEvent("submit",{detail:{formData:i,values:s},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(n),!n.defaultPrevented)try{const a=await this._submitData(i,s);this.dispatchEvent(new CustomEvent("submitsuccess",{detail:a,bubbles:!0,cancelable:!0}))}catch(a){this.dispatchEvent(new CustomEvent("submiterror",{detail:{error:a},bubbles:!0,cancelable:!0}))}}async _submitData(e,t){const i=this.getAttribute("action"),s=(this.getAttribute("method")||"POST").toUpperCase(),r=this.getAttribute("enctype")||"application/x-www-form-urlencoded";if(!i)return{status:0,ok:!0,data:{values:t}};const n=Array.from(e.values()).some(o=>o instanceof File);let a=null;const c={};let l=i;if(s==="GET"){const o=new URLSearchParams;e.forEach((d,h)=>{d instanceof File||o.append(h,String(d))}),l+=(i.includes("?")?"&":"?")+o.toString()}else if(r==="multipart/form-data"||n)a=e;else if(r==="application/json")a=JSON.stringify(t),c["Content-Type"]="application/json";else{const o=new URLSearchParams;e.forEach((d,h)=>{d instanceof File||o.append(h,String(d))}),a=o,c["Content-Type"]="application/x-www-form-urlencoded"}if(typeof fetch=="function"){const o=await fetch(l,{method:s,body:s==="GET"?null:a,headers:c}),d=await o.text().catch(()=>"");let h=d;try{h=JSON.parse(d)}catch{}if(!o.ok)throw{status:o.status,data:h};return{status:o.status,ok:o.ok,data:h}}return await new Promise((o,d)=>{const h=new XMLHttpRequest;h.open(s,l,!0),Object.entries(c).forEach(([u,b])=>h.setRequestHeader(u,b)),h.onload=function(){const{status:u,responseText:b}=h;if(u>=200&&u<300){let f=b;try{f=JSON.parse(b)}catch{}o({status:u,ok:!0,data:f})}else d({status:u,data:b})},h.onerror=function(){d({status:h.status,data:h.responseText})},h.send(s==="GET"?null:a)})}_formDataToValues(e){const t={};return e.forEach((i,s)=>{i instanceof File?(t[s]||(t[s]=[]),t[s].push(i)):s in t?Array.isArray(t[s])?(t[s].length>0&&t[s][0]instanceof File,t[s].push(i)):t[s]=[t[s],i]:t[s]=i}),this._form&&Array.from(this._form.querySelectorAll("mint-dropzone[name]")).forEach(s=>{const r=s.getAttribute("name");if(r&&typeof s.files<"u"&&s.files){const n=s.files;if(n.length>0){const a=Array.from(n);t[r]&&Array.isArray(t[r])?a.forEach(c=>{t[r].some(o=>o.name===c.name&&o.size===c.size&&o.lastModified===c.lastModified)||t[r].push(c)}):t[r]=a}}}),t}_collectValidationRules(){const e={};return this._form&&Array.from(this._form.querySelectorAll("[name][validation]")).forEach(i=>{const s=i.getAttribute("name")||"",r=i.getAttribute("validation");if(!s||!r)return;const n=this._parseRules(r);n.length&&(e[s]=n)}),e}_parseRules(e){if(!e)return[];try{const t=e.replace(/'/g,'"'),i=JSON.parse(t);if(Array.isArray(i))return i.map(s=>String(s))}catch{}return e.split(",").map(t=>t.trim()).filter(Boolean)}_validate(e,t){let i=!0;return this._errors={},Object.entries(t||{}).forEach(([s,r])=>{const n=Array.isArray(r)?r:[r],a=this._getFieldElements(s),c=this._extractFieldValue(a),l=this._validateRules(c,n);l?(i=!1,this._errors[s]=l,this._flagFieldError(a,l)):this._clearFieldError(a)}),i}_validateField(e){const t=this._collectValidationRules();if(!t[e])return;const i=t[e],s=Array.isArray(i)?i:[i],r=this._getFieldElements(e),n=this._extractFieldValue(r),a=this._validateRules(n,s);a?(this._errors[e]=a,this._flagFieldError(r,a)):(this._clearFieldError(r),delete this._errors[e])}_validateRules(e,t){for(const i of t){const[s,r]=i.split(":");switch(s){case"required":{if(e==null||typeof e=="string"&&e.trim()===""||e instanceof FileList&&e.length===0||Array.isArray(e)&&e.length===0)return"This field is required.";break}case"string":{if(typeof e!="string")return"Must be a string.";break}case"email":{if(typeof e=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()))return"Enter a valid email.";break}case"number":{const n=Number(e);if(Number.isNaN(n))return"Must be a number.";break}case"min":{const n=Number(r);if(Number.isNaN(n))break;if(typeof e=="string"&&e.trim().length<n)return`Must be at least ${n} characters.`;if(Array.isArray(e)&&e.length<n)return`Select at least ${n}.`;if(e instanceof FileList&&e.length<n)return`Upload at least ${n} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)<n)return`Must be at least ${n}.`;break}case"max":{const n=Number(r);if(Number.isNaN(n))break;if(typeof e=="string"&&e.trim().length>n)return`Must be at most ${n} characters.`;if(Array.isArray(e)&&e.length>n)return`Select no more than ${n}.`;if(e instanceof FileList&&e.length>n)return`Upload no more than ${n} files.`;if(e!=null&&!Number.isNaN(Number(e))&&Number(e)>n)return`Must be at most ${n}.`;break}}}return null}_getFieldElements(e){if(!this._form)return[];const t=Array.from(this._form.querySelectorAll(`[name="${e}"]`)),i=t.filter(s=>s.tagName==="MINT-SELECT");if(i.length>0){const s=[];return i.forEach(r=>{const n=r.querySelector('select[name="'+e+'"]');n&&s.push(n)}),t.filter(r=>r.tagName!=="MINT-SELECT").concat(s)}return t}_extractFieldValue(e){if(e.length===0)return"";const t=e.find(s=>s instanceof HTMLSelectElement);if(t)return t.value;if(e.length>1){const s=e.filter(n=>n instanceof HTMLInputElement),r=s.filter(n=>n.checked);if(s.every(n=>n.type==="radio"))return r.length>0?r[0].value||"on":"";if(s.every(n=>n.type==="checkbox"))return r.map(n=>n.value||"on")}const i=e[0];if(i instanceof HTMLInputElement)return i.type==="file"?i.files:i.type==="checkbox"||i.type==="radio"?i.checked?i.value||"on":"":i.value;if(i instanceof HTMLTextAreaElement)return i.value;if(i.tagName==="MINT-SELECT"){const s=i.querySelector("select");if(s)return s.value;if(typeof i.getValue=="function"){const n=i.getValue();if(n!=null&&n!=="")return n}const r=i.getAttribute("value");return r||""}return i.tagName==="MINT-DROPZONE"&&typeof i.files<"u"?i.files:typeof i.value<"u"?i.value:i.getAttribute("value")||""}_flagFieldError(e,t){e.length!==0&&e.forEach(i=>{(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement)&&i.setAttribute("aria-invalid","true");const s=this._resolveHost(i);s&&(s.setAttribute("error",""),s.setAttribute("error-message",t),s.setAttribute("data-mint-form-error","true"))})}_clearFieldError(e){e.length!==0&&e.forEach(t=>{(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&t.removeAttribute("aria-invalid");const i=this._resolveHost(t);i&&(i.removeAttribute("error"),i.removeAttribute("error-message"),i.removeAttribute("data-mint-form-error"))})}_clearErrors(){this.querySelectorAll("[data-mint-form-error]").forEach(e=>{const t=e;t.removeAttribute("error"),t.removeAttribute("error-message"),t.removeAttribute("data-mint-form-error")}),this._form&&this._form.querySelectorAll('[aria-invalid="true"]').forEach(e=>{e.removeAttribute("aria-invalid")})}_resetCustomFields(){this.querySelectorAll("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch").forEach(t=>{var s,r;t.removeAttribute("error"),t.removeAttribute("error-message");const i=t.tagName;if(i==="MINT-INPUT")try{t.value=""}catch{}else if(i==="MINT-DATE-PICKER")try{(s=t.setValue)==null||s.call(t,"")}catch{}else if(i==="MINT-SELECT")try{(r=t.setValue)==null||r.call(t,"")}catch{}else if(i==="MINT-DROPZONE"){const n=t.querySelector('input[type="file"]');n&&(n.value="")}else if(i==="MINT-CHECKBOX"||i==="MINT-CHOICE"){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');n&&(n.checked=!1)}else if(i==="MINT-SWITCH"){const n=t.querySelector('input[type="checkbox"]');n&&(n.checked=!1)}})}_resolveHost(e){const t=e.closest("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch");return t||e}_setupBlurValidation(){if(!this._form)return;const e=i=>{const s=i.target;if(!s)return;const r=this._findFieldElement(s);if(!r)return;const n=this._getFieldName(r);if(!n||!this._collectValidationRules()[n])return;const c=this._extractFieldValue([r]),l=c!=null&&(typeof c=="string"?c.trim()!=="":c instanceof FileList||Array.isArray(c)?c.length>0:!0),o=r.hasAttribute("data-mint-form-error")||s instanceof HTMLElement&&(s.hasAttribute("aria-invalid")||s.closest("[data-mint-form-error]"));(l||o)&&setTimeout(()=>{this._validateField(n)},0)};this._form.addEventListener("blur",e,!0),this._fieldBlurHandlers.set(this._form,e);const t=i=>{const s=i.target;if(!s)return;if(s instanceof HTMLSelectElement||s.tagName==="MINT-SELECT"||s.closest("mint-select")){const l=this._findFieldElement(s);if(!l)return;const o=this._getFieldName(l);if(!o||!this._collectValidationRules()[o])return;setTimeout(()=>{this._validateField(o)},0);return}const n=this._findFieldElement(s);if(!n)return;const a=this._getFieldName(n);!a||!this._collectValidationRules()[a]||(n.hasAttribute("data-mint-form-error")||s instanceof HTMLElement&&s.hasAttribute("aria-invalid"))&&setTimeout(()=>{this._validateField(a)},0)};this._form.addEventListener("change",t,!0),this._fieldChangeHandlers.set(this._form,t)}_findFieldElement(e){if(e.hasAttribute("name")&&(e.tagName.startsWith("MINT-")||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement))return e;const t=e.closest("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch");if(t&&t.hasAttribute("name"))return t;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.hasAttribute("name"))return e;let i=e;for(;i&&i!==this._form;){if(i.hasAttribute("name"))return i;i=i.parentElement}return null}_getFieldName(e){return e.hasAttribute("name")||e.tagName.startsWith("MINT-")?e.getAttribute("name"):(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.name||null}_cleanupBlurValidation(){if(this._form&&this._fieldBlurHandlers.has(this._form)){const e=this._fieldBlurHandlers.get(this._form);e&&this._form.removeEventListener("blur",e,!0),this._fieldBlurHandlers.delete(this._form)}if(this._form&&this._fieldChangeHandlers.has(this._form)){const e=this._fieldChangeHandlers.get(this._form);e&&this._form.removeEventListener("change",e,!0),this._fieldChangeHandlers.delete(this._form)}this._observer&&(this._observer.disconnect(),this._observer=null)}_syncDropzoneFiles(){if(!this._form)return;Array.from(this._form.querySelectorAll("mint-dropzone[name]")).forEach(t=>{typeof t.syncFiles=="function"&&t.syncFiles()})}}customElements.get("mint-form")||customElements.define("mint-form",ee);class te extends HTMLElement{constructor(){super(),this._observer=null,this._hoverHandlers=new Map}static get observedAttributes(){return["striped","hover","bordered","compact"]}connectedCallback(){this.style.display="block",this.style.width="100%",this.style.overflowX="auto",this._observeChanges(),this._applyStyles(),requestAnimationFrame(()=>{this._applyStyles(),setTimeout(()=>this._applyStyles(),0),setTimeout(()=>this._applyStyles(),50),setTimeout(()=>this._applyStyles(),100),setTimeout(()=>this._applyStyles(),200)})}disconnectedCallback(){this._observer&&(this._observer.disconnect(),this._observer=null),this._hoverHandlers.forEach((e,t)=>{t.removeEventListener("mouseenter",e.enter),t.removeEventListener("mouseleave",e.leave)}),this._hoverHandlers.clear()}attributeChangedCallback(){this._applyStyles()}_observeChanges(){this._observer=new MutationObserver(()=>{this._applyStyles()}),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!1})}_applyStyles(){const e=this.querySelector("table");if(!e)return;const t=this.hasAttribute("bordered"),i=this.hasAttribute("striped"),s=this.hasAttribute("hover"),r=this.hasAttribute("compact");e.style.width="100%",e.style.borderCollapse="collapse",e.style.fontSize="0.875rem",e.style.fontWeight="500";const n=e.querySelector("thead");n&&(n.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(n.style.backgroundColor="rgb(31 41 55)"),n.querySelectorAll("th").forEach(o=>{o.style.textAlign="left",o.style.fontWeight="600",o.style.color="rgb(17 24 39)",document.documentElement.classList.contains("dark")&&(o.style.color="rgb(255 255 255)"),o.style.textTransform="uppercase",o.style.letterSpacing="0.05em",o.style.fontSize="0.75rem",t&&(o.style.border="1px solid rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(o.style.borderColor="rgb(55 65 81)")),r?o.style.padding="0.375rem 0.75rem":o.style.padding="0.75rem 1rem"}));const a=e.querySelector("tbody");a&&(i&&(a.style.borderTopWidth="1px",a.style.borderTopStyle="solid",a.style.borderTopColor="rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(a.style.borderTopColor="rgb(55 65 81)")),a.querySelectorAll("tr").forEach((o,d)=>{if(t&&(o.style.borderBottomWidth="1px",o.style.borderBottomStyle="solid",o.style.borderBottomColor="rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(o.style.borderBottomColor="rgb(55 65 81)")),i?d%2===0?(o.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(o.style.backgroundColor="rgb(17 24 39)")):(o.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(o.style.backgroundColor="rgb(31 41 55)")):(o.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(o.style.backgroundColor="rgb(17 24 39)")),s){o.style.transition="background-color 150ms";const u=this._hoverHandlers.get(o);u&&(o.removeEventListener("mouseenter",u.enter),o.removeEventListener("mouseleave",u.leave));const b=()=>{o.style.backgroundColor="rgb(243 244 246)",document.documentElement.classList.contains("dark")&&(o.style.backgroundColor="rgb(31 41 55)")},f=()=>{i?d%2===0?(o.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(o.style.backgroundColor="rgb(17 24 39)")):(o.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(o.style.backgroundColor="rgb(31 41 55)")):(o.style.backgroundColor="rgb(255 255 255)",document.documentElement.classList.contains("dark")&&(o.style.backgroundColor="rgb(17 24 39)"))};this._hoverHandlers.set(o,{enter:b,leave:f}),o.addEventListener("mouseenter",b),o.addEventListener("mouseleave",f)}else{const u=this._hoverHandlers.get(o);u&&(o.removeEventListener("mouseenter",u.enter),o.removeEventListener("mouseleave",u.leave),this._hoverHandlers.delete(o))}o.querySelectorAll("td").forEach(u=>{u.style.color="rgb(17 24 39)",document.documentElement.classList.contains("dark")&&(u.style.color="rgb(243 244 246)"),t&&(u.style.border="1px solid rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(u.style.borderColor="rgb(55 65 81)")),r?u.style.padding="0.375rem 0.75rem":u.style.padding="0.75rem 1rem"})}));const c=e.querySelector("tfoot");c&&(c.style.backgroundColor="rgb(249 250 251)",document.documentElement.classList.contains("dark")&&(c.style.backgroundColor="rgb(31 41 55)"),c.style.fontWeight="600",c.querySelectorAll("td").forEach(o=>{o.style.color="rgb(17 24 39)",document.documentElement.classList.contains("dark")&&(o.style.color="rgb(243 244 246)"),t&&(o.style.border="1px solid rgb(229 231 235)",document.documentElement.classList.contains("dark")&&(o.style.borderColor="rgb(55 65 81)")),r?o.style.padding="0.375rem 0.75rem":o.style.padding="0.75rem 1rem"}))}}customElements.get("mint-table")||customElements.define("mint-table",te);exports.BackButton=W;exports.Button=F;exports.Card=V;exports.Checkbox=G;exports.Choice=J;exports.DatePicker=K;exports.Dropzone=Q;exports.Form=ee;exports.Grid=$;exports.Icon=O;exports.Input=X;exports.Link=R;exports.Modal=Y;exports.Page=j;exports.Popover=U;exports.Select=Z;exports.Spinner=P;exports.Stack=z;exports.Switch=q;exports.Table=te;exports.Text=B;exports.default=F;