import{_ as h}from"./state-editor.vue-nmdekqgv.js";import{k as x,Q as e,S as i,F as $,ab as N,O as d,$ as a,V as B,a1 as O,U as k,l as b,af as V,u as w,a0 as o,W as p,a6 as F,a8 as E}from"./vendor/json-editor-vue-mdfcgt41.js";import{_ as P}from"./nsection-block-dyz9ib8t.js";import{Q as R,e as j}from"./ixdlms3l.js";import{_ as A}from"./help-fab.vue-lsyamqmo.js";import"./nicon-title.vue-g9trlv29.js";import"./vendor/unocss-mnpxkox6.js";import"./vendor/shiki-fpe2sz4h.js";const G={key:0,flex:"~ col gap-1"},H={key:1,mt2:"",px4:"",italic:"",op35:""},K=x({__name:"StateGroup",props:{state:{},revision:{},prefix:{default:""}},setup(f){return(t,n)=>{const c=h;return e(),i("div",null,[t.state&&Object.keys(t.state).length>0?(e(),i("div",G,[(e(!0),i($,null,N(t.state,(s,r)=>(e(),d(c,{key:r,revision:t.revision,state:s,name:r.startsWith(t.prefix)?r.slice(t.prefix.length):r},{actions:a(l=>[B(t.$slots,"actions",O({ref_for:!0},l))]),_:2},1032,["revision","state","name"]))),128))])):(e(),i("div",H," No data "))])}}}),Q={class:"markdown-body"},T={__name:"payload",setup(f,{expose:t}){return t({frontmatter:{}}),(c,s)=>(e(),i("div",Q,s[0]||(s[0]=[k("h1",null,"State & Async Data",-1),k("p",null,"// TODO",-1)])))}},W=T,L={key:0},tt=x({__name:"payload",setup(f){const t=R(),n=b(()=>t.value?.nuxt.payload),c=b(()=>t.value?.revision.value);async function s(r){await t.value?.nuxt.hooks.callHookParallel("app:data:refresh",r)}return(r,l)=>{const m=K,_=P,v=j,S=h,g=W,D=A,C=V("tooltip");return e(),i($,null,[w(t)?(e(),i("div",L,[o(_,{icon:"carbon-data-set",text:"State",description:"Keyed state from `useState`",padding:!1},{default:a(()=>[o(m,{state:n.value.state,revision:c.value,prefix:"$s"},null,8,["state","revision"])]),_:1}),o(_,{icon:"carbon-data-blob",text:"Data",description:"Keyed state from `useAsyncData`",padding:!1},{actions:a(()=>[o(v,{n:"xs primary","self-start":"",icon:"i-carbon-recycle",onClick:l[0]||(l[0]=y=>s())},{default:a(()=>l[1]||(l[1]=[F(" Re-fetch all data ")])),_:1})]),default:a(()=>[o(m,{state:n.value.data,revision:c.value},{actions:a(({isOpen:y,name:u})=>[y&&u?E((e(),d(v,{key:0,title:`Re-fetch '${u}'`,icon:"carbon-recycle",border:!1,onClick:U=>s([u])},null,8,["title","onClick"])),[[C,`Re-fetch '${u}'`,void 0,{bottom:!0}]]):p("",!0)]),_:1},8,["state","revision"])]),_:1}),n.value.functions&&Object.keys(n.value.functions).length?(e(),d(_,{key:0,icon:"carbon-function",text:"Functions",description:"State for functions"},{default:a(()=>[o(S,{"ml--6":"",state:n.value.functions,revision:c.value},null,8,["state","revision"])]),_:1})):p("",!0)])):p("",!0),o(D,null,{default:a(()=>[o(g)]),_:1})],64)}}});export{tt as default};
