@dilemmagx/palette 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +10518 -0
- package/dist/core.d.ts +81 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +7 -0
- package/package.json +45 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";var Va=Object.create;var kt=Object.defineProperty;var Wa=Object.getOwnPropertyDescriptor;var Xa=Object.getOwnPropertyNames;var Ya=Object.getPrototypeOf,Ja=Object.prototype.hasOwnProperty;var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ka=(e,t)=>{for(var r in t)kt(e,r,{get:t[r],enumerable:!0})},rn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xa(t))!Ja.call(e,i)&&i!==r&&kt(e,i,{get:()=>t[i],enumerable:!(n=Wa(t,i))||n.enumerable});return e};var nr=(e,t,r)=>(r=e!=null?Va(Ya(e)):{},rn(t||!e||!e.__esModule?kt(r,"default",{value:e,enumerable:!0}):r,e)),Qa=e=>rn(kt({},"__esModule",{value:!0}),e);var we=D((V0,an)=>{var nn=e=>typeof e<"u"&&e!==null,Za=e=>typeof e=="object",eo=e=>Object.prototype.toString.call(e)==="[object Object]",to=e=>typeof e=="function",ro=e=>typeof e=="boolean",no=e=>e instanceof Buffer,io=e=>{if(nn(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},ao=e=>e instanceof ArrayBuffer,oo=e=>typeof e=="string"&&e.length>0,so=e=>typeof e=="number"&&!Number.isNaN(e),lo=e=>Number.isInteger(e),co=(e,t,r)=>e>=t&&e<=r,ho=(e,t)=>t.includes(e),uo=(e,t,r)=>new Error(`Expected ${t} for ${e} but received ${r} of type ${typeof r}`),fo=(e,t)=>(t.message=e.message,t);an.exports={defined:nn,object:Za,plainObject:eo,fn:to,bool:ro,buffer:no,typedArray:io,arrayBuffer:ao,string:oo,number:so,integer:lo,inRange:co,inArray:ho,invalidParameterError:uo,nativeError:fo}});var ln=D((W0,sn)=>{"use strict";var on=()=>process.platform==="linux",Ct=null,mo=()=>{if(!Ct)if(on()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,Ct=process.report.getReport(),process.report.excludeNetwork=e}else Ct={};return Ct};sn.exports={isLinux:on,getReport:mo}});var hn=D((X0,cn)=>{"use strict";var We=require("fs"),go="/usr/bin/ldd",po="/proc/self/exe",Rt=2048,bo=e=>{let t=We.openSync(e,"r"),r=Buffer.alloc(Rt),n=We.readSync(t,r,0,Rt,0);return We.close(t,()=>{}),r.subarray(0,n)},yo=e=>new Promise((t,r)=>{We.open(e,"r",(n,i)=>{if(n)r(n);else{let a=Buffer.alloc(Rt);We.read(i,a,0,Rt,0,(o,l)=>{t(a.subarray(0,l)),We.close(i,()=>{})})}})});cn.exports={LDD_PATH:go,SELF_PATH:po,readFileSync:bo,readFile:yo}});var fn=D((Y0,un)=>{"use strict";var wo=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let i=0;i<n;i++){let a=t+i*r;if(e.readUInt32LE(a)===3){let l=e.readUInt32LE(a+8),c=e.readUInt32LE(a+32);return e.subarray(l,l+c).toString().replace(/\0.*$/g,"")}}return null};un.exports={interpreterPath:wo}});var Mt=D((J0,Mn)=>{"use strict";var dn=require("child_process"),{isLinux:Xe,getReport:gn}=ln(),{LDD_PATH:St,SELF_PATH:pn,readFile:ir,readFileSync:ar}=hn(),{interpreterPath:bn}=fn(),Ee,Pe,ve,yn="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",De="",wn=()=>De||new Promise(e=>{dn.exec(yn,(t,r)=>{De=t?" ":r,e(De)})}),En=()=>{if(!De)try{De=dn.execSync(yn,{encoding:"utf8"})}catch{De=" "}return De},Re="glibc",Pn=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,Ne="musl",Eo=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),vn=()=>{let e=gn();return e.header&&e.header.glibcVersionRuntime?Re:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(Eo)?Ne:null},xn=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(Re)?Re:r&&r.includes(Ne)?Ne:null},An=e=>{if(e){if(e.includes("/ld-musl-"))return Ne;if(e.includes("/ld-linux-"))return Re}return null},In=e=>(e=e.toString(),e.includes("musl")?Ne:e.includes("GNU C Library")?Re:null),Po=async()=>{if(Pe!==void 0)return Pe;Pe=null;try{let e=await ir(St);Pe=In(e)}catch{}return Pe},vo=()=>{if(Pe!==void 0)return Pe;Pe=null;try{let e=ar(St);Pe=In(e)}catch{}return Pe},xo=async()=>{if(Ee!==void 0)return Ee;Ee=null;try{let e=await ir(pn),t=bn(e);Ee=An(t)}catch{}return Ee},Ao=()=>{if(Ee!==void 0)return Ee;Ee=null;try{let e=ar(pn),t=bn(e);Ee=An(t)}catch{}return Ee},kn=async()=>{let e=null;if(Xe()&&(e=await xo(),!e&&(e=await Po(),e||(e=vn()),!e))){let t=await wn();e=xn(t)}return e},Cn=()=>{let e=null;if(Xe()&&(e=Ao(),!e&&(e=vo(),e||(e=vn()),!e))){let t=En();e=xn(t)}return e},Io=async()=>Xe()&&await kn()!==Re,ko=()=>Xe()&&Cn()!==Re,Co=async()=>{if(ve!==void 0)return ve;ve=null;try{let t=(await ir(St)).match(Pn);t&&(ve=t[1])}catch{}return ve},Ro=()=>{if(ve!==void 0)return ve;ve=null;try{let t=ar(St).match(Pn);t&&(ve=t[1])}catch{}return ve},Rn=()=>{let e=gn();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},mn=e=>e.trim().split(/\s+/)[1],Sn=e=>{let[t,r,n]=e.split(/[\r\n]+/);return t&&t.includes(Re)?mn(t):r&&n&&r.includes(Ne)?mn(n):null},So=async()=>{let e=null;if(Xe()&&(e=await Co(),e||(e=Rn()),!e)){let t=await wn();e=Sn(t)}return e},Mo=()=>{let e=null;if(Xe()&&(e=Ro(),e||(e=Rn()),!e)){let t=En();e=Sn(t)}return e};Mn.exports={GLIBC:Re,MUSL:Ne,family:kn,familySync:Cn,isNonGlibcLinux:Io,isNonGlibcLinuxSync:ko,version:So,versionSync:Mo}});var ht=D((K0,Tn)=>{"use strict";var To=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Tn.exports=To});var Tt=D((Q0,Ln)=>{"use strict";var Lo="2.0.0",Do=Number.MAX_SAFE_INTEGER||9007199254740991,Fo=16,Bo=250,jo=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ln.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Fo,MAX_SAFE_BUILD_LENGTH:Bo,MAX_SAFE_INTEGER:Do,RELEASE_TYPES:jo,SEMVER_SPEC_VERSION:Lo,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ut=D((xe,Dn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:or,MAX_SAFE_BUILD_LENGTH:$o,MAX_LENGTH:No}=Tt(),Oo=ht();xe=Dn.exports={};var Ho=xe.re=[],qo=xe.safeRe=[],P=xe.src=[],_o=xe.safeSrc=[],v=xe.t={},zo=0,sr="[a-zA-Z0-9-]",Uo=[["\\s",1],["\\d",No],[sr,$o]],Go=e=>{for(let[t,r]of Uo)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},L=(e,t,r)=>{let n=Go(t),i=zo++;Oo(e,i,t),v[e]=i,P[i]=t,_o[i]=n,Ho[i]=new RegExp(t,r?"g":void 0),qo[i]=new RegExp(n,r?"g":void 0)};L("NUMERICIDENTIFIER","0|[1-9]\\d*");L("NUMERICIDENTIFIERLOOSE","\\d+");L("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${sr}*`);L("MAINVERSION",`(${P[v.NUMERICIDENTIFIER]})\\.(${P[v.NUMERICIDENTIFIER]})\\.(${P[v.NUMERICIDENTIFIER]})`);L("MAINVERSIONLOOSE",`(${P[v.NUMERICIDENTIFIERLOOSE]})\\.(${P[v.NUMERICIDENTIFIERLOOSE]})\\.(${P[v.NUMERICIDENTIFIERLOOSE]})`);L("PRERELEASEIDENTIFIER",`(?:${P[v.NONNUMERICIDENTIFIER]}|${P[v.NUMERICIDENTIFIER]})`);L("PRERELEASEIDENTIFIERLOOSE",`(?:${P[v.NONNUMERICIDENTIFIER]}|${P[v.NUMERICIDENTIFIERLOOSE]})`);L("PRERELEASE",`(?:-(${P[v.PRERELEASEIDENTIFIER]}(?:\\.${P[v.PRERELEASEIDENTIFIER]})*))`);L("PRERELEASELOOSE",`(?:-?(${P[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${P[v.PRERELEASEIDENTIFIERLOOSE]})*))`);L("BUILDIDENTIFIER",`${sr}+`);L("BUILD",`(?:\\+(${P[v.BUILDIDENTIFIER]}(?:\\.${P[v.BUILDIDENTIFIER]})*))`);L("FULLPLAIN",`v?${P[v.MAINVERSION]}${P[v.PRERELEASE]}?${P[v.BUILD]}?`);L("FULL",`^${P[v.FULLPLAIN]}$`);L("LOOSEPLAIN",`[v=\\s]*${P[v.MAINVERSIONLOOSE]}${P[v.PRERELEASELOOSE]}?${P[v.BUILD]}?`);L("LOOSE",`^${P[v.LOOSEPLAIN]}$`);L("GTLT","((?:<|>)?=?)");L("XRANGEIDENTIFIERLOOSE",`${P[v.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);L("XRANGEIDENTIFIER",`${P[v.NUMERICIDENTIFIER]}|x|X|\\*`);L("XRANGEPLAIN",`[v=\\s]*(${P[v.XRANGEIDENTIFIER]})(?:\\.(${P[v.XRANGEIDENTIFIER]})(?:\\.(${P[v.XRANGEIDENTIFIER]})(?:${P[v.PRERELEASE]})?${P[v.BUILD]}?)?)?`);L("XRANGEPLAINLOOSE",`[v=\\s]*(${P[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${P[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${P[v.XRANGEIDENTIFIERLOOSE]})(?:${P[v.PRERELEASELOOSE]})?${P[v.BUILD]}?)?)?`);L("XRANGE",`^${P[v.GTLT]}\\s*${P[v.XRANGEPLAIN]}$`);L("XRANGELOOSE",`^${P[v.GTLT]}\\s*${P[v.XRANGEPLAINLOOSE]}$`);L("COERCEPLAIN",`(^|[^\\d])(\\d{1,${or}})(?:\\.(\\d{1,${or}}))?(?:\\.(\\d{1,${or}}))?`);L("COERCE",`${P[v.COERCEPLAIN]}(?:$|[^\\d])`);L("COERCEFULL",P[v.COERCEPLAIN]+`(?:${P[v.PRERELEASE]})?(?:${P[v.BUILD]})?(?:$|[^\\d])`);L("COERCERTL",P[v.COERCE],!0);L("COERCERTLFULL",P[v.COERCEFULL],!0);L("LONETILDE","(?:~>?)");L("TILDETRIM",`(\\s*)${P[v.LONETILDE]}\\s+`,!0);xe.tildeTrimReplace="$1~";L("TILDE",`^${P[v.LONETILDE]}${P[v.XRANGEPLAIN]}$`);L("TILDELOOSE",`^${P[v.LONETILDE]}${P[v.XRANGEPLAINLOOSE]}$`);L("LONECARET","(?:\\^)");L("CARETTRIM",`(\\s*)${P[v.LONECARET]}\\s+`,!0);xe.caretTrimReplace="$1^";L("CARET",`^${P[v.LONECARET]}${P[v.XRANGEPLAIN]}$`);L("CARETLOOSE",`^${P[v.LONECARET]}${P[v.XRANGEPLAINLOOSE]}$`);L("COMPARATORLOOSE",`^${P[v.GTLT]}\\s*(${P[v.LOOSEPLAIN]})$|^$`);L("COMPARATOR",`^${P[v.GTLT]}\\s*(${P[v.FULLPLAIN]})$|^$`);L("COMPARATORTRIM",`(\\s*)${P[v.GTLT]}\\s*(${P[v.LOOSEPLAIN]}|${P[v.XRANGEPLAIN]})`,!0);xe.comparatorTrimReplace="$1$2$3";L("HYPHENRANGE",`^\\s*(${P[v.XRANGEPLAIN]})\\s+-\\s+(${P[v.XRANGEPLAIN]})\\s*$`);L("HYPHENRANGELOOSE",`^\\s*(${P[v.XRANGEPLAINLOOSE]})\\s+-\\s+(${P[v.XRANGEPLAINLOOSE]})\\s*$`);L("STAR","(<|>)?=?\\s*\\*");L("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");L("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Lt=D((Z0,Fn)=>{"use strict";var Vo=Object.freeze({loose:!0}),Wo=Object.freeze({}),Xo=e=>e?typeof e!="object"?Vo:e:Wo;Fn.exports=Xo});var Nn=D((eh,$n)=>{"use strict";var Bn=/^[0-9]+$/,jn=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=Bn.test(e),n=Bn.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},Yo=(e,t)=>jn(t,e);$n.exports={compareIdentifiers:jn,rcompareIdentifiers:Yo}});var Ye=D((th,Hn)=>{"use strict";var Dt=ht(),{MAX_LENGTH:On,MAX_SAFE_INTEGER:Ft}=Tt(),{safeRe:Bt,t:jt}=ut(),Jo=Lt(),{compareIdentifiers:lr}=Nn(),cr=class e{constructor(t,r){if(r=Jo(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>On)throw new TypeError(`version is longer than ${On} characters`);Dt("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?Bt[jt.LOOSE]:Bt[jt.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ft||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ft||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ft||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let a=+i;if(a>=0&&a<Ft)return a}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Dt("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=t.prerelease[r];if(Dt("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return lr(n,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],i=t.build[r];if(Dt("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return lr(n,i)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?Bt[jt.PRERELEASELOOSE]:Bt[jt.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let a=this.prerelease.length;for(;--a>=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);if(a===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let a=[r,i];n===!1&&(a=[r]),lr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Hn.exports=cr});var zn=D((rh,_n)=>{"use strict";var qn=Ye(),Ko=(e,t,r=!1)=>{if(e instanceof qn)return e;try{return new qn(e,t)}catch(n){if(!r)return null;throw n}};_n.exports=Ko});var Gn=D((nh,Un)=>{"use strict";var Qo=Ye(),Zo=zn(),{safeRe:$t,t:Nt}=ut(),es=(e,t)=>{if(e instanceof Qo)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?$t[Nt.COERCEFULL]:$t[Nt.COERCE]);else{let c=t.includePrerelease?$t[Nt.COERCERTLFULL]:$t[Nt.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",a=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",l=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Zo(`${n}.${i}.${a}${o}${l}`,t)};Un.exports=es});var Oe=D((ih,Wn)=>{"use strict";var Vn=Ye(),ts=(e,t,r)=>new Vn(e,r).compare(new Vn(t,r));Wn.exports=ts});var hr=D((ah,Xn)=>{"use strict";var rs=Oe(),ns=(e,t,r)=>rs(e,t,r)>=0;Xn.exports=ns});var Jn=D((oh,Yn)=>{"use strict";var ur=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};Yn.exports=ur});var Qn=D((sh,Kn)=>{"use strict";var is=Oe(),as=(e,t,r)=>is(e,t,r)===0;Kn.exports=as});var ei=D((lh,Zn)=>{"use strict";var os=Oe(),ss=(e,t,r)=>os(e,t,r)!==0;Zn.exports=ss});var ri=D((ch,ti)=>{"use strict";var ls=Oe(),cs=(e,t,r)=>ls(e,t,r)>0;ti.exports=cs});var ii=D((hh,ni)=>{"use strict";var hs=Oe(),us=(e,t,r)=>hs(e,t,r)<0;ni.exports=us});var oi=D((uh,ai)=>{"use strict";var fs=Oe(),ms=(e,t,r)=>fs(e,t,r)<=0;ai.exports=ms});var li=D((fh,si)=>{"use strict";var ds=Qn(),gs=ei(),ps=ri(),bs=hr(),ys=ii(),ws=oi(),Es=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return ds(e,r,n);case"!=":return gs(e,r,n);case">":return ps(e,r,n);case">=":return bs(e,r,n);case"<":return ys(e,r,n);case"<=":return ws(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};si.exports=Es});var gi=D((mh,di)=>{"use strict";var ft=Symbol("SemVer ANY"),dr=class e{static get ANY(){return ft}constructor(t,r){if(r=ci(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),mr("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===ft?this.value="":this.value=this.operator+this.semver.version,mr("comp",this)}parse(t){let r=this.options.loose?hi[ui.COMPARATORLOOSE]:hi[ui.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new fi(n[2],this.options.loose):this.semver=ft}toString(){return this.value}test(t){if(mr("Comparator.test",t,this.options.loose),this.semver===ft||t===ft)return!0;if(typeof t=="string")try{t=new fi(t,this.options)}catch{return!1}return fr(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new mi(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new mi(this.value,r).test(t.semver):(r=ci(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||fr(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||fr(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};di.exports=dr;var ci=Lt(),{safeRe:hi,t:ui}=ut(),fr=li(),mr=ht(),fi=Ye(),mi=gr()});var gr=D((dh,wi)=>{"use strict";var Ps=/\s+/g,pr=class e{constructor(t,r){if(r=xs(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof br)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Ps," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!bi(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Ms(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let n=((this.options.includePrerelease&&Rs)|(this.options.loose&&Ss))+":"+t,i=pi.get(n);if(i)return i;let a=this.options.loose,o=a?ee[K.HYPHENRANGELOOSE]:ee[K.HYPHENRANGE];t=t.replace(o,Hs(this.options.includePrerelease)),q("hyphen replace",t),t=t.replace(ee[K.COMPARATORTRIM],Is),q("comparator trim",t),t=t.replace(ee[K.TILDETRIM],ks),q("tilde trim",t),t=t.replace(ee[K.CARETTRIM],Cs),q("caret trim",t);let l=t.split(" ").map(g=>Ts(g,this.options)).join(" ").split(/\s+/).map(g=>Os(g,this.options));a&&(l=l.filter(g=>(q("loose invalid filter",g,this.options),!!g.match(ee[K.COMPARATORLOOSE])))),q("range list",l);let c=new Map,f=l.map(g=>new br(g,this.options));for(let g of f){if(bi(g))return[g];c.set(g.value,g)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return pi.set(n,d),d}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>yi(n,r)&&t.set.some(i=>yi(i,r)&&n.every(a=>i.every(o=>a.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new As(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(qs(this.set[r],t,this.options))return!0;return!1}};wi.exports=pr;var vs=Jn(),pi=new vs,xs=Lt(),br=gi(),q=ht(),As=Ye(),{safeRe:ee,t:K,comparatorTrimReplace:Is,tildeTrimReplace:ks,caretTrimReplace:Cs}=ut(),{FLAG_INCLUDE_PRERELEASE:Rs,FLAG_LOOSE:Ss}=Tt(),bi=e=>e.value==="<0.0.0-0",Ms=e=>e.value==="",yi=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every(a=>i.intersects(a,t)),i=n.pop();return r},Ts=(e,t)=>(e=e.replace(ee[K.BUILD],""),q("comp",e,t),e=Fs(e,t),q("caret",e),e=Ls(e,t),q("tildes",e),e=js(e,t),q("xrange",e),e=Ns(e,t),q("stars",e),e),te=e=>!e||e.toLowerCase()==="x"||e==="*",Ls=(e,t)=>e.trim().split(/\s+/).map(r=>Ds(r,t)).join(" "),Ds=(e,t)=>{let r=t.loose?ee[K.TILDELOOSE]:ee[K.TILDE];return e.replace(r,(n,i,a,o,l)=>{q("tilde",e,n,i,a,o,l);let c;return te(i)?c="":te(a)?c=`>=${i}.0.0 <${+i+1}.0.0-0`:te(o)?c=`>=${i}.${a}.0 <${i}.${+a+1}.0-0`:l?(q("replaceTilde pr",l),c=`>=${i}.${a}.${o}-${l} <${i}.${+a+1}.0-0`):c=`>=${i}.${a}.${o} <${i}.${+a+1}.0-0`,q("tilde return",c),c})},Fs=(e,t)=>e.trim().split(/\s+/).map(r=>Bs(r,t)).join(" "),Bs=(e,t)=>{q("caret",e,t);let r=t.loose?ee[K.CARETLOOSE]:ee[K.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,a,o,l,c)=>{q("caret",e,i,a,o,l,c);let f;return te(a)?f="":te(o)?f=`>=${a}.0.0${n} <${+a+1}.0.0-0`:te(l)?a==="0"?f=`>=${a}.${o}.0${n} <${a}.${+o+1}.0-0`:f=`>=${a}.${o}.0${n} <${+a+1}.0.0-0`:c?(q("replaceCaret pr",c),a==="0"?o==="0"?f=`>=${a}.${o}.${l}-${c} <${a}.${o}.${+l+1}-0`:f=`>=${a}.${o}.${l}-${c} <${a}.${+o+1}.0-0`:f=`>=${a}.${o}.${l}-${c} <${+a+1}.0.0-0`):(q("no pr"),a==="0"?o==="0"?f=`>=${a}.${o}.${l}${n} <${a}.${o}.${+l+1}-0`:f=`>=${a}.${o}.${l}${n} <${a}.${+o+1}.0-0`:f=`>=${a}.${o}.${l} <${+a+1}.0.0-0`),q("caret return",f),f})},js=(e,t)=>(q("replaceXRanges",e,t),e.split(/\s+/).map(r=>$s(r,t)).join(" ")),$s=(e,t)=>{e=e.trim();let r=t.loose?ee[K.XRANGELOOSE]:ee[K.XRANGE];return e.replace(r,(n,i,a,o,l,c)=>{q("xRange",e,n,i,a,o,l,c);let f=te(a),d=f||te(o),g=d||te(l),b=g;return i==="="&&b&&(i=""),c=t.includePrerelease?"-0":"",f?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&b?(d&&(o=0),l=0,i===">"?(i=">=",d?(a=+a+1,o=0,l=0):(o=+o+1,l=0)):i==="<="&&(i="<",d?a=+a+1:o=+o+1),i==="<"&&(c="-0"),n=`${i+a}.${o}.${l}${c}`):d?n=`>=${a}.0.0${c} <${+a+1}.0.0-0`:g&&(n=`>=${a}.${o}.0${c} <${a}.${+o+1}.0-0`),q("xRange return",n),n})},Ns=(e,t)=>(q("replaceStars",e,t),e.trim().replace(ee[K.STAR],"")),Os=(e,t)=>(q("replaceGTE0",e,t),e.trim().replace(ee[t.includePrerelease?K.GTE0PRE:K.GTE0],"")),Hs=e=>(t,r,n,i,a,o,l,c,f,d,g,b)=>(te(n)?r="":te(i)?r=`>=${n}.0.0${e?"-0":""}`:te(a)?r=`>=${n}.${i}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,te(f)?c="":te(d)?c=`<${+f+1}.0.0-0`:te(g)?c=`<${f}.${+d+1}.0-0`:b?c=`<=${f}.${d}.${g}-${b}`:e?c=`<${f}.${d}.${+g+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),qs=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++)if(q(e[n].semver),e[n].semver!==br.ANY&&e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}});var Pi=D((gh,Ei)=>{"use strict";var _s=gr(),zs=(e,t,r)=>{try{t=new _s(t,r)}catch{return!1}return t.test(e)};Ei.exports=zs});var yr=D((ph,Us)=>{Us.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.34.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unneb\xE4ck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix B\xFCnemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","J\xE9r\xE9my Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kot\u011B\u0161ovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouci\xF1o <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugu\xE9 <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>"],scripts:{build:"node install/build.js",install:"node install/check.js || npm run build",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-types":"tsd --files ./test/types/sharp.test-d.ts","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.0.0","detect-libc":"^2.1.2",semver:"^7.7.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.5","@img/sharp-darwin-x64":"0.34.5","@img/sharp-libvips-darwin-arm64":"1.2.4","@img/sharp-libvips-darwin-x64":"1.2.4","@img/sharp-libvips-linux-arm":"1.2.4","@img/sharp-libvips-linux-arm64":"1.2.4","@img/sharp-libvips-linux-ppc64":"1.2.4","@img/sharp-libvips-linux-riscv64":"1.2.4","@img/sharp-libvips-linux-s390x":"1.2.4","@img/sharp-libvips-linux-x64":"1.2.4","@img/sharp-libvips-linuxmusl-arm64":"1.2.4","@img/sharp-libvips-linuxmusl-x64":"1.2.4","@img/sharp-linux-arm":"0.34.5","@img/sharp-linux-arm64":"0.34.5","@img/sharp-linux-ppc64":"0.34.5","@img/sharp-linux-riscv64":"0.34.5","@img/sharp-linux-s390x":"0.34.5","@img/sharp-linux-x64":"0.34.5","@img/sharp-linuxmusl-arm64":"0.34.5","@img/sharp-linuxmusl-x64":"0.34.5","@img/sharp-wasm32":"0.34.5","@img/sharp-win32-arm64":"0.34.5","@img/sharp-win32-ia32":"0.34.5","@img/sharp-win32-x64":"0.34.5"},devDependencies:{"@biomejs/biome":"^2.3.4","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.7.0","@img/sharp-libvips-dev":"1.2.4","@img/sharp-libvips-dev-wasm32":"1.2.4","@img/sharp-libvips-win32-arm64":"1.2.4","@img/sharp-libvips-win32-ia32":"1.2.4","@img/sharp-libvips-win32-x64":"1.2.4","@types/node":"*",emnapi:"^1.7.0","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.3","node-addon-api":"^8.5.0","node-gyp":"^11.5.0","tar-fs":"^3.1.1",tsd:"^0.33.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.17.3"},funding:{url:"https://opencollective.com/libvips"}}});var Er=D((bh,Ti)=>{var{spawnSync:Ot}=require("node:child_process"),{createHash:Gs}=require("node:crypto"),Ii=Gn(),Vs=hr(),Ws=Pi(),vi=Mt(),{config:Xs,engines:xi,optionalDependencies:Ys}=yr(),Js=process.env.npm_package_config_libvips||Xs.libvips,ki=Ii(Js).version,Ks=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],Ht={encoding:"utf8",shell:!0},Qs=e=>{e instanceof Error?console.error(`sharp: Installation error: ${e.message}`):console.log(`sharp: ${e}`)},Ci=()=>vi.isNonGlibcLinuxSync()?vi.familySync():"",Zs=()=>`${process.platform}${Ci()}-${process.arch}`,Je=()=>{if(Ri())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r=="string"?r:Ci();return`${t||process.platform}${n}-${e||process.arch}`},el=()=>{try{return require(`@img/sharp-libvips-dev-${Je()}/include`)}catch{try{return require("@img/sharp-libvips-dev/include")}catch{}}return""},tl=()=>{try{return require("@img/sharp-libvips-dev/cplusplus")}catch{}return""},rl=()=>{try{return require(`@img/sharp-libvips-dev-${Je()}/lib`)}catch{try{return require(`@img/sharp-libvips-${Je()}/lib`)}catch{}}return""},nl=()=>{if(process.release?.name==="node"&&process.versions&&!Ws(process.versions.node,xi.node))return{found:process.versions.node,expected:xi.node}},Ri=()=>{let{CC:e}=process.env;return!!e?.endsWith("/emcc")},il=()=>process.platform==="darwin"&&process.arch==="x64"?(Ot("sysctl sysctl.proc_translated",Ht).stdout||"").trim()==="sysctl.proc_translated: 1":!1,Ai=e=>Gs("sha512").update(e).digest("hex"),al=()=>{try{let e=Ai(`imgsharp-libvips-${Je()}`),t=Ii(Ys[`@img/sharp-libvips-${Je()}`],{includePrerelease:!0}).version;return Ai(`${e}npm:${t}`).slice(0,10)}catch{}return""},ol=()=>Ot(`node-gyp rebuild --directory=src ${Ri()?"--nodedir=emscripten":""}`,{...Ht,stdio:"inherit"}).status,Si=()=>process.platform!=="win32"?(Ot("pkg-config --modversion vips-cpp",{...Ht,env:{...process.env,PKG_CONFIG_PATH:Mi()}}).stdout||"").trim():"",Mi=()=>process.platform!=="win32"?[(Ot('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',Ht).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",wr=(e,t,r)=>(r&&r(`Detected ${t}, skipping search for globally-installed libvips`),e),sl=e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return wr(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return wr(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(il())return wr(!1,"Rosetta",e);let t=Si();return!!t&&Vs(t,ki)};Ti.exports={minimumLibvipsVersion:ki,prebuiltPlatforms:Ks,buildPlatformArch:Je,buildSharpLibvipsIncludeDir:el,buildSharpLibvipsCPlusPlusDir:tl,buildSharpLibvipsLibDir:rl,isUnsupportedNodeRuntime:nl,runtimePlatformArch:Zs,log:Qs,yarnLocator:al,spawnRebuild:ol,globalLibvipsVersion:Si,pkgConfigPath:Mi,useGlobalLibvips:sl}});var dt=D((yh,Di)=>{var{familySync:ll,versionSync:cl}=Mt(),{runtimePlatformArch:hl,isUnsupportedNodeRuntime:Li,prebuiltPlatforms:ul,minimumLibvipsVersion:fl}=Er(),He=hl(),ml=[`../src/build/Release/sharp-${He}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${He}/sharp.node`,"@img/sharp-wasm32/sharp.node"],Pr,Ke,mt=[];for(Pr of ml)try{Ke=require(Pr);break}catch(e){mt.push(e)}if(Ke&&Pr.startsWith("@img/sharp-linux-x64")&&!Ke._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",mt.push(e),Ke=null}if(Ke)Di.exports=Ke;else{let[e,t,r]=["linux","darwin","win32"].map(a=>He.startsWith(a)),n=[`Could not load the "sharp" module using the ${He} runtime`];mt.forEach(a=>{a.code!=="MODULE_NOT_FOUND"&&n.push(`${a.code}: ${a.message}`)});let i=mt.map(a=>a.message).join(" ");if(n.push("Possible solutions:"),Li()){let{found:a,expected:o}=Li();n.push("- Please upgrade Node.js:",` Found ${a}`,` Requires ${o}`)}else if(ul.includes(He)){let[a,o]=He.split("-"),l=a.endsWith("musl")?" --libc=musl":"";n.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${a.replace("musl","")}${l} --cpu=${o} sharp`)}else n.push(`- Manually install libvips >= ${fl}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(i))try{let{config:a}=require(`@img/sharp-libvips-${He}/package`),o=`${ll()} ${cl()}`,l=`${a.musl?"musl":"glibc"} ${a.musl||a.glibc}`;n.push("- Update your OS:",` Found ${o}`,` Requires ${l}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(i)&&n.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node"),t&&/Incompatible library version/.test(i)&&n.push("- Update Homebrew:"," brew update && brew upgrade vips"),mt.some(a=>a.code==="ERR_DLOPEN_DISABLED")&&n.push("- Run Node.js without using the --no-addons flag"),r&&/The specified procedure could not be found/.test(i)&&n.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp"),n.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(n.join(`
|
|
2
|
+
`))}});var Bi=D((wh,Fi)=>{var dl=require("node:util"),vr=require("node:stream"),gl=we();dt();var pl=dl.debuglog("sharp"),bl=e=>{qe.queue.emit("change",e)},qe=function(e,t){if(arguments.length===1&&!gl.defined(e))throw new Error("Invalid input");return this instanceof qe?(vr.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:r=>{this.emit("warning",r),pl(r)},queueListener:bl},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this):new qe(e,t)};Object.setPrototypeOf(qe.prototype,vr.Duplex.prototype);Object.setPrototypeOf(qe,vr.Duplex);function yl(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...n}=this.options;return e.options=structuredClone(n),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput()&&this.on("finish",()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")}),e}Object.assign(qe.prototype,{clone:yl});Fi.exports=qe});var Ni=D((Eh,$i)=>{var h=we(),Fe=dt(),wl={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},El=["failOn","limitInputPixels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","failOnError","openSlideLevel","pdfBackground","tiffSubifd"];function ji(e){let t=El.filter(r=>h.defined(e[r])).map(r=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function Pl(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(h.string(e))n.file=e;else if(h.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(h.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(h.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");n.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(h.plainObject(e)&&!h.defined(t))t=e,ji(t)&&(n.buffer=[]);else if(!h.defined(e)&&!h.defined(t)&&h.object(r)&&r.allowStream)n.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(i=>this._createInputDescriptor(i));else throw new Error("Recursive join is unsupported");else throw new Error("Expected at least two images to join");else throw new Error(`Unsupported input '${e}' of type ${typeof e}${h.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(h.object(t)){if(h.defined(t.failOnError))if(h.bool(t.failOnError))n.failOn=t.failOnError?"warning":"none";else throw h.invalidParameterError("failOnError","boolean",t.failOnError);if(h.defined(t.failOn))if(h.string(t.failOn)&&h.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw h.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(h.defined(t.autoOrient))if(h.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw h.invalidParameterError("autoOrient","boolean",t.autoOrient);if(h.defined(t.density))if(h.inRange(t.density,1,1e5))n.density=t.density;else throw h.invalidParameterError("density","number between 1 and 100000",t.density);if(h.defined(t.ignoreIcc))if(h.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw h.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(h.defined(t.limitInputPixels))if(h.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?16383**2:0;else if(h.integer(t.limitInputPixels)&&h.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw h.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(h.defined(t.unlimited))if(h.bool(t.unlimited))n.unlimited=t.unlimited;else throw h.invalidParameterError("unlimited","boolean",t.unlimited);if(h.defined(t.sequentialRead))if(h.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw h.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(h.defined(t.raw)){if(h.object(t.raw)&&h.integer(t.raw.width)&&t.raw.width>0&&h.integer(t.raw.height)&&t.raw.height>0&&h.integer(t.raw.channels)&&h.inRange(t.raw.channels,1,4))switch(n.rawWidth=t.raw.width,n.rawHeight=t.raw.height,n.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:n.rawDepth="uchar";break;case Int8Array:n.rawDepth="char";break;case Uint16Array:n.rawDepth="ushort";break;case Int16Array:n.rawDepth="short";break;case Uint32Array:n.rawDepth="uint";break;case Int32Array:n.rawDepth="int";break;case Float32Array:n.rawDepth="float";break;case Float64Array:n.rawDepth="double";break;default:n.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(n.rawPremultiplied=!1,h.defined(t.raw.premultiplied))if(h.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw h.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,h.defined(t.raw.pageHeight))if(h.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw new Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);n.rawPageHeight=t.raw.pageHeight}else throw h.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(h.defined(t.animated))if(h.bool(t.animated))n.pages=t.animated?-1:1;else throw h.invalidParameterError("animated","boolean",t.animated);if(h.defined(t.pages))if(h.integer(t.pages)&&h.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw h.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(h.defined(t.page))if(h.integer(t.page)&&h.inRange(t.page,0,1e5))n.page=t.page;else throw h.invalidParameterError("page","integer between 0 and 100000",t.page);if(h.object(t.openSlide)&&h.defined(t.openSlide.level))if(h.integer(t.openSlide.level)&&h.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw h.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(h.defined(t.level))if(h.integer(t.level)&&h.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw h.invalidParameterError("level","integer between 0 and 256",t.level);if(h.object(t.tiff)&&h.defined(t.tiff.subifd))if(h.integer(t.tiff.subifd)&&h.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw h.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(h.defined(t.subifd))if(h.integer(t.subifd)&&h.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw h.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(h.object(t.svg)){if(h.defined(t.svg.stylesheet))if(h.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw h.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(h.defined(t.svg.highBitdepth))if(h.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw h.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(h.object(t.pdf)&&h.defined(t.pdf.background)?n.pdfBackground=this._getBackgroundColourOption(t.pdf.background):h.defined(t.pdfBackground)&&(n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground)),h.object(t.jp2)&&h.defined(t.jp2.oneshot))if(h.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw h.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(h.defined(t.create))if(h.object(t.create)&&h.integer(t.create.width)&&t.create.width>0&&h.integer(t.create.height)&&t.create.height>0&&h.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,h.defined(t.create.pageHeight))if(h.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw new Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);n.createPageHeight=t.create.pageHeight}else throw h.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(h.defined(t.create.noise)){if(!h.object(t.create.noise))throw new Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw new Error("Only gaussian noise is supported at the moment");if(n.createNoiseType=t.create.noise.type,!h.inRange(t.create.channels,1,4))throw h.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,h.defined(t.create.noise.mean))if(h.number(t.create.noise.mean)&&h.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw h.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,h.defined(t.create.noise.sigma))if(h.number(t.create.noise.sigma)&&h.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw h.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(h.defined(t.create.background)){if(!h.inRange(t.create.channels,3,4))throw h.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);n.createBackground=this._getBackgroundColourOption(t.create.background)}else throw new Error("Expected valid noise or background to create a new input image");delete n.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(h.defined(t.text))if(h.object(t.text)&&h.string(t.text.text)){if(n.textValue=t.text.text,h.defined(t.text.height)&&h.defined(t.text.dpi))throw new Error("Expected only one of dpi or height");if(h.defined(t.text.font))if(h.string(t.text.font))n.textFont=t.text.font;else throw h.invalidParameterError("text.font","string",t.text.font);if(h.defined(t.text.fontfile))if(h.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw h.invalidParameterError("text.fontfile","string",t.text.fontfile);if(h.defined(t.text.width))if(h.integer(t.text.width)&&t.text.width>0)n.textWidth=t.text.width;else throw h.invalidParameterError("text.width","positive integer",t.text.width);if(h.defined(t.text.height))if(h.integer(t.text.height)&&t.text.height>0)n.textHeight=t.text.height;else throw h.invalidParameterError("text.height","positive integer",t.text.height);if(h.defined(t.text.align))if(h.string(t.text.align)&&h.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw h.invalidParameterError("text.align","valid alignment",t.text.align);if(h.defined(t.text.justify))if(h.bool(t.text.justify))n.textJustify=t.text.justify;else throw h.invalidParameterError("text.justify","boolean",t.text.justify);if(h.defined(t.text.dpi))if(h.integer(t.text.dpi)&&h.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw h.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(h.defined(t.text.rgba))if(h.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw h.invalidParameterError("text.rgba","bool",t.text.rgba);if(h.defined(t.text.spacing))if(h.integer(t.text.spacing)&&h.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw h.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(h.defined(t.text.wrap))if(h.string(t.text.wrap)&&h.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw h.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete n.buffer}else throw new Error("Expected a valid string to create an image with text.");if(h.defined(t.join))if(h.defined(this.options.join)){if(h.defined(t.join.animated))if(h.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw h.invalidParameterError("join.animated","boolean",t.join.animated);if(h.defined(t.join.across))if(h.integer(t.join.across)&&h.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw h.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(h.defined(t.join.shim))if(h.integer(t.join.shim)&&h.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw h.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(h.defined(t.join.background)&&(n.joinBackground=this._getBackgroundColourOption(t.join.background)),h.defined(t.join.halign))if(h.string(t.join.halign)&&h.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw h.invalidParameterError("join.halign","valid alignment",t.join.halign);if(h.defined(t.join.valign))if(h.string(t.join.valign)&&h.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw h.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(h.defined(t))throw new Error(`Invalid input options ${t}`);return n}function vl(e,t,r){Array.isArray(this.options.input.buffer)?h.buffer(e)?(this.options.input.buffer.length===0&&this.on("finish",()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),r()):r(new Error("Non-Buffer data on Writable Stream")):r(new Error("Unexpected data on Writable Stream"))}function xl(){this._isStreamInput()&&(this.options.input.buffer=Buffer.concat(this.options.input.buffer))}function Al(){return Array.isArray(this.options.input.buffer)}function Il(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Fe.metadata(this.options,(r,n)=>{r?e(h.nativeError(r,t)):e(null,n)})}):Fe.metadata(this.options,(r,n)=>{r?e(h.nativeError(r,t)):e(null,n)}),this):this._isStreamInput()?new Promise((r,n)=>{let i=()=>{this._flattenBufferIn(),Fe.metadata(this.options,(a,o)=>{a?n(h.nativeError(a,t)):r(o)})};this.writableFinished?i():this.once("finish",i)}):new Promise((r,n)=>{Fe.metadata(this.options,(i,a)=>{i?n(h.nativeError(i,t)):r(a)})})}function kl(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Fe.stats(this.options,(r,n)=>{r?e(h.nativeError(r,t)):e(null,n)})}):Fe.stats(this.options,(r,n)=>{r?e(h.nativeError(r,t)):e(null,n)}),this):this._isStreamInput()?new Promise((r,n)=>{this.on("finish",function(){this._flattenBufferIn(),Fe.stats(this.options,(i,a)=>{i?n(h.nativeError(i,t)):r(a)})})}):new Promise((r,n)=>{Fe.stats(this.options,(i,a)=>{i?n(h.nativeError(i,t)):r(a)})})}$i.exports=e=>{Object.assign(e.prototype,{_inputOptionsFromObject:ji,_createInputDescriptor:Pl,_write:vl,_flattenBufferIn:xl,_isStreamInput:Al,metadata:Il,stats:kl}),e.align=wl}});var Ui=D((Ph,zi)=>{var C=we(),Hi={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},qi={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},Oi={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},_i={entropy:16,attention:17},xr={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},Cl={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},Rl={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function Ar(e){return e.angle%360!==0||e.rotationAngle!==0}function qt(e){return e.width!==-1||e.height!==-1}function Sl(e,t,r){if(qt(this.options)&&this.options.debuglog("ignoring previous resize options"),this.options.widthPost!==-1&&this.options.debuglog("operation order will be: extract, resize, extract"),C.defined(e))if(C.object(e)&&!C.defined(r))r=e;else if(C.integer(e)&&e>0)this.options.width=e;else throw C.invalidParameterError("width","positive integer",e);else this.options.width=-1;if(C.defined(t))if(C.integer(t)&&t>0)this.options.height=t;else throw C.invalidParameterError("height","positive integer",t);else this.options.height=-1;if(C.object(r)){if(C.defined(r.width))if(C.integer(r.width)&&r.width>0)this.options.width=r.width;else throw C.invalidParameterError("width","positive integer",r.width);if(C.defined(r.height))if(C.integer(r.height)&&r.height>0)this.options.height=r.height;else throw C.invalidParameterError("height","positive integer",r.height);if(C.defined(r.fit)){let n=Rl[r.fit];if(C.string(n))this.options.canvas=n;else throw C.invalidParameterError("fit","valid fit",r.fit)}if(C.defined(r.position)){let n=C.integer(r.position)?r.position:_i[r.position]||qi[r.position]||Hi[r.position];if(C.integer(n)&&(C.inRange(n,0,8)||C.inRange(n,16,17)))this.options.position=n;else throw C.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),C.defined(r.kernel))if(C.string(xr[r.kernel]))this.options.kernel=xr[r.kernel];else throw C.invalidParameterError("kernel","valid kernel name",r.kernel);C.defined(r.withoutEnlargement)&&this._setBooleanOption("withoutEnlargement",r.withoutEnlargement),C.defined(r.withoutReduction)&&this._setBooleanOption("withoutReduction",r.withoutReduction),C.defined(r.fastShrinkOnLoad)&&this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}return Ar(this.options)&&qt(this.options)&&(this.options.rotateBefore=!0),this}function Ml(e){if(C.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(C.object(e)){if(C.defined(e.top))if(C.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw C.invalidParameterError("top","positive integer",e.top);if(C.defined(e.bottom))if(C.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw C.invalidParameterError("bottom","positive integer",e.bottom);if(C.defined(e.left))if(C.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw C.invalidParameterError("left","positive integer",e.left);if(C.defined(e.right))if(C.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw C.invalidParameterError("right","positive integer",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),C.defined(e.extendWith))if(C.string(Oi[e.extendWith]))this.options.extendWith=Oi[e.extendWith];else throw C.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw C.invalidParameterError("extend","integer or object",e);return this}function Tl(e){let t=qt(this.options)||this.options.widthPre!==-1?"Post":"Pre";return this.options[`width${t}`]!==-1&&this.options.debuglog("ignoring previous extract options"),["left","top","width","height"].forEach(function(r){let n=e[r];if(C.integer(n)&&n>=0)this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw C.invalidParameterError(r,"integer",n)},this),Ar(this.options)&&!qt(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function Ll(e){if(this.options.trimThreshold=10,C.defined(e))if(C.object(e)){if(C.defined(e.background)&&this._setBackgroundColourOption("trimBackground",e.background),C.defined(e.threshold))if(C.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw C.invalidParameterError("threshold","positive number",e.threshold);C.defined(e.lineArt)&&this._setBooleanOption("trimLineArt",e.lineArt)}else throw C.invalidParameterError("trim","object",e);return Ar(this.options)&&(this.options.rotateBefore=!0),this}zi.exports=e=>{Object.assign(e.prototype,{resize:Sl,extend:Ml,extract:Tl,trim:Ll}),e.gravity=Hi,e.strategy=_i,e.kernel=xr,e.fit=Cl,e.position=qi}});var Vi=D((vh,Gi)=>{var N=we(),Ir={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"};function Dl(e){if(!Array.isArray(e))throw N.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(t=>{if(!N.object(t))throw N.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),n={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(N.defined(t.blend))if(N.string(Ir[t.blend]))n.blend=Ir[t.blend];else throw N.invalidParameterError("blend","valid blend name",t.blend);if(N.defined(t.tile))if(N.bool(t.tile))n.tile=t.tile;else throw N.invalidParameterError("tile","boolean",t.tile);if(N.defined(t.left))if(N.integer(t.left))n.left=t.left;else throw N.invalidParameterError("left","integer",t.left);if(N.defined(t.top))if(N.integer(t.top))n.top=t.top;else throw N.invalidParameterError("top","integer",t.top);if(N.defined(t.top)!==N.defined(t.left))throw new Error("Expected both left and top to be set");if(n.hasOffset=N.integer(t.top)&&N.integer(t.left),N.defined(t.gravity))if(N.integer(t.gravity)&&N.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(N.string(t.gravity)&&N.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw N.invalidParameterError("gravity","valid gravity",t.gravity);if(N.defined(t.premultiplied))if(N.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw N.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}Gi.exports=e=>{e.prototype.composite=Dl,e.blend=Ir}});var Ki=D((xh,Ji)=>{var m=we(),Wi={integer:"integer",float:"float",approximate:"approximate"};function Fl(e,t){if(!m.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0),m.integer(e)&&!(e%90))this.options.angle=e;else if(m.number(e))this.options.rotationAngle=e,m.object(t)&&t.background&&this._setBackgroundColourOption("rotationBackground",t.background);else throw m.invalidParameterError("angle","numeric",e);return this}function Bl(){return this.options.input.autoOrient=!0,this}function jl(e){return this.options.flip=m.bool(e)?e:!0,this}function $l(e){return this.options.flop=m.bool(e)?e:!0,this}function Nl(e,t){let r=[].concat(...e);if(r.length===4&&r.every(m.number))this.options.affineMatrix=r;else throw m.invalidParameterError("matrix","1x4 or 2x2 array",e);if(m.defined(t))if(m.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),m.defined(t.idx))if(m.number(t.idx))this.options.affineIdx=t.idx;else throw m.invalidParameterError("options.idx","number",t.idx);if(m.defined(t.idy))if(m.number(t.idy))this.options.affineIdy=t.idy;else throw m.invalidParameterError("options.idy","number",t.idy);if(m.defined(t.odx))if(m.number(t.odx))this.options.affineOdx=t.odx;else throw m.invalidParameterError("options.odx","number",t.odx);if(m.defined(t.ody))if(m.number(t.ody))this.options.affineOdy=t.ody;else throw m.invalidParameterError("options.ody","number",t.ody);if(m.defined(t.interpolator))if(m.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw m.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw m.invalidParameterError("options","object",t);return this}function Ol(e,t,r){if(!m.defined(e))this.options.sharpenSigma=-1;else if(m.bool(e))this.options.sharpenSigma=e?-1:0;else if(m.number(e)&&m.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,m.defined(t))if(m.number(t)&&m.inRange(t,0,1e4))this.options.sharpenM1=t;else throw m.invalidParameterError("flat","number between 0 and 10000",t);if(m.defined(r))if(m.number(r)&&m.inRange(r,0,1e4))this.options.sharpenM2=r;else throw m.invalidParameterError("jagged","number between 0 and 10000",r)}else if(m.plainObject(e)){if(m.number(e.sigma)&&m.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw m.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(m.defined(e.m1))if(m.number(e.m1)&&m.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw m.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(m.defined(e.m2))if(m.number(e.m2)&&m.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw m.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(m.defined(e.x1))if(m.number(e.x1)&&m.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw m.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(m.defined(e.y2))if(m.number(e.y2)&&m.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw m.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(m.defined(e.y3))if(m.number(e.y3)&&m.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw m.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw m.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function Hl(e){if(!m.defined(e))this.options.medianSize=3;else if(m.integer(e)&&m.inRange(e,1,1e3))this.options.medianSize=e;else throw m.invalidParameterError("size","integer between 1 and 1000",e);return this}function ql(e){let t;if(m.number(e))t=e;else if(m.plainObject(e)){if(!m.number(e.sigma))throw m.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(m.string(Wi[e.precision]))this.options.precision=Wi[e.precision];else throw m.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(m.number(e.minAmplitude)&&m.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw m.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!m.defined(e))this.options.blurSigma=-1;else if(m.bool(e))this.options.blurSigma=e?-1:0;else if(m.number(t)&&m.inRange(t,.3,1e3))this.options.blurSigma=t;else throw m.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function Xi(e){if(!m.defined(e))this.options.dilateWidth=1;else if(m.integer(e)&&e>0)this.options.dilateWidth=e;else throw m.invalidParameterError("dilate","positive integer",Xi);return this}function Yi(e){if(!m.defined(e))this.options.erodeWidth=1;else if(m.integer(e)&&e>0)this.options.erodeWidth=e;else throw m.invalidParameterError("erode","positive integer",Yi);return this}function _l(e){return this.options.flatten=m.bool(e)?e:!0,m.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function zl(){return this.options.unflatten=!0,this}function Ul(e,t){if(!m.defined(e))this.options.gamma=2.2;else if(m.number(e)&&m.inRange(e,1,3))this.options.gamma=e;else throw m.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!m.defined(t))this.options.gammaOut=this.options.gamma;else if(m.number(t)&&m.inRange(t,1,3))this.options.gammaOut=t;else throw m.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function Gl(e){if(this.options.negate=m.bool(e)?e:!0,m.plainObject(e)&&"alpha"in e)if(m.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw m.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function Vl(e){if(m.plainObject(e)){if(m.defined(e.lower))if(m.number(e.lower)&&m.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw m.invalidParameterError("lower","number between 0 and 99",e.lower);if(m.defined(e.upper))if(m.number(e.upper)&&m.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw m.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw m.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function Wl(e){return this.normalise(e)}function Xl(e){if(m.plainObject(e)){if(m.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw m.invalidParameterError("width","integer greater than zero",e.width);if(m.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw m.invalidParameterError("height","integer greater than zero",e.height);if(m.defined(e.maxSlope))if(m.integer(e.maxSlope)&&m.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw m.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw m.invalidParameterError("options","plain object",e);return this}function Yl(e){if(!m.object(e)||!Array.isArray(e.kernel)||!m.integer(e.width)||!m.integer(e.height)||!m.inRange(e.width,3,1001)||!m.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return m.integer(e.scale)||(e.scale=e.kernel.reduce((t,r)=>t+r,0)),e.scale<1&&(e.scale=1),m.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function Jl(e,t){if(!m.defined(e))this.options.threshold=128;else if(m.bool(e))this.options.threshold=e?128:0;else if(m.integer(e)&&m.inRange(e,0,255))this.options.threshold=e;else throw m.invalidParameterError("threshold","integer between 0 and 255",e);return!m.object(t)||t.greyscale===!0||t.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function Kl(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),m.string(t)&&m.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw m.invalidParameterError("operator","one of: and, or, eor",t);return this}function Ql(e,t){if(!m.defined(e)&&m.number(t)?e=1:m.number(e)&&!m.defined(t)&&(t=0),!m.defined(e))this.options.linearA=[];else if(m.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(m.number))this.options.linearA=e;else throw m.invalidParameterError("a","number or array of numbers",e);if(!m.defined(t))this.options.linearB=[];else if(m.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&t.length&&t.every(m.number))this.options.linearB=t;else throw m.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw new Error("Expected a and b to be arrays of the same length");return this}function Zl(e){if(!Array.isArray(e))throw m.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw m.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let t=e.flat().map(Number);if(t.length!==9&&t.length!==16)throw m.invalidParameterError("inputMatrix","cardinality of 9 or 16",t.length);return this.options.recombMatrix=t,this}function ec(e){if(!m.plainObject(e))throw m.invalidParameterError("options","plain object",e);if("brightness"in e)if(m.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw m.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(m.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw m.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(m.integer(e.hue))this.options.hue=e.hue%360;else throw m.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(m.number(e.lightness))this.options.lightness=e.lightness;else throw m.invalidParameterError("lightness","number",e.lightness);return this}Ji.exports=e=>{Object.assign(e.prototype,{autoOrient:Bl,rotate:Fl,flip:jl,flop:$l,affine:Nl,sharpen:Ol,erode:Yi,dilate:Xi,median:Hl,blur:ql,flatten:_l,unflatten:zl,gamma:Ul,negate:Gl,normalise:Vl,normalize:Wl,clahe:Xl,convolve:Yl,threshold:Jl,boolean:Kl,linear:Ql,recomb:Zl,modulate:ec})}});var na=D((Ah,ra)=>{var Sr=Object.defineProperty,tc=Object.getOwnPropertyDescriptor,rc=Object.getOwnPropertyNames,nc=Object.prototype.hasOwnProperty,ic=(e,t)=>{for(var r in t)Sr(e,r,{get:t[r],enumerable:!0})},ac=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rc(t))!nc.call(e,i)&&i!==r&&Sr(e,i,{get:()=>t[i],enumerable:!(n=tc(t,i))||n.enumerable});return e},oc=e=>ac(Sr({},"__esModule",{value:!0}),e),Qi={};ic(Qi,{default:()=>Ec});ra.exports=oc(Qi);var Ae={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Zi=Object.create(null);for(let e in Ae)Object.hasOwn(Ae,e)&&(Zi[Ae[e]]=e);var se={to:{},get:{}};se.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=se.get.hsl(e),n="hsl";break}case"hwb":{r=se.get.hwb(e),n="hwb";break}default:{r=se.get.rgb(e),n="rgb";break}}return r?{model:n,value:r}:null};se.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],l,c,f;if(l=e.match(r)){for(f=l[2],l=l[1],c=0;c<3;c++){let d=c*2;o[c]=Number.parseInt(l.slice(d,d+2),16)}f&&(o[3]=Number.parseInt(f,16)/255)}else if(l=e.match(t)){for(l=l[1],f=l[3],c=0;c<3;c++)o[c]=Number.parseInt(l[c]+l[c],16);f&&(o[3]=Number.parseInt(f+f,16)/255)}else if(l=e.match(n)){for(c=0;c<3;c++)o[c]=Number.parseInt(l[c+1],10);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else if(l=e.match(i)){for(c=0;c<3;c++)o[c]=Math.round(Number.parseFloat(l[c+1])*2.55);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else return(l=e.match(a))?l[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Ae,l[1])?(o=Ae[l[1]],o[3]=1,o):null:null;for(c=0;c<3;c++)o[c]=Be(o[c],0,255);return o[3]=Be(o[3],0,1),o};se.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),i=(Number.parseFloat(r[1])%360+360)%360,a=Be(Number.parseFloat(r[2]),0,100),o=Be(Number.parseFloat(r[3]),0,100),l=Be(Number.isNaN(n)?1:n,0,1);return[i,a,o,l]}return null};se.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),i=(Number.parseFloat(r[1])%360+360)%360,a=Be(Number.parseFloat(r[2]),0,100),o=Be(Number.parseFloat(r[3]),0,100),l=Be(Number.isNaN(n)?1:n,0,1);return[i,a,o,l]}return null};se.to.hex=function(...e){return"#"+_t(e[0])+_t(e[1])+_t(e[2])+(e[3]<1?_t(Math.round(e[3]*255)):"")};se.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};se.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};se.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};se.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};se.to.keyword=function(...e){return Zi[e.slice(0,3)]};function Be(e,t,r){return Math.min(Math.max(t,e),r)}function _t(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var Qe=se,ea={};for(let e of Object.keys(Ae))ea[Ae[e]]=e;var E={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},_e=E,Se=(6/29)**3;function et(e){let t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function tt(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(E)){if(!("channels"in E[e]))throw new Error("missing channels property: "+e);if(!("labels"in E[e]))throw new Error("missing channel labels property: "+e);if(E[e].labels.length!==E[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=E[e];delete E[e].channels,delete E[e].labels,Object.defineProperty(E[e],"channels",{value:t}),Object.defineProperty(E[e],"labels",{value:r})}E.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=a-i,l,c;switch(a){case i:{l=0;break}case t:{l=(r-n)/o;break}case r:{l=2+(n-t)/o;break}case n:{l=4+(t-r)/o;break}}l=Math.min(l*60,360),l<0&&(l+=360);let f=(i+a)/2;return a===i?c=0:f<=.5?c=o/(a+i):c=o/(2-a-i),[l,c*100,f*100]};E.rgb.hsv=function(e){let t,r,n,i,a,o=e[0]/255,l=e[1]/255,c=e[2]/255,f=Math.max(o,l,c),d=f-Math.min(o,l,c),g=function(b){return(f-b)/6/d+1/2};if(d===0)i=0,a=0;else{switch(a=d/f,t=g(o),r=g(l),n=g(c),f){case o:{i=n-r;break}case l:{i=1/3+t-n;break}case c:{i=2/3+r-t;break}}i<0?i+=1:i>1&&(i-=1)}return[i*360,a*100,f*100]};E.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],i=E.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[i,a*100,n*100]};E.rgb.oklab=function(e){let t=tt(e[0]/255),r=tt(e[1]/255),n=tt(e[2]/255),i=Math.cbrt(.4122214708*t+.5363325363*r+.0514459929*n),a=Math.cbrt(.2119034982*t+.6806995451*r+.1073969566*n),o=Math.cbrt(.0883024619*t+.2817188376*r+.6299787005*n),l=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,f=.0259040371*i+.7827717662*a-.808675766*o;return[l*100,c*100,f*100]};E.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(1-t,1-r,1-n),a=(1-t-i)/(1-i)||0,o=(1-r-i)/(1-i)||0,l=(1-n-i)/(1-i)||0;return[a*100,o*100,l*100,i*100]};function sc(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}E.rgb.keyword=function(e){let t=ea[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let i of Object.keys(Ae)){let a=Ae[i],o=sc(e,a);o<r&&(r=o,n=i)}return n};E.keyword.rgb=function(e){return Ae[e]};E.rgb.xyz=function(e){let t=tt(e[0]/255),r=tt(e[1]/255),n=tt(e[2]/255),i=t*.4124564+r*.3575761+n*.1804375,a=t*.2126729+r*.7151522+n*.072175,o=t*.0193339+r*.119192+n*.9503041;return[i*100,a*100,o*100]};E.rgb.lab=function(e){let t=E.rgb.xyz(e),r=t[0],n=t[1],i=t[2];r/=95.047,n/=100,i/=108.883,r=r>Se?r**(1/3):7.787*r+16/116,n=n>Se?n**(1/3):7.787*n+16/116,i=i>Se?i**(1/3):7.787*i+16/116;let a=116*n-16,o=500*(r-n),l=200*(n-i);return[a,o,l]};E.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,i,a;if(r===0)return a=n*255,[a,a,a];let o=n<.5?n*(1+r):n+r-n*r,l=2*n-o,c=[0,0,0];for(let f=0;f<3;f++)i=t+1/3*-(f-1),i<0&&i++,i>1&&i--,6*i<1?a=l+(o-l)*6*i:2*i<1?a=o:3*i<2?a=l+(o-l)*(2/3-i)*6:a=l,c[f]=a*255;return c};E.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,i=r,a=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=a<=1?a:2-a;let o=(n+r)/2,l=n===0?2*i/(a+i):2*r/(n+r);return[t,l*100,o*100]};E.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*n*(1-r),l=255*n*(1-r*a),c=255*n*(1-r*(1-a));switch(n*=255,i){case 0:return[n,c,o];case 1:return[l,n,o];case 2:return[o,n,c];case 3:return[o,l,n];case 4:return[c,o,n];case 5:return[n,o,l]}};E.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,i=Math.max(n,.01),a,o;o=(2-r)*n;let l=(2-r)*i;return a=r*i,a/=l<=1?l:2-l,a=a||0,o/=2,[t,a*100,o*100]};E.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,i=r+n,a;i>1&&(r/=i,n/=i);let o=Math.floor(6*t),l=1-n;a=6*t-o,(o&1)!==0&&(a=1-a);let c=r+a*(l-r),f,d,g;switch(o){default:case 6:case 0:{f=l,d=c,g=r;break}case 1:{f=c,d=l,g=r;break}case 2:{f=r,d=l,g=c;break}case 3:{f=r,d=c,g=l;break}case 4:{f=c,d=r,g=l;break}case 5:{f=l,d=r,g=c;break}}return[f*255,d*255,g*255]};E.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),l=1-Math.min(1,n*(1-i)+i);return[a*255,o*255,l*255]};E.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,i,a,o;return i=t*3.2404542+r*-1.5371385+n*-.4985314,a=t*-.969266+r*1.8760108+n*.041556,o=t*.0556434+r*-.2040259+n*1.0572252,i=et(i),a=et(a),o=et(o),[i*255,a*255,o*255]};E.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>Se?t**(1/3):7.787*t+16/116,r=r>Se?r**(1/3):7.787*r+16/116,n=n>Se?n**(1/3):7.787*n+16/116;let i=116*r-16,a=500*(t-r),o=200*(r-n);return[i,a,o]};E.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,i=Math.cbrt(.8189330101*t+.3618667424*r-.1288597137*n),a=Math.cbrt(.0329845436*t+.9293118715*r+.0361456387*n),o=Math.cbrt(.0482003018*t+.2643662691*r+.633851707*n),l=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,f=.0259040371*i+.7827717662*a-.808675766*o;return[l*100,c*100,f*100]};E.oklab.oklch=function(e){return E.lab.lch(e)};E.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,i=(.999999998*t+.396337792*r+.215803758*n)**3,a=(1.000000008*t-.105561342*r-.063854175*n)**3,o=(1.000000055*t-.089484182*r-1.291485538*n)**3,l=1.227013851*i-.55779998*a+.281256149*o,c=-.040580178*i+1.11225687*a-.071676679*o,f=-.076381285*i-.421481978*a+1.58616322*o;return[l*100,c*100,f*100]};E.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,i=(t+.3963377774*r+.2158037573*n)**3,a=(t-.1055613458*r-.0638541728*n)**3,o=(t-.0894841775*r-1.291485548*n)**3,l=et(4.0767416621*i-3.3077115913*a+.2309699292*o),c=et(-1.2684380046*i+2.6097574011*a-.3413193965*o),f=et(-.0041960863*i-.7034186147*a+1.707614701*o);return[l*255,c*255,f*255]};E.oklch.oklab=function(e){return E.lch.lab(e)};E.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],i,a,o;a=(t+16)/116,i=r/500+a,o=a-n/200;let l=a**3,c=i**3,f=o**3;return a=l>Se?l:(a-16/116)/7.787,i=c>Se?c:(i-16/116)/7.787,o=f>Se?f:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]};E.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],i;i=Math.atan2(n,r)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(r*r+n*n);return[t,o,i]};E.lch.lab=function(e){let t=e[0],r=e[1],i=e[2]/360*2*Math.PI,a=r*Math.cos(i),o=r*Math.sin(i);return[t,a,o]};E.rgb.ansi16=function(e,t=null){let[r,n,i]=e,a=t===null?E.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return a===2&&(o+=60),o};E.hsv.ansi16=function(e){return E.rgb.ansi16(E.hsv.rgb(e),e[2])};E.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];return t>>4===r>>4&&r>>4===n>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};E.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(Math.trunc(e>50)+1)*.5,n=(t&1)*r*255,i=(t>>1&1)*r*255,a=(t>>2&1)*r*255;return[n,i,a]};E.ansi256.rgb=function(e){if(e=e[0],e>=232){let a=(e-232)*10+8;return[a,a,a]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,i=t%6/5*255;return[r,n,i]};E.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};E.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=[...r].map(l=>l+l).join(""));let n=Number.parseInt(r,16),i=n>>16&255,a=n>>8&255,o=n&255;return[i,a,o]};E.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.max(Math.max(t,r),n),a=Math.min(Math.min(t,r),n),o=i-a,l,c=o<1?a/(1-o):0;return o<=0?l=0:i===t?l=(r-n)/o%6:i===r?l=2+(n-t)/o:l=4+(t-r)/o,l/=6,l%=1,[l*360,o*100,c*100]};E.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r),i=0;return n<1&&(i=(r-.5*n)/(1-n)),[e[0],n*100,i*100]};E.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],n*100,i*100]};E.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let i=[0,0,0],a=t%1*6,o=a%1,l=1-o,c=0;switch(Math.floor(a)){case 0:{i[0]=1,i[1]=o,i[2]=0;break}case 1:{i[0]=l,i[1]=1,i[2]=0;break}case 2:{i[0]=0,i[1]=1,i[2]=o;break}case 3:{i[0]=0,i[1]=l,i[2]=1;break}case 4:{i[0]=o,i[1]=0,i[2]=1;break}default:i[0]=1,i[1]=0,i[2]=l}return c=(1-r)*n,[(r*i[0]+c)*255,(r*i[1]+c)*255,(r*i[2]+c)*255]};E.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),i=0;return n>0&&(i=t/n),[e[0],i*100,n*100]};E.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],i*100,n*100]};E.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};E.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,i=n-t,a=0;return i<1&&(a=(n-i)/(1-i)),[e[0],i*100,a*100]};E.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};E.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};E.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};E.gray.hsl=function(e){return[0,0,e[0]]};E.gray.hsv=E.gray.hsl;E.gray.hwb=function(e){return[0,100,e[0]]};E.gray.cmyk=function(e){return[0,0,0,e[0]]};E.gray.lab=function(e){return[e[0],0,0]};E.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n};E.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function lc(){let e={},t=Object.keys(_e);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function cc(e){let t=lc(),r=[e];for(t[e].distance=0;r.length>0;){let n=r.pop(),i=Object.keys(_e[n]);for(let{length:a}=i,o=0;o<a;o++){let l=i[o],c=t[l];c.distance===-1&&(c.distance=t[n].distance+1,c.parent=n,r.unshift(l))}}return t}function hc(e,t){return function(r){return t(e(r))}}function uc(e,t){let r=[t[e].parent,e],n=_e[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)r.unshift(t[i].parent),n=hc(_e[t[i].parent][i],n),i=t[i].parent;return n.conversion=r,n}function fc(e){let t=cc(e),r={},n=Object.keys(t);for(let{length:i}=n,a=0;a<i;a++){let o=n[a];t[o].parent!==null&&(r[o]=uc(o,t))}return r}var mc=fc,Ze={},dc=Object.keys(_e);function gc(e){let t=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function pc(e){let t=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let i=e(r);if(typeof i=="object")for(let{length:a}=i,o=0;o<a;o++)i[o]=Math.round(i[o]);return i};return"conversion"in e&&(t.conversion=e.conversion),t}for(let e of dc){Ze[e]={},Object.defineProperty(Ze[e],"channels",{value:_e[e].channels}),Object.defineProperty(Ze[e],"labels",{value:_e[e].labels});let t=mc(e),r=Object.keys(t);for(let n of r){let i=t[n];Ze[e][n]=pc(i),Ze[e][n].raw=gc(i)}}var le=Ze,ta=["keyword","gray","hex"],kr={};for(let e of Object.keys(le))kr[[...le[e].labels].sort().join("")]=e;var Cr={};function W(e,t){if(!(this instanceof W))return new W(e,t);if(t&&t in ta&&(t=null),t&&!(t in le))throw new Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof W)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let i=Qe.get(e);if(i===null)throw new Error("Unable to parse color from string: "+e);this.model=i.model,n=le[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=le[this.model].channels;let i=Array.prototype.slice.call(e,0,n);this.color=Rr(i,n),this.valpha=typeof e[n]=="number"?e[n]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let i=Object.keys(e);"alpha"in e&&(i.splice(i.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);let a=i.sort().join("");if(!(a in kr))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=kr[a];let{labels:o}=le[this.model],l=[];for(r=0;r<o.length;r++)l.push(e[o[r]]);this.color=Rr(l)}if(Cr[this.model])for(n=le[this.model].channels,r=0;r<n;r++){let i=Cr[this.model][r];i&&(this.color[r]=i(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}W.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in Qe.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return Qe.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e=="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return Qe.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=le[this.model],{labels:r}=le[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new W([...this.color.map(yc(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new W([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:U("rgb",0,G(255)),green:U("rgb",1,G(255)),blue:U("rgb",2,G(255)),hue:U(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:U("hsl",1,G(100)),lightness:U("hsl",2,G(100)),saturationv:U("hsv",1,G(100)),value:U("hsv",2,G(100)),chroma:U("hcg",1,G(100)),gray:U("hcg",2,G(100)),white:U("hwb",1,G(100)),wblack:U("hwb",2,G(100)),cyan:U("cmyk",0,G(100)),magenta:U("cmyk",1,G(100)),yellow:U("cmyk",2,G(100)),black:U("cmyk",3,G(100)),x:U("xyz",0,G(95.047)),y:U("xyz",1,G(100)),z:U("xyz",2,G(108.833)),l:U("lab",0,G(100)),a:U("lab",1),b:U("lab",2),keyword(e){return e!==void 0?new W(e):le[this.model].keyword(this.color)},hex(e){return e!==void 0?new W(e):Qe.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new W(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();return r.length===1&&(r="0"+r),Qe.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,n]of e.entries()){let i=n/255;t[r]=i<=.04045?i/12.92:((i+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return W.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),n=this.rgb(),i=t===void 0?.5:t,a=2*i-1,o=r.alpha()-n.alpha(),l=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,c=1-l;return W.rgb(l*r.red()+c*n.red(),l*r.green()+c*n.green(),l*r.blue()+c*n.blue(),r.alpha()*i+n.alpha()*(1-i))}};for(let e of Object.keys(le)){if(ta.includes(e))continue;let{channels:t}=le[e];W.prototype[e]=function(...r){return this.model===e?new W(this):r.length>0?new W(r,e):new W([...wc(le[this.model][e].raw(this.color)),this.valpha],e)},W[e]=function(...r){let n=r[0];return typeof n=="number"&&(n=Rr(r,t)),new W(n,e)}}function bc(e,t){return Number(e.toFixed(t))}function yc(e){return function(t){return bc(t,e)}}function U(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(Cr[n]||=[])[t]=r;return e=e[0],function(n){let i;return n!==void 0?(r&&(n=r(n)),i=this[e](),i.color[t]=n,i):(i=this[e]().color[t],r&&(i=r(i)),i)}}function G(e){return function(t){return Math.max(0,Math.min(e,t))}}function wc(e){return Array.isArray(e)?e:[e]}function Rr(e,t){for(let r=0;r<t;r++)typeof e[r]!="number"&&(e[r]=0);return e}var Ec=W});var aa=D((Ih,ia)=>{ia.exports=na().default});var ca=D((kh,la)=>{var Pc=aa(),Me=we(),oa={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function vc(e){return this._setBackgroundColourOption("tint",e),this}function xc(e){return this.options.greyscale=Me.bool(e)?e:!0,this}function Ac(e){return this.greyscale(e)}function Ic(e){if(!Me.string(e))throw Me.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function kc(e){return this.pipelineColourspace(e)}function Cc(e){if(!Me.string(e))throw Me.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function Rc(e){return this.toColourspace(e)}function sa(e){if(Me.object(e)||Me.string(e)&&e.length>=3&&e.length<=200){let t=Pc(e);return[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw Me.invalidParameterError("background","object or string",e)}function Sc(e,t){Me.defined(t)&&(this.options[e]=sa(t))}la.exports=e=>{Object.assign(e.prototype,{tint:vc,greyscale:xc,grayscale:Ac,pipelineColourspace:Ic,pipelineColorspace:kc,toColourspace:Cc,toColorspace:Rc,_getBackgroundColourOption:sa,_setBackgroundColourOption:Sc}),e.colourspace=oa,e.colorspace=oa}});var ua=D((Ch,ha)=>{var Ie=we(),Mc={and:"and",or:"or",eor:"eor"};function Tc(){return this.options.removeAlpha=!0,this}function Lc(e){if(Ie.defined(e))if(Ie.number(e)&&Ie.inRange(e,0,1))this.options.ensureAlpha=e;else throw Ie.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function Dc(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e)&&(e=t[e]),Ie.integer(e)&&Ie.inRange(e,0,4))this.options.extractChannel=e;else throw Ie.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function Fc(e,t){return Array.isArray(e)?e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,t)),this}function Bc(e){if(Ie.string(e)&&Ie.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw Ie.invalidParameterError("boolOp","one of: and, or, eor",e);return this}ha.exports=e=>{Object.assign(e.prototype,{removeAlpha:Tc,ensureAlpha:Lc,extractChannel:Dc,joinChannel:Fc,bandbool:Bc}),e.bool=Mc}});var pa=D((Rh,ga)=>{var Mr=require("node:path"),s=we(),rt=dt(),fa=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),jc=/\.(jp[2x]|j2[kc])$/i,ma=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),da=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function $c(e,t){let r;if(s.string(e)?s.string(this.options.input.file)&&Mr.resolve(this.options.input.file)===Mr.resolve(e)?r=new Error("Cannot use same file for input and output"):jc.test(Mr.extname(e))&&!this.constructor.format.jp2k.output.file&&(r=ma()):r=new Error("Missing output file path"),r)if(s.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function Nc(e,t){s.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let r=Error();return this._pipeline(s.fn(e)?e:t,r)}function Oc(){return this.options.keepMetadata|=1,this}function Hc(e){if(s.object(e))for(let[t,r]of Object.entries(e))if(s.object(r))for(let[n,i]of Object.entries(r))if(s.string(i))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=i;else throw s.invalidParameterError(`${t}.${n}`,"string",i);else throw s.invalidParameterError(t,"object",r);else throw s.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function qc(e){return this.withExif(e),this.options.withExifMerge=!0,this}function _c(){return this.options.keepMetadata|=8,this}function zc(e,t){if(s.string(e))this.options.withIccProfile=e;else throw s.invalidParameterError("icc","string",e);if(this.keepIccProfile(),s.object(t)&&s.defined(t.attach))if(s.bool(t.attach))t.attach||(this.options.keepMetadata&=-9);else throw s.invalidParameterError("attach","boolean",t.attach);return this}function Uc(){return this.options.keepMetadata|=2,this}function Gc(e){if(s.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw s.invalidParameterError("xmp","non-empty string",e);return this}function Vc(){return this.options.keepMetadata=31,this}function Wc(e){if(this.keepMetadata(),this.withIccProfile("srgb"),s.object(e)){if(s.defined(e.orientation))if(s.integer(e.orientation)&&s.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw s.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(s.defined(e.density))if(s.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw s.invalidParameterError("density","positive number",e.density);s.defined(e.icc)&&this.withIccProfile(e.icc),s.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function Xc(e,t){let r=fa.get((s.object(e)&&s.string(e.id)?e.id:e).toLowerCase());if(!r)throw s.invalidParameterError("format",`one of: ${[...fa.keys()].join(", ")}`,e);return this[r](t)}function Yc(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=s.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(s.defined(t)&&this._setBooleanOption("jpegOptimiseCoding",t),s.defined(e.mozjpeg))if(s.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw s.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=s.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;s.defined(r)&&this._setBooleanOption("jpegTrellisQuantisation",r),s.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=s.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;s.defined(n)&&(this._setBooleanOption("jpegOptimiseScans",n),n&&(this.options.jpegProgressive=!0));let i=s.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(s.defined(i))if(s.integer(i)&&s.inRange(i,0,8))this.options.jpegQuantisationTable=i;else throw s.invalidParameterError("quantisationTable","integer between 0 and 8",i)}return this._updateFormatOut("jpeg",e)}function Jc(e){if(s.object(e)){if(s.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),s.defined(e.compressionLevel))if(s.integer(e.compressionLevel)&&s.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw s.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);s.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(s.defined(t))if(s.integer(t)&&s.inRange(t,2,256))this.options.pngBitdepth=da(t);else throw s.invalidParameterError("colours","integer between 2 and 256",t);if(s.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(s.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw s.invalidParameterError("quality","integer between 0 and 100",e.quality);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 10",e.effort);if(s.defined(e.dither))if(s.number(e.dither)&&s.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw s.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function Kc(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.alphaQuality))if(s.integer(e.alphaQuality)&&s.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw s.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(s.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),s.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),s.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),s.defined(e.smartDeblock)&&this._setBooleanOption("webpSmartDeblock",e.smartDeblock),s.defined(e.preset))if(s.string(e.preset)&&s.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw s.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw s.invalidParameterError("effort","integer between 0 and 6",e.effort);s.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),s.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return Tr(e,this.options),this._updateFormatOut("webp",e)}function Qc(e){if(s.object(e)){s.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),s.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(s.defined(t))if(s.integer(t)&&s.inRange(t,2,256))this.options.gifBitdepth=da(t);else throw s.invalidParameterError("colours","integer between 2 and 256",t);if(s.defined(e.effort))if(s.number(e.effort)&&s.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 10",e.effort);if(s.defined(e.dither))if(s.number(e.dither)&&s.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw s.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(s.defined(e.interFrameMaxError))if(s.number(e.interFrameMaxError)&&s.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw s.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(s.defined(e.interPaletteMaxError))if(s.number(e.interPaletteMaxError)&&s.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw s.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(s.defined(e.keepDuplicateFrames))if(s.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw s.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Tr(e,this.options),this._updateFormatOut("gif",e)}function Zc(e){if(!this.constructor.format.jp2k.output.buffer)throw ma();if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.tileWidth))if(s.integer(e.tileWidth)&&s.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw s.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(s.defined(e.tileHeight))if(s.integer(e.tileHeight)&&s.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw s.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Tr(e,t){if(s.object(e)&&s.defined(e.loop))if(s.integer(e.loop)&&s.inRange(e.loop,0,65535))t.loop=e.loop;else throw s.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(s.object(e)&&s.defined(e.delay))if(s.integer(e.delay)&&s.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(s.integer)&&e.delay.every(r=>s.inRange(r,0,65535)))t.delay=e.delay;else throw s.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function e0(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.bitdepth))if(s.integer(e.bitdepth)&&s.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw s.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(s.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),s.defined(e.tileWidth))if(s.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw s.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(s.defined(e.tileHeight))if(s.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw s.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(s.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),s.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),s.defined(e.xres))if(s.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw s.invalidParameterError("xres","number greater than zero",e.xres);if(s.defined(e.yres))if(s.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw s.invalidParameterError("yres","number greater than zero",e.yres);if(s.defined(e.compression))if(s.string(e.compression)&&s.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw s.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(s.defined(e.bigtiff)&&this._setBooleanOption("tiffBigtiff",e.bigtiff),s.defined(e.predictor))if(s.string(e.predictor)&&s.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw s.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(s.defined(e.resolutionUnit))if(s.string(e.resolutionUnit)&&s.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw s.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function t0(e){return this.heif({...e,compression:"av1"})}function r0(e){if(s.object(e)){if(s.string(e.compression)&&s.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw s.invalidParameterError("compression","one of: av1, hevc",e.compression);if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.heifLossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw s.invalidParameterError("effort","integer between 0 and 9",e.effort);if(s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(s.defined(e.bitdepth))if(s.integer(e.bitdepth)&&s.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw s.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw s.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw s.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function n0(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(s.defined(e.distance))if(s.number(e.distance)&&s.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw s.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(s.defined(e.decodingTier))if(s.integer(e.decodingTier)&&s.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw s.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Tr(e,this.options),this._updateFormatOut("jxl",e)}function i0(e){if(s.object(e)&&s.defined(e.depth))if(s.string(e.depth)&&s.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw s.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function a0(e){if(s.object(e)){if(s.defined(e.size))if(s.integer(e.size)&&s.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw s.invalidParameterError("size","integer between 1 and 8192",e.size);if(s.defined(e.overlap))if(s.integer(e.overlap)&&s.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw s.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw s.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(s.defined(e.container))if(s.string(e.container)&&s.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw s.invalidParameterError("container","one of: fs, zip",e.container);if(s.defined(e.layout))if(s.string(e.layout)&&s.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw s.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(s.defined(e.angle))if(s.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw s.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),s.defined(e.depth))if(s.string(e.depth)&&s.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw s.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(s.defined(e.skipBlanks))if(s.integer(e.skipBlanks)&&s.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw s.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else s.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let t=s.bool(e.center)?e.center:e.centre;if(s.defined(t)&&this._setBooleanOption("tileCentre",t),s.defined(e.id))if(s.string(e.id))this.options.tileId=e.id;else throw s.invalidParameterError("id","string",e.id);if(s.defined(e.basename))if(s.string(e.basename))this.options.tileBasename=e.basename;else throw s.invalidParameterError("basename","string",e.basename)}if(s.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw s.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function o0(e){if(!s.plainObject(e))throw s.invalidParameterError("options","object",e);if(s.integer(e.seconds)&&s.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw s.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function s0(e,t){return s.object(t)&&t.force===!1||(this.options.formatOut=e),this}function l0(e,t){if(s.bool(t))this.options[e]=t;else throw s.invalidParameterError(e,"boolean",t)}function c0(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function h0(e,t){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),rt.pipeline(this.options,(r,n,i)=>{r?e(s.nativeError(r,t)):e(null,n,i)})}):rt.pipeline(this.options,(r,n,i)=>{r?e(s.nativeError(r,t)):e(null,n,i)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),rt.pipeline(this.options,(r,n,i)=>{r?this.emit("error",s.nativeError(r,t)):(this.emit("info",i),this.push(n)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):rt.pipeline(this.options,(r,n,i)=>{r?this.emit("error",s.nativeError(r,t)):(this.emit("info",i),this.push(n)),this.push(null),this.on("end",()=>this.emit("close"))}),this):this._isStreamInput()?new Promise((r,n)=>{this.once("finish",()=>{this._flattenBufferIn(),rt.pipeline(this.options,(i,a,o)=>{i?n(s.nativeError(i,t)):this.options.resolveWithObject?r({data:a,info:o}):r(a)})})}):new Promise((r,n)=>{rt.pipeline(this.options,(i,a,o)=>{i?n(s.nativeError(i,t)):this.options.resolveWithObject?r({data:a,info:o}):r(a)})})}ga.exports=e=>{Object.assign(e.prototype,{toFile:$c,toBuffer:Nc,keepExif:Oc,withExif:Hc,withExifMerge:qc,keepIccProfile:_c,withIccProfile:zc,keepXmp:Uc,withXmp:Gc,keepMetadata:Vc,withMetadata:Wc,toFormat:Xc,jpeg:Yc,jp2:Zc,png:Jc,webp:Kc,tiff:e0,avif:t0,heif:r0,jxl:n0,gif:Qc,raw:i0,tile:a0,timeout:o0,_updateFormatOut:s0,_setBooleanOption:l0,_read:c0,_pipeline:h0})}});var Ea=D((Sh,wa)=>{var u0=require("node:events"),zt=Mt(),ue=we(),{runtimePlatformArch:f0}=Er(),re=dt(),ba=f0(),Lr=re.libvipsVersion(),je=re.format();je.heif.output.alias=["avif","heic"];je.jpeg.output.alias=["jpe","jpg"];je.tiff.output.alias=["tif"];je.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var m0={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},nt={vips:Lr.semver};if(!Lr.isGlobal)if(Lr.isWasm)try{nt=require("@img/sharp-wasm32/versions")}catch{}else try{nt=require(`@img/sharp-${ba}/versions`)}catch{try{nt=require(`@img/sharp-libvips-${ba}/versions`)}catch{}}nt.sharp=yr().version;nt.heif&&je.heif&&(je.heif.input.fileSuffix=[".avif"],je.heif.output.alias=["avif"]);function ya(e){return ue.bool(e)?e?re.cache(50,20,100):re.cache(0,0,0):ue.object(e)?re.cache(e.memory,e.files,e.items):re.cache()}ya(!0);function d0(e){return re.concurrency(ue.integer(e)?e:null)}zt.familySync()===zt.GLIBC&&!re._isUsingJemalloc()?re.concurrency(1):zt.familySync()===zt.MUSL&&re.concurrency()===1024&&re.concurrency(require("node:os").availableParallelism());var g0=new u0.EventEmitter;function p0(){return re.counters()}function b0(e){return re.simd(ue.bool(e)?e:null)}function y0(e){if(ue.object(e))if(Array.isArray(e.operation)&&e.operation.every(ue.string))re.block(e.operation,!0);else throw ue.invalidParameterError("operation","Array<string>",e.operation);else throw ue.invalidParameterError("options","object",e)}function w0(e){if(ue.object(e))if(Array.isArray(e.operation)&&e.operation.every(ue.string))re.block(e.operation,!1);else throw ue.invalidParameterError("operation","Array<string>",e.operation);else throw ue.invalidParameterError("options","object",e)}wa.exports=e=>{e.cache=ya,e.concurrency=d0,e.counters=p0,e.simd=b0,e.format=je,e.interpolators=m0,e.versions=nt,e.queue=g0,e.block=y0,e.unblock=w0}});var va=D((Mh,Pa)=>{var Te=Bi();Ni()(Te);Ui()(Te);Vi()(Te);Ki()(Te);ca()(Te);ua()(Te);pa()(Te);Ea()(Te);Pa.exports=Te});var U0={};Ka(U0,{detectInputType:()=>Vr,generatePalette:()=>Ba,generatePaletteFromDataUri:()=>Xr,generatePaletteFromHex:()=>Wr,generatePaletteFromPath:()=>Jr,generatePaletteFromUrl:()=>Yr,listAlgorithms:()=>Fa});module.exports=Qa(U0);var Ta=nr(require("node:fs/promises")),La=nr(require("node:path")),Gr=nr(va());function Q(e){return e<0?-1:e===0?0:1}function ze(e,t,r){return(1-r)*e+r*t}function xa(e,t,r){return r<e?e:r>t?t:r}function it(e,t,r){return r<e?e:r>t?t:r}function Ut(e){return e=e%360,e<0&&(e=e+360),e}function fe(e){return e=e%360,e<0&&(e=e+360),e}function Dr(e,t){return 180-Math.abs(Math.abs(e-t)-180)}function gt(e,t){let r=e[0]*t[0][0]+e[1]*t[0][1]+e[2]*t[0][2],n=e[0]*t[1][0]+e[1]*t[1][1]+e[2]*t[1][2],i=e[0]*t[2][0]+e[1]*t[2][1]+e[2]*t[2][2];return[r,n,i]}var Aa=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],E0=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],Fr=[95.047,100,108.883];function Ge(e,t,r){return(255<<24|(e&255)<<16|(t&255)<<8|r&255)>>>0}function Br(e){let t=Ue(e[0]),r=Ue(e[1]),n=Ue(e[2]);return Ge(t,r,n)}function Ia(e){return e>>24&255}function at(e){return e>>16&255}function ot(e){return e>>8&255}function st(e){return e&255}function jr(e,t,r){let n=E0,i=n[0][0]*e+n[0][1]*t+n[0][2]*r,a=n[1][0]*e+n[1][1]*t+n[1][2]*r,o=n[2][0]*e+n[2][1]*t+n[2][2]*r,l=Ue(i),c=Ue(a),f=Ue(o);return Ge(l,c,f)}function P0(e){let t=ke(at(e)),r=ke(ot(e)),n=ke(st(e));return gt([t,r,n],Aa)}function ka(e,t,r){let n=Fr,i=(e+16)/116,a=t/500+i,o=i-r/200,l=Gt(a),c=Gt(i),f=Gt(o),d=l*n[0],g=c*n[1],b=f*n[2];return jr(d,g,b)}function $r(e){let t=ke(at(e)),r=ke(ot(e)),n=ke(st(e)),i=Aa,a=i[0][0]*t+i[0][1]*r+i[0][2]*n,o=i[1][0]*t+i[1][1]*r+i[1][2]*n,l=i[2][0]*t+i[2][1]*r+i[2][2]*n,c=Fr,f=a/c[0],d=o/c[1],g=l/c[2],b=pt(f),p=pt(d),I=pt(g),w=116*p-16,R=500*(b-p),F=200*(p-I);return[w,R,F]}function Ca(e){let t=me(e),r=Ue(t);return Ge(r,r,r)}function Vt(e){let t=P0(e)[1];return 116*pt(t/100)-16}function me(e){return 100*Gt((e+16)/116)}function bt(e){return pt(e/100)*116-16}function ke(e){let t=e/255;return t<=.040449936?t/12.92*100:Math.pow((t+.055)/1.055,2.4)*100}function Ue(e){let t=e/100,r=0;return t<=.0031308?r=t*12.92:r=1.055*Math.pow(t,1/2.4)-.055,xa(0,255,Math.round(r*255))}function Ra(){return Fr}function pt(e){let t=.008856451679035631,r=24389/27;return e>t?Math.pow(e,1/3):(r*e+16)/116}function Gt(e){let t=.008856451679035631,r=24389/27,n=e*e*e;return n>t?n:(116*e-16)/r}var ce=class e{static make(t=Ra(),r=200/Math.PI*me(50)/100,n=50,i=2,a=!1){let o=t,l=o[0]*.401288+o[1]*.650173+o[2]*-.051461,c=o[0]*-.250268+o[1]*1.204414+o[2]*.045854,f=o[0]*-.002079+o[1]*.048952+o[2]*.953127,d=.8+i/10,g=d>=.9?ze(.59,.69,(d-.9)*10):ze(.525,.59,(d-.8)*10),b=a?1:d*(1-1/3.6*Math.exp((-r-42)/92));b=b>1?1:b<0?0:b;let p=d,I=[b*(100/l)+1-b,b*(100/c)+1-b,b*(100/f)+1-b],w=1/(5*r+1),R=w*w*w*w,F=1-R,y=R*r+.1*F*F*Math.cbrt(5*r),x=me(n)/t[1],B=1.48+Math.sqrt(x),T=.725/Math.pow(x,.2),H=T,A=[Math.pow(y*I[0]*l/100,.42),Math.pow(y*I[1]*c/100,.42),Math.pow(y*I[2]*f/100,.42)],M=[400*A[0]/(A[0]+27.13),400*A[1]/(A[1]+27.13),400*A[2]/(A[2]+27.13)],$=(2*M[0]+M[1]+.05*M[2])*T;return new e(x,$,T,H,g,p,I,y,Math.pow(y,.25),B)}constructor(t,r,n,i,a,o,l,c,f,d){this.n=t,this.aw=r,this.nbb=n,this.ncb=i,this.c=a,this.nc=o,this.rgbD=l,this.fl=c,this.fLRoot=f,this.z=d}};ce.DEFAULT=ce.make();var Ce=class e{constructor(t,r,n,i,a,o,l,c,f){this.hue=t,this.chroma=r,this.j=n,this.q=i,this.m=a,this.s=o,this.jstar=l,this.astar=c,this.bstar=f}distance(t){let r=this.jstar-t.jstar,n=this.astar-t.astar,i=this.bstar-t.bstar,a=Math.sqrt(r*r+n*n+i*i);return 1.41*Math.pow(a,.63)}static fromInt(t){return e.fromIntInViewingConditions(t,ce.DEFAULT)}static fromIntInViewingConditions(t,r){let n=(t&16711680)>>16,i=(t&65280)>>8,a=t&255,o=ke(n),l=ke(i),c=ke(a),f=.41233895*o+.35762064*l+.18051042*c,d=.2126*o+.7152*l+.0722*c,g=.01932141*o+.11916382*l+.95034478*c,b=.401288*f+.650173*d-.051461*g,p=-.250268*f+1.204414*d+.045854*g,I=-.002079*f+.048952*d+.953127*g,w=r.rgbD[0]*b,R=r.rgbD[1]*p,F=r.rgbD[2]*I,y=Math.pow(r.fl*Math.abs(w)/100,.42),x=Math.pow(r.fl*Math.abs(R)/100,.42),B=Math.pow(r.fl*Math.abs(F)/100,.42),T=Q(w)*400*y/(y+27.13),H=Q(R)*400*x/(x+27.13),A=Q(F)*400*B/(B+27.13),M=(11*T+-12*H+A)/11,$=(T+H-2*A)/9,j=(20*T+20*H+21*A)/20,Z=(40*T+20*H+A)/20,oe=Math.atan2($,M)*180/Math.PI,V=oe<0?oe+360:oe>=360?oe-360:oe,$e=V*Math.PI/180,xt=Z*r.nbb,Le=100*Math.pow(xt/r.aw,r.c*r.z),At=4/r.c*Math.sqrt(Le/100)*(r.aw+4)*r.fLRoot,Zt=V<20.14?V+360:V,er=.25*(Math.cos(Zt*Math.PI/180+2)+3.8),rr=5e4/13*er*r.nc*r.ncb*Math.sqrt(M*M+$*$)/(j+.305),It=Math.pow(rr,.9)*Math.pow(1.64-Math.pow(.29,r.n),.73),Zr=It*Math.sqrt(Le/100),en=Zr*r.fLRoot,_a=50*Math.sqrt(It*r.c/(r.aw+4)),za=(1+100*.007)*Le/(1+.007*Le),tn=1/.0228*Math.log(1+.0228*en),Ua=tn*Math.cos($e),Ga=tn*Math.sin($e);return new e(V,Zr,Le,At,en,_a,za,Ua,Ga)}static fromJch(t,r,n){return e.fromJchInViewingConditions(t,r,n,ce.DEFAULT)}static fromJchInViewingConditions(t,r,n,i){let a=4/i.c*Math.sqrt(t/100)*(i.aw+4)*i.fLRoot,o=r*i.fLRoot,l=r/Math.sqrt(t/100),c=50*Math.sqrt(l*i.c/(i.aw+4)),f=n*Math.PI/180,d=(1+100*.007)*t/(1+.007*t),g=1/.0228*Math.log(1+.0228*o),b=g*Math.cos(f),p=g*Math.sin(f);return new e(n,r,t,a,o,c,d,b,p)}static fromUcs(t,r,n){return e.fromUcsInViewingConditions(t,r,n,ce.DEFAULT)}static fromUcsInViewingConditions(t,r,n,i){let a=r,o=n,l=Math.sqrt(a*a+o*o),f=(Math.exp(l*.0228)-1)/.0228/i.fLRoot,d=Math.atan2(o,a)*(180/Math.PI);d<0&&(d+=360);let g=t/(1-(t-100)*.007);return e.fromJchInViewingConditions(g,f,d,i)}toInt(){return this.viewed(ce.DEFAULT)}viewed(t){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),n=Math.pow(r/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),i=this.hue*Math.PI/180,a=.25*(Math.cos(i+2)+3.8),o=t.aw*Math.pow(this.j/100,1/t.c/t.z),l=a*(5e4/13)*t.nc*t.ncb,c=o/t.nbb,f=Math.sin(i),d=Math.cos(i),g=23*(c+.305)*n/(23*l+11*n*d+108*n*f),b=g*d,p=g*f,I=(460*c+451*b+288*p)/1403,w=(460*c-891*b-261*p)/1403,R=(460*c-220*b-6300*p)/1403,F=Math.max(0,27.13*Math.abs(I)/(400-Math.abs(I))),y=Q(I)*(100/t.fl)*Math.pow(F,1/.42),x=Math.max(0,27.13*Math.abs(w)/(400-Math.abs(w))),B=Q(w)*(100/t.fl)*Math.pow(x,1/.42),T=Math.max(0,27.13*Math.abs(R)/(400-Math.abs(R))),H=Q(R)*(100/t.fl)*Math.pow(T,1/.42),A=y/t.rgbD[0],M=B/t.rgbD[1],$=H/t.rgbD[2],j=1.86206786*A-1.01125463*M+.14918677*$,Z=.38752654*A+.62144744*M-.00897398*$,he=-.0158415*A-.03412294*M+1.04996444*$;return jr(j,Z,he)}static fromXyzInViewingConditions(t,r,n,i){let a=.401288*t+.650173*r-.051461*n,o=-.250268*t+1.204414*r+.045854*n,l=-.002079*t+.048952*r+.953127*n,c=i.rgbD[0]*a,f=i.rgbD[1]*o,d=i.rgbD[2]*l,g=Math.pow(i.fl*Math.abs(c)/100,.42),b=Math.pow(i.fl*Math.abs(f)/100,.42),p=Math.pow(i.fl*Math.abs(d)/100,.42),I=Q(c)*400*g/(g+27.13),w=Q(f)*400*b/(b+27.13),R=Q(d)*400*p/(p+27.13),F=(11*I+-12*w+R)/11,y=(I+w-2*R)/9,x=(20*I+20*w+21*R)/20,B=(40*I+20*w+R)/20,H=Math.atan2(y,F)*180/Math.PI,A=H<0?H+360:H>=360?H-360:H,M=A*Math.PI/180,$=B*i.nbb,j=100*Math.pow($/i.aw,i.c*i.z),Z=4/i.c*Math.sqrt(j/100)*(i.aw+4)*i.fLRoot,he=A<20.14?A+360:A,oe=1/4*(Math.cos(he*Math.PI/180+2)+3.8),$e=5e4/13*oe*i.nc*i.ncb*Math.sqrt(F*F+y*y)/(x+.305),xt=Math.pow($e,.9)*Math.pow(1.64-Math.pow(.29,i.n),.73),Le=xt*Math.sqrt(j/100),At=Le*i.fLRoot,Zt=50*Math.sqrt(xt*i.c/(i.aw+4)),er=(1+100*.007)*j/(1+.007*j),tr=Math.log(1+.0228*At)/.0228,rr=tr*Math.cos(M),It=tr*Math.sin(M);return new e(A,Le,j,Z,At,Zt,er,rr,It)}xyzInViewingConditions(t){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),n=Math.pow(r/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),i=this.hue*Math.PI/180,a=.25*(Math.cos(i+2)+3.8),o=t.aw*Math.pow(this.j/100,1/t.c/t.z),l=a*(5e4/13)*t.nc*t.ncb,c=o/t.nbb,f=Math.sin(i),d=Math.cos(i),g=23*(c+.305)*n/(23*l+11*n*d+108*n*f),b=g*d,p=g*f,I=(460*c+451*b+288*p)/1403,w=(460*c-891*b-261*p)/1403,R=(460*c-220*b-6300*p)/1403,F=Math.max(0,27.13*Math.abs(I)/(400-Math.abs(I))),y=Q(I)*(100/t.fl)*Math.pow(F,1/.42),x=Math.max(0,27.13*Math.abs(w)/(400-Math.abs(w))),B=Q(w)*(100/t.fl)*Math.pow(x,1/.42),T=Math.max(0,27.13*Math.abs(R)/(400-Math.abs(R))),H=Q(R)*(100/t.fl)*Math.pow(T,1/.42),A=y/t.rgbD[0],M=B/t.rgbD[1],$=H/t.rgbD[2],j=1.86206786*A-1.01125463*M+.14918677*$,Z=.38752654*A+.62144744*M-.00897398*$,he=-.0158415*A-.03412294*M+1.04996444*$;return[j,Z,he]}};var ge=class e{static sanitizeRadians(t){return(t+Math.PI*8)%(Math.PI*2)}static trueDelinearized(t){let r=t/100,n=0;return r<=.0031308?n=r*12.92:n=1.055*Math.pow(r,1/2.4)-.055,n*255}static chromaticAdaptation(t){let r=Math.pow(Math.abs(t),.42);return Q(t)*400*r/(r+27.13)}static hueOf(t){let r=gt(t,e.SCALED_DISCOUNT_FROM_LINRGB),n=e.chromaticAdaptation(r[0]),i=e.chromaticAdaptation(r[1]),a=e.chromaticAdaptation(r[2]),o=(11*n+-12*i+a)/11,l=(n+i-2*a)/9;return Math.atan2(l,o)}static areInCyclicOrder(t,r,n){let i=e.sanitizeRadians(r-t),a=e.sanitizeRadians(n-t);return i<a}static intercept(t,r,n){return(r-t)/(n-t)}static lerpPoint(t,r,n){return[t[0]+(n[0]-t[0])*r,t[1]+(n[1]-t[1])*r,t[2]+(n[2]-t[2])*r]}static setCoordinate(t,r,n,i){let a=e.intercept(t[i],r,n[i]);return e.lerpPoint(t,a,n)}static isBounded(t){return 0<=t&&t<=100}static nthVertex(t,r){let n=e.Y_FROM_LINRGB[0],i=e.Y_FROM_LINRGB[1],a=e.Y_FROM_LINRGB[2],o=r%4<=1?0:100,l=r%2===0?0:100;if(r<4){let c=o,f=l,d=(t-c*i-f*a)/n;return e.isBounded(d)?[d,c,f]:[-1,-1,-1]}else if(r<8){let c=o,f=l,d=(t-f*n-c*a)/i;return e.isBounded(d)?[f,d,c]:[-1,-1,-1]}else{let c=o,f=l,d=(t-c*n-f*i)/a;return e.isBounded(d)?[c,f,d]:[-1,-1,-1]}}static bisectToSegment(t,r){let n=[-1,-1,-1],i=n,a=0,o=0,l=!1,c=!0;for(let f=0;f<12;f++){let d=e.nthVertex(t,f);if(d[0]<0)continue;let g=e.hueOf(d);if(!l){n=d,i=d,a=g,o=g,l=!0;continue}(c||e.areInCyclicOrder(a,g,o))&&(c=!1,e.areInCyclicOrder(a,r,g)?(i=d,o=g):(n=d,a=g))}return[n,i]}static midpoint(t,r){return[(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2]}static criticalPlaneBelow(t){return Math.floor(t-.5)}static criticalPlaneAbove(t){return Math.ceil(t-.5)}static bisectToLimit(t,r){let n=e.bisectToSegment(t,r),i=n[0],a=e.hueOf(i),o=n[1];for(let l=0;l<3;l++)if(i[l]!==o[l]){let c=-1,f=255;i[l]<o[l]?(c=e.criticalPlaneBelow(e.trueDelinearized(i[l])),f=e.criticalPlaneAbove(e.trueDelinearized(o[l]))):(c=e.criticalPlaneAbove(e.trueDelinearized(i[l])),f=e.criticalPlaneBelow(e.trueDelinearized(o[l])));for(let d=0;d<8&&!(Math.abs(f-c)<=1);d++){let g=Math.floor((c+f)/2),b=e.CRITICAL_PLANES[g],p=e.setCoordinate(i,b,o,l),I=e.hueOf(p);e.areInCyclicOrder(a,r,I)?(o=p,f=g):(i=p,a=I,c=g)}}return e.midpoint(i,o)}static inverseChromaticAdaptation(t){let r=Math.abs(t),n=Math.max(0,27.13*r/(400-r));return Q(t)*Math.pow(n,1/.42)}static findResultByJ(t,r,n){let i=Math.sqrt(n)*11,a=ce.DEFAULT,o=1/Math.pow(1.64-Math.pow(.29,a.n),.73),c=.25*(Math.cos(t+2)+3.8)*(5e4/13)*a.nc*a.ncb,f=Math.sin(t),d=Math.cos(t);for(let g=0;g<5;g++){let b=i/100,p=r===0||i===0?0:r/Math.sqrt(b),I=Math.pow(p*o,1/.9),R=a.aw*Math.pow(b,1/a.c/a.z)/a.nbb,F=23*(R+.305)*I/(23*c+11*I*d+108*I*f),y=F*d,x=F*f,B=(460*R+451*y+288*x)/1403,T=(460*R-891*y-261*x)/1403,H=(460*R-220*y-6300*x)/1403,A=e.inverseChromaticAdaptation(B),M=e.inverseChromaticAdaptation(T),$=e.inverseChromaticAdaptation(H),j=gt([A,M,$],e.LINRGB_FROM_SCALED_DISCOUNT);if(j[0]<0||j[1]<0||j[2]<0)return 0;let Z=e.Y_FROM_LINRGB[0],he=e.Y_FROM_LINRGB[1],oe=e.Y_FROM_LINRGB[2],V=Z*j[0]+he*j[1]+oe*j[2];if(V<=0)return 0;if(g===4||Math.abs(V-n)<.002)return j[0]>100.01||j[1]>100.01||j[2]>100.01?0:Br(j);i=i-(V-n)*i/(2*V)}return 0}static solveToInt(t,r,n){if(r<1e-4||n<1e-4||n>99.9999)return Ca(n);t=fe(t);let i=t/180*Math.PI,a=me(n),o=e.findResultByJ(i,r,a);if(o!==0)return o;let l=e.bisectToLimit(a,i);return Br(l)}static solveToCam(t,r,n){return Ce.fromInt(e.solveToInt(t,r,n))}};ge.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]];ge.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]];ge.Y_FROM_LINRGB=[.2126,.7152,.0722];ge.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];var _=class e{static from(t,r,n){return new e(ge.solveToInt(t,r,n))}static fromInt(t){return new e(t)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(t){this.setInternalState(ge.solveToInt(t,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(t){this.setInternalState(ge.solveToInt(this.internalHue,t,this.internalTone))}get tone(){return this.internalTone}set tone(t){this.setInternalState(ge.solveToInt(this.internalHue,this.internalChroma,t))}constructor(t){this.argb=t;let r=Ce.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Vt(t),this.argb=t}setInternalState(t){let r=Ce.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Vt(t),this.argb=t}inViewingConditions(t){let n=Ce.fromInt(this.toInt()).xyzInViewingConditions(t),i=Ce.fromXyzInViewingConditions(n[0],n[1],n[2],ce.make());return e.from(i.hue,i.chroma,bt(n[1]))}};var ie=class e{static ratioOfTones(t,r){return t=it(0,100,t),r=it(0,100,r),e.ratioOfYs(me(t),me(r))}static ratioOfYs(t,r){let n=t>r?t:r,i=n===r?t:r;return(n+5)/(i+5)}static lighter(t,r){if(t<0||t>100)return-1;let n=me(t),i=r*(n+5)-5,a=e.ratioOfYs(i,n),o=Math.abs(a-r);if(a<r&&o>.04)return-1;let l=bt(i)+.4;return l<0||l>100?-1:l}static darker(t,r){if(t<0||t>100)return-1;let n=me(t),i=(n+5)/r-5,a=e.ratioOfYs(n,i),o=Math.abs(a-r);if(a<r&&o>.04)return-1;let l=bt(i)-.4;return l<0||l>100?-1:l}static lighterUnsafe(t,r){let n=e.lighter(t,r);return n<0?100:n}static darkerUnsafe(t,r){let n=e.darker(t,r);return n<0?0:n}};var lt=class e{static isDisliked(t){let r=Math.round(t.hue)>=90&&Math.round(t.hue)<=111,n=Math.round(t.chroma)>16,i=Math.round(t.tone)<65;return r&&n&&i}static fixIfDisliked(t){return e.isDisliked(t)?_.from(t.hue,t.chroma,70):t}};var k=class e{static fromPalette(t){return new e(t.name??"",t.palette,t.tone,t.isBackground??!1,t.background,t.secondBackground,t.contrastCurve,t.toneDeltaPair)}constructor(t,r,n,i,a,o,l,c){if(this.name=t,this.palette=r,this.tone=n,this.isBackground=i,this.background=a,this.secondBackground=o,this.contrastCurve=l,this.toneDeltaPair=c,this.hctCache=new Map,!a&&o)throw new Error(`Color ${t} has secondBackgrounddefined, but background is not defined.`);if(!a&&l)throw new Error(`Color ${t} has contrastCurvedefined, but background is not defined.`);if(a&&!l)throw new Error(`Color ${t} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(t){return this.getHct(t).toInt()}getHct(t){let r=this.hctCache.get(t);if(r!=null)return r;let n=this.getTone(t),i=this.palette(t).getHct(n);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,i),i}getTone(t){let r=t.contrastLevel<0;if(this.toneDeltaPair){let n=this.toneDeltaPair(t),i=n.roleA,a=n.roleB,o=n.delta,l=n.polarity,c=n.stayTogether,d=this.background(t).getTone(t),g=l==="nearer"||l==="lighter"&&!t.isDark||l==="darker"&&t.isDark,b=g?i:a,p=g?a:i,I=this.name===b.name,w=t.isDark?1:-1,R=b.contrastCurve.get(t.contrastLevel),F=p.contrastCurve.get(t.contrastLevel),y=b.tone(t),x=ie.ratioOfTones(d,y)>=R?y:e.foregroundTone(d,R),B=p.tone(t),T=ie.ratioOfTones(d,B)>=F?B:e.foregroundTone(d,F);return r&&(x=e.foregroundTone(d,R),T=e.foregroundTone(d,F)),(T-x)*w>=o||(T=it(0,100,x+o*w),(T-x)*w>=o||(x=it(0,100,T-o*w))),50<=x&&x<60?w>0?(x=60,T=Math.max(T,x+o*w)):(x=49,T=Math.min(T,x+o*w)):50<=T&&T<60&&(c?w>0?(x=60,T=Math.max(T,x+o*w)):(x=49,T=Math.min(T,x+o*w)):w>0?T=60:T=49),I?x:T}else{let n=this.tone(t);if(this.background==null)return n;let i=this.background(t).getTone(t),a=this.contrastCurve.get(t.contrastLevel);if(ie.ratioOfTones(i,n)>=a||(n=e.foregroundTone(i,a)),r&&(n=e.foregroundTone(i,a)),this.isBackground&&50<=n&&n<60&&(ie.ratioOfTones(49,i)>=a?n=49:n=60),this.secondBackground){let[o,l]=[this.background,this.secondBackground],[c,f]=[o(t).getTone(t),l(t).getTone(t)],[d,g]=[Math.max(c,f),Math.min(c,f)];if(ie.ratioOfTones(d,n)>=a&&ie.ratioOfTones(g,n)>=a)return n;let b=ie.lighter(d,a),p=ie.darker(g,a),I=[];return b!==-1&&I.push(b),p!==-1&&I.push(p),e.tonePrefersLightForeground(c)||e.tonePrefersLightForeground(f)?b<0?100:b:I.length===1?I[0]:p<0?0:p}return n}}static foregroundTone(t,r){let n=ie.lighterUnsafe(t,r),i=ie.darkerUnsafe(t,r),a=ie.ratioOfTones(n,t),o=ie.ratioOfTones(i,t);if(e.tonePrefersLightForeground(t)){let c=Math.abs(a-o)<.1&&a<r&&o<r;return a>=r||a>=o||c?n:i}else return o>=r||o>=a?i:n}static tonePrefersLightForeground(t){return Math.round(t)<60}static toneAllowsLightForeground(t){return Math.round(t)<=49}static enableLightForeground(t){return e.tonePrefersLightForeground(t)&&!e.toneAllowsLightForeground(t)?49:t}};var O=class e{static fromInt(t){let r=_.fromInt(t);return e.fromHct(r)}static fromHct(t){return new e(t.hue,t.chroma,t)}static fromHueAndChroma(t,r){let n=new Nr(t,r).create();return new e(t,r,n)}constructor(t,r,n){this.hue=t,this.chroma=r,this.keyColor=n,this.cache=new Map}tone(t){let r=this.cache.get(t);return r===void 0&&(r=_.from(this.hue,this.chroma,t).toInt(),this.cache.set(t,r)),r}getHct(t){return _.fromInt(this.tone(t))}},Nr=class{constructor(t,r){this.hue=t,this.requestedChroma=r,this.chromaCache=new Map,this.maxChromaValue=200}create(){let i=0,a=100;for(;i<a;){let o=Math.floor((i+a)/2),l=this.maxChroma(o)<this.maxChroma(o+1);if(this.maxChroma(o)>=this.requestedChroma-.01)if(Math.abs(i-50)<Math.abs(a-50))a=o;else{if(i===o)return _.from(this.hue,this.requestedChroma,i);i=o}else l?i=o+1:a=o}return _.from(this.hue,this.requestedChroma,i)}maxChroma(t){if(this.chromaCache.has(t))return this.chromaCache.get(t);let r=_.from(this.hue,this.maxChromaValue,t).chroma;return this.chromaCache.set(t,r),r}};var S=class{constructor(t,r,n,i){this.low=t,this.normal=r,this.medium=n,this.high=i}get(t){return t<=-1?this.low:t<0?ze(this.low,this.normal,(t- -1)/1):t<.5?ze(this.normal,this.medium,(t-0)/.5):t<1?ze(this.medium,this.high,(t-.5)/.5):this.high}};var X=class{constructor(t,r,n,i,a){this.roleA=t,this.roleB=r,this.delta=n,this.polarity=i,this.stayTogether=a}};var Y;(function(e){e[e.MONOCHROME=0]="MONOCHROME",e[e.NEUTRAL=1]="NEUTRAL",e[e.TONAL_SPOT=2]="TONAL_SPOT",e[e.VIBRANT=3]="VIBRANT",e[e.EXPRESSIVE=4]="EXPRESSIVE",e[e.FIDELITY=5]="FIDELITY",e[e.CONTENT=6]="CONTENT",e[e.RAINBOW=7]="RAINBOW",e[e.FRUIT_SALAD=8]="FRUIT_SALAD"})(Y||(Y={}));function ct(e){return e.variant===Y.FIDELITY||e.variant===Y.CONTENT}function z(e){return e.variant===Y.MONOCHROME}function v0(e,t,r,n){let i=r,a=_.from(e,t,r);if(a.chroma<t){let o=a.chroma;for(;a.chroma<t;){i+=n?-1:1;let l=_.from(e,t,i);if(o>l.chroma||Math.abs(l.chroma-t)<.4)break;let c=Math.abs(l.chroma-t),f=Math.abs(a.chroma-t);c<f&&(a=l),o=Math.max(o,l.chroma)}}return i}var u=class e{static highestSurface(t){return t.isDark?e.surfaceBright:e.surfaceDim}};u.contentAccentToneDelta=15;u.primaryPaletteKeyColor=k.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone});u.secondaryPaletteKeyColor=k.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone});u.tertiaryPaletteKeyColor=k.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone});u.neutralPaletteKeyColor=k.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone});u.neutralVariantPaletteKeyColor=k.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone});u.background=k.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0});u.onBackground=k.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>u.background,contrastCurve:new S(3,3,4.5,7)});u.surface=k.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0});u.surfaceDim=k.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new S(87,87,80,75).get(e.contrastLevel),isBackground:!0});u.surfaceBright=k.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new S(24,24,29,34).get(e.contrastLevel):98,isBackground:!0});u.surfaceContainerLowest=k.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new S(4,4,2,0).get(e.contrastLevel):100,isBackground:!0});u.surfaceContainerLow=k.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new S(10,10,11,12).get(e.contrastLevel):new S(96,96,96,95).get(e.contrastLevel),isBackground:!0});u.surfaceContainer=k.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new S(12,12,16,20).get(e.contrastLevel):new S(94,94,92,90).get(e.contrastLevel),isBackground:!0});u.surfaceContainerHigh=k.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new S(17,17,21,25).get(e.contrastLevel):new S(92,92,88,85).get(e.contrastLevel),isBackground:!0});u.surfaceContainerHighest=k.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new S(22,22,26,30).get(e.contrastLevel):new S(90,90,84,80).get(e.contrastLevel),isBackground:!0});u.onSurface=k.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>u.highestSurface(e),contrastCurve:new S(4.5,7,11,21)});u.surfaceVariant=k.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0});u.onSurfaceVariant=k.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>u.highestSurface(e),contrastCurve:new S(3,4.5,7,11)});u.inverseSurface=k.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20});u.inverseOnSurface=k.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>u.inverseSurface,contrastCurve:new S(4.5,7,11,21)});u.outline=k.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>u.highestSurface(e),contrastCurve:new S(1.5,3,4.5,7)});u.outlineVariant=k.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5)});u.shadow=k.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0});u.scrim=k.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0});u.surfaceTint=k.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0});u.primary=k.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>z(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(3,4.5,7,7),toneDeltaPair:e=>new X(u.primaryContainer,u.primary,10,"nearer",!1)});u.onPrimary=k.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>z(e)?e.isDark?10:90:e.isDark?20:100,background:e=>u.primary,contrastCurve:new S(4.5,7,11,21)});u.primaryContainer=k.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>ct(e)?e.sourceColorHct.tone:z(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.primaryContainer,u.primary,10,"nearer",!1)});u.onPrimaryContainer=k.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>ct(e)?k.foregroundTone(u.primaryContainer.tone(e),4.5):z(e)?e.isDark?0:100:e.isDark?90:30,background:e=>u.primaryContainer,contrastCurve:new S(3,4.5,7,11)});u.inversePrimary=k.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>u.inverseSurface,contrastCurve:new S(3,4.5,7,7)});u.secondary=k.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(3,4.5,7,7),toneDeltaPair:e=>new X(u.secondaryContainer,u.secondary,10,"nearer",!1)});u.onSecondary=k.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>z(e)?e.isDark?10:100:e.isDark?20:100,background:e=>u.secondary,contrastCurve:new S(4.5,7,11,21)});u.secondaryContainer=k.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{let t=e.isDark?30:90;return z(e)?e.isDark?30:85:ct(e)?v0(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark):t},isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.secondaryContainer,u.secondary,10,"nearer",!1)});u.onSecondaryContainer=k.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>z(e)?e.isDark?90:10:ct(e)?k.foregroundTone(u.secondaryContainer.tone(e),4.5):e.isDark?90:30,background:e=>u.secondaryContainer,contrastCurve:new S(3,4.5,7,11)});u.tertiary=k.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>z(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(3,4.5,7,7),toneDeltaPair:e=>new X(u.tertiaryContainer,u.tertiary,10,"nearer",!1)});u.onTertiary=k.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>z(e)?e.isDark?10:90:e.isDark?20:100,background:e=>u.tertiary,contrastCurve:new S(4.5,7,11,21)});u.tertiaryContainer=k.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(z(e))return e.isDark?60:49;if(!ct(e))return e.isDark?30:90;let t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return lt.fixIfDisliked(t).tone},isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.tertiaryContainer,u.tertiary,10,"nearer",!1)});u.onTertiaryContainer=k.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>z(e)?e.isDark?0:100:ct(e)?k.foregroundTone(u.tertiaryContainer.tone(e),4.5):e.isDark?90:30,background:e=>u.tertiaryContainer,contrastCurve:new S(3,4.5,7,11)});u.error=k.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(3,4.5,7,7),toneDeltaPair:e=>new X(u.errorContainer,u.error,10,"nearer",!1)});u.onError=k.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>u.error,contrastCurve:new S(4.5,7,11,21)});u.errorContainer=k.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.errorContainer,u.error,10,"nearer",!1)});u.onErrorContainer=k.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>z(e)?e.isDark?90:10:e.isDark?90:30,background:e=>u.errorContainer,contrastCurve:new S(3,4.5,7,11)});u.primaryFixed=k.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>z(e)?40:90,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.primaryFixed,u.primaryFixedDim,10,"lighter",!0)});u.primaryFixedDim=k.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>z(e)?30:80,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.primaryFixed,u.primaryFixedDim,10,"lighter",!0)});u.onPrimaryFixed=k.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>z(e)?100:10,background:e=>u.primaryFixedDim,secondBackground:e=>u.primaryFixed,contrastCurve:new S(4.5,7,11,21)});u.onPrimaryFixedVariant=k.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>z(e)?90:30,background:e=>u.primaryFixedDim,secondBackground:e=>u.primaryFixed,contrastCurve:new S(3,4.5,7,11)});u.secondaryFixed=k.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>z(e)?80:90,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.secondaryFixed,u.secondaryFixedDim,10,"lighter",!0)});u.secondaryFixedDim=k.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>z(e)?70:80,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.secondaryFixed,u.secondaryFixedDim,10,"lighter",!0)});u.onSecondaryFixed=k.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>u.secondaryFixedDim,secondBackground:e=>u.secondaryFixed,contrastCurve:new S(4.5,7,11,21)});u.onSecondaryFixedVariant=k.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>z(e)?25:30,background:e=>u.secondaryFixedDim,secondBackground:e=>u.secondaryFixed,contrastCurve:new S(3,4.5,7,11)});u.tertiaryFixed=k.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>z(e)?40:90,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.tertiaryFixed,u.tertiaryFixedDim,10,"lighter",!0)});u.tertiaryFixedDim=k.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>z(e)?30:80,isBackground:!0,background:e=>u.highestSurface(e),contrastCurve:new S(1,1,3,4.5),toneDeltaPair:e=>new X(u.tertiaryFixed,u.tertiaryFixedDim,10,"lighter",!0)});u.onTertiaryFixed=k.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>z(e)?100:10,background:e=>u.tertiaryFixedDim,secondBackground:e=>u.tertiaryFixed,contrastCurve:new S(4.5,7,11,21)});u.onTertiaryFixedVariant=k.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>z(e)?90:30,background:e=>u.tertiaryFixedDim,secondBackground:e=>u.tertiaryFixed,contrastCurve:new S(3,4.5,7,11)});var J=class{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.variant,this.contrastLevel=t.contrastLevel,this.isDark=t.isDark,this.sourceColorHct=_.fromInt(t.sourceColorArgb),this.primaryPalette=t.primaryPalette,this.secondaryPalette=t.secondaryPalette,this.tertiaryPalette=t.tertiaryPalette,this.neutralPalette=t.neutralPalette,this.neutralVariantPalette=t.neutralVariantPalette,this.errorPalette=O.fromHueAndChroma(25,84)}static getRotatedHue(t,r,n){let i=t.hue;if(r.length!==n.length)throw new Error(`mismatch between hue length ${r.length} & rotations ${n.length}`);if(n.length===1)return fe(t.hue+n[0]);let a=r.length;for(let o=0;o<=a-2;o++){let l=r[o],c=r[o+1];if(l<i&&i<c)return fe(i+n[o])}return i}getArgb(t){return t.getArgb(this)}getHct(t){return t.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(u.primaryPaletteKeyColor)}get secondaryPaletteKeyColor(){return this.getArgb(u.secondaryPaletteKeyColor)}get tertiaryPaletteKeyColor(){return this.getArgb(u.tertiaryPaletteKeyColor)}get neutralPaletteKeyColor(){return this.getArgb(u.neutralPaletteKeyColor)}get neutralVariantPaletteKeyColor(){return this.getArgb(u.neutralVariantPaletteKeyColor)}get background(){return this.getArgb(u.background)}get onBackground(){return this.getArgb(u.onBackground)}get surface(){return this.getArgb(u.surface)}get surfaceDim(){return this.getArgb(u.surfaceDim)}get surfaceBright(){return this.getArgb(u.surfaceBright)}get surfaceContainerLowest(){return this.getArgb(u.surfaceContainerLowest)}get surfaceContainerLow(){return this.getArgb(u.surfaceContainerLow)}get surfaceContainer(){return this.getArgb(u.surfaceContainer)}get surfaceContainerHigh(){return this.getArgb(u.surfaceContainerHigh)}get surfaceContainerHighest(){return this.getArgb(u.surfaceContainerHighest)}get onSurface(){return this.getArgb(u.onSurface)}get surfaceVariant(){return this.getArgb(u.surfaceVariant)}get onSurfaceVariant(){return this.getArgb(u.onSurfaceVariant)}get inverseSurface(){return this.getArgb(u.inverseSurface)}get inverseOnSurface(){return this.getArgb(u.inverseOnSurface)}get outline(){return this.getArgb(u.outline)}get outlineVariant(){return this.getArgb(u.outlineVariant)}get shadow(){return this.getArgb(u.shadow)}get scrim(){return this.getArgb(u.scrim)}get surfaceTint(){return this.getArgb(u.surfaceTint)}get primary(){return this.getArgb(u.primary)}get onPrimary(){return this.getArgb(u.onPrimary)}get primaryContainer(){return this.getArgb(u.primaryContainer)}get onPrimaryContainer(){return this.getArgb(u.onPrimaryContainer)}get inversePrimary(){return this.getArgb(u.inversePrimary)}get secondary(){return this.getArgb(u.secondary)}get onSecondary(){return this.getArgb(u.onSecondary)}get secondaryContainer(){return this.getArgb(u.secondaryContainer)}get onSecondaryContainer(){return this.getArgb(u.onSecondaryContainer)}get tertiary(){return this.getArgb(u.tertiary)}get onTertiary(){return this.getArgb(u.onTertiary)}get tertiaryContainer(){return this.getArgb(u.tertiaryContainer)}get onTertiaryContainer(){return this.getArgb(u.onTertiaryContainer)}get error(){return this.getArgb(u.error)}get onError(){return this.getArgb(u.onError)}get errorContainer(){return this.getArgb(u.errorContainer)}get onErrorContainer(){return this.getArgb(u.onErrorContainer)}get primaryFixed(){return this.getArgb(u.primaryFixed)}get primaryFixedDim(){return this.getArgb(u.primaryFixedDim)}get onPrimaryFixed(){return this.getArgb(u.onPrimaryFixed)}get onPrimaryFixedVariant(){return this.getArgb(u.onPrimaryFixedVariant)}get secondaryFixed(){return this.getArgb(u.secondaryFixed)}get secondaryFixedDim(){return this.getArgb(u.secondaryFixedDim)}get onSecondaryFixed(){return this.getArgb(u.onSecondaryFixed)}get onSecondaryFixedVariant(){return this.getArgb(u.onSecondaryFixedVariant)}get tertiaryFixed(){return this.getArgb(u.tertiaryFixed)}get tertiaryFixedDim(){return this.getArgb(u.tertiaryFixedDim)}get onTertiaryFixed(){return this.getArgb(u.onTertiaryFixed)}get onTertiaryFixedVariant(){return this.getArgb(u.onTertiaryFixedVariant)}};var Wt=class{fromInt(t){return $r(t)}toInt(t){return ka(t[0],t[1],t[2])}distance(t,r){let n=t[0]-r[0],i=t[1]-r[1],a=t[2]-r[2];return n*n+i*i+a*a}};var x0=10,A0=3,Xt=class{static quantize(t,r,n){let i=new Map,a=new Array,o=new Array,l=new Wt,c=0;for(let y=0;y<t.length;y++){let x=t[y],B=i.get(x);B===void 0?(c++,a.push(l.fromInt(x)),o.push(x),i.set(x,1)):i.set(x,B+1)}let f=new Array;for(let y=0;y<c;y++){let x=o[y],B=i.get(x);B!==void 0&&(f[y]=B)}let d=Math.min(n,c);r.length>0&&(d=Math.min(d,r.length));let g=new Array;for(let y=0;y<r.length;y++)g.push(l.fromInt(r[y]));let b=d-g.length;if(r.length===0&&b>0)for(let y=0;y<b;y++){let x=Math.random()*100,B=Math.random()*201+-100,T=Math.random()*201+-100;g.push(new Array(x,B,T))}let p=new Array;for(let y=0;y<c;y++)p.push(Math.floor(Math.random()*d));let I=new Array;for(let y=0;y<d;y++){I.push(new Array);for(let x=0;x<d;x++)I[y].push(0)}let w=new Array;for(let y=0;y<d;y++){w.push(new Array);for(let x=0;x<d;x++)w[y].push(new Or)}let R=new Array;for(let y=0;y<d;y++)R.push(0);for(let y=0;y<x0;y++){for(let A=0;A<d;A++){for(let M=A+1;M<d;M++){let $=l.distance(g[A],g[M]);w[M][A].distance=$,w[M][A].index=A,w[A][M].distance=$,w[A][M].index=M}w[A].sort();for(let M=0;M<d;M++)I[A][M]=w[A][M].index}let x=0;for(let A=0;A<c;A++){let M=a[A],$=p[A],j=g[$],Z=l.distance(M,j),he=Z,oe=-1;for(let V=0;V<d;V++){if(w[$][V].distance>=4*Z)continue;let $e=l.distance(M,g[V]);$e<he&&(he=$e,oe=V)}oe!==-1&&Math.abs(Math.sqrt(he)-Math.sqrt(Z))>A0&&(x++,p[A]=oe)}if(x===0&&y!==0)break;let B=new Array(d).fill(0),T=new Array(d).fill(0),H=new Array(d).fill(0);for(let A=0;A<d;A++)R[A]=0;for(let A=0;A<c;A++){let M=p[A],$=a[A],j=f[A];R[M]+=j,B[M]+=$[0]*j,T[M]+=$[1]*j,H[M]+=$[2]*j}for(let A=0;A<d;A++){let M=R[A];if(M===0){g[A]=[0,0,0];continue}let $=B[A]/M,j=T[A]/M,Z=H[A]/M;g[A]=[$,j,Z]}}let F=new Map;for(let y=0;y<d;y++){let x=R[y];if(x===0)continue;let B=l.toInt(g[y]);F.has(B)||F.set(B,x)}return F}},Or=class{constructor(){this.distance=-1,this.index=-1}};var Yt=class{static quantize(t){let r=new Map;for(let n=0;n<t.length;n++){let i=t[n];Ia(i)<255||r.set(i,(r.get(i)??0)+1)}return r}};var Jt=5,pe=33,yt=35937,ae={RED:"red",GREEN:"green",BLUE:"blue"},Kt=class{constructor(t=[],r=[],n=[],i=[],a=[],o=[]){this.weights=t,this.momentsR=r,this.momentsG=n,this.momentsB=i,this.moments=a,this.cubes=o}quantize(t,r){this.constructHistogram(t),this.computeMoments();let n=this.createBoxes(r);return this.createResult(n.resultCount)}constructHistogram(t){this.weights=Array.from({length:yt}).fill(0),this.momentsR=Array.from({length:yt}).fill(0),this.momentsG=Array.from({length:yt}).fill(0),this.momentsB=Array.from({length:yt}).fill(0),this.moments=Array.from({length:yt}).fill(0);let r=Yt.quantize(t);for(let[n,i]of r.entries()){let a=at(n),o=ot(n),l=st(n),c=8-Jt,f=(a>>c)+1,d=(o>>c)+1,g=(l>>c)+1,b=this.getIndex(f,d,g);this.weights[b]=(this.weights[b]??0)+i,this.momentsR[b]+=i*a,this.momentsG[b]+=i*o,this.momentsB[b]+=i*l,this.moments[b]+=i*(a*a+o*o+l*l)}}computeMoments(){for(let t=1;t<pe;t++){let r=Array.from({length:pe}).fill(0),n=Array.from({length:pe}).fill(0),i=Array.from({length:pe}).fill(0),a=Array.from({length:pe}).fill(0),o=Array.from({length:pe}).fill(0);for(let l=1;l<pe;l++){let c=0,f=0,d=0,g=0,b=0;for(let p=1;p<pe;p++){let I=this.getIndex(t,l,p);c+=this.weights[I],f+=this.momentsR[I],d+=this.momentsG[I],g+=this.momentsB[I],b+=this.moments[I],r[p]+=c,n[p]+=f,i[p]+=d,a[p]+=g,o[p]+=b;let w=this.getIndex(t-1,l,p);this.weights[I]=this.weights[w]+r[p],this.momentsR[I]=this.momentsR[w]+n[p],this.momentsG[I]=this.momentsG[w]+i[p],this.momentsB[I]=this.momentsB[w]+a[p],this.moments[I]=this.moments[w]+o[p]}}}}createBoxes(t){this.cubes=Array.from({length:t}).fill(0).map(()=>new Hr);let r=Array.from({length:t}).fill(0);this.cubes[0].r0=0,this.cubes[0].g0=0,this.cubes[0].b0=0,this.cubes[0].r1=pe-1,this.cubes[0].g1=pe-1,this.cubes[0].b1=pe-1;let n=t,i=0;for(let a=1;a<t;a++){this.cut(this.cubes[i],this.cubes[a])?(r[i]=this.cubes[i].vol>1?this.variance(this.cubes[i]):0,r[a]=this.cubes[a].vol>1?this.variance(this.cubes[a]):0):(r[i]=0,a--),i=0;let o=r[0];for(let l=1;l<=a;l++)r[l]>o&&(o=r[l],i=l);if(o<=0){n=a+1;break}}return new qr(t,n)}createResult(t){let r=[];for(let n=0;n<t;++n){let i=this.cubes[n],a=this.volume(i,this.weights);if(a>0){let o=Math.round(this.volume(i,this.momentsR)/a),l=Math.round(this.volume(i,this.momentsG)/a),c=Math.round(this.volume(i,this.momentsB)/a),f=255<<24|(o&255)<<16|(l&255)<<8|c&255;r.push(f)}}return r}variance(t){let r=this.volume(t,this.momentsR),n=this.volume(t,this.momentsG),i=this.volume(t,this.momentsB),a=this.moments[this.getIndex(t.r1,t.g1,t.b1)]-this.moments[this.getIndex(t.r1,t.g1,t.b0)]-this.moments[this.getIndex(t.r1,t.g0,t.b1)]+this.moments[this.getIndex(t.r1,t.g0,t.b0)]-this.moments[this.getIndex(t.r0,t.g1,t.b1)]+this.moments[this.getIndex(t.r0,t.g1,t.b0)]+this.moments[this.getIndex(t.r0,t.g0,t.b1)]-this.moments[this.getIndex(t.r0,t.g0,t.b0)],o=r*r+n*n+i*i,l=this.volume(t,this.weights);return a-o/l}cut(t,r){let n=this.volume(t,this.momentsR),i=this.volume(t,this.momentsG),a=this.volume(t,this.momentsB),o=this.volume(t,this.weights),l=this.maximize(t,ae.RED,t.r0+1,t.r1,n,i,a,o),c=this.maximize(t,ae.GREEN,t.g0+1,t.g1,n,i,a,o),f=this.maximize(t,ae.BLUE,t.b0+1,t.b1,n,i,a,o),d,g=l.maximum,b=c.maximum,p=f.maximum;if(g>=b&&g>=p){if(l.cutLocation<0)return!1;d=ae.RED}else b>=g&&b>=p?d=ae.GREEN:d=ae.BLUE;switch(r.r1=t.r1,r.g1=t.g1,r.b1=t.b1,d){case ae.RED:t.r1=l.cutLocation,r.r0=t.r1,r.g0=t.g0,r.b0=t.b0;break;case ae.GREEN:t.g1=c.cutLocation,r.r0=t.r0,r.g0=t.g1,r.b0=t.b0;break;case ae.BLUE:t.b1=f.cutLocation,r.r0=t.r0,r.g0=t.g0,r.b0=t.b1;break;default:throw new Error("unexpected direction "+d)}return t.vol=(t.r1-t.r0)*(t.g1-t.g0)*(t.b1-t.b0),r.vol=(r.r1-r.r0)*(r.g1-r.g0)*(r.b1-r.b0),!0}maximize(t,r,n,i,a,o,l,c){let f=this.bottom(t,r,this.momentsR),d=this.bottom(t,r,this.momentsG),g=this.bottom(t,r,this.momentsB),b=this.bottom(t,r,this.weights),p=0,I=-1,w=0,R=0,F=0,y=0;for(let x=n;x<i;x++){if(w=f+this.top(t,r,x,this.momentsR),R=d+this.top(t,r,x,this.momentsG),F=g+this.top(t,r,x,this.momentsB),y=b+this.top(t,r,x,this.weights),y===0)continue;let B=(w*w+R*R+F*F)*1,T=y*1,H=B/T;w=a-w,R=o-R,F=l-F,y=c-y,y!==0&&(B=(w*w+R*R+F*F)*1,T=y*1,H+=B/T,H>p&&(p=H,I=x))}return new _r(I,p)}volume(t,r){return r[this.getIndex(t.r1,t.g1,t.b1)]-r[this.getIndex(t.r1,t.g1,t.b0)]-r[this.getIndex(t.r1,t.g0,t.b1)]+r[this.getIndex(t.r1,t.g0,t.b0)]-r[this.getIndex(t.r0,t.g1,t.b1)]+r[this.getIndex(t.r0,t.g1,t.b0)]+r[this.getIndex(t.r0,t.g0,t.b1)]-r[this.getIndex(t.r0,t.g0,t.b0)]}bottom(t,r,n){switch(r){case ae.RED:return-n[this.getIndex(t.r0,t.g1,t.b1)]+n[this.getIndex(t.r0,t.g1,t.b0)]+n[this.getIndex(t.r0,t.g0,t.b1)]-n[this.getIndex(t.r0,t.g0,t.b0)];case ae.GREEN:return-n[this.getIndex(t.r1,t.g0,t.b1)]+n[this.getIndex(t.r1,t.g0,t.b0)]+n[this.getIndex(t.r0,t.g0,t.b1)]-n[this.getIndex(t.r0,t.g0,t.b0)];case ae.BLUE:return-n[this.getIndex(t.r1,t.g1,t.b0)]+n[this.getIndex(t.r1,t.g0,t.b0)]+n[this.getIndex(t.r0,t.g1,t.b0)]-n[this.getIndex(t.r0,t.g0,t.b0)];default:throw new Error("unexpected direction $direction")}}top(t,r,n,i){switch(r){case ae.RED:return i[this.getIndex(n,t.g1,t.b1)]-i[this.getIndex(n,t.g1,t.b0)]-i[this.getIndex(n,t.g0,t.b1)]+i[this.getIndex(n,t.g0,t.b0)];case ae.GREEN:return i[this.getIndex(t.r1,n,t.b1)]-i[this.getIndex(t.r1,n,t.b0)]-i[this.getIndex(t.r0,n,t.b1)]+i[this.getIndex(t.r0,n,t.b0)];case ae.BLUE:return i[this.getIndex(t.r1,t.g1,n)]-i[this.getIndex(t.r1,t.g0,n)]-i[this.getIndex(t.r0,t.g1,n)]+i[this.getIndex(t.r0,t.g0,n)];default:throw new Error("unexpected direction $direction")}}getIndex(t,r,n){return(t<<Jt*2)+(t<<Jt+1)+t+(r<<Jt)+r+n}},Hr=class{constructor(t=0,r=0,n=0,i=0,a=0,o=0,l=0){this.r0=t,this.r1=r,this.g0=n,this.g1=i,this.b0=a,this.b1=o,this.vol=l}},qr=class{constructor(t,r){this.requestedCount=t,this.resultCount=r}},_r=class{constructor(t,r){this.cutLocation=t,this.maximum=r}};var wt=class{static quantize(t,r){let i=new Kt().quantize(t,r);return Xt.quantize(t,i,r)}};var Et=class e extends J{constructor(t,r,n){super({sourceColorArgb:t.toInt(),variant:Y.EXPRESSIVE,contrastLevel:n,isDark:r,primaryPalette:O.fromHueAndChroma(fe(t.hue+240),40),secondaryPalette:O.fromHueAndChroma(J.getRotatedHue(t,e.hues,e.secondaryRotations),24),tertiaryPalette:O.fromHueAndChroma(J.getRotatedHue(t,e.hues,e.tertiaryRotations),32),neutralPalette:O.fromHueAndChroma(t.hue+15,8),neutralVariantPalette:O.fromHueAndChroma(t.hue+15,12)})}};Et.hues=[0,21,51,121,151,191,271,321,360];Et.secondaryRotations=[45,95,45,20,45,90,45,45,45];Et.tertiaryRotations=[120,120,20,45,20,15,20,120,120];var Pt=class e extends J{constructor(t,r,n){super({sourceColorArgb:t.toInt(),variant:Y.VIBRANT,contrastLevel:n,isDark:r,primaryPalette:O.fromHueAndChroma(t.hue,200),secondaryPalette:O.fromHueAndChroma(J.getRotatedHue(t,e.hues,e.secondaryRotations),24),tertiaryPalette:O.fromHueAndChroma(J.getRotatedHue(t,e.hues,e.tertiaryRotations),32),neutralPalette:O.fromHueAndChroma(t.hue,10),neutralVariantPalette:O.fromHueAndChroma(t.hue,12)})}};Pt.hues=[0,41,61,101,131,181,251,301,360];Pt.secondaryRotations=[18,15,10,12,15,18,15,12,12];Pt.tertiaryRotations=[35,30,20,25,30,35,30,25,25];var k0={desired:4,fallbackColorARGB:4282549748,filter:!0};function C0(e,t){return e.score>t.score?-1:e.score<t.score?1:0}var be=class e{constructor(){}static score(t,r){let{desired:n,fallbackColorARGB:i,filter:a}={...k0,...r},o=[],l=new Array(360).fill(0),c=0;for(let[p,I]of t.entries()){let w=_.fromInt(p);o.push(w);let R=Math.floor(w.hue);l[R]+=I,c+=I}let f=new Array(360).fill(0);for(let p=0;p<360;p++){let I=l[p]/c;for(let w=p-14;w<p+16;w++){let R=Ut(w);f[R]+=I}}let d=new Array;for(let p of o){let I=Ut(Math.round(p.hue)),w=f[I];if(a&&(p.chroma<e.CUTOFF_CHROMA||w<=e.CUTOFF_EXCITED_PROPORTION))continue;let R=w*100*e.WEIGHT_PROPORTION,F=p.chroma<e.TARGET_CHROMA?e.WEIGHT_CHROMA_BELOW:e.WEIGHT_CHROMA_ABOVE,y=(p.chroma-e.TARGET_CHROMA)*F,x=R+y;d.push({hct:p,score:x})}d.sort(C0);let g=[];for(let p=90;p>=15;p--){g.length=0;for(let{hct:I}of d)if(g.find(R=>Dr(I.hue,R.hue)<p)||g.push(I),g.length>=n)break;if(g.length>=n)break}let b=[];g.length===0&&b.push(i);for(let p of g)b.push(p.toInt());return b}};be.TARGET_CHROMA=48;be.WEIGHT_PROPORTION=.7;be.WEIGHT_CHROMA_ABOVE=.3;be.WEIGHT_CHROMA_BELOW=.1;be.CUTOFF_CHROMA=5;be.CUTOFF_EXCITED_PROPORTION=.01;function zr(e){let t=at(e),r=ot(e),n=st(e),i=[t.toString(16),r.toString(16),n.toString(16)];for(let[a,o]of i.entries())o.length===1&&(i[a]="0"+o);return"#"+i.join("")}var Da=["analogous","complementary","triadic","tetradic","split-complementary","monochrome","monet"],R0="analogous";function Fa(){return[...Da]}function Vr(e){let t=e.trim();return Na(t)?"hex":Oa(t)?"datauri":M0(t)?"url":"path"}async function Ba(e,t={}){let r=Vr(e);return r==="hex"?Wr(e,t):r==="datauri"?Xr(e,t):r==="url"?Yr(e,t):Jr(e,t)}async function Wr(e,t={}){let r=Qr(e),n=L0(r);return ja(n,"hex",t.algorithm,t.count)}async function Xr(e,t={}){let r=_0(e);return Kr(r,"datauri",t.algorithm,t.count)}async function Yr(e,t={}){let r=await z0(e);return Kr(r,"url",t.algorithm,t.count)}async function Jr(e,t={}){let r=La.default.resolve(e),n=await Ta.default.readFile(r);return Kr(n,"path",t.algorithm,t.count)}async function Kr(e,t,r,n){let i=$a(r),a=await B0(e);if(i==="monet"){let o=await j0(e,Ha(n,6));if(o.length>0)return{inputType:t,algorithm:i,baseColor:Ur(a),colors:o}}return ja(a,t,i,n)}function ja(e,t,r,n){let i=$a(r),a=Ur(e);if(i==="monet"){let f=T0(a);return{inputType:t,algorithm:i,baseColor:a,colors:qa(f,Ha(n,6))}}let o=D0(e),c=S0(o,i,n).map(f=>Ur(F0(f)));return{inputType:t,algorithm:i,baseColor:a,colors:c}}function $a(e){if(!e)return R0;if(!Da.includes(e))throw new Error(`Unknown algorithm: ${e}`);return e}function S0(e,t,r){let n=vt(e.h),i=ye(e.s,20,90),a=ye(e.l,20,80);return t==="analogous"?O0(n,i,a,Ve(r,5),40):t==="complementary"?Qt(n,i,a,Ve(r,3),[0,180],14):t==="triadic"?Qt(n,i,a,Ve(r,3),[0,120,240],10):t==="tetradic"?Qt(n,i,a,Ve(r,4),[0,90,180,270],8):t==="split-complementary"?Qt(n,i,a,Ve(r,3),[0,150,210],10):t==="monochrome"?Ma(n,i,a,Ve(r,4)):Ma(n,i,a,Ve(r,6))}function Na(e){return/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e)}function Oa(e){return/^data:image\/[a-z0-9.+-]+;base64,/i.test(e)}function M0(e){return/^https?:\/\//i.test(e)}function Qr(e){let t=e.trim();if(!Na(t))throw new Error(`Invalid HEX color: ${e}`);let r=t.startsWith("#")?t.slice(1):t;return r.length===3?`#${r.split("").map(i=>i+i).join("").toUpperCase()}`:`#${r.toUpperCase()}`}function T0(e){let t=Qr(e).slice(1),r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return Ge(r,n,i)}function L0(e){let t=Qr(e).slice(1),r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return{r,g:n,b:i}}function Ur(e){let t=r=>Math.round(ye(r,0,255)).toString(16).padStart(2,"0").toUpperCase();return`#${t(e.r)}${t(e.g)}${t(e.b)}`}function D0(e){let t=e.r/255,r=e.g/255,n=e.b/255,i=Math.max(t,r,n),a=Math.min(t,r,n),o=i-a,l=0;o!==0&&(i===t?l=(r-n)/o%6:i===r?l=(n-t)/o+2:l=(t-r)/o+4,l*=60),l<0&&(l+=360);let c=(i+a)/2,f=o===0?0:o/(1-Math.abs(2*c-1));return{h:l,s:f*100,l:c*100}}function F0(e){let t=vt(e.h),r=ye(e.s,0,100)/100,n=ye(e.l,0,100)/100,i=(1-Math.abs(2*n-1))*r,a=i*(1-Math.abs(t/60%2-1)),o=n-i/2,l=0,c=0,f=0;return t>=0&&t<60?(l=i,c=a):t<120?(l=a,c=i):t<180?(c=i,f=a):t<240?(c=a,f=i):t<300?(l=a,f=i):(l=i,f=a),{r:(l+o)*255,g:(c+o)*255,b:(f+o)*255}}async function B0(e){let r=(await(0,Gr.default)(e).stats()).channels;return{r:r[0]?.mean??0,g:r[1]?.mean??0,b:r[2]?.mean??0}}async function j0(e,t){let{data:r,info:n}=await(0,Gr.default)(e).resize({width:48,height:48,fit:"inside"}).removeAlpha().raw().toBuffer({resolveWithObject:!0}),i=[],a=n.channels;for(let d=0;d<r.length;d+=a){let g=r[d]??0,b=r[d+1]??0,p=r[d+2]??0;i.push(Ge(g,b,p))}if(i.length===0)return[];let o=H0(i,1200),l=wt.quantize(o,128),f=be.score(l)[0]??o[0];return qa(f,t)}function Ve(e,t){return e?Math.max(2,Math.min(12,Math.floor(e))):t}function Ha(e,t){return e?Math.max(1,Math.floor(e)):t}function $0(e,t){if(e<=1)return[0];let r=t*2/(e-1),n=[];for(let i=0;i<e;i+=1)n.push(-t+i*r);return n}function N0(e,t){if(e<=1)return[0];let r=t*2/(e-1),n=[];for(let i=0;i<e;i+=1)n.push(-t+i*r);return n}function O0(e,t,r,n,i){return $0(n,i).map(o=>({h:vt(e+o),s:ye(t,0,100),l:ye(r,0,100)}))}function Qt(e,t,r,n,i,a){let o=[];for(let l=0;l<n;l+=1){let c=i[l%i.length]??0,f=Math.floor(l/i.length),d=(f%2===0?1:-1)*a*(f+1)*.5;o.push({h:vt(e+c),s:ye(t,0,100),l:ye(r+d,0,100)})}return o}function Ma(e,t,r,n){return N0(n,20).map(a=>({h:vt(e),s:ye(t,0,100),l:ye(r+a,0,100)}))}function H0(e,t){if(e.length<=t)return e;let r=Math.ceil(e.length/t),n=[];for(let i=0;i<e.length;i+=r)n.push(e[i]);return n}function qa(e,t){let r=_.fromInt(e),n=O.fromHct(r);return q0(t).map(a=>zr(n.tone(a)))}function q0(e){let t=[0,10,20,30,40,50,60,70,80,90,95,98,100];if(e<=t.length)return t.slice(0,e);let r=[];for(let n=0;n<e;n+=1)r.push(Math.round(100*n/(e-1)));return r}function _0(e){if(!Oa(e))throw new Error("Invalid data URI");let t=e.split(",")[1]??"";return Buffer.from(t,"base64")}async function z0(e){let t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch image: ${t.status} ${t.statusText}`);let r=await t.arrayBuffer();return Buffer.from(r)}function ye(e,t,r){return Math.min(r,Math.max(t,e))}function vt(e){let t=e%360;return t<0?t+360:t}0&&(module.exports={detectInputType,generatePalette,generatePaletteFromDataUri,generatePaletteFromHex,generatePaletteFromPath,generatePaletteFromUrl,listAlgorithms});
|
|
3
|
+
/*! Bundled license information:
|
|
4
|
+
|
|
5
|
+
sharp/lib/is.js:
|
|
6
|
+
sharp/lib/libvips.js:
|
|
7
|
+
sharp/lib/sharp.js:
|
|
8
|
+
sharp/lib/constructor.js:
|
|
9
|
+
sharp/lib/input.js:
|
|
10
|
+
sharp/lib/resize.js:
|
|
11
|
+
sharp/lib/composite.js:
|
|
12
|
+
sharp/lib/operation.js:
|
|
13
|
+
sharp/lib/colour.js:
|
|
14
|
+
sharp/lib/channel.js:
|
|
15
|
+
sharp/lib/output.js:
|
|
16
|
+
sharp/lib/utility.js:
|
|
17
|
+
sharp/lib/index.js:
|
|
18
|
+
(*!
|
|
19
|
+
Copyright 2013 Lovell Fuller and others.
|
|
20
|
+
SPDX-License-Identifier: Apache-2.0
|
|
21
|
+
*)
|
|
22
|
+
|
|
23
|
+
@material/material-color-utilities/utils/math_utils.js:
|
|
24
|
+
@material/material-color-utilities/utils/color_utils.js:
|
|
25
|
+
@material/material-color-utilities/hct/viewing_conditions.js:
|
|
26
|
+
@material/material-color-utilities/hct/cam16.js:
|
|
27
|
+
@material/material-color-utilities/hct/hct_solver.js:
|
|
28
|
+
@material/material-color-utilities/hct/hct.js:
|
|
29
|
+
@material/material-color-utilities/blend/blend.js:
|
|
30
|
+
@material/material-color-utilities/palettes/tonal_palette.js:
|
|
31
|
+
@material/material-color-utilities/palettes/core_palette.js:
|
|
32
|
+
@material/material-color-utilities/quantize/lab_point_provider.js:
|
|
33
|
+
@material/material-color-utilities/quantize/quantizer_wsmeans.js:
|
|
34
|
+
@material/material-color-utilities/quantize/quantizer_map.js:
|
|
35
|
+
@material/material-color-utilities/quantize/quantizer_wu.js:
|
|
36
|
+
@material/material-color-utilities/quantize/quantizer_celebi.js:
|
|
37
|
+
@material/material-color-utilities/scheme/scheme.js:
|
|
38
|
+
@material/material-color-utilities/scheme/scheme_android.js:
|
|
39
|
+
@material/material-color-utilities/score/score.js:
|
|
40
|
+
@material/material-color-utilities/utils/string_utils.js:
|
|
41
|
+
@material/material-color-utilities/utils/image_utils.js:
|
|
42
|
+
@material/material-color-utilities/utils/theme_utils.js:
|
|
43
|
+
@material/material-color-utilities/index.js:
|
|
44
|
+
(**
|
|
45
|
+
* @license
|
|
46
|
+
* Copyright 2021 Google LLC
|
|
47
|
+
*
|
|
48
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
49
|
+
* you may not use this file except in compliance with the License.
|
|
50
|
+
* You may obtain a copy of the License at
|
|
51
|
+
*
|
|
52
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
53
|
+
*
|
|
54
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
55
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
56
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
57
|
+
* See the License for the specific language governing permissions and
|
|
58
|
+
* limitations under the License.
|
|
59
|
+
*)
|
|
60
|
+
|
|
61
|
+
@material/material-color-utilities/contrast/contrast.js:
|
|
62
|
+
@material/material-color-utilities/dynamiccolor/dynamic_color.js:
|
|
63
|
+
@material/material-color-utilities/dynamiccolor/variant.js:
|
|
64
|
+
@material/material-color-utilities/dynamiccolor/material_dynamic_colors.js:
|
|
65
|
+
@material/material-color-utilities/dynamiccolor/dynamic_scheme.js:
|
|
66
|
+
@material/material-color-utilities/scheme/scheme_expressive.js:
|
|
67
|
+
@material/material-color-utilities/scheme/scheme_fruit_salad.js:
|
|
68
|
+
@material/material-color-utilities/scheme/scheme_monochrome.js:
|
|
69
|
+
@material/material-color-utilities/scheme/scheme_neutral.js:
|
|
70
|
+
@material/material-color-utilities/scheme/scheme_rainbow.js:
|
|
71
|
+
@material/material-color-utilities/scheme/scheme_tonal_spot.js:
|
|
72
|
+
@material/material-color-utilities/scheme/scheme_vibrant.js:
|
|
73
|
+
(**
|
|
74
|
+
* @license
|
|
75
|
+
* Copyright 2022 Google LLC
|
|
76
|
+
*
|
|
77
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
78
|
+
* you may not use this file except in compliance with the License.
|
|
79
|
+
* You may obtain a copy of the License at
|
|
80
|
+
*
|
|
81
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
*
|
|
83
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
84
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
85
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
86
|
+
* See the License for the specific language governing permissions and
|
|
87
|
+
* limitations under the License.
|
|
88
|
+
*)
|
|
89
|
+
|
|
90
|
+
@material/material-color-utilities/dislike/dislike_analyzer.js:
|
|
91
|
+
@material/material-color-utilities/dynamiccolor/contrast_curve.js:
|
|
92
|
+
@material/material-color-utilities/dynamiccolor/tone_delta_pair.js:
|
|
93
|
+
@material/material-color-utilities/temperature/temperature_cache.js:
|
|
94
|
+
@material/material-color-utilities/scheme/scheme_content.js:
|
|
95
|
+
@material/material-color-utilities/scheme/scheme_fidelity.js:
|
|
96
|
+
(**
|
|
97
|
+
* @license
|
|
98
|
+
* Copyright 2023 Google LLC
|
|
99
|
+
*
|
|
100
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
101
|
+
* you may not use this file except in compliance with the License.
|
|
102
|
+
* You may obtain a copy of the License at
|
|
103
|
+
*
|
|
104
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
105
|
+
*
|
|
106
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
107
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
108
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
109
|
+
* See the License for the specific language governing permissions and
|
|
110
|
+
* limitations under the License.
|
|
111
|
+
*)
|
|
112
|
+
*/
|
|
113
|
+
//# sourceMappingURL=index.js.map
|