1import{c as y,B as I,a0 as N,d as Z,p as oe,w as O,u as T,ab as k,n as q,H as re,L as ae,O as ce,a5 as ue}from"./B3yagc9L.js";import{_ as ee,b as ie,d as de,w as fe}from"./DbRNuaQP.js";import{E as te}from"./C-PXKxxF.js";import{i as x,Q as le}from"./CfHXrSqi.js";function Ae(e){return e===void 0}const g="focus-trap.focus-after-trapped",R="focus-trap.focus-after-released",ve="focus-trap.focusout-prevented",M={cancelable:!0,bubbles:!1},pe={cancelable:!0,bubbles:!1},W="focusAfterTrapped",J="focusAfterReleased",Ee=Symbol("elFocusTrap"),A=y(),P=y(0),U=y(0);let F=0;const ne=e=>{const n=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0||o===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)n.push(s.currentNode);return n},Q=(e,n)=>{for(const s of e)if(!me(s,n))return s},me=(e,n)=>{if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1},Te=e=>{const n=ne(e),s=Q(n,e),o=Q(n.reverse(),e);return[s,o]},Fe=e=>e instanceof HTMLInputElement&&"select"in e,l=(e,n)=>{if(e&&e.focus){const s=document.activeElement;e.focus({preventScroll:!0}),U.value=window.performance.now(),e!==s&&Fe(e)&&n&&e.select()}};function Y(e,n){const s=[...e],o=e.indexOf(n);return o!==-1&&s.splice(o,1),s}const _e=()=>{let e=[];return{push:o=>{const a=e[0];a&&o!==a&&a.pause(),e=Y(e,o),e.unshift(o)},remove:o=>{var a,d;e=Y(e,o),(d=(a=e[0])==null?void 0:a.resume)==null||d.call(a)}}},be=(e,n=!1)=>{const s=document.activeElement;for(const o of e)if(l(o,n),document.activeElement!==s)return},z=_e(),ye=()=>P.value>U.value,_=()=>{A.value="pointer",P.value=window.performance.now()},G=()=>{A.value="keyboard",P.value=window.performance.now()},Pe=()=>(I(()=>{F===0&&(document.addEventListener("mousedown",_),document.addEventListener("touchstart",_),document.addEventListener("keydown",G)),F++}),N(()=>{F--,F<=0&&(document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",G))}),{focusReason:A,lastUserFocusTimestamp:P,lastAutomatedFocusTimestamp:U}),b=e=>new CustomEvent(ve,{...pe,detail:e});let p=[];const X=e=>{e.code===te.esc&&p.forEach(n=>n(e))},Le=e=>{I(()=>{p.length===0&&document.addEventListener("keydown",X),x&&p.push(e)}),N(()=>{p=p.filter(n=>n!==e),p.length===0&&x&&document.removeEventListener("keydown",X)})},Se=Z({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[W,J,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:n}){const s=y();let o,a;const{focusReason:d}=Pe();Le(t=>{e.trapped&&!v.paused&&n("release-requested",t)});const v={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},E=t=>{if(!e.loop&&!e.trapped||v.paused)return;const{code:r,altKey:c,ctrlKey:u,metaKey:i,currentTarget:H,shiftKey:V}=t,{loop:j}=e,se=r===te.tab&&!c&&!u&&!i,m=document.activeElement;if(se&&m){const w=H,[h,C]=Te(w);if(h&&C){if(!V&&m===C){const f=b({focusReason:d.value});n("focusout-prevented",f),f.defaultPrevented||(t.preventDefault(),j&&l(h,!0))}else if(V&&[h,w].includes(m)){const f=b({focusReason:d.value});n("focusout-prevented",f),f.defaultPrevented||(t.preventDefault(),j&&l(C,!0))}}else if(m===w){const f=b({focusReason:d.value});n("focusout-prevented",f),f.defaultPrevented||t.preventDefault()}}};oe(Ee,{focusTrapRef:s,onKeydown:E}),O(()=>e.focusTrapEl,t=>{t&&(s.value=t)},{immediate:!0}),O([s],([t],[r])=>{t&&(t.addEventListener("keydown",E),t.addEventListener("focusin",L),t.addEventListener("focusout",S)),r&&(r.removeEventListener("keydown",E),r.removeEventListener("focusin",L),r.removeEventListener("focusout",S))});const K=t=>{n(W,t)},D=t=>n(J,t),L=t=>{const r=T(s);if(!r)return;const c=t.target,u=t.relatedTarget,i=c&&r.contains(c);e.trapped||u&&r.contains(u)||(o=u),i&&n("focusin",t),!v.paused&&e.trapped&&(i?a=c:l(a,!0))},S=t=>{const r=T(s);if(!(v.paused||!r))if(e.trapped){const c=t.relatedTarget;!le(c)&&!r.contains(c)&&setTimeout(()=>{if(!v.paused&&e.trapped){const u=b({focusReason:d.value});n("focusout-prevented",u),u.defaultPrevented||l(a,!0)}},0)}else{const c=t.target;c&&r.contains(c)||n("focusout",t)}};async function B(){await q();const t=T(s);if(t){z.push(v);const r=t.contains(document.activeElement)?o:document.activeElement;if(o=r,!t.contains(r)){const u=new Event(g,M);
1t.addEventListener(g,K),t.dispatchEvent(u),u.defaultPrevented||q(()=>{let i=e.focusStartEl;re(i)||(l(i),document.activeElement!==i&&(i="first")),i==="first"&&be(ne(t),!0),(document.activeElement===r||i==="container")&&l(t)})}}}function $(){const t=T(s);if(t){t.removeEventListener(g,K);const r=new CustomEvent(R,{...M,detail:{focusReason:d.value}});t.addEventListener(R,D),t.dispatchEvent(r),!r.defaultPrevented&&(d.value=="keyboard"||!ye()||t.contains(document.activeElement))&&l(o??document.body),t.removeEventListener(R,D),z.remove(v)}}return I(()=>{e.trapped&&B(),O(()=>e.trapped,t=>{t?B():$()})}),N(()=>{e.trapped&&$(),s.value&&(s.value.removeEventListener("keydown",E),s.value.removeEventListener("focusin",L),s.value.removeEventListener("focusout",S),s.value=void 0)}),{onKeydown:E}}});function we(e,n,s,o,a,d){return k(e.$slots,"default",{handleKeydown:e.onKeydown})}var Ue=ee(Se,[["render",we],["__file","focus-trap.vue"]]);const he=ie({to:{type:de([String,Object]),required:!0},disabled:Boolean}),Ce=Z({__name:"teleport",props:he,setup(e){return(n,s)=>n.disabled?k(n.$slots,"default",{key:0}):(ae(),ce(ue,{key:1,to:n.to},[k(n.$slots,"default")],8,["to"]))}});var Oe=ee(Ce,[["__file","teleport.vue"]]);const Ke=fe(Oe);export{Ue as E,Ee as F,Ke as a,Ae as i};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.