monobill-mintui 0.3.40 → 0.3.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/text/Text.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;AAC7D,KAAK,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AACrD,KAAK,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAA;AAEtD,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,YAAY,CAAyB;;IAO7C,iBAAiB,IAAI,IAAI;IASzB,OAAO,CAAC,mBAAmB;IAO3B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,oBAAoB,IAAI,IAAI;IAQ5B,OAAO,CAAC,gBAAgB;IAexB,UAAU,IAAI,WAAW;IAIzB,OAAO,IAAI,QAAQ;IAInB,MAAM,IAAI,OAAO;IAIjB,WAAW,IAAI,OAAO;IAItB,QAAQ,IAAI,OAAO;IAInB,QAAQ,IAAI,OAAO;IAInB,UAAU,IAAI,WAAW;IAazB,cAAc,IAAI,MAAM;IA+DxB,MAAM,IAAI,IAAI;CAsDf;AAOD,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/text/Text.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;AAC7D,KAAK,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AACrD,KAAK,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAA;AAEtD,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,YAAY,CAAyB;;IAO7C,iBAAiB,IAAI,IAAI;IASzB,OAAO,CAAC,mBAAmB;IAO3B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,oBAAoB,IAAI,IAAI;IAQ5B,OAAO,CAAC,gBAAgB;IAexB,UAAU,IAAI,WAAW;IAIzB,OAAO,IAAI,QAAQ;IAInB,MAAM,IAAI,OAAO;IAIjB,WAAW,IAAI,OAAO;IAItB,QAAQ,IAAI,OAAO;IAInB,QAAQ,IAAI,OAAO;IAInB,UAAU,IAAI,WAAW;IAezB,cAAc,IAAI,MAAM;IA+DxB,MAAM,IAAI,IAAI;CAsDf;AAOD,eAAe,QAAQ,CAAA"}
package/dist/index.cjs CHANGED
@@ -62,7 +62,7 @@
62
62
  mint-button[data-variant="link"] .mint-button-active {
63
63
  box-shadow: none !important;
64
64
  }
65
- `,document.head.appendChild(t),W._activeShadowStyleInjected=!0}this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add("w-full")}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(t,e,i){e!==i&&this.render()}getVariant(){return this.getAttribute("variant")||"solid"}getTone(){return this.getAttribute("tone")||"neutral"}isDisabled(){return this.getAttribute("disabled")==="true"}isLoading(){return this.getAttribute("loading")==="true"}getType(){const t=this.getAttribute("type"),e=this.getAttribute("button-type");return(t||e||"default")==="submit"?"submit":"button"}isFullWidth(){return this.hasAttribute("full-width")}isActive(){const t=this.getAttribute("active");return!(t===null||t==="false"||t==="0")}get active(){return this.isActive()}set active(t){t?this.setAttribute("active","true"):this.removeAttribute("active")}getIconPosition(){return this.getAttribute("icon-position")||"left"}getIcon(){return this.getAttribute("icon")||""}isIconOnly(){var i,s,n,r,a;if(!(this.getIcon()||((i=this._button)==null?void 0:i.querySelector('[slot="icon"], .mint-button-icon, mint-icon'))))return!1;const e=(s=this._button)==null?void 0:s.querySelector(".mint-button-content");if(e&&((n=e.textContent)!=null&&n.trim()))return!1;if(this._button)for(let o=this._button.firstChild;o;o=o.nextSibling){if(o.nodeType===Node.TEXT_NODE&&((r=o.textContent)!=null&&r.trim()))return!1;if(o.nodeType===Node.ELEMENT_NODE){const l=o;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}getActiveStateClasses(){const t=this.getVariant(),e=this.getTone(),i=`${t}-${e}`;return{"solid-action":["!bg-slate-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-slate-700","hover:!bg-slate-900","dark:hover:!bg-slate-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"solid-neutral":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"solid-info":["!bg-blue-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-blue-700","hover:!bg-blue-900","dark:hover:!bg-blue-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"solid-warning":["!bg-amber-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-amber-700","hover:!bg-amber-900","dark:hover:!bg-amber-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"solid-danger":["!bg-red-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-red-700","hover:!bg-red-900","dark:hover:!bg-red-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"ghost-action":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"ghost-neutral":["!bg-gray-50","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","!text-gray-900","dark:!text-white","hover:!bg-gray-50","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","hover:!text-gray-900","dark:hover:!text-white"],"ghost-info":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"ghost-warning":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"ghost-danger":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"link-action":["!text-slate-900","dark:!text-slate-300","hover:!text-slate-900","dark:hover:!text-slate-300"],"link-neutral":["!text-gray-950","dark:!text-gray-200","hover:!text-gray-950","dark:hover:!text-gray-200"],"link-info":["!text-blue-900","dark:!text-blue-200","hover:!text-blue-900","dark:hover:!text-blue-200"],"link-warning":["!text-amber-900","dark:!text-amber-200","hover:!text-amber-900","dark:hover:!text-amber-200"],"link-danger":["!text-red-900","dark:!text-red-200","hover:!text-red-900","dark:hover:!text-red-200"]}[i]||[]}getButtonClasses(){const t=this.isIconOnly(),e=this.getVariant(),i=["inline-flex","items-center","justify-center","font-medium","rounded-lg","box-border",...t?["p-1.5","aspect-square","w-[2.25rem]","h-[2.25rem]"]:["px-3.5","py-1.5","min-h-[2.25rem]"],"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(),n={"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"]},r=`${e}-${s}`,a=n[r]||n["solid-neutral"],o=[...i,...a];if(this.isActive()){const l=this.getActiveStateClasses();o.push(...l),o.push("[&>*]:scale-95")}return this.isFullWidth()&&o.push("w-full"),o.join(" ")}render(){var d,p,h,u,_,f;const t=this.isDisabled()||this.isLoading(),e=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=e,this._button.disabled=t;let i=this._button.querySelector("mint-spinner");const s=this.isLoading();if(s)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 m=document.createElement("span");m.className="mr-2 inline-flex items-center";const g=document.createElement("mint-spinner");g.setAttribute("size","default"),g.setAttribute("data-button-variant",this.getVariant()),g.setAttribute("data-button-tone",this.getTone()),g.style.width="0.875rem",g.style.height="0.875rem",m.appendChild(g),this._button.insertBefore(m,this._button.firstChild)}else i&&((d=i.parentElement)==null||d.remove());for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);const n=this.getIcon();let r=this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');n?(r&&r.tagName!=="MINT-ICON"&&(r.remove(),r=null),!r||r.tagName!=="MINT-ICON"?(r=document.createElement("mint-icon"),r.setAttribute("name",n),r.className="mint-button-icon"):r.setAttribute("name",n)):r&&r.tagName==="MINT-ICON"&&(r.remove(),r=null),r||(r=this._button.querySelector('[slot="icon"], .mint-button-icon'));const a=this.getIconPosition();let o=this._button.querySelector(".mint-button-content");if(o){const m=r&&r.tagName==="MINT-ICON";if(r&&!r.parentElement){const g=(u=this._button.querySelector("mint-spinner"))==null?void 0:u.parentElement;m||a==="left"?g?g.insertAdjacentElement("afterend",r):this._button.insertBefore(r,o):o.insertAdjacentElement("afterend",r)}else if(r&&(m||a==="left")&&r.nextSibling!==o){r.remove();const g=(_=this._button.querySelector("mint-spinner"))==null?void 0:_.parentElement;g?g.insertAdjacentElement("afterend",r):this._button.insertBefore(r,o)}else r&&!m&&a==="right"&&r.previousSibling!==o&&(r.remove(),o.insertAdjacentElement("afterend",r))}else{const m=[];for(let g=this._button.firstChild;g;g=g.nextSibling){if(g.nodeType!==Node.ELEMENT_NODE){m.push(g);continue}const b=g;b.tagName!=="MINT-SPINNER"&&!b.querySelector("mint-spinner")&&g!==r&&!b.hasAttribute("slot")&&!(b.className==="mr-2"&&b.querySelector("mint-spinner"))&&m.push(g)}if(m.length>0){o=document.createElement("span"),o.className="mint-button-content inline-flex items-center",m.forEach(b=>{o.appendChild(b)});const g=(p=this._button.querySelector("mint-spinner"))==null?void 0:p.parentElement;r&&a==="left"?g?(g.insertAdjacentElement("afterend",r),r.insertAdjacentElement("afterend",o)):(this._button.insertBefore(r,this._button.firstChild),r.insertAdjacentElement("afterend",o)):r&&a==="right"?g?(g.insertAdjacentElement("afterend",o),o.insertAdjacentElement("afterend",r)):(this._button.insertBefore(o,this._button.firstChild),o.insertAdjacentElement("afterend",r)):g?g.insertAdjacentElement("afterend",o):this._button.insertBefore(o,this._button.firstChild)}else if(r&&r.tagName==="MINT-ICON"&&!r.parentElement){const g=(h=this._button.querySelector("mint-spinner"))==null?void 0:h.parentElement;g?g.insertAdjacentElement("afterend",r):this._button.insertBefore(r,this._button.firstChild)}}const l=this.isIconOnly();if(r&&(r.classList.contains("mint-button-icon")||r.classList.add("mint-button-icon"),s?r.style.display="none":r.style.display="",r.classList.remove("mr-1.5","ml-1.5"),l?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")):a==="left"?r.classList.add("mr-1.5"):r.classList.add("ml-1.5")),s){const m=(f=this._button.querySelector("mint-spinner"))==null?void 0:f.parentElement;m&&(l?(m.classList.remove("mr-2"),m.classList.add("mr-0")):m.classList.contains("mr-2")||(m.classList.remove("mr-0"),m.classList.add("mr-2")))}const c=this.getButtonClasses();this._button.className=c,this.setAttribute("data-variant",this.getVariant()),this.setAttribute("data-tone",this.getTone()),this.isActive()?this._button.classList.add("mint-button-active"):this._button.classList.remove("mint-button-active")}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(t){if(this.isDisabled()||this.isLoading()){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();return}if(this.getType()==="submit"){this.dispatchEvent(new CustomEvent("click",{detail:{originalEvent:t},bubbles:!0,cancelable:!0,composed:!0}));return}if(t.stopPropagation(),t.stopImmediatePropagation(),this._isHandlingClick){t.preventDefault();return}this._isHandlingClick=!0,t.preventDefault(),this.dispatchEvent(new CustomEvent("click",{detail:{originalEvent:t},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};W._activeShadowStyleInjected=!1;let j=W;customElements.get("mint-button")||customElements.define("mint-button",j);class X extends HTMLElement{constructor(){super(),this._button=null,this._checked=!1}static get observedAttributes(){return["checked","disabled","label","icon","info","error","error-message","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block","w-full"),this._checked=this.hasAttribute("checked"),this.render()}_getSwitchContainer(){let t=this.querySelector(".mint-switch-container");return t||(t=document.createElement("div"),t.className="mint-switch-container flex items-center gap-2",this.insertBefore(t,this.firstChild)),t}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(t==="checked"&&(this._checked=i!==null),e!==i){if(t==="error"||t==="error-message"){this._renderErrorState();return}if(t==="loading"){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(t){try{t?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!t,this.render()}catch{}}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getIcon(){return this.getAttribute("icon")||""}hasIcon(){return!!this.getIcon()}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getSwitchClasses(){const t=this.hasError(),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",t?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","disabled:opacity-50","disabled:cursor-not-allowed"],i=this._checked?["bg-slate-950","dark:bg-slate-600",t?"border-red-300 dark:border-red-300":"border-slate-700 dark:border-slate-500"]:["bg-slate-200","dark:bg-slate-400",t?"border-red-300 dark:border-red-300":"border-slate-300 dark:border-slate-500"];return[...e,...i].join(" ")}getThumbClasses(){const t=["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"],e=this._checked?"translate-x-5":"translate-x-0.5";return[...t,e].join(" ")}getIconClasses(){return["absolute","inset-0","flex","items-center","justify-center","pointer-events-none"].join(" ")}render(){const t=this.isLoading(),e=this.getSwitchClasses(),i=this.getThumbClasses(),s=this.getLabel(),n=this.getInfo(),r=this.getIcon(),a=this.getAttribute("id")||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute("id")||this.setAttribute("id",a);const o=this._getSwitchContainer();this._button?this._button.parentElement!==o&&o.appendChild(this._button):(this._button=document.createElement("button"),o.appendChild(this._button),this.setupEventListeners());let l=o.querySelector(".mint-switch-label");s?(l||(l=document.createElement("label"),l.className="mint-switch-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",this._button&&this._button.parentElement===o?o.insertBefore(l,this._button.nextSibling):o.appendChild(l)),l.textContent=s,l.setAttribute("for",a),this.isDisabled()?l.classList.add("opacity-40"):l.classList.remove("opacity-40")):l&&l.remove(),this._button.className=e,this._button.disabled=this.isDisabled(),this._button.id=a,this._button.setAttribute("aria-checked",String(this._checked)),this._button.setAttribute("aria-label",s||"Toggle switch"),this._button.setAttribute("role","switch"),this._button.type="button";let c=this._button.querySelector("span");c||(c=document.createElement("span"),this._button.appendChild(c)),c.className=i;const d=c.querySelector("span");if(r){let h=d;h||(h=document.createElement("span"),h.className=this.getIconClasses(),c.appendChild(h));let u=h.querySelector("mint-icon");u||(u=document.createElement("mint-icon"),h.appendChild(u)),u.setAttribute("name",r)}else d&&d.remove();let p=this.querySelector(".mint-switch-info");n?(p||(p=document.createElement("span"),p.className="mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block",o&&o.parentElement===this?this.insertBefore(p,o.nextSibling):this.appendChild(p)),p.textContent=n,this.isDisabled()?p.classList.add("opacity-40"):p.classList.remove("opacity-40")):p&&p.remove(),this._renderErrorState(),this._renderSkeleton(t)}setupEventListeners(){this._button&&this._button.addEventListener("click",this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener("click",this.handleToggle.bind(this))}handleToggle(t){if(!this.isDisabled()){this.checked=!this._checked;const e=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent("input",{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("toggle",{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(t){const e=this._getSwitchContainer(),i=this.getLabel(),s=this.getInfo();let n=e.querySelector(".mint-switch-skeleton-container"),r=this.querySelector(".mint-switch-info-skeleton");if(t){e.classList.contains("relative")||e.classList.add("relative"),n||(n=document.createElement("div"),n.className="mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2",e.appendChild(n));let a=n.querySelector(".mint-switch-skeleton-box");if(a||(a=document.createElement("div"),a.className="mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse",n.appendChild(a)),i){let l=n.querySelector(".mint-switch-skeleton-label");l||(l=document.createElement("div"),l.className="mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",n.appendChild(l))}else{const l=n.querySelector(".mint-switch-skeleton-label");l&&l.remove()}n.style.display="flex",this._button&&(this._button.style.visibility="hidden",this._button.style.pointerEvents="none");const o=e.querySelector(".mint-switch-label");if(o&&(o.style.visibility="hidden",o.style.pointerEvents="none"),s){r||(r=document.createElement("div"),r.className="mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse mt-2",e&&e.parentElement===this?this.insertBefore(r,e.nextSibling):this.appendChild(r)),r.style.display="block";const l=this.querySelector(".mint-switch-info");l&&(l.style.display="none")}else r&&(r.style.display="none")}else{n&&(n.style.display="none"),r&&(r.style.display="none"),this._button&&(this._button.style.visibility="visible",this._button.style.pointerEvents="auto");const a=e.querySelector(".mint-switch-label");a&&(a.style.visibility="visible",a.style.pointerEvents="auto");const o=this.querySelector(".mint-switch-info");o&&(o.style.display="")}}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-switch-error");t&&e?(i||(i=document.createElement("div"),i.className="mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=e):i&&i.remove(),this._button&&(this._button.className=this.getSwitchClasses())}}customElements.get("mint-switch")||customElements.define("mint-switch",X);class K 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(e=>this._userClasses.add(e))}attributeChangedCallback(t,e,i){e!==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 t=this.getSize(),e=this.getVariant(),i=document.documentElement.classList.contains("dark"),s={heading:["font-semibold"],"sub-heading":["font-medium"],regular:[]},n={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"]},r=[];this.isBold()&&r.push("font-bold"),this.isUnderline()&&r.push("underline"),this.isStrike()&&r.push("line-through"),this.isItalic()&&r.push("italic");const a=this.getDisplay();return[a==="block"?"block":a==="inline"?"inline":"inline-block",...s[t]||s.regular,...n[e]||n.default,...r].join(" ")}render(){const t=this.getSize(),e=["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)}),e.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=>{!e.includes(l)&&!i.includes(l)&&this._userClasses.add(l)});const r=[...new Set([...s,...Array.from(this._userClasses)])];this.className=r.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)"},o=a[t]||a.regular;this.style.setProperty("font-size",o)}}customElements.get("mint-text")||customElements.define("mint-text",K);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(t,e,i){e!==i&&(this.render(),t==="text-align"&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{const t=this.getTextAlign();t&&this._applyTextAlignToChildren(t)}),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 t=this.getAttribute("gap")||"3";return parseFloat(t)}getTextAlign(){const t=this.getAttribute("text-align")||"";return["left","center","right","justify"].includes(t)?t:""}getStackClasses(){const t=this.getDirection(),e=this.getTextAlign(),i=this.getGap(),s=["flex",t==="horizontal"?"flex-row":"flex-col",`gap-${i}`];return e&&(s.push(`text-${e}`),s.push(`[&>*]:text-${e}`),s.push(`[&>*_.mint-button-content]:text-${e}`),e==="left"?(s.push("[&>mint-button]:!justify-start"),s.push("[&>mint-button>button]:!justify-start")):e==="right"?(s.push("[&>mint-button]:!justify-end"),s.push("[&>mint-button>button]:!justify-end")):e==="center"&&(s.push("[&>mint-button]:!justify-center"),s.push("[&>mint-button>button]:!justify-center"))),s.join(" ")}render(){const t=this.getStackClasses(),e=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(n=>this.classList.remove(n)),t.split(" ").forEach(n=>{n&&this.classList.add(n)}),["box-border","m-0","p-0","border-0","align-baseline","block"].forEach(n=>{this.classList.contains(n)||this.classList.add(n)}),e?this._applyTextAlignToChildren(e):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(t){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"),t==="left"?s.classList.add("justify-start"):t==="right"?s.classList.add("justify-end"):t==="center"&&s.classList.add("justify-center");const n=s.querySelector(".mint-button-content");n&&(n.classList.remove("text-left","text-center","text-right","text-justify"),n.classList.add(`text-${t}`))}}else i.classList.remove("text-left","text-center","text-right","text-justify"),i.classList.add(`text-${t}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(e=>{if(e.tagName==="MINT-BUTTON"){const i=e.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 e.classList.remove("text-left","text-center","text-right","text-justify")})}}customElements.get("mint-stack")||customElements.define("mint-stack",Z);class Q extends HTMLElement{constructor(){super(),this._headingElement=null}static get observedAttributes(){return["heading"]}connectedCallback(){this.classList.add("box-border","m-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(t,e,i){e!==i&&this.render()}getHeading(){return this.getAttribute("heading")||""}hasPaddingClass(){return Array.from(this.classList).some(e=>/^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e))}render(){this.classList.add("rounded-lg","shadow","bg-white","dark:bg-gray-800","border","border-gray-200","dark:border-gray-700","overflow-hidden","transition-colors","duration-200","mb-6"),this.hasPaddingClass()||this.classList.add("p-4");const t=this.getHeading();t?(this._headingElement||(this._headingElement=document.createElement("mint-text"),this._headingElement.setAttribute("size","sub-heading"),this.insertBefore(this._headingElement,this.firstChild)),this._headingElement.textContent=t):this._headingElement&&this._headingElement.parentNode&&(this._headingElement.remove(),this._headingElement=null)}}customElements.get("mint-card")||customElements.define("mint-card",Q);class tt 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(e=>{e.classList.contains("underline")||e.classList.add("underline")})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(t,e,i){e!==i&&this.render()}getHref(){return this.getAttribute("href")||"#"}getTarget(){return this.getAttribute("target")||""}hasIcon(){var t;return!!(this.querySelector("mint-icon")||(t=this._link)!=null&&t.querySelector("mint-icon"))}render(){const t=this.getHref(),e=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=t,e?(this._link.target=e,e==="_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",tt);class et extends HTMLElement{constructor(){super(),this._button=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()}disconnectedCallback(){}attributeChangedCallback(t,e,i){e!==i&&this.render()}getFallbackHref(){return this.getAttribute("fallback-href")||this.getAttribute("href")||"/"}_getTargetUrl(){const t=document.referrer,e=window.location.origin;if(t)try{const i=new URL(t);if(i.origin===e)return i.pathname+i.search}catch{}return this.getFallbackHref()}handleClick(t){t.preventDefault(),t.stopPropagation();const e=this._getTargetUrl(),i=document.referrer,s=i&&(()=>{try{return new URL(i).origin===window.location.origin}catch{return!1}})(),n=new CustomEvent("back",{detail:{url:e,isFromReferrer:s,referrer:i||null,fallbackHref:this.getFallbackHref()},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n)}render(){this._button||(this._button=document.createElement("mint-button"),this._button.setAttribute("variant","neutral"),this._button.setAttribute("icon","arrow-left"),this._button.addEventListener("click",t=>this.handleClick(t)),this.appendChild(this._button))}}customElements.get("mint-back-button")||customElements.define("mint-back-button",et);class it 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,this._backButton=null,this._backButtonHandler=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(),this._setupBackButtonListener()}attributeChangedCallback(t,e,i){e!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null),this._removeBackButtonListener()}getHeading(){return this.getAttribute("heading")||""}getFallbackHref(){return this.getAttribute("fallback-href")||"/"}shouldShowBackButton(){return this.hasAttribute("show-back-button")}render(){const t=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 e=this._titleElement.querySelector("mint-back-button");if(this.shouldShowBackButton()){e||(e=document.createElement("mint-back-button"),this._titleElement.insertBefore(e,this._titleElement.firstChild));const r=this.getFallbackHref();e.setAttribute("fallback-href",r),this._backButton=e}else e&&(e.remove(),e=null,this._backButton=null);t?(this._headingText?(this._headingText.classList.add("truncate","min-w-0"),e&&e.parentElement===this._titleElement?this._headingText.previousSibling!==e&&this._titleElement.insertBefore(this._headingText,e.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"),e&&e.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,e.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=t):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(r=>r!==this._pageContainer&&r!==this._actionsSlot&&r.getAttribute("slot")==="actions").forEach(r=>{this._actionsSlot&&r.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(r)}),this._bodySlot||(this._bodySlot=document.createElement("div"),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(r=>{r!==this._pageContainer&&r.getAttribute("slot")!=="actions"&&r!==this._actionsSlot&&r!==this._header&&r!==this._bodySlot&&r!==this._headingText&&r.parentElement!==this._bodySlot&&r.parentElement!==this._pageContainer&&this._bodySlot.appendChild(r)}),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"]}))}_setupBackButtonListener(){this._backButtonHandler||(this._backButtonHandler=t=>{const e=t.target;if(e&&e.tagName==="MINT-BACK-BUTTON"){t.stopPropagation();const i=new CustomEvent("back",{detail:t.detail,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)}}),this.addEventListener("back",this._backButtonHandler,!0)}_removeBackButtonListener(){this._backButtonHandler&&(this.removeEventListener("back",this._backButtonHandler,!0),this._backButtonHandler=null)}}customElements.get("mint-page")||customElements.define("mint-page",it);class st 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(t,e,i){e!==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 t=["grid"],e=this.getColumns();t.push(`grid-cols-${e}`);const i=this.getSm();i&&t.push(`sm:grid-cols-${i}`);const s=this.getMd();s&&t.push(`md:grid-cols-${s}`);const n=this.getLg();n&&t.push(`lg:grid-cols-${n}`);const r=this.getXl();r&&t.push(`xl:grid-cols-${r}`);const a=this.getGap();return t.push(`gap-${a}`),t}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",st);class rt 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(t,e,i){e!==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 t=this.getId(),e=this.getHeading(),i=this.isOpen();if(t&&(this.id=t),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 n=this._headingSlot.querySelector("mint-text");e?(n||(n=document.createElement("mint-text"),n.setAttribute("size","sub-heading"),n.setAttribute("bold",""),this._headingSlot.appendChild(n)),n.textContent=e):n&&n.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 o=this._actionsSlot.querySelector("mint-stack");o||(o=document.createElement("mint-stack"),o.setAttribute("direction","horizontal"),o.className="justify-end",this._actionsSlot.appendChild(o)),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(h=>{h.parentElement!==o&&o.appendChild(h)}),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 t=document.documentElement.classList.contains("dark"),e=this._modal.querySelector(".modal-content");e&&(t?(e.classList.remove("bg-white"),e.classList.add("bg-gray-800")):(e.classList.remove("bg-gray-800"),e.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_animateEnter(){var e;const t=(e=this._modal)==null?void 0:e.querySelector(".modal-content");t&&(t.style.transform="scale(0.97) translateY(10px)",t.style.opacity="0",t.style.transition="all 200ms ease-out",this.classList.remove("hidden"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transform="scale(1) translateY(0)",t.style.opacity="1"})}))}_animateExit(){var e;const t=(e=this._modal)==null?void 0:e.querySelector(".modal-content");if(!t){this.classList.add("hidden");return}t.style.transition="all 200ms ease-in",t.style.transform="scale(0.97) translateY(10px)",t.style.opacity="0",setTimeout(()=>{this.classList.add("hidden"),t.style.transform="",t.style.opacity="",t.style.transition=""},200)}}customElements.get("mint-modal")||customElements.define("mint-modal",rt);class nt 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(){const t=this._isInsideModal()?"z-[60]":"z-50";this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","top-0","left-0",t,"pointer-events-none"),this.isOpen()||this.classList.add("hidden"),this.render(),this._setupTrigger(),this._observeDarkMode()}_isInsideModal(){let t=this;for(;t;){if(t.tagName==="MINT-MODAL")return!0;t=t.parentElement}if(this._triggerElement)for(t=this._triggerElement;t;){if(t.tagName==="MINT-MODAL")return!0;t=t.parentElement}return!1}disconnectedCallback(){this._triggerElement&&this._triggerElement.tagName==="MINT-BUTTON"&&this._triggerElement.removeAttribute("active"),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(t,e,i){if(e!==i){if(this.isConnected){const s=this._isInsideModal()?"z-[60]":"z-50";this.classList.remove("z-50","z-[60]"),this.classList.add(s)}this.render(),(t==="trigger-id"||t==="hover")&&this._setupTrigger(),t==="open"&&this.isOpen()&&this._closeOtherPopovers()}}getId(){return this.getAttribute("id")||""}getPadding(){const t=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"}[t]||"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 t=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),t&&(this._triggerElement=document.getElementById(t),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(t),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){const t=this;this._triggerClickHandler=function(e){e.stopImmediatePropagation(),e.preventDefault(),t.hasAttribute("open")?t.removeAttribute("open"):t.setAttribute("open","")},this._triggerElement.addEventListener("click",this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();const t=this;this._triggerHoverEnterHandler=function(){t._cancelHoverClose(),t.open()},this._triggerHoverLeaveHandler=function(e){var s;const i=e.relatedTarget;i&&(t.contains(i)||(s=t._triggerElement)!=null&&s.contains(i))||t._scheduleHoverClose()},this._triggerElement.addEventListener("mouseenter",this._triggerHoverEnterHandler),this._triggerElement.addEventListener("mouseleave",this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){t._cancelHoverClose()},this._popoverHoverLeaveHandler=function(e){var s;const i=e.relatedTarget;i&&(t.contains(i)||(s=t._triggerElement)!=null&&s.contains(i))||t._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 t=this._triggerElement?this._triggerElement.matches(":hover"):!1,e=this._popover?this._popover.matches(":hover"):!1;return t||e}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:"down"};const t=this._triggerElement.getBoundingClientRect(),e=this._popover.querySelector(".popover-content");if(!e)return{top:0,left:0,direction:"down"};this.classList.contains("hidden")&&(this.classList.remove("hidden"),this._popover.style.visibility="hidden");const s=e.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight,a=8;let o=this.getDirection(),l=0,c=0;switch(o){case"down":if(l=t.bottom+a,c=t.left+t.width/2-s.width/2,l+s.height>r){const d=t.top-s.height-a;d>=0?(o="up",l=d):(l=Math.max(0,r-s.height-a),l+s.height>r&&(l=0))}c<0&&(c=a),c+s.width>n&&(c=Math.max(a,n-s.width-a),c+s.width>n&&(c=n-s.width));break;case"up":if(l=t.top-s.height-a,c=t.left+t.width/2-s.width/2,l<0){const d=t.bottom+a;d+s.height<=r?(o="down",l=d):(l=Math.min(r-s.height-a,r-s.height),l<0&&(l=r-s.height))}c<0&&(c=a),c+s.width>n&&(c=Math.max(a,n-s.width-a),c+s.width>n&&(c=n-s.width));break;case"right":if(l=t.top+t.height/2-s.height/2,c=t.right+a,c+s.width>n){const d=t.left-s.width-a;d>=0?(o="left",c=d):(c=Math.max(0,n-s.width-a),c+s.width>n&&(c=n-s.width))}l<0&&(l=a),l+s.height>r&&(l=Math.max(a,r-s.height-a),l+s.height>r&&(l=r-s.height));break;case"left":if(l=t.top+t.height/2-s.height/2,c=t.left-s.width-a,c<0){const d=t.right+a;d+s.width<=n?(o="right",c=d):(c=Math.min(n-s.width-a,n-s.width),c<0&&(c=0))}l<0&&(l=a),l+s.height>r&&(l=Math.max(a,r-s.height-a),l+s.height>r&&(l=r-s.height));break}return{top:l,left:c,direction:o}}render(){const t=this.getId(),e=this.isOpen(),i=this.getPadding();if(t&&(this.id=t),e){if(this.classList.remove("hidden"),this.style.pointerEvents="auto",this._triggerElement&&this._triggerElement.tagName==="MINT-BUTTON"&&requestAnimationFrame(()=>{this._triggerElement.setAttribute("active","true");const r=this._triggerElement;typeof r.render=="function"&&requestAnimationFrame(()=>{r.render()})}),!this._clickOutsideHandler){const r=this;this._clickOutsideHandler=function(a){const o=a.composedPath(),l=o.includes(r);if(!(r._triggerElement&&o.includes(r._triggerElement))&&!l){r.close();return}},setTimeout(()=>{document.addEventListener("click",this._clickOutsideHandler,!1)},100)}}else this.classList.add("hidden"),this.style.pointerEvents="none",this._triggerElement&&this._triggerElement.tagName==="MINT-BUTTON"&&requestAnimationFrame(()=>{this._triggerElement.removeAttribute("active");const r=this._triggerElement;typeof r.render=="function"&&requestAnimationFrame(()=>{r.render()})}),this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler,!1),this._clickOutsideHandler=null);if(this._overlay){const r=this._isInsideModal()?"z-[55]":"z-40";this._overlay.className=`fixed inset-0 pointer-events-none ${r}`}else{this._overlay=document.createElement("div");const r=this._isInsideModal()?"z-[55]":"z-40";this._overlay.className=`fixed inset-0 pointer-events-none ${r}`,this.appendChild(this._overlay)}if(this._popover){const r=this._isInsideModal()?"z-[60]":"z-50";this._popover.className=`fixed ${r} pointer-events-auto`}else{this._popover=document.createElement("div");const r=this._isInsideModal()?"z-[60]":"z-50";this._popover.className=`fixed ${r} 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 r=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"],o=r.filter(l=>!a.includes(l));s.className=[...o,i].join(" ")}Array.from(this.children).forEach(r=>{r!==this._overlay&&r!==this._popover&&r.parentElement===this&&s.appendChild(r)}),e?(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"})}))):!e&&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 t=document.documentElement.classList.contains("dark"),e=this._popover.querySelector(".popover-content");e&&(t?(e.classList.remove("bg-white"),e.classList.add("bg-gray-800")):(e.classList.remove("bg-gray-800"),e.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_updatePosition(t){if(!this._triggerElement||!this._popover)return;const e=this._popover.style.visibility!=="hidden";e||(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`,e||(this._popover.style.visibility="visible",t&&(!t.style.opacity||t.style.opacity==="")&&(t.style.transform="scale(0.97) translateY(10px)",t.style.opacity="0",t.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transform="scale(1) translateY(0)",t.style.opacity="1"})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){const t=this;this._scrollHandler=function(){if(t.isOpen()&&t._popover){const e=t._popover.querySelector(".popover-content");e&&t._updatePosition(e)}},window.addEventListener("scroll",this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){const t=this;this._resizeHandler=function(){if(t.isOpen()&&t._popover){const e=t._popover.querySelector(".popover-content");e&&t._updatePosition(e)}},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(e=>{if(e!==this){const i=e;typeof i.close=="function"?i.close():e.removeAttribute("open")}})}}customElements.get("mint-popover")||customElements.define("mint-popover",nt);class at 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","error","error-message","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const t=this.getAttribute("checked");this._checked=t!==null&&t!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(t==="checked"&&(this._checked=i!==null&&i!=="false",this._checkbox&&(this._checkbox.checked=this._checked)),e!==i){if(t==="error"||t==="error-message"){this._renderErrorState();return}if(t==="loading"){this.render();return}this.render(),t==="checked"&&this._checkbox&&this.updateVisualState()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(t){try{t?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!t,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}catch{}}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")||""}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getCheckboxClasses(){const t=this.hasError(),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",t?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],i=this._checked?["bg-slate-800","dark:bg-slate-600",t?"border-red-300 dark:border-red-300":"border-slate-800 dark:border-slate-600"]:["bg-white","dark:bg-gray-700",t?"border-red-300 dark:border-red-300":"border-gray-300 dark:border-gray-500"];return[...e,...i].join(" ")}render(){const t=this.isLoading(),e=this.getLabel(),i=this.getInfo(),s=this.isDisabled();let n=this.querySelector(".mint-checkbox-container");n||(n=document.createElement("div"),n.className="mint-checkbox-container relative inline-flex items-start gap-2",this.insertBefore(n,this.firstChild));let r=this.querySelector(".mint-checkbox-wrapper");r?r.parentElement!==n&&n.appendChild(r):(r=document.createElement("div"),r.className="mint-checkbox-wrapper",n.appendChild(r)),this._checkbox?this._checkbox.parentElement!==r&&r.appendChild(this._checkbox):(this._checkbox=document.createElement("input"),this._checkbox.type="checkbox",r.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=s,this._changeHandler||this.setupEventListeners();const a=this.getId();a?this._checkbox.id=a:this._checkbox.removeAttribute("id");const o=this.getName();o?this._checkbox.name=o:this._checkbox.removeAttribute("name");const l=this.getValue();l?this._checkbox.value=l:this._checkbox.removeAttribute("value"),e?this._checkbox.setAttribute("aria-label",e):this._checkbox.removeAttribute("aria-label"),r.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,r.style.cursor="pointer",r.style.pointerEvents="auto",this._checkbox.style.pointerEvents="auto";const c=r;c._wrapperClickHandler||(c._wrapperClickHandler=u=>{u.target===r&&!s&&(u.preventDefault(),u.stopPropagation(),this.toggle())},r.addEventListener("click",c._wrapperClickHandler));let d=r.querySelector("mint-icon");d||(d=document.createElement("mint-icon"),d.setAttribute("name","check"),d.className="w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto",d.style.transition="opacity 200ms ease-out, transform 200ms ease-out",d.style.zIndex="1",r.appendChild(d)),this.updateVisualState();let p=this.querySelector(".mint-checkbox-label-container");const h=this.querySelector(".mint-checkbox-container");if(e||i){p?h&&p.parentElement!==h&&h.appendChild(p):(p=document.createElement("div"),p.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",h?h.appendChild(p):this.appendChild(p));let u=p.querySelector(".mint-checkbox-label");e?(u||(u=document.createElement("span"),u.className="mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",p.insertBefore(u,p.firstChild)),u.textContent=e,s?u.classList.add("opacity-40"):u.classList.remove("opacity-40")):u&&u.remove();let _=p.querySelector(".mint-checkbox-info");if(i?(_||(_=document.createElement("span"),_.className="mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",p.appendChild(_)),_.textContent=i,s?_.classList.add("opacity-40"):_.classList.remove("opacity-40")):_&&_.remove(),s)p.style.cursor="default",p._clickHandler&&(p.removeEventListener("click",p._clickHandler),p._clickHandler=null);else{p.style.cursor="pointer";const f=p._clickHandler;f&&p.removeEventListener("click",f),p._clickHandler=m=>{this._checkbox&&(m.target===this._checkbox||this._checkbox.contains(m.target)||m.composedPath().includes(this._checkbox))||this.toggle()},p.addEventListener("click",p._clickHandler)}}else p&&p.remove();this._renderErrorState(),this._renderSkeleton(t)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=t=>{t.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const e=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent("input",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0}));const i=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(i)},this._checkbox.addEventListener("change",this._changeHandler),this._mousedownHandler=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&!this.isDisabled()&&(e.classList.add("mint-checkbox-active"),this._checked?(e.style.backgroundColor="rgb(15 23 42)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(e.style.backgroundColor="rgb(243 244 246)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?e.style.backgroundColor="rgb(51 65 85)":e.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&(e.classList.remove("mint-checkbox-active"),e.style.backgroundColor="",e.style.boxShadow="")},this._mouseleaveHandler=t=>{const e=this.querySelector(".mint-checkbox-wrapper");e&&(e.classList.remove("mint-checkbox-active"),e.style.backgroundColor="",e.style.boxShadow="")},this._checkbox.addEventListener("mousedown",this._mousedownHandler),this._checkbox.addEventListener("mouseup",this._mouseupHandler),this._checkbox.addEventListener("mouseleave",this._mouseleaveHandler),this._focusHandler=t=>{const e=this.querySelector(".mint-checkbox-wrapper");e&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(":focus-visible")&&(e==null||e.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&t.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=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&!this.isDisabled()&&(e.classList.add("mint-checkbox-active"),this._checked?(e.style.backgroundColor="rgb(15 23 42)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(e.style.backgroundColor="rgb(243 244 246)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?e.style.backgroundColor="rgb(51 65 85)":e.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&(e.classList.remove("mint-checkbox-active"),e.style.backgroundColor="",e.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));const t=this.querySelector(".mint-checkbox-wrapper");if(t){const e=t;e._wrapperClickHandler&&(t.removeEventListener("click",e._wrapperClickHandler),e._wrapperClickHandler=null)}}updateVisualState(){const t=this.querySelector(".mint-checkbox-wrapper"),e=t==null?void 0:t.querySelector("mint-icon");e&&(e.style.opacity=this._checked?"1":"0",e.style.transform=this._checked?"scale(1)":"scale(0.8)"),t&&(t.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,t.classList.contains("mint-checkbox-active")||(t.style.backgroundColor="",t.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(),this.dispatchEvent(new CustomEvent("input",{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0}));const t=new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}_renderSkeleton(t){let e=this.querySelector(".mint-checkbox-skeleton-container");const i=this.querySelector(".mint-checkbox-container"),s=this.querySelector(".mint-checkbox-wrapper"),n=this.querySelector(".mint-checkbox-label-container");if(t){e||(e=document.createElement("div"),e.className="mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2",i?i.appendChild(e):(this.style.position="relative",this.appendChild(e)));let r=e.querySelector(".mint-checkbox-skeleton-box");if(r||(r=document.createElement("div"),r.className="mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",e.appendChild(r)),n){let a=e.querySelector(".mint-checkbox-skeleton-label");a||(a=document.createElement("div"),a.className="mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",e.appendChild(a))}e.style.display="flex",s&&(s.style.visibility="hidden",s.style.pointerEvents="none"),n&&(n.style.visibility="hidden",n.style.pointerEvents="none")}else e&&(e.style.display="none"),s&&(s.style.visibility="visible",s.style.pointerEvents="auto"),n&&(n.style.visibility="visible",n.style.pointerEvents="auto")}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-checkbox-label-container");!i&&t&&e&&(i=document.createElement("div"),i.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",this.appendChild(i));let s=this.querySelector(".mint-checkbox-error");t&&e?(s?(s.classList.add("block","w-full"),s.style.display="block",(i&&s.parentElement!==i||i&&s.parentElement===i)&&i.appendChild(s)):(s=document.createElement("div"),s.className="mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full",s.style.display="block",i?i.appendChild(s):this.appendChild(s)),s.textContent=e):s&&s.remove();const n=this.querySelector(".mint-checkbox-wrapper");n&&(n.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`)}}customElements.get("mint-checkbox")||customElements.define("mint-checkbox",at);class wt extends HTMLElement{constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._clickHandler=null,this._focusHandler=null,this._blurHandler=null,this._keydownHandler=null}static get observedAttributes(){return["value","checked","disabled","loading","info"]}connectedCallback(){this.classList.add("inline-flex","items-start","gap-2","cursor-pointer","select-none");const t=this.getAttribute("checked");this._checked=t!==null&&t!=="false",this.render(),this._setupClickHandler()}disconnectedCallback(){this._clickHandler&&(this.removeEventListener("click",this._clickHandler),this._clickHandler=null),this._radio&&(this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._focusHandler&&(this._radio.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._radio.removeEventListener("blur",this._blurHandler),this._blurHandler=null),this._keydownHandler&&(this._radio.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null))}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(t==="checked"&&(this._checked=i!==null&&i!=="false",this._radio&&(this._radio.checked=this._checked),this._updateVisualState()),e!==i){if(t==="loading"){this.render();return}if(t==="info"){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(t){try{this._checked=!!t,t?this.setAttribute("checked",""):this.removeAttribute("checked"),this._radio&&(this._radio.checked=this._checked),this.isConnected?requestAnimationFrame(()=>{this._updateVisualState()}):this._updateVisualState()}catch{}}getValue(){return this.getAttribute("value")||""}getInfo(){return this.getAttribute("info")||""}isDisabled(){const t=this.closest("mint-choice");return this.hasAttribute("disabled")||((t==null?void 0:t.hasAttribute("disabled"))??!1)}_setupClickHandler(){this._clickHandler||(this._clickHandler=t=>{t.target!==this._radio&&(this.isDisabled()||this._radio&&(this._radio.click(),requestAnimationFrame(()=>{if(this._radio&&this._radio.checked!==this._checked){this._checked=this._radio.checked,this._checked?this.setAttribute("checked",""):this.removeAttribute("checked"),this._updateVisualState(),this._updateGroupState();const e=this.closest("mint-choice");e&&e.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))}})))},this.addEventListener("click",this._clickHandler))}render(){var _;const t=this.isLoading(),e=this.isDisabled(),i=this.getValue(),s=this.closest("mint-choice"),n=(s==null?void 0:s.getAttribute("name"))||"";let r="";const a=this.querySelector(".mint-choice-option-label");if(a)r=((_=a.textContent)==null?void 0:_.trim())||"";else{const f=this.querySelector(".mint-choice-option-label-container");Array.from(this.childNodes).forEach(m=>{var g;if(m!==f&&m.nodeType===Node.TEXT_NODE){const b=(g=m.textContent)==null?void 0:g.trim();b&&(r+=b)}})}const o=this.querySelectorAll(".mint-choice-option-wrapper");let l=null;if(o.length>0&&(this._radio&&(l=Array.from(o).find(f=>f.contains(this._radio))),l||(l=o[0]),o.forEach((f,m)=>{f!==l&&f.remove()})),l||(l=document.createElement("div"),l.className="mint-choice-option-wrapper",l.style.position="relative",this.insertBefore(l,this.firstChild)),l.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`,l.style.position="relative",this.querySelectorAll('input[type="radio"]').forEach(f=>{f!==this._radio&&f.remove()}),this._radio)this._radio.parentElement!==l&&l.appendChild(this._radio),this._radio&&this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._radio.addEventListener("change",this._changeHandler)),this._radio&&(this._focusHandler||(this._focusHandler=f=>{const m=this.querySelector(".mint-choice-option-wrapper");m&&!this.isDisabled()&&m.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")}),this._blurHandler||(this._blurHandler=()=>{const f=this.querySelector(".mint-choice-option-wrapper");f&&f.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")}),this._keydownHandler||(this._keydownHandler=f=>{this.isDisabled()||(f.key==="ArrowDown"||f.key==="ArrowRight"?(f.preventDefault(),this._focusNextOption()):(f.key==="ArrowUp"||f.key==="ArrowLeft")&&(f.preventDefault(),this._focusPreviousOption()))}),this._radio.removeEventListener("focus",this._focusHandler),this._radio.removeEventListener("blur",this._blurHandler),this._radio.removeEventListener("keydown",this._keydownHandler),this._radio.addEventListener("focus",this._focusHandler),this._radio.addEventListener("blur",this._blurHandler),this._radio.addEventListener("keydown",this._keydownHandler));else{this._radio=document.createElement("input"),this._radio.type="radio",this._radio.className="sr-only",this._radio.style.position="absolute",this._radio.style.width="1px",this._radio.style.height="1px",this._radio.style.padding="0",this._radio.style.margin="-1px",this._radio.style.overflow="hidden",this._radio.style.clip="rect(0, 0, 0, 0)",this._radio.style.whiteSpace="nowrap",this._radio.style.border="0",l.appendChild(this._radio),this._changeHandler=m=>{const g=this._checked;this._checked=this._radio.checked,this._checked?this.setAttribute("checked",""):this.removeAttribute("checked"),this._updateVisualState(),this._updateGroupState();const b=this.closest("mint-choice");g!==this._checked&&b&&setTimeout(()=>{b.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))},0)},this._radio.addEventListener("change",this._changeHandler);const f=()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.setAttribute("checked",""):this.removeAttribute("checked"),this._updateVisualState(),this._updateGroupState())};this._radio.addEventListener("click",f),this._focusHandler=m=>{const g=this.querySelector(".mint-choice-option-wrapper");g&&!this.isDisabled()&&g.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("focus",this._focusHandler),this._blurHandler=()=>{const m=this.querySelector(".mint-choice-option-wrapper");m&&m.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("blur",this._blurHandler),this._keydownHandler=m=>{this.isDisabled()||(m.key==="ArrowDown"||m.key==="ArrowRight"?(m.preventDefault(),this._focusNextOption()):(m.key==="ArrowUp"||m.key==="ArrowLeft")&&(m.preventDefault(),this._focusPreviousOption()))},this._radio.addEventListener("keydown",this._keydownHandler)}this._radio.name=n,this._radio.value=i,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._radio.checked=this._checked,this._radio.disabled=e,e?this._radio.setAttribute("tabindex","-1"):this._radio.removeAttribute("tabindex"),r?this._radio.setAttribute("aria-label",r):this._radio.removeAttribute("aria-label"),l.querySelectorAll(".mint-choice-option-indicator").forEach((f,m)=>{m>0&&f.remove()});let p=l.querySelector(".mint-choice-option-indicator");p||(p=document.createElement("div"),p.className="mint-choice-option-indicator",l.appendChild(p)),p.className="mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none",p.style.position="absolute",p.style.top="50%",p.style.left="50%",p.style.transform=this._checked?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0)",p.style.opacity=this._checked?"1":"0",this._updateVisualState(),this._renderSkeleton(t);const h=this.getInfo();let u=this.querySelector(".mint-choice-option-label-container");if(r||h){u||(u=document.createElement("div"),u.className="mint-choice-option-label-container flex flex-col gap-0.5",this.appendChild(u),Array.from(this.childNodes).forEach(g=>{var b;g.nodeType===Node.TEXT_NODE&&((b=g.textContent)!=null&&b.trim())&&g!==u&&(g.textContent="")}));let f=u.querySelector(".mint-choice-option-label");r?(f||(f=document.createElement("span"),f.className="mint-choice-option-label",u.appendChild(f)),f.className=`mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${e?"opacity-40":""}`,f.textContent=r):f&&f.remove();let m=u.querySelector(".mint-choice-option-info");h?(m||(m=document.createElement("span"),m.className="mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none",u.appendChild(m)),m.textContent=h,e?m.classList.add("opacity-40"):m.classList.remove("opacity-40")):m&&m.remove()}else u&&u.remove();e?(this.classList.add("cursor-not-allowed"),this.classList.remove("cursor-pointer")):(this.classList.add("cursor-pointer"),this.classList.remove("cursor-not-allowed")),this._updateVisualState()}_getWrapperClasses(){const t=this.isDisabled(),e=["inline-flex","items-center","justify-center","w-[1rem]","h-[1rem]","rounded-full","border-2","transition-all","duration-200","flex-shrink-0","mt-0.5"];return t&&e.push("opacity-40","cursor-not-allowed"),this._checked?e.push("bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"):e.push("bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"),e.join(" ")}_updateVisualState(){const t=this.querySelector(".mint-choice-option-wrapper");t&&(t.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`);const e=this.querySelector(".mint-choice-option-indicator");e&&(e.style.opacity=this._checked?"1":"0",e.style.transform=this._checked?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0)")}_renderSkeleton(t){let e=this.querySelector(".mint-choice-option-skeleton-container");const i=this.querySelector(".mint-choice-option-wrapper");if(t){e||(e=document.createElement("div"),e.className="mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2",i?(i.classList.contains("relative")||i.classList.add("relative"),i.appendChild(e)):(this.style.position="relative",this.appendChild(e)));let s=e.querySelector(".mint-choice-option-skeleton-radio");if(s||(s=document.createElement("div"),s.className="mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse",e.appendChild(s)),e.style.display="flex",i){const n=i.querySelector('input[type="radio"]'),r=i.querySelector(".mint-choice-option-indicator");n&&(n.style.visibility="hidden"),r&&(r.style.visibility="hidden"),i.style.pointerEvents="none"}}else{if(e&&(e.style.display="none"),i){const n=i.querySelector('input[type="radio"]'),r=i.querySelector(".mint-choice-option-indicator");n&&(n.style.visibility="visible"),r&&(r.style.visibility="visible"),i.style.pointerEvents="auto"}const s=this.querySelector(".mint-choice-option-label");s&&!(i!=null&&i.contains(s))&&(s.style.visibility="visible",s.style.pointerEvents="auto")}}_updateGroupState(){var e;if(!((e=this._radio)!=null&&e.name))return;document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`).forEach(i=>{if(i===this._radio)return;const s=i.closest("mint-choice-option");s&&s!==this&&(s._checked=i.checked,i.checked?s.setAttribute("checked",""):s.removeAttribute("checked"),s._updateVisualState())})}_focusNextOption(){var s;if(!((s=this._radio)!=null&&s.name))return;const t=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(n=>!n.disabled),e=t.indexOf(this._radio);let i=null;if(e>=0&&e<t.length-1?i=t[e+1]:t.length>0&&(i=t[0]),i){const n=i.closest("mint-choice-option");if(i.checked=!0,n){const r=n._checked;if(n._checked=!0,n.setAttribute("checked",""),n._changeHandler){const o=new Event("change",{bubbles:!0});n._changeHandler.call(n,o)}else n._updateVisualState(),n._updateGroupState();const a=n.closest("mint-choice");a&&!r&&setTimeout(()=>{a.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:!0,value:n.getValue()},bubbles:!0,cancelable:!0}))},0)}i.focus(),i.dispatchEvent(new Event("change",{bubbles:!0}))}}_focusPreviousOption(){var s;if(!((s=this._radio)!=null&&s.name))return;const t=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(n=>!n.disabled),e=t.indexOf(this._radio);let i=null;if(e>0?i=t[e-1]:t.length>0&&(i=t[t.length-1]),i){const n=i.closest("mint-choice-option");if(i.checked=!0,n){const r=n._checked;if(n._checked=!0,n.setAttribute("checked",""),n._changeHandler){const o=new Event("change",{bubbles:!0});n._changeHandler.call(n,o)}else n._updateVisualState(),n._updateGroupState();const a=n.closest("mint-choice");a&&!r&&setTimeout(()=>{a.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:!0,value:n.getValue()},bubbles:!0,cancelable:!0}))},0)}i.focus(),i.dispatchEvent(new Event("change",{bubbles:!0}))}}}customElements.get("mint-choice-option")||customElements.define("mint-choice-option",wt);class ot extends HTMLElement{constructor(){super(),this._optionsContainer=null}static get observedAttributes(){return["label","name","info","error","error-message","id","disabled","required","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","block","w-full"),this.render(),this.addEventListener("choice-change",t=>{var r;const i=((r=t.detail)==null?void 0:r.value)||this.getValue();(this.getAttribute("value")||"")!==i&&(i?this.setAttribute("value",i):this.removeAttribute("value"));const n=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n),this.dispatchEvent(new CustomEvent("input",{detail:{value:i},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:i},bubbles:!0,cancelable:!0,composed:!0}))})}disconnectedCallback(){}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){e!==i&&(t==="error"||t==="error-message"?this._renderErrorState():t==="loading"?(this.render(),this.querySelectorAll("mint-choice-option").forEach(n=>{this.isLoading()?n.setAttribute("loading",""):n.removeAttribute("loading")})):(this.render(),t==="name"&&this.querySelectorAll("mint-choice-option").forEach(n=>{typeof n.render=="function"&&n.render()})))}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getName(){return this.getAttribute("name")||""}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getId(){return this.getAttribute("id")||""}isDisabled(){return this.hasAttribute("disabled")}isRequired(){return this.hasAttribute("required")}getValue(){const t=this.querySelector('input[type="radio"]:checked');return(t==null?void 0:t.value)||""}setValue(t){const e=this.querySelectorAll("mint-choice-option");e.forEach(i=>{if((i.getAttribute("value")||"")===t){const n=i;n.checked=!0;const r=i.querySelector('input[type="radio"]');r&&(r.checked=!0,r.dispatchEvent(new Event("change",{bubbles:!0})))}else{const n=i;n.checked=!1;const r=i.querySelector('input[type="radio"]');r&&(r.checked=!1)}}),requestAnimationFrame(()=>{e.forEach(i=>{typeof i._updateVisualState=="function"&&i._updateVisualState();const s=i.querySelector('input[type="radio"]');if(s){const n=i;s.checked!==n.checked&&(s.checked=n.checked)}})})}get value(){try{return this.getValue()||""}catch{return""}}set value(t){try{this.setValue(t||"")}catch{}}render(){const t=this.isLoading(),e=this.getLabel(),i=this.getInfo(),s=this.getId()||`mint-choice-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute("id",s);const n=this.isDisabled();let r=this.querySelector(".mint-choice-label-container");if(e||i){r||(r=document.createElement("div"),r.className="mint-choice-label-container flex flex-col gap-0.5 mb-2",this.insertBefore(r,this.firstChild));let l=r.querySelector(".mint-choice-label");e?(l||(l=document.createElement("label"),l.className="mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",r.insertBefore(l,r.firstChild)),l.textContent=e,l.setAttribute("for",s),n?l.classList.add("opacity-40"):l.classList.remove("opacity-40")):l&&l.remove();let c=r.querySelector(".mint-choice-info");i?(c||(c=document.createElement("span"),c.className="mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none",r.appendChild(c)),c.textContent=i,n?c.classList.add("opacity-40"):c.classList.remove("opacity-40")):c&&c.remove()}else r&&r.remove();let a=this.querySelector(".mint-choice-options-wrapper");if(!a){a=document.createElement("div"),a.className="mint-choice-options-wrapper relative";const l=this.querySelector(".mint-choice-label-container");l&&l.parentElement===this?this.insertBefore(a,l.nextSibling):this.insertBefore(a,this.firstChild)}this._optionsContainer?this._optionsContainer.parentElement!==a&&a.appendChild(this._optionsContainer):(this._optionsContainer=document.createElement("div"),this._optionsContainer.className="mint-choice-options-container flex flex-col gap-3",a.appendChild(this._optionsContainer)),Array.from(this.children).filter(l=>l.tagName==="MINT-CHOICE-OPTION"&&l.parentElement!==this._optionsContainer).forEach(l=>{this._optionsContainer.appendChild(l)}),this._renderErrorState(),this._renderSkeleton(t)}_renderSkeleton(t){let e=this.querySelector(".mint-choice-skeleton-container");const i=this.querySelector(".mint-choice-options-wrapper"),s=this.querySelector(".mint-choice-options-container");if(t){if(e||(e=document.createElement("div"),e.className="mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3",i?i.appendChild(e):(this.style.position="relative",this.appendChild(e))),e.querySelectorAll(".mint-choice-option-skeleton").length===0)for(let r=0;r<3;r++){const a=document.createElement("div");a.className="mint-choice-option-skeleton flex items-center gap-3";const o=document.createElement("div");o.className="flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse",a.appendChild(o);const l=document.createElement("div");l.className="h-4 w-20 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",a.appendChild(l),e.appendChild(a)}e.style.display="flex",s&&(s.style.opacity="0",s.style.pointerEvents="none")}else e&&(e.style.display="none"),s&&(s.style.opacity="1",s.style.pointerEvents="auto")}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-choice-error");t&&e?(i||(i=document.createElement("div"),i.className="mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=e):i&&i.remove()}}customElements.get("mint-choice")||customElements.define("mint-choice",ot);class lt 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","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(t,e,i){if(e!==i){if(t==="error"||t==="error-message"){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(t==="loading"){this.render();return}this.render()}}getType(){return this.getAttribute("type")||"text"}getRows(){const t=this.getAttribute("rows");return t?parseInt(t,10):3}_getNormalizedType(){const t=this.getType();return t==="datetime"?"datetime-local":t==="money"?"text":t==="textarea"?"textarea":t}_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 t,e,i;return this._isColor()?((t=this._colorPicker)==null?void 0:t.value)||((e=this._colorTextInput)==null?void 0:e.value)||this.getAttribute("value")||"#000000":((i=this._element)==null?void 0:i.value)||this.getAttribute("value")||""}set value(t){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=t||"#000000"),this._colorTextInput&&(this._colorTextInput.value=t||"#000000")):this._element&&(this._element.value=t),t?this.setAttribute("value",t):this.removeAttribute("value")}catch{}}get value(){try{return this.getValue()||""}catch{return""}}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 t=this._isTextarea(),e=!!this.getIcon(),i=this._isColor(),s=this._isNumber(),n=this.hasError(),r=["w-full",e||i?"pl-10":"px-3.5",e||i?"pr-3.5":s?"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",t?"transition-colors transition-opacity":"transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","readonly:cursor-default",t?"resize-y":"",s?"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none":""],a=["border-2",n?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],o=["focus-visible:ring-2","focus-visible:ring-offset-1",n?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"];return[...r,...a,...o].filter(Boolean).join(" ")}isLoading(){return this.hasAttribute("loading")}render(){var b,v,k,A;this.getType();const t=this._getNormalizedType(),e=this._isTextarea(),i=this._isMoney(),s=this._isColor(),n=this.getPlaceholder(),r=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),l=this.getId(),c=this.getName(),d=this.getAttribute("value")||(s?"#000000":""),p=this.getRows(),h=this.getIcon(),u=this.getLabel(),_=this.getInfo(),f=this.isLoading();if(this._renderSkeleton(f),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=y=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(":focus-visible")&&requestAnimationFrame(()=>{var x;this._colorPicker&&this._colorPicker.matches(":focus-visible")&&((x=this._colorPickerWrapper)==null||x.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 x;const y=((x=this._colorPicker)==null?void 0:x.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=y),this._colorTextInput&&(this._colorTextInput.value=y),this.setAttribute("value",y),this.dispatchEvent(new CustomEvent("input",{detail:{value:y},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener("change",()=>{var x;const y=((x=this._colorPicker)==null?void 0:x.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=y),this.setAttribute("value",y),this.dispatchEvent(new CustomEvent("change",{detail:{value:y},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement("input"),this._colorTextInput.type="text",this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=n||"#000000",this._colorTextInput.pattern="^#[0-9A-Fa-f]{6}$",this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener("input",()=>{var x;const y=((x=this._colorTextInput)==null?void 0:x.value)||"";/^#[0-9A-Fa-f]{6}$/.test(y)&&(this._colorPicker&&(this._colorPicker.value=y),this.setAttribute("value",y),this.dispatchEvent(new CustomEvent("input",{detail:{value:y},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener("blur",()=>{var x,T;const y=((x=this._colorTextInput)==null?void 0:x.value)||"";/^#[0-9A-Fa-f]{6}$/.test(y)?(this._colorPicker&&(this._colorPicker.value=y),this.setAttribute("value",y)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:((T=this._colorPicker)==null?void 0:T.value)||"#000000"},bubbles:!0,cancelable:!0}))}));const E=d||"#000000";if(this._colorPicker&&this._colorPicker.value!==E&&(this._colorPicker.value=E),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=E),this._colorTextInput&&this._colorTextInput.value!==E&&(this._colorTextInput.value=E),this._colorPicker&&(this._colorPicker.disabled=r),this._colorPickerWrapper&&(r?(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=r,this._colorTextInput.readOnly=a,this._colorTextInput.required=o),this._colorTextInput){const y=this._colorTextInput;l?y.id=l:y.removeAttribute("id"),c?y.name=c:y.removeAttribute("name"),y.setAttribute("aria-invalid",this.hasError()?"true":"false"),this._element=y}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),h&&!e?this._icon?this._icon.setAttribute("name",h):(this._icon=document.createElement("mint-icon"),this._icon.setAttribute("name",h),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()&&!e){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 E=document.createElement("mint-icon");E.setAttribute("name","caret-up"),E.className="w-[1rem] h-[1rem]",this._numberIncrementButton.appendChild(E),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement("button"),this._numberDecrementButton.type="button",this._numberDecrementButton.className="flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const y=document.createElement("mint-icon");y.setAttribute("name","caret-down"),y.className="w-[1rem] h-[1rem]",this._numberDecrementButton.appendChild(y),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener("click",x=>{if(x.preventDefault(),x.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const T=parseFloat(this._input.value)||0,R=parseFloat(this._input.step)||1,P=this._input.min?parseFloat(this._input.min):void 0,$=this._input.max?parseFloat(this._input.max):void 0;let H=T+R;$!==void 0&&H>$&&(H=$),P!==void 0&&H<P&&(H=P),this._input.value=H.toString(),this.setAttribute("value",H.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}}),this._numberDecrementButton.addEventListener("click",x=>{if(x.preventDefault(),x.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const T=parseFloat(this._input.value)||0,R=parseFloat(this._input.step)||1,P=this._input.min?parseFloat(this._input.min):void 0,$=this._input.max?parseFloat(this._input.max):void 0;let H=T-R;P!==void 0&&H<P&&(H=P),$!==void 0&&H>$&&(H=$),this._input.value=H.toString(),this.setAttribute("value",H.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=r||a),this._numberDecrementButton&&(this._numberDecrementButton.disabled=r||a)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(e){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=n,this._textarea.disabled=r,this._textarea.readOnly=a,this._textarea.required=o,this._textarea.rows=p,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"),c?this._textarea.name=c:this._textarea.removeAttribute("name"),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const E=this.firstChild.textContent;E&&!this._textarea.value&&(this._textarea.value=E.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=t,this._input.placeholder=n,this._input.disabled=r,this._input.readOnly=a,this._input.required=o,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"),c?this._input.name=c:this._input.removeAttribute("name"),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const E=this.firstChild.textContent;E&&!this._input.value&&(this._input.value=E.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(".mint-input-label-container");if(u||_){g||(g=document.createElement("div"),g.className="mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]",this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let E=g.querySelector(".mint-input-label");if(u){E||(E=document.createElement("label"),E.className="mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",g.insertBefore(E,g.firstChild)),E.textContent=u;const x=l||((b=this._element)==null?void 0:b.id)||((v=this._colorTextInput)==null?void 0:v.id)||((k=this._input)==null?void 0:k.id)||((A=this._textarea)==null?void 0:A.id);if(x)E.setAttribute("for",x);else{const T=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=T:this._colorTextInput?this._colorTextInput.id=T:this._input?this._input.id=T:this._textarea&&(this._textarea.id=T),E.setAttribute("for",T)}r?E.classList.add("opacity-40"):E.classList.remove("opacity-40")}else E&&E.remove();let y=g.querySelector(".mint-input-info");_?(y||(y=document.createElement("span"),y.className="mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none",g.appendChild(y)),y.textContent=_,r?y.classList.add("opacity-40"):y.classList.remove("opacity-40")):y&&y.remove()}else g&&g.remove();this._renderErrorState(),this._renderSkeleton(f)}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-input-error");t&&e?(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=e):i&&i.remove()}setupEventListeners(){this._element&&(this._element.addEventListener("input",()=>{var i;const t=((i=this._element)==null?void 0:i.value)||"";t?this.setAttribute("value",t):this.removeAttribute("value");const e=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent("input",{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener("blur",()=>{var e;const t=((e=this._element)==null?void 0:e.value)||"";t?this.setAttribute("value",t):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:{value:t},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 t;this._isColor()&&this._colorTextInput?this._colorTextInput.focus():(t=this._element)==null||t.focus()}blur(){var t;this._isColor()&&this._colorTextInput?this._colorTextInput.blur():(t=this._element)==null||t.blur()}_renderSkeleton(t){let e=this.querySelector(".mint-input-skeleton-container");const i=this._wrapper||this.querySelector(".relative.w-full");if(t){e||(e=document.createElement("div"),e.className="mint-input-skeleton-container absolute inset-0 z-10 pointer-events-none",i?(i.classList.contains("relative")||i.classList.add("relative"),i.appendChild(e)):(this.style.position="relative",this.appendChild(e)));let s=e.querySelector(".mint-input-skeleton");if(!s){s=document.createElement("div"),s.className="mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse";const n=this._isTextarea(),r=this.getRows();if(n){const a=r*24+12;s.style.height=`${a}px`}else s.style.height="2.2rem";e.appendChild(s)}e.style.display="block",this._element&&(this._element.style.opacity="0",this._element.style.pointerEvents="none"),this._colorTextInput&&(this._colorTextInput.style.opacity="0",this._colorTextInput.style.pointerEvents="none")}else e&&(e.style.display="none"),this._element&&(this._element.style.opacity="1",this._element.style.pointerEvents="auto"),this._colorTextInput&&(this._colorTextInput.style.opacity="1",this._colorTextInput.style.pointerEvents="auto")}}customElements.get("mint-input")||customElements.define("mint-input",lt);class ct 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","loading","selection-mode","week-start-day"]}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 t=this.closest("form");t&&t.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(e!==i){if(t==="error"||t==="error-message"){const s=this.hasError(),n=this.getErrorMessage();this._applyErrorVisuals(s,n,this.isDisabled());return}if(t==="loading"){this.render();return}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute("value")||""}setValue(t){t?(this.setAttribute("value",t),this._textInput&&(this._textInput.value=t),this._parseValue(t)):(this.removeAttribute("value"),this._textInput&&(this._textInput.value=""),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||""}catch{return""}}set value(t){try{this.setValue(t||"")}catch{}}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")||""}getSelectionMode(){const t=this.getAttribute("selection-mode");return t==="week"||t==="month"?t:"day"}getWeekStartDay(){var i;const t=(i=this.getAttribute("week-start-day"))==null?void 0:i.toLowerCase();return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[t||"sunday"]??0}getDisplayFormat(){return this.getAttribute("display-format")||"F j, Y"}getShortcuts(){const t=this.getAttribute("shortcuts");if(!t)return[];try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(i=>({label:i.label,action:this._createShortcutAction(i.action)}))}catch{const i=t.trim();if(i&&typeof window[i]=="function"){const s=window[i]();if(Array.isArray(s))return s.map(n=>({label:n.label,action:typeof n.action=="function"?n.action:this._createShortcutAction(n.action)}))}}return[]}_createShortcutAction(t){return typeof t=="function"?t:typeof t=="string"&&typeof window[t]=="function"?window[t]:()=>null}_getDefaultShortcuts(){const t=[{label:"Today",action:()=>new Date}];return this._isRange&&t.push({label:"This Week",action:()=>{const e=new Date,i=e.getDay(),s=new Date(e);s.setDate(e.getDate()-i),s.setHours(0,0,0,0);const n=new Date(s);return n.setDate(s.getDate()+6),n.setHours(23,59,59,999),{start:s,end:n}}},{label:"This Month",action:()=>{const e=new Date,i=new Date(e.getFullYear(),e.getMonth(),1),s=new Date(e.getFullYear(),e.getMonth()+1,0);return s.setHours(23,59,59,999),{start:i,end:s}}}),t}_getFormatTokens(t){const e=[];let i=0;const s=t.toLowerCase();for(;i<s.length;){const n=s[i];if(n==="d"||n==="m"||n==="y"){let r=1,a=i+1;for(;a<s.length&&s[a]===n;)r++,a++;e.push({type:"part",part:n,len:r}),i=a}else e.push({type:"sep",value:t[i]}),i++}return e}_createPartInput(t,e,i,s,n){const r=document.createElement("input");return r.type="text",r.inputMode="numeric",r.pattern="\\d*",r.maxLength=t,r.placeholder=e,r.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",r.disabled=i||s,r.readOnly=s,r.required=n,t===4?r.className+=" w-[40px]":t===2&&(r.className+=" w-[30px]"),r}_buildValueFromParts(t,e){let i=0;return e.map(s=>{var r;if(s.type==="sep")return s.value;const n=((r=t[i])==null?void 0:r.value)||"";return i++,n}).join("")}_applyDateToParts(t,e,i,s){if(!e.length)return;if(!t){e.forEach(o=>o.value="");return}const n=this._formatDate(t,s);let r=0,a=0;i.forEach(o=>{if(o.type==="sep")r+=o.value.length;else{const l=n.substr(r,o.len);e[a]&&(e[a].value=l),a++,r+=o.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;const t=this.getFormat(),e=this._getFormatTokens(t),i=this._buildValueFromParts(this._startPartInputs,e);if(this._isRange){const s=this._buildValueFromParts(this._endPartInputs,e);this._hiddenInput.value=s?`${i} - ${s}`:i}else this._hiddenInput.value=i}_focusNext(t,e){if(e+1<t.length){const i=t[e+1];i.focus(),i.setSelectionRange(0,i.value.length)}}_focusPrev(t,e){if(e-1>=0){const i=t[e-1];i.focus(),i.setSelectionRange(i.value.length,i.value.length)}}_attachPartInputHandlers(t,e,i){t.forEach((s,n)=>{const r=s.maxLength||2;s.addEventListener("input",()=>{s.value=s.value.replace(/\D/g,"").slice(0,r),s.value.length>=r&&this._focusNext(t,n),this._syncHiddenInput()}),s.addEventListener("keydown",a=>{a.key==="Backspace"&&s.selectionStart===0&&s.selectionEnd===0&&this._focusPrev(t,n),a.key==="ArrowLeft"&&s.selectionStart===0&&s.selectionEnd===0&&(this._focusPrev(t,n),a.preventDefault()),a.key==="ArrowRight"&&s.selectionStart===s.value.length&&s.selectionEnd===s.value.length&&(this._focusNext(t,n),a.preventDefault())}),s.addEventListener("blur",a=>{var c,d;this._syncHiddenInput();const o=a.relatedTarget;o&&(this.contains(o)||(c=this._popover)!=null&&c.contains(o)||this._calendarContainer&&this._calendarContainer.contains(o))||(this._handleBlur(((d=this._hiddenInput)==null?void 0:d.value)||""),this._exitInputMode(),setTimeout(()=>{if(this._hiddenInput){const p=new FocusEvent("blur",{bubbles:!0,cancelable:!0,relatedTarget:a.relatedTarget});this._hiddenInput.dispatchEvent(p)}},0))})})}_splitRangeInput(t,e){const i=t.split(/\s*-\s*/);return i.length>=2?[i[0],i.slice(1).join("-")]:[t]}_parseValue(t){const e=this.getFormat(),i=this._getFormatTokens(e),s=this.getSelectionMode();if(this._isRange||s==="week"||s==="month"){const[r,a]=this._splitRangeInput(t,e),o=r?this._parseDateString(r,e):null,l=a?this._parseDateString(a,e):null;if(o&&l){const[c,d]=o<=l?[o,l]:[l,o];this._selectedStartDate=c,this._selectedEndDate=d,this._currentMonth=c.getMonth(),this._currentYear=c.getFullYear()}else o&&(this._selectedStartDate=o,this._selectedEndDate=null,this._currentMonth=o.getMonth(),this._currentYear=o.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,i,e),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,i,e)}else{const r=this._parseDateString(t,e);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,i,e)):this._applyDateToParts(null,this._startPartInputs,i,e)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(t,e){const i=/[\/\-\.\s]+/;if(i.test(t)){const f=t.split(i).filter(g=>g.length>0),m=e.split(/[\/\-\.\s]+/).filter(g=>g.length>0);if(f.length===m.length){let g=0,b=0,v=0;for(let k=0;k<m.length;k++){const A=m[k].toLowerCase(),E=f[k];if(A.includes("d"))g=parseInt(E,10);else if(A.includes("m"))b=parseInt(E,10)-1;else if(A.includes("y")){let y=parseInt(E,10);const x=A.length,T=E.length;T===2&&x===4?y=Math.floor(new Date().getFullYear()/100)*100+y:T===2&&x===2&&(y=Math.floor(new Date().getFullYear()/100)*100+y),v=y}}if(g&&b>=0&&b<=11&&v){const k=new Date(v,b,g);if(!isNaN(k.getTime())&&k.getDate()===g&&k.getMonth()===b&&k.getFullYear()===v)return k}}}const n=t.replace(/[\/\-\.]/g,""),r=e.replace(/[\/\-\.]/g,"").toLowerCase();let a=r.indexOf("d"),o=r.indexOf("m"),l=r.indexOf("y");const c=[{char:"d",index:a},{char:"m",index:o},{char:"y",index:l}].sort((f,m)=>f.index-m.index);let d=0,p=0,h=0,u=0;r.length,n.length;for(const f of c)if(f.char==="d"){const m=r.lastIndexOf("d")-r.indexOf("d")+1,g=n.substr(u,m);if(g.length===0)return null;d=parseInt(g,10),u+=g.length}else if(f.char==="m"){const m=r.lastIndexOf("m")-r.indexOf("m")+1,g=n.substr(u,m);if(g.length===0)return null;p=parseInt(g,10)-1,u+=g.length}else if(f.char==="y"){const m=r.lastIndexOf("y")-r.indexOf("y")+1,g=n.substr(u),b=Math.min(m,g.length),v=g.substr(0,b);if(v.length===0)return null;let k=parseInt(v,10);b===2&&m===4?k=Math.floor(new Date().getFullYear()/100)*100+k:b===2&&m===2&&(k=Math.floor(new Date().getFullYear()/100)*100+k),h=k,u+=b}if(!d||p<0||p>11||!h)return null;const _=new Date(h,p,d);return isNaN(_.getTime())||_.getDate()!==d||_.getMonth()!==p||_.getFullYear()!==h?null:_}_formatDate(t,e){const i=t.getDate(),s=t.getMonth()+1,n=t.getFullYear(),r=e.toLowerCase();let a=e;return r.includes("dd")?a=a.replace(/dd/gi,String(i).padStart(2,"0")):r.includes("d")&&(a=a.replace(/d/gi,String(i))),r.includes("mm")?a=a.replace(/mm/gi,String(s).padStart(2,"0")):r.includes("m")&&(a=a.replace(/m/gi,String(s))),r.includes("yyyy")?a=a.replace(/yyyy/gi,String(n)):r.includes("yy")&&(a=a.replace(/yy/gi,String(n).substr(2))),a}_formatDatePhp(t,e){const i=t.getDate(),s=t.getMonth()+1,n=t.getFullYear(),r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o=["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"],c=(h,u=2)=>h.toString().padStart(u,"0"),d=h=>{const u=h%10,_=h%100;return u===1&&_!==11?"st":u===2&&_!==12?"nd":u===3&&_!==13?"rd":"th"};let p="";for(let h=0;h<e.length;h++){const u=e[h];if(u==="\\"&&h+1<e.length){p+=e[h+1],h++;continue}switch(u){case"Y":p+=n.toString();break;case"y":p+=n.toString().slice(-2);break;case"m":p+=c(s);break;case"n":p+=s.toString();break;case"M":p+=l[s-1];break;case"F":p+=o[s-1];break;case"d":p+=c(i);break;case"j":p+=i.toString();break;case"D":p+=a[t.getDay()];break;case"l":p+=r[t.getDay()];break;case"S":p+=d(i);break;default:p+=u;break}}return p}_validateDateString(t,e){const i=this._parseDateString(t,e);return i!==null&&!isNaN(i.getTime())}render(){const t=this.isLoading(),e=this.getLabel(),i=this.getInfo(),s=this.getValue(),n=this.isDisabled(),r=this.isReadonly(),a=this.isRequired(),o=this.getId(),l=this.getName(),c=this.getFormat(),d=this.hasError(),p=this.getErrorMessage(),h=this.getSelectionMode();this._isRange=this.isRange()||h==="week"||h==="month",this._input||(this._input=document.createElement("div"),this._input.className="relative w-full",this.appendChild(this._input));let u=this.querySelector(".mint-date-picker-label-container");if(e||i){u||(u=document.createElement("div"),u.className="mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]",this.contains(this._input)?this.insertBefore(u,this._input):this.appendChild(u));let v=u.querySelector(".mint-date-picker-label");e?(v||(v=document.createElement("label"),v.className="mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",u.insertBefore(v,u.firstChild)),v.textContent=e,o&&this._textInput&&v.setAttribute("for",o)):v&&v.remove();let k=u.querySelector(".mint-date-picker-info");i?(k||(k=document.createElement("span"),k.className="mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",u.appendChild(k)),k.textContent=i):k&&k.remove()}else u&&u.remove();this._hiddenInput||(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.value=s||"",this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),o&&(this._hiddenInput.id=o),l&&(this._hiddenInput.name=l),this._hiddenInput.value=s||"",this._hiddenInput.setAttribute("aria-invalid",d?"true":"false");let _=this._input.querySelector(".mint-date-fields");_||(_=document.createElement("div"),this._input.appendChild(_)),this._fieldsContainer=_,this._applyErrorVisuals(d,p,n),_.innerHTML="",this._displayEl=document.createElement("div");const f=r?"select-text":"select-none";this._displayEl.className=`flex-1 text-gray-900 dark:text-white ${r?"cursor-default":"cursor-text"} ${f} focus:outline-none`,this._displayEl.tabIndex=n||r?-1:0,this._displayEl.addEventListener("click",()=>{n||r||this._enterInputMode()}),this._displayEl.addEventListener("keydown",v=>{n||r||(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement("div"),this._inputsWrapperEl.className="flex items-center gap-1 w-full";const m=this._getFormatTokens(c);this._startPartInputs=[],this._endPartInputs=[];const g=v=>{const k=document.createDocumentFragment();return m.forEach(A=>{if(A.type==="sep"){const E=document.createElement("span");E.textContent=A.value,E.className="text-gray-400 dark:text-gray-500 select-none",k.appendChild(E)}else{const E=A.part==="d"?"dd":A.part==="m"?"mm":A.len===2?"yy":"yyyy",y=this._createPartInput(A.len,E,n,r,a);v==="start"?this._startPartInputs.push(y):this._endPartInputs.push(y),k.appendChild(y)}}),k};if(this._inputsWrapperEl.appendChild(g("start")),this._isRange){const v=document.createElement("span");v.textContent=" - ",v.className="text-gray-400 dark:text-gray-500 select-none",this._inputsWrapperEl.appendChild(v),this._inputsWrapperEl.appendChild(g("end"))}const b=document.createElement("div");if(b.className="flex flex-col w-full",this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none",b.appendChild(this._displayEl),b.appendChild(this._inputsWrapperEl),_.appendChild(b),_.addEventListener("click",()=>{this._isInputMode||n||r||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,m,_),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,m,_),this._parseValue(s),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=n||r,!n&&!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-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";const v=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=v;const k=document.createElement("mint-icon");k.setAttribute("name","calendar"),k.className="w-4 h-4 pointer-events-none",this._iconButton.appendChild(k),this._iconButton.addEventListener("click",()=>{n||r||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=n||r}this._renderErrorState(d,p),this._renderSkeleton(t)}_renderErrorState(t,e){let i=this.querySelector(".mint-date-picker-error");t&&e?(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=e):i&&i.remove()}_applyErrorVisuals(t,e,i){if(this._renderErrorState(t,e),this._fieldsContainer){const s=this._getFieldContainerClass(t,i);this._fieldsContainer.className=s}this._hiddenInput&&this._hiddenInput.setAttribute("aria-invalid",t?"true":"false")}_attachFormResetListener(){const t=this.closest("form");!t||this._resetHandler||(this._resetHandler=()=>{this.setValue(""),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,"",this.isDisabled())},t.addEventListener("reset",this._resetHandler))}_clearPartInputs(t){t.forEach(e=>{e.value=""})}_getFieldContainerClass(t,e){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",t?"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",t?"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(" ")+(e?" opacity-40 cursor-not-allowed":"")}_handleInputChange(t){}_cleanInputValue(t,e){return t}_handleBlur(t){const e=this.getFormat(),i=this.getSelectionMode(),s=this._isRange||i==="week"||i==="month";if(!t){this.setValue(""),this._updateDisplayText();return}if(s){const[n,r]=this._splitRangeInput(t,e),a=n?this._parseDateString(n,e):null,o=r?this._parseDateString(r,e):null;if(a&&o){const[l,c]=a<=o?[a,o]:[o,a],d=this._formatDate(l,e),p=this._formatDate(c,e),h=`${d} - ${p}`;this.setValue(h),this._applyDateToParts(l,this._startPartInputs,this._getFormatTokens(e),e),this._applyDateToParts(c,this._endPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=l,this._selectedEndDate=c,this._currentMonth=l.getMonth(),this._currentYear=l.getFullYear()}else if(a){const l=this._formatDate(a,e);this.setValue(l),this._applyDateToParts(a,this._startPartInputs,this._getFormatTokens(e),e),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(e),e),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(t,e)){const n=this._parseDateString(t,e);if(n){const r=this._formatDate(n,e);this.setValue(r),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(t=0){if(!this._iconButton){t<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(t+1)});return}const e=10,i=this._iconButton.id;i&&this._iconButton.isConnected?document.getElementById(i)?this._createPopover(i):t<e&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(t+1)}):t<e&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(t+1)})}_createPopover(t){if(!t)return;if(!document.getElementById(t)){setTimeout(()=>{this._createPopover(t)},50);return}if(!this._popover)this._popover=document.createElement("mint-popover"),this._popover.setAttribute("direction","down"),this._popover.setAttribute("padding","0"),this.closest("mint-modal")?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute("trigger-id",t),this._popoverObserver||(this._popoverObserver=new MutationObserver(s=>{s.forEach(n=>{var r;if(n.type==="attributes"&&n.attributeName==="open")if((r=this._popover)==null?void 0:r.hasAttribute("open"))requestAnimationFrame(()=>{this._buildCalendar();const o=this._popover;typeof o.render=="function"&&o.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{var o;(o=this._iconButton)==null||o.focus()}),this._viewMode="calendar",this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{const o=new Date;this._currentMonth=o.getMonth(),this._currentYear=o.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{var l;const o=new FocusEvent("blur",{bubbles:!0,cancelable:!0,relatedTarget:null});(l=this._hiddenInput)==null||l.dispatchEvent(o)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:["open"]})),requestAnimationFrame(()=>{this._buildCalendar()}))})});else{if(this._popover.getAttribute("trigger-id")!==t){this._popover.setAttribute("trigger-id",t);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 t=this._popover.querySelector(".popover-content");if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;const t=this._getDaysInMonth(this._currentMonth,this._currentYear),e=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),i=["January","February","March","April","May","June","July","August","September","October","November","December"],s=this.getWeekStartDay(),n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=[...n.slice(s),...n.slice(0,s)],a=this.getShortcuts(),o=a.length>0;this._calendarContainer.className=o?"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 l=document.createElement("div");l.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 d=document.createElement("div");d.className="flex items-center justify-between mb-4";const p=document.createElement("button");p.type="button",p.tabIndex=0,p.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",p.setAttribute("data-keep-popover-open","true");const h=document.createElement("mint-icon");h.setAttribute("name","caret-left"),h.className="w-4 h-4",p.appendChild(h),p.addEventListener("click",()=>{this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar()}),d.appendChild(p);const u=document.createElement("div");u.className="flex items-center gap-2";const _=document.createElement("button");_.type="button",_.tabIndex=0,_.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",_.setAttribute("data-keep-popover-open","true"),_.textContent=i[this._currentMonth],_.addEventListener("click",()=>{this._viewMode="month",this._buildCalendar()}),u.appendChild(_);const f=document.createElement("button");f.type="button",f.tabIndex=0,f.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",f.setAttribute("data-keep-popover-open","true"),f.textContent=String(this._currentYear),f.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),u.appendChild(f),d.appendChild(u);const m=document.createElement("button");m.type="button",m.tabIndex=0,m.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",m.setAttribute("data-keep-popover-open","true");const g=document.createElement("mint-icon");g.setAttribute("name","caret-right"),g.className="w-4 h-4",m.appendChild(g),m.addEventListener("click",()=>{this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar()}),d.appendChild(m);const b=document.createElement("div");b.className="grid grid-cols-7 mb-2",r.forEach(C=>{const I=document.createElement("div");I.className="text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1",I.textContent=C,b.appendChild(I)});const v=document.createElement("div");v.className="grid grid-cols-7";const k=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,A=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null,E=this._currentMonth===0?11:this._currentMonth-1,y=this._currentMonth===0?this._currentYear-1:this._currentYear,x=this._getDaysInMonth(E,y),T=this._currentMonth===11?0:this._currentMonth+1,R=this._currentMonth===11?this._currentYear+1:this._currentYear,P=e+t,yt=Math.ceil(P/7)*7-P,Y=(C,I,S)=>{const V=this._isToday(C),O=this._isDateSelected(C),q=this._isDateInRange(C),F=k&&C<k||A&&C>A;let M="rounded-md";if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){const D=this._isSameDate(C,this._selectedStartDate),L=this._isSameDate(C,this._selectedEndDate);D&&L?M="rounded-md":D?M="rounded-l-md":L?M="rounded-r-md":q&&(M="rounded-none")}else O&&!this._isRange&&(M="rounded-md");const N=document.createElement("button");N.type="button",N.disabled=!!F,N.tabIndex=F?-1:0;let B=`w-full h-8 ${M} 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`;return S?B+=O?" bg-slate-800 dark:bg-slate-600 text-white":q?" bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":V?" 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":B+=O?" bg-slate-800 dark:bg-slate-600 text-white":q?" bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":" text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700",B+=F?" opacity-40 cursor-not-allowed":"",N.className=B,N.textContent=I.toString(),F||N.addEventListener("click",()=>{this._handleDateClick(C)}),N};for(let C=e-1;C>=0;C--){const I=x-C,S=new Date(y,E,I),V=Y(S,I,!1);v.appendChild(V)}for(let C=1;C<=t;C++){const I=new Date(this._currentYear,this._currentMonth,C),S=Y(I,C,!0);v.appendChild(S)}for(let C=1;C<=yt;C++){const I=new Date(R,T,C),S=Y(I,C,!1);v.appendChild(S)}if(o){const C=document.createElement("div");C.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 I=document.createElement("div");I.className="relative md:relative md:flex-1 md:min-h-0";const S=document.createElement("div");S.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",S.style.scrollbarWidth="none",S.style.msOverflowStyle="none",S.style.setProperty("-webkit-overflow-scrolling","touch");const V=document.createElement("style");V.textContent=`
65
+ `,document.head.appendChild(t),W._activeShadowStyleInjected=!0}this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add("w-full")}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(t,e,i){e!==i&&this.render()}getVariant(){return this.getAttribute("variant")||"solid"}getTone(){return this.getAttribute("tone")||"neutral"}isDisabled(){return this.getAttribute("disabled")==="true"}isLoading(){return this.getAttribute("loading")==="true"}getType(){const t=this.getAttribute("type"),e=this.getAttribute("button-type");return(t||e||"default")==="submit"?"submit":"button"}isFullWidth(){return this.hasAttribute("full-width")}isActive(){const t=this.getAttribute("active");return!(t===null||t==="false"||t==="0")}get active(){return this.isActive()}set active(t){t?this.setAttribute("active","true"):this.removeAttribute("active")}getIconPosition(){return this.getAttribute("icon-position")||"left"}getIcon(){return this.getAttribute("icon")||""}isIconOnly(){var i,s,n,r,a;if(!(this.getIcon()||((i=this._button)==null?void 0:i.querySelector('[slot="icon"], .mint-button-icon, mint-icon'))))return!1;const e=(s=this._button)==null?void 0:s.querySelector(".mint-button-content");if(e&&((n=e.textContent)!=null&&n.trim()))return!1;if(this._button)for(let o=this._button.firstChild;o;o=o.nextSibling){if(o.nodeType===Node.TEXT_NODE&&((r=o.textContent)!=null&&r.trim()))return!1;if(o.nodeType===Node.ELEMENT_NODE){const l=o;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}getActiveStateClasses(){const t=this.getVariant(),e=this.getTone(),i=`${t}-${e}`;return{"solid-action":["!bg-slate-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-slate-700","hover:!bg-slate-900","dark:hover:!bg-slate-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"solid-neutral":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"solid-info":["!bg-blue-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-blue-700","hover:!bg-blue-900","dark:hover:!bg-blue-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"solid-warning":["!bg-amber-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-amber-700","hover:!bg-amber-900","dark:hover:!bg-amber-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"solid-danger":["!bg-red-900","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:!bg-red-700","hover:!bg-red-900","dark:hover:!bg-red-700","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"],"ghost-action":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"ghost-neutral":["!bg-gray-50","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","!text-gray-900","dark:!text-white","hover:!bg-gray-50","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","hover:!text-gray-900","dark:hover:!text-white"],"ghost-info":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"ghost-warning":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"ghost-danger":["!bg-gray-100","!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:!bg-gray-800","hover:!bg-gray-100","dark:hover:!bg-gray-800","hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"],"link-action":["!text-slate-900","dark:!text-slate-300","hover:!text-slate-900","dark:hover:!text-slate-300"],"link-neutral":["!text-gray-950","dark:!text-gray-200","hover:!text-gray-950","dark:hover:!text-gray-200"],"link-info":["!text-blue-900","dark:!text-blue-200","hover:!text-blue-900","dark:hover:!text-blue-200"],"link-warning":["!text-amber-900","dark:!text-amber-200","hover:!text-amber-900","dark:hover:!text-amber-200"],"link-danger":["!text-red-900","dark:!text-red-200","hover:!text-red-900","dark:hover:!text-red-200"]}[i]||[]}getButtonClasses(){const t=this.isIconOnly(),e=this.getVariant(),i=["inline-flex","items-center","justify-center","font-medium","rounded-lg","box-border",...t?["p-1.5","aspect-square","w-[2.25rem]","h-[2.25rem]"]:["px-3.5","py-1.5","min-h-[2.25rem]"],"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(),n={"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"]},r=`${e}-${s}`,a=n[r]||n["solid-neutral"],o=[...i,...a];if(this.isActive()){const l=this.getActiveStateClasses();o.push(...l),o.push("[&>*]:scale-95")}return this.isFullWidth()&&o.push("w-full"),o.join(" ")}render(){var d,p,h,u,_,f;const t=this.isDisabled()||this.isLoading(),e=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=e,this._button.disabled=t;let i=this._button.querySelector("mint-spinner");const s=this.isLoading();if(s)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 m=document.createElement("span");m.className="mr-2 inline-flex items-center";const g=document.createElement("mint-spinner");g.setAttribute("size","default"),g.setAttribute("data-button-variant",this.getVariant()),g.setAttribute("data-button-tone",this.getTone()),g.style.width="0.875rem",g.style.height="0.875rem",m.appendChild(g),this._button.insertBefore(m,this._button.firstChild)}else i&&((d=i.parentElement)==null||d.remove());for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);const n=this.getIcon();let r=this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');n?(r&&r.tagName!=="MINT-ICON"&&(r.remove(),r=null),!r||r.tagName!=="MINT-ICON"?(r=document.createElement("mint-icon"),r.setAttribute("name",n),r.className="mint-button-icon"):r.setAttribute("name",n)):r&&r.tagName==="MINT-ICON"&&(r.remove(),r=null),r||(r=this._button.querySelector('[slot="icon"], .mint-button-icon'));const a=this.getIconPosition();let o=this._button.querySelector(".mint-button-content");if(o){const m=r&&r.tagName==="MINT-ICON";if(r&&!r.parentElement){const g=(u=this._button.querySelector("mint-spinner"))==null?void 0:u.parentElement;m||a==="left"?g?g.insertAdjacentElement("afterend",r):this._button.insertBefore(r,o):o.insertAdjacentElement("afterend",r)}else if(r&&(m||a==="left")&&r.nextSibling!==o){r.remove();const g=(_=this._button.querySelector("mint-spinner"))==null?void 0:_.parentElement;g?g.insertAdjacentElement("afterend",r):this._button.insertBefore(r,o)}else r&&!m&&a==="right"&&r.previousSibling!==o&&(r.remove(),o.insertAdjacentElement("afterend",r))}else{const m=[];for(let g=this._button.firstChild;g;g=g.nextSibling){if(g.nodeType!==Node.ELEMENT_NODE){m.push(g);continue}const b=g;b.tagName!=="MINT-SPINNER"&&!b.querySelector("mint-spinner")&&g!==r&&!b.hasAttribute("slot")&&!(b.className==="mr-2"&&b.querySelector("mint-spinner"))&&m.push(g)}if(m.length>0){o=document.createElement("span"),o.className="mint-button-content inline-flex items-center",m.forEach(b=>{o.appendChild(b)});const g=(p=this._button.querySelector("mint-spinner"))==null?void 0:p.parentElement;r&&a==="left"?g?(g.insertAdjacentElement("afterend",r),r.insertAdjacentElement("afterend",o)):(this._button.insertBefore(r,this._button.firstChild),r.insertAdjacentElement("afterend",o)):r&&a==="right"?g?(g.insertAdjacentElement("afterend",o),o.insertAdjacentElement("afterend",r)):(this._button.insertBefore(o,this._button.firstChild),o.insertAdjacentElement("afterend",r)):g?g.insertAdjacentElement("afterend",o):this._button.insertBefore(o,this._button.firstChild)}else if(r&&r.tagName==="MINT-ICON"&&!r.parentElement){const g=(h=this._button.querySelector("mint-spinner"))==null?void 0:h.parentElement;g?g.insertAdjacentElement("afterend",r):this._button.insertBefore(r,this._button.firstChild)}}const l=this.isIconOnly();if(r&&(r.classList.contains("mint-button-icon")||r.classList.add("mint-button-icon"),s?r.style.display="none":r.style.display="",r.classList.remove("mr-1.5","ml-1.5"),l?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")):a==="left"?r.classList.add("mr-1.5"):r.classList.add("ml-1.5")),s){const m=(f=this._button.querySelector("mint-spinner"))==null?void 0:f.parentElement;m&&(l?(m.classList.remove("mr-2"),m.classList.add("mr-0")):m.classList.contains("mr-2")||(m.classList.remove("mr-0"),m.classList.add("mr-2")))}const c=this.getButtonClasses();this._button.className=c,this.setAttribute("data-variant",this.getVariant()),this.setAttribute("data-tone",this.getTone()),this.isActive()?this._button.classList.add("mint-button-active"):this._button.classList.remove("mint-button-active")}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(t){if(this.isDisabled()||this.isLoading()){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();return}if(this.getType()==="submit"){this.dispatchEvent(new CustomEvent("click",{detail:{originalEvent:t},bubbles:!0,cancelable:!0,composed:!0}));return}if(t.stopPropagation(),t.stopImmediatePropagation(),this._isHandlingClick){t.preventDefault();return}this._isHandlingClick=!0,t.preventDefault(),this.dispatchEvent(new CustomEvent("click",{detail:{originalEvent:t},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};W._activeShadowStyleInjected=!1;let j=W;customElements.get("mint-button")||customElements.define("mint-button",j);class X extends HTMLElement{constructor(){super(),this._button=null,this._checked=!1}static get observedAttributes(){return["checked","disabled","label","icon","info","error","error-message","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block","w-full"),this._checked=this.hasAttribute("checked"),this.render()}_getSwitchContainer(){let t=this.querySelector(".mint-switch-container");return t||(t=document.createElement("div"),t.className="mint-switch-container flex items-center gap-2",this.insertBefore(t,this.firstChild)),t}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(t==="checked"&&(this._checked=i!==null),e!==i){if(t==="error"||t==="error-message"){this._renderErrorState();return}if(t==="loading"){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(t){try{t?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!t,this.render()}catch{}}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getIcon(){return this.getAttribute("icon")||""}hasIcon(){return!!this.getIcon()}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getSwitchClasses(){const t=this.hasError(),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",t?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","disabled:opacity-50","disabled:cursor-not-allowed"],i=this._checked?["bg-slate-950","dark:bg-slate-600",t?"border-red-300 dark:border-red-300":"border-slate-700 dark:border-slate-500"]:["bg-slate-200","dark:bg-slate-400",t?"border-red-300 dark:border-red-300":"border-slate-300 dark:border-slate-500"];return[...e,...i].join(" ")}getThumbClasses(){const t=["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"],e=this._checked?"translate-x-5":"translate-x-0.5";return[...t,e].join(" ")}getIconClasses(){return["absolute","inset-0","flex","items-center","justify-center","pointer-events-none"].join(" ")}render(){const t=this.isLoading(),e=this.getSwitchClasses(),i=this.getThumbClasses(),s=this.getLabel(),n=this.getInfo(),r=this.getIcon(),a=this.getAttribute("id")||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute("id")||this.setAttribute("id",a);const o=this._getSwitchContainer();this._button?this._button.parentElement!==o&&o.appendChild(this._button):(this._button=document.createElement("button"),o.appendChild(this._button),this.setupEventListeners());let l=o.querySelector(".mint-switch-label");s?(l||(l=document.createElement("label"),l.className="mint-switch-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",this._button&&this._button.parentElement===o?o.insertBefore(l,this._button.nextSibling):o.appendChild(l)),l.textContent=s,l.setAttribute("for",a),this.isDisabled()?l.classList.add("opacity-40"):l.classList.remove("opacity-40")):l&&l.remove(),this._button.className=e,this._button.disabled=this.isDisabled(),this._button.id=a,this._button.setAttribute("aria-checked",String(this._checked)),this._button.setAttribute("aria-label",s||"Toggle switch"),this._button.setAttribute("role","switch"),this._button.type="button";let c=this._button.querySelector("span");c||(c=document.createElement("span"),this._button.appendChild(c)),c.className=i;const d=c.querySelector("span");if(r){let h=d;h||(h=document.createElement("span"),h.className=this.getIconClasses(),c.appendChild(h));let u=h.querySelector("mint-icon");u||(u=document.createElement("mint-icon"),h.appendChild(u)),u.setAttribute("name",r)}else d&&d.remove();let p=this.querySelector(".mint-switch-info");n?(p||(p=document.createElement("span"),p.className="mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block",o&&o.parentElement===this?this.insertBefore(p,o.nextSibling):this.appendChild(p)),p.textContent=n,this.isDisabled()?p.classList.add("opacity-40"):p.classList.remove("opacity-40")):p&&p.remove(),this._renderErrorState(),this._renderSkeleton(t)}setupEventListeners(){this._button&&this._button.addEventListener("click",this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener("click",this.handleToggle.bind(this))}handleToggle(t){if(!this.isDisabled()){this.checked=!this._checked;const e=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent("input",{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("toggle",{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(t){const e=this._getSwitchContainer(),i=this.getLabel(),s=this.getInfo();let n=e.querySelector(".mint-switch-skeleton-container"),r=this.querySelector(".mint-switch-info-skeleton");if(t){e.classList.contains("relative")||e.classList.add("relative"),n||(n=document.createElement("div"),n.className="mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2",e.appendChild(n));let a=n.querySelector(".mint-switch-skeleton-box");if(a||(a=document.createElement("div"),a.className="mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse",n.appendChild(a)),i){let l=n.querySelector(".mint-switch-skeleton-label");l||(l=document.createElement("div"),l.className="mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",n.appendChild(l))}else{const l=n.querySelector(".mint-switch-skeleton-label");l&&l.remove()}n.style.display="flex",this._button&&(this._button.style.visibility="hidden",this._button.style.pointerEvents="none");const o=e.querySelector(".mint-switch-label");if(o&&(o.style.visibility="hidden",o.style.pointerEvents="none"),s){r||(r=document.createElement("div"),r.className="mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse mt-2",e&&e.parentElement===this?this.insertBefore(r,e.nextSibling):this.appendChild(r)),r.style.display="block";const l=this.querySelector(".mint-switch-info");l&&(l.style.display="none")}else r&&(r.style.display="none")}else{n&&(n.style.display="none"),r&&(r.style.display="none"),this._button&&(this._button.style.visibility="visible",this._button.style.pointerEvents="auto");const a=e.querySelector(".mint-switch-label");a&&(a.style.visibility="visible",a.style.pointerEvents="auto");const o=this.querySelector(".mint-switch-info");o&&(o.style.display="")}}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-switch-error");t&&e?(i||(i=document.createElement("div"),i.className="mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=e):i&&i.remove(),this._button&&(this._button.className=this.getSwitchClasses())}}customElements.get("mint-switch")||customElements.define("mint-switch",X);class K extends HTMLElement{constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}static get observedAttributes(){return["variant","size","bold","underline","strike","italic","display","inline"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline"),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(e=>this._userClasses.add(e))}attributeChangedCallback(t,e,i){e!==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.hasAttribute("inline")?"inline-block":"block"}getTextClasses(){const t=this.getSize(),e=this.getVariant(),i=document.documentElement.classList.contains("dark"),s={heading:["font-semibold"],"sub-heading":["font-medium"],regular:[]},n={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"]},r=[];this.isBold()&&r.push("font-bold"),this.isUnderline()&&r.push("underline"),this.isStrike()&&r.push("line-through"),this.isItalic()&&r.push("italic");const a=this.getDisplay();return[a==="block"?"block":a==="inline"?"inline":"inline-block",...s[t]||s.regular,...n[e]||n.default,...r].join(" ")}render(){const t=this.getSize(),e=["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)}),e.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=>{!e.includes(l)&&!i.includes(l)&&this._userClasses.add(l)});const r=[...new Set([...s,...Array.from(this._userClasses)])];this.className=r.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)"},o=a[t]||a.regular;this.style.setProperty("font-size",o)}}customElements.get("mint-text")||customElements.define("mint-text",K);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(t,e,i){e!==i&&(this.render(),t==="text-align"&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{const t=this.getTextAlign();t&&this._applyTextAlignToChildren(t)}),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 t=this.getAttribute("gap")||"3";return parseFloat(t)}getTextAlign(){const t=this.getAttribute("text-align")||"";return["left","center","right","justify"].includes(t)?t:""}getStackClasses(){const t=this.getDirection(),e=this.getTextAlign(),i=this.getGap(),s=["flex",t==="horizontal"?"flex-row":"flex-col",`gap-${i}`];return e&&(s.push(`text-${e}`),s.push(`[&>*]:text-${e}`),s.push(`[&>*_.mint-button-content]:text-${e}`),e==="left"?(s.push("[&>mint-button]:!justify-start"),s.push("[&>mint-button>button]:!justify-start")):e==="right"?(s.push("[&>mint-button]:!justify-end"),s.push("[&>mint-button>button]:!justify-end")):e==="center"&&(s.push("[&>mint-button]:!justify-center"),s.push("[&>mint-button>button]:!justify-center"))),s.join(" ")}render(){const t=this.getStackClasses(),e=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(n=>this.classList.remove(n)),t.split(" ").forEach(n=>{n&&this.classList.add(n)}),["box-border","m-0","p-0","border-0","align-baseline","block"].forEach(n=>{this.classList.contains(n)||this.classList.add(n)}),e?this._applyTextAlignToChildren(e):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(t){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"),t==="left"?s.classList.add("justify-start"):t==="right"?s.classList.add("justify-end"):t==="center"&&s.classList.add("justify-center");const n=s.querySelector(".mint-button-content");n&&(n.classList.remove("text-left","text-center","text-right","text-justify"),n.classList.add(`text-${t}`))}}else i.classList.remove("text-left","text-center","text-right","text-justify"),i.classList.add(`text-${t}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(e=>{if(e.tagName==="MINT-BUTTON"){const i=e.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 e.classList.remove("text-left","text-center","text-right","text-justify")})}}customElements.get("mint-stack")||customElements.define("mint-stack",Z);class Q extends HTMLElement{constructor(){super(),this._headingElement=null}static get observedAttributes(){return["heading"]}connectedCallback(){this.classList.add("box-border","m-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(t,e,i){e!==i&&this.render()}getHeading(){return this.getAttribute("heading")||""}hasPaddingClass(){return Array.from(this.classList).some(e=>/^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e))}render(){this.classList.add("rounded-lg","shadow","bg-white","dark:bg-gray-800","border","border-gray-200","dark:border-gray-700","overflow-hidden","transition-colors","duration-200","mb-6"),this.hasPaddingClass()||this.classList.add("p-4");const t=this.getHeading();t?(this._headingElement||(this._headingElement=document.createElement("mint-text"),this._headingElement.setAttribute("size","sub-heading"),this.insertBefore(this._headingElement,this.firstChild)),this._headingElement.textContent=t):this._headingElement&&this._headingElement.parentNode&&(this._headingElement.remove(),this._headingElement=null)}}customElements.get("mint-card")||customElements.define("mint-card",Q);class tt 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(e=>{e.classList.contains("underline")||e.classList.add("underline")})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(t,e,i){e!==i&&this.render()}getHref(){return this.getAttribute("href")||"#"}getTarget(){return this.getAttribute("target")||""}hasIcon(){var t;return!!(this.querySelector("mint-icon")||(t=this._link)!=null&&t.querySelector("mint-icon"))}render(){const t=this.getHref(),e=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=t,e?(this._link.target=e,e==="_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",tt);class et extends HTMLElement{constructor(){super(),this._button=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()}disconnectedCallback(){}attributeChangedCallback(t,e,i){e!==i&&this.render()}getFallbackHref(){return this.getAttribute("fallback-href")||this.getAttribute("href")||"/"}_getTargetUrl(){const t=document.referrer,e=window.location.origin;if(t)try{const i=new URL(t);if(i.origin===e)return i.pathname+i.search}catch{}return this.getFallbackHref()}handleClick(t){t.preventDefault(),t.stopPropagation();const e=this._getTargetUrl(),i=document.referrer,s=i&&(()=>{try{return new URL(i).origin===window.location.origin}catch{return!1}})(),n=new CustomEvent("back",{detail:{url:e,isFromReferrer:s,referrer:i||null,fallbackHref:this.getFallbackHref()},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n)}render(){this._button||(this._button=document.createElement("mint-button"),this._button.setAttribute("variant","neutral"),this._button.setAttribute("icon","arrow-left"),this._button.addEventListener("click",t=>this.handleClick(t)),this.appendChild(this._button))}}customElements.get("mint-back-button")||customElements.define("mint-back-button",et);class it 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,this._backButton=null,this._backButtonHandler=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(),this._setupBackButtonListener()}attributeChangedCallback(t,e,i){e!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null),this._removeBackButtonListener()}getHeading(){return this.getAttribute("heading")||""}getFallbackHref(){return this.getAttribute("fallback-href")||"/"}shouldShowBackButton(){return this.hasAttribute("show-back-button")}render(){const t=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 e=this._titleElement.querySelector("mint-back-button");if(this.shouldShowBackButton()){e||(e=document.createElement("mint-back-button"),this._titleElement.insertBefore(e,this._titleElement.firstChild));const r=this.getFallbackHref();e.setAttribute("fallback-href",r),this._backButton=e}else e&&(e.remove(),e=null,this._backButton=null);t?(this._headingText?(this._headingText.classList.add("truncate","min-w-0"),e&&e.parentElement===this._titleElement?this._headingText.previousSibling!==e&&this._titleElement.insertBefore(this._headingText,e.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"),e&&e.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,e.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=t):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(r=>r!==this._pageContainer&&r!==this._actionsSlot&&r.getAttribute("slot")==="actions").forEach(r=>{this._actionsSlot&&r.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(r)}),this._bodySlot||(this._bodySlot=document.createElement("div"),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(r=>{r!==this._pageContainer&&r.getAttribute("slot")!=="actions"&&r!==this._actionsSlot&&r!==this._header&&r!==this._bodySlot&&r!==this._headingText&&r.parentElement!==this._bodySlot&&r.parentElement!==this._pageContainer&&this._bodySlot.appendChild(r)}),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"]}))}_setupBackButtonListener(){this._backButtonHandler||(this._backButtonHandler=t=>{const e=t.target;if(e&&e.tagName==="MINT-BACK-BUTTON"){t.stopPropagation();const i=new CustomEvent("back",{detail:t.detail,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)}}),this.addEventListener("back",this._backButtonHandler,!0)}_removeBackButtonListener(){this._backButtonHandler&&(this.removeEventListener("back",this._backButtonHandler,!0),this._backButtonHandler=null)}}customElements.get("mint-page")||customElements.define("mint-page",it);class st 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(t,e,i){e!==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 t=["grid"],e=this.getColumns();t.push(`grid-cols-${e}`);const i=this.getSm();i&&t.push(`sm:grid-cols-${i}`);const s=this.getMd();s&&t.push(`md:grid-cols-${s}`);const n=this.getLg();n&&t.push(`lg:grid-cols-${n}`);const r=this.getXl();r&&t.push(`xl:grid-cols-${r}`);const a=this.getGap();return t.push(`gap-${a}`),t}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",st);class rt 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(t,e,i){e!==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 t=this.getId(),e=this.getHeading(),i=this.isOpen();if(t&&(this.id=t),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 n=this._headingSlot.querySelector("mint-text");e?(n||(n=document.createElement("mint-text"),n.setAttribute("size","sub-heading"),n.setAttribute("bold",""),this._headingSlot.appendChild(n)),n.textContent=e):n&&n.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 o=this._actionsSlot.querySelector("mint-stack");o||(o=document.createElement("mint-stack"),o.setAttribute("direction","horizontal"),o.className="justify-end",this._actionsSlot.appendChild(o)),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(h=>{h.parentElement!==o&&o.appendChild(h)}),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 t=document.documentElement.classList.contains("dark"),e=this._modal.querySelector(".modal-content");e&&(t?(e.classList.remove("bg-white"),e.classList.add("bg-gray-800")):(e.classList.remove("bg-gray-800"),e.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_animateEnter(){var e;const t=(e=this._modal)==null?void 0:e.querySelector(".modal-content");t&&(t.style.transform="scale(0.97) translateY(10px)",t.style.opacity="0",t.style.transition="all 200ms ease-out",this.classList.remove("hidden"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transform="scale(1) translateY(0)",t.style.opacity="1"})}))}_animateExit(){var e;const t=(e=this._modal)==null?void 0:e.querySelector(".modal-content");if(!t){this.classList.add("hidden");return}t.style.transition="all 200ms ease-in",t.style.transform="scale(0.97) translateY(10px)",t.style.opacity="0",setTimeout(()=>{this.classList.add("hidden"),t.style.transform="",t.style.opacity="",t.style.transition=""},200)}}customElements.get("mint-modal")||customElements.define("mint-modal",rt);class nt 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(){const t=this._isInsideModal()?"z-[60]":"z-50";this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","top-0","left-0",t,"pointer-events-none"),this.isOpen()||this.classList.add("hidden"),this.render(),this._setupTrigger(),this._observeDarkMode()}_isInsideModal(){let t=this;for(;t;){if(t.tagName==="MINT-MODAL")return!0;t=t.parentElement}if(this._triggerElement)for(t=this._triggerElement;t;){if(t.tagName==="MINT-MODAL")return!0;t=t.parentElement}return!1}disconnectedCallback(){this._triggerElement&&this._triggerElement.tagName==="MINT-BUTTON"&&this._triggerElement.removeAttribute("active"),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(t,e,i){if(e!==i){if(this.isConnected){const s=this._isInsideModal()?"z-[60]":"z-50";this.classList.remove("z-50","z-[60]"),this.classList.add(s)}this.render(),(t==="trigger-id"||t==="hover")&&this._setupTrigger(),t==="open"&&this.isOpen()&&this._closeOtherPopovers()}}getId(){return this.getAttribute("id")||""}getPadding(){const t=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"}[t]||"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 t=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),t&&(this._triggerElement=document.getElementById(t),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(t),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){const t=this;this._triggerClickHandler=function(e){e.stopImmediatePropagation(),e.preventDefault(),t.hasAttribute("open")?t.removeAttribute("open"):t.setAttribute("open","")},this._triggerElement.addEventListener("click",this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();const t=this;this._triggerHoverEnterHandler=function(){t._cancelHoverClose(),t.open()},this._triggerHoverLeaveHandler=function(e){var s;const i=e.relatedTarget;i&&(t.contains(i)||(s=t._triggerElement)!=null&&s.contains(i))||t._scheduleHoverClose()},this._triggerElement.addEventListener("mouseenter",this._triggerHoverEnterHandler),this._triggerElement.addEventListener("mouseleave",this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){t._cancelHoverClose()},this._popoverHoverLeaveHandler=function(e){var s;const i=e.relatedTarget;i&&(t.contains(i)||(s=t._triggerElement)!=null&&s.contains(i))||t._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 t=this._triggerElement?this._triggerElement.matches(":hover"):!1,e=this._popover?this._popover.matches(":hover"):!1;return t||e}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:"down"};const t=this._triggerElement.getBoundingClientRect(),e=this._popover.querySelector(".popover-content");if(!e)return{top:0,left:0,direction:"down"};this.classList.contains("hidden")&&(this.classList.remove("hidden"),this._popover.style.visibility="hidden");const s=e.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight,a=8;let o=this.getDirection(),l=0,c=0;switch(o){case"down":if(l=t.bottom+a,c=t.left+t.width/2-s.width/2,l+s.height>r){const d=t.top-s.height-a;d>=0?(o="up",l=d):(l=Math.max(0,r-s.height-a),l+s.height>r&&(l=0))}c<0&&(c=a),c+s.width>n&&(c=Math.max(a,n-s.width-a),c+s.width>n&&(c=n-s.width));break;case"up":if(l=t.top-s.height-a,c=t.left+t.width/2-s.width/2,l<0){const d=t.bottom+a;d+s.height<=r?(o="down",l=d):(l=Math.min(r-s.height-a,r-s.height),l<0&&(l=r-s.height))}c<0&&(c=a),c+s.width>n&&(c=Math.max(a,n-s.width-a),c+s.width>n&&(c=n-s.width));break;case"right":if(l=t.top+t.height/2-s.height/2,c=t.right+a,c+s.width>n){const d=t.left-s.width-a;d>=0?(o="left",c=d):(c=Math.max(0,n-s.width-a),c+s.width>n&&(c=n-s.width))}l<0&&(l=a),l+s.height>r&&(l=Math.max(a,r-s.height-a),l+s.height>r&&(l=r-s.height));break;case"left":if(l=t.top+t.height/2-s.height/2,c=t.left-s.width-a,c<0){const d=t.right+a;d+s.width<=n?(o="right",c=d):(c=Math.min(n-s.width-a,n-s.width),c<0&&(c=0))}l<0&&(l=a),l+s.height>r&&(l=Math.max(a,r-s.height-a),l+s.height>r&&(l=r-s.height));break}return{top:l,left:c,direction:o}}render(){const t=this.getId(),e=this.isOpen(),i=this.getPadding();if(t&&(this.id=t),e){if(this.classList.remove("hidden"),this.style.pointerEvents="auto",this._triggerElement&&this._triggerElement.tagName==="MINT-BUTTON"&&requestAnimationFrame(()=>{this._triggerElement.setAttribute("active","true");const r=this._triggerElement;typeof r.render=="function"&&requestAnimationFrame(()=>{r.render()})}),!this._clickOutsideHandler){const r=this;this._clickOutsideHandler=function(a){const o=a.composedPath(),l=o.includes(r);if(!(r._triggerElement&&o.includes(r._triggerElement))&&!l){r.close();return}},setTimeout(()=>{document.addEventListener("click",this._clickOutsideHandler,!1)},100)}}else this.classList.add("hidden"),this.style.pointerEvents="none",this._triggerElement&&this._triggerElement.tagName==="MINT-BUTTON"&&requestAnimationFrame(()=>{this._triggerElement.removeAttribute("active");const r=this._triggerElement;typeof r.render=="function"&&requestAnimationFrame(()=>{r.render()})}),this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler,!1),this._clickOutsideHandler=null);if(this._overlay){const r=this._isInsideModal()?"z-[55]":"z-40";this._overlay.className=`fixed inset-0 pointer-events-none ${r}`}else{this._overlay=document.createElement("div");const r=this._isInsideModal()?"z-[55]":"z-40";this._overlay.className=`fixed inset-0 pointer-events-none ${r}`,this.appendChild(this._overlay)}if(this._popover){const r=this._isInsideModal()?"z-[60]":"z-50";this._popover.className=`fixed ${r} pointer-events-auto`}else{this._popover=document.createElement("div");const r=this._isInsideModal()?"z-[60]":"z-50";this._popover.className=`fixed ${r} 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 r=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"],o=r.filter(l=>!a.includes(l));s.className=[...o,i].join(" ")}Array.from(this.children).forEach(r=>{r!==this._overlay&&r!==this._popover&&r.parentElement===this&&s.appendChild(r)}),e?(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"})}))):!e&&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 t=document.documentElement.classList.contains("dark"),e=this._popover.querySelector(".popover-content");e&&(t?(e.classList.remove("bg-white"),e.classList.add("bg-gray-800")):(e.classList.remove("bg-gray-800"),e.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_updatePosition(t){if(!this._triggerElement||!this._popover)return;const e=this._popover.style.visibility!=="hidden";e||(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`,e||(this._popover.style.visibility="visible",t&&(!t.style.opacity||t.style.opacity==="")&&(t.style.transform="scale(0.97) translateY(10px)",t.style.opacity="0",t.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transform="scale(1) translateY(0)",t.style.opacity="1"})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){const t=this;this._scrollHandler=function(){if(t.isOpen()&&t._popover){const e=t._popover.querySelector(".popover-content");e&&t._updatePosition(e)}},window.addEventListener("scroll",this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){const t=this;this._resizeHandler=function(){if(t.isOpen()&&t._popover){const e=t._popover.querySelector(".popover-content");e&&t._updatePosition(e)}},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(e=>{if(e!==this){const i=e;typeof i.close=="function"?i.close():e.removeAttribute("open")}})}}customElements.get("mint-popover")||customElements.define("mint-popover",nt);class at 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","error","error-message","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const t=this.getAttribute("checked");this._checked=t!==null&&t!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(t==="checked"&&(this._checked=i!==null&&i!=="false",this._checkbox&&(this._checkbox.checked=this._checked)),e!==i){if(t==="error"||t==="error-message"){this._renderErrorState();return}if(t==="loading"){this.render();return}this.render(),t==="checked"&&this._checkbox&&this.updateVisualState()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(t){try{t?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!t,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}catch{}}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")||""}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getCheckboxClasses(){const t=this.hasError(),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",t?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],i=this._checked?["bg-slate-800","dark:bg-slate-600",t?"border-red-300 dark:border-red-300":"border-slate-800 dark:border-slate-600"]:["bg-white","dark:bg-gray-700",t?"border-red-300 dark:border-red-300":"border-gray-300 dark:border-gray-500"];return[...e,...i].join(" ")}render(){const t=this.isLoading(),e=this.getLabel(),i=this.getInfo(),s=this.isDisabled();let n=this.querySelector(".mint-checkbox-container");n||(n=document.createElement("div"),n.className="mint-checkbox-container relative inline-flex items-start gap-2",this.insertBefore(n,this.firstChild));let r=this.querySelector(".mint-checkbox-wrapper");r?r.parentElement!==n&&n.appendChild(r):(r=document.createElement("div"),r.className="mint-checkbox-wrapper",n.appendChild(r)),this._checkbox?this._checkbox.parentElement!==r&&r.appendChild(this._checkbox):(this._checkbox=document.createElement("input"),this._checkbox.type="checkbox",r.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=s,this._changeHandler||this.setupEventListeners();const a=this.getId();a?this._checkbox.id=a:this._checkbox.removeAttribute("id");const o=this.getName();o?this._checkbox.name=o:this._checkbox.removeAttribute("name");const l=this.getValue();l?this._checkbox.value=l:this._checkbox.removeAttribute("value"),e?this._checkbox.setAttribute("aria-label",e):this._checkbox.removeAttribute("aria-label"),r.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,r.style.cursor="pointer",r.style.pointerEvents="auto",this._checkbox.style.pointerEvents="auto";const c=r;c._wrapperClickHandler||(c._wrapperClickHandler=u=>{u.target===r&&!s&&(u.preventDefault(),u.stopPropagation(),this.toggle())},r.addEventListener("click",c._wrapperClickHandler));let d=r.querySelector("mint-icon");d||(d=document.createElement("mint-icon"),d.setAttribute("name","check"),d.className="w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto",d.style.transition="opacity 200ms ease-out, transform 200ms ease-out",d.style.zIndex="1",r.appendChild(d)),this.updateVisualState();let p=this.querySelector(".mint-checkbox-label-container");const h=this.querySelector(".mint-checkbox-container");if(e||i){p?h&&p.parentElement!==h&&h.appendChild(p):(p=document.createElement("div"),p.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",h?h.appendChild(p):this.appendChild(p));let u=p.querySelector(".mint-checkbox-label");e?(u||(u=document.createElement("span"),u.className="mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",p.insertBefore(u,p.firstChild)),u.textContent=e,s?u.classList.add("opacity-40"):u.classList.remove("opacity-40")):u&&u.remove();let _=p.querySelector(".mint-checkbox-info");if(i?(_||(_=document.createElement("span"),_.className="mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",p.appendChild(_)),_.textContent=i,s?_.classList.add("opacity-40"):_.classList.remove("opacity-40")):_&&_.remove(),s)p.style.cursor="default",p._clickHandler&&(p.removeEventListener("click",p._clickHandler),p._clickHandler=null);else{p.style.cursor="pointer";const f=p._clickHandler;f&&p.removeEventListener("click",f),p._clickHandler=m=>{this._checkbox&&(m.target===this._checkbox||this._checkbox.contains(m.target)||m.composedPath().includes(this._checkbox))||this.toggle()},p.addEventListener("click",p._clickHandler)}}else p&&p.remove();this._renderErrorState(),this._renderSkeleton(t)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=t=>{t.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const e=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent("input",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0}));const i=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(i)},this._checkbox.addEventListener("change",this._changeHandler),this._mousedownHandler=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&!this.isDisabled()&&(e.classList.add("mint-checkbox-active"),this._checked?(e.style.backgroundColor="rgb(15 23 42)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(e.style.backgroundColor="rgb(243 244 246)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?e.style.backgroundColor="rgb(51 65 85)":e.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&(e.classList.remove("mint-checkbox-active"),e.style.backgroundColor="",e.style.boxShadow="")},this._mouseleaveHandler=t=>{const e=this.querySelector(".mint-checkbox-wrapper");e&&(e.classList.remove("mint-checkbox-active"),e.style.backgroundColor="",e.style.boxShadow="")},this._checkbox.addEventListener("mousedown",this._mousedownHandler),this._checkbox.addEventListener("mouseup",this._mouseupHandler),this._checkbox.addEventListener("mouseleave",this._mouseleaveHandler),this._focusHandler=t=>{const e=this.querySelector(".mint-checkbox-wrapper");e&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(":focus-visible")&&(e==null||e.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&t.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=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&!this.isDisabled()&&(e.classList.add("mint-checkbox-active"),this._checked?(e.style.backgroundColor="rgb(15 23 42)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(e.style.backgroundColor="rgb(243 244 246)",e.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?e.style.backgroundColor="rgb(51 65 85)":e.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=t=>{t.stopPropagation();const e=this.querySelector(".mint-checkbox-wrapper");e&&(e.classList.remove("mint-checkbox-active"),e.style.backgroundColor="",e.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));const t=this.querySelector(".mint-checkbox-wrapper");if(t){const e=t;e._wrapperClickHandler&&(t.removeEventListener("click",e._wrapperClickHandler),e._wrapperClickHandler=null)}}updateVisualState(){const t=this.querySelector(".mint-checkbox-wrapper"),e=t==null?void 0:t.querySelector("mint-icon");e&&(e.style.opacity=this._checked?"1":"0",e.style.transform=this._checked?"scale(1)":"scale(0.8)"),t&&(t.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,t.classList.contains("mint-checkbox-active")||(t.style.backgroundColor="",t.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(),this.dispatchEvent(new CustomEvent("input",{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0}));const t=new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}_renderSkeleton(t){let e=this.querySelector(".mint-checkbox-skeleton-container");const i=this.querySelector(".mint-checkbox-container"),s=this.querySelector(".mint-checkbox-wrapper"),n=this.querySelector(".mint-checkbox-label-container");if(t){e||(e=document.createElement("div"),e.className="mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2",i?i.appendChild(e):(this.style.position="relative",this.appendChild(e)));let r=e.querySelector(".mint-checkbox-skeleton-box");if(r||(r=document.createElement("div"),r.className="mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",e.appendChild(r)),n){let a=e.querySelector(".mint-checkbox-skeleton-label");a||(a=document.createElement("div"),a.className="mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",e.appendChild(a))}e.style.display="flex",s&&(s.style.visibility="hidden",s.style.pointerEvents="none"),n&&(n.style.visibility="hidden",n.style.pointerEvents="none")}else e&&(e.style.display="none"),s&&(s.style.visibility="visible",s.style.pointerEvents="auto"),n&&(n.style.visibility="visible",n.style.pointerEvents="auto")}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-checkbox-label-container");!i&&t&&e&&(i=document.createElement("div"),i.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",this.appendChild(i));let s=this.querySelector(".mint-checkbox-error");t&&e?(s?(s.classList.add("block","w-full"),s.style.display="block",(i&&s.parentElement!==i||i&&s.parentElement===i)&&i.appendChild(s)):(s=document.createElement("div"),s.className="mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full",s.style.display="block",i?i.appendChild(s):this.appendChild(s)),s.textContent=e):s&&s.remove();const n=this.querySelector(".mint-checkbox-wrapper");n&&(n.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`)}}customElements.get("mint-checkbox")||customElements.define("mint-checkbox",at);class wt extends HTMLElement{constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._clickHandler=null,this._focusHandler=null,this._blurHandler=null,this._keydownHandler=null}static get observedAttributes(){return["value","checked","disabled","loading","info"]}connectedCallback(){this.classList.add("inline-flex","items-start","gap-2","cursor-pointer","select-none");const t=this.getAttribute("checked");this._checked=t!==null&&t!=="false",this.render(),this._setupClickHandler()}disconnectedCallback(){this._clickHandler&&(this.removeEventListener("click",this._clickHandler),this._clickHandler=null),this._radio&&(this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._focusHandler&&(this._radio.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._radio.removeEventListener("blur",this._blurHandler),this._blurHandler=null),this._keydownHandler&&(this._radio.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null))}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(t==="checked"&&(this._checked=i!==null&&i!=="false",this._radio&&(this._radio.checked=this._checked),this._updateVisualState()),e!==i){if(t==="loading"){this.render();return}if(t==="info"){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(t){try{this._checked=!!t,t?this.setAttribute("checked",""):this.removeAttribute("checked"),this._radio&&(this._radio.checked=this._checked),this.isConnected?requestAnimationFrame(()=>{this._updateVisualState()}):this._updateVisualState()}catch{}}getValue(){return this.getAttribute("value")||""}getInfo(){return this.getAttribute("info")||""}isDisabled(){const t=this.closest("mint-choice");return this.hasAttribute("disabled")||((t==null?void 0:t.hasAttribute("disabled"))??!1)}_setupClickHandler(){this._clickHandler||(this._clickHandler=t=>{t.target!==this._radio&&(this.isDisabled()||this._radio&&(this._radio.click(),requestAnimationFrame(()=>{if(this._radio&&this._radio.checked!==this._checked){this._checked=this._radio.checked,this._checked?this.setAttribute("checked",""):this.removeAttribute("checked"),this._updateVisualState(),this._updateGroupState();const e=this.closest("mint-choice");e&&e.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))}})))},this.addEventListener("click",this._clickHandler))}render(){var _;const t=this.isLoading(),e=this.isDisabled(),i=this.getValue(),s=this.closest("mint-choice"),n=(s==null?void 0:s.getAttribute("name"))||"";let r="";const a=this.querySelector(".mint-choice-option-label");if(a)r=((_=a.textContent)==null?void 0:_.trim())||"";else{const f=this.querySelector(".mint-choice-option-label-container");Array.from(this.childNodes).forEach(m=>{var g;if(m!==f&&m.nodeType===Node.TEXT_NODE){const b=(g=m.textContent)==null?void 0:g.trim();b&&(r+=b)}})}const o=this.querySelectorAll(".mint-choice-option-wrapper");let l=null;if(o.length>0&&(this._radio&&(l=Array.from(o).find(f=>f.contains(this._radio))),l||(l=o[0]),o.forEach((f,m)=>{f!==l&&f.remove()})),l||(l=document.createElement("div"),l.className="mint-choice-option-wrapper",l.style.position="relative",this.insertBefore(l,this.firstChild)),l.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`,l.style.position="relative",this.querySelectorAll('input[type="radio"]').forEach(f=>{f!==this._radio&&f.remove()}),this._radio)this._radio.parentElement!==l&&l.appendChild(this._radio),this._radio&&this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._radio.addEventListener("change",this._changeHandler)),this._radio&&(this._focusHandler||(this._focusHandler=f=>{const m=this.querySelector(".mint-choice-option-wrapper");m&&!this.isDisabled()&&m.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")}),this._blurHandler||(this._blurHandler=()=>{const f=this.querySelector(".mint-choice-option-wrapper");f&&f.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")}),this._keydownHandler||(this._keydownHandler=f=>{this.isDisabled()||(f.key==="ArrowDown"||f.key==="ArrowRight"?(f.preventDefault(),this._focusNextOption()):(f.key==="ArrowUp"||f.key==="ArrowLeft")&&(f.preventDefault(),this._focusPreviousOption()))}),this._radio.removeEventListener("focus",this._focusHandler),this._radio.removeEventListener("blur",this._blurHandler),this._radio.removeEventListener("keydown",this._keydownHandler),this._radio.addEventListener("focus",this._focusHandler),this._radio.addEventListener("blur",this._blurHandler),this._radio.addEventListener("keydown",this._keydownHandler));else{this._radio=document.createElement("input"),this._radio.type="radio",this._radio.className="sr-only",this._radio.style.position="absolute",this._radio.style.width="1px",this._radio.style.height="1px",this._radio.style.padding="0",this._radio.style.margin="-1px",this._radio.style.overflow="hidden",this._radio.style.clip="rect(0, 0, 0, 0)",this._radio.style.whiteSpace="nowrap",this._radio.style.border="0",l.appendChild(this._radio),this._changeHandler=m=>{const g=this._checked;this._checked=this._radio.checked,this._checked?this.setAttribute("checked",""):this.removeAttribute("checked"),this._updateVisualState(),this._updateGroupState();const b=this.closest("mint-choice");g!==this._checked&&b&&setTimeout(()=>{b.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))},0)},this._radio.addEventListener("change",this._changeHandler);const f=()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.setAttribute("checked",""):this.removeAttribute("checked"),this._updateVisualState(),this._updateGroupState())};this._radio.addEventListener("click",f),this._focusHandler=m=>{const g=this.querySelector(".mint-choice-option-wrapper");g&&!this.isDisabled()&&g.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("focus",this._focusHandler),this._blurHandler=()=>{const m=this.querySelector(".mint-choice-option-wrapper");m&&m.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("blur",this._blurHandler),this._keydownHandler=m=>{this.isDisabled()||(m.key==="ArrowDown"||m.key==="ArrowRight"?(m.preventDefault(),this._focusNextOption()):(m.key==="ArrowUp"||m.key==="ArrowLeft")&&(m.preventDefault(),this._focusPreviousOption()))},this._radio.addEventListener("keydown",this._keydownHandler)}this._radio.name=n,this._radio.value=i,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._radio.checked=this._checked,this._radio.disabled=e,e?this._radio.setAttribute("tabindex","-1"):this._radio.removeAttribute("tabindex"),r?this._radio.setAttribute("aria-label",r):this._radio.removeAttribute("aria-label"),l.querySelectorAll(".mint-choice-option-indicator").forEach((f,m)=>{m>0&&f.remove()});let p=l.querySelector(".mint-choice-option-indicator");p||(p=document.createElement("div"),p.className="mint-choice-option-indicator",l.appendChild(p)),p.className="mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none",p.style.position="absolute",p.style.top="50%",p.style.left="50%",p.style.transform=this._checked?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0)",p.style.opacity=this._checked?"1":"0",this._updateVisualState(),this._renderSkeleton(t);const h=this.getInfo();let u=this.querySelector(".mint-choice-option-label-container");if(r||h){u||(u=document.createElement("div"),u.className="mint-choice-option-label-container flex flex-col gap-0.5",this.appendChild(u),Array.from(this.childNodes).forEach(g=>{var b;g.nodeType===Node.TEXT_NODE&&((b=g.textContent)!=null&&b.trim())&&g!==u&&(g.textContent="")}));let f=u.querySelector(".mint-choice-option-label");r?(f||(f=document.createElement("span"),f.className="mint-choice-option-label",u.appendChild(f)),f.className=`mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${e?"opacity-40":""}`,f.textContent=r):f&&f.remove();let m=u.querySelector(".mint-choice-option-info");h?(m||(m=document.createElement("span"),m.className="mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none",u.appendChild(m)),m.textContent=h,e?m.classList.add("opacity-40"):m.classList.remove("opacity-40")):m&&m.remove()}else u&&u.remove();e?(this.classList.add("cursor-not-allowed"),this.classList.remove("cursor-pointer")):(this.classList.add("cursor-pointer"),this.classList.remove("cursor-not-allowed")),this._updateVisualState()}_getWrapperClasses(){const t=this.isDisabled(),e=["inline-flex","items-center","justify-center","w-[1rem]","h-[1rem]","rounded-full","border-2","transition-all","duration-200","flex-shrink-0","mt-0.5"];return t&&e.push("opacity-40","cursor-not-allowed"),this._checked?e.push("bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"):e.push("bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"),e.join(" ")}_updateVisualState(){const t=this.querySelector(".mint-choice-option-wrapper");t&&(t.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`);const e=this.querySelector(".mint-choice-option-indicator");e&&(e.style.opacity=this._checked?"1":"0",e.style.transform=this._checked?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0)")}_renderSkeleton(t){let e=this.querySelector(".mint-choice-option-skeleton-container");const i=this.querySelector(".mint-choice-option-wrapper");if(t){e||(e=document.createElement("div"),e.className="mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2",i?(i.classList.contains("relative")||i.classList.add("relative"),i.appendChild(e)):(this.style.position="relative",this.appendChild(e)));let s=e.querySelector(".mint-choice-option-skeleton-radio");if(s||(s=document.createElement("div"),s.className="mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse",e.appendChild(s)),e.style.display="flex",i){const n=i.querySelector('input[type="radio"]'),r=i.querySelector(".mint-choice-option-indicator");n&&(n.style.visibility="hidden"),r&&(r.style.visibility="hidden"),i.style.pointerEvents="none"}}else{if(e&&(e.style.display="none"),i){const n=i.querySelector('input[type="radio"]'),r=i.querySelector(".mint-choice-option-indicator");n&&(n.style.visibility="visible"),r&&(r.style.visibility="visible"),i.style.pointerEvents="auto"}const s=this.querySelector(".mint-choice-option-label");s&&!(i!=null&&i.contains(s))&&(s.style.visibility="visible",s.style.pointerEvents="auto")}}_updateGroupState(){var e;if(!((e=this._radio)!=null&&e.name))return;document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`).forEach(i=>{if(i===this._radio)return;const s=i.closest("mint-choice-option");s&&s!==this&&(s._checked=i.checked,i.checked?s.setAttribute("checked",""):s.removeAttribute("checked"),s._updateVisualState())})}_focusNextOption(){var s;if(!((s=this._radio)!=null&&s.name))return;const t=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(n=>!n.disabled),e=t.indexOf(this._radio);let i=null;if(e>=0&&e<t.length-1?i=t[e+1]:t.length>0&&(i=t[0]),i){const n=i.closest("mint-choice-option");if(i.checked=!0,n){const r=n._checked;if(n._checked=!0,n.setAttribute("checked",""),n._changeHandler){const o=new Event("change",{bubbles:!0});n._changeHandler.call(n,o)}else n._updateVisualState(),n._updateGroupState();const a=n.closest("mint-choice");a&&!r&&setTimeout(()=>{a.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:!0,value:n.getValue()},bubbles:!0,cancelable:!0}))},0)}i.focus(),i.dispatchEvent(new Event("change",{bubbles:!0}))}}_focusPreviousOption(){var s;if(!((s=this._radio)!=null&&s.name))return;const t=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(n=>!n.disabled),e=t.indexOf(this._radio);let i=null;if(e>0?i=t[e-1]:t.length>0&&(i=t[t.length-1]),i){const n=i.closest("mint-choice-option");if(i.checked=!0,n){const r=n._checked;if(n._checked=!0,n.setAttribute("checked",""),n._changeHandler){const o=new Event("change",{bubbles:!0});n._changeHandler.call(n,o)}else n._updateVisualState(),n._updateGroupState();const a=n.closest("mint-choice");a&&!r&&setTimeout(()=>{a.dispatchEvent(new CustomEvent("choice-change",{detail:{checked:!0,value:n.getValue()},bubbles:!0,cancelable:!0}))},0)}i.focus(),i.dispatchEvent(new Event("change",{bubbles:!0}))}}}customElements.get("mint-choice-option")||customElements.define("mint-choice-option",wt);class ot extends HTMLElement{constructor(){super(),this._optionsContainer=null}static get observedAttributes(){return["label","name","info","error","error-message","id","disabled","required","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","block","w-full"),this.render(),this.addEventListener("choice-change",t=>{var r;const i=((r=t.detail)==null?void 0:r.value)||this.getValue();(this.getAttribute("value")||"")!==i&&(i?this.setAttribute("value",i):this.removeAttribute("value"));const n=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n),this.dispatchEvent(new CustomEvent("input",{detail:{value:i},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:i},bubbles:!0,cancelable:!0,composed:!0}))})}disconnectedCallback(){}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){e!==i&&(t==="error"||t==="error-message"?this._renderErrorState():t==="loading"?(this.render(),this.querySelectorAll("mint-choice-option").forEach(n=>{this.isLoading()?n.setAttribute("loading",""):n.removeAttribute("loading")})):(this.render(),t==="name"&&this.querySelectorAll("mint-choice-option").forEach(n=>{typeof n.render=="function"&&n.render()})))}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getName(){return this.getAttribute("name")||""}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getId(){return this.getAttribute("id")||""}isDisabled(){return this.hasAttribute("disabled")}isRequired(){return this.hasAttribute("required")}getValue(){const t=this.querySelector('input[type="radio"]:checked');return(t==null?void 0:t.value)||""}setValue(t){const e=this.querySelectorAll("mint-choice-option");e.forEach(i=>{if((i.getAttribute("value")||"")===t){const n=i;n.checked=!0;const r=i.querySelector('input[type="radio"]');r&&(r.checked=!0,r.dispatchEvent(new Event("change",{bubbles:!0})))}else{const n=i;n.checked=!1;const r=i.querySelector('input[type="radio"]');r&&(r.checked=!1)}}),requestAnimationFrame(()=>{e.forEach(i=>{typeof i._updateVisualState=="function"&&i._updateVisualState();const s=i.querySelector('input[type="radio"]');if(s){const n=i;s.checked!==n.checked&&(s.checked=n.checked)}})})}get value(){try{return this.getValue()||""}catch{return""}}set value(t){try{this.setValue(t||"")}catch{}}render(){const t=this.isLoading(),e=this.getLabel(),i=this.getInfo(),s=this.getId()||`mint-choice-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute("id",s);const n=this.isDisabled();let r=this.querySelector(".mint-choice-label-container");if(e||i){r||(r=document.createElement("div"),r.className="mint-choice-label-container flex flex-col gap-0.5 mb-2",this.insertBefore(r,this.firstChild));let l=r.querySelector(".mint-choice-label");e?(l||(l=document.createElement("label"),l.className="mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",r.insertBefore(l,r.firstChild)),l.textContent=e,l.setAttribute("for",s),n?l.classList.add("opacity-40"):l.classList.remove("opacity-40")):l&&l.remove();let c=r.querySelector(".mint-choice-info");i?(c||(c=document.createElement("span"),c.className="mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none",r.appendChild(c)),c.textContent=i,n?c.classList.add("opacity-40"):c.classList.remove("opacity-40")):c&&c.remove()}else r&&r.remove();let a=this.querySelector(".mint-choice-options-wrapper");if(!a){a=document.createElement("div"),a.className="mint-choice-options-wrapper relative";const l=this.querySelector(".mint-choice-label-container");l&&l.parentElement===this?this.insertBefore(a,l.nextSibling):this.insertBefore(a,this.firstChild)}this._optionsContainer?this._optionsContainer.parentElement!==a&&a.appendChild(this._optionsContainer):(this._optionsContainer=document.createElement("div"),this._optionsContainer.className="mint-choice-options-container flex flex-col gap-3",a.appendChild(this._optionsContainer)),Array.from(this.children).filter(l=>l.tagName==="MINT-CHOICE-OPTION"&&l.parentElement!==this._optionsContainer).forEach(l=>{this._optionsContainer.appendChild(l)}),this._renderErrorState(),this._renderSkeleton(t)}_renderSkeleton(t){let e=this.querySelector(".mint-choice-skeleton-container");const i=this.querySelector(".mint-choice-options-wrapper"),s=this.querySelector(".mint-choice-options-container");if(t){if(e||(e=document.createElement("div"),e.className="mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3",i?i.appendChild(e):(this.style.position="relative",this.appendChild(e))),e.querySelectorAll(".mint-choice-option-skeleton").length===0)for(let r=0;r<3;r++){const a=document.createElement("div");a.className="mint-choice-option-skeleton flex items-center gap-3";const o=document.createElement("div");o.className="flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse",a.appendChild(o);const l=document.createElement("div");l.className="h-4 w-20 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",a.appendChild(l),e.appendChild(a)}e.style.display="flex",s&&(s.style.opacity="0",s.style.pointerEvents="none")}else e&&(e.style.display="none"),s&&(s.style.opacity="1",s.style.pointerEvents="auto")}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-choice-error");t&&e?(i||(i=document.createElement("div"),i.className="mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=e):i&&i.remove()}}customElements.get("mint-choice")||customElements.define("mint-choice",ot);class lt 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","loading"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(t,e,i){if(e!==i){if(t==="error"||t==="error-message"){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(t==="loading"){this.render();return}this.render()}}getType(){return this.getAttribute("type")||"text"}getRows(){const t=this.getAttribute("rows");return t?parseInt(t,10):3}_getNormalizedType(){const t=this.getType();return t==="datetime"?"datetime-local":t==="money"?"text":t==="textarea"?"textarea":t}_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 t,e,i;return this._isColor()?((t=this._colorPicker)==null?void 0:t.value)||((e=this._colorTextInput)==null?void 0:e.value)||this.getAttribute("value")||"#000000":((i=this._element)==null?void 0:i.value)||this.getAttribute("value")||""}set value(t){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=t||"#000000"),this._colorTextInput&&(this._colorTextInput.value=t||"#000000")):this._element&&(this._element.value=t),t?this.setAttribute("value",t):this.removeAttribute("value")}catch{}}get value(){try{return this.getValue()||""}catch{return""}}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 t=this._isTextarea(),e=!!this.getIcon(),i=this._isColor(),s=this._isNumber(),n=this.hasError(),r=["w-full",e||i?"pl-10":"px-3.5",e||i?"pr-3.5":s?"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",t?"transition-colors transition-opacity":"transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","readonly:cursor-default",t?"resize-y":"",s?"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none":""],a=["border-2",n?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],o=["focus-visible:ring-2","focus-visible:ring-offset-1",n?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"];return[...r,...a,...o].filter(Boolean).join(" ")}isLoading(){return this.hasAttribute("loading")}render(){var b,v,k,A;this.getType();const t=this._getNormalizedType(),e=this._isTextarea(),i=this._isMoney(),s=this._isColor(),n=this.getPlaceholder(),r=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),l=this.getId(),c=this.getName(),d=this.getAttribute("value")||(s?"#000000":""),p=this.getRows(),h=this.getIcon(),u=this.getLabel(),_=this.getInfo(),f=this.isLoading();if(this._renderSkeleton(f),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=y=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(":focus-visible")&&requestAnimationFrame(()=>{var x;this._colorPicker&&this._colorPicker.matches(":focus-visible")&&((x=this._colorPickerWrapper)==null||x.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 x;const y=((x=this._colorPicker)==null?void 0:x.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=y),this._colorTextInput&&(this._colorTextInput.value=y),this.setAttribute("value",y),this.dispatchEvent(new CustomEvent("input",{detail:{value:y},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener("change",()=>{var x;const y=((x=this._colorPicker)==null?void 0:x.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=y),this.setAttribute("value",y),this.dispatchEvent(new CustomEvent("change",{detail:{value:y},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement("input"),this._colorTextInput.type="text",this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=n||"#000000",this._colorTextInput.pattern="^#[0-9A-Fa-f]{6}$",this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener("input",()=>{var x;const y=((x=this._colorTextInput)==null?void 0:x.value)||"";/^#[0-9A-Fa-f]{6}$/.test(y)&&(this._colorPicker&&(this._colorPicker.value=y),this.setAttribute("value",y),this.dispatchEvent(new CustomEvent("input",{detail:{value:y},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener("blur",()=>{var x,T;const y=((x=this._colorTextInput)==null?void 0:x.value)||"";/^#[0-9A-Fa-f]{6}$/.test(y)?(this._colorPicker&&(this._colorPicker.value=y),this.setAttribute("value",y)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:((T=this._colorPicker)==null?void 0:T.value)||"#000000"},bubbles:!0,cancelable:!0}))}));const E=d||"#000000";if(this._colorPicker&&this._colorPicker.value!==E&&(this._colorPicker.value=E),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=E),this._colorTextInput&&this._colorTextInput.value!==E&&(this._colorTextInput.value=E),this._colorPicker&&(this._colorPicker.disabled=r),this._colorPickerWrapper&&(r?(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=r,this._colorTextInput.readOnly=a,this._colorTextInput.required=o),this._colorTextInput){const y=this._colorTextInput;l?y.id=l:y.removeAttribute("id"),c?y.name=c:y.removeAttribute("name"),y.setAttribute("aria-invalid",this.hasError()?"true":"false"),this._element=y}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),h&&!e?this._icon?this._icon.setAttribute("name",h):(this._icon=document.createElement("mint-icon"),this._icon.setAttribute("name",h),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()&&!e){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 E=document.createElement("mint-icon");E.setAttribute("name","caret-up"),E.className="w-[1rem] h-[1rem]",this._numberIncrementButton.appendChild(E),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement("button"),this._numberDecrementButton.type="button",this._numberDecrementButton.className="flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const y=document.createElement("mint-icon");y.setAttribute("name","caret-down"),y.className="w-[1rem] h-[1rem]",this._numberDecrementButton.appendChild(y),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener("click",x=>{if(x.preventDefault(),x.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const T=parseFloat(this._input.value)||0,R=parseFloat(this._input.step)||1,P=this._input.min?parseFloat(this._input.min):void 0,$=this._input.max?parseFloat(this._input.max):void 0;let H=T+R;$!==void 0&&H>$&&(H=$),P!==void 0&&H<P&&(H=P),this._input.value=H.toString(),this.setAttribute("value",H.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}}),this._numberDecrementButton.addEventListener("click",x=>{if(x.preventDefault(),x.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const T=parseFloat(this._input.value)||0,R=parseFloat(this._input.step)||1,P=this._input.min?parseFloat(this._input.min):void 0,$=this._input.max?parseFloat(this._input.max):void 0;let H=T-R;P!==void 0&&H<P&&(H=P),$!==void 0&&H>$&&(H=$),this._input.value=H.toString(),this.setAttribute("value",H.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=r||a),this._numberDecrementButton&&(this._numberDecrementButton.disabled=r||a)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(e){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=n,this._textarea.disabled=r,this._textarea.readOnly=a,this._textarea.required=o,this._textarea.rows=p,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"),c?this._textarea.name=c:this._textarea.removeAttribute("name"),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const E=this.firstChild.textContent;E&&!this._textarea.value&&(this._textarea.value=E.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=t,this._input.placeholder=n,this._input.disabled=r,this._input.readOnly=a,this._input.required=o,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"),c?this._input.name=c:this._input.removeAttribute("name"),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const E=this.firstChild.textContent;E&&!this._input.value&&(this._input.value=E.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(".mint-input-label-container");if(u||_){g||(g=document.createElement("div"),g.className="mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]",this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let E=g.querySelector(".mint-input-label");if(u){E||(E=document.createElement("label"),E.className="mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",g.insertBefore(E,g.firstChild)),E.textContent=u;const x=l||((b=this._element)==null?void 0:b.id)||((v=this._colorTextInput)==null?void 0:v.id)||((k=this._input)==null?void 0:k.id)||((A=this._textarea)==null?void 0:A.id);if(x)E.setAttribute("for",x);else{const T=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=T:this._colorTextInput?this._colorTextInput.id=T:this._input?this._input.id=T:this._textarea&&(this._textarea.id=T),E.setAttribute("for",T)}r?E.classList.add("opacity-40"):E.classList.remove("opacity-40")}else E&&E.remove();let y=g.querySelector(".mint-input-info");_?(y||(y=document.createElement("span"),y.className="mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none",g.appendChild(y)),y.textContent=_,r?y.classList.add("opacity-40"):y.classList.remove("opacity-40")):y&&y.remove()}else g&&g.remove();this._renderErrorState(),this._renderSkeleton(f)}_renderErrorState(){const t=this.hasError(),e=this.getErrorMessage();let i=this.querySelector(".mint-input-error");t&&e?(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=e):i&&i.remove()}setupEventListeners(){this._element&&(this._element.addEventListener("input",()=>{var i;const t=((i=this._element)==null?void 0:i.value)||"";t?this.setAttribute("value",t):this.removeAttribute("value");const e=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent("input",{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener("blur",()=>{var e;const t=((e=this._element)==null?void 0:e.value)||"";t?this.setAttribute("value",t):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:{value:t},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 t;this._isColor()&&this._colorTextInput?this._colorTextInput.focus():(t=this._element)==null||t.focus()}blur(){var t;this._isColor()&&this._colorTextInput?this._colorTextInput.blur():(t=this._element)==null||t.blur()}_renderSkeleton(t){let e=this.querySelector(".mint-input-skeleton-container");const i=this._wrapper||this.querySelector(".relative.w-full");if(t){e||(e=document.createElement("div"),e.className="mint-input-skeleton-container absolute inset-0 z-10 pointer-events-none",i?(i.classList.contains("relative")||i.classList.add("relative"),i.appendChild(e)):(this.style.position="relative",this.appendChild(e)));let s=e.querySelector(".mint-input-skeleton");if(!s){s=document.createElement("div"),s.className="mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse";const n=this._isTextarea(),r=this.getRows();if(n){const a=r*24+12;s.style.height=`${a}px`}else s.style.height="2.2rem";e.appendChild(s)}e.style.display="block",this._element&&(this._element.style.opacity="0",this._element.style.pointerEvents="none"),this._colorTextInput&&(this._colorTextInput.style.opacity="0",this._colorTextInput.style.pointerEvents="none")}else e&&(e.style.display="none"),this._element&&(this._element.style.opacity="1",this._element.style.pointerEvents="auto"),this._colorTextInput&&(this._colorTextInput.style.opacity="1",this._colorTextInput.style.pointerEvents="auto")}}customElements.get("mint-input")||customElements.define("mint-input",lt);class ct 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","loading","selection-mode","week-start-day"]}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 t=this.closest("form");t&&t.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}isLoading(){return this.hasAttribute("loading")}attributeChangedCallback(t,e,i){if(e!==i){if(t==="error"||t==="error-message"){const s=this.hasError(),n=this.getErrorMessage();this._applyErrorVisuals(s,n,this.isDisabled());return}if(t==="loading"){this.render();return}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute("value")||""}setValue(t){t?(this.setAttribute("value",t),this._textInput&&(this._textInput.value=t),this._parseValue(t)):(this.removeAttribute("value"),this._textInput&&(this._textInput.value=""),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||""}catch{return""}}set value(t){try{this.setValue(t||"")}catch{}}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")||""}getSelectionMode(){const t=this.getAttribute("selection-mode");return t==="week"||t==="month"?t:"day"}getWeekStartDay(){var i;const t=(i=this.getAttribute("week-start-day"))==null?void 0:i.toLowerCase();return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[t||"sunday"]??0}getDisplayFormat(){return this.getAttribute("display-format")||"F j, Y"}getShortcuts(){const t=this.getAttribute("shortcuts");if(!t)return[];try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(i=>({label:i.label,action:this._createShortcutAction(i.action)}))}catch{const i=t.trim();if(i&&typeof window[i]=="function"){const s=window[i]();if(Array.isArray(s))return s.map(n=>({label:n.label,action:typeof n.action=="function"?n.action:this._createShortcutAction(n.action)}))}}return[]}_createShortcutAction(t){return typeof t=="function"?t:typeof t=="string"&&typeof window[t]=="function"?window[t]:()=>null}_getDefaultShortcuts(){const t=[{label:"Today",action:()=>new Date}];return this._isRange&&t.push({label:"This Week",action:()=>{const e=new Date,i=e.getDay(),s=new Date(e);s.setDate(e.getDate()-i),s.setHours(0,0,0,0);const n=new Date(s);return n.setDate(s.getDate()+6),n.setHours(23,59,59,999),{start:s,end:n}}},{label:"This Month",action:()=>{const e=new Date,i=new Date(e.getFullYear(),e.getMonth(),1),s=new Date(e.getFullYear(),e.getMonth()+1,0);return s.setHours(23,59,59,999),{start:i,end:s}}}),t}_getFormatTokens(t){const e=[];let i=0;const s=t.toLowerCase();for(;i<s.length;){const n=s[i];if(n==="d"||n==="m"||n==="y"){let r=1,a=i+1;for(;a<s.length&&s[a]===n;)r++,a++;e.push({type:"part",part:n,len:r}),i=a}else e.push({type:"sep",value:t[i]}),i++}return e}_createPartInput(t,e,i,s,n){const r=document.createElement("input");return r.type="text",r.inputMode="numeric",r.pattern="\\d*",r.maxLength=t,r.placeholder=e,r.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",r.disabled=i||s,r.readOnly=s,r.required=n,t===4?r.className+=" w-[40px]":t===2&&(r.className+=" w-[30px]"),r}_buildValueFromParts(t,e){let i=0;return e.map(s=>{var r;if(s.type==="sep")return s.value;const n=((r=t[i])==null?void 0:r.value)||"";return i++,n}).join("")}_applyDateToParts(t,e,i,s){if(!e.length)return;if(!t){e.forEach(o=>o.value="");return}const n=this._formatDate(t,s);let r=0,a=0;i.forEach(o=>{if(o.type==="sep")r+=o.value.length;else{const l=n.substr(r,o.len);e[a]&&(e[a].value=l),a++,r+=o.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;const t=this.getFormat(),e=this._getFormatTokens(t),i=this._buildValueFromParts(this._startPartInputs,e);if(this._isRange){const s=this._buildValueFromParts(this._endPartInputs,e);this._hiddenInput.value=s?`${i} - ${s}`:i}else this._hiddenInput.value=i}_focusNext(t,e){if(e+1<t.length){const i=t[e+1];i.focus(),i.setSelectionRange(0,i.value.length)}}_focusPrev(t,e){if(e-1>=0){const i=t[e-1];i.focus(),i.setSelectionRange(i.value.length,i.value.length)}}_attachPartInputHandlers(t,e,i){t.forEach((s,n)=>{const r=s.maxLength||2;s.addEventListener("input",()=>{s.value=s.value.replace(/\D/g,"").slice(0,r),s.value.length>=r&&this._focusNext(t,n),this._syncHiddenInput()}),s.addEventListener("keydown",a=>{a.key==="Backspace"&&s.selectionStart===0&&s.selectionEnd===0&&this._focusPrev(t,n),a.key==="ArrowLeft"&&s.selectionStart===0&&s.selectionEnd===0&&(this._focusPrev(t,n),a.preventDefault()),a.key==="ArrowRight"&&s.selectionStart===s.value.length&&s.selectionEnd===s.value.length&&(this._focusNext(t,n),a.preventDefault())}),s.addEventListener("blur",a=>{var c,d;this._syncHiddenInput();const o=a.relatedTarget;o&&(this.contains(o)||(c=this._popover)!=null&&c.contains(o)||this._calendarContainer&&this._calendarContainer.contains(o))||(this._handleBlur(((d=this._hiddenInput)==null?void 0:d.value)||""),this._exitInputMode(),setTimeout(()=>{if(this._hiddenInput){const p=new FocusEvent("blur",{bubbles:!0,cancelable:!0,relatedTarget:a.relatedTarget});this._hiddenInput.dispatchEvent(p)}},0))})})}_splitRangeInput(t,e){const i=t.split(/\s*-\s*/);return i.length>=2?[i[0],i.slice(1).join("-")]:[t]}_parseValue(t){const e=this.getFormat(),i=this._getFormatTokens(e),s=this.getSelectionMode();if(this._isRange||s==="week"||s==="month"){const[r,a]=this._splitRangeInput(t,e),o=r?this._parseDateString(r,e):null,l=a?this._parseDateString(a,e):null;if(o&&l){const[c,d]=o<=l?[o,l]:[l,o];this._selectedStartDate=c,this._selectedEndDate=d,this._currentMonth=c.getMonth(),this._currentYear=c.getFullYear()}else o&&(this._selectedStartDate=o,this._selectedEndDate=null,this._currentMonth=o.getMonth(),this._currentYear=o.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,i,e),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,i,e)}else{const r=this._parseDateString(t,e);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,i,e)):this._applyDateToParts(null,this._startPartInputs,i,e)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(t,e){const i=/[\/\-\.\s]+/;if(i.test(t)){const f=t.split(i).filter(g=>g.length>0),m=e.split(/[\/\-\.\s]+/).filter(g=>g.length>0);if(f.length===m.length){let g=0,b=0,v=0;for(let k=0;k<m.length;k++){const A=m[k].toLowerCase(),E=f[k];if(A.includes("d"))g=parseInt(E,10);else if(A.includes("m"))b=parseInt(E,10)-1;else if(A.includes("y")){let y=parseInt(E,10);const x=A.length,T=E.length;T===2&&x===4?y=Math.floor(new Date().getFullYear()/100)*100+y:T===2&&x===2&&(y=Math.floor(new Date().getFullYear()/100)*100+y),v=y}}if(g&&b>=0&&b<=11&&v){const k=new Date(v,b,g);if(!isNaN(k.getTime())&&k.getDate()===g&&k.getMonth()===b&&k.getFullYear()===v)return k}}}const n=t.replace(/[\/\-\.]/g,""),r=e.replace(/[\/\-\.]/g,"").toLowerCase();let a=r.indexOf("d"),o=r.indexOf("m"),l=r.indexOf("y");const c=[{char:"d",index:a},{char:"m",index:o},{char:"y",index:l}].sort((f,m)=>f.index-m.index);let d=0,p=0,h=0,u=0;r.length,n.length;for(const f of c)if(f.char==="d"){const m=r.lastIndexOf("d")-r.indexOf("d")+1,g=n.substr(u,m);if(g.length===0)return null;d=parseInt(g,10),u+=g.length}else if(f.char==="m"){const m=r.lastIndexOf("m")-r.indexOf("m")+1,g=n.substr(u,m);if(g.length===0)return null;p=parseInt(g,10)-1,u+=g.length}else if(f.char==="y"){const m=r.lastIndexOf("y")-r.indexOf("y")+1,g=n.substr(u),b=Math.min(m,g.length),v=g.substr(0,b);if(v.length===0)return null;let k=parseInt(v,10);b===2&&m===4?k=Math.floor(new Date().getFullYear()/100)*100+k:b===2&&m===2&&(k=Math.floor(new Date().getFullYear()/100)*100+k),h=k,u+=b}if(!d||p<0||p>11||!h)return null;const _=new Date(h,p,d);return isNaN(_.getTime())||_.getDate()!==d||_.getMonth()!==p||_.getFullYear()!==h?null:_}_formatDate(t,e){const i=t.getDate(),s=t.getMonth()+1,n=t.getFullYear(),r=e.toLowerCase();let a=e;return r.includes("dd")?a=a.replace(/dd/gi,String(i).padStart(2,"0")):r.includes("d")&&(a=a.replace(/d/gi,String(i))),r.includes("mm")?a=a.replace(/mm/gi,String(s).padStart(2,"0")):r.includes("m")&&(a=a.replace(/m/gi,String(s))),r.includes("yyyy")?a=a.replace(/yyyy/gi,String(n)):r.includes("yy")&&(a=a.replace(/yy/gi,String(n).substr(2))),a}_formatDatePhp(t,e){const i=t.getDate(),s=t.getMonth()+1,n=t.getFullYear(),r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o=["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"],c=(h,u=2)=>h.toString().padStart(u,"0"),d=h=>{const u=h%10,_=h%100;return u===1&&_!==11?"st":u===2&&_!==12?"nd":u===3&&_!==13?"rd":"th"};let p="";for(let h=0;h<e.length;h++){const u=e[h];if(u==="\\"&&h+1<e.length){p+=e[h+1],h++;continue}switch(u){case"Y":p+=n.toString();break;case"y":p+=n.toString().slice(-2);break;case"m":p+=c(s);break;case"n":p+=s.toString();break;case"M":p+=l[s-1];break;case"F":p+=o[s-1];break;case"d":p+=c(i);break;case"j":p+=i.toString();break;case"D":p+=a[t.getDay()];break;case"l":p+=r[t.getDay()];break;case"S":p+=d(i);break;default:p+=u;break}}return p}_validateDateString(t,e){const i=this._parseDateString(t,e);return i!==null&&!isNaN(i.getTime())}render(){const t=this.isLoading(),e=this.getLabel(),i=this.getInfo(),s=this.getValue(),n=this.isDisabled(),r=this.isReadonly(),a=this.isRequired(),o=this.getId(),l=this.getName(),c=this.getFormat(),d=this.hasError(),p=this.getErrorMessage(),h=this.getSelectionMode();this._isRange=this.isRange()||h==="week"||h==="month",this._input||(this._input=document.createElement("div"),this._input.className="relative w-full",this.appendChild(this._input));let u=this.querySelector(".mint-date-picker-label-container");if(e||i){u||(u=document.createElement("div"),u.className="mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]",this.contains(this._input)?this.insertBefore(u,this._input):this.appendChild(u));let v=u.querySelector(".mint-date-picker-label");e?(v||(v=document.createElement("label"),v.className="mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",u.insertBefore(v,u.firstChild)),v.textContent=e,o&&this._textInput&&v.setAttribute("for",o)):v&&v.remove();let k=u.querySelector(".mint-date-picker-info");i?(k||(k=document.createElement("span"),k.className="mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",u.appendChild(k)),k.textContent=i):k&&k.remove()}else u&&u.remove();this._hiddenInput||(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.value=s||"",this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),o&&(this._hiddenInput.id=o),l&&(this._hiddenInput.name=l),this._hiddenInput.value=s||"",this._hiddenInput.setAttribute("aria-invalid",d?"true":"false");let _=this._input.querySelector(".mint-date-fields");_||(_=document.createElement("div"),this._input.appendChild(_)),this._fieldsContainer=_,this._applyErrorVisuals(d,p,n),_.innerHTML="",this._displayEl=document.createElement("div");const f=r?"select-text":"select-none";this._displayEl.className=`flex-1 text-gray-900 dark:text-white ${r?"cursor-default":"cursor-text"} ${f} focus:outline-none`,this._displayEl.tabIndex=n||r?-1:0,this._displayEl.addEventListener("click",()=>{n||r||this._enterInputMode()}),this._displayEl.addEventListener("keydown",v=>{n||r||(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement("div"),this._inputsWrapperEl.className="flex items-center gap-1 w-full";const m=this._getFormatTokens(c);this._startPartInputs=[],this._endPartInputs=[];const g=v=>{const k=document.createDocumentFragment();return m.forEach(A=>{if(A.type==="sep"){const E=document.createElement("span");E.textContent=A.value,E.className="text-gray-400 dark:text-gray-500 select-none",k.appendChild(E)}else{const E=A.part==="d"?"dd":A.part==="m"?"mm":A.len===2?"yy":"yyyy",y=this._createPartInput(A.len,E,n,r,a);v==="start"?this._startPartInputs.push(y):this._endPartInputs.push(y),k.appendChild(y)}}),k};if(this._inputsWrapperEl.appendChild(g("start")),this._isRange){const v=document.createElement("span");v.textContent=" - ",v.className="text-gray-400 dark:text-gray-500 select-none",this._inputsWrapperEl.appendChild(v),this._inputsWrapperEl.appendChild(g("end"))}const b=document.createElement("div");if(b.className="flex flex-col w-full",this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none",b.appendChild(this._displayEl),b.appendChild(this._inputsWrapperEl),_.appendChild(b),_.addEventListener("click",()=>{this._isInputMode||n||r||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,m,_),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,m,_),this._parseValue(s),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=n||r,!n&&!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-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";const v=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=v;const k=document.createElement("mint-icon");k.setAttribute("name","calendar"),k.className="w-4 h-4 pointer-events-none",this._iconButton.appendChild(k),this._iconButton.addEventListener("click",()=>{n||r||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=n||r}this._renderErrorState(d,p),this._renderSkeleton(t)}_renderErrorState(t,e){let i=this.querySelector(".mint-date-picker-error");t&&e?(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=e):i&&i.remove()}_applyErrorVisuals(t,e,i){if(this._renderErrorState(t,e),this._fieldsContainer){const s=this._getFieldContainerClass(t,i);this._fieldsContainer.className=s}this._hiddenInput&&this._hiddenInput.setAttribute("aria-invalid",t?"true":"false")}_attachFormResetListener(){const t=this.closest("form");!t||this._resetHandler||(this._resetHandler=()=>{this.setValue(""),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,"",this.isDisabled())},t.addEventListener("reset",this._resetHandler))}_clearPartInputs(t){t.forEach(e=>{e.value=""})}_getFieldContainerClass(t,e){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",t?"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",t?"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(" ")+(e?" opacity-40 cursor-not-allowed":"")}_handleInputChange(t){}_cleanInputValue(t,e){return t}_handleBlur(t){const e=this.getFormat(),i=this.getSelectionMode(),s=this._isRange||i==="week"||i==="month";if(!t){this.setValue(""),this._updateDisplayText();return}if(s){const[n,r]=this._splitRangeInput(t,e),a=n?this._parseDateString(n,e):null,o=r?this._parseDateString(r,e):null;if(a&&o){const[l,c]=a<=o?[a,o]:[o,a],d=this._formatDate(l,e),p=this._formatDate(c,e),h=`${d} - ${p}`;this.setValue(h),this._applyDateToParts(l,this._startPartInputs,this._getFormatTokens(e),e),this._applyDateToParts(c,this._endPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=l,this._selectedEndDate=c,this._currentMonth=l.getMonth(),this._currentYear=l.getFullYear()}else if(a){const l=this._formatDate(a,e);this.setValue(l),this._applyDateToParts(a,this._startPartInputs,this._getFormatTokens(e),e),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(e),e),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(t,e)){const n=this._parseDateString(t,e);if(n){const r=this._formatDate(n,e);this.setValue(r),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(e),e),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(t=0){if(!this._iconButton){t<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(t+1)});return}const e=10,i=this._iconButton.id;i&&this._iconButton.isConnected?document.getElementById(i)?this._createPopover(i):t<e&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(t+1)}):t<e&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(t+1)})}_createPopover(t){if(!t)return;if(!document.getElementById(t)){setTimeout(()=>{this._createPopover(t)},50);return}if(!this._popover)this._popover=document.createElement("mint-popover"),this._popover.setAttribute("direction","down"),this._popover.setAttribute("padding","0"),this.closest("mint-modal")?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute("trigger-id",t),this._popoverObserver||(this._popoverObserver=new MutationObserver(s=>{s.forEach(n=>{var r;if(n.type==="attributes"&&n.attributeName==="open")if((r=this._popover)==null?void 0:r.hasAttribute("open"))requestAnimationFrame(()=>{this._buildCalendar();const o=this._popover;typeof o.render=="function"&&o.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{var o;(o=this._iconButton)==null||o.focus()}),this._viewMode="calendar",this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{const o=new Date;this._currentMonth=o.getMonth(),this._currentYear=o.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{var l;const o=new FocusEvent("blur",{bubbles:!0,cancelable:!0,relatedTarget:null});(l=this._hiddenInput)==null||l.dispatchEvent(o)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:["open"]})),requestAnimationFrame(()=>{this._buildCalendar()}))})});else{if(this._popover.getAttribute("trigger-id")!==t){this._popover.setAttribute("trigger-id",t);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 t=this._popover.querySelector(".popover-content");if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;const t=this._getDaysInMonth(this._currentMonth,this._currentYear),e=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),i=["January","February","March","April","May","June","July","August","September","October","November","December"],s=this.getWeekStartDay(),n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=[...n.slice(s),...n.slice(0,s)],a=this.getShortcuts(),o=a.length>0;this._calendarContainer.className=o?"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 l=document.createElement("div");l.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 d=document.createElement("div");d.className="flex items-center justify-between mb-4";const p=document.createElement("button");p.type="button",p.tabIndex=0,p.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",p.setAttribute("data-keep-popover-open","true");const h=document.createElement("mint-icon");h.setAttribute("name","caret-left"),h.className="w-4 h-4",p.appendChild(h),p.addEventListener("click",()=>{this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar()}),d.appendChild(p);const u=document.createElement("div");u.className="flex items-center gap-2";const _=document.createElement("button");_.type="button",_.tabIndex=0,_.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",_.setAttribute("data-keep-popover-open","true"),_.textContent=i[this._currentMonth],_.addEventListener("click",()=>{this._viewMode="month",this._buildCalendar()}),u.appendChild(_);const f=document.createElement("button");f.type="button",f.tabIndex=0,f.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",f.setAttribute("data-keep-popover-open","true"),f.textContent=String(this._currentYear),f.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),u.appendChild(f),d.appendChild(u);const m=document.createElement("button");m.type="button",m.tabIndex=0,m.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",m.setAttribute("data-keep-popover-open","true");const g=document.createElement("mint-icon");g.setAttribute("name","caret-right"),g.className="w-4 h-4",m.appendChild(g),m.addEventListener("click",()=>{this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar()}),d.appendChild(m);const b=document.createElement("div");b.className="grid grid-cols-7 mb-2",r.forEach(C=>{const I=document.createElement("div");I.className="text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1",I.textContent=C,b.appendChild(I)});const v=document.createElement("div");v.className="grid grid-cols-7";const k=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,A=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null,E=this._currentMonth===0?11:this._currentMonth-1,y=this._currentMonth===0?this._currentYear-1:this._currentYear,x=this._getDaysInMonth(E,y),T=this._currentMonth===11?0:this._currentMonth+1,R=this._currentMonth===11?this._currentYear+1:this._currentYear,P=e+t,yt=Math.ceil(P/7)*7-P,Y=(C,I,S)=>{const V=this._isToday(C),O=this._isDateSelected(C),q=this._isDateInRange(C),F=k&&C<k||A&&C>A;let M="rounded-md";if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){const D=this._isSameDate(C,this._selectedStartDate),L=this._isSameDate(C,this._selectedEndDate);D&&L?M="rounded-md":D?M="rounded-l-md":L?M="rounded-r-md":q&&(M="rounded-none")}else O&&!this._isRange&&(M="rounded-md");const N=document.createElement("button");N.type="button",N.disabled=!!F,N.tabIndex=F?-1:0;let B=`w-full h-8 ${M} 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`;return S?B+=O?" bg-slate-800 dark:bg-slate-600 text-white":q?" bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":V?" 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":B+=O?" bg-slate-800 dark:bg-slate-600 text-white":q?" bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":" text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700",B+=F?" opacity-40 cursor-not-allowed":"",N.className=B,N.textContent=I.toString(),F||N.addEventListener("click",()=>{this._handleDateClick(C)}),N};for(let C=e-1;C>=0;C--){const I=x-C,S=new Date(y,E,I),V=Y(S,I,!1);v.appendChild(V)}for(let C=1;C<=t;C++){const I=new Date(this._currentYear,this._currentMonth,C),S=Y(I,C,!0);v.appendChild(S)}for(let C=1;C<=yt;C++){const I=new Date(R,T,C),S=Y(I,C,!1);v.appendChild(S)}if(o){const C=document.createElement("div");C.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 I=document.createElement("div");I.className="relative md:relative md:flex-1 md:min-h-0";const S=document.createElement("div");S.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",S.style.scrollbarWidth="none",S.style.msOverflowStyle="none",S.style.setProperty("-webkit-overflow-scrolling","touch");const V=document.createElement("style");V.textContent=`
66
66
  .mint-date-shortcuts-row::-webkit-scrollbar {
67
67
  display: none;
68
68
  }
package/dist/index.js CHANGED
@@ -1065,7 +1065,7 @@ class et extends HTMLElement {
1065
1065
  super(), this._darkModeObserver = null, this._userClasses = /* @__PURE__ */ new Set();
1066
1066
  }
1067
1067
  static get observedAttributes() {
1068
- return ["variant", "size", "bold", "underline", "strike", "italic", "display"];
1068
+ return ["variant", "size", "bold", "underline", "strike", "italic", "display", "inline"];
1069
1069
  }
1070
1070
  connectedCallback() {
1071
1071
  this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline"), this._captureUserClasses(), this.render(), this._observeDarkMode();
@@ -1106,7 +1106,7 @@ class et extends HTMLElement {
1106
1106
  return this.hasAttribute("italic");
1107
1107
  }
1108
1108
  getDisplay() {
1109
- return this.hasAttribute("display") ? this.getAttribute("display") : this.getSize() === "regular" ? "inline-block" : "block";
1109
+ return this.hasAttribute("display") ? this.getAttribute("display") : this.hasAttribute("inline") ? "inline-block" : "block";
1110
1110
  }
1111
1111
  getTextClasses() {
1112
1112
  const t = this.getSize(), e = this.getVariant(), i = document.documentElement.classList.contains("dark"), s = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monobill-mintui",
3
- "version": "0.3.40",
3
+ "version": "0.3.41",
4
4
  "description": "A modern framework-agnostic UI kit built as Web Components. Requires Tailwind CSS.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",