/*! third party licenses: js/vendor.LICENSE.txt */
import{g as X}from"./vendor-BeFBwUwf.chunk.mjs";import{c as Y}from"./_commonjs-dynamic-modules-CSduYUN4.chunk.mjs";function K(S,P){for(var w=0;w
m[G]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}var T={exports:{}},z;function Z(){return z||(z=1,function(S,P){(function(w){S.exports=w()})(function(){return function(){function w(m,G,o){function i(n,t){if(!G[n]){if(!m[n]){var A=typeof Y=="function"&&Y;if(!t&&A)return A(n,!0);if(s)return s(n,!0);var h=new Error("Cannot find module '"+n+"'");throw h.code="MODULE_NOT_FOUND",h}var u=G[n]={exports:{}};m[n][0].call(u.exports,function(c){var l=m[n][1][c];return i(l||c)},u,u.exports,w,m,G,o)}return G[n].exports}for(var s=typeof Y=="function"&&Y,e=0;e=0,wasm:A.indexOf("wasm")>=0};i.call(this,h),this.features={js:h.js,wasm:h.wasm&&this.has_wasm()},this.use(s),this.use(e)}o(n,i),n.prototype.resizeAndUnsharp=function(t,A){var h=this.resize(t,A);return t.unsharpAmount&&this.unsharp_mask(h,t.toWidth,t.toHeight,t.unsharpAmount,t.unsharpRadius,t.unsharpThreshold),h},m.exports=n},{"./mm_resize":4,"./mm_unsharp_mask":9,inherits:19,multimath:20}],2:[function(w,m,G){function o(e){return e<0?0:e>255?255:e}function i(e,n,t,A,h,u){var c,l,I,d,_,B,C,Q,E,y,M,D=0,v=0;for(E=0;E0;C--)M=u[_++],d=d+M*e[Q+3]|0,I=I+M*e[Q+2]|0,l=l+M*e[Q+1]|0,c=c+M*e[Q]|0,Q=Q+4|0;n[v+3]=o(d+8192>>14),n[v+2]=o(I+8192>>14),n[v+1]=o(l+8192>>14),n[v]=o(c+8192>>14),v=v+A*4|0}v=(E+1)*4|0,D=(E+1)*t*4|0}}function s(e,n,t,A,h,u){var c,l,I,d,_,B,C,Q,E,y,M,D=0,v=0;for(E=0;E0;C--)M=u[_++],d=d+M*e[Q+3]|0,I=I+M*e[Q+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AGIAEQAQs="},{}],4:[function(w,m,G){m.exports={name:"resize",fn:w("./resize"),wasm_fn:w("./resize_wasm"),wasm_src:w("./convolve_wasm_base64")}},{"./convolve_wasm_base64":3,"./resize":5,"./resize_wasm":8}],5:[function(w,m,G){var o=w("./resize_filter_gen"),i=w("./convolve").convolveHorizontally,s=w("./convolve").convolveVertically;function e(n,t,A){for(var h=3,u=t*A*4|0;h"u"?3:n.quality,Q=n.alpha||!1,E=o(C,A,u,l,d),y=o(C,h,c,I,_),M=new Uint8Array(u*h*4);return i(t,M,A,h,u,E),s(M,B,h,u,c,y),Q||e(B,u,c),B}},{"./convolve":2,"./resize_filter_gen":6}],6:[function(w,m,G){var o=w("./resize_filter_info"),i=14;function s(e){return Math.round(e*((1<>1]+=s(1-O),R=0;R0&&y[r]===0;)r--;if(f=B+R,a=r-R+1,g[x++]=f,g[x++]=a,!b)g.set(y.subarray(R,r+1),x),x+=a;else for(v=R;v<=r;v++)g[x++]=y[v]}else g[x++]=0,g[x++]=0}return g}},{"./resize_filter_info":7}],7:[function(w,m,G){m.exports=[{win:.5,filter:function(o){return o>=-.5&&o<.5?1:0}},{win:1,filter:function(o){if(o<=-1||o>=1)return 0;if(o>-11920929e-14&&o<11920929e-14)return 1;var i=o*Math.PI;return Math.sin(i)/i*(.54+.46*Math.cos(i/1))}},{win:2,filter:function(o){if(o<=-2||o>=2)return 0;if(o>-11920929e-14&&o<11920929e-14)return 1;var i=o*Math.PI;return Math.sin(i)/i*Math.sin(i/2)/(i/2)}},{win:3,filter:function(o){if(o<=-3||o>=3)return 0;if(o>-11920929e-14&&o<11920929e-14)return 1;var i=o*Math.PI;return Math.sin(i)/i*Math.sin(i/3)/(i/3)}}]},{}],8:[function(w,m,G){var o=w("./resize_filter_gen");function i(t,A,h){for(var u=3,c=A*h*4|0;u>8&255}}m.exports=function(t){var A=t.src,h=t.width,u=t.height,c=t.toWidth,l=t.toHeight,I=t.scaleX||t.toWidth/t.width,d=t.scaleY||t.toHeight/t.height,_=t.offsetX||0,B=t.offsetY||0,C=t.dest||new Uint8Array(c*l*4),Q=typeof t.quality>"u"?3:t.quality,E=t.alpha||!1,y=o(Q,h,c,I,_),M=o(Q,u,l,d,B),D=0,v=this.__align(D+Math.max(A.byteLength,C.byteLength)),k=this.__align(v+u*c*4),O=this.__align(k+y.byteLength),H=O+M.byteLength,R=this.__instance("resize",H),r=new Uint8Array(this.__memory.buffer),f=new Uint32Array(this.__memory.buffer),a=new Uint32Array(A.buffer);f.set(a),n(y,r,k),n(M,r,O);var p=R.exports.convolveHV||R.exports._convolveHV;p(k,O,v,h,u,c,l);var g=new Uint32Array(C.buffer);return g.set(new Uint32Array(this.__memory.buffer,0,l*c)),E||i(C,c,l),C}},{"./resize_filter_gen":6}],9:[function(w,m,G){m.exports={name:"unsharp_mask",fn:w("./unsharp_mask"),wasm_fn:w("./unsharp_mask_wasm"),wasm_src:w("./unsharp_mask_wasm_base64")}},{"./unsharp_mask":10,"./unsharp_mask_wasm":11,"./unsharp_mask_wasm_base64":12}],10:[function(w,m,G){var o=w("glur/mono16");function i(s,e,n){for(var t=e*n,A=new Uint16Array(t),h,u,c,l,I=0;I=u&&h>=c?h:u>=c&&u>=h?u:c,A[I]=l<<8;return A}m.exports=function(s,e,n,t,A,h){var u,c,l,I,d;if(!(t===0||A<.5)){A>2&&(A=2);var _=i(s,e,n),B=new Uint16Array(_);o(B,e,n,A);for(var C=t/100*4096+.5|0,Q=h<<8,E=e*n,y=0;y=Q&&(c=u+(C*I+2048>>12),c=c>65280?65280:c,c=c<0?0:c,u=u!==0?u:1,l=(c<<12)/u|0,d=y*4,s[d]=s[d]*l+2048>>12,s[d+1]=s[d+1]*l+2048>>12,s[d+2]=s[d+2]*l+2048>>12)}}},{"glur/mono16":18}],11:[function(w,m,G){m.exports=function(o,i,s,e,n,t){if(!(e===0||n<.5)){n>2&&(n=2);var A=i*s,h=A*4,u=A*2,c=A*2,l=Math.max(i,s)*4,I=8*4,d=0,_=h,B=_+u,C=B+c,Q=C+c,E=Q+l,y=this.__instance("unsharp_mask",h+u+c*2+l+I,{exp:Math.exp}),M=new Uint32Array(o.buffer),D=new Uint32Array(this.__memory.buffer);D.set(M);var v=y.exports.hsv_v16||y.exports._hsv_v16;v(d,_,i,s),v=y.exports.blurMono16||y.exports._blurMono16,v(_,B,C,Q,E,i,s,n),v=y.exports.unsharp||y.exports._unsharp,v(d,d,_,B,i,s,e,t),M.set(new Uint32Array(this.__memory.buffer,0,A))}}},{}],12:[function(w,m,G){m.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAE0B2AAAGAEf39/fwBgBn9/f39/fwBgCH9/f39/f39/AGAIf39/f39/f30AYAJ9fwBgAXwBfAIZAgNlbnYDZXhwAAYDZW52Bm1lbW9yeQIAAAMHBgAFAgQBAwYGAX8AQQALB4oBCBFfX3dhc21fY2FsbF9jdG9ycwABFl9fYnVpbGRfZ2F1c3NpYW5fY29lZnMAAg5fX2dhdXNzMTZfbGluZQADCmJsdXJNb25vMTYABAdoc3ZfdjE2AAUHdW5zaGFycAAGDF9fZHNvX2hhbmRsZQMAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwABCsUMBgMAAQvWAQEHfCABRNuGukOCGvs/IAC7oyICRAAAAAAAAADAohAAIgW2jDgCFCABIAKaEAAiAyADoCIGtjgCECABRAAAAAAAAPA/IAOhIgQgBKIgAyACIAKgokQAAAAAAADwP6AgBaGjIgS2OAIAIAEgBSAEmqIiB7Y4AgwgASADIAJEAAAAAAAA8D+gIASioiIItjgCCCABIAMgAkQAAAAAAADwv6AgBKKiIgK2OAIEIAEgByAIoCAFRAAAAAAAAPA/IAahoCIDo7Y4AhwgASAEIAKgIAOjtjgCGAuGBQMGfwl8An0gAyoCDCEVIAMqAgghFiADKgIUuyERIAMqAhC7IRACQCAEQQFrIghBAEgiCQRAIAIhByAAIQYMAQsgAiAALwEAuCIPIAMqAhi7oiIMIBGiIg0gDCAQoiAPIAMqAgS7IhOiIhQgAyoCALsiEiAP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DQALCyAFRQ0AQQAhCANAIAIgBiAIbEEBdGogASAIQQF0aiADIAQgBiAFEAMgCEEBaiIIIAVHDQALCwtxAQN/IAIgA2wiBQRAA0AgASAAKAIAIgRBEHZB/wFxIgIgAiAEQQh2Qf8BcSIDIAMgBEH/AXEiBEkbIAIgA0sbIgYgBiAEIAIgBEsbIAMgBEsbQQh0OwEAIAFBAmohASAAQQRqIQAgBUEBayIFDQALCwuZAgIDfwF8IAQgBWwhBAJ/IAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6AiC5lEAAAAAAAA4EFjBEAgC6oMAQtBgICAgHgLIQUgBARAIAdBCHQhCUEAIQYDQCAJIAIgBkEBdCIHai8BACIBIAMgB2ovAQBrIgcgB0EfdSIIaiAIc00EQCAAIAZBAnQiCGoiCiAFIAdsQYAQakEMdSABaiIHQYD+AyAHQYD+A0gbIgdBACAHQQBKG0EMdCABQQEgARtuIgEgCi0AAGxBgBBqQQx2OgAAIAAgCEEBcmoiByABIActAABsQYAQakEMdjoAACAAIAhBAnJqIgcgASAHLQAAbEGAEGpBDHY6AAALIAZBAWoiBiAERw0ACwsL"},{}],13:[function(w,m,G){var o=100;function i(s,e){this.create=s,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=e||2e3}i.prototype.acquire=function(){var s=this,e;return this.available.length!==0?e=this.available.pop():(e=this.create(),e.id=this.lastId++,e.release=function(){return s.release(e)}),this.acquired[e.id]=e,e},i.prototype.release=function(s){var e=this;delete this.acquired[s.id],s.lastUsed=Date.now(),this.available.push(s),this.timeoutId===0&&(this.timeoutId=setTimeout(function(){return e.gc()},o))},i.prototype.gc=function(){var s=this,e=Date.now();this.available=this.available.filter(function(n){return e-n.lastUsed>s.idle?(n.destroy(),!1):!0}),this.available.length!==0?this.timeoutId=setTimeout(function(){return s.gc()},o):this.timeoutId=0},m.exports=i},{}],14:[function(w,m,G){var o=2;m.exports=function(i,s,e,n,t,A){var h=e/i,u=n/s,c=(2*A+o+1)/t;if(c>.5)return[[e,n]];var l=Math.ceil(Math.log(Math.min(h,u))/Math.log(c));if(l<=1)return[[e,n]];for(var I=[],d=0;d=e.toWidth&&(d=e.toWidth-u),c=I-e.destTileBorder,c<0&&(c=0),_=I+h+e.destTileBorder-c,c+_>=e.toHeight&&(_=e.toHeight-c),C={toX:u,toY:c,toWidth:d,toHeight:_,toInnerX:l,toInnerY:I,toInnerWidth:A,toInnerHeight:h,offsetX:u/n-i(u/n),offsetY:c/t-i(c/t),scaleX:n,scaleY:t,x:i(u/n),y:i(c/t),width:s(d/n),height:s(_/t)},B.push(C);return B}},{}],16:[function(w,m,G){function o(i){return Object.prototype.toString.call(i)}m.exports.isCanvas=function(i){var s=o(i);return s==="[object HTMLCanvasElement]"||s==="[object OffscreenCanvas]"||s==="[object Canvas]"},m.exports.isImage=function(i){return o(i)==="[object HTMLImageElement]"},m.exports.isImageBitmap=function(i){return o(i)==="[object ImageBitmap]"},m.exports.limiter=function(i){var s=0,e=[];function n(){s"u")return!1;var s=i(100,100);return createImageBitmap(s,0,0,100,100,{resizeWidth:10,resizeHeight:10,resizeQuality:"high"}).then(function(e){var n=e.width===10;return e.close(),s=null,n})}).catch(function(){return!1})},m.exports.worker_offscreen_canvas_support=function(){return new Promise(function(i,s){if(typeof OffscreenCanvas>"u"){i(!1);return}function e(A){if(typeof createImageBitmap>"u"){A.postMessage(!1);return}Promise.resolve().then(function(){var h=new OffscreenCanvas(10,10),u=h.getContext("2d");return u.rect(0,0,1,1),createImageBitmap(h,0,0,1,1)}).then(function(){return A.postMessage(!0)},function(){return A.postMessage(!1)})}var n=btoa("(".concat(e.toString(),")(self);")),t=new Worker("data:text/javascript;base64,".concat(n));t.onmessage=function(A){return i(A.data)},t.onerror=s}).then(function(i){return i},function(){return!1})},m.exports.can_use_canvas=function(i){var s=!1;try{var e=i(2,1),n=e.getContext("2d"),t=n.createImageData(2,1);t.data[0]=12,t.data[1]=23,t.data[2]=34,t.data[3]=255,t.data[4]=45,t.data[5]=56,t.data[6]=67,t.data[7]=255,n.putImageData(t,0,0),t=null,t=n.getImageData(0,0,2,1),t.data[0]===12&&t.data[1]===23&&t.data[2]===34&&t.data[3]===255&&t.data[4]===45&&t.data[5]===56&&t.data[6]===67&&t.data[7]===255&&(s=!0)}catch{}return s},m.exports.cib_can_use_region=function(){return new Promise(function(i){if(typeof createImageBitmap>"u"){i(!1);return}var s=new Image;s.src="data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z",s.onload=function(){createImageBitmap(s,0,0,s.width,s.height).then(function(e){e.width===s.width&&e.height===s.height?i(!0):i(!1)},function(){return i(!1)})},s.onerror=function(){return i(!1)}})}},{}],17:[function(w,m,G){m.exports=function(){var o=w("./mathlib"),i;onmessage=function(s){var e=s.data.opts;if(!e.src&&e.srcBitmap){var n=new OffscreenCanvas(e.width,e.height),t=n.getContext("2d",{alpha:!!e.alpha});t.drawImage(e.srcBitmap,0,0),e.src=t.getImageData(0,0,e.width,e.height).data,n.width=n.height=0,n=null,e.srcBitmap.close(),e.srcBitmap=null}i||(i=new o(s.data.features));var A=i.resizeAndUnsharp(e);postMessage({data:A},[A.buffer])}}},{"./mathlib":1}],18:[function(w,m,G){var o,i,s,e,n,t,A,h;function u(I){I<.5&&(I=.5);var d=Math.exp(.726*.726)/I,_=Math.exp(-d),B=Math.exp(-2*d),C=(1-_)*(1-_)/(1+2*d*_-B);return o=C,i=C*(d-1)*_,s=C*(d+1)*_,e=-C*B,n=2*_,t=-B,A=(o+i)/(1-n-t),h=(s+e)/(1-n-t),new Float32Array([o,i,s,e,n,t,A,h])}function c(I,d,_,B,C,Q){var E,y,M,D,v,k,O,H,R,r,f,a,p,g;for(R=0;R=0;r--)M=y*f+E*a+D*p+v*g,v=D,D=M,E=y,y=I[k],d[O]=_[H]+D,k--,H--,O-=Q}}function l(I,d,_,B){if(B){var C=new Uint16Array(I.length),Q=new Float32Array(Math.max(d,_)),E=u(B);c(I,C,Q,E,d,_),c(C,I,Q,E,_,d)}}m.exports=l},{}],19:[function(w,m,G){typeof Object.create=="function"?m.exports=function(o,i){i&&(o.super_=i,o.prototype=Object.create(i.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:m.exports=function(o,i){if(i){o.super_=i;var s=function(){};s.prototype=i.prototype,o.prototype=new s,o.prototype.constructor=o}}},{}],20:[function(w,m,G){var o=w("object-assign"),i=w("./lib/base64decode"),s=w("./lib/wa_detect"),e={js:!0,wasm:!0};function n(t){if(!(this instanceof n))return new n(t);var A=o({},e,t||{});if(this.options=A,this.__cache={},this.__init_promise=null,this.__modules=A.modules||{},this.__memory=null,this.__wasm={},this.__isLE=new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0]===1,!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}n.prototype.has_wasm=s,n.prototype.use=function(t){return this.__modules[t.name]=t,this.options.wasm&&this.has_wasm()&&t.wasm_fn?this[t.name]=t.wasm_fn:this[t.name]=t.fn,this},n.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error(`mathlib: only "wasm" was enabled, but it's not supported`));var t=this;return this.__init_promise=Promise.all(Object.keys(t.__modules).map(function(A){var h=t.__modules[A];return!t.options.wasm||!t.has_wasm()||!h.wasm_fn||t.__wasm[A]?null:WebAssembly.compile(t.__base64decode(h.wasm_src)).then(function(u){t.__wasm[A]=u})})).then(function(){return t}),this.__init_promise},n.prototype.__base64decode=i,n.prototype.__reallocate=function(t){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(t/(64*1024))}),this.__memory;var A=this.__memory.buffer.byteLength;return A>2),t=0,A=0,h=0;h>16&255,n[A++]=t>>8&255,n[A++]=t&255),t=t<<6|o.indexOf(s.charAt(h));var u=e%4*6;return u===0?(n[A++]=t>>16&255,n[A++]=t>>8&255,n[A++]=t&255):u===18?(n[A++]=t>>10&255,n[A++]=t>>2&255):u===12&&(n[A++]=t>>4&255),n}},{}],22:[function(w,m,G){var o;m.exports=function(){if(typeof o<"u"||(o=!1,typeof WebAssembly>"u"))return o;try{var i=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),s=new WebAssembly.Module(i),e=new WebAssembly.Instance(s,{});return e.exports.test(4)!==0&&(o=!0),o}catch{}return o}},{}],23:[function(w,m,G){var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function e(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function n(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var A={},h=0;h<10;h++)A["_"+String.fromCharCode(h)]=h;var u=Object.getOwnPropertyNames(A).map(function(l){return A[l]});if(u.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(l){c[l]=l}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}m.exports=n()?Object.assign:function(t,A){for(var h,u=e(t),c,l=1;lr.length)&&(f=r.length);for(var a=0,p=new Array(f);a=0)}catch{}var Q=1;typeof navigator<"u"&&(Q=Math.min(navigator.hardwareConcurrency||1,4));var E={tile:1024,concurrency:Q,features:["js","wasm","ww"],idle:2e3,createCanvas:function(r,f){var a=document.createElement("canvas");return a.width=r,a.height=f,a}},y={quality:3,alpha:!1,unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0},M=!1,D=!1,v=!1,k=!1,O=!1;function H(){return{value:h(I),destroy:function(){if(this.value.terminate(),typeof window<"u"){var r=window.URL||window.webkitURL||window.mozURL||window.msURL;r&&r.revokeObjectURL&&this.value.objectURL&&r.revokeObjectURL(this.value.objectURL)}}}}function R(r){if(!(this instanceof R))return new R(r);this.options=A({},E,r||{});var f="lk_".concat(this.options.concurrency);this.__limit=B[f]||l.limiter(this.options.concurrency),B[f]||(B[f]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}R.prototype.init=function(){var r=this;if(this.__initPromise)return this.__initPromise;if(typeof ImageData<"u"&&typeof Uint8ClampedArray<"u")try{new ImageData(new Uint8ClampedArray(400),10,10),M=!0}catch{}typeof ImageBitmap<"u"&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?D=!0:this.debug("ImageBitmap does not support .close(), disabled"));var f=this.options.features.slice();if(f.indexOf("all")>=0&&(f=["cib","wasm","js","ww"]),this.__requested_features=f,this.__mathlib=new u(f),f.indexOf("ww")>=0&&typeof window<"u"&&"Worker"in window)try{var a=w("webworkify")(function(){});a.terminate(),this.features.ww=!0;var p="wp_".concat(JSON.stringify(this.options));B[p]?this.__workersPool=B[p]:(this.__workersPool=new c(H,this.options.idle),B[p]=this.__workersPool)}catch{}var g=this.__mathlib.init().then(function(U){A(r.features,U.features)}),x;D?x=l.cib_support(this.options.createCanvas).then(function(U){if(r.features.cib&&f.indexOf("cib")<0){r.debug("createImageBitmap() resize supported, but disabled by config");return}f.indexOf("cib")>=0&&(r.features.cib=U)}):x=Promise.resolve(!1),v=l.can_use_canvas(this.options.createCanvas);var b;D&&M&&f.indexOf("ww")!==-1?b=l.worker_offscreen_canvas_support():b=Promise.resolve(!1),b=b.then(function(U){k=U});var j=l.cib_can_use_region().then(function(U){O=U});return this.__initPromise=Promise.all([g,x,b,j]).then(function(){return r}),this.__initPromise},R.prototype.__invokeResize=function(r,f){var a=this;return f.__mathCache=f.__mathCache||{},Promise.resolve().then(function(){return a.features.ww?new Promise(function(p,g){var x=a.__workersPool.acquire();f.cancelToken&&f.cancelToken.catch(function(j){return g(j)}),x.value.onmessage=function(j){x.release(),j.data.err?g(j.data.err):p(j.data)};var b=[];r.src&&b.push(r.src.buffer),r.srcBitmap&&b.push(r.srcBitmap),x.value.postMessage({opts:r,features:a.__requested_features,preload:{wasm_nodule:a.__mathlib.__}},b)}):{data:a.__mathlib.resizeAndUnsharp(r,f.__mathCache)}})},R.prototype.__extractTileData=function(r,f,a,p,g){if(this.features.ww&&k&&(l.isCanvas(f)||O))return this.debug("Create tile for OffscreenCanvas"),createImageBitmap(p.srcImageBitmap||f,r.x,r.y,r.width,r.height).then(function(j){return g.srcBitmap=j,g});if(l.isCanvas(f))return p.srcCtx||(p.srcCtx=f.getContext("2d",{alpha:!!a.alpha})),this.debug("Get tile pixel data"),g.src=p.srcCtx.getImageData(r.x,r.y,r.width,r.height).data,g;this.debug("Draw tile imageBitmap/image to temporary canvas");var x=this.options.createCanvas(r.width,r.height),b=x.getContext("2d",{alpha:!!a.alpha});return b.globalCompositeOperation="copy",b.drawImage(p.srcImageBitmap||f,r.x,r.y,r.width,r.height,0,0,r.width,r.height),this.debug("Get tile pixel data"),g.src=b.getImageData(0,0,r.width,r.height).data,x.width=x.height=0,g},R.prototype.__landTileData=function(r,f,a){var p;if(this.debug("Convert raw rgba tile result to ImageData"),f.bitmap)return a.toCtx.drawImage(f.bitmap,r.toX,r.toY),null;if(M)p=new ImageData(new Uint8ClampedArray(f.data),r.toWidth,r.toHeight);else if(p=a.toCtx.createImageData(r.toWidth,r.toHeight),p.data.set)p.data.set(f.data);else for(var g=p.data.length-1;g>=0;g--)p.data[g]=f.data[g];return this.debug("Draw tile"),C?a.toCtx.putImageData(p,r.toX,r.toY,r.toInnerX-r.toX,r.toInnerY-r.toY,r.toInnerWidth+1e-5,r.toInnerHeight+1e-5):a.toCtx.putImageData(p,r.toX,r.toY,r.toInnerX-r.toX,r.toInnerY-r.toY,r.toInnerWidth,r.toInnerHeight),null},R.prototype.__tileAndResize=function(r,f,a){var p=this,g={srcCtx:null,srcImageBitmap:null,isImageBitmapReused:!1,toCtx:null},x=function(b){return p.__limit(function(){if(a.canceled)return a.cancelToken;var j={width:b.width,height:b.height,toWidth:b.toWidth,toHeight:b.toHeight,scaleX:b.scaleX,scaleY:b.scaleY,offsetX:b.offsetX,offsetY:b.offsetY,quality:a.quality,alpha:a.alpha,unsharpAmount:a.unsharpAmount,unsharpRadius:a.unsharpRadius,unsharpThreshold:a.unsharpThreshold};return p.debug("Invoke resize math"),Promise.resolve(j).then(function(U){return p.__extractTileData(b,r,a,g,U)}).then(function(U){return p.debug("Invoke resize math"),p.__invokeResize(U,a)}).then(function(U){return a.canceled?a.cancelToken:(g.srcImageData=null,p.__landTileData(b,U,g))})})};return Promise.resolve().then(function(){if(g.toCtx=f.getContext("2d",{alpha:!!a.alpha}),l.isCanvas(r))return null;if(l.isImageBitmap(r))return g.srcImageBitmap=r,g.isImageBitmapReused=!0,null;if(l.isImage(r))return D?(p.debug("Decode image via createImageBitmap"),createImageBitmap(r).then(function(b){g.srcImageBitmap=b}).catch(function(b){return null})):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')}).then(function(){if(a.canceled)return a.cancelToken;p.debug("Calculate tiles");var b=_({width:a.width,height:a.height,srcTileSize:p.options.tile,toWidth:a.toWidth,toHeight:a.toHeight,destTileBorder:a.__destTileBorder}),j=b.map(function(F){return x(F)});function U(F){F.srcImageBitmap&&(F.isImageBitmapReused||F.srcImageBitmap.close(),F.srcImageBitmap=null)}return p.debug("Process tiles"),Promise.all(j).then(function(){return p.debug("Finished!"),U(g),f},function(F){throw U(g),F})})},R.prototype.__processStages=function(r,f,a,p){var g=this;if(p.canceled)return p.cancelToken;var x=r.shift(),b=o(x,2),j=b[0],U=b[1],F=r.length===0;p=A({},p,{toWidth:j,toHeight:U,quality:F?p.quality:Math.min(1,p.quality)});var W;return F||(W=this.options.createCanvas(j,U)),this.__tileAndResize(f,F?a:W,p).then(function(){return F?a:(p.width=j,p.height=U,g.__processStages(r,W,a,p))}).then(function(L){return W&&(W.width=W.height=0),L})},R.prototype.__resizeViaCreateImageBitmap=function(r,f,a){var p=this,g=f.getContext("2d",{alpha:!!a.alpha});return this.debug("Resize via createImageBitmap()"),createImageBitmap(r,{resizeWidth:a.toWidth,resizeHeight:a.toHeight,resizeQuality:l.cib_quality_name(a.quality)}).then(function(x){if(a.canceled)return a.cancelToken;if(!a.unsharpAmount)return g.drawImage(x,0,0),x.close(),g=null,p.debug("Finished!"),f;p.debug("Unsharp result");var b=p.options.createCanvas(a.toWidth,a.toHeight),j=b.getContext("2d",{alpha:!!a.alpha});j.drawImage(x,0,0),x.close();var U=j.getImageData(0,0,a.toWidth,a.toHeight);return p.__mathlib.unsharp_mask(U.data,a.toWidth,a.toHeight,a.unsharpAmount,a.unsharpRadius,a.unsharpThreshold),g.putImageData(U,0,0),b.width=b.height=0,U=j=b=g=null,p.debug("Finished!"),f})},R.prototype.resize=function(r,f,a){var p=this;this.debug("Start resize...");var g=A({},y);if(isNaN(a)?a&&(g=A(g,a)):g=A(g,{quality:a}),g.toWidth=f.width,g.toHeight=f.height,g.width=r.naturalWidth||r.width,g.height=r.naturalHeight||r.height,f.width===0||f.height===0)return Promise.reject(new Error("Invalid output size: ".concat(f.width,"x").concat(f.height)));g.unsharpRadius>2&&(g.unsharpRadius=2),g.canceled=!1,g.cancelToken&&(g.cancelToken=g.cancelToken.then(function(b){throw g.canceled=!0,b},function(b){throw g.canceled=!0,b}));var x=3;return g.__destTileBorder=Math.ceil(Math.max(x,2.5*g.unsharpRadius|0)),this.init().then(function(){if(g.canceled)return g.cancelToken;if(p.features.cib)return p.__resizeViaCreateImageBitmap(r,f,g);if(!v){var b=new Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");throw b.code="ERR_GET_IMAGE_DATA",b}var j=d(g.width,g.height,g.toWidth,g.toHeight,p.options.tile,g.__destTileBorder);return p.__processStages(j,r,f,g)})},R.prototype.resizeBuffer=function(r){var f=this,a=A({},y,r);return this.init().then(function(){return f.__mathlib.resizeAndUnsharp(a)})},R.prototype.toBlob=function(r,f,a){return f=f||"image/png",new Promise(function(p){if(r.toBlob){r.toBlob(function(U){return p(U)},f,a);return}if(r.convertToBlob){p(r.convertToBlob({type:f,quality:a}));return}for(var g=atob(r.toDataURL(f,a).split(",")[1]),x=g.length,b=new Uint8Array(x),j=0;j