import{c as T,d as C,r as b,bF as N,f as y,v as k,bG as _,K as j,h as F,j as H,k as r,l as I,o as U,t as w,A as W,bH as P,bI as A,L as G,C as $,n as S,bJ as J}from"./index-5c2959ce.js";import{u as K}from"./index-bc17a672.js";const[M,f,O]=T("list"),V={error:Boolean,offset:I(300),loading:Boolean,disabled:Boolean,finished:Boolean,scroller:Object,errorText:String,direction:U("down"),loadingText:String,finishedText:String,immediateCheck:w};var q=C({name:M,props:V,emits:["load","update:error","update:loading"],setup(e,{emit:s,slots:n}){const a=b(e.loading),i=b(),l=b(),o=K(),c=N(i),v=y(()=>e.scroller||c.value),d=()=>{W(()=>{if(a.value||e.finished||e.disabled||e.error||(o==null?void 0:o.value)===!1)return;const{direction:t}=e,g=+e.offset,u=P(v);if(!u.height||A(i))return;let h=!1;const x=P(l);t==="up"?h=u.top-x.top<=g:h=x.bottom-u.bottom<=g,h&&(a.value=!0,s("update:loading",!0),s("load"))})},L=()=>{if(e.finished){const t=n.finished?n.finished():e.finishedText;if(t)return r("div",{class:f("finished-text")},[t])}},B=()=>{s("update:error",!1),d()},E=()=>{if(e.error){const t=n.error?n.error():e.errorText;if(t)return r("div",{role:"button",class:f("error-text"),tabindex:0,onClick:B},[t])}},R=()=>{if(a.value&&!e.finished&&!e.disabled)return r("div",{class:f("loading")},[n.loading?n.loading():r(G,{class:f("loading-icon")},{default:()=>[e.loadingText||O("loading")]})])};return k(()=>[e.loading,e.finished,e.error],d),o&&k(o,t=>{t&&d()}),_(()=>{a.value=e.loading}),j(()=>{e.immediateCheck&&d()}),F({check:d}),H("scroll",d,{target:v,passive:!0}),()=>{var t;const g=(t=n.default)==null?void 0:t.call(n),u=r("div",{ref:l,class:f("placeholder")},null);return r("div",{ref:i,role:"feed",class:f(),"aria-busy":a.value},[e.direction==="down"?g:u,R(),L(),E(),e.direction==="up"?g:u])}}});const Z=$(q),[z,m]=T("progress"),D={color:String,inactive:Boolean,pivotText:String,textColor:String,showPivot:w,pivotColor:String,trackColor:String,strokeWidth:S,percentage:{type:S,default:0,validator:e=>+e>=0&&+e<=100}};var Q=C({name:z,props:D,setup(e){const s=y(()=>e.inactive?void 0:e.color),n=()=>{const{textColor:a,pivotText:i,pivotColor:l,percentage:o}=e,c=i!=null?i:"".concat(o,"%");if(e.showPivot&&c){const v={color:a,left:"".concat(+o,"%"),transform:"translate(-".concat(+o,"%,-50%)"),background:l||s.value};return r("span",{style:v,class:m("pivot",{inactive:e.inactive})},[c])}};return()=>{const{trackColor:a,percentage:i,strokeWidth:l}=e,o={background:a,height:J(l)},c={width:"".concat(i,"%"),background:s.value};return r("div",{class:m(),style:o},[r("span",{class:m("portion",{inactive:e.inactive}),style:c},null),n()])}}});const p=$(Q);export{Z as L,p as P};