import{_ as b}from"./C-XkP9tB.js";import{d as C,N as k,v as m,e as P,o as j,a as r,b as o,w as a,s as w,m as n,n as c,t as S}from"./Dk4AzF7j.js";import{_ as T}from"./DXyvFCCy.js";import{u as x}from"./DRRSlvyf.js";import"./BOMWTB7S.js";import"./D7D5X_-3.js";const A={class:"container mx-auto p-8"},E={class:"space-y-6"},I={class:"space-y-4"},R={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},D={class:"mt-6"},L={class:"bg-gray-100 dark:bg-gray-800 p-4 rounded-lg"},N={class:"text-sm"},J=C({__name:"test-api-tracking",setup(B){const{kapi:u}=k(),s=m({project:!1,system:!1,location:!1,error:!1,multiple:!1,composable:!1}),l=m({}),f=async()=>{s.value.project=!0;try{const t=await(await u("Project")).getProjects({limit:5});l.value.project={success:!0,count:t?.projects?.length||0}}catch(e){l.value.project={success:!1,error:e instanceof Error?e.message:String(e)}}finally{s.value.project=!1}},g=async()=>{s.value.system=!0;try{const t=await(await u("System")).getSystems({limit:3});l.value.system={success:!0,count:t?.systems?.length||0}}catch(e){l.value.system={success:!1,error:e instanceof Error?e.message:String(e)}}finally{s.value.system=!1}},y=async()=>{s.value.location=!0;try{const t=await(await u("Location")).list();l.value.location={success:!0,count:t?.length||0}}catch(e){l.value.location={success:!1,error:e instanceof Error?e.message:String(e)}}finally{s.value.location=!1}},v=async()=>{s.value.error=!0;try{await(await u("Project")).getProject("invalid-id-that-should-fail"),l.value.error={success:!0,unexpected:!0}}catch(e){l.value.error={success:!1,error:e instanceof Error?e.message:String(e)}}finally{s.value.error=!1}},h=async()=>{s.value.multiple=!0;try{const e=[];for(let t=0;t<5;t++)e.push(u("Location").then(d=>d.list()));await Promise.all(e),l.value.multiple={success:!0,calls:5}}catch(e){l.value.multiple={success:!1,error:e instanceof Error?e.message:String(e)}}finally{s.value.multiple=!1}},_=async()=>{s.value.composable=!0;try{const{data:e}=await x();l.value.composable={success:!0,hasData:!!e}}catch(e){l.value.composable={success:!1,error:e instanceof Error?e.message:String(e)}}finally{s.value.composable=!1}};return(e,t)=>{const d=b,i=w,p=T;return j(),P("div",A,[r(d,{title:"API Tracking Test",description:"Test page to verify API call tracking functionality"}),o("div",E,[r(p,null,{header:a(()=>[...t[0]||(t[0]=[o("h2",{class:"text-lg font-semibold"}," Test API Calls ",-1)])]),default:a(()=>[o("div",I,[o("div",R,[r(i,{loading:n(s).project,color:"blue",onClick:f},{default:a(()=>[...t[1]||(t[1]=[c(" Test Project API ",-1)])]),_:1},8,["loading"]),r(i,{loading:n(s).system,color:"green",onClick:g},{default:a(()=>[...t[2]||(t[2]=[c(" Test System API ",-1)])]),_:1},8,["loading"]),r(i,{loading:n(s).location,color:"purple",onClick:y},{default:a(()=>[...t[3]||(t[3]=[c(" Test Location API ",-1)])]),_:1},8,["loading"]),r(i,{loading:n(s).error,color:"red",onClick:v},{default:a(()=>[...t[4]||(t[4]=[c(" Test Error Call ",-1)])]),_:1},8,["loading"]),r(i,{loading:n(s).multiple,color:"orange",onClick:h},{default:a(()=>[...t[5]||(t[5]=[c(" Test Multiple Calls ",-1)])]),_:1},8,["loading"]),r(i,{loading:n(s).composable,color:"cyan",onClick:_},{default:a(()=>[...t[6]||(t[6]=[c(" Test from Composable ",-1)])]),_:1},8,["loading"])]),o("div",D,[t[7]||(t[7]=o("h3",{class:"text-md font-medium mb-2"}," Results: ",-1)),o("div",L,[o("pre",N,S(JSON.stringify(n(l),null,2)),1)])])])]),_:1}),r(p,null,{header:a(()=>[...t[8]||(t[8]=[o("h2",{class:"text-lg font-semibold"}," Instructions ",-1)])]),default:a(()=>[t[9]||(t[9]=o("div",{class:"prose dark:prose-invert"},[o("p",null,' This page is designed to test the API call tracking functionality. Open the Debug Dock (⌘⌥D) and switch to the "API" tab to see tracked calls. '),o("ul",null,[o("li",null,"Click the buttons above to trigger different API calls"),o("li",null,"Check the API tab in the debug dock to see the tracked calls"),o("li",null,"Each call should show repository, method, timing, and source information"),o("li",null,"Error calls should show error messages"),o("li",null,"Multiple rapid calls should be deduplicated with a counter")])],-1))]),_:1})])])}}});export{J as default};
