@inertiaui/modal-react 0.19.2 → 0.19.4

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,5 +1,5 @@
1
- (function(C,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react"),require("react/jsx-runtime"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime","axios","@inertiajs/react","@inertiajs/core","react-dom"],i):(C=typeof globalThis<"u"?globalThis:C||self,i(C.InertiaUIModal={},C.React,C.jsxRuntime,C.Axios,C.react,C.core,C.ReactDOM))})(this,function(C,i,$,Ee,z,tn,nn){"use strict";var ol=Object.defineProperty;var sl=(C,i,$)=>i in C?ol(C,i,{enumerable:!0,configurable:!0,writable:!0,value:$}):C[i]=$;var B=(C,i,$)=>sl(C,typeof i!="symbol"?i+"":i,$);function rn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const se=rn(i),ue={type:"modal",navigate:!1,modal:{closeButton:!0,closeExplicitly:!1,maxWidth:"2xl",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white rounded",position:"center"},slideover:{closeButton:!0,closeExplicitly:!1,maxWidth:"md",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white min-h-screen",position:"right"}};class ln{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(ue))}put(t,n){if(typeof t=="object"){this.config={type:t.type??ue.type,navigate:t.navigate??ue.navigate,modal:{...ue.modal,...t.modal??{}},slideover:{...ue.slideover,...t.slideover??{}}};return}const r=t.split(".");let l=this.config;for(let s=0;s<r.length-1;s++)l=l[r[s]]=l[r[s]]||{};l[r[r.length-1]]=n}get(t){if(typeof t>"u")return this.config;const n=t.split(".");let r=this.config;for(const l of n){if(r[l]===void 0)return null;r=r[l]}return r}}const be=new ln,on=()=>be.reset(),sn=(e,t)=>be.put(e,t),$e=e=>be.get(e),re=(e,t)=>be.get(e?`slideover.${t}`:`modal.${t}`);function dt(e,t){return e=typeof e=="string"?new URL(e,window.location.origin):e,t=typeof t=="string"?new URL(t,window.location.origin):t,`${e.origin}${e.pathname}`==`${t.origin}${t.pathname}`}function Xe(e="inertiaui_modal_"){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${e}${crypto.randomUUID()}`:`${e}${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}function un(e,t){return Array.isArray(e)?e.filter(n=>!t.includes(n)):Object.keys(e).reduce((n,r)=>(t.includes(r)||(n[r]=e[r]),n),{})}function ct(e,t){return Array.isArray(e)?e.filter(n=>t.includes(n)):t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}function an(e){return Array.isArray(e)?e.filter(t=>t!==null):Object.keys(e).reduce((t,n)=>(n in e&&e[n]!==null&&(t[n]=e[n]),t),{})}function dn(e,t=3,n=10){return new Promise((r,l)=>{const s=e();if(s){r(s);return}let u=t*1e3/n;const a=setInterval(()=>{const o=e();o&&(clearInterval(a),r(o)),--u<=0&&(clearInterval(a),l(new Error("Condition not met in time")))},n)})}function ae(e){return e?(e=e.replace(/_/g,"-"),e=e.replace(/-+/g,"-"),/[A-Z]/.test(e)?(e=e.replace(/\s+/g,"").replace(/_/g,"").replace(/(?:^|\s|-)+([A-Za-z])/g,(t,n)=>n.toUpperCase()),e=e.replace(/(.)(?=[A-Z])/g,"$1-"),e.toLowerCase()):e):""}const Me=i.createContext(null);Me.displayName="ModalStackContext";let ft=null,mt=null,de=null,Ve=null,Ce=[],le={};const pt=({children:e})=>{const[t,n]=i.useState([]),[r,l]=i.useState({}),s=g=>{n(d=>{const p=g([...d]),h=w=>{var E;return p.length<2?!0:((E=p.map(v=>({id:v.id,shouldRender:v.shouldRender})).reverse().find(v=>v.shouldRender))==null?void 0:E.id)===w};return p.forEach((w,E)=>{p[E].onTopOfStack=h(w.id),p[E].getParentModal=()=>E<1?null:p.slice(0,E).reverse().find(v=>v.isOpen),p[E].getChildModal=()=>E===p.length-1?null:p.slice(E+1).find(v=>v.isOpen)}),p})};i.useEffect(()=>{Ce=t},[t]);class u{constructor(d,p,h,w,E){B(this,"show",()=>{s(d=>d.map(p=>(p.id===this.id&&!p.isOpen&&(p.isOpen=!0,p.shouldRender=!0),p)))});B(this,"setOpen",d=>{d?this.show():this.close()});B(this,"close",()=>{s(d=>d.map(p=>{var h;return p.id===this.id&&p.isOpen&&(Object.keys(p.listeners).forEach(w=>{p.off(w)}),p.isOpen=!1,(h=p.onCloseCallback)==null||h.call(p)),p}))});B(this,"afterLeave",()=>{this.isOpen||s(d=>{const p=d.map(h=>{var w;return h.id===this.id&&!h.isOpen&&(h.shouldRender=!1,(w=h.afterLeaveCallback)==null||w.call(h),h.afterLeaveCallback=null),h});return this.index===0?[]:p})});B(this,"on",(d,p)=>{d=ae(d),this.listeners[d]=this.listeners[d]??[],this.listeners[d].push(p)});B(this,"off",(d,p)=>{var h;d=ae(d),p?this.listeners[d]=((h=this.listeners[d])==null?void 0:h.filter(w=>w!==p))??[]:delete this.listeners[d]});B(this,"emit",(d,...p)=>{var h;(h=this.listeners[ae(d)])==null||h.forEach(w=>w(...p))});B(this,"registerEventListenersFromProps",d=>{const p=[];return Object.keys(d).filter(h=>h.startsWith("on")).forEach(h=>{const w=ae(h).replace(/^on-/,"");this.on(w,d[h]),p.push(()=>this.off(w,d[h]))}),()=>p.forEach(h=>h())});B(this,"reload",(d={})=>{var h;let p=Object.keys(this.response.props);d.only&&(p=ct(p,d.only)),d.except&&(p=un(p,d.except)),(h=this.response)!=null&&h.url&&Ee.get(this.response.url,{headers:{Accept:"text/html, application/xhtml+xml","X-Inertia":!0,"X-Inertia-Partial-Component":this.response.component,"X-Inertia-Version":this.response.version,"X-Inertia-Partial-Data":p.join(","),"X-InertiaUI-Modal":Xe(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":de}}).then(w=>{this.updateProps(w.data.props)})});B(this,"updateProps",d=>{Object.assign(this.props,d),s(p=>p)});if(this.id=p.id??Xe(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=d,this.props=p.props,this.response=p,this.config=h??{},this.onCloseCallback=w,this.afterLeaveCallback=E,le[this.id]){this.config={...this.config,...le[this.id].config??{}};const v=le[this.id].onClose,M=le[this.id].onAfterLeave;v&&(this.onCloseCallback=w?()=>{w(),v()}:v),M&&(this.afterLeaveCallback=E?()=>{E(),M()}:M),delete le[this.id]}this.index=-1,this.getParentModal=()=>null,this.getChildModal=()=>null,this.onTopOfStack=!0}static generateId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`inertiaui_modal_${crypto.randomUUID()}`:`inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}}const a=(g,d={},p=null,h=null)=>mt(g.component).then(w=>o(w,g,d,p,h)),o=(g,d,p,h,w)=>{const E=new u(g,d,p,h,w);return E.index=t.length,s(v=>[...v,E]),E.show(),E};function c(g,d,p,h){if(!r[g])throw new Error(`The local modal "${g}" has not been registered.`);const w=o(null,{},d,p,h);return w.name=g,r[g].callback(w),w}const m=(g,d={})=>x(g,d.method??"get",d.data??{},d.headers??{},d.config??{},d.onClose,d.onAfterLeave,d.queryStringArrayFormat??"brackets",d.navigate??$e("navigate")).then(p=>{const h=d.listeners??{};return Object.keys(h).forEach(w=>{const E=ae(w);p.on(E,h[w])}),p}),x=(g,d,p={},h={},w={},E=null,v=null,M="brackets",P=!1)=>{const A=Xe();return new Promise((U,F)=>{if(g.startsWith("#")){U(c(g.substring(1),w,E,v));return}const[I,H]=tn.mergeDataIntoQueryString(d,g||"",p,M);let W=P&&t.length===0;if(t.length===0&&(de=typeof window<"u"?window.location.href:""),h={...h,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":ft,"X-InertiaUI-Modal":A,"X-InertiaUI-Modal-Use-Router":W?1:0,"X-InertiaUI-Modal-Base-Url":de},W)return Ve=null,le[A]={config:w,onClose:E,onAfterLeave:v},z.router.visit(I,{method:d,data:H,headers:h,preserveScroll:!0,preserveState:!0,onError:F,onFinish:()=>{dn(()=>Ve).then(U)}});Ee({url:I,method:d,data:H,headers:h}).then(S=>U(a(S.data,w,E,v))).catch(S=>{F(S)})})},f={stack:t,localModals:r,push:o,pushFromResponseData:a,length:()=>Ce.length,closeAll:()=>{Ce.reverse().forEach(g=>g.close())},reset:()=>s(()=>[]),visit:x,visitModal:m,registerLocalModal:(g,d)=>{l(p=>({...p,[g]:{name:g,callback:d}}))},removeLocalModal:g=>{l(d=>{const p={...d};return delete p[g],p})}};return $.jsx(Me.Provider,{value:f,children:e})},ce=()=>{const e=i.useContext(Me);if(e===null)throw new Error("useModalStack must be used within a ModalStackProvider");return e},ht=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],vt=e=>{e.initialPage&&(ft=e.initialPage.version),e.resolveComponent&&(mt=e.resolveComponent)},cn=(e,t)=>{vt(t);const n=({Component:r,props:l,key:s})=>{const u=()=>{const a=i.createElement(r,{key:s,...l});return typeof r.layout=="function"?r.layout(a):Array.isArray(r.layout)?r.layout.concat(a).reverse().reduce((c,m)=>i.createElement(m,l,c)):a};return $.jsxs($.Fragment,{children:[u(),$.jsx(gt,{})]})};return $.jsx(pt,{children:$.jsx(e,{...t,children:n})})},gt=({children:e})=>{var a;const t=i.useContext(Me);let n=!1,r=!1;i.useEffect(()=>z.router.on("before",o=>{if(!dt(window.location.href,o.detail.visit.url)||o.detail.visit.replace||t.length()!==1||!r)return!0;const{method:c,data:m,only:x,except:b,headers:y,errorBag:f,forceFormData:g,queryStringArrayFormat:d,async:p,showProgress:h,prefetch:w,fresh:E,reset:v,preserveUrl:M}=o.detail.visit;return z.router.visit(o.detail.visit.url,{replace:!0,preserveScroll:!0,preserveState:!0,method:c,data:m,only:x,except:b,headers:y,errorBag:f,forceFormData:g,queryStringArrayFormat:d,async:p,showProgress:h,prefetch:w,fresh:E,reset:v,preserveUrl:M}),!1}),[]),i.useEffect(()=>z.router.on("start",()=>n=!0),[]),i.useEffect(()=>z.router.on("finish",()=>n=!1),[]),i.useEffect(()=>z.router.on("navigate",function(o){const c=o.detail.page.props._inertiaui_modal;if(!c){r&&t.closeAll();return}r=c,de=c.baseUrl,t.pushFromResponseData(c,{},()=>{if(!c.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!n&&window.location.href!==c.baseUrl&&z.router.visit(c.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(m=>{Ve=m})}),[]);const l=o=>(Ce.length&&(o.headers["X-InertiaUI-Modal-Base-Url"]=de),o);i.useEffect(()=>(Ee.interceptors.request.use(l),()=>Ee.interceptors.request.eject(l)),[]);const s=z.usePage(),u=i.useRef();return i.useEffect(()=>{var m,x;const o=(m=s.props)==null?void 0:m._inertiaui_modal,c=u.current;u.current=o,o&&c&&o.component===c.component&&dt(o.url,c.url)&&((x=t.stack[0])==null||x.updateProps(o.props??{}))},[(a=s.props)==null?void 0:a._inertiaui_modal]),$.jsxs($.Fragment,{children:[e,t.stack.length>0&&$.jsx(wt,{index:0})]})},Ye=i.createContext(null);Ye.displayName="ModalIndexContext";const ze=()=>{const e=i.useContext(Ye);if(e===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return e},wt=({index:e})=>{const{stack:t}=ce(),n=i.useMemo(()=>t[e],[t,e]);return(n==null?void 0:n.component)&&$.jsx(Ye.Provider,{value:e,children:$.jsx(n.component,{...n.props,onModalEvent:(...r)=>n.emit(...r)})})},Ge=i.forwardRef(({name:e,children:t,onFocus:n=null,onBlur:r=null,onClose:l=null,onSuccess:s=null,...u},a)=>{const o=ze(),{stack:c,registerLocalModal:m,removeLocalModal:x}=ce(),[b,y]=i.useState(null),f=i.useMemo(()=>e?b:c[o],[e,b,o,c]),g=i.useMemo(()=>{var v;return(v=c.find(M=>M.shouldRender&&M.index>(f==null?void 0:f.index)))==null?void 0:v.index},[o,c]),d=i.useMemo(()=>(f==null?void 0:f.config.slideover)??u.slideover??$e("type")==="slideover",[u.slideover]),p=i.useMemo(()=>({slideover:d,closeButton:u.closeButton??re(d,"closeButton"),closeExplicitly:u.closeExplicitly??re(d,"closeExplicitly"),maxWidth:u.maxWidth??re(d,"maxWidth"),paddingClasses:u.paddingClasses??re(d,"paddingClasses"),panelClasses:u.panelClasses??re(d,"panelClasses"),position:u.position??re(d,"position"),...f==null?void 0:f.config}),[u,f==null?void 0:f.config]);i.useEffect(()=>{if(e){let v=null;return m(e,M=>{v=M.registerEventListenersFromProps(u),y(M)}),()=>{v==null||v(),v=null,x(e)}}return f.registerEventListenersFromProps(u)},[e]);const h=i.useRef(f);i.useEffect(()=>{h.current=f},[f]),i.useEffect(()=>{f!==null&&(f.isOpen?s==null||s():l==null||l())},[f==null?void 0:f.isOpen]);const[w,E]=i.useState(!1);return i.useEffect(()=>{w&&f!==null&&f.isOpen&&(f.onTopOfStack?n==null||n():r==null||r()),E(!0)},[f==null?void 0:f.onTopOfStack]),i.useImperativeHandle(a,()=>({afterLeave:()=>{var v;return(v=h.current)==null?void 0:v.afterLeave()},close:()=>{var v;return(v=h.current)==null?void 0:v.close()},emit:(...v)=>{var M;return(M=h.current)==null?void 0:M.emit(...v)},getChildModal:()=>{var v;return(v=h.current)==null?void 0:v.getChildModal()},getParentModal:()=>{var v;return(v=h.current)==null?void 0:v.getParentModal()},reload:(...v)=>{var M;return(M=h.current)==null?void 0:M.reload(...v)},setOpen:()=>{var v;return(v=h.current)==null?void 0:v.setOpen()},get id(){var v;return(v=h.current)==null?void 0:v.id},get index(){var v;return(v=h.current)==null?void 0:v.index},get isOpen(){var v;return(v=h.current)==null?void 0:v.isOpen},get config(){var v;return(v=h.current)==null?void 0:v.config},get modalContext(){return h.current},get onTopOfStack(){var v;return(v=h.current)==null?void 0:v.onTopOfStack},get shouldRender(){var v;return(v=h.current)==null?void 0:v.shouldRender}}),[f]),(f==null?void 0:f.shouldRender)&&$.jsxs($.Fragment,{children:[typeof t=="function"?t({afterLeave:f.afterLeave,close:f.close,config:p,emit:f.emit,getChildModal:f.getChildModal,getParentModal:f.getParentModal,id:f.id,index:f.index,isOpen:f.isOpen,modalContext:f,onTopOfStack:f.onTopOfStack,reload:f.reload,setOpen:f.setOpen,shouldRender:f.shouldRender}):t,g&&$.jsx(wt,{index:g})]})});Ge.displayName="HeadlessModal";function yt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=yt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Se(){for(var e,t,n=0,r="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=yt(e))&&(r&&(r+=" "),r+=t);return r}var fn=Object.defineProperty,mn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ke=(e,t,n)=>(mn(e,typeof t!="symbol"?t+"":t,n),n);let pn=class{constructor(){Ke(this,"current",this.detect()),Ke(this,"handoffState","pending"),Ke(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Q=new pn;function Oe(e){return Q.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Pe(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function G(){let e=[],t={addEventListener(n,r,l,s){return n.addEventListener(r,l,s),t.add(()=>n.removeEventListener(r,l,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Pe(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=G();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let l of e.splice(r,1))l()}},dispose(){for(let n of e.splice(0))n()}};return t}function Ze(){let[e]=i.useState(G);return i.useEffect(()=>()=>e.dispose(),[e]),e}let L=(e,t)=>{Q.isServer?i.useEffect(e,t):i.useLayoutEffect(e,t)};function R(e){let t=i.useRef(e);return L(()=>{t.current=e},[e]),t}let O=function(e){let t=R(e);return i.useCallback((...n)=>t.current(...n),[t])},hn=i.createContext(void 0);function vn(){return i.useContext(hn)}function Je(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function K(e,t,...n){if(e in t){let l=t[e];return typeof l=="function"?l(...n):l}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,K),r}var Te=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Te||{}),Z=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Z||{});function D(){let e=wn();return i.useCallback(t=>gn({mergeRefs:e,...t}),[e])}function gn({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:l,visible:s=!0,name:u,mergeRefs:a}){a=a??yn;let o=xt(t,e);if(s)return Fe(o,n,r,u,a);let c=l??0;if(c&2){let{static:m=!1,...x}=o;if(m)return Fe(x,n,r,u,a)}if(c&1){let{unmount:m=!0,...x}=o;return K(m?0:1,{0(){return null},1(){return Fe({...x,hidden:!0,style:{display:"none"}},n,r,u,a)}})}return Fe(o,n,r,u,a)}function Fe(e,t={},n,r,l){let{as:s=n,children:u,refName:a="ref",...o}=Qe(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},m=typeof u=="function"?u(t):u;"className"in o&&o.className&&typeof o.className=="function"&&(o.className=o.className(t)),o["aria-labelledby"]&&o["aria-labelledby"]===o.id&&(o["aria-labelledby"]=void 0);let x={};if(t){let b=!1,y=[];for(let[f,g]of Object.entries(t))typeof g=="boolean"&&(b=!0),g===!0&&y.push(f.replace(/([A-Z])/g,d=>`-${d.toLowerCase()}`));if(b){x["data-headlessui-state"]=y.join(" ");for(let f of y)x[`data-${f}`]=""}}if(s===i.Fragment&&(Object.keys(ee(o)).length>0||Object.keys(ee(x)).length>0))if(!i.isValidElement(m)||Array.isArray(m)&&m.length>1){if(Object.keys(ee(o)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(ee(o)).concat(Object.keys(ee(x))).map(b=>` - ${b}`).join(`
1
+ (function(C,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("react/jsx-runtime"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime","axios","@inertiajs/react","@inertiajs/core","react-dom"],o):(C=typeof globalThis<"u"?globalThis:C||self,o(C.InertiaUIModal={},C.React,C.jsxRuntime,C.Axios,C.react,C.core,C.ReactDOM))})(this,function(C,o,$,xe,ne,en,tn){"use strict";var il=Object.defineProperty;var sl=(C,o,$)=>o in C?il(C,o,{enumerable:!0,configurable:!0,writable:!0,value:$}):C[o]=$;var B=(C,o,$)=>sl(C,typeof o!="symbol"?o+"":o,$);function nn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const se=nn(o),ae={type:"modal",navigate:!1,modal:{closeButton:!0,closeExplicitly:!1,maxWidth:"2xl",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white rounded",position:"center"},slideover:{closeButton:!0,closeExplicitly:!1,maxWidth:"md",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white min-h-screen",position:"right"}};class rn{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(ae))}put(t,n){if(typeof t=="object"){this.config={type:t.type??ae.type,navigate:t.navigate??ae.navigate,modal:{...ae.modal,...t.modal??{}},slideover:{...ae.slideover,...t.slideover??{}}};return}const r=t.split(".");let l=this.config;for(let s=0;s<r.length-1;s++)l=l[r[s]]=l[r[s]]||{};l[r[r.length-1]]=n}get(t){if(typeof t>"u")return this.config;const n=t.split(".");let r=this.config;for(const l of n){if(r[l]===void 0)return null;r=r[l]}return r}}const be=new rn,ln=()=>be.reset(),on=(e,t)=>be.put(e,t),$e=e=>be.get(e),re=(e,t)=>be.get(e?`slideover.${t}`:`modal.${t}`);function sn(e,t){return e=typeof e=="string"?new URL(e,window.location.origin):e,t=typeof t=="string"?new URL(t,window.location.origin):t,`${e.origin}${e.pathname}`==`${t.origin}${t.pathname}`}function Xe(e="inertiaui_modal_"){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${e}${crypto.randomUUID()}`:`${e}${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}function an(e,t){return Array.isArray(e)?e.filter(n=>!t.includes(n)):Object.keys(e).reduce((n,r)=>(t.includes(r)||(n[r]=e[r]),n),{})}function dt(e,t){return Array.isArray(e)?e.filter(n=>t.includes(n)):t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}function un(e){return Array.isArray(e)?e.filter(t=>t!==null):Object.keys(e).reduce((t,n)=>(n in e&&e[n]!==null&&(t[n]=e[n]),t),{})}function dn(e,t=3,n=10){return new Promise((r,l)=>{const s=e();if(s){r(s);return}let a=t*1e3/n;const u=setInterval(()=>{const i=e();i&&(clearInterval(u),r(i)),--a<=0&&(clearInterval(u),l(new Error("Condition not met in time")))},n)})}function ue(e){return e?(e=e.replace(/_/g,"-"),e=e.replace(/-+/g,"-"),/[A-Z]/.test(e)?(e=e.replace(/\s+/g,"").replace(/_/g,"").replace(/(?:^|\s|-)+([A-Za-z])/g,(t,n)=>n.toUpperCase()),e=e.replace(/(.)(?=[A-Z])/g,"$1-"),e.toLowerCase()):e):""}const Me=o.createContext(null);Me.displayName="ModalStackContext";let ct=null,ft=null,de=null,Ve=null,Ce=[],le={};const mt=({children:e})=>{const[t,n]=o.useState([]),[r,l]=o.useState({}),s=g=>{n(d=>{const p=g([...d]),h=w=>{var x;return p.length<2?!0:((x=p.map(v=>({id:v.id,shouldRender:v.shouldRender})).reverse().find(v=>v.shouldRender))==null?void 0:x.id)===w};return p.forEach((w,x)=>{p[x].onTopOfStack=h(w.id),p[x].getParentModal=()=>x<1?null:p.slice(0,x).reverse().find(v=>v.isOpen),p[x].getChildModal=()=>x===p.length-1?null:p.slice(x+1).find(v=>v.isOpen)}),p})};o.useEffect(()=>{Ce=t},[t]);class a{constructor(d,p,h,w,x){B(this,"show",()=>{s(d=>d.map(p=>(p.id===this.id&&!p.isOpen&&(p.isOpen=!0,p.shouldRender=!0),p)))});B(this,"setOpen",d=>{d?this.show():this.close()});B(this,"close",()=>{s(d=>d.map(p=>{var h;return p.id===this.id&&p.isOpen&&(Object.keys(p.listeners).forEach(w=>{p.off(w)}),p.isOpen=!1,(h=p.onCloseCallback)==null||h.call(p)),p}))});B(this,"afterLeave",()=>{this.isOpen||s(d=>{const p=d.map(h=>{var w;return h.id===this.id&&!h.isOpen&&(h.shouldRender=!1,(w=h.afterLeaveCallback)==null||w.call(h),h.afterLeaveCallback=null),h});return this.index===0?[]:p})});B(this,"on",(d,p)=>{d=ue(d),this.listeners[d]=this.listeners[d]??[],this.listeners[d].push(p)});B(this,"off",(d,p)=>{var h;d=ue(d),p?this.listeners[d]=((h=this.listeners[d])==null?void 0:h.filter(w=>w!==p))??[]:delete this.listeners[d]});B(this,"emit",(d,...p)=>{var h;(h=this.listeners[ue(d)])==null||h.forEach(w=>w(...p))});B(this,"registerEventListenersFromProps",d=>{const p=[];return Object.keys(d).filter(h=>h.startsWith("on")).forEach(h=>{const w=ue(h).replace(/^on-/,"");this.on(w,d[h]),p.push(()=>this.off(w,d[h]))}),()=>p.forEach(h=>h())});B(this,"reload",(d={})=>{var h;let p=Object.keys(this.response.props);d.only&&(p=dt(p,d.only)),d.except&&(p=an(p,d.except)),(h=this.response)!=null&&h.url&&xe.get(this.response.url,{headers:{Accept:"text/html, application/xhtml+xml","X-Inertia":!0,"X-Inertia-Partial-Component":this.response.component,"X-Inertia-Version":this.response.version,"X-Inertia-Partial-Data":p.join(","),"X-InertiaUI-Modal":Xe(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":de}}).then(w=>{this.updateProps(w.data.props)})});B(this,"updateProps",d=>{Object.assign(this.props,d),s(p=>p)});if(this.id=p.id??Xe(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=d,this.props=p.props,this.response=p,this.config=h??{},this.onCloseCallback=w,this.afterLeaveCallback=x,le[this.id]){this.config={...this.config,...le[this.id].config??{}};const v=le[this.id].onClose,M=le[this.id].onAfterLeave;v&&(this.onCloseCallback=w?()=>{w(),v()}:v),M&&(this.afterLeaveCallback=x?()=>{x(),M()}:M),delete le[this.id]}this.index=-1,this.getParentModal=()=>null,this.getChildModal=()=>null,this.onTopOfStack=!0}static generateId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`inertiaui_modal_${crypto.randomUUID()}`:`inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}}const u=(g,d={},p=null,h=null)=>ft(g.component).then(w=>i(w,g,d,p,h)),i=(g,d,p,h,w)=>{const x=new a(g,d,p,h,w);return x.index=t.length,s(v=>[...v,x]),x.show(),x};function c(g,d,p,h){if(!r[g])throw new Error(`The local modal "${g}" has not been registered.`);const w=i(null,{},d,p,h);return w.name=g,r[g].callback(w),w}const m=(g,d={})=>E(g,d.method??"get",d.data??{},d.headers??{},d.config??{},d.onClose,d.onAfterLeave,d.queryStringArrayFormat??"brackets",d.navigate??$e("navigate")).then(p=>{const h=d.listeners??{};return Object.keys(h).forEach(w=>{const x=ue(w);p.on(x,h[w])}),p}),E=(g,d,p={},h={},w={},x=null,v=null,M="brackets",P=!1)=>{const I=Xe();return new Promise((U,F)=>{if(g.startsWith("#")){U(c(g.substring(1),w,x,v));return}const[A,H]=en.mergeDataIntoQueryString(d,g||"",p,M);let W=P&&t.length===0;if(t.length===0&&(de=typeof window<"u"?window.location.href:""),h={...h,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":ct,"X-InertiaUI-Modal":I,"X-InertiaUI-Modal-Use-Router":W?1:0,"X-InertiaUI-Modal-Base-Url":de},W)return Ve=null,le[I]={config:w,onClose:x,onAfterLeave:v},ne.router.visit(A,{method:d,data:H,headers:h,preserveScroll:!0,preserveState:!0,onError:F,onFinish:()=>{dn(()=>Ve).then(U)}});xe({url:A,method:d,data:H,headers:h}).then(S=>U(u(S.data,w,x,v))).catch(S=>{F(S)})})},f={stack:t,localModals:r,push:i,pushFromResponseData:u,length:()=>Ce.length,closeAll:()=>{Ce.reverse().forEach(g=>g.close())},reset:()=>s(()=>[]),visit:E,visitModal:m,registerLocalModal:(g,d)=>{l(p=>({...p,[g]:{name:g,callback:d}}))},removeLocalModal:g=>{l(d=>{const p={...d};return delete p[g],p})}};return $.jsx(Me.Provider,{value:f,children:e})},ce=()=>{const e=o.useContext(Me);if(e===null)throw new Error("useModalStack must be used within a ModalStackProvider");return e},pt=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],ht=e=>{e.initialPage&&(ct=e.initialPage.version),e.resolveComponent&&(ft=e.resolveComponent)},cn=(e,t)=>{ht(t);const n=({Component:r,props:l,key:s})=>{const a=()=>{const u=o.createElement(r,{key:s,...l});return typeof r.layout=="function"?r.layout(u):Array.isArray(r.layout)?r.layout.concat(u).reverse().reduce((c,m)=>o.createElement(m,l,c)):u};return $.jsxs($.Fragment,{children:[a(),$.jsx(vt,{})]})};return $.jsx(mt,{children:$.jsx(e,{...t,children:n})})},vt=({children:e})=>{var u;const t=o.useContext(Me);let n=!1,r=!1;o.useEffect(()=>ne.router.on("start",()=>n=!0),[]),o.useEffect(()=>ne.router.on("finish",()=>n=!1),[]),o.useEffect(()=>ne.router.on("navigate",function(i){const c=i.detail.page.props._inertiaui_modal;if(!c){r&&t.closeAll();return}r=c,de=c.baseUrl,t.pushFromResponseData(c,{},()=>{if(!c.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!n&&window.location.href!==c.baseUrl&&ne.router.visit(c.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(m=>{Ve=m})}),[]);const l=i=>(Ce.length&&(i.headers["X-InertiaUI-Modal-Base-Url"]=de),i);o.useEffect(()=>(xe.interceptors.request.use(l),()=>xe.interceptors.request.eject(l)),[]);const s=ne.usePage(),a=o.useRef();return o.useEffect(()=>{var m,E;const i=(m=s.props)==null?void 0:m._inertiaui_modal,c=a.current;a.current=i,i&&c&&i.component===c.component&&sn(i.url,c.url)&&((E=t.stack[0])==null||E.updateProps(i.props??{}))},[(u=s.props)==null?void 0:u._inertiaui_modal]),$.jsxs($.Fragment,{children:[e,t.stack.length>0&&$.jsx(gt,{index:0})]})},Ye=o.createContext(null);Ye.displayName="ModalIndexContext";const ze=()=>{const e=o.useContext(Ye);if(e===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return e},gt=({index:e})=>{const{stack:t}=ce(),n=o.useMemo(()=>t[e],[t,e]);return(n==null?void 0:n.component)&&$.jsx(Ye.Provider,{value:e,children:$.jsx(n.component,{...n.props,onModalEvent:(...r)=>n.emit(...r)})})},Ge=o.forwardRef(({name:e,children:t,onFocus:n=null,onBlur:r=null,onClose:l=null,onSuccess:s=null,...a},u)=>{const i=ze(),{stack:c,registerLocalModal:m,removeLocalModal:E}=ce(),[b,y]=o.useState(null),f=o.useMemo(()=>e?b:c[i],[e,b,i,c]),g=o.useMemo(()=>{var v;return(v=c.find(M=>M.shouldRender&&M.index>(f==null?void 0:f.index)))==null?void 0:v.index},[i,c]),d=o.useMemo(()=>(f==null?void 0:f.config.slideover)??a.slideover??$e("type")==="slideover",[a.slideover]),p=o.useMemo(()=>({slideover:d,closeButton:a.closeButton??re(d,"closeButton"),closeExplicitly:a.closeExplicitly??re(d,"closeExplicitly"),maxWidth:a.maxWidth??re(d,"maxWidth"),paddingClasses:a.paddingClasses??re(d,"paddingClasses"),panelClasses:a.panelClasses??re(d,"panelClasses"),position:a.position??re(d,"position"),...f==null?void 0:f.config}),[a,f==null?void 0:f.config]);o.useEffect(()=>{if(e){let v=null;return m(e,M=>{v=M.registerEventListenersFromProps(a),y(M)}),()=>{v==null||v(),v=null,E(e)}}return f.registerEventListenersFromProps(a)},[e]);const h=o.useRef(f);o.useEffect(()=>{h.current=f},[f]),o.useEffect(()=>{f!==null&&(f.isOpen?s==null||s():l==null||l())},[f==null?void 0:f.isOpen]);const[w,x]=o.useState(!1);return o.useEffect(()=>{w&&f!==null&&f.isOpen&&(f.onTopOfStack?n==null||n():r==null||r()),x(!0)},[f==null?void 0:f.onTopOfStack]),o.useImperativeHandle(u,()=>({afterLeave:()=>{var v;return(v=h.current)==null?void 0:v.afterLeave()},close:()=>{var v;return(v=h.current)==null?void 0:v.close()},emit:(...v)=>{var M;return(M=h.current)==null?void 0:M.emit(...v)},getChildModal:()=>{var v;return(v=h.current)==null?void 0:v.getChildModal()},getParentModal:()=>{var v;return(v=h.current)==null?void 0:v.getParentModal()},reload:(...v)=>{var M;return(M=h.current)==null?void 0:M.reload(...v)},setOpen:()=>{var v;return(v=h.current)==null?void 0:v.setOpen()},get id(){var v;return(v=h.current)==null?void 0:v.id},get index(){var v;return(v=h.current)==null?void 0:v.index},get isOpen(){var v;return(v=h.current)==null?void 0:v.isOpen},get config(){var v;return(v=h.current)==null?void 0:v.config},get modalContext(){return h.current},get onTopOfStack(){var v;return(v=h.current)==null?void 0:v.onTopOfStack},get shouldRender(){var v;return(v=h.current)==null?void 0:v.shouldRender}}),[f]),(f==null?void 0:f.shouldRender)&&$.jsxs($.Fragment,{children:[typeof t=="function"?t({afterLeave:f.afterLeave,close:f.close,config:p,emit:f.emit,getChildModal:f.getChildModal,getParentModal:f.getParentModal,id:f.id,index:f.index,isOpen:f.isOpen,modalContext:f,onTopOfStack:f.onTopOfStack,reload:f.reload,setOpen:f.setOpen,shouldRender:f.shouldRender}):t,g&&$.jsx(gt,{index:g})]})});Ge.displayName="HeadlessModal";function wt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=wt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Se(){for(var e,t,n=0,r="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=wt(e))&&(r&&(r+=" "),r+=t);return r}var fn=Object.defineProperty,mn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ke=(e,t,n)=>(mn(e,typeof t!="symbol"?t+"":t,n),n);let pn=class{constructor(){Ke(this,"current",this.detect()),Ke(this,"handoffState","pending"),Ke(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},J=new pn;function Oe(e){return J.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Pe(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function z(){let e=[],t={addEventListener(n,r,l,s){return n.addEventListener(r,l,s),t.add(()=>n.removeEventListener(r,l,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Pe(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=z();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let l of e.splice(r,1))l()}},dispose(){for(let n of e.splice(0))n()}};return t}function Ze(){let[e]=o.useState(z);return o.useEffect(()=>()=>e.dispose(),[e]),e}let L=(e,t)=>{J.isServer?o.useEffect(e,t):o.useLayoutEffect(e,t)};function Q(e){let t=o.useRef(e);return L(()=>{t.current=e},[e]),t}let O=function(e){let t=Q(e);return o.useCallback((...n)=>t.current(...n),[t])},hn=o.createContext(void 0);function vn(){return o.useContext(hn)}function Je(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function G(e,t,...n){if(e in t){let l=t[e];return typeof l=="function"?l(...n):l}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,G),r}var Te=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Te||{}),K=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(K||{});function D(){let e=wn();return o.useCallback(t=>gn({mergeRefs:e,...t}),[e])}function gn({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:l,visible:s=!0,name:a,mergeRefs:u}){u=u??yn;let i=yt(t,e);if(s)return Fe(i,n,r,a,u);let c=l??0;if(c&2){let{static:m=!1,...E}=i;if(m)return Fe(E,n,r,a,u)}if(c&1){let{unmount:m=!0,...E}=i;return G(m?0:1,{0(){return null},1(){return Fe({...E,hidden:!0,style:{display:"none"}},n,r,a,u)}})}return Fe(i,n,r,a,u)}function Fe(e,t={},n,r,l){let{as:s=n,children:a,refName:u="ref",...i}=Qe(e,["unmount","static"]),c=e.ref!==void 0?{[u]:e.ref}:{},m=typeof a=="function"?a(t):a;"className"in i&&i.className&&typeof i.className=="function"&&(i.className=i.className(t)),i["aria-labelledby"]&&i["aria-labelledby"]===i.id&&(i["aria-labelledby"]=void 0);let E={};if(t){let b=!1,y=[];for(let[f,g]of Object.entries(t))typeof g=="boolean"&&(b=!0),g===!0&&y.push(f.replace(/([A-Z])/g,d=>`-${d.toLowerCase()}`));if(b){E["data-headlessui-state"]=y.join(" ");for(let f of y)E[`data-${f}`]=""}}if(s===o.Fragment&&(Object.keys(R(i)).length>0||Object.keys(R(E)).length>0))if(!o.isValidElement(m)||Array.isArray(m)&&m.length>1){if(Object.keys(R(i)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(R(i)).concat(Object.keys(R(E))).map(b=>` - ${b}`).join(`
2
2
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(b=>` - ${b}`).join(`
3
3
  `)].join(`
4
- `))}else{let b=m.props,y=b==null?void 0:b.className,f=typeof y=="function"?(...p)=>Je(y(...p),o.className):Je(y,o.className),g=f?{className:f}:{},d=xt(m.props,ee(Qe(o,["ref"])));for(let p in x)p in d&&delete x[p];return i.cloneElement(m,Object.assign({},d,x,c,{ref:l(xn(m),c.ref)},g))}return i.createElement(s,Object.assign({},Qe(o,["ref"]),s!==i.Fragment&&c,s!==i.Fragment&&x),m)}function wn(){let e=i.useRef([]),t=i.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function yn(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function xt(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let l in r)l.startsWith("on")&&typeof r[l]=="function"?(n[l]!=null||(n[l]=[]),n[l].push(r[l])):t[l]=r[l];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[l=>{var s;return(s=l==null?void 0:l.preventDefault)==null?void 0:s.call(l)}]);for(let r in n)Object.assign(t,{[r](l,...s){let u=n[r];for(let a of u){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;a(l,...s)}}});return t}function k(e){var t;return Object.assign(i.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ee(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Qe(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function xn(e){return i.version.split(".")[0]>="19"?e.props.ref:e.ref}let En="span";var Le=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Le||{});function bn(e,t){var n;let{features:r=1,...l}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=l["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return D()({ourProps:s,theirProps:l,slot:{},defaultTag:En,name:"Hidden"})}let Re=k(bn),Et=Symbol();function $n(e,t=!0){return Object.assign(e,{[Et]:t})}function q(...e){let t=i.useRef(e);i.useEffect(()=>{t.current=e},[e]);let n=O(r=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(r):l.current=r)});return e.every(r=>r==null||(r==null?void 0:r[Et]))?void 0:n}let et=i.createContext(null);et.displayName="DescriptionContext";function bt(){let e=i.useContext(et);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,bt),t}return e}function Mn(){let[e,t]=i.useState([]);return[e.length>0?e.join(" "):void 0,i.useMemo(()=>function(n){let r=O(s=>(t(u=>[...u,s]),()=>t(u=>{let a=u.slice(),o=a.indexOf(s);return o!==-1&&a.splice(o,1),a}))),l=i.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props,value:n.value}),[r,n.slot,n.name,n.props,n.value]);return i.createElement(et.Provider,{value:l},n.children)},[t])]}let Cn="p";function Sn(e,t){let n=i.useId(),r=vn(),{id:l=`headlessui-description-${n}`,...s}=e,u=bt(),a=q(t);L(()=>u.register(l),[l,u.register]);let o=r||!1,c=i.useMemo(()=>({...u.slot,disabled:o}),[u.slot,o]),m={ref:a,...u.props,id:l};return D()({ourProps:m,theirProps:s,slot:c,defaultTag:Cn,name:u.name||"Description"})}let On=k(Sn),Pn=Object.assign(On,{});var $t=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))($t||{});let Tn=i.createContext(()=>{});function Fn({value:e,children:t}){return i.createElement(Tn.Provider,{value:e},t)}let Ln=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};function Mt(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(l){return r.add(l),()=>r.delete(l)},dispatch(l,...s){let u=t[l].call(n,...s);u&&(n=u,r.forEach(a=>a()))}}}function Ct(e){return i.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let kn=new Ln(()=>Mt(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let n=this.slice();return n.splice(t,1),n}}));function ie(e,t){let n=kn.get(t),r=i.useId(),l=Ct(n);if(L(()=>{if(e)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,e]),!e)return!1;let s=l.indexOf(r),u=l.length;return s===-1&&(s=u,u+=1),s===u-1}let tt=new Map,fe=new Map;function St(e){var t;let n=(t=fe.get(e))!=null?t:0;return fe.set(e,n+1),n!==0?()=>Ot(e):(tt.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Ot(e))}function Ot(e){var t;let n=(t=fe.get(e))!=null?t:1;if(n===1?fe.delete(e):fe.set(e,n-1),n!==1)return;let r=tt.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,tt.delete(e))}function Nn(e,{allowed:t,disallowed:n}={}){let r=ie(e,"inert-others");L(()=>{var l,s;if(!r)return;let u=G();for(let o of(l=n==null?void 0:n())!=null?l:[])o&&u.add(St(o));let a=(s=t==null?void 0:t())!=null?s:[];for(let o of a){if(!o)continue;let c=Oe(o);if(!c)continue;let m=o.parentElement;for(;m&&m!==c.body;){for(let x of m.children)a.some(b=>x.contains(b))||u.add(St(x));m=m.parentElement}}return u.dispose},[r,t,n])}function An(e,t,n){let r=R(l=>{let s=l.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});i.useEffect(()=>{if(!e)return;let l=t===null?null:t instanceof HTMLElement?t:t.current;if(!l)return;let s=G();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>r.current(l));u.observe(l),s.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>r.current(l));u.observe(l),s.add(()=>u.disconnect())}return()=>s.dispose()},[t,r,e])}let ke=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),In=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var V=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(V||{}),nt=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(nt||{}),Dn=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Dn||{});function jn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ke)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Un(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(In)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Pt=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Pt||{});function Hn(e,t=0){var n;return e===((n=Oe(e))==null?void 0:n.body)?!1:K(t,{0(){return e.matches(ke)},1(){let r=e;for(;r!==null;){if(r.matches(ke))return!0;r=r.parentElement}return!1}})}var Wn=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Wn||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Y(e){e==null||e.focus({preventScroll:!0})}let _n=["textarea","input"].join(",");function Bn(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,_n))!=null?n:!1}function qn(e,t=n=>n){return e.slice().sort((n,r)=>{let l=t(n),s=t(r);if(l===null||s===null)return 0;let u=l.compareDocumentPosition(s);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function me(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:l=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,u=Array.isArray(e)?n?qn(e):e:t&64?Un(e):jn(e);l.length>0&&u.length>1&&(u=u.filter(y=>!l.some(f=>f!=null&&"current"in f?(f==null?void 0:f.current)===y:f===y))),r=r??s.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),o=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,u.indexOf(r))-1;if(t&4)return Math.max(0,u.indexOf(r))+1;if(t&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},m=0,x=u.length,b;do{if(m>=x||m+x<=0)return 0;let y=o+m;if(t&16)y=(y+x)%x;else{if(y<0)return 3;if(y>=x)return 1}b=u[y],b==null||b.focus(c),m+=a}while(b!==s.activeElement);return t&6&&Bn(b)&&b.select(),2}function Tt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Xn(){return/Android/gi.test(window.navigator.userAgent)}function Vn(){return Tt()||Xn()}function pe(e,t,n,r){let l=R(n);i.useEffect(()=>{if(!e)return;function s(u){l.current(u)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function Ft(e,t,n,r){let l=R(n);i.useEffect(()=>{if(!e)return;function s(u){l.current(u)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Lt=30;function Yn(e,t,n){let r=ie(e,"outside-click"),l=R(n),s=i.useCallback(function(o,c){if(o.defaultPrevented)return;let m=c(o);if(m===null||!m.getRootNode().contains(m)||!m.isConnected)return;let x=function b(y){return typeof y=="function"?b(y()):Array.isArray(y)||y instanceof Set?y:[y]}(t);for(let b of x)if(b!==null&&(b.contains(m)||o.composed&&o.composedPath().includes(b)))return;return!Hn(m,Pt.Loose)&&m.tabIndex!==-1&&o.preventDefault(),l.current(o,m)},[l,t]),u=i.useRef(null);pe(r,"pointerdown",o=>{var c,m;u.current=((m=(c=o.composedPath)==null?void 0:c.call(o))==null?void 0:m[0])||o.target},!0),pe(r,"mousedown",o=>{var c,m;u.current=((m=(c=o.composedPath)==null?void 0:c.call(o))==null?void 0:m[0])||o.target},!0),pe(r,"click",o=>{Vn()||u.current&&(s(o,()=>u.current),u.current=null)},!0);let a=i.useRef({x:0,y:0});pe(r,"touchstart",o=>{a.current.x=o.touches[0].clientX,a.current.y=o.touches[0].clientY},!0),pe(r,"touchend",o=>{let c={x:o.changedTouches[0].clientX,y:o.changedTouches[0].clientY};if(!(Math.abs(c.x-a.current.x)>=Lt||Math.abs(c.y-a.current.y)>=Lt))return s(o,()=>o.target instanceof HTMLElement?o.target:null)},!0),Ft(r,"blur",o=>s(o,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function he(...e){return i.useMemo(()=>Oe(...e),[...e])}function kt(e,t,n,r){let l=R(n);i.useEffect(()=>{e=e??window;function s(u){l.current(u)}return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)},[e,t,r])}function zn(){let e;return{before({doc:t}){var n;let r=t.documentElement,l=(n=t.defaultView)!=null?n:window;e=Math.max(0,l.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,l=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-l);n.style(r,"paddingRight",`${s}px`)}}}function Gn(){return Tt()?{before({doc:e,d:t,meta:n}){function r(l){return n.containers.flatMap(s=>s()).some(s=>s.contains(l))}t.microTask(()=>{var l;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=G();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let s=(l=window.scrollY)!=null?l:window.pageYOffset,u=null;t.addEventListener(e,"click",a=>{if(a.target instanceof HTMLElement)try{let o=a.target.closest("a");if(!o)return;let{hash:c}=new URL(o.href),m=e.querySelector(c);m&&!r(m)&&(u=m)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(a.target instanceof HTMLElement)if(r(a.target)){let o=a.target;for(;o.parentElement&&r(o.parentElement);)o=o.parentElement;t.style(o,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(a.target instanceof HTMLElement){if(a.target.tagName==="INPUT")return;if(r(a.target)){let o=a.target;for(;o.parentElement&&o.dataset.headlessuiPortal!==""&&!(o.scrollHeight>o.clientHeight||o.scrollWidth>o.clientWidth);)o=o.parentElement;o.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let o=(a=window.scrollY)!=null?a:window.pageYOffset;s!==o&&window.scrollTo(0,s),u&&u.isConnected&&(u.scrollIntoView({block:"nearest"}),u=null)})})}}:{}}function Kn(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Zn(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let te=Mt(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:G(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:Zn(n)},l=[Gn(),zn(),Kn()];l.forEach(({before:s})=>s==null?void 0:s(r)),l.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});te.subscribe(()=>{let e=te.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",l=n.count!==0;(l&&!r||!l&&r)&&te.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&te.dispatch("TEARDOWN",n)}});function Jn(e,t,n=()=>({containers:[]})){let r=Ct(te),l=t?r.get(t):void 0,s=l?l.count>0:!1;return L(()=>{if(!(!t||!e))return te.dispatch("PUSH",t,n),()=>te.dispatch("POP",t,n)},[e,t]),s}function Qn(e,t,n=()=>[document.body]){let r=ie(e,"scroll-lock");Jn(r,t,l=>{var s;return{containers:[...(s=l.containers)!=null?s:[],n]}})}function Rn(e=0){let[t,n]=i.useState(e),r=i.useCallback(o=>n(o),[t]),l=i.useCallback(o=>n(c=>c|o),[t]),s=i.useCallback(o=>(t&o)===o,[t]),u=i.useCallback(o=>n(c=>c&~o),[n]),a=i.useCallback(o=>n(c=>c^o),[n]);return{flags:t,setFlag:r,addFlag:l,hasFlag:s,removeFlag:u,toggleFlag:a}}var Nt,At;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Nt=process==null?void 0:process.env)==null?void 0:Nt.NODE_ENV)==="test"&&typeof((At=Element==null?void 0:Element.prototype)==null?void 0:At.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
5
- `)),[]});var er=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(er||{});function tr(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function nr(e,t,n,r){let[l,s]=i.useState(n),{hasFlag:u,addFlag:a,removeFlag:o}=Rn(e&&l?3:0),c=i.useRef(!1),m=i.useRef(!1),x=Ze();return L(()=>{var b;if(e){if(n&&s(!0),!t){n&&a(3);return}return(b=r==null?void 0:r.start)==null||b.call(r,n),rr(t,{inFlight:c,prepare(){m.current?m.current=!1:m.current=c.current,c.current=!0,!m.current&&(n?(a(3),o(4)):(a(4),o(2)))},run(){m.current?n?(o(3),a(4)):(o(4),a(3)):n?o(1):a(1)},done(){var y;m.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,o(7),n||s(!1),(y=r==null?void 0:r.end)==null||y.call(r,n))}})}},[e,n,t,x]),e?[l,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function rr(e,{prepare:t,run:n,done:r,inFlight:l}){let s=G();return ir(e,{prepare:t,inFlight:l}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(lr(e,r))})}),s.dispose}function lr(e,t){var n,r;let l=G();if(!e)return l.dispose;let s=!1;l.add(()=>{s=!0});let u=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return u.length===0?(t(),l.dispose):(Promise.allSettled(u.map(a=>a.finished)).then(()=>{s||t()}),l.dispose)}function ir(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function rt(e,t){let n=i.useRef([]),r=O(e);i.useEffect(()=>{let l=[...n.current];for(let[s,u]of t.entries())if(n.current[s]!==u){let a=r(t,l);return n.current=t,a}},[r,...t])}let Ne=i.createContext(null);Ne.displayName="OpenClosedContext";var j=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(j||{});function Ae(){return i.useContext(Ne)}function or({value:e,children:t}){return i.createElement(Ne.Provider,{value:e},t)}function sr({children:e}){return i.createElement(Ne.Provider,{value:null},e)}function ur(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let J=[];ur(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||J[0]===t.target)return;let n=t.target;n=n.closest(ke),J.unshift(n??t.target),J=J.filter(r=>r!=null&&r.isConnected),J.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function It(e){let t=O(e),n=i.useRef(!1);i.useEffect(()=>(n.current=!1,()=>{n.current=!0,Pe(()=>{n.current&&t()})}),[t])}function ar(){let e=typeof document>"u";return"useSyncExternalStore"in se?(t=>t.useSyncExternalStore)(se)(()=>()=>{},()=>!1,()=>!e):!1}function ve(){let e=ar(),[t,n]=se.useState(Q.isHandoffComplete);return t&&Q.isHandoffComplete===!1&&n(!1),se.useEffect(()=>{t!==!0&&n(!0)},[t]),se.useEffect(()=>Q.handoff(),[]),e?!1:t}let Dt=i.createContext(!1);function dr(){return i.useContext(Dt)}function jt(e){return i.createElement(Dt.Provider,{value:e.force},e.children)}function cr(e){let t=dr(),n=i.useContext(Ht),r=he(e),[l,s]=i.useState(()=>{var u;if(!t&&n!==null)return(u=n.current)!=null?u:null;if(Q.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let o=r.createElement("div");return o.setAttribute("id","headlessui-portal-root"),r.body.appendChild(o)});return i.useEffect(()=>{l!==null&&(r!=null&&r.body.contains(l)||r==null||r.body.appendChild(l))},[l,r]),i.useEffect(()=>{t||n!==null&&s(n.current)},[n,s,t]),l}let Ut=i.Fragment,fr=k(function(e,t){let n=e,r=i.useRef(null),l=q($n(x=>{r.current=x}),t),s=he(r),u=cr(r),[a]=i.useState(()=>{var x;return Q.isServer?null:(x=s==null?void 0:s.createElement("div"))!=null?x:null}),o=i.useContext(lt),c=ve();L(()=>{!u||!a||u.contains(a)||(a.setAttribute("data-headlessui-portal",""),u.appendChild(a))},[u,a]),L(()=>{if(a&&o)return o.register(a)},[o,a]),It(()=>{var x;!u||!a||(a instanceof Node&&u.contains(a)&&u.removeChild(a),u.childNodes.length<=0&&((x=u.parentElement)==null||x.removeChild(u)))});let m=D();return c?!u||!a?null:nn.createPortal(m({ourProps:{ref:l},theirProps:n,slot:{},defaultTag:Ut,name:"Portal"}),a):null});function mr(e,t){let n=q(t),{enabled:r=!0,...l}=e,s=D();return r?i.createElement(fr,{...l,ref:n}):s({ourProps:{ref:n},theirProps:l,slot:{},defaultTag:Ut,name:"Portal"})}let pr=i.Fragment,Ht=i.createContext(null);function hr(e,t){let{target:n,...r}=e,l={ref:q(t)},s=D();return i.createElement(Ht.Provider,{value:n},s({ourProps:l,theirProps:r,defaultTag:pr,name:"Popover.Group"}))}let lt=i.createContext(null);function vr(){let e=i.useContext(lt),t=i.useRef([]),n=O(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=O(s=>{let u=t.current.indexOf(s);u!==-1&&t.current.splice(u,1),e&&e.unregister(s)}),l=i.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,i.useMemo(()=>function({children:s}){return i.createElement(lt.Provider,{value:l},s)},[l])]}let gr=k(mr),Wt=k(hr),wr=Object.assign(gr,{Group:Wt});function yr(e,t=typeof document<"u"?document.defaultView:null,n){let r=ie(e,"escape");kt(t,"keydown",l=>{r&&(l.defaultPrevented||l.key===$t.Escape&&n(l))})}function xr(){var e;let[t]=i.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,r]=i.useState((e=t==null?void 0:t.matches)!=null?e:!1);return L(()=>{if(!t)return;function l(s){r(s.matches)}return t.addEventListener("change",l),()=>t.removeEventListener("change",l)},[t]),n}function Er({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=he(n),l=O(()=>{var s,u;let a=[];for(let o of e)o!==null&&(o instanceof HTMLElement?a.push(o):"current"in o&&o.current instanceof HTMLElement&&a.push(o.current));if(t!=null&&t.current)for(let o of t.current)a.push(o);for(let o of(s=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?s:[])o!==document.body&&o!==document.head&&o instanceof HTMLElement&&o.id!=="headlessui-portal-root"&&(n&&(o.contains(n)||o.contains((u=n==null?void 0:n.getRootNode())==null?void 0:u.host))||a.some(c=>o.contains(c))||a.push(o));return a});return{resolveContainers:l,contains:O(s=>l().some(u=>u.contains(s)))}}let _t=i.createContext(null);function Bt({children:e,node:t}){let[n,r]=i.useState(null),l=qt(t??n);return i.createElement(_t.Provider,{value:l},e,l===null&&i.createElement(Re,{features:Le.Hidden,ref:s=>{var u,a;if(s){for(let o of(a=(u=Oe(s))==null?void 0:u.querySelectorAll("html > *, body > *"))!=null?a:[])if(o!==document.body&&o!==document.head&&o instanceof HTMLElement&&o!=null&&o.contains(s)){r(o);break}}}}))}function qt(e=null){var t;return(t=i.useContext(_t))!=null?t:e}function it(){let e=i.useRef(!1);return L(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ge=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ge||{});function br(){let e=i.useRef(0);return Ft(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Xt(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}let $r="div";var ne=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(ne||{});function Mr(e,t){let n=i.useRef(null),r=q(n,t),{initialFocus:l,initialFocusFallback:s,containers:u,features:a=15,...o}=e;ve()||(a=0);let c=he(n);Pr(a,{ownerDocument:c});let m=Tr(a,{ownerDocument:c,container:n,initialFocus:l,initialFocusFallback:s});Fr(a,{ownerDocument:c,container:n,containers:u,previousActiveElement:m});let x=br(),b=O(h=>{let w=n.current;w&&(E=>E())(()=>{K(x.current,{[ge.Forwards]:()=>{me(w,V.First,{skipElements:[h.relatedTarget,s]})},[ge.Backwards]:()=>{me(w,V.Last,{skipElements:[h.relatedTarget,s]})}})})}),y=ie(!!(a&2),"focus-trap#tab-lock"),f=Ze(),g=i.useRef(!1),d={ref:r,onKeyDown(h){h.key=="Tab"&&(g.current=!0,f.requestAnimationFrame(()=>{g.current=!1}))},onBlur(h){if(!(a&4))return;let w=Xt(u);n.current instanceof HTMLElement&&w.add(n.current);let E=h.relatedTarget;E instanceof HTMLElement&&E.dataset.headlessuiFocusGuard!=="true"&&(Vt(w,E)||(g.current?me(n.current,K(x.current,{[ge.Forwards]:()=>V.Next,[ge.Backwards]:()=>V.Previous})|V.WrapAround,{relativeTo:h.target}):h.target instanceof HTMLElement&&Y(h.target)))}},p=D();return i.createElement(i.Fragment,null,y&&i.createElement(Re,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:b,features:Le.Focusable}),p({ourProps:d,theirProps:o,defaultTag:$r,name:"FocusTrap"}),y&&i.createElement(Re,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:b,features:Le.Focusable}))}let Cr=k(Mr),Sr=Object.assign(Cr,{features:ne});function Or(e=!0){let t=i.useRef(J.slice());return rt(([n],[r])=>{r===!0&&n===!1&&Pe(()=>{t.current.splice(0)}),r===!1&&n===!0&&(t.current=J.slice())},[e,J,t]),O(()=>{var n;return(n=t.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function Pr(e,{ownerDocument:t}){let n=!!(e&8),r=Or(n);rt(()=>{n||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&Y(r())},[n]),It(()=>{n&&Y(r())})}function Tr(e,{ownerDocument:t,container:n,initialFocus:r,initialFocusFallback:l}){let s=i.useRef(null),u=ie(!!(e&1),"focus-trap#initial-focus"),a=it();return rt(()=>{if(e===0)return;if(!u){l!=null&&l.current&&Y(l.current);return}let o=n.current;o&&Pe(()=>{if(!a.current)return;let c=t==null?void 0:t.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===c){s.current=c;return}}else if(o.contains(c)){s.current=c;return}if(r!=null&&r.current)Y(r.current);else{if(e&16){if(me(o,V.First|V.AutoFocus)!==nt.Error)return}else if(me(o,V.First)!==nt.Error)return;if(l!=null&&l.current&&(Y(l.current),(t==null?void 0:t.activeElement)===l.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}s.current=t==null?void 0:t.activeElement})},[l,u,e]),s}function Fr(e,{ownerDocument:t,container:n,containers:r,previousActiveElement:l}){let s=it(),u=!!(e&4);kt(t==null?void 0:t.defaultView,"focus",a=>{if(!u||!s.current)return;let o=Xt(r);n.current instanceof HTMLElement&&o.add(n.current);let c=l.current;if(!c)return;let m=a.target;m&&m instanceof HTMLElement?Vt(o,m)?(l.current=m,Y(m)):(a.preventDefault(),a.stopPropagation(),Y(c)):Y(l.current)},!0)}function Vt(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function Yt(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Gt)!==i.Fragment||i.Children.count(e.children)===1}let Ie=i.createContext(null);Ie.displayName="TransitionContext";var Lr=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Lr||{});function kr(){let e=i.useContext(Ie);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Nr(){let e=i.useContext(De);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let De=i.createContext(null);De.displayName="NestingContext";function je(e){return"children"in e?je(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function zt(e,t){let n=R(e),r=i.useRef([]),l=it(),s=Ze(),u=O((y,f=Z.Hidden)=>{let g=r.current.findIndex(({el:d})=>d===y);g!==-1&&(K(f,{[Z.Unmount](){r.current.splice(g,1)},[Z.Hidden](){r.current[g].state="hidden"}}),s.microTask(()=>{var d;!je(r)&&l.current&&((d=n.current)==null||d.call(n))}))}),a=O(y=>{let f=r.current.find(({el:g})=>g===y);return f?f.state!=="visible"&&(f.state="visible"):r.current.push({el:y,state:"visible"}),()=>u(y,Z.Unmount)}),o=i.useRef([]),c=i.useRef(Promise.resolve()),m=i.useRef({enter:[],leave:[]}),x=O((y,f,g)=>{o.current.splice(0),t&&(t.chains.current[f]=t.chains.current[f].filter(([d])=>d!==y)),t==null||t.chains.current[f].push([y,new Promise(d=>{o.current.push(d)})]),t==null||t.chains.current[f].push([y,new Promise(d=>{Promise.all(m.current[f].map(([p,h])=>h)).then(()=>d())})]),f==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(f)):g(f)}),b=O((y,f,g)=>{Promise.all(m.current[f].splice(0).map(([d,p])=>p)).then(()=>{var d;(d=o.current.shift())==null||d()}).then(()=>g(f))});return i.useMemo(()=>({children:r,register:a,unregister:u,onStart:x,onStop:b,wait:c,chains:m}),[a,u,r,x,b,m,c])}let Gt=i.Fragment,Kt=Te.RenderStrategy;function Ar(e,t){var n,r;let{transition:l=!0,beforeEnter:s,afterEnter:u,beforeLeave:a,afterLeave:o,enter:c,enterFrom:m,enterTo:x,entered:b,leave:y,leaveFrom:f,leaveTo:g,...d}=e,[p,h]=i.useState(null),w=i.useRef(null),E=Yt(e),v=q(...E?[w,t,h]:t===null?[]:[t]),M=(n=d.unmount)==null||n?Z.Unmount:Z.Hidden,{show:P,appear:A,initial:U}=kr(),[F,I]=i.useState(P?"visible":"hidden"),H=Nr(),{register:W,unregister:S}=H;L(()=>W(w),[W,w]),L(()=>{if(M===Z.Hidden&&w.current){if(P&&F!=="visible"){I("visible");return}return K(F,{hidden:()=>S(w),visible:()=>W(w)})}},[F,w,W,S,P,M]);let _=ve();L(()=>{if(E&&_&&F==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,F,_,E]);let He=U&&!A,We=A&&P&&U,we=i.useRef(!1),X=zt(()=>{we.current||(I("hidden"),S(w))},H),_e=O(at=>{we.current=!0;let qe=at?"enter":"leave";X.onStart(w,qe,xe=>{xe==="enter"?s==null||s():xe==="leave"&&(a==null||a())})}),T=O(at=>{let qe=at?"enter":"leave";we.current=!1,X.onStop(w,qe,xe=>{xe==="enter"?u==null||u():xe==="leave"&&(o==null||o())}),qe==="leave"&&!je(X)&&(I("hidden"),S(w))});i.useEffect(()=>{E&&l||(_e(P),T(P))},[P,E,l]);let Be=!(!l||!E||!_||He),[,N]=nr(Be,p,P,{start:_e,end:T}),ll=ee({ref:v,className:((r=Je(d.className,We&&c,We&&m,N.enter&&c,N.enter&&N.closed&&m,N.enter&&!N.closed&&x,N.leave&&y,N.leave&&!N.closed&&f,N.leave&&N.closed&&g,!N.transition&&P&&b))==null?void 0:r.trim())||void 0,...tr(N)}),ye=0;F==="visible"&&(ye|=j.Open),F==="hidden"&&(ye|=j.Closed),N.enter&&(ye|=j.Opening),N.leave&&(ye|=j.Closing);let il=D();return i.createElement(De.Provider,{value:X},i.createElement(or,{value:ye},il({ourProps:ll,theirProps:d,defaultTag:Gt,features:Kt,visible:F==="visible",name:"Transition.Child"})))}function Ir(e,t){let{show:n,appear:r=!1,unmount:l=!0,...s}=e,u=i.useRef(null),a=Yt(e),o=q(...a?[u,t]:t===null?[]:[t]);ve();let c=Ae();if(n===void 0&&c!==null&&(n=(c&j.Open)===j.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[m,x]=i.useState(n?"visible":"hidden"),b=zt(()=>{n||x("hidden")}),[y,f]=i.useState(!0),g=i.useRef([n]);L(()=>{y!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),f(!1))},[g,n]);let d=i.useMemo(()=>({show:n,appear:r,initial:y}),[n,r,y]);L(()=>{n?x("visible"):!je(b)&&u.current!==null&&x("hidden")},[n,b]);let p={unmount:l},h=O(()=>{var v;y&&f(!1),(v=e.beforeEnter)==null||v.call(e)}),w=O(()=>{var v;y&&f(!1),(v=e.beforeLeave)==null||v.call(e)}),E=D();return i.createElement(De.Provider,{value:b},i.createElement(Ie.Provider,{value:d},E({ourProps:{...p,as:i.Fragment,children:i.createElement(Zt,{ref:o,...p,...s,beforeEnter:h,beforeLeave:w})},theirProps:{},defaultTag:i.Fragment,features:Kt,visible:m==="visible",name:"Transition"})))}function Dr(e,t){let n=i.useContext(Ie)!==null,r=Ae()!==null;return i.createElement(i.Fragment,null,!n&&r?i.createElement(ot,{ref:t,...e}):i.createElement(Zt,{ref:t,...e}))}let ot=k(Ir),Zt=k(Ar),oe=k(Dr),Jt=Object.assign(ot,{Child:oe,Root:ot});var jr=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(jr||{}),Ur=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Ur||{});let Hr={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},st=i.createContext(null);st.displayName="DialogContext";function Ue(e){let t=i.useContext(st);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ue),n}return t}function Wr(e,t){return K(t.type,Hr,e,t)}let Qt=k(function(e,t){let n=i.useId(),{id:r=`headlessui-dialog-${n}`,open:l,onClose:s,initialFocus:u,role:a="dialog",autoFocus:o=!0,__demoMode:c=!1,unmount:m=!1,...x}=e,b=i.useRef(!1);a=function(){return a==="dialog"||a==="alertdialog"?a:(b.current||(b.current=!0,console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let y=Ae();l===void 0&&y!==null&&(l=(y&j.Open)===j.Open);let f=i.useRef(null),g=q(f,t),d=he(f),p=l?0:1,[h,w]=i.useReducer(Wr,{titleId:null,descriptionId:null,panelRef:i.createRef()}),E=O(()=>s(!1)),v=O(T=>w({type:0,id:T})),M=ve()?p===0:!1,[P,A]=vr(),U={get current(){var T;return(T=h.panelRef.current)!=null?T:f.current}},F=qt(),{resolveContainers:I}=Er({mainTreeNode:F,portals:P,defaultContainers:[U]}),H=y!==null?(y&j.Closing)===j.Closing:!1;Nn(c||H?!1:M,{allowed:O(()=>{var T,Be;return[(Be=(T=f.current)==null?void 0:T.closest("[data-headlessui-portal]"))!=null?Be:null]}),disallowed:O(()=>{var T;return[(T=F==null?void 0:F.closest("body > *:not(#headlessui-portal-root)"))!=null?T:null]})}),Yn(M,I,T=>{T.preventDefault(),E()}),yr(M,d==null?void 0:d.defaultView,T=>{T.preventDefault(),T.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),E()}),Qn(c||H?!1:M,d,I),An(M,f,E);let[W,S]=Mn(),_=i.useMemo(()=>[{dialogState:p,close:E,setTitleId:v,unmount:m},h],[p,h,E,v,m]),He=i.useMemo(()=>({open:p===0}),[p]),We={ref:g,id:r,role:a,tabIndex:-1,"aria-modal":c?void 0:p===0?!0:void 0,"aria-labelledby":h.titleId,"aria-describedby":W,unmount:m},we=!xr(),X=ne.None;M&&!c&&(X|=ne.RestoreFocus,X|=ne.TabLock,o&&(X|=ne.AutoFocus),we&&(X|=ne.InitialFocus));let _e=D();return i.createElement(sr,null,i.createElement(jt,{force:!0},i.createElement(wr,null,i.createElement(st.Provider,{value:_},i.createElement(Wt,{target:f},i.createElement(jt,{force:!1},i.createElement(S,{slot:He},i.createElement(A,null,i.createElement(Sr,{initialFocus:u,initialFocusFallback:f,containers:I,features:X},i.createElement(Fn,{value:E},_e({ourProps:We,theirProps:x,slot:He,defaultTag:_r,features:Br,visible:p===0,name:"Dialog"})))))))))))}),_r="div",Br=Te.RenderStrategy|Te.Static;function qr(e,t){let{transition:n=!1,open:r,...l}=e,s=Ae(),u=e.hasOwnProperty("open")||s!==null,a=e.hasOwnProperty("onClose");if(!u&&!a)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!u)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!a)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!s&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(r!==void 0||n)&&!l.static?i.createElement(Bt,null,i.createElement(Jt,{show:r,transition:n,unmount:l.unmount},i.createElement(Qt,{ref:t,...l}))):i.createElement(Bt,null,i.createElement(Qt,{ref:t,open:r,...l}))}let Xr="div";function Vr(e,t){let n=i.useId(),{id:r=`headlessui-dialog-panel-${n}`,transition:l=!1,...s}=e,[{dialogState:u,unmount:a},o]=Ue("Dialog.Panel"),c=q(t,o.panelRef),m=i.useMemo(()=>({open:u===0}),[u]),x=O(d=>{d.stopPropagation()}),b={ref:c,id:r,onClick:x},y=l?oe:i.Fragment,f=l?{unmount:a}:{},g=D();return i.createElement(y,{...f},g({ourProps:b,theirProps:s,slot:m,defaultTag:Xr,name:"Dialog.Panel"}))}let Yr="div";function zr(e,t){let{transition:n=!1,...r}=e,[{dialogState:l,unmount:s}]=Ue("Dialog.Backdrop"),u=i.useMemo(()=>({open:l===0}),[l]),a={ref:t,"aria-hidden":!0},o=n?oe:i.Fragment,c=n?{unmount:s}:{},m=D();return i.createElement(o,{...c},m({ourProps:a,theirProps:r,slot:u,defaultTag:Yr,name:"Dialog.Backdrop"}))}let Gr="h2";function Kr(e,t){let n=i.useId(),{id:r=`headlessui-dialog-title-${n}`,...l}=e,[{dialogState:s,setTitleId:u}]=Ue("Dialog.Title"),a=q(t);i.useEffect(()=>(u(r),()=>u(null)),[r,u]);let o=i.useMemo(()=>({open:s===0}),[s]),c={ref:a,id:r};return D()({ourProps:c,theirProps:l,slot:o,defaultTag:Gr,name:"Dialog.Title"})}let Zr=k(qr),ut=k(Vr);k(zr);let Jr=k(Kr),Qr=Object.assign(Zr,{Panel:ut,Title:Jr,Description:Pn});function Rt({onClick:e}){return $.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:e,children:[$.jsx("span",{className:"sr-only",children:"Close"}),$.jsx("svg",{className:"size-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true",children:$.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}const Rr=({modalContext:e,config:t,children:n})=>{const[r,l]=i.useState(!1);return $.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:$.jsx("div",{className:Se("im-modal-positioner flex min-h-full justify-center",{"items-start":t.position==="top","items-center":t.position==="center","items-end":t.position==="bottom"}),children:$.jsx(oe,{as:"div",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",afterEnter:()=>l(!0),afterLeave:e.afterLeave,className:Se("im-modal-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:$.jsxs(ut,{className:`im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":r,children:[t.closeButton&&$.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:$.jsx(Rt,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})})},el=({modalContext:e,config:t,children:n})=>{const[r,l]=i.useState(!1);return $.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:$.jsx("div",{className:Se("im-slideover-positioner flex min-h-full items-center",{"justify-start rtl:justify-end":(t==null?void 0:t.position)==="left","justify-end rtl:justify-start":(t==null?void 0:t.position)==="right"}),children:$.jsx(oe,{as:"div",enterFrom:`opacity-0 ${t.position==="left"?"-translate-x-full":"translate-x-full"}`,enterTo:"opacity-100 translate-x-0",leaveFrom:"opacity-100 translate-x-0",leaveTo:`opacity-0 ${t.position==="left"?"-translate-x-full":"translate-x-full"}`,afterEnter:()=>l(!0),afterLeave:e.afterLeave,className:Se("im-slideover-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:$.jsxs(ut,{className:`im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":r,children:[t.closeButton&&$.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:$.jsx(Rt,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})})},en=i.forwardRef(({name:e,children:t,onFocus:n=null,onBlur:r=null,onClose:l=null,onSuccess:s=null,onAfterLeave:u=null,...a},o)=>{const c=x=>typeof t=="function"?t(x):t,m=i.useRef(null);return i.useImperativeHandle(o,()=>m.current,[m]),$.jsx(Ge,{ref:m,name:e,onFocus:n,onBlur:r,onClose:l,onSuccess:s,...a,children:({afterLeave:x,close:b,config:y,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:E,onTopOfStack:v,reload:M,setOpen:P,shouldRender:A})=>$.jsx(Jt,{appear:!0,show:w??!1,afterLeave:u,children:$.jsxs(Qr,{as:"div",className:"im-dialog relative z-20",onClose:()=>y.closeExplicitly?null:b(),"data-inertiaui-modal-id":p,"data-inertiaui-modal-index":h,children:[h===0?$.jsx(oe,{enter:"transition transform ease-in-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition transform ease-in-out duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:v?$.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):$.jsx("div",{})}):null,h>0&&v?$.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,y.slideover?$.jsx(el,{modalContext:E,config:y,children:c({afterLeave:x,close:b,config:y,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:E,onTopOfStack:v,reload:M,setOpen:P,shouldRender:A})}):$.jsx(Rr,{modalContext:E,config:y,children:c({afterLeave:x,close:b,config:y,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:E,onTopOfStack:v,reload:M,setOpen:P,shouldRender:A})})]})})})});en.displayName="Modal";const tl=({href:e,method:t="get",data:n={},as:r="a",headers:l={},queryStringArrayFormat:s="brackets",onAfterLeave:u=null,onBlur:a=null,onClose:o=null,onError:c=null,onFocus:m=null,onStart:x=null,onSuccess:b=null,navigate:y=null,children:f,...g})=>{const[d,p]=i.useState(!1),[h,w]=i.useState(null),{stack:E,visit:v}=ce(),M=i.useMemo(()=>y??$e("navigate"),[y]),P={},A={};Object.keys(g).forEach(S=>{ht.includes(S)||(S.startsWith("on")&&typeof g[S]=="function"?S.toLowerCase()in window?P[S]=g[S]:A[S]=g[S]:P[S]=g[S])});const[U,F]=i.useState(!1);i.useEffect(()=>{h&&(h.onTopOfStack&&U?m==null||m():!h.onTopOfStack&&!U&&(a==null||a()),F(!h.onTopOfStack))},[E]);const I=i.useCallback(()=>{o==null||o()},[o]),H=i.useCallback(()=>{w(null),u==null||u()},[u]),W=i.useCallback(S=>{S==null||S.preventDefault(),!d&&(e.startsWith("#")||(p(!0),x==null||x()),v(e,t,n,l,an(ct(g,ht)),()=>I(E.length),H,s,M).then(_=>{w(_),_.registerEventListenersFromProps(A),b==null||b()}).catch(_=>{console.error(_),c==null||c(_)}).finally(()=>p(!1)))},[e,t,n,l,s,g,I,H]);return $.jsx(r,{...P,href:e,onClick:W,children:typeof f=="function"?f({loading:d}):f})};function nl(){return ce().stack[ze()]??null}const rl=e=>t=>(t.default.layout=n=>i.createElement(e,{},n),t);C.HeadlessModal=Ge,C.Modal=en,C.ModalLink=tl,C.ModalRoot=gt,C.ModalStackProvider=pt,C.getConfig=$e,C.initFromPageProps=vt,C.putConfig=sn,C.renderApp=cn,C.resetConfig=on,C.setPageLayout=rl,C.useModal=nl,C.useModalIndex=ze,C.useModalStack=ce,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
4
+ `))}else{let b=m.props,y=b==null?void 0:b.className,f=typeof y=="function"?(...p)=>Je(y(...p),i.className):Je(y,i.className),g=f?{className:f}:{},d=yt(m.props,R(Qe(i,["ref"])));for(let p in E)p in d&&delete E[p];return o.cloneElement(m,Object.assign({},d,E,c,{ref:l(En(m),c.ref)},g))}return o.createElement(s,Object.assign({},Qe(i,["ref"]),s!==o.Fragment&&c,s!==o.Fragment&&E),m)}function wn(){let e=o.useRef([]),t=o.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function yn(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function yt(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let l in r)l.startsWith("on")&&typeof r[l]=="function"?(n[l]!=null||(n[l]=[]),n[l].push(r[l])):t[l]=r[l];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[l=>{var s;return(s=l==null?void 0:l.preventDefault)==null?void 0:s.call(l)}]);for(let r in n)Object.assign(t,{[r](l,...s){let a=n[r];for(let u of a){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;u(l,...s)}}});return t}function k(e){var t;return Object.assign(o.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function R(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Qe(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function En(e){return o.version.split(".")[0]>="19"?e.props.ref:e.ref}let xn="span";var Le=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Le||{});function bn(e,t){var n;let{features:r=1,...l}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=l["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return D()({ourProps:s,theirProps:l,slot:{},defaultTag:xn,name:"Hidden"})}let Re=k(bn),Et=Symbol();function $n(e,t=!0){return Object.assign(e,{[Et]:t})}function q(...e){let t=o.useRef(e);o.useEffect(()=>{t.current=e},[e]);let n=O(r=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(r):l.current=r)});return e.every(r=>r==null||(r==null?void 0:r[Et]))?void 0:n}let et=o.createContext(null);et.displayName="DescriptionContext";function xt(){let e=o.useContext(et);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,xt),t}return e}function Mn(){let[e,t]=o.useState([]);return[e.length>0?e.join(" "):void 0,o.useMemo(()=>function(n){let r=O(s=>(t(a=>[...a,s]),()=>t(a=>{let u=a.slice(),i=u.indexOf(s);return i!==-1&&u.splice(i,1),u}))),l=o.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props,value:n.value}),[r,n.slot,n.name,n.props,n.value]);return o.createElement(et.Provider,{value:l},n.children)},[t])]}let Cn="p";function Sn(e,t){let n=o.useId(),r=vn(),{id:l=`headlessui-description-${n}`,...s}=e,a=xt(),u=q(t);L(()=>a.register(l),[l,a.register]);let i=r||!1,c=o.useMemo(()=>({...a.slot,disabled:i}),[a.slot,i]),m={ref:u,...a.props,id:l};return D()({ourProps:m,theirProps:s,slot:c,defaultTag:Cn,name:a.name||"Description"})}let On=k(Sn),Pn=Object.assign(On,{});var bt=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(bt||{});let Tn=o.createContext(()=>{});function Fn({value:e,children:t}){return o.createElement(Tn.Provider,{value:e},t)}let Ln=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};function $t(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(l){return r.add(l),()=>r.delete(l)},dispatch(l,...s){let a=t[l].call(n,...s);a&&(n=a,r.forEach(u=>u()))}}}function Mt(e){return o.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let kn=new Ln(()=>$t(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let n=this.slice();return n.splice(t,1),n}}));function oe(e,t){let n=kn.get(t),r=o.useId(),l=Mt(n);if(L(()=>{if(e)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,e]),!e)return!1;let s=l.indexOf(r),a=l.length;return s===-1&&(s=a,a+=1),s===a-1}let tt=new Map,fe=new Map;function Ct(e){var t;let n=(t=fe.get(e))!=null?t:0;return fe.set(e,n+1),n!==0?()=>St(e):(tt.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>St(e))}function St(e){var t;let n=(t=fe.get(e))!=null?t:1;if(n===1?fe.delete(e):fe.set(e,n-1),n!==1)return;let r=tt.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,tt.delete(e))}function Nn(e,{allowed:t,disallowed:n}={}){let r=oe(e,"inert-others");L(()=>{var l,s;if(!r)return;let a=z();for(let i of(l=n==null?void 0:n())!=null?l:[])i&&a.add(Ct(i));let u=(s=t==null?void 0:t())!=null?s:[];for(let i of u){if(!i)continue;let c=Oe(i);if(!c)continue;let m=i.parentElement;for(;m&&m!==c.body;){for(let E of m.children)u.some(b=>E.contains(b))||a.add(Ct(E));m=m.parentElement}}return a.dispose},[r,t,n])}function In(e,t,n){let r=Q(l=>{let s=l.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});o.useEffect(()=>{if(!e)return;let l=t===null?null:t instanceof HTMLElement?t:t.current;if(!l)return;let s=z();if(typeof ResizeObserver<"u"){let a=new ResizeObserver(()=>r.current(l));a.observe(l),s.add(()=>a.disconnect())}if(typeof IntersectionObserver<"u"){let a=new IntersectionObserver(()=>r.current(l));a.observe(l),s.add(()=>a.disconnect())}return()=>s.dispose()},[t,r,e])}let ke=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),An=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var V=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(V||{}),nt=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(nt||{}),Dn=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Dn||{});function jn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ke)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Un(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(An)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ot=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ot||{});function Hn(e,t=0){var n;return e===((n=Oe(e))==null?void 0:n.body)?!1:G(t,{0(){return e.matches(ke)},1(){let r=e;for(;r!==null;){if(r.matches(ke))return!0;r=r.parentElement}return!1}})}var Wn=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Wn||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Y(e){e==null||e.focus({preventScroll:!0})}let _n=["textarea","input"].join(",");function Bn(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,_n))!=null?n:!1}function qn(e,t=n=>n){return e.slice().sort((n,r)=>{let l=t(n),s=t(r);if(l===null||s===null)return 0;let a=l.compareDocumentPosition(s);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function me(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:l=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?qn(e):e:t&64?Un(e):jn(e);l.length>0&&a.length>1&&(a=a.filter(y=>!l.some(f=>f!=null&&"current"in f?(f==null?void 0:f.current)===y:f===y))),r=r??s.activeElement;let u=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,a.indexOf(r))-1;if(t&4)return Math.max(0,a.indexOf(r))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},m=0,E=a.length,b;do{if(m>=E||m+E<=0)return 0;let y=i+m;if(t&16)y=(y+E)%E;else{if(y<0)return 3;if(y>=E)return 1}b=a[y],b==null||b.focus(c),m+=u}while(b!==s.activeElement);return t&6&&Bn(b)&&b.select(),2}function Pt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Xn(){return/Android/gi.test(window.navigator.userAgent)}function Vn(){return Pt()||Xn()}function pe(e,t,n,r){let l=Q(n);o.useEffect(()=>{if(!e)return;function s(a){l.current(a)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function Tt(e,t,n,r){let l=Q(n);o.useEffect(()=>{if(!e)return;function s(a){l.current(a)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Ft=30;function Yn(e,t,n){let r=oe(e,"outside-click"),l=Q(n),s=o.useCallback(function(i,c){if(i.defaultPrevented)return;let m=c(i);if(m===null||!m.getRootNode().contains(m)||!m.isConnected)return;let E=function b(y){return typeof y=="function"?b(y()):Array.isArray(y)||y instanceof Set?y:[y]}(t);for(let b of E)if(b!==null&&(b.contains(m)||i.composed&&i.composedPath().includes(b)))return;return!Hn(m,Ot.Loose)&&m.tabIndex!==-1&&i.preventDefault(),l.current(i,m)},[l,t]),a=o.useRef(null);pe(r,"pointerdown",i=>{var c,m;a.current=((m=(c=i.composedPath)==null?void 0:c.call(i))==null?void 0:m[0])||i.target},!0),pe(r,"mousedown",i=>{var c,m;a.current=((m=(c=i.composedPath)==null?void 0:c.call(i))==null?void 0:m[0])||i.target},!0),pe(r,"click",i=>{Vn()||a.current&&(s(i,()=>a.current),a.current=null)},!0);let u=o.useRef({x:0,y:0});pe(r,"touchstart",i=>{u.current.x=i.touches[0].clientX,u.current.y=i.touches[0].clientY},!0),pe(r,"touchend",i=>{let c={x:i.changedTouches[0].clientX,y:i.changedTouches[0].clientY};if(!(Math.abs(c.x-u.current.x)>=Ft||Math.abs(c.y-u.current.y)>=Ft))return s(i,()=>i.target instanceof HTMLElement?i.target:null)},!0),Tt(r,"blur",i=>s(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function he(...e){return o.useMemo(()=>Oe(...e),[...e])}function Lt(e,t,n,r){let l=Q(n);o.useEffect(()=>{e=e??window;function s(a){l.current(a)}return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)},[e,t,r])}function zn(){let e;return{before({doc:t}){var n;let r=t.documentElement,l=(n=t.defaultView)!=null?n:window;e=Math.max(0,l.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,l=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-l);n.style(r,"paddingRight",`${s}px`)}}}function Gn(){return Pt()?{before({doc:e,d:t,meta:n}){function r(l){return n.containers.flatMap(s=>s()).some(s=>s.contains(l))}t.microTask(()=>{var l;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let u=z();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let s=(l=window.scrollY)!=null?l:window.pageYOffset,a=null;t.addEventListener(e,"click",u=>{if(u.target instanceof HTMLElement)try{let i=u.target.closest("a");if(!i)return;let{hash:c}=new URL(i.href),m=e.querySelector(c);m&&!r(m)&&(a=m)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(u.target instanceof HTMLElement)if(r(u.target)){let i=u.target;for(;i.parentElement&&r(i.parentElement);)i=i.parentElement;t.style(i,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(u.target instanceof HTMLElement){if(u.target.tagName==="INPUT")return;if(r(u.target)){let i=u.target;for(;i.parentElement&&i.dataset.headlessuiPortal!==""&&!(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);)i=i.parentElement;i.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let i=(u=window.scrollY)!=null?u:window.pageYOffset;s!==i&&window.scrollTo(0,s),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)})})}}:{}}function Kn(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Zn(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let ee=$t(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:z(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:Zn(n)},l=[Gn(),zn(),Kn()];l.forEach(({before:s})=>s==null?void 0:s(r)),l.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});ee.subscribe(()=>{let e=ee.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",l=n.count!==0;(l&&!r||!l&&r)&&ee.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ee.dispatch("TEARDOWN",n)}});function Jn(e,t,n=()=>({containers:[]})){let r=Mt(ee),l=t?r.get(t):void 0,s=l?l.count>0:!1;return L(()=>{if(!(!t||!e))return ee.dispatch("PUSH",t,n),()=>ee.dispatch("POP",t,n)},[e,t]),s}function Qn(e,t,n=()=>[document.body]){let r=oe(e,"scroll-lock");Jn(r,t,l=>{var s;return{containers:[...(s=l.containers)!=null?s:[],n]}})}function Rn(e=0){let[t,n]=o.useState(e),r=o.useCallback(i=>n(i),[t]),l=o.useCallback(i=>n(c=>c|i),[t]),s=o.useCallback(i=>(t&i)===i,[t]),a=o.useCallback(i=>n(c=>c&~i),[n]),u=o.useCallback(i=>n(c=>c^i),[n]);return{flags:t,setFlag:r,addFlag:l,hasFlag:s,removeFlag:a,toggleFlag:u}}var kt,Nt;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((kt=process==null?void 0:process.env)==null?void 0:kt.NODE_ENV)==="test"&&typeof((Nt=Element==null?void 0:Element.prototype)==null?void 0:Nt.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
5
+ `)),[]});var er=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(er||{});function tr(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function nr(e,t,n,r){let[l,s]=o.useState(n),{hasFlag:a,addFlag:u,removeFlag:i}=Rn(e&&l?3:0),c=o.useRef(!1),m=o.useRef(!1),E=Ze();return L(()=>{var b;if(e){if(n&&s(!0),!t){n&&u(3);return}return(b=r==null?void 0:r.start)==null||b.call(r,n),rr(t,{inFlight:c,prepare(){m.current?m.current=!1:m.current=c.current,c.current=!0,!m.current&&(n?(u(3),i(4)):(u(4),i(2)))},run(){m.current?n?(i(3),u(4)):(i(4),u(3)):n?i(1):u(1)},done(){var y;m.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,i(7),n||s(!1),(y=r==null?void 0:r.end)==null||y.call(r,n))}})}},[e,n,t,E]),e?[l,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function rr(e,{prepare:t,run:n,done:r,inFlight:l}){let s=z();return or(e,{prepare:t,inFlight:l}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(lr(e,r))})}),s.dispose}function lr(e,t){var n,r;let l=z();if(!e)return l.dispose;let s=!1;l.add(()=>{s=!0});let a=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return a.length===0?(t(),l.dispose):(Promise.allSettled(a.map(u=>u.finished)).then(()=>{s||t()}),l.dispose)}function or(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function rt(e,t){let n=o.useRef([]),r=O(e);o.useEffect(()=>{let l=[...n.current];for(let[s,a]of t.entries())if(n.current[s]!==a){let u=r(t,l);return n.current=t,u}},[r,...t])}let Ne=o.createContext(null);Ne.displayName="OpenClosedContext";var j=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(j||{});function Ie(){return o.useContext(Ne)}function ir({value:e,children:t}){return o.createElement(Ne.Provider,{value:e},t)}function sr({children:e}){return o.createElement(Ne.Provider,{value:null},e)}function ar(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Z=[];ar(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||Z[0]===t.target)return;let n=t.target;n=n.closest(ke),Z.unshift(n??t.target),Z=Z.filter(r=>r!=null&&r.isConnected),Z.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function It(e){let t=O(e),n=o.useRef(!1);o.useEffect(()=>(n.current=!1,()=>{n.current=!0,Pe(()=>{n.current&&t()})}),[t])}function ur(){let e=typeof document>"u";return"useSyncExternalStore"in se?(t=>t.useSyncExternalStore)(se)(()=>()=>{},()=>!1,()=>!e):!1}function ve(){let e=ur(),[t,n]=se.useState(J.isHandoffComplete);return t&&J.isHandoffComplete===!1&&n(!1),se.useEffect(()=>{t!==!0&&n(!0)},[t]),se.useEffect(()=>J.handoff(),[]),e?!1:t}let At=o.createContext(!1);function dr(){return o.useContext(At)}function Dt(e){return o.createElement(At.Provider,{value:e.force},e.children)}function cr(e){let t=dr(),n=o.useContext(Ut),r=he(e),[l,s]=o.useState(()=>{var a;if(!t&&n!==null)return(a=n.current)!=null?a:null;if(J.isServer)return null;let u=r==null?void 0:r.getElementById("headlessui-portal-root");if(u)return u;if(r===null)return null;let i=r.createElement("div");return i.setAttribute("id","headlessui-portal-root"),r.body.appendChild(i)});return o.useEffect(()=>{l!==null&&(r!=null&&r.body.contains(l)||r==null||r.body.appendChild(l))},[l,r]),o.useEffect(()=>{t||n!==null&&s(n.current)},[n,s,t]),l}let jt=o.Fragment,fr=k(function(e,t){let n=e,r=o.useRef(null),l=q($n(E=>{r.current=E}),t),s=he(r),a=cr(r),[u]=o.useState(()=>{var E;return J.isServer?null:(E=s==null?void 0:s.createElement("div"))!=null?E:null}),i=o.useContext(lt),c=ve();L(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),L(()=>{if(u&&i)return i.register(u)},[i,u]),It(()=>{var E;!a||!u||(u instanceof Node&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((E=a.parentElement)==null||E.removeChild(a)))});let m=D();return c?!a||!u?null:tn.createPortal(m({ourProps:{ref:l},theirProps:n,slot:{},defaultTag:jt,name:"Portal"}),u):null});function mr(e,t){let n=q(t),{enabled:r=!0,...l}=e,s=D();return r?o.createElement(fr,{...l,ref:n}):s({ourProps:{ref:n},theirProps:l,slot:{},defaultTag:jt,name:"Portal"})}let pr=o.Fragment,Ut=o.createContext(null);function hr(e,t){let{target:n,...r}=e,l={ref:q(t)},s=D();return o.createElement(Ut.Provider,{value:n},s({ourProps:l,theirProps:r,defaultTag:pr,name:"Popover.Group"}))}let lt=o.createContext(null);function vr(){let e=o.useContext(lt),t=o.useRef([]),n=O(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=O(s=>{let a=t.current.indexOf(s);a!==-1&&t.current.splice(a,1),e&&e.unregister(s)}),l=o.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,o.useMemo(()=>function({children:s}){return o.createElement(lt.Provider,{value:l},s)},[l])]}let gr=k(mr),Ht=k(hr),wr=Object.assign(gr,{Group:Ht});function yr(e,t=typeof document<"u"?document.defaultView:null,n){let r=oe(e,"escape");Lt(t,"keydown",l=>{r&&(l.defaultPrevented||l.key===bt.Escape&&n(l))})}function Er(){var e;let[t]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,r]=o.useState((e=t==null?void 0:t.matches)!=null?e:!1);return L(()=>{if(!t)return;function l(s){r(s.matches)}return t.addEventListener("change",l),()=>t.removeEventListener("change",l)},[t]),n}function xr({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=he(n),l=O(()=>{var s,a;let u=[];for(let i of e)i!==null&&(i instanceof HTMLElement?u.push(i):"current"in i&&i.current instanceof HTMLElement&&u.push(i.current));if(t!=null&&t.current)for(let i of t.current)u.push(i);for(let i of(s=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?s:[])i!==document.body&&i!==document.head&&i instanceof HTMLElement&&i.id!=="headlessui-portal-root"&&(n&&(i.contains(n)||i.contains((a=n==null?void 0:n.getRootNode())==null?void 0:a.host))||u.some(c=>i.contains(c))||u.push(i));return u});return{resolveContainers:l,contains:O(s=>l().some(a=>a.contains(s)))}}let Wt=o.createContext(null);function _t({children:e,node:t}){let[n,r]=o.useState(null),l=Bt(t??n);return o.createElement(Wt.Provider,{value:l},e,l===null&&o.createElement(Re,{features:Le.Hidden,ref:s=>{var a,u;if(s){for(let i of(u=(a=Oe(s))==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?u:[])if(i!==document.body&&i!==document.head&&i instanceof HTMLElement&&i!=null&&i.contains(s)){r(i);break}}}}))}function Bt(e=null){var t;return(t=o.useContext(Wt))!=null?t:e}function ot(){let e=o.useRef(!1);return L(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ge=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ge||{});function br(){let e=o.useRef(0);return Tt(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function qt(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}let $r="div";var te=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(te||{});function Mr(e,t){let n=o.useRef(null),r=q(n,t),{initialFocus:l,initialFocusFallback:s,containers:a,features:u=15,...i}=e;ve()||(u=0);let c=he(n);Pr(u,{ownerDocument:c});let m=Tr(u,{ownerDocument:c,container:n,initialFocus:l,initialFocusFallback:s});Fr(u,{ownerDocument:c,container:n,containers:a,previousActiveElement:m});let E=br(),b=O(h=>{let w=n.current;w&&(x=>x())(()=>{G(E.current,{[ge.Forwards]:()=>{me(w,V.First,{skipElements:[h.relatedTarget,s]})},[ge.Backwards]:()=>{me(w,V.Last,{skipElements:[h.relatedTarget,s]})}})})}),y=oe(!!(u&2),"focus-trap#tab-lock"),f=Ze(),g=o.useRef(!1),d={ref:r,onKeyDown(h){h.key=="Tab"&&(g.current=!0,f.requestAnimationFrame(()=>{g.current=!1}))},onBlur(h){if(!(u&4))return;let w=qt(a);n.current instanceof HTMLElement&&w.add(n.current);let x=h.relatedTarget;x instanceof HTMLElement&&x.dataset.headlessuiFocusGuard!=="true"&&(Xt(w,x)||(g.current?me(n.current,G(E.current,{[ge.Forwards]:()=>V.Next,[ge.Backwards]:()=>V.Previous})|V.WrapAround,{relativeTo:h.target}):h.target instanceof HTMLElement&&Y(h.target)))}},p=D();return o.createElement(o.Fragment,null,y&&o.createElement(Re,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:b,features:Le.Focusable}),p({ourProps:d,theirProps:i,defaultTag:$r,name:"FocusTrap"}),y&&o.createElement(Re,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:b,features:Le.Focusable}))}let Cr=k(Mr),Sr=Object.assign(Cr,{features:te});function Or(e=!0){let t=o.useRef(Z.slice());return rt(([n],[r])=>{r===!0&&n===!1&&Pe(()=>{t.current.splice(0)}),r===!1&&n===!0&&(t.current=Z.slice())},[e,Z,t]),O(()=>{var n;return(n=t.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function Pr(e,{ownerDocument:t}){let n=!!(e&8),r=Or(n);rt(()=>{n||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&Y(r())},[n]),It(()=>{n&&Y(r())})}function Tr(e,{ownerDocument:t,container:n,initialFocus:r,initialFocusFallback:l}){let s=o.useRef(null),a=oe(!!(e&1),"focus-trap#initial-focus"),u=ot();return rt(()=>{if(e===0)return;if(!a){l!=null&&l.current&&Y(l.current);return}let i=n.current;i&&Pe(()=>{if(!u.current)return;let c=t==null?void 0:t.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===c){s.current=c;return}}else if(i.contains(c)){s.current=c;return}if(r!=null&&r.current)Y(r.current);else{if(e&16){if(me(i,V.First|V.AutoFocus)!==nt.Error)return}else if(me(i,V.First)!==nt.Error)return;if(l!=null&&l.current&&(Y(l.current),(t==null?void 0:t.activeElement)===l.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}s.current=t==null?void 0:t.activeElement})},[l,a,e]),s}function Fr(e,{ownerDocument:t,container:n,containers:r,previousActiveElement:l}){let s=ot(),a=!!(e&4);Lt(t==null?void 0:t.defaultView,"focus",u=>{if(!a||!s.current)return;let i=qt(r);n.current instanceof HTMLElement&&i.add(n.current);let c=l.current;if(!c)return;let m=u.target;m&&m instanceof HTMLElement?Xt(i,m)?(l.current=m,Y(m)):(u.preventDefault(),u.stopPropagation(),Y(c)):Y(l.current)},!0)}function Xt(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function Vt(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:zt)!==o.Fragment||o.Children.count(e.children)===1}let Ae=o.createContext(null);Ae.displayName="TransitionContext";var Lr=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Lr||{});function kr(){let e=o.useContext(Ae);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Nr(){let e=o.useContext(De);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let De=o.createContext(null);De.displayName="NestingContext";function je(e){return"children"in e?je(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Yt(e,t){let n=Q(e),r=o.useRef([]),l=ot(),s=Ze(),a=O((y,f=K.Hidden)=>{let g=r.current.findIndex(({el:d})=>d===y);g!==-1&&(G(f,{[K.Unmount](){r.current.splice(g,1)},[K.Hidden](){r.current[g].state="hidden"}}),s.microTask(()=>{var d;!je(r)&&l.current&&((d=n.current)==null||d.call(n))}))}),u=O(y=>{let f=r.current.find(({el:g})=>g===y);return f?f.state!=="visible"&&(f.state="visible"):r.current.push({el:y,state:"visible"}),()=>a(y,K.Unmount)}),i=o.useRef([]),c=o.useRef(Promise.resolve()),m=o.useRef({enter:[],leave:[]}),E=O((y,f,g)=>{i.current.splice(0),t&&(t.chains.current[f]=t.chains.current[f].filter(([d])=>d!==y)),t==null||t.chains.current[f].push([y,new Promise(d=>{i.current.push(d)})]),t==null||t.chains.current[f].push([y,new Promise(d=>{Promise.all(m.current[f].map(([p,h])=>h)).then(()=>d())})]),f==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(f)):g(f)}),b=O((y,f,g)=>{Promise.all(m.current[f].splice(0).map(([d,p])=>p)).then(()=>{var d;(d=i.current.shift())==null||d()}).then(()=>g(f))});return o.useMemo(()=>({children:r,register:u,unregister:a,onStart:E,onStop:b,wait:c,chains:m}),[u,a,r,E,b,m,c])}let zt=o.Fragment,Gt=Te.RenderStrategy;function Ir(e,t){var n,r;let{transition:l=!0,beforeEnter:s,afterEnter:a,beforeLeave:u,afterLeave:i,enter:c,enterFrom:m,enterTo:E,entered:b,leave:y,leaveFrom:f,leaveTo:g,...d}=e,[p,h]=o.useState(null),w=o.useRef(null),x=Vt(e),v=q(...x?[w,t,h]:t===null?[]:[t]),M=(n=d.unmount)==null||n?K.Unmount:K.Hidden,{show:P,appear:I,initial:U}=kr(),[F,A]=o.useState(P?"visible":"hidden"),H=Nr(),{register:W,unregister:S}=H;L(()=>W(w),[W,w]),L(()=>{if(M===K.Hidden&&w.current){if(P&&F!=="visible"){A("visible");return}return G(F,{hidden:()=>S(w),visible:()=>W(w)})}},[F,w,W,S,P,M]);let _=ve();L(()=>{if(x&&_&&F==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,F,_,x]);let He=U&&!I,We=I&&P&&U,we=o.useRef(!1),X=Yt(()=>{we.current||(A("hidden"),S(w))},H),_e=O(ut=>{we.current=!0;let qe=ut?"enter":"leave";X.onStart(w,qe,Ee=>{Ee==="enter"?s==null||s():Ee==="leave"&&(u==null||u())})}),T=O(ut=>{let qe=ut?"enter":"leave";we.current=!1,X.onStop(w,qe,Ee=>{Ee==="enter"?a==null||a():Ee==="leave"&&(i==null||i())}),qe==="leave"&&!je(X)&&(A("hidden"),S(w))});o.useEffect(()=>{x&&l||(_e(P),T(P))},[P,x,l]);let Be=!(!l||!x||!_||He),[,N]=nr(Be,p,P,{start:_e,end:T}),ll=R({ref:v,className:((r=Je(d.className,We&&c,We&&m,N.enter&&c,N.enter&&N.closed&&m,N.enter&&!N.closed&&E,N.leave&&y,N.leave&&!N.closed&&f,N.leave&&N.closed&&g,!N.transition&&P&&b))==null?void 0:r.trim())||void 0,...tr(N)}),ye=0;F==="visible"&&(ye|=j.Open),F==="hidden"&&(ye|=j.Closed),N.enter&&(ye|=j.Opening),N.leave&&(ye|=j.Closing);let ol=D();return o.createElement(De.Provider,{value:X},o.createElement(ir,{value:ye},ol({ourProps:ll,theirProps:d,defaultTag:zt,features:Gt,visible:F==="visible",name:"Transition.Child"})))}function Ar(e,t){let{show:n,appear:r=!1,unmount:l=!0,...s}=e,a=o.useRef(null),u=Vt(e),i=q(...u?[a,t]:t===null?[]:[t]);ve();let c=Ie();if(n===void 0&&c!==null&&(n=(c&j.Open)===j.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[m,E]=o.useState(n?"visible":"hidden"),b=Yt(()=>{n||E("hidden")}),[y,f]=o.useState(!0),g=o.useRef([n]);L(()=>{y!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),f(!1))},[g,n]);let d=o.useMemo(()=>({show:n,appear:r,initial:y}),[n,r,y]);L(()=>{n?E("visible"):!je(b)&&a.current!==null&&E("hidden")},[n,b]);let p={unmount:l},h=O(()=>{var v;y&&f(!1),(v=e.beforeEnter)==null||v.call(e)}),w=O(()=>{var v;y&&f(!1),(v=e.beforeLeave)==null||v.call(e)}),x=D();return o.createElement(De.Provider,{value:b},o.createElement(Ae.Provider,{value:d},x({ourProps:{...p,as:o.Fragment,children:o.createElement(Kt,{ref:i,...p,...s,beforeEnter:h,beforeLeave:w})},theirProps:{},defaultTag:o.Fragment,features:Gt,visible:m==="visible",name:"Transition"})))}function Dr(e,t){let n=o.useContext(Ae)!==null,r=Ie()!==null;return o.createElement(o.Fragment,null,!n&&r?o.createElement(it,{ref:t,...e}):o.createElement(Kt,{ref:t,...e}))}let it=k(Ar),Kt=k(Ir),ie=k(Dr),Zt=Object.assign(it,{Child:ie,Root:it});var jr=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(jr||{}),Ur=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Ur||{});let Hr={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},st=o.createContext(null);st.displayName="DialogContext";function Ue(e){let t=o.useContext(st);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ue),n}return t}function Wr(e,t){return G(t.type,Hr,e,t)}let Jt=k(function(e,t){let n=o.useId(),{id:r=`headlessui-dialog-${n}`,open:l,onClose:s,initialFocus:a,role:u="dialog",autoFocus:i=!0,__demoMode:c=!1,unmount:m=!1,...E}=e,b=o.useRef(!1);u=function(){return u==="dialog"||u==="alertdialog"?u:(b.current||(b.current=!0,console.warn(`Invalid role [${u}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let y=Ie();l===void 0&&y!==null&&(l=(y&j.Open)===j.Open);let f=o.useRef(null),g=q(f,t),d=he(f),p=l?0:1,[h,w]=o.useReducer(Wr,{titleId:null,descriptionId:null,panelRef:o.createRef()}),x=O(()=>s(!1)),v=O(T=>w({type:0,id:T})),M=ve()?p===0:!1,[P,I]=vr(),U={get current(){var T;return(T=h.panelRef.current)!=null?T:f.current}},F=Bt(),{resolveContainers:A}=xr({mainTreeNode:F,portals:P,defaultContainers:[U]}),H=y!==null?(y&j.Closing)===j.Closing:!1;Nn(c||H?!1:M,{allowed:O(()=>{var T,Be;return[(Be=(T=f.current)==null?void 0:T.closest("[data-headlessui-portal]"))!=null?Be:null]}),disallowed:O(()=>{var T;return[(T=F==null?void 0:F.closest("body > *:not(#headlessui-portal-root)"))!=null?T:null]})}),Yn(M,A,T=>{T.preventDefault(),x()}),yr(M,d==null?void 0:d.defaultView,T=>{T.preventDefault(),T.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),x()}),Qn(c||H?!1:M,d,A),In(M,f,x);let[W,S]=Mn(),_=o.useMemo(()=>[{dialogState:p,close:x,setTitleId:v,unmount:m},h],[p,h,x,v,m]),He=o.useMemo(()=>({open:p===0}),[p]),We={ref:g,id:r,role:u,tabIndex:-1,"aria-modal":c?void 0:p===0?!0:void 0,"aria-labelledby":h.titleId,"aria-describedby":W,unmount:m},we=!Er(),X=te.None;M&&!c&&(X|=te.RestoreFocus,X|=te.TabLock,i&&(X|=te.AutoFocus),we&&(X|=te.InitialFocus));let _e=D();return o.createElement(sr,null,o.createElement(Dt,{force:!0},o.createElement(wr,null,o.createElement(st.Provider,{value:_},o.createElement(Ht,{target:f},o.createElement(Dt,{force:!1},o.createElement(S,{slot:He},o.createElement(I,null,o.createElement(Sr,{initialFocus:a,initialFocusFallback:f,containers:A,features:X},o.createElement(Fn,{value:x},_e({ourProps:We,theirProps:E,slot:He,defaultTag:_r,features:Br,visible:p===0,name:"Dialog"})))))))))))}),_r="div",Br=Te.RenderStrategy|Te.Static;function qr(e,t){let{transition:n=!1,open:r,...l}=e,s=Ie(),a=e.hasOwnProperty("open")||s!==null,u=e.hasOwnProperty("onClose");if(!a&&!u)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!a)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!u)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!s&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(r!==void 0||n)&&!l.static?o.createElement(_t,null,o.createElement(Zt,{show:r,transition:n,unmount:l.unmount},o.createElement(Jt,{ref:t,...l}))):o.createElement(_t,null,o.createElement(Jt,{ref:t,open:r,...l}))}let Xr="div";function Vr(e,t){let n=o.useId(),{id:r=`headlessui-dialog-panel-${n}`,transition:l=!1,...s}=e,[{dialogState:a,unmount:u},i]=Ue("Dialog.Panel"),c=q(t,i.panelRef),m=o.useMemo(()=>({open:a===0}),[a]),E=O(d=>{d.stopPropagation()}),b={ref:c,id:r,onClick:E},y=l?ie:o.Fragment,f=l?{unmount:u}:{},g=D();return o.createElement(y,{...f},g({ourProps:b,theirProps:s,slot:m,defaultTag:Xr,name:"Dialog.Panel"}))}let Yr="div";function zr(e,t){let{transition:n=!1,...r}=e,[{dialogState:l,unmount:s}]=Ue("Dialog.Backdrop"),a=o.useMemo(()=>({open:l===0}),[l]),u={ref:t,"aria-hidden":!0},i=n?ie:o.Fragment,c=n?{unmount:s}:{},m=D();return o.createElement(i,{...c},m({ourProps:u,theirProps:r,slot:a,defaultTag:Yr,name:"Dialog.Backdrop"}))}let Gr="h2";function Kr(e,t){let n=o.useId(),{id:r=`headlessui-dialog-title-${n}`,...l}=e,[{dialogState:s,setTitleId:a}]=Ue("Dialog.Title"),u=q(t);o.useEffect(()=>(a(r),()=>a(null)),[r,a]);let i=o.useMemo(()=>({open:s===0}),[s]),c={ref:u,id:r};return D()({ourProps:c,theirProps:l,slot:i,defaultTag:Gr,name:"Dialog.Title"})}let Zr=k(qr),at=k(Vr);k(zr);let Jr=k(Kr),Qr=Object.assign(Zr,{Panel:at,Title:Jr,Description:Pn});function Qt({onClick:e}){return $.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:e,children:[$.jsx("span",{className:"sr-only",children:"Close"}),$.jsx("svg",{className:"size-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true",children:$.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}const Rr=({modalContext:e,config:t,children:n})=>{const[r,l]=o.useState(!1);return $.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:$.jsx("div",{className:Se("im-modal-positioner flex min-h-full justify-center",{"items-start":t.position==="top","items-center":t.position==="center","items-end":t.position==="bottom"}),children:$.jsx(ie,{as:"div",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",afterEnter:()=>l(!0),afterLeave:e.afterLeave,className:Se("im-modal-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:$.jsxs(at,{className:`im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":r,children:[t.closeButton&&$.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:$.jsx(Qt,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})})},el=({modalContext:e,config:t,children:n})=>{const[r,l]=o.useState(!1);return $.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:$.jsx("div",{className:Se("im-slideover-positioner flex min-h-full items-center",{"justify-start rtl:justify-end":(t==null?void 0:t.position)==="left","justify-end rtl:justify-start":(t==null?void 0:t.position)==="right"}),children:$.jsx(ie,{as:"div",enterFrom:`opacity-0 ${t.position==="left"?"-translate-x-full":"translate-x-full"}`,enterTo:"opacity-100 translate-x-0",leaveFrom:"opacity-100 translate-x-0",leaveTo:`opacity-0 ${t.position==="left"?"-translate-x-full":"translate-x-full"}`,afterEnter:()=>l(!0),afterLeave:e.afterLeave,className:Se("im-slideover-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:$.jsxs(at,{className:`im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":r,children:[t.closeButton&&$.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:$.jsx(Qt,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})})},Rt=o.forwardRef(({name:e,children:t,onFocus:n=null,onBlur:r=null,onClose:l=null,onSuccess:s=null,onAfterLeave:a=null,...u},i)=>{const c=E=>typeof t=="function"?t(E):t,m=o.useRef(null);return o.useImperativeHandle(i,()=>m.current,[m]),$.jsx(Ge,{ref:m,name:e,onFocus:n,onBlur:r,onClose:l,onSuccess:s,...u,children:({afterLeave:E,close:b,config:y,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:x,onTopOfStack:v,reload:M,setOpen:P,shouldRender:I})=>$.jsx(Zt,{appear:!0,show:w??!1,afterLeave:a,children:$.jsxs(Qr,{as:"div",className:"im-dialog relative z-20",onClose:()=>y.closeExplicitly?null:b(),"data-inertiaui-modal-id":p,"data-inertiaui-modal-index":h,children:[h===0?$.jsx(ie,{enter:"transition transform ease-in-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition transform ease-in-out duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:v?$.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):$.jsx("div",{})}):null,h>0&&v?$.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,y.slideover?$.jsx(el,{modalContext:x,config:y,children:c({afterLeave:E,close:b,config:y,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:x,onTopOfStack:v,reload:M,setOpen:P,shouldRender:I})}):$.jsx(Rr,{modalContext:x,config:y,children:c({afterLeave:E,close:b,config:y,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:x,onTopOfStack:v,reload:M,setOpen:P,shouldRender:I})})]})})})});Rt.displayName="Modal";const tl=({href:e,method:t="get",data:n={},as:r="a",headers:l={},queryStringArrayFormat:s="brackets",onAfterLeave:a=null,onBlur:u=null,onClose:i=null,onError:c=null,onFocus:m=null,onStart:E=null,onSuccess:b=null,navigate:y=null,children:f,...g})=>{const[d,p]=o.useState(!1),[h,w]=o.useState(null),{stack:x,visit:v}=ce(),M=o.useMemo(()=>y??$e("navigate"),[y]),P={},I={};Object.keys(g).forEach(S=>{pt.includes(S)||(S.startsWith("on")&&typeof g[S]=="function"?S.toLowerCase()in window?P[S]=g[S]:I[S]=g[S]:P[S]=g[S])});const[U,F]=o.useState(!1);o.useEffect(()=>{h&&(h.onTopOfStack&&U?m==null||m():!h.onTopOfStack&&!U&&(u==null||u()),F(!h.onTopOfStack))},[x]);const A=o.useCallback(()=>{i==null||i()},[i]),H=o.useCallback(()=>{w(null),a==null||a()},[a]),W=o.useCallback(S=>{S==null||S.preventDefault(),!d&&(e.startsWith("#")||(p(!0),E==null||E()),v(e,t,n,l,un(dt(g,pt)),()=>A(x.length),H,s,M).then(_=>{w(_),_.registerEventListenersFromProps(I),b==null||b()}).catch(_=>{console.error(_),c==null||c(_)}).finally(()=>p(!1)))},[e,t,n,l,s,g,A,H]);return $.jsx(r,{...P,href:e,onClick:W,children:typeof f=="function"?f({loading:d}):f})};function nl(){return ce().stack[ze()]??null}const rl=e=>t=>(t.default.layout=n=>o.createElement(e,{},n),t);C.HeadlessModal=Ge,C.Modal=Rt,C.ModalLink=tl,C.ModalRoot=vt,C.ModalStackProvider=mt,C.getConfig=$e,C.initFromPageProps=ht,C.putConfig=on,C.renderApp=cn,C.resetConfig=ln,C.setPageLayout=rl,C.useModal=nl,C.useModalIndex=ze,C.useModalStack=ce,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inertiaui/modal-react",
3
3
  "author": "Pascal Baljet <pascal@protone.media>",
4
- "version": "0.19.2",
4
+ "version": "0.19.4",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "type": "module",
package/src/ModalRoot.jsx CHANGED
@@ -475,70 +475,6 @@ export const ModalRoot = ({ children }) => {
475
475
  let isNavigating = false
476
476
  let previousModalOnBase = false
477
477
 
478
- useEffect(
479
- () =>
480
- router.on('before', ($event) => {
481
- if (!sameUrlPath(window.location.href, $event.detail.visit.url)) {
482
- // Not navigating to the same base url
483
- return true
484
- }
485
-
486
- if ($event.detail.visit.replace) {
487
- // Prevent replacing again if we are already replacing
488
- return true
489
- }
490
-
491
- if (context.length() !== 1) {
492
- // Only replace the first modal
493
- return true
494
- }
495
-
496
- if (!previousModalOnBase) {
497
- // No modal on base
498
- return true
499
- }
500
-
501
- const {
502
- method,
503
- data,
504
- only,
505
- except,
506
- headers,
507
- errorBag,
508
- forceFormData,
509
- queryStringArrayFormat,
510
- async,
511
- showProgress,
512
- prefetch,
513
- fresh,
514
- reset,
515
- preserveUrl,
516
- } = $event.detail.visit
517
-
518
- router.visit($event.detail.visit.url, {
519
- replace: true,
520
- preserveScroll: true,
521
- preserveState: true,
522
- method,
523
- data,
524
- only,
525
- except,
526
- headers,
527
- errorBag,
528
- forceFormData,
529
- queryStringArrayFormat,
530
- async,
531
- showProgress,
532
- prefetch,
533
- fresh,
534
- reset,
535
- preserveUrl,
536
- })
537
-
538
- return false
539
- }),
540
- [],
541
- )
542
478
  useEffect(() => router.on('start', () => (isNavigating = true)), [])
543
479
  useEffect(() => router.on('finish', () => (isNavigating = false)), [])
544
480
  useEffect(