@jieyin/editor-sdk 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @jieyin/editor-sdk might be problematic. Click here for more details.
- package/dist/editor-sdk.es.js +2640 -2639
- package/dist/editor-sdk.umd.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/editor-sdk.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(Ne,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("fabric")):typeof define=="function"&&define.amd?define(["exports","vue","fabric"],t):(Ne=typeof globalThis<"u"?globalThis:Ne||self,t(Ne.EditorSDK={},Ne.Vue,Ne.fabric))})(this,function(Ne,t,at){"use strict";var st=typeof document<"u"?document.currentScript:null;const sr="file_token",lr="file_token_expire_time",Ka=60*1e3,cr=typeof window<"u"&&typeof localStorage<"u";function bn(x){return cr?localStorage.getItem(x):null}function kn(x,X){cr&&localStorage.setItem(x,X)}function En(x){cr&&localStorage.removeItem(x)}function It(){return bn(sr)}function dr(x=Ka){if(!It())return!0;const r=bn(lr);if(!r)return!1;const l=Number(r);return Date.now()+x>l}function ja(x,X){if(kn(sr,x),typeof X=="number"&&X>0){const r=Date.now()+X*1e3;kn(lr,String(r))}}function Cn(){En(sr),En(lr)}async function Bn(x){var l,E;const X=await x(),r=(l=X==null?void 0:X.data)==null?void 0:l.data;return((E=X==null?void 0:X.data)==null?void 0:E.code)===200&&(r!=null&&r.file_token)?(ja(r.file_token,r.expires_in),r.file_token):null}let fr=null;function Ja(x){fr=x}function Qa(){return fr}function _n(){return typeof window>"u"?null:fr}async function Et(){if(typeof window>"u")return It();const x=It();if(x&&!dr())return x;try{const X=await _n();if(x&&(X!=null&&X.fetchFileTokenRefresh)){const r=await Bn(X.fetchFileTokenRefresh);if(r)return r}}catch{}try{const X=_n();return X!=null&&X.fetchFileToken?await Bn(X.fetchFileToken):null}catch{return null}}function An(x){if(!x||x.startsWith("data:")||x.startsWith("blob:"))return!1;try{const X=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(x,X);return!(!r.pathname.includes("/files/")||r.searchParams.has("fileToken"))}catch{return x.includes("/files/")&&!x.includes("fileToken=")}}function Rt(x,X){if(!X||!An(x))return x;const r=/^(https?:)?\/\//i.test(x),l=x.startsWith("//");try{const E=typeof window<"u"?window.location.origin:"http://localhost",f=new URL(x,E);return f.searchParams.has("fileToken")?x:(f.searchParams.set("fileToken",X),r?f.toString():l?f.toString().replace(/^https?:/,""):`${f.pathname}${f.search}${f.hash}`)}catch{return x}}function ur(x){const X=It();return!X||dr()?x:Rt(x,X)}function hr(x){try{const X=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(x,X);if(!r.searchParams.has("fileToken"))return x;r.searchParams.delete("fileToken");const l=/^(https?:)?\/\//i.test(x),E=x.startsWith("//");return l?r.toString():E?r.toString().replace(/^https?:/,""):`${r.pathname}${r.search}${r.hash}`}catch{return x.replace(/([?&])fileToken=[^&]*(&)?/,(X,r,l)=>r==="?"&&l?"?":r==="&"&&l?"&":"").replace(/[?&]$/,"")}}async function pr(x){if(!An(x))return x;const X=await Et();return Rt(x,X)}async function dt(x,X){if(typeof window>"u")return fetch(x,X);const r=hr(x),l=await pr(r),E=await fetch(l,X);if(E.status!==401)return E;Cn();const f=await Et(),b=Rt(r,f);return fetch(b,X)}const eo={class:"topbar"},to={class:"topbar-left"},ro={class:"product-name"},no={class:"toolbar"},ao={class:"topbar-right"},oo=t.defineComponent({__name:"EditorTopbar",props:{productName:{type:String,default:""},showGrid:{type:Boolean,default:!1}},emits:["add-text","add-label","toggle-grid","clear-canvas","download-png","upload"],setup(x,{emit:X}){const r=X,l=t.ref(null),E=()=>{var b;(b=l.value)==null||b.click()},f=b=>{r("upload",b)};return(b,i)=>(t.openBlock(),t.createElementBlock("header",eo,[t.createElementVNode("div",to,[i[2]||(i[2]=t.createElementVNode("select",{class:"select"},[t.createElementVNode("option",null,"简体中文"),t.createElementVNode("option",null,"English")],-1)),t.createElementVNode("span",ro,t.toDisplayString(x.productName||"定制产品"),1),t.createElementVNode("div",no,[t.createElementVNode("button",{class:"ghost",type:"button",onClick:i[0]||(i[0]=p=>r("add-text"))},"文字"),t.createElementVNode("button",{class:"ghost",type:"button",onClick:E},"图片")])]),t.createElementVNode("div",ao,[t.createElementVNode("button",{class:"primary",type:"button",onClick:i[1]||(i[1]=p=>r("clear-canvas"))},"清空画布")]),t.createElementVNode("input",{ref_key:"fileInput",ref:l,type:"file",accept:"image/*",hidden:"",onChange:f},null,544)]))}}),io={key:0,class:"sidebar-nav"},so={class:"nav-icon"},lo={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",style:{width:"20px",height:"20px"}},co={key:1,class:"sidebar-panel"},fo={key:0,class:"add-buttons"},uo={key:1,class:"toolbar add-buttons-compact"},ho={key:1,class:"layer-tools"},po={class:"tool-grid"},xo={class:"slider-row"},mo=["value"],vo=["value"],go={key:2,class:"text-tools"},yo={class:"control-block"},wo=["value"],bo=["value"],ko={class:"slider-row"},Eo=["value"],Co=["value"],Bo={class:"slider-row"},_o=["value"],Ao=["value"],Do={class:"slider-row"},Fo=["value"],So=["value"],No={class:"color-row"},Io=["value"],Ro={class:"preset-colors"},zo=["onClick"],To={class:"slider-row"},Oo=["value"],Lo=["value"],Po={class:"color-row"},Uo=["value"],Mo={key:3,class:"image-tools"},Vo={class:"mode-grid"},Wo={key:0,class:"slider-row"},$o=["value"],Ho=["value"],qo={key:2,class:"sidebar-panel"},Xo={class:"product-grid"},Zo=["onClick"],Go=["src","alt"],Yo={class:"product-title"},Ko={class:"pagination"},jo={class:"pager"},Jo=["disabled"],Qo={class:"pager-btn",type:"button",disabled:""},ei=["disabled"],ti={key:3,class:"sidebar-panel"},ri={class:"layer-list"},ni=["onClick","title"],ai={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},oi={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ii={class:"layer-thumbnail"},si=["onClick"],li=["onClick"],ci=["onClick"],di=["onClick"],fi=["onClick"],ui=["title","onClick"],hi={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},pi={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},xi=["onClick"],mi={key:0,class:"empty"},Dn=t.defineComponent({__name:"EditorSidebar",props:{activeTab:{type:String,default:"add"},visibleTabs:{type:Array,default:()=>["add","product","layer"]},showNav:{type:Boolean,default:!0},urlInput:{type:String,default:""},productItems:{type:Array,default:()=>[]},productTotal:{type:Number,default:0},productPage:{type:Number,default:1},productPageSize:{type:Number,default:8},productHasPrev:{type:Boolean,default:!1},productHasNext:{type:Boolean,default:!1},selectedProductIndex:{type:Number,default:0},layers:{type:Array,default:()=>[]},activeLayerId:{type:[String,Number],default:null},showImageTools:{type:Boolean,default:!1},imagePatternMode:{type:String,default:""},imagePatternScale:{type:Number,default:100},imagePatternScaleEnabled:{type:Boolean,default:!1},showLayerTools:{type:Boolean,default:!1},layerOpacity:{type:Number,default:1},showTextTools:{type:Boolean,default:!1},textFontFamily:{type:String,default:"Arial"},textFontSize:{type:Number,default:26},textCharSpacing:{type:Number,default:0},textLineHeight:{type:Number,default:1.16},textFill:{type:String,default:"#111827"},textStrokeWidth:{type:Number,default:0},textStroke:{type:String,default:"#000000"}},emits:["update:activeTab","update:urlInput","update:selectedProductIndex","change-product-page","add-text","add-label","add-rect","add-circle","remove-selected","upload","add-image-url","paste-url","select-layer","apply-image-pattern","update-image-pattern-scale","move-layer","flip-layer","rotate-layer","center-layer","update-layer-opacity","update-text-prop","align-layer","scale-layer","duplicate-layer","toggle-layer-visibility","toggle-layer-lock","delete-layer","move-layer-by-id","duplicate-layer-by-id"],setup(x,{emit:X}){const r=x,l=X,E=["Arial","Times New Roman","Courier New","Roboto","Pacifico","Montserrat"],f=["#000000","#ffffff","#ef4444","#f59e0b","#10b981","#3b82f6"],b=t.ref(null),i=()=>{var n;(n=b.value)==null||n.click()},p=n=>{l("upload",n)},d=new Map,v=t.ref(0),C=async()=>{await Et(),v.value++};t.onMounted(C),t.watch(()=>r.productItems,()=>{C()},{deep:!0,immediate:!0});const m=n=>(v.value,n?ur(n):""),s=(n,e)=>{!n||!(e!=null&&e.object)||(d.set(e.id,{canvas:n,layer:e}),t.nextTick(()=>{h(n,e.object)}))},h=(n,e)=>{var c,y,k;if(!n||!e)return;const o=n.getContext("2d");if(o){if(o.clearRect(0,0,40,40),o.fillStyle="#f1f5f9",o.fillRect(0,0,40,40),(c=e==null?void 0:e.customData)!=null&&c.isPatternRect){const _=((y=e==null?void 0:e.customData)==null?void 0:y.patternSource)||((k=e==null?void 0:e.customData)==null?void 0:k.savedSrc)||"";if(_&&typeof _=="string"){const S=new Image;S.crossOrigin="anonymous",S.onload=()=>{try{const I=Math.min(40/S.width,40/S.height,1),H=S.width*I,V=S.height*I,T=(40-H)/2,q=(40-V)/2;o.clearRect(0,0,40,40),o.fillStyle="#f1f5f9",o.fillRect(0,0,40,40),o.drawImage(S,T,q,H,V)}catch{o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20)}},S.onerror=()=>{o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20)},pr(_).then(I=>{S.src=I}).catch(()=>{S.src=_});return}o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20);return}if(e.type==="image"&&e._element)try{const _=e._element,S=Math.min(40/(e.width||40),40/(e.height||40),1),I=(e.width||40)*S,H=(e.height||40)*S,V=(40-I)/2,T=(40-H)/2;o.drawImage(_,V,T,I,H)}catch{o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20)}else e.type==="textbox"||e.type==="text"?(o.fillStyle="#475569",o.font="10px Arial",o.fillText("T",15,25)):e.type==="rect"?(o.fillStyle="#6366f1",o.fillRect(10,10,20,20)):e.type==="circle"?(o.fillStyle="#6366f1",o.beginPath(),o.arc(20,20,10,0,Math.PI*2),o.fill()):(o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20))}};return t.watch(()=>r.layers,()=>{t.nextTick(()=>{d.forEach(({canvas:n,layer:e})=>{e!=null&&e.object&&h(n,e.object)})})},{deep:!0}),(n,e)=>(t.openBlock(),t.createElementBlock("aside",{class:t.normalizeClass(["sidebar",{"sidebar-no-nav":!x.showNav}])},[x.showNav?(t.openBlock(),t.createElementBlock("div",io,[x.visibleTabs.includes("add")?(t.openBlock(),t.createElementBlock("button",{key:0,class:t.normalizeClass(["nav-item",{active:x.activeTab==="add"}]),type:"button",onClick:e[0]||(e[0]=o=>l("update:activeTab","add"))},[t.createElementVNode("span",so,[(t.openBlock(),t.createElementBlock("svg",lo,[...e[46]||(e[46]=[t.createElementVNode("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"},null,-1)])]))]),e[47]||(e[47]=t.createElementVNode("span",{class:"nav-label"},"操作",-1))],2)):t.createCommentVNode("",!0),x.visibleTabs.includes("product")?(t.openBlock(),t.createElementBlock("button",{key:1,class:t.normalizeClass(["nav-item",{active:x.activeTab==="product"}]),type:"button",onClick:e[1]||(e[1]=o=>l("update:activeTab","product"))},[...e[48]||(e[48]=[t.createElementVNode("span",{class:"nav-icon"},"🛍️",-1),t.createElementVNode("span",{class:"nav-label"},"产品",-1)])],2)):t.createCommentVNode("",!0),x.visibleTabs.includes("layer")?(t.openBlock(),t.createElementBlock("button",{key:2,class:t.normalizeClass(["nav-item",{active:x.activeTab==="layer"}]),type:"button",onClick:e[2]||(e[2]=o=>l("update:activeTab","layer"))},[...e[49]||(e[49]=[t.createElementVNode("span",{class:"nav-icon"},"⧉",-1),t.createElementVNode("span",{class:"nav-label"},"图层",-1)])],2)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),x.visibleTabs.includes("add")&&x.activeTab==="add"?(t.openBlock(),t.createElementBlock("div",co,[!x.showTextTools&&!x.showImageTools&&!x.showLayerTools?(t.openBlock(),t.createElementBlock("div",fo,[x.showNav?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("button",{class:"add-btn",type:"button",onClick:e[3]||(e[3]=o=>l("add-text"))},[...e[50]||(e[50]=[t.createElementVNode("div",{class:"add-btn-icon"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M4 20h16M4 4h16M9 12h6"})])],-1),t.createElementVNode("span",{class:"add-btn-text"},"添加文字",-1)])]),t.createElementVNode("button",{class:"add-btn",type:"button",onClick:i},[...e[51]||(e[51]=[t.createStaticVNode('<div class="add-btn-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></div><span class="add-btn-text">添加图片</span>',2)])])],64)):(t.openBlock(),t.createElementBlock("div",uo,[t.createElementVNode("button",{class:"ghost",type:"button",onClick:e[4]||(e[4]=o=>l("add-text"))},"添加文字"),t.createElementVNode("button",{class:"ghost",type:"button",onClick:i},"添加图片")]))])):t.createCommentVNode("",!0),x.showLayerTools?(t.openBlock(),t.createElementBlock("div",ho,[e[71]||(e[71]=t.createElementVNode("h4",{class:"panel-subtitle"},"图层操作",-1)),t.createElementVNode("div",po,[t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层置顶",onClick:e[5]||(e[5]=o=>l("move-layer-by-id",x.activeLayerId,"top"))},[...e[52]||(e[52]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"12",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"8",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"4",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层置底",onClick:e[6]||(e[6]=o=>l("move-layer-by-id",x.activeLayerId,"bot"))},[...e[53]||(e[53]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"4",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"10",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"16",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层上移",onClick:e[7]||(e[7]=o=>l("move-layer-by-id",x.activeLayerId,"up"))},[...e[54]||(e[54]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"8",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"4",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"14",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层下移",onClick:e[8]||(e[8]=o=>l("move-layer-by-id",x.activeLayerId,"down"))},[...e[55]||(e[55]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"4",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"10",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"16",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"复制图层",onClick:e[9]||(e[9]=o=>l("duplicate-layer"))},[...e[56]||(e[56]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.createElementVNode("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"删除图层",onClick:e[10]||(e[10]=o=>l("remove-selected"))},[...e[57]||(e[57]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),t.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"左对齐",onClick:e[11]||(e[11]=o=>l("align-layer","left"))},[...e[58]||(e[58]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"3",y1:"12",x2:"3",y2:"12","stroke-width":"3"}),t.createElementVNode("rect",{x:"6",y:"8",width:"12",height:"8",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"水平对齐",onClick:e[12]||(e[12]=o=>l("align-layer","hcenter"))},[...e[59]||(e[59]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"12",y1:"3",x2:"12",y2:"21","stroke-width":"2"}),t.createElementVNode("rect",{x:"6",y:"8",width:"12",height:"8",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"右对齐",onClick:e[13]||(e[13]=o=>l("align-layer","right"))},[...e[60]||(e[60]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"21",y1:"12",x2:"21",y2:"12","stroke-width":"3"}),t.createElementVNode("rect",{x:"6",y:"8",width:"12",height:"8",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"上对齐",onClick:e[14]||(e[14]=o=>l("align-layer","top"))},[...e[61]||(e[61]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"12",y1:"3",x2:"12",y2:"3","stroke-width":"3"}),t.createElementVNode("rect",{x:"8",y:"6",width:"8",height:"12",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"垂直对齐",onClick:e[15]||(e[15]=o=>l("align-layer","vcenter"))},[...e[62]||(e[62]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"3",y1:"12",x2:"21",y2:"12","stroke-width":"2"}),t.createElementVNode("rect",{x:"8",y:"6",width:"8",height:"12",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"下对齐",onClick:e[16]||(e[16]=o=>l("align-layer","bottom"))},[...e[63]||(e[63]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"12",y1:"21",x2:"12",y2:"21","stroke-width":"3"}),t.createElementVNode("rect",{x:"8",y:"6",width:"8",height:"12",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"放大",onClick:e[17]||(e[17]=o=>l("scale-layer","up"))},[...e[64]||(e[64]=[t.createStaticVNode('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>',1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"缩小",onClick:e[18]||(e[18]=o=>l("scale-layer","down"))},[...e[65]||(e[65]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),t.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"逆时针旋转",onClick:e[19]||(e[19]=o=>l("rotate-layer","ccw"))},[...e[66]||(e[66]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"顺时针旋转",onClick:e[20]||(e[20]=o=>l("rotate-layer","cw"))},[...e[67]||(e[67]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M2.5 2v6h6M21.5 22v-6h6M22 12.5a10 10 0 0 1-18.8 4.2M2 11.5a10 10 0 0 1 18.8-4.3"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"水平翻转",onClick:e[21]||(e[21]=o=>l("flip-layer","X"))},[...e[68]||(e[68]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3"}),t.createElementVNode("line",{x1:"12",y1:"3",x2:"12",y2:"21","stroke-dasharray":"2 2"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"垂直翻转",onClick:e[22]||(e[22]=o=>l("flip-layer","Y"))},[...e[69]||(e[69]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M3 8V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3M3 16v3a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-3"}),t.createElementVNode("line",{x1:"3",y1:"12",x2:"21",y2:"12","stroke-dasharray":"2 2"})],-1)])])]),t.createElementVNode("div",xo,[e[70]||(e[70]=t.createElementVNode("span",{class:"slider-label"},"透明度",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"0",max:"1",step:"0.05",value:x.layerOpacity,onInput:e[23]||(e[23]=o=>l("update-layer-opacity",o.target.value))},null,40,mo),t.createElementVNode("input",{class:"number-input",type:"number",min:"0",max:"1",step:"0.05",value:x.layerOpacity,onInput:e[24]||(e[24]=o=>l("update-layer-opacity",o.target.value))},null,40,vo)])])):t.createCommentVNode("",!0),x.showTextTools?(t.openBlock(),t.createElementBlock("div",go,[e[78]||(e[78]=t.createElementVNode("h4",{class:"panel-subtitle"},"文字排版",-1)),t.createElementVNode("div",yo,[t.createElementVNode("select",{class:"select",value:x.textFontFamily,onChange:e[25]||(e[25]=o=>l("update-text-prop","fontFamily",o.target.value))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(E,o=>t.createElementVNode("option",{key:o,value:o},t.toDisplayString(o),9,bo)),64))],40,wo)]),t.createElementVNode("div",ko,[e[72]||(e[72]=t.createElementVNode("span",{class:"slider-label"},"字号",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"10",max:"300",step:"1",value:x.textFontSize,onInput:e[26]||(e[26]=o=>l("update-text-prop","fontSize",o.target.value))},null,40,Eo),t.createElementVNode("input",{class:"number-input",type:"number",min:"10",max:"300",step:"1",value:x.textFontSize,onInput:e[27]||(e[27]=o=>l("update-text-prop","fontSize",o.target.value))},null,40,Co)]),t.createElementVNode("div",Bo,[e[73]||(e[73]=t.createElementVNode("span",{class:"slider-label"},"字距",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"-100",max:"800",step:"10",value:x.textCharSpacing,onInput:e[28]||(e[28]=o=>l("update-text-prop","charSpacing",o.target.value))},null,40,_o),t.createElementVNode("input",{class:"number-input",type:"number",min:"-100",max:"800",step:"10",value:x.textCharSpacing,onInput:e[29]||(e[29]=o=>l("update-text-prop","charSpacing",o.target.value))},null,40,Ao)]),t.createElementVNode("div",Do,[e[74]||(e[74]=t.createElementVNode("span",{class:"slider-label"},"行高",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"0.5",max:"3",step:"0.1",value:x.textLineHeight,onInput:e[30]||(e[30]=o=>l("update-text-prop","lineHeight",o.target.value))},null,40,Fo),t.createElementVNode("input",{class:"number-input",type:"number",min:"0.5",max:"3",step:"0.1",value:x.textLineHeight,onInput:e[31]||(e[31]=o=>l("update-text-prop","lineHeight",o.target.value))},null,40,So)]),t.createElementVNode("div",No,[e[75]||(e[75]=t.createElementVNode("span",null,"文本颜色",-1)),t.createElementVNode("label",{class:"color-preview",style:t.normalizeStyle({background:x.textFill})},[t.createElementVNode("input",{type:"color",value:x.textFill,onInput:e[32]||(e[32]=o=>l("update-text-prop","fill",o.target.value))},null,40,Io)],4)]),t.createElementVNode("div",Ro,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(f,o=>t.createElementVNode("button",{key:o,class:"color-chip",type:"button",style:t.normalizeStyle({background:o}),onClick:c=>l("update-text-prop","fill",o)},null,12,zo)),64))]),e[79]||(e[79]=t.createElementVNode("h4",{class:"panel-subtitle"},"描边与背景",-1)),t.createElementVNode("div",To,[e[76]||(e[76]=t.createElementVNode("span",{class:"slider-label"},"粗细",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"0",max:"10",step:"0.1",value:x.textStrokeWidth,onInput:e[33]||(e[33]=o=>l("update-text-prop","strokeWidth",o.target.value))},null,40,Oo),t.createElementVNode("input",{class:"number-input",type:"number",min:"0",max:"10",step:"0.1",value:x.textStrokeWidth,onInput:e[34]||(e[34]=o=>l("update-text-prop","strokeWidth",o.target.value))},null,40,Lo)]),t.createElementVNode("div",Po,[e[77]||(e[77]=t.createElementVNode("span",null,"描边色",-1)),t.createElementVNode("label",{class:"color-preview",style:t.normalizeStyle({background:x.textStroke})},[t.createElementVNode("input",{type:"color",value:x.textStroke,onInput:e[35]||(e[35]=o=>l("update-text-prop","stroke",o.target.value))},null,40,Uo)],4)])])):t.createCommentVNode("",!0),x.showImageTools?(t.openBlock(),t.createElementBlock("div",Mo,[e[81]||(e[81]=t.createElementVNode("h4",{class:"panel-subtitle"},"图片操作",-1)),t.createElementVNode("div",Vo,[t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="grid"}]),type:"button",onClick:e[36]||(e[36]=o=>l("apply-image-pattern","grid"))}," 基础 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="brick-x"}]),type:"button",onClick:e[37]||(e[37]=o=>l("apply-image-pattern","brick-x"))}," 横向交错 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="brick-y"}]),type:"button",onClick:e[38]||(e[38]=o=>l("apply-image-pattern","brick-y"))}," 纵向交错 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="mirror"}]),type:"button",onClick:e[39]||(e[39]=o=>l("apply-image-pattern","mirror"))}," 镜像 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="random"}]),type:"button",onClick:e[40]||(e[40]=o=>l("apply-image-pattern","random"))}," 随机 ",2)]),x.imagePatternScaleEnabled?(t.openBlock(),t.createElementBlock("div",Wo,[e[80]||(e[80]=t.createElementVNode("span",{class:"slider-label"},"缩放",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"1",max:"200",step:"1",value:x.imagePatternScale,onInput:e[41]||(e[41]=o=>l("update-image-pattern-scale",o.target.value))},null,40,$o),t.createElementVNode("input",{class:"number-input",type:"number",min:"1",max:"200",step:"1",value:x.imagePatternScale,onInput:e[42]||(e[42]=o=>l("update-image-pattern-scale",o.target.value))},null,40,Ho)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("input",{ref_key:"fileInput",ref:b,type:"file",accept:"image/*",hidden:"",onChange:p},null,544)])):t.createCommentVNode("",!0),x.visibleTabs.includes("product")&&x.activeTab==="product"?(t.openBlock(),t.createElementBlock("div",qo,[e[82]||(e[82]=t.createElementVNode("h3",{class:"panel-title"},"产品",-1)),t.createElementVNode("div",Xo,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.productItems,(o,c)=>(t.openBlock(),t.createElementBlock("button",{key:o.id,class:t.normalizeClass(["product-card",{active:x.selectedProductIndex===c}]),type:"button",onClick:y=>l("update:selectedProductIndex",c)},[t.createElementVNode("img",{src:m(o.coverImg),alt:o.name},null,8,Go),t.createElementVNode("span",Yo,t.toDisplayString(o.name),1)],10,Zo))),128))]),t.createElementVNode("div",Ko,[t.createElementVNode("span",null,"共"+t.toDisplayString(x.productTotal)+"条",1),t.createElementVNode("div",jo,[t.createElementVNode("button",{class:"pager-btn",type:"button",disabled:!x.productHasPrev,onClick:e[43]||(e[43]=o=>l("change-product-page",x.productPage-1))}," 上一页 ",8,Jo),t.createElementVNode("button",Qo,t.toDisplayString(x.productPage),1),t.createElementVNode("button",{class:"pager-btn",type:"button",disabled:!x.productHasNext,onClick:e[44]||(e[44]=o=>l("change-product-page",x.productPage+1))}," 下一页 ",8,ei)])])])):t.createCommentVNode("",!0),x.visibleTabs.includes("layer")&&x.activeTab==="layer"?(t.openBlock(),t.createElementBlock("div",ti,[e[93]||(e[93]=t.createElementVNode("h3",{class:"panel-title"},"图层",-1)),t.createElementVNode("div",ri,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.layers,o=>(t.openBlock(),t.createElementBlock("div",{key:o.id,class:t.normalizeClass(["layer-item",{active:x.activeLayerId===o.id,hidden:!o.visible,locked:o.locked}]),style:{display:"flex"}},[t.createElementVNode("div",{class:"layer-actions",onClick:e[45]||(e[45]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("button",{class:"layer-visibility-btn",type:"button",onClick:t.withModifiers(c=>l("toggle-layer-visibility",o),["stop"]),title:o.visible?"隐藏":"显示"},[o.visible?(t.openBlock(),t.createElementBlock("svg",ai,[...e[83]||(e[83]=[t.createElementVNode("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),t.createElementVNode("circle",{cx:"12",cy:"12",r:"3"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",oi,[...e[84]||(e[84]=[t.createElementVNode("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),t.createElementVNode("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)])]))],8,ni),t.createElementVNode("div",ii,[t.createElementVNode("canvas",{ref_for:!0,ref:c=>s(c,o),class:"layer-thumbnail-canvas",width:"40",height:"40"},null,512)]),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"置顶",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"top"),["stop"])},[...e[85]||(e[85]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 19V5M5 12l7-7 7 7"})],-1)])],8,si),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"上移一层",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"up"),["stop"])},[...e[86]||(e[86]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M18 15l-6-6-6 6"})],-1)])],8,li),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"下移一层",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"down"),["stop"])},[...e[87]||(e[87]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M6 9l6 6 6-6"})],-1)])],8,ci),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"置底",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"bot"),["stop"])},[...e[88]||(e[88]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 5v14M19 12l-7 7-7-7"})],-1)])],8,di),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"复制",onClick:t.withModifiers(c=>l("duplicate-layer-by-id",o.id),["stop"])},[...e[89]||(e[89]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.createElementVNode("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)])],8,fi),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:o.locked?"解锁":"锁定",onClick:t.withModifiers(c=>l("toggle-layer-lock",o),["stop"])},[o.locked?(t.openBlock(),t.createElementBlock("svg",hi,[...e[90]||(e[90]=[t.createElementVNode("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",pi,[...e[91]||(e[91]=[t.createElementVNode("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M7 11V7a5 5 0 0 1 9.33-2.5"},null,-1)])]))],8,ui),t.createElementVNode("button",{class:"layer-action-btn danger",type:"button",title:"删除",onClick:t.withModifiers(c=>l("delete-layer",o),["stop"])},[...e[92]||(e[92]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),t.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])],8,xi)])],2))),128)),x.layers.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",mi,"暂无图层"))])])):t.createCommentVNode("",!0)],2))}}),vi={class:"canvas-section"},gi={class:"canvas-toolbar"},yi={class:"toolbar-left"},wi={key:0,class:"status"},bi={key:0},ki={key:1},Ei={class:"canvas-footer"},Ci={class:"footer-left"},Bi={key:0,class:"copy-dropdown"},_i={class:"copy-item"},Ai=["checked"],Di={class:"copy-list"},Fi=["checked","onChange"],Si={class:"copy-actions"},Ni=["disabled"],Ii={class:"diecut-panel"},Ri={class:"diecut-list"},zi=["onClick"],Ti=["src","alt"],Oi={class:"footer-right"},Li={class:"zoom-controls"},Pi={class:"zoom-value"},Ui=t.defineComponent({__name:"CanvasSection",props:{sizeOptions:{type:Array,default:()=>[]},selectedSize:{type:String,default:""},loadingTemplate:{type:Boolean,default:!1},templateError:{type:String,default:""},diecutOptions:{type:Array,default:()=>[]},selectedDiecutId:{type:String,default:""},zoom:{type:Number,default:100}},emits:["update:selectedSize","update:selectedDiecutId","canvas-ready","zoom-in","zoom-out","fit-canvas","copy-to-diecuts"],setup(x,{emit:X}){const r=x,l=X,E=t.ref(null),f=t.ref(null),b=t.ref(!1),i=t.ref([]),p=t.ref(0),d=async()=>{await Et(),p.value++},v=t.computed(()=>(r.diecutOptions||[]).filter(y=>y.id!==r.selectedDiecutId)),C=t.computed(()=>v.value.length>0&&i.value.length===v.value.length),m=y=>{l("update:selectedDiecutId",y)},s=()=>{b.value=!b.value},h=()=>{C.value?i.value=[]:i.value=v.value.map(y=>y.id)},n=y=>{y&&(i.value.includes(y)?i.value=i.value.filter(k=>k!==y):i.value=[...i.value,y])},e=()=>{b.value=!1,i.value=[]},o=()=>{i.value.length&&(l("copy-to-diecuts",[...i.value]),e())};t.watch(v,y=>{const k=new Set(y.map(_=>_.id));i.value=i.value.filter(_=>k.has(_))}),t.watch(()=>r.diecutOptions,()=>{d()},{deep:!0,immediate:!0});const c=y=>(p.value,y?ur(y):"");return t.onMounted(()=>{l("canvas-ready",{canvasWrap:E.value,canvasEl:f.value})}),(y,k)=>(t.openBlock(),t.createElementBlock("section",vi,[t.createElementVNode("div",gi,[t.createElementVNode("div",yi,[x.loadingTemplate||x.templateError?(t.openBlock(),t.createElementBlock("div",wi,[x.loadingTemplate?(t.openBlock(),t.createElementBlock("span",bi,"模板加载中...")):(t.openBlock(),t.createElementBlock("span",ki,t.toDisplayString(x.templateError),1))])):t.createCommentVNode("",!0)])]),t.createElementVNode("div",{class:"canvas-container",ref_key:"localCanvasWrap",ref:E},[t.createElementVNode("canvas",{ref_key:"localCanvasEl",ref:f},null,512)],512),t.createElementVNode("div",Ei,[t.createElementVNode("div",Ci,[t.createElementVNode("div",{class:"copy-panel",onClick:k[0]||(k[0]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("button",{class:"copy-btn",type:"button",onClick:s},"复制至"),b.value?(t.openBlock(),t.createElementBlock("div",Bi,[t.createElementVNode("label",_i,[t.createElementVNode("input",{type:"checkbox",checked:C.value,onChange:h},null,40,Ai),k[4]||(k[4]=t.createElementVNode("span",null,"全选",-1))]),t.createElementVNode("div",Di,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.value,_=>(t.openBlock(),t.createElementBlock("label",{key:_.id,class:"copy-item"},[t.createElementVNode("input",{type:"checkbox",checked:i.value.includes(_.id),onChange:S=>n(_.id)},null,40,Fi),t.createElementVNode("span",null,t.toDisplayString(_.name),1)]))),128))]),t.createElementVNode("div",Si,[t.createElementVNode("button",{class:"ghost",type:"button",onClick:e},"取消"),t.createElementVNode("button",{class:"primary small",type:"button",disabled:!i.value.length,onClick:o}," 确认 ",8,Ni)])])):t.createCommentVNode("",!0)]),k[5]||(k[5]=t.createElementVNode("div",{class:"footer-divider"},null,-1)),t.createElementVNode("div",Ii,[t.createElementVNode("div",Ri,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.diecutOptions,_=>(t.openBlock(),t.createElementBlock("button",{key:_.id,class:t.normalizeClass(["diecut-item",{active:x.selectedDiecutId===_.id}]),type:"button",onClick:S=>m(_.id)},[t.createElementVNode("img",{src:c(_.url),alt:_.name},null,8,Ti),t.createElementVNode("span",null,t.toDisplayString(_.name),1)],10,zi))),128))])])]),t.createElementVNode("div",Oi,[t.createElementVNode("div",Li,[t.createElementVNode("button",{class:"zoom-btn",type:"button",onClick:k[1]||(k[1]=_=>l("zoom-out")),title:"缩小"},[...k[6]||(k[6]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},[t.createElementVNode("path",{d:"M3 7h8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])]),t.createElementVNode("span",Pi,t.toDisplayString(x.zoom)+"%",1),t.createElementVNode("button",{class:"zoom-btn",type:"button",onClick:k[2]||(k[2]=_=>l("zoom-in")),title:"放大"},[...k[7]||(k[7]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},[t.createElementVNode("path",{d:"M7 3v8M3 7h8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])]),k[8]||(k[8]=t.createElementVNode("div",{class:"zoom-divider"},null,-1)),t.createElementVNode("button",{class:"fit-btn",type:"button",onClick:k[3]||(k[3]=_=>l("fit-canvas")),title:"适配画布"}," 适配 ")])])])]))}});var Fn=(x=>(x[x.Drawing=0]="Drawing",x[x.Material=1]="Material",x))(Fn||{}),gt=(x=>(x[x.Group=0]="Group",x[x.Layer=1]="Layer",x))(gt||{});function Mi(x){let X=x;return()=>{const r=X;return X+=1,r}}function Vi(x,X){return{name:x.name||"",type:x.type||"Layer",blendMode:x.blendMode||"normal",transform:x.transform??[],meshPoints:x.meshPoints,bounds:x.bounds??{left:0,top:0,width:0,height:0},isSmartObject:x.isSmartObject??!1,size:x.size,originalWidth:x.originalWidth,originalHeight:x.originalHeight,placedLayer:x.placedLayer,quiltSliceX:x.quiltSliceX,quiltSliceY:x.quiltSliceY,layerOrder:x.layerOrder,imagePath:x.imagePath,vectorMask:x.vectorMask??X,filterList:x.filterList,opacity:x.opacity,clipping:x.clipping}}function Wi(x,X,r,l){let E=x.name||"",f=X[E],b=(f==null?void 0:f.partId)??(x.type==="Group"?r.get(E):void 0);if(x.type==="Group"&&b===void 0&&(!f||f.id===void 0)&&x.children&&x.children.length===1){const d=x.children[0].name,v=X[d],C=(v==null?void 0:v.partId)??r.get(d);(C!==void 0||(v==null?void 0:v.id)!==void 0)&&(E=d,f=v,b=C)}const i=x.id??(f==null?void 0:f.id)??l();if(x.type==="Group")return{id:i,partId:b,name:E,blendMode:x.blendMode||"normal",bounds:x.bounds||{left:0,top:0,width:0,height:0},type:gt.Group,smartObjects:(x.children??[]).map(d=>Vi(d,x.vectorMask)),opacity:x.opacity,clipping:x.clipping,layerOrder:x.layerOrder};let p=f==null?void 0:f.url;return!p&&x.imagePath&&(p=x.imagePath),{id:i,name:x.name||"",blendMode:x.blendMode||"normal",bounds:x.bounds||{left:0,top:0,width:0,height:0},type:gt.Layer,url:p,opacity:x.opacity,clipping:x.clipping,layerOrder:x.layerOrder}}function xr(x,X){const r=new Map(X.parts.map(E=>[E.name,E.id])),l=Mi(X.defaultIdStart??1);return{parts:X.parts,models:x.map(E=>{const f=E.layerExtrasByName??{},b=E.psdJson,i=b.layerList||b.layerList||[],p=b.canvasWidth,d=b.canvasHeight;if(!p||!d)throw new Error(`无法获取 PSD 画布尺寸: canvasWidth=${p}, canvasHeight=${d}。请确保 jsonurl 中的 canvasWidth 和 canvasHeight 存在`);console.log("[psdConverter] 📐 使用 psdJson 画布尺寸:",{canvasWidth:p,canvasHeight:d,note:"应该使用 jsonurl 中的原始尺寸(如 7559x7559)"});const v=[];for(const m of i)if(m.type==="Group"&&m.children){const s=[],h=[],n=[...m.children].sort((e,o)=>{const c=e.layerOrder??0,y=o.layerOrder??0;return c-y});for(const e of n)e.isSmartObject===!0?s.push(e):h.push(e);h.length>0&&v.push(...h),s.length>0&&v.push({...m,children:s})}else v.push(m);const C=v.map(m=>Wi(m,f,r,l));return{width:p,height:d,psdPartData:C}})}}function Sn(x){return x?x.vectorMask&&x.vectorMask.paths&&Array.isArray(x.vectorMask.paths)?{type:"bezier",paths:x.vectorMask.paths}:Array.isArray(x.vectorMask)?{type:"simple",points:x.vectorMask}:null:null}function Nn(x){return x?x.type==="bezier"?{type:"bezier",paths:x.paths.map(X=>({open:!!X.open,knots:X.knots.map(r=>({linked:!!r.linked,points:Array.isArray(r.points)?[...r.points]:[]}))}))}:x.type==="simple"?{type:"simple",points:x.points.map(X=>({x:X.x,y:X.y,type:X.type}))}:null:null}function $t(x,X){if(X){if(x.globalCompositeOperation="destination-in",x.beginPath(),X.type==="bezier"&&Array.isArray(X.paths))X.paths.forEach(r=>{const l=r.knots;if(!l||l.length<2)return;const E=l[0];x.moveTo(E.points[2],E.points[3]);for(let f=0;f<l.length;f++){const b=l[f];let i=(f+1)%l.length;if(!r.open&&f===l.length-1)i=0;else if(r.open&&f===l.length-1)break;const p=l[i],d=b.points[4],v=b.points[5],C=p.points[0],m=p.points[1],s=p.points[2],h=p.points[3];x.bezierCurveTo(d,v,C,m,s,h)}r.open||x.closePath()});else if(X.type==="simple"&&Array.isArray(X.points)){const r=X.points;if(r.length<3)return;x.moveTo(r[0].x,r[0].y);for(let l=1;l<r.length;l++)x.lineTo(r[l].x,r[l].y);x.closePath()}x.fillStyle="#000",x.fill(),x.globalCompositeOperation="source-over"}}const In=x=>{if(!x)return x;if(typeof window<"u"){const r=window.location.hostname;if(r==="localhost"||r==="127.0.0.1")try{const l=new URL(x);if(l.pathname.startsWith("/files/"))return`${l.pathname}${l.search}${l.hash}`}catch{}}if(typeof window<"u"&&window.location.hostname!=="localhost")return x;const X=x.match(/^https?:\/\/([^/]+\.oss[^/]*\.aliyuncs\.com)(.*)$/);return X?`/oss${X[2]}`:x},$i=(x,X)=>{if(typeof OffscreenCanvas<"u"&&typeof document>"u")return new OffscreenCanvas(x,X);const r=document.createElement("canvas");return r.width=x,r.height=X,r},Ht=async(x,X)=>{var p;if(!X||X<=0)return x;const r=Math.max(x.width,x.height);if(r<=X)return x;const l=X/r,E=Math.max(1,Math.round(x.width*l)),f=Math.max(1,Math.round(x.height*l)),b=$i(E,f),i=b.getContext("2d");return i?(i.drawImage(x,0,0,E,f),(p=x.close)==null||p.call(x),await createImageBitmap(b)):x};async function mr(x,X){if(typeof x=="string")try{const r=In(x),l=await dt(r);if(!l.ok){const f=l.status===404?`图片不存在 (404): ${x}`:`加载图片失败 (${l.status} ${l.statusText}): ${x}`;throw new Error(f)}const E=await l.blob();if(!E.type.startsWith("image/")&&E.size===0)throw new Error(`图片数据无效: URL=${x}`);try{const f=await createImageBitmap(E);return await Ht(f,X)}catch(f){throw new Error(`图片解码失败: URL=${x}, 错误=${f instanceof Error?f.message:f}`)}}catch(r){throw r instanceof Error?r:new Error(`加载图片失败: ${x}, ${r}`)}if(x instanceof HTMLImageElement){if((!x.complete||x.naturalWidth===0)&&await new Promise((r,l)=>{x.onload=r,x.onerror=()=>l(new Error(`图片加载失败: src=${x.src}`)),x.complete&&r(null)}),x.naturalWidth===0||x.naturalHeight===0)throw new Error(`图片尺寸无效: src=${x.src}, width=${x.naturalWidth}, height=${x.naturalHeight}`);try{const r=await createImageBitmap(x);return await Ht(r,X)}catch(r){throw new Error(`图片解码失败: src=${x.src}, 错误=${r instanceof Error?r.message:r}`)}}if(x instanceof ImageBitmap){if(x.width===0||x.height===0)throw new Error(`ImageBitmap 尺寸无效: width=${x.width}, height=${x.height}`);return await Ht(x,X)}throw new Error("不支持的图片类型")}async function Rn(x,X){try{const r=In(x),l=await dt(r);if(!l.ok){const f=l.status===404?`图片不存在 (404): ${x}`:`加载图片失败 (${l.status} ${l.statusText}): ${x}`;throw new Error(f)}const E=await l.blob();if(!E.type.startsWith("image/")&&E.size===0)throw new Error(`图片数据无效: URL=${x}`);try{const f=await createImageBitmap(E);return await Ht(f,X)}catch(f){throw new Error(`图片解码失败: URL=${x}, 错误=${f instanceof Error?f.message:f}`)}}catch(r){throw r instanceof Error?r:new Error(`加载图片失败: ${x}, ${r}`)}}function vr(x){if(!x)return"source-over";const X=x.trim().toLowerCase();return{normal:"source-over",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","color dodge":"color-dodge","color-dodge":"color-dodge","color burn":"color-burn","color-burn":"color-burn","hard light":"hard-light","hard-light":"hard-light","soft light":"soft-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion",hue:"hue",saturation:"saturation",color:"color",luminosity:"luminosity","linear burn":"plus-darker","linear dodge":"lighter",lighter:"lighter","pass-through":"source-over"}[X]||"source-over"}const qt=new Map,Xt=new Map;let Hi=0;function zn(x){const X=qt.get(x);if(X)return X;const r=new Worker(new URL("/assets/deform.worker-D47nPX6L.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:st&&st.tagName.toUpperCase()==="SCRIPT"&&st.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"});return r.onmessage=l=>{const{id:E,imageBitmap:f,error:b,duration:i}=l.data??{},p=i?` worker耗时=${Math.round(i)}ms`:"";console.log(`[renderService] deform worker 响应 id=${E}${p}`,{hasImageBitmap:!!f,width:f==null?void 0:f.width,height:f==null?void 0:f.height,error:b});const d=Xt.get(E);if(d){if(Xt.delete(E),b){d.reject(new Error(b));return}d.resolve(f)}},r.onerror=l=>{console.error("deform worker error",l)},qt.set(x,r),r}function Tn(x){var X,r;return{name:x.name,type:x.type,blendMode:x.blendMode,transform:Array.isArray(x.transform)?[...x.transform]:[],meshPoints:Array.isArray(x.meshPoints)?x.meshPoints.map(l=>({x:l.x,y:l.y,type:l.type})):[],bounds:x.bounds?{width:x.bounds.width,height:x.bounds.height,top:x.bounds.top,left:x.bounds.left,bottom:x.bounds.bottom,right:x.bounds.right}:{width:0,height:0,top:0,left:0},size:x.size?{width:x.size.width,height:x.size.height}:void 0,placedLayer:x.placedLayer?{width:x.placedLayer.width,height:x.placedLayer.height}:void 0,isSmartObject:x.isSmartObject,originalWidth:x.originalWidth,originalHeight:x.originalHeight,quiltSliceX:Array.isArray(x.quiltSliceX)?[...x.quiltSliceX]:void 0,quiltSliceY:Array.isArray(x.quiltSliceY)?[...x.quiltSliceY]:void 0,layerOrder:x.layerOrder,imagePath:x.imagePath,vectorMask:x.vectorMask?{paths:(X=x.vectorMask.paths)==null?void 0:X.map(l=>{var E;return{open:l.open,knots:(E=l.knots)==null?void 0:E.map(f=>({linked:f.linked,points:[...f.points]})),fillRule:l.fillRule,operation:l.operation}}),points:(r=x.vectorMask.points)==null?void 0:r.map(l=>({x:l.x,y:l.y,type:l.type})),invert:x.vectorMask.invert,notLink:x.vectorMask.notLink,disable:x.vectorMask.disable,fillStartsWithAllPixels:x.vectorMask.fillStartsWithAllPixels}:void 0,filterList:x.filterList?x.filterList.map(l=>{var E;return{type:l.type,enabled:l.enabled,filter:l.filter?{puppetShapeList:(E=l.filter.puppetShapeList)==null?void 0:E.map(f=>({originalVertexArray:f.originalVertexArray.map(b=>({x:b.x,y:b.y})),deformedVertexArray:f.deformedVertexArray.map(b=>({x:b.x,y:b.y})),indexArray:[...f.indexArray]}))}:void 0}}):void 0,opacity:x.opacity,clipping:x.clipping}}function gr(x,X,r,l){const E=++Hi,f=zn(r),b=performance.now(),i=new Date().toISOString();return console.log(`[renderService] 📤 发送 deform 任务 id=${E} faceId=${r} 时间=${i}`),new Promise((p,d)=>{Xt.set(E,{resolve:C=>{const m=performance.now(),s=new Date().toISOString(),h=m-b;console.log(`[renderService] 📥 接收 deform 结果 id=${E} 时间=${s} 总耗时=${Math.round(h)}ms`),p(C)},reject:d});const v=Tn(X);f.postMessage({id:E,designBitmap:x,layerData:v,canvasSize:l},[x])})}function qi(){qt.forEach(x=>{x.terminate()}),qt.clear(),Xt.clear()}async function Xi(x,X,r=0,l){const E=await mr(x,l);if(!E||E.width===0||E.height===0)throw new Error("图片无效:尺寸为 0");const f=await gr(E,X,r),b=document.createElement("canvas");b.width=f.width,b.height=f.height;const i=b.getContext("2d");if(!i)throw new Error("无法创建 canvas context");return i.drawImage(f,0,0),new Promise((p,d)=>{b.toBlob(v=>{if(!v){d(new Error("canvas toBlob failed"));return}const C=URL.createObjectURL(v),m=new Image;m.onload=()=>{URL.revokeObjectURL(C),p(m)},m.onerror=()=>{URL.revokeObjectURL(C),d(new Error("变形图片转换失败"))},m.src=C},"image/png")})}async function yr(x,X,r=0,l,E){const f=await mr(x,E);if(!f||f.width===0||f.height===0)throw new Error("图片无效:尺寸为 0");return await gr(f,X,r,l)}function Ct(x,X){if(typeof OffscreenCanvas<"u"&&typeof document>"u")return new OffscreenCanvas(x,X);if(typeof document<"u"){const r=document.createElement("canvas");return r.width=x,r.height=X,r}else throw new Error("无法创建 canvas:不在 Worker 或主线程环境中")}function zt(x){return x.getContext("2d")}function wr(x){const X=zt(x);if(!X)throw new Error("无法创建 canvas context");return X}async function Zi(x,X){const l=xr([{psdJson:x,layerExtrasByName:X}],{parts:[],defaultIdStart:1});if(!l.models||l.models.length===0)throw new Error("无法解析 JSON 数据");const E=l.models[0];if(!E.psdPartData)throw new Error("JSON 数据中没有 psdPartData");const f=[];for(const i of E.psdPartData){if(i.type!==gt.Group)continue;const p=X[i.name],d=(p==null?void 0:p.designImage)??(p==null?void 0:p.url);if(d){if(!i.smartObjects||i.smartObjects.length===0){console.warn(`图层 "${i.name}" 没有 smartObject,跳过变形`);continue}f.push({partData:i,image:d})}}return await Promise.all(f.map(async({partData:i,image:p})=>{const d=i.smartObjects[0],v=i.partId??i.id,C=await yr(p,d,v);return{layerName:i.name,partId:i.partId,imageBitmap:C}}))}async function Zt(x){const X=performance.now(),{psdJson:r,materialList:l,fabricScreenshotList:E,width:f,height:b,baseUrl:i}=x,p=x.maxImageSize,d=Z=>{if(!Z||typeof Z!="string"||!Z.includes("http"))return;if(/^(https?:)?\/\//i.test(Z)||Z.startsWith("data:")||Z.startsWith("blob:"))return Z;if(!i)return!Z.includes("http")&&!Z.startsWith("data:")&&!Z.startsWith("blob:")?void 0:Z;try{const ee=new URL(Z,i).toString();return!ee.includes("http")&&!ee.startsWith("data:")&&!ee.startsWith("blob:")?void 0:ee}catch(ee){console.warn(`[renderByJson] 解析图片 URL 失败: ${Z}`,ee);return}},v={},C=new Map;for(const Z of l)v[Z.sourceName]={url:Z.url},Z.sourceName&&C.set(Z.sourceName,Z.url);const m=new Map;for(const Z of E)m.set(Z.id,Z.url);function s(Z,re){const ee=Z.id??re;if(Z.type==="Group"&&ee&&m.has(ee)){const ce=m.get(ee);if(Z.children){for(const N of Z.children)if(N&&N.isSmartObject===!0){const z=(N==null?void 0:N.name)||"";z&&!v[z]&&(v[z]={}),z&&(v[z].designImage=ce)}}}if(Z.children)for(const ce of Z.children)ce&&s(ce,ee)}if(r.layerList)for(const Z of r.layerList)Z&&s(Z);const n=xr([{psdJson:r,layerExtrasByName:v}],{parts:[],defaultIdStart:1});if(!n.models||n.models.length===0)throw new Error("无法解析 JSON 数据");const e=n.models[0];if(!e.psdPartData)throw new Error("JSON 数据中没有 psdPartData");const o=e.width,c=e.height,y=Ct(o,c),k=wr(y),_=[];for(let Z=0;Z<e.psdPartData.length;Z++){const re=e.psdPartData[Z],ee=v[re.url];if(re.type===gt.Layer){const ce=(ee==null?void 0:ee.url)??re.url,N=d(ce);if(!N){console.warn(`图层 "${re.name}" 没有 url,跳过`);continue}_.push({index:Z,type:"layer",partData:re,promise:Rn(N,p).catch(z=>(console.warn(`⚠️ 加载图层图片失败,将跳过该图层 (${re.name}):`,z.message||z),null))})}else if(re.type===gt.Group){if(!re.smartObjects||re.smartObjects.length===0){console.warn(`图层 "${re.name}" 没有 smartObject,跳过变形`);continue}for(let ce=0;ce<re.smartObjects.length;ce++){const N=re.smartObjects[ce];if(!N||!N.name){console.warn("智能对象无效,跳过");continue}const z=v[N.name]??ee;let Y=(z==null?void 0:z.designImage)??(z==null?void 0:z.url)??N.imagePath;if(typeof Y=="string"&&(/^(https?:)?\/\//i.test(Y)||Y.startsWith("data:")||Y.startsWith("blob:")||(Y=C.get(Y)??Y),Y=d(Y)),!Y){console.warn(`智能对象 "${N.name}" 没有 designImage、url 或 imagePath,跳过变形`);continue}const K=(re.partId??re.id)*100+ce,B=Nn(Sn(N)),ye={width:o,height:c};_.push({index:Z+ce*.01,type:"group",partData:re,smartObject:N,maskData:B,promise:yr(Y,N,K,ye,p).catch(Ce=>(console.warn(`⚠️ 变形失败,将跳过该图层 (${N.name}):`,Ce.message||Ce),null))})}}}const S=await Promise.all(_.map(Z=>Z.promise)),I=_.map((Z,re)=>({task:Z,imageBitmap:S[re]})).sort((Z,re)=>{var N,z;const ee=Z.task.type==="group"&&((N=Z.task.smartObject)==null?void 0:N.layerOrder)!==void 0?Z.task.smartObject.layerOrder:Z.task.partData.layerOrder??Z.task.index,ce=re.task.type==="group"&&((z=re.task.smartObject)==null?void 0:z.layerOrder)!==void 0?re.task.smartObject.layerOrder:re.task.partData.layerOrder??re.task.index;return ee-ce});console.log(`[renderByJson] 开始绘制 ${I.length} 个图层`);let H=Ct(o,c),V=zt(H),T=!1,q="normal";for(let Z=0;Z<I.length;Z++){const{task:re,imageBitmap:ee}=I[Z];if(!ee){console.warn(`[renderByJson] 图层 "${re.partData.name}" 没有 imageBitmap,跳过`);continue}const{partData:ce}=re,N=ce.bounds;let z;re.type==="group"&&re.smartObject?z=re.smartObject.opacity??ce.opacity:z=ce.opacity,(typeof z!="number"||isNaN(z))&&(z=1);let Y;re.type==="group"&&re.smartObject?Y=re.smartObject.clipping??ce.clipping===!0:Y=ce.clipping===!0;const K=I[Z+1];let B=!1;if(K){const Ce=K.task.partData;K.task.type==="group"&&K.task.smartObject?B=K.task.smartObject.clipping??Ce.clipping===!0:B=Ce.clipping===!0}const ye=re.type==="group"&&re.smartObject&&re.smartObject.name?re.smartObject.name:(ce==null?void 0:ce.name)||"未命名图层";if(console.log(`[renderByJson] 绘制图层 "${ye}"`,{type:re.type,bitmapSize:{width:ee.width,height:ee.height},bounds:N,hasMask:!!re.maskData,blendMode:ce.blendMode,opacity:z,clipping:Y}),!Y&&B){if(T=!0,q=ce.blendMode||"normal",V){if(V.clearRect(0,0,o,c),V.globalCompositeOperation="source-over",V.globalAlpha=z,re.type==="group"&&re.smartObject)if(re.maskData){const Ce=Ct(o,c),ue=zt(Ce);ue&&(ue.drawImage(ee,0,0),$t(ue,re.maskData),V.drawImage(Ce,0,0))}else V.drawImage(ee,0,0);else re.type==="layer"&&(N?V.drawImage(ee,N.left,N.top,N.width,N.height):V.drawImage(ee,0,0));V.globalAlpha=1}}else if(Y){if(V){if(V.globalCompositeOperation="source-atop",V.globalAlpha=z,re.type==="group"&&re.smartObject)if(re.maskData){const Ce=Ct(o,c),ue=zt(Ce);ue&&(ue.drawImage(ee,0,0),$t(ue,re.maskData),V.drawImage(Ce,0,0))}else V.drawImage(ee,0,0);else re.type==="layer"&&(N?V.drawImage(ee,N.left,N.top,N.width,N.height):V.drawImage(ee,0,0));V.globalAlpha=1,V.globalCompositeOperation="source-over"}}else{if(k.globalCompositeOperation=vr(ce.blendMode),k.globalAlpha=z,re.type==="group"&&re.smartObject)if(re.maskData){const Ce=Ct(o,c),ue=zt(Ce);ue&&(ue.drawImage(ee,0,0),$t(ue,re.maskData),k.drawImage(Ce,0,0))}else k.drawImage(ee,0,0);else re.type==="layer"&&(N?k.drawImage(ee,N.left,N.top,N.width,N.height):k.drawImage(ee,0,0));k.globalAlpha=1,k.globalCompositeOperation="source-over"}T&&!B&&(k.globalCompositeOperation=vr(q),k.drawImage(H,0,0),k.globalCompositeOperation="source-over",T=!1)}H=null,V=null;let F=y,W=o,w=c;if(f!==void 0||b!==void 0){if(f!==void 0&&b!==void 0)W=f,w=b;else if(f!==void 0){const re=f/o;W=f,w=Math.round(c*re)}else if(b!==void 0){const re=b/c;W=Math.round(o*re),w=b}F=Ct(W,w);const Z=wr(F);Z.imageSmoothingEnabled=!0,Z.imageSmoothingQuality="high",Z.drawImage(y,0,0,o,c,0,0,W,w),console.log(`[renderByJson] 已缩放结果: ${o}x${c} -> ${W}x${w}`)}const he=performance.now()-X;return console.log(`[renderByJson] 绘制完成,总渲染时间: ${Math.round(he)}ms`),{canvas:F,width:W,height:w}}async function On(x,X="canvas.png"){if(x instanceof OffscreenCanvas){const r=document.createElement("canvas");r.width=x.width,r.height=x.height;const l=wr(r),E=await x.transferToImageBitmap();return l.drawImage(E,0,0),E.close(),On(r,X)}try{const r=await new Promise((f,b)=>{x.toBlob(i=>{if(!i){b(new Error("canvas toBlob failed"));return}f(i)},"image/png")}),l=URL.createObjectURL(r),E=document.createElement("a");E.download=X,E.href=l,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(l),console.log(`已下载: ${X}`)}catch(r){throw console.error("下载失败:",r),r}}const br=(x,X)=>{if(!x)return x;const r=hr(x);return Rt(r,X)},Ln=(x,X)=>{var r;return{...x,imagePath:br(x.imagePath,X),children:(r=x.children)==null?void 0:r.map(l=>Ln(l,X))}};async function kr(x){var r,l,E,f;const X=await Et();return X?{...x,materialList:(r=x.materialList)==null?void 0:r.map(b=>({...b,url:br(b.url,X)||b.url})),fabricScreenshotList:(l=x.fabricScreenshotList)==null?void 0:l.map(b=>({...b,url:br(b.url,X)||b.url})),psdJson:{...x.psdJson,layerList:((f=(E=x.psdJson)==null?void 0:E.layerList)==null?void 0:f.map(b=>Ln(b,X)))??[]}}:x}var De=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pn(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}function Gi(x){if(x.__esModule)return x;var X=x.default;if(typeof X=="function"){var r=function l(){return this instanceof l?Reflect.construct(X,arguments,this.constructor):X.apply(this,arguments)};r.prototype=X.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(x).forEach(function(l){var E=Object.getOwnPropertyDescriptor(x,l);Object.defineProperty(r,l,E.get?E:{enumerable:!0,get:function(){return x[l]}})}),r}function Tt(x){throw new Error('Could not dynamically require "'+x+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Un={exports:{}};/*!
|
|
1
|
+
(function(ze,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("fabric")):typeof define=="function"&&define.amd?define(["exports","vue","fabric"],t):(ze=typeof globalThis<"u"?globalThis:ze||self,t(ze.EditorSDK={},ze.Vue,ze.fabric))})(this,function(ze,t,nt){"use strict";var ot=typeof document<"u"?document.currentScript:null;const ir="file_token",sr="file_token_expire_time",Ka=60*1e3,lr=typeof window<"u"&&typeof localStorage<"u";function bn(x){return lr?localStorage.getItem(x):null}function En(x,X){lr&&localStorage.setItem(x,X)}function kn(x){lr&&localStorage.removeItem(x)}function Tt(){return bn(ir)}function cr(x=Ka){if(!Tt())return!0;const r=bn(sr);if(!r)return!1;const l=Number(r);return Date.now()+x>l}function ja(x,X){if(En(ir,x),typeof X=="number"&&X>0){const r=Date.now()+X*1e3;En(sr,String(r))}}function Cn(){kn(ir),kn(sr)}async function Bn(x){var l,k;const X=await x(),r=(l=X==null?void 0:X.data)==null?void 0:l.data;return((k=X==null?void 0:X.data)==null?void 0:k.code)===200&&(r!=null&&r.file_token)?(ja(r.file_token,r.expires_in),r.file_token):null}let dr=null;function Ja(x){dr=x}function Qa(){return dr}function _n(){return typeof window>"u"?null:dr}async function Bt(){if(typeof window>"u")return Tt();const x=Tt();if(x&&!cr())return x;try{const X=await _n();if(x&&(X!=null&&X.fetchFileTokenRefresh)){const r=await Bn(X.fetchFileTokenRefresh);if(r)return r}}catch{}try{const X=_n();return X!=null&&X.fetchFileToken?await Bn(X.fetchFileToken):null}catch{return null}}function An(x){if(!x||x.startsWith("data:")||x.startsWith("blob:"))return!1;try{const X=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(x,X);return!(!r.pathname.includes("/files/")||r.searchParams.has("fileToken"))}catch{return x.includes("/files/")&&!x.includes("fileToken=")}}function Ot(x,X){if(!X||!An(x))return x;const r=/^(https?:)?\/\//i.test(x),l=x.startsWith("//");try{const k=typeof window<"u"?window.location.origin:"http://localhost",f=new URL(x,k);return f.searchParams.has("fileToken")?x:(f.searchParams.set("fileToken",X),r?f.toString():l?f.toString().replace(/^https?:/,""):`${f.pathname}${f.search}${f.hash}`)}catch{return x}}function fr(x){const X=Tt();return!X||cr()?x:Ot(x,X)}function ur(x){try{const X=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(x,X);if(!r.searchParams.has("fileToken"))return x;r.searchParams.delete("fileToken");const l=/^(https?:)?\/\//i.test(x),k=x.startsWith("//");return l?r.toString():k?r.toString().replace(/^https?:/,""):`${r.pathname}${r.search}${r.hash}`}catch{return x.replace(/([?&])fileToken=[^&]*(&)?/,(X,r,l)=>r==="?"&&l?"?":r==="&"&&l?"&":"").replace(/[?&]$/,"")}}async function hr(x){if(!An(x))return x;const X=await Bt();return Ot(x,X)}async function dt(x,X){if(typeof window>"u")return fetch(x,X);const r=ur(x),l=await hr(r),k=await fetch(l,X);if(k.status!==401)return k;Cn();const f=await Bt(),b=Ot(r,f);return fetch(b,X)}const eo={class:"topbar"},to={class:"topbar-left"},ro={class:"product-name"},no={class:"toolbar"},ao={class:"topbar-right"},oo=t.defineComponent({__name:"EditorTopbar",props:{productName:{type:String,default:""},showGrid:{type:Boolean,default:!1}},emits:["add-text","add-label","toggle-grid","clear-canvas","download-png","upload"],setup(x,{emit:X}){const r=X,l=t.ref(null),k=()=>{var b;(b=l.value)==null||b.click()},f=b=>{r("upload",b)};return(b,i)=>(t.openBlock(),t.createElementBlock("header",eo,[t.createElementVNode("div",to,[i[2]||(i[2]=t.createElementVNode("select",{class:"select"},[t.createElementVNode("option",null,"简体中文"),t.createElementVNode("option",null,"English")],-1)),t.createElementVNode("span",ro,t.toDisplayString(x.productName||"定制产品"),1),t.createElementVNode("div",no,[t.createElementVNode("button",{class:"ghost",type:"button",onClick:i[0]||(i[0]=p=>r("add-text"))},"文字"),t.createElementVNode("button",{class:"ghost",type:"button",onClick:k},"图片")])]),t.createElementVNode("div",ao,[t.createElementVNode("button",{class:"primary",type:"button",onClick:i[1]||(i[1]=p=>r("clear-canvas"))},"清空画布")]),t.createElementVNode("input",{ref_key:"fileInput",ref:l,type:"file",accept:"image/*",hidden:"",onChange:f},null,544)]))}}),io={key:0,class:"sidebar-nav"},so={class:"nav-icon"},lo={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",style:{width:"20px",height:"20px"}},co={key:1,class:"sidebar-panel"},fo={key:0,class:"add-buttons"},uo={key:1,class:"toolbar add-buttons-compact"},ho={key:1,class:"layer-tools"},po={class:"tool-grid"},xo={class:"slider-row"},mo=["value"],vo=["value"],go={key:2,class:"text-tools"},yo={class:"control-block"},wo=["value"],bo=["value"],Eo={class:"slider-row"},ko=["value"],Co=["value"],Bo={class:"slider-row"},_o=["value"],Ao=["value"],Do={class:"slider-row"},Fo=["value"],So=["value"],No={class:"color-row"},Io=["value"],Ro={class:"preset-colors"},zo=["onClick"],To={class:"slider-row"},Oo=["value"],Lo=["value"],Po={class:"color-row"},Uo=["value"],Mo={key:3,class:"image-tools"},Wo={class:"mode-grid"},Vo={key:0,class:"slider-row"},$o=["value"],Ho=["value"],qo={key:2,class:"sidebar-panel"},Xo={class:"product-grid"},Zo=["onClick"],Go=["src","alt"],Yo={class:"product-title"},Ko={class:"pagination"},jo={class:"pager"},Jo=["disabled"],Qo={class:"pager-btn",type:"button",disabled:""},ei=["disabled"],ti={key:3,class:"sidebar-panel"},ri={class:"layer-list"},ni=["onClick","title"],ai={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},oi={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ii={class:"layer-thumbnail"},si=["onClick"],li=["onClick"],ci=["onClick"],di=["onClick"],fi=["onClick"],ui=["title","onClick"],hi={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},pi={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},xi=["onClick"],mi={key:0,class:"empty"},Dn=t.defineComponent({__name:"EditorSidebar",props:{activeTab:{type:String,default:"add"},visibleTabs:{type:Array,default:()=>["add","product","layer"]},showNav:{type:Boolean,default:!0},urlInput:{type:String,default:""},productItems:{type:Array,default:()=>[]},productTotal:{type:Number,default:0},productPage:{type:Number,default:1},productPageSize:{type:Number,default:8},productHasPrev:{type:Boolean,default:!1},productHasNext:{type:Boolean,default:!1},selectedProductIndex:{type:Number,default:0},layers:{type:Array,default:()=>[]},activeLayerId:{type:[String,Number],default:null},showImageTools:{type:Boolean,default:!1},imagePatternMode:{type:String,default:""},imagePatternScale:{type:Number,default:100},imagePatternScaleEnabled:{type:Boolean,default:!1},showLayerTools:{type:Boolean,default:!1},layerOpacity:{type:Number,default:1},showTextTools:{type:Boolean,default:!1},textFontFamily:{type:String,default:"Arial"},textFontSize:{type:Number,default:26},textCharSpacing:{type:Number,default:0},textLineHeight:{type:Number,default:1.16},textFill:{type:String,default:"#111827"},textStrokeWidth:{type:Number,default:0},textStroke:{type:String,default:"#000000"}},emits:["update:activeTab","update:urlInput","update:selectedProductIndex","change-product-page","add-text","add-label","add-rect","add-circle","remove-selected","upload","add-image-url","paste-url","select-layer","apply-image-pattern","update-image-pattern-scale","move-layer","flip-layer","rotate-layer","center-layer","update-layer-opacity","update-text-prop","align-layer","scale-layer","duplicate-layer","toggle-layer-visibility","toggle-layer-lock","delete-layer","move-layer-by-id","duplicate-layer-by-id"],setup(x,{emit:X}){const r=x,l=X,k=["Arial","Times New Roman","Courier New","Roboto","Pacifico","Montserrat"],f=["#000000","#ffffff","#ef4444","#f59e0b","#10b981","#3b82f6"],b=t.ref(null),i=()=>{var n;(n=b.value)==null||n.click()},p=n=>{l("upload",n)},d=new Map,v=t.ref(0),C=async()=>{await Bt(),v.value++};t.onMounted(C),t.watch(()=>r.productItems,()=>{C()},{deep:!0,immediate:!0});const m=n=>(v.value,n?fr(n):""),s=(n,e)=>{!n||!(e!=null&&e.object)||(d.set(e.id,{canvas:n,layer:e}),t.nextTick(()=>{h(n,e.object)}))},h=(n,e)=>{var c,y,E;if(!n||!e)return;const o=n.getContext("2d");if(o){if(o.clearRect(0,0,40,40),o.fillStyle="#f1f5f9",o.fillRect(0,0,40,40),(c=e==null?void 0:e.customData)!=null&&c.isPatternRect){const _=((y=e==null?void 0:e.customData)==null?void 0:y.patternSource)||((E=e==null?void 0:e.customData)==null?void 0:E.savedSrc)||"";if(_&&typeof _=="string"){const S=new Image;S.crossOrigin="anonymous",S.onload=()=>{try{const I=Math.min(40/S.width,40/S.height,1),$=S.width*I,W=S.height*I,T=(40-$)/2,q=(40-W)/2;o.clearRect(0,0,40,40),o.fillStyle="#f1f5f9",o.fillRect(0,0,40,40),o.drawImage(S,T,q,$,W)}catch{o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20)}},S.onerror=()=>{o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20)},hr(_).then(I=>{S.src=I}).catch(()=>{S.src=_});return}o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20);return}if(e.type==="image"&&e._element)try{const _=e._element,S=Math.min(40/(e.width||40),40/(e.height||40),1),I=(e.width||40)*S,$=(e.height||40)*S,W=(40-I)/2,T=(40-$)/2;o.drawImage(_,W,T,I,$)}catch{o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20)}else e.type==="textbox"||e.type==="text"?(o.fillStyle="#475569",o.font="10px Arial",o.fillText("T",15,25)):e.type==="rect"?(o.fillStyle="#6366f1",o.fillRect(10,10,20,20)):e.type==="circle"?(o.fillStyle="#6366f1",o.beginPath(),o.arc(20,20,10,0,Math.PI*2),o.fill()):(o.fillStyle="#cbd5e1",o.fillRect(10,10,20,20))}};return t.watch(()=>r.layers,()=>{t.nextTick(()=>{d.forEach(({canvas:n,layer:e})=>{e!=null&&e.object&&h(n,e.object)})})},{deep:!0}),(n,e)=>(t.openBlock(),t.createElementBlock("aside",{class:t.normalizeClass(["sidebar",{"sidebar-no-nav":!x.showNav}])},[x.showNav?(t.openBlock(),t.createElementBlock("div",io,[x.visibleTabs.includes("add")?(t.openBlock(),t.createElementBlock("button",{key:0,class:t.normalizeClass(["nav-item",{active:x.activeTab==="add"}]),type:"button",onClick:e[0]||(e[0]=o=>l("update:activeTab","add"))},[t.createElementVNode("span",so,[(t.openBlock(),t.createElementBlock("svg",lo,[...e[46]||(e[46]=[t.createElementVNode("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"},null,-1)])]))]),e[47]||(e[47]=t.createElementVNode("span",{class:"nav-label"},"操作",-1))],2)):t.createCommentVNode("",!0),x.visibleTabs.includes("product")?(t.openBlock(),t.createElementBlock("button",{key:1,class:t.normalizeClass(["nav-item",{active:x.activeTab==="product"}]),type:"button",onClick:e[1]||(e[1]=o=>l("update:activeTab","product"))},[...e[48]||(e[48]=[t.createElementVNode("span",{class:"nav-icon"},"🛍️",-1),t.createElementVNode("span",{class:"nav-label"},"产品",-1)])],2)):t.createCommentVNode("",!0),x.visibleTabs.includes("layer")?(t.openBlock(),t.createElementBlock("button",{key:2,class:t.normalizeClass(["nav-item",{active:x.activeTab==="layer"}]),type:"button",onClick:e[2]||(e[2]=o=>l("update:activeTab","layer"))},[...e[49]||(e[49]=[t.createElementVNode("span",{class:"nav-icon"},"⧉",-1),t.createElementVNode("span",{class:"nav-label"},"图层",-1)])],2)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),x.visibleTabs.includes("add")&&x.activeTab==="add"?(t.openBlock(),t.createElementBlock("div",co,[!x.showTextTools&&!x.showImageTools&&!x.showLayerTools?(t.openBlock(),t.createElementBlock("div",fo,[x.showNav?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("button",{class:"add-btn",type:"button",onClick:e[3]||(e[3]=o=>l("add-text"))},[...e[50]||(e[50]=[t.createElementVNode("div",{class:"add-btn-icon"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M4 20h16M4 4h16M9 12h6"})])],-1),t.createElementVNode("span",{class:"add-btn-text"},"添加文字",-1)])]),t.createElementVNode("button",{class:"add-btn",type:"button",onClick:i},[...e[51]||(e[51]=[t.createStaticVNode('<div class="add-btn-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></div><span class="add-btn-text">添加图片</span>',2)])])],64)):(t.openBlock(),t.createElementBlock("div",uo,[t.createElementVNode("button",{class:"ghost",type:"button",onClick:e[4]||(e[4]=o=>l("add-text"))},"添加文字"),t.createElementVNode("button",{class:"ghost",type:"button",onClick:i},"添加图片")]))])):t.createCommentVNode("",!0),x.showLayerTools?(t.openBlock(),t.createElementBlock("div",ho,[e[71]||(e[71]=t.createElementVNode("h4",{class:"panel-subtitle"},"图层操作",-1)),t.createElementVNode("div",po,[t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层置顶",onClick:e[5]||(e[5]=o=>l("move-layer-by-id",x.activeLayerId,"top"))},[...e[52]||(e[52]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"12",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"8",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"4",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层置底",onClick:e[6]||(e[6]=o=>l("move-layer-by-id",x.activeLayerId,"bot"))},[...e[53]||(e[53]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"4",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"10",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"16",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层上移",onClick:e[7]||(e[7]=o=>l("move-layer-by-id",x.activeLayerId,"up"))},[...e[54]||(e[54]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"8",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"4",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"14",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"图层下移",onClick:e[8]||(e[8]=o=>l("move-layer-by-id",x.activeLayerId,"down"))},[...e[55]||(e[55]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"3",y:"4",width:"14",height:"8",rx:"1"}),t.createElementVNode("rect",{x:"5",y:"10",width:"10",height:"6",rx:"1"}),t.createElementVNode("rect",{x:"7",y:"16",width:"6",height:"4",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"复制图层",onClick:e[9]||(e[9]=o=>l("duplicate-layer"))},[...e[56]||(e[56]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.createElementVNode("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"删除图层",onClick:e[10]||(e[10]=o=>l("remove-selected"))},[...e[57]||(e[57]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),t.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"左对齐",onClick:e[11]||(e[11]=o=>l("align-layer","left"))},[...e[58]||(e[58]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"3",y1:"12",x2:"3",y2:"12","stroke-width":"3"}),t.createElementVNode("rect",{x:"6",y:"8",width:"12",height:"8",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"水平对齐",onClick:e[12]||(e[12]=o=>l("align-layer","hcenter"))},[...e[59]||(e[59]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"12",y1:"3",x2:"12",y2:"21","stroke-width":"2"}),t.createElementVNode("rect",{x:"6",y:"8",width:"12",height:"8",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"右对齐",onClick:e[13]||(e[13]=o=>l("align-layer","right"))},[...e[60]||(e[60]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"21",y1:"12",x2:"21",y2:"12","stroke-width":"3"}),t.createElementVNode("rect",{x:"6",y:"8",width:"12",height:"8",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"上对齐",onClick:e[14]||(e[14]=o=>l("align-layer","top"))},[...e[61]||(e[61]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"12",y1:"3",x2:"12",y2:"3","stroke-width":"3"}),t.createElementVNode("rect",{x:"8",y:"6",width:"8",height:"12",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"垂直对齐",onClick:e[15]||(e[15]=o=>l("align-layer","vcenter"))},[...e[62]||(e[62]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"3",y1:"12",x2:"21",y2:"12","stroke-width":"2"}),t.createElementVNode("rect",{x:"8",y:"6",width:"8",height:"12",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"下对齐",onClick:e[16]||(e[16]=o=>l("align-layer","bottom"))},[...e[63]||(e[63]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("line",{x1:"12",y1:"21",x2:"12",y2:"21","stroke-width":"3"}),t.createElementVNode("rect",{x:"8",y:"6",width:"8",height:"12",rx:"1"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"放大",onClick:e[17]||(e[17]=o=>l("scale-layer","up"))},[...e[64]||(e[64]=[t.createStaticVNode('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>',1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"缩小",onClick:e[18]||(e[18]=o=>l("scale-layer","down"))},[...e[65]||(e[65]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),t.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),t.createElementVNode("line",{x1:"8",y1:"11",x2:"14",y2:"11"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"逆时针旋转",onClick:e[19]||(e[19]=o=>l("rotate-layer","ccw"))},[...e[66]||(e[66]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"顺时针旋转",onClick:e[20]||(e[20]=o=>l("rotate-layer","cw"))},[...e[67]||(e[67]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M2.5 2v6h6M21.5 22v-6h6M22 12.5a10 10 0 0 1-18.8 4.2M2 11.5a10 10 0 0 1 18.8-4.3"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"水平翻转",onClick:e[21]||(e[21]=o=>l("flip-layer","X"))},[...e[68]||(e[68]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3"}),t.createElementVNode("line",{x1:"12",y1:"3",x2:"12",y2:"21","stroke-dasharray":"2 2"})],-1)])]),t.createElementVNode("button",{class:"tool-btn",type:"button",title:"垂直翻转",onClick:e[22]||(e[22]=o=>l("flip-layer","Y"))},[...e[69]||(e[69]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M3 8V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3M3 16v3a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-3"}),t.createElementVNode("line",{x1:"3",y1:"12",x2:"21",y2:"12","stroke-dasharray":"2 2"})],-1)])])]),t.createElementVNode("div",xo,[e[70]||(e[70]=t.createElementVNode("span",{class:"slider-label"},"透明度",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"0",max:"1",step:"0.05",value:x.layerOpacity,onInput:e[23]||(e[23]=o=>l("update-layer-opacity",o.target.value))},null,40,mo),t.createElementVNode("input",{class:"number-input",type:"number",min:"0",max:"1",step:"0.05",value:x.layerOpacity,onInput:e[24]||(e[24]=o=>l("update-layer-opacity",o.target.value))},null,40,vo)])])):t.createCommentVNode("",!0),x.showTextTools?(t.openBlock(),t.createElementBlock("div",go,[e[78]||(e[78]=t.createElementVNode("h4",{class:"panel-subtitle"},"文字排版",-1)),t.createElementVNode("div",yo,[t.createElementVNode("select",{class:"select",value:x.textFontFamily,onChange:e[25]||(e[25]=o=>l("update-text-prop","fontFamily",o.target.value))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(k,o=>t.createElementVNode("option",{key:o,value:o},t.toDisplayString(o),9,bo)),64))],40,wo)]),t.createElementVNode("div",Eo,[e[72]||(e[72]=t.createElementVNode("span",{class:"slider-label"},"字号",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"10",max:"300",step:"1",value:x.textFontSize,onInput:e[26]||(e[26]=o=>l("update-text-prop","fontSize",o.target.value))},null,40,ko),t.createElementVNode("input",{class:"number-input",type:"number",min:"10",max:"300",step:"1",value:x.textFontSize,onInput:e[27]||(e[27]=o=>l("update-text-prop","fontSize",o.target.value))},null,40,Co)]),t.createElementVNode("div",Bo,[e[73]||(e[73]=t.createElementVNode("span",{class:"slider-label"},"字距",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"-100",max:"800",step:"10",value:x.textCharSpacing,onInput:e[28]||(e[28]=o=>l("update-text-prop","charSpacing",o.target.value))},null,40,_o),t.createElementVNode("input",{class:"number-input",type:"number",min:"-100",max:"800",step:"10",value:x.textCharSpacing,onInput:e[29]||(e[29]=o=>l("update-text-prop","charSpacing",o.target.value))},null,40,Ao)]),t.createElementVNode("div",Do,[e[74]||(e[74]=t.createElementVNode("span",{class:"slider-label"},"行高",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"0.5",max:"3",step:"0.1",value:x.textLineHeight,onInput:e[30]||(e[30]=o=>l("update-text-prop","lineHeight",o.target.value))},null,40,Fo),t.createElementVNode("input",{class:"number-input",type:"number",min:"0.5",max:"3",step:"0.1",value:x.textLineHeight,onInput:e[31]||(e[31]=o=>l("update-text-prop","lineHeight",o.target.value))},null,40,So)]),t.createElementVNode("div",No,[e[75]||(e[75]=t.createElementVNode("span",null,"文本颜色",-1)),t.createElementVNode("label",{class:"color-preview",style:t.normalizeStyle({background:x.textFill})},[t.createElementVNode("input",{type:"color",value:x.textFill,onInput:e[32]||(e[32]=o=>l("update-text-prop","fill",o.target.value))},null,40,Io)],4)]),t.createElementVNode("div",Ro,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(f,o=>t.createElementVNode("button",{key:o,class:"color-chip",type:"button",style:t.normalizeStyle({background:o}),onClick:c=>l("update-text-prop","fill",o)},null,12,zo)),64))]),e[79]||(e[79]=t.createElementVNode("h4",{class:"panel-subtitle"},"描边与背景",-1)),t.createElementVNode("div",To,[e[76]||(e[76]=t.createElementVNode("span",{class:"slider-label"},"粗细",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"0",max:"10",step:"0.1",value:x.textStrokeWidth,onInput:e[33]||(e[33]=o=>l("update-text-prop","strokeWidth",o.target.value))},null,40,Oo),t.createElementVNode("input",{class:"number-input",type:"number",min:"0",max:"10",step:"0.1",value:x.textStrokeWidth,onInput:e[34]||(e[34]=o=>l("update-text-prop","strokeWidth",o.target.value))},null,40,Lo)]),t.createElementVNode("div",Po,[e[77]||(e[77]=t.createElementVNode("span",null,"描边色",-1)),t.createElementVNode("label",{class:"color-preview",style:t.normalizeStyle({background:x.textStroke})},[t.createElementVNode("input",{type:"color",value:x.textStroke,onInput:e[35]||(e[35]=o=>l("update-text-prop","stroke",o.target.value))},null,40,Uo)],4)])])):t.createCommentVNode("",!0),x.showImageTools?(t.openBlock(),t.createElementBlock("div",Mo,[e[81]||(e[81]=t.createElementVNode("h4",{class:"panel-subtitle"},"图片操作",-1)),t.createElementVNode("div",Wo,[t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="grid"}]),type:"button",onClick:e[36]||(e[36]=o=>l("apply-image-pattern","grid"))}," 基础 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="brick-x"}]),type:"button",onClick:e[37]||(e[37]=o=>l("apply-image-pattern","brick-x"))}," 横向交错 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="brick-y"}]),type:"button",onClick:e[38]||(e[38]=o=>l("apply-image-pattern","brick-y"))}," 纵向交错 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="mirror"}]),type:"button",onClick:e[39]||(e[39]=o=>l("apply-image-pattern","mirror"))}," 镜像 ",2),t.createElementVNode("button",{class:t.normalizeClass(["mode-card",{active:x.imagePatternMode==="random"}]),type:"button",onClick:e[40]||(e[40]=o=>l("apply-image-pattern","random"))}," 随机 ",2)]),x.imagePatternScaleEnabled?(t.openBlock(),t.createElementBlock("div",Vo,[e[80]||(e[80]=t.createElementVNode("span",{class:"slider-label"},"缩放",-1)),t.createElementVNode("input",{class:"slider-input",type:"range",min:"1",max:"200",step:"1",value:x.imagePatternScale,onInput:e[41]||(e[41]=o=>l("update-image-pattern-scale",o.target.value))},null,40,$o),t.createElementVNode("input",{class:"number-input",type:"number",min:"1",max:"200",step:"1",value:x.imagePatternScale,onInput:e[42]||(e[42]=o=>l("update-image-pattern-scale",o.target.value))},null,40,Ho)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("input",{ref_key:"fileInput",ref:b,type:"file",accept:"image/*",hidden:"",onChange:p},null,544)])):t.createCommentVNode("",!0),x.visibleTabs.includes("product")&&x.activeTab==="product"?(t.openBlock(),t.createElementBlock("div",qo,[e[82]||(e[82]=t.createElementVNode("h3",{class:"panel-title"},"产品",-1)),t.createElementVNode("div",Xo,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.productItems,(o,c)=>(t.openBlock(),t.createElementBlock("button",{key:o.id,class:t.normalizeClass(["product-card",{active:x.selectedProductIndex===c}]),type:"button",onClick:y=>l("update:selectedProductIndex",c)},[t.createElementVNode("img",{src:m(o.coverImg),alt:o.name},null,8,Go),t.createElementVNode("span",Yo,t.toDisplayString(o.name),1)],10,Zo))),128))]),t.createElementVNode("div",Ko,[t.createElementVNode("span",null,"共"+t.toDisplayString(x.productTotal)+"条",1),t.createElementVNode("div",jo,[t.createElementVNode("button",{class:"pager-btn",type:"button",disabled:!x.productHasPrev,onClick:e[43]||(e[43]=o=>l("change-product-page",x.productPage-1))}," 上一页 ",8,Jo),t.createElementVNode("button",Qo,t.toDisplayString(x.productPage),1),t.createElementVNode("button",{class:"pager-btn",type:"button",disabled:!x.productHasNext,onClick:e[44]||(e[44]=o=>l("change-product-page",x.productPage+1))}," 下一页 ",8,ei)])])])):t.createCommentVNode("",!0),x.visibleTabs.includes("layer")&&x.activeTab==="layer"?(t.openBlock(),t.createElementBlock("div",ti,[e[93]||(e[93]=t.createElementVNode("h3",{class:"panel-title"},"图层",-1)),t.createElementVNode("div",ri,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.layers,o=>(t.openBlock(),t.createElementBlock("div",{key:o.id,class:t.normalizeClass(["layer-item",{active:x.activeLayerId===o.id,hidden:!o.visible,locked:o.locked}]),style:{display:"flex"}},[t.createElementVNode("div",{class:"layer-actions",onClick:e[45]||(e[45]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("button",{class:"layer-visibility-btn",type:"button",onClick:t.withModifiers(c=>l("toggle-layer-visibility",o),["stop"]),title:o.visible?"隐藏":"显示"},[o.visible?(t.openBlock(),t.createElementBlock("svg",ai,[...e[83]||(e[83]=[t.createElementVNode("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),t.createElementVNode("circle",{cx:"12",cy:"12",r:"3"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",oi,[...e[84]||(e[84]=[t.createElementVNode("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),t.createElementVNode("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)])]))],8,ni),t.createElementVNode("div",ii,[t.createElementVNode("canvas",{ref_for:!0,ref:c=>s(c,o),class:"layer-thumbnail-canvas",width:"40",height:"40"},null,512)]),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"置顶",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"top"),["stop"])},[...e[85]||(e[85]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 19V5M5 12l7-7 7 7"})],-1)])],8,si),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"上移一层",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"up"),["stop"])},[...e[86]||(e[86]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M18 15l-6-6-6 6"})],-1)])],8,li),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"下移一层",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"down"),["stop"])},[...e[87]||(e[87]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M6 9l6 6 6-6"})],-1)])],8,ci),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"置底",onClick:t.withModifiers(c=>l("move-layer-by-id",o.id,"bot"),["stop"])},[...e[88]||(e[88]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 5v14M19 12l-7 7-7-7"})],-1)])],8,di),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:"复制",onClick:t.withModifiers(c=>l("duplicate-layer-by-id",o.id),["stop"])},[...e[89]||(e[89]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.createElementVNode("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)])],8,fi),t.createElementVNode("button",{class:"layer-action-btn",type:"button",title:o.locked?"解锁":"锁定",onClick:t.withModifiers(c=>l("toggle-layer-lock",o),["stop"])},[o.locked?(t.openBlock(),t.createElementBlock("svg",hi,[...e[90]||(e[90]=[t.createElementVNode("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",pi,[...e[91]||(e[91]=[t.createElementVNode("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M7 11V7a5 5 0 0 1 9.33-2.5"},null,-1)])]))],8,ui),t.createElementVNode("button",{class:"layer-action-btn danger",type:"button",title:"删除",onClick:t.withModifiers(c=>l("delete-layer",o),["stop"])},[...e[92]||(e[92]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),t.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])],8,xi)])],2))),128)),x.layers.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",mi,"暂无图层"))])])):t.createCommentVNode("",!0)],2))}}),vi={class:"canvas-section"},gi={class:"canvas-toolbar"},yi={class:"toolbar-left"},wi={key:0,class:"status"},bi={key:0},Ei={key:1},ki={class:"canvas-footer"},Ci={class:"footer-left"},Bi={key:0,class:"copy-dropdown"},_i={class:"copy-item"},Ai=["checked"],Di={class:"copy-list"},Fi=["checked","onChange"],Si={class:"copy-actions"},Ni=["disabled"],Ii={class:"diecut-panel"},Ri={class:"diecut-list"},zi=["onClick"],Ti=["src","alt"],Oi={class:"footer-right"},Li={class:"zoom-controls"},Pi={class:"zoom-value"},Ui=t.defineComponent({__name:"CanvasSection",props:{sizeOptions:{type:Array,default:()=>[]},selectedSize:{type:String,default:""},loadingTemplate:{type:Boolean,default:!1},templateError:{type:String,default:""},diecutOptions:{type:Array,default:()=>[]},selectedDiecutId:{type:String,default:""},zoom:{type:Number,default:100}},emits:["update:selectedSize","update:selectedDiecutId","canvas-ready","zoom-in","zoom-out","fit-canvas","copy-to-diecuts"],setup(x,{emit:X}){const r=x,l=X,k=t.ref(null),f=t.ref(null),b=t.ref(!1),i=t.ref([]),p=t.ref(0),d=async()=>{await Bt(),p.value++},v=t.computed(()=>(r.diecutOptions||[]).filter(y=>y.id!==r.selectedDiecutId)),C=t.computed(()=>v.value.length>0&&i.value.length===v.value.length),m=y=>{l("update:selectedDiecutId",y)},s=()=>{b.value=!b.value},h=()=>{C.value?i.value=[]:i.value=v.value.map(y=>y.id)},n=y=>{y&&(i.value.includes(y)?i.value=i.value.filter(E=>E!==y):i.value=[...i.value,y])},e=()=>{b.value=!1,i.value=[]},o=()=>{i.value.length&&(l("copy-to-diecuts",[...i.value]),e())};t.watch(v,y=>{const E=new Set(y.map(_=>_.id));i.value=i.value.filter(_=>E.has(_))}),t.watch(()=>r.diecutOptions,()=>{d()},{deep:!0,immediate:!0});const c=y=>(p.value,y?fr(y):"");return t.onMounted(()=>{l("canvas-ready",{canvasWrap:k.value,canvasEl:f.value})}),(y,E)=>(t.openBlock(),t.createElementBlock("section",vi,[t.createElementVNode("div",gi,[t.createElementVNode("div",yi,[x.loadingTemplate||x.templateError?(t.openBlock(),t.createElementBlock("div",wi,[x.loadingTemplate?(t.openBlock(),t.createElementBlock("span",bi,"模板加载中...")):(t.openBlock(),t.createElementBlock("span",Ei,t.toDisplayString(x.templateError),1))])):t.createCommentVNode("",!0)])]),t.createElementVNode("div",{class:"canvas-container",ref_key:"localCanvasWrap",ref:k},[t.createElementVNode("canvas",{ref_key:"localCanvasEl",ref:f},null,512)],512),t.createElementVNode("div",ki,[t.createElementVNode("div",Ci,[t.createElementVNode("div",{class:"copy-panel",onClick:E[0]||(E[0]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("button",{class:"copy-btn",type:"button",onClick:s},"复制至"),b.value?(t.openBlock(),t.createElementBlock("div",Bi,[t.createElementVNode("label",_i,[t.createElementVNode("input",{type:"checkbox",checked:C.value,onChange:h},null,40,Ai),E[4]||(E[4]=t.createElementVNode("span",null,"全选",-1))]),t.createElementVNode("div",Di,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.value,_=>(t.openBlock(),t.createElementBlock("label",{key:_.id,class:"copy-item"},[t.createElementVNode("input",{type:"checkbox",checked:i.value.includes(_.id),onChange:S=>n(_.id)},null,40,Fi),t.createElementVNode("span",null,t.toDisplayString(_.name),1)]))),128))]),t.createElementVNode("div",Si,[t.createElementVNode("button",{class:"ghost",type:"button",onClick:e},"取消"),t.createElementVNode("button",{class:"primary small",type:"button",disabled:!i.value.length,onClick:o}," 确认 ",8,Ni)])])):t.createCommentVNode("",!0)]),E[5]||(E[5]=t.createElementVNode("div",{class:"footer-divider"},null,-1)),t.createElementVNode("div",Ii,[t.createElementVNode("div",Ri,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.diecutOptions,_=>(t.openBlock(),t.createElementBlock("button",{key:_.id,class:t.normalizeClass(["diecut-item",{active:x.selectedDiecutId===_.id}]),type:"button",onClick:S=>m(_.id)},[t.createElementVNode("img",{src:c(_.url),alt:_.name},null,8,Ti),t.createElementVNode("span",null,t.toDisplayString(_.name),1)],10,zi))),128))])])]),t.createElementVNode("div",Oi,[t.createElementVNode("div",Li,[t.createElementVNode("button",{class:"zoom-btn",type:"button",onClick:E[1]||(E[1]=_=>l("zoom-out")),title:"缩小"},[...E[6]||(E[6]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},[t.createElementVNode("path",{d:"M3 7h8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])]),t.createElementVNode("span",Pi,t.toDisplayString(x.zoom)+"%",1),t.createElementVNode("button",{class:"zoom-btn",type:"button",onClick:E[2]||(E[2]=_=>l("zoom-in")),title:"放大"},[...E[7]||(E[7]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},[t.createElementVNode("path",{d:"M7 3v8M3 7h8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])]),E[8]||(E[8]=t.createElementVNode("div",{class:"zoom-divider"},null,-1)),t.createElementVNode("button",{class:"fit-btn",type:"button",onClick:E[3]||(E[3]=_=>l("fit-canvas")),title:"适配画布"}," 适配 ")])])])]))}});var Fn=(x=>(x[x.Drawing=0]="Drawing",x[x.Material=1]="Material",x))(Fn||{}),wt=(x=>(x[x.Group=0]="Group",x[x.Layer=1]="Layer",x))(wt||{});function Mi(x){let X=x;return()=>{const r=X;return X+=1,r}}function Wi(x,X){return{name:x.name||"",type:x.type||"Layer",blendMode:x.blendMode||"normal",transform:x.transform??[],meshPoints:x.meshPoints,bounds:x.bounds??{left:0,top:0,width:0,height:0},isSmartObject:x.isSmartObject??!1,size:x.size,originalWidth:x.originalWidth,originalHeight:x.originalHeight,placedLayer:x.placedLayer,quiltSliceX:x.quiltSliceX,quiltSliceY:x.quiltSliceY,layerOrder:x.layerOrder,imagePath:x.imagePath,vectorMask:x.vectorMask??X,filterList:x.filterList,opacity:x.opacity,clipping:x.clipping}}function Vi(x,X,r,l){let k=x.name||"",f=X[k],b=(f==null?void 0:f.partId)??(x.type==="Group"?r.get(k):void 0);if(x.type==="Group"&&b===void 0&&(!f||f.id===void 0)&&x.children&&x.children.length===1){const d=x.children[0].name,v=X[d],C=(v==null?void 0:v.partId)??r.get(d);(C!==void 0||(v==null?void 0:v.id)!==void 0)&&(k=d,f=v,b=C)}const i=x.id??(f==null?void 0:f.id)??l();if(x.type==="Group")return{id:i,partId:b,name:k,blendMode:x.blendMode||"normal",bounds:x.bounds||{left:0,top:0,width:0,height:0},type:wt.Group,smartObjects:(x.children??[]).map(d=>Wi(d,x.vectorMask)),opacity:x.opacity,clipping:x.clipping,layerOrder:x.layerOrder};let p=f==null?void 0:f.url;return!p&&x.imagePath&&(p=x.imagePath),{id:i,name:x.name||"",blendMode:x.blendMode||"normal",bounds:x.bounds||{left:0,top:0,width:0,height:0},type:wt.Layer,url:p,opacity:x.opacity,clipping:x.clipping,layerOrder:x.layerOrder}}function pr(x,X){const r=new Map(X.parts.map(k=>[k.name,k.id])),l=Mi(X.defaultIdStart??1);return{parts:X.parts,models:x.map(k=>{const f=k.layerExtrasByName??{},b=k.psdJson,i=b.layerList||b.layerList||[],p=b.canvasWidth,d=b.canvasHeight;if(!p||!d)throw new Error(`无法获取 PSD 画布尺寸: canvasWidth=${p}, canvasHeight=${d}。请确保 jsonurl 中的 canvasWidth 和 canvasHeight 存在`);console.log("[psdConverter] 📐 使用 psdJson 画布尺寸:",{canvasWidth:p,canvasHeight:d,note:"应该使用 jsonurl 中的原始尺寸(如 7559x7559)"});const v=[];for(const m of i)if(m.type==="Group"&&m.children){const s=[],h=[],n=[...m.children].sort((e,o)=>{const c=e.layerOrder??0,y=o.layerOrder??0;return c-y});for(const e of n)e.isSmartObject===!0?s.push(e):h.push(e);h.length>0&&v.push(...h),s.length>0&&v.push({...m,children:s})}else v.push(m);const C=v.map(m=>Vi(m,f,r,l));return{width:p,height:d,psdPartData:C}})}}function Sn(x){return x?x.vectorMask&&x.vectorMask.paths&&Array.isArray(x.vectorMask.paths)?{type:"bezier",paths:x.vectorMask.paths}:Array.isArray(x.vectorMask)?{type:"simple",points:x.vectorMask}:null:null}function Nn(x){return x?x.type==="bezier"?{type:"bezier",paths:x.paths.map(X=>({open:!!X.open,knots:X.knots.map(r=>({linked:!!r.linked,points:Array.isArray(r.points)?[...r.points]:[]}))}))}:x.type==="simple"?{type:"simple",points:x.points.map(X=>({x:X.x,y:X.y,type:X.type}))}:null:null}function qt(x,X){if(X){if(x.globalCompositeOperation="destination-in",x.beginPath(),X.type==="bezier"&&Array.isArray(X.paths))X.paths.forEach(r=>{const l=r.knots;if(!l||l.length<2)return;const k=l[0];x.moveTo(k.points[2],k.points[3]);for(let f=0;f<l.length;f++){const b=l[f];let i=(f+1)%l.length;if(!r.open&&f===l.length-1)i=0;else if(r.open&&f===l.length-1)break;const p=l[i],d=b.points[4],v=b.points[5],C=p.points[0],m=p.points[1],s=p.points[2],h=p.points[3];x.bezierCurveTo(d,v,C,m,s,h)}r.open||x.closePath()});else if(X.type==="simple"&&Array.isArray(X.points)){const r=X.points;if(r.length<3)return;x.moveTo(r[0].x,r[0].y);for(let l=1;l<r.length;l++)x.lineTo(r[l].x,r[l].y);x.closePath()}x.fillStyle="#000",x.fill(),x.globalCompositeOperation="source-over"}}const In=x=>{if(!x)return x;if(typeof window<"u"){const r=window.location.hostname;if(r==="localhost"||r==="127.0.0.1")try{const l=new URL(x);if(l.pathname.startsWith("/files/"))return`${l.pathname}${l.search}${l.hash}`}catch{}}if(typeof window<"u"&&window.location.hostname!=="localhost")return x;const X=x.match(/^https?:\/\/([^/]+\.oss[^/]*\.aliyuncs\.com)(.*)$/);return X?`/oss${X[2]}`:x},$i=(x,X)=>{if(typeof OffscreenCanvas<"u"&&typeof document>"u")return new OffscreenCanvas(x,X);const r=document.createElement("canvas");return r.width=x,r.height=X,r},Xt=async(x,X)=>{var p;if(!X||X<=0)return x;const r=Math.max(x.width,x.height);if(r<=X)return x;const l=X/r,k=Math.max(1,Math.round(x.width*l)),f=Math.max(1,Math.round(x.height*l)),b=$i(k,f),i=b.getContext("2d");return i?(i.drawImage(x,0,0,k,f),(p=x.close)==null||p.call(x),await createImageBitmap(b)):x};async function xr(x,X){if(typeof x=="string")try{const r=In(x),l=await dt(r);if(!l.ok){const f=l.status===404?`图片不存在 (404): ${x}`:`加载图片失败 (${l.status} ${l.statusText}): ${x}`;throw new Error(f)}const k=await l.blob();if(!k.type.startsWith("image/")&&k.size===0)throw new Error(`图片数据无效: URL=${x}`);try{const f=await createImageBitmap(k);return await Xt(f,X)}catch(f){throw new Error(`图片解码失败: URL=${x}, 错误=${f instanceof Error?f.message:f}`)}}catch(r){throw r instanceof Error?r:new Error(`加载图片失败: ${x}, ${r}`)}if(x instanceof HTMLImageElement){if((!x.complete||x.naturalWidth===0)&&await new Promise((r,l)=>{x.onload=r,x.onerror=()=>l(new Error(`图片加载失败: src=${x.src}`)),x.complete&&r(null)}),x.naturalWidth===0||x.naturalHeight===0)throw new Error(`图片尺寸无效: src=${x.src}, width=${x.naturalWidth}, height=${x.naturalHeight}`);try{const r=await createImageBitmap(x);return await Xt(r,X)}catch(r){throw new Error(`图片解码失败: src=${x.src}, 错误=${r instanceof Error?r.message:r}`)}}if(x instanceof ImageBitmap){if(x.width===0||x.height===0)throw new Error(`ImageBitmap 尺寸无效: width=${x.width}, height=${x.height}`);return await Xt(x,X)}throw new Error("不支持的图片类型")}async function Rn(x,X){try{const r=In(x),l=await dt(r);if(!l.ok){const f=l.status===404?`图片不存在 (404): ${x}`:`加载图片失败 (${l.status} ${l.statusText}): ${x}`;throw new Error(f)}const k=await l.blob();if(!k.type.startsWith("image/")&&k.size===0)throw new Error(`图片数据无效: URL=${x}`);try{const f=await createImageBitmap(k);return await Xt(f,X)}catch(f){throw new Error(`图片解码失败: URL=${x}, 错误=${f instanceof Error?f.message:f}`)}}catch(r){throw r instanceof Error?r:new Error(`加载图片失败: ${x}, ${r}`)}}function mr(x){if(!x)return"source-over";const X=x.trim().toLowerCase();return{normal:"source-over",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","color dodge":"color-dodge","color-dodge":"color-dodge","color burn":"color-burn","color-burn":"color-burn","hard light":"hard-light","hard-light":"hard-light","soft light":"soft-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion",hue:"hue",saturation:"saturation",color:"color",luminosity:"luminosity","linear burn":"plus-darker","linear dodge":"lighter",lighter:"lighter","pass-through":"source-over"}[X]||"source-over"}const Zt=new Map,Gt=new Map;let Hi=0;function zn(x){const X=Zt.get(x);if(X)return X;const r=new Worker(new URL("/assets/deform.worker-D47nPX6L.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ot&&ot.tagName.toUpperCase()==="SCRIPT"&&ot.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"});return r.onmessage=l=>{const{id:k,imageBitmap:f,error:b,duration:i}=l.data??{},p=i?` worker耗时=${Math.round(i)}ms`:"";console.log(`[renderService] deform worker 响应 id=${k}${p}`,{hasImageBitmap:!!f,width:f==null?void 0:f.width,height:f==null?void 0:f.height,error:b});const d=Gt.get(k);if(d){if(Gt.delete(k),b){d.reject(new Error(b));return}d.resolve(f)}},r.onerror=l=>{console.error("deform worker error",l)},Zt.set(x,r),r}function Tn(x){var X,r;return{name:x.name,type:x.type,blendMode:x.blendMode,transform:Array.isArray(x.transform)?[...x.transform]:[],meshPoints:Array.isArray(x.meshPoints)?x.meshPoints.map(l=>({x:l.x,y:l.y,type:l.type})):[],bounds:x.bounds?{width:x.bounds.width,height:x.bounds.height,top:x.bounds.top,left:x.bounds.left,bottom:x.bounds.bottom,right:x.bounds.right}:{width:0,height:0,top:0,left:0},size:x.size?{width:x.size.width,height:x.size.height}:void 0,placedLayer:x.placedLayer?{width:x.placedLayer.width,height:x.placedLayer.height}:void 0,isSmartObject:x.isSmartObject,originalWidth:x.originalWidth,originalHeight:x.originalHeight,quiltSliceX:Array.isArray(x.quiltSliceX)?[...x.quiltSliceX]:void 0,quiltSliceY:Array.isArray(x.quiltSliceY)?[...x.quiltSliceY]:void 0,layerOrder:x.layerOrder,imagePath:x.imagePath,vectorMask:x.vectorMask?{paths:(X=x.vectorMask.paths)==null?void 0:X.map(l=>{var k;return{open:l.open,knots:(k=l.knots)==null?void 0:k.map(f=>({linked:f.linked,points:[...f.points]})),fillRule:l.fillRule,operation:l.operation}}),points:(r=x.vectorMask.points)==null?void 0:r.map(l=>({x:l.x,y:l.y,type:l.type})),invert:x.vectorMask.invert,notLink:x.vectorMask.notLink,disable:x.vectorMask.disable,fillStartsWithAllPixels:x.vectorMask.fillStartsWithAllPixels}:void 0,filterList:x.filterList?x.filterList.map(l=>{var k;return{type:l.type,enabled:l.enabled,filter:l.filter?{puppetShapeList:(k=l.filter.puppetShapeList)==null?void 0:k.map(f=>({originalVertexArray:f.originalVertexArray.map(b=>({x:b.x,y:b.y})),deformedVertexArray:f.deformedVertexArray.map(b=>({x:b.x,y:b.y})),indexArray:[...f.indexArray]}))}:void 0}}):void 0,opacity:x.opacity,clipping:x.clipping}}function vr(x,X,r,l){const k=++Hi,f=zn(r),b=performance.now(),i=new Date().toISOString();return console.log(`[renderService] 📤 发送 deform 任务 id=${k} faceId=${r} 时间=${i}`),new Promise((p,d)=>{Gt.set(k,{resolve:C=>{const m=performance.now(),s=new Date().toISOString(),h=m-b;console.log(`[renderService] 📥 接收 deform 结果 id=${k} 时间=${s} 总耗时=${Math.round(h)}ms`),p(C)},reject:d});const v=Tn(X);f.postMessage({id:k,designBitmap:x,layerData:v,canvasSize:l},[x])})}function qi(){Zt.forEach(x=>{x.terminate()}),Zt.clear(),Gt.clear()}async function Xi(x,X,r=0,l){const k=await xr(x,l);if(!k||k.width===0||k.height===0)throw new Error("图片无效:尺寸为 0");const f=await vr(k,X,r),b=document.createElement("canvas");b.width=f.width,b.height=f.height;const i=b.getContext("2d");if(!i)throw new Error("无法创建 canvas context");return i.drawImage(f,0,0),new Promise((p,d)=>{b.toBlob(v=>{if(!v){d(new Error("canvas toBlob failed"));return}const C=URL.createObjectURL(v),m=new Image;m.onload=()=>{URL.revokeObjectURL(C),p(m)},m.onerror=()=>{URL.revokeObjectURL(C),d(new Error("变形图片转换失败"))},m.src=C},"image/png")})}async function gr(x,X,r=0,l,k){const f=await xr(x,k);if(!f||f.width===0||f.height===0)throw new Error("图片无效:尺寸为 0");return await vr(f,X,r,l)}function _t(x,X){if(typeof OffscreenCanvas<"u"&&typeof document>"u")return new OffscreenCanvas(x,X);if(typeof document<"u"){const r=document.createElement("canvas");return r.width=x,r.height=X,r}else throw new Error("无法创建 canvas:不在 Worker 或主线程环境中")}function Lt(x){return x.getContext("2d")}function yr(x){const X=Lt(x);if(!X)throw new Error("无法创建 canvas context");return X}async function Zi(x,X){const l=pr([{psdJson:x,layerExtrasByName:X}],{parts:[],defaultIdStart:1});if(!l.models||l.models.length===0)throw new Error("无法解析 JSON 数据");const k=l.models[0];if(!k.psdPartData)throw new Error("JSON 数据中没有 psdPartData");const f=[];for(const i of k.psdPartData){if(i.type!==wt.Group)continue;const p=X[i.name],d=(p==null?void 0:p.designImage)??(p==null?void 0:p.url);if(d){if(!i.smartObjects||i.smartObjects.length===0){console.warn(`图层 "${i.name}" 没有 smartObject,跳过变形`);continue}f.push({partData:i,image:d})}}return await Promise.all(f.map(async({partData:i,image:p})=>{const d=i.smartObjects[0],v=i.partId??i.id,C=await gr(p,d,v);return{layerName:i.name,partId:i.partId,imageBitmap:C}}))}async function Yt(x){const X=performance.now(),{psdJson:r,materialList:l,fabricScreenshotList:k,width:f,height:b,baseUrl:i}=x,p=x.maxImageSize,d=Z=>{if(!Z||typeof Z!="string"||!Z.includes("http"))return;if(/^(https?:)?\/\//i.test(Z)||Z.startsWith("data:")||Z.startsWith("blob:"))return Z;if(!i)return!Z.includes("http")&&!Z.startsWith("data:")&&!Z.startsWith("blob:")?void 0:Z;try{const ee=new URL(Z,i).toString();return!ee.includes("http")&&!ee.startsWith("data:")&&!ee.startsWith("blob:")?void 0:ee}catch(ee){console.warn(`[renderByJson] 解析图片 URL 失败: ${Z}`,ee);return}},v={},C=new Map;for(const Z of l)v[Z.sourceName]={url:Z.url},Z.sourceName&&C.set(Z.sourceName,Z.url);const m=new Map;for(const Z of k)m.set(Z.id,Z.url);function s(Z,ne){const ee=Z.id??ne;if(Z.type==="Group"&&ee&&m.has(ee)){const ce=m.get(ee);if(Z.children){for(const N of Z.children)if(N&&N.isSmartObject===!0){const z=(N==null?void 0:N.name)||"";z&&!v[z]&&(v[z]={}),z&&(v[z].designImage=ce)}}}if(Z.children)for(const ce of Z.children)ce&&s(ce,ee)}if(r.layerList)for(const Z of r.layerList)Z&&s(Z);const n=pr([{psdJson:r,layerExtrasByName:v}],{parts:[],defaultIdStart:1});if(!n.models||n.models.length===0)throw new Error("无法解析 JSON 数据");const e=n.models[0];if(!e.psdPartData)throw new Error("JSON 数据中没有 psdPartData");const o=e.width,c=e.height,y=_t(o,c),E=yr(y),_=[];for(let Z=0;Z<e.psdPartData.length;Z++){const ne=e.psdPartData[Z],ee=v[ne.url];if(ne.type===wt.Layer){const ce=(ee==null?void 0:ee.url)??ne.url,N=d(ce);if(!N){console.warn(`图层 "${ne.name}" 没有 url,跳过`);continue}_.push({index:Z,type:"layer",partData:ne,promise:Rn(N,p).catch(z=>(console.warn(`⚠️ 加载图层图片失败,将跳过该图层 (${ne.name}):`,z.message||z),null))})}else if(ne.type===wt.Group){if(!ne.smartObjects||ne.smartObjects.length===0){console.warn(`图层 "${ne.name}" 没有 smartObject,跳过变形`);continue}for(let ce=0;ce<ne.smartObjects.length;ce++){const N=ne.smartObjects[ce];if(!N||!N.name){console.warn("智能对象无效,跳过");continue}const z=v[N.name]??ee;let Y=(z==null?void 0:z.designImage)??(z==null?void 0:z.url)??N.imagePath;if(typeof Y=="string"&&(/^(https?:)?\/\//i.test(Y)||Y.startsWith("data:")||Y.startsWith("blob:")||(Y=C.get(Y)??Y),Y=d(Y)),!Y){console.warn(`智能对象 "${N.name}" 没有 designImage、url 或 imagePath,跳过变形`);continue}const K=(ne.partId??ne.id)*100+ce,B=Nn(Sn(N)),ve={width:o,height:c};_.push({index:Z+ce*.01,type:"group",partData:ne,smartObject:N,maskData:B,promise:gr(Y,N,K,ve,p).catch(Ee=>(console.warn(`⚠️ 变形失败,将跳过该图层 (${N.name}):`,Ee.message||Ee),null))})}}}const S=await Promise.all(_.map(Z=>Z.promise)),I=_.map((Z,ne)=>({task:Z,imageBitmap:S[ne]})).sort((Z,ne)=>{var N,z;const ee=Z.task.type==="group"&&((N=Z.task.smartObject)==null?void 0:N.layerOrder)!==void 0?Z.task.smartObject.layerOrder:Z.task.partData.layerOrder??Z.task.index,ce=ne.task.type==="group"&&((z=ne.task.smartObject)==null?void 0:z.layerOrder)!==void 0?ne.task.smartObject.layerOrder:ne.task.partData.layerOrder??ne.task.index;return ee-ce});console.log(`[renderByJson] 开始绘制 ${I.length} 个图层`);let $=_t(o,c),W=Lt($),T=!1,q="normal";for(let Z=0;Z<I.length;Z++){const{task:ne,imageBitmap:ee}=I[Z];if(!ee){console.warn(`[renderByJson] 图层 "${ne.partData.name}" 没有 imageBitmap,跳过`);continue}const{partData:ce}=ne,N=ce.bounds;let z;ne.type==="group"&&ne.smartObject?z=ne.smartObject.opacity??ce.opacity:z=ce.opacity,(typeof z!="number"||isNaN(z))&&(z=1);let Y;ne.type==="group"&&ne.smartObject?Y=ne.smartObject.clipping??ce.clipping===!0:Y=ce.clipping===!0;const K=I[Z+1];let B=!1;if(K){const Ee=K.task.partData;K.task.type==="group"&&K.task.smartObject?B=K.task.smartObject.clipping??Ee.clipping===!0:B=Ee.clipping===!0}const ve=ne.type==="group"&&ne.smartObject&&ne.smartObject.name?ne.smartObject.name:(ce==null?void 0:ce.name)||"未命名图层";if(console.log(`[renderByJson] 绘制图层 "${ve}"`,{type:ne.type,bitmapSize:{width:ee.width,height:ee.height},bounds:N,hasMask:!!ne.maskData,blendMode:ce.blendMode,opacity:z,clipping:Y}),!Y&&B){if(T=!0,q=ce.blendMode||"normal",W){if(W.clearRect(0,0,o,c),W.globalCompositeOperation="source-over",W.globalAlpha=z,ne.type==="group"&&ne.smartObject)if(ne.maskData){const Ee=_t(o,c),ue=Lt(Ee);ue&&(ue.drawImage(ee,0,0),qt(ue,ne.maskData),W.drawImage(Ee,0,0))}else W.drawImage(ee,0,0);else ne.type==="layer"&&(N?W.drawImage(ee,N.left,N.top,N.width,N.height):W.drawImage(ee,0,0));W.globalAlpha=1}}else if(Y){if(W){if(W.globalCompositeOperation="source-atop",W.globalAlpha=z,ne.type==="group"&&ne.smartObject)if(ne.maskData){const Ee=_t(o,c),ue=Lt(Ee);ue&&(ue.drawImage(ee,0,0),qt(ue,ne.maskData),W.drawImage(Ee,0,0))}else W.drawImage(ee,0,0);else ne.type==="layer"&&(N?W.drawImage(ee,N.left,N.top,N.width,N.height):W.drawImage(ee,0,0));W.globalAlpha=1,W.globalCompositeOperation="source-over"}}else{if(E.globalCompositeOperation=mr(ce.blendMode),E.globalAlpha=z,ne.type==="group"&&ne.smartObject)if(ne.maskData){const Ee=_t(o,c),ue=Lt(Ee);ue&&(ue.drawImage(ee,0,0),qt(ue,ne.maskData),E.drawImage(Ee,0,0))}else E.drawImage(ee,0,0);else ne.type==="layer"&&(N?E.drawImage(ee,N.left,N.top,N.width,N.height):E.drawImage(ee,0,0));E.globalAlpha=1,E.globalCompositeOperation="source-over"}T&&!B&&(E.globalCompositeOperation=mr(q),E.drawImage($,0,0),E.globalCompositeOperation="source-over",T=!1)}$=null,W=null;let F=y,V=o,w=c;if(f!==void 0||b!==void 0){if(f!==void 0&&b!==void 0)V=f,w=b;else if(f!==void 0){const ne=f/o;V=f,w=Math.round(c*ne)}else if(b!==void 0){const ne=b/c;V=Math.round(o*ne),w=b}F=_t(V,w);const Z=yr(F);Z.imageSmoothingEnabled=!0,Z.imageSmoothingQuality="high",Z.drawImage(y,0,0,o,c,0,0,V,w),console.log(`[renderByJson] 已缩放结果: ${o}x${c} -> ${V}x${w}`)}const fe=performance.now()-X;return console.log(`[renderByJson] 绘制完成,总渲染时间: ${Math.round(fe)}ms`),{canvas:F,width:V,height:w}}async function On(x,X="canvas.png"){if(x instanceof OffscreenCanvas){const r=document.createElement("canvas");r.width=x.width,r.height=x.height;const l=yr(r),k=await x.transferToImageBitmap();return l.drawImage(k,0,0),k.close(),On(r,X)}try{const r=await new Promise((f,b)=>{x.toBlob(i=>{if(!i){b(new Error("canvas toBlob failed"));return}f(i)},"image/png")}),l=URL.createObjectURL(r),k=document.createElement("a");k.download=X,k.href=l,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(l),console.log(`已下载: ${X}`)}catch(r){throw console.error("下载失败:",r),r}}const wr=(x,X)=>{if(!x)return x;const r=ur(x);return Ot(r,X)},Ln=(x,X)=>{var r;return{...x,imagePath:wr(x.imagePath,X),children:(r=x.children)==null?void 0:r.map(l=>Ln(l,X))}};async function br(x){var r,l,k,f;const X=await Bt();return X?{...x,materialList:(r=x.materialList)==null?void 0:r.map(b=>({...b,url:wr(b.url,X)||b.url})),fabricScreenshotList:(l=x.fabricScreenshotList)==null?void 0:l.map(b=>({...b,url:wr(b.url,X)||b.url})),psdJson:{...x.psdJson,layerList:((f=(k=x.psdJson)==null?void 0:k.layerList)==null?void 0:f.map(b=>Ln(b,X)))??[]}}:x}var Fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pn(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}function Gi(x){if(x.__esModule)return x;var X=x.default;if(typeof X=="function"){var r=function l(){return this instanceof l?Reflect.construct(X,arguments,this.constructor):X.apply(this,arguments)};r.prototype=X.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(x).forEach(function(l){var k=Object.getOwnPropertyDescriptor(x,l);Object.defineProperty(r,l,k.get?k:{enumerable:!0,get:function(){return x[l]}})}),r}function Pt(x){throw new Error('Could not dynamically require "'+x+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Un={exports:{}};/*!
|
|
2
2
|
|
|
3
3
|
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
4
4
|
<http://stuartk.com/jszip>
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
JSZip uses the library pako released under the MIT license :
|
|
10
10
|
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
11
|
-
*/(function(x,X){(function(r){x.exports=r()})(function(){return function r(l,
|
|
12
|
-
\0`,K+=f(N,2),K+=S.magic,K+=f(y,2),K+=f(k,2),K+=f(ce.crc32,4),K+=f(ce.compressedSize,4),K+=f(ce.uncompressedSize,4),K+=f(H.length,2),K+=f(j.length,2),{fileRecord:C.LOCAL_FILE_HEADER+K+H+j,dirRecord:C.CENTRAL_FILE_HEADER+f(Y,2)+K+f(q.length,2)+"\0\0\0\0"+f(z,4)+f(e,4)+H+j+q}}var i=r("../utils"),p=r("../stream/GenericWorker"),d=r("../utf8"),v=r("../crc32"),C=r("../signature");function m(s,h,n,e){p.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=n,this.encodeFileName=e,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(m,p),m.prototype.push=function(s){var h=s.meta.percent||0,n=this.entriesCount,e=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,p.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:n?(h+100*(n-e-1))/n:100}}))},m.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var h=this.streamFiles&&!s.file.dir;if(h){var n=b(s,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(s){this.accumulate=!1;var h=this.streamFiles&&!s.file.dir,n=b(s,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),h)this.push({data:function(e){return C.DATA_DESCRIPTOR+f(e.crc32,4)+f(e.compressedSize,4)+f(e.uncompressedSize,4)}(s),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var s=this.bytesWritten,h=0;h<this.dirRecords.length;h++)this.push({data:this.dirRecords[h],meta:{percent:100}});var n=this.bytesWritten-s,e=function(o,c,y,k,_){var S=i.transformTo("string",_(k));return C.CENTRAL_DIRECTORY_END+"\0\0\0\0"+f(o,2)+f(o,2)+f(c,4)+f(y,4)+f(S.length,2)+S}(this.dirRecords.length,n,s,this.zipComment,this.encodeFileName);this.push({data:e,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(s){this._sources.push(s);var h=this;return s.on("data",function(n){h.processChunk(n)}),s.on("end",function(){h.closedSource(h.previous.streamInfo),h._sources.length?h.prepareNextSource():h.end()}),s.on("error",function(n){h.error(n)}),this},m.prototype.resume=function(){return!!p.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(s){var h=this._sources;if(!p.prototype.error.call(this,s))return!1;for(var n=0;n<h.length;n++)try{h[n].error(s)}catch{}return!0},m.prototype.lock=function(){p.prototype.lock.call(this);for(var s=this._sources,h=0;h<s.length;h++)s[h].lock()},l.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,l,E){var f=r("../compressions"),b=r("./ZipFileWorker");E.generateWorker=function(i,p,d){var v=new b(p.streamFiles,d,p.platform,p.encodeFileName),C=0;try{i.forEach(function(m,s){C++;var h=function(c,y){var k=c||y,_=f[k];if(!_)throw new Error(k+" is not a valid compression method !");return _}(s.options.compression,p.compression),n=s.options.compressionOptions||p.compressionOptions||{},e=s.dir,o=s.date;s._compressWorker(h,n).withStreamInfo("file",{name:m,dir:e,date:o,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(v)}),v.entriesCount=C}catch(m){v.error(m)}return v}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,l,E){function f(){if(!(this instanceof f))return new f;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var b=new f;for(var i in this)typeof this[i]!="function"&&(b[i]=this[i]);return b}}(f.prototype=r("./object")).loadAsync=r("./load"),f.support=r("./support"),f.defaults=r("./defaults"),f.version="3.10.1",f.loadAsync=function(b,i){return new f().loadAsync(b,i)},f.external=r("./external"),l.exports=f},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,l,E){var f=r("./utils"),b=r("./external"),i=r("./utf8"),p=r("./zipEntries"),d=r("./stream/Crc32Probe"),v=r("./nodejsUtils");function C(m){return new b.Promise(function(s,h){var n=m.decompressed.getContentWorker().pipe(new d);n.on("error",function(e){h(e)}).on("end",function(){n.streamInfo.crc32!==m.decompressed.crc32?h(new Error("Corrupted zip : CRC32 mismatch")):s()}).resume()})}l.exports=function(m,s){var h=this;return s=f.extend(s||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),v.isNode&&v.isStream(m)?b.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):f.prepareContent("the loaded zip file",m,!0,s.optimizedBinaryString,s.base64).then(function(n){var e=new p(s);return e.load(n),e}).then(function(n){var e=[b.Promise.resolve(n)],o=n.files;if(s.checkCRC32)for(var c=0;c<o.length;c++)e.push(C(o[c]));return b.Promise.all(e)}).then(function(n){for(var e=n.shift(),o=e.files,c=0;c<o.length;c++){var y=o[c],k=y.fileNameStr,_=f.resolve(y.fileNameStr);h.file(_,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:s.createFolders}),y.dir||(h.file(_).unsafeOriginalName=k)}return e.zipComment.length&&(h.comment=e.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,l,E){var f=r("../utils"),b=r("../stream/GenericWorker");function i(p,d){b.call(this,"Nodejs stream input adapter for "+p),this._upstreamEnded=!1,this._bindStream(d)}f.inherits(i,b),i.prototype._bindStream=function(p){var d=this;(this._stream=p).pause(),p.on("data",function(v){d.push({data:v,meta:{percent:0}})}).on("error",function(v){d.isPaused?this.generatedError=v:d.error(v)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},i.prototype.pause=function(){return!!b.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!b.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},l.exports=i},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,l,E){var f=r("readable-stream").Readable;function b(i,p,d){f.call(this,p),this._helper=i;var v=this;i.on("data",function(C,m){v.push(C)||v._helper.pause(),d&&d(m)}).on("error",function(C){v.emit("error",C)}).on("end",function(){v.push(null)})}r("../utils").inherits(b,f),b.prototype._read=function(){this._helper.resume()},l.exports=b},{"../utils":32,"readable-stream":16}],14:[function(r,l,E){l.exports={isNode:typeof Buffer<"u",newBufferFrom:function(f,b){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(f,b);if(typeof f=="number")throw new Error('The "data" argument must not be a number');return new Buffer(f,b)},allocBuffer:function(f){if(Buffer.alloc)return Buffer.alloc(f);var b=new Buffer(f);return b.fill(0),b},isBuffer:function(f){return Buffer.isBuffer(f)},isStream:function(f){return f&&typeof f.on=="function"&&typeof f.pause=="function"&&typeof f.resume=="function"}}},{}],15:[function(r,l,E){function f(_,S,I){var H,V=i.getTypeOf(S),T=i.extend(I||{},v);T.date=T.date||new Date,T.compression!==null&&(T.compression=T.compression.toUpperCase()),typeof T.unixPermissions=="string"&&(T.unixPermissions=parseInt(T.unixPermissions,8)),T.unixPermissions&&16384&T.unixPermissions&&(T.dir=!0),T.dosPermissions&&16&T.dosPermissions&&(T.dir=!0),T.dir&&(_=o(_)),T.createFolders&&(H=e(_))&&c.call(this,H,!0);var q=V==="string"&&T.binary===!1&&T.base64===!1;I&&I.binary!==void 0||(T.binary=!q),(S instanceof C&&S.uncompressedSize===0||T.dir||!S||S.length===0)&&(T.base64=!1,T.binary=!0,S="",T.compression="STORE",V="string");var F=null;F=S instanceof C||S instanceof p?S:h.isNode&&h.isStream(S)?new n(_,S):i.prepareContent(_,S,T.binary,T.optimizedBinaryString,T.base64);var W=new m(_,F,T);this.files[_]=W}var b=r("./utf8"),i=r("./utils"),p=r("./stream/GenericWorker"),d=r("./stream/StreamHelper"),v=r("./defaults"),C=r("./compressedObject"),m=r("./zipObject"),s=r("./generate"),h=r("./nodejsUtils"),n=r("./nodejs/NodejsStreamInputAdapter"),e=function(_){_.slice(-1)==="/"&&(_=_.substring(0,_.length-1));var S=_.lastIndexOf("/");return 0<S?_.substring(0,S):""},o=function(_){return _.slice(-1)!=="/"&&(_+="/"),_},c=function(_,S){return S=S!==void 0?S:v.createFolders,_=o(_),this.files[_]||f.call(this,_,null,{dir:!0,createFolders:S}),this.files[_]};function y(_){return Object.prototype.toString.call(_)==="[object RegExp]"}var k={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(_){var S,I,H;for(S in this.files)H=this.files[S],(I=S.slice(this.root.length,S.length))&&S.slice(0,this.root.length)===this.root&&_(I,H)},filter:function(_){var S=[];return this.forEach(function(I,H){_(I,H)&&S.push(H)}),S},file:function(_,S,I){if(arguments.length!==1)return _=this.root+_,f.call(this,_,S,I),this;if(y(_)){var H=_;return this.filter(function(T,q){return!q.dir&&H.test(T)})}var V=this.files[this.root+_];return V&&!V.dir?V:null},folder:function(_){if(!_)return this;if(y(_))return this.filter(function(V,T){return T.dir&&_.test(V)});var S=this.root+_,I=c.call(this,S),H=this.clone();return H.root=I.name,H},remove:function(_){_=this.root+_;var S=this.files[_];if(S||(_.slice(-1)!=="/"&&(_+="/"),S=this.files[_]),S&&!S.dir)delete this.files[_];else for(var I=this.filter(function(V,T){return T.name.slice(0,_.length)===_}),H=0;H<I.length;H++)delete this.files[I[H].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(_){var S,I={};try{if((I=i.extend(_||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:b.utf8encode})).type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");i.checkSupport(I.type),I.platform!=="darwin"&&I.platform!=="freebsd"&&I.platform!=="linux"&&I.platform!=="sunos"||(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var H=I.comment||this.comment||"";S=s.generateWorker(this,I,H)}catch(V){(S=new p("error")).error(V)}return new d(S,I.type||"string",I.mimeType)},generateAsync:function(_,S){return this.generateInternalStream(_).accumulate(S)},generateNodeStream:function(_,S){return(_=_||{}).type||(_.type="nodebuffer"),this.generateInternalStream(_).toNodejsStream(S)}};l.exports=k},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,l,E){l.exports=r("stream")},{stream:void 0}],17:[function(r,l,E){var f=r("./DataReader");function b(i){f.call(this,i);for(var p=0;p<this.data.length;p++)i[p]=255&i[p]}r("../utils").inherits(b,f),b.prototype.byteAt=function(i){return this.data[this.zero+i]},b.prototype.lastIndexOfSignature=function(i){for(var p=i.charCodeAt(0),d=i.charCodeAt(1),v=i.charCodeAt(2),C=i.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===p&&this.data[m+1]===d&&this.data[m+2]===v&&this.data[m+3]===C)return m-this.zero;return-1},b.prototype.readAndCheckSignature=function(i){var p=i.charCodeAt(0),d=i.charCodeAt(1),v=i.charCodeAt(2),C=i.charCodeAt(3),m=this.readData(4);return p===m[0]&&d===m[1]&&v===m[2]&&C===m[3]},b.prototype.readData=function(i){if(this.checkOffset(i),i===0)return[];var p=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./DataReader":18}],18:[function(r,l,E){var f=r("../utils");function b(i){this.data=i,this.length=i.length,this.index=0,this.zero=0}b.prototype={checkOffset:function(i){this.checkIndex(this.index+i)},checkIndex:function(i){if(this.length<this.zero+i||i<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+i+"). Corrupted zip ?")},setIndex:function(i){this.checkIndex(i),this.index=i},skip:function(i){this.setIndex(this.index+i)},byteAt:function(){},readInt:function(i){var p,d=0;for(this.checkOffset(i),p=this.index+i-1;p>=this.index;p--)d=(d<<8)+this.byteAt(p);return this.index+=i,d},readString:function(i){return f.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},l.exports=b},{"../utils":32}],19:[function(r,l,E){var f=r("./Uint8ArrayReader");function b(i){f.call(this,i)}r("../utils").inherits(b,f),b.prototype.readData=function(i){this.checkOffset(i);var p=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,l,E){var f=r("./DataReader");function b(i){f.call(this,i)}r("../utils").inherits(b,f),b.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},b.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},b.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},b.prototype.readData=function(i){this.checkOffset(i);var p=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./DataReader":18}],21:[function(r,l,E){var f=r("./ArrayReader");function b(i){f.call(this,i)}r("../utils").inherits(b,f),b.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var p=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./ArrayReader":17}],22:[function(r,l,E){var f=r("../utils"),b=r("../support"),i=r("./ArrayReader"),p=r("./StringReader"),d=r("./NodeBufferReader"),v=r("./Uint8ArrayReader");l.exports=function(C){var m=f.getTypeOf(C);return f.checkSupport(m),m!=="string"||b.uint8array?m==="nodebuffer"?new d(C):b.uint8array?new v(f.transformTo("uint8array",C)):new i(f.transformTo("array",C)):new p(C)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,l,E){E.LOCAL_FILE_HEADER="PK",E.CENTRAL_FILE_HEADER="PK",E.CENTRAL_DIRECTORY_END="PK",E.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",E.ZIP64_CENTRAL_DIRECTORY_END="PK",E.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,l,E){var f=r("./GenericWorker"),b=r("../utils");function i(p){f.call(this,"ConvertWorker to "+p),this.destType=p}b.inherits(i,f),i.prototype.processChunk=function(p){this.push({data:b.transformTo(this.destType,p.data),meta:p.meta})},l.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(r,l,E){var f=r("./GenericWorker"),b=r("../crc32");function i(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(i,f),i.prototype.processChunk=function(p){this.streamInfo.crc32=b(p.data,this.streamInfo.crc32||0),this.push(p)},l.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,l,E){var f=r("../utils"),b=r("./GenericWorker");function i(p){b.call(this,"DataLengthProbe for "+p),this.propName=p,this.withStreamInfo(p,0)}f.inherits(i,b),i.prototype.processChunk=function(p){if(p){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+p.data.length}b.prototype.processChunk.call(this,p)},l.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(r,l,E){var f=r("../utils"),b=r("./GenericWorker");function i(p){b.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,p.then(function(v){d.dataIsReady=!0,d.data=v,d.max=v&&v.length||0,d.type=f.getTypeOf(v),d.isPaused||d._tickAndRepeat()},function(v){d.error(v)})}f.inherits(i,b),i.prototype.cleanUp=function(){b.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!b.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var p=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":p=this.data.substring(this.index,d);break;case"uint8array":p=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":p=this.data.slice(this.index,d)}return this.index=d,this.push({data:p,meta:{percent:this.max?this.index/this.max*100:0}})},l.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(r,l,E){function f(b){this.name=b||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(b){this.emit("data",b)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(b){this.emit("error",b)}return!0},error:function(b){return!this.isFinished&&(this.isPaused?this.generatedError=b:(this.isFinished=!0,this.emit("error",b),this.previous&&this.previous.error(b),this.cleanUp()),!0)},on:function(b,i){return this._listeners[b].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(b,i){if(this._listeners[b])for(var p=0;p<this._listeners[b].length;p++)this._listeners[b][p].call(this,i)},pipe:function(b){return b.registerPrevious(this)},registerPrevious:function(b){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=b.streamInfo,this.mergeStreamInfo(),this.previous=b;var i=this;return b.on("data",function(p){i.processChunk(p)}),b.on("end",function(){i.end()}),b.on("error",function(p){i.error(p)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var b=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),b=!0),this.previous&&this.previous.resume(),!b},flush:function(){},processChunk:function(b){this.push(b)},withStreamInfo:function(b,i){return this.extraStreamInfo[b]=i,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var b in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,b)&&(this.streamInfo[b]=this.extraStreamInfo[b])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var b="Worker "+this.name;return this.previous?this.previous+" -> "+b:b}},l.exports=f},{}],29:[function(r,l,E){var f=r("../utils"),b=r("./ConvertWorker"),i=r("./GenericWorker"),p=r("../base64"),d=r("../support"),v=r("../external"),C=null;if(d.nodestream)try{C=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(h,n){return new v.Promise(function(e,o){var c=[],y=h._internalType,k=h._outputType,_=h._mimeType;h.on("data",function(S,I){c.push(S),n&&n(I)}).on("error",function(S){c=[],o(S)}).on("end",function(){try{var S=function(I,H,V){switch(I){case"blob":return f.newBlob(f.transformTo("arraybuffer",H),V);case"base64":return p.encode(H);default:return f.transformTo(I,H)}}(k,function(I,H){var V,T=0,q=null,F=0;for(V=0;V<H.length;V++)F+=H[V].length;switch(I){case"string":return H.join("");case"array":return Array.prototype.concat.apply([],H);case"uint8array":for(q=new Uint8Array(F),V=0;V<H.length;V++)q.set(H[V],T),T+=H[V].length;return q;case"nodebuffer":return Buffer.concat(H);default:throw new Error("concat : unsupported type '"+I+"'")}}(y,c),_);e(S)}catch(I){o(I)}c=[]}).resume()})}function s(h,n,e){var o=n;switch(n){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=n,this._mimeType=e,f.checkSupport(o),this._worker=h.pipe(new b(o)),h.lock()}catch(c){this._worker=new i("error"),this._worker.error(c)}}s.prototype={accumulate:function(h){return m(this,h)},on:function(h,n){var e=this;return h==="data"?this._worker.on(h,function(o){n.call(e,o.data,o.meta)}):this._worker.on(h,function(){f.delay(n,arguments,e)}),this},resume:function(){return f.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(h){if(f.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new C(this,{objectMode:this._outputType!=="nodebuffer"},h)}},l.exports=s},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,l,E){if(E.base64=!0,E.array=!0,E.string=!0,E.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",E.nodebuffer=typeof Buffer<"u",E.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")E.blob=!1;else{var f=new ArrayBuffer(0);try{E.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);b.append(f),E.blob=b.getBlob("application/zip").size===0}catch{E.blob=!1}}}try{E.nodestream=!!r("readable-stream").Readable}catch{E.nodestream=!1}},{"readable-stream":16}],31:[function(r,l,E){for(var f=r("./utils"),b=r("./support"),i=r("./nodejsUtils"),p=r("./stream/GenericWorker"),d=new Array(256),v=0;v<256;v++)d[v]=252<=v?6:248<=v?5:240<=v?4:224<=v?3:192<=v?2:1;d[254]=d[254]=1;function C(){p.call(this,"utf-8 decode"),this.leftOver=null}function m(){p.call(this,"utf-8 encode")}E.utf8encode=function(s){return b.nodebuffer?i.newBufferFrom(s,"utf-8"):function(h){var n,e,o,c,y,k=h.length,_=0;for(c=0;c<k;c++)(64512&(e=h.charCodeAt(c)))==55296&&c+1<k&&(64512&(o=h.charCodeAt(c+1)))==56320&&(e=65536+(e-55296<<10)+(o-56320),c++),_+=e<128?1:e<2048?2:e<65536?3:4;for(n=b.uint8array?new Uint8Array(_):new Array(_),c=y=0;y<_;c++)(64512&(e=h.charCodeAt(c)))==55296&&c+1<k&&(64512&(o=h.charCodeAt(c+1)))==56320&&(e=65536+(e-55296<<10)+(o-56320),c++),e<128?n[y++]=e:(e<2048?n[y++]=192|e>>>6:(e<65536?n[y++]=224|e>>>12:(n[y++]=240|e>>>18,n[y++]=128|e>>>12&63),n[y++]=128|e>>>6&63),n[y++]=128|63&e);return n}(s)},E.utf8decode=function(s){return b.nodebuffer?f.transformTo("nodebuffer",s).toString("utf-8"):function(h){var n,e,o,c,y=h.length,k=new Array(2*y);for(n=e=0;n<y;)if((o=h[n++])<128)k[e++]=o;else if(4<(c=d[o]))k[e++]=65533,n+=c-1;else{for(o&=c===2?31:c===3?15:7;1<c&&n<y;)o=o<<6|63&h[n++],c--;1<c?k[e++]=65533:o<65536?k[e++]=o:(o-=65536,k[e++]=55296|o>>10&1023,k[e++]=56320|1023&o)}return k.length!==e&&(k.subarray?k=k.subarray(0,e):k.length=e),f.applyFromCharCode(k)}(s=f.transformTo(b.uint8array?"uint8array":"array",s))},f.inherits(C,p),C.prototype.processChunk=function(s){var h=f.transformTo(b.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(b.uint8array){var n=h;(h=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),h.set(n,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var e=function(c,y){var k;for((y=y||c.length)>c.length&&(y=c.length),k=y-1;0<=k&&(192&c[k])==128;)k--;return k<0||k===0?y:k+d[c[k]]>y?k:y}(h),o=h;e!==h.length&&(b.uint8array?(o=h.subarray(0,e),this.leftOver=h.subarray(e,h.length)):(o=h.slice(0,e),this.leftOver=h.slice(e,h.length))),this.push({data:E.utf8decode(o),meta:s.meta})},C.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:E.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},E.Utf8DecodeWorker=C,f.inherits(m,p),m.prototype.processChunk=function(s){this.push({data:E.utf8encode(s.data),meta:s.meta})},E.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,l,E){var f=r("./support"),b=r("./base64"),i=r("./nodejsUtils"),p=r("./external");function d(n){return n}function v(n,e){for(var o=0;o<n.length;++o)e[o]=255&n.charCodeAt(o);return e}r("setimmediate"),E.newBlob=function(n,e){E.checkSupport("blob");try{return new Blob([n],{type:e})}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return o.append(n),o.getBlob(e)}catch{throw new Error("Bug : can't construct the Blob.")}}};var C={stringifyByChunk:function(n,e,o){var c=[],y=0,k=n.length;if(k<=o)return String.fromCharCode.apply(null,n);for(;y<k;)e==="array"||e==="nodebuffer"?c.push(String.fromCharCode.apply(null,n.slice(y,Math.min(y+o,k)))):c.push(String.fromCharCode.apply(null,n.subarray(y,Math.min(y+o,k)))),y+=o;return c.join("")},stringifyByChar:function(n){for(var e="",o=0;o<n.length;o++)e+=String.fromCharCode(n[o]);return e},applyCanBeUsed:{uint8array:function(){try{return f.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return f.nodebuffer&&String.fromCharCode.apply(null,i.allocBuffer(1)).length===1}catch{return!1}}()}};function m(n){var e=65536,o=E.getTypeOf(n),c=!0;if(o==="uint8array"?c=C.applyCanBeUsed.uint8array:o==="nodebuffer"&&(c=C.applyCanBeUsed.nodebuffer),c)for(;1<e;)try{return C.stringifyByChunk(n,o,e)}catch{e=Math.floor(e/2)}return C.stringifyByChar(n)}function s(n,e){for(var o=0;o<n.length;o++)e[o]=n[o];return e}E.applyFromCharCode=m;var h={};h.string={string:d,array:function(n){return v(n,new Array(n.length))},arraybuffer:function(n){return h.string.uint8array(n).buffer},uint8array:function(n){return v(n,new Uint8Array(n.length))},nodebuffer:function(n){return v(n,i.allocBuffer(n.length))}},h.array={string:m,array:d,arraybuffer:function(n){return new Uint8Array(n).buffer},uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return i.newBufferFrom(n)}},h.arraybuffer={string:function(n){return m(new Uint8Array(n))},array:function(n){return s(new Uint8Array(n),new Array(n.byteLength))},arraybuffer:d,uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return i.newBufferFrom(new Uint8Array(n))}},h.uint8array={string:m,array:function(n){return s(n,new Array(n.length))},arraybuffer:function(n){return n.buffer},uint8array:d,nodebuffer:function(n){return i.newBufferFrom(n)}},h.nodebuffer={string:m,array:function(n){return s(n,new Array(n.length))},arraybuffer:function(n){return h.nodebuffer.uint8array(n).buffer},uint8array:function(n){return s(n,new Uint8Array(n.length))},nodebuffer:d},E.transformTo=function(n,e){if(e=e||"",!n)return e;E.checkSupport(n);var o=E.getTypeOf(e);return h[o][n](e)},E.resolve=function(n){for(var e=n.split("/"),o=[],c=0;c<e.length;c++){var y=e[c];y==="."||y===""&&c!==0&&c!==e.length-1||(y===".."?o.pop():o.push(y))}return o.join("/")},E.getTypeOf=function(n){return typeof n=="string"?"string":Object.prototype.toString.call(n)==="[object Array]"?"array":f.nodebuffer&&i.isBuffer(n)?"nodebuffer":f.uint8array&&n instanceof Uint8Array?"uint8array":f.arraybuffer&&n instanceof ArrayBuffer?"arraybuffer":void 0},E.checkSupport=function(n){if(!f[n.toLowerCase()])throw new Error(n+" is not supported by this platform")},E.MAX_VALUE_16BITS=65535,E.MAX_VALUE_32BITS=-1,E.pretty=function(n){var e,o,c="";for(o=0;o<(n||"").length;o++)c+="\\x"+((e=n.charCodeAt(o))<16?"0":"")+e.toString(16).toUpperCase();return c},E.delay=function(n,e,o){setImmediate(function(){n.apply(o||null,e||[])})},E.inherits=function(n,e){function o(){}o.prototype=e.prototype,n.prototype=new o},E.extend=function(){var n,e,o={};for(n=0;n<arguments.length;n++)for(e in arguments[n])Object.prototype.hasOwnProperty.call(arguments[n],e)&&o[e]===void 0&&(o[e]=arguments[n][e]);return o},E.prepareContent=function(n,e,o,c,y){return p.Promise.resolve(e).then(function(k){return f.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new p.Promise(function(_,S){var I=new FileReader;I.onload=function(H){_(H.target.result)},I.onerror=function(H){S(H.target.error)},I.readAsArrayBuffer(k)}):k}).then(function(k){var _=E.getTypeOf(k);return _?(_==="arraybuffer"?k=E.transformTo("uint8array",k):_==="string"&&(y?k=b.decode(k):o&&c!==!0&&(k=function(S){return v(S,f.uint8array?new Uint8Array(S.length):new Array(S.length))}(k))),k):p.Promise.reject(new Error("Can't read the data of '"+n+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,l,E){var f=r("./reader/readerFor"),b=r("./utils"),i=r("./signature"),p=r("./zipEntry"),d=r("./support");function v(C){this.files=[],this.loadOptions=C}v.prototype={checkSignature:function(C){if(!this.reader.readAndCheckSignature(C)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+b.pretty(m)+", expected "+b.pretty(C)+")")}},isSignature:function(C,m){var s=this.reader.index;this.reader.setIndex(C);var h=this.reader.readString(4)===m;return this.reader.setIndex(s),h},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var C=this.reader.readData(this.zipCommentLength),m=d.uint8array?"uint8array":"array",s=b.transformTo(m,C);this.zipComment=this.loadOptions.decodeFileName(s)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var C,m,s,h=this.zip64EndOfCentralSize-44;0<h;)C=this.reader.readInt(2),m=this.reader.readInt(4),s=this.reader.readData(m),this.zip64ExtensibleData[C]={id:C,length:m,value:s}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var C,m;for(C=0;C<this.files.length;C++)m=this.files[C],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var C;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(C=new p({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(C);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var C=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(C<0)throw this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(C);var m=C;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===b.MAX_VALUE_16BITS||this.diskWithCentralDirStart===b.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===b.MAX_VALUE_16BITS||this.centralDirRecords===b.MAX_VALUE_16BITS||this.centralDirSize===b.MAX_VALUE_32BITS||this.centralDirOffset===b.MAX_VALUE_32BITS){if(this.zip64=!0,(C=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(C),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var h=m-s;if(0<h)this.isSignature(m,i.CENTRAL_FILE_HEADER)||(this.reader.zero=h);else if(h<0)throw new Error("Corrupted zip: missing "+Math.abs(h)+" bytes.")},prepareReader:function(C){this.reader=f(C)},load:function(C){this.prepareReader(C),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},l.exports=v},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,l,E){var f=r("./reader/readerFor"),b=r("./utils"),i=r("./compressedObject"),p=r("./crc32"),d=r("./utf8"),v=r("./compressions"),C=r("./support");function m(s,h){this.options=s,this.loadOptions=h}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(s){var h,n;if(s.skip(22),this.fileNameLength=s.readInt(2),n=s.readInt(2),this.fileName=s.readData(this.fileNameLength),s.skip(n),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((h=function(e){for(var o in v)if(Object.prototype.hasOwnProperty.call(v,o)&&v[o].magic===e)return v[o];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+b.pretty(this.compressionMethod)+" unknown (inner file : "+b.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,h,s.readData(this.compressedSize))},readCentralPart:function(s){this.versionMadeBy=s.readInt(2),s.skip(2),this.bitFlag=s.readInt(2),this.compressionMethod=s.readString(2),this.date=s.readDate(),this.crc32=s.readInt(4),this.compressedSize=s.readInt(4),this.uncompressedSize=s.readInt(4);var h=s.readInt(2);if(this.extraFieldsLength=s.readInt(2),this.fileCommentLength=s.readInt(2),this.diskNumberStart=s.readInt(2),this.internalFileAttributes=s.readInt(2),this.externalFileAttributes=s.readInt(4),this.localHeaderOffset=s.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");s.skip(h),this.readExtraFields(s),this.parseZIP64ExtraField(s),this.fileComment=s.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var s=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=f(this.extraFields[1].value);this.uncompressedSize===b.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===b.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===b.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===b.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var h,n,e,o=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4<o;)h=s.readInt(2),n=s.readInt(2),e=s.readData(n),this.extraFields[h]={id:h,length:n,value:e};s.setIndex(o)},handleUTF8:function(){var s=C.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var h=this.findExtraFieldUnicodePath();if(h!==null)this.fileNameStr=h;else{var n=b.transformTo(s,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var e=this.findExtraFieldUnicodeComment();if(e!==null)this.fileCommentStr=e;else{var o=b.transformTo(s,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var s=this.extraFields[28789];if(s){var h=f(s.value);return h.readInt(1)!==1||p(this.fileName)!==h.readInt(4)?null:d.utf8decode(h.readData(s.length-5))}return null},findExtraFieldUnicodeComment:function(){var s=this.extraFields[25461];if(s){var h=f(s.value);return h.readInt(1)!==1||p(this.fileComment)!==h.readInt(4)?null:d.utf8decode(h.readData(s.length-5))}return null}},l.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,l,E){function f(h,n,e){this.name=h,this.dir=e.dir,this.date=e.date,this.comment=e.comment,this.unixPermissions=e.unixPermissions,this.dosPermissions=e.dosPermissions,this._data=n,this._dataBinary=e.binary,this.options={compression:e.compression,compressionOptions:e.compressionOptions}}var b=r("./stream/StreamHelper"),i=r("./stream/DataWorker"),p=r("./utf8"),d=r("./compressedObject"),v=r("./stream/GenericWorker");f.prototype={internalStream:function(h){var n=null,e="string";try{if(!h)throw new Error("No output type specified.");var o=(e=h.toLowerCase())==="string"||e==="text";e!=="binarystring"&&e!=="text"||(e="string"),n=this._decompressWorker();var c=!this._dataBinary;c&&!o&&(n=n.pipe(new p.Utf8EncodeWorker)),!c&&o&&(n=n.pipe(new p.Utf8DecodeWorker))}catch(y){(n=new v("error")).error(y)}return new b(n,e,"")},async:function(h,n){return this.internalStream(h).accumulate(n)},nodeStream:function(h,n){return this.internalStream(h||"nodebuffer").toNodejsStream(n)},_compressWorker:function(h,n){if(this._data instanceof d&&this._data.compression.magic===h.magic)return this._data.getCompressedWorker();var e=this._decompressWorker();return this._dataBinary||(e=e.pipe(new p.Utf8EncodeWorker)),d.createWorkerFrom(e,h,n)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof v?this._data:new i(this._data)}};for(var C=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},s=0;s<C.length;s++)f.prototype[C[s]]=m;l.exports=f},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,l,E){(function(f){var b,i,p=f.MutationObserver||f.WebKitMutationObserver;if(p){var d=0,v=new p(h),C=f.document.createTextNode("");v.observe(C,{characterData:!0}),b=function(){C.data=d=++d%2}}else if(f.setImmediate||f.MessageChannel===void 0)b="document"in f&&"onreadystatechange"in f.document.createElement("script")?function(){var n=f.document.createElement("script");n.onreadystatechange=function(){h(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},f.document.documentElement.appendChild(n)}:function(){setTimeout(h,0)};else{var m=new f.MessageChannel;m.port1.onmessage=h,b=function(){m.port2.postMessage(0)}}var s=[];function h(){var n,e;i=!0;for(var o=s.length;o;){for(e=s,s=[],n=-1;++n<o;)e[n]();o=s.length}i=!1}l.exports=function(n){s.push(n)!==1||i||b()}}).call(this,typeof De<"u"?De:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,l,E){var f=r("immediate");function b(){}var i={},p=["REJECTED"],d=["FULFILLED"],v=["PENDING"];function C(o){if(typeof o!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,o!==b&&n(this,o)}function m(o,c,y){this.promise=o,typeof c=="function"&&(this.onFulfilled=c,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function s(o,c,y){f(function(){var k;try{k=c(y)}catch(_){return i.reject(o,_)}k===o?i.reject(o,new TypeError("Cannot resolve promise with itself")):i.resolve(o,k)})}function h(o){var c=o&&o.then;if(o&&(typeof o=="object"||typeof o=="function")&&typeof c=="function")return function(){c.apply(o,arguments)}}function n(o,c){var y=!1;function k(I){y||(y=!0,i.reject(o,I))}function _(I){y||(y=!0,i.resolve(o,I))}var S=e(function(){c(_,k)});S.status==="error"&&k(S.value)}function e(o,c){var y={};try{y.value=o(c),y.status="success"}catch(k){y.status="error",y.value=k}return y}(l.exports=C).prototype.finally=function(o){if(typeof o!="function")return this;var c=this.constructor;return this.then(function(y){return c.resolve(o()).then(function(){return y})},function(y){return c.resolve(o()).then(function(){throw y})})},C.prototype.catch=function(o){return this.then(null,o)},C.prototype.then=function(o,c){if(typeof o!="function"&&this.state===d||typeof c!="function"&&this.state===p)return this;var y=new this.constructor(b);return this.state!==v?s(y,this.state===d?o:c,this.outcome):this.queue.push(new m(y,o,c)),y},m.prototype.callFulfilled=function(o){i.resolve(this.promise,o)},m.prototype.otherCallFulfilled=function(o){s(this.promise,this.onFulfilled,o)},m.prototype.callRejected=function(o){i.reject(this.promise,o)},m.prototype.otherCallRejected=function(o){s(this.promise,this.onRejected,o)},i.resolve=function(o,c){var y=e(h,c);if(y.status==="error")return i.reject(o,y.value);var k=y.value;if(k)n(o,k);else{o.state=d,o.outcome=c;for(var _=-1,S=o.queue.length;++_<S;)o.queue[_].callFulfilled(c)}return o},i.reject=function(o,c){o.state=p,o.outcome=c;for(var y=-1,k=o.queue.length;++y<k;)o.queue[y].callRejected(c);return o},C.resolve=function(o){return o instanceof this?o:i.resolve(new this(b),o)},C.reject=function(o){var c=new this(b);return i.reject(c,o)},C.all=function(o){var c=this;if(Object.prototype.toString.call(o)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=o.length,k=!1;if(!y)return this.resolve([]);for(var _=new Array(y),S=0,I=-1,H=new this(b);++I<y;)V(o[I],I);return H;function V(T,q){c.resolve(T).then(function(F){_[q]=F,++S!==y||k||(k=!0,i.resolve(H,_))},function(F){k||(k=!0,i.reject(H,F))})}},C.race=function(o){var c=this;if(Object.prototype.toString.call(o)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=o.length,k=!1;if(!y)return this.resolve([]);for(var _=-1,S=new this(b);++_<y;)I=o[_],c.resolve(I).then(function(H){k||(k=!0,i.resolve(S,H))},function(H){k||(k=!0,i.reject(S,H))});var I;return S}},{immediate:36}],38:[function(r,l,E){var f={};(0,r("./lib/utils/common").assign)(f,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),l.exports=f},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,l,E){var f=r("./zlib/deflate"),b=r("./utils/common"),i=r("./utils/strings"),p=r("./zlib/messages"),d=r("./zlib/zstream"),v=Object.prototype.toString,C=0,m=-1,s=0,h=8;function n(o){if(!(this instanceof n))return new n(o);this.options=b.assign({level:m,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:s,to:""},o||{});var c=this.options;c.raw&&0<c.windowBits?c.windowBits=-c.windowBits:c.gzip&&0<c.windowBits&&c.windowBits<16&&(c.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=f.deflateInit2(this.strm,c.level,c.method,c.windowBits,c.memLevel,c.strategy);if(y!==C)throw new Error(p[y]);if(c.header&&f.deflateSetHeader(this.strm,c.header),c.dictionary){var k;if(k=typeof c.dictionary=="string"?i.string2buf(c.dictionary):v.call(c.dictionary)==="[object ArrayBuffer]"?new Uint8Array(c.dictionary):c.dictionary,(y=f.deflateSetDictionary(this.strm,k))!==C)throw new Error(p[y]);this._dict_set=!0}}function e(o,c){var y=new n(c);if(y.push(o,!0),y.err)throw y.msg||p[y.err];return y.result}n.prototype.push=function(o,c){var y,k,_=this.strm,S=this.options.chunkSize;if(this.ended)return!1;k=c===~~c?c:c===!0?4:0,typeof o=="string"?_.input=i.string2buf(o):v.call(o)==="[object ArrayBuffer]"?_.input=new Uint8Array(o):_.input=o,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new b.Buf8(S),_.next_out=0,_.avail_out=S),(y=f.deflate(_,k))!==1&&y!==C)return this.onEnd(y),!(this.ended=!0);_.avail_out!==0&&(_.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(i.buf2binstring(b.shrinkBuf(_.output,_.next_out))):this.onData(b.shrinkBuf(_.output,_.next_out)))}while((0<_.avail_in||_.avail_out===0)&&y!==1);return k===4?(y=f.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===C):k!==2||(this.onEnd(C),!(_.avail_out=0))},n.prototype.onData=function(o){this.chunks.push(o)},n.prototype.onEnd=function(o){o===C&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=b.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},E.Deflate=n,E.deflate=e,E.deflateRaw=function(o,c){return(c=c||{}).raw=!0,e(o,c)},E.gzip=function(o,c){return(c=c||{}).gzip=!0,e(o,c)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,l,E){var f=r("./zlib/inflate"),b=r("./utils/common"),i=r("./utils/strings"),p=r("./zlib/constants"),d=r("./zlib/messages"),v=r("./zlib/zstream"),C=r("./zlib/gzheader"),m=Object.prototype.toString;function s(n){if(!(this instanceof s))return new s(n);this.options=b.assign({chunkSize:16384,windowBits:0,to:""},n||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||n&&n.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new v,this.strm.avail_out=0;var o=f.inflateInit2(this.strm,e.windowBits);if(o!==p.Z_OK)throw new Error(d[o]);this.header=new C,f.inflateGetHeader(this.strm,this.header)}function h(n,e){var o=new s(e);if(o.push(n,!0),o.err)throw o.msg||d[o.err];return o.result}s.prototype.push=function(n,e){var o,c,y,k,_,S,I=this.strm,H=this.options.chunkSize,V=this.options.dictionary,T=!1;if(this.ended)return!1;c=e===~~e?e:e===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof n=="string"?I.input=i.binstring2buf(n):m.call(n)==="[object ArrayBuffer]"?I.input=new Uint8Array(n):I.input=n,I.next_in=0,I.avail_in=I.input.length;do{if(I.avail_out===0&&(I.output=new b.Buf8(H),I.next_out=0,I.avail_out=H),(o=f.inflate(I,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&V&&(S=typeof V=="string"?i.string2buf(V):m.call(V)==="[object ArrayBuffer]"?new Uint8Array(V):V,o=f.inflateSetDictionary(this.strm,S)),o===p.Z_BUF_ERROR&&T===!0&&(o=p.Z_OK,T=!1),o!==p.Z_STREAM_END&&o!==p.Z_OK)return this.onEnd(o),!(this.ended=!0);I.next_out&&(I.avail_out!==0&&o!==p.Z_STREAM_END&&(I.avail_in!==0||c!==p.Z_FINISH&&c!==p.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=i.utf8border(I.output,I.next_out),k=I.next_out-y,_=i.buf2string(I.output,y),I.next_out=k,I.avail_out=H-k,k&&b.arraySet(I.output,I.output,y,k,0),this.onData(_)):this.onData(b.shrinkBuf(I.output,I.next_out)))),I.avail_in===0&&I.avail_out===0&&(T=!0)}while((0<I.avail_in||I.avail_out===0)&&o!==p.Z_STREAM_END);return o===p.Z_STREAM_END&&(c=p.Z_FINISH),c===p.Z_FINISH?(o=f.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===p.Z_OK):c!==p.Z_SYNC_FLUSH||(this.onEnd(p.Z_OK),!(I.avail_out=0))},s.prototype.onData=function(n){this.chunks.push(n)},s.prototype.onEnd=function(n){n===p.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=b.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg},E.Inflate=s,E.inflate=h,E.inflateRaw=function(n,e){return(e=e||{}).raw=!0,h(n,e)},E.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,l,E){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";E.assign=function(p){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var v=d.shift();if(v){if(typeof v!="object")throw new TypeError(v+"must be non-object");for(var C in v)v.hasOwnProperty(C)&&(p[C]=v[C])}}return p},E.shrinkBuf=function(p,d){return p.length===d?p:p.subarray?p.subarray(0,d):(p.length=d,p)};var b={arraySet:function(p,d,v,C,m){if(d.subarray&&p.subarray)p.set(d.subarray(v,v+C),m);else for(var s=0;s<C;s++)p[m+s]=d[v+s]},flattenChunks:function(p){var d,v,C,m,s,h;for(d=C=0,v=p.length;d<v;d++)C+=p[d].length;for(h=new Uint8Array(C),d=m=0,v=p.length;d<v;d++)s=p[d],h.set(s,m),m+=s.length;return h}},i={arraySet:function(p,d,v,C,m){for(var s=0;s<C;s++)p[m+s]=d[v+s]},flattenChunks:function(p){return[].concat.apply([],p)}};E.setTyped=function(p){p?(E.Buf8=Uint8Array,E.Buf16=Uint16Array,E.Buf32=Int32Array,E.assign(E,b)):(E.Buf8=Array,E.Buf16=Array,E.Buf32=Array,E.assign(E,i))},E.setTyped(f)},{}],42:[function(r,l,E){var f=r("./common"),b=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch{b=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{i=!1}for(var p=new f.Buf8(256),d=0;d<256;d++)p[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function v(C,m){if(m<65537&&(C.subarray&&i||!C.subarray&&b))return String.fromCharCode.apply(null,f.shrinkBuf(C,m));for(var s="",h=0;h<m;h++)s+=String.fromCharCode(C[h]);return s}p[254]=p[254]=1,E.string2buf=function(C){var m,s,h,n,e,o=C.length,c=0;for(n=0;n<o;n++)(64512&(s=C.charCodeAt(n)))==55296&&n+1<o&&(64512&(h=C.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(h-56320),n++),c+=s<128?1:s<2048?2:s<65536?3:4;for(m=new f.Buf8(c),n=e=0;e<c;n++)(64512&(s=C.charCodeAt(n)))==55296&&n+1<o&&(64512&(h=C.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(h-56320),n++),s<128?m[e++]=s:(s<2048?m[e++]=192|s>>>6:(s<65536?m[e++]=224|s>>>12:(m[e++]=240|s>>>18,m[e++]=128|s>>>12&63),m[e++]=128|s>>>6&63),m[e++]=128|63&s);return m},E.buf2binstring=function(C){return v(C,C.length)},E.binstring2buf=function(C){for(var m=new f.Buf8(C.length),s=0,h=m.length;s<h;s++)m[s]=C.charCodeAt(s);return m},E.buf2string=function(C,m){var s,h,n,e,o=m||C.length,c=new Array(2*o);for(s=h=0;s<o;)if((n=C[s++])<128)c[h++]=n;else if(4<(e=p[n]))c[h++]=65533,s+=e-1;else{for(n&=e===2?31:e===3?15:7;1<e&&s<o;)n=n<<6|63&C[s++],e--;1<e?c[h++]=65533:n<65536?c[h++]=n:(n-=65536,c[h++]=55296|n>>10&1023,c[h++]=56320|1023&n)}return v(c,h)},E.utf8border=function(C,m){var s;for((m=m||C.length)>C.length&&(m=C.length),s=m-1;0<=s&&(192&C[s])==128;)s--;return s<0||s===0?m:s+p[C[s]]>m?s:m}},{"./common":41}],43:[function(r,l,E){l.exports=function(f,b,i,p){for(var d=65535&f|0,v=f>>>16&65535|0,C=0;i!==0;){for(i-=C=2e3<i?2e3:i;v=v+(d=d+b[p++]|0)|0,--C;);d%=65521,v%=65521}return d|v<<16|0}},{}],44:[function(r,l,E){l.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,l,E){var f=function(){for(var b,i=[],p=0;p<256;p++){b=p;for(var d=0;d<8;d++)b=1&b?3988292384^b>>>1:b>>>1;i[p]=b}return i}();l.exports=function(b,i,p,d){var v=f,C=d+p;b^=-1;for(var m=d;m<C;m++)b=b>>>8^v[255&(b^i[m])];return-1^b}},{}],46:[function(r,l,E){var f,b=r("../utils/common"),i=r("./trees"),p=r("./adler32"),d=r("./crc32"),v=r("./messages"),C=0,m=4,s=0,h=-2,n=-1,e=4,o=2,c=8,y=9,k=286,_=30,S=19,I=2*k+1,H=15,V=3,T=258,q=T+V+1,F=42,W=113,w=1,j=2,he=3,Z=4;function re(g,ae){return g.msg=v[ae],ae}function ee(g){return(g<<1)-(4<g?9:0)}function ce(g){for(var ae=g.length;0<=--ae;)g[ae]=0}function N(g){var ae=g.state,te=ae.pending;te>g.avail_out&&(te=g.avail_out),te!==0&&(b.arraySet(g.output,ae.pending_buf,ae.pending_out,te,g.next_out),g.next_out+=te,ae.pending_out+=te,g.total_out+=te,g.avail_out-=te,ae.pending-=te,ae.pending===0&&(ae.pending_out=0))}function z(g,ae){i._tr_flush_block(g,0<=g.block_start?g.block_start:-1,g.strstart-g.block_start,ae),g.block_start=g.strstart,N(g.strm)}function Y(g,ae){g.pending_buf[g.pending++]=ae}function K(g,ae){g.pending_buf[g.pending++]=ae>>>8&255,g.pending_buf[g.pending++]=255&ae}function B(g,ae){var te,M,R=g.max_chain_length,G=g.strstart,le=g.prev_length,se=g.nice_match,O=g.strstart>g.w_size-q?g.strstart-(g.w_size-q):0,$=g.window,J=g.w_mask,Q=g.prev,ne=g.strstart+T,de=$[G+le-1],xe=$[G+le];g.prev_length>=g.good_match&&(R>>=2),se>g.lookahead&&(se=g.lookahead);do if($[(te=ae)+le]===xe&&$[te+le-1]===de&&$[te]===$[G]&&$[++te]===$[G+1]){G+=2,te++;do;while($[++G]===$[++te]&&$[++G]===$[++te]&&$[++G]===$[++te]&&$[++G]===$[++te]&&$[++G]===$[++te]&&$[++G]===$[++te]&&$[++G]===$[++te]&&$[++G]===$[++te]&&G<ne);if(M=T-(ne-G),G=ne-T,le<M){if(g.match_start=ae,se<=(le=M))break;de=$[G+le-1],xe=$[G+le]}}while((ae=Q[ae&J])>O&&--R!=0);return le<=g.lookahead?le:g.lookahead}function ye(g){var ae,te,M,R,G,le,se,O,$,J,Q=g.w_size;do{if(R=g.window_size-g.lookahead-g.strstart,g.strstart>=Q+(Q-q)){for(b.arraySet(g.window,g.window,Q,Q,0),g.match_start-=Q,g.strstart-=Q,g.block_start-=Q,ae=te=g.hash_size;M=g.head[--ae],g.head[ae]=Q<=M?M-Q:0,--te;);for(ae=te=Q;M=g.prev[--ae],g.prev[ae]=Q<=M?M-Q:0,--te;);R+=Q}if(g.strm.avail_in===0)break;if(le=g.strm,se=g.window,O=g.strstart+g.lookahead,$=R,J=void 0,J=le.avail_in,$<J&&(J=$),te=J===0?0:(le.avail_in-=J,b.arraySet(se,le.input,le.next_in,J,O),le.state.wrap===1?le.adler=p(le.adler,se,J,O):le.state.wrap===2&&(le.adler=d(le.adler,se,J,O)),le.next_in+=J,le.total_in+=J,J),g.lookahead+=te,g.lookahead+g.insert>=V)for(G=g.strstart-g.insert,g.ins_h=g.window[G],g.ins_h=(g.ins_h<<g.hash_shift^g.window[G+1])&g.hash_mask;g.insert&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[G+V-1])&g.hash_mask,g.prev[G&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=G,G++,g.insert--,!(g.lookahead+g.insert<V)););}while(g.lookahead<q&&g.strm.avail_in!==0)}function Ce(g,ae){for(var te,M;;){if(g.lookahead<q){if(ye(g),g.lookahead<q&&ae===C)return w;if(g.lookahead===0)break}if(te=0,g.lookahead>=V&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+V-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),te!==0&&g.strstart-te<=g.w_size-q&&(g.match_length=B(g,te)),g.match_length>=V)if(M=i._tr_tally(g,g.strstart-g.match_start,g.match_length-V),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=V){for(g.match_length--;g.strstart++,g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+V-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart,--g.match_length!=0;);g.strstart++}else g.strstart+=g.match_length,g.match_length=0,g.ins_h=g.window[g.strstart],g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+1])&g.hash_mask;else M=i._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++;if(M&&(z(g,!1),g.strm.avail_out===0))return w}return g.insert=g.strstart<V-1?g.strstart:V-1,ae===m?(z(g,!0),g.strm.avail_out===0?he:Z):g.last_lit&&(z(g,!1),g.strm.avail_out===0)?w:j}function ue(g,ae){for(var te,M,R;;){if(g.lookahead<q){if(ye(g),g.lookahead<q&&ae===C)return w;if(g.lookahead===0)break}if(te=0,g.lookahead>=V&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+V-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),g.prev_length=g.match_length,g.prev_match=g.match_start,g.match_length=V-1,te!==0&&g.prev_length<g.max_lazy_match&&g.strstart-te<=g.w_size-q&&(g.match_length=B(g,te),g.match_length<=5&&(g.strategy===1||g.match_length===V&&4096<g.strstart-g.match_start)&&(g.match_length=V-1)),g.prev_length>=V&&g.match_length<=g.prev_length){for(R=g.strstart+g.lookahead-V,M=i._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-V),g.lookahead-=g.prev_length-1,g.prev_length-=2;++g.strstart<=R&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+V-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),--g.prev_length!=0;);if(g.match_available=0,g.match_length=V-1,g.strstart++,M&&(z(g,!1),g.strm.avail_out===0))return w}else if(g.match_available){if((M=i._tr_tally(g,0,g.window[g.strstart-1]))&&z(g,!1),g.strstart++,g.lookahead--,g.strm.avail_out===0)return w}else g.match_available=1,g.strstart++,g.lookahead--}return g.match_available&&(M=i._tr_tally(g,0,g.window[g.strstart-1]),g.match_available=0),g.insert=g.strstart<V-1?g.strstart:V-1,ae===m?(z(g,!0),g.strm.avail_out===0?he:Z):g.last_lit&&(z(g,!1),g.strm.avail_out===0)?w:j}function Ae(g,ae,te,M,R){this.good_length=g,this.max_lazy=ae,this.nice_length=te,this.max_chain=M,this.func=R}function Re(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=c,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new b.Buf16(2*I),this.dyn_dtree=new b.Buf16(2*(2*_+1)),this.bl_tree=new b.Buf16(2*(2*S+1)),ce(this.dyn_ltree),ce(this.dyn_dtree),ce(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new b.Buf16(H+1),this.heap=new b.Buf16(2*k+1),ce(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new b.Buf16(2*k+1),ce(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Pe(g){var ae;return g&&g.state?(g.total_in=g.total_out=0,g.data_type=o,(ae=g.state).pending=0,ae.pending_out=0,ae.wrap<0&&(ae.wrap=-ae.wrap),ae.status=ae.wrap?F:W,g.adler=ae.wrap===2?0:1,ae.last_flush=C,i._tr_init(ae),s):re(g,h)}function Ue(g){var ae=Pe(g);return ae===s&&function(te){te.window_size=2*te.w_size,ce(te.head),te.max_lazy_match=f[te.level].max_lazy,te.good_match=f[te.level].good_length,te.nice_match=f[te.level].nice_length,te.max_chain_length=f[te.level].max_chain,te.strstart=0,te.block_start=0,te.lookahead=0,te.insert=0,te.match_length=te.prev_length=V-1,te.match_available=0,te.ins_h=0}(g.state),ae}function We(g,ae,te,M,R,G){if(!g)return h;var le=1;if(ae===n&&(ae=6),M<0?(le=0,M=-M):15<M&&(le=2,M-=16),R<1||y<R||te!==c||M<8||15<M||ae<0||9<ae||G<0||e<G)return re(g,h);M===8&&(M=9);var se=new Re;return(g.state=se).strm=g,se.wrap=le,se.gzhead=null,se.w_bits=M,se.w_size=1<<se.w_bits,se.w_mask=se.w_size-1,se.hash_bits=R+7,se.hash_size=1<<se.hash_bits,se.hash_mask=se.hash_size-1,se.hash_shift=~~((se.hash_bits+V-1)/V),se.window=new b.Buf8(2*se.w_size),se.head=new b.Buf16(se.hash_size),se.prev=new b.Buf16(se.w_size),se.lit_bufsize=1<<R+6,se.pending_buf_size=4*se.lit_bufsize,se.pending_buf=new b.Buf8(se.pending_buf_size),se.d_buf=1*se.lit_bufsize,se.l_buf=3*se.lit_bufsize,se.level=ae,se.strategy=G,se.method=te,Ue(g)}f=[new Ae(0,0,0,0,function(g,ae){var te=65535;for(te>g.pending_buf_size-5&&(te=g.pending_buf_size-5);;){if(g.lookahead<=1){if(ye(g),g.lookahead===0&&ae===C)return w;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var M=g.block_start+te;if((g.strstart===0||g.strstart>=M)&&(g.lookahead=g.strstart-M,g.strstart=M,z(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-q&&(z(g,!1),g.strm.avail_out===0))return w}return g.insert=0,ae===m?(z(g,!0),g.strm.avail_out===0?he:Z):(g.strstart>g.block_start&&(z(g,!1),g.strm.avail_out),w)}),new Ae(4,4,8,4,Ce),new Ae(4,5,16,8,Ce),new Ae(4,6,32,32,Ce),new Ae(4,4,16,16,ue),new Ae(8,16,32,32,ue),new Ae(8,16,128,128,ue),new Ae(8,32,128,256,ue),new Ae(32,128,258,1024,ue),new Ae(32,258,258,4096,ue)],E.deflateInit=function(g,ae){return We(g,ae,c,15,8,0)},E.deflateInit2=We,E.deflateReset=Ue,E.deflateResetKeep=Pe,E.deflateSetHeader=function(g,ae){return g&&g.state?g.state.wrap!==2?h:(g.state.gzhead=ae,s):h},E.deflate=function(g,ae){var te,M,R,G;if(!g||!g.state||5<ae||ae<0)return g?re(g,h):h;if(M=g.state,!g.output||!g.input&&g.avail_in!==0||M.status===666&&ae!==m)return re(g,g.avail_out===0?-5:h);if(M.strm=g,te=M.last_flush,M.last_flush=ae,M.status===F)if(M.wrap===2)g.adler=0,Y(M,31),Y(M,139),Y(M,8),M.gzhead?(Y(M,(M.gzhead.text?1:0)+(M.gzhead.hcrc?2:0)+(M.gzhead.extra?4:0)+(M.gzhead.name?8:0)+(M.gzhead.comment?16:0)),Y(M,255&M.gzhead.time),Y(M,M.gzhead.time>>8&255),Y(M,M.gzhead.time>>16&255),Y(M,M.gzhead.time>>24&255),Y(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),Y(M,255&M.gzhead.os),M.gzhead.extra&&M.gzhead.extra.length&&(Y(M,255&M.gzhead.extra.length),Y(M,M.gzhead.extra.length>>8&255)),M.gzhead.hcrc&&(g.adler=d(g.adler,M.pending_buf,M.pending,0)),M.gzindex=0,M.status=69):(Y(M,0),Y(M,0),Y(M,0),Y(M,0),Y(M,0),Y(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),Y(M,3),M.status=W);else{var le=c+(M.w_bits-8<<4)<<8;le|=(2<=M.strategy||M.level<2?0:M.level<6?1:M.level===6?2:3)<<6,M.strstart!==0&&(le|=32),le+=31-le%31,M.status=W,K(M,le),M.strstart!==0&&(K(M,g.adler>>>16),K(M,65535&g.adler)),g.adler=1}if(M.status===69)if(M.gzhead.extra){for(R=M.pending;M.gzindex<(65535&M.gzhead.extra.length)&&(M.pending!==M.pending_buf_size||(M.gzhead.hcrc&&M.pending>R&&(g.adler=d(g.adler,M.pending_buf,M.pending-R,R)),N(g),R=M.pending,M.pending!==M.pending_buf_size));)Y(M,255&M.gzhead.extra[M.gzindex]),M.gzindex++;M.gzhead.hcrc&&M.pending>R&&(g.adler=d(g.adler,M.pending_buf,M.pending-R,R)),M.gzindex===M.gzhead.extra.length&&(M.gzindex=0,M.status=73)}else M.status=73;if(M.status===73)if(M.gzhead.name){R=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>R&&(g.adler=d(g.adler,M.pending_buf,M.pending-R,R)),N(g),R=M.pending,M.pending===M.pending_buf_size)){G=1;break}G=M.gzindex<M.gzhead.name.length?255&M.gzhead.name.charCodeAt(M.gzindex++):0,Y(M,G)}while(G!==0);M.gzhead.hcrc&&M.pending>R&&(g.adler=d(g.adler,M.pending_buf,M.pending-R,R)),G===0&&(M.gzindex=0,M.status=91)}else M.status=91;if(M.status===91)if(M.gzhead.comment){R=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>R&&(g.adler=d(g.adler,M.pending_buf,M.pending-R,R)),N(g),R=M.pending,M.pending===M.pending_buf_size)){G=1;break}G=M.gzindex<M.gzhead.comment.length?255&M.gzhead.comment.charCodeAt(M.gzindex++):0,Y(M,G)}while(G!==0);M.gzhead.hcrc&&M.pending>R&&(g.adler=d(g.adler,M.pending_buf,M.pending-R,R)),G===0&&(M.status=103)}else M.status=103;if(M.status===103&&(M.gzhead.hcrc?(M.pending+2>M.pending_buf_size&&N(g),M.pending+2<=M.pending_buf_size&&(Y(M,255&g.adler),Y(M,g.adler>>8&255),g.adler=0,M.status=W)):M.status=W),M.pending!==0){if(N(g),g.avail_out===0)return M.last_flush=-1,s}else if(g.avail_in===0&&ee(ae)<=ee(te)&&ae!==m)return re(g,-5);if(M.status===666&&g.avail_in!==0)return re(g,-5);if(g.avail_in!==0||M.lookahead!==0||ae!==C&&M.status!==666){var se=M.strategy===2?function(O,$){for(var J;;){if(O.lookahead===0&&(ye(O),O.lookahead===0)){if($===C)return w;break}if(O.match_length=0,J=i._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++,J&&(z(O,!1),O.strm.avail_out===0))return w}return O.insert=0,$===m?(z(O,!0),O.strm.avail_out===0?he:Z):O.last_lit&&(z(O,!1),O.strm.avail_out===0)?w:j}(M,ae):M.strategy===3?function(O,$){for(var J,Q,ne,de,xe=O.window;;){if(O.lookahead<=T){if(ye(O),O.lookahead<=T&&$===C)return w;if(O.lookahead===0)break}if(O.match_length=0,O.lookahead>=V&&0<O.strstart&&(Q=xe[ne=O.strstart-1])===xe[++ne]&&Q===xe[++ne]&&Q===xe[++ne]){de=O.strstart+T;do;while(Q===xe[++ne]&&Q===xe[++ne]&&Q===xe[++ne]&&Q===xe[++ne]&&Q===xe[++ne]&&Q===xe[++ne]&&Q===xe[++ne]&&Q===xe[++ne]&&ne<de);O.match_length=T-(de-ne),O.match_length>O.lookahead&&(O.match_length=O.lookahead)}if(O.match_length>=V?(J=i._tr_tally(O,1,O.match_length-V),O.lookahead-=O.match_length,O.strstart+=O.match_length,O.match_length=0):(J=i._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++),J&&(z(O,!1),O.strm.avail_out===0))return w}return O.insert=0,$===m?(z(O,!0),O.strm.avail_out===0?he:Z):O.last_lit&&(z(O,!1),O.strm.avail_out===0)?w:j}(M,ae):f[M.level].func(M,ae);if(se!==he&&se!==Z||(M.status=666),se===w||se===he)return g.avail_out===0&&(M.last_flush=-1),s;if(se===j&&(ae===1?i._tr_align(M):ae!==5&&(i._tr_stored_block(M,0,0,!1),ae===3&&(ce(M.head),M.lookahead===0&&(M.strstart=0,M.block_start=0,M.insert=0))),N(g),g.avail_out===0))return M.last_flush=-1,s}return ae!==m?s:M.wrap<=0?1:(M.wrap===2?(Y(M,255&g.adler),Y(M,g.adler>>8&255),Y(M,g.adler>>16&255),Y(M,g.adler>>24&255),Y(M,255&g.total_in),Y(M,g.total_in>>8&255),Y(M,g.total_in>>16&255),Y(M,g.total_in>>24&255)):(K(M,g.adler>>>16),K(M,65535&g.adler)),N(g),0<M.wrap&&(M.wrap=-M.wrap),M.pending!==0?s:1)},E.deflateEnd=function(g){var ae;return g&&g.state?(ae=g.state.status)!==F&&ae!==69&&ae!==73&&ae!==91&&ae!==103&&ae!==W&&ae!==666?re(g,h):(g.state=null,ae===W?re(g,-3):s):h},E.deflateSetDictionary=function(g,ae){var te,M,R,G,le,se,O,$,J=ae.length;if(!g||!g.state||(G=(te=g.state).wrap)===2||G===1&&te.status!==F||te.lookahead)return h;for(G===1&&(g.adler=p(g.adler,ae,J,0)),te.wrap=0,J>=te.w_size&&(G===0&&(ce(te.head),te.strstart=0,te.block_start=0,te.insert=0),$=new b.Buf8(te.w_size),b.arraySet($,ae,J-te.w_size,te.w_size,0),ae=$,J=te.w_size),le=g.avail_in,se=g.next_in,O=g.input,g.avail_in=J,g.next_in=0,g.input=ae,ye(te);te.lookahead>=V;){for(M=te.strstart,R=te.lookahead-(V-1);te.ins_h=(te.ins_h<<te.hash_shift^te.window[M+V-1])&te.hash_mask,te.prev[M&te.w_mask]=te.head[te.ins_h],te.head[te.ins_h]=M,M++,--R;);te.strstart=M,te.lookahead=V-1,ye(te)}return te.strstart+=te.lookahead,te.block_start=te.strstart,te.insert=te.lookahead,te.lookahead=0,te.match_length=te.prev_length=V-1,te.match_available=0,g.next_in=se,g.input=O,g.avail_in=le,te.wrap=G,s},E.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,l,E){l.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,l,E){l.exports=function(f,b){var i,p,d,v,C,m,s,h,n,e,o,c,y,k,_,S,I,H,V,T,q,F,W,w,j;i=f.state,p=f.next_in,w=f.input,d=p+(f.avail_in-5),v=f.next_out,j=f.output,C=v-(b-f.avail_out),m=v+(f.avail_out-257),s=i.dmax,h=i.wsize,n=i.whave,e=i.wnext,o=i.window,c=i.hold,y=i.bits,k=i.lencode,_=i.distcode,S=(1<<i.lenbits)-1,I=(1<<i.distbits)-1;e:do{y<15&&(c+=w[p++]<<y,y+=8,c+=w[p++]<<y,y+=8),H=k[c&S];t:for(;;){if(c>>>=V=H>>>24,y-=V,(V=H>>>16&255)===0)j[v++]=65535&H;else{if(!(16&V)){if(!(64&V)){H=k[(65535&H)+(c&(1<<V)-1)];continue t}if(32&V){i.mode=12;break e}f.msg="invalid literal/length code",i.mode=30;break e}T=65535&H,(V&=15)&&(y<V&&(c+=w[p++]<<y,y+=8),T+=c&(1<<V)-1,c>>>=V,y-=V),y<15&&(c+=w[p++]<<y,y+=8,c+=w[p++]<<y,y+=8),H=_[c&I];r:for(;;){if(c>>>=V=H>>>24,y-=V,!(16&(V=H>>>16&255))){if(!(64&V)){H=_[(65535&H)+(c&(1<<V)-1)];continue r}f.msg="invalid distance code",i.mode=30;break e}if(q=65535&H,y<(V&=15)&&(c+=w[p++]<<y,(y+=8)<V&&(c+=w[p++]<<y,y+=8)),s<(q+=c&(1<<V)-1)){f.msg="invalid distance too far back",i.mode=30;break e}if(c>>>=V,y-=V,(V=v-C)<q){if(n<(V=q-V)&&i.sane){f.msg="invalid distance too far back",i.mode=30;break e}if(W=o,(F=0)===e){if(F+=h-V,V<T){for(T-=V;j[v++]=o[F++],--V;);F=v-q,W=j}}else if(e<V){if(F+=h+e-V,(V-=e)<T){for(T-=V;j[v++]=o[F++],--V;);if(F=0,e<T){for(T-=V=e;j[v++]=o[F++],--V;);F=v-q,W=j}}}else if(F+=e-V,V<T){for(T-=V;j[v++]=o[F++],--V;);F=v-q,W=j}for(;2<T;)j[v++]=W[F++],j[v++]=W[F++],j[v++]=W[F++],T-=3;T&&(j[v++]=W[F++],1<T&&(j[v++]=W[F++]))}else{for(F=v-q;j[v++]=j[F++],j[v++]=j[F++],j[v++]=j[F++],2<(T-=3););T&&(j[v++]=j[F++],1<T&&(j[v++]=j[F++]))}break}}break}}while(p<d&&v<m);p-=T=y>>3,c&=(1<<(y-=T<<3))-1,f.next_in=p,f.next_out=v,f.avail_in=p<d?d-p+5:5-(p-d),f.avail_out=v<m?m-v+257:257-(v-m),i.hold=c,i.bits=y}},{}],49:[function(r,l,E){var f=r("../utils/common"),b=r("./adler32"),i=r("./crc32"),p=r("./inffast"),d=r("./inftrees"),v=1,C=2,m=0,s=-2,h=1,n=852,e=592;function o(F){return(F>>>24&255)+(F>>>8&65280)+((65280&F)<<8)+((255&F)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(F){var W;return F&&F.state?(W=F.state,F.total_in=F.total_out=W.total=0,F.msg="",W.wrap&&(F.adler=1&W.wrap),W.mode=h,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new f.Buf32(n),W.distcode=W.distdyn=new f.Buf32(e),W.sane=1,W.back=-1,m):s}function k(F){var W;return F&&F.state?((W=F.state).wsize=0,W.whave=0,W.wnext=0,y(F)):s}function _(F,W){var w,j;return F&&F.state?(j=F.state,W<0?(w=0,W=-W):(w=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?s:(j.window!==null&&j.wbits!==W&&(j.window=null),j.wrap=w,j.wbits=W,k(F))):s}function S(F,W){var w,j;return F?(j=new c,(F.state=j).window=null,(w=_(F,W))!==m&&(F.state=null),w):s}var I,H,V=!0;function T(F){if(V){var W;for(I=new f.Buf32(512),H=new f.Buf32(32),W=0;W<144;)F.lens[W++]=8;for(;W<256;)F.lens[W++]=9;for(;W<280;)F.lens[W++]=7;for(;W<288;)F.lens[W++]=8;for(d(v,F.lens,0,288,I,0,F.work,{bits:9}),W=0;W<32;)F.lens[W++]=5;d(C,F.lens,0,32,H,0,F.work,{bits:5}),V=!1}F.lencode=I,F.lenbits=9,F.distcode=H,F.distbits=5}function q(F,W,w,j){var he,Z=F.state;return Z.window===null&&(Z.wsize=1<<Z.wbits,Z.wnext=0,Z.whave=0,Z.window=new f.Buf8(Z.wsize)),j>=Z.wsize?(f.arraySet(Z.window,W,w-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize):(j<(he=Z.wsize-Z.wnext)&&(he=j),f.arraySet(Z.window,W,w-j,he,Z.wnext),(j-=he)?(f.arraySet(Z.window,W,w-j,j,0),Z.wnext=j,Z.whave=Z.wsize):(Z.wnext+=he,Z.wnext===Z.wsize&&(Z.wnext=0),Z.whave<Z.wsize&&(Z.whave+=he))),0}E.inflateReset=k,E.inflateReset2=_,E.inflateResetKeep=y,E.inflateInit=function(F){return S(F,15)},E.inflateInit2=S,E.inflate=function(F,W){var w,j,he,Z,re,ee,ce,N,z,Y,K,B,ye,Ce,ue,Ae,Re,Pe,Ue,We,g,ae,te,M,R=0,G=new f.Buf8(4),le=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!F||!F.state||!F.output||!F.input&&F.avail_in!==0)return s;(w=F.state).mode===12&&(w.mode=13),re=F.next_out,he=F.output,ce=F.avail_out,Z=F.next_in,j=F.input,ee=F.avail_in,N=w.hold,z=w.bits,Y=ee,K=ce,ae=m;e:for(;;)switch(w.mode){case h:if(w.wrap===0){w.mode=13;break}for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(2&w.wrap&&N===35615){G[w.check=0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0),z=N=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&N)<<8)+(N>>8))%31){F.msg="incorrect header check",w.mode=30;break}if((15&N)!=8){F.msg="unknown compression method",w.mode=30;break}if(z-=4,g=8+(15&(N>>>=4)),w.wbits===0)w.wbits=g;else if(g>w.wbits){F.msg="invalid window size",w.mode=30;break}w.dmax=1<<g,F.adler=w.check=1,w.mode=512&N?10:12,z=N=0;break;case 2:for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(w.flags=N,(255&w.flags)!=8){F.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){F.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=N>>8&1),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0)),z=N=0,w.mode=3;case 3:for(;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.head&&(w.head.time=N),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,G[2]=N>>>16&255,G[3]=N>>>24&255,w.check=i(w.check,G,4,0)),z=N=0,w.mode=4;case 4:for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.head&&(w.head.xflags=255&N,w.head.os=N>>8),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0)),z=N=0,w.mode=5;case 5:if(1024&w.flags){for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.length=N,w.head&&(w.head.extra_len=N),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0)),z=N=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(ee<(B=w.length)&&(B=ee),B&&(w.head&&(g=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),f.arraySet(w.head.extra,j,Z,B,g)),512&w.flags&&(w.check=i(w.check,j,B,Z)),ee-=B,Z+=B,w.length-=B),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(ee===0)break e;for(B=0;g=j[Z+B++],w.head&&g&&w.length<65536&&(w.head.name+=String.fromCharCode(g)),g&&B<ee;);if(512&w.flags&&(w.check=i(w.check,j,B,Z)),ee-=B,Z+=B,g)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(ee===0)break e;for(B=0;g=j[Z+B++],w.head&&g&&w.length<65536&&(w.head.comment+=String.fromCharCode(g)),g&&B<ee;);if(512&w.flags&&(w.check=i(w.check,j,B,Z)),ee-=B,Z+=B,g)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(N!==(65535&w.check)){F.msg="header crc mismatch",w.mode=30;break}z=N=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),F.adler=w.check=0,w.mode=12;break;case 10:for(;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}F.adler=w.check=o(N),z=N=0,w.mode=11;case 11:if(w.havedict===0)return F.next_out=re,F.avail_out=ce,F.next_in=Z,F.avail_in=ee,w.hold=N,w.bits=z,2;F.adler=w.check=1,w.mode=12;case 12:if(W===5||W===6)break e;case 13:if(w.last){N>>>=7&z,z-=7&z,w.mode=27;break}for(;z<3;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}switch(w.last=1&N,z-=1,3&(N>>>=1)){case 0:w.mode=14;break;case 1:if(T(w),w.mode=20,W!==6)break;N>>>=2,z-=2;break e;case 2:w.mode=17;break;case 3:F.msg="invalid block type",w.mode=30}N>>>=2,z-=2;break;case 14:for(N>>>=7&z,z-=7&z;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if((65535&N)!=(N>>>16^65535)){F.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&N,z=N=0,w.mode=15,W===6)break e;case 15:w.mode=16;case 16:if(B=w.length){if(ee<B&&(B=ee),ce<B&&(B=ce),B===0)break e;f.arraySet(he,j,Z,B,re),ee-=B,Z+=B,ce-=B,re+=B,w.length-=B;break}w.mode=12;break;case 17:for(;z<14;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(w.nlen=257+(31&N),N>>>=5,z-=5,w.ndist=1+(31&N),N>>>=5,z-=5,w.ncode=4+(15&N),N>>>=4,z-=4,286<w.nlen||30<w.ndist){F.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;z<3;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.lens[le[w.have++]]=7&N,N>>>=3,z-=3}for(;w.have<19;)w.lens[le[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,te={bits:w.lenbits},ae=d(0,w.lens,0,19,w.lencode,0,w.work,te),w.lenbits=te.bits,ae){F.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;Ae=(R=w.lencode[N&(1<<w.lenbits)-1])>>>16&255,Re=65535&R,!((ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(Re<16)N>>>=ue,z-=ue,w.lens[w.have++]=Re;else{if(Re===16){for(M=ue+2;z<M;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(N>>>=ue,z-=ue,w.have===0){F.msg="invalid bit length repeat",w.mode=30;break}g=w.lens[w.have-1],B=3+(3&N),N>>>=2,z-=2}else if(Re===17){for(M=ue+3;z<M;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}z-=ue,g=0,B=3+(7&(N>>>=ue)),N>>>=3,z-=3}else{for(M=ue+7;z<M;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}z-=ue,g=0,B=11+(127&(N>>>=ue)),N>>>=7,z-=7}if(w.have+B>w.nlen+w.ndist){F.msg="invalid bit length repeat",w.mode=30;break}for(;B--;)w.lens[w.have++]=g}}if(w.mode===30)break;if(w.lens[256]===0){F.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,te={bits:w.lenbits},ae=d(v,w.lens,0,w.nlen,w.lencode,0,w.work,te),w.lenbits=te.bits,ae){F.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,te={bits:w.distbits},ae=d(C,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,te),w.distbits=te.bits,ae){F.msg="invalid distances set",w.mode=30;break}if(w.mode=20,W===6)break e;case 20:w.mode=21;case 21:if(6<=ee&&258<=ce){F.next_out=re,F.avail_out=ce,F.next_in=Z,F.avail_in=ee,w.hold=N,w.bits=z,p(F,K),re=F.next_out,he=F.output,ce=F.avail_out,Z=F.next_in,j=F.input,ee=F.avail_in,N=w.hold,z=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;Ae=(R=w.lencode[N&(1<<w.lenbits)-1])>>>16&255,Re=65535&R,!((ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(Ae&&!(240&Ae)){for(Pe=ue,Ue=Ae,We=Re;Ae=(R=w.lencode[We+((N&(1<<Pe+Ue)-1)>>Pe)])>>>16&255,Re=65535&R,!(Pe+(ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}N>>>=Pe,z-=Pe,w.back+=Pe}if(N>>>=ue,z-=ue,w.back+=ue,w.length=Re,Ae===0){w.mode=26;break}if(32&Ae){w.back=-1,w.mode=12;break}if(64&Ae){F.msg="invalid literal/length code",w.mode=30;break}w.extra=15&Ae,w.mode=22;case 22:if(w.extra){for(M=w.extra;z<M;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.length+=N&(1<<w.extra)-1,N>>>=w.extra,z-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;Ae=(R=w.distcode[N&(1<<w.distbits)-1])>>>16&255,Re=65535&R,!((ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(!(240&Ae)){for(Pe=ue,Ue=Ae,We=Re;Ae=(R=w.distcode[We+((N&(1<<Pe+Ue)-1)>>Pe)])>>>16&255,Re=65535&R,!(Pe+(ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}N>>>=Pe,z-=Pe,w.back+=Pe}if(N>>>=ue,z-=ue,w.back+=ue,64&Ae){F.msg="invalid distance code",w.mode=30;break}w.offset=Re,w.extra=15&Ae,w.mode=24;case 24:if(w.extra){for(M=w.extra;z<M;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.offset+=N&(1<<w.extra)-1,N>>>=w.extra,z-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){F.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(ce===0)break e;if(B=K-ce,w.offset>B){if((B=w.offset-B)>w.whave&&w.sane){F.msg="invalid distance too far back",w.mode=30;break}ye=B>w.wnext?(B-=w.wnext,w.wsize-B):w.wnext-B,B>w.length&&(B=w.length),Ce=w.window}else Ce=he,ye=re-w.offset,B=w.length;for(ce<B&&(B=ce),ce-=B,w.length-=B;he[re++]=Ce[ye++],--B;);w.length===0&&(w.mode=21);break;case 26:if(ce===0)break e;he[re++]=w.length,ce--,w.mode=21;break;case 27:if(w.wrap){for(;z<32;){if(ee===0)break e;ee--,N|=j[Z++]<<z,z+=8}if(K-=ce,F.total_out+=K,w.total+=K,K&&(F.adler=w.check=w.flags?i(w.check,he,K,re-K):b(w.check,he,K,re-K)),K=ce,(w.flags?N:o(N))!==w.check){F.msg="incorrect data check",w.mode=30;break}z=N=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(N!==(4294967295&w.total)){F.msg="incorrect length check",w.mode=30;break}z=N=0}w.mode=29;case 29:ae=1;break e;case 30:ae=-3;break e;case 31:return-4;case 32:default:return s}return F.next_out=re,F.avail_out=ce,F.next_in=Z,F.avail_in=ee,w.hold=N,w.bits=z,(w.wsize||K!==F.avail_out&&w.mode<30&&(w.mode<27||W!==4))&&q(F,F.output,F.next_out,K-F.avail_out)?(w.mode=31,-4):(Y-=F.avail_in,K-=F.avail_out,F.total_in+=Y,F.total_out+=K,w.total+=K,w.wrap&&K&&(F.adler=w.check=w.flags?i(w.check,he,K,F.next_out-K):b(w.check,he,K,F.next_out-K)),F.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(Y==0&&K===0||W===4)&&ae===m&&(ae=-5),ae)},E.inflateEnd=function(F){if(!F||!F.state)return s;var W=F.state;return W.window&&(W.window=null),F.state=null,m},E.inflateGetHeader=function(F,W){var w;return F&&F.state&&2&(w=F.state).wrap?((w.head=W).done=!1,m):s},E.inflateSetDictionary=function(F,W){var w,j=W.length;return F&&F.state?(w=F.state).wrap!==0&&w.mode!==11?s:w.mode===11&&b(1,W,j,0)!==w.check?-3:q(F,W,j,j)?(w.mode=31,-4):(w.havedict=1,m):s},E.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,l,E){var f=r("../utils/common"),b=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],p=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];l.exports=function(v,C,m,s,h,n,e,o){var c,y,k,_,S,I,H,V,T,q=o.bits,F=0,W=0,w=0,j=0,he=0,Z=0,re=0,ee=0,ce=0,N=0,z=null,Y=0,K=new f.Buf16(16),B=new f.Buf16(16),ye=null,Ce=0;for(F=0;F<=15;F++)K[F]=0;for(W=0;W<s;W++)K[C[m+W]]++;for(he=q,j=15;1<=j&&K[j]===0;j--);if(j<he&&(he=j),j===0)return h[n++]=20971520,h[n++]=20971520,o.bits=1,0;for(w=1;w<j&&K[w]===0;w++);for(he<w&&(he=w),F=ee=1;F<=15;F++)if(ee<<=1,(ee-=K[F])<0)return-1;if(0<ee&&(v===0||j!==1))return-1;for(B[1]=0,F=1;F<15;F++)B[F+1]=B[F]+K[F];for(W=0;W<s;W++)C[m+W]!==0&&(e[B[C[m+W]]++]=W);if(I=v===0?(z=ye=e,19):v===1?(z=b,Y-=257,ye=i,Ce-=257,256):(z=p,ye=d,-1),F=w,S=n,re=W=N=0,k=-1,_=(ce=1<<(Z=he))-1,v===1&&852<ce||v===2&&592<ce)return 1;for(;;){for(H=F-re,T=e[W]<I?(V=0,e[W]):e[W]>I?(V=ye[Ce+e[W]],z[Y+e[W]]):(V=96,0),c=1<<F-re,w=y=1<<Z;h[S+(N>>re)+(y-=c)]=H<<24|V<<16|T|0,y!==0;);for(c=1<<F-1;N&c;)c>>=1;if(c!==0?(N&=c-1,N+=c):N=0,W++,--K[F]==0){if(F===j)break;F=C[m+e[W]]}if(he<F&&(N&_)!==k){for(re===0&&(re=he),S+=w,ee=1<<(Z=F-re);Z+re<j&&!((ee-=K[Z+re])<=0);)Z++,ee<<=1;if(ce+=1<<Z,v===1&&852<ce||v===2&&592<ce)return 1;h[k=N&_]=he<<24|Z<<16|S-n|0}}return N!==0&&(h[S+N]=F-re<<24|64<<16|0),o.bits=he,0}},{"../utils/common":41}],51:[function(r,l,E){l.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,l,E){var f=r("../utils/common"),b=0,i=1;function p(R){for(var G=R.length;0<=--G;)R[G]=0}var d=0,v=29,C=256,m=C+1+v,s=30,h=19,n=2*m+1,e=15,o=16,c=7,y=256,k=16,_=17,S=18,I=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],H=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],V=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(m+2));p(q);var F=new Array(2*s);p(F);var W=new Array(512);p(W);var w=new Array(256);p(w);var j=new Array(v);p(j);var he,Z,re,ee=new Array(s);function ce(R,G,le,se,O){this.static_tree=R,this.extra_bits=G,this.extra_base=le,this.elems=se,this.max_length=O,this.has_stree=R&&R.length}function N(R,G){this.dyn_tree=R,this.max_code=0,this.stat_desc=G}function z(R){return R<256?W[R]:W[256+(R>>>7)]}function Y(R,G){R.pending_buf[R.pending++]=255&G,R.pending_buf[R.pending++]=G>>>8&255}function K(R,G,le){R.bi_valid>o-le?(R.bi_buf|=G<<R.bi_valid&65535,Y(R,R.bi_buf),R.bi_buf=G>>o-R.bi_valid,R.bi_valid+=le-o):(R.bi_buf|=G<<R.bi_valid&65535,R.bi_valid+=le)}function B(R,G,le){K(R,le[2*G],le[2*G+1])}function ye(R,G){for(var le=0;le|=1&R,R>>>=1,le<<=1,0<--G;);return le>>>1}function Ce(R,G,le){var se,O,$=new Array(e+1),J=0;for(se=1;se<=e;se++)$[se]=J=J+le[se-1]<<1;for(O=0;O<=G;O++){var Q=R[2*O+1];Q!==0&&(R[2*O]=ye($[Q]++,Q))}}function ue(R){var G;for(G=0;G<m;G++)R.dyn_ltree[2*G]=0;for(G=0;G<s;G++)R.dyn_dtree[2*G]=0;for(G=0;G<h;G++)R.bl_tree[2*G]=0;R.dyn_ltree[2*y]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function Ae(R){8<R.bi_valid?Y(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function Re(R,G,le,se){var O=2*G,$=2*le;return R[O]<R[$]||R[O]===R[$]&&se[G]<=se[le]}function Pe(R,G,le){for(var se=R.heap[le],O=le<<1;O<=R.heap_len&&(O<R.heap_len&&Re(G,R.heap[O+1],R.heap[O],R.depth)&&O++,!Re(G,se,R.heap[O],R.depth));)R.heap[le]=R.heap[O],le=O,O<<=1;R.heap[le]=se}function Ue(R,G,le){var se,O,$,J,Q=0;if(R.last_lit!==0)for(;se=R.pending_buf[R.d_buf+2*Q]<<8|R.pending_buf[R.d_buf+2*Q+1],O=R.pending_buf[R.l_buf+Q],Q++,se===0?B(R,O,G):(B(R,($=w[O])+C+1,G),(J=I[$])!==0&&K(R,O-=j[$],J),B(R,$=z(--se),le),(J=H[$])!==0&&K(R,se-=ee[$],J)),Q<R.last_lit;);B(R,y,G)}function We(R,G){var le,se,O,$=G.dyn_tree,J=G.stat_desc.static_tree,Q=G.stat_desc.has_stree,ne=G.stat_desc.elems,de=-1;for(R.heap_len=0,R.heap_max=n,le=0;le<ne;le++)$[2*le]!==0?(R.heap[++R.heap_len]=de=le,R.depth[le]=0):$[2*le+1]=0;for(;R.heap_len<2;)$[2*(O=R.heap[++R.heap_len]=de<2?++de:0)]=1,R.depth[O]=0,R.opt_len--,Q&&(R.static_len-=J[2*O+1]);for(G.max_code=de,le=R.heap_len>>1;1<=le;le--)Pe(R,$,le);for(O=ne;le=R.heap[1],R.heap[1]=R.heap[R.heap_len--],Pe(R,$,1),se=R.heap[1],R.heap[--R.heap_max]=le,R.heap[--R.heap_max]=se,$[2*O]=$[2*le]+$[2*se],R.depth[O]=(R.depth[le]>=R.depth[se]?R.depth[le]:R.depth[se])+1,$[2*le+1]=$[2*se+1]=O,R.heap[1]=O++,Pe(R,$,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],function(xe,ve){var pe,fe,ge,ke,ze,qe,$e=ve.dyn_tree,Ze=ve.max_code,Xe=ve.stat_desc.static_tree,ct=ve.stat_desc.has_stree,Ge=ve.stat_desc.extra_bits,ot=ve.stat_desc.extra_base,Je=ve.stat_desc.max_length,et=0;for(ke=0;ke<=e;ke++)xe.bl_count[ke]=0;for($e[2*xe.heap[xe.heap_max]+1]=0,pe=xe.heap_max+1;pe<n;pe++)Je<(ke=$e[2*$e[2*(fe=xe.heap[pe])+1]+1]+1)&&(ke=Je,et++),$e[2*fe+1]=ke,Ze<fe||(xe.bl_count[ke]++,ze=0,ot<=fe&&(ze=Ge[fe-ot]),qe=$e[2*fe],xe.opt_len+=qe*(ke+ze),ct&&(xe.static_len+=qe*(Xe[2*fe+1]+ze)));if(et!==0){do{for(ke=Je-1;xe.bl_count[ke]===0;)ke--;xe.bl_count[ke]--,xe.bl_count[ke+1]+=2,xe.bl_count[Je]--,et-=2}while(0<et);for(ke=Je;ke!==0;ke--)for(fe=xe.bl_count[ke];fe!==0;)Ze<(ge=xe.heap[--pe])||($e[2*ge+1]!==ke&&(xe.opt_len+=(ke-$e[2*ge+1])*$e[2*ge],$e[2*ge+1]=ke),fe--)}}(R,G),Ce($,de,R.bl_count)}function g(R,G,le){var se,O,$=-1,J=G[1],Q=0,ne=7,de=4;for(J===0&&(ne=138,de=3),G[2*(le+1)+1]=65535,se=0;se<=le;se++)O=J,J=G[2*(se+1)+1],++Q<ne&&O===J||(Q<de?R.bl_tree[2*O]+=Q:O!==0?(O!==$&&R.bl_tree[2*O]++,R.bl_tree[2*k]++):Q<=10?R.bl_tree[2*_]++:R.bl_tree[2*S]++,$=O,de=(Q=0)===J?(ne=138,3):O===J?(ne=6,3):(ne=7,4))}function ae(R,G,le){var se,O,$=-1,J=G[1],Q=0,ne=7,de=4;for(J===0&&(ne=138,de=3),se=0;se<=le;se++)if(O=J,J=G[2*(se+1)+1],!(++Q<ne&&O===J)){if(Q<de)for(;B(R,O,R.bl_tree),--Q!=0;);else O!==0?(O!==$&&(B(R,O,R.bl_tree),Q--),B(R,k,R.bl_tree),K(R,Q-3,2)):Q<=10?(B(R,_,R.bl_tree),K(R,Q-3,3)):(B(R,S,R.bl_tree),K(R,Q-11,7));$=O,de=(Q=0)===J?(ne=138,3):O===J?(ne=6,3):(ne=7,4)}}p(ee);var te=!1;function M(R,G,le,se){K(R,(d<<1)+(se?1:0),3),function(O,$,J,Q){Ae(O),Y(O,J),Y(O,~J),f.arraySet(O.pending_buf,O.window,$,J,O.pending),O.pending+=J}(R,G,le)}E._tr_init=function(R){te||(function(){var G,le,se,O,$,J=new Array(e+1);for(O=se=0;O<v-1;O++)for(j[O]=se,G=0;G<1<<I[O];G++)w[se++]=O;for(w[se-1]=O,O=$=0;O<16;O++)for(ee[O]=$,G=0;G<1<<H[O];G++)W[$++]=O;for($>>=7;O<s;O++)for(ee[O]=$<<7,G=0;G<1<<H[O]-7;G++)W[256+$++]=O;for(le=0;le<=e;le++)J[le]=0;for(G=0;G<=143;)q[2*G+1]=8,G++,J[8]++;for(;G<=255;)q[2*G+1]=9,G++,J[9]++;for(;G<=279;)q[2*G+1]=7,G++,J[7]++;for(;G<=287;)q[2*G+1]=8,G++,J[8]++;for(Ce(q,m+1,J),G=0;G<s;G++)F[2*G+1]=5,F[2*G]=ye(G,5);he=new ce(q,I,C+1,m,e),Z=new ce(F,H,0,s,e),re=new ce(new Array(0),V,0,h,c)}(),te=!0),R.l_desc=new N(R.dyn_ltree,he),R.d_desc=new N(R.dyn_dtree,Z),R.bl_desc=new N(R.bl_tree,re),R.bi_buf=0,R.bi_valid=0,ue(R)},E._tr_stored_block=M,E._tr_flush_block=function(R,G,le,se){var O,$,J=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=function(Q){var ne,de=4093624447;for(ne=0;ne<=31;ne++,de>>>=1)if(1&de&&Q.dyn_ltree[2*ne]!==0)return b;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return i;for(ne=32;ne<C;ne++)if(Q.dyn_ltree[2*ne]!==0)return i;return b}(R)),We(R,R.l_desc),We(R,R.d_desc),J=function(Q){var ne;for(g(Q,Q.dyn_ltree,Q.l_desc.max_code),g(Q,Q.dyn_dtree,Q.d_desc.max_code),We(Q,Q.bl_desc),ne=h-1;3<=ne&&Q.bl_tree[2*T[ne]+1]===0;ne--);return Q.opt_len+=3*(ne+1)+5+5+4,ne}(R),O=R.opt_len+3+7>>>3,($=R.static_len+3+7>>>3)<=O&&(O=$)):O=$=le+5,le+4<=O&&G!==-1?M(R,G,le,se):R.strategy===4||$===O?(K(R,2+(se?1:0),3),Ue(R,q,F)):(K(R,4+(se?1:0),3),function(Q,ne,de,xe){var ve;for(K(Q,ne-257,5),K(Q,de-1,5),K(Q,xe-4,4),ve=0;ve<xe;ve++)K(Q,Q.bl_tree[2*T[ve]+1],3);ae(Q,Q.dyn_ltree,ne-1),ae(Q,Q.dyn_dtree,de-1)}(R,R.l_desc.max_code+1,R.d_desc.max_code+1,J+1),Ue(R,R.dyn_ltree,R.dyn_dtree)),ue(R),se&&Ae(R)},E._tr_tally=function(R,G,le){return R.pending_buf[R.d_buf+2*R.last_lit]=G>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&G,R.pending_buf[R.l_buf+R.last_lit]=255&le,R.last_lit++,G===0?R.dyn_ltree[2*le]++:(R.matches++,G--,R.dyn_ltree[2*(w[le]+C+1)]++,R.dyn_dtree[2*z(G)]++),R.last_lit===R.lit_bufsize-1},E._tr_align=function(R){K(R,2,3),B(R,y,q),function(G){G.bi_valid===16?(Y(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.bi_valid-=8)}(R)}},{"../utils/common":41}],53:[function(r,l,E){l.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,l,E){(function(f){(function(b,i){if(!b.setImmediate){var p,d,v,C,m=1,s={},h=!1,n=b.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(b);e=e&&e.setTimeout?e:b,p={}.toString.call(b.process)==="[object process]"?function(k){process.nextTick(function(){c(k)})}:function(){if(b.postMessage&&!b.importScripts){var k=!0,_=b.onmessage;return b.onmessage=function(){k=!1},b.postMessage("","*"),b.onmessage=_,k}}()?(C="setImmediate$"+Math.random()+"$",b.addEventListener?b.addEventListener("message",y,!1):b.attachEvent("onmessage",y),function(k){b.postMessage(C+k,"*")}):b.MessageChannel?((v=new MessageChannel).port1.onmessage=function(k){c(k.data)},function(k){v.port2.postMessage(k)}):n&&"onreadystatechange"in n.createElement("script")?(d=n.documentElement,function(k){var _=n.createElement("script");_.onreadystatechange=function(){c(k),_.onreadystatechange=null,d.removeChild(_),_=null},d.appendChild(_)}):function(k){setTimeout(c,0,k)},e.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var _=new Array(arguments.length-1),S=0;S<_.length;S++)_[S]=arguments[S+1];var I={callback:k,args:_};return s[m]=I,p(m),m++},e.clearImmediate=o}function o(k){delete s[k]}function c(k){if(h)setTimeout(c,0,k);else{var _=s[k];if(_){h=!0;try{(function(S){var I=S.callback,H=S.args;switch(H.length){case 0:I();break;case 1:I(H[0]);break;case 2:I(H[0],H[1]);break;case 3:I(H[0],H[1],H[2]);break;default:I.apply(i,H)}})(_)}finally{o(k),h=!1}}}}function y(k){k.source===b&&typeof k.data=="string"&&k.data.indexOf(C)===0&&c(+k.data.slice(C.length))}})(typeof self>"u"?f===void 0?this:f:self)}).call(this,typeof De<"u"?De:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Un);var Yi=Un.exports;const Ki=Pn(Yi);var Mn={exports:{}},Er={exports:{}};const ji=Gi(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Vn;function Oe(){return Vn||(Vn=1,function(x,X){(function(r,l){x.exports=l()})(De,function(){var r=r||function(l,E){var f;if(typeof window<"u"&&window.crypto&&(f=window.crypto),typeof self<"u"&&self.crypto&&(f=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(f=globalThis.crypto),!f&&typeof window<"u"&&window.msCrypto&&(f=window.msCrypto),!f&&typeof De<"u"&&De.crypto&&(f=De.crypto),!f&&typeof Tt=="function")try{f=ji}catch{}var b=function(){if(f){if(typeof f.getRandomValues=="function")try{return f.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof f.randomBytes=="function")try{return f.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function c(){}return function(y){var k;return c.prototype=y,k=new c,c.prototype=null,k}}(),p={},d=p.lib={},v=d.Base=function(){return{extend:function(c){var y=i(this);return c&&y.mixIn(c),(!y.hasOwnProperty("init")||this.init===y.init)&&(y.init=function(){y.$super.init.apply(this,arguments)}),y.init.prototype=y,y.$super=this,y},create:function(){var c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var y in c)c.hasOwnProperty(y)&&(this[y]=c[y]);c.hasOwnProperty("toString")&&(this.toString=c.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),C=d.WordArray=v.extend({init:function(c,y){c=this.words=c||[],y!=E?this.sigBytes=y:this.sigBytes=c.length*4},toString:function(c){return(c||s).stringify(this)},concat:function(c){var y=this.words,k=c.words,_=this.sigBytes,S=c.sigBytes;if(this.clamp(),_%4)for(var I=0;I<S;I++){var H=k[I>>>2]>>>24-I%4*8&255;y[_+I>>>2]|=H<<24-(_+I)%4*8}else for(var V=0;V<S;V+=4)y[_+V>>>2]=k[V>>>2];return this.sigBytes+=S,this},clamp:function(){var c=this.words,y=this.sigBytes;c[y>>>2]&=4294967295<<32-y%4*8,c.length=l.ceil(y/4)},clone:function(){var c=v.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var y=[],k=0;k<c;k+=4)y.push(b());return new C.init(y,c)}}),m=p.enc={},s=m.Hex={stringify:function(c){for(var y=c.words,k=c.sigBytes,_=[],S=0;S<k;S++){var I=y[S>>>2]>>>24-S%4*8&255;_.push((I>>>4).toString(16)),_.push((I&15).toString(16))}return _.join("")},parse:function(c){for(var y=c.length,k=[],_=0;_<y;_+=2)k[_>>>3]|=parseInt(c.substr(_,2),16)<<24-_%8*4;return new C.init(k,y/2)}},h=m.Latin1={stringify:function(c){for(var y=c.words,k=c.sigBytes,_=[],S=0;S<k;S++){var I=y[S>>>2]>>>24-S%4*8&255;_.push(String.fromCharCode(I))}return _.join("")},parse:function(c){for(var y=c.length,k=[],_=0;_<y;_++)k[_>>>2]|=(c.charCodeAt(_)&255)<<24-_%4*8;return new C.init(k,y)}},n=m.Utf8={stringify:function(c){try{return decodeURIComponent(escape(h.stringify(c)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(c){return h.parse(unescape(encodeURIComponent(c)))}},e=d.BufferedBlockAlgorithm=v.extend({reset:function(){this._data=new C.init,this._nDataBytes=0},_append:function(c){typeof c=="string"&&(c=n.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes},_process:function(c){var y,k=this._data,_=k.words,S=k.sigBytes,I=this.blockSize,H=I*4,V=S/H;c?V=l.ceil(V):V=l.max((V|0)-this._minBufferSize,0);var T=V*I,q=l.min(T*4,S);if(T){for(var F=0;F<T;F+=I)this._doProcessBlock(_,F);y=_.splice(0,T),k.sigBytes-=q}return new C.init(y,q)},clone:function(){var c=v.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});d.Hasher=e.extend({cfg:v.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset()},reset:function(){e.reset.call(this),this._doReset()},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var y=this._doFinalize();return y},blockSize:16,_createHelper:function(c){return function(y,k){return new c.init(k).finalize(y)}},_createHmacHelper:function(c){return function(y,k){return new o.HMAC.init(c,k).finalize(y)}}});var o=p.algo={};return p}(Math);return r})}(Er)),Er.exports}var Cr={exports:{}},Wn;function Gt(){return Wn||(Wn=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(l){var E=r,f=E.lib,b=f.Base,i=f.WordArray,p=E.x64={};p.Word=b.extend({init:function(d,v){this.high=d,this.low=v}}),p.WordArray=b.extend({init:function(d,v){d=this.words=d||[],v!=l?this.sigBytes=v:this.sigBytes=d.length*8},toX32:function(){for(var d=this.words,v=d.length,C=[],m=0;m<v;m++){var s=d[m];C.push(s.high),C.push(s.low)}return i.create(C,this.sigBytes)},clone:function(){for(var d=b.clone.call(this),v=d.words=this.words.slice(0),C=v.length,m=0;m<C;m++)v[m]=v[m].clone();return d}})}(),r})}(Cr)),Cr.exports}var Br={exports:{}},$n;function Ji(){return $n||($n=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(){if(typeof ArrayBuffer=="function"){var l=r,E=l.lib,f=E.WordArray,b=f.init,i=f.init=function(p){if(p instanceof ArrayBuffer&&(p=new Uint8Array(p)),(p instanceof Int8Array||typeof Uint8ClampedArray<"u"&&p instanceof Uint8ClampedArray||p instanceof Int16Array||p instanceof Uint16Array||p instanceof Int32Array||p instanceof Uint32Array||p instanceof Float32Array||p instanceof Float64Array)&&(p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength)),p instanceof Uint8Array){for(var d=p.byteLength,v=[],C=0;C<d;C++)v[C>>>2]|=p[C]<<24-C%4*8;b.call(this,v,d)}else b.apply(this,arguments)};i.prototype=f}}(),r.lib.WordArray})}(Br)),Br.exports}var _r={exports:{}},Hn;function Qi(){return Hn||(Hn=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(){var l=r,E=l.lib,f=E.WordArray,b=l.enc;b.Utf16=b.Utf16BE={stringify:function(p){for(var d=p.words,v=p.sigBytes,C=[],m=0;m<v;m+=2){var s=d[m>>>2]>>>16-m%4*8&65535;C.push(String.fromCharCode(s))}return C.join("")},parse:function(p){for(var d=p.length,v=[],C=0;C<d;C++)v[C>>>1]|=p.charCodeAt(C)<<16-C%2*16;return f.create(v,d*2)}},b.Utf16LE={stringify:function(p){for(var d=p.words,v=p.sigBytes,C=[],m=0;m<v;m+=2){var s=i(d[m>>>2]>>>16-m%4*8&65535);C.push(String.fromCharCode(s))}return C.join("")},parse:function(p){for(var d=p.length,v=[],C=0;C<d;C++)v[C>>>1]|=i(p.charCodeAt(C)<<16-C%2*16);return f.create(v,d*2)}};function i(p){return p<<8&4278255360|p>>>8&16711935}}(),r.enc.Utf16})}(_r)),_r.exports}var Ar={exports:{}},qn;function yt(){return qn||(qn=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(){var l=r,E=l.lib,f=E.WordArray,b=l.enc;b.Base64={stringify:function(p){var d=p.words,v=p.sigBytes,C=this._map;p.clamp();for(var m=[],s=0;s<v;s+=3)for(var h=d[s>>>2]>>>24-s%4*8&255,n=d[s+1>>>2]>>>24-(s+1)%4*8&255,e=d[s+2>>>2]>>>24-(s+2)%4*8&255,o=h<<16|n<<8|e,c=0;c<4&&s+c*.75<v;c++)m.push(C.charAt(o>>>6*(3-c)&63));var y=C.charAt(64);if(y)for(;m.length%4;)m.push(y);return m.join("")},parse:function(p){var d=p.length,v=this._map,C=this._reverseMap;if(!C){C=this._reverseMap=[];for(var m=0;m<v.length;m++)C[v.charCodeAt(m)]=m}var s=v.charAt(64);if(s){var h=p.indexOf(s);h!==-1&&(d=h)}return i(p,d,C)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function i(p,d,v){for(var C=[],m=0,s=0;s<d;s++)if(s%4){var h=v[p.charCodeAt(s-1)]<<s%4*2,n=v[p.charCodeAt(s)]>>>6-s%4*2,e=h|n;C[m>>>2]|=e<<24-m%4*8,m++}return f.create(C,m)}}(),r.enc.Base64})}(Ar)),Ar.exports}var Dr={exports:{}},Xn;function e0(){return Xn||(Xn=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(){var l=r,E=l.lib,f=E.WordArray,b=l.enc;b.Base64url={stringify:function(p,d){d===void 0&&(d=!0);var v=p.words,C=p.sigBytes,m=d?this._safe_map:this._map;p.clamp();for(var s=[],h=0;h<C;h+=3)for(var n=v[h>>>2]>>>24-h%4*8&255,e=v[h+1>>>2]>>>24-(h+1)%4*8&255,o=v[h+2>>>2]>>>24-(h+2)%4*8&255,c=n<<16|e<<8|o,y=0;y<4&&h+y*.75<C;y++)s.push(m.charAt(c>>>6*(3-y)&63));var k=m.charAt(64);if(k)for(;s.length%4;)s.push(k);return s.join("")},parse:function(p,d){d===void 0&&(d=!0);var v=p.length,C=d?this._safe_map:this._map,m=this._reverseMap;if(!m){m=this._reverseMap=[];for(var s=0;s<C.length;s++)m[C.charCodeAt(s)]=s}var h=C.charAt(64);if(h){var n=p.indexOf(h);n!==-1&&(v=n)}return i(p,v,m)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function i(p,d,v){for(var C=[],m=0,s=0;s<d;s++)if(s%4){var h=v[p.charCodeAt(s-1)]<<s%4*2,n=v[p.charCodeAt(s)]>>>6-s%4*2,e=h|n;C[m>>>2]|=e<<24-m%4*8,m++}return f.create(C,m)}}(),r.enc.Base64url})}(Dr)),Dr.exports}var Fr={exports:{}},Zn;function wt(){return Zn||(Zn=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(l){var E=r,f=E.lib,b=f.WordArray,i=f.Hasher,p=E.algo,d=[];(function(){for(var n=0;n<64;n++)d[n]=l.abs(l.sin(n+1))*4294967296|0})();var v=p.MD5=i.extend({_doReset:function(){this._hash=new b.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(n,e){for(var o=0;o<16;o++){var c=e+o,y=n[c];n[c]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360}var k=this._hash.words,_=n[e+0],S=n[e+1],I=n[e+2],H=n[e+3],V=n[e+4],T=n[e+5],q=n[e+6],F=n[e+7],W=n[e+8],w=n[e+9],j=n[e+10],he=n[e+11],Z=n[e+12],re=n[e+13],ee=n[e+14],ce=n[e+15],N=k[0],z=k[1],Y=k[2],K=k[3];N=C(N,z,Y,K,_,7,d[0]),K=C(K,N,z,Y,S,12,d[1]),Y=C(Y,K,N,z,I,17,d[2]),z=C(z,Y,K,N,H,22,d[3]),N=C(N,z,Y,K,V,7,d[4]),K=C(K,N,z,Y,T,12,d[5]),Y=C(Y,K,N,z,q,17,d[6]),z=C(z,Y,K,N,F,22,d[7]),N=C(N,z,Y,K,W,7,d[8]),K=C(K,N,z,Y,w,12,d[9]),Y=C(Y,K,N,z,j,17,d[10]),z=C(z,Y,K,N,he,22,d[11]),N=C(N,z,Y,K,Z,7,d[12]),K=C(K,N,z,Y,re,12,d[13]),Y=C(Y,K,N,z,ee,17,d[14]),z=C(z,Y,K,N,ce,22,d[15]),N=m(N,z,Y,K,S,5,d[16]),K=m(K,N,z,Y,q,9,d[17]),Y=m(Y,K,N,z,he,14,d[18]),z=m(z,Y,K,N,_,20,d[19]),N=m(N,z,Y,K,T,5,d[20]),K=m(K,N,z,Y,j,9,d[21]),Y=m(Y,K,N,z,ce,14,d[22]),z=m(z,Y,K,N,V,20,d[23]),N=m(N,z,Y,K,w,5,d[24]),K=m(K,N,z,Y,ee,9,d[25]),Y=m(Y,K,N,z,H,14,d[26]),z=m(z,Y,K,N,W,20,d[27]),N=m(N,z,Y,K,re,5,d[28]),K=m(K,N,z,Y,I,9,d[29]),Y=m(Y,K,N,z,F,14,d[30]),z=m(z,Y,K,N,Z,20,d[31]),N=s(N,z,Y,K,T,4,d[32]),K=s(K,N,z,Y,W,11,d[33]),Y=s(Y,K,N,z,he,16,d[34]),z=s(z,Y,K,N,ee,23,d[35]),N=s(N,z,Y,K,S,4,d[36]),K=s(K,N,z,Y,V,11,d[37]),Y=s(Y,K,N,z,F,16,d[38]),z=s(z,Y,K,N,j,23,d[39]),N=s(N,z,Y,K,re,4,d[40]),K=s(K,N,z,Y,_,11,d[41]),Y=s(Y,K,N,z,H,16,d[42]),z=s(z,Y,K,N,q,23,d[43]),N=s(N,z,Y,K,w,4,d[44]),K=s(K,N,z,Y,Z,11,d[45]),Y=s(Y,K,N,z,ce,16,d[46]),z=s(z,Y,K,N,I,23,d[47]),N=h(N,z,Y,K,_,6,d[48]),K=h(K,N,z,Y,F,10,d[49]),Y=h(Y,K,N,z,ee,15,d[50]),z=h(z,Y,K,N,T,21,d[51]),N=h(N,z,Y,K,Z,6,d[52]),K=h(K,N,z,Y,H,10,d[53]),Y=h(Y,K,N,z,j,15,d[54]),z=h(z,Y,K,N,S,21,d[55]),N=h(N,z,Y,K,W,6,d[56]),K=h(K,N,z,Y,ce,10,d[57]),Y=h(Y,K,N,z,q,15,d[58]),z=h(z,Y,K,N,re,21,d[59]),N=h(N,z,Y,K,V,6,d[60]),K=h(K,N,z,Y,he,10,d[61]),Y=h(Y,K,N,z,I,15,d[62]),z=h(z,Y,K,N,w,21,d[63]),k[0]=k[0]+N|0,k[1]=k[1]+z|0,k[2]=k[2]+Y|0,k[3]=k[3]+K|0},_doFinalize:function(){var n=this._data,e=n.words,o=this._nDataBytes*8,c=n.sigBytes*8;e[c>>>5]|=128<<24-c%32;var y=l.floor(o/4294967296),k=o;e[(c+64>>>9<<4)+15]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,e[(c+64>>>9<<4)+14]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,n.sigBytes=(e.length+1)*4,this._process();for(var _=this._hash,S=_.words,I=0;I<4;I++){var H=S[I];S[I]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360}return _},clone:function(){var n=i.clone.call(this);return n._hash=this._hash.clone(),n}});function C(n,e,o,c,y,k,_){var S=n+(e&o|~e&c)+y+_;return(S<<k|S>>>32-k)+e}function m(n,e,o,c,y,k,_){var S=n+(e&c|o&~c)+y+_;return(S<<k|S>>>32-k)+e}function s(n,e,o,c,y,k,_){var S=n+(e^o^c)+y+_;return(S<<k|S>>>32-k)+e}function h(n,e,o,c,y,k,_){var S=n+(o^(e|~c))+y+_;return(S<<k|S>>>32-k)+e}E.MD5=i._createHelper(v),E.HmacMD5=i._createHmacHelper(v)}(Math),r.MD5})}(Fr)),Fr.exports}var Sr={exports:{}},Gn;function Yn(){return Gn||(Gn=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(){var l=r,E=l.lib,f=E.WordArray,b=E.Hasher,i=l.algo,p=[],d=i.SHA1=b.extend({_doReset:function(){this._hash=new f.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(v,C){for(var m=this._hash.words,s=m[0],h=m[1],n=m[2],e=m[3],o=m[4],c=0;c<80;c++){if(c<16)p[c]=v[C+c]|0;else{var y=p[c-3]^p[c-8]^p[c-14]^p[c-16];p[c]=y<<1|y>>>31}var k=(s<<5|s>>>27)+o+p[c];c<20?k+=(h&n|~h&e)+1518500249:c<40?k+=(h^n^e)+1859775393:c<60?k+=(h&n|h&e|n&e)-1894007588:k+=(h^n^e)-899497514,o=e,e=n,n=h<<30|h>>>2,h=s,s=k}m[0]=m[0]+s|0,m[1]=m[1]+h|0,m[2]=m[2]+n|0,m[3]=m[3]+e|0,m[4]=m[4]+o|0},_doFinalize:function(){var v=this._data,C=v.words,m=this._nDataBytes*8,s=v.sigBytes*8;return C[s>>>5]|=128<<24-s%32,C[(s+64>>>9<<4)+14]=Math.floor(m/4294967296),C[(s+64>>>9<<4)+15]=m,v.sigBytes=C.length*4,this._process(),this._hash},clone:function(){var v=b.clone.call(this);return v._hash=this._hash.clone(),v}});l.SHA1=b._createHelper(d),l.HmacSHA1=b._createHmacHelper(d)}(),r.SHA1})}(Sr)),Sr.exports}var Nr={exports:{}},Kn;function Ir(){return Kn||(Kn=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){return function(l){var E=r,f=E.lib,b=f.WordArray,i=f.Hasher,p=E.algo,d=[],v=[];(function(){function s(o){for(var c=l.sqrt(o),y=2;y<=c;y++)if(!(o%y))return!1;return!0}function h(o){return(o-(o|0))*4294967296|0}for(var n=2,e=0;e<64;)s(n)&&(e<8&&(d[e]=h(l.pow(n,1/2))),v[e]=h(l.pow(n,1/3)),e++),n++})();var C=[],m=p.SHA256=i.extend({_doReset:function(){this._hash=new b.init(d.slice(0))},_doProcessBlock:function(s,h){for(var n=this._hash.words,e=n[0],o=n[1],c=n[2],y=n[3],k=n[4],_=n[5],S=n[6],I=n[7],H=0;H<64;H++){if(H<16)C[H]=s[h+H]|0;else{var V=C[H-15],T=(V<<25|V>>>7)^(V<<14|V>>>18)^V>>>3,q=C[H-2],F=(q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10;C[H]=T+C[H-7]+F+C[H-16]}var W=k&_^~k&S,w=e&o^e&c^o&c,j=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),he=(k<<26|k>>>6)^(k<<21|k>>>11)^(k<<7|k>>>25),Z=I+he+W+v[H]+C[H],re=j+w;I=S,S=_,_=k,k=y+Z|0,y=c,c=o,o=e,e=Z+re|0}n[0]=n[0]+e|0,n[1]=n[1]+o|0,n[2]=n[2]+c|0,n[3]=n[3]+y|0,n[4]=n[4]+k|0,n[5]=n[5]+_|0,n[6]=n[6]+S|0,n[7]=n[7]+I|0},_doFinalize:function(){var s=this._data,h=s.words,n=this._nDataBytes*8,e=s.sigBytes*8;return h[e>>>5]|=128<<24-e%32,h[(e+64>>>9<<4)+14]=l.floor(n/4294967296),h[(e+64>>>9<<4)+15]=n,s.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var s=i.clone.call(this);return s._hash=this._hash.clone(),s}});E.SHA256=i._createHelper(m),E.HmacSHA256=i._createHmacHelper(m)}(Math),r.SHA256})}(Nr)),Nr.exports}var Rr={exports:{}},jn;function t0(){return jn||(jn=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),Ir())})(De,function(r){return function(){var l=r,E=l.lib,f=E.WordArray,b=l.algo,i=b.SHA256,p=b.SHA224=i.extend({_doReset:function(){this._hash=new f.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var d=i._doFinalize.call(this);return d.sigBytes-=4,d}});l.SHA224=i._createHelper(p),l.HmacSHA224=i._createHmacHelper(p)}(),r.SHA224})}(Rr)),Rr.exports}var zr={exports:{}},Jn;function Qn(){return Jn||(Jn=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),Gt())})(De,function(r){return function(){var l=r,E=l.lib,f=E.Hasher,b=l.x64,i=b.Word,p=b.WordArray,d=l.algo;function v(){return i.create.apply(i,arguments)}var C=[v(1116352408,3609767458),v(1899447441,602891725),v(3049323471,3964484399),v(3921009573,2173295548),v(961987163,4081628472),v(1508970993,3053834265),v(2453635748,2937671579),v(2870763221,3664609560),v(3624381080,2734883394),v(310598401,1164996542),v(607225278,1323610764),v(1426881987,3590304994),v(1925078388,4068182383),v(2162078206,991336113),v(2614888103,633803317),v(3248222580,3479774868),v(3835390401,2666613458),v(4022224774,944711139),v(264347078,2341262773),v(604807628,2007800933),v(770255983,1495990901),v(1249150122,1856431235),v(1555081692,3175218132),v(1996064986,2198950837),v(2554220882,3999719339),v(2821834349,766784016),v(2952996808,2566594879),v(3210313671,3203337956),v(3336571891,1034457026),v(3584528711,2466948901),v(113926993,3758326383),v(338241895,168717936),v(666307205,1188179964),v(773529912,1546045734),v(1294757372,1522805485),v(1396182291,2643833823),v(1695183700,2343527390),v(1986661051,1014477480),v(2177026350,1206759142),v(2456956037,344077627),v(2730485921,1290863460),v(2820302411,3158454273),v(3259730800,3505952657),v(3345764771,106217008),v(3516065817,3606008344),v(3600352804,1432725776),v(4094571909,1467031594),v(275423344,851169720),v(430227734,3100823752),v(506948616,1363258195),v(659060556,3750685593),v(883997877,3785050280),v(958139571,3318307427),v(1322822218,3812723403),v(1537002063,2003034995),v(1747873779,3602036899),v(1955562222,1575990012),v(2024104815,1125592928),v(2227730452,2716904306),v(2361852424,442776044),v(2428436474,593698344),v(2756734187,3733110249),v(3204031479,2999351573),v(3329325298,3815920427),v(3391569614,3928383900),v(3515267271,566280711),v(3940187606,3454069534),v(4118630271,4000239992),v(116418474,1914138554),v(174292421,2731055270),v(289380356,3203993006),v(460393269,320620315),v(685471733,587496836),v(852142971,1086792851),v(1017036298,365543100),v(1126000580,2618297676),v(1288033470,3409855158),v(1501505948,4234509866),v(1607167915,987167468),v(1816402316,1246189591)],m=[];(function(){for(var h=0;h<80;h++)m[h]=v()})();var s=d.SHA512=f.extend({_doReset:function(){this._hash=new p.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(h,n){for(var e=this._hash.words,o=e[0],c=e[1],y=e[2],k=e[3],_=e[4],S=e[5],I=e[6],H=e[7],V=o.high,T=o.low,q=c.high,F=c.low,W=y.high,w=y.low,j=k.high,he=k.low,Z=_.high,re=_.low,ee=S.high,ce=S.low,N=I.high,z=I.low,Y=H.high,K=H.low,B=V,ye=T,Ce=q,ue=F,Ae=W,Re=w,Pe=j,Ue=he,We=Z,g=re,ae=ee,te=ce,M=N,R=z,G=Y,le=K,se=0;se<80;se++){var O,$,J=m[se];if(se<16)$=J.high=h[n+se*2]|0,O=J.low=h[n+se*2+1]|0;else{var Q=m[se-15],ne=Q.high,de=Q.low,xe=(ne>>>1|de<<31)^(ne>>>8|de<<24)^ne>>>7,ve=(de>>>1|ne<<31)^(de>>>8|ne<<24)^(de>>>7|ne<<25),pe=m[se-2],fe=pe.high,ge=pe.low,ke=(fe>>>19|ge<<13)^(fe<<3|ge>>>29)^fe>>>6,ze=(ge>>>19|fe<<13)^(ge<<3|fe>>>29)^(ge>>>6|fe<<26),qe=m[se-7],$e=qe.high,Ze=qe.low,Xe=m[se-16],ct=Xe.high,Ge=Xe.low;O=ve+Ze,$=xe+$e+(O>>>0<ve>>>0?1:0),O=O+ze,$=$+ke+(O>>>0<ze>>>0?1:0),O=O+Ge,$=$+ct+(O>>>0<Ge>>>0?1:0),J.high=$,J.low=O}var ot=We&ae^~We&M,Je=g&te^~g&R,et=B&Ce^B&Ae^Ce&Ae,ln=ye&ue^ye&Re^ue&Re,Kt=(B>>>28|ye<<4)^(B<<30|ye>>>2)^(B<<25|ye>>>7),Ot=(ye>>>28|B<<4)^(ye<<30|B>>>2)^(ye<<25|B>>>7),jt=(We>>>14|g<<18)^(We>>>18|g<<14)^(We<<23|g>>>9),cn=(g>>>14|We<<18)^(g>>>18|We<<14)^(g<<23|We>>>9),Jt=C[se],Lt=Jt.high,Qt=Jt.low,Qe=le+cn,it=G+jt+(Qe>>>0<le>>>0?1:0),Qe=Qe+Je,it=it+ot+(Qe>>>0<Je>>>0?1:0),Qe=Qe+Qt,it=it+Lt+(Qe>>>0<Qt>>>0?1:0),Qe=Qe+O,it=it+$+(Qe>>>0<O>>>0?1:0),_t=Ot+ln,dn=Kt+et+(_t>>>0<Ot>>>0?1:0);G=M,le=R,M=ae,R=te,ae=We,te=g,g=Ue+Qe|0,We=Pe+it+(g>>>0<Ue>>>0?1:0)|0,Pe=Ae,Ue=Re,Ae=Ce,Re=ue,Ce=B,ue=ye,ye=Qe+_t|0,B=it+dn+(ye>>>0<Qe>>>0?1:0)|0}T=o.low=T+ye,o.high=V+B+(T>>>0<ye>>>0?1:0),F=c.low=F+ue,c.high=q+Ce+(F>>>0<ue>>>0?1:0),w=y.low=w+Re,y.high=W+Ae+(w>>>0<Re>>>0?1:0),he=k.low=he+Ue,k.high=j+Pe+(he>>>0<Ue>>>0?1:0),re=_.low=re+g,_.high=Z+We+(re>>>0<g>>>0?1:0),ce=S.low=ce+te,S.high=ee+ae+(ce>>>0<te>>>0?1:0),z=I.low=z+R,I.high=N+M+(z>>>0<R>>>0?1:0),K=H.low=K+le,H.high=Y+G+(K>>>0<le>>>0?1:0)},_doFinalize:function(){var h=this._data,n=h.words,e=this._nDataBytes*8,o=h.sigBytes*8;n[o>>>5]|=128<<24-o%32,n[(o+128>>>10<<5)+30]=Math.floor(e/4294967296),n[(o+128>>>10<<5)+31]=e,h.sigBytes=n.length*4,this._process();var c=this._hash.toX32();return c},clone:function(){var h=f.clone.call(this);return h._hash=this._hash.clone(),h},blockSize:1024/32});l.SHA512=f._createHelper(s),l.HmacSHA512=f._createHmacHelper(s)}(),r.SHA512})}(zr)),zr.exports}var Tr={exports:{}},ea;function r0(){return ea||(ea=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),Gt(),Qn())})(De,function(r){return function(){var l=r,E=l.x64,f=E.Word,b=E.WordArray,i=l.algo,p=i.SHA512,d=i.SHA384=p.extend({_doReset:function(){this._hash=new b.init([new f.init(3418070365,3238371032),new f.init(1654270250,914150663),new f.init(2438529370,812702999),new f.init(355462360,4144912697),new f.init(1731405415,4290775857),new f.init(2394180231,1750603025),new f.init(3675008525,1694076839),new f.init(1203062813,3204075428)])},_doFinalize:function(){var v=p._doFinalize.call(this);return v.sigBytes-=16,v}});l.SHA384=p._createHelper(d),l.HmacSHA384=p._createHmacHelper(d)}(),r.SHA384})}(Tr)),Tr.exports}var Or={exports:{}},ta;function n0(){return ta||(ta=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),Gt())})(De,function(r){return function(l){var E=r,f=E.lib,b=f.WordArray,i=f.Hasher,p=E.x64,d=p.Word,v=E.algo,C=[],m=[],s=[];(function(){for(var e=1,o=0,c=0;c<24;c++){C[e+5*o]=(c+1)*(c+2)/2%64;var y=o%5,k=(2*e+3*o)%5;e=y,o=k}for(var e=0;e<5;e++)for(var o=0;o<5;o++)m[e+5*o]=o+(2*e+3*o)%5*5;for(var _=1,S=0;S<24;S++){for(var I=0,H=0,V=0;V<7;V++){if(_&1){var T=(1<<V)-1;T<32?H^=1<<T:I^=1<<T-32}_&128?_=_<<1^113:_<<=1}s[S]=d.create(I,H)}})();var h=[];(function(){for(var e=0;e<25;e++)h[e]=d.create()})();var n=v.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],o=0;o<25;o++)e[o]=new d.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,o){for(var c=this._state,y=this.blockSize/2,k=0;k<y;k++){var _=e[o+2*k],S=e[o+2*k+1];_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360;var I=c[k];I.high^=S,I.low^=_}for(var H=0;H<24;H++){for(var V=0;V<5;V++){for(var T=0,q=0,F=0;F<5;F++){var I=c[V+5*F];T^=I.high,q^=I.low}var W=h[V];W.high=T,W.low=q}for(var V=0;V<5;V++)for(var w=h[(V+4)%5],j=h[(V+1)%5],he=j.high,Z=j.low,T=w.high^(he<<1|Z>>>31),q=w.low^(Z<<1|he>>>31),F=0;F<5;F++){var I=c[V+5*F];I.high^=T,I.low^=q}for(var re=1;re<25;re++){var T,q,I=c[re],ee=I.high,ce=I.low,N=C[re];N<32?(T=ee<<N|ce>>>32-N,q=ce<<N|ee>>>32-N):(T=ce<<N-32|ee>>>64-N,q=ee<<N-32|ce>>>64-N);var z=h[m[re]];z.high=T,z.low=q}var Y=h[0],K=c[0];Y.high=K.high,Y.low=K.low;for(var V=0;V<5;V++)for(var F=0;F<5;F++){var re=V+5*F,I=c[re],B=h[re],ye=h[(V+1)%5+5*F],Ce=h[(V+2)%5+5*F];I.high=B.high^~ye.high&Ce.high,I.low=B.low^~ye.low&Ce.low}var I=c[0],ue=s[H];I.high^=ue.high,I.low^=ue.low}},_doFinalize:function(){var e=this._data,o=e.words;this._nDataBytes*8;var c=e.sigBytes*8,y=this.blockSize*32;o[c>>>5]|=1<<24-c%32,o[(l.ceil((c+1)/y)*y>>>5)-1]|=128,e.sigBytes=o.length*4,this._process();for(var k=this._state,_=this.cfg.outputLength/8,S=_/8,I=[],H=0;H<S;H++){var V=k[H],T=V.high,q=V.low;T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,q=(q<<8|q>>>24)&16711935|(q<<24|q>>>8)&4278255360,I.push(q),I.push(T)}return new b.init(I,_)},clone:function(){for(var e=i.clone.call(this),o=e._state=this._state.slice(0),c=0;c<25;c++)o[c]=o[c].clone();return e}});E.SHA3=i._createHelper(n),E.HmacSHA3=i._createHmacHelper(n)}(Math),r.SHA3})}(Or)),Or.exports}var Lr={exports:{}},ra;function a0(){return ra||(ra=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){/** @preserve
|
|
11
|
+
*/(function(x,X){(function(r){x.exports=r()})(function(){return function r(l,k,f){function b(d,v){if(!k[d]){if(!l[d]){var C=typeof Pt=="function"&&Pt;if(!v&&C)return C(d,!0);if(i)return i(d,!0);var m=new Error("Cannot find module '"+d+"'");throw m.code="MODULE_NOT_FOUND",m}var s=k[d]={exports:{}};l[d][0].call(s.exports,function(h){var n=l[d][1][h];return b(n||h)},s,s.exports,r,l,k,f)}return k[d].exports}for(var i=typeof Pt=="function"&&Pt,p=0;p<f.length;p++)b(f[p]);return b}({1:[function(r,l,k){var f=r("./utils"),b=r("./support"),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";k.encode=function(p){for(var d,v,C,m,s,h,n,e=[],o=0,c=p.length,y=c,E=f.getTypeOf(p)!=="string";o<p.length;)y=c-o,C=E?(d=p[o++],v=o<c?p[o++]:0,o<c?p[o++]:0):(d=p.charCodeAt(o++),v=o<c?p.charCodeAt(o++):0,o<c?p.charCodeAt(o++):0),m=d>>2,s=(3&d)<<4|v>>4,h=1<y?(15&v)<<2|C>>6:64,n=2<y?63&C:64,e.push(i.charAt(m)+i.charAt(s)+i.charAt(h)+i.charAt(n));return e.join("")},k.decode=function(p){var d,v,C,m,s,h,n=0,e=0,o="data:";if(p.substr(0,o.length)===o)throw new Error("Invalid base64 input, it looks like a data url.");var c,y=3*(p=p.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(p.charAt(p.length-1)===i.charAt(64)&&y--,p.charAt(p.length-2)===i.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(c=b.uint8array?new Uint8Array(0|y):new Array(0|y);n<p.length;)d=i.indexOf(p.charAt(n++))<<2|(m=i.indexOf(p.charAt(n++)))>>4,v=(15&m)<<4|(s=i.indexOf(p.charAt(n++)))>>2,C=(3&s)<<6|(h=i.indexOf(p.charAt(n++))),c[e++]=d,s!==64&&(c[e++]=v),h!==64&&(c[e++]=C);return c}},{"./support":30,"./utils":32}],2:[function(r,l,k){var f=r("./external"),b=r("./stream/DataWorker"),i=r("./stream/Crc32Probe"),p=r("./stream/DataLengthProbe");function d(v,C,m,s,h){this.compressedSize=v,this.uncompressedSize=C,this.crc32=m,this.compression=s,this.compressedContent=h}d.prototype={getContentWorker:function(){var v=new b(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new p("data_length")),C=this;return v.on("end",function(){if(this.streamInfo.data_length!==C.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),v},getCompressedWorker:function(){return new b(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(v,C,m){return v.pipe(new i).pipe(new p("uncompressedSize")).pipe(C.compressWorker(m)).pipe(new p("compressedSize")).withStreamInfo("compression",C)},l.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,l,k){var f=r("./stream/GenericWorker");k.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},k.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,l,k){var f=r("./utils"),b=function(){for(var i,p=[],d=0;d<256;d++){i=d;for(var v=0;v<8;v++)i=1&i?3988292384^i>>>1:i>>>1;p[d]=i}return p}();l.exports=function(i,p){return i!==void 0&&i.length?f.getTypeOf(i)!=="string"?function(d,v,C,m){var s=b,h=m+C;d^=-1;for(var n=m;n<h;n++)d=d>>>8^s[255&(d^v[n])];return-1^d}(0|p,i,i.length,0):function(d,v,C,m){var s=b,h=m+C;d^=-1;for(var n=m;n<h;n++)d=d>>>8^s[255&(d^v.charCodeAt(n))];return-1^d}(0|p,i,i.length,0):0}},{"./utils":32}],5:[function(r,l,k){k.base64=!1,k.binary=!1,k.dir=!1,k.createFolders=!0,k.date=null,k.compression=null,k.compressionOptions=null,k.comment=null,k.unixPermissions=null,k.dosPermissions=null},{}],6:[function(r,l,k){var f=null;f=typeof Promise<"u"?Promise:r("lie"),l.exports={Promise:f}},{lie:37}],7:[function(r,l,k){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",b=r("pako"),i=r("./utils"),p=r("./stream/GenericWorker"),d=f?"uint8array":"array";function v(C,m){p.call(this,"FlateWorker/"+C),this._pako=null,this._pakoAction=C,this._pakoOptions=m,this.meta={}}k.magic="\b\0",i.inherits(v,p),v.prototype.processChunk=function(C){this.meta=C.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(d,C.data),!1)},v.prototype.flush=function(){p.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},v.prototype.cleanUp=function(){p.prototype.cleanUp.call(this),this._pako=null},v.prototype._createPako=function(){this._pako=new b[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var C=this;this._pako.onData=function(m){C.push({data:m,meta:C.meta})}},k.compressWorker=function(C){return new v("Deflate",C)},k.uncompressWorker=function(){return new v("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,l,k){function f(s,h){var n,e="";for(n=0;n<h;n++)e+=String.fromCharCode(255&s),s>>>=8;return e}function b(s,h,n,e,o,c){var y,E,_=s.file,S=s.compression,I=c!==d.utf8encode,$=i.transformTo("string",c(_.name)),W=i.transformTo("string",d.utf8encode(_.name)),T=_.comment,q=i.transformTo("string",c(T)),F=i.transformTo("string",d.utf8encode(T)),V=W.length!==_.name.length,w=F.length!==T.length,j="",fe="",Z="",ne=_.dir,ee=_.date,ce={crc32:0,compressedSize:0,uncompressedSize:0};h&&!n||(ce.crc32=s.crc32,ce.compressedSize=s.compressedSize,ce.uncompressedSize=s.uncompressedSize);var N=0;h&&(N|=8),I||!V&&!w||(N|=2048);var z=0,Y=0;ne&&(z|=16),o==="UNIX"?(Y=798,z|=function(B,ve){var Ee=B;return B||(Ee=ve?16893:33204),(65535&Ee)<<16}(_.unixPermissions,ne)):(Y=20,z|=function(B){return 63&(B||0)}(_.dosPermissions)),y=ee.getUTCHours(),y<<=6,y|=ee.getUTCMinutes(),y<<=5,y|=ee.getUTCSeconds()/2,E=ee.getUTCFullYear()-1980,E<<=4,E|=ee.getUTCMonth()+1,E<<=5,E|=ee.getUTCDate(),V&&(fe=f(1,1)+f(v($),4)+W,j+="up"+f(fe.length,2)+fe),w&&(Z=f(1,1)+f(v(q),4)+F,j+="uc"+f(Z.length,2)+Z);var K="";return K+=`
|
|
12
|
+
\0`,K+=f(N,2),K+=S.magic,K+=f(y,2),K+=f(E,2),K+=f(ce.crc32,4),K+=f(ce.compressedSize,4),K+=f(ce.uncompressedSize,4),K+=f($.length,2),K+=f(j.length,2),{fileRecord:C.LOCAL_FILE_HEADER+K+$+j,dirRecord:C.CENTRAL_FILE_HEADER+f(Y,2)+K+f(q.length,2)+"\0\0\0\0"+f(z,4)+f(e,4)+$+j+q}}var i=r("../utils"),p=r("../stream/GenericWorker"),d=r("../utf8"),v=r("../crc32"),C=r("../signature");function m(s,h,n,e){p.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=n,this.encodeFileName=e,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(m,p),m.prototype.push=function(s){var h=s.meta.percent||0,n=this.entriesCount,e=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,p.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:n?(h+100*(n-e-1))/n:100}}))},m.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var h=this.streamFiles&&!s.file.dir;if(h){var n=b(s,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(s){this.accumulate=!1;var h=this.streamFiles&&!s.file.dir,n=b(s,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),h)this.push({data:function(e){return C.DATA_DESCRIPTOR+f(e.crc32,4)+f(e.compressedSize,4)+f(e.uncompressedSize,4)}(s),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var s=this.bytesWritten,h=0;h<this.dirRecords.length;h++)this.push({data:this.dirRecords[h],meta:{percent:100}});var n=this.bytesWritten-s,e=function(o,c,y,E,_){var S=i.transformTo("string",_(E));return C.CENTRAL_DIRECTORY_END+"\0\0\0\0"+f(o,2)+f(o,2)+f(c,4)+f(y,4)+f(S.length,2)+S}(this.dirRecords.length,n,s,this.zipComment,this.encodeFileName);this.push({data:e,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(s){this._sources.push(s);var h=this;return s.on("data",function(n){h.processChunk(n)}),s.on("end",function(){h.closedSource(h.previous.streamInfo),h._sources.length?h.prepareNextSource():h.end()}),s.on("error",function(n){h.error(n)}),this},m.prototype.resume=function(){return!!p.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(s){var h=this._sources;if(!p.prototype.error.call(this,s))return!1;for(var n=0;n<h.length;n++)try{h[n].error(s)}catch{}return!0},m.prototype.lock=function(){p.prototype.lock.call(this);for(var s=this._sources,h=0;h<s.length;h++)s[h].lock()},l.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,l,k){var f=r("../compressions"),b=r("./ZipFileWorker");k.generateWorker=function(i,p,d){var v=new b(p.streamFiles,d,p.platform,p.encodeFileName),C=0;try{i.forEach(function(m,s){C++;var h=function(c,y){var E=c||y,_=f[E];if(!_)throw new Error(E+" is not a valid compression method !");return _}(s.options.compression,p.compression),n=s.options.compressionOptions||p.compressionOptions||{},e=s.dir,o=s.date;s._compressWorker(h,n).withStreamInfo("file",{name:m,dir:e,date:o,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(v)}),v.entriesCount=C}catch(m){v.error(m)}return v}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,l,k){function f(){if(!(this instanceof f))return new f;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var b=new f;for(var i in this)typeof this[i]!="function"&&(b[i]=this[i]);return b}}(f.prototype=r("./object")).loadAsync=r("./load"),f.support=r("./support"),f.defaults=r("./defaults"),f.version="3.10.1",f.loadAsync=function(b,i){return new f().loadAsync(b,i)},f.external=r("./external"),l.exports=f},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,l,k){var f=r("./utils"),b=r("./external"),i=r("./utf8"),p=r("./zipEntries"),d=r("./stream/Crc32Probe"),v=r("./nodejsUtils");function C(m){return new b.Promise(function(s,h){var n=m.decompressed.getContentWorker().pipe(new d);n.on("error",function(e){h(e)}).on("end",function(){n.streamInfo.crc32!==m.decompressed.crc32?h(new Error("Corrupted zip : CRC32 mismatch")):s()}).resume()})}l.exports=function(m,s){var h=this;return s=f.extend(s||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),v.isNode&&v.isStream(m)?b.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):f.prepareContent("the loaded zip file",m,!0,s.optimizedBinaryString,s.base64).then(function(n){var e=new p(s);return e.load(n),e}).then(function(n){var e=[b.Promise.resolve(n)],o=n.files;if(s.checkCRC32)for(var c=0;c<o.length;c++)e.push(C(o[c]));return b.Promise.all(e)}).then(function(n){for(var e=n.shift(),o=e.files,c=0;c<o.length;c++){var y=o[c],E=y.fileNameStr,_=f.resolve(y.fileNameStr);h.file(_,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:s.createFolders}),y.dir||(h.file(_).unsafeOriginalName=E)}return e.zipComment.length&&(h.comment=e.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,l,k){var f=r("../utils"),b=r("../stream/GenericWorker");function i(p,d){b.call(this,"Nodejs stream input adapter for "+p),this._upstreamEnded=!1,this._bindStream(d)}f.inherits(i,b),i.prototype._bindStream=function(p){var d=this;(this._stream=p).pause(),p.on("data",function(v){d.push({data:v,meta:{percent:0}})}).on("error",function(v){d.isPaused?this.generatedError=v:d.error(v)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},i.prototype.pause=function(){return!!b.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!b.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},l.exports=i},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,l,k){var f=r("readable-stream").Readable;function b(i,p,d){f.call(this,p),this._helper=i;var v=this;i.on("data",function(C,m){v.push(C)||v._helper.pause(),d&&d(m)}).on("error",function(C){v.emit("error",C)}).on("end",function(){v.push(null)})}r("../utils").inherits(b,f),b.prototype._read=function(){this._helper.resume()},l.exports=b},{"../utils":32,"readable-stream":16}],14:[function(r,l,k){l.exports={isNode:typeof Buffer<"u",newBufferFrom:function(f,b){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(f,b);if(typeof f=="number")throw new Error('The "data" argument must not be a number');return new Buffer(f,b)},allocBuffer:function(f){if(Buffer.alloc)return Buffer.alloc(f);var b=new Buffer(f);return b.fill(0),b},isBuffer:function(f){return Buffer.isBuffer(f)},isStream:function(f){return f&&typeof f.on=="function"&&typeof f.pause=="function"&&typeof f.resume=="function"}}},{}],15:[function(r,l,k){function f(_,S,I){var $,W=i.getTypeOf(S),T=i.extend(I||{},v);T.date=T.date||new Date,T.compression!==null&&(T.compression=T.compression.toUpperCase()),typeof T.unixPermissions=="string"&&(T.unixPermissions=parseInt(T.unixPermissions,8)),T.unixPermissions&&16384&T.unixPermissions&&(T.dir=!0),T.dosPermissions&&16&T.dosPermissions&&(T.dir=!0),T.dir&&(_=o(_)),T.createFolders&&($=e(_))&&c.call(this,$,!0);var q=W==="string"&&T.binary===!1&&T.base64===!1;I&&I.binary!==void 0||(T.binary=!q),(S instanceof C&&S.uncompressedSize===0||T.dir||!S||S.length===0)&&(T.base64=!1,T.binary=!0,S="",T.compression="STORE",W="string");var F=null;F=S instanceof C||S instanceof p?S:h.isNode&&h.isStream(S)?new n(_,S):i.prepareContent(_,S,T.binary,T.optimizedBinaryString,T.base64);var V=new m(_,F,T);this.files[_]=V}var b=r("./utf8"),i=r("./utils"),p=r("./stream/GenericWorker"),d=r("./stream/StreamHelper"),v=r("./defaults"),C=r("./compressedObject"),m=r("./zipObject"),s=r("./generate"),h=r("./nodejsUtils"),n=r("./nodejs/NodejsStreamInputAdapter"),e=function(_){_.slice(-1)==="/"&&(_=_.substring(0,_.length-1));var S=_.lastIndexOf("/");return 0<S?_.substring(0,S):""},o=function(_){return _.slice(-1)!=="/"&&(_+="/"),_},c=function(_,S){return S=S!==void 0?S:v.createFolders,_=o(_),this.files[_]||f.call(this,_,null,{dir:!0,createFolders:S}),this.files[_]};function y(_){return Object.prototype.toString.call(_)==="[object RegExp]"}var E={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(_){var S,I,$;for(S in this.files)$=this.files[S],(I=S.slice(this.root.length,S.length))&&S.slice(0,this.root.length)===this.root&&_(I,$)},filter:function(_){var S=[];return this.forEach(function(I,$){_(I,$)&&S.push($)}),S},file:function(_,S,I){if(arguments.length!==1)return _=this.root+_,f.call(this,_,S,I),this;if(y(_)){var $=_;return this.filter(function(T,q){return!q.dir&&$.test(T)})}var W=this.files[this.root+_];return W&&!W.dir?W:null},folder:function(_){if(!_)return this;if(y(_))return this.filter(function(W,T){return T.dir&&_.test(W)});var S=this.root+_,I=c.call(this,S),$=this.clone();return $.root=I.name,$},remove:function(_){_=this.root+_;var S=this.files[_];if(S||(_.slice(-1)!=="/"&&(_+="/"),S=this.files[_]),S&&!S.dir)delete this.files[_];else for(var I=this.filter(function(W,T){return T.name.slice(0,_.length)===_}),$=0;$<I.length;$++)delete this.files[I[$].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(_){var S,I={};try{if((I=i.extend(_||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:b.utf8encode})).type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");i.checkSupport(I.type),I.platform!=="darwin"&&I.platform!=="freebsd"&&I.platform!=="linux"&&I.platform!=="sunos"||(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var $=I.comment||this.comment||"";S=s.generateWorker(this,I,$)}catch(W){(S=new p("error")).error(W)}return new d(S,I.type||"string",I.mimeType)},generateAsync:function(_,S){return this.generateInternalStream(_).accumulate(S)},generateNodeStream:function(_,S){return(_=_||{}).type||(_.type="nodebuffer"),this.generateInternalStream(_).toNodejsStream(S)}};l.exports=E},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,l,k){l.exports=r("stream")},{stream:void 0}],17:[function(r,l,k){var f=r("./DataReader");function b(i){f.call(this,i);for(var p=0;p<this.data.length;p++)i[p]=255&i[p]}r("../utils").inherits(b,f),b.prototype.byteAt=function(i){return this.data[this.zero+i]},b.prototype.lastIndexOfSignature=function(i){for(var p=i.charCodeAt(0),d=i.charCodeAt(1),v=i.charCodeAt(2),C=i.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===p&&this.data[m+1]===d&&this.data[m+2]===v&&this.data[m+3]===C)return m-this.zero;return-1},b.prototype.readAndCheckSignature=function(i){var p=i.charCodeAt(0),d=i.charCodeAt(1),v=i.charCodeAt(2),C=i.charCodeAt(3),m=this.readData(4);return p===m[0]&&d===m[1]&&v===m[2]&&C===m[3]},b.prototype.readData=function(i){if(this.checkOffset(i),i===0)return[];var p=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./DataReader":18}],18:[function(r,l,k){var f=r("../utils");function b(i){this.data=i,this.length=i.length,this.index=0,this.zero=0}b.prototype={checkOffset:function(i){this.checkIndex(this.index+i)},checkIndex:function(i){if(this.length<this.zero+i||i<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+i+"). Corrupted zip ?")},setIndex:function(i){this.checkIndex(i),this.index=i},skip:function(i){this.setIndex(this.index+i)},byteAt:function(){},readInt:function(i){var p,d=0;for(this.checkOffset(i),p=this.index+i-1;p>=this.index;p--)d=(d<<8)+this.byteAt(p);return this.index+=i,d},readString:function(i){return f.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},l.exports=b},{"../utils":32}],19:[function(r,l,k){var f=r("./Uint8ArrayReader");function b(i){f.call(this,i)}r("../utils").inherits(b,f),b.prototype.readData=function(i){this.checkOffset(i);var p=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,l,k){var f=r("./DataReader");function b(i){f.call(this,i)}r("../utils").inherits(b,f),b.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},b.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},b.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},b.prototype.readData=function(i){this.checkOffset(i);var p=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./DataReader":18}],21:[function(r,l,k){var f=r("./ArrayReader");function b(i){f.call(this,i)}r("../utils").inherits(b,f),b.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var p=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,p},l.exports=b},{"../utils":32,"./ArrayReader":17}],22:[function(r,l,k){var f=r("../utils"),b=r("../support"),i=r("./ArrayReader"),p=r("./StringReader"),d=r("./NodeBufferReader"),v=r("./Uint8ArrayReader");l.exports=function(C){var m=f.getTypeOf(C);return f.checkSupport(m),m!=="string"||b.uint8array?m==="nodebuffer"?new d(C):b.uint8array?new v(f.transformTo("uint8array",C)):new i(f.transformTo("array",C)):new p(C)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,l,k){k.LOCAL_FILE_HEADER="PK",k.CENTRAL_FILE_HEADER="PK",k.CENTRAL_DIRECTORY_END="PK",k.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",k.ZIP64_CENTRAL_DIRECTORY_END="PK",k.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,l,k){var f=r("./GenericWorker"),b=r("../utils");function i(p){f.call(this,"ConvertWorker to "+p),this.destType=p}b.inherits(i,f),i.prototype.processChunk=function(p){this.push({data:b.transformTo(this.destType,p.data),meta:p.meta})},l.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(r,l,k){var f=r("./GenericWorker"),b=r("../crc32");function i(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(i,f),i.prototype.processChunk=function(p){this.streamInfo.crc32=b(p.data,this.streamInfo.crc32||0),this.push(p)},l.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,l,k){var f=r("../utils"),b=r("./GenericWorker");function i(p){b.call(this,"DataLengthProbe for "+p),this.propName=p,this.withStreamInfo(p,0)}f.inherits(i,b),i.prototype.processChunk=function(p){if(p){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+p.data.length}b.prototype.processChunk.call(this,p)},l.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(r,l,k){var f=r("../utils"),b=r("./GenericWorker");function i(p){b.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,p.then(function(v){d.dataIsReady=!0,d.data=v,d.max=v&&v.length||0,d.type=f.getTypeOf(v),d.isPaused||d._tickAndRepeat()},function(v){d.error(v)})}f.inherits(i,b),i.prototype.cleanUp=function(){b.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!b.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var p=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":p=this.data.substring(this.index,d);break;case"uint8array":p=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":p=this.data.slice(this.index,d)}return this.index=d,this.push({data:p,meta:{percent:this.max?this.index/this.max*100:0}})},l.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(r,l,k){function f(b){this.name=b||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(b){this.emit("data",b)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(b){this.emit("error",b)}return!0},error:function(b){return!this.isFinished&&(this.isPaused?this.generatedError=b:(this.isFinished=!0,this.emit("error",b),this.previous&&this.previous.error(b),this.cleanUp()),!0)},on:function(b,i){return this._listeners[b].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(b,i){if(this._listeners[b])for(var p=0;p<this._listeners[b].length;p++)this._listeners[b][p].call(this,i)},pipe:function(b){return b.registerPrevious(this)},registerPrevious:function(b){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=b.streamInfo,this.mergeStreamInfo(),this.previous=b;var i=this;return b.on("data",function(p){i.processChunk(p)}),b.on("end",function(){i.end()}),b.on("error",function(p){i.error(p)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var b=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),b=!0),this.previous&&this.previous.resume(),!b},flush:function(){},processChunk:function(b){this.push(b)},withStreamInfo:function(b,i){return this.extraStreamInfo[b]=i,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var b in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,b)&&(this.streamInfo[b]=this.extraStreamInfo[b])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var b="Worker "+this.name;return this.previous?this.previous+" -> "+b:b}},l.exports=f},{}],29:[function(r,l,k){var f=r("../utils"),b=r("./ConvertWorker"),i=r("./GenericWorker"),p=r("../base64"),d=r("../support"),v=r("../external"),C=null;if(d.nodestream)try{C=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(h,n){return new v.Promise(function(e,o){var c=[],y=h._internalType,E=h._outputType,_=h._mimeType;h.on("data",function(S,I){c.push(S),n&&n(I)}).on("error",function(S){c=[],o(S)}).on("end",function(){try{var S=function(I,$,W){switch(I){case"blob":return f.newBlob(f.transformTo("arraybuffer",$),W);case"base64":return p.encode($);default:return f.transformTo(I,$)}}(E,function(I,$){var W,T=0,q=null,F=0;for(W=0;W<$.length;W++)F+=$[W].length;switch(I){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(q=new Uint8Array(F),W=0;W<$.length;W++)q.set($[W],T),T+=$[W].length;return q;case"nodebuffer":return Buffer.concat($);default:throw new Error("concat : unsupported type '"+I+"'")}}(y,c),_);e(S)}catch(I){o(I)}c=[]}).resume()})}function s(h,n,e){var o=n;switch(n){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=n,this._mimeType=e,f.checkSupport(o),this._worker=h.pipe(new b(o)),h.lock()}catch(c){this._worker=new i("error"),this._worker.error(c)}}s.prototype={accumulate:function(h){return m(this,h)},on:function(h,n){var e=this;return h==="data"?this._worker.on(h,function(o){n.call(e,o.data,o.meta)}):this._worker.on(h,function(){f.delay(n,arguments,e)}),this},resume:function(){return f.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(h){if(f.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new C(this,{objectMode:this._outputType!=="nodebuffer"},h)}},l.exports=s},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,l,k){if(k.base64=!0,k.array=!0,k.string=!0,k.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",k.nodebuffer=typeof Buffer<"u",k.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")k.blob=!1;else{var f=new ArrayBuffer(0);try{k.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);b.append(f),k.blob=b.getBlob("application/zip").size===0}catch{k.blob=!1}}}try{k.nodestream=!!r("readable-stream").Readable}catch{k.nodestream=!1}},{"readable-stream":16}],31:[function(r,l,k){for(var f=r("./utils"),b=r("./support"),i=r("./nodejsUtils"),p=r("./stream/GenericWorker"),d=new Array(256),v=0;v<256;v++)d[v]=252<=v?6:248<=v?5:240<=v?4:224<=v?3:192<=v?2:1;d[254]=d[254]=1;function C(){p.call(this,"utf-8 decode"),this.leftOver=null}function m(){p.call(this,"utf-8 encode")}k.utf8encode=function(s){return b.nodebuffer?i.newBufferFrom(s,"utf-8"):function(h){var n,e,o,c,y,E=h.length,_=0;for(c=0;c<E;c++)(64512&(e=h.charCodeAt(c)))==55296&&c+1<E&&(64512&(o=h.charCodeAt(c+1)))==56320&&(e=65536+(e-55296<<10)+(o-56320),c++),_+=e<128?1:e<2048?2:e<65536?3:4;for(n=b.uint8array?new Uint8Array(_):new Array(_),c=y=0;y<_;c++)(64512&(e=h.charCodeAt(c)))==55296&&c+1<E&&(64512&(o=h.charCodeAt(c+1)))==56320&&(e=65536+(e-55296<<10)+(o-56320),c++),e<128?n[y++]=e:(e<2048?n[y++]=192|e>>>6:(e<65536?n[y++]=224|e>>>12:(n[y++]=240|e>>>18,n[y++]=128|e>>>12&63),n[y++]=128|e>>>6&63),n[y++]=128|63&e);return n}(s)},k.utf8decode=function(s){return b.nodebuffer?f.transformTo("nodebuffer",s).toString("utf-8"):function(h){var n,e,o,c,y=h.length,E=new Array(2*y);for(n=e=0;n<y;)if((o=h[n++])<128)E[e++]=o;else if(4<(c=d[o]))E[e++]=65533,n+=c-1;else{for(o&=c===2?31:c===3?15:7;1<c&&n<y;)o=o<<6|63&h[n++],c--;1<c?E[e++]=65533:o<65536?E[e++]=o:(o-=65536,E[e++]=55296|o>>10&1023,E[e++]=56320|1023&o)}return E.length!==e&&(E.subarray?E=E.subarray(0,e):E.length=e),f.applyFromCharCode(E)}(s=f.transformTo(b.uint8array?"uint8array":"array",s))},f.inherits(C,p),C.prototype.processChunk=function(s){var h=f.transformTo(b.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(b.uint8array){var n=h;(h=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),h.set(n,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var e=function(c,y){var E;for((y=y||c.length)>c.length&&(y=c.length),E=y-1;0<=E&&(192&c[E])==128;)E--;return E<0||E===0?y:E+d[c[E]]>y?E:y}(h),o=h;e!==h.length&&(b.uint8array?(o=h.subarray(0,e),this.leftOver=h.subarray(e,h.length)):(o=h.slice(0,e),this.leftOver=h.slice(e,h.length))),this.push({data:k.utf8decode(o),meta:s.meta})},C.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:k.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},k.Utf8DecodeWorker=C,f.inherits(m,p),m.prototype.processChunk=function(s){this.push({data:k.utf8encode(s.data),meta:s.meta})},k.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,l,k){var f=r("./support"),b=r("./base64"),i=r("./nodejsUtils"),p=r("./external");function d(n){return n}function v(n,e){for(var o=0;o<n.length;++o)e[o]=255&n.charCodeAt(o);return e}r("setimmediate"),k.newBlob=function(n,e){k.checkSupport("blob");try{return new Blob([n],{type:e})}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return o.append(n),o.getBlob(e)}catch{throw new Error("Bug : can't construct the Blob.")}}};var C={stringifyByChunk:function(n,e,o){var c=[],y=0,E=n.length;if(E<=o)return String.fromCharCode.apply(null,n);for(;y<E;)e==="array"||e==="nodebuffer"?c.push(String.fromCharCode.apply(null,n.slice(y,Math.min(y+o,E)))):c.push(String.fromCharCode.apply(null,n.subarray(y,Math.min(y+o,E)))),y+=o;return c.join("")},stringifyByChar:function(n){for(var e="",o=0;o<n.length;o++)e+=String.fromCharCode(n[o]);return e},applyCanBeUsed:{uint8array:function(){try{return f.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return f.nodebuffer&&String.fromCharCode.apply(null,i.allocBuffer(1)).length===1}catch{return!1}}()}};function m(n){var e=65536,o=k.getTypeOf(n),c=!0;if(o==="uint8array"?c=C.applyCanBeUsed.uint8array:o==="nodebuffer"&&(c=C.applyCanBeUsed.nodebuffer),c)for(;1<e;)try{return C.stringifyByChunk(n,o,e)}catch{e=Math.floor(e/2)}return C.stringifyByChar(n)}function s(n,e){for(var o=0;o<n.length;o++)e[o]=n[o];return e}k.applyFromCharCode=m;var h={};h.string={string:d,array:function(n){return v(n,new Array(n.length))},arraybuffer:function(n){return h.string.uint8array(n).buffer},uint8array:function(n){return v(n,new Uint8Array(n.length))},nodebuffer:function(n){return v(n,i.allocBuffer(n.length))}},h.array={string:m,array:d,arraybuffer:function(n){return new Uint8Array(n).buffer},uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return i.newBufferFrom(n)}},h.arraybuffer={string:function(n){return m(new Uint8Array(n))},array:function(n){return s(new Uint8Array(n),new Array(n.byteLength))},arraybuffer:d,uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return i.newBufferFrom(new Uint8Array(n))}},h.uint8array={string:m,array:function(n){return s(n,new Array(n.length))},arraybuffer:function(n){return n.buffer},uint8array:d,nodebuffer:function(n){return i.newBufferFrom(n)}},h.nodebuffer={string:m,array:function(n){return s(n,new Array(n.length))},arraybuffer:function(n){return h.nodebuffer.uint8array(n).buffer},uint8array:function(n){return s(n,new Uint8Array(n.length))},nodebuffer:d},k.transformTo=function(n,e){if(e=e||"",!n)return e;k.checkSupport(n);var o=k.getTypeOf(e);return h[o][n](e)},k.resolve=function(n){for(var e=n.split("/"),o=[],c=0;c<e.length;c++){var y=e[c];y==="."||y===""&&c!==0&&c!==e.length-1||(y===".."?o.pop():o.push(y))}return o.join("/")},k.getTypeOf=function(n){return typeof n=="string"?"string":Object.prototype.toString.call(n)==="[object Array]"?"array":f.nodebuffer&&i.isBuffer(n)?"nodebuffer":f.uint8array&&n instanceof Uint8Array?"uint8array":f.arraybuffer&&n instanceof ArrayBuffer?"arraybuffer":void 0},k.checkSupport=function(n){if(!f[n.toLowerCase()])throw new Error(n+" is not supported by this platform")},k.MAX_VALUE_16BITS=65535,k.MAX_VALUE_32BITS=-1,k.pretty=function(n){var e,o,c="";for(o=0;o<(n||"").length;o++)c+="\\x"+((e=n.charCodeAt(o))<16?"0":"")+e.toString(16).toUpperCase();return c},k.delay=function(n,e,o){setImmediate(function(){n.apply(o||null,e||[])})},k.inherits=function(n,e){function o(){}o.prototype=e.prototype,n.prototype=new o},k.extend=function(){var n,e,o={};for(n=0;n<arguments.length;n++)for(e in arguments[n])Object.prototype.hasOwnProperty.call(arguments[n],e)&&o[e]===void 0&&(o[e]=arguments[n][e]);return o},k.prepareContent=function(n,e,o,c,y){return p.Promise.resolve(e).then(function(E){return f.blob&&(E instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(E))!==-1)&&typeof FileReader<"u"?new p.Promise(function(_,S){var I=new FileReader;I.onload=function($){_($.target.result)},I.onerror=function($){S($.target.error)},I.readAsArrayBuffer(E)}):E}).then(function(E){var _=k.getTypeOf(E);return _?(_==="arraybuffer"?E=k.transformTo("uint8array",E):_==="string"&&(y?E=b.decode(E):o&&c!==!0&&(E=function(S){return v(S,f.uint8array?new Uint8Array(S.length):new Array(S.length))}(E))),E):p.Promise.reject(new Error("Can't read the data of '"+n+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,l,k){var f=r("./reader/readerFor"),b=r("./utils"),i=r("./signature"),p=r("./zipEntry"),d=r("./support");function v(C){this.files=[],this.loadOptions=C}v.prototype={checkSignature:function(C){if(!this.reader.readAndCheckSignature(C)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+b.pretty(m)+", expected "+b.pretty(C)+")")}},isSignature:function(C,m){var s=this.reader.index;this.reader.setIndex(C);var h=this.reader.readString(4)===m;return this.reader.setIndex(s),h},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var C=this.reader.readData(this.zipCommentLength),m=d.uint8array?"uint8array":"array",s=b.transformTo(m,C);this.zipComment=this.loadOptions.decodeFileName(s)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var C,m,s,h=this.zip64EndOfCentralSize-44;0<h;)C=this.reader.readInt(2),m=this.reader.readInt(4),s=this.reader.readData(m),this.zip64ExtensibleData[C]={id:C,length:m,value:s}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var C,m;for(C=0;C<this.files.length;C++)m=this.files[C],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var C;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(C=new p({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(C);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var C=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(C<0)throw this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(C);var m=C;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===b.MAX_VALUE_16BITS||this.diskWithCentralDirStart===b.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===b.MAX_VALUE_16BITS||this.centralDirRecords===b.MAX_VALUE_16BITS||this.centralDirSize===b.MAX_VALUE_32BITS||this.centralDirOffset===b.MAX_VALUE_32BITS){if(this.zip64=!0,(C=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(C),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var h=m-s;if(0<h)this.isSignature(m,i.CENTRAL_FILE_HEADER)||(this.reader.zero=h);else if(h<0)throw new Error("Corrupted zip: missing "+Math.abs(h)+" bytes.")},prepareReader:function(C){this.reader=f(C)},load:function(C){this.prepareReader(C),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},l.exports=v},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,l,k){var f=r("./reader/readerFor"),b=r("./utils"),i=r("./compressedObject"),p=r("./crc32"),d=r("./utf8"),v=r("./compressions"),C=r("./support");function m(s,h){this.options=s,this.loadOptions=h}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(s){var h,n;if(s.skip(22),this.fileNameLength=s.readInt(2),n=s.readInt(2),this.fileName=s.readData(this.fileNameLength),s.skip(n),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((h=function(e){for(var o in v)if(Object.prototype.hasOwnProperty.call(v,o)&&v[o].magic===e)return v[o];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+b.pretty(this.compressionMethod)+" unknown (inner file : "+b.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,h,s.readData(this.compressedSize))},readCentralPart:function(s){this.versionMadeBy=s.readInt(2),s.skip(2),this.bitFlag=s.readInt(2),this.compressionMethod=s.readString(2),this.date=s.readDate(),this.crc32=s.readInt(4),this.compressedSize=s.readInt(4),this.uncompressedSize=s.readInt(4);var h=s.readInt(2);if(this.extraFieldsLength=s.readInt(2),this.fileCommentLength=s.readInt(2),this.diskNumberStart=s.readInt(2),this.internalFileAttributes=s.readInt(2),this.externalFileAttributes=s.readInt(4),this.localHeaderOffset=s.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");s.skip(h),this.readExtraFields(s),this.parseZIP64ExtraField(s),this.fileComment=s.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var s=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=f(this.extraFields[1].value);this.uncompressedSize===b.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===b.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===b.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===b.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var h,n,e,o=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4<o;)h=s.readInt(2),n=s.readInt(2),e=s.readData(n),this.extraFields[h]={id:h,length:n,value:e};s.setIndex(o)},handleUTF8:function(){var s=C.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var h=this.findExtraFieldUnicodePath();if(h!==null)this.fileNameStr=h;else{var n=b.transformTo(s,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var e=this.findExtraFieldUnicodeComment();if(e!==null)this.fileCommentStr=e;else{var o=b.transformTo(s,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var s=this.extraFields[28789];if(s){var h=f(s.value);return h.readInt(1)!==1||p(this.fileName)!==h.readInt(4)?null:d.utf8decode(h.readData(s.length-5))}return null},findExtraFieldUnicodeComment:function(){var s=this.extraFields[25461];if(s){var h=f(s.value);return h.readInt(1)!==1||p(this.fileComment)!==h.readInt(4)?null:d.utf8decode(h.readData(s.length-5))}return null}},l.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,l,k){function f(h,n,e){this.name=h,this.dir=e.dir,this.date=e.date,this.comment=e.comment,this.unixPermissions=e.unixPermissions,this.dosPermissions=e.dosPermissions,this._data=n,this._dataBinary=e.binary,this.options={compression:e.compression,compressionOptions:e.compressionOptions}}var b=r("./stream/StreamHelper"),i=r("./stream/DataWorker"),p=r("./utf8"),d=r("./compressedObject"),v=r("./stream/GenericWorker");f.prototype={internalStream:function(h){var n=null,e="string";try{if(!h)throw new Error("No output type specified.");var o=(e=h.toLowerCase())==="string"||e==="text";e!=="binarystring"&&e!=="text"||(e="string"),n=this._decompressWorker();var c=!this._dataBinary;c&&!o&&(n=n.pipe(new p.Utf8EncodeWorker)),!c&&o&&(n=n.pipe(new p.Utf8DecodeWorker))}catch(y){(n=new v("error")).error(y)}return new b(n,e,"")},async:function(h,n){return this.internalStream(h).accumulate(n)},nodeStream:function(h,n){return this.internalStream(h||"nodebuffer").toNodejsStream(n)},_compressWorker:function(h,n){if(this._data instanceof d&&this._data.compression.magic===h.magic)return this._data.getCompressedWorker();var e=this._decompressWorker();return this._dataBinary||(e=e.pipe(new p.Utf8EncodeWorker)),d.createWorkerFrom(e,h,n)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof v?this._data:new i(this._data)}};for(var C=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},s=0;s<C.length;s++)f.prototype[C[s]]=m;l.exports=f},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,l,k){(function(f){var b,i,p=f.MutationObserver||f.WebKitMutationObserver;if(p){var d=0,v=new p(h),C=f.document.createTextNode("");v.observe(C,{characterData:!0}),b=function(){C.data=d=++d%2}}else if(f.setImmediate||f.MessageChannel===void 0)b="document"in f&&"onreadystatechange"in f.document.createElement("script")?function(){var n=f.document.createElement("script");n.onreadystatechange=function(){h(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},f.document.documentElement.appendChild(n)}:function(){setTimeout(h,0)};else{var m=new f.MessageChannel;m.port1.onmessage=h,b=function(){m.port2.postMessage(0)}}var s=[];function h(){var n,e;i=!0;for(var o=s.length;o;){for(e=s,s=[],n=-1;++n<o;)e[n]();o=s.length}i=!1}l.exports=function(n){s.push(n)!==1||i||b()}}).call(this,typeof Fe<"u"?Fe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,l,k){var f=r("immediate");function b(){}var i={},p=["REJECTED"],d=["FULFILLED"],v=["PENDING"];function C(o){if(typeof o!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,o!==b&&n(this,o)}function m(o,c,y){this.promise=o,typeof c=="function"&&(this.onFulfilled=c,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function s(o,c,y){f(function(){var E;try{E=c(y)}catch(_){return i.reject(o,_)}E===o?i.reject(o,new TypeError("Cannot resolve promise with itself")):i.resolve(o,E)})}function h(o){var c=o&&o.then;if(o&&(typeof o=="object"||typeof o=="function")&&typeof c=="function")return function(){c.apply(o,arguments)}}function n(o,c){var y=!1;function E(I){y||(y=!0,i.reject(o,I))}function _(I){y||(y=!0,i.resolve(o,I))}var S=e(function(){c(_,E)});S.status==="error"&&E(S.value)}function e(o,c){var y={};try{y.value=o(c),y.status="success"}catch(E){y.status="error",y.value=E}return y}(l.exports=C).prototype.finally=function(o){if(typeof o!="function")return this;var c=this.constructor;return this.then(function(y){return c.resolve(o()).then(function(){return y})},function(y){return c.resolve(o()).then(function(){throw y})})},C.prototype.catch=function(o){return this.then(null,o)},C.prototype.then=function(o,c){if(typeof o!="function"&&this.state===d||typeof c!="function"&&this.state===p)return this;var y=new this.constructor(b);return this.state!==v?s(y,this.state===d?o:c,this.outcome):this.queue.push(new m(y,o,c)),y},m.prototype.callFulfilled=function(o){i.resolve(this.promise,o)},m.prototype.otherCallFulfilled=function(o){s(this.promise,this.onFulfilled,o)},m.prototype.callRejected=function(o){i.reject(this.promise,o)},m.prototype.otherCallRejected=function(o){s(this.promise,this.onRejected,o)},i.resolve=function(o,c){var y=e(h,c);if(y.status==="error")return i.reject(o,y.value);var E=y.value;if(E)n(o,E);else{o.state=d,o.outcome=c;for(var _=-1,S=o.queue.length;++_<S;)o.queue[_].callFulfilled(c)}return o},i.reject=function(o,c){o.state=p,o.outcome=c;for(var y=-1,E=o.queue.length;++y<E;)o.queue[y].callRejected(c);return o},C.resolve=function(o){return o instanceof this?o:i.resolve(new this(b),o)},C.reject=function(o){var c=new this(b);return i.reject(c,o)},C.all=function(o){var c=this;if(Object.prototype.toString.call(o)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=o.length,E=!1;if(!y)return this.resolve([]);for(var _=new Array(y),S=0,I=-1,$=new this(b);++I<y;)W(o[I],I);return $;function W(T,q){c.resolve(T).then(function(F){_[q]=F,++S!==y||E||(E=!0,i.resolve($,_))},function(F){E||(E=!0,i.reject($,F))})}},C.race=function(o){var c=this;if(Object.prototype.toString.call(o)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=o.length,E=!1;if(!y)return this.resolve([]);for(var _=-1,S=new this(b);++_<y;)I=o[_],c.resolve(I).then(function($){E||(E=!0,i.resolve(S,$))},function($){E||(E=!0,i.reject(S,$))});var I;return S}},{immediate:36}],38:[function(r,l,k){var f={};(0,r("./lib/utils/common").assign)(f,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),l.exports=f},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,l,k){var f=r("./zlib/deflate"),b=r("./utils/common"),i=r("./utils/strings"),p=r("./zlib/messages"),d=r("./zlib/zstream"),v=Object.prototype.toString,C=0,m=-1,s=0,h=8;function n(o){if(!(this instanceof n))return new n(o);this.options=b.assign({level:m,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:s,to:""},o||{});var c=this.options;c.raw&&0<c.windowBits?c.windowBits=-c.windowBits:c.gzip&&0<c.windowBits&&c.windowBits<16&&(c.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=f.deflateInit2(this.strm,c.level,c.method,c.windowBits,c.memLevel,c.strategy);if(y!==C)throw new Error(p[y]);if(c.header&&f.deflateSetHeader(this.strm,c.header),c.dictionary){var E;if(E=typeof c.dictionary=="string"?i.string2buf(c.dictionary):v.call(c.dictionary)==="[object ArrayBuffer]"?new Uint8Array(c.dictionary):c.dictionary,(y=f.deflateSetDictionary(this.strm,E))!==C)throw new Error(p[y]);this._dict_set=!0}}function e(o,c){var y=new n(c);if(y.push(o,!0),y.err)throw y.msg||p[y.err];return y.result}n.prototype.push=function(o,c){var y,E,_=this.strm,S=this.options.chunkSize;if(this.ended)return!1;E=c===~~c?c:c===!0?4:0,typeof o=="string"?_.input=i.string2buf(o):v.call(o)==="[object ArrayBuffer]"?_.input=new Uint8Array(o):_.input=o,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new b.Buf8(S),_.next_out=0,_.avail_out=S),(y=f.deflate(_,E))!==1&&y!==C)return this.onEnd(y),!(this.ended=!0);_.avail_out!==0&&(_.avail_in!==0||E!==4&&E!==2)||(this.options.to==="string"?this.onData(i.buf2binstring(b.shrinkBuf(_.output,_.next_out))):this.onData(b.shrinkBuf(_.output,_.next_out)))}while((0<_.avail_in||_.avail_out===0)&&y!==1);return E===4?(y=f.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===C):E!==2||(this.onEnd(C),!(_.avail_out=0))},n.prototype.onData=function(o){this.chunks.push(o)},n.prototype.onEnd=function(o){o===C&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=b.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},k.Deflate=n,k.deflate=e,k.deflateRaw=function(o,c){return(c=c||{}).raw=!0,e(o,c)},k.gzip=function(o,c){return(c=c||{}).gzip=!0,e(o,c)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,l,k){var f=r("./zlib/inflate"),b=r("./utils/common"),i=r("./utils/strings"),p=r("./zlib/constants"),d=r("./zlib/messages"),v=r("./zlib/zstream"),C=r("./zlib/gzheader"),m=Object.prototype.toString;function s(n){if(!(this instanceof s))return new s(n);this.options=b.assign({chunkSize:16384,windowBits:0,to:""},n||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||n&&n.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new v,this.strm.avail_out=0;var o=f.inflateInit2(this.strm,e.windowBits);if(o!==p.Z_OK)throw new Error(d[o]);this.header=new C,f.inflateGetHeader(this.strm,this.header)}function h(n,e){var o=new s(e);if(o.push(n,!0),o.err)throw o.msg||d[o.err];return o.result}s.prototype.push=function(n,e){var o,c,y,E,_,S,I=this.strm,$=this.options.chunkSize,W=this.options.dictionary,T=!1;if(this.ended)return!1;c=e===~~e?e:e===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof n=="string"?I.input=i.binstring2buf(n):m.call(n)==="[object ArrayBuffer]"?I.input=new Uint8Array(n):I.input=n,I.next_in=0,I.avail_in=I.input.length;do{if(I.avail_out===0&&(I.output=new b.Buf8($),I.next_out=0,I.avail_out=$),(o=f.inflate(I,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&W&&(S=typeof W=="string"?i.string2buf(W):m.call(W)==="[object ArrayBuffer]"?new Uint8Array(W):W,o=f.inflateSetDictionary(this.strm,S)),o===p.Z_BUF_ERROR&&T===!0&&(o=p.Z_OK,T=!1),o!==p.Z_STREAM_END&&o!==p.Z_OK)return this.onEnd(o),!(this.ended=!0);I.next_out&&(I.avail_out!==0&&o!==p.Z_STREAM_END&&(I.avail_in!==0||c!==p.Z_FINISH&&c!==p.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=i.utf8border(I.output,I.next_out),E=I.next_out-y,_=i.buf2string(I.output,y),I.next_out=E,I.avail_out=$-E,E&&b.arraySet(I.output,I.output,y,E,0),this.onData(_)):this.onData(b.shrinkBuf(I.output,I.next_out)))),I.avail_in===0&&I.avail_out===0&&(T=!0)}while((0<I.avail_in||I.avail_out===0)&&o!==p.Z_STREAM_END);return o===p.Z_STREAM_END&&(c=p.Z_FINISH),c===p.Z_FINISH?(o=f.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===p.Z_OK):c!==p.Z_SYNC_FLUSH||(this.onEnd(p.Z_OK),!(I.avail_out=0))},s.prototype.onData=function(n){this.chunks.push(n)},s.prototype.onEnd=function(n){n===p.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=b.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg},k.Inflate=s,k.inflate=h,k.inflateRaw=function(n,e){return(e=e||{}).raw=!0,h(n,e)},k.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,l,k){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";k.assign=function(p){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var v=d.shift();if(v){if(typeof v!="object")throw new TypeError(v+"must be non-object");for(var C in v)v.hasOwnProperty(C)&&(p[C]=v[C])}}return p},k.shrinkBuf=function(p,d){return p.length===d?p:p.subarray?p.subarray(0,d):(p.length=d,p)};var b={arraySet:function(p,d,v,C,m){if(d.subarray&&p.subarray)p.set(d.subarray(v,v+C),m);else for(var s=0;s<C;s++)p[m+s]=d[v+s]},flattenChunks:function(p){var d,v,C,m,s,h;for(d=C=0,v=p.length;d<v;d++)C+=p[d].length;for(h=new Uint8Array(C),d=m=0,v=p.length;d<v;d++)s=p[d],h.set(s,m),m+=s.length;return h}},i={arraySet:function(p,d,v,C,m){for(var s=0;s<C;s++)p[m+s]=d[v+s]},flattenChunks:function(p){return[].concat.apply([],p)}};k.setTyped=function(p){p?(k.Buf8=Uint8Array,k.Buf16=Uint16Array,k.Buf32=Int32Array,k.assign(k,b)):(k.Buf8=Array,k.Buf16=Array,k.Buf32=Array,k.assign(k,i))},k.setTyped(f)},{}],42:[function(r,l,k){var f=r("./common"),b=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch{b=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{i=!1}for(var p=new f.Buf8(256),d=0;d<256;d++)p[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function v(C,m){if(m<65537&&(C.subarray&&i||!C.subarray&&b))return String.fromCharCode.apply(null,f.shrinkBuf(C,m));for(var s="",h=0;h<m;h++)s+=String.fromCharCode(C[h]);return s}p[254]=p[254]=1,k.string2buf=function(C){var m,s,h,n,e,o=C.length,c=0;for(n=0;n<o;n++)(64512&(s=C.charCodeAt(n)))==55296&&n+1<o&&(64512&(h=C.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(h-56320),n++),c+=s<128?1:s<2048?2:s<65536?3:4;for(m=new f.Buf8(c),n=e=0;e<c;n++)(64512&(s=C.charCodeAt(n)))==55296&&n+1<o&&(64512&(h=C.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(h-56320),n++),s<128?m[e++]=s:(s<2048?m[e++]=192|s>>>6:(s<65536?m[e++]=224|s>>>12:(m[e++]=240|s>>>18,m[e++]=128|s>>>12&63),m[e++]=128|s>>>6&63),m[e++]=128|63&s);return m},k.buf2binstring=function(C){return v(C,C.length)},k.binstring2buf=function(C){for(var m=new f.Buf8(C.length),s=0,h=m.length;s<h;s++)m[s]=C.charCodeAt(s);return m},k.buf2string=function(C,m){var s,h,n,e,o=m||C.length,c=new Array(2*o);for(s=h=0;s<o;)if((n=C[s++])<128)c[h++]=n;else if(4<(e=p[n]))c[h++]=65533,s+=e-1;else{for(n&=e===2?31:e===3?15:7;1<e&&s<o;)n=n<<6|63&C[s++],e--;1<e?c[h++]=65533:n<65536?c[h++]=n:(n-=65536,c[h++]=55296|n>>10&1023,c[h++]=56320|1023&n)}return v(c,h)},k.utf8border=function(C,m){var s;for((m=m||C.length)>C.length&&(m=C.length),s=m-1;0<=s&&(192&C[s])==128;)s--;return s<0||s===0?m:s+p[C[s]]>m?s:m}},{"./common":41}],43:[function(r,l,k){l.exports=function(f,b,i,p){for(var d=65535&f|0,v=f>>>16&65535|0,C=0;i!==0;){for(i-=C=2e3<i?2e3:i;v=v+(d=d+b[p++]|0)|0,--C;);d%=65521,v%=65521}return d|v<<16|0}},{}],44:[function(r,l,k){l.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,l,k){var f=function(){for(var b,i=[],p=0;p<256;p++){b=p;for(var d=0;d<8;d++)b=1&b?3988292384^b>>>1:b>>>1;i[p]=b}return i}();l.exports=function(b,i,p,d){var v=f,C=d+p;b^=-1;for(var m=d;m<C;m++)b=b>>>8^v[255&(b^i[m])];return-1^b}},{}],46:[function(r,l,k){var f,b=r("../utils/common"),i=r("./trees"),p=r("./adler32"),d=r("./crc32"),v=r("./messages"),C=0,m=4,s=0,h=-2,n=-1,e=4,o=2,c=8,y=9,E=286,_=30,S=19,I=2*E+1,$=15,W=3,T=258,q=T+W+1,F=42,V=113,w=1,j=2,fe=3,Z=4;function ne(g,ae){return g.msg=v[ae],ae}function ee(g){return(g<<1)-(4<g?9:0)}function ce(g){for(var ae=g.length;0<=--ae;)g[ae]=0}function N(g){var ae=g.state,te=ae.pending;te>g.avail_out&&(te=g.avail_out),te!==0&&(b.arraySet(g.output,ae.pending_buf,ae.pending_out,te,g.next_out),g.next_out+=te,ae.pending_out+=te,g.total_out+=te,g.avail_out-=te,ae.pending-=te,ae.pending===0&&(ae.pending_out=0))}function z(g,ae){i._tr_flush_block(g,0<=g.block_start?g.block_start:-1,g.strstart-g.block_start,ae),g.block_start=g.strstart,N(g.strm)}function Y(g,ae){g.pending_buf[g.pending++]=ae}function K(g,ae){g.pending_buf[g.pending++]=ae>>>8&255,g.pending_buf[g.pending++]=255&ae}function B(g,ae){var te,P,R=g.max_chain_length,G=g.strstart,le=g.prev_length,ie=g.nice_match,O=g.strstart>g.w_size-q?g.strstart-(g.w_size-q):0,H=g.window,J=g.w_mask,Q=g.prev,re=g.strstart+T,de=H[G+le-1],pe=H[G+le];g.prev_length>=g.good_match&&(R>>=2),ie>g.lookahead&&(ie=g.lookahead);do if(H[(te=ae)+le]===pe&&H[te+le-1]===de&&H[te]===H[G]&&H[++te]===H[G+1]){G+=2,te++;do;while(H[++G]===H[++te]&&H[++G]===H[++te]&&H[++G]===H[++te]&&H[++G]===H[++te]&&H[++G]===H[++te]&&H[++G]===H[++te]&&H[++G]===H[++te]&&H[++G]===H[++te]&&G<re);if(P=T-(re-G),G=re-T,le<P){if(g.match_start=ae,ie<=(le=P))break;de=H[G+le-1],pe=H[G+le]}}while((ae=Q[ae&J])>O&&--R!=0);return le<=g.lookahead?le:g.lookahead}function ve(g){var ae,te,P,R,G,le,ie,O,H,J,Q=g.w_size;do{if(R=g.window_size-g.lookahead-g.strstart,g.strstart>=Q+(Q-q)){for(b.arraySet(g.window,g.window,Q,Q,0),g.match_start-=Q,g.strstart-=Q,g.block_start-=Q,ae=te=g.hash_size;P=g.head[--ae],g.head[ae]=Q<=P?P-Q:0,--te;);for(ae=te=Q;P=g.prev[--ae],g.prev[ae]=Q<=P?P-Q:0,--te;);R+=Q}if(g.strm.avail_in===0)break;if(le=g.strm,ie=g.window,O=g.strstart+g.lookahead,H=R,J=void 0,J=le.avail_in,H<J&&(J=H),te=J===0?0:(le.avail_in-=J,b.arraySet(ie,le.input,le.next_in,J,O),le.state.wrap===1?le.adler=p(le.adler,ie,J,O):le.state.wrap===2&&(le.adler=d(le.adler,ie,J,O)),le.next_in+=J,le.total_in+=J,J),g.lookahead+=te,g.lookahead+g.insert>=W)for(G=g.strstart-g.insert,g.ins_h=g.window[G],g.ins_h=(g.ins_h<<g.hash_shift^g.window[G+1])&g.hash_mask;g.insert&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[G+W-1])&g.hash_mask,g.prev[G&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=G,G++,g.insert--,!(g.lookahead+g.insert<W)););}while(g.lookahead<q&&g.strm.avail_in!==0)}function Ee(g,ae){for(var te,P;;){if(g.lookahead<q){if(ve(g),g.lookahead<q&&ae===C)return w;if(g.lookahead===0)break}if(te=0,g.lookahead>=W&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+W-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),te!==0&&g.strstart-te<=g.w_size-q&&(g.match_length=B(g,te)),g.match_length>=W)if(P=i._tr_tally(g,g.strstart-g.match_start,g.match_length-W),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=W){for(g.match_length--;g.strstart++,g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+W-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart,--g.match_length!=0;);g.strstart++}else g.strstart+=g.match_length,g.match_length=0,g.ins_h=g.window[g.strstart],g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+1])&g.hash_mask;else P=i._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++;if(P&&(z(g,!1),g.strm.avail_out===0))return w}return g.insert=g.strstart<W-1?g.strstart:W-1,ae===m?(z(g,!0),g.strm.avail_out===0?fe:Z):g.last_lit&&(z(g,!1),g.strm.avail_out===0)?w:j}function ue(g,ae){for(var te,P,R;;){if(g.lookahead<q){if(ve(g),g.lookahead<q&&ae===C)return w;if(g.lookahead===0)break}if(te=0,g.lookahead>=W&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+W-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),g.prev_length=g.match_length,g.prev_match=g.match_start,g.match_length=W-1,te!==0&&g.prev_length<g.max_lazy_match&&g.strstart-te<=g.w_size-q&&(g.match_length=B(g,te),g.match_length<=5&&(g.strategy===1||g.match_length===W&&4096<g.strstart-g.match_start)&&(g.match_length=W-1)),g.prev_length>=W&&g.match_length<=g.prev_length){for(R=g.strstart+g.lookahead-W,P=i._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-W),g.lookahead-=g.prev_length-1,g.prev_length-=2;++g.strstart<=R&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+W-1])&g.hash_mask,te=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),--g.prev_length!=0;);if(g.match_available=0,g.match_length=W-1,g.strstart++,P&&(z(g,!1),g.strm.avail_out===0))return w}else if(g.match_available){if((P=i._tr_tally(g,0,g.window[g.strstart-1]))&&z(g,!1),g.strstart++,g.lookahead--,g.strm.avail_out===0)return w}else g.match_available=1,g.strstart++,g.lookahead--}return g.match_available&&(P=i._tr_tally(g,0,g.window[g.strstart-1]),g.match_available=0),g.insert=g.strstart<W-1?g.strstart:W-1,ae===m?(z(g,!0),g.strm.avail_out===0?fe:Z):g.last_lit&&(z(g,!1),g.strm.avail_out===0)?w:j}function _e(g,ae,te,P,R){this.good_length=g,this.max_lazy=ae,this.nice_length=te,this.max_chain=P,this.func=R}function Me(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=c,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new b.Buf16(2*I),this.dyn_dtree=new b.Buf16(2*(2*_+1)),this.bl_tree=new b.Buf16(2*(2*S+1)),ce(this.dyn_ltree),ce(this.dyn_dtree),ce(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new b.Buf16($+1),this.heap=new b.Buf16(2*E+1),ce(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new b.Buf16(2*E+1),ce(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Se(g){var ae;return g&&g.state?(g.total_in=g.total_out=0,g.data_type=o,(ae=g.state).pending=0,ae.pending_out=0,ae.wrap<0&&(ae.wrap=-ae.wrap),ae.status=ae.wrap?F:V,g.adler=ae.wrap===2?0:1,ae.last_flush=C,i._tr_init(ae),s):ne(g,h)}function Ze(g){var ae=Se(g);return ae===s&&function(te){te.window_size=2*te.w_size,ce(te.head),te.max_lazy_match=f[te.level].max_lazy,te.good_match=f[te.level].good_length,te.nice_match=f[te.level].nice_length,te.max_chain_length=f[te.level].max_chain,te.strstart=0,te.block_start=0,te.lookahead=0,te.insert=0,te.match_length=te.prev_length=W-1,te.match_available=0,te.ins_h=0}(g.state),ae}function We(g,ae,te,P,R,G){if(!g)return h;var le=1;if(ae===n&&(ae=6),P<0?(le=0,P=-P):15<P&&(le=2,P-=16),R<1||y<R||te!==c||P<8||15<P||ae<0||9<ae||G<0||e<G)return ne(g,h);P===8&&(P=9);var ie=new Me;return(g.state=ie).strm=g,ie.wrap=le,ie.gzhead=null,ie.w_bits=P,ie.w_size=1<<ie.w_bits,ie.w_mask=ie.w_size-1,ie.hash_bits=R+7,ie.hash_size=1<<ie.hash_bits,ie.hash_mask=ie.hash_size-1,ie.hash_shift=~~((ie.hash_bits+W-1)/W),ie.window=new b.Buf8(2*ie.w_size),ie.head=new b.Buf16(ie.hash_size),ie.prev=new b.Buf16(ie.w_size),ie.lit_bufsize=1<<R+6,ie.pending_buf_size=4*ie.lit_bufsize,ie.pending_buf=new b.Buf8(ie.pending_buf_size),ie.d_buf=1*ie.lit_bufsize,ie.l_buf=3*ie.lit_bufsize,ie.level=ae,ie.strategy=G,ie.method=te,Ze(g)}f=[new _e(0,0,0,0,function(g,ae){var te=65535;for(te>g.pending_buf_size-5&&(te=g.pending_buf_size-5);;){if(g.lookahead<=1){if(ve(g),g.lookahead===0&&ae===C)return w;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var P=g.block_start+te;if((g.strstart===0||g.strstart>=P)&&(g.lookahead=g.strstart-P,g.strstart=P,z(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-q&&(z(g,!1),g.strm.avail_out===0))return w}return g.insert=0,ae===m?(z(g,!0),g.strm.avail_out===0?fe:Z):(g.strstart>g.block_start&&(z(g,!1),g.strm.avail_out),w)}),new _e(4,4,8,4,Ee),new _e(4,5,16,8,Ee),new _e(4,6,32,32,Ee),new _e(4,4,16,16,ue),new _e(8,16,32,32,ue),new _e(8,16,128,128,ue),new _e(8,32,128,256,ue),new _e(32,128,258,1024,ue),new _e(32,258,258,4096,ue)],k.deflateInit=function(g,ae){return We(g,ae,c,15,8,0)},k.deflateInit2=We,k.deflateReset=Ze,k.deflateResetKeep=Se,k.deflateSetHeader=function(g,ae){return g&&g.state?g.state.wrap!==2?h:(g.state.gzhead=ae,s):h},k.deflate=function(g,ae){var te,P,R,G;if(!g||!g.state||5<ae||ae<0)return g?ne(g,h):h;if(P=g.state,!g.output||!g.input&&g.avail_in!==0||P.status===666&&ae!==m)return ne(g,g.avail_out===0?-5:h);if(P.strm=g,te=P.last_flush,P.last_flush=ae,P.status===F)if(P.wrap===2)g.adler=0,Y(P,31),Y(P,139),Y(P,8),P.gzhead?(Y(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),Y(P,255&P.gzhead.time),Y(P,P.gzhead.time>>8&255),Y(P,P.gzhead.time>>16&255),Y(P,P.gzhead.time>>24&255),Y(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),Y(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(Y(P,255&P.gzhead.extra.length),Y(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(g.adler=d(g.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(Y(P,0),Y(P,0),Y(P,0),Y(P,0),Y(P,0),Y(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),Y(P,3),P.status=V);else{var le=c+(P.w_bits-8<<4)<<8;le|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(le|=32),le+=31-le%31,P.status=V,K(P,le),P.strstart!==0&&(K(P,g.adler>>>16),K(P,65535&g.adler)),g.adler=1}if(P.status===69)if(P.gzhead.extra){for(R=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>R&&(g.adler=d(g.adler,P.pending_buf,P.pending-R,R)),N(g),R=P.pending,P.pending!==P.pending_buf_size));)Y(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>R&&(g.adler=d(g.adler,P.pending_buf,P.pending-R,R)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(g.adler=d(g.adler,P.pending_buf,P.pending-R,R)),N(g),R=P.pending,P.pending===P.pending_buf_size)){G=1;break}G=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,Y(P,G)}while(G!==0);P.gzhead.hcrc&&P.pending>R&&(g.adler=d(g.adler,P.pending_buf,P.pending-R,R)),G===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(g.adler=d(g.adler,P.pending_buf,P.pending-R,R)),N(g),R=P.pending,P.pending===P.pending_buf_size)){G=1;break}G=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,Y(P,G)}while(G!==0);P.gzhead.hcrc&&P.pending>R&&(g.adler=d(g.adler,P.pending_buf,P.pending-R,R)),G===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&N(g),P.pending+2<=P.pending_buf_size&&(Y(P,255&g.adler),Y(P,g.adler>>8&255),g.adler=0,P.status=V)):P.status=V),P.pending!==0){if(N(g),g.avail_out===0)return P.last_flush=-1,s}else if(g.avail_in===0&&ee(ae)<=ee(te)&&ae!==m)return ne(g,-5);if(P.status===666&&g.avail_in!==0)return ne(g,-5);if(g.avail_in!==0||P.lookahead!==0||ae!==C&&P.status!==666){var ie=P.strategy===2?function(O,H){for(var J;;){if(O.lookahead===0&&(ve(O),O.lookahead===0)){if(H===C)return w;break}if(O.match_length=0,J=i._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++,J&&(z(O,!1),O.strm.avail_out===0))return w}return O.insert=0,H===m?(z(O,!0),O.strm.avail_out===0?fe:Z):O.last_lit&&(z(O,!1),O.strm.avail_out===0)?w:j}(P,ae):P.strategy===3?function(O,H){for(var J,Q,re,de,pe=O.window;;){if(O.lookahead<=T){if(ve(O),O.lookahead<=T&&H===C)return w;if(O.lookahead===0)break}if(O.match_length=0,O.lookahead>=W&&0<O.strstart&&(Q=pe[re=O.strstart-1])===pe[++re]&&Q===pe[++re]&&Q===pe[++re]){de=O.strstart+T;do;while(Q===pe[++re]&&Q===pe[++re]&&Q===pe[++re]&&Q===pe[++re]&&Q===pe[++re]&&Q===pe[++re]&&Q===pe[++re]&&Q===pe[++re]&&re<de);O.match_length=T-(de-re),O.match_length>O.lookahead&&(O.match_length=O.lookahead)}if(O.match_length>=W?(J=i._tr_tally(O,1,O.match_length-W),O.lookahead-=O.match_length,O.strstart+=O.match_length,O.match_length=0):(J=i._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++),J&&(z(O,!1),O.strm.avail_out===0))return w}return O.insert=0,H===m?(z(O,!0),O.strm.avail_out===0?fe:Z):O.last_lit&&(z(O,!1),O.strm.avail_out===0)?w:j}(P,ae):f[P.level].func(P,ae);if(ie!==fe&&ie!==Z||(P.status=666),ie===w||ie===fe)return g.avail_out===0&&(P.last_flush=-1),s;if(ie===j&&(ae===1?i._tr_align(P):ae!==5&&(i._tr_stored_block(P,0,0,!1),ae===3&&(ce(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),N(g),g.avail_out===0))return P.last_flush=-1,s}return ae!==m?s:P.wrap<=0?1:(P.wrap===2?(Y(P,255&g.adler),Y(P,g.adler>>8&255),Y(P,g.adler>>16&255),Y(P,g.adler>>24&255),Y(P,255&g.total_in),Y(P,g.total_in>>8&255),Y(P,g.total_in>>16&255),Y(P,g.total_in>>24&255)):(K(P,g.adler>>>16),K(P,65535&g.adler)),N(g),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?s:1)},k.deflateEnd=function(g){var ae;return g&&g.state?(ae=g.state.status)!==F&&ae!==69&&ae!==73&&ae!==91&&ae!==103&&ae!==V&&ae!==666?ne(g,h):(g.state=null,ae===V?ne(g,-3):s):h},k.deflateSetDictionary=function(g,ae){var te,P,R,G,le,ie,O,H,J=ae.length;if(!g||!g.state||(G=(te=g.state).wrap)===2||G===1&&te.status!==F||te.lookahead)return h;for(G===1&&(g.adler=p(g.adler,ae,J,0)),te.wrap=0,J>=te.w_size&&(G===0&&(ce(te.head),te.strstart=0,te.block_start=0,te.insert=0),H=new b.Buf8(te.w_size),b.arraySet(H,ae,J-te.w_size,te.w_size,0),ae=H,J=te.w_size),le=g.avail_in,ie=g.next_in,O=g.input,g.avail_in=J,g.next_in=0,g.input=ae,ve(te);te.lookahead>=W;){for(P=te.strstart,R=te.lookahead-(W-1);te.ins_h=(te.ins_h<<te.hash_shift^te.window[P+W-1])&te.hash_mask,te.prev[P&te.w_mask]=te.head[te.ins_h],te.head[te.ins_h]=P,P++,--R;);te.strstart=P,te.lookahead=W-1,ve(te)}return te.strstart+=te.lookahead,te.block_start=te.strstart,te.insert=te.lookahead,te.lookahead=0,te.match_length=te.prev_length=W-1,te.match_available=0,g.next_in=ie,g.input=O,g.avail_in=le,te.wrap=G,s},k.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,l,k){l.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,l,k){l.exports=function(f,b){var i,p,d,v,C,m,s,h,n,e,o,c,y,E,_,S,I,$,W,T,q,F,V,w,j;i=f.state,p=f.next_in,w=f.input,d=p+(f.avail_in-5),v=f.next_out,j=f.output,C=v-(b-f.avail_out),m=v+(f.avail_out-257),s=i.dmax,h=i.wsize,n=i.whave,e=i.wnext,o=i.window,c=i.hold,y=i.bits,E=i.lencode,_=i.distcode,S=(1<<i.lenbits)-1,I=(1<<i.distbits)-1;e:do{y<15&&(c+=w[p++]<<y,y+=8,c+=w[p++]<<y,y+=8),$=E[c&S];t:for(;;){if(c>>>=W=$>>>24,y-=W,(W=$>>>16&255)===0)j[v++]=65535&$;else{if(!(16&W)){if(!(64&W)){$=E[(65535&$)+(c&(1<<W)-1)];continue t}if(32&W){i.mode=12;break e}f.msg="invalid literal/length code",i.mode=30;break e}T=65535&$,(W&=15)&&(y<W&&(c+=w[p++]<<y,y+=8),T+=c&(1<<W)-1,c>>>=W,y-=W),y<15&&(c+=w[p++]<<y,y+=8,c+=w[p++]<<y,y+=8),$=_[c&I];r:for(;;){if(c>>>=W=$>>>24,y-=W,!(16&(W=$>>>16&255))){if(!(64&W)){$=_[(65535&$)+(c&(1<<W)-1)];continue r}f.msg="invalid distance code",i.mode=30;break e}if(q=65535&$,y<(W&=15)&&(c+=w[p++]<<y,(y+=8)<W&&(c+=w[p++]<<y,y+=8)),s<(q+=c&(1<<W)-1)){f.msg="invalid distance too far back",i.mode=30;break e}if(c>>>=W,y-=W,(W=v-C)<q){if(n<(W=q-W)&&i.sane){f.msg="invalid distance too far back",i.mode=30;break e}if(V=o,(F=0)===e){if(F+=h-W,W<T){for(T-=W;j[v++]=o[F++],--W;);F=v-q,V=j}}else if(e<W){if(F+=h+e-W,(W-=e)<T){for(T-=W;j[v++]=o[F++],--W;);if(F=0,e<T){for(T-=W=e;j[v++]=o[F++],--W;);F=v-q,V=j}}}else if(F+=e-W,W<T){for(T-=W;j[v++]=o[F++],--W;);F=v-q,V=j}for(;2<T;)j[v++]=V[F++],j[v++]=V[F++],j[v++]=V[F++],T-=3;T&&(j[v++]=V[F++],1<T&&(j[v++]=V[F++]))}else{for(F=v-q;j[v++]=j[F++],j[v++]=j[F++],j[v++]=j[F++],2<(T-=3););T&&(j[v++]=j[F++],1<T&&(j[v++]=j[F++]))}break}}break}}while(p<d&&v<m);p-=T=y>>3,c&=(1<<(y-=T<<3))-1,f.next_in=p,f.next_out=v,f.avail_in=p<d?d-p+5:5-(p-d),f.avail_out=v<m?m-v+257:257-(v-m),i.hold=c,i.bits=y}},{}],49:[function(r,l,k){var f=r("../utils/common"),b=r("./adler32"),i=r("./crc32"),p=r("./inffast"),d=r("./inftrees"),v=1,C=2,m=0,s=-2,h=1,n=852,e=592;function o(F){return(F>>>24&255)+(F>>>8&65280)+((65280&F)<<8)+((255&F)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(F){var V;return F&&F.state?(V=F.state,F.total_in=F.total_out=V.total=0,F.msg="",V.wrap&&(F.adler=1&V.wrap),V.mode=h,V.last=0,V.havedict=0,V.dmax=32768,V.head=null,V.hold=0,V.bits=0,V.lencode=V.lendyn=new f.Buf32(n),V.distcode=V.distdyn=new f.Buf32(e),V.sane=1,V.back=-1,m):s}function E(F){var V;return F&&F.state?((V=F.state).wsize=0,V.whave=0,V.wnext=0,y(F)):s}function _(F,V){var w,j;return F&&F.state?(j=F.state,V<0?(w=0,V=-V):(w=1+(V>>4),V<48&&(V&=15)),V&&(V<8||15<V)?s:(j.window!==null&&j.wbits!==V&&(j.window=null),j.wrap=w,j.wbits=V,E(F))):s}function S(F,V){var w,j;return F?(j=new c,(F.state=j).window=null,(w=_(F,V))!==m&&(F.state=null),w):s}var I,$,W=!0;function T(F){if(W){var V;for(I=new f.Buf32(512),$=new f.Buf32(32),V=0;V<144;)F.lens[V++]=8;for(;V<256;)F.lens[V++]=9;for(;V<280;)F.lens[V++]=7;for(;V<288;)F.lens[V++]=8;for(d(v,F.lens,0,288,I,0,F.work,{bits:9}),V=0;V<32;)F.lens[V++]=5;d(C,F.lens,0,32,$,0,F.work,{bits:5}),W=!1}F.lencode=I,F.lenbits=9,F.distcode=$,F.distbits=5}function q(F,V,w,j){var fe,Z=F.state;return Z.window===null&&(Z.wsize=1<<Z.wbits,Z.wnext=0,Z.whave=0,Z.window=new f.Buf8(Z.wsize)),j>=Z.wsize?(f.arraySet(Z.window,V,w-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize):(j<(fe=Z.wsize-Z.wnext)&&(fe=j),f.arraySet(Z.window,V,w-j,fe,Z.wnext),(j-=fe)?(f.arraySet(Z.window,V,w-j,j,0),Z.wnext=j,Z.whave=Z.wsize):(Z.wnext+=fe,Z.wnext===Z.wsize&&(Z.wnext=0),Z.whave<Z.wsize&&(Z.whave+=fe))),0}k.inflateReset=E,k.inflateReset2=_,k.inflateResetKeep=y,k.inflateInit=function(F){return S(F,15)},k.inflateInit2=S,k.inflate=function(F,V){var w,j,fe,Z,ne,ee,ce,N,z,Y,K,B,ve,Ee,ue,_e,Me,Se,Ze,We,g,ae,te,P,R=0,G=new f.Buf8(4),le=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!F||!F.state||!F.output||!F.input&&F.avail_in!==0)return s;(w=F.state).mode===12&&(w.mode=13),ne=F.next_out,fe=F.output,ce=F.avail_out,Z=F.next_in,j=F.input,ee=F.avail_in,N=w.hold,z=w.bits,Y=ee,K=ce,ae=m;e:for(;;)switch(w.mode){case h:if(w.wrap===0){w.mode=13;break}for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(2&w.wrap&&N===35615){G[w.check=0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0),z=N=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&N)<<8)+(N>>8))%31){F.msg="incorrect header check",w.mode=30;break}if((15&N)!=8){F.msg="unknown compression method",w.mode=30;break}if(z-=4,g=8+(15&(N>>>=4)),w.wbits===0)w.wbits=g;else if(g>w.wbits){F.msg="invalid window size",w.mode=30;break}w.dmax=1<<g,F.adler=w.check=1,w.mode=512&N?10:12,z=N=0;break;case 2:for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(w.flags=N,(255&w.flags)!=8){F.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){F.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=N>>8&1),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0)),z=N=0,w.mode=3;case 3:for(;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.head&&(w.head.time=N),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,G[2]=N>>>16&255,G[3]=N>>>24&255,w.check=i(w.check,G,4,0)),z=N=0,w.mode=4;case 4:for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.head&&(w.head.xflags=255&N,w.head.os=N>>8),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0)),z=N=0,w.mode=5;case 5:if(1024&w.flags){for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.length=N,w.head&&(w.head.extra_len=N),512&w.flags&&(G[0]=255&N,G[1]=N>>>8&255,w.check=i(w.check,G,2,0)),z=N=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(ee<(B=w.length)&&(B=ee),B&&(w.head&&(g=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),f.arraySet(w.head.extra,j,Z,B,g)),512&w.flags&&(w.check=i(w.check,j,B,Z)),ee-=B,Z+=B,w.length-=B),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(ee===0)break e;for(B=0;g=j[Z+B++],w.head&&g&&w.length<65536&&(w.head.name+=String.fromCharCode(g)),g&&B<ee;);if(512&w.flags&&(w.check=i(w.check,j,B,Z)),ee-=B,Z+=B,g)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(ee===0)break e;for(B=0;g=j[Z+B++],w.head&&g&&w.length<65536&&(w.head.comment+=String.fromCharCode(g)),g&&B<ee;);if(512&w.flags&&(w.check=i(w.check,j,B,Z)),ee-=B,Z+=B,g)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;z<16;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(N!==(65535&w.check)){F.msg="header crc mismatch",w.mode=30;break}z=N=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),F.adler=w.check=0,w.mode=12;break;case 10:for(;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}F.adler=w.check=o(N),z=N=0,w.mode=11;case 11:if(w.havedict===0)return F.next_out=ne,F.avail_out=ce,F.next_in=Z,F.avail_in=ee,w.hold=N,w.bits=z,2;F.adler=w.check=1,w.mode=12;case 12:if(V===5||V===6)break e;case 13:if(w.last){N>>>=7&z,z-=7&z,w.mode=27;break}for(;z<3;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}switch(w.last=1&N,z-=1,3&(N>>>=1)){case 0:w.mode=14;break;case 1:if(T(w),w.mode=20,V!==6)break;N>>>=2,z-=2;break e;case 2:w.mode=17;break;case 3:F.msg="invalid block type",w.mode=30}N>>>=2,z-=2;break;case 14:for(N>>>=7&z,z-=7&z;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if((65535&N)!=(N>>>16^65535)){F.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&N,z=N=0,w.mode=15,V===6)break e;case 15:w.mode=16;case 16:if(B=w.length){if(ee<B&&(B=ee),ce<B&&(B=ce),B===0)break e;f.arraySet(fe,j,Z,B,ne),ee-=B,Z+=B,ce-=B,ne+=B,w.length-=B;break}w.mode=12;break;case 17:for(;z<14;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(w.nlen=257+(31&N),N>>>=5,z-=5,w.ndist=1+(31&N),N>>>=5,z-=5,w.ncode=4+(15&N),N>>>=4,z-=4,286<w.nlen||30<w.ndist){F.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;z<3;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.lens[le[w.have++]]=7&N,N>>>=3,z-=3}for(;w.have<19;)w.lens[le[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,te={bits:w.lenbits},ae=d(0,w.lens,0,19,w.lencode,0,w.work,te),w.lenbits=te.bits,ae){F.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;_e=(R=w.lencode[N&(1<<w.lenbits)-1])>>>16&255,Me=65535&R,!((ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(Me<16)N>>>=ue,z-=ue,w.lens[w.have++]=Me;else{if(Me===16){for(P=ue+2;z<P;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(N>>>=ue,z-=ue,w.have===0){F.msg="invalid bit length repeat",w.mode=30;break}g=w.lens[w.have-1],B=3+(3&N),N>>>=2,z-=2}else if(Me===17){for(P=ue+3;z<P;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}z-=ue,g=0,B=3+(7&(N>>>=ue)),N>>>=3,z-=3}else{for(P=ue+7;z<P;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}z-=ue,g=0,B=11+(127&(N>>>=ue)),N>>>=7,z-=7}if(w.have+B>w.nlen+w.ndist){F.msg="invalid bit length repeat",w.mode=30;break}for(;B--;)w.lens[w.have++]=g}}if(w.mode===30)break;if(w.lens[256]===0){F.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,te={bits:w.lenbits},ae=d(v,w.lens,0,w.nlen,w.lencode,0,w.work,te),w.lenbits=te.bits,ae){F.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,te={bits:w.distbits},ae=d(C,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,te),w.distbits=te.bits,ae){F.msg="invalid distances set",w.mode=30;break}if(w.mode=20,V===6)break e;case 20:w.mode=21;case 21:if(6<=ee&&258<=ce){F.next_out=ne,F.avail_out=ce,F.next_in=Z,F.avail_in=ee,w.hold=N,w.bits=z,p(F,K),ne=F.next_out,fe=F.output,ce=F.avail_out,Z=F.next_in,j=F.input,ee=F.avail_in,N=w.hold,z=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;_e=(R=w.lencode[N&(1<<w.lenbits)-1])>>>16&255,Me=65535&R,!((ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(_e&&!(240&_e)){for(Se=ue,Ze=_e,We=Me;_e=(R=w.lencode[We+((N&(1<<Se+Ze)-1)>>Se)])>>>16&255,Me=65535&R,!(Se+(ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}N>>>=Se,z-=Se,w.back+=Se}if(N>>>=ue,z-=ue,w.back+=ue,w.length=Me,_e===0){w.mode=26;break}if(32&_e){w.back=-1,w.mode=12;break}if(64&_e){F.msg="invalid literal/length code",w.mode=30;break}w.extra=15&_e,w.mode=22;case 22:if(w.extra){for(P=w.extra;z<P;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.length+=N&(1<<w.extra)-1,N>>>=w.extra,z-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;_e=(R=w.distcode[N&(1<<w.distbits)-1])>>>16&255,Me=65535&R,!((ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(!(240&_e)){for(Se=ue,Ze=_e,We=Me;_e=(R=w.distcode[We+((N&(1<<Se+Ze)-1)>>Se)])>>>16&255,Me=65535&R,!(Se+(ue=R>>>24)<=z);){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}N>>>=Se,z-=Se,w.back+=Se}if(N>>>=ue,z-=ue,w.back+=ue,64&_e){F.msg="invalid distance code",w.mode=30;break}w.offset=Me,w.extra=15&_e,w.mode=24;case 24:if(w.extra){for(P=w.extra;z<P;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}w.offset+=N&(1<<w.extra)-1,N>>>=w.extra,z-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){F.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(ce===0)break e;if(B=K-ce,w.offset>B){if((B=w.offset-B)>w.whave&&w.sane){F.msg="invalid distance too far back",w.mode=30;break}ve=B>w.wnext?(B-=w.wnext,w.wsize-B):w.wnext-B,B>w.length&&(B=w.length),Ee=w.window}else Ee=fe,ve=ne-w.offset,B=w.length;for(ce<B&&(B=ce),ce-=B,w.length-=B;fe[ne++]=Ee[ve++],--B;);w.length===0&&(w.mode=21);break;case 26:if(ce===0)break e;fe[ne++]=w.length,ce--,w.mode=21;break;case 27:if(w.wrap){for(;z<32;){if(ee===0)break e;ee--,N|=j[Z++]<<z,z+=8}if(K-=ce,F.total_out+=K,w.total+=K,K&&(F.adler=w.check=w.flags?i(w.check,fe,K,ne-K):b(w.check,fe,K,ne-K)),K=ce,(w.flags?N:o(N))!==w.check){F.msg="incorrect data check",w.mode=30;break}z=N=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;z<32;){if(ee===0)break e;ee--,N+=j[Z++]<<z,z+=8}if(N!==(4294967295&w.total)){F.msg="incorrect length check",w.mode=30;break}z=N=0}w.mode=29;case 29:ae=1;break e;case 30:ae=-3;break e;case 31:return-4;case 32:default:return s}return F.next_out=ne,F.avail_out=ce,F.next_in=Z,F.avail_in=ee,w.hold=N,w.bits=z,(w.wsize||K!==F.avail_out&&w.mode<30&&(w.mode<27||V!==4))&&q(F,F.output,F.next_out,K-F.avail_out)?(w.mode=31,-4):(Y-=F.avail_in,K-=F.avail_out,F.total_in+=Y,F.total_out+=K,w.total+=K,w.wrap&&K&&(F.adler=w.check=w.flags?i(w.check,fe,K,F.next_out-K):b(w.check,fe,K,F.next_out-K)),F.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(Y==0&&K===0||V===4)&&ae===m&&(ae=-5),ae)},k.inflateEnd=function(F){if(!F||!F.state)return s;var V=F.state;return V.window&&(V.window=null),F.state=null,m},k.inflateGetHeader=function(F,V){var w;return F&&F.state&&2&(w=F.state).wrap?((w.head=V).done=!1,m):s},k.inflateSetDictionary=function(F,V){var w,j=V.length;return F&&F.state?(w=F.state).wrap!==0&&w.mode!==11?s:w.mode===11&&b(1,V,j,0)!==w.check?-3:q(F,V,j,j)?(w.mode=31,-4):(w.havedict=1,m):s},k.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,l,k){var f=r("../utils/common"),b=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],p=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];l.exports=function(v,C,m,s,h,n,e,o){var c,y,E,_,S,I,$,W,T,q=o.bits,F=0,V=0,w=0,j=0,fe=0,Z=0,ne=0,ee=0,ce=0,N=0,z=null,Y=0,K=new f.Buf16(16),B=new f.Buf16(16),ve=null,Ee=0;for(F=0;F<=15;F++)K[F]=0;for(V=0;V<s;V++)K[C[m+V]]++;for(fe=q,j=15;1<=j&&K[j]===0;j--);if(j<fe&&(fe=j),j===0)return h[n++]=20971520,h[n++]=20971520,o.bits=1,0;for(w=1;w<j&&K[w]===0;w++);for(fe<w&&(fe=w),F=ee=1;F<=15;F++)if(ee<<=1,(ee-=K[F])<0)return-1;if(0<ee&&(v===0||j!==1))return-1;for(B[1]=0,F=1;F<15;F++)B[F+1]=B[F]+K[F];for(V=0;V<s;V++)C[m+V]!==0&&(e[B[C[m+V]]++]=V);if(I=v===0?(z=ve=e,19):v===1?(z=b,Y-=257,ve=i,Ee-=257,256):(z=p,ve=d,-1),F=w,S=n,ne=V=N=0,E=-1,_=(ce=1<<(Z=fe))-1,v===1&&852<ce||v===2&&592<ce)return 1;for(;;){for($=F-ne,T=e[V]<I?(W=0,e[V]):e[V]>I?(W=ve[Ee+e[V]],z[Y+e[V]]):(W=96,0),c=1<<F-ne,w=y=1<<Z;h[S+(N>>ne)+(y-=c)]=$<<24|W<<16|T|0,y!==0;);for(c=1<<F-1;N&c;)c>>=1;if(c!==0?(N&=c-1,N+=c):N=0,V++,--K[F]==0){if(F===j)break;F=C[m+e[V]]}if(fe<F&&(N&_)!==E){for(ne===0&&(ne=fe),S+=w,ee=1<<(Z=F-ne);Z+ne<j&&!((ee-=K[Z+ne])<=0);)Z++,ee<<=1;if(ce+=1<<Z,v===1&&852<ce||v===2&&592<ce)return 1;h[E=N&_]=fe<<24|Z<<16|S-n|0}}return N!==0&&(h[S+N]=F-ne<<24|64<<16|0),o.bits=fe,0}},{"../utils/common":41}],51:[function(r,l,k){l.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,l,k){var f=r("../utils/common"),b=0,i=1;function p(R){for(var G=R.length;0<=--G;)R[G]=0}var d=0,v=29,C=256,m=C+1+v,s=30,h=19,n=2*m+1,e=15,o=16,c=7,y=256,E=16,_=17,S=18,I=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],$=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],W=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(m+2));p(q);var F=new Array(2*s);p(F);var V=new Array(512);p(V);var w=new Array(256);p(w);var j=new Array(v);p(j);var fe,Z,ne,ee=new Array(s);function ce(R,G,le,ie,O){this.static_tree=R,this.extra_bits=G,this.extra_base=le,this.elems=ie,this.max_length=O,this.has_stree=R&&R.length}function N(R,G){this.dyn_tree=R,this.max_code=0,this.stat_desc=G}function z(R){return R<256?V[R]:V[256+(R>>>7)]}function Y(R,G){R.pending_buf[R.pending++]=255&G,R.pending_buf[R.pending++]=G>>>8&255}function K(R,G,le){R.bi_valid>o-le?(R.bi_buf|=G<<R.bi_valid&65535,Y(R,R.bi_buf),R.bi_buf=G>>o-R.bi_valid,R.bi_valid+=le-o):(R.bi_buf|=G<<R.bi_valid&65535,R.bi_valid+=le)}function B(R,G,le){K(R,le[2*G],le[2*G+1])}function ve(R,G){for(var le=0;le|=1&R,R>>>=1,le<<=1,0<--G;);return le>>>1}function Ee(R,G,le){var ie,O,H=new Array(e+1),J=0;for(ie=1;ie<=e;ie++)H[ie]=J=J+le[ie-1]<<1;for(O=0;O<=G;O++){var Q=R[2*O+1];Q!==0&&(R[2*O]=ve(H[Q]++,Q))}}function ue(R){var G;for(G=0;G<m;G++)R.dyn_ltree[2*G]=0;for(G=0;G<s;G++)R.dyn_dtree[2*G]=0;for(G=0;G<h;G++)R.bl_tree[2*G]=0;R.dyn_ltree[2*y]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function _e(R){8<R.bi_valid?Y(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function Me(R,G,le,ie){var O=2*G,H=2*le;return R[O]<R[H]||R[O]===R[H]&&ie[G]<=ie[le]}function Se(R,G,le){for(var ie=R.heap[le],O=le<<1;O<=R.heap_len&&(O<R.heap_len&&Me(G,R.heap[O+1],R.heap[O],R.depth)&&O++,!Me(G,ie,R.heap[O],R.depth));)R.heap[le]=R.heap[O],le=O,O<<=1;R.heap[le]=ie}function Ze(R,G,le){var ie,O,H,J,Q=0;if(R.last_lit!==0)for(;ie=R.pending_buf[R.d_buf+2*Q]<<8|R.pending_buf[R.d_buf+2*Q+1],O=R.pending_buf[R.l_buf+Q],Q++,ie===0?B(R,O,G):(B(R,(H=w[O])+C+1,G),(J=I[H])!==0&&K(R,O-=j[H],J),B(R,H=z(--ie),le),(J=$[H])!==0&&K(R,ie-=ee[H],J)),Q<R.last_lit;);B(R,y,G)}function We(R,G){var le,ie,O,H=G.dyn_tree,J=G.stat_desc.static_tree,Q=G.stat_desc.has_stree,re=G.stat_desc.elems,de=-1;for(R.heap_len=0,R.heap_max=n,le=0;le<re;le++)H[2*le]!==0?(R.heap[++R.heap_len]=de=le,R.depth[le]=0):H[2*le+1]=0;for(;R.heap_len<2;)H[2*(O=R.heap[++R.heap_len]=de<2?++de:0)]=1,R.depth[O]=0,R.opt_len--,Q&&(R.static_len-=J[2*O+1]);for(G.max_code=de,le=R.heap_len>>1;1<=le;le--)Se(R,H,le);for(O=re;le=R.heap[1],R.heap[1]=R.heap[R.heap_len--],Se(R,H,1),ie=R.heap[1],R.heap[--R.heap_max]=le,R.heap[--R.heap_max]=ie,H[2*O]=H[2*le]+H[2*ie],R.depth[O]=(R.depth[le]>=R.depth[ie]?R.depth[le]:R.depth[ie])+1,H[2*le+1]=H[2*ie+1]=O,R.heap[1]=O++,Se(R,H,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],function(pe,ke){var ge,he,xe,we,Be,Ne,Ue=ke.dyn_tree,st=ke.max_code,at=ke.stat_desc.static_tree,vt=ke.stat_desc.has_stree,Qe=ke.stat_desc.extra_bits,Ge=ke.stat_desc.extra_base,He=ke.stat_desc.max_length,qe=0;for(we=0;we<=e;we++)pe.bl_count[we]=0;for(Ue[2*pe.heap[pe.heap_max]+1]=0,ge=pe.heap_max+1;ge<n;ge++)He<(we=Ue[2*Ue[2*(he=pe.heap[ge])+1]+1]+1)&&(we=He,qe++),Ue[2*he+1]=we,st<he||(pe.bl_count[we]++,Be=0,Ge<=he&&(Be=Qe[he-Ge]),Ne=Ue[2*he],pe.opt_len+=Ne*(we+Be),vt&&(pe.static_len+=Ne*(at[2*he+1]+Be)));if(qe!==0){do{for(we=He-1;pe.bl_count[we]===0;)we--;pe.bl_count[we]--,pe.bl_count[we+1]+=2,pe.bl_count[He]--,qe-=2}while(0<qe);for(we=He;we!==0;we--)for(he=pe.bl_count[we];he!==0;)st<(xe=pe.heap[--ge])||(Ue[2*xe+1]!==we&&(pe.opt_len+=(we-Ue[2*xe+1])*Ue[2*xe],Ue[2*xe+1]=we),he--)}}(R,G),Ee(H,de,R.bl_count)}function g(R,G,le){var ie,O,H=-1,J=G[1],Q=0,re=7,de=4;for(J===0&&(re=138,de=3),G[2*(le+1)+1]=65535,ie=0;ie<=le;ie++)O=J,J=G[2*(ie+1)+1],++Q<re&&O===J||(Q<de?R.bl_tree[2*O]+=Q:O!==0?(O!==H&&R.bl_tree[2*O]++,R.bl_tree[2*E]++):Q<=10?R.bl_tree[2*_]++:R.bl_tree[2*S]++,H=O,de=(Q=0)===J?(re=138,3):O===J?(re=6,3):(re=7,4))}function ae(R,G,le){var ie,O,H=-1,J=G[1],Q=0,re=7,de=4;for(J===0&&(re=138,de=3),ie=0;ie<=le;ie++)if(O=J,J=G[2*(ie+1)+1],!(++Q<re&&O===J)){if(Q<de)for(;B(R,O,R.bl_tree),--Q!=0;);else O!==0?(O!==H&&(B(R,O,R.bl_tree),Q--),B(R,E,R.bl_tree),K(R,Q-3,2)):Q<=10?(B(R,_,R.bl_tree),K(R,Q-3,3)):(B(R,S,R.bl_tree),K(R,Q-11,7));H=O,de=(Q=0)===J?(re=138,3):O===J?(re=6,3):(re=7,4)}}p(ee);var te=!1;function P(R,G,le,ie){K(R,(d<<1)+(ie?1:0),3),function(O,H,J,Q){_e(O),Y(O,J),Y(O,~J),f.arraySet(O.pending_buf,O.window,H,J,O.pending),O.pending+=J}(R,G,le)}k._tr_init=function(R){te||(function(){var G,le,ie,O,H,J=new Array(e+1);for(O=ie=0;O<v-1;O++)for(j[O]=ie,G=0;G<1<<I[O];G++)w[ie++]=O;for(w[ie-1]=O,O=H=0;O<16;O++)for(ee[O]=H,G=0;G<1<<$[O];G++)V[H++]=O;for(H>>=7;O<s;O++)for(ee[O]=H<<7,G=0;G<1<<$[O]-7;G++)V[256+H++]=O;for(le=0;le<=e;le++)J[le]=0;for(G=0;G<=143;)q[2*G+1]=8,G++,J[8]++;for(;G<=255;)q[2*G+1]=9,G++,J[9]++;for(;G<=279;)q[2*G+1]=7,G++,J[7]++;for(;G<=287;)q[2*G+1]=8,G++,J[8]++;for(Ee(q,m+1,J),G=0;G<s;G++)F[2*G+1]=5,F[2*G]=ve(G,5);fe=new ce(q,I,C+1,m,e),Z=new ce(F,$,0,s,e),ne=new ce(new Array(0),W,0,h,c)}(),te=!0),R.l_desc=new N(R.dyn_ltree,fe),R.d_desc=new N(R.dyn_dtree,Z),R.bl_desc=new N(R.bl_tree,ne),R.bi_buf=0,R.bi_valid=0,ue(R)},k._tr_stored_block=P,k._tr_flush_block=function(R,G,le,ie){var O,H,J=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=function(Q){var re,de=4093624447;for(re=0;re<=31;re++,de>>>=1)if(1&de&&Q.dyn_ltree[2*re]!==0)return b;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return i;for(re=32;re<C;re++)if(Q.dyn_ltree[2*re]!==0)return i;return b}(R)),We(R,R.l_desc),We(R,R.d_desc),J=function(Q){var re;for(g(Q,Q.dyn_ltree,Q.l_desc.max_code),g(Q,Q.dyn_dtree,Q.d_desc.max_code),We(Q,Q.bl_desc),re=h-1;3<=re&&Q.bl_tree[2*T[re]+1]===0;re--);return Q.opt_len+=3*(re+1)+5+5+4,re}(R),O=R.opt_len+3+7>>>3,(H=R.static_len+3+7>>>3)<=O&&(O=H)):O=H=le+5,le+4<=O&&G!==-1?P(R,G,le,ie):R.strategy===4||H===O?(K(R,2+(ie?1:0),3),Ze(R,q,F)):(K(R,4+(ie?1:0),3),function(Q,re,de,pe){var ke;for(K(Q,re-257,5),K(Q,de-1,5),K(Q,pe-4,4),ke=0;ke<pe;ke++)K(Q,Q.bl_tree[2*T[ke]+1],3);ae(Q,Q.dyn_ltree,re-1),ae(Q,Q.dyn_dtree,de-1)}(R,R.l_desc.max_code+1,R.d_desc.max_code+1,J+1),Ze(R,R.dyn_ltree,R.dyn_dtree)),ue(R),ie&&_e(R)},k._tr_tally=function(R,G,le){return R.pending_buf[R.d_buf+2*R.last_lit]=G>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&G,R.pending_buf[R.l_buf+R.last_lit]=255&le,R.last_lit++,G===0?R.dyn_ltree[2*le]++:(R.matches++,G--,R.dyn_ltree[2*(w[le]+C+1)]++,R.dyn_dtree[2*z(G)]++),R.last_lit===R.lit_bufsize-1},k._tr_align=function(R){K(R,2,3),B(R,y,q),function(G){G.bi_valid===16?(Y(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.bi_valid-=8)}(R)}},{"../utils/common":41}],53:[function(r,l,k){l.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,l,k){(function(f){(function(b,i){if(!b.setImmediate){var p,d,v,C,m=1,s={},h=!1,n=b.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(b);e=e&&e.setTimeout?e:b,p={}.toString.call(b.process)==="[object process]"?function(E){process.nextTick(function(){c(E)})}:function(){if(b.postMessage&&!b.importScripts){var E=!0,_=b.onmessage;return b.onmessage=function(){E=!1},b.postMessage("","*"),b.onmessage=_,E}}()?(C="setImmediate$"+Math.random()+"$",b.addEventListener?b.addEventListener("message",y,!1):b.attachEvent("onmessage",y),function(E){b.postMessage(C+E,"*")}):b.MessageChannel?((v=new MessageChannel).port1.onmessage=function(E){c(E.data)},function(E){v.port2.postMessage(E)}):n&&"onreadystatechange"in n.createElement("script")?(d=n.documentElement,function(E){var _=n.createElement("script");_.onreadystatechange=function(){c(E),_.onreadystatechange=null,d.removeChild(_),_=null},d.appendChild(_)}):function(E){setTimeout(c,0,E)},e.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var _=new Array(arguments.length-1),S=0;S<_.length;S++)_[S]=arguments[S+1];var I={callback:E,args:_};return s[m]=I,p(m),m++},e.clearImmediate=o}function o(E){delete s[E]}function c(E){if(h)setTimeout(c,0,E);else{var _=s[E];if(_){h=!0;try{(function(S){var I=S.callback,$=S.args;switch($.length){case 0:I();break;case 1:I($[0]);break;case 2:I($[0],$[1]);break;case 3:I($[0],$[1],$[2]);break;default:I.apply(i,$)}})(_)}finally{o(E),h=!1}}}}function y(E){E.source===b&&typeof E.data=="string"&&E.data.indexOf(C)===0&&c(+E.data.slice(C.length))}})(typeof self>"u"?f===void 0?this:f:self)}).call(this,typeof Fe<"u"?Fe:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Un);var Yi=Un.exports;const Ki=Pn(Yi);var Mn={exports:{}},Er={exports:{}};const ji=Gi(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Wn;function Le(){return Wn||(Wn=1,function(x,X){(function(r,l){x.exports=l()})(Fe,function(){var r=r||function(l,k){var f;if(typeof window<"u"&&window.crypto&&(f=window.crypto),typeof self<"u"&&self.crypto&&(f=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(f=globalThis.crypto),!f&&typeof window<"u"&&window.msCrypto&&(f=window.msCrypto),!f&&typeof Fe<"u"&&Fe.crypto&&(f=Fe.crypto),!f&&typeof Pt=="function")try{f=ji}catch{}var b=function(){if(f){if(typeof f.getRandomValues=="function")try{return f.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof f.randomBytes=="function")try{return f.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function c(){}return function(y){var E;return c.prototype=y,E=new c,c.prototype=null,E}}(),p={},d=p.lib={},v=d.Base=function(){return{extend:function(c){var y=i(this);return c&&y.mixIn(c),(!y.hasOwnProperty("init")||this.init===y.init)&&(y.init=function(){y.$super.init.apply(this,arguments)}),y.init.prototype=y,y.$super=this,y},create:function(){var c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var y in c)c.hasOwnProperty(y)&&(this[y]=c[y]);c.hasOwnProperty("toString")&&(this.toString=c.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),C=d.WordArray=v.extend({init:function(c,y){c=this.words=c||[],y!=k?this.sigBytes=y:this.sigBytes=c.length*4},toString:function(c){return(c||s).stringify(this)},concat:function(c){var y=this.words,E=c.words,_=this.sigBytes,S=c.sigBytes;if(this.clamp(),_%4)for(var I=0;I<S;I++){var $=E[I>>>2]>>>24-I%4*8&255;y[_+I>>>2]|=$<<24-(_+I)%4*8}else for(var W=0;W<S;W+=4)y[_+W>>>2]=E[W>>>2];return this.sigBytes+=S,this},clamp:function(){var c=this.words,y=this.sigBytes;c[y>>>2]&=4294967295<<32-y%4*8,c.length=l.ceil(y/4)},clone:function(){var c=v.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var y=[],E=0;E<c;E+=4)y.push(b());return new C.init(y,c)}}),m=p.enc={},s=m.Hex={stringify:function(c){for(var y=c.words,E=c.sigBytes,_=[],S=0;S<E;S++){var I=y[S>>>2]>>>24-S%4*8&255;_.push((I>>>4).toString(16)),_.push((I&15).toString(16))}return _.join("")},parse:function(c){for(var y=c.length,E=[],_=0;_<y;_+=2)E[_>>>3]|=parseInt(c.substr(_,2),16)<<24-_%8*4;return new C.init(E,y/2)}},h=m.Latin1={stringify:function(c){for(var y=c.words,E=c.sigBytes,_=[],S=0;S<E;S++){var I=y[S>>>2]>>>24-S%4*8&255;_.push(String.fromCharCode(I))}return _.join("")},parse:function(c){for(var y=c.length,E=[],_=0;_<y;_++)E[_>>>2]|=(c.charCodeAt(_)&255)<<24-_%4*8;return new C.init(E,y)}},n=m.Utf8={stringify:function(c){try{return decodeURIComponent(escape(h.stringify(c)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(c){return h.parse(unescape(encodeURIComponent(c)))}},e=d.BufferedBlockAlgorithm=v.extend({reset:function(){this._data=new C.init,this._nDataBytes=0},_append:function(c){typeof c=="string"&&(c=n.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes},_process:function(c){var y,E=this._data,_=E.words,S=E.sigBytes,I=this.blockSize,$=I*4,W=S/$;c?W=l.ceil(W):W=l.max((W|0)-this._minBufferSize,0);var T=W*I,q=l.min(T*4,S);if(T){for(var F=0;F<T;F+=I)this._doProcessBlock(_,F);y=_.splice(0,T),E.sigBytes-=q}return new C.init(y,q)},clone:function(){var c=v.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});d.Hasher=e.extend({cfg:v.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset()},reset:function(){e.reset.call(this),this._doReset()},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var y=this._doFinalize();return y},blockSize:16,_createHelper:function(c){return function(y,E){return new c.init(E).finalize(y)}},_createHmacHelper:function(c){return function(y,E){return new o.HMAC.init(c,E).finalize(y)}}});var o=p.algo={};return p}(Math);return r})}(Er)),Er.exports}var kr={exports:{}},Vn;function Kt(){return Vn||(Vn=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(l){var k=r,f=k.lib,b=f.Base,i=f.WordArray,p=k.x64={};p.Word=b.extend({init:function(d,v){this.high=d,this.low=v}}),p.WordArray=b.extend({init:function(d,v){d=this.words=d||[],v!=l?this.sigBytes=v:this.sigBytes=d.length*8},toX32:function(){for(var d=this.words,v=d.length,C=[],m=0;m<v;m++){var s=d[m];C.push(s.high),C.push(s.low)}return i.create(C,this.sigBytes)},clone:function(){for(var d=b.clone.call(this),v=d.words=this.words.slice(0),C=v.length,m=0;m<C;m++)v[m]=v[m].clone();return d}})}(),r})}(kr)),kr.exports}var Cr={exports:{}},$n;function Ji(){return $n||($n=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(){if(typeof ArrayBuffer=="function"){var l=r,k=l.lib,f=k.WordArray,b=f.init,i=f.init=function(p){if(p instanceof ArrayBuffer&&(p=new Uint8Array(p)),(p instanceof Int8Array||typeof Uint8ClampedArray<"u"&&p instanceof Uint8ClampedArray||p instanceof Int16Array||p instanceof Uint16Array||p instanceof Int32Array||p instanceof Uint32Array||p instanceof Float32Array||p instanceof Float64Array)&&(p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength)),p instanceof Uint8Array){for(var d=p.byteLength,v=[],C=0;C<d;C++)v[C>>>2]|=p[C]<<24-C%4*8;b.call(this,v,d)}else b.apply(this,arguments)};i.prototype=f}}(),r.lib.WordArray})}(Cr)),Cr.exports}var Br={exports:{}},Hn;function Qi(){return Hn||(Hn=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.WordArray,b=l.enc;b.Utf16=b.Utf16BE={stringify:function(p){for(var d=p.words,v=p.sigBytes,C=[],m=0;m<v;m+=2){var s=d[m>>>2]>>>16-m%4*8&65535;C.push(String.fromCharCode(s))}return C.join("")},parse:function(p){for(var d=p.length,v=[],C=0;C<d;C++)v[C>>>1]|=p.charCodeAt(C)<<16-C%2*16;return f.create(v,d*2)}},b.Utf16LE={stringify:function(p){for(var d=p.words,v=p.sigBytes,C=[],m=0;m<v;m+=2){var s=i(d[m>>>2]>>>16-m%4*8&65535);C.push(String.fromCharCode(s))}return C.join("")},parse:function(p){for(var d=p.length,v=[],C=0;C<d;C++)v[C>>>1]|=i(p.charCodeAt(C)<<16-C%2*16);return f.create(v,d*2)}};function i(p){return p<<8&4278255360|p>>>8&16711935}}(),r.enc.Utf16})}(Br)),Br.exports}var _r={exports:{}},qn;function bt(){return qn||(qn=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.WordArray,b=l.enc;b.Base64={stringify:function(p){var d=p.words,v=p.sigBytes,C=this._map;p.clamp();for(var m=[],s=0;s<v;s+=3)for(var h=d[s>>>2]>>>24-s%4*8&255,n=d[s+1>>>2]>>>24-(s+1)%4*8&255,e=d[s+2>>>2]>>>24-(s+2)%4*8&255,o=h<<16|n<<8|e,c=0;c<4&&s+c*.75<v;c++)m.push(C.charAt(o>>>6*(3-c)&63));var y=C.charAt(64);if(y)for(;m.length%4;)m.push(y);return m.join("")},parse:function(p){var d=p.length,v=this._map,C=this._reverseMap;if(!C){C=this._reverseMap=[];for(var m=0;m<v.length;m++)C[v.charCodeAt(m)]=m}var s=v.charAt(64);if(s){var h=p.indexOf(s);h!==-1&&(d=h)}return i(p,d,C)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function i(p,d,v){for(var C=[],m=0,s=0;s<d;s++)if(s%4){var h=v[p.charCodeAt(s-1)]<<s%4*2,n=v[p.charCodeAt(s)]>>>6-s%4*2,e=h|n;C[m>>>2]|=e<<24-m%4*8,m++}return f.create(C,m)}}(),r.enc.Base64})}(_r)),_r.exports}var Ar={exports:{}},Xn;function e0(){return Xn||(Xn=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.WordArray,b=l.enc;b.Base64url={stringify:function(p,d){d===void 0&&(d=!0);var v=p.words,C=p.sigBytes,m=d?this._safe_map:this._map;p.clamp();for(var s=[],h=0;h<C;h+=3)for(var n=v[h>>>2]>>>24-h%4*8&255,e=v[h+1>>>2]>>>24-(h+1)%4*8&255,o=v[h+2>>>2]>>>24-(h+2)%4*8&255,c=n<<16|e<<8|o,y=0;y<4&&h+y*.75<C;y++)s.push(m.charAt(c>>>6*(3-y)&63));var E=m.charAt(64);if(E)for(;s.length%4;)s.push(E);return s.join("")},parse:function(p,d){d===void 0&&(d=!0);var v=p.length,C=d?this._safe_map:this._map,m=this._reverseMap;if(!m){m=this._reverseMap=[];for(var s=0;s<C.length;s++)m[C.charCodeAt(s)]=s}var h=C.charAt(64);if(h){var n=p.indexOf(h);n!==-1&&(v=n)}return i(p,v,m)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function i(p,d,v){for(var C=[],m=0,s=0;s<d;s++)if(s%4){var h=v[p.charCodeAt(s-1)]<<s%4*2,n=v[p.charCodeAt(s)]>>>6-s%4*2,e=h|n;C[m>>>2]|=e<<24-m%4*8,m++}return f.create(C,m)}}(),r.enc.Base64url})}(Ar)),Ar.exports}var Dr={exports:{}},Zn;function Et(){return Zn||(Zn=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(l){var k=r,f=k.lib,b=f.WordArray,i=f.Hasher,p=k.algo,d=[];(function(){for(var n=0;n<64;n++)d[n]=l.abs(l.sin(n+1))*4294967296|0})();var v=p.MD5=i.extend({_doReset:function(){this._hash=new b.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(n,e){for(var o=0;o<16;o++){var c=e+o,y=n[c];n[c]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360}var E=this._hash.words,_=n[e+0],S=n[e+1],I=n[e+2],$=n[e+3],W=n[e+4],T=n[e+5],q=n[e+6],F=n[e+7],V=n[e+8],w=n[e+9],j=n[e+10],fe=n[e+11],Z=n[e+12],ne=n[e+13],ee=n[e+14],ce=n[e+15],N=E[0],z=E[1],Y=E[2],K=E[3];N=C(N,z,Y,K,_,7,d[0]),K=C(K,N,z,Y,S,12,d[1]),Y=C(Y,K,N,z,I,17,d[2]),z=C(z,Y,K,N,$,22,d[3]),N=C(N,z,Y,K,W,7,d[4]),K=C(K,N,z,Y,T,12,d[5]),Y=C(Y,K,N,z,q,17,d[6]),z=C(z,Y,K,N,F,22,d[7]),N=C(N,z,Y,K,V,7,d[8]),K=C(K,N,z,Y,w,12,d[9]),Y=C(Y,K,N,z,j,17,d[10]),z=C(z,Y,K,N,fe,22,d[11]),N=C(N,z,Y,K,Z,7,d[12]),K=C(K,N,z,Y,ne,12,d[13]),Y=C(Y,K,N,z,ee,17,d[14]),z=C(z,Y,K,N,ce,22,d[15]),N=m(N,z,Y,K,S,5,d[16]),K=m(K,N,z,Y,q,9,d[17]),Y=m(Y,K,N,z,fe,14,d[18]),z=m(z,Y,K,N,_,20,d[19]),N=m(N,z,Y,K,T,5,d[20]),K=m(K,N,z,Y,j,9,d[21]),Y=m(Y,K,N,z,ce,14,d[22]),z=m(z,Y,K,N,W,20,d[23]),N=m(N,z,Y,K,w,5,d[24]),K=m(K,N,z,Y,ee,9,d[25]),Y=m(Y,K,N,z,$,14,d[26]),z=m(z,Y,K,N,V,20,d[27]),N=m(N,z,Y,K,ne,5,d[28]),K=m(K,N,z,Y,I,9,d[29]),Y=m(Y,K,N,z,F,14,d[30]),z=m(z,Y,K,N,Z,20,d[31]),N=s(N,z,Y,K,T,4,d[32]),K=s(K,N,z,Y,V,11,d[33]),Y=s(Y,K,N,z,fe,16,d[34]),z=s(z,Y,K,N,ee,23,d[35]),N=s(N,z,Y,K,S,4,d[36]),K=s(K,N,z,Y,W,11,d[37]),Y=s(Y,K,N,z,F,16,d[38]),z=s(z,Y,K,N,j,23,d[39]),N=s(N,z,Y,K,ne,4,d[40]),K=s(K,N,z,Y,_,11,d[41]),Y=s(Y,K,N,z,$,16,d[42]),z=s(z,Y,K,N,q,23,d[43]),N=s(N,z,Y,K,w,4,d[44]),K=s(K,N,z,Y,Z,11,d[45]),Y=s(Y,K,N,z,ce,16,d[46]),z=s(z,Y,K,N,I,23,d[47]),N=h(N,z,Y,K,_,6,d[48]),K=h(K,N,z,Y,F,10,d[49]),Y=h(Y,K,N,z,ee,15,d[50]),z=h(z,Y,K,N,T,21,d[51]),N=h(N,z,Y,K,Z,6,d[52]),K=h(K,N,z,Y,$,10,d[53]),Y=h(Y,K,N,z,j,15,d[54]),z=h(z,Y,K,N,S,21,d[55]),N=h(N,z,Y,K,V,6,d[56]),K=h(K,N,z,Y,ce,10,d[57]),Y=h(Y,K,N,z,q,15,d[58]),z=h(z,Y,K,N,ne,21,d[59]),N=h(N,z,Y,K,W,6,d[60]),K=h(K,N,z,Y,fe,10,d[61]),Y=h(Y,K,N,z,I,15,d[62]),z=h(z,Y,K,N,w,21,d[63]),E[0]=E[0]+N|0,E[1]=E[1]+z|0,E[2]=E[2]+Y|0,E[3]=E[3]+K|0},_doFinalize:function(){var n=this._data,e=n.words,o=this._nDataBytes*8,c=n.sigBytes*8;e[c>>>5]|=128<<24-c%32;var y=l.floor(o/4294967296),E=o;e[(c+64>>>9<<4)+15]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,e[(c+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,n.sigBytes=(e.length+1)*4,this._process();for(var _=this._hash,S=_.words,I=0;I<4;I++){var $=S[I];S[I]=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360}return _},clone:function(){var n=i.clone.call(this);return n._hash=this._hash.clone(),n}});function C(n,e,o,c,y,E,_){var S=n+(e&o|~e&c)+y+_;return(S<<E|S>>>32-E)+e}function m(n,e,o,c,y,E,_){var S=n+(e&c|o&~c)+y+_;return(S<<E|S>>>32-E)+e}function s(n,e,o,c,y,E,_){var S=n+(e^o^c)+y+_;return(S<<E|S>>>32-E)+e}function h(n,e,o,c,y,E,_){var S=n+(o^(e|~c))+y+_;return(S<<E|S>>>32-E)+e}k.MD5=i._createHelper(v),k.HmacMD5=i._createHmacHelper(v)}(Math),r.MD5})}(Dr)),Dr.exports}var Fr={exports:{}},Gn;function Yn(){return Gn||(Gn=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.WordArray,b=k.Hasher,i=l.algo,p=[],d=i.SHA1=b.extend({_doReset:function(){this._hash=new f.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(v,C){for(var m=this._hash.words,s=m[0],h=m[1],n=m[2],e=m[3],o=m[4],c=0;c<80;c++){if(c<16)p[c]=v[C+c]|0;else{var y=p[c-3]^p[c-8]^p[c-14]^p[c-16];p[c]=y<<1|y>>>31}var E=(s<<5|s>>>27)+o+p[c];c<20?E+=(h&n|~h&e)+1518500249:c<40?E+=(h^n^e)+1859775393:c<60?E+=(h&n|h&e|n&e)-1894007588:E+=(h^n^e)-899497514,o=e,e=n,n=h<<30|h>>>2,h=s,s=E}m[0]=m[0]+s|0,m[1]=m[1]+h|0,m[2]=m[2]+n|0,m[3]=m[3]+e|0,m[4]=m[4]+o|0},_doFinalize:function(){var v=this._data,C=v.words,m=this._nDataBytes*8,s=v.sigBytes*8;return C[s>>>5]|=128<<24-s%32,C[(s+64>>>9<<4)+14]=Math.floor(m/4294967296),C[(s+64>>>9<<4)+15]=m,v.sigBytes=C.length*4,this._process(),this._hash},clone:function(){var v=b.clone.call(this);return v._hash=this._hash.clone(),v}});l.SHA1=b._createHelper(d),l.HmacSHA1=b._createHmacHelper(d)}(),r.SHA1})}(Fr)),Fr.exports}var Sr={exports:{}},Kn;function Nr(){return Kn||(Kn=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){return function(l){var k=r,f=k.lib,b=f.WordArray,i=f.Hasher,p=k.algo,d=[],v=[];(function(){function s(o){for(var c=l.sqrt(o),y=2;y<=c;y++)if(!(o%y))return!1;return!0}function h(o){return(o-(o|0))*4294967296|0}for(var n=2,e=0;e<64;)s(n)&&(e<8&&(d[e]=h(l.pow(n,1/2))),v[e]=h(l.pow(n,1/3)),e++),n++})();var C=[],m=p.SHA256=i.extend({_doReset:function(){this._hash=new b.init(d.slice(0))},_doProcessBlock:function(s,h){for(var n=this._hash.words,e=n[0],o=n[1],c=n[2],y=n[3],E=n[4],_=n[5],S=n[6],I=n[7],$=0;$<64;$++){if($<16)C[$]=s[h+$]|0;else{var W=C[$-15],T=(W<<25|W>>>7)^(W<<14|W>>>18)^W>>>3,q=C[$-2],F=(q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10;C[$]=T+C[$-7]+F+C[$-16]}var V=E&_^~E&S,w=e&o^e&c^o&c,j=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),fe=(E<<26|E>>>6)^(E<<21|E>>>11)^(E<<7|E>>>25),Z=I+fe+V+v[$]+C[$],ne=j+w;I=S,S=_,_=E,E=y+Z|0,y=c,c=o,o=e,e=Z+ne|0}n[0]=n[0]+e|0,n[1]=n[1]+o|0,n[2]=n[2]+c|0,n[3]=n[3]+y|0,n[4]=n[4]+E|0,n[5]=n[5]+_|0,n[6]=n[6]+S|0,n[7]=n[7]+I|0},_doFinalize:function(){var s=this._data,h=s.words,n=this._nDataBytes*8,e=s.sigBytes*8;return h[e>>>5]|=128<<24-e%32,h[(e+64>>>9<<4)+14]=l.floor(n/4294967296),h[(e+64>>>9<<4)+15]=n,s.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var s=i.clone.call(this);return s._hash=this._hash.clone(),s}});k.SHA256=i._createHelper(m),k.HmacSHA256=i._createHmacHelper(m)}(Math),r.SHA256})}(Sr)),Sr.exports}var Ir={exports:{}},jn;function t0(){return jn||(jn=1,function(x,X){(function(r,l,k){x.exports=l(Le(),Nr())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.WordArray,b=l.algo,i=b.SHA256,p=b.SHA224=i.extend({_doReset:function(){this._hash=new f.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var d=i._doFinalize.call(this);return d.sigBytes-=4,d}});l.SHA224=i._createHelper(p),l.HmacSHA224=i._createHmacHelper(p)}(),r.SHA224})}(Ir)),Ir.exports}var Rr={exports:{}},Jn;function Qn(){return Jn||(Jn=1,function(x,X){(function(r,l,k){x.exports=l(Le(),Kt())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.Hasher,b=l.x64,i=b.Word,p=b.WordArray,d=l.algo;function v(){return i.create.apply(i,arguments)}var C=[v(1116352408,3609767458),v(1899447441,602891725),v(3049323471,3964484399),v(3921009573,2173295548),v(961987163,4081628472),v(1508970993,3053834265),v(2453635748,2937671579),v(2870763221,3664609560),v(3624381080,2734883394),v(310598401,1164996542),v(607225278,1323610764),v(1426881987,3590304994),v(1925078388,4068182383),v(2162078206,991336113),v(2614888103,633803317),v(3248222580,3479774868),v(3835390401,2666613458),v(4022224774,944711139),v(264347078,2341262773),v(604807628,2007800933),v(770255983,1495990901),v(1249150122,1856431235),v(1555081692,3175218132),v(1996064986,2198950837),v(2554220882,3999719339),v(2821834349,766784016),v(2952996808,2566594879),v(3210313671,3203337956),v(3336571891,1034457026),v(3584528711,2466948901),v(113926993,3758326383),v(338241895,168717936),v(666307205,1188179964),v(773529912,1546045734),v(1294757372,1522805485),v(1396182291,2643833823),v(1695183700,2343527390),v(1986661051,1014477480),v(2177026350,1206759142),v(2456956037,344077627),v(2730485921,1290863460),v(2820302411,3158454273),v(3259730800,3505952657),v(3345764771,106217008),v(3516065817,3606008344),v(3600352804,1432725776),v(4094571909,1467031594),v(275423344,851169720),v(430227734,3100823752),v(506948616,1363258195),v(659060556,3750685593),v(883997877,3785050280),v(958139571,3318307427),v(1322822218,3812723403),v(1537002063,2003034995),v(1747873779,3602036899),v(1955562222,1575990012),v(2024104815,1125592928),v(2227730452,2716904306),v(2361852424,442776044),v(2428436474,593698344),v(2756734187,3733110249),v(3204031479,2999351573),v(3329325298,3815920427),v(3391569614,3928383900),v(3515267271,566280711),v(3940187606,3454069534),v(4118630271,4000239992),v(116418474,1914138554),v(174292421,2731055270),v(289380356,3203993006),v(460393269,320620315),v(685471733,587496836),v(852142971,1086792851),v(1017036298,365543100),v(1126000580,2618297676),v(1288033470,3409855158),v(1501505948,4234509866),v(1607167915,987167468),v(1816402316,1246189591)],m=[];(function(){for(var h=0;h<80;h++)m[h]=v()})();var s=d.SHA512=f.extend({_doReset:function(){this._hash=new p.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(h,n){for(var e=this._hash.words,o=e[0],c=e[1],y=e[2],E=e[3],_=e[4],S=e[5],I=e[6],$=e[7],W=o.high,T=o.low,q=c.high,F=c.low,V=y.high,w=y.low,j=E.high,fe=E.low,Z=_.high,ne=_.low,ee=S.high,ce=S.low,N=I.high,z=I.low,Y=$.high,K=$.low,B=W,ve=T,Ee=q,ue=F,_e=V,Me=w,Se=j,Ze=fe,We=Z,g=ne,ae=ee,te=ce,P=N,R=z,G=Y,le=K,ie=0;ie<80;ie++){var O,H,J=m[ie];if(ie<16)H=J.high=h[n+ie*2]|0,O=J.low=h[n+ie*2+1]|0;else{var Q=m[ie-15],re=Q.high,de=Q.low,pe=(re>>>1|de<<31)^(re>>>8|de<<24)^re>>>7,ke=(de>>>1|re<<31)^(de>>>8|re<<24)^(de>>>7|re<<25),ge=m[ie-2],he=ge.high,xe=ge.low,we=(he>>>19|xe<<13)^(he<<3|xe>>>29)^he>>>6,Be=(xe>>>19|he<<13)^(xe<<3|he>>>29)^(xe>>>6|he<<26),Ne=m[ie-7],Ue=Ne.high,st=Ne.low,at=m[ie-16],vt=at.high,Qe=at.low;O=ke+st,H=pe+Ue+(O>>>0<ke>>>0?1:0),O=O+Be,H=H+we+(O>>>0<Be>>>0?1:0),O=O+Qe,H=H+vt+(O>>>0<Qe>>>0?1:0),J.high=H,J.low=O}var Ge=We&ae^~We&P,He=g&te^~g&R,qe=B&Ee^B&_e^Ee&_e,lt=ve&ue^ve&Me^ue&Me,pt=(B>>>28|ve<<4)^(B<<30|ve>>>2)^(B<<25|ve>>>7),Ut=(ve>>>28|B<<4)^(ve<<30|B>>>2)^(ve<<25|B>>>7),sn=(We>>>14|g<<18)^(We>>>18|g<<14)^(We<<23|g>>>9),ln=(g>>>14|We<<18)^(g>>>18|We<<14)^(g<<23|We>>>9),Dt=C[ie],cn=Dt.high,Ft=Dt.low,Je=le+ln,ct=G+sn+(Je>>>0<le>>>0?1:0),Je=Je+He,ct=ct+Ge+(Je>>>0<He>>>0?1:0),Je=Je+Ft,ct=ct+cn+(Je>>>0<Ft>>>0?1:0),Je=Je+O,ct=ct+H+(Je>>>0<O>>>0?1:0),Jt=Ut+lt,dn=pt+qe+(Jt>>>0<Ut>>>0?1:0);G=P,le=R,P=ae,R=te,ae=We,te=g,g=Ze+Je|0,We=Se+ct+(g>>>0<Ze>>>0?1:0)|0,Se=_e,Ze=Me,_e=Ee,Me=ue,Ee=B,ue=ve,ve=Je+Jt|0,B=ct+dn+(ve>>>0<Je>>>0?1:0)|0}T=o.low=T+ve,o.high=W+B+(T>>>0<ve>>>0?1:0),F=c.low=F+ue,c.high=q+Ee+(F>>>0<ue>>>0?1:0),w=y.low=w+Me,y.high=V+_e+(w>>>0<Me>>>0?1:0),fe=E.low=fe+Ze,E.high=j+Se+(fe>>>0<Ze>>>0?1:0),ne=_.low=ne+g,_.high=Z+We+(ne>>>0<g>>>0?1:0),ce=S.low=ce+te,S.high=ee+ae+(ce>>>0<te>>>0?1:0),z=I.low=z+R,I.high=N+P+(z>>>0<R>>>0?1:0),K=$.low=K+le,$.high=Y+G+(K>>>0<le>>>0?1:0)},_doFinalize:function(){var h=this._data,n=h.words,e=this._nDataBytes*8,o=h.sigBytes*8;n[o>>>5]|=128<<24-o%32,n[(o+128>>>10<<5)+30]=Math.floor(e/4294967296),n[(o+128>>>10<<5)+31]=e,h.sigBytes=n.length*4,this._process();var c=this._hash.toX32();return c},clone:function(){var h=f.clone.call(this);return h._hash=this._hash.clone(),h},blockSize:1024/32});l.SHA512=f._createHelper(s),l.HmacSHA512=f._createHmacHelper(s)}(),r.SHA512})}(Rr)),Rr.exports}var zr={exports:{}},ea;function r0(){return ea||(ea=1,function(x,X){(function(r,l,k){x.exports=l(Le(),Kt(),Qn())})(Fe,function(r){return function(){var l=r,k=l.x64,f=k.Word,b=k.WordArray,i=l.algo,p=i.SHA512,d=i.SHA384=p.extend({_doReset:function(){this._hash=new b.init([new f.init(3418070365,3238371032),new f.init(1654270250,914150663),new f.init(2438529370,812702999),new f.init(355462360,4144912697),new f.init(1731405415,4290775857),new f.init(2394180231,1750603025),new f.init(3675008525,1694076839),new f.init(1203062813,3204075428)])},_doFinalize:function(){var v=p._doFinalize.call(this);return v.sigBytes-=16,v}});l.SHA384=p._createHelper(d),l.HmacSHA384=p._createHmacHelper(d)}(),r.SHA384})}(zr)),zr.exports}var Tr={exports:{}},ta;function n0(){return ta||(ta=1,function(x,X){(function(r,l,k){x.exports=l(Le(),Kt())})(Fe,function(r){return function(l){var k=r,f=k.lib,b=f.WordArray,i=f.Hasher,p=k.x64,d=p.Word,v=k.algo,C=[],m=[],s=[];(function(){for(var e=1,o=0,c=0;c<24;c++){C[e+5*o]=(c+1)*(c+2)/2%64;var y=o%5,E=(2*e+3*o)%5;e=y,o=E}for(var e=0;e<5;e++)for(var o=0;o<5;o++)m[e+5*o]=o+(2*e+3*o)%5*5;for(var _=1,S=0;S<24;S++){for(var I=0,$=0,W=0;W<7;W++){if(_&1){var T=(1<<W)-1;T<32?$^=1<<T:I^=1<<T-32}_&128?_=_<<1^113:_<<=1}s[S]=d.create(I,$)}})();var h=[];(function(){for(var e=0;e<25;e++)h[e]=d.create()})();var n=v.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],o=0;o<25;o++)e[o]=new d.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,o){for(var c=this._state,y=this.blockSize/2,E=0;E<y;E++){var _=e[o+2*E],S=e[o+2*E+1];_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360;var I=c[E];I.high^=S,I.low^=_}for(var $=0;$<24;$++){for(var W=0;W<5;W++){for(var T=0,q=0,F=0;F<5;F++){var I=c[W+5*F];T^=I.high,q^=I.low}var V=h[W];V.high=T,V.low=q}for(var W=0;W<5;W++)for(var w=h[(W+4)%5],j=h[(W+1)%5],fe=j.high,Z=j.low,T=w.high^(fe<<1|Z>>>31),q=w.low^(Z<<1|fe>>>31),F=0;F<5;F++){var I=c[W+5*F];I.high^=T,I.low^=q}for(var ne=1;ne<25;ne++){var T,q,I=c[ne],ee=I.high,ce=I.low,N=C[ne];N<32?(T=ee<<N|ce>>>32-N,q=ce<<N|ee>>>32-N):(T=ce<<N-32|ee>>>64-N,q=ee<<N-32|ce>>>64-N);var z=h[m[ne]];z.high=T,z.low=q}var Y=h[0],K=c[0];Y.high=K.high,Y.low=K.low;for(var W=0;W<5;W++)for(var F=0;F<5;F++){var ne=W+5*F,I=c[ne],B=h[ne],ve=h[(W+1)%5+5*F],Ee=h[(W+2)%5+5*F];I.high=B.high^~ve.high&Ee.high,I.low=B.low^~ve.low&Ee.low}var I=c[0],ue=s[$];I.high^=ue.high,I.low^=ue.low}},_doFinalize:function(){var e=this._data,o=e.words;this._nDataBytes*8;var c=e.sigBytes*8,y=this.blockSize*32;o[c>>>5]|=1<<24-c%32,o[(l.ceil((c+1)/y)*y>>>5)-1]|=128,e.sigBytes=o.length*4,this._process();for(var E=this._state,_=this.cfg.outputLength/8,S=_/8,I=[],$=0;$<S;$++){var W=E[$],T=W.high,q=W.low;T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,q=(q<<8|q>>>24)&16711935|(q<<24|q>>>8)&4278255360,I.push(q),I.push(T)}return new b.init(I,_)},clone:function(){for(var e=i.clone.call(this),o=e._state=this._state.slice(0),c=0;c<25;c++)o[c]=o[c].clone();return e}});k.SHA3=i._createHelper(n),k.HmacSHA3=i._createHmacHelper(n)}(Math),r.SHA3})}(Tr)),Tr.exports}var Or={exports:{}},ra;function a0(){return ra||(ra=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){/** @preserve
|
|
13
13
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
14
14
|
|
|
15
15
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
19
19
|
|
|
20
20
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
21
|
-
*/return function(l){var E=r,f=E.lib,b=f.WordArray,i=f.Hasher,p=E.algo,d=b.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),v=b.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),C=b.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),m=b.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),s=b.create([0,1518500249,1859775393,2400959708,2840853838]),h=b.create([1352829926,1548603684,1836072691,2053994217,0]),n=p.RIPEMD160=i.extend({_doReset:function(){this._hash=b.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(S,I){for(var H=0;H<16;H++){var V=I+H,T=S[V];S[V]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var q=this._hash.words,F=s.words,W=h.words,w=d.words,j=v.words,he=C.words,Z=m.words,re,ee,ce,N,z,Y,K,B,ye,Ce;Y=re=q[0],K=ee=q[1],B=ce=q[2],ye=N=q[3],Ce=z=q[4];for(var ue,H=0;H<80;H+=1)ue=re+S[I+w[H]]|0,H<16?ue+=e(ee,ce,N)+F[0]:H<32?ue+=o(ee,ce,N)+F[1]:H<48?ue+=c(ee,ce,N)+F[2]:H<64?ue+=y(ee,ce,N)+F[3]:ue+=k(ee,ce,N)+F[4],ue=ue|0,ue=_(ue,he[H]),ue=ue+z|0,re=z,z=N,N=_(ce,10),ce=ee,ee=ue,ue=Y+S[I+j[H]]|0,H<16?ue+=k(K,B,ye)+W[0]:H<32?ue+=y(K,B,ye)+W[1]:H<48?ue+=c(K,B,ye)+W[2]:H<64?ue+=o(K,B,ye)+W[3]:ue+=e(K,B,ye)+W[4],ue=ue|0,ue=_(ue,Z[H]),ue=ue+Ce|0,Y=Ce,Ce=ye,ye=_(B,10),B=K,K=ue;ue=q[1]+ce+ye|0,q[1]=q[2]+N+Ce|0,q[2]=q[3]+z+Y|0,q[3]=q[4]+re+K|0,q[4]=q[0]+ee+B|0,q[0]=ue},_doFinalize:function(){var S=this._data,I=S.words,H=this._nDataBytes*8,V=S.sigBytes*8;I[V>>>5]|=128<<24-V%32,I[(V+64>>>9<<4)+14]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360,S.sigBytes=(I.length+1)*4,this._process();for(var T=this._hash,q=T.words,F=0;F<5;F++){var W=q[F];q[F]=(W<<8|W>>>24)&16711935|(W<<24|W>>>8)&4278255360}return T},clone:function(){var S=i.clone.call(this);return S._hash=this._hash.clone(),S}});function e(S,I,H){return S^I^H}function o(S,I,H){return S&I|~S&H}function c(S,I,H){return(S|~I)^H}function y(S,I,H){return S&H|I&~H}function k(S,I,H){return S^(I|~H)}function _(S,I){return S<<I|S>>>32-I}E.RIPEMD160=i._createHelper(n),E.HmacRIPEMD160=i._createHmacHelper(n)}(),r.RIPEMD160})}(Lr)),Lr.exports}var Pr={exports:{}},na;function Ur(){return na||(na=1,function(x,X){(function(r,l){x.exports=l(Oe())})(De,function(r){(function(){var l=r,E=l.lib,f=E.Base,b=l.enc,i=b.Utf8,p=l.algo;p.HMAC=f.extend({init:function(d,v){d=this._hasher=new d.init,typeof v=="string"&&(v=i.parse(v));var C=d.blockSize,m=C*4;v.sigBytes>m&&(v=d.finalize(v)),v.clamp();for(var s=this._oKey=v.clone(),h=this._iKey=v.clone(),n=s.words,e=h.words,o=0;o<C;o++)n[o]^=1549556828,e[o]^=909522486;s.sigBytes=h.sigBytes=m,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var v=this._hasher,C=v.finalize(d);v.reset();var m=v.finalize(this._oKey.clone().concat(C));return m}})})()})}(Pr)),Pr.exports}var Mr={exports:{}},aa;function o0(){return aa||(aa=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),Ir(),Ur())})(De,function(r){return function(){var l=r,E=l.lib,f=E.Base,b=E.WordArray,i=l.algo,p=i.SHA256,d=i.HMAC,v=i.PBKDF2=f.extend({cfg:f.extend({keySize:128/32,hasher:p,iterations:25e4}),init:function(C){this.cfg=this.cfg.extend(C)},compute:function(C,m){for(var s=this.cfg,h=d.create(s.hasher,C),n=b.create(),e=b.create([1]),o=n.words,c=e.words,y=s.keySize,k=s.iterations;o.length<y;){var _=h.update(m).finalize(e);h.reset();for(var S=_.words,I=S.length,H=_,V=1;V<k;V++){H=h.finalize(H),h.reset();for(var T=H.words,q=0;q<I;q++)S[q]^=T[q]}n.concat(_),c[0]++}return n.sigBytes=y*4,n}});l.PBKDF2=function(C,m,s){return v.create(s).compute(C,m)}}(),r.PBKDF2})}(Mr)),Mr.exports}var Vr={exports:{}},oa;function xt(){return oa||(oa=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),Yn(),Ur())})(De,function(r){return function(){var l=r,E=l.lib,f=E.Base,b=E.WordArray,i=l.algo,p=i.MD5,d=i.EvpKDF=f.extend({cfg:f.extend({keySize:128/32,hasher:p,iterations:1}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,C){for(var m,s=this.cfg,h=s.hasher.create(),n=b.create(),e=n.words,o=s.keySize,c=s.iterations;e.length<o;){m&&h.update(m),m=h.update(v).finalize(C),h.reset();for(var y=1;y<c;y++)m=h.finalize(m),h.reset();n.concat(m)}return n.sigBytes=o*4,n}});l.EvpKDF=function(v,C,m){return d.create(m).compute(v,C)}}(),r.EvpKDF})}(Vr)),Vr.exports}var Wr={exports:{}},ia;function je(){return ia||(ia=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),xt())})(De,function(r){r.lib.Cipher||function(l){var E=r,f=E.lib,b=f.Base,i=f.WordArray,p=f.BufferedBlockAlgorithm,d=E.enc;d.Utf8;var v=d.Base64,C=E.algo,m=C.EvpKDF,s=f.Cipher=p.extend({cfg:b.extend(),createEncryptor:function(T,q){return this.create(this._ENC_XFORM_MODE,T,q)},createDecryptor:function(T,q){return this.create(this._DEC_XFORM_MODE,T,q)},init:function(T,q,F){this.cfg=this.cfg.extend(F),this._xformMode=T,this._key=q,this.reset()},reset:function(){p.reset.call(this),this._doReset()},process:function(T){return this._append(T),this._process()},finalize:function(T){T&&this._append(T);var q=this._doFinalize();return q},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function T(q){return typeof q=="string"?V:S}return function(q){return{encrypt:function(F,W,w){return T(W).encrypt(q,F,W,w)},decrypt:function(F,W,w){return T(W).decrypt(q,F,W,w)}}}}()});f.StreamCipher=s.extend({_doFinalize:function(){var T=this._process(!0);return T},blockSize:1});var h=E.mode={},n=f.BlockCipherMode=b.extend({createEncryptor:function(T,q){return this.Encryptor.create(T,q)},createDecryptor:function(T,q){return this.Decryptor.create(T,q)},init:function(T,q){this._cipher=T,this._iv=q}}),e=h.CBC=function(){var T=n.extend();T.Encryptor=T.extend({processBlock:function(F,W){var w=this._cipher,j=w.blockSize;q.call(this,F,W,j),w.encryptBlock(F,W),this._prevBlock=F.slice(W,W+j)}}),T.Decryptor=T.extend({processBlock:function(F,W){var w=this._cipher,j=w.blockSize,he=F.slice(W,W+j);w.decryptBlock(F,W),q.call(this,F,W,j),this._prevBlock=he}});function q(F,W,w){var j,he=this._iv;he?(j=he,this._iv=l):j=this._prevBlock;for(var Z=0;Z<w;Z++)F[W+Z]^=j[Z]}return T}(),o=E.pad={},c=o.Pkcs7={pad:function(T,q){for(var F=q*4,W=F-T.sigBytes%F,w=W<<24|W<<16|W<<8|W,j=[],he=0;he<W;he+=4)j.push(w);var Z=i.create(j,W);T.concat(Z)},unpad:function(T){var q=T.words[T.sigBytes-1>>>2]&255;T.sigBytes-=q}};f.BlockCipher=s.extend({cfg:s.cfg.extend({mode:e,padding:c}),reset:function(){var T;s.reset.call(this);var q=this.cfg,F=q.iv,W=q.mode;this._xformMode==this._ENC_XFORM_MODE?T=W.createEncryptor:(T=W.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==T?this._mode.init(this,F&&F.words):(this._mode=T.call(W,this,F&&F.words),this._mode.__creator=T)},_doProcessBlock:function(T,q){this._mode.processBlock(T,q)},_doFinalize:function(){var T,q=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(q.pad(this._data,this.blockSize),T=this._process(!0)):(T=this._process(!0),q.unpad(T)),T},blockSize:128/32});var y=f.CipherParams=b.extend({init:function(T){this.mixIn(T)},toString:function(T){return(T||this.formatter).stringify(this)}}),k=E.format={},_=k.OpenSSL={stringify:function(T){var q,F=T.ciphertext,W=T.salt;return W?q=i.create([1398893684,1701076831]).concat(W).concat(F):q=F,q.toString(v)},parse:function(T){var q,F=v.parse(T),W=F.words;return W[0]==1398893684&&W[1]==1701076831&&(q=i.create(W.slice(2,4)),W.splice(0,4),F.sigBytes-=16),y.create({ciphertext:F,salt:q})}},S=f.SerializableCipher=b.extend({cfg:b.extend({format:_}),encrypt:function(T,q,F,W){W=this.cfg.extend(W);var w=T.createEncryptor(F,W),j=w.finalize(q),he=w.cfg;return y.create({ciphertext:j,key:F,iv:he.iv,algorithm:T,mode:he.mode,padding:he.padding,blockSize:T.blockSize,formatter:W.format})},decrypt:function(T,q,F,W){W=this.cfg.extend(W),q=this._parse(q,W.format);var w=T.createDecryptor(F,W).finalize(q.ciphertext);return w},_parse:function(T,q){return typeof T=="string"?q.parse(T,this):T}}),I=E.kdf={},H=I.OpenSSL={execute:function(T,q,F,W,w){if(W||(W=i.random(64/8)),w)var j=m.create({keySize:q+F,hasher:w}).compute(T,W);else var j=m.create({keySize:q+F}).compute(T,W);var he=i.create(j.words.slice(q),F*4);return j.sigBytes=q*4,y.create({key:j,iv:he,salt:W})}},V=f.PasswordBasedCipher=S.extend({cfg:S.cfg.extend({kdf:H}),encrypt:function(T,q,F,W){W=this.cfg.extend(W);var w=W.kdf.execute(F,T.keySize,T.ivSize,W.salt,W.hasher);W.iv=w.iv;var j=S.encrypt.call(this,T,q,w.key,W);return j.mixIn(w),j},decrypt:function(T,q,F,W){W=this.cfg.extend(W),q=this._parse(q,W.format);var w=W.kdf.execute(F,T.keySize,T.ivSize,q.salt,W.hasher);W.iv=w.iv;var j=S.decrypt.call(this,T,q,w.key,W);return j}})}()})}(Wr)),Wr.exports}var $r={exports:{}},sa;function i0(){return sa||(sa=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.mode.CFB=function(){var l=r.lib.BlockCipherMode.extend();l.Encryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize;E.call(this,f,b,p,i),this._prevBlock=f.slice(b,b+p)}}),l.Decryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize,d=f.slice(b,b+p);E.call(this,f,b,p,i),this._prevBlock=d}});function E(f,b,i,p){var d,v=this._iv;v?(d=v.slice(0),this._iv=void 0):d=this._prevBlock,p.encryptBlock(d,0);for(var C=0;C<i;C++)f[b+C]^=d[C]}return l}(),r.mode.CFB})}($r)),$r.exports}var Hr={exports:{}},la;function s0(){return la||(la=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.mode.CTR=function(){var l=r.lib.BlockCipherMode.extend(),E=l.Encryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize,d=this._iv,v=this._counter;d&&(v=this._counter=d.slice(0),this._iv=void 0);var C=v.slice(0);i.encryptBlock(C,0),v[p-1]=v[p-1]+1|0;for(var m=0;m<p;m++)f[b+m]^=C[m]}});return l.Decryptor=E,l}(),r.mode.CTR})}(Hr)),Hr.exports}var qr={exports:{}},ca;function l0(){return ca||(ca=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){/** @preserve
|
|
21
|
+
*/return function(l){var k=r,f=k.lib,b=f.WordArray,i=f.Hasher,p=k.algo,d=b.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),v=b.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),C=b.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),m=b.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),s=b.create([0,1518500249,1859775393,2400959708,2840853838]),h=b.create([1352829926,1548603684,1836072691,2053994217,0]),n=p.RIPEMD160=i.extend({_doReset:function(){this._hash=b.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(S,I){for(var $=0;$<16;$++){var W=I+$,T=S[W];S[W]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var q=this._hash.words,F=s.words,V=h.words,w=d.words,j=v.words,fe=C.words,Z=m.words,ne,ee,ce,N,z,Y,K,B,ve,Ee;Y=ne=q[0],K=ee=q[1],B=ce=q[2],ve=N=q[3],Ee=z=q[4];for(var ue,$=0;$<80;$+=1)ue=ne+S[I+w[$]]|0,$<16?ue+=e(ee,ce,N)+F[0]:$<32?ue+=o(ee,ce,N)+F[1]:$<48?ue+=c(ee,ce,N)+F[2]:$<64?ue+=y(ee,ce,N)+F[3]:ue+=E(ee,ce,N)+F[4],ue=ue|0,ue=_(ue,fe[$]),ue=ue+z|0,ne=z,z=N,N=_(ce,10),ce=ee,ee=ue,ue=Y+S[I+j[$]]|0,$<16?ue+=E(K,B,ve)+V[0]:$<32?ue+=y(K,B,ve)+V[1]:$<48?ue+=c(K,B,ve)+V[2]:$<64?ue+=o(K,B,ve)+V[3]:ue+=e(K,B,ve)+V[4],ue=ue|0,ue=_(ue,Z[$]),ue=ue+Ee|0,Y=Ee,Ee=ve,ve=_(B,10),B=K,K=ue;ue=q[1]+ce+ve|0,q[1]=q[2]+N+Ee|0,q[2]=q[3]+z+Y|0,q[3]=q[4]+ne+K|0,q[4]=q[0]+ee+B|0,q[0]=ue},_doFinalize:function(){var S=this._data,I=S.words,$=this._nDataBytes*8,W=S.sigBytes*8;I[W>>>5]|=128<<24-W%32,I[(W+64>>>9<<4)+14]=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360,S.sigBytes=(I.length+1)*4,this._process();for(var T=this._hash,q=T.words,F=0;F<5;F++){var V=q[F];q[F]=(V<<8|V>>>24)&16711935|(V<<24|V>>>8)&4278255360}return T},clone:function(){var S=i.clone.call(this);return S._hash=this._hash.clone(),S}});function e(S,I,$){return S^I^$}function o(S,I,$){return S&I|~S&$}function c(S,I,$){return(S|~I)^$}function y(S,I,$){return S&$|I&~$}function E(S,I,$){return S^(I|~$)}function _(S,I){return S<<I|S>>>32-I}k.RIPEMD160=i._createHelper(n),k.HmacRIPEMD160=i._createHmacHelper(n)}(),r.RIPEMD160})}(Or)),Or.exports}var Lr={exports:{}},na;function Pr(){return na||(na=1,function(x,X){(function(r,l){x.exports=l(Le())})(Fe,function(r){(function(){var l=r,k=l.lib,f=k.Base,b=l.enc,i=b.Utf8,p=l.algo;p.HMAC=f.extend({init:function(d,v){d=this._hasher=new d.init,typeof v=="string"&&(v=i.parse(v));var C=d.blockSize,m=C*4;v.sigBytes>m&&(v=d.finalize(v)),v.clamp();for(var s=this._oKey=v.clone(),h=this._iKey=v.clone(),n=s.words,e=h.words,o=0;o<C;o++)n[o]^=1549556828,e[o]^=909522486;s.sigBytes=h.sigBytes=m,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var v=this._hasher,C=v.finalize(d);v.reset();var m=v.finalize(this._oKey.clone().concat(C));return m}})})()})}(Lr)),Lr.exports}var Ur={exports:{}},aa;function o0(){return aa||(aa=1,function(x,X){(function(r,l,k){x.exports=l(Le(),Nr(),Pr())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.Base,b=k.WordArray,i=l.algo,p=i.SHA256,d=i.HMAC,v=i.PBKDF2=f.extend({cfg:f.extend({keySize:128/32,hasher:p,iterations:25e4}),init:function(C){this.cfg=this.cfg.extend(C)},compute:function(C,m){for(var s=this.cfg,h=d.create(s.hasher,C),n=b.create(),e=b.create([1]),o=n.words,c=e.words,y=s.keySize,E=s.iterations;o.length<y;){var _=h.update(m).finalize(e);h.reset();for(var S=_.words,I=S.length,$=_,W=1;W<E;W++){$=h.finalize($),h.reset();for(var T=$.words,q=0;q<I;q++)S[q]^=T[q]}n.concat(_),c[0]++}return n.sigBytes=y*4,n}});l.PBKDF2=function(C,m,s){return v.create(s).compute(C,m)}}(),r.PBKDF2})}(Ur)),Ur.exports}var Mr={exports:{}},oa;function mt(){return oa||(oa=1,function(x,X){(function(r,l,k){x.exports=l(Le(),Yn(),Pr())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.Base,b=k.WordArray,i=l.algo,p=i.MD5,d=i.EvpKDF=f.extend({cfg:f.extend({keySize:128/32,hasher:p,iterations:1}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,C){for(var m,s=this.cfg,h=s.hasher.create(),n=b.create(),e=n.words,o=s.keySize,c=s.iterations;e.length<o;){m&&h.update(m),m=h.update(v).finalize(C),h.reset();for(var y=1;y<c;y++)m=h.finalize(m),h.reset();n.concat(m)}return n.sigBytes=o*4,n}});l.EvpKDF=function(v,C,m){return d.create(m).compute(v,C)}}(),r.EvpKDF})}(Mr)),Mr.exports}var Wr={exports:{}},ia;function je(){return ia||(ia=1,function(x,X){(function(r,l,k){x.exports=l(Le(),mt())})(Fe,function(r){r.lib.Cipher||function(l){var k=r,f=k.lib,b=f.Base,i=f.WordArray,p=f.BufferedBlockAlgorithm,d=k.enc;d.Utf8;var v=d.Base64,C=k.algo,m=C.EvpKDF,s=f.Cipher=p.extend({cfg:b.extend(),createEncryptor:function(T,q){return this.create(this._ENC_XFORM_MODE,T,q)},createDecryptor:function(T,q){return this.create(this._DEC_XFORM_MODE,T,q)},init:function(T,q,F){this.cfg=this.cfg.extend(F),this._xformMode=T,this._key=q,this.reset()},reset:function(){p.reset.call(this),this._doReset()},process:function(T){return this._append(T),this._process()},finalize:function(T){T&&this._append(T);var q=this._doFinalize();return q},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function T(q){return typeof q=="string"?W:S}return function(q){return{encrypt:function(F,V,w){return T(V).encrypt(q,F,V,w)},decrypt:function(F,V,w){return T(V).decrypt(q,F,V,w)}}}}()});f.StreamCipher=s.extend({_doFinalize:function(){var T=this._process(!0);return T},blockSize:1});var h=k.mode={},n=f.BlockCipherMode=b.extend({createEncryptor:function(T,q){return this.Encryptor.create(T,q)},createDecryptor:function(T,q){return this.Decryptor.create(T,q)},init:function(T,q){this._cipher=T,this._iv=q}}),e=h.CBC=function(){var T=n.extend();T.Encryptor=T.extend({processBlock:function(F,V){var w=this._cipher,j=w.blockSize;q.call(this,F,V,j),w.encryptBlock(F,V),this._prevBlock=F.slice(V,V+j)}}),T.Decryptor=T.extend({processBlock:function(F,V){var w=this._cipher,j=w.blockSize,fe=F.slice(V,V+j);w.decryptBlock(F,V),q.call(this,F,V,j),this._prevBlock=fe}});function q(F,V,w){var j,fe=this._iv;fe?(j=fe,this._iv=l):j=this._prevBlock;for(var Z=0;Z<w;Z++)F[V+Z]^=j[Z]}return T}(),o=k.pad={},c=o.Pkcs7={pad:function(T,q){for(var F=q*4,V=F-T.sigBytes%F,w=V<<24|V<<16|V<<8|V,j=[],fe=0;fe<V;fe+=4)j.push(w);var Z=i.create(j,V);T.concat(Z)},unpad:function(T){var q=T.words[T.sigBytes-1>>>2]&255;T.sigBytes-=q}};f.BlockCipher=s.extend({cfg:s.cfg.extend({mode:e,padding:c}),reset:function(){var T;s.reset.call(this);var q=this.cfg,F=q.iv,V=q.mode;this._xformMode==this._ENC_XFORM_MODE?T=V.createEncryptor:(T=V.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==T?this._mode.init(this,F&&F.words):(this._mode=T.call(V,this,F&&F.words),this._mode.__creator=T)},_doProcessBlock:function(T,q){this._mode.processBlock(T,q)},_doFinalize:function(){var T,q=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(q.pad(this._data,this.blockSize),T=this._process(!0)):(T=this._process(!0),q.unpad(T)),T},blockSize:128/32});var y=f.CipherParams=b.extend({init:function(T){this.mixIn(T)},toString:function(T){return(T||this.formatter).stringify(this)}}),E=k.format={},_=E.OpenSSL={stringify:function(T){var q,F=T.ciphertext,V=T.salt;return V?q=i.create([1398893684,1701076831]).concat(V).concat(F):q=F,q.toString(v)},parse:function(T){var q,F=v.parse(T),V=F.words;return V[0]==1398893684&&V[1]==1701076831&&(q=i.create(V.slice(2,4)),V.splice(0,4),F.sigBytes-=16),y.create({ciphertext:F,salt:q})}},S=f.SerializableCipher=b.extend({cfg:b.extend({format:_}),encrypt:function(T,q,F,V){V=this.cfg.extend(V);var w=T.createEncryptor(F,V),j=w.finalize(q),fe=w.cfg;return y.create({ciphertext:j,key:F,iv:fe.iv,algorithm:T,mode:fe.mode,padding:fe.padding,blockSize:T.blockSize,formatter:V.format})},decrypt:function(T,q,F,V){V=this.cfg.extend(V),q=this._parse(q,V.format);var w=T.createDecryptor(F,V).finalize(q.ciphertext);return w},_parse:function(T,q){return typeof T=="string"?q.parse(T,this):T}}),I=k.kdf={},$=I.OpenSSL={execute:function(T,q,F,V,w){if(V||(V=i.random(64/8)),w)var j=m.create({keySize:q+F,hasher:w}).compute(T,V);else var j=m.create({keySize:q+F}).compute(T,V);var fe=i.create(j.words.slice(q),F*4);return j.sigBytes=q*4,y.create({key:j,iv:fe,salt:V})}},W=f.PasswordBasedCipher=S.extend({cfg:S.cfg.extend({kdf:$}),encrypt:function(T,q,F,V){V=this.cfg.extend(V);var w=V.kdf.execute(F,T.keySize,T.ivSize,V.salt,V.hasher);V.iv=w.iv;var j=S.encrypt.call(this,T,q,w.key,V);return j.mixIn(w),j},decrypt:function(T,q,F,V){V=this.cfg.extend(V),q=this._parse(q,V.format);var w=V.kdf.execute(F,T.keySize,T.ivSize,q.salt,V.hasher);V.iv=w.iv;var j=S.decrypt.call(this,T,q,w.key,V);return j}})}()})}(Wr)),Wr.exports}var Vr={exports:{}},sa;function i0(){return sa||(sa=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.mode.CFB=function(){var l=r.lib.BlockCipherMode.extend();l.Encryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize;k.call(this,f,b,p,i),this._prevBlock=f.slice(b,b+p)}}),l.Decryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize,d=f.slice(b,b+p);k.call(this,f,b,p,i),this._prevBlock=d}});function k(f,b,i,p){var d,v=this._iv;v?(d=v.slice(0),this._iv=void 0):d=this._prevBlock,p.encryptBlock(d,0);for(var C=0;C<i;C++)f[b+C]^=d[C]}return l}(),r.mode.CFB})}(Vr)),Vr.exports}var $r={exports:{}},la;function s0(){return la||(la=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.mode.CTR=function(){var l=r.lib.BlockCipherMode.extend(),k=l.Encryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize,d=this._iv,v=this._counter;d&&(v=this._counter=d.slice(0),this._iv=void 0);var C=v.slice(0);i.encryptBlock(C,0),v[p-1]=v[p-1]+1|0;for(var m=0;m<p;m++)f[b+m]^=C[m]}});return l.Decryptor=k,l}(),r.mode.CTR})}($r)),$r.exports}var Hr={exports:{}},ca;function l0(){return ca||(ca=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){/** @preserve
|
|
22
22
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
23
23
|
* derived from CryptoJS.mode.CTR
|
|
24
24
|
* Jan Hruby jhruby.web@gmail.com
|
|
25
|
-
*/return r.mode.CTRGladman=function(){var l=r.lib.BlockCipherMode.extend();function E(i){if((i>>24&255)===255){var p=i>>16&255,d=i>>8&255,v=i&255;p===255?(p=0,d===255?(d=0,v===255?v=0:++v):++d):++p,i=0,i+=p<<16,i+=d<<8,i+=v}else i+=1<<24;return i}function f(i){return(i[0]=E(i[0]))===0&&(i[1]=E(i[1])),i}var b=l.Encryptor=l.extend({processBlock:function(i,p){var d=this._cipher,v=d.blockSize,C=this._iv,m=this._counter;C&&(m=this._counter=C.slice(0),this._iv=void 0),f(m);var s=m.slice(0);d.encryptBlock(s,0);for(var h=0;h<v;h++)i[p+h]^=s[h]}});return l.Decryptor=b,l}(),r.mode.CTRGladman})}(qr)),qr.exports}var Xr={exports:{}},da;function c0(){return da||(da=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.mode.OFB=function(){var l=r.lib.BlockCipherMode.extend(),E=l.Encryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize,d=this._iv,v=this._keystream;d&&(v=this._keystream=d.slice(0),this._iv=void 0),i.encryptBlock(v,0);for(var C=0;C<p;C++)f[b+C]^=v[C]}});return l.Decryptor=E,l}(),r.mode.OFB})}(Xr)),Xr.exports}var Zr={exports:{}},fa;function d0(){return fa||(fa=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.mode.ECB=function(){var l=r.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(E,f){this._cipher.encryptBlock(E,f)}}),l.Decryptor=l.extend({processBlock:function(E,f){this._cipher.decryptBlock(E,f)}}),l}(),r.mode.ECB})}(Zr)),Zr.exports}var Gr={exports:{}},ua;function f0(){return ua||(ua=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.pad.AnsiX923={pad:function(l,E){var f=l.sigBytes,b=E*4,i=b-f%b,p=f+i-1;l.clamp(),l.words[p>>>2]|=i<<24-p%4*8,l.sigBytes+=i},unpad:function(l){var E=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=E}},r.pad.Ansix923})}(Gr)),Gr.exports}var Yr={exports:{}},ha;function u0(){return ha||(ha=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.pad.Iso10126={pad:function(l,E){var f=E*4,b=f-l.sigBytes%f;l.concat(r.lib.WordArray.random(b-1)).concat(r.lib.WordArray.create([b<<24],1))},unpad:function(l){var E=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=E}},r.pad.Iso10126})}(Yr)),Yr.exports}var Kr={exports:{}},pa;function h0(){return pa||(pa=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.pad.Iso97971={pad:function(l,E){l.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(l,E)},unpad:function(l){r.pad.ZeroPadding.unpad(l),l.sigBytes--}},r.pad.Iso97971})}(Kr)),Kr.exports}var jr={exports:{}},xa;function p0(){return xa||(xa=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.pad.ZeroPadding={pad:function(l,E){var f=E*4;l.clamp(),l.sigBytes+=f-(l.sigBytes%f||f)},unpad:function(l){for(var E=l.words,f=l.sigBytes-1,f=l.sigBytes-1;f>=0;f--)if(E[f>>>2]>>>24-f%4*8&255){l.sigBytes=f+1;break}}},r.pad.ZeroPadding})}(jr)),jr.exports}var Jr={exports:{}},ma;function x0(){return ma||(ma=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})}(Jr)),Jr.exports}var Qr={exports:{}},va;function m0(){return va||(va=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),je())})(De,function(r){return function(l){var E=r,f=E.lib,b=f.CipherParams,i=E.enc,p=i.Hex,d=E.format;d.Hex={stringify:function(v){return v.ciphertext.toString(p)},parse:function(v){var C=p.parse(v);return b.create({ciphertext:C})}}}(),r.format.Hex})}(Qr)),Qr.exports}var en={exports:{}},ga;function v0(){return ga||(ga=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),yt(),wt(),xt(),je())})(De,function(r){return function(){var l=r,E=l.lib,f=E.BlockCipher,b=l.algo,i=[],p=[],d=[],v=[],C=[],m=[],s=[],h=[],n=[],e=[];(function(){for(var y=[],k=0;k<256;k++)k<128?y[k]=k<<1:y[k]=k<<1^283;for(var _=0,S=0,k=0;k<256;k++){var I=S^S<<1^S<<2^S<<3^S<<4;I=I>>>8^I&255^99,i[_]=I,p[I]=_;var H=y[_],V=y[H],T=y[V],q=y[I]*257^I*16843008;d[_]=q<<24|q>>>8,v[_]=q<<16|q>>>16,C[_]=q<<8|q>>>24,m[_]=q;var q=T*16843009^V*65537^H*257^_*16843008;s[I]=q<<24|q>>>8,h[I]=q<<16|q>>>16,n[I]=q<<8|q>>>24,e[I]=q,_?(_=H^y[y[y[T^H]]],S^=y[y[S]]):_=S=1}})();var o=[0,1,2,4,8,16,32,64,128,27,54],c=b.AES=f.extend({_doReset:function(){var y;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var k=this._keyPriorReset=this._key,_=k.words,S=k.sigBytes/4,I=this._nRounds=S+6,H=(I+1)*4,V=this._keySchedule=[],T=0;T<H;T++)T<S?V[T]=_[T]:(y=V[T-1],T%S?S>6&&T%S==4&&(y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255]):(y=y<<8|y>>>24,y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255],y^=o[T/S|0]<<24),V[T]=V[T-S]^y);for(var q=this._invKeySchedule=[],F=0;F<H;F++){var T=H-F;if(F%4)var y=V[T];else var y=V[T-4];F<4||T<=4?q[F]=y:q[F]=s[i[y>>>24]]^h[i[y>>>16&255]]^n[i[y>>>8&255]]^e[i[y&255]]}}},encryptBlock:function(y,k){this._doCryptBlock(y,k,this._keySchedule,d,v,C,m,i)},decryptBlock:function(y,k){var _=y[k+1];y[k+1]=y[k+3],y[k+3]=_,this._doCryptBlock(y,k,this._invKeySchedule,s,h,n,e,p);var _=y[k+1];y[k+1]=y[k+3],y[k+3]=_},_doCryptBlock:function(y,k,_,S,I,H,V,T){for(var q=this._nRounds,F=y[k]^_[0],W=y[k+1]^_[1],w=y[k+2]^_[2],j=y[k+3]^_[3],he=4,Z=1;Z<q;Z++){var re=S[F>>>24]^I[W>>>16&255]^H[w>>>8&255]^V[j&255]^_[he++],ee=S[W>>>24]^I[w>>>16&255]^H[j>>>8&255]^V[F&255]^_[he++],ce=S[w>>>24]^I[j>>>16&255]^H[F>>>8&255]^V[W&255]^_[he++],N=S[j>>>24]^I[F>>>16&255]^H[W>>>8&255]^V[w&255]^_[he++];F=re,W=ee,w=ce,j=N}var re=(T[F>>>24]<<24|T[W>>>16&255]<<16|T[w>>>8&255]<<8|T[j&255])^_[he++],ee=(T[W>>>24]<<24|T[w>>>16&255]<<16|T[j>>>8&255]<<8|T[F&255])^_[he++],ce=(T[w>>>24]<<24|T[j>>>16&255]<<16|T[F>>>8&255]<<8|T[W&255])^_[he++],N=(T[j>>>24]<<24|T[F>>>16&255]<<16|T[W>>>8&255]<<8|T[w&255])^_[he++];y[k]=re,y[k+1]=ee,y[k+2]=ce,y[k+3]=N},keySize:256/32});l.AES=f._createHelper(c)}(),r.AES})}(en)),en.exports}var tn={exports:{}},ya;function g0(){return ya||(ya=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),yt(),wt(),xt(),je())})(De,function(r){return function(){var l=r,E=l.lib,f=E.WordArray,b=E.BlockCipher,i=l.algo,p=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],d=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],v=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],C=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],m=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],s=i.DES=b.extend({_doReset:function(){for(var o=this._key,c=o.words,y=[],k=0;k<56;k++){var _=p[k]-1;y[k]=c[_>>>5]>>>31-_%32&1}for(var S=this._subKeys=[],I=0;I<16;I++){for(var H=S[I]=[],V=v[I],k=0;k<24;k++)H[k/6|0]|=y[(d[k]-1+V)%28]<<31-k%6,H[4+(k/6|0)]|=y[28+(d[k+24]-1+V)%28]<<31-k%6;H[0]=H[0]<<1|H[0]>>>31;for(var k=1;k<7;k++)H[k]=H[k]>>>(k-1)*4+3;H[7]=H[7]<<5|H[7]>>>27}for(var T=this._invSubKeys=[],k=0;k<16;k++)T[k]=S[15-k]},encryptBlock:function(o,c){this._doCryptBlock(o,c,this._subKeys)},decryptBlock:function(o,c){this._doCryptBlock(o,c,this._invSubKeys)},_doCryptBlock:function(o,c,y){this._lBlock=o[c],this._rBlock=o[c+1],h.call(this,4,252645135),h.call(this,16,65535),n.call(this,2,858993459),n.call(this,8,16711935),h.call(this,1,1431655765);for(var k=0;k<16;k++){for(var _=y[k],S=this._lBlock,I=this._rBlock,H=0,V=0;V<8;V++)H|=C[V][((I^_[V])&m[V])>>>0];this._lBlock=I,this._rBlock=S^H}var T=this._lBlock;this._lBlock=this._rBlock,this._rBlock=T,h.call(this,1,1431655765),n.call(this,8,16711935),n.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),o[c]=this._lBlock,o[c+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function h(o,c){var y=(this._lBlock>>>o^this._rBlock)&c;this._rBlock^=y,this._lBlock^=y<<o}function n(o,c){var y=(this._rBlock>>>o^this._lBlock)&c;this._lBlock^=y,this._rBlock^=y<<o}l.DES=b._createHelper(s);var e=i.TripleDES=b.extend({_doReset:function(){var o=this._key,c=o.words;if(c.length!==2&&c.length!==4&&c.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var y=c.slice(0,2),k=c.length<4?c.slice(0,2):c.slice(2,4),_=c.length<6?c.slice(0,2):c.slice(4,6);this._des1=s.createEncryptor(f.create(y)),this._des2=s.createEncryptor(f.create(k)),this._des3=s.createEncryptor(f.create(_))},encryptBlock:function(o,c){this._des1.encryptBlock(o,c),this._des2.decryptBlock(o,c),this._des3.encryptBlock(o,c)},decryptBlock:function(o,c){this._des3.decryptBlock(o,c),this._des2.encryptBlock(o,c),this._des1.decryptBlock(o,c)},keySize:192/32,ivSize:64/32,blockSize:64/32});l.TripleDES=b._createHelper(e)}(),r.TripleDES})}(tn)),tn.exports}var rn={exports:{}},wa;function y0(){return wa||(wa=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),yt(),wt(),xt(),je())})(De,function(r){return function(){var l=r,E=l.lib,f=E.StreamCipher,b=l.algo,i=b.RC4=f.extend({_doReset:function(){for(var v=this._key,C=v.words,m=v.sigBytes,s=this._S=[],h=0;h<256;h++)s[h]=h;for(var h=0,n=0;h<256;h++){var e=h%m,o=C[e>>>2]>>>24-e%4*8&255;n=(n+s[h]+o)%256;var c=s[h];s[h]=s[n],s[n]=c}this._i=this._j=0},_doProcessBlock:function(v,C){v[C]^=p.call(this)},keySize:256/32,ivSize:0});function p(){for(var v=this._S,C=this._i,m=this._j,s=0,h=0;h<4;h++){C=(C+1)%256,m=(m+v[C])%256;var n=v[C];v[C]=v[m],v[m]=n,s|=v[(v[C]+v[m])%256]<<24-h*8}return this._i=C,this._j=m,s}l.RC4=f._createHelper(i);var d=b.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var v=this.cfg.drop;v>0;v--)p.call(this)}});l.RC4Drop=f._createHelper(d)}(),r.RC4})}(rn)),rn.exports}var nn={exports:{}},ba;function w0(){return ba||(ba=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),yt(),wt(),xt(),je())})(De,function(r){return function(){var l=r,E=l.lib,f=E.StreamCipher,b=l.algo,i=[],p=[],d=[],v=b.Rabbit=f.extend({_doReset:function(){for(var m=this._key.words,s=this.cfg.iv,h=0;h<4;h++)m[h]=(m[h]<<8|m[h]>>>24)&16711935|(m[h]<<24|m[h]>>>8)&4278255360;var n=this._X=[m[0],m[3]<<16|m[2]>>>16,m[1],m[0]<<16|m[3]>>>16,m[2],m[1]<<16|m[0]>>>16,m[3],m[2]<<16|m[1]>>>16],e=this._C=[m[2]<<16|m[2]>>>16,m[0]&4294901760|m[1]&65535,m[3]<<16|m[3]>>>16,m[1]&4294901760|m[2]&65535,m[0]<<16|m[0]>>>16,m[2]&4294901760|m[3]&65535,m[1]<<16|m[1]>>>16,m[3]&4294901760|m[0]&65535];this._b=0;for(var h=0;h<4;h++)C.call(this);for(var h=0;h<8;h++)e[h]^=n[h+4&7];if(s){var o=s.words,c=o[0],y=o[1],k=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,S=k>>>16|_&4294901760,I=_<<16|k&65535;e[0]^=k,e[1]^=S,e[2]^=_,e[3]^=I,e[4]^=k,e[5]^=S,e[6]^=_,e[7]^=I;for(var h=0;h<4;h++)C.call(this)}},_doProcessBlock:function(m,s){var h=this._X;C.call(this),i[0]=h[0]^h[5]>>>16^h[3]<<16,i[1]=h[2]^h[7]>>>16^h[5]<<16,i[2]=h[4]^h[1]>>>16^h[7]<<16,i[3]=h[6]^h[3]>>>16^h[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>24)&16711935|(i[n]<<24|i[n]>>>8)&4278255360,m[s+n]^=i[n]},blockSize:128/32,ivSize:64/32});function C(){for(var m=this._X,s=this._C,h=0;h<8;h++)p[h]=s[h];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<p[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<p[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<p[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<p[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<p[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<p[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<p[6]>>>0?1:0)|0,this._b=s[7]>>>0<p[7]>>>0?1:0;for(var h=0;h<8;h++){var n=m[h]+s[h],e=n&65535,o=n>>>16,c=((e*e>>>17)+e*o>>>15)+o*o,y=((n&4294901760)*n|0)+((n&65535)*n|0);d[h]=c^y}m[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,m[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,m[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,m[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,m[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,m[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,m[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,m[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}l.Rabbit=f._createHelper(v)}(),r.Rabbit})}(nn)),nn.exports}var an={exports:{}},ka;function b0(){return ka||(ka=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),yt(),wt(),xt(),je())})(De,function(r){return function(){var l=r,E=l.lib,f=E.StreamCipher,b=l.algo,i=[],p=[],d=[],v=b.RabbitLegacy=f.extend({_doReset:function(){var m=this._key.words,s=this.cfg.iv,h=this._X=[m[0],m[3]<<16|m[2]>>>16,m[1],m[0]<<16|m[3]>>>16,m[2],m[1]<<16|m[0]>>>16,m[3],m[2]<<16|m[1]>>>16],n=this._C=[m[2]<<16|m[2]>>>16,m[0]&4294901760|m[1]&65535,m[3]<<16|m[3]>>>16,m[1]&4294901760|m[2]&65535,m[0]<<16|m[0]>>>16,m[2]&4294901760|m[3]&65535,m[1]<<16|m[1]>>>16,m[3]&4294901760|m[0]&65535];this._b=0;for(var e=0;e<4;e++)C.call(this);for(var e=0;e<8;e++)n[e]^=h[e+4&7];if(s){var o=s.words,c=o[0],y=o[1],k=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,S=k>>>16|_&4294901760,I=_<<16|k&65535;n[0]^=k,n[1]^=S,n[2]^=_,n[3]^=I,n[4]^=k,n[5]^=S,n[6]^=_,n[7]^=I;for(var e=0;e<4;e++)C.call(this)}},_doProcessBlock:function(m,s){var h=this._X;C.call(this),i[0]=h[0]^h[5]>>>16^h[3]<<16,i[1]=h[2]^h[7]>>>16^h[5]<<16,i[2]=h[4]^h[1]>>>16^h[7]<<16,i[3]=h[6]^h[3]>>>16^h[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>24)&16711935|(i[n]<<24|i[n]>>>8)&4278255360,m[s+n]^=i[n]},blockSize:128/32,ivSize:64/32});function C(){for(var m=this._X,s=this._C,h=0;h<8;h++)p[h]=s[h];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<p[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<p[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<p[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<p[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<p[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<p[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<p[6]>>>0?1:0)|0,this._b=s[7]>>>0<p[7]>>>0?1:0;for(var h=0;h<8;h++){var n=m[h]+s[h],e=n&65535,o=n>>>16,c=((e*e>>>17)+e*o>>>15)+o*o,y=((n&4294901760)*n|0)+((n&65535)*n|0);d[h]=c^y}m[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,m[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,m[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,m[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,m[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,m[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,m[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,m[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}l.RabbitLegacy=f._createHelper(v)}(),r.RabbitLegacy})}(an)),an.exports}var on={exports:{}},Ea;function k0(){return Ea||(Ea=1,function(x,X){(function(r,l,E){x.exports=l(Oe(),yt(),wt(),xt(),je())})(De,function(r){return function(){var l=r,E=l.lib,f=E.BlockCipher,b=l.algo;const i=16,p=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],d=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var v={pbox:[],sbox:[]};function C(e,o){let c=o>>24&255,y=o>>16&255,k=o>>8&255,_=o&255,S=e.sbox[0][c]+e.sbox[1][y];return S=S^e.sbox[2][k],S=S+e.sbox[3][_],S}function m(e,o,c){let y=o,k=c,_;for(let S=0;S<i;++S)y=y^e.pbox[S],k=C(e,y)^k,_=y,y=k,k=_;return _=y,y=k,k=_,k=k^e.pbox[i],y=y^e.pbox[i+1],{left:y,right:k}}function s(e,o,c){let y=o,k=c,_;for(let S=i+1;S>1;--S)y=y^e.pbox[S],k=C(e,y)^k,_=y,y=k,k=_;return _=y,y=k,k=_,k=k^e.pbox[1],y=y^e.pbox[0],{left:y,right:k}}function h(e,o,c){for(let I=0;I<4;I++){e.sbox[I]=[];for(let H=0;H<256;H++)e.sbox[I][H]=d[I][H]}let y=0;for(let I=0;I<i+2;I++)e.pbox[I]=p[I]^o[y],y++,y>=c&&(y=0);let k=0,_=0,S=0;for(let I=0;I<i+2;I+=2)S=m(e,k,_),k=S.left,_=S.right,e.pbox[I]=k,e.pbox[I+1]=_;for(let I=0;I<4;I++)for(let H=0;H<256;H+=2)S=m(e,k,_),k=S.left,_=S.right,e.sbox[I][H]=k,e.sbox[I][H+1]=_;return!0}var n=b.Blowfish=f.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,o=e.words,c=e.sigBytes/4;h(v,o,c)}},encryptBlock:function(e,o){var c=m(v,e[o],e[o+1]);e[o]=c.left,e[o+1]=c.right},decryptBlock:function(e,o){var c=s(v,e[o],e[o+1]);e[o]=c.left,e[o+1]=c.right},blockSize:64/32,keySize:128/32,ivSize:64/32});l.Blowfish=f._createHelper(n)}(),r.Blowfish})}(on)),on.exports}(function(x,X){(function(r,l,E){x.exports=l(Oe(),Gt(),Ji(),Qi(),yt(),e0(),wt(),Yn(),Ir(),t0(),Qn(),r0(),n0(),a0(),Ur(),o0(),xt(),je(),i0(),s0(),l0(),c0(),d0(),f0(),u0(),h0(),p0(),x0(),m0(),v0(),g0(),y0(),w0(),b0(),k0())})(De,function(r){return r})})(Mn);var E0=Mn.exports;const Yt=Pn(E0);function C0(){return Yt.SHA256("fabric-editor-2024-secret-key-v1.0").toString()}function B0(){return C0()}function Ca(x){if(!x||typeof x!="object")return x;if(Array.isArray(x))return x.map(r=>Ca(r));const X=JSON.parse(JSON.stringify(x));if(X.objects&&Array.isArray(X.objects)&&(X.objects=X.objects.map(r=>{var l;if(r.type==="image"&&r.src&&(r.customData||(r.customData={}),r.src.startsWith("blob:")&&r.customData.savedSrc?r.src=r.customData.savedSrc:r.src.startsWith("data:")&&(r.customData.savedSrc||(r.customData.savedSrc=r.src))),(l=r==null?void 0:r.customData)!=null&&l.isPatternRect){r.customData||(r.customData={});const E=r.customData.patternSource,f=r.customData.savedSrc;typeof E=="string"?E.startsWith("blob:")&&typeof f=="string"&&f.startsWith("data:")?r.customData.patternSource=f:E.startsWith("data:")&&!r.customData.savedSrc&&(r.customData.savedSrc=E):!E&&typeof f=="string"&&f.startsWith("data:")&&(r.customData.patternSource=f)}return r})),X.backgroundImage&&typeof X.backgroundImage=="object"){const r=X.backgroundImage;r.src&&typeof r.src=="string"&&(r.src.startsWith("blob:")&&r.savedSrc&&typeof r.savedSrc=="string"&&r.savedSrc.startsWith("data:")?r.src=r.savedSrc:r.src.startsWith("data:")&&!r.savedSrc&&(r.savedSrc=r.src))}return X}function _0(x,X){try{const r=X||B0(),l=Ca(x),E=JSON.stringify(l);return Yt.AES.encrypt(E,r,{mode:Yt.mode.CBC,padding:Yt.pad.Pkcs7}).toString()}catch(r){throw console.error("[encryptJson] 加密失败:",r),new Error("JSON 加密失败")}}const A0={class:"preview"},D0={class:"preview-header"},F0=["disabled"],S0={key:0},N0={key:1},I0=["disabled"],R0={class:"preview-canvas-wrapper"},z0=["aria-label"],T0={key:0,class:"preview-loading"},O0=["disabled"],L0={key:2,class:"preview-indicator"},P0={class:"preview-zoom"},U0={key:0,class:"preview-zoom-loading"},M0={class:"preview-zoom-tools"},V0=["disabled"],W0=["disabled"],$0=["disabled"],H0=["disabled"],q0=["src"],X0=["disabled"],Z0={key:0,class:"progress-modal"},G0={class:"progress-container"},Y0={class:"progress-content"},K0={class:"progress-bar-wrapper"},j0={class:"progress-bar-container"},J0={class:"progress-marks"},Q0={class:"progress-percent"},es=["data-value"],Bt=1600,ts=((x,X)=>{const r=x.__vccOpts||x;for(const[l,E]of X)r[l]=E;return r})(t.defineComponent({__name:"PreviewPanel",props:{renderData:{type:Object,default:null},previewTitle:{type:String,default:""},templateIndex:{type:Number,default:0},templateTotal:{type:Number,default:0},getRenderDataForIndex:{type:Function,default:null},getAllDiecutFabricData:{type:Function,default:null}},emits:["prev-template","next-template"],setup(x,{emit:X}){const r=x,l=X,E=t.ref(null),f=t.ref(null),b=t.ref(null),i=t.ref(!1),p=t.ref(!1),d=t.ref(!1),v=t.ref(!1),C=t.ref(!1),m=t.ref(0);let s=null;const h=t.ref(null),n=t.ref(null),e=t.ref(null),o=t.ref(1),c=new Map,y=new Map,k=new Map,_=new Map,S=new Map;let I=0,H=null,V=null,T=0,q=null,F=0,W=0;const w={width:0,height:0,dpr:0};let j=!1;const he=new Map,Z=t.computed(()=>r.templateTotal>0&&r.templateIndex>0),re=t.computed(()=>r.templateTotal>0&&r.templateIndex<r.templateTotal-1),ee=t.computed(()=>r.templateTotal?r.templateIndex+1:0),ce=O=>`${((O==null?void 0:O.trim())||"preview").replace(/[\\/:*?"<>|]+/g,"_")}.png`,N=O=>{var J,Q,ne,de,xe,ve;const $={psdJson:{canvasWidth:(J=O.psdJson)==null?void 0:J.canvasWidth,canvasHeight:(Q=O.psdJson)==null?void 0:Q.canvasHeight,layerList:(de=(ne=O.psdJson)==null?void 0:ne.layerList)==null?void 0:de.map(pe=>({name:pe.name,type:pe.type,blendMode:pe.blendMode,bounds:pe.bounds,layerOrder:pe.layerOrder,opacity:pe.opacity,clipping:pe.clipping,isSmartObject:pe.isSmartObject,size:pe.size,originalWidth:pe.originalWidth,originalHeight:pe.originalHeight,transform:pe.transform,meshPoints:pe.meshPoints,vectorMask:pe.vectorMask,filterList:pe.filterList,children:pe.children}))},materialList:(xe=O.materialList)==null?void 0:xe.map(pe=>({layerName:pe.layerName,url:pe.url,sourceName:pe.sourceName})),fabricScreenshotList:(ve=O.fabricScreenshotList)==null?void 0:ve.map(pe=>({id:pe.id,url:pe.url})),width:O.width,height:O.height};try{return JSON.stringify($)}catch(pe){return console.warn("[preview-panel] 生成renderData签名失败:",pe),`fallback-${Date.now()}`}},z=(O,$="image/png",J=.92)=>new Promise((Q,ne)=>{O.toBlob(de=>{de?Q(de):ne(new Error("canvas toBlob failed"))},$,J)}),Y=(O,$=200,J=800)=>{s&&(clearTimeout(s),s=null);const Q=()=>{if(m.value>=O){s&&(clearTimeout(s),s=null);return}const ne=Math.random()*1.5+.5;m.value=Math.min(O,m.value+ne);const de=Math.random()*(J-$)+$;s=window.setTimeout(Q,de)};Q()},K=async()=>{var O;try{if(p.value||v.value)return;v.value=!0,C.value=!0;const $=Math.random()*15+5;m.value=$;const J=new Ki;Y(35,300,1e3);let Q=null;if(e.value)try{Q=await(await fetch(e.value)).blob(),Y(45,200,800)}catch(ve){console.warn("[preview-panel] 获取blobUrl失败,尝试其他方式:",ve)}if(!Q&&n.value)try{const ve=document.createElement("canvas");ve.width=n.value.width,ve.height=n.value.height;const pe=ve.getContext("2d");pe&&(pe.drawImage(n.value,0,0),Q=await z(ve),Y(45,200,800))}catch(ve){console.warn("[preview-panel] 从bitmap创建blob失败,尝试其他方式:",ve)}if(!Q&&E.value)try{Q=await z(E.value),Y(45,200,800)}catch(ve){console.warn("[preview-panel] 从预览canvas创建blob失败:",ve)}if(!Q&&r.templateTotal<=1&&r.getRenderDataForIndex)try{Y(55,300,1e3);const ve=await r.getRenderDataForIndex(0);if(ve){Y(65,400,1200);const pe={...ve,width:Bt,height:Bt};if(te(),q){const fe=await R(pe);if(Y(75,300,1e3),fe){const ge=document.createElement("canvas");ge.width=fe.width,ge.height=fe.height;const ke=ge.getContext("2d");ke&&(ke.drawImage(fe,0,0),Q=await z(ge),(O=fe.close)==null||O.call(fe),Y(80,200,800))}}else{const fe=await kr(pe),ge=await Zt(fe);Y(75,300,1e3);const ke=ge.canvas??ge;ke&&(Q=await z(ke),Y(80,200,800))}}}catch(ve){console.error("[preview-panel] 渲染预览图失败:",ve)}if(Q){const ve=r.templateTotal<=1?ce(r.previewTitle):`1_${ce(r.previewTitle||"template_1")}`;J.file(ve,Q),Y(85,200,700),console.log("[preview-panel] 预览图片已添加到zip")}if(r.templateTotal>1){const ve=[],pe=r.templateTotal-1;for(let fe=1;fe<r.templateTotal;fe++){const ge=fe,ke=(async()=>{var ze;try{const qe=c.get(ge),$e=y.get(ge);let Ze=null;if($e)try{Ze=await(await fetch($e)).blob()}catch(Xe){console.warn(`[preview-panel] 获取模板 ${ge} 的blobUrl失败,尝试渲染:`,Xe)}if(!Ze&&qe)try{const Xe=document.createElement("canvas");Xe.width=qe.width,Xe.height=qe.height;const ct=Xe.getContext("2d");ct&&(ct.drawImage(qe,0,0),Ze=await z(Xe))}catch(Xe){console.warn("[preview-panel] 从bitmap创建blob失败,尝试渲染:",Xe)}if(!Ze&&r.getRenderDataForIndex){const Xe=await r.getRenderDataForIndex(ge);if(Xe){const ct={...Xe,width:Bt,height:Bt};if(te(),q)try{const Ge=await R(ct);if(Ge){const ot=document.createElement("canvas");ot.width=Ge.width,ot.height=Ge.height;const Je=ot.getContext("2d");Je&&(Je.drawImage(Ge,0,0),Ze=await z(ot),(ze=Ge.close)==null||ze.call(Ge))}}catch(Ge){console.error(`[preview-panel] 渲染模板 ${ge} 失败:`,Ge)}else try{const Ge=await kr(ct),ot=await Zt(Ge),Je=ot.canvas??ot;Je&&(Ze=await z(Je))}catch(Ge){console.error(`[preview-panel] 主线程渲染模板 ${ge} 失败:`,Ge)}}}if(Ze){const Xe=`${ge+1}_${ce(r.previewTitle||`template_${ge+1}`)}`;J.file(Xe,Ze),console.log(`[preview-panel] 模板 ${ge} 已添加到zip`)}else console.warn(`[preview-panel] 模板 ${ge} 无法获取图片,跳过`)}catch(qe){console.error(`[preview-panel] 处理模板 ${ge} 时出错:`,qe)}})();ve.push(ke)}await Promise.allSettled(ve),Y(88,200,600)}if(r.getAllDiecutFabricData)try{Y(92,300,800);const ve=await r.getAllDiecutFabricData();Y(95,200,600);const pe=_0(ve);J.file("fabric_data_all.encrypted.json",pe),Y(97,200,500),console.log("[preview-panel] 所有刀板的合并加密fabric数据已添加到zip")}catch(ve){console.error("[preview-panel] 导出fabric数据失败:",ve)}Y(98,300,700);const ne=await J.generateAsync({type:"blob"});Y(99,200,500);const de=r.templateTotal<=1?`${ce(r.previewTitle).replace(".png","")}.zip`:`${ce(r.previewTitle||"templates").replace(".png","")}_all.zip`;Y(100,100,300);const xe=()=>{if(m.value>=100){const ve=URL.createObjectURL(ne),pe=document.createElement("a");pe.href=ve,pe.download=de,pe.click(),URL.revokeObjectURL(ve),console.log("[preview-panel] 文件已开始下载");const fe=Math.random()*1e4+1e4;console.log(`[preview-panel] 下载完成,将在 ${Math.round(fe/1e3)} 秒后关闭进度条`),setTimeout(()=>{s&&(clearTimeout(s),s=null),C.value=!1,v.value=!1},fe)}else setTimeout(xe,100)};xe(),console.log("[preview-panel] 下载完成")}catch($){console.error("[preview-panel] 下载失败:",$),s&&(clearTimeout(s),s=null),C.value=!1,v.value=!1}},B=()=>{const O=b.value,$=E.value;if(!O||!$)return;const J=window.devicePixelRatio||1,Q=$.style.width;(!Q||Q==="0px")&&($.style.width="300px"),$.offsetWidth;const de=$.getBoundingClientRect().width||300,xe=de,ve=de,pe=xe;if(Math.abs(w.width-ve)<.1&&Math.abs(w.height-pe)<.1&&w.dpr===J)return;w.width=ve,w.height=pe,w.dpr=J;const fe=Math.max(1,Math.floor(ve*J)),ge=fe,ke=fe;($.width!==ge||$.height!==ke)&&($.width=ge,$.height=ke),$.style.height=`${ve}px`},ye=()=>{const O=E.value;if(!O)return;const $=O.getContext("2d");$&&$.clearRect(0,0,O.width,O.height)},Ce=O=>{const $=E.value;if(!O||!$)return;let J=f.value;J||(J=document.createElement("canvas"),f.value=J),(J.width!==$.width||J.height!==$.height)&&(J.width=$.width,J.height=$.height);const Q=J.getContext("2d");if(!Q)return;Q.clearRect(0,0,J.width,J.height),Q.drawImage(O,0,0,J.width,J.height);const ne=$.getContext("2d");ne&&(ne.clearRect(0,0,$.width,$.height),ne.drawImage(J,0,0,$.width,$.height))},ue=()=>{e.value&&(URL.revokeObjectURL(e.value),e.value=null)},Ae=async O=>{const $=document.createElement("canvas");$.width=O.width,$.height=O.height;const J=$.getContext("2d");if(!J)return;J.drawImage(O,0,0);const Q=await new Promise(ne=>$.toBlob(de=>ne(de),"image/png"));Q&&(ue(),e.value=URL.createObjectURL(Q))},Re=O=>{c.forEach($=>{$.close&&$.close()}),c.clear(),y.forEach($=>URL.revokeObjectURL($)),y.clear(),k.clear(),console.log("[preview-panel] 已清除所有大图缓存和签名"),n.value&&n.value.close&&n.value.close(),n.value=null,ue()},Pe=async(O,$,J)=>{const Q=$;let ne=null;J?(ne=N(J),k.set(Q,ne),console.log(`[preview-panel] 模板 ${Q} renderData签名已保存:`,ne.substring(0,50)+"...")):ne=k.get(Q)||null;const de=c.get(Q);de&&de.close&&de.close();const xe=y.get(Q);xe&&URL.revokeObjectURL(xe);const ve=k.get(Q);if(ve&&ve!==ne){const fe=_.get(ve);fe&&fe.close&&fe.close();const ge=S.get(ve);ge&&ge!==e.value&&URL.revokeObjectURL(ge),_.delete(ve),S.delete(ve)}const pe=await createImageBitmap(O);if(c.set(Q,pe),console.log(`[preview-panel] 模板 ${Q} 大图已保存到缓存,当前缓存数量: ${c.size}`),ne){const fe=_.get(ne);fe&&fe!==pe&&fe.close&&fe.close();const ge=S.get(ne);ge&&ge!==e.value&&URL.revokeObjectURL(ge);try{const ke=await createImageBitmap(pe);_.set(ne,ke),console.log(`[preview-panel] 签名 ${ne.substring(0,50)}... 的bitmap已保存到签名缓存(独立副本)`)}catch(ke){console.warn("[preview-panel] 为签名缓存克隆bitmap失败,使用原bitmap:",ke),_.set(ne,pe)}try{const ke=document.createElement("canvas");ke.width=pe.width,ke.height=pe.height;const ze=ke.getContext("2d");if(ze){ze.drawImage(pe,0,0);const qe=await new Promise($e=>ke.toBlob(Ze=>$e(Ze),"image/png"));if(qe){const $e=URL.createObjectURL(qe);S.set(ne,$e),console.log(`[preview-panel] 签名 ${ne.substring(0,50)}... 的blobUrl已保存到签名缓存`)}}}catch(ke){console.warn("[preview-panel] 为签名缓存生成blobUrl失败:",ke)}}if(Q===r.templateIndex)n.value&&n.value.close&&n.value.close(),n.value=pe,Ae(pe);else{const fe=document.createElement("canvas");fe.width=pe.width,fe.height=pe.height;const ge=fe.getContext("2d");if(ge){ge.drawImage(pe,0,0);const ke=await new Promise(ze=>fe.toBlob(qe=>ze(qe),"image/png"));if(ke){const ze=URL.createObjectURL(ke);y.set(Q,ze)}}}},Ue=async(O,$)=>{var ke;const J=$??r.templateIndex,Q=N(O),ne=_.get(Q),de=S.get(Q);if((ne||de)&&(console.log(`[preview-panel] 模板 ${J} 找到相同签名的缓存,直接复用`),ne))try{const ze=await createImageBitmap(ne);await Pe(ze,J,O);return}catch(ze){console.warn("[preview-panel] 从签名缓存克隆bitmap失败,继续渲染:",ze),_.delete(Q),de&&de!==e.value?(URL.revokeObjectURL(de),S.delete(Q)):de&&S.delete(Q)}const xe=c.get(J),ve=y.get(J),pe=k.get(J);if((xe||ve)&&pe===Q){if(console.log(`[preview-panel] 模板 ${J} 大图已在缓存中且签名匹配,直接使用`),J===r.templateIndex&&xe)try{const ze=document.createElement("canvas");ze.width=xe.width,ze.height=xe.height;const qe=ze.getContext("2d");if(qe){qe.drawImage(xe,0,0),n.value&&n.value.close&&n.value.close(),n.value=xe,Ae(xe);return}}catch(ze){console.warn("[preview-panel] 缓存的bitmap不可用,需要重新渲染:",ze),c.delete(J),ve&&(URL.revokeObjectURL(ve),y.delete(J)),k.delete(J)}return}pe&&pe!==Q&&(console.log(`[preview-panel] 模板 ${J} renderData签名已变化,需要重新渲染`),console.log(`[preview-panel] 旧签名: ${pe.substring(0,50)}...`),console.log(`[preview-panel] 新签名: ${Q.substring(0,50)}...`)),console.log(`[preview-panel] 模板 ${J} 开始渲染大图`);const fe=++I,ge={...O,width:Bt,height:Bt};if(te(),!q)throw new Error("Web Worker 不可用,无法在 worker 中渲染大图");try{const ze=await R(ge);if(!ze)throw new Error("Worker 渲染返回空结果");if(fe!==I){(ke=ze.close)==null||ke.call(ze);return}await Pe(ze,J,O)}catch(ze){throw console.error("[preview-panel] renderLargePreview in worker failed:",ze),ze}},We=async()=>{i.value=!0,o.value=1,await t.nextTick();const O=r.templateIndex,$=c.get(O),J=y.get(O);if(J||$){$&&(n.value&&n.value.close&&n.value.close(),n.value=$),J?(e.value&&e.value!==J&&ue(),e.value=J):$&&Ae($);const ne=h.value;if(ne&&n.value){ne.width=n.value.width,ne.height=n.value.height;const de=ne.getContext("2d");de&&(de.clearRect(0,0,ne.width,ne.height),de.drawImage(n.value,0,0))}p.value=!1,G();return}const Q=r.renderData;if(Q){p.value=!0;try{await Ue(Q,O),await t.nextTick();const ne=h.value;if(ne&&n.value){ne.width=n.value.width,ne.height=n.value.height;const de=ne.getContext("2d");de&&(de.clearRect(0,0,ne.width,ne.height),de.drawImage(n.value,0,0))}p.value=!1,G()}catch(ne){console.error("[preview-panel] 在 web worker 中渲染大图失败:",ne),p.value=!1}}else p.value=!1},g=async O=>{if(p.value)return;let $;if(O==="prev"){if(!Z.value)return;$=r.templateIndex-1}else{if(!re.value)return;$=r.templateIndex+1}let J=null;if(r.getRenderDataForIndex)try{J=await r.getRenderDataForIndex($)}catch(fe){console.error(`[preview-panel] 获取模板 ${$} 渲染数据失败:`,fe);return}else J=r.renderData;if(!J){console.warn(`[preview-panel] 模板 ${$} 没有渲染数据`);return}const Q=N(J),ne=_.get(Q),de=S.get(Q);if(ne||de){if(console.log(`[preview-panel] 模板 ${$} 从签名缓存中获取大图(元素未变化)`),de){if(e.value&&e.value!==de&&ue(),e.value=de,ne)try{const fe=await createImageBitmap(ne);await Pe(fe,$,J),n.value&&n.value.close&&n.value.close(),n.value=fe}catch(fe){console.warn("[preview-panel] 从签名缓存克隆bitmap失败,仅使用blobUrl:",fe),_.delete(Q)}await t.nextTick(),G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}if(ne)try{const fe=await createImageBitmap(ne);await Pe(fe,$,J),n.value&&n.value.close&&n.value.close(),n.value=fe,Ae(fe),await t.nextTick();const ge=h.value;if(ge&&n.value){ge.width=n.value.width,ge.height=n.value.height;const ke=ge.getContext("2d");ke&&(ke.clearRect(0,0,ge.width,ge.height),ke.drawImage(n.value,0,0))}G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}catch(fe){console.warn("[preview-panel] 从签名缓存克隆bitmap失败,尝试其他方式:",fe),_.delete(Q),de&&de!==e.value?(URL.revokeObjectURL(de),S.delete(Q)):de&&S.delete(Q)}}const xe=c.get($),ve=y.get($),pe=k.get($);if((xe||ve)&&pe===Q){if(console.log(`[preview-panel] 模板 ${$} 从索引缓存中获取大图(元素未变化)`),ve){if(e.value&&e.value!==ve&&ue(),e.value=ve,xe)try{const fe=document.createElement("canvas");fe.width=xe.width,fe.height=xe.height;const ge=fe.getContext("2d");ge&&(ge.drawImage(xe,0,0),n.value&&n.value.close&&n.value.close(),n.value=xe)}catch(fe){console.warn("[preview-panel] 索引缓存的bitmap不可用,仅使用blobUrl:",fe),c.delete($)}await t.nextTick(),G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}if(xe){try{const fe=document.createElement("canvas");fe.width=xe.width,fe.height=xe.height;const ge=fe.getContext("2d");ge&&(ge.drawImage(xe,0,0),n.value&&n.value.close&&n.value.close(),n.value=xe,Ae(xe))}catch(fe){console.warn("[preview-panel] 索引缓存的bitmap不可用,需要重新渲染:",fe),c.delete($),k.delete($)}if(c.has($)){await t.nextTick();const fe=h.value;if(fe&&n.value){fe.width=n.value.width,fe.height=n.value.height;const ge=fe.getContext("2d");ge&&(ge.clearRect(0,0,fe.width,fe.height),ge.drawImage(n.value,0,0))}G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}}}console.log(pe&&pe!==Q?`[preview-panel] 模板 ${$} 元素已变化,需要重新渲染`:`[preview-panel] 模板 ${$} 缓存中没有大图,需要渲染`),j=!0,p.value=!0,l(O==="prev"?"prev-template":"next-template"),await t.nextTick();try{await Ue(J,$),await t.nextTick();const fe=h.value;if(fe&&n.value){fe.width=n.value.width,fe.height=n.value.height;const ge=fe.getContext("2d");ge&&(ge.clearRect(0,0,fe.width,fe.height),ge.drawImage(n.value,0,0))}p.value=!1,G()}catch(fe){console.error(`[preview-panel] 在 web worker 中渲染模板 ${$} 大图失败:`,fe),p.value=!1}},ae=()=>{p.value||(i.value=!1,p.value=!1,o.value=1)},te=()=>{q||typeof Worker>"u"||typeof OffscreenCanvas>"u"||(q=new Worker(new URL("/assets/renderWorker-xde7w90h.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:st&&st.tagName.toUpperCase()==="SCRIPT"&&st.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"}),q.onmessage=O=>{const{id:$,bitmap:J,error:Q}=O.data||{},ne=he.get($);if(ne){if(he.delete($),Q){ne.reject(new Error(Q));return}ne.resolve(J??null)}},q.onerror=O=>{he.forEach(({reject:$})=>$(new Error(O.message||"render worker error"))),he.clear()})},M=O=>{if(O==null||typeof O!="object"||O instanceof ImageBitmap||O instanceof Blob||O instanceof ArrayBuffer)return O;if(Array.isArray(O))return O.map(J=>M(J));const $={};for(const J in O)Object.prototype.hasOwnProperty.call(O,J)&&($[J]=M(O[J]));return $},R=async O=>{if(te(),!q)return Promise.resolve(null);const $=++F,J=new Promise((de,xe)=>{he.set($,{resolve:de,reject:xe})}),Q=await kr(O),ne=M(Q);return q.postMessage({id:$,renderData:ne}),J};t.watch(()=>r.renderData,async O=>{var Q;const $=E.value;if(!O||!$){ye(),Re(),d.value=!1;return}const J=++T;try{const ne={...O,width:1600,height:1600};console.log(ne);let de=null;try{de=await R(ne)}catch(fe){console.warn("[preview-panel] render worker failed, fallback to main thread.",fe)}if(J!==T){(Q=de==null?void 0:de.close)==null||Q.call(de),d.value=!1;return}if(de){V&&V.close&&V.close(),V=de,B(),Ce(de);const fe=r.templateIndex;await Pe(de,fe,O),d.value=!1;return}const xe=await Zt(ne);if(J!==T){d.value=!1;return}const ve=xe.canvas??xe;if(!ve||!$){d.value=!1;return}V=ve,B(),Ce(ve);const pe=r.templateIndex;try{const fe=await createImageBitmap(ve);await Pe(fe,pe,O)}catch(fe){console.warn("[preview-panel] 从 canvas 创建 ImageBitmap 失败:",fe)}d.value=!1}catch(ne){console.error("[preview-panel] renderByJson failed:",ne),d.value=!1}},{immediate:!0}),t.watch(()=>r.previewTitle,()=>{d.value=!0}),t.watch([e,n],()=>{(e.value||n.value)&&(p.value=!1)}),t.watch(()=>r.templateIndex,(O,$)=>{if(j){j=!1;return}if(i.value){const J=c.get(O),Q=y.get(O);if(console.log(`[preview-panel] templateIndex 变化到 ${O},缓存检查:`,{hasBitmap:!!J,hasBlobUrl:!!Q,mapSize:c.size,blobMapSize:y.size}),J||Q){console.log(`[preview-panel] 模板 ${O} 从缓存中获取大图(templateIndex watch)`),J&&(n.value&&n.value.close&&n.value.close(),n.value=J),Q?(e.value&&e.value!==Q&&ue(),e.value=Q):J&&Ae(J),t.nextTick(()=>{const de=h.value;if(de&&n.value){de.width=n.value.width,de.height=n.value.height;const xe=de.getContext("2d");xe&&(xe.clearRect(0,0,de.width,de.height),xe.drawImage(n.value,0,0))}G()});return}const ne=r.renderData;ne&&(console.log(`[preview-panel] 模板 ${O} 缓存中没有大图,调用 renderLargePreview(templateIndex watch)`),p.value=!0,Ue(ne,O).then(()=>{t.nextTick(()=>{const de=h.value;if(de&&n.value){de.width=n.value.width,de.height=n.value.height;const xe=de.getContext("2d");xe&&(xe.clearRect(0,0,de.width,de.height),xe.drawImage(n.value,0,0))}p.value=!1,G()})}).catch(de=>{console.error("[preview-panel] 切换模板渲染大图失败:",de),p.value=!1}))}});const G=()=>{const O=h.value;O&&(O.style.transform=`scale(${o.value})`)},le=O=>{if(p.value)return;O.preventDefault();const J=(O.deltaY||0)>0?-.1:.1,Q=Math.min(4,Math.max(.2,Number((o.value+J).toFixed(2))));o.value=Q,G()},se=O=>{if(p.value)return;const $=Math.min(4,Math.max(.2,Number((o.value+O).toFixed(2))));o.value=$,G()};return t.onMounted(()=>{B(),b.value&&(H=new ResizeObserver(()=>{W&&cancelAnimationFrame(W),W=requestAnimationFrame(()=>{B(),V&&Ce(V)})}),H.observe(b.value),E.value&&H.observe(E.value))}),t.onBeforeUnmount(()=>{W&&(cancelAnimationFrame(W),W=0),H&&b.value&&H.unobserve(b.value),H=null,Re(),V&&V.close&&V.close(),V=null,q&&(q.terminate(),q=null,he.clear())}),(O,$)=>(t.openBlock(),t.createElementBlock("aside",A0,[t.createElementVNode("div",D0,[$[7]||($[7]=t.createElementVNode("span",null,"预览效果",-1)),t.createElementVNode("button",{class:"ghost",type:"button",disabled:p.value||v.value,onClick:K},[v.value?(t.openBlock(),t.createElementBlock("span",S0,"下载中...")):(t.openBlock(),t.createElementBlock("span",N0,"下载"))],8,F0)]),t.createElementVNode("div",{ref_key:"previewBody",ref:b,class:"preview-body"},[x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:0,class:"preview-nav preview-nav-left",type:"button",disabled:!Z.value||d.value,"aria-label":"上一张",onClick:$[0]||($[0]=J=>l("prev-template"))}," < ",8,I0)):t.createCommentVNode("",!0),t.createElementVNode("div",R0,[t.createElementVNode("canvas",{ref_key:"previewCanvas",ref:E,"aria-label":x.previewTitle,class:"preview-canvas",onClick:We},null,8,z0),d.value?(t.openBlock(),t.createElementBlock("div",T0,[...$[8]||($[8]=[t.createElementVNode("span",{class:"preview-loading-spinner"},null,-1),t.createElementVNode("span",null,"加载中...",-1)])])):t.createCommentVNode("",!0)]),x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:1,class:"preview-nav preview-nav-right",type:"button",disabled:!re.value||d.value,"aria-label":"下一张",onClick:$[1]||($[1]=J=>l("next-template"))}," > ",8,O0)):t.createCommentVNode("",!0),x.templateTotal>0?(t.openBlock(),t.createElementBlock("div",L0,t.toDisplayString(ee.value)+"/"+t.toDisplayString(x.templateTotal),1)):t.createCommentVNode("",!0)],512),i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"preview-zoom-backdrop",onClick:$[6]||($[6]=t.withModifiers(J=>p.value?void 0:ae,["self"])),onWheelPassive:t.withModifiers(le,["prevent"])},[t.createElementVNode("div",P0,[p.value?(t.openBlock(),t.createElementBlock("div",U0,[...$[9]||($[9]=[t.createElementVNode("span",{class:"preview-zoom-spinner"},null,-1),t.createElementVNode("span",null,"大图生成中...",-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",M0,[t.createElementVNode("button",{class:"preview-zoom-btn",type:"button",disabled:p.value,onClick:$[2]||($[2]=J=>se(.2))}," + ",8,V0),t.createElementVNode("button",{class:"preview-zoom-btn",type:"button",disabled:p.value,onClick:$[3]||($[3]=J=>se(-.2))}," - ",8,W0)]),x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:1,class:"preview-zoom-nav preview-zoom-nav-left",type:"button",disabled:p.value||!Z.value,"aria-label":"上一张",onClick:$[4]||($[4]=J=>g("prev"))}," < ",8,$0)):t.createCommentVNode("",!0),x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:2,class:"preview-zoom-nav preview-zoom-nav-right",type:"button",disabled:p.value||!re.value,"aria-label":"下一张",onClick:$[5]||($[5]=J=>g("next"))}," > ",8,H0)):t.createCommentVNode("",!0),e.value?(t.openBlock(),t.createElementBlock("img",{key:3,src:e.value,class:"preview-zoom-image",alt:"large-preview",style:t.normalizeStyle({transform:`scale(${o.value})`})},null,12,q0)):(t.openBlock(),t.createElementBlock("canvas",{key:4,ref_key:"largePreviewCanvas",ref:h,class:"preview-zoom-canvas",style:t.normalizeStyle({transform:`scale(${o.value})`})},null,4)),t.createElementVNode("button",{class:"preview-zoom-close",type:"button",disabled:p.value,onClick:ae}," × ",8,X0)])],32)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"progress-fade"},{default:t.withCtx(()=>[C.value?(t.openBlock(),t.createElementBlock("div",Z0,[$[15]||($[15]=t.createElementVNode("div",{class:"progress-backdrop"},null,-1)),$[16]||($[16]=t.createElementVNode("div",{class:"gradient-bg"},null,-1)),t.createElementVNode("div",G0,[$[14]||($[14]=t.createElementVNode("div",{class:"floating-shapes"},[t.createElementVNode("div",{class:"floating-shape shape-1"}),t.createElementVNode("div",{class:"floating-shape shape-2"}),t.createElementVNode("div",{class:"floating-shape shape-3"})],-1)),t.createElementVNode("div",Y0,[$[12]||($[12]=t.createElementVNode("div",{class:"progress-title"},[t.createElementVNode("div",{class:"title-text"},"后台服务渲染中")],-1)),t.createElementVNode("div",K0,[t.createElementVNode("div",j0,[t.createElementVNode("div",{class:"progress-bar-fill",style:t.normalizeStyle({width:`${m.value}%`})},[...$[10]||($[10]=[t.createElementVNode("div",{class:"liquid-shine"},null,-1)])],4),t.createElementVNode("div",J0,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(10,J=>t.createElementVNode("div",{key:J,class:t.normalizeClass(["progress-mark",{active:m.value>=J*10}])},null,2)),64))])]),t.createElementVNode("div",Q0,[t.createElementVNode("span",{class:"percent-number","data-value":Math.round(m.value)},t.toDisplayString(Math.round(m.value)),9,es),$[11]||($[11]=t.createElementVNode("span",{class:"percent-symbol"},"%",-1))])]),$[13]||($[13]=t.createElementVNode("div",{class:"progress-footer"},[t.createElementVNode("div",{class:"footer-dot"}),t.createElementVNode("div",{class:"footer-dot"}),t.createElementVNode("div",{class:"footer-dot"})],-1))])])])):t.createCommentVNode("",!0)]),_:1})]))]))}}),[["__scopeId","data-v-5c7a9d71"]]),rs={class:"modal"},ns={class:"modal-header"},as={class:"modal-body"},os={class:"mode-list"},is=["onClick"],ss={key:0,class:"badge"},ls=t.defineComponent({__name:"TemplateModal",props:{templateModeOptions:{type:Array,default:()=>[]},selectedMode:{type:String,default:""}},emits:["update:selected-mode","close"],setup(x,{emit:X}){const r=X;return(l,E)=>(t.openBlock(),t.createElementBlock("div",{class:"modal-backdrop",onClick:E[1]||(E[1]=t.withModifiers(f=>r("close"),["self"]))},[t.createElementVNode("div",rs,[t.createElementVNode("div",ns,[E[2]||(E[2]=t.createElementVNode("span",null,"切换模版",-1)),t.createElementVNode("button",{class:"ghost icon",type:"button",onClick:E[0]||(E[0]=f=>r("close"))},"×")]),t.createElementVNode("div",as,[t.createElementVNode("div",os,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.templateModeOptions,f=>(t.openBlock(),t.createElementBlock("button",{key:f.type,class:t.normalizeClass(["mode-card",{active:x.selectedMode===f.type}]),type:"button",onClick:b=>r("update:selected-mode",f.type)},[t.createElementVNode("div",null,[t.createElementVNode("h4",null,t.toDisplayString(f.label),1),t.createElementVNode("p",null,"尺寸:"+t.toDisplayString(f.size),1)]),x.selectedMode===f.type?(t.openBlock(),t.createElementBlock("span",ss,"默认")):t.createCommentVNode("",!0)],10,is))),128))])])])]))}}),cs={class:"editor"},ds={class:"main"},lt="guide-resource",fs=10*1024*1024,sn=t.defineComponent({__name:"index",props:{product:{default:null},basicInfo:{default:null},diecutData:{default:null},deformationData:{default:null},options:{default:()=>({showTopbar:!0,showSidebar:!0,showPreview:!0,enableGrid:!0})},productListApi:{},productDetailApi:{},productListPageSize:{},productListInitialPage:{}},setup(x){var $a;const X=x,r=t.computed(()=>typeof X.productListApi=="function"),l=t.ref([]),E=t.ref(0),f=t.ref(X.productListInitialPage??1),b=t.ref(X.productListPageSize??8),i=t.ref(null),p=t.ref(null),d=t.ref(null),v=t.computed(()=>r.value?i.value:X.basicInfo),C=t.computed(()=>r.value?p.value:X.diecutData),m=t.computed(()=>r.value?d.value:X.deformationData),s=t.ref(null),h=t.ref(null),n=t.ref(""),e=t.ref(r.value?"product":"layer"),o=t.ref(!!(($a=X.options)!=null&&$a.enableGrid)),c=t.ref(100),y=t.ref([]),k=t.ref(null),_=t.ref({visible:!1,mode:"",scale:100,isPattern:!1}),S=t.ref({visible:!1,opacity:1}),I=t.ref({visible:!1,fontFamily:"Arial",fontSize:26,charSpacing:0,lineHeight:1.16,fill:"#111827",strokeWidth:0,stroke:"#000000"}),H=t.computed(()=>_.value.visible||I.value.visible||S.value.visible),V=t.ref(0),T=t.ref(0),q=t.ref(""),F=t.ref(!1),W=t.ref(""),w=t.ref(!1),j=t.ref(""),he=t.ref(0),Z=t.ref(""),re=t.ref(!1),ee=t.computed(()=>{var a;return((a=X.options)==null?void 0:a.showTopbar)!==!1}),ce=t.computed(()=>{var a;return((a=X.options)==null?void 0:a.showSidebar)!==!1}),N=t.computed(()=>{var a;return((a=X.options)==null?void 0:a.showPreview)!==!1});t.watch(()=>{var a;return(a=X.options)==null?void 0:a.enableGrid},a=>{typeof a=="boolean"&&(o.value=a)}),t.watch(r,a=>{e.value=a?"product":"layer"});const z=new Map,Y=(a,u)=>{!a||!u||z.set(a,JSON.parse(JSON.stringify(u)))},K=a=>a?z.get(a)??null:null;let B=null,ye=1,Ce=null,ue=null,Ae=!1,Re=null,Pe=0,Ue=null,We=0,g=!1,ae=!1,te=!1;const M={width:0,height:0};let R=0,G=0,le=null;const se=()=>{h.value&&(R&&cancelAnimationFrame(R),R=requestAnimationFrame(()=>{if(!h.value)return;const a=Math.max(h.value.clientWidth,1),u=Math.max(h.value.clientHeight,1);Math.abs(a-M.width)<1&&Math.abs(u-M.height)<1||xn()}))},O=new Map,$=new Map;let J=null;const Q=new Map,ne=a=>{console.log("queuePreviewUpdate",a),J&&clearTimeout(J),J=setTimeout(async()=>{try{Me();const u=pe.value[T.value];if(!(u!=null&&u.jsonURL))return;const D=await(await dt(mt(u.jsonURL))).json(),L=new URL(".",new URL(u.jsonURL,window.location.href)).toString(),P=ar(u.resources||[]),U=Pt(D.layerList||[]),oe=Dt(),ie=Z.value?String(Z.value):"";if(ie){const Ee=await ol();if(Ee){er.set(ie,Ee);const Fe=pt.get(ie);Fe&&URL.revokeObjectURL(Fe),pt.set(ie,URL.createObjectURL(Ee))}else console.warn("[ui-editor] 无法生成遮罩截图,预览可能不完整。")}const me=oe.map(Ee=>{const Fe=U.get(Ee.name);if(!Fe)return null;const Ve=pt.get(Ee.id);return Ve?{id:Fe,url:Ve}:null}).filter(Boolean),we={psdJson:D,materialList:P,fabricScreenshotList:me,width:300,height:300,baseUrl:L};et.value=we}catch(u){console.error("[ui-editor] renderByJson failed:",u)}finally{J=null}},10)},de=()=>{if(!h.value)return 700;const a=h.value.clientWidth||700,u=h.value.clientHeight||700;return Math.max(400,Math.min(a,u)-40)},xe=({canvasEl:a,canvasWrap:u})=>{s.value=a,h.value=u},ve=(a=[])=>a!=null&&a.length?(a.find(A=>/bg|背景/i.test(A.name))??a[0]).url:"",pe=t.computed(()=>{var A;return(((A=m.value)==null?void 0:A.data)??[]).flatMap(D=>(D==null?void 0:D.infos)??[]).map((D,L)=>({id:`${D.name}-${L}`,name:D.name,resources:D.resources??[],jsonURL:D.jsonURL,thumb:ve(D.resources)}))}),fe=t.computed(()=>pe.value.length),ge=t.computed(()=>T.value>0),ke=t.computed(()=>T.value<pe.value.length-1),ze=()=>{ge.value&&(T.value-=1)},qe=()=>{ke.value&&(T.value+=1)},$e=t.computed(()=>r.value?l.value:X.product?[X.product]:[]);t.computed(()=>pe.value[V.value]);const Ze=t.computed(()=>$e.value[he.value]);t.computed(()=>r.value&&Number.isFinite(E.value));const Xe=t.computed(()=>r.value?E.value:$e.value.length),ct=t.computed(()=>b.value?Math.max(1,Math.ceil(Xe.value/b.value)):1),Ge=t.computed(()=>f.value>1),ot=t.computed(()=>f.value<ct.value),Je=t.computed(()=>{var a;return((a=v.value)==null?void 0:a.sizes)??[]}),et=t.ref(null),ln=t.computed(()=>{var a,u;return(a=Ze.value)!=null&&a.name?Ze.value.name:((u=v.value)==null?void 0:u.name)||"预览效果"}),Kt=t.ref(null),Ot=()=>{var D,L,P,U,oe;const a=Number(((D=Ze.value)==null?void 0:D.id)??((L=v.value)==null?void 0:L.id)),u=`${((P=v.value)==null?void 0:P.name)??""}:${(((U=C.value)==null?void 0:U.data)??[]).length}:${(((oe=m.value)==null?void 0:oe.data)??[]).length}`,A=Number.isFinite(a)?`id:${a}`:`data:${u}`;if(Kt.value!==A){if(Kt.value=A,B){Wt();const ie=B.getObjects();ie.length>0&&(ie.forEach(me=>{B.remove(me)}),B.requestRenderAll()),B.discardActiveObject(),Me(),tt(),Ke(),rt()}et.value=null,Z.value="",V.value=0,T.value=0}},jt=async(a=f.value)=>{if(X.productListApi)try{const u=await X.productListApi(a,b.value);l.value=(u==null?void 0:u.rows)??[],E.value=Number.isFinite(u==null?void 0:u.total)?Number(u==null?void 0:u.total):l.value.length,f.value=a}catch(u){console.warn("[ui-editor] 获取产品列表失败",u)}},cn=async a=>{if(!X.productDetailApi){console.warn("[ui-editor] 未传 productDetailApi,无法加载产品详情");return}try{const u=await X.productDetailApi(a);i.value=(u==null?void 0:u.basicInfo)??null,p.value=(u==null?void 0:u.diecutData)??null,d.value=(u==null?void 0:u.deformationData)??null}catch(u){console.warn("[ui-editor] 获取产品详情失败",u)}};t.watch(e,a=>{if(B&&a==="layer"){Me();const u=B.getActiveObject();u&&(tt(u,!1),Ke(u),rt(u,!1))}}),t.watch([he,$e],()=>{var a;if($e.value.length&&he.value>=$e.value.length){he.value=0;return}if(Ot(),r.value){const u=(a=Ze.value)==null?void 0:a.id;u!=null&&cn(u)}}),t.watch(()=>[X.basicInfo,X.diecutData,X.deformationData],()=>{r.value||Ot()},{deep:!0});const Jt=async a=>{r.value&&(a<1||a>ct.value||a!==f.value&&(await jt(a),he.value=0))},Lt=async()=>{const a=pe.value[T.value];if(!(a!=null&&a.jsonURL))return;const A=await(await dt(mt(a.jsonURL))).json(),D=new URL(".",new URL(a.jsonURL,window.location.href)).toString(),L=ar(a.resources||[]),P=Pt(A.layerList||[]),oe=Dt().map(me=>{const we=P.get(me.name);if(!we)return null;const Ee=_a(me.id);return Ee?{id:we,url:Ee}:null}).filter(Boolean),ie={psdJson:A,materialList:L,fabricScreenshotList:oe,width:1e3,height:1e3,baseUrl:D};et.value=ie},Qt=async a=>{const u=pe.value[a];if(!(u!=null&&u.jsonURL))return null;try{const D=await(await dt(mt(u.jsonURL))).json(),L=new URL(".",new URL(u.jsonURL,window.location.href)).toString(),P=ar(u.resources||[]),U=Pt(D.layerList||[]),ie=Dt().map(me=>{const we=U.get(me.name);if(!we)return null;const Ee=_a(me.id);return Ee?{id:we,url:Ee}:null}).filter(Boolean);return{psdJson:D,materialList:P,fabricScreenshotList:ie,width:1e3,height:1e3,baseUrl:L}}catch(A){return console.error(`[ui-editor] 构建模板 ${a} 的 renderData 失败:`,A),null}},Qe=t.computed(()=>{var u;return(((u=C.value)==null?void 0:u.data)??[]).filter(A=>A==null?void 0:A.jsonURL).map(A=>({type:A.type,label:A.type==="SPLIT"?"多图拼模板设计":"单片",size:A.size,jsonURL:A.jsonURL,resources:A.resources??[]}))}),it=t.computed(()=>{var D;const u=(((D=C.value)==null?void 0:D.data)??[]).filter(L=>(L==null?void 0:L.type)==="SPLIT").flatMap(L=>(L==null?void 0:L.resources)??[]),A=new Map;return u.forEach(L=>{if(!(L!=null&&L.groupId))return;const P=A.get(L.groupId)??{id:L.groupId,name:L.groupName||`刀板${A.size+1}`,mask:null,dotted:null,resources:[]};P.resources.push(L),L.type==="MASK"&&(P.mask=L),L.type==="DOTTED_LINE"&&(P.dotted=L),A.set(L.groupId,P)}),A}),_t=t.computed(()=>Array.from(it.value.values()).map(a=>{var u,A;return{id:a.id,name:a.name,url:((u=a.mask)==null?void 0:u.url)||((A=a.resources[0])==null?void 0:A.url)||""}})),dn=new Set(["MASK","DOTTED_LINE"]),hs=a=>dn.has(a==null?void 0:a.type),er=new Map,pt=new Map,tr=new Map,rr=new Map,_a=a=>{if(!a)return"";const u=pt.get(a);if(u)return u;const A=er.get(a);if(!A)return"";const D=URL.createObjectURL(A);return pt.set(a,D),D},At=(a,u)=>(a.customData={id:ye++,label:u},a),Aa=a=>(a==null?void 0:a.type)==="textbox"||(a==null?void 0:a.type)==="i-text",ft=a=>{var A;if(!a||a.excludeFromExport)return!1;const u=(A=a.customData)==null?void 0:A.role;return!(u===lt||u==="guide")},ps=a=>{var A;if(!a||a.excludeFromExport)return!1;const u=(A=a.customData)==null?void 0:A.role;return!(u===lt||u==="guide"||u==="grid")},xs=a=>{const u=JSON.parse(JSON.stringify(a));return u.customData||(u.customData={}),u.customData.id=ye++,u},fn=a=>Number.isFinite(a)?Math.min(200,Math.max(1,Math.round(a))):100,nr=a=>!a||a===""?"":a==="brick"?"brick-x":a==="brick-x"||a==="brick-y"||a==="mirror"||a==="random"?a:"grid",ms=a=>{if(!a)return null;const u=a.width??a.naturalWidth,A=a.height??a.naturalHeight;return!u||!A?null:{width:u,height:A}},Da=(a,u,A,D)=>{if(!B||!a||!u||!A)return;const L=B.getWidth(),P=B.getHeight(),U=u*D,oe=A*D;!U||!oe||(a.offsetX=(L-U)/2,a.offsetY=(P-oe)/2)},vs=(a,u,A,D,L,P,U=!1,oe=!1)=>{a.save(),a.translate(A+(U?L:0),D+(oe?P:0)),a.scale(U?-1:1,oe?-1:1),a.drawImage(u,0,0,L,P),a.restore()},gs=a=>{var u,A,D,L;return a?(u=a==null?void 0:a.customData)!=null&&u.isPatternRect?((A=a.customData)==null?void 0:A.patternSource)||"":(a==null?void 0:a.type)==="image"&&(((D=a.customData)==null?void 0:D.savedSrc)||((L=a.getSrc)==null?void 0:L.call(a))||a.src)||"":""},ys=async(a,u)=>{var D;const A=a==null?void 0:a.patternElement;if(A)return A;if((a==null?void 0:a.type)==="image"){const L=((D=a.getElement)==null?void 0:D.call(a))||a._element;if(L)return L}return await un(u)},ws=(a,u)=>{const A=a.naturalWidth||a.width,D=a.naturalHeight||a.height,L=nr(u);if(L==="grid"||L==="")return a;const P=document.createElement("canvas"),U=P.getContext("2d");if(!U)return a;if(L==="brick-x")return P.width=A,P.height=D*2,U.drawImage(a,0,0,A,D),U.drawImage(a,-A/2,D,A,D),U.drawImage(a,A/2,D,A,D),P;if(L==="brick-y")return P.width=A*2,P.height=D,U.drawImage(a,0,0,A,D),U.drawImage(a,A,-D/2,A,D),U.drawImage(a,A,D/2,A,D),P;if(L==="mirror")return P.width=A*2,P.height=D*2,U.drawImage(a,0,0,A,D),U.save(),U.translate(A*2,0),U.scale(-1,1),U.drawImage(a,0,0,A,D),U.restore(),U.save(),U.translate(0,D*2),U.scale(1,-1),U.drawImage(a,0,0,A,D),U.restore(),U.save(),U.translate(A*2,D*2),U.scale(-1,-1),U.drawImage(a,0,0,A,D),U.restore(),P;if(L==="random"){P.width=A*3,P.height=D*3;for(let me=0;me<3;me++)for(let we=0;we<3;we++){const Ee=Math.random()<.5,Fe=Math.random()<.5;vs(U,a,we*A,me*D,A,D,Ee,Fe)}return P}return a},tt=(a,u=!0)=>{var oe,ie,me;if(!B){_.value={visible:!1,mode:"grid",scale:100,isPattern:!1};return}const A=a??B.getActiveObject(),D=!!((oe=A==null?void 0:A.customData)!=null&&oe.isPatternRect),L=(A==null?void 0:A.type)==="image"||D;if(!A||!L){_.value={visible:!1,mode:"",scale:100,isPattern:!1};return}const P=nr(((ie=A.customData)==null?void 0:ie.patternMode)||""),U=fn(((me=A.customData)==null?void 0:me.patternScale)??Math.round((A.scaleX??1)*100));_.value={visible:!0,mode:P,scale:U,isPattern:D},u&&e.value!=="add"&&(e.value="add")},Ke=a=>{if(!B){S.value={visible:!1,opacity:1};return}const u=a??B.getActiveObject();if(!ft(u)){S.value={visible:!1,opacity:1};return}S.value={visible:!0,opacity:typeof u.opacity=="number"?u.opacity:1}},rt=(a,u=!0)=>{if(!B){I.value={visible:!1,fontFamily:"Arial",fontSize:26,charSpacing:0,lineHeight:1.16,fill:"#111827",strokeWidth:0,stroke:"#000000"};return}const A=a??B.getActiveObject();if(!Aa(A)){I.value={visible:!1,fontFamily:"Arial",fontSize:26,charSpacing:0,lineHeight:1.16,fill:"#111827",strokeWidth:0,stroke:"#000000"};return}I.value={visible:!0,fontFamily:A.fontFamily||"Arial",fontSize:A.fontSize??26,charSpacing:A.charSpacing??0,lineHeight:A.lineHeight??1.16,fill:A.fill||"#111827",strokeWidth:A.strokeWidth??0,stroke:A.stroke||"#000000"},u&&e.value!=="layer"&&e.value!=="add"&&(e.value="add")},bs=a=>{if(!a)return"";const u=a.match(/^image_(.+?)_[a-zA-Z0-9]+\.png$/);return(u==null?void 0:u[1])||a},ar=(a=[])=>a.filter(u=>u==null?void 0:u.url).map(u=>{const A=u.name||u.groupName||u.fileName||"";return{layerName:bs(A),url:u.url||"",sourceName:A}}).filter(u=>u.layerName&&u.url),Dt=()=>{var D;const u=(((D=C.value)==null?void 0:D.data)??[]).filter(L=>(L==null?void 0:L.type)==="SPLIT").flatMap(L=>(L==null?void 0:L.resources)??[]),A=new Map;return u.forEach(L=>{if(!(L!=null&&L.groupId))return;const P=String(L.groupId),U=A.get(P)??{id:P,name:L.groupName||`刀板${A.size+1}`};L.type==="MASK"&&(U.mask=L),A.set(P,U)}),Array.from(A.values()).filter(L=>{var P;return(P=L.mask)==null?void 0:P.url})},Pt=(a,u=new Map)=>(a.forEach(A=>{(A==null?void 0:A.type)==="Group"&&(A!=null&&A.id)&&(A!=null&&A.name)&&u.set(A.name,A.id),Array.isArray(A.children)&&Pt(A.children,u)}),u),mt=a=>{if(!a)return a;if(typeof window<"u"){const A=window.location.hostname;if(A==="localhost"||A==="127.0.0.1")try{const D=new URL(a);if(D.pathname.startsWith("/files/"))return`${D.pathname}${D.search}${D.hash}`}catch{}}const u=a.match(/^https?:\/\/([^/]+\.oss[^/]*\.aliyuncs\.com)(.*)$/);return u?`/oss${u[2]}`:a},Fa=a=>{if(!a||a.startsWith("data:")||a.startsWith("blob:"))return Promise.resolve(a);const u=a.includes("/files/");if(a.startsWith("/")&&!u)return Promise.resolve(a);const A=tr.get(a);if(A)return Promise.resolve(A);const D=rr.get(a);if(D)return D;const L=dt(mt(a),{mode:"cors"}).then(P=>{if(!P.ok)throw new Error(`fetch failed: ${P.status}`);return P.blob()}).then(P=>{const U=URL.createObjectURL(P);return tr.set(a,U),rr.delete(a),U}).catch(()=>(rr.delete(a),mt(a)));return rr.set(a,L),L},un=a=>Fa(a).then(u=>new Promise((A,D)=>{const L=new Image;L.crossOrigin="anonymous",L.onload=()=>A(L),L.onerror=D,L.src=u})),vt=(a,u="image/png",A)=>new Promise((D,L)=>{a.toBlob(P=>{if(!P){L(new Error("canvas toBlob failed"));return}D(P)},u,A)}),ks=()=>{Re||typeof Worker>"u"||typeof OffscreenCanvas>"u"||(Re=new Worker(new URL("/assets/maskWorker-ZKs7ClE6.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:st&&st.tagName.toUpperCase()==="SCRIPT"&&st.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"}),Re.onmessage=a=>{const{id:u,arrayBuffer:A,error:D}=a.data||{},L=O.get(u);if(L){if(O.delete(u),D){L.reject(new Error(D));return}L.resolve(A?new Blob([A],{type:"image/png"}):null)}},Re.onerror=a=>{O.forEach(({reject:u})=>u(new Error(a.message||"mask worker error"))),O.clear()})},Es=a=>{if(ks(),!Re)return Promise.resolve(null);const u=++Pe,A=new Promise((D,L)=>{O.set(u,{resolve:D,reject:L})});return Re.postMessage({id:u,...a}),A},Cs=()=>{Ue||typeof Worker>"u"||(Ue=new Worker(new URL("/assets/copyDiecuts.worker-DToLkwQW.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:st&&st.tagName.toUpperCase()==="SCRIPT"&&st.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"}),Ue.onmessage=a=>{const{id:u,ok:A,data:D,error:L}=a.data||{},P=$.get(u);if(P){if($.delete(u),!A||L){P.reject(new Error(L||"copy worker failed"));return}P.resolve(D)}},Ue.onerror=a=>{$.forEach(({reject:u})=>u(new Error(a.message||"copy worker error"))),$.clear()})},Bs=a=>{if(Cs(),!Ue)return Promise.resolve(null);const u=++We,A=new Promise((D,L)=>{$.set(u,{resolve:D,reject:L})});return Ue.postMessage({id:u,...a}),A},Ft=async(a,u,A)=>{const D=at.Image,L={crossOrigin:"anonymous",...A??{}},P=await Fa(a);if(P){if(P.startsWith("blob:")||P.startsWith("data:")){const U=D.fromURL(P,u,L);U!=null&&U.then&&U.then(u).catch(()=>{});return}try{const U=await dt(P,{mode:"cors"});if(!U.ok)throw new Error(`fetch failed: ${U.status}`);const oe=await U.blob(),ie=URL.createObjectURL(oe),me=D.fromURL(ie,we=>{URL.revokeObjectURL(ie),u(we)},L);me!=null&&me.then&&me.then(we=>{URL.revokeObjectURL(ie),u(we)}).catch(()=>{URL.revokeObjectURL(ie)});return}catch(U){console.warn("[loadFabricImage] 使用 blob 失败:",U)}}},Me=()=>{var D;if(!B)return;const u=[...B.getObjects().filter(L=>!L.excludeFromExport)].reverse();y.value=u.map(L=>{var P,U;return{id:((P=L.customData)==null?void 0:P.id)??L.type,name:((U=L.customData)==null?void 0:U.label)??L.type,object:L,visible:L.visible!==!1,locked:!!(L.lockMovementX&&L.lockMovementY&&L.lockScalingX&&L.lockScalingY&&L.lockRotation)}});const A=B.getActiveObject();k.value=((D=A==null?void 0:A.customData)==null?void 0:D.id)??null},ut=()=>{var u;if(!B)return;const a=B.getActiveObject();k.value=((u=a==null?void 0:a.customData)==null?void 0:u.id)??null,a&&(e.value="layer"),tt(a,!1),Ke(a),rt(a,!1)},hn=a=>{if(!(!B||!a)){if(typeof a.bringToFront=="function"){a.bringToFront();return}typeof B.bringToFront=="function"&&B.bringToFront(a)}},bt=a=>{if(!B||!a)return;const u=B.getObjects(),A=u.map((U,oe)=>({item:U,index:oe})).filter(({item:U})=>{var oe,ie;return((oe=U==null?void 0:U.customData)==null?void 0:oe.role)===lt||((ie=U==null?void 0:U.customData)==null?void 0:ie.role)==="guide"});if(u.includes(a)||B.add(a),!A.length)return;const D=Math.min(...A.map(U=>U.index)),L=B.getObjects().indexOf(a);if(L===-1||L<D)return;const P=Math.max(0,D-1);L!==P&&Array.isArray(B._objects)&&(B._objects.splice(L,1),B._objects.splice(P,0,a),B.requestRenderAll())},_s=()=>{},Sa=()=>{if(!B)return;const a=At(new at.Textbox("捷印定制",{left:B.getWidth()/2,top:B.getHeight()/2,width:320,fontSize:48,fontWeight:"bold",fill:"#111827",strokeWidth:I.value.strokeWidth||3,stroke:"#6366f1",originX:"center",originY:"center",textAlign:"center",lineHeight:1.16,charSpacing:0}),`文本-${ye}`);B.add(a),B.setActiveObject(a),kt(a,"top"),ht(),Me(),rt(a),ut()},Na=()=>{if(!B)return;const a=At(new at.Textbox("标签",{left:260,top:260,width:160,fontSize:20,fill:"#1e293b",backgroundColor:"#fde68a",textAlign:"center",padding:6}),`标签-${ye}`);B.add(a),B.setActiveObject(a),kt(a,"top"),ht(),Me(),rt(a),ut()},As=()=>{if(!B)return;const a=At(new at.Rect({left:180,top:160,width:160,height:110,fill:"#60a5fa",rx:10,ry:10}),`矩形-${ye}`);bt(a),B.setActiveObject(a),Me(),ut()},Ds=()=>{if(!B)return;const a=At(new at.Circle({left:420,top:210,radius:60,fill:"#34d399"}),`圆形-${ye}`);bt(a),B.setActiveObject(a),Me(),ut()},Ia=async a=>{if(!B||!a)return;await Ft(a,A=>{A&&(A.scaleToWidth(B.getWidth()),A.set({left:B.getWidth()/2,top:B.getHeight()/2,originX:"center",originY:"center"}),At(A,`图片-${ye}`),B.add(A),B.setActiveObject(A),kt(A,"top"),ht(),Me(),tt(A),Ke(A),rt(A),ut())},{crossOrigin:"anonymous"})},Fs=a=>{var A,D;const u=(D=(A=a.clipboardData)==null?void 0:A.getData("text"))==null?void 0:D.trim();!u||!/^https?:\/\//i.test(u)||(Ia(u),n.value="")},Ut=a=>new Promise((u,A)=>{const D=new FileReader;D.onload=()=>{typeof D.result=="string"?u(D.result):A(new Error("readBlobAsDataUrl failed"))},D.onerror=()=>A(D.error??new Error("readBlobAsDataUrl failed")),D.readAsDataURL(a)}),Ss=a=>new Promise((u,A)=>{const D=URL.createObjectURL(a),L=new Image;L.onload=()=>{URL.revokeObjectURL(D),u(L)},L.onerror=()=>{URL.revokeObjectURL(D),A(new Error("loadImageFromBlob failed"))},L.src=D}),Ra=a=>a?a.startsWith("data:")?Promise.resolve(a):dt(mt(a)).then(u=>u.blob()).then(u=>Ut(u)).catch(u=>(console.warn("[convertImageUrlToBase64] 转换失败:",a,u),null)):Promise.resolve(null),Ns=async a=>{if(!(a.size>fs))return{dataUrl:await Ut(a),blob:a,compressed:!1};const A=await Ss(a),D=document.createElement("canvas");D.width=A.width,D.height=A.height;const L=D.getContext("2d");if(!L)throw new Error("canvas context not available");L.drawImage(A,0,0,A.width,A.height);let P=null;try{P=await vt(D,"image/webp",.95)}catch(oe){console.warn("[ui-editor] 导出 WebP 失败,回退 PNG",oe),P=null}if(!P)try{P=await vt(D,"image/png")}catch(oe){return console.error("[ui-editor] 导出 PNG 也失败,使用原始文件",oe),{dataUrl:await Ut(a),blob:a,compressed:!1}}return{dataUrl:await Ut(P),blob:P,compressed:!0}},za=async a=>{var L;const u=(L=a.target.files)==null?void 0:L[0];if(a.target.value="",!u||!B)return;let A="";const D=P=>{P&&(P.scaleToWidth(B.getWidth()),P.set({left:B.getWidth()/2,top:B.getHeight()/2,originX:"center",originY:"center"}),At(P,`图片-${ye}`),A&&(P.customData={...P.customData||{},savedSrc:A}),B.add(P),B.setActiveObject(P),kt(P,"top"),ht(),Me(),tt(P),Ke(P),rt(P),ut())};try{A=(await Ns(u)).dataUrl,await Ft(A,D)}catch(P){console.warn("[ui-editor] 上传图片压缩失败,改用原图",P),A=await Ut(u),await Ft(A,D)}},Is=()=>{if(!B)return;const a=B.getActiveObjects();a.length&&(a.forEach(u=>B.remove(u)),B.discardActiveObject(),Me(),tt(),Ke(),rt(),ne("object:removed"))},Rs=()=>{B&&(B.getObjects().forEach(a=>{a.excludeFromExport||B.remove(a)}),B.discardActiveObject(),Me(),tt(),Ke(),rt(),ne("canvas:cleared"))},zs=()=>{B&&(re.value=!0)},Ts=()=>{re.value=!1,Rs()},pn=()=>{re.value=!1},Os=a=>{if(!B||!(a!=null&&a.object))return;B.setActiveObject(a.object),B.requestRenderAll(),k.value=a.id;const u=e.value==="layer";tt(a.object,!u),Ke(a.object),rt(a.object)},Ls=async a=>{var Te,_e,Le,Ye;if(!B)return;const u=B.getActiveObject();if(!u)return;const A=gs(u);if(!A)return;const D=!!((Te=u==null?void 0:u.customData)!=null&&Te.isPatternRect),L=nr(((_e=u.customData)==null?void 0:_e.patternMode)||""),P=nr(a);if(D&&L===P){const He=B.getObjects().indexOf(u);await Ft(A,nt=>{var Xa,Za,Ga,Ya;if(!nt)return;const Ha=(Xa=u.customData)==null?void 0:Xa.originalWidth,qa=(Za=u.customData)==null?void 0:Za.originalHeight,yn=(Ga=u.customData)==null?void 0:Ga.originalScaleX,wn=(Ya=u.customData)==null?void 0:Ya.originalScaleY;Ha&&qa&&yn&&wn?nt.set({width:Ha/yn,height:qa/wn,scaleX:yn,scaleY:wn}):nt.scaleToWidth(B.getWidth()),nt.set({left:u.left??B.getWidth()/2,top:u.top??B.getHeight()/2,angle:u.angle??0,flipX:u.flipX??!1,flipY:u.flipY??!1,opacity:u.opacity??1,originX:"center",originY:"center"});const{isPatternRect:kl,patternMode:El,patternScale:Cl,patternSource:Bl,patternTileWidth:_l,patternTileHeight:Al,originalWidth:Dl,originalHeight:Fl,originalScaleX:Sl,originalScaleY:Nl,...vl}=u.customData||{};nt.customData={...vl,savedSrc:A},B.remove(u),B.add(nt),He>=0&&(typeof nt.moveTo=="function"?nt.moveTo(He):typeof B.moveTo=="function"&&B.moveTo(nt,He)),B.setActiveObject(nt),bt(nt),ht(),B.requestRenderAll(),Me(),tt(nt),ne("object:modified")},{crossOrigin:"anonymous"});return}const U=await ys(u,A),oe=ws(U,P),ie=((Le=u.customData)==null?void 0:Le.patternScale)??Math.round((u.scaleX??1)*100),me=Math.max(.01,fn(ie)/100),we=ms(oe),Ee=u.type==="image"?(u.width??0)*(u.scaleX??1):null,Fe=u.type==="image"?(u.height??0)*(u.scaleY??1):null,Ve=u.type==="image"?u.scaleX??1:null,be=u.type==="image"?u.scaleY??1:null,Ie=new at.Pattern({source:oe,repeat:"repeat"});Ie.patternTransform=[me,0,0,me,0,0],we&&Da(Ie,we.width,we.height,me);const Be=new at.Rect({left:0,top:0,width:B.getWidth(),height:B.getHeight(),fill:Ie,objectCaching:!1});if(!Be||typeof Be._set!="function"){console.warn("[ui-editor] applyImagePattern failed: invalid rect instance.");return}Be.patternElement=U,Be.customData={...u.customData||{},isPatternRect:!0,patternMode:P,patternScale:Math.round(me*100),patternSource:A,patternTileWidth:we==null?void 0:we.width,patternTileHeight:we==null?void 0:we.height,originalWidth:Ee,originalHeight:Fe,originalScaleX:Ve,originalScaleY:be};const Se=B.getObjects().indexOf(u);B.remove(u);try{B.add(Be)}catch(He){console.warn("[ui-editor] applyImagePattern add failed.",He);return}Se>=0&&(typeof Be.moveTo=="function"?Be.moveTo(Se):typeof B.moveTo=="function"&&B.moveTo(Be,Se)),typeof Be.center=="function"?(Be.center(),(Ye=Be.setCoords)==null||Ye.call(Be)):Be.set({left:B.getWidth()/2,top:B.getHeight()/2,originX:"center",originY:"center"}),B.setActiveObject(Be),bt(Be),ht(),Me(),tt(Be),ut()},Ps=a=>{var D,L,P;if(!B)return;const u=B.getActiveObject();if(!u)return;const A=fn(Number(a))/100;if(u.customData={...u.customData||{},patternScale:Math.round(A*100)},(D=u.customData)!=null&&D.isPatternRect){const U=u.fill;if(U){U.patternTransform=[A,0,0,A,0,0];const oe=(L=u.customData)==null?void 0:L.patternTileWidth,ie=(P=u.customData)==null?void 0:P.patternTileHeight;oe&&ie&&Da(U,oe,ie,A)}u.dirty=!0,B.requestRenderAll()}tt(u)},Us=(a,u)=>{if(!B)return;const A=B.getActiveObject();if(!Aa(A))return;const L=new Set(["fontSize","charSpacing","lineHeight","strokeWidth"]).has(a)?Number(u):u;A[a]!==L&&(A.set(a,L),G&&cancelAnimationFrame(G),G=requestAnimationFrame(()=>{B.requestRenderAll()}),le&&window.clearTimeout(le),le=window.setTimeout(()=>{B.fire("object:modified",{target:A})},120),rt(A))},kt=(a,u)=>{if(!B||!a)return!1;const A=t.toRaw(a)??a,D=String(u??"").trim();if(!D)return!1;const L=B.getObjects();if(!L.length)return!1;const P=L.map((me,we)=>({item:me,index:we})).filter(({item:me})=>ft(me)).map(({index:me})=>me);if(!P.length)return!1;const U=L.indexOf(A);if(U===-1)return!1;const oe=P.indexOf(U);if(oe===-1)return!1;let ie=U;if(D==="up"&&oe<P.length-1)ie=P[oe+1];else if(D==="down"&&oe>0)ie=P[oe-1];else if(D==="top")ie=P[P.length-1];else if(D==="bot")ie=P[0];else return!1;return ie===U?!1:(console.log("[layer-move] direction=",D,"currentIndex=",U,"targetIndex=",ie,"movableIndices=",P),typeof B.moveTo=="function"?(B.moveTo(A,ie),B.requestRenderAll(),console.log("[layer-move] moveTo via canvas success"),!0):typeof A.moveTo=="function"?(A.moveTo(ie),B.requestRenderAll(),console.log("[layer-move] moveTo via object success"),!0):Array.isArray(B._objects)?(B._objects.splice(U,1),B._objects.splice(ie,0,A),B.requestRenderAll(),console.log("[layer-move] moveTo via _objects success"),!0):!1)},Ms=async a=>{var L;if(!B)return;const u=String(a??"").trim();let A=B.getActiveObject();if(!ft(A)){const P=y.value.find(U=>U.id===k.value);if(!(P!=null&&P.object)||!ft(P.object))return;A=P.object,B.setActiveObject(A)}console.log("[layer-move] moveLayer direction=",u,"activeId=",k.value,"objId=",(L=A==null?void 0:A.customData)==null?void 0:L.id);let D=kt(A,u);if(!D)try{if(u==="up"&&typeof A.bringForward=="function"){const P=A.bringForward();P&&typeof P.then=="function"&&await P,D=!0}else if(u==="down"&&typeof A.sendBackwards=="function"){const P=A.sendBackwards();P&&typeof P.then=="function"&&await P,D=!0}else if(u==="top"&&typeof A.bringToFront=="function"){const P=A.bringToFront();P&&typeof P.then=="function"&&await P,D=!0}else if(u==="bot"&&typeof A.sendToBack=="function"){const P=A.sendToBack();P&&typeof P.then=="function"&&await P,D=!0}}catch(P){console.warn("[ui-editor] moveLayer failed:",P)}console.log("[layer-move] moveLayer moved=",D),D||kt(A,a),ht(),B.requestRenderAll(),Me(),Ke(A),B.fire("object:modified",{target:A})},Vs=a=>{if(!B)return;const u=B.getActiveObject();ft(u)&&(a==="X"&&u.set("flipX",!u.flipX),a==="Y"&&u.set("flipY",!u.flipY),B.requestRenderAll(),Me(),Ke(u),B.fire("object:modified",{target:u}))},Ws=(a="cw")=>{var D;if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=a==="ccw"?-90:90;u.rotate((u.angle??0)+A),(D=u.setCoords)==null||D.call(u),B.requestRenderAll(),Me(),Ke(u),B.fire("object:modified",{target:u})},$s=()=>{var u;if(!B)return;const a=B.getActiveObject();ft(a)&&(typeof a.center=="function"&&a.center(),(u=a.setCoords)==null||u.call(a),B.requestRenderAll(),Me(),Ke(a),B.fire("object:modified",{target:a}))},Hs=a=>{if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=Math.min(1,Math.max(0,Number(a)));u.set("opacity",A),B.requestRenderAll(),Me(),Ke(u),B.fire("object:modified",{target:u})},qs=a=>{var P;if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=a==="up"?1.1:.9,D=Math.max(.05,(u.scaleX??1)*A),L=Math.max(.05,(u.scaleY??1)*A);u.set({scaleX:D,scaleY:L}),(P=u.setCoords)==null||P.call(u),B.requestRenderAll(),Me(),Ke(u),B.fire("object:modified",{target:u})},Xs=a=>{var oe;if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=u.getBoundingRect(!0,!0),D=B.getWidth(),L=B.getHeight();let P=0,U=0;a==="left"&&(P=-A.left),a==="right"&&(P=D-(A.left+A.width)),a==="hcenter"&&(P=D/2-(A.left+A.width/2)),a==="top"&&(U=-A.top),a==="bottom"&&(U=L-(A.top+A.height)),a==="vcenter"&&(U=L/2-(A.top+A.height/2)),u.set({left:(u.left??0)+P,top:(u.top??0)+U}),(oe=u.setCoords)==null||oe.call(u),B.requestRenderAll(),Me(),Ke(u),B.fire("object:modified",{target:u})},Zs=async()=>{var D;if(!B)return;const a=B.getActiveObject();if(!ft(a))return;const u=await Oa(a);if(!u)return;const A=(D=a.customData)!=null&&D.label?`${a.customData.label}-复制`:`图层-${ye}`;u.customData={...u.customData||{},id:ye++,label:A},u.set({left:(a.left??0)+20,top:(a.top??0)+20}),bt(u),B.setActiveObject(u),ht(),B.requestRenderAll(),Me(),tt(u),Ke(u),rt(u),B.fire("object:modified",{target:u})},Gs=a=>{if(!B||!(a!=null&&a.object))return;const u=!a.visible;a.object.set("visible",u),B.requestRenderAll(),Me(),B.fire("object:modified",{target:a.object})},Ys=a=>{if(!B||!(a!=null&&a.object))return;const u=a.locked;a.object.set({lockMovementX:!u,lockMovementY:!u,lockScalingX:!u,lockScalingY:!u,lockRotation:!u}),B.requestRenderAll(),Me(),B.fire("object:modified",{target:a.object})},Ks=a=>{if(!B)return;const u=a==null?void 0:a.id;let D=(a!=null&&a.object?t.toRaw(a.object):null)??B.getObjects().find(oe=>{var ie;return((ie=oe==null?void 0:oe.customData)==null?void 0:ie.id)===u});if(!D&&(a!=null&&a.name)&&(D=B.getObjects().find(oe=>{var ie;return((ie=oe==null?void 0:oe.customData)==null?void 0:ie.label)===a.name})),!D)return;const P=B.getActiveObject()===D;B.remove(D),P&&(B.discardActiveObject(),k.value=null),B.requestRenderAll(),Me();const U=e.value==="layer";tt(void 0,!U),Ke(),rt(void 0,!U),ne("object:removed")},Ta=async(a,u)=>{var oe;if(!B)return;const A=y.value.find(ie=>ie.id===a);if(!(A!=null&&A.object))return;const D=A.object,L=String(u??"").trim();B.setActiveObject(D),k.value=a,console.log("[layer-move] moveLayerById direction=",L,"layerId=",a,"objId=",(oe=D==null?void 0:D.customData)==null?void 0:oe.id);let P=kt(D,L);if(!P)try{if(L==="up"&&typeof D.bringForward=="function"){const ie=D.bringForward();ie&&typeof ie.then=="function"&&await ie,P=!0}else if(L==="down"&&typeof D.sendBackwards=="function"){const ie=D.sendBackwards();ie&&typeof ie.then=="function"&&await ie,P=!0}else if(L==="top"&&typeof D.bringToFront=="function"){const ie=D.bringToFront();ie&&typeof ie.then=="function"&&await ie,P=!0}else if(L==="bot"&&typeof D.sendToBack=="function"){const ie=D.sendToBack();ie&&typeof ie.then=="function"&&await ie,P=!0}}catch(ie){console.warn("[ui-editor] moveLayerById failed:",ie)}console.log("[layer-move] moveLayerById moved=",P),ht(),B.requestRenderAll(),Me();const U=e.value==="layer";tt(D,!U),Ke(D),rt(D),B.fire("object:modified",{target:D}),ne("layer:moved")},js=async a=>{var U;if(!B)return;const u=y.value.find(oe=>oe.id===a);if(!(u!=null&&u.object))return;const A=u.object;B.setActiveObject(A),k.value=a;const D=await Oa(A);if(!D)return;const L=(U=A.customData)!=null&&U.label?`${A.customData.label}-复制`:`图层-${ye}`;D.customData={...D.customData||{},id:ye++,label:L},D.set({left:(A.left??0)+20,top:(A.top??0)+20}),bt(D),ht(),B.setActiveObject(D),B.requestRenderAll(),Me();const P=e.value==="layer";tt(D,!P),Ke(D),rt(D),B.fire("object:modified",{target:D})},Oa=async a=>{if(!a||typeof a.clone!="function")return null;const u=[],A=L=>{if(!L||typeof L!="object")return;const P=L.patternTransform;let U=P;if(P&&!Array.isArray(P)){if(typeof P=="object"&&"a"in P){const oe=P;U=[oe.a,oe.b,oe.c,oe.d,oe.e,oe.f]}else U=null;L.patternTransform=U,u.push(()=>{L.patternTransform=P})}},D=L=>{if(!L||!("styles"in L))return;const P=L.styles;if(!P||typeof P!="object"||Array.isArray(P))return;const U=Object.keys(P);if(U.length!==0)for(const oe of U){const ie=P[oe];if(!ie||typeof ie!="object"){L.styles={},u.push(()=>{L.styles=P});return}}};a.fill instanceof at.Pattern&&A(a.fill),a.stroke instanceof at.Pattern&&A(a.stroke),(a.type==="textbox"||a.type==="i-text"||a.type==="text")&&D(a);try{return await a.clone()}catch(L){return console.warn("[ui-editor] clone object failed:",a==null?void 0:a.type,L),null}finally{u.forEach(L=>L())}},Js=()=>{if(!B||!h.value)return;const a=Math.max(h.value.clientWidth,1),u=Math.max(h.value.clientHeight,1),A=Math.max(1,Math.floor(Math.min(a,u))),D=B.wrapperEl,L=`${A}px`,P=!D||D.style.width!==L||D.style.height!==L;if(D&&(D.style.width=L,D.style.height=L),P&&typeof B.setDimensions=="function")B.setDimensions({width:A,height:A},{cssOnly:!0});else{const U=B.getElement();U&&(U.style.width=L,U.style.height=L)}},Qs=()=>{var D,L,P,U;if(!B||!h.value)return;const a=Math.max(h.value.clientWidth,1),u=Math.max(h.value.clientHeight,1),A=Math.max(1,Math.floor(Math.min(a,u)));((D=B.getWidth)==null?void 0:D.call(B))===A&&((L=B.getHeight)==null?void 0:L.call(B))===A||(typeof B.setDimensions=="function"?B.setDimensions({width:A,height:A}):((P=B.setWidth)==null||P.call(B,A),(U=B.setHeight)==null||U.call(B,A)),B.requestRenderAll())},el=a=>{if(!B)return;const u=Math.min(200,Math.max(30,a));c.value=u;const A=u/100,D=h.value,L=(D==null?void 0:D.clientWidth)||B.getWidth(),P=(D==null?void 0:D.clientHeight)||B.getHeight(),U=(L-B.getWidth()*A)/2,oe=(P-B.getHeight()*A)/2;B.setViewportTransform([A,0,0,A,U,oe]),B.requestRenderAll()},Mt=a=>el(a),tl=()=>Mt(c.value+10),rl=()=>Mt(c.value-10),nl=()=>{if(!B||!Z.value)return;const a=Nt(Z.value);a!=null&&a.length&&St(a)},xn=()=>{if(!B||!h.value)return;Qs(),Js();const a=Math.max(h.value.clientWidth,100),u=Math.max(h.value.clientHeight,100);M.width=a,M.height=u;const A=Math.min(a/B.getWidth(),u/B.getHeight()),D=Math.round(A*100);Mt(Math.min(160,Math.max(30,D))),il(),nl()},al=async()=>{if(!B)return;B.discardActiveObject(),B.requestRenderAll();const a=B.getElement();if(a)try{const u=await vt(a,"image/png"),A=URL.createObjectURL(u),D=document.createElement("a");D.href=A,D.download="design.png",D.click(),URL.revokeObjectURL(A)}catch(u){console.warn("[ui-editor] 导出 PNG 失败:",u)}},ol=async()=>{var A;if(!B||!Ce||Ae)return null;Ae=!0;let a=null,u=null;try{const D=B.getObjects().find(be=>{var Ie,Be;return((Ie=be==null?void 0:be.customData)==null?void 0:Ie.role)===lt&&((Be=be==null?void 0:be.customData)==null?void 0:Be.label)==="遮罩层"});if(!D)return null;const L=document.createElement("canvas");L.width=B.getWidth(),L.height=B.getHeight(),L.style.display="none",document.body.appendChild(L),u=new at.Canvas(L,{width:B.getWidth(),height:B.getHeight()});const P=B.getObjects().filter(be=>{var Ie,Be,Se;return((Ie=be==null?void 0:be.customData)==null?void 0:Ie.role)!==lt&&((Be=be==null?void 0:be.customData)==null?void 0:Be.role)!=="guide"&&((Se=be==null?void 0:be.customData)==null?void 0:Se.role)!=="grid"});(await Promise.all(P.map(be=>be.clone()))).forEach(be=>{u.add(be)}),u.renderAll();const oe=typeof D.getScaledWidth=="function"?D.getScaledWidth():(D.width??0)*(D.scaleX??1),ie=typeof D.getScaledHeight=="function"?D.getScaledHeight():(D.height??0)*(D.scaleY??1);if(!oe||!ie)return null;const me=D.left??0,we=D.top??0;let Ee=null;try{const be=u.getElement();Ee=await vt(be)}catch(be){return console.warn("[ui-editor] Canvas 被跨域图片污染,无法导出截图。请确保图片资源服务器配置了 CORS。",be),null}const Fe=typeof D.getElement=="function"?D.getElement():D._element;let Ve=null;if(Fe){const be=document.createElement("canvas"),Ie=Fe.width||Fe.naturalWidth||oe,Be=Fe.height||Fe.naturalHeight||ie;be.width=Ie,be.height=Be;const Se=be.getContext("2d");if(Se){Se.drawImage(Fe,0,0,Ie,Be);let Te=null;try{Te=await vt(be)}catch(_e){return console.warn("[ui-editor] 遮罩图片被跨域污染,无法导出。请确保图片资源服务器配置了 CORS。",_e),null}try{Ee&&Te&&(Ve=await Es({baseBlob:Ee,maskBlob:Te,maskWidth:oe,maskHeight:ie,left:me,top:we,canvasWidth:u.getWidth(),canvasHeight:u.getHeight()}))}catch(_e){console.warn("[ui-editor] mask worker failed, fallback to main thread.",_e)}}}if(Ve)a=Ve;else{if(!Ee)return null;const be=await createImageBitmap(Ee),Ie=be.width/u.getWidth(),Be=be.height/u.getHeight(),Se=document.createElement("canvas");Se.width=Math.round(oe),Se.height=Math.round(ie);const Te=Se.getContext("2d");if(!Te)return null;if(Te.drawImage(be,me*Ie,we*Be,oe*Ie,ie*Be,0,0,oe,ie),Fe){const _e=document.createElement("canvas");_e.width=Se.width,_e.height=Se.height;const Le=_e.getContext("2d");Le&&(Le.drawImage(Fe,0,0,Fe.width,Fe.height,0,0,oe,ie),Te.globalCompositeOperation="destination-in",Te.drawImage(_e,0,0),Te.globalCompositeOperation="source-over")}try{a=await vt(Se)}catch(_e){console.warn("[ui-editor] 输出遮罩导出失败。",_e),a=null}}}finally{if(u){const D=u.getElement();u.dispose(),(A=D==null?void 0:D.parentNode)==null||A.removeChild(D)}Ae=!1}return a},La=a=>{var ie,me;if(!B||!a)return;const u=B.getWidth(),A=B.getHeight(),D=a.width||((ie=a._element)==null?void 0:ie.width)||1,L=a.height||((me=a._element)==null?void 0:me.height)||1,P=Math.min(u/D,A/L),U=(u-D*P)/2,oe=(A-L*P)/2;a.scale(P),a.set({left:U,top:oe,originX:"left",originY:"top"})},il=()=>{B!=null&&B.backgroundImage&&(La(B.backgroundImage),B.requestRenderAll())},sl=async a=>{if(!B||!a)return;await Ft(a,A=>{A&&(A.set({originX:"left",originY:"top",selectable:!1,evented:!1}),La(A),B.set("backgroundImage",A),B.requestRenderAll())},{crossOrigin:"anonymous"})},Pa=()=>{B&&(B.getObjects().filter(a=>{var u;return((u=a.customData)==null?void 0:u.role)===lt}).forEach(a=>B.remove(a)),B.clipPath&&(B.clipPath=null,Ce=null,B.requestRenderAll()),ue&&(B.remove(ue),ue=null))},ll=(a,u)=>{var Ee,Fe;const A=B.getWidth(),D=B.getHeight(),L=a.width||((Ee=a._element)==null?void 0:Ee.width)||1,P=a.height||((Fe=a._element)==null?void 0:Fe.height)||1,U=Math.min(A/L,D/P),oe=L*U,ie=P*U,me=(A-oe)/2,we=(D-ie)/2;a.set({originX:"left",originY:"top",left:me,top:we,scaleX:U,scaleY:U})},St=(a=[])=>{B&&(Pa(),a.filter(hs).forEach(u=>{const A=D=>{if(D&&(D.set({left:0,top:0,originX:"left",originY:"top",selectable:!1,evented:!1,hasBorders:!1,hasControls:!1,lockMovementX:!0,lockMovementY:!0,lockScalingX:!0,lockScalingY:!0,lockRotation:!0,opacity:u.type==="MASK"?0:.9,excludeFromExport:!0}),D.customData={role:lt,label:u.type==="MASK"?"遮罩层":"虚线层"},ll(D),B.add(D),hn(D),u.type==="MASK")){Ce=new at.Image(D.getElement(),{left:D.left,top:D.top,originX:"left",originY:"top",scaleX:D.scaleX,scaleY:D.scaleY,absolutePositioned:!0}),ue&&(B.remove(ue),ue=null);const L=typeof D.getElement=="function"?D.getElement():D._element;if(L){const P=document.createElement("canvas");P.width=B.getWidth(),P.height=B.getHeight();const U=P.getContext("2d");if(U){U.fillStyle="rgba(0, 0, 0, 0.3)",U.fillRect(0,0,P.width,P.height),U.globalCompositeOperation="destination-out";const oe=typeof D.getScaledWidth=="function"?D.getScaledWidth():(L.width||L.naturalWidth||0)*(D.scaleX??1),ie=typeof D.getScaledHeight=="function"?D.getScaledHeight():(L.height||L.naturalHeight||0)*(D.scaleY??1);U.drawImage(L,0,0,L.width,L.height,D.left??0,D.top??0,oe,ie),U.globalCompositeOperation="source-over",ue=new at.Image(P,{left:0,top:0,originX:"left",originY:"top",selectable:!1,evented:!1,excludeFromExport:!0}),ue.customData={role:"guide",label:"遮罩外层"},B.add(ue),hn(ue)}}B.requestRenderAll()}};Ft(u.url,A,{crossOrigin:"anonymous"})}))},ht=()=>{B&&(B.getObjects().filter(a=>{var u,A;return((u=a.customData)==null?void 0:u.role)===lt||((A=a.customData)==null?void 0:A.role)==="guide"}).forEach(a=>hn(a)),B.requestRenderAll())},Vt=a=>{if(!a)return;const u=a.thumb||ve(a.resources);u&&sl(u)},cl=()=>{const a=Qe.value;if(!a.length)return null;const u=a.filter(D=>!q.value||D.size===q.value),A=u.length?u:a;return A.find(D=>D.type===W.value)??A[0]},Wt=()=>{B&&(B.clear(),B.set("backgroundImage",null),B.requestRenderAll(),Pa())},mn=(a,u)=>{!B||!a||B.loadFromJSON(a,()=>{B.requestRenderAll(),Me(),u==null||u()},(A,D)=>{(D==null?void 0:D.type)==="image"&&D.set({crossOrigin:"anonymous"})})},Ua=async()=>{var P;if(!B)return null;const a=B.toJSON(["customData"]),u=B.getObjects(),A=a.objects??[],D=new Map,L=[];if(u.forEach(U=>{var ie,me,we;if((U==null?void 0:U.type)!=="image"||!((ie=U.customData)!=null&&ie.id))return;(((me=U.customData)==null?void 0:me.savedSrc)||((we=U.getSrc)==null?void 0:we.call(U)))&&typeof U.toDataURL=="function"&&L.push(Promise.resolve().then(()=>{var Ee;try{(Ee=U.customData)!=null&&Ee.savedSrc?D.set(U.customData.id,U.customData.savedSrc):D.set(U.customData.id,U.toDataURL({format:"png"}))}catch{}}))}),(P=B.backgroundImage)!=null&&P.src){const U=B.backgroundImage;typeof U.toDataURL=="function"&&L.push(Promise.resolve().then(()=>{try{const oe=U.toDataURL({format:"png"});a.backgroundImage.src=oe,a.backgroundImage.savedSrc=oe}catch{}}))}L.length&&await Promise.all(L);try{A.forEach((U,oe)=>{var me;const ie=u[oe];if(ie&&(ie.customData&&!U.customData&&(U.customData=JSON.parse(JSON.stringify(ie.customData))),(me=U.customData)!=null&&me.isPatternRect)){const we=U.customData.patternSource,Ee=U.customData.savedSrc;(typeof we!="string"||!we.length)&&typeof Ee=="string"&&Ee.startsWith("data:")&&(U.customData.patternSource=Ee)}})}catch(U){console.warn("[exportCanvasState] 回填 customData 失败:",U)}return A.forEach(U=>{var ie;if((U==null?void 0:U.type)!=="image")return;const oe=(ie=U.customData)==null?void 0:ie.id;if(oe&&D.has(oe)){const me=D.get(oe);U.customData={...U.customData||{},savedSrc:me},U.src=me}}),a},vn=async a=>{if(!B||!a)return;const u=await Ua();u&&Y(a,u)},dl=a=>{var A,D;if(!a||typeof a!="object")return console.warn("[filterUserContent] fabricJson 无效:",a),a;const u=JSON.parse(JSON.stringify(a));if(console.log("[filterUserContent] 原始 objects 数量:",((A=u.objects)==null?void 0:A.length)||0),console.log("[filterUserContent] 原始 objects 类型:",(D=u.objects)==null?void 0:D.map(L=>L==null?void 0:L.type)),u.objects&&Array.isArray(u.objects)){const L=u.objects.length;u.objects=u.objects.map(U=>{var Ee,Fe,Ve,be,Ie,Be,Se,Te,_e,Le;if(((Ee=U==null?void 0:U.customData)==null?void 0:Ee.role)===lt||((Fe=U==null?void 0:U.customData)==null?void 0:Fe.role)==="guide"||((Ve=U==null?void 0:U.customData)==null?void 0:Ve.role)==="grid"||(be=U==null?void 0:U.customData)!=null&&be.isMask||((Ie=U==null?void 0:U.customData)==null?void 0:Ie.role)==="mask")return null;const oe=((Be=U==null?void 0:U.type)==null?void 0:Be.toLowerCase())||"",ie=oe==="image",me=oe==="textbox"||oe==="i-text"||oe==="text",we=!!((Se=U==null?void 0:U.customData)!=null&&Se.isPatternRect);if(!ie&&!me&&!we)return console.log("[filterUserContent] 过滤掉非图片/文字/平铺对象:",U==null?void 0:U.type,U==null?void 0:U.customData),null;if(ie||we){if(U.customData||(U.customData={}),we){const Ye=(Te=U.customData)==null?void 0:Te.patternSource,He=(_e=U.customData)==null?void 0:_e.savedSrc;typeof Ye=="string"?Ye.startsWith("blob:")&&typeof He=="string"&&He.startsWith("data:")?U.customData.patternSource=He:Ye.startsWith("data:")&&!U.customData.savedSrc&&(U.customData.savedSrc=Ye):!Ye&&typeof He=="string"&&He.startsWith("data:")&&(U.customData.patternSource=He)}ie&&U.customData.savedSrc&&U.customData.savedSrc.startsWith("data:")?U.src=U.customData.savedSrc:ie&&U.src&&U.src.startsWith("blob:")&&(U.customData.savedSrc&&U.customData.savedSrc.startsWith("data:")?U.src=U.customData.savedSrc:console.warn("[filterUserContent] 图片对象缺少 base64 数据:",(Le=U.customData)==null?void 0:Le.id)),ie&&U.src&&U.src.startsWith("data:")&&!U.customData.savedSrc&&(U.customData.savedSrc=U.src)}return U}).filter(U=>U!==null);const P=u.objects.length;console.log("[filterUserContent] 过滤后 objects 数量:",P,"(原始:",L,")"),console.log("[filterUserContent] 过滤后 objects 类型:",u.objects.map(U=>U==null?void 0:U.type))}return u.backgroundImage&&delete u.backgroundImage,u},fl=async()=>{var D,L,P,U,oe,ie;const a={};Z.value&&await vn(Z.value);const u=Dt(),A=new Map;u.forEach(me=>{A.set(String(me.id),me)});for(const me of _t.value){const we=me.id,Ee=K(we);if(console.log(`[getAllDiecutFabricData] 刀板 ${me.name} (${we}):`,{hasState:!!Ee,objectsCount:((D=Ee==null?void 0:Ee.objects)==null?void 0:D.length)||0}),Ee){const Fe=dl(Ee);console.log(`[getAllDiecutFabricData] 过滤后刀板 ${me.name}:`,{objectsCount:((L=Fe==null?void 0:Fe.objects)==null?void 0:L.length)||0});const Ve=A.get(String(we));let be=null,Ie=null;if((P=Ve==null?void 0:Ve.mask)!=null&&P.url){if(be=await Ra(Ve.mask.url),be){const _e=(U=Ee.objects)==null?void 0:U.find(Le=>{var Ye,He;return((Ye=Le==null?void 0:Le.customData)==null?void 0:Ye.role)===lt&&((He=Le==null?void 0:Le.customData)==null?void 0:He.label)==="遮罩层"});_e?Ie={width:_e.width||Ve.mask.width,height:_e.height||Ve.mask.height,left:_e.left??0,top:_e.top??0,scaleX:_e.scaleX??1,scaleY:_e.scaleY??1,originX:_e.originX||"left",originY:_e.originY||"top"}:Ie={width:Ve.mask.width,height:Ve.mask.height}}console.log(`[getAllDiecutFabricData] 刀板 ${me.name} 蒙版:`,{hasMaskUrl:!!Ve.mask.url,hasMaskData:!!be,maskInfo:Ie})}const Be=it.value.get(String(we));let Se=null,Te=null;if((oe=Be==null?void 0:Be.dotted)!=null&&oe.url){if(Se=await Ra(Be.dotted.url),Se){const _e=(ie=Ee.objects)==null?void 0:ie.find(Le=>{var Ye,He;return((Ye=Le==null?void 0:Le.customData)==null?void 0:Ye.role)===lt&&((He=Le==null?void 0:Le.customData)==null?void 0:He.label)==="虚线层"});_e?Te={width:_e.width||Be.dotted.width,height:_e.height||Be.dotted.height,left:_e.left??0,top:_e.top??0,scaleX:_e.scaleX??1,scaleY:_e.scaleY??1,originX:_e.originX||"left",originY:_e.originY||"top"}:Te={width:Be.dotted.width,height:Be.dotted.height}}console.log(`[getAllDiecutFabricData] 刀板 ${me.name} 虚线层:`,{hasDottedLineUrl:!!Be.dotted.url,hasDottedLineData:!!Se,dottedLineInfo:Te})}a[we]={id:we,name:me.name,fabricData:Fe,maskData:be,maskInfo:Ie,dottedLineData:Se,dottedLineInfo:Te}}}return console.log("[getAllDiecutFabricData] 最终合并数据:",{diecutCount:Object.keys(a).length,totalObjects:Object.values(a).reduce((me,we)=>{var Ee,Fe;return me+(((Fe=(Ee=we.fabricData)==null?void 0:Ee.objects)==null?void 0:Fe.length)||0)},0),maskDataCount:Object.values(a).filter(me=>me.maskData).length,dottedLineDataCount:Object.values(a).filter(me=>me.dottedLineData).length}),{version:"1.0",diecuts:a}},ul=async(a,u,A)=>{var L;let D=null;try{const P=document.createElement("canvas");P.width=u,P.height=A,P.style.display="none",document.body.appendChild(P),D=new at.Canvas(P,{width:u,height:A}),await new Promise(ie=>{D.loadFromJSON(a,()=>{D.requestRenderAll(),setTimeout(()=>{ie()},200)},(me,we)=>{(we==null?void 0:we.type)==="image"&&we.set({crossOrigin:"anonymous"})})});const U=D.getElement();return U?await vt(U,"image/png"):null}catch(P){return console.error("[ui-editor] 从 JSON 生成截图失败:",P),null}finally{if(D){const P=D.getElement();D.dispose(),(L=P==null?void 0:P.parentNode)==null||L.removeChild(P)}}},hl=async(a,u,A,D)=>{var Te;if(!u.url)return null;const L=(Te=a.objects)==null?void 0:Te.find(_e=>{var Le;return((Le=_e==null?void 0:_e.customData)==null?void 0:Le.label)==="遮罩层"});let P,U,oe,ie;if(L)P=(L.width??0)*(L.scaleX??1),U=(L.height??0)*(L.scaleY??1),oe=L.left??0,ie=L.top??0;else{const _e=await un(u.url),Le=u.width||_e.width,Ye=u.height||_e.height,He=Math.min(A/Le,D/Ye);P=Le*He,U=Ye*He,oe=(A-P)/2,ie=(D-U)/2}if(!P||!U)return null;const me=await ul(a,A,D);if(!me)return null;const we=await un(u.url),Ee=document.createElement("canvas");Ee.width=Math.round(P),Ee.height=Math.round(U);const Fe=Ee.getContext("2d");if(!Fe)return null;const Ve=await createImageBitmap(me),be=Ve.width/A,Ie=Ve.height/D;Fe.drawImage(Ve,oe*be,ie*Ie,P*be,U*Ie,0,0,P,U);const Be=document.createElement("canvas");Be.width=Ee.width,Be.height=Ee.height;const Se=Be.getContext("2d");return Se&&(Se.drawImage(we,0,0,we.width,we.height,0,0,P,U),Fe.globalCompositeOperation="destination-in",Fe.drawImage(Be,0,0),Fe.globalCompositeOperation="source-over"),await vt(Ee,"image/png")},pl=async a=>{if(!B||!(a!=null&&a.length))return;Z.value&&await vn(Z.value);const u=await Ua();if(!u)return;const A=(u.objects??[]).filter(ps);if(!A.length)return;const D={},L=[];if(a.forEach(P=>{if(!P||P===Z.value)return;const U=K(P),oe=ir(U)||{...u,objects:[]};D[P]=oe,L.push(P)}),L.length!==0){try{const P=JSON.parse(JSON.stringify(A)),U=JSON.parse(JSON.stringify(D)),oe=await Bs({sourceObjects:P,targetJsonMap:U,objectIndex:ye});if(oe)ye=oe.nextObjectIndex,Object.entries(oe.updates).forEach(([ie,me])=>{Y(ie,me)});else throw new Error("Worker returned null")}catch(P){console.warn("[ui-editor] copy to diecuts worker failed, fallback to main thread:",P),L.forEach(U=>{const oe=K(U),ie=ir(oe)||{...u,objects:[]},me=Array.isArray(ie.objects)?ie.objects:[],we=A.map(xs);ie.objects=[...me,...we],Y(U,ie)})}if(L.length>0)try{const P=pe.value[T.value];if(!(P!=null&&P.jsonURL))return;const oe=await(await dt(mt(P.jsonURL))).json(),ie=Pt(oe.layerList||[]),me=Dt(),we=B.getWidth(),Ee=B.getHeight(),Ve=(await Promise.all(L.map(async be=>{var Se;const Ie=me.find(Te=>Te.id===be);if(!((Se=Ie==null?void 0:Ie.mask)!=null&&Se.url))return console.warn(`[ui-editor] 找不到目标刀板 ${be} 对应的 group 或 mask`),null;const Be=K(be);if(!Be)return console.warn(`[ui-editor] 找不到目标刀板 ${be} 的状态`),null;try{const Te=ir(Be),_e=JSON.parse(JSON.stringify(Te)),Le=await hl(_e,Ie.mask,we,Ee);if(!Le)throw new Error("无法生成遮罩截图");const Ye=pt.get(be);Ye&&URL.revokeObjectURL(Ye),er.set(be,Le);const He=URL.createObjectURL(Le);pt.set(be,He);const nt=ie.get(Ie.name);return nt?{id:nt,url:He,targetId:be}:(console.warn(`[ui-editor] 找不到刀板 ${be} 对应的 PSD Group ID`),null)}catch(Te){return console.error(`[ui-editor] 为目标刀板 ${be} 生成截图失败:`,Te),null}}))).filter(be=>be!==null);if(Ve.length===0){console.warn("[ui-editor] 没有成功生成任何截图");return}if(et.value){const be=et.value.fabricScreenshotList||[],Ie=new Map;be.forEach(Se=>{Ie.set(Se.id,Se)}),Ve.forEach(Se=>{const Te=Ie.get(Se.id);if(Te&&Te.url!==Se.url)try{URL.revokeObjectURL(Te.url)}catch{}Ie.set(Se.id,{id:Se.id,url:Se.url})});const Be=Array.from(Ie.values());et.value={...et.value,fabricScreenshotList:Be}}else{const be=new URL(".",new URL(P.jsonURL,window.location.href)).toString(),Ie=ar(P.resources||[]),Se=Dt().map(Te=>{const _e=ie.get(Te.name);if(!_e)return null;const Le=pt.get(Te.id);return Le?{id:_e,url:Le}:null}).filter(Boolean);et.value={psdJson:oe,materialList:Ie,fabricScreenshotList:Se,width:300,height:300,baseUrl:be}}}catch(P){console.error("[ui-editor] 为目标刀板生成截图失败:",P)}}},xl=a=>{var U;const[u,A]=a.split(","),D=((U=u.match(/data:(.*);base64/))==null?void 0:U[1])||"image/png",L=atob(A),P=new Uint8Array(L.length);for(let oe=0;oe<L.length;oe+=1)P[oe]=L.charCodeAt(oe);return new Blob([P],{type:D})},gn=new Set,or=a=>{try{const u=xl(a),A=URL.createObjectURL(u);return gn.add(A),A}catch{return a}},Ma=()=>{gn.forEach(a=>URL.revokeObjectURL(a)),gn.clear()},ir=a=>{var A;if(!a)return a;(A=a.backgroundImage)!=null&&A.src&&(a.backgroundImage.src.startsWith("data:")?(a.backgroundImage.savedSrc=a.backgroundImage.src,a.backgroundImage.src=or(a.backgroundImage.src)):a.backgroundImage.src.startsWith("blob:")&&(a.backgroundImage.savedSrc?a.backgroundImage.src=or(a.backgroundImage.savedSrc):a.backgroundImage=null));const u=D=>{var L;if(!D||typeof D!="object")return D;if(Array.isArray(D))return D.map(u).filter(P=>P!==null);if(D.type==="image"){if((L=D.customData)!=null&&L.savedSrc)D.src=or(D.customData.savedSrc);else if(typeof D.src=="string"&&D.src.startsWith("data:"))D.customData={...D.customData||{},savedSrc:D.src},D.src=or(D.src);else if(typeof D.src=="string"&&D.src.startsWith("blob:"))return null}return Object.keys(D).forEach(P=>{const U=D[P];if(typeof U=="string"&&U.startsWith("blob:")){D[P]=null;return}D[P]=u(U)}),D};return Array.isArray(a.objects)&&(a.objects=u(a.objects)),a},Va=a=>{if(!B||!a)return!1;Ma();const u=ir(K(a));return u?(Wt(),mn(u,()=>{Mt(c.value)}),!0):!1},Nt=a=>{if(!a)return[];const u=it.value.get(a)||Array.from(it.value.values()).find(D=>D.name===a),A=[];return u!=null&&u.mask&&A.push(u.mask),u!=null&&u.dotted&&A.push(u.dotted),A},Wa=async(a,u=[])=>{if(!(!B||!a)){w.value=!0,j.value="";try{if(Q.has(a)){Wt(),mn(Q.get(a));const P=Nt(Z.value);St(P.length?P:u);return}const A=await dt(mt(a),{mode:"cors"});if(!A.ok)throw new Error("模板加载失败");const D=await A.json();Q.set(a,D),Wt(),mn(D);const L=Nt(Z.value);St(L.length?L:u)}catch{j.value="模板加载失败,已回退到预览图",Vt({resources:u});const D=Nt(Z.value);St(D.length?D:u)}finally{w.value=!1}}},ml=()=>{F.value=!F.value};return t.watch(Je,a=>{!q.value&&(a!=null&&a.length)&&(q.value=a[0])},{immediate:!0}),t.watch(pe,a=>{a!=null&&a.length&&((V.value>=a.length||V.value<0)&&(V.value=0),(T.value>=a.length||T.value<0)&&(T.value=0),B&&Vt(a[V.value]),Lt())},{immediate:!0}),t.watch(Qe,a=>{if(a!=null&&a.length){if(!W.value){const u=a.find(A=>A.type==="SPLIT");W.value=(u==null?void 0:u.type)??a[0].type;return}a.some(u=>u.type===W.value)||(W.value=a[0].type)}},{immediate:!0}),t.watch(_t,a=>{!Z.value&&(a!=null&&a.length)&&(Z.value=a[0].id)},{immediate:!0}),t.watch(Z,async(a,u)=>{if(!B||!a)return;if(u&&await vn(u),!Va(a)){Wt();const D=pe.value[V.value];D&&Vt(D),Mt(c.value)}St(Nt(a))},{immediate:!0}),t.watch(V,a=>{if(!B)return;const u=pe.value[a];u&&(u.jsonURL?Wa(u.jsonURL,u.resources):Vt(u))}),t.watch(T,()=>{Lt()}),t.watch(W,()=>{if(!B)return;const a=cl();a&&Wa(a.jsonURL,a.resources)}),t.onMounted(async()=>{if(r.value&&await jt(f.value),!s.value)return;const a=de();B=new at.Canvas(s.value,{width:a,height:a,backgroundColor:"#f8fafc",preserveObjectStacking:!0}),B.on("selection:created",ut),B.on("selection:updated",ut),B.on("selection:cleared",ut),B.on("object:added",L=>{var U,oe;const P=L==null?void 0:L.target;((U=P==null?void 0:P.customData)==null?void 0:U.role)!==lt&&((oe=P==null?void 0:P.customData)==null?void 0:oe.role)!=="guide"&&!(P!=null&&P.excludeFromExport)&&(bt(P),ht()),Me(),u("object:added")}),B.on("object:removed",()=>{Me(),ut()}),B.on("object:moving",()=>{g=!0,ae=!0}),B.on("mouse:up",()=>{g&&(g=!1,ae&&(ae=!1,te=!0,ne("drag-end")))}),B.on("object:modified",()=>u("object:modified"));function u(L){if(te){te=!1;return}if(g){ae=!0;return}ne(L)}const A=Z.value;!(A?Va(A):!1)&&pe.value.length&&Vt(pe.value[V.value]),A&&St(Nt(A)),xn(),window.addEventListener("resize",se),await t.nextTick(),Lt()}),t.onBeforeUnmount(()=>{R&&(cancelAnimationFrame(R),R=0),window.removeEventListener("resize",se),B&&(B.dispose(),B=null),Re&&(Re.terminate(),Re=null,O.clear()),Ue&&(Ue.terminate(),Ue=null,$.clear()),pt.forEach(a=>URL.revokeObjectURL(a)),pt.clear(),er.clear(),Ma(),tr.forEach(a=>URL.revokeObjectURL(a)),tr.clear()}),(a,u)=>{var A,D;return t.openBlock(),t.createElementBlock("div",cs,[ee.value?(t.openBlock(),t.createBlock(oo,{key:0,"product-name":((A=Ze.value)==null?void 0:A.name)||((D=v.value)==null?void 0:D.name)||"定制产品","show-grid":o.value,onAddText:Sa,onAddLabel:Na,onToggleGrid:_s,onClearCanvas:zs,onDownloadPng:al,onUpload:za},null,8,["product-name","show-grid"])):t.createCommentVNode("",!0),t.createElementVNode("div",ds,[ce.value?(t.openBlock(),t.createBlock(Dn,{key:0,class:"sidebar-left",activeTab:e.value,"onUpdate:activeTab":u[0]||(u[0]=L=>e.value=L),urlInput:n.value,"onUpdate:urlInput":u[1]||(u[1]=L=>n.value=L),selectedProductIndex:he.value,"onUpdate:selectedProductIndex":u[2]||(u[2]=L=>he.value=L),"visible-tabs":r.value?["product","layer"]:["layer"],"product-items":$e.value,"product-total":Xe.value,"product-page":f.value,"product-page-size":b.value,"product-has-prev":Ge.value,"product-has-next":ot.value,layers:y.value,"active-layer-id":k.value,onChangeProductPage:Jt,onSelectLayer:Os,onToggleLayerVisibility:Gs,onToggleLayerLock:Ys,onDeleteLayer:Ks,onMoveLayerById:Ta,onDuplicateLayerById:js},null,8,["activeTab","urlInput","selectedProductIndex","visible-tabs","product-items","product-total","product-page","product-page-size","product-has-prev","product-has-next","layers","active-layer-id"])):t.createCommentVNode("",!0),t.createVNode(Ui,{selectedSize:q.value,"onUpdate:selectedSize":u[3]||(u[3]=L=>q.value=L),selectedDiecutId:Z.value,"onUpdate:selectedDiecutId":u[4]||(u[4]=L=>Z.value=L),"size-options":Je.value,"loading-template":w.value,"template-error":j.value,"diecut-options":_t.value,zoom:c.value,onCanvasReady:xe,onZoomIn:tl,onZoomOut:rl,onFitCanvas:xn,onCopyToDiecuts:pl},null,8,["selectedSize","selectedDiecutId","size-options","loading-template","template-error","diecut-options","zoom"]),H.value&&ce.value?(t.openBlock(),t.createBlock(Dn,{key:1,class:"sidebar-right","active-tab":"add",urlInput:n.value,"onUpdate:urlInput":u[5]||(u[5]=L=>n.value=L),"show-nav":!1,"visible-tabs":["add"],layers:y.value,"active-layer-id":k.value,"show-image-tools":_.value.visible,"image-pattern-mode":_.value.mode,"image-pattern-scale":_.value.scale,"image-pattern-scale-enabled":_.value.isPattern,"show-layer-tools":S.value.visible,"layer-opacity":S.value.opacity,"show-text-tools":I.value.visible,"text-font-family":I.value.fontFamily,"text-font-size":I.value.fontSize,"text-char-spacing":I.value.charSpacing,"text-line-height":I.value.lineHeight,"text-fill":I.value.fill,"text-stroke-width":I.value.strokeWidth,"text-stroke":I.value.stroke,onAddText:Sa,onAddLabel:Na,onAddRect:As,onAddCircle:Ds,onRemoveSelected:Is,onUpload:za,onAddImageUrl:Ia,onPasteUrl:Fs,onApplyImagePattern:Ls,onUpdateImagePatternScale:Ps,onUpdateTextProp:Us,onMoveLayer:Ms,onMoveLayerById:Ta,onFlipLayer:Vs,onRotateLayer:Ws,onScaleLayer:qs,onAlignLayer:Xs,onDuplicateLayer:Zs,onCenterLayer:$s,onUpdateLayerOpacity:Hs},null,8,["urlInput","layers","active-layer-id","show-image-tools","image-pattern-mode","image-pattern-scale","image-pattern-scale-enabled","show-layer-tools","layer-opacity","show-text-tools","text-font-family","text-font-size","text-char-spacing","text-line-height","text-fill","text-stroke-width","text-stroke"])):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createBlock(ts,{key:2,"render-data":et.value,"preview-title":ln.value,"template-index":T.value,"template-total":fe.value,"get-render-data-for-index":Qt,"get-all-diecut-fabric-data":fl,onPrevTemplate:ze,onNextTemplate:qe},null,8,["render-data","preview-title","template-index","template-total"])):t.createCommentVNode("",!0)]),F.value?(t.openBlock(),t.createBlock(ls,{key:1,"template-mode-options":Qe.value,"selected-mode":W.value,"onUpdate:selectedMode":u[6]||(u[6]=L=>W.value=L),onClose:ml},null,8,["template-mode-options","selected-mode"])):t.createCommentVNode("",!0),re.value?(t.openBlock(),t.createElementBlock("div",{key:2,class:"modal-backdrop",onClick:t.withModifiers(pn,["self"])},[t.createElementVNode("div",{class:"modal"},[t.createElementVNode("div",{class:"modal-header"},[u[7]||(u[7]=t.createElementVNode("span",null,"清空画布",-1)),t.createElementVNode("button",{class:"ghost icon",type:"button",onClick:pn},"✕")]),u[8]||(u[8]=t.createElementVNode("div",{class:"modal-body"},[t.createElementVNode("p",{class:"modal-text"},"确定要清空画布吗?此操作无法撤销。")],-1)),t.createElementVNode("div",{class:"modal-footer"},[t.createElementVNode("button",{class:"modal-btn",type:"button",onClick:pn},"取消"),t.createElementVNode("button",{class:"modal-btn danger",type:"button",onClick:Ts},"清空")])])])):t.createCommentVNode("",!0)])}}}),Ba=x=>{x.component("Editor",sn)},us={install:Ba,Editor:sn};Ne.EPartType=Fn,Ne.EPsdDataType=gt,Ne.Editor=sn,Ne.appendFileTokenIfPresent=ur,Ne.appendFileTokenToUrl=Rt,Ne.applyVectorMask=$t,Ne.clearFileToken=Cn,Ne.convertBlendMode=vr,Ne.convertPsdJsonToModelData=xr,Ne.default=us,Ne.deformByJson=Zi,Ne.deformImage=Xi,Ne.deformImageBitmap=yr,Ne.deformWithWorker=gr,Ne.disposeDeformWorkers=qi,Ne.downloadCanvas=On,Ne.ensureFileToken=Et,Ne.fetchWithFileToken=dt,Ne.getDeformWorker=zn,Ne.getFileToken=It,Ne.getFileTokenFetchers=Qa,Ne.getMaskFromData=Sn,Ne.install=Ba,Ne.isFileTokenExpired=dr,Ne.loadImageBitmap=Rn,Ne.normalizeLayerData=Tn,Ne.normalizeMaskData=Nn,Ne.renderByJson=Zt,Ne.setFileTokenFetchers=Ja,Ne.stripFileTokenParam=hr,Ne.toImageBitmap=mr,Ne.withFileToken=pr,Object.defineProperties(Ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
25
|
+
*/return r.mode.CTRGladman=function(){var l=r.lib.BlockCipherMode.extend();function k(i){if((i>>24&255)===255){var p=i>>16&255,d=i>>8&255,v=i&255;p===255?(p=0,d===255?(d=0,v===255?v=0:++v):++d):++p,i=0,i+=p<<16,i+=d<<8,i+=v}else i+=1<<24;return i}function f(i){return(i[0]=k(i[0]))===0&&(i[1]=k(i[1])),i}var b=l.Encryptor=l.extend({processBlock:function(i,p){var d=this._cipher,v=d.blockSize,C=this._iv,m=this._counter;C&&(m=this._counter=C.slice(0),this._iv=void 0),f(m);var s=m.slice(0);d.encryptBlock(s,0);for(var h=0;h<v;h++)i[p+h]^=s[h]}});return l.Decryptor=b,l}(),r.mode.CTRGladman})}(Hr)),Hr.exports}var qr={exports:{}},da;function c0(){return da||(da=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.mode.OFB=function(){var l=r.lib.BlockCipherMode.extend(),k=l.Encryptor=l.extend({processBlock:function(f,b){var i=this._cipher,p=i.blockSize,d=this._iv,v=this._keystream;d&&(v=this._keystream=d.slice(0),this._iv=void 0),i.encryptBlock(v,0);for(var C=0;C<p;C++)f[b+C]^=v[C]}});return l.Decryptor=k,l}(),r.mode.OFB})}(qr)),qr.exports}var Xr={exports:{}},fa;function d0(){return fa||(fa=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.mode.ECB=function(){var l=r.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(k,f){this._cipher.encryptBlock(k,f)}}),l.Decryptor=l.extend({processBlock:function(k,f){this._cipher.decryptBlock(k,f)}}),l}(),r.mode.ECB})}(Xr)),Xr.exports}var Zr={exports:{}},ua;function f0(){return ua||(ua=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.pad.AnsiX923={pad:function(l,k){var f=l.sigBytes,b=k*4,i=b-f%b,p=f+i-1;l.clamp(),l.words[p>>>2]|=i<<24-p%4*8,l.sigBytes+=i},unpad:function(l){var k=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=k}},r.pad.Ansix923})}(Zr)),Zr.exports}var Gr={exports:{}},ha;function u0(){return ha||(ha=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.pad.Iso10126={pad:function(l,k){var f=k*4,b=f-l.sigBytes%f;l.concat(r.lib.WordArray.random(b-1)).concat(r.lib.WordArray.create([b<<24],1))},unpad:function(l){var k=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=k}},r.pad.Iso10126})}(Gr)),Gr.exports}var Yr={exports:{}},pa;function h0(){return pa||(pa=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.pad.Iso97971={pad:function(l,k){l.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(l,k)},unpad:function(l){r.pad.ZeroPadding.unpad(l),l.sigBytes--}},r.pad.Iso97971})}(Yr)),Yr.exports}var Kr={exports:{}},xa;function p0(){return xa||(xa=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.pad.ZeroPadding={pad:function(l,k){var f=k*4;l.clamp(),l.sigBytes+=f-(l.sigBytes%f||f)},unpad:function(l){for(var k=l.words,f=l.sigBytes-1,f=l.sigBytes-1;f>=0;f--)if(k[f>>>2]>>>24-f%4*8&255){l.sigBytes=f+1;break}}},r.pad.ZeroPadding})}(Kr)),Kr.exports}var jr={exports:{}},ma;function x0(){return ma||(ma=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})}(jr)),jr.exports}var Jr={exports:{}},va;function m0(){return va||(va=1,function(x,X){(function(r,l,k){x.exports=l(Le(),je())})(Fe,function(r){return function(l){var k=r,f=k.lib,b=f.CipherParams,i=k.enc,p=i.Hex,d=k.format;d.Hex={stringify:function(v){return v.ciphertext.toString(p)},parse:function(v){var C=p.parse(v);return b.create({ciphertext:C})}}}(),r.format.Hex})}(Jr)),Jr.exports}var Qr={exports:{}},ga;function v0(){return ga||(ga=1,function(x,X){(function(r,l,k){x.exports=l(Le(),bt(),Et(),mt(),je())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.BlockCipher,b=l.algo,i=[],p=[],d=[],v=[],C=[],m=[],s=[],h=[],n=[],e=[];(function(){for(var y=[],E=0;E<256;E++)E<128?y[E]=E<<1:y[E]=E<<1^283;for(var _=0,S=0,E=0;E<256;E++){var I=S^S<<1^S<<2^S<<3^S<<4;I=I>>>8^I&255^99,i[_]=I,p[I]=_;var $=y[_],W=y[$],T=y[W],q=y[I]*257^I*16843008;d[_]=q<<24|q>>>8,v[_]=q<<16|q>>>16,C[_]=q<<8|q>>>24,m[_]=q;var q=T*16843009^W*65537^$*257^_*16843008;s[I]=q<<24|q>>>8,h[I]=q<<16|q>>>16,n[I]=q<<8|q>>>24,e[I]=q,_?(_=$^y[y[y[T^$]]],S^=y[y[S]]):_=S=1}})();var o=[0,1,2,4,8,16,32,64,128,27,54],c=b.AES=f.extend({_doReset:function(){var y;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var E=this._keyPriorReset=this._key,_=E.words,S=E.sigBytes/4,I=this._nRounds=S+6,$=(I+1)*4,W=this._keySchedule=[],T=0;T<$;T++)T<S?W[T]=_[T]:(y=W[T-1],T%S?S>6&&T%S==4&&(y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255]):(y=y<<8|y>>>24,y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255],y^=o[T/S|0]<<24),W[T]=W[T-S]^y);for(var q=this._invKeySchedule=[],F=0;F<$;F++){var T=$-F;if(F%4)var y=W[T];else var y=W[T-4];F<4||T<=4?q[F]=y:q[F]=s[i[y>>>24]]^h[i[y>>>16&255]]^n[i[y>>>8&255]]^e[i[y&255]]}}},encryptBlock:function(y,E){this._doCryptBlock(y,E,this._keySchedule,d,v,C,m,i)},decryptBlock:function(y,E){var _=y[E+1];y[E+1]=y[E+3],y[E+3]=_,this._doCryptBlock(y,E,this._invKeySchedule,s,h,n,e,p);var _=y[E+1];y[E+1]=y[E+3],y[E+3]=_},_doCryptBlock:function(y,E,_,S,I,$,W,T){for(var q=this._nRounds,F=y[E]^_[0],V=y[E+1]^_[1],w=y[E+2]^_[2],j=y[E+3]^_[3],fe=4,Z=1;Z<q;Z++){var ne=S[F>>>24]^I[V>>>16&255]^$[w>>>8&255]^W[j&255]^_[fe++],ee=S[V>>>24]^I[w>>>16&255]^$[j>>>8&255]^W[F&255]^_[fe++],ce=S[w>>>24]^I[j>>>16&255]^$[F>>>8&255]^W[V&255]^_[fe++],N=S[j>>>24]^I[F>>>16&255]^$[V>>>8&255]^W[w&255]^_[fe++];F=ne,V=ee,w=ce,j=N}var ne=(T[F>>>24]<<24|T[V>>>16&255]<<16|T[w>>>8&255]<<8|T[j&255])^_[fe++],ee=(T[V>>>24]<<24|T[w>>>16&255]<<16|T[j>>>8&255]<<8|T[F&255])^_[fe++],ce=(T[w>>>24]<<24|T[j>>>16&255]<<16|T[F>>>8&255]<<8|T[V&255])^_[fe++],N=(T[j>>>24]<<24|T[F>>>16&255]<<16|T[V>>>8&255]<<8|T[w&255])^_[fe++];y[E]=ne,y[E+1]=ee,y[E+2]=ce,y[E+3]=N},keySize:256/32});l.AES=f._createHelper(c)}(),r.AES})}(Qr)),Qr.exports}var en={exports:{}},ya;function g0(){return ya||(ya=1,function(x,X){(function(r,l,k){x.exports=l(Le(),bt(),Et(),mt(),je())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.WordArray,b=k.BlockCipher,i=l.algo,p=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],d=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],v=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],C=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],m=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],s=i.DES=b.extend({_doReset:function(){for(var o=this._key,c=o.words,y=[],E=0;E<56;E++){var _=p[E]-1;y[E]=c[_>>>5]>>>31-_%32&1}for(var S=this._subKeys=[],I=0;I<16;I++){for(var $=S[I]=[],W=v[I],E=0;E<24;E++)$[E/6|0]|=y[(d[E]-1+W)%28]<<31-E%6,$[4+(E/6|0)]|=y[28+(d[E+24]-1+W)%28]<<31-E%6;$[0]=$[0]<<1|$[0]>>>31;for(var E=1;E<7;E++)$[E]=$[E]>>>(E-1)*4+3;$[7]=$[7]<<5|$[7]>>>27}for(var T=this._invSubKeys=[],E=0;E<16;E++)T[E]=S[15-E]},encryptBlock:function(o,c){this._doCryptBlock(o,c,this._subKeys)},decryptBlock:function(o,c){this._doCryptBlock(o,c,this._invSubKeys)},_doCryptBlock:function(o,c,y){this._lBlock=o[c],this._rBlock=o[c+1],h.call(this,4,252645135),h.call(this,16,65535),n.call(this,2,858993459),n.call(this,8,16711935),h.call(this,1,1431655765);for(var E=0;E<16;E++){for(var _=y[E],S=this._lBlock,I=this._rBlock,$=0,W=0;W<8;W++)$|=C[W][((I^_[W])&m[W])>>>0];this._lBlock=I,this._rBlock=S^$}var T=this._lBlock;this._lBlock=this._rBlock,this._rBlock=T,h.call(this,1,1431655765),n.call(this,8,16711935),n.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),o[c]=this._lBlock,o[c+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function h(o,c){var y=(this._lBlock>>>o^this._rBlock)&c;this._rBlock^=y,this._lBlock^=y<<o}function n(o,c){var y=(this._rBlock>>>o^this._lBlock)&c;this._lBlock^=y,this._rBlock^=y<<o}l.DES=b._createHelper(s);var e=i.TripleDES=b.extend({_doReset:function(){var o=this._key,c=o.words;if(c.length!==2&&c.length!==4&&c.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var y=c.slice(0,2),E=c.length<4?c.slice(0,2):c.slice(2,4),_=c.length<6?c.slice(0,2):c.slice(4,6);this._des1=s.createEncryptor(f.create(y)),this._des2=s.createEncryptor(f.create(E)),this._des3=s.createEncryptor(f.create(_))},encryptBlock:function(o,c){this._des1.encryptBlock(o,c),this._des2.decryptBlock(o,c),this._des3.encryptBlock(o,c)},decryptBlock:function(o,c){this._des3.decryptBlock(o,c),this._des2.encryptBlock(o,c),this._des1.decryptBlock(o,c)},keySize:192/32,ivSize:64/32,blockSize:64/32});l.TripleDES=b._createHelper(e)}(),r.TripleDES})}(en)),en.exports}var tn={exports:{}},wa;function y0(){return wa||(wa=1,function(x,X){(function(r,l,k){x.exports=l(Le(),bt(),Et(),mt(),je())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.StreamCipher,b=l.algo,i=b.RC4=f.extend({_doReset:function(){for(var v=this._key,C=v.words,m=v.sigBytes,s=this._S=[],h=0;h<256;h++)s[h]=h;for(var h=0,n=0;h<256;h++){var e=h%m,o=C[e>>>2]>>>24-e%4*8&255;n=(n+s[h]+o)%256;var c=s[h];s[h]=s[n],s[n]=c}this._i=this._j=0},_doProcessBlock:function(v,C){v[C]^=p.call(this)},keySize:256/32,ivSize:0});function p(){for(var v=this._S,C=this._i,m=this._j,s=0,h=0;h<4;h++){C=(C+1)%256,m=(m+v[C])%256;var n=v[C];v[C]=v[m],v[m]=n,s|=v[(v[C]+v[m])%256]<<24-h*8}return this._i=C,this._j=m,s}l.RC4=f._createHelper(i);var d=b.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var v=this.cfg.drop;v>0;v--)p.call(this)}});l.RC4Drop=f._createHelper(d)}(),r.RC4})}(tn)),tn.exports}var rn={exports:{}},ba;function w0(){return ba||(ba=1,function(x,X){(function(r,l,k){x.exports=l(Le(),bt(),Et(),mt(),je())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.StreamCipher,b=l.algo,i=[],p=[],d=[],v=b.Rabbit=f.extend({_doReset:function(){for(var m=this._key.words,s=this.cfg.iv,h=0;h<4;h++)m[h]=(m[h]<<8|m[h]>>>24)&16711935|(m[h]<<24|m[h]>>>8)&4278255360;var n=this._X=[m[0],m[3]<<16|m[2]>>>16,m[1],m[0]<<16|m[3]>>>16,m[2],m[1]<<16|m[0]>>>16,m[3],m[2]<<16|m[1]>>>16],e=this._C=[m[2]<<16|m[2]>>>16,m[0]&4294901760|m[1]&65535,m[3]<<16|m[3]>>>16,m[1]&4294901760|m[2]&65535,m[0]<<16|m[0]>>>16,m[2]&4294901760|m[3]&65535,m[1]<<16|m[1]>>>16,m[3]&4294901760|m[0]&65535];this._b=0;for(var h=0;h<4;h++)C.call(this);for(var h=0;h<8;h++)e[h]^=n[h+4&7];if(s){var o=s.words,c=o[0],y=o[1],E=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,S=E>>>16|_&4294901760,I=_<<16|E&65535;e[0]^=E,e[1]^=S,e[2]^=_,e[3]^=I,e[4]^=E,e[5]^=S,e[6]^=_,e[7]^=I;for(var h=0;h<4;h++)C.call(this)}},_doProcessBlock:function(m,s){var h=this._X;C.call(this),i[0]=h[0]^h[5]>>>16^h[3]<<16,i[1]=h[2]^h[7]>>>16^h[5]<<16,i[2]=h[4]^h[1]>>>16^h[7]<<16,i[3]=h[6]^h[3]>>>16^h[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>24)&16711935|(i[n]<<24|i[n]>>>8)&4278255360,m[s+n]^=i[n]},blockSize:128/32,ivSize:64/32});function C(){for(var m=this._X,s=this._C,h=0;h<8;h++)p[h]=s[h];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<p[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<p[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<p[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<p[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<p[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<p[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<p[6]>>>0?1:0)|0,this._b=s[7]>>>0<p[7]>>>0?1:0;for(var h=0;h<8;h++){var n=m[h]+s[h],e=n&65535,o=n>>>16,c=((e*e>>>17)+e*o>>>15)+o*o,y=((n&4294901760)*n|0)+((n&65535)*n|0);d[h]=c^y}m[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,m[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,m[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,m[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,m[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,m[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,m[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,m[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}l.Rabbit=f._createHelper(v)}(),r.Rabbit})}(rn)),rn.exports}var nn={exports:{}},Ea;function b0(){return Ea||(Ea=1,function(x,X){(function(r,l,k){x.exports=l(Le(),bt(),Et(),mt(),je())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.StreamCipher,b=l.algo,i=[],p=[],d=[],v=b.RabbitLegacy=f.extend({_doReset:function(){var m=this._key.words,s=this.cfg.iv,h=this._X=[m[0],m[3]<<16|m[2]>>>16,m[1],m[0]<<16|m[3]>>>16,m[2],m[1]<<16|m[0]>>>16,m[3],m[2]<<16|m[1]>>>16],n=this._C=[m[2]<<16|m[2]>>>16,m[0]&4294901760|m[1]&65535,m[3]<<16|m[3]>>>16,m[1]&4294901760|m[2]&65535,m[0]<<16|m[0]>>>16,m[2]&4294901760|m[3]&65535,m[1]<<16|m[1]>>>16,m[3]&4294901760|m[0]&65535];this._b=0;for(var e=0;e<4;e++)C.call(this);for(var e=0;e<8;e++)n[e]^=h[e+4&7];if(s){var o=s.words,c=o[0],y=o[1],E=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,S=E>>>16|_&4294901760,I=_<<16|E&65535;n[0]^=E,n[1]^=S,n[2]^=_,n[3]^=I,n[4]^=E,n[5]^=S,n[6]^=_,n[7]^=I;for(var e=0;e<4;e++)C.call(this)}},_doProcessBlock:function(m,s){var h=this._X;C.call(this),i[0]=h[0]^h[5]>>>16^h[3]<<16,i[1]=h[2]^h[7]>>>16^h[5]<<16,i[2]=h[4]^h[1]>>>16^h[7]<<16,i[3]=h[6]^h[3]>>>16^h[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>24)&16711935|(i[n]<<24|i[n]>>>8)&4278255360,m[s+n]^=i[n]},blockSize:128/32,ivSize:64/32});function C(){for(var m=this._X,s=this._C,h=0;h<8;h++)p[h]=s[h];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<p[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<p[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<p[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<p[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<p[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<p[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<p[6]>>>0?1:0)|0,this._b=s[7]>>>0<p[7]>>>0?1:0;for(var h=0;h<8;h++){var n=m[h]+s[h],e=n&65535,o=n>>>16,c=((e*e>>>17)+e*o>>>15)+o*o,y=((n&4294901760)*n|0)+((n&65535)*n|0);d[h]=c^y}m[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,m[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,m[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,m[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,m[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,m[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,m[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,m[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}l.RabbitLegacy=f._createHelper(v)}(),r.RabbitLegacy})}(nn)),nn.exports}var an={exports:{}},ka;function E0(){return ka||(ka=1,function(x,X){(function(r,l,k){x.exports=l(Le(),bt(),Et(),mt(),je())})(Fe,function(r){return function(){var l=r,k=l.lib,f=k.BlockCipher,b=l.algo;const i=16,p=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],d=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var v={pbox:[],sbox:[]};function C(e,o){let c=o>>24&255,y=o>>16&255,E=o>>8&255,_=o&255,S=e.sbox[0][c]+e.sbox[1][y];return S=S^e.sbox[2][E],S=S+e.sbox[3][_],S}function m(e,o,c){let y=o,E=c,_;for(let S=0;S<i;++S)y=y^e.pbox[S],E=C(e,y)^E,_=y,y=E,E=_;return _=y,y=E,E=_,E=E^e.pbox[i],y=y^e.pbox[i+1],{left:y,right:E}}function s(e,o,c){let y=o,E=c,_;for(let S=i+1;S>1;--S)y=y^e.pbox[S],E=C(e,y)^E,_=y,y=E,E=_;return _=y,y=E,E=_,E=E^e.pbox[1],y=y^e.pbox[0],{left:y,right:E}}function h(e,o,c){for(let I=0;I<4;I++){e.sbox[I]=[];for(let $=0;$<256;$++)e.sbox[I][$]=d[I][$]}let y=0;for(let I=0;I<i+2;I++)e.pbox[I]=p[I]^o[y],y++,y>=c&&(y=0);let E=0,_=0,S=0;for(let I=0;I<i+2;I+=2)S=m(e,E,_),E=S.left,_=S.right,e.pbox[I]=E,e.pbox[I+1]=_;for(let I=0;I<4;I++)for(let $=0;$<256;$+=2)S=m(e,E,_),E=S.left,_=S.right,e.sbox[I][$]=E,e.sbox[I][$+1]=_;return!0}var n=b.Blowfish=f.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,o=e.words,c=e.sigBytes/4;h(v,o,c)}},encryptBlock:function(e,o){var c=m(v,e[o],e[o+1]);e[o]=c.left,e[o+1]=c.right},decryptBlock:function(e,o){var c=s(v,e[o],e[o+1]);e[o]=c.left,e[o+1]=c.right},blockSize:64/32,keySize:128/32,ivSize:64/32});l.Blowfish=f._createHelper(n)}(),r.Blowfish})}(an)),an.exports}(function(x,X){(function(r,l,k){x.exports=l(Le(),Kt(),Ji(),Qi(),bt(),e0(),Et(),Yn(),Nr(),t0(),Qn(),r0(),n0(),a0(),Pr(),o0(),mt(),je(),i0(),s0(),l0(),c0(),d0(),f0(),u0(),h0(),p0(),x0(),m0(),v0(),g0(),y0(),w0(),b0(),E0())})(Fe,function(r){return r})})(Mn);var k0=Mn.exports;const jt=Pn(k0);function C0(){return jt.SHA256("fabric-editor-2024-secret-key-v1.0").toString()}function B0(){return C0()}function Ca(x){if(!x||typeof x!="object")return x;if(Array.isArray(x))return x.map(r=>Ca(r));const X=JSON.parse(JSON.stringify(x));if(X.objects&&Array.isArray(X.objects)&&(X.objects=X.objects.map(r=>{var l;if(r.type==="image"&&r.src&&(r.customData||(r.customData={}),r.src.startsWith("blob:")&&r.customData.savedSrc?r.src=r.customData.savedSrc:r.src.startsWith("data:")&&(r.customData.savedSrc||(r.customData.savedSrc=r.src))),(l=r==null?void 0:r.customData)!=null&&l.isPatternRect){r.customData||(r.customData={});const k=r.customData.patternSource,f=r.customData.savedSrc;typeof k=="string"?k.startsWith("blob:")&&typeof f=="string"&&f.startsWith("data:")?r.customData.patternSource=f:k.startsWith("data:")&&!r.customData.savedSrc&&(r.customData.savedSrc=k):!k&&typeof f=="string"&&f.startsWith("data:")&&(r.customData.patternSource=f)}return r})),X.backgroundImage&&typeof X.backgroundImage=="object"){const r=X.backgroundImage;r.src&&typeof r.src=="string"&&(r.src.startsWith("blob:")&&r.savedSrc&&typeof r.savedSrc=="string"&&r.savedSrc.startsWith("data:")?r.src=r.savedSrc:r.src.startsWith("data:")&&!r.savedSrc&&(r.savedSrc=r.src))}return X}function _0(x,X){try{const r=X||B0(),l=Ca(x),k=JSON.stringify(l);return jt.AES.encrypt(k,r,{mode:jt.mode.CBC,padding:jt.pad.Pkcs7}).toString()}catch(r){throw console.error("[encryptJson] 加密失败:",r),new Error("JSON 加密失败")}}const A0={class:"preview"},D0={class:"preview-header"},F0=["disabled"],S0={key:0},N0={key:1},I0=["disabled"],R0={class:"preview-canvas-wrapper"},z0=["aria-label"],T0={key:0,class:"preview-loading"},O0=["disabled"],L0={key:2,class:"preview-indicator"},P0={class:"preview-zoom"},U0={key:0,class:"preview-zoom-loading"},M0={class:"preview-zoom-tools"},W0=["disabled"],V0=["disabled"],$0=["disabled"],H0=["disabled"],q0=["src"],X0=["disabled"],Z0={key:0,class:"progress-modal"},G0={class:"progress-container"},Y0={class:"progress-content"},K0={class:"progress-bar-wrapper"},j0={class:"progress-bar-container"},J0={class:"progress-marks"},Q0={class:"progress-percent"},es=["data-value"],At=1600,ts=((x,X)=>{const r=x.__vccOpts||x;for(const[l,k]of X)r[l]=k;return r})(t.defineComponent({__name:"PreviewPanel",props:{renderData:{type:Object,default:null},previewTitle:{type:String,default:""},templateIndex:{type:Number,default:0},templateTotal:{type:Number,default:0},getRenderDataForIndex:{type:Function,default:null},getAllDiecutFabricData:{type:Function,default:null}},emits:["prev-template","next-template"],setup(x,{emit:X}){const r=x,l=X,k=t.ref(null),f=t.ref(null),b=t.ref(null),i=t.ref(!1),p=t.ref(!1),d=t.ref(!1),v=t.ref(!1),C=t.ref(!1),m=t.ref(0);let s=null;const h=t.ref(null),n=t.ref(null),e=t.ref(null),o=t.ref(1),c=new Map,y=new Map,E=new Map,_=new Map,S=new Map;let I=0,$=null,W=null,T=0,q=null,F=0,V=0;const w={width:0,height:0,dpr:0};let j=!1;const fe=new Map,Z=t.computed(()=>r.templateTotal>0&&r.templateIndex>0),ne=t.computed(()=>r.templateTotal>0&&r.templateIndex<r.templateTotal-1),ee=t.computed(()=>r.templateTotal?r.templateIndex+1:0),ce=O=>`${((O==null?void 0:O.trim())||"preview").replace(/[\\/:*?"<>|]+/g,"_")}.png`,N=O=>{var J,Q,re,de,pe,ke;const H={psdJson:{canvasWidth:(J=O.psdJson)==null?void 0:J.canvasWidth,canvasHeight:(Q=O.psdJson)==null?void 0:Q.canvasHeight,layerList:(de=(re=O.psdJson)==null?void 0:re.layerList)==null?void 0:de.map(ge=>({name:ge.name,type:ge.type,blendMode:ge.blendMode,bounds:ge.bounds,layerOrder:ge.layerOrder,opacity:ge.opacity,clipping:ge.clipping,isSmartObject:ge.isSmartObject,size:ge.size,originalWidth:ge.originalWidth,originalHeight:ge.originalHeight,transform:ge.transform,meshPoints:ge.meshPoints,vectorMask:ge.vectorMask,filterList:ge.filterList,children:ge.children}))},materialList:(pe=O.materialList)==null?void 0:pe.map(ge=>({layerName:ge.layerName,url:ge.url,sourceName:ge.sourceName})),fabricScreenshotList:(ke=O.fabricScreenshotList)==null?void 0:ke.map(ge=>({id:ge.id,url:ge.url})),width:O.width,height:O.height};try{return JSON.stringify(H)}catch(ge){return console.warn("[preview-panel] 生成renderData签名失败:",ge),`fallback-${Date.now()}`}},z=(O,H="image/png",J=.92)=>new Promise((Q,re)=>{O.toBlob(de=>{de?Q(de):re(new Error("canvas toBlob failed"))},H,J)}),Y=(O,H=200,J=800)=>{s&&(clearTimeout(s),s=null);const Q=()=>{if(m.value>=O){s&&(clearTimeout(s),s=null);return}const re=Math.random()*1.5+.5;m.value=Math.min(O,m.value+re);const de=Math.random()*(J-H)+H;s=window.setTimeout(Q,de)};Q()},K=async()=>{var O;try{if(p.value||v.value)return;v.value=!0,C.value=!0;const H=Math.random()*15+5;m.value=H;const J=Math.floor(1e5+Math.random()*9e5).toString(),Q=new Ki;Y(35,300,1e3);let re=null;if(e.value)try{re=await(await fetch(e.value)).blob(),Y(45,200,800)}catch(xe){console.warn("[preview-panel] 获取blobUrl失败,尝试其他方式:",xe)}if(!re&&n.value)try{const xe=document.createElement("canvas");xe.width=n.value.width,xe.height=n.value.height;const we=xe.getContext("2d");we&&(we.drawImage(n.value,0,0),re=await z(xe),Y(45,200,800))}catch(xe){console.warn("[preview-panel] 从bitmap创建blob失败,尝试其他方式:",xe)}if(!re&&k.value)try{re=await z(k.value),Y(45,200,800)}catch(xe){console.warn("[preview-panel] 从预览canvas创建blob失败:",xe)}if(!re&&r.templateTotal<=1&&r.getRenderDataForIndex)try{Y(55,300,1e3);const xe=await r.getRenderDataForIndex(0);if(xe){Y(65,400,1200);const we={...xe,width:At,height:At};if(te(),q){const Be=await R(we);if(Y(75,300,1e3),Be){const Ne=document.createElement("canvas");Ne.width=Be.width,Ne.height=Be.height;const Ue=Ne.getContext("2d");Ue&&(Ue.drawImage(Be,0,0),re=await z(Ne),(O=Be.close)==null||O.call(Be),Y(80,200,800))}}else{const Be=await br(we),Ne=await Yt(Be);Y(75,300,1e3);const Ue=Ne.canvas??Ne;Ue&&(re=await z(Ue),Y(80,200,800))}}}catch(xe){console.error("[preview-panel] 渲染预览图失败:",xe)}if(re){const Be=`${(r.templateTotal<=1?ce(r.previewTitle):`${ce(r.previewTitle||"template_1")}`).replace(/\.png$/,"")}_${J}_1.png`;Q.file(Be,re),Y(85,200,700),console.log("[preview-panel] 预览图片已添加到zip")}if(r.templateTotal>1){const xe=[],we=r.templateTotal-1;for(let Be=1;Be<r.templateTotal;Be++){const Ne=Be,Ue=(async()=>{var st;try{const at=c.get(Ne),vt=y.get(Ne);let Qe=null;if(vt)try{Qe=await(await fetch(vt)).blob()}catch(Ge){console.warn(`[preview-panel] 获取模板 ${Ne} 的blobUrl失败,尝试渲染:`,Ge)}if(!Qe&&at)try{const Ge=document.createElement("canvas");Ge.width=at.width,Ge.height=at.height;const He=Ge.getContext("2d");He&&(He.drawImage(at,0,0),Qe=await z(Ge))}catch(Ge){console.warn("[preview-panel] 从bitmap创建blob失败,尝试渲染:",Ge)}if(!Qe&&r.getRenderDataForIndex){const Ge=await r.getRenderDataForIndex(Ne);if(Ge){const He={...Ge,width:At,height:At};if(te(),q)try{const qe=await R(He);if(qe){const lt=document.createElement("canvas");lt.width=qe.width,lt.height=qe.height;const pt=lt.getContext("2d");pt&&(pt.drawImage(qe,0,0),Qe=await z(lt),(st=qe.close)==null||st.call(qe))}}catch(qe){console.error(`[preview-panel] 渲染模板 ${Ne} 失败:`,qe)}else try{const qe=await br(He),lt=await Yt(qe),pt=lt.canvas??lt;pt&&(Qe=await z(pt))}catch(qe){console.error(`[preview-panel] 主线程渲染模板 ${Ne} 失败:`,qe)}}}if(Qe){const qe=`${`${ce(r.previewTitle||`template_${Ne+1}`)}`.replace(/\.png$/,"")}_${J}_${Ne+1}.png`;Q.file(qe,Qe),console.log(`[preview-panel] 模板 ${Ne} 已添加到zip`)}else console.warn(`[preview-panel] 模板 ${Ne} 无法获取图片,跳过`)}catch(at){console.error(`[preview-panel] 处理模板 ${Ne} 时出错:`,at)}})();xe.push(Ue)}await Promise.allSettled(xe),Y(88,200,600)}if(r.getAllDiecutFabricData)try{Y(92,300,800);const xe=await r.getAllDiecutFabricData();Y(95,200,600);const we=_0(xe),Ue=`${"fabric_data_all.encrypted.json".replace(/\.encrypted\.json$/,"")}_${J}.encrypted.json`;Q.file(Ue,we),Y(97,200,500),console.log("[preview-panel] 所有刀板的合并加密fabric数据已添加到zip")}catch(xe){console.error("[preview-panel] 导出fabric数据失败:",xe)}Y(98,300,700);const de=await Q.generateAsync({type:"blob"});Y(99,200,500);const ge=`${(r.templateTotal<=1?`${ce(r.previewTitle).replace(".png","")}.zip`:`${ce(r.previewTitle||"templates").replace(".png","")}_all.zip`).replace(/\.zip$/,"")}_${J}.zip`;Y(100,100,300);const he=()=>{if(m.value>=100){const xe=URL.createObjectURL(de),we=document.createElement("a");we.href=xe,we.download=ge,we.click(),URL.revokeObjectURL(xe),console.log("[preview-panel] 文件已开始下载");const Be=Math.random()*5e3;console.log(`[preview-panel] 下载完成,将在 ${Math.round(Be/1e3)} 秒后关闭进度条`),setTimeout(()=>{s&&(clearTimeout(s),s=null),C.value=!1,v.value=!1},Be)}else setTimeout(he,100)};he(),console.log("[preview-panel] 下载完成")}catch(H){console.error("[preview-panel] 下载失败:",H),s&&(clearTimeout(s),s=null),C.value=!1,v.value=!1}},B=()=>{const O=b.value,H=k.value;if(!O||!H)return;const J=window.devicePixelRatio||1,Q=H.style.width;(!Q||Q==="0px")&&(H.style.width="300px"),H.offsetWidth;const de=H.getBoundingClientRect().width||300,pe=de,ke=de,ge=pe;if(Math.abs(w.width-ke)<.1&&Math.abs(w.height-ge)<.1&&w.dpr===J)return;w.width=ke,w.height=ge,w.dpr=J;const he=Math.max(1,Math.floor(ke*J)),xe=he,we=he;(H.width!==xe||H.height!==we)&&(H.width=xe,H.height=we),H.style.height=`${ke}px`},ve=()=>{const O=k.value;if(!O)return;const H=O.getContext("2d");H&&H.clearRect(0,0,O.width,O.height)},Ee=O=>{const H=k.value;if(!O||!H)return;let J=f.value;J||(J=document.createElement("canvas"),f.value=J),(J.width!==H.width||J.height!==H.height)&&(J.width=H.width,J.height=H.height);const Q=J.getContext("2d");if(!Q)return;Q.clearRect(0,0,J.width,J.height),Q.drawImage(O,0,0,J.width,J.height);const re=H.getContext("2d");re&&(re.clearRect(0,0,H.width,H.height),re.drawImage(J,0,0,H.width,H.height))},ue=()=>{e.value&&(URL.revokeObjectURL(e.value),e.value=null)},_e=async O=>{const H=document.createElement("canvas");H.width=O.width,H.height=O.height;const J=H.getContext("2d");if(!J)return;J.drawImage(O,0,0);const Q=await new Promise(re=>H.toBlob(de=>re(de),"image/png"));Q&&(ue(),e.value=URL.createObjectURL(Q))},Me=O=>{c.forEach(H=>{H.close&&H.close()}),c.clear(),y.forEach(H=>URL.revokeObjectURL(H)),y.clear(),E.clear(),console.log("[preview-panel] 已清除所有大图缓存和签名"),n.value&&n.value.close&&n.value.close(),n.value=null,ue()},Se=async(O,H,J)=>{const Q=H;let re=null;J?(re=N(J),E.set(Q,re),console.log(`[preview-panel] 模板 ${Q} renderData签名已保存:`,re.substring(0,50)+"...")):re=E.get(Q)||null;const de=c.get(Q);de&&de.close&&de.close();const pe=y.get(Q);pe&&URL.revokeObjectURL(pe);const ke=E.get(Q);if(ke&&ke!==re){const he=_.get(ke);he&&he.close&&he.close();const xe=S.get(ke);xe&&xe!==e.value&&URL.revokeObjectURL(xe),_.delete(ke),S.delete(ke)}const ge=await createImageBitmap(O);if(c.set(Q,ge),console.log(`[preview-panel] 模板 ${Q} 大图已保存到缓存,当前缓存数量: ${c.size}`),re){const he=_.get(re);he&&he!==ge&&he.close&&he.close();const xe=S.get(re);xe&&xe!==e.value&&URL.revokeObjectURL(xe);try{const we=await createImageBitmap(ge);_.set(re,we),console.log(`[preview-panel] 签名 ${re.substring(0,50)}... 的bitmap已保存到签名缓存(独立副本)`)}catch(we){console.warn("[preview-panel] 为签名缓存克隆bitmap失败,使用原bitmap:",we),_.set(re,ge)}try{const we=document.createElement("canvas");we.width=ge.width,we.height=ge.height;const Be=we.getContext("2d");if(Be){Be.drawImage(ge,0,0);const Ne=await new Promise(Ue=>we.toBlob(st=>Ue(st),"image/png"));if(Ne){const Ue=URL.createObjectURL(Ne);S.set(re,Ue),console.log(`[preview-panel] 签名 ${re.substring(0,50)}... 的blobUrl已保存到签名缓存`)}}}catch(we){console.warn("[preview-panel] 为签名缓存生成blobUrl失败:",we)}}if(Q===r.templateIndex)n.value&&n.value.close&&n.value.close(),n.value=ge,_e(ge);else{const he=document.createElement("canvas");he.width=ge.width,he.height=ge.height;const xe=he.getContext("2d");if(xe){xe.drawImage(ge,0,0);const we=await new Promise(Be=>he.toBlob(Ne=>Be(Ne),"image/png"));if(we){const Be=URL.createObjectURL(we);y.set(Q,Be)}}}},Ze=async(O,H)=>{var we;const J=H??r.templateIndex,Q=N(O),re=_.get(Q),de=S.get(Q);if((re||de)&&(console.log(`[preview-panel] 模板 ${J} 找到相同签名的缓存,直接复用`),re))try{const Be=await createImageBitmap(re);await Se(Be,J,O);return}catch(Be){console.warn("[preview-panel] 从签名缓存克隆bitmap失败,继续渲染:",Be),_.delete(Q),de&&de!==e.value?(URL.revokeObjectURL(de),S.delete(Q)):de&&S.delete(Q)}const pe=c.get(J),ke=y.get(J),ge=E.get(J);if((pe||ke)&&ge===Q){if(console.log(`[preview-panel] 模板 ${J} 大图已在缓存中且签名匹配,直接使用`),J===r.templateIndex&&pe)try{const Be=document.createElement("canvas");Be.width=pe.width,Be.height=pe.height;const Ne=Be.getContext("2d");if(Ne){Ne.drawImage(pe,0,0),n.value&&n.value.close&&n.value.close(),n.value=pe,_e(pe);return}}catch(Be){console.warn("[preview-panel] 缓存的bitmap不可用,需要重新渲染:",Be),c.delete(J),ke&&(URL.revokeObjectURL(ke),y.delete(J)),E.delete(J)}return}ge&&ge!==Q&&(console.log(`[preview-panel] 模板 ${J} renderData签名已变化,需要重新渲染`),console.log(`[preview-panel] 旧签名: ${ge.substring(0,50)}...`),console.log(`[preview-panel] 新签名: ${Q.substring(0,50)}...`)),console.log(`[preview-panel] 模板 ${J} 开始渲染大图`);const he=++I,xe={...O,width:At,height:At};if(te(),!q)throw new Error("Web Worker 不可用,无法在 worker 中渲染大图");try{const Be=await R(xe);if(!Be)throw new Error("Worker 渲染返回空结果");if(he!==I){(we=Be.close)==null||we.call(Be);return}await Se(Be,J,O)}catch(Be){throw console.error("[preview-panel] renderLargePreview in worker failed:",Be),Be}},We=async()=>{i.value=!0,o.value=1,await t.nextTick();const O=r.templateIndex,H=c.get(O),J=y.get(O);if(J||H){H&&(n.value&&n.value.close&&n.value.close(),n.value=H),J?(e.value&&e.value!==J&&ue(),e.value=J):H&&_e(H);const re=h.value;if(re&&n.value){re.width=n.value.width,re.height=n.value.height;const de=re.getContext("2d");de&&(de.clearRect(0,0,re.width,re.height),de.drawImage(n.value,0,0))}p.value=!1,G();return}const Q=r.renderData;if(Q){p.value=!0;try{await Ze(Q,O),await t.nextTick();const re=h.value;if(re&&n.value){re.width=n.value.width,re.height=n.value.height;const de=re.getContext("2d");de&&(de.clearRect(0,0,re.width,re.height),de.drawImage(n.value,0,0))}p.value=!1,G()}catch(re){console.error("[preview-panel] 在 web worker 中渲染大图失败:",re),p.value=!1}}else p.value=!1},g=async O=>{if(p.value)return;let H;if(O==="prev"){if(!Z.value)return;H=r.templateIndex-1}else{if(!ne.value)return;H=r.templateIndex+1}let J=null;if(r.getRenderDataForIndex)try{J=await r.getRenderDataForIndex(H)}catch(he){console.error(`[preview-panel] 获取模板 ${H} 渲染数据失败:`,he);return}else J=r.renderData;if(!J){console.warn(`[preview-panel] 模板 ${H} 没有渲染数据`);return}const Q=N(J),re=_.get(Q),de=S.get(Q);if(re||de){if(console.log(`[preview-panel] 模板 ${H} 从签名缓存中获取大图(元素未变化)`),de){if(e.value&&e.value!==de&&ue(),e.value=de,re)try{const he=await createImageBitmap(re);await Se(he,H,J),n.value&&n.value.close&&n.value.close(),n.value=he}catch(he){console.warn("[preview-panel] 从签名缓存克隆bitmap失败,仅使用blobUrl:",he),_.delete(Q)}await t.nextTick(),G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}if(re)try{const he=await createImageBitmap(re);await Se(he,H,J),n.value&&n.value.close&&n.value.close(),n.value=he,_e(he),await t.nextTick();const xe=h.value;if(xe&&n.value){xe.width=n.value.width,xe.height=n.value.height;const we=xe.getContext("2d");we&&(we.clearRect(0,0,xe.width,xe.height),we.drawImage(n.value,0,0))}G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}catch(he){console.warn("[preview-panel] 从签名缓存克隆bitmap失败,尝试其他方式:",he),_.delete(Q),de&&de!==e.value?(URL.revokeObjectURL(de),S.delete(Q)):de&&S.delete(Q)}}const pe=c.get(H),ke=y.get(H),ge=E.get(H);if((pe||ke)&&ge===Q){if(console.log(`[preview-panel] 模板 ${H} 从索引缓存中获取大图(元素未变化)`),ke){if(e.value&&e.value!==ke&&ue(),e.value=ke,pe)try{const he=document.createElement("canvas");he.width=pe.width,he.height=pe.height;const xe=he.getContext("2d");xe&&(xe.drawImage(pe,0,0),n.value&&n.value.close&&n.value.close(),n.value=pe)}catch(he){console.warn("[preview-panel] 索引缓存的bitmap不可用,仅使用blobUrl:",he),c.delete(H)}await t.nextTick(),G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}if(pe){try{const he=document.createElement("canvas");he.width=pe.width,he.height=pe.height;const xe=he.getContext("2d");xe&&(xe.drawImage(pe,0,0),n.value&&n.value.close&&n.value.close(),n.value=pe,_e(pe))}catch(he){console.warn("[preview-panel] 索引缓存的bitmap不可用,需要重新渲染:",he),c.delete(H),E.delete(H)}if(c.has(H)){await t.nextTick();const he=h.value;if(he&&n.value){he.width=n.value.width,he.height=n.value.height;const xe=he.getContext("2d");xe&&(xe.clearRect(0,0,he.width,he.height),xe.drawImage(n.value,0,0))}G(),j=!0,l(O==="prev"?"prev-template":"next-template");return}}}console.log(ge&&ge!==Q?`[preview-panel] 模板 ${H} 元素已变化,需要重新渲染`:`[preview-panel] 模板 ${H} 缓存中没有大图,需要渲染`),j=!0,p.value=!0,l(O==="prev"?"prev-template":"next-template"),await t.nextTick();try{await Ze(J,H),await t.nextTick();const he=h.value;if(he&&n.value){he.width=n.value.width,he.height=n.value.height;const xe=he.getContext("2d");xe&&(xe.clearRect(0,0,he.width,he.height),xe.drawImage(n.value,0,0))}p.value=!1,G()}catch(he){console.error(`[preview-panel] 在 web worker 中渲染模板 ${H} 大图失败:`,he),p.value=!1}},ae=()=>{p.value||(i.value=!1,p.value=!1,o.value=1)},te=()=>{q||typeof Worker>"u"||typeof OffscreenCanvas>"u"||(q=new Worker(new URL("/assets/renderWorker-xde7w90h.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ot&&ot.tagName.toUpperCase()==="SCRIPT"&&ot.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"}),q.onmessage=O=>{const{id:H,bitmap:J,error:Q}=O.data||{},re=fe.get(H);if(re){if(fe.delete(H),Q){re.reject(new Error(Q));return}re.resolve(J??null)}},q.onerror=O=>{fe.forEach(({reject:H})=>H(new Error(O.message||"render worker error"))),fe.clear()})},P=O=>{if(O==null||typeof O!="object"||O instanceof ImageBitmap||O instanceof Blob||O instanceof ArrayBuffer)return O;if(Array.isArray(O))return O.map(J=>P(J));const H={};for(const J in O)Object.prototype.hasOwnProperty.call(O,J)&&(H[J]=P(O[J]));return H},R=async O=>{if(te(),!q)return Promise.resolve(null);const H=++F,J=new Promise((de,pe)=>{fe.set(H,{resolve:de,reject:pe})}),Q=await br(O),re=P(Q);return q.postMessage({id:H,renderData:re}),J};t.watch(()=>r.renderData,async O=>{var Q;const H=k.value;if(!O||!H){ve(),Me(),d.value=!1;return}const J=++T;try{const re={...O,width:1600,height:1600};console.log(re);let de=null;try{de=await R(re)}catch(he){console.warn("[preview-panel] render worker failed, fallback to main thread.",he)}if(J!==T){(Q=de==null?void 0:de.close)==null||Q.call(de),d.value=!1;return}if(de){W&&W.close&&W.close(),W=de,B(),Ee(de);const he=r.templateIndex;await Se(de,he,O),d.value=!1;return}const pe=await Yt(re);if(J!==T){d.value=!1;return}const ke=pe.canvas??pe;if(!ke||!H){d.value=!1;return}W=ke,B(),Ee(ke);const ge=r.templateIndex;try{const he=await createImageBitmap(ke);await Se(he,ge,O)}catch(he){console.warn("[preview-panel] 从 canvas 创建 ImageBitmap 失败:",he)}d.value=!1}catch(re){console.error("[preview-panel] renderByJson failed:",re),d.value=!1}},{immediate:!0}),t.watch(()=>r.previewTitle,()=>{d.value=!0}),t.watch([e,n],()=>{(e.value||n.value)&&(p.value=!1)}),t.watch(()=>r.templateIndex,(O,H)=>{if(j){j=!1;return}if(i.value){const J=c.get(O),Q=y.get(O);if(console.log(`[preview-panel] templateIndex 变化到 ${O},缓存检查:`,{hasBitmap:!!J,hasBlobUrl:!!Q,mapSize:c.size,blobMapSize:y.size}),J||Q){console.log(`[preview-panel] 模板 ${O} 从缓存中获取大图(templateIndex watch)`),J&&(n.value&&n.value.close&&n.value.close(),n.value=J),Q?(e.value&&e.value!==Q&&ue(),e.value=Q):J&&_e(J),t.nextTick(()=>{const de=h.value;if(de&&n.value){de.width=n.value.width,de.height=n.value.height;const pe=de.getContext("2d");pe&&(pe.clearRect(0,0,de.width,de.height),pe.drawImage(n.value,0,0))}G()});return}const re=r.renderData;re&&(console.log(`[preview-panel] 模板 ${O} 缓存中没有大图,调用 renderLargePreview(templateIndex watch)`),p.value=!0,Ze(re,O).then(()=>{t.nextTick(()=>{const de=h.value;if(de&&n.value){de.width=n.value.width,de.height=n.value.height;const pe=de.getContext("2d");pe&&(pe.clearRect(0,0,de.width,de.height),pe.drawImage(n.value,0,0))}p.value=!1,G()})}).catch(de=>{console.error("[preview-panel] 切换模板渲染大图失败:",de),p.value=!1}))}});const G=()=>{const O=h.value;O&&(O.style.transform=`scale(${o.value})`)},le=O=>{if(p.value)return;O.preventDefault();const J=(O.deltaY||0)>0?-.1:.1,Q=Math.min(4,Math.max(.2,Number((o.value+J).toFixed(2))));o.value=Q,G()},ie=O=>{if(p.value)return;const H=Math.min(4,Math.max(.2,Number((o.value+O).toFixed(2))));o.value=H,G()};return t.onMounted(()=>{B(),b.value&&($=new ResizeObserver(()=>{V&&cancelAnimationFrame(V),V=requestAnimationFrame(()=>{B(),W&&Ee(W)})}),$.observe(b.value),k.value&&$.observe(k.value))}),t.onBeforeUnmount(()=>{V&&(cancelAnimationFrame(V),V=0),$&&b.value&&$.unobserve(b.value),$=null,Me(),W&&W.close&&W.close(),W=null,q&&(q.terminate(),q=null,fe.clear())}),(O,H)=>(t.openBlock(),t.createElementBlock("aside",A0,[t.createElementVNode("div",D0,[H[7]||(H[7]=t.createElementVNode("span",null,"预览效果",-1)),t.createElementVNode("button",{class:"ghost",type:"button",disabled:p.value||v.value,onClick:K},[v.value?(t.openBlock(),t.createElementBlock("span",S0,"下载中...")):(t.openBlock(),t.createElementBlock("span",N0,"下载"))],8,F0)]),t.createElementVNode("div",{ref_key:"previewBody",ref:b,class:"preview-body"},[x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:0,class:"preview-nav preview-nav-left",type:"button",disabled:!Z.value||d.value,"aria-label":"上一张",onClick:H[0]||(H[0]=J=>l("prev-template"))}," < ",8,I0)):t.createCommentVNode("",!0),t.createElementVNode("div",R0,[t.createElementVNode("canvas",{ref_key:"previewCanvas",ref:k,"aria-label":x.previewTitle,class:"preview-canvas",onClick:We},null,8,z0),d.value?(t.openBlock(),t.createElementBlock("div",T0,[...H[8]||(H[8]=[t.createElementVNode("span",{class:"preview-loading-spinner"},null,-1),t.createElementVNode("span",null,"加载中...",-1)])])):t.createCommentVNode("",!0)]),x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:1,class:"preview-nav preview-nav-right",type:"button",disabled:!ne.value||d.value,"aria-label":"下一张",onClick:H[1]||(H[1]=J=>l("next-template"))}," > ",8,O0)):t.createCommentVNode("",!0),x.templateTotal>0?(t.openBlock(),t.createElementBlock("div",L0,t.toDisplayString(ee.value)+"/"+t.toDisplayString(x.templateTotal),1)):t.createCommentVNode("",!0)],512),i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"preview-zoom-backdrop",onClick:H[6]||(H[6]=t.withModifiers(J=>p.value?void 0:ae,["self"])),onWheelPassive:t.withModifiers(le,["prevent"])},[t.createElementVNode("div",P0,[p.value?(t.openBlock(),t.createElementBlock("div",U0,[...H[9]||(H[9]=[t.createElementVNode("span",{class:"preview-zoom-spinner"},null,-1),t.createElementVNode("span",null,"大图生成中...",-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",M0,[t.createElementVNode("button",{class:"preview-zoom-btn",type:"button",disabled:p.value,onClick:H[2]||(H[2]=J=>ie(.2))}," + ",8,W0),t.createElementVNode("button",{class:"preview-zoom-btn",type:"button",disabled:p.value,onClick:H[3]||(H[3]=J=>ie(-.2))}," - ",8,V0)]),x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:1,class:"preview-zoom-nav preview-zoom-nav-left",type:"button",disabled:p.value||!Z.value,"aria-label":"上一张",onClick:H[4]||(H[4]=J=>g("prev"))}," < ",8,$0)):t.createCommentVNode("",!0),x.templateTotal>1?(t.openBlock(),t.createElementBlock("button",{key:2,class:"preview-zoom-nav preview-zoom-nav-right",type:"button",disabled:p.value||!ne.value,"aria-label":"下一张",onClick:H[5]||(H[5]=J=>g("next"))}," > ",8,H0)):t.createCommentVNode("",!0),e.value?(t.openBlock(),t.createElementBlock("img",{key:3,src:e.value,class:"preview-zoom-image",alt:"large-preview",style:t.normalizeStyle({transform:`scale(${o.value})`})},null,12,q0)):(t.openBlock(),t.createElementBlock("canvas",{key:4,ref_key:"largePreviewCanvas",ref:h,class:"preview-zoom-canvas",style:t.normalizeStyle({transform:`scale(${o.value})`})},null,4)),t.createElementVNode("button",{class:"preview-zoom-close",type:"button",disabled:p.value,onClick:ae}," × ",8,X0)])],32)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"progress-fade"},{default:t.withCtx(()=>[C.value?(t.openBlock(),t.createElementBlock("div",Z0,[H[15]||(H[15]=t.createElementVNode("div",{class:"progress-backdrop"},null,-1)),H[16]||(H[16]=t.createElementVNode("div",{class:"gradient-bg"},null,-1)),t.createElementVNode("div",G0,[H[14]||(H[14]=t.createElementVNode("div",{class:"floating-shapes"},[t.createElementVNode("div",{class:"floating-shape shape-1"}),t.createElementVNode("div",{class:"floating-shape shape-2"}),t.createElementVNode("div",{class:"floating-shape shape-3"})],-1)),t.createElementVNode("div",Y0,[H[12]||(H[12]=t.createElementVNode("div",{class:"progress-title"},[t.createElementVNode("div",{class:"title-text"},"后台服务渲染中")],-1)),t.createElementVNode("div",K0,[t.createElementVNode("div",j0,[t.createElementVNode("div",{class:"progress-bar-fill",style:t.normalizeStyle({width:`${m.value}%`})},[...H[10]||(H[10]=[t.createElementVNode("div",{class:"liquid-shine"},null,-1)])],4),t.createElementVNode("div",J0,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(10,J=>t.createElementVNode("div",{key:J,class:t.normalizeClass(["progress-mark",{active:m.value>=J*10}])},null,2)),64))])]),t.createElementVNode("div",Q0,[t.createElementVNode("span",{class:"percent-number","data-value":Math.round(m.value)},t.toDisplayString(Math.round(m.value)),9,es),H[11]||(H[11]=t.createElementVNode("span",{class:"percent-symbol"},"%",-1))])]),H[13]||(H[13]=t.createElementVNode("div",{class:"progress-footer"},[t.createElementVNode("div",{class:"footer-dot"}),t.createElementVNode("div",{class:"footer-dot"}),t.createElementVNode("div",{class:"footer-dot"})],-1))])])])):t.createCommentVNode("",!0)]),_:1})]))]))}}),[["__scopeId","data-v-0684bf8d"]]),rs={class:"modal"},ns={class:"modal-header"},as={class:"modal-body"},os={class:"mode-list"},is=["onClick"],ss={key:0,class:"badge"},ls=t.defineComponent({__name:"TemplateModal",props:{templateModeOptions:{type:Array,default:()=>[]},selectedMode:{type:String,default:""}},emits:["update:selected-mode","close"],setup(x,{emit:X}){const r=X;return(l,k)=>(t.openBlock(),t.createElementBlock("div",{class:"modal-backdrop",onClick:k[1]||(k[1]=t.withModifiers(f=>r("close"),["self"]))},[t.createElementVNode("div",rs,[t.createElementVNode("div",ns,[k[2]||(k[2]=t.createElementVNode("span",null,"切换模版",-1)),t.createElementVNode("button",{class:"ghost icon",type:"button",onClick:k[0]||(k[0]=f=>r("close"))},"×")]),t.createElementVNode("div",as,[t.createElementVNode("div",os,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.templateModeOptions,f=>(t.openBlock(),t.createElementBlock("button",{key:f.type,class:t.normalizeClass(["mode-card",{active:x.selectedMode===f.type}]),type:"button",onClick:b=>r("update:selected-mode",f.type)},[t.createElementVNode("div",null,[t.createElementVNode("h4",null,t.toDisplayString(f.label),1),t.createElementVNode("p",null,"尺寸:"+t.toDisplayString(f.size),1)]),x.selectedMode===f.type?(t.openBlock(),t.createElementBlock("span",ss,"默认")):t.createCommentVNode("",!0)],10,is))),128))])])])]))}}),cs={class:"editor"},ds={class:"main"},it="guide-resource",fs=10*1024*1024,on=t.defineComponent({__name:"index",props:{product:{default:null},basicInfo:{default:null},diecutData:{default:null},deformationData:{default:null},options:{default:()=>({showTopbar:!0,showSidebar:!0,showPreview:!0,enableGrid:!0})},productListApi:{},productDetailApi:{},productListPageSize:{},productListInitialPage:{}},setup(x){var $a;const X=x,r=t.computed(()=>typeof X.productListApi=="function"),l=t.ref([]),k=t.ref(0),f=t.ref(X.productListInitialPage??1),b=t.ref(X.productListPageSize??8),i=t.ref(null),p=t.ref(null),d=t.ref(null),v=t.computed(()=>r.value?i.value:X.basicInfo),C=t.computed(()=>r.value?p.value:X.diecutData),m=t.computed(()=>r.value?d.value:X.deformationData),s=t.ref(null),h=t.ref(null),n=t.ref(""),e=t.ref(r.value?"product":"layer"),o=t.ref(!!(($a=X.options)!=null&&$a.enableGrid)),c=t.ref(100),y=t.ref([]),E=t.ref(null),_=t.ref({visible:!1,mode:"",scale:100,isPattern:!1}),S=t.ref({visible:!1,opacity:1}),I=t.ref({visible:!1,fontFamily:"Arial",fontSize:26,charSpacing:0,lineHeight:1.16,fill:"#111827",strokeWidth:0,stroke:"#000000"}),$=t.computed(()=>_.value.visible||I.value.visible||S.value.visible),W=t.ref(0),T=t.ref(0),q=t.ref(""),F=t.ref(!1),V=t.ref(""),w=t.ref(!1),j=t.ref(""),fe=t.ref(0),Z=t.ref(""),ne=t.ref(!1),ee=t.computed(()=>{var a;return((a=X.options)==null?void 0:a.showTopbar)!==!1}),ce=t.computed(()=>{var a;return((a=X.options)==null?void 0:a.showSidebar)!==!1}),N=t.computed(()=>{var a;return((a=X.options)==null?void 0:a.showPreview)!==!1});t.watch(()=>{var a;return(a=X.options)==null?void 0:a.enableGrid},a=>{typeof a=="boolean"&&(o.value=a)}),t.watch(r,a=>{e.value=a?"product":"layer"});const z=new Map,Y=(a,u)=>{!a||!u||z.set(a,JSON.parse(JSON.stringify(u)))},K=a=>a?z.get(a)??null:null;let B=null,ve=1,Ee=null,ue=!1,_e=null,Me=0,Se=null,Ze=0,We=!1,g=!1,ae=!1;const te={width:0,height:0};let P=0,R=0,G=null;const le=()=>{h.value&&(P&&cancelAnimationFrame(P),P=requestAnimationFrame(()=>{if(!h.value)return;const a=Math.max(h.value.clientWidth,1),u=Math.max(h.value.clientHeight,1);Math.abs(a-te.width)<1&&Math.abs(u-te.height)<1||xn()}))},ie=new Map,O=new Map;let H=null;const J=new Map,Q=a=>{console.log("queuePreviewUpdate",a),H&&clearTimeout(H),H=setTimeout(async()=>{try{Ve();const u=ke.value[T.value];if(!(u!=null&&u.jsonURL))return;const D=await(await dt(gt(u.jsonURL))).json(),L=new URL(".",new URL(u.jsonURL,window.location.href)).toString(),U=nr(u.resources||[]),M=Mt(D.layerList||[]),oe=Nt(),se=Z.value?String(Z.value):"";if(se){const Ce=await al();if(Ce){Qt.set(se,Ce);const Ie=xt.get(se);Ie&&URL.revokeObjectURL(Ie),xt.set(se,URL.createObjectURL(Ce))}else console.warn("[ui-editor] 无法生成遮罩截图,预览可能不完整。")}const me=oe.map(Ce=>{const Ie=M.get(Ce.name);if(!Ie)return null;const $e=xt.get(Ce.id);return $e?{id:Ie,url:$e}:null}).filter(Boolean),ye={psdJson:D,materialList:U,fabricScreenshotList:me,width:300,height:300,baseUrl:L};He.value=ye}catch(u){console.error("[ui-editor] renderByJson failed:",u)}finally{H=null}},10)},re=()=>{if(!h.value)return 700;const a=h.value.clientWidth||700,u=h.value.clientHeight||700;return Math.max(400,Math.min(a,u)-40)},de=({canvasEl:a,canvasWrap:u})=>{s.value=a,h.value=u},pe=(a=[])=>a!=null&&a.length?(a.find(A=>/bg|背景/i.test(A.name))??a[0]).url:"",ke=t.computed(()=>{var A;return(((A=m.value)==null?void 0:A.data)??[]).flatMap(D=>(D==null?void 0:D.infos)??[]).map((D,L)=>({id:`${D.name}-${L}`,name:D.name,resources:D.resources??[],jsonURL:D.jsonURL,thumb:pe(D.resources)}))}),ge=t.computed(()=>ke.value.length),he=t.computed(()=>T.value>0),xe=t.computed(()=>T.value<ke.value.length-1),we=()=>{he.value&&(T.value-=1)},Be=()=>{xe.value&&(T.value+=1)},Ne=t.computed(()=>r.value?l.value:X.product?[X.product]:[]);t.computed(()=>ke.value[W.value]);const Ue=t.computed(()=>Ne.value[fe.value]);t.computed(()=>r.value&&Number.isFinite(k.value));const st=t.computed(()=>r.value?k.value:Ne.value.length),at=t.computed(()=>b.value?Math.max(1,Math.ceil(st.value/b.value)):1),vt=t.computed(()=>f.value>1),Qe=t.computed(()=>f.value<at.value),Ge=t.computed(()=>{var a;return((a=v.value)==null?void 0:a.sizes)??[]}),He=t.ref(null),qe=t.computed(()=>{var a,u;return(a=Ue.value)!=null&&a.name?Ue.value.name:((u=v.value)==null?void 0:u.name)||"预览效果"}),lt=t.ref(null),pt=()=>{var D,L,U,M,oe;const a=Number(((D=Ue.value)==null?void 0:D.id)??((L=v.value)==null?void 0:L.id)),u=`${((U=v.value)==null?void 0:U.name)??""}:${(((M=C.value)==null?void 0:M.data)??[]).length}:${(((oe=m.value)==null?void 0:oe.data)??[]).length}`,A=Number.isFinite(a)?`id:${a}`:`data:${u}`;if(lt.value!==A){if(lt.value=A,B){Ht();const se=B.getObjects();se.length>0&&(se.forEach(me=>{B.remove(me)}),B.requestRenderAll()),B.discardActiveObject(),Ve(),et(),Ke(),tt()}He.value=null,Z.value="",W.value=0,T.value=0}},Ut=async(a=f.value)=>{if(X.productListApi)try{const u=await X.productListApi(a,b.value);l.value=(u==null?void 0:u.rows)??[],k.value=Number.isFinite(u==null?void 0:u.total)?Number(u==null?void 0:u.total):l.value.length,f.value=a}catch(u){console.warn("[ui-editor] 获取产品列表失败",u)}},sn=async a=>{if(!X.productDetailApi){console.warn("[ui-editor] 未传 productDetailApi,无法加载产品详情");return}try{const u=await X.productDetailApi(a);i.value=(u==null?void 0:u.basicInfo)??null,p.value=(u==null?void 0:u.diecutData)??null,d.value=(u==null?void 0:u.deformationData)??null}catch(u){console.warn("[ui-editor] 获取产品详情失败",u)}};t.watch(e,a=>{if(B&&a==="layer"){Ve();const u=B.getActiveObject();u&&(et(u,!1),Ke(u),tt(u,!1))}}),t.watch([fe,Ne],()=>{var a;if(Ne.value.length&&fe.value>=Ne.value.length){fe.value=0;return}if(pt(),r.value){const u=(a=Ue.value)==null?void 0:a.id;u!=null&&sn(u)}}),t.watch(()=>[X.basicInfo,X.diecutData,X.deformationData],()=>{r.value||pt()},{deep:!0});const ln=async a=>{r.value&&(a<1||a>at.value||a!==f.value&&(await Ut(a),fe.value=0))},Dt=async()=>{const a=ke.value[T.value];if(!(a!=null&&a.jsonURL))return;const A=await(await dt(gt(a.jsonURL))).json(),D=new URL(".",new URL(a.jsonURL,window.location.href)).toString(),L=nr(a.resources||[]),U=Mt(A.layerList||[]),oe=Nt().map(me=>{const ye=U.get(me.name);if(!ye)return null;const Ce=_a(me.id);return Ce?{id:ye,url:Ce}:null}).filter(Boolean),se={psdJson:A,materialList:L,fabricScreenshotList:oe,width:1e3,height:1e3,baseUrl:D};He.value=se},cn=async a=>{const u=ke.value[a];if(!(u!=null&&u.jsonURL))return null;try{const D=await(await dt(gt(u.jsonURL))).json(),L=new URL(".",new URL(u.jsonURL,window.location.href)).toString(),U=nr(u.resources||[]),M=Mt(D.layerList||[]),se=Nt().map(me=>{const ye=M.get(me.name);if(!ye)return null;const Ce=_a(me.id);return Ce?{id:ye,url:Ce}:null}).filter(Boolean);return{psdJson:D,materialList:U,fabricScreenshotList:se,width:1e3,height:1e3,baseUrl:L}}catch(A){return console.error(`[ui-editor] 构建模板 ${a} 的 renderData 失败:`,A),null}},Ft=t.computed(()=>{var u;return(((u=C.value)==null?void 0:u.data)??[]).filter(A=>A==null?void 0:A.jsonURL).map(A=>({type:A.type,label:A.type==="SPLIT"?"多图拼模板设计":"单片",size:A.size,jsonURL:A.jsonURL,resources:A.resources??[]}))}),Je=t.computed(()=>{var D;const u=(((D=C.value)==null?void 0:D.data)??[]).filter(L=>(L==null?void 0:L.type)==="SPLIT").flatMap(L=>(L==null?void 0:L.resources)??[]),A=new Map;return u.forEach(L=>{if(!(L!=null&&L.groupId))return;const U=A.get(L.groupId)??{id:L.groupId,name:L.groupName||`刀板${A.size+1}`,mask:null,dotted:null,resources:[]};U.resources.push(L),L.type==="MASK"&&(U.mask=L),L.type==="DOTTED_LINE"&&(U.dotted=L),A.set(L.groupId,U)}),A}),ct=t.computed(()=>Array.from(Je.value.values()).map(a=>{var u,A;return{id:a.id,name:a.name,url:((u=a.mask)==null?void 0:u.url)||((A=a.resources[0])==null?void 0:A.url)||""}})),Jt=new Set(["MASK","DOTTED_LINE"]),dn=a=>Jt.has(a==null?void 0:a.type),Qt=new Map,xt=new Map,er=new Map,tr=new Map,_a=a=>{if(!a)return"";const u=xt.get(a);if(u)return u;const A=Qt.get(a);if(!A)return"";const D=URL.createObjectURL(A);return xt.set(a,D),D},St=(a,u)=>(a.customData={id:ve++,label:u},a),Aa=a=>(a==null?void 0:a.type)==="textbox"||(a==null?void 0:a.type)==="i-text",ft=a=>{var A;if(!a||a.excludeFromExport)return!1;const u=(A=a.customData)==null?void 0:A.role;return!(u===it||u==="guide")},hs=a=>{var A;if(!a||a.excludeFromExport)return!1;const u=(A=a.customData)==null?void 0:A.role;return!(u===it||u==="guide"||u==="grid")},ps=a=>{const u=JSON.parse(JSON.stringify(a));return u.customData||(u.customData={}),u.customData.id=ve++,u},fn=a=>Number.isFinite(a)?Math.min(200,Math.max(1,Math.round(a))):100,rr=a=>!a||a===""?"":a==="brick"?"brick-x":a==="brick-x"||a==="brick-y"||a==="mirror"||a==="random"?a:"grid",xs=a=>{if(!a)return null;const u=a.width??a.naturalWidth,A=a.height??a.naturalHeight;return!u||!A?null:{width:u,height:A}},Da=(a,u,A,D)=>{if(!B||!a||!u||!A)return;const L=B.getWidth(),U=B.getHeight(),M=u*D,oe=A*D;!M||!oe||(a.offsetX=(L-M)/2,a.offsetY=(U-oe)/2)},ms=(a,u,A,D,L,U,M=!1,oe=!1)=>{a.save(),a.translate(A+(M?L:0),D+(oe?U:0)),a.scale(M?-1:1,oe?-1:1),a.drawImage(u,0,0,L,U),a.restore()},vs=a=>{var u,A,D,L;return a?(u=a==null?void 0:a.customData)!=null&&u.isPatternRect?((A=a.customData)==null?void 0:A.patternSource)||"":(a==null?void 0:a.type)==="image"&&(((D=a.customData)==null?void 0:D.savedSrc)||((L=a.getSrc)==null?void 0:L.call(a))||a.src)||"":""},gs=async(a,u)=>{var D;const A=a==null?void 0:a.patternElement;if(A)return A;if((a==null?void 0:a.type)==="image"){const L=((D=a.getElement)==null?void 0:D.call(a))||a._element;if(L)return L}return await un(u)},ys=(a,u)=>{const A=a.naturalWidth||a.width,D=a.naturalHeight||a.height,L=rr(u);if(L==="grid"||L==="")return a;const U=document.createElement("canvas"),M=U.getContext("2d");if(!M)return a;if(L==="brick-x")return U.width=A,U.height=D*2,M.drawImage(a,0,0,A,D),M.drawImage(a,-A/2,D,A,D),M.drawImage(a,A/2,D,A,D),U;if(L==="brick-y")return U.width=A*2,U.height=D,M.drawImage(a,0,0,A,D),M.drawImage(a,A,-D/2,A,D),M.drawImage(a,A,D/2,A,D),U;if(L==="mirror")return U.width=A*2,U.height=D*2,M.drawImage(a,0,0,A,D),M.save(),M.translate(A*2,0),M.scale(-1,1),M.drawImage(a,0,0,A,D),M.restore(),M.save(),M.translate(0,D*2),M.scale(1,-1),M.drawImage(a,0,0,A,D),M.restore(),M.save(),M.translate(A*2,D*2),M.scale(-1,-1),M.drawImage(a,0,0,A,D),M.restore(),U;if(L==="random"){U.width=A*3,U.height=D*3;for(let me=0;me<3;me++)for(let ye=0;ye<3;ye++){const Ce=Math.random()<.5,Ie=Math.random()<.5;ms(M,a,ye*A,me*D,A,D,Ce,Ie)}return U}return a},et=(a,u=!0)=>{var oe,se,me;if(!B){_.value={visible:!1,mode:"grid",scale:100,isPattern:!1};return}const A=a??B.getActiveObject(),D=!!((oe=A==null?void 0:A.customData)!=null&&oe.isPatternRect),L=(A==null?void 0:A.type)==="image"||D;if(!A||!L){_.value={visible:!1,mode:"",scale:100,isPattern:!1};return}const U=rr(((se=A.customData)==null?void 0:se.patternMode)||""),M=fn(((me=A.customData)==null?void 0:me.patternScale)??Math.round((A.scaleX??1)*100));_.value={visible:!0,mode:U,scale:M,isPattern:D},u&&e.value!=="add"&&(e.value="add")},Ke=a=>{if(!B){S.value={visible:!1,opacity:1};return}const u=a??B.getActiveObject();if(!ft(u)){S.value={visible:!1,opacity:1};return}S.value={visible:!0,opacity:typeof u.opacity=="number"?u.opacity:1}},tt=(a,u=!0)=>{if(!B){I.value={visible:!1,fontFamily:"Arial",fontSize:26,charSpacing:0,lineHeight:1.16,fill:"#111827",strokeWidth:0,stroke:"#000000"};return}const A=a??B.getActiveObject();if(!Aa(A)){I.value={visible:!1,fontFamily:"Arial",fontSize:26,charSpacing:0,lineHeight:1.16,fill:"#111827",strokeWidth:0,stroke:"#000000"};return}I.value={visible:!0,fontFamily:A.fontFamily||"Arial",fontSize:A.fontSize??26,charSpacing:A.charSpacing??0,lineHeight:A.lineHeight??1.16,fill:A.fill||"#111827",strokeWidth:A.strokeWidth??0,stroke:A.stroke||"#000000"},u&&e.value!=="layer"&&e.value!=="add"&&(e.value="add")},ws=a=>{if(!a)return"";const u=a.match(/^image_(.+?)_[a-zA-Z0-9]+\.png$/);return(u==null?void 0:u[1])||a},nr=(a=[])=>a.filter(u=>u==null?void 0:u.url).map(u=>{const A=u.name||u.groupName||u.fileName||"";return{layerName:ws(A),url:u.url||"",sourceName:A}}).filter(u=>u.layerName&&u.url),Nt=()=>{var D;const u=(((D=C.value)==null?void 0:D.data)??[]).filter(L=>(L==null?void 0:L.type)==="SPLIT").flatMap(L=>(L==null?void 0:L.resources)??[]),A=new Map;return u.forEach(L=>{if(!(L!=null&&L.groupId))return;const U=String(L.groupId),M=A.get(U)??{id:U,name:L.groupName||`刀板${A.size+1}`};L.type==="MASK"&&(M.mask=L),A.set(U,M)}),Array.from(A.values()).filter(L=>{var U;return(U=L.mask)==null?void 0:U.url})},Mt=(a,u=new Map)=>(a.forEach(A=>{(A==null?void 0:A.type)==="Group"&&(A!=null&&A.id)&&(A!=null&&A.name)&&u.set(A.name,A.id),Array.isArray(A.children)&&Mt(A.children,u)}),u),gt=a=>{if(!a)return a;if(typeof window<"u"){const A=window.location.hostname;if(A==="localhost"||A==="127.0.0.1")try{const D=new URL(a);if(D.pathname.startsWith("/files/"))return`${D.pathname}${D.search}${D.hash}`}catch{}}const u=a.match(/^https?:\/\/([^/]+\.oss[^/]*\.aliyuncs\.com)(.*)$/);return u?`/oss${u[2]}`:a},Fa=a=>{if(!a||a.startsWith("data:")||a.startsWith("blob:"))return Promise.resolve(a);const u=a.includes("/files/");if(a.startsWith("/")&&!u)return Promise.resolve(a);const A=er.get(a);if(A)return Promise.resolve(A);const D=tr.get(a);if(D)return D;const L=dt(gt(a),{mode:"cors"}).then(U=>{if(!U.ok)throw new Error(`fetch failed: ${U.status}`);return U.blob()}).then(U=>{const M=URL.createObjectURL(U);return er.set(a,M),tr.delete(a),M}).catch(()=>(tr.delete(a),gt(a)));return tr.set(a,L),L},un=a=>Fa(a).then(u=>new Promise((A,D)=>{const L=new Image;L.crossOrigin="anonymous",L.onload=()=>A(L),L.onerror=D,L.src=u})),yt=(a,u="image/png",A)=>new Promise((D,L)=>{a.toBlob(U=>{if(!U){L(new Error("canvas toBlob failed"));return}D(U)},u,A)}),bs=()=>{_e||typeof Worker>"u"||typeof OffscreenCanvas>"u"||(_e=new Worker(new URL("/assets/maskWorker-ZKs7ClE6.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ot&&ot.tagName.toUpperCase()==="SCRIPT"&&ot.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"}),_e.onmessage=a=>{const{id:u,arrayBuffer:A,error:D}=a.data||{},L=ie.get(u);if(L){if(ie.delete(u),D){L.reject(new Error(D));return}L.resolve(A?new Blob([A],{type:"image/png"}):null)}},_e.onerror=a=>{ie.forEach(({reject:u})=>u(new Error(a.message||"mask worker error"))),ie.clear()})},Es=a=>{if(bs(),!_e)return Promise.resolve(null);const u=++Me,A=new Promise((D,L)=>{ie.set(u,{resolve:D,reject:L})});return _e.postMessage({id:u,...a}),A},ks=()=>{Se||typeof Worker>"u"||(Se=new Worker(new URL("/assets/copyDiecuts.worker-DToLkwQW.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ot&&ot.tagName.toUpperCase()==="SCRIPT"&&ot.src||new URL("editor-sdk.umd.js",document.baseURI).href),{type:"module"}),Se.onmessage=a=>{const{id:u,ok:A,data:D,error:L}=a.data||{},U=O.get(u);if(U){if(O.delete(u),!A||L){U.reject(new Error(L||"copy worker failed"));return}U.resolve(D)}},Se.onerror=a=>{O.forEach(({reject:u})=>u(new Error(a.message||"copy worker error"))),O.clear()})},Cs=a=>{if(ks(),!Se)return Promise.resolve(null);const u=++Ze,A=new Promise((D,L)=>{O.set(u,{resolve:D,reject:L})});return Se.postMessage({id:u,...a}),A},It=async(a,u,A)=>{const D=nt.Image,L={crossOrigin:"anonymous",...A??{}},U=await Fa(a);if(U){if(U.startsWith("blob:")||U.startsWith("data:")){const M=D.fromURL(U,u,L);M!=null&&M.then&&M.then(u).catch(()=>{});return}try{const M=await dt(U,{mode:"cors"});if(!M.ok)throw new Error(`fetch failed: ${M.status}`);const oe=await M.blob(),se=URL.createObjectURL(oe),me=D.fromURL(se,ye=>{URL.revokeObjectURL(se),u(ye)},L);me!=null&&me.then&&me.then(ye=>{URL.revokeObjectURL(se),u(ye)}).catch(()=>{URL.revokeObjectURL(se)});return}catch(M){console.warn("[loadFabricImage] 使用 blob 失败:",M)}}},Ve=()=>{var D;if(!B)return;const u=[...B.getObjects().filter(L=>!L.excludeFromExport)].reverse();y.value=u.map(L=>{var U,M;return{id:((U=L.customData)==null?void 0:U.id)??L.type,name:((M=L.customData)==null?void 0:M.label)??L.type,object:L,visible:L.visible!==!1,locked:!!(L.lockMovementX&&L.lockMovementY&&L.lockScalingX&&L.lockScalingY&&L.lockRotation)}});const A=B.getActiveObject();E.value=((D=A==null?void 0:A.customData)==null?void 0:D.id)??null},ut=()=>{var u;if(!B)return;const a=B.getActiveObject();E.value=((u=a==null?void 0:a.customData)==null?void 0:u.id)??null,a&&(e.value="layer"),et(a,!1),Ke(a),tt(a,!1)},hn=a=>{if(!(!B||!a)){if(typeof a.bringToFront=="function"){a.bringToFront();return}typeof B.bringToFront=="function"&&B.bringToFront(a)}},kt=a=>{if(!B||!a)return;const u=B.getObjects(),A=u.map((M,oe)=>({item:M,index:oe})).filter(({item:M})=>{var oe,se;return((oe=M==null?void 0:M.customData)==null?void 0:oe.role)===it||((se=M==null?void 0:M.customData)==null?void 0:se.role)==="guide"});if(u.includes(a)||B.add(a),!A.length)return;const D=Math.min(...A.map(M=>M.index)),L=B.getObjects().indexOf(a);if(L===-1||L<D)return;const U=Math.max(0,D-1);L!==U&&Array.isArray(B._objects)&&(B._objects.splice(L,1),B._objects.splice(U,0,a),B.requestRenderAll())},Bs=()=>{},Sa=()=>{if(!B)return;const a=St(new nt.Textbox("捷印定制",{left:B.getWidth()/2,top:B.getHeight()/2,width:320,fontSize:48,fontWeight:"bold",fill:"#111827",strokeWidth:I.value.strokeWidth||3,stroke:"#6366f1",originX:"center",originY:"center",textAlign:"center",lineHeight:1.16,charSpacing:0}),`文本-${ve}`);B.add(a),B.setActiveObject(a),Ct(a,"top"),ht(),Ve(),tt(a),ut()},Na=()=>{if(!B)return;const a=St(new nt.Textbox("标签",{left:260,top:260,width:160,fontSize:20,fill:"#1e293b",backgroundColor:"#fde68a",textAlign:"center",padding:6}),`标签-${ve}`);B.add(a),B.setActiveObject(a),Ct(a,"top"),ht(),Ve(),tt(a),ut()},_s=()=>{if(!B)return;const a=St(new nt.Rect({left:180,top:160,width:160,height:110,fill:"#60a5fa",rx:10,ry:10}),`矩形-${ve}`);kt(a),B.setActiveObject(a),Ve(),ut()},As=()=>{if(!B)return;const a=St(new nt.Circle({left:420,top:210,radius:60,fill:"#34d399"}),`圆形-${ve}`);kt(a),B.setActiveObject(a),Ve(),ut()},Ia=async a=>{if(!B||!a)return;await It(a,A=>{A&&(A.scaleToWidth(B.getWidth()),A.set({left:B.getWidth()/2,top:B.getHeight()/2,originX:"center",originY:"center"}),St(A,`图片-${ve}`),B.add(A),B.setActiveObject(A),Ct(A,"top"),ht(),Ve(),et(A),Ke(A),tt(A),ut())},{crossOrigin:"anonymous"})},Ds=a=>{var A,D;const u=(D=(A=a.clipboardData)==null?void 0:A.getData("text"))==null?void 0:D.trim();!u||!/^https?:\/\//i.test(u)||(Ia(u),n.value="")},Wt=a=>new Promise((u,A)=>{const D=new FileReader;D.onload=()=>{typeof D.result=="string"?u(D.result):A(new Error("readBlobAsDataUrl failed"))},D.onerror=()=>A(D.error??new Error("readBlobAsDataUrl failed")),D.readAsDataURL(a)}),Fs=a=>new Promise((u,A)=>{const D=URL.createObjectURL(a),L=new Image;L.onload=()=>{URL.revokeObjectURL(D),u(L)},L.onerror=()=>{URL.revokeObjectURL(D),A(new Error("loadImageFromBlob failed"))},L.src=D}),Ra=a=>a?a.startsWith("data:")?Promise.resolve(a):dt(gt(a)).then(u=>u.blob()).then(u=>Wt(u)).catch(u=>(console.warn("[convertImageUrlToBase64] 转换失败:",a,u),null)):Promise.resolve(null),Ss=async a=>{if(!(a.size>fs))return{dataUrl:await Wt(a),blob:a,compressed:!1};const A=await Fs(a),D=document.createElement("canvas");D.width=A.width,D.height=A.height;const L=D.getContext("2d");if(!L)throw new Error("canvas context not available");L.drawImage(A,0,0,A.width,A.height);let U=null;try{U=await yt(D,"image/webp",.95)}catch(oe){console.warn("[ui-editor] 导出 WebP 失败,回退 PNG",oe),U=null}if(!U)try{U=await yt(D,"image/png")}catch(oe){return console.error("[ui-editor] 导出 PNG 也失败,使用原始文件",oe),{dataUrl:await Wt(a),blob:a,compressed:!1}}return{dataUrl:await Wt(U),blob:U,compressed:!0}},za=async a=>{var L;const u=(L=a.target.files)==null?void 0:L[0];if(a.target.value="",!u||!B)return;let A="";const D=U=>{U&&(U.scaleToWidth(B.getWidth()),U.set({left:B.getWidth()/2,top:B.getHeight()/2,originX:"center",originY:"center"}),St(U,`图片-${ve}`),A&&(U.customData={...U.customData||{},savedSrc:A}),B.add(U),B.setActiveObject(U),Ct(U,"top"),ht(),Ve(),et(U),Ke(U),tt(U),ut())};try{A=(await Ss(u)).dataUrl,await It(A,D)}catch(U){console.warn("[ui-editor] 上传图片压缩失败,改用原图",U),A=await Wt(u),await It(A,D)}},Ns=()=>{if(!B)return;const a=B.getActiveObjects();a.length&&(a.forEach(u=>B.remove(u)),B.discardActiveObject(),Ve(),et(),Ke(),tt(),Q("object:removed"))},Is=()=>{B&&(B.getObjects().forEach(a=>{a.excludeFromExport||B.remove(a)}),B.discardActiveObject(),Ve(),et(),Ke(),tt(),Q("canvas:cleared"))},Rs=()=>{B&&(ne.value=!0)},zs=()=>{ne.value=!1,Is()},pn=()=>{ne.value=!1},Ts=a=>{if(!B||!(a!=null&&a.object))return;B.setActiveObject(a.object),B.requestRenderAll(),E.value=a.id;const u=e.value==="layer";et(a.object,!u),Ke(a.object),tt(a.object)},Os=async a=>{var Oe,De,Pe,Ye;if(!B)return;const u=B.getActiveObject();if(!u)return;const A=vs(u);if(!A)return;const D=!!((Oe=u==null?void 0:u.customData)!=null&&Oe.isPatternRect),L=rr(((De=u.customData)==null?void 0:De.patternMode)||""),U=rr(a);if(D&&L===U){const Xe=B.getObjects().indexOf(u);await It(A,rt=>{var Xa,Za,Ga,Ya;if(!rt)return;const Ha=(Xa=u.customData)==null?void 0:Xa.originalWidth,qa=(Za=u.customData)==null?void 0:Za.originalHeight,yn=(Ga=u.customData)==null?void 0:Ga.originalScaleX,wn=(Ya=u.customData)==null?void 0:Ya.originalScaleY;Ha&&qa&&yn&&wn?rt.set({width:Ha/yn,height:qa/wn,scaleX:yn,scaleY:wn}):rt.scaleToWidth(B.getWidth()),rt.set({left:u.left??B.getWidth()/2,top:u.top??B.getHeight()/2,angle:u.angle??0,flipX:u.flipX??!1,flipY:u.flipY??!1,opacity:u.opacity??1,originX:"center",originY:"center"});const{isPatternRect:bl,patternMode:El,patternScale:kl,patternSource:Cl,patternTileWidth:Bl,patternTileHeight:_l,originalWidth:Al,originalHeight:Dl,originalScaleX:Fl,originalScaleY:Sl,...ml}=u.customData||{};rt.customData={...ml,savedSrc:A},B.remove(u),B.add(rt),Xe>=0&&(typeof rt.moveTo=="function"?rt.moveTo(Xe):typeof B.moveTo=="function"&&B.moveTo(rt,Xe)),B.setActiveObject(rt),kt(rt),ht(),B.requestRenderAll(),Ve(),et(rt),Q("object:modified")},{crossOrigin:"anonymous"});return}const M=await gs(u,A),oe=ys(M,U),se=((Pe=u.customData)==null?void 0:Pe.patternScale)??Math.round((u.scaleX??1)*100),me=Math.max(.01,fn(se)/100),ye=xs(oe),Ce=u.type==="image"?(u.width??0)*(u.scaleX??1):null,Ie=u.type==="image"?(u.height??0)*(u.scaleY??1):null,$e=u.type==="image"?u.scaleX??1:null,be=u.type==="image"?u.scaleY??1:null,Te=new nt.Pattern({source:oe,repeat:"repeat"});Te.patternTransform=[me,0,0,me,0,0],ye&&Da(Te,ye.width,ye.height,me);const Ae=new nt.Rect({left:0,top:0,width:B.getWidth(),height:B.getHeight(),fill:Te,objectCaching:!1});if(!Ae||typeof Ae._set!="function"){console.warn("[ui-editor] applyImagePattern failed: invalid rect instance.");return}Ae.patternElement=M,Ae.customData={...u.customData||{},isPatternRect:!0,patternMode:U,patternScale:Math.round(me*100),patternSource:A,patternTileWidth:ye==null?void 0:ye.width,patternTileHeight:ye==null?void 0:ye.height,originalWidth:Ce,originalHeight:Ie,originalScaleX:$e,originalScaleY:be};const Re=B.getObjects().indexOf(u);B.remove(u);try{B.add(Ae)}catch(Xe){console.warn("[ui-editor] applyImagePattern add failed.",Xe);return}Re>=0&&(typeof Ae.moveTo=="function"?Ae.moveTo(Re):typeof B.moveTo=="function"&&B.moveTo(Ae,Re)),typeof Ae.center=="function"?(Ae.center(),(Ye=Ae.setCoords)==null||Ye.call(Ae)):Ae.set({left:B.getWidth()/2,top:B.getHeight()/2,originX:"center",originY:"center"}),B.setActiveObject(Ae),kt(Ae),ht(),Ve(),et(Ae),ut()},Ls=a=>{var D,L,U;if(!B)return;const u=B.getActiveObject();if(!u)return;const A=fn(Number(a))/100;if(u.customData={...u.customData||{},patternScale:Math.round(A*100)},(D=u.customData)!=null&&D.isPatternRect){const M=u.fill;if(M){M.patternTransform=[A,0,0,A,0,0];const oe=(L=u.customData)==null?void 0:L.patternTileWidth,se=(U=u.customData)==null?void 0:U.patternTileHeight;oe&&se&&Da(M,oe,se,A)}u.dirty=!0,B.requestRenderAll()}et(u)},Ps=(a,u)=>{if(!B)return;const A=B.getActiveObject();if(!Aa(A))return;const L=new Set(["fontSize","charSpacing","lineHeight","strokeWidth"]).has(a)?Number(u):u;A[a]!==L&&(A.set(a,L),R&&cancelAnimationFrame(R),R=requestAnimationFrame(()=>{B.requestRenderAll()}),G&&window.clearTimeout(G),G=window.setTimeout(()=>{B.fire("object:modified",{target:A})},120),tt(A))},Ct=(a,u)=>{if(!B||!a)return!1;const A=t.toRaw(a)??a,D=String(u??"").trim();if(!D)return!1;const L=B.getObjects();if(!L.length)return!1;const U=L.map((me,ye)=>({item:me,index:ye})).filter(({item:me})=>ft(me)).map(({index:me})=>me);if(!U.length)return!1;const M=L.indexOf(A);if(M===-1)return!1;const oe=U.indexOf(M);if(oe===-1)return!1;let se=M;if(D==="up"&&oe<U.length-1)se=U[oe+1];else if(D==="down"&&oe>0)se=U[oe-1];else if(D==="top")se=U[U.length-1];else if(D==="bot")se=U[0];else return!1;return se===M?!1:(console.log("[layer-move] direction=",D,"currentIndex=",M,"targetIndex=",se,"movableIndices=",U),typeof B.moveTo=="function"?(B.moveTo(A,se),B.requestRenderAll(),console.log("[layer-move] moveTo via canvas success"),!0):typeof A.moveTo=="function"?(A.moveTo(se),B.requestRenderAll(),console.log("[layer-move] moveTo via object success"),!0):Array.isArray(B._objects)?(B._objects.splice(M,1),B._objects.splice(se,0,A),B.requestRenderAll(),console.log("[layer-move] moveTo via _objects success"),!0):!1)},Us=async a=>{var L;if(!B)return;const u=String(a??"").trim();let A=B.getActiveObject();if(!ft(A)){const U=y.value.find(M=>M.id===E.value);if(!(U!=null&&U.object)||!ft(U.object))return;A=U.object,B.setActiveObject(A)}console.log("[layer-move] moveLayer direction=",u,"activeId=",E.value,"objId=",(L=A==null?void 0:A.customData)==null?void 0:L.id);let D=Ct(A,u);if(!D)try{if(u==="up"&&typeof A.bringForward=="function"){const U=A.bringForward();U&&typeof U.then=="function"&&await U,D=!0}else if(u==="down"&&typeof A.sendBackwards=="function"){const U=A.sendBackwards();U&&typeof U.then=="function"&&await U,D=!0}else if(u==="top"&&typeof A.bringToFront=="function"){const U=A.bringToFront();U&&typeof U.then=="function"&&await U,D=!0}else if(u==="bot"&&typeof A.sendToBack=="function"){const U=A.sendToBack();U&&typeof U.then=="function"&&await U,D=!0}}catch(U){console.warn("[ui-editor] moveLayer failed:",U)}console.log("[layer-move] moveLayer moved=",D),D||Ct(A,a),ht(),B.requestRenderAll(),Ve(),Ke(A),B.fire("object:modified",{target:A})},Ms=a=>{if(!B)return;const u=B.getActiveObject();ft(u)&&(a==="X"&&u.set("flipX",!u.flipX),a==="Y"&&u.set("flipY",!u.flipY),B.requestRenderAll(),Ve(),Ke(u),B.fire("object:modified",{target:u}))},Ws=(a="cw")=>{var D;if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=a==="ccw"?-90:90;u.rotate((u.angle??0)+A),(D=u.setCoords)==null||D.call(u),B.requestRenderAll(),Ve(),Ke(u),B.fire("object:modified",{target:u})},Vs=()=>{var u;if(!B)return;const a=B.getActiveObject();ft(a)&&(typeof a.center=="function"&&a.center(),(u=a.setCoords)==null||u.call(a),B.requestRenderAll(),Ve(),Ke(a),B.fire("object:modified",{target:a}))},$s=a=>{if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=Math.min(1,Math.max(0,Number(a)));u.set("opacity",A),B.requestRenderAll(),Ve(),Ke(u),B.fire("object:modified",{target:u})},Hs=a=>{var U;if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=a==="up"?1.1:.9,D=Math.max(.05,(u.scaleX??1)*A),L=Math.max(.05,(u.scaleY??1)*A);u.set({scaleX:D,scaleY:L}),(U=u.setCoords)==null||U.call(u),B.requestRenderAll(),Ve(),Ke(u),B.fire("object:modified",{target:u})},qs=a=>{var oe;if(!B)return;const u=B.getActiveObject();if(!ft(u))return;const A=u.getBoundingRect(!0,!0),D=B.getWidth(),L=B.getHeight();let U=0,M=0;a==="left"&&(U=-A.left),a==="right"&&(U=D-(A.left+A.width)),a==="hcenter"&&(U=D/2-(A.left+A.width/2)),a==="top"&&(M=-A.top),a==="bottom"&&(M=L-(A.top+A.height)),a==="vcenter"&&(M=L/2-(A.top+A.height/2)),u.set({left:(u.left??0)+U,top:(u.top??0)+M}),(oe=u.setCoords)==null||oe.call(u),B.requestRenderAll(),Ve(),Ke(u),B.fire("object:modified",{target:u})},Xs=async()=>{var D;if(!B)return;const a=B.getActiveObject();if(!ft(a))return;const u=await Oa(a);if(!u)return;const A=(D=a.customData)!=null&&D.label?`${a.customData.label}-复制`:`图层-${ve}`;u.customData={...u.customData||{},id:ve++,label:A},u.set({left:(a.left??0)+20,top:(a.top??0)+20}),kt(u),B.setActiveObject(u),ht(),B.requestRenderAll(),Ve(),et(u),Ke(u),tt(u),B.fire("object:modified",{target:u})},Zs=a=>{if(!B||!(a!=null&&a.object))return;const u=!a.visible;a.object.set("visible",u),B.requestRenderAll(),Ve(),B.fire("object:modified",{target:a.object})},Gs=a=>{if(!B||!(a!=null&&a.object))return;const u=a.locked;a.object.set({lockMovementX:!u,lockMovementY:!u,lockScalingX:!u,lockScalingY:!u,lockRotation:!u}),B.requestRenderAll(),Ve(),B.fire("object:modified",{target:a.object})},Ys=a=>{if(!B)return;const u=a==null?void 0:a.id;let D=(a!=null&&a.object?t.toRaw(a.object):null)??B.getObjects().find(oe=>{var se;return((se=oe==null?void 0:oe.customData)==null?void 0:se.id)===u});if(!D&&(a!=null&&a.name)&&(D=B.getObjects().find(oe=>{var se;return((se=oe==null?void 0:oe.customData)==null?void 0:se.label)===a.name})),!D)return;const U=B.getActiveObject()===D;B.remove(D),U&&(B.discardActiveObject(),E.value=null),B.requestRenderAll(),Ve();const M=e.value==="layer";et(void 0,!M),Ke(),tt(void 0,!M),Q("object:removed")},Ta=async(a,u)=>{var oe;if(!B)return;const A=y.value.find(se=>se.id===a);if(!(A!=null&&A.object))return;const D=A.object,L=String(u??"").trim();B.setActiveObject(D),E.value=a,console.log("[layer-move] moveLayerById direction=",L,"layerId=",a,"objId=",(oe=D==null?void 0:D.customData)==null?void 0:oe.id);let U=Ct(D,L);if(!U)try{if(L==="up"&&typeof D.bringForward=="function"){const se=D.bringForward();se&&typeof se.then=="function"&&await se,U=!0}else if(L==="down"&&typeof D.sendBackwards=="function"){const se=D.sendBackwards();se&&typeof se.then=="function"&&await se,U=!0}else if(L==="top"&&typeof D.bringToFront=="function"){const se=D.bringToFront();se&&typeof se.then=="function"&&await se,U=!0}else if(L==="bot"&&typeof D.sendToBack=="function"){const se=D.sendToBack();se&&typeof se.then=="function"&&await se,U=!0}}catch(se){console.warn("[ui-editor] moveLayerById failed:",se)}console.log("[layer-move] moveLayerById moved=",U),ht(),B.requestRenderAll(),Ve();const M=e.value==="layer";et(D,!M),Ke(D),tt(D),B.fire("object:modified",{target:D}),Q("layer:moved")},Ks=async a=>{var M;if(!B)return;const u=y.value.find(oe=>oe.id===a);if(!(u!=null&&u.object))return;const A=u.object;B.setActiveObject(A),E.value=a;const D=await Oa(A);if(!D)return;const L=(M=A.customData)!=null&&M.label?`${A.customData.label}-复制`:`图层-${ve}`;D.customData={...D.customData||{},id:ve++,label:L},D.set({left:(A.left??0)+20,top:(A.top??0)+20}),kt(D),ht(),B.setActiveObject(D),B.requestRenderAll(),Ve();const U=e.value==="layer";et(D,!U),Ke(D),tt(D),B.fire("object:modified",{target:D})},Oa=async a=>{if(!a||typeof a.clone!="function")return null;const u=[],A=L=>{if(!L||typeof L!="object")return;const U=L.patternTransform;let M=U;if(U&&!Array.isArray(U)){if(typeof U=="object"&&"a"in U){const oe=U;M=[oe.a,oe.b,oe.c,oe.d,oe.e,oe.f]}else M=null;L.patternTransform=M,u.push(()=>{L.patternTransform=U})}},D=L=>{if(!L||!("styles"in L))return;const U=L.styles;if(!U||typeof U!="object"||Array.isArray(U))return;const M=Object.keys(U);if(M.length!==0)for(const oe of M){const se=U[oe];if(!se||typeof se!="object"){L.styles={},u.push(()=>{L.styles=U});return}}};a.fill instanceof nt.Pattern&&A(a.fill),a.stroke instanceof nt.Pattern&&A(a.stroke),(a.type==="textbox"||a.type==="i-text"||a.type==="text")&&D(a);try{return await a.clone()}catch(L){return console.warn("[ui-editor] clone object failed:",a==null?void 0:a.type,L),null}finally{u.forEach(L=>L())}},js=()=>{if(!B||!h.value)return;const a=Math.max(h.value.clientWidth,1),u=Math.max(h.value.clientHeight,1),A=Math.max(1,Math.floor(Math.min(a,u))),D=B.wrapperEl,L=`${A}px`,U=!D||D.style.width!==L||D.style.height!==L;if(D&&(D.style.width=L,D.style.height=L),U&&typeof B.setDimensions=="function")B.setDimensions({width:A,height:A},{cssOnly:!0});else{const M=B.getElement();M&&(M.style.width=L,M.style.height=L)}},Js=()=>{var D,L,U,M;if(!B||!h.value)return;const a=Math.max(h.value.clientWidth,1),u=Math.max(h.value.clientHeight,1),A=Math.max(1,Math.floor(Math.min(a,u)));((D=B.getWidth)==null?void 0:D.call(B))===A&&((L=B.getHeight)==null?void 0:L.call(B))===A||(typeof B.setDimensions=="function"?B.setDimensions({width:A,height:A}):((U=B.setWidth)==null||U.call(B,A),(M=B.setHeight)==null||M.call(B,A)),B.requestRenderAll())},Qs=a=>{if(!B)return;const u=Math.min(200,Math.max(30,a));c.value=u;const A=u/100,D=h.value,L=(D==null?void 0:D.clientWidth)||B.getWidth(),U=(D==null?void 0:D.clientHeight)||B.getHeight(),M=(L-B.getWidth()*A)/2,oe=(U-B.getHeight()*A)/2;B.setViewportTransform([A,0,0,A,M,oe]),B.requestRenderAll()},Vt=a=>Qs(a),el=()=>Vt(c.value+10),tl=()=>Vt(c.value-10),rl=()=>{if(!B||!Z.value)return;const a=zt(Z.value);a!=null&&a.length&&Rt(a)},xn=()=>{if(!B||!h.value)return;Js(),js();const a=Math.max(h.value.clientWidth,100),u=Math.max(h.value.clientHeight,100);te.width=a,te.height=u;const A=Math.min(a/B.getWidth(),u/B.getHeight()),D=Math.round(A*100);Vt(Math.min(160,Math.max(30,D))),ol(),rl()},nl=async()=>{if(!B)return;B.discardActiveObject(),B.requestRenderAll();const a=B.getElement();if(a)try{const u=await yt(a,"image/png"),A=URL.createObjectURL(u),D=document.createElement("a");D.href=A,D.download="design.png",D.click(),URL.revokeObjectURL(A)}catch(u){console.warn("[ui-editor] 导出 PNG 失败:",u)}},al=async()=>{var A;if(!B||ue)return null;ue=!0;let a=null,u=null;try{const D=B.getObjects().find(be=>{var Te,Ae;return((Te=be==null?void 0:be.customData)==null?void 0:Te.role)===it&&((Ae=be==null?void 0:be.customData)==null?void 0:Ae.label)==="遮罩层"});if(!D)return ue=!1,null;const L=document.createElement("canvas");L.width=B.getWidth(),L.height=B.getHeight(),L.style.display="none",document.body.appendChild(L),u=new nt.Canvas(L,{width:B.getWidth(),height:B.getHeight()});const U=B.getObjects().filter(be=>{var Te,Ae,Re;return((Te=be==null?void 0:be.customData)==null?void 0:Te.role)!==it&&((Ae=be==null?void 0:be.customData)==null?void 0:Ae.role)!=="guide"&&((Re=be==null?void 0:be.customData)==null?void 0:Re.role)!=="grid"});(await Promise.all(U.map(be=>be.clone()))).forEach(be=>{u.add(be)}),u.renderAll();const oe=typeof D.getScaledWidth=="function"?D.getScaledWidth():(D.width??0)*(D.scaleX??1),se=typeof D.getScaledHeight=="function"?D.getScaledHeight():(D.height??0)*(D.scaleY??1);if(!oe||!se)return null;const me=D.left??0,ye=D.top??0;let Ce=null;try{const be=u.getElement();Ce=await yt(be)}catch(be){return console.warn("[ui-editor] Canvas 被跨域图片污染,无法导出截图。请确保图片资源服务器配置了 CORS。",be),null}const Ie=typeof D.getElement=="function"?D.getElement():D._element;let $e=null;if(Ie){const be=document.createElement("canvas"),Te=Ie.width||Ie.naturalWidth||oe,Ae=Ie.height||Ie.naturalHeight||se;be.width=Te,be.height=Ae;const Re=be.getContext("2d");if(Re){Re.drawImage(Ie,0,0,Te,Ae);let Oe=null;try{Oe=await yt(be)}catch(De){return console.warn("[ui-editor] 遮罩图片被跨域污染,无法导出。请确保图片资源服务器配置了 CORS。",De),null}try{Ce&&Oe&&($e=await Es({baseBlob:Ce,maskBlob:Oe,maskWidth:oe,maskHeight:se,left:me,top:ye,canvasWidth:u.getWidth(),canvasHeight:u.getHeight()}))}catch(De){console.warn("[ui-editor] mask worker failed, fallback to main thread.",De)}}}if($e)a=$e;else{if(!Ce)return null;const be=await createImageBitmap(Ce),Te=be.width/u.getWidth(),Ae=be.height/u.getHeight(),Re=document.createElement("canvas");Re.width=Math.round(oe),Re.height=Math.round(se);const Oe=Re.getContext("2d");if(!Oe)return null;if(Oe.drawImage(be,me*Te,ye*Ae,oe*Te,se*Ae,0,0,oe,se),Ie){const De=document.createElement("canvas");De.width=Re.width,De.height=Re.height;const Pe=De.getContext("2d");Pe&&(Pe.drawImage(Ie,0,0,Ie.width,Ie.height,0,0,oe,se),Oe.globalCompositeOperation="destination-in",Oe.drawImage(De,0,0),Oe.globalCompositeOperation="source-over")}try{a=await yt(Re)}catch(De){console.warn("[ui-editor] 输出遮罩导出失败。",De),a=null}}}finally{if(u){const D=u.getElement();u.dispose(),(A=D==null?void 0:D.parentNode)==null||A.removeChild(D)}ue=!1}return a},La=a=>{var se,me;if(!B||!a)return;const u=B.getWidth(),A=B.getHeight(),D=a.width||((se=a._element)==null?void 0:se.width)||1,L=a.height||((me=a._element)==null?void 0:me.height)||1,U=Math.min(u/D,A/L),M=(u-D*U)/2,oe=(A-L*U)/2;a.scale(U),a.set({left:M,top:oe,originX:"left",originY:"top"})},ol=()=>{B!=null&&B.backgroundImage&&(La(B.backgroundImage),B.requestRenderAll())},il=async a=>{if(!B||!a)return;await It(a,A=>{A&&(A.set({originX:"left",originY:"top",selectable:!1,evented:!1}),La(A),B.set("backgroundImage",A),B.requestRenderAll())},{crossOrigin:"anonymous"})},Pa=()=>{B&&(B.getObjects().filter(a=>{var u;return((u=a.customData)==null?void 0:u.role)===it}).forEach(a=>B.remove(a)),B.clipPath&&(B.clipPath=null,B.requestRenderAll()),Ee&&(B.remove(Ee),Ee=null))},sl=(a,u)=>{var Ce,Ie;const A=B.getWidth(),D=B.getHeight(),L=a.width||((Ce=a._element)==null?void 0:Ce.width)||1,U=a.height||((Ie=a._element)==null?void 0:Ie.height)||1,M=Math.min(A/L,D/U),oe=L*M,se=U*M,me=(A-oe)/2,ye=(D-se)/2;a.set({originX:"left",originY:"top",left:me,top:ye,scaleX:M,scaleY:M})},Rt=(a=[])=>{B&&(Pa(),a.filter(dn).forEach(u=>{const A=D=>{if(D&&(D.set({left:0,top:0,originX:"left",originY:"top",selectable:!1,evented:!1,hasBorders:!1,hasControls:!1,lockMovementX:!0,lockMovementY:!0,lockScalingX:!0,lockScalingY:!0,lockRotation:!0,opacity:u.type==="MASK"?0:.9,excludeFromExport:!0}),D.customData={role:it,label:u.type==="MASK"?"遮罩层":"虚线层"},sl(D),B.add(D),hn(D),u.type==="MASK")){new nt.Image(D.getElement(),{left:D.left,top:D.top,originX:"left",originY:"top",scaleX:D.scaleX,scaleY:D.scaleY,absolutePositioned:!0}),Ee&&(B.remove(Ee),Ee=null);const L=typeof D.getElement=="function"?D.getElement():D._element;if(L){const U=document.createElement("canvas");U.width=B.getWidth(),U.height=B.getHeight();const M=U.getContext("2d");if(M){M.fillStyle="rgba(0, 0, 0, 0.3)",M.fillRect(0,0,U.width,U.height),M.globalCompositeOperation="destination-out";const oe=typeof D.getScaledWidth=="function"?D.getScaledWidth():(L.width||L.naturalWidth||0)*(D.scaleX??1),se=typeof D.getScaledHeight=="function"?D.getScaledHeight():(L.height||L.naturalHeight||0)*(D.scaleY??1);M.drawImage(L,0,0,L.width,L.height,D.left??0,D.top??0,oe,se),M.globalCompositeOperation="source-over",Ee=new nt.Image(U,{left:0,top:0,originX:"left",originY:"top",selectable:!1,evented:!1,excludeFromExport:!0}),Ee.customData={role:"guide",label:"遮罩外层"},B.add(Ee),hn(Ee)}}B.requestRenderAll()}};It(u.url,A,{crossOrigin:"anonymous"})}))},ht=()=>{B&&(B.getObjects().filter(a=>{var u,A;return((u=a.customData)==null?void 0:u.role)===it||((A=a.customData)==null?void 0:A.role)==="guide"}).forEach(a=>hn(a)),B.requestRenderAll())},$t=a=>{if(!a)return;const u=a.thumb||pe(a.resources);u&&il(u)},ll=()=>{const a=Ft.value;if(!a.length)return null;const u=a.filter(D=>!q.value||D.size===q.value),A=u.length?u:a;return A.find(D=>D.type===V.value)??A[0]},Ht=()=>{B&&(B.clear(),B.set("backgroundImage",null),B.requestRenderAll(),Pa())},mn=(a,u)=>{!B||!a||B.loadFromJSON(a,()=>{B.requestRenderAll(),Ve(),u==null||u()},(A,D)=>{(D==null?void 0:D.type)==="image"&&D.set({crossOrigin:"anonymous"})})},Ua=async()=>{var U;if(!B)return null;const a=B.toJSON(["customData"]),u=B.getObjects(),A=a.objects??[],D=new Map,L=[];if(u.forEach(M=>{var se,me,ye;if((M==null?void 0:M.type)!=="image"||!((se=M.customData)!=null&&se.id))return;(((me=M.customData)==null?void 0:me.savedSrc)||((ye=M.getSrc)==null?void 0:ye.call(M)))&&typeof M.toDataURL=="function"&&L.push(Promise.resolve().then(()=>{var Ce;try{(Ce=M.customData)!=null&&Ce.savedSrc?D.set(M.customData.id,M.customData.savedSrc):D.set(M.customData.id,M.toDataURL({format:"png"}))}catch{}}))}),(U=B.backgroundImage)!=null&&U.src){const M=B.backgroundImage;typeof M.toDataURL=="function"&&L.push(Promise.resolve().then(()=>{try{const oe=M.toDataURL({format:"png"});a.backgroundImage.src=oe,a.backgroundImage.savedSrc=oe}catch{}}))}L.length&&await Promise.all(L);try{A.forEach((M,oe)=>{var me;const se=u[oe];if(se&&(se.customData&&!M.customData&&(M.customData=JSON.parse(JSON.stringify(se.customData))),(me=M.customData)!=null&&me.isPatternRect)){const ye=M.customData.patternSource,Ce=M.customData.savedSrc;(typeof ye!="string"||!ye.length)&&typeof Ce=="string"&&Ce.startsWith("data:")&&(M.customData.patternSource=Ce)}})}catch(M){console.warn("[exportCanvasState] 回填 customData 失败:",M)}return A.forEach(M=>{var se;if((M==null?void 0:M.type)!=="image")return;const oe=(se=M.customData)==null?void 0:se.id;if(oe&&D.has(oe)){const me=D.get(oe);M.customData={...M.customData||{},savedSrc:me},M.src=me}}),a},vn=async a=>{if(!B||!a)return;const u=await Ua();u&&Y(a,u)},cl=a=>{var A,D;if(!a||typeof a!="object")return console.warn("[filterUserContent] fabricJson 无效:",a),a;const u=JSON.parse(JSON.stringify(a));if(console.log("[filterUserContent] 原始 objects 数量:",((A=u.objects)==null?void 0:A.length)||0),console.log("[filterUserContent] 原始 objects 类型:",(D=u.objects)==null?void 0:D.map(L=>L==null?void 0:L.type)),u.objects&&Array.isArray(u.objects)){const L=u.objects.length;u.objects=u.objects.map(M=>{var Ce,Ie,$e,be,Te,Ae,Re,Oe,De,Pe;if(((Ce=M==null?void 0:M.customData)==null?void 0:Ce.role)===it||((Ie=M==null?void 0:M.customData)==null?void 0:Ie.role)==="guide"||(($e=M==null?void 0:M.customData)==null?void 0:$e.role)==="grid"||(be=M==null?void 0:M.customData)!=null&&be.isMask||((Te=M==null?void 0:M.customData)==null?void 0:Te.role)==="mask")return null;const oe=((Ae=M==null?void 0:M.type)==null?void 0:Ae.toLowerCase())||"",se=oe==="image",me=oe==="textbox"||oe==="i-text"||oe==="text",ye=!!((Re=M==null?void 0:M.customData)!=null&&Re.isPatternRect);if(!se&&!me&&!ye)return console.log("[filterUserContent] 过滤掉非图片/文字/平铺对象:",M==null?void 0:M.type,M==null?void 0:M.customData),null;if(se||ye){if(M.customData||(M.customData={}),ye){const Ye=(Oe=M.customData)==null?void 0:Oe.patternSource,Xe=(De=M.customData)==null?void 0:De.savedSrc;typeof Ye=="string"?Ye.startsWith("blob:")&&typeof Xe=="string"&&Xe.startsWith("data:")?M.customData.patternSource=Xe:Ye.startsWith("data:")&&!M.customData.savedSrc&&(M.customData.savedSrc=Ye):!Ye&&typeof Xe=="string"&&Xe.startsWith("data:")&&(M.customData.patternSource=Xe)}se&&M.customData.savedSrc&&M.customData.savedSrc.startsWith("data:")?M.src=M.customData.savedSrc:se&&M.src&&M.src.startsWith("blob:")&&(M.customData.savedSrc&&M.customData.savedSrc.startsWith("data:")?M.src=M.customData.savedSrc:console.warn("[filterUserContent] 图片对象缺少 base64 数据:",(Pe=M.customData)==null?void 0:Pe.id)),se&&M.src&&M.src.startsWith("data:")&&!M.customData.savedSrc&&(M.customData.savedSrc=M.src)}return M}).filter(M=>M!==null);const U=u.objects.length;console.log("[filterUserContent] 过滤后 objects 数量:",U,"(原始:",L,")"),console.log("[filterUserContent] 过滤后 objects 类型:",u.objects.map(M=>M==null?void 0:M.type))}return u.backgroundImage&&delete u.backgroundImage,u},dl=async()=>{var D,L,U,M,oe,se;const a={};Z.value&&await vn(Z.value);const u=Nt(),A=new Map;u.forEach(me=>{A.set(String(me.id),me)});for(const me of ct.value){const ye=me.id,Ce=K(ye);if(console.log(`[getAllDiecutFabricData] 刀板 ${me.name} (${ye}):`,{hasState:!!Ce,objectsCount:((D=Ce==null?void 0:Ce.objects)==null?void 0:D.length)||0}),Ce){const Ie=cl(Ce);console.log(`[getAllDiecutFabricData] 过滤后刀板 ${me.name}:`,{objectsCount:((L=Ie==null?void 0:Ie.objects)==null?void 0:L.length)||0});const $e=A.get(String(ye));let be=null,Te=null;if((U=$e==null?void 0:$e.mask)!=null&&U.url){if(be=await Ra($e.mask.url),be){const De=(M=Ce.objects)==null?void 0:M.find(Pe=>{var Ye,Xe;return((Ye=Pe==null?void 0:Pe.customData)==null?void 0:Ye.role)===it&&((Xe=Pe==null?void 0:Pe.customData)==null?void 0:Xe.label)==="遮罩层"});De?Te={width:De.width||$e.mask.width,height:De.height||$e.mask.height,left:De.left??0,top:De.top??0,scaleX:De.scaleX??1,scaleY:De.scaleY??1,originX:De.originX||"left",originY:De.originY||"top"}:Te={width:$e.mask.width,height:$e.mask.height}}console.log(`[getAllDiecutFabricData] 刀板 ${me.name} 蒙版:`,{hasMaskUrl:!!$e.mask.url,hasMaskData:!!be,maskInfo:Te})}const Ae=Je.value.get(String(ye));let Re=null,Oe=null;if((oe=Ae==null?void 0:Ae.dotted)!=null&&oe.url){if(Re=await Ra(Ae.dotted.url),Re){const De=(se=Ce.objects)==null?void 0:se.find(Pe=>{var Ye,Xe;return((Ye=Pe==null?void 0:Pe.customData)==null?void 0:Ye.role)===it&&((Xe=Pe==null?void 0:Pe.customData)==null?void 0:Xe.label)==="虚线层"});De?Oe={width:De.width||Ae.dotted.width,height:De.height||Ae.dotted.height,left:De.left??0,top:De.top??0,scaleX:De.scaleX??1,scaleY:De.scaleY??1,originX:De.originX||"left",originY:De.originY||"top"}:Oe={width:Ae.dotted.width,height:Ae.dotted.height}}console.log(`[getAllDiecutFabricData] 刀板 ${me.name} 虚线层:`,{hasDottedLineUrl:!!Ae.dotted.url,hasDottedLineData:!!Re,dottedLineInfo:Oe})}a[ye]={id:ye,name:me.name,fabricData:Ie,maskData:be,maskInfo:Te,dottedLineData:Re,dottedLineInfo:Oe}}}return console.log("[getAllDiecutFabricData] 最终合并数据:",{diecutCount:Object.keys(a).length,totalObjects:Object.values(a).reduce((me,ye)=>{var Ce,Ie;return me+(((Ie=(Ce=ye.fabricData)==null?void 0:Ce.objects)==null?void 0:Ie.length)||0)},0),maskDataCount:Object.values(a).filter(me=>me.maskData).length,dottedLineDataCount:Object.values(a).filter(me=>me.dottedLineData).length}),{version:"1.0",diecuts:a}},fl=async(a,u,A)=>{var L;let D=null;try{const U=document.createElement("canvas");U.width=u,U.height=A,U.style.display="none",document.body.appendChild(U),D=new nt.Canvas(U,{width:u,height:A}),await new Promise(se=>{D.loadFromJSON(a,()=>{D.requestRenderAll(),setTimeout(()=>{se()},200)},(me,ye)=>{(ye==null?void 0:ye.type)==="image"&&ye.set({crossOrigin:"anonymous"})})});const M=D.getElement();return M?await yt(M,"image/png"):null}catch(U){return console.error("[ui-editor] 从 JSON 生成截图失败:",U),null}finally{if(D){const U=D.getElement();D.dispose(),(L=U==null?void 0:U.parentNode)==null||L.removeChild(U)}}},ul=async(a,u,A,D)=>{var Oe;if(!u.url)return null;const L=(Oe=a.objects)==null?void 0:Oe.find(De=>{var Pe;return((Pe=De==null?void 0:De.customData)==null?void 0:Pe.label)==="遮罩层"});let U,M,oe,se;if(L)U=(L.width??0)*(L.scaleX??1),M=(L.height??0)*(L.scaleY??1),oe=L.left??0,se=L.top??0;else{const De=await un(u.url),Pe=u.width||De.width,Ye=u.height||De.height,Xe=Math.min(A/Pe,D/Ye);U=Pe*Xe,M=Ye*Xe,oe=(A-U)/2,se=(D-M)/2}if(!U||!M)return null;const me=await fl(a,A,D);if(!me)return null;const ye=await un(u.url),Ce=document.createElement("canvas");Ce.width=Math.round(U),Ce.height=Math.round(M);const Ie=Ce.getContext("2d");if(!Ie)return null;const $e=await createImageBitmap(me),be=$e.width/A,Te=$e.height/D;Ie.drawImage($e,oe*be,se*Te,U*be,M*Te,0,0,U,M);const Ae=document.createElement("canvas");Ae.width=Ce.width,Ae.height=Ce.height;const Re=Ae.getContext("2d");return Re&&(Re.drawImage(ye,0,0,ye.width,ye.height,0,0,U,M),Ie.globalCompositeOperation="destination-in",Ie.drawImage(Ae,0,0),Ie.globalCompositeOperation="source-over"),await yt(Ce,"image/png")},hl=async a=>{if(!B||!(a!=null&&a.length))return;Z.value&&await vn(Z.value);const u=await Ua();if(!u)return;const A=(u.objects??[]).filter(hs);if(!A.length)return;const D={},L=[];if(a.forEach(U=>{if(!U||U===Z.value)return;const M=K(U),oe=or(M)||{...u,objects:[]};D[U]=oe,L.push(U)}),L.length!==0){try{const U=JSON.parse(JSON.stringify(A)),M=JSON.parse(JSON.stringify(D)),oe=await Cs({sourceObjects:U,targetJsonMap:M,objectIndex:ve});if(oe)ve=oe.nextObjectIndex,Object.entries(oe.updates).forEach(([se,me])=>{Y(se,me)});else throw new Error("Worker returned null")}catch(U){console.warn("[ui-editor] copy to diecuts worker failed, fallback to main thread:",U),L.forEach(M=>{const oe=K(M),se=or(oe)||{...u,objects:[]},me=Array.isArray(se.objects)?se.objects:[],ye=A.map(ps);se.objects=[...me,...ye],Y(M,se)})}if(L.length>0)try{const U=ke.value[T.value];if(!(U!=null&&U.jsonURL))return;const oe=await(await dt(gt(U.jsonURL))).json(),se=Mt(oe.layerList||[]),me=Nt(),ye=B.getWidth(),Ce=B.getHeight(),$e=(await Promise.all(L.map(async be=>{var Re;const Te=me.find(Oe=>Oe.id===be);if(!((Re=Te==null?void 0:Te.mask)!=null&&Re.url))return console.warn(`[ui-editor] 找不到目标刀板 ${be} 对应的 group 或 mask`),null;const Ae=K(be);if(!Ae)return console.warn(`[ui-editor] 找不到目标刀板 ${be} 的状态`),null;try{const Oe=or(Ae),De=JSON.parse(JSON.stringify(Oe)),Pe=await ul(De,Te.mask,ye,Ce);if(!Pe)throw new Error("无法生成遮罩截图");const Ye=xt.get(be);Ye&&URL.revokeObjectURL(Ye),Qt.set(be,Pe);const Xe=URL.createObjectURL(Pe);xt.set(be,Xe);const rt=se.get(Te.name);return rt?{id:rt,url:Xe,targetId:be}:(console.warn(`[ui-editor] 找不到刀板 ${be} 对应的 PSD Group ID`),null)}catch(Oe){return console.error(`[ui-editor] 为目标刀板 ${be} 生成截图失败:`,Oe),null}}))).filter(be=>be!==null);if($e.length===0){console.warn("[ui-editor] 没有成功生成任何截图");return}if(He.value){const be=He.value.fabricScreenshotList||[],Te=new Map;be.forEach(Re=>{Te.set(Re.id,Re)}),$e.forEach(Re=>{const Oe=Te.get(Re.id);if(Oe&&Oe.url!==Re.url)try{URL.revokeObjectURL(Oe.url)}catch{}Te.set(Re.id,{id:Re.id,url:Re.url})});const Ae=Array.from(Te.values());He.value={...He.value,fabricScreenshotList:Ae}}else{const be=new URL(".",new URL(U.jsonURL,window.location.href)).toString(),Te=nr(U.resources||[]),Re=Nt().map(Oe=>{const De=se.get(Oe.name);if(!De)return null;const Pe=xt.get(Oe.id);return Pe?{id:De,url:Pe}:null}).filter(Boolean);He.value={psdJson:oe,materialList:Te,fabricScreenshotList:Re,width:300,height:300,baseUrl:be}}}catch(U){console.error("[ui-editor] 为目标刀板生成截图失败:",U)}}},pl=a=>{var M;const[u,A]=a.split(","),D=((M=u.match(/data:(.*);base64/))==null?void 0:M[1])||"image/png",L=atob(A),U=new Uint8Array(L.length);for(let oe=0;oe<L.length;oe+=1)U[oe]=L.charCodeAt(oe);return new Blob([U],{type:D})},gn=new Set,ar=a=>{try{const u=pl(a),A=URL.createObjectURL(u);return gn.add(A),A}catch{return a}},Ma=()=>{gn.forEach(a=>URL.revokeObjectURL(a)),gn.clear()},or=a=>{var A;if(!a)return a;(A=a.backgroundImage)!=null&&A.src&&(a.backgroundImage.src.startsWith("data:")?(a.backgroundImage.savedSrc=a.backgroundImage.src,a.backgroundImage.src=ar(a.backgroundImage.src)):a.backgroundImage.src.startsWith("blob:")&&(a.backgroundImage.savedSrc?a.backgroundImage.src=ar(a.backgroundImage.savedSrc):a.backgroundImage=null));const u=D=>{var L;if(!D||typeof D!="object")return D;if(Array.isArray(D))return D.map(u).filter(U=>U!==null);if(D.type==="image"){if((L=D.customData)!=null&&L.savedSrc)D.src=ar(D.customData.savedSrc);else if(typeof D.src=="string"&&D.src.startsWith("data:"))D.customData={...D.customData||{},savedSrc:D.src},D.src=ar(D.src);else if(typeof D.src=="string"&&D.src.startsWith("blob:"))return null}return Object.keys(D).forEach(U=>{const M=D[U];if(typeof M=="string"&&M.startsWith("blob:")){D[U]=null;return}D[U]=u(M)}),D};return Array.isArray(a.objects)&&(a.objects=u(a.objects)),a},Wa=a=>{if(!B||!a)return!1;Ma();const u=or(K(a));return u?(Ht(),mn(u,()=>{Vt(c.value)}),!0):!1},zt=a=>{if(!a)return[];const u=Je.value.get(a)||Array.from(Je.value.values()).find(D=>D.name===a),A=[];return u!=null&&u.mask&&A.push(u.mask),u!=null&&u.dotted&&A.push(u.dotted),A},Va=async(a,u=[])=>{if(!(!B||!a)){w.value=!0,j.value="";try{if(J.has(a)){Ht(),mn(J.get(a));const U=zt(Z.value);Rt(U.length?U:u);return}const A=await dt(gt(a),{mode:"cors"});if(!A.ok)throw new Error("模板加载失败");const D=await A.json();J.set(a,D),Ht(),mn(D);const L=zt(Z.value);Rt(L.length?L:u)}catch{j.value="模板加载失败,已回退到预览图",$t({resources:u});const D=zt(Z.value);Rt(D.length?D:u)}finally{w.value=!1}}},xl=()=>{F.value=!F.value};return t.watch(Ge,a=>{!q.value&&(a!=null&&a.length)&&(q.value=a[0])},{immediate:!0}),t.watch(ke,a=>{a!=null&&a.length&&((W.value>=a.length||W.value<0)&&(W.value=0),(T.value>=a.length||T.value<0)&&(T.value=0),B&&$t(a[W.value]),Dt())},{immediate:!0}),t.watch(Ft,a=>{if(a!=null&&a.length){if(!V.value){const u=a.find(A=>A.type==="SPLIT");V.value=(u==null?void 0:u.type)??a[0].type;return}a.some(u=>u.type===V.value)||(V.value=a[0].type)}},{immediate:!0}),t.watch(ct,a=>{!Z.value&&(a!=null&&a.length)&&(Z.value=a[0].id)},{immediate:!0}),t.watch(Z,async(a,u)=>{if(!B||!a)return;if(u&&await vn(u),!Wa(a)){Ht();const D=ke.value[W.value];D&&$t(D),Vt(c.value)}Rt(zt(a))},{immediate:!0}),t.watch(W,a=>{if(!B)return;const u=ke.value[a];u&&(u.jsonURL?Va(u.jsonURL,u.resources):$t(u))}),t.watch(T,()=>{Dt()}),t.watch(V,()=>{if(!B)return;const a=ll();a&&Va(a.jsonURL,a.resources)}),t.onMounted(async()=>{if(r.value&&await Ut(f.value),!s.value)return;const a=re();B=new nt.Canvas(s.value,{width:a,height:a,backgroundColor:"#f8fafc",preserveObjectStacking:!0}),B.on("selection:created",ut),B.on("selection:updated",ut),B.on("selection:cleared",ut),B.on("object:added",L=>{var M,oe;const U=L==null?void 0:L.target;((M=U==null?void 0:U.customData)==null?void 0:M.role)!==it&&((oe=U==null?void 0:U.customData)==null?void 0:oe.role)!=="guide"&&!(U!=null&&U.excludeFromExport)&&(kt(U),ht()),Ve(),u("object:added")}),B.on("object:removed",()=>{Ve(),ut()}),B.on("object:moving",()=>{We=!0,g=!0}),B.on("mouse:up",()=>{We&&(We=!1,g&&(g=!1,ae=!0,Q("drag-end")))}),B.on("object:modified",()=>u("object:modified"));function u(L){if(ae){ae=!1;return}if(We){g=!0;return}Q(L)}const A=Z.value;!(A?Wa(A):!1)&&ke.value.length&&$t(ke.value[W.value]),A&&Rt(zt(A)),xn(),window.addEventListener("resize",le),await t.nextTick(),Dt()}),t.onBeforeUnmount(()=>{P&&(cancelAnimationFrame(P),P=0),window.removeEventListener("resize",le),B&&(B.dispose(),B=null),_e&&(_e.terminate(),_e=null,ie.clear()),Se&&(Se.terminate(),Se=null,O.clear()),xt.forEach(a=>URL.revokeObjectURL(a)),xt.clear(),Qt.clear(),Ma(),er.forEach(a=>URL.revokeObjectURL(a)),er.clear()}),(a,u)=>{var A,D;return t.openBlock(),t.createElementBlock("div",cs,[ee.value?(t.openBlock(),t.createBlock(oo,{key:0,"product-name":((A=Ue.value)==null?void 0:A.name)||((D=v.value)==null?void 0:D.name)||"定制产品","show-grid":o.value,onAddText:Sa,onAddLabel:Na,onToggleGrid:Bs,onClearCanvas:Rs,onDownloadPng:nl,onUpload:za},null,8,["product-name","show-grid"])):t.createCommentVNode("",!0),t.createElementVNode("div",ds,[ce.value?(t.openBlock(),t.createBlock(Dn,{key:0,class:"sidebar-left",activeTab:e.value,"onUpdate:activeTab":u[0]||(u[0]=L=>e.value=L),urlInput:n.value,"onUpdate:urlInput":u[1]||(u[1]=L=>n.value=L),selectedProductIndex:fe.value,"onUpdate:selectedProductIndex":u[2]||(u[2]=L=>fe.value=L),"visible-tabs":r.value?["product","layer"]:["layer"],"product-items":Ne.value,"product-total":st.value,"product-page":f.value,"product-page-size":b.value,"product-has-prev":vt.value,"product-has-next":Qe.value,layers:y.value,"active-layer-id":E.value,onChangeProductPage:ln,onSelectLayer:Ts,onToggleLayerVisibility:Zs,onToggleLayerLock:Gs,onDeleteLayer:Ys,onMoveLayerById:Ta,onDuplicateLayerById:Ks},null,8,["activeTab","urlInput","selectedProductIndex","visible-tabs","product-items","product-total","product-page","product-page-size","product-has-prev","product-has-next","layers","active-layer-id"])):t.createCommentVNode("",!0),t.createVNode(Ui,{selectedSize:q.value,"onUpdate:selectedSize":u[3]||(u[3]=L=>q.value=L),selectedDiecutId:Z.value,"onUpdate:selectedDiecutId":u[4]||(u[4]=L=>Z.value=L),"size-options":Ge.value,"loading-template":w.value,"template-error":j.value,"diecut-options":ct.value,zoom:c.value,onCanvasReady:de,onZoomIn:el,onZoomOut:tl,onFitCanvas:xn,onCopyToDiecuts:hl},null,8,["selectedSize","selectedDiecutId","size-options","loading-template","template-error","diecut-options","zoom"]),$.value&&ce.value?(t.openBlock(),t.createBlock(Dn,{key:1,class:"sidebar-right","active-tab":"add",urlInput:n.value,"onUpdate:urlInput":u[5]||(u[5]=L=>n.value=L),"show-nav":!1,"visible-tabs":["add"],layers:y.value,"active-layer-id":E.value,"show-image-tools":_.value.visible,"image-pattern-mode":_.value.mode,"image-pattern-scale":_.value.scale,"image-pattern-scale-enabled":_.value.isPattern,"show-layer-tools":S.value.visible,"layer-opacity":S.value.opacity,"show-text-tools":I.value.visible,"text-font-family":I.value.fontFamily,"text-font-size":I.value.fontSize,"text-char-spacing":I.value.charSpacing,"text-line-height":I.value.lineHeight,"text-fill":I.value.fill,"text-stroke-width":I.value.strokeWidth,"text-stroke":I.value.stroke,onAddText:Sa,onAddLabel:Na,onAddRect:_s,onAddCircle:As,onRemoveSelected:Ns,onUpload:za,onAddImageUrl:Ia,onPasteUrl:Ds,onApplyImagePattern:Os,onUpdateImagePatternScale:Ls,onUpdateTextProp:Ps,onMoveLayer:Us,onMoveLayerById:Ta,onFlipLayer:Ms,onRotateLayer:Ws,onScaleLayer:Hs,onAlignLayer:qs,onDuplicateLayer:Xs,onCenterLayer:Vs,onUpdateLayerOpacity:$s},null,8,["urlInput","layers","active-layer-id","show-image-tools","image-pattern-mode","image-pattern-scale","image-pattern-scale-enabled","show-layer-tools","layer-opacity","show-text-tools","text-font-family","text-font-size","text-char-spacing","text-line-height","text-fill","text-stroke-width","text-stroke"])):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createBlock(ts,{key:2,"render-data":He.value,"preview-title":qe.value,"template-index":T.value,"template-total":ge.value,"get-render-data-for-index":cn,"get-all-diecut-fabric-data":dl,onPrevTemplate:we,onNextTemplate:Be},null,8,["render-data","preview-title","template-index","template-total"])):t.createCommentVNode("",!0)]),F.value?(t.openBlock(),t.createBlock(ls,{key:1,"template-mode-options":Ft.value,"selected-mode":V.value,"onUpdate:selectedMode":u[6]||(u[6]=L=>V.value=L),onClose:xl},null,8,["template-mode-options","selected-mode"])):t.createCommentVNode("",!0),ne.value?(t.openBlock(),t.createElementBlock("div",{key:2,class:"modal-backdrop",onClick:t.withModifiers(pn,["self"])},[t.createElementVNode("div",{class:"modal"},[t.createElementVNode("div",{class:"modal-header"},[u[7]||(u[7]=t.createElementVNode("span",null,"清空画布",-1)),t.createElementVNode("button",{class:"ghost icon",type:"button",onClick:pn},"✕")]),u[8]||(u[8]=t.createElementVNode("div",{class:"modal-body"},[t.createElementVNode("p",{class:"modal-text"},"确定要清空画布吗?此操作无法撤销。")],-1)),t.createElementVNode("div",{class:"modal-footer"},[t.createElementVNode("button",{class:"modal-btn",type:"button",onClick:pn},"取消"),t.createElementVNode("button",{class:"modal-btn danger",type:"button",onClick:zs},"清空")])])])):t.createCommentVNode("",!0)])}}}),Ba=x=>{x.component("Editor",on)},us={install:Ba,Editor:on};ze.EPartType=Fn,ze.EPsdDataType=wt,ze.Editor=on,ze.appendFileTokenIfPresent=fr,ze.appendFileTokenToUrl=Ot,ze.applyVectorMask=qt,ze.clearFileToken=Cn,ze.convertBlendMode=mr,ze.convertPsdJsonToModelData=pr,ze.default=us,ze.deformByJson=Zi,ze.deformImage=Xi,ze.deformImageBitmap=gr,ze.deformWithWorker=vr,ze.disposeDeformWorkers=qi,ze.downloadCanvas=On,ze.ensureFileToken=Bt,ze.fetchWithFileToken=dt,ze.getDeformWorker=zn,ze.getFileToken=Tt,ze.getFileTokenFetchers=Qa,ze.getMaskFromData=Sn,ze.install=Ba,ze.isFileTokenExpired=cr,ze.loadImageBitmap=Rn,ze.normalizeLayerData=Tn,ze.normalizeMaskData=Nn,ze.renderByJson=Yt,ze.setFileTokenFetchers=Ja,ze.stripFileTokenParam=ur,ze.toImageBitmap=xr,ze.withFileToken=hr,Object.defineProperties(ze,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|