@namahapdf/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import {a,e,f,d,c}from'./chunk-X7U5LSSK.js';var Vt=a((Ht,Xt)=>{(function(Mt,_t){typeof Ht=="object"&&typeof Xt=="object"?Xt.exports=Mt.pdfjsImageDecoders=_t():typeof define=="function"&&define.amd?define("pdfjs-dist/image_decoders/pdf.image_decoders",[],(()=>Mt.pdfjsImageDecoders=_t())):typeof Ht=="object"?Ht["pdfjs-dist/image_decoders/pdf.image_decoders"]=Mt.pdfjsImageDecoders=_t():Mt["pdfjs-dist/image_decoders/pdf.image_decoders"]=Mt.pdfjsImageDecoders=_t();})(globalThis,(()=>(()=>{var jt=[,(It,w)=>{var C,E;Object.defineProperty(w,"__esModule",{value:true}),w.VerbosityLevel=w.Util=w.UnknownErrorException=w.UnexpectedResponseException=w.TextRenderingMode=w.RenderingIntentFlag=w.PromiseCapability=w.PermissionFlag=w.PasswordResponses=w.PasswordException=w.PageActionEventType=w.OPS=w.MissingPDFException=w.MAX_IMAGE_SIZE_TO_CACHE=w.LINE_FACTOR=w.LINE_DESCENT_FACTOR=w.InvalidPDFException=w.ImageKind=w.IDENTITY_MATRIX=w.FormatError=w.FeatureTest=w.FONT_IDENTITY_MATRIX=w.DocumentActionEventType=w.CMapCompressionType=w.BaseException=w.BASELINE_FACTOR=w.AnnotationType=w.AnnotationReplyType=w.AnnotationPrefix=w.AnnotationMode=w.AnnotationFlag=w.AnnotationFieldFlag=w.AnnotationEditorType=w.AnnotationEditorPrefix=w.AnnotationEditorParamsType=w.AnnotationBorderStyleType=w.AnnotationActionEventType=w.AbortException=void 0,w.assert=function(n,a){n||K(a);},w.bytesToString=pt,w.createValidAbsoluteUrl=function(n,a=null,T=null){if(!n)return null;try{if(T&&typeof n=="string"){if(T.addDefaultProtocol&&n.startsWith("www.")){let ct=n.match(/\./g);(ct==null?void 0:ct.length)>=2&&(n=`http://${n}`);}if(T.tryConvertEncoding)try{n=H(n);}catch{}}let J=a?new URL(n,a):new URL(n);if((function(it){switch(it==null?void 0:it.protocol){case "http:":case "https:":case "ftp:":case "mailto:":case "tel:":return !0;default:return !1}})(J))return J}catch{}return null},w.getModificationDate=function(n=new Date){return [n.getUTCFullYear().toString(),(n.getUTCMonth()+1).toString().padStart(2,"0"),n.getUTCDate().toString().padStart(2,"0"),n.getUTCHours().toString().padStart(2,"0"),n.getUTCMinutes().toString().padStart(2,"0"),n.getUTCSeconds().toString().padStart(2,"0")].join("")},w.getUuid=function(){if(typeof crypto!="undefined"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();let n=new Uint8Array(32);if(typeof crypto!="undefined"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(n);else for(let a=0;a<32;a++)n[a]=Math.floor(255*Math.random());return pt(n)},w.getVerbosityLevel=function(){return D},w.info=function(n){D>=Z.INFOS&&console.log(`Info: ${n}`);},w.isArrayBuffer=function(n){return typeof n=="object"&&(n==null?void 0:n.byteLength)!==void 0},w.isArrayEqual=function(n,a){if(n.length!==a.length)return false;for(let T=0,J=n.length;T<J;T++)if(n[T]!==a[T])return false;return true},w.isNodeJS=void 0,w.normalizeUnicode=function(n){return j||(j=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,A=new Map([["\uFB05","\u017Ft"]])),n.replaceAll(j,((a,T,J)=>T?T.normalize("NFKC"):A.get(J)))},w.objectFromMap=function(n){let a=Object.create(null);for(let[T,J]of n)a[T]=J;return a},w.objectSize=function(n){return Object.keys(n).length},w.setVerbosityLevel=function(n){Number.isInteger(n)&&(D=n);},w.shadow=$,w.string32=function(n){return String.fromCharCode(n>>24&255,n>>16&255,n>>8&255,255&n)},w.stringToBytes=ft,w.stringToPDFString=function(n){if(n[0]>="\xEF"){let T;if(n[0]==="\xFE"&&n[1]==="\xFF"?T="utf-16be":n[0]==="\xFF"&&n[1]==="\xFE"?T="utf-16le":n[0]==="\xEF"&&n[1]==="\xBB"&&n[2]==="\xBF"&&(T="utf-8"),T)try{let J=new TextDecoder(T,{fatal:!0}),ct=ft(n);return J.decode(ct)}catch(J){at(`stringToPDFString: "${J}".`);}}let a=[];for(let T=0,J=n.length;T<J;T++){let ct=B[n.charCodeAt(T)];a.push(ct?String.fromCharCode(ct):n.charAt(T));}return a.join("")},w.stringToUTF8String=H,w.unreachable=K,w.utf8StringToString=function(n){return unescape(encodeURIComponent(n))},w.warn=at;let gt=!(typeof process!="object"||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type!=="browser");w.isNodeJS=gt,w.IDENTITY_MATRIX=[1,0,0,1,0,0],w.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],w.MAX_IMAGE_SIZE_TO_CACHE=1e7,w.LINE_FACTOR=1.35,w.LINE_DESCENT_FACTOR=.35,w.BASELINE_FACTOR=.25925925925925924,w.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},w.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},w.AnnotationEditorPrefix="pdfjs_internal_editor_",w.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15},w.AnnotationEditorParamsType={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23},w.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},w.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},w.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},w.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},w.AnnotationReplyType={GROUP:"Group",REPLY:"R"},w.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},w.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},w.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},w.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"},w.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},w.PageActionEventType={O:"PageOpen",C:"PageClose"};let Z={ERRORS:0,WARNINGS:1,INFOS:5};w.VerbosityLevel=Z,w.CMapCompressionType={NONE:0,BINARY:1},w.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,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},w.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let D=Z.WARNINGS;function at(f){D>=Z.WARNINGS&&console.log(`Warning: ${f}`);}function K(f){throw new Error(f)}function $(f,n,a,T=false){return Object.defineProperty(f,n,{value:a,enumerable:!T,configurable:true,writable:false}),a}let st=(function(){function n(a,T){this.constructor===n&&K("Cannot initialize BaseException."),this.message=a,this.name=T;}return n.prototype=new Error,n.constructor=n,n})();w.BaseException=st,w.PasswordException=class extends st{constructor(n,a){super(n,"PasswordException"),this.code=a;}},w.UnknownErrorException=class extends st{constructor(n,a){super(n,"UnknownErrorException"),this.details=a;}},w.InvalidPDFException=class extends st{constructor(n){super(n,"InvalidPDFException");}},w.MissingPDFException=class extends st{constructor(n){super(n,"MissingPDFException");}},w.UnexpectedResponseException=class extends st{constructor(n,a){super(n,"UnexpectedResponseException"),this.status=a;}},w.FormatError=class extends st{constructor(n){super(n,"FormatError");}},w.AbortException=class extends st{constructor(n){super(n,"AbortException");}};function pt(f){typeof f=="object"&&(f==null?void 0:f.length)!==void 0||K("Invalid argument for bytesToString");let n=f.length,a=8192;if(n<a)return String.fromCharCode.apply(null,f);let T=[];for(let J=0;J<n;J+=a){let ct=Math.min(J+a,n),it=f.subarray(J,ct);T.push(String.fromCharCode.apply(null,it));}return T.join("")}function ft(f){typeof f!="string"&&K("Invalid argument for stringToBytes");let n=f.length,a=new Uint8Array(n);for(let T=0;T<n;++T)a[T]=255&f.charCodeAt(T);return a}w.FeatureTest=class{static get isLittleEndian(){return $(this,"isLittleEndian",(function(){let a=new Uint8Array(4);return a[0]=1,new Uint32Array(a.buffer,0,1)[0]===1})())}static get isEvalSupported(){return $(this,"isEvalSupported",(function(){try{return new Function(""),!0}catch{return false}})())}static get isOffscreenCanvasSupported(){return $(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas!="undefined")}static get platform(){return typeof navigator=="undefined"?$(this,"platform",{isWin:false,isMac:false}):$(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){var n,a;return $(this,"isCSSRoundSupported",(a=(n=globalThis.CSS)==null?void 0:n.supports)==null?void 0:a.call(n,"width: round(1.5px, 1px)"))}};let lt=[...Array(256).keys()].map((f=>f.toString(16).padStart(2,"0")));w.Util=class{static makeHexColor(n,a,T){return `#${lt[n]}${lt[a]}${lt[T]}`}static scaleMinMax(n,a){let T;n[0]?(n[0]<0&&(T=a[0],a[0]=a[1],a[1]=T),a[0]*=n[0],a[1]*=n[0],n[3]<0&&(T=a[2],a[2]=a[3],a[3]=T),a[2]*=n[3],a[3]*=n[3]):(T=a[0],a[0]=a[2],a[2]=T,T=a[1],a[1]=a[3],a[3]=T,n[1]<0&&(T=a[2],a[2]=a[3],a[3]=T),a[2]*=n[1],a[3]*=n[1],n[2]<0&&(T=a[0],a[0]=a[1],a[1]=T),a[0]*=n[2],a[1]*=n[2]),a[0]+=n[4],a[1]+=n[4],a[2]+=n[5],a[3]+=n[5];}static transform(n,a){return [n[0]*a[0]+n[2]*a[1],n[1]*a[0]+n[3]*a[1],n[0]*a[2]+n[2]*a[3],n[1]*a[2]+n[3]*a[3],n[0]*a[4]+n[2]*a[5]+n[4],n[1]*a[4]+n[3]*a[5]+n[5]]}static applyTransform(n,a){return [n[0]*a[0]+n[1]*a[2]+a[4],n[0]*a[1]+n[1]*a[3]+a[5]]}static applyInverseTransform(n,a){let T=a[0]*a[3]-a[1]*a[2];return [(n[0]*a[3]-n[1]*a[2]+a[2]*a[5]-a[4]*a[3])/T,(-n[0]*a[1]+n[1]*a[0]+a[4]*a[1]-a[5]*a[0])/T]}static getAxialAlignedBoundingBox(n,a){let T=this.applyTransform(n,a),J=this.applyTransform(n.slice(2,4),a),ct=this.applyTransform([n[0],n[3]],a),it=this.applyTransform([n[2],n[1]],a);return [Math.min(T[0],J[0],ct[0],it[0]),Math.min(T[1],J[1],ct[1],it[1]),Math.max(T[0],J[0],ct[0],it[0]),Math.max(T[1],J[1],ct[1],it[1])]}static inverseTransform(n){let a=n[0]*n[3]-n[1]*n[2];return [n[3]/a,-n[1]/a,-n[2]/a,n[0]/a,(n[2]*n[5]-n[4]*n[3])/a,(n[4]*n[1]-n[5]*n[0])/a]}static singularValueDecompose2dScale(n){let a=[n[0],n[2],n[1],n[3]],T=n[0]*a[0]+n[1]*a[2],J=n[0]*a[1]+n[1]*a[3],ct=n[2]*a[0]+n[3]*a[2],it=n[2]*a[1]+n[3]*a[3],x=(T+it)/2,v=Math.sqrt((T+it)**2-4*(T*it-ct*J))/2,V=x+v||1,_=x-v||1;return [Math.sqrt(V),Math.sqrt(_)]}static normalizeRect(n){let a=n.slice(0);return n[0]>n[2]&&(a[0]=n[2],a[2]=n[0]),n[1]>n[3]&&(a[1]=n[3],a[3]=n[1]),a}static intersect(n,a){let T=Math.max(Math.min(n[0],n[2]),Math.min(a[0],a[2])),J=Math.min(Math.max(n[0],n[2]),Math.max(a[0],a[2]));if(T>J)return null;let ct=Math.max(Math.min(n[1],n[3]),Math.min(a[1],a[3])),it=Math.min(Math.max(n[1],n[3]),Math.max(a[1],a[3]));return ct>it?null:[T,ct,J,it]}static bezierBoundingBox(n,a,T,J,ct,it,x,v){let V=[],_=[[],[]],I,F,S,q,M,s,g,b;for(let i=0;i<2;++i)if(i===0?(F=6*n-12*T+6*ct,I=-3*n+9*T-9*ct+3*x,S=3*T-3*n):(F=6*a-12*J+6*it,I=-3*a+9*J-9*it+3*v,S=3*J-3*a),Math.abs(I)<1e-12){if(Math.abs(F)<1e-12)continue;q=-S/F,0<q&&q<1&&V.push(q);}else g=F*F-4*S*I,b=Math.sqrt(g),g<0||(M=(-F+b)/(2*I),0<M&&M<1&&V.push(M),s=(-F-b)/(2*I),0<s&&s<1&&V.push(s));let c,r=V.length,t=r;for(;r--;)q=V[r],c=1-q,_[0][r]=c*c*c*n+3*c*c*q*T+3*c*q*q*ct+q*q*q*x,_[1][r]=c*c*c*a+3*c*c*q*J+3*c*q*q*it+q*q*q*v;return _[0][t]=n,_[1][t]=a,_[0][t+1]=x,_[1][t+1]=v,_[0].length=_[1].length=t+2,[Math.min(..._[0]),Math.min(..._[1]),Math.max(..._[0]),Math.max(..._[1])]}};let B=[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 H(f){return decodeURIComponent(escape(f))}w.PromiseCapability=(E=class{constructor(){e(this,C,false);this.promise=new Promise(((n,a)=>{this.resolve=T=>{f(this,C,true),n(T);},this.reject=T=>{f(this,C,true),a(T);};}));}get settled(){return d(this,C)}},C=new WeakMap,E);let j=null,A=null;w.AnnotationPrefix="pdfjs_internal_id_";},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.Jbig2Image=void 0;var Z=gt(1),D=gt(3),at=gt(6),K=gt(7);class $ extends Z.BaseException{constructor(t){super(`JBIG2 error: ${t}`,"Jbig2Error");}}class st{getContexts(t){return t in this?this[t]:this[t]=new Int8Array(65536)}}class pt{constructor(t,i,e){this.data=t,this.start=i,this.end=e;}get decoder(){let t=new at.ArithmeticDecoder(this.data,this.start,this.end);return (0, Z.shadow)(this,"decoder",t)}get contextCache(){let t=new st;return (0, Z.shadow)(this,"contextCache",t)}}let ft=2**31-1,lt=-2147483648;function B(r,t,i){let e=r.getContexts(t),o=1;function d(h){let m=0;for(let P=0;P<h;P++){let O=i.readBit(e,o);o=o<256?o<<1|O:511&(o<<1|O)|256,m=m<<1|O;}return m>>>0}let u=d(1),p=d(1)?d(1)?d(1)?d(1)?d(1)?d(32)+4436:d(12)+340:d(8)+84:d(6)+20:d(4)+4:d(2),l;return u===0?l=p:p>0&&(l=-p),l>=lt&&l<=ft?l:null}function H(r,t,i){let e=r.getContexts("IAID"),o=1;for(let d=0;d<i;d++)o=o<<1|t.readBit(e,o);return i<31?o&(1<<i)-1:2147483647&o}let j=["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"],A=[[{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}]],C=[{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}]}],E=[39717,1941,229,405];function n(r,t,i,e,o,d,u,p){if(r)return c(new s(p.data,p.start,p.end),t,i,false);if(e===0&&true&&!o&&u.length===4&&u[0].x===3&&u[0].y===-1&&u[1].x===-3&&u[1].y===-1&&u[2].x===2&&u[2].y===-2&&u[3].x===-2&&u[3].y===-2)return (function(xt,vt,At){let Lt=At.decoder,Et=At.contextCache.getContexts("GB"),Pt=[],Ot,Rt,kt,Bt,Nt,Dt,Ut;for(Rt=0;Rt<vt;Rt++)for(Nt=Pt[Rt]=new Uint8Array(xt),Dt=Rt<1?Nt:Pt[Rt-1],Ut=Rt<2?Nt:Pt[Rt-2],Ot=Ut[0]<<13|Ut[1]<<12|Ut[2]<<11|Dt[0]<<7|Dt[1]<<6|Dt[2]<<5|Dt[3]<<4,kt=0;kt<xt;kt++)Nt[kt]=Bt=Lt.readBit(Et,Ot),Ot=(31735&Ot)<<1|(kt+3<xt?Ut[kt+3]<<11:0)|(kt+4<xt?Dt[kt+4]<<4:0)|Bt;return Pt})(t,i,p);let h=A[e].concat(u);h.sort((function(Tt,xt){return Tt.y-xt.y||Tt.x-xt.x}));let m=h.length,P=new Int8Array(m),O=new Int8Array(m),y=[],k,R,L=0,U=0,z=0,G=0;for(R=0;R<m;R++)P[R]=h[R].x,O[R]=h[R].y,U=Math.min(U,h[R].x),z=Math.max(z,h[R].x),G=Math.min(G,h[R].y),R<m-1&&h[R].y===h[R+1].y&&h[R].x===h[R+1].x-1?L|=1<<m-1-R:y.push(R);let N=y.length,Y=new Int8Array(N),Q=new Int8Array(N),X=new Uint16Array(N);for(k=0;k<N;k++)R=y[k],Y[k]=h[R].x,Q[k]=h[R].y,X[k]=1<<m-1-R;let W=-U,ot=-G,et=t-z,nt=E[e],tt=new Uint8Array(t),rt=[],ut=p.decoder,ht=p.contextCache.getContexts("GB"),dt,yt,wt,Ct,bt,St=0,mt=0;for(let Tt=0;Tt<i;Tt++){if(o&&(St^=ut.readBit(ht,nt),St)){rt.push(tt);continue}for(tt=new Uint8Array(tt),rt.push(tt),dt=0;dt<t;dt++){if(dt>=W&&dt<et&&Tt>=ot)for(mt=mt<<1&L,R=0;R<N;R++)yt=Tt+Q[R],wt=dt+Y[R],Ct=rt[yt][wt],Ct&&(Ct=X[R],mt|=Ct);else for(mt=0,bt=m-1,R=0;R<m;R++,bt--)wt=dt+P[R],wt>=0&&wt<t&&(yt=Tt+O[R],yt>=0&&(Ct=rt[yt][wt],Ct&&(mt|=Ct<<bt)));let xt=ut.readBit(ht,mt);tt[dt]=xt;}}return rt}function a(r,t,i,e,o,d,u,p,l){let h=C[i].coding;i===0&&(h=h.concat([p[0]]));let m=h.length,P=new Int32Array(m),O=new Int32Array(m),y;for(y=0;y<m;y++)P[y]=h[y].x,O[y]=h[y].y;let k=C[i].reference;i===0&&(k=k.concat([p[1]]));let R=k.length,L=new Int32Array(R),U=new Int32Array(R);for(y=0;y<R;y++)L[y]=k[y].x,U[y]=k[y].y;let z=e[0].length,G=e.length,Y=[],Q=l.decoder,X=l.contextCache.getContexts("GR");for(let ot=0;ot<t;ot++){let et=new Uint8Array(r);Y.push(et);for(let nt=0;nt<r;nt++){let tt,rt,ut=0;for(y=0;y<m;y++)tt=ot+O[y],rt=nt+P[y],tt<0||rt<0||rt>=r?ut<<=1:ut=ut<<1|Y[tt][rt];for(y=0;y<R;y++)tt=ot+U[y]-d,rt=nt+L[y]-o,tt<0||tt>=G||rt<0||rt>=z?ut<<=1:ut=ut<<1|e[tt][rt];let ht=Q.readBit(X,ut);et[nt]=ht;}}return Y}function T(r,t,i,e,o,d,u,p,l,h,m,P,O,y,k,R,L,U,z){if(r&&t)throw new $("refinement with Huffman is not supported");let G=[],N,Y;for(N=0;N<e;N++){if(Y=new Uint8Array(i),o)for(let et=0;et<i;et++)Y[et]=o;G.push(Y);}let Q=L.decoder,X=L.contextCache,W=r?-y.tableDeltaT.decode(z):-B(X,"IADT",Q),ot=0;for(N=0;N<d;){W+=r?y.tableDeltaT.decode(z):B(X,"IADT",Q),ot+=r?y.tableFirstS.decode(z):B(X,"IAFS",Q);let et=ot;for(;;){let nt=0;u>1&&(nt=r?z.readBits(U):B(X,"IAIT",Q));let tt=u*W+nt,rt=r?y.symbolIDTable.decode(z):H(X,Q,l),ut=t&&(r?z.readBit():B(X,"IARI",Q)),ht=p[rt],dt=ht[0].length,yt=ht.length;if(ut){let xt=B(X,"IARDW",Q),vt=B(X,"IARDH",Q);dt+=xt,yt+=vt,ht=a(dt,yt,k,ht,(xt>>1)+B(X,"IARDX",Q),(vt>>1)+B(X,"IARDY",Q),false,R,L);}let wt=tt-(1&P?0:yt-1),Ct=et-(2&P?dt-1:0),bt,St,mt;if(h){for(bt=0;bt<yt;bt++){if(Y=G[Ct+bt],!Y)continue;mt=ht[bt];let xt=Math.min(i-wt,dt);switch(O){case 0:for(St=0;St<xt;St++)Y[wt+St]|=mt[St];break;case 2:for(St=0;St<xt;St++)Y[wt+St]^=mt[St];break;default:throw new $(`operator ${O} is not supported`)}}et+=yt-1;}else {for(St=0;St<yt;St++)if(Y=G[wt+St],Y)switch(mt=ht[St],O){case 0:for(bt=0;bt<dt;bt++)Y[Ct+bt]|=mt[bt];break;case 2:for(bt=0;bt<dt;bt++)Y[Ct+bt]^=mt[bt];break;default:throw new $(`operator ${O} is not supported`)}et+=dt-1;}N++;let Tt=r?y.tableDeltaS.decode(z):B(X,"IADS",Q);if(Tt===null)break;et+=Tt+m;}}return G}function J(r,t){let i={};i.number=(0, D.readUint32)(r,t);let e=r[t+4],o=63&e;if(!j[o])throw new $("invalid segment type: "+o);i.type=o,i.typeName=j[o],i.deferredNonRetain=!!(128&e);let d=!!(64&e),u=r[t+5],p=u>>5&7,l=[31&u],h=t+6;if(u===7){p=536870911&(0, D.readUint32)(r,h-1),h+=3;let k=p+7>>3;for(l[0]=r[h++];--k>0;)l.push(r[h++]);}else if(u===5||u===6)throw new $("invalid referred-to flags");i.retainBits=l;let m=4;i.number<=256?m=1:i.number<=65536&&(m=2);let P=[],O,y;for(O=0;O<p;O++){let k;k=m===1?r[h]:m===2?(0, D.readUint16)(r,h):(0, D.readUint32)(r,h),P.push(k),h+=m;}if(i.referredTo=P,d?(i.pageAssociation=(0, D.readUint32)(r,h),h+=4):i.pageAssociation=r[h++],i.length=(0, D.readUint32)(r,h),h+=4,i.length===4294967295){if(o!==38)throw new $("invalid unknown segment length");{let k=it(r,h),R=!!(1&r[h+x]),L=6,U=new Uint8Array(L);for(R||(U[0]=255,U[1]=172),U[2]=k.height>>>24&255,U[3]=k.height>>16&255,U[4]=k.height>>8&255,U[5]=255&k.height,O=h,y=r.length;O<y;O++){let z=0;for(;z<L&&U[z]===r[O+z];)z++;if(z===L){i.length=O+L;break}}if(i.length===4294967295)throw new $("segment end was not found")}}return i.headerEnd=h,i}function ct(r,t,i,e){let o=[],d=i;for(;d<e;){let u=J(t,d);d=u.headerEnd;let p={header:u,data:t};if(r.randomAccess||(p.start=d,d+=u.length,p.end=d),o.push(p),u.type===51)break}if(r.randomAccess)for(let u=0,p=o.length;u<p;u++)o[u].start=d,d+=o[u].header.length,o[u].end=d;return o}function it(r,t){return {width:(0, D.readUint32)(r,t),height:(0, D.readUint32)(r,t+4),x:(0, D.readUint32)(r,t+8),y:(0, D.readUint32)(r,t+12),combinationOperator:7&r[t+16]}}let x=17;function v(r,t){let i=r.header,e=r.data,o=r.end,d,u,p,l,h=r.start;switch(i.type){case 0:let P={},O=(0, D.readUint16)(e,h);if(P.huffman=!!(1&O),P.refinement=!!(2&O),P.huffmanDHSelector=O>>2&3,P.huffmanDWSelector=O>>4&3,P.bitmapSizeSelector=O>>6&1,P.aggregationInstancesSelector=O>>7&1,P.bitmapCodingContextUsed=!!(256&O),P.bitmapCodingContextRetained=!!(512&O),P.template=O>>10&3,P.refinementTemplate=O>>12&1,h+=2,!P.huffman){for(l=P.template===0?4:1,u=[],p=0;p<l;p++)u.push({x:(0, D.readInt8)(e,h),y:(0, D.readInt8)(e,h+1)}),h+=2;P.at=u;}if(P.refinement&&!P.refinementTemplate){for(u=[],p=0;p<2;p++)u.push({x:(0, D.readInt8)(e,h),y:(0, D.readInt8)(e,h+1)}),h+=2;P.refinementAt=u;}P.numberOfExportedSymbols=(0, D.readUint32)(e,h),h+=4,P.numberOfNewSymbols=(0, D.readUint32)(e,h),h+=4,d=[P,i.number,i.referredTo,e,h,o];break;case 6:case 7:let y={};y.info=it(e,h),h+=x;let k=(0, D.readUint16)(e,h);if(h+=2,y.huffman=!!(1&k),y.refinement=!!(2&k),y.logStripSize=k>>2&3,y.stripSize=1<<y.logStripSize,y.referenceCorner=k>>4&3,y.transposed=!!(64&k),y.combinationOperator=k>>7&3,y.defaultPixelValue=k>>9&1,y.dsOffset=k<<17>>27,y.refinementTemplate=k>>15&1,y.huffman){let X=(0, D.readUint16)(e,h);h+=2,y.huffmanFS=3&X,y.huffmanDS=X>>2&3,y.huffmanDT=X>>4&3,y.huffmanRefinementDW=X>>6&3,y.huffmanRefinementDH=X>>8&3,y.huffmanRefinementDX=X>>10&3,y.huffmanRefinementDY=X>>12&3,y.huffmanRefinementSizeSelector=!!(16384&X);}if(y.refinement&&!y.refinementTemplate){for(u=[],p=0;p<2;p++)u.push({x:(0, D.readInt8)(e,h),y:(0, D.readInt8)(e,h+1)}),h+=2;y.refinementAt=u;}y.numberOfSymbolInstances=(0, D.readUint32)(e,h),h+=4,d=[y,i.referredTo,e,h,o];break;case 16:let R={},L=e[h++];R.mmr=!!(1&L),R.template=L>>1&3,R.patternWidth=e[h++],R.patternHeight=e[h++],R.maxPatternIndex=(0, D.readUint32)(e,h),h+=4,d=[R,i.number,e,h,o];break;case 22:case 23:let U={};U.info=it(e,h),h+=x;let z=e[h++];U.mmr=!!(1&z),U.template=z>>1&3,U.enableSkip=!!(8&z),U.combinationOperator=z>>4&7,U.defaultPixelValue=z>>7&1,U.gridWidth=(0, D.readUint32)(e,h),h+=4,U.gridHeight=(0, D.readUint32)(e,h),h+=4,U.gridOffsetX=4294967295&(0, D.readUint32)(e,h),h+=4,U.gridOffsetY=4294967295&(0, D.readUint32)(e,h),h+=4,U.gridVectorX=(0, D.readUint16)(e,h),h+=2,U.gridVectorY=(0, D.readUint16)(e,h),h+=2,d=[U,i.referredTo,e,h,o];break;case 38:case 39:let G={};G.info=it(e,h),h+=x;let N=e[h++];if(G.mmr=!!(1&N),G.template=N>>1&3,G.prediction=!!(8&N),!G.mmr){for(l=G.template===0?4:1,u=[],p=0;p<l;p++)u.push({x:(0, D.readInt8)(e,h),y:(0, D.readInt8)(e,h+1)}),h+=2;G.at=u;}d=[G,e,h,o];break;case 48:let Y={width:(0, D.readUint32)(e,h),height:(0, D.readUint32)(e,h+4),resolutionX:(0, D.readUint32)(e,h+8),resolutionY:(0, D.readUint32)(e,h+12)};Y.height===4294967295&&delete Y.height;let Q=e[h+16];(0, D.readUint16)(e,h+17),Y.lossless=!!(1&Q),Y.refinement=!!(2&Q),Y.defaultPixelValue=Q>>2&1,Y.combinationOperator=Q>>3&3,Y.requiresBuffer=!!(32&Q),Y.combinationOperatorOverride=!!(64&Q),d=[Y];break;case 49:case 50:case 51:case 62:break;case 53:d=[i.number,e,h,o];break;default:throw new $(`segment type ${i.typeName}(${i.type}) is not implemented`)}let m="on"+i.typeName;m in t&&t[m].apply(t,d);}function V(r,t){for(let i=0,e=r.length;i<e;i++)v(r[i],t);}class _{onPageInformation(t){this.currentPageInfo=t;let i=t.width+7>>3,e=new Uint8ClampedArray(i*t.height);t.defaultPixelValue&&e.fill(255),this.buffer=e;}drawBitmap(t,i){let e=this.currentPageInfo,o=t.width,d=t.height,u=e.width+7>>3,p=e.combinationOperatorOverride?t.combinationOperator:e.combinationOperator,l=this.buffer,h=128>>(7&t.x),m,P,O,y,k=t.y*u+(t.x>>3);switch(p){case 0:for(m=0;m<d;m++){for(O=h,y=k,P=0;P<o;P++)i[m][P]&&(l[y]|=O),O>>=1,O||(O=128,y++);k+=u;}break;case 2:for(m=0;m<d;m++){for(O=h,y=k,P=0;P<o;P++)i[m][P]&&(l[y]^=O),O>>=1,O||(O=128,y++);k+=u;}break;default:throw new $(`operator ${p} is not supported`)}}onImmediateGenericRegion(t,i,e,o){let d=t.info,u=new pt(i,e,o),p=n(t.mmr,d.width,d.height,t.template,t.prediction,null,t.at,u);this.drawBitmap(d,p);}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments);}onSymbolDictionary(t,i,e,o,d,u){let p,l;t.huffman&&(p=(function(y,k,R){let L,U,z,G,N=0;switch(y.huffmanDHSelector){case 0:case 1:L=M(y.huffmanDHSelector+4);break;case 3:L=g(N,k,R),N++;break;default:throw new $("invalid Huffman DH selector")}switch(y.huffmanDWSelector){case 0:case 1:U=M(y.huffmanDWSelector+2);break;case 3:U=g(N,k,R),N++;break;default:throw new $("invalid Huffman DW selector")}return y.bitmapSizeSelector?(z=g(N,k,R),N++):z=M(1),G=y.aggregationInstancesSelector?g(N,k,R):M(1),{tableDeltaHeight:L,tableDeltaWidth:U,tableBitmapSize:z,tableAggregateInstances:G}})(t,e,this.customTables),l=new s(o,d,u));let h=this.symbols;h||(this.symbols=h={});let m=[];for(let O of e){let y=h[O];y&&m.push(...y);}let P=new pt(o,d,u);h[i]=(function(y,k,R,L,U,z,G,N,Y,Q,X,W){if(y&&k)throw new $("symbol refinement with Huffman is not supported");let ot=[],et=0,nt=(0, D.log2)(R.length+L),tt=X.decoder,rt=X.contextCache,ut,ht;for(y&&(ut=M(1),ht=[],nt=Math.max(nt,1));ot.length<L;){et+=y?z.tableDeltaHeight.decode(W):B(rt,"IADH",tt);let mt=0,Tt=0,xt=y?ht.length:0;for(;;){let vt=y?z.tableDeltaWidth.decode(W):B(rt,"IADW",tt);if(vt===null)break;mt+=vt,Tt+=mt;let At;if(k){let Lt=B(rt,"IAAI",tt);if(Lt>1)At=T(y,k,mt,et,0,Lt,1,R.concat(ot),nt,0,0,1,0,z,Y,Q,X,0,W);else {let Et=H(rt,tt,nt),Pt=B(rt,"IARDX",tt),Ot=B(rt,"IARDY",tt);At=a(mt,et,Y,Et<R.length?R[Et]:ot[Et-R.length],Pt,Ot,false,Q,X);}ot.push(At);}else y?ht.push(mt):(At=n(false,mt,et,G,false,null,N,X),ot.push(At));}if(y&&!k){let vt=z.tableBitmapSize.decode(W);W.byteAlign();let At;if(vt===0)At=b(W,Tt,et);else {let Et=W.end,Pt=W.position+vt;W.end=Pt,At=c(W,Tt,et,false),W.end=Et,W.position=Pt;}let Lt=ht.length;if(xt===Lt-1)ot.push(At);else {let Et,Pt,Ot,Rt,kt,Bt=0;for(Et=xt;Et<Lt;Et++){for(Rt=ht[Et],Ot=Bt+Rt,kt=[],Pt=0;Pt<et;Pt++)kt.push(At[Pt].subarray(Bt,Ot));ot.push(kt),Bt=Ot;}}}}let dt=[],yt=[],wt,Ct,bt=false,St=R.length+L;for(;yt.length<St;){let mt=y?ut.decode(W):B(rt,"IAEX",tt);for(;mt--;)yt.push(bt);bt=!bt;}for(wt=0,Ct=R.length;wt<Ct;wt++)yt[wt]&&dt.push(R[wt]);for(let mt=0;mt<L;wt++,mt++)yt[wt]&&dt.push(ot[mt]);return dt})(t.huffman,t.refinement,m,t.numberOfNewSymbols,t.numberOfExportedSymbols,p,t.template,t.at,t.refinementTemplate,t.refinementAt,P,l);}onImmediateTextRegion(t,i,e,o,d){let u=t.info,p,l,h=this.symbols,m=[];for(let k of i){let R=h[k];R&&m.push(...R);}let P=(0, D.log2)(m.length);t.huffman&&(l=new s(e,o,d),p=(function(R,L,U,z,G){let N=[];for(let nt=0;nt<=34;nt++){let tt=G.readBits(4);N.push(new I([nt,tt,0,0]));}let Y=new S(N,false);N.length=0;for(let nt=0;nt<z;){let tt=Y.decode(G);if(tt>=32){let rt,ut,ht;switch(tt){case 32:if(nt===0)throw new $("no previous value in symbol ID table");ut=G.readBits(2)+3,rt=N[nt-1].prefixLength;break;case 33:ut=G.readBits(3)+3,rt=0;break;case 34:ut=G.readBits(7)+11,rt=0;break;default:throw new $("invalid code length in symbol ID table")}for(ht=0;ht<ut;ht++)N.push(new I([nt,rt,0,0])),nt++;}else N.push(new I([nt,tt,0,0])),nt++;}G.byteAlign();let Q=new S(N,false),X,W,ot,et=0;switch(R.huffmanFS){case 0:case 1:X=M(R.huffmanFS+6);break;case 3:X=g(et,L,U),et++;break;default:throw new $("invalid Huffman FS selector")}switch(R.huffmanDS){case 0:case 1:case 2:W=M(R.huffmanDS+8);break;case 3:W=g(et,L,U),et++;break;default:throw new $("invalid Huffman DS selector")}switch(R.huffmanDT){case 0:case 1:case 2:ot=M(R.huffmanDT+11);break;case 3:ot=g(et,L,U),et++;break;default:throw new $("invalid Huffman DT selector")}if(R.refinement)throw new $("refinement with Huffman is not supported");return {symbolIDTable:Q,tableFirstS:X,tableDeltaS:W,tableDeltaT:ot}})(t,i,this.customTables,m.length,l));let O=new pt(e,o,d),y=T(t.huffman,t.refinement,u.width,u.height,t.defaultPixelValue,t.numberOfSymbolInstances,t.stripSize,m,P,t.transposed,t.dsOffset,t.referenceCorner,t.combinationOperator,p,t.refinementTemplate,t.refinementAt,O,t.logStripSize,l);this.drawBitmap(u,y);}onImmediateLosslessTextRegion(){this.onImmediateTextRegion(...arguments);}onPatternDictionary(t,i,e,o,d){let u=this.patterns;u||(this.patterns=u={});let p=new pt(e,o,d);u[i]=(function(h,m,P,O,y,k){let R=[];h||(R.push({x:-m,y:0}),y===0&&R.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2}));let L=n(h,(O+1)*m,P,y,false,null,R,k),U=[];for(let z=0;z<=O;z++){let G=[],N=m*z,Y=N+m;for(let Q=0;Q<P;Q++)G.push(L[Q].subarray(N,Y));U.push(G);}return U})(t.mmr,t.patternWidth,t.patternHeight,t.maxPatternIndex,t.template,p);}onImmediateHalftoneRegion(t,i,e,o,d){let u=this.patterns[i[0]],p=t.info,l=new pt(e,o,d),h=(function(P,O,y,k,R,L,U,z,G,N,Y,Q,X,W,ot){if(U)throw new $("skip is not supported");if(z!==0)throw new $(`operator "${z}" is not supported in halftone region`);let et=[],nt,tt,rt;for(nt=0;nt<R;nt++){if(rt=new Uint8Array(k),L)for(tt=0;tt<k;tt++)rt[tt]=L;et.push(rt);}let ut=O.length,ht=O[0],dt=ht[0].length,yt=ht.length,wt=(0, D.log2)(ut),Ct=[];P||(Ct.push({x:y<=1?3:2,y:-1}),y===0&&Ct.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2}));let bt=[],St,mt,Tt,xt,vt,At,Lt,Et,Pt,Ot,Rt;for(P&&(St=new s(ot.data,ot.start,ot.end)),nt=wt-1;nt>=0;nt--)mt=P?c(St,G,N,true):n(false,G,N,y,false,null,Ct,ot),bt[nt]=mt;for(Tt=0;Tt<N;Tt++)for(xt=0;xt<G;xt++){for(vt=0,At=0,tt=wt-1;tt>=0;tt--)vt^=bt[tt][Tt][xt],At|=vt<<tt;if(Lt=O[At],Et=Y+Tt*W+xt*X>>8,Pt=Q+Tt*X-xt*W>>8,Et>=0&&Et+dt<=k&&Pt>=0&&Pt+yt<=R)for(nt=0;nt<yt;nt++)for(Rt=et[Pt+nt],Ot=Lt[nt],tt=0;tt<dt;tt++)Rt[Et+tt]|=Ot[tt];else {let kt,Bt;for(nt=0;nt<yt;nt++)if(Bt=Pt+nt,!(Bt<0||Bt>=R))for(Rt=et[Bt],Ot=Lt[nt],tt=0;tt<dt;tt++)kt=Et+tt,kt>=0&&kt<k&&(Rt[kt]|=Ot[tt]);}}return et})(t.mmr,u,t.template,p.width,p.height,t.defaultPixelValue,t.enableSkip,t.combinationOperator,t.gridWidth,t.gridHeight,t.gridOffsetX,t.gridOffsetY,t.gridVectorX,t.gridVectorY,l);this.drawBitmap(p,h);}onImmediateLosslessHalftoneRegion(){this.onImmediateHalftoneRegion(...arguments);}onTables(t,i,e,o){let d=this.customTables;d||(this.customTables=d={}),d[t]=(function(p,l,h){let m=p[l],P=4294967295&(0, D.readUint32)(p,l+1),O=4294967295&(0, D.readUint32)(p,l+5),y=new s(p,l+9,h),k=1+(m>>1&7),R=1+(m>>4&7),L=[],U,z,G=P;do U=y.readBits(k),z=y.readBits(R),L.push(new I([G,U,z,0])),G+=1<<z;while(G<O);return U=y.readBits(k),L.push(new I([P-1,U,32,0,"lower"])),U=y.readBits(k),L.push(new I([O,U,32,0])),1&m&&(U=y.readBits(k),L.push(new I([U,0]))),new S(L,false)})(i,e,o);}}class I{constructor(t){t.length===2?(this.isOOB=true,this.rangeLow=0,this.prefixLength=t[0],this.rangeLength=0,this.prefixCode=t[1],this.isLowerRange=false):(this.isOOB=false,this.rangeLow=t[0],this.prefixLength=t[1],this.rangeLength=t[2],this.prefixCode=t[3],this.isLowerRange=t[4]==="lower");}}class F{constructor(t){this.children=[],t?(this.isLeaf=true,this.rangeLength=t.rangeLength,this.rangeLow=t.rangeLow,this.isLowerRange=t.isLowerRange,this.isOOB=t.isOOB):this.isLeaf=false;}buildTree(t,i){let e=t.prefixCode>>i&1;if(i<=0)this.children[e]=new F(t);else {let o=this.children[e];o||(this.children[e]=o=new F(null)),o.buildTree(t,i-1);}}decodeNode(t){if(this.isLeaf){if(this.isOOB)return null;let e=t.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-e:e)}let i=this.children[t.readBit()];if(!i)throw new $("invalid Huffman data");return i.decodeNode(t)}}class S{constructor(t,i){i||this.assignPrefixCodes(t),this.rootNode=new F(null);for(let e=0,o=t.length;e<o;e++){let d=t[e];d.prefixLength>0&&this.rootNode.buildTree(d,d.prefixLength-1);}}decode(t){return this.rootNode.decodeNode(t)}assignPrefixCodes(t){let i=t.length,e=0;for(let m=0;m<i;m++)e=Math.max(e,t[m].prefixLength);let o=new Uint32Array(e+1);for(let m=0;m<i;m++)o[t[m].prefixLength]++;let d,u,p,l=1,h=0;for(o[0]=0;l<=e;){for(h=h+o[l-1]<<1,d=h,u=0;u<i;)p=t[u],p.prefixLength===l&&(p.prefixCode=d,d++),u++;l++;}}}let q={};function M(r){let t,i=q[r];if(i)return i;switch(r){case 1:t=[[0,1,4,0],[16,2,8,2],[272,3,16,6],[65808,3,32,7]];break;case 2:t=[[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[75,6,32,62],[6,63]];break;case 3:t=[[-256,8,8,254],[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[-257,8,32,255,"lower"],[75,7,32,126],[6,62]];break;case 4:t=[[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[76,5,32,31]];break;case 5:t=[[-255,7,8,126],[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[-256,7,32,127,"lower"],[76,6,32,62]];break;case 6:t=[[-2048,5,10,28],[-1024,4,9,8],[-512,4,8,9],[-256,4,7,10],[-128,5,6,29],[-64,5,5,30],[-32,4,5,11],[0,2,7,0],[128,3,7,2],[256,3,8,3],[512,4,9,12],[1024,4,10,13],[-2049,6,32,62,"lower"],[2048,6,32,63]];break;case 7:t=[[-1024,4,9,8],[-512,3,8,0],[-256,4,7,9],[-128,5,6,26],[-64,5,5,27],[-32,4,5,10],[0,4,5,11],[32,5,5,28],[64,5,6,29],[128,4,7,12],[256,3,8,1],[512,3,9,2],[1024,3,10,3],[-1025,5,32,30,"lower"],[2048,5,32,31]];break;case 8:t=[[-15,8,3,252],[-7,9,1,508],[-5,8,1,253],[-3,9,0,509],[-2,7,0,124],[-1,4,0,10],[0,2,1,0],[2,5,0,26],[3,6,0,58],[4,3,4,4],[20,6,1,59],[22,4,4,11],[38,4,5,12],[70,5,6,27],[134,5,7,28],[262,6,7,60],[390,7,8,125],[646,6,10,61],[-16,9,32,510,"lower"],[1670,9,32,511],[2,1]];break;case 9:t=[[-31,8,4,252],[-15,9,2,508],[-11,8,2,253],[-7,9,1,509],[-5,7,1,124],[-3,4,1,10],[-1,3,1,2],[1,3,1,3],[3,5,1,26],[5,6,1,58],[7,3,5,4],[39,6,2,59],[43,4,5,11],[75,4,6,12],[139,5,7,27],[267,5,8,28],[523,6,8,60],[779,7,9,125],[1291,6,11,61],[-32,9,32,510,"lower"],[3339,9,32,511],[2,0]];break;case 10:t=[[-21,7,4,122],[-5,8,0,252],[-4,7,0,123],[-3,5,0,24],[-2,2,2,0],[2,5,0,25],[3,6,0,54],[4,7,0,124],[5,8,0,253],[6,2,6,1],[70,5,5,26],[102,6,5,55],[134,6,6,56],[198,6,7,57],[326,6,8,58],[582,6,9,59],[1094,6,10,60],[2118,7,11,125],[-22,8,32,254,"lower"],[4166,8,32,255],[2,2]];break;case 11:t=[[1,1,0,0],[2,2,1,2],[4,4,0,12],[5,4,1,13],[7,5,1,28],[9,5,2,29],[13,6,2,60],[17,7,2,122],[21,7,3,123],[29,7,4,124],[45,7,5,125],[77,7,6,126],[141,7,32,127]];break;case 12:t=[[1,1,0,0],[2,2,0,2],[3,3,1,6],[5,5,0,28],[6,5,1,29],[8,6,1,60],[10,7,0,122],[11,7,1,123],[13,7,2,124],[17,7,3,125],[25,7,4,126],[41,8,5,254],[73,8,32,255]];break;case 13:t=[[1,1,0,0],[2,3,0,4],[3,4,0,12],[4,5,0,28],[5,4,1,13],[7,3,3,5],[15,6,1,58],[17,6,2,59],[21,6,3,60],[29,6,4,61],[45,6,5,62],[77,7,6,126],[141,7,32,127]];break;case 14:t=[[-2,3,0,4],[-1,3,0,5],[0,1,0,0],[1,3,0,6],[2,3,0,7]];break;case 15:t=[[-24,7,4,124],[-8,6,2,60],[-4,5,1,28],[-2,4,0,12],[-1,3,0,4],[0,1,0,0],[1,3,0,5],[2,4,0,13],[3,5,1,29],[5,6,2,61],[9,7,4,125],[-25,7,32,126,"lower"],[25,7,32,127]];break;default:throw new $(`standard table B.${r} does not exist`)}for(let e=0,o=t.length;e<o;e++)t[e]=new I(t[e]);return i=new S(t,true),q[r]=i,i}class s{constructor(t,i,e){this.data=t,this.start=i,this.end=e,this.position=i,this.shift=-1,this.currentByte=0;}readBit(){if(this.shift<0){if(this.position>=this.end)throw new $("end of data while reading bit");this.currentByte=this.data[this.position++],this.shift=7;}let t=this.currentByte>>this.shift&1;return this.shift--,t}readBits(t){let i,e=0;for(i=t-1;i>=0;i--)e|=this.readBit()<<i;return e}byteAlign(){this.shift=-1;}next(){return this.position>=this.end?-1:this.data[this.position++]}}function g(r,t,i){let e=0;for(let o=0,d=t.length;o<d;o++){let u=i[t[o]];if(u){if(r===e)return u;e++;}}throw new $("can't find custom Huffman table")}function b(r,t,i){let e=[];for(let o=0;o<i;o++){let d=new Uint8Array(t);e.push(d);for(let u=0;u<t;u++)d[u]=r.readBit();r.byteAlign();}return e}function c(r,t,i,e){let o={K:-1,Columns:t,Rows:i,BlackIs1:true,EndOfBlock:e},d=new K.CCITTFaxDecoder(r,o),u=[],p,l=false;for(let h=0;h<i;h++){let m=new Uint8Array(t);u.push(m);let P=-1;for(let O=0;O<t;O++)P<0&&(p=d.readNextChar(),p===-1&&(p=0,l=true),P=7),m[O]=p>>P&1,P--;}if(e&&!l)for(let m=0;m<5&&d.readNextChar()!==-1;m++);return u}w.Jbig2Image=class{parseChunks(t){return (function(e){let o=new _;for(let d=0,u=e.length;d<u;d++){let p=e[d];V(ct({},p.data,p.start,p.end),o);}return o.buffer})(t)}parse(t){let{imgData:i,width:e,height:o}=(function(u){let p=u.length,l=0;if(u[l]!==151||u[l+1]!==74||u[l+2]!==66||u[l+3]!==50||u[l+4]!==13||u[l+5]!==10||u[l+6]!==26||u[l+7]!==10)throw new $("parseJbig2 - invalid header.");let h=Object.create(null);l+=8;let m=u[l++];h.randomAccess=!(1&m),2&m||(h.numberOfPages=(0, D.readUint32)(u,l),l+=4);let P=ct(h,u,l,p),O=new _;V(P,O);let{width:y,height:k}=O.currentPageInfo,R=O.buffer,L=new Uint8ClampedArray(y*k),U=0,z=0;for(let G=0;G<k;G++){let N,Y=0;for(let Q=0;Q<y;Q++)Y||(Y=128,N=R[z++]),L[U++]=N&Y?0:255,Y>>=1;}return {imgData:L,width:y,height:k}})(t);return this.width=e,this.height=o,i}};},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.XRefParseException=w.XRefEntryException=w.ParserEOFException=w.PDF_VERSION_REGEXP=w.MissingDataException=void 0,w.arrayBuffersToBytes=function(C){let E=C.length;if(E===0)return new Uint8Array(0);if(E===1)return new Uint8Array(C[0]);let f=0;for(let T=0;T<E;T++)f+=C[T].byteLength;let n=new Uint8Array(f),a=0;for(let T=0;T<E;T++){let J=new Uint8Array(C[T]);n.set(J,a),a+=J.byteLength;}return n},w.collectActions=function(C,E,f){let n=Object.create(null),a=ft({dict:E,key:"AA",stopWhenFound:false});if(a)for(let T=a.length-1;T>=0;T--){let J=a[T];if(J instanceof D.Dict)for(let ct of J.getKeys()){let it=f[ct];if(!it)continue;let x=[];B(J.getRaw(ct),C,x,new D.RefSet),x.length>0&&(n[it]=x);}}if(E.has("A")){let T=[];B(E.get("A"),C,T,new D.RefSet),T.length>0&&(n.Action=T);}return (0, Z.objectSize)(n)>0?n:null},w.encodeToXmlString=function(C){let E=[],f=0;for(let n=0,a=C.length;n<a;n++){let T=C.codePointAt(n);if(32<=T&&T<=126){let J=H[T];J&&(f<n&&E.push(C.substring(f,n)),E.push(J),f=n+1);}else f<n&&E.push(C.substring(f,n)),E.push(`&#x${T.toString(16).toUpperCase()};`),T>55295&&(T<57344||T>65533)&&n++,f=n+1;}return E.length===0?C:(f<C.length&&E.push(C.substring(f,C.length)),E.join(""))},w.escapePDFName=function(C){let E=[],f=0;for(let n=0,a=C.length;n<a;n++){let T=C.charCodeAt(n);(T<33||T>126||T===35||T===40||T===41||T===60||T===62||T===91||T===93||T===123||T===125||T===47||T===37)&&(f<n&&E.push(C.substring(f,n)),E.push(`#${T.toString(16)}`),f=n+1);}return E.length===0?C:(f<C.length&&E.push(C.substring(f,C.length)),E.join(""))},w.escapeString=function(C){return C.replaceAll(/([()\\\n\r])/g,(E=>E===`
2
+ `?"\\n":E==="\r"?"\\r":`\\${E}`))},w.getInheritableProperty=ft,w.getLookupTableFactory=function(C){let E;return function(){return C&&(E=Object.create(null),C(E),C=null),E}},w.getNewAnnotationsMap=function(C){if(!C)return null;let E=new Map;for(let[f,n]of C){if(!f.startsWith(Z.AnnotationEditorPrefix))continue;let a=E.get(n.pageIndex);a||(a=[],E.set(n.pageIndex,a)),a.push(n);}return E.size>0?E:null},w.getRotationMatrix=function(C,E,f){switch(C){case 90:return [0,1,-1,0,E,0];case 180:return [-1,0,0,-1,E,f];case 270:return [0,-1,1,0,0,f];default:throw new Error("Invalid rotation")}},w.isAscii=function(C){return /^[\x00-\x7F]*$/.test(C)},w.isWhiteSpace=function(C){return C===32||C===9||C===13||C===10},w.log2=function(C){return C<=0?0:Math.ceil(Math.log2(C))},w.numberToString=function(C){if(Number.isInteger(C))return C.toString();let E=Math.round(100*C);return E%100==0?(E/100).toString():E%10==0?C.toFixed(1):C.toFixed(2)},w.parseXFAPath=function(C){let E=/(.+)\[(\d+)\]$/;return C.split(".").map((f=>{let n=f.match(E);return n?{name:n[1],pos:parseInt(n[2],10)}:{name:f,pos:0}}))},w.readInt8=function(C,E){return C[E]<<24>>24},w.readUint16=function(C,E){return C[E]<<8|C[E+1]},w.readUint32=function(C,E){return (C[E]<<24|C[E+1]<<16|C[E+2]<<8|C[E+3])>>>0},w.recoverJsURL=function(C){let E=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\.")+`)\\((?:'|")([^'"]*)(?:'|")(?:,\\s*(\\w+)\\)|\\))`,"i").exec(C);if(E!=null&&E[2]){let f=E[2],n=false;return E[3]==="true"&&E[1]==="app.launchURL"&&(n=true),{url:f,newWindow:n}}return null},w.stringToUTF16HexString=function(C){let E=[];for(let f=0,n=C.length;f<n;f++){let a=C.charCodeAt(f);E.push((a>>8&255).toString(16).padStart(2,"0"),(255&a).toString(16).padStart(2,"0"));}return E.join("")},w.stringToUTF16String=function(C,E=false){let f=[];E&&f.push("\xFE\xFF");for(let n=0,a=C.length;n<a;n++){let T=C.charCodeAt(n);f.push(String.fromCharCode(T>>8&255),String.fromCharCode(255&T));}return f.join("")},w.toRomanNumerals=function(C,E=false){(0, Z.assert)(Number.isInteger(C)&&C>0,"The number should be a positive integer.");let f=[],n;for(;C>=1e3;)C-=1e3,f.push("M");n=C/100|0,C%=100,f.push(lt[n]),n=C/10|0,C%=10,f.push(lt[10+n]),f.push(lt[20+C]);let a=f.join("");return E?a.toLowerCase():a},w.validateCSSFont=function(C){let E=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:f,fontWeight:n,italicAngle:a}=C;if(!j(f,true))return false;let T=n?n.toString():"";C.fontWeight=E.has(T)?T:"400";let J=parseFloat(a);return C.italicAngle=isNaN(J)||J<-90||J>90?"14":a.toString(),true},w.validateFontName=j;var Z=gt(1),D=gt(4),at=gt(5);w.PDF_VERSION_REGEXP=/^[1-9]\.\d$/;class K extends Z.BaseException{constructor(C,E){super(`Missing data [${C}, ${E})`,"MissingDataException"),this.begin=C,this.end=E;}}w.MissingDataException=K;class $ extends Z.BaseException{constructor(C){super(C,"ParserEOFException");}}w.ParserEOFException=$;class st extends Z.BaseException{constructor(C){super(C,"XRefEntryException");}}w.XRefEntryException=st;class pt extends Z.BaseException{constructor(C){super(C,"XRefParseException");}}w.XRefParseException=pt;function ft({dict:A,key:C,getArray:E=false,stopWhenFound:f=true}){let n,a=new D.RefSet;for(;A instanceof D.Dict&&(!A.objId||!a.has(A.objId));){A.objId&&a.put(A.objId);let T=E?A.getArray(C):A.get(C);if(T!==void 0){if(f)return T;(n||(n=[])).push(T);}A=A.get("Parent");}return n}let lt=["","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 B(A,C,E,f){if(!A)return;let n=null;if(A instanceof D.Ref){if(f.has(A))return;n=A,f.put(n),A=C.fetch(A);}if(Array.isArray(A))for(let a of A)B(a,C,E,f);else if(A instanceof D.Dict){if((0, D.isName)(A.get("S"),"JavaScript")){let a=A.get("JS"),T;a instanceof at.BaseStream?T=a.getString():typeof a=="string"&&(T=a),T&&(T=(0, Z.stringToPDFString)(T).replaceAll("\0","")),T&&E.push(T);}B(A.getRaw("Next"),C,E,f);}n&&f.remove(n);}let H={60:"&lt;",62:"&gt;",38:"&amp;",34:"&quot;",39:"&apos;"};function j(A,C=false){let E=/^("|').*("|')$/.exec(A);if(E&&E[1]===E[2]){if(new RegExp(`[^\\\\]${E[1]}`).test(A.slice(1,-1)))return C&&(0, Z.warn)(`FontFamily contains unescaped ${E[1]}: ${A}.`),false}else for(let f of A.split(/[ \t]+/))if(/^(\d|(-(\d|-)))/.test(f)||!/^[\w-\\]+$/.test(f))return C&&(0, Z.warn)(`FontFamily contains invalid <custom-ident>: ${A}.`),false;return true}},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.RefSetCache=w.RefSet=w.Ref=w.Name=w.EOF=w.Dict=w.Cmd=w.CIRCULAR_REF=void 0,w.clearPrimitiveCaches=function(){K=Object.create(null),$=Object.create(null),st=Object.create(null);},w.isCmd=function(f,n){return f instanceof ft&&(n===void 0||f.cmd===n)},w.isDict=function(f,n){return f instanceof B&&(n===void 0||C(f.get("Type"),n))},w.isName=C,w.isRefsEqual=function(f,n){return f.num===n.num&&f.gen===n.gen};var Z=gt(1);let D=Symbol("CIRCULAR_REF");w.CIRCULAR_REF=D;let at=Symbol("EOF");w.EOF=at;let K=Object.create(null),$=Object.create(null),st=Object.create(null);class pt{constructor(f){this.name=f;}static get(f){return $[f]||($[f]=new pt(f))}}w.Name=pt;class ft{constructor(f){this.cmd=f;}static get(f){return K[f]||(K[f]=new ft(f))}}w.Cmd=ft;let lt=function(){return lt};class B{constructor(f=null){this._map=Object.create(null),this.xref=f,this.objId=null,this.suppressEncryption=false,this.__nonSerializable__=lt;}assignXref(f){this.xref=f;}get size(){return Object.keys(this._map).length}get(f,n,a){let T=this._map[f];return T===void 0&&n!==void 0&&(T=this._map[n],T===void 0&&a!==void 0&&(T=this._map[a])),T instanceof H&&this.xref?this.xref.fetch(T,this.suppressEncryption):T}async getAsync(f,n,a){let T=this._map[f];return T===void 0&&n!==void 0&&(T=this._map[n],T===void 0&&a!==void 0&&(T=this._map[a])),T instanceof H&&this.xref?this.xref.fetchAsync(T,this.suppressEncryption):T}getArray(f,n,a){let T=this._map[f];if(T===void 0&&n!==void 0&&(T=this._map[n],T===void 0&&a!==void 0&&(T=this._map[a])),T instanceof H&&this.xref&&(T=this.xref.fetch(T,this.suppressEncryption)),Array.isArray(T)){T=T.slice();for(let J=0,ct=T.length;J<ct;J++)T[J]instanceof H&&this.xref&&(T[J]=this.xref.fetch(T[J],this.suppressEncryption));}return T}getRaw(f){return this._map[f]}getKeys(){return Object.keys(this._map)}getRawValues(){return Object.values(this._map)}set(f,n){this._map[f]=n;}has(f){return this._map[f]!==void 0}forEach(f){for(let n in this._map)f(n,this.get(n));}static get empty(){let f=new B(null);return f.set=(n,a)=>{(0, Z.unreachable)("Should not call `set` on the empty dictionary.");},(0, Z.shadow)(this,"empty",f)}static merge({xref:f,dictArray:n,mergeSubDicts:a=false}){let T=new B(f),J=new Map;for(let ct of n)if(ct instanceof B)for(let[it,x]of Object.entries(ct._map)){let v=J.get(it);if(v===void 0)v=[],J.set(it,v);else if(!(a&&x instanceof B))continue;v.push(x);}for(let[ct,it]of J){if(it.length===1||!(it[0]instanceof B)){T._map[ct]=it[0];continue}let x=new B(f);for(let v of it)for(let[V,_]of Object.entries(v._map))x._map[V]===void 0&&(x._map[V]=_);x.size>0&&(T._map[ct]=x);}return J.clear(),T.size>0?T:B.empty}clone(){let f=new B(this.xref);for(let n of this.getKeys())f.set(n,this.getRaw(n));return f}}w.Dict=B;class H{constructor(f,n){this.num=f,this.gen=n;}toString(){return this.gen===0?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(f){let n=st[f];if(n)return n;let a=/^(\d+)R(\d*)$/.exec(f);return a&&a[1]!=="0"?st[f]=new H(parseInt(a[1]),a[2]?parseInt(a[2]):0):null}static get(f,n){let a=n===0?`${f}R`:`${f}R${n}`;return st[a]||(st[a]=new H(f,n))}}w.Ref=H;class j{constructor(f=null){this._set=new Set(f==null?void 0:f._set);}has(f){return this._set.has(f.toString())}put(f){this._set.add(f.toString());}remove(f){this._set.delete(f.toString());}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear();}}w.RefSet=j;class A{constructor(){this._map=new Map;}get size(){return this._map.size}get(f){return this._map.get(f.toString())}has(f){return this._map.has(f.toString())}put(f,n){this._map.set(f.toString(),n);}putAlias(f,n){this._map.set(f.toString(),this.get(n));}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear();}}w.RefSetCache=A;function C(E,f){return E instanceof pt&&(f===void 0||E.name===f)}},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.BaseStream=void 0;var Z=gt(1);class D{constructor(){this.constructor===D&&(0, Z.unreachable)("Cannot initialize BaseStream.");}get length(){(0, Z.unreachable)("Abstract getter `length` accessed");}get isEmpty(){(0, Z.unreachable)("Abstract getter `isEmpty` accessed");}get isDataLoaded(){return (0, Z.shadow)(this,"isDataLoaded",true)}getByte(){(0, Z.unreachable)("Abstract method `getByte` called");}getBytes(K){(0, Z.unreachable)("Abstract method `getBytes` called");}peekByte(){let K=this.getByte();return K!==-1&&this.pos--,K}peekBytes(K){let $=this.getBytes(K);return this.pos-=$.length,$}getUint16(){let K=this.getByte(),$=this.getByte();return K===-1||$===-1?-1:(K<<8)+$}getInt32(){return (this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(K,$){(0, Z.unreachable)("Abstract method `getByteRange` called");}getString(K){return (0, Z.bytesToString)(this.getBytes(K))}skip(K){this.pos+=K||1;}reset(){(0, Z.unreachable)("Abstract method `reset` called");}moveStart(){(0, Z.unreachable)("Abstract method `moveStart` called");}makeSubStream(K,$,st=null){(0, Z.unreachable)("Abstract method `makeSubStream` called");}getBaseStreams(){return null}}w.BaseStream=D;},(It,w)=>{Object.defineProperty(w,"__esModule",{value:true}),w.ArithmeticDecoder=void 0;let gt=[{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}];w.ArithmeticDecoder=class{constructor(D,at,K){this.data=D,this.bp=at,this.dataEnd=K,this.chigh=D[at],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(){let D=this.data,at=this.bp;D[at]===255?D[at+1]>143?(this.clow+=65280,this.ct=8):(at++,this.clow+=D[at]<<9,this.ct=7,this.bp=at):(at++,this.clow+=at<this.dataEnd?D[at]<<8:65280,this.ct=8,this.bp=at),this.clow>65535&&(this.chigh+=this.clow>>16,this.clow&=65535);}readBit(D,at){let K=D[at]>>1,$=1&D[at],st=gt[K],pt=st.qe,ft,lt=this.a-pt;if(this.chigh<pt)lt<pt?(lt=pt,ft=$,K=st.nmps):(lt=pt,ft=1^$,st.switchFlag===1&&($=ft),K=st.nlps);else {if(this.chigh-=pt,(32768&lt)!=0)return this.a=lt,$;lt<pt?(ft=1^$,st.switchFlag===1&&($=ft),K=st.nlps):(ft=$,K=st.nmps);}do this.ct===0&&this.byteIn(),lt<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while((32768&lt)==0);return this.a=lt,D[at]=K<<1|$,ft}};},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.CCITTFaxDecoder=void 0;var Z=gt(1);let D=-1,at=[[-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]],K=[[-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]],$=[[-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]],st=[[-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]],pt=[[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]],ft=[[-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]];w.CCITTFaxDecoder=class{constructor(B,H={}){var A;if(!B||typeof B.next!="function")throw new Error('CCITTFaxDecoder - invalid "source" parameter.');this.source=B,this.eof=false,this.encoding=H.K||0,this.eoline=H.EndOfLine||false,this.byteAlign=H.EncodedByteAlign||false,this.columns=H.Columns||1728,this.rows=H.Rows||0,this.eoblock=(A=H.EndOfBlock)!=null?A:true,this.black=H.BlackIs1||false,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=false;let j;for(;(j=this._lookBits(12))===0;)this._eatBits(1);j===1&&this._eatBits(12),this.encoding>0&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1));}readNextChar(){if(this.eof)return -1;let B=this.refLine,H=this.codingLine,j=this.columns,A,C,E,f,n;if(this.outputBits===0){if(this.rowsDone&&(this.eof=true),this.eof)return -1;this.err=false;let a,T,J;if(this.nextLine2D){for(f=0;H[f]<j;++f)B[f]=H[f];for(B[f++]=j,B[f]=j,H[0]=0,this.codingPos=0,A=0,C=0;H[this.codingPos]<j;)switch(a=this._getTwoDimCode(),a){case 0:this._addPixels(B[A+1],C),B[A+1]<j&&(A+=2);break;case 1:if(a=T=0,C){do a+=J=this._getBlackCode();while(J>=64);do T+=J=this._getWhiteCode();while(J>=64)}else {do a+=J=this._getWhiteCode();while(J>=64);do T+=J=this._getBlackCode();while(J>=64)}for(this._addPixels(H[this.codingPos]+a,C),H[this.codingPos]<j&&this._addPixels(H[this.codingPos]+T,1^C);B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case 7:if(this._addPixels(B[A]+3,C),C^=1,H[this.codingPos]<j)for(++A;B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case 5:if(this._addPixels(B[A]+2,C),C^=1,H[this.codingPos]<j)for(++A;B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case 3:if(this._addPixels(B[A]+1,C),C^=1,H[this.codingPos]<j)for(++A;B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case 2:if(this._addPixels(B[A],C),C^=1,H[this.codingPos]<j)for(++A;B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case 8:if(this._addPixelsNeg(B[A]-3,C),C^=1,H[this.codingPos]<j)for(A>0?--A:++A;B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case 6:if(this._addPixelsNeg(B[A]-2,C),C^=1,H[this.codingPos]<j)for(A>0?--A:++A;B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case 4:if(this._addPixelsNeg(B[A]-1,C),C^=1,H[this.codingPos]<j)for(A>0?--A:++A;B[A]<=H[this.codingPos]&&B[A]<j;)A+=2;break;case D:this._addPixels(j,0),this.eof=true;break;default:(0, Z.info)("bad 2d code"),this._addPixels(j,0),this.err=true;}}else for(H[0]=0,this.codingPos=0,C=0;H[this.codingPos]<j;){if(a=0,C)do a+=J=this._getBlackCode();while(J>=64);else do a+=J=this._getWhiteCode();while(J>=64);this._addPixels(H[this.codingPos]+a,C),C^=1;}let ct=false;if(this.byteAlign&&(this.inputBits&=-8),this.eoblock||this.row!==this.rows-1){if(a=this._lookBits(12),this.eoline)for(;a!==D&&a!==1;)this._eatBits(1),a=this._lookBits(12);else for(;a===0;)this._eatBits(1),a=this._lookBits(12);a===1?(this._eatBits(12),ct=true):a===D&&(this.eof=true);}else this.rowsDone=true;if(!this.eof&&this.encoding>0&&!this.rowsDone&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1)),this.eoblock&&ct&&this.byteAlign){if(a=this._lookBits(12),a===1){if(this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1)),this.encoding>=0)for(f=0;f<4;++f)a=this._lookBits(12),a!==1&&(0, Z.info)("bad rtc code: "+a),this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1));this.eof=true;}}else if(this.err&&this.eoline){for(;;){if(a=this._lookBits(13),a===D)return this.eof=true,-1;if(a>>1==1)break;this._eatBits(1);}this._eatBits(12),this.encoding>0&&(this._eatBits(1),this.nextLine2D=!(1&a));}this.outputBits=H[0]>0?H[this.codingPos=0]:H[this.codingPos=1],this.row++;}if(this.outputBits>=8)n=1&this.codingPos?0:255,this.outputBits-=8,this.outputBits===0&&H[this.codingPos]<j&&(this.codingPos++,this.outputBits=H[this.codingPos]-H[this.codingPos-1]);else {E=8,n=0;do{if(typeof this.outputBits!="number")throw new Z.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');this.outputBits>E?(n<<=E,1&this.codingPos||(n|=255>>8-E),this.outputBits-=E,E=0):(n<<=this.outputBits,1&this.codingPos||(n|=255>>8-this.outputBits),E-=this.outputBits,this.outputBits=0,H[this.codingPos]<j?(this.codingPos++,this.outputBits=H[this.codingPos]-H[this.codingPos-1]):E>0&&(n<<=E,E=0));}while(E)}return this.black&&(n^=255),n}_addPixels(B,H){let j=this.codingLine,A=this.codingPos;B>j[A]&&(B>this.columns&&((0, Z.info)("row is wrong length"),this.err=true,B=this.columns),1&A^H&&++A,j[A]=B),this.codingPos=A;}_addPixelsNeg(B,H){let j=this.codingLine,A=this.codingPos;if(B>j[A])B>this.columns&&((0, Z.info)("row is wrong length"),this.err=true,B=this.columns),1&A^H&&++A,j[A]=B;else if(B<j[A]){for(B<0&&((0, Z.info)("invalid code"),this.err=true,B=0);A>0&&B<j[A-1];)--A;j[A]=B;}this.codingPos=A;}_findTableCode(B,H,j,A){let C=A||0;for(let E=B;E<=H;++E){let f=this._lookBits(E);if(f===D)return [true,1,false];if(E<H&&(f<<=H-E),!C||f>=C){let n=j[f-C];if(n[0]===E)return this._eatBits(E),[true,n[1],true]}}return [false,0,false]}_getTwoDimCode(){let B,H=0;if(this.eoblock){if(H=this._lookBits(7),B=at[H],(B==null?void 0:B[0])>0)return this._eatBits(B[0]),B[1]}else {let j=this._findTableCode(1,7,at);if(j[0]&&j[2])return j[1]}return (0, Z.info)("Bad two dim code"),D}_getWhiteCode(){let B,H=0;if(this.eoblock){if(H=this._lookBits(12),H===D)return 1;if(B=H>>5==0?K[H]:$[H>>3],B[0]>0)return this._eatBits(B[0]),B[1]}else {let j=this._findTableCode(1,9,$);if(j[0]||(j=this._findTableCode(11,12,K),j[0]))return j[1]}return (0, Z.info)("bad white code"),this._eatBits(1),1}_getBlackCode(){let B,H;if(this.eoblock){if(B=this._lookBits(13),B===D)return 1;if(H=B>>7==0?st[B]:B>>9==0&&B>>7!=0?pt[(B>>1)-64]:ft[B>>7],H[0]>0)return this._eatBits(H[0]),H[1]}else {let j=this._findTableCode(2,6,ft);if(j[0]||(j=this._findTableCode(7,12,pt,64),j[0])||(j=this._findTableCode(10,13,st),j[0]))return j[1]}return (0, Z.info)("bad black code"),this._eatBits(1),1}_lookBits(B){let H;for(;this.inputBits<B;){if((H=this.source.next())===-1)return this.inputBits===0?D:this.inputBuf<<B-this.inputBits&65535>>16-B;this.inputBuf=this.inputBuf<<8|H,this.inputBits+=8;}return this.inputBuf>>this.inputBits-B&65535>>16-B}_eatBits(B){(this.inputBits-=B)<0&&(this.inputBits=0);}};},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.JpegImage=void 0;var Z=gt(1),D=gt(9),at=gt(3);class K extends Z.BaseException{constructor(x){super(`JPEG error: ${x}`,"JpegError");}}class $ extends Z.BaseException{constructor(x,v){super(x,"DNLMarkerError"),this.scanLines=v;}}class st extends Z.BaseException{constructor(x){super(x,"EOIMarkerError");}}let pt=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]),ft=4017,lt=799,B=3406,H=2276,j=1567,A=3784,C=5793,E=2896;function f(it,x){let v,V,_=0,I=16;for(;I>0&&!it[I-1];)I--;let F=[{children:[],index:0}],S,q=F[0];for(v=0;v<I;v++){for(V=0;V<it[v];V++){for(q=F.pop(),q.children[q.index]=x[_];q.index>0;)q=F.pop();for(q.index++,F.push(q);F.length<=v;)F.push(S={children:[],index:0}),q.children[q.index]=S.children,q=S;_++;}v+1<I&&(F.push(S={children:[],index:0}),q.children[q.index]=S.children,q=S);}return F[0].children}function n(it,x,v){return 64*((it.blocksPerLine+1)*x+v)}function a(it,x,v,V,_,I,F,S,q,M=false){let s=v.mcusPerLine,g=v.progressive,b=x,c=0,r=0;function t(){if(r>0)return r--,c>>r&1;if(c=it[x++],c===255){let X=it[x++];if(X){if(X===220&&M){x+=2;let W=(0, at.readUint16)(it,x);if(x+=2,W>0&&W!==v.scanLines)throw new $("Found DNL marker (0xFFDC) while parsing scan data",W)}else if(X===217){if(M){let W=l*(v.precision===8?8:0);if(W>0&&Math.round(v.scanLines/W)>=5)throw new $("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",W)}throw new st("Found EOI marker (0xFFD9) while parsing scan data")}throw new K(`unexpected marker ${(c<<8|X).toString(16)}`)}}return r=7,c>>>7}function i(X){let W=X;for(;;){switch(W=W[t()],typeof W){case "number":return W;case "object":continue}throw new K("invalid huffman sequence")}}function e(X){let W=0;for(;X>0;)W=W<<1|t(),X--;return W}function o(X){if(X===1)return t()===1?1:-1;let W=e(X);return W>=1<<X-1?W:W+(-1<<X)+1}let d=0,u,p=0,l=0;function h(X,W,ot,et,nt){let tt=ot%s;l=(ot/s|0)*X.v+et;let rt=tt*X.h+nt;W(X,n(X,l,rt));}function m(X,W,ot){l=ot/X.blocksPerLine|0;let et=ot%X.blocksPerLine;W(X,n(X,l,et));}let P=V.length,O,y,k,R,L,U;U=g?I===0?S===0?function(W,ot){let et=i(W.huffmanTableDC),nt=et===0?0:o(et)<<q;W.blockData[ot]=W.pred+=nt;}:function(W,ot){W.blockData[ot]|=t()<<q;}:S===0?function(W,ot){if(d>0){d--;return}let et=I,nt=F;for(;et<=nt;){let tt=i(W.huffmanTableAC),rt=15&tt,ut=tt>>4;if(rt===0){if(ut<15){d=e(ut)+(1<<ut)-1;break}et+=16;continue}et+=ut;let ht=pt[et];W.blockData[ot+ht]=o(rt)*(1<<q),et++;}}:function(W,ot){let et=I,nt=F,tt,rt,ut=0;for(;et<=nt;){let ht=ot+pt[et],dt=W.blockData[ht]<0?-1:1;switch(p){case 0:if(rt=i(W.huffmanTableAC),tt=15&rt,ut=rt>>4,tt===0)ut<15?(d=e(ut)+(1<<ut),p=4):(ut=16,p=1);else {if(tt!==1)throw new K("invalid ACn encoding");u=o(tt),p=ut?2:3;}continue;case 1:case 2:W.blockData[ht]?W.blockData[ht]+=dt*(t()<<q):(ut--,ut===0&&(p=p===2?3:0));break;case 3:W.blockData[ht]?W.blockData[ht]+=dt*(t()<<q):(W.blockData[ht]=u<<q,p=0);break;case 4:W.blockData[ht]&&(W.blockData[ht]+=dt*(t()<<q));}et++;}p===4&&(d--,d===0&&(p=0));}:function(W,ot){let et=i(W.huffmanTableDC),nt=et===0?0:o(et);W.blockData[ot]=W.pred+=nt;let tt=1;for(;tt<64;){let rt=i(W.huffmanTableAC),ut=15&rt,ht=rt>>4;if(ut===0){if(ht<15)break;tt+=16;continue}tt+=ht;let dt=pt[tt];W.blockData[ot+dt]=o(ut),tt++;}};let z,G=0,N=P===1?V[0].blocksPerLine*V[0].blocksPerColumn:s*v.mcusPerColumn,Y,Q;for(;G<=N;){let X=_?Math.min(N-G,_):N;if(X>0){for(y=0;y<P;y++)V[y].pred=0;if(d=0,P===1)for(O=V[0],L=0;L<X;L++)m(O,U,G),G++;else for(L=0;L<X;L++){for(y=0;y<P;y++)for(O=V[y],Y=O.h,Q=O.v,k=0;k<Q;k++)for(R=0;R<Y;R++)h(O,U,G,k,R);G++;}}if(r=0,z=ct(it,x),!z)break;if(z.invalid){let W=X>0?"unexpected":"excessive";(0, Z.warn)(`decodeScan - ${W} MCU data, current marker is: ${z.invalid}`),x=z.offset;}if(!(z.marker>=65488&&z.marker<=65495))break;x+=2;}return x-b}function T(it,x,v){let V=it.quantizationTable,_=it.blockData,I,F,S,q,M,s,g,b,c,r,t,i,e,o,d,u,p;if(!V)throw new K("missing required Quantization Table.");for(let l=0;l<64;l+=8)c=_[x+l],r=_[x+l+1],t=_[x+l+2],i=_[x+l+3],e=_[x+l+4],o=_[x+l+5],d=_[x+l+6],u=_[x+l+7],c*=V[l],(r|t|i|e|o|d|u)!=0?(r*=V[l+1],t*=V[l+2],i*=V[l+3],e*=V[l+4],o*=V[l+5],d*=V[l+6],u*=V[l+7],I=C*c+128>>8,F=C*e+128>>8,S=t,q=d,M=E*(r-u)+128>>8,b=E*(r+u)+128>>8,s=i<<4,g=o<<4,I=I+F+1>>1,F=I-F,p=S*A+q*j+128>>8,S=S*j-q*A+128>>8,q=p,M=M+g+1>>1,g=M-g,b=b+s+1>>1,s=b-s,I=I+q+1>>1,q=I-q,F=F+S+1>>1,S=F-S,p=M*H+b*B+2048>>12,M=M*B-b*H+2048>>12,b=p,p=s*lt+g*ft+2048>>12,s=s*ft-g*lt+2048>>12,g=p,v[l]=I+b,v[l+7]=I-b,v[l+1]=F+g,v[l+6]=F-g,v[l+2]=S+s,v[l+5]=S-s,v[l+3]=q+M,v[l+4]=q-M):(p=C*c+512>>10,v[l]=p,v[l+1]=p,v[l+2]=p,v[l+3]=p,v[l+4]=p,v[l+5]=p,v[l+6]=p,v[l+7]=p);for(let l=0;l<8;++l)c=v[l],r=v[l+8],t=v[l+16],i=v[l+24],e=v[l+32],o=v[l+40],d=v[l+48],u=v[l+56],(r|t|i|e|o|d|u)!=0?(I=C*c+2048>>12,F=C*e+2048>>12,S=t,q=d,M=E*(r-u)+2048>>12,b=E*(r+u)+2048>>12,s=i,g=o,I=4112+(I+F+1>>1),F=I-F,p=S*A+q*j+2048>>12,S=S*j-q*A+2048>>12,q=p,M=M+g+1>>1,g=M-g,b=b+s+1>>1,s=b-s,I=I+q+1>>1,q=I-q,F=F+S+1>>1,S=F-S,p=M*H+b*B+2048>>12,M=M*B-b*H+2048>>12,b=p,p=s*lt+g*ft+2048>>12,s=s*ft-g*lt+2048>>12,g=p,c=I+b,u=I-b,r=F+g,d=F-g,t=S+s,o=S-s,i=q+M,e=q-M,c<16?c=0:c>=4080?c=255:c>>=4,r<16?r=0:r>=4080?r=255:r>>=4,t<16?t=0:t>=4080?t=255:t>>=4,i<16?i=0:i>=4080?i=255:i>>=4,e<16?e=0:e>=4080?e=255:e>>=4,o<16?o=0:o>=4080?o=255:o>>=4,d<16?d=0:d>=4080?d=255:d>>=4,u<16?u=0:u>=4080?u=255:u>>=4,_[x+l]=c,_[x+l+8]=r,_[x+l+16]=t,_[x+l+24]=i,_[x+l+32]=e,_[x+l+40]=o,_[x+l+48]=d,_[x+l+56]=u):(p=C*c+8192>>14,p=p<-2040?0:p>=2024?255:p+2056>>4,_[x+l]=p,_[x+l+8]=p,_[x+l+16]=p,_[x+l+24]=p,_[x+l+32]=p,_[x+l+40]=p,_[x+l+48]=p,_[x+l+56]=p);}function J(it,x){let v=x.blocksPerLine,V=x.blocksPerColumn,_=new Int16Array(64);for(let I=0;I<V;I++)for(let F=0;F<v;F++)T(x,n(x,I,F),_);return x.blockData}function ct(it,x,v=x){let V=it.length-1,_=v<x?v:x;if(x>=V)return null;let I=(0, at.readUint16)(it,x);if(I>=65472&&I<=65534)return {invalid:null,marker:I,offset:x};let F=(0, at.readUint16)(it,_);for(;!(F>=65472&&F<=65534);){if(++_>=V)return null;F=(0, at.readUint16)(it,_);}return {invalid:I.toString(16),marker:F,offset:_}}w.JpegImage=class{constructor({decodeTransform:x=null,colorTransform:v=-1}={}){this._decodeTransform=x,this._colorTransform=v;}parse(x,{dnlScanLines:v=null}={}){function V(){let t=(0, at.readUint16)(x,S);S+=2;let i=S+t-2,e=ct(x,i,S);e!=null&&e.invalid&&((0, Z.warn)("readDataBlock - incorrect length, current marker is: "+e.invalid),i=e.offset);let o=x.subarray(S,i);return S+=o.length,o}function _(t){let i=Math.ceil(t.samplesPerLine/8/t.maxH),e=Math.ceil(t.scanLines/8/t.maxV);for(let o of t.components){let d=Math.ceil(Math.ceil(t.samplesPerLine/8)*o.h/t.maxH),u=Math.ceil(Math.ceil(t.scanLines/8)*o.v/t.maxV),p=i*o.h,l=64*(e*o.v)*(p+1);o.blockData=new Int16Array(l),o.blocksPerLine=d,o.blocksPerColumn=u;}t.mcusPerLine=i,t.mcusPerColumn=e;}let I,F,S=0,q=null,M=null,s=0,g=[],b=[],c=[],r=(0, at.readUint16)(x,S);if(S+=2,r!==65496)throw new K("SOI not found");r=(0, at.readUint16)(x,S),S+=2;t:for(;r!==65497;){let t,i,e;switch(r){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:let o=V();r===65504&&o[0]===74&&o[1]===70&&o[2]===73&&o[3]===70&&o[4]===0&&(q={version:{major:o[5],minor:o[6]},densityUnits:o[7],xDensity:o[8]<<8|o[9],yDensity:o[10]<<8|o[11],thumbWidth:o[12],thumbHeight:o[13],thumbData:o.subarray(14,14+3*o[12]*o[13])}),r===65518&&o[0]===65&&o[1]===100&&o[2]===111&&o[3]===98&&o[4]===101&&(M={version:o[5]<<8|o[6],flags0:o[7]<<8|o[8],flags1:o[9]<<8|o[10],transformCode:o[11]});break;case 65499:let d=(0, at.readUint16)(x,S);S+=2;let u=d+S-2,p;for(;S<u;){let N=x[S++],Y=new Uint16Array(64);if(N>>4==0)for(i=0;i<64;i++)p=pt[i],Y[p]=x[S++];else {if(N>>4!=1)throw new K("DQT - invalid table spec");for(i=0;i<64;i++)p=pt[i],Y[p]=(0, at.readUint16)(x,S),S+=2;}g[15&N]=Y;}break;case 65472:case 65473:case 65474:if(I)throw new K("Only single frame JPEGs supported");S+=2,I={},I.extended=r===65473,I.progressive=r===65474,I.precision=x[S++];let l=(0, at.readUint16)(x,S);S+=2,I.scanLines=v||l,I.samplesPerLine=(0, at.readUint16)(x,S),S+=2,I.components=[],I.componentIds={};let h=x[S++],m=0,P=0;for(t=0;t<h;t++){let N=x[S],Y=x[S+1]>>4,Q=15&x[S+1];m<Y&&(m=Y),P<Q&&(P=Q);let X=x[S+2];e=I.components.push({h:Y,v:Q,quantizationId:X,quantizationTable:null}),I.componentIds[N]=e-1,S+=3;}I.maxH=m,I.maxV=P,_(I);break;case 65476:let O=(0, at.readUint16)(x,S);for(S+=2,t=2;t<O;){let N=x[S++],Y=new Uint8Array(16),Q=0;for(i=0;i<16;i++,S++)Q+=Y[i]=x[S];let X=new Uint8Array(Q);for(i=0;i<Q;i++,S++)X[i]=x[S];t+=17+Q,(N>>4==0?c:b)[15&N]=f(Y,X);}break;case 65501:S+=2,F=(0, at.readUint16)(x,S),S+=2;break;case 65498:let y=++s==1&&!v;S+=2;let k=x[S++],R=[];for(t=0;t<k;t++){let N=x[S++],Y=I.componentIds[N],Q=I.components[Y];Q.index=N;let X=x[S++];Q.huffmanTableDC=c[X>>4],Q.huffmanTableAC=b[15&X],R.push(Q);}let L=x[S++],U=x[S++],z=x[S++];try{let N=a(x,S,I,R,F,L,U,z>>4,15&z,y);S+=N;}catch(N){if(N instanceof $)return (0, Z.warn)(`${N.message} -- attempting to re-parse the JPEG image.`),this.parse(x,{dnlScanLines:N.scanLines});if(N instanceof st){(0, Z.warn)(`${N.message} -- ignoring the rest of the image data.`);break t}throw N}break;case 65500:S+=4;break;case 65535:x[S]!==255&&S--;break;default:let G=ct(x,S-2,S-3);if(G!=null&&G.invalid){(0, Z.warn)("JpegImage.parse - unexpected data, current marker is: "+G.invalid),S=G.offset;break}if(!G||S>=x.length-1){(0, Z.warn)("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break t}throw new K("JpegImage.parse - unknown marker: "+r.toString(16))}r=(0, at.readUint16)(x,S),S+=2;}this.width=I.samplesPerLine,this.height=I.scanLines,this.jfif=q,this.adobe=M,this.components=[];for(let t of I.components){let i=g[t.quantizationId];i&&(t.quantizationTable=i),this.components.push({index:t.index,output:J(0,t),scaleX:t.h/I.maxH,scaleY:t.v/I.maxV,blocksPerLine:t.blocksPerLine,blocksPerColumn:t.blocksPerColumn});}this.numComponents=this.components.length;}_getLinearizedBlockData(x,v,V=false){let _=this.width/x,I=this.height/v,F,S,q,M,s,g,b,c,r,t,i,e=0,o=this.components.length,d=x*v*o,u=new Uint8ClampedArray(d),p=new Uint32Array(x),l=4294967288,h;for(b=0;b<o;b++){if(F=this.components[b],S=F.scaleX*_,q=F.scaleY*I,e=b,i=F.output,M=F.blocksPerLine+1<<3,S!==h){for(s=0;s<x;s++)c=0|s*S,p[s]=(c&l)<<3|7&c;h=S;}for(g=0;g<v;g++)for(c=0|g*q,t=M*(c&l)|(7&c)<<3,s=0;s<x;s++)u[e]=i[t+p[s]],e+=o;}let m=this._decodeTransform;if(V||o!==4||m||(m=new Int32Array([-256,255,-256,255,-256,255,-256,255])),m)for(b=0;b<d;)for(c=0,r=0;c<o;c++,b++,r+=2)u[b]=(u[b]*m[r]>>8)+m[r+1];return u}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:this.numComponents===3?this._colorTransform!==0&&(this.components[0].index!==82||this.components[1].index!==71||this.components[2].index!==66):this._colorTransform===1}_convertYccToRgb(x){let v,V,_;for(let I=0,F=x.length;I<F;I+=3)v=x[I],V=x[I+1],_=x[I+2],x[I]=v-179.456+1.402*_,x[I+1]=v+135.459-.344*V-.714*_,x[I+2]=v-226.816+1.772*V;return x}_convertYccToRgba(x,v){for(let V=0,_=0,I=x.length;V<I;V+=3,_+=4){let F=x[V],S=x[V+1],q=x[V+2];v[_]=F-179.456+1.402*q,v[_+1]=F+135.459-.344*S-.714*q,v[_+2]=F-226.816+1.772*S,v[_+3]=255;}return v}_convertYcckToRgb(x){let v,V,_,I,F=0;for(let S=0,q=x.length;S<q;S+=4)v=x[S],V=x[S+1],_=x[S+2],I=x[S+3],x[F++]=V*(-660635669420364e-19*V+.000437130475926232*_-54080610064599e-18*v+.00048449797120281*I-.154362151871126)-122.67195406894+_*(-957964378445773e-18*_+.000817076911346625*v-.00477271405408747*I+1.53380253221734)+v*(.000961250184130688*v-.00266257332283933*I+.48357088451265)+I*(-336197177618394e-18*I+.484791561490776),x[F++]=107.268039397724+V*(219927104525741e-19*V-.000640992018297945*_+.000659397001245577*v+.000426105652938837*I-.176491792462875)+_*(-778269941513683e-18*_+.00130872261408275*v+.000770482631801132*I-.151051492775562)+v*(.00126935368114843*v-.00265090189010898*I+.25802910206845)+I*(-318913117588328e-18*I-.213742400323665),x[F++]=V*(-570115196973677e-18*V-263409051004589e-19*_+.0020741088115012*v-.00288260236853442*I+.814272968359295)-20.810012546947+_*(-153496057440975e-19*_-.000132689043961446*v+.000560833691242812*I-.195152027534049)+v*(.00174418132927582*v-.00255243321439347*I+.116935020465145)+I*(-343531996510555e-18*I+.24165260232407);return x.subarray(0,F)}_convertYcckToRgba(x){for(let v=0,V=x.length;v<V;v+=4){let _=x[v],I=x[v+1],F=x[v+2],S=x[v+3];x[v]=I*(-660635669420364e-19*I+.000437130475926232*F-54080610064599e-18*_+.00048449797120281*S-.154362151871126)-122.67195406894+F*(-957964378445773e-18*F+.000817076911346625*_-.00477271405408747*S+1.53380253221734)+_*(.000961250184130688*_-.00266257332283933*S+.48357088451265)+S*(-336197177618394e-18*S+.484791561490776),x[v+1]=107.268039397724+I*(219927104525741e-19*I-.000640992018297945*F+.000659397001245577*_+.000426105652938837*S-.176491792462875)+F*(-778269941513683e-18*F+.00130872261408275*_+.000770482631801132*S-.151051492775562)+_*(.00126935368114843*_-.00265090189010898*S+.25802910206845)+S*(-318913117588328e-18*S-.213742400323665),x[v+2]=I*(-570115196973677e-18*I-263409051004589e-19*F+.0020741088115012*_-.00288260236853442*S+.814272968359295)-20.810012546947+F*(-153496057440975e-19*F-.000132689043961446*_+.000560833691242812*S-.195152027534049)+_*(.00174418132927582*_-.00255243321439347*S+.116935020465145)+S*(-343531996510555e-18*S+.24165260232407),x[v+3]=255;}return x}_convertYcckToCmyk(x){let v,V,_;for(let I=0,F=x.length;I<F;I+=4)v=x[I],V=x[I+1],_=x[I+2],x[I]=434.456-v-1.402*_,x[I+1]=119.541-v+.344*V+.714*_,x[I+2]=481.816-v-1.772*V;return x}_convertCmykToRgb(x){let v,V,_,I,F=0;for(let S=0,q=x.length;S<q;S+=4)v=x[S],V=x[S+1],_=x[S+2],I=x[S+3],x[F++]=255+v*(-6747147073602441e-20*v+.0008379262121013727*V+.0002894718188643294*_+.003264231057537806*I-1.1185611867203937)+V*(26374107616089405e-21*V-8626949158638572e-20*_-.0002748769067499491*I-.02155688794978967)+_*(-3878099212869363e-20*_-.0003267808279485286*I+.0686742238595345)-I*(.0003361971776183937*I+.7430659151342254),x[F++]=255+v*(.00013596372813588848*v+.000924537132573585*V+.00010567359618683593*_+.0004791864687436512*I-.3109689587515875)+V*(-23545346108370344e-20*V+.0002702845253534714*_+.0020200308977307156*I-.7488052167015494)+_*(6834815998235662e-20*_+.00015168452363460973*I-.09751927774728933)-I*(.0003189131175883281*I+.7364883807733168),x[F++]=255+v*(13598650411385307e-21*v+.00012423956175490851*V+.0004751985097583589*_-36729317476630422e-22*I-.05562186980264034)+V*(.00016141380598724676*V+.0009692239130725186*_+.0007782692450036253*I-.44015232367526463)+_*(5068882914068769e-22*_+.0017778369011375071*I-.7591454649749609)-I*(.0003435319965105553*I+.7063770186160144);return x.subarray(0,F)}_convertCmykToRgba(x){for(let v=0,V=x.length;v<V;v+=4){let _=x[v],I=x[v+1],F=x[v+2],S=x[v+3];x[v]=255+_*(-6747147073602441e-20*_+.0008379262121013727*I+.0002894718188643294*F+.003264231057537806*S-1.1185611867203937)+I*(26374107616089405e-21*I-8626949158638572e-20*F-.0002748769067499491*S-.02155688794978967)+F*(-3878099212869363e-20*F-.0003267808279485286*S+.0686742238595345)-S*(.0003361971776183937*S+.7430659151342254),x[v+1]=255+_*(.00013596372813588848*_+.000924537132573585*I+.00010567359618683593*F+.0004791864687436512*S-.3109689587515875)+I*(-23545346108370344e-20*I+.0002702845253534714*F+.0020200308977307156*S-.7488052167015494)+F*(6834815998235662e-20*F+.00015168452363460973*S-.09751927774728933)-S*(.0003189131175883281*S+.7364883807733168),x[v+2]=255+_*(13598650411385307e-21*_+.00012423956175490851*I+.0004751985097583589*F-36729317476630422e-22*S-.05562186980264034)+I*(.00016141380598724676*I+.0009692239130725186*F+.0007782692450036253*S-.44015232367526463)+F*(5068882914068769e-22*F+.0017778369011375071*S-.7591454649749609)-S*(.0003435319965105553*S+.7063770186160144),x[v+3]=255;}return x}getData({width:x,height:v,forceRGBA:V=false,forceRGB:_=false,isSourcePDF:I=false}){if(this.numComponents>4)throw new K("Unsupported color mode");let F=this._getLinearizedBlockData(x,v,I);if(this.numComponents===1&&(V||_)){let S=F.length*(V?4:3),q=new Uint8ClampedArray(S),M=0;if(V)(0, D.grayToRGBA)(F,new Uint32Array(q.buffer));else for(let s of F)q[M++]=s,q[M++]=s,q[M++]=s;return q}if(this.numComponents===3&&this._isColorConversionNeeded){if(V){let S=new Uint8ClampedArray(F.length/3*4);return this._convertYccToRgba(F,S)}return this._convertYccToRgb(F)}if(this.numComponents===4){if(this._isColorConversionNeeded)return V?this._convertYcckToRgba(F):_?this._convertYcckToRgb(F):this._convertYcckToCmyk(F);if(V)return this._convertCmykToRgba(F);if(_)return this._convertCmykToRgb(F)}return F}};},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.convertBlackAndWhiteToRGBA=D,w.convertToRGBA=function(K){switch(K.kind){case Z.ImageKind.GRAYSCALE_1BPP:return D(K);case Z.ImageKind.RGB_24BPP:return (function({src:st,srcPos:pt=0,dest:ft,destPos:lt=0,width:B,height:H}){let j=0,A=st.length>>2,C=new Uint32Array(st.buffer,pt,A);if(Z.FeatureTest.isLittleEndian){for(;j<A-2;j+=3,lt+=4){let E=C[j],f=C[j+1],n=C[j+2];ft[lt]=4278190080|E,ft[lt+1]=E>>>24|f<<8|4278190080,ft[lt+2]=f>>>16|n<<16|4278190080,ft[lt+3]=n>>>8|4278190080;}for(let E=4*j,f=st.length;E<f;E+=3)ft[lt++]=st[E]|st[E+1]<<8|st[E+2]<<16|4278190080;}else {for(;j<A-2;j+=3,lt+=4){let E=C[j],f=C[j+1],n=C[j+2];ft[lt]=255|E,ft[lt+1]=E<<24|f>>>8|255,ft[lt+2]=f<<16|n>>>16|255,ft[lt+3]=n<<8|255;}for(let E=4*j,f=st.length;E<f;E+=3)ft[lt++]=st[E]<<24|st[E+1]<<16|st[E+2]<<8|255;}return {srcPos:pt,destPos:lt}})(K)}return null},w.grayToRGBA=function(K,$){if(Z.FeatureTest.isLittleEndian)for(let st=0,pt=K.length;st<pt;st++)$[st]=65793*K[st]|4278190080;else for(let st=0,pt=K.length;st<pt;st++)$[st]=16843008*K[st]|255;};var Z=gt(1);function D({src:at,srcPos:K=0,dest:$,width:st,height:pt,nonBlackColor:ft=4294967295,inverseDecode:lt=false}){let B=Z.FeatureTest.isLittleEndian?4278190080:255,[H,j]=lt?[ft,B]:[B,ft],A=st>>3,C=7&st,E=at.length;$=new Uint32Array($.buffer);let f=0;for(let n=0;n<pt;n++){for(let T=K+A;K<T;K++){let J=K<E?at[K]:255;$[f++]=128&J?j:H,$[f++]=64&J?j:H,$[f++]=32&J?j:H,$[f++]=16&J?j:H,$[f++]=8&J?j:H,$[f++]=4&J?j:H,$[f++]=2&J?j:H,$[f++]=1&J?j:H;}if(C===0)continue;let a=K<E?at[K++]:255;for(let T=0;T<C;T++)$[f++]=a&1<<7-T?j:H;}return {srcPos:K,destPos:f}}},(It,w,gt)=>{Object.defineProperty(w,"__esModule",{value:true}),w.JpxImage=void 0;var Z=gt(1),D=gt(3),at=gt(6);class K extends Z.BaseException{constructor(s){super(`JPX error: ${s}`,"JpxError");}}let $={LL:0,LH:1,HL:1,HH:2};w.JpxImage=class{constructor(){this.failOnCorruptedImage=false;}parse(s){if((0, D.readUint16)(s,0)===65359){this.parseCodestream(s,0,s.length);return}let g=s.length,b=0;for(;b<g;){let c=8,r=(0, D.readUint32)(s,b),t=(0, D.readUint32)(s,b+4);if(b+=c,r===1&&(r=4294967296*(0, D.readUint32)(s,b)+(0, D.readUint32)(s,b+4),b+=8,c+=8),r===0&&(r=g-b+c),r<c)throw new K("Invalid box field size");let i=r-c,e=true;switch(t){case 1785737832:e=false;break;case 1668246642:let o=s[b];if(o===1){let u=(0, D.readUint32)(s,b+3);switch(u){case 16:case 17:case 18:break;default:(0, Z.warn)("Unknown colorspace "+u);}}else o===2&&(0, Z.info)("ICC profile not supported");break;case 1785737827:this.parseCodestream(s,b,b+i);break;case 1783636e3:(0, D.readUint32)(s,b)!==218793738&&(0, Z.warn)("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:let d=String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t);(0, Z.warn)(`Unsupported header type ${t} (${d}).`);}e&&(b+=i);}}parseImageProperties(s){let g=s.getByte();for(;g>=0;){let b=g;if(g=s.getByte(),(b<<8|g)===65361){s.skip(4);let c=s.getInt32()>>>0,r=s.getInt32()>>>0,t=s.getInt32()>>>0,i=s.getInt32()>>>0;s.skip(16);let e=s.getUint16();this.width=c-t,this.height=r-i,this.componentsCount=e,this.bitsPerComponent=8;return}}throw new K("No size marker found in JPX stream")}parseCodestream(s,g,b){let c={},r=false;try{let t=g;for(;t+1<b;){let i=(0,D.readUint16)(s,t);t+=2;let e,o,d,u,p,l,h=0;switch(i){case 65359:c.mainHeader=!0;break;case 65497:break;case 65361:h=(0,D.readUint16)(s,t);let m={};m.Xsiz=(0,D.readUint32)(s,t+4),m.Ysiz=(0,D.readUint32)(s,t+8),m.XOsiz=(0,D.readUint32)(s,t+12),m.YOsiz=(0,D.readUint32)(s,t+16),m.XTsiz=(0,D.readUint32)(s,t+20),m.YTsiz=(0,D.readUint32)(s,t+24),m.XTOsiz=(0,D.readUint32)(s,t+28),m.YTOsiz=(0,D.readUint32)(s,t+32);let P=(0,D.readUint16)(s,t+36);m.Csiz=P;let O=[];e=t+38;for(let N=0;N<P;N++){let Y={precision:1+(127&s[e]),isSigned:!!(128&s[e]),XRsiz:s[e+1],YRsiz:s[e+2]};e+=3,st(Y,m),O.push(Y);}c.SIZ=m,c.components=O,pt(c,O),c.QCC=[],c.COC=[];break;case 65372:h=(0,D.readUint16)(s,t);let y={};switch(e=t+2,o=s[e++],31&o){case 0:u=8,p=!0;break;case 1:u=16,p=!1;break;case 2:u=16,p=!0;break;default:throw new Error("Invalid SQcd value "+o)}for(y.noQuantization=u===8,y.scalarExpounded=p,y.guardBits=o>>5,d=[];e<h+t;){let N={};u===8?(N.epsilon=s[e++]>>3,N.mu=0):(N.epsilon=s[e]>>3,N.mu=(7&s[e])<<8|s[e+1],e+=2),d.push(N);}y.SPqcds=d,c.mainHeader?c.QCD=y:(c.currentTile.QCD=y,c.currentTile.QCC=[]);break;case 65373:h=(0,D.readUint16)(s,t);let k={};e=t+2;let R;switch(c.SIZ.Csiz<257?R=s[e++]:(R=(0,D.readUint16)(s,e),e+=2),o=s[e++],31&o){case 0:u=8,p=!0;break;case 1:u=16,p=!1;break;case 2:u=16,p=!0;break;default:throw new Error("Invalid SQcd value "+o)}for(k.noQuantization=u===8,k.scalarExpounded=p,k.guardBits=o>>5,d=[];e<h+t;){let N={};u===8?(N.epsilon=s[e++]>>3,N.mu=0):(N.epsilon=s[e]>>3,N.mu=(7&s[e])<<8|s[e+1],e+=2),d.push(N);}k.SPqcds=d,c.mainHeader?c.QCC[R]=k:c.currentTile.QCC[R]=k;break;case 65362:h=(0,D.readUint16)(s,t);let L={};e=t+2;let U=s[e++];L.entropyCoderWithCustomPrecincts=!!(1&U),L.sopMarkerUsed=!!(2&U),L.ephMarkerUsed=!!(4&U),L.progressionOrder=s[e++],L.layersCount=(0,D.readUint16)(s,e),e+=2,L.multipleComponentTransform=s[e++],L.decompositionLevelsCount=s[e++],L.xcb=2+(15&s[e++]),L.ycb=2+(15&s[e++]);let z=s[e++];if(L.selectiveArithmeticCodingBypass=!!(1&z),L.resetContextProbabilities=!!(2&z),L.terminationOnEachCodingPass=!!(4&z),L.verticallyStripe=!!(8&z),L.predictableTermination=!!(16&z),L.segmentationSymbolUsed=!!(32&z),L.reversibleTransformation=s[e++],L.entropyCoderWithCustomPrecincts){let N=[];for(;e<h+t;){let Y=s[e++];N.push({PPx:15&Y,PPy:Y>>4});}L.precinctsSizes=N;}let G=[];L.selectiveArithmeticCodingBypass&&G.push("selectiveArithmeticCodingBypass"),L.terminationOnEachCodingPass&&G.push("terminationOnEachCodingPass"),L.verticallyStripe&&G.push("verticallyStripe"),L.predictableTermination&&G.push("predictableTermination"),G.length>0&&(r=!0,(0,Z.warn)(`JPX: Unsupported COD options (${G.join(", ")}).`)),c.mainHeader?c.COD=L:(c.currentTile.COD=L,c.currentTile.COC=[]);break;case 65424:h=(0,D.readUint16)(s,t),l={},l.index=(0,D.readUint16)(s,t+2),l.length=(0,D.readUint32)(s,t+4),l.dataEnd=l.length+t-2,l.partIndex=s[t+8],l.partsCount=s[t+9],c.mainHeader=!1,l.partIndex===0&&(l.COD=c.COD,l.COC=c.COC.slice(0),l.QCD=c.QCD,l.QCC=c.QCC.slice(0)),c.currentTile=l;break;case 65427:l=c.currentTile,l.partIndex===0&&(x(c,l.index),T(c)),h=l.dataEnd-t,J(c,s,t,h);break;case 65363:(0,Z.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");case 65365:case 65367:case 65368:case 65380:h=(0,D.readUint16)(s,t);break;default:throw new Error("Unknown codestream code: "+i.toString(16))}t+=h;}}catch(t){if(r||this.failOnCorruptedImage)throw new K(t.message);(0, Z.warn)(`JPX: Trying to recover from: "${t.message}".`);}this.tiles=(function(i){let e=i.SIZ,o=i.components,d=e.Csiz,u=[];for(let p=0,l=i.tiles.length;p<l;p++){let h=i.tiles[p],m=[];for(let Q=0;Q<d;Q++)m[Q]=it(i,h,Q);let P=m[0],O=new Uint8ClampedArray(P.items.length*d),y={left:P.left,top:P.top,width:P.width,height:P.height,items:O},k,R,L,U,z,G,N,Y=0;if(h.codingStyleDefaultParameters.multipleComponentTransform){let Q=d===4,X=m[0].items,W=m[1].items,ot=m[2].items,et=Q?m[3].items:null;k=o[0].precision-8,R=.5+(128<<k);let nt=h.components[0],tt=d-3;if(U=X.length,nt.codingStyleParameters.reversibleTransformation)for(L=0;L<U;L++,Y+=tt){z=X[L]+R,G=W[L],N=ot[L];let rt=z-(N+G>>2);O[Y++]=rt+N>>k,O[Y++]=rt>>k,O[Y++]=rt+G>>k;}else for(L=0;L<U;L++,Y+=tt)z=X[L]+R,G=W[L],N=ot[L],O[Y++]=z+1.402*N>>k,O[Y++]=z-.34413*G-.71414*N>>k,O[Y++]=z+1.772*G>>k;if(Q)for(L=0,Y=3;L<U;L++,Y+=4)O[Y]=et[L]+R>>k;}else for(let Q=0;Q<d;Q++){let X=m[Q].items;for(k=o[Q].precision-8,R=.5+(128<<k),Y=Q,L=0,U=X.length;L<U;L++)O[Y]=X[L]+R>>k,Y+=d;}u.push(y);}return u})(c),this.width=c.SIZ.Xsiz-c.SIZ.XOsiz,this.height=c.SIZ.Ysiz-c.SIZ.YOsiz,this.componentsCount=c.SIZ.Csiz;}};function st(M,s){M.x0=Math.ceil(s.XOsiz/M.XRsiz),M.x1=Math.ceil(s.Xsiz/M.XRsiz),M.y0=Math.ceil(s.YOsiz/M.YRsiz),M.y1=Math.ceil(s.Ysiz/M.YRsiz),M.width=M.x1-M.x0,M.height=M.y1-M.y0;}function pt(M,s){let g=M.SIZ,b=[],c,r=Math.ceil((g.Xsiz-g.XTOsiz)/g.XTsiz),t=Math.ceil((g.Ysiz-g.YTOsiz)/g.YTsiz);for(let i=0;i<t;i++)for(let e=0;e<r;e++)c={},c.tx0=Math.max(g.XTOsiz+e*g.XTsiz,g.XOsiz),c.ty0=Math.max(g.YTOsiz+i*g.YTsiz,g.YOsiz),c.tx1=Math.min(g.XTOsiz+(e+1)*g.XTsiz,g.Xsiz),c.ty1=Math.min(g.YTOsiz+(i+1)*g.YTsiz,g.Ysiz),c.width=c.tx1-c.tx0,c.height=c.ty1-c.ty0,c.components=[],b.push(c);M.tiles=b;for(let i=0,e=g.Csiz;i<e;i++){let o=s[i];for(let d=0,u=b.length;d<u;d++){let p={};c=b[d],p.tcx0=Math.ceil(c.tx0/o.XRsiz),p.tcy0=Math.ceil(c.ty0/o.YRsiz),p.tcx1=Math.ceil(c.tx1/o.XRsiz),p.tcy1=Math.ceil(c.ty1/o.YRsiz),p.width=p.tcx1-p.tcx0,p.height=p.tcy1-p.tcy0,c.components[i]=p;}}}function ft(M,s,g){let b=s.codingStyleParameters,c={};return b.entropyCoderWithCustomPrecincts?(c.PPx=b.precinctsSizes[g].PPx,c.PPy=b.precinctsSizes[g].PPy):(c.PPx=15,c.PPy=15),c.xcb_=g>0?Math.min(b.xcb,c.PPx-1):Math.min(b.xcb,c.PPx),c.ycb_=g>0?Math.min(b.ycb,c.PPy-1):Math.min(b.ycb,c.PPy),c}function lt(M,s,g){let b=1<<g.PPx,c=1<<g.PPy,r=s.resLevel===0,t=1<<g.PPx+(r?0:-1),i=1<<g.PPy+(r?0:-1),e=s.trx1>s.trx0?Math.ceil(s.trx1/b)-Math.floor(s.trx0/b):0,o=s.try1>s.try0?Math.ceil(s.try1/c)-Math.floor(s.try0/c):0,d=e*o;s.precinctParameters={precinctWidth:b,precinctHeight:c,numprecinctswide:e,numprecinctshigh:o,numprecincts:d,precinctWidthInSubband:t,precinctHeightInSubband:i};}function B(M,s,g){let b=g.xcb_,c=g.ycb_,r=1<<b,t=1<<c,i=s.tbx0>>b,e=s.tby0>>c,o=s.tbx1+r-1>>b,d=s.tby1+t-1>>c,u=s.resolution.precinctParameters,p=[],l=[],h,m,P,O;for(m=e;m<d;m++)for(h=i;h<o;h++){if(P={cbx:h,cby:m,tbx0:r*h,tby0:t*m,tbx1:r*(h+1),tby1:t*(m+1)},P.tbx0_=Math.max(s.tbx0,P.tbx0),P.tby0_=Math.max(s.tby0,P.tby0),P.tbx1_=Math.min(s.tbx1,P.tbx1),P.tby1_=Math.min(s.tby1,P.tby1),O=Math.floor((P.tbx0_-s.tbx0)/u.precinctWidthInSubband)+Math.floor((P.tby0_-s.tby0)/u.precinctHeightInSubband)*u.numprecinctswide,P.precinctNumber=O,P.subbandType=s.type,P.Lblock=3,P.tbx1_<=P.tbx0_||P.tby1_<=P.tby0_)continue;p.push(P);let y=l[O];y!==void 0?(h<y.cbxMin?y.cbxMin=h:h>y.cbxMax&&(y.cbxMax=h),m<y.cbyMin?y.cbxMin=m:m>y.cbyMax&&(y.cbyMax=m)):l[O]=y={cbxMin:h,cbyMin:m,cbxMax:h,cbyMax:m},P.precinct=y;}s.codeblockParameters={codeblockWidth:b,codeblockHeight:c,numcodeblockwide:o-i+1,numcodeblockhigh:d-e+1},s.codeblocks=p,s.precincts=l;}function H(M,s,g){let b=[],c=M.subbands;for(let r=0,t=c.length;r<t;r++){let i=c[r].codeblocks;for(let e=0,o=i.length;e<o;e++){let d=i[e];d.precinctNumber===s&&b.push(d);}}return {layerNumber:g,codeblocks:b}}function j(M){let s=M.SIZ,g=M.currentTile.index,b=M.tiles[g],c=b.codingStyleDefaultParameters.layersCount,r=s.Csiz,t=0;for(let u=0;u<r;u++)t=Math.max(t,b.components[u].codingStyleParameters.decompositionLevelsCount);let i=0,e=0,o=0,d=0;this.nextPacket=function(){for(;i<c;i++){for(;e<=t;e++){for(;o<r;o++){let p=b.components[o];if(e>p.codingStyleParameters.decompositionLevelsCount)continue;let l=p.resolutions[e],h=l.precinctParameters.numprecincts;for(;d<h;){let m=H(l,d,i);return d++,m}d=0;}o=0;}e=0;}throw new K("Out of packets")};}function A(M){let s=M.SIZ,g=M.currentTile.index,b=M.tiles[g],c=b.codingStyleDefaultParameters.layersCount,r=s.Csiz,t=0;for(let u=0;u<r;u++)t=Math.max(t,b.components[u].codingStyleParameters.decompositionLevelsCount);let i=0,e=0,o=0,d=0;this.nextPacket=function(){for(;i<=t;i++){for(;e<c;e++){for(;o<r;o++){let p=b.components[o];if(i>p.codingStyleParameters.decompositionLevelsCount)continue;let l=p.resolutions[i],h=l.precinctParameters.numprecincts;for(;d<h;){let m=H(l,d,e);return d++,m}d=0;}o=0;}e=0;}throw new K("Out of packets")};}function C(M){let s=M.SIZ,g=M.currentTile.index,b=M.tiles[g],c=b.codingStyleDefaultParameters.layersCount,r=s.Csiz,t,i,e,o,d=0;for(e=0;e<r;e++){let p=b.components[e];d=Math.max(d,p.codingStyleParameters.decompositionLevelsCount);}let u=new Int32Array(d+1);for(i=0;i<=d;++i){let p=0;for(e=0;e<r;++e){let l=b.components[e].resolutions;i<l.length&&(p=Math.max(p,l[i].precinctParameters.numprecincts));}u[i]=p;}t=0,i=0,e=0,o=0,this.nextPacket=function(){for(;i<=d;i++){for(;o<u[i];o++){for(;e<r;e++){let l=b.components[e];if(i>l.codingStyleParameters.decompositionLevelsCount)continue;let h=l.resolutions[i],m=h.precinctParameters.numprecincts;if(!(o>=m)){for(;t<c;){let P=H(h,o,t);return t++,P}t=0;}}e=0;}o=0;}throw new K("Out of packets")};}function E(M){let s=M.SIZ,g=M.currentTile.index,b=M.tiles[g],c=b.codingStyleDefaultParameters.layersCount,r=s.Csiz,t=a(b),i=t,e=0,o=0,d=0,u=0,p=0;this.nextPacket=function(){for(;p<i.maxNumHigh;p++){for(;u<i.maxNumWide;u++){for(;d<r;d++){let h=b.components[d],m=h.codingStyleParameters.decompositionLevelsCount;for(;o<=m;o++){let P=h.resolutions[o],O=t.components[d].resolutions[o],y=n(u,p,O,i,P);if(y!==null){for(;e<c;){let k=H(P,y,e);return e++,k}e=0;}}o=0;}d=0;}u=0;}throw new K("Out of packets")};}function f(M){let s=M.SIZ,g=M.currentTile.index,b=M.tiles[g],c=b.codingStyleDefaultParameters.layersCount,r=s.Csiz,t=a(b),i=0,e=0,o=0,d=0,u=0;this.nextPacket=function(){for(;o<r;++o){let l=b.components[o],h=t.components[o],m=l.codingStyleParameters.decompositionLevelsCount;for(;u<h.maxNumHigh;u++){for(;d<h.maxNumWide;d++){for(;e<=m;e++){let P=l.resolutions[e],O=h.resolutions[e],y=n(d,u,O,h,P);if(y!==null){for(;i<c;){let k=H(P,y,i);return i++,k}i=0;}}e=0;}d=0;}u=0;}throw new K("Out of packets")};}function n(M,s,g,b,c){let r=M*b.minWidth,t=s*b.minHeight;if(r%g.width!=0||t%g.height!=0)return null;let i=t/g.width*c.precinctParameters.numprecinctswide;return r/g.height+i}function a(M){let s=M.components.length,g=Number.MAX_VALUE,b=Number.MAX_VALUE,c=0,r=0,t=new Array(s);for(let i=0;i<s;i++){let e=M.components[i],o=e.codingStyleParameters.decompositionLevelsCount,d=new Array(o+1),u=Number.MAX_VALUE,p=Number.MAX_VALUE,l=0,h=0,m=1;for(let P=o;P>=0;--P){let O=e.resolutions[P],y=m*O.precinctParameters.precinctWidth,k=m*O.precinctParameters.precinctHeight;u=Math.min(u,y),p=Math.min(p,k),l=Math.max(l,O.precinctParameters.numprecinctswide),h=Math.max(h,O.precinctParameters.numprecinctshigh),d[P]={width:y,height:k},m<<=1;}g=Math.min(g,u),b=Math.min(b,p),c=Math.max(c,l),r=Math.max(r,h),t[i]={resolutions:d,minWidth:u,minHeight:p,maxNumWide:l,maxNumHigh:h};}return {components:t,minWidth:g,minHeight:b,maxNumWide:c,maxNumHigh:r}}function T(M){let s=M.SIZ,g=M.currentTile.index,b=M.tiles[g],c=s.Csiz;for(let t=0;t<c;t++){let i=b.components[t],e=i.codingStyleParameters.decompositionLevelsCount,o=[],d=[];for(let u=0;u<=e;u++){let p=ft(0,i,u),l={},h=1<<e-u;l.trx0=Math.ceil(i.tcx0/h),l.try0=Math.ceil(i.tcy0/h),l.trx1=Math.ceil(i.tcx1/h),l.try1=Math.ceil(i.tcy1/h),l.resLevel=u,lt(0,l,p),o.push(l);let m;if(u===0)m={},m.type="LL",m.tbx0=Math.ceil(i.tcx0/h),m.tby0=Math.ceil(i.tcy0/h),m.tbx1=Math.ceil(i.tcx1/h),m.tby1=Math.ceil(i.tcy1/h),m.resolution=l,B(0,m,p),d.push(m),l.subbands=[m];else {let P=1<<e-u+1,O=[];m={},m.type="HL",m.tbx0=Math.ceil(i.tcx0/P-.5),m.tby0=Math.ceil(i.tcy0/P),m.tbx1=Math.ceil(i.tcx1/P-.5),m.tby1=Math.ceil(i.tcy1/P),m.resolution=l,B(0,m,p),d.push(m),O.push(m),m={},m.type="LH",m.tbx0=Math.ceil(i.tcx0/P),m.tby0=Math.ceil(i.tcy0/P-.5),m.tbx1=Math.ceil(i.tcx1/P),m.tby1=Math.ceil(i.tcy1/P-.5),m.resolution=l,B(0,m,p),d.push(m),O.push(m),m={},m.type="HH",m.tbx0=Math.ceil(i.tcx0/P-.5),m.tby0=Math.ceil(i.tcy0/P-.5),m.tbx1=Math.ceil(i.tcx1/P-.5),m.tby1=Math.ceil(i.tcy1/P-.5),m.resolution=l,B(0,m,p),d.push(m),O.push(m),l.subbands=O;}}i.resolutions=o,i.subbands=d;}let r=b.codingStyleDefaultParameters.progressionOrder;switch(r){case 0:b.packetsIterator=new j(M);break;case 1:b.packetsIterator=new A(M);break;case 2:b.packetsIterator=new C(M);break;case 3:b.packetsIterator=new E(M);break;case 4:b.packetsIterator=new f(M);break;default:throw new K(`Unsupported progression order ${r}`)}}function J(M,s,g,b){let c,r=0,t=0,i=false;function e(y){for(;t<y;){let k=s[g+r];r++,i?(c=c<<7|k,t+=7,i=false):(c=c<<8|k,t+=8),k===255&&(i=true);}return t-=y,c>>>t&(1<<y)-1}function o(y){return s[g+r-1]===255&&s[g+r]===y?(d(1),true):s[g+r]===255&&s[g+r+1]===y?(d(2),true):false}function d(y){r+=y;}function u(){t=0,i&&(r++,i=false);}function p(){if(e(1)===0)return 1;if(e(1)===0)return 2;let y=e(2);return y<3?y+3:(y=e(5),y<31?y+6:(y=e(7),y+37))}let l=M.currentTile.index,h=M.tiles[l],m=M.COD.sopMarkerUsed,P=M.COD.ephMarkerUsed,O=h.packetsIterator;for(;r<b;){u(),m&&o(145)&&d(4);let y=O.nextPacket();if(!e(1))continue;let k=y.layerNumber,R=[],L;for(let U=0,z=y.codeblocks.length;U<z;U++){L=y.codeblocks[U];let G=L.precinct,N=L.cbx-G.cbxMin,Y=L.cby-G.cbyMin,Q,X,W=false,ot=false;if(L.included!==void 0)W=!!e(1);else {G=L.precinct;let rt;if(G.inclusionTree!==void 0)rt=G.inclusionTree;else {let ut=G.cbxMax-G.cbxMin+1,ht=G.cbyMax-G.cbyMin+1;rt=new V(ut,ht,k),X=new v(ut,ht),G.inclusionTree=rt,G.zeroBitPlanesTree=X;for(let dt=0;dt<k;dt++)if(e(1)!==0)throw new K("Invalid tag tree")}if(rt.reset(N,Y,k))for(;;){if(!e(1)){rt.incrementValue(k);break}if(Q=!rt.nextLevel(),Q){L.included=true,W=ot=true;break}}}if(!W)continue;if(ot){for(X=G.zeroBitPlanesTree,X.reset(N,Y);;)if(e(1)){if(Q=!X.nextLevel(),Q)break}else X.incrementValue();L.zeroBitPlanes=X.value;}let et=p();for(;e(1);)L.Lblock++;let nt=(0, D.log2)(et),tt=e((et<1<<nt?nt-1:nt)+L.Lblock);R.push({codeblock:L,codingpasses:et,dataLength:tt});}for(u(),P&&o(146);R.length>0;){let U=R.shift();L=U.codeblock,L.data===void 0&&(L.data=[]),L.data.push({data:s,start:g+r,end:g+r+U.dataLength,codingpasses:U.codingpasses}),r+=U.dataLength;}}return r}function ct(M,s,g,b,c,r,t,i,e){let o=b.tbx0,d=b.tby0,u=b.tbx1-b.tbx0,p=b.codeblocks,l=b.type.charAt(0)==="H"?1:0,h=b.type.charAt(1)==="H"?s:0;for(let m=0,P=p.length;m<P;++m){let O=p[m],y=O.tbx1_-O.tbx0_,k=O.tby1_-O.tby0_;if(y===0||k===0||O.data===void 0)continue;let R=new _(y,k,O.subbandType,O.zeroBitPlanes,r),L=2,U=O.data,z,G,N,Y=0,Q=0;for(z=0,G=U.length;z<G;z++)N=U[z],Y+=N.end-N.start,Q+=N.codingpasses;let X=new Uint8Array(Y),W=0;for(z=0,G=U.length;z<G;z++){N=U[z];let Ct=N.data.subarray(N.start,N.end);X.set(Ct,W),W+=Ct.length;}let ot=new at.ArithmeticDecoder(X,0,Y);for(R.setDecoder(ot),z=0;z<Q;z++){switch(L){case 0:R.runSignificancePropagationPass();break;case 1:R.runMagnitudeRefinementPass();break;case 2:R.runCleanupPass(),i&&R.checkSegmentationSymbol();}e&&R.reset(),L=(L+1)%3;}let et=O.tbx0_-o+(O.tby0_-d)*u,nt=R.coefficentsSign,tt=R.coefficentsMagnitude,rt=R.bitsDecoded,ut=t?0:.5,ht,dt,yt;W=0;let wt=b.type!=="LL";for(z=0;z<k;z++){let Ct=2*(et/u|0)*(s-u)+l+h;for(ht=0;ht<y;ht++)dt=tt[W],dt!==0&&(dt=(dt+ut)*c,nt[W]!==0&&(dt=-dt),yt=rt[W],M[wt?Ct+(et<<1):et]=t&&yt>=r?dt:dt*(1<<r-yt)),et++,W++;et+=u-y;}}}function it(M,s,g){let b=s.components[g],c=b.codingStyleParameters,r=b.quantizationParameters,t=c.decompositionLevelsCount,i=r.SPqcds,e=r.scalarExpounded,o=r.guardBits,d=c.segmentationSymbolUsed,u=c.resetContextProbabilities,p=M.components[g].precision,l=c.reversibleTransformation,h=l?new S:new F,m=[],P=0;for(let y=0;y<=t;y++){let k=b.resolutions[y],R=k.trx1-k.trx0,L=k.try1-k.try0,U=new Float32Array(R*L);for(let z=0,G=k.subbands.length;z<G;z++){let N,Y;e?(N=i[P].mu,Y=i[P].epsilon,P++):(N=i[0].mu,Y=i[0].epsilon+(y>0?1-y:0));let Q=k.subbands[z],X=$[Q.type];ct(U,R,0,Q,l?1:2**(p+X-Y)*(1+N/2048),o+Y-1,l,d,u);}m.push({width:R,height:L,items:U});}let O=h.calculate(m,b.tcx0,b.tcy0);return {left:b.tcx0,top:b.tcy0,width:O.width,height:O.height,items:O.items}}function x(M,s){let g=M.SIZ.Csiz,b=M.tiles[s];for(let c=0;c<g;c++){let r=b.components[c],t=M.currentTile.QCC[c]!==void 0?M.currentTile.QCC[c]:M.currentTile.QCD;r.quantizationParameters=t;let i=M.currentTile.COC[c]!==void 0?M.currentTile.COC[c]:M.currentTile.COD;r.codingStyleParameters=i;}b.codingStyleDefaultParameters=M.currentTile.COD;}class v{constructor(s,g){let b=(0, D.log2)(Math.max(s,g))+1;this.levels=[];for(let c=0;c<b;c++){let r={width:s,height:g,items:[]};this.levels.push(r),s=Math.ceil(s/2),g=Math.ceil(g/2);}}reset(s,g){let b,c=0,r=0;for(;c<this.levels.length;){b=this.levels[c];let t=s+g*b.width;if(b.items[t]!==void 0){r=b.items[t];break}b.index=t,s>>=1,g>>=1,c++;}c--,b=this.levels[c],b.items[b.index]=r,this.currentLevel=c,delete this.value;}incrementValue(){let s=this.levels[this.currentLevel];s.items[s.index]++;}nextLevel(){let s=this.currentLevel,g=this.levels[s],b=g.items[g.index];return s--,s<0?(this.value=b,false):(this.currentLevel=s,g=this.levels[s],g.items[g.index]=b,true)}}class V{constructor(s,g,b){let c=(0, D.log2)(Math.max(s,g))+1;this.levels=[];for(let r=0;r<c;r++){let t=new Uint8Array(s*g);for(let e=0,o=t.length;e<o;e++)t[e]=b;let i={width:s,height:g,items:t};this.levels.push(i),s=Math.ceil(s/2),g=Math.ceil(g/2);}}reset(s,g,b){let c=0;for(;c<this.levels.length;){let r=this.levels[c],t=s+g*r.width;r.index=t;let i=r.items[t];if(i===255)break;if(i>b)return this.currentLevel=c,this.propagateValues(),false;s>>=1,g>>=1,c++;}return this.currentLevel=c-1,true}incrementValue(s){let g=this.levels[this.currentLevel];g.items[g.index]=s+1,this.propagateValues();}propagateValues(){let s=this.currentLevel,g=this.levels[s],b=g.items[g.index];for(;--s>=0;)g=this.levels[s],g.items[g.index]=b;}nextLevel(){let s=this.currentLevel,g=this.levels[s],b=g.items[g.index];return g.items[g.index]=255,s--,s<0?false:(this.currentLevel=s,g=this.levels[s],g.items[g.index]=b,true)}}let q=class q{constructor(s,g,b,c,r){this.width=s,this.height=g;let t;t=b==="HH"?q.HHContextLabel:b==="HL"?q.HLContextLabel:q.LLAndLHContextsLabel,this.contextLabelTable=t;let i=s*g;this.neighborsSignificance=new Uint8Array(i),this.coefficentsSign=new Uint8Array(i);let e;e=r>14?new Uint32Array(i):r>6?new Uint16Array(i):new Uint8Array(i),this.coefficentsMagnitude=e,this.processingFlags=new Uint8Array(i);let o=new Uint8Array(i);if(c!==0)for(let d=0;d<i;d++)o[d]=c;this.bitsDecoded=o,this.reset();}setDecoder(s){this.decoder=s;}reset(){this.contexts=new Int8Array(19),this.contexts[0]=8,this.contexts[q.UNIFORM_CONTEXT]=92,this.contexts[q.RUNLENGTH_CONTEXT]=6;}setNeighborsSignificance(s,g,b){let c=this.neighborsSignificance,r=this.width,t=this.height,i=g>0,e=g+1<r,o;s>0&&(o=b-r,i&&(c[o-1]+=16),e&&(c[o+1]+=16),c[o]+=4),s+1<t&&(o=b+r,i&&(c[o-1]+=16),e&&(c[o+1]+=16),c[o]+=4),i&&(c[b-1]+=1),e&&(c[b+1]+=1),c[b]|=128;}runSignificancePropagationPass(){let s=this.decoder,g=this.width,b=this.height,c=this.coefficentsMagnitude,r=this.coefficentsSign,t=this.neighborsSignificance,i=this.processingFlags,e=this.contexts,o=this.contextLabelTable,d=this.bitsDecoded;for(let u=0;u<b;u+=4)for(let p=0;p<g;p++){let l=u*g+p;for(let h=0;h<4;h++,l+=g){let m=u+h;if(m>=b)break;if(i[l]&=-2,c[l]||!t[l])continue;let P=o[t[l]];if(s.readBit(e,P)){let O=this.decodeSignBit(m,p,l);r[l]=O,c[l]=1,this.setNeighborsSignificance(m,p,l),i[l]|=2;}d[l]++,i[l]|=1;}}}decodeSignBit(s,g,b){let c=this.width,r=this.height,t=this.coefficentsMagnitude,i=this.coefficentsSign,e,o,d,u,p,l;u=g>0&&t[b-1]!==0,g+1<c&&t[b+1]!==0?(d=i[b+1],u?(o=i[b-1],e=1-d-o):e=1-d-d):u?(o=i[b-1],e=1-o-o):e=0;let h=3*e;return u=s>0&&t[b-c]!==0,s+1<r&&t[b+c]!==0?(d=i[b+c],u?(o=i[b-c],e=1-d-o+h):e=1-d-d+h):u?(o=i[b-c],e=1-o-o+h):e=h,e>=0?(p=9+e,l=this.decoder.readBit(this.contexts,p)):(p=9-e,l=1^this.decoder.readBit(this.contexts,p)),l}runMagnitudeRefinementPass(){let s=this.decoder,g=this.width,b=this.height,c=this.coefficentsMagnitude,r=this.neighborsSignificance,t=this.contexts,i=this.bitsDecoded,e=this.processingFlags,o=g*b,d=4*g;for(let u,p=0;p<o;p=u){u=Math.min(o,p+d);for(let l=0;l<g;l++)for(let h=p+l;h<u;h+=g){if(!c[h]||(1&e[h])!=0)continue;let m=16;(2&e[h])!=0&&(e[h]^=2,m=(127&r[h])===0?15:14);let P=s.readBit(t,m);c[h]=c[h]<<1|P,i[h]++,e[h]|=1;}}}runCleanupPass(){let s=this.decoder,g=this.width,b=this.height,c=this.neighborsSignificance,r=this.coefficentsMagnitude,t=this.coefficentsSign,i=this.contexts,e=this.contextLabelTable,o=this.bitsDecoded,d=this.processingFlags,u=g,p=2*g,l=3*g,h;for(let m=0;m<b;m=h){h=Math.min(m+4,b);let P=m*g,O=m+3<b;for(let y=0;y<g;y++){let k=P+y,R,L=0,U=k,z=m;if(O&&d[k]===0&&d[k+u]===0&&d[k+p]===0&&d[k+l]===0&&c[k]===0&&c[k+u]===0&&c[k+p]===0&&c[k+l]===0){if(!s.readBit(i,q.RUNLENGTH_CONTEXT)){o[k]++,o[k+u]++,o[k+p]++,o[k+l]++;continue}L=s.readBit(i,q.UNIFORM_CONTEXT)<<1|s.readBit(i,q.UNIFORM_CONTEXT),L!==0&&(z=m+L,U+=L*g),R=this.decodeSignBit(z,y,U),t[U]=R,r[U]=1,this.setNeighborsSignificance(z,y,U),d[U]|=2,U=k;for(let G=m;G<=z;G++,U+=g)o[U]++;L++;}for(z=m+L;z<h;z++,U+=g){if(r[U]||(1&d[U])!=0)continue;let G=e[c[U]];s.readBit(i,G)===1&&(R=this.decodeSignBit(z,y,U),t[U]=R,r[U]=1,this.setNeighborsSignificance(z,y,U),d[U]|=2),o[U]++;}}}}checkSegmentationSymbol(){let s=this.decoder,g=this.contexts;if((s.readBit(g,q.UNIFORM_CONTEXT)<<3|s.readBit(g,q.UNIFORM_CONTEXT)<<2|s.readBit(g,q.UNIFORM_CONTEXT)<<1|s.readBit(g,q.UNIFORM_CONTEXT))!==10)throw new K("Invalid segmentation symbol")}};c(q,"UNIFORM_CONTEXT",17),c(q,"RUNLENGTH_CONTEXT",18),c(q,"LLAndLHContextsLabel",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])),c(q,"HLContextLabel",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])),c(q,"HHContextLabel",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]));let _=q;class I{constructor(){this.constructor===I&&(0, Z.unreachable)("Cannot initialize Transform.");}calculate(s,g,b){let c=s[0];for(let r=1,t=s.length;r<t;r++)c=this.iterate(c,s[r],g,b);return c}extend(s,g,b){let c=g-1,r=g+1,t=g+b-2,i=g+b;s[c--]=s[r++],s[i++]=s[t--],s[c--]=s[r++],s[i++]=s[t--],s[c--]=s[r++],s[i++]=s[t--],s[c]=s[r],s[i]=s[t];}filter(s,g,b){(0, Z.unreachable)("Abstract method `filter` called");}iterate(s,g,b,c){let r=s.width,t=s.height,i=s.items,e=g.width,o=g.height,d=g.items,u,p,l,h,m,P;for(l=0,u=0;u<t;u++)for(h=2*u*e,p=0;p<r;p++,l++,h+=2)d[h]=i[l];i=s.items=null;let O=new Float32Array(e+8);if(e===1){if((1&b)!=0)for(P=0,l=0;P<o;P++,l+=e)d[l]*=.5;}else for(P=0,l=0;P<o;P++,l+=e)O.set(d.subarray(l,l+e),4),this.extend(O,4,e),this.filter(O,4,e),d.set(O.subarray(4,4+e),l);let y=16,k=[];for(u=0;u<y;u++)k.push(new Float32Array(o+8));let R,L=0;if(s=4+o,o===1){if((1&c)!=0)for(m=0;m<e;m++)d[m]*=.5;}else for(m=0;m<e;m++){if(L===0){for(y=Math.min(e-m,y),l=m,h=4;h<s;l+=e,h++)for(R=0;R<y;R++)k[R][h]=d[l+R];L=y;}L--;let U=k[L];if(this.extend(U,4,o),this.filter(U,4,o),L===0)for(l=m-y+1,h=4;h<s;l+=e,h++)for(R=0;R<y;R++)d[l+R]=k[R][h];}return {width:e,height:o,items:d}}}class F extends I{filter(s,g,b){let c=b>>1,r,t,i,e,o=-1.586134342059924,d=-0.052980118572961,u=.882911075530934,p=.443506852043971,l=1.230174104914001;for(r=(g|=0)-3,t=c+4;t--;r+=2)s[r]*=.8128930661159609;for(r=g-2,i=p*s[r-1],t=c+3;t--&&(e=p*s[r+1],s[r]=l*s[r]-i-e,!!t--);r+=2)r+=2,i=p*s[r+1],s[r]=l*s[r]-i-e;for(r=g-1,i=u*s[r-1],t=c+2;t--&&(e=u*s[r+1],s[r]-=i+e,!!t--);r+=2)r+=2,i=u*s[r+1],s[r]-=i+e;for(r=g,i=d*s[r-1],t=c+1;t--&&(e=d*s[r+1],s[r]-=i+e,!!t--);r+=2)r+=2,i=d*s[r+1],s[r]-=i+e;if(c!==0)for(r=g+1,i=o*s[r-1],t=c;t--&&(e=o*s[r+1],s[r]-=i+e,!!t--);r+=2)r+=2,i=o*s[r+1],s[r]-=i+e;}}class S extends I{filter(s,g,b){let c=b>>1,r,t;for(r=g|=0,t=c+1;t--;r+=2)s[r]-=s[r-1]+s[r+1]+2>>2;for(r=g+1,t=c;t--;r+=2)s[r]+=s[r-1]+s[r+1]>>1;}}}],Mt={};function _t(It){var w=Mt[It];if(w!==void 0)return w.exports;var gt=Mt[It]={exports:{}};return jt[It](gt,gt.exports,_t),gt.exports}var qt={};return (()=>{var It=qt;Object.defineProperty(It,"__esModule",{value:true}),Object.defineProperty(It,"Jbig2Image",{enumerable:true,get:function(){return gt.Jbig2Image}}),Object.defineProperty(It,"JpegImage",{enumerable:true,get:function(){return Z.JpegImage}}),Object.defineProperty(It,"JpxImage",{enumerable:true,get:function(){return D.JpxImage}}),Object.defineProperty(It,"getVerbosityLevel",{enumerable:true,get:function(){return w.getVerbosityLevel}}),Object.defineProperty(It,"setVerbosityLevel",{enumerable:true,get:function(){return w.setVerbosityLevel}});var w=_t(1),gt=_t(2),Z=_t(8),D=_t(10);})(),qt})()));});var pdf_image_decoders_min5CGUOWQR = Vt();export{pdf_image_decoders_min5CGUOWQR as default};
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@namahapdf/core",
3
+ "version": "0.1.0",
4
+ "description": "Headless in-browser PDF engine — parse, render, edit, annotate, sign, redact, fill forms. The core of the NamahaPDF SDK.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ }
17
+ },
18
+ "files": ["dist", "README.md", "LICENSE"],
19
+ "scripts": {
20
+ "build": "tsup"
21
+ },
22
+ "dependencies": {
23
+ "@noble/curves": "^1.6.0",
24
+ "pdf-lib": "^1.17.1"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "engines": {
30
+ "node": ">=18"
31
+ },
32
+ "keywords": ["pdf", "pdf-editor", "pdf-viewer", "annotate", "sign", "sdk"]
33
+ }