From 08e2c54c279dd8ab23819e31c86b82ffa542ece3 Mon Sep 17 00:00:00 2001 From: Spaaaacccee Date: Wed, 20 Mar 2024 05:01:07 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20path-vis?= =?UTF-8?q?ualiser/app@4888711b06a583c852b46a9d53a1238f117e51d0=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/{index-455c938f.js => index-33801a99.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-455c938f.js => index-33801a99.js} (99%) diff --git a/assets/index-455c938f.js b/assets/index-33801a99.js similarity index 99% rename from assets/index-455c938f.js rename to assets/index-33801a99.js index 69677e97..2e847524 100644 --- a/assets/index-455c938f.js +++ b/assets/index-33801a99.js @@ -603,7 +603,7 @@ Use Save As... to download, then click back to return to this page.`)&&(location `+Sn.split(` `).map(function(On){return" "+On}).join(` `)):Sn=Cn.stylize("[Circular]","special")),un(ar)){if(nr&&Zn.match(/^\d+$/))return Sn;(ar=JSON.stringify(""+Zn)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(ar=ar.substr(1,ar.length-2),ar=Cn.stylize(ar,"name")):(ar=ar.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),ar=Cn.stylize(ar,"string"))}return ar+": "+Sn}function sn(Cn){return Array.isArray(Cn)}function ln(Cn){return typeof Cn=="boolean"}function dn(Cn){return Cn===null}function mn(Cn){return typeof Cn=="number"}function gn(Cn){return typeof Cn=="string"}function un(Cn){return Cn===void 0}function hn(Cn){return bn(Cn)&&$n(Cn)==="[object RegExp]"}function bn(Cn){return typeof Cn=="object"&&Cn!==null}function En(Cn){return bn(Cn)&&$n(Cn)==="[object Date]"}function _n(Cn){return bn(Cn)&&($n(Cn)==="[object Error]"||Cn instanceof Error)}function Tn(Cn){return typeof Cn=="function"}function $n(Cn){return Object.prototype.toString.call(Cn)}function pn(Cn){return Cn<10?"0"+Cn.toString(10):Cn.toString(10)}Ut.debuglog=function(Cn){if(Cn=Cn.toUpperCase(),!Yt[Cn])if(Xt.test(Cn)){var Gn=Gt.pid;Yt[Cn]=function(){var In=Ut.format.apply(Ut,arguments);console.error("%s %d: %s",Cn,Gn,In)}}else Yt[Cn]=function(){};return Yt[Cn]},Ut.inspect=Qt,Qt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Qt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},Ut.types=Nt("./support/types"),Ut.isArray=sn,Ut.isBoolean=ln,Ut.isNull=dn,Ut.isNullOrUndefined=function(Cn){return Cn==null},Ut.isNumber=mn,Ut.isString=gn,Ut.isSymbol=function(Cn){return typeof Cn=="symbol"},Ut.isUndefined=un,Ut.isRegExp=hn,Ut.types.isRegExp=hn,Ut.isObject=bn,Ut.isDate=En,Ut.types.isDate=En,Ut.isError=_n,Ut.types.isNativeError=_n,Ut.isFunction=Tn,Ut.isPrimitive=function(Cn){return Cn===null||typeof Cn=="boolean"||typeof Cn=="number"||typeof Cn=="string"||typeof Cn=="symbol"||Cn===void 0},Ut.isBuffer=Nt("./support/isBuffer");var Nn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function An(Cn,Gn){return Object.prototype.hasOwnProperty.call(Cn,Gn)}Ut.log=function(){var Cn,Gn;console.log("%s - %s",(Cn=new Date,Gn=[pn(Cn.getHours()),pn(Cn.getMinutes()),pn(Cn.getSeconds())].join(":"),[Cn.getDate(),Nn[Cn.getMonth()],Gn].join(" ")),Ut.format.apply(Ut,arguments))},Ut.inherits=Nt("inherits"),Ut._extend=function(Cn,Gn){if(!Gn||!bn(Gn))return Cn;for(var In=Object.keys(Gn),Bn=In.length;Bn--;)Cn[In[Bn]]=Gn[In[Bn]];return Cn};var Dn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Pn(Cn,Gn){if(!Cn){var In=new Error("Promise was rejected with a falsy value");In.reason=Cn,Cn=In}return Gn(Cn)}Ut.promisify=function(Cn){if(typeof Cn!="function")throw new TypeError('The "original" argument must be of type Function');if(Dn&&Cn[Dn]){var Gn;if(typeof(Gn=Cn[Dn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Gn,Dn,{value:Gn,enumerable:!1,writable:!1,configurable:!0}),Gn}function Gn(){for(var In,Bn,Zn=new Promise(function(Sn,Rn){In=Sn,Bn=Rn}),nr=[],ar=0;ar{var Pt=_e.exports={};Pt.nextTick=function(){var Dt=typeof window<"u"&&window.setImmediate,Nt=typeof window<"u"&&window.postMessage&&window.addEventListener;if(Dt)return function(Ut){return window.setImmediate(Ut)};if(Nt){var jt=[];return window.addEventListener("message",function(Ut){var Gt=Ut.source;Gt!==window&&Gt!==null||Ut.data!=="process-tick"||(Ut.stopPropagation(),jt.length>0&&jt.shift()())},!0),function(Ut){jt.push(Ut),window.postMessage("process-tick","*")}}return function(Ut){setTimeout(Ut,0)}}(),Pt.title="browser",Pt.browser=!0,Pt.env={},Pt.argv=[],Pt.binding=function(Dt){throw new Error("process.binding is not supported")},Pt.cwd=function(){return"/"},Pt.chdir=function(Dt){throw new Error("process.chdir is not supported")}},6197:(_e,Pt,Dt)=>{var Nt=Dt(8834).lW;Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.AbstractTokenizer=void 0;const jt=Dt(4644);Pt.AbstractTokenizer=class{constructor(Ut){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=Ut||{}}async readToken(Ut,Gt=this.position){const Wt=Nt.alloc(Ut.len);if(await this.readBuffer(Wt,{position:Gt})Gt)return this.position+=Gt,Gt}return this.position+=Ut,Ut}async close(){}normalizeOptions(Ut,Gt){if(Gt&&Gt.position!==void 0&&Gt.position{Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.BufferTokenizer=void 0;const Nt=Dt(4644),jt=Dt(6197);class Ut extends jt.AbstractTokenizer{constructor(Wt,qt){super(qt),this.uint8Array=Wt,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:Wt.length}async readBuffer(Wt,qt){if(qt&&qt.position){if(qt.position{Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.fromFile=Pt.FileTokenizer=void 0;const Nt=Dt(6197),jt=Dt(4644),Ut=Dt(5187);class Gt extends Nt.AbstractTokenizer{constructor(qt,Yt){super(Yt),this.fd=qt}async readBuffer(qt,Yt){const Xt=this.normalizeOptions(qt,Yt);this.position=Xt.position;const Zt=await Ut.read(this.fd,qt,Xt.offset,Xt.length,Xt.position);if(this.position+=Zt.bytesRead,Zt.bytesRead{Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.readFile=Pt.writeFileSync=Pt.writeFile=Pt.read=Pt.open=Pt.close=Pt.stat=Pt.createReadStream=Pt.pathExists=void 0;const Nt=Dt(6777);Pt.pathExists=Nt.existsSync,Pt.createReadStream=Nt.createReadStream,Pt.stat=async function(jt){return new Promise((Ut,Gt)=>{Nt.stat(jt,(Wt,qt)=>{Wt?Gt(Wt):Ut(qt)})})},Pt.close=async function(jt){return new Promise((Ut,Gt)=>{Nt.close(jt,Wt=>{Wt?Gt(Wt):Ut()})})},Pt.open=async function(jt,Ut){return new Promise((Gt,Wt)=>{Nt.open(jt,Ut,(qt,Yt)=>{qt?Wt(qt):Gt(Yt)})})},Pt.read=async function(jt,Ut,Gt,Wt,qt){return new Promise((Yt,Xt)=>{Nt.read(jt,Ut,Gt,Wt,qt,(Zt,Qt,en)=>{Zt?Xt(Zt):Yt({bytesRead:Qt,buffer:en})})})},Pt.writeFile=async function(jt,Ut){return new Promise((Gt,Wt)=>{Nt.writeFile(jt,Ut,qt=>{qt?Wt(qt):Gt()})})},Pt.writeFileSync=function(jt,Ut){Nt.writeFileSync(jt,Ut)},Pt.readFile=async function(jt){return new Promise((Ut,Gt)=>{Nt.readFile(jt,(Wt,qt)=>{Wt?Gt(Wt):Ut(qt)})})}},8286:(_e,Pt,Dt)=>{Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.ReadStreamTokenizer=void 0;const Nt=Dt(6197),jt=Dt(4644);class Ut extends Nt.AbstractTokenizer{constructor(Wt,qt){super(qt),this.streamReader=new jt.StreamReader(Wt)}async getFileInfo(){return this.fileInfo}async readBuffer(Wt,qt){const Yt=this.normalizeOptions(Wt,qt),Xt=Yt.position-this.position;if(Xt>0)return await this.ignore(Xt),this.readBuffer(Wt,qt);if(Xt<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(Yt.length===0)return 0;const Zt=await this.streamReader.read(Wt,Yt.offset,Yt.length);if(this.position+=Zt,(!qt||!qt.mayBeLess)&&Zt0){const Qt=new Uint8Array(Yt.length+Zt);return Xt=await this.peekBuffer(Qt,{mayBeLess:Yt.mayBeLess}),Wt.set(Qt.subarray(Zt),Yt.offset),Xt-Zt}if(Zt<0)throw new Error("Cannot peek from a negative offset in a stream")}if(Yt.length>0){try{Xt=await this.streamReader.peek(Wt,Yt.offset,Yt.length)}catch(Zt){if(qt&&qt.mayBeLess&&Zt instanceof jt.EndOfStreamError)return 0;throw Zt}if(!Yt.mayBeLess&&Xt{Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.fromBuffer=Pt.fromStream=Pt.EndOfStreamError=void 0;const Nt=Dt(8286),jt=Dt(932);var Ut=Dt(4644);Object.defineProperty(Pt,"EndOfStreamError",{enumerable:!0,get:function(){return Ut.EndOfStreamError}}),Pt.fromStream=function(Gt,Wt){return Wt=Wt||{},new Nt.ReadStreamTokenizer(Gt,Wt)},Pt.fromBuffer=function(Gt,Wt){return new jt.BufferTokenizer(Gt,Wt)}},3569:(_e,Pt,Dt)=>{Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.fromStream=Pt.fromBuffer=Pt.EndOfStreamError=Pt.fromFile=void 0;const Nt=Dt(5187),jt=Dt(7378);var Ut=Dt(9425);Object.defineProperty(Pt,"fromFile",{enumerable:!0,get:function(){return Ut.fromFile}});var Gt=Dt(7378);Object.defineProperty(Pt,"EndOfStreamError",{enumerable:!0,get:function(){return Gt.EndOfStreamError}}),Object.defineProperty(Pt,"fromBuffer",{enumerable:!0,get:function(){return Gt.fromBuffer}}),Pt.fromStream=async function(Wt,qt){if(qt=qt||{},Wt.path){const Yt=await Nt.stat(Wt.path);qt.path=Wt.path,qt.size=Yt.size}return jt.fromStream(Wt,qt)}},643:(_e,Pt)=>{var Dt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Yt){return typeof Yt}:function(Yt){return Yt&&typeof Symbol=="function"&&Yt.constructor===Symbol&&Yt!==Symbol.prototype?"symbol":typeof Yt};Pt.Ee=function(Yt,Xt,Zt,Qt,en,tn){for(var nn=arguments.length,rn=Array(nn>6?nn-6:0),an=6;an3?tn-3:0),rn=3;rn{var Nt=Dt(8834).lW;Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.AnsiStringType=Pt.StringType=Pt.BufferType=Pt.Uint8ArrayType=Pt.IgnoreType=Pt.Float80_LE=Pt.Float80_BE=Pt.Float64_LE=Pt.Float64_BE=Pt.Float32_LE=Pt.Float32_BE=Pt.Float16_LE=Pt.Float16_BE=Pt.INT64_BE=Pt.UINT64_BE=Pt.INT64_LE=Pt.UINT64_LE=Pt.INT32_LE=Pt.INT32_BE=Pt.INT24_BE=Pt.INT24_LE=Pt.INT16_LE=Pt.INT16_BE=Pt.INT8=Pt.UINT32_BE=Pt.UINT32_LE=Pt.UINT24_BE=Pt.UINT24_LE=Pt.UINT16_BE=Pt.UINT16_LE=Pt.UINT8=void 0;const jt=Dt(2333);function Ut(Wt){return new DataView(Wt.buffer,Wt.byteOffset)}Pt.UINT8={len:1,get:(Wt,qt)=>Ut(Wt).getUint8(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setUint8(qt,Yt),qt+1)},Pt.UINT16_LE={len:2,get:(Wt,qt)=>Ut(Wt).getUint16(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setUint16(qt,Yt,!0),qt+2)},Pt.UINT16_BE={len:2,get:(Wt,qt)=>Ut(Wt).getUint16(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setUint16(qt,Yt),qt+2)},Pt.UINT24_LE={len:3,get(Wt,qt){const Yt=Ut(Wt);return Yt.getUint8(qt)+(Yt.getUint16(qt+1,!0)<<8)},put(Wt,qt,Yt){const Xt=Ut(Wt);return Xt.setUint8(qt,255&Yt),Xt.setUint16(qt+1,Yt>>8,!0),qt+3}},Pt.UINT24_BE={len:3,get(Wt,qt){const Yt=Ut(Wt);return(Yt.getUint16(qt)<<8)+Yt.getUint8(qt+2)},put(Wt,qt,Yt){const Xt=Ut(Wt);return Xt.setUint16(qt,Yt>>8),Xt.setUint8(qt+2,255&Yt),qt+3}},Pt.UINT32_LE={len:4,get:(Wt,qt)=>Ut(Wt).getUint32(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setUint32(qt,Yt,!0),qt+4)},Pt.UINT32_BE={len:4,get:(Wt,qt)=>Ut(Wt).getUint32(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setUint32(qt,Yt),qt+4)},Pt.INT8={len:1,get:(Wt,qt)=>Ut(Wt).getInt8(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setInt8(qt,Yt),qt+1)},Pt.INT16_BE={len:2,get:(Wt,qt)=>Ut(Wt).getInt16(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setInt16(qt,Yt),qt+2)},Pt.INT16_LE={len:2,get:(Wt,qt)=>Ut(Wt).getInt16(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setInt16(qt,Yt,!0),qt+2)},Pt.INT24_LE={len:3,get(Wt,qt){const Yt=Pt.UINT24_LE.get(Wt,qt);return Yt>8388607?Yt-16777216:Yt},put(Wt,qt,Yt){const Xt=Ut(Wt);return Xt.setUint8(qt,255&Yt),Xt.setUint16(qt+1,Yt>>8,!0),qt+3}},Pt.INT24_BE={len:3,get(Wt,qt){const Yt=Pt.UINT24_BE.get(Wt,qt);return Yt>8388607?Yt-16777216:Yt},put(Wt,qt,Yt){const Xt=Ut(Wt);return Xt.setUint16(qt,Yt>>8),Xt.setUint8(qt+2,255&Yt),qt+3}},Pt.INT32_BE={len:4,get:(Wt,qt)=>Ut(Wt).getInt32(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setInt32(qt,Yt),qt+4)},Pt.INT32_LE={len:4,get:(Wt,qt)=>Ut(Wt).getInt32(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setInt32(qt,Yt,!0),qt+4)},Pt.UINT64_LE={len:8,get:(Wt,qt)=>Ut(Wt).getBigUint64(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setBigUint64(qt,Yt,!0),qt+8)},Pt.INT64_LE={len:8,get:(Wt,qt)=>Ut(Wt).getBigInt64(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setBigInt64(qt,Yt,!0),qt+8)},Pt.UINT64_BE={len:8,get:(Wt,qt)=>Ut(Wt).getBigUint64(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setBigUint64(qt,Yt),qt+8)},Pt.INT64_BE={len:8,get:(Wt,qt)=>Ut(Wt).getBigInt64(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setBigInt64(qt,Yt),qt+8)},Pt.Float16_BE={len:2,get(Wt,qt){return jt.read(Wt,qt,!1,10,this.len)},put(Wt,qt,Yt){return jt.write(Wt,Yt,qt,!1,10,this.len),qt+this.len}},Pt.Float16_LE={len:2,get(Wt,qt){return jt.read(Wt,qt,!0,10,this.len)},put(Wt,qt,Yt){return jt.write(Wt,Yt,qt,!0,10,this.len),qt+this.len}},Pt.Float32_BE={len:4,get:(Wt,qt)=>Ut(Wt).getFloat32(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setFloat32(qt,Yt),qt+4)},Pt.Float32_LE={len:4,get:(Wt,qt)=>Ut(Wt).getFloat32(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setFloat32(qt,Yt,!0),qt+4)},Pt.Float64_BE={len:8,get:(Wt,qt)=>Ut(Wt).getFloat64(qt),put:(Wt,qt,Yt)=>(Ut(Wt).setFloat64(qt,Yt),qt+8)},Pt.Float64_LE={len:8,get:(Wt,qt)=>Ut(Wt).getFloat64(qt,!0),put:(Wt,qt,Yt)=>(Ut(Wt).setFloat64(qt,Yt,!0),qt+8)},Pt.Float80_BE={len:10,get(Wt,qt){return jt.read(Wt,qt,!1,63,this.len)},put(Wt,qt,Yt){return jt.write(Wt,Yt,qt,!1,63,this.len),qt+this.len}},Pt.Float80_LE={len:10,get(Wt,qt){return jt.read(Wt,qt,!0,63,this.len)},put(Wt,qt,Yt){return jt.write(Wt,Yt,qt,!0,63,this.len),qt+this.len}},Pt.IgnoreType=class{constructor(Wt){this.len=Wt}get(Wt,qt){}},Pt.Uint8ArrayType=class{constructor(Wt){this.len=Wt}get(Wt,qt){return Wt.subarray(qt,qt+this.len)}},Pt.BufferType=class{constructor(Wt){this.len=Wt}get(Wt,qt){return Nt.from(Wt.subarray(qt,qt+this.len))}},Pt.StringType=class{constructor(Wt,qt){this.len=Wt,this.encoding=qt}get(Wt,qt){return Nt.from(Wt).toString(this.encoding,qt,qt+this.len)}};class Gt{constructor(qt){this.len=qt}static decode(qt,Yt,Xt){let Zt="";for(let Qt=Yt;Qt>10),56320+(1023&qt)))}static singleByteDecoder(qt){if(Gt.inRange(qt,0,127))return qt;const Yt=Gt.windows1252[qt-128];if(Yt===null)throw Error("invaliding encoding");return Yt}get(qt,Yt=0){return Gt.decode(qt,Yt,Yt+this.len)}}Pt.AnsiStringType=Gt,Gt.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},311:(_e,Pt)=>{(Pt=_e.exports=function(Dt){return Dt.replace(/^\s*|\s*$/g,"")}).left=function(Dt){return Dt.replace(/^\s*/,"")},Pt.right=function(Dt){return Dt.replace(/\s*$/,"")}},9299:(_e,Pt,Dt)=>{var Nt=Dt(4406);(function(){var jt={};function Ut(){Nt===void 0&&console.log.apply(console,arguments)}_e.exports=jt,function(Gt,Wt){var qt,Yt,Xt,Zt,Qt,en,tn,nn,rn,an,sn,ln,dn,mn,gn;(function(){var un=function(){function En(_n){this.message="JPEG error: "+_n}return En.prototype=new Error,En.prototype.name="JpegError",En.constructor=En,En}(),hn=function(){var En=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),_n=4017,Tn=799,$n=3406,pn=2276,Nn=1567,An=3784,Dn=5793,Pn=2896;function Cn(Sn){Sn==null&&(Sn={}),Sn.w==null&&(Sn.w=-1),this.V=Sn.n,this.N=Sn.w}function Gn(Sn,Rn){for(var On,Vn,yn,vn=0,wn=[],Un=16;Un>0&&!Sn[Un-1];)Un--;wn.push({children:[],index:0});var Kn=wn[0];for(On=0;On0;)Kn=wn.pop();for(Kn.index++,wn.push(Kn);wn.length<=On;)wn.push(yn={children:[],index:0}),Kn.children[Kn.index]=yn.children,Kn=yn;vn++}On+10)return mr--,ir>>mr&1;if((ir=Sn[Rn++])===255){var Lr=Sn[Rn++];if(Lr){if(Lr===220&&kn){var lo=bn(Sn,Rn+=2);if(Rn+=2,lo>0&&lo!==On.s)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",lo)}else if(Lr===217){if(kn){var uo=8*Wn;if(uo>0&&uo>>7}function ur(Lr){for(var lo=Lr;;){switch(typeof(lo=lo[Xn()])){case"number":return lo;case"object":continue}throw new un("invalid huffman sequence")}}function Wr(Lr){for(var lo=0;Lr>0;)lo=lo<<1|Xn(),Lr--;return lo}function Or(Lr){if(Lr===1)return Xn()===1?1:-1;var lo=Wr(Lr);return lo>=1<0)kr--;else for(var uo=vn,ao=wn;uo<=ao;){var Ro=ur(Lr.i),Xo=15&Ro,Ao=Ro>>4;if(Xo!==0){var ho=En[uo+=Ao];Lr.D[lo+ho]=Or(Xo)*(1<>4,(uo=15&ao)==0)Ao<15?(kr=Wr(Ao)+(1<>4;if(Ao!==0){var qo=En[Ro+=ho];Lr.D[lo+qo]=Or(Ao),Ro++}else{if(ho<15)break;Ro+=16}}},hr=no===1?Vn[0].P*Vn[0].c:qn*On.R;vr<=hr;){var Hr=yn?Math.min(hr-vr,yn):hr;if(Hr>0){for(Jn=0;Jn=65488&&sr.M<=65495)))break;Rn+=2}return Rn-jn}function Zn(Sn,Rn,On){var Vn,yn,vn,wn,Un,Kn,kn,tr,or,Jn,gr,Er,Sr,Rr,sr,hr,Tr,Mr=Sn.$,qn=Sn.D;if(!Mr)throw new un("missing required Quantization Table.");for(var Ln=0;Ln<64;Ln+=8)or=qn[Rn+Ln],Jn=qn[Rn+Ln+1],gr=qn[Rn+Ln+2],Er=qn[Rn+Ln+3],Sr=qn[Rn+Ln+4],Rr=qn[Rn+Ln+5],sr=qn[Rn+Ln+6],hr=qn[Rn+Ln+7],or*=Mr[Ln],Jn|gr|Er|Sr|Rr|sr|hr?(Jn*=Mr[Ln+1],gr*=Mr[Ln+2],Er*=Mr[Ln+3],Sr*=Mr[Ln+4],Rr*=Mr[Ln+5],sr*=Mr[Ln+6],hr*=Mr[Ln+7],yn=(Vn=(Vn=Dn*or+128>>8)+(yn=Dn*Sr+128>>8)+1>>1)-yn,Tr=(vn=gr)*An+(wn=sr)*Nn+128>>8,vn=vn*Nn-wn*An+128>>8,kn=(Un=(Un=Pn*(Jn-hr)+128>>8)+(kn=Rr<<4)+1>>1)-kn,Kn=(tr=(tr=Pn*(Jn+hr)+128>>8)+(Kn=Er<<4)+1>>1)-Kn,wn=(Vn=Vn+(wn=Tr)+1>>1)-wn,vn=(yn=yn+vn+1>>1)-vn,Tr=Un*pn+tr*$n+2048>>12,Un=Un*$n-tr*pn+2048>>12,tr=Tr,Tr=Kn*Tn+kn*_n+2048>>12,Kn=Kn*_n-kn*Tn+2048>>12,kn=Tr,On[Ln]=Vn+tr,On[Ln+7]=Vn-tr,On[Ln+1]=yn+kn,On[Ln+6]=yn-kn,On[Ln+2]=vn+Kn,On[Ln+5]=vn-Kn,On[Ln+3]=wn+Un,On[Ln+4]=wn-Un):(Tr=Dn*or+512>>10,On[Ln]=Tr,On[Ln+1]=Tr,On[Ln+2]=Tr,On[Ln+3]=Tr,On[Ln+4]=Tr,On[Ln+5]=Tr,On[Ln+6]=Tr,On[Ln+7]=Tr);for(var jn=0;jn<8;++jn)or=On[jn],(Jn=On[jn+8])|(gr=On[jn+16])|(Er=On[jn+24])|(Sr=On[jn+32])|(Rr=On[jn+40])|(sr=On[jn+48])|(hr=On[jn+56])?(yn=(Vn=4112+((Vn=Dn*or+2048>>12)+(yn=Dn*Sr+2048>>12)+1>>1))-yn,Tr=(vn=gr)*An+(wn=sr)*Nn+2048>>12,vn=vn*Nn-wn*An+2048>>12,wn=Tr,kn=(Un=(Un=Pn*(Jn-hr)+2048>>12)+(kn=Rr)+1>>1)-kn,Kn=(tr=(tr=Pn*(Jn+hr)+2048>>12)+(Kn=Er)+1>>1)-Kn,Tr=Un*pn+tr*$n+2048>>12,Un=Un*$n-tr*pn+2048>>12,tr=Tr,Tr=Kn*Tn+kn*_n+2048>>12,Kn=Kn*_n-kn*Tn+2048>>12,(or=(Vn=Vn+wn+1>>1)+tr)<16?or=0:or>=4080?or=255:or>>=4,(Jn=(yn=yn+vn+1>>1)+(kn=Tr))<16?Jn=0:Jn>=4080?Jn=255:Jn>>=4,(gr=(vn=yn-vn)+Kn)<16?gr=0:gr>=4080?gr=255:gr>>=4,(Er=(wn=Vn-wn)+Un)<16?Er=0:Er>=4080?Er=255:Er>>=4,(Sr=wn-Un)<16?Sr=0:Sr>=4080?Sr=255:Sr>>=4,(Rr=vn-Kn)<16?Rr=0:Rr>=4080?Rr=255:Rr>>=4,(sr=yn-kn)<16?sr=0:sr>=4080?sr=255:sr>>=4,(hr=Vn-tr)<16?hr=0:hr>=4080?hr=255:hr>>=4,qn[Rn+jn]=or,qn[Rn+jn+8]=Jn,qn[Rn+jn+16]=gr,qn[Rn+jn+24]=Er,qn[Rn+jn+32]=Sr,qn[Rn+jn+40]=Rr,qn[Rn+jn+48]=sr,qn[Rn+jn+56]=hr):(Tr=(Tr=Dn*or+8192>>14)<-2040?0:Tr>=2024?255:Tr+2056>>4,qn[Rn+jn]=Tr,qn[Rn+jn+8]=Tr,qn[Rn+jn+16]=Tr,qn[Rn+jn+24]=Tr,qn[Rn+jn+32]=Tr,qn[Rn+jn+40]=Tr,qn[Rn+jn+48]=Tr,qn[Rn+jn+56]=Tr)}function nr(Sn,Rn){for(var On=Rn.P,Vn=Rn.c,yn=new Int16Array(64),vn=0;vn=Vn)return null;var vn=bn(Sn,Rn);if(vn>=65472&&vn<=65534)return{u:null,M:vn,offset:Rn};for(var wn=bn(Sn,yn);!(wn>=65472&&wn<=65534);){if(++yn>=Vn)return null;wn=bn(Sn,yn)}return{u:vn.toString(16),M:wn,offset:yn}}return Cn.prototype={parse(Sn,Rn){Rn==null&&(Rn={});var On,Vn,yn=Rn.F,vn=0,wn=null,Un=null,Kn=0;function kn(){var Jo=bn(Sn,vn),as=(vn+=2)+Jo-2,Ko=ar(Sn,as,vn);Ko&&Ko.u&&(as=Ko.offset);var Qo=Sn.subarray(vn,as);return vn+=Qo.length,Qo}function tr(Jo){for(var as=Math.ceil(Jo.o/8/Jo.X),Ko=Math.ceil(Jo.s/8/Jo.B),Qo=0;Qo>4){if(Mr>>4!=1)throw new un("DQT - invalid table spec");for(Rr=0;Rr<64;Rr++)qn[En[Rr]]=bn(Sn,vn),vn+=2}else for(Rr=0;Rr<64;Rr++)qn[En[Rr]]=Sn[vn++];or[15&Mr]=qn}break;case 65472:case 65473:case 65474:if(On)throw new un("Only single frame JPEGs supported");vn+=2,(On={}).G=Er===65473,On.Z=Er===65474,On.precision=Sn[vn++];var Ln,jn=bn(Sn,vn),ir=0,mr=0;vn+=2,On.s=yn||jn,On.o=bn(Sn,vn),vn+=2,On.W=[],On._={};var kr=Sn[vn++];for(Sr=0;Sr>4,Wn=15&Sn[vn+1];ir>4?Jn:gr)[15&ur]=Gn(Wr,to)}break;case 65501:Vn=bn(Sn,vn+=2),vn+=2;break;case 65498:var Gr,no=++Kn==1&&!yn;vn+=2;var Hr=Sn[vn++],Lr=[];for(Sr=0;Sr>4],Gr.i=Jn[15&ao],Lr.push(Gr)}var Ro=Sn[vn++],Xo=Sn[vn++],Ao=Sn[vn++];try{var ho=Bn(Sn,vn,On,Lr,Vn,Ro,Xo,Ao>>4,15&Ao,no);vn+=ho}catch(Jo){if(Jo instanceof DNLMarkerError)return this.parse(Sn,{F:Jo.s});if(Jo instanceof EOIMarkerError)break e;throw Jo}break;case 65500:vn+=4;break;case 65535:Sn[vn]!==255&&vn--;break;default:var qo=ar(Sn,vn-2,vn-3);if(qo&&qo.u){vn=qo.offset;break}if(vn>=Sn.length-1)break e;throw new un("JpegImage.parse - unknown marker: "+Er.toString(16))}Er=bn(Sn,vn),vn+=2}for(this.width=On.o,this.height=On.s,this.g=wn,this.b=Un,this.W=[],Sr=0;Sr>8)+jn[or+1];return Mr},get f(){return this.b?!!this.b.a:this.p===3?this.N!==0&&(this.W[0].index!==82||this.W[1].index!==71||this.W[2].index!==66):this.N===1},z:function(Sn){for(var Rn,On,Vn,yn=0,vn=Sn.length;yn4)throw new un("Unsupported color mode");var vn=this.Y(Rn,On,yn);if(this.p===1&&Vn){for(var wn=vn.length,Un=new Uint8ClampedArray(3*wn),Kn=0,kn=0;kn3&&(hn.t258=hn.t258.slice(0,3)),Tn=hn.t258?Math.min(32,hn.t258[0])*hn.t258.length:hn.t277?hn.t277[0]:1,$n==1&&hn.t279!=null&&hn.t278&&hn.t262[0]==32803&&(Tn=Math.round(8*hn.t279[0]/(hn.width*hn.t278[0]))),hn.t50885&&hn.t50885[0]==4&&(Tn=3*hn.t258[0]);var Nn=8*Math.ceil(hn.width*Tn/8),An=hn.t273;(An==null||hn.t322)&&(An=hn.t324);var Dn=hn.t279;$n==1&&An.length==1&&(Dn=[hn.height*(Nn>>>3)]),(Dn==null||hn.t322)&&(Dn=hn.t325);var Pn=new Uint8Array(hn.height*(Nn>>>3)),Cn=0;if(hn.t322!=null){var Gn=hn.t322[0],In=hn.t323[0],Bn=Math.floor((hn.width+Gn-1)/Gn),Zn=Math.floor((hn.height+In-1)/In),nr=new Uint8Array(0|Math.ceil(Gn*In*Tn/8));console.log("====",Bn,Zn);for(var ar=0;ar>>3,Zn=un.t278?un.t278[0]:un.height,nr=Math.ceil(Gn*In*un.width/8);if(Gn==16&&!un.isLE&&un.t33422==null)for(var ar=0;ar>>8&255}else if(In==3)for(An=3;An>>3]>>>7-(7&In)&1;return Gn[1]++,Bn}function $n(Gn,In){if(un==null){un={};for(var Bn=0;Bn>>=1;return Gn}function Nn(Gn,In){return Gn>>In}function An(Gn,In,Bn,Zn,nr,ar){In[Bn]=Nn(Nn(11*Gn[nr]-4*Gn[nr+ar]+Gn[nr+ar+ar]+4,3)+Gn[Zn],1),In[Bn+ar]=Nn(Nn(5*Gn[nr]+4*Gn[nr+ar]-Gn[nr+ar+ar]+4,3)-Gn[Zn],1)}function Dn(Gn,In,Bn,Zn,nr,ar){var Sn=Gn[nr-ar]-Gn[nr+ar],Rn=Gn[nr],On=Gn[Zn];In[Bn]=Nn(Nn(Sn+4,3)+Rn+On,1),In[Bn+ar]=Nn(Nn(4-Sn,3)+Rn-On,1)}function Pn(Gn,In,Bn,Zn,nr,ar){In[Bn]=Nn(Nn(5*Gn[nr]+4*Gn[nr-ar]-Gn[nr-ar-ar]+4,3)+Gn[Zn],1),In[Bn+ar]=Nn(Nn(11*Gn[nr]-4*Gn[nr-ar]+Gn[nr-ar-ar]+4,3)-Gn[Zn],1)}function Cn(Gn){return bn[Gn=Gn<0?0:Gn>4095?4095:Gn]>>>2}return function(Gn,In,Bn,Zn,nr){Zn=new Uint16Array(Zn.buffer);var ar,Sn,Rn,On,Vn,yn,vn,wn,Un=Date.now(),Kn=Gt._binBE,kn=In+Bn;for(In+=4;In>>1)*(Sn>>>1));for(wn=new Int16Array((ar>>>1)*(Sn>>>1)),hn=new Int16Array(1024),Sr=0;Sr<1024;Sr++){var Rr=Sr-512,sr=Math.abs(Rr),hr=Math.floor(768*sr*sr*sr/16581375)+sr;hn[Sr]=Math.sign(Rr)*hr}for(bn=new Uint16Array(4096),Sr=0;Sr<4096;Sr++){var Tr=Sr,Mr=65535*(Math.pow(113,Tr/4095)-1)/112;bn[Sr]=Math.min(Mr,65535)}}var qn=vn[Vn],Ln=pn(ar,1+_n[Rn]),jn=pn(Sn,1+_n[Rn]);if(Rn==0)for(var ir=0;ir>>1)+mr]=Gn[kr]<<8|Gn[kr+1]}else{var Cr=[Gn,8*In],Wn=[],vr=0,Xn=Ln*jn,ur=[0,0],Wr=0;for(or=0;vr0;)Wn[vr++]=or,Wr--;var Or=(Rn-1)%3,to=Or!=1?Ln:0,Gr=Or!=0?jn:0;for(ir=0;ir>>1)+to,Hr=ir*Ln;for(mr=0;mr>>1,lo=2*Ln,uo=2*jn;for(ir=0;ir>14-2*qo&3;var xa=Ao[ho];if(xa!=0)for(ir=0;ir>>1)*(ar>>>1)+(mr>>>1)],Wo=as[kr]-2048,ss=Ko[kr]-2048,$a=Qo[kr]-2048,vs=(Wo<<1)+Go,ks=(ss<<1)+Go,Ss=Go+$a,Is=Go-$a;Zn[hs]=Cn(vs),Zn[hs+1]=Cn(Ss),Zn[hs+ar]=Cn(Is),Zn[hs+ar+1]=Cn(ks)}}In+=4*Er}else if(Jn==16388)In+=4*Er;else if(gr!=8192&&gr!=8448&&gr!=9216)throw Jn.toString(16)}}}}}}}}}console.log(Date.now()-Un)}}(),Gt.decode._decodeLogLuv32=function(un,hn,bn,En,_n,Tn){for(var $n=un.width,pn=4*$n,Nn=0,An=new Uint8Array(pn);Nn>>11,Gn=15&Dn>>>22,In=15&Dn>>>26,Bn=0;Bn<4&&128<>3))>>>(7&Zn)&127)<2047&&(ar[On]=2047),Zn+=7);for(On=0;On<16;On++,Un+=2)Rr=ar[On]<<1,Gt.decode._putsF(_n,(Kn*$n+Un)*Nn,Rr<<16-Nn);Un-=1&Un?1:31}}}else for(var On=0;On>>4,_n[Tn+On+1]=Vn<<4|vn>>>4,_n[Tn+On+2]=vn<<4|yn>>>4}else{pn+=8;var wn,Un,Kn,kn=[bn,0,0,0],tr=new Uint16Array(32770),or=[3857,3856,3599,3342,3085,2828,2571,2314,2057,1800,1543,1286,1029,772,771,768,514,513],Jn=0,gr=Gt.decode._ljpeg_diff;for(tr[0]=15,wn=On=0;On<18;On++)for(var Er=32768>>>(or[On]>>>8),Sr=0;Sr1&&(or=Math.floor(tr/(Jn-1))),ar==68&&Sn==32&&or>0&&(Cn=On.readShort(Zn,562));var gr=[0,0],Er=Gn(pn[Pn]),Sr=[En,0,0,0];for(vn=0;vn>>4),0)<<1)<>>1)&1<>>3;un[En]|=bn>>>16,un[En+1]|=bn>>>8,un[En+2]|=bn},Gt.decode._getbithuff=function(un,hn,bn,En){Gt.decode._get_byte;var _n,Tn=hn[0],$n=hn[1],pn=hn[2],Nn=hn[3];if(bn==0||pn<0)return 0;for(;!Nn&&pn>>32-bn,En?(pn-=En[_n+1]>>>8,_n=255&En[_n+1]):pn-=bn,pn<0)throw"e";return hn[0]=Tn,hn[1]=$n,hn[2]=pn,hn[3]=Nn,_n},Gt.decode._make_decoder=function(un){var hn,bn,En,_n,Tn,$n=[];for(hn=16;hn!=0&&!un[hn];hn--);var pn=17;for($n[0]=hn,En=bn=1;bn<=hn;bn++)for(_n=0;_n>>8;else for(Dn=0;Dn>>8,_n[Tn+(Dn<<1)+1]=255&In[Dn];else if(Gn==14||Gn==12){var Zn=16-Gn;for(Dn=0;Dn1),!Cn){if(hn[bn]==255&&hn[bn+1]==An)return{jpegOffset:bn};if(Gn!=null&&(hn[bn+In]==255&&hn[bn+In+1]==An?Dn=bn+In:Ut("JPEGInterchangeFormat does not point to SOI"),Bn==null?Ut("JPEGInterchangeFormatLength field is missing"):(In>=Pn||In+Zn<=Pn)&&Ut("JPEGInterchangeFormatLength field value is invalid"),Dn!=null))return{jpegOffset:Dn}}if(ar!=null&&(Sn=ar[0],Rn=ar[1]),Gn!=null&&Bn!=null)if(Zn>=2&&In+Zn<=Pn){for(_n=hn[bn+In+Zn-2]==255&&hn[bn+In+Zn-1]==An?new Uint8Array(Zn-2):new Uint8Array(Zn),$n=0;$n<_n.length;$n++)_n[$n]=hn[bn+In+$n];Ut("Incorrect JPEG interchange format: using JPEGInterchangeFormat offset to derive tables")}else Ut("JPEGInterchangeFormat+JPEGInterchangeFormatLength > offset to first strip or tile");if(_n==null){var yn=0,vn=[];vn[yn++]=255,vn[yn++]=An;var wn=un.t519;if(wn==null)throw new Error("JPEGQTables tag is missing");for($n=0;$n>>8,vn[yn++]=255&Kn,vn[yn++]=$n|Nn<<4,pn=0;pn<16;pn++)vn[yn++]=hn[bn+Un[$n]+pn];for(pn=0;pn>>8&255,vn[yn++]=255&un.height,vn[yn++]=un.width>>>8&255,vn[yn++]=255&un.width,vn[yn++]=On,On==1)vn[yn++]=1,vn[yn++]=17,vn[yn++]=0;else for($n=0;$n<3;$n++)vn[yn++]=$n+1,vn[yn++]=$n!=0?17:(15&Sn)<<4|15&Rn,vn[yn++]=$n;Vn!=null&&Vn[0]!=0&&(vn[yn++]=255,vn[yn++]=221,vn[yn++]=0,vn[yn++]=4,vn[yn++]=Vn[0]>>>8&255,vn[yn++]=255&Vn[0]),_n=new Uint8Array(vn)}var kn=-1;for($n=0;$n<_n.length-1;){if(_n[$n]==255&&_n[$n+1]==192){kn=$n;break}$n++}if(kn==-1){var tr=new Uint8Array(_n.length+10+3*On);tr.set(_n);var or=_n.length;if(kn=_n.length,(_n=tr)[or++]=255,_n[or++]=192,_n[or++]=0,_n[or++]=8+3*On,_n[or++]=8,_n[or++]=un.height>>>8&255,_n[or++]=255&un.height,_n[or++]=un.width>>>8&255,_n[or++]=255&un.width,_n[or++]=On,On==1)_n[or++]=1,_n[or++]=17,_n[or++]=0;else for($n=0;$n<3;$n++)_n[or++]=$n+1,_n[or++]=$n!=0?17:(15&Sn)<<4|15&Rn,_n[or++]=$n}if(hn[Pn]==255&&hn[Pn+1]==218){var Jn=hn[Pn+2]<<8|hn[Pn+3];for((Tn=new Uint8Array(Jn+2))[0]=hn[Pn],Tn[1]=hn[Pn+1],Tn[2]=hn[Pn+2],Tn[3]=hn[Pn+3],$n=0;$n>>8&255,Nn[Dn.sofPosition+6]=255&un.height,Nn[Dn.sofPosition+7]=un.width>>>8&255,Nn[Dn.sofPosition+8]=255&un.width,hn[bn]==255&&hn[bn+1]==SOS||(Nn.set(Dn.sosMarker,An),An+=sosMarker.length),Gn=0;Gn=0&&Nn<128)for(var An=0;An=-127&&Nn<0){for(An=0;An<1-Nn;An++)$n[_n]=Tn[hn],_n++;hn++}}return _n},Gt.decode._decodeThunder=function(un,hn,bn,En,_n){for(var Tn=[0,1,0,-1],$n=[0,1,2,3,0,-3,-2,-1],pn=hn+bn,Nn=2*_n,An=0;hn>>6,Cn=63&Dn;if(hn++,Pn==3&&(An=15&Cn,En[Nn>>>1]|=An<<4*(1-Nn&1),Nn++),Pn==0)for(var Gn=0;Gn>>1]|=An<<4*(1-Nn&1),Nn++;if(Pn==2)for(Gn=0;Gn<2;Gn++)(In=Cn>>>3*(1-Gn)&7)!=4&&(An+=$n[In],En[Nn>>>1]|=An<<4*(1-Nn&1),Nn++);if(Pn==1)for(Gn=0;Gn<3;Gn++){var In;(In=Cn>>>2*(2-Gn)&3)!=2&&(An+=Tn[In],En[Nn>>>1]|=An<<4*(1-Nn&1),Nn++)}}},Gt.decode._dmap={1:0,"011":1,"000011":2,"0000011":3,"010":-1,"000010":-2,"0000010":-3},Gt.decode._lens=function(){var un=function(Nn,An,Dn,Pn){for(var Cn=0;Cn>>3>>3]>>>7-(7&Nn)&1),$n==2&&(yn=un[Nn>>>3]>>>(7&Nn)&1),Nn++,Dn+=yn,Rn=="H"){if(pn._lens[ar][Dn]!=null){var vn=pn._lens[ar][Dn];Dn="",An+=vn,vn<64&&(pn._addNtimes(Pn,An,ar),In+=An,ar=1-ar,An=0,--On==0&&(Rn=""))}}else Dn=="0001"&&(Dn="",pn._addNtimes(Pn,nr-In,ar),In=nr),Dn=="001"&&(Dn="",Rn="H",On=2),pn._dmap[Dn]!=null&&(Bn=Zn+pn._dmap[Dn],pn._addNtimes(Pn,Bn-In,ar),In=Bn,Dn="",ar=1-ar);Pn.length==Tn&&Rn==""&&(pn._writeBits(Pn,En,8*_n+Sn*Vn),ar=0,Sn++,In=0,Cn=pn._makeDiff(Pn),Pn=[])}},Gt.decode._findDiff=function(un,hn,bn){for(var En=0;En=hn&&un[En+1]==bn)return un[En]},Gt.decode._makeDiff=function(un){var hn=[];un[0]==1&&hn.push(0,1);for(var bn=1;bn>>3>>3]>>>7-(7&Nn)&1),$n==2&&(Bn=un[Nn>>>3]>>>(7&Nn)&1),Nn++,Dn+=Bn,(An=pn._lens[Cn][Dn])!=null&&(pn._addNtimes(Pn,An,Cn),Dn="",An<64&&(Cn=1-Cn),Pn.length==Tn&&(pn._writeBits(Pn,En,8*_n+Gn*In),Pn=[],Gn++,Cn=0,7&Nn&&(Nn+=8-(7&Nn)),An>=64&&(Nn+=8)))}},Gt.decode._decodeG3=function(un,hn,bn,En,_n,Tn,$n,pn){for(var Nn=Gt.decode,An=hn<<3,Dn=0,Pn="",Cn=[],Gn=[],In=0;In>>3>>3]>>>7-(7&An)&1),$n==2&&(wn=un[An>>>3]>>>(7&An)&1),An++,Pn+=wn,yn){if(Nn._lens[Sn][Pn]!=null){var Un=Nn._lens[Sn][Pn];Pn="",Dn+=Un,Un<64&&(Nn._addNtimes(Cn,Dn,Sn),Sn=1-Sn,Dn=0)}}else On=="H"?Nn._lens[Sn][Pn]!=null&&(Un=Nn._lens[Sn][Pn],Pn="",Dn+=Un,Un<64&&(Nn._addNtimes(Cn,Dn,Sn),Bn+=Dn,Sn=1-Sn,Dn=0,--Vn==0&&(On=""))):(Pn=="0001"&&(Pn="",Nn._addNtimes(Cn,ar-Bn,Sn),Bn=ar),Pn=="001"&&(Pn="",On="H",Vn=2),Nn._dmap[Pn]!=null&&(Zn=nr+Nn._dmap[Pn],Nn._addNtimes(Cn,Zn-Bn,Sn),Bn=Zn,Pn="",Sn=1-Sn));Pn.endsWith("000000000001")&&(Rn>=0&&Nn._writeBits(Cn,En,8*_n+Rn*vn),pn&&($n==1&&(yn=(un[An>>>3]>>>7-(7&An)&1)==1),$n==2&&(yn=(un[An>>>3]>>>(7&An)&1)==1),An++),Pn="",Sn=0,Rn++,Bn=0,Gn=Nn._makeDiff(Cn),Cn=[])}Cn.length==Tn&&Nn._writeBits(Cn,En,8*_n+Rn*vn)},Gt.decode._addNtimes=function(un,hn,bn){for(var En=0;En>>3]|=un[En]<<7-(bn+En&7)},Gt.decode._decodeLZW=Gt.decode._decodeLZW=(Qt=0,en=0,tn=0,nn=0,rn=function(){var un=qt>>>3,hn=(Yt[un]<<16|Yt[un+1]<<8|Yt[un+2])>>>24-(7&qt)-en&(1<>>----------------");for(var Nn=0;Nn<$n;Nn++){var An=un.readUshort(hn,bn);bn+=2;var Dn=un.readUshort(hn,bn);bn+=2;var Pn=un.readUint(hn,bn);bn+=4;var Cn=un.readUint(hn,bn);bn+=4;var Gn=[];if(Dn!=1&&Dn!=7||(Gn=new Uint8Array(hn.buffer,Pn<5?bn-4:Cn,Pn)),Dn==2){var In=Pn<5?bn-4:Cn,Bn=hn[In],Zn=Math.max(0,Math.min(Pn-1,hn.length-In));Bn<128||Zn==0?Gn.push(un.readASCII(hn,In,Zn)):Gn=new Uint8Array(hn.buffer,In,Zn)}if(Dn==3)for(var nr=0;nr4&&(un.writeUint(bn,En,pn),Bn=pn),Pn==1||Pn==7)for(var Zn=0;Zn4&&(pn+=In+=1&In),En+=4}}return[En,pn]},Gt.toRGBA8=function(un,hn){var bn=un.width,En=un.height,_n=bn*En,Tn=4*_n,$n=un.data,pn=new Uint8Array(4*_n),Nn=un.t262?un.t262[0]:2,An=un.t258?Math.min(32,un.t258[0]):1;if(un.t262==null&&An==1&&(Nn=0),Nn==0)for(var Dn=Math.ceil(An*bn/8),Pn=0;Pn>3)]>>7-(7&In)&1;pn[Bn]=pn[Bn+1]=pn[Bn+2]=255*(1-Zn),pn[Bn+3]=255}if(An==4)for(In=0;In>1)]>>4-4*(1&In)&15,pn[Bn]=pn[Bn+1]=pn[Bn+2]=17*(15-Zn),pn[Bn+3]=255;if(An==8)for(In=0;In>3)]>>7-(7&In)&1,pn[Bn]=pn[Bn+1]=pn[Bn+2]=255*Zn,pn[Bn+3]=255;if(An==2)for(In=0;In>2)]>>6-2*(3&In)&3,pn[Bn]=pn[Bn+1]=pn[Bn+2]=85*Zn,pn[Bn+3]=255;if(An==8)for(In=0;In>>3)]>>>7-(7&vn)&1;else if(An==2)wn=$n[Un+(vn>>>2)]>>>6-2*(3&vn)&3;else if(An==4)wn=$n[Un+(vn>>>1)]>>>4-4*(1&vn)&15;else{if(An!=8)throw An;wn=$n[Un+vn*nr]}pn[Bn]=Vn[wn]>>8,pn[Bn+1]=Vn[yn+wn]>>8,pn[Bn+2]=Vn[yn+yn+wn]>>8,pn[Bn+3]=255}}else if(Nn==5){var Kn=(nr=un.t258?un.t258.length:4)>4?1:0;for(In=0;In<_n;In++){Bn=In<<2;var kn=In*nr;if(UDOC){var tr=$n[kn],or=$n[kn+1],Jn=$n[kn+2],gr=$n[kn+3],Er=UDOC.C.cmykToRgb([tr*(1/255),or*(1/255),Jn*(1/255),gr*(1/255)]);pn[Bn]=~~(.5+255*Er[0]),pn[Bn+1]=~~(.5+255*Er[1]),pn[Bn+2]=~~(.5+255*Er[2])}else tr=255-$n[kn],or=255-$n[kn+1],Jn=255-$n[kn+2],gr=(255-$n[kn+3])*.00392156862745098,pn[Bn]=~~(tr*gr+.5),pn[Bn+1]=~~(or*gr+.5),pn[Bn+2]=~~(Jn*gr+.5);pn[Bn+3]=255*(1-Kn)+$n[kn+4]*Kn}}else if(Nn==6&&un.t278){var Sr=un.t278[0];for(Pn=0;Pn>>1))+(1&sr)];var hr=$n[kn+2]-128,Tr=$n[kn+3]-128,Mr=Jn+((Tr>>2)+(Tr>>3)+(Tr>>5)),qn=Jn-((hr>>2)+(hr>>4)+(hr>>5))-((Tr>>1)+(Tr>>3)+(Tr>>4)+(Tr>>5)),Ln=Jn+(hr+(hr>>1)+(hr>>2)+(hr>>6));pn[Bn]=Math.max(0,Math.min(255,Mr)),pn[Bn+1]=Math.max(0,Math.min(255,qn)),pn[Bn+2]=Math.max(0,Math.min(255,Ln)),pn[Bn+3]=255}}}else if(Nn==32845){let Xn=function(ur){return ur<.0031308?12.92*ur:1.055*Math.pow(ur,.4166666666666667)-.055};for(Pn=0;PnEn&&(En=pn,_n=$n)}}Gt.decodeImage(un,_n,hn);var Nn=Gt.toRGBA8(_n),An=_n.width,Dn=_n.height,Pn=document.createElement("canvas");Pn.width=An,Pn.height=Dn;var Cn=Pn.getContext("2d"),Gn=new ImageData(new Uint8ClampedArray(Nn.buffer),An,Dn);return Cn.putImageData(Gn,0,0),Pn.toDataURL()},Gt._binBE={nextZero:function(un,hn){for(;un[hn]!=0;)hn++;return hn},readUshort:function(un,hn){return un[hn]<<8|un[hn+1]},readShort:function(un,hn){var bn=Gt._binBE.ui8;return bn[0]=un[hn+1],bn[1]=un[hn+0],Gt._binBE.i16[0]},readInt:function(un,hn){var bn=Gt._binBE.ui8;return bn[0]=un[hn+3],bn[1]=un[hn+2],bn[2]=un[hn+1],bn[3]=un[hn+0],Gt._binBE.i32[0]},readUint:function(un,hn){var bn=Gt._binBE.ui8;return bn[0]=un[hn+3],bn[1]=un[hn+2],bn[2]=un[hn+1],bn[3]=un[hn+0],Gt._binBE.ui32[0]},readASCII:function(un,hn,bn){for(var En="",_n=0;_n>8&255,un[hn+1]=255&bn},writeInt:function(un,hn,bn){var En=Gt._binBE.ui8;Gt._binBE.i32[0]=bn,un[hn+3]=En[0],un[hn+2]=En[1],un[hn+1]=En[2],un[hn+0]=En[3]},writeUint:function(un,hn,bn){un[hn]=bn>>24&255,un[hn+1]=bn>>16&255,un[hn+2]=bn>>8&255,un[hn+3]=bn>>0&255},writeASCII:function(un,hn,bn){for(var En=0;En>8&255},writeInt:function(un,hn,bn){var En=Gt._binBE.ui8;Gt._binBE.i32[0]=bn,un[hn+0]=En[0],un[hn+1]=En[1],un[hn+2]=En[2],un[hn+3]=En[3]},writeUint:function(un,hn,bn){un[hn]=bn>>>0&255,un[hn+1]=bn>>>8&255,un[hn+2]=bn>>>16&255,un[hn+3]=bn>>>24&255},writeASCII:Gt._binBE.writeASCII},Gt._copyTile=function(un,hn,bn,En,_n,Tn,$n,pn){for(var Nn=Math.min(hn,_n-$n),An=Math.min(bn,Tn-pn),Dn=0;Dn>--On&1)];Rn[ar]=yn}}function Tn(In,Bn,Zn,nr){if(In[Bn+3]!=255)return 0;if(Zn==0)return Bn;for(var ar=0;ar<2;ar++){In[Bn+ar]==0&&(In[Bn+ar]=In.length,In.push(0,0,nr,255));var Sn=Tn(In,In[Bn+ar],Zn-1,nr+1);if(Sn!=0)return Sn}return 0}function $n(In){for(var Bn=In.b,Zn=In.a;Bn<25&&In.e>>8),Zn=Zn<<8|nr,Bn+=8}if(Bn<0)throw"e";In.b=Bn,In.a=Zn}function pn(In,Bn){return Bn.b>(Bn.b-=In)&65535>>16-In}function Nn(In,Bn){var Zn=In[0],nr=0,ar=255;Bn.b<16&&$n(Bn);var Sn=Bn.a>>Bn.b-8&255;for(ar=Zn[(nr=In[1][Sn])+3],Bn.b-=Zn[nr+2];ar==255;)ar=Zn[(nr=Zn[nr+(Bn.a>>--Bn.b&1)])+3];return ar}function An(In,Bn){return In<32768>>16-Bn&&(In+=1-(1<>>1);else if(Bn==6)or=In[kn]+(tr-In[kn-Rn]>>>1);else{if(Bn!=7)throw Bn;or=tr+In[kn]>>>1}In[Kn]+=or}}}return function(In){if(un=In,hn=0,En()!=65496)throw"e";for(var Bn=[],Zn=0,nr=0,ar=[],Sn=[],Rn=[],On=0,Vn=0,yn=0;;){var vn=En();if(vn!=65535){var wn=En();if(vn==65475){nr=bn(),Vn=En(),yn=En(),On=bn();for(var Un=0;Un>4,15&kn]}}else if(vn==65476)for(var tr=hn+wn-2;hn>>4],ar[or[0]]=or.slice(1)}Zn=bn(),hn+=2;break}hn+=wn-2}}else hn--}var Jn=new(nr>8?Uint16Array:Uint8Array)(Vn*yn*On),gr={b:0,a:0,c:Zn==8,e:hn,data:un,d:un.length};if(gr.c)(function(ur,Wr,Or,to,Gr){for(var no=un.length-hn,Hr=0;HrSr&&(Sr=mr),(ir=sr[1])>Rr&&(Rr=ir),Er.push(mr*ir)}if(Sr!=1||Rr!=1){var hr=[],Tr=0;for(Un=0;Un>>6),Kn=0;Kn<3;Kn++)for(var kn=0;kn<41;kn++)wn[Kn][kn]=[Un,1];return wn}function nr(vn,wn){var Un=0,Kn=8-vn.a;if(vn.j,vn.a,wn){if(wn>=Kn)do Un<<=Kn,wn-=Kn,Un|=vn[vn.j]&(1<=8);wn&&(Un<<=wn,Kn-=wn,Un|=vn[vn.j]>>>Kn&(1<sr&&Rr>>2,Jn)return void(Ln[Tr]=hr);gr=wn.t*wn.c[vn.g+kr-ir]+wn.c[vn.g+mr-kr]}else hr=kr>mr&&kr>Cr||kr>>2:Wn+vr>>>1,gr=wn.t*wn.c[vn.g+kr-mr]+wn.c[vn.g+mr-Wn];Er=Xn(gr);var ur=function(Or){for(var to=-1,Gr=0;!Gr;to++)Gr=Or[Or.j]>>>7-Or.a&1,Or.a++,Or.a&=7,Or.a||Or.j++;return to}(Un);if(ur>>1):qn>>>1,or[Er][0]+=Xn(qn),or[Er][1]==vn.f&&(or[Er][0]>>>=1,or[Er][1]>>>=1),or[Er][1]++,hr=gr<0?hr-qn:hr+qn,vn.i&&(hr<0?hr+=wn.w:hr>vn.g&&(hr-=wn.w)),Ln[Tr]=hr>=0?Math.min(hr,vn.g):0}function Sn(vn,wn,Un){for(var Kn=vn[0].length,kn=wn;kn<=Un;kn++)vn[kn][0]=vn[kn-1][1],vn[kn][Kn-1]=vn[kn-1][Kn-2]}function Rn(vn){Sn(vn,Tn,Dn),Sn(vn,un,bn),Sn(vn,Gn,Bn)}function On(vn,wn,Un,Kn,kn,tr,or,Jn,gr,Er,Sr,Rr,sr){for(var hr=0,Tr=1,Mr=knbn;Tr8&&(ar(vn,wn,Un,Kn,kn,Tr,Jn[gr]),ar(vn,wn,Un,Kn,tr,Tr,Jn[gr]),Tr+=2);Rn(Kn)}function Vn(vn,wn,Un,Kn,kn,tr){On(vn,wn,Un,Kn,un,Tn,kn,tr,0,0,1,0,8),On(vn,wn,Un,Kn,$n,Gn,kn,tr,1,0,1,0,8),On(vn,wn,Un,Kn,hn,pn,kn,tr,2,1,0,3,0),On(vn,wn,Un,Kn,Nn,In,kn,tr,0,0,0,3,2),On(vn,wn,Un,Kn,bn,An,kn,tr,1,0,0,3,2),On(vn,wn,Un,Kn,Dn,Bn,kn,tr,2,1,0,3,0)}function yn(vn,wn,Un,Kn,kn,tr){var or=tr.length,Jn=vn.l;kn+1==vn.s&&(Jn=vn.e-kn*vn.l);for(var gr=6*vn.e*Kn+kn*vn.l,Er=0;Er<6;Er++){for(var Sr=0;Sr>>1):sr==2?Gn+(Er>>>1):Tn+Er;var hr=vn.h?(2*Sr/3&2147483646|Sr%3&1)+(Sr%3>>>1):Sr>>>1;wn[gr+Sr]=Un[Rr][hr+1]}gr+=vn.e}}Gt._decompressRAF=function(vn,wn){var Un=function(Tr){var Mr=Gt._binBE.readUshort,qn={b:Mr(Tr,0),i:Tr[2],C:Tr[3],u:Tr[4],q:Mr(Tr,5),k:Mr(Tr,7),e:Mr(Tr,9),l:Mr(Tr,11),s:Tr[13],d:Mr(Tr,14)};if(qn.b!=18771||qn.i>1||qn.q<6||qn.q%6||qn.e<768||qn.e%24||qn.l!=768||qn.k=qn.l||qn.s>16||qn.s!=qn.k/qn.l||qn.s!=Math.ceil(qn.e/qn.l)||qn.d!=qn.q/6||qn.u!=12&&qn.u!=14&&qn.u!=16||qn.C!=16&&qn.C!=0)throw"Invalid data";if(qn.i==0)throw"Not implemented. We need this file!";return qn.h=qn.C==16,qn.m=0|(qn.h?2*qn.l/3:qn.l>>>1),qn.A=qn.m+2,qn.f=64,qn.g=(1<{Dt.r(Pt),Dt.d(Pt,{DOMException:()=>mn,Headers:()=>Xt,Request:()=>an,Response:()=>ln,fetch:()=>gn});var Nt=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||Nt!==void 0&&Nt,jt={searchParams:"URLSearchParams"in Nt,iterable:"Symbol"in Nt&&"iterator"in Symbol,blob:"FileReader"in Nt&&"Blob"in Nt&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Nt,arrayBuffer:"ArrayBuffer"in Nt};if(jt.arrayBuffer)var Ut=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Gt=ArrayBuffer.isView||function(un){return un&&Ut.indexOf(Object.prototype.toString.call(un))>-1};function Wt(un){if(typeof un!="string"&&(un=String(un)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(un)||un==="")throw new TypeError('Invalid character in header field name: "'+un+'"');return un.toLowerCase()}function qt(un){return typeof un!="string"&&(un=String(un)),un}function Yt(un){var hn={next:function(){var bn=un.shift();return{done:bn===void 0,value:bn}}};return jt.iterable&&(hn[Symbol.iterator]=function(){return hn}),hn}function Xt(un){this.map={},un instanceof Xt?un.forEach(function(hn,bn){this.append(bn,hn)},this):Array.isArray(un)?un.forEach(function(hn){this.append(hn[0],hn[1])},this):un&&Object.getOwnPropertyNames(un).forEach(function(hn){this.append(hn,un[hn])},this)}function Zt(un){if(un.bodyUsed)return Promise.reject(new TypeError("Already read"));un.bodyUsed=!0}function Qt(un){return new Promise(function(hn,bn){un.onload=function(){hn(un.result)},un.onerror=function(){bn(un.error)}})}function en(un){var hn=new FileReader,bn=Qt(hn);return hn.readAsArrayBuffer(un),bn}function tn(un){if(un.slice)return un.slice(0);var hn=new Uint8Array(un.byteLength);return hn.set(new Uint8Array(un)),hn.buffer}function nn(){return this.bodyUsed=!1,this._initBody=function(un){var hn;this.bodyUsed=this.bodyUsed,this._bodyInit=un,un?typeof un=="string"?this._bodyText=un:jt.blob&&Blob.prototype.isPrototypeOf(un)?this._bodyBlob=un:jt.formData&&FormData.prototype.isPrototypeOf(un)?this._bodyFormData=un:jt.searchParams&&URLSearchParams.prototype.isPrototypeOf(un)?this._bodyText=un.toString():jt.arrayBuffer&&jt.blob&&(hn=un)&&DataView.prototype.isPrototypeOf(hn)?(this._bodyArrayBuffer=tn(un.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):jt.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(un)||Gt(un))?this._bodyArrayBuffer=tn(un):this._bodyText=un=Object.prototype.toString.call(un):this._bodyText="",this.headers.get("content-type")||(typeof un=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):jt.searchParams&&URLSearchParams.prototype.isPrototypeOf(un)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},jt.blob&&(this.blob=function(){var un=Zt(this);if(un)return un;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?Zt(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(en)}),this.text=function(){var un,hn,bn,En=Zt(this);if(En)return En;if(this._bodyBlob)return un=this._bodyBlob,bn=Qt(hn=new FileReader),hn.readAsText(un),bn;if(this._bodyArrayBuffer)return Promise.resolve(function(_n){for(var Tn=new Uint8Array(_n),$n=new Array(Tn.length),pn=0;pn-1?En:bn),this.mode=hn.mode||this.mode||null,this.signal=hn.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(_n),!(this.method!=="GET"&&this.method!=="HEAD"||hn.cache!=="no-store"&&hn.cache!=="no-cache")){var Tn=/([?&])_=[^&]*/;Tn.test(this.url)?this.url=this.url.replace(Tn,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function sn(un){var hn=new FormData;return un.trim().split("&").forEach(function(bn){if(bn){var En=bn.split("="),_n=En.shift().replace(/\+/g," "),Tn=En.join("=").replace(/\+/g," ");hn.append(decodeURIComponent(_n),decodeURIComponent(Tn))}}),hn}function ln(un,hn){if(!(this instanceof ln))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');hn||(hn={}),this.type="default",this.status=hn.status===void 0?200:hn.status,this.ok=this.status>=200&&this.status<300,this.statusText=hn.statusText===void 0?"":""+hn.statusText,this.headers=new Xt(hn.headers),this.url=hn.url||"",this._initBody(un)}an.prototype.clone=function(){return new an(this,{body:this._bodyInit})},nn.call(an.prototype),nn.call(ln.prototype),ln.prototype.clone=function(){return new ln(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Xt(this.headers),url:this.url})},ln.error=function(){var un=new ln(null,{status:0,statusText:""});return un.type="error",un};var dn=[301,302,303,307,308];ln.redirect=function(un,hn){if(dn.indexOf(hn)===-1)throw new RangeError("Invalid status code");return new ln(null,{status:hn,headers:{location:un}})};var mn=Nt.DOMException;try{new mn}catch{(mn=function(hn,bn){this.message=hn,this.name=bn;var En=Error(hn);this.stack=En.stack}).prototype=Object.create(Error.prototype),mn.prototype.constructor=mn}function gn(un,hn){return new Promise(function(bn,En){var _n=new an(un,hn);if(_n.signal&&_n.signal.aborted)return En(new mn("Aborted","AbortError"));var Tn=new XMLHttpRequest;function $n(){Tn.abort()}Tn.onload=function(){var pn,Nn,An={status:Tn.status,statusText:Tn.statusText,headers:(pn=Tn.getAllResponseHeaders()||"",Nn=new Xt,pn.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(Pn){return Pn.indexOf(` -`)===0?Pn.substr(1,Pn.length):Pn}).forEach(function(Pn){var Cn=Pn.split(":"),Gn=Cn.shift().trim();if(Gn){var In=Cn.join(":").trim();Nn.append(Gn,In)}}),Nn)};An.url="responseURL"in Tn?Tn.responseURL:An.headers.get("X-Request-URL");var Dn="response"in Tn?Tn.response:Tn.responseText;setTimeout(function(){bn(new ln(Dn,An))},0)},Tn.onerror=function(){setTimeout(function(){En(new TypeError("Network request failed"))},0)},Tn.ontimeout=function(){setTimeout(function(){En(new TypeError("Network request failed"))},0)},Tn.onabort=function(){setTimeout(function(){En(new mn("Aborted","AbortError"))},0)},Tn.open(_n.method,function(pn){try{return pn===""&&Nt.location.href?Nt.location.href:pn}catch{return pn}}(_n.url),!0),_n.credentials==="include"?Tn.withCredentials=!0:_n.credentials==="omit"&&(Tn.withCredentials=!1),"responseType"in Tn&&(jt.blob?Tn.responseType="blob":jt.arrayBuffer&&_n.headers.get("Content-Type")&&_n.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(Tn.responseType="arraybuffer")),!hn||typeof hn.headers!="object"||hn.headers instanceof Xt?_n.headers.forEach(function(pn,Nn){Tn.setRequestHeader(Nn,pn)}):Object.getOwnPropertyNames(hn.headers).forEach(function(pn){Tn.setRequestHeader(pn,qt(hn.headers[pn]))}),_n.signal&&(_n.signal.addEventListener("abort",$n),Tn.onreadystatechange=function(){Tn.readyState===4&&_n.signal.removeEventListener("abort",$n)}),Tn.send(_n._bodyInit===void 0?null:_n._bodyInit)})}gn.polyfill=!0,Nt.fetch||(Nt.fetch=gn,Nt.Headers=Xt,Nt.Request=an,Nt.Response=ln)},6290:(_e,Pt,Dt)=>{var Nt=Dt(5048),jt=Dt(9748),Ut=Dt(4655),Gt=Dt(1960);function Wt(Xt,Zt,Qt){var en=Xt;return jt(Zt)?(Qt=Zt,typeof Xt=="string"&&(en={uri:Xt})):en=Gt(Zt,{uri:Xt}),en.callback=Qt,en}function qt(Xt,Zt,Qt){return Yt(Zt=Wt(Xt,Zt,Qt))}function Yt(Xt){if(Xt.callback===void 0)throw new Error("callback argument missing");var Zt=!1,Qt=function(_n,Tn,$n){Zt||(Zt=!0,Xt.callback(_n,Tn,$n))};function en(){var _n=void 0;if(_n=sn.response?sn.response:sn.responseText||function(Tn){try{if(Tn.responseType==="document")return Tn.responseXML;var $n=Tn.responseXML&&Tn.responseXML.documentElement.nodeName==="parsererror";if(Tn.responseType===""&&!$n)return Tn.responseXML}catch{}return null}(sn),bn)try{_n=JSON.parse(_n)}catch{}return _n}function tn(_n){return clearTimeout(ln),_n instanceof Error||(_n=new Error(""+(_n||"Unknown XMLHttpRequest Error"))),_n.statusCode=0,Qt(_n,En)}function nn(){if(!an){var _n;clearTimeout(ln),_n=Xt.useXDR&&sn.status===void 0?200:sn.status===1223?204:sn.status;var Tn=En,$n=null;return _n!==0?(Tn={body:en(),statusCode:_n,method:mn,headers:{},url:dn,rawRequest:sn},sn.getAllResponseHeaders&&(Tn.headers=Ut(sn.getAllResponseHeaders()))):$n=new Error("Internal XMLHttpRequest Error"),Qt($n,Tn,Tn.body)}}var rn,an,sn=Xt.xhr||null;sn||(sn=Xt.cors||Xt.useXDR?new qt.XDomainRequest:new qt.XMLHttpRequest);var ln,dn=sn.url=Xt.uri||Xt.url,mn=sn.method=Xt.method||"GET",gn=Xt.body||Xt.data,un=sn.headers=Xt.headers||{},hn=!!Xt.sync,bn=!1,En={body:void 0,headers:{},statusCode:0,method:mn,url:dn,rawRequest:sn};if("json"in Xt&&Xt.json!==!1&&(bn=!0,un.accept||un.Accept||(un.Accept="application/json"),mn!=="GET"&&mn!=="HEAD"&&(un["content-type"]||un["Content-Type"]||(un["Content-Type"]="application/json"),gn=JSON.stringify(Xt.json===!0?gn:Xt.json))),sn.onreadystatechange=function(){sn.readyState===4&&setTimeout(nn,0)},sn.onload=nn,sn.onerror=tn,sn.onprogress=function(){},sn.onabort=function(){an=!0},sn.ontimeout=tn,sn.open(mn,dn,!hn,Xt.username,Xt.password),hn||(sn.withCredentials=!!Xt.withCredentials),!hn&&Xt.timeout>0&&(ln=setTimeout(function(){if(!an){an=!0,sn.abort("timeout");var _n=new Error("XMLHttpRequest timeout");_n.code="ETIMEDOUT",tn(_n)}},Xt.timeout)),sn.setRequestHeader)for(rn in un)un.hasOwnProperty(rn)&&sn.setRequestHeader(rn,un[rn]);else if(Xt.headers&&!function(_n){for(var Tn in _n)if(_n.hasOwnProperty(Tn))return!1;return!0}(Xt.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in Xt&&(sn.responseType=Xt.responseType),"beforeSend"in Xt&&typeof Xt.beforeSend=="function"&&Xt.beforeSend(sn),sn.send(gn||null),sn}_e.exports=qt,_e.exports.default=qt,qt.XMLHttpRequest=Nt.XMLHttpRequest||function(){},qt.XDomainRequest="withCredentials"in new qt.XMLHttpRequest?qt.XMLHttpRequest:Nt.XDomainRequest,function(Xt,Zt){for(var Qt=0;Qt{_e.exports=self.DOMParser!==void 0?function(Pt){return new self.DOMParser().parseFromString(Pt,"application/xml")}:self.ActiveXObject!==void 0&&new self.ActiveXObject("Microsoft.XMLDOM")?function(Pt){var Dt=new self.ActiveXObject("Microsoft.XMLDOM");return Dt.async="false",Dt.loadXML(Pt),Dt}:function(Pt){var Dt=document.createElement("div");return Dt.innerHTML=Pt,Dt}},1960:_e=>{_e.exports=function(){for(var Dt={},Nt=0;Nt{},6777:()=>{},5546:()=>{},2460:(_e,Pt,Dt)=>{var Nt=Dt(4406),jt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,Gt=Object.getOwnPropertyNames,Wt=Object.prototype.hasOwnProperty,qt=(Mn,dr)=>{for(var br in dr)jt(Mn,br,{get:dr[br],enumerable:!0})},Yt=(Mn=>(dr,br)=>Mn&&Mn.get(dr)||(br=((Ir,Nr,Yr,zr)=>{if(Nr&&typeof Nr=="object"||typeof Nr=="function")for(let _i of Gt(Nr))Wt.call(Ir,_i)||jt(Ir,_i,{get:()=>Nr[_i],enumerable:!(zr=Ut(Nr,_i))||zr.enumerable});return Ir})(jt({},"__esModule",{value:!0}),dr),Mn&&Mn.set(dr,br),br))(typeof WeakMap<"u"?new WeakMap:0),Xt=(Mn,dr,br)=>(((Ir,Nr,Yr)=>{Nr in Ir?jt(Ir,Nr,{enumerable:!0,configurable:!0,writable:!0,value:Yr}):Ir[Nr]=Yr})(Mn,typeof dr!="symbol"?dr+"":dr,br),br),Zt={};qt(Zt,{applyPalette:()=>wu,applyPaletteSync:()=>Ml,buildPalette:()=>_u,buildPaletteSync:()=>bs,constants:()=>Qt,conversion:()=>an,distance:()=>Rn,image:()=>xa,palette:()=>hr,quality:()=>$a,utils:()=>ir});var Qt={};qt(Qt,{bt709:()=>en});var en={};qt(en,{Y:()=>tn,x:()=>nn,y:()=>rn});var tn=(Mn=>(Mn[Mn.RED=.2126]="RED",Mn[Mn.GREEN=.7152]="GREEN",Mn[Mn.BLUE=.0722]="BLUE",Mn[Mn.WHITE=1]="WHITE",Mn))(tn||{}),nn=(Mn=>(Mn[Mn.RED=.64]="RED",Mn[Mn.GREEN=.3]="GREEN",Mn[Mn.BLUE=.15]="BLUE",Mn[Mn.WHITE=.3127]="WHITE",Mn))(nn||{}),rn=(Mn=>(Mn[Mn.RED=.33]="RED",Mn[Mn.GREEN=.6]="GREEN",Mn[Mn.BLUE=.06]="BLUE",Mn[Mn.WHITE=.329]="WHITE",Mn))(rn||{}),an={};function sn(Mn){return Mn>.04045?((Mn+.055)/1.055)**2.4:Mn/12.92}function ln(Mn,dr,br){return{x:.4124*(Mn=sn(Mn/255))+.3576*(dr=sn(dr/255))+.1805*(br=sn(br/255)),y:.2126*Mn+.7152*dr+.0722*br,z:.0193*Mn+.1192*dr+.9505*br}}qt(an,{lab2rgb:()=>Sn,lab2xyz:()=>Zn,rgb2hsl:()=>Tn,rgb2lab:()=>Pn,rgb2xyz:()=>ln,xyz2lab:()=>Dn,xyz2rgb:()=>ar});var dn={};function mn(Mn){return Mn*(Math.PI/180)}function gn(Mn,dr,br){let Ir=Mn;return Irdr&&(Ir=dr),Ir>br&&(Ir=br),Ir}function hn(Mn,dr,br){return Mn>br&&(Mn=br),Mn255?Mn=255:Mn<0&&(Mn=0),Mn}function En(Mn){return Mn>255?Mn=255:Mn<0&&(Mn=0),Mn}function _n(Mn,dr){const br=typeof Mn[0];let Ir;if(br==="number"||br==="string"){const Nr=Object.create(null);for(let Yr=0,zr=Mn.length;Yrdr(Yr,zr)||Nr[Yr]-Nr[zr])}else{const Nr=Mn.slice(0);Ir=Mn.sort((Yr,zr)=>dr(Yr,zr)||Nr.indexOf(Yr)-Nr.indexOf(zr))}return Ir}function Tn(Mn,dr,br){const Ir=un(Mn,dr,br),Nr=gn(Mn,dr,br),Yr=Nr-Ir,zr=(Ir+Nr)/510;let _i=0;zr>0&&zr<1&&(_i=Yr/(zr<.5?Nr+Ir:510-Nr-Ir));let qr=0;return Yr>0&&(qr=Nr===Mn?(dr-br)/Yr:Nr===dr?2+(br-Mn)/Yr:4+(Mn-dr)/Yr,qr*=60,qr<0&&(qr+=360)),{h:qr,s:_i,l:zr}}qt(dn,{degrees2radians:()=>mn,inRange0to255:()=>En,inRange0to255Rounded:()=>bn,intInRange:()=>hn,max3:()=>gn,min3:()=>un,stableSort:()=>_n});var $n=.95047,pn=1,Nn=1.08883;function An(Mn){return Mn>.008856?Mn**.3333333333333333:7.787*Mn+.13793103448275862}function Dn(Mn,dr,br){if(Mn=An(Mn/$n),dr=An(dr/pn),br=An(br/Nn),116*dr-16<0)throw new Error("xxx");return{L:Math.max(0,116*dr-16),a:500*(Mn-dr),b:200*(dr-br)}}function Pn(Mn,dr,br){const Ir=ln(Mn,dr,br);return Dn(Ir.x,Ir.y,Ir.z)}var Cn=.95047,Gn=1,In=1.08883;function Bn(Mn){return Mn>.206893034?Mn**3:(Mn-.13793103448275862)/7.787}function Zn(Mn,dr,br){const Ir=(Mn+16)/116,Nr=Ir-br/200;return{x:Cn*Bn(dr/500+Ir),y:Gn*Bn(Ir),z:In*Bn(Nr)}}function nr(Mn){return Mn>.0031308?1.055*Mn**.4166666666666667-.055:12.92*Mn}function ar(Mn,dr,br){const Ir=nr(3.2406*Mn+-1.5372*dr+-.4986*br),Nr=nr(-.9689*Mn+1.8758*dr+.0415*br),Yr=nr(.0557*Mn+-.204*dr+1.057*br);return{r:bn(255*Ir),g:bn(255*Nr),b:bn(255*Yr)}}function Sn(Mn,dr,br){const Ir=Zn(Mn,dr,br);return ar(Ir.x,Ir.y,Ir.z)}var Rn={};qt(Rn,{AbstractDistanceCalculator:()=>On,AbstractEuclidean:()=>kn,AbstractManhattan:()=>gr,CIE94GraphicArts:()=>vn,CIE94Textiles:()=>yn,CIEDE2000:()=>Un,CMetric:()=>Kn,Euclidean:()=>tr,EuclideanBT709:()=>or,EuclideanBT709NoAlpha:()=>Jn,Manhattan:()=>Er,ManhattanBT709:()=>Rr,ManhattanNommyde:()=>Sr,PNGQuant:()=>sr});var On=class{constructor(){Xt(this,"_maxDistance"),Xt(this,"_whitePoint"),this._setDefaults(),this.setWhitePoint(255,255,255,255)}setWhitePoint(Mn,dr,br,Ir){this._whitePoint={r:Mn>0?255/Mn:0,g:dr>0?255/dr:0,b:br>0?255/br:0,a:Ir>0?255/Ir:0},this._maxDistance=this.calculateRaw(Mn,dr,br,Ir,0,0,0,0)}calculateNormalized(Mn,dr){return this.calculateRaw(Mn.r,Mn.g,Mn.b,Mn.a,dr.r,dr.g,dr.b,dr.a)/this._maxDistance}},Vn=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){const qr=Pn(En(Mn*this._whitePoint.r),En(dr*this._whitePoint.g),En(br*this._whitePoint.b)),so=Pn(En(Nr*this._whitePoint.r),En(Yr*this._whitePoint.g),En(zr*this._whitePoint.b)),eo=qr.L-so.L,io=qr.a-so.a,yo=qr.b-so.b,Bo=Math.sqrt(qr.a*qr.a+qr.b*qr.b),Mo=Bo-Math.sqrt(so.a*so.a+so.b*so.b);let xo=io*io+yo*yo-Mo*Mo;xo=xo<0?0:Math.sqrt(xo);const wo=(_i-Ir)*this._whitePoint.a*this._kA;return Math.sqrt((eo/this._Kl)**2+(Mo/(1+this._K1*Bo))**2+(xo/(1+this._K2*Bo))**2+wo**2)}},yn=class extends Vn{_setDefaults(){this._Kl=2,this._K1=.048,this._K2=.014,this._kA=12.5/255}},vn=class extends Vn{_setDefaults(){this._Kl=1,this._K1=.045,this._K2=.015,this._kA=25/255}},wn=class extends On{_setDefaults(){}static _calculatehp(Mn,dr){const br=Math.atan2(Mn,dr);return br>=0?br:br+wn._deg360InRad}static _calculateRT(Mn,dr){const br=dr**7,Ir=2*Math.sqrt(br/(br+wn._pow25to7)),Nr=wn._deg30InRad*Math.exp(-(((Mn-wn._deg275InRad)/wn._deg25InRad)**2));return-Math.sin(2*Nr)*Ir}static _calculateT(Mn){return 1-.17*Math.cos(Mn-wn._deg30InRad)+.24*Math.cos(2*Mn)+.32*Math.cos(3*Mn+wn._deg6InRad)-.2*Math.cos(4*Mn-wn._deg63InRad)}static _calculate_ahp(Mn,dr,br,Ir){const Nr=br+Ir;return Mn===0?Nr:dr<=wn._deg180InRad?Nr/2:Nr>8)+4*eo*eo+((767-qr)*io*io>>8),Bo=(_i-Ir)*this._whitePoint.a;return Math.sqrt(yo+Bo*Bo)}_setDefaults(){}},kn=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){const qr=Nr-Mn,so=Yr-dr,eo=zr-br,io=_i-Ir;return Math.sqrt(this._kR*qr*qr+this._kG*so*so+this._kB*eo*eo+this._kA*io*io)}},tr=class extends kn{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},or=class extends kn{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},Jn=class extends kn{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=0}},gr=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){let qr=Nr-Mn,so=Yr-dr,eo=zr-br,io=_i-Ir;return qr<0&&(qr=0-qr),so<0&&(so=0-so),eo<0&&(eo=0-eo),io<0&&(io=0-io),this._kR*qr+this._kG*so+this._kB*eo+this._kA*io}},Er=class extends gr{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},Sr=class extends gr{_setDefaults(){this._kR=.4984,this._kG=.8625,this._kB=.2979,this._kA=1}},Rr=class extends gr{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},sr=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){const qr=(_i-Ir)*this._whitePoint.a;return this._colordifferenceCh(Mn*this._whitePoint.r,Nr*this._whitePoint.r,qr)+this._colordifferenceCh(dr*this._whitePoint.g,Yr*this._whitePoint.g,qr)+this._colordifferenceCh(br*this._whitePoint.b,zr*this._whitePoint.b,qr)}_colordifferenceCh(Mn,dr,br){const Ir=Mn-dr,Nr=Ir+br;return Ir*Ir+Nr*Nr}_setDefaults(){}},hr={};qt(hr,{AbstractPaletteQuantizer:()=>Tr,ColorHistogram:()=>no,NeuQuant:()=>ur,NeuQuantFloat:()=>to,RGBQuant:()=>Lr,WuColorCube:()=>Ao,WuQuant:()=>qo});var Tr=class{quantizeSync(){for(const Mn of this.quantize())if(Mn.palette)return Mn.palette;throw new Error("unreachable")}},Mr=class{constructor(){Xt(this,"r"),Xt(this,"g"),Xt(this,"b"),Xt(this,"a"),Xt(this,"uint32"),Xt(this,"rgba"),this.uint32=-1>>>0,this.r=this.g=this.b=this.a=0,this.rgba=new Array(4),this.rgba[0]=0,this.rgba[1]=0,this.rgba[2]=0,this.rgba[3]=0}static createByQuadruplet(Mn){const dr=new Mr;return dr.r=0|Mn[0],dr.g=0|Mn[1],dr.b=0|Mn[2],dr.a=0|Mn[3],dr._loadUINT32(),dr._loadQuadruplet(),dr}static createByRGBA(Mn,dr,br,Ir){const Nr=new Mr;return Nr.r=0|Mn,Nr.g=0|dr,Nr.b=0|br,Nr.a=0|Ir,Nr._loadUINT32(),Nr._loadQuadruplet(),Nr}static createByUint32(Mn){const dr=new Mr;return dr.uint32=Mn>>>0,dr._loadRGBA(),dr._loadQuadruplet(),dr}from(Mn){this.r=Mn.r,this.g=Mn.g,this.b=Mn.b,this.a=Mn.a,this.uint32=Mn.uint32,this.rgba[0]=Mn.r,this.rgba[1]=Mn.g,this.rgba[2]=Mn.b,this.rgba[3]=Mn.a}getLuminosity(Mn){let dr=this.r,br=this.g,Ir=this.b;return Mn&&(dr=Math.min(255,255-this.a+this.a*dr/255),br=Math.min(255,255-this.a+this.a*br/255),Ir=Math.min(255,255-this.a+this.a*Ir/255)),.2126*dr+.7152*br+.0722*Ir}_loadUINT32(){this.uint32=(this.a<<24|this.b<<16|this.g<<8|this.r)>>>0}_loadRGBA(){this.r=255&this.uint32,this.g=this.uint32>>>8&255,this.b=this.uint32>>>16&255,this.a=this.uint32>>>24&255}_loadQuadruplet(){this.rgba[0]=this.r,this.rgba[1]=this.g,this.rgba[2]=this.b,this.rgba[3]=this.a}},qn=class{constructor(){Xt(this,"_pointArray"),Xt(this,"_width"),Xt(this,"_height"),this._width=0,this._height=0,this._pointArray=[]}getWidth(){return this._width}getHeight(){return this._height}setWidth(Mn){this._width=Mn}setHeight(Mn){this._height=Mn}getPointArray(){return this._pointArray}clone(){const Mn=new qn;Mn._width=this._width,Mn._height=this._height;for(let dr=0,br=this._pointArray.length;dr=Nr&&Mn=0;dr--)if(Mn.uint32===this._pointArray[dr].uint32)return!0;return!1}getNearestColor(Mn,dr){return this._pointArray[0|this._getNearestIndex(Mn,dr)]}getPointContainer(){return this._pointContainer}_nearestPointFromCache(Mn){return typeof this._i32idx[Mn]=="number"?this._i32idx[Mn]:-1}_getNearestIndex(Mn,dr){let br=this._nearestPointFromCache(""+dr.uint32);if(br>=0)return br;let Ir=Number.MAX_VALUE;br=0;for(let Nr=0,Yr=this._pointArray.length;Nr{const br=Tn(Mn.r,Mn.g,Mn.b),Ir=Tn(dr.r,dr.g,dr.b),Nr=Mn.r===Mn.g&&Mn.g===Mn.b?0:1+Ln(br.h,10),Yr=(dr.r===dr.g&&dr.g===dr.b?0:1+Ln(Ir.h,10))-Nr;if(Yr)return-Yr;const zr=Mn.getLuminosity(!0),_i=dr.getLuminosity(!0);if(_i-zr!=0)return _i-zr;const qr=(100*Ir.s|0)-(100*br.s|0);return qr?-qr:0})}},ir={};qt(ir,{HueStatistics:()=>kr,Palette:()=>jn,Point:()=>Mr,PointContainer:()=>qn,ProgressTracker:()=>Wn,arithmetic:()=>dn});var mr=class{constructor(){Xt(this,"num",0),Xt(this,"cols",[])}},kr=class{constructor(Mn,dr){Xt(this,"_numGroups"),Xt(this,"_minCols"),Xt(this,"_stats"),Xt(this,"_groupsFull"),this._numGroups=Mn,this._minCols=dr,this._stats=[];for(let br=0;br<=Mn;br++)this._stats[br]=new mr;this._groupsFull=0}check(Mn){this._groupsFull===this._numGroups+1&&(this.check=()=>{});const dr=255&Mn,br=Mn>>>8&255,Ir=Mn>>>16&255,Nr=dr===br&&br===Ir?0:1+Ln(Tn(dr,br,Ir).h,this._numGroups),Yr=this._stats[Nr],zr=this._minCols;Yr.num++,Yr.num>zr||(Yr.num===zr&&this._groupsFull++,Yr.num<=zr&&this._stats[Nr].cols.push(Mn))}injectIntoDictionary(Mn){for(let dr=0;dr<=this._numGroups;dr++)this._stats[dr].num<=this._minCols&&this._stats[dr].cols.forEach(br=>{Mn[br]?Mn[br]++:Mn[br]=1})}injectIntoArray(Mn){for(let dr=0;dr<=this._numGroups;dr++)this._stats[dr].num<=this._minCols&&this._stats[dr].cols.forEach(br=>{Mn.indexOf(br)===-1&&Mn.push(br)})}},Cr=class{constructor(Mn,dr){Xt(this,"progress"),Xt(this,"_step"),Xt(this,"_range"),Xt(this,"_last"),Xt(this,"_progressRange"),this._range=Mn,this._progressRange=dr,this._step=Math.max(1,this._range/(Cr.steps+1)|0),this._last=-this._step,this.progress=0}shouldNotify(Mn){return Mn-this._last>=this._step&&(this._last=Mn,this.progress=Math.min(this._progressRange*this._last/this._range,this._progressRange),!0)}},Wn=Cr;Xt(Wn,"steps",100);var vr=class{constructor(Mn){Xt(this,"r"),Xt(this,"g"),Xt(this,"b"),Xt(this,"a"),this.r=this.g=this.b=this.a=Mn}toPoint(){return Mr.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(Mn,dr,br,Ir){this.r-=0|Mn,this.g-=0|dr,this.b-=0|br,this.a-=0|Ir}},Xn=class extends Tr{constructor(Mn,dr=256){super(),Xt(this,"_pointArray"),Xt(this,"_networkSize"),Xt(this,"_network"),Xt(this,"_sampleFactor"),Xt(this,"_radPower"),Xt(this,"_freq"),Xt(this,"_bias"),Xt(this,"_distance"),this._distance=Mn,this._pointArray=[],this._sampleFactor=1,this._networkSize=dr,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(Mn){this._pointArray=this._pointArray.concat(Mn.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let Mn=0;Mn>3)*Xn._radiusBias,qr=_i>>Xn._radiusBiasShift;qr<=1&&(qr=0);for(let eo=0;eo>>0;Nr=dr=dr&&(io-=dr),eo++,Yr===0&&(Yr=1),eo%Yr==0){zr-=zr/br|0,_i-=_i/Xn._radiusDecrease|0,qr=_i>>Xn._radiusBiasShift,qr<=1&&(qr=0);for(let rs=0;rs>>0}}}_buildPalette(){const Mn=new jn;return this._network.forEach(dr=>{Mn.add(dr.toPoint())}),Mn.sort(),Mn}_alterNeighbour(Mn,dr,br,Ir,Nr,Yr){let zr=dr-Mn;zr<-1&&(zr=-1);let _i=dr+Mn;_i>this._networkSize&&(_i=this._networkSize);let qr=dr+1,so=dr-1,eo=1;for(;qr<_i||so>zr;){const io=this._radPower[eo++]/Xn._alphaRadBias;if(qr<_i){const yo=this._network[qr++];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}if(so>zr){const yo=this._network[so--];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}}}_alterSingle(Mn,dr,br,Ir,Nr,Yr){Mn/=Xn._initAlpha;const zr=this._network[dr];zr.subtract(Mn*(zr.r-Nr),Mn*(zr.g-Ir),Mn*(zr.b-br),Mn*(zr.a-Yr))}_contest(Mn,dr,br,Ir){let Nr=2147483647,Yr=Nr,zr=-1,_i=zr;for(let qr=0;qr>Xn._initialBiasShift-3);io>Xn._betaShift;this._freq[qr]-=yo,this._bias[qr]+=yo<>Xn._betaShift),Xt(ur,"_betaGamma",Xn._initialBias<>3,this.g>>3,this.b>>3,this.a>>3)}subtract(Mn,dr,br,Ir){this.r-=Mn,this.g-=dr,this.b-=br,this.a-=Ir}},Or=class extends Tr{constructor(Mn,dr=256){super(),Xt(this,"_pointArray"),Xt(this,"_networkSize"),Xt(this,"_network"),Xt(this,"_sampleFactor"),Xt(this,"_radPower"),Xt(this,"_freq"),Xt(this,"_bias"),Xt(this,"_distance"),this._distance=Mn,this._pointArray=[],this._sampleFactor=1,this._networkSize=dr,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(Mn){this._pointArray=this._pointArray.concat(Mn.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let Mn=0;Mn>3)*Or._radiusBias,qr=_i>>Or._radiusBiasShift;qr<=1&&(qr=0);for(let eo=0;eo=dr&&(io-=dr),eo++,Yr===0&&(Yr=1),eo%Yr==0){zr-=zr/br,_i-=_i/Or._radiusDecrease,qr=_i>>Or._radiusBiasShift,qr<=1&&(qr=0);for(let rs=0;rs{Mn.add(dr.toPoint())}),Mn.sort(),Mn}_alterNeighbour(Mn,dr,br,Ir,Nr,Yr){let zr=dr-Mn;zr<-1&&(zr=-1);let _i=dr+Mn;_i>this._networkSize&&(_i=this._networkSize);let qr=dr+1,so=dr-1,eo=1;for(;qr<_i||so>zr;){const io=this._radPower[eo++]/Or._alphaRadBias;if(qr<_i){const yo=this._network[qr++];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}if(so>zr){const yo=this._network[so--];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}}}_alterSingle(Mn,dr,br,Ir,Nr,Yr){Mn/=Or._initAlpha;const zr=this._network[dr];zr.subtract(Mn*(zr.r-Nr),Mn*(zr.g-Ir),Mn*(zr.b-br),Mn*(zr.a-Yr))}_contest(Mn,dr,br,Ir){let Nr=2147483647,Yr=Nr,zr=-1,_i=zr;for(let qr=0;qr>Or._initialBiasShift-3);io>Or._betaShift;this._freq[qr]-=yo,this._bias[qr]+=yo<>Or._betaShift),Xt(to,"_betaGamma",Or._initialBias<this._histogram[Ir]-this._histogram[br]);if(Mn.length===0)return[];let dr;switch(this._method){case 1:const br=Math.min(Mn.length,this._initColors),Ir=Mn[br-1],Nr=this._histogram[Ir];dr=Mn.slice(0,br);let Yr=br;const zr=Mn.length;for(;Yr+br)}_colorStats1D(Mn){const dr=this._histogram,br=Mn.getPointArray(),Ir=br.length;for(let Nr=0;Nr{let eo=Math.round(so.w*so.h/zr)*Gr._boxPixels;eo<2&&(eo=2);const io={};this._iterateBox(so,dr,yo=>{const Bo=Ir[yo].uint32;this._hueStats.check(Bo),Bo in qr?qr[Bo]++:Bo in io?++io[Bo]>=eo&&(qr[Bo]=io[Bo]):io[Bo]=1})}),this._hueStats.injectIntoDictionary(qr)}_iterateBox(Mn,dr,br){const Ir=Mn,Nr=Ir.y*dr+Ir.x,Yr=(Ir.y+Ir.h-1)*dr+(Ir.x+Ir.w-1),zr=dr-Ir.w+1;let _i=0,qr=Nr;do br.call(this,qr),qr+=++_i%Ir.w==0?zr:1;while(qr<=Yr)}_makeBoxes(Mn,dr,br,Ir){const Nr=Mn%br,Yr=dr%Ir,zr=Mn-Nr,_i=dr-Yr,qr=[];for(let so=0;sothis._colors;){Yr.length=0;for(let eo=0;eo3*this._colors?this._initialDistance:this._distanceIncrement}if(zryo.distance-io.distance);let eo=0;for(;zr=0;eo--)Ir[eo]===0&&(eo!==so-1&&(br[eo]=br[so-1]),--so);br.length=so,dr.sort(),yield{palette:dr,progress:100}}};function lo(Mn){const dr=[];for(let br=0;br0){const br=this._sums[dr],Ir=this._reds[dr]/br,Nr=this._greens[dr]/br,Yr=this._blues[dr]/br,zr=this._alphas[dr]/br,_i=Mr.createByRGBA(0|Ir,0|Nr,0|Yr,0|zr);Mn.add(_i)}Mn.sort(),yield{palette:Mn,progress:100}}*_preparePalette(){yield*this._calculateMoments();let Mn=0;const dr=lo(this._colors);for(let zr=1;zr1?this._calculateVariance(this._cubes[Mn]):0,dr[zr]=this._cubes[zr].volume>1?this._calculateVariance(this._cubes[zr]):0):(dr[Mn]=0,zr--),Mn=0;let _i=dr[0];for(let qr=1;qr<=zr;++qr)dr[qr]>_i&&(_i=dr[qr],Mn=qr);if(_i<=0){this._colors=zr+1;break}}const br=[],Ir=[],Nr=[],Yr=[];for(let zr=0;zr0?(br[zr]=ho._volume(this._cubes[zr],this._momentsRed)/_i|0,Ir[zr]=ho._volume(this._cubes[zr],this._momentsGreen)/_i|0,Nr[zr]=ho._volume(this._cubes[zr],this._momentsBlue)/_i|0,Yr[zr]=ho._volume(this._cubes[zr],this._momentsAlpha)/_i|0):(br[zr]=0,Ir[zr]=0,Nr[zr]=0,Yr[zr]=0)}this._reds=lo(this._colors+1),this._greens=lo(this._colors+1),this._blues=lo(this._colors+1),this._alphas=lo(this._colors+1),this._sums=lo(this._colors+1);for(let zr=0,_i=this._pixels.length;zr<_i;zr++){const qr=this._pixels[zr];let so=-1,eo=Number.MAX_VALUE;for(let io=0;io>dr),Ir=1+(Mn.g>>dr),Nr=1+(Mn.b>>dr),Yr=1+(Mn.a>>dr);this._weights[Yr][br][Ir][Nr]++,this._momentsRed[Yr][br][Ir][Nr]+=Mn.r,this._momentsGreen[Yr][br][Ir][Nr]+=Mn.g,this._momentsBlue[Yr][br][Ir][Nr]+=Mn.b,this._momentsAlpha[Yr][br][Ir][Nr]+=Mn.a,this._moments[Yr][br][Ir][Nr]+=this._table[Mn.r]+this._table[Mn.g]+this._table[Mn.b]+this._table[Mn.a]}*_calculateMoments(){const Mn=[],dr=[],br=[],Ir=[],Nr=[],Yr=[],zr=ao(this._sideSize,this._sideSize,this._sideSize),_i=ao(this._sideSize,this._sideSize,this._sideSize),qr=ao(this._sideSize,this._sideSize,this._sideSize),so=ao(this._sideSize,this._sideSize,this._sideSize),eo=ao(this._sideSize,this._sideSize,this._sideSize),io=ao(this._sideSize,this._sideSize,this._sideSize);let yo=0;const Bo=new Wn(this._alphaMaxSideIndex*this._maxSideIndex,99);for(let Mo=1;Mo<=this._alphaMaxSideIndex;++Mo){Ro(zr,this._sideSize,this._sideSize,this._sideSize,0),Ro(_i,this._sideSize,this._sideSize,this._sideSize,0),Ro(qr,this._sideSize,this._sideSize,this._sideSize,0),Ro(so,this._sideSize,this._sideSize,this._sideSize,0),Ro(eo,this._sideSize,this._sideSize,this._sideSize,0),Ro(io,this._sideSize,this._sideSize,this._sideSize,0);for(let xo=1;xo<=this._maxSideIndex;++xo,++yo){Bo.shouldNotify(yo)&&(yield{progress:Bo.progress}),Xo(Mn,this._sideSize,0),Xo(dr,this._sideSize,0),Xo(br,this._sideSize,0),Xo(Ir,this._sideSize,0),Xo(Nr,this._sideSize,0),Xo(Yr,this._sideSize,0);for(let wo=1;wo<=this._maxSideIndex;++wo){let os=0,rs=0,xs=0,fs=0,Ds=0,ms=0;for(let Po=1;Po<=this._maxSideIndex;++Po)os+=this._weights[Mo][xo][wo][Po],rs+=this._momentsRed[Mo][xo][wo][Po],xs+=this._momentsGreen[Mo][xo][wo][Po],fs+=this._momentsBlue[Mo][xo][wo][Po],Ds+=this._momentsAlpha[Mo][xo][wo][Po],ms+=this._moments[Mo][xo][wo][Po],Mn[Po]+=os,dr[Po]+=rs,br[Po]+=xs,Ir[Po]+=fs,Nr[Po]+=Ds,Yr[Po]+=ms,zr[xo][wo][Po]=zr[xo-1][wo][Po]+Mn[Po],_i[xo][wo][Po]=_i[xo-1][wo][Po]+dr[Po],qr[xo][wo][Po]=qr[xo-1][wo][Po]+br[Po],so[xo][wo][Po]=so[xo-1][wo][Po]+Ir[Po],eo[xo][wo][Po]=eo[xo-1][wo][Po]+Nr[Po],io[xo][wo][Po]=io[xo-1][wo][Po]+Yr[Po],this._weights[Mo][xo][wo][Po]=this._weights[Mo-1][xo][wo][Po]+zr[xo][wo][Po],this._momentsRed[Mo][xo][wo][Po]=this._momentsRed[Mo-1][xo][wo][Po]+_i[xo][wo][Po],this._momentsGreen[Mo][xo][wo][Po]=this._momentsGreen[Mo-1][xo][wo][Po]+qr[xo][wo][Po],this._momentsBlue[Mo][xo][wo][Po]=this._momentsBlue[Mo-1][xo][wo][Po]+so[xo][wo][Po],this._momentsAlpha[Mo][xo][wo][Po]=this._momentsAlpha[Mo-1][xo][wo][Po]+eo[xo][wo][Po],this._moments[Mo][xo][wo][Po]=this._moments[Mo-1][xo][wo][Po]+io[xo][wo][Po]}}}}static _volumeFloat(Mn,dr){return dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]-dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]-dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]+dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]+dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]+dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]-dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]-dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]-dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]-dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]-dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum])}static _volume(Mn,dr){return 0|ho._volumeFloat(Mn,dr)}static _top(Mn,dr,br,Ir){let Nr;switch(dr){case ho._alpha:Nr=Ir[br][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]-Ir[br][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]-Ir[br][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]+Ir[br][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(Ir[br][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]-Ir[br][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]-Ir[br][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+Ir[br][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);break;case ho._red:Nr=Ir[Mn.alphaMaximum][br][Mn.greenMaximum][Mn.blueMaximum]-Ir[Mn.alphaMaximum][br][Mn.greenMinimum][Mn.blueMaximum]-Ir[Mn.alphaMinimum][br][Mn.greenMaximum][Mn.blueMaximum]+Ir[Mn.alphaMinimum][br][Mn.greenMinimum][Mn.blueMaximum]-(Ir[Mn.alphaMaximum][br][Mn.greenMaximum][Mn.blueMinimum]-Ir[Mn.alphaMaximum][br][Mn.greenMinimum][Mn.blueMinimum]-Ir[Mn.alphaMinimum][br][Mn.greenMaximum][Mn.blueMinimum]+Ir[Mn.alphaMinimum][br][Mn.greenMinimum][Mn.blueMinimum]);break;case ho._green:Nr=Ir[Mn.alphaMaximum][Mn.redMaximum][br][Mn.blueMaximum]-Ir[Mn.alphaMaximum][Mn.redMinimum][br][Mn.blueMaximum]-Ir[Mn.alphaMinimum][Mn.redMaximum][br][Mn.blueMaximum]+Ir[Mn.alphaMinimum][Mn.redMinimum][br][Mn.blueMaximum]-(Ir[Mn.alphaMaximum][Mn.redMaximum][br][Mn.blueMinimum]-Ir[Mn.alphaMaximum][Mn.redMinimum][br][Mn.blueMinimum]-Ir[Mn.alphaMinimum][Mn.redMaximum][br][Mn.blueMinimum]+Ir[Mn.alphaMinimum][Mn.redMinimum][br][Mn.blueMinimum]);break;case ho._blue:Nr=Ir[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][br]-Ir[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][br]-Ir[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][br]+Ir[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][br]-(Ir[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][br]-Ir[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][br]-Ir[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][br]+Ir[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][br]);break;default:throw new Error("impossible")}return 0|Nr}static _bottom(Mn,dr,br){switch(dr){case ho._alpha:return-br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(-br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);case ho._red:return-br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(-br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);case ho._green:return-br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(-br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);case ho._blue:return-br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]-(-br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);default:return 0}}_calculateVariance(Mn){const dr=ho._volume(Mn,this._momentsRed),br=ho._volume(Mn,this._momentsGreen),Ir=ho._volume(Mn,this._momentsBlue),Nr=ho._volume(Mn,this._momentsAlpha);return ho._volumeFloat(Mn,this._moments)-(dr*dr+br*br+Ir*Ir+Nr*Nr)/ho._volume(Mn,this._weights)}_maximize(Mn,dr,br,Ir,Nr,Yr,zr,_i,qr){const so=0|ho._bottom(Mn,dr,this._momentsRed),eo=0|ho._bottom(Mn,dr,this._momentsGreen),io=0|ho._bottom(Mn,dr,this._momentsBlue),yo=0|ho._bottom(Mn,dr,this._momentsAlpha),Bo=0|ho._bottom(Mn,dr,this._weights);let Mo=0,xo=-1;for(let wo=br;woMo&&(Mo=Po,xo=wo))}}return{max:Mo,position:xo}}_cut(Mn,dr){let br;const Ir=ho._volume(Mn,this._momentsRed),Nr=ho._volume(Mn,this._momentsGreen),Yr=ho._volume(Mn,this._momentsBlue),zr=ho._volume(Mn,this._momentsAlpha),_i=ho._volume(Mn,this._weights),qr=this._maximize(Mn,ho._red,Mn.redMinimum+1,Mn.redMaximum,Ir,Nr,Yr,zr,_i),so=this._maximize(Mn,ho._green,Mn.greenMinimum+1,Mn.greenMaximum,Ir,Nr,Yr,zr,_i),eo=this._maximize(Mn,ho._blue,Mn.blueMinimum+1,Mn.blueMaximum,Ir,Nr,Yr,zr,_i),io=this._maximize(Mn,ho._alpha,Mn.alphaMinimum+1,Mn.alphaMaximum,Ir,Nr,Yr,zr,_i);if(io.max>=qr.max&&io.max>=so.max&&io.max>=eo.max){if(br=ho._alpha,io.position<0)return!1}else br=qr.max>=io.max&&qr.max>=so.max&&qr.max>=eo.max?ho._red:so.max>=io.max&&so.max>=qr.max&&so.max>=eo.max?ho._green:ho._blue;switch(dr.redMaximum=Mn.redMaximum,dr.greenMaximum=Mn.greenMaximum,dr.blueMaximum=Mn.blueMaximum,dr.alphaMaximum=Mn.alphaMaximum,br){case ho._red:dr.redMinimum=Mn.redMaximum=qr.position,dr.greenMinimum=Mn.greenMinimum,dr.blueMinimum=Mn.blueMinimum,dr.alphaMinimum=Mn.alphaMinimum;break;case ho._green:dr.greenMinimum=Mn.greenMaximum=so.position,dr.redMinimum=Mn.redMinimum,dr.blueMinimum=Mn.blueMinimum,dr.alphaMinimum=Mn.alphaMinimum;break;case ho._blue:dr.blueMinimum=Mn.blueMaximum=eo.position,dr.redMinimum=Mn.redMinimum,dr.greenMinimum=Mn.greenMinimum,dr.alphaMinimum=Mn.alphaMinimum;break;case ho._alpha:dr.alphaMinimum=Mn.alphaMaximum=io.position,dr.blueMinimum=Mn.blueMinimum,dr.redMinimum=Mn.redMinimum,dr.greenMinimum=Mn.greenMinimum}return Mn.volume=(Mn.redMaximum-Mn.redMinimum)*(Mn.greenMaximum-Mn.greenMinimum)*(Mn.blueMaximum-Mn.blueMinimum)*(Mn.alphaMaximum-Mn.alphaMinimum),dr.volume=(dr.redMaximum-dr.redMinimum)*(dr.greenMaximum-dr.greenMinimum)*(dr.blueMaximum-dr.blueMinimum)*(dr.alphaMaximum-dr.alphaMinimum),!0}_initialize(Mn){this._colors=Mn,this._cubes=[];for(let dr=0;drJo,ErrorDiffusionArray:()=>Qo,ErrorDiffusionArrayKernel:()=>Ko,ErrorDiffusionRiemersma:()=>ss,NearestColor:()=>as});var Jo=class{quantizeSync(Mn,dr){for(const br of this.quantize(Mn,dr))if(br.pointContainer)return br.pointContainer;throw new Error("unreachable")}},as=class extends Jo{constructor(Mn){super(),Xt(this,"_distance"),this._distance=Mn}*quantize(Mn,dr){const br=Mn.getPointArray(),Ir=Mn.getWidth(),Nr=Mn.getHeight(),Yr=new Wn(Nr,99);for(let zr=0;zr(Mn[Mn.FloydSteinberg=0]="FloydSteinberg",Mn[Mn.FalseFloydSteinberg=1]="FalseFloydSteinberg",Mn[Mn.Stucki=2]="Stucki",Mn[Mn.Atkinson=3]="Atkinson",Mn[Mn.Jarvis=4]="Jarvis",Mn[Mn.Burkes=5]="Burkes",Mn[Mn.Sierra=6]="Sierra",Mn[Mn.TwoSierra=7]="TwoSierra",Mn[Mn.SierraLite=8]="SierraLite",Mn))(Ko||{}),Qo=class extends Jo{constructor(Mn,dr,br=!0,Ir=0,Nr=!1){super(),Xt(this,"_minColorDistance"),Xt(this,"_serpentine"),Xt(this,"_kernel"),Xt(this,"_calculateErrorLikeGIMP"),Xt(this,"_distance"),this._setKernel(dr),this._distance=Mn,this._minColorDistance=Ir,this._serpentine=br,this._calculateErrorLikeGIMP=Nr}*quantize(Mn,dr){const br=Mn.getPointArray(),Ir=new Mr,Nr=Mn.getWidth(),Yr=Mn.getHeight(),zr=[];let _i=1,qr=1;for(const eo of this._kernel){const io=eo[2]+1;qr=0&&vu+xo=0&&Gs+eodr&&(Mn.length=dr);const br=Mn.length;for(let Ir=0;Ir=0&&Mn.x=0&&Mn.y{const so=br[_i+qr*Ir];let{r:eo,g:io,b:yo,a:Bo}=so;for(let os=0;osSs});var vs=.01,ks=.03;function Ss(Mn,dr){if(Mn.getHeight()!==dr.getHeight()||Mn.getWidth()!==dr.getWidth())throw new Error("Images have different sizes!");const br=(255*vs)**2,Ir=(255*ks)**2;let Nr=0,Yr=0;return function(zr,_i,qr){const so=zr.getWidth(),eo=zr.getHeight();for(let io=0;io{let eo=0,io=0,yo=0;for(let Mo=0;MoNt.nextTick(Mn):Mn=>setTimeout(Mn,0);function bs(Mn,{colorDistanceFormula:dr,paletteQuantization:br,colors:Ir}={}){const Nr=Eu(na(dr),br,Ir);return Mn.forEach(Yr=>Nr.sample(Yr)),Nr.quantizeSync()}async function _u(Mn,{colorDistanceFormula:dr,paletteQuantization:br,colors:Ir,onProgress:Nr}={}){return new Promise((Yr,zr)=>{const _i=Eu(na(dr),br,Ir);let qr;Mn.forEach(io=>_i.sample(io));const so=_i.quantize(),eo=()=>{try{const io=so.next();io.done?Yr(qr):(io.value.palette&&(qr=io.value.palette),Nr&&Nr(io.value.progress),Fo(eo))}catch(io){zr(io)}};Fo(eo)})}function Ml(Mn,dr,{colorDistanceFormula:br,imageQuantization:Ir}={}){return yu(na(br),Ir).quantizeSync(Mn,dr)}async function wu(Mn,dr,{colorDistanceFormula:br,imageQuantization:Ir,onProgress:Nr}={}){return new Promise((Yr,zr)=>{let _i;const qr=yu(na(br),Ir).quantize(Mn,dr),so=()=>{try{const eo=qr.next();eo.done?Yr(_i):(eo.value.pointContainer&&(_i=eo.value.pointContainer),Nr&&Nr(eo.value.progress),Fo(so))}catch(eo){zr(eo)}};Fo(so)})}function na(Mn="euclidean-bt709"){switch(Mn){case"cie94-graphic-arts":return new vn;case"cie94-textiles":return new yn;case"ciede2000":return new Un;case"color-metric":return new Kn;case"euclidean":return new tr;case"euclidean-bt709":return new or;case"euclidean-bt709-noalpha":return new Jn;case"manhattan":return new Er;case"manhattan-bt709":return new Rr;case"manhattan-nommyde":return new Sr;case"pngquant":return new sr;default:throw new Error(`Unknown colorDistanceFormula ${Mn}`)}}function yu(Mn,dr="floyd-steinberg"){switch(dr){case"nearest":return new as(Mn);case"riemersma":return new ss(Mn);case"floyd-steinberg":return new Qo(Mn,0);case"false-floyd-steinberg":return new Qo(Mn,1);case"stucki":return new Qo(Mn,2);case"atkinson":return new Qo(Mn,3);case"jarvis":return new Qo(Mn,4);case"burkes":return new Qo(Mn,5);case"sierra":return new Qo(Mn,6);case"two-sierra":return new Qo(Mn,7);case"sierra-lite":return new Qo(Mn,8);default:throw new Error(`Unknown imageQuantization ${dr}`)}}function Eu(Mn,dr="wuquant",br=256){switch(dr){case"neuquant":return new ur(Mn,br);case"rgbquant":return new Lr(Mn,br);case"wuquant":return new qo(Mn,br);case"neuquant-float":return new to(Mn,br);default:throw new Error(`Unknown paletteQuantization ${dr}`)}}_e.exports=Yt(Zt)}},__webpack_module_cache__={};function __webpack_require__(_e){var Pt=__webpack_module_cache__[_e];if(Pt!==void 0)return Pt.exports;var Dt=__webpack_module_cache__[_e]={exports:{}};return __webpack_modules__[_e](Dt,Dt.exports,__webpack_require__),Dt.exports}__webpack_require__.n=_e=>{var Pt=_e&&_e.__esModule?()=>_e.default:()=>_e;return __webpack_require__.d(Pt,{a:Pt}),Pt},__webpack_require__.d=(_e,Pt)=>{for(var Dt in Pt)__webpack_require__.o(Pt,Dt)&&!__webpack_require__.o(_e,Dt)&&Object.defineProperty(_e,Dt,{enumerable:!0,get:Pt[Dt]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(_e,Pt)=>Object.prototype.hasOwnProperty.call(_e,Pt),__webpack_require__.r=_e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(_e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_e,"__esModule",{value:!0})},(()=>{var _e={};__webpack_require__.r(_e),__webpack_require__.d(_e,{AUTO:()=>gr,BLEND_ADD:()=>jn,BLEND_DARKEN:()=>kr,BLEND_DESTINATION_OVER:()=>qn,BLEND_DIFFERENCE:()=>vr,BLEND_EXCLUSION:()=>Xn,BLEND_HARDLIGHT:()=>Wn,BLEND_LIGHTEN:()=>Cr,BLEND_MULTIPLY:()=>Ln,BLEND_OVERLAY:()=>mr,BLEND_SCREEN:()=>ir,BLEND_SOURCE_OVER:()=>Mr,EDGE_CROP:()=>Or,EDGE_EXTEND:()=>ur,EDGE_WRAP:()=>Wr,HORIZONTAL_ALIGN_CENTER:()=>Sr,HORIZONTAL_ALIGN_LEFT:()=>Er,HORIZONTAL_ALIGN_RIGHT:()=>Rr,VERTICAL_ALIGN_BOTTOM:()=>Tr,VERTICAL_ALIGN_MIDDLE:()=>hr,VERTICAL_ALIGN_TOP:()=>sr});var Pt={};__webpack_require__.r(Pt),__webpack_require__.d(Pt,{add:()=>Hr,darken:()=>uo,difference:()=>Xo,dstOver:()=>Gr,exclusion:()=>Ao,hardLight:()=>Ro,lighten:()=>ao,multiply:()=>no,overlay:()=>lo,screen:()=>Lr,srcOver:()=>to});var Dt=__webpack_require__(5546),Nt=__webpack_require__.n(Dt),jt=__webpack_require__(1023),Ut=__webpack_require__.n(jt),Gt=__webpack_require__(2699),Wt=__webpack_require__.n(Gt);function qt(Fn){if(Fn===void 0)return!1;if(typeof Fn!="function")throw new TypeError("Callback must be a function");return!0}function Yt(Fn,zn){if(typeof Fn=="string"&&(Fn=new Error(Fn)),typeof zn=="function")return zn.call(this,Fn);throw Fn}function Xt(Fn,zn,er,rr,lr,fr){zn=Math.round(zn),er=Math.round(er),rr=Math.round(rr),lr=Math.round(lr);for(let wr=er;wr1&&(ba-=1),ba<1/6?Vo+6*(es-Vo)*ba:ba<.5?es:ba<2/3?Vo+(es-Vo)*(2/3-ba)*6:Vo}if(Xr=Bn(Xr,360),Kr=Bn(Kr,100),Qr=Bn(Qr,100),Kr===0)fo=_o=jo=Qr;else{var Oo=Qr<.5?Qr*(1+Kr):Qr+Kr-Qr*Kr,Zo=2*Qr-Oo;fo=Yo(Zo,Oo,Xr+1/3),_o=Yo(Zo,Oo,Xr),jo=Yo(Zo,Oo,Xr-1/3)}return{r:255*fo,g:255*_o,b:255*jo}}(rr.h,Fr,Vr),co=!0,Jr="hsl"),rr.hasOwnProperty("a")&&($r=rr.a)),$r=In($r),{ok:co,format:rr.format||Jr,r:Math.min(255,Math.max(_r.r,0)),g:Math.min(255,Math.max(_r.g,0)),b:Math.min(255,Math.max(_r.b,0)),a:$r}}(Fn);this._originalInput=Fn,this._r=er.r,this._g=er.g,this._b=er.b,this._a=er.a,this._roundA=Math.round(100*this._a)/100,this._format=zn.format||er.format,this._gradientType=zn.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=er.ok}function ln(Fn,zn,er){Fn=Bn(Fn,255),zn=Bn(zn,255),er=Bn(er,255);var rr,lr,fr=Math.max(Fn,zn,er),wr=Math.min(Fn,zn,er),_r=(fr+wr)/2;if(fr==wr)rr=lr=0;else{var $r=fr-wr;switch(lr=_r>.5?$r/(2-fr-wr):$r/(fr+wr),fr){case Fn:rr=(zn-er)/$r+(zn>1)+720)%360;--zn;)rr.h=(rr.h+lr)%360,fr.push(sn(rr));return fr}function Pn(Fn,zn){zn=zn||6;for(var er=sn(Fn).toHsv(),rr=er.h,lr=er.s,fr=er.v,wr=[],_r=1/zn;zn--;)wr.push(sn({h:rr,s:lr,v:fr})),fr=(fr+_r)%1;return wr}sn.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var Fn=this.toRgb();return(299*Fn.r+587*Fn.g+114*Fn.b)/1e3},getLuminance:function(){var Fn,zn,er,rr=this.toRgb();return Fn=rr.r/255,zn=rr.g/255,er=rr.b/255,.2126*(Fn<=.03928?Fn/12.92:Math.pow((Fn+.055)/1.055,2.4))+.7152*(zn<=.03928?zn/12.92:Math.pow((zn+.055)/1.055,2.4))+.0722*(er<=.03928?er/12.92:Math.pow((er+.055)/1.055,2.4))},setAlpha:function(Fn){return this._a=In(Fn),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var Fn=dn(this._r,this._g,this._b);return{h:360*Fn.h,s:Fn.s,v:Fn.v,a:this._a}},toHsvString:function(){var Fn=dn(this._r,this._g,this._b),zn=Math.round(360*Fn.h),er=Math.round(100*Fn.s),rr=Math.round(100*Fn.v);return this._a==1?"hsv("+zn+", "+er+"%, "+rr+"%)":"hsva("+zn+", "+er+"%, "+rr+"%, "+this._roundA+")"},toHsl:function(){var Fn=ln(this._r,this._g,this._b);return{h:360*Fn.h,s:Fn.s,l:Fn.l,a:this._a}},toHslString:function(){var Fn=ln(this._r,this._g,this._b),zn=Math.round(360*Fn.h),er=Math.round(100*Fn.s),rr=Math.round(100*Fn.l);return this._a==1?"hsl("+zn+", "+er+"%, "+rr+"%)":"hsla("+zn+", "+er+"%, "+rr+"%, "+this._roundA+")"},toHex:function(Fn){return mn(this._r,this._g,this._b,Fn)},toHexString:function(Fn){return"#"+this.toHex(Fn)},toHex8:function(Fn){return function(zn,er,rr,lr,fr){var wr=[ar(Math.round(zn).toString(16)),ar(Math.round(er).toString(16)),ar(Math.round(rr).toString(16)),ar(Rn(lr))];return fr&&wr[0].charAt(0)==wr[0].charAt(1)&&wr[1].charAt(0)==wr[1].charAt(1)&&wr[2].charAt(0)==wr[2].charAt(1)&&wr[3].charAt(0)==wr[3].charAt(1)?wr[0].charAt(0)+wr[1].charAt(0)+wr[2].charAt(0)+wr[3].charAt(0):wr.join("")}(this._r,this._g,this._b,this._a,Fn)},toHex8String:function(Fn){return"#"+this.toHex8(Fn)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*Bn(this._r,255))+"%",g:Math.round(100*Bn(this._g,255))+"%",b:Math.round(100*Bn(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(100*Bn(this._r,255))+"%, "+Math.round(100*Bn(this._g,255))+"%, "+Math.round(100*Bn(this._b,255))+"%)":"rgba("+Math.round(100*Bn(this._r,255))+"%, "+Math.round(100*Bn(this._g,255))+"%, "+Math.round(100*Bn(this._b,255))+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":!(this._a<1)&&(Gn[mn(this._r,this._g,this._b,!0)]||!1)},toFilter:function(Fn){var zn="#"+gn(this._r,this._g,this._b,this._a),er=zn,rr=this._gradientType?"GradientType = 1, ":"";if(Fn){var lr=sn(Fn);er="#"+gn(lr._r,lr._g,lr._b,lr._a)}return"progid:DXImageTransform.Microsoft.gradient("+rr+"startColorstr="+zn+",endColorstr="+er+")"},toString:function(Fn){var zn=!!Fn;Fn=Fn||this._format;var er=!1,rr=this._a<1&&this._a>=0;return zn||!rr||Fn!=="hex"&&Fn!=="hex6"&&Fn!=="hex3"&&Fn!=="hex4"&&Fn!=="hex8"&&Fn!=="name"?(Fn==="rgb"&&(er=this.toRgbString()),Fn==="prgb"&&(er=this.toPercentageRgbString()),Fn!=="hex"&&Fn!=="hex6"||(er=this.toHexString()),Fn==="hex3"&&(er=this.toHexString(!0)),Fn==="hex4"&&(er=this.toHex8String(!0)),Fn==="hex8"&&(er=this.toHex8String()),Fn==="name"&&(er=this.toName()),Fn==="hsl"&&(er=this.toHslString()),Fn==="hsv"&&(er=this.toHsvString()),er||this.toHexString()):Fn==="name"&&this._a===0?this.toName():this.toRgbString()},clone:function(){return sn(this.toString())},_applyModification:function(Fn,zn){var er=Fn.apply(null,[this].concat([].slice.call(zn)));return this._r=er._r,this._g=er._g,this._b=er._b,this.setAlpha(er._a),this},lighten:function(){return this._applyModification(En,arguments)},brighten:function(){return this._applyModification(_n,arguments)},darken:function(){return this._applyModification(Tn,arguments)},desaturate:function(){return this._applyModification(un,arguments)},saturate:function(){return this._applyModification(hn,arguments)},greyscale:function(){return this._applyModification(bn,arguments)},spin:function(){return this._applyModification($n,arguments)},_applyCombination:function(Fn,zn){return Fn.apply(null,[this].concat([].slice.call(zn)))},analogous:function(){return this._applyCombination(Dn,arguments)},complement:function(){return this._applyCombination(pn,arguments)},monochromatic:function(){return this._applyCombination(Pn,arguments)},splitcomplement:function(){return this._applyCombination(An,arguments)},triad:function(){return this._applyCombination(Nn,[3])},tetrad:function(){return this._applyCombination(Nn,[4])}},sn.fromRatio=function(Fn,zn){if(nn(Fn)=="object"){var er={};for(var rr in Fn)Fn.hasOwnProperty(rr)&&(er[rr]=rr==="a"?Fn[rr]:Sn(Fn[rr]));Fn=er}return sn(Fn,zn)},sn.equals=function(Fn,zn){return!(!Fn||!zn)&&sn(Fn).toRgbString()==sn(zn).toRgbString()},sn.random=function(){return sn.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},sn.mix=function(Fn,zn,er){er=er===0?0:er||50;var rr=sn(Fn).toRgb(),lr=sn(zn).toRgb(),fr=er/100;return sn({r:(lr.r-rr.r)*fr+rr.r,g:(lr.g-rr.g)*fr+rr.g,b:(lr.b-rr.b)*fr+rr.b,a:(lr.a-rr.a)*fr+rr.a})},sn.readability=function(Fn,zn){var er=sn(Fn),rr=sn(zn);return(Math.max(er.getLuminance(),rr.getLuminance())+.05)/(Math.min(er.getLuminance(),rr.getLuminance())+.05)},sn.isReadable=function(Fn,zn,er){var rr,lr,fr,wr,_r,$r=sn.readability(Fn,zn);switch(lr=!1,(fr=er,(wr=((fr=fr||{level:"AA",size:"small"}).level||"AA").toUpperCase())!=="AA"&&wr!=="AAA"&&(wr="AA"),(_r=(fr.size||"small").toLowerCase())!=="small"&&_r!=="large"&&(_r="small"),rr={level:wr,size:_r}).level+rr.size){case"AAsmall":case"AAAlarge":lr=$r>=4.5;break;case"AAlarge":lr=$r>=3;break;case"AAAsmall":lr=$r>=7}return lr},sn.mostReadable=function(Fn,zn,er){var rr,lr,fr,wr,_r=null,$r=0;lr=(er=er||{}).includeFallbackColors,fr=er.level,wr=er.size;for(var Fr=0;Fr$r&&($r=rr,_r=sn(zn[Fr]));return sn.isReadable(Fn,_r,{level:fr,size:wr})||!lr?_r:(er.includeFallbackColors=!1,sn.mostReadable(Fn,["#fff","#000"],er))};var Cn=sn.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Gn=sn.hexNames=function(Fn){var zn={};for(var er in Fn)Fn.hasOwnProperty(er)&&(zn[Fn[er]]=er);return zn}(Cn);function In(Fn){return Fn=parseFloat(Fn),(isNaN(Fn)||Fn<0||Fn>1)&&(Fn=1),Fn}function Bn(Fn,zn){(function(rr){return typeof rr=="string"&&rr.indexOf(".")!=-1&&parseFloat(rr)===1})(Fn)&&(Fn="100%");var er=function(rr){return typeof rr=="string"&&rr.indexOf("%")!=-1}(Fn);return Fn=Math.min(zn,Math.max(0,parseFloat(Fn))),er&&(Fn=parseInt(Fn*zn,10)/100),Math.abs(Fn-zn)<1e-6?1:Fn%zn/parseFloat(zn)}function Zn(Fn){return Math.min(1,Math.max(0,Fn))}function nr(Fn){return parseInt(Fn,16)}function ar(Fn){return Fn.length==1?"0"+Fn:""+Fn}function Sn(Fn){return Fn<=1&&(Fn=100*Fn+"%"),Fn}function Rn(Fn){return Math.round(255*parseFloat(Fn)).toString(16)}function On(Fn){return nr(Fn)/255}var Vn,yn,vn,wn=(yn="[\\s|\\(]+("+(Vn="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Vn+")[,|\\s]+("+Vn+")\\s*\\)?",vn="[\\s|\\(]+("+Vn+")[,|\\s]+("+Vn+")[,|\\s]+("+Vn+")[,|\\s]+("+Vn+")\\s*\\)?",{CSS_UNIT:new RegExp(Vn),rgb:new RegExp("rgb"+yn),rgba:new RegExp("rgba"+vn),hsl:new RegExp("hsl"+yn),hsla:new RegExp("hsla"+vn),hsv:new RegExp("hsv"+yn),hsva:new RegExp("hsva"+vn),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function Un(Fn){return!!wn.CSS_UNIT.exec(Fn)}function Kn(Fn,zn){this.size=this.size||Fn,this.smallerSize=this.smallerSize||zn,function(er){for(let rr=1;rrlr?"1":"0";return fr};const tr=[],or=Kn;__webpack_require__(9307);const Jn=(Fn,zn)=>{let{url:er,...rr}=Fn;fetch(er,rr).then(lr=>{if(lr.ok)return lr.arrayBuffer().catch(fr=>{throw new Error(`Response is not a buffer for url ${er}. Error: ${fr.message}`)});throw new Error(`HTTP Status ${lr.status} for url ${er}`)}).then(lr=>zn(null,lr)).catch(lr=>zn(lr))},gr=-1,Er=1,Sr=2,Rr=4,sr=8,hr=16,Tr=32,Mr="srcOver",qn="dstOver",Ln="multiply",jn="add",ir="screen",mr="overlay",kr="darken",Cr="lighten",Wn="hardLight",vr="difference",Xn="exclusion",ur=1,Wr=2,Or=3;function to(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a;return{r:(Fn.r*Fn.a+zn.r*zn.a*(1-Fn.a))/rr,g:(Fn.g*Fn.a+zn.g*zn.a*(1-Fn.a))/rr,b:(Fn.b*Fn.a+zn.b*zn.a*(1-Fn.a))/rr,a:rr}}function Gr(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a;return{r:(zn.r*zn.a+Fn.r*Fn.a*(1-zn.a))/rr,g:(zn.g*zn.a+Fn.g*Fn.a*(1-zn.a))/rr,b:(zn.b*zn.a+Fn.b*Fn.a*(1-zn.a))/rr,a:rr}}function no(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr*_r+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(fr*$r+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function Hr(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a;return{r:(lr+zn.r*zn.a)/rr,g:(fr+zn.g*zn.a)/rr,b:(wr+zn.b*zn.a)/rr,a:rr}}function Lr(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr*zn.a+_r*Fn.a-lr*_r+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(fr*zn.a+$r*Fn.a-fr*$r+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(wr*zn.a+Fr*Fn.a-wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function lo(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(2*_r<=zn.a?2*lr*_r+lr*(1-zn.a)+_r*(1-Fn.a):lr*(1+zn.a)+_r*(1+Fn.a)-2*_r*lr-zn.a*Fn.a)/rr,g:(2*$r<=zn.a?2*fr*$r+fr*(1-zn.a)+$r*(1-Fn.a):fr*(1+zn.a)+$r*(1+Fn.a)-2*$r*fr-zn.a*Fn.a)/rr,b:(2*Fr<=zn.a?2*wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a):wr*(1+zn.a)+Fr*(1+Fn.a)-2*Fr*wr-zn.a*Fn.a)/rr,a:rr}}function uo(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(Math.min(lr*zn.a,_r*Fn.a)+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(Math.min(fr*zn.a,$r*Fn.a)+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(Math.min(wr*zn.a,Fr*Fn.a)+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function ao(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(Math.max(lr*zn.a,_r*Fn.a)+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(Math.max(fr*zn.a,$r*Fn.a)+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(Math.max(wr*zn.a,Fr*Fn.a)+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function Ro(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(2*lr<=Fn.a?2*lr*_r+lr*(1-zn.a)+_r*(1-Fn.a):lr*(1+zn.a)+_r*(1+Fn.a)-2*_r*lr-zn.a*Fn.a)/rr,g:(2*fr<=Fn.a?2*fr*$r+fr*(1-zn.a)+$r*(1-Fn.a):fr*(1+zn.a)+$r*(1+Fn.a)-2*$r*fr-zn.a*Fn.a)/rr,b:(2*wr<=Fn.a?2*wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a):wr*(1+zn.a)+Fr*(1+Fn.a)-2*Fr*wr-zn.a*Fn.a)/rr,a:rr}}function Xo(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr+_r-2*Math.min(lr*zn.a,_r*Fn.a))/rr,g:(fr+$r-2*Math.min(fr*zn.a,$r*Fn.a))/rr,b:(wr+Fr-2*Math.min(wr*zn.a,Fr*Fn.a))/rr,a:rr}}function Ao(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr*zn.a+_r*Fn.a-2*lr*_r+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(fr*zn.a+$r*Fn.a-2*fr*$r+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(wr*zn.a+Fr*Fn.a-2*wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}const ho=function(Fn,zn){for(var er=arguments.length,rr=new Array(er>2?er-2:0),lr=2;lr{rr.push((_r,$r)=>{_r&&wr(_r),fr($r)}),Fn.bind(zn)(...rr)})},qo={},xa=(Fn,zn)=>{qo[Fn]=zn},Jo=Fn=>{const zn=Fn.split("/").slice(-1);var er;return(er=zn[zn.length-1].split(".").pop(),Object.entries(qo).find(rr=>rr[1].includes(er))||[])[0]};var as=__webpack_require__(5025),Ko=__webpack_require__.n(as),Qo=__webpack_require__(6551),hs=__webpack_require__.n(Qo),Go=__webpack_require__(8834).lW;function Wo(Fn){return Fn._exif&&Fn._exif.tags&&Fn._exif.tags.Orientation||1}async function ss(Fn,zn,er){const rr=await async function(lr,fr){const wr=await Ko().fromBuffer(lr);return wr?wr.mime:fr?Jo(fr):null}(Fn,zn);if(typeof rr!="string")return er(new Error("Could not find MIME for Buffer <"+zn+">"));this._originalMime=rr.toLowerCase();try{const lr=this.getMIME();if(!this.constructor.decoders[lr])return Yt.call(this,"Unsupported MIME type: "+lr,er);this.bitmap=this.constructor.decoders[lr](Fn)}catch(lr){return er.call(this,lr,this)}try{this._exif=hs().create(Fn).parse(),function(lr){if(Wo(lr)<2)return;const fr=function(_r){const $r=_r.getWidth(),Fr=_r.getHeight();switch(Wo(_r)){case 1:default:return null;case 2:return function(jr,Vr){return[$r-jr-1,Vr]};case 3:return function(jr,Vr){return[$r-jr-1,Fr-Vr-1]};case 4:return function(jr,Vr){return[jr,Fr-Vr-1]};case 5:return function(jr,Vr){return[Vr,jr]};case 6:return function(jr,Vr){return[Vr,Fr-jr-1]};case 7:return function(jr,Vr){return[$r-Vr-1,Fr-jr-1]};case 8:return function(jr,Vr){return[$r-Vr-1,jr]}}}(lr),wr=Wo(lr)>4;(function(_r,$r,Fr,jr){const Vr=_r.bitmap.data,co=_r.bitmap.width,Jr=Go.alloc(Vr.length);for(let Xr=0;Xr<$r;Xr++)for(let Kr=0;Kr{zn.call(this,null,rr)}):zn.call(this,null,er)}return this}function vs(Fn){return ho($a,this,Fn)}var ks=__webpack_require__(8834).lW;function Ss(Fn,zn,er){return(zn=function(rr){var lr=function(fr,wr){if(typeof fr!="object"||fr===null)return fr;var _r=fr[Symbol.toPrimitive];if(_r!==void 0){var $r=_r.call(fr,"string");if(typeof $r!="object")return $r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(fr)}(rr);return typeof lr=="symbol"?lr:String(lr)}(zn))in Fn?Object.defineProperty(Fn,zn,{value:er,enumerable:!0,configurable:!0,writable:!0}):Fn[zn]=er,Fn}const Is="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",Vl=[NaN,NaN];for(let Fn=2;Fn<65;Fn++){const zn=Qt()(Qt().BIN,Is.slice(0,Fn))(new Array(65).join("1"));Vl.push(zn.length)}function Fo(){}function bs(Fn){return Object.prototype.toString.call(Fn).toLowerCase().indexOf("arraybuffer")>-1}function _u(Fn){const zn=ks.alloc(Fn.byteLength),er=new Uint8Array(Fn);for(let rr=0;rrer?zn(er):typeof rr=="object"&&ks.isBuffer(rr)?zn(null,rr):typeof rr=="object"&&bs(rr)?zn(null,_u(rr)):new Error(`Could not load Buffer from <${Fn.url}>`))}const wu={data:null,width:null,height:null};class na extends Wt(){constructor(){for(var zn=arguments.length,er=new Array(zn),rr=0;rrho(this.write,this,$r)),Ss(this,"getBase64Async",$r=>ho(this.getBase64,this,$r)),Ss(this,"getBuffer",$a),Ss(this,"getBufferAsync",vs),Ss(this,"getPixelColour",this.getPixelColor),Ss(this,"setPixelColour",this.setPixelColor);const lr=this;let fr=Fo;function wr(){for(var $r=arguments.length,Fr=new Array($r),jr=0;jr<$r;jr++)Fr[jr]=arguments[jr];const[Vr]=Fr;(Vr||{}).methodName="constructor",setTimeout(()=>{Vr&&fr===Fo?lr.emitError("constructor",Vr):Vr||lr.emitMulti("constructor","initialized"),fr.call(lr,...Fr)},1)}if(bs(er[0])&&(er[0]=_u(er[0])),typeof er[0]=="number"&&typeof er[1]=="number"||parseInt(er[0],10)&&parseInt(er[1],10)){const $r=parseInt(er[0],10),Fr=parseInt(er[1],10);if(fr=er[2],typeof er[2]=="number"&&(this._background=er[2],fr=er[3]),typeof er[2]=="string"&&(this._background=na.cssColorToHex(er[2]),fr=er[3]),fr===void 0&&(fr=Fo),typeof fr!="function")return Yt.call(this,"cb must be a function",wr);this.bitmap={data:ks.alloc($r*Fr*4),width:$r,height:Fr};for(let jr=0;jr{if($r)return Yt.call(this,$r,wr);this.parseBitmap(Fr,er[0].url,wr)})}else if(er[0]instanceof na){const[$r]=er;if(fr=er[1],fr===void 0&&(fr=Fo),typeof fr!="function")return Yt.call(this,"cb must be a function",wr);this.bitmap={data:ks.from($r.bitmap.data),width:$r.bitmap.width,height:$r.bitmap.height},this._quality=$r._quality,this._deflateLevel=$r._deflateLevel,this._deflateStrategy=$r._deflateStrategy,this._filterType=$r._filterType,this._rgba=$r._rgba,this._background=$r._background,this._originalMime=$r._originalMime,wr(null,this)}else if((_r=er[0])&&typeof _r=="object"&&typeof _r.width=="number"&&typeof _r.height=="number"&&(ks.isBuffer(_r.data)||_r.data instanceof Uint8Array||typeof Uint8ClampedArray=="function"&&_r.data instanceof Uint8ClampedArray)&&(_r.data.length===_r.width*_r.height*4||_r.data.length===_r.width*_r.height*3)){const[$r]=er;fr=er[1]||Fo;const Fr=$r.width*$r.height*4===$r.data.length?ks.from($r.data):function(jr){if(jr.length%3!=0)throw new Error("Buffer length is incorrect");const Vr=ks.allocUnsafe(jr.length/3*4);let co=0;for(let Jr=0;Jr{if(Fr)return Yt.call(this,Fr,wr);this.parseBitmap(jr,$r,wr)})}else if(typeof er[0]=="object"&&ks.isBuffer(er[0])){const $r=er[0];if(fr=er[1],typeof fr!="function")return Yt.call(this,"cb must be a function",wr);this.parseBitmap($r,null,wr)}else{fr=er[er.length-1],typeof fr!="function"&&(fr=er[er.length-2],typeof fr!="function"&&(fr=Fo));const $r=na.__extraConstructors.find(Fr=>Fr.test(...er));if(!$r)return Yt.call(this,"No matching constructor overloading was found. Please see the docs for how to call the Jimp constructor.",wr);new Promise((Fr,jr)=>{$r.run.call(this,Fr,jr,...er)}).then(()=>wr(null,this)).catch(wr)}var _r}parseBitmap(zn,er,rr){ss.call(this,zn,null,rr)}rgba(zn,er){return typeof zn!="boolean"?Yt.call(this,"bool must be a boolean, true for RGBA or false for RGB",er):(this._rgba=zn,qt(er)&&er.call(this,null,this),this)}emitMulti(zn,er){let rr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};rr=Object.assign(rr,{methodName:zn,eventName:er}),this.emit("any",rr),zn&&this.emit(zn,rr),this.emit(er,rr)}emitError(zn,er){this.emitMulti(zn,"error",er)}getHeight(){return this.bitmap.height}getWidth(){return this.bitmap.width}inspect(){return""}toString(){return"[object Jimp]"}getMIME(){return this._originalMime||na.MIME_PNG}getExtension(){const zn=this.getMIME();return(qo[zn.toLowerCase()]||[])[0]}write(zn,er){if(!Nt()||!Nt().createWriteStream)throw new Error("Cant access the filesystem. You can use the getBase64 method.");if(typeof zn!="string")return Yt.call(this,"path must be a string",er);if(er===void 0&&(er=Fo),typeof er!="function")return Yt.call(this,"cb must be a function",er);const rr=Jo(zn)||this.getMIME(),lr=Ut().parse(zn);return lr.dir&&Nt().mkdirSync(lr.dir,{recursive:!0}),this.getBuffer(rr,(fr,wr)=>{if(fr)return Yt.call(this,fr,er);const _r=Nt().createWriteStream(zn);_r.on("open",()=>{_r.write(wr),_r.end()}).on("error",$r=>Yt.call(this,$r,er)),_r.on("finish",()=>{er.call(this,null,this)})}),this}getBase64(zn,er){return zn===na.AUTO&&(zn=this.getMIME()),typeof zn!="string"?Yt.call(this,"mime must be a string",er):typeof er!="function"?Yt.call(this,"cb must be a function",er):(this.getBuffer(zn,function(rr,lr){if(rr)return Yt.call(this,rr,er);const fr="data:"+zn+";base64,"+lr.toString("base64");er.call(this,null,fr)}),this)}hash(zn,er){if(typeof(zn=zn||64)=="function"&&(er=zn,zn=64),typeof zn!="number")return Yt.call(this,"base must be a number",er);if(zn<2||zn>64)return Yt.call(this,"base must be a number between 2 and 64",er);let rr=this.pHash();for(rr=Qt()(Qt().BIN,Is.slice(0,zn))(rr);rr.length=this.bitmap.width&&(fr=this.bitmap.width-1),er<0&&(wr=0),er>=this.bitmap.height&&(wr=this.bitmap.height-1)),rr===na.EDGE_WRAP&&(zn<0&&(fr=this.bitmap.width+zn),zn>=this.bitmap.width&&(fr=zn%this.bitmap.width),er<0&&(wr=this.bitmap.height+er),er>=this.bitmap.height&&(wr=er%this.bitmap.height));let _r=this.bitmap.width*wr+fr<<2;return(fr<0||fr>=this.bitmap.width)&&(_r=-1),(wr<0||wr>=this.bitmap.height)&&(_r=-1),qt(lr)&&lr.call(this,null,_r),_r}getPixelColor(zn,er,rr){if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",rr);zn=Math.round(zn),er=Math.round(er);const lr=this.getPixelIndex(zn,er),fr=this.bitmap.data.readUInt32BE(lr);return qt(rr)&&rr.call(this,null,fr),fr}setPixelColor(zn,er,rr,lr){if(typeof zn!="number"||typeof er!="number"||typeof rr!="number")return Yt.call(this,"hex, x and y must be numbers",lr);er=Math.round(er),rr=Math.round(rr);const fr=this.getPixelIndex(er,rr);return this.bitmap.data.writeUInt32BE(zn,fr),qt(lr)&&lr.call(this,null,this),this}hasAlpha(){for(let zn=0;zn1&&arguments[1]!==void 0?arguments[1]:na;Object.entries(Fn).forEach(er=>{let[rr,lr]=er;zn[rr]=lr})}function Eu(Fn){let zn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:na;Object.entries(Fn).forEach(er=>{let[rr,lr]=er;zn.prototype[rr]=lr})}function Mn(Fn,zn,er){const rr="before-"+zn,lr=zn.replace(/e$/,"")+"ed";na.prototype[Fn]=function(){let fr;for(var wr=arguments.length,_r=new Array(wr),$r=0;$r3&&arguments[3]!==void 0?arguments[3]:{},lr=arguments.length>4?arguments[4]:void 0;if(typeof rr=="function"&&(lr=rr,rr={}),!(Fn instanceof this.constructor))return Yt.call(this,"The source must be a Jimp image",lr);if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",lr);let{mode:fr,opacitySource:wr,opacityDest:_r}=rr;fr||(fr=Mr),(typeof wr!="number"||wr<0||wr>1)&&(wr=1),(typeof _r!="number"||_r<0||_r>1)&&(_r=1);const $r=Pt[fr];zn=Math.round(zn),er=Math.round(er);const Fr=this;return _r!==1&&Fr.opacity(_r),Fn.scanQuiet(0,0,Fn.bitmap.width,Fn.bitmap.height,function(jr,Vr,co){const Jr=Fr.getPixelIndex(zn+jr,er+Vr,Or);if(Jr===-1)return;const Xr=$r({r:this.bitmap.data[co+0]/255,g:this.bitmap.data[co+1]/255,b:this.bitmap.data[co+2]/255,a:this.bitmap.data[co+3]/255},{r:Fr.bitmap.data[Jr+0]/255,g:Fr.bitmap.data[Jr+1]/255,b:Fr.bitmap.data[Jr+2]/255,a:Fr.bitmap.data[Jr+3]/255},wr);Fr.bitmap.data[Jr+0]=this.constructor.limit255(255*Xr.r),Fr.bitmap.data[Jr+1]=this.constructor.limit255(255*Xr.g),Fr.bitmap.data[Jr+2]=this.constructor.limit255(255*Xr.b),Fr.bitmap.data[Jr+3]=this.constructor.limit255(255*Xr.a)}),qt(lr)&&lr.call(this,null,this),this}}),na.__extraConstructors=[],na.appendConstructorOption=function(Fn,zn,er){na.__extraConstructors.push({name:Fn,test:zn,run:er})},na.read=function(){for(var Fn=arguments.length,zn=new Array(Fn),er=0;er{new na(...zn,(fr,wr)=>{fr?lr(fr):rr(wr)})})},na.create=na.read,na.rgbaToInt=function(Fn,zn,er,rr,lr){if(typeof Fn!="number"||typeof zn!="number"||typeof er!="number"||typeof rr!="number")return Yt.call(this,"r, g, b and a must be numbers",lr);if(Fn<0||Fn>255)return Yt.call(this,"r must be between 0 and 255",lr);if((zn<0||zn>255)&&Yt.call(this,"g must be between 0 and 255",lr),er<0||er>255)return Yt.call(this,"b must be between 0 and 255",lr);if(rr<0||rr>255)return Yt.call(this,"a must be between 0 and 255",lr);Fn=Math.round(Fn),er=Math.round(er),zn=Math.round(zn),rr=Math.round(rr);const fr=Fn*Math.pow(256,3)+zn*Math.pow(256,2)+er*Math.pow(256,1)+rr*Math.pow(256,0);return qt(lr)&&lr.call(this,null,fr),fr},na.intToRGBA=function(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"i must be a number",zn);const er={};return er.r=Math.floor(Fn/Math.pow(256,3)),er.g=Math.floor((Fn-er.r*Math.pow(256,3))/Math.pow(256,2)),er.b=Math.floor((Fn-er.r*Math.pow(256,3)-er.g*Math.pow(256,2))/Math.pow(256,1)),er.a=Math.floor((Fn-er.r*Math.pow(256,3)-er.g*Math.pow(256,2)-er.b*Math.pow(256,1))/Math.pow(256,0)),qt(zn)&&zn.call(this,null,er),er},na.cssColorToHex=function(Fn){return typeof(Fn=Fn||0)=="number"?Number(Fn):parseInt(sn(Fn).toHex8(),16)},na.limit255=function(Fn){return Fn=Math.max(Fn,0),Math.min(Fn,255)},na.diff=function(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:.1;if(!(Fn instanceof na&&zn instanceof na))return Yt.call(this,"img1 and img2 must be an Jimp images");const rr=Fn.bitmap,lr=zn.bitmap;if(rr.width===lr.width&&rr.height===lr.height||(rr.width*rr.height>lr.width*lr.height?Fn=Fn.cloneQuiet().resize(lr.width,lr.height):zn=zn.cloneQuiet().resize(rr.width,rr.height)),typeof er!="number"||er<0||er>1)return Yt.call(this,"threshold must be a number between 0 and 1");const fr=new na(rr.width,rr.height,4294967295);return{percent:tn()(rr.data,lr.data,fr.bitmap.data,fr.bitmap.width,fr.bitmap.height,{threshold:er})/(fr.bitmap.width*fr.bitmap.height),image:fr}},na.distance=function(Fn,zn){const er=new or,rr=er.getHash(Fn),lr=er.getHash(zn);return er.distance(rr,lr)},na.compareHashes=function(Fn,zn){return new or().distance(Fn,zn)},na.colorDiff=function(Fn,zn){const er=lr=>Math.pow(lr,2),{max:rr}=Math;return Fn.a===0||Fn.a||(Fn.a=255),zn.a===0||zn.a||(zn.a=255),(rr(er(Fn.r-zn.r),er(Fn.r-zn.r-Fn.a+zn.a))+rr(er(Fn.g-zn.g),er(Fn.g-zn.g-Fn.a+zn.a))+rr(er(Fn.b-zn.b),er(Fn.b-zn.b-Fn.a+zn.a)))/195075},Mn("clone","clone",function(Fn){const zn=new na(this);return qt(Fn)&&Fn.call(zn,null,zn),zn}),dr("background",function(Fn,zn){return typeof Fn!="number"?Yt.call(this,"hex must be a hexadecimal rgba value",zn):(this._background=Fn,qt(zn)&&zn.call(this,null,this),this)}),dr("scan",function(Fn,zn,er,rr,lr,fr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"x and y must be numbers",fr);if(typeof er!="number"||typeof rr!="number")return Yt.call(this,"w and h must be numbers",fr);if(typeof lr!="function")return Yt.call(this,"f must be a function",fr);const wr=Xt(this,Fn,zn,er,rr,lr);return qt(fr)&&fr.call(this,null,wr),wr});{let Fn;typeof window<"u"&&typeof window=="object"&&(Fn=window),typeof self<"u"&&typeof self=="object"&&(Fn=self),Fn.Jimp=na,Fn.Buffer=ks}const br=na;var Ir=__webpack_require__(643),Nr=__webpack_require__(2691),Yr=__webpack_require__.n(Nr);const zr="image/jpeg",_i=()=>({mime:{[zr]:["jpeg","jpg","jpe"]},constants:{MIME_JPEG:zr},decoders:{[zr]:Yr().decode},encoders:{[zr]:Fn=>Yr().encode(Fn.bitmap,Fn._quality).data},class:{_quality:100,quality(Fn,zn){return typeof Fn!="number"?Yt.call(this,"n must be a number",zn):Fn<0||Fn>100?Yt.call(this,"n must be a number 0 - 100",zn):(this._quality=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)}}});var qr=__webpack_require__(9902);const so="image/png",eo=()=>({mime:{[so]:["png"]},constants:{MIME_PNG:so,PNG_FILTER_AUTO:-1,PNG_FILTER_NONE:0,PNG_FILTER_SUB:1,PNG_FILTER_UP:2,PNG_FILTER_AVERAGE:3,PNG_FILTER_PATH:4},hasAlpha:{[so]:!0},decoders:{[so]:qr.PNG.sync.read},encoders:{[so](Fn){const zn=new qr.PNG({width:Fn.bitmap.width,height:Fn.bitmap.height});return zn.data=Fn.bitmap.data,qr.PNG.sync.write(zn,{deflateLevel:Fn._deflateLevel,deflateStrategy:Fn._deflateStrategy,filterType:Fn._filterType,colorType:typeof Fn._colorType=="number"?Fn._colorType:Fn._rgba?6:2,inputHasAlpha:Fn._rgba})}},class:{_deflateLevel:9,_deflateStrategy:3,_filterType:-1,_colorType:null,deflateLevel(Fn,zn){return typeof Fn!="number"?Yt.call(this,"l must be a number",zn):Fn<0||Fn>9?Yt.call(this,"l must be a number 0 - 9",zn):(this._deflateLevel=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)},deflateStrategy(Fn,zn){return typeof Fn!="number"?Yt.call(this,"s must be a number",zn):Fn<0||Fn>3?Yt.call(this,"s must be a number 0 - 3",zn):(this._deflateStrategy=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)},filterType(Fn,zn){return typeof Fn!="number"?Yt.call(this,"n must be a number",zn):Fn<-1||Fn>4?Yt.call(this,"n must be -1 (auto) or a number 0 - 4",zn):(this._filterType=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)},colorType(Fn,zn){return typeof Fn!="number"?Yt.call(this,"s must be a number",zn):Fn!==0&&Fn!==2&&Fn!==4&&Fn!==6?Yt.call(this,"s must be a number 0, 2, 4, 6.",zn):(this._colorType=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)}}});var io=__webpack_require__(486),yo=__webpack_require__.n(io);const Bo="image/bmp",Mo="image/x-ms-bmp",xo=Fn=>{return Xt({bitmap:zn=yo().decode(Fn)},0,0,zn.width,zn.height,function(er,rr,lr){const fr=this.bitmap.data[lr+0],wr=this.bitmap.data[lr+1],_r=this.bitmap.data[lr+2],$r=this.bitmap.data[lr+3];this.bitmap.data[lr+0]=$r,this.bitmap.data[lr+1]=_r,this.bitmap.data[lr+2]=wr,this.bitmap.data[lr+3]=zn.is_with_alpha?fr:255}).bitmap;var zn},wo=Fn=>yo().encode(function(zn){return Xt(zn,0,0,zn.bitmap.width,zn.bitmap.height,function(er,rr,lr){const fr=this.bitmap.data[lr+0],wr=this.bitmap.data[lr+1],_r=this.bitmap.data[lr+2],$r=this.bitmap.data[lr+3];this.bitmap.data[lr+0]=$r,this.bitmap.data[lr+1]=_r,this.bitmap.data[lr+2]=wr,this.bitmap.data[lr+3]=fr}).bitmap}(Fn)).data;var os=__webpack_require__(9299),rs=__webpack_require__.n(os),xs=__webpack_require__(8834).lW;const fs="image/tiff";var Ds=__webpack_require__(63),ms=__webpack_require__(9455),Po=__webpack_require__(8834).lW;const Ol="image/gif",Hu=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],Gu=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18];var ru=__webpack_require__(8834).lW;function vu(Fn,zn,er,rr){const lr=[0,0,0],fr=(zn.length-1)/2;for(let wr=0;wrFn!=null;function Su(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){const lr=parseInt(.2126*this.bitmap.data[rr]+.7152*this.bitmap.data[rr+1]+.0722*this.bitmap.data[rr+2],10);this.bitmap.data[rr]=lr,this.bitmap.data[rr+1]=lr,this.bitmap.data[rr+2]=lr}),qt(Fn)&&Fn.call(this,null,this),this}function bu(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:50;return{r:(zn.r-Fn.r)*(er/100)+Fn.r,g:(zn.g-Fn.g)*(er/100)+Fn.g,b:(zn.b-Fn.b)*(er/100)+Fn.b}}function Dm(Fn,zn){return Fn&&Array.isArray(Fn)?(Fn=Fn.map(er=>(er.apply!=="xor"&&er.apply!=="mix"||(er.params[0]=sn(er.params[0]).toRgb()),er)),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(er,rr,lr)=>{let fr={r:this.bitmap.data[lr],g:this.bitmap.data[lr+1],b:this.bitmap.data[lr+2]};const wr=(_r,$r)=>this.constructor.limit255(fr[_r]+$r);Fn.forEach(_r=>{if(_r.apply==="mix")fr=bu(fr,_r.params[0],_r.params[1]);else if(_r.apply==="tint")fr=bu(fr,{r:255,g:255,b:255},_r.params[0]);else if(_r.apply==="shade")fr=bu(fr,{r:0,g:0,b:0},_r.params[0]);else if(_r.apply==="xor")fr={r:fr.r^_r.params[0].r,g:fr.g^_r.params[0].g,b:fr.b^_r.params[0].b};else if(_r.apply==="red")fr.r=wr("r",_r.params[0]);else if(_r.apply==="green")fr.g=wr("g",_r.params[0]);else if(_r.apply==="blue")fr.b=wr("b",_r.params[0]);else{if(_r.apply==="hue"&&(_r.apply="spin"),fr=sn(fr),!fr[_r.apply])return Yt.call(this,"action "+_r.apply+" not supported",zn);fr=fr[_r.apply](..._r.params).toRgb()}}),this.bitmap.data[lr]=fr.r,this.bitmap.data[lr+1]=fr.g,this.bitmap.data[lr+2]=fr.b}),qt(zn)&&zn.call(this,null,this),this):Yt.call(this,"actions must be an array",zn)}var Mp=__webpack_require__(8834).lW;function Bm(Fn){const zn=[1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6];return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){const fr=zn[((3&rr)<<2)+er%4];this.bitmap.data[lr]=Math.min(this.bitmap.data[lr]+fr,255),this.bitmap.data[lr+1]=Math.min(this.bitmap.data[lr+1]+fr,255),this.bitmap.data[lr+2]=Math.min(this.bitmap.data[lr+2]+fr,255)}),qt(Fn)&&Fn.call(this,null,this),this}var Nm=__webpack_require__(8834).lW;function Fm(Fn,zn,er){if(typeof Fn!="boolean"||typeof zn!="boolean")return Yt.call(this,"horizontal and vertical must be Booleans",er);const rr=Nm.alloc(this.bitmap.data.length);return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(lr,fr,wr){const _r=Fn?this.bitmap.width-1-lr:lr,$r=zn?this.bitmap.height-1-fr:fr,Fr=this.bitmap.width*$r+_r<<2,jr=this.bitmap.data.readUInt32BE(wr);rr.writeUInt32BE(jr,Fr)}),this.bitmap.data=Nm.from(rr),qt(er)&&er.call(this,null,this),this}function Vm(){const Fn={r:new Array(256).fill(0),g:new Array(256).fill(0),b:new Array(256).fill(0)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){Fn.r[this.bitmap.data[rr+0]]++,Fn.g[this.bitmap.data[rr+1]]++,Fn.b[this.bitmap.data[rr+2]]++}),Fn}const $u=function(Fn,zn,er){return 255*(Fn-zn)/(er-zn)},Op=function(Fn){return[Fn.findIndex(zn=>zn>0),255-Fn.slice().reverse().findIndex(zn=>zn>0)]};var qm=__webpack_require__(8058),Ym=__webpack_require__.n(qm);function Rp(Fn,zn){let er=0;for(let rr=0;rr{const $r=[...fr,_r].join(" "),Fr=Rp(Fn,$r);Fr<=er?(Fr>wr&&(wr=Fr),fr.push(_r)):(lr.push(fr),fr=[_r])}),lr.push(fr),{lines:lr,longestLine:wr}}function zo(Fn,zn,er){const{lines:rr}=jm(Fn,zn,er);return rr.length*Fn.common.lineHeight}function Uo(Fn,zn,er,rr,lr){if(lr.width>0&&lr.height>0){const fr=zn.pages[lr.page];Fn.blit(fr,er+lr.xoffset,rr+lr.yoffset,lr.x,lr.y,lr.width,lr.height)}return Fn}function Xm(Fn,zn,er,rr,lr){for(let fr=0;fr0&&this.heightOriginal>0&&this.targetWidth>0&&this.targetHeight>0))throw new Error("Invalid settings specified for the resizer.");this.configurePasses()},Ws.prototype.configurePasses=function(){this.widthOriginal===this.targetWidth?this.resizeWidth=this.bypassResizer:(this.ratioWeightWidthPass=this.widthOriginal/this.targetWidth,this.ratioWeightWidthPass<1&&this.interpolationPass?(this.initializeFirstPassBuffers(!0),this.resizeWidth=this.colorChannels===4?this.resizeWidthInterpolatedRGBA:this.resizeWidthInterpolatedRGB):(this.initializeFirstPassBuffers(!1),this.resizeWidth=this.colorChannels===4?this.resizeWidthRGBA:this.resizeWidthRGB)),this.heightOriginal===this.targetHeight?this.resizeHeight=this.bypassResizer:(this.ratioWeightHeightPass=this.heightOriginal/this.targetHeight,this.ratioWeightHeightPass<1&&this.interpolationPass?(this.initializeSecondPassBuffers(!0),this.resizeHeight=this.resizeHeightInterpolated):(this.initializeSecondPassBuffers(!1),this.resizeHeight=this.colorChannels===4?this.resizeHeightRGBA:this.resizeHeightRGB))},Ws.prototype._resizeWidthInterpolatedRGBChannels=function(Fn,zn){const er=zn?4:3,rr=this.ratioWeightWidthPass,lr=this.widthBuffer;let fr,wr,_r=0,$r=0,Fr=0,jr=0,Vr=0;for(fr=0;_r<1/3;fr+=er,_r+=rr)for($r=fr,Fr=0;$r=Vr)){Jr+=jr;break}co+=er,Jr=co,jr-=Vr}while(jr>0&&co=$r)){jr+=_r;break}Fr=Jr,jr=Fr,_r-=$r}while(_r>0&&Fr3&&(this.outputWidthWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.heightOriginal)))},Ws.prototype.initializeSecondPassBuffers=function(Fn){this.heightBuffer=this.generateUint8Buffer(this.finalResultSize),Fn||(this.outputHeightWorkBench=this.generateFloatBuffer(this.targetWidthMultipliedByChannels),this.colorChannels>3&&(this.outputHeightWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.targetWidth)))},Ws.prototype.generateFloatBuffer=function(Fn){try{return new Float32Array(Fn)}catch{return[]}},Ws.prototype.generateFloat64Buffer=function(Fn){try{return new Float64Array(Fn)}catch{return[]}},Ws.prototype.generateUint8Buffer=function(Fn){try{return new Uint8Array(Fn)}catch{return[]}};const Km=Ws;var zm=__webpack_require__(8834).lW;const Zm={nearestNeighbor(Fn,zn){const er=Fn.width,rr=Fn.height,lr=zn.width,fr=zn.height,wr=Fn.data,_r=zn.data;for(let $r=0;$r0?lr[ba-4]:2*lr[ba]-lr[ba+4],iu=lr[ba],nu=lr[ba+4],xu=Yo0?Xr[ba-4*Vr]:2*Xr[ba]-Xr[ba+4*Vr],iu=Xr[ba],nu=Xr[ba+4*Vr],xu=Yo<_r-2?Xr[ba+8*Vr]:2*Xr[ba+4*Vr]-Xr[ba];Kr[Vo+es]=rr(Vs,iu,nu,xu,Oo)}}const Qr=jr*co;if(Qr>1)for(let fo=0;fo=0&&Qr.x<_r&&Qr.y>=0&&Qr.y<$r){const _o=(_r*(0|Qr.y)+Qr.x|0)<<2,jo=this.bitmap.data.readUInt32BE(_o);Fr.writeUInt32BE(jo,fo)}else Fr.writeUInt32BE(this._background,fo)}if(this.bitmap.data=Fr,zn===!0||typeof zn=="string"){const Jr=_r/2-fr/2,Xr=$r/2-wr/2;this.crop(Jr,Xr,fr,wr)}}const Lp=[()=>({blit(Fn,zn,er,rr,lr,fr,wr,_r){if(!(Fn instanceof this.constructor))return Yt.call(this,"The source must be a Jimp image",_r);if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",_r);if(typeof rr=="function")_r=rr,rr=0,lr=0,fr=Fn.bitmap.width,wr=Fn.bitmap.height;else{if(typeof rr!=typeof lr||typeof lr!=typeof fr||typeof fr!=typeof wr)return Yt.call(this,"srcx, srcy, srcw, srch must be numbers",_r);rr=rr||0,lr=lr||0,fr=fr||Fn.bitmap.width,wr=wr||Fn.bitmap.height}zn=Math.round(zn),er=Math.round(er),rr=Math.round(rr),lr=Math.round(lr),fr=Math.round(fr),wr=Math.round(wr);const $r=this.bitmap.width,Fr=this.bitmap.height,jr=this;return Fn.scanQuiet(rr,lr,fr,wr,function(Vr,co,Jr){const Xr=zn+Vr-rr,Kr=er+co-lr;if(Xr>=0&&Kr>=0&&$r-Xr>0&&Fr-Kr>0){const Qr=jr.getPixelIndex(Xr,Kr),fo={r:this.bitmap.data[Jr],g:this.bitmap.data[Jr+1],b:this.bitmap.data[Jr+2],a:this.bitmap.data[Jr+3]},_o={r:jr.bitmap.data[Qr],g:jr.bitmap.data[Qr+1],b:jr.bitmap.data[Qr+2],a:jr.bitmap.data[Qr+3]};jr.bitmap.data[Qr]=(fo.a*(fo.r-_o.r)-_o.r+255>>8)+_o.r,jr.bitmap.data[Qr+1]=(fo.a*(fo.g-_o.g)-_o.g+255>>8)+_o.g,jr.bitmap.data[Qr+2]=(fo.a*(fo.b-_o.b)-_o.b+255>>8)+_o.b,jr.bitmap.data[Qr+3]=this.constructor.limit255(_o.a+fo.a)}}),qt(_r)&&_r.call(this,null,this),this}}),()=>({blur(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"r must be a number",zn);if(Fn<1)return Yt.call(this,"r must be greater than 0",zn);let er,rr,lr,fr,wr,_r,$r,Fr,jr,Vr,co,Jr,Xr,Kr;const Qr=this.bitmap.width-1,fo=this.bitmap.height-1,_o=Fn+1,jo=Hu[Fn],Yo=Gu[Fn],Oo=[],Zo=[],Vo=[],es=[],ba=[],Vs=[];let iu=2;for(;iu-- >0;){for(Jr=0,Xr=0,_r=0;_rQr?Qr:$r)<<2),er+=this.bitmap.data[Fr++],rr+=this.bitmap.data[Fr++],lr+=this.bitmap.data[Fr++],fr+=this.bitmap.data[Fr];for(wr=0;wr0?Fr<<2:0),jr=Xr+ba[wr],Vr=Xr+Vs[wr],er+=this.bitmap.data[jr++]-this.bitmap.data[Vr++],rr+=this.bitmap.data[jr++]-this.bitmap.data[Vr++],lr+=this.bitmap.data[jr++]-this.bitmap.data[Vr++],fr+=this.bitmap.data[jr]-this.bitmap.data[Vr],Jr++;Xr+=this.bitmap.width<<2}for(wr=0;wrfo?0:this.bitmap.width,er+=Oo[co],rr+=Zo[co],lr+=Vo[co],fr+=es[co];for(Jr=wr<<2,_r=0;_r>>Yo,this.bitmap.data[Jr+3]=Kr,Kr>255&&(this.bitmap.data[Jr+3]=255),Kr>0?(Kr=255/Kr,this.bitmap.data[Jr]=(er*jo>>>Yo)*Kr,this.bitmap.data[Jr+1]=(rr*jo>>>Yo)*Kr,this.bitmap.data[Jr+2]=(lr*jo>>>Yo)*Kr):(this.bitmap.data[Jr+2]=0,this.bitmap.data[Jr+1]=0,this.bitmap.data[Jr]=0),wr===0&&(ba[_r]=((Fr=_r+_o)0?Fr*this.bitmap.width:0),jr=wr+ba[_r],Vr=wr+Vs[_r],er+=Oo[jr]-Oo[Vr],rr+=Zo[jr]-Zo[Vr],lr+=Vo[jr]-Vo[Vr],fr+=es[jr]-es[Vr],Jr+=this.bitmap.width<<2}}return qt(zn)&&zn.call(this,null,this),this}}),()=>({circle(){let Fn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},zn=arguments.length>1?arguments[1]:void 0;typeof Fn=="function"&&(zn=Fn,Fn={});const er=Fn.radius||(this.bitmap.width>this.bitmap.height?this.bitmap.height:this.bitmap.width)/2,rr=typeof Fn.x=="number"?Fn.x:this.bitmap.width/2,lr=typeof Fn.y=="number"?Fn.y:this.bitmap.height/2;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(fr,wr,_r){const $r=Math.sqrt(Math.pow(fr-rr,2)+Math.pow(wr-lr,2));er-$r<=0?this.bitmap.data[_r+3]=0:er-$r<1&&(this.bitmap.data[_r+3]=255*(er-$r))}),qt(zn)&&zn.call(this,null,this),this}}),()=>({brightness(Fn,zn){return typeof Fn!="number"?Yt.call(this,"val must be numbers",zn):Fn<-1||Fn>1?Yt.call(this,"val must be a number between -1 and +1",zn):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){Fn<0?(this.bitmap.data[lr]*=1+Fn,this.bitmap.data[lr+1]*=1+Fn,this.bitmap.data[lr+2]*=1+Fn):(this.bitmap.data[lr]+=(255-this.bitmap.data[lr])*Fn,this.bitmap.data[lr+1]+=(255-this.bitmap.data[lr+1])*Fn,this.bitmap.data[lr+2]+=(255-this.bitmap.data[lr+2])*Fn)}),qt(zn)&&zn.call(this,null,this),this)},contrast(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"val must be numbers",zn);if(Fn<-1||Fn>1)return Yt.call(this,"val must be a number between -1 and +1",zn);const er=(Fn+1)/(1-Fn);function rr(lr){return(lr=Math.floor(er*(lr-127)+127))<0?0:lr>255?255:lr}return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(lr,fr,wr){this.bitmap.data[wr]=rr(this.bitmap.data[wr]),this.bitmap.data[wr+1]=rr(this.bitmap.data[wr+1]),this.bitmap.data[wr+2]=rr(this.bitmap.data[wr+2])}),qt(zn)&&zn.call(this,null,this),this},posterize(Fn,zn){return typeof Fn!="number"?Yt.call(this,"n must be numbers",zn):(Fn<2&&(Fn=2),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){this.bitmap.data[lr]=Math.floor(this.bitmap.data[lr]/255*(Fn-1))/(Fn-1)*255,this.bitmap.data[lr+1]=Math.floor(this.bitmap.data[lr+1]/255*(Fn-1))/(Fn-1)*255,this.bitmap.data[lr+2]=Math.floor(this.bitmap.data[lr+2]/255*(Fn-1))/(Fn-1)*255}),qt(zn)&&zn.call(this,null,this),this)},greyscale:Su,grayscale:Su,opacity(Fn,zn){return typeof Fn!="number"?Yt.call(this,"f must be a number",zn):Fn<0||Fn>1?Yt.call(this,"f must be a number from 0 to 1",zn):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){const fr=this.bitmap.data[lr+3]*Fn;this.bitmap.data[lr+3]=fr}),qt(zn)&&zn.call(this,null,this),this)},sepia(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){let lr=this.bitmap.data[rr],fr=this.bitmap.data[rr+1],wr=this.bitmap.data[rr+2];lr=.393*lr+.769*fr+.189*wr,fr=.349*lr+.686*fr+.168*wr,wr=.272*lr+.534*fr+.131*wr,this.bitmap.data[rr]=lr<255?lr:255,this.bitmap.data[rr+1]=fr<255?fr:255,this.bitmap.data[rr+2]=wr<255?wr:255}),qt(Fn)&&Fn.call(this,null,this),this},fade(Fn,zn){return typeof Fn!="number"?Yt.call(this,"f must be a number",zn):Fn<0||Fn>1?Yt.call(this,"f must be a number from 0 to 1",zn):(this.opacity(1-Fn),qt(zn)&&zn.call(this,null,this),this)},convolution(Fn,zn,er){typeof zn=="function"&&er===void 0&&(er=zn,zn=null),zn||(zn=this.constructor.EDGE_EXTEND);const rr=ru.from(this.bitmap.data),lr=Fn.length,fr=Fn[0].length,wr=Math.floor(lr/2),_r=Math.floor(fr/2),$r=-wr,Fr=-_r;let jr,Vr,co,Jr,Xr,Kr,Qr,fo,_o,jo;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(Yo,Oo,Zo){Jr=0,co=0,Vr=0;for(let Vo=$r;Vo<=wr;Vo++)for(let es=Fr;es<=_r;es++)fo=Yo+es,_o=Oo+Vo,jr=Fn[Vo+wr][es+_r],jo=this.getPixelIndex(fo,_o,zn),jo===-1?(Qr=0,Kr=0,Xr=0):(Xr=this.bitmap.data[jo+0],Kr=this.bitmap.data[jo+1],Qr=this.bitmap.data[jo+2]),Vr+=jr*Xr,co+=jr*Kr,Jr+=jr*Qr;Vr<0&&(Vr=0),co<0&&(co=0),Jr<0&&(Jr=0),Vr>255&&(Vr=255),co>255&&(co=255),Jr>255&&(Jr=255),rr[Zo+0]=Vr,rr[Zo+1]=co,rr[Zo+2]=Jr}),this.bitmap.data=rr,qt(er)&&er.call(this,null,this),this},opaque(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){this.bitmap.data[rr+3]=255}),qt(Fn)&&Fn.call(this,null,this),this},pixelate(Fn,zn,er,rr,lr,fr){if(typeof zn=="function")fr=zn,lr=null,rr=null,er=null,zn=null;else{if(typeof Fn!="number")return Yt.call(this,"size must be a number",fr);if(Gs(zn)&&typeof zn!="number")return Yt.call(this,"x must be a number",fr);if(Gs(er)&&typeof er!="number")return Yt.call(this,"y must be a number",fr);if(Gs(rr)&&typeof rr!="number")return Yt.call(this,"w must be a number",fr);if(Gs(lr)&&typeof lr!="number")return Yt.call(this,"h must be a number",fr)}const wr=[[1/16,2/16,1/16],[2/16,.25,2/16],[1/16,2/16,1/16]];zn=zn||0,er=er||0,rr=Gs(rr)?rr:this.bitmap.width-zn,lr=Gs(lr)?lr:this.bitmap.height-er;const _r=this.cloneQuiet();return this.scanQuiet(zn,er,rr,lr,function($r,Fr,jr){$r=Fn*Math.floor($r/Fn),Fr=Fn*Math.floor(Fr/Fn);const Vr=vu(_r,wr,$r,Fr);this.bitmap.data[jr]=Vr[0],this.bitmap.data[jr+1]=Vr[1],this.bitmap.data[jr+2]=Vr[2]}),qt(fr)&&fr.call(this,null,this),this},convolute(Fn,zn,er,rr,lr,fr){if(!Array.isArray(Fn))return Yt.call(this,"the kernel must be an array",fr);if(typeof zn=="function")fr=zn,zn=null,er=null,rr=null,lr=null;else{if(Gs(zn)&&typeof zn!="number")return Yt.call(this,"x must be a number",fr);if(Gs(er)&&typeof er!="number")return Yt.call(this,"y must be a number",fr);if(Gs(rr)&&typeof rr!="number")return Yt.call(this,"w must be a number",fr);if(Gs(lr)&&typeof lr!="number")return Yt.call(this,"h must be a number",fr)}zn=Gs(zn)?zn:0,er=Gs(er)?er:0,rr=Gs(rr)?rr:this.bitmap.width-zn,lr=Gs(lr)?lr:this.bitmap.height-er;const wr=this.cloneQuiet();return this.scanQuiet(zn,er,rr,lr,function(_r,$r,Fr){const jr=vu(wr,Fn,_r,$r);this.bitmap.data[Fr]=this.constructor.limit255(jr[0]),this.bitmap.data[Fr+1]=this.constructor.limit255(jr[1]),this.bitmap.data[Fr+2]=this.constructor.limit255(jr[2])}),qt(fr)&&fr.call(this,null,this),this},color:Dm,colour:Dm}),()=>({contain(Fn,zn,er,rr,lr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",lr);typeof er=="string"&&(typeof rr=="function"&&lr===void 0&&(lr=rr),rr=er,er=null),typeof er=="function"&&(lr===void 0&&(lr=er),rr=null,er=null),typeof rr=="function"&&lr===void 0&&(lr=rr,rr=null);const fr=7&(er=er||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),wr=er>>3;if((fr===0||fr&fr-1)&&(wr===0||wr&wr-1))return Yt.call(this,"only use one flag per alignment direction",lr);const _r=fr>>1,$r=wr>>1,Fr=Fn/zn>this.bitmap.width/this.bitmap.height?zn/this.bitmap.height:Fn/this.bitmap.width,jr=this.cloneQuiet().scale(Fr,rr);return this.resize(Fn,zn,rr),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(Vr,co,Jr){this.bitmap.data.writeUInt32BE(this._background,Jr)}),this.blit(jr,(this.bitmap.width-jr.bitmap.width)/2*_r,(this.bitmap.height-jr.bitmap.height)/2*$r),qt(lr)&&lr.call(this,null,this),this}}),()=>({cover(Fn,zn,er,rr,lr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",lr);er&&typeof er=="function"&&lr===void 0?(lr=er,er=null,rr=null):typeof rr=="function"&&lr===void 0&&(lr=rr,rr=null);const fr=7&(er=er||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),wr=er>>3;if((fr===0||fr&fr-1)&&(wr===0||wr&wr-1))return Yt.call(this,"only use one flag per alignment direction",lr);const _r=fr>>1,$r=wr>>1,Fr=Fn/zn>this.bitmap.width/this.bitmap.height?Fn/this.bitmap.width:zn/this.bitmap.height;return this.scale(Fr,rr),this.crop((this.bitmap.width-Fn)/2*_r,(this.bitmap.height-zn)/2*$r,Fn,zn),qt(lr)&&lr.call(this,null,this),this}}),function(Fn){return Fn("crop",function(zn,er,rr,lr,fr){if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",fr);if(typeof rr!="number"||typeof lr!="number")return Yt.call(this,"w and h must be numbers",fr);if(zn=Math.round(zn),er=Math.round(er),rr=Math.round(rr),lr=Math.round(lr),zn===0&&rr===this.bitmap.width){const wr=rr*er+zn<<2,_r=wr+(lr*rr<<2);this.bitmap.data=this.bitmap.data.slice(wr,_r)}else{const wr=Mp.allocUnsafe(rr*lr*4);let _r=0;this.scanQuiet(zn,er,rr,lr,function($r,Fr,jr){const Vr=this.bitmap.data.readUInt32BE(jr,!0);wr.writeUInt32BE(Vr,_r,!0),_r+=4}),this.bitmap.data=wr}return this.bitmap.width=rr,this.bitmap.height=lr,qt(fr)&&fr.call(this,null,this),this}),{class:{autocrop(){const zn=this.bitmap.width,er=this.bitmap.height;let rr,lr=0,fr=2e-4,wr=!0,_r=!1,$r={north:!1,south:!1,east:!1,west:!1};for(var Fr=arguments.length,jr=new Array(Fr),Vr=0;Vrfr)break e}Xr++}if(co=this.getPixelColor(zn,0),!$r.west)e:for(let Oo=0;Oofr)break e}fo++}if(co=this.getPixelColor(0,er),!$r.south)e:for(let Oo=er-1;Oo>=Xr+1;Oo--){for(let Zo=zn-Kr-1;Zo>=0;Zo--){const Vo=this.getPixelColor(Zo,Oo),es=this.constructor.intToRGBA(Vo);if(this.constructor.colorDiff(Jr,es)>fr)break e}Qr++}if(co=this.getPixelColor(zn,er),!$r.east)e:for(let Oo=zn-1;Oo>=0+fo+1;Oo--){for(let Zo=er-1;Zo>=0+Xr;Zo--){const Vo=this.getPixelColor(Oo,Zo),es=this.constructor.intToRGBA(Vo);if(this.constructor.colorDiff(Jr,es)>fr)break e}Kr++}let _o=!1;if(fo-=lr,Kr-=lr,Xr-=lr,Qr-=lr,_r){const Oo=Math.min(Kr,fo),Zo=Math.min(Xr,Qr);fo=Oo,Kr=Oo,Xr=Zo,Qr=Zo}fo=fo>=0?fo:0,Kr=Kr>=0?Kr:0,Xr=Xr>=0?Xr:0,Qr=Qr>=0?Qr:0;const jo=zn-(fo+Kr),Yo=er-(Qr+Xr);return _o=wr?Kr!==0&&Xr!==0&&fo!==0&&Qr!==0:Kr!==0||Xr!==0||fo!==0||Qr!==0,_o&&this.crop(fo,Xr,jo,Yo),qt(rr)&&rr.call(this,null,this),this}}}},()=>({displace(Fn,zn,er){if(typeof Fn!="object"||Fn.constructor!==this.constructor)return Yt.call(this,"The source must be a Jimp image",er);if(typeof zn!="number")return Yt.call(this,"factor must be a number",er);const rr=this.cloneQuiet();return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(lr,fr,wr){let _r=Fn.bitmap.data[wr]/256*zn;_r=Math.round(_r);const $r=this.getPixelIndex(lr+_r,fr);this.bitmap.data[$r]=rr.bitmap.data[wr],this.bitmap.data[$r+1]=rr.bitmap.data[wr+1],this.bitmap.data[$r+2]=rr.bitmap.data[wr+2]}),qt(er)&&er.call(this,null,this),this}}),()=>({dither565:Bm,dither16:Bm}),()=>({fisheye(){let Fn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{r:2.5},zn=arguments.length>1?arguments[1]:void 0;typeof Fn=="function"&&(zn=Fn,Fn={r:2.5});const er=this.cloneQuiet(),{width:rr,height:lr}=er.bitmap;return er.scanQuiet(0,0,rr,lr,(fr,wr)=>{const _r=fr/rr,$r=wr/lr,Fr=Math.sqrt(Math.pow(_r-.5,2)+Math.pow($r-.5,2)),jr=2*Math.pow(Fr,Fn.r),Vr=(_r-.5)/Fr,co=($r-.5)/Fr,Jr=Math.round((jr*Vr+.5)*rr),Xr=Math.round((jr*co+.5)*lr),Kr=er.getPixelColor(Jr,Xr);this.setPixelColor(Kr,fr,wr)}),this.setPixelColor(er.getPixelColor(rr/2,lr/2),rr/2,lr/2),qt(zn)&&zn.call(this,null,this),this}}),()=>({flip:Fm,mirror:Fm}),()=>({gaussian(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"r must be a number",zn);if(Fn<1)return Yt.call(this,"r must be greater than 0",zn);const er=Math.ceil(2.57*Fn),rr=2*er+1,lr=Fn*Fn*2,fr=lr*Math.PI,wr=[];for(let _r=0;_r({invert(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){this.bitmap.data[rr]=255-this.bitmap.data[rr],this.bitmap.data[rr+1]=255-this.bitmap.data[rr+1],this.bitmap.data[rr+2]=255-this.bitmap.data[rr+2]}),qt(Fn)&&Fn.call(this,null,this),this}}),()=>({mask(Fn){let zn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,rr=arguments.length>3?arguments[3]:void 0;if(!(Fn instanceof this.constructor))return Yt.call(this,"The source must be a Jimp image",rr);if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",rr);zn=Math.round(zn),er=Math.round(er);const lr=this.bitmap.width,fr=this.bitmap.height,wr=this;return Fn.scanQuiet(0,0,Fn.bitmap.width,Fn.bitmap.height,function(_r,$r,Fr){const jr=zn+_r,Vr=er+$r;if(jr>=0&&Vr>=0&&jr({normalize(Fn){const zn=Vm.call(this),er={r:Op(zn.r),g:Op(zn.g),b:Op(zn.b)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(rr,lr,fr){const wr=this.bitmap.data[fr+0],_r=this.bitmap.data[fr+1],$r=this.bitmap.data[fr+2];this.bitmap.data[fr+0]=$u(wr,er.r[0],er.r[1]),this.bitmap.data[fr+1]=$u(_r,er.g[0],er.g[1]),this.bitmap.data[fr+2]=$u($r,er.b[0],er.b[1])}),qt(Fn)&&Fn.call(this,null,this),this}}),()=>({constants:{measureText:Rp,measureTextHeight:zo,FONT_SANS_8_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"),FONT_SANS_10_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"),FONT_SANS_12_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"),FONT_SANS_14_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"),FONT_SANS_16_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"),FONT_SANS_32_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"),FONT_SANS_64_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"),FONT_SANS_128_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"),FONT_SANS_8_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"),FONT_SANS_16_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"),FONT_SANS_32_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"),FONT_SANS_64_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"),FONT_SANS_128_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"),loadFont(Fn,zn){return typeof Fn!="string"?Yt.call(this,"file must be a string",zn):new Promise((er,rr)=>{zn=zn||function(lr,fr){lr?rr(lr):er(fr)},Ym()(Fn,(lr,fr)=>{const wr={},_r={};if(lr)return Yt.call(this,lr,zn);for(let $r=0;$r$r.read(Fr+"/"+co));return Promise.all(Vr)})(this,Ut().dirname(Fn),fr.pages).then($r=>{zn(null,{chars:wr,kernings:_r,pages:$r,common:fr.common,info:fr.info})})})})}},class:{print(Fn,zn,er,rr,lr,fr,wr){if(typeof lr=="function"&&wr===void 0&&(wr=lr,lr=1/0),lr===void 0&&(lr=1/0),typeof fr=="function"&&wr===void 0&&(wr=fr,fr=1/0),fr===void 0&&(fr=1/0),typeof Fn!="object")return Yt.call(this,"font must be a Jimp loadFont",wr);if(typeof zn!="number"||typeof er!="number"||typeof lr!="number")return Yt.call(this,"x, y and maxWidth must be numbers",wr);if(typeof lr!="number")return Yt.call(this,"maxWidth must be a number",wr);if(typeof fr!="number")return Yt.call(this,"maxHeight must be a number",wr);let _r,$r;typeof rr=="object"&&rr.text!==null&&rr.text!==void 0?(_r=rr.alignmentX||this.constructor.HORIZONTAL_ALIGN_LEFT,$r=rr.alignmentY||this.constructor.VERTICAL_ALIGN_TOP,{text:rr}=rr):(_r=this.constructor.HORIZONTAL_ALIGN_LEFT,$r=this.constructor.VERTICAL_ALIGN_TOP,rr=rr.toString()),fr!==1/0&&$r===this.constructor.VERTICAL_ALIGN_BOTTOM?er+=fr-zo(Fn,rr,lr):fr!==1/0&&$r===this.constructor.VERTICAL_ALIGN_MIDDLE&&(er+=fr/2-zo(Fn,rr,lr)/2);const Fr=Object.entries(Fn.chars)[0][1].xadvance,{lines:jr,longestLine:Vr}=jm(Fn,rr,lr);return jr.forEach(co=>{const Jr=co.join(" "),Xr=function(Kr,Qr,fo,_o,jo){return jo===Kr.HORIZONTAL_ALIGN_LEFT?0:jo===Kr.HORIZONTAL_ALIGN_CENTER?(_o-Rp(Qr,fo))/2:_o-Rp(Qr,fo)}(this.constructor,Fn,Jr,lr,_r);Xm.call(this,Fn,zn+Xr,er,Jr,Fr),er+=Fn.common.lineHeight}),qt(wr)&&wr.call(this,null,this,{x:zn+Vr,y:er}),this}}}),()=>({constants:{RESIZE_NEAREST_NEIGHBOR:"nearestNeighbor",RESIZE_BILINEAR:"bilinearInterpolation",RESIZE_BICUBIC:"bicubicInterpolation",RESIZE_HERMITE:"hermiteInterpolation",RESIZE_BEZIER:"bezierInterpolation"},class:{resize(Fn,zn,er,rr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",rr);if(typeof er=="function"&&rr===void 0&&(rr=er,er=null),Fn===this.constructor.AUTO&&zn===this.constructor.AUTO)return Yt.call(this,"w and h cannot both be set to auto",rr);if(Fn===this.constructor.AUTO&&(Fn=this.bitmap.width*(zn/this.bitmap.height)),zn===this.constructor.AUTO&&(zn=this.bitmap.height*(Fn/this.bitmap.width)),Fn<0||zn<0)return Yt.call(this,"w and h must be positive numbers",rr);if(Fn=Math.round(Fn)||1,zn=Math.round(zn)||1,typeof kp[er]=="function"){const lr={data:Um.alloc(Fn*zn*4),width:Fn,height:zn};kp[er](this.bitmap,lr),this.bitmap=lr}else{const lr=this;new Km(this.bitmap.width,this.bitmap.height,Fn,zn,!0,!0,fr=>{lr.bitmap.data=Um.from(fr),lr.bitmap.width=Fn,lr.bitmap.height=zn}).resize(this.bitmap.data)}return qt(rr)&&rr.call(this,null,this),this}}}),()=>({rotate(Fn,zn,er){return zn==null&&(zn=!0),typeof zn=="function"&&er===void 0&&(er=zn,zn=!0),typeof Fn!="number"?Yt.call(this,"deg must be a number",er):typeof zn!="boolean"&&typeof zn!="string"?Yt.call(this,"mode must be a boolean or a string",er):(Fn%90!=0||!zn&&this.bitmap.width!==this.bitmap.height&&Fn%180!=0?Dl.call(this,Fn,zn,er):Wu.call(this,Fn),qt(er)&&er.call(this,null,this),this)}}),()=>({scale(Fn,zn,er){if(typeof Fn!="number")return Yt.call(this,"f must be a number",er);if(Fn<0)return Yt.call(this,"f must be a positive number",er);typeof zn=="function"&&er===void 0&&(er=zn,zn=null);const rr=this.bitmap.width*Fn,lr=this.bitmap.height*Fn;return this.resize(rr,lr,zn),qt(er)&&er.call(this,null,this),this},scaleToFit(Fn,zn,er,rr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",rr);typeof er=="function"&&rr===void 0&&(rr=er,er=null);const lr=Fn/zn>this.bitmap.width/this.bitmap.height?zn/this.bitmap.height:Fn/this.bitmap.width;return this.scale(lr,er),qt(rr)&&rr.call(this,null,this),this}}),()=>({shadow(){let Fn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},zn=arguments.length>1?arguments[1]:void 0;typeof Fn=="function"&&(zn=Fn,Fn={});const{opacity:er=.7,size:rr=1.1,x:lr=-25,y:fr=25,blur:wr=5}=Fn,_r=this.clone(),$r=this.clone();return $r.scan(0,0,$r.bitmap.width,$r.bitmap.height,(Fr,jr,Vr)=>{$r.bitmap.data[Vr]=0,$r.bitmap.data[Vr+1]=0,$r.bitmap.data[Vr+2]=0,$r.bitmap.data[Vr+3]=$r.constructor.limit255($r.bitmap.data[Vr+3]*er),this.bitmap.data[Vr]=0,this.bitmap.data[Vr+1]=0,this.bitmap.data[Vr+2]=0,this.bitmap.data[Vr+3]=0}),$r.resize($r.bitmap.width*rr,$r.bitmap.height*rr).blur(wr),this.composite($r,lr,fr),this.composite(_r,0,0),qt(zn)&&zn.call(this,null,this),this}}),()=>({threshold(Fn,zn){let{max:er,replace:rr=255,autoGreyscale:lr=!0}=Fn;return typeof er!="number"?Yt.call(this,"max must be a number",zn):typeof rr!="number"?Yt.call(this,"replace must be a number",zn):typeof lr!="boolean"?Yt.call(this,"autoGreyscale must be a boolean",zn):(er=this.constructor.limit255(er),rr=this.constructor.limit255(rr),lr&&this.greyscale(),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(fr,wr,_r)=>{const $r=this.bitmap.data[_r]1&&arguments[1]!==void 0?arguments[1]:br;const er={hasAlpha:{},encoders:{},decoders:{},class:{},constants:{}};function rr(lr){Object.entries(lr).forEach(fr=>{let[wr,_r]=fr;er[wr]={...er[wr],..._r}})}Fn.types&&(Fn.types.forEach(function(lr){const fr=lr();Array.isArray(fr.mime)?xa(...fr.mime):Object.entries(fr.mime).forEach(wr=>xa(...wr)),delete fr.mime,rr(fr)}),zn.decoders={...zn.decoders,...er.decoders},zn.encoders={...zn.encoders,...er.encoders},zn.hasAlpha={...zn.hasAlpha,...er.hasAlpha}),Fn.plugins&&Fn.plugins.forEach(function(lr){const fr=lr(dr)||{};fr.class||fr.constants?rr(fr):rr({class:fr})}),Eu(er.class,zn),yu(er.constants,zn)})({types:[()=>(0,Ir.Ee)(_i(),eo(),{mime:{[Bo]:["bmp"]},constants:{MIME_BMP:Bo,MIME_X_MS_BMP:Mo},decoders:{[Bo]:xo,[Mo]:xo},encoders:{[Bo]:wo,[Mo]:wo}},{mime:{[fs]:["tiff","tif"]},constants:{MIME_TIFF:fs},decoders:{[fs]:Fn=>{const zn=rs().decode(Fn),er=zn[0];zn.forEach(lr=>{rs().decodeImage(Fn,lr)});const rr=rs().toRGBA8(er);return{data:xs.from(rr),width:er.t256[0],height:er.t257[0]}}},encoders:{[fs]:Fn=>{const zn=rs().encodeImage(Fn.bitmap.data,Fn.bitmap.width,Fn.bitmap.height);return xs.from(zn)}}},{mime:{[Ol]:["gif"]},constants:{MIME_GIF:Ol},decoders:{[Ol]:Fn=>{const zn=new Ds.N(Fn),er=Po.alloc(zn.width*zn.height*4);return zn.decodeAndBlitFrameRGBA(0,er),{data:er,width:zn.width,height:zn.height}}},encoders:{[Ol]:Fn=>{const zn=new ms.BitmapImage(Fn.bitmap);ms.GifUtil.quantizeDekker(zn,256);const er=new ms.GifFrame(zn);return new ms.GifCodec().encodeGif([er],{}).then(rr=>rr.buffer)}}})],plugins:[Fn=>{const zn=Lp.map(er=>{let rr=er(Fn)||{};return rr.class||rr.constants||(rr={class:rr}),rr});return(0,Ir.Ee)(...zn)}]})})()})();const _Jimp=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Jimp=typeof self<"u"&&self.Jimp||_Jimp,defaultScreenshotRenderer=_e=>jsxRuntimeExports.jsx("img",{src:_e});function Screenshot({screenshot:_e,renderScreenshot:Pt=defaultScreenshotRenderer}){const{result:Dt,loading:Nt}=useAsync(async()=>await(_e==null?void 0:_e()),[_e]);return Pt(Dt,Nt)}function Gallery({onChange:_e}){const Pt=usePaper(),[Dt]=useScreenshots(),[Nt,{set:jt,remove:Ut}]=useMap$1();reactExports.useEffect(()=>{_e==null||_e(lodashExports$1.values(Nt))},[Nt]);function Gt(Wt,qt,Yt){qt&&Yt?jt(`${Wt}`,Yt):Ut(`${Wt}`)}return useAsync(async()=>{const Wt=lodashExports$1.head(lodashExports$1.values(Dt)),qt=await(Wt==null?void 0:Wt());qt&&Gt(0,!0,qt)},[Dt]),jsxRuntimeExports.jsx(Scroll,{x:!0,py:2,children:jsxRuntimeExports.jsx(Stack$1,{direction:"row",children:lodashExports$1.values(Dt).map((Wt,qt)=>jsxRuntimeExports.jsx(Screenshot,{screenshot:Wt,renderScreenshot:(Yt,Xt)=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Box$1,{sx:{minWidth:"320px",height:"320px",flex:0,p:2,"&:not(:last-child)":{pr:1}},children:jsxRuntimeExports.jsxs(Box$1,{sx:{position:"relative",...Pt(1),height:"100%"},children:[!!Yt&&jsxRuntimeExports.jsx(Box$1,{sx:{backgroundImage:Zt=>`linear-gradient(to bottom, ${alpha(Zt.palette.background.paper,.5)}, transparent), url("${Yt}")`,width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center"}}),jsxRuntimeExports.jsx(Box$1,{sx:{position:"absolute",p:1,top:0,left:0},children:jsxRuntimeExports.jsx(FormControlLabel$1,{control:jsxRuntimeExports.jsx(Checkbox$1,{checked:!!Nt[qt],disabled:!Yt,color:"primary",sx:{ml:1},onChange:(Zt,Qt)=>Gt(qt,Qt,Yt)}),label:`Viewport ${qt+1}`})}),Xt&&jsxRuntimeExports.jsx(Box$1,{sx:{position:"absolute",m:2,top:0,right:0},children:jsxRuntimeExports.jsx(CircularProgress$1,{})})]})})})},qt))})})}function getFilename(_e=""){return lodashExports$1.kebabCase(_e.replace("*"," star "))||"untitled"}const imageSize=64;async function resizeImage(_e){const Pt=await Jimp.read(Buffer.from(_e.split(",")[1],"base64")),Dt=Pt.getWidth(){const Zt=lodashExports$1.delay(()=>{Dt(Qt=>({...Qt,workspaceMeta:Nt}))},300);return()=>clearTimeout(Zt)},[Nt,Dt],[Nt]);const{save:Ut,estimateWorkspaceSize:Gt}=useWorkspace(),Wt=useLoadingState("general"),qt=useSnackbar(),Yt=reactExports.useMemo(Gt,[]);async function Xt(Zt){return{...Nt,id:nanoid$1(),size:Zt,screenshots:await map$6((Nt==null?void 0:Nt.screenshots)??[],resizeImage),lastModified:Date.now()}}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Gallery,{onChange:Zt=>jt("screenshots",Zt)})}),jsxRuntimeExports.jsxs(Stack$1,{p:2,gap:2,children:[jsxRuntimeExports.jsx(TextField$1,{...textFieldProps,defaultValue:Nt.name,onChange:Zt=>jt("name",Zt.target.value),label:"Name",fullWidth:!0}),jsxRuntimeExports.jsx(TextField$1,{...textFieldProps,minRows:3,defaultValue:Nt.description,size:"small",onChange:Zt=>jt("description",Zt.target.value),label:"Description",fullWidth:!0,multiline:!0}),jsxRuntimeExports.jsx(TextField$1,{...textFieldProps,defaultValue:Nt.author,size:"small",onChange:Zt=>jt("author",Zt.target.value),label:"Author",fullWidth:!0,multiline:!0}),jsxRuntimeExports.jsx(Box$1,{sx:{pt:2,width:"100%"},children:jsxRuntimeExports.jsx(Button,{sx:{justifyContent:"flex-start",width:"100%",..._e(1)},onClick:()=>Wt(async()=>{const Zt=getFilename(Nt.name),{size:Qt}=await Ut(!1,Zt);download(JSON.stringify(await Xt(Qt)),`${Zt}.workspace.meta`),qt(`Metadata saved, ${Zt}.workspace.meta`)}),startIcon:jsxRuntimeExports.jsx(DownloadOutlined,{}),size:"large",children:jsxRuntimeExports.jsxs(Stack$1,{sx:{ml:1},alignItems:"baseline",children:[Nt.name||"Untitled",jsxRuntimeExports.jsxs(Type$1,{color:"text.secondary",children:[getFilename(Nt.name),".workspace"]}),jsxRuntimeExports.jsxs(Type$1,{color:"text.secondary",children:[lodashExports$1.ceil(Yt/1024/1024,2)," MB"]})]})})})]})]})}function ExportWorkspaceModal(_e){return jsxRuntimeExports.jsxs(Modal,{..._e,children:[jsxRuntimeExports.jsx(ModalAppBar,{onClose:()=>{var Pt;return(Pt=_e==null?void 0:_e.onClose)==null?void 0:Pt.call(_e,{},"backdropClick")},children:jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:"Publish Workspace"})}),jsxRuntimeExports.jsx(A$3,{})]})}function MenuEntry({startIcon:_e,endIcon:Pt,label:Dt}){return jsxRuntimeExports.jsxs(Stack$1,{direction:"row",gap:1,children:[!!_e&&reactExports.cloneElement(_e,{fontSize:"small",color:"disabled"}),jsxRuntimeExports.jsx("span",{children:Dt}),!!Pt&&reactExports.cloneElement(Pt,{fontSize:"small",color:"disabled"})]})}function useTitleBarVisible(){const[_e,Pt]=reactExports.useState(!1);return reactExports.useEffect(()=>{if("windowControlsOverlay"in navigator){const Dt=()=>{Pt(!!navigator.windowControlsOverlay.visible)};return navigator.windowControlsOverlay.addEventListener("geometrychange",Dt),Dt(),()=>navigator.windowControlsOverlay.removeEventListener("geometrychange",Dt)}},[Pt]),_e}const TitleBar=()=>{const{save:_e,load:Pt}=useWorkspace(),Dt=useTitleBarVisible(),[,Nt]=useView(),[jt,Ut]=reactExports.useState(!1);function Gt(Wt){Nt(({view:qt})=>({view:{type:"branch",orientation:Wt,key:nanoid$1(),children:[{...qt,size:80},{type:"leaf",key:nanoid$1(),content:{type:""},size:20,acceptDrop:!0}]}}))}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box$1,{sx:{mx:.5,borderBottom:Wt=>`1px solid ${Wt.palette.background.default}`,minHeight:36,height:Dt?"env(titlebar-area-height, 50px)":0,width:"env(titlebar-area-width, 100%)",WebkitAppRegion:"drag",overflowX:"auto"},children:jsxRuntimeExports.jsx(Scroll,{x:!0,style:{height:"100%"},children:jsxRuntimeExports.jsx(Box$1,{sx:{height:"100%"},children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",spacing:1,sx:{height:"100%"},alignItems:"center",children:[jsxRuntimeExports.jsx(Box$1,{sx:{p:1,height:"100%"},children:jsxRuntimeExports.jsx("img",{src:logo,style:{height:"100%"}})}),[{key:"view",items:[{type:"action",key:"panel-new-right",name:"Add panel to the right",action:()=>Gt("horizontal")},{type:"action",key:"panel-new-bottom",name:"Add panel below",action:()=>Gt("vertical")},{type:"divider"},{type:"action",name:"Reset layout",key:"panel-reset",action:()=>Nt(getDefaultViewTree)}]},{key:"workspace",items:[{type:"action",name:"Open workspace",key:"workspace-load",action:Pt},{type:"action",name:"Save workspace",key:"workspace-save",action:_e},{type:"action",name:jsxRuntimeExports.jsx(MenuEntry,{label:"Publish workspace",endIcon:jsxRuntimeExports.jsx(OpenInNewOutlined,{})}),key:"workspace-save-metadata",action:()=>Ut(!0)}]},{key:"help",items:[{type:"action",name:"Open repository in GitHub",key:"github",action:()=>open(repository,"_blank")},{type:"action",name:"Changelog",key:"changelog",action:()=>open(`${docs}/changelog-${version}.md`,"_blank")},{type:"action",name:"Documentation",key:"documentation",action:()=>open("https://path-visualiser.github.io/docs/overview/","_blank")}]}].map(({key:Wt,items:qt})=>jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Yt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Menu$1,{...bindMenu(Yt),children:jsxRuntimeExports.jsx(MenuList$1,{dense:!0,sx:{p:0},children:qt.map((Xt,Zt)=>{if(Xt.type==="action"){const{name:Qt,key:en,action:tn}=Xt;return jsxRuntimeExports.jsx(MenuItem$1,{onClick:()=>{tn==null||tn(),Yt.close()},children:Qt},en)}else return jsxRuntimeExports.jsx(Divider$1,{},Zt)})})}),jsxRuntimeExports.jsx(FeaturePickerButton,{...bindTrigger(Yt),sx:{WebkitAppRegion:"no-drag",minWidth:"fit-content",p:.5,px:1},children:lodashExports$1.startCase(Wt)})]})},Wt))]})})})}),jsxRuntimeExports.jsx(ExportWorkspaceModal,{open:jt,onClose:()=>Ut(!1)})]})};function AppBarTitle({children:_e}){return jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:_e})}function ModalAppBar({onClose:_e=()=>{},style:Pt,elevatedStyle:Dt,children:Nt,transitionProperties:jt=["box-shadow","background","border-bottom"],elevatedChildren:Ut,simple:Gt,position:Wt="sticky"}){const qt=useSmallDisplay(),Yt=usePanel(),Xt=useTheme(),[,,Zt,,Qt]=useScrollState();reactExports.useEffect(()=>{Qt(Yt)},[Yt,Qt]);const en=Zt?{background:qt?Xt.palette.background.default:Xt.palette.background.paper,...!Gt&&{boxShadow:Xt.shadows[0]},...Pt}:{background:qt?Xt.palette.background.default:Xt.palette.background.paper,...!Gt&&{boxShadow:Xt.shadows[4]},...Dt};function tn(nn){return typeof nn=="string"?jsxRuntimeExports.jsx(AppBarTitle,{children:nn}):nn}return jsxRuntimeExports.jsx(AppBar$1,{elevation:0,position:Wt,style:{color:Xt.palette.text.primary,transition:Xt.transitions.create(jt),...en},children:jsxRuntimeExports.jsxs(Toolbar$1,{children:[jsxRuntimeExports.jsx(IconButton$1,{style:{marginRight:Xt.spacing(1)},"aria-label":"open drawer",edge:"start",onClick:()=>_e(),children:jsxRuntimeExports.jsx(ArrowBack,{})}),Nt&&jsxRuntimeExports.jsx("div",{style:{gridColumn:1,gridRow:1,flex:1,overflow:"auto"},children:jsxRuntimeExports.jsx(Fade$1,{in:!!(!Ut||Zt),mountOnEnter:!0,unmountOnExit:!0,children:jsxRuntimeExports.jsx(Box$1,{style:{width:"100%"},children:tn(Nt)})})}),Ut&&jsxRuntimeExports.jsx("div",{style:{gridColumn:1,gridRow:1,flex:1,overflow:"auto"},children:jsxRuntimeExports.jsx(Fade$1,{in:!!(Ut&&!Zt),mountOnEnter:!0,unmountOnExit:!0,children:jsxRuntimeExports.jsx(Box$1,{style:{width:"100%"},children:tn(Ut)})})})]})})}function Modal({children:_e,actions:Pt,width:Dt=480,height:Nt,variant:jt="default",scrollable:Ut=!0,...Gt}){var mn;const[Wt,qt]=reactExports.useState(void 0);reactExports.useEffect(()=>{_e&&qt(_e)},[_e]);const Yt=useTheme(),Xt=useSmallDisplay(),[Zt,Qt]=reactExports.useState(null),[en,tn]=reactExports.useState(null),[nn,rn]=reactExports.useState(!1),[an,sn]=reactExports.useState(0),ln=useTitleBarVisible();reactExports.useEffect(()=>{if(Zt&&en&&!Xt&&!Nt){const gn=()=>{const hn=window.innerHeight-64{window.removeEventListener("resize",gn),un.detach()}}},[Zt,en,Xt,Nt]);const dn=jt==="submodal"&&Xt;return jsxRuntimeExports.jsxs(Dialog$1,{fullScreen:Xt,...Gt,keepMounted:!1,TransitionProps:{unmountOnExit:!0,mountOnEnter:!0},style:{...dn&&{paddingTop:Yt.spacing(8)},...Gt.style},PaperProps:{ref:gn=>Qt(gn),style:{...dn&&{borderRadius:`${Yt.shape.borderRadius}px ${Yt.shape.borderRadius}px 0 0`},background:Xt?Yt.palette.background.default:Yt.palette.background.paper,overflow:"hidden",height:Nt&&!Xt?Nt:nn||Xt?"100%":an||"fit-content",position:"relative",maxWidth:"none",...Xt&&ln&&{paddingTop:36},...(mn=Gt.PaperProps)==null?void 0:mn.style},...Gt.PaperProps},children:[jsxRuntimeExports.jsx(Scroll,{y:!0,style:{height:"100%",width:Xt?void 0:Dt,maxWidth:"100%",overflow:Ut?void 0:"hidden"},children:jsxRuntimeExports.jsx("div",{ref:gn=>tn(gn),style:{width:"100%"},children:Wt})}),Pt]})}function ManagedModal({appBar:_e,trigger:Pt=()=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}),children:Dt,popover:Nt,slotProps:jt}){const Ut=usePaper(),Gt=useAcrylic(),Wt=useSmallDisplay(),qt=Nt&&!Wt;return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Yt=>{var en,tn;const{open:Xt,close:Zt,isOpen:Qt}=Yt;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[reactExports.cloneElement(Pt(Xt,Qt)),qt?jsxRuntimeExports.jsx(Popover$1,{...lodashExports$1.merge(bindPopover(Yt),{slotProps:{paper:{sx:{...Gt}}}},jt==null?void 0:jt.popover),children:jsxRuntimeExports.jsx(Box$1,{...lodashExports$1.merge({sx:{width:360,...Ut(1)}},jt==null?void 0:jt.paper),children:Dt??((en=jt==null?void 0:jt.modal)==null?void 0:en.children)})}):jsxRuntimeExports.jsxs(Modal,{open:Qt,onClose:Zt,...jt==null?void 0:jt.modal,children:[jsxRuntimeExports.jsx(ModalAppBar,{onClose:Zt,..._e}),Dt??((tn=jt==null?void 0:jt.modal)==null?void 0:tn.children)]})]})}})}var rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote$1(_e){return rx_escapable.lastIndex=0,rx_escapable.test(_e)?'"'+_e.replace(rx_escapable,function(Pt){var Dt=meta[Pt];return typeof Dt=="string"?Dt:"\\u"+("0000"+Pt.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+_e+'"'}function str$1(_e,Pt,Dt){var Nt,jt,Ut,Gt,Wt=gap,qt,Yt=Pt[_e];switch(Yt&&typeof Yt=="object"&&typeof Yt.toJSON=="function"&&(Yt=Yt.toJSON(_e)),typeof rep=="function"&&(Yt=rep.call(Pt,_e,Yt)),typeof Yt){case"string":return quote$1(Yt);case"number":return isFinite(Yt)?String(Yt):"null";case"boolean":case"null":return String(Yt);case"object":if(!Yt)return"null";if(gap+=indent,qt=[],Object.prototype.toString.apply(Yt)==="[object Array]"){for(Gt=Yt.length,Nt=0;NtDt?`[ +`)===0?Pn.substr(1,Pn.length):Pn}).forEach(function(Pn){var Cn=Pn.split(":"),Gn=Cn.shift().trim();if(Gn){var In=Cn.join(":").trim();Nn.append(Gn,In)}}),Nn)};An.url="responseURL"in Tn?Tn.responseURL:An.headers.get("X-Request-URL");var Dn="response"in Tn?Tn.response:Tn.responseText;setTimeout(function(){bn(new ln(Dn,An))},0)},Tn.onerror=function(){setTimeout(function(){En(new TypeError("Network request failed"))},0)},Tn.ontimeout=function(){setTimeout(function(){En(new TypeError("Network request failed"))},0)},Tn.onabort=function(){setTimeout(function(){En(new mn("Aborted","AbortError"))},0)},Tn.open(_n.method,function(pn){try{return pn===""&&Nt.location.href?Nt.location.href:pn}catch{return pn}}(_n.url),!0),_n.credentials==="include"?Tn.withCredentials=!0:_n.credentials==="omit"&&(Tn.withCredentials=!1),"responseType"in Tn&&(jt.blob?Tn.responseType="blob":jt.arrayBuffer&&_n.headers.get("Content-Type")&&_n.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(Tn.responseType="arraybuffer")),!hn||typeof hn.headers!="object"||hn.headers instanceof Xt?_n.headers.forEach(function(pn,Nn){Tn.setRequestHeader(Nn,pn)}):Object.getOwnPropertyNames(hn.headers).forEach(function(pn){Tn.setRequestHeader(pn,qt(hn.headers[pn]))}),_n.signal&&(_n.signal.addEventListener("abort",$n),Tn.onreadystatechange=function(){Tn.readyState===4&&_n.signal.removeEventListener("abort",$n)}),Tn.send(_n._bodyInit===void 0?null:_n._bodyInit)})}gn.polyfill=!0,Nt.fetch||(Nt.fetch=gn,Nt.Headers=Xt,Nt.Request=an,Nt.Response=ln)},6290:(_e,Pt,Dt)=>{var Nt=Dt(5048),jt=Dt(9748),Ut=Dt(4655),Gt=Dt(1960);function Wt(Xt,Zt,Qt){var en=Xt;return jt(Zt)?(Qt=Zt,typeof Xt=="string"&&(en={uri:Xt})):en=Gt(Zt,{uri:Xt}),en.callback=Qt,en}function qt(Xt,Zt,Qt){return Yt(Zt=Wt(Xt,Zt,Qt))}function Yt(Xt){if(Xt.callback===void 0)throw new Error("callback argument missing");var Zt=!1,Qt=function(_n,Tn,$n){Zt||(Zt=!0,Xt.callback(_n,Tn,$n))};function en(){var _n=void 0;if(_n=sn.response?sn.response:sn.responseText||function(Tn){try{if(Tn.responseType==="document")return Tn.responseXML;var $n=Tn.responseXML&&Tn.responseXML.documentElement.nodeName==="parsererror";if(Tn.responseType===""&&!$n)return Tn.responseXML}catch{}return null}(sn),bn)try{_n=JSON.parse(_n)}catch{}return _n}function tn(_n){return clearTimeout(ln),_n instanceof Error||(_n=new Error(""+(_n||"Unknown XMLHttpRequest Error"))),_n.statusCode=0,Qt(_n,En)}function nn(){if(!an){var _n;clearTimeout(ln),_n=Xt.useXDR&&sn.status===void 0?200:sn.status===1223?204:sn.status;var Tn=En,$n=null;return _n!==0?(Tn={body:en(),statusCode:_n,method:mn,headers:{},url:dn,rawRequest:sn},sn.getAllResponseHeaders&&(Tn.headers=Ut(sn.getAllResponseHeaders()))):$n=new Error("Internal XMLHttpRequest Error"),Qt($n,Tn,Tn.body)}}var rn,an,sn=Xt.xhr||null;sn||(sn=Xt.cors||Xt.useXDR?new qt.XDomainRequest:new qt.XMLHttpRequest);var ln,dn=sn.url=Xt.uri||Xt.url,mn=sn.method=Xt.method||"GET",gn=Xt.body||Xt.data,un=sn.headers=Xt.headers||{},hn=!!Xt.sync,bn=!1,En={body:void 0,headers:{},statusCode:0,method:mn,url:dn,rawRequest:sn};if("json"in Xt&&Xt.json!==!1&&(bn=!0,un.accept||un.Accept||(un.Accept="application/json"),mn!=="GET"&&mn!=="HEAD"&&(un["content-type"]||un["Content-Type"]||(un["Content-Type"]="application/json"),gn=JSON.stringify(Xt.json===!0?gn:Xt.json))),sn.onreadystatechange=function(){sn.readyState===4&&setTimeout(nn,0)},sn.onload=nn,sn.onerror=tn,sn.onprogress=function(){},sn.onabort=function(){an=!0},sn.ontimeout=tn,sn.open(mn,dn,!hn,Xt.username,Xt.password),hn||(sn.withCredentials=!!Xt.withCredentials),!hn&&Xt.timeout>0&&(ln=setTimeout(function(){if(!an){an=!0,sn.abort("timeout");var _n=new Error("XMLHttpRequest timeout");_n.code="ETIMEDOUT",tn(_n)}},Xt.timeout)),sn.setRequestHeader)for(rn in un)un.hasOwnProperty(rn)&&sn.setRequestHeader(rn,un[rn]);else if(Xt.headers&&!function(_n){for(var Tn in _n)if(_n.hasOwnProperty(Tn))return!1;return!0}(Xt.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in Xt&&(sn.responseType=Xt.responseType),"beforeSend"in Xt&&typeof Xt.beforeSend=="function"&&Xt.beforeSend(sn),sn.send(gn||null),sn}_e.exports=qt,_e.exports.default=qt,qt.XMLHttpRequest=Nt.XMLHttpRequest||function(){},qt.XDomainRequest="withCredentials"in new qt.XMLHttpRequest?qt.XMLHttpRequest:Nt.XDomainRequest,function(Xt,Zt){for(var Qt=0;Qt{_e.exports=self.DOMParser!==void 0?function(Pt){return new self.DOMParser().parseFromString(Pt,"application/xml")}:self.ActiveXObject!==void 0&&new self.ActiveXObject("Microsoft.XMLDOM")?function(Pt){var Dt=new self.ActiveXObject("Microsoft.XMLDOM");return Dt.async="false",Dt.loadXML(Pt),Dt}:function(Pt){var Dt=document.createElement("div");return Dt.innerHTML=Pt,Dt}},1960:_e=>{_e.exports=function(){for(var Dt={},Nt=0;Nt{},6777:()=>{},5546:()=>{},2460:(_e,Pt,Dt)=>{var Nt=Dt(4406),jt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,Gt=Object.getOwnPropertyNames,Wt=Object.prototype.hasOwnProperty,qt=(Mn,dr)=>{for(var br in dr)jt(Mn,br,{get:dr[br],enumerable:!0})},Yt=(Mn=>(dr,br)=>Mn&&Mn.get(dr)||(br=((Ir,Nr,Yr,zr)=>{if(Nr&&typeof Nr=="object"||typeof Nr=="function")for(let _i of Gt(Nr))Wt.call(Ir,_i)||jt(Ir,_i,{get:()=>Nr[_i],enumerable:!(zr=Ut(Nr,_i))||zr.enumerable});return Ir})(jt({},"__esModule",{value:!0}),dr),Mn&&Mn.set(dr,br),br))(typeof WeakMap<"u"?new WeakMap:0),Xt=(Mn,dr,br)=>(((Ir,Nr,Yr)=>{Nr in Ir?jt(Ir,Nr,{enumerable:!0,configurable:!0,writable:!0,value:Yr}):Ir[Nr]=Yr})(Mn,typeof dr!="symbol"?dr+"":dr,br),br),Zt={};qt(Zt,{applyPalette:()=>wu,applyPaletteSync:()=>Ml,buildPalette:()=>_u,buildPaletteSync:()=>bs,constants:()=>Qt,conversion:()=>an,distance:()=>Rn,image:()=>xa,palette:()=>hr,quality:()=>$a,utils:()=>ir});var Qt={};qt(Qt,{bt709:()=>en});var en={};qt(en,{Y:()=>tn,x:()=>nn,y:()=>rn});var tn=(Mn=>(Mn[Mn.RED=.2126]="RED",Mn[Mn.GREEN=.7152]="GREEN",Mn[Mn.BLUE=.0722]="BLUE",Mn[Mn.WHITE=1]="WHITE",Mn))(tn||{}),nn=(Mn=>(Mn[Mn.RED=.64]="RED",Mn[Mn.GREEN=.3]="GREEN",Mn[Mn.BLUE=.15]="BLUE",Mn[Mn.WHITE=.3127]="WHITE",Mn))(nn||{}),rn=(Mn=>(Mn[Mn.RED=.33]="RED",Mn[Mn.GREEN=.6]="GREEN",Mn[Mn.BLUE=.06]="BLUE",Mn[Mn.WHITE=.329]="WHITE",Mn))(rn||{}),an={};function sn(Mn){return Mn>.04045?((Mn+.055)/1.055)**2.4:Mn/12.92}function ln(Mn,dr,br){return{x:.4124*(Mn=sn(Mn/255))+.3576*(dr=sn(dr/255))+.1805*(br=sn(br/255)),y:.2126*Mn+.7152*dr+.0722*br,z:.0193*Mn+.1192*dr+.9505*br}}qt(an,{lab2rgb:()=>Sn,lab2xyz:()=>Zn,rgb2hsl:()=>Tn,rgb2lab:()=>Pn,rgb2xyz:()=>ln,xyz2lab:()=>Dn,xyz2rgb:()=>ar});var dn={};function mn(Mn){return Mn*(Math.PI/180)}function gn(Mn,dr,br){let Ir=Mn;return Irdr&&(Ir=dr),Ir>br&&(Ir=br),Ir}function hn(Mn,dr,br){return Mn>br&&(Mn=br),Mn255?Mn=255:Mn<0&&(Mn=0),Mn}function En(Mn){return Mn>255?Mn=255:Mn<0&&(Mn=0),Mn}function _n(Mn,dr){const br=typeof Mn[0];let Ir;if(br==="number"||br==="string"){const Nr=Object.create(null);for(let Yr=0,zr=Mn.length;Yrdr(Yr,zr)||Nr[Yr]-Nr[zr])}else{const Nr=Mn.slice(0);Ir=Mn.sort((Yr,zr)=>dr(Yr,zr)||Nr.indexOf(Yr)-Nr.indexOf(zr))}return Ir}function Tn(Mn,dr,br){const Ir=un(Mn,dr,br),Nr=gn(Mn,dr,br),Yr=Nr-Ir,zr=(Ir+Nr)/510;let _i=0;zr>0&&zr<1&&(_i=Yr/(zr<.5?Nr+Ir:510-Nr-Ir));let qr=0;return Yr>0&&(qr=Nr===Mn?(dr-br)/Yr:Nr===dr?2+(br-Mn)/Yr:4+(Mn-dr)/Yr,qr*=60,qr<0&&(qr+=360)),{h:qr,s:_i,l:zr}}qt(dn,{degrees2radians:()=>mn,inRange0to255:()=>En,inRange0to255Rounded:()=>bn,intInRange:()=>hn,max3:()=>gn,min3:()=>un,stableSort:()=>_n});var $n=.95047,pn=1,Nn=1.08883;function An(Mn){return Mn>.008856?Mn**.3333333333333333:7.787*Mn+.13793103448275862}function Dn(Mn,dr,br){if(Mn=An(Mn/$n),dr=An(dr/pn),br=An(br/Nn),116*dr-16<0)throw new Error("xxx");return{L:Math.max(0,116*dr-16),a:500*(Mn-dr),b:200*(dr-br)}}function Pn(Mn,dr,br){const Ir=ln(Mn,dr,br);return Dn(Ir.x,Ir.y,Ir.z)}var Cn=.95047,Gn=1,In=1.08883;function Bn(Mn){return Mn>.206893034?Mn**3:(Mn-.13793103448275862)/7.787}function Zn(Mn,dr,br){const Ir=(Mn+16)/116,Nr=Ir-br/200;return{x:Cn*Bn(dr/500+Ir),y:Gn*Bn(Ir),z:In*Bn(Nr)}}function nr(Mn){return Mn>.0031308?1.055*Mn**.4166666666666667-.055:12.92*Mn}function ar(Mn,dr,br){const Ir=nr(3.2406*Mn+-1.5372*dr+-.4986*br),Nr=nr(-.9689*Mn+1.8758*dr+.0415*br),Yr=nr(.0557*Mn+-.204*dr+1.057*br);return{r:bn(255*Ir),g:bn(255*Nr),b:bn(255*Yr)}}function Sn(Mn,dr,br){const Ir=Zn(Mn,dr,br);return ar(Ir.x,Ir.y,Ir.z)}var Rn={};qt(Rn,{AbstractDistanceCalculator:()=>On,AbstractEuclidean:()=>kn,AbstractManhattan:()=>gr,CIE94GraphicArts:()=>vn,CIE94Textiles:()=>yn,CIEDE2000:()=>Un,CMetric:()=>Kn,Euclidean:()=>tr,EuclideanBT709:()=>or,EuclideanBT709NoAlpha:()=>Jn,Manhattan:()=>Er,ManhattanBT709:()=>Rr,ManhattanNommyde:()=>Sr,PNGQuant:()=>sr});var On=class{constructor(){Xt(this,"_maxDistance"),Xt(this,"_whitePoint"),this._setDefaults(),this.setWhitePoint(255,255,255,255)}setWhitePoint(Mn,dr,br,Ir){this._whitePoint={r:Mn>0?255/Mn:0,g:dr>0?255/dr:0,b:br>0?255/br:0,a:Ir>0?255/Ir:0},this._maxDistance=this.calculateRaw(Mn,dr,br,Ir,0,0,0,0)}calculateNormalized(Mn,dr){return this.calculateRaw(Mn.r,Mn.g,Mn.b,Mn.a,dr.r,dr.g,dr.b,dr.a)/this._maxDistance}},Vn=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){const qr=Pn(En(Mn*this._whitePoint.r),En(dr*this._whitePoint.g),En(br*this._whitePoint.b)),so=Pn(En(Nr*this._whitePoint.r),En(Yr*this._whitePoint.g),En(zr*this._whitePoint.b)),eo=qr.L-so.L,io=qr.a-so.a,yo=qr.b-so.b,Bo=Math.sqrt(qr.a*qr.a+qr.b*qr.b),Mo=Bo-Math.sqrt(so.a*so.a+so.b*so.b);let xo=io*io+yo*yo-Mo*Mo;xo=xo<0?0:Math.sqrt(xo);const wo=(_i-Ir)*this._whitePoint.a*this._kA;return Math.sqrt((eo/this._Kl)**2+(Mo/(1+this._K1*Bo))**2+(xo/(1+this._K2*Bo))**2+wo**2)}},yn=class extends Vn{_setDefaults(){this._Kl=2,this._K1=.048,this._K2=.014,this._kA=12.5/255}},vn=class extends Vn{_setDefaults(){this._Kl=1,this._K1=.045,this._K2=.015,this._kA=25/255}},wn=class extends On{_setDefaults(){}static _calculatehp(Mn,dr){const br=Math.atan2(Mn,dr);return br>=0?br:br+wn._deg360InRad}static _calculateRT(Mn,dr){const br=dr**7,Ir=2*Math.sqrt(br/(br+wn._pow25to7)),Nr=wn._deg30InRad*Math.exp(-(((Mn-wn._deg275InRad)/wn._deg25InRad)**2));return-Math.sin(2*Nr)*Ir}static _calculateT(Mn){return 1-.17*Math.cos(Mn-wn._deg30InRad)+.24*Math.cos(2*Mn)+.32*Math.cos(3*Mn+wn._deg6InRad)-.2*Math.cos(4*Mn-wn._deg63InRad)}static _calculate_ahp(Mn,dr,br,Ir){const Nr=br+Ir;return Mn===0?Nr:dr<=wn._deg180InRad?Nr/2:Nr>8)+4*eo*eo+((767-qr)*io*io>>8),Bo=(_i-Ir)*this._whitePoint.a;return Math.sqrt(yo+Bo*Bo)}_setDefaults(){}},kn=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){const qr=Nr-Mn,so=Yr-dr,eo=zr-br,io=_i-Ir;return Math.sqrt(this._kR*qr*qr+this._kG*so*so+this._kB*eo*eo+this._kA*io*io)}},tr=class extends kn{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},or=class extends kn{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},Jn=class extends kn{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=0}},gr=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){let qr=Nr-Mn,so=Yr-dr,eo=zr-br,io=_i-Ir;return qr<0&&(qr=0-qr),so<0&&(so=0-so),eo<0&&(eo=0-eo),io<0&&(io=0-io),this._kR*qr+this._kG*so+this._kB*eo+this._kA*io}},Er=class extends gr{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},Sr=class extends gr{_setDefaults(){this._kR=.4984,this._kG=.8625,this._kB=.2979,this._kA=1}},Rr=class extends gr{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},sr=class extends On{calculateRaw(Mn,dr,br,Ir,Nr,Yr,zr,_i){const qr=(_i-Ir)*this._whitePoint.a;return this._colordifferenceCh(Mn*this._whitePoint.r,Nr*this._whitePoint.r,qr)+this._colordifferenceCh(dr*this._whitePoint.g,Yr*this._whitePoint.g,qr)+this._colordifferenceCh(br*this._whitePoint.b,zr*this._whitePoint.b,qr)}_colordifferenceCh(Mn,dr,br){const Ir=Mn-dr,Nr=Ir+br;return Ir*Ir+Nr*Nr}_setDefaults(){}},hr={};qt(hr,{AbstractPaletteQuantizer:()=>Tr,ColorHistogram:()=>no,NeuQuant:()=>ur,NeuQuantFloat:()=>to,RGBQuant:()=>Lr,WuColorCube:()=>Ao,WuQuant:()=>qo});var Tr=class{quantizeSync(){for(const Mn of this.quantize())if(Mn.palette)return Mn.palette;throw new Error("unreachable")}},Mr=class{constructor(){Xt(this,"r"),Xt(this,"g"),Xt(this,"b"),Xt(this,"a"),Xt(this,"uint32"),Xt(this,"rgba"),this.uint32=-1>>>0,this.r=this.g=this.b=this.a=0,this.rgba=new Array(4),this.rgba[0]=0,this.rgba[1]=0,this.rgba[2]=0,this.rgba[3]=0}static createByQuadruplet(Mn){const dr=new Mr;return dr.r=0|Mn[0],dr.g=0|Mn[1],dr.b=0|Mn[2],dr.a=0|Mn[3],dr._loadUINT32(),dr._loadQuadruplet(),dr}static createByRGBA(Mn,dr,br,Ir){const Nr=new Mr;return Nr.r=0|Mn,Nr.g=0|dr,Nr.b=0|br,Nr.a=0|Ir,Nr._loadUINT32(),Nr._loadQuadruplet(),Nr}static createByUint32(Mn){const dr=new Mr;return dr.uint32=Mn>>>0,dr._loadRGBA(),dr._loadQuadruplet(),dr}from(Mn){this.r=Mn.r,this.g=Mn.g,this.b=Mn.b,this.a=Mn.a,this.uint32=Mn.uint32,this.rgba[0]=Mn.r,this.rgba[1]=Mn.g,this.rgba[2]=Mn.b,this.rgba[3]=Mn.a}getLuminosity(Mn){let dr=this.r,br=this.g,Ir=this.b;return Mn&&(dr=Math.min(255,255-this.a+this.a*dr/255),br=Math.min(255,255-this.a+this.a*br/255),Ir=Math.min(255,255-this.a+this.a*Ir/255)),.2126*dr+.7152*br+.0722*Ir}_loadUINT32(){this.uint32=(this.a<<24|this.b<<16|this.g<<8|this.r)>>>0}_loadRGBA(){this.r=255&this.uint32,this.g=this.uint32>>>8&255,this.b=this.uint32>>>16&255,this.a=this.uint32>>>24&255}_loadQuadruplet(){this.rgba[0]=this.r,this.rgba[1]=this.g,this.rgba[2]=this.b,this.rgba[3]=this.a}},qn=class{constructor(){Xt(this,"_pointArray"),Xt(this,"_width"),Xt(this,"_height"),this._width=0,this._height=0,this._pointArray=[]}getWidth(){return this._width}getHeight(){return this._height}setWidth(Mn){this._width=Mn}setHeight(Mn){this._height=Mn}getPointArray(){return this._pointArray}clone(){const Mn=new qn;Mn._width=this._width,Mn._height=this._height;for(let dr=0,br=this._pointArray.length;dr=Nr&&Mn=0;dr--)if(Mn.uint32===this._pointArray[dr].uint32)return!0;return!1}getNearestColor(Mn,dr){return this._pointArray[0|this._getNearestIndex(Mn,dr)]}getPointContainer(){return this._pointContainer}_nearestPointFromCache(Mn){return typeof this._i32idx[Mn]=="number"?this._i32idx[Mn]:-1}_getNearestIndex(Mn,dr){let br=this._nearestPointFromCache(""+dr.uint32);if(br>=0)return br;let Ir=Number.MAX_VALUE;br=0;for(let Nr=0,Yr=this._pointArray.length;Nr{const br=Tn(Mn.r,Mn.g,Mn.b),Ir=Tn(dr.r,dr.g,dr.b),Nr=Mn.r===Mn.g&&Mn.g===Mn.b?0:1+Ln(br.h,10),Yr=(dr.r===dr.g&&dr.g===dr.b?0:1+Ln(Ir.h,10))-Nr;if(Yr)return-Yr;const zr=Mn.getLuminosity(!0),_i=dr.getLuminosity(!0);if(_i-zr!=0)return _i-zr;const qr=(100*Ir.s|0)-(100*br.s|0);return qr?-qr:0})}},ir={};qt(ir,{HueStatistics:()=>kr,Palette:()=>jn,Point:()=>Mr,PointContainer:()=>qn,ProgressTracker:()=>Wn,arithmetic:()=>dn});var mr=class{constructor(){Xt(this,"num",0),Xt(this,"cols",[])}},kr=class{constructor(Mn,dr){Xt(this,"_numGroups"),Xt(this,"_minCols"),Xt(this,"_stats"),Xt(this,"_groupsFull"),this._numGroups=Mn,this._minCols=dr,this._stats=[];for(let br=0;br<=Mn;br++)this._stats[br]=new mr;this._groupsFull=0}check(Mn){this._groupsFull===this._numGroups+1&&(this.check=()=>{});const dr=255&Mn,br=Mn>>>8&255,Ir=Mn>>>16&255,Nr=dr===br&&br===Ir?0:1+Ln(Tn(dr,br,Ir).h,this._numGroups),Yr=this._stats[Nr],zr=this._minCols;Yr.num++,Yr.num>zr||(Yr.num===zr&&this._groupsFull++,Yr.num<=zr&&this._stats[Nr].cols.push(Mn))}injectIntoDictionary(Mn){for(let dr=0;dr<=this._numGroups;dr++)this._stats[dr].num<=this._minCols&&this._stats[dr].cols.forEach(br=>{Mn[br]?Mn[br]++:Mn[br]=1})}injectIntoArray(Mn){for(let dr=0;dr<=this._numGroups;dr++)this._stats[dr].num<=this._minCols&&this._stats[dr].cols.forEach(br=>{Mn.indexOf(br)===-1&&Mn.push(br)})}},Cr=class{constructor(Mn,dr){Xt(this,"progress"),Xt(this,"_step"),Xt(this,"_range"),Xt(this,"_last"),Xt(this,"_progressRange"),this._range=Mn,this._progressRange=dr,this._step=Math.max(1,this._range/(Cr.steps+1)|0),this._last=-this._step,this.progress=0}shouldNotify(Mn){return Mn-this._last>=this._step&&(this._last=Mn,this.progress=Math.min(this._progressRange*this._last/this._range,this._progressRange),!0)}},Wn=Cr;Xt(Wn,"steps",100);var vr=class{constructor(Mn){Xt(this,"r"),Xt(this,"g"),Xt(this,"b"),Xt(this,"a"),this.r=this.g=this.b=this.a=Mn}toPoint(){return Mr.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(Mn,dr,br,Ir){this.r-=0|Mn,this.g-=0|dr,this.b-=0|br,this.a-=0|Ir}},Xn=class extends Tr{constructor(Mn,dr=256){super(),Xt(this,"_pointArray"),Xt(this,"_networkSize"),Xt(this,"_network"),Xt(this,"_sampleFactor"),Xt(this,"_radPower"),Xt(this,"_freq"),Xt(this,"_bias"),Xt(this,"_distance"),this._distance=Mn,this._pointArray=[],this._sampleFactor=1,this._networkSize=dr,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(Mn){this._pointArray=this._pointArray.concat(Mn.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let Mn=0;Mn>3)*Xn._radiusBias,qr=_i>>Xn._radiusBiasShift;qr<=1&&(qr=0);for(let eo=0;eo>>0;Nr=dr=dr&&(io-=dr),eo++,Yr===0&&(Yr=1),eo%Yr==0){zr-=zr/br|0,_i-=_i/Xn._radiusDecrease|0,qr=_i>>Xn._radiusBiasShift,qr<=1&&(qr=0);for(let rs=0;rs>>0}}}_buildPalette(){const Mn=new jn;return this._network.forEach(dr=>{Mn.add(dr.toPoint())}),Mn.sort(),Mn}_alterNeighbour(Mn,dr,br,Ir,Nr,Yr){let zr=dr-Mn;zr<-1&&(zr=-1);let _i=dr+Mn;_i>this._networkSize&&(_i=this._networkSize);let qr=dr+1,so=dr-1,eo=1;for(;qr<_i||so>zr;){const io=this._radPower[eo++]/Xn._alphaRadBias;if(qr<_i){const yo=this._network[qr++];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}if(so>zr){const yo=this._network[so--];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}}}_alterSingle(Mn,dr,br,Ir,Nr,Yr){Mn/=Xn._initAlpha;const zr=this._network[dr];zr.subtract(Mn*(zr.r-Nr),Mn*(zr.g-Ir),Mn*(zr.b-br),Mn*(zr.a-Yr))}_contest(Mn,dr,br,Ir){let Nr=2147483647,Yr=Nr,zr=-1,_i=zr;for(let qr=0;qr>Xn._initialBiasShift-3);io>Xn._betaShift;this._freq[qr]-=yo,this._bias[qr]+=yo<>Xn._betaShift),Xt(ur,"_betaGamma",Xn._initialBias<>3,this.g>>3,this.b>>3,this.a>>3)}subtract(Mn,dr,br,Ir){this.r-=Mn,this.g-=dr,this.b-=br,this.a-=Ir}},Or=class extends Tr{constructor(Mn,dr=256){super(),Xt(this,"_pointArray"),Xt(this,"_networkSize"),Xt(this,"_network"),Xt(this,"_sampleFactor"),Xt(this,"_radPower"),Xt(this,"_freq"),Xt(this,"_bias"),Xt(this,"_distance"),this._distance=Mn,this._pointArray=[],this._sampleFactor=1,this._networkSize=dr,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(Mn){this._pointArray=this._pointArray.concat(Mn.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let Mn=0;Mn>3)*Or._radiusBias,qr=_i>>Or._radiusBiasShift;qr<=1&&(qr=0);for(let eo=0;eo=dr&&(io-=dr),eo++,Yr===0&&(Yr=1),eo%Yr==0){zr-=zr/br,_i-=_i/Or._radiusDecrease,qr=_i>>Or._radiusBiasShift,qr<=1&&(qr=0);for(let rs=0;rs{Mn.add(dr.toPoint())}),Mn.sort(),Mn}_alterNeighbour(Mn,dr,br,Ir,Nr,Yr){let zr=dr-Mn;zr<-1&&(zr=-1);let _i=dr+Mn;_i>this._networkSize&&(_i=this._networkSize);let qr=dr+1,so=dr-1,eo=1;for(;qr<_i||so>zr;){const io=this._radPower[eo++]/Or._alphaRadBias;if(qr<_i){const yo=this._network[qr++];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}if(so>zr){const yo=this._network[so--];yo.subtract(io*(yo.r-Nr),io*(yo.g-Ir),io*(yo.b-br),io*(yo.a-Yr))}}}_alterSingle(Mn,dr,br,Ir,Nr,Yr){Mn/=Or._initAlpha;const zr=this._network[dr];zr.subtract(Mn*(zr.r-Nr),Mn*(zr.g-Ir),Mn*(zr.b-br),Mn*(zr.a-Yr))}_contest(Mn,dr,br,Ir){let Nr=2147483647,Yr=Nr,zr=-1,_i=zr;for(let qr=0;qr>Or._initialBiasShift-3);io>Or._betaShift;this._freq[qr]-=yo,this._bias[qr]+=yo<>Or._betaShift),Xt(to,"_betaGamma",Or._initialBias<this._histogram[Ir]-this._histogram[br]);if(Mn.length===0)return[];let dr;switch(this._method){case 1:const br=Math.min(Mn.length,this._initColors),Ir=Mn[br-1],Nr=this._histogram[Ir];dr=Mn.slice(0,br);let Yr=br;const zr=Mn.length;for(;Yr+br)}_colorStats1D(Mn){const dr=this._histogram,br=Mn.getPointArray(),Ir=br.length;for(let Nr=0;Nr{let eo=Math.round(so.w*so.h/zr)*Gr._boxPixels;eo<2&&(eo=2);const io={};this._iterateBox(so,dr,yo=>{const Bo=Ir[yo].uint32;this._hueStats.check(Bo),Bo in qr?qr[Bo]++:Bo in io?++io[Bo]>=eo&&(qr[Bo]=io[Bo]):io[Bo]=1})}),this._hueStats.injectIntoDictionary(qr)}_iterateBox(Mn,dr,br){const Ir=Mn,Nr=Ir.y*dr+Ir.x,Yr=(Ir.y+Ir.h-1)*dr+(Ir.x+Ir.w-1),zr=dr-Ir.w+1;let _i=0,qr=Nr;do br.call(this,qr),qr+=++_i%Ir.w==0?zr:1;while(qr<=Yr)}_makeBoxes(Mn,dr,br,Ir){const Nr=Mn%br,Yr=dr%Ir,zr=Mn-Nr,_i=dr-Yr,qr=[];for(let so=0;sothis._colors;){Yr.length=0;for(let eo=0;eo3*this._colors?this._initialDistance:this._distanceIncrement}if(zryo.distance-io.distance);let eo=0;for(;zr=0;eo--)Ir[eo]===0&&(eo!==so-1&&(br[eo]=br[so-1]),--so);br.length=so,dr.sort(),yield{palette:dr,progress:100}}};function lo(Mn){const dr=[];for(let br=0;br0){const br=this._sums[dr],Ir=this._reds[dr]/br,Nr=this._greens[dr]/br,Yr=this._blues[dr]/br,zr=this._alphas[dr]/br,_i=Mr.createByRGBA(0|Ir,0|Nr,0|Yr,0|zr);Mn.add(_i)}Mn.sort(),yield{palette:Mn,progress:100}}*_preparePalette(){yield*this._calculateMoments();let Mn=0;const dr=lo(this._colors);for(let zr=1;zr1?this._calculateVariance(this._cubes[Mn]):0,dr[zr]=this._cubes[zr].volume>1?this._calculateVariance(this._cubes[zr]):0):(dr[Mn]=0,zr--),Mn=0;let _i=dr[0];for(let qr=1;qr<=zr;++qr)dr[qr]>_i&&(_i=dr[qr],Mn=qr);if(_i<=0){this._colors=zr+1;break}}const br=[],Ir=[],Nr=[],Yr=[];for(let zr=0;zr0?(br[zr]=ho._volume(this._cubes[zr],this._momentsRed)/_i|0,Ir[zr]=ho._volume(this._cubes[zr],this._momentsGreen)/_i|0,Nr[zr]=ho._volume(this._cubes[zr],this._momentsBlue)/_i|0,Yr[zr]=ho._volume(this._cubes[zr],this._momentsAlpha)/_i|0):(br[zr]=0,Ir[zr]=0,Nr[zr]=0,Yr[zr]=0)}this._reds=lo(this._colors+1),this._greens=lo(this._colors+1),this._blues=lo(this._colors+1),this._alphas=lo(this._colors+1),this._sums=lo(this._colors+1);for(let zr=0,_i=this._pixels.length;zr<_i;zr++){const qr=this._pixels[zr];let so=-1,eo=Number.MAX_VALUE;for(let io=0;io>dr),Ir=1+(Mn.g>>dr),Nr=1+(Mn.b>>dr),Yr=1+(Mn.a>>dr);this._weights[Yr][br][Ir][Nr]++,this._momentsRed[Yr][br][Ir][Nr]+=Mn.r,this._momentsGreen[Yr][br][Ir][Nr]+=Mn.g,this._momentsBlue[Yr][br][Ir][Nr]+=Mn.b,this._momentsAlpha[Yr][br][Ir][Nr]+=Mn.a,this._moments[Yr][br][Ir][Nr]+=this._table[Mn.r]+this._table[Mn.g]+this._table[Mn.b]+this._table[Mn.a]}*_calculateMoments(){const Mn=[],dr=[],br=[],Ir=[],Nr=[],Yr=[],zr=ao(this._sideSize,this._sideSize,this._sideSize),_i=ao(this._sideSize,this._sideSize,this._sideSize),qr=ao(this._sideSize,this._sideSize,this._sideSize),so=ao(this._sideSize,this._sideSize,this._sideSize),eo=ao(this._sideSize,this._sideSize,this._sideSize),io=ao(this._sideSize,this._sideSize,this._sideSize);let yo=0;const Bo=new Wn(this._alphaMaxSideIndex*this._maxSideIndex,99);for(let Mo=1;Mo<=this._alphaMaxSideIndex;++Mo){Ro(zr,this._sideSize,this._sideSize,this._sideSize,0),Ro(_i,this._sideSize,this._sideSize,this._sideSize,0),Ro(qr,this._sideSize,this._sideSize,this._sideSize,0),Ro(so,this._sideSize,this._sideSize,this._sideSize,0),Ro(eo,this._sideSize,this._sideSize,this._sideSize,0),Ro(io,this._sideSize,this._sideSize,this._sideSize,0);for(let xo=1;xo<=this._maxSideIndex;++xo,++yo){Bo.shouldNotify(yo)&&(yield{progress:Bo.progress}),Xo(Mn,this._sideSize,0),Xo(dr,this._sideSize,0),Xo(br,this._sideSize,0),Xo(Ir,this._sideSize,0),Xo(Nr,this._sideSize,0),Xo(Yr,this._sideSize,0);for(let wo=1;wo<=this._maxSideIndex;++wo){let os=0,rs=0,xs=0,fs=0,Ds=0,ms=0;for(let Po=1;Po<=this._maxSideIndex;++Po)os+=this._weights[Mo][xo][wo][Po],rs+=this._momentsRed[Mo][xo][wo][Po],xs+=this._momentsGreen[Mo][xo][wo][Po],fs+=this._momentsBlue[Mo][xo][wo][Po],Ds+=this._momentsAlpha[Mo][xo][wo][Po],ms+=this._moments[Mo][xo][wo][Po],Mn[Po]+=os,dr[Po]+=rs,br[Po]+=xs,Ir[Po]+=fs,Nr[Po]+=Ds,Yr[Po]+=ms,zr[xo][wo][Po]=zr[xo-1][wo][Po]+Mn[Po],_i[xo][wo][Po]=_i[xo-1][wo][Po]+dr[Po],qr[xo][wo][Po]=qr[xo-1][wo][Po]+br[Po],so[xo][wo][Po]=so[xo-1][wo][Po]+Ir[Po],eo[xo][wo][Po]=eo[xo-1][wo][Po]+Nr[Po],io[xo][wo][Po]=io[xo-1][wo][Po]+Yr[Po],this._weights[Mo][xo][wo][Po]=this._weights[Mo-1][xo][wo][Po]+zr[xo][wo][Po],this._momentsRed[Mo][xo][wo][Po]=this._momentsRed[Mo-1][xo][wo][Po]+_i[xo][wo][Po],this._momentsGreen[Mo][xo][wo][Po]=this._momentsGreen[Mo-1][xo][wo][Po]+qr[xo][wo][Po],this._momentsBlue[Mo][xo][wo][Po]=this._momentsBlue[Mo-1][xo][wo][Po]+so[xo][wo][Po],this._momentsAlpha[Mo][xo][wo][Po]=this._momentsAlpha[Mo-1][xo][wo][Po]+eo[xo][wo][Po],this._moments[Mo][xo][wo][Po]=this._moments[Mo-1][xo][wo][Po]+io[xo][wo][Po]}}}}static _volumeFloat(Mn,dr){return dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]-dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]-dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]+dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]+dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]+dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]-dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]-dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]-dr[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+dr[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]-dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+dr[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]-dr[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum])}static _volume(Mn,dr){return 0|ho._volumeFloat(Mn,dr)}static _top(Mn,dr,br,Ir){let Nr;switch(dr){case ho._alpha:Nr=Ir[br][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]-Ir[br][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]-Ir[br][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]+Ir[br][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(Ir[br][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]-Ir[br][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]-Ir[br][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+Ir[br][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);break;case ho._red:Nr=Ir[Mn.alphaMaximum][br][Mn.greenMaximum][Mn.blueMaximum]-Ir[Mn.alphaMaximum][br][Mn.greenMinimum][Mn.blueMaximum]-Ir[Mn.alphaMinimum][br][Mn.greenMaximum][Mn.blueMaximum]+Ir[Mn.alphaMinimum][br][Mn.greenMinimum][Mn.blueMaximum]-(Ir[Mn.alphaMaximum][br][Mn.greenMaximum][Mn.blueMinimum]-Ir[Mn.alphaMaximum][br][Mn.greenMinimum][Mn.blueMinimum]-Ir[Mn.alphaMinimum][br][Mn.greenMaximum][Mn.blueMinimum]+Ir[Mn.alphaMinimum][br][Mn.greenMinimum][Mn.blueMinimum]);break;case ho._green:Nr=Ir[Mn.alphaMaximum][Mn.redMaximum][br][Mn.blueMaximum]-Ir[Mn.alphaMaximum][Mn.redMinimum][br][Mn.blueMaximum]-Ir[Mn.alphaMinimum][Mn.redMaximum][br][Mn.blueMaximum]+Ir[Mn.alphaMinimum][Mn.redMinimum][br][Mn.blueMaximum]-(Ir[Mn.alphaMaximum][Mn.redMaximum][br][Mn.blueMinimum]-Ir[Mn.alphaMaximum][Mn.redMinimum][br][Mn.blueMinimum]-Ir[Mn.alphaMinimum][Mn.redMaximum][br][Mn.blueMinimum]+Ir[Mn.alphaMinimum][Mn.redMinimum][br][Mn.blueMinimum]);break;case ho._blue:Nr=Ir[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][br]-Ir[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][br]-Ir[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][br]+Ir[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][br]-(Ir[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][br]-Ir[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][br]-Ir[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][br]+Ir[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][br]);break;default:throw new Error("impossible")}return 0|Nr}static _bottom(Mn,dr,br){switch(dr){case ho._alpha:return-br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(-br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);case ho._red:return-br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMaximum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(-br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);case ho._green:return-br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMaximum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMaximum]-(-br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);case ho._blue:return-br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMaximum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]-(-br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMaximum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMaximum][Mn.greenMinimum][Mn.blueMinimum]+br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMaximum][Mn.blueMinimum]-br[Mn.alphaMinimum][Mn.redMinimum][Mn.greenMinimum][Mn.blueMinimum]);default:return 0}}_calculateVariance(Mn){const dr=ho._volume(Mn,this._momentsRed),br=ho._volume(Mn,this._momentsGreen),Ir=ho._volume(Mn,this._momentsBlue),Nr=ho._volume(Mn,this._momentsAlpha);return ho._volumeFloat(Mn,this._moments)-(dr*dr+br*br+Ir*Ir+Nr*Nr)/ho._volume(Mn,this._weights)}_maximize(Mn,dr,br,Ir,Nr,Yr,zr,_i,qr){const so=0|ho._bottom(Mn,dr,this._momentsRed),eo=0|ho._bottom(Mn,dr,this._momentsGreen),io=0|ho._bottom(Mn,dr,this._momentsBlue),yo=0|ho._bottom(Mn,dr,this._momentsAlpha),Bo=0|ho._bottom(Mn,dr,this._weights);let Mo=0,xo=-1;for(let wo=br;woMo&&(Mo=Po,xo=wo))}}return{max:Mo,position:xo}}_cut(Mn,dr){let br;const Ir=ho._volume(Mn,this._momentsRed),Nr=ho._volume(Mn,this._momentsGreen),Yr=ho._volume(Mn,this._momentsBlue),zr=ho._volume(Mn,this._momentsAlpha),_i=ho._volume(Mn,this._weights),qr=this._maximize(Mn,ho._red,Mn.redMinimum+1,Mn.redMaximum,Ir,Nr,Yr,zr,_i),so=this._maximize(Mn,ho._green,Mn.greenMinimum+1,Mn.greenMaximum,Ir,Nr,Yr,zr,_i),eo=this._maximize(Mn,ho._blue,Mn.blueMinimum+1,Mn.blueMaximum,Ir,Nr,Yr,zr,_i),io=this._maximize(Mn,ho._alpha,Mn.alphaMinimum+1,Mn.alphaMaximum,Ir,Nr,Yr,zr,_i);if(io.max>=qr.max&&io.max>=so.max&&io.max>=eo.max){if(br=ho._alpha,io.position<0)return!1}else br=qr.max>=io.max&&qr.max>=so.max&&qr.max>=eo.max?ho._red:so.max>=io.max&&so.max>=qr.max&&so.max>=eo.max?ho._green:ho._blue;switch(dr.redMaximum=Mn.redMaximum,dr.greenMaximum=Mn.greenMaximum,dr.blueMaximum=Mn.blueMaximum,dr.alphaMaximum=Mn.alphaMaximum,br){case ho._red:dr.redMinimum=Mn.redMaximum=qr.position,dr.greenMinimum=Mn.greenMinimum,dr.blueMinimum=Mn.blueMinimum,dr.alphaMinimum=Mn.alphaMinimum;break;case ho._green:dr.greenMinimum=Mn.greenMaximum=so.position,dr.redMinimum=Mn.redMinimum,dr.blueMinimum=Mn.blueMinimum,dr.alphaMinimum=Mn.alphaMinimum;break;case ho._blue:dr.blueMinimum=Mn.blueMaximum=eo.position,dr.redMinimum=Mn.redMinimum,dr.greenMinimum=Mn.greenMinimum,dr.alphaMinimum=Mn.alphaMinimum;break;case ho._alpha:dr.alphaMinimum=Mn.alphaMaximum=io.position,dr.blueMinimum=Mn.blueMinimum,dr.redMinimum=Mn.redMinimum,dr.greenMinimum=Mn.greenMinimum}return Mn.volume=(Mn.redMaximum-Mn.redMinimum)*(Mn.greenMaximum-Mn.greenMinimum)*(Mn.blueMaximum-Mn.blueMinimum)*(Mn.alphaMaximum-Mn.alphaMinimum),dr.volume=(dr.redMaximum-dr.redMinimum)*(dr.greenMaximum-dr.greenMinimum)*(dr.blueMaximum-dr.blueMinimum)*(dr.alphaMaximum-dr.alphaMinimum),!0}_initialize(Mn){this._colors=Mn,this._cubes=[];for(let dr=0;drJo,ErrorDiffusionArray:()=>Qo,ErrorDiffusionArrayKernel:()=>Ko,ErrorDiffusionRiemersma:()=>ss,NearestColor:()=>as});var Jo=class{quantizeSync(Mn,dr){for(const br of this.quantize(Mn,dr))if(br.pointContainer)return br.pointContainer;throw new Error("unreachable")}},as=class extends Jo{constructor(Mn){super(),Xt(this,"_distance"),this._distance=Mn}*quantize(Mn,dr){const br=Mn.getPointArray(),Ir=Mn.getWidth(),Nr=Mn.getHeight(),Yr=new Wn(Nr,99);for(let zr=0;zr(Mn[Mn.FloydSteinberg=0]="FloydSteinberg",Mn[Mn.FalseFloydSteinberg=1]="FalseFloydSteinberg",Mn[Mn.Stucki=2]="Stucki",Mn[Mn.Atkinson=3]="Atkinson",Mn[Mn.Jarvis=4]="Jarvis",Mn[Mn.Burkes=5]="Burkes",Mn[Mn.Sierra=6]="Sierra",Mn[Mn.TwoSierra=7]="TwoSierra",Mn[Mn.SierraLite=8]="SierraLite",Mn))(Ko||{}),Qo=class extends Jo{constructor(Mn,dr,br=!0,Ir=0,Nr=!1){super(),Xt(this,"_minColorDistance"),Xt(this,"_serpentine"),Xt(this,"_kernel"),Xt(this,"_calculateErrorLikeGIMP"),Xt(this,"_distance"),this._setKernel(dr),this._distance=Mn,this._minColorDistance=Ir,this._serpentine=br,this._calculateErrorLikeGIMP=Nr}*quantize(Mn,dr){const br=Mn.getPointArray(),Ir=new Mr,Nr=Mn.getWidth(),Yr=Mn.getHeight(),zr=[];let _i=1,qr=1;for(const eo of this._kernel){const io=eo[2]+1;qr=0&&vu+xo=0&&Gs+eodr&&(Mn.length=dr);const br=Mn.length;for(let Ir=0;Ir=0&&Mn.x=0&&Mn.y{const so=br[_i+qr*Ir];let{r:eo,g:io,b:yo,a:Bo}=so;for(let os=0;osSs});var vs=.01,ks=.03;function Ss(Mn,dr){if(Mn.getHeight()!==dr.getHeight()||Mn.getWidth()!==dr.getWidth())throw new Error("Images have different sizes!");const br=(255*vs)**2,Ir=(255*ks)**2;let Nr=0,Yr=0;return function(zr,_i,qr){const so=zr.getWidth(),eo=zr.getHeight();for(let io=0;io{let eo=0,io=0,yo=0;for(let Mo=0;MoNt.nextTick(Mn):Mn=>setTimeout(Mn,0);function bs(Mn,{colorDistanceFormula:dr,paletteQuantization:br,colors:Ir}={}){const Nr=Eu(na(dr),br,Ir);return Mn.forEach(Yr=>Nr.sample(Yr)),Nr.quantizeSync()}async function _u(Mn,{colorDistanceFormula:dr,paletteQuantization:br,colors:Ir,onProgress:Nr}={}){return new Promise((Yr,zr)=>{const _i=Eu(na(dr),br,Ir);let qr;Mn.forEach(io=>_i.sample(io));const so=_i.quantize(),eo=()=>{try{const io=so.next();io.done?Yr(qr):(io.value.palette&&(qr=io.value.palette),Nr&&Nr(io.value.progress),Fo(eo))}catch(io){zr(io)}};Fo(eo)})}function Ml(Mn,dr,{colorDistanceFormula:br,imageQuantization:Ir}={}){return yu(na(br),Ir).quantizeSync(Mn,dr)}async function wu(Mn,dr,{colorDistanceFormula:br,imageQuantization:Ir,onProgress:Nr}={}){return new Promise((Yr,zr)=>{let _i;const qr=yu(na(br),Ir).quantize(Mn,dr),so=()=>{try{const eo=qr.next();eo.done?Yr(_i):(eo.value.pointContainer&&(_i=eo.value.pointContainer),Nr&&Nr(eo.value.progress),Fo(so))}catch(eo){zr(eo)}};Fo(so)})}function na(Mn="euclidean-bt709"){switch(Mn){case"cie94-graphic-arts":return new vn;case"cie94-textiles":return new yn;case"ciede2000":return new Un;case"color-metric":return new Kn;case"euclidean":return new tr;case"euclidean-bt709":return new or;case"euclidean-bt709-noalpha":return new Jn;case"manhattan":return new Er;case"manhattan-bt709":return new Rr;case"manhattan-nommyde":return new Sr;case"pngquant":return new sr;default:throw new Error(`Unknown colorDistanceFormula ${Mn}`)}}function yu(Mn,dr="floyd-steinberg"){switch(dr){case"nearest":return new as(Mn);case"riemersma":return new ss(Mn);case"floyd-steinberg":return new Qo(Mn,0);case"false-floyd-steinberg":return new Qo(Mn,1);case"stucki":return new Qo(Mn,2);case"atkinson":return new Qo(Mn,3);case"jarvis":return new Qo(Mn,4);case"burkes":return new Qo(Mn,5);case"sierra":return new Qo(Mn,6);case"two-sierra":return new Qo(Mn,7);case"sierra-lite":return new Qo(Mn,8);default:throw new Error(`Unknown imageQuantization ${dr}`)}}function Eu(Mn,dr="wuquant",br=256){switch(dr){case"neuquant":return new ur(Mn,br);case"rgbquant":return new Lr(Mn,br);case"wuquant":return new qo(Mn,br);case"neuquant-float":return new to(Mn,br);default:throw new Error(`Unknown paletteQuantization ${dr}`)}}_e.exports=Yt(Zt)}},__webpack_module_cache__={};function __webpack_require__(_e){var Pt=__webpack_module_cache__[_e];if(Pt!==void 0)return Pt.exports;var Dt=__webpack_module_cache__[_e]={exports:{}};return __webpack_modules__[_e](Dt,Dt.exports,__webpack_require__),Dt.exports}__webpack_require__.n=_e=>{var Pt=_e&&_e.__esModule?()=>_e.default:()=>_e;return __webpack_require__.d(Pt,{a:Pt}),Pt},__webpack_require__.d=(_e,Pt)=>{for(var Dt in Pt)__webpack_require__.o(Pt,Dt)&&!__webpack_require__.o(_e,Dt)&&Object.defineProperty(_e,Dt,{enumerable:!0,get:Pt[Dt]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(_e,Pt)=>Object.prototype.hasOwnProperty.call(_e,Pt),__webpack_require__.r=_e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(_e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_e,"__esModule",{value:!0})},(()=>{var _e={};__webpack_require__.r(_e),__webpack_require__.d(_e,{AUTO:()=>gr,BLEND_ADD:()=>jn,BLEND_DARKEN:()=>kr,BLEND_DESTINATION_OVER:()=>qn,BLEND_DIFFERENCE:()=>vr,BLEND_EXCLUSION:()=>Xn,BLEND_HARDLIGHT:()=>Wn,BLEND_LIGHTEN:()=>Cr,BLEND_MULTIPLY:()=>Ln,BLEND_OVERLAY:()=>mr,BLEND_SCREEN:()=>ir,BLEND_SOURCE_OVER:()=>Mr,EDGE_CROP:()=>Or,EDGE_EXTEND:()=>ur,EDGE_WRAP:()=>Wr,HORIZONTAL_ALIGN_CENTER:()=>Sr,HORIZONTAL_ALIGN_LEFT:()=>Er,HORIZONTAL_ALIGN_RIGHT:()=>Rr,VERTICAL_ALIGN_BOTTOM:()=>Tr,VERTICAL_ALIGN_MIDDLE:()=>hr,VERTICAL_ALIGN_TOP:()=>sr});var Pt={};__webpack_require__.r(Pt),__webpack_require__.d(Pt,{add:()=>Hr,darken:()=>uo,difference:()=>Xo,dstOver:()=>Gr,exclusion:()=>Ao,hardLight:()=>Ro,lighten:()=>ao,multiply:()=>no,overlay:()=>lo,screen:()=>Lr,srcOver:()=>to});var Dt=__webpack_require__(5546),Nt=__webpack_require__.n(Dt),jt=__webpack_require__(1023),Ut=__webpack_require__.n(jt),Gt=__webpack_require__(2699),Wt=__webpack_require__.n(Gt);function qt(Fn){if(Fn===void 0)return!1;if(typeof Fn!="function")throw new TypeError("Callback must be a function");return!0}function Yt(Fn,zn){if(typeof Fn=="string"&&(Fn=new Error(Fn)),typeof zn=="function")return zn.call(this,Fn);throw Fn}function Xt(Fn,zn,er,rr,lr,fr){zn=Math.round(zn),er=Math.round(er),rr=Math.round(rr),lr=Math.round(lr);for(let wr=er;wr1&&(ba-=1),ba<1/6?Vo+6*(es-Vo)*ba:ba<.5?es:ba<2/3?Vo+(es-Vo)*(2/3-ba)*6:Vo}if(Xr=Bn(Xr,360),Kr=Bn(Kr,100),Qr=Bn(Qr,100),Kr===0)fo=_o=jo=Qr;else{var Oo=Qr<.5?Qr*(1+Kr):Qr+Kr-Qr*Kr,Zo=2*Qr-Oo;fo=Yo(Zo,Oo,Xr+1/3),_o=Yo(Zo,Oo,Xr),jo=Yo(Zo,Oo,Xr-1/3)}return{r:255*fo,g:255*_o,b:255*jo}}(rr.h,Fr,Vr),co=!0,Jr="hsl"),rr.hasOwnProperty("a")&&($r=rr.a)),$r=In($r),{ok:co,format:rr.format||Jr,r:Math.min(255,Math.max(_r.r,0)),g:Math.min(255,Math.max(_r.g,0)),b:Math.min(255,Math.max(_r.b,0)),a:$r}}(Fn);this._originalInput=Fn,this._r=er.r,this._g=er.g,this._b=er.b,this._a=er.a,this._roundA=Math.round(100*this._a)/100,this._format=zn.format||er.format,this._gradientType=zn.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=er.ok}function ln(Fn,zn,er){Fn=Bn(Fn,255),zn=Bn(zn,255),er=Bn(er,255);var rr,lr,fr=Math.max(Fn,zn,er),wr=Math.min(Fn,zn,er),_r=(fr+wr)/2;if(fr==wr)rr=lr=0;else{var $r=fr-wr;switch(lr=_r>.5?$r/(2-fr-wr):$r/(fr+wr),fr){case Fn:rr=(zn-er)/$r+(zn>1)+720)%360;--zn;)rr.h=(rr.h+lr)%360,fr.push(sn(rr));return fr}function Pn(Fn,zn){zn=zn||6;for(var er=sn(Fn).toHsv(),rr=er.h,lr=er.s,fr=er.v,wr=[],_r=1/zn;zn--;)wr.push(sn({h:rr,s:lr,v:fr})),fr=(fr+_r)%1;return wr}sn.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var Fn=this.toRgb();return(299*Fn.r+587*Fn.g+114*Fn.b)/1e3},getLuminance:function(){var Fn,zn,er,rr=this.toRgb();return Fn=rr.r/255,zn=rr.g/255,er=rr.b/255,.2126*(Fn<=.03928?Fn/12.92:Math.pow((Fn+.055)/1.055,2.4))+.7152*(zn<=.03928?zn/12.92:Math.pow((zn+.055)/1.055,2.4))+.0722*(er<=.03928?er/12.92:Math.pow((er+.055)/1.055,2.4))},setAlpha:function(Fn){return this._a=In(Fn),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var Fn=dn(this._r,this._g,this._b);return{h:360*Fn.h,s:Fn.s,v:Fn.v,a:this._a}},toHsvString:function(){var Fn=dn(this._r,this._g,this._b),zn=Math.round(360*Fn.h),er=Math.round(100*Fn.s),rr=Math.round(100*Fn.v);return this._a==1?"hsv("+zn+", "+er+"%, "+rr+"%)":"hsva("+zn+", "+er+"%, "+rr+"%, "+this._roundA+")"},toHsl:function(){var Fn=ln(this._r,this._g,this._b);return{h:360*Fn.h,s:Fn.s,l:Fn.l,a:this._a}},toHslString:function(){var Fn=ln(this._r,this._g,this._b),zn=Math.round(360*Fn.h),er=Math.round(100*Fn.s),rr=Math.round(100*Fn.l);return this._a==1?"hsl("+zn+", "+er+"%, "+rr+"%)":"hsla("+zn+", "+er+"%, "+rr+"%, "+this._roundA+")"},toHex:function(Fn){return mn(this._r,this._g,this._b,Fn)},toHexString:function(Fn){return"#"+this.toHex(Fn)},toHex8:function(Fn){return function(zn,er,rr,lr,fr){var wr=[ar(Math.round(zn).toString(16)),ar(Math.round(er).toString(16)),ar(Math.round(rr).toString(16)),ar(Rn(lr))];return fr&&wr[0].charAt(0)==wr[0].charAt(1)&&wr[1].charAt(0)==wr[1].charAt(1)&&wr[2].charAt(0)==wr[2].charAt(1)&&wr[3].charAt(0)==wr[3].charAt(1)?wr[0].charAt(0)+wr[1].charAt(0)+wr[2].charAt(0)+wr[3].charAt(0):wr.join("")}(this._r,this._g,this._b,this._a,Fn)},toHex8String:function(Fn){return"#"+this.toHex8(Fn)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*Bn(this._r,255))+"%",g:Math.round(100*Bn(this._g,255))+"%",b:Math.round(100*Bn(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(100*Bn(this._r,255))+"%, "+Math.round(100*Bn(this._g,255))+"%, "+Math.round(100*Bn(this._b,255))+"%)":"rgba("+Math.round(100*Bn(this._r,255))+"%, "+Math.round(100*Bn(this._g,255))+"%, "+Math.round(100*Bn(this._b,255))+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":!(this._a<1)&&(Gn[mn(this._r,this._g,this._b,!0)]||!1)},toFilter:function(Fn){var zn="#"+gn(this._r,this._g,this._b,this._a),er=zn,rr=this._gradientType?"GradientType = 1, ":"";if(Fn){var lr=sn(Fn);er="#"+gn(lr._r,lr._g,lr._b,lr._a)}return"progid:DXImageTransform.Microsoft.gradient("+rr+"startColorstr="+zn+",endColorstr="+er+")"},toString:function(Fn){var zn=!!Fn;Fn=Fn||this._format;var er=!1,rr=this._a<1&&this._a>=0;return zn||!rr||Fn!=="hex"&&Fn!=="hex6"&&Fn!=="hex3"&&Fn!=="hex4"&&Fn!=="hex8"&&Fn!=="name"?(Fn==="rgb"&&(er=this.toRgbString()),Fn==="prgb"&&(er=this.toPercentageRgbString()),Fn!=="hex"&&Fn!=="hex6"||(er=this.toHexString()),Fn==="hex3"&&(er=this.toHexString(!0)),Fn==="hex4"&&(er=this.toHex8String(!0)),Fn==="hex8"&&(er=this.toHex8String()),Fn==="name"&&(er=this.toName()),Fn==="hsl"&&(er=this.toHslString()),Fn==="hsv"&&(er=this.toHsvString()),er||this.toHexString()):Fn==="name"&&this._a===0?this.toName():this.toRgbString()},clone:function(){return sn(this.toString())},_applyModification:function(Fn,zn){var er=Fn.apply(null,[this].concat([].slice.call(zn)));return this._r=er._r,this._g=er._g,this._b=er._b,this.setAlpha(er._a),this},lighten:function(){return this._applyModification(En,arguments)},brighten:function(){return this._applyModification(_n,arguments)},darken:function(){return this._applyModification(Tn,arguments)},desaturate:function(){return this._applyModification(un,arguments)},saturate:function(){return this._applyModification(hn,arguments)},greyscale:function(){return this._applyModification(bn,arguments)},spin:function(){return this._applyModification($n,arguments)},_applyCombination:function(Fn,zn){return Fn.apply(null,[this].concat([].slice.call(zn)))},analogous:function(){return this._applyCombination(Dn,arguments)},complement:function(){return this._applyCombination(pn,arguments)},monochromatic:function(){return this._applyCombination(Pn,arguments)},splitcomplement:function(){return this._applyCombination(An,arguments)},triad:function(){return this._applyCombination(Nn,[3])},tetrad:function(){return this._applyCombination(Nn,[4])}},sn.fromRatio=function(Fn,zn){if(nn(Fn)=="object"){var er={};for(var rr in Fn)Fn.hasOwnProperty(rr)&&(er[rr]=rr==="a"?Fn[rr]:Sn(Fn[rr]));Fn=er}return sn(Fn,zn)},sn.equals=function(Fn,zn){return!(!Fn||!zn)&&sn(Fn).toRgbString()==sn(zn).toRgbString()},sn.random=function(){return sn.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},sn.mix=function(Fn,zn,er){er=er===0?0:er||50;var rr=sn(Fn).toRgb(),lr=sn(zn).toRgb(),fr=er/100;return sn({r:(lr.r-rr.r)*fr+rr.r,g:(lr.g-rr.g)*fr+rr.g,b:(lr.b-rr.b)*fr+rr.b,a:(lr.a-rr.a)*fr+rr.a})},sn.readability=function(Fn,zn){var er=sn(Fn),rr=sn(zn);return(Math.max(er.getLuminance(),rr.getLuminance())+.05)/(Math.min(er.getLuminance(),rr.getLuminance())+.05)},sn.isReadable=function(Fn,zn,er){var rr,lr,fr,wr,_r,$r=sn.readability(Fn,zn);switch(lr=!1,(fr=er,(wr=((fr=fr||{level:"AA",size:"small"}).level||"AA").toUpperCase())!=="AA"&&wr!=="AAA"&&(wr="AA"),(_r=(fr.size||"small").toLowerCase())!=="small"&&_r!=="large"&&(_r="small"),rr={level:wr,size:_r}).level+rr.size){case"AAsmall":case"AAAlarge":lr=$r>=4.5;break;case"AAlarge":lr=$r>=3;break;case"AAAsmall":lr=$r>=7}return lr},sn.mostReadable=function(Fn,zn,er){var rr,lr,fr,wr,_r=null,$r=0;lr=(er=er||{}).includeFallbackColors,fr=er.level,wr=er.size;for(var Fr=0;Fr$r&&($r=rr,_r=sn(zn[Fr]));return sn.isReadable(Fn,_r,{level:fr,size:wr})||!lr?_r:(er.includeFallbackColors=!1,sn.mostReadable(Fn,["#fff","#000"],er))};var Cn=sn.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Gn=sn.hexNames=function(Fn){var zn={};for(var er in Fn)Fn.hasOwnProperty(er)&&(zn[Fn[er]]=er);return zn}(Cn);function In(Fn){return Fn=parseFloat(Fn),(isNaN(Fn)||Fn<0||Fn>1)&&(Fn=1),Fn}function Bn(Fn,zn){(function(rr){return typeof rr=="string"&&rr.indexOf(".")!=-1&&parseFloat(rr)===1})(Fn)&&(Fn="100%");var er=function(rr){return typeof rr=="string"&&rr.indexOf("%")!=-1}(Fn);return Fn=Math.min(zn,Math.max(0,parseFloat(Fn))),er&&(Fn=parseInt(Fn*zn,10)/100),Math.abs(Fn-zn)<1e-6?1:Fn%zn/parseFloat(zn)}function Zn(Fn){return Math.min(1,Math.max(0,Fn))}function nr(Fn){return parseInt(Fn,16)}function ar(Fn){return Fn.length==1?"0"+Fn:""+Fn}function Sn(Fn){return Fn<=1&&(Fn=100*Fn+"%"),Fn}function Rn(Fn){return Math.round(255*parseFloat(Fn)).toString(16)}function On(Fn){return nr(Fn)/255}var Vn,yn,vn,wn=(yn="[\\s|\\(]+("+(Vn="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Vn+")[,|\\s]+("+Vn+")\\s*\\)?",vn="[\\s|\\(]+("+Vn+")[,|\\s]+("+Vn+")[,|\\s]+("+Vn+")[,|\\s]+("+Vn+")\\s*\\)?",{CSS_UNIT:new RegExp(Vn),rgb:new RegExp("rgb"+yn),rgba:new RegExp("rgba"+vn),hsl:new RegExp("hsl"+yn),hsla:new RegExp("hsla"+vn),hsv:new RegExp("hsv"+yn),hsva:new RegExp("hsva"+vn),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function Un(Fn){return!!wn.CSS_UNIT.exec(Fn)}function Kn(Fn,zn){this.size=this.size||Fn,this.smallerSize=this.smallerSize||zn,function(er){for(let rr=1;rrlr?"1":"0";return fr};const tr=[],or=Kn;__webpack_require__(9307);const Jn=(Fn,zn)=>{let{url:er,...rr}=Fn;fetch(er,rr).then(lr=>{if(lr.ok)return lr.arrayBuffer().catch(fr=>{throw new Error(`Response is not a buffer for url ${er}. Error: ${fr.message}`)});throw new Error(`HTTP Status ${lr.status} for url ${er}`)}).then(lr=>zn(null,lr)).catch(lr=>zn(lr))},gr=-1,Er=1,Sr=2,Rr=4,sr=8,hr=16,Tr=32,Mr="srcOver",qn="dstOver",Ln="multiply",jn="add",ir="screen",mr="overlay",kr="darken",Cr="lighten",Wn="hardLight",vr="difference",Xn="exclusion",ur=1,Wr=2,Or=3;function to(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a;return{r:(Fn.r*Fn.a+zn.r*zn.a*(1-Fn.a))/rr,g:(Fn.g*Fn.a+zn.g*zn.a*(1-Fn.a))/rr,b:(Fn.b*Fn.a+zn.b*zn.a*(1-Fn.a))/rr,a:rr}}function Gr(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a;return{r:(zn.r*zn.a+Fn.r*Fn.a*(1-zn.a))/rr,g:(zn.g*zn.a+Fn.g*Fn.a*(1-zn.a))/rr,b:(zn.b*zn.a+Fn.b*Fn.a*(1-zn.a))/rr,a:rr}}function no(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr*_r+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(fr*$r+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function Hr(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a;return{r:(lr+zn.r*zn.a)/rr,g:(fr+zn.g*zn.a)/rr,b:(wr+zn.b*zn.a)/rr,a:rr}}function Lr(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr*zn.a+_r*Fn.a-lr*_r+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(fr*zn.a+$r*Fn.a-fr*$r+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(wr*zn.a+Fr*Fn.a-wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function lo(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(2*_r<=zn.a?2*lr*_r+lr*(1-zn.a)+_r*(1-Fn.a):lr*(1+zn.a)+_r*(1+Fn.a)-2*_r*lr-zn.a*Fn.a)/rr,g:(2*$r<=zn.a?2*fr*$r+fr*(1-zn.a)+$r*(1-Fn.a):fr*(1+zn.a)+$r*(1+Fn.a)-2*$r*fr-zn.a*Fn.a)/rr,b:(2*Fr<=zn.a?2*wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a):wr*(1+zn.a)+Fr*(1+Fn.a)-2*Fr*wr-zn.a*Fn.a)/rr,a:rr}}function uo(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(Math.min(lr*zn.a,_r*Fn.a)+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(Math.min(fr*zn.a,$r*Fn.a)+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(Math.min(wr*zn.a,Fr*Fn.a)+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function ao(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(Math.max(lr*zn.a,_r*Fn.a)+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(Math.max(fr*zn.a,$r*Fn.a)+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(Math.max(wr*zn.a,Fr*Fn.a)+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}function Ro(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(2*lr<=Fn.a?2*lr*_r+lr*(1-zn.a)+_r*(1-Fn.a):lr*(1+zn.a)+_r*(1+Fn.a)-2*_r*lr-zn.a*Fn.a)/rr,g:(2*fr<=Fn.a?2*fr*$r+fr*(1-zn.a)+$r*(1-Fn.a):fr*(1+zn.a)+$r*(1+Fn.a)-2*$r*fr-zn.a*Fn.a)/rr,b:(2*wr<=Fn.a?2*wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a):wr*(1+zn.a)+Fr*(1+Fn.a)-2*Fr*wr-zn.a*Fn.a)/rr,a:rr}}function Xo(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr+_r-2*Math.min(lr*zn.a,_r*Fn.a))/rr,g:(fr+$r-2*Math.min(fr*zn.a,$r*Fn.a))/rr,b:(wr+Fr-2*Math.min(wr*zn.a,Fr*Fn.a))/rr,a:rr}}function Ao(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;Fn.a*=er;const rr=zn.a+Fn.a-zn.a*Fn.a,lr=Fn.r*Fn.a,fr=Fn.g*Fn.a,wr=Fn.b*Fn.a,_r=zn.r*zn.a,$r=zn.g*zn.a,Fr=zn.b*zn.a;return{r:(lr*zn.a+_r*Fn.a-2*lr*_r+lr*(1-zn.a)+_r*(1-Fn.a))/rr,g:(fr*zn.a+$r*Fn.a-2*fr*$r+fr*(1-zn.a)+$r*(1-Fn.a))/rr,b:(wr*zn.a+Fr*Fn.a-2*wr*Fr+wr*(1-zn.a)+Fr*(1-Fn.a))/rr,a:rr}}const ho=function(Fn,zn){for(var er=arguments.length,rr=new Array(er>2?er-2:0),lr=2;lr{rr.push((_r,$r)=>{_r&&wr(_r),fr($r)}),Fn.bind(zn)(...rr)})},qo={},xa=(Fn,zn)=>{qo[Fn]=zn},Jo=Fn=>{const zn=Fn.split("/").slice(-1);var er;return(er=zn[zn.length-1].split(".").pop(),Object.entries(qo).find(rr=>rr[1].includes(er))||[])[0]};var as=__webpack_require__(5025),Ko=__webpack_require__.n(as),Qo=__webpack_require__(6551),hs=__webpack_require__.n(Qo),Go=__webpack_require__(8834).lW;function Wo(Fn){return Fn._exif&&Fn._exif.tags&&Fn._exif.tags.Orientation||1}async function ss(Fn,zn,er){const rr=await async function(lr,fr){const wr=await Ko().fromBuffer(lr);return wr?wr.mime:fr?Jo(fr):null}(Fn,zn);if(typeof rr!="string")return er(new Error("Could not find MIME for Buffer <"+zn+">"));this._originalMime=rr.toLowerCase();try{const lr=this.getMIME();if(!this.constructor.decoders[lr])return Yt.call(this,"Unsupported MIME type: "+lr,er);this.bitmap=this.constructor.decoders[lr](Fn)}catch(lr){return er.call(this,lr,this)}try{this._exif=hs().create(Fn).parse(),function(lr){if(Wo(lr)<2)return;const fr=function(_r){const $r=_r.getWidth(),Fr=_r.getHeight();switch(Wo(_r)){case 1:default:return null;case 2:return function(jr,Vr){return[$r-jr-1,Vr]};case 3:return function(jr,Vr){return[$r-jr-1,Fr-Vr-1]};case 4:return function(jr,Vr){return[jr,Fr-Vr-1]};case 5:return function(jr,Vr){return[Vr,jr]};case 6:return function(jr,Vr){return[Vr,Fr-jr-1]};case 7:return function(jr,Vr){return[$r-Vr-1,Fr-jr-1]};case 8:return function(jr,Vr){return[$r-Vr-1,jr]}}}(lr),wr=Wo(lr)>4;(function(_r,$r,Fr,jr){const Vr=_r.bitmap.data,co=_r.bitmap.width,Jr=Go.alloc(Vr.length);for(let Xr=0;Xr<$r;Xr++)for(let Kr=0;Kr{zn.call(this,null,rr)}):zn.call(this,null,er)}return this}function vs(Fn){return ho($a,this,Fn)}var ks=__webpack_require__(8834).lW;function Ss(Fn,zn,er){return(zn=function(rr){var lr=function(fr,wr){if(typeof fr!="object"||fr===null)return fr;var _r=fr[Symbol.toPrimitive];if(_r!==void 0){var $r=_r.call(fr,"string");if(typeof $r!="object")return $r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(fr)}(rr);return typeof lr=="symbol"?lr:String(lr)}(zn))in Fn?Object.defineProperty(Fn,zn,{value:er,enumerable:!0,configurable:!0,writable:!0}):Fn[zn]=er,Fn}const Is="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",Vl=[NaN,NaN];for(let Fn=2;Fn<65;Fn++){const zn=Qt()(Qt().BIN,Is.slice(0,Fn))(new Array(65).join("1"));Vl.push(zn.length)}function Fo(){}function bs(Fn){return Object.prototype.toString.call(Fn).toLowerCase().indexOf("arraybuffer")>-1}function _u(Fn){const zn=ks.alloc(Fn.byteLength),er=new Uint8Array(Fn);for(let rr=0;rrer?zn(er):typeof rr=="object"&&ks.isBuffer(rr)?zn(null,rr):typeof rr=="object"&&bs(rr)?zn(null,_u(rr)):new Error(`Could not load Buffer from <${Fn.url}>`))}const wu={data:null,width:null,height:null};class na extends Wt(){constructor(){for(var zn=arguments.length,er=new Array(zn),rr=0;rrho(this.write,this,$r)),Ss(this,"getBase64Async",$r=>ho(this.getBase64,this,$r)),Ss(this,"getBuffer",$a),Ss(this,"getBufferAsync",vs),Ss(this,"getPixelColour",this.getPixelColor),Ss(this,"setPixelColour",this.setPixelColor);const lr=this;let fr=Fo;function wr(){for(var $r=arguments.length,Fr=new Array($r),jr=0;jr<$r;jr++)Fr[jr]=arguments[jr];const[Vr]=Fr;(Vr||{}).methodName="constructor",setTimeout(()=>{Vr&&fr===Fo?lr.emitError("constructor",Vr):Vr||lr.emitMulti("constructor","initialized"),fr.call(lr,...Fr)},1)}if(bs(er[0])&&(er[0]=_u(er[0])),typeof er[0]=="number"&&typeof er[1]=="number"||parseInt(er[0],10)&&parseInt(er[1],10)){const $r=parseInt(er[0],10),Fr=parseInt(er[1],10);if(fr=er[2],typeof er[2]=="number"&&(this._background=er[2],fr=er[3]),typeof er[2]=="string"&&(this._background=na.cssColorToHex(er[2]),fr=er[3]),fr===void 0&&(fr=Fo),typeof fr!="function")return Yt.call(this,"cb must be a function",wr);this.bitmap={data:ks.alloc($r*Fr*4),width:$r,height:Fr};for(let jr=0;jr{if($r)return Yt.call(this,$r,wr);this.parseBitmap(Fr,er[0].url,wr)})}else if(er[0]instanceof na){const[$r]=er;if(fr=er[1],fr===void 0&&(fr=Fo),typeof fr!="function")return Yt.call(this,"cb must be a function",wr);this.bitmap={data:ks.from($r.bitmap.data),width:$r.bitmap.width,height:$r.bitmap.height},this._quality=$r._quality,this._deflateLevel=$r._deflateLevel,this._deflateStrategy=$r._deflateStrategy,this._filterType=$r._filterType,this._rgba=$r._rgba,this._background=$r._background,this._originalMime=$r._originalMime,wr(null,this)}else if((_r=er[0])&&typeof _r=="object"&&typeof _r.width=="number"&&typeof _r.height=="number"&&(ks.isBuffer(_r.data)||_r.data instanceof Uint8Array||typeof Uint8ClampedArray=="function"&&_r.data instanceof Uint8ClampedArray)&&(_r.data.length===_r.width*_r.height*4||_r.data.length===_r.width*_r.height*3)){const[$r]=er;fr=er[1]||Fo;const Fr=$r.width*$r.height*4===$r.data.length?ks.from($r.data):function(jr){if(jr.length%3!=0)throw new Error("Buffer length is incorrect");const Vr=ks.allocUnsafe(jr.length/3*4);let co=0;for(let Jr=0;Jr{if(Fr)return Yt.call(this,Fr,wr);this.parseBitmap(jr,$r,wr)})}else if(typeof er[0]=="object"&&ks.isBuffer(er[0])){const $r=er[0];if(fr=er[1],typeof fr!="function")return Yt.call(this,"cb must be a function",wr);this.parseBitmap($r,null,wr)}else{fr=er[er.length-1],typeof fr!="function"&&(fr=er[er.length-2],typeof fr!="function"&&(fr=Fo));const $r=na.__extraConstructors.find(Fr=>Fr.test(...er));if(!$r)return Yt.call(this,"No matching constructor overloading was found. Please see the docs for how to call the Jimp constructor.",wr);new Promise((Fr,jr)=>{$r.run.call(this,Fr,jr,...er)}).then(()=>wr(null,this)).catch(wr)}var _r}parseBitmap(zn,er,rr){ss.call(this,zn,null,rr)}rgba(zn,er){return typeof zn!="boolean"?Yt.call(this,"bool must be a boolean, true for RGBA or false for RGB",er):(this._rgba=zn,qt(er)&&er.call(this,null,this),this)}emitMulti(zn,er){let rr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};rr=Object.assign(rr,{methodName:zn,eventName:er}),this.emit("any",rr),zn&&this.emit(zn,rr),this.emit(er,rr)}emitError(zn,er){this.emitMulti(zn,"error",er)}getHeight(){return this.bitmap.height}getWidth(){return this.bitmap.width}inspect(){return""}toString(){return"[object Jimp]"}getMIME(){return this._originalMime||na.MIME_PNG}getExtension(){const zn=this.getMIME();return(qo[zn.toLowerCase()]||[])[0]}write(zn,er){if(!Nt()||!Nt().createWriteStream)throw new Error("Cant access the filesystem. You can use the getBase64 method.");if(typeof zn!="string")return Yt.call(this,"path must be a string",er);if(er===void 0&&(er=Fo),typeof er!="function")return Yt.call(this,"cb must be a function",er);const rr=Jo(zn)||this.getMIME(),lr=Ut().parse(zn);return lr.dir&&Nt().mkdirSync(lr.dir,{recursive:!0}),this.getBuffer(rr,(fr,wr)=>{if(fr)return Yt.call(this,fr,er);const _r=Nt().createWriteStream(zn);_r.on("open",()=>{_r.write(wr),_r.end()}).on("error",$r=>Yt.call(this,$r,er)),_r.on("finish",()=>{er.call(this,null,this)})}),this}getBase64(zn,er){return zn===na.AUTO&&(zn=this.getMIME()),typeof zn!="string"?Yt.call(this,"mime must be a string",er):typeof er!="function"?Yt.call(this,"cb must be a function",er):(this.getBuffer(zn,function(rr,lr){if(rr)return Yt.call(this,rr,er);const fr="data:"+zn+";base64,"+lr.toString("base64");er.call(this,null,fr)}),this)}hash(zn,er){if(typeof(zn=zn||64)=="function"&&(er=zn,zn=64),typeof zn!="number")return Yt.call(this,"base must be a number",er);if(zn<2||zn>64)return Yt.call(this,"base must be a number between 2 and 64",er);let rr=this.pHash();for(rr=Qt()(Qt().BIN,Is.slice(0,zn))(rr);rr.length=this.bitmap.width&&(fr=this.bitmap.width-1),er<0&&(wr=0),er>=this.bitmap.height&&(wr=this.bitmap.height-1)),rr===na.EDGE_WRAP&&(zn<0&&(fr=this.bitmap.width+zn),zn>=this.bitmap.width&&(fr=zn%this.bitmap.width),er<0&&(wr=this.bitmap.height+er),er>=this.bitmap.height&&(wr=er%this.bitmap.height));let _r=this.bitmap.width*wr+fr<<2;return(fr<0||fr>=this.bitmap.width)&&(_r=-1),(wr<0||wr>=this.bitmap.height)&&(_r=-1),qt(lr)&&lr.call(this,null,_r),_r}getPixelColor(zn,er,rr){if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",rr);zn=Math.round(zn),er=Math.round(er);const lr=this.getPixelIndex(zn,er),fr=this.bitmap.data.readUInt32BE(lr);return qt(rr)&&rr.call(this,null,fr),fr}setPixelColor(zn,er,rr,lr){if(typeof zn!="number"||typeof er!="number"||typeof rr!="number")return Yt.call(this,"hex, x and y must be numbers",lr);er=Math.round(er),rr=Math.round(rr);const fr=this.getPixelIndex(er,rr);return this.bitmap.data.writeUInt32BE(zn,fr),qt(lr)&&lr.call(this,null,this),this}hasAlpha(){for(let zn=0;zn1&&arguments[1]!==void 0?arguments[1]:na;Object.entries(Fn).forEach(er=>{let[rr,lr]=er;zn[rr]=lr})}function Eu(Fn){let zn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:na;Object.entries(Fn).forEach(er=>{let[rr,lr]=er;zn.prototype[rr]=lr})}function Mn(Fn,zn,er){const rr="before-"+zn,lr=zn.replace(/e$/,"")+"ed";na.prototype[Fn]=function(){let fr;for(var wr=arguments.length,_r=new Array(wr),$r=0;$r3&&arguments[3]!==void 0?arguments[3]:{},lr=arguments.length>4?arguments[4]:void 0;if(typeof rr=="function"&&(lr=rr,rr={}),!(Fn instanceof this.constructor))return Yt.call(this,"The source must be a Jimp image",lr);if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",lr);let{mode:fr,opacitySource:wr,opacityDest:_r}=rr;fr||(fr=Mr),(typeof wr!="number"||wr<0||wr>1)&&(wr=1),(typeof _r!="number"||_r<0||_r>1)&&(_r=1);const $r=Pt[fr];zn=Math.round(zn),er=Math.round(er);const Fr=this;return _r!==1&&Fr.opacity(_r),Fn.scanQuiet(0,0,Fn.bitmap.width,Fn.bitmap.height,function(jr,Vr,co){const Jr=Fr.getPixelIndex(zn+jr,er+Vr,Or);if(Jr===-1)return;const Xr=$r({r:this.bitmap.data[co+0]/255,g:this.bitmap.data[co+1]/255,b:this.bitmap.data[co+2]/255,a:this.bitmap.data[co+3]/255},{r:Fr.bitmap.data[Jr+0]/255,g:Fr.bitmap.data[Jr+1]/255,b:Fr.bitmap.data[Jr+2]/255,a:Fr.bitmap.data[Jr+3]/255},wr);Fr.bitmap.data[Jr+0]=this.constructor.limit255(255*Xr.r),Fr.bitmap.data[Jr+1]=this.constructor.limit255(255*Xr.g),Fr.bitmap.data[Jr+2]=this.constructor.limit255(255*Xr.b),Fr.bitmap.data[Jr+3]=this.constructor.limit255(255*Xr.a)}),qt(lr)&&lr.call(this,null,this),this}}),na.__extraConstructors=[],na.appendConstructorOption=function(Fn,zn,er){na.__extraConstructors.push({name:Fn,test:zn,run:er})},na.read=function(){for(var Fn=arguments.length,zn=new Array(Fn),er=0;er{new na(...zn,(fr,wr)=>{fr?lr(fr):rr(wr)})})},na.create=na.read,na.rgbaToInt=function(Fn,zn,er,rr,lr){if(typeof Fn!="number"||typeof zn!="number"||typeof er!="number"||typeof rr!="number")return Yt.call(this,"r, g, b and a must be numbers",lr);if(Fn<0||Fn>255)return Yt.call(this,"r must be between 0 and 255",lr);if((zn<0||zn>255)&&Yt.call(this,"g must be between 0 and 255",lr),er<0||er>255)return Yt.call(this,"b must be between 0 and 255",lr);if(rr<0||rr>255)return Yt.call(this,"a must be between 0 and 255",lr);Fn=Math.round(Fn),er=Math.round(er),zn=Math.round(zn),rr=Math.round(rr);const fr=Fn*Math.pow(256,3)+zn*Math.pow(256,2)+er*Math.pow(256,1)+rr*Math.pow(256,0);return qt(lr)&&lr.call(this,null,fr),fr},na.intToRGBA=function(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"i must be a number",zn);const er={};return er.r=Math.floor(Fn/Math.pow(256,3)),er.g=Math.floor((Fn-er.r*Math.pow(256,3))/Math.pow(256,2)),er.b=Math.floor((Fn-er.r*Math.pow(256,3)-er.g*Math.pow(256,2))/Math.pow(256,1)),er.a=Math.floor((Fn-er.r*Math.pow(256,3)-er.g*Math.pow(256,2)-er.b*Math.pow(256,1))/Math.pow(256,0)),qt(zn)&&zn.call(this,null,er),er},na.cssColorToHex=function(Fn){return typeof(Fn=Fn||0)=="number"?Number(Fn):parseInt(sn(Fn).toHex8(),16)},na.limit255=function(Fn){return Fn=Math.max(Fn,0),Math.min(Fn,255)},na.diff=function(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:.1;if(!(Fn instanceof na&&zn instanceof na))return Yt.call(this,"img1 and img2 must be an Jimp images");const rr=Fn.bitmap,lr=zn.bitmap;if(rr.width===lr.width&&rr.height===lr.height||(rr.width*rr.height>lr.width*lr.height?Fn=Fn.cloneQuiet().resize(lr.width,lr.height):zn=zn.cloneQuiet().resize(rr.width,rr.height)),typeof er!="number"||er<0||er>1)return Yt.call(this,"threshold must be a number between 0 and 1");const fr=new na(rr.width,rr.height,4294967295);return{percent:tn()(rr.data,lr.data,fr.bitmap.data,fr.bitmap.width,fr.bitmap.height,{threshold:er})/(fr.bitmap.width*fr.bitmap.height),image:fr}},na.distance=function(Fn,zn){const er=new or,rr=er.getHash(Fn),lr=er.getHash(zn);return er.distance(rr,lr)},na.compareHashes=function(Fn,zn){return new or().distance(Fn,zn)},na.colorDiff=function(Fn,zn){const er=lr=>Math.pow(lr,2),{max:rr}=Math;return Fn.a===0||Fn.a||(Fn.a=255),zn.a===0||zn.a||(zn.a=255),(rr(er(Fn.r-zn.r),er(Fn.r-zn.r-Fn.a+zn.a))+rr(er(Fn.g-zn.g),er(Fn.g-zn.g-Fn.a+zn.a))+rr(er(Fn.b-zn.b),er(Fn.b-zn.b-Fn.a+zn.a)))/195075},Mn("clone","clone",function(Fn){const zn=new na(this);return qt(Fn)&&Fn.call(zn,null,zn),zn}),dr("background",function(Fn,zn){return typeof Fn!="number"?Yt.call(this,"hex must be a hexadecimal rgba value",zn):(this._background=Fn,qt(zn)&&zn.call(this,null,this),this)}),dr("scan",function(Fn,zn,er,rr,lr,fr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"x and y must be numbers",fr);if(typeof er!="number"||typeof rr!="number")return Yt.call(this,"w and h must be numbers",fr);if(typeof lr!="function")return Yt.call(this,"f must be a function",fr);const wr=Xt(this,Fn,zn,er,rr,lr);return qt(fr)&&fr.call(this,null,wr),wr});{let Fn;typeof window<"u"&&typeof window=="object"&&(Fn=window),typeof self<"u"&&typeof self=="object"&&(Fn=self),Fn.Jimp=na,Fn.Buffer=ks}const br=na;var Ir=__webpack_require__(643),Nr=__webpack_require__(2691),Yr=__webpack_require__.n(Nr);const zr="image/jpeg",_i=()=>({mime:{[zr]:["jpeg","jpg","jpe"]},constants:{MIME_JPEG:zr},decoders:{[zr]:Yr().decode},encoders:{[zr]:Fn=>Yr().encode(Fn.bitmap,Fn._quality).data},class:{_quality:100,quality(Fn,zn){return typeof Fn!="number"?Yt.call(this,"n must be a number",zn):Fn<0||Fn>100?Yt.call(this,"n must be a number 0 - 100",zn):(this._quality=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)}}});var qr=__webpack_require__(9902);const so="image/png",eo=()=>({mime:{[so]:["png"]},constants:{MIME_PNG:so,PNG_FILTER_AUTO:-1,PNG_FILTER_NONE:0,PNG_FILTER_SUB:1,PNG_FILTER_UP:2,PNG_FILTER_AVERAGE:3,PNG_FILTER_PATH:4},hasAlpha:{[so]:!0},decoders:{[so]:qr.PNG.sync.read},encoders:{[so](Fn){const zn=new qr.PNG({width:Fn.bitmap.width,height:Fn.bitmap.height});return zn.data=Fn.bitmap.data,qr.PNG.sync.write(zn,{deflateLevel:Fn._deflateLevel,deflateStrategy:Fn._deflateStrategy,filterType:Fn._filterType,colorType:typeof Fn._colorType=="number"?Fn._colorType:Fn._rgba?6:2,inputHasAlpha:Fn._rgba})}},class:{_deflateLevel:9,_deflateStrategy:3,_filterType:-1,_colorType:null,deflateLevel(Fn,zn){return typeof Fn!="number"?Yt.call(this,"l must be a number",zn):Fn<0||Fn>9?Yt.call(this,"l must be a number 0 - 9",zn):(this._deflateLevel=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)},deflateStrategy(Fn,zn){return typeof Fn!="number"?Yt.call(this,"s must be a number",zn):Fn<0||Fn>3?Yt.call(this,"s must be a number 0 - 3",zn):(this._deflateStrategy=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)},filterType(Fn,zn){return typeof Fn!="number"?Yt.call(this,"n must be a number",zn):Fn<-1||Fn>4?Yt.call(this,"n must be -1 (auto) or a number 0 - 4",zn):(this._filterType=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)},colorType(Fn,zn){return typeof Fn!="number"?Yt.call(this,"s must be a number",zn):Fn!==0&&Fn!==2&&Fn!==4&&Fn!==6?Yt.call(this,"s must be a number 0, 2, 4, 6.",zn):(this._colorType=Math.round(Fn),qt(zn)&&zn.call(this,null,this),this)}}});var io=__webpack_require__(486),yo=__webpack_require__.n(io);const Bo="image/bmp",Mo="image/x-ms-bmp",xo=Fn=>{return Xt({bitmap:zn=yo().decode(Fn)},0,0,zn.width,zn.height,function(er,rr,lr){const fr=this.bitmap.data[lr+0],wr=this.bitmap.data[lr+1],_r=this.bitmap.data[lr+2],$r=this.bitmap.data[lr+3];this.bitmap.data[lr+0]=$r,this.bitmap.data[lr+1]=_r,this.bitmap.data[lr+2]=wr,this.bitmap.data[lr+3]=zn.is_with_alpha?fr:255}).bitmap;var zn},wo=Fn=>yo().encode(function(zn){return Xt(zn,0,0,zn.bitmap.width,zn.bitmap.height,function(er,rr,lr){const fr=this.bitmap.data[lr+0],wr=this.bitmap.data[lr+1],_r=this.bitmap.data[lr+2],$r=this.bitmap.data[lr+3];this.bitmap.data[lr+0]=$r,this.bitmap.data[lr+1]=_r,this.bitmap.data[lr+2]=wr,this.bitmap.data[lr+3]=fr}).bitmap}(Fn)).data;var os=__webpack_require__(9299),rs=__webpack_require__.n(os),xs=__webpack_require__(8834).lW;const fs="image/tiff";var Ds=__webpack_require__(63),ms=__webpack_require__(9455),Po=__webpack_require__(8834).lW;const Ol="image/gif",Hu=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],Gu=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18];var ru=__webpack_require__(8834).lW;function vu(Fn,zn,er,rr){const lr=[0,0,0],fr=(zn.length-1)/2;for(let wr=0;wrFn!=null;function Su(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){const lr=parseInt(.2126*this.bitmap.data[rr]+.7152*this.bitmap.data[rr+1]+.0722*this.bitmap.data[rr+2],10);this.bitmap.data[rr]=lr,this.bitmap.data[rr+1]=lr,this.bitmap.data[rr+2]=lr}),qt(Fn)&&Fn.call(this,null,this),this}function bu(Fn,zn){let er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:50;return{r:(zn.r-Fn.r)*(er/100)+Fn.r,g:(zn.g-Fn.g)*(er/100)+Fn.g,b:(zn.b-Fn.b)*(er/100)+Fn.b}}function Dm(Fn,zn){return Fn&&Array.isArray(Fn)?(Fn=Fn.map(er=>(er.apply!=="xor"&&er.apply!=="mix"||(er.params[0]=sn(er.params[0]).toRgb()),er)),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(er,rr,lr)=>{let fr={r:this.bitmap.data[lr],g:this.bitmap.data[lr+1],b:this.bitmap.data[lr+2]};const wr=(_r,$r)=>this.constructor.limit255(fr[_r]+$r);Fn.forEach(_r=>{if(_r.apply==="mix")fr=bu(fr,_r.params[0],_r.params[1]);else if(_r.apply==="tint")fr=bu(fr,{r:255,g:255,b:255},_r.params[0]);else if(_r.apply==="shade")fr=bu(fr,{r:0,g:0,b:0},_r.params[0]);else if(_r.apply==="xor")fr={r:fr.r^_r.params[0].r,g:fr.g^_r.params[0].g,b:fr.b^_r.params[0].b};else if(_r.apply==="red")fr.r=wr("r",_r.params[0]);else if(_r.apply==="green")fr.g=wr("g",_r.params[0]);else if(_r.apply==="blue")fr.b=wr("b",_r.params[0]);else{if(_r.apply==="hue"&&(_r.apply="spin"),fr=sn(fr),!fr[_r.apply])return Yt.call(this,"action "+_r.apply+" not supported",zn);fr=fr[_r.apply](..._r.params).toRgb()}}),this.bitmap.data[lr]=fr.r,this.bitmap.data[lr+1]=fr.g,this.bitmap.data[lr+2]=fr.b}),qt(zn)&&zn.call(this,null,this),this):Yt.call(this,"actions must be an array",zn)}var Mp=__webpack_require__(8834).lW;function Bm(Fn){const zn=[1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6];return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){const fr=zn[((3&rr)<<2)+er%4];this.bitmap.data[lr]=Math.min(this.bitmap.data[lr]+fr,255),this.bitmap.data[lr+1]=Math.min(this.bitmap.data[lr+1]+fr,255),this.bitmap.data[lr+2]=Math.min(this.bitmap.data[lr+2]+fr,255)}),qt(Fn)&&Fn.call(this,null,this),this}var Nm=__webpack_require__(8834).lW;function Fm(Fn,zn,er){if(typeof Fn!="boolean"||typeof zn!="boolean")return Yt.call(this,"horizontal and vertical must be Booleans",er);const rr=Nm.alloc(this.bitmap.data.length);return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(lr,fr,wr){const _r=Fn?this.bitmap.width-1-lr:lr,$r=zn?this.bitmap.height-1-fr:fr,Fr=this.bitmap.width*$r+_r<<2,jr=this.bitmap.data.readUInt32BE(wr);rr.writeUInt32BE(jr,Fr)}),this.bitmap.data=Nm.from(rr),qt(er)&&er.call(this,null,this),this}function Vm(){const Fn={r:new Array(256).fill(0),g:new Array(256).fill(0),b:new Array(256).fill(0)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){Fn.r[this.bitmap.data[rr+0]]++,Fn.g[this.bitmap.data[rr+1]]++,Fn.b[this.bitmap.data[rr+2]]++}),Fn}const $u=function(Fn,zn,er){return 255*(Fn-zn)/(er-zn)},Op=function(Fn){return[Fn.findIndex(zn=>zn>0),255-Fn.slice().reverse().findIndex(zn=>zn>0)]};var qm=__webpack_require__(8058),Ym=__webpack_require__.n(qm);function Rp(Fn,zn){let er=0;for(let rr=0;rr{const $r=[...fr,_r].join(" "),Fr=Rp(Fn,$r);Fr<=er?(Fr>wr&&(wr=Fr),fr.push(_r)):(lr.push(fr),fr=[_r])}),lr.push(fr),{lines:lr,longestLine:wr}}function zo(Fn,zn,er){const{lines:rr}=jm(Fn,zn,er);return rr.length*Fn.common.lineHeight}function Uo(Fn,zn,er,rr,lr){if(lr.width>0&&lr.height>0){const fr=zn.pages[lr.page];Fn.blit(fr,er+lr.xoffset,rr+lr.yoffset,lr.x,lr.y,lr.width,lr.height)}return Fn}function Xm(Fn,zn,er,rr,lr){for(let fr=0;fr0&&this.heightOriginal>0&&this.targetWidth>0&&this.targetHeight>0))throw new Error("Invalid settings specified for the resizer.");this.configurePasses()},Ws.prototype.configurePasses=function(){this.widthOriginal===this.targetWidth?this.resizeWidth=this.bypassResizer:(this.ratioWeightWidthPass=this.widthOriginal/this.targetWidth,this.ratioWeightWidthPass<1&&this.interpolationPass?(this.initializeFirstPassBuffers(!0),this.resizeWidth=this.colorChannels===4?this.resizeWidthInterpolatedRGBA:this.resizeWidthInterpolatedRGB):(this.initializeFirstPassBuffers(!1),this.resizeWidth=this.colorChannels===4?this.resizeWidthRGBA:this.resizeWidthRGB)),this.heightOriginal===this.targetHeight?this.resizeHeight=this.bypassResizer:(this.ratioWeightHeightPass=this.heightOriginal/this.targetHeight,this.ratioWeightHeightPass<1&&this.interpolationPass?(this.initializeSecondPassBuffers(!0),this.resizeHeight=this.resizeHeightInterpolated):(this.initializeSecondPassBuffers(!1),this.resizeHeight=this.colorChannels===4?this.resizeHeightRGBA:this.resizeHeightRGB))},Ws.prototype._resizeWidthInterpolatedRGBChannels=function(Fn,zn){const er=zn?4:3,rr=this.ratioWeightWidthPass,lr=this.widthBuffer;let fr,wr,_r=0,$r=0,Fr=0,jr=0,Vr=0;for(fr=0;_r<1/3;fr+=er,_r+=rr)for($r=fr,Fr=0;$r=Vr)){Jr+=jr;break}co+=er,Jr=co,jr-=Vr}while(jr>0&&co=$r)){jr+=_r;break}Fr=Jr,jr=Fr,_r-=$r}while(_r>0&&Fr3&&(this.outputWidthWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.heightOriginal)))},Ws.prototype.initializeSecondPassBuffers=function(Fn){this.heightBuffer=this.generateUint8Buffer(this.finalResultSize),Fn||(this.outputHeightWorkBench=this.generateFloatBuffer(this.targetWidthMultipliedByChannels),this.colorChannels>3&&(this.outputHeightWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.targetWidth)))},Ws.prototype.generateFloatBuffer=function(Fn){try{return new Float32Array(Fn)}catch{return[]}},Ws.prototype.generateFloat64Buffer=function(Fn){try{return new Float64Array(Fn)}catch{return[]}},Ws.prototype.generateUint8Buffer=function(Fn){try{return new Uint8Array(Fn)}catch{return[]}};const Km=Ws;var zm=__webpack_require__(8834).lW;const Zm={nearestNeighbor(Fn,zn){const er=Fn.width,rr=Fn.height,lr=zn.width,fr=zn.height,wr=Fn.data,_r=zn.data;for(let $r=0;$r0?lr[ba-4]:2*lr[ba]-lr[ba+4],iu=lr[ba],nu=lr[ba+4],xu=Yo0?Xr[ba-4*Vr]:2*Xr[ba]-Xr[ba+4*Vr],iu=Xr[ba],nu=Xr[ba+4*Vr],xu=Yo<_r-2?Xr[ba+8*Vr]:2*Xr[ba+4*Vr]-Xr[ba];Kr[Vo+es]=rr(Vs,iu,nu,xu,Oo)}}const Qr=jr*co;if(Qr>1)for(let fo=0;fo=0&&Qr.x<_r&&Qr.y>=0&&Qr.y<$r){const _o=(_r*(0|Qr.y)+Qr.x|0)<<2,jo=this.bitmap.data.readUInt32BE(_o);Fr.writeUInt32BE(jo,fo)}else Fr.writeUInt32BE(this._background,fo)}if(this.bitmap.data=Fr,zn===!0||typeof zn=="string"){const Jr=_r/2-fr/2,Xr=$r/2-wr/2;this.crop(Jr,Xr,fr,wr)}}const Lp=[()=>({blit(Fn,zn,er,rr,lr,fr,wr,_r){if(!(Fn instanceof this.constructor))return Yt.call(this,"The source must be a Jimp image",_r);if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",_r);if(typeof rr=="function")_r=rr,rr=0,lr=0,fr=Fn.bitmap.width,wr=Fn.bitmap.height;else{if(typeof rr!=typeof lr||typeof lr!=typeof fr||typeof fr!=typeof wr)return Yt.call(this,"srcx, srcy, srcw, srch must be numbers",_r);rr=rr||0,lr=lr||0,fr=fr||Fn.bitmap.width,wr=wr||Fn.bitmap.height}zn=Math.round(zn),er=Math.round(er),rr=Math.round(rr),lr=Math.round(lr),fr=Math.round(fr),wr=Math.round(wr);const $r=this.bitmap.width,Fr=this.bitmap.height,jr=this;return Fn.scanQuiet(rr,lr,fr,wr,function(Vr,co,Jr){const Xr=zn+Vr-rr,Kr=er+co-lr;if(Xr>=0&&Kr>=0&&$r-Xr>0&&Fr-Kr>0){const Qr=jr.getPixelIndex(Xr,Kr),fo={r:this.bitmap.data[Jr],g:this.bitmap.data[Jr+1],b:this.bitmap.data[Jr+2],a:this.bitmap.data[Jr+3]},_o={r:jr.bitmap.data[Qr],g:jr.bitmap.data[Qr+1],b:jr.bitmap.data[Qr+2],a:jr.bitmap.data[Qr+3]};jr.bitmap.data[Qr]=(fo.a*(fo.r-_o.r)-_o.r+255>>8)+_o.r,jr.bitmap.data[Qr+1]=(fo.a*(fo.g-_o.g)-_o.g+255>>8)+_o.g,jr.bitmap.data[Qr+2]=(fo.a*(fo.b-_o.b)-_o.b+255>>8)+_o.b,jr.bitmap.data[Qr+3]=this.constructor.limit255(_o.a+fo.a)}}),qt(_r)&&_r.call(this,null,this),this}}),()=>({blur(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"r must be a number",zn);if(Fn<1)return Yt.call(this,"r must be greater than 0",zn);let er,rr,lr,fr,wr,_r,$r,Fr,jr,Vr,co,Jr,Xr,Kr;const Qr=this.bitmap.width-1,fo=this.bitmap.height-1,_o=Fn+1,jo=Hu[Fn],Yo=Gu[Fn],Oo=[],Zo=[],Vo=[],es=[],ba=[],Vs=[];let iu=2;for(;iu-- >0;){for(Jr=0,Xr=0,_r=0;_rQr?Qr:$r)<<2),er+=this.bitmap.data[Fr++],rr+=this.bitmap.data[Fr++],lr+=this.bitmap.data[Fr++],fr+=this.bitmap.data[Fr];for(wr=0;wr0?Fr<<2:0),jr=Xr+ba[wr],Vr=Xr+Vs[wr],er+=this.bitmap.data[jr++]-this.bitmap.data[Vr++],rr+=this.bitmap.data[jr++]-this.bitmap.data[Vr++],lr+=this.bitmap.data[jr++]-this.bitmap.data[Vr++],fr+=this.bitmap.data[jr]-this.bitmap.data[Vr],Jr++;Xr+=this.bitmap.width<<2}for(wr=0;wrfo?0:this.bitmap.width,er+=Oo[co],rr+=Zo[co],lr+=Vo[co],fr+=es[co];for(Jr=wr<<2,_r=0;_r>>Yo,this.bitmap.data[Jr+3]=Kr,Kr>255&&(this.bitmap.data[Jr+3]=255),Kr>0?(Kr=255/Kr,this.bitmap.data[Jr]=(er*jo>>>Yo)*Kr,this.bitmap.data[Jr+1]=(rr*jo>>>Yo)*Kr,this.bitmap.data[Jr+2]=(lr*jo>>>Yo)*Kr):(this.bitmap.data[Jr+2]=0,this.bitmap.data[Jr+1]=0,this.bitmap.data[Jr]=0),wr===0&&(ba[_r]=((Fr=_r+_o)0?Fr*this.bitmap.width:0),jr=wr+ba[_r],Vr=wr+Vs[_r],er+=Oo[jr]-Oo[Vr],rr+=Zo[jr]-Zo[Vr],lr+=Vo[jr]-Vo[Vr],fr+=es[jr]-es[Vr],Jr+=this.bitmap.width<<2}}return qt(zn)&&zn.call(this,null,this),this}}),()=>({circle(){let Fn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},zn=arguments.length>1?arguments[1]:void 0;typeof Fn=="function"&&(zn=Fn,Fn={});const er=Fn.radius||(this.bitmap.width>this.bitmap.height?this.bitmap.height:this.bitmap.width)/2,rr=typeof Fn.x=="number"?Fn.x:this.bitmap.width/2,lr=typeof Fn.y=="number"?Fn.y:this.bitmap.height/2;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(fr,wr,_r){const $r=Math.sqrt(Math.pow(fr-rr,2)+Math.pow(wr-lr,2));er-$r<=0?this.bitmap.data[_r+3]=0:er-$r<1&&(this.bitmap.data[_r+3]=255*(er-$r))}),qt(zn)&&zn.call(this,null,this),this}}),()=>({brightness(Fn,zn){return typeof Fn!="number"?Yt.call(this,"val must be numbers",zn):Fn<-1||Fn>1?Yt.call(this,"val must be a number between -1 and +1",zn):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){Fn<0?(this.bitmap.data[lr]*=1+Fn,this.bitmap.data[lr+1]*=1+Fn,this.bitmap.data[lr+2]*=1+Fn):(this.bitmap.data[lr]+=(255-this.bitmap.data[lr])*Fn,this.bitmap.data[lr+1]+=(255-this.bitmap.data[lr+1])*Fn,this.bitmap.data[lr+2]+=(255-this.bitmap.data[lr+2])*Fn)}),qt(zn)&&zn.call(this,null,this),this)},contrast(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"val must be numbers",zn);if(Fn<-1||Fn>1)return Yt.call(this,"val must be a number between -1 and +1",zn);const er=(Fn+1)/(1-Fn);function rr(lr){return(lr=Math.floor(er*(lr-127)+127))<0?0:lr>255?255:lr}return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(lr,fr,wr){this.bitmap.data[wr]=rr(this.bitmap.data[wr]),this.bitmap.data[wr+1]=rr(this.bitmap.data[wr+1]),this.bitmap.data[wr+2]=rr(this.bitmap.data[wr+2])}),qt(zn)&&zn.call(this,null,this),this},posterize(Fn,zn){return typeof Fn!="number"?Yt.call(this,"n must be numbers",zn):(Fn<2&&(Fn=2),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){this.bitmap.data[lr]=Math.floor(this.bitmap.data[lr]/255*(Fn-1))/(Fn-1)*255,this.bitmap.data[lr+1]=Math.floor(this.bitmap.data[lr+1]/255*(Fn-1))/(Fn-1)*255,this.bitmap.data[lr+2]=Math.floor(this.bitmap.data[lr+2]/255*(Fn-1))/(Fn-1)*255}),qt(zn)&&zn.call(this,null,this),this)},greyscale:Su,grayscale:Su,opacity(Fn,zn){return typeof Fn!="number"?Yt.call(this,"f must be a number",zn):Fn<0||Fn>1?Yt.call(this,"f must be a number from 0 to 1",zn):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(er,rr,lr){const fr=this.bitmap.data[lr+3]*Fn;this.bitmap.data[lr+3]=fr}),qt(zn)&&zn.call(this,null,this),this)},sepia(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){let lr=this.bitmap.data[rr],fr=this.bitmap.data[rr+1],wr=this.bitmap.data[rr+2];lr=.393*lr+.769*fr+.189*wr,fr=.349*lr+.686*fr+.168*wr,wr=.272*lr+.534*fr+.131*wr,this.bitmap.data[rr]=lr<255?lr:255,this.bitmap.data[rr+1]=fr<255?fr:255,this.bitmap.data[rr+2]=wr<255?wr:255}),qt(Fn)&&Fn.call(this,null,this),this},fade(Fn,zn){return typeof Fn!="number"?Yt.call(this,"f must be a number",zn):Fn<0||Fn>1?Yt.call(this,"f must be a number from 0 to 1",zn):(this.opacity(1-Fn),qt(zn)&&zn.call(this,null,this),this)},convolution(Fn,zn,er){typeof zn=="function"&&er===void 0&&(er=zn,zn=null),zn||(zn=this.constructor.EDGE_EXTEND);const rr=ru.from(this.bitmap.data),lr=Fn.length,fr=Fn[0].length,wr=Math.floor(lr/2),_r=Math.floor(fr/2),$r=-wr,Fr=-_r;let jr,Vr,co,Jr,Xr,Kr,Qr,fo,_o,jo;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(Yo,Oo,Zo){Jr=0,co=0,Vr=0;for(let Vo=$r;Vo<=wr;Vo++)for(let es=Fr;es<=_r;es++)fo=Yo+es,_o=Oo+Vo,jr=Fn[Vo+wr][es+_r],jo=this.getPixelIndex(fo,_o,zn),jo===-1?(Qr=0,Kr=0,Xr=0):(Xr=this.bitmap.data[jo+0],Kr=this.bitmap.data[jo+1],Qr=this.bitmap.data[jo+2]),Vr+=jr*Xr,co+=jr*Kr,Jr+=jr*Qr;Vr<0&&(Vr=0),co<0&&(co=0),Jr<0&&(Jr=0),Vr>255&&(Vr=255),co>255&&(co=255),Jr>255&&(Jr=255),rr[Zo+0]=Vr,rr[Zo+1]=co,rr[Zo+2]=Jr}),this.bitmap.data=rr,qt(er)&&er.call(this,null,this),this},opaque(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){this.bitmap.data[rr+3]=255}),qt(Fn)&&Fn.call(this,null,this),this},pixelate(Fn,zn,er,rr,lr,fr){if(typeof zn=="function")fr=zn,lr=null,rr=null,er=null,zn=null;else{if(typeof Fn!="number")return Yt.call(this,"size must be a number",fr);if(Gs(zn)&&typeof zn!="number")return Yt.call(this,"x must be a number",fr);if(Gs(er)&&typeof er!="number")return Yt.call(this,"y must be a number",fr);if(Gs(rr)&&typeof rr!="number")return Yt.call(this,"w must be a number",fr);if(Gs(lr)&&typeof lr!="number")return Yt.call(this,"h must be a number",fr)}const wr=[[1/16,2/16,1/16],[2/16,.25,2/16],[1/16,2/16,1/16]];zn=zn||0,er=er||0,rr=Gs(rr)?rr:this.bitmap.width-zn,lr=Gs(lr)?lr:this.bitmap.height-er;const _r=this.cloneQuiet();return this.scanQuiet(zn,er,rr,lr,function($r,Fr,jr){$r=Fn*Math.floor($r/Fn),Fr=Fn*Math.floor(Fr/Fn);const Vr=vu(_r,wr,$r,Fr);this.bitmap.data[jr]=Vr[0],this.bitmap.data[jr+1]=Vr[1],this.bitmap.data[jr+2]=Vr[2]}),qt(fr)&&fr.call(this,null,this),this},convolute(Fn,zn,er,rr,lr,fr){if(!Array.isArray(Fn))return Yt.call(this,"the kernel must be an array",fr);if(typeof zn=="function")fr=zn,zn=null,er=null,rr=null,lr=null;else{if(Gs(zn)&&typeof zn!="number")return Yt.call(this,"x must be a number",fr);if(Gs(er)&&typeof er!="number")return Yt.call(this,"y must be a number",fr);if(Gs(rr)&&typeof rr!="number")return Yt.call(this,"w must be a number",fr);if(Gs(lr)&&typeof lr!="number")return Yt.call(this,"h must be a number",fr)}zn=Gs(zn)?zn:0,er=Gs(er)?er:0,rr=Gs(rr)?rr:this.bitmap.width-zn,lr=Gs(lr)?lr:this.bitmap.height-er;const wr=this.cloneQuiet();return this.scanQuiet(zn,er,rr,lr,function(_r,$r,Fr){const jr=vu(wr,Fn,_r,$r);this.bitmap.data[Fr]=this.constructor.limit255(jr[0]),this.bitmap.data[Fr+1]=this.constructor.limit255(jr[1]),this.bitmap.data[Fr+2]=this.constructor.limit255(jr[2])}),qt(fr)&&fr.call(this,null,this),this},color:Dm,colour:Dm}),()=>({contain(Fn,zn,er,rr,lr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",lr);typeof er=="string"&&(typeof rr=="function"&&lr===void 0&&(lr=rr),rr=er,er=null),typeof er=="function"&&(lr===void 0&&(lr=er),rr=null,er=null),typeof rr=="function"&&lr===void 0&&(lr=rr,rr=null);const fr=7&(er=er||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),wr=er>>3;if((fr===0||fr&fr-1)&&(wr===0||wr&wr-1))return Yt.call(this,"only use one flag per alignment direction",lr);const _r=fr>>1,$r=wr>>1,Fr=Fn/zn>this.bitmap.width/this.bitmap.height?zn/this.bitmap.height:Fn/this.bitmap.width,jr=this.cloneQuiet().scale(Fr,rr);return this.resize(Fn,zn,rr),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(Vr,co,Jr){this.bitmap.data.writeUInt32BE(this._background,Jr)}),this.blit(jr,(this.bitmap.width-jr.bitmap.width)/2*_r,(this.bitmap.height-jr.bitmap.height)/2*$r),qt(lr)&&lr.call(this,null,this),this}}),()=>({cover(Fn,zn,er,rr,lr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",lr);er&&typeof er=="function"&&lr===void 0?(lr=er,er=null,rr=null):typeof rr=="function"&&lr===void 0&&(lr=rr,rr=null);const fr=7&(er=er||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),wr=er>>3;if((fr===0||fr&fr-1)&&(wr===0||wr&wr-1))return Yt.call(this,"only use one flag per alignment direction",lr);const _r=fr>>1,$r=wr>>1,Fr=Fn/zn>this.bitmap.width/this.bitmap.height?Fn/this.bitmap.width:zn/this.bitmap.height;return this.scale(Fr,rr),this.crop((this.bitmap.width-Fn)/2*_r,(this.bitmap.height-zn)/2*$r,Fn,zn),qt(lr)&&lr.call(this,null,this),this}}),function(Fn){return Fn("crop",function(zn,er,rr,lr,fr){if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",fr);if(typeof rr!="number"||typeof lr!="number")return Yt.call(this,"w and h must be numbers",fr);if(zn=Math.round(zn),er=Math.round(er),rr=Math.round(rr),lr=Math.round(lr),zn===0&&rr===this.bitmap.width){const wr=rr*er+zn<<2,_r=wr+(lr*rr<<2);this.bitmap.data=this.bitmap.data.slice(wr,_r)}else{const wr=Mp.allocUnsafe(rr*lr*4);let _r=0;this.scanQuiet(zn,er,rr,lr,function($r,Fr,jr){const Vr=this.bitmap.data.readUInt32BE(jr,!0);wr.writeUInt32BE(Vr,_r,!0),_r+=4}),this.bitmap.data=wr}return this.bitmap.width=rr,this.bitmap.height=lr,qt(fr)&&fr.call(this,null,this),this}),{class:{autocrop(){const zn=this.bitmap.width,er=this.bitmap.height;let rr,lr=0,fr=2e-4,wr=!0,_r=!1,$r={north:!1,south:!1,east:!1,west:!1};for(var Fr=arguments.length,jr=new Array(Fr),Vr=0;Vrfr)break e}Xr++}if(co=this.getPixelColor(zn,0),!$r.west)e:for(let Oo=0;Oofr)break e}fo++}if(co=this.getPixelColor(0,er),!$r.south)e:for(let Oo=er-1;Oo>=Xr+1;Oo--){for(let Zo=zn-Kr-1;Zo>=0;Zo--){const Vo=this.getPixelColor(Zo,Oo),es=this.constructor.intToRGBA(Vo);if(this.constructor.colorDiff(Jr,es)>fr)break e}Qr++}if(co=this.getPixelColor(zn,er),!$r.east)e:for(let Oo=zn-1;Oo>=0+fo+1;Oo--){for(let Zo=er-1;Zo>=0+Xr;Zo--){const Vo=this.getPixelColor(Oo,Zo),es=this.constructor.intToRGBA(Vo);if(this.constructor.colorDiff(Jr,es)>fr)break e}Kr++}let _o=!1;if(fo-=lr,Kr-=lr,Xr-=lr,Qr-=lr,_r){const Oo=Math.min(Kr,fo),Zo=Math.min(Xr,Qr);fo=Oo,Kr=Oo,Xr=Zo,Qr=Zo}fo=fo>=0?fo:0,Kr=Kr>=0?Kr:0,Xr=Xr>=0?Xr:0,Qr=Qr>=0?Qr:0;const jo=zn-(fo+Kr),Yo=er-(Qr+Xr);return _o=wr?Kr!==0&&Xr!==0&&fo!==0&&Qr!==0:Kr!==0||Xr!==0||fo!==0||Qr!==0,_o&&this.crop(fo,Xr,jo,Yo),qt(rr)&&rr.call(this,null,this),this}}}},()=>({displace(Fn,zn,er){if(typeof Fn!="object"||Fn.constructor!==this.constructor)return Yt.call(this,"The source must be a Jimp image",er);if(typeof zn!="number")return Yt.call(this,"factor must be a number",er);const rr=this.cloneQuiet();return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(lr,fr,wr){let _r=Fn.bitmap.data[wr]/256*zn;_r=Math.round(_r);const $r=this.getPixelIndex(lr+_r,fr);this.bitmap.data[$r]=rr.bitmap.data[wr],this.bitmap.data[$r+1]=rr.bitmap.data[wr+1],this.bitmap.data[$r+2]=rr.bitmap.data[wr+2]}),qt(er)&&er.call(this,null,this),this}}),()=>({dither565:Bm,dither16:Bm}),()=>({fisheye(){let Fn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{r:2.5},zn=arguments.length>1?arguments[1]:void 0;typeof Fn=="function"&&(zn=Fn,Fn={r:2.5});const er=this.cloneQuiet(),{width:rr,height:lr}=er.bitmap;return er.scanQuiet(0,0,rr,lr,(fr,wr)=>{const _r=fr/rr,$r=wr/lr,Fr=Math.sqrt(Math.pow(_r-.5,2)+Math.pow($r-.5,2)),jr=2*Math.pow(Fr,Fn.r),Vr=(_r-.5)/Fr,co=($r-.5)/Fr,Jr=Math.round((jr*Vr+.5)*rr),Xr=Math.round((jr*co+.5)*lr),Kr=er.getPixelColor(Jr,Xr);this.setPixelColor(Kr,fr,wr)}),this.setPixelColor(er.getPixelColor(rr/2,lr/2),rr/2,lr/2),qt(zn)&&zn.call(this,null,this),this}}),()=>({flip:Fm,mirror:Fm}),()=>({gaussian(Fn,zn){if(typeof Fn!="number")return Yt.call(this,"r must be a number",zn);if(Fn<1)return Yt.call(this,"r must be greater than 0",zn);const er=Math.ceil(2.57*Fn),rr=2*er+1,lr=Fn*Fn*2,fr=lr*Math.PI,wr=[];for(let _r=0;_r({invert(Fn){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(zn,er,rr){this.bitmap.data[rr]=255-this.bitmap.data[rr],this.bitmap.data[rr+1]=255-this.bitmap.data[rr+1],this.bitmap.data[rr+2]=255-this.bitmap.data[rr+2]}),qt(Fn)&&Fn.call(this,null,this),this}}),()=>({mask(Fn){let zn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,er=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,rr=arguments.length>3?arguments[3]:void 0;if(!(Fn instanceof this.constructor))return Yt.call(this,"The source must be a Jimp image",rr);if(typeof zn!="number"||typeof er!="number")return Yt.call(this,"x and y must be numbers",rr);zn=Math.round(zn),er=Math.round(er);const lr=this.bitmap.width,fr=this.bitmap.height,wr=this;return Fn.scanQuiet(0,0,Fn.bitmap.width,Fn.bitmap.height,function(_r,$r,Fr){const jr=zn+_r,Vr=er+$r;if(jr>=0&&Vr>=0&&jr({normalize(Fn){const zn=Vm.call(this),er={r:Op(zn.r),g:Op(zn.g),b:Op(zn.b)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,function(rr,lr,fr){const wr=this.bitmap.data[fr+0],_r=this.bitmap.data[fr+1],$r=this.bitmap.data[fr+2];this.bitmap.data[fr+0]=$u(wr,er.r[0],er.r[1]),this.bitmap.data[fr+1]=$u(_r,er.g[0],er.g[1]),this.bitmap.data[fr+2]=$u($r,er.b[0],er.b[1])}),qt(Fn)&&Fn.call(this,null,this),this}}),()=>({constants:{measureText:Rp,measureTextHeight:zo,FONT_SANS_8_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"),FONT_SANS_10_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"),FONT_SANS_12_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"),FONT_SANS_14_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"),FONT_SANS_16_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"),FONT_SANS_32_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"),FONT_SANS_64_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"),FONT_SANS_128_BLACK:Ut().join(Ll,"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"),FONT_SANS_8_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"),FONT_SANS_16_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"),FONT_SANS_32_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"),FONT_SANS_64_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"),FONT_SANS_128_WHITE:Ut().join(Ll,"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"),loadFont(Fn,zn){return typeof Fn!="string"?Yt.call(this,"file must be a string",zn):new Promise((er,rr)=>{zn=zn||function(lr,fr){lr?rr(lr):er(fr)},Ym()(Fn,(lr,fr)=>{const wr={},_r={};if(lr)return Yt.call(this,lr,zn);for(let $r=0;$r$r.read(Fr+"/"+co));return Promise.all(Vr)})(this,Ut().dirname(Fn),fr.pages).then($r=>{zn(null,{chars:wr,kernings:_r,pages:$r,common:fr.common,info:fr.info})})})})}},class:{print(Fn,zn,er,rr,lr,fr,wr){if(typeof lr=="function"&&wr===void 0&&(wr=lr,lr=1/0),lr===void 0&&(lr=1/0),typeof fr=="function"&&wr===void 0&&(wr=fr,fr=1/0),fr===void 0&&(fr=1/0),typeof Fn!="object")return Yt.call(this,"font must be a Jimp loadFont",wr);if(typeof zn!="number"||typeof er!="number"||typeof lr!="number")return Yt.call(this,"x, y and maxWidth must be numbers",wr);if(typeof lr!="number")return Yt.call(this,"maxWidth must be a number",wr);if(typeof fr!="number")return Yt.call(this,"maxHeight must be a number",wr);let _r,$r;typeof rr=="object"&&rr.text!==null&&rr.text!==void 0?(_r=rr.alignmentX||this.constructor.HORIZONTAL_ALIGN_LEFT,$r=rr.alignmentY||this.constructor.VERTICAL_ALIGN_TOP,{text:rr}=rr):(_r=this.constructor.HORIZONTAL_ALIGN_LEFT,$r=this.constructor.VERTICAL_ALIGN_TOP,rr=rr.toString()),fr!==1/0&&$r===this.constructor.VERTICAL_ALIGN_BOTTOM?er+=fr-zo(Fn,rr,lr):fr!==1/0&&$r===this.constructor.VERTICAL_ALIGN_MIDDLE&&(er+=fr/2-zo(Fn,rr,lr)/2);const Fr=Object.entries(Fn.chars)[0][1].xadvance,{lines:jr,longestLine:Vr}=jm(Fn,rr,lr);return jr.forEach(co=>{const Jr=co.join(" "),Xr=function(Kr,Qr,fo,_o,jo){return jo===Kr.HORIZONTAL_ALIGN_LEFT?0:jo===Kr.HORIZONTAL_ALIGN_CENTER?(_o-Rp(Qr,fo))/2:_o-Rp(Qr,fo)}(this.constructor,Fn,Jr,lr,_r);Xm.call(this,Fn,zn+Xr,er,Jr,Fr),er+=Fn.common.lineHeight}),qt(wr)&&wr.call(this,null,this,{x:zn+Vr,y:er}),this}}}),()=>({constants:{RESIZE_NEAREST_NEIGHBOR:"nearestNeighbor",RESIZE_BILINEAR:"bilinearInterpolation",RESIZE_BICUBIC:"bicubicInterpolation",RESIZE_HERMITE:"hermiteInterpolation",RESIZE_BEZIER:"bezierInterpolation"},class:{resize(Fn,zn,er,rr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",rr);if(typeof er=="function"&&rr===void 0&&(rr=er,er=null),Fn===this.constructor.AUTO&&zn===this.constructor.AUTO)return Yt.call(this,"w and h cannot both be set to auto",rr);if(Fn===this.constructor.AUTO&&(Fn=this.bitmap.width*(zn/this.bitmap.height)),zn===this.constructor.AUTO&&(zn=this.bitmap.height*(Fn/this.bitmap.width)),Fn<0||zn<0)return Yt.call(this,"w and h must be positive numbers",rr);if(Fn=Math.round(Fn)||1,zn=Math.round(zn)||1,typeof kp[er]=="function"){const lr={data:Um.alloc(Fn*zn*4),width:Fn,height:zn};kp[er](this.bitmap,lr),this.bitmap=lr}else{const lr=this;new Km(this.bitmap.width,this.bitmap.height,Fn,zn,!0,!0,fr=>{lr.bitmap.data=Um.from(fr),lr.bitmap.width=Fn,lr.bitmap.height=zn}).resize(this.bitmap.data)}return qt(rr)&&rr.call(this,null,this),this}}}),()=>({rotate(Fn,zn,er){return zn==null&&(zn=!0),typeof zn=="function"&&er===void 0&&(er=zn,zn=!0),typeof Fn!="number"?Yt.call(this,"deg must be a number",er):typeof zn!="boolean"&&typeof zn!="string"?Yt.call(this,"mode must be a boolean or a string",er):(Fn%90!=0||!zn&&this.bitmap.width!==this.bitmap.height&&Fn%180!=0?Dl.call(this,Fn,zn,er):Wu.call(this,Fn),qt(er)&&er.call(this,null,this),this)}}),()=>({scale(Fn,zn,er){if(typeof Fn!="number")return Yt.call(this,"f must be a number",er);if(Fn<0)return Yt.call(this,"f must be a positive number",er);typeof zn=="function"&&er===void 0&&(er=zn,zn=null);const rr=this.bitmap.width*Fn,lr=this.bitmap.height*Fn;return this.resize(rr,lr,zn),qt(er)&&er.call(this,null,this),this},scaleToFit(Fn,zn,er,rr){if(typeof Fn!="number"||typeof zn!="number")return Yt.call(this,"w and h must be numbers",rr);typeof er=="function"&&rr===void 0&&(rr=er,er=null);const lr=Fn/zn>this.bitmap.width/this.bitmap.height?zn/this.bitmap.height:Fn/this.bitmap.width;return this.scale(lr,er),qt(rr)&&rr.call(this,null,this),this}}),()=>({shadow(){let Fn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},zn=arguments.length>1?arguments[1]:void 0;typeof Fn=="function"&&(zn=Fn,Fn={});const{opacity:er=.7,size:rr=1.1,x:lr=-25,y:fr=25,blur:wr=5}=Fn,_r=this.clone(),$r=this.clone();return $r.scan(0,0,$r.bitmap.width,$r.bitmap.height,(Fr,jr,Vr)=>{$r.bitmap.data[Vr]=0,$r.bitmap.data[Vr+1]=0,$r.bitmap.data[Vr+2]=0,$r.bitmap.data[Vr+3]=$r.constructor.limit255($r.bitmap.data[Vr+3]*er),this.bitmap.data[Vr]=0,this.bitmap.data[Vr+1]=0,this.bitmap.data[Vr+2]=0,this.bitmap.data[Vr+3]=0}),$r.resize($r.bitmap.width*rr,$r.bitmap.height*rr).blur(wr),this.composite($r,lr,fr),this.composite(_r,0,0),qt(zn)&&zn.call(this,null,this),this}}),()=>({threshold(Fn,zn){let{max:er,replace:rr=255,autoGreyscale:lr=!0}=Fn;return typeof er!="number"?Yt.call(this,"max must be a number",zn):typeof rr!="number"?Yt.call(this,"replace must be a number",zn):typeof lr!="boolean"?Yt.call(this,"autoGreyscale must be a boolean",zn):(er=this.constructor.limit255(er),rr=this.constructor.limit255(rr),lr&&this.greyscale(),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(fr,wr,_r)=>{const $r=this.bitmap.data[_r]1&&arguments[1]!==void 0?arguments[1]:br;const er={hasAlpha:{},encoders:{},decoders:{},class:{},constants:{}};function rr(lr){Object.entries(lr).forEach(fr=>{let[wr,_r]=fr;er[wr]={...er[wr],..._r}})}Fn.types&&(Fn.types.forEach(function(lr){const fr=lr();Array.isArray(fr.mime)?xa(...fr.mime):Object.entries(fr.mime).forEach(wr=>xa(...wr)),delete fr.mime,rr(fr)}),zn.decoders={...zn.decoders,...er.decoders},zn.encoders={...zn.encoders,...er.encoders},zn.hasAlpha={...zn.hasAlpha,...er.hasAlpha}),Fn.plugins&&Fn.plugins.forEach(function(lr){const fr=lr(dr)||{};fr.class||fr.constants?rr(fr):rr({class:fr})}),Eu(er.class,zn),yu(er.constants,zn)})({types:[()=>(0,Ir.Ee)(_i(),eo(),{mime:{[Bo]:["bmp"]},constants:{MIME_BMP:Bo,MIME_X_MS_BMP:Mo},decoders:{[Bo]:xo,[Mo]:xo},encoders:{[Bo]:wo,[Mo]:wo}},{mime:{[fs]:["tiff","tif"]},constants:{MIME_TIFF:fs},decoders:{[fs]:Fn=>{const zn=rs().decode(Fn),er=zn[0];zn.forEach(lr=>{rs().decodeImage(Fn,lr)});const rr=rs().toRGBA8(er);return{data:xs.from(rr),width:er.t256[0],height:er.t257[0]}}},encoders:{[fs]:Fn=>{const zn=rs().encodeImage(Fn.bitmap.data,Fn.bitmap.width,Fn.bitmap.height);return xs.from(zn)}}},{mime:{[Ol]:["gif"]},constants:{MIME_GIF:Ol},decoders:{[Ol]:Fn=>{const zn=new Ds.N(Fn),er=Po.alloc(zn.width*zn.height*4);return zn.decodeAndBlitFrameRGBA(0,er),{data:er,width:zn.width,height:zn.height}}},encoders:{[Ol]:Fn=>{const zn=new ms.BitmapImage(Fn.bitmap);ms.GifUtil.quantizeDekker(zn,256);const er=new ms.GifFrame(zn);return new ms.GifCodec().encodeGif([er],{}).then(rr=>rr.buffer)}}})],plugins:[Fn=>{const zn=Lp.map(er=>{let rr=er(Fn)||{};return rr.class||rr.constants||(rr={class:rr}),rr});return(0,Ir.Ee)(...zn)}]})})()})();const _Jimp=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Jimp=typeof self<"u"&&self.Jimp||_Jimp,defaultScreenshotRenderer=_e=>jsxRuntimeExports.jsx("img",{src:_e});function Screenshot({screenshot:_e,renderScreenshot:Pt=defaultScreenshotRenderer}){const{result:Dt,loading:Nt}=useAsync(async()=>await(_e==null?void 0:_e()),[_e]);return Pt(Dt,Nt)}function Gallery({onChange:_e}){const Pt=usePaper(),[Dt]=useScreenshots(),[Nt,{set:jt,remove:Ut}]=useMap$1();reactExports.useEffect(()=>{_e==null||_e(lodashExports$1.values(Nt))},[Nt]);function Gt(Wt,qt,Yt){qt&&Yt?jt(`${Wt}`,Yt):Ut(`${Wt}`)}return useAsync(async()=>{const Wt=lodashExports$1.head(lodashExports$1.values(Dt)),qt=await(Wt==null?void 0:Wt());qt&&Gt(0,!0,qt)},[Dt]),jsxRuntimeExports.jsx(Scroll,{x:!0,py:2,children:jsxRuntimeExports.jsx(Stack$1,{direction:"row",children:lodashExports$1.values(Dt).map((Wt,qt)=>jsxRuntimeExports.jsx(Screenshot,{screenshot:Wt,renderScreenshot:(Yt,Xt)=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Box$1,{sx:{minWidth:"320px",height:"320px",flex:0,p:2,"&:not(:last-child)":{pr:1}},children:jsxRuntimeExports.jsxs(Box$1,{sx:{position:"relative",...Pt(1),height:"100%"},children:[!!Yt&&jsxRuntimeExports.jsx(Box$1,{sx:{backgroundImage:Zt=>`linear-gradient(to bottom, ${alpha(Zt.palette.background.paper,.5)}, transparent), url("${Yt}")`,width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center"}}),jsxRuntimeExports.jsx(Box$1,{sx:{position:"absolute",p:1,top:0,left:0},children:jsxRuntimeExports.jsx(FormControlLabel$1,{control:jsxRuntimeExports.jsx(Checkbox$1,{checked:!!Nt[qt],disabled:!Yt,color:"primary",sx:{ml:1},onChange:(Zt,Qt)=>Gt(qt,Qt,Yt)}),label:`Viewport ${qt+1}`})}),Xt&&jsxRuntimeExports.jsx(Box$1,{sx:{position:"absolute",m:2,top:0,right:0},children:jsxRuntimeExports.jsx(CircularProgress$1,{})})]})})})},qt))})})}function getFilename(_e=""){return lodashExports$1.kebabCase(_e.replace("*"," star "))||"untitled"}const imageSize=64;async function resizeImage(_e){const Pt=await Jimp.read(Buffer.from(_e.split(",")[1],"base64")),Dt=Pt.getWidth(){const Zt=lodashExports$1.delay(()=>{Dt(Qt=>({...Qt,workspaceMeta:Nt}))},300);return()=>clearTimeout(Zt)},[Nt,Dt],[Nt]);const{save:Ut,estimateWorkspaceSize:Gt}=useWorkspace(),Wt=useLoadingState("general"),qt=useSnackbar(),Yt=reactExports.useMemo(Gt,[]);async function Xt(Zt){return{...Nt,id:nanoid$1(),size:Zt,screenshots:await map$6((Nt==null?void 0:Nt.screenshots)??[],resizeImage),lastModified:Date.now()}}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Gallery,{onChange:Zt=>jt("screenshots",Zt)})}),jsxRuntimeExports.jsxs(Stack$1,{p:2,gap:2,children:[jsxRuntimeExports.jsx(TextField$1,{...textFieldProps,defaultValue:Nt.name,onChange:Zt=>jt("name",Zt.target.value),label:"Name",fullWidth:!0}),jsxRuntimeExports.jsx(TextField$1,{...textFieldProps,minRows:3,defaultValue:Nt.description,size:"small",onChange:Zt=>jt("description",Zt.target.value),label:"Description",fullWidth:!0,multiline:!0}),jsxRuntimeExports.jsx(TextField$1,{...textFieldProps,defaultValue:Nt.author,size:"small",onChange:Zt=>jt("author",Zt.target.value),label:"Author",fullWidth:!0,multiline:!0}),jsxRuntimeExports.jsx(Box$1,{sx:{pt:2,width:"100%"},children:jsxRuntimeExports.jsx(Button,{sx:{justifyContent:"flex-start",width:"100%",..._e(1)},onClick:()=>Wt(async()=>{const Zt=getFilename(Nt.name),{size:Qt}=await Ut(!1,Zt);download(JSON.stringify(await Xt(Qt)),`${Zt}.workspace.meta`),qt(`Metadata saved, ${Zt}.workspace.meta`)}),startIcon:jsxRuntimeExports.jsx(DownloadOutlined,{}),size:"large",children:jsxRuntimeExports.jsxs(Stack$1,{sx:{ml:1},alignItems:"baseline",children:[Nt.name||"Untitled",jsxRuntimeExports.jsxs(Type$1,{color:"text.secondary",children:[getFilename(Nt.name),".workspace"]}),jsxRuntimeExports.jsxs(Type$1,{color:"text.secondary",children:[lodashExports$1.ceil(Yt/1024/1024,2)," MB"]})]})})})]})]})}function ExportWorkspaceModal(_e){return jsxRuntimeExports.jsxs(Modal,{..._e,children:[jsxRuntimeExports.jsx(ModalAppBar,{onClose:()=>{var Pt;return(Pt=_e==null?void 0:_e.onClose)==null?void 0:Pt.call(_e,{},"backdropClick")},children:jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:"Publish Workspace"})}),jsxRuntimeExports.jsx(A$3,{})]})}function MenuEntry({startIcon:_e,endIcon:Pt,label:Dt}){return jsxRuntimeExports.jsxs(Stack$1,{direction:"row",gap:1,children:[!!_e&&reactExports.cloneElement(_e,{fontSize:"small",color:"disabled"}),jsxRuntimeExports.jsx("span",{children:Dt}),!!Pt&&reactExports.cloneElement(Pt,{fontSize:"small",color:"disabled"})]})}function useTitleBarVisible(){const[_e,Pt]=reactExports.useState(!1);return reactExports.useEffect(()=>{if("windowControlsOverlay"in navigator){const Dt=()=>{Pt(!!navigator.windowControlsOverlay.visible)};return navigator.windowControlsOverlay.addEventListener("geometrychange",Dt),Dt(),()=>navigator.windowControlsOverlay.removeEventListener("geometrychange",Dt)}},[Pt]),_e}const TitleBar=()=>{const{save:_e,load:Pt}=useWorkspace(),Dt=useTitleBarVisible(),[,Nt]=useView(),[jt,Ut]=reactExports.useState(!1);function Gt(Wt){Nt(({view:qt})=>({view:{type:"branch",orientation:Wt,key:nanoid$1(),children:[{...qt,size:80},{type:"leaf",key:nanoid$1(),content:{type:""},size:20,acceptDrop:!0}]}}))}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box$1,{sx:{mx:.5,borderBottom:Wt=>`1px solid ${Wt.palette.background.default}`,minHeight:36,height:Dt?"env(titlebar-area-height, 50px)":0,width:"env(titlebar-area-width, 100%)",WebkitAppRegion:"drag",overflowX:"auto"},children:jsxRuntimeExports.jsx(Scroll,{x:!0,style:{height:"100%"},children:jsxRuntimeExports.jsx(Box$1,{sx:{height:"100%"},children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",spacing:1,sx:{height:"100%"},alignItems:"center",justifyContent:"flex-start",children:[jsxRuntimeExports.jsx(Box$1,{sx:{p:1,height:"100%",maxWidth:"min-content"},children:jsxRuntimeExports.jsx("img",{src:logo,style:{height:"100%"}})}),[{key:"view",items:[{type:"action",key:"panel-new-right",name:"Add panel to the right",action:()=>Gt("horizontal")},{type:"action",key:"panel-new-bottom",name:"Add panel below",action:()=>Gt("vertical")},{type:"divider"},{type:"action",name:"Reset layout",key:"panel-reset",action:()=>Nt(getDefaultViewTree)}]},{key:"workspace",items:[{type:"action",name:"Open workspace",key:"workspace-load",action:Pt},{type:"action",name:"Save workspace",key:"workspace-save",action:_e},{type:"action",name:jsxRuntimeExports.jsx(MenuEntry,{label:"Publish workspace",endIcon:jsxRuntimeExports.jsx(OpenInNewOutlined,{})}),key:"workspace-save-metadata",action:()=>Ut(!0)}]},{key:"help",items:[{type:"action",name:"Open repository in GitHub",key:"github",action:()=>open(repository,"_blank")},{type:"action",name:"Changelog",key:"changelog",action:()=>open(`${docs}/changelog-${version}.md`,"_blank")},{type:"action",name:"Documentation",key:"documentation",action:()=>open("https://path-visualiser.github.io/docs/overview/","_blank")}]}].map(({key:Wt,items:qt})=>jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Yt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Menu$1,{...bindMenu(Yt),children:jsxRuntimeExports.jsx(MenuList$1,{dense:!0,sx:{p:0},children:qt.map((Xt,Zt)=>{if(Xt.type==="action"){const{name:Qt,key:en,action:tn}=Xt;return jsxRuntimeExports.jsx(MenuItem$1,{onClick:()=>{tn==null||tn(),Yt.close()},children:Qt},en)}else return jsxRuntimeExports.jsx(Divider$1,{},Zt)})})}),jsxRuntimeExports.jsx(FeaturePickerButton,{...bindTrigger(Yt),sx:{WebkitAppRegion:"no-drag",minWidth:"fit-content",p:.5,px:1},children:lodashExports$1.startCase(Wt)})]})},Wt))]})})})}),jsxRuntimeExports.jsx(ExportWorkspaceModal,{open:jt,onClose:()=>Ut(!1)})]})};function AppBarTitle({children:_e}){return jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:_e})}function ModalAppBar({onClose:_e=()=>{},style:Pt,elevatedStyle:Dt,children:Nt,transitionProperties:jt=["box-shadow","background","border-bottom"],elevatedChildren:Ut,simple:Gt,position:Wt="sticky"}){const qt=useSmallDisplay(),Yt=usePanel(),Xt=useTheme(),[,,Zt,,Qt]=useScrollState();reactExports.useEffect(()=>{Qt(Yt)},[Yt,Qt]);const en=Zt?{background:qt?Xt.palette.background.default:Xt.palette.background.paper,...!Gt&&{boxShadow:Xt.shadows[0]},...Pt}:{background:qt?Xt.palette.background.default:Xt.palette.background.paper,...!Gt&&{boxShadow:Xt.shadows[4]},...Dt};function tn(nn){return typeof nn=="string"?jsxRuntimeExports.jsx(AppBarTitle,{children:nn}):nn}return jsxRuntimeExports.jsx(AppBar$1,{elevation:0,position:Wt,style:{color:Xt.palette.text.primary,transition:Xt.transitions.create(jt),...en},children:jsxRuntimeExports.jsxs(Toolbar$1,{children:[jsxRuntimeExports.jsx(IconButton$1,{style:{marginRight:Xt.spacing(1)},"aria-label":"open drawer",edge:"start",onClick:()=>_e(),children:jsxRuntimeExports.jsx(ArrowBack,{})}),Nt&&jsxRuntimeExports.jsx("div",{style:{gridColumn:1,gridRow:1,flex:1,overflow:"auto"},children:jsxRuntimeExports.jsx(Fade$1,{in:!!(!Ut||Zt),mountOnEnter:!0,unmountOnExit:!0,children:jsxRuntimeExports.jsx(Box$1,{style:{width:"100%"},children:tn(Nt)})})}),Ut&&jsxRuntimeExports.jsx("div",{style:{gridColumn:1,gridRow:1,flex:1,overflow:"auto"},children:jsxRuntimeExports.jsx(Fade$1,{in:!!(Ut&&!Zt),mountOnEnter:!0,unmountOnExit:!0,children:jsxRuntimeExports.jsx(Box$1,{style:{width:"100%"},children:tn(Ut)})})})]})})}function Modal({children:_e,actions:Pt,width:Dt=480,height:Nt,variant:jt="default",scrollable:Ut=!0,...Gt}){var mn;const[Wt,qt]=reactExports.useState(void 0);reactExports.useEffect(()=>{_e&&qt(_e)},[_e]);const Yt=useTheme(),Xt=useSmallDisplay(),[Zt,Qt]=reactExports.useState(null),[en,tn]=reactExports.useState(null),[nn,rn]=reactExports.useState(!1),[an,sn]=reactExports.useState(0),ln=useTitleBarVisible();reactExports.useEffect(()=>{if(Zt&&en&&!Xt&&!Nt){const gn=()=>{const hn=window.innerHeight-64{window.removeEventListener("resize",gn),un.detach()}}},[Zt,en,Xt,Nt]);const dn=jt==="submodal"&&Xt;return jsxRuntimeExports.jsxs(Dialog$1,{fullScreen:Xt,...Gt,keepMounted:!1,TransitionProps:{unmountOnExit:!0,mountOnEnter:!0},style:{...dn&&{paddingTop:Yt.spacing(8)},...Gt.style},PaperProps:{ref:gn=>Qt(gn),style:{...dn&&{borderRadius:`${Yt.shape.borderRadius}px ${Yt.shape.borderRadius}px 0 0`},background:Xt?Yt.palette.background.default:Yt.palette.background.paper,overflow:"hidden",height:Nt&&!Xt?Nt:nn||Xt?"100%":an||"fit-content",position:"relative",maxWidth:"none",...Xt&&ln&&{paddingTop:36},...(mn=Gt.PaperProps)==null?void 0:mn.style},...Gt.PaperProps},children:[jsxRuntimeExports.jsx(Scroll,{y:!0,style:{height:"100%",width:Xt?void 0:Dt,maxWidth:"100%",overflow:Ut?void 0:"hidden"},children:jsxRuntimeExports.jsx("div",{ref:gn=>tn(gn),style:{width:"100%"},children:Wt})}),Pt]})}function ManagedModal({appBar:_e,trigger:Pt=()=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}),children:Dt,popover:Nt,slotProps:jt}){const Ut=usePaper(),Gt=useAcrylic(),Wt=useSmallDisplay(),qt=Nt&&!Wt;return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Yt=>{var en,tn;const{open:Xt,close:Zt,isOpen:Qt}=Yt;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[reactExports.cloneElement(Pt(Xt,Qt)),qt?jsxRuntimeExports.jsx(Popover$1,{...lodashExports$1.merge(bindPopover(Yt),{slotProps:{paper:{sx:{...Gt}}}},jt==null?void 0:jt.popover),children:jsxRuntimeExports.jsx(Box$1,{...lodashExports$1.merge({sx:{width:360,...Ut(1)}},jt==null?void 0:jt.paper),children:Dt??((en=jt==null?void 0:jt.modal)==null?void 0:en.children)})}):jsxRuntimeExports.jsxs(Modal,{open:Qt,onClose:Zt,...jt==null?void 0:jt.modal,children:[jsxRuntimeExports.jsx(ModalAppBar,{onClose:Zt,..._e}),Dt??((tn=jt==null?void 0:jt.modal)==null?void 0:tn.children)]})]})}})}var rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote$1(_e){return rx_escapable.lastIndex=0,rx_escapable.test(_e)?'"'+_e.replace(rx_escapable,function(Pt){var Dt=meta[Pt];return typeof Dt=="string"?Dt:"\\u"+("0000"+Pt.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+_e+'"'}function str$1(_e,Pt,Dt){var Nt,jt,Ut,Gt,Wt=gap,qt,Yt=Pt[_e];switch(Yt&&typeof Yt=="object"&&typeof Yt.toJSON=="function"&&(Yt=Yt.toJSON(_e)),typeof rep=="function"&&(Yt=rep.call(Pt,_e,Yt)),typeof Yt){case"string":return quote$1(Yt);case"number":return isFinite(Yt)?String(Yt):"null";case"boolean":case"null":return String(Yt);case"object":if(!Yt)return"null";if(gap+=indent,qt=[],Object.prototype.toString.apply(Yt)==="[object Array]"){for(Gt=Yt.length,Nt=0;NtDt?`[ `+gap+qt.join(`, `+gap)+` `+Wt+"]":"[ "+qt.join(", ")+" ]":"["+qt.join(",")+"]",gap=Wt,Ut}if(rep&&typeof rep=="object")for(Gt=rep.length,Nt=0;NtDt?`{ diff --git a/index.html b/index.html index 969115cc..43f9e56c 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ - +