import{I as x}from"./parser-DaoUb5SB.js";import{P as k}from"./index-BT0jOPXg.js";import{c as _}from"./api-D2oYCc9G.js";import{u as b}from"./widget-jbnupkVY.js";import{M as h,$ as P,o as B,q as n}from"./app-QjDgb7aF.js";import{b as M,p as S,k as T,i as v,u as i,j as C,J as D,D as N}from"./vue-Cm77DuTi.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const $={class:"mkw-button"},p="button",U=M({__name:"button",props:{widget:{}},emits:["updateProps"],setup(c,{expose:l,emit:u}){const m={label:{type:"string",default:"BUTTON"},colored:{type:"boolean",default:!0},script:{type:"string",multiline:!0,default:'Mk:dialog("hello" "world")'}},e=c,d=u,{widgetProps:r,configure:f}=b(p,m,e,d),g=new k,y=async()=>{const a=new x(_({storageKey:"widget",token:P?.token}),{in:t=>new Promise(s=>{B({title:t}).then(({canceled:E,result:w})=>{s(w)})}),out:t=>{},log:(t,s)=>{}});let o;try{o=g.parse(r.script)}catch(t){n({type:"error",text:`Syntax error: ${t}`});return}try{await a.exec(o)}catch(t){n({type:"error",text:String(t)})}};return l({name:p,configure:f,id:e.widget?e.widget.id:null}),(a,o)=>(C(),S("div",$,[T(h,{primary:i(r).colored,full:"",onClick:y},{default:v(()=>[D(N(i(r).label),1)]),_:1},8,["primary"])]))}});export{U as default};
//# sourceMappingURL=button-DNGQbH6M.js.map
