import{e as S,q as I,_ as M}from"./index.fc1ffc8e.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as R,r as P,bU as V,bV as H,bC as U,C as O,D as L,aI as t,aH as e,aM as l,bw as K,bx as z,G as N,aZ as j,b8 as q,bW as G,b5 as W,bX as X,bA as Z,bD as J,bM as Q,n as B}from"./arco.4738edf2.js";import{m as Y,e as D,a as $,b as tt,g as et}from"./serial.a589823e.js";import"./chart.a6be8b1c.js";import"./vue.202e581b.js";const ut={class:"container"},at=["innerHTML"],ot={name:"Backup"},nt=R({...ot,setup(ct){const n=S(),o=P({status:"\u70B9\u51FB\u5907\u4EFD\u6309\u94AE\u5C06\u751F\u6210 EEPROM \u5907\u4EFD\u6587\u4EF6
",eepromType:"",showHide:0,startInfo:"0x00"}),y=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await Y()},m=async(u,a,d=new Date+"_backup.bin")=>{var F;await D(n.connectPort);let c=new Uint8Array(a-u);for(let r=u;r",B(()=>{const _=document==null?void 0:document.getElementById("statusArea");_&&(_.scrollTop=_==null?void 0:_.scrollHeight)})}o.status=o.status+"\u5907\u4EFD\u8FDB\u5EA6\uFF1A100.0%
",B(()=>{const r=document==null?void 0:document.getElementById("statusArea");r&&(r.scrollTop=r==null?void 0:r.scrollHeight)}),console.log(c);const p=new Blob([c],{type:"application/octet-stream"}),i=URL.createObjectURL(p),s=document.createElement("a");s.href=i,s.download=d,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)},f=async(u=0)=>{await D(n.connectPort);const a=document.createElement("input");a.type="file",a.onchange=async()=>{var p;const d=new Blob([a.files[0]],{type:"application/octet-stream"}),c=new Uint8Array(await d.arrayBuffer());for(let i=u;i",B(()=>{const s=document==null?void 0:document.getElementById("statusArea");s&&(s.scrollTop=s==null?void 0:s.scrollHeight)});o.status=o.status+"\u6062\u590D\u8FDB\u5EA6\uFF1A100.0%
",await et(n.connectPort)},a.click()},w=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await m(0,7680,"config.bin")},k=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await m(7680,8192,"calibration.bin")},A=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await f()},C=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await f(7680)},g=async()=>{var a;if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}let u=8192;switch(o.eepromType){case"1":u=8192;break;case"2":u=131072;break;case"3":u=262144;break;case"4":u=524288;break;default:u=8192}if(((a=n.configuration)==null?void 0:a.uart)=="official"&&u>=131072){alert("\u8BE5\u56FA\u4EF6\u4E0D\u652F\u6301\u5907\u4EFD\u6269\u5BB9\u7A7A\u95F4");return}await m(0,u)},h=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await f(parseInt(o.startInfo))};return(u,a)=>{const d=I,c=j,p=q,i=G,s=W,F=X,r=V,b=H,_=Z,v=U,x=J,T=Q;return O(),L("div",ut,[t(d,{items:["\u5C0F\u5DE5\u5177","\u5907\u4EFD/\u8FD8\u539F"]}),t(T,{gutter:20,align:"stretch"},{default:e(()=>[t(x,{span:24},{default:e(()=>[t(v,{class:"general-card",title:"\u5907\u4EFD/\u8FD8\u539F",onClick:a[2]||(a[2]=()=>{o.showHide+=1})},{default:e(()=>[t(b,{"default-active-key":"1"},{default:e(()=>[t(i,{key:"1",title:"\u5FEB\u6377\u5907\u4EFD"},{default:e(()=>[t(p,null,{default:e(()=>[t(c,{type:"primary",onClick:w},{default:e(()=>[l("\u5907\u4EFD\u914D\u7F6E")]),_:1}),t(c,{onClick:A},{default:e(()=>[l("\u6062\u590D\u914D\u7F6E")]),_:1}),t(c,{type:"primary",onClick:k},{default:e(()=>[l("\u5907\u4EFD\u6821\u51C6")]),_:1}),t(c,{onClick:C},{default:e(()=>[l("\u6062\u590D\u6821\u51C6")]),_:1})]),_:1})]),_:1}),t(i,{key:"2",title:"\u5B8C\u6574\u5907\u4EFD"},{default:e(()=>[t(p,null,{default:e(()=>[t(c,{type:"primary",onClick:g},{default:e(()=>[l("\u5907\u4EFD")]),_:1}),K(t(s,{modelValue:o.startInfo,"onUpdate:modelValue":a[0]||(a[0]=E=>o.startInfo=E)},null,8,["modelValue"]),[[z,o.showHide>=5]]),t(c,{onClick:h},{default:e(()=>[l("\u6062\u590D")]),_:1}),t(r,{modelValue:o.eepromType,"onUpdate:modelValue":a[1]||(a[1]=E=>o.eepromType=E),style:{width:"320px"},placeholder:"\u9009\u62E9EEPROM\u5927\u5C0F"},{default:e(()=>[t(F,{value:"1"},{default:e(()=>[l("8KB\uFF0864Kbit\uFF09")]),_:1}),t(F,{value:"2"},{default:e(()=>[l("128KB\uFF081Mbit\uFF09")]),_:1}),t(F,{value:"3"},{default:e(()=>[l("256KB\uFF082Mbit\uFF09")]),_:1}),t(F,{value:"4"},{default:e(()=>[l("512KB\uFF084Mbit\uFF09")]),_:1})]),_:1},8,["modelValue"]),t(c,{type:"text",onClick:y},{default:e(()=>[l("\u81EA\u52A8\u68C0\u6D4B")]),_:1})]),_:1})]),_:1})]),_:1}),t(_),N("div",{id:"statusArea",style:{height:"20em","background-color":"azure",color:"silver",overflow:"auto",padding:"20px"},innerHTML:o.status},null,8,at)]),_:1})]),_:1})]),_:1})])}}});const yt=M(nt,[["__scopeId","data-v-76383a0f"]]);export{yt as default};