import{B as e,C as t,H as n,L as r,N as i,O as a,_ as o,b as s,g as c,j as l,k as u,r as d,t as f,u as p,v as m,w as h,x as g}from"./_plugin-vue_export-helper-Cut4Z2wH.js";import{t as _}from"./JsonPanel-D8QacXqQ.js";var v={class:`view`},ee={key:0,class:`placeholder`},y={key:1,class:`placeholder`},b={key:2,class:`placeholder`},x={class:`error-text`},S={key:3,class:`content-area`},C={key:0,class:`empty-state`},w={key:1,class:`section`},T={class:`section-title`},E={class:`table-wrapper`},D={class:`data-table`},O=[`onClick`],k={class:`expand-cell`},A={class:`expand-icon`},j={class:`mono-cell id-cell`},M={class:`ts-cell`},N={class:`mono-cell`},P={class:`mono-cell`},F={key:0},I={key:1},L=[`title`],R={key:0,class:`detail-row`},te={colspan:6},z={class:`cp-detail`},B={class:`detail-grid`},V={class:`detail-item`},H=[`onClick`,`title`],U={key:0,class:`detail-item`},W={class:`detail-value mono`},G={key:1,class:`detail-item`},K={class:`detail-value mono`},q={key:2,class:`section`},J=f(h({__name:`CheckpointsView`,setup(f){let h=r(null),J=r(!1),Y=r(``),X=r(null);async function Z(){if(p.connected){J.value=!0,Y.value=``;try{h.value=await d(p.baseUrl)}catch(e){Y.value=e instanceof Error?e.message:`Failed to load checkpoints`}finally{J.value=!1}}}a(Z),i(()=>p.connected,e=>{e?Z():h.value=null});let Q=o(()=>h.value?.checkpoints||[]);function ne(e){X.value=X.value===e?null:e}function re(e){return!e||e.length<=16?e||`—`:e.slice(0,8)+`...`+e.slice(-8)}function ie(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}let $=r(``);async function ae(e){try{await navigator.clipboard.writeText(e),$.value=e,setTimeout(()=>{$.value=``},1500)}catch{}}return(r,i)=>(u(),g(`div`,v,[i[7]||=m(`div`,{class:`view-header`},[m(`h2`,null,`Checkpoints`),m(`span`,{class:`view-subtitle`},`/anip/checkpoints`)],-1),e(p).connected?J.value?(u(),g(`div`,y,[...i[1]||=[m(`div`,{class:`spinner`},null,-1),m(`p`,null,`Loading checkpoints...`,-1)]])):Y.value?(u(),g(`div`,b,[m(`p`,x,n(Y.value),1),m(`button`,{class:`retry-btn`,onClick:Z},`Retry`)])):h.value?(u(),g(`div`,S,[Q.value.length===0?(u(),g(`div`,C,[...i[2]||=[m(`p`,null,`No checkpoints yet. Checkpoints are created periodically based on the checkpoint policy.`,-1)]])):(u(),g(`section`,w,[m(`h3`,T,`Checkpoints (`+n(Q.value.length)+`)`,1),m(`div`,E,[m(`table`,D,[i[6]||=m(`thead`,null,[m(`tr`,null,[m(`th`),m(`th`,null,`ID`),m(`th`,null,`Timestamp`),m(`th`,null,`Entries`),m(`th`,null,`Range`),m(`th`,null,`Merkle Root`)])],-1),m(`tbody`,null,[(u(!0),g(c,null,l(Q.value,e=>(u(),g(c,{key:e.checkpoint_id},[m(`tr`,{class:`cp-row`,onClick:t=>ne(e.checkpoint_id)},[m(`td`,k,[m(`span`,A,n(X.value===e.checkpoint_id?`▼`:`▶`),1)]),m(`td`,j,n(e.checkpoint_id),1),m(`td`,M,n(ie(e.timestamp)),1),m(`td`,N,n(e.entry_count),1),m(`td`,P,[e.range?(u(),g(`span`,F,n(e.range.first_sequence)+` – `+n(e.range.last_sequence),1)):(u(),g(`span`,I,`—`))]),m(`td`,{class:`hash-cell`,title:e.merkle_root},n(re(e.merkle_root)),9,L)],8,O),X.value===e.checkpoint_id?(u(),g(`tr`,R,[m(`td`,te,[m(`div`,z,[m(`div`,B,[m(`div`,V,[i[3]||=m(`span`,{class:`detail-label`},`Merkle Root`,-1),m(`span`,{class:`detail-value mono`,onClick:t=>ae(e.merkle_root),title:$.value===e.merkle_root?`Copied!`:`Click to copy`},n(e.merkle_root),9,H)]),e.previous_checkpoint?(u(),g(`div`,U,[i[4]||=m(`span`,{class:`detail-label`},`Previous Checkpoint`,-1),m(`span`,W,n(e.previous_checkpoint),1)])):s(``,!0),e.range?(u(),g(`div`,G,[i[5]||=m(`span`,{class:`detail-label`},`Range`,-1),m(`span`,K,n(e.range.first_sequence)+` – `+n(e.range.last_sequence),1)])):s(``,!0)]),t(_,{data:e,title:`Full Checkpoint`,collapsed:!1},null,8,[`data`])])])])):s(``,!0)],64))),128))])])])])),Q.value.length>0?(u(),g(`section`,q,[t(_,{data:h.value,title:`Raw Response`,collapsed:!0},null,8,[`data`])])):s(``,!0)])):s(``,!0):(u(),g(`div`,ee,[...i[0]||=[m(`div`,{class:`placeholder-icon`},`✓`,-1),m(`p`,null,`Connect to an ANIP service to view its checkpoint history.`,-1)]]))]))}}),[[`__scopeId`,`data-v-b04f6f9c`]]);export{J as default};