var l=(f,g,u)=>new Promise((c,o)=>{var _=e=>{try{i(u.next(e))}catch(a){o(a)}},m=e=>{try{i(u.throw(e))}catch(a){o(a)}},i=e=>e.done?c(e.value):Promise.resolve(e.value).then(_,m);i((u=u.apply(f,g)).next())});import{M as D}from"./EditorWorker-ce739c1a.js";import"./editorWorker-a0599278.js";import{b as O,d as k,j as N,aQ as w,aR as b,S as T,r as s,o as y,c as V,f as n,w as t,p as I,u as p,E as A,Q as J,g as d}from"./index-67a30bc6.js";import{g as R}from"./storage-30a128e3.js";import{i as L}from"./icon-99a136c4.js";const M={class:"go-edit"},P=d("\u9875\u9762\u5728\u7EBF\u7F16\u8F91\u5668"),j=d(" \u5BFC\u5165 "),G=d(" \u300C\u9875\u9762\u5931\u7126\u4FDD\u5B58\u300D "),H=d(" \u300Cctrl + s \u4FDD\u5B58\u300D "),K=k({__name:"index",setup(f){const{ChevronBackOutlineIcon:g,DownloadIcon:u}=L.ionicons5,c=window.showOpenFilePicker,o=N("");function _(){return l(this,null,function*(){const e=yield R();o.value=JSON.stringify(e,void 0,2)})}setTimeout(_);function m(){return l(this,null,function*(){const a=yield(yield c())[0].getFile(),r=new FileReader;r.readAsText(a),r.onloadend=()=>{o.value=(r.result||"").toString()}})}window.opener.addEventListener(w.CHART,e=>{b(T.GO_CHART_STORAGE_LIST,[e.detail]),o.value=JSON.stringify(e.detail,void 0,2)}),document.addEventListener("keydown",function(e){e.keyCode==83&&(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i())}),addEventListener("blur",i);function i(){return l(this,null,function*(){if(!window.opener)return window.$message.error("\u6E90\u7A97\u53E3\u5DF2\u5173\u95ED\uFF0C\u89C6\u56FE\u540C\u6B65\u5931\u8D25");try{const e=JSON.parse(o.value);delete e.id,window.opener.dispatchEvent(new CustomEvent(w.JSON,{detail:e}))}catch(e){window.$message.error("\u5185\u5BB9\u683C\u5F0F\u6709\u8BEF"),console.log(e)}})}return(e,a)=>{const r=s("n-text"),S=s("n-icon"),C=s("n-button"),v=s("n-tag"),E=s("n-space"),F=s("n-layout-header"),h=s("n-layout-content"),x=s("n-layout");return y(),V("div",M,[n(x,null,{default:t(()=>[n(F,{class:"go-edit-header go-px-5 go-flex-items-center",bordered:""},{default:t(()=>[I("div",null,[n(r,{class:"go-edit-title go-mr-4"},{default:t(()=>[P]),_:1}),p(c)?(y(),A(C,{key:0,class:"go-mr-3",size:"medium",onClick:m},{icon:t(()=>[n(S,null,{default:t(()=>[n(p(u))]),_:1})]),default:t(()=>[j]),_:1})):J("",!0)]),n(E,null,{default:t(()=>[n(v,{bordered:!1,type:"warning"},{default:t(()=>[G]),_:1}),n(v,{bordered:!1,type:"warning"},{default:t(()=>[H]),_:1})]),_:1})]),_:1}),n(h,null,{default:t(()=>[n(p(D),{modelValue:o.value,"onUpdate:modelValue":a[0]||(a[0]=B=>o.value=B),language:"json",editorOptions:{lineNumbers:"on",minimap:{enabled:!0}}},null,8,["modelValue"])]),_:1})]),_:1})])}}});var X=O(K,[["__scopeId","data-v-ae219e10"]]);export{X as default};
