UNPKG

pdfjs-serverless

Version:

PDF.js redistributed as a single bundle for edge and serverless runtimes

2 lines 1.68 MB
var e=Object.defineProperty,__esmMin=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};if(globalThis.DOMMatrix===void 0&&(globalThis.DOMMatrix=class DOMMatrix{}),globalThis.FinalizationRegistry===void 0&&(globalThis.FinalizationRegistry=class FinalizationRegistry{register(){}unregister(){}}),globalThis.navigator??={},globalThis.navigator.platform??=``,globalThis.navigator.userAgent??=``,Promise.withResolvers===void 0&&(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),Promise.try===void 0&&(Promise.try=function(e,...t){return new Promise(n=>n(e(...t)))}),Map.prototype.getOrInsertComputed===void 0&&Object.defineProperty(Map.prototype,"getOrInsertComputed",{value(e,t){if(this.has(e))return this.get(e);let n=t(e);return this.set(e,n),n},writable:!0,configurable:!0}),Uint8Array.prototype.toHex===void 0&&Object.defineProperty(Uint8Array.prototype,"toHex",{value(){let e=``;for(let t=0;t<this.length;t++)e+=this[t].toString(16).padStart(2,`0`);return e},writable:!0,configurable:!0}),typeof ReadableStream<`u`&&ReadableStream.prototype[Symbol.asyncIterator]===void 0){let asyncIterator=function({preventCancel:e=!1}={}){let t=this.getReader(),n=!1,r=Promise.resolve(),next=()=>n?Promise.resolve({value:void 0,done:!0}):t.read().then(e=>(e.done&&(n=!0,t.releaseLock()),e),e=>{throw n=!0,t.releaseLock(),e}),doReturn=r=>{if(n)return Promise.resolve({value:r,done:!0});if(n=!0,e)return t.releaseLock(),Promise.resolve({value:r,done:!0});let i=t.cancel(r);return t.releaseLock(),i.then(()=>({value:r,done:!0}))};return{next(){return r=r.then(next,next)},return(e){return r=r.then(()=>doReturn(e),()=>doReturn(e))},[Symbol.asyncIterator](){return this}}};for(let e of[Symbol.asyncIterator,`values`])Object.defineProperty(ReadableStream.prototype,e,{value:asyncIterator,writable:!0,configurable:!0})}const t=typeof window>`u`,n=[1/0,1/0,-1/0,-1/0],r=new Float32Array(n),i=[.001,0,0,.001,0,0],a=1.35,o=.35,s=o/a,c=`http://www.w3.org/2000/svg`,l={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},u=`pdfjs_internal_editor_`,d={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},f={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},p={TRIANGLES:1,LATTICE:2,PATCH:3},m={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},h={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},g={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},_={GROUP:`Group`,REPLY:`R`},v={PLAY_OR_RESUME:0,STOP:1,PAUSE:2,RESUME:3,PLAY:4},y={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},b={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},x={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},S={E:`Mouse Enter`,X:`Mouse Exit`,D:`Mouse Down`,U:`Mouse Up`,Fo:`Focus`,Bl:`Blur`,PO:`PageOpen`,PC:`PageClose`,PV:`PageVisible`,PI:`PageInvisible`,K:`Keystroke`,F:`Format`,V:`Validate`,C:`Calculate`},C={WC:`WillClose`,WS:`WillSave`,DS:`DidSave`,WP:`WillPrint`,DP:`DidPrint`},w={O:`PageOpen`,C:`PageClose`},T={ERRORS:0,WARNINGS:1,INFOS:5},E={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},D={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},ee={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let O=T.WARNINGS;function setVerbosityLevel$1(e){Number.isInteger(e)&&(O=e)}function getVerbosityLevel$1(){return O}function info$1(e){O>=T.INFOS&&console.info(`Info: ${e}`)}function warn$1(e){O>=T.WARNINGS&&console.warn(`Warning: ${e}`)}function unreachable$1(e){throw Error(e)}function assert$1(e,t){e||unreachable$1(t)}function _isValidProtocol$1(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function createValidAbsoluteUrl$1(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=stringToUTF8String$1(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return _isValidProtocol$1(r)?r:null}function stripPath$1(e){return e.substring(e.lastIndexOf(`/`)+1)}function shadow$1(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}const k=function BaseExceptionClosure(){function BaseException(e,t){this.message=e,this.name=t}return BaseException.prototype=Error(),BaseException.constructor=BaseException,BaseException}();var PasswordException$1=class extends k{constructor(e,t){super(e,`PasswordException`),this.code=t}},UnknownErrorException$1=class extends k{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},InvalidPDFException$1=class extends k{constructor(e){super(e,`InvalidPDFException`)}},ResponseException$1=class extends k{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},FormatError$1=class extends k{constructor(e){super(e,`FormatError`)}},AbortException$1=class extends k{constructor(e){super(e,`AbortException`)}};function bytesToString$1(e){(typeof e!=`object`||e?.length===void 0)&&unreachable$1(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function stringToBytes$1(e){typeof e!=`string`&&unreachable$1(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}function objectSize(e){return Object.keys(e).length}var FeatureTest$1=class{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let t=new Uint32Array(e.buffer,0,1);return shadow$1(this,`isLittleEndian`,t[0]===1)}static get isOffscreenCanvasSupported(){return shadow$1(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return shadow$1(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return shadow$1(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return shadow$1(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return shadow$1(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported&&(e=new OffscreenCanvas(1,1).getContext(`2d`)),shadow$1(this,`isCanvasFilterSupported`,e?.filter!==void 0)}static get isAlphaColorInputSupported(){return shadow$1(this,`isAlphaColorInputSupported`,!1)}static get isBackdropFilterSupported(){return shadow$1(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},Util$1=class{static get hexNums(){return shadow$1(this,`hexNums`,Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static#e(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}static#t(e,t,n,r,i,a,o,s,c,l,u,d){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,n,r,i,a,o,s,-u/l,d);return}let f=l**2-4*u*c;if(f<0)return;let p=Math.sqrt(f),m=2*c;this.#e(e,t,n,r,i,a,o,s,(-l+p)/m,d),this.#e(e,t,n,r,i,a,o,s,(-l-p)/m,d)}static bezierBoundingBox(e,t,n,r,i,a,o,s,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,s),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,s),this.#t(e,n,i,o,t,r,a,s,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),c),this.#t(e,n,i,o,t,r,a,s,3*(-t+3*(r-a)+s),6*(t-2*r+a),3*(r-t),c)}};function stringToUTF8String$1(e){return decodeURIComponent(escape(e))}function utf8StringToString(e){return unescape(encodeURIComponent(e))}function isArrayEqual(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}let te=null,j=null;function normalizeUnicode$1(e){return te||(te=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,j=new Map([[`ſt`,`ſt`]])),e.replaceAll(te,(e,t,n)=>t?t.normalize(`NFKC`):j.get(n))}function _isValidExplicitDest$1(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}const makeArr$1=()=>[],makeMap$1=()=>new Map,makeObj$1=()=>Object.create(null),ne=Symbol(`CIRCULAR_REF`),re=Symbol(`EOF`);let ie=Object.create(null),ae=Object.create(null),oe=Object.create(null);function clearPrimitiveCaches(){ie=Object.create(null),ae=Object.create(null),oe=Object.create(null)}var M=class Name{constructor(e){this.name=e}static get(e){return ae[e]||=new Name(e)}},se=class Cmd{constructor(e){this.cmd=e}static get(e){return ie[e]||=new Cmd(e)}};const ce=function nonSerializableClosure(){return ce};var N=class Dict{__nonSerializable__=ce;#e=new Map;objId=null;suppressEncryption=!1;xref;constructor(e=null){this.xref=e}assignXref(e){this.xref=e}get size(){return this.#e.size}#t(e,t,n,r){let i=this.#e.get(t);return i===void 0&&n!==void 0&&(i=this.#e.get(n),i===void 0&&r!==void 0&&(i=this.#e.get(r))),i instanceof F&&this.xref?e?this.xref.fetchAsync(i,this.suppressEncryption):this.xref.fetch(i,this.suppressEncryption):i}get(e,t,n){return this.#t(!1,e,t,n)}async getAsync(e,t,n){return this.#t(!0,e,t,n)}getArray(e,t,n){let r=this.#t(!1,e,t,n);if(Array.isArray(r)){r=r.slice();for(let e=0,t=r.length;e<t;e++)r[e]instanceof F&&this.xref&&(r[e]=this.xref.fetch(r[e],this.suppressEncryption))}return r}getRaw(e){return this.#e.get(e)}getKeys(){return this.#e.keys()}getRawValues(){return this.#e.values()}getRawEntries(){return this.#e.entries()}set(e,t){this.#e.set(e,t)}setIfNotExists(e,t){this.has(e)||this.set(e,t)}setIfNumber(e,t){typeof t==`number`&&this.set(e,t)}setIfArray(e,t){(Array.isArray(t)||ArrayBuffer.isView(t))&&this.set(e,t)}setIfDefined(e,t){t!=null&&this.set(e,t)}setIfName(e,t){typeof t==`string`?this.set(e,M.get(t)):t instanceof M&&this.set(e,t)}setIfDict(e,t){t instanceof Dict&&this.set(e,t)}has(e){return this.#e.has(e)}*[Symbol.iterator](){for(let[e,t]of this.#e)yield[e,t instanceof F&&this.xref?this.xref.fetch(t,this.suppressEncryption):t]}static get empty(){let e=new Dict(null);return e.set=(e,t)=>{unreachable$1("Should not call `set` on the empty dictionary.")},shadow$1(this,`empty`,e)}static merge({xref:e,dictArray:t,mergeSubDicts:n=!1}){let r=new Dict(e),i=new Map;for(let e of t)if(e instanceof Dict)for(let[t,r]of e.getRawEntries()){let e=i.getOrInsertComputed(t,makeArr$1);e.length&&!(n&&r instanceof Dict)||e.push(r)}for(let[t,n]of i){if(n.length===1||!(n[0]instanceof Dict)){r.set(t,n[0]);continue}let i=new Dict(e);for(let e of n)for(let[t,n]of e.getRawEntries())i.setIfNotExists(t,n);i.size>0&&r.set(t,i)}return i.clear(),r.size>0?r:Dict.empty}clone(){let e=new Dict(this.xref);for(let[t,n]of this.#e)e.set(t,n);return e}delete(e){this.#e.delete(e)}},F=class Ref{constructor(e,t){this.num=e,this.gen=t}toString(){return this.gen===0?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(e){let t=oe[e];if(t)return t;let n=/^(\d+)R(\d*)$/.exec(e);return!n||n[1]===`0`?null:oe[e]=new Ref(parseInt(n[1],10),n[2]?parseInt(n[2],10):0)}static get(e,t){let n=t===0?`${e}R`:`${e}R${t}`;return oe[n]||=new Ref(e,t)}},RefSet=class{constructor(e=null){this._set=new Set(e?._set)}has(e){return this._set.has(e.toString())}put(e){this._set.add(e.toString())}remove(e){this._set.delete(e.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}},RefSetCache=class{_map=new Map;get size(){return this._map.size}get(e){return this._map.get(e.toString())}has(e){return this._map.has(e.toString())}put(e,t){this._map.set(e.toString(),t)}putAlias(e,t){this._map.set(e.toString(),this.get(t))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*values(){yield*this._map.values()}*items(){for(let[e,t]of this._map)yield[F.fromString(e),t]}*keys(){for(let e of this._map.keys())yield F.fromString(e)}};function isName(e,t){return e instanceof M&&(t===void 0||e.name===t)}function isCmd(e,t){return e instanceof se&&(t===void 0||e.cmd===t)}function isDict(e,t){return e instanceof N&&(t===void 0||isName(e.get(`Type`),t))}function isRefsEqual(e,t){return e.num===t.num&&e.gen===t.gen}var BaseStream=class{get length(){unreachable$1("Abstract getter `length` accessed")}get isEmpty(){unreachable$1("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return shadow$1(this,`isDataLoaded`,!0)}getByte(){unreachable$1("Abstract method `getByte` called")}getBytes(e){unreachable$1("Abstract method `getBytes` called")}async getImageData(e,t){return this.getBytes(e,t)}async asyncGetBytes(){unreachable$1("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(){let e=this.getByte();return e!==-1&&this.pos--,e}peekBytes(e){let t=this.getBytes(e);return this.pos-=t.length,t}getUint16(){let e=this.getByte(),t=this.getByte();return e===-1||t===-1?-1:(e<<8)+t}getInt32(){let e=this.getByte(),t=this.getByte(),n=this.getByte(),r=this.getByte();return(e<<24)+(t<<16)+(n<<8)+r}getByteRange(e,t){unreachable$1("Abstract method `getByteRange` called")}getString(e){return bytesToString$1(this.getBytes(e))}skip(e){this.pos+=e||1}reset(){unreachable$1("Abstract method `reset` called")}moveStart(){unreachable$1("Abstract method `moveStart` called")}makeSubStream(e,t,n=null){unreachable$1("Abstract method `makeSubStream` called")}clone(){unreachable$1("Abstract method `clone` called")}getBaseStreams(){return null}getOriginalStream(){return this.stream?.getOriginalStream()||this}};function isAscii(e){return typeof e==`string`&&(!e||/^[\x00-\x7F]*$/.test(e))}function stringToAsciiOrUTF16BE(e){return e==null||isAscii(e)?e:stringToUTF16String(e,!0)}function stringToUTF16HexString(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);t.push(Util$1.hexNums[r>>8&255],Util$1.hexNums[r&255])}return t.join(``)}function stringToUTF16String(e,t=!1){let n=[];t&&n.push(`þÿ`);for(let t=0,r=e.length;t<r;t++){let r=e.charCodeAt(t);n.push(String.fromCharCode(r>>8&255),String.fromCharCode(r&255))}return n.join(``)}const le=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToPDFString(e,t=!1){if(e[0]>=`ï`){let n;if(e[0]===`þ`&&e[1]===`ÿ`?(n=`utf-16be`,e.length%2==1&&(e=e.slice(0,-1))):e[0]===`ÿ`&&e[1]===`þ`?(n=`utf-16le`,e.length%2==1&&(e=e.slice(0,-1))):e[0]===`ï`&&e[1]===`»`&&e[2]===`¿`&&(n=`utf-8`),n)try{let r=new TextDecoder(n,{fatal:!0}),i=stringToBytes$1(e),a=r.decode(i);return t||!a.includes(`\x1B`)?a:a.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,``)}catch(e){warn$1(`stringToPDFString: "${e}".`)}}let n=[];for(let r=0,i=e.length;r<i;r++){let a=e.charCodeAt(r);if(!t&&a===27){for(;++r<i&&e.charCodeAt(r)!==27;);continue}let o=le[a];n.push(o?String.fromCharCode(o):e.charAt(r))}return n.join(``)}const ue=/^[1-9]\.\d$/,de=2**31-1,fe=[1,0,0,1,0,0],pe=[`ColorSpace`,`ExtGState`,`Font`,`Pattern`,`Properties`,`Shading`,`XObject`],me=[`ExtGState`,`Font`,`Properties`,`XObject`];function getLookupTableFactory(e){let t;return function(){return e&&=(t=Object.create(null),e(t),null),t}}var MissingDataException=class extends k{constructor(e,t){super(`Missing data [${e}, ${t})`,`MissingDataException`),this.begin=e,this.end=t}},ParserEOFException=class extends k{constructor(e){super(e,`ParserEOFException`)}},XRefEntryException=class extends k{constructor(e){super(e,`XRefEntryException`)}},XRefParseException=class extends k{constructor(e){super(e,`XRefParseException`)}};function arrayBuffersToBytes(e){let t=e.length;if(t===0)return new Uint8Array;if(t===1)return new Uint8Array(e[0]);let n=0;for(let r=0;r<t;r++)n+=e[r].byteLength;let r=new Uint8Array(n),i=0;for(let n=0;n<t;n++){let t=new Uint8Array(e[n]);r.set(t,i),i+=t.byteLength}return r}async function fetchBinaryData(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch file "${e}" with "${t.statusText}".`);return t.bytes()}function getInheritableProperty({dict:e,key:t,getArray:n=!1,stopWhenFound:r=!0}){let i,a=new RefSet;for(;e instanceof N&&!(e.objId&&a.has(e.objId));){e.objId&&a.put(e.objId);let o=n?e.getArray(t):e.get(t);if(o!==void 0){if(r)return o;(i||=[]).push(o)}e=e.get(`Parent`)}return i}function getParentToUpdate(e,t,n){let r=new RefSet,i=e,a={dict:null,ref:null};for(;e instanceof N&&!r.has(t)&&(r.put(t),!e.has(`T`));){if(t=e.getRaw(`Parent`),!(t instanceof F))return a;e=n.fetch(t)}return e instanceof N&&e!==i&&(a.dict=e,a.ref=t),a}function deepCompare(e,t){if(e===t)return!0;if(e instanceof F&&t instanceof F)return isRefsEqual(e,t);if(e instanceof M&&t instanceof M)return e.name===t.name;if(e instanceof N&&t instanceof N){if(e.size!==t.size)return!1;for(let[n,r]of e.getRawEntries()){let e=t.getRaw(n);if(e===void 0||!deepCompare(r,e))return!1}return!0}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(!deepCompare(e[n],t[n]))return!1;return!0}return!1}const he=`.C.CC.CCC.CD.D.DC.DCC.DCCC.CM..X.XX.XXX.XL.L.LX.LXX.LXXX.XC..I.II.III.IV.V.VI.VII.VIII.IX`.split(`.`);function toRomanNumerals(e,t=!1){assert$1(Number.isInteger(e)&&e>0,`The number should be a positive integer.`);let n=`M`.repeat(e/1e3|0)+he[e%1e3/100|0]+he[10+(e%100/10|0)]+he[20+e%10];return t?n.toLowerCase():n}function isWhiteSpace(e){return e===32||e===9||e===13||e===10}function isBooleanArray(e,t){return Array.isArray(e)&&(t===null||e.length===t)&&e.every(e=>typeof e==`boolean`)}function isNumberArray(e,t){return Array.isArray(e)?(t===null||e.length===t)&&e.every(e=>typeof e==`number`):ArrayBuffer.isView(e)&&!(e instanceof BigInt64Array||e instanceof BigUint64Array)&&(t===null||e.length===t)}function lookupMatrix(e,t){return isNumberArray(e,6)?e:t}function lookupRect(e,t){return isNumberArray(e,4)?e:t}function lookupNormalRect(e,t){return isNumberArray(e,4)?Util$1.normalizeRect(e):t}function parseXFAPath(e){let t=/(.+)\[(\d+)\]$/;return e.split(`.`).map(e=>{let n=e.match(t);return n?{name:n[1],pos:parseInt(n[2],10)}:{name:e,pos:0}})}function escapePDFName(e){let t=[],n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);(i<33||i>126||i===35||i===40||i===41||i===60||i===62||i===91||i===93||i===123||i===125||i===47||i===37)&&(n<r&&t.push(e.substring(n,r)),t.push(`#${i.toString(16)}`),n=r+1)}return t.length===0?e:(n<e.length&&t.push(e.substring(n)),t.join(``))}function escapeString(e){return e.replaceAll(/([()\\\n\r])/g,e=>e===` `?`\\n`:e===`\r`?`\\r`:`\\${e}`)}function _collectJS(e,t,n,r){if(!e)return;let i=null;if(e instanceof F){if(r.has(e))return;i=e,r.put(i),e=t.fetch(e)}if(Array.isArray(e))for(let i of e)_collectJS(i,t,n,r);else if(e instanceof N){if(isName(e.get(`S`),`JavaScript`)){let t=e.get(`JS`),r;t instanceof BaseStream?r=t.getString():typeof t==`string`&&(r=t),r&&=stringToPDFString(r,!0).replaceAll(`\0`,``),r&&n.push(r.trim())}_collectJS(e.getRaw(`Next`),t,n,r)}i&&r.remove(i)}function collectActions(e,t,n){let r=Object.create(null),i=getInheritableProperty({dict:t,key:`AA`,stopWhenFound:!1});if(i)for(let t=i.length-1;t>=0;t--){let a=i[t];if(a instanceof N)for(let[t,i]of a.getRawEntries()){let a=n[t];if(!a)continue;let o=new RefSet,s=[];_collectJS(i,e,s,o),s.length>0&&(r[a]=s)}}if(t.has(`A`)){let n=t.get(`A`),i=new RefSet,a=[];_collectJS(n,e,a,i),a.length>0&&(r.Action=a)}return objectSize(r)>0?r:null}const ge={60:`&lt;`,62:`&gt;`,38:`&amp;`,34:`&quot;`,39:`&apos;`};function*codePointIter(e){for(let t=0,n=e.length;t<n;t++){let n=e.codePointAt(t);n>55295&&(n<57344||n>65533)&&t++,yield n}}function encodeToXmlString(e){let t=[],n=0;for(let r=0,i=e.length;r<i;r++){let i=e.codePointAt(r);if(32<=i&&i<=126){let a=ge[i];a&&(n<r&&t.push(e.substring(n,r)),t.push(a),n=r+1)}else n<r&&t.push(e.substring(n,r)),t.push(`&#x${i.toString(16).toUpperCase()};`),i>55295&&(i<57344||i>65533)&&r++,n=r+1}return t.length===0?e:(n<e.length&&t.push(e.substring(n)),t.join(``))}function validateFontName(e,t=!1){let n=/^("|').*("|')$/.exec(e);if(n&&n[1]===n[2]){if(RegExp(`[^\\\\]${n[1]}`).test(e.slice(1,-1)))return t&&warn$1(`FontFamily contains unescaped ${n[1]}: ${e}.`),!1}else for(let n of e.split(/[ \t]+/))if(/^(?:\d|-[\d-])/.test(n)||!/^[\w\\-]+$/.test(n))return t&&warn$1(`FontFamily contains invalid <custom-ident>: ${e}.`),!1;return!0}function validateCSSFont(e){let t=new Set([`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`,`1000`,`normal`,`bold`,`bolder`,`lighter`]),{fontFamily:n,fontWeight:r,italicAngle:i}=e;if(!validateFontName(n,!0))return!1;let a=r?r.toString():``;e.fontWeight=t.has(a)?a:`400`;let o=parseFloat(i);return e.italicAngle=isNaN(o)||o<-90||o>90?`14`:i.toString(),!0}function recoverJsURL(e){let t=RegExp(`^\\s*(`+[`app.launchURL`,`window.open`,`xfa.host.gotoURL`].join(`|`).replaceAll(`.`,`\\.`)+`)\\((?:'|")([^'"]*)(?:'|")(?:,\\s*(\\w+)\\)|\\))`,`i`).exec(e);return t?.[2]?{url:t[2],newWindow:t[1]===`app.launchURL`&&t[3]===`true`}:null}function numberToString(e){if(Number.isInteger(e))return e.toString();let t=Math.round(e*100);return t%100==0?(t/100).toString():t%10==0?e.toFixed(1):e.toFixed(2)}function getNewAnnotationsMap(e){if(!e)return null;let t=new Map;for(let[n,r]of e)n.startsWith(u)&&t.getOrInsertComputed(r.pageIndex,makeArr$1).push(r);return t.size>0?t:null}function getModificationDate(e=new Date){return e instanceof Date||(e=new Date(e)),[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,`0`),e.getUTCDate().toString().padStart(2,`0`),e.getUTCHours().toString().padStart(2,`0`),e.getUTCMinutes().toString().padStart(2,`0`),e.getUTCSeconds().toString().padStart(2,`0`)].join(``)}function getRotationMatrix(e,t,n){switch(e){case 90:return[0,1,-1,0,t,0];case 180:return[-1,0,0,-1,t,n];case 270:return[0,-1,1,0,0,n];default:throw Error(`Invalid rotation`)}}function getSizeInBytes(e){return Math.ceil(Math.ceil(Math.log2(1+e))/8)}var QCMS=class{static#e=null;static _memory=null;static _mustAddAlpha=!1;static _destBuffer=null;static _destOffset=0;static _destLength=0;static _cssColor=``;static _makeHexColor=null;static get _memoryArray(){let e=this.#e;return e?.byteLength?e:this.#e=new Uint8Array(this._memory.buffer)}};function copy_result(e,t){let{_mustAddAlpha:n,_destBuffer:r,_destOffset:i,_destLength:a,_memoryArray:o}=QCMS;if(t===a){r.set(o.subarray(e,e+t),i);return}if(n)for(let n=e,a=e+t,s=i;n<a;n+=3,s+=4)r[s]=o[n],r[s+1]=o[n+1],r[s+2]=o[n+2],r[s+3]=255;else for(let n=e,a=e+t,s=i;n<a;n+=3,s+=4)r[s]=o[n],r[s+1]=o[n+1],r[s+2]=o[n+2]}function copy_rgb(e){let{_destBuffer:t,_destOffset:n,_memoryArray:r}=QCMS;t[n]=r[e],t[n+1]=r[e+1],t[n+2]=r[e+2]}function make_cssRGB(e){let{_memoryArray:t}=QCMS;QCMS._cssColor=QCMS._makeHexColor(t[e],t[e+1],t[e+2])}const _e=Object.freeze({RGB8:0,0:`RGB8`,RGBA8:1,1:`RGBA8`,BGRA8:2,2:`BGRA8`,Gray8:3,3:`Gray8`,GrayA8:4,4:`GrayA8`,CMYK:5,5:`CMYK`}),ve=Object.freeze({Perceptual:0,0:`Perceptual`,RelativeColorimetric:1,1:`RelativeColorimetric`,Saturation:2,2:`Saturation`,AbsoluteColorimetric:3,3:`AbsoluteColorimetric`});function qcms_convert_array(e,t){let n=passArray8ToWasm0(t,Ce.__wbindgen_malloc),r=Se;Ce.qcms_convert_array(e,n,r)}function qcms_convert_four(e,t,n,r,i,a){Ce.qcms_convert_four(e,t,n,r,i,a)}function qcms_convert_one(e,t,n){Ce.qcms_convert_one(e,t,n)}function qcms_convert_three(e,t,n,r,i){Ce.qcms_convert_three(e,t,n,r,i)}function qcms_drop_transformer(e){Ce.qcms_drop_transformer(e)}function qcms_transformer_from_memory(e,t,n){let r=passArray8ToWasm0(e,Ce.__wbindgen_malloc),i=Se;return Ce.qcms_transformer_from_memory(r,i,t,n)>>>0}function __wbg_get_imports(){return{__proto__:null,"./qcms_bg.js":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(getStringFromWasm0(e,t))},__wbg_copy_result_0d15f3bf9d9012ae:function(e,t){copy_result(e>>>0,t>>>0)},__wbg_copy_rgb_0106d9d9464fce43:function(e){copy_rgb(e>>>0)},__wbg_make_cssRGB_8e24b34f71f5363e:function(e){make_cssRGB(e>>>0)},__wbindgen_init_externref_table:function(){let e=Ce.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function getStringFromWasm0(e,t){return e>>>=0,decodeText(e,t)}let ye=null;function getUint8ArrayMemory0(){return(ye===null||ye.byteLength===0)&&(ye=new Uint8Array(Ce.memory.buffer)),ye}function passArray8ToWasm0(e,t){let n=t(e.length*1,1)>>>0;return getUint8ArrayMemory0().set(e,n/1),Se=e.length,n}let be=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});be.decode();let xe=0;function decodeText(e,t){return xe+=t,xe>=2146435072&&(be=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),be.decode(),xe=t),be.decode(getUint8ArrayMemory0().subarray(e,e+t))}let Se=0,Ce;function __wbg_finalize_init(e,t){return Ce=e.exports,ye=null,Ce.__wbindgen_start(),Ce}function initSync(e){if(Ce!==void 0)return Ce;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=__wbg_get_imports();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),__wbg_finalize_init(new WebAssembly.Instance(e,t),e)}function MathClamp$1(e,t,n){return Math.min(Math.max(e,t),n)}function resizeRgbImage(e,t,n,r,i,a,o){o=o===1?o:0;let s=n/i,c=r/a,l=0,u,d=new Uint16Array(i),f=n*3;for(let e=0;e<i;e++)d[e]=Math.floor(e*s)*3;for(let n=0;n<a;n++){let r=Math.floor(n*c)*f;for(let n=0;n<i;n++)u=r+d[n],t[l++]=e[u++],t[l++]=e[u++],t[l++]=e[u++],l+=o}}function resizeRgbaImage(e,t,n,r,i,a,o){let s=n/i,c=r/a,l=0,u=new Uint16Array(i);if(o===1){for(let e=0;e<i;e++)u[e]=Math.floor(e*s);let r=new Uint32Array(e.buffer),o=new Uint32Array(t.buffer),d=FeatureTest$1.isLittleEndian?16777215:4294967040;for(let e=0;e<a;e++){let t=r.subarray(Math.floor(e*c)*n);for(let e=0;e<i;e++)o[l++]|=t[u[e]]&d}}else{let r=n*4;for(let e=0;e<i;e++)u[e]=Math.floor(e*s)*4;for(let n=0;n<a;n++){let a=e.subarray(Math.floor(n*c)*r);for(let e=0;e<i;e++){let n=u[e];t[l++]=a[n],t[l++]=a[n+1],t[l++]=a[n+2]}}}}function copyRgbaImage(e,t,n){if(n===1){let n=new Uint32Array(e.buffer),r=new Uint32Array(t.buffer),i=FeatureTest$1.isLittleEndian?16777215:4294967040;for(let e=0,t=n.length;e<t;e++)r[e]|=n[e]&i}else{let n=0;for(let r=0,i=e.length;r<i;r+=4)t[n++]=e[r],t[n++]=e[r+1],t[n++]=e[r+2]}}function isDefaultDecodeHelper(e,t){if(!Array.isArray(e))return!0;let n=e.length;return n<t?(warn$1(`Decode map length is too short.`),!0):(n>t&&(info$1(`Truncating too long decode map.`),e.length=t),!1)}var we=class ColorSpace{static#e=new Uint8ClampedArray(3);constructor(e,t){this.name=e,this.numComps=t}getRgb(e,t,n=new Uint8ClampedArray(3)){return this.getRgbItem(e,t,n,0),n}getRgbHex(e,t){let n=this.getRgb(e,t,ColorSpace.#e);return Util$1.makeHexColor(n[0],n[1],n[2])}getRgbItem(e,t,n,r){unreachable$1(`Should not call ColorSpace.getRgbItem`)}getRgbBuffer(e,t,n,r,i,a,o){unreachable$1(`Should not call ColorSpace.getRgbBuffer`)}getOutputLength(e,t){unreachable$1(`Should not call ColorSpace.getOutputLength`)}isPassthrough(e){return!1}isDefaultDecode(e,t){return ColorSpace.isDefaultDecode(e,this.numComps)}fillRgb(e,t,n,r,i,a,o,s,c){let l=t*n,u=null,d=1<<o,f=n!==i||t!==r;if(this.isPassthrough(o))u=s;else if(this.numComps===1&&l>d&&this.name!==`DeviceGray`&&this.name!==`DeviceRGB`){let t=o<=8?new Uint8Array(d):new Uint16Array(d);for(let e=0;e<d;e++)t[e]=e;let n=new Uint8ClampedArray(d*3);if(this.getRgbBuffer(t,0,d,n,0,o,0),f){u=new Uint8Array(l*3);let e=0;for(let t=0;t<l;++t){let r=s[t]*3;u[e++]=n[r],u[e++]=n[r+1],u[e++]=n[r+2]}}else{let t=0;for(let r=0;r<l;++r){let i=s[r]*3;e[t++]=n[i],e[t++]=n[i+1],e[t++]=n[i+2],t+=c}}}else f?(u=new Uint8ClampedArray(l*3),this.getRgbBuffer(s,0,l,u,0,o,0)):this.getRgbBuffer(s,0,r*a,e,0,o,c);if(u)if(f)resizeRgbImage(u,e,t,n,r,i,c);else{let t=0,n=0;for(let i=0,o=r*a;i<o;i++)e[t++]=u[n++],e[t++]=u[n++],e[t++]=u[n++],t+=c}}get usesZeroToOneRange(){return shadow$1(this,`usesZeroToOneRange`,!0)}static isDefaultDecode(e,t){if(isDefaultDecodeHelper(e,t*2))return!0;for(let t=0,n=e.length;t<n;t+=2)if(e[t]!==0||e[t+1]!==1)return!1;return!0}},AlternateCS=class extends we{constructor(e,t,n){super(`Alternate`,e),this.base=t,this.tintFn=n,this.tmpBuf=new Float32Array(t.numComps)}getRgbItem(e,t,n,r){let i=this.tmpBuf;this.tintFn(e,t,i,0),this.base.getRgbItem(i,0,n,r)}getRgbBuffer(e,t,n,r,i,a,o){let s=this.tintFn,c=this.base,l=1/((1<<a)-1),u=c.numComps,d=c.usesZeroToOneRange,f=(c.isPassthrough(8)||!d)&&o===0,p=f?i:0,m=f?r:new Uint8ClampedArray(u*n),h=this.numComps,g=new Float32Array(h),_=new Float32Array(u),v,y;for(v=0;v<n;v++){for(y=0;y<h;y++)g[y]=e[t++]*l;if(s(g,0,_,0),d)for(y=0;y<u;y++)m[p++]=_[y]*255;else c.getRgbItem(_,0,m,p),p+=u}f||c.getRgbBuffer(m,0,n,r,i,8,o)}getOutputLength(e,t){return this.base.getOutputLength(e*this.base.numComps/this.numComps,t)}},PatternCS=class extends we{constructor(e){super(`Pattern`,null),this.base=e}isDefaultDecode(e,t){unreachable$1(`Should not call PatternCS.isDefaultDecode`)}},IndexedCS=class extends we{constructor(e,t,n){super(`Indexed`,1),this.base=e,this.highVal=t;let r=e.numComps*(t+1);if(this.lookup=new Uint8Array(r),n instanceof BaseStream){let e=n.getBytes(r);this.lookup.set(e)}else if(typeof n==`string`)for(let e=0;e<r;++e)this.lookup[e]=n.charCodeAt(e)&255;else throw new FormatError$1(`IndexedCS - unrecognized lookup table: ${n}`)}getRgbItem(e,t,n,r){let{base:i,highVal:a,lookup:o}=this,s=MathClamp$1(Math.round(e[t]),0,a)*i.numComps;i.getRgbBuffer(o,s,1,n,r,8,0)}getRgbBuffer(e,t,n,r,i,a,o){let{base:s,highVal:c,lookup:l}=this,{numComps:u}=s,d=s.getOutputLength(u,o);for(let a=0;a<n;++a){let n=MathClamp$1(Math.round(e[t++]),0,c)*u;s.getRgbBuffer(l,n,1,r,i,8,o),i+=d}}getOutputLength(e,t){return this.base.getOutputLength(e*this.base.numComps,t)}isDefaultDecode(e,t){return isDefaultDecodeHelper(e,2)?!0:!Number.isInteger(t)||t<1?(warn$1(`Bits per component is not correct`),!0):e[0]===0&&e[1]===(1<<t)-1}},DeviceGrayCS=class extends we{constructor(){super(`DeviceGray`,1)}getRgbItem(e,t,n,r){let i=e[t]*255;n[r]=n[r+1]=n[r+2]=i}getRgbBuffer(e,t,n,r,i,a,o){let s=255/((1<<a)-1),c=t,l=i;for(let t=0;t<n;++t){let t=s*e[c++];r[l++]=t,r[l++]=t,r[l++]=t,l+=o}}getOutputLength(e,t){return e*(3+t)}},DeviceRgbCS=class extends we{constructor(){super(`DeviceRGB`,3)}getRgbItem(e,t,n,r){n[r]=e[t]*255,n[r+1]=e[t+1]*255,n[r+2]=e[t+2]*255}getRgbBuffer(e,t,n,r,i,a,o){if(a===8&&o===0){r.set(e.subarray(t,t+n*3),i);return}let s=255/((1<<a)-1),c=t,l=i;for(let t=0;t<n;++t)r[l++]=s*e[c++],r[l++]=s*e[c++],r[l++]=s*e[c++],l+=o}getOutputLength(e,t){return e*(3+t)/3|0}isPassthrough(e){return e===8}},DeviceRgbaCS=class extends we{constructor(){super(`DeviceRGBA`,4)}getOutputLength(e,t){return e*4}isPassthrough(e){return e===8}fillRgb(e,t,n,r,i,a,o,s,c){n!==i||t!==r?resizeRgbaImage(s,e,t,n,r,i,c):copyRgbaImage(s,e,c)}},DeviceCmykCS=class extends we{constructor(){super(`DeviceCMYK`,4)}#e(e,t,n,r,i){let a=e[t]*n,o=e[t+1]*n,s=e[t+2]*n,c=e[t+3]*n;r[i]=255+a*(-4.387332384609988*a+54.48615194189176*o+18.82290502165302*s+212.25662451639585*c+-285.2331026137004)+o*(1.7149763477362134*o-5.6096736904047315*s+-17.873870861415444*c-5.497006427196366)+s*(-2.5217340131683033*s-21.248923337353073*c+17.5119270841813)+c*(-21.86122147463605*c-189.48180835922747),r[i+1]=255+a*(8.841041422036149*a+60.118027045597366*o+6.871425592049007*s+31.159100130055922*c+-79.2970844816548)+o*(-15.310361306967817*o+17.575251261109482*s+131.35250912493976*c-190.9453302588951)+s*(4.444339102852739*s+9.8632861493405*c-24.86741582555878)+c*(-20.737325471181034*c-187.80453709719578),r[i+2]=255+a*(.8842522430003296*a+8.078677503112928*o+30.89978309703729*s-.23883238689178934*c+-14.183576799673286)+o*(10.49593273432072*o+63.02378494754052*s+50.606957656360734*c-112.23884253719248)+s*(.03296041114873217*s+115.60384449646641*c+-193.58209356861505)+c*(-22.33816807309886*c-180.12613974708367)}getRgbItem(e,t,n,r){this.#e(e,t,1,n,r)}getRgbBuffer(e,t,n,r,i,a,o){let s=1/((1<<a)-1);for(let a=0;a<n;a++)this.#e(e,t,s,r,i),t+=4,i+=3+o}getOutputLength(e,t){return e/4*(3+t)|0}},CalGrayCS=class extends we{constructor(e,t,n){if(super(`CalGray`,1),!e)throw new FormatError$1(`WhitePoint missing - required for color space CalGray`);if([this.XW,this.YW,this.ZW]=e,[this.XB,this.YB,this.ZB]=t||[0,0,0],this.G=n||1,this.XW<0||this.ZW<0||this.YW!==1)throw new FormatError$1(`Invalid WhitePoint components for ${this.name}, no fallback available`);(this.XB<0||this.YB<0||this.ZB<0)&&(info$1(`Invalid BlackPoint for ${this.name}, falling back to default.`),this.XB=this.YB=this.ZB=0),(this.XB!==0||this.YB!==0||this.ZB!==0)&&warn$1(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ZB: ${this.ZB}, only default values are supported.`),this.G<1&&(info$1(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`),this.G=1)}#e(e,t,n,r,i){let a=(e[t]*i)**this.G,o=this.YW*a,s=Math.max(295.8*o**.3333333333333333-40.8,0);n[r]=s,n[r+1]=s,n[r+2]=s}getRgbItem(e,t,n,r){this.#e(e,t,n,r,1)}getRgbBuffer(e,t,n,r,i,a,o){let s=1/((1<<a)-1);for(let a=0;a<n;++a)this.#e(e,t,r,i,s),t+=1,i+=3+o}getOutputLength(e,t){return e*(3+t)}},Te=class CalRGBCS extends we{static#e=new Float32Array([.8951,.2664,-.1614,-.7502,1.7135,.0367,.0389,-.0685,1.0296]);static#t=new Float32Array([.9869929,-.1470543,.1599627,.4323053,.5183603,.0492912,-.0085287,.0400428,.9684867]);static#n=new Float32Array([3.2404542,-1.5371385,-.4985314,-.969266,1.8760108,.041556,.0556434,-.2040259,1.0572252]);static#r=new Float32Array([1,1,1]);static#i=new Float32Array(3);static#a=new Float32Array(3);static#o=new Float32Array(3);static#s=(24/116)**3/8;constructor(e,t,n,r){if(super(`CalRGB`,3),!e)throw new FormatError$1(`WhitePoint missing - required for color space CalRGB`);let[i,a,o]=this.whitePoint=e,[s,c,l]=this.blackPoint=t||new Float32Array(3);if([this.GR,this.GG,this.GB]=n||new Float32Array([1,1,1]),[this.MXA,this.MYA,this.MZA,this.MXB,this.MYB,this.MZB,this.MXC,this.MYC,this.MZC]=r||new Float32Array([1,0,0,0,1,0,0,0,1]),i<0||o<0||a!==1)throw new FormatError$1(`Invalid WhitePoint components for ${this.name}, no fallback available`);(s<0||c<0||l<0)&&(info$1(`Invalid BlackPoint for ${this.name} [${s}, ${c}, ${l}], falling back to default.`),this.blackPoint=new Float32Array(3)),(this.GR<0||this.GG<0||this.GB<0)&&(info$1(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ${this.name}, falling back to default.`),this.GR=this.GG=this.GB=1)}#c(e,t,n){n[0]=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],n[1]=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],n[2]=e[6]*t[0]+e[7]*t[1]+e[8]*t[2]}#l(e,t,n){n[0]=t[0]*1/e[0],n[1]=t[1]*1/e[1],n[2]=t[2]*1/e[2]}#u(e,t,n){n[0]=t[0]*.95047/e[0],n[1]=t[1]*1/e[1],n[2]=t[2]*1.08883/e[2]}#d(e){return e<=.0031308?MathClamp$1(12.92*e,0,1):e>=.99554525?1:MathClamp$1(1.055*e**(1/2.4)-.055,0,1)}#f(e){return e<0?-this.#f(-e):e>8?((e+16)/116)**3:e*CalRGBCS.#s}#p(e,t,n){if(e[0]===0&&e[1]===0&&e[2]===0){n[0]=t[0],n[1]=t[1],n[2]=t[2];return}let r=this.#f(0),i=r,a=this.#f(e[0]),o=r,s=this.#f(e[1]),c=r,l=this.#f(e[2]),u=(1-i)/(1-a),d=1-u,f=(1-o)/(1-s),p=1-f,m=(1-c)/(1-l),h=1-m;n[0]=t[0]*u+d,n[1]=t[1]*f+p,n[2]=t[2]*m+h}#m(e,t,n){if(e[0]===1&&e[2]===1){n[0]=t[0],n[1]=t[1],n[2]=t[2];return}let r=n;this.#c(CalRGBCS.#e,t,r);let i=CalRGBCS.#i;this.#l(e,r,i),this.#c(CalRGBCS.#t,i,n)}#h(e,t,n){let r=n;this.#c(CalRGBCS.#e,t,r);let i=CalRGBCS.#i;this.#u(e,r,i),this.#c(CalRGBCS.#t,i,n)}#g(e,t,n,r,i){let a=MathClamp$1(e[t]*i,0,1),o=MathClamp$1(e[t+1]*i,0,1),s=MathClamp$1(e[t+2]*i,0,1),c=a===1?1:a**this.GR,l=o===1?1:o**this.GG,u=s===1?1:s**this.GB,d=this.MXA*c+this.MXB*l+this.MXC*u,f=this.MYA*c+this.MYB*l+this.MYC*u,p=this.MZA*c+this.MZB*l+this.MZC*u,m=CalRGBCS.#a;m[0]=d,m[1]=f,m[2]=p;let h=CalRGBCS.#o;this.#m(this.whitePoint,m,h);let g=CalRGBCS.#a;this.#p(this.blackPoint,h,g);let _=CalRGBCS.#o;this.#h(CalRGBCS.#r,g,_);let v=CalRGBCS.#a;this.#c(CalRGBCS.#n,_,v),n[r]=this.#d(v[0])*255,n[r+1]=this.#d(v[1])*255,n[r+2]=this.#d(v[2])*255}getRgbItem(e,t,n,r){this.#g(e,t,n,r,1)}getRgbBuffer(e,t,n,r,i,a,o){let s=1/((1<<a)-1);for(let a=0;a<n;++a)this.#g(e,t,r,i,s),t+=3,i+=3+o}getOutputLength(e,t){return e*(3+t)/3|0}},LabCS=class extends we{constructor(e,t,n){if(super(`Lab`,3),!e)throw new FormatError$1(`WhitePoint missing - required for color space Lab`);if([this.XW,this.YW,this.ZW]=e,[this.amin,this.amax,this.bmin,this.bmax]=n||[-100,100,-100,100],[this.XB,this.YB,this.ZB]=t||[0,0,0],this.XW<0||this.ZW<0||this.YW!==1)throw new FormatError$1(`Invalid WhitePoint components, no fallback available`);(this.XB<0||this.YB<0||this.ZB<0)&&(info$1(`Invalid BlackPoint, falling back to default`),this.XB=this.YB=this.ZB=0),(this.amin>this.amax||this.bmin>this.bmax)&&(info$1(`Invalid Range, falling back to defaults`),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}#e(e){return e>=6/29?e**3:108/841*(e-4/29)}#t(e,t,n,r){return n+e*(r-n)/t}#n(e,t,n,r,i){let a=e[t],o=e[t+1],s=e[t+2];n!==!1&&(a=this.#t(a,n,0,100),o=this.#t(o,n,this.amin,this.amax),s=this.#t(s,n,this.bmin,this.bmax)),o>this.amax?o=this.amax:o<this.amin&&(o=this.amin),s>this.bmax?s=this.bmax:s<this.bmin&&(s=this.bmin);let c=(a+16)/116,l=c+o/500,u=c-s/200,d=this.XW*this.#e(l),f=this.YW*this.#e(c),p=this.ZW*this.#e(u),m,h,g;this.ZW<1?(m=d*3.1339+f*-1.617+p*-.4906,h=d*-.9785+f*1.916+p*.0333,g=d*.072+f*-.229+p*1.4057):(m=d*3.2406+f*-1.5372+p*-.4986,h=d*-.9689+f*1.8758+p*.0415,g=d*.0557+f*-.204+p*1.057),r[i]=Math.sqrt(m)*255,r[i+1]=Math.sqrt(h)*255,r[i+2]=Math.sqrt(g)*255}getRgbItem(e,t,n,r){this.#n(e,t,!1,n,r)}getRgbBuffer(e,t,n,r,i,a,o){let s=(1<<a)-1;for(let a=0;a<n;a++)this.#n(e,t,s,r,i),t+=3,i+=3+o}getOutputLength(e,t){return e*(3+t)/3|0}isDefaultDecode(e,t){return!0}get usesZeroToOneRange(){return shadow$1(this,`usesZeroToOneRange`,!1)}};function fetchSync(e){let t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),t.response}var Ee=class IccColorSpace extends we{#e;#t;static#n=!0;static#r=null;static#i=null;constructor(e,t,n){if(!IccColorSpace.isUsable)throw Error(`No ICC color space support`);super(t,n);let r;switch(n){case 1:r=_e.Gray8,this.#t=(e,t,n)=>qcms_convert_one(this.#e,e[t]*255,n);break;case 3:r=_e.RGB8,this.#t=(e,t,n)=>qcms_convert_three(this.#e,e[t]*255,e[t+1]*255,e[t+2]*255,n);break;case 4:r=_e.CMYK,this.#t=(e,t,n)=>qcms_convert_four(this.#e,e[t]*255,e[t+1]*255,e[t+2]*255,e[t+3]*255,n);break;default:throw Error(`Unsupported number of components: ${n}`)}if(this.#e=qcms_transformer_from_memory(e,r,ve.Perceptual),!this.#e)throw Error(`Failed to create ICC color space`);IccColorSpace.#i||=new FinalizationRegistry(e=>{qcms_drop_transformer(e)}),IccColorSpace.#i.register(this,this.#e)}getRgbHex(e,t){return this.#t(e,t,!0),QCMS._cssColor}getRgbItem(e,t,n,r){QCMS._destBuffer=n,QCMS._destOffset=r,QCMS._destLength=3,this.#t(e,t,!1),QCMS._destBuffer=null}getRgbBuffer(e,t,n,r,i,a,o){if(e=e.subarray(t,t+n*this.numComps),a!==8){let t=255/((1<<a)-1);for(let n=0,r=e.length;n<r;n++)e[n]*=t}QCMS._mustAddAlpha=o&&r.buffer===e.buffer,QCMS._destBuffer=r,QCMS._destOffset=i,QCMS._destLength=n*(3+o),qcms_convert_array(this.#e,e),QCMS._mustAddAlpha=!1,QCMS._destBuffer=null}getOutputLength(e,t){return e/this.numComps*(3+t)|0}static setOptions({useWasm:e,useWorkerFetch:t,wasmUrl:n}){if(!t){this.#n=!1;return}this.#n=e,this.#r=n}static get isUsable(){let e=!1;if(this.#n)if(this.#r)try{this._module=initSync({module:fetchSync(`${this.#r}qcms_bg.wasm`)}),e=!!this._module,QCMS._memory=this._module.memory,QCMS._makeHexColor=Util$1.makeHexColor.bind(Util$1)}catch(e){warn$1(`ICCBased color space: "${e}".`)}else warn$1("No ICC color space support due to missing `wasmUrl` API option");return shadow$1(this,`isUsable`,e)}},De=class CmykICCBasedCS extends Ee{static#e;constructor(){let e=new Uint8Array(fetchSync(`${CmykICCBasedCS.#e}CGATS001Compat-v2-micro.icc`));super(e,`DeviceCMYK`,4)}static setOptions({iccUrl:e}){this.#e=e}static get isUsable(){let e=!1;return Ee.isUsable&&(this.#e?e=!0:warn$1("No CMYK ICC profile support due to missing `iccUrl` API option")),shadow$1(this,`isUsable`,e)}},Oe=class Stream extends BaseStream{constructor(e,t,n,r){super(),this.bytes=e instanceof Uint8Array?e:new Uint8Array(e),this.start=t||0,this.pos=this.start,this.end=t+n||this.bytes.length,this.dict=r}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(e){let t=this.pos,n=e?Math.min(t+e,this.end):this.end;return this.pos=n,this.bytes.subarray(t,n)}getByteRange(e,t){return e<0&&(e=0),t>this.end&&(t=this.end),this.bytes.subarray(e,t)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(e,t,n=null){return new Stream(this.bytes.buffer,e,t,n)}clone(){return new Stream(this.bytes.buffer,this.start,this.length,this.dict?.clone())}},StringStream=class extends Oe{constructor(e,t=null){super(stringToBytes$1(e),NaN,NaN,t)}},NullStream=class extends Oe{constructor(){super(new Uint8Array)}},ChunkedStream=class extends Oe{progressiveDataLength=0;_lastSuccessfulEnsureByteChunk=-1;_loadedChunks=new Set;constructor(e,t,n){super(new Uint8Array(e),0,e,null),this.chunkSize=t,this.numChunks=Math.ceil(e/t),this.manager=n}getMissingChunks(){let e=[];for(let t=0,n=this.numChunks;t<n;++t)this._loadedChunks.has(t)||e.push(t);return e}get numChunksLoaded(){return this._loadedChunks.size}get isDataLoaded(){return this.numChunksLoaded===this.numChunks}onReceiveData(e,t){let n=this.chunkSize;if(e%n!==0)throw Error(`Bad begin offset: ${e}`);let r=e+t.byteLength;if(r%n!==0&&r!==this.bytes.length)throw Error(`Bad end offset: ${r}`);this.bytes.set(new Uint8Array(t),e);let i=Math.floor(e/n),a=Math.floor((r-1)/n)+1;for(let e=i;e<a;++e)this._loadedChunks.add(e)}onReceiveProgressiveData(e){let t=this.progressiveDataLength,n=Math.floor(t/this.chunkSize);this.bytes.set(new Uint8Array(e),t),t+=e.byteLength,this.progressiveDataLength=t;let r=t>=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(let e=n;e<r;++e)this._loadedChunks.add(e)}ensureByte(e){if(e<this.progressiveDataLength)return;let t=Math.floor(e/this.chunkSize);if(!(t>this.numChunks)&&t!==this._lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(t))throw new MissingDataException(e,e+1);this._lastSuccessfulEnsureByteChunk=t}}ensureRange(e,t){if(e>=t||t<=this.progressiveDataLength)return;let n=Math.floor(e/this.chunkSize);if(n>this.numChunks)return;let r=Math.min(Math.floor((t-1)/this.chunkSize)+1,this.numChunks);for(let i=n;i<r;++i)if(!this._loadedChunks.has(i))throw new MissingDataException(e,t)}nextEmptyChunk(e){let t=this.numChunks;for(let n=0;n<t;++n){let r=(e+n)%t;if(!this._loadedChunks.has(r))return r}return null}hasChunk(e){return this._loadedChunks.has(e)}getByte(){let e=this.pos;return e>=this.end?-1:(e>=this.progressiveDataLength&&this.ensureByte(e),this.bytes[this.pos++])}getBytes(e){let t=this.pos,n=e?Math.min(t+e,this.end):this.end;return n>this.progressiveDataLength&&this.ensureRange(t,n),this.pos=n,this.bytes.subarray(t,n)}getByteRange(e,t){return e<0&&(e=0),t>this.end&&(t=this.end),t>this.progressiveDataLength&&this.ensureRange(e,t),this.bytes.subarray(e,t)}makeSubStream(e,t,n=null){t?e+t>this.progressiveDataLength&&this.ensureRange(e,e+t):e>=this.progressiveDataLength&&this.ensureByte(e);function ChunkedStreamSubstream(){}ChunkedStreamSubstream.prototype=Object.create(this),ChunkedStreamSubstream.prototype.getMissingChunks=function(){let e=this.chunkSize,t=Math.floor(this.start/e),n=Math.floor((this.end-1)/e)+1,r=[];for(let e=t;e<n;++e)this._loadedChunks.has(e)||r.push(e);return r},Object.defineProperty(ChunkedStreamSubstream.prototype,"isDataLoaded",{get(){return this.numChunksLoaded===this.numChunks||this.getMissingChunks().length===0},configurable:!0});let r=new ChunkedStreamSubstream;return r.pos=r.start=e,r.end=e+t||this.end,r.dict=n,r}getBaseStreams(){return[this]}},ChunkedStreamManager=class{#e=!1;currRequestId=0;_chunksNeededByRequest=new Map;#t=Promise.withResolvers();_promisesByRequest=new Map;_requestsByChunk=new Map;constructor(e,t){this.length=t.length,this.chunkSize=t.rangeChunkSize,this.stream=new ChunkedStream(this.length,this.chunkSize,this),this.pdfStream=e,this.disableAutoFetch=t.disableAutoFetch,this.msgHandler=t.msgHandler}async sendRequest(e,t){let n=this.pdfStream.getRangeReader(e,t),r=[];for(;;){let{value:e,done:t}=await n.read();if(this.#e){r=null;return}if(t)break;r.push(e)}if(r.length===0&&this.disableAutoFetch)return;let i=arrayBuffersToBytes(r);r=null,this.onReceiveData({chunk:i.buffer,begin:e})}requestAllChunks(e=!1){if(!e){let