k5web/assets/index.9dd3f9b0.js
2024-05-13 00:19:18 +08:00

33 lines
14 KiB
JavaScript

import{G as E,M as B,c as Y,w as Q,h as it,Y as st,_ as lt}from"./index.aa4cef55.js";/* empty css *//* empty css *//* empty css */import{d as I,c as w,o as ut,b as pt,f as ft,t as dt,p as mt,r as Z,aI as g,aU as tt,i as gt,bD as bt,bO as yt,C as A,D as R,aH as y,aK as vt,aJ as Ot,aE as _t,G as M,u as z,aM as L,aN as T,bE as ht,bJ as jt,a$ as wt,ba as Pt,be as Ct,bf as St}from"./arco.76776ef0.js";import{e as xt,b as Dt,g as Et}from"./serial.c741fbda.js";import{u as et,r as nt,_ as at}from"./dep-281dbb92.526b06bd.js";import{B as Nt}from"./index.3a9d9ed5.js";import{_ as v,u as ot}from"./useConfig.93c19403.js";import{i as $,h as It}from"./index.23e71fba.js";import{d as N,i as V}from"./index.ee7dcbab.js";import{C as $t}from"./index.5e61a6e4.js";import"./chart.ce50b7a1.js";import"./vue.5cc47a17.js";import"./useDisabled.103ae1d5.js";function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,a)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?U(Object(n),!0).forEach(function(a){at(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}var kt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M17.66 7.17l-5.3 5.3-1.42-1.41 5.3-5.3 1.42 1.41zm5.65 0l-10.6 10.6-6.37-6.36L7.76 10l4.95 4.95 9.19-9.2 1.41 1.42zM2.11 10l4.94 4.95.35-.35L8.82 16l-1.77 1.77L.69 11.4 2.1 10z"}}]},At=I({name:"CheckDoubleIcon",props:{size:{type:String},onClick:{type:Function}},setup(e,t){var{attrs:n}=t,a=w(()=>e.size),{className:i,style:f}=et(a),c=w(()=>["t-icon","t-icon-check-double",i.value]),o=w(()=>G(G({},f.value),n.style)),s=w(()=>({class:c.value,style:o.value,onClick:u=>{var r;return(r=e.onClick)===null||r===void 0?void 0:r.call(e,{e:u})}}));return()=>nt(kt,s.value)}});const Ft=At;function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,a)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(a){at(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}var Bt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.88 1.38l1.28.22a4 4 0 013.34 3.94V8h5.32a2 2 0 011.97 2.33l-1.66 10A2 2 0 0119.15 22H7V10.8l3.88-9.42zm1.23 2.26L9 11.2V20h10.15l1.67-10H13.5V5.54a2 2 0 00-1.39-1.9zM4 10v12H2V10h2z"}}]},Mt=I({name:"ThumbUpIcon",props:{size:{type:String},onClick:{type:Function}},setup(e,t){var{attrs:n}=t,a=w(()=>e.size),{className:i,style:f}=et(a),c=w(()=>["t-icon","t-icon-thumb-up",i.value]),o=w(()=>H(H({},f.value),n.style)),s=w(()=>({class:c.value,style:o.value,onClick:u=>{var r;return(r=e.onClick)===null||r===void 0?void 0:r.call(e,{e:u})}}));return()=>nt(Bt,s.value)}});const Rt=Mt;/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/var zt={align:{type:String,default:"top",validator:function(t){return t?["start","end","center","stretch","baseline","top","middle","bottom"].includes(t):!0}},gutter:{type:[Number,Object,Array],default:0},justify:{type:String,default:"start",validator:function(t){return t?["start","end","center","space-around","space-between"].includes(t):!0}},tag:{type:String,default:"div"}};/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/var J=function(t){var n="xs";return t<768?n="xs":t>=768&&t<992?n="sm":t>=992&&t<1200?n="md":t>=1200&&t<1400?n="lg":t>=1400&&t<1880?n="xl":n="xxl",n};/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/function Lt(e,t){ut(function(){window.addEventListener(e,t)}),pt(function(){window.removeEventListener(e,t)})}/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,a)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?X(Object(n),!0).forEach(function(a){v(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function rt(){var e=ft(J(V?0:window.innerWidth)),t=function(){e.value=J(V?0:window.innerWidth)};return Lt("resize",t),e}function Tt(e,t){var n=t.justify,a=t.align;return[e,v(v({},"".concat(e,"--").concat(n),n),"".concat(e,"--align-").concat(a),a)]}function Vt(e,t){var n={},a=function(o){return Object.assign(n,{marginLeft:"".concat(o/-2,"px"),marginRight:"".concat(o/-2,"px")})},i=function(o){return Object.assign(n,{rowGap:"".concat(o,"px")})},f={isNumber:function(o){N(o)&&a(o)},isArray:function(o){B(o)&&o.length&&(f.isNumber(o[0]),N(o[1])&&i(o[1]),E(o[0])&&!$(o[0][t])&&a(o[0][t]),E(o[1])&&!$(o[1][t])&&i(o[1][t]))},isObject:function(o){E(o)&&o[t]&&(B(o)&&o.length?(a(o[t][0]),i(o[t][1])):a(o[t]))}};return Object.keys(f).forEach(function(c){f[c](e)}),n}function Ut(e){return N(e)?"".concat(e," ").concat(e," 0"):/^\d+(\.\d+)?(px|r?em|%)$/.test(e)?"0 0 ".concat(e):e}function Gt(e,t){var n={},a=function(c){return Object.assign(n,{paddingLeft:"".concat(c/2,"px"),paddingRight:"".concat(c/2,"px")})},i={isNumber:function(c){N(c)&&a(c)},isArray:function(c){B(c)&&c.length&&(N(c[0])&&a(c[0]),E(c[0])&&c[0][t]&&a(c[0][t]))},isObject:function(c){E(c)&&c[t]&&a(c[t])}};return Object.keys(i).forEach(function(f){i[f](e)}),n}function Kt(e,t){var n=t.span,a=t.order,i=t.offset,f=t.push,c=t.pull,o=["xs","sm","md","lg","xl","xxl"],s=o.reduce(function(u,r){var d=t[r],l={};return N(d)?l.span=d:E(d)&&(l=d||{}),F(F({},u),{},v(v(v(v(v({},"".concat(e,"-").concat(r,"-").concat(l.span),!$(l.span)),"".concat(e,"-").concat(r,"-order-").concat(l.order),parseInt(l.order,10)>=0),"".concat(e,"-").concat(r,"-offset-").concat(l.offset),parseInt(l.offset,10)>=0),"".concat(e,"-").concat(r,"-push-").concat(l.push),parseInt(l.push,10)>=0),"".concat(e,"-").concat(r,"-pull-").concat(l.pull),parseInt(l.pull,10)>=0))},{});return F(v(v(v(v(v(v({},"".concat(e),!0),"".concat(e,"-").concat(n),!$(n)),"".concat(e,"-order-").concat(a),a),"".concat(e,"-offset-").concat(i),i),"".concat(e,"-push-").concat(f),f),"".concat(e,"-pull-").concat(c),c),s)}/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,a)}return n}function Ht(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q(Object(n),!0).forEach(function(a){v(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function Jt(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!tt(e)}var Xt=I({name:"TRow",props:Ht({},zt),setup:function(t){var n=dt(t),a=n.gutter,i=Y();mt("rowContext",Z({gutter:a}));var f=rt(),c=ot("row"),o=w(function(){return Tt(c.value,t)}),s=w(function(){return Vt(t.gutter,f.value)});return function(){var u,r=t.tag;return g(r,{class:o.value,style:s.value},Jt(u=i("default"))?u:{default:function(){return[u]}})}}});/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/var qt={flex:{type:[String,Number]},lg:{type:[Number,Object]},md:{type:[Number,Object]},offset:{type:Number,default:0},order:{type:Number,default:0},pull:{type:Number,default:0},push:{type:Number,default:0},sm:{type:[Number,Object]},span:{type:Number},tag:{type:String,default:"div"},xl:{type:[Number,Object]},xs:{type:[Number,Object]},xxl:{type:[Number,Object]}};/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,a)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?W(Object(n),!0).forEach(function(a){v(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function Yt(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!tt(e)}var Qt=I({name:"TCol",inject:["rowContext"],props:Wt({},qt),setup:function(t){var n=ot("col"),a=Y(),i=gt("rowContext",Object.create(null)),f=rt(),c=w(function(){return Kt(n.value,t)}),o=w(function(){var s={},u=t.flex;if(u&&(s.flex=Ut(u)),i){var r=i.gutter;Object.assign(s,Gt(r,f.value))}return s});return function(){var s,u=t.tag;return g(u,{class:c.value,style:o.value},Yt(s=a("default"))?s:{default:function(){return[s]}})}}});/**
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
*/var Zt=Q(Xt),te=Q(Qt);const ct=e=>(Ct("data-v-90e5a732"),e=e(),St(),e),ee={class:"container"},ne=["title","src"],ae=ct(()=>M("div",{id:"canvasDiv",style:{zoom:"250%"}},null,-1)),oe=ct(()=>M("br",null,null,-1)),re={name:"Backup"},ce=I({...re,setup(e){const t=it(),n=Z({binaryFile:void 0,loading:!1}),a=o=>{alert("\u56FE\u7247\u5DE5\u574A\u5373\u5C06\u63A8\u51FA")},i=o=>{const s=document.createElement("canvas");s.width=128,s.height=64;const u=s.cloneNode(),r=document.getElementById("canvasDiv");r.innerHTML="",r==null||r.append(s,u);const d=new Image;d.src=o.url,d.onload=()=>{const l=s.getContext("2d");l==null||l.drawImage(d,0,0,128,64);const j=l==null?void 0:l.getImageData(0,0,s.width,s.height).data;function b(O,_){const p=(_*128+O)*4;return j[p]+j[p+1]+j[p+2]>128*3?0:1}const C=u.getContext("2d"),P=C.getImageData(0,0,u.width,u.height);for(let O=0;O<64;O++)for(let _=0;_<128;_++){const p=(O*128+_)*4,D=!b(_,O);P.data[p]=D*255,P.data[p+1]=D*255,P.data[p+2]=D*255,P.data[p+3]=255}C.putImageData(P,0,0);const x=new Uint8Array(1024);let S=0;for(let O=0;O<64;O+=8)for(let _=0;_<128;_++){let m=0;for(let p=0;p<8;p++)m|=b(_,O+p)<<p;x[S++]=m}n.binaryFile=x}},f=()=>{const o=document.createElement("input");o.type="file",o.onchange=async()=>{const s=new Blob([o.files[0]],{type:"application/octet-stream"}),u=URL.createObjectURL(s),r=document.createElement("canvas");r.width=128,r.height=64;const d=r.cloneNode(),l=document.getElementById("canvasDiv");l.innerHTML="",l==null||l.append(r,d);const j=new Image;j.src=u,j.onload=()=>{const b=r.getContext("2d");b==null||b.drawImage(j,0,0,128,64);const C=b==null?void 0:b.getImageData(0,0,r.width,r.height).data;function P(m,p){const h=(p*128+m)*4;return C[h]+C[h+1]+C[h+2]>128*3?0:1}const x=d.getContext("2d"),S=x.getImageData(0,0,d.width,d.height);for(let m=0;m<64;m++)for(let p=0;p<128;p++){const h=(m*128+p)*4,k=!P(p,m);S.data[h]=k*255,S.data[h+1]=k*255,S.data[h+2]=k*255,S.data[h+3]=255}x.putImageData(S,0,0);const O=new Uint8Array(1024);let _=0;for(let m=0;m<64;m+=8)for(let p=0;p<128;p++){let D=0;for(let h=0;h<8;h++)D|=P(p,m+h)<<h;O[_++]=D}n.binaryFile=O}},o.click()},c=async()=>{var u,r,d,l,j;if(t.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}if(((u=t.configuration)==null?void 0:u.uart)=="official"){alert(sessionStorage.getItem("noticeVersionNoSupport"));return}if(((r=t.configuration)==null?void 0:r.charset)!="losehu"&&((d=t.configuration)==null?void 0:d.charset)!="gb2312"){alert(sessionStorage.getItem("noticeVersionNoSupport"));return}n.loading=!0;let o=123728;((l=t.configuration)==null?void 0:l.charset)=="gb2312"&&(o=8320),await xt(t.connectPort);const s=n.binaryFile;for(let b=o;b<s.length+o;b+=128)await Dt(t.connectPort,b,s.slice(b-o,b-o+128),128,(j=t.configuration)==null?void 0:j.uart);await Et(t.connectPort),n.loading=!1};return(o,s)=>{const u=st,r=Nt,d=te,l=Zt,j=$t,b=ht,C=jt,P=It,x=wt,S=Pt,O=bt,_=yt;return A(),R("div",ee,[g(u,{items:[o.$t("menu.list"),o.$t("menu.image")]},null,8,["items"]),g(C,{gutter:20,align:"stretch"},{default:y(()=>[g(b,{span:24},{default:y(()=>[g(_,{loading:n.loading,tip:"\u5199\u5165\u4E2D...",style:{width:"100%"}},{default:y(()=>[g(O,{class:"general-card",title:o.$t("menu.image")+o.$t("global.onStart")},{default:y(()=>[g(C,{gutter:20},{default:y(()=>[(A(!0),R(vt,null,Ot([{name:"\u7F57\u72EE\u864E",url:"/img1.png"},{name:"\u79BB\u7EBF\u5C0F\u6050\u9F99",url:"/img2.png"},{name:"\u4E0D\u5FD8\u521D\u5FC3\u7262\u8BB0\u4F7F\u547D",url:"/img3.png"},{name:"\u4E3A\u4EBA\u6C11\u670D\u52A1",url:"/img4.png"},{name:"\u4E25\u7981\u6536\u542C\u654C\u53F0\u5E7F\u64AD",url:"/img5.png"},{name:"\u7231\u56E0\u65AF\u5766",url:"/img6.png"}],m=>(A(),_t(b,{span:4},{default:y(()=>[g(j,{style:{width:"100%"}},{cover:y(()=>[M("img",{title:m.name,src:m.url},null,8,ne)]),footer:y(()=>[g(l,{align:"middle",justify:"center",style:{gap:"24px"}},{default:y(()=>[g(d,{flex:"auto",style:{display:"inline-flex","justify-content":"center"}},{default:y(()=>[g(r,{variant:"text",shape:"square",onClick:p=>a(m)},{default:y(()=>[g(z(Rt))]),_:2},1032,["onClick"])]),_:2},1024),g(d,{flex:"auto",style:{display:"inline-flex","justify-content":"center"}},{default:y(()=>[g(r,{variant:"text",shape:"square",onClick:p=>i(m)},{default:y(()=>[g(z(Ft))]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),256))]),_:1}),g(P,{style:{margin:"10px"},total:6,showPageNumber:"",showPageSize:!1}),ae,oe,g(S,null,{default:y(()=>[g(x,{onClick:f},{default:y(()=>[L(T(o.$t("tool.selectImage")),1)]),_:1}),g(x,{type:"primary",disabled:!n.binaryFile,onClick:c},{default:y(()=>[L(T(o.$t("tool.write")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["title"])]),_:1},8,["loading"])]),_:1})]),_:1})])}}});const je=lt(ce,[["__scopeId","data-v-90e5a732"]]);export{je as default};