@inertiaui/modal-react 1.0.0-beta-1 → 1.0.0-beta-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- (function(M,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):(M=typeof globalThis<"u"?globalThis:M||self,o(M.InertiaUIModal={},M.React,M.jsxRuntime,M.Axios,M.react,M.core,M.ReactDOM))})(this,function(M,o,S,Ce,ie,Pr,Tr){"use strict";var Kl=Object.defineProperty;var Yl=(M,o,S)=>o in M?Kl(M,o,{enumerable:!0,configurable:!0,writable:!0,value:S}):M[o]=S;var V=(M,o,S)=>Yl(M,typeof o!="symbol"?o+"":o,S);function kr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const pe=kr(o),he={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 Fr{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(he))}put(t,r){if(typeof t=="object"){this.config={type:t.type??he.type,navigate:t.navigate??he.navigate,modal:{...he.modal,...t.modal??{}},slideover:{...he.slideover,...t.slideover??{}}};return}const n=t.split(".");let l=this.config;for(let i=0;i<n.length-1;i++)l=l[n[i]]=l[n[i]]||{};l[n[n.length-1]]=r}get(t){if(typeof t>"u")return this.config;const r=t.split(".");let n=this.config;for(const l of r){if(n[l]===void 0)return null;n=n[l]}return n}}const Pe=new Fr,Lr=()=>Pe.reset(),Ar=(e,t)=>Pe.put(e,t),Te=e=>Pe.get(e),se=(e,t)=>Pe.get(e?`slideover.${t}`:`modal.${t}`);function Ir(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 Qe(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 ue(e){return typeof e=="string"?e.toLowerCase():e}function Nr(e,t,r=!1){return r&&(t=t.map(ue)),Array.isArray(e)?e.filter(n=>!t.includes(r?ue(n):n)):Object.keys(e).reduce((n,l)=>(t.includes(r?ue(l):l)||(n[l]=e[l]),n),{})}function Dr(e,t,r=!1){return r&&(t=t.map(ue)),Array.isArray(e)?e.filter(n=>t.includes(r?ue(n):n)):Object.keys(e).reduce((n,l)=>(t.includes(r?ue(l):l)&&(n[l]=e[l]),n),{})}function jr(e){return Array.isArray(e)?e.filter(t=>t!==null):Object.keys(e).reduce((t,r)=>(r in e&&e[r]!==null&&(t[r]=e[r]),t),{})}function ve(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,r)=>r.toUpperCase()),e=e.replace(/(.)(?=[A-Z])/g,"$1-"),e.toLowerCase()):e):""}const ke=o.createContext(null);ke.displayName="ModalStackContext";let Ot=null,Mt=null,ae=null,Fe={},Re=[],de={};const Ct=({children:e})=>{const[t,r]=o.useState([]),[n,l]=o.useState({}),i=v=>{r(c=>{const f=v([...c]),g=y=>{var p;return f.length<2?!0:((p=f.map(x=>({id:x.id,shouldRender:x.shouldRender})).reverse().find(x=>x.shouldRender))==null?void 0:p.id)===y};return f.forEach((y,p)=>{f[p].onTopOfStack=g(y.id),f[p].getParentModal=()=>p<1?null:f.slice(0,p).reverse().find(x=>x.isOpen),f[p].getChildModal=()=>p===f.length-1?null:f.slice(p+1).find(x=>x.isOpen)}),f})};o.useEffect(()=>{Re=t},[t]);class a{constructor(c,f,g,y,p){V(this,"show",()=>{i(c=>c.map(f=>(f.id===this.id&&!f.isOpen&&(f.isOpen=!0,f.shouldRender=!0),f)))});V(this,"setOpen",c=>{c?this.show():this.close()});V(this,"close",()=>{i(c=>{let f=!1;const g=c.map(y=>{var p;return y.id===this.id&&y.isOpen&&(Object.keys(y.listeners).forEach(x=>{y.off(x)}),y.isOpen=!1,(p=y.onCloseCallback)==null||p.call(y),f=!0),y});return f?g:c})});V(this,"afterLeave",()=>{this.isOpen||i(c=>{const f=c.map(g=>{var y;return g.id===this.id&&!g.isOpen&&(g.shouldRender=!1,(y=g.afterLeaveCallback)==null||y.call(g),g.afterLeaveCallback=null),g});return this.index===0?[]:f})});V(this,"on",(c,f)=>{c=ve(c),this.listeners[c]=this.listeners[c]??[],this.listeners[c].push(f)});V(this,"off",(c,f)=>{var g;c=ve(c),f?this.listeners[c]=((g=this.listeners[c])==null?void 0:g.filter(y=>y!==f))??[]:delete this.listeners[c]});V(this,"emit",(c,...f)=>{var g;(g=this.listeners[ve(c)])==null||g.forEach(y=>y(...f))});V(this,"registerEventListenersFromProps",c=>{const f=[];return Object.keys(c).filter(g=>g.startsWith("on")).forEach(g=>{const y=ve(g).replace(/^on-/,"");this.on(y,c[g]),f.push(()=>this.off(y,c[g]))}),()=>f.forEach(g=>g())});V(this,"reload",(c={})=>{var p,x;let f=Object.keys(this.response.props);if(c.only&&(f=c.only),c.except&&(f=Nr(f,c.except)),!((p=this.response)!=null&&p.url))return;const g=(c.method??"get").toLowerCase(),y=c.data??{};(x=c.onStart)==null||x.call(c),Ce({url:this.response.url,method:g,data:g==="get"?{}:y,params:g==="get"?y:{},headers:{...c.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":f.join(","),"X-InertiaUI-Modal":Qe(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":ae}}).then(O=>{var F;this.updateProps(O.data.props),(F=c.onSuccess)==null||F.call(c,O)}).catch(O=>{var F;(F=c.onError)==null||F.call(c,O)}).finally(()=>{var O;(O=c.onFinish)==null||O.call(c)})});V(this,"updateProps",c=>{Object.assign(this.props,c),i(f=>f)});if(this.id=f.id??Qe(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=c,this.props=f.props,this.response=f,this.config=g??{},this.onCloseCallback=y,this.afterLeaveCallback=p,de[this.id]){this.config={...this.config,...de[this.id].config??{}};const x=de[this.id].onClose,O=de[this.id].onAfterLeave;x&&(this.onCloseCallback=y?()=>{y(),x()}:x),O&&(this.afterLeaveCallback=p?()=>{p(),O()}:O),delete de[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=(v,c={},f=null,g=null)=>Mt(v.component).then(y=>d(y,v,c,f,g)),s=v=>{var f,g;const c=(g=(f=v.response)==null?void 0:f.meta)==null?void 0:g.deferredProps;c&&Object.keys(c).forEach(y=>{v.reload({only:c[y]})})},d=(v,c,f,g,y)=>{const p=new a(v,c,f,g,y);return p.index=t.length,i(x=>[...x,p]),s(p),p.show(),p};function h(v,c,f,g){if(!n[v])throw new Error(`The local modal "${v}" has not been registered.`);const y=d(null,{},c,f,g);return y.name=v,n[v].callback(y),y}const b=(v,c={})=>E(v,c.method??"get",c.data??{},c.headers??{},c.config??{},c.onClose,c.onAfterLeave,c.queryStringArrayFormat??"brackets",c.navigate??Te("navigate")).then(f=>{const g=c.listeners??{};return Object.keys(g).forEach(y=>{const p=ve(y);f.on(p,g[y])}),f}),E=(v,c,f={},g={},y={},p=null,x=null,O="brackets",F=!1)=>{const U=Qe();return new Promise((k,D)=>{if(v.startsWith("#")){k(h(v.substring(1),y,p,x));return}const[H,A]=Pr.mergeDataIntoQueryString(c,v||"",f,O);let T=F&&t.length===0;if(t.length===0&&(ae=typeof window<"u"?window.location.href:""),g={...g,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":Ot,"X-InertiaUI-Modal":U,"X-InertiaUI-Modal-Use-Router":T?1:0,"X-InertiaUI-Modal-Base-Url":ae},T)return Fe={},de[U]={config:y,onClose:p,onAfterLeave:x},ie.router.visit(H,{method:c,data:A,headers:g,preserveScroll:!0,preserveState:!0,onError:D,onBefore:()=>{Fe[U]=k}});Ce({url:H,method:c,data:A,headers:g}).then(I=>k(u(I.data,y,p,x))).catch(I=>{D(I)})})},$={stack:t,localModals:n,push:d,pushFromResponseData:u,length:()=>Re.length,closeAll:()=>{Re.reverse().forEach(v=>v.close())},reset:()=>i(()=>[]),visit:E,visitModal:b,registerLocalModal:(v,c)=>{l(f=>({...f,[v]:{name:v,callback:c}}))},removeLocalModal:v=>{l(c=>{const f={...c};return delete f[v],f})},onModalOnBase:v=>{const c=Fe[v.id];c&&(c(v),delete Fe[v.id])}};return S.jsx(ke.Provider,{value:$,children:e})},ge=()=>{const e=o.useContext(ke);if(e===null)throw new Error("useModalStack must be used within a ModalStackProvider");return e},Pt=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],Tt=e=>{e.initialPage&&(Ot=e.initialPage.version),e.resolveComponent&&(Mt=e.resolveComponent)},_r=(e,t)=>{Tt(t);const r=({Component:n,props:l,key:i})=>{const a=()=>{const u=o.createElement(n,{key:i,...l});return typeof n.layout=="function"?n.layout(u):Array.isArray(n.layout)?n.layout.concat(u).reverse().reduce((d,h)=>o.createElement(h,l,d)):u};return S.jsxs(S.Fragment,{children:[a(),S.jsx(kt,{})]})};return S.jsx(Ct,{children:S.jsx(e,{...t,children:r})})},kt=({children:e})=>{var s,d;const t=o.useContext(ke),r=ie.usePage();let n=!1,l=!1,i=!!((s=r.props)!=null&&s._inertiaui_modal);o.useEffect(()=>ie.router.on("start",()=>n=!0),[]),o.useEffect(()=>ie.router.on("finish",()=>n=!1),[]),o.useEffect(()=>ie.router.on("navigate",function(h){const b=h.detail.page.props._inertiaui_modal;if(!b){l&&t.closeAll(),ae=null,i=!1;return}l=b,ae=b.baseUrl,t.pushFromResponseData(b,{},()=>{if(!b.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!n&&window.location.href!==b.baseUrl&&ie.router.visit(b.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(t.onModalOnBase)}),[]);const a=h=>{var b;return h.headers["X-InertiaUI-Modal-Base-Url"]=ae??(i?(b=r.props._inertiaui_modal)==null?void 0:b.baseUrl:null),h};o.useEffect(()=>(Ce.interceptors.request.use(a),()=>Ce.interceptors.request.eject(a)),[]);const u=o.useRef();return o.useEffect(()=>{var E,w;const h=(E=r.props)==null?void 0:E._inertiaui_modal,b=u.current;u.current=h,h&&b&&h.component===b.component&&Ir(h.url,b.url)&&((w=t.stack[0])==null||w.updateProps(h.props??{}))},[(d=r.props)==null?void 0:d._inertiaui_modal]),S.jsxs(S.Fragment,{children:[e,t.stack.length>0&&S.jsx(Ft,{index:0})]})},et=o.createContext(null);et.displayName="ModalIndexContext";const tt=()=>{const e=o.useContext(et);if(e===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return e},Ft=({index:e})=>{const{stack:t}=ge(),r=o.useMemo(()=>t[e],[t,e]);return(r==null?void 0:r.component)&&S.jsx(et.Provider,{value:e,children:S.jsx(r.component,{...r.props,onModalEvent:(...n)=>r.emit(...n)})})};function rt(){return ge().stack[tt()]??null}const Lt=({children:e,data:t,fallback:r})=>{if(!t)throw new Error("`<Deferred>` requires a `data` prop to be a string or array of strings");const[n,l]=o.useState(!1),i=Array.isArray(t)?t:[t],a=rt().props;return o.useEffect(()=>{l(i.every(u=>a[u]!==void 0))},[a,i]),n?e:r};Lt.displayName="InertiaModalDeferred";const nt=o.forwardRef(({name:e,children:t,onFocus:r=null,onBlur:n=null,onClose:l=null,onSuccess:i=null,...a},u)=>{const s=tt(),{stack:d,registerLocalModal:h,removeLocalModal:b}=ge(),[E,w]=o.useState(null),m=o.useMemo(()=>e?E:d[s],[e,E,s,d]),$=o.useMemo(()=>{var p;return(p=d.find(x=>x.shouldRender&&x.index>(m==null?void 0:m.index)))==null?void 0:p.index},[s,d]),v=o.useMemo(()=>(m==null?void 0:m.config.slideover)??a.slideover??Te("type")==="slideover",[a.slideover]),c=o.useMemo(()=>({slideover:v,closeButton:a.closeButton??se(v,"closeButton"),closeExplicitly:a.closeExplicitly??se(v,"closeExplicitly"),maxWidth:a.maxWidth??se(v,"maxWidth"),paddingClasses:a.paddingClasses??se(v,"paddingClasses"),panelClasses:a.panelClasses??se(v,"panelClasses"),position:a.position??se(v,"position"),...m==null?void 0:m.config}),[a,m==null?void 0:m.config]);o.useEffect(()=>{if(e){let p=null;return h(e,x=>{p=x.registerEventListenersFromProps(a),w(x)}),()=>{p==null||p(),p=null,b(e)}}return m.registerEventListenersFromProps(a)},[e]);const f=o.useRef(m);o.useEffect(()=>{f.current=m},[m]),o.useEffect(()=>{m!==null&&(m.isOpen?i==null||i():l==null||l())},[m==null?void 0:m.isOpen]);const[g,y]=o.useState(!1);return o.useEffect(()=>{g&&m!==null&&m.isOpen&&(m.onTopOfStack?r==null||r():n==null||n()),y(!0)},[m==null?void 0:m.onTopOfStack]),o.useImperativeHandle(u,()=>({afterLeave:()=>{var p;return(p=f.current)==null?void 0:p.afterLeave()},close:()=>{var p;return(p=f.current)==null?void 0:p.close()},emit:(...p)=>{var x;return(x=f.current)==null?void 0:x.emit(...p)},getChildModal:()=>{var p;return(p=f.current)==null?void 0:p.getChildModal()},getParentModal:()=>{var p;return(p=f.current)==null?void 0:p.getParentModal()},reload:(...p)=>{var x;return(x=f.current)==null?void 0:x.reload(...p)},setOpen:()=>{var p;return(p=f.current)==null?void 0:p.setOpen()},get id(){var p;return(p=f.current)==null?void 0:p.id},get index(){var p;return(p=f.current)==null?void 0:p.index},get isOpen(){var p;return(p=f.current)==null?void 0:p.isOpen},get config(){var p;return(p=f.current)==null?void 0:p.config},get modalContext(){return f.current},get onTopOfStack(){var p;return(p=f.current)==null?void 0:p.onTopOfStack},get shouldRender(){var p;return(p=f.current)==null?void 0:p.shouldRender}}),[m]),(m==null?void 0:m.shouldRender)&&S.jsxs(S.Fragment,{children:[typeof t=="function"?t({afterLeave:m.afterLeave,close:m.close,config:c,emit:m.emit,getChildModal:m.getChildModal,getParentModal:m.getParentModal,id:m.id,index:m.index,isOpen:m.isOpen,modalContext:m,onTopOfStack:m.onTopOfStack,reload:m.reload,setOpen:m.setOpen,shouldRender:m.shouldRender}):t,$&&S.jsx(Ft,{index:$})]})});nt.displayName="HeadlessModal";function At(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(r=At(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Le(){for(var e,t,r=0,n="",l=arguments.length;r<l;r++)(e=arguments[r])&&(t=At(e))&&(n&&(n+=" "),n+=t);return n}var Wr=Object.defineProperty,Ur=(e,t,r)=>t in e?Wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lt=(e,t,r)=>(Ur(e,typeof t!="symbol"?t+"":t,r),r);let Hr=class{constructor(){lt(this,"current",this.detect()),lt(this,"handoffState","pending"),lt(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"}},ee=new Hr;function Ae(e){var t,r;return ee.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(r=(t=e.current)==null?void 0:t.ownerDocument)!=null?r:document:null:document}function Ie(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function X(){let e=[],t={addEventListener(r,n,l,i){return r.addEventListener(n,l,i),t.add(()=>r.removeEventListener(n,l,i))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Ie(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,l){let i=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:l}),this.add(()=>{Object.assign(r.style,{[n]:i})})},group(r){let n=X();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let l of e.splice(n,1))l()}},dispose(){for(let r of e.splice(0))r()}};return t}function ot(){let[e]=o.useState(X);return o.useEffect(()=>()=>e.dispose(),[e]),e}let L=(e,t)=>{ee.isServer?o.useEffect(e,t):o.useLayoutEffect(e,t)};function te(e){let t=o.useRef(e);return L(()=>{t.current=e},[e]),t}let P=function(e){let t=te(e);return o.useCallback((...r)=>t.current(...r),[t])},Vr=o.createContext(void 0);function Br(){return o.useContext(Vr)}function it(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function z(e,t,...r){if(e in t){let l=t[e];return typeof l=="function"?l(...r):l}let n=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(n,z),n}var Ne=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ne||{}),Y=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Y||{});function j(){let e=Xr();return o.useCallback(t=>qr({mergeRefs:e,...t}),[e])}function qr({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:l,visible:i=!0,name:a,mergeRefs:u}){u=u??zr;let s=It(t,e);if(i)return De(s,r,n,a,u);let d=l??0;if(d&2){let{static:h=!1,...b}=s;if(h)return De(b,r,n,a,u)}if(d&1){let{unmount:h=!0,...b}=s;return z(h?0:1,{0(){return null},1(){return De({...b,hidden:!0,style:{display:"none"}},r,n,a,u)}})}return De(s,r,n,a,u)}function De(e,t={},r,n,l){let{as:i=r,children:a,refName:u="ref",...s}=st(e,["unmount","static"]),d=e.ref!==void 0?{[u]:e.ref}:{},h=typeof a=="function"?a(t):a;"className"in s&&s.className&&typeof s.className=="function"&&(s.className=s.className(t)),s["aria-labelledby"]&&s["aria-labelledby"]===s.id&&(s["aria-labelledby"]=void 0);let b={};if(t){let E=!1,w=[];for(let[m,$]of Object.entries(t))typeof $=="boolean"&&(E=!0),$===!0&&w.push(m.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(E){b["data-headlessui-state"]=w.join(" ");for(let m of w)b[`data-${m}`]=""}}if(i===o.Fragment&&(Object.keys(re(s)).length>0||Object.keys(re(b)).length>0))if(!o.isValidElement(h)||Array.isArray(h)&&h.length>1){if(Object.keys(re(s)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(re(s)).concat(Object.keys(re(b))).map(E=>` - ${E}`).join(`
1
+ (function(M,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):(M=typeof globalThis<"u"?globalThis:M||self,o(M.InertiaUIModal={},M.React,M.jsxRuntime,M.Axios,M.react,M.core,M.ReactDOM))})(this,(function(M,o,O,Te,ue,Pr,Tr){"use strict";var Yl=Object.defineProperty;var Zl=(M,o,O)=>o in M?Yl(M,o,{enumerable:!0,configurable:!0,writable:!0,value:O}):M[o]=O;var B=(M,o,O)=>Zl(M,typeof o!="symbol"?o+"":o,O);function kr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ve=kr(o),ge={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 Lr{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(ge))}put(t,r){if(typeof t=="object"){this.config={type:t.type??ge.type,navigate:t.navigate??ge.navigate,modal:{...ge.modal,...t.modal??{}},slideover:{...ge.slideover,...t.slideover??{}}};return}const n=t.split(".");let l=this.config;for(let i=0;i<n.length-1;i++)l=l[n[i]]=l[n[i]]||{};l[n[n.length-1]]=r}get(t){if(typeof t>"u")return this.config;const r=t.split(".");let n=this.config;for(const l of r){if(n[l]===void 0)return null;n=n[l]}return n}}const ke=new Lr,Fr=()=>ke.reset(),Ar=(e,t)=>ke.put(e,t),Le=e=>ke.get(e),ae=(e,t)=>ke.get(e?`slideover.${t}`:`modal.${t}`);function Ir(e,t){const r=typeof window<"u"?window.location.origin:"http://localhost";return e=typeof e=="string"?new URL(e,r):e,t=typeof t=="string"?new URL(t,r):t,`${e.origin}${e.pathname}`==`${t.origin}${t.pathname}`}function Re(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 de(e){return typeof e=="string"?e.toLowerCase():e}function Nr(e,t,r=!1){return r&&(t=t.map(de)),Array.isArray(e)?e.filter(n=>!t.includes(r?de(n):n)):Object.keys(e).reduce((n,l)=>(t.includes(r?de(l):l)||(n[l]=e[l]),n),{})}function Dr(e,t,r=!1){return r&&(t=t.map(de)),Array.isArray(e)?e.filter(n=>t.includes(r?de(n):n)):Object.keys(e).reduce((n,l)=>(t.includes(r?de(l):l)&&(n[l]=e[l]),n),{})}function jr(e){return Array.isArray(e)?e.filter(t=>t!==null):Object.keys(e).reduce((t,r)=>(r in e&&e[r]!==null&&(t[r]=e[r]),t),{})}function we(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,r)=>r.toUpperCase()),e=e.replace(/(.)(?=[A-Z])/g,"$1-"),e.toLowerCase()):e):""}function _r(e){if(typeof window<"u")return e.toLowerCase()in window;if(typeof document<"u"){const n=document.createElement("div");return e.toLowerCase()in n}const t=e.toLowerCase();return[/^on(click|dblclick|mousedown|mouseup|mouseover|mouseout|mousemove|mouseenter|mouseleave)$/,/^on(keydown|keyup|keypress)$/,/^on(focus|blur|change|input|submit|reset)$/,/^on(load|unload|error|resize|scroll)$/,/^on(touchstart|touchend|touchmove|touchcancel)$/,/^on(pointerdown|pointerup|pointermove|pointerenter|pointerleave|pointercancel)$/,/^on(drag|dragstart|dragend|dragenter|dragleave|dragover|drop)$/,/^on(animationstart|animationend|animationiteration)$/,/^on(transitionstart|transitionend|transitionrun|transitioncancel)$/].some(n=>n.test(t))}const Fe=o.createContext(null);Fe.displayName="ModalStackContext";let St=null,Mt=null,ce=null,Ae={},et=[],fe={};const Ct=({children:e})=>{const[t,r]=o.useState([]),[n,l]=o.useState({}),i=v=>{r(c=>{const f=v([...c]),g=y=>{var p;return f.length<2?!0:((p=f.map(x=>({id:x.id,shouldRender:x.shouldRender})).reverse().find(x=>x.shouldRender))==null?void 0:p.id)===y};return f.forEach((y,p)=>{f[p].onTopOfStack=g(y.id),f[p].getParentModal=()=>p<1?null:f.slice(0,p).reverse().find(x=>x.isOpen),f[p].getChildModal=()=>p===f.length-1?null:f.slice(p+1).find(x=>x.isOpen)}),f})};o.useEffect(()=>{et=t},[t]);class a{constructor(c,f,g,y,p){B(this,"show",()=>{i(c=>c.map(f=>(f.id===this.id&&!f.isOpen&&(f.isOpen=!0,f.shouldRender=!0),f)))});B(this,"setOpen",c=>{c?this.show():this.close()});B(this,"close",()=>{i(c=>{let f=!1;const g=c.map(y=>{var p;return y.id===this.id&&y.isOpen&&(Object.keys(y.listeners).forEach(x=>{y.off(x)}),y.isOpen=!1,(p=y.onCloseCallback)==null||p.call(y),f=!0),y});return f?g:c})});B(this,"afterLeave",()=>{this.isOpen||i(c=>{const f=c.map(g=>{var y;return g.id===this.id&&!g.isOpen&&(g.shouldRender=!1,(y=g.afterLeaveCallback)==null||y.call(g),g.afterLeaveCallback=null),g});return this.index===0?[]:f})});B(this,"on",(c,f)=>{c=we(c),this.listeners[c]=this.listeners[c]??[],this.listeners[c].push(f)});B(this,"off",(c,f)=>{var g;c=we(c),f?this.listeners[c]=((g=this.listeners[c])==null?void 0:g.filter(y=>y!==f))??[]:delete this.listeners[c]});B(this,"emit",(c,...f)=>{var g;(g=this.listeners[we(c)])==null||g.forEach(y=>y(...f))});B(this,"registerEventListenersFromProps",c=>{const f=[];return Object.keys(c).filter(g=>g.startsWith("on")).forEach(g=>{const y=we(g).replace(/^on-/,"");this.on(y,c[g]),f.push(()=>this.off(y,c[g]))}),()=>f.forEach(g=>g())});B(this,"reload",(c={})=>{var p,x;let f=Object.keys(this.response.props);if(c.only&&(f=c.only),c.except&&(f=Nr(f,c.except)),!((p=this.response)!=null&&p.url))return;const g=(c.method??"get").toLowerCase(),y=c.data??{};(x=c.onStart)==null||x.call(c),Te({url:this.response.url,method:g,data:g==="get"?{}:y,params:g==="get"?y:{},headers:{...c.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":f.join(","),"X-InertiaUI-Modal":Re(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":ce}}).then(S=>{var F;this.updateProps(S.data.props),(F=c.onSuccess)==null||F.call(c,S)}).catch(S=>{var F;(F=c.onError)==null||F.call(c,S)}).finally(()=>{var S;(S=c.onFinish)==null||S.call(c)})});B(this,"updateProps",c=>{Object.assign(this.props,c),i(f=>f)});if(this.id=f.id??Re(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=c,this.props=f.props,this.response=f,this.config=g??{},this.onCloseCallback=y,this.afterLeaveCallback=p,fe[this.id]){this.config={...this.config,...fe[this.id].config??{}};const x=fe[this.id].onClose,S=fe[this.id].onAfterLeave;x&&(this.onCloseCallback=y?()=>{y(),x()}:x),S&&(this.afterLeaveCallback=p?()=>{p(),S()}:S),delete fe[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=(v,c={},f=null,g=null)=>Mt(v.component).then(y=>d(y,v,c,f,g)),s=v=>{var f,g;const c=(g=(f=v.response)==null?void 0:f.meta)==null?void 0:g.deferredProps;c&&Object.keys(c).forEach(y=>{v.reload({only:c[y]})})},d=(v,c,f,g,y)=>{const p=new a(v,c,f,g,y);return p.index=t.length,i(x=>[...x,p]),s(p),p.show(),p};function h(v,c,f,g){if(!n[v])throw new Error(`The local modal "${v}" has not been registered.`);const y=d(null,{},c,f,g);return y.name=v,n[v].callback(y),y}const b=(v,c={})=>E(v,c.method??"get",c.data??{},c.headers??{},c.config??{},c.onClose,c.onAfterLeave,c.queryStringArrayFormat??"brackets",c.navigate??Le("navigate"),c.onStart,c.onSuccess,c.onError).then(f=>{const g=c.listeners??{};return Object.keys(g).forEach(y=>{const p=we(y);f.on(p,g[y])}),f}),E=(v,c,f={},g={},y={},p=null,x=null,S="brackets",F=!1,j=null,k=null,A=null)=>{const H=Re();return new Promise((I,T)=>{if(v.startsWith("#")){I(h(v.substring(1),y,p,x));return}const[_,pe]=Pr.mergeDataIntoQueryString(c,v||"",f,S);let se=F&&t.length===0;if(t.length===0&&(ce=typeof window<"u"?window.location.href:""),g={...g,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":St,"X-InertiaUI-Modal":H,"X-InertiaUI-Modal-Use-Router":se?1:0,"X-InertiaUI-Modal-Base-Url":ce},se)return Ae={},fe[H]={config:y,onClose:p,onAfterLeave:x},ue.router.visit(_,{method:c,data:pe,headers:g,preserveScroll:!0,preserveState:!0,onError(...L){A==null||A(...L),T(...L)},onStart(...L){j==null||j(...L)},onSuccess(...L){k==null||k(...L)},onBefore:()=>{Ae[H]=I}});j==null||j(),Te({url:_,method:c,data:pe,headers:g}).then(L=>{k==null||k(L),I(u(L.data,y,p,x))}).catch((...L)=>{A==null||A(...L),T(...L)})})},$={stack:t,localModals:n,push:d,pushFromResponseData:u,length:()=>et.length,closeAll:()=>{et.reverse().forEach(v=>v.close())},reset:()=>i(()=>[]),visit:E,visitModal:b,registerLocalModal:(v,c)=>{l(f=>({...f,[v]:{name:v,callback:c}}))},removeLocalModal:v=>{l(c=>{const f={...c};return delete f[v],f})},onModalOnBase:v=>{const c=Ae[v.id];c&&(c(v),delete Ae[v.id])}};return O.jsx(Fe.Provider,{value:$,children:e})},be=()=>{const e=o.useContext(Fe);if(e===null)throw new Error("useModalStack must be used within a ModalStackProvider");return e},Pt=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],Tt=e=>{e.initialPage&&(St=e.initialPage.version),e.resolveComponent&&(Mt=e.resolveComponent)},Wr=(e,t)=>{Tt(t);const r=({Component:n,props:l,key:i})=>{const a=()=>{const u=o.createElement(n,{key:i,...l});return typeof n.layout=="function"?n.layout(u):Array.isArray(n.layout)?n.layout.concat(u).reverse().reduce((d,h)=>o.createElement(h,l,d)):u};return O.jsxs(O.Fragment,{children:[a(),O.jsx(kt,{})]})};return O.jsx(Ct,{children:O.jsx(e,{...t,children:r})})},kt=({children:e})=>{var s,d;const t=o.useContext(Fe),r=ue.usePage();let n=!1,l=!1,i=!!((s=r.props)!=null&&s._inertiaui_modal);o.useEffect(()=>ue.router.on("start",()=>n=!0),[]),o.useEffect(()=>ue.router.on("finish",()=>n=!1),[]),o.useEffect(()=>ue.router.on("navigate",function(h){const b=h.detail.page.props._inertiaui_modal;if(!b){l&&t.closeAll(),ce=null,i=!1;return}l=b,ce=b.baseUrl,t.pushFromResponseData(b,{},()=>{if(!b.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!n&&typeof window<"u"&&window.location.href!==b.baseUrl&&ue.router.visit(b.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(t.onModalOnBase)}),[]);const a=h=>{var b;return h.headers["X-InertiaUI-Modal-Base-Url"]=ce??(i?(b=r.props._inertiaui_modal)==null?void 0:b.baseUrl:null),h};o.useEffect(()=>(Te.interceptors.request.use(a),()=>Te.interceptors.request.eject(a)),[]);const u=o.useRef();return o.useEffect(()=>{var E,w;const h=(E=r.props)==null?void 0:E._inertiaui_modal,b=u.current;u.current=h,h&&b&&h.component===b.component&&Ir(h.url,b.url)&&((w=t.stack[0])==null||w.updateProps(h.props??{}))},[(d=r.props)==null?void 0:d._inertiaui_modal]),O.jsxs(O.Fragment,{children:[e,t.stack.length>0&&O.jsx(Lt,{index:0})]})},tt=o.createContext(null);tt.displayName="ModalIndexContext";const rt=()=>{const e=o.useContext(tt);if(e===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return e},Lt=({index:e})=>{const{stack:t}=be(),r=o.useMemo(()=>t[e],[t,e]);return(r==null?void 0:r.component)&&O.jsx(tt.Provider,{value:e,children:O.jsx(r.component,{...r.props,onModalEvent:(...n)=>r.emit(...n)})})};function nt(){return be().stack[rt()]??null}const Ft=({children:e,data:t,fallback:r})=>{if(!t)throw new Error("`<Deferred>` requires a `data` prop to be a string or array of strings");const[n,l]=o.useState(!1),i=Array.isArray(t)?t:[t],a=nt().props;return o.useEffect(()=>{l(i.every(u=>a[u]!==void 0))},[a,i]),n?e:r};Ft.displayName="InertiaModalDeferred";const lt=o.forwardRef(({name:e,children:t,onFocus:r=null,onBlur:n=null,onClose:l=null,onSuccess:i=null,...a},u)=>{const s=rt(),{stack:d,registerLocalModal:h,removeLocalModal:b}=be(),[E,w]=o.useState(null),m=o.useMemo(()=>e?E:d[s],[e,E,s,d]),$=o.useMemo(()=>{var p;return(p=d.find(x=>x.shouldRender&&x.index>(m==null?void 0:m.index)))==null?void 0:p.index},[s,d]),v=o.useMemo(()=>(m==null?void 0:m.config.slideover)??a.slideover??Le("type")==="slideover",[a.slideover]),c=o.useMemo(()=>({slideover:v,closeButton:a.closeButton??ae(v,"closeButton"),closeExplicitly:a.closeExplicitly??ae(v,"closeExplicitly"),maxWidth:a.maxWidth??ae(v,"maxWidth"),paddingClasses:a.paddingClasses??ae(v,"paddingClasses"),panelClasses:a.panelClasses??ae(v,"panelClasses"),position:a.position??ae(v,"position"),...m==null?void 0:m.config}),[a,m==null?void 0:m.config]);o.useEffect(()=>{if(e){let p=null;return h(e,x=>{p=x.registerEventListenersFromProps(a),w(x)}),()=>{p==null||p(),p=null,b(e)}}return m.registerEventListenersFromProps(a)},[e]);const f=o.useRef(m);o.useEffect(()=>{f.current=m},[m]),o.useEffect(()=>{m!==null&&(m.isOpen?i==null||i():l==null||l())},[m==null?void 0:m.isOpen]);const[g,y]=o.useState(!1);return o.useEffect(()=>{g&&m!==null&&m.isOpen&&(m.onTopOfStack?r==null||r():n==null||n()),y(!0)},[m==null?void 0:m.onTopOfStack]),o.useImperativeHandle(u,()=>({afterLeave:()=>{var p;return(p=f.current)==null?void 0:p.afterLeave()},close:()=>{var p;return(p=f.current)==null?void 0:p.close()},emit:(...p)=>{var x;return(x=f.current)==null?void 0:x.emit(...p)},getChildModal:()=>{var p;return(p=f.current)==null?void 0:p.getChildModal()},getParentModal:()=>{var p;return(p=f.current)==null?void 0:p.getParentModal()},reload:(...p)=>{var x;return(x=f.current)==null?void 0:x.reload(...p)},setOpen:()=>{var p;return(p=f.current)==null?void 0:p.setOpen()},get id(){var p;return(p=f.current)==null?void 0:p.id},get index(){var p;return(p=f.current)==null?void 0:p.index},get isOpen(){var p;return(p=f.current)==null?void 0:p.isOpen},get config(){var p;return(p=f.current)==null?void 0:p.config},get modalContext(){return f.current},get onTopOfStack(){var p;return(p=f.current)==null?void 0:p.onTopOfStack},get shouldRender(){var p;return(p=f.current)==null?void 0:p.shouldRender}}),[m]),(m==null?void 0:m.shouldRender)&&O.jsxs(O.Fragment,{children:[typeof t=="function"?t({afterLeave:m.afterLeave,close:m.close,config:c,emit:m.emit,getChildModal:m.getChildModal,getParentModal:m.getParentModal,id:m.id,index:m.index,isOpen:m.isOpen,modalContext:m,onTopOfStack:m.onTopOfStack,reload:m.reload,setOpen:m.setOpen,shouldRender:m.shouldRender}):t,$&&O.jsx(Lt,{index:$})]})});lt.displayName="HeadlessModal";function At(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(r=At(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ie(){for(var e,t,r=0,n="",l=arguments.length;r<l;r++)(e=arguments[r])&&(t=At(e))&&(n&&(n+=" "),n+=t);return n}var Ur=Object.defineProperty,Hr=(e,t,r)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ot=(e,t,r)=>(Hr(e,typeof t!="symbol"?t+"":t,r),r);let Vr=class{constructor(){ot(this,"current",this.detect()),ot(this,"handoffState","pending"),ot(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 Vr;function Ne(e){var t,r;return q.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(r=(t=e.current)==null?void 0:t.ownerDocument)!=null?r:document:null:document}function De(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function G(){let e=[],t={addEventListener(r,n,l,i){return r.addEventListener(n,l,i),t.add(()=>r.removeEventListener(n,l,i))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return De(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,l){let i=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:l}),this.add(()=>{Object.assign(r.style,{[n]:i})})},group(r){let n=G();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let l of e.splice(n,1))l()}},dispose(){for(let r of e.splice(0))r()}};return t}function it(){let[e]=o.useState(G);return o.useEffect(()=>()=>e.dispose(),[e]),e}let N=(e,t)=>{q.isServer?o.useEffect(e,t):o.useLayoutEffect(e,t)};function re(e){let t=o.useRef(e);return N(()=>{t.current=e},[e]),t}let P=function(e){let t=re(e);return o.useCallback((...r)=>t.current(...r),[t])},Br=o.createContext(void 0);function qr(){return o.useContext(Br)}function st(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function K(e,t,...r){if(e in t){let l=t[e];return typeof l=="function"?l(...r):l}let n=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(n,K),n}var je=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(je||{}),J=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(J||{});function W(){let e=zr();return o.useCallback(t=>Xr({mergeRefs:e,...t}),[e])}function Xr({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:l,visible:i=!0,name:a,mergeRefs:u}){u=u??Gr;let s=It(t,e);if(i)return _e(s,r,n,a,u);let d=l??0;if(d&2){let{static:h=!1,...b}=s;if(h)return _e(b,r,n,a,u)}if(d&1){let{unmount:h=!0,...b}=s;return K(h?0:1,{0(){return null},1(){return _e({...b,hidden:!0,style:{display:"none"}},r,n,a,u)}})}return _e(s,r,n,a,u)}function _e(e,t={},r,n,l){let{as:i=r,children:a,refName:u="ref",...s}=ut(e,["unmount","static"]),d=e.ref!==void 0?{[u]:e.ref}:{},h=typeof a=="function"?a(t):a;"className"in s&&s.className&&typeof s.className=="function"&&(s.className=s.className(t)),s["aria-labelledby"]&&s["aria-labelledby"]===s.id&&(s["aria-labelledby"]=void 0);let b={};if(t){let E=!1,w=[];for(let[m,$]of Object.entries(t))typeof $=="boolean"&&(E=!0),$===!0&&w.push(m.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(E){b["data-headlessui-state"]=w.join(" ");for(let m of w)b[`data-${m}`]=""}}if(i===o.Fragment&&(Object.keys(ne(s)).length>0||Object.keys(ne(b)).length>0))if(!o.isValidElement(h)||Array.isArray(h)&&h.length>1){if(Object.keys(ne(s)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(ne(s)).concat(Object.keys(ne(b))).map(E=>` - ${E}`).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(E=>` - ${E}`).join(`
3
3
  `)].join(`
4
- `))}else{let E=h.props,w=E==null?void 0:E.className,m=typeof w=="function"?(...c)=>it(w(...c),s.className):it(w,s.className),$=m?{className:m}:{},v=It(h.props,re(st(s,["ref"])));for(let c in b)c in v&&delete b[c];return o.cloneElement(h,Object.assign({},v,b,d,{ref:l(Gr(h),d.ref)},$))}return o.createElement(i,Object.assign({},st(s,["ref"]),i!==o.Fragment&&d,i!==o.Fragment&&b),h)}function Xr(){let e=o.useRef([]),t=o.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function zr(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function It(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let l in n)l.startsWith("on")&&typeof n[l]=="function"?(r[l]!=null||(r[l]=[]),r[l].push(n[l])):t[l]=n[l];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[l=>{var i;return(i=l==null?void 0:l.preventDefault)==null?void 0:i.call(l)}]);for(let n in r)Object.assign(t,{[n](l,...i){let a=r[n];for(let u of a){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;u(l,...i)}}});return t}function N(e){var t;return Object.assign(o.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function re(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function st(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function Gr(e){return o.version.split(".")[0]>="19"?e.props.ref:e.ref}let Kr="span";var je=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(je||{});function Yr(e,t){var r;let{features:n=1,...l}=e,i={ref:t,"aria-hidden":(n&2)===2?!0:(r=l["aria-hidden"])!=null?r:void 0,hidden:(n&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",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return j()({ourProps:i,theirProps:l,slot:{},defaultTag:Kr,name:"Hidden"})}let ut=N(Yr);function Nt(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Z(e){return Nt(e)&&"tagName"in e}function ne(e){return Z(e)&&"accessKey"in e}function J(e){return Z(e)&&"tabIndex"in e}function Zr(e){return Z(e)&&"style"in e}function Jr(e){return ne(e)&&e.nodeName==="IFRAME"}function Qr(e){return ne(e)&&e.nodeName==="INPUT"}let Dt=Symbol();function Rr(e,t=!0){return Object.assign(e,{[Dt]:t})}function B(...e){let t=o.useRef(e);o.useEffect(()=>{t.current=e},[e]);let r=P(n=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(n):l.current=n)});return e.every(n=>n==null||(n==null?void 0:n[Dt]))?void 0:r}let at=o.createContext(null);at.displayName="DescriptionContext";function jt(){let e=o.useContext(at);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,jt),t}return e}function en(){let[e,t]=o.useState([]);return[e.length>0?e.join(" "):void 0,o.useMemo(()=>function(r){let n=P(i=>(t(a=>[...a,i]),()=>t(a=>{let u=a.slice(),s=u.indexOf(i);return s!==-1&&u.splice(s,1),u}))),l=o.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return o.createElement(at.Provider,{value:l},r.children)},[t])]}let tn="p";function rn(e,t){let r=o.useId(),n=Br(),{id:l=`headlessui-description-${r}`,...i}=e,a=jt(),u=B(t);L(()=>a.register(l),[l,a.register]);let s=n||!1,d=o.useMemo(()=>({...a.slot,disabled:s}),[a.slot,s]),h={ref:u,...a.props,id:l};return j()({ourProps:h,theirProps:i,slot:d,defaultTag:tn,name:a.name||"Description"})}let nn=N(rn),ln=Object.assign(nn,{});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 on=o.createContext(()=>{});function sn({value:e,children:t}){return o.createElement(on.Provider,{value:e},t)}let Wt=class extends Map{constructor(t){super(),this.factory=t}get(t){let r=super.get(t);return r===void 0&&(r=this.factory(t),this.set(t,r)),r}};var un=Object.defineProperty,an=(e,t,r)=>t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dn=(e,t,r)=>(an(e,t+"",r),r),Ut=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},_=(e,t,r)=>(Ut(e,t,"read from private field"),r?r.call(e):t.get(e)),dt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ht=(e,t,r,n)=>(Ut(e,t,"write to private field"),t.set(e,r),r),q,we,be;let cn=class{constructor(t){dt(this,q,{}),dt(this,we,new Wt(()=>new Set)),dt(this,be,new Set),dn(this,"disposables",X()),Ht(this,q,t)}dispose(){this.disposables.dispose()}get state(){return _(this,q)}subscribe(t,r){let n={selector:t,callback:r,current:t(_(this,q))};return _(this,be).add(n),this.disposables.add(()=>{_(this,be).delete(n)})}on(t,r){return _(this,we).get(t).add(r),this.disposables.add(()=>{_(this,we).get(t).delete(r)})}send(t){let r=this.reduce(_(this,q),t);if(r!==_(this,q)){Ht(this,q,r);for(let n of _(this,be)){let l=n.selector(_(this,q));Vt(n.current,l)||(n.current=l,n.callback(l))}for(let n of _(this,we).get(t.type))n(_(this,q),t)}}};q=new WeakMap,we=new WeakMap,be=new WeakMap;function Vt(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:ct(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:ct(e.entries(),t.entries()):Bt(e)&&Bt(t)?ct(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function ct(e,t){do{let r=e.next(),n=t.next();if(r.done&&n.done)return!0;if(r.done||n.done||!Object.is(r.value,n.value))return!1}while(!0)}function Bt(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var fn=Object.defineProperty,mn=(e,t,r)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,qt=(e,t,r)=>(mn(e,typeof t!="symbol"?t+"":t,r),r),pn=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(pn||{});let hn={0(e,t){let r=t.id,n=e.stack,l=e.stack.indexOf(r);if(l!==-1){let i=e.stack.slice();return i.splice(l,1),i.push(r),n=i,{...e,stack:n}}return{...e,stack:[...e.stack,r]}},1(e,t){let r=t.id,n=e.stack.indexOf(r);if(n===-1)return e;let l=e.stack.slice();return l.splice(n,1),{...e,stack:l}}},vn=class Cr extends cn{constructor(){super(...arguments),qt(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),qt(this,"selectors",{isTop:(t,r)=>t.stack[t.stack.length-1]===r,inStack:(t,r)=>t.stack.includes(r)})}static new(){return new Cr({stack:[]})}reduce(t,r){return z(r.type,hn,t,r)}};const Xt=new Wt(()=>vn.new());var _e={exports:{}},ft={};/**
4
+ `))}else{let E=h.props,w=E==null?void 0:E.className,m=typeof w=="function"?(...c)=>st(w(...c),s.className):st(w,s.className),$=m?{className:m}:{},v=It(h.props,ne(ut(s,["ref"])));for(let c in b)c in v&&delete b[c];return o.cloneElement(h,Object.assign({},v,b,d,{ref:l(Kr(h),d.ref)},$))}return o.createElement(i,Object.assign({},ut(s,["ref"]),i!==o.Fragment&&d,i!==o.Fragment&&b),h)}function zr(){let e=o.useRef([]),t=o.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function Gr(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function It(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let l in n)l.startsWith("on")&&typeof n[l]=="function"?(r[l]!=null||(r[l]=[]),r[l].push(n[l])):t[l]=n[l];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[l=>{var i;return(i=l==null?void 0:l.preventDefault)==null?void 0:i.call(l)}]);for(let n in r)Object.assign(t,{[n](l,...i){let a=r[n];for(let u of a){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;u(l,...i)}}});return t}function D(e){var t;return Object.assign(o.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ne(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function ut(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function Kr(e){return o.version.split(".")[0]>="19"?e.props.ref:e.ref}let Yr="span";var We=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(We||{});function Zr(e,t){var r;let{features:n=1,...l}=e,i={ref:t,"aria-hidden":(n&2)===2?!0:(r=l["aria-hidden"])!=null?r:void 0,hidden:(n&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",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return W()({ourProps:i,theirProps:l,slot:{},defaultTag:Yr,name:"Hidden"})}let at=D(Zr);function Nt(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Q(e){return Nt(e)&&"tagName"in e}function le(e){return Q(e)&&"accessKey"in e}function R(e){return Q(e)&&"tabIndex"in e}function Jr(e){return Q(e)&&"style"in e}function Qr(e){return le(e)&&e.nodeName==="IFRAME"}function Rr(e){return le(e)&&e.nodeName==="INPUT"}let Dt=Symbol();function en(e,t=!0){return Object.assign(e,{[Dt]:t})}function X(...e){let t=o.useRef(e);o.useEffect(()=>{t.current=e},[e]);let r=P(n=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(n):l.current=n)});return e.every(n=>n==null||(n==null?void 0:n[Dt]))?void 0:r}let dt=o.createContext(null);dt.displayName="DescriptionContext";function jt(){let e=o.useContext(dt);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,jt),t}return e}function tn(){let[e,t]=o.useState([]);return[e.length>0?e.join(" "):void 0,o.useMemo(()=>function(r){let n=P(i=>(t(a=>[...a,i]),()=>t(a=>{let u=a.slice(),s=u.indexOf(i);return s!==-1&&u.splice(s,1),u}))),l=o.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return o.createElement(dt.Provider,{value:l},r.children)},[t])]}let rn="p";function nn(e,t){let r=o.useId(),n=qr(),{id:l=`headlessui-description-${r}`,...i}=e,a=jt(),u=X(t);N(()=>a.register(l),[l,a.register]);let s=n||!1,d=o.useMemo(()=>({...a.slot,disabled:s}),[a.slot,s]),h={ref:u,...a.props,id:l};return W()({ourProps:h,theirProps:i,slot:d,defaultTag:rn,name:a.name||"Description"})}let ln=D(nn),on=Object.assign(ln,{});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 sn=o.createContext(()=>{});function un({value:e,children:t}){return o.createElement(sn.Provider,{value:e},t)}let Wt=class extends Map{constructor(t){super(),this.factory=t}get(t){let r=super.get(t);return r===void 0&&(r=this.factory(t),this.set(t,r)),r}};var an=Object.defineProperty,dn=(e,t,r)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cn=(e,t,r)=>(dn(e,t+"",r),r),Ut=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},U=(e,t,r)=>(Ut(e,t,"read from private field"),r?r.call(e):t.get(e)),ct=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ht=(e,t,r,n)=>(Ut(e,t,"write to private field"),t.set(e,r),r),z,ye,Ee;let fn=class{constructor(t){ct(this,z,{}),ct(this,ye,new Wt(()=>new Set)),ct(this,Ee,new Set),cn(this,"disposables",G()),Ht(this,z,t),q.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return U(this,z)}subscribe(t,r){if(q.isServer)return()=>{};let n={selector:t,callback:r,current:t(U(this,z))};return U(this,Ee).add(n),this.disposables.add(()=>{U(this,Ee).delete(n)})}on(t,r){return q.isServer?()=>{}:(U(this,ye).get(t).add(r),this.disposables.add(()=>{U(this,ye).get(t).delete(r)}))}send(t){let r=this.reduce(U(this,z),t);if(r!==U(this,z)){Ht(this,z,r);for(let n of U(this,Ee)){let l=n.selector(U(this,z));Vt(n.current,l)||(n.current=l,n.callback(l))}for(let n of U(this,ye).get(t.type))n(U(this,z),t)}}};z=new WeakMap,ye=new WeakMap,Ee=new WeakMap;function Vt(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:ft(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:ft(e.entries(),t.entries()):Bt(e)&&Bt(t)?ft(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function ft(e,t){do{let r=e.next(),n=t.next();if(r.done&&n.done)return!0;if(r.done||n.done||!Object.is(r.value,n.value))return!1}while(!0)}function Bt(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var mn=Object.defineProperty,pn=(e,t,r)=>t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,qt=(e,t,r)=>(pn(e,typeof t!="symbol"?t+"":t,r),r),hn=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(hn||{});let vn={0(e,t){let r=t.id,n=e.stack,l=e.stack.indexOf(r);if(l!==-1){let i=e.stack.slice();return i.splice(l,1),i.push(r),n=i,{...e,stack:n}}return{...e,stack:[...e.stack,r]}},1(e,t){let r=t.id,n=e.stack.indexOf(r);if(n===-1)return e;let l=e.stack.slice();return l.splice(n,1),{...e,stack:l}}},gn=class Cr extends fn{constructor(){super(...arguments),qt(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),qt(this,"selectors",{isTop:(t,r)=>t.stack[t.stack.length-1]===r,inStack:(t,r)=>t.stack.includes(r)})}static new(){return new Cr({stack:[]})}reduce(t,r){return K(r.type,vn,t,r)}};const Xt=new Wt(()=>gn.new());var Ue={exports:{}},mt={};/**
5
5
  * @license React
6
6
  * use-sync-external-store-with-selector.production.js
7
7
  *
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * This source code is licensed under the MIT license found in the
11
11
  * LICENSE file in the root directory of this source tree.
12
- */var zt;function gn(){if(zt)return ft;zt=1;var e=o;function t(s,d){return s===d&&(s!==0||1/s===1/d)||s!==s&&d!==d}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,l=e.useRef,i=e.useEffect,a=e.useMemo,u=e.useDebugValue;return ft.useSyncExternalStoreWithSelector=function(s,d,h,b,E){var w=l(null);if(w.current===null){var m={hasValue:!1,value:null};w.current=m}else m=w.current;w=a(function(){function v(p){if(!c){if(c=!0,f=p,p=b(p),E!==void 0&&m.hasValue){var x=m.value;if(E(x,p))return g=x}return g=p}if(x=g,r(f,p))return x;var O=b(p);return E!==void 0&&E(x,O)?(f=p,x):(f=p,g=O)}var c=!1,f,g,y=h===void 0?null:h;return[function(){return v(d())},y===null?void 0:function(){return v(y())}]},[d,h,b,E]);var $=n(s,w[0],w[1]);return i(function(){m.hasValue=!0,m.value=$},[$]),u($),$},ft}var mt={};/**
12
+ */var zt;function wn(){if(zt)return mt;zt=1;var e=o;function t(s,d){return s===d&&(s!==0||1/s===1/d)||s!==s&&d!==d}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,l=e.useRef,i=e.useEffect,a=e.useMemo,u=e.useDebugValue;return mt.useSyncExternalStoreWithSelector=function(s,d,h,b,E){var w=l(null);if(w.current===null){var m={hasValue:!1,value:null};w.current=m}else m=w.current;w=a(function(){function v(p){if(!c){if(c=!0,f=p,p=b(p),E!==void 0&&m.hasValue){var x=m.value;if(E(x,p))return g=x}return g=p}if(x=g,r(f,p))return x;var S=b(p);return E!==void 0&&E(x,S)?(f=p,x):(f=p,g=S)}var c=!1,f,g,y=h===void 0?null:h;return[function(){return v(d())},y===null?void 0:function(){return v(y())}]},[d,h,b,E]);var $=n(s,w[0],w[1]);return i(function(){m.hasValue=!0,m.value=$},[$]),u($),$},mt}var pt={};/**
13
13
  * @license React
14
14
  * use-sync-external-store-with-selector.development.js
15
15
  *
@@ -17,5 +17,5 @@
17
17
  *
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
- */var Gt;function wn(){return Gt||(Gt=1,process.env.NODE_ENV!=="production"&&function(){function e(s,d){return s===d&&(s!==0||1/s===1/d)||s!==s&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=o,r=typeof Object.is=="function"?Object.is:e,n=t.useSyncExternalStore,l=t.useRef,i=t.useEffect,a=t.useMemo,u=t.useDebugValue;mt.useSyncExternalStoreWithSelector=function(s,d,h,b,E){var w=l(null);if(w.current===null){var m={hasValue:!1,value:null};w.current=m}else m=w.current;w=a(function(){function v(p){if(!c){if(c=!0,f=p,p=b(p),E!==void 0&&m.hasValue){var x=m.value;if(E(x,p))return g=x}return g=p}if(x=g,r(f,p))return x;var O=b(p);return E!==void 0&&E(x,O)?(f=p,x):(f=p,g=O)}var c=!1,f,g,y=h===void 0?null:h;return[function(){return v(d())},y===null?void 0:function(){return v(y())}]},[d,h,b,E]);var $=n(s,w[0],w[1]);return i(function(){m.hasValue=!0,m.value=$},[$]),u($),$},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),mt}var Kt;function bn(){return Kt||(Kt=1,process.env.NODE_ENV==="production"?_e.exports=gn():_e.exports=wn()),_e.exports}var yn=bn();function Yt(e,t,r=Vt){return yn.useSyncExternalStoreWithSelector(P(n=>e.subscribe(En,n)),P(()=>e.state),P(()=>e.state),P(t),r)}function En(e){return e}function ye(e,t){let r=o.useId(),n=Xt.get(t),[l,i]=Yt(n,o.useCallback(a=>[n.selectors.isTop(a,r),n.selectors.inStack(a,r)],[n,r]));return L(()=>{if(e)return n.actions.push(r),()=>n.actions.pop(r)},[n,e,r]),e?i?l:!0:!1}let pt=new Map,Ee=new Map;function Zt(e){var t;let r=(t=Ee.get(e))!=null?t:0;return Ee.set(e,r+1),r!==0?()=>Jt(e):(pt.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Jt(e))}function Jt(e){var t;let r=(t=Ee.get(e))!=null?t:1;if(r===1?Ee.delete(e):Ee.set(e,r-1),r!==1)return;let n=pt.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,pt.delete(e))}function xn(e,{allowed:t,disallowed:r}={}){let n=ye(e,"inert-others");L(()=>{var l,i;if(!n)return;let a=X();for(let s of(l=r==null?void 0:r())!=null?l:[])s&&a.add(Zt(s));let u=(i=t==null?void 0:t())!=null?i:[];for(let s of u){if(!s)continue;let d=Ae(s);if(!d)continue;let h=s.parentElement;for(;h&&h!==d.body;){for(let b of h.children)u.some(E=>b.contains(E))||a.add(Zt(b));h=h.parentElement}}return a.dispose},[n,t,r])}function $n(e,t,r){let n=te(l=>{let i=l.getBoundingClientRect();i.x===0&&i.y===0&&i.width===0&&i.height===0&&r()});o.useEffect(()=>{if(!e)return;let l=t===null?null:ne(t)?t:t.current;if(!l)return;let i=X();if(typeof ResizeObserver<"u"){let a=new ResizeObserver(()=>n.current(l));a.observe(l),i.add(()=>a.disconnect())}if(typeof IntersectionObserver<"u"){let a=new IntersectionObserver(()=>n.current(l));a.observe(l),i.add(()=>a.disconnect())}return()=>i.dispose()},[t,n,e])}let We=["[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(","),Sn=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var G=(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))(G||{}),ht=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ht||{}),On=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(On||{});function Mn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(We)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function Cn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Sn)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var Qt=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Qt||{});function Pn(e,t=0){var r;return e===((r=Ae(e))==null?void 0:r.body)?!1:z(t,{0(){return e.matches(We)},1(){let n=e;for(;n!==null;){if(n.matches(We))return!0;n=n.parentElement}return!1}})}var Tn=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Tn||{});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 K(e){e==null||e.focus({preventScroll:!0})}let kn=["textarea","input"].join(",");function Fn(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,kn))!=null?r:!1}function Ln(e,t=r=>r){return e.slice().sort((r,n)=>{let l=t(r),i=t(n);if(l===null||i===null)return 0;let a=l.compareDocumentPosition(i);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function xe(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:l=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?r?Ln(e):e:t&64?Cn(e):Mn(e);l.length>0&&a.length>1&&(a=a.filter(w=>!l.some(m=>m!=null&&"current"in m?(m==null?void 0:m.current)===w:m===w))),n=n??i.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")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,a.indexOf(n))-1;if(t&4)return Math.max(0,a.indexOf(n))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),d=t&32?{preventScroll:!0}:{},h=0,b=a.length,E;do{if(h>=b||h+b<=0)return 0;let w=s+h;if(t&16)w=(w+b)%b;else{if(w<0)return 3;if(w>=b)return 1}E=a[w],E==null||E.focus(d),h+=u}while(E!==i.activeElement);return t&6&&Fn(E)&&E.select(),2}function Rt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function An(){return/Android/gi.test(window.navigator.userAgent)}function er(){return Rt()||An()}function Ue(e,t,r,n){let l=te(r);o.useEffect(()=>{if(!e)return;function i(a){l.current(a)}return document.addEventListener(t,i,n),()=>document.removeEventListener(t,i,n)},[e,t,n])}function tr(e,t,r,n){let l=te(r);o.useEffect(()=>{if(!e)return;function i(a){l.current(a)}return window.addEventListener(t,i,n),()=>window.removeEventListener(t,i,n)},[e,t,n])}const rr=30;function In(e,t,r){let n=te(r),l=o.useCallback(function(u,s){if(u.defaultPrevented)return;let d=s(u);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let h=function b(E){return typeof E=="function"?b(E()):Array.isArray(E)||E instanceof Set?E:[E]}(t);for(let b of h)if(b!==null&&(b.contains(d)||u.composed&&u.composedPath().includes(b)))return;return!Pn(d,Qt.Loose)&&d.tabIndex!==-1&&u.preventDefault(),n.current(u,d)},[n,t]),i=o.useRef(null);Ue(e,"pointerdown",u=>{var s,d;er()||(i.current=((d=(s=u.composedPath)==null?void 0:s.call(u))==null?void 0:d[0])||u.target)},!0),Ue(e,"pointerup",u=>{if(er()||!i.current)return;let s=i.current;return i.current=null,l(u,()=>s)},!0);let a=o.useRef({x:0,y:0});Ue(e,"touchstart",u=>{a.current.x=u.touches[0].clientX,a.current.y=u.touches[0].clientY},!0),Ue(e,"touchend",u=>{let s={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(s.x-a.current.x)>=rr||Math.abs(s.y-a.current.y)>=rr))return l(u,()=>J(u.target)?u.target:null)},!0),tr(e,"blur",u=>l(u,()=>Jr(window.document.activeElement)?window.document.activeElement:null),!0)}function He(...e){return o.useMemo(()=>Ae(...e),[...e])}function nr(e,t,r,n){let l=te(r);o.useEffect(()=>{e=e??window;function i(a){l.current(a)}return e.addEventListener(t,i,n),()=>e.removeEventListener(t,i,n)},[e,t,n])}function Nn(e){return o.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Dn(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(l){return n.add(l),()=>n.delete(l)},dispatch(l,...i){let a=t[l].call(r,...i);a&&(r=a,n.forEach(u=>u()))}}}function jn(){let e;return{before({doc:t}){var r;let n=t.documentElement,l=(r=t.defaultView)!=null?r:window;e=Math.max(0,l.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,l=Math.max(0,n.clientWidth-n.offsetWidth),i=Math.max(0,e-l);r.style(n,"paddingRight",`${i}px`)}}}function _n(){return Rt()?{before({doc:e,d:t,meta:r}){function n(l){return r.containers.flatMap(i=>i()).some(i=>i.contains(l))}t.microTask(()=>{var l;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let u=X();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let i=(l=window.scrollY)!=null?l:window.pageYOffset,a=null;t.addEventListener(e,"click",u=>{if(J(u.target))try{let s=u.target.closest("a");if(!s)return;let{hash:d}=new URL(s.href),h=e.querySelector(d);J(h)&&!n(h)&&(a=h)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(J(u.target)&&Zr(u.target))if(n(u.target)){let s=u.target;for(;s.parentElement&&n(s.parentElement);)s=s.parentElement;t.style(s,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(J(u.target)){if(Qr(u.target))return;if(n(u.target)){let s=u.target;for(;s.parentElement&&s.dataset.headlessuiPortal!==""&&!(s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth);)s=s.parentElement;s.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let s=(u=window.scrollY)!=null?u:window.pageYOffset;i!==s&&window.scrollTo(0,i),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)})})}}:{}}function Wn(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Un(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let le=Dn(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:X(),meta:new Set};return n.count++,n.meta.add(t),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:r}){let n={doc:e,d:t,meta:Un(r)},l=[_n(),jn(),Wn()];l.forEach(({before:i})=>i==null?void 0:i(n)),l.forEach(({after:i})=>i==null?void 0:i(n))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});le.subscribe(()=>{let e=le.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",l=r.count!==0;(l&&!n||!l&&n)&&le.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&le.dispatch("TEARDOWN",r)}});function Hn(e,t,r=()=>({containers:[]})){let n=Nn(le),l=t?n.get(t):void 0,i=l?l.count>0:!1;return L(()=>{if(!(!t||!e))return le.dispatch("PUSH",t,r),()=>le.dispatch("POP",t,r)},[e,t]),i}function Vn(e,t,r=()=>[document.body]){let n=ye(e,"scroll-lock");Hn(n,t,l=>{var i;return{containers:[...(i=l.containers)!=null?i:[],r]}})}function Bn(e=0){let[t,r]=o.useState(e),n=o.useCallback(s=>r(s),[t]),l=o.useCallback(s=>r(d=>d|s),[t]),i=o.useCallback(s=>(t&s)===s,[t]),a=o.useCallback(s=>r(d=>d&~s),[r]),u=o.useCallback(s=>r(d=>d^s),[r]);return{flags:t,setFlag:n,addFlag:l,hasFlag:i,removeFlag:a,toggleFlag:u}}var lr,or;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((lr=process==null?void 0:process.env)==null?void 0:lr.NODE_ENV)==="test"&&typeof((or=Element==null?void 0:Element.prototype)==null?void 0:or.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(`
21
- `)),[]});var qn=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(qn||{});function Xn(e){let t={};for(let r in e)e[r]===!0&&(t[`data-${r}`]="");return t}function zn(e,t,r,n){let[l,i]=o.useState(r),{hasFlag:a,addFlag:u,removeFlag:s}=Bn(e&&l?3:0),d=o.useRef(!1),h=o.useRef(!1),b=ot();return L(()=>{var E;if(e){if(r&&i(!0),!t){r&&u(3);return}return(E=n==null?void 0:n.start)==null||E.call(n,r),Gn(t,{inFlight:d,prepare(){h.current?h.current=!1:h.current=d.current,d.current=!0,!h.current&&(r?(u(3),s(4)):(u(4),s(2)))},run(){h.current?r?(s(3),u(4)):(s(4),u(3)):r?s(1):u(1)},done(){var w;h.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(d.current=!1,s(7),r||i(!1),(w=n==null?void 0:n.end)==null||w.call(n,r))}})}},[e,r,t,b]),e?[l,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Gn(e,{prepare:t,run:r,done:n,inFlight:l}){let i=X();return Yn(e,{prepare:t,inFlight:l}),i.nextFrame(()=>{r(),i.requestAnimationFrame(()=>{i.add(Kn(e,n))})}),i.dispose}function Kn(e,t){var r,n;let l=X();if(!e)return l.dispose;let i=!1;l.add(()=>{i=!0});let a=(n=(r=e.getAnimations)==null?void 0:r.call(e).filter(u=>u instanceof CSSTransition))!=null?n:[];return a.length===0?(t(),l.dispose):(Promise.allSettled(a.map(u=>u.finished)).then(()=>{i||t()}),l.dispose)}function Yn(e,{inFlight:t,prepare:r}){if(t!=null&&t.current){r();return}let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}function vt(e,t){let r=o.useRef([]),n=P(e);o.useEffect(()=>{let l=[...r.current];for(let[i,a]of t.entries())if(r.current[i]!==a){let u=n(t,l);return r.current=t,u}},[n,...t])}let Ve=o.createContext(null);Ve.displayName="OpenClosedContext";var W=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(W||{});function Be(){return o.useContext(Ve)}function Zn({value:e,children:t}){return o.createElement(Ve.Provider,{value:e},t)}function Jn({children:e}){return o.createElement(Ve.Provider,{value:null},e)}function Qn(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Q=[];Qn(()=>{function e(t){if(!J(t.target)||t.target===document.body||Q[0]===t.target)return;let r=t.target;r=r.closest(We),Q.unshift(r??t.target),Q=Q.filter(n=>n!=null&&n.isConnected),Q.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 ir(e){let t=P(e),r=o.useRef(!1);o.useEffect(()=>(r.current=!1,()=>{r.current=!0,Ie(()=>{r.current&&t()})}),[t])}function Rn(){let e=typeof document>"u";return"useSyncExternalStore"in pe?(t=>t.useSyncExternalStore)(pe)(()=>()=>{},()=>!1,()=>!e):!1}function $e(){let e=Rn(),[t,r]=pe.useState(ee.isHandoffComplete);return t&&ee.isHandoffComplete===!1&&r(!1),pe.useEffect(()=>{t!==!0&&r(!0)},[t]),pe.useEffect(()=>ee.handoff(),[]),e?!1:t}let sr=o.createContext(!1);function el(){return o.useContext(sr)}function ur(e){return o.createElement(sr.Provider,{value:e.force},e.children)}function tl(e){let t=el(),r=o.useContext(dr),[n,l]=o.useState(()=>{var i;if(!t&&r!==null)return(i=r.current)!=null?i:null;if(ee.isServer)return null;let a=e==null?void 0:e.getElementById("headlessui-portal-root");if(a)return a;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return o.useEffect(()=>{n!==null&&(e!=null&&e.body.contains(n)||e==null||e.body.appendChild(n))},[n,e]),o.useEffect(()=>{t||r!==null&&l(r.current)},[r,l,t]),n}let ar=o.Fragment,rl=N(function(e,t){let{ownerDocument:r=null,...n}=e,l=o.useRef(null),i=B(Rr(w=>{l.current=w}),t),a=He(l),u=r??a,s=tl(u),[d]=o.useState(()=>{var w;return ee.isServer?null:(w=u==null?void 0:u.createElement("div"))!=null?w:null}),h=o.useContext(gt),b=$e();L(()=>{!s||!d||s.contains(d)||(d.setAttribute("data-headlessui-portal",""),s.appendChild(d))},[s,d]),L(()=>{if(d&&h)return h.register(d)},[h,d]),ir(()=>{var w;!s||!d||(Nt(d)&&s.contains(d)&&s.removeChild(d),s.childNodes.length<=0&&((w=s.parentElement)==null||w.removeChild(s)))});let E=j();return b?!s||!d?null:Tr.createPortal(E({ourProps:{ref:i},theirProps:n,slot:{},defaultTag:ar,name:"Portal"}),d):null});function nl(e,t){let r=B(t),{enabled:n=!0,ownerDocument:l,...i}=e,a=j();return n?o.createElement(rl,{...i,ownerDocument:l,ref:r}):a({ourProps:{ref:r},theirProps:i,slot:{},defaultTag:ar,name:"Portal"})}let ll=o.Fragment,dr=o.createContext(null);function ol(e,t){let{target:r,...n}=e,l={ref:B(t)},i=j();return o.createElement(dr.Provider,{value:r},i({ourProps:l,theirProps:n,defaultTag:ll,name:"Popover.Group"}))}let gt=o.createContext(null);function il(){let e=o.useContext(gt),t=o.useRef([]),r=P(i=>(t.current.push(i),e&&e.register(i),()=>n(i))),n=P(i=>{let a=t.current.indexOf(i);a!==-1&&t.current.splice(a,1),e&&e.unregister(i)}),l=o.useMemo(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,o.useMemo(()=>function({children:i}){return o.createElement(gt.Provider,{value:l},i)},[l])]}let sl=N(nl),cr=N(ol),ul=Object.assign(sl,{Group:cr});function al(e,t=typeof document<"u"?document.defaultView:null,r){let n=ye(e,"escape");nr(t,"keydown",l=>{n&&(l.defaultPrevented||l.key===_t.Escape&&r(l))})}function dl(){var e;let[t]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[r,n]=o.useState((e=t==null?void 0:t.matches)!=null?e:!1);return L(()=>{if(!t)return;function l(i){n(i.matches)}return t.addEventListener("change",l),()=>t.removeEventListener("change",l)},[t]),r}function cl({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=He(r),l=P(()=>{var i,a;let u=[];for(let s of e)s!==null&&(Z(s)?u.push(s):"current"in s&&Z(s.current)&&u.push(s.current));if(t!=null&&t.current)for(let s of t.current)u.push(s);for(let s of(i=n==null?void 0:n.querySelectorAll("html > *, body > *"))!=null?i:[])s!==document.body&&s!==document.head&&Z(s)&&s.id!=="headlessui-portal-root"&&(r&&(s.contains(r)||s.contains((a=r==null?void 0:r.getRootNode())==null?void 0:a.host))||u.some(d=>s.contains(d))||u.push(s));return u});return{resolveContainers:l,contains:P(i=>l().some(a=>a.contains(i)))}}let fr=o.createContext(null);function mr({children:e,node:t}){let[r,n]=o.useState(null),l=pr(t??r);return o.createElement(fr.Provider,{value:l},e,l===null&&o.createElement(ut,{features:je.Hidden,ref:i=>{var a,u;if(i){for(let s of(u=(a=Ae(i))==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?u:[])if(s!==document.body&&s!==document.head&&Z(s)&&s!=null&&s.contains(i)){n(s);break}}}}))}function pr(e=null){var t;return(t=o.useContext(fr))!=null?t:e}function wt(){let e=o.useRef(!1);return L(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var Se=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Se||{});function fl(){let e=o.useRef(0);return tr(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function hr(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)Z(r.current)&&t.add(r.current);return t}let ml="div";var oe=(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))(oe||{});function pl(e,t){let r=o.useRef(null),n=B(r,t),{initialFocus:l,initialFocusFallback:i,containers:a,features:u=15,...s}=e;$e()||(u=0);let d=He(r);wl(u,{ownerDocument:d});let h=bl(u,{ownerDocument:d,container:r,initialFocus:l,initialFocusFallback:i});yl(u,{ownerDocument:d,container:r,containers:a,previousActiveElement:h});let b=fl(),E=P(f=>{if(!ne(r.current))return;let g=r.current;(y=>y())(()=>{z(b.current,{[Se.Forwards]:()=>{xe(g,G.First,{skipElements:[f.relatedTarget,i]})},[Se.Backwards]:()=>{xe(g,G.Last,{skipElements:[f.relatedTarget,i]})}})})}),w=ye(!!(u&2),"focus-trap#tab-lock"),m=ot(),$=o.useRef(!1),v={ref:n,onKeyDown(f){f.key=="Tab"&&($.current=!0,m.requestAnimationFrame(()=>{$.current=!1}))},onBlur(f){if(!(u&4))return;let g=hr(a);ne(r.current)&&g.add(r.current);let y=f.relatedTarget;J(y)&&y.dataset.headlessuiFocusGuard!=="true"&&(vr(g,y)||($.current?xe(r.current,z(b.current,{[Se.Forwards]:()=>G.Next,[Se.Backwards]:()=>G.Previous})|G.WrapAround,{relativeTo:f.target}):J(f.target)&&K(f.target)))}},c=j();return o.createElement(o.Fragment,null,w&&o.createElement(ut,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:E,features:je.Focusable}),c({ourProps:v,theirProps:s,defaultTag:ml,name:"FocusTrap"}),w&&o.createElement(ut,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:E,features:je.Focusable}))}let hl=N(pl),vl=Object.assign(hl,{features:oe});function gl(e=!0){let t=o.useRef(Q.slice());return vt(([r],[n])=>{n===!0&&r===!1&&Ie(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=Q.slice())},[e,Q,t]),P(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function wl(e,{ownerDocument:t}){let r=!!(e&8),n=gl(r);vt(()=>{r||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&K(n())},[r]),ir(()=>{r&&K(n())})}function bl(e,{ownerDocument:t,container:r,initialFocus:n,initialFocusFallback:l}){let i=o.useRef(null),a=ye(!!(e&1),"focus-trap#initial-focus"),u=wt();return vt(()=>{if(e===0)return;if(!a){l!=null&&l.current&&K(l.current);return}let s=r.current;s&&Ie(()=>{if(!u.current)return;let d=t==null?void 0:t.activeElement;if(n!=null&&n.current){if((n==null?void 0:n.current)===d){i.current=d;return}}else if(s.contains(d)){i.current=d;return}if(n!=null&&n.current)K(n.current);else{if(e&16){if(xe(s,G.First|G.AutoFocus)!==ht.Error)return}else if(xe(s,G.First)!==ht.Error)return;if(l!=null&&l.current&&(K(l.current),(t==null?void 0:t.activeElement)===l.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}i.current=t==null?void 0:t.activeElement})},[l,a,e]),i}function yl(e,{ownerDocument:t,container:r,containers:n,previousActiveElement:l}){let i=wt(),a=!!(e&4);nr(t==null?void 0:t.defaultView,"focus",u=>{if(!a||!i.current)return;let s=hr(n);ne(r.current)&&s.add(r.current);let d=l.current;if(!d)return;let h=u.target;ne(h)?vr(s,h)?(l.current=h,K(h)):(u.preventDefault(),u.stopPropagation(),K(d)):K(l.current)},!0)}function vr(e,t){for(let r of e)if(r.contains(t))return!0;return!1}function gr(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:br)!==o.Fragment||o.Children.count(e.children)===1}let qe=o.createContext(null);qe.displayName="TransitionContext";var El=(e=>(e.Visible="visible",e.Hidden="hidden",e))(El||{});function xl(){let e=o.useContext(qe);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function $l(){let e=o.useContext(Xe);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Xe=o.createContext(null);Xe.displayName="NestingContext";function ze(e){return"children"in e?ze(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function wr(e,t){let r=te(e),n=o.useRef([]),l=wt(),i=ot(),a=P((w,m=Y.Hidden)=>{let $=n.current.findIndex(({el:v})=>v===w);$!==-1&&(z(m,{[Y.Unmount](){n.current.splice($,1)},[Y.Hidden](){n.current[$].state="hidden"}}),i.microTask(()=>{var v;!ze(n)&&l.current&&((v=r.current)==null||v.call(r))}))}),u=P(w=>{let m=n.current.find(({el:$})=>$===w);return m?m.state!=="visible"&&(m.state="visible"):n.current.push({el:w,state:"visible"}),()=>a(w,Y.Unmount)}),s=o.useRef([]),d=o.useRef(Promise.resolve()),h=o.useRef({enter:[],leave:[]}),b=P((w,m,$)=>{s.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==w)),t==null||t.chains.current[m].push([w,new Promise(v=>{s.current.push(v)})]),t==null||t.chains.current[m].push([w,new Promise(v=>{Promise.all(h.current[m].map(([c,f])=>f)).then(()=>v())})]),m==="enter"?d.current=d.current.then(()=>t==null?void 0:t.wait.current).then(()=>$(m)):$(m)}),E=P((w,m,$)=>{Promise.all(h.current[m].splice(0).map(([v,c])=>c)).then(()=>{var v;(v=s.current.shift())==null||v()}).then(()=>$(m))});return o.useMemo(()=>({children:n,register:u,unregister:a,onStart:b,onStop:E,wait:d,chains:h}),[u,a,n,b,E,h,d])}let br=o.Fragment,yr=Ne.RenderStrategy;function Sl(e,t){var r,n;let{transition:l=!0,beforeEnter:i,afterEnter:a,beforeLeave:u,afterLeave:s,enter:d,enterFrom:h,enterTo:b,entered:E,leave:w,leaveFrom:m,leaveTo:$,...v}=e,[c,f]=o.useState(null),g=o.useRef(null),y=gr(e),p=B(...y?[g,t,f]:t===null?[]:[t]),x=(r=v.unmount)==null||r?Y.Unmount:Y.Hidden,{show:O,appear:F,initial:U}=xl(),[k,D]=o.useState(O?"visible":"hidden"),H=$l(),{register:A,unregister:T}=H;L(()=>A(g),[A,g]),L(()=>{if(x===Y.Hidden&&g.current){if(O&&k!=="visible"){D("visible");return}return z(k,{hidden:()=>T(g),visible:()=>A(g)})}},[k,g,A,T,O,x]);let I=$e();L(()=>{if(y&&I&&k==="visible"&&g.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[g,k,I,y]);let xt=U&&!F,Ke=F&&O&&U,fe=o.useRef(!1),me=wr(()=>{fe.current||(D("hidden"),T(g))},H),Ye=P(St=>{fe.current=!0;let Je=St?"enter":"leave";me.onStart(g,Je,Me=>{Me==="enter"?i==null||i():Me==="leave"&&(u==null||u())})}),R=P(St=>{let Je=St?"enter":"leave";fe.current=!1,me.onStop(g,Je,Me=>{Me==="enter"?a==null||a():Me==="leave"&&(s==null||s())}),Je==="leave"&&!ze(me)&&(D("hidden"),T(g))});o.useEffect(()=>{y&&l||(Ye(O),R(O))},[O,y,l]);let $t=!(!l||!y||!I||xt),[,C]=zn($t,c,O,{start:Ye,end:R}),Ze=re({ref:p,className:((n=it(v.className,Ke&&d,Ke&&h,C.enter&&d,C.enter&&C.closed&&h,C.enter&&!C.closed&&b,C.leave&&w,C.leave&&!C.closed&&m,C.leave&&C.closed&&$,!C.transition&&O&&E))==null?void 0:n.trim())||void 0,...Xn(C)}),Oe=0;k==="visible"&&(Oe|=W.Open),k==="hidden"&&(Oe|=W.Closed),O&&k==="hidden"&&(Oe|=W.Opening),!O&&k==="visible"&&(Oe|=W.Closing);let Gl=j();return o.createElement(Xe.Provider,{value:me},o.createElement(Zn,{value:Oe},Gl({ourProps:Ze,theirProps:v,defaultTag:br,features:yr,visible:k==="visible",name:"Transition.Child"})))}function Ol(e,t){let{show:r,appear:n=!1,unmount:l=!0,...i}=e,a=o.useRef(null),u=gr(e),s=B(...u?[a,t]:t===null?[]:[t]);$e();let d=Be();if(r===void 0&&d!==null&&(r=(d&W.Open)===W.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[h,b]=o.useState(r?"visible":"hidden"),E=wr(()=>{r||b("hidden")}),[w,m]=o.useState(!0),$=o.useRef([r]);L(()=>{w!==!1&&$.current[$.current.length-1]!==r&&($.current.push(r),m(!1))},[$,r]);let v=o.useMemo(()=>({show:r,appear:n,initial:w}),[r,n,w]);L(()=>{r?b("visible"):!ze(E)&&a.current!==null&&b("hidden")},[r,E]);let c={unmount:l},f=P(()=>{var p;w&&m(!1),(p=e.beforeEnter)==null||p.call(e)}),g=P(()=>{var p;w&&m(!1),(p=e.beforeLeave)==null||p.call(e)}),y=j();return o.createElement(Xe.Provider,{value:E},o.createElement(qe.Provider,{value:v},y({ourProps:{...c,as:o.Fragment,children:o.createElement(Er,{ref:s,...c,...i,beforeEnter:f,beforeLeave:g})},theirProps:{},defaultTag:o.Fragment,features:yr,visible:h==="visible",name:"Transition"})))}function Ml(e,t){let r=o.useContext(qe)!==null,n=Be()!==null;return o.createElement(o.Fragment,null,!r&&n?o.createElement(bt,{ref:t,...e}):o.createElement(Er,{ref:t,...e}))}let bt=N(Ol),Er=N(Sl),ce=N(Ml),xr=Object.assign(bt,{Child:ce,Root:bt});var Cl=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Cl||{}),Pl=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Pl||{});let Tl={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},yt=o.createContext(null);yt.displayName="DialogContext";function Ge(e){let t=o.useContext(yt);if(t===null){let r=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ge),r}return t}function kl(e,t){return z(t.type,Tl,e,t)}let $r=N(function(e,t){let r=o.useId(),{id:n=`headlessui-dialog-${r}`,open:l,onClose:i,initialFocus:a,role:u="dialog",autoFocus:s=!0,__demoMode:d=!1,unmount:h=!1,...b}=e,E=o.useRef(!1);u=function(){return u==="dialog"||u==="alertdialog"?u:(E.current||(E.current=!0,console.warn(`Invalid role [${u}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let w=Be();l===void 0&&w!==null&&(l=(w&W.Open)===W.Open);let m=o.useRef(null),$=B(m,t),v=He(m),c=l?0:1,[f,g]=o.useReducer(kl,{titleId:null,descriptionId:null,panelRef:o.createRef()}),y=P(()=>i(!1)),p=P(C=>g({type:0,id:C})),x=$e()?c===0:!1,[O,F]=il(),U={get current(){var C;return(C=f.panelRef.current)!=null?C:m.current}},k=pr(),{resolveContainers:D}=cl({mainTreeNode:k,portals:O,defaultContainers:[U]}),H=w!==null?(w&W.Closing)===W.Closing:!1;xn(d||H?!1:x,{allowed:P(()=>{var C,Ze;return[(Ze=(C=m.current)==null?void 0:C.closest("[data-headlessui-portal]"))!=null?Ze:null]}),disallowed:P(()=>{var C;return[(C=k==null?void 0:k.closest("body > *:not(#headlessui-portal-root)"))!=null?C:null]})});let A=Xt.get(null);L(()=>{if(x)return A.actions.push(n),()=>A.actions.pop(n)},[A,n,x]);let T=Yt(A,o.useCallback(C=>A.selectors.isTop(C,n),[A,n]));In(T,D,C=>{C.preventDefault(),y()}),al(T,v==null?void 0:v.defaultView,C=>{C.preventDefault(),C.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),y()}),Vn(d||H?!1:x,v,D),$n(x,m,y);let[I,xt]=en(),Ke=o.useMemo(()=>[{dialogState:c,close:y,setTitleId:p,unmount:h},f],[c,f,y,p,h]),fe=o.useMemo(()=>({open:c===0}),[c]),me={ref:$,id:n,role:u,tabIndex:-1,"aria-modal":d?void 0:c===0?!0:void 0,"aria-labelledby":f.titleId,"aria-describedby":I,unmount:h},Ye=!dl(),R=oe.None;x&&!d&&(R|=oe.RestoreFocus,R|=oe.TabLock,s&&(R|=oe.AutoFocus),Ye&&(R|=oe.InitialFocus));let $t=j();return o.createElement(Jn,null,o.createElement(ur,{force:!0},o.createElement(ul,null,o.createElement(yt.Provider,{value:Ke},o.createElement(cr,{target:m},o.createElement(ur,{force:!1},o.createElement(xt,{slot:fe},o.createElement(F,null,o.createElement(vl,{initialFocus:a,initialFocusFallback:m,containers:D,features:R},o.createElement(sn,{value:y},$t({ourProps:me,theirProps:b,slot:fe,defaultTag:Fl,features:Ll,visible:c===0,name:"Dialog"})))))))))))}),Fl="div",Ll=Ne.RenderStrategy|Ne.Static;function Al(e,t){let{transition:r=!1,open:n,...l}=e,i=Be(),a=e.hasOwnProperty("open")||i!==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(!i&&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(n!==void 0||r)&&!l.static?o.createElement(mr,null,o.createElement(xr,{show:n,transition:r,unmount:l.unmount},o.createElement($r,{ref:t,...l}))):o.createElement(mr,null,o.createElement($r,{ref:t,open:n,...l}))}let Il="div";function Nl(e,t){let r=o.useId(),{id:n=`headlessui-dialog-panel-${r}`,transition:l=!1,...i}=e,[{dialogState:a,unmount:u},s]=Ge("Dialog.Panel"),d=B(t,s.panelRef),h=o.useMemo(()=>({open:a===0}),[a]),b=P(v=>{v.stopPropagation()}),E={ref:d,id:n,onClick:b},w=l?ce:o.Fragment,m=l?{unmount:u}:{},$=j();return o.createElement(w,{...m},$({ourProps:E,theirProps:i,slot:h,defaultTag:Il,name:"Dialog.Panel"}))}let Dl="div";function jl(e,t){let{transition:r=!1,...n}=e,[{dialogState:l,unmount:i}]=Ge("Dialog.Backdrop"),a=o.useMemo(()=>({open:l===0}),[l]),u={ref:t,"aria-hidden":!0},s=r?ce:o.Fragment,d=r?{unmount:i}:{},h=j();return o.createElement(s,{...d},h({ourProps:u,theirProps:n,slot:a,defaultTag:Dl,name:"Dialog.Backdrop"}))}let _l="h2";function Wl(e,t){let r=o.useId(),{id:n=`headlessui-dialog-title-${r}`,...l}=e,[{dialogState:i,setTitleId:a}]=Ge("Dialog.Title"),u=B(t);o.useEffect(()=>(a(n),()=>a(null)),[n,a]);let s=o.useMemo(()=>({open:i===0}),[i]),d={ref:u,id:n};return j()({ourProps:d,theirProps:l,slot:s,defaultTag:_l,name:"Dialog.Title"})}let Ul=N(Al),Et=N(Nl);N(jl);let Hl=N(Wl),Vl=Object.assign(Ul,{Panel:Et,Title:Hl,Description:ln});function Sr({onClick:e}){return S.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:e,children:[S.jsx("span",{className:"sr-only",children:"Close"}),S.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:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}const Bl=({modalContext:e,config:t,children:r})=>{const[n,l]=o.useState(!1);return S.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:S.jsx("div",{className:Le("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:S.jsx(ce,{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:Le("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:S.jsxs(Et,{className:`im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":n,children:[t.closeButton&&S.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:S.jsx(Sr,{onClick:e.close})}),typeof r=="function"?r({modalContext:e,config:t}):r]})})})})},ql=({modalContext:e,config:t,children:r})=>{const[n,l]=o.useState(!1);return S.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:S.jsx("div",{className:Le("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:S.jsx(ce,{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:Le("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:S.jsxs(Et,{className:`im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":n,children:[t.closeButton&&S.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:S.jsx(Sr,{onClick:e.close})}),typeof r=="function"?r({modalContext:e,config:t}):r]})})})})},Or=o.forwardRef(({name:e,children:t,onFocus:r=null,onBlur:n=null,onClose:l=null,onSuccess:i=null,onAfterLeave:a=null,...u},s)=>{const d=b=>typeof t=="function"?t(b):t,h=o.useRef(null);return o.useImperativeHandle(s,()=>h.current,[h]),S.jsx(nt,{ref:h,name:e,onFocus:r,onBlur:n,onClose:l,onSuccess:i,...u,children:({afterLeave:b,close:E,config:w,emit:m,getChildModal:$,getParentModal:v,id:c,index:f,isOpen:g,modalContext:y,onTopOfStack:p,reload:x,setOpen:O,shouldRender:F})=>S.jsx(xr,{appear:!0,show:g??!1,afterLeave:a,children:S.jsxs(Vl,{as:"div",className:"im-dialog relative z-20",onClose:()=>w.closeExplicitly?null:E(),"data-inertiaui-modal-id":c,"data-inertiaui-modal-index":f,children:[f===0?S.jsx(ce,{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:p?S.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):S.jsx("div",{})}):null,f>0&&p?S.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,w.slideover?S.jsx(ql,{modalContext:y,config:w,children:d({afterLeave:b,close:E,config:w,emit:m,getChildModal:$,getParentModal:v,id:c,index:f,isOpen:g,modalContext:y,onTopOfStack:p,reload:x,setOpen:O,shouldRender:F})}):S.jsx(Bl,{modalContext:y,config:w,children:d({afterLeave:b,close:E,config:w,emit:m,getChildModal:$,getParentModal:v,id:c,index:f,isOpen:g,modalContext:y,onTopOfStack:p,reload:x,setOpen:O,shouldRender:F})})]})})})});Or.displayName="Modal";const Xl=({href:e,method:t="get",data:r={},as:n="a",headers:l={},queryStringArrayFormat:i="brackets",onAfterLeave:a=null,onBlur:u=null,onClose:s=null,onError:d=null,onFocus:h=null,onStart:b=null,onSuccess:E=null,navigate:w=null,children:m,...$})=>{const[v,c]=o.useState(!1),[f,g]=o.useState(null),{stack:y,visit:p}=ge(),x=o.useMemo(()=>w??Te("navigate"),[w]),O={},F={};Object.keys($).forEach(T=>{Pt.includes(T)||(T.startsWith("on")&&typeof $[T]=="function"?T.toLowerCase()in window?O[T]=$[T]:F[T]=$[T]:O[T]=$[T])});const[U,k]=o.useState(!1);o.useEffect(()=>{f&&(f.onTopOfStack&&U?h==null||h():!f.onTopOfStack&&!U&&(u==null||u()),k(!f.onTopOfStack))},[y]);const D=o.useCallback(()=>{s==null||s()},[s]),H=o.useCallback(()=>{g(null),a==null||a()},[a]),A=o.useCallback(T=>{T==null||T.preventDefault(),!v&&(e.startsWith("#")||(c(!0),b==null||b()),p(e,t,r,l,jr(Dr($,Pt)),()=>D(y.length),H,i,x).then(I=>{g(I),I.registerEventListenersFromProps(F),E==null||E()}).catch(I=>{console.error(I),d==null||d(I)}).finally(()=>c(!1)))},[e,t,r,l,i,$,D,H]);return S.jsx(n,{...O,href:e,onClick:A,children:typeof m=="function"?m({loading:v}):m})},Mr=({children:e,data:t,params:r,buffer:n,as:l,always:i,fallback:a})=>{i=i??!1,l=l??"div",a=a??null;const[u,s]=o.useState(!1),d=o.useRef(!1),h=o.useRef(!1),b=o.useRef(null),E=rt(),w=o.useCallback(()=>{if(t)return{only:Array.isArray(t)?t:[t]};if(!r)throw new Error("You must provide either a `data` or `params` prop.");return r},[r,t]);return o.useEffect(()=>{if(!b.current)return;const m=new IntersectionObserver($=>{if(!$[0].isIntersecting||(!i&&d.current&&m.disconnect(),h.current))return;d.current=!0,h.current=!0;const v=w();E.reload({...v,onStart:c=>{var f;h.current=!0,(f=v.onStart)==null||f.call(v,c)},onFinish:c=>{var f;s(!0),h.current=!1,(f=v.onFinish)==null||f.call(v,c),i||m.disconnect()}})},{rootMargin:`${n||0}px`});return m.observe(b.current),()=>{m.disconnect()}},[b,w,n]),i||!u?o.createElement(l,{props:null,ref:b},u?e:a):u?e:null};Mr.displayName="InertiaWhenVisible";const zl=e=>t=>(t.default.layout=r=>o.createElement(e,{},r),t);M.Deferred=Lt,M.HeadlessModal=nt,M.Modal=Or,M.ModalLink=Xl,M.ModalRoot=kt,M.ModalStackProvider=Ct,M.WhenVisible=Mr,M.getConfig=Te,M.initFromPageProps=Tt,M.putConfig=Ar,M.renderApp=_r,M.resetConfig=Lr,M.setPageLayout=zl,M.useModal=rt,M.useModalIndex=tt,M.useModalStack=ge,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
20
+ */var Gt;function bn(){return Gt||(Gt=1,process.env.NODE_ENV!=="production"&&(function(){function e(s,d){return s===d&&(s!==0||1/s===1/d)||s!==s&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=o,r=typeof Object.is=="function"?Object.is:e,n=t.useSyncExternalStore,l=t.useRef,i=t.useEffect,a=t.useMemo,u=t.useDebugValue;pt.useSyncExternalStoreWithSelector=function(s,d,h,b,E){var w=l(null);if(w.current===null){var m={hasValue:!1,value:null};w.current=m}else m=w.current;w=a(function(){function v(p){if(!c){if(c=!0,f=p,p=b(p),E!==void 0&&m.hasValue){var x=m.value;if(E(x,p))return g=x}return g=p}if(x=g,r(f,p))return x;var S=b(p);return E!==void 0&&E(x,S)?(f=p,x):(f=p,g=S)}var c=!1,f,g,y=h===void 0?null:h;return[function(){return v(d())},y===null?void 0:function(){return v(y())}]},[d,h,b,E]);var $=n(s,w[0],w[1]);return i(function(){m.hasValue=!0,m.value=$},[$]),u($),$},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),pt}var Kt;function yn(){return Kt||(Kt=1,process.env.NODE_ENV==="production"?Ue.exports=wn():Ue.exports=bn()),Ue.exports}var En=yn();function Yt(e,t,r=Vt){return En.useSyncExternalStoreWithSelector(P(n=>e.subscribe(xn,n)),P(()=>e.state),P(()=>e.state),P(t),r)}function xn(e){return e}function xe(e,t){let r=o.useId(),n=Xt.get(t),[l,i]=Yt(n,o.useCallback(a=>[n.selectors.isTop(a,r),n.selectors.inStack(a,r)],[n,r]));return N(()=>{if(e)return n.actions.push(r),()=>n.actions.pop(r)},[n,e,r]),e?i?l:!0:!1}let ht=new Map,$e=new Map;function Zt(e){var t;let r=(t=$e.get(e))!=null?t:0;return $e.set(e,r+1),r!==0?()=>Jt(e):(ht.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Jt(e))}function Jt(e){var t;let r=(t=$e.get(e))!=null?t:1;if(r===1?$e.delete(e):$e.set(e,r-1),r!==1)return;let n=ht.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,ht.delete(e))}function $n(e,{allowed:t,disallowed:r}={}){let n=xe(e,"inert-others");N(()=>{var l,i;if(!n)return;let a=G();for(let s of(l=r==null?void 0:r())!=null?l:[])s&&a.add(Zt(s));let u=(i=t==null?void 0:t())!=null?i:[];for(let s of u){if(!s)continue;let d=Ne(s);if(!d)continue;let h=s.parentElement;for(;h&&h!==d.body;){for(let b of h.children)u.some(E=>b.contains(E))||a.add(Zt(b));h=h.parentElement}}return a.dispose},[n,t,r])}function On(e,t,r){let n=re(l=>{let i=l.getBoundingClientRect();i.x===0&&i.y===0&&i.width===0&&i.height===0&&r()});o.useEffect(()=>{if(!e)return;let l=t===null?null:le(t)?t:t.current;if(!l)return;let i=G();if(typeof ResizeObserver<"u"){let a=new ResizeObserver(()=>n.current(l));a.observe(l),i.add(()=>a.disconnect())}if(typeof IntersectionObserver<"u"){let a=new IntersectionObserver(()=>n.current(l));a.observe(l),i.add(()=>a.disconnect())}return()=>i.dispose()},[t,n,e])}let He=["[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(","),Sn=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Y=(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))(Y||{}),vt=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(vt||{}),Mn=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Mn||{});function Cn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(He)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function Pn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Sn)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var Qt=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Qt||{});function Tn(e,t=0){var r;return e===((r=Ne(e))==null?void 0:r.body)?!1:K(t,{0(){return e.matches(He)},1(){let n=e;for(;n!==null;){if(n.matches(He))return!0;n=n.parentElement}return!1}})}var kn=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(kn||{});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 Z(e){e==null||e.focus({preventScroll:!0})}let Ln=["textarea","input"].join(",");function Fn(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Ln))!=null?r:!1}function An(e,t=r=>r){return e.slice().sort((r,n)=>{let l=t(r),i=t(n);if(l===null||i===null)return 0;let a=l.compareDocumentPosition(i);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Oe(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:l=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?r?An(e):e:t&64?Pn(e):Cn(e);l.length>0&&a.length>1&&(a=a.filter(w=>!l.some(m=>m!=null&&"current"in m?(m==null?void 0:m.current)===w:m===w))),n=n??i.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")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,a.indexOf(n))-1;if(t&4)return Math.max(0,a.indexOf(n))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),d=t&32?{preventScroll:!0}:{},h=0,b=a.length,E;do{if(h>=b||h+b<=0)return 0;let w=s+h;if(t&16)w=(w+b)%b;else{if(w<0)return 3;if(w>=b)return 1}E=a[w],E==null||E.focus(d),h+=u}while(E!==i.activeElement);return t&6&&Fn(E)&&E.select(),2}function Rt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function In(){return/Android/gi.test(window.navigator.userAgent)}function er(){return Rt()||In()}function Ve(e,t,r,n){let l=re(r);o.useEffect(()=>{if(!e)return;function i(a){l.current(a)}return document.addEventListener(t,i,n),()=>document.removeEventListener(t,i,n)},[e,t,n])}function tr(e,t,r,n){let l=re(r);o.useEffect(()=>{if(!e)return;function i(a){l.current(a)}return window.addEventListener(t,i,n),()=>window.removeEventListener(t,i,n)},[e,t,n])}const rr=30;function Nn(e,t,r){let n=re(r),l=o.useCallback(function(u,s){if(u.defaultPrevented)return;let d=s(u);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let h=(function b(E){return typeof E=="function"?b(E()):Array.isArray(E)||E instanceof Set?E:[E]})(t);for(let b of h)if(b!==null&&(b.contains(d)||u.composed&&u.composedPath().includes(b)))return;return!Tn(d,Qt.Loose)&&d.tabIndex!==-1&&u.preventDefault(),n.current(u,d)},[n,t]),i=o.useRef(null);Ve(e,"pointerdown",u=>{var s,d;er()||(i.current=((d=(s=u.composedPath)==null?void 0:s.call(u))==null?void 0:d[0])||u.target)},!0),Ve(e,"pointerup",u=>{if(er()||!i.current)return;let s=i.current;return i.current=null,l(u,()=>s)},!0);let a=o.useRef({x:0,y:0});Ve(e,"touchstart",u=>{a.current.x=u.touches[0].clientX,a.current.y=u.touches[0].clientY},!0),Ve(e,"touchend",u=>{let s={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(s.x-a.current.x)>=rr||Math.abs(s.y-a.current.y)>=rr))return l(u,()=>R(u.target)?u.target:null)},!0),tr(e,"blur",u=>l(u,()=>Qr(window.document.activeElement)?window.document.activeElement:null),!0)}function Be(...e){return o.useMemo(()=>Ne(...e),[...e])}function nr(e,t,r,n){let l=re(r);o.useEffect(()=>{e=e??window;function i(a){l.current(a)}return e.addEventListener(t,i,n),()=>e.removeEventListener(t,i,n)},[e,t,n])}function Dn(e){return o.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function jn(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(l){return n.add(l),()=>n.delete(l)},dispatch(l,...i){let a=t[l].call(r,...i);a&&(r=a,n.forEach(u=>u()))}}}function _n(){let e;return{before({doc:t}){var r;let n=t.documentElement,l=(r=t.defaultView)!=null?r:window;e=Math.max(0,l.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,l=Math.max(0,n.clientWidth-n.offsetWidth),i=Math.max(0,e-l);r.style(n,"paddingRight",`${i}px`)}}}function Wn(){return Rt()?{before({doc:e,d:t,meta:r}){function n(l){return r.containers.flatMap(i=>i()).some(i=>i.contains(l))}t.microTask(()=>{var l;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let u=G();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let i=(l=window.scrollY)!=null?l:window.pageYOffset,a=null;t.addEventListener(e,"click",u=>{if(R(u.target))try{let s=u.target.closest("a");if(!s)return;let{hash:d}=new URL(s.href),h=e.querySelector(d);R(h)&&!n(h)&&(a=h)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(R(u.target)&&Jr(u.target))if(n(u.target)){let s=u.target;for(;s.parentElement&&n(s.parentElement);)s=s.parentElement;t.style(s,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(R(u.target)){if(Rr(u.target))return;if(n(u.target)){let s=u.target;for(;s.parentElement&&s.dataset.headlessuiPortal!==""&&!(s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth);)s=s.parentElement;s.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let s=(u=window.scrollY)!=null?u:window.pageYOffset;i!==s&&window.scrollTo(0,i),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)})})}}:{}}function Un(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Hn(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let oe=jn(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:G(),meta:new Set};return n.count++,n.meta.add(t),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:r}){let n={doc:e,d:t,meta:Hn(r)},l=[Wn(),_n(),Un()];l.forEach(({before:i})=>i==null?void 0:i(n)),l.forEach(({after:i})=>i==null?void 0:i(n))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});oe.subscribe(()=>{let e=oe.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",l=r.count!==0;(l&&!n||!l&&n)&&oe.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&oe.dispatch("TEARDOWN",r)}});function Vn(e,t,r=()=>({containers:[]})){let n=Dn(oe),l=t?n.get(t):void 0,i=l?l.count>0:!1;return N(()=>{if(!(!t||!e))return oe.dispatch("PUSH",t,r),()=>oe.dispatch("POP",t,r)},[e,t]),i}function Bn(e,t,r=()=>[document.body]){let n=xe(e,"scroll-lock");Vn(n,t,l=>{var i;return{containers:[...(i=l.containers)!=null?i:[],r]}})}function qn(e=0){let[t,r]=o.useState(e),n=o.useCallback(s=>r(s),[t]),l=o.useCallback(s=>r(d=>d|s),[t]),i=o.useCallback(s=>(t&s)===s,[t]),a=o.useCallback(s=>r(d=>d&~s),[r]),u=o.useCallback(s=>r(d=>d^s),[r]);return{flags:t,setFlag:n,addFlag:l,hasFlag:i,removeFlag:a,toggleFlag:u}}var lr,or;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((lr=process==null?void 0:process.env)==null?void 0:lr.NODE_ENV)==="test"&&typeof((or=Element==null?void 0:Element.prototype)==null?void 0:or.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(`
21
+ `)),[]});var Xn=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Xn||{});function zn(e){let t={};for(let r in e)e[r]===!0&&(t[`data-${r}`]="");return t}function Gn(e,t,r,n){let[l,i]=o.useState(r),{hasFlag:a,addFlag:u,removeFlag:s}=qn(e&&l?3:0),d=o.useRef(!1),h=o.useRef(!1),b=it();return N(()=>{var E;if(e){if(r&&i(!0),!t){r&&u(3);return}return(E=n==null?void 0:n.start)==null||E.call(n,r),Kn(t,{inFlight:d,prepare(){h.current?h.current=!1:h.current=d.current,d.current=!0,!h.current&&(r?(u(3),s(4)):(u(4),s(2)))},run(){h.current?r?(s(3),u(4)):(s(4),u(3)):r?s(1):u(1)},done(){var w;h.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(d.current=!1,s(7),r||i(!1),(w=n==null?void 0:n.end)==null||w.call(n,r))}})}},[e,r,t,b]),e?[l,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Kn(e,{prepare:t,run:r,done:n,inFlight:l}){let i=G();return Zn(e,{prepare:t,inFlight:l}),i.nextFrame(()=>{r(),i.requestAnimationFrame(()=>{i.add(Yn(e,n))})}),i.dispose}function Yn(e,t){var r,n;let l=G();if(!e)return l.dispose;let i=!1;l.add(()=>{i=!0});let a=(n=(r=e.getAnimations)==null?void 0:r.call(e).filter(u=>u instanceof CSSTransition))!=null?n:[];return a.length===0?(t(),l.dispose):(Promise.allSettled(a.map(u=>u.finished)).then(()=>{i||t()}),l.dispose)}function Zn(e,{inFlight:t,prepare:r}){if(t!=null&&t.current){r();return}let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}function gt(e,t){let r=o.useRef([]),n=P(e);o.useEffect(()=>{let l=[...r.current];for(let[i,a]of t.entries())if(r.current[i]!==a){let u=n(t,l);return r.current=t,u}},[n,...t])}let qe=o.createContext(null);qe.displayName="OpenClosedContext";var V=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(V||{});function Xe(){return o.useContext(qe)}function Jn({value:e,children:t}){return o.createElement(qe.Provider,{value:e},t)}function Qn({children:e}){return o.createElement(qe.Provider,{value:null},e)}function Rn(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let ee=[];Rn(()=>{function e(t){if(!R(t.target)||t.target===document.body||ee[0]===t.target)return;let r=t.target;r=r.closest(He),ee.unshift(r??t.target),ee=ee.filter(n=>n!=null&&n.isConnected),ee.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 ir(e){let t=P(e),r=o.useRef(!1);o.useEffect(()=>(r.current=!1,()=>{r.current=!0,De(()=>{r.current&&t()})}),[t])}function el(){let e=typeof document>"u";return"useSyncExternalStore"in ve?(t=>t.useSyncExternalStore)(ve)(()=>()=>{},()=>!1,()=>!e):!1}function Se(){let e=el(),[t,r]=ve.useState(q.isHandoffComplete);return t&&q.isHandoffComplete===!1&&r(!1),ve.useEffect(()=>{t!==!0&&r(!0)},[t]),ve.useEffect(()=>q.handoff(),[]),e?!1:t}let sr=o.createContext(!1);function tl(){return o.useContext(sr)}function ur(e){return o.createElement(sr.Provider,{value:e.force},e.children)}function rl(e){let t=tl(),r=o.useContext(dr),[n,l]=o.useState(()=>{var i;if(!t&&r!==null)return(i=r.current)!=null?i:null;if(q.isServer)return null;let a=e==null?void 0:e.getElementById("headlessui-portal-root");if(a)return a;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return o.useEffect(()=>{n!==null&&(e!=null&&e.body.contains(n)||e==null||e.body.appendChild(n))},[n,e]),o.useEffect(()=>{t||r!==null&&l(r.current)},[r,l,t]),n}let ar=o.Fragment,nl=D(function(e,t){let{ownerDocument:r=null,...n}=e,l=o.useRef(null),i=X(en(w=>{l.current=w}),t),a=Be(l),u=r??a,s=rl(u),[d]=o.useState(()=>{var w;return q.isServer?null:(w=u==null?void 0:u.createElement("div"))!=null?w:null}),h=o.useContext(wt),b=Se();N(()=>{!s||!d||s.contains(d)||(d.setAttribute("data-headlessui-portal",""),s.appendChild(d))},[s,d]),N(()=>{if(d&&h)return h.register(d)},[h,d]),ir(()=>{var w;!s||!d||(Nt(d)&&s.contains(d)&&s.removeChild(d),s.childNodes.length<=0&&((w=s.parentElement)==null||w.removeChild(s)))});let E=W();return b?!s||!d?null:Tr.createPortal(E({ourProps:{ref:i},theirProps:n,slot:{},defaultTag:ar,name:"Portal"}),d):null});function ll(e,t){let r=X(t),{enabled:n=!0,ownerDocument:l,...i}=e,a=W();return n?o.createElement(nl,{...i,ownerDocument:l,ref:r}):a({ourProps:{ref:r},theirProps:i,slot:{},defaultTag:ar,name:"Portal"})}let ol=o.Fragment,dr=o.createContext(null);function il(e,t){let{target:r,...n}=e,l={ref:X(t)},i=W();return o.createElement(dr.Provider,{value:r},i({ourProps:l,theirProps:n,defaultTag:ol,name:"Popover.Group"}))}let wt=o.createContext(null);function sl(){let e=o.useContext(wt),t=o.useRef([]),r=P(i=>(t.current.push(i),e&&e.register(i),()=>n(i))),n=P(i=>{let a=t.current.indexOf(i);a!==-1&&t.current.splice(a,1),e&&e.unregister(i)}),l=o.useMemo(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,o.useMemo(()=>function({children:i}){return o.createElement(wt.Provider,{value:l},i)},[l])]}let ul=D(ll),cr=D(il),al=Object.assign(ul,{Group:cr});function dl(e,t=typeof document<"u"?document.defaultView:null,r){let n=xe(e,"escape");nr(t,"keydown",l=>{n&&(l.defaultPrevented||l.key===_t.Escape&&r(l))})}function cl(){var e;let[t]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[r,n]=o.useState((e=t==null?void 0:t.matches)!=null?e:!1);return N(()=>{if(!t)return;function l(i){n(i.matches)}return t.addEventListener("change",l),()=>t.removeEventListener("change",l)},[t]),r}function fl({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=Be(r),l=P(()=>{var i,a;let u=[];for(let s of e)s!==null&&(Q(s)?u.push(s):"current"in s&&Q(s.current)&&u.push(s.current));if(t!=null&&t.current)for(let s of t.current)u.push(s);for(let s of(i=n==null?void 0:n.querySelectorAll("html > *, body > *"))!=null?i:[])s!==document.body&&s!==document.head&&Q(s)&&s.id!=="headlessui-portal-root"&&(r&&(s.contains(r)||s.contains((a=r==null?void 0:r.getRootNode())==null?void 0:a.host))||u.some(d=>s.contains(d))||u.push(s));return u});return{resolveContainers:l,contains:P(i=>l().some(a=>a.contains(i)))}}let fr=o.createContext(null);function mr({children:e,node:t}){let[r,n]=o.useState(null),l=pr(t??r);return o.createElement(fr.Provider,{value:l},e,l===null&&o.createElement(at,{features:We.Hidden,ref:i=>{var a,u;if(i){for(let s of(u=(a=Ne(i))==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?u:[])if(s!==document.body&&s!==document.head&&Q(s)&&s!=null&&s.contains(i)){n(s);break}}}}))}function pr(e=null){var t;return(t=o.useContext(fr))!=null?t:e}function bt(){let e=o.useRef(!1);return N(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var Me=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Me||{});function ml(){let e=o.useRef(0);return tr(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function hr(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)Q(r.current)&&t.add(r.current);return t}let pl="div";var ie=(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))(ie||{});function hl(e,t){let r=o.useRef(null),n=X(r,t),{initialFocus:l,initialFocusFallback:i,containers:a,features:u=15,...s}=e;Se()||(u=0);let d=Be(r);bl(u,{ownerDocument:d});let h=yl(u,{ownerDocument:d,container:r,initialFocus:l,initialFocusFallback:i});El(u,{ownerDocument:d,container:r,containers:a,previousActiveElement:h});let b=ml(),E=P(f=>{if(!le(r.current))return;let g=r.current;(y=>y())(()=>{K(b.current,{[Me.Forwards]:()=>{Oe(g,Y.First,{skipElements:[f.relatedTarget,i]})},[Me.Backwards]:()=>{Oe(g,Y.Last,{skipElements:[f.relatedTarget,i]})}})})}),w=xe(!!(u&2),"focus-trap#tab-lock"),m=it(),$=o.useRef(!1),v={ref:n,onKeyDown(f){f.key=="Tab"&&($.current=!0,m.requestAnimationFrame(()=>{$.current=!1}))},onBlur(f){if(!(u&4))return;let g=hr(a);le(r.current)&&g.add(r.current);let y=f.relatedTarget;R(y)&&y.dataset.headlessuiFocusGuard!=="true"&&(vr(g,y)||($.current?Oe(r.current,K(b.current,{[Me.Forwards]:()=>Y.Next,[Me.Backwards]:()=>Y.Previous})|Y.WrapAround,{relativeTo:f.target}):R(f.target)&&Z(f.target)))}},c=W();return o.createElement(o.Fragment,null,w&&o.createElement(at,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:E,features:We.Focusable}),c({ourProps:v,theirProps:s,defaultTag:pl,name:"FocusTrap"}),w&&o.createElement(at,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:E,features:We.Focusable}))}let vl=D(hl),gl=Object.assign(vl,{features:ie});function wl(e=!0){let t=o.useRef(ee.slice());return gt(([r],[n])=>{n===!0&&r===!1&&De(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=ee.slice())},[e,ee,t]),P(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function bl(e,{ownerDocument:t}){let r=!!(e&8),n=wl(r);gt(()=>{r||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&Z(n())},[r]),ir(()=>{r&&Z(n())})}function yl(e,{ownerDocument:t,container:r,initialFocus:n,initialFocusFallback:l}){let i=o.useRef(null),a=xe(!!(e&1),"focus-trap#initial-focus"),u=bt();return gt(()=>{if(e===0)return;if(!a){l!=null&&l.current&&Z(l.current);return}let s=r.current;s&&De(()=>{if(!u.current)return;let d=t==null?void 0:t.activeElement;if(n!=null&&n.current){if((n==null?void 0:n.current)===d){i.current=d;return}}else if(s.contains(d)){i.current=d;return}if(n!=null&&n.current)Z(n.current);else{if(e&16){if(Oe(s,Y.First|Y.AutoFocus)!==vt.Error)return}else if(Oe(s,Y.First)!==vt.Error)return;if(l!=null&&l.current&&(Z(l.current),(t==null?void 0:t.activeElement)===l.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}i.current=t==null?void 0:t.activeElement})},[l,a,e]),i}function El(e,{ownerDocument:t,container:r,containers:n,previousActiveElement:l}){let i=bt(),a=!!(e&4);nr(t==null?void 0:t.defaultView,"focus",u=>{if(!a||!i.current)return;let s=hr(n);le(r.current)&&s.add(r.current);let d=l.current;if(!d)return;let h=u.target;le(h)?vr(s,h)?(l.current=h,Z(h)):(u.preventDefault(),u.stopPropagation(),Z(d)):Z(l.current)},!0)}function vr(e,t){for(let r of e)if(r.contains(t))return!0;return!1}function gr(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:br)!==o.Fragment||o.Children.count(e.children)===1}let ze=o.createContext(null);ze.displayName="TransitionContext";var xl=(e=>(e.Visible="visible",e.Hidden="hidden",e))(xl||{});function $l(){let e=o.useContext(ze);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Ol(){let e=o.useContext(Ge);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ge=o.createContext(null);Ge.displayName="NestingContext";function Ke(e){return"children"in e?Ke(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function wr(e,t){let r=re(e),n=o.useRef([]),l=bt(),i=it(),a=P((w,m=J.Hidden)=>{let $=n.current.findIndex(({el:v})=>v===w);$!==-1&&(K(m,{[J.Unmount](){n.current.splice($,1)},[J.Hidden](){n.current[$].state="hidden"}}),i.microTask(()=>{var v;!Ke(n)&&l.current&&((v=r.current)==null||v.call(r))}))}),u=P(w=>{let m=n.current.find(({el:$})=>$===w);return m?m.state!=="visible"&&(m.state="visible"):n.current.push({el:w,state:"visible"}),()=>a(w,J.Unmount)}),s=o.useRef([]),d=o.useRef(Promise.resolve()),h=o.useRef({enter:[],leave:[]}),b=P((w,m,$)=>{s.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==w)),t==null||t.chains.current[m].push([w,new Promise(v=>{s.current.push(v)})]),t==null||t.chains.current[m].push([w,new Promise(v=>{Promise.all(h.current[m].map(([c,f])=>f)).then(()=>v())})]),m==="enter"?d.current=d.current.then(()=>t==null?void 0:t.wait.current).then(()=>$(m)):$(m)}),E=P((w,m,$)=>{Promise.all(h.current[m].splice(0).map(([v,c])=>c)).then(()=>{var v;(v=s.current.shift())==null||v()}).then(()=>$(m))});return o.useMemo(()=>({children:n,register:u,unregister:a,onStart:b,onStop:E,wait:d,chains:h}),[u,a,n,b,E,h,d])}let br=o.Fragment,yr=je.RenderStrategy;function Sl(e,t){var r,n;let{transition:l=!0,beforeEnter:i,afterEnter:a,beforeLeave:u,afterLeave:s,enter:d,enterFrom:h,enterTo:b,entered:E,leave:w,leaveFrom:m,leaveTo:$,...v}=e,[c,f]=o.useState(null),g=o.useRef(null),y=gr(e),p=X(...y?[g,t,f]:t===null?[]:[t]),x=(r=v.unmount)==null||r?J.Unmount:J.Hidden,{show:S,appear:F,initial:j}=$l(),[k,A]=o.useState(S?"visible":"hidden"),H=Ol(),{register:I,unregister:T}=H;N(()=>I(g),[I,g]),N(()=>{if(x===J.Hidden&&g.current){if(S&&k!=="visible"){A("visible");return}return K(k,{hidden:()=>T(g),visible:()=>I(g)})}},[k,g,I,T,S,x]);let _=Se();N(()=>{if(y&&_&&k==="visible"&&g.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[g,k,_,y]);let pe=j&&!F,se=F&&S&&j,L=o.useRef(!1),he=wr(()=>{L.current||(A("hidden"),T(g))},H),Ze=P(Ot=>{L.current=!0;let Qe=Ot?"enter":"leave";he.onStart(g,Qe,Pe=>{Pe==="enter"?i==null||i():Pe==="leave"&&(u==null||u())})}),te=P(Ot=>{let Qe=Ot?"enter":"leave";L.current=!1,he.onStop(g,Qe,Pe=>{Pe==="enter"?a==null||a():Pe==="leave"&&(s==null||s())}),Qe==="leave"&&!Ke(he)&&(A("hidden"),T(g))});o.useEffect(()=>{y&&l||(Ze(S),te(S))},[S,y,l]);let $t=!(!l||!y||!_||pe),[,C]=Gn($t,c,S,{start:Ze,end:te}),Je=ne({ref:p,className:((n=st(v.className,se&&d,se&&h,C.enter&&d,C.enter&&C.closed&&h,C.enter&&!C.closed&&b,C.leave&&w,C.leave&&!C.closed&&m,C.leave&&C.closed&&$,!C.transition&&S&&E))==null?void 0:n.trim())||void 0,...zn(C)}),Ce=0;k==="visible"&&(Ce|=V.Open),k==="hidden"&&(Ce|=V.Closed),S&&k==="hidden"&&(Ce|=V.Opening),!S&&k==="visible"&&(Ce|=V.Closing);let Kl=W();return o.createElement(Ge.Provider,{value:he},o.createElement(Jn,{value:Ce},Kl({ourProps:Je,theirProps:v,defaultTag:br,features:yr,visible:k==="visible",name:"Transition.Child"})))}function Ml(e,t){let{show:r,appear:n=!1,unmount:l=!0,...i}=e,a=o.useRef(null),u=gr(e),s=X(...u?[a,t]:t===null?[]:[t]);Se();let d=Xe();if(r===void 0&&d!==null&&(r=(d&V.Open)===V.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[h,b]=o.useState(r?"visible":"hidden"),E=wr(()=>{r||b("hidden")}),[w,m]=o.useState(!0),$=o.useRef([r]);N(()=>{w!==!1&&$.current[$.current.length-1]!==r&&($.current.push(r),m(!1))},[$,r]);let v=o.useMemo(()=>({show:r,appear:n,initial:w}),[r,n,w]);N(()=>{r?b("visible"):!Ke(E)&&a.current!==null&&b("hidden")},[r,E]);let c={unmount:l},f=P(()=>{var p;w&&m(!1),(p=e.beforeEnter)==null||p.call(e)}),g=P(()=>{var p;w&&m(!1),(p=e.beforeLeave)==null||p.call(e)}),y=W();return o.createElement(Ge.Provider,{value:E},o.createElement(ze.Provider,{value:v},y({ourProps:{...c,as:o.Fragment,children:o.createElement(Er,{ref:s,...c,...i,beforeEnter:f,beforeLeave:g})},theirProps:{},defaultTag:o.Fragment,features:yr,visible:h==="visible",name:"Transition"})))}function Cl(e,t){let r=o.useContext(ze)!==null,n=Xe()!==null;return o.createElement(o.Fragment,null,!r&&n?o.createElement(yt,{ref:t,...e}):o.createElement(Er,{ref:t,...e}))}let yt=D(Ml),Er=D(Sl),me=D(Cl),xr=Object.assign(yt,{Child:me,Root:yt});var Pl=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Pl||{}),Tl=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Tl||{});let kl={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Et=o.createContext(null);Et.displayName="DialogContext";function Ye(e){let t=o.useContext(Et);if(t===null){let r=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ye),r}return t}function Ll(e,t){return K(t.type,kl,e,t)}let $r=D(function(e,t){let r=o.useId(),{id:n=`headlessui-dialog-${r}`,open:l,onClose:i,initialFocus:a,role:u="dialog",autoFocus:s=!0,__demoMode:d=!1,unmount:h=!1,...b}=e,E=o.useRef(!1);u=(function(){return u==="dialog"||u==="alertdialog"?u:(E.current||(E.current=!0,console.warn(`Invalid role [${u}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let w=Xe();l===void 0&&w!==null&&(l=(w&V.Open)===V.Open);let m=o.useRef(null),$=X(m,t),v=Be(m),c=l?0:1,[f,g]=o.useReducer(Ll,{titleId:null,descriptionId:null,panelRef:o.createRef()}),y=P(()=>i(!1)),p=P(C=>g({type:0,id:C})),x=Se()?c===0:!1,[S,F]=sl(),j={get current(){var C;return(C=f.panelRef.current)!=null?C:m.current}},k=pr(),{resolveContainers:A}=fl({mainTreeNode:k,portals:S,defaultContainers:[j]}),H=w!==null?(w&V.Closing)===V.Closing:!1;$n(d||H?!1:x,{allowed:P(()=>{var C,Je;return[(Je=(C=m.current)==null?void 0:C.closest("[data-headlessui-portal]"))!=null?Je:null]}),disallowed:P(()=>{var C;return[(C=k==null?void 0:k.closest("body > *:not(#headlessui-portal-root)"))!=null?C:null]})});let I=Xt.get(null);N(()=>{if(x)return I.actions.push(n),()=>I.actions.pop(n)},[I,n,x]);let T=Yt(I,o.useCallback(C=>I.selectors.isTop(C,n),[I,n]));Nn(T,A,C=>{C.preventDefault(),y()}),dl(T,v==null?void 0:v.defaultView,C=>{C.preventDefault(),C.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),y()}),Bn(d||H?!1:x,v,A),On(x,m,y);let[_,pe]=tn(),se=o.useMemo(()=>[{dialogState:c,close:y,setTitleId:p,unmount:h},f],[c,f,y,p,h]),L=o.useMemo(()=>({open:c===0}),[c]),he={ref:$,id:n,role:u,tabIndex:-1,"aria-modal":d?void 0:c===0?!0:void 0,"aria-labelledby":f.titleId,"aria-describedby":_,unmount:h},Ze=!cl(),te=ie.None;x&&!d&&(te|=ie.RestoreFocus,te|=ie.TabLock,s&&(te|=ie.AutoFocus),Ze&&(te|=ie.InitialFocus));let $t=W();return o.createElement(Qn,null,o.createElement(ur,{force:!0},o.createElement(al,null,o.createElement(Et.Provider,{value:se},o.createElement(cr,{target:m},o.createElement(ur,{force:!1},o.createElement(pe,{slot:L},o.createElement(F,null,o.createElement(gl,{initialFocus:a,initialFocusFallback:m,containers:A,features:te},o.createElement(un,{value:y},$t({ourProps:he,theirProps:b,slot:L,defaultTag:Fl,features:Al,visible:c===0,name:"Dialog"})))))))))))}),Fl="div",Al=je.RenderStrategy|je.Static;function Il(e,t){let{transition:r=!1,open:n,...l}=e,i=Xe(),a=e.hasOwnProperty("open")||i!==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(!i&&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(n!==void 0||r)&&!l.static?o.createElement(mr,null,o.createElement(xr,{show:n,transition:r,unmount:l.unmount},o.createElement($r,{ref:t,...l}))):o.createElement(mr,null,o.createElement($r,{ref:t,open:n,...l}))}let Nl="div";function Dl(e,t){let r=o.useId(),{id:n=`headlessui-dialog-panel-${r}`,transition:l=!1,...i}=e,[{dialogState:a,unmount:u},s]=Ye("Dialog.Panel"),d=X(t,s.panelRef),h=o.useMemo(()=>({open:a===0}),[a]),b=P(v=>{v.stopPropagation()}),E={ref:d,id:n,onClick:b},w=l?me:o.Fragment,m=l?{unmount:u}:{},$=W();return o.createElement(w,{...m},$({ourProps:E,theirProps:i,slot:h,defaultTag:Nl,name:"Dialog.Panel"}))}let jl="div";function _l(e,t){let{transition:r=!1,...n}=e,[{dialogState:l,unmount:i}]=Ye("Dialog.Backdrop"),a=o.useMemo(()=>({open:l===0}),[l]),u={ref:t,"aria-hidden":!0},s=r?me:o.Fragment,d=r?{unmount:i}:{},h=W();return o.createElement(s,{...d},h({ourProps:u,theirProps:n,slot:a,defaultTag:jl,name:"Dialog.Backdrop"}))}let Wl="h2";function Ul(e,t){let r=o.useId(),{id:n=`headlessui-dialog-title-${r}`,...l}=e,[{dialogState:i,setTitleId:a}]=Ye("Dialog.Title"),u=X(t);o.useEffect(()=>(a(n),()=>a(null)),[n,a]);let s=o.useMemo(()=>({open:i===0}),[i]),d={ref:u,id:n};return W()({ourProps:d,theirProps:l,slot:s,defaultTag:Wl,name:"Dialog.Title"})}let Hl=D(Il),xt=D(Dl);D(_l);let Vl=D(Ul),Bl=Object.assign(Hl,{Panel:xt,Title:Vl,Description:on});function Or({onClick:e}){return O.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:e,children:[O.jsx("span",{className:"sr-only",children:"Close"}),O.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:O.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}const ql=({modalContext:e,config:t,children:r})=>{const[n,l]=o.useState(!1);return O.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:O.jsx("div",{className:Ie("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:O.jsx(me,{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:Ie("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:O.jsxs(xt,{className:`im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":n,children:[t.closeButton&&O.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:O.jsx(Or,{onClick:e.close})}),typeof r=="function"?r({modalContext:e,config:t}):r]})})})})},Xl=({modalContext:e,config:t,children:r})=>{const[n,l]=o.useState(!1);return O.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:O.jsx("div",{className:Ie("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:O.jsx(me,{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:Ie("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:O.jsxs(xt,{className:`im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":n,children:[t.closeButton&&O.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:O.jsx(Or,{onClick:e.close})}),typeof r=="function"?r({modalContext:e,config:t}):r]})})})})},Sr=o.forwardRef(({name:e,children:t,onFocus:r=null,onBlur:n=null,onClose:l=null,onSuccess:i=null,onAfterLeave:a=null,...u},s)=>{const d=b=>typeof t=="function"?t(b):t,h=o.useRef(null);return o.useImperativeHandle(s,()=>h.current,[h]),O.jsx(lt,{ref:h,name:e,onFocus:r,onBlur:n,onClose:l,onSuccess:i,...u,children:({afterLeave:b,close:E,config:w,emit:m,getChildModal:$,getParentModal:v,id:c,index:f,isOpen:g,modalContext:y,onTopOfStack:p,reload:x,setOpen:S,shouldRender:F})=>O.jsx(xr,{appear:!0,show:g??!1,afterLeave:a,children:O.jsxs(Bl,{as:"div",className:"im-dialog relative z-20",onClose:()=>w.closeExplicitly?null:E(),"data-inertiaui-modal-id":c,"data-inertiaui-modal-index":f,children:[f===0?O.jsx(me,{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:p?O.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):O.jsx("div",{})}):null,f>0&&p?O.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,w.slideover?O.jsx(Xl,{modalContext:y,config:w,children:d({afterLeave:b,close:E,config:w,emit:m,getChildModal:$,getParentModal:v,id:c,index:f,isOpen:g,modalContext:y,onTopOfStack:p,reload:x,setOpen:S,shouldRender:F})}):O.jsx(ql,{modalContext:y,config:w,children:d({afterLeave:b,close:E,config:w,emit:m,getChildModal:$,getParentModal:v,id:c,index:f,isOpen:g,modalContext:y,onTopOfStack:p,reload:x,setOpen:S,shouldRender:F})})]})})})});Sr.displayName="Modal";const zl=({href:e,method:t="get",data:r={},as:n="a",headers:l={},queryStringArrayFormat:i="brackets",onAfterLeave:a=null,onBlur:u=null,onClose:s=null,onError:d=null,onFocus:h=null,onStart:b=null,onSuccess:E=null,navigate:w=null,children:m,...$})=>{const[v,c]=o.useState(!1),[f,g]=o.useState(null),{stack:y,visit:p}=be(),x=o.useMemo(()=>w??Le("navigate"),[w]),S={},F={};Object.keys($).forEach(T=>{Pt.includes(T)||(T.startsWith("on")&&typeof $[T]=="function"?_r(T)?S[T]=$[T]:F[T]=$[T]:S[T]=$[T])});const[j,k]=o.useState(!1);o.useEffect(()=>{f&&(f.onTopOfStack&&j?h==null||h():!f.onTopOfStack&&!j&&(u==null||u()),k(!f.onTopOfStack))},[y]);const A=o.useCallback(()=>{s==null||s()},[s]),H=o.useCallback(()=>{g(null),a==null||a()},[a]),I=o.useCallback(T=>{T==null||T.preventDefault(),!v&&(e.startsWith("#")||(c(!0),b==null||b()),p(e,t,r,l,jr(Dr($,Pt)),()=>A(y.length),H,i,x).then(_=>{g(_),_.registerEventListenersFromProps(F),E==null||E()}).catch(_=>{console.error(_),d==null||d(_)}).finally(()=>c(!1)))},[e,t,r,l,i,$,A,H]);return O.jsx(n,{...S,href:e,onClick:I,children:typeof m=="function"?m({loading:v}):m})},Mr=({children:e,data:t,params:r,buffer:n,as:l,always:i,fallback:a})=>{i=i??!1,l=l??"div",a=a??null;const[u,s]=o.useState(!1),d=o.useRef(!1),h=o.useRef(!1),b=o.useRef(null),E=nt(),w=o.useCallback(()=>{if(t)return{only:Array.isArray(t)?t:[t]};if(!r)throw new Error("You must provide either a `data` or `params` prop.");return r},[r,t]);return o.useEffect(()=>{if(!b.current)return;const m=new IntersectionObserver($=>{if(!$[0].isIntersecting||(!i&&d.current&&m.disconnect(),h.current))return;d.current=!0,h.current=!0;const v=w();E.reload({...v,onStart:c=>{var f;h.current=!0,(f=v.onStart)==null||f.call(v,c)},onFinish:c=>{var f;s(!0),h.current=!1,(f=v.onFinish)==null||f.call(v,c),i||m.disconnect()}})},{rootMargin:`${n||0}px`});return m.observe(b.current),()=>{m.disconnect()}},[b,w,n]),i||!u?o.createElement(l,{props:null,ref:b},u?e:a):u?e:null};Mr.displayName="InertiaWhenVisible";const Gl=e=>t=>(t.default.layout=r=>o.createElement(e,{},r),t);M.Deferred=Ft,M.HeadlessModal=lt,M.Modal=Sr,M.ModalLink=zl,M.ModalRoot=kt,M.ModalStackProvider=Ct,M.WhenVisible=Mr,M.getConfig=Le,M.initFromPageProps=Tt,M.putConfig=Ar,M.renderApp=Wr,M.resetConfig=Fr,M.setPageLayout=Gl,M.useModal=nt,M.useModalIndex=rt,M.useModalStack=be,Object.defineProperty(M,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": "1.0.0-beta-1",
4
+ "version": "1.0.0-beta-3",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -51,4 +51,4 @@
51
51
  "react": "^18.2.0||^19.0.0",
52
52
  "react-dom": "^18.2.0||^19.0.0"
53
53
  }
54
- }
54
+ }
package/src/ModalLink.jsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useState, useEffect, useMemo } from 'react'
2
2
  import { useModalStack, modalPropNames } from './ModalRoot'
3
- import { only, rejectNullValues } from './helpers'
3
+ import { only, rejectNullValues, isStandardDomEvent } from './helpers'
4
4
  import { getConfig } from './config'
5
5
 
6
6
  const ModalLink = ({
@@ -39,7 +39,7 @@ const ModalLink = ({
39
39
  }
40
40
 
41
41
  if (key.startsWith('on') && typeof props[key] === 'function') {
42
- if (key.toLowerCase() in window) {
42
+ if (isStandardDomEvent(key)) {
43
43
  standardProps[key] = props[key]
44
44
  } else {
45
45
  customEvents[key] = props[key]
package/src/ModalRoot.jsx CHANGED
@@ -325,6 +325,9 @@ export const ModalStackProvider = ({ children }) => {
325
325
  options.onAfterLeave,
326
326
  options.queryStringArrayFormat ?? 'brackets',
327
327
  options.navigate ?? getConfig('navigate'),
328
+ options.onStart,
329
+ options.onSuccess,
330
+ options.onError,
328
331
  ).then((modal) => {
329
332
  const listeners = options.listeners ?? {}
330
333
 
@@ -347,6 +350,9 @@ export const ModalStackProvider = ({ children }) => {
347
350
  onAfterLeave = null,
348
351
  queryStringArrayFormat = 'brackets',
349
352
  useBrowserHistory = false,
353
+ onStart = null,
354
+ onSuccess = null,
355
+ onError = null,
350
356
  ) => {
351
357
  const modalId = generateId()
352
358
 
@@ -391,7 +397,16 @@ export const ModalStackProvider = ({ children }) => {
391
397
  headers,
392
398
  preserveScroll: true,
393
399
  preserveState: true,
394
- onError: reject,
400
+ onError(...args) {
401
+ onError?.(...args)
402
+ reject(...args)
403
+ },
404
+ onStart(...args) {
405
+ onStart?.(...args)
406
+ },
407
+ onSuccess(...args) {
408
+ onSuccess?.(...args)
409
+ },
395
410
  onBefore: () => {
396
411
  baseModalsToWaitFor[modalId] = resolve
397
412
  },
@@ -400,15 +415,21 @@ export const ModalStackProvider = ({ children }) => {
400
415
 
401
416
  //
402
417
 
418
+ onStart?.()
419
+
403
420
  Axios({
404
421
  url,
405
422
  method,
406
423
  data,
407
424
  headers,
408
425
  })
409
- .then((response) => resolve(pushFromResponseData(response.data, config, onClose, onAfterLeave)))
410
- .catch((error) => {
411
- reject(error)
426
+ .then((response) => {
427
+ onSuccess?.(response)
428
+ resolve(pushFromResponseData(response.data, config, onClose, onAfterLeave))
429
+ })
430
+ .catch((...args) => {
431
+ onError?.(...args)
432
+ reject(...args)
412
433
  })
413
434
  })
414
435
  }
@@ -544,7 +565,7 @@ export const ModalRoot = ({ children }) => {
544
565
  console.error('No base url in modal response data so cannot navigate back')
545
566
  return
546
567
  }
547
- if (!isNavigating && window.location.href !== modalOnBase.baseUrl) {
568
+ if (!isNavigating && typeof window !== 'undefined' && window.location.href !== modalOnBase.baseUrl) {
548
569
  router.visit(modalOnBase.baseUrl, {
549
570
  preserveScroll: true,
550
571
  preserveState: true,
package/src/helpers.js CHANGED
@@ -1,2 +1,2 @@
1
- import { generateId, sameUrlPath, except, only, rejectNullValues, kebabCase } from './../../vue/src/helpers.js'
2
- export { generateId, sameUrlPath, except, only, rejectNullValues, kebabCase }
1
+ import { generateId, sameUrlPath, except, only, rejectNullValues, kebabCase, isStandardDomEvent } from './../../vue/src/helpers.js'
2
+ export { generateId, sameUrlPath, except, only, rejectNullValues, kebabCase, isStandardDomEvent }