pdfjs-dist
Version:
Generic build of Mozilla's PDF.js library.
22 lines • 133 kB
JavaScript
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2022 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
*/
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/image_decoders/pdf.image_decoders",[],t):"object"==typeof exports?exports["pdfjs-dist/image_decoders/pdf.image_decoders"]=t():e["pdfjs-dist/image_decoders/pdf.image_decoders"]=e.pdfjsImageDecoders=t()}(globalThis,(()=>(()=>{var e=[,(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.StreamType=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;t.arrayByteLength=arrayByteLength;t.arraysToBytes=function arraysToBytes(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let n=0;for(let r=0;r<t;r++)n+=arrayByteLength(e[r]);let r=0;const i=new Uint8Array(n);for(let n=0;n<t;n++){let t=e[n];t instanceof Uint8Array||(t="string"==typeof t?stringToBytes(t):new Uint8Array(t));const o=t.byteLength;i.set(t,r);r+=o}return i};t.assert=function assert(e,t){e||unreachable(t)};t.bytesToString=function bytesToString(e){"object"==typeof e&&null!==e&&void 0!==e.length||unreachable("Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const r=[];for(let i=0;i<t;i+=n){const o=Math.min(i+n,t),s=e.subarray(i,o);r.push(String.fromCharCode.apply(null,s))}return r.join("")};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(n,r){e.resolve=function(e){t=!0;n(e)};e.reject=function(e){t=!0;r(e)}}));return e};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;try{if(n&&"string"==typeof e){if(n.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(n.tryConvertEncoding)try{e=stringToUTF8String(e)}catch(e){}}const r=t?new URL(e,t):new URL(e);if(_isValidProtocol(r))return r}catch(e){}return null};t.escapeString=function escapeString(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};t.getModificationDate=function getModificationDate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;const t=[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")];return t.join("")};t.getVerbosityLevel=function getVerbosityLevel(){return i};t.info=function info(e){i>=r.INFOS&&console.log(`Info: ${e}`)};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=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};t.isAscii=function isAscii(e){return/^[\x00-\x7F]*$/.test(e)};t.objectFromMap=function objectFromMap(e){const t=Object.create(null);for(const[n,r]of e)t[n]=r;return t};t.objectSize=function objectSize(e){return Object.keys(e).length};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(i=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){if(e[0]>="ï"){let t;"þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8");if(t)try{const n=new TextDecoder(t,{fatal:!0}),r=stringToBytes(e);return n.decode(r)}catch(e){warn(`stringToPDFString: "${e}".`)}}const t=[];for(let n=0,r=e.length;n<r;n++){const r=a[e.charCodeAt(n)];t.push(r?String.fromCharCode(r):e.charAt(n))}return t.join("")};t.stringToUTF16BEString=function stringToUTF16BEString(e){const t=["þÿ"];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);t.push(String.fromCharCode(r>>8&255),String.fromCharCode(255&r))}return t.join("")};t.stringToUTF8String=stringToUTF8String;t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;n(2);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.LINE_FACTOR=1.35;t.LINE_DESCENT_FACTOR=.35;t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};t.AnnotationEditorPrefix="pdfjs_internal_editor_";t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};t.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};t.TextRenderingMode={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};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.AnnotationType={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};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.AnnotationFieldFlag={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};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={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"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const r={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=r;t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};t.OPS={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,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let i=r.WARNINGS;function warn(e){i>=r.WARNINGS&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function shadow(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1});return n}const o=function BaseExceptionClosure(){function BaseException(e,t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=o;t.PasswordException=class PasswordException extends o{constructor(e,t){super(e,"PasswordException");this.code=t}};t.UnknownErrorException=class UnknownErrorException extends o{constructor(e,t){super(e,"UnknownErrorException");this.details=t}};t.InvalidPDFException=class InvalidPDFException extends o{constructor(e){super(e,"InvalidPDFException")}};t.MissingPDFException=class MissingPDFException extends o{constructor(e){super(e,"MissingPDFException")}};t.UnexpectedResponseException=class UnexpectedResponseException extends o{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}};t.FormatError=class FormatError extends o{constructor(e){super(e,"FormatError")}};t.AbortException=class AbortException extends o{constructor(e){super(e,"AbortException")}};function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=255&e.charCodeAt(r);return n}function arrayByteLength(e){if(void 0!==e.length)return e.length;if(void 0!==e.byteLength)return e.byteLength;unreachable("Invalid argument for arrayByteLength")}t.FeatureTest=class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}};const s=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,n){return`#${s[e]}${s[t]}${s[n]}`}static scaleMinMax(e,t){let n;if(e[0]){if(e[0]<0){n=t[0];t[0]=t[1];t[1]=n}t[0]*=e[0];t[1]*=e[0];if(e[3]<0){n=t[2];t[2]=t[3];t[3]=n}t[2]*=e[3];t[3]*=e[3]}else{n=t[0];t[0]=t[2];t[2]=n;n=t[1];t[1]=t[3];t[3]=n;if(e[1]<0){n=t[2];t[2]=t[3];t[3]=n}t[2]*=e[1];t[3]*=e[1];if(e[2]<0){n=t[0];t[0]=t[1];t[1]=n}t[0]*=e[2];t[1]*=e[2]}t[0]+=e[4];t[1]+=e[4];t[2]+=e[5];t[3]+=e[5]}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 applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){const n=Util.applyTransform(e,t),r=Util.applyTransform(e.slice(2,4),t),i=Util.applyTransform([e[0],e[3]],t),o=Util.applyTransform([e[2],e[1]],t);return[Math.min(n[0],r[0],i[0],o[0]),Math.min(n[1],r[1],i[1],o[1]),Math.max(n[0],r[0],i[0],o[0]),Math.max(n[1],r[1],i[1],o[1])]}static inverseTransform(e){const 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 apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],o=e[2]*t[1]+e[3]*t[3],s=(n+o)/2,a=Math.sqrt((n+o)**2-4*(n*o-i*r))/2,c=s+a||1,l=s-a||1;return[Math.sqrt(c),Math.sqrt(l)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const 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;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>o?null:[n,i,r,o]}static bezierBoundingBox(e,t,n,r,i,o,s,a){const c=[],l=[[],[]];let f,u,h,d,p,g,m,b;for(let l=0;l<2;++l){if(0===l){u=6*e-12*n+6*i;f=-3*e+9*n-9*i+3*s;h=3*n-3*e}else{u=6*t-12*r+6*o;f=-3*t+9*r-9*o+3*a;h=3*r-3*t}if(Math.abs(f)<1e-12){if(Math.abs(u)<1e-12)continue;d=-h/u;0<d&&d<1&&c.push(d)}else{m=u*u-4*h*f;b=Math.sqrt(m);if(!(m<0)){p=(-u+b)/(2*f);0<p&&p<1&&c.push(p);g=(-u-b)/(2*f);0<g&&g<1&&c.push(g)}}}let y,x=c.length;const w=x;for(;x--;){d=c[x];y=1-d;l[0][x]=y*y*y*e+3*y*y*d*n+3*y*d*d*i+d*d*d*s;l[1][x]=y*y*y*t+3*y*y*d*r+3*y*d*d*o+d*d*d*a}l[0][w]=e;l[1][w]=t;l[0][w+1]=s;l[1][w+1]=a;l[0].length=l[1].length=w+2;return[Math.min(...l[0]),Math.min(...l[1]),Math.max(...l[0]),Math.max(...l[1])]}}t.Util=Util;const a=[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 stringToUTF8String(e){return decodeURIComponent(escape(e))}},(e,t,n)=>{"use strict";var r=n(3);if(!globalThis._pdfjsCompatibilityChecked){globalThis._pdfjsCompatibilityChecked=!0;!function checkNodeBtoa(){!globalThis.btoa&&r.isNodeJS&&(globalThis.btoa=function(e){return Buffer.from(e,"binary").toString("base64")})}();!function checkNodeAtob(){!globalThis.atob&&r.isNodeJS&&(globalThis.atob=function(e){return Buffer.from(e,"base64").toString("binary")})}();!function checkDOMMatrix(){!globalThis.DOMMatrix&&r.isNodeJS&&(globalThis.DOMMatrix=require("dommatrix/dist/dommatrix.js"))}();!function checkReadableStream(){!globalThis.ReadableStream&&r.isNodeJS&&(globalThis.ReadableStream=require("web-streams-polyfill/dist/ponyfill.js").ReadableStream)}();!function checkArrayAt(){Array.prototype.at||n(4)}();!function checkTypedArrayAt(){Uint8Array.prototype.at||n(76)}()}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.isNodeJS=void 0;const n=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=n},(e,t,n)=>{n(5);var r=n(75);e.exports=r("Array","at")},(e,t,n)=>{"use strict";var r=n(6),i=n(41),o=n(65),s=n(63),a=n(70);r({target:"Array",proto:!0},{at:function at(e){var t=i(this),n=o(t),r=s(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}});a("at")},(e,t,n)=>{var r=n(7),i=n(8).f,o=n(45),s=n(49),a=n(39),c=n(57),l=n(69);e.exports=function(e,t){var n,f,u,h,d,p=e.target,g=e.global,m=e.stat;if(n=g?r:m?r[p]||a(p,{}):(r[p]||{}).prototype)for(f in t){h=t[f];u=e.dontCallGetSet?(d=i(n,f))&&d.value:n[f];if(!l(g?f:p+(m?".":"#")+f,e.forced)&&void 0!==u){if(typeof h==typeof u)continue;c(h,u)}(e.sham||u&&u.sham)&&o(h,"sham",!0);s(n,f,h,e)}}},e=>{var check=function(e){return e&&e.Math==Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||Function("return this")()},(e,t,n)=>{var r=n(9),i=n(11),o=n(13),s=n(14),a=n(15),c=n(20),l=n(40),f=n(43),u=Object.getOwnPropertyDescriptor;t.f=r?u:function getOwnPropertyDescriptor(e,t){e=a(e);t=c(t);if(f)try{return u(e,t)}catch(e){}if(l(e,t))return s(!i(o.f,e,t),e[t])}},(e,t,n)=>{var r=n(10);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},(e,t,n)=>{var r=n(12),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},(e,t,n)=>{var r=n(10);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function propertyIsEnumerable(e){var t=r(this,e);return!!t&&t.enumerable}:n},e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},(e,t,n)=>{var r=n(16),i=n(19);e.exports=function(e){return r(i(e))}},(e,t,n)=>{var r=n(17),i=n(10),o=n(18),s=Object,a=r("".split);e.exports=i((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"==o(e)?a(e,""):s(e)}:s},(e,t,n)=>{var r=n(12),i=Function.prototype,o=i.bind,s=i.call,a=r&&o.bind(s,s);e.exports=r?function(e){return e&&a(e)}:function(e){return e&&function(){return s.apply(e,arguments)}}},(e,t,n)=>{var r=n(17),i=r({}.toString),o=r("".slice);e.exports=function(e){return o(i(e),8,-1)}},e=>{var t=TypeError;e.exports=function(e){if(null==e)throw t("Can't call method on "+e);return e}},(e,t,n)=>{var r=n(21),i=n(24);e.exports=function(e){var t=r(e,"string");return i(t)?t:t+""}},(e,t,n)=>{var r=n(11),i=n(22),o=n(24),s=n(31),a=n(34),c=n(35),l=TypeError,f=c("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var n,c=s(e,f);if(c){void 0===t&&(t="default");n=r(c,e,t);if(!i(n)||o(n))return n;throw l("Can't convert object to primitive value")}void 0===t&&(t="number");return a(e,t)}},(e,t,n)=>{var r=n(23);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},e=>{e.exports=function(e){return"function"==typeof e}},(e,t,n)=>{var r=n(25),i=n(23),o=n(26),s=n(27),a=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&o(t.prototype,a(e))}},(e,t,n)=>{var r=n(7),i=n(23),aFunction=function(e){return i(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?aFunction(r[e]):r[e]&&r[e][t]}},(e,t,n)=>{var r=n(17);e.exports=r({}.isPrototypeOf)},(e,t,n)=>{var r=n(28);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(e,t,n)=>{var r=n(29),i=n(10);e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},(e,t,n)=>{var r,i,o=n(7),s=n(30),a=o.process,c=o.Deno,l=a&&a.versions||c&&c.version,f=l&&l.v8;f&&(i=(r=f.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1]));!i&&s&&(!(r=s.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/))&&(i=+r[1]);e.exports=i},(e,t,n)=>{var r=n(25);e.exports=r("navigator","userAgent")||""},(e,t,n)=>{var r=n(32);e.exports=function(e,t){var n=e[t];return null==n?void 0:r(n)}},(e,t,n)=>{var r=n(23),i=n(33),o=TypeError;e.exports=function(e){if(r(e))return e;throw o(i(e)+" is not a function")}},e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},(e,t,n)=>{var r=n(11),i=n(23),o=n(22),s=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&i(n=e.toString)&&!o(a=r(n,e)))return a;if(i(n=e.valueOf)&&!o(a=r(n,e)))return a;if("string"!==t&&i(n=e.toString)&&!o(a=r(n,e)))return a;throw s("Can't convert object to primitive value")}},(e,t,n)=>{var r=n(7),i=n(36),o=n(40),s=n(42),a=n(28),c=n(27),l=i("wks"),f=r.Symbol,u=f&&f.for,h=c?f:f&&f.withoutSetter||s;e.exports=function(e){if(!o(l,e)||!a&&"string"!=typeof l[e]){var t="Symbol."+e;a&&o(f,e)?l[e]=f[e]:l[e]=c&&u?u(t):h(t)}return l[e]}},(e,t,n)=>{var r=n(37),i=n(38);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.24.1",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},e=>{e.exports=!1},(e,t,n)=>{var r=n(7),i=n(39),o="__core-js_shared__",s=r[o]||i(o,{});e.exports=s},(e,t,n)=>{var r=n(7),i=Object.defineProperty;e.exports=function(e,t){try{i(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},(e,t,n)=>{var r=n(17),i=n(41),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function hasOwn(e,t){return o(i(e),t)}},(e,t,n)=>{var r=n(19),i=Object;e.exports=function(e){return i(r(e))}},(e,t,n)=>{var r=n(17),i=0,o=Math.random(),s=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++i+o,36)}},(e,t,n)=>{var r=n(9),i=n(10),o=n(44);e.exports=!r&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},(e,t,n)=>{var r=n(7),i=n(22),o=r.document,s=i(o)&&i(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},(e,t,n)=>{var r=n(9),i=n(46),o=n(14);e.exports=r?function(e,t,n){return i.f(e,t,o(1,n))}:function(e,t,n){e[t]=n;return e}},(e,t,n)=>{var r=n(9),i=n(43),o=n(47),s=n(48),a=n(20),c=TypeError,l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,u="enumerable",h="configurable",d="writable";t.f=r?o?function defineProperty(e,t,n){s(e);t=a(t);s(n);if("function"==typeof e&&"prototype"===t&&"value"in n&&d in n&&!n.writable){var r=f(e,t);if(r&&r.writable){e[t]=n.value;n={configurable:h in n?n.configurable:r.configurable,enumerable:u in n?n.enumerable:r.enumerable,writable:!1}}}return l(e,t,n)}:l:function defineProperty(e,t,n){s(e);t=a(t);s(n);if(i)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw c("Accessors not supported");"value"in n&&(e[t]=n.value);return e}},(e,t,n)=>{var r=n(9),i=n(10);e.exports=r&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},(e,t,n)=>{var r=n(22),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw o(i(e)+" is not an object")}},(e,t,n)=>{var r=n(23),i=n(46),o=n(50),s=n(39);e.exports=function(e,t,n,a){a||(a={});var c=a.enumerable,l=void 0!==a.name?a.name:t;r(n)&&o(n,l,a);if(a.global)c?e[t]=n:s(t,n);else{try{a.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:i.f(e,t,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return e}},(e,t,n)=>{var r=n(10),i=n(23),o=n(40),s=n(9),a=n(51).CONFIGURABLE,c=n(52),l=n(53),f=l.enforce,u=l.get,h=Object.defineProperty,d=s&&!r((function(){return 8!==h((function(){}),"length",{value:8}).length})),p=String(String).split("String"),g=e.exports=function(e,t,n){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]");n&&n.getter&&(t="get "+t);n&&n.setter&&(t="set "+t);(!o(e,"name")||a&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t);d&&n&&o(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&o(n,"constructor")&&n.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=f(e);o(r,"source")||(r.source=p.join("string"==typeof t?t:""));return e};Function.prototype.toString=g((function toString(){return i(this)&&u(this).source||c(this)}),"toString")},(e,t,n)=>{var r=n(9),i=n(40),o=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,a=i(o,"name"),c=a&&"something"===function something(){}.name,l=a&&(!r||r&&s(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},(e,t,n)=>{var r=n(17),i=n(23),o=n(38),s=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return s(e)});e.exports=o.inspectSource},(e,t,n)=>{var r,i,o,s=n(54),a=n(7),c=n(17),l=n(22),f=n(45),u=n(40),h=n(38),d=n(55),p=n(56),g="Object already initialized",m=a.TypeError,b=a.WeakMap;if(s||h.state){var y=h.state||(h.state=new b),x=c(y.get),w=c(y.has),T=c(y.set);r=function(e,t){if(w(y,e))throw new m(g);t.facade=e;T(y,e,t);return t};i=function(e){return x(y,e)||{}};o=function(e){return w(y,e)}}else{var S=d("state");p[S]=!0;r=function(e,t){if(u(e,S))throw new m(g);t.facade=e;f(e,S,t);return t};i=function(e){return u(e,S)?e[S]:{}};o=function(e){return u(e,S)}}e.exports={set:r,get:i,has:o,enforce:function(e){return o(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=i(t)).type!==e)throw m("Incompatible receiver, "+e+" required");return n}}}},(e,t,n)=>{var r=n(7),i=n(23),o=n(52),s=r.WeakMap;e.exports=i(s)&&/native code/.test(o(s))},(e,t,n)=>{var r=n(36),i=n(42),o=r("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},e=>{e.exports={}},(e,t,n)=>{var r=n(40),i=n(58),o=n(8),s=n(46);e.exports=function(e,t,n){for(var a=i(t),c=s.f,l=o.f,f=0;f<a.length;f++){var u=a[f];r(e,u)||n&&r(n,u)||c(e,u,l(t,u))}}},(e,t,n)=>{var r=n(25),i=n(17),o=n(59),s=n(68),a=n(48),c=i([].concat);e.exports=r("Reflect","ownKeys")||function ownKeys(e){var t=o.f(a(e)),n=s.f;return n?c(t,n(e)):t}},(e,t,n)=>{var r=n(60),i=n(67).concat("length","prototype");t.f=Object.getOwnPropertyNames||function getOwnPropertyNames(e){return r(e,i)}},(e,t,n)=>{var r=n(17),i=n(40),o=n(15),s=n(61).indexOf,a=n(56),c=r([].push);e.exports=function(e,t){var n,r=o(e),l=0,f=[];for(n in r)!i(a,n)&&i(r,n)&&c(f,n);for(;t.length>l;)i(r,n=t[l++])&&(~s(f,n)||c(f,n));return f}},(e,t,n)=>{var r=n(15),i=n(62),o=n(65),createMethod=function(e){return function(t,n,s){var a,c=r(t),l=o(c),f=i(s,l);if(e&&n!=n){for(;l>f;)if((a=c[f++])!=a)return!0}else for(;l>f;f++)if((e||f in c)&&c[f]===n)return e||f||0;return!e&&-1}};e.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},(e,t,n)=>{var r=n(63),i=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):o(n,t)}},(e,t,n)=>{var r=n(64);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},e=>{var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function trunc(e){var r=+e;return(r>0?n:t)(r)}},(e,t,n)=>{var r=n(66);e.exports=function(e){return r(e.length)}},(e,t,n)=>{var r=n(63),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(e,t)=>{t.f=Object.getOwnPropertySymbols},(e,t,n)=>{var r=n(10),i=n(23),o=/#|\.prototype\./,isForced=function(e,t){var n=a[s(e)];return n==l||n!=c&&(i(t)?r(t):!!t)},s=isForced.normalize=function(e){return String(e).replace(o,".").toLowerCase()},a=isForced.data={},c=isForced.NATIVE="N",l=isForced.POLYFILL="P";e.exports=isForced},(e,t,n)=>{var r=n(35),i=n(71),o=n(46).f,s=r("unscopables"),a=Array.prototype;null==a[s]&&o(a,s,{configurable:!0,value:i(null)});e.exports=function(e){a[s][e]=!0}},(e,t,n)=>{var r,i=n(48),o=n(72),s=n(67),a=n(56),c=n(74),l=n(44),f=n(55),u=f("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"<script>"+e+"</"+"script>"},NullProtoObjectViaActiveX=function(e){e.write(scriptTag(""));e.close();var t=e.parentWindow.Object;e=null;return t},NullProtoObject=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&r?NullProtoObjectViaActiveX(r):function(){var e,t=l("iframe");t.style.display="none";c.appendChild(t);t.src=String("javascript:");(e=t.contentWindow.document).open();e.write(scriptTag("document.F=Object"));e.close();return e.F}():NullProtoObjectViaActiveX(r);for(var e=s.length;e--;)delete NullProtoObject.prototype[s[e]];return NullProtoObject()};a[u]=!0;e.exports=Object.create||function create(e,t){var n;if(null!==e){EmptyConstructor.prototype=i(e);n=new EmptyConstructor;EmptyConstructor.prototype=null;n[u]=e}else n=NullProtoObject();return void 0===t?n:o.f(n,t)}},(e,t,n)=>{var r=n(9),i=n(47),o=n(46),s=n(48),a=n(15),c=n(73);t.f=r&&!i?Object.defineProperties:function defineProperties(e,t){s(e);for(var n,r=a(t),i=c(t),l=i.length,f=0;l>f;)o.f(e,n=i[f++],r[n]);return e}},(e,t,n)=>{var r=n(60),i=n(67);e.exports=Object.keys||function keys(e){return r(e,i)}},(e,t,n)=>{var r=n(25);e.exports=r("document","documentElement")},(e,t,n)=>{var r=n(7),i=n(17);e.exports=function(e,t){return i(r[e].prototype[t])}},(e,t,n)=>{n(77)},(e,t,n)=>{"use strict";var r=n(78),i=n(65),o=n(63),s=r.aTypedArray;(0,r.exportTypedArrayMethod)("at",(function at(e){var t=s(this),n=i(t),r=o(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}))},(e,t,n)=>{"use strict";var r,i,o,s=n(79),a=n(9),c=n(7),l=n(23),f=n(22),u=n(40),h=n(80),d=n(33),p=n(45),g=n(49),m=n(46).f,b=n(26),y=n(82),x=n(84),w=n(35),T=n(42),S=n(53),C=S.enforce,P=S.get,v=c.Int8Array,E=v&&v.prototype,I=c.Uint8ClampedArray,A=I&&I.prototype,k=v&&y(v),O=E&&y(E),_=Object.prototype,B=c.TypeError,D=w("toStringTag"),M=T("TYPED_ARRAY_TAG"),R="TypedArrayConstructor",L=s&&!!x&&"Opera"!==h(c.opera),U=!1,N={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},j={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(e){var t=y(e);if(f(t)){var n=P(t);return n&&u(n,R)?n.TypedArrayConstructor:getTypedArrayConstructor(t)}},isTypedArray=function(e){if(!f(e))return!1;var t=h(e);return u(N,t)||u(j,t)};for(r in N)(o=(i=c[r])&&i.prototype)?C(o).TypedArrayConstructor=i:L=!1;for(r in j)(o=(i=c[r])&&i.prototype)&&(C(o).TypedArrayConstructor=i);if(!L||!l(k)||k===Function.prototype){k=function TypedArray(){throw B("Incorrect invocation")};if(L)for(r in N)c[r]&&x(c[r],k)}if(!L||!O||O===_){O=k.prototype;if(L)for(r in N)c[r]&&x(c[r].prototype,O)}L&&y(A)!==O&&x(A,O);if(a&&!u(O,D)){U=!0;m(O,D,{get:function(){return f(this)?this[M]:void 0}});for(r in N)c[r]&&p(c[r],M,r)}e.exports={NATIVE_ARRAY_BUFFER_VIEWS:L,TYPED_ARRAY_TAG:U&&M,aTypedArray:function(e){if(isTypedArray(e))return e;throw B("Target is not a typed array")},aTypedArrayConstructor:function(e){if(l(e)&&(!x||b(k,e)))return e;throw B(d(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(a){if(n)for(var i in N){var o=c[i];if(o&&u(o.prototype,e))try{delete o.prototype[e]}catch(n){try{o.prototype[e]=t}catch(e){}}}O[e]&&!n||g(O,e,n?t:L&&E[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(a){if(x){if(n)for(r in N)if((i=c[r])&&u(i,e))try{delete i[e]}catch(e){}if(k[e]&&!n)return;try{return g(k,e,n?t:L&&k[e]||t)}catch(e){}}for(r in N)!(i=c[r])||i[e]&&!n||g(i,e,t)}},getTypedArrayConstructor:getTypedArrayConstructor,isView:function isView(e){if(!f(e))return!1;var t=h(e);return"DataView"===t||u(N,t)||u(j,t)},isTypedArray:isTypedArray,TypedArray:k,TypedArrayPrototype:O}},e=>{e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},(e,t,n)=>{var r=n(81),i=n(23),o=n(18),s=n(35)("toStringTag"),a=Object,c="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=a(e),s))?n:c?o(t):"Object"==(r=o(t))&&i(t.callee)?"Arguments":r}},(e,t,n)=>{var r={};r[n(35)("toStringTag")]="z";e.exports="[object z]"===String(r)},(e,t,n)=>{var r=n(40),i=n(23),o=n(41),s=n(55),a=n(83),c=s("IE_PROTO"),l=Object,f=l.prototype;e.exports=a?l.getPrototypeOf:function(e){var t=o(e);if(r(t,c))return t[c];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof l?f:null}},(e,t,n)=>{var r=n(10);e.exports=!r((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},(e,t,n)=>{var r=n(17),i=n(48),o=n(85);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]);t=n instanceof Array}catch(e){}return function setPrototypeOf(n,r){i(n);o(r);t?e(n,r):n.__proto__=r;return n}}():void 0)},(e,t,n)=>{var r=n(23),i=String,o=TypeError;e.exports=function(e){if("object"==typeof e||r(e))return e;throw o("Can't set "+i(e)+" as a prototype")}},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Jbig2Image=void 0;var r=n(1),i=n(87),o=n(90),s=n(91);class Jbig2Error extends r.BaseException{constructor(e){super(`JBIG2 error: ${e}`,"Jbig2Error")}}class ContextCache{getContexts(e){return e in this?this[e]:this[e]=new Int8Array(65536)}}class DecodingContext{constructor(e,t,n){this.data=e;this.start=t;this.end=n}get decoder(){const e=new o.ArithmeticDecoder(this.data,this.start,this.end);return(0,r.shadow)(this,"decoder",e)}get contextCache(){const e=new ContextCache;return(0,r.shadow)(this,"contextCache",e)}}function decodeInteger(e,t,n){const r=e.getContexts(t);let i=1;function readBits(e){let t=0;for(let o=0;o<e;o++){const e=n.readBit(r,i);i=i<256?i<<1|e:511&(i<<1|e)|256;t=t<<1|e}return t>>>0}const o=readBits(1),s=readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(32)+4436:readBits(12)+340:readBits(8)+84:readBits(6)+20:readBits(4)+4:readBits(2);return 0===o?s:s>0?-s:null}function decodeIAID(e,t,n){const r=e.getContexts("IAID");let i=1;for(let e=0;e<n;e++){i=i<<1|t.readBit(r,i)}return n<31?i&(1<<n)-1:2147483647&i}const a=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"PatternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"],c=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],l=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],f=[39717,1941,229,405],u=[32,8];function decodeBitmap(e,t,n,r,i,o,s,a){if(e){return decodeMMRBitmap(new Reader(a.data,a.start,a.end),t,n,!1)}if(0===r&&!o&&!i&&4===s.length&&3===s[0].x&&-1===s[0].y&&-3===s[1].x&&-1===s[1].y&&2===s[2].x&&-2===s[2].y&&-2===s[3].x&&-2===s[3].y)return function decodeBitmapTemplate0(e,t,n){const r=n.decoder,i=n.contextCache.getContexts("GB"),o=[];let s,a,c,l,f,u,h;for(a=0;a<t;a++){f=o[a]=new Uint8Array(e);u=a<1?f:o[a-1];h=a<2?f:o[a-2];s=h[0]<<13|h[1]<<12|h[2]<<11|u[0]<<7|u[1]<<6|u[2]<<5|u[3]<<4;for(c=0;c<e;c++){f[c]=l=r.readBit(i,s);s=(31735&s)<<1|(c+3<e?h[c+3]<<11:0)|(c+4<e?u[c+4]<<4:0)|l}}return o}(t,n,a);const l=!!o,u=c[r].concat(s);u.sort((function(e,t){return e.y-t.y||e.x-t.x}));const h=u.length,d=new Int8Array(h),p=new Int8Array(h),g=[];let m,b,y=0,x=0,w=0,T=0;for(b=0;b<h;b++){d[b]=u[b].x;p[b]=u[b].y;x=Math.min(x,u[b].x);w=Math.max(w,u[b].x);T=Math.min(T,u[b].y);b<h-1&&u[b].y===u[b+1].y&&u[b].x===u[b+1].x-1?y|=1<<h-1-b:g.push(b)}const S=g.length,C=new Int8Array(S),P=new Int8Array(S),v=new Uint16Array(S);for(m=0;m<S;m++){b=g[m];C[m]=u[b].x;P[m]=u[b].y;v[m]=1<<h-1-b}const E=-x,I=-T,A=t-w,k=f[r];let O=new Uint8Array(t);const _=[],B=a.decoder,D=a.contextCache.getContexts("GB");let M,R,L,U,N,j=0,H=0;for(let e=0;e<n;e++){if(i){j^=B.readBit(D,k);if(j){_.push(O);continue}}O=new Uint8Array(O);_.push(O);for(M=0;M<t;M++){if(l&&o[e][M]){O[M]=0;continue}if(M>=E&&M<A&&e>=I){H=H<<1&y;for(b=0;b<S;b++){R=e+P[b];L=M+C[b];U=_[R][L];if(U){U=v[b];H|=U}}}else{H=0;N=h-1;for(b=0;b<h;b++,N--){L=M+d[b];if(L>=0&&L<t){R=e+p[b];if(R>=0){U=_[R][L];U&&(H|=U<<N)}}}}const n=B.readBit(D,H);O[M]=n}}return _}function decodeRefinement(e,t,n,r,i,o,s,a,c){let f=l[n].coding;0===n&&(f=f.concat([a[0]]));const h=f.length,d=new Int32Array(h),p=new Int32Array(h);let g;for(g=0;g<h;g++){d[g]=f[g].x;p[g]=f[g].y}let m=l[n].reference;0===n&&(m=m.concat([a[1]]));const b=m.length,y=new Int32Array(b),x=new Int32Array(b);for(g=0;g<b;g++){y[g]=m[g].x;x[g]=m[g].y}const w=r[0].length,T=r.length,S=u[n],C=[],P=c.decoder,v=c.contextCache.getContexts("GR");let E=0;for(let n=0;n<t;n++){if(s){E^=P.readBit(v,S);if(E)throw new Jbig2Error("prediction is not supported")}const t=new Uint8Array(e);C.push(t);for(let s=0;s<e;s++){let a,c,l=0;for(g=0;g<h;g++){a=n+p[g];c=s+d[g];a<0||c<0||c>=e?l<<=1:l=l<<1|C[a][c]}for(g=0;g<b;g++){a=n+x[g]-o;c=s+y[g]-i;a<0||a>=T||c<0||c>=w?l<<=1:l=l<<1|r[a][c]}const f=P.readBit(v,l);t[s]=f}}return C}function decodeTextRegion(e,t,n,r,i,o,s,a,c,l,f,u,h,d,p,g,m,b,y){if(e&&t)throw new Jbig2Error("refinement with Huffman is not supported");const x=[];let w,T;for(w=0;w<r;w++){T=new Uint8Array(n);if(i)for(let e=0;e<n;e++)T[e]=i;x.push(T)}const S=m.decoder,C=m.contextCache;let P=e?-d.tableDeltaT.decode(y):-decodeInteger(C,"IADT",S),v=0;w=0;for(;w<o;){P+=e?d.tableDeltaT.decode(y):decodeInteger(C,"IADT",S);v+=e?d.tableFirstS.decode(y):decodeInteger(C,"IAFS",S);let r=v;for(;;){let i=0;s>1&&(i=e?y.readBits(b):decodeInteger(C,"IAIT",S));const o=s*P+i,v=e?d.symbolIDTable.decode(y):decodeIAID(C,S,c),E=t&&(e?y.readBit():decodeInteger(C,"IARI",S));let I=a[v],A=I[0].length,k=I.length;if(E){const e=decodeInteger(C,"IARDW",S),t=decodeInteger(C,"IARDH",S),n=decodeInteger(C,"IARDX",S),r=decodeInteger(C,"IARDY",S);A+=e;k+=t;I=decodeRefinement(A,k,p,I,(e>>1)+n,(t>>1)+r,!1,g,m)}const O=o-(1&u?0:k-1),_=r-(2&u?A-1:0);let B,D,M;if(l){for(B=0;B<k;B++){T=x[_+B];if(!T)continue;M=I[B];const e=Math.min(n-O,A);switch(h){case 0:for(D=0;D<e;D++)T[O+D]|=M[D];break;case 2:for(D=0;D<e;D++)T[O+D]^=M[D];break;default:throw new Jbig2Error(`operator ${h} is not supported`)}}r+=k-1}else{for(D=0;D<k;D++){T=x[O+D];if(T){M=I[D];switch(h){case 0:for(B=0;B<A;B++)T[_+B]|=M[B];break;case 2:for(B=0;B<A;B++)T[_+B]^=M[B];break;default:throw new Jbig2Error(`operator ${h} is not supported`)}}}r+=A-1}w++;const R=e?d.tableDeltaS.decode(y):decodeInteger(C,"IADS",S);if(null===R)break;r+=R+f}}return x}function readSegmentHeader(e,t){const n={};n.number=(0,i.readUint32)(e,t);const r=e[t+4],o=63&r;if(!a[o])throw new Jbig2Error("invalid segment type: "+o);n.type=o;n.typeName=a[o];n.deferredNonRetain=!!(128&r);const s=!!(64&r),c=e[t+5];let l=c>>5&7;const f=[31&c];let u=t+6;if(7===c){l=536870911&(0,i.readUint32)(e,u-1);u+=3;let t=l+7>>3;f[0]=e[u++];for(;--t>0;)f.push(e[u++])}else if(5===c||6===c)throw new Jbig2Error("invalid referred-to flags");n.retainBits=f;let d=4;n.number<=256?d=1:n.number<=65536&&(d=2);const p=[];let g,m;for(g=0;g<l;g++){let t;t=1===d?e[u]:2===d?(0,i.readUint16)(e,u):(0,i.readUint32)(e,u);p.push(t);u+=d}n.referredTo=p;if(s){n.pageAssociation=(0,i.readUint32)(e,u);u+=4}else n.pageAssociation=e[u++];n.length=(0,i.readUint32)(e,u);u+=4;if(4294967295===n.length){if(38!==o)throw new Jbig2Error("invalid unknown segment length");{const t=readRegionSegmentInformation(e,u),r=!!(1&e[u+h]),i=6,o=new Uint8Array(i);if(!r){o[0]=255;o[1]=172}o[2]=t.height>>>24&255;o[3]=t.height>>16&255;o[4]=t.height>>8&255;o[5]=255&t.height;for(g=u,m=e.length;g<m;g++){let t=0;for(;t<i&&o[t]===e[g+t];)t++;if(t===i){n.length=g+i;break}}if(4294967295===n.length)throw new Jbig2Error("segment end was not found")}}n.headerEnd=u;return n}function readSegments(e,t,n,r){const i=[];let o=n;for(;o<r;){const n=readSegmentHeader(t,o);o=n.headerEnd;const r={header:n,data:t};if(!e.randomAccess){r.start=o;o+=n.length;r.end=o}i.push(r);if(51===n.type)break}if(e.randomAccess)for(let e=0,t=i.length;e<t;e++){i[e].start=o;o+=i[e].header.length;i[e].end=o}return i}function readRegionSegmentInformation(e,t){return{width:(0,i.readUint32)(e,t),height:(0,i.readUint32)(e,t+4),x:(0,i.readUint32)(e,t+8),y:(0,i.readUint32)(e,t+12),combinationOperator:7&e[t+16]}}const h=17;function processSegment(e,t){const n=e.header,r=e.data,o=e.end;let s,a,c,l,f=e.start;switch(n.type){case 0:const e={},t=(0,i.readUint16)(r,f);e.huffman=!!(1&t);e.refinement=!!(2&t);e.huffmanDHSelector=t>>2&3;e.huffmanDWSelector=t>>4&3;e.bitmapSizeSelector=t>>6&1;e.aggregationInstancesSelector=t>>7&1;e.bitmapCodingContextUsed=!!(256&t);e.bitmapCodingContextRetained=!!(512&t);e.template=t>>10&3;e.refinementTemplate=t>>12&1;f+=2;if(!e.huffman){l=0===e.template?4:1;a=[];for(c=0;c<l;c++){a.push({x:(0,i.readInt8)(r,f),y:(0,i.readInt8)(r,f+1)});f+=2}e.at=a}if(e.refinement&&!e.refinementTemplate){a=[];for(c=0;c<2;c++){a.push({x:(0,i.readInt8)(r,f),y:(0,i.readInt8)(r,f+1)});f+=2}e.refinementAt=a}e.numberOfExportedSymbols=(0,i.readUint32)(r,f);f+=4;e.numberOfNewSymbols=(0,i.readUint32)(r,f);f+=4;s=[e,n.number,n.referredTo,r,f,o];break;case 6:case 7:const u={};u.info=readRegionSegmentInformation(r,f);f+=h;const d=(0,i.readUint16)(r,f);f+=2;u.huffman=!!(1&d);u.refinement=!!(2&d);u.logStripSize=d>>2&3;u.stripSize=1<<u.logStripSize;u.referenceCorner=d>>4&3;u.transposed=!!(64&d);u.combinationOperator=d>>7&3;u.defaultPixelValue=d>>9&1;u.dsOffset=d<<17>>27;u.refinementTemplate=d>>15&1;if(u.huffman){const e=(0,i.readUint16)(r,f);f+=2;u.huffmanFS=3&e;u.huffmanDS=e>>2&3;u.huffmanDT=e>>4&3;u.huffmanRefinementDW=e>>6&3;u.huffmanRefinementDH=e>>8&3;u.huffmanRefinementDX=e>>10&3;u.huffmanRefinementDY=e>>12&3;u.huffmanRefinementSizeSelector=!!(16384&e)}if(u.refinement&&!u.refinementTemplate){a=[];for(c=0;c<2;c++){a.push({x:(0,i.readInt8)(r,f),y:(0,i.readInt8)(r,f+1)});f+=2}u.refinementAt=a}u.numberOfSymbolInstances=(0,i.readUint32)(r,f);f+=4;s=[u,n.referredTo,r,f,o];break;case 16:const p={},g=r[f++];p.mmr=!!(1&g);p.template=g>>1&3;p.patternWidth=r[f++];p.patternHeight=r[f++];p.maxPatternIndex=(0,i.readUint32)(r,f);f+=4;s=[p,n.number,r,f,o];break;case 22:case 23:const m={};m.info=readRegionSegmentInformation(r,f);f+=h;const b=r[f++];m.mmr=!!(1&b);m.template=b>>1&3;m.enableSkip=!!(8&b);m.combinationOperator=b>>4&7;m.defaultPixelValue=b>>7&1;m.gridWidth=(0,i.readUint32)(r,f);f+=4;m.gridHeight=(0,i.readUint32)(r,f);f+=4;m.gridOffsetX=4294967295&(0,i.readUint32)(r,f);f+=4;m.gridOffsetY=4294967295&(0,i.readUint32)(r,f);f+=4;m.gridVectorX=(0,i.readUint16)(r,f);f+=2;m.gridVectorY=(0,i.readUint16)(r,f);f+=2;s=[m,n.referredTo,r,f,o];break;case 38:case 39:const y={};y.info=readRegionSegmentInformation(r,f);f+=h;const x=r[f++];y.mmr=!!(1&x);y.template=x>>1&3;y.prediction=!!(8&x);if(!y.mmr){l=0===y.template?4:1;a=[];for(c=0;c<l;c++){a.push({x:(0,i.readInt8)(r,f),y:(0,i.readInt8)(r,f+1)});f+=2}y.at=a}s=[y,r,f,o];break;case 48:const w={width:(0,i.readUint32)(r,f),height:(0,i.readUint32)(r,f+4),resolutionX:(0,i.readUint32)(r,f+8),resolutionY:(0,i.readUint32)(r,f+12)};4294967295===w.height&&delete w.height;const T=r[f+16];(0,i.readUint16)(r,f+17);w.lossless=!!(1&T);w.refinement=!!(2&T);w.defaultPixelValue=T>>2&1;w.combinationOperator=T>>3&3;w.requiresBuffer=!!(32&T);w.combinationOperatorOverride=!!(64&T);s=[w];break;case 49:case 50:case 51:case 62:break;case 53:s=[n.number,r,f,o];break;default:throw new Jbig2Error(`segment type ${n.typeName}(${n.type}) is not implemented`)}const u="on"+n.typeName;u in t&&t[u].apply(t,s)}function processSegments(e,t){for(let n=0,r=e.length;n<r;n++)processSegment(e[n],t)}class SimpleSegmentVisitor{onPageInformation(e){this.currentPageInfo=e;const t=e.width+7>>3,n=new Uint8ClampedArray(t*e.height);e.defaultPixelValue&&n.fill(255);this.buffer=n}drawBitmap(e,t){const n=this.currentPageInfo,r=e.width,i=e.height,o=n.width+7>>3,s=n.combinationOperatorOverride?e.combinationOperator:n.combinationOperator,a=this.buffer,c=128>>(7&e.x);let l,f,u,h,d=e.y*o+(e.x>>3);switch(s){case 0:for(l=0;l<i;l++){u=c;h=d;for(f=0;f<r;f++){t[l][f]&&(a[h]|=u);u>>=1;if(!u){u=128;h++}}d+=o}break;case 2:for(l=0;l<i;l++){u=c;h=d;for(f=0;f<r;f++){t[l][f]&&(a[h]^=u);u>>=1;if(!u){u=128;h++}}d+=o}break;default:throw new Jbig2Error(`operator ${s} is not supported`)}}onImmediateGenericRegion(e,t,n,r){const i=e.info,o=new DecodingContext(t,n,r),s=decodeBitmap(e.mmr,i.width,i.height,e.template,e.prediction,null,e.at,o);this.drawBitmap(i,s)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(e,t,n,r,o,s){let a,c;if(e.huffman){a=function getSymbolDictionaryHuffmanTables(e,t,n){let r,i,o,s,a=0;switch(e.huffmanDHSelector){case 0:case 1:r=getStandardTable(e.huffmanDHSelector+4);break;case 3:r=getCustomHuffmanTable(a,t,n);a++;break;default:throw new Jbig2Error("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:i=getStandardTable(e.huffmanDWSelector+2);break;case 3:i=getCustomHuffmanTable(a,t,n);a++;break;default:throw new Jbig2Error("invalid Huffman DW selector")}if(e.bitmapSizeSelector){o=getCustomHuffmanTable(a,t,n);a++}else o=getStandardTable(1);s=e.aggregationInstancesSelector?getCustomHuffmanTable(a,t,n):getStandardTable(1);return{tableDeltaHeight:r,tableDeltaWidth:i,tableBitmapSize:o,tableAggregateInstances:s}}(e,n,this.customTables);c=new Reader(r,o,s)}let l=this.symbols;l||(this.symbols=l={});const f=[];for(const e of n){const t=l[e];t&&f.push(...t)}const u=new DecodingContext(r,o,s);l[t]=function decodeSymbolDictionary(e,t,n,r,o,s,a,c,l,f,u,h){if(e&&t)throw new Jbig2Error("symbol refinement with Huffman is not supported");const d=[];let p=0,g=(0,i.log2)(n.length+r);const m=u.decoder,b=u.contextCache;let y,x;if(e){y=getStandardTable(1);x=[];g=Math.max(g,1)}for(;d.length<r;){p+=e?s.tableDeltaHeight.decode(h):decodeInteger(b,"IADH",m);let r=0,i=0;const o=e?x.length:0;for(;;){const o=e?s.tableDeltaWidth.decode(h):decodeInteger(b,"IADW",m);if(null===o)break;r+=o;i+=r;let y;if(t){const i=decodeInteger(b,"IAAI",m);if(i>1)y=decodeTextRegion(e,t,r,p,0,i,1,n.concat(d),g,0,0,1,0,s,l,f,u,0,h);else{const e=decodeIAID(b,m,g),t=decodeInteger(b,"IARDX",m),i=decodeInteger(b,"IARDY",m);y=decodeRefinement(r,p,l,e<n.length?n[e]:d[e-n.length],t,i,!1,f,u)}d.push(y)}else if(e)x.push(r);else{y=decodeBitmap(!1,r,p,a,!1,null,c,u);d.push(y)}}if(e&&!t){const e=s.tableBitmapSize.decode(h);h.byteAlign();let t;if(0===e)t=readUncompressedBitmap(h,i,p);else{const n=h.end,r=h.position+e;h.end=r;t=decodeMMRBitmap(h,i,p,!1);h.end=n;h.position=r}const n=x.length;if(o===n-1)d.push(t);else{let e,r,i,s,a,c=0;for(e=o;e<n;e++){s=x[e];i=c+s;a=[];for(r=0;r<p;r++)a.push(t[r].subarray(c,i));d.push(a);c=i}}}}const w=[],T=[];let S,C,P=!1;const v=n.length+r;for(;T.length<v;){let t=e?y.decode(h):decodeInteger(b,"IAEX",m);for(;t--;)T.push(P);P=!P}for(S=0,C=n.length;S<C;S++)T[S]&&w.push(n[S]);for(let e=0;e<r;S++,e++)T[S]&&w.push(d[e]);return w}(e.huffman,e.refinement,f,e.numberOfNewSymbols,e.numberOfExportedSymbols,a,e.template,e.at,e.refinementTemplate,e.refinementAt,u,c)}onImmediateTextRegion(e,t,n,r,o){const s=e.info;let a,c;const l=this.symbols,f=[];for(const e of t){const t=l[e];t&&f.push(...t)}const u=(0,i.log2)(f.length);if(e.huffman){c=new Reader(n,r,o);a=function getTextRegionHuffmanTables(e,t,n,r,i){const o=[];for(let e=0;e<=34;e++){const t=i.readBits(4);o.push(new HuffmanLine([e,t,0,0]))}const s=new H