@inertiaui/modal-react 0.15.0 → 0.16.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.
@@ -1,4 +1,4 @@
1
- (function(L,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core")):typeof define=="function"&&define.amd?define(["exports","react","axios","@inertiajs/react","@inertiajs/core"],u):(L=typeof globalThis<"u"?globalThis:L||self,u(L.InertiaUIModal={},L.React,L.Axios,L.react,L.core))})(this,function(L,u,le,ge,xr){"use strict";var fa=Object.defineProperty;var va=(L,u,le)=>u in L?fa(L,u,{enumerable:!0,configurable:!0,writable:!0,value:le}):L[u]=le;var ae=(L,u,le)=>va(L,typeof u!="symbol"?u+"":u,le);function Er(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Te=Er(u),Se={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 Tr{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(Se))}put(e,r){if(typeof e=="object"){this.config={type:e.type??Se.type,navigate:e.navigate??Se.navigate,modal:{...Se.modal,...e.modal??{}},slideover:{...Se.slideover,...e.slideover??{}}};return}const n=e.split(".");let i=this.config;for(let l=0;l<n.length-1;l++)i=i[n[l]]=i[n[l]]||{};i[n[n.length-1]]=r}get(e){if(typeof e>"u")return this.config;const r=e.split(".");let n=this.config;for(const i of r){if(n[i]===void 0)return null;n=n[i]}return n}}const Ae=new Tr,Sr=()=>Ae.reset(),Cr=(t,e)=>Ae.put(t,e),_e=t=>Ae.get(t),ye=(t,e)=>Ae.get(t?`slideover.${e}`:`modal.${e}`);var Qe={exports:{}},Ce={};/**
1
+ (function(k,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","axios","@inertiajs/react","@inertiajs/core","react-dom"],i):(k=typeof globalThis<"u"?globalThis:k||self,i(k.InertiaUIModal={},k.React,k.Axios,k.react,k.core,k.ReactDOM))})(this,function(k,i,le,Oe,Xn,zn){"use strict";var yi=Object.defineProperty;var xi=(k,i,le)=>i in k?yi(k,i,{enumerable:!0,configurable:!0,writable:!0,value:le}):k[i]=le;var te=(k,i,le)=>xi(k,typeof i!="symbol"?i+"":i,le);function Kn(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 je=Kn(i),_e={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 Gn{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(_e))}put(t,n){if(typeof t=="object"){this.config={type:t.type??_e.type,navigate:t.navigate??_e.navigate,modal:{..._e.modal,...t.modal??{}},slideover:{..._e.slideover,...t.slideover??{}}};return}const r=t.split(".");let l=this.config;for(let u=0;u<r.length-1;u++)l=l[r[u]]=l[r[u]]||{};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 ze=new Gn,Jn=()=>ze.reset(),Rn=(e,t)=>ze.put(e,t),Ke=e=>ze.get(e),Pe=(e,t)=>ze.get(e?`slideover.${t}`:`modal.${t}`);var ft={exports:{}},Le={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var yt;function Or(){if(yt)return Ce;yt=1;var t=u,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function s(b,o,y){var p,T={},C=null,O=null;y!==void 0&&(C=""+y),o.key!==void 0&&(C=""+o.key),o.ref!==void 0&&(O=o.ref);for(p in o)n.call(o,p)&&!l.hasOwnProperty(p)&&(T[p]=o[p]);if(b&&b.defaultProps)for(p in o=b.defaultProps,o)T[p]===void 0&&(T[p]=o[p]);return{$$typeof:e,type:b,key:C,ref:O,props:T,_owner:i.current}}return Ce.Fragment=r,Ce.jsx=s,Ce.jsxs=s,Ce}var Oe={};/**
9
+ */var Dt;function Zn(){if(Dt)return Le;Dt=1;var e=i,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function s(d,a,p){var c,b={},y=null,w=null;p!==void 0&&(y=""+p),a.key!==void 0&&(y=""+a.key),a.ref!==void 0&&(w=a.ref);for(c in a)r.call(a,c)&&!u.hasOwnProperty(c)&&(b[c]=a[c]);if(d&&d.defaultProps)for(c in a=d.defaultProps,a)b[c]===void 0&&(b[c]=a[c]);return{$$typeof:t,type:d,key:y,ref:w,props:b,_owner:l.current}}return Le.Fragment=n,Le.jsx=s,Le.jsxs=s,Le}var Ae={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,28 +14,21 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var wt;function kr(){return wt||(wt=1,process.env.NODE_ENV!=="production"&&function(){var t=u,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),b=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),x=Symbol.iterator,v="@@iterator";function f(a){if(a===null||typeof a!="object")return null;var h=x&&a[x]||a[v];return typeof h=="function"?h:null}var m=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(a){{for(var h=arguments.length,E=new Array(h>1?h-1:0),P=1;P<h;P++)E[P-1]=arguments[P];S("error",a,E)}}function S(a,h,E){{var P=m.ReactDebugCurrentFrame,D=P.getStackAddendum();D!==""&&(h+="%s",E=E.concat([D]));var W=E.map(function(A){return String(A)});W.unshift("Warning: "+h),Function.prototype.apply.call(console[a],console,W)}}var k=!1,_=!1,ie=!1,V=!1,G=!1,Z;Z=Symbol.for("react.module.reference");function Y(a){return!!(typeof a=="string"||typeof a=="function"||a===n||a===l||G||a===i||a===y||a===p||V||a===O||k||_||ie||typeof a=="object"&&a!==null&&(a.$$typeof===C||a.$$typeof===T||a.$$typeof===s||a.$$typeof===b||a.$$typeof===o||a.$$typeof===Z||a.getModuleId!==void 0))}function X(a,h,E){var P=a.displayName;if(P)return P;var D=h.displayName||h.name||"";return D!==""?E+"("+D+")":E}function I(a){return a.displayName||"Context"}function c(a){if(a==null)return null;if(typeof a.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case n:return"Fragment";case r:return"Portal";case l:return"Profiler";case i:return"StrictMode";case y:return"Suspense";case p:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case b:var h=a;return I(h)+".Consumer";case s:var E=a;return I(E._context)+".Provider";case o:return X(a,a.render,"ForwardRef");case T:var P=a.displayName||null;return P!==null?P:c(a.type)||"Memo";case C:{var D=a,W=D._payload,A=D._init;try{return c(A(W))}catch{return null}}}return null}var d=Object.assign,w=0,M,R,$,j,U,B,te;function K(){}K.__reactDisabledLog=!0;function re(){{if(w===0){M=console.log,R=console.info,$=console.warn,j=console.error,U=console.group,B=console.groupCollapsed,te=console.groupEnd;var a={configurable:!0,enumerable:!0,value:K,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}w++}}function Q(){{if(w--,w===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:d({},a,{value:M}),info:d({},a,{value:R}),warn:d({},a,{value:$}),error:d({},a,{value:j}),group:d({},a,{value:U}),groupCollapsed:d({},a,{value:B}),groupEnd:d({},a,{value:te})})}w<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=m.ReactCurrentDispatcher,se;function ee(a,h,E){{if(se===void 0)try{throw Error()}catch(D){var P=D.stack.trim().match(/\n( *(at )?)/);se=P&&P[1]||""}return`
18
- `+se+a}}var ue=!1,Ge;{var Un=typeof WeakMap=="function"?WeakMap:Map;Ge=new Un}function sr(a,h){if(!a||ue)return"";{var E=Ge.get(a);if(E!==void 0)return E}var P;ue=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=fe.current,fe.current=null,re();try{if(h){var A=function(){throw Error()};if(Object.defineProperty(A.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(A,[])}catch(J){P=J}Reflect.construct(a,[],A)}else{try{A.call()}catch(J){P=J}a.call(A.prototype)}}else{try{throw Error()}catch(J){P=J}a()}}catch(J){if(J&&P&&typeof J.stack=="string"){for(var N=J.stack.split(`
19
- `),z=P.stack.split(`
20
- `),H=N.length-1,q=z.length-1;H>=1&&q>=0&&N[H]!==z[q];)q--;for(;H>=1&&q>=0;H--,q--)if(N[H]!==z[q]){if(H!==1||q!==1)do if(H--,q--,q<0||N[H]!==z[q]){var ne=`
21
- `+N[H].replace(" at new "," at ");return a.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",a.displayName)),typeof a=="function"&&Ge.set(a,ne),ne}while(H>=1&&q>=0);break}}}finally{ue=!1,fe.current=W,Q(),Error.prepareStackTrace=D}var Ee=a?a.displayName||a.name:"",be=Ee?ee(Ee):"";return typeof a=="function"&&Ge.set(a,be),be}function Bn(a,h,E){return sr(a,!1)}function Kn(a){var h=a.prototype;return!!(h&&h.isReactComponent)}function Je(a,h,E){if(a==null)return"";if(typeof a=="function")return sr(a,Kn(a));if(typeof a=="string")return ee(a);switch(a){case y:return ee("Suspense");case p:return ee("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case o:return Bn(a.render);case T:return Je(a.type,h,E);case C:{var P=a,D=P._payload,W=P._init;try{return Je(W(D),h,E)}catch{}}}return""}var Ie=Object.prototype.hasOwnProperty,lr={},or=m.ReactDebugCurrentFrame;function Ze(a){if(a){var h=a._owner,E=Je(a.type,a._source,h?h.type:null);or.setExtraStackFrame(E)}else or.setExtraStackFrame(null)}function Hn(a,h,E,P,D){{var W=Function.call.bind(Ie);for(var A in a)if(W(a,A)){var N=void 0;try{if(typeof a[A]!="function"){var z=Error((P||"React class")+": "+E+" type `"+A+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[A]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw z.name="Invariant Violation",z}N=a[A](h,A,P,E,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(H){N=H}N&&!(N instanceof Error)&&(Ze(D),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",P||"React class",E,A,typeof N),Ze(null)),N instanceof Error&&!(N.message in lr)&&(lr[N.message]=!0,Ze(D),g("Failed %s type: %s",E,N.message),Ze(null))}}}var Vn=Array.isArray;function pt(a){return Vn(a)}function qn(a){{var h=typeof Symbol=="function"&&Symbol.toStringTag,E=h&&a[Symbol.toStringTag]||a.constructor.name||"Object";return E}}function Yn(a){try{return ur(a),!1}catch{return!0}}function ur(a){return""+a}function cr(a){if(Yn(a))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qn(a)),ur(a)}var dr=m.ReactCurrentOwner,Xn={key:!0,ref:!0,__self:!0,__source:!0},fr,vr;function zn(a){if(Ie.call(a,"ref")){var h=Object.getOwnPropertyDescriptor(a,"ref").get;if(h&&h.isReactWarning)return!1}return a.ref!==void 0}function Gn(a){if(Ie.call(a,"key")){var h=Object.getOwnPropertyDescriptor(a,"key").get;if(h&&h.isReactWarning)return!1}return a.key!==void 0}function Jn(a,h){typeof a.ref=="string"&&dr.current}function Zn(a,h){{var E=function(){fr||(fr=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",h))};E.isReactWarning=!0,Object.defineProperty(a,"key",{get:E,configurable:!0})}}function Qn(a,h){{var E=function(){vr||(vr=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",h))};E.isReactWarning=!0,Object.defineProperty(a,"ref",{get:E,configurable:!0})}}var ea=function(a,h,E,P,D,W,A){var N={$$typeof:e,type:a,key:h,ref:E,props:A,_owner:W};return N._store={},Object.defineProperty(N._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(N,"_self",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.defineProperty(N,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(N.props),Object.freeze(N)),N};function ta(a,h,E,P,D){{var W,A={},N=null,z=null;E!==void 0&&(cr(E),N=""+E),Gn(h)&&(cr(h.key),N=""+h.key),zn(h)&&(z=h.ref,Jn(h,D));for(W in h)Ie.call(h,W)&&!Xn.hasOwnProperty(W)&&(A[W]=h[W]);if(a&&a.defaultProps){var H=a.defaultProps;for(W in H)A[W]===void 0&&(A[W]=H[W])}if(N||z){var q=typeof a=="function"?a.displayName||a.name||"Unknown":a;N&&Zn(A,q),z&&Qn(A,q)}return ea(a,N,z,D,P,dr.current,A)}}var mt=m.ReactCurrentOwner,pr=m.ReactDebugCurrentFrame;function xe(a){if(a){var h=a._owner,E=Je(a.type,a._source,h?h.type:null);pr.setExtraStackFrame(E)}else pr.setExtraStackFrame(null)}var ht;ht=!1;function bt(a){return typeof a=="object"&&a!==null&&a.$$typeof===e}function mr(){{if(mt.current){var a=c(mt.current.type);if(a)return`
17
+ */var Wt;function Qn(){return Wt||(Wt=1,process.env.NODE_ENV!=="production"&&function(){var e=i,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),d=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),E=Symbol.iterator,m="@@iterator";function f(o){if(o===null||typeof o!="object")return null;var v=E&&o[E]||o[m];return typeof v=="function"?v:null}var h=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(o){{for(var v=arguments.length,C=new Array(v>1?v-1:0),S=1;S<v;S++)C[S-1]=arguments[S];x("error",o,C)}}function x(o,v,C){{var S=h.ReactDebugCurrentFrame,j=S.getStackAddendum();j!==""&&(v+="%s",C=C.concat([j]));var _=C.map(function($){return String($)});_.unshift("Warning: "+v),Function.prototype.apply.call(console[o],console,_)}}var T=!1,F=!1,Y=!1,U=!1,J=!1,R;R=Symbol.for("react.module.reference");function H(o){return!!(typeof o=="string"||typeof o=="function"||o===r||o===u||J||o===l||o===p||o===c||U||o===w||T||F||Y||typeof o=="object"&&o!==null&&(o.$$typeof===y||o.$$typeof===b||o.$$typeof===s||o.$$typeof===d||o.$$typeof===a||o.$$typeof===R||o.getModuleId!==void 0))}function q(o,v,C){var S=o.displayName;if(S)return S;var j=v.displayName||v.name||"";return j!==""?C+"("+j+")":C}function K(o){return o.displayName||"Context"}function L(o){if(o==null)return null;if(typeof o.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case r:return"Fragment";case n:return"Portal";case u:return"Profiler";case l:return"StrictMode";case p:return"Suspense";case c:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case d:var v=o;return K(v)+".Consumer";case s:var C=o;return K(C._context)+".Provider";case a:return q(o,o.render,"ForwardRef");case b:var S=o.displayName||null;return S!==null?S:L(o.type)||"Memo";case y:{var j=o,_=j._payload,$=j._init;try{return L($(_))}catch{return null}}}return null}var M=Object.assign,I=0,be,we,me,Z,ye,N,xe;function B(){}B.__reactDisabledLog=!0;function jt(){{if(I===0){be=console.log,we=console.info,me=console.warn,Z=console.error,ye=console.group,N=console.groupCollapsed,xe=console.groupEnd;var o={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}I++}}function Ce(){{if(I--,I===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},o,{value:be}),info:M({},o,{value:we}),warn:M({},o,{value:me}),error:M({},o,{value:Z}),group:M({},o,{value:ye}),groupCollapsed:M({},o,{value:N}),groupEnd:M({},o,{value:xe})})}I<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var qe=h.ReactCurrentDispatcher,Te;function ae(o,v,C){{if(Te===void 0)try{throw Error()}catch(j){var S=j.stack.trim().match(/\n( *(at )?)/);Te=S&&S[1]||""}return`
18
+ `+Te+o}}var ue=!1,st;{var Jl=typeof WeakMap=="function"?WeakMap:Map;st=new Jl}function kn(o,v){if(!o||ue)return"";{var C=st.get(o);if(C!==void 0)return C}var S;ue=!0;var j=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _;_=qe.current,qe.current=null,jt();try{if(v){var $=function(){throw Error()};if(Object.defineProperty($.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($,[])}catch(G){S=G}Reflect.construct(o,[],$)}else{try{$.call()}catch(G){S=G}o.call($.prototype)}}else{try{throw Error()}catch(G){S=G}o()}}catch(G){if(G&&S&&typeof G.stack=="string"){for(var P=G.stack.split(`
19
+ `),X=S.stack.split(`
20
+ `),D=P.length-1,W=X.length-1;D>=1&&W>=0&&P[D]!==X[W];)W--;for(;D>=1&&W>=0;D--,W--)if(P[D]!==X[W]){if(D!==1||W!==1)do if(D--,W--,W<0||P[D]!==X[W]){var ee=`
21
+ `+P[D].replace(" at new "," at ");return o.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",o.displayName)),typeof o=="function"&&st.set(o,ee),ee}while(D>=1&&W>=0);break}}}finally{ue=!1,qe.current=_,Ce(),Error.prepareStackTrace=j}var ke=o?o.displayName||o.name:"",Se=ke?ae(ke):"";return typeof o=="function"&&st.set(o,Se),Se}function Rl(o,v,C){return kn(o,!1)}function Zl(o){var v=o.prototype;return!!(v&&v.isReactComponent)}function dt(o,v,C){if(o==null)return"";if(typeof o=="function")return kn(o,Zl(o));if(typeof o=="string")return ae(o);switch(o){case p:return ae("Suspense");case c:return ae("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case a:return Rl(o.render);case b:return dt(o.type,v,C);case y:{var S=o,j=S._payload,_=S._init;try{return dt(_(j),v,C)}catch{}}}return""}var Xe=Object.prototype.hasOwnProperty,jn={},_n=h.ReactDebugCurrentFrame;function ct(o){if(o){var v=o._owner,C=dt(o.type,o._source,v?v.type:null);_n.setExtraStackFrame(C)}else _n.setExtraStackFrame(null)}function Ql(o,v,C,S,j){{var _=Function.call.bind(Xe);for(var $ in o)if(_(o,$)){var P=void 0;try{if(typeof o[$]!="function"){var X=Error((S||"React class")+": "+C+" type `"+$+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[$]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw X.name="Invariant Violation",X}P=o[$](v,$,S,C,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(D){P=D}P&&!(P instanceof Error)&&(ct(j),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",S||"React class",C,$,typeof P),ct(null)),P instanceof Error&&!(P.message in jn)&&(jn[P.message]=!0,ct(j),g("Failed %s type: %s",C,P.message),ct(null))}}}var ei=Array.isArray;function _t(o){return ei(o)}function ti(o){{var v=typeof Symbol=="function"&&Symbol.toStringTag,C=v&&o[Symbol.toStringTag]||o.constructor.name||"Object";return C}}function ni(o){try{return Ln(o),!1}catch{return!0}}function Ln(o){return""+o}function An(o){if(ni(o))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ti(o)),Ln(o)}var In=h.ReactCurrentOwner,ri={key:!0,ref:!0,__self:!0,__source:!0},Nn,Dn;function li(o){if(Xe.call(o,"ref")){var v=Object.getOwnPropertyDescriptor(o,"ref").get;if(v&&v.isReactWarning)return!1}return o.ref!==void 0}function ii(o){if(Xe.call(o,"key")){var v=Object.getOwnPropertyDescriptor(o,"key").get;if(v&&v.isReactWarning)return!1}return o.key!==void 0}function oi(o,v){typeof o.ref=="string"&&In.current}function ai(o,v){{var C=function(){Nn||(Nn=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",v))};C.isReactWarning=!0,Object.defineProperty(o,"key",{get:C,configurable:!0})}}function ui(o,v){{var C=function(){Dn||(Dn=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",v))};C.isReactWarning=!0,Object.defineProperty(o,"ref",{get:C,configurable:!0})}}var si=function(o,v,C,S,j,_,$){var P={$$typeof:t,type:o,key:v,ref:C,props:$,_owner:_};return P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(P,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(P,"_source",{configurable:!1,enumerable:!1,writable:!1,value:j}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P};function di(o,v,C,S,j){{var _,$={},P=null,X=null;C!==void 0&&(An(C),P=""+C),ii(v)&&(An(v.key),P=""+v.key),li(v)&&(X=v.ref,oi(v,j));for(_ in v)Xe.call(v,_)&&!ri.hasOwnProperty(_)&&($[_]=v[_]);if(o&&o.defaultProps){var D=o.defaultProps;for(_ in D)$[_]===void 0&&($[_]=D[_])}if(P||X){var W=typeof o=="function"?o.displayName||o.name||"Unknown":o;P&&ai($,W),X&&ui($,W)}return si(o,P,X,j,S,In.current,$)}}var Lt=h.ReactCurrentOwner,Wn=h.ReactDebugCurrentFrame;function Fe(o){if(o){var v=o._owner,C=dt(o.type,o._source,v?v.type:null);Wn.setExtraStackFrame(C)}else Wn.setExtraStackFrame(null)}var At;At=!1;function It(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function Un(){{if(Lt.current){var o=L(Lt.current.type);if(o)return`
22
22
 
23
- Check the render method of \``+a+"`."}return""}}function ra(a){return""}var hr={};function na(a){{var h=mr();if(!h){var E=typeof a=="string"?a:a.displayName||a.name;E&&(h=`
23
+ Check the render method of \``+o+"`."}return""}}function ci(o){return""}var Hn={};function fi(o){{var v=Un();if(!v){var C=typeof o=="string"?o:o.displayName||o.name;C&&(v=`
24
24
 
25
- Check the top-level render call using <`+E+">.")}return h}}function br(a,h){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var E=na(h);if(hr[E])return;hr[E]=!0;var P="";a&&a._owner&&a._owner!==mt.current&&(P=" It was passed a child from "+c(a._owner.type)+"."),xe(a),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',E,P),xe(null)}}function gr(a,h){{if(typeof a!="object")return;if(pt(a))for(var E=0;E<a.length;E++){var P=a[E];bt(P)&&br(P,h)}else if(bt(a))a._store&&(a._store.validated=!0);else if(a){var D=f(a);if(typeof D=="function"&&D!==a.entries)for(var W=D.call(a),A;!(A=W.next()).done;)bt(A.value)&&br(A.value,h)}}}function aa(a){{var h=a.type;if(h==null||typeof h=="string")return;var E;if(typeof h=="function")E=h.propTypes;else if(typeof h=="object"&&(h.$$typeof===o||h.$$typeof===T))E=h.propTypes;else return;if(E){var P=c(h);Hn(E,a.props,"prop",P,a)}else if(h.PropTypes!==void 0&&!ht){ht=!0;var D=c(h);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof h.getDefaultProps=="function"&&!h.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ia(a){{for(var h=Object.keys(a.props),E=0;E<h.length;E++){var P=h[E];if(P!=="children"&&P!=="key"){xe(a),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",P),xe(null);break}}a.ref!==null&&(xe(a),g("Invalid attribute `ref` supplied to `React.Fragment`."),xe(null))}}var yr={};function wr(a,h,E,P,D,W){{var A=Y(a);if(!A){var N="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(N+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var z=ra();z?N+=z:N+=mr();var H;a===null?H="null":pt(a)?H="array":a!==void 0&&a.$$typeof===e?(H="<"+(c(a.type)||"Unknown")+" />",N=" Did you accidentally export a JSX literal instead of a component?"):H=typeof a,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",H,N)}var q=ta(a,h,E,D,W);if(q==null)return q;if(A){var ne=h.children;if(ne!==void 0)if(P)if(pt(ne)){for(var Ee=0;Ee<ne.length;Ee++)gr(ne[Ee],a);Object.freeze&&Object.freeze(ne)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else gr(ne,a)}if(Ie.call(h,"key")){var be=c(a),J=Object.keys(h).filter(function(da){return da!=="key"}),gt=J.length>0?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}";if(!yr[be+gt]){var ca=J.length>0?"{"+J.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+C+">.")}return v}}function Bn(o,v){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var C=fi(v);if(Hn[C])return;Hn[C]=!0;var S="";o&&o._owner&&o._owner!==Lt.current&&(S=" It was passed a child from "+L(o._owner.type)+"."),Fe(o),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',C,S),Fe(null)}}function Vn(o,v){{if(typeof o!="object")return;if(_t(o))for(var C=0;C<o.length;C++){var S=o[C];It(S)&&Bn(S,v)}else if(It(o))o._store&&(o._store.validated=!0);else if(o){var j=f(o);if(typeof j=="function"&&j!==o.entries)for(var _=j.call(o),$;!($=_.next()).done;)It($.value)&&Bn($.value,v)}}}function mi(o){{var v=o.type;if(v==null||typeof v=="string")return;var C;if(typeof v=="function")C=v.propTypes;else if(typeof v=="object"&&(v.$$typeof===a||v.$$typeof===b))C=v.propTypes;else return;if(C){var S=L(v);Ql(C,o.props,"prop",S,o)}else if(v.PropTypes!==void 0&&!At){At=!0;var j=L(v);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",j||"Unknown")}typeof v.getDefaultProps=="function"&&!v.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pi(o){{for(var v=Object.keys(o.props),C=0;C<v.length;C++){var S=v[C];if(S!=="children"&&S!=="key"){Fe(o),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),Fe(null);break}}o.ref!==null&&(Fe(o),g("Invalid attribute `ref` supplied to `React.Fragment`."),Fe(null))}}var Yn={};function qn(o,v,C,S,j,_){{var $=H(o);if(!$){var P="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(P+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var X=ci();X?P+=X:P+=Un();var D;o===null?D="null":_t(o)?D="array":o!==void 0&&o.$$typeof===t?(D="<"+(L(o.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):D=typeof o,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",D,P)}var W=di(o,v,C,j,_);if(W==null)return W;if($){var ee=v.children;if(ee!==void 0)if(S)if(_t(ee)){for(var ke=0;ke<ee.length;ke++)Vn(ee[ke],o);Object.freeze&&Object.freeze(ee)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Vn(ee,o)}if(Xe.call(v,"key")){var Se=L(o),G=Object.keys(v).filter(function(wi){return wi!=="key"}),Nt=G.length>0?"{key: someKey, "+G.join(": ..., ")+": ...}":"{key: someKey}";if(!Yn[Se+Nt]){var bi=G.length>0?"{"+G.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,gt,be,ca,be),yr[be+gt]=!0}}return a===n?ia(q):aa(q),q}}function sa(a,h,E){return wr(a,h,E,!0)}function la(a,h,E){return wr(a,h,E,!1)}var oa=la,ua=sa;Oe.Fragment=n,Oe.jsx=oa,Oe.jsxs=ua}()),Oe}process.env.NODE_ENV==="production"?Qe.exports=Or():Qe.exports=kr();var F=Qe.exports;const xt={modifiedElements:[],bodyState:{hasOverflowHidden:!1,hasPointerEventsNone:!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),document.body.classList.contains("pointer-events-none")||(document.body.classList.add("pointer-events-none"),this.bodyState.hasPointerEventsNone=!0),Array.from(document.body.children).forEach(r=>{!r.classList.contains("im-dialog")&&r.getAttribute("aria-hidden")!=="true"&&(r.setAttribute("aria-hidden","true"),this.modifiedElements.push(r))})},cleanup(){this.bodyState.hasOverflowHidden&&(document.body.classList.remove("overflow-hidden"),this.bodyState.hasOverflowHidden=!1),this.bodyState.hasPointerEventsNone&&(document.body.classList.remove("pointer-events-none"),this.bodyState.hasPointerEventsNone=!1),document.body.style.paddingRight=this.bodyState.originalPaddingRight,this.bodyState.originalPaddingRight="",this.modifiedElements.forEach(t=>{t.removeAttribute("aria-hidden")}),this.modifiedElements=[]}};function Pr(t,e){return Array.isArray(t)?t.filter(r=>!e.includes(r)):Object.keys(t).reduce((r,n)=>(e.includes(n)||(r[n]=t[n]),r),{})}function Et(t,e){return Array.isArray(t)?t.filter(r=>e.includes(r)):e.reduce((r,n)=>(n in t&&(r[n]=t[n]),r),{})}function Fr(t){return Array.isArray(t)?t.filter(e=>e!==null):Object.keys(t).reduce((e,r)=>(r in t&&t[r]!==null&&(e[r]=t[r]),e),{})}function jr(t,e=3,r=10){return new Promise((n,i)=>{const l=t();if(l){n(l);return}let s=e*1e3/r;const b=setInterval(()=>{const o=t();o&&(clearInterval(b),n(o)),--s<=0&&(clearInterval(b),i(new Error("Condition not met in time")))},r)})}function ke(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,r)=>r.toUpperCase()),t=t.replace(/(.)(?=[A-Z])/g,"$1-"),t.toLowerCase()):t):""}const Me=u.createContext(null);Me.displayName="ModalStackContext";let Tt=null,St=null,Pe=null,et=null,tt=[];const Ct=({children:t})=>{const[e,r]=u.useState([]),[n,i]=u.useState({}),l=v=>{r(f=>{const m=v([...f]),g=S=>{var k;return m.length<2?!0:((k=m.map(_=>({id:_.id,shouldRender:_.shouldRender})).reverse().find(_=>_.shouldRender))==null?void 0:k.id)===S};return m.forEach((S,k)=>{m[k].onTopOfStack=g(S.id),m[k].getParentModal=()=>k<1?null:m.slice(0,k).reverse().find(_=>_.isOpen),m[k].getChildModal=()=>k===m.length-1?null:m.slice(k+1).find(_=>_.isOpen)}),m})};u.useEffect(()=>{tt=e},[e]);class s{constructor(f,m,g,S,k){ae(this,"update",(f,m,g)=>{l(S=>S.map(k=>(k.id===this.id&&(k.config=f,k.onCloseCallback=m,k.afterLeaveCallback=g),k)))});ae(this,"show",()=>{l(f=>f.map(m=>(m.id===this.id&&!m.isOpen&&(m.isOpen=!0,m.shouldRender=!0),m)))});ae(this,"setOpen",f=>{f?this.show():this.close()});ae(this,"close",()=>{l(f=>f.map(m=>{var g;return m.id===this.id&&m.isOpen&&(Object.keys(m.listeners).forEach(S=>{m.off(S)}),m.isOpen=!1,(g=m.onCloseCallback)==null||g.call(m)),m}))});ae(this,"afterLeave",()=>{this.isOpen||l(f=>{const m=f.map(g=>{var S;return g.id===this.id&&!g.isOpen&&(g.shouldRender=!1,(S=g.afterLeaveCallback)==null||S.call(g),g.afterLeaveCallback=null),g});return this.index===0?[]:m})});ae(this,"on",(f,m)=>{f=ke(f),this.listeners[f]=this.listeners[f]??[],this.listeners[f].push(m)});ae(this,"off",(f,m)=>{var g;f=ke(f),m?this.listeners[f]=((g=this.listeners[f])==null?void 0:g.filter(S=>S!==m))??[]:delete this.listeners[f]});ae(this,"emit",(f,...m)=>{var g;(g=this.listeners[ke(f)])==null||g.forEach(S=>S(...m))});ae(this,"registerEventListenersFromProps",f=>{const m=[];return Object.keys(f).filter(g=>g.startsWith("on")).forEach(g=>{const S=ke(g).replace(/^on-/,"");this.on(S,f[g]),m.push(()=>this.off(S,f[g]))}),()=>m.forEach(g=>g())});ae(this,"reload",(f={})=>{var g;let m=Object.keys(this.response.props);f.only&&(m=Et(m,f.only)),f.except&&(m=Pr(m,f.except)),(g=this.response)!=null&&g.url&&le.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":m.join(","),"X-InertiaUI-Modal":!0,"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":Pe}}).then(S=>{this.updateProps(S.data.props)})});ae(this,"updateProps",f=>{Object.assign(this.props,f),l(m=>m)});this.id=s.generateId(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=f,this.props=m.props,this.response=m,this.config=g,this.onCloseCallback=S,this.afterLeaveCallback=k,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 b=(v,f={},m=null,g=null)=>St(v.component).then(S=>o(S,v,f,m,g)),o=(v,f,m,g,S)=>{const k=new s(v,f,m,g,S);return k.index=e.length,l(_=>[..._,k]),k.show(),k};function y(v,f,m,g){if(!n[v])throw new Error(`The local modal "${v}" has not been registered.`);const S=o(null,{},f,m,g);return S.name=v,n[v].callback(S),S}const p=(v,f={})=>T(v,f.method??"get",f.data??{},f.headers??{},f.config??{},f.onClose,f.onAfterLeave,f.queryStringArrayFormat??"brackets",f.navigate??_e("navigate")).then(m=>{const g=f.listeners??{};return Object.keys(g).forEach(S=>{const k=ke(S);m.on(k,g[S])}),m}),T=(v,f,m={},g={},S={},k=null,_=null,ie="brackets",V=!1)=>new Promise((G,Z)=>{if(v.startsWith("#")){G(y(v.substring(1),S,k,_));return}const[Y,X]=xr.mergeDataIntoQueryString(f,v||"",m,ie);let I=V&&e.length===0;if(e.length===0&&(Pe=typeof window<"u"?window.location.href:""),g={...g,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":Tt,"X-InertiaUI-Modal":!0,"X-InertiaUI-Modal-Use-Router":I?1:0,"X-InertiaUI-Modal-Base-Url":Pe},I)return et=null,ge.router.visit(Y,{method:f,data:X,headers:g,preserveScroll:!0,preserveState:!0,onError:Z,onFinish:()=>{jr(()=>et).then(c=>{const d=c.onCloseCallback,w=c.afterLeaveCallback;c.update(S,()=>{k==null||k(),d==null||d()},()=>{_==null||_(),w==null||w()}),G(c)})}});le({url:Y,method:f,data:X,headers:g}).then(c=>G(b(c.data,S,k,_))).catch(c=>{Z(c)})}),x={stack:e,localModals:n,push:o,pushFromResponseData:b,closeAll:()=>{tt.reverse().forEach(v=>v.close())},reset:()=>l(()=>[]),visit:T,visitModal:p,registerLocalModal:(v,f)=>{i(m=>({...m,[v]:{name:v,callback:f}}))},removeLocalModal:v=>{i(f=>{const m={...f};return delete m[v],m})}};return F.jsx(Me.Provider,{value:x,children:t})},Fe=()=>{const t=u.useContext(Me);if(t===null)throw new Error("useModalStack must be used within a ModalStackProvider");return t},Ot=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],kt=t=>{t.initialPage&&(Tt=t.initialPage.version),t.resolveComponent&&(St=t.resolveComponent)},Nr=(t,e)=>{kt(e);const r=({Component:n,props:i,key:l})=>{const s=()=>{const b=u.createElement(n,{key:l,...i});return typeof n.layout=="function"?n.layout(b):Array.isArray(n.layout)?n.layout.concat(b).reverse().reduce((y,p)=>u.createElement(p,i,y)):b};return F.jsxs(F.Fragment,{children:[s(),F.jsx(Pt,{})]})};return F.jsx(Ct,{children:F.jsx(t,{...e,children:r})})},Pt=({children:t})=>{var b;const e=u.useContext(Me);let r=!1,n=!1;u.useEffect(()=>ge.router.on("start",()=>r=!0),[]),u.useEffect(()=>ge.router.on("finish",()=>r=!1),[]),u.useEffect(()=>ge.router.on("navigate",function(o){const y=o.detail.page.props._inertiaui_modal;if(!y){n&&e.closeAll();return}n=y,Pe=y.baseUrl,e.pushFromResponseData(y,{},()=>{if(!y.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!r&&window.location.href!==y.baseUrl&&ge.router.visit(y.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(p=>{et=p})}),[]);const i=o=>(tt.length&&(o.headers["X-InertiaUI-Modal-Base-Url"]=Pe),o);u.useEffect(()=>(le.interceptors.request.use(i),()=>le.interceptors.request.eject(i)),[]);const l=ge.usePage(),s=u.useRef();return u.useEffect(()=>{var p,T;const o=(p=l.props)==null?void 0:p._inertiaui_modal,y=s.current;s.current=o,o&&y&&o.component===y.component&&o.url===y.url&&((T=e.stack[0])==null||T.updateProps(o.props??{}))},[(b=l.props)==null?void 0:b._inertiaui_modal]),F.jsxs(F.Fragment,{children:[t,e.stack.length>0&&F.jsx(Ft,{index:0})]})},rt=u.createContext(null);rt.displayName="ModalIndexContext";const nt=()=>{const t=u.useContext(rt);if(t===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return t},Ft=({index:t})=>{const{stack:e}=Fe(),r=u.useMemo(()=>e[t],[e,t]);return(r==null?void 0:r.component)&&F.jsx(rt.Provider,{value:t,children:F.jsx(r.component,{...r.props,onModalEvent:(...n)=>r.emit(...n)})})},at=u.forwardRef(({name:t,children:e,...r},n)=>{const i=nt(),{stack:l,registerLocalModal:s,removeLocalModal:b}=Fe(),[o,y]=u.useState(null),p=u.useMemo(()=>t?o:l[i],[t,o,i,l]),T=u.useMemo(()=>{var v;return(v=l.find(f=>f.shouldRender&&f.index>(p==null?void 0:p.index)))==null?void 0:v.index},[i,l]),C=u.useMemo(()=>(p==null?void 0:p.config.slideover)??r.slideover??_e("type")==="slideover",[r.slideover]),O=u.useMemo(()=>({slideover:C,closeButton:r.closeButton??ye(C,"closeButton"),closeExplicitly:r.closeExplicitly??ye(C,"closeExplicitly"),maxWidth:r.maxWidth??ye(C,"maxWidth"),paddingClasses:r.paddingClasses??ye(C,"paddingClasses"),panelClasses:r.panelClasses??ye(C,"panelClasses"),position:r.position??ye(C,"position"),...p==null?void 0:p.config}),[r,p==null?void 0:p.config]);u.useEffect(()=>{if(t){let v=null;return s(t,f=>{v=f.registerEventListenersFromProps(r),y(f)}),()=>{v==null||v(),v=null,b(t)}}return p.registerEventListenersFromProps(r)},[t]);const x=u.useRef(p);return u.useEffect(()=>{x.current=p},[p]),u.useImperativeHandle(n,()=>({afterLeave:()=>{var v;return(v=x.current)==null?void 0:v.afterLeave()},close:()=>{var v;return(v=x.current)==null?void 0:v.close()},emit:(...v)=>{var f;return(f=x.current)==null?void 0:f.emit(...v)},getChildModal:()=>{var v;return(v=x.current)==null?void 0:v.getChildModal()},getParentModal:()=>{var v;return(v=x.current)==null?void 0:v.getParentModal()},reload:(...v)=>{var f;return(f=x.current)==null?void 0:f.reload(...v)},setOpen:()=>{var v;return(v=x.current)==null?void 0:v.setOpen()},get id(){var v;return(v=x.current)==null?void 0:v.id},get index(){var v;return(v=x.current)==null?void 0:v.index},get isOpen(){var v;return(v=x.current)==null?void 0:v.isOpen},get config(){var v;return(v=x.current)==null?void 0:v.config},get modalContext(){return x.current},get onTopOfStack(){var v;return(v=x.current)==null?void 0:v.onTopOfStack},get shouldRender(){var v;return(v=x.current)==null?void 0:v.shouldRender}}),[p]),(p==null?void 0:p.shouldRender)&&F.jsxs(F.Fragment,{children:[typeof e=="function"?e({afterLeave:p.afterLeave,close:p.close,config:O,emit:p.emit,getChildModal:p.getChildModal,getParentModal:p.getParentModal,id:p.id,index:p.index,isOpen:p.isOpen,modalContext:p,onTopOfStack:p.onTopOfStack,reload:p.reload,setOpen:p.setOpen,shouldRender:p.shouldRender}):e,T&&F.jsx(Ft,{index:T})]})});at.displayName="HeadlessModal";function jt(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=jt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Re(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=jt(t))&&(n&&(n+=" "),n+=e);return n}var Ir=Object.defineProperty,Ar=(t,e,r)=>e in t?Ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,it=(t,e,r)=>(Ar(t,typeof e!="symbol"?e+"":e,r),r);let _r=class{constructor(){it(this,"current",this.detect()),it(this,"handoffState","pending"),it(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"}},De=new _r;function Mr(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function Le(){let t=[],e={addEventListener(r,n,i,l){return r.addEventListener(n,i,l),e.add(()=>r.removeEventListener(n,i,l))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return e.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return e.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Mr(()=>{n.current&&r[0]()}),e.add(()=>{n.current=!1})},style(r,n,i){let l=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:i}),this.add(()=>{Object.assign(r.style,{[n]:l})})},group(r){let n=Le();return r(n),this.add(()=>n.dispose())},add(r){return t.includes(r)||t.push(r),()=>{let n=t.indexOf(r);if(n>=0)for(let i of t.splice(n,1))i()}},dispose(){for(let r of t.splice(0))r()}};return e}function Nt(){let[t]=u.useState(Le);return u.useEffect(()=>()=>t.dispose(),[t]),t}let ce=(t,e)=>{De.isServer?u.useEffect(t,e):u.useLayoutEffect(t,e)};function It(t){let e=u.useRef(t);return ce(()=>{e.current=t},[t]),e}let oe=function(t){let e=It(t);return u.useCallback((...r)=>e.current(...r),[e])};function st(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function $e(t,e,...r){if(t in e){let i=e[t];return typeof i=="function"?i(...r):i}let n=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(n,$e),n}var At=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(At||{}),de=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(de||{});function _t(){let t=Dr();return u.useCallback(e=>Rr({mergeRefs:t,...e}),[t])}function Rr({ourProps:t,theirProps:e,slot:r,defaultTag:n,features:i,visible:l=!0,name:s,mergeRefs:b}){b=b??Lr;let o=Mt(e,t);if(l)return We(o,r,n,s,b);let y=i??0;if(y&2){let{static:p=!1,...T}=o;if(p)return We(T,r,n,s,b)}if(y&1){let{unmount:p=!0,...T}=o;return $e(p?0:1,{0(){return null},1(){return We({...T,hidden:!0,style:{display:"none"}},r,n,s,b)}})}return We(o,r,n,s,b)}function We(t,e={},r,n,i){let{as:l=r,children:s,refName:b="ref",...o}=ot(t,["unmount","static"]),y=t.ref!==void 0?{[b]:t.ref}:{},p=typeof s=="function"?s(e):s;"className"in o&&o.className&&typeof o.className=="function"&&(o.className=o.className(e)),o["aria-labelledby"]&&o["aria-labelledby"]===o.id&&(o["aria-labelledby"]=void 0);let T={};if(e){let C=!1,O=[];for(let[x,v]of Object.entries(e))typeof v=="boolean"&&(C=!0),v===!0&&O.push(x.replace(/([A-Z])/g,f=>`-${f.toLowerCase()}`));if(C){T["data-headlessui-state"]=O.join(" ");for(let x of O)T[`data-${x}`]=""}}if(l===u.Fragment&&(Object.keys(ve(o)).length>0||Object.keys(ve(T)).length>0))if(!u.isValidElement(p)||Array.isArray(p)&&p.length>1){if(Object.keys(ve(o)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(ve(o)).concat(Object.keys(ve(T))).map(C=>` - ${C}`).join(`
31
- `),"","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(C=>` - ${C}`).join(`
30
+ <%s key={someKey} {...props} />`,Nt,Se,bi,Se),Yn[Se+Nt]=!0}}return o===r?pi(W):mi(W),W}}function hi(o,v,C){return qn(o,v,C,!0)}function vi(o,v,C){return qn(o,v,C,!1)}var gi=vi,Ei=hi;Ae.Fragment=r,Ae.jsx=gi,Ae.jsxs=Ei}()),Ae}process.env.NODE_ENV==="production"?ft.exports=Zn():ft.exports=Qn();var O=ft.exports;function er(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 Ut(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 tr(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 nr(e,t=3,n=10){return new Promise((r,l)=>{const u=e();if(u){r(u);return}let s=t*1e3/n;const d=setInterval(()=>{const a=e();a&&(clearInterval(d),r(a)),--s<=0&&(clearInterval(d),l(new Error("Condition not met in time")))},n)})}function Ie(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 Ge=i.createContext(null);Ge.displayName="ModalStackContext";let Ht=null,Bt=null,Ne=null,mt=null,pt=[];const Vt=({children:e})=>{const[t,n]=i.useState([]),[r,l]=i.useState({}),u=m=>{n(f=>{const h=m([...f]),g=x=>{var T;return h.length<2?!0:((T=h.map(F=>({id:F.id,shouldRender:F.shouldRender})).reverse().find(F=>F.shouldRender))==null?void 0:T.id)===x};return h.forEach((x,T)=>{h[T].onTopOfStack=g(x.id),h[T].getParentModal=()=>T<1?null:h.slice(0,T).reverse().find(F=>F.isOpen),h[T].getChildModal=()=>T===h.length-1?null:h.slice(T+1).find(F=>F.isOpen)}),h})};i.useEffect(()=>{pt=t},[t]);class s{constructor(f,h,g,x,T){te(this,"update",(f,h,g)=>{u(x=>x.map(T=>(T.id===this.id&&(T.config=f,T.onCloseCallback=h,T.afterLeaveCallback=g),T)))});te(this,"show",()=>{u(f=>f.map(h=>(h.id===this.id&&!h.isOpen&&(h.isOpen=!0,h.shouldRender=!0),h)))});te(this,"setOpen",f=>{f?this.show():this.close()});te(this,"close",()=>{u(f=>f.map(h=>{var g;return h.id===this.id&&h.isOpen&&(Object.keys(h.listeners).forEach(x=>{h.off(x)}),h.isOpen=!1,(g=h.onCloseCallback)==null||g.call(h)),h}))});te(this,"afterLeave",()=>{this.isOpen||u(f=>{const h=f.map(g=>{var x;return g.id===this.id&&!g.isOpen&&(g.shouldRender=!1,(x=g.afterLeaveCallback)==null||x.call(g),g.afterLeaveCallback=null),g});return this.index===0?[]:h})});te(this,"on",(f,h)=>{f=Ie(f),this.listeners[f]=this.listeners[f]??[],this.listeners[f].push(h)});te(this,"off",(f,h)=>{var g;f=Ie(f),h?this.listeners[f]=((g=this.listeners[f])==null?void 0:g.filter(x=>x!==h))??[]:delete this.listeners[f]});te(this,"emit",(f,...h)=>{var g;(g=this.listeners[Ie(f)])==null||g.forEach(x=>x(...h))});te(this,"registerEventListenersFromProps",f=>{const h=[];return Object.keys(f).filter(g=>g.startsWith("on")).forEach(g=>{const x=Ie(g).replace(/^on-/,"");this.on(x,f[g]),h.push(()=>this.off(x,f[g]))}),()=>h.forEach(g=>g())});te(this,"reload",(f={})=>{var g;let h=Object.keys(this.response.props);f.only&&(h=Ut(h,f.only)),f.except&&(h=er(h,f.except)),(g=this.response)!=null&&g.url&&le.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":!0,"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":Ne}}).then(x=>{this.updateProps(x.data.props)})});te(this,"updateProps",f=>{Object.assign(this.props,f),u(h=>h)});this.id=s.generateId(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=f,this.props=h.props,this.response=h,this.config=g,this.onCloseCallback=x,this.afterLeaveCallback=T,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 d=(m,f={},h=null,g=null)=>Bt(m.component).then(x=>a(x,m,f,h,g)),a=(m,f,h,g,x)=>{const T=new s(m,f,h,g,x);return T.index=t.length,u(F=>[...F,T]),T.show(),T};function p(m,f,h,g){if(!r[m])throw new Error(`The local modal "${m}" has not been registered.`);const x=a(null,{},f,h,g);return x.name=m,r[m].callback(x),x}const c=(m,f={})=>b(m,f.method??"get",f.data??{},f.headers??{},f.config??{},f.onClose,f.onAfterLeave,f.queryStringArrayFormat??"brackets",f.navigate??Ke("navigate")).then(h=>{const g=f.listeners??{};return Object.keys(g).forEach(x=>{const T=Ie(x);h.on(T,g[x])}),h}),b=(m,f,h={},g={},x={},T=null,F=null,Y="brackets",U=!1)=>new Promise((J,R)=>{if(m.startsWith("#")){J(p(m.substring(1),x,T,F));return}const[H,q]=Xn.mergeDataIntoQueryString(f,m||"",h,Y);let K=U&&t.length===0;if(t.length===0&&(Ne=typeof window<"u"?window.location.href:""),g={...g,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":Ht,"X-InertiaUI-Modal":!0,"X-InertiaUI-Modal-Use-Router":K?1:0,"X-InertiaUI-Modal-Base-Url":Ne},K)return mt=null,Oe.router.visit(H,{method:f,data:q,headers:g,preserveScroll:!0,preserveState:!0,onError:R,onFinish:()=>{nr(()=>mt).then(L=>{const M=L.onCloseCallback,I=L.afterLeaveCallback;L.update(x,()=>{T==null||T(),M==null||M()},()=>{F==null||F(),I==null||I()}),J(L)})}});le({url:H,method:f,data:q,headers:g}).then(L=>J(d(L.data,x,T,F))).catch(L=>{R(L)})}),E={stack:t,localModals:r,push:a,pushFromResponseData:d,closeAll:()=>{pt.reverse().forEach(m=>m.close())},reset:()=>u(()=>[]),visit:b,visitModal:c,registerLocalModal:(m,f)=>{l(h=>({...h,[m]:{name:m,callback:f}}))},removeLocalModal:m=>{l(f=>{const h={...f};return delete h[m],h})}};return O.jsx(Ge.Provider,{value:E,children:e})},De=()=>{const e=i.useContext(Ge);if(e===null)throw new Error("useModalStack must be used within a ModalStackProvider");return e},Yt=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],qt=e=>{e.initialPage&&(Ht=e.initialPage.version),e.resolveComponent&&(Bt=e.resolveComponent)},rr=(e,t)=>{qt(t);const n=({Component:r,props:l,key:u})=>{const s=()=>{const d=i.createElement(r,{key:u,...l});return typeof r.layout=="function"?r.layout(d):Array.isArray(r.layout)?r.layout.concat(d).reverse().reduce((p,c)=>i.createElement(c,l,p)):d};return O.jsxs(O.Fragment,{children:[s(),O.jsx(Xt,{})]})};return O.jsx(Vt,{children:O.jsx(e,{...t,children:n})})},Xt=({children:e})=>{var d;const t=i.useContext(Ge);let n=!1,r=!1;i.useEffect(()=>Oe.router.on("start",()=>n=!0),[]),i.useEffect(()=>Oe.router.on("finish",()=>n=!1),[]),i.useEffect(()=>Oe.router.on("navigate",function(a){const p=a.detail.page.props._inertiaui_modal;if(!p){r&&t.closeAll();return}r=p,Ne=p.baseUrl,t.pushFromResponseData(p,{},()=>{if(!p.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!n&&window.location.href!==p.baseUrl&&Oe.router.visit(p.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(c=>{mt=c})}),[]);const l=a=>(pt.length&&(a.headers["X-InertiaUI-Modal-Base-Url"]=Ne),a);i.useEffect(()=>(le.interceptors.request.use(l),()=>le.interceptors.request.eject(l)),[]);const u=Oe.usePage(),s=i.useRef();return i.useEffect(()=>{var c,b;const a=(c=u.props)==null?void 0:c._inertiaui_modal,p=s.current;s.current=a,a&&p&&a.component===p.component&&a.url===p.url&&((b=t.stack[0])==null||b.updateProps(a.props??{}))},[(d=u.props)==null?void 0:d._inertiaui_modal]),O.jsxs(O.Fragment,{children:[e,t.stack.length>0&&O.jsx(zt,{index:0})]})},ht=i.createContext(null);ht.displayName="ModalIndexContext";const vt=()=>{const e=i.useContext(ht);if(e===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return e},zt=({index:e})=>{const{stack:t}=De(),n=i.useMemo(()=>t[e],[t,e]);return(n==null?void 0:n.component)&&O.jsx(ht.Provider,{value:e,children:O.jsx(n.component,{...n.props,onModalEvent:(...r)=>n.emit(...r)})})},gt=i.forwardRef(({name:e,children:t,...n},r)=>{const l=vt(),{stack:u,registerLocalModal:s,removeLocalModal:d}=De(),[a,p]=i.useState(null),c=i.useMemo(()=>e?a:u[l],[e,a,l,u]),b=i.useMemo(()=>{var m;return(m=u.find(f=>f.shouldRender&&f.index>(c==null?void 0:c.index)))==null?void 0:m.index},[l,u]),y=i.useMemo(()=>(c==null?void 0:c.config.slideover)??n.slideover??Ke("type")==="slideover",[n.slideover]),w=i.useMemo(()=>({slideover:y,closeButton:n.closeButton??Pe(y,"closeButton"),closeExplicitly:n.closeExplicitly??Pe(y,"closeExplicitly"),maxWidth:n.maxWidth??Pe(y,"maxWidth"),paddingClasses:n.paddingClasses??Pe(y,"paddingClasses"),panelClasses:n.panelClasses??Pe(y,"panelClasses"),position:n.position??Pe(y,"position"),...c==null?void 0:c.config}),[n,c==null?void 0:c.config]);i.useEffect(()=>{if(e){let m=null;return s(e,f=>{m=f.registerEventListenersFromProps(n),p(f)}),()=>{m==null||m(),m=null,d(e)}}return c.registerEventListenersFromProps(n)},[e]);const E=i.useRef(c);return i.useEffect(()=>{E.current=c},[c]),i.useImperativeHandle(r,()=>({afterLeave:()=>{var m;return(m=E.current)==null?void 0:m.afterLeave()},close:()=>{var m;return(m=E.current)==null?void 0:m.close()},emit:(...m)=>{var f;return(f=E.current)==null?void 0:f.emit(...m)},getChildModal:()=>{var m;return(m=E.current)==null?void 0:m.getChildModal()},getParentModal:()=>{var m;return(m=E.current)==null?void 0:m.getParentModal()},reload:(...m)=>{var f;return(f=E.current)==null?void 0:f.reload(...m)},setOpen:()=>{var m;return(m=E.current)==null?void 0:m.setOpen()},get id(){var m;return(m=E.current)==null?void 0:m.id},get index(){var m;return(m=E.current)==null?void 0:m.index},get isOpen(){var m;return(m=E.current)==null?void 0:m.isOpen},get config(){var m;return(m=E.current)==null?void 0:m.config},get modalContext(){return E.current},get onTopOfStack(){var m;return(m=E.current)==null?void 0:m.onTopOfStack},get shouldRender(){var m;return(m=E.current)==null?void 0:m.shouldRender}}),[c]),(c==null?void 0:c.shouldRender)&&O.jsxs(O.Fragment,{children:[typeof t=="function"?t({afterLeave:c.afterLeave,close:c.close,config:w,emit:c.emit,getChildModal:c.getChildModal,getParentModal:c.getParentModal,id:c.id,index:c.index,isOpen:c.isOpen,modalContext:c,onTopOfStack:c.onTopOfStack,reload:c.reload,setOpen:c.setOpen,shouldRender:c.shouldRender}):t,b&&O.jsx(zt,{index:b})]})});gt.displayName="HeadlessModal";function Kt(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=Kt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Je(){for(var e,t,n=0,r="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=Kt(e))&&(r&&(r+=" "),r+=t);return r}var lr=Object.defineProperty,ir=(e,t,n)=>t in e?lr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Et=(e,t,n)=>(ir(e,typeof t!="symbol"?t+"":t,n),n);let or=class{constructor(){Et(this,"current",this.detect()),Et(this,"handoffState","pending"),Et(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"}},pe=new or;function Re(e){return pe.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Ze(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function se(){let e=[],t={addEventListener(n,r,l,u){return n.addEventListener(r,l,u),t.add(()=>n.removeEventListener(r,l,u))},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 Ze(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let u=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:u})})},group(n){let r=se();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 bt(){let[e]=i.useState(se);return i.useEffect(()=>()=>e.dispose(),[e]),e}let V=(e,t)=>{pe.isServer?i.useEffect(e,t):i.useLayoutEffect(e,t)};function he(e){let t=i.useRef(e);return V(()=>{t.current=e},[e]),t}let A=function(e){let t=he(e);return i.useCallback((...n)=>t.current(...n),[t])},ar=i.createContext(void 0);function ur(){return i.useContext(ar)}function wt(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function de(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,de),r}var Qe=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Qe||{}),ce=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ce||{});function Q(){let e=dr();return i.useCallback(t=>sr({mergeRefs:e,...t}),[e])}function sr({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:l,visible:u=!0,name:s,mergeRefs:d}){d=d??cr;let a=Gt(t,e);if(u)return et(a,n,r,s,d);let p=l??0;if(p&2){let{static:c=!1,...b}=a;if(c)return et(b,n,r,s,d)}if(p&1){let{unmount:c=!0,...b}=a;return de(c?0:1,{0(){return null},1(){return et({...b,hidden:!0,style:{display:"none"}},n,r,s,d)}})}return et(a,n,r,s,d)}function et(e,t={},n,r,l){let{as:u=n,children:s,refName:d="ref",...a}=yt(e,["unmount","static"]),p=e.ref!==void 0?{[d]:e.ref}:{},c=typeof s=="function"?s(t):s;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let b={};if(t){let y=!1,w=[];for(let[E,m]of Object.entries(t))typeof m=="boolean"&&(y=!0),m===!0&&w.push(E.replace(/([A-Z])/g,f=>`-${f.toLowerCase()}`));if(y){b["data-headlessui-state"]=w.join(" ");for(let E of w)b[`data-${E}`]=""}}if(u===i.Fragment&&(Object.keys(ve(a)).length>0||Object.keys(ve(b)).length>0))if(!i.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(ve(a)).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(ve(a)).concat(Object.keys(ve(b))).map(y=>` - ${y}`).join(`
31
+ `),"","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(y=>` - ${y}`).join(`
32
32
  `)].join(`
33
- `))}else{let C=p.props,O=C==null?void 0:C.className,x=typeof O=="function"?(...m)=>st(O(...m),o.className):st(O,o.className),v=x?{className:x}:{},f=Mt(p.props,ve(ot(o,["ref"])));for(let m in T)m in f&&delete T[m];return u.cloneElement(p,Object.assign({},f,T,y,{ref:i($r(p),y.ref)},v))}return u.createElement(l,Object.assign({},ot(o,["ref"]),l!==u.Fragment&&y,l!==u.Fragment&&T),p)}function Dr(){let t=u.useRef([]),e=u.useCallback(r=>{for(let n of t.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return t.current=r,e}}function Lr(...t){return t.every(e=>e==null)?void 0:e=>{for(let r of t)r!=null&&(typeof r=="function"?r(e):r.current=e)}}function Mt(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},r={};for(let n of t)for(let i in n)i.startsWith("on")&&typeof n[i]=="function"?(r[i]!=null||(r[i]=[]),r[i].push(n[i])):e[i]=n[i];if(e.disabled||e["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[i=>{var l;return(l=i==null?void 0:i.preventDefault)==null?void 0:l.call(i)}]);for(let n in r)Object.assign(e,{[n](i,...l){let s=r[n];for(let b of s){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;b(i,...l)}}});return e}function lt(t){var e;return Object.assign(u.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function ve(t){let e=Object.assign({},t);for(let r in e)e[r]===void 0&&delete e[r];return e}function ot(t,e=[]){let r=Object.assign({},t);for(let n of e)n in r&&delete r[n];return r}function $r(t){return u.version.split(".")[0]>="19"?t.props.ref:t.ref}let Wr=Symbol();function Rt(...t){let e=u.useRef(t);u.useEffect(()=>{e.current=t},[t]);let r=oe(n=>{for(let i of e.current)i!=null&&(typeof i=="function"?i(n):i.current=n)});return t.every(n=>n==null||(n==null?void 0:n[Wr]))?void 0:r}function Ur(t=0){let[e,r]=u.useState(t),n=u.useCallback(o=>r(o),[e]),i=u.useCallback(o=>r(y=>y|o),[e]),l=u.useCallback(o=>(e&o)===o,[e]),s=u.useCallback(o=>r(y=>y&~o),[r]),b=u.useCallback(o=>r(y=>y^o),[r]);return{flags:e,setFlag:n,addFlag:i,hasFlag:l,removeFlag:s,toggleFlag:b}}var Dt,Lt;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Dt=process==null?void 0:process.env)==null?void 0:Dt.NODE_ENV)==="test"&&typeof((Lt=Element==null?void 0:Element.prototype)==null?void 0:Lt.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(`
34
- `)),[]});var Br=(t=>(t[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t))(Br||{});function Kr(t){let e={};for(let r in t)t[r]===!0&&(e[`data-${r}`]="");return e}function Hr(t,e,r,n){let[i,l]=u.useState(r),{hasFlag:s,addFlag:b,removeFlag:o}=Ur(t&&i?3:0),y=u.useRef(!1),p=u.useRef(!1),T=Nt();return ce(()=>{var C;if(t){if(r&&l(!0),!e){r&&b(3);return}return(C=n==null?void 0:n.start)==null||C.call(n,r),Vr(e,{inFlight:y,prepare(){p.current?p.current=!1:p.current=y.current,y.current=!0,!p.current&&(r?(b(3),o(4)):(b(4),o(2)))},run(){p.current?r?(o(3),b(4)):(o(4),b(3)):r?o(1):b(1)},done(){var O;p.current&&typeof e.getAnimations=="function"&&e.getAnimations().length>0||(y.current=!1,o(7),r||l(!1),(O=n==null?void 0:n.end)==null||O.call(n,r))}})}},[t,r,e,T]),t?[i,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Vr(t,{prepare:e,run:r,done:n,inFlight:i}){let l=Le();return Yr(t,{prepare:e,inFlight:i}),l.nextFrame(()=>{r(),l.requestAnimationFrame(()=>{l.add(qr(t,n))})}),l.dispose}function qr(t,e){var r,n;let i=Le();if(!t)return i.dispose;let l=!1;i.add(()=>{l=!0});let s=(n=(r=t.getAnimations)==null?void 0:r.call(t).filter(b=>b instanceof CSSTransition))!=null?n:[];return s.length===0?(e(),i.dispose):(Promise.allSettled(s.map(b=>b.finished)).then(()=>{l||e()}),i.dispose)}function Yr(t,{inFlight:e,prepare:r}){if(e!=null&&e.current){r();return}let n=t.style.transition;t.style.transition="none",r(),t.offsetHeight,t.style.transition=n}/*!
35
- * tabbable 6.2.0
36
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
37
- */var $t=["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])"],Ue=$t.join(","),Wt=typeof Element>"u",pe=Wt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Be=!Wt&&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},Ke=function t(e,r){var n;r===void 0&&(r=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),l=i===""||i==="true",s=l||r&&e&&t(e.parentNode);return s},Xr=function(e){var r,n=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"contenteditable");return n===""||n==="true"},Ut=function(e,r,n){if(Ke(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Ue));return r&&pe.call(e,Ue)&&i.unshift(e),i=i.filter(n),i},Bt=function t(e,r,n){for(var i=[],l=Array.from(e);l.length;){var s=l.shift();if(!Ke(s,!1))if(s.tagName==="SLOT"){var b=s.assignedElements(),o=b.length?b:s.children,y=t(o,!0,n);n.flatten?i.push.apply(i,y):i.push({scopeParent:s,candidates:y})}else{var p=pe.call(s,Ue);p&&n.filter(s)&&(r||!e.includes(s))&&i.push(s);var T=s.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(s),C=!Ke(T,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(s));if(T&&C){var O=t(T===!0?s.children:T.children,!0,n);n.flatten?i.push.apply(i,O):i.push({scopeParent:s,candidates:O})}else l.unshift.apply(l,s.children)}}return i},Kt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},me=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Xr(e))&&!Kt(e)?0:e.tabIndex},zr=function(e,r){var n=me(e);return n<0&&r&&!Kt(e)?0:n},Gr=function(e,r){return e.tabIndex===r.tabIndex?e.documentOrder-r.documentOrder:e.tabIndex-r.tabIndex},Ht=function(e){return e.tagName==="INPUT"},Jr=function(e){return Ht(e)&&e.type==="hidden"},Zr=function(e){var r=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return r},Qr=function(e,r){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===r)return e[n]},en=function(e){if(!e.name)return!0;var r=e.form||Be(e),n=function(b){return r.querySelectorAll('input[type="radio"][name="'+b+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(s){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",s.message),!1}var l=Qr(i,e.form);return!l||l===e},tn=function(e){return Ht(e)&&e.type==="radio"},rn=function(e){return tn(e)&&!en(e)},nn=function(e){var r,n=e&&Be(e),i=(r=n)===null||r===void 0?void 0:r.host,l=!1;if(n&&n!==e){var s,b,o;for(l=!!((s=i)!==null&&s!==void 0&&(b=s.ownerDocument)!==null&&b!==void 0&&b.contains(i)||e!=null&&(o=e.ownerDocument)!==null&&o!==void 0&&o.contains(e));!l&&i;){var y,p,T;n=Be(i),i=(y=n)===null||y===void 0?void 0:y.host,l=!!((p=i)!==null&&p!==void 0&&(T=p.ownerDocument)!==null&&T!==void 0&&T.contains(i))}}return l},Vt=function(e){var r=e.getBoundingClientRect(),n=r.width,i=r.height;return n===0&&i===0},an=function(e,r){var n=r.displayCheck,i=r.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var l=pe.call(e,"details>summary:first-of-type"),s=l?e.parentElement:e;if(pe.call(s,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="legacy-full"){if(typeof i=="function"){for(var b=e;e;){var o=e.parentElement,y=Be(e);if(o&&!o.shadowRoot&&i(o)===!0)return Vt(e);e.assignedSlot?e=e.assignedSlot:!o&&y!==e.ownerDocument?e=y.host:e=o}e=b}if(nn(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Vt(e);return!1},sn=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var r=e.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var n=0;n<r.children.length;n++){var i=r.children.item(n);if(i.tagName==="LEGEND")return pe.call(r,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}r=r.parentElement}return!1},He=function(e,r){return!(r.disabled||Ke(r)||Jr(r)||an(r,e)||Zr(r)||sn(r))},ut=function(e,r){return!(rn(r)||me(r)<0||!He(e,r))},ln=function(e){var r=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(r)||r>=0)},on=function t(e){var r=[],n=[];return e.forEach(function(i,l){var s=!!i.scopeParent,b=s?i.scopeParent:i,o=zr(b,s),y=s?t(i.candidates):b;o===0?s?r.push.apply(r,y):r.push(b):n.push({documentOrder:l,tabIndex:o,item:i,isScope:s,content:y})}),n.sort(Gr).reduce(function(i,l){return l.isScope?i.push.apply(i,l.content):i.push(l.content),i},[]).concat(r)},un=function(e,r){r=r||{};var n;return r.getShadowRoot?n=Bt([e],r.includeContainer,{filter:ut.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:ln}):n=Ut(e,r.includeContainer,ut.bind(null,r)),on(n)},cn=function(e,r){r=r||{};var n;return r.getShadowRoot?n=Bt([e],r.includeContainer,{filter:He.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):n=Ut(e,r.includeContainer,He.bind(null,r)),n},we=function(e,r){if(r=r||{},!e)throw new Error("No node provided");return pe.call(e,Ue)===!1?!1:ut(r,e)},dn=$t.concat("iframe").join(","),ct=function(e,r){if(r=r||{},!e)throw new Error("No node provided");return pe.call(e,dn)===!1?!1:He(r,e)};let dt=u.createContext(null);dt.displayName="OpenClosedContext";var he=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(he||{});function qt(){return u.useContext(dt)}function fn({value:t,children:e}){return u.createElement(dt.Provider,{value:t},e)}function vn(){let t=typeof document>"u";return"useSyncExternalStore"in Te?(e=>e.useSyncExternalStore)(Te)(()=>()=>{},()=>!1,()=>!t):!1}function Yt(){let t=vn(),[e,r]=Te.useState(De.isHandoffComplete);return e&&De.isHandoffComplete===!1&&r(!1),Te.useEffect(()=>{e!==!0&&r(!0)},[e]),Te.useEffect(()=>De.handoff(),[]),t?!1:e}function pn(){let t=u.useRef(!1);return ce(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function Xt(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||((e=t.as)!=null?e:Gt)!==u.Fragment||u.Children.count(t.children)===1}let Ve=u.createContext(null);Ve.displayName="TransitionContext";var mn=(t=>(t.Visible="visible",t.Hidden="hidden",t))(mn||{});function hn(){let t=u.useContext(Ve);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function bn(){let t=u.useContext(qe);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let qe=u.createContext(null);qe.displayName="NestingContext";function Ye(t){return"children"in t?Ye(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function zt(t,e){let r=It(t),n=u.useRef([]),i=pn(),l=Nt(),s=oe((O,x=de.Hidden)=>{let v=n.current.findIndex(({el:f})=>f===O);v!==-1&&($e(x,{[de.Unmount](){n.current.splice(v,1)},[de.Hidden](){n.current[v].state="hidden"}}),l.microTask(()=>{var f;!Ye(n)&&i.current&&((f=r.current)==null||f.call(r))}))}),b=oe(O=>{let x=n.current.find(({el:v})=>v===O);return x?x.state!=="visible"&&(x.state="visible"):n.current.push({el:O,state:"visible"}),()=>s(O,de.Unmount)}),o=u.useRef([]),y=u.useRef(Promise.resolve()),p=u.useRef({enter:[],leave:[]}),T=oe((O,x,v)=>{o.current.splice(0),e&&(e.chains.current[x]=e.chains.current[x].filter(([f])=>f!==O)),e==null||e.chains.current[x].push([O,new Promise(f=>{o.current.push(f)})]),e==null||e.chains.current[x].push([O,new Promise(f=>{Promise.all(p.current[x].map(([m,g])=>g)).then(()=>f())})]),x==="enter"?y.current=y.current.then(()=>e==null?void 0:e.wait.current).then(()=>v(x)):v(x)}),C=oe((O,x,v)=>{Promise.all(p.current[x].splice(0).map(([f,m])=>m)).then(()=>{var f;(f=o.current.shift())==null||f()}).then(()=>v(x))});return u.useMemo(()=>({children:n,register:b,unregister:s,onStart:T,onStop:C,wait:y,chains:p}),[b,s,n,T,C,p,y])}let Gt=u.Fragment,Jt=At.RenderStrategy;function gn(t,e){var r,n;let{transition:i=!0,beforeEnter:l,afterEnter:s,beforeLeave:b,afterLeave:o,enter:y,enterFrom:p,enterTo:T,entered:C,leave:O,leaveFrom:x,leaveTo:v,...f}=t,[m,g]=u.useState(null),S=u.useRef(null),k=Xt(t),_=Rt(...k?[S,e,g]:e===null?[]:[e]),ie=(r=f.unmount)==null||r?de.Unmount:de.Hidden,{show:V,appear:G,initial:Z}=hn(),[Y,X]=u.useState(V?"visible":"hidden"),I=bn(),{register:c,unregister:d}=I;ce(()=>c(S),[c,S]),ce(()=>{if(ie===de.Hidden&&S.current){if(V&&Y!=="visible"){X("visible");return}return $e(Y,{hidden:()=>d(S),visible:()=>c(S)})}},[Y,S,c,d,V,ie]);let w=Yt();ce(()=>{if(k&&w&&Y==="visible"&&S.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[S,Y,w,k]);let M=Z&&!G,R=G&&V&&Z,$=u.useRef(!1),j=zt(()=>{$.current||(X("hidden"),d(S))},I),U=oe(se=>{$.current=!0;let ee=se?"enter":"leave";j.onStart(S,ee,ue=>{ue==="enter"?l==null||l():ue==="leave"&&(b==null||b())})}),B=oe(se=>{let ee=se?"enter":"leave";$.current=!1,j.onStop(S,ee,ue=>{ue==="enter"?s==null||s():ue==="leave"&&(o==null||o())}),ee==="leave"&&!Ye(j)&&(X("hidden"),d(S))});u.useEffect(()=>{k&&i||(U(V),B(V))},[V,k,i]);let te=!(!i||!k||!w||M),[,K]=Hr(te,m,V,{start:U,end:B}),re=ve({ref:_,className:((n=st(f.className,R&&y,R&&p,K.enter&&y,K.enter&&K.closed&&p,K.enter&&!K.closed&&T,K.leave&&O,K.leave&&!K.closed&&x,K.leave&&K.closed&&v,!K.transition&&V&&C))==null?void 0:n.trim())||void 0,...Kr(K)}),Q=0;Y==="visible"&&(Q|=he.Open),Y==="hidden"&&(Q|=he.Closed),K.enter&&(Q|=he.Opening),K.leave&&(Q|=he.Closing);let fe=_t();return u.createElement(qe.Provider,{value:j},u.createElement(fn,{value:Q},fe({ourProps:re,theirProps:f,defaultTag:Gt,features:Jt,visible:Y==="visible",name:"Transition.Child"})))}function yn(t,e){let{show:r,appear:n=!1,unmount:i=!0,...l}=t,s=u.useRef(null),b=Xt(t),o=Rt(...b?[s,e]:e===null?[]:[e]);Yt();let y=qt();if(r===void 0&&y!==null&&(r=(y&he.Open)===he.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[p,T]=u.useState(r?"visible":"hidden"),C=zt(()=>{r||T("hidden")}),[O,x]=u.useState(!0),v=u.useRef([r]);ce(()=>{O!==!1&&v.current[v.current.length-1]!==r&&(v.current.push(r),x(!1))},[v,r]);let f=u.useMemo(()=>({show:r,appear:n,initial:O}),[r,n,O]);ce(()=>{r?T("visible"):!Ye(C)&&s.current!==null&&T("hidden")},[r,C]);let m={unmount:i},g=oe(()=>{var _;O&&x(!1),(_=t.beforeEnter)==null||_.call(t)}),S=oe(()=>{var _;O&&x(!1),(_=t.beforeLeave)==null||_.call(t)}),k=_t();return u.createElement(qe.Provider,{value:C},u.createElement(Ve.Provider,{value:f},k({ourProps:{...m,as:u.Fragment,children:u.createElement(Zt,{ref:o,...m,...l,beforeEnter:g,beforeLeave:S})},theirProps:{},defaultTag:u.Fragment,features:Jt,visible:p==="visible",name:"Transition"})))}function wn(t,e){let r=u.useContext(Ve)!==null,n=qt()!==null;return u.createElement(u.Fragment,null,!r&&n?u.createElement(ft,{ref:e,...t}):u.createElement(Zt,{ref:e,...t}))}let ft=lt(yn),Zt=lt(gn),Xe=lt(wn),xn=Object.assign(ft,{Child:Xe,Root:ft});function Qt({onClick:t}){return F.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:t,children:[F.jsx("span",{className:"sr-only",children:"Close"}),F.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:F.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}/*!
38
- * focus-trap 7.6.2
39
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
40
- */function vt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function En(t){if(Array.isArray(t))return vt(t)}function Tn(t,e,r){return(e=Pn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Cn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
41
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function er(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function tr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?er(Object(r),!0).forEach(function(n){Tn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):er(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function On(t){return En(t)||Sn(t)||Fn(t)||Cn()}function kn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pn(t){var e=kn(t,"string");return typeof e=="symbol"?e:e+""}function Fn(t,e){if(t){if(typeof t=="string")return vt(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vt(t,e):void 0}}var rr={activateTrap:function(e,r){if(e.length>0){var n=e[e.length-1];n!==r&&n.pause()}var i=e.indexOf(r);i===-1||e.splice(i,1),e.push(r)},deactivateTrap:function(e,r){var n=e.indexOf(r);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},jn=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Nn=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},je=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},In=function(e){return je(e)&&!e.shiftKey},An=function(e){return je(e)&&e.shiftKey},nr=function(e){return setTimeout(e,0)},Ne=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return typeof e=="function"?e.apply(void 0,n):e},ze=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},_n=[],Mn=function(e,r){var n=(r==null?void 0:r.document)||document,i=(r==null?void 0:r.trapStack)||_n,l=tr({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:In,isKeyBackward:An},r),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},b,o=function(c,d,w){return c&&c[d]!==void 0?c[d]:l[w||d]},y=function(c,d){var w=typeof(d==null?void 0:d.composedPath)=="function"?d.composedPath():void 0;return s.containerGroups.findIndex(function(M){var R=M.container,$=M.tabbableNodes;return R.contains(c)||(w==null?void 0:w.includes(R))||$.find(function(j){return j===c})})},p=function(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=d.hasFallback,M=w===void 0?!1:w,R=d.params,$=R===void 0?[]:R,j=l[c];if(typeof j=="function"&&(j=j.apply(void 0,On($))),j===!0&&(j=void 0),!j){if(j===void 0||j===!1)return j;throw new Error("`".concat(c,"` was specified but was not a node, or did not return a node"))}var U=j;if(typeof j=="string"){try{U=n.querySelector(j)}catch(B){throw new Error("`".concat(c,'` appears to be an invalid selector; error="').concat(B.message,'"'))}if(!U&&!M)throw new Error("`".concat(c,"` as selector refers to no known node"))}return U},T=function(){var c=p("initialFocus",{hasFallback:!0});if(c===!1)return!1;if(c===void 0||c&&!ct(c,l.tabbableOptions))if(y(n.activeElement)>=0)c=n.activeElement;else{var d=s.tabbableGroups[0],w=d&&d.firstTabbableNode;c=w||p("fallbackFocus")}else c===null&&(c=p("fallbackFocus"));if(!c)throw new Error("Your focus-trap needs to have at least one focusable element");return c},C=function(){if(s.containerGroups=s.containers.map(function(c){var d=un(c,l.tabbableOptions),w=cn(c,l.tabbableOptions),M=d.length>0?d[0]:void 0,R=d.length>0?d[d.length-1]:void 0,$=w.find(function(B){return we(B)}),j=w.slice().reverse().find(function(B){return we(B)}),U=!!d.find(function(B){return me(B)>0});return{container:c,tabbableNodes:d,focusableNodes:w,posTabIndexesFound:U,firstTabbableNode:M,lastTabbableNode:R,firstDomTabbableNode:$,lastDomTabbableNode:j,nextTabbableNode:function(te){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,re=d.indexOf(te);return re<0?K?w.slice(w.indexOf(te)+1).find(function(Q){return we(Q)}):w.slice(0,w.indexOf(te)).reverse().find(function(Q){return we(Q)}):d[re+(K?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(c){return c.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!p("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(s.containerGroups.find(function(c){return c.posTabIndexesFound})&&s.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.")},O=function(c){var d=c.activeElement;if(d)return d.shadowRoot&&d.shadowRoot.activeElement!==null?O(d.shadowRoot):d},x=function(c){if(c!==!1&&c!==O(document)){if(!c||!c.focus){x(T());return}c.focus({preventScroll:!!l.preventScroll}),s.mostRecentlyFocusedNode=c,jn(c)&&c.select()}},v=function(c){var d=p("setReturnFocus",{params:[c]});return d||(d===!1?!1:c)},f=function(c){var d=c.target,w=c.event,M=c.isBackward,R=M===void 0?!1:M;d=d||ze(w),C();var $=null;if(s.tabbableGroups.length>0){var j=y(d,w),U=j>=0?s.containerGroups[j]:void 0;if(j<0)R?$=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:$=s.tabbableGroups[0].firstTabbableNode;else if(R){var B=s.tabbableGroups.findIndex(function(se){var ee=se.firstTabbableNode;return d===ee});if(B<0&&(U.container===d||ct(d,l.tabbableOptions)&&!we(d,l.tabbableOptions)&&!U.nextTabbableNode(d,!1))&&(B=j),B>=0){var te=B===0?s.tabbableGroups.length-1:B-1,K=s.tabbableGroups[te];$=me(d)>=0?K.lastTabbableNode:K.lastDomTabbableNode}else je(w)||($=U.nextTabbableNode(d,!1))}else{var re=s.tabbableGroups.findIndex(function(se){var ee=se.lastTabbableNode;return d===ee});if(re<0&&(U.container===d||ct(d,l.tabbableOptions)&&!we(d,l.tabbableOptions)&&!U.nextTabbableNode(d))&&(re=j),re>=0){var Q=re===s.tabbableGroups.length-1?0:re+1,fe=s.tabbableGroups[Q];$=me(d)>=0?fe.firstTabbableNode:fe.firstDomTabbableNode}else je(w)||($=U.nextTabbableNode(d))}}else $=p("fallbackFocus");return $},m=function(c){var d=ze(c);if(!(y(d,c)>=0)){if(Ne(l.clickOutsideDeactivates,c)){b.deactivate({returnFocus:l.returnFocusOnDeactivate});return}Ne(l.allowOutsideClick,c)||c.preventDefault()}},g=function(c){var d=ze(c),w=y(d,c)>=0;if(w||d instanceof Document)w&&(s.mostRecentlyFocusedNode=d);else{c.stopImmediatePropagation();var M,R=!0;if(s.mostRecentlyFocusedNode)if(me(s.mostRecentlyFocusedNode)>0){var $=y(s.mostRecentlyFocusedNode),j=s.containerGroups[$].tabbableNodes;if(j.length>0){var U=j.findIndex(function(B){return B===s.mostRecentlyFocusedNode});U>=0&&(l.isKeyForward(s.recentNavEvent)?U+1<j.length&&(M=j[U+1],R=!1):U-1>=0&&(M=j[U-1],R=!1))}}else s.containerGroups.some(function(B){return B.tabbableNodes.some(function(te){return me(te)>0})})||(R=!1);else R=!1;R&&(M=f({target:s.mostRecentlyFocusedNode,isBackward:l.isKeyBackward(s.recentNavEvent)})),x(M||s.mostRecentlyFocusedNode||T())}s.recentNavEvent=void 0},S=function(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=c;var w=f({event:c,isBackward:d});w&&(je(c)&&c.preventDefault(),x(w))},k=function(c){(l.isKeyForward(c)||l.isKeyBackward(c))&&S(c,l.isKeyBackward(c))},_=function(c){Nn(c)&&Ne(l.escapeDeactivates,c)!==!1&&(c.preventDefault(),b.deactivate())},ie=function(c){var d=ze(c);y(d,c)>=0||Ne(l.clickOutsideDeactivates,c)||Ne(l.allowOutsideClick,c)||(c.preventDefault(),c.stopImmediatePropagation())},V=function(){if(s.active)return rr.activateTrap(i,b),s.delayInitialFocusTimer=l.delayInitialFocus?nr(function(){x(T())}):x(T()),n.addEventListener("focusin",g,!0),n.addEventListener("mousedown",m,{capture:!0,passive:!1}),n.addEventListener("touchstart",m,{capture:!0,passive:!1}),n.addEventListener("click",ie,{capture:!0,passive:!1}),n.addEventListener("keydown",k,{capture:!0,passive:!1}),n.addEventListener("keydown",_),b},G=function(){if(s.active)return n.removeEventListener("focusin",g,!0),n.removeEventListener("mousedown",m,!0),n.removeEventListener("touchstart",m,!0),n.removeEventListener("click",ie,!0),n.removeEventListener("keydown",k,!0),n.removeEventListener("keydown",_),b},Z=function(c){var d=c.some(function(w){var M=Array.from(w.removedNodes);return M.some(function(R){return R===s.mostRecentlyFocusedNode})});d&&x(T())},Y=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(Z):void 0,X=function(){Y&&(Y.disconnect(),s.active&&!s.paused&&s.containers.map(function(c){Y.observe(c,{subtree:!0,childList:!0})}))};return b={get active(){return s.active},get paused(){return s.paused},activate:function(c){if(s.active)return this;var d=o(c,"onActivate"),w=o(c,"onPostActivate"),M=o(c,"checkCanFocusTrap");M||C(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=n.activeElement,d==null||d();var R=function(){M&&C(),V(),X(),w==null||w()};return M?(M(s.containers.concat()).then(R,R),this):(R(),this)},deactivate:function(c){if(!s.active)return this;var d=tr({onDeactivate:l.onDeactivate,onPostDeactivate:l.onPostDeactivate,checkCanReturnFocus:l.checkCanReturnFocus},c);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,G(),s.active=!1,s.paused=!1,X(),rr.deactivateTrap(i,b);var w=o(d,"onDeactivate"),M=o(d,"onPostDeactivate"),R=o(d,"checkCanReturnFocus"),$=o(d,"returnFocus","returnFocusOnDeactivate");w==null||w();var j=function(){nr(function(){$&&x(v(s.nodeFocusedBeforeActivation)),M==null||M()})};return $&&R?(R(v(s.nodeFocusedBeforeActivation)).then(j,j),this):(j(),this)},pause:function(c){if(s.paused||!s.active)return this;var d=o(c,"onPause"),w=o(c,"onPostPause");return s.paused=!0,d==null||d(),G(),X(),w==null||w(),this},unpause:function(c){if(!s.paused||!s.active)return this;var d=o(c,"onUnpause"),w=o(c,"onPostUnpause");return s.paused=!1,d==null||d(),C(),V(),X(),w==null||w(),this},updateContainerElements:function(c){var d=[].concat(c).filter(Boolean);return s.containers=d.map(function(w){return typeof w=="string"?n.querySelector(w):w}),s.active&&C(),X(),this}},b.updateContainerElements(e),b};function ar(t,e){const r=u.useRef(null);return u.useEffect(()=>{if(!r.current)return;const n=Mn(r.current,{clickOutsideDeactivates:!t,escapeDeactivates:!t,onDeactivate:()=>e==null?void 0:e(),fallbackFocus:()=>r.current});return n.activate(),()=>n.deactivate()},[]),r}const Rn=({modalContext:t,config:e,children:r})=>{const n=ar(e==null?void 0:e.closeExplicitly,()=>t.close());return F.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:F.jsx("div",{className:Re("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:F.jsx(Xe,{as:"div",ref:n,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",afterLeave:t.afterLeave,className:Re("im-modal-wrapper pointer-events-auto 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:F.jsxs("div",{className:`im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,children:[e.closeButton&&F.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:F.jsx(Qt,{onClick:t.close})}),typeof r=="function"?r({modalContext:t,config:e}):r]})})})})},Dn=({modalContext:t,config:e,children:r})=>{const n=ar(e==null?void 0:e.closeExplicitly,()=>t.close());return F.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:F.jsx("div",{className:Re("im-slideover-positioner flex min-h-full items-center",{"justify-start":e.position==="left","justify-end":e.position==="right"}),children:F.jsx(Xe,{as:"div",ref:n,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"}`,afterLeave:t.afterLeave,className:Re("im-slideover-wrapper pointer-events-auto 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:F.jsxs("div",{className:`im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,children:[e.closeButton&&F.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:F.jsx(Qt,{onClick:t.close})}),typeof r=="function"?r({modalContext:t,config:e}):r]})})})})},ir=u.forwardRef(({name:t,children:e,...r},n)=>{const i=s=>typeof e=="function"?e(s):e,l=u.useRef(null);return u.useEffect(()=>{var s;if(((s=l==null?void 0:l.current)==null?void 0:s.index)===0)return xt.prepare(),()=>xt.cleanup()},[l]),u.useImperativeHandle(n,()=>l.current,[l]),F.jsx(at,{ref:l,name:t,...r,children:({afterLeave:s,close:b,config:o,emit:y,getChildModal:p,getParentModal:T,id:C,index:O,isOpen:x,modalContext:v,onTopOfStack:f,reload:m,setOpen:g,shouldRender:S})=>F.jsx(xn,{appear:!0,show:x??!1,children:F.jsxs("div",{className:"im-dialog relative z-20","data-inertiaui-modal-id":C,"data-inertiaui-modal-index":O,children:[O===0?F.jsx(Xe,{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:f?F.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):F.jsx("div",{})}):null,O>0&&f?F.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,o.slideover?F.jsx(Dn,{modalContext:v,config:o,children:i({afterLeave:s,close:b,config:o,emit:y,getChildModal:p,getParentModal:T,id:C,index:O,isOpen:x,modalContext:v,onTopOfStack:f,reload:m,setOpen:g,shouldRender:S})}):F.jsx(Rn,{modalContext:v,config:o,children:i({afterLeave:s,close:b,config:o,emit:y,getChildModal:p,getParentModal:T,id:C,index:O,isOpen:x,modalContext:v,onTopOfStack:f,reload:m,setOpen:g,shouldRender:S})})]})})})});ir.displayName="Modal";const Ln=({href:t,method:e="get",data:r={},as:n="a",headers:i={},queryStringArrayFormat:l="brackets",onAfterLeave:s=null,onBlur:b=null,onClose:o=null,onError:y=null,onFocus:p=null,onStart:T=null,onSuccess:C=null,navigate:O=null,children:x,...v})=>{const[f,m]=u.useState(!1),[g,S]=u.useState(null),{stack:k,visit:_}=Fe(),ie=u.useMemo(()=>O??_e("navigate"),[O]),V={},G={};Object.keys(v).forEach(d=>{Ot.includes(d)||(d.startsWith("on")&&typeof v[d]=="function"?d.toLowerCase()in window?V[d]=v[d]:G[d]=v[d]:V[d]=v[d])});const[Z,Y]=u.useState(!1);u.useEffect(()=>{g&&(g.onTopOfStack&&Z?p==null||p():!g.onTopOfStack&&!Z&&(b==null||b()),Y(!g.onTopOfStack))},[k]);const X=u.useCallback(()=>{o==null||o()},[o]),I=u.useCallback(()=>{S(null),s==null||s()},[s]),c=u.useCallback(d=>{d==null||d.preventDefault(),!f&&(t.startsWith("#")||(m(!0),T==null||T()),_(t,e,r,i,Fr(Et(v,Ot)),()=>X(k.length),I,l,ie).then(w=>{S(w),w.registerEventListenersFromProps(G),C==null||C()}).catch(w=>{console.error(w),y==null||y(w)}).finally(()=>m(!1)))},[t,e,r,i,l,v,X,I]);return F.jsx(n,{...V,href:t,onClick:c,children:typeof x=="function"?x({loading:f}):x})};function $n(){return Fe().stack[nt()]??null}const Wn=t=>e=>(e.default.layout=r=>u.createElement(t,{},r),e);L.HeadlessModal=at,L.Modal=ir,L.ModalLink=Ln,L.ModalRoot=Pt,L.ModalStackProvider=Ct,L.getConfig=_e,L.initFromPageProps=kt,L.putConfig=Cr,L.renderApp=Nr,L.resetConfig=Sr,L.setPageLayout=Wn,L.useModal=$n,L.useModalIndex=nt,L.useModalStack=Fe,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
33
+ `))}else{let y=c.props,w=y==null?void 0:y.className,E=typeof w=="function"?(...h)=>wt(w(...h),a.className):wt(w,a.className),m=E?{className:E}:{},f=Gt(c.props,ve(yt(a,["ref"])));for(let h in b)h in f&&delete b[h];return i.cloneElement(c,Object.assign({},f,b,p,{ref:l(fr(c),p.ref)},m))}return i.createElement(u,Object.assign({},yt(a,["ref"]),u!==i.Fragment&&p,u!==i.Fragment&&b),c)}function dr(){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 cr(...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 Gt(...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 u;return(u=l==null?void 0:l.preventDefault)==null?void 0:u.call(l)}]);for(let r in n)Object.assign(t,{[r](l,...u){let s=n[r];for(let d of s){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;d(l,...u)}}});return t}function z(e){var t;return Object.assign(i.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ve(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function yt(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function fr(e){return i.version.split(".")[0]>="19"?e.props.ref:e.ref}let mr="span";var tt=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(tt||{});function pr(e,t){var n;let{features:r=1,...l}=e,u={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 Q()({ourProps:u,theirProps:l,slot:{},defaultTag:mr,name:"Hidden"})}let xt=z(pr),Jt=Symbol();function hr(e,t=!0){return Object.assign(e,{[Jt]:t})}function re(...e){let t=i.useRef(e);i.useEffect(()=>{t.current=e},[e]);let n=A(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[Jt]))?void 0:n}let Ct=i.createContext(null);Ct.displayName="DescriptionContext";function Rt(){let e=i.useContext(Ct);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,Rt),t}return e}function vr(){let[e,t]=i.useState([]);return[e.length>0?e.join(" "):void 0,i.useMemo(()=>function(n){let r=A(u=>(t(s=>[...s,u]),()=>t(s=>{let d=s.slice(),a=d.indexOf(u);return a!==-1&&d.splice(a,1),d}))),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(Ct.Provider,{value:l},n.children)},[t])]}let gr="p";function Er(e,t){let n=i.useId(),r=ur(),{id:l=`headlessui-description-${n}`,...u}=e,s=Rt(),d=re(t);V(()=>s.register(l),[l,s.register]);let a=r||!1,p=i.useMemo(()=>({...s.slot,disabled:a}),[s.slot,a]),c={ref:d,...s.props,id:l};return Q()({ourProps:c,theirProps:u,slot:p,defaultTag:gr,name:s.name||"Description"})}let br=z(Er),wr=Object.assign(br,{});var Zt=(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))(Zt||{});let yr=i.createContext(()=>{});function xr({value:e,children:t}){return i.createElement(yr.Provider,{value:e},t)}let Cr=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 Qt(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(l){return r.add(l),()=>r.delete(l)},dispatch(l,...u){let s=t[l].call(n,...u);s&&(n=s,r.forEach(d=>d()))}}}function en(e){return i.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let Tr=new Cr(()=>Qt(()=>[],{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 $e(e,t){let n=Tr.get(t),r=i.useId(),l=en(n);if(V(()=>{if(e)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,e]),!e)return!1;let u=l.indexOf(r),s=l.length;return u===-1&&(u=s,s+=1),u===s-1}let Tt=new Map,We=new Map;function tn(e){var t;let n=(t=We.get(e))!=null?t:0;return We.set(e,n+1),n!==0?()=>nn(e):(Tt.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>nn(e))}function nn(e){var t;let n=(t=We.get(e))!=null?t:1;if(n===1?We.delete(e):We.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 Sr(e,{allowed:t,disallowed:n}={}){let r=$e(e,"inert-others");V(()=>{var l,u;if(!r)return;let s=se();for(let a of(l=n==null?void 0:n())!=null?l:[])a&&s.add(tn(a));let d=(u=t==null?void 0:t())!=null?u:[];for(let a of d){if(!a)continue;let p=Re(a);if(!p)continue;let c=a.parentElement;for(;c&&c!==p.body;){for(let b of c.children)d.some(y=>b.contains(y))||s.add(tn(b));c=c.parentElement}}return s.dispose},[r,t,n])}function Or(e,t,n){let r=he(l=>{let u=l.getBoundingClientRect();u.x===0&&u.y===0&&u.width===0&&u.height===0&&n()});i.useEffect(()=>{if(!e)return;let l=t===null?null:t instanceof HTMLElement?t:t.current;if(!l)return;let u=se();if(typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>r.current(l));s.observe(l),u.add(()=>s.disconnect())}if(typeof IntersectionObserver<"u"){let s=new IntersectionObserver(()=>r.current(l));s.observe(l),u.add(()=>s.disconnect())}return()=>u.dispose()},[t,r,e])}let nt=["[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(","),Pr=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ie=(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))(ie||{}),St=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(St||{}),$r=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))($r||{});function Mr(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(nt)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Fr(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Pr)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var rn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(rn||{});function kr(e,t=0){var n;return e===((n=Re(e))==null?void 0:n.body)?!1:de(t,{0(){return e.matches(nt)},1(){let r=e;for(;r!==null;){if(r.matches(nt))return!0;r=r.parentElement}return!1}})}var jr=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(jr||{});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 oe(e){e==null||e.focus({preventScroll:!0})}let _r=["textarea","input"].join(",");function Lr(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,_r))!=null?n:!1}function Ar(e,t=n=>n){return e.slice().sort((n,r)=>{let l=t(n),u=t(r);if(l===null||u===null)return 0;let s=l.compareDocumentPosition(u);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ue(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:l=[]}={}){let u=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,s=Array.isArray(e)?n?Ar(e):e:t&64?Fr(e):Mr(e);l.length>0&&s.length>1&&(s=s.filter(w=>!l.some(E=>E!=null&&"current"in E?(E==null?void 0:E.current)===w:E===w))),r=r??u.activeElement;let d=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,s.indexOf(r))-1;if(t&4)return Math.max(0,s.indexOf(r))+1;if(t&8)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=t&32?{preventScroll:!0}:{},c=0,b=s.length,y;do{if(c>=b||c+b<=0)return 0;let w=a+c;if(t&16)w=(w+b)%b;else{if(w<0)return 3;if(w>=b)return 1}y=s[w],y==null||y.focus(p),c+=d}while(y!==u.activeElement);return t&6&&Lr(y)&&y.select(),2}function ln(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Ir(){return/Android/gi.test(window.navigator.userAgent)}function Nr(){return ln()||Ir()}function He(e,t,n,r){let l=he(n);i.useEffect(()=>{if(!e)return;function u(s){l.current(s)}return document.addEventListener(t,u,r),()=>document.removeEventListener(t,u,r)},[e,t,r])}function on(e,t,n,r){let l=he(n);i.useEffect(()=>{if(!e)return;function u(s){l.current(s)}return window.addEventListener(t,u,r),()=>window.removeEventListener(t,u,r)},[e,t,r])}const an=30;function Dr(e,t,n){let r=$e(e,"outside-click"),l=he(n),u=i.useCallback(function(a,p){if(a.defaultPrevented)return;let c=p(a);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let b=function y(w){return typeof w=="function"?y(w()):Array.isArray(w)||w instanceof Set?w:[w]}(t);for(let y of b)if(y!==null&&(y.contains(c)||a.composed&&a.composedPath().includes(y)))return;return!kr(c,rn.Loose)&&c.tabIndex!==-1&&a.preventDefault(),l.current(a,c)},[l,t]),s=i.useRef(null);He(r,"pointerdown",a=>{var p,c;s.current=((c=(p=a.composedPath)==null?void 0:p.call(a))==null?void 0:c[0])||a.target},!0),He(r,"mousedown",a=>{var p,c;s.current=((c=(p=a.composedPath)==null?void 0:p.call(a))==null?void 0:c[0])||a.target},!0),He(r,"click",a=>{Nr()||s.current&&(u(a,()=>s.current),s.current=null)},!0);let d=i.useRef({x:0,y:0});He(r,"touchstart",a=>{d.current.x=a.touches[0].clientX,d.current.y=a.touches[0].clientY},!0),He(r,"touchend",a=>{let p={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(p.x-d.current.x)>=an||Math.abs(p.y-d.current.y)>=an))return u(a,()=>a.target instanceof HTMLElement?a.target:null)},!0),on(r,"blur",a=>u(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Be(...e){return i.useMemo(()=>Re(...e),[...e])}function un(e,t,n,r){let l=he(n);i.useEffect(()=>{e=e??window;function u(s){l.current(s)}return e.addEventListener(t,u,r),()=>e.removeEventListener(t,u,r)},[e,t,r])}function Wr(){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),u=Math.max(0,e-l);n.style(r,"paddingRight",`${u}px`)}}}function Ur(){return ln()?{before({doc:e,d:t,meta:n}){function r(l){return n.containers.flatMap(u=>u()).some(u=>u.contains(l))}t.microTask(()=>{var l;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let d=se();d.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>d.dispose()))}let u=(l=window.scrollY)!=null?l:window.pageYOffset,s=null;t.addEventListener(e,"click",d=>{if(d.target instanceof HTMLElement)try{let a=d.target.closest("a");if(!a)return;let{hash:p}=new URL(a.href),c=e.querySelector(p);c&&!r(c)&&(s=c)}catch{}},!0),t.addEventListener(e,"touchstart",d=>{if(d.target instanceof HTMLElement)if(r(d.target)){let a=d.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(d.target,"touchAction","none")}),t.addEventListener(e,"touchmove",d=>{if(d.target instanceof HTMLElement){if(d.target.tagName==="INPUT")return;if(r(d.target)){let a=d.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&d.preventDefault()}else d.preventDefault()}},{passive:!1}),t.add(()=>{var d;let a=(d=window.scrollY)!=null?d:window.pageYOffset;u!==a&&window.scrollTo(0,u),s&&s.isConnected&&(s.scrollIntoView({block:"nearest"}),s=null)})})}}:{}}function Hr(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Br(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let ge=Qt(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:se(),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:Br(n)},l=[Ur(),Wr(),Hr()];l.forEach(({before:u})=>u==null?void 0:u(r)),l.forEach(({after:u})=>u==null?void 0:u(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});ge.subscribe(()=>{let e=ge.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)&&ge.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ge.dispatch("TEARDOWN",n)}});function Vr(e,t,n=()=>({containers:[]})){let r=en(ge),l=t?r.get(t):void 0,u=l?l.count>0:!1;return V(()=>{if(!(!t||!e))return ge.dispatch("PUSH",t,n),()=>ge.dispatch("POP",t,n)},[e,t]),u}function Yr(e,t,n=()=>[document.body]){let r=$e(e,"scroll-lock");Vr(r,t,l=>{var u;return{containers:[...(u=l.containers)!=null?u:[],n]}})}function qr(e=0){let[t,n]=i.useState(e),r=i.useCallback(a=>n(a),[t]),l=i.useCallback(a=>n(p=>p|a),[t]),u=i.useCallback(a=>(t&a)===a,[t]),s=i.useCallback(a=>n(p=>p&~a),[n]),d=i.useCallback(a=>n(p=>p^a),[n]);return{flags:t,setFlag:r,addFlag:l,hasFlag:u,removeFlag:s,toggleFlag:d}}var sn,dn;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((sn=process==null?void 0:process.env)==null?void 0:sn.NODE_ENV)==="test"&&typeof((dn=Element==null?void 0:Element.prototype)==null?void 0:dn.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(`
34
+ `)),[]});var Xr=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Xr||{});function zr(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Kr(e,t,n,r){let[l,u]=i.useState(n),{hasFlag:s,addFlag:d,removeFlag:a}=qr(e&&l?3:0),p=i.useRef(!1),c=i.useRef(!1),b=bt();return V(()=>{var y;if(e){if(n&&u(!0),!t){n&&d(3);return}return(y=r==null?void 0:r.start)==null||y.call(r,n),Gr(t,{inFlight:p,prepare(){c.current?c.current=!1:c.current=p.current,p.current=!0,!c.current&&(n?(d(3),a(4)):(d(4),a(2)))},run(){c.current?n?(a(3),d(4)):(a(4),d(3)):n?a(1):d(1)},done(){var w;c.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(p.current=!1,a(7),n||u(!1),(w=r==null?void 0:r.end)==null||w.call(r,n))}})}},[e,n,t,b]),e?[l,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Gr(e,{prepare:t,run:n,done:r,inFlight:l}){let u=se();return Rr(e,{prepare:t,inFlight:l}),u.nextFrame(()=>{n(),u.requestAnimationFrame(()=>{u.add(Jr(e,r))})}),u.dispose}function Jr(e,t){var n,r;let l=se();if(!e)return l.dispose;let u=!1;l.add(()=>{u=!0});let s=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(d=>d instanceof CSSTransition))!=null?r:[];return s.length===0?(t(),l.dispose):(Promise.allSettled(s.map(d=>d.finished)).then(()=>{u||t()}),l.dispose)}function Rr(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 Ot(e,t){let n=i.useRef([]),r=A(e);i.useEffect(()=>{let l=[...n.current];for(let[u,s]of t.entries())if(n.current[u]!==s){let d=r(t,l);return n.current=t,d}},[r,...t])}let rt=i.createContext(null);rt.displayName="OpenClosedContext";var ne=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ne||{});function lt(){return i.useContext(rt)}function Zr({value:e,children:t}){return i.createElement(rt.Provider,{value:e},t)}function Qr({children:e}){return i.createElement(rt.Provider,{value:null},e)}function el(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let fe=[];el(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||fe[0]===t.target)return;let n=t.target;n=n.closest(nt),fe.unshift(n??t.target),fe=fe.filter(r=>r!=null&&r.isConnected),fe.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 cn(e){let t=A(e),n=i.useRef(!1);i.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ze(()=>{n.current&&t()})}),[t])}function tl(){let e=typeof document>"u";return"useSyncExternalStore"in je?(t=>t.useSyncExternalStore)(je)(()=>()=>{},()=>!1,()=>!e):!1}function Ve(){let e=tl(),[t,n]=je.useState(pe.isHandoffComplete);return t&&pe.isHandoffComplete===!1&&n(!1),je.useEffect(()=>{t!==!0&&n(!0)},[t]),je.useEffect(()=>pe.handoff(),[]),e?!1:t}let fn=i.createContext(!1);function nl(){return i.useContext(fn)}function mn(e){return i.createElement(fn.Provider,{value:e.force},e.children)}function rl(e){let t=nl(),n=i.useContext(hn),r=Be(e),[l,u]=i.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(pe.isServer)return null;let d=r==null?void 0:r.getElementById("headlessui-portal-root");if(d)return d;if(r===null)return null;let a=r.createElement("div");return a.setAttribute("id","headlessui-portal-root"),r.body.appendChild(a)});return i.useEffect(()=>{l!==null&&(r!=null&&r.body.contains(l)||r==null||r.body.appendChild(l))},[l,r]),i.useEffect(()=>{t||n!==null&&u(n.current)},[n,u,t]),l}let pn=i.Fragment,ll=z(function(e,t){let n=e,r=i.useRef(null),l=re(hr(b=>{r.current=b}),t),u=Be(r),s=rl(r),[d]=i.useState(()=>{var b;return pe.isServer?null:(b=u==null?void 0:u.createElement("div"))!=null?b:null}),a=i.useContext(Pt),p=Ve();V(()=>{!s||!d||s.contains(d)||(d.setAttribute("data-headlessui-portal",""),s.appendChild(d))},[s,d]),V(()=>{if(d&&a)return a.register(d)},[a,d]),cn(()=>{var b;!s||!d||(d instanceof Node&&s.contains(d)&&s.removeChild(d),s.childNodes.length<=0&&((b=s.parentElement)==null||b.removeChild(s)))});let c=Q();return p?!s||!d?null:zn.createPortal(c({ourProps:{ref:l},theirProps:n,slot:{},defaultTag:pn,name:"Portal"}),d):null});function il(e,t){let n=re(t),{enabled:r=!0,...l}=e,u=Q();return r?i.createElement(ll,{...l,ref:n}):u({ourProps:{ref:n},theirProps:l,slot:{},defaultTag:pn,name:"Portal"})}let ol=i.Fragment,hn=i.createContext(null);function al(e,t){let{target:n,...r}=e,l={ref:re(t)},u=Q();return i.createElement(hn.Provider,{value:n},u({ourProps:l,theirProps:r,defaultTag:ol,name:"Popover.Group"}))}let Pt=i.createContext(null);function ul(){let e=i.useContext(Pt),t=i.useRef([]),n=A(u=>(t.current.push(u),e&&e.register(u),()=>r(u))),r=A(u=>{let s=t.current.indexOf(u);s!==-1&&t.current.splice(s,1),e&&e.unregister(u)}),l=i.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,i.useMemo(()=>function({children:u}){return i.createElement(Pt.Provider,{value:l},u)},[l])]}let sl=z(il),vn=z(al),dl=Object.assign(sl,{Group:vn});function cl(e,t=typeof document<"u"?document.defaultView:null,n){let r=$e(e,"escape");un(t,"keydown",l=>{r&&(l.defaultPrevented||l.key===Zt.Escape&&n(l))})}function fl(){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 V(()=>{if(!t)return;function l(u){r(u.matches)}return t.addEventListener("change",l),()=>t.removeEventListener("change",l)},[t]),n}function ml({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=Be(n),l=A(()=>{var u,s;let d=[];for(let a of e)a!==null&&(a instanceof HTMLElement?d.push(a):"current"in a&&a.current instanceof HTMLElement&&d.push(a.current));if(t!=null&&t.current)for(let a of t.current)d.push(a);for(let a of(u=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?u:[])a!==document.body&&a!==document.head&&a instanceof HTMLElement&&a.id!=="headlessui-portal-root"&&(n&&(a.contains(n)||a.contains((s=n==null?void 0:n.getRootNode())==null?void 0:s.host))||d.some(p=>a.contains(p))||d.push(a));return d});return{resolveContainers:l,contains:A(u=>l().some(s=>s.contains(u)))}}let gn=i.createContext(null);function En({children:e,node:t}){let[n,r]=i.useState(null),l=bn(t??n);return i.createElement(gn.Provider,{value:l},e,l===null&&i.createElement(xt,{features:tt.Hidden,ref:u=>{var s,d;if(u){for(let a of(d=(s=Re(u))==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?d:[])if(a!==document.body&&a!==document.head&&a instanceof HTMLElement&&a!=null&&a.contains(u)){r(a);break}}}}))}function bn(e=null){var t;return(t=i.useContext(gn))!=null?t:e}function $t(){let e=i.useRef(!1);return V(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var Ye=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Ye||{});function pl(){let e=i.useRef(0);return on(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function wn(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 hl="div";var Ee=(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))(Ee||{});function vl(e,t){let n=i.useRef(null),r=re(n,t),{initialFocus:l,initialFocusFallback:u,containers:s,features:d=15,...a}=e;Ve()||(d=0);let p=Be(n);wl(d,{ownerDocument:p});let c=yl(d,{ownerDocument:p,container:n,initialFocus:l,initialFocusFallback:u});xl(d,{ownerDocument:p,container:n,containers:s,previousActiveElement:c});let b=pl(),y=A(g=>{let x=n.current;x&&(T=>T())(()=>{de(b.current,{[Ye.Forwards]:()=>{Ue(x,ie.First,{skipElements:[g.relatedTarget,u]})},[Ye.Backwards]:()=>{Ue(x,ie.Last,{skipElements:[g.relatedTarget,u]})}})})}),w=$e(!!(d&2),"focus-trap#tab-lock"),E=bt(),m=i.useRef(!1),f={ref:r,onKeyDown(g){g.key=="Tab"&&(m.current=!0,E.requestAnimationFrame(()=>{m.current=!1}))},onBlur(g){if(!(d&4))return;let x=wn(s);n.current instanceof HTMLElement&&x.add(n.current);let T=g.relatedTarget;T instanceof HTMLElement&&T.dataset.headlessuiFocusGuard!=="true"&&(yn(x,T)||(m.current?Ue(n.current,de(b.current,{[Ye.Forwards]:()=>ie.Next,[Ye.Backwards]:()=>ie.Previous})|ie.WrapAround,{relativeTo:g.target}):g.target instanceof HTMLElement&&oe(g.target)))}},h=Q();return i.createElement(i.Fragment,null,w&&i.createElement(xt,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:y,features:tt.Focusable}),h({ourProps:f,theirProps:a,defaultTag:hl,name:"FocusTrap"}),w&&i.createElement(xt,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:y,features:tt.Focusable}))}let gl=z(vl),El=Object.assign(gl,{features:Ee});function bl(e=!0){let t=i.useRef(fe.slice());return Ot(([n],[r])=>{r===!0&&n===!1&&Ze(()=>{t.current.splice(0)}),r===!1&&n===!0&&(t.current=fe.slice())},[e,fe,t]),A(()=>{var n;return(n=t.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function wl(e,{ownerDocument:t}){let n=!!(e&8),r=bl(n);Ot(()=>{n||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&oe(r())},[n]),cn(()=>{n&&oe(r())})}function yl(e,{ownerDocument:t,container:n,initialFocus:r,initialFocusFallback:l}){let u=i.useRef(null),s=$e(!!(e&1),"focus-trap#initial-focus"),d=$t();return Ot(()=>{if(e===0)return;if(!s){l!=null&&l.current&&oe(l.current);return}let a=n.current;a&&Ze(()=>{if(!d.current)return;let p=t==null?void 0:t.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===p){u.current=p;return}}else if(a.contains(p)){u.current=p;return}if(r!=null&&r.current)oe(r.current);else{if(e&16){if(Ue(a,ie.First|ie.AutoFocus)!==St.Error)return}else if(Ue(a,ie.First)!==St.Error)return;if(l!=null&&l.current&&(oe(l.current),(t==null?void 0:t.activeElement)===l.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}u.current=t==null?void 0:t.activeElement})},[l,s,e]),u}function xl(e,{ownerDocument:t,container:n,containers:r,previousActiveElement:l}){let u=$t(),s=!!(e&4);un(t==null?void 0:t.defaultView,"focus",d=>{if(!s||!u.current)return;let a=wn(r);n.current instanceof HTMLElement&&a.add(n.current);let p=l.current;if(!p)return;let c=d.target;c&&c instanceof HTMLElement?yn(a,c)?(l.current=c,oe(c)):(d.preventDefault(),d.stopPropagation(),oe(p)):oe(l.current)},!0)}function yn(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function xn(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Tn)!==i.Fragment||i.Children.count(e.children)===1}let it=i.createContext(null);it.displayName="TransitionContext";var Cl=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Cl||{});function Tl(){let e=i.useContext(it);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Sl(){let e=i.useContext(ot);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let ot=i.createContext(null);ot.displayName="NestingContext";function at(e){return"children"in e?at(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Cn(e,t){let n=he(e),r=i.useRef([]),l=$t(),u=bt(),s=A((w,E=ce.Hidden)=>{let m=r.current.findIndex(({el:f})=>f===w);m!==-1&&(de(E,{[ce.Unmount](){r.current.splice(m,1)},[ce.Hidden](){r.current[m].state="hidden"}}),u.microTask(()=>{var f;!at(r)&&l.current&&((f=n.current)==null||f.call(n))}))}),d=A(w=>{let E=r.current.find(({el:m})=>m===w);return E?E.state!=="visible"&&(E.state="visible"):r.current.push({el:w,state:"visible"}),()=>s(w,ce.Unmount)}),a=i.useRef([]),p=i.useRef(Promise.resolve()),c=i.useRef({enter:[],leave:[]}),b=A((w,E,m)=>{a.current.splice(0),t&&(t.chains.current[E]=t.chains.current[E].filter(([f])=>f!==w)),t==null||t.chains.current[E].push([w,new Promise(f=>{a.current.push(f)})]),t==null||t.chains.current[E].push([w,new Promise(f=>{Promise.all(c.current[E].map(([h,g])=>g)).then(()=>f())})]),E==="enter"?p.current=p.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(E)):m(E)}),y=A((w,E,m)=>{Promise.all(c.current[E].splice(0).map(([f,h])=>h)).then(()=>{var f;(f=a.current.shift())==null||f()}).then(()=>m(E))});return i.useMemo(()=>({children:r,register:d,unregister:s,onStart:b,onStop:y,wait:p,chains:c}),[d,s,r,b,y,c,p])}let Tn=i.Fragment,Sn=Qe.RenderStrategy;function Ol(e,t){var n,r;let{transition:l=!0,beforeEnter:u,afterEnter:s,beforeLeave:d,afterLeave:a,enter:p,enterFrom:c,enterTo:b,entered:y,leave:w,leaveFrom:E,leaveTo:m,...f}=e,[h,g]=i.useState(null),x=i.useRef(null),T=xn(e),F=re(...T?[x,t,g]:t===null?[]:[t]),Y=(n=f.unmount)==null||n?ce.Unmount:ce.Hidden,{show:U,appear:J,initial:R}=Tl(),[H,q]=i.useState(U?"visible":"hidden"),K=Sl(),{register:L,unregister:M}=K;V(()=>L(x),[L,x]),V(()=>{if(Y===ce.Hidden&&x.current){if(U&&H!=="visible"){q("visible");return}return de(H,{hidden:()=>M(x),visible:()=>L(x)})}},[H,x,L,M,U,Y]);let I=Ve();V(()=>{if(T&&I&&H==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,H,I,T]);let be=R&&!J,we=J&&U&&R,me=i.useRef(!1),Z=Cn(()=>{me.current||(q("hidden"),M(x))},K),ye=A(Te=>{me.current=!0;let ae=Te?"enter":"leave";Z.onStart(x,ae,ue=>{ue==="enter"?u==null||u():ue==="leave"&&(d==null||d())})}),N=A(Te=>{let ae=Te?"enter":"leave";me.current=!1,Z.onStop(x,ae,ue=>{ue==="enter"?s==null||s():ue==="leave"&&(a==null||a())}),ae==="leave"&&!at(Z)&&(q("hidden"),M(x))});i.useEffect(()=>{T&&l||(ye(U),N(U))},[U,T,l]);let xe=!(!l||!T||!I||be),[,B]=Kr(xe,h,U,{start:ye,end:N}),jt=ve({ref:F,className:((r=wt(f.className,we&&p,we&&c,B.enter&&p,B.enter&&B.closed&&c,B.enter&&!B.closed&&b,B.leave&&w,B.leave&&!B.closed&&E,B.leave&&B.closed&&m,!B.transition&&U&&y))==null?void 0:r.trim())||void 0,...zr(B)}),Ce=0;H==="visible"&&(Ce|=ne.Open),H==="hidden"&&(Ce|=ne.Closed),B.enter&&(Ce|=ne.Opening),B.leave&&(Ce|=ne.Closing);let qe=Q();return i.createElement(ot.Provider,{value:Z},i.createElement(Zr,{value:Ce},qe({ourProps:jt,theirProps:f,defaultTag:Tn,features:Sn,visible:H==="visible",name:"Transition.Child"})))}function Pl(e,t){let{show:n,appear:r=!1,unmount:l=!0,...u}=e,s=i.useRef(null),d=xn(e),a=re(...d?[s,t]:t===null?[]:[t]);Ve();let p=lt();if(n===void 0&&p!==null&&(n=(p&ne.Open)===ne.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,b]=i.useState(n?"visible":"hidden"),y=Cn(()=>{n||b("hidden")}),[w,E]=i.useState(!0),m=i.useRef([n]);V(()=>{w!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),E(!1))},[m,n]);let f=i.useMemo(()=>({show:n,appear:r,initial:w}),[n,r,w]);V(()=>{n?b("visible"):!at(y)&&s.current!==null&&b("hidden")},[n,y]);let h={unmount:l},g=A(()=>{var F;w&&E(!1),(F=e.beforeEnter)==null||F.call(e)}),x=A(()=>{var F;w&&E(!1),(F=e.beforeLeave)==null||F.call(e)}),T=Q();return i.createElement(ot.Provider,{value:y},i.createElement(it.Provider,{value:f},T({ourProps:{...h,as:i.Fragment,children:i.createElement(On,{ref:a,...h,...u,beforeEnter:g,beforeLeave:x})},theirProps:{},defaultTag:i.Fragment,features:Sn,visible:c==="visible",name:"Transition"})))}function $l(e,t){let n=i.useContext(it)!==null,r=lt()!==null;return i.createElement(i.Fragment,null,!n&&r?i.createElement(Mt,{ref:t,...e}):i.createElement(On,{ref:t,...e}))}let Mt=z(Pl),On=z(Ol),Me=z($l),Pn=Object.assign(Mt,{Child:Me,Root:Mt});var Ml=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ml||{}),Fl=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Fl||{});let kl={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Ft=i.createContext(null);Ft.displayName="DialogContext";function ut(e){let t=i.useContext(Ft);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ut),n}return t}function jl(e,t){return de(t.type,kl,e,t)}let $n=z(function(e,t){let n=i.useId(),{id:r=`headlessui-dialog-${n}`,open:l,onClose:u,initialFocus:s,role:d="dialog",autoFocus:a=!0,__demoMode:p=!1,unmount:c=!1,...b}=e,y=i.useRef(!1);d=function(){return d==="dialog"||d==="alertdialog"?d:(y.current||(y.current=!0,console.warn(`Invalid role [${d}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let w=lt();l===void 0&&w!==null&&(l=(w&ne.Open)===ne.Open);let E=i.useRef(null),m=re(E,t),f=Be(E),h=l?0:1,[g,x]=i.useReducer(jl,{titleId:null,descriptionId:null,panelRef:i.createRef()}),T=A(()=>u(!1)),F=A(N=>x({type:0,id:N})),Y=Ve()?h===0:!1,[U,J]=ul(),R={get current(){var N;return(N=g.panelRef.current)!=null?N:E.current}},H=bn(),{resolveContainers:q}=ml({mainTreeNode:H,portals:U,defaultContainers:[R]}),K=w!==null?(w&ne.Closing)===ne.Closing:!1;Sr(p||K?!1:Y,{allowed:A(()=>{var N,xe;return[(xe=(N=E.current)==null?void 0:N.closest("[data-headlessui-portal]"))!=null?xe:null]}),disallowed:A(()=>{var N;return[(N=H==null?void 0:H.closest("body > *:not(#headlessui-portal-root)"))!=null?N:null]})}),Dr(Y,q,N=>{N.preventDefault(),T()}),cl(Y,f==null?void 0:f.defaultView,N=>{N.preventDefault(),N.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),T()}),Yr(p||K?!1:Y,f,q),Or(Y,E,T);let[L,M]=vr(),I=i.useMemo(()=>[{dialogState:h,close:T,setTitleId:F,unmount:c},g],[h,g,T,F,c]),be=i.useMemo(()=>({open:h===0}),[h]),we={ref:m,id:r,role:d,tabIndex:-1,"aria-modal":p?void 0:h===0?!0:void 0,"aria-labelledby":g.titleId,"aria-describedby":L,unmount:c},me=!fl(),Z=Ee.None;Y&&!p&&(Z|=Ee.RestoreFocus,Z|=Ee.TabLock,a&&(Z|=Ee.AutoFocus),me&&(Z|=Ee.InitialFocus));let ye=Q();return i.createElement(Qr,null,i.createElement(mn,{force:!0},i.createElement(dl,null,i.createElement(Ft.Provider,{value:I},i.createElement(vn,{target:E},i.createElement(mn,{force:!1},i.createElement(M,{slot:be},i.createElement(J,null,i.createElement(El,{initialFocus:s,initialFocusFallback:E,containers:q,features:Z},i.createElement(xr,{value:T},ye({ourProps:we,theirProps:b,slot:be,defaultTag:_l,features:Ll,visible:h===0,name:"Dialog"})))))))))))}),_l="div",Ll=Qe.RenderStrategy|Qe.Static;function Al(e,t){let{transition:n=!1,open:r,...l}=e,u=lt(),s=e.hasOwnProperty("open")||u!==null,d=e.hasOwnProperty("onClose");if(!s&&!d)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!s)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!d)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!u&&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(En,null,i.createElement(Pn,{show:r,transition:n,unmount:l.unmount},i.createElement($n,{ref:t,...l}))):i.createElement(En,null,i.createElement($n,{ref:t,open:r,...l}))}let Il="div";function Nl(e,t){let n=i.useId(),{id:r=`headlessui-dialog-panel-${n}`,transition:l=!1,...u}=e,[{dialogState:s,unmount:d},a]=ut("Dialog.Panel"),p=re(t,a.panelRef),c=i.useMemo(()=>({open:s===0}),[s]),b=A(f=>{f.stopPropagation()}),y={ref:p,id:r,onClick:b},w=l?Me:i.Fragment,E=l?{unmount:d}:{},m=Q();return i.createElement(w,{...E},m({ourProps:y,theirProps:u,slot:c,defaultTag:Il,name:"Dialog.Panel"}))}let Dl="div";function Wl(e,t){let{transition:n=!1,...r}=e,[{dialogState:l,unmount:u}]=ut("Dialog.Backdrop"),s=i.useMemo(()=>({open:l===0}),[l]),d={ref:t,"aria-hidden":!0},a=n?Me:i.Fragment,p=n?{unmount:u}:{},c=Q();return i.createElement(a,{...p},c({ourProps:d,theirProps:r,slot:s,defaultTag:Dl,name:"Dialog.Backdrop"}))}let Ul="h2";function Hl(e,t){let n=i.useId(),{id:r=`headlessui-dialog-title-${n}`,...l}=e,[{dialogState:u,setTitleId:s}]=ut("Dialog.Title"),d=re(t);i.useEffect(()=>(s(r),()=>s(null)),[r,s]);let a=i.useMemo(()=>({open:u===0}),[u]),p={ref:d,id:r};return Q()({ourProps:p,theirProps:l,slot:a,defaultTag:Ul,name:"Dialog.Title"})}let Bl=z(Al),kt=z(Nl);z(Wl);let Vl=z(Hl),Yl=Object.assign(Bl,{Panel:kt,Title:Vl,Description:wr});function Mn({onClick:e}){return O.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:e,children:[O.jsx("span",{className:"sr-only",children:"Close"}),O.jsx("svg",{className:"size-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true",children:O.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}const ql=({modalContext:e,config:t,children:n})=>O.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:O.jsx("div",{className:Je("im-modal-positioner flex min-h-full justify-center",{"items-start":t.position==="top","items-center":t.position==="center","items-end":t.position==="bottom"}),children:O.jsx(Me,{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",afterLeave:e.afterLeave,className:Je("im-modal-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:O.jsxs(kt,{className:`im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,children:[t.closeButton&&O.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:O.jsx(Mn,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})}),Xl=({modalContext:e,config:t,children:n})=>O.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:O.jsx("div",{className:Je("im-slideover-positioner flex min-h-full items-center",{"justify-start":t.position==="left","justify-end":t.position==="right"}),children:O.jsx(Me,{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"}`,afterLeave:e.afterLeave,className:Je("im-slideover-wrapper w-full transition duration-300 ease-in-out",e.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":t.maxWidth==="sm","sm:max-w-md":t.maxWidth==="md","sm:max-w-md md:max-w-lg":t.maxWidth==="lg","sm:max-w-md md:max-w-xl":t.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":t.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":t.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":t.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":t.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":t.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":t.maxWidth==="7xl"}),children:O.jsxs(kt,{className:`im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,children:[t.closeButton&&O.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:O.jsx(Mn,{onClick:e.close})}),typeof n=="function"?n({modalContext:e,config:t}):n]})})})}),Fn=i.forwardRef(({name:e,children:t,...n},r)=>{const l=s=>typeof t=="function"?t(s):t,u=i.useRef(null);return i.useImperativeHandle(r,()=>u.current,[u]),O.jsx(gt,{ref:u,name:e,...n,children:({afterLeave:s,close:d,config:a,emit:p,getChildModal:c,getParentModal:b,id:y,index:w,isOpen:E,modalContext:m,onTopOfStack:f,reload:h,setOpen:g,shouldRender:x})=>O.jsx(Pn,{appear:!0,show:E??!1,children:O.jsxs(Yl,{as:"div",className:"im-dialog relative z-20",onClose:()=>a.closeExplicitly?null:d(),"data-inertiaui-modal-id":y,"data-inertiaui-modal-index":w,children:[w===0?O.jsx(Me,{enter:"transition transform ease-in-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition transform ease-in-out duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:f?O.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):O.jsx("div",{})}):null,w>0&&f?O.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,a.slideover?O.jsx(Xl,{modalContext:m,config:a,children:l({afterLeave:s,close:d,config:a,emit:p,getChildModal:c,getParentModal:b,id:y,index:w,isOpen:E,modalContext:m,onTopOfStack:f,reload:h,setOpen:g,shouldRender:x})}):O.jsx(ql,{modalContext:m,config:a,children:l({afterLeave:s,close:d,config:a,emit:p,getChildModal:c,getParentModal:b,id:y,index:w,isOpen:E,modalContext:m,onTopOfStack:f,reload:h,setOpen:g,shouldRender:x})})]})})})});Fn.displayName="Modal";const zl=({href:e,method:t="get",data:n={},as:r="a",headers:l={},queryStringArrayFormat:u="brackets",onAfterLeave:s=null,onBlur:d=null,onClose:a=null,onError:p=null,onFocus:c=null,onStart:b=null,onSuccess:y=null,navigate:w=null,children:E,...m})=>{const[f,h]=i.useState(!1),[g,x]=i.useState(null),{stack:T,visit:F}=De(),Y=i.useMemo(()=>w??Ke("navigate"),[w]),U={},J={};Object.keys(m).forEach(M=>{Yt.includes(M)||(M.startsWith("on")&&typeof m[M]=="function"?M.toLowerCase()in window?U[M]=m[M]:J[M]=m[M]:U[M]=m[M])});const[R,H]=i.useState(!1);i.useEffect(()=>{g&&(g.onTopOfStack&&R?c==null||c():!g.onTopOfStack&&!R&&(d==null||d()),H(!g.onTopOfStack))},[T]);const q=i.useCallback(()=>{a==null||a()},[a]),K=i.useCallback(()=>{x(null),s==null||s()},[s]),L=i.useCallback(M=>{M==null||M.preventDefault(),!f&&(e.startsWith("#")||(h(!0),b==null||b()),F(e,t,n,l,tr(Ut(m,Yt)),()=>q(T.length),K,u,Y).then(I=>{x(I),I.registerEventListenersFromProps(J),y==null||y()}).catch(I=>{console.error(I),p==null||p(I)}).finally(()=>h(!1)))},[e,t,n,l,u,m,q,K]);return O.jsx(r,{...U,href:e,onClick:L,children:typeof E=="function"?E({loading:f}):E})};function Kl(){return De().stack[vt()]??null}const Gl=e=>t=>(t.default.layout=n=>i.createElement(e,{},n),t);k.HeadlessModal=gt,k.Modal=Fn,k.ModalLink=zl,k.ModalRoot=Xt,k.ModalStackProvider=Vt,k.getConfig=Ke,k.initFromPageProps=qt,k.putConfig=Rn,k.renderApp=rr,k.resetConfig=Jn,k.setPageLayout=Gl,k.useModal=Kl,k.useModalIndex=vt,k.useModalStack=De,Object.defineProperty(k,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.15.0",
4
+ "version": "0.16.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -24,13 +24,15 @@
24
24
  "eslint": "eslint \"src/**/*.{js,jsx}\" --fix",
25
25
  "prettier": "prettier -w src/"
26
26
  },
27
- "devDependencies": {
27
+ "dependencies": {
28
28
  "@headlessui/react": "^2.1.0",
29
29
  "@heroicons/react": "^2.1.4",
30
+ "clsx": "^2.1.1"
31
+ },
32
+ "devDependencies": {
30
33
  "@inertiajs/react": "^1.3.0||^2.0.0",
31
34
  "@vitejs/plugin-react": "^4.3.1",
32
35
  "axios": "^1.6.0",
33
- "clsx": "^2.1.1",
34
36
  "eslint-config-prettier": "^9.0.0",
35
37
  "eslint-plugin-prettier": "^5.1.0",
36
38
  "eslint-plugin-react-hooks": "^4.6.2",
@@ -38,7 +40,6 @@
38
40
  "eslint-plugin-tailwindcss": "^3.15.1",
39
41
  "eslint-plugin-unused-imports": "^3.1.0",
40
42
  "eslint": "^8.57.0",
41
- "focus-trap": "^7.6.2",
42
43
  "prettier-plugin-tailwindcss": "^0.5.12",
43
44
  "prettier": "^3.2.4",
44
45
  "react-dom": "^18.2.0",
package/src/Modal.jsx CHANGED
@@ -1,9 +1,8 @@
1
- import { Transition, TransitionChild } from '@headlessui/react'
2
- import { forwardRef, useRef, useImperativeHandle, useEffect } from 'react'
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, ...props }, ref) => {
9
8
  const renderChildren = (contentProps) => {
@@ -16,14 +15,6 @@ const Modal = forwardRef(({ name, children, ...props }, ref) => {
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 (
@@ -52,8 +43,10 @@ const Modal = forwardRef(({ name, children, ...props }, ref) => {
52
43
  appear={true}
53
44
  show={isOpen ?? false}
54
45
  >
55
- <div
46
+ <Dialog
47
+ as="div"
56
48
  className="im-dialog relative z-20"
49
+ onClose={() => (config.closeExplicitly ? null : close())}
57
50
  data-inertiaui-modal-id={id}
58
51
  data-inertiaui-modal-index={index}
59
52
  >
@@ -127,7 +120,7 @@ const Modal = forwardRef(({ name, children, ...props }, ref) => {
127
120
  })}
128
121
  </ModalContent>
129
122
  )}
130
- </div>
123
+ </Dialog>
131
124
  </Transition>
132
125
  )}
133
126
  </HeadlessModal>