import{d as w,r as l,_,h as i,A as x,i as k,o as u,aj as f,c as A,w as y,au as b,u as e,f as E,t as V}from"./Dih1Xbo1.js";import{_ as B}from"./PX4grvR7.js";import O from"./CbJYNGU8.js";import{_ as $}from"./i8vlw7Lc.js";import{u as j}from"./DSufQG8x.js";import"./Bh0_f5g3.js";import"./DoX2iuhV.js";import"./A_4S9xP3.js";import"./DXKf4i4_.js";import"./DuwiEx1X.js";import"./BLTKKlVT.js";import"./BDn_2gCt.js";import"./CzKwzGAK.js";import"./DPsH4b_L.js";import"./Bf7bwUep.js";const D=b(B),F=b(O),N={"text-sm":"","font-mono":"","first-letter:capitalize":""},X=w({__name:"ChartEditor",props:{contentRef:{type:[String,Object,Function]},view:{},getPos:{type:Function},setAttrs:{type:Function},node:{},selected:{},decorations:{},innerDecorations:{}},setup(g){const C=g,d=["bar","line","pie","donut"],{getComponentProps:h}=j(),{model:t,mdcAttrs:n}=h(C,{id:{type:String},class:{type:String,default:""},type:{type:String,default:"bar",validator(a){return d.includes(a)}},data:{type:[String,Array,Object]},labels:{type:Array}}),m=l();if(typeof _<"u"){const{editItem:a}=_(),{currentContentKeys:r}=x();i(n,o=>{m.value=o.data}),i(t,()=>{if(typeof t.data!="string")return;const o=`${r.value}:${t.data.replace("/",":")}`,{content:c}=a(o);i(c,async s=>{try{m.value=JSON.parse(s)}catch(p){console.log(p,s)}})})}const S=l(null),v=l("base");return i(t,()=>{}),(a,r)=>{const o=D,c=F,s=$;return u(),k("div",null,[f(c,{mb1:""},{default:y(()=>[f(o,{modelValue:e(n).type,"onUpdate:modelValue":r[0]||(r[0]=p=>e(n).type=p),chevron:"",tooltip:"Type",items:d},{default:y(()=>[E("span",N,V(e(n).type),1)]),_:1},8,["modelValue"])]),_:1}),(u(),A(s,{ref_key:"chart",ref:S,key:v.value,contenteditable:"false",type:e(t).type,data:e(t).data,labels:e(t).labels},null,8,["type","data","labels"]))])}}});export{X as default};
