"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[1819],{91819:function(a,t,s){s.r(t),s.d(t,{CleanupTempDataCommand:function(){return h},ExportCanvasCommand:function(){return n},GetCanvasInfoCommand:function(){return e},ValidateCanvasCommand:function(){return c}});class e{constructor(a){this.canvas=a.canvas,this.layerManager=a.layerManager,this.undoable=!1}execute(){return{width:this.canvas.getWidth(),height:this.canvas.getHeight(),zoom:this.canvas.getZoom(),layers:this.layerManager?.getLayers()?.length||0,objects:this.canvas.getObjects().length}}}class n{constructor(a){this.canvas=a.canvas,this.format=a.format||"png",this.quality=a.quality||1,this.undoable=!1}execute(){return this.canvas.toDataURL(`image/${this.format}`,this.quality)}}class c{constructor(a){this.canvas=a.canvas,this.undoable=!1}execute(){const a=this.canvas.getObjects(),t=[];return a.forEach(((a,s)=>{a.left&&a.top||t.push(`对象 ${s} 位置无效`),(a.width<=0||a.height<=0)&&t.push(`对象 ${s} 尺寸无效`)})),{isValid:0===t.length,errors:t,objectCount:a.length}}}class h{constructor(a){this.canvas=a.canvas,this.undoable=!1}execute(){const a=[],t=this.canvas.getObjects();return t.forEach(((t,s)=>{(t._isTemp||t._invalid)&&(this.canvas.remove(t),a.push(`临时对象 ${s}`))})),this.canvas._clearCache&&(this.canvas._clearCache(),a.push("画布缓存")),{cleaned:a,count:a.length}}}}}]);