/** * @licstart The following is the entire license notice for the * Javascript code in this page * * Copyright 2020 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()}(this,(function(){return(()=>{"use strict";var e=[(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"getVerbosityLevel",{enumerable:!0,get:function(){return r.getVerbosityLevel}});Object.defineProperty(t,"setVerbosityLevel",{enumerable:!0,get:function(){return r.setVerbosityLevel}});Object.defineProperty(t,"Jbig2mage",{enumerable:!0,get:function(){return i.Jbig2mage}});Object.defineProperty(t,"JpegImage",{enumerable:!0,get:function(){return o.JpegImage}});Object.defineProperty(t,"JpxImage",{enumerable:!0,get:function(){return s.JpxImage}});var r=n(1),i=n(4),o=n(9),s=n(10)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!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;rt});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,t){if(!e)return null;try{const n=t?new URL(e,t):new URL(e);if(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}}(n))return n}catch(e){}return null};t.encodeToXmlString=function encodeToXmlString(e){const t=[];let n=0;for(let r=0,i=e.length;r55295&&(i<57344||i>65533)&&r++;n=r+1}}if(0===t.length)return e;n"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};t.getModificationDate=function getModificationDate(e=new Date){return[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("")};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;return e.every((function(e,n){return e===t[n]}))};t.isAscii=function isAscii(e){return/^[\x00-\x7F]*$/.test(e)};t.isBool=function isBool(e){return"boolean"==typeof e};t.isNum=function isNum(e){return"number"==typeof e};t.isSameOrigin=function isSameOrigin(e,t){let n;try{n=new URL(e);if(!n.origin||"null"===n.origin)return!1}catch(e){return!1}const r=new URL(t,n);return n.origin===r.origin};t.isString=function isString(e){return"string"==typeof e};t.objectFromEntries=function objectFromEntries(e){return Object.assign(Object.create(null),Object.fromEntries(e))};t.objectSize=function objectSize(e){return Object.keys(e).length};t.removeNullCharacters=function removeNullCharacters(e){if("string"!=typeof e){warn("The argument for removeNullCharacters must be a string.");return e}return e.replace(s,"")};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){const t=e.length,n=[];if("þ"===e[0]&&"ÿ"===e[1])for(let r=2;r>8&255));t.push(String.fromCharCode(255&r))}return t.join("")};t.stringToUTF8String=function stringToUTF8String(e){return decodeURIComponent(escape(e))};t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;t.VerbosityLevel=t.Util=t.UNSUPPORTED_FEATURES=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.IsLittleEndianCached=t.IsEvalSupportedCached=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.createObjectURL=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;n(2);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];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",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",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",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent"};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 assert(e,t){e||unreachable(t)}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){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=this.constructor.name}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=o;t.PasswordException=class PasswordException extends o{constructor(e,t){super(e);this.code=t}};t.UnknownErrorException=class UnknownErrorException extends o{constructor(e,t){super(e);this.details=t}};t.InvalidPDFException=class InvalidPDFException extends o{};t.MissingPDFException=class MissingPDFException extends o{};t.UnexpectedResponseException=class UnexpectedResponseException extends o{constructor(e,t){super(e);this.status=t}};t.FormatError=class FormatError extends o{};t.AbortException=class AbortException extends o{};const s=/\x00/g;function stringToBytes(e){assert("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let r=0;re.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,n){return`#${l[e]}${l[t]}${l[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 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)*(n+o)-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){function compare(e,t){return e-t}const n=[e[0],e[2],t[0],t[2]].sort(compare),r=[e[1],e[3],t[1],t[3]].sort(compare),i=[];e=Util.normalizeRect(e);t=Util.normalizeRect(t);if(!(n[0]===e[0]&&n[1]===t[0]||n[0]===t[0]&&n[1]===e[0]))return null;i[0]=n[1];i[2]=n[2];if(!(r[0]===e[1]&&r[1]===t[1]||r[0]===t[1]&&r[1]===e[1]))return null;i[1]=r[1];i[3]=r[2];return i}}t.Util=Util;const f=[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];const h=function createObjectURLClosure(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function createObjectURL(t,n,r=!1){if(!r&&URL.createObjectURL){const e=new Blob([t],{type:n});return URL.createObjectURL(e)}let i=`data:${n};base64,`;for(let n=0,r=t.length;n>2]+e[(3&o)<<4|s>>4]+e[n+1>6:64]+e[n+2{n(3)},(e,t)=>{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)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Jbig2Image=void 0;var r=n(1),i=n(5),o=n(7),s=n(8);class Jbig2Error extends r.BaseException{constructor(e){super(`JBIG2 error: ${e}`)}}var a=function Jbig2ImageClosure(){function ContextCache(){}ContextCache.prototype={getContexts(e){return e in this?this[e]:this[e]=new Int8Array(65536)}};function DecodingContext(e,t,n){this.data=e;this.start=t;this.end=n}DecodingContext.prototype={get decoder(){var e=new o.ArithmeticDecoder(this.data,this.start,this.end);return(0,r.shadow)(this,"decoder",e)},get contextCache(){var e=new ContextCache;return(0,r.shadow)(this,"contextCache",e)}};function decodeInteger(e,t,n){var r=e.getContexts(t),i=1;function readBits(e){for(var t=0,o=0;o>>0}var 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){for(var r=e.getContexts("IAID"),i=1,o=0;o=_&&P=A){H=H<<1&y;for(u=0;u=0&&E=0&&(B=M[k][E])&&(H|=B<=e?A<<=1:A=A<<1|T[D][_]}for(d=0;d=w||_<0||_>=x?A<<=1:A=A<<1|i[D][_]}var L=I.readBit(S,A);E[B]=L}}return T}function decodeTextRegion(e,t,n,r,i,o,s,a,c,l,f,h,d,u,p,m,g,b,y){if(e&&t)throw new Jbig2Error("refinement with Huffman is not supported");var v,x,w=[];for(v=0;v1&&(r=e?y.readBits(b):decodeInteger(I,"IAIT",T));var E=s*S+r,B=e?u.symbolIDTable.decode(y):decodeIAID(I,T,c),D=t&&(e?y.readBit():decodeInteger(I,"IARI",T)),_=a[B],A=_[0].length,L=_.length;if(D){var R=decodeInteger(I,"IARDW",T),O=decodeInteger(I,"IARDH",T);_=decodeRefinement(A+=R,L+=O,p,_,(R>>1)+decodeInteger(I,"IARDX",T),(O>>1)+decodeInteger(I,"IARDY",T),!1,m,g)}var M,U,F,N=E-(1&h?0:L-1),H=k-(2&h?A-1:0);if(l){for(M=0;M>5&7,h=[31&c],d=n+6;if(7===c){f=536870911&(0,i.readUint32)(t,d-1);d+=3;var u=f+7>>3;h[0]=t[d++];for(;--u>0;)h.push(t[d++])}else if(5===c||6===c)throw new Jbig2Error("invalid referred-to flags");r.retainBits=h;let p=4;r.number<=256?p=1:r.number<=65536&&(p=2);var m,g,b=[];for(m=0;m>>24&255;x[3]=y.height>>16&255;x[4]=y.height>>8&255;x[5]=255&y.height;for(m=d,g=t.length;m>2&3;d.huffmanDWSelector=u>>4&3;d.bitmapSizeSelector=u>>6&1;d.aggregationInstancesSelector=u>>7&1;d.bitmapCodingContextUsed=!!(256&u);d.bitmapCodingContextRetained=!!(512&u);d.template=u>>10&3;d.refinementTemplate=u>>12&1;f+=2;if(!d.huffman){s=0===d.template?4:1;r=[];for(o=0;o>2&3;p.stripSize=1<>4&3;p.transposed=!!(64&m);p.combinationOperator=m>>7&3;p.defaultPixelValue=m>>9&1;p.dsOffset=m<<17>>27;p.refinementTemplate=m>>15&1;if(p.huffman){var g=(0,i.readUint16)(c,f);f+=2;p.huffmanFS=3&g;p.huffmanDS=g>>2&3;p.huffmanDT=g>>4&3;p.huffmanRefinementDW=g>>6&3;p.huffmanRefinementDH=g>>8&3;p.huffmanRefinementDX=g>>10&3;p.huffmanRefinementDY=g>>12&3;p.huffmanRefinementSizeSelector=!!(16384&g)}if(p.refinement&&!p.refinementTemplate){r=[];for(o=0;o<2;o++){r.push({x:(0,i.readInt8)(c,f),y:(0,i.readInt8)(c,f+1)});f+=2}p.refinementAt=r}p.numberOfSymbolInstances=(0,i.readUint32)(c,f);f+=4;n=[p,a.referredTo,c,f,h];break;case 16:const e={},t=c[f++];e.mmr=!!(1&t);e.template=t>>1&3;e.patternWidth=c[f++];e.patternHeight=c[f++];e.maxPatternIndex=(0,i.readUint32)(c,f);f+=4;n=[e,a.number,c,f,h];break;case 22:case 23:const w={};w.info=readRegionSegmentInformation(c,f);f+=l;const C=c[f++];w.mmr=!!(1&C);w.template=C>>1&3;w.enableSkip=!!(8&C);w.combinationOperator=C>>4&7;w.defaultPixelValue=C>>7&1;w.gridWidth=(0,i.readUint32)(c,f);f+=4;w.gridHeight=(0,i.readUint32)(c,f);f+=4;w.gridOffsetX=4294967295&(0,i.readUint32)(c,f);f+=4;w.gridOffsetY=4294967295&(0,i.readUint32)(c,f);f+=4;w.gridVectorX=(0,i.readUint16)(c,f);f+=2;w.gridVectorY=(0,i.readUint16)(c,f);f+=2;n=[w,a.referredTo,c,f,h];break;case 38:case 39:var b={};b.info=readRegionSegmentInformation(c,f);f+=l;var y=c[f++];b.mmr=!!(1&y);b.template=y>>1&3;b.prediction=!!(8&y);if(!b.mmr){s=0===b.template?4:1;r=[];for(o=0;o>2&1;v.combinationOperator=x>>3&3;v.requiresBuffer=!!(32&x);v.combinationOperatorOverride=!!(64&x);n=[v];break;case 49:case 50:case 51:break;case 53:n=[a.number,c,f,h];break;case 62:break;default:throw new Jbig2Error(`segment type ${a.typeName}(${a.type}) is not implemented`)}var w="on"+a.typeName;w in t&&t[w].apply(t,n)}function processSegments(e,t){for(var n=0,r=e.length;n>3,n=new Uint8ClampedArray(t*e.height);if(e.defaultPixelValue)for(var r=0,i=n.length;r>3,f=s.combinationOperatorOverride?e.combinationOperator:s.combinationOperator,h=this.buffer,d=128>>(7&e.x),u=e.y*l+(e.x>>3);switch(f){case 0:for(n=0;n>=1)){i=128;o++}}u+=l}break;case 2:for(n=0;n>=1)){i=128;o++}}u+=l}break;default:throw new Jbig2Error(`operator ${f} is not supported`)}},onImmediateGenericRegion:function SimpleSegmentVisitor_onImmediateGenericRegion(e,t,n,r){var 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:function SimpleSegmentVisitor_onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function SimpleSegmentVisitor_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)}var l=this.symbols;l||(this.symbols=l={});for(var f=[],h=0,d=n.length;h1)x=decodeTextRegion(e,t,r,p,0,C,1,n.concat(u),m,0,0,1,0,s,l,f,h,0,d);else{var T=decodeIAID(b,g,m),I=decodeInteger(b,"IARDX",g),S=decodeInteger(b,"IARDY",g);x=decodeRefinement(r,p,l,T=32){let n,r,s;switch(t){case 32:if(0===e)throw new Jbig2Error("no previous value in symbol ID table");r=i.readBits(2)+3;n=o[e-1].prefixLength;break;case 33:r=i.readBits(3)+3;n=0;break;case 34:r=i.readBits(7)+11;n=0;break;default:throw new Jbig2Error("invalid code length in symbol ID table")}for(s=0;s=0;b--){E=e?decodeMMRBitmap(k,l,f,!0):decodeBitmap(!1,l,f,n,!1,null,S,m);P[b]=E}for(B=0;B=0;y--){_=P[y][B][D]^_;A|=_<>8;O=d+B*u-D*p>>8;if(R>=0&&R+C<=r&&O>=0&&O+T<=o)for(b=0;b=o)){U=g[t];M=L[b];for(y=0;y=0&&e>1&7),l=1+(r>>4&7),f=[];let h,d,u=o;do{h=a.readBits(c);d=a.readBits(l);f.push(new HuffmanLine([u,h,d,0]));u+=1<>t&1;if(t<=0)this.children[n]=new HuffmanTreeNode(e);else{let r=this.children[n];r||(this.children[n]=r=new HuffmanTreeNode(null));r.buildTree(e,t-1)}},decodeNode(e){if(this.isLeaf){if(this.isOOB)return null;const t=e.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-t:t)}const t=this.children[e.readBit()];if(!t)throw new Jbig2Error("invalid Huffman data");return t.decodeNode(e)}};function HuffmanTable(e,t){t||this.assignPrefixCodes(e);this.rootNode=new HuffmanTreeNode(null);for(let t=0,n=e.length;t0&&this.rootNode.buildTree(n,n.prefixLength-1)}}HuffmanTable.prototype={decode(e){return this.rootNode.decodeNode(e)},assignPrefixCodes(e){const t=e.length;let n=0;for(let r=0;r=this.end)throw new Jbig2Error("end of data while reading bit");this.currentByte=this.data[this.position++];this.shift=7}const e=this.currentByte>>this.shift&1;this.shift--;return e},readBits(e){let t,n=0;for(t=e-1;t>=0;t--)n|=this.readBit()<=this.end?-1:this.data[this.position++]}};function getCustomHuffmanTable(e,t,n){let r=0;for(let i=0,o=t.length;i>n&1;n--}}if(r&&!l){const e=5;for(let t=0;tfunction parseJbig2Chunks(e){for(var t=new SimpleSegmentVisitor,n=0,r=e.length;n>=1}}return{imgData:h,width:c,height:l}}(e);this.width=n;this.height=r;return t}};return Jbig2Image}();t.Jbig2Image=a},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.collectActions=function collectActions(e,t,n){const o=Object.create(null);if(t.has("AA")){const r=t.get("AA");for(const t of r.getKeys()){const s=n[t];if(!s)continue;const a=r.getRaw(t),c=new i.RefSet,l=[];_collectJS(a,e,l,c);l.length>0&&(o[s]=l)}}if(t.has("A")){const n=t.get("A"),r=new i.RefSet,s=[];_collectJS(n,e,s,r);s.length>0&&(o.Action=s)}return(0,r.objectSize)(o)>0?o:null};t.escapePDFName=function escapePDFName(e){const t=[];let n=0;for(let r=0,i=e.length;r126||35===i||40===i||41===i||60===i||62===i||91===i||93===i||123===i||125===i||47===i||37===i){n100){(0,r.warn)(`getInheritableProperty: maximum loop count exceeded for "${t}"`);break}e=e.get("Parent")}return o};t.getLookupTableFactory=function getLookupTableFactory(e){let t;return function(){if(e){t=Object.create(null);e(t);e=null}return t}};t.isWhiteSpace=function isWhiteSpace(e){return 32===e||9===e||13===e||10===e};t.log2=function log2(e){if(e<=0)return 0;return Math.ceil(Math.log2(e))};t.parseXFAPath=function parseXFAPath(e){const t=/(.+)\[([0-9]+)\]$/;return e.split(".").map((e=>{const n=e.match(t);return n?{name:n[1],pos:parseInt(n[2],10)}:{name:e,pos:0}}))};t.readInt8=function readInt8(e,t){return e[t]<<24>>24};t.readUint16=function readUint16(e,t){return e[t]<<8|e[t+1]};t.readUint32=function readUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0};t.toRomanNumerals=function toRomanNumerals(e,t=!1){(0,r.assert)(Number.isInteger(e)&&e>0,"The number should be a positive integer.");const n=[];let i;for(;e>=1e3;){e-=1e3;n.push("M")}i=e/100|0;e%=100;n.push(o[i]);i=e/10|0;e%=10;n.push(o[10+i]);n.push(o[20+e]);const s=n.join("");return t?s.toLowerCase():s};t.XRefParseException=t.XRefEntryException=t.MissingDataException=void 0;var r=n(1),i=n(6);class MissingDataException extends r.BaseException{constructor(e,t){super(`Missing data [${e}, ${t})`);this.begin=e;this.end=t}}t.MissingDataException=MissingDataException;class XRefEntryException extends r.BaseException{}t.XRefEntryException=XRefEntryException;class XRefParseException extends r.BaseException{}t.XRefParseException=XRefParseException;const o=["","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"];function _collectJS(e,t,n,o){if(!e)return;let s=null;if((0,i.isRef)(e)){if(o.has(e))return;s=e;o.put(s);e=t.fetch(e)}if(Array.isArray(e))for(const r of e)_collectJS(r,t,n,o);else if(e instanceof i.Dict){if((0,i.isName)(e.get("S"),"JavaScript")&&e.has("JS")){const t=e.get("JS");let o;o=(0,i.isStream)(t)?(0,r.bytesToString)(t.getBytes()):t;o=(0,r.stringToPDFString)(o);o&&n.push(o)}_collectJS(e.getRaw("Next"),t,n,o)}s&&o.remove(s)}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.clearPrimitiveCaches=function clearPrimitiveCaches(){s._clearCache();o._clearCache();c._clearCache()};t.isCmd=function isCmd(e,t){return e instanceof s&&(void 0===t||e.cmd===t)};t.isDict=function isDict(e,t){return e instanceof a&&(void 0===t||isName(e.get("Type"),t))};t.isEOF=function isEOF(e){return e===i};t.isName=isName;t.isRef=function isRef(e){return e instanceof c};t.isRefsEqual=function isRefsEqual(e,t){return e.num===t.num&&e.gen===t.gen};t.isStream=function isStream(e){return"object"==typeof e&&null!==e&&void 0!==e.getBytes};t.RefSetCache=t.RefSet=t.Ref=t.Name=t.EOF=t.Dict=t.Cmd=void 0;var r=n(1),i={};t.EOF=i;var o=function NameClosure(){let e=Object.create(null);function Name(e){this.name=e}Name.prototype={};Name.get=function Name_get(t){var n=e[t];return n||(e[t]=new Name(t))};Name._clearCache=function(){e=Object.create(null)};return Name}();t.Name=o;var s=function CmdClosure(){let e=Object.create(null);function Cmd(e){this.cmd=e}Cmd.prototype={};Cmd.get=function Cmd_get(t){var n=e[t];return n||(e[t]=new Cmd(t))};Cmd._clearCache=function(){e=Object.create(null)};return Cmd}();t.Cmd=s;var a=function DictClosure(){var e=function nonSerializableClosure(){return e};function Dict(t){this._map=Object.create(null);this.xref=t;this.objId=null;this.suppressEncryption=!1;this.__nonSerializable__=e}Dict.prototype={assignXref:function Dict_assignXref(e){this.xref=e},get size(){return Object.keys(this._map).length},get(e,t,n){let r=this._map[e];if(void 0===r&&void 0!==t){r=this._map[t];void 0===r&&void 0!==n&&(r=this._map[n])}return r instanceof c&&this.xref?this.xref.fetch(r,this.suppressEncryption):r},async getAsync(e,t,n){let r=this._map[e];if(void 0===r&&void 0!==t){r=this._map[t];void 0===r&&void 0!==n&&(r=this._map[n])}return r instanceof c&&this.xref?this.xref.fetchAsync(r,this.suppressEncryption):r},getArray(e,t,n){let r=this.get(e,t,n);if(!Array.isArray(r)||!this.xref)return r;r=r.slice();for(let e=0,t=r.length;e{(0,r.unreachable)("Should not call `set` on the empty dictionary.")};return e}();Dict.merge=function({xref:e,dictArray:t,mergeSubDicts:n=!1}){const r=new Dict(e);if(!n){for(const e of t)if(e instanceof Dict)for(const[t,n]of Object.entries(e._map))void 0===r._map[t]&&(r._map[t]=n);return r.size>0?r:Dict.empty}const i=new Map;for(const e of t)if(e instanceof Dict)for(const[t,n]of Object.entries(e._map)){let e=i.get(t);if(void 0===e){e=[];i.set(t,e)}e.push(n)}for(const[t,n]of i){if(1===n.length||!(n[0]instanceof Dict)){r._map[t]=n[0];continue}const i=new Dict(e);for(const e of n)if(e instanceof Dict)for(const[t,n]of Object.entries(e._map))void 0===i._map[t]&&(i._map[t]=n);i.size>0&&(r._map[t]=i)}i.clear();return r.size>0?r:Dict.empty};return Dict}();t.Dict=a;var c=function RefClosure(){let e=Object.create(null);function Ref(e,t){this.num=e;this.gen=t}Ref.prototype={toString:function Ref_toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}};Ref.get=function(t,n){const r=0===n?`${t}R`:`${t}R${n}`,i=e[r];return i||(e[r]=new Ref(t,n))};Ref._clearCache=function(){e=Object.create(null)};return Ref}();t.Ref=c;t.RefSet=class RefSet{constructor(e=null){this._set=new Set(e&&e._set)}has(e){return this._set.has(e.toString())}put(e){this._set.add(e.toString())}remove(e){this._set.delete(e.toString())}forEach(e){for(const t of this._set.values())e(t)}clear(){this._set.clear()}};t.RefSetCache=class RefSetCache{constructor(){this._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))}forEach(e){for(const t of this._map.values())e(t)}clear(){this._map.clear()}};function isName(e,t){return e instanceof o&&(void 0===t||e.name===t)}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ArithmeticDecoder=void 0;const n=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];t.ArithmeticDecoder=class ArithmeticDecoder{constructor(e,t,n){this.data=e;this.bp=t;this.dataEnd=n;this.chigh=e[t];this.clow=0;this.byteIn();this.chigh=this.chigh<<7&65535|this.clow>>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=32768}byteIn(){const e=this.data;let t=this.bp;if(255===e[t])if(e[t+1]>143){this.clow+=65280;this.ct=8}else{t++;this.clow+=e[t]<<9;this.ct=7;this.bp=t}else{t++;this.clow+=t65535){this.chigh+=this.clow>>16;this.clow&=65535}}readBit(e,t){let r=e[t]>>1,i=1&e[t];const o=n[r],s=o.qe;let a,c=this.a-s;if(this.chigh>15&1;this.clow=this.clow<<1&65535;this.ct--}while(0==(32768&c));this.a=c;e[t]=r<<1|i;return a}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.CCITTFaxDecoder=void 0;var r=n(1);const i=function CCITTFaxDecoder(){const e=-1,t=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],n=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],i=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],o=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],s=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],a=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];function CCITTFaxDecoder(e,t={}){if(!e||"function"!=typeof e.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');this.source=e;this.eof=!1;this.encoding=t.K||0;this.eoline=t.EndOfLine||!1;this.byteAlign=t.EncodedByteAlign||!1;this.columns=t.Columns||1728;this.rows=t.Rows||0;let n,r=t.EndOfBlock;null==r&&(r=!0);this.eoblock=r;this.black=t.BlackIs1||!1;this.codingLine=new Uint32Array(this.columns+1);this.refLine=new Uint32Array(this.columns+2);this.codingLine[0]=this.columns;this.codingPos=0;this.row=0;this.nextLine2D=this.encoding<0;this.inputBits=0;this.inputBuf=0;this.outputBits=0;this.rowsDone=!1;for(;0===(n=this._lookBits(12));)this._eatBits(1);1===n&&this._eatBits(12);if(this.encoding>0){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}}CCITTFaxDecoder.prototype={readNextChar(){if(this.eof)return-1;const t=this.refLine,n=this.codingLine,i=this.columns;let o,s,a,c,l;if(0===this.outputBits){this.rowsDone&&(this.eof=!0);if(this.eof)return-1;this.err=!1;let a,l,f;if(this.nextLine2D){for(c=0;n[c]=64);do{l+=f=this._getWhiteCode()}while(f>=64)}else{do{a+=f=this._getWhiteCode()}while(f>=64);do{l+=f=this._getBlackCode()}while(f>=64)}this._addPixels(n[this.codingPos]+a,s);n[this.codingPos]0?--o:++o;for(;t[o]<=n[this.codingPos]&&t[o]0?--o:++o;for(;t[o]<=n[this.codingPos]&&t[o]0?--o:++o;for(;t[o]<=n[this.codingPos]&&t[o]=64);else do{a+=f=this._getWhiteCode()}while(f>=64);this._addPixels(n[this.codingPos]+a,s);s^=1}}let h=!1;this.byteAlign&&(this.inputBits&=-8);if(this.eoblock||this.row!==this.rows-1){a=this._lookBits(12);if(this.eoline)for(;a!==e&&1!==a;){this._eatBits(1);a=this._lookBits(12)}else for(;0===a;){this._eatBits(1);a=this._lookBits(12)}if(1===a){this._eatBits(12);h=!0}else a===e&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}if(this.eoblock&&h&&this.byteAlign){a=this._lookBits(12);if(1===a){this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}if(this.encoding>=0)for(c=0;c<4;++c){a=this._lookBits(12);1!==a&&(0,r.info)("bad rtc code: "+a);this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}}this.eof=!0}}else if(this.err&&this.eoline){for(;;){a=this._lookBits(13);if(a===e){this.eof=!0;return-1}if(a>>1==1)break;this._eatBits(1)}this._eatBits(12);if(this.encoding>0){this._eatBits(1);this.nextLine2D=!(1&a)}}n[0]>0?this.outputBits=n[this.codingPos=0]:this.outputBits=n[this.codingPos=1];this.row++}if(this.outputBits>=8){l=1&this.codingPos?0:255;this.outputBits-=8;if(0===this.outputBits&&n[this.codingPos]a){l<<=a;1&this.codingPos||(l|=255>>8-a);this.outputBits-=a;a=0}else{l<<=this.outputBits;1&this.codingPos||(l|=255>>8-this.outputBits);a-=this.outputBits;this.outputBits=0;if(n[this.codingPos]0){l<<=a;a=0}}}while(a)}this.black&&(l^=255);return l},_addPixels(e,t){const n=this.codingLine;let i=this.codingPos;if(e>n[i]){if(e>this.columns){(0,r.info)("row is wrong length");this.err=!0;e=this.columns}1&i^t&&++i;n[i]=e}this.codingPos=i},_addPixelsNeg(e,t){const n=this.codingLine;let i=this.codingPos;if(e>n[i]){if(e>this.columns){(0,r.info)("row is wrong length");this.err=!0;e=this.columns}1&i^t&&++i;n[i]=e}else if(e0&&e=o){const e=r[t-o];if(e[0]===i){this._eatBits(i);return[!0,e[1],!0]}}}return[!1,0,!1]},_getTwoDimCode(){let n,i=0;if(this.eoblock){i=this._lookBits(7);n=t[i];if(n&&n[0]>0){this._eatBits(n[0]);return n[1]}}else{const e=this._findTableCode(1,7,t);if(e[0]&&e[2])return e[1]}(0,r.info)("Bad two dim code");return e},_getWhiteCode(){let t,o=0;if(this.eoblock){o=this._lookBits(12);if(o===e)return 1;t=o>>5==0?n[o]:i[o>>3];if(t[0]>0){this._eatBits(t[0]);return t[1]}}else{let e=this._findTableCode(1,9,i);if(e[0])return e[1];e=this._findTableCode(11,12,n);if(e[0])return e[1]}(0,r.info)("bad white code");this._eatBits(1);return 1},_getBlackCode(){let t,n;if(this.eoblock){t=this._lookBits(13);if(t===e)return 1;n=t>>7==0?o[t]:t>>9==0&&t>>7!=0?s[(t>>1)-64]:a[t>>7];if(n[0]>0){this._eatBits(n[0]);return n[1]}}else{let e=this._findTableCode(2,6,a);if(e[0])return e[1];e=this._findTableCode(7,12,s,64);if(e[0])return e[1];e=this._findTableCode(10,13,o);if(e[0])return e[1]}(0,r.info)("bad black code");this._eatBits(1);return 1},_lookBits(t){let n;for(;this.inputBits>16-t;this.inputBuf=this.inputBuf<<8|n;this.inputBits+=8}return this.inputBuf>>this.inputBits-t&65535>>16-t},_eatBits(e){(this.inputBits-=e)<0&&(this.inputBits=0)}};return CCITTFaxDecoder}();t.CCITTFaxDecoder=i},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.JpegImage=void 0;var r=n(1),i=n(5);class JpegError extends r.BaseException{constructor(e){super(`JPEG error: ${e}`)}}class DNLMarkerError extends r.BaseException{constructor(e,t){super(e);this.scanLines=t}}class EOIMarkerError extends r.BaseException{}var o=function JpegImageClosure(){var e=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,n=799,o=3406,s=2276,a=1567,c=3784,l=5793,f=2896;function JpegImage({decodeTransform:e=null,colorTransform:t=-1}={}){this._decodeTransform=e;this._colorTransform=t}function buildHuffmanTable(e,t){for(var n,r,i=0,o=[],s=16;s>0&&!e[s-1];)s--;o.push({children:[],index:0});var a,c=o[0];for(n=0;n0;)c=o.pop();c.index++;o.push(c);for(;o.length<=n;){o.push(a={children:[],index:0});c.children[c.index]=a.children;c=a}i++}if(n+10){b--;return g>>b&1}g=t[n++];if(255===g){var e=t[n++];if(e){if(220===e&&d){n+=2;const e=(0,i.readUint16)(t,n);n+=2;if(e>0&&e!==o.scanLines)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",e)}else if(217===e){if(d){const e=w*(8===o.precision?8:0);if(e>0&&Math.round(o.scanLines/e)>=10)throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",e)}throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data")}throw new JpegError(`unexpected marker ${(g<<8|e).toString(16)}`)}}b=7;return g>>>7}function decodeHuffman(e){for(var t=e;;){switch(typeof(t=t[readBit()])){case"number":return t;case"object":continue}throw new JpegError("invalid huffman sequence")}}function receive(e){for(var t=0;e>0;){t=t<<1|readBit();e--}return t}function receiveAndExtend(e){if(1===e)return 1===readBit()?1:-1;var t=receive(e);return t>=1<0)y--;else for(var r=c,i=l;r<=i;){var o=decodeHuffman(t.huffmanTableAC),s=15&o,a=o>>4;if(0!==s){var f=e[r+=a];t.blockData[n+f]=receiveAndExtend(s)*(1<>4;if(0==(r=15&i))if(a<15){y=receive(a)+(1<>4;if(0!==a){var l=e[o+=c];t.blockData[n+l]=receiveAndExtend(a);o++}else{if(c<15)break;o+=16}}};var B,D,_,A,L=0;D=1===E?s[0].blocksPerLine*s[0].blocksPerColumn:u*o.mcusPerColumn;for(;L<=D;){var R=a?Math.min(D-L,a):D;if(R>0){for(T=0;T0?"unexpected":"excessive";(0,r.warn)(`decodeScan - ${e} MCU data, current marker is: ${B.invalid}`);n=B.offset}if(!(B.marker>=65488&&B.marker<=65495))break;n+=2}return n-m}function quantizeAndInverse(e,r,i){var h,d,u,p,m,g,b,y,v,x,w,C,T,I,S,P,k,E=e.quantizationTable,B=e.blockData;if(!E)throw new JpegError("missing required Quantization Table.");for(var D=0;D<64;D+=8){v=B[r+D];x=B[r+D+1];w=B[r+D+2];C=B[r+D+3];T=B[r+D+4];I=B[r+D+5];S=B[r+D+6];P=B[r+D+7];v*=E[D];if(0!=(x|w|C|T|I|S|P)){x*=E[D+1];w*=E[D+2];C*=E[D+3];T*=E[D+4];I*=E[D+5];S*=E[D+6];P*=E[D+7];d=(h=(h=l*v+128>>8)+(d=l*T+128>>8)+1>>1)-d;k=(u=w)*c+(p=S)*a+128>>8;u=u*a-p*c+128>>8;b=(m=(m=f*(x-P)+128>>8)+(b=I<<4)+1>>1)-b;g=(y=(y=f*(x+P)+128>>8)+(g=C<<4)+1>>1)-g;p=(h=h+(p=k)+1>>1)-p;u=(d=d+u+1>>1)-u;k=m*s+y*o+2048>>12;m=m*o-y*s+2048>>12;y=k;k=g*n+b*t+2048>>12;g=g*t-b*n+2048>>12;b=k;i[D]=h+y;i[D+7]=h-y;i[D+1]=d+b;i[D+6]=d-b;i[D+2]=u+g;i[D+5]=u-g;i[D+3]=p+m;i[D+4]=p-m}else{k=l*v+512>>10;i[D]=k;i[D+1]=k;i[D+2]=k;i[D+3]=k;i[D+4]=k;i[D+5]=k;i[D+6]=k;i[D+7]=k}}for(var _=0;_<8;++_){v=i[_];if(0!=((x=i[_+8])|(w=i[_+16])|(C=i[_+24])|(T=i[_+32])|(I=i[_+40])|(S=i[_+48])|(P=i[_+56]))){d=(h=4112+((h=l*v+2048>>12)+(d=l*T+2048>>12)+1>>1))-d;k=(u=w)*c+(p=S)*a+2048>>12;u=u*a-p*c+2048>>12;p=k;b=(m=(m=f*(x-P)+2048>>12)+(b=I)+1>>1)-b;g=(y=(y=f*(x+P)+2048>>12)+(g=C)+1>>1)-g;k=m*s+y*o+2048>>12;m=m*o-y*s+2048>>12;y=k;k=g*n+b*t+2048>>12;g=g*t-b*n+2048>>12;(v=(h=h+p+1>>1)+y)<16?v=0:v>=4080?v=255:v>>=4;(x=(d=d+u+1>>1)+(b=k))<16?x=0:x>=4080?x=255:x>>=4;(w=(u=d-u)+g)<16?w=0:w>=4080?w=255:w>>=4;(C=(p=h-p)+m)<16?C=0:C>=4080?C=255:C>>=4;(T=p-m)<16?T=0:T>=4080?T=255:T>>=4;(I=u-g)<16?I=0:I>=4080?I=255:I>>=4;(S=d-b)<16?S=0:S>=4080?S=255:S>>=4;(P=h-y)<16?P=0:P>=4080?P=255:P>>=4;B[r+_]=v;B[r+_+8]=x;B[r+_+16]=w;B[r+_+24]=C;B[r+_+32]=T;B[r+_+40]=I;B[r+_+48]=S;B[r+_+56]=P}else{k=(k=l*v+8192>>14)<-2040?0:k>=2024?255:k+2056>>4;B[r+_]=k;B[r+_+8]=k;B[r+_+16]=k;B[r+_+24]=k;B[r+_+32]=k;B[r+_+40]=k;B[r+_+48]=k;B[r+_+56]=k}}}function buildComponentData(e,t){for(var n=t.blocksPerLine,r=t.blocksPerColumn,i=new Int16Array(64),o=0;o=r)return null;var s=(0,i.readUint16)(e,t);if(s>=65472&&s<=65534)return{invalid:null,marker:s,offset:t};for(var a=(0,i.readUint16)(e,o);!(a>=65472&&a<=65534);){if(++o>=r)return null;a=(0,i.readUint16)(e,o)}return{invalid:s.toString(16),marker:a,offset:o}}JpegImage.prototype={parse(t,{dnlScanLines:n=null}={}){function readDataBlock(){const e=(0,i.readUint16)(t,a);let n=(a+=2)+e-2;var o=findNextFileMarker(t,n,a);if(o&&o.invalid){(0,r.warn)("readDataBlock - incorrect length, current marker is: "+o.invalid);n=o.offset}var s=t.subarray(a,n);a+=s.length;return s}function prepareComponents(e){for(var t=Math.ceil(e.samplesPerLine/8/e.maxH),n=Math.ceil(e.scanLines/8/e.maxV),r=0;r>4==0)for(g=0;g<64;g++)w[e[g]]=t[a++];else{if(x>>4!=1)throw new JpegError("DQT - invalid table spec");for(g=0;g<64;g++){w[e[g]]=(0,i.readUint16)(t,a);a+=2}}h[15&x]=w}break;case 65472:case 65473:case 65474:if(o)throw new JpegError("Only single frame JPEGs supported");a+=2;(o={}).extended=65473===p;o.progressive=65474===p;o.precision=t[a++];const z=(0,i.readUint16)(t,a);a+=2;o.scanLines=n||z;o.samplesPerLine=(0,i.readUint16)(t,a);a+=2;o.components=[];o.componentIds={};var C,T=t[a++],I=0,S=0;for(m=0;m>4,k=15&t[a+1];I>4==0?u:d)[15&B]=buildHuffmanTable(D,A)}break;case 65501:a+=2;s=(0,i.readUint16)(t,a);a+=2;break;case 65498:const j=1==++f&&!n;a+=2;var L,R=t[a++],O=[];for(m=0;m>4];L.huffmanTableAC=d[15&U];O.push(L)}var F=t[a++],N=t[a++],H=t[a++];try{var J=decodeScan(t,a,o,O,s,F,N,H>>4,15&H,j);a+=J}catch(e){if(e instanceof DNLMarkerError){(0,r.warn)(`${e.message} -- attempting to re-parse the JPEG image.`);return this.parse(t,{dnlScanLines:e.scanLines})}if(e instanceof EOIMarkerError){(0,r.warn)(`${e.message} -- ignoring the rest of the image data.`);break e}throw e}break;case 65500:a+=4;break;case 65535:255!==t[a]&&a--;break;default:const Y=findNextFileMarker(t,a-2,a-3);if(Y&&Y.invalid){(0,r.warn)("JpegImage.parse - unexpected data, current marker is: "+Y.invalid);a=Y.offset;break}if(!Y||a>=t.length-1){(0,r.warn)("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break e}throw new JpegError("JpegImage.parse - unknown marker: "+p.toString(16))}p=(0,i.readUint16)(t,a);a+=2}this.width=o.samplesPerLine;this.height=o.scanLines;this.jfif=c;this.adobe=l;this.components=[];for(m=0;m>8)+T[h+1];return v},get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform},_convertYccToRgb:function convertYccToRgb(e){for(var t,n,r,i=0,o=e.length;i4)throw new JpegError("Unsupported color mode");var i=this._getLinearizedBlockData(e,t,r);if(1===this.numComponents&&n){for(var o=i.length,s=new Uint8ClampedArray(3*o),a=0,c=0;c{Object.defineProperty(t,"__esModule",{value:!0});t.JpxImage=void 0;var r=n(1),i=n(5),o=n(7);class JpxError extends r.BaseException{constructor(e){super(`JPX error: ${e}`)}}var s=function JpxImageClosure(){var e={LL:0,LH:1,HL:1,HH:2};function JpxImage(){this.failOnCorruptedImage=!1}JpxImage.prototype={parse:function JpxImage_parse(e){if(65359!==(0,i.readUint16)(e,0))for(var t=0,n=e.length;t>24&255,a>>16&255,a>>8&255,255&a);(0,r.warn)("Unsupported header type "+a+" ("+d+")")}l&&(t+=c)}else this.parseCodestream(e,0,e.length)},parseImageProperties:function JpxImage_parseImageProperties(e){for(var t=e.getByte();t>=0;){if(65361===(t<<8|(t=e.getByte()))){e.skip(4);var n=e.getInt32()>>>0,r=e.getInt32()>>>0,i=e.getInt32()>>>0,o=e.getInt32()>>>0;e.skip(16);var s=e.getUint16();this.width=n-i;this.height=r-o;this.componentsCount=s;this.bitsPerComponent=8;return}}throw new JpxError("No size marker found in JPX stream")},parseCodestream:function JpxImage_parseCodestream(e,t,n){var o={},s=!1;try{for(var a=t;a+1>5;h=[];for(;l>3;C.mu=0}else{C.epsilon=e[l]>>3;C.mu=(7&e[l])<<8|e[l+1];l+=2}h.push(C)}w.SPqcds=h;if(o.mainHeader)o.QCD=w;else{o.currentTile.QCD=w;o.currentTile.QCC=[]}break;case 65373:m=(0,i.readUint16)(e,a);var T,I={};l=a+2;if(o.SIZ.Csiz<257)T=e[l++];else{T=(0,i.readUint16)(e,l);l+=2}switch(31&(f=e[l++])){case 0:d=8;u=!0;break;case 1:d=16;u=!1;break;case 2:d=16;u=!0;break;default:throw new Error("Invalid SQcd value "+f)}I.noQuantization=8===d;I.scalarExpounded=u;I.guardBits=f>>5;h=[];for(;l>3;C.mu=0}else{C.epsilon=e[l]>>3;C.mu=(7&e[l])<<8|e[l+1];l+=2}h.push(C)}I.SPqcds=h;o.mainHeader?o.QCC[T]=I:o.currentTile.QCC[T]=I;break;case 65362:m=(0,i.readUint16)(e,a);var S={};l=a+2;var P=e[l++];S.entropyCoderWithCustomPrecincts=!!(1&P);S.sopMarkerUsed=!!(2&P);S.ephMarkerUsed=!!(4&P);S.progressionOrder=e[l++];S.layersCount=(0,i.readUint16)(e,l);l+=2;S.multipleComponentTransform=e[l++];S.decompositionLevelsCount=e[l++];S.xcb=2+(15&e[l++]);S.ycb=2+(15&e[l++]);var k=e[l++];S.selectiveArithmeticCodingBypass=!!(1&k);S.resetContextProbabilities=!!(2&k);S.terminationOnEachCodingPass=!!(4&k);S.verticallyStripe=!!(8&k);S.predictableTermination=!!(16&k);S.segmentationSymbolUsed=!!(32&k);S.reversibleTransformation=e[l++];if(S.entropyCoderWithCustomPrecincts){for(var E=[];l>4})}S.precinctsSizes=E}var D=[];S.selectiveArithmeticCodingBypass&&D.push("selectiveArithmeticCodingBypass");S.resetContextProbabilities&&D.push("resetContextProbabilities");S.terminationOnEachCodingPass&&D.push("terminationOnEachCodingPass");S.verticallyStripe&&D.push("verticallyStripe");S.predictableTermination&&D.push("predictableTermination");if(D.length>0){s=!0;(0,r.warn)(`JPX: Unsupported COD options (${D.join(", ")}).`)}if(o.mainHeader)o.COD=S;else{o.currentTile.COD=S;o.currentTile.COC=[]}break;case 65424:m=(0,i.readUint16)(e,a);(p={}).index=(0,i.readUint16)(e,a+2);p.length=(0,i.readUint32)(e,a+4);p.dataEnd=p.length+a-2;p.partIndex=e[a+8];p.partsCount=e[a+9];o.mainHeader=!1;if(0===p.partIndex){p.COD=o.COD;p.COC=o.COC.slice(0);p.QCD=o.QCD;p.QCC=o.QCC.slice(0)}o.currentTile=p;break;case 65427:if(0===(p=o.currentTile).partIndex){initializeTile(o,p.index);buildPackets(o)}parseTilePackets(o,e,a,m=p.dataEnd-a);break;case 65363:(0,r.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");case 65365:case 65367:case 65368:case 65380:m=(0,i.readUint16)(e,a);break;default:throw new Error("Unknown codestream code: "+c.toString(16))}a+=m}}catch(e){if(s||this.failOnCorruptedImage)throw new JpxError(e.message);(0,r.warn)(`JPX: Trying to recover from: "${e.message}".`)}this.tiles=function transformComponents(e){for(var t=e.SIZ,n=e.components,r=t.Csiz,i=[],o=0,s=e.tiles.length;o>2);y[x++]=e+g>>f;y[x++]=e>>f;y[x++]=e+m>>f}else for(d=0;d>f;y[x++]=p-.34413*m-.71414*g>>f;y[x++]=p+1.772*m>>f}if(w)for(d=0,x=3;d>f}else for(a=0;a>f;x+=r}}i.push(v)}return i}(o);this.width=o.SIZ.Xsiz-o.SIZ.XOsiz;this.height=o.SIZ.Ysiz-o.SIZ.YOsiz;this.componentsCount=o.SIZ.Csiz}};function calculateComponentDimensions(e,t){e.x0=Math.ceil(t.XOsiz/e.XRsiz);e.x1=Math.ceil(t.Xsiz/e.XRsiz);e.y0=Math.ceil(t.YOsiz/e.YRsiz);e.y1=Math.ceil(t.Ysiz/e.YRsiz);e.width=e.x1-e.x0;e.height=e.y1-e.y0}function calculateTileGrids(e,t){for(var n,r=e.SIZ,i=[],o=Math.ceil((r.Xsiz-r.XTOsiz)/r.XTsiz),s=Math.ceil((r.Ysiz-r.YTOsiz)/r.YTsiz),a=0;a0?Math.min(r.xcb,i.PPx-1):Math.min(r.xcb,i.PPx);i.ycb_=n>0?Math.min(r.ycb,i.PPy-1):Math.min(r.ycb,i.PPy);return i}function buildPrecincts(e,t,n){var r=1<t.trx0?Math.ceil(t.trx1/r)-Math.floor(t.trx0/r):0,l=t.try1>t.try0?Math.ceil(t.try1/i)-Math.floor(t.try0/i):0,f=c*l;t.precinctParameters={precinctWidth:r,precinctHeight:i,numprecinctswide:c,numprecinctshigh:l,numprecincts:f,precinctWidthInSubband:s,precinctHeightInSubband:a}}function buildCodeblocks(e,t,n){var r,i,o,s,a=n.xcb_,c=n.ycb_,l=1<>a,d=t.tby0>>c,u=t.tbx1+l-1>>a,p=t.tby1+f-1>>c,m=t.resolution.precinctParameters,g=[],b=[];for(i=d;iy.cbxMax&&(y.cbxMax=r);iy.cbyMax&&(y.cbyMax=i)}else b[s]=y={cbxMin:r,cbyMin:i,cbxMax:r,cbyMax:i};o.precinct=y}}t.codeblockParameters={codeblockWidth:a,codeblockHeight:c,numcodeblockwide:u-h+1,numcodeblockhigh:p-d+1};t.codeblocks=g;t.precincts=b}function createPacket(e,t,n){for(var r=[],i=e.subbands,o=0,s=i.length;oe.codingStyleParameters.decompositionLevelsCount)){for(var t=e.resolutions[l],n=t.precinctParameters.numprecincts;he.codingStyleParameters.decompositionLevelsCount)){for(var t=e.resolutions[c],n=t.precinctParameters.numprecincts;hl.codingStyleParameters.decompositionLevelsCount)){var e=l.resolutions[n],o=e.precinctParameters.numprecincts;if(!(i>=o)){for(;t=0;--g){var b=c.resolutions[g],y=m*b.precinctParameters.precinctWidth,v=m*b.precinctParameters.precinctHeight;h=Math.min(h,y);d=Math.min(d,v);u=Math.max(u,b.precinctParameters.numprecinctswide);p=Math.max(p,b.precinctParameters.numprecinctshigh);f[g]={width:y,height:v};m<<=1}n=Math.min(n,h);r=Math.min(r,d);i=Math.max(i,u);o=Math.max(o,p);s[a]={resolutions:f,minWidth:h,minHeight:d,maxNumWide:u,maxNumHigh:p}}return{components:s,minWidth:n,minHeight:r,maxNumWide:i,maxNumHigh:o}}function buildPackets(e){for(var t=e.SIZ,n=e.currentTile.index,r=e.tiles[n],i=t.Csiz,o=0;o>>(l-=e)&(1<0;){var R=v.shift();void 0===(b=R.codeblock).data&&(b.data=[]);b.data.push({data:r,start:o+c,end:o+c+R.dataLength,codingpasses:R.codingpasses});c+=R.dataLength}}}return c}function copyCoefficients(e,t,n,r,i,a,c,l){for(var f=r.tbx0,h=r.tby0,d=r.tbx1-r.tbx0,u=r.codeblocks,p="H"===r.type.charAt(0)?1:0,m="H"===r.type.charAt(1)?t:0,g=0,b=u.length;g=a?R:R*(1<0?1-v:0)}var E=x.subbands[I],B=e[E.type];copyCoefficients(T,w,0,E,m?1:2**(p+B-k)*(1+P/2048),d+k-1,m,u)}b.push({width:w,height:C,items:T})}var D=g.calculate(b,i.tcx0,i.tcy0);return{left:i.tcx0,top:i.tcy0,width:D.width,height:D.height,items:D.items}}function initializeTile(e,t){for(var n=e.SIZ.Csiz,r=e.tiles[t],i=0;i>=1;t>>=1;r++}r--;(n=this.levels[r]).items[n.index]=i;this.currentLevel=r;delete this.value},incrementValue:function TagTree_incrementValue(){var e=this.levels[this.currentLevel];e.items[e.index]++},nextLevel:function TagTree_nextLevel(){var e=this.currentLevel,t=this.levels[e],n=t.items[t.index];if(--e<0){this.value=n;return!1}this.currentLevel=e;(t=this.levels[e]).items[t.index]=n;return!0}};return TagTree}(),n=function InclusionTreeClosure(){function InclusionTree(e,t,n){var r=(0,i.log2)(Math.max(e,t))+1;this.levels=[];for(var o=0;on){this.currentLevel=r;this.propagateValues();return!1}e>>=1;t>>=1;r++}this.currentLevel=r-1;return!0},incrementValue:function InclusionTree_incrementValue(e){var t=this.levels[this.currentLevel];t.items[t.index]=e+1;this.propagateValues()},propagateValues:function InclusionTree_propagateValues(){for(var e=this.currentLevel,t=this.levels[e],n=t.items[t.index];--e>=0;)(t=this.levels[e]).items[t.index]=n},nextLevel:function InclusionTree_nextLevel(){var e=this.currentLevel,t=this.levels[e],n=t.items[t.index];t.items[t.index]=255;if(--e<0)return!1;this.currentLevel=e;(t=this.levels[e]).items[t.index]=n;return!0}};return InclusionTree}(),s=function BitModelClosure(){var e=17,t=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),n=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),r=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);function BitModel(e,i,o,s,a){this.width=e;this.height=i;let c;c="HH"===o?r:"HL"===o?n:t;this.contextLabelTable=c;var l=e*i;this.neighborsSignificance=new Uint8Array(l);this.coefficentsSign=new Uint8Array(l);let f;f=a>14?new Uint32Array(l):a>6?new Uint16Array(l):new Uint8Array(l);this.coefficentsMagnitude=f;this.processingFlags=new Uint8Array(l);var h=new Uint8Array(l);if(0!==s)for(var d=0;d0,c=t+10){r=n-o;a&&(i[r-1]+=16);c&&(i[r+1]+=16);i[r]+=4}if(e+1=n)break;s[d]&=-2;if(!r[d]&&o[d]){var m=c[o[d]];if(e.readBit(a,m)){var g=this.decodeSignBit(p,h,d);i[d]=g;r[d]=1;this.setNeighborsSignificance(p,h,d);s[d]|=2}l[d]++;s[d]|=1}}},decodeSignBit:function BitModel_decodeSignBit(e,t,n){var r,i,o,s,a,c,l=this.width,f=this.height,h=this.coefficentsMagnitude,d=this.coefficentsSign;s=t>0&&0!==h[n-1];if(t+10&&0!==h[n-l];if(e+1=0){a=9+r;c=this.decoder.readBit(this.contexts,a)}else{a=9-r;c=1^this.decoder.readBit(this.contexts,a)}return c},runMagnitudeRefinementPass:function BitModel_runMagnitudeRefinementPass(){for(var e,t=this.decoder,n=this.width,r=this.height,i=this.coefficentsMagnitude,o=this.neighborsSignificance,s=this.contexts,a=this.bitsDecoded,c=this.processingFlags,l=n*r,f=4*n,h=0;h>1,c=-1.586134342059924,l=-.052980118572961,f=.882911075530934,h=.443506852043971,d=1.230174104914001;r=(t|=0)-3;for(i=a+4;i--;r+=2)e[r]*=.8128930661159609;o=h*e[(r=t-2)-1];for(i=a+3;i--;r+=2){s=h*e[r+1];e[r]=d*e[r]-o-s;if(!i--)break;o=h*e[(r+=2)+1];e[r]=d*e[r]-o-s}o=f*e[(r=t-1)-1];for(i=a+2;i--;r+=2){s=f*e[r+1];e[r]-=o+s;if(!i--)break;o=f*e[(r+=2)+1];e[r]-=o+s}o=l*e[(r=t)-1];for(i=a+1;i--;r+=2){s=l*e[r+1];e[r]-=o+s;if(!i--)break;o=l*e[(r+=2)+1];e[r]-=o+s}if(0!==a){o=c*e[(r=t+1)-1];for(i=a;i--;r+=2){s=c*e[r+1];e[r]-=o+s;if(!i--)break;o=c*e[(r+=2)+1];e[r]-=o+s}}};return IrreversibleTransform}(),l=function ReversibleTransformClosure(){function ReversibleTransform(){a.call(this)}ReversibleTransform.prototype=Object.create(a.prototype);ReversibleTransform.prototype.filter=function reversibleTransformFilter(e,t,n){var r,i,o=n>>1;for(r=t|=0,i=o+1;i--;r+=2)e[r]-=e[r-1]+e[r+1]+2>>2;for(r=t+1,i=o;i--;r+=2)e[r]+=e[r-1]+e[r+1]>>1};return ReversibleTransform}();return JpxImage}();t.JpxImage=s}],t={};return function __w_pdfjs_require__(n){if(t[n])return t[n].exports;var r=t[n]={exports:{}};e[n](r,r.exports,__w_pdfjs_require__);return r.exports}(0)})()}));