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