UNPKG

mdast2docx

Version:

Convert Markdown Abstract Syntax Tree (MDAST) to DOCX seamlessly. Supports footnotes, images, links, and customizable document properties.

2 lines 136 kB
import{a as I,b as y,c as Vn,d as gr,f as ke,g as Qr}from"./chunk-D3LAYVCJ.mjs";var J=y((yc,Kr)=>{"use strict";var Jr=function(e){return typeof e!="undefined"&&e!==null},Xn=function(e){return typeof e=="object"},Qn=function(e){return Object.prototype.toString.call(e)==="[object Object]"},Jn=function(e){return typeof e=="function"},Kn=function(e){return typeof e=="boolean"},Yn=function(e){return e instanceof Buffer},Zn=function(e){if(Jr(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},ea=function(e){return e instanceof ArrayBuffer},ra=function(e){return typeof e=="string"&&e.length>0},ta=function(e){return typeof e=="number"&&!Number.isNaN(e)},ia=function(e){return Number.isInteger(e)},na=function(e,r,t){return e>=r&&e<=t},aa=function(e,r){return r.includes(e)},sa=function(e,r,t){return new Error(`Expected ${r} for ${e} but received ${t} of type ${typeof t}`)},oa=function(e,r){return r.message=e.message,r};Kr.exports={defined:Jr,object:Xn,plainObject:Qn,fn:Jn,bool:Kn,buffer:Yn,typedArray:Zn,arrayBuffer:ea,string:ra,number:ta,integer:ia,inRange:na,inArray:aa,invalidParameterError:sa,nativeError:oa}});var et=y((Ec,Zr)=>{"use strict";var Yr=()=>process.platform==="linux",_e=null,la=()=>{if(!_e)if(Yr()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,_e=process.report.getReport(),process.report.excludeNetwork=e}else _e={};return _e};Zr.exports={isLinux:Yr,getReport:la}});var it=y((vc,tt)=>{"use strict";var rt=I("fs"),ca="/usr/bin/ldd",fa=e=>rt.readFileSync(e,"utf-8"),ha=e=>new Promise((r,t)=>{rt.readFile(e,"utf-8",(i,n)=>{i?t(i):r(n)})});tt.exports={LDD_PATH:ca,readFileSync:fa,readFile:ha}});var ze=y((xc,Et)=>{"use strict";var at=I("child_process"),{isLinux:be,getReport:st}=et(),{LDD_PATH:Ue,readFile:ot,readFileSync:lt}=it(),K,Y,ct="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",se="",ft=()=>se||new Promise(e=>{at.exec(ct,(r,t)=>{se=r?" ":t,e(se)})}),ht=()=>{if(!se)try{se=at.execSync(ct,{encoding:"utf8"})}catch{se=" "}return se},oe="glibc",ut=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,pe="musl",ua=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),dt=()=>{let e=st();return e.header&&e.header.glibcVersionRuntime?oe:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(ua)?pe:null},mt=e=>{let[r,t]=e.split(/[\r\n]+/);return r&&r.includes(oe)?oe:t&&t.includes(pe)?pe:null},gt=e=>e.includes("musl")?pe:e.includes("GNU C Library")?oe:null,da=async()=>{if(K!==void 0)return K;K=null;try{let e=await ot(Ue);K=gt(e)}catch{}return K},ma=()=>{if(K!==void 0)return K;K=null;try{let e=lt(Ue);K=gt(e)}catch{}return K},pt=async()=>{let e=null;if(be()&&(e=await da(),e||(e=dt()),!e)){let r=await ft();e=mt(r)}return e},bt=()=>{let e=null;if(be()&&(e=ma(),e||(e=dt()),!e)){let r=ht();e=mt(r)}return e},ga=async()=>be()&&await pt()!==oe,pa=()=>be()&&bt()!==oe,ba=async()=>{if(Y!==void 0)return Y;Y=null;try{let r=(await ot(Ue)).match(ut);r&&(Y=r[1])}catch{}return Y},wa=()=>{if(Y!==void 0)return Y;Y=null;try{let r=lt(Ue).match(ut);r&&(Y=r[1])}catch{}return Y},wt=()=>{let e=st();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},nt=e=>e.trim().split(/\s+/)[1],yt=e=>{let[r,t,i]=e.split(/[\r\n]+/);return r&&r.includes(oe)?nt(r):t&&i&&t.includes(pe)?nt(i):null},ya=async()=>{let e=null;if(be()&&(e=await ba(),e||(e=wt()),!e)){let r=await ft();e=yt(r)}return e},Ea=()=>{let e=null;if(be()&&(e=wa(),e||(e=wt()),!e)){let r=ht();e=yt(r)}return e};Et.exports={GLIBC:oe,MUSL:pe,family:pt,familySync:bt,isNonGlibcLinux:ga,isNonGlibcLinuxSync:pa,version:ya,versionSync:Ea}});var Te=y((Pc,vt)=>{"use strict";var va=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};vt.exports=va});var Ge=y((Rc,xt)=>{"use strict";var xa="2.0.0",Pa=Number.MAX_SAFE_INTEGER||9007199254740991,Ra=16,Ia=250,Aa=["major","premajor","minor","preminor","patch","prepatch","prerelease"];xt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Ra,MAX_SAFE_BUILD_LENGTH:Ia,MAX_SAFE_INTEGER:Pa,RELEASE_TYPES:Aa,SEMVER_SPEC_VERSION:xa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var je=y((Z,Pt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:pr,MAX_SAFE_BUILD_LENGTH:Sa,MAX_LENGTH:La}=Ge(),$a=Te();Z=Pt.exports={};var ka=Z.re=[],Ta=Z.safeRe=[],d=Z.src=[],ja=Z.safeSrc=[],m=Z.t={},Na=0,br="[a-zA-Z0-9-]",Ca=[["\\s",1],["\\d",La],[br,Sa]],Fa=e=>{for(let[r,t]of Ca)e=e.split(`${r}*`).join(`${r}{0,${t}}`).split(`${r}+`).join(`${r}{1,${t}}`);return e},E=(e,r,t)=>{let i=Fa(r),n=Na++;$a(e,n,r),m[e]=n,d[n]=r,ja[n]=i,ka[n]=new RegExp(r,t?"g":void 0),Ta[n]=new RegExp(i,t?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${br}*`);E("MAINVERSION",`(${d[m.NUMERICIDENTIFIER]})\\.(${d[m.NUMERICIDENTIFIER]})\\.(${d[m.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${d[m.NUMERICIDENTIFIERLOOSE]})\\.(${d[m.NUMERICIDENTIFIERLOOSE]})\\.(${d[m.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${d[m.NONNUMERICIDENTIFIER]}|${d[m.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${d[m.NONNUMERICIDENTIFIER]}|${d[m.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${d[m.PRERELEASEIDENTIFIER]}(?:\\.${d[m.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${d[m.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[m.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${br}+`);E("BUILD",`(?:\\+(${d[m.BUILDIDENTIFIER]}(?:\\.${d[m.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${d[m.MAINVERSION]}${d[m.PRERELEASE]}?${d[m.BUILD]}?`);E("FULL",`^${d[m.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${d[m.MAINVERSIONLOOSE]}${d[m.PRERELEASELOOSE]}?${d[m.BUILD]}?`);E("LOOSE",`^${d[m.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${d[m.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${d[m.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${d[m.XRANGEIDENTIFIER]})(?:\\.(${d[m.XRANGEIDENTIFIER]})(?:\\.(${d[m.XRANGEIDENTIFIER]})(?:${d[m.PRERELEASE]})?${d[m.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${d[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[m.XRANGEIDENTIFIERLOOSE]})(?:${d[m.PRERELEASELOOSE]})?${d[m.BUILD]}?)?)?`);E("XRANGE",`^${d[m.GTLT]}\\s*${d[m.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${d[m.GTLT]}\\s*${d[m.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${pr}})(?:\\.(\\d{1,${pr}}))?(?:\\.(\\d{1,${pr}}))?`);E("COERCE",`${d[m.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",d[m.COERCEPLAIN]+`(?:${d[m.PRERELEASE]})?(?:${d[m.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",d[m.COERCE],!0);E("COERCERTLFULL",d[m.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${d[m.LONETILDE]}\\s+`,!0);Z.tildeTrimReplace="$1~";E("TILDE",`^${d[m.LONETILDE]}${d[m.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${d[m.LONETILDE]}${d[m.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${d[m.LONECARET]}\\s+`,!0);Z.caretTrimReplace="$1^";E("CARET",`^${d[m.LONECARET]}${d[m.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${d[m.LONECARET]}${d[m.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${d[m.GTLT]}\\s*(${d[m.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${d[m.GTLT]}\\s*(${d[m.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${d[m.GTLT]}\\s*(${d[m.LOOSEPLAIN]}|${d[m.XRANGEPLAIN]})`,!0);Z.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${d[m.XRANGEPLAIN]})\\s+-\\s+(${d[m.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${d[m.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[m.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var He=y((Ic,Rt)=>{"use strict";var Ba=Object.freeze({loose:!0}),Oa=Object.freeze({}),qa=e=>e?typeof e!="object"?Ba:e:Oa;Rt.exports=qa});var Lt=y((Ac,St)=>{"use strict";var It=/^[0-9]+$/,At=(e,r)=>{let t=It.test(e),i=It.test(r);return t&&i&&(e=+e,r=+r),e===r?0:t&&!i?-1:i&&!t?1:e<r?-1:1},Ma=(e,r)=>At(r,e);St.exports={compareIdentifiers:At,rcompareIdentifiers:Ma}});var ye=y((Sc,kt)=>{"use strict";var We=Te(),{MAX_LENGTH:$t,MAX_SAFE_INTEGER:Ve}=Ge(),{safeRe:Xe,t:Qe}=je(),Da=He(),{compareIdentifiers:we}=Lt(),wr=class e{constructor(r,t){if(t=Da(t),r instanceof e){if(r.loose===!!t.loose&&r.includePrerelease===!!t.includePrerelease)return r;r=r.version}else if(typeof r!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof r}".`);if(r.length>$t)throw new TypeError(`version is longer than ${$t} characters`);We("SemVer",r,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=r.trim().match(t.loose?Xe[Qe.LOOSE]:Xe[Qe.FULL]);if(!i)throw new TypeError(`Invalid Version: ${r}`);if(this.raw=r,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>Ve||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ve||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ve||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<Ve)return s}return n}):this.prerelease=[],this.build=i[5]?i[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(r){if(We("SemVer.compare",this.version,this.options,r),!(r instanceof e)){if(typeof r=="string"&&r===this.version)return 0;r=new e(r,this.options)}return r.version===this.version?0:this.compareMain(r)||this.comparePre(r)}compareMain(r){return r instanceof e||(r=new e(r,this.options)),we(this.major,r.major)||we(this.minor,r.minor)||we(this.patch,r.patch)}comparePre(r){if(r instanceof e||(r=new e(r,this.options)),this.prerelease.length&&!r.prerelease.length)return-1;if(!this.prerelease.length&&r.prerelease.length)return 1;if(!this.prerelease.length&&!r.prerelease.length)return 0;let t=0;do{let i=this.prerelease[t],n=r.prerelease[t];if(We("prerelease compare",t,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return we(i,n)}while(++t)}compareBuild(r){r instanceof e||(r=new e(r,this.options));let t=0;do{let i=this.build[t],n=r.build[t];if(We("build compare",t,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return we(i,n)}while(++t)}inc(r,t,i){if(r.startsWith("pre")){if(!t&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Xe[Qe.PRERELEASELOOSE]:Xe[Qe.PRERELEASE]);if(!n||n[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(r){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,i),this.inc("pre",t,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,i),this.inc("pre",t,i);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 n=Number(i)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(t===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];i===!1&&(s=[t]),we(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${r}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};kt.exports=wr});var Nt=y((Lc,jt)=>{"use strict";var Tt=ye(),_a=(e,r,t=!1)=>{if(e instanceof Tt)return e;try{return new Tt(e,r)}catch(i){if(!t)return null;throw i}};jt.exports=_a});var Ft=y(($c,Ct)=>{"use strict";var Ua=ye(),za=Nt(),{safeRe:Je,t:Ke}=je(),Ga=(e,r)=>{if(e instanceof Ua)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;r=r||{};let t=null;if(!r.rtl)t=e.match(r.includePrerelease?Je[Ke.COERCEFULL]:Je[Ke.COERCE]);else{let h=r.includePrerelease?Je[Ke.COERCERTLFULL]:Je[Ke.COERCERTL],u;for(;(u=h.exec(e))&&(!t||t.index+t[0].length!==e.length);)(!t||u.index+u[0].length!==t.index+t[0].length)&&(t=u),h.lastIndex=u.index+u[1].length+u[2].length;h.lastIndex=-1}if(t===null)return null;let i=t[2],n=t[3]||"0",s=t[4]||"0",o=r.includePrerelease&&t[5]?`-${t[5]}`:"",l=r.includePrerelease&&t[6]?`+${t[6]}`:"";return za(`${i}.${n}.${s}${o}${l}`,r)};Ct.exports=Ga});var ue=y((kc,Ot)=>{"use strict";var Bt=ye(),Ha=(e,r,t)=>new Bt(e,t).compare(new Bt(r,t));Ot.exports=Ha});var yr=y((Tc,qt)=>{"use strict";var Wa=ue(),Va=(e,r,t)=>Wa(e,r,t)>=0;qt.exports=Va});var Dt=y((jc,Mt)=>{"use strict";var Er=class{constructor(){this.max=1e3,this.map=new Map}get(r){let t=this.map.get(r);if(t!==void 0)return this.map.delete(r),this.map.set(r,t),t}delete(r){return this.map.delete(r)}set(r,t){if(!this.delete(r)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(r,t)}return this}};Mt.exports=Er});var Ut=y((Nc,_t)=>{"use strict";var Xa=ue(),Qa=(e,r,t)=>Xa(e,r,t)===0;_t.exports=Qa});var Gt=y((Cc,zt)=>{"use strict";var Ja=ue(),Ka=(e,r,t)=>Ja(e,r,t)!==0;zt.exports=Ka});var Wt=y((Fc,Ht)=>{"use strict";var Ya=ue(),Za=(e,r,t)=>Ya(e,r,t)>0;Ht.exports=Za});var Xt=y((Bc,Vt)=>{"use strict";var es=ue(),rs=(e,r,t)=>es(e,r,t)<0;Vt.exports=rs});var Jt=y((Oc,Qt)=>{"use strict";var ts=ue(),is=(e,r,t)=>ts(e,r,t)<=0;Qt.exports=is});var Yt=y((qc,Kt)=>{"use strict";var ns=Ut(),as=Gt(),ss=Wt(),os=yr(),ls=Xt(),cs=Jt(),fs=(e,r,t,i)=>{switch(r){case"===":return typeof e=="object"&&(e=e.version),typeof t=="object"&&(t=t.version),e===t;case"!==":return typeof e=="object"&&(e=e.version),typeof t=="object"&&(t=t.version),e!==t;case"":case"=":case"==":return ns(e,t,i);case"!=":return as(e,t,i);case">":return ss(e,t,i);case">=":return os(e,t,i);case"<":return ls(e,t,i);case"<=":return cs(e,t,i);default:throw new TypeError(`Invalid operator: ${r}`)}};Kt.exports=fs});var ai=y((Mc,ni)=>{"use strict";var Ne=Symbol("SemVer ANY"),Pr=class e{static get ANY(){return Ne}constructor(r,t){if(t=Zt(t),r instanceof e){if(r.loose===!!t.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),xr("comparator",r,t),this.options=t,this.loose=!!t.loose,this.parse(r),this.semver===Ne?this.value="":this.value=this.operator+this.semver.version,xr("comp",this)}parse(r){let t=this.options.loose?ei[ri.COMPARATORLOOSE]:ei[ri.COMPARATOR],i=r.match(t);if(!i)throw new TypeError(`Invalid comparator: ${r}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new ti(i[2],this.options.loose):this.semver=Ne}toString(){return this.value}test(r){if(xr("Comparator.test",r,this.options.loose),this.semver===Ne||r===Ne)return!0;if(typeof r=="string")try{r=new ti(r,this.options)}catch{return!1}return vr(r,this.operator,this.semver,this.options)}intersects(r,t){if(!(r instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new ii(r.value,t).test(this.value):r.operator===""?r.value===""?!0:new ii(this.value,t).test(r.semver):(t=Zt(t),t.includePrerelease&&(this.value==="<0.0.0-0"||r.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||r.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&r.operator.startsWith(">")||this.operator.startsWith("<")&&r.operator.startsWith("<")||this.semver.version===r.semver.version&&this.operator.includes("=")&&r.operator.includes("=")||vr(this.semver,"<",r.semver,t)&&this.operator.startsWith(">")&&r.operator.startsWith("<")||vr(this.semver,">",r.semver,t)&&this.operator.startsWith("<")&&r.operator.startsWith(">")))}};ni.exports=Pr;var Zt=He(),{safeRe:ei,t:ri}=je(),vr=Yt(),xr=Te(),ti=ye(),ii=Rr()});var Rr=y((Dc,ci)=>{"use strict";var hs=/\s+/g,Ir=class e{constructor(r,t){if(t=ds(t),r instanceof e)return r.loose===!!t.loose&&r.includePrerelease===!!t.includePrerelease?r:new e(r.raw,t);if(r instanceof Ar)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=r.trim().replace(hs," "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(n=>!oi(n[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&Es(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let r=0;r<this.set.length;r++){r>0&&(this.formatted+="||");let t=this.set[r];for(let i=0;i<t.length;i++)i>0&&(this.formatted+=" "),this.formatted+=t[i].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(r){let i=((this.options.includePrerelease&&ws)|(this.options.loose&&ys))+":"+r,n=si.get(i);if(n)return n;let s=this.options.loose,o=s?O[C.HYPHENRANGELOOSE]:O[C.HYPHENRANGE];r=r.replace(o,ks(this.options.includePrerelease)),P("hyphen replace",r),r=r.replace(O[C.COMPARATORTRIM],gs),P("comparator trim",r),r=r.replace(O[C.TILDETRIM],ps),P("tilde trim",r),r=r.replace(O[C.CARETTRIM],bs),P("caret trim",r);let l=r.split(" ").map(w=>vs(w,this.options)).join(" ").split(/\s+/).map(w=>$s(w,this.options));s&&(l=l.filter(w=>(P("loose invalid filter",w,this.options),!!w.match(O[C.COMPARATORLOOSE])))),P("range list",l);let h=new Map,u=l.map(w=>new Ar(w,this.options));for(let w of u){if(oi(w))return[w];h.set(w.value,w)}h.size>1&&h.has("")&&h.delete("");let b=[...h.values()];return si.set(i,b),b}intersects(r,t){if(!(r instanceof e))throw new TypeError("a Range is required");return this.set.some(i=>li(i,t)&&r.set.some(n=>li(n,t)&&i.every(s=>n.every(o=>s.intersects(o,t)))))}test(r){if(!r)return!1;if(typeof r=="string")try{r=new ms(r,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(Ts(this.set[t],r,this.options))return!0;return!1}};ci.exports=Ir;var us=Dt(),si=new us,ds=He(),Ar=ai(),P=Te(),ms=ye(),{safeRe:O,t:C,comparatorTrimReplace:gs,tildeTrimReplace:ps,caretTrimReplace:bs}=je(),{FLAG_INCLUDE_PRERELEASE:ws,FLAG_LOOSE:ys}=Ge(),oi=e=>e.value==="<0.0.0-0",Es=e=>e.value==="",li=(e,r)=>{let t=!0,i=e.slice(),n=i.pop();for(;t&&i.length;)t=i.every(s=>n.intersects(s,r)),n=i.pop();return t},vs=(e,r)=>(P("comp",e,r),e=Rs(e,r),P("caret",e),e=xs(e,r),P("tildes",e),e=As(e,r),P("xrange",e),e=Ls(e,r),P("stars",e),e),F=e=>!e||e.toLowerCase()==="x"||e==="*",xs=(e,r)=>e.trim().split(/\s+/).map(t=>Ps(t,r)).join(" "),Ps=(e,r)=>{let t=r.loose?O[C.TILDELOOSE]:O[C.TILDE];return e.replace(t,(i,n,s,o,l)=>{P("tilde",e,i,n,s,o,l);let h;return F(n)?h="":F(s)?h=`>=${n}.0.0 <${+n+1}.0.0-0`:F(o)?h=`>=${n}.${s}.0 <${n}.${+s+1}.0-0`:l?(P("replaceTilde pr",l),h=`>=${n}.${s}.${o}-${l} <${n}.${+s+1}.0-0`):h=`>=${n}.${s}.${o} <${n}.${+s+1}.0-0`,P("tilde return",h),h})},Rs=(e,r)=>e.trim().split(/\s+/).map(t=>Is(t,r)).join(" "),Is=(e,r)=>{P("caret",e,r);let t=r.loose?O[C.CARETLOOSE]:O[C.CARET],i=r.includePrerelease?"-0":"";return e.replace(t,(n,s,o,l,h)=>{P("caret",e,n,s,o,l,h);let u;return F(s)?u="":F(o)?u=`>=${s}.0.0${i} <${+s+1}.0.0-0`:F(l)?s==="0"?u=`>=${s}.${o}.0${i} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.0${i} <${+s+1}.0.0-0`:h?(P("replaceCaret pr",h),s==="0"?o==="0"?u=`>=${s}.${o}.${l}-${h} <${s}.${o}.${+l+1}-0`:u=`>=${s}.${o}.${l}-${h} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.${l}-${h} <${+s+1}.0.0-0`):(P("no pr"),s==="0"?o==="0"?u=`>=${s}.${o}.${l}${i} <${s}.${o}.${+l+1}-0`:u=`>=${s}.${o}.${l}${i} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.${l} <${+s+1}.0.0-0`),P("caret return",u),u})},As=(e,r)=>(P("replaceXRanges",e,r),e.split(/\s+/).map(t=>Ss(t,r)).join(" ")),Ss=(e,r)=>{e=e.trim();let t=r.loose?O[C.XRANGELOOSE]:O[C.XRANGE];return e.replace(t,(i,n,s,o,l,h)=>{P("xRange",e,i,n,s,o,l,h);let u=F(s),b=u||F(o),w=b||F(l),R=w;return n==="="&&R&&(n=""),h=r.includePrerelease?"-0":"",u?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&R?(b&&(o=0),l=0,n===">"?(n=">=",b?(s=+s+1,o=0,l=0):(o=+o+1,l=0)):n==="<="&&(n="<",b?s=+s+1:o=+o+1),n==="<"&&(h="-0"),i=`${n+s}.${o}.${l}${h}`):b?i=`>=${s}.0.0${h} <${+s+1}.0.0-0`:w&&(i=`>=${s}.${o}.0${h} <${s}.${+o+1}.0-0`),P("xRange return",i),i})},Ls=(e,r)=>(P("replaceStars",e,r),e.trim().replace(O[C.STAR],"")),$s=(e,r)=>(P("replaceGTE0",e,r),e.trim().replace(O[r.includePrerelease?C.GTE0PRE:C.GTE0],"")),ks=e=>(r,t,i,n,s,o,l,h,u,b,w,R)=>(F(i)?t="":F(n)?t=`>=${i}.0.0${e?"-0":""}`:F(s)?t=`>=${i}.${n}.0${e?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${e?"-0":""}`,F(u)?h="":F(b)?h=`<${+u+1}.0.0-0`:F(w)?h=`<${u}.${+b+1}.0-0`:R?h=`<=${u}.${b}.${w}-${R}`:e?h=`<${u}.${b}.${+w+1}-0`:h=`<=${h}`,`${t} ${h}`.trim()),Ts=(e,r,t)=>{for(let i=0;i<e.length;i++)if(!e[i].test(r))return!1;if(r.prerelease.length&&!t.includePrerelease){for(let i=0;i<e.length;i++)if(P(e[i].semver),e[i].semver!==Ar.ANY&&e[i].semver.prerelease.length>0){let n=e[i].semver;if(n.major===r.major&&n.minor===r.minor&&n.patch===r.patch)return!0}return!1}return!0}});var hi=y((_c,fi)=>{"use strict";var js=Rr(),Ns=(e,r,t)=>{try{r=new js(r,t)}catch{return!1}return r.test(e)};fi.exports=Ns});var Sr=y((Uc,Cs)=>{Cs.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.2",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:{install:"node install/check",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types","test-lint":"semistandard && cpplint","test-unit":"nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha","test-licensing":'license-checker --production --summary --onlyAllow="Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT"',"test-leak":"./test/leak/leak.sh","test-types":"tsd","package-from-local-build":"node npm/from-local-build","package-from-github-release":"node npm/from-github-release","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:{color:"^4.2.3","detect-libc":"^2.0.4",semver:"^7.7.2"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.2","@img/sharp-darwin-x64":"0.34.2","@img/sharp-libvips-darwin-arm64":"1.1.0","@img/sharp-libvips-darwin-x64":"1.1.0","@img/sharp-libvips-linux-arm":"1.1.0","@img/sharp-libvips-linux-arm64":"1.1.0","@img/sharp-libvips-linux-ppc64":"1.1.0","@img/sharp-libvips-linux-s390x":"1.1.0","@img/sharp-libvips-linux-x64":"1.1.0","@img/sharp-libvips-linuxmusl-arm64":"1.1.0","@img/sharp-libvips-linuxmusl-x64":"1.1.0","@img/sharp-linux-arm":"0.34.2","@img/sharp-linux-arm64":"0.34.2","@img/sharp-linux-s390x":"0.34.2","@img/sharp-linux-x64":"0.34.2","@img/sharp-linuxmusl-arm64":"0.34.2","@img/sharp-linuxmusl-x64":"0.34.2","@img/sharp-wasm32":"0.34.2","@img/sharp-win32-arm64":"0.34.2","@img/sharp-win32-ia32":"0.34.2","@img/sharp-win32-x64":"0.34.2"},devDependencies:{"@emnapi/runtime":"^1.4.3","@img/sharp-libvips-dev":"1.1.0","@img/sharp-libvips-dev-wasm32":"1.1.0","@img/sharp-libvips-win32-arm64":"1.1.0","@img/sharp-libvips-win32-ia32":"1.1.0","@img/sharp-libvips-win32-x64":"1.1.0","@types/node":"*",cc:"^3.0.1",emnapi:"^1.4.3","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.1","license-checker":"^25.0.1",mocha:"^11.4.0","node-addon-api":"^8.3.1",nyc:"^17.1.0",prebuild:"^13.0.1",semistandard:"^17.0.0","tar-fs":"^3.0.8",tsd:"^0.32.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.16.1"},funding:{url:"https://opencollective.com/libvips"},binary:{napi_versions:[9]},semistandard:{env:["mocha"]},cc:{linelength:"120",filter:["build/include"]},nyc:{include:["lib"]},tsd:{directory:"test/types/"}}});var $r=y((zc,vi)=>{"use strict";var{spawnSync:Ye}=I("child_process"),{createHash:Fs}=I("crypto"),gi=Ft(),Bs=yr(),Os=hi(),ui=ze(),{config:qs,engines:di,optionalDependencies:Ms}=Sr(),Ds=process.env.npm_package_config_libvips||qs.libvips,pi=gi(Ds).version,_s=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],Ze={encoding:"utf8",shell:!0},Us=e=>{e instanceof Error?console.error(`sharp: Installation error: ${e.message}`):console.log(`sharp: ${e}`)},bi=()=>ui.isNonGlibcLinuxSync()?ui.familySync():"",zs=()=>`${process.platform}${bi()}-${process.arch}`,Ee=()=>{if(wi())return"wasm32";let{npm_config_arch:e,npm_config_platform:r,npm_config_libc:t}=process.env,i=typeof t=="string"?t:bi();return`${r||process.platform}${i}-${e||process.arch}`},Gs=()=>{try{return I(`@img/sharp-libvips-dev-${Ee()}/include`)}catch{try{return I("@img/sharp-libvips-dev/include")}catch{}}return""},Hs=()=>{try{return I("@img/sharp-libvips-dev/cplusplus")}catch{}return""},Ws=()=>{try{return I(`@img/sharp-libvips-dev-${Ee()}/lib`)}catch{try{return I(`@img/sharp-libvips-${Ee()}/lib`)}catch{}}return""},Vs=()=>{var e;if(((e=process.release)==null?void 0:e.name)==="node"&&process.versions&&!Os(process.versions.node,di.node))return{found:process.versions.node,expected:di.node}},wi=()=>{let{CC:e}=process.env;return!!(e&&e.endsWith("/emcc"))},Xs=()=>process.platform==="darwin"&&process.arch==="x64"?(Ye("sysctl sysctl.proc_translated",Ze).stdout||"").trim()==="sysctl.proc_translated: 1":!1,mi=e=>Fs("sha512").update(e).digest("hex"),Qs=()=>{try{let e=mi(`imgsharp-libvips-${Ee()}`),r=gi(Ms[`@img/sharp-libvips-${Ee()}`],{includePrerelease:!0}).version;return mi(`${e}npm:${r}`).slice(0,10)}catch{}return""},Js=()=>Ye(`node-gyp rebuild --directory=src ${wi()?"--nodedir=emscripten":""}`,{...Ze,stdio:"inherit"}).status,yi=()=>process.platform!=="win32"?(Ye("pkg-config --modversion vips-cpp",{...Ze,env:{...process.env,PKG_CONFIG_PATH:Ei()}}).stdout||"").trim():"",Ei=()=>process.platform!=="win32"?[(Ye('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',Ze).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",Lr=(e,r,t)=>(t&&t(`Detected ${r}, skipping search for globally-installed libvips`),e),Ks=e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return Lr(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return Lr(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(Xs())return Lr(!1,"Rosetta",e);let r=yi();return!!r&&Bs(r,pi)};vi.exports={minimumLibvipsVersion:pi,prebuiltPlatforms:_s,buildPlatformArch:Ee,buildSharpLibvipsIncludeDir:Gs,buildSharpLibvipsCPlusPlusDir:Hs,buildSharpLibvipsLibDir:Ws,isUnsupportedNodeRuntime:Vs,runtimePlatformArch:zs,log:Us,yarnLocator:Qs,spawnRebuild:Js,globalLibvipsVersion:yi,pkgConfigPath:Ei,useGlobalLibvips:Ks}});var Fe=y((Hc,Pi)=>{"use strict";var{familySync:Ys,versionSync:Zs}=ze(),{runtimePlatformArch:eo,isUnsupportedNodeRuntime:xi,prebuiltPlatforms:ro,minimumLibvipsVersion:to}=$r(),de=eo(),io=[`../src/build/Release/sharp-${de}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${de}/sharp.node`,"@img/sharp-wasm32/sharp.node"],kr,ve,Ce=[];for(kr of io)try{ve=I(kr);break}catch(e){Ce.push(e)}if(ve&&kr.startsWith("@img/sharp-linux-x64")&&!ve._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",Ce.push(e),ve=null}if(ve)Pi.exports=ve;else{let[e,r,t]=["linux","darwin","win32"].map(s=>de.startsWith(s)),i=[`Could not load the "sharp" module using the ${de} runtime`];Ce.forEach(s=>{s.code!=="MODULE_NOT_FOUND"&&i.push(`${s.code}: ${s.message}`)});let n=Ce.map(s=>s.message).join(" ");if(i.push("Possible solutions:"),xi()){let{found:s,expected:o}=xi();i.push("- Please upgrade Node.js:",` Found ${s}`,` Requires ${o}`)}else if(ro.includes(de)){let[s,o]=de.split("-"),l=s.endsWith("musl")?" --libc=musl":"";i.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=${s.replace("musl","")}${l} --cpu=${o} sharp`)}else i.push(`- Manually install libvips >= ${to}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(n))try{let{config:s}=I(`@img/sharp-libvips-${de}/package`),o=`${Ys()} ${Zs()}`,l=`${s.musl?"musl":"glibc"} ${s.musl||s.glibc}`;i.push("- Update your OS:",` Found ${o}`,` Requires ${l}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(n)&&i.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node"),r&&/Incompatible library version/.test(n)&&i.push("- Update Homebrew:"," brew update && brew upgrade vips"),Ce.some(s=>s.code==="ERR_DLOPEN_DISABLED")&&i.push("- Run Node.js without using the --no-addons flag"),t&&/The specified procedure could not be found/.test(n)&&i.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"),i.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(i.join(` `))}});var Ii=y((Vc,Ri)=>{"use strict";var no=I("util"),Tr=I("stream"),ao=J();Fe();var so=no.debuglog("sharp"),me=function(e,r){if(arguments.length===1&&!ao.defined(e))throw new Error("Invalid input");return this instanceof me?(Tr.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],rotateBeforePreExtract:!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,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,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",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:t=>{this.emit("warning",t),so(t)},queueListener:function(t){me.queue.emit("change",t)}},this.options.input=this._createInputDescriptor(e,r,{allowStream:!0}),this):new me(e,r)};Object.setPrototypeOf(me.prototype,Tr.Duplex.prototype);Object.setPrototypeOf(me,Tr.Duplex);function oo(){let e=this.constructor.call(),{debuglog:r,queueListener:t,...i}=this.options;return e.options=structuredClone(i),e.options.debuglog=r,e.options.queueListener=t,this._isStreamInput()&&this.on("finish",()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")}),e}Object.assign(me.prototype,{clone:oo});Ri.exports=me});var Li=y((Xc,Si)=>{"use strict";var f=J(),le=Fe(),lo={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"};function Ai(e){let{raw:r,density:t,limitInputPixels:i,ignoreIcc:n,unlimited:s,sequentialRead:o,failOn:l,failOnError:h,animated:u,page:b,pages:w,subifd:R,pdfBackground:T,autoOrient:v}=e;return[r,t,i,n,s,o,l,h,u,b,w,R,T,v].some(f.defined)?{raw:r,density:t,limitInputPixels:i,ignoreIcc:n,unlimited:s,sequentialRead:o,failOn:l,failOnError:h,animated:u,page:b,pages:w,subifd:R,pdfBackground:T,autoOrient:v}:void 0}function co(e,r,t){let i={autoOrient:!1,failOn:"warning",limitInputPixels:Math.pow(16383,2),ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(f.string(e))i.file=e;else if(f.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");i.buffer=e}else if(f.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");i.buffer=Buffer.from(e,0,e.byteLength)}else if(f.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");i.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(f.plainObject(e)&&!f.defined(r))r=e,Ai(r)&&(i.buffer=[]);else if(!f.defined(e)&&!f.defined(r)&&f.object(t)&&t.allowStream)i.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(n=>this._createInputDescriptor(n));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}${f.defined(r)?` when also providing options of type ${typeof r}`:""}`);if(f.object(r)){if(f.defined(r.failOnError))if(f.bool(r.failOnError))i.failOn=r.failOnError?"warning":"none";else throw f.invalidParameterError("failOnError","boolean",r.failOnError);if(f.defined(r.failOn))if(f.string(r.failOn)&&f.inArray(r.failOn,["none","truncated","error","warning"]))i.failOn=r.failOn;else throw f.invalidParameterError("failOn","one of: none, truncated, error, warning",r.failOn);if(f.defined(r.autoOrient))if(f.bool(r.autoOrient))i.autoOrient=r.autoOrient;else throw f.invalidParameterError("autoOrient","boolean",r.autoOrient);if(f.defined(r.density))if(f.inRange(r.density,1,1e5))i.density=r.density;else throw f.invalidParameterError("density","number between 1 and 100000",r.density);if(f.defined(r.ignoreIcc))if(f.bool(r.ignoreIcc))i.ignoreIcc=r.ignoreIcc;else throw f.invalidParameterError("ignoreIcc","boolean",r.ignoreIcc);if(f.defined(r.limitInputPixels))if(f.bool(r.limitInputPixels))i.limitInputPixels=r.limitInputPixels?Math.pow(16383,2):0;else if(f.integer(r.limitInputPixels)&&f.inRange(r.limitInputPixels,0,Number.MAX_SAFE_INTEGER))i.limitInputPixels=r.limitInputPixels;else throw f.invalidParameterError("limitInputPixels","positive integer",r.limitInputPixels);if(f.defined(r.unlimited))if(f.bool(r.unlimited))i.unlimited=r.unlimited;else throw f.invalidParameterError("unlimited","boolean",r.unlimited);if(f.defined(r.sequentialRead))if(f.bool(r.sequentialRead))i.sequentialRead=r.sequentialRead;else throw f.invalidParameterError("sequentialRead","boolean",r.sequentialRead);if(f.defined(r.raw))if(f.object(r.raw)&&f.integer(r.raw.width)&&r.raw.width>0&&f.integer(r.raw.height)&&r.raw.height>0&&f.integer(r.raw.channels)&&f.inRange(r.raw.channels,1,4))switch(i.rawWidth=r.raw.width,i.rawHeight=r.raw.height,i.rawChannels=r.raw.channels,i.rawPremultiplied=!!r.raw.premultiplied,e.constructor){case Uint8Array:case Uint8ClampedArray:i.rawDepth="uchar";break;case Int8Array:i.rawDepth="char";break;case Uint16Array:i.rawDepth="ushort";break;case Int16Array:i.rawDepth="short";break;case Uint32Array:i.rawDepth="uint";break;case Int32Array:i.rawDepth="int";break;case Float32Array:i.rawDepth="float";break;case Float64Array:i.rawDepth="double";break;default:i.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(f.defined(r.animated))if(f.bool(r.animated))i.pages=r.animated?-1:1;else throw f.invalidParameterError("animated","boolean",r.animated);if(f.defined(r.pages))if(f.integer(r.pages)&&f.inRange(r.pages,-1,1e5))i.pages=r.pages;else throw f.invalidParameterError("pages","integer between -1 and 100000",r.pages);if(f.defined(r.page))if(f.integer(r.page)&&f.inRange(r.page,0,1e5))i.page=r.page;else throw f.invalidParameterError("page","integer between 0 and 100000",r.page);if(f.defined(r.level))if(f.integer(r.level)&&f.inRange(r.level,0,256))i.level=r.level;else throw f.invalidParameterError("level","integer between 0 and 256",r.level);if(f.defined(r.subifd))if(f.integer(r.subifd)&&f.inRange(r.subifd,-1,1e5))i.subifd=r.subifd;else throw f.invalidParameterError("subifd","integer between -1 and 100000",r.subifd);if(f.defined(r.pdfBackground)&&(i.pdfBackground=this._getBackgroundColourOption(r.pdfBackground)),f.defined(r.create))if(f.object(r.create)&&f.integer(r.create.width)&&r.create.width>0&&f.integer(r.create.height)&&r.create.height>0&&f.integer(r.create.channels)){if(i.createWidth=r.create.width,i.createHeight=r.create.height,i.createChannels=r.create.channels,f.defined(r.create.noise)){if(!f.object(r.create.noise))throw new Error("Expected noise to be an object");if(!f.inArray(r.create.noise.type,["gaussian"]))throw new Error("Only gaussian noise is supported at the moment");if(!f.inRange(r.create.channels,1,4))throw f.invalidParameterError("create.channels","number between 1 and 4",r.create.channels);if(i.createNoiseType=r.create.noise.type,f.number(r.create.noise.mean)&&f.inRange(r.create.noise.mean,0,1e4))i.createNoiseMean=r.create.noise.mean;else throw f.invalidParameterError("create.noise.mean","number between 0 and 10000",r.create.noise.mean);if(f.number(r.create.noise.sigma)&&f.inRange(r.create.noise.sigma,0,1e4))i.createNoiseSigma=r.create.noise.sigma;else throw f.invalidParameterError("create.noise.sigma","number between 0 and 10000",r.create.noise.sigma)}else if(f.defined(r.create.background)){if(!f.inRange(r.create.channels,3,4))throw f.invalidParameterError("create.channels","number between 3 and 4",r.create.channels);i.createBackground=this._getBackgroundColourOption(r.create.background)}else throw new Error("Expected valid noise or background to create a new input image");delete i.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(f.defined(r.text))if(f.object(r.text)&&f.string(r.text.text)){if(i.textValue=r.text.text,f.defined(r.text.height)&&f.defined(r.text.dpi))throw new Error("Expected only one of dpi or height");if(f.defined(r.text.font))if(f.string(r.text.font))i.textFont=r.text.font;else throw f.invalidParameterError("text.font","string",r.text.font);if(f.defined(r.text.fontfile))if(f.string(r.text.fontfile))i.textFontfile=r.text.fontfile;else throw f.invalidParameterError("text.fontfile","string",r.text.fontfile);if(f.defined(r.text.width))if(f.integer(r.text.width)&&r.text.width>0)i.textWidth=r.text.width;else throw f.invalidParameterError("text.width","positive integer",r.text.width);if(f.defined(r.text.height))if(f.integer(r.text.height)&&r.text.height>0)i.textHeight=r.text.height;else throw f.invalidParameterError("text.height","positive integer",r.text.height);if(f.defined(r.text.align))if(f.string(r.text.align)&&f.string(this.constructor.align[r.text.align]))i.textAlign=this.constructor.align[r.text.align];else throw f.invalidParameterError("text.align","valid alignment",r.text.align);if(f.defined(r.text.justify))if(f.bool(r.text.justify))i.textJustify=r.text.justify;else throw f.invalidParameterError("text.justify","boolean",r.text.justify);if(f.defined(r.text.dpi))if(f.integer(r.text.dpi)&&f.inRange(r.text.dpi,1,1e6))i.textDpi=r.text.dpi;else throw f.invalidParameterError("text.dpi","integer between 1 and 1000000",r.text.dpi);if(f.defined(r.text.rgba))if(f.bool(r.text.rgba))i.textRgba=r.text.rgba;else throw f.invalidParameterError("text.rgba","bool",r.text.rgba);if(f.defined(r.text.spacing))if(f.integer(r.text.spacing)&&f.inRange(r.text.spacing,-1e6,1e6))i.textSpacing=r.text.spacing;else throw f.invalidParameterError("text.spacing","integer between -1000000 and 1000000",r.text.spacing);if(f.defined(r.text.wrap))if(f.string(r.text.wrap)&&f.inArray(r.text.wrap,["word","char","word-char","none"]))i.textWrap=r.text.wrap;else throw f.invalidParameterError("text.wrap","one of: word, char, word-char, none",r.text.wrap);delete i.buffer}else throw new Error("Expected a valid string to create an image with text.");if(f.defined(r.join))if(f.defined(this.options.join)){if(f.defined(r.join.animated))if(f.bool(r.join.animated))i.joinAnimated=r.join.animated;else throw f.invalidParameterError("join.animated","boolean",r.join.animated);if(f.defined(r.join.across))if(f.integer(r.join.across)&&f.inRange(r.join.across,1,1e6))i.joinAcross=r.join.across;else throw f.invalidParameterError("join.across","integer between 1 and 100000",r.join.across);if(f.defined(r.join.shim))if(f.integer(r.join.shim)&&f.inRange(r.join.shim,0,1e6))i.joinShim=r.join.shim;else throw f.invalidParameterError("join.shim","integer between 0 and 100000",r.join.shim);if(f.defined(r.join.background)&&(i.joinBackground=this._getBackgroundColourOption(r.join.background)),f.defined(r.join.halign))if(f.string(r.join.halign)&&f.string(this.constructor.align[r.join.halign]))i.joinHalign=this.constructor.align[r.join.halign];else throw f.invalidParameterError("join.halign","valid alignment",r.join.halign);if(f.defined(r.join.valign))if(f.string(r.join.valign)&&f.string(this.constructor.align[r.join.valign]))i.joinValign=this.constructor.align[r.join.valign];else throw f.invalidParameterError("join.valign","valid alignment",r.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(f.defined(r))throw new Error("Invalid input options "+r);return i}function fo(e,r,t){Array.isArray(this.options.input.buffer)?f.buffer(e)?(this.options.input.buffer.length===0&&this.on("finish",()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),t()):t(new Error("Non-Buffer data on Writable Stream")):t(new Error("Unexpected data on Writable Stream"))}function ho(){this._isStreamInput()&&(this.options.input.buffer=Buffer.concat(this.options.input.buffer))}function uo(){return Array.isArray(this.options.input.buffer)}function mo(e){let r=Error();return f.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),le.metadata(this.options,(t,i)=>{t?e(f.nativeError(t,r)):e(null,i)})}):le.metadata(this.options,(t,i)=>{t?e(f.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{let n=()=>{this._flattenBufferIn(),le.metadata(this.options,(s,o)=>{s?i(f.nativeError(s,r)):t(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((t,i)=>{le.metadata(this.options,(n,s)=>{n?i(f.nativeError(n,r)):t(s)})})}function go(e){let r=Error();return f.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),le.stats(this.options,(t,i)=>{t?e(f.nativeError(t,r)):e(null,i)})}):le.stats(this.options,(t,i)=>{t?e(f.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{this.on("finish",function(){this._flattenBufferIn(),le.stats(this.options,(n,s)=>{n?i(f.nativeError(n,r)):t(s)})})}):new Promise((t,i)=>{le.stats(this.options,(n,s)=>{n?i(f.nativeError(n,r)):t(s)})})}Si.exports=function(e){Object.assign(e.prototype,{_inputOptionsFromObject:Ai,_createInputDescriptor:co,_write:fo,_flattenBufferIn:ho,_isStreamInput:uo,metadata:mo,stats:go}),e.align=lo}});var Ci=y((Qc,Ni)=>{"use strict";var p=J(),ki={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},Ti={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},$i={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},ji={entropy:16,attention:17},jr={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},po={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},bo={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function Nr(e){return e.angle%360!==0||e.input.autoOrient===!0||e.rotationAngle!==0}function er(e){return e.width!=