1import{_ as R}from"./DhsSbPuU.js";import{Z as S,a as d,m as _,w as f,d as r,ag as A,J as M,M as D,E as F,am as K,v as L,aq as G,G as H,A as h,q as g,e as m,l as J,j as a,N as $,k as V,f as B,n as O,b as Z,t as Q,z as W}from"./Cwnt1hDm.js";import{_ as X}from"./CbmoTdqx.js";import{_ as Y}from"./UKQLMbo8.js";import{_ as ee}from"./VbwndDtA.js";import{_ as te}from"./9a2pmMBn.js";import{C as ae}from"./FUEBz3ew.js";import"./CyDLesCS.js";import"./D4fVd_LN.js";import"./BSkA0Wp8.js";import"./B0CT5uEn.js";import"./CJQRN2-B.js";import"./rhR1D7mj.js";import"./C7JDPtPu.js";import"./CLmoyFVz.js";const se={};function oe(T,o){const p=R;return d(),_(p,{variant:"subtle",size:"xs",class:"uppercase tracking-wider",ui:{size:{xs:"px-2 py-1",sm:"px-2 sm:px-5 py-2"}}},{default:f(()=>[...o[0]||(o[0]=[r("span",{class:"whitespace-nowrap"}," Beta ",-1)])]),_:1})}const ne=Object.assign(S(se,[["render",oe]]),{__name:"BetaBadge"}),re={class:"flex items-center justify-between"},le={class:"prose prose-sm dark:prose-invert flex items-center gap-x-2"},ie={class:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-y-6 my-6"},ce={key:1,class:"flex flex-col items-center justify-center gap-y-4 pt-20"},ue={class:"italic text-gray-500 dark:text-gray-400"},N=30,Ve={__name:"index",async setup(T){let o,p;const U=A("profile"),y=M(),x=[{id:"all",label:"My Chartrs",icon:"i-carbon-tools-alt"},{id:"recent",label:"Recent",icon:"i-carbon-time"},{id:"saved",label:"Saved",icon:"i-carbon-bookmark-filled"},{id:"unlisted",label:"Unlisted",icon:"i-carbon-link"},{id:"public",label:"Public",icon:"i-carbon-earth"}],w=D(),s=h({get(){return y.query.tab||x[0].id},set(t){w.replace({query:{tab:t}})}}),c=g(1),n=g([]),l=g(!0),i=h({get(){return y.query.search||""},set(t){w.replace({query:{search:t||void 0}})}}),C=h(()=>{const t=`&filter=${s.value}`,e=i.value?`&search=${i.value}`:"";return`/api/chartrs?page=${c.value}&limit=${N}${e}${t}`}),{data:v}=([o,p]=F(()=>H(C.value,"$HuKKwo2N2P")),o=await o,p(),o);K(v,()=>{n.value=v.value||[],v.value!==void 0&&(l.value=!1)});async function b(){if(!l.value&&!(n.value.length<c.value*N)){l.value=!0;try{c.value++;const t=await $fetch(C.value);n.value.push(...t)}catch(t){console.error("Error loading more items:",t),W().add({title:"Error",description:"Failed to load more items",color:"red"})}finally{l.value=!1}}}function E(){console.log("handleEndVisible"),b()}return L(s,()=>{c.value=0,n.value=[],b()}),G(i,()=>{c.value=0,n.value=[],b()},{debounce:500}),(t,e)=>{const q=ne,k=J,I=X,P=Y,j=ee,z=te;return d(),_(z,{class:"mt-20"},{default:f(()=>[r("div",null,[r("div",re,[r("div",le,[e[4]||(e[4]=r("h2",{class:"!m-0"}," Chartrs ",-1)),m(q,{class:"text-xs"})]),m(k,{color:"orange",icon:"i-heroicons-plus",onClick:e[0]||(e[0]=u=>("navigateTo"in t?t.navigateTo:a($))("/chartrs/new"))},{default:f(()=>[...e[5]||(e[5]=[V(" Create ",-1)])]),_:1})])]),r("div",ie,[m(I,{modelValue:a(s),"onUpdate:modelValue":e[1]||(e[1]=u=>B(s)?s.value=u:null),tabs:x},null,8,["modelValue"]),m(P,{modelValue:a(i),"onUpdate:modelValue":e[2]||(e[2]=u=>B(i)?i.value=u:null),placeholder:"Search...",icon:"i-carbon-search",size:"sm",ui:{wrapper:"w-full sm:w-auto",rounded:"rounded-full"}},null,8,["modelValue"])]),a(s)==="public"?(d(),_(j,{key:0,show:!0,username:a(U)?.username,class:"mb-6"},null,8,["username"])):O("",!0),!a(l)&&a(n).length===0?(d(),Z("div",ce,[r("p",ue,Q(a(s)==="saved"?"No saved Chartrs yet!":a(s)==="recent"?"No recently used Chartrs yet!":"Nothing here yet, go create a Chartr!"),1),m(k,{icon:"i-heroicons-plus",variant:"outline",onClick:e[3]||(e[3]=u=>("navigateTo"in t?t.navigateTo:a($))("/chartrs/new"))},{default:f(()=>[...e[6]||(e[6]=[V(" Create Chartr ",-1)])]),_:1})])):(d(),_(ae,{key:2,chartrs:a(n),"is-loading":a(l),onEndVisible:E},null,8,["chartrs","is-loading"]))]),_:1})}}};export{Ve as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.