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