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