import{j as A,r as $,k as N,l as O,m as j,n as b,w as S,d as q,b as z,v as R,T as D,q as p,s as F,x as B,y as V,z as H,A as m,B as _,C as P,D as Z,F as K,__tla as M}from"./index.b5692aad.js";let T,Y=Promise.all([(()=>{try{return M}catch{}})()]).then(async()=>{function E(n){let e;const o=A("loading"),s=$(!1),t=N({...n,originalPosition:"",originalOverflow:"",visible:!1});function a(l){t.text=l}function r(){const l=t.parent;if(!l.vLoadingAddClassList){let i=l.getAttribute("loading-number");i=Number.parseInt(i)-1,i?l.setAttribute("loading-number",i.toString()):(p(l,o.bm("parent","relative")),l.removeAttribute("loading-number")),p(l,o.bm("parent","hidden"))}c(),v.unmount()}function c(){var l,i;(i=(l=d.$el)==null?void 0:l.parentNode)==null||i.removeChild(d.$el)}function C(){var l;n.beforeClose&&!n.beforeClose()||(s.value=!0,clearTimeout(e),e=window.setTimeout(u,400),t.visible=!1,(l=n.closed)==null||l.call(n))}function u(){if(!s.value)return;const l=t.parent;s.value=!1,l.vLoadingAddClassList=void 0,r()}const v=O({name:"ElLoading",setup(){return()=>{const l=t.spinner||t.svg,i=b("svg",{class:"circular",viewBox:t.svgViewBox?t.svgViewBox:"0 0 50 50",...l?{innerHTML:l}:{}},[b("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})]),I=t.text?b("p",{class:o.b("text")},[t.text]):void 0;return b(D,{name:o.b("fade"),onAfterLeave:u},{default:S(()=>[q(z("div",{style:{backgroundColor:t.background||""},class:[o.b("mask"),t.customClass,t.fullscreen?"is-fullscreen":""]},[b("div",{class:o.b("spinner")},[i,I])]),[[R,t.visible]])])})}}}),d=v.mount(document.createElement("div"));return{...j(t),setText:a,removeElLoadingChild:c,close:C,handleAfterLeave:u,vm:d,get $el(){return d.$el}}}let g,k,w,h,y,f,x,L;k=function(n={}){if(!F)return;const e=w(n);if(e.fullscreen&&g)return g;const o=E({...e,closed:()=>{var t;(t=e.closed)==null||t.call(e),e.fullscreen&&(g=void 0)}});h(e,e.parent,o),y(e,e.parent,o),e.parent.vLoadingAddClassList=()=>y(e,e.parent,o);let s=e.parent.getAttribute("loading-number");return s?s=`${Number.parseInt(s)+1}`:s="1",e.parent.setAttribute("loading-number",s),e.parent.appendChild(o.$el),B(()=>o.visible.value=e.visible),e.fullscreen&&(g=o),o},w=n=>{var e,o,s,t;let a;return V(n.target)?a=(e=document.querySelector(n.target))!=null?e:document.body:a=n.target||document.body,{parent:a===document.body||n.body?document.body:a,background:n.background||"",svg:n.svg||"",svgViewBox:n.svgViewBox||"",spinner:n.spinner||!1,text:n.text||"",fullscreen:a===document.body&&((o=n.fullscreen)!=null?o:!0),lock:(s=n.lock)!=null?s:!1,customClass:n.customClass||"",visible:(t=n.visible)!=null?t:!0,target:a}},h=async(n,e,o)=>{const{nextZIndex:s}=H(),t={};if(n.fullscreen)o.originalPosition.value=m(document.body,"position"),o.originalOverflow.value=m(document.body,"overflow"),t.zIndex=s();else if(n.parent===document.body){o.originalPosition.value=m(document.body,"position"),await B();for(const a of["top","left"]){const r=a==="top"?"scrollTop":"scrollLeft";t[a]=`${n.target.getBoundingClientRect()[a]+document.body[r]+document.documentElement[r]-Number.parseInt(m(document.body,`margin-${a}`),10)}px`}for(const a of["height","width"])t[a]=`${n.target.getBoundingClientRect()[a]}px`}else o.originalPosition.value=m(e,"position");for(const[a,r]of Object.entries(t))o.$el.style[a]=r},y=(n,e,o)=>{const s=A("loading");["absolute","fixed","sticky"].includes(o.originalPosition.value)?p(e,s.bm("parent","relative")):_(e,s.bm("parent","relative")),n.fullscreen&&n.lock?_(e,s.bm("parent","hidden")):p(e,s.bm("parent","hidden"))},f=Symbol("ElLoading"),x=(n,e)=>{var o,s,t,a;const r=e.instance,c=l=>P(e.value)?e.value[l]:void 0,C=l=>{const i=V(l)&&(r==null?void 0:r[l])||l;return i&&$(i)},u=l=>C(c(l)||n.getAttribute(`element-loading-${K(l)}`)),v=(o=c("fullscreen"))!=null?o:e.modifiers.fullscreen,d={text:u("text"),svg:u("svg"),svgViewBox:u("svgViewBox"),spinner:u("spinner"),background:u("background"),customClass:u("customClass"),fullscreen:v,target:(s=c("target"))!=null?s:v?void 0:n,body:(t=c("body"))!=null?t:e.modifiers.body,lock:(a=c("lock"))!=null?a:e.modifiers.lock};n[f]={options:d,instance:k(d)}},L=(n,e)=>{for(const o of Object.keys(e))Z(e[o])&&(e[o].value=n[o])},T={mounted(n,e){e.value&&x(n,e)},updated(n,e){const o=n[f];e.oldValue!==e.value&&(e.value&&!e.oldValue?x(n,e):e.value&&e.oldValue?P(e.value)&&L(e.value,o.options):o==null||o.instance.close())},unmounted(n){var e;(e=n[f])==null||e.instance.close()}}});export{Y as __tla,T as v};
