import{d as V,a0 as B,al as _,r as w,be as O,bE as C,a2 as $,o as i,m as p,k as u,G as c,f as t,t as J,p as l,aa as z,bo as D,bp as P,F as R,I as j,i as E,h as v,au as F,by as G,l as M,az as A,_ as I}from"./CCqMIw4K.js";import{_ as T}from"./DeIONhMO.js";import{N as U}from"./CCcSlQVK.js";const Y=["open"],q={flex:"~ gap2","select-none":"","items-center":"",px4:""},W=V({__name:"StateEditor",props:{name:{},open:{type:Boolean},state:{},readonly:{type:Boolean}},emits:["update:open"],setup(b,{emit:g}){const s=b,n=B(s,"open",g,{passive:!0}),k=_(),o=w(),m=O(s.name,"$9Gvv2FGyYa");s.state?o.value=JSON.parse(JSON.stringify(s.state)):(typeof s.state=="number"||typeof s.state!="string")&&(o.value=s.state);const d=C(o,e=>{typeof e!="number"&&typeof e!="string"?f(e,s.state):m.value=e},{deep:!0});function f(e,r){for(const a in e)e[a]===null?r[a]=null:Array.isArray(e[a])?r[a]=e[a].slice():typeof e[a]=="object"?f(e[a],r[a]):r[a]=e[a]}async function h(){d.pause(),o.value=JSON.parse(JSON.stringify(s.state)),await A(),d.resume()}return(e,r)=>{const a=I,N=T,S=$("tooltip");return i(),p("div",{class:"state-editor-details",open:e.name?t(n):!0},[u("div",q,[e.name?(i(),p("button",{key:0,flex:"~","cursor-pointer":"","items-center":"",class:c(t(n)?"":"op50"),onClick:r[0]||(r[0]=y=>n.value=!t(n))},[u("div",{"i-carbon-chevron-right":"",transition:"",class:c(t(n)?"rotate-90 op0":"")},null,2),u("code",{px3:"",py1:"","font-mono":"",class:c(t(n)?"bg-[#8881] rounded-t":"rounded hover:bg-active")},J(e.name),3)],2)):l("",!0),z(e.$slots,"actions",D(P({isOpen:t(n),name:e.name,state:t(m)}))),t(n)?(i(),p(R,{key:1},[j(E(a,{title:"Refresh View",icon:"carbon-renew",border:!1,onClick:h},null,512),[[S,"Refresh View",void 0,{bottom:!0}]]),t(o)?(i(),v(N,{key:0,getter:()=>({name:e.name,input:JSON.stringify(t(o))})},null,8,["getter"])):l("",!0)],64)):l("",!0)]),t(n)||!e.name?(i(),v(t(U),F({key:0,modelValue:t(o),"onUpdate:modelValue":r[1]||(r[1]=y=>M(o)?o.value=y:null)},e.$attrs,{class:["json-editor-vue",[t(k).value==="dark"?"jse-theme-dark":"",(e.name,"")]],"main-menu-bar":!1,"navigation-bar":!1,"status-bar":!1,"read-only":"readonly"in e?e.readonly:t(G),indentation:2,"tab-size":2}),null,16,["modelValue","class","read-only"])):l("",!0)],8,Y)}}});export{W as _};
