import{s,a,e,r,D}from"./chunk-p42kdtn4.js";/*! * tabbable 6.5.2 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE */var ye=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ie=ye.join(","),ge=typeof Element>"u",V=ge?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,we=!ge&&Element.prototype.getRootNode?function(o){return o==null||o.getRootNode==null?void 0:o.getRootNode()}:function(o){return o==null?void 0:o.ownerDocument},oe=function(t,n){if(n===void 0)n=!0;var u=t==null||t.getAttribute==null?void 0:t.getAttribute("inert"),d=u===""||u==="true",v=d||n&&t&&(typeof t.closest==="function"?t.closest("[inert]"):oe(t.parentNode));return v},Le=function(t){var n,u=t==null||t.getAttribute==null||(n=t.getAttribute("contenteditable"))==null?void 0:n.toLowerCase();return u===""||u==="true"||u==="plaintext-only"},Te=function(t,n,u){if(oe(t))return[];var d=Array.prototype.slice.apply(t.querySelectorAll(ie));if(n&&V.call(t,ie))d.unshift(t);return d=d.filter(u),d},ue=function(t,n,u){var d=[],v=Array.from(t);while(v.length){var i=v.shift();if(oe(i,!1))continue;if(i.tagName==="SLOT"){var h=i.assignedElements(),S=h.length?h:i.children,k=ue(S,!0,u);if(u.flatten)d.push.apply(d,k);else d.push({scopeParent:i,candidates:k})}else{var P=V.call(i,ie);if(P&&u.filter(i)&&(n||!t.includes(i)))d.push(i);var E=i.shadowRoot||typeof u.getShadowRoot==="function"&&u.getShadowRoot(i),R=!oe(E,!1)&&(!u.shadowRootFilter||u.shadowRootFilter(i));if(E&&R){var O=ue(E===!0?i.children:E.children,!0,u);if(u.flatten)d.push.apply(d,O);else d.push({scopeParent:i,candidates:O})}else v.unshift.apply(v,i.children)}}return d},Se=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},H=function(t){if(!t)throw Error("No node provided");if(t.tabIndex<0){if((/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Le(t))&&!Se(t))return 0}return t.tabIndex},xe=function(t,n){var u=H(t);if(u<0&&n&&!Se(t))return 0;return u},Me=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Ae=function(t){return t.tagName==="INPUT"},_e=function(t){return Ae(t)&&t.type==="hidden"},je=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(u){return u.tagName==="SUMMARY"});return n},Be=function(t,n){for(var u=0;usummary:first-of-type"),k=S?t.parentElement:t;if(V.call(k,"details:not([open]) *"))return!0;if(!u||u==="full"||u==="full-native"||u==="legacy-full"){if(typeof d==="function"){var P=t;while(t){var E=t.parentElement,R=we(t);if(E&&!E.shadowRoot&&d(E)===!0)return me(t);else if(t.assignedSlot)t=t.assignedSlot;else if(!E&&R!==t.ownerDocument)t=R.host;else t=E}t=P}if(t.isConnected)return!t.getClientRects().length;if(u!=="legacy-full")return!0}else if(u==="non-zero-area")return me(t);return!1},Ve=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName)){var n=t.parentElement;while(n){if(n.tagName==="FIELDSET"&&n.disabled){for(var u=0;u=0)return!0;return!1},Ee=function(t){var n=[],u=[];return t.forEach(function(d,v){var i=!!d.scopeParent,h=i?d.scopeParent:d,S=xe(h,i),k=i?Ee(d.candidates):h;if(S===0)i?n.push.apply(n,k):n.push(h);else u.push({documentOrder:v,tabIndex:S,item:d,isScope:i,content:k})}),u.sort(Me).reduce(function(d,v){return v.isScope?d.push.apply(d,v.content):d.push(v.content),d},[]).concat(n)},Fe=function(t,n){n=n||{};var u;if(n.getShadowRoot)u=ue([t],n.includeContainer,{filter:be.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:qe});else u=Te(t,n.includeContainer,be.bind(null,n));return Ee(u)},Ne=function(t,n){n=n||{};var u;if(n.getShadowRoot)u=ue([t],n.includeContainer,{filter:se.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot});else u=Te(t,n.includeContainer,se.bind(null,n));return u},q=function(t,n){if(n=n||{},!t)throw Error("No node provided");if(V.call(t,ie)===!1)return!1;return be(n,t)},We=ye.concat("iframe:not([inert]):not([inert] *)").join(","),le=function(t,n){if(n=n||{},!t)throw Error("No node provided");if(V.call(t,We)===!1)return!1;return se(n,t)};/*! * focus-trap 8.2.6 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE */function he(o,t){(t==null||t>o.length)&&(t=o.length);for(var n=0,u=Array(t);n=o.length?{done:!0}:{done:!1,value:o[u++]}},e:function(S){throw S},f:d}}throw TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var v,i=!0,h=!1;return{s:function(){n=n.call(o)},n:function(){var S=n.next();return i=S.done,S},e:function(S){h=!0,v=S},f:function(){try{i||n.return==null||n.return()}finally{if(h)throw v}}}}function Ye(o,t,n){return(t=Qe(t))in o?Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):o[t]=n,o}function ze(o){if(typeof Symbol<"u"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)}function Ze(){throw TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ke(o,t){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(o);t&&(u=u.filter(function(d){return Object.getOwnPropertyDescriptor(o,d).enumerable})),n.push.apply(n,u)}return n}function Re(o){for(var t=1;t0)return t[t.length-1];return null},activateTrap:function(t,n){var u=_.getActiveTrap(t);if(n!==u)_.pauseTrap(t);var d=t.indexOf(n);if(d===-1)t.push(n);else t.splice(d,1),t.push(n)},deactivateTrap:function(t,n){var u=t.indexOf(n);if(u!==-1)t.splice(u,1);_.unpauseTrap(t)},pauseTrap:function(t){var n=_.getActiveTrap(t);n===null||n===void 0||n._setPausedState(!0)},unpauseTrap:function(t){var n=_.getActiveTrap(t);if(n&&!n._isManuallyPaused())n._setPausedState(!1)}},et=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select==="function"},tt=function(t){return(t===null||t===void 0?void 0:t.key)==="Escape"||(t===null||t===void 0?void 0:t.key)==="Esc"||(t===null||t===void 0?void 0:t.keyCode)===27},J=function(t){return(t===null||t===void 0?void 0:t.key)==="Tab"||(t===null||t===void 0?void 0:t.keyCode)===9},at=function(t){return J(t)&&!t.shiftKey},rt=function(t){return J(t)&&t.shiftKey},De=function(t){return setTimeout(t,0)},X=function(t){for(var n=arguments.length,u=Array(n>1?n-1:0),d=1;d1&&arguments[1]!==void 0?arguments[1]:{},f=c.hasFallback,y=f===void 0?!1:f,m=c.params,b=m===void 0?[]:m,p=v[l];if(typeof p==="function")p=p.apply(void 0,Xe(b));if(p===!0)p=void 0;if(!p){if(p===void 0||p===!1)return p;throw Error("`".concat(l,"` was specified but was not a node, or did not return a node"))}var g=p;if(typeof p==="string"){try{g=u.querySelector(p)}catch(w){throw Error("`".concat(l,'` appears to be an invalid selector; error="').concat(w.message,'"'),{cause:w})}if(!g){if(!y)throw Error("`".concat(l,"` as selector refers to no known node"))}}return g},E=function(l){var c=l.activeElement;if(!c)return null;if(c.shadowRoot&&c.shadowRoot.activeElement!==null)return E(c.shadowRoot);return c},R=function(){var l=P("initialFocus",{hasFallback:!0});if(l===!1)return!1;if(l===void 0||l&&!le(l,v.tabbableOptions)){var c=E(u);if(k(c)>=0)l=c;else{var f=i.tabbableGroups[0],y=f&&f.firstTabbableNode;l=y||P("fallbackFocus")}}else if(l===null)l=P("fallbackFocus");if(!l)throw Error("Your focus-trap needs to have at least one focusable element");return l},O=function(){if(i.containerGroups=i.containers.map(function(l){var c=Fe(l,v.tabbableOptions),f=Ne(l,v.tabbableOptions),y=c.length>0?c[0]:void 0,m=c.length>0?c[c.length-1]:void 0,b=f.find(function(w){return q(w)}),p=f.slice().reverse().find(function(w){return q(w)}),g=!!c.find(function(w){return H(w)>0});return{container:l,tabbableNodes:c,focusableNodes:f,posTabIndexesFound:g,firstTabbableNode:y,lastTabbableNode:m,firstDomTabbableNode:b,lastDomTabbableNode:p,nextTabbableNode:function(F){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,N=c.indexOf(F);if(N<0){if(I)return f.slice(f.indexOf(F)+1).find(function(C){return q(C)});return f.slice(0,f.indexOf(F)).reverse().find(function(C){return q(C)})}return c[N+(I?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function(l){return l.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!P("fallbackFocus"))throw Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find(function(l){return l.posTabIndexesFound})&&i.containerGroups.length>1)throw Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},M=function(l){if(l===!1)return;if(l===E(u)){i.mostRecentlyFocusedNode=l;return}if(!l||!l.focus){M(R());return}if(l.focus({preventScroll:!!v.preventScroll}),i.mostRecentlyFocusedNode=l,et(l))l.select()},ee=function(l){var c=P("setReturnFocus",{params:[l]});return c?c:c===!1?!1:l},te=function(l){var{target:c,event:f,isBackward:y}=l,m=y===void 0?!1:y;c=c||ce(f),O();var b=null;if(i.tabbableGroups.length>0){var p=k(c,f),g=p>=0?i.containerGroups[p]:void 0;if(p<0)if(m)b=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode;else b=i.tabbableGroups[0].firstTabbableNode;else if(m){var w=i.tabbableGroups.findIndex(function(K){var ve=K.firstTabbableNode;return c===ve});if(w<0&&(g.container===c||le(c,v.tabbableOptions)&&!q(c,v.tabbableOptions)&&!g.nextTabbableNode(c,!1)))w=Math.max(0,i.tabbableGroups.findIndex(function(K){return i.containerGroups.indexOf(K)>=p}));if(w>=0){var F=w===0?i.tabbableGroups.length-1:w-1,I=i.tabbableGroups[F];b=H(c)>=0?I.lastTabbableNode:I.lastDomTabbableNode}else if(!J(f))b=g.nextTabbableNode(c,!1)}else{var N=i.tabbableGroups.findIndex(function(K){var ve=K.lastTabbableNode;return c===ve});if(N<0&&(g.container===c||le(c,v.tabbableOptions)&&!q(c,v.tabbableOptions)&&!g.nextTabbableNode(c))){var C=i.tabbableGroups.findIndex(function(K){return i.containerGroups.indexOf(K)>p});N=C>0?C-1:i.tabbableGroups.length-1}if(N>=0){var x=N===i.tabbableGroups.length-1?0:N+1,ne=i.tabbableGroups[x];b=H(c)>=0?ne.firstTabbableNode:ne.firstDomTabbableNode}else if(!J(f))b=g.nextTabbableNode(c)}}else b=P("fallbackFocus");return b},W=function(l){var c=ce(l);if(k(c,l)>=0)return;if(X(v.clickOutsideDeactivates,l)){h.deactivate({returnFocus:v.returnFocusOnDeactivate});return}if(X(v.allowOutsideClick,l))return;l.preventDefault()},ae=function(l){var c=ce(l),f=k(c,l)>=0;if(f||c instanceof Document){if(f)i.mostRecentlyFocusedNode=c}else{l.stopImmediatePropagation();var y,m=!0;if(i.mostRecentlyFocusedNode){if(H(i.mostRecentlyFocusedNode)>0){var b=k(i.mostRecentlyFocusedNode),p=i.containerGroups[b].tabbableNodes;if(p.length>0){var g=p.findIndex(function(w){return w===i.mostRecentlyFocusedNode});if(g>=0){if(v.isKeyForward(i.recentNavEvent)){if(g+1=0)y=p[g-1],m=!1}}}else if(!i.containerGroups.some(function(w){return w.tabbableNodes.some(function(F){return H(F)>0})}))m=!1}else m=!1;if(m)y=te({target:i.mostRecentlyFocusedNode,isBackward:v.isKeyBackward(i.recentNavEvent)});if(y)M(y);else M(i.mostRecentlyFocusedNode||R())}i.recentNavEvent=void 0},de=function(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i.recentNavEvent=l;var f=te({event:l,isBackward:c});if(f){if(J(l))l.preventDefault();M(f)}},U=function(l){if(v.isKeyForward(l)||v.isKeyBackward(l))de(l,v.isKeyBackward(l))},z=function(l){if(tt(l)&&X(v.escapeDeactivates,l)!==!1)l.preventDefault(),h.deactivate()},Y=function(l){var c=ce(l);if(k(c,l)>=0)return;if(X(v.clickOutsideDeactivates,l))return;if(X(v.allowOutsideClick,l))return;l.preventDefault(),l.stopImmediatePropagation()},re=function(){if(!i.active)return;if(_.activateTrap(d,h),i.paused)return;var l;if(v.delayInitialFocus)l=new Promise(function(c){i.delayInitialFocusTimer=De(function(){M(R()),c()})});else if(M(R()),!i.active||i.paused)return;return u.addEventListener("focusin",ae,!0),u.addEventListener("mousedown",W,{capture:!0,passive:!1}),u.addEventListener("touchstart",W,{capture:!0,passive:!1}),u.addEventListener("click",Y,{capture:!0,passive:!1}),u.addEventListener("keydown",U,{capture:!0,passive:!1}),u.addEventListener("keydown",z),l},fe=function(l){if(i.active&&!i.paused)h._setSubtreeIsolation(!1);i.adjacentElements.clear(),i.alreadySilent.clear();var c=new Set,f=new Set,y=Ie(l),m;try{for(y.s();!(m=y.n()).done;){var b=m.value;c.add(b);var p=typeof ShadowRoot<"u"&&b.getRootNode()instanceof ShadowRoot,g=b;while(g){c.add(g);var w=g.parentElement,F=[];if(w)F=w.children;else if(!w&&p)F=g.getRootNode().children,w=g.getRootNode().host,p=typeof ShadowRoot<"u"&&w.getRootNode()instanceof ShadowRoot;var I=Ie(F),N;try{for(I.s();!(N=I.n()).done;){var C=N.value;f.add(C)}}catch(x){I.e(x)}finally{I.f()}g=w}}}catch(x){y.e(x)}finally{y.f()}c.forEach(function(x){f.delete(x)}),i.adjacentElements=f},A=function(){if(!i.active)return;return u.removeEventListener("focusin",ae,!0),u.removeEventListener("mousedown",W,!0),u.removeEventListener("touchstart",W,!0),u.removeEventListener("click",Y,!0),u.removeEventListener("keydown",U,!0),u.removeEventListener("keydown",z),h},L=function(l){var c=i.mostRecentlyFocusedNode;if(!c)return;var f=l.some(function(m){var b=Array.from(m.removedNodes);return b.some(function(p){return p===c||typeof p.contains==="function"&&p.contains(c)})});if(f&&i.containers.some(function(m){return m===null||m===void 0?void 0:m.isConnected})){O();var y=R();M(y)}},j=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(L):void 0,B=function(){if(!j)return;if(j.disconnect(),i.active&&!i.paused)i.containers.map(function(l){j.observe(l,{subtree:!0,childList:!0})})};return h={get active(){return i.active},get paused(){return i.paused},activate:function(l){if(i.active)return this;var c={};i.activation=c,Z.set(u,{});var f=S(l,"onActivate"),y=S(l,"onPostActivate"),m=S(l,"checkCanFocusTrap"),b=_.getActiveTrap(d),p=!1;if(b&&!b.paused){var g;(g=b._setSubtreeIsolation)===null||g===void 0||g.call(b,!1),p=!0,c.preexistingTrap=b,G.set(b,(G.get(b)||0)+1)}try{if(!m)O();i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=E(u),f===null||f===void 0||f({trap:h});var w=function(){if(!i.active||i.activation!==c)return;if(m)O();var N=function(){if(!i.active||i.activation!==c)return;if(!i.paused)h._setSubtreeIsolation(!0);B(),y===null||y===void 0||y({trap:h})};pe(c);var C=re();if(C)C.then(N);else N()};if(m)return m(i.containers.concat()).then(w,w),this;w()}catch(I){if(pe(c),b===_.getActiveTrap(d)&&p&&!G.has(b)){var F;(F=b._setSubtreeIsolation)===null||F===void 0||F.call(b,!0)}throw I}return this},deactivate:function(l){var c;if(!i.active)return this;var f=Re({onDeactivate:v.onDeactivate,onPostDeactivate:v.onPostDeactivate,checkCanReturnFocus:v.checkCanReturnFocus},l);if(clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,i.unpausing=void 0,!i.paused)h._setSubtreeIsolation(!1);i.alreadySilent.clear(),A(),i.active=!1,i.paused=!1,B();var y=i.activation,m={};Z.set(u,m),_.deactivateTrap(d,h);var b=(c=i.activation)===null||c===void 0?void 0:c.preexistingTrap;if(pe(i.activation),!G.has(b)&&b===_.getActiveTrap(d)&&b!==null&&b!==void 0&&b.active&&!b.paused){var p;(p=b._setSubtreeIsolation)===null||p===void 0||p.call(b,!0)}var g=S(f,"onDeactivate"),w=S(f,"onPostDeactivate"),F=S(f,"checkCanReturnFocus"),I=S(f,"delayReturnFocus"),N=S(f,"returnFocus","returnFocusOnDeactivate");g===null||g===void 0||g({trap:h});var C=function(){if(N&&i.activation===y&&Z.get(u)===m){var K=ee(i.nodeFocusedBeforeActivation);if(i.activation===y&&Z.get(u)===m)M(K)}w===null||w===void 0||w({trap:h})},x=function(){if(I&&N)De(C);else C()};if(N&&F)return F(ee(i.nodeFocusedBeforeActivation)).then(x,x),this;return x(),this},pause:function(l){if(!i.active)return this;return i.manuallyPaused=!0,this._setPausedState(!0,l)},unpause:function(l){if(!i.active)return this;if(i.manuallyPaused=!1,d[d.length-1]!==this)return this;if(i.paused)Z.set(u,{});return this._setPausedState(!1,l)},updateContainerElements:function(l){var c=[].concat(l).filter(Boolean);if(i.containers=c.map(function(f){return typeof f==="string"?u.querySelector(f):f}),v.isolateSubtrees)fe(i.containers);if(i.active){if(O(),!i.paused)h._setSubtreeIsolation(!0)}return B(),this}},Object.defineProperties(h,{_isManuallyPaused:{value:function(){return i.manuallyPaused}},_setPausedState:{value:function(l,c){if(i.paused===l)return this;if(i.paused=l,l){var f=S(c,"onPause"),y=S(c,"onPostPause");f===null||f===void 0||f({trap:h}),i.unpausing=void 0,A(),h._setSubtreeIsolation(!1),B(),y===null||y===void 0||y({trap:h})}else{var m=S(c,"onUnpause"),b=S(c,"onPostUnpause"),p={};if(i.unpausing=p,m===null||m===void 0||m({trap:h}),i.unpausing!==p)return this;var g=function(){if(!i.active||i.paused)return;O();var F=function(){if(i.unpausing!==p)return;if(!G.has(h))h._setSubtreeIsolation(!0);B(),b===null||b===void 0||b({trap:h})},I=re();if(I)I.then(F);else F()};g()}return this}},_setSubtreeIsolation:{value:function(l){if(v.isolateSubtrees){if(i.subtreeIsolated===l)return;i.subtreeIsolated=l,i.adjacentElements.forEach(function(c){var f;if(l)switch(v.isolateSubtrees){case"aria-hidden":if(c.ariaHidden==="true"||((f=c.getAttribute("aria-hidden"))===null||f===void 0?void 0:f.toLowerCase())==="true")i.alreadySilent.add(c);c.setAttribute("aria-hidden","true");break;default:if(c.inert||c.hasAttribute("inert"))i.alreadySilent.add(c);c.setAttribute("inert",!0);break}else if(i.alreadySilent.has(c));else switch(v.isolateSubtrees){case"aria-hidden":c.removeAttribute("aria-hidden");break;default:c.removeAttribute("inert");break}})}}}}),h.updateContainerElements(t),h};var it=150,ot=1000,Q=new Set,Ce=(o)=>{let t=o.trim();if(!t)return null;let n=Number.parseFloat(t);if(!Number.isFinite(n))return null;if(t.endsWith("ms"))return n;if(t.endsWith("s"))return n*1000;return null};function ut(o,t){let n=t.modalName;if(!n)return;let u=`[data-modal-${n}-toggler]`,d=`[data-modal-${n}-close]`,v=`[data-modal-${n}-target]`,i=()=>Array.from(document.querySelectorAll(u)),h=Array.from(document.querySelectorAll(v)),S=i(),k=S.filter((A)=>o.contains(A)),P=document.querySelector(d)??k[k.length-1]??null;if(P&&!P.hasAttribute("aria-label"))P.setAttribute("aria-label",`Close ${n}`);if(o.setAttribute("inert",""),!o.hasAttribute("role"))o.setAttribute("role","dialog");if(!o.hasAttribute("aria-modal"))o.setAttribute("aria-modal","true");if(!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))o.setAttribute("aria-label",n.replace(/[-_]+/g," "));S.forEach((A)=>{A.setAttribute("aria-expanded","false")});let E=document.documentElement,R=!1,O=null,M=(A)=>{let L=A?"true":"false";i().forEach((j)=>{j.setAttribute("aria-expanded",L)})},ee=()=>{s.stop(o),o.classList.add("is-active"),Q.add(o),E.classList.add(a.HAS_MODAL_OPEN,`has-modal-${n}-open`),o.removeAttribute("inert"),R=!0},te=()=>{M(!0)},W=()=>{if(s.start(o),o.classList.remove("is-active"),Q.delete(o),E.classList.remove(`has-modal-${n}-open`),Q.size===0)E.classList.remove(a.HAS_MODAL_OPEN);o.setAttribute("inert",""),R=!1},ae=()=>{M(!1)},de=()=>{if(R)return;O?.activate()},U=()=>{if(!R)return;O?.deactivate()},z=(A)=>{let L=A.target;if(!(L instanceof Element))return;if(L.closest(u)){if(R)U();else de();return}if(L.closest(d))U()},Y=new Set,re=(A)=>new Promise((L)=>{let j=performance.now()+ot,B=0,T=()=>{cancelAnimationFrame(B),Y.delete(T),L()},l=()=>{if(getComputedStyle(A).visibility!=="hidden")return T();if(performance.now()>=j)return T();B=requestAnimationFrame(l)};Y.add(T),B=requestAnimationFrame(l)}),fe=()=>{let A=getComputedStyle(o).getPropertyValue("--modal-duration"),L=Ce(A);if(L!==null)return L;let j=getComputedStyle(E).getPropertyValue("--motion--duration-fast");return Ce(j)??it};e(()=>{O=Oe(h.length>0?h:o,{checkCanFocusTrap:(A)=>Promise.all(A.map(re)),onActivate:ee,onPostActivate:te,onDeactivate:W,onPostDeactivate:ae,clickOutsideDeactivates:(A)=>!(A.target instanceof Element)||!A.target.closest(u),allowOutsideClick:(A)=>A.target instanceof Element&&Boolean(A.target.closest(u)),initialFocus:P??!1,fallbackFocus:o}),document.addEventListener("click",z)}),D(async()=>{if(!R)return;U(),await new Promise((A)=>setTimeout(A,fe()))}),r(()=>{if(Array.from(Y).forEach((A)=>A()),O?.deactivate(),O=null,Q.delete(o),Q.size===0)E.classList.remove(a.HAS_MODAL_OPEN);E.classList.remove(`has-modal-${n}-open`),document.removeEventListener("click",z)})}export{ut as default};