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