import{_ as h}from"./state-editor-kisl1jyp.js";import{p as k,J as i,Y as t,F as $,ah as N,X as f,$ as a,a0 as B,a2 as w,a3 as d,q as b,aj as O,a4 as m,a1 as n,u as j,ad as F,ac as V}from"./vendor/json-editor-vue-ikjc812x.js";import{_ as E}from"./nsection-block-je23gs2w.js";import{b as G,f as P,_ as R}from"#entry";import{_ as A}from"./help-fab-chg6ox1v.js";import"./data-schema-button-hqryewml.js";import"./nicon-title-he6hzgyb.js";import"./vendor/shiki-hpfujfi3.js";import"./vendor/unocss-hczpatch.js";const H={key:0,flex:"~ col gap-1"},K={key:1,mt2:"",px4:"",italic:"",op35:""},T=k({__name:"StateGroup",props:{state:{},revision:{},prefix:{default:""}},setup(o){return(e,r)=>{const l=h;return t(),i("div",null,[o.state&&Object.keys(o.state).length>0?(t(),i("div",H,[(t(!0),i($,null,N(o.state,(u,s)=>(t(),f(l,{key:s,revision:o.revision,state:u,name:s.startsWith(o.prefix)?s.slice(o.prefix.length):s},{actions:a(c=>[B(e.$slots,"actions",w({ref_for:!0},c))]),_:3},8,["revision","state","name"]))),128))])):(t(),i("div",K," No data "))])}}}),q=Object.assign(T,{__name:"StateGroup"}),J={},L={class:"markdown-body"};function W(o,e){return t(),i("div",L,[...e[0]||(e[0]=[d("template",null,[d("div",{class:"markdown-body"},[d("h1",null,"State & Async Data"),d("p",null,"// TODO")])],-1)])])}const X=G(J,[["render",W]]),Y={key:0},at=k({__name:"payload",setup(o){const e=P(),r=b(()=>e.value?.nuxt.payload),l=b(()=>e.value?.revision.value);async function u(s){await e.value?.nuxt.hooks.callHookParallel("app:data:refresh",s)}return(s,c)=>{const v=q,p=E,x=R,S=h,g=X,D=A,C=O("tooltip");return t(),i($,null,[j(e)?(t(),i("div",Y,[n(p,{icon:"carbon-data-set",text:"State",description:"Keyed state from `useState`",padding:!1},{default:a(()=>[n(v,{state:r.value.state,revision:l.value,prefix:"$s"},null,8,["state","revision"])]),_:1}),n(p,{icon:"carbon-data-blob",text:"Data",description:"Keyed state from `useAsyncData`",padding:!1},{actions:a(()=>[n(x,{n:"xs primary","self-start":"",icon:"i-carbon-recycle",onClick:c[0]||(c[0]=y=>u())},{default:a(()=>[...c[1]||(c[1]=[V(" Re-fetch all data ",-1)])]),_:1})]),default:a(()=>[n(v,{state:r.value.data,revision:l.value},{actions:a(({isOpen:y,name:_})=>[y&&_?F((t(),f(x,{key:0,title:`Re-fetch '${_}'`,icon:"carbon-recycle",border:!1,onClick:z=>u([_])},null,8,["title","onClick"])),[[C,`Re-fetch '${_}'`,void 0,{bottom:!0}]]):m("",!0)]),_:1},8,["state","revision"])]),_:1}),r.value.functions&&Object.keys(r.value.functions).length?(t(),f(p,{key:0,icon:"carbon-function",text:"Functions",description:"State for functions"},{default:a(()=>[n(S,{"ml--6":"",state:r.value.functions,revision:l.value},null,8,["state","revision"])]),_:1})):m("",!0)])):m("",!0),n(D,null,{default:a(()=>[n(g)]),_:1})],64)}}});export{at as default};
