import{d as P,S,N as x,aa as g,O as z,w,e as l,h as u,E as y,F as _,P as R,U as T,q as B,i as V,G as C,u as N,k as q,r as p,aW as D,an as E,ak as F,o as s,t as I,g as U,z as j,_ as A}from"./index-D92x6h1h.js";function G(a){return{hasLeft:a.scrollLeft>0,hasRight:a.scrollLeft+a.clientWidth<a.scrollWidth-1}}const M=["aria-label"],H={key:0,class:"page-tabs__l1-icon","aria-hidden":"true"},J=["aria-label","value"],K=["value"],Q=P({__name:"PageTabs",props:{tabs:{},l1Icon:{}},setup(a){const{t:m}=N(),v=a,h=D(),L=E(),f=q(()=>{const e=v.tabs.filter(t=>h.path===t.to||h.path.startsWith(t.to+"/"));return e.sort((t,r)=>r.to.length-t.to.length),e[0]?.to??v.tabs[0]?.to??""}),k=S();function O(e){const t=e.target;t.value&&t.value!==h.path&&L.push(t.value)}const n=p(null),d=p(!1),b=p(!1);function c(){const e=n.value;if(!e){d.value=!1,b.value=!1;return}const{hasLeft:t,hasRight:r}=G({scrollLeft:e.scrollLeft,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth});d.value=t,b.value=r}let i=null;x(()=>{g(c),globalThis.ResizeObserver!==void 0&&(i=new ResizeObserver(c),n.value&&i.observe(n.value))}),z(()=>{i?.disconnect(),i=null}),w(()=>v.tabs.map(e=>e.to).join("|"),()=>{g(c)});function W(){const e=n.value;if(!e)return;const t=e.querySelector(".page-tabs__tab--active");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}return w(f,()=>{g(W)},{immediate:!0}),(e,t)=>{const r=F("router-link");return s(),l("nav",{class:y(["page-tabs",{"page-tabs--phone":u(k),"page-tabs--has-left-overflow":d.value,"page-tabs--has-right-overflow":b.value}]),"aria-label":u(m)("Section navigation")},[u(k)?(s(),l(_,{key:0},[a.l1Icon?(s(),l("span",H,[(s(),R(T(a.l1Icon),{size:20,"stroke-width":2}))])):B("",!0),V("select",{class:"page-tabs__select","aria-label":u(m)("Section navigation"),value:f.value,onChange:O},[(s(!0),l(_,null,C(a.tabs,o=>(s(),l("option",{key:o.to,value:o.to},I(o.label),9,K))),128))],40,J)],64)):(s(),l("div",{key:1,ref_key:"scrollerRef",ref:n,class:"page-tabs__scroller",onScrollPassive:c},[(s(!0),l(_,null,C(a.tabs,o=>(s(),R(r,{key:o.to,to:o.to,class:y(["page-tabs__tab",{"page-tabs__tab--active":f.value===o.to}])},{default:U(()=>[j(I(o.label),1)]),_:2},1032,["to","class"]))),128))],544))],10,M)}}}),Y=A(Q,[["__scopeId","data-v-2c27e8d3"]]);export{Y as P};
