2 lines
40 KiB
JavaScript
Raw Normal View History

2023-07-31 09:26:24 +08:00
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("minimist"),require("ag-psd/initialize-canvas"),require("ag-psd"),require("fs-extra"),require("path"),require("crypto"),require("pinyin-pro"),require("canvas")):"function"==typeof define&&define.amd?define(["minimist","ag-psd/initialize-canvas","ag-psd","fs-extra","path","crypto","pinyin-pro","canvas"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).minimist,null,t.psd,t.fs,t.path,t.crypto,t.pinyinPro,t.canvas)}(this,(function(t,e,i,o,s,r,n,a){"use strict";function l(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var c,p=l(i);function h(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n}function d(t,e,i,o){return new(i||(i=Promise))((function(s,r){function n(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(n,a)}l((o=o.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.all=0]="all",t[t.v249=1]="v249",t[t.v342=2]="v342"}(c||(c={}));let u=(t,e)=>{t.__unserialization||(t.__unserialization=[]),t.__unserialization.push(e)};function _(t){return e=>{Object.defineProperty(e.prototype,"$__type__",{value:t,enumerable:!0})}}let v={},g={},f={},y=0;function m(t){return void 0!==t.constructor.__ver_tag_id__&&f[t.constructor.__ver_tag_id__]==t||(t.constructor.__ver_tag_id__=`${y}`,f[t.constructor.__ver_tag_id__]=t,y++),t.constructor.__ver_tag_id__}function b(t,e){for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(i in t)continue;t[i]=e[i]}}function x(t,...e){for(let i=0;i<e.length;i++)b(t,e[i])}function w(t){return(e,i)=>{let o=e.constructor.name;o=m(e),!g[o]&&(g[o]={});let s=g[o];if(s[i]||(s[i]={}),c.all===t)for(const t in c)s[i][c[t]]=!0;else s[i][c[t]]=!0;var r=S(e.constructor);if(r){let t=m(r.prototype);!v[o]&&(v[o]=t);for(var n=S(r);n;){let e=m(n.prototype);!v[t]&&(v[t]=e),n=S(n)}for(;t;)t in g&&x(s,g[t]),t=v[t]}e._version||(e._version={}),e._version[o]=g[o]=s}}function S(t){var e=t.prototype,i=e&&Object.getPrototypeOf(e);return i&&i.constructor}const M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",F=new Array(123);for(let t=0;t<123;++t)F[t]=64;for(let t=0;t<64;++t)F[M.charCodeAt(t)]=t;const P=F,I="0123456789abcdef".split(""),$=["","","",""],j=$.concat($,"-",$,"-",$,"-",$,"-",$,$,$),C=j.map(((t,e)=>"-"===t?NaN:e)).filter(isFinite);let N={};for(let t=0;t<I.length;t++){let e=I[t];N[e]=t}const z=new class{uuid(){var t=(new Date).getTime();return globalThis.performance&&"function"==typeof globalThis.performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}decodeUuid(t){const e=t.split("@")[0];if(22!==e.length)return t;j[0]=t[0],j[1]=t[1];for(let e=2,i=2;e<22;e+=2){const o=P[t.charCodeAt(e)],s=P[t.charCodeAt(e+1)];j[C[i++]]=I[o>>2],j[C[i++]]=I[(3&o)<<2|s>>4],j[C[i++]]=I[15&s]}return t.replace(e,j.join(""))}compressUuid(t){const e=t.split("@")[0];if(36!==e.length)return t;let i=[];i[0]=e[0],i[1]=e[1];let o=e.replace("-","").replace("-","").replace("-","").replace("-","");for(let t=2,e=2;t<32;t+=3){const s=N[String.fromCharCode(o.charCodeAt(t))],r=N[String.fromCharCode(o.charCodeAt(t+1))],n=N[String.fromCharCode(o.charCodeAt(t+2))];i[e++]=M[(s<<2)+(r>>2)],i[e++]=M[((3&r)<<4)+n]}return t.replace(e,i.join(""))}isNumber(t){return!isNaN(parseFloat(t))&&isFinite(t)}};class O{constructor(){this.uuid="",this.idx=0,this.uuid=z.uuid()}toJSON(){var t;let e=