import{d as w,r as l,_,h as c,A as x,i as k,o as u,a9 as f,c as A,w as y,ao as b,u as e,f as E,t as V}from"./Bxv1kRJt.js";import{_ as B}from"./CDVN_Roy.js";import O from"./BYwhxvBR.js";import{_ as $}from"./CCy2CNr7.js";import{u as D}from"./DDOpIcVM.js";import"./DJ1-1-8O.js";import"./i2E1o2Cl.js";import"./06_OkG9_.js";import"./Dxmk8VbU.js";import"./Dwvp_P-r.js";import"./Fma_4dAm.js";import"./Dv7rEyVi.js";import"./XWxoP7r2.js";import"./Bf7bwUep.js";const F=b(B),N=b(O),U={"text-sm":"","font-mono":"","first-letter:capitalize":""},W=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}=D(),{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();c(n,o=>{m.value=o.data}),c(t,()=>{if(typeof t.data!="string")return;const o=`${r.value}:${t.data.replace("/",":")}`,{content:i}=a(o);c(i,async s=>{try{m.value=JSON.parse(s)}catch(p){console.log(p,s)}})})}const S=l(null),v=l("base");return c(t,()=>{}),(a,r)=>{const o=F,i=N,s=$;return u(),k("div",null,[f(i,{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",U,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{W as default};
