/** * @licstart The following is the entire license notice for the * JavaScript code in this page * * Copyright 2024 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @licend The above is the entire license notice for the * JavaScript code in this page */ /** * pdfjsVersion = 5.7.284 * pdfjsBuild = 7e5b36c2d */"object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type;const t=[1/0,1/0,-1/0,-1/0],e=(new Float32Array(t),{ERRORS:0,WARNINGS:1,INFOS:5});let r=e.WARNINGS;function setVerbosityLevel(t){Number.isInteger(t)&&(r=t)}function getVerbosityLevel(){return r}function info(t){r>=e.INFOS&&console.info(`Info: ${t}`)}function warn(t){r>=e.WARNINGS&&console.warn(`Warning: ${t}`)}function unreachable(t){throw new Error(t)}function shadow(t,e,r,n=!1){Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!0,writable:!1});return r}const n=function BaseExceptionClosure(){function BaseException(t,e){this.message=t;this.name=e}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class FormatError extends n{constructor(t){super(t,"FormatError")}}function bytesToString(t){"object"==typeof t&&void 0!==t?.length||unreachable("Invalid argument for bytesToString");const e=t.length,r=8192;if(e{if("undefined"==typeof document)return!1;const t=document.createElement("input");t.type="color";t.setAttribute("alpha","");t.value="#ff000080";return"#ff0000"!==t.value})())}}class Util{static get hexNums(){return shadow(this,"hexNums",Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0")))}static makeHexColor(t,e,r){return`#${this.hexNums[t]}${this.hexNums[e]}${this.hexNums[r]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let r;if(t[0]){if(t[0]<0){r=e[0];e[0]=e[2];e[2]=r}e[0]*=t[0];e[2]*=t[0];if(t[3]<0){r=e[1];e[1]=e[3];e[3]=r}e[1]*=t[3];e[3]*=t[3]}else{r=e[0];e[0]=e[1];e[1]=r;r=e[2];e[2]=e[3];e[3]=r;if(t[1]<0){r=e[1];e[1]=e[3];e[3]=r}e[1]*=t[1];e[3]*=t[1];if(t[2]<0){r=e[0];e[0]=e[2];e[2]=r}e[0]*=t[2];e[2]*=t[2]}e[0]+=t[4];e[1]+=t[5];e[2]+=t[4];e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,r=0){const n=t[r],s=t[r+1];t[r]=n*e[0]+s*e[2]+e[4];t[r+1]=n*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e,r=0){const n=e[0],s=e[1],a=e[2],i=e[3],o=e[4],c=e[5];for(let e=0;e<6;e+=2){const l=t[r+e],u=t[r+e+1];t[r+e]=l*n+u*a+o;t[r+e+1]=l*s+u*i+c}}static applyInverseTransform(t,e){const r=t[0],n=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(r*e[3]-n*e[2]+e[2]*e[5]-e[4]*e[3])/s;t[1]=(-r*e[1]+n*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,r){const n=e[0],s=e[1],a=e[2],i=e[3],o=e[4],c=e[5],l=t[0],u=t[1],f=t[2],h=t[3];let m=n*l+o,g=m,d=n*f+o,p=d,b=i*u+c,y=b,w=i*h+c,C=w;if(0!==s||0!==a){const t=s*l,e=s*f,r=a*u,n=a*h;m+=r;p+=r;d+=n;g+=n;b+=t;C+=t;w+=e;y+=e}r[0]=Math.min(r[0],m,d,g,p);r[1]=Math.min(r[1],b,w,y,C);r[2]=Math.max(r[2],m,d,g,p);r[3]=Math.max(r[3],b,w,y,C)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const r=t[0],n=t[1],s=t[2],a=t[3],i=r**2+n**2,o=r*s+n*a,c=s**2+a**2,l=(i+c)/2,u=Math.sqrt(l**2-(i*c-o**2));e[0]=Math.sqrt(l+u||1);e[1]=Math.sqrt(l-u||1)}static normalizeRect(t){const e=t.slice(0);if(t[0]>t[2]){e[0]=t[2];e[2]=t[0]}if(t[1]>t[3]){e[1]=t[3];e[3]=t[1]}return e}static intersect(t,e){const r=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(r>n)return null;const s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>a?null:[r,s,n,a]}static pointBoundingBox(t,e,r){r[0]=Math.min(r[0],t);r[1]=Math.min(r[1],e);r[2]=Math.max(r[2],t);r[3]=Math.max(r[3],e)}static rectBoundingBox(t,e,r,n,s){s[0]=Math.min(s[0],t,r);s[1]=Math.min(s[1],e,n);s[2]=Math.max(s[2],t,r);s[3]=Math.max(s[3],e,n)}static#t(t,e,r,n,s,a,i,o,c,l){if(c<=0||c>=1)return;const u=1-c,f=c*c,h=f*c,m=u*(u*(u*t+3*c*e)+3*f*r)+h*n,g=u*(u*(u*s+3*c*a)+3*f*i)+h*o;l[0]=Math.min(l[0],m);l[1]=Math.min(l[1],g);l[2]=Math.max(l[2],m);l[3]=Math.max(l[3],g)}static#e(t,e,r,n,s,a,i,o,c,l,u,f){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#t(t,e,r,n,s,a,i,o,-u/l,f);return}const h=l**2-4*u*c;if(h<0)return;const m=Math.sqrt(h),g=2*c;this.#t(t,e,r,n,s,a,i,o,(-l+m)/g,f);this.#t(t,e,r,n,s,a,i,o,(-l-m)/g,f)}static bezierBoundingBox(t,e,r,n,s,a,i,o,c){c[0]=Math.min(c[0],t,i);c[1]=Math.min(c[1],e,o);c[2]=Math.max(c[2],t,i);c[3]=Math.max(c[3],e,o);this.#e(t,r,s,i,e,n,a,o,3*(3*(r-s)-t+i),6*(t-2*r+s),3*(r-t),c);this.#e(t,r,s,i,e,n,a,o,3*(3*(n-a)-e+o),6*(e-2*n+a),3*(n-e),c)}}Symbol("CIRCULAR_REF"),Symbol("EOF");Object.create(null);let s=Object.create(null),a=Object.create(null);class Name{constructor(t){this.name=t}static get(t){return s[t]||=new Name(t)}}const i=function nonSerializableClosure(){return i};class Dict{__nonSerializable__=i;#r=new Map;objId=null;suppressEncryption=!1;xref;constructor(t=null){this.xref=t}assignXref(t){this.xref=t}get size(){return this.#r.size}#n(t,e,r,n){let s=this.#r.get(e);if(void 0===s&&void 0!==r){s=this.#r.get(r);void 0===s&&void 0!==n&&(s=this.#r.get(n))}return s instanceof Ref&&this.xref?t?this.xref.fetchAsync(s,this.suppressEncryption):this.xref.fetch(s,this.suppressEncryption):s}get(t,e,r){return this.#n(!1,t,e,r)}async getAsync(t,e,r){return this.#n(!0,t,e,r)}getArray(t,e,r){let n=this.#n(!1,t,e,r);if(Array.isArray(n)){n=n.slice();for(let t=0,e=n.length;t{unreachable("Should not call `set` on the empty dictionary.")};return shadow(this,"empty",t)}static merge({xref:t,dictArray:e,mergeSubDicts:r=!1}){const n=new Dict(t),s=new Map;for(const t of e)if(t instanceof Dict)for(const[e,n]of t.getRawEntries()){let t=s.get(e);if(void 0===t){t=[];s.set(e,t)}else if(!(r&&n instanceof Dict))continue;t.push(n)}for(const[e,r]of s){if(1===r.length||!(r[0]instanceof Dict)){n.set(e,r[0]);continue}const s=new Dict(t);for(const t of r)for(const[e,r]of t.getRawEntries())s.setIfNotExists(e,r);s.size>0&&n.set(e,s)}s.clear();return n.size>0?n:Dict.empty}clone(){const t=new Dict(this.xref);for(const[e,r]of this.#r)t.set(e,r);return t}delete(t){this.#r.delete(t)}}class Ref{constructor(t,e){this.num=t;this.gen=e}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(t){const e=a[t];if(e)return e;const r=/^(\d+)R(\d*)$/.exec(t);return r&&"0"!==r[1]?a[t]=new Ref(parseInt(r[1],10),r[2]?parseInt(r[2],10):0):null}static get(t,e){const r=0===e?`${t}R`:`${t}R${e}`;return a[r]||=new Ref(t,e)}}Symbol.iterator;Symbol.iterator;class BaseStream{get length(){unreachable("Abstract getter `length` accessed")}get isEmpty(){unreachable("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return shadow(this,"isDataLoaded",!0)}getByte(){unreachable("Abstract method `getByte` called")}getBytes(t){unreachable("Abstract method `getBytes` called")}async getImageData(t,e){return this.getBytes(t,e)}async asyncGetBytes(){unreachable("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get isAsyncDecoder(){return!1}get isImageStream(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}async getTransferableImage(){return null}peekByte(){const t=this.getByte();-1!==t&&this.pos--;return t}peekBytes(t){const e=this.getBytes(t);this.pos-=e.length;return e}getUint16(){const t=this.getByte(),e=this.getByte();return-1===t||-1===e?-1:(t<<8)+e}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(t,e){unreachable("Abstract method `getByteRange` called")}getString(t){return bytesToString(this.getBytes(t))}skip(t){this.pos+=t||1}reset(){unreachable("Abstract method `reset` called")}moveStart(){unreachable("Abstract method `moveStart` called")}makeSubStream(t,e,r=null){unreachable("Abstract method `makeSubStream` called")}getBaseStreams(){return null}getOriginalStream(){return this.stream?.getOriginalStream()||this}}class MissingDataException extends n{constructor(t,e){super(`Missing data [${t}, ${e})`,"MissingDataException");this.begin=t;this.end=e}}async function fetchBinaryData(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch file "${t}" with "${e.statusText}".`);return e.bytes()}const o=async function JBig2(t={}){var e=t,quit_=(t,e)=>{throw e},r=import.meta.url;try{new URL(".",r).href}catch{}0;console.log.bind(console);var n,s,a,i,o,c=console.error.bind(console),l=!1,u=!1;function updateMemoryViews(){var t=h.buffer;i=new Int8Array(t);new Int16Array(t);o=new Uint8Array(t);new Uint16Array(t);new Int32Array(t);new Uint32Array(t);new Float32Array(t);new Float64Array(t);new BigInt64Array(t);new BigUint64Array(t)}class ExitStatus{name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`;this.status=t}}var f,h,callRuntimeCallbacks=t=>{for(;t.length>0;)t.shift()(e)},m=[],addOnPostRun=t=>m.push(t),g=[],addOnPreRun=t=>g.push(t),d=!0,p=0,b={},handleException=t=>{if(t instanceof ExitStatus||"unwind"==t)return n;quit_(0,t)},keepRuntimeAlive=()=>d||p>0,_proc_exit=t=>{n=t;if(!keepRuntimeAlive()){e.onExit?.(t);l=!0}quit_(0,new ExitStatus(t))},_exit=(t,e)=>{n=t;_proc_exit(t)},callUserCallback=t=>{if(!l)try{return t()}catch(t){handleException(t)}finally{(()=>{if(!keepRuntimeAlive())try{_exit(n)}catch(t){handleException(t)}})()}},alignMemory=(t,e)=>Math.ceil(t/e)*e,growMemory=t=>{var e=(t-h.buffer.byteLength+65535)/65536|0;try{h.grow(e);updateMemoryViews();return 1}catch(t){}};e.noExitRuntime&&(d=e.noExitRuntime);e.print&&e.print;e.printErr&&(c=e.printErr);e.wasmBinary&&e.wasmBinary;e.arguments&&e.arguments;e.thisProgram&&e.thisProgram;if(e.preInit){"function"==typeof e.preInit&&(e.preInit=[e.preInit]);for(;e.preInit.length>0;)e.preInit.shift()()}e.writeArrayToMemory=(t,e)=>{i.set(t,e)};var y,w={e:()=>function abort(t){e.onAbort?.(t);c(t="Aborted("+t+")");l=!0;t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);a?.(r);throw r}(""),b:()=>{d=!1;p=0},c:(t,e)=>{if(b[t]){clearTimeout(b[t].id);delete b[t]}if(!e)return 0;var r=setTimeout(()=>{delete b[t];callUserCallback(()=>f(t,performance.now()))},e);b[t]={id:r,timeout_ms:e};return 0},g:function _createImageData(t){e.imageData=new Uint8Array(t)},d:t=>{var e=o.length,r=2147483648;if((t>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var s=e*(1+.2/n);s=Math.min(s,t+100663296);var a=Math.min(r,alignMemory(Math.max(t,s),65536));if(growMemory(a))return!0}return!1},a:_proc_exit,h:function _setImageData(t,r,n,s){if(n===r){e.imageData=new Uint8ClampedArray(o.subarray(t,t+n*s));return}const a=r*s,i=e.imageData=new Uint8ClampedArray(a);for(let e=t,s=0;s{e.instantiateWasm(t,(t,e)=>{r(receiveInstance(t))})})}();!function run(){!function preRun(){if(e.preRun){"function"==typeof e.preRun&&(e.preRun=[e.preRun]);for(;e.preRun.length;)addOnPreRun(e.preRun.shift())}callRuntimeCallbacks(g)}();function doRun(){e.calledRun=!0;if(!l){!function initRuntime(){u=!0;y.j()}();s?.(e);e.onRuntimeInitialized?.();!function postRun(){if(e.postRun){"function"==typeof e.postRun&&(e.postRun=[e.postRun]);for(;e.postRun.length;)addOnPostRun(e.postRun.shift())}callRuntimeCallbacks(m)}()}}if(e.setStatus){e.setStatus("Running...");setTimeout(()=>{setTimeout(()=>e.setStatus(""),1);doRun()},1)}else doRun()}();return u?e:new Promise((t,e)=>{s=t;a=e})};class Jbig2Error extends n{constructor(t){super(t,"Jbig2Error")}}class JBig2CCITTFaxImage{static#s=null;static#a=null;static#i=null;static#o=!0;static#c=!0;static#l=null;static setOptions({handler:t,useWasm:e,useWorkerFetch:r,wasmUrl:n}){this.#o=e;this.#c=r;this.#l=n;r||(this.#a=t)}static async#u(t){const e=`${this.#l}jbig2_nowasm_fallback.js`;let r=null;try{r=(await import( /*webpackIgnore: true*/ /*@vite-ignore*/ e)).default()}catch(t){warn(`JBig2CCITTFaxImage#getJsModule: ${t}`)}t(r)}static async#f(t,e,r){const n="jbig2.wasm";try{this.#s||(this.#c?this.#s=await fetchBinaryData(`${this.#l}${n}`):this.#s=await this.#a.sendWithPromise("FetchBinaryData",{kind:"wasmUrl",filename:n}));return r((await WebAssembly.instantiate(this.#s,e)).instance)}catch(e){warn(`JBig2CCITTFaxImage#instantiateWasm: ${e}`);this.#u(t);return null}finally{this.#a=null}}static async decode(t,e,r,n,s){if(!this.#i){const{promise:t,resolve:e}=Promise.withResolvers(),r=[t];this.#o?r.push(o({warn,instantiateWasm:this.#f.bind(this,e)})):this.#u(e);this.#i=Promise.race(r)}const a=await this.#i;if(!a)throw new Jbig2Error("JBig2 failed to initialize");let i,c;try{const o=t.length;i=a._malloc(o);a.writeArrayToMemory(t,i);if(s)a._ccitt_decode(i,o,e,r,s.K,s.EndOfLine?1:0,s.EncodedByteAlign?1:0,s.BlackIs1?1:0,s.Columns,s.Rows);else{const t=n?n.length:0;if(t>0){c=a._malloc(t);a.writeArrayToMemory(n,c)}a._jbig2_decode(i,o,e,r,c,t)}if(!a.imageData)throw new Jbig2Error("Unknown error");const{imageData:l}=a;a.imageData=null;return l}finally{i&&a._free(i);c&&a._free(c)}}static cleanup(){this.#i=null}}function MathClamp(t,e,r){return Math.min(Math.max(t,e),r)}function isDefaultDecodeHelper(t,e){if(!Array.isArray(t))return!0;const r=t.length;if(re){info("Truncating too long decode map.");t.length=e}return!1}class ColorSpace{static#h=new Uint8ClampedArray(3);constructor(t,e){this.name=t;this.numComps=e}getRgb(t,e,r=new Uint8ClampedArray(3)){this.getRgbItem(t,e,r,0);return r}getRgbHex(t,e){const r=this.getRgb(t,e,ColorSpace.#h);return Util.makeHexColor(r[0],r[1],r[2])}getRgbItem(t,e,r,n){unreachable("Should not call ColorSpace.getRgbItem")}getRgbBuffer(t,e,r,n,s,a,i){unreachable("Should not call ColorSpace.getRgbBuffer")}getOutputLength(t,e){unreachable("Should not call ColorSpace.getOutputLength")}isPassthrough(t){return!1}isDefaultDecode(t,e){return ColorSpace.isDefaultDecode(t,this.numComps)}fillRgb(t,e,r,n,s,a,i,o,c){const l=e*r;let u=null;const f=1<f&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const e=i<=8?new Uint8Array(f):new Uint16Array(f);for(let t=0;t=.99554525?1:MathClamp(1.055*t**(1/2.4)-.055,0,1)}#S(t){return t<0?-this.#S(-t):t>8?((t+16)/116)**3:t*CalRGBCS.#_}#v(t,e,r){if(0===t[0]&&0===t[1]&&0===t[2]){r[0]=e[0];r[1]=e[1];r[2]=e[2];return}const n=this.#S(0),s=(1-n)/(1-this.#S(t[0])),a=1-s,i=(1-n)/(1-this.#S(t[1])),o=1-i,c=(1-n)/(1-this.#S(t[2])),l=1-c;r[0]=e[0]*s+a;r[1]=e[1]*i+o;r[2]=e[2]*c+l}#M(t,e,r){if(1===t[0]&&1===t[2]){r[0]=e[0];r[1]=e[1];r[2]=e[2];return}const n=r;this.#R(CalRGBCS.#g,e,n);const s=CalRGBCS.#y;this.#A(t,n,s);this.#R(CalRGBCS.#d,s,r)}#I(t,e,r){const n=r;this.#R(CalRGBCS.#g,e,n);const s=CalRGBCS.#y;this.#B(t,n,s);this.#R(CalRGBCS.#d,s,r)}#m(t,e,r,n,s){const a=MathClamp(t[e]*s,0,1),i=MathClamp(t[e+1]*s,0,1),o=MathClamp(t[e+2]*s,0,1),c=1===a?1:a**this.GR,l=1===i?1:i**this.GG,u=1===o?1:o**this.GB,f=this.MXA*c+this.MXB*l+this.MXC*u,h=this.MYA*c+this.MYB*l+this.MYC*u,m=this.MZA*c+this.MZB*l+this.MZC*u,g=CalRGBCS.#w;g[0]=f;g[1]=h;g[2]=m;const d=CalRGBCS.#C;this.#M(this.whitePoint,g,d);const p=CalRGBCS.#w;this.#v(this.blackPoint,d,p);const b=CalRGBCS.#C;this.#I(CalRGBCS.#b,p,b);const y=CalRGBCS.#w;this.#R(CalRGBCS.#p,b,y);r[n]=255*this.#x(y[0]);r[n+1]=255*this.#x(y[1]);r[n+2]=255*this.#x(y[2])}getRgbItem(t,e,r,n){this.#m(t,e,r,n,1)}getRgbBuffer(t,e,r,n,s,a,i){const o=1/((1<this.amax||this.bmin>this.bmax){info("Invalid Range, falling back to defaults");this.amin=-100;this.amax=100;this.bmin=-100;this.bmax=100}}#k(t){return t>=6/29?t**3:108/841*(t-4/29)}#D(t,e,r,n){return r+t*(n-r)/e}#m(t,e,r,n,s){let a=t[e],i=t[e+1],o=t[e+2];if(!1!==r){a=this.#D(a,r,0,100);i=this.#D(i,r,this.amin,this.amax);o=this.#D(o,r,this.bmin,this.bmax)}i>this.amax?i=this.amax:ithis.bmax?o=this.bmax:o=h){f=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});f.decode();m=e}return f.decode(getUint8ArrayMemory0().subarray(t,t+e))}(t>>>=0,e)}(t,e))},__wbg_copy_result_0d15f3bf9d9012ae:function(t,e){!function copy_result(t,e){const{_mustAddAlpha:r,_destBuffer:n,_destOffset:s,_destLength:a,_memoryArray:i}=QCMS;if(e!==a)if(r)for(let r=t,a=t+e,o=s;r>>0,e>>>0)},__wbg_copy_rgb_0106d9d9464fce43:function(t){!function copy_rgb(t){const{_destBuffer:e,_destOffset:r,_memoryArray:n}=QCMS;e[r]=n[t];e[r+1]=n[t+1];e[r+2]=n[t+2]}(t>>>0)},__wbg_make_cssRGB_8e24b34f71f5363e:function(t){!function make_cssRGB(t){const{_memoryArray:e}=QCMS;QCMS._cssColor=QCMS._makeHexColor(e[t],e[t+1],e[t+2])}(t>>>0)},__wbindgen_init_externref_table:function(){const t=d.__wbindgen_externrefs,e=t.grow(4);t.set(0,void 0);t.set(e+0,void 0);t.set(e+1,null);t.set(e+2,!0);t.set(e+3,!1)}}}}let u=null;function getUint8ArrayMemory0(){null!==u&&0!==u.byteLength||(u=new Uint8Array(d.memory.buffer));return u}function passArray8ToWasm0(t,e){const r=e(1*t.length,1)>>>0;getUint8ArrayMemory0().set(t,r/1);p=t.length;return r}let f=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});f.decode();const h=2146435072;let m=0;let g,d,p=0;function __wbg_finalize_init(t,e){d=t.exports;g=e;u=null;d.__wbindgen_start();return d}function fetchSync(t){const e=new XMLHttpRequest;e.open("GET",t,!1);e.responseType="arraybuffer";e.send(null);return e.response}class IccColorSpace extends ColorSpace{#T;#P;static#o=!0;static#l=null;static#U=null;constructor(t,e,r){if(!IccColorSpace.isUsable)throw new Error("No ICC color space support");super(e,r);let n;switch(r){case 1:n=c.Gray8;this.#P=(t,e,r)=>function qcms_convert_one(t,e,r){d.qcms_convert_one(t,e,r)}(this.#T,255*t[e],r);break;case 3:n=c.RGB8;this.#P=(t,e,r)=>function qcms_convert_three(t,e,r,n,s){d.qcms_convert_three(t,e,r,n,s)}(this.#T,255*t[e],255*t[e+1],255*t[e+2],r);break;case 4:n=c.CMYK;this.#P=(t,e,r)=>function qcms_convert_four(t,e,r,n,s,a){d.qcms_convert_four(t,e,r,n,s,a)}(this.#T,255*t[e],255*t[e+1],255*t[e+2],255*t[e+3],r);break;default:throw new Error(`Unsupported number of components: ${r}`)}this.#T=function qcms_transformer_from_memory(t,e,r){const n=passArray8ToWasm0(t,d.__wbindgen_malloc),s=p;return d.qcms_transformer_from_memory(n,s,e,r)>>>0}(t,n,l.Perceptual);if(!this.#T)throw new Error("Failed to create ICC color space");IccColorSpace.#U||=new FinalizationRegistry(t=>{!function qcms_drop_transformer(t){d.qcms_drop_transformer(t)}(t)});IccColorSpace.#U.register(this,this.#T)}getRgbHex(t,e){this.#P(t,e,!0);return QCMS._cssColor}getRgbItem(t,e,r,n){QCMS._destBuffer=r;QCMS._destOffset=n;QCMS._destLength=3;this.#P(t,e,!1);QCMS._destBuffer=null}getRgbBuffer(t,e,r,n,s,a,i){t=t.subarray(e,e+r*this.numComps);if(8!==a){const e=255/((1<0&&!t[a-1];)a--;const i=[{children:[],index:0}];let o,c=i[0];for(r=0;r0;)c=i.pop();c.index++;i.push(c);for(;i.length<=r;){i.push(o={children:[],index:0});c.children[c.index]=o.children;c=o}s++}if(r+10){d--;return g>>d&1}g=t[r++];if(255===g){const s=t[r++];if(s){if(220===s&&u){r+=2;const t=e.getUint16(r);r+=2;if(t>0&&t!==n.scanLines)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",t)}else if(217===s){if(u){const t=C*(8===n.precision?8:0);if(t>0&&Math.round(n.scanLines/t)>=5)throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",t)}throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data")}throw new JpegError(`unexpected marker ${(g<<8|s).toString(16)}`)}}d=7;return g>>>7}function decodeHuffman(t){let e=t;for(;;){e=e[readBit()];switch(typeof e){case"number":return e;case"object":continue}throw new JpegError("invalid huffman sequence")}}function receive(t){let e=0;for(;t>0;){e=e<<1|readBit();t--}return e}function receiveAndExtend(t){if(1===t)return 1===readBit()?1:-1;const e=receive(t);return e>=1<0){p--;return}let r=i;const n=o;for(;r<=n;){const n=decodeHuffman(t.huffmanTableAC),s=15&n,a=n>>4;if(0===s){if(a<15){p=receive(a)+(1<>4;if(0===s)if(c<15){p=receive(c)+(1<>4;if(0===n){if(a<15)break;s+=16;continue}s+=a;const i=b[s];t.blockData[e+i]=receiveAndExtend(n);s++}};let M,I=0;const k=1===_?s[0].blocksPerLine*s[0].blocksPerColumn:f*n.mcusPerColumn;let D,E;for(;I<=k;){const n=a?Math.min(k-I,a):k;if(n>0){for(A=0;A<_;A++)s[A].pred=0;p=0;if(1===_){R=s[0];for(S=0;S0?"unexpected":"excessive"} MCU data, current marker is: ${M.invalid}`);r=M.offset}if(!(M.marker>=65488&&M.marker<=65495))break;r+=2}return r-m}function quantizeAndInverse(t,e,r){const n=t.quantizationTable,s=t.blockData;let a,i,o,c,l,u,f,h,m,g,d,p,b,S,v,M,I;if(!n)throw new JpegError("missing required Quantization Table.");for(let t=0;t<64;t+=8){m=s[e+t];g=s[e+t+1];d=s[e+t+2];p=s[e+t+3];b=s[e+t+4];S=s[e+t+5];v=s[e+t+6];M=s[e+t+7];m*=n[t];if(0!==(g|d|p|b|S|v|M)){g*=n[t+1];d*=n[t+2];p*=n[t+3];b*=n[t+4];S*=n[t+5];v*=n[t+6];M*=n[t+7];a=B*m+128>>8;i=B*b+128>>8;o=d;c=v;l=x*(g-M)+128>>8;h=x*(g+M)+128>>8;u=p<<4;f=S<<4;a=a+i+1>>1;i=a-i;I=o*A+c*R+128>>8;o=o*R-c*A+128>>8;c=I;l=l+f+1>>1;f=l-f;h=h+u+1>>1;u=h-u;a=a+c+1>>1;c=a-c;i=i+o+1>>1;o=i-o;I=l*_+h*C+2048>>12;l=l*C-h*_+2048>>12;h=I;I=u*w+f*y+2048>>12;u=u*y-f*w+2048>>12;f=I;r[t]=a+h;r[t+7]=a-h;r[t+1]=i+f;r[t+6]=i-f;r[t+2]=o+u;r[t+5]=o-u;r[t+3]=c+l;r[t+4]=c-l}else{I=B*m+512>>10;r[t]=I;r[t+1]=I;r[t+2]=I;r[t+3]=I;r[t+4]=I;r[t+5]=I;r[t+6]=I;r[t+7]=I}}for(let t=0;t<8;++t){m=r[t];g=r[t+8];d=r[t+16];p=r[t+24];b=r[t+32];S=r[t+40];v=r[t+48];M=r[t+56];if(0!==(g|d|p|b|S|v|M)){a=B*m+2048>>12;i=B*b+2048>>12;o=d;c=v;l=x*(g-M)+2048>>12;h=x*(g+M)+2048>>12;u=p;f=S;a=4112+(a+i+1>>1);i=a-i;I=o*A+c*R+2048>>12;o=o*R-c*A+2048>>12;c=I;l=l+f+1>>1;f=l-f;h=h+u+1>>1;u=h-u;a=a+c+1>>1;c=a-c;i=i+o+1>>1;o=i-o;I=l*_+h*C+2048>>12;l=l*C-h*_+2048>>12;h=I;I=u*w+f*y+2048>>12;u=u*y-f*w+2048>>12;f=I;m=a+h;M=a-h;g=i+f;v=i-f;d=o+u;S=o-u;p=c+l;b=c-l;m<16?m=0:m>=4080?m=255:m>>=4;g<16?g=0:g>=4080?g=255:g>>=4;d<16?d=0:d>=4080?d=255:d>>=4;p<16?p=0:p>=4080?p=255:p>>=4;b<16?b=0:b>=4080?b=255:b>>=4;S<16?S=0:S>=4080?S=255:S>>=4;v<16?v=0:v>=4080?v=255:v>>=4;M<16?M=0:M>=4080?M=255:M>>=4;s[e+t]=m;s[e+t+8]=g;s[e+t+16]=d;s[e+t+24]=p;s[e+t+32]=b;s[e+t+40]=S;s[e+t+48]=v;s[e+t+56]=M}else{I=B*m+8192>>14;I=I<-2040?0:I>=2024?255:I+2056>>4;s[e+t]=I;s[e+t+8]=I;s[e+t+16]=I;s[e+t+24]=I;s[e+t+32]=I;s[e+t+40]=I;s[e+t+48]=I;s[e+t+56]=I}}}function buildComponentData(t,e){const r=e.blocksPerLine,n=e.blocksPerColumn,s=new Int16Array(64);for(let t=0;t=s)return null;const i=e.getUint16(r);if(i>=65472&&i<=65534)return{invalid:null,marker:i,offset:r};let o=e.getUint16(a);for(;!(o>=65472&&o<=65534);){if(++a>=s)return null;o=e.getUint16(a)}return{invalid:i.toString(16),marker:o,offset:a}}function prepareComponents(t){const e=Math.ceil(t.samplesPerLine/8/t.maxH),r=Math.ceil(t.scanLines/8/t.maxV);for(const n of t.components){const s=Math.ceil(Math.ceil(t.samplesPerLine/8)*n.h/t.maxH),a=Math.ceil(Math.ceil(t.scanLines/8)*n.v/t.maxV),i=e*n.h,o=64*(r*n.v)*(i+1);n.blockData=new Int16Array(o);n.blocksPerLine=s;n.blocksPerColumn=a}t.mcusPerLine=e;t.mcusPerColumn=r}function readDataBlock(t,e,r){const n=e.getUint16(r);let s=(r+=2)+n-2;const a=findNextFileMarker(t,e,s,r);if(a?.invalid){warn("readDataBlock - incorrect length, current marker is: "+a.invalid);s=a.offset}const i=t.subarray(r,s);return{appData:i,oldOffset:r,newOffset:r+i.length}}function skipData(t,e,r){const n=e.getUint16(r),s=(r+=2)+n-2,a=findNextFileMarker(t,e,s,r);return a?.invalid?a.offset:s}class JpegImage{constructor({decodeTransform:t=null,colorTransform:e=-1}={}){this._decodeTransform=t;this._colorTransform=e}static canUseImageDecoder(t,e=-1){const r=new DataView(t.buffer,t.byteOffset,t.byteLength);let n=null,s=0,a=null,i=r.getUint16(s);s+=2;if(65496!==i)throw new JpegError("SOI not found");i=r.getUint16(s);s+=2;t:for(;65497!==i;){switch(i){case 65505:const{appData:e,oldOffset:o,newOffset:c}=readDataBlock(t,r,s);s=c;if(69===e[0]&&120===e[1]&&105===e[2]&&102===e[3]&&0===e[4]&&0===e[5]){if(n)throw new JpegError("Duplicate EXIF-blocks found.");n={exifStart:o+6,exifEnd:c}}i=r.getUint16(s);s+=2;continue;case 65472:case 65473:case 65474:a=t[s+7];break t;case 65535:255!==t[s]&&s--}s=skipData(t,r,s);i=r.getUint16(s);s+=2}return 4===a||3===a&&0===e?null:n||{}}parse(t,{dnlScanLines:e=null}={}){const r=new DataView(t.buffer,t.byteOffset,t.byteLength),n=t.length-1;let s,a,i=0,o=null,c=null,l=0;const u=[],f=[],h=[];let m=r.getUint16(i);i+=2;if(65496!==m)throw new JpegError("SOI not found");m=r.getUint16(i);i+=2;t:for(;65497!==m;){let g,d,p;switch(m){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const{appData:y,newOffset:w}=readDataBlock(t,r,i);i=w;65504===m&&74===y[0]&&70===y[1]&&73===y[2]&&70===y[3]&&0===y[4]&&(o={version:{major:y[5],minor:y[6]},densityUnits:y[7],xDensity:y[8]<<8|y[9],yDensity:y[10]<<8|y[11],thumbWidth:y[12],thumbHeight:y[13],thumbData:y.subarray(14,14+3*y[12]*y[13])});65518===m&&65===y[0]&&100===y[1]&&111===y[2]&&98===y[3]&&101===y[4]&&(c={version:y[5]<<8|y[6],flags0:y[7]<<8|y[8],flags1:y[9]<<8|y[10],transformCode:y[11]});break;case 65499:const C=r.getUint16(i);i+=2;const _=C+i-2;let R;for(;i<_;){const e=t[i++],n=new Uint16Array(64);if(e>>4){if(e>>4!=1)throw new JpegError("DQT - invalid table spec");for(d=0;d<64;d++){R=b[d];n[R]=r.getUint16(i);i+=2}}else for(d=0;d<64;d++){R=b[d];n[R]=t[i++]}u[15&e]=n}break;case 65472:case 65473:case 65474:if(s)throw new JpegError("Only single frame JPEGs supported");i+=2;s={};s.extended=65473===m;s.progressive=65474===m;s.precision=t[i++];const A=r.getUint16(i);i+=2;s.scanLines=e||A;s.samplesPerLine=r.getUint16(i);i+=2;s.components=[];s.componentIds={};const B=t[i++];let x=0,S=0;for(g=0;g>4,n=15&t[i+1];x>4?f:h)[15&e]=buildHuffmanTable(r,s)}break;case 65501:i+=2;a=r.getUint16(i);i+=2;break;case 65498:const M=1===++l&&!e;i+=2;const I=t[i++],k=[];for(g=0;g>4];n.huffmanTableAC=f[15&a];k.push(n)}const D=t[i++],E=t[i++],T=t[i++];try{i+=decodeScan(t,r,i,s,k,a,D,E,T>>4,15&T,M)}catch(e){if(e instanceof DNLMarkerError){warn(`${e.message} -- attempting to re-parse the JPEG image.`);return this.parse(t,{dnlScanLines:e.scanLines})}if(e instanceof EOIMarkerError){warn(`${e.message} -- ignoring the rest of the image data.`);break t}throw e}break;case 65500:i+=4;break;case 65535:255!==t[i]&&i--;break;default:const P=findNextFileMarker(t,r,i-2,i-3);if(P?.invalid){warn("JpegImage.parse - unexpected data, current marker is: "+P.invalid);i=P.offset;break}if(!P||i>=n){warn("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break t}throw new JpegError("JpegImage.parse - unknown marker: "+m.toString(16))}if(i>8)+A[m+1];return w}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(t){let e,r,n;for(let s=0,a=t.length;s4)throw new JpegError("Unsupported color mode");const a=this._getLinearizedBlockData(t,e,s);if(1===this.numComponents&&(r||n)){const t=a.length*(r?4:3),e=new Uint8ClampedArray(t);let n=0;if(r)!function grayToRGBA(t,e){if(FeatureTest.isLittleEndian)for(let r=0,n=t.length;r{throw e},n=import.meta.url;try{new URL(".",n).href}catch{}0;var s,a,i,o,c,l,u,f=console.log.bind(console),h=console.error.bind(console),m=!1,g=!1;function updateMemoryViews(){var t=p.buffer;c=new Int8Array(t);new Int16Array(t);u=new Uint8Array(t);new Uint16Array(t);o=new Int32Array(t);l=new Uint32Array(t);new Float32Array(t);new Float64Array(t);new BigInt64Array(t);new BigUint64Array(t)}class ExitStatus{name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`;this.status=t}}var d,p,callRuntimeCallbacks=t=>{for(;t.length>0;)t.shift()(e)},b=[],addOnPostRun=t=>b.push(t),y=[],addOnPreRun=t=>y.push(t),w=!0,C=0,_={},handleException=t=>{if(t instanceof ExitStatus||"unwind"==t)return s;quit_(0,t)},keepRuntimeAlive=()=>w||C>0,_proc_exit=t=>{s=t;if(!keepRuntimeAlive()){e.onExit?.(t);m=!0}quit_(0,new ExitStatus(t))},_exit=(t,e)=>{s=t;_proc_exit(t)},callUserCallback=t=>{if(!m)try{return t()}catch(t){handleException(t)}finally{(()=>{if(!keepRuntimeAlive())try{_exit(s)}catch(t){handleException(t)}})()}},alignMemory=(t,e)=>Math.ceil(t/e)*e,growMemory=t=>{var e=(t-p.buffer.byteLength+65535)/65536|0;try{p.grow(e);updateMemoryViews();return 1}catch(t){}},R={},getEnvStrings=()=>{if(!getEnvStrings.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:r||"./this.program"};for(var e in R)void 0===R[e]?delete t[e]:t[e]=R[e];var n=[];for(var e in t)n.push(`${e}=${t[e]}`);getEnvStrings.strings=n}return getEnvStrings.strings},stringToUTF8=(t,e,r)=>((t,e,r,n)=>{if(!(n>0))return 0;for(var s=r,a=r+n-1,i=0;i=a)break;e[r++]=o}else if(o<=2047){if(r+1>=a)break;e[r++]=192|o>>6;e[r++]=128|63&o}else if(o<=65535){if(r+2>=a)break;e[r++]=224|o>>12;e[r++]=128|o>>6&63;e[r++]=128|63&o}else{if(r+3>=a)break;e[r++]=240|o>>18;e[r++]=128|o>>12&63;e[r++]=128|o>>6&63;e[r++]=128|63&o;i++}}e[r]=0;return r-s})(t,u,e,r),lengthBytesUTF8=t=>{for(var e=0,r=0;r=55296&&n<=57343){e+=4;++r}else e+=3}return e},A=[null,[],[]],B=globalThis.TextDecoder&&new TextDecoder,UTF8ArrayToString=(t,e=0,r,n)=>{var s=((t,e,r,n)=>{var s=e+r;if(n)return s;for(;t[e]&&!(e>=s);)++e;return e})(t,e,r,n);if(s-e>16&&t.buffer&&B)return B.decode(t.subarray(e,s));for(var a="";e>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|o)}else a+=String.fromCharCode(i)}return a},printChar=(t,e)=>{var r=A[t];if(0===e||10===e){(1===t?f:h)(UTF8ArrayToString(r));r.length=0}else r.push(e)},UTF8ToString=(t,e,r)=>t?UTF8ArrayToString(u,t,e,r):"";e.noExitRuntime&&(w=e.noExitRuntime);e.print&&(f=e.print);e.printErr&&(h=e.printErr);e.wasmBinary&&e.wasmBinary;e.arguments&&e.arguments;e.thisProgram&&(r=e.thisProgram);if(e.preInit){"function"==typeof e.preInit&&(e.preInit=[e.preInit]);for(;e.preInit.length>0;)e.preInit.shift()()}e.writeArrayToMemory=(t,e)=>{c.set(t,e)};var x,S={m:()=>function abort(t){e.onAbort?.(t);h(t=`Aborted(${t})`);m=!0;t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);i?.(r);throw r}(""),l:()=>{w=!1;C=0},i:(t,e)=>{if(_[t]){clearTimeout(_[t].id);delete _[t]}if(!e)return 0;var r=setTimeout(()=>{delete _[t];callUserCallback(()=>d(t,performance.now()))},e);_[t]={id:r,timeout_ms:e};return 0},f:function _copy_pixels_1(t,r){t>>=2;const n=e.imageData=new Uint8ClampedArray(r),s=o.subarray(t,t+r);n.set(s)},e:function _copy_pixels_3(t,r,n,s){t>>=2;r>>=2;n>>=2;const a=e.imageData=new Uint8ClampedArray(3*s),i=o.subarray(t,t+s),c=o.subarray(r,r+s),l=o.subarray(n,n+s);for(let t=0;t>=2;r>>=2;n>>=2;s>>=2;const i=e.imageData=new Uint8ClampedArray(4*a),c=o.subarray(t,t+a),l=o.subarray(r,r+a),u=o.subarray(n,n+a),f=o.subarray(s,s+a);for(let t=0;t{var e=u.length,r=2147483648;if((t>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var s=e*(1+.2/n);s=Math.min(s,t+100663296);var a=Math.min(r,alignMemory(Math.max(t,s),65536));if(growMemory(a))return!0}return!1},o:(t,e)=>{var r=0,n=0;for(var s of getEnvStrings()){var a=e+r;l[t+n>>2]=a;r+=stringToUTF8(s,a,1/0)+1;n+=4}return 0},p:(t,e)=>{var r=getEnvStrings();l[t>>2]=r.length;var n=0;for(var s of r)n+=lengthBytesUTF8(s)+1;l[e>>2]=n;return 0},n:function _fd_seek(t,e,r,n){e=(s=e)<-9007199254740992||s>9007199254740992?NaN:Number(s);var s;return 70},b:(t,e,r,n)=>{for(var s=0,a=0;a>2],o=l[e+4>>2];e+=8;for(var c=0;c>2]=s;return 0},q:function _gray_to_rgba(t,r){t>>=2;const n=e.imageData=new Uint8ClampedArray(4*r),s=o.subarray(t,t+r);for(let t=0;t>=2;r>>=2;const s=e.imageData=new Uint8ClampedArray(4*n),a=o.subarray(t,t+n),i=o.subarray(r,r+n);for(let t=0;t>=2;r>>=2;n>>=2;const a=e.imageData=new Uint8ClampedArray(4*s),i=o.subarray(t,t+s),c=o.subarray(r,r+s),l=o.subarray(n,n+s);for(let t=0;t{e.instantiateWasm(t,(t,e)=>{r(receiveInstance(t))})})}();!function run(){!function preRun(){if(e.preRun){"function"==typeof e.preRun&&(e.preRun=[e.preRun]);for(;e.preRun.length;)addOnPreRun(e.preRun.shift())}callRuntimeCallbacks(y)}();function doRun(){e.calledRun=!0;if(!m){!function initRuntime(){g=!0;x.s()}();a?.(e);e.onRuntimeInitialized?.();!function postRun(){if(e.postRun){"function"==typeof e.postRun&&(e.postRun=[e.postRun]);for(;e.postRun.length;)addOnPostRun(e.postRun.shift())}callRuntimeCallbacks(b)}()}}if(e.setStatus){e.setStatus("Running...");setTimeout(()=>{setTimeout(()=>e.setStatus(""),1);doRun()},1)}else doRun()}();return g?e:new Promise((t,e)=>{a=t;i=e})};class Stream extends BaseStream{constructor(t,e,r,n){super();this.bytes=t instanceof Uint8Array?t:new Uint8Array(t);this.start=e||0;this.pos=this.start;this.end=e+r||this.bytes.length;this.dict=n}get length(){return this.end-this.start}get isEmpty(){return 0===this.length}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(t){const e=this.bytes,r=this.pos,n=this.end;if(!t){this.pos=n;return e.subarray(r,n)}let s=r+t;s>n&&(s=n);this.pos=s;return e.subarray(r,s)}getByteRange(t,e){t<0&&(t=0);e>this.end&&(e=this.end);return this.bytes.subarray(t,e)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(t,e,r=null){return new Stream(this.bytes.buffer,t,e,r)}clone(){return new Stream(this.bytes.buffer,this.start,this.end-this.start,this.dict.clone())}}class JpxError extends n{constructor(t){super(t,"JpxError")}}class JpxImage{static#s=null;static#a=null;static#i=null;static#o=!0;static#c=!0;static#l=null;static setOptions({handler:t,useWasm:e,useWorkerFetch:r,wasmUrl:n}){this.#o=e;this.#c=r;this.#l=n;r||(this.#a=t)}static async#u(t){const e=`${this.#l}openjpeg_nowasm_fallback.js`;let r=null;try{r=(await import( /*webpackIgnore: true*/ /*@vite-ignore*/ e)).default()}catch(t){warn(`JpxImage#getJsModule: ${t}`)}t(r)}static async#f(t,e,r){const n="openjpeg.wasm";try{this.#s||(this.#c?this.#s=await fetchBinaryData(`${this.#l}${n}`):this.#s=await this.#a.sendWithPromise("FetchBinaryData",{kind:"wasmUrl",filename:n}));return r((await WebAssembly.instantiate(this.#s,e)).instance)}catch(e){warn(`JpxImage#instantiateWasm: ${e}`);this.#u(t);return null}finally{this.#a=null}}static async decode(t,{numComponents:e=4,isIndexedColormap:r=!1,smaskInData:n=!1,reducePower:s=0}={}){if(!this.#i){const{promise:t,resolve:e}=Promise.withResolvers(),r=[t];this.#o?r.push(S({warn,instantiateWasm:this.#f.bind(this,e)})):this.#u(e);this.#i=Promise.race(r)}const a=await this.#i;if(!a)throw new JpxError("OpenJPEG failed to initialize");let i;try{const o=t.length;i=a._malloc(o);a.writeArrayToMemory(t,i);if(a._jp2_decode(i,o,e>0?e:0,!!r,!!n,s)){const{errorMessages:t}=a;if(t){delete a.errorMessages;throw new JpxError(t)}throw new JpxError("Unknown error")}const{imageData:c}=a;a.imageData=null;return c}finally{i&&a._free(i)}}static cleanup(){this.#i=null}static parseImageProperties(t){if(!(t instanceof ArrayBuffer||ArrayBuffer.isView(t)))throw new JpxError("Invalid data format, must be a TypedArray.");let e=(t=new Stream(t)).getByte();for(;e>=0;){const r=e;e=t.getByte();if(65361===(r<<8|e)){t.skip(4);const e=t.getInt32()>>>0,r=t.getInt32()>>>0,n=t.getInt32()>>>0,s=t.getInt32()>>>0;t.skip(16);return{width:e-n,height:r-s,bitsPerComponent:8,componentsCount:t.getUint16()}}}throw new JpxError("No size marker found in JPX stream")}}globalThis.pdfjsImageDecoders={getVerbosityLevel,Jbig2Error,Jbig2Image:JBig2CCITTFaxImage,JpegError,JpegImage,JpxError,JpxImage,setVerbosityLevel,VerbosityLevel:e};export{Jbig2Error,JBig2CCITTFaxImage as Jbig2Image,JpegError,JpegImage,JpxError,JpxImage,e as VerbosityLevel,getVerbosityLevel,setVerbosityLevel};