@inertiaui/modal-react 0.14.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(F,o){typeof exports=="object"&&typeof module<"u"?o(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"],o):(F=typeof globalThis<"u"?globalThis:F||self,o(F.InertiaUIModal={},F.React,F.Axios,F.react,F.core,F.ReactDOM))})(this,function(F,o,le,Oe,Xr,zr){"use strict";var Co=Object.defineProperty;var To=(F,o,le)=>o in F?Co(F,o,{enumerable:!0,configurable:!0,writable:!0,value:le}):F[o]=le;var te=(F,o,le)=>To(F,typeof o!="symbol"?o+"":o,le);function Kr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const je=Kr(o),_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 Gr{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(_e))}put(t,r){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 n=t.split(".");let l=this.config;for(let s=0;s<n.length-1;s++)l=l[n[s]]=l[n[s]]||{};l[n[n.length-1]]=r}get(t){if(typeof t>"u")return this.config;const r=t.split(".");let n=this.config;for(const l of r){if(n[l]===void 0)return null;n=n[l]}return n}}const Ke=new Gr,Rr=()=>Ke.reset(),Jr=(e,t)=>Ke.put(e,t),Ge=e=>Ke.get(e),Pe=(e,t)=>Ke.get(e?`slideover.${t}`:`modal.${t}`);var mt={exports:{}},Le={};/**
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 Ut;function Zr(){if(Ut)return Le;Ut=1;var e=o,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(c,a,p){var d,b={},x=null,E=null;p!==void 0&&(x=""+p),a.key!==void 0&&(x=""+a.key),a.ref!==void 0&&(E=a.ref);for(d in a)n.call(a,d)&&!s.hasOwnProperty(d)&&(b[d]=a[d]);if(c&&c.defaultProps)for(d in a=c.defaultProps,a)b[d]===void 0&&(b[d]=a[d]);return{$$typeof:t,type:c,key:x,ref:E,props:b,_owner:l.current}}return Le.Fragment=r,Le.jsx=u,Le.jsxs=u,Le}var Ae={};/**
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,21 +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 Ht;function Qr(){return Ht||(Ht=1,process.env.NODE_ENV!=="production"&&function(){var e=o,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),E=Symbol.for("react.offscreen"),y=Symbol.iterator,m="@@iterator";function f(i){if(i===null||typeof i!="object")return null;var h=y&&i[y]||i[m];return typeof h=="function"?h:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(i){{for(var h=arguments.length,w=new Array(h>1?h-1:0),S=1;S<h;S++)w[S-1]=arguments[S];C("error",i,w)}}function C(i,h,w){{var S=v.ReactDebugCurrentFrame,j=S.getStackAddendum();j!==""&&(h+="%s",w=w.concat([j]));var L=w.map(function($){return String($)});L.unshift("Warning: "+h),Function.prototype.apply.call(console[i],console,L)}}var T=!1,k=!1,Y=!1,U=!1,R=!1,J;J=Symbol.for("react.module.reference");function H(i){return!!(typeof i=="string"||typeof i=="function"||i===n||i===s||R||i===l||i===p||i===d||U||i===E||T||k||Y||typeof i=="object"&&i!==null&&(i.$$typeof===x||i.$$typeof===b||i.$$typeof===u||i.$$typeof===c||i.$$typeof===a||i.$$typeof===J||i.getModuleId!==void 0))}function q(i,h,w){var S=i.displayName;if(S)return S;var j=h.displayName||h.name||"";return j!==""?w+"("+j+")":w}function K(i){return i.displayName||"Context"}function _(i){if(i==null)return null;if(typeof i.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case l:return"StrictMode";case p:return"Suspense";case d:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case c:var h=i;return K(h)+".Consumer";case u:var w=i;return K(w._context)+".Provider";case a:return q(i,i.render,"ForwardRef");case b:var S=i.displayName||null;return S!==null?S:_(i.type)||"Memo";case x:{var j=i,L=j._payload,$=j._init;try{return _($(L))}catch{return null}}}return null}var M=Object.assign,I=0,be,Ee,me,Z,we,N,xe;function B(){}B.__reactDisabledLog=!0;function _t(){{if(I===0){be=console.log,Ee=console.info,me=console.warn,Z=console.error,we=console.group,N=console.groupCollapsed,xe=console.groupEnd;var i={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}I++}}function Ce(){{if(I--,I===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},i,{value:be}),info:M({},i,{value:Ee}),warn:M({},i,{value:me}),error:M({},i,{value:Z}),group:M({},i,{value:we}),groupCollapsed:M({},i,{value:N}),groupEnd:M({},i,{value:xe})})}I<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var qe=v.ReactCurrentDispatcher,Te;function ae(i,h,w){{if(Te===void 0)try{throw Error()}catch(j){var S=j.stack.trim().match(/\n( *(at )?)/);Te=S&&S[1]||""}return`
18
- `+Te+i}}var se=!1,ct;{var Jl=typeof WeakMap=="function"?WeakMap:Map;ct=new Jl}function jr(i,h){if(!i||se)return"";{var w=ct.get(i);if(w!==void 0)return w}var S;se=!0;var j=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var L;L=qe.current,qe.current=null,_t();try{if(h){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(i,[],$)}else{try{$.call()}catch(G){S=G}i.call($.prototype)}}else{try{throw Error()}catch(G){S=G}i()}}catch(G){if(G&&S&&typeof G.stack=="string"){for(var P=G.stack.split(`
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
19
  `),X=S.stack.split(`
20
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 i.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",i.displayName)),typeof i=="function"&&ct.set(i,ee),ee}while(D>=1&&W>=0);break}}}finally{se=!1,qe.current=L,Ce(),Error.prepareStackTrace=j}var Fe=i?i.displayName||i.name:"",Se=Fe?ae(Fe):"";return typeof i=="function"&&ct.set(i,Se),Se}function Zl(i,h,w){return jr(i,!1)}function Ql(i){var h=i.prototype;return!!(h&&h.isReactComponent)}function dt(i,h,w){if(i==null)return"";if(typeof i=="function")return jr(i,Ql(i));if(typeof i=="string")return ae(i);switch(i){case p:return ae("Suspense");case d:return ae("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case a:return Zl(i.render);case b:return dt(i.type,h,w);case x:{var S=i,j=S._payload,L=S._init;try{return dt(L(j),h,w)}catch{}}}return""}var Xe=Object.prototype.hasOwnProperty,_r={},Lr=v.ReactDebugCurrentFrame;function ft(i){if(i){var h=i._owner,w=dt(i.type,i._source,h?h.type:null);Lr.setExtraStackFrame(w)}else Lr.setExtraStackFrame(null)}function eo(i,h,w,S,j){{var L=Function.call.bind(Xe);for(var $ in i)if(L(i,$)){var P=void 0;try{if(typeof i[$]!="function"){var X=Error((S||"React class")+": "+w+" type `"+$+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[$]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw X.name="Invariant Violation",X}P=i[$](h,$,S,w,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(D){P=D}P&&!(P instanceof Error)&&(ft(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",w,$,typeof P),ft(null)),P instanceof Error&&!(P.message in _r)&&(_r[P.message]=!0,ft(j),g("Failed %s type: %s",w,P.message),ft(null))}}}var to=Array.isArray;function Lt(i){return to(i)}function ro(i){{var h=typeof Symbol=="function"&&Symbol.toStringTag,w=h&&i[Symbol.toStringTag]||i.constructor.name||"Object";return w}}function no(i){try{return Ar(i),!1}catch{return!0}}function Ar(i){return""+i}function Ir(i){if(no(i))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ro(i)),Ar(i)}var ze=v.ReactCurrentOwner,lo={key:!0,ref:!0,__self:!0,__source:!0},Nr,Dr,At;At={};function oo(i){if(Xe.call(i,"ref")){var h=Object.getOwnPropertyDescriptor(i,"ref").get;if(h&&h.isReactWarning)return!1}return i.ref!==void 0}function io(i){if(Xe.call(i,"key")){var h=Object.getOwnPropertyDescriptor(i,"key").get;if(h&&h.isReactWarning)return!1}return i.key!==void 0}function ao(i,h){if(typeof i.ref=="string"&&ze.current&&h&&ze.current.stateNode!==h){var w=_(ze.current.type);At[w]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',_(ze.current.type),i.ref),At[w]=!0)}}function so(i,h){{var w=function(){Nr||(Nr=!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))};w.isReactWarning=!0,Object.defineProperty(i,"key",{get:w,configurable:!0})}}function uo(i,h){{var w=function(){Dr||(Dr=!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))};w.isReactWarning=!0,Object.defineProperty(i,"ref",{get:w,configurable:!0})}}var co=function(i,h,w,S,j,L,$){var P={$$typeof:t,type:i,key:h,ref:w,props:$,_owner:L};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 fo(i,h,w,S,j){{var L,$={},P=null,X=null;w!==void 0&&(Ir(w),P=""+w),io(h)&&(Ir(h.key),P=""+h.key),oo(h)&&(X=h.ref,ao(h,j));for(L in h)Xe.call(h,L)&&!lo.hasOwnProperty(L)&&($[L]=h[L]);if(i&&i.defaultProps){var D=i.defaultProps;for(L in D)$[L]===void 0&&($[L]=D[L])}if(P||X){var W=typeof i=="function"?i.displayName||i.name||"Unknown":i;P&&so($,W),X&&uo($,W)}return co(i,P,X,j,S,ze.current,$)}}var It=v.ReactCurrentOwner,Wr=v.ReactDebugCurrentFrame;function ke(i){if(i){var h=i._owner,w=dt(i.type,i._source,h?h.type:null);Wr.setExtraStackFrame(w)}else Wr.setExtraStackFrame(null)}var Nt;Nt=!1;function Dt(i){return typeof i=="object"&&i!==null&&i.$$typeof===t}function Ur(){{if(It.current){var i=_(It.current.type);if(i)return`
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 \``+i+"`."}return""}}function mo(i){return""}var Hr={};function po(i){{var h=Ur();if(!h){var w=typeof i=="string"?i:i.displayName||i.name;w&&(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 <`+w+">.")}return h}}function Br(i,h){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var w=po(h);if(Hr[w])return;Hr[w]=!0;var S="";i&&i._owner&&i._owner!==It.current&&(S=" It was passed a child from "+_(i._owner.type)+"."),ke(i),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',w,S),ke(null)}}function Vr(i,h){{if(typeof i!="object")return;if(Lt(i))for(var w=0;w<i.length;w++){var S=i[w];Dt(S)&&Br(S,h)}else if(Dt(i))i._store&&(i._store.validated=!0);else if(i){var j=f(i);if(typeof j=="function"&&j!==i.entries)for(var L=j.call(i),$;!($=L.next()).done;)Dt($.value)&&Br($.value,h)}}}function vo(i){{var h=i.type;if(h==null||typeof h=="string")return;var w;if(typeof h=="function")w=h.propTypes;else if(typeof h=="object"&&(h.$$typeof===a||h.$$typeof===b))w=h.propTypes;else return;if(w){var S=_(h);eo(w,i.props,"prop",S,i)}else if(h.PropTypes!==void 0&&!Nt){Nt=!0;var j=_(h);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",j||"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 ho(i){{for(var h=Object.keys(i.props),w=0;w<h.length;w++){var S=h[w];if(S!=="children"&&S!=="key"){ke(i),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),ke(null);break}}i.ref!==null&&(ke(i),g("Invalid attribute `ref` supplied to `React.Fragment`."),ke(null))}}var Yr={};function qr(i,h,w,S,j,L){{var $=H(i);if(!$){var P="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).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=mo();X?P+=X:P+=Ur();var D;i===null?D="null":Lt(i)?D="array":i!==void 0&&i.$$typeof===t?(D="<"+(_(i.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):D=typeof i,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=fo(i,h,w,j,L);if(W==null)return W;if($){var ee=h.children;if(ee!==void 0)if(S)if(Lt(ee)){for(var Fe=0;Fe<ee.length;Fe++)Vr(ee[Fe],i);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 Vr(ee,i)}if(Xe.call(h,"key")){var Se=_(i),G=Object.keys(h).filter(function(xo){return xo!=="key"}),Wt=G.length>0?"{key: someKey, "+G.join(": ..., ")+": ...}":"{key: someKey}";if(!Yr[Se+Wt]){var wo=G.length>0?"{"+G.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} />`,Wt,Se,wo,Se),Yr[Se+Wt]=!0}}return i===n?ho(W):vo(W),W}}function go(i,h,w){return qr(i,h,w,!0)}function yo(i,h,w){return qr(i,h,w,!1)}var bo=yo,Eo=go;Ae.Fragment=n,Ae.jsx=bo,Ae.jsxs=Eo}()),Ae}process.env.NODE_ENV==="production"?mt.exports=Zr():mt.exports=Qr();var O=mt.exports;function en(e,t){return Array.isArray(e)?e.filter(r=>!t.includes(r)):Object.keys(e).reduce((r,n)=>(t.includes(n)||(r[n]=e[n]),r),{})}function Bt(e,t){return Array.isArray(e)?e.filter(r=>t.includes(r)):t.reduce((r,n)=>(n in e&&(r[n]=e[n]),r),{})}function tn(e){return Array.isArray(e)?e.filter(t=>t!==null):Object.keys(e).reduce((t,r)=>(r in e&&e[r]!==null&&(t[r]=e[r]),t),{})}function rn(e,t=3,r=10){return new Promise((n,l)=>{const s=e();if(s){n(s);return}let u=t*1e3/r;const c=setInterval(()=>{const a=e();a&&(clearInterval(c),n(a)),--u<=0&&(clearInterval(c),l(new Error("Condition not met in time")))},r)})}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,r)=>r.toUpperCase()),e=e.replace(/(.)(?=[A-Z])/g,"$1-"),e.toLowerCase()):e):""}const Re=o.createContext(null);Re.displayName="ModalStackContext";let Vt=null,Yt=null,Ne=null,pt=null,vt=[];const qt=({children:e})=>{const[t,r]=o.useState([]),[n,l]=o.useState({}),s=m=>{r(f=>{const v=m([...f]),g=C=>{var T;return v.length<2?!0:((T=v.map(k=>({id:k.id,shouldRender:k.shouldRender})).reverse().find(k=>k.shouldRender))==null?void 0:T.id)===C};return v.forEach((C,T)=>{v[T].onTopOfStack=g(C.id),v[T].getParentModal=()=>T<1?null:v.slice(0,T).reverse().find(k=>k.isOpen),v[T].getChildModal=()=>T===v.length-1?null:v.slice(T+1).find(k=>k.isOpen)}),v})};o.useEffect(()=>{vt=t},[t]);class u{constructor(f,v,g,C,T){te(this,"update",(f,v,g)=>{s(C=>C.map(T=>(T.id===this.id&&(T.config=f,T.onCloseCallback=v,T.afterLeaveCallback=g),T)))});te(this,"show",()=>{s(f=>f.map(v=>(v.id===this.id&&!v.isOpen&&(v.isOpen=!0,v.shouldRender=!0),v)))});te(this,"setOpen",f=>{f?this.show():this.close()});te(this,"close",()=>{s(f=>f.map(v=>{var g;return v.id===this.id&&v.isOpen&&(Object.keys(v.listeners).forEach(C=>{v.off(C)}),v.isOpen=!1,(g=v.onCloseCallback)==null||g.call(v)),v}))});te(this,"afterLeave",()=>{this.isOpen||s(f=>{const v=f.map(g=>{var C;return g.id===this.id&&!g.isOpen&&(g.shouldRender=!1,(C=g.afterLeaveCallback)==null||C.call(g),g.afterLeaveCallback=null),g});return this.index===0?[]:v})});te(this,"on",(f,v)=>{f=Ie(f),this.listeners[f]=this.listeners[f]??[],this.listeners[f].push(v)});te(this,"off",(f,v)=>{var g;f=Ie(f),v?this.listeners[f]=((g=this.listeners[f])==null?void 0:g.filter(C=>C!==v))??[]:delete this.listeners[f]});te(this,"emit",(f,...v)=>{var g;(g=this.listeners[Ie(f)])==null||g.forEach(C=>C(...v))});te(this,"registerEventListenersFromProps",f=>{const v=[];return Object.keys(f).filter(g=>g.startsWith("on")).forEach(g=>{const C=Ie(g).replace(/^on-/,"");this.on(C,f[g]),v.push(()=>this.off(C,f[g]))}),()=>v.forEach(g=>g())});te(this,"reload",(f={})=>{var g;let v=Object.keys(this.response.props);f.only&&(v=Bt(v,f.only)),f.except&&(v=en(v,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":v.join(","),"X-InertiaUI-Modal":!0,"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":Ne}}).then(C=>{this.updateProps(C.data.props)})});te(this,"updateProps",f=>{Object.assign(this.props,f),s(v=>v)});this.id=u.generateId(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=f,this.props=v.props,this.response=v,this.config=g,this.onCloseCallback=C,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 c=(m,f={},v=null,g=null)=>Yt(m.component).then(C=>a(C,m,f,v,g)),a=(m,f,v,g,C)=>{const T=new u(m,f,v,g,C);return T.index=t.length,s(k=>[...k,T]),T.show(),T};function p(m,f,v,g){if(!n[m])throw new Error(`The local modal "${m}" has not been registered.`);const C=a(null,{},f,v,g);return C.name=m,n[m].callback(C),C}const d=(m,f={})=>b(m,f.method??"get",f.data??{},f.headers??{},f.config??{},f.onClose,f.onAfterLeave,f.queryStringArrayFormat??"brackets",f.navigate??Ge("navigate")).then(v=>{const g=f.listeners??{};return Object.keys(g).forEach(C=>{const T=Ie(C);v.on(T,g[C])}),v}),b=(m,f,v={},g={},C={},T=null,k=null,Y="brackets",U=!1)=>new Promise((R,J)=>{if(m.startsWith("#")){R(p(m.substring(1),C,T,k));return}const[H,q]=Xr.mergeDataIntoQueryString(f,m||"",v,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":Vt,"X-InertiaUI-Modal":!0,"X-InertiaUI-Modal-Use-Router":K?1:0,"X-InertiaUI-Modal-Base-Url":Ne},K)return pt=null,Oe.router.visit(H,{method:f,data:q,headers:g,preserveScroll:!0,preserveState:!0,onError:J,onFinish:()=>{rn(()=>pt).then(_=>{const M=_.onCloseCallback,I=_.afterLeaveCallback;_.update(C,()=>{T==null||T(),M==null||M()},()=>{k==null||k(),I==null||I()}),R(_)})}});le({url:H,method:f,data:q,headers:g}).then(_=>R(c(_.data,C,T,k))).catch(_=>{J(_)})}),y={stack:t,localModals:n,push:a,pushFromResponseData:c,closeAll:()=>{vt.reverse().forEach(m=>m.close())},reset:()=>s(()=>[]),visit:b,visitModal:d,registerLocalModal:(m,f)=>{l(v=>({...v,[m]:{name:m,callback:f}}))},removeLocalModal:m=>{l(f=>{const v={...f};return delete v[m],v})}};return O.jsx(Re.Provider,{value:y,children:e})},De=()=>{const e=o.useContext(Re);if(e===null)throw new Error("useModalStack must be used within a ModalStackProvider");return e},Xt=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],zt=e=>{e.initialPage&&(Vt=e.initialPage.version),e.resolveComponent&&(Yt=e.resolveComponent)},nn=(e,t)=>{zt(t);const r=({Component:n,props:l,key:s})=>{const u=()=>{const c=o.createElement(n,{key:s,...l});return typeof n.layout=="function"?n.layout(c):Array.isArray(n.layout)?n.layout.concat(c).reverse().reduce((p,d)=>o.createElement(d,l,p)):c};return O.jsxs(O.Fragment,{children:[u(),O.jsx(Kt,{})]})};return O.jsx(qt,{children:O.jsx(e,{...t,children:r})})},Kt=({children:e})=>{var c;const t=o.useContext(Re);let r=!1,n=!1;o.useEffect(()=>Oe.router.on("start",()=>r=!0),[]),o.useEffect(()=>Oe.router.on("finish",()=>r=!1),[]),o.useEffect(()=>Oe.router.on("navigate",function(a){const p=a.detail.page.props._inertiaui_modal;if(!p){n&&t.closeAll();return}n=p,Ne=p.baseUrl,t.pushFromResponseData(p,{},()=>{if(!p.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!r&&window.location.href!==p.baseUrl&&Oe.router.visit(p.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(d=>{pt=d})}),[]);const l=a=>(vt.length&&(a.headers["X-InertiaUI-Modal-Base-Url"]=Ne),a);o.useEffect(()=>(le.interceptors.request.use(l),()=>le.interceptors.request.eject(l)),[]);const s=Oe.usePage(),u=o.useRef();return o.useEffect(()=>{var d,b;const a=(d=s.props)==null?void 0:d._inertiaui_modal,p=u.current;u.current=a,a&&p&&a.component===p.component&&a.url===p.url&&((b=t.stack[0])==null||b.updateProps(a.props??{}))},[(c=s.props)==null?void 0:c._inertiaui_modal]),O.jsxs(O.Fragment,{children:[e,t.stack.length>0&&O.jsx(Gt,{index:0})]})},ht=o.createContext(null);ht.displayName="ModalIndexContext";const gt=()=>{const e=o.useContext(ht);if(e===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return e},Gt=({index:e})=>{const{stack:t}=De(),r=o.useMemo(()=>t[e],[t,e]);return(r==null?void 0:r.component)&&O.jsx(ht.Provider,{value:e,children:O.jsx(r.component,{...r.props,onModalEvent:(...n)=>r.emit(...n)})})},yt=o.forwardRef(({name:e,children:t,...r},n)=>{const l=gt(),{stack:s,registerLocalModal:u,removeLocalModal:c}=De(),[a,p]=o.useState(null),d=o.useMemo(()=>e?a:s[l],[e,a,l,s]),b=o.useMemo(()=>{var m;return(m=s.find(f=>f.shouldRender&&f.index>(d==null?void 0:d.index)))==null?void 0:m.index},[l,s]),x=o.useMemo(()=>(d==null?void 0:d.config.slideover)??r.slideover??Ge("type")==="slideover",[r.slideover]),E=o.useMemo(()=>({slideover:x,closeButton:r.closeButton??Pe(x,"closeButton"),closeExplicitly:r.closeExplicitly??Pe(x,"closeExplicitly"),maxWidth:r.maxWidth??Pe(x,"maxWidth"),paddingClasses:r.paddingClasses??Pe(x,"paddingClasses"),panelClasses:r.panelClasses??Pe(x,"panelClasses"),position:r.position??Pe(x,"position"),...d==null?void 0:d.config}),[r,d==null?void 0:d.config]);o.useEffect(()=>{if(e){let m=null;return u(e,f=>{m=f.registerEventListenersFromProps(r),p(f)}),()=>{m==null||m(),m=null,c(e)}}return d.registerEventListenersFromProps(r)},[e]);const y=o.useRef(d);return o.useEffect(()=>{y.current=d},[d]),o.useImperativeHandle(n,()=>({afterLeave:()=>{var m;return(m=y.current)==null?void 0:m.afterLeave()},close:()=>{var m;return(m=y.current)==null?void 0:m.close()},emit:(...m)=>{var f;return(f=y.current)==null?void 0:f.emit(...m)},getChildModal:()=>{var m;return(m=y.current)==null?void 0:m.getChildModal()},getParentModal:()=>{var m;return(m=y.current)==null?void 0:m.getParentModal()},reload:(...m)=>{var f;return(f=y.current)==null?void 0:f.reload(...m)},setOpen:()=>{var m;return(m=y.current)==null?void 0:m.setOpen()},get id(){var m;return(m=y.current)==null?void 0:m.id},get index(){var m;return(m=y.current)==null?void 0:m.index},get isOpen(){var m;return(m=y.current)==null?void 0:m.isOpen},get config(){var m;return(m=y.current)==null?void 0:m.config},get modalContext(){return y.current},get onTopOfStack(){var m;return(m=y.current)==null?void 0:m.onTopOfStack},get shouldRender(){var m;return(m=y.current)==null?void 0:m.shouldRender}}),[d]),(d==null?void 0:d.shouldRender)&&O.jsxs(O.Fragment,{children:[typeof t=="function"?t({afterLeave:d.afterLeave,close:d.close,config:E,emit:d.emit,getChildModal:d.getChildModal,getParentModal:d.getParentModal,id:d.id,index:d.index,isOpen:d.isOpen,modalContext:d,onTopOfStack:d.onTopOfStack,reload:d.reload,setOpen:d.setOpen,shouldRender:d.shouldRender}):t,b&&O.jsx(Gt,{index:b})]})});yt.displayName="HeadlessModal";function Rt(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(r=Rt(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Je(){for(var e,t,r=0,n="",l=arguments.length;r<l;r++)(e=arguments[r])&&(t=Rt(e))&&(n&&(n+=" "),n+=t);return n}var ln=Object.defineProperty,on=(e,t,r)=>t in e?ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bt=(e,t,r)=>(on(e,typeof t!="symbol"?t+"":t,r),r);let an=class{constructor(){bt(this,"current",this.detect()),bt(this,"handoffState","pending"),bt(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 an;function Ze(e){return pe.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Qe(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ue(){let e=[],t={addEventListener(r,n,l,s){return r.addEventListener(n,l,s),t.add(()=>r.removeEventListener(n,l,s))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Qe(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,l){let s=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:l}),this.add(()=>{Object.assign(r.style,{[n]:s})})},group(r){let n=ue();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let l of e.splice(n,1))l()}},dispose(){for(let r of e.splice(0))r()}};return t}function Et(){let[e]=o.useState(ue);return o.useEffect(()=>()=>e.dispose(),[e]),e}let V=(e,t)=>{pe.isServer?o.useEffect(e,t):o.useLayoutEffect(e,t)};function ve(e){let t=o.useRef(e);return V(()=>{t.current=e},[e]),t}let A=function(e){let t=ve(e);return o.useCallback((...r)=>t.current(...r),[t])},sn=o.createContext(void 0);function un(){return o.useContext(sn)}function wt(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ce(e,t,...r){if(e in t){let l=t[e];return typeof l=="function"?l(...r):l}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ce),n}var et=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(et||{}),de=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(de||{});function Q(){let e=dn();return o.useCallback(t=>cn({mergeRefs:e,...t}),[e])}function cn({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:l,visible:s=!0,name:u,mergeRefs:c}){c=c??fn;let a=Jt(t,e);if(s)return tt(a,r,n,u,c);let p=l??0;if(p&2){let{static:d=!1,...b}=a;if(d)return tt(b,r,n,u,c)}if(p&1){let{unmount:d=!0,...b}=a;return ce(d?0:1,{0(){return null},1(){return tt({...b,hidden:!0,style:{display:"none"}},r,n,u,c)}})}return tt(a,r,n,u,c)}function tt(e,t={},r,n,l){let{as:s=r,children:u,refName:c="ref",...a}=xt(e,["unmount","static"]),p=e.ref!==void 0?{[c]:e.ref}:{},d=typeof u=="function"?u(t):u;"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 x=!1,E=[];for(let[y,m]of Object.entries(t))typeof m=="boolean"&&(x=!0),m===!0&&E.push(y.replace(/([A-Z])/g,f=>`-${f.toLowerCase()}`));if(x){b["data-headlessui-state"]=E.join(" ");for(let y of E)b[`data-${y}`]=""}}if(s===o.Fragment&&(Object.keys(he(a)).length>0||Object.keys(he(b)).length>0))if(!o.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(he(a)).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(he(a)).concat(Object.keys(he(b))).map(x=>` - ${x}`).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(x=>` - ${x}`).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 x=d.props,E=x==null?void 0:x.className,y=typeof E=="function"?(...v)=>wt(E(...v),a.className):wt(E,a.className),m=y?{className:y}:{},f=Jt(d.props,he(xt(a,["ref"])));for(let v in b)v in f&&delete b[v];return o.cloneElement(d,Object.assign({},f,b,p,{ref:l(mn(d),p.ref)},m))}return o.createElement(s,Object.assign({},xt(a,["ref"]),s!==o.Fragment&&p,s!==o.Fragment&&b),d)}function dn(){let e=o.useRef([]),t=o.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function fn(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function Jt(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let l in n)l.startsWith("on")&&typeof n[l]=="function"?(r[l]!=null||(r[l]=[]),r[l].push(n[l])):t[l]=n[l];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[l=>{var s;return(s=l==null?void 0:l.preventDefault)==null?void 0:s.call(l)}]);for(let n in r)Object.assign(t,{[n](l,...s){let u=r[n];for(let c of u){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;c(l,...s)}}});return t}function z(e){var t;return Object.assign(o.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function he(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function xt(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function mn(e){return o.version.split(".")[0]>="19"?e.props.ref:e.ref}let pn="span";var rt=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(rt||{});function vn(e,t){var r;let{features:n=1,...l}=e,s={ref:t,"aria-hidden":(n&2)===2?!0:(r=l["aria-hidden"])!=null?r:void 0,hidden:(n&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return Q()({ourProps:s,theirProps:l,slot:{},defaultTag:pn,name:"Hidden"})}let Ct=z(vn),Zt=Symbol();function hn(e,t=!0){return Object.assign(e,{[Zt]:t})}function ne(...e){let t=o.useRef(e);o.useEffect(()=>{t.current=e},[e]);let r=A(n=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(n):l.current=n)});return e.every(n=>n==null||(n==null?void 0:n[Zt]))?void 0:r}let Tt=o.createContext(null);Tt.displayName="DescriptionContext";function Qt(){let e=o.useContext(Tt);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,Qt),t}return e}function gn(){let[e,t]=o.useState([]);return[e.length>0?e.join(" "):void 0,o.useMemo(()=>function(r){let n=A(s=>(t(u=>[...u,s]),()=>t(u=>{let c=u.slice(),a=c.indexOf(s);return a!==-1&&c.splice(a,1),c}))),l=o.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return o.createElement(Tt.Provider,{value:l},r.children)},[t])]}let yn="p";function bn(e,t){let r=o.useId(),n=un(),{id:l=`headlessui-description-${r}`,...s}=e,u=Qt(),c=ne(t);V(()=>u.register(l),[l,u.register]);let a=n||!1,p=o.useMemo(()=>({...u.slot,disabled:a}),[u.slot,a]),d={ref:c,...u.props,id:l};return Q()({ourProps:d,theirProps:s,slot:p,defaultTag:yn,name:u.name||"Description"})}let En=z(bn),wn=Object.assign(En,{});var er=(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))(er||{});let xn=o.createContext(()=>{});function Cn({value:e,children:t}){return o.createElement(xn.Provider,{value:e},t)}let Tn=class extends Map{constructor(t){super(),this.factory=t}get(t){let r=super.get(t);return r===void 0&&(r=this.factory(t),this.set(t,r)),r}};function tr(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(l){return n.add(l),()=>n.delete(l)},dispatch(l,...s){let u=t[l].call(r,...s);u&&(r=u,n.forEach(c=>c()))}}}function rr(e){return o.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let Sn=new Tn(()=>tr(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let r=this.slice();return r.splice(t,1),r}}));function $e(e,t){let r=Sn.get(t),n=o.useId(),l=rr(r);if(V(()=>{if(e)return r.dispatch("ADD",n),()=>r.dispatch("REMOVE",n)},[r,e]),!e)return!1;let s=l.indexOf(n),u=l.length;return s===-1&&(s=u,u+=1),s===u-1}let St=new Map,We=new Map;function nr(e){var t;let r=(t=We.get(e))!=null?t:0;return We.set(e,r+1),r!==0?()=>lr(e):(St.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>lr(e))}function lr(e){var t;let r=(t=We.get(e))!=null?t:1;if(r===1?We.delete(e):We.set(e,r-1),r!==1)return;let n=St.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,St.delete(e))}function On(e,{allowed:t,disallowed:r}={}){let n=$e(e,"inert-others");V(()=>{var l,s;if(!n)return;let u=ue();for(let a of(l=r==null?void 0:r())!=null?l:[])a&&u.add(nr(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let p=Ze(a);if(!p)continue;let d=a.parentElement;for(;d&&d!==p.body;){for(let b of d.children)c.some(x=>b.contains(x))||u.add(nr(b));d=d.parentElement}}return u.dispose},[n,t,r])}function Pn(e,t,r){let n=ve(l=>{let s=l.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&r()});o.useEffect(()=>{if(!e)return;let l=t===null?null:t instanceof HTMLElement?t:t.current;if(!l)return;let s=ue();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>n.current(l));u.observe(l),s.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>n.current(l));u.observe(l),s.add(()=>u.disconnect())}return()=>s.dispose()},[t,n,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(","),$n=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var oe=(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))(oe||{}),Ot=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Ot||{}),Mn=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Mn||{});function kn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(nt)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function Fn(e=document.body){return e==null?[]:Array.from(e.querySelectorAll($n)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var or=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(or||{});function jn(e,t=0){var r;return e===((r=Ze(e))==null?void 0:r.body)?!1:ce(t,{0(){return e.matches(nt)},1(){let n=e;for(;n!==null;){if(n.matches(nt))return!0;n=n.parentElement}return!1}})}var _n=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(_n||{});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 ie(e){e==null||e.focus({preventScroll:!0})}let Ln=["textarea","input"].join(",");function An(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Ln))!=null?r:!1}function In(e,t=r=>r){return e.slice().sort((r,n)=>{let l=t(r),s=t(n);if(l===null||s===null)return 0;let u=l.compareDocumentPosition(s);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ue(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:l=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,u=Array.isArray(e)?r?In(e):e:t&64?Fn(e):kn(e);l.length>0&&u.length>1&&(u=u.filter(E=>!l.some(y=>y!=null&&"current"in y?(y==null?void 0:y.current)===E:y===E))),n=n??s.activeElement;let c=(()=>{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,u.indexOf(n))-1;if(t&4)return Math.max(0,u.indexOf(n))+1;if(t&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=t&32?{preventScroll:!0}:{},d=0,b=u.length,x;do{if(d>=b||d+b<=0)return 0;let E=a+d;if(t&16)E=(E+b)%b;else{if(E<0)return 3;if(E>=b)return 1}x=u[E],x==null||x.focus(p),d+=c}while(x!==s.activeElement);return t&6&&An(x)&&x.select(),2}function ir(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Nn(){return/Android/gi.test(window.navigator.userAgent)}function Dn(){return ir()||Nn()}function He(e,t,r,n){let l=ve(r);o.useEffect(()=>{if(!e)return;function s(u){l.current(u)}return document.addEventListener(t,s,n),()=>document.removeEventListener(t,s,n)},[e,t,n])}function ar(e,t,r,n){let l=ve(r);o.useEffect(()=>{if(!e)return;function s(u){l.current(u)}return window.addEventListener(t,s,n),()=>window.removeEventListener(t,s,n)},[e,t,n])}const sr=30;function Wn(e,t,r){let n=$e(e,"outside-click"),l=ve(r),s=o.useCallback(function(a,p){if(a.defaultPrevented)return;let d=p(a);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let b=function x(E){return typeof E=="function"?x(E()):Array.isArray(E)||E instanceof Set?E:[E]}(t);for(let x of b)if(x!==null&&(x.contains(d)||a.composed&&a.composedPath().includes(x)))return;return!jn(d,or.Loose)&&d.tabIndex!==-1&&a.preventDefault(),l.current(a,d)},[l,t]),u=o.useRef(null);He(n,"pointerdown",a=>{var p,d;u.current=((d=(p=a.composedPath)==null?void 0:p.call(a))==null?void 0:d[0])||a.target},!0),He(n,"mousedown",a=>{var p,d;u.current=((d=(p=a.composedPath)==null?void 0:p.call(a))==null?void 0:d[0])||a.target},!0),He(n,"click",a=>{Dn()||u.current&&(s(a,()=>u.current),u.current=null)},!0);let c=o.useRef({x:0,y:0});He(n,"touchstart",a=>{c.current.x=a.touches[0].clientX,c.current.y=a.touches[0].clientY},!0),He(n,"touchend",a=>{let p={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(p.x-c.current.x)>=sr||Math.abs(p.y-c.current.y)>=sr))return s(a,()=>a.target instanceof HTMLElement?a.target:null)},!0),ar(n,"blur",a=>s(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Be(...e){return o.useMemo(()=>Ze(...e),[...e])}function ur(e,t,r,n){let l=ve(r);o.useEffect(()=>{e=e??window;function s(u){l.current(u)}return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s,n)},[e,t,n])}function Un(){let e;return{before({doc:t}){var r;let n=t.documentElement,l=(r=t.defaultView)!=null?r:window;e=Math.max(0,l.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,l=Math.max(0,n.clientWidth-n.offsetWidth),s=Math.max(0,e-l);r.style(n,"paddingRight",`${s}px`)}}}function Hn(){return ir()?{before({doc:e,d:t,meta:r}){function n(l){return r.containers.flatMap(s=>s()).some(s=>s.contains(l))}t.microTask(()=>{var l;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=ue();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(l=window.scrollY)!=null?l:window.pageYOffset,u=null;t.addEventListener(e,"click",c=>{if(c.target instanceof HTMLElement)try{let a=c.target.closest("a");if(!a)return;let{hash:p}=new URL(a.href),d=e.querySelector(p);d&&!n(d)&&(u=d)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(c.target instanceof HTMLElement)if(n(c.target)){let a=c.target;for(;a.parentElement&&n(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(c.target instanceof HTMLElement){if(c.target.tagName==="INPUT")return;if(n(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),u&&u.isConnected&&(u.scrollIntoView({block:"nearest"}),u=null)})})}}:{}}function Bn(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Vn(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let ge=tr(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:ue(),meta:new Set};return n.count++,n.meta.add(t),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:r}){let n={doc:e,d:t,meta:Vn(r)},l=[Hn(),Un(),Bn()];l.forEach(({before:s})=>s==null?void 0:s(n)),l.forEach(({after:s})=>s==null?void 0:s(n))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});ge.subscribe(()=>{let e=ge.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",l=r.count!==0;(l&&!n||!l&&n)&&ge.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&ge.dispatch("TEARDOWN",r)}});function Yn(e,t,r=()=>({containers:[]})){let n=rr(ge),l=t?n.get(t):void 0,s=l?l.count>0:!1;return V(()=>{if(!(!t||!e))return ge.dispatch("PUSH",t,r),()=>ge.dispatch("POP",t,r)},[e,t]),s}function qn(e,t,r=()=>[document.body]){let n=$e(e,"scroll-lock");Yn(n,t,l=>{var s;return{containers:[...(s=l.containers)!=null?s:[],r]}})}function Xn(e=0){let[t,r]=o.useState(e),n=o.useCallback(a=>r(a),[t]),l=o.useCallback(a=>r(p=>p|a),[t]),s=o.useCallback(a=>(t&a)===a,[t]),u=o.useCallback(a=>r(p=>p&~a),[r]),c=o.useCallback(a=>r(p=>p^a),[r]);return{flags:t,setFlag:n,addFlag:l,hasFlag:s,removeFlag:u,toggleFlag:c}}var cr,dr;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((cr=process==null?void 0:process.env)==null?void 0:cr.NODE_ENV)==="test"&&typeof((dr=Element==null?void 0:Element.prototype)==null?void 0:dr.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 zn=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(zn||{});function Kn(e){let t={};for(let r in e)e[r]===!0&&(t[`data-${r}`]="");return t}function Gn(e,t,r,n){let[l,s]=o.useState(r),{hasFlag:u,addFlag:c,removeFlag:a}=Xn(e&&l?3:0),p=o.useRef(!1),d=o.useRef(!1),b=Et();return V(()=>{var x;if(e){if(r&&s(!0),!t){r&&c(3);return}return(x=n==null?void 0:n.start)==null||x.call(n,r),Rn(t,{inFlight:p,prepare(){d.current?d.current=!1:d.current=p.current,p.current=!0,!d.current&&(r?(c(3),a(4)):(c(4),a(2)))},run(){d.current?r?(a(3),c(4)):(a(4),c(3)):r?a(1):c(1)},done(){var E;d.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(p.current=!1,a(7),r||s(!1),(E=n==null?void 0:n.end)==null||E.call(n,r))}})}},[e,r,t,b]),e?[l,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Rn(e,{prepare:t,run:r,done:n,inFlight:l}){let s=ue();return Zn(e,{prepare:t,inFlight:l}),s.nextFrame(()=>{r(),s.requestAnimationFrame(()=>{s.add(Jn(e,n))})}),s.dispose}function Jn(e,t){var r,n;let l=ue();if(!e)return l.dispose;let s=!1;l.add(()=>{s=!0});let u=(n=(r=e.getAnimations)==null?void 0:r.call(e).filter(c=>c instanceof CSSTransition))!=null?n:[];return u.length===0?(t(),l.dispose):(Promise.allSettled(u.map(c=>c.finished)).then(()=>{s||t()}),l.dispose)}function Zn(e,{inFlight:t,prepare:r}){if(t!=null&&t.current){r();return}let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}function Pt(e,t){let r=o.useRef([]),n=A(e);o.useEffect(()=>{let l=[...r.current];for(let[s,u]of t.entries())if(r.current[s]!==u){let c=n(t,l);return r.current=t,c}},[n,...t])}let lt=o.createContext(null);lt.displayName="OpenClosedContext";var re=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(re||{});function ot(){return o.useContext(lt)}function Qn({value:e,children:t}){return o.createElement(lt.Provider,{value:e},t)}function el({children:e}){return o.createElement(lt.Provider,{value:null},e)}function tl(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let fe=[];tl(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||fe[0]===t.target)return;let r=t.target;r=r.closest(nt),fe.unshift(r??t.target),fe=fe.filter(n=>n!=null&&n.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 fr(e){let t=A(e),r=o.useRef(!1);o.useEffect(()=>(r.current=!1,()=>{r.current=!0,Qe(()=>{r.current&&t()})}),[t])}function rl(){let e=typeof document>"u";return"useSyncExternalStore"in je?(t=>t.useSyncExternalStore)(je)(()=>()=>{},()=>!1,()=>!e):!1}function Ve(){let e=rl(),[t,r]=je.useState(pe.isHandoffComplete);return t&&pe.isHandoffComplete===!1&&r(!1),je.useEffect(()=>{t!==!0&&r(!0)},[t]),je.useEffect(()=>pe.handoff(),[]),e?!1:t}let mr=o.createContext(!1);function nl(){return o.useContext(mr)}function pr(e){return o.createElement(mr.Provider,{value:e.force},e.children)}function ll(e){let t=nl(),r=o.useContext(hr),n=Be(e),[l,s]=o.useState(()=>{var u;if(!t&&r!==null)return(u=r.current)!=null?u:null;if(pe.isServer)return null;let c=n==null?void 0:n.getElementById("headlessui-portal-root");if(c)return c;if(n===null)return null;let a=n.createElement("div");return a.setAttribute("id","headlessui-portal-root"),n.body.appendChild(a)});return o.useEffect(()=>{l!==null&&(n!=null&&n.body.contains(l)||n==null||n.body.appendChild(l))},[l,n]),o.useEffect(()=>{t||r!==null&&s(r.current)},[r,s,t]),l}let vr=o.Fragment,ol=z(function(e,t){let r=e,n=o.useRef(null),l=ne(hn(b=>{n.current=b}),t),s=Be(n),u=ll(n),[c]=o.useState(()=>{var b;return pe.isServer?null:(b=s==null?void 0:s.createElement("div"))!=null?b:null}),a=o.useContext($t),p=Ve();V(()=>{!u||!c||u.contains(c)||(c.setAttribute("data-headlessui-portal",""),u.appendChild(c))},[u,c]),V(()=>{if(c&&a)return a.register(c)},[a,c]),fr(()=>{var b;!u||!c||(c instanceof Node&&u.contains(c)&&u.removeChild(c),u.childNodes.length<=0&&((b=u.parentElement)==null||b.removeChild(u)))});let d=Q();return p?!u||!c?null:zr.createPortal(d({ourProps:{ref:l},theirProps:r,slot:{},defaultTag:vr,name:"Portal"}),c):null});function il(e,t){let r=ne(t),{enabled:n=!0,...l}=e,s=Q();return n?o.createElement(ol,{...l,ref:r}):s({ourProps:{ref:r},theirProps:l,slot:{},defaultTag:vr,name:"Portal"})}let al=o.Fragment,hr=o.createContext(null);function sl(e,t){let{target:r,...n}=e,l={ref:ne(t)},s=Q();return o.createElement(hr.Provider,{value:r},s({ourProps:l,theirProps:n,defaultTag:al,name:"Popover.Group"}))}let $t=o.createContext(null);function ul(){let e=o.useContext($t),t=o.useRef([]),r=A(s=>(t.current.push(s),e&&e.register(s),()=>n(s))),n=A(s=>{let u=t.current.indexOf(s);u!==-1&&t.current.splice(u,1),e&&e.unregister(s)}),l=o.useMemo(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,o.useMemo(()=>function({children:s}){return o.createElement($t.Provider,{value:l},s)},[l])]}let cl=z(il),gr=z(sl),dl=Object.assign(cl,{Group:gr});function fl(e,t=typeof document<"u"?document.defaultView:null,r){let n=$e(e,"escape");ur(t,"keydown",l=>{n&&(l.defaultPrevented||l.key===er.Escape&&r(l))})}function ml(){var e;let[t]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[r,n]=o.useState((e=t==null?void 0:t.matches)!=null?e:!1);return V(()=>{if(!t)return;function l(s){n(s.matches)}return t.addEventListener("change",l),()=>t.removeEventListener("change",l)},[t]),r}function pl({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=Be(r),l=A(()=>{var s,u;let c=[];for(let a of e)a!==null&&(a instanceof HTMLElement?c.push(a):"current"in a&&a.current instanceof HTMLElement&&c.push(a.current));if(t!=null&&t.current)for(let a of t.current)c.push(a);for(let a of(s=n==null?void 0:n.querySelectorAll("html > *, body > *"))!=null?s:[])a!==document.body&&a!==document.head&&a instanceof HTMLElement&&a.id!=="headlessui-portal-root"&&(r&&(a.contains(r)||a.contains((u=r==null?void 0:r.getRootNode())==null?void 0:u.host))||c.some(p=>a.contains(p))||c.push(a));return c});return{resolveContainers:l,contains:A(s=>l().some(u=>u.contains(s)))}}let yr=o.createContext(null);function br({children:e,node:t}){let[r,n]=o.useState(null),l=Er(t??r);return o.createElement(yr.Provider,{value:l},e,l===null&&o.createElement(Ct,{features:rt.Hidden,ref:s=>{var u,c;if(s){for(let a of(c=(u=Ze(s))==null?void 0:u.querySelectorAll("html > *, body > *"))!=null?c:[])if(a!==document.body&&a!==document.head&&a instanceof HTMLElement&&a!=null&&a.contains(s)){n(a);break}}}}))}function Er(e=null){var t;return(t=o.useContext(yr))!=null?t:e}function Mt(){let e=o.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 vl(){let e=o.useRef(0);return ar(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function wr(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)r.current instanceof HTMLElement&&t.add(r.current);return t}let hl="div";var ye=(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))(ye||{});function gl(e,t){let r=o.useRef(null),n=ne(r,t),{initialFocus:l,initialFocusFallback:s,containers:u,features:c=15,...a}=e;Ve()||(c=0);let p=Be(r);wl(c,{ownerDocument:p});let d=xl(c,{ownerDocument:p,container:r,initialFocus:l,initialFocusFallback:s});Cl(c,{ownerDocument:p,container:r,containers:u,previousActiveElement:d});let b=vl(),x=A(g=>{let C=r.current;C&&(T=>T())(()=>{ce(b.current,{[Ye.Forwards]:()=>{Ue(C,oe.First,{skipElements:[g.relatedTarget,s]})},[Ye.Backwards]:()=>{Ue(C,oe.Last,{skipElements:[g.relatedTarget,s]})}})})}),E=$e(!!(c&2),"focus-trap#tab-lock"),y=Et(),m=o.useRef(!1),f={ref:n,onKeyDown(g){g.key=="Tab"&&(m.current=!0,y.requestAnimationFrame(()=>{m.current=!1}))},onBlur(g){if(!(c&4))return;let C=wr(u);r.current instanceof HTMLElement&&C.add(r.current);let T=g.relatedTarget;T instanceof HTMLElement&&T.dataset.headlessuiFocusGuard!=="true"&&(xr(C,T)||(m.current?Ue(r.current,ce(b.current,{[Ye.Forwards]:()=>oe.Next,[Ye.Backwards]:()=>oe.Previous})|oe.WrapAround,{relativeTo:g.target}):g.target instanceof HTMLElement&&ie(g.target)))}},v=Q();return o.createElement(o.Fragment,null,E&&o.createElement(Ct,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:rt.Focusable}),v({ourProps:f,theirProps:a,defaultTag:hl,name:"FocusTrap"}),E&&o.createElement(Ct,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:rt.Focusable}))}let yl=z(gl),bl=Object.assign(yl,{features:ye});function El(e=!0){let t=o.useRef(fe.slice());return Pt(([r],[n])=>{n===!0&&r===!1&&Qe(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=fe.slice())},[e,fe,t]),A(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function wl(e,{ownerDocument:t}){let r=!!(e&8),n=El(r);Pt(()=>{r||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&ie(n())},[r]),fr(()=>{r&&ie(n())})}function xl(e,{ownerDocument:t,container:r,initialFocus:n,initialFocusFallback:l}){let s=o.useRef(null),u=$e(!!(e&1),"focus-trap#initial-focus"),c=Mt();return Pt(()=>{if(e===0)return;if(!u){l!=null&&l.current&&ie(l.current);return}let a=r.current;a&&Qe(()=>{if(!c.current)return;let p=t==null?void 0:t.activeElement;if(n!=null&&n.current){if((n==null?void 0:n.current)===p){s.current=p;return}}else if(a.contains(p)){s.current=p;return}if(n!=null&&n.current)ie(n.current);else{if(e&16){if(Ue(a,oe.First|oe.AutoFocus)!==Ot.Error)return}else if(Ue(a,oe.First)!==Ot.Error)return;if(l!=null&&l.current&&(ie(l.current),(t==null?void 0:t.activeElement)===l.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}s.current=t==null?void 0:t.activeElement})},[l,u,e]),s}function Cl(e,{ownerDocument:t,container:r,containers:n,previousActiveElement:l}){let s=Mt(),u=!!(e&4);ur(t==null?void 0:t.defaultView,"focus",c=>{if(!u||!s.current)return;let a=wr(n);r.current instanceof HTMLElement&&a.add(r.current);let p=l.current;if(!p)return;let d=c.target;d&&d instanceof HTMLElement?xr(a,d)?(l.current=d,ie(d)):(c.preventDefault(),c.stopPropagation(),ie(p)):ie(l.current)},!0)}function xr(e,t){for(let r of e)if(r.contains(t))return!0;return!1}function Cr(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Sr)!==o.Fragment||o.Children.count(e.children)===1}let it=o.createContext(null);it.displayName="TransitionContext";var Tl=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Tl||{});function Sl(){let e=o.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 Ol(){let e=o.useContext(at);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let at=o.createContext(null);at.displayName="NestingContext";function st(e){return"children"in e?st(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Tr(e,t){let r=ve(e),n=o.useRef([]),l=Mt(),s=Et(),u=A((E,y=de.Hidden)=>{let m=n.current.findIndex(({el:f})=>f===E);m!==-1&&(ce(y,{[de.Unmount](){n.current.splice(m,1)},[de.Hidden](){n.current[m].state="hidden"}}),s.microTask(()=>{var f;!st(n)&&l.current&&((f=r.current)==null||f.call(r))}))}),c=A(E=>{let y=n.current.find(({el:m})=>m===E);return y?y.state!=="visible"&&(y.state="visible"):n.current.push({el:E,state:"visible"}),()=>u(E,de.Unmount)}),a=o.useRef([]),p=o.useRef(Promise.resolve()),d=o.useRef({enter:[],leave:[]}),b=A((E,y,m)=>{a.current.splice(0),t&&(t.chains.current[y]=t.chains.current[y].filter(([f])=>f!==E)),t==null||t.chains.current[y].push([E,new Promise(f=>{a.current.push(f)})]),t==null||t.chains.current[y].push([E,new Promise(f=>{Promise.all(d.current[y].map(([v,g])=>g)).then(()=>f())})]),y==="enter"?p.current=p.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(y)):m(y)}),x=A((E,y,m)=>{Promise.all(d.current[y].splice(0).map(([f,v])=>v)).then(()=>{var f;(f=a.current.shift())==null||f()}).then(()=>m(y))});return o.useMemo(()=>({children:n,register:c,unregister:u,onStart:b,onStop:x,wait:p,chains:d}),[c,u,n,b,x,d,p])}let Sr=o.Fragment,Or=et.RenderStrategy;function Pl(e,t){var r,n;let{transition:l=!0,beforeEnter:s,afterEnter:u,beforeLeave:c,afterLeave:a,enter:p,enterFrom:d,enterTo:b,entered:x,leave:E,leaveFrom:y,leaveTo:m,...f}=e,[v,g]=o.useState(null),C=o.useRef(null),T=Cr(e),k=ne(...T?[C,t,g]:t===null?[]:[t]),Y=(r=f.unmount)==null||r?de.Unmount:de.Hidden,{show:U,appear:R,initial:J}=Sl(),[H,q]=o.useState(U?"visible":"hidden"),K=Ol(),{register:_,unregister:M}=K;V(()=>_(C),[_,C]),V(()=>{if(Y===de.Hidden&&C.current){if(U&&H!=="visible"){q("visible");return}return ce(H,{hidden:()=>M(C),visible:()=>_(C)})}},[H,C,_,M,U,Y]);let I=Ve();V(()=>{if(T&&I&&H==="visible"&&C.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[C,H,I,T]);let be=J&&!R,Ee=R&&U&&J,me=o.useRef(!1),Z=Tr(()=>{me.current||(q("hidden"),M(C))},K),we=A(Te=>{me.current=!0;let ae=Te?"enter":"leave";Z.onStart(C,ae,se=>{se==="enter"?s==null||s():se==="leave"&&(c==null||c())})}),N=A(Te=>{let ae=Te?"enter":"leave";me.current=!1,Z.onStop(C,ae,se=>{se==="enter"?u==null||u():se==="leave"&&(a==null||a())}),ae==="leave"&&!st(Z)&&(q("hidden"),M(C))});o.useEffect(()=>{T&&l||(we(U),N(U))},[U,T,l]);let xe=!(!l||!T||!I||be),[,B]=Gn(xe,v,U,{start:we,end:N}),_t=he({ref:k,className:((n=wt(f.className,Ee&&p,Ee&&d,B.enter&&p,B.enter&&B.closed&&d,B.enter&&!B.closed&&b,B.leave&&E,B.leave&&!B.closed&&y,B.leave&&B.closed&&m,!B.transition&&U&&x))==null?void 0:n.trim())||void 0,...Kn(B)}),Ce=0;H==="visible"&&(Ce|=re.Open),H==="hidden"&&(Ce|=re.Closed),B.enter&&(Ce|=re.Opening),B.leave&&(Ce|=re.Closing);let qe=Q();return o.createElement(at.Provider,{value:Z},o.createElement(Qn,{value:Ce},qe({ourProps:_t,theirProps:f,defaultTag:Sr,features:Or,visible:H==="visible",name:"Transition.Child"})))}function $l(e,t){let{show:r,appear:n=!1,unmount:l=!0,...s}=e,u=o.useRef(null),c=Cr(e),a=ne(...c?[u,t]:t===null?[]:[t]);Ve();let p=ot();if(r===void 0&&p!==null&&(r=(p&re.Open)===re.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,b]=o.useState(r?"visible":"hidden"),x=Tr(()=>{r||b("hidden")}),[E,y]=o.useState(!0),m=o.useRef([r]);V(()=>{E!==!1&&m.current[m.current.length-1]!==r&&(m.current.push(r),y(!1))},[m,r]);let f=o.useMemo(()=>({show:r,appear:n,initial:E}),[r,n,E]);V(()=>{r?b("visible"):!st(x)&&u.current!==null&&b("hidden")},[r,x]);let v={unmount:l},g=A(()=>{var k;E&&y(!1),(k=e.beforeEnter)==null||k.call(e)}),C=A(()=>{var k;E&&y(!1),(k=e.beforeLeave)==null||k.call(e)}),T=Q();return o.createElement(at.Provider,{value:x},o.createElement(it.Provider,{value:f},T({ourProps:{...v,as:o.Fragment,children:o.createElement(Pr,{ref:a,...v,...s,beforeEnter:g,beforeLeave:C})},theirProps:{},defaultTag:o.Fragment,features:Or,visible:d==="visible",name:"Transition"})))}function Ml(e,t){let r=o.useContext(it)!==null,n=ot()!==null;return o.createElement(o.Fragment,null,!r&&n?o.createElement(kt,{ref:t,...e}):o.createElement(Pr,{ref:t,...e}))}let kt=z($l),Pr=z(Pl),Me=z(Ml),$r=Object.assign(kt,{Child:Me,Root:kt});var kl=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(kl||{}),Fl=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Fl||{});let jl={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Ft=o.createContext(null);Ft.displayName="DialogContext";function ut(e){let t=o.useContext(Ft);if(t===null){let r=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ut),r}return t}function _l(e,t){return ce(t.type,jl,e,t)}let Mr=z(function(e,t){let r=o.useId(),{id:n=`headlessui-dialog-${r}`,open:l,onClose:s,initialFocus:u,role:c="dialog",autoFocus:a=!0,__demoMode:p=!1,unmount:d=!1,...b}=e,x=o.useRef(!1);c=function(){return c==="dialog"||c==="alertdialog"?c:(x.current||(x.current=!0,console.warn(`Invalid role [${c}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let E=ot();l===void 0&&E!==null&&(l=(E&re.Open)===re.Open);let y=o.useRef(null),m=ne(y,t),f=Be(y),v=l?0:1,[g,C]=o.useReducer(_l,{titleId:null,descriptionId:null,panelRef:o.createRef()}),T=A(()=>s(!1)),k=A(N=>C({type:0,id:N})),Y=Ve()?v===0:!1,[U,R]=ul(),J={get current(){var N;return(N=g.panelRef.current)!=null?N:y.current}},H=Er(),{resolveContainers:q}=pl({mainTreeNode:H,portals:U,defaultContainers:[J]}),K=E!==null?(E&re.Closing)===re.Closing:!1;On(p||K?!1:Y,{allowed:A(()=>{var N,xe;return[(xe=(N=y.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]})}),Wn(Y,q,N=>{N.preventDefault(),T()}),fl(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()}),qn(p||K?!1:Y,f,q),Pn(Y,y,T);let[_,M]=gn(),I=o.useMemo(()=>[{dialogState:v,close:T,setTitleId:k,unmount:d},g],[v,g,T,k,d]),be=o.useMemo(()=>({open:v===0}),[v]),Ee={ref:m,id:n,role:c,tabIndex:-1,"aria-modal":p?void 0:v===0?!0:void 0,"aria-labelledby":g.titleId,"aria-describedby":_,unmount:d},me=!ml(),Z=ye.None;Y&&!p&&(Z|=ye.RestoreFocus,Z|=ye.TabLock,a&&(Z|=ye.AutoFocus),me&&(Z|=ye.InitialFocus));let we=Q();return o.createElement(el,null,o.createElement(pr,{force:!0},o.createElement(dl,null,o.createElement(Ft.Provider,{value:I},o.createElement(gr,{target:y},o.createElement(pr,{force:!1},o.createElement(M,{slot:be},o.createElement(R,null,o.createElement(bl,{initialFocus:u,initialFocusFallback:y,containers:q,features:Z},o.createElement(Cn,{value:T},we({ourProps:Ee,theirProps:b,slot:be,defaultTag:Ll,features:Al,visible:v===0,name:"Dialog"})))))))))))}),Ll="div",Al=et.RenderStrategy|et.Static;function Il(e,t){let{transition:r=!1,open:n,...l}=e,s=ot(),u=e.hasOwnProperty("open")||s!==null,c=e.hasOwnProperty("onClose");if(!u&&!c)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!u)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!c)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!s&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(n!==void 0||r)&&!l.static?o.createElement(br,null,o.createElement($r,{show:n,transition:r,unmount:l.unmount},o.createElement(Mr,{ref:t,...l}))):o.createElement(br,null,o.createElement(Mr,{ref:t,open:n,...l}))}let Nl="div";function Dl(e,t){let r=o.useId(),{id:n=`headlessui-dialog-panel-${r}`,transition:l=!1,...s}=e,[{dialogState:u,unmount:c},a]=ut("Dialog.Panel"),p=ne(t,a.panelRef),d=o.useMemo(()=>({open:u===0}),[u]),b=A(f=>{f.stopPropagation()}),x={ref:p,id:n,onClick:b},E=l?Me:o.Fragment,y=l?{unmount:c}:{},m=Q();return o.createElement(E,{...y},m({ourProps:x,theirProps:s,slot:d,defaultTag:Nl,name:"Dialog.Panel"}))}let Wl="div";function Ul(e,t){let{transition:r=!1,...n}=e,[{dialogState:l,unmount:s}]=ut("Dialog.Backdrop"),u=o.useMemo(()=>({open:l===0}),[l]),c={ref:t,"aria-hidden":!0},a=r?Me:o.Fragment,p=r?{unmount:s}:{},d=Q();return o.createElement(a,{...p},d({ourProps:c,theirProps:n,slot:u,defaultTag:Wl,name:"Dialog.Backdrop"}))}let Hl="h2";function Bl(e,t){let r=o.useId(),{id:n=`headlessui-dialog-title-${r}`,...l}=e,[{dialogState:s,setTitleId:u}]=ut("Dialog.Title"),c=ne(t);o.useEffect(()=>(u(n),()=>u(null)),[n,u]);let a=o.useMemo(()=>({open:s===0}),[s]),p={ref:c,id:n};return Q()({ourProps:p,theirProps:l,slot:a,defaultTag:Hl,name:"Dialog.Title"})}let Vl=z(Il),jt=z(Dl);z(Ul);let Yl=z(Bl),ql=Object.assign(Vl,{Panel:jt,Title:Yl,Description:wn});function kr({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 Xl=({modalContext:e,config:t,children:r})=>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(jt,{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(kr,{onClick:e.close})}),typeof r=="function"?r({modalContext:e,config:t}):r]})})})}),zl=({modalContext:e,config:t,children:r})=>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(jt,{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(kr,{onClick:e.close})}),typeof r=="function"?r({modalContext:e,config:t}):r]})})})}),Fr=o.forwardRef(({name:e,children:t,...r},n)=>{const l=u=>typeof t=="function"?t(u):t,s=o.useRef(null);return o.useImperativeHandle(n,()=>s.current,[s]),O.jsx(yt,{ref:s,name:e,...r,children:({afterLeave:u,close:c,config:a,emit:p,getChildModal:d,getParentModal:b,id:x,index:E,isOpen:y,modalContext:m,onTopOfStack:f,reload:v,setOpen:g,shouldRender:C})=>O.jsx($r,{appear:!0,show:y??!1,children:O.jsxs(ql,{as:"div",className:"im-dialog relative z-20",onClose:()=>a.closeExplicitly?null:c(),"data-inertiaui-modal-id":x,"data-inertiaui-modal-index":E,children:[E===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,E>0&&f?O.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,a.slideover?O.jsx(zl,{modalContext:m,config:a,children:l({afterLeave:u,close:c,config:a,emit:p,getChildModal:d,getParentModal:b,id:x,index:E,isOpen:y,modalContext:m,onTopOfStack:f,reload:v,setOpen:g,shouldRender:C})}):O.jsx(Xl,{modalContext:m,config:a,children:l({afterLeave:u,close:c,config:a,emit:p,getChildModal:d,getParentModal:b,id:x,index:E,isOpen:y,modalContext:m,onTopOfStack:f,reload:v,setOpen:g,shouldRender:C})})]})})})});Fr.displayName="Modal";const Kl=({href:e,method:t="get",data:r={},as:n="a",headers:l={},queryStringArrayFormat:s="brackets",onAfterLeave:u=null,onBlur:c=null,onClose:a=null,onError:p=null,onFocus:d=null,onStart:b=null,onSuccess:x=null,navigate:E=null,children:y,...m})=>{const[f,v]=o.useState(!1),[g,C]=o.useState(null),{stack:T,visit:k}=De(),Y=o.useMemo(()=>E??Ge("navigate"),[E]),U={},R={};Object.keys(m).forEach(M=>{Xt.includes(M)||(M.startsWith("on")&&typeof m[M]=="function"?M.toLowerCase()in window?U[M]=m[M]:R[M]=m[M]:U[M]=m[M])});const[J,H]=o.useState(!1);o.useEffect(()=>{g&&(g.onTopOfStack&&J?d==null||d():!g.onTopOfStack&&!J&&(c==null||c()),H(!g.onTopOfStack))},[T]);const q=o.useCallback(()=>{a==null||a()},[a]),K=o.useCallback(()=>{C(null),u==null||u()},[u]),_=o.useCallback(M=>{M==null||M.preventDefault(),!f&&(e.startsWith("#")||(v(!0),b==null||b()),k(e,t,r,l,tn(Bt(m,Xt)),()=>q(T.length),K,s,Y).then(I=>{C(I),I.registerEventListenersFromProps(R),x==null||x()}).catch(I=>{console.error(I),p==null||p(I)}).finally(()=>v(!1)))},[e,t,r,l,s,m,q,K]);return O.jsx(n,{...U,href:e,onClick:_,children:typeof y=="function"?y({loading:f}):y})};function Gl(){return De().stack[gt()]??null}const Rl=e=>t=>(t.default.layout=r=>o.createElement(e,{},r),t);F.HeadlessModal=yt,F.Modal=Fr,F.ModalLink=Kl,F.ModalRoot=Kt,F.ModalStackProvider=qt,F.getConfig=Ge,F.initFromPageProps=zt,F.putConfig=Jr,F.renderApp=nn,F.resetConfig=Rr,F.setPageLayout=Rl,F.useModal=Gl,F.useModalIndex=gt,F.useModalStack=De,Object.defineProperty(F,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.14.0",
4
+ "version": "0.16.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "type": "module",