@inertiaui/modal-react 0.18.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inertiaui-modal.js +1515 -1502
- package/dist/inertiaui-modal.umd.cjs +4 -11
- package/package.json +2 -3
- package/src/Modal.jsx +6 -13
- package/src/ModalContent.jsx +5 -16
- package/src/SlideoverContent.jsx +5 -16
- package/src/helpers.js +2 -2
- package/src/focusTrapper.js +0 -23
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
(function(I,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("react/jsx-runtime"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime","axios","@inertiajs/react","@inertiajs/core"],l):(I=typeof globalThis<"u"?globalThis:I||self,l(I.InertiaUIModal={},I.React,I.jsxRuntime,I.Axios,I.react,I.core))})(this,function(I,l,N,he,te,Mt){"use strict";var Yn=Object.defineProperty;var Jn=(I,l,N)=>l in I?Yn(I,l,{enumerable:!0,configurable:!0,writable:!0,value:N}):I[l]=N;var _=(I,l,N)=>Jn(I,typeof l!="symbol"?l+"":l,N);function At(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const ie=At(l),le={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 jt{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(le))}put(e,n){if(typeof e=="object"){this.config={type:e.type??le.type,navigate:e.navigate??le.navigate,modal:{...le.modal,...e.modal??{}},slideover:{...le.slideover,...e.slideover??{}}};return}const r=e.split(".");let i=this.config;for(let s=0;s<r.length-1;s++)i=i[r[s]]=i[r[s]]||{};i[r[r.length-1]]=n}get(e){if(typeof e>"u")return this.config;const n=e.split(".");let r=this.config;for(const i of n){if(r[i]===void 0)return null;r=r[i]}return r}}const ve=new jt,Lt=()=>ve.reset(),Dt=(t,e)=>ve.put(t,e),me=t=>ve.get(t),ne=(t,e)=>ve.get(t?`slideover.${e}`:`modal.${e}`),ze={modifiedElements:[],bodyState:{hasOverflowHidden:!1,originalPaddingRight:""},prepare(){const t=window.innerWidth-document.documentElement.clientWidth;this.bodyState.originalPaddingRight=document.body.style.paddingRight;const e=parseInt(window.getComputedStyle(document.body).paddingRight,10);document.body.style.paddingRight=`${e+t}px`,document.body.classList.contains("overflow-hidden")||(document.body.classList.add("overflow-hidden"),this.bodyState.hasOverflowHidden=!0),Array.from(document.body.children).forEach(n=>{!n.classList.contains("im-dialog")&&n.getAttribute("aria-hidden")!=="true"&&(n.setAttribute("aria-hidden","true"),this.modifiedElements.push(n))})},cleanup(){this.bodyState.hasOverflowHidden&&(document.body.classList.remove("overflow-hidden"),this.bodyState.hasOverflowHidden=!1),document.body.style.paddingRight=this.bodyState.originalPaddingRight,this.bodyState.originalPaddingRight="",this.modifiedElements.forEach(t=>{t.removeAttribute("aria-hidden")}),this.modifiedElements=[]}};function Me(t="inertiaui_modal_"){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${t}${crypto.randomUUID()}`:`${t}${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}function $t(t,e){return Array.isArray(t)?t.filter(n=>!e.includes(n)):Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{})}function Ge(t,e){return Array.isArray(t)?t.filter(n=>e.includes(n)):e.reduce((n,r)=>(r in t&&(n[r]=t[r]),n),{})}function Ut(t){return Array.isArray(t)?t.filter(e=>e!==null):Object.keys(t).reduce((e,n)=>(n in t&&t[n]!==null&&(e[n]=t[n]),e),{})}function Wt(t,e=3,n=10){return new Promise((r,i)=>{const s=t();if(s){r(s);return}let a=e*1e3/n;const v=setInterval(()=>{const u=t();u&&(clearInterval(v),r(u)),--a<=0&&(clearInterval(v),i(new Error("Condition not met in time")))},n)})}function se(t){return t?(t=t.replace(/_/g,"-"),t=t.replace(/-+/g,"-"),/[A-Z]/.test(t)?(t=t.replace(/\s+/g,"").replace(/_/g,"").replace(/(?:^|\s|-)+([A-Za-z])/g,(e,n)=>n.toUpperCase()),t=t.replace(/(.)(?=[A-Z])/g,"$1-"),t.toLowerCase()):t):""}const pe=l.createContext(null);pe.displayName="ModalStackContext";let Ze=null,Ye=null,ue=null,Ae=null,je=[],re={};const Je=({children:t})=>{const[e,n]=l.useState([]),[r,i]=l.useState({}),s=y=>{n(c=>{const h=y([...c]),m=w=>{var T;return h.length<2?!0:((T=h.map(p=>({id:p.id,shouldRender:p.shouldRender})).reverse().find(p=>p.shouldRender))==null?void 0:T.id)===w};return h.forEach((w,T)=>{h[T].onTopOfStack=m(w.id),h[T].getParentModal=()=>T<1?null:h.slice(0,T).reverse().find(p=>p.isOpen),h[T].getChildModal=()=>T===h.length-1?null:h.slice(T+1).find(p=>p.isOpen)}),h})};l.useEffect(()=>{je=e},[e]);class a{constructor(c,h,m,w,T){_(this,"show",()=>{s(c=>c.map(h=>(h.id===this.id&&!h.isOpen&&(h.isOpen=!0,h.shouldRender=!0),h)))});_(this,"setOpen",c=>{c?this.show():this.close()});_(this,"close",()=>{s(c=>c.map(h=>{var m;return h.id===this.id&&h.isOpen&&(Object.keys(h.listeners).forEach(w=>{h.off(w)}),h.isOpen=!1,(m=h.onCloseCallback)==null||m.call(h)),h}))});_(this,"afterLeave",()=>{this.isOpen||s(c=>{const h=c.map(m=>{var w;return m.id===this.id&&!m.isOpen&&(m.shouldRender=!1,(w=m.afterLeaveCallback)==null||w.call(m),m.afterLeaveCallback=null),m});return this.index===0?[]:h})});_(this,"on",(c,h)=>{c=se(c),this.listeners[c]=this.listeners[c]??[],this.listeners[c].push(h)});_(this,"off",(c,h)=>{var m;c=se(c),h?this.listeners[c]=((m=this.listeners[c])==null?void 0:m.filter(w=>w!==h))??[]:delete this.listeners[c]});_(this,"emit",(c,...h)=>{var m;(m=this.listeners[se(c)])==null||m.forEach(w=>w(...h))});_(this,"registerEventListenersFromProps",c=>{const h=[];return Object.keys(c).filter(m=>m.startsWith("on")).forEach(m=>{const w=se(m).replace(/^on-/,"");this.on(w,c[m]),h.push(()=>this.off(w,c[m]))}),()=>h.forEach(m=>m())});_(this,"reload",(c={})=>{var m;let h=Object.keys(this.response.props);c.only&&(h=Ge(h,c.only)),c.except&&(h=$t(h,c.except)),(m=this.response)!=null&&m.url&&he.get(this.response.url,{headers:{Accept:"text/html, application/xhtml+xml","X-Inertia":!0,"X-Inertia-Partial-Component":this.response.component,"X-Inertia-Version":this.response.version,"X-Inertia-Partial-Data":h.join(","),"X-InertiaUI-Modal":Me(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":ue}}).then(w=>{this.updateProps(w.data.props)})});_(this,"updateProps",c=>{Object.assign(this.props,c),s(h=>h)});if(this.id=h.id??Me(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=c,this.props=h.props,this.response=h,this.config=m??{},this.onCloseCallback=w,this.afterLeaveCallback=T,re[this.id]){this.config={...this.config,...re[this.id].config??{}};const p=re[this.id].onClose,M=re[this.id].onAfterLeave;p&&(this.onCloseCallback=w?()=>{w(),p()}:p),M&&(this.afterLeaveCallback=T?()=>{T(),M()}:M),delete re[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 v=(y,c={},h=null,m=null)=>Ye(y.component).then(w=>u(w,y,c,h,m)),u=(y,c,h,m,w)=>{const T=new a(y,c,h,m,w);return T.index=e.length,s(p=>[...p,T]),T.show(),T};function b(y,c,h,m){if(!r[y])throw new Error(`The local modal "${y}" has not been registered.`);const w=u(null,{},c,h,m);return w.name=y,r[y].callback(w),w}const g=(y,c={})=>x(y,c.method??"get",c.data??{},c.headers??{},c.config??{},c.onClose,c.onAfterLeave,c.queryStringArrayFormat??"brackets",c.navigate??me("navigate")).then(h=>{const m=c.listeners??{};return Object.keys(m).forEach(w=>{const T=se(w);h.on(T,m[w])}),h}),x=(y,c,h={},m={},w={},T=null,p=null,M="brackets",L=!1)=>{const B=Me();return new Promise((H,U)=>{if(y.startsWith("#")){H(b(y.substring(1),w,T,p));return}const[W,k]=Mt.mergeDataIntoQueryString(c,y||"",h,M);let o=L&&e.length===0;if(e.length===0&&(ue=typeof window<"u"?window.location.href:""),m={...m,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":Ze,"X-InertiaUI-Modal":B,"X-InertiaUI-Modal-Use-Router":o?1:0,"X-InertiaUI-Modal-Base-Url":ue},o)return Ae=null,re[B]={config:w,onClose:T,onAfterLeave:p},te.router.visit(W,{method:c,data:k,headers:m,preserveScroll:!0,preserveState:!0,onError:U,onFinish:()=>{Wt(()=>Ae).then(H)}});he({url:W,method:c,data:k,headers:m}).then(d=>H(v(d.data,w,T,p))).catch(d=>{U(d)})})},f={stack:e,localModals:r,push:u,pushFromResponseData:v,closeAll:()=>{je.reverse().forEach(y=>y.close())},reset:()=>s(()=>[]),visit:x,visitModal:g,registerLocalModal:(y,c)=>{i(h=>({...h,[y]:{name:y,callback:c}}))},removeLocalModal:y=>{i(c=>{const h={...c};return delete h[y],h})}};return N.jsx(pe.Provider,{value:f,children:t})},oe=()=>{const t=l.useContext(pe);if(t===null)throw new Error("useModalStack must be used within a ModalStackProvider");return t},Qe=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],Re=t=>{t.initialPage&&(Ze=t.initialPage.version),t.resolveComponent&&(Ye=t.resolveComponent)},Bt=(t,e)=>{Re(e);const n=({Component:r,props:i,key:s})=>{const a=()=>{const v=l.createElement(r,{key:s,...i});return typeof r.layout=="function"?r.layout(v):Array.isArray(r.layout)?r.layout.concat(v).reverse().reduce((b,g)=>l.createElement(g,i,b)):v};return N.jsxs(N.Fragment,{children:[a(),N.jsx(et,{})]})};return N.jsx(Je,{children:N.jsx(t,{...e,children:n})})},et=({children:t})=>{var v;const e=l.useContext(pe);let n=!1,r=!1;l.useEffect(()=>te.router.on("start",()=>n=!0),[]),l.useEffect(()=>te.router.on("finish",()=>n=!1),[]),l.useEffect(()=>te.router.on("navigate",function(u){const b=u.detail.page.props._inertiaui_modal;if(!b){r&&e.closeAll();return}r=b,ue=b.baseUrl,e.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&&te.router.visit(b.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(g=>{Ae=g})}),[]);const i=u=>(je.length&&(u.headers["X-InertiaUI-Modal-Base-Url"]=ue),u);l.useEffect(()=>(he.interceptors.request.use(i),()=>he.interceptors.request.eject(i)),[]);const s=te.usePage(),a=l.useRef();return l.useEffect(()=>{var g,x;const u=(g=s.props)==null?void 0:g._inertiaui_modal,b=a.current;a.current=u,u&&b&&u.component===b.component&&u.url===b.url&&((x=e.stack[0])==null||x.updateProps(u.props??{}))},[(v=s.props)==null?void 0:v._inertiaui_modal]),N.jsxs(N.Fragment,{children:[t,e.stack.length>0&&N.jsx(tt,{index:0})]})},Le=l.createContext(null);Le.displayName="ModalIndexContext";const De=()=>{const t=l.useContext(Le);if(t===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return t},tt=({index:t})=>{const{stack:e}=oe(),n=l.useMemo(()=>e[t],[e,t]);return(n==null?void 0:n.component)&&N.jsx(Le.Provider,{value:t,children:N.jsx(n.component,{...n.props,onModalEvent:(...r)=>n.emit(...r)})})},$e=l.forwardRef(({name:t,children:e,onFocus:n=null,onBlur:r=null,onClose:i=null,onSuccess:s=null,...a},v)=>{const u=De(),{stack:b,registerLocalModal:g,removeLocalModal:x}=oe(),[O,S]=l.useState(null),f=l.useMemo(()=>t?O:b[u],[t,O,u,b]),y=l.useMemo(()=>{var p;return(p=b.find(M=>M.shouldRender&&M.index>(f==null?void 0:f.index)))==null?void 0:p.index},[u,b]),c=l.useMemo(()=>(f==null?void 0:f.config.slideover)??a.slideover??me("type")==="slideover",[a.slideover]),h=l.useMemo(()=>({slideover:c,closeButton:a.closeButton??ne(c,"closeButton"),closeExplicitly:a.closeExplicitly??ne(c,"closeExplicitly"),maxWidth:a.maxWidth??ne(c,"maxWidth"),paddingClasses:a.paddingClasses??ne(c,"paddingClasses"),panelClasses:a.panelClasses??ne(c,"panelClasses"),position:a.position??ne(c,"position"),...f==null?void 0:f.config}),[a,f==null?void 0:f.config]);l.useEffect(()=>{if(t){let p=null;return g(t,M=>{p=M.registerEventListenersFromProps(a),S(M)}),()=>{p==null||p(),p=null,x(t)}}return f.registerEventListenersFromProps(a)},[t]);const m=l.useRef(f);l.useEffect(()=>{m.current=f},[f]),l.useEffect(()=>{f!==null&&(f.isOpen?s==null||s():i==null||i())},[f==null?void 0:f.isOpen]);const[w,T]=l.useState(!1);return l.useEffect(()=>{w&&f!==null&&f.isOpen&&(f.onTopOfStack?n==null||n():r==null||r()),T(!0)},[f==null?void 0:f.onTopOfStack]),l.useImperativeHandle(v,()=>({afterLeave:()=>{var p;return(p=m.current)==null?void 0:p.afterLeave()},close:()=>{var p;return(p=m.current)==null?void 0:p.close()},emit:(...p)=>{var M;return(M=m.current)==null?void 0:M.emit(...p)},getChildModal:()=>{var p;return(p=m.current)==null?void 0:p.getChildModal()},getParentModal:()=>{var p;return(p=m.current)==null?void 0:p.getParentModal()},reload:(...p)=>{var M;return(M=m.current)==null?void 0:M.reload(...p)},setOpen:()=>{var p;return(p=m.current)==null?void 0:p.setOpen()},get id(){var p;return(p=m.current)==null?void 0:p.id},get index(){var p;return(p=m.current)==null?void 0:p.index},get isOpen(){var p;return(p=m.current)==null?void 0:p.isOpen},get config(){var p;return(p=m.current)==null?void 0:p.config},get modalContext(){return m.current},get onTopOfStack(){var p;return(p=m.current)==null?void 0:p.onTopOfStack},get shouldRender(){var p;return(p=m.current)==null?void 0:p.shouldRender}}),[f]),(f==null?void 0:f.shouldRender)&&N.jsxs(N.Fragment,{children:[typeof e=="function"?e({afterLeave:f.afterLeave,close:f.close,config:h,emit:f.emit,getChildModal:f.getChildModal,getParentModal:f.getParentModal,id:f.id,index:f.index,isOpen:f.isOpen,modalContext:f,onTopOfStack:f.onTopOfStack,reload:f.reload,setOpen:f.setOpen,shouldRender:f.shouldRender}):e,y&&N.jsx(tt,{index:y})]})});$e.displayName="HeadlessModal";function nt(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=nt(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function be(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=nt(t))&&(r&&(r+=" "),r+=e);return r}var Ht=Object.defineProperty,Kt=(t,e,n)=>e in t?Ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ue=(t,e,n)=>(Kt(t,typeof e!="symbol"?e+"":e,n),n);let _t=class{constructor(){Ue(this,"current",this.detect()),Ue(this,"handoffState","pending"),Ue(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}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"}},ge=new _t;function qt(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function ye(){let t=[],e={addEventListener(n,r,i,s){return n.addEventListener(r,i,s),e.add(()=>n.removeEventListener(r,i,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return e.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return e.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return qt(()=>{r.current&&n[0]()}),e.add(()=>{r.current=!1})},style(n,r,i){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:i}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=ye();return n(r),this.add(()=>r.dispose())},add(n){return t.includes(n)||t.push(n),()=>{let r=t.indexOf(n);if(r>=0)for(let i of t.splice(r,1))i()}},dispose(){for(let n of t.splice(0))n()}};return e}function rt(){let[t]=l.useState(ye);return l.useEffect(()=>()=>t.dispose(),[t]),t}let z=(t,e)=>{ge.isServer?l.useEffect(t,e):l.useLayoutEffect(t,e)};function at(t){let e=l.useRef(t);return z(()=>{e.current=t},[t]),e}let X=function(t){let e=at(t);return l.useCallback((...n)=>e.current(...n),[e])};function We(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function we(t,e,...n){if(t in e){let i=e[t];return typeof i=="function"?i(...n):i}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,we),r}var it=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(it||{}),G=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(G||{});function lt(){let t=Vt();return l.useCallback(e=>Xt({mergeRefs:t,...e}),[t])}function Xt({ourProps:t,theirProps:e,slot:n,defaultTag:r,features:i,visible:s=!0,name:a,mergeRefs:v}){v=v??zt;let u=st(e,t);if(s)return xe(u,n,r,a,v);let b=i??0;if(b&2){let{static:g=!1,...x}=u;if(g)return xe(x,n,r,a,v)}if(b&1){let{unmount:g=!0,...x}=u;return we(g?0:1,{0(){return null},1(){return xe({...x,hidden:!0,style:{display:"none"}},n,r,a,v)}})}return xe(u,n,r,a,v)}function xe(t,e={},n,r,i){let{as:s=n,children:a,refName:v="ref",...u}=He(t,["unmount","static"]),b=t.ref!==void 0?{[v]:t.ref}:{},g=typeof a=="function"?a(e):a;"className"in u&&u.className&&typeof u.className=="function"&&(u.className=u.className(e)),u["aria-labelledby"]&&u["aria-labelledby"]===u.id&&(u["aria-labelledby"]=void 0);let x={};if(e){let O=!1,S=[];for(let[f,y]of Object.entries(e))typeof y=="boolean"&&(O=!0),y===!0&&S.push(f.replace(/([A-Z])/g,c=>`-${c.toLowerCase()}`));if(O){x["data-headlessui-state"]=S.join(" ");for(let f of S)x[`data-${f}`]=""}}if(s===l.Fragment&&(Object.keys(Y(u)).length>0||Object.keys(Y(x)).length>0))if(!l.isValidElement(g)||Array.isArray(g)&&g.length>1){if(Object.keys(Y(u)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Y(u)).concat(Object.keys(Y(x))).map(O=>` - ${O}`).join(`
|
|
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(
|
|
1
|
+
(function(C,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react"),require("react/jsx-runtime"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime","axios","@inertiajs/react","@inertiajs/core","react-dom"],i):(C=typeof globalThis<"u"?globalThis:C||self,i(C.InertiaUIModal={},C.React,C.jsxRuntime,C.Axios,C.react,C.core,C.ReactDOM))})(this,function(C,i,$,ye,ne,en,tn){"use strict";var il=Object.defineProperty;var ol=(C,i,$)=>i in C?il(C,i,{enumerable:!0,configurable:!0,writable:!0,value:$}):C[i]=$;var B=(C,i,$)=>ol(C,typeof i!="symbol"?i+"":i,$);function nn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const se=nn(i),ue={type:"modal",navigate:!1,modal:{closeButton:!0,closeExplicitly:!1,maxWidth:"2xl",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white rounded",position:"center"},slideover:{closeButton:!0,closeExplicitly:!1,maxWidth:"md",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white min-h-screen",position:"right"}};class rn{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(ue))}put(t,n){if(typeof t=="object"){this.config={type:t.type??ue.type,navigate:t.navigate??ue.navigate,modal:{...ue.modal,...t.modal??{}},slideover:{...ue.slideover,...t.slideover??{}}};return}const r=t.split(".");let l=this.config;for(let s=0;s<r.length-1;s++)l=l[r[s]]=l[r[s]]||{};l[r[r.length-1]]=n}get(t){if(typeof t>"u")return this.config;const n=t.split(".");let r=this.config;for(const l of n){if(r[l]===void 0)return null;r=r[l]}return r}}const be=new rn,ln=()=>be.reset(),on=(e,t)=>be.put(e,t),$e=e=>be.get(e),re=(e,t)=>be.get(e?`slideover.${t}`:`modal.${t}`);function 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 sn(e,t){return Array.isArray(e)?e.filter(n=>!t.includes(n)):Object.keys(e).reduce((n,r)=>(t.includes(r)||(n[r]=e[r]),n),{})}function dt(e,t){return Array.isArray(e)?e.filter(n=>t.includes(n)):t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}function un(e){return Array.isArray(e)?e.filter(t=>t!==null):Object.keys(e).reduce((t,n)=>(n in e&&e[n]!==null&&(t[n]=e[n]),t),{})}function an(e,t=3,n=10){return new Promise((r,l)=>{const s=e();if(s){r(s);return}let u=t*1e3/n;const a=setInterval(()=>{const o=e();o&&(clearInterval(a),r(o)),--u<=0&&(clearInterval(a),l(new Error("Condition not met in time")))},n)})}function ae(e){return e?(e=e.replace(/_/g,"-"),e=e.replace(/-+/g,"-"),/[A-Z]/.test(e)?(e=e.replace(/\s+/g,"").replace(/_/g,"").replace(/(?:^|\s|-)+([A-Za-z])/g,(t,n)=>n.toUpperCase()),e=e.replace(/(.)(?=[A-Z])/g,"$1-"),e.toLowerCase()):e):""}const Me=i.createContext(null);Me.displayName="ModalStackContext";let ct=null,ft=null,de=null,Xe=null,Ve=[],le={};const mt=({children:e})=>{const[t,n]=i.useState([]),[r,l]=i.useState({}),s=g=>{n(d=>{const p=g([...d]),h=w=>{var y;return p.length<2?!0:((y=p.map(v=>({id:v.id,shouldRender:v.shouldRender})).reverse().find(v=>v.shouldRender))==null?void 0:y.id)===w};return p.forEach((w,y)=>{p[y].onTopOfStack=h(w.id),p[y].getParentModal=()=>y<1?null:p.slice(0,y).reverse().find(v=>v.isOpen),p[y].getChildModal=()=>y===p.length-1?null:p.slice(y+1).find(v=>v.isOpen)}),p})};i.useEffect(()=>{Ve=t},[t]);class u{constructor(d,p,h,w,y){B(this,"show",()=>{s(d=>d.map(p=>(p.id===this.id&&!p.isOpen&&(p.isOpen=!0,p.shouldRender=!0),p)))});B(this,"setOpen",d=>{d?this.show():this.close()});B(this,"close",()=>{s(d=>d.map(p=>{var h;return p.id===this.id&&p.isOpen&&(Object.keys(p.listeners).forEach(w=>{p.off(w)}),p.isOpen=!1,(h=p.onCloseCallback)==null||h.call(p)),p}))});B(this,"afterLeave",()=>{this.isOpen||s(d=>{const p=d.map(h=>{var w;return h.id===this.id&&!h.isOpen&&(h.shouldRender=!1,(w=h.afterLeaveCallback)==null||w.call(h),h.afterLeaveCallback=null),h});return this.index===0?[]:p})});B(this,"on",(d,p)=>{d=ae(d),this.listeners[d]=this.listeners[d]??[],this.listeners[d].push(p)});B(this,"off",(d,p)=>{var h;d=ae(d),p?this.listeners[d]=((h=this.listeners[d])==null?void 0:h.filter(w=>w!==p))??[]:delete this.listeners[d]});B(this,"emit",(d,...p)=>{var h;(h=this.listeners[ae(d)])==null||h.forEach(w=>w(...p))});B(this,"registerEventListenersFromProps",d=>{const p=[];return Object.keys(d).filter(h=>h.startsWith("on")).forEach(h=>{const w=ae(h).replace(/^on-/,"");this.on(w,d[h]),p.push(()=>this.off(w,d[h]))}),()=>p.forEach(h=>h())});B(this,"reload",(d={})=>{var h;let p=Object.keys(this.response.props);d.only&&(p=dt(p,d.only)),d.except&&(p=sn(p,d.except)),(h=this.response)!=null&&h.url&&ye.get(this.response.url,{headers:{Accept:"text/html, application/xhtml+xml","X-Inertia":!0,"X-Inertia-Partial-Component":this.response.component,"X-Inertia-Version":this.response.version,"X-Inertia-Partial-Data":p.join(","),"X-InertiaUI-Modal":qe(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":de}}).then(w=>{this.updateProps(w.data.props)})});B(this,"updateProps",d=>{Object.assign(this.props,d),s(p=>p)});if(this.id=p.id??qe(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=d,this.props=p.props,this.response=p,this.config=h??{},this.onCloseCallback=w,this.afterLeaveCallback=y,le[this.id]){this.config={...this.config,...le[this.id].config??{}};const v=le[this.id].onClose,M=le[this.id].onAfterLeave;v&&(this.onCloseCallback=w?()=>{w(),v()}:v),M&&(this.afterLeaveCallback=y?()=>{y(),M()}:M),delete le[this.id]}this.index=-1,this.getParentModal=()=>null,this.getChildModal=()=>null,this.onTopOfStack=!0}static generateId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`inertiaui_modal_${crypto.randomUUID()}`:`inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}}const a=(g,d={},p=null,h=null)=>ft(g.component).then(w=>o(w,g,d,p,h)),o=(g,d,p,h,w)=>{const y=new u(g,d,p,h,w);return y.index=t.length,s(v=>[...v,y]),y.show(),y};function c(g,d,p,h){if(!r[g])throw new Error(`The local modal "${g}" has not been registered.`);const w=o(null,{},d,p,h);return w.name=g,r[g].callback(w),w}const m=(g,d={})=>x(g,d.method??"get",d.data??{},d.headers??{},d.config??{},d.onClose,d.onAfterLeave,d.queryStringArrayFormat??"brackets",d.navigate??$e("navigate")).then(p=>{const h=d.listeners??{};return Object.keys(h).forEach(w=>{const y=ae(w);p.on(y,h[w])}),p}),x=(g,d,p={},h={},w={},y=null,v=null,M="brackets",T=!1)=>{const I=qe();return new Promise((H,F)=>{if(g.startsWith("#")){H(c(g.substring(1),w,y,v));return}const[A,U]=en.mergeDataIntoQueryString(d,g||"",p,M);let W=T&&t.length===0;if(t.length===0&&(de=typeof window<"u"?window.location.href:""),h={...h,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":ct,"X-InertiaUI-Modal":I,"X-InertiaUI-Modal-Use-Router":W?1:0,"X-InertiaUI-Modal-Base-Url":de},W)return Xe=null,le[I]={config:w,onClose:y,onAfterLeave:v},ne.router.visit(A,{method:d,data:U,headers:h,preserveScroll:!0,preserveState:!0,onError:F,onFinish:()=>{an(()=>Xe).then(H)}});ye({url:A,method:d,data:U,headers:h}).then(S=>H(a(S.data,w,y,v))).catch(S=>{F(S)})})},f={stack:t,localModals:r,push:o,pushFromResponseData:a,closeAll:()=>{Ve.reverse().forEach(g=>g.close())},reset:()=>s(()=>[]),visit:x,visitModal:m,registerLocalModal:(g,d)=>{l(p=>({...p,[g]:{name:g,callback:d}}))},removeLocalModal:g=>{l(d=>{const p={...d};return delete p[g],p})}};return $.jsx(Me.Provider,{value:f,children:e})},ce=()=>{const e=i.useContext(Me);if(e===null)throw new Error("useModalStack must be used within a ModalStackProvider");return e},pt=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],ht=e=>{e.initialPage&&(ct=e.initialPage.version),e.resolveComponent&&(ft=e.resolveComponent)},dn=(e,t)=>{ht(t);const n=({Component:r,props:l,key:s})=>{const u=()=>{const a=i.createElement(r,{key:s,...l});return typeof r.layout=="function"?r.layout(a):Array.isArray(r.layout)?r.layout.concat(a).reverse().reduce((c,m)=>i.createElement(m,l,c)):a};return $.jsxs($.Fragment,{children:[u(),$.jsx(vt,{})]})};return $.jsx(mt,{children:$.jsx(e,{...t,children:n})})},vt=({children:e})=>{var a;const t=i.useContext(Me);let n=!1,r=!1;i.useEffect(()=>ne.router.on("start",()=>n=!0),[]),i.useEffect(()=>ne.router.on("finish",()=>n=!1),[]),i.useEffect(()=>ne.router.on("navigate",function(o){const c=o.detail.page.props._inertiaui_modal;if(!c){r&&t.closeAll();return}r=c,de=c.baseUrl,t.pushFromResponseData(c,{},()=>{if(!c.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!n&&window.location.href!==c.baseUrl&&ne.router.visit(c.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(m=>{Xe=m})}),[]);const l=o=>(Ve.length&&(o.headers["X-InertiaUI-Modal-Base-Url"]=de),o);i.useEffect(()=>(ye.interceptors.request.use(l),()=>ye.interceptors.request.eject(l)),[]);const s=ne.usePage(),u=i.useRef();return i.useEffect(()=>{var m,x;const o=(m=s.props)==null?void 0:m._inertiaui_modal,c=u.current;u.current=o,o&&c&&o.component===c.component&&o.url===c.url&&((x=t.stack[0])==null||x.updateProps(o.props??{}))},[(a=s.props)==null?void 0:a._inertiaui_modal]),$.jsxs($.Fragment,{children:[e,t.stack.length>0&&$.jsx(gt,{index:0})]})},Ye=i.createContext(null);Ye.displayName="ModalIndexContext";const ze=()=>{const e=i.useContext(Ye);if(e===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return e},gt=({index:e})=>{const{stack:t}=ce(),n=i.useMemo(()=>t[e],[t,e]);return(n==null?void 0:n.component)&&$.jsx(Ye.Provider,{value:e,children:$.jsx(n.component,{...n.props,onModalEvent:(...r)=>n.emit(...r)})})},Ge=i.forwardRef(({name:e,children:t,onFocus:n=null,onBlur:r=null,onClose:l=null,onSuccess:s=null,...u},a)=>{const o=ze(),{stack:c,registerLocalModal:m,removeLocalModal:x}=ce(),[b,E]=i.useState(null),f=i.useMemo(()=>e?b:c[o],[e,b,o,c]),g=i.useMemo(()=>{var v;return(v=c.find(M=>M.shouldRender&&M.index>(f==null?void 0:f.index)))==null?void 0:v.index},[o,c]),d=i.useMemo(()=>(f==null?void 0:f.config.slideover)??u.slideover??$e("type")==="slideover",[u.slideover]),p=i.useMemo(()=>({slideover:d,closeButton:u.closeButton??re(d,"closeButton"),closeExplicitly:u.closeExplicitly??re(d,"closeExplicitly"),maxWidth:u.maxWidth??re(d,"maxWidth"),paddingClasses:u.paddingClasses??re(d,"paddingClasses"),panelClasses:u.panelClasses??re(d,"panelClasses"),position:u.position??re(d,"position"),...f==null?void 0:f.config}),[u,f==null?void 0:f.config]);i.useEffect(()=>{if(e){let v=null;return m(e,M=>{v=M.registerEventListenersFromProps(u),E(M)}),()=>{v==null||v(),v=null,x(e)}}return f.registerEventListenersFromProps(u)},[e]);const h=i.useRef(f);i.useEffect(()=>{h.current=f},[f]),i.useEffect(()=>{f!==null&&(f.isOpen?s==null||s():l==null||l())},[f==null?void 0:f.isOpen]);const[w,y]=i.useState(!1);return i.useEffect(()=>{w&&f!==null&&f.isOpen&&(f.onTopOfStack?n==null||n():r==null||r()),y(!0)},[f==null?void 0:f.onTopOfStack]),i.useImperativeHandle(a,()=>({afterLeave:()=>{var v;return(v=h.current)==null?void 0:v.afterLeave()},close:()=>{var v;return(v=h.current)==null?void 0:v.close()},emit:(...v)=>{var M;return(M=h.current)==null?void 0:M.emit(...v)},getChildModal:()=>{var v;return(v=h.current)==null?void 0:v.getChildModal()},getParentModal:()=>{var v;return(v=h.current)==null?void 0:v.getParentModal()},reload:(...v)=>{var M;return(M=h.current)==null?void 0:M.reload(...v)},setOpen:()=>{var v;return(v=h.current)==null?void 0:v.setOpen()},get id(){var v;return(v=h.current)==null?void 0:v.id},get index(){var v;return(v=h.current)==null?void 0:v.index},get isOpen(){var v;return(v=h.current)==null?void 0:v.isOpen},get config(){var v;return(v=h.current)==null?void 0:v.config},get modalContext(){return h.current},get onTopOfStack(){var v;return(v=h.current)==null?void 0:v.onTopOfStack},get shouldRender(){var v;return(v=h.current)==null?void 0:v.shouldRender}}),[f]),(f==null?void 0:f.shouldRender)&&$.jsxs($.Fragment,{children:[typeof t=="function"?t({afterLeave:f.afterLeave,close:f.close,config:p,emit:f.emit,getChildModal:f.getChildModal,getParentModal:f.getParentModal,id:f.id,index:f.index,isOpen:f.isOpen,modalContext:f,onTopOfStack:f.onTopOfStack,reload:f.reload,setOpen:f.setOpen,shouldRender:f.shouldRender}):t,g&&$.jsx(gt,{index:g})]})});Ge.displayName="HeadlessModal";function wt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=wt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ce(){for(var e,t,n=0,r="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=wt(e))&&(r&&(r+=" "),r+=t);return r}var cn=Object.defineProperty,fn=(e,t,n)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ke=(e,t,n)=>(fn(e,typeof t!="symbol"?t+"":t,n),n);let mn=class{constructor(){Ke(this,"current",this.detect()),Ke(this,"handoffState","pending"),Ke(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},J=new mn;function Se(e){return J.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Oe(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function z(){let e=[],t={addEventListener(n,r,l,s){return n.addEventListener(r,l,s),t.add(()=>n.removeEventListener(r,l,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Oe(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=z();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let l of e.splice(r,1))l()}},dispose(){for(let n of e.splice(0))n()}};return t}function Ze(){let[e]=i.useState(z);return i.useEffect(()=>()=>e.dispose(),[e]),e}let k=(e,t)=>{J.isServer?i.useEffect(e,t):i.useLayoutEffect(e,t)};function Q(e){let t=i.useRef(e);return k(()=>{t.current=e},[e]),t}let O=function(e){let t=Q(e);return i.useCallback((...n)=>t.current(...n),[t])},pn=i.createContext(void 0);function hn(){return i.useContext(pn)}function Je(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function G(e,t,...n){if(e in t){let l=t[e];return typeof l=="function"?l(...n):l}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,G),r}var Te=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Te||{}),K=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(K||{});function D(){let e=gn();return i.useCallback(t=>vn({mergeRefs:e,...t}),[e])}function vn({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:l,visible:s=!0,name:u,mergeRefs:a}){a=a??wn;let o=Et(t,e);if(s)return Pe(o,n,r,u,a);let c=l??0;if(c&2){let{static:m=!1,...x}=o;if(m)return Pe(x,n,r,u,a)}if(c&1){let{unmount:m=!0,...x}=o;return G(m?0:1,{0(){return null},1(){return Pe({...x,hidden:!0,style:{display:"none"}},n,r,u,a)}})}return Pe(o,n,r,u,a)}function Pe(e,t={},n,r,l){let{as:s=n,children:u,refName:a="ref",...o}=Qe(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},m=typeof u=="function"?u(t):u;"className"in o&&o.className&&typeof o.className=="function"&&(o.className=o.className(t)),o["aria-labelledby"]&&o["aria-labelledby"]===o.id&&(o["aria-labelledby"]=void 0);let x={};if(t){let b=!1,E=[];for(let[f,g]of Object.entries(t))typeof g=="boolean"&&(b=!0),g===!0&&E.push(f.replace(/([A-Z])/g,d=>`-${d.toLowerCase()}`));if(b){x["data-headlessui-state"]=E.join(" ");for(let f of E)x[`data-${f}`]=""}}if(s===i.Fragment&&(Object.keys(R(o)).length>0||Object.keys(R(x)).length>0))if(!i.isValidElement(m)||Array.isArray(m)&&m.length>1){if(Object.keys(R(o)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(R(o)).concat(Object.keys(R(x))).map(b=>` - ${b}`).join(`
|
|
2
|
+
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(b=>` - ${b}`).join(`
|
|
3
3
|
`)].join(`
|
|
4
|
-
`))}else{let O=g.props,S=O==null?void 0:O.className,f=typeof S=="function"?(...h)=>We(S(...h),u.className):We(S,u.className),y=f?{className:f}:{},c=st(g.props,Y(He(u,["ref"])));for(let h in x)h in c&&delete x[h];return l.cloneElement(g,Object.assign({},c,x,b,{ref:i(Gt(g),b.ref)},y))}return l.createElement(s,Object.assign({},He(u,["ref"]),s!==l.Fragment&&b,s!==l.Fragment&&x),g)}function Vt(){let t=l.useRef([]),e=l.useCallback(n=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return t.current=n,e}}function zt(...t){return t.every(e=>e==null)?void 0:e=>{for(let n of t)n!=null&&(typeof n=="function"?n(e):n.current=e)}}function st(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let r of t)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(r[i])):e[i]=r[i];if(e.disabled||e["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[i=>{var s;return(s=i==null?void 0:i.preventDefault)==null?void 0:s.call(i)}]);for(let r in n)Object.assign(e,{[r](i,...s){let a=n[r];for(let v of a){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;v(i,...s)}}});return e}function Be(t){var e;return Object.assign(l.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function Y(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function He(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}function Gt(t){return l.version.split(".")[0]>="19"?t.props.ref:t.ref}let Zt=Symbol();function ut(...t){let e=l.useRef(t);l.useEffect(()=>{e.current=t},[t]);let n=X(r=>{for(let i of e.current)i!=null&&(typeof i=="function"?i(r):i.current=r)});return t.every(r=>r==null||(r==null?void 0:r[Zt]))?void 0:n}function Yt(t=0){let[e,n]=l.useState(t),r=l.useCallback(u=>n(u),[e]),i=l.useCallback(u=>n(b=>b|u),[e]),s=l.useCallback(u=>(e&u)===u,[e]),a=l.useCallback(u=>n(b=>b&~u),[n]),v=l.useCallback(u=>n(b=>b^u),[n]);return{flags:e,setFlag:r,addFlag:i,hasFlag:s,removeFlag:a,toggleFlag:v}}var ot,dt;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ot=process==null?void 0:process.env)==null?void 0:ot.NODE_ENV)==="test"&&typeof((dt=Element==null?void 0:Element.prototype)==null?void 0:dt.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
5
|
-
`)),[]});var Jt=(t=>(t[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t))(Jt||{});function Qt(t){let e={};for(let n in t)t[n]===!0&&(e[`data-${n}`]="");return e}function Rt(t,e,n,r){let[i,s]=l.useState(n),{hasFlag:a,addFlag:v,removeFlag:u}=Yt(t&&i?3:0),b=l.useRef(!1),g=l.useRef(!1),x=rt();return z(()=>{var O;if(t){if(n&&s(!0),!e){n&&v(3);return}return(O=r==null?void 0:r.start)==null||O.call(r,n),en(e,{inFlight:b,prepare(){g.current?g.current=!1:g.current=b.current,b.current=!0,!g.current&&(n?(v(3),u(4)):(v(4),u(2)))},run(){g.current?n?(u(3),v(4)):(u(4),v(3)):n?u(1):v(1)},done(){var S;g.current&&typeof e.getAnimations=="function"&&e.getAnimations().length>0||(b.current=!1,u(7),n||s(!1),(S=r==null?void 0:r.end)==null||S.call(r,n))}})}},[t,n,e,x]),t?[i,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function en(t,{prepare:e,run:n,done:r,inFlight:i}){let s=ye();return nn(t,{prepare:e,inFlight:i}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(tn(t,r))})}),s.dispose}function tn(t,e){var n,r;let i=ye();if(!t)return i.dispose;let s=!1;i.add(()=>{s=!0});let a=(r=(n=t.getAnimations)==null?void 0:n.call(t).filter(v=>v instanceof CSSTransition))!=null?r:[];return a.length===0?(e(),i.dispose):(Promise.allSettled(a.map(v=>v.finished)).then(()=>{s||e()}),i.dispose)}function nn(t,{inFlight:e,prepare:n}){if(e!=null&&e.current){n();return}let r=t.style.transition;t.style.transition="none",n(),t.offsetHeight,t.style.transition=r}/*!
|
|
6
|
-
* tabbable 6.2.0
|
|
7
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
8
|
-
*/var ct=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ee=ct.join(","),ft=typeof Element>"u",J=ft?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Se=!ft&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},Te=function t(e,n){var r;n===void 0&&(n=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",a=s||n&&e&&t(e.parentNode);return a},rn=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},ht=function(e,n,r){if(Te(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Ee));return n&&J.call(e,Ee)&&i.unshift(e),i=i.filter(r),i},vt=function t(e,n,r){for(var i=[],s=Array.from(e);s.length;){var a=s.shift();if(!Te(a,!1))if(a.tagName==="SLOT"){var v=a.assignedElements(),u=v.length?v:a.children,b=t(u,!0,r);r.flatten?i.push.apply(i,b):i.push({scopeParent:a,candidates:b})}else{var g=J.call(a,Ee);g&&r.filter(a)&&(n||!e.includes(a))&&i.push(a);var x=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),O=!Te(x,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(x&&O){var S=t(x===!0?a.children:x.children,!0,r);r.flatten?i.push.apply(i,S):i.push({scopeParent:a,candidates:S})}else s.unshift.apply(s,a.children)}}return i},mt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Q=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||rn(e))&&!mt(e)?0:e.tabIndex},an=function(e,n){var r=Q(e);return r<0&&n&&!mt(e)?0:r},ln=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},pt=function(e){return e.tagName==="INPUT"},sn=function(e){return pt(e)&&e.type==="hidden"},un=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},on=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},dn=function(e){if(!e.name)return!0;var n=e.form||Se(e),r=function(v){return n.querySelectorAll('input[type="radio"][name="'+v+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var s=on(i,e.form);return!s||s===e},cn=function(e){return pt(e)&&e.type==="radio"},fn=function(e){return cn(e)&&!dn(e)},hn=function(e){var n,r=e&&Se(e),i=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==e){var a,v,u;for(s=!!((a=i)!==null&&a!==void 0&&(v=a.ownerDocument)!==null&&v!==void 0&&v.contains(i)||e!=null&&(u=e.ownerDocument)!==null&&u!==void 0&&u.contains(e));!s&&i;){var b,g,x;r=Se(i),i=(b=r)===null||b===void 0?void 0:b.host,s=!!((g=i)!==null&&g!==void 0&&(x=g.ownerDocument)!==null&&x!==void 0&&x.contains(i))}}return s},bt=function(e){var n=e.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},vn=function(e,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var s=J.call(e,"details>summary:first-of-type"),a=s?e.parentElement:e;if(J.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var v=e;e;){var u=e.parentElement,b=Se(e);if(u&&!u.shadowRoot&&i(u)===!0)return bt(e);e.assignedSlot?e=e.assignedSlot:!u&&b!==e.ownerDocument?e=b.host:e=u}e=v}if(hn(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bt(e);return!1},mn=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return J.call(n,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}n=n.parentElement}return!1},Ne=function(e,n){return!(n.disabled||Te(n)||sn(n)||vn(n,e)||un(n)||mn(n))},Ke=function(e,n){return!(fn(n)||Q(n)<0||!Ne(e,n))},pn=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},bn=function t(e){var n=[],r=[];return e.forEach(function(i,s){var a=!!i.scopeParent,v=a?i.scopeParent:i,u=an(v,a),b=a?t(i.candidates):v;u===0?a?n.push.apply(n,b):n.push(v):r.push({documentOrder:s,tabIndex:u,item:i,isScope:a,content:b})}),r.sort(ln).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(n)},gn=function(e,n){n=n||{};var r;return n.getShadowRoot?r=vt([e],n.includeContainer,{filter:Ke.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:pn}):r=ht(e,n.includeContainer,Ke.bind(null,n)),bn(r)},yn=function(e,n){n=n||{};var r;return n.getShadowRoot?r=vt([e],n.includeContainer,{filter:Ne.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=ht(e,n.includeContainer,Ne.bind(null,n)),r},ae=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return J.call(e,Ee)===!1?!1:Ke(n,e)},wn=ct.concat("iframe").join(","),_e=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return J.call(e,wn)===!1?!1:Ne(n,e)};let qe=l.createContext(null);qe.displayName="OpenClosedContext";var R=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(R||{});function gt(){return l.useContext(qe)}function xn({value:t,children:e}){return l.createElement(qe.Provider,{value:t},e)}function En(){let t=typeof document>"u";return"useSyncExternalStore"in ie?(e=>e.useSyncExternalStore)(ie)(()=>()=>{},()=>!1,()=>!t):!1}function yt(){let t=En(),[e,n]=ie.useState(ge.isHandoffComplete);return e&&ge.isHandoffComplete===!1&&n(!1),ie.useEffect(()=>{e!==!0&&n(!0)},[e]),ie.useEffect(()=>ge.handoff(),[]),t?!1:e}function Sn(){let t=l.useRef(!1);return z(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function wt(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||((e=t.as)!=null?e:Et)!==l.Fragment||l.Children.count(t.children)===1}let Oe=l.createContext(null);Oe.displayName="TransitionContext";var Tn=(t=>(t.Visible="visible",t.Hidden="hidden",t))(Tn||{});function Nn(){let t=l.useContext(Oe);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function On(){let t=l.useContext(Fe);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let Fe=l.createContext(null);Fe.displayName="NestingContext";function ke(t){return"children"in t?ke(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function xt(t,e){let n=at(t),r=l.useRef([]),i=Sn(),s=rt(),a=X((S,f=G.Hidden)=>{let y=r.current.findIndex(({el:c})=>c===S);y!==-1&&(we(f,{[G.Unmount](){r.current.splice(y,1)},[G.Hidden](){r.current[y].state="hidden"}}),s.microTask(()=>{var c;!ke(r)&&i.current&&((c=n.current)==null||c.call(n))}))}),v=X(S=>{let f=r.current.find(({el:y})=>y===S);return f?f.state!=="visible"&&(f.state="visible"):r.current.push({el:S,state:"visible"}),()=>a(S,G.Unmount)}),u=l.useRef([]),b=l.useRef(Promise.resolve()),g=l.useRef({enter:[],leave:[]}),x=X((S,f,y)=>{u.current.splice(0),e&&(e.chains.current[f]=e.chains.current[f].filter(([c])=>c!==S)),e==null||e.chains.current[f].push([S,new Promise(c=>{u.current.push(c)})]),e==null||e.chains.current[f].push([S,new Promise(c=>{Promise.all(g.current[f].map(([h,m])=>m)).then(()=>c())})]),f==="enter"?b.current=b.current.then(()=>e==null?void 0:e.wait.current).then(()=>y(f)):y(f)}),O=X((S,f,y)=>{Promise.all(g.current[f].splice(0).map(([c,h])=>h)).then(()=>{var c;(c=u.current.shift())==null||c()}).then(()=>y(f))});return l.useMemo(()=>({children:r,register:v,unregister:a,onStart:x,onStop:O,wait:b,chains:g}),[v,a,r,x,O,g,b])}let Et=l.Fragment,St=it.RenderStrategy;function Fn(t,e){var n,r;let{transition:i=!0,beforeEnter:s,afterEnter:a,beforeLeave:v,afterLeave:u,enter:b,enterFrom:g,enterTo:x,entered:O,leave:S,leaveFrom:f,leaveTo:y,...c}=t,[h,m]=l.useState(null),w=l.useRef(null),T=wt(t),p=ut(...T?[w,e,m]:e===null?[]:[e]),M=(n=c.unmount)==null||n?G.Unmount:G.Hidden,{show:L,appear:B,initial:H}=Nn(),[U,W]=l.useState(L?"visible":"hidden"),k=On(),{register:o,unregister:d}=k;z(()=>o(w),[o,w]),z(()=>{if(M===G.Hidden&&w.current){if(L&&U!=="visible"){W("visible");return}return we(U,{hidden:()=>d(w),visible:()=>o(w)})}},[U,w,o,d,L,M]);let E=yt();z(()=>{if(T&&E&&U==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,U,E,T]);let C=H&&!B,P=B&&L&&H,A=l.useRef(!1),F=xt(()=>{A.current||(W("hidden"),d(w))},k),j=X(ee=>{A.current=!0;let Z=ee?"enter":"leave";F.onStart(w,Z,fe=>{fe==="enter"?s==null||s():fe==="leave"&&(v==null||v())})}),D=X(ee=>{let Z=ee?"enter":"leave";A.current=!1,F.onStop(w,Z,fe=>{fe==="enter"?a==null||a():fe==="leave"&&(u==null||u())}),Z==="leave"&&!ke(F)&&(W("hidden"),d(w))});l.useEffect(()=>{T&&i||(j(L),D(L))},[L,T,i]);let V=!(!i||!T||!E||C),[,$]=Rt(V,h,L,{start:j,end:D}),q=Y({ref:p,className:((r=We(c.className,P&&b,P&&g,$.enter&&b,$.enter&&$.closed&&g,$.enter&&!$.closed&&x,$.leave&&S,$.leave&&!$.closed&&f,$.leave&&$.closed&&y,!$.transition&&L&&O))==null?void 0:r.trim())||void 0,...Qt($)}),K=0;U==="visible"&&(K|=R.Open),U==="hidden"&&(K|=R.Closed),$.enter&&(K|=R.Opening),$.leave&&(K|=R.Closing);let Ie=lt();return l.createElement(Fe.Provider,{value:F},l.createElement(xn,{value:K},Ie({ourProps:q,theirProps:c,defaultTag:Et,features:St,visible:U==="visible",name:"Transition.Child"})))}function kn(t,e){let{show:n,appear:r=!1,unmount:i=!0,...s}=t,a=l.useRef(null),v=wt(t),u=ut(...v?[a,e]:e===null?[]:[e]);yt();let b=gt();if(n===void 0&&b!==null&&(n=(b&R.Open)===R.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[g,x]=l.useState(n?"visible":"hidden"),O=xt(()=>{n||x("hidden")}),[S,f]=l.useState(!0),y=l.useRef([n]);z(()=>{S!==!1&&y.current[y.current.length-1]!==n&&(y.current.push(n),f(!1))},[y,n]);let c=l.useMemo(()=>({show:n,appear:r,initial:S}),[n,r,S]);z(()=>{n?x("visible"):!ke(O)&&a.current!==null&&x("hidden")},[n,O]);let h={unmount:i},m=X(()=>{var p;S&&f(!1),(p=t.beforeEnter)==null||p.call(t)}),w=X(()=>{var p;S&&f(!1),(p=t.beforeLeave)==null||p.call(t)}),T=lt();return l.createElement(Fe.Provider,{value:O},l.createElement(Oe.Provider,{value:c},T({ourProps:{...h,as:l.Fragment,children:l.createElement(Tt,{ref:u,...h,...s,beforeEnter:m,beforeLeave:w})},theirProps:{},defaultTag:l.Fragment,features:St,visible:g==="visible",name:"Transition"})))}function Cn(t,e){let n=l.useContext(Oe)!==null,r=gt()!==null;return l.createElement(l.Fragment,null,!n&&r?l.createElement(Xe,{ref:e,...t}):l.createElement(Tt,{ref:e,...t}))}let Xe=Be(kn),Tt=Be(Fn),Ce=Be(Cn),Pn=Object.assign(Xe,{Child:Ce,Root:Xe});function Nt({onClick:t}){return N.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:t,children:[N.jsx("span",{className:"sr-only",children:"Close"}),N.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:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}/*!
|
|
9
|
-
* focus-trap 7.6.4
|
|
10
|
-
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
11
|
-
*/function Ve(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function In(t){if(Array.isArray(t))return Ve(t)}function Mn(t,e,n){return(e=$n(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function An(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function jn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
12
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ft(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ot(Object(n),!0).forEach(function(r){Mn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ot(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ln(t){return In(t)||An(t)||Un(t)||jn()}function Dn(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $n(t){var e=Dn(t,"string");return typeof e=="symbol"?e:e+""}function Un(t,e){if(t){if(typeof t=="string")return Ve(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(t,e):void 0}}var kt={activateTrap:function(e,n){if(e.length>0){var r=e[e.length-1];r!==n&&r._setPausedState(!0)}var i=e.indexOf(n);i===-1||e.splice(i,1),e.push(n)},deactivateTrap:function(e,n){var r=e.indexOf(n);r!==-1&&e.splice(r,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)}},Wn=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Bn=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},de=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Hn=function(e){return de(e)&&!e.shiftKey},Kn=function(e){return de(e)&&e.shiftKey},Ct=function(e){return setTimeout(e,0)},ce=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof e=="function"?e.apply(void 0,r):e},Pe=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},_n=[],qn=function(e,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||_n,s=Ft({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Hn,isKeyBackward:Kn},n),a={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},v,u=function(o,d,E){return o&&o[d]!==void 0?o[d]:s[E||d]},b=function(o,d){var E=typeof(d==null?void 0:d.composedPath)=="function"?d.composedPath():void 0;return a.containerGroups.findIndex(function(C){var P=C.container,A=C.tabbableNodes;return P.contains(o)||(E==null?void 0:E.includes(P))||A.find(function(F){return F===o})})},g=function(o){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=d.hasFallback,C=E===void 0?!1:E,P=d.params,A=P===void 0?[]:P,F=s[o];if(typeof F=="function"&&(F=F.apply(void 0,Ln(A))),F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var j=F;if(typeof F=="string"){try{j=r.querySelector(F)}catch(D){throw new Error("`".concat(o,'` appears to be an invalid selector; error="').concat(D.message,'"'))}if(!j&&!C)throw new Error("`".concat(o,"` as selector refers to no known node"))}return j},x=function(){var o=g("initialFocus",{hasFallback:!0});if(o===!1)return!1;if(o===void 0||o&&!_e(o,s.tabbableOptions))if(b(r.activeElement)>=0)o=r.activeElement;else{var d=a.tabbableGroups[0],E=d&&d.firstTabbableNode;o=E||g("fallbackFocus")}else o===null&&(o=g("fallbackFocus"));if(!o)throw new Error("Your focus-trap needs to have at least one focusable element");return o},O=function(){if(a.containerGroups=a.containers.map(function(o){var d=gn(o,s.tabbableOptions),E=yn(o,s.tabbableOptions),C=d.length>0?d[0]:void 0,P=d.length>0?d[d.length-1]:void 0,A=E.find(function(D){return ae(D)}),F=E.slice().reverse().find(function(D){return ae(D)}),j=!!d.find(function(D){return Q(D)>0});return{container:o,tabbableNodes:d,focusableNodes:E,posTabIndexesFound:j,firstTabbableNode:C,lastTabbableNode:P,firstDomTabbableNode:A,lastDomTabbableNode:F,nextTabbableNode:function(V){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,q=d.indexOf(V);return q<0?$?E.slice(E.indexOf(V)+1).find(function(K){return ae(K)}):E.slice(0,E.indexOf(V)).reverse().find(function(K){return ae(K)}):d[q+($?1:-1)]}}}),a.tabbableGroups=a.containerGroups.filter(function(o){return o.tabbableNodes.length>0}),a.tabbableGroups.length<=0&&!g("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find(function(o){return o.posTabIndexesFound})&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},S=function(o){var d=o.activeElement;if(d)return d.shadowRoot&&d.shadowRoot.activeElement!==null?S(d.shadowRoot):d},f=function(o){if(o!==!1&&o!==S(document)){if(!o||!o.focus){f(x());return}o.focus({preventScroll:!!s.preventScroll}),a.mostRecentlyFocusedNode=o,Wn(o)&&o.select()}},y=function(o){var d=g("setReturnFocus",{params:[o]});return d||(d===!1?!1:o)},c=function(o){var d=o.target,E=o.event,C=o.isBackward,P=C===void 0?!1:C;d=d||Pe(E),O();var A=null;if(a.tabbableGroups.length>0){var F=b(d,E),j=F>=0?a.containerGroups[F]:void 0;if(F<0)P?A=a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:A=a.tabbableGroups[0].firstTabbableNode;else if(P){var D=a.tabbableGroups.findIndex(function(ee){var Z=ee.firstTabbableNode;return d===Z});if(D<0&&(j.container===d||_e(d,s.tabbableOptions)&&!ae(d,s.tabbableOptions)&&!j.nextTabbableNode(d,!1))&&(D=F),D>=0){var V=D===0?a.tabbableGroups.length-1:D-1,$=a.tabbableGroups[V];A=Q(d)>=0?$.lastTabbableNode:$.lastDomTabbableNode}else de(E)||(A=j.nextTabbableNode(d,!1))}else{var q=a.tabbableGroups.findIndex(function(ee){var Z=ee.lastTabbableNode;return d===Z});if(q<0&&(j.container===d||_e(d,s.tabbableOptions)&&!ae(d,s.tabbableOptions)&&!j.nextTabbableNode(d))&&(q=F),q>=0){var K=q===a.tabbableGroups.length-1?0:q+1,Ie=a.tabbableGroups[K];A=Q(d)>=0?Ie.firstTabbableNode:Ie.firstDomTabbableNode}else de(E)||(A=j.nextTabbableNode(d))}}else A=g("fallbackFocus");return A},h=function(o){var d=Pe(o);if(!(b(d,o)>=0)){if(ce(s.clickOutsideDeactivates,o)){v.deactivate({returnFocus:s.returnFocusOnDeactivate});return}ce(s.allowOutsideClick,o)||o.preventDefault()}},m=function(o){var d=Pe(o),E=b(d,o)>=0;if(E||d instanceof Document)E&&(a.mostRecentlyFocusedNode=d);else{o.stopImmediatePropagation();var C,P=!0;if(a.mostRecentlyFocusedNode)if(Q(a.mostRecentlyFocusedNode)>0){var A=b(a.mostRecentlyFocusedNode),F=a.containerGroups[A].tabbableNodes;if(F.length>0){var j=F.findIndex(function(D){return D===a.mostRecentlyFocusedNode});j>=0&&(s.isKeyForward(a.recentNavEvent)?j+1<F.length&&(C=F[j+1],P=!1):j-1>=0&&(C=F[j-1],P=!1))}}else a.containerGroups.some(function(D){return D.tabbableNodes.some(function(V){return Q(V)>0})})||(P=!1);else P=!1;P&&(C=c({target:a.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(a.recentNavEvent)})),f(C||a.mostRecentlyFocusedNode||x())}a.recentNavEvent=void 0},w=function(o){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;a.recentNavEvent=o;var E=c({event:o,isBackward:d});E&&(de(o)&&o.preventDefault(),f(E))},T=function(o){(s.isKeyForward(o)||s.isKeyBackward(o))&&w(o,s.isKeyBackward(o))},p=function(o){Bn(o)&&ce(s.escapeDeactivates,o)!==!1&&(o.preventDefault(),v.deactivate())},M=function(o){var d=Pe(o);b(d,o)>=0||ce(s.clickOutsideDeactivates,o)||ce(s.allowOutsideClick,o)||(o.preventDefault(),o.stopImmediatePropagation())},L=function(){if(a.active)return kt.activateTrap(i,v),a.delayInitialFocusTimer=s.delayInitialFocus?Ct(function(){f(x())}):f(x()),r.addEventListener("focusin",m,!0),r.addEventListener("mousedown",h,{capture:!0,passive:!1}),r.addEventListener("touchstart",h,{capture:!0,passive:!1}),r.addEventListener("click",M,{capture:!0,passive:!1}),r.addEventListener("keydown",T,{capture:!0,passive:!1}),r.addEventListener("keydown",p),v},B=function(){if(a.active)return r.removeEventListener("focusin",m,!0),r.removeEventListener("mousedown",h,!0),r.removeEventListener("touchstart",h,!0),r.removeEventListener("click",M,!0),r.removeEventListener("keydown",T,!0),r.removeEventListener("keydown",p),v},H=function(o){var d=o.some(function(E){var C=Array.from(E.removedNodes);return C.some(function(P){return P===a.mostRecentlyFocusedNode})});d&&f(x())},U=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(H):void 0,W=function(){U&&(U.disconnect(),a.active&&!a.paused&&a.containers.map(function(o){U.observe(o,{subtree:!0,childList:!0})}))};return v={get active(){return a.active},get paused(){return a.paused},activate:function(o){if(a.active)return this;var d=u(o,"onActivate"),E=u(o,"onPostActivate"),C=u(o,"checkCanFocusTrap");C||O(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=r.activeElement,d==null||d();var P=function(){C&&O(),L(),W(),E==null||E()};return C?(C(a.containers.concat()).then(P,P),this):(P(),this)},deactivate:function(o){if(!a.active)return this;var d=Ft({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},o);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,B(),a.active=!1,a.paused=!1,W(),kt.deactivateTrap(i,v);var E=u(d,"onDeactivate"),C=u(d,"onPostDeactivate"),P=u(d,"checkCanReturnFocus"),A=u(d,"returnFocus","returnFocusOnDeactivate");E==null||E();var F=function(){Ct(function(){A&&f(y(a.nodeFocusedBeforeActivation)),C==null||C()})};return A&&P?(P(y(a.nodeFocusedBeforeActivation)).then(F,F),this):(F(),this)},pause:function(o){return a.active?(a.manuallyPaused=!0,this._setPausedState(!0,o)):this},unpause:function(o){return a.active?(a.manuallyPaused=!1,i[i.length-1]!==this?this:this._setPausedState(!1,o)):this},updateContainerElements:function(o){var d=[].concat(o).filter(Boolean);return a.containers=d.map(function(E){return typeof E=="string"?r.querySelector(E):E}),a.active&&O(),W(),this}},Object.defineProperties(v,{_isManuallyPaused:{value:function(){return a.manuallyPaused}},_setPausedState:{value:function(o,d){if(a.paused===o)return this;if(a.paused=o,o){var E=u(d,"onPause"),C=u(d,"onPostPause");E==null||E(),B(),W(),C==null||C()}else{var P=u(d,"onUnpause"),A=u(d,"onPostUnpause");P==null||P(),O(),L(),W(),A==null||A()}return this}}}),v.updateContainerElements(e),v};function Pt(t,e,n){let r=null;return t&&(r=qn(t,{clickOutsideDeactivates:!e,escapeDeactivates:!e,onDeactivate:()=>n==null?void 0:n(),fallbackFocus:()=>t}),r.activate()),{deactivate:()=>{r==null||r.deactivate(),r=null},wrapper:t}}const Xn=({modalContext:t,config:e,children:n})=>{const[r,i]=l.useState(!1),s=l.useRef(null),[a,v]=l.useState(null);function u(){v(Pt(s.current,e==null?void 0:e.closeExplicitly,()=>t.close())),i(!0)}return l.useEffect(()=>()=>a==null?void 0:a.deactivate(),[a]),N.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:N.jsx("div",{className:be("im-modal-positioner flex min-h-full justify-center",{"items-start":e.position==="top","items-center":e.position==="center","items-end":e.position==="bottom"}),children:N.jsx(Ce,{as:"div",ref:s,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:u,afterLeave:t.afterLeave,className:be("im-modal-wrapper w-full transition duration-300 ease-in-out",t.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":e.maxWidth==="sm","sm:max-w-md":e.maxWidth==="md","sm:max-w-md md:max-w-lg":e.maxWidth==="lg","sm:max-w-md md:max-w-xl":e.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":e.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":e.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":e.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":e.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":e.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":e.maxWidth==="7xl"}),children:N.jsxs("div",{className:`im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,"data-inertiaui-modal-entered":r,children:[e.closeButton&&N.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:N.jsx(Nt,{onClick:t.close})}),typeof n=="function"?n({modalContext:t,config:e}):n]})})})})},Vn=({modalContext:t,config:e,children:n})=>{const[r,i]=l.useState(!1),s=l.useRef(null),[a,v]=l.useState(null);function u(){v(Pt(s.current,e==null?void 0:e.closeExplicitly,()=>t.close())),i(!0)}return l.useEffect(()=>()=>a==null?void 0:a.deactivate(),[a]),N.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:N.jsx("div",{className:be("im-slideover-positioner flex min-h-full items-center",{"justify-start rtl:justify-end":(e==null?void 0:e.position)==="left","justify-end rtl:justify-start":(e==null?void 0:e.position)==="right"}),children:N.jsx(Ce,{as:"div",ref:s,enterFrom:`opacity-0 ${e.position==="left"?"-translate-x-full":"translate-x-full"}`,enterTo:"opacity-100 translate-x-0",leaveFrom:"opacity-100 translate-x-0",leaveTo:`opacity-0 ${e.position==="left"?"-translate-x-full":"translate-x-full"}`,afterEnter:u,afterLeave:t.afterLeave,className:be("im-slideover-wrapper w-full transition duration-300 ease-in-out",t.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":e.maxWidth==="sm","sm:max-w-md":e.maxWidth==="md","sm:max-w-md md:max-w-lg":e.maxWidth==="lg","sm:max-w-md md:max-w-xl":e.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":e.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":e.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":e.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":e.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":e.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":e.maxWidth==="7xl"}),children:N.jsxs("div",{className:`im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,"data-inertiaui-modal-entered":r,children:[e.closeButton&&N.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:N.jsx(Nt,{onClick:t.close})}),typeof n=="function"?n({modalContext:t,config:e}):n]})})})})},It=l.forwardRef(({name:t,children:e,onFocus:n=null,onBlur:r=null,onClose:i=null,onSuccess:s=null,onAfterLeave:a=null,...v},u)=>{const b=x=>typeof e=="function"?e(x):e,g=l.useRef(null);return l.useEffect(()=>{var x;if(((x=g==null?void 0:g.current)==null?void 0:x.index)===0)return ze.prepare(),()=>ze.cleanup()},[g]),l.useImperativeHandle(u,()=>g.current,[g]),N.jsx($e,{ref:g,name:t,onFocus:n,onBlur:r,onClose:i,onSuccess:s,...v,children:({afterLeave:x,close:O,config:S,emit:f,getChildModal:y,getParentModal:c,id:h,index:m,isOpen:w,modalContext:T,onTopOfStack:p,reload:M,setOpen:L,shouldRender:B})=>N.jsx(Pn,{appear:!0,show:w??!1,afterLeave:a,children:N.jsxs("div",{className:"im-dialog relative z-20","data-inertiaui-modal-id":h,"data-inertiaui-modal-index":m,children:[m===0?N.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?N.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):N.jsx("div",{})}):null,m>0&&p?N.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,S.slideover?N.jsx(Vn,{modalContext:T,config:S,children:b({afterLeave:x,close:O,config:S,emit:f,getChildModal:y,getParentModal:c,id:h,index:m,isOpen:w,modalContext:T,onTopOfStack:p,reload:M,setOpen:L,shouldRender:B})}):N.jsx(Xn,{modalContext:T,config:S,children:b({afterLeave:x,close:O,config:S,emit:f,getChildModal:y,getParentModal:c,id:h,index:m,isOpen:w,modalContext:T,onTopOfStack:p,reload:M,setOpen:L,shouldRender:B})})]})})})});It.displayName="Modal";const zn=({href:t,method:e="get",data:n={},as:r="a",headers:i={},queryStringArrayFormat:s="brackets",onAfterLeave:a=null,onBlur:v=null,onClose:u=null,onError:b=null,onFocus:g=null,onStart:x=null,onSuccess:O=null,navigate:S=null,children:f,...y})=>{const[c,h]=l.useState(!1),[m,w]=l.useState(null),{stack:T,visit:p}=oe(),M=l.useMemo(()=>S??me("navigate"),[S]),L={},B={};Object.keys(y).forEach(d=>{Qe.includes(d)||(d.startsWith("on")&&typeof y[d]=="function"?d.toLowerCase()in window?L[d]=y[d]:B[d]=y[d]:L[d]=y[d])});const[H,U]=l.useState(!1);l.useEffect(()=>{m&&(m.onTopOfStack&&H?g==null||g():!m.onTopOfStack&&!H&&(v==null||v()),U(!m.onTopOfStack))},[T]);const W=l.useCallback(()=>{u==null||u()},[u]),k=l.useCallback(()=>{w(null),a==null||a()},[a]),o=l.useCallback(d=>{d==null||d.preventDefault(),!c&&(t.startsWith("#")||(h(!0),x==null||x()),p(t,e,n,i,Ut(Ge(y,Qe)),()=>W(T.length),k,s,M).then(E=>{w(E),E.registerEventListenersFromProps(B),O==null||O()}).catch(E=>{console.error(E),b==null||b(E)}).finally(()=>h(!1)))},[t,e,n,i,s,y,W,k]);return N.jsx(r,{...L,href:t,onClick:o,children:typeof f=="function"?f({loading:c}):f})};function Gn(){return oe().stack[De()]??null}const Zn=t=>e=>(e.default.layout=n=>l.createElement(t,{},n),e);I.HeadlessModal=$e,I.Modal=It,I.ModalLink=zn,I.ModalRoot=et,I.ModalStackProvider=Je,I.getConfig=me,I.initFromPageProps=Re,I.putConfig=Dt,I.renderApp=Bt,I.resetConfig=Lt,I.setPageLayout=Zn,I.useModal=Gn,I.useModalIndex=De,I.useModalStack=oe,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
`))}else{let b=m.props,E=b==null?void 0:b.className,f=typeof E=="function"?(...p)=>Je(E(...p),o.className):Je(E,o.className),g=f?{className:f}:{},d=Et(m.props,R(Qe(o,["ref"])));for(let p in x)p in d&&delete x[p];return i.cloneElement(m,Object.assign({},d,x,c,{ref:l(En(m),c.ref)},g))}return i.createElement(s,Object.assign({},Qe(o,["ref"]),s!==i.Fragment&&c,s!==i.Fragment&&x),m)}function gn(){let e=i.useRef([]),t=i.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function wn(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function Et(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let l in r)l.startsWith("on")&&typeof r[l]=="function"?(n[l]!=null||(n[l]=[]),n[l].push(r[l])):t[l]=r[l];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[l=>{var s;return(s=l==null?void 0:l.preventDefault)==null?void 0:s.call(l)}]);for(let r in n)Object.assign(t,{[r](l,...s){let u=n[r];for(let a of u){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;a(l,...s)}}});return t}function L(e){var t;return Object.assign(i.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function R(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Qe(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function En(e){return i.version.split(".")[0]>="19"?e.props.ref:e.ref}let xn="span";var Fe=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Fe||{});function yn(e,t){var n;let{features:r=1,...l}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=l["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return D()({ourProps:s,theirProps:l,slot:{},defaultTag:xn,name:"Hidden"})}let Re=L(yn),xt=Symbol();function bn(e,t=!0){return Object.assign(e,{[xt]:t})}function q(...e){let t=i.useRef(e);i.useEffect(()=>{t.current=e},[e]);let n=O(r=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(r):l.current=r)});return e.every(r=>r==null||(r==null?void 0:r[xt]))?void 0:n}let et=i.createContext(null);et.displayName="DescriptionContext";function yt(){let e=i.useContext(et);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,yt),t}return e}function $n(){let[e,t]=i.useState([]);return[e.length>0?e.join(" "):void 0,i.useMemo(()=>function(n){let r=O(s=>(t(u=>[...u,s]),()=>t(u=>{let a=u.slice(),o=a.indexOf(s);return o!==-1&&a.splice(o,1),a}))),l=i.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props,value:n.value}),[r,n.slot,n.name,n.props,n.value]);return i.createElement(et.Provider,{value:l},n.children)},[t])]}let Mn="p";function Cn(e,t){let n=i.useId(),r=hn(),{id:l=`headlessui-description-${n}`,...s}=e,u=yt(),a=q(t);k(()=>u.register(l),[l,u.register]);let o=r||!1,c=i.useMemo(()=>({...u.slot,disabled:o}),[u.slot,o]),m={ref:a,...u.props,id:l};return D()({ourProps:m,theirProps:s,slot:c,defaultTag:Mn,name:u.name||"Description"})}let Sn=L(Cn),On=Object.assign(Sn,{});var bt=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(bt||{});let Tn=i.createContext(()=>{});function Pn({value:e,children:t}){return i.createElement(Tn.Provider,{value:e},t)}let Fn=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};function $t(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(l){return r.add(l),()=>r.delete(l)},dispatch(l,...s){let u=t[l].call(n,...s);u&&(n=u,r.forEach(a=>a()))}}}function Mt(e){return i.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let kn=new Fn(()=>$t(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let n=this.slice();return n.splice(t,1),n}}));function ie(e,t){let n=kn.get(t),r=i.useId(),l=Mt(n);if(k(()=>{if(e)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,e]),!e)return!1;let s=l.indexOf(r),u=l.length;return s===-1&&(s=u,u+=1),s===u-1}let tt=new Map,fe=new Map;function Ct(e){var t;let n=(t=fe.get(e))!=null?t:0;return fe.set(e,n+1),n!==0?()=>St(e):(tt.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>St(e))}function St(e){var t;let n=(t=fe.get(e))!=null?t:1;if(n===1?fe.delete(e):fe.set(e,n-1),n!==1)return;let r=tt.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,tt.delete(e))}function Ln(e,{allowed:t,disallowed:n}={}){let r=ie(e,"inert-others");k(()=>{var l,s;if(!r)return;let u=z();for(let o of(l=n==null?void 0:n())!=null?l:[])o&&u.add(Ct(o));let a=(s=t==null?void 0:t())!=null?s:[];for(let o of a){if(!o)continue;let c=Se(o);if(!c)continue;let m=o.parentElement;for(;m&&m!==c.body;){for(let x of m.children)a.some(b=>x.contains(b))||u.add(Ct(x));m=m.parentElement}}return u.dispose},[r,t,n])}function Nn(e,t,n){let r=Q(l=>{let s=l.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});i.useEffect(()=>{if(!e)return;let l=t===null?null:t instanceof HTMLElement?t:t.current;if(!l)return;let s=z();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>r.current(l));u.observe(l),s.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>r.current(l));u.observe(l),s.add(()=>u.disconnect())}return()=>s.dispose()},[t,r,e])}let ke=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),In=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var V=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(V||{}),nt=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(nt||{}),An=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(An||{});function Dn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ke)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function jn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(In)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ot=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ot||{});function Hn(e,t=0){var n;return e===((n=Se(e))==null?void 0:n.body)?!1:G(t,{0(){return e.matches(ke)},1(){let r=e;for(;r!==null;){if(r.matches(ke))return!0;r=r.parentElement}return!1}})}var Un=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Un||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Y(e){e==null||e.focus({preventScroll:!0})}let Wn=["textarea","input"].join(",");function _n(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Wn))!=null?n:!1}function Bn(e,t=n=>n){return e.slice().sort((n,r)=>{let l=t(n),s=t(r);if(l===null||s===null)return 0;let u=l.compareDocumentPosition(s);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function me(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:l=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,u=Array.isArray(e)?n?Bn(e):e:t&64?jn(e):Dn(e);l.length>0&&u.length>1&&(u=u.filter(E=>!l.some(f=>f!=null&&"current"in f?(f==null?void 0:f.current)===E:f===E))),r=r??s.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),o=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,u.indexOf(r))-1;if(t&4)return Math.max(0,u.indexOf(r))+1;if(t&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},m=0,x=u.length,b;do{if(m>=x||m+x<=0)return 0;let E=o+m;if(t&16)E=(E+x)%x;else{if(E<0)return 3;if(E>=x)return 1}b=u[E],b==null||b.focus(c),m+=a}while(b!==s.activeElement);return t&6&&_n(b)&&b.select(),2}function Tt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function qn(){return/Android/gi.test(window.navigator.userAgent)}function Xn(){return Tt()||qn()}function pe(e,t,n,r){let l=Q(n);i.useEffect(()=>{if(!e)return;function s(u){l.current(u)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function Pt(e,t,n,r){let l=Q(n);i.useEffect(()=>{if(!e)return;function s(u){l.current(u)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Ft=30;function Vn(e,t,n){let r=ie(e,"outside-click"),l=Q(n),s=i.useCallback(function(o,c){if(o.defaultPrevented)return;let m=c(o);if(m===null||!m.getRootNode().contains(m)||!m.isConnected)return;let x=function b(E){return typeof E=="function"?b(E()):Array.isArray(E)||E instanceof Set?E:[E]}(t);for(let b of x)if(b!==null&&(b.contains(m)||o.composed&&o.composedPath().includes(b)))return;return!Hn(m,Ot.Loose)&&m.tabIndex!==-1&&o.preventDefault(),l.current(o,m)},[l,t]),u=i.useRef(null);pe(r,"pointerdown",o=>{var c,m;u.current=((m=(c=o.composedPath)==null?void 0:c.call(o))==null?void 0:m[0])||o.target},!0),pe(r,"mousedown",o=>{var c,m;u.current=((m=(c=o.composedPath)==null?void 0:c.call(o))==null?void 0:m[0])||o.target},!0),pe(r,"click",o=>{Xn()||u.current&&(s(o,()=>u.current),u.current=null)},!0);let a=i.useRef({x:0,y:0});pe(r,"touchstart",o=>{a.current.x=o.touches[0].clientX,a.current.y=o.touches[0].clientY},!0),pe(r,"touchend",o=>{let c={x:o.changedTouches[0].clientX,y:o.changedTouches[0].clientY};if(!(Math.abs(c.x-a.current.x)>=Ft||Math.abs(c.y-a.current.y)>=Ft))return s(o,()=>o.target instanceof HTMLElement?o.target:null)},!0),Pt(r,"blur",o=>s(o,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function he(...e){return i.useMemo(()=>Se(...e),[...e])}function kt(e,t,n,r){let l=Q(n);i.useEffect(()=>{e=e??window;function s(u){l.current(u)}return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)},[e,t,r])}function Yn(){let e;return{before({doc:t}){var n;let r=t.documentElement,l=(n=t.defaultView)!=null?n:window;e=Math.max(0,l.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,l=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-l);n.style(r,"paddingRight",`${s}px`)}}}function zn(){return Tt()?{before({doc:e,d:t,meta:n}){function r(l){return n.containers.flatMap(s=>s()).some(s=>s.contains(l))}t.microTask(()=>{var l;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=z();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let s=(l=window.scrollY)!=null?l:window.pageYOffset,u=null;t.addEventListener(e,"click",a=>{if(a.target instanceof HTMLElement)try{let o=a.target.closest("a");if(!o)return;let{hash:c}=new URL(o.href),m=e.querySelector(c);m&&!r(m)&&(u=m)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(a.target instanceof HTMLElement)if(r(a.target)){let o=a.target;for(;o.parentElement&&r(o.parentElement);)o=o.parentElement;t.style(o,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(a.target instanceof HTMLElement){if(a.target.tagName==="INPUT")return;if(r(a.target)){let o=a.target;for(;o.parentElement&&o.dataset.headlessuiPortal!==""&&!(o.scrollHeight>o.clientHeight||o.scrollWidth>o.clientWidth);)o=o.parentElement;o.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let o=(a=window.scrollY)!=null?a:window.pageYOffset;s!==o&&window.scrollTo(0,s),u&&u.isConnected&&(u.scrollIntoView({block:"nearest"}),u=null)})})}}:{}}function Gn(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Kn(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let ee=$t(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:z(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:Kn(n)},l=[zn(),Yn(),Gn()];l.forEach(({before:s})=>s==null?void 0:s(r)),l.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});ee.subscribe(()=>{let e=ee.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",l=n.count!==0;(l&&!r||!l&&r)&&ee.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ee.dispatch("TEARDOWN",n)}});function Zn(e,t,n=()=>({containers:[]})){let r=Mt(ee),l=t?r.get(t):void 0,s=l?l.count>0:!1;return k(()=>{if(!(!t||!e))return ee.dispatch("PUSH",t,n),()=>ee.dispatch("POP",t,n)},[e,t]),s}function Jn(e,t,n=()=>[document.body]){let r=ie(e,"scroll-lock");Zn(r,t,l=>{var s;return{containers:[...(s=l.containers)!=null?s:[],n]}})}function Qn(e=0){let[t,n]=i.useState(e),r=i.useCallback(o=>n(o),[t]),l=i.useCallback(o=>n(c=>c|o),[t]),s=i.useCallback(o=>(t&o)===o,[t]),u=i.useCallback(o=>n(c=>c&~o),[n]),a=i.useCallback(o=>n(c=>c^o),[n]);return{flags:t,setFlag:r,addFlag:l,hasFlag:s,removeFlag:u,toggleFlag:a}}var Lt,Nt;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Lt=process==null?void 0:process.env)==null?void 0:Lt.NODE_ENV)==="test"&&typeof((Nt=Element==null?void 0:Element.prototype)==null?void 0:Nt.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
5
|
+
`)),[]});var Rn=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Rn||{});function er(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function tr(e,t,n,r){let[l,s]=i.useState(n),{hasFlag:u,addFlag:a,removeFlag:o}=Qn(e&&l?3:0),c=i.useRef(!1),m=i.useRef(!1),x=Ze();return k(()=>{var b;if(e){if(n&&s(!0),!t){n&&a(3);return}return(b=r==null?void 0:r.start)==null||b.call(r,n),nr(t,{inFlight:c,prepare(){m.current?m.current=!1:m.current=c.current,c.current=!0,!m.current&&(n?(a(3),o(4)):(a(4),o(2)))},run(){m.current?n?(o(3),a(4)):(o(4),a(3)):n?o(1):a(1)},done(){var E;m.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,o(7),n||s(!1),(E=r==null?void 0:r.end)==null||E.call(r,n))}})}},[e,n,t,x]),e?[l,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function nr(e,{prepare:t,run:n,done:r,inFlight:l}){let s=z();return lr(e,{prepare:t,inFlight:l}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(rr(e,r))})}),s.dispose}function rr(e,t){var n,r;let l=z();if(!e)return l.dispose;let s=!1;l.add(()=>{s=!0});let u=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return u.length===0?(t(),l.dispose):(Promise.allSettled(u.map(a=>a.finished)).then(()=>{s||t()}),l.dispose)}function lr(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function rt(e,t){let n=i.useRef([]),r=O(e);i.useEffect(()=>{let l=[...n.current];for(let[s,u]of t.entries())if(n.current[s]!==u){let a=r(t,l);return n.current=t,a}},[r,...t])}let Le=i.createContext(null);Le.displayName="OpenClosedContext";var j=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(j||{});function Ne(){return i.useContext(Le)}function ir({value:e,children:t}){return i.createElement(Le.Provider,{value:e},t)}function or({children:e}){return i.createElement(Le.Provider,{value:null},e)}function sr(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Z=[];sr(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||Z[0]===t.target)return;let n=t.target;n=n.closest(ke),Z.unshift(n??t.target),Z=Z.filter(r=>r!=null&&r.isConnected),Z.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function It(e){let t=O(e),n=i.useRef(!1);i.useEffect(()=>(n.current=!1,()=>{n.current=!0,Oe(()=>{n.current&&t()})}),[t])}function ur(){let e=typeof document>"u";return"useSyncExternalStore"in se?(t=>t.useSyncExternalStore)(se)(()=>()=>{},()=>!1,()=>!e):!1}function ve(){let e=ur(),[t,n]=se.useState(J.isHandoffComplete);return t&&J.isHandoffComplete===!1&&n(!1),se.useEffect(()=>{t!==!0&&n(!0)},[t]),se.useEffect(()=>J.handoff(),[]),e?!1:t}let At=i.createContext(!1);function ar(){return i.useContext(At)}function Dt(e){return i.createElement(At.Provider,{value:e.force},e.children)}function dr(e){let t=ar(),n=i.useContext(Ht),r=he(e),[l,s]=i.useState(()=>{var u;if(!t&&n!==null)return(u=n.current)!=null?u:null;if(J.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let o=r.createElement("div");return o.setAttribute("id","headlessui-portal-root"),r.body.appendChild(o)});return i.useEffect(()=>{l!==null&&(r!=null&&r.body.contains(l)||r==null||r.body.appendChild(l))},[l,r]),i.useEffect(()=>{t||n!==null&&s(n.current)},[n,s,t]),l}let jt=i.Fragment,cr=L(function(e,t){let n=e,r=i.useRef(null),l=q(bn(x=>{r.current=x}),t),s=he(r),u=dr(r),[a]=i.useState(()=>{var x;return J.isServer?null:(x=s==null?void 0:s.createElement("div"))!=null?x:null}),o=i.useContext(lt),c=ve();k(()=>{!u||!a||u.contains(a)||(a.setAttribute("data-headlessui-portal",""),u.appendChild(a))},[u,a]),k(()=>{if(a&&o)return o.register(a)},[o,a]),It(()=>{var x;!u||!a||(a instanceof Node&&u.contains(a)&&u.removeChild(a),u.childNodes.length<=0&&((x=u.parentElement)==null||x.removeChild(u)))});let m=D();return c?!u||!a?null:tn.createPortal(m({ourProps:{ref:l},theirProps:n,slot:{},defaultTag:jt,name:"Portal"}),a):null});function fr(e,t){let n=q(t),{enabled:r=!0,...l}=e,s=D();return r?i.createElement(cr,{...l,ref:n}):s({ourProps:{ref:n},theirProps:l,slot:{},defaultTag:jt,name:"Portal"})}let mr=i.Fragment,Ht=i.createContext(null);function pr(e,t){let{target:n,...r}=e,l={ref:q(t)},s=D();return i.createElement(Ht.Provider,{value:n},s({ourProps:l,theirProps:r,defaultTag:mr,name:"Popover.Group"}))}let lt=i.createContext(null);function hr(){let e=i.useContext(lt),t=i.useRef([]),n=O(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=O(s=>{let u=t.current.indexOf(s);u!==-1&&t.current.splice(u,1),e&&e.unregister(s)}),l=i.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,i.useMemo(()=>function({children:s}){return i.createElement(lt.Provider,{value:l},s)},[l])]}let vr=L(fr),Ut=L(pr),gr=Object.assign(vr,{Group:Ut});function wr(e,t=typeof document<"u"?document.defaultView:null,n){let r=ie(e,"escape");kt(t,"keydown",l=>{r&&(l.defaultPrevented||l.key===bt.Escape&&n(l))})}function Er(){var e;let[t]=i.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,r]=i.useState((e=t==null?void 0:t.matches)!=null?e:!1);return k(()=>{if(!t)return;function l(s){r(s.matches)}return t.addEventListener("change",l),()=>t.removeEventListener("change",l)},[t]),n}function xr({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=he(n),l=O(()=>{var s,u;let a=[];for(let o of e)o!==null&&(o instanceof HTMLElement?a.push(o):"current"in o&&o.current instanceof HTMLElement&&a.push(o.current));if(t!=null&&t.current)for(let o of t.current)a.push(o);for(let o of(s=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?s:[])o!==document.body&&o!==document.head&&o instanceof HTMLElement&&o.id!=="headlessui-portal-root"&&(n&&(o.contains(n)||o.contains((u=n==null?void 0:n.getRootNode())==null?void 0:u.host))||a.some(c=>o.contains(c))||a.push(o));return a});return{resolveContainers:l,contains:O(s=>l().some(u=>u.contains(s)))}}let Wt=i.createContext(null);function _t({children:e,node:t}){let[n,r]=i.useState(null),l=Bt(t??n);return i.createElement(Wt.Provider,{value:l},e,l===null&&i.createElement(Re,{features:Fe.Hidden,ref:s=>{var u,a;if(s){for(let o of(a=(u=Se(s))==null?void 0:u.querySelectorAll("html > *, body > *"))!=null?a:[])if(o!==document.body&&o!==document.head&&o instanceof HTMLElement&&o!=null&&o.contains(s)){r(o);break}}}}))}function Bt(e=null){var t;return(t=i.useContext(Wt))!=null?t:e}function it(){let e=i.useRef(!1);return k(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ge=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ge||{});function yr(){let e=i.useRef(0);return Pt(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function qt(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}let br="div";var te=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(te||{});function $r(e,t){let n=i.useRef(null),r=q(n,t),{initialFocus:l,initialFocusFallback:s,containers:u,features:a=15,...o}=e;ve()||(a=0);let c=he(n);Or(a,{ownerDocument:c});let m=Tr(a,{ownerDocument:c,container:n,initialFocus:l,initialFocusFallback:s});Pr(a,{ownerDocument:c,container:n,containers:u,previousActiveElement:m});let x=yr(),b=O(h=>{let w=n.current;w&&(y=>y())(()=>{G(x.current,{[ge.Forwards]:()=>{me(w,V.First,{skipElements:[h.relatedTarget,s]})},[ge.Backwards]:()=>{me(w,V.Last,{skipElements:[h.relatedTarget,s]})}})})}),E=ie(!!(a&2),"focus-trap#tab-lock"),f=Ze(),g=i.useRef(!1),d={ref:r,onKeyDown(h){h.key=="Tab"&&(g.current=!0,f.requestAnimationFrame(()=>{g.current=!1}))},onBlur(h){if(!(a&4))return;let w=qt(u);n.current instanceof HTMLElement&&w.add(n.current);let y=h.relatedTarget;y instanceof HTMLElement&&y.dataset.headlessuiFocusGuard!=="true"&&(Xt(w,y)||(g.current?me(n.current,G(x.current,{[ge.Forwards]:()=>V.Next,[ge.Backwards]:()=>V.Previous})|V.WrapAround,{relativeTo:h.target}):h.target instanceof HTMLElement&&Y(h.target)))}},p=D();return i.createElement(i.Fragment,null,E&&i.createElement(Re,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:b,features:Fe.Focusable}),p({ourProps:d,theirProps:o,defaultTag:br,name:"FocusTrap"}),E&&i.createElement(Re,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:b,features:Fe.Focusable}))}let Mr=L($r),Cr=Object.assign(Mr,{features:te});function Sr(e=!0){let t=i.useRef(Z.slice());return rt(([n],[r])=>{r===!0&&n===!1&&Oe(()=>{t.current.splice(0)}),r===!1&&n===!0&&(t.current=Z.slice())},[e,Z,t]),O(()=>{var n;return(n=t.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function Or(e,{ownerDocument:t}){let n=!!(e&8),r=Sr(n);rt(()=>{n||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&Y(r())},[n]),It(()=>{n&&Y(r())})}function Tr(e,{ownerDocument:t,container:n,initialFocus:r,initialFocusFallback:l}){let s=i.useRef(null),u=ie(!!(e&1),"focus-trap#initial-focus"),a=it();return rt(()=>{if(e===0)return;if(!u){l!=null&&l.current&&Y(l.current);return}let o=n.current;o&&Oe(()=>{if(!a.current)return;let c=t==null?void 0:t.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===c){s.current=c;return}}else if(o.contains(c)){s.current=c;return}if(r!=null&&r.current)Y(r.current);else{if(e&16){if(me(o,V.First|V.AutoFocus)!==nt.Error)return}else if(me(o,V.First)!==nt.Error)return;if(l!=null&&l.current&&(Y(l.current),(t==null?void 0:t.activeElement)===l.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}s.current=t==null?void 0:t.activeElement})},[l,u,e]),s}function Pr(e,{ownerDocument:t,container:n,containers:r,previousActiveElement:l}){let s=it(),u=!!(e&4);kt(t==null?void 0:t.defaultView,"focus",a=>{if(!u||!s.current)return;let o=qt(r);n.current instanceof HTMLElement&&o.add(n.current);let c=l.current;if(!c)return;let m=a.target;m&&m instanceof HTMLElement?Xt(o,m)?(l.current=m,Y(m)):(a.preventDefault(),a.stopPropagation(),Y(c)):Y(l.current)},!0)}function Xt(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function Vt(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:zt)!==i.Fragment||i.Children.count(e.children)===1}let Ie=i.createContext(null);Ie.displayName="TransitionContext";var Fr=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Fr||{});function kr(){let e=i.useContext(Ie);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Lr(){let e=i.useContext(Ae);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ae=i.createContext(null);Ae.displayName="NestingContext";function De(e){return"children"in e?De(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Yt(e,t){let n=Q(e),r=i.useRef([]),l=it(),s=Ze(),u=O((E,f=K.Hidden)=>{let g=r.current.findIndex(({el:d})=>d===E);g!==-1&&(G(f,{[K.Unmount](){r.current.splice(g,1)},[K.Hidden](){r.current[g].state="hidden"}}),s.microTask(()=>{var d;!De(r)&&l.current&&((d=n.current)==null||d.call(n))}))}),a=O(E=>{let f=r.current.find(({el:g})=>g===E);return f?f.state!=="visible"&&(f.state="visible"):r.current.push({el:E,state:"visible"}),()=>u(E,K.Unmount)}),o=i.useRef([]),c=i.useRef(Promise.resolve()),m=i.useRef({enter:[],leave:[]}),x=O((E,f,g)=>{o.current.splice(0),t&&(t.chains.current[f]=t.chains.current[f].filter(([d])=>d!==E)),t==null||t.chains.current[f].push([E,new Promise(d=>{o.current.push(d)})]),t==null||t.chains.current[f].push([E,new Promise(d=>{Promise.all(m.current[f].map(([p,h])=>h)).then(()=>d())})]),f==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(f)):g(f)}),b=O((E,f,g)=>{Promise.all(m.current[f].splice(0).map(([d,p])=>p)).then(()=>{var d;(d=o.current.shift())==null||d()}).then(()=>g(f))});return i.useMemo(()=>({children:r,register:a,unregister:u,onStart:x,onStop:b,wait:c,chains:m}),[a,u,r,x,b,m,c])}let zt=i.Fragment,Gt=Te.RenderStrategy;function Nr(e,t){var n,r;let{transition:l=!0,beforeEnter:s,afterEnter:u,beforeLeave:a,afterLeave:o,enter:c,enterFrom:m,enterTo:x,entered:b,leave:E,leaveFrom:f,leaveTo:g,...d}=e,[p,h]=i.useState(null),w=i.useRef(null),y=Vt(e),v=q(...y?[w,t,h]:t===null?[]:[t]),M=(n=d.unmount)==null||n?K.Unmount:K.Hidden,{show:T,appear:I,initial:H}=kr(),[F,A]=i.useState(T?"visible":"hidden"),U=Lr(),{register:W,unregister:S}=U;k(()=>W(w),[W,w]),k(()=>{if(M===K.Hidden&&w.current){if(T&&F!=="visible"){A("visible");return}return G(F,{hidden:()=>S(w),visible:()=>W(w)})}},[F,w,W,S,T,M]);let _=ve();k(()=>{if(y&&_&&F==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,F,_,y]);let He=H&&!I,Ue=I&&T&&H,we=i.useRef(!1),X=Yt(()=>{we.current||(A("hidden"),S(w))},U),We=O(at=>{we.current=!0;let Be=at?"enter":"leave";X.onStart(w,Be,xe=>{xe==="enter"?s==null||s():xe==="leave"&&(a==null||a())})}),P=O(at=>{let Be=at?"enter":"leave";we.current=!1,X.onStop(w,Be,xe=>{xe==="enter"?u==null||u():xe==="leave"&&(o==null||o())}),Be==="leave"&&!De(X)&&(A("hidden"),S(w))});i.useEffect(()=>{y&&l||(We(T),P(T))},[T,y,l]);let _e=!(!l||!y||!_||He),[,N]=tr(_e,p,T,{start:We,end:P}),rl=R({ref:v,className:((r=Je(d.className,Ue&&c,Ue&&m,N.enter&&c,N.enter&&N.closed&&m,N.enter&&!N.closed&&x,N.leave&&E,N.leave&&!N.closed&&f,N.leave&&N.closed&&g,!N.transition&&T&&b))==null?void 0:r.trim())||void 0,...er(N)}),Ee=0;F==="visible"&&(Ee|=j.Open),F==="hidden"&&(Ee|=j.Closed),N.enter&&(Ee|=j.Opening),N.leave&&(Ee|=j.Closing);let ll=D();return i.createElement(Ae.Provider,{value:X},i.createElement(ir,{value:Ee},ll({ourProps:rl,theirProps:d,defaultTag:zt,features:Gt,visible:F==="visible",name:"Transition.Child"})))}function Ir(e,t){let{show:n,appear:r=!1,unmount:l=!0,...s}=e,u=i.useRef(null),a=Vt(e),o=q(...a?[u,t]:t===null?[]:[t]);ve();let c=Ne();if(n===void 0&&c!==null&&(n=(c&j.Open)===j.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[m,x]=i.useState(n?"visible":"hidden"),b=Yt(()=>{n||x("hidden")}),[E,f]=i.useState(!0),g=i.useRef([n]);k(()=>{E!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),f(!1))},[g,n]);let d=i.useMemo(()=>({show:n,appear:r,initial:E}),[n,r,E]);k(()=>{n?x("visible"):!De(b)&&u.current!==null&&x("hidden")},[n,b]);let p={unmount:l},h=O(()=>{var v;E&&f(!1),(v=e.beforeEnter)==null||v.call(e)}),w=O(()=>{var v;E&&f(!1),(v=e.beforeLeave)==null||v.call(e)}),y=D();return i.createElement(Ae.Provider,{value:b},i.createElement(Ie.Provider,{value:d},y({ourProps:{...p,as:i.Fragment,children:i.createElement(Kt,{ref:o,...p,...s,beforeEnter:h,beforeLeave:w})},theirProps:{},defaultTag:i.Fragment,features:Gt,visible:m==="visible",name:"Transition"})))}function Ar(e,t){let n=i.useContext(Ie)!==null,r=Ne()!==null;return i.createElement(i.Fragment,null,!n&&r?i.createElement(ot,{ref:t,...e}):i.createElement(Kt,{ref:t,...e}))}let ot=L(Ir),Kt=L(Nr),oe=L(Ar),Zt=Object.assign(ot,{Child:oe,Root:ot});var Dr=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Dr||{}),jr=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(jr||{});let Hr={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},st=i.createContext(null);st.displayName="DialogContext";function je(e){let t=i.useContext(st);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,je),n}return t}function Ur(e,t){return G(t.type,Hr,e,t)}let Jt=L(function(e,t){let n=i.useId(),{id:r=`headlessui-dialog-${n}`,open:l,onClose:s,initialFocus:u,role:a="dialog",autoFocus:o=!0,__demoMode:c=!1,unmount:m=!1,...x}=e,b=i.useRef(!1);a=function(){return a==="dialog"||a==="alertdialog"?a:(b.current||(b.current=!0,console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let E=Ne();l===void 0&&E!==null&&(l=(E&j.Open)===j.Open);let f=i.useRef(null),g=q(f,t),d=he(f),p=l?0:1,[h,w]=i.useReducer(Ur,{titleId:null,descriptionId:null,panelRef:i.createRef()}),y=O(()=>s(!1)),v=O(P=>w({type:0,id:P})),M=ve()?p===0:!1,[T,I]=hr(),H={get current(){var P;return(P=h.panelRef.current)!=null?P:f.current}},F=Bt(),{resolveContainers:A}=xr({mainTreeNode:F,portals:T,defaultContainers:[H]}),U=E!==null?(E&j.Closing)===j.Closing:!1;Ln(c||U?!1:M,{allowed:O(()=>{var P,_e;return[(_e=(P=f.current)==null?void 0:P.closest("[data-headlessui-portal]"))!=null?_e:null]}),disallowed:O(()=>{var P;return[(P=F==null?void 0:F.closest("body > *:not(#headlessui-portal-root)"))!=null?P:null]})}),Vn(M,A,P=>{P.preventDefault(),y()}),wr(M,d==null?void 0:d.defaultView,P=>{P.preventDefault(),P.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),y()}),Jn(c||U?!1:M,d,A),Nn(M,f,y);let[W,S]=$n(),_=i.useMemo(()=>[{dialogState:p,close:y,setTitleId:v,unmount:m},h],[p,h,y,v,m]),He=i.useMemo(()=>({open:p===0}),[p]),Ue={ref:g,id:r,role:a,tabIndex:-1,"aria-modal":c?void 0:p===0?!0:void 0,"aria-labelledby":h.titleId,"aria-describedby":W,unmount:m},we=!Er(),X=te.None;M&&!c&&(X|=te.RestoreFocus,X|=te.TabLock,o&&(X|=te.AutoFocus),we&&(X|=te.InitialFocus));let We=D();return i.createElement(or,null,i.createElement(Dt,{force:!0},i.createElement(gr,null,i.createElement(st.Provider,{value:_},i.createElement(Ut,{target:f},i.createElement(Dt,{force:!1},i.createElement(S,{slot:He},i.createElement(I,null,i.createElement(Cr,{initialFocus:u,initialFocusFallback:f,containers:A,features:X},i.createElement(Pn,{value:y},We({ourProps:Ue,theirProps:x,slot:He,defaultTag:Wr,features:_r,visible:p===0,name:"Dialog"})))))))))))}),Wr="div",_r=Te.RenderStrategy|Te.Static;function Br(e,t){let{transition:n=!1,open:r,...l}=e,s=Ne(),u=e.hasOwnProperty("open")||s!==null,a=e.hasOwnProperty("onClose");if(!u&&!a)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!u)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!a)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!s&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(r!==void 0||n)&&!l.static?i.createElement(_t,null,i.createElement(Zt,{show:r,transition:n,unmount:l.unmount},i.createElement(Jt,{ref:t,...l}))):i.createElement(_t,null,i.createElement(Jt,{ref:t,open:r,...l}))}let qr="div";function Xr(e,t){let n=i.useId(),{id:r=`headlessui-dialog-panel-${n}`,transition:l=!1,...s}=e,[{dialogState:u,unmount:a},o]=je("Dialog.Panel"),c=q(t,o.panelRef),m=i.useMemo(()=>({open:u===0}),[u]),x=O(d=>{d.stopPropagation()}),b={ref:c,id:r,onClick:x},E=l?oe:i.Fragment,f=l?{unmount:a}:{},g=D();return i.createElement(E,{...f},g({ourProps:b,theirProps:s,slot:m,defaultTag:qr,name:"Dialog.Panel"}))}let Vr="div";function Yr(e,t){let{transition:n=!1,...r}=e,[{dialogState:l,unmount:s}]=je("Dialog.Backdrop"),u=i.useMemo(()=>({open:l===0}),[l]),a={ref:t,"aria-hidden":!0},o=n?oe:i.Fragment,c=n?{unmount:s}:{},m=D();return i.createElement(o,{...c},m({ourProps:a,theirProps:r,slot:u,defaultTag:Vr,name:"Dialog.Backdrop"}))}let zr="h2";function Gr(e,t){let n=i.useId(),{id:r=`headlessui-dialog-title-${n}`,...l}=e,[{dialogState:s,setTitleId:u}]=je("Dialog.Title"),a=q(t);i.useEffect(()=>(u(r),()=>u(null)),[r,u]);let o=i.useMemo(()=>({open:s===0}),[s]),c={ref:a,id:r};return D()({ourProps:c,theirProps:l,slot:o,defaultTag:zr,name:"Dialog.Title"})}let Kr=L(Br),ut=L(Xr);L(Yr);let Zr=L(Gr),Jr=Object.assign(Kr,{Panel:ut,Title:Zr,Description:On});function Qt({onClick:e}){return $.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:e,children:[$.jsx("span",{className:"sr-only",children:"Close"}),$.jsx("svg",{className:"size-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true",children:$.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}const Qr=({modalContext:e,config:t,children:n})=>{const[r,l]=i.useState(!1);return $.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:$.jsx("div",{className:Ce("im-modal-positioner flex min-h-full justify-center",{"items-start":t.position==="top","items-center":t.position==="center","items-end":t.position==="bottom"}),children:$.jsx(oe,{as:"div",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",afterEnter:()=>l(!0),afterLeave:e.afterLeave,className:Ce("im-modal-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:$.jsxs(ut,{className:`im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":r,children:[t.closeButton&&$.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:$.jsx(Qt,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})})},Rr=({modalContext:e,config:t,children:n})=>{const[r,l]=i.useState(!1);return $.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:$.jsx("div",{className:Ce("im-slideover-positioner flex min-h-full items-center",{"justify-start rtl:justify-end":(t==null?void 0:t.position)==="left","justify-end rtl:justify-start":(t==null?void 0:t.position)==="right"}),children:$.jsx(oe,{as:"div",enterFrom:`opacity-0 ${t.position==="left"?"-translate-x-full":"translate-x-full"}`,enterTo:"opacity-100 translate-x-0",leaveFrom:"opacity-100 translate-x-0",leaveTo:`opacity-0 ${t.position==="left"?"-translate-x-full":"translate-x-full"}`,afterEnter:()=>l(!0),afterLeave:e.afterLeave,className:Ce("im-slideover-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:$.jsxs(ut,{className:`im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,"data-inertiaui-modal-entered":r,children:[t.closeButton&&$.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:$.jsx(Qt,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})})},Rt=i.forwardRef(({name:e,children:t,onFocus:n=null,onBlur:r=null,onClose:l=null,onSuccess:s=null,onAfterLeave:u=null,...a},o)=>{const c=x=>typeof t=="function"?t(x):t,m=i.useRef(null);return i.useImperativeHandle(o,()=>m.current,[m]),$.jsx(Ge,{ref:m,name:e,onFocus:n,onBlur:r,onClose:l,onSuccess:s,...a,children:({afterLeave:x,close:b,config:E,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:y,onTopOfStack:v,reload:M,setOpen:T,shouldRender:I})=>$.jsx(Zt,{appear:!0,show:w??!1,afterLeave:u,children:$.jsxs(Jr,{as:"div",className:"im-dialog relative z-20",onClose:()=>E.closeExplicitly?null:b(),"data-inertiaui-modal-id":p,"data-inertiaui-modal-index":h,children:[h===0?$.jsx(oe,{enter:"transition transform ease-in-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition transform ease-in-out duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:v?$.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):$.jsx("div",{})}):null,h>0&&v?$.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,E.slideover?$.jsx(Rr,{modalContext:y,config:E,children:c({afterLeave:x,close:b,config:E,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:y,onTopOfStack:v,reload:M,setOpen:T,shouldRender:I})}):$.jsx(Qr,{modalContext:y,config:E,children:c({afterLeave:x,close:b,config:E,emit:f,getChildModal:g,getParentModal:d,id:p,index:h,isOpen:w,modalContext:y,onTopOfStack:v,reload:M,setOpen:T,shouldRender:I})})]})})})});Rt.displayName="Modal";const el=({href:e,method:t="get",data:n={},as:r="a",headers:l={},queryStringArrayFormat:s="brackets",onAfterLeave:u=null,onBlur:a=null,onClose:o=null,onError:c=null,onFocus:m=null,onStart:x=null,onSuccess:b=null,navigate:E=null,children:f,...g})=>{const[d,p]=i.useState(!1),[h,w]=i.useState(null),{stack:y,visit:v}=ce(),M=i.useMemo(()=>E??$e("navigate"),[E]),T={},I={};Object.keys(g).forEach(S=>{pt.includes(S)||(S.startsWith("on")&&typeof g[S]=="function"?S.toLowerCase()in window?T[S]=g[S]:I[S]=g[S]:T[S]=g[S])});const[H,F]=i.useState(!1);i.useEffect(()=>{h&&(h.onTopOfStack&&H?m==null||m():!h.onTopOfStack&&!H&&(a==null||a()),F(!h.onTopOfStack))},[y]);const A=i.useCallback(()=>{o==null||o()},[o]),U=i.useCallback(()=>{w(null),u==null||u()},[u]),W=i.useCallback(S=>{S==null||S.preventDefault(),!d&&(e.startsWith("#")||(p(!0),x==null||x()),v(e,t,n,l,un(dt(g,pt)),()=>A(y.length),U,s,M).then(_=>{w(_),_.registerEventListenersFromProps(I),b==null||b()}).catch(_=>{console.error(_),c==null||c(_)}).finally(()=>p(!1)))},[e,t,n,l,s,g,A,U]);return $.jsx(r,{...T,href:e,onClick:W,children:typeof f=="function"?f({loading:d}):f})};function tl(){return ce().stack[ze()]??null}const nl=e=>t=>(t.default.layout=n=>i.createElement(e,{},n),t);C.HeadlessModal=Ge,C.Modal=Rt,C.ModalLink=el,C.ModalRoot=vt,C.ModalStackProvider=mt,C.getConfig=$e,C.initFromPageProps=ht,C.putConfig=on,C.renderApp=dn,C.resetConfig=ln,C.setPageLayout=nl,C.useModal=tl,C.useModalIndex=ze,C.useModalStack=ce,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiaui/modal-react",
|
|
3
3
|
"author": "Pascal Baljet <pascal@protone.media>",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"eslint-plugin-tailwindcss": "^3.15.1",
|
|
39
39
|
"eslint-plugin-unused-imports": "^3.1.0",
|
|
40
40
|
"eslint": "^8.57.0",
|
|
41
|
-
"focus-trap": "^7.6.2",
|
|
42
41
|
"prettier-plugin-tailwindcss": "^0.5.12",
|
|
43
42
|
"prettier": "^3.2.4",
|
|
44
43
|
"react-dom": "^18.2.0||^19.0.0",
|
|
@@ -52,4 +51,4 @@
|
|
|
52
51
|
"react": "^18.2.0||^19.0.0",
|
|
53
52
|
"react-dom": "^18.2.0||^19.0.0"
|
|
54
53
|
}
|
|
55
|
-
}
|
|
54
|
+
}
|
package/src/Modal.jsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Transition, TransitionChild } from '@headlessui/react'
|
|
2
|
-
import { forwardRef, useRef, useImperativeHandle
|
|
1
|
+
import { Dialog, Transition, TransitionChild } from '@headlessui/react'
|
|
2
|
+
import { forwardRef, useRef, useImperativeHandle } from 'react'
|
|
3
3
|
import HeadlessModal from './HeadlessModal'
|
|
4
4
|
import ModalContent from './ModalContent'
|
|
5
5
|
import SlideoverContent from './SlideoverContent'
|
|
6
|
-
import { modalDOMHandler } from './helpers'
|
|
7
6
|
|
|
8
7
|
const Modal = forwardRef(({ name, children, onFocus = null, onBlur = null, onClose = null, onSuccess = null, onAfterLeave = null, ...props }, ref) => {
|
|
9
8
|
const renderChildren = (contentProps) => {
|
|
@@ -16,14 +15,6 @@ const Modal = forwardRef(({ name, children, onFocus = null, onBlur = null, onClo
|
|
|
16
15
|
|
|
17
16
|
const headlessModalRef = useRef(null)
|
|
18
17
|
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (headlessModalRef?.current?.index === 0) {
|
|
21
|
-
modalDOMHandler.prepare()
|
|
22
|
-
|
|
23
|
-
return () => modalDOMHandler.cleanup()
|
|
24
|
-
}
|
|
25
|
-
}, [headlessModalRef])
|
|
26
|
-
|
|
27
18
|
useImperativeHandle(ref, () => headlessModalRef.current, [headlessModalRef])
|
|
28
19
|
|
|
29
20
|
return (
|
|
@@ -57,8 +48,10 @@ const Modal = forwardRef(({ name, children, onFocus = null, onBlur = null, onClo
|
|
|
57
48
|
show={isOpen ?? false}
|
|
58
49
|
afterLeave={onAfterLeave}
|
|
59
50
|
>
|
|
60
|
-
<
|
|
51
|
+
<Dialog
|
|
52
|
+
as="div"
|
|
61
53
|
className="im-dialog relative z-20"
|
|
54
|
+
onClose={() => (config.closeExplicitly ? null : close())}
|
|
62
55
|
data-inertiaui-modal-id={id}
|
|
63
56
|
data-inertiaui-modal-index={index}
|
|
64
57
|
>
|
|
@@ -132,7 +125,7 @@ const Modal = forwardRef(({ name, children, onFocus = null, onBlur = null, onClo
|
|
|
132
125
|
})}
|
|
133
126
|
</ModalContent>
|
|
134
127
|
)}
|
|
135
|
-
</
|
|
128
|
+
</Dialog>
|
|
136
129
|
</Transition>
|
|
137
130
|
)}
|
|
138
131
|
</HeadlessModal>
|
package/src/ModalContent.jsx
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import { TransitionChild } from '@headlessui/react'
|
|
1
|
+
import { TransitionChild, DialogPanel } from '@headlessui/react'
|
|
2
2
|
import CloseButton from './CloseButton'
|
|
3
3
|
import clsx from 'clsx'
|
|
4
|
-
import {
|
|
5
|
-
import { useEffect, useRef, useState } from 'react'
|
|
4
|
+
import { useState } from 'react'
|
|
6
5
|
|
|
7
6
|
const ModalContent = ({ modalContext, config, children }) => {
|
|
8
7
|
const [entered, setEntered] = useState(false)
|
|
9
|
-
const wrapper = useRef(null)
|
|
10
|
-
const [focusTrap, setFocusTrap] = useState(null)
|
|
11
|
-
|
|
12
|
-
function afterEnter() {
|
|
13
|
-
setFocusTrap(focusTrapper(wrapper.current, config?.closeExplicitly, () => modalContext.close()))
|
|
14
|
-
setEntered(true)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
useEffect(() => () => focusTrap?.deactivate(), [focusTrap])
|
|
18
8
|
|
|
19
9
|
return (
|
|
20
10
|
<div className="im-modal-container fixed inset-0 z-40 overflow-y-auto p-4">
|
|
@@ -27,12 +17,11 @@ const ModalContent = ({ modalContext, config, children }) => {
|
|
|
27
17
|
>
|
|
28
18
|
<TransitionChild
|
|
29
19
|
as="div"
|
|
30
|
-
ref={wrapper}
|
|
31
20
|
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
32
21
|
enterTo="opacity-100 translate-y-0 sm:scale-100"
|
|
33
22
|
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
|
|
34
23
|
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
35
|
-
afterEnter={
|
|
24
|
+
afterEnter={() => setEntered(true)}
|
|
36
25
|
afterLeave={modalContext.afterLeave}
|
|
37
26
|
className={clsx('im-modal-wrapper w-full transition duration-300 ease-in-out', modalContext.onTopOfStack ? '' : 'blur-sm', {
|
|
38
27
|
'sm:max-w-sm': config.maxWidth === 'sm',
|
|
@@ -47,7 +36,7 @@ const ModalContent = ({ modalContext, config, children }) => {
|
|
|
47
36
|
'sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl': config.maxWidth === '7xl',
|
|
48
37
|
})}
|
|
49
38
|
>
|
|
50
|
-
<
|
|
39
|
+
<DialogPanel
|
|
51
40
|
className={`im-modal-content relative ${config.paddingClasses} ${config.panelClasses}`}
|
|
52
41
|
data-inertiaui-modal-entered={entered}
|
|
53
42
|
>
|
|
@@ -57,7 +46,7 @@ const ModalContent = ({ modalContext, config, children }) => {
|
|
|
57
46
|
</div>
|
|
58
47
|
)}
|
|
59
48
|
{typeof children === 'function' ? children({ modalContext, config }) : children}
|
|
60
|
-
</
|
|
49
|
+
</DialogPanel>
|
|
61
50
|
</TransitionChild>
|
|
62
51
|
</div>
|
|
63
52
|
</div>
|
package/src/SlideoverContent.jsx
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import { TransitionChild } from '@headlessui/react'
|
|
1
|
+
import { TransitionChild, DialogPanel } from '@headlessui/react'
|
|
2
2
|
import CloseButton from './CloseButton'
|
|
3
3
|
import clsx from 'clsx'
|
|
4
|
-
import {
|
|
5
|
-
import { useEffect, useRef, useState } from 'react'
|
|
4
|
+
import { useState } from 'react'
|
|
6
5
|
|
|
7
6
|
const SlideoverContent = ({ modalContext, config, children }) => {
|
|
8
7
|
const [entered, setEntered] = useState(false)
|
|
9
|
-
const wrapper = useRef(null)
|
|
10
|
-
const [focusTrap, setFocusTrap] = useState(null)
|
|
11
|
-
|
|
12
|
-
function afterEnter() {
|
|
13
|
-
setFocusTrap(focusTrapper(wrapper.current, config?.closeExplicitly, () => modalContext.close()))
|
|
14
|
-
setEntered(true)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
useEffect(() => () => focusTrap?.deactivate(), [focusTrap])
|
|
18
8
|
|
|
19
9
|
return (
|
|
20
10
|
<div className="im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden">
|
|
@@ -26,12 +16,11 @@ const SlideoverContent = ({ modalContext, config, children }) => {
|
|
|
26
16
|
>
|
|
27
17
|
<TransitionChild
|
|
28
18
|
as="div"
|
|
29
|
-
ref={wrapper}
|
|
30
19
|
enterFrom={`opacity-0 ${config.position === 'left' ? '-translate-x-full' : 'translate-x-full'}`}
|
|
31
20
|
enterTo="opacity-100 translate-x-0"
|
|
32
21
|
leaveFrom="opacity-100 translate-x-0"
|
|
33
22
|
leaveTo={`opacity-0 ${config.position === 'left' ? '-translate-x-full' : 'translate-x-full'}`}
|
|
34
|
-
afterEnter={
|
|
23
|
+
afterEnter={() => setEntered(true)}
|
|
35
24
|
afterLeave={modalContext.afterLeave}
|
|
36
25
|
className={clsx('im-slideover-wrapper w-full transition duration-300 ease-in-out', modalContext.onTopOfStack ? '' : 'blur-sm', {
|
|
37
26
|
'sm:max-w-sm': config.maxWidth === 'sm',
|
|
@@ -46,7 +35,7 @@ const SlideoverContent = ({ modalContext, config, children }) => {
|
|
|
46
35
|
'sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl': config.maxWidth === '7xl',
|
|
47
36
|
})}
|
|
48
37
|
>
|
|
49
|
-
<
|
|
38
|
+
<DialogPanel
|
|
50
39
|
className={`im-slideover-content relative ${config.paddingClasses} ${config.panelClasses}`}
|
|
51
40
|
data-inertiaui-modal-entered={entered}
|
|
52
41
|
>
|
|
@@ -56,7 +45,7 @@ const SlideoverContent = ({ modalContext, config, children }) => {
|
|
|
56
45
|
</div>
|
|
57
46
|
)}
|
|
58
47
|
{typeof children === 'function' ? children({ modalContext, config }) : children}
|
|
59
|
-
</
|
|
48
|
+
</DialogPanel>
|
|
60
49
|
</TransitionChild>
|
|
61
50
|
</div>
|
|
62
51
|
</div>
|
package/src/helpers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { generateId, except, only, rejectNullValues, waitFor, kebabCase } from './../../vue/src/helpers.js'
|
|
2
|
+
export { generateId, except, only, rejectNullValues, waitFor, kebabCase }
|
package/src/focusTrapper.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createFocusTrap } from 'focus-trap'
|
|
2
|
-
|
|
3
|
-
export function focusTrapper(wrapper, closeExplicitly, onDeactivateCallback) {
|
|
4
|
-
let trap = null
|
|
5
|
-
|
|
6
|
-
if (wrapper) {
|
|
7
|
-
trap = createFocusTrap(wrapper, {
|
|
8
|
-
clickOutsideDeactivates: !closeExplicitly,
|
|
9
|
-
escapeDeactivates: !closeExplicitly,
|
|
10
|
-
onDeactivate: () => onDeactivateCallback?.(),
|
|
11
|
-
fallbackFocus: () => wrapper,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
trap.activate()
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const deactivate = () => {
|
|
18
|
-
trap?.deactivate()
|
|
19
|
-
trap = null
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return { deactivate, wrapper }
|
|
23
|
-
}
|