mirror of
https://github.com/schroinerxy/cloud-mail.git
synced 2026-06-21 19:35:50 +08:00
2 lines
20 KiB
JavaScript
2 lines
20 KiB
JavaScript
import{a8 as O,bo as xt,aQ as Ue,M as le,b as lt,d as Q,Z as It,R as $e,aS as Nt,k as g,b2 as Lt,H as ut,as as ue,z as A,F as B,a5 as be,ac as Ke,g as r,$ as P,_ as Ce,a as ce,aY as _t,j as At,u as Ye,bq as Ft,cm as Rt,cn as Pt,X as ct,W as Ot,I as de,a1 as kt,c as L,o as h,e as T,P as ye,f as K,n as w,r as M,m as _,p as J,a6 as te,L as Z,q as We,ab as Vt,bs as Dt,a7 as zt,a_ as Mt,t as oe,i as je,U as Ge,w as dt,J as xe,aa as Xe,E as ft,G as Bt,co as Ht,S as he,a9 as ge}from"./index-BtzXKQwE.js";import{u as Ut,d as qe}from"./index-DeJUs09x.js";import{U as we,I as Je,C as Ze}from"./event-BB_Ol6Sd.js";import{a as $t,d as Kt,b as Yt,c as Wt}from"./index-CBgbCWze.js";const jt=(e,n)=>{if(!O)return!1;const o={undefined:"overflow",true:"overflow-y",false:"overflow-x"}[String(n)],t=xt(e,o);return["scroll","auto","overlay"].some(i=>t.includes(i))},Vo=(e,n)=>{if(!O)return;let o=e;for(;o;){if([window,document,document.documentElement].includes(o))return window;if(jt(o,n))return o;o=o.parentNode}return o};let ne;const Do=e=>{var n;if(!O)return 0;if(ne!==void 0)return ne;const o=document.createElement("div");o.className=`${e}-scrollbar__wrap`,o.style.visibility="hidden",o.style.width="100px",o.style.position="absolute",o.style.top="-9999px",document.body.appendChild(o);const t=o.offsetWidth;o.style.overflow="scroll";const i=document.createElement("div");i.style.width="100%",o.appendChild(i);const l=i.offsetWidth;return(n=o.parentNode)==null||n.removeChild(o),ne=t-l,ne};function zo(e,n){if(!O)return;if(!n){e.scrollTop=0;return}const o=[];let t=n.offsetParent;for(;t!==null&&e!==t&&e.contains(t);)o.push(t),t=t.offsetParent;const i=n.offsetTop+o.reduce((c,y)=>c+y.offsetTop,0),l=i+n.offsetHeight,u=e.scrollTop,d=u+e.clientHeight;i<u?e.scrollTop=i:l>d&&(e.scrollTop=l-e.clientHeight)}const Gt=()=>O&&/firefox/i.test(window.navigator.userAgent);let I;const Xt={height:"0",visibility:"hidden",overflow:Gt()?"":"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},qt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function Jt(e){const n=window.getComputedStyle(e),o=n.getPropertyValue("box-sizing"),t=Number.parseFloat(n.getPropertyValue("padding-bottom"))+Number.parseFloat(n.getPropertyValue("padding-top")),i=Number.parseFloat(n.getPropertyValue("border-bottom-width"))+Number.parseFloat(n.getPropertyValue("border-top-width"));return{contextStyle:qt.map(u=>[u,n.getPropertyValue(u)]),paddingSize:t,borderSize:i,boxSizing:o}}function Qe(e,n=1,o){var t;I||(I=document.createElement("textarea"),document.body.appendChild(I));const{paddingSize:i,borderSize:l,boxSizing:u,contextStyle:d}=Jt(e);d.forEach(([E,N])=>I?.style.setProperty(E,N)),Object.entries(Xt).forEach(([E,N])=>I?.style.setProperty(E,N,"important")),I.value=e.value||e.placeholder||"";let c=I.scrollHeight;const y={};u==="border-box"?c=c+l:u==="content-box"&&(c=c-i),I.value="";const v=I.scrollHeight-i;if(Ue(n)){let E=v*n;u==="border-box"&&(E=E+i+l),c=Math.max(E,c),y.minHeight=`${E}px`}if(Ue(o)){let E=v*o;u==="border-box"&&(E=E+i+l),c=Math.min(E,c)}return y.height=`${c}px`,(t=I.parentNode)==null||t.removeChild(I),I=void 0,y}const Zt=lt({id:{type:String,default:void 0},size:Nt,disabled:Boolean,modelValue:{type:Q([String,Number,Object]),default:""},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:Q([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:Boolean,clearable:Boolean,showPassword:Boolean,showWordLimit:Boolean,suffixIcon:{type:$e},prefixIcon:{type:$e},containerRole:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:Q([Object,Array,String]),default:()=>It({})},autofocus:Boolean,rows:{type:Number,default:2},...Ut(["ariaLabel"]),inputmode:{type:Q(String),default:void 0},name:String}),Qt={[we]:e=>le(e),input:e=>le(e),change:e=>le(e),focus:e=>e instanceof FocusEvent,blur:e=>e instanceof FocusEvent,clear:()=>!0,mouseleave:e=>e instanceof MouseEvent,mouseenter:e=>e instanceof MouseEvent,keydown:e=>e instanceof Event,compositionstart:e=>e instanceof CompositionEvent,compositionupdate:e=>e instanceof CompositionEvent,compositionend:e=>e instanceof CompositionEvent},eo=["class","style"],to=/^on[A-Z]/,oo=(e={})=>{const{excludeListeners:n=!1,excludeKeys:o}=e,t=g(()=>(o?.value||[]).concat(eo)),i=ut();return i?g(()=>{var l;return Lt(Object.entries((l=i.proxy)==null?void 0:l.$attrs).filter(([u])=>!t.value.includes(u)&&!(n&&to.test(u))))}):g(()=>({}))},no='a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])',so=e=>getComputedStyle(e).position==="fixed"?!1:e.offsetParent!==null,Mo=e=>Array.from(e.querySelectorAll(no)).filter(n=>Ie(n)&&so(n)),Ie=e=>{if(e.tabIndex>0||e.tabIndex===0&&e.getAttribute("tabIndex")!==null)return!0;if(e.tabIndex<0||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true")return!1;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return!(e.type==="hidden"||e.type==="file");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},Bo=function(e,n,...o){let t;n.includes("mouse")||n.includes("click")?t="MouseEvents":n.includes("key")?t="KeyboardEvent":t="HTMLEvents";const i=document.createEvent(t);return i.initEvent(n,...o),e.dispatchEvent(i),e};function ao(e,{disabled:n,beforeFocus:o,afterFocus:t,beforeBlur:i,afterBlur:l}={}){const u=ut(),{emit:d}=u,c=ue(),y=A(!1),v=m=>{const s=Ke(o)?o(m):!1;r(n)||y.value||s||(y.value=!0,d("focus",m),t?.())},E=m=>{var s;const f=Ke(i)?i(m):!1;r(n)||m.relatedTarget&&((s=c.value)!=null&&s.contains(m.relatedTarget))||f||(y.value=!1,d("blur",m),l?.())},N=m=>{var s,f;r(n)||Ie(m.target)||(s=c.value)!=null&&s.contains(document.activeElement)&&c.value!==document.activeElement||(f=e.value)==null||f.focus()};return B([c,()=>r(n)],([m,s])=>{m&&(s?m.removeAttribute("tabindex"):m.setAttribute("tabindex","-1"))}),be(c,"focus",v,!0),be(c,"blur",E,!0),be(c,"click",N,!0),{isFocused:y,wrapperRef:c,handleFocus:v,handleBlur:E}}const ro=e=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e);function io({afterComposition:e,emit:n}){const o=A(!1),t=d=>{n?.("compositionstart",d),o.value=!0},i=d=>{var c;n?.("compositionupdate",d);const y=(c=d.target)==null?void 0:c.value,v=y[y.length-1]||"";o.value=!ro(v)},l=d=>{n?.("compositionend",d),o.value&&(o.value=!1,P(()=>e(d)))};return{isComposing:o,handleComposition:d=>{d.type==="compositionend"?l(d):i(d)},handleCompositionStart:t,handleCompositionUpdate:i,handleCompositionEnd:l}}function lo(e){let n;function o(){if(e.value==null)return;const{selectionStart:i,selectionEnd:l,value:u}=e.value;if(i==null||l==null)return;const d=u.slice(0,Math.max(0,i)),c=u.slice(Math.max(0,l));n={selectionStart:i,selectionEnd:l,value:u,beforeTxt:d,afterTxt:c}}function t(){if(e.value==null||n==null)return;const{value:i}=e.value,{beforeTxt:l,afterTxt:u,selectionStart:d}=n;if(l==null||u==null||d==null)return;let c=i.length;if(i.endsWith(u))c=i.length-u.length;else if(i.startsWith(l))c=l.length;else{const y=l[d-1],v=i.indexOf(y,d-1);v!==-1&&(c=v+1)}e.value.setSelectionRange(c,c)}return[o,t]}const uo="ElInput",co=ce({name:uo,inheritAttrs:!1}),fo=ce({...co,props:Zt,emits:Qt,setup(e,{expose:n,emit:o}){const t=e,i=_t(),l=oo(),u=At(),d=g(()=>[t.type==="textarea"?f.b():s.b(),s.m(N.value),s.is("disabled",m.value),s.is("exceed",Et.value),{[s.b("group")]:u.prepend||u.append,[s.m("prefix")]:u.prefix||t.prefixIcon,[s.m("suffix")]:u.suffix||t.suffixIcon||t.clearable||t.showPassword,[s.bm("suffix","password-clear")]:ee.value&&ve.value,[s.b("hidden")]:t.type==="hidden"},i.class]),c=g(()=>[s.e("wrapper"),s.is("focus",D.value)]),{form:y,formItem:v}=Yt(),{inputId:E}=Wt(t,{formItemContext:v}),N=$t(),m=Kt(),s=Ye("input"),f=Ye("textarea"),S=ue(),b=ue(),C=A(!1),k=A(!1),W=A(),V=ue(t.inputStyle),F=g(()=>S.value||b.value),{wrapperRef:H,isFocused:D,handleFocus:j,handleBlur:G}=ao(F,{disabled:m,afterBlur(){var a;t.validateEvent&&((a=v?.validate)==null||a.call(v,"blur").catch(p=>qe()))}}),pe=g(()=>{var a;return(a=y?.statusIcon)!=null?a:!1}),x=g(()=>v?.validateState||""),_e=g(()=>x.value&&Ft[x.value]),vt=g(()=>k.value?Rt:Pt),mt=g(()=>[i.style]),Ae=g(()=>[t.inputStyle,V.value,{resize:t.resize}]),z=g(()=>ct(t.modelValue)?"":String(t.modelValue)),ee=g(()=>t.clearable&&!m.value&&!t.readonly&&!!z.value&&(D.value||C.value)),ve=g(()=>t.showPassword&&!m.value&&!!z.value),U=g(()=>t.showWordLimit&&!!t.maxlength&&(t.type==="text"||t.type==="textarea")&&!m.value&&!t.readonly&&!t.showPassword),me=g(()=>z.value.length),Et=g(()=>!!U.value&&me.value>Number(t.maxlength)),bt=g(()=>!!u.suffix||!!t.suffixIcon||ee.value||t.showPassword||U.value||!!x.value&&pe.value),[Fe,Re]=lo(S);Ot(b,a=>{if(yt(),!U.value||t.resize!=="both")return;const p=a[0],{width:$}=p.contentRect;W.value={right:`calc(100% - ${$+15+6}px)`}});const X=()=>{const{type:a,autosize:p}=t;if(!(!O||a!=="textarea"||!b.value))if(p){const $=Ge(p)?p.minRows:void 0,Be=Ge(p)?p.maxRows:void 0,He=Qe(b.value,$,Be);V.value={overflowY:"hidden",...He},P(()=>{b.value.offsetHeight,V.value=He})}else V.value={minHeight:Qe(b.value).minHeight}},yt=(a=>{let p=!1;return()=>{var $;if(p||!t.autosize)return;(($=b.value)==null?void 0:$.offsetParent)===null||(a(),p=!0)}})(X),q=()=>{const a=F.value,p=t.formatter?t.formatter(z.value):z.value;!a||a.value===p||(a.value=p)},Ee=async a=>{Fe();let{value:p}=a.target;if(t.formatter&&t.parser&&(p=t.parser(p)),!Oe.value){if(p===z.value){q();return}o(we,p),o(Je,p),await P(),q(),Re()}},Pe=a=>{let{value:p}=a.target;t.formatter&&t.parser&&(p=t.parser(p)),o(Ze,p)},{isComposing:Oe,handleCompositionStart:ke,handleCompositionUpdate:Ve,handleCompositionEnd:De}=io({emit:o,afterComposition:Ee}),ht=()=>{Fe(),k.value=!k.value,setTimeout(Re)},gt=()=>{var a;return(a=F.value)==null?void 0:a.focus()},Tt=()=>{var a;return(a=F.value)==null?void 0:a.blur()},St=a=>{C.value=!1,o("mouseleave",a)},wt=a=>{C.value=!0,o("mouseenter",a)},ze=a=>{o("keydown",a)},Ct=()=>{var a;(a=F.value)==null||a.select()},Me=()=>{o(we,""),o(Ze,""),o("clear"),o(Je,"")};return B(()=>t.modelValue,()=>{var a;P(()=>X()),t.validateEvent&&((a=v?.validate)==null||a.call(v,"change").catch(p=>qe()))}),B(z,()=>q()),B(()=>t.type,async()=>{await P(),q(),X()}),de(()=>{!t.formatter&&t.parser,q(),P(X)}),n({input:S,textarea:b,ref:F,textareaStyle:Ae,autosize:kt(t,"autosize"),isComposing:Oe,focus:gt,blur:Tt,select:Ct,clear:Me,resizeTextarea:X}),(a,p)=>(h(),L("div",{class:w([r(d),{[r(s).bm("group","append")]:a.$slots.append,[r(s).bm("group","prepend")]:a.$slots.prepend}]),style:je(r(mt)),onMouseenter:wt,onMouseleave:St},[T(" input "),a.type!=="textarea"?(h(),L(ye,{key:0},[T(" prepend slot "),a.$slots.prepend?(h(),L("div",{key:0,class:w(r(s).be("group","prepend"))},[M(a.$slots,"prepend")],2)):T("v-if",!0),K("div",{ref_key:"wrapperRef",ref:H,class:w(r(c))},[T(" prefix slot "),a.$slots.prefix||a.prefixIcon?(h(),L("span",{key:0,class:w(r(s).e("prefix"))},[K("span",{class:w(r(s).e("prefix-inner"))},[M(a.$slots,"prefix"),a.prefixIcon?(h(),_(r(Z),{key:0,class:w(r(s).e("icon"))},{default:J(()=>[(h(),_(te(a.prefixIcon)))]),_:1},8,["class"])):T("v-if",!0)],2)],2)):T("v-if",!0),K("input",We({id:r(E),ref_key:"input",ref:S,class:r(s).e("inner")},r(l),{name:a.name,minlength:a.minlength,maxlength:a.maxlength,type:a.showPassword?k.value?"text":"password":a.type,disabled:r(m),readonly:a.readonly,autocomplete:a.autocomplete,tabindex:a.tabindex,"aria-label":a.ariaLabel,placeholder:a.placeholder,style:a.inputStyle,form:a.form,autofocus:a.autofocus,role:a.containerRole,inputmode:a.inputmode,onCompositionstart:r(ke),onCompositionupdate:r(Ve),onCompositionend:r(De),onInput:Ee,onChange:Pe,onKeydown:ze}),null,16,["id","name","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","role","inputmode","onCompositionstart","onCompositionupdate","onCompositionend"]),T(" suffix slot "),r(bt)?(h(),L("span",{key:1,class:w(r(s).e("suffix"))},[K("span",{class:w(r(s).e("suffix-inner"))},[!r(ee)||!r(ve)||!r(U)?(h(),L(ye,{key:0},[M(a.$slots,"suffix"),a.suffixIcon?(h(),_(r(Z),{key:0,class:w(r(s).e("icon"))},{default:J(()=>[(h(),_(te(a.suffixIcon)))]),_:1},8,["class"])):T("v-if",!0)],64)):T("v-if",!0),r(ee)?(h(),_(r(Z),{key:1,class:w([r(s).e("icon"),r(s).e("clear")]),onMousedown:zt(r(Mt),["prevent"]),onClick:Me},{default:J(()=>[Vt(r(Dt))]),_:1},8,["class","onMousedown"])):T("v-if",!0),r(ve)?(h(),_(r(Z),{key:2,class:w([r(s).e("icon"),r(s).e("password")]),onClick:ht},{default:J(()=>[(h(),_(te(r(vt))))]),_:1},8,["class"])):T("v-if",!0),r(U)?(h(),L("span",{key:3,class:w(r(s).e("count"))},[K("span",{class:w(r(s).e("count-inner"))},oe(r(me))+" / "+oe(a.maxlength),3)],2)):T("v-if",!0),r(x)&&r(_e)&&r(pe)?(h(),_(r(Z),{key:4,class:w([r(s).e("icon"),r(s).e("validateIcon"),r(s).is("loading",r(x)==="validating")])},{default:J(()=>[(h(),_(te(r(_e))))]),_:1},8,["class"])):T("v-if",!0)],2)],2)):T("v-if",!0)],2),T(" append slot "),a.$slots.append?(h(),L("div",{key:1,class:w(r(s).be("group","append"))},[M(a.$slots,"append")],2)):T("v-if",!0)],64)):(h(),L(ye,{key:1},[T(" textarea "),K("textarea",We({id:r(E),ref_key:"textarea",ref:b,class:[r(f).e("inner"),r(s).is("focus",r(D))]},r(l),{minlength:a.minlength,maxlength:a.maxlength,tabindex:a.tabindex,disabled:r(m),readonly:a.readonly,autocomplete:a.autocomplete,style:r(Ae),"aria-label":a.ariaLabel,placeholder:a.placeholder,form:a.form,autofocus:a.autofocus,rows:a.rows,role:a.containerRole,onCompositionstart:r(ke),onCompositionupdate:r(Ve),onCompositionend:r(De),onInput:Ee,onFocus:r(j),onBlur:r(G),onChange:Pe,onKeydown:ze}),null,16,["id","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","role","onCompositionstart","onCompositionupdate","onCompositionend","onFocus","onBlur"]),r(U)?(h(),L("span",{key:0,style:je(W.value),class:w(r(s).e("count"))},oe(r(me))+" / "+oe(a.maxlength),7)):T("v-if",!0)],64))],38))}});var po=Ce(fo,[["__file","input.vue"]]);const Ho=dt(po),Te="focus-trap.focus-after-trapped",Se="focus-trap.focus-after-released",vo="focus-trap.focusout-prevented",et={cancelable:!0,bubbles:!1},mo={cancelable:!0,bubbles:!1},tt="focusAfterTrapped",ot="focusAfterReleased",Eo=Symbol("elFocusTrap"),Ne=A(),fe=A(0),Le=A(0);let se=0;const pt=e=>{const n=[],o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{const i=t.tagName==="INPUT"&&t.type==="hidden";return t.disabled||t.hidden||i?NodeFilter.FILTER_SKIP:t.tabIndex>=0||t===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)n.push(o.currentNode);return n},nt=(e,n)=>{for(const o of e)if(!bo(o,n))return o},bo=(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},yo=e=>{const n=pt(e),o=nt(n,e),t=nt(n.reverse(),e);return[o,t]},ho=e=>e instanceof HTMLInputElement&&"select"in e,R=(e,n)=>{if(e&&e.focus){const o=document.activeElement;let t=!1;Xe(e)&&!Ie(e)&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),t=!0),e.focus({preventScroll:!0}),Le.value=window.performance.now(),e!==o&&ho(e)&&n&&e.select(),Xe(e)&&t&&e.removeAttribute("tabindex")}};function st(e,n){const o=[...e],t=e.indexOf(n);return t!==-1&&o.splice(t,1),o}const go=()=>{let e=[];return{push:t=>{const i=e[0];i&&t!==i&&i.pause(),e=st(e,t),e.unshift(t)},remove:t=>{var i,l;e=st(e,t),(l=(i=e[0])==null?void 0:i.resume)==null||l.call(i)}}},To=(e,n=!1)=>{const o=document.activeElement;for(const t of e)if(R(t,n),document.activeElement!==o)return},at=go(),So=()=>fe.value>Le.value,ae=()=>{Ne.value="pointer",fe.value=window.performance.now()},rt=()=>{Ne.value="keyboard",fe.value=window.performance.now()},wo=()=>(de(()=>{se===0&&(document.addEventListener("mousedown",ae),document.addEventListener("touchstart",ae),document.addEventListener("keydown",rt)),se++}),xe(()=>{se--,se<=0&&(document.removeEventListener("mousedown",ae),document.removeEventListener("touchstart",ae),document.removeEventListener("keydown",rt))}),{focusReason:Ne,lastUserFocusTimestamp:fe,lastAutomatedFocusTimestamp:Le}),re=e=>new CustomEvent(vo,{...mo,detail:e});let Y=[];const it=e=>{e.code===ft.esc&&Y.forEach(n=>n(e))},Co=e=>{de(()=>{Y.length===0&&document.addEventListener("keydown",it),O&&Y.push(e)}),xe(()=>{Y=Y.filter(n=>n!==e),Y.length===0&&O&&document.removeEventListener("keydown",it)})},xo=ce({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[tt,ot,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:n}){const o=A();let t,i;const{focusReason:l}=wo();Co(s=>{e.trapped&&!u.paused&&n("release-requested",s)});const u={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},d=s=>{if(!e.loop&&!e.trapped||u.paused)return;const{code:f,altKey:S,ctrlKey:b,metaKey:C,currentTarget:k,shiftKey:W}=s,{loop:V}=e,F=f===ft.tab&&!S&&!b&&!C,H=document.activeElement;if(F&&H){const D=k,[j,G]=yo(D);if(j&&G){if(!W&&H===G){const x=re({focusReason:l.value});n("focusout-prevented",x),x.defaultPrevented||(s.preventDefault(),V&&R(j,!0))}else if(W&&[j,D].includes(H)){const x=re({focusReason:l.value});n("focusout-prevented",x),x.defaultPrevented||(s.preventDefault(),V&&R(G,!0))}}else if(H===D){const x=re({focusReason:l.value});n("focusout-prevented",x),x.defaultPrevented||s.preventDefault()}}};Bt(Eo,{focusTrapRef:o,onKeydown:d}),B(()=>e.focusTrapEl,s=>{s&&(o.value=s)},{immediate:!0}),B([o],([s],[f])=>{s&&(s.addEventListener("keydown",d),s.addEventListener("focusin",v),s.addEventListener("focusout",E)),f&&(f.removeEventListener("keydown",d),f.removeEventListener("focusin",v),f.removeEventListener("focusout",E))});const c=s=>{n(tt,s)},y=s=>n(ot,s),v=s=>{const f=r(o);if(!f)return;const S=s.target,b=s.relatedTarget,C=S&&f.contains(S);e.trapped||b&&f.contains(b)||(t=b),C&&n("focusin",s),!u.paused&&e.trapped&&(C?i=S:R(i,!0))},E=s=>{const f=r(o);if(!(u.paused||!f))if(e.trapped){const S=s.relatedTarget;!ct(S)&&!f.contains(S)&&setTimeout(()=>{if(!u.paused&&e.trapped){const b=re({focusReason:l.value});n("focusout-prevented",b),b.defaultPrevented||R(i,!0)}},0)}else{const S=s.target;S&&f.contains(S)||n("focusout",s)}};async function N(){await P();const s=r(o);if(s){at.push(u);const f=s.contains(document.activeElement)?t:document.activeElement;if(t=f,!s.contains(f)){const b=new Event(Te,et);s.addEventListener(Te,c),s.dispatchEvent(b),b.defaultPrevented||P(()=>{let C=e.focusStartEl;le(C)||(R(C),document.activeElement!==C&&(C="first")),C==="first"&&To(pt(s),!0),(document.activeElement===f||C==="container")&&R(s)})}}}function m(){const s=r(o);if(s){s.removeEventListener(Te,c);const f=new CustomEvent(Se,{...et,detail:{focusReason:l.value}});s.addEventListener(Se,y),s.dispatchEvent(f),!f.defaultPrevented&&(l.value=="keyboard"||!So()||s.contains(document.activeElement))&&R(t??document.body),s.removeEventListener(Se,y),at.remove(u)}}return de(()=>{e.trapped&&N(),B(()=>e.trapped,s=>{s?N():m()})}),xe(()=>{e.trapped&&m(),o.value&&(o.value.removeEventListener("keydown",d),o.value.removeEventListener("focusin",v),o.value.removeEventListener("focusout",E),o.value=void 0)}),{onKeydown:d}}});function Io(e,n,o,t,i,l){return M(e.$slots,"default",{handleKeydown:e.onKeydown})}var Uo=Ce(xo,[["render",Io],["__file","focus-trap.vue"]]);const No=lt({to:{type:Q([String,Object]),required:!0},disabled:Boolean}),Lo=ce({__name:"teleport",props:No,setup(e){return(n,o)=>n.disabled?M(n.$slots,"default",{key:0}):(h(),_(Ht,{key:1,to:n.to},[M(n.$slots,"default")],8,["to"]))}});var _o=Ce(Lo,[["__file","teleport.vue"]]);const $o=dt(_o);var Ao=(e=>(e[e.TEXT=1]="TEXT",e[e.CLASS=2]="CLASS",e[e.STYLE=4]="STYLE",e[e.PROPS=8]="PROPS",e[e.FULL_PROPS=16]="FULL_PROPS",e[e.HYDRATE_EVENTS=32]="HYDRATE_EVENTS",e[e.STABLE_FRAGMENT=64]="STABLE_FRAGMENT",e[e.KEYED_FRAGMENT=128]="KEYED_FRAGMENT",e[e.UNKEYED_FRAGMENT=256]="UNKEYED_FRAGMENT",e[e.NEED_PATCH=512]="NEED_PATCH",e[e.DYNAMIC_SLOTS=1024]="DYNAMIC_SLOTS",e[e.HOISTED=-1]="HOISTED",e[e.BAIL=-2]="BAIL",e))(Ao||{});const ie=e=>{const n=he(e)?e:[e],o=[];return n.forEach(t=>{var i;he(t)?o.push(...ie(t)):ge(t)&&((i=t.component)!=null&&i.subTree)?o.push(t,...ie(t.component.subTree)):ge(t)&&he(t.children)?o.push(...ie(t.children)):ge(t)&&t.shapeFlag===2?o.push(...ie(t.type())):o.push(t)}),o};export{Ho as E,Eo as F,Ao as P,Uo as a,$o as b,ao as c,io as d,No as e,ie as f,Vo as g,Do as h,Ie as i,R as j,Mo as o,zo as s,Bo as t,oo as u};
|