import{s as o,e as i}from"./index-M_JNBppB.js";const m=17,s=91,l=86,d=67,y=88,K=89,k=90,C=71,w=66,v=76,h=85,S=83,D=80,b=68,u=46,L=69,F=[66,67,68,69,71,76,80,83,85,86,88,89,90],f={[l]:g,[K]:E,[k]:G,[S]:z,[D]:O,[L]:j},a={...f,[h]:A},r={...f,[d]:$,[y]:x,[C]:I,[w]:M,[b]:p,[u]:p,[v]:q};let c=!1;function H(){window.onkeydown=e=>{if(!o.state.isInEdiotr)return;const{curComponent:n}=o.state,{keyCode:t}=e;t===m||t===s?c=!0:t==u&&n?(o.commit("deleteComponent"),o.commit("recordSnapshot")):c&&(r[t]&&(!n||!n.isLock)?(e.preventDefault(),r[t]()):a[t]&&n&&n.isLock&&(e.preventDefault(),a[t]()))},window.onkeyup=e=>{(e.keyCode===m||e.keyCode===s)&&(c=!1)},window.onmousedown=()=>{o.commit("setInEditorStatus",!1)}}function $(){o.commit("copy")}function g(){o.commit("paste"),o.commit("recordSnapshot")}function x(){o.commit("cut")}function E(){o.commit("redo")}function G(){o.commit("undo")}function I(){o.state.areaData.components.length&&(o.commit("compose"),o.commit("recordSnapshot"))}function M(){const e=o.state.curComponent;e&&!e.isLock&&e.component=="Group"&&(o.commit("decompose"),o.commit("recordSnapshot"))}function z(){i.$emit("save")}function O(){i.$emit("preview")}function p(){o.state.curComponent&&(o.commit("deleteComponent"),o.commit("recordSnapshot"))}function j(){i.$emit("clearCanvas")}function q(){o.commit("lock")}function A(){o.commit("unlock")}export{F as k,H as l};
