import{bx as de,b7 as J,a$ as ue,by as Oe,r as C,bz as He,bb as Ne,bw as Le,aJ as Ee,bm as fe,b as W,n as A,aw as ve,m as H,d as Z,aX as be,b2 as he,s as R,bq as me,j as ge,h as De,a0 as $,ad as we,a_ as Q,aq as z,af as N,b9 as ye,ba as Me,g as m,w as p,a9 as K,z as We,aa as ee,t as M,e as Ze,bv as Ue,bl as qe,Q as ie,ap as G,B as Fe,b0 as Ve,bA as oe,i as je,bB as Xe,v as Ke,k as Ye,O as Je,p as Qe,q as Ge,aI as pe,M as et,bC as tt,U as nt,bn as at,bD as lt,al as it,am as ot,x as st,ab as se}from"./index-BfmASpv-.js";import{u as xe}from"./use-id-JtySl7aL.js";import{T as rt}from"./use-tab-status-CA5wB-Hn.js";import{S as ct,a as dt}from"./index-CGu5AUOW.js";function ut(e,a,o){let l,r=0;const t=e.scrollLeft,s=o===0?1:Math.round(o*1e3/16);function c(){de(l)}function v(){e.scrollLeft+=(a-t)/s,++ra||!s&&ta?r=J(y):l&&(r=J(l))}return y(),g}function vt(){const e=C([]),a=[];return He(()=>{e.value=[]}),[e,l=>(a[l]||(a[l]=r=>{e.value[l]=r}),a[l])]}function Te(e,a){if(!Ne||!window.IntersectionObserver)return;const o=new IntersectionObserver(t=>{a(t[0].intersectionRatio>0)},{root:document.body}),l=()=>{e.value&&o.observe(e.value)},r=()=>{e.value&&o.unobserve(e.value)};Le(r),Ee(r),fe(l)}const[bt,ht]=W("sticky"),mt={zIndex:A,position:ve("top"),container:Object,offsetTop:H(0),offsetBottom:H(0)};var gt=Z({name:bt,props:mt,emits:["scroll","change"],setup(e,{emit:a,slots:o}){const l=C(),r=be(l),t=he({fixed:!1,width:0,height:0,transform:0}),s=C(!1),c=R(()=>me(e.position==="top"?e.offsetTop:e.offsetBottom)),v=R(()=>{if(s.value)return;const{fixed:f,height:S,width:u}=t;if(f)return{width:`${u}px`,height:`${S}px`}}),g=R(()=>{if(!t.fixed||s.value)return;const f=ge(De(e.zIndex),{width:`${t.width}px`,height:`${t.height}px`,[e.position]:`${c.value}px`});return t.transform&&(f.transform=`translate3d(0, ${t.transform}px, 0)`),f}),y=f=>a("scroll",{scrollTop:f,isFixed:t.fixed}),k=()=>{if(!l.value||Q(l))return;const{container:f,position:S}=e,u=N(l),T=ue(window);if(t.width=u.width,t.height=u.height,S==="top")if(f){const d=N(f),B=d.bottom-c.value-t.height;t.fixed=c.value>u.top&&d.bottom>0,t.transform=B<0?B:0}else t.fixed=c.value>u.top;else{const{clientHeight:d}=document.documentElement;if(f){const B=N(f),h=d-B.top-c.value-t.height;t.fixed=d-c.valueB.top,t.transform=h<0?-h:0}else t.fixed=d-c.valuet.fixed,f=>a("change",f)),we("scroll",k,{target:r,passive:!0}),Te(l,k),$([ye,Me],()=>{!l.value||Q(l)||!t.fixed||(s.value=!0,z(()=>{const f=N(l);t.width=f.width,t.height=f.height,s.value=!1}))}),()=>{var f;return m("div",{ref:l,style:v.value},[m("div",{class:ht({fixed:t.fixed&&!s.value}),style:g.value},[(f=o.default)==null?void 0:f.call(o)])])}}});const wt=p(gt),[yt,re]=W("tabs");var xt=Z({name:yt,props:{count:K(Number),inited:Boolean,animated:Boolean,duration:K(A),swipeable:Boolean,lazyRender:Boolean,currentIndex:K(Number)},emits:["change"],setup(e,{emit:a,slots:o}){const l=C(),r=c=>a("change",c),t=()=>{var c;const v=(c=o.default)==null?void 0:c.call(o);return e.animated||e.swipeable?m(ct,{ref:l,loop:!1,class:re("track"),duration:+e.duration*1e3,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:r},{default:()=>[v]}):v},s=c=>{const v=l.value;v&&v.state.active!==c&&v.swipeTo(c,{immediate:!e.inited})};return $(()=>e.currentIndex,s),We(()=>{s(e.currentIndex)}),ee({swipeRef:l}),()=>m("div",{class:re("content",{animated:e.animated||e.swipeable})},[t()])}});const[Se,X]=W("tabs"),Tt={type:ve("line"),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:H(0),duration:H(.3),animated:Boolean,ellipsis:M,swipeable:Boolean,scrollspy:Boolean,offsetTop:H(0),background:String,lazyRender:M,showHeader:M,lineWidth:A,lineHeight:A,beforeChange:Function,swipeThreshold:H(5),titleActiveColor:String,titleInactiveColor:String},Ce=Symbol(Se);var St=Z({name:Se,props:Tt,emits:["change","scroll","rendered","clickTab","update:active"],setup(e,{emit:a,slots:o}){let l,r,t,s,c;const v=C(),g=C(),y=C(),k=C(),f=xe(),S=be(v),[u,T]=vt(),{children:d,linkChildren:B}=Ze(Ce),h=he({inited:!1,position:"",lineStyle:{},currentIndex:-1}),L=R(()=>d.length>+e.swipeThreshold||!e.ellipsis||e.shrink),U=R(()=>({borderColor:e.color,background:e.background})),E=(n,i)=>{var b;return(b=n.name)!=null?b:i},q=R(()=>{const n=d[h.currentIndex];if(n)return E(n,h.currentIndex)}),O=R(()=>me(e.offsetTop)),te=R(()=>e.sticky?O.value+l:0),D=n=>{const i=g.value,b=u.value;if(!L.value||!i||!b||!b[h.currentIndex])return;const x=b[h.currentIndex].$el,w=x.offsetLeft-(i.offsetWidth-x.offsetWidth)/2;s&&s(),s=ut(i,w,n?0:+e.duration)},_=()=>{const n=h.inited;z(()=>{const i=u.value;if(!i||!i[h.currentIndex]||e.type!=="line"||Q(v.value))return;const b=i[h.currentIndex].$el,{lineWidth:x,lineHeight:w}=e,I=b.offsetLeft+b.offsetWidth/2,P={width:ie(x),backgroundColor:e.color,transform:`translateX(${I}px) translateX(-50%)`};if(n&&(P.transitionDuration=`${e.duration}s`),G(w)){const j=ie(w);P.height=j,P.borderRadius=j}h.lineStyle=P})},Ie=n=>{const i=n=0&&n{const b=Ie(n);if(!G(b))return;const x=d[b],w=E(x,b),I=h.currentIndex!==null;h.currentIndex!==b&&(h.currentIndex=b,i||D(),_()),w!==e.active&&(a("update:active",w),I&&a("change",w,x.title)),t&&!e.scrollspy&&Ve(Math.ceil(oe(v.value)-O.value))},V=(n,i)=>{const b=d.find((w,I)=>E(w,I)===n),x=b?d.indexOf(b):0;F(x,i)},ne=(n=!1)=>{if(e.scrollspy){const i=d[h.currentIndex].$el;if(i&&S.value){const b=oe(i,S.value)-te.value;r=!0,c&&c(),c=ft(S.value,b,n?0:+e.duration,()=>{r=!1})}}},Re=(n,i,b)=>{const{title:x,disabled:w}=d[i],I=E(d[i],i);w||(je(e.beforeChange,{args:[I],done:()=>{F(i),ne()}}),Xe(n)),a("clickTab",{name:I,title:x,event:b,disabled:w})},ke=n=>{t=n.isFixed,a("scroll",n)},Be=n=>{z(()=>{V(n),ne(!0)})},$e=()=>{for(let n=0;nte.value)return n===0?0:n-1}return d.length-1},_e=()=>{if(e.scrollspy&&!r){const n=$e();F(n)}},Pe=()=>{if(e.type==="line"&&d.length)return m("div",{class:X("line"),style:h.lineStyle},null)},ae=()=>{var n,i,b;const{type:x,border:w,sticky:I}=e,P=[m("div",{ref:I?void 0:y,class:[X("wrap"),{[Fe]:x==="line"&&w}]},[m("div",{ref:g,role:"tablist",class:X("nav",[x,{shrink:e.shrink,complete:L.value}]),style:U.value,"aria-orientation":"horizontal"},[(n=o["nav-left"])==null?void 0:n.call(o),d.map(j=>j.renderTitle(Re)),Pe(),(i=o["nav-right"])==null?void 0:i.call(o)])]),(b=o["nav-bottom"])==null?void 0:b.call(o)];return I?m("div",{ref:y},[P]):P},le=()=>{_(),z(()=>{var n,i;D(!0),(i=(n=k.value)==null?void 0:n.swipeRef.value)==null||i.resize()})};$(()=>[e.color,e.duration,e.lineWidth,e.lineHeight],_),$(ye,le),$(()=>e.active,n=>{n!==q.value&&V(n)}),$(()=>d.length,()=>{h.inited&&(V(e.active),_(),z(()=>{D(!0)}))});const ze=()=>{V(e.active,!0),z(()=>{h.inited=!0,y.value&&(l=N(y.value).height),D(!0)})},Ae=(n,i)=>a("rendered",n,i);return ee({resize:le,scrollTo:Be}),Ue(_),qe(_),fe(ze),Te(v,_),we("scroll",_e,{target:S,passive:!0}),B({id:f,props:e,setLine:_,scrollable:L,onRendered:Ae,currentName:q,setTitleRefs:T,scrollIntoView:D}),()=>m("div",{ref:v,class:X([e.type])},[e.showHeader?e.sticky?m(wt,{container:v.value,offsetTop:O.value,onScroll:ke},{default:()=>[ae()]}):ae():null,m(xt,{ref:k,count:d.length,inited:h.inited,animated:e.animated,duration:e.duration,swipeable:e.swipeable,lazyRender:e.lazyRender,currentIndex:h.currentIndex,onChange:F},{default:()=>{var n;return[(n=o.default)==null?void 0:n.call(o)]}})])}});const[Ct,ce]=W("tab"),It=Z({name:Ct,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:A,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:M},setup(e,{slots:a}){const o=R(()=>{const r={},{type:t,color:s,disabled:c,isActive:v,activeColor:g,inactiveColor:y}=e;s&&t==="card"&&(r.borderColor=s,c||(v?r.backgroundColor=s:r.color=s));const f=v?g:y;return f&&(r.color=f),r}),l=()=>{const r=m("span",{class:ce("text",{ellipsis:!e.scrollable})},[a.title?a.title():e.title]);return e.dot||G(e.badge)&&e.badge!==""?m(Ke,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:()=>[r]}):r};return()=>m("div",{id:e.id,role:"tab",class:[ce([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:o.value,tabindex:e.disabled?void 0:e.isActive?0:-1,"aria-selected":e.isActive,"aria-disabled":e.disabled||void 0,"aria-controls":e.controls},[l()])}}),[Rt,Y]=W("tab"),kt=ge({},Ye,{dot:Boolean,name:A,badge:A,title:String,disabled:Boolean,titleClass:Je,titleStyle:[String,Object],showZeroBadge:M});var Bt=Z({name:Rt,props:kt,setup(e,{slots:a}){const o=xe(),l=C(!1),r=Qe(),{parent:t,index:s}=Ge(Ce);if(!t)return;const c=()=>{var u;return(u=e.name)!=null?u:s.value},v=()=>{l.value=!0,t.props.lazyRender&&z(()=>{t.onRendered(c(),e.title)})},g=R(()=>{const u=c()===t.currentName.value;return u&&!l.value&&v(),u}),y=C(""),k=C("");pe(()=>{const{titleClass:u,titleStyle:T}=e;y.value=u?et(u):"",k.value=T&&typeof T!="string"?tt(nt(T)):T});const f=u=>m(It,st({key:o,id:`${t.id}-${s.value}`,ref:t.setTitleRefs(s.value),style:k.value,class:y.value,isActive:g.value,controls:o,scrollable:t.scrollable.value,activeColor:t.props.titleActiveColor,inactiveColor:t.props.titleInactiveColor,onClick:T=>u(r.proxy,s.value,T)},se(t.props,["type","color","shrink"]),se(e,["dot","badge","title","disabled","showZeroBadge"])),{title:a.title}),S=C(!g.value);return $(g,u=>{u?S.value=!1:at(()=>{S.value=!0})}),$(()=>e.title,()=>{t.setLine(),t.scrollIntoView()}),lt(rt,g),ee({id:o,renderTitle:f}),()=>{var u;const T=`${t.id}-${s.value}`,{animated:d,swipeable:B,scrollspy:h,lazyRender:L}=t.props;if(!a.default&&!d)return;const U=h||g.value;if(d||B)return m(dt,{id:o,role:"tabpanel",class:Y("panel-wrapper",{inactive:S.value}),tabindex:g.value?0:-1,"aria-hidden":!g.value,"aria-labelledby":T},{default:()=>{var O;return[m("div",{class:Y("panel")},[(O=a.default)==null?void 0:O.call(a)])]}});const q=l.value||h||!L?(u=a.default)==null?void 0:u.call(a):null;return it(m("div",{id:o,role:"tabpanel",class:Y("panel"),tabindex:U?0:-1,"aria-labelledby":T},[q]),[[ot,U]])}}});const At=p(Bt),Ot=p(St);export{Ot as T,At as a};