UNPKG

pdfjs-dist

Version:

Generic build of Mozilla's PDF.js library.

26 lines • 99.8 kB
/** * @licstart The following is the entire license notice for the * JavaScript code in this page * * Copyright 2024 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @licend The above is the entire license notice for the * JavaScript code in this page */ /** * pdfjsVersion = 5.3.93 * pdfjsBuild = cbeef3233 */ "object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type;const e={ERRORS:0,WARNINGS:1,INFOS:5};let t=e.WARNINGS;function setVerbosityLevel(e){Number.isInteger(e)&&(t=e)}function getVerbosityLevel(){return t}function info(n){t>=e.INFOS&&console.log(`Info: ${n}`)}function util_warn(n){t>=e.WARNINGS&&console.log(`Warning: ${n}`)}function unreachable(e){throw new Error(e)}function shadow(e,t,n,r=!1){Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1});return n}const n=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class FormatError extends n{constructor(e){super(e,"FormatError")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const r=[];for(let i=0;i<t;i+=n){const s=Math.min(i+n,t),o=e.subarray(i,s);r.push(String.fromCharCode.apply(null,o))}return r.join("")}class util_FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){const{platform:e,userAgent:t}=navigator;return shadow(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const r=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class util_Util{static makeHexColor(e,t,n){return`#${r[e]}${r[t]}${r[n]}`}static scaleMinMax(e,t){let n;if(e[0]){if(e[0]<0){n=t[0];t[0]=t[2];t[2]=n}t[0]*=e[0];t[2]*=e[0];if(e[3]<0){n=t[1];t[1]=t[3];t[3]=n}t[1]*=e[3];t[3]*=e[3]}else{n=t[0];t[0]=t[1];t[1]=n;n=t[2];t[2]=t[3];t[3]=n;if(e[1]<0){n=t[1];t[1]=t[3];t[3]=n}t[1]*=e[1];t[3]*=e[1];if(e[2]<0){n=t[0];t[0]=t[2];t[2]=n}t[0]*=e[2];t[2]*=e[2]}t[0]+=e[4];t[1]+=e[5];t[2]+=e[4];t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t,n=0){const r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4];e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){const r=t[0],i=t[1],s=t[2],o=t[3],a=t[4],c=t[5];for(let t=0;t<6;t+=2){const l=e[n+t],h=e[n+t+1];e[n+t]=l*r+h*s+a;e[n+t+1]=l*i+h*o+c}}static applyInverseTransform(e,t){const n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i;e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){const r=t[0],i=t[1],s=t[2],o=t[3],a=t[4],c=t[5],l=e[0],h=e[1],f=e[2],u=e[3];let d=r*l+a,m=d,g=r*f+a,p=g,b=o*h+c,w=b,y=o*u+c,C=y;if(0!==i||0!==s){const e=i*l,t=i*f,n=s*h,r=s*u;d+=n;p+=n;g+=r;m+=r;b+=e;C+=e;y+=t;w+=t}n[0]=Math.min(n[0],d,g,m,p);n[1]=Math.min(n[1],b,y,w,C);n[2]=Math.max(n[2],d,g,m,p);n[3]=Math.max(n[3],b,y,w,C)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const n=e[0],r=e[1],i=e[2],s=e[3],o=n**2+r**2,a=n*i+r*s,c=i**2+s**2,l=(o+c)/2,h=Math.sqrt(l**2-(o*c-a**2));t[0]=Math.sqrt(l+h||1);t[1]=Math.sqrt(l-h||1)}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>s?null:[n,i,r,s]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e);n[1]=Math.min(n[1],t);n[2]=Math.max(n[2],e);n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n);i[1]=Math.min(i[1],t,r);i[2]=Math.max(i[2],e,n);i[3]=Math.max(i[3],t,r)}static#e(e,t,n,r,i,s,o,a,c,l){if(c<=0||c>=1)return;const h=1-c,f=c*c,u=f*c,d=h*(h*(h*e+3*c*t)+3*f*n)+u*r,m=h*(h*(h*i+3*c*s)+3*f*o)+u*a;l[0]=Math.min(l[0],d);l[1]=Math.min(l[1],m);l[2]=Math.max(l[2],d);l[3]=Math.max(l[3],m)}static#t(e,t,n,r,i,s,o,a,c,l,h,f){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,n,r,i,s,o,a,-h/l,f);return}const u=l**2-4*h*c;if(u<0)return;const d=Math.sqrt(u),m=2*c;this.#e(e,t,n,r,i,s,o,a,(-l+d)/m,f);this.#e(e,t,n,r,i,s,o,a,(-l-d)/m,f)}static bezierBoundingBox(e,t,n,r,i,s,o,a,c){c[0]=Math.min(c[0],e,o);c[1]=Math.min(c[1],t,a);c[2]=Math.max(c[2],e,o);c[3]=Math.max(c[3],t,a);this.#t(e,n,i,o,t,r,s,a,3*(3*(n-i)-e+o),6*(e-2*n+i),3*(n-e),c);this.#t(e,n,i,o,t,r,s,a,3*(3*(r-s)-t+a),6*(t-2*r+s),3*(r-t),c)}}function MathClamp(e,t,n){return Math.min(Math.max(e,t),n)}"function"!=typeof Promise.try&&(Promise.try=function(e,...t){return new Promise((n=>{n(e(...t))}))});"function"!=typeof Math.sumPrecise&&(Math.sumPrecise=function(e){return e.reduce(((e,t)=>e+t),0)});Symbol("CIRCULAR_REF"),Symbol("EOF");Object.create(null);let i=Object.create(null),s=Object.create(null);class Name{constructor(e){this.name=e}static get(e){return i[e]||=new Name(e)}}const o=function nonSerializableClosure(){return o};class primitives_Dict{constructor(e=null){this._map=new Map;this.xref=e;this.objId=null;this.suppressEncryption=!1;this.__nonSerializable__=o}assignXref(e){this.xref=e}get size(){return this._map.size}get(e,t,n){let r=this._map.get(e);if(void 0===r&&void 0!==t){r=this._map.get(t);void 0===r&&void 0!==n&&(r=this._map.get(n))}return r instanceof primitives_Ref&&this.xref?this.xref.fetch(r,this.suppressEncryption):r}async getAsync(e,t,n){let r=this._map.get(e);if(void 0===r&&void 0!==t){r=this._map.get(t);void 0===r&&void 0!==n&&(r=this._map.get(n))}return r instanceof primitives_Ref&&this.xref?this.xref.fetchAsync(r,this.suppressEncryption):r}getArray(e,t,n){let r=this._map.get(e);if(void 0===r&&void 0!==t){r=this._map.get(t);void 0===r&&void 0!==n&&(r=this._map.get(n))}r instanceof primitives_Ref&&this.xref&&(r=this.xref.fetch(r,this.suppressEncryption));if(Array.isArray(r)){r=r.slice();for(let e=0,t=r.length;e<t;e++)r[e]instanceof primitives_Ref&&this.xref&&(r[e]=this.xref.fetch(r[e],this.suppressEncryption))}return r}getRaw(e){return this._map.get(e)}getKeys(){return[...this._map.keys()]}getRawValues(){return[...this._map.values()]}set(e,t){this._map.set(e,t)}has(e){return this._map.has(e)}*[Symbol.iterator](){for(const[e,t]of this._map)yield[e,t instanceof primitives_Ref&&this.xref?this.xref.fetch(t,this.suppressEncryption):t]}static get empty(){const e=new primitives_Dict(null);e.set=(e,t)=>{unreachable("Should not call `set` on the empty dictionary.")};return shadow(this,"empty",e)}static merge({xref:e,dictArray:t,mergeSubDicts:n=!1}){const r=new primitives_Dict(e),i=new Map;for(const e of t)if(e instanceof primitives_Dict)for(const[t,r]of e._map){let e=i.get(t);if(void 0===e){e=[];i.set(t,e)}else if(!(n&&r instanceof primitives_Dict))continue;e.push(r)}for(const[t,n]of i){if(1===n.length||!(n[0]instanceof primitives_Dict)){r._map.set(t,n[0]);continue}const i=new primitives_Dict(e);for(const e of n)for(const[t,n]of e._map)i._map.has(t)||i._map.set(t,n);i.size>0&&r._map.set(t,i)}i.clear();return r.size>0?r:primitives_Dict.empty}clone(){const e=new primitives_Dict(this.xref);for(const t of this.getKeys())e.set(t,this.getRaw(t));return e}delete(e){delete this._map[e]}}class primitives_Ref{constructor(e,t){this.num=e;this.gen=t}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(e){const t=s[e];if(t)return t;const n=/^(\d+)R(\d*)$/.exec(e);return n&&"0"!==n[1]?s[e]=new primitives_Ref(parseInt(n[1]),n[2]?parseInt(n[2]):0):null}static get(e,t){const n=0===t?`${e}R`:`${e}R${t}`;return s[n]||=new primitives_Ref(e,t)}}Symbol.iterator;Symbol.iterator;class base_stream_BaseStream{get length(){unreachable("Abstract getter `length` accessed")}get isEmpty(){unreachable("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return shadow(this,"isDataLoaded",!0)}getByte(){unreachable("Abstract method `getByte` called")}getBytes(e){unreachable("Abstract method `getBytes` called")}async getImageData(e,t){return this.getBytes(e,t)}async asyncGetBytes(){unreachable("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get isAsyncDecoder(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}async getTransferableImage(){return null}peekByte(){const e=this.getByte();-1!==e&&this.pos--;return e}peekBytes(e){const t=this.getBytes(e);this.pos-=t.length;return t}getUint16(){const e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(e,t){unreachable("Abstract method `getByteRange` called")}getString(e){return bytesToString(this.getBytes(e))}skip(e){this.pos+=e||1}reset(){unreachable("Abstract method `reset` called")}moveStart(){unreachable("Abstract method `moveStart` called")}makeSubStream(e,t,n=null){unreachable("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}class MissingDataException extends n{constructor(e,t){super(`Missing data [${e}, ${t})`,"MissingDataException");this.begin=e;this.end=t}}function log2(e){return e>0?Math.ceil(Math.log2(e)):0}function readInt8(e,t){return e[t]<<24>>24}function readUint16(e,t){return e[t]<<8|e[t+1]}function readUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}const a=[{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}];class ArithmeticDecoder{constructor(e,t,n){this.data=e;this.bp=t;this.dataEnd=n;this.chigh=e[t];this.clow=0;this.byteIn();this.chigh=this.chigh<<7&65535|this.clow>>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=32768}byteIn(){const e=this.data;let t=this.bp;if(255===e[t])if(e[t+1]>143){this.clow+=65280;this.ct=8}else{t++;this.clow+=e[t]<<9;this.ct=7;this.bp=t}else{t++;this.clow+=t<this.dataEnd?e[t]<<8:65280;this.ct=8;this.bp=t}if(this.clow>65535){this.chigh+=this.clow>>16;this.clow&=65535}}readBit(e,t){let n=e[t]>>1,r=1&e[t];const i=a[n],s=i.qe;let o,c=this.a-s;if(this.chigh<s)if(c<s){c=s;o=r;n=i.nmps}else{c=s;o=1^r;1===i.switchFlag&&(r=o);n=i.nlps}else{this.chigh-=s;if(32768&c){this.a=c;return r}if(c<s){o=1^r;1===i.switchFlag&&(r=o);n=i.nlps}else{o=r;n=i.nmps}}do{0===this.ct&&this.byteIn();c<<=1;this.chigh=this.chigh<<1&65535|this.clow>>15&1;this.clow=this.clow<<1&65535;this.ct--}while(!(32768&c));this.a=c;e[t]=n<<1|r;return o}}const c=-1,l=[[-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]],h=[[-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]],f=[[-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]],u=[[-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]],d=[[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]],m=[[-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]];class CCITTFaxDecoder{constructor(e,t={}){if("function"!=typeof e?.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');this.source=e;this.eof=!1;this.encoding=t.K||0;this.eoline=t.EndOfLine||!1;this.byteAlign=t.EncodedByteAlign||!1;this.columns=t.Columns||1728;this.rows=t.Rows||0;this.eoblock=t.EndOfBlock??!0;this.black=t.BlackIs1||!1;this.codingLine=new Uint32Array(this.columns+1);this.refLine=new Uint32Array(this.columns+2);this.codingLine[0]=this.columns;this.codingPos=0;this.row=0;this.nextLine2D=this.encoding<0;this.inputBits=0;this.inputBuf=0;this.outputBits=0;this.rowsDone=!1;let n;for(;0===(n=this._lookBits(12));)this._eatBits(1);1===n&&this._eatBits(12);if(this.encoding>0){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}}readNextChar(){if(this.eof)return-1;const e=this.refLine,t=this.codingLine,n=this.columns;let r,i,s,o,a;if(0===this.outputBits){this.rowsDone&&(this.eof=!0);if(this.eof)return-1;this.err=!1;let s,a,l;if(this.nextLine2D){for(o=0;t[o]<n;++o)e[o]=t[o];e[o++]=n;e[o]=n;t[0]=0;this.codingPos=0;r=0;i=0;for(;t[this.codingPos]<n;){s=this._getTwoDimCode();switch(s){case 0:this._addPixels(e[r+1],i);e[r+1]<n&&(r+=2);break;case 1:s=a=0;if(i){do{s+=l=this._getBlackCode()}while(l>=64);do{a+=l=this._getWhiteCode()}while(l>=64)}else{do{s+=l=this._getWhiteCode()}while(l>=64);do{a+=l=this._getBlackCode()}while(l>=64)}this._addPixels(t[this.codingPos]+s,i);t[this.codingPos]<n&&this._addPixels(t[this.codingPos]+a,1^i);for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2;break;case 7:this._addPixels(e[r]+3,i);i^=1;if(t[this.codingPos]<n){++r;for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2}break;case 5:this._addPixels(e[r]+2,i);i^=1;if(t[this.codingPos]<n){++r;for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2}break;case 3:this._addPixels(e[r]+1,i);i^=1;if(t[this.codingPos]<n){++r;for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2}break;case 2:this._addPixels(e[r],i);i^=1;if(t[this.codingPos]<n){++r;for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2}break;case 8:this._addPixelsNeg(e[r]-3,i);i^=1;if(t[this.codingPos]<n){r>0?--r:++r;for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2}break;case 6:this._addPixelsNeg(e[r]-2,i);i^=1;if(t[this.codingPos]<n){r>0?--r:++r;for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2}break;case 4:this._addPixelsNeg(e[r]-1,i);i^=1;if(t[this.codingPos]<n){r>0?--r:++r;for(;e[r]<=t[this.codingPos]&&e[r]<n;)r+=2}break;case c:this._addPixels(n,0);this.eof=!0;break;default:info("bad 2d code");this._addPixels(n,0);this.err=!0}}}else{t[0]=0;this.codingPos=0;i=0;for(;t[this.codingPos]<n;){s=0;if(i)do{s+=l=this._getBlackCode()}while(l>=64);else do{s+=l=this._getWhiteCode()}while(l>=64);this._addPixels(t[this.codingPos]+s,i);i^=1}}let h=!1;this.byteAlign&&(this.inputBits&=-8);if(this.eoblock||this.row!==this.rows-1){s=this._lookBits(12);if(this.eoline)for(;s!==c&&1!==s;){this._eatBits(1);s=this._lookBits(12)}else for(;0===s;){this._eatBits(1);s=this._lookBits(12)}if(1===s){this._eatBits(12);h=!0}else s===c&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}if(this.eoblock&&h&&this.byteAlign){s=this._lookBits(12);if(1===s){this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}if(this.encoding>=0)for(o=0;o<4;++o){s=this._lookBits(12);1!==s&&info("bad rtc code: "+s);this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}}this.eof=!0}}else if(this.err&&this.eoline){for(;;){s=this._lookBits(13);if(s===c){this.eof=!0;return-1}if(s>>1==1)break;this._eatBits(1)}this._eatBits(12);if(this.encoding>0){this._eatBits(1);this.nextLine2D=!(1&s)}}this.outputBits=t[0]>0?t[this.codingPos=0]:t[this.codingPos=1];this.row++}if(this.outputBits>=8){a=1&this.codingPos?0:255;this.outputBits-=8;if(0===this.outputBits&&t[this.codingPos]<n){this.codingPos++;this.outputBits=t[this.codingPos]-t[this.codingPos-1]}}else{s=8;a=0;do{if("number"!=typeof this.outputBits)throw new FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');if(this.outputBits>s){a<<=s;1&this.codingPos||(a|=255>>8-s);this.outputBits-=s;s=0}else{a<<=this.outputBits;1&this.codingPos||(a|=255>>8-this.outputBits);s-=this.outputBits;this.outputBits=0;if(t[this.codingPos]<n){this.codingPos++;this.outputBits=t[this.codingPos]-t[this.codingPos-1]}else if(s>0){a<<=s;s=0}}}while(s)}this.black&&(a^=255);return a}_addPixels(e,t){const n=this.codingLine;let r=this.codingPos;if(e>n[r]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&r^t&&++r;n[r]=e}this.codingPos=r}_addPixelsNeg(e,t){const n=this.codingLine;let r=this.codingPos;if(e>n[r]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&r^t&&++r;n[r]=e}else if(e<n[r]){if(e<0){info("invalid code");this.err=!0;e=0}for(;r>0&&e<n[r-1];)--r;n[r]=e}this.codingPos=r}_findTableCode(e,t,n,r){const i=r||0;for(let r=e;r<=t;++r){let e=this._lookBits(r);if(e===c)return[!0,1,!1];r<t&&(e<<=t-r);if(!i||e>=i){const t=n[e-i];if(t[0]===r){this._eatBits(r);return[!0,t[1],!0]}}}return[!1,0,!1]}_getTwoDimCode(){let e,t=0;if(this.eoblock){t=this._lookBits(7);e=l[t];if(e?.[0]>0){this._eatBits(e[0]);return e[1]}}else{const e=this._findTableCode(1,7,l);if(e[0]&&e[2])return e[1]}info("Bad two dim code");return c}_getWhiteCode(){let e,t=0;if(this.eoblock){t=this._lookBits(12);if(t===c)return 1;e=t>>5?f[t>>3]:h[t];if(e[0]>0){this._eatBits(e[0]);return e[1]}}else{let e=this._findTableCode(1,9,f);if(e[0])return e[1];e=this._findTableCode(11,12,h);if(e[0])return e[1]}info("bad white code");this._eatBits(1);return 1}_getBlackCode(){let e,t;if(this.eoblock){e=this._lookBits(13);if(e===c)return 1;t=e>>7?!(e>>9)&&e>>7?d[(e>>1)-64]:m[e>>7]:u[e];if(t[0]>0){this._eatBits(t[0]);return t[1]}}else{let e=this._findTableCode(2,6,m);if(e[0])return e[1];e=this._findTableCode(7,12,d,64);if(e[0])return e[1];e=this._findTableCode(10,13,u);if(e[0])return e[1]}info("bad black code");this._eatBits(1);return 1}_lookBits(e){let t;for(;this.inputBits<e;){if(-1===(t=this.source.next()))return 0===this.inputBits?c:this.inputBuf<<e-this.inputBits&65535>>16-e;this.inputBuf=this.inputBuf<<8|t;this.inputBits+=8}return this.inputBuf>>this.inputBits-e&65535>>16-e}_eatBits(e){(this.inputBits-=e)<0&&(this.inputBits=0)}}class Jbig2Error extends n{constructor(e){super(e,"Jbig2Error")}}class ContextCache{getContexts(e){return e in this?this[e]:this[e]=new Int8Array(65536)}}class DecodingContext{constructor(e,t,n){this.data=e;this.start=t;this.end=n}get decoder(){return shadow(this,"decoder",new ArithmeticDecoder(this.data,this.start,this.end))}get contextCache(){return shadow(this,"contextCache",new ContextCache)}}function decodeInteger(e,t,n){const r=e.getContexts(t);let i=1;function readBits(e){let t=0;for(let s=0;s<e;s++){const e=n.readBit(r,i);i=i<256?i<<1|e:511&(i<<1|e)|256;t=t<<1|e}return t>>>0}const s=readBits(1),o=readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(32)+4436:readBits(12)+340:readBits(8)+84:readBits(6)+20:readBits(4)+4:readBits(2);let a;0===s?a=o:o>0&&(a=-o);return a>=-2147483648&&a<=2147483647?a:null}function decodeIAID(e,t,n){const r=e.getContexts("IAID");let i=1;for(let e=0;e<n;e++){i=i<<1|t.readBit(r,i)}return n<31?i&(1<<n)-1:2147483647&i}const g=["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"],p=[[{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}]],b=[{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}]}],w=[39717,1941,229,405],y=[32,8];function decodeBitmap(e,t,n,r,i,s,o,a){if(e){return decodeMMRBitmap(new Reader(a.data,a.start,a.end),t,n,!1)}if(0===r&&!s&&!i&&4===o.length&&3===o[0].x&&-1===o[0].y&&-3===o[1].x&&-1===o[1].y&&2===o[2].x&&-2===o[2].y&&-2===o[3].x&&-2===o[3].y)return function decodeBitmapTemplate0(e,t,n){const r=n.decoder,i=n.contextCache.getContexts("GB"),s=[];let o,a,c,l,h,f,u;for(a=0;a<t;a++){h=s[a]=new Uint8Array(e);f=a<1?h:s[a-1];u=a<2?h:s[a-2];o=u[0]<<13|u[1]<<12|u[2]<<11|f[0]<<7|f[1]<<6|f[2]<<5|f[3]<<4;for(c=0;c<e;c++){h[c]=l=r.readBit(i,o);o=(31735&o)<<1|(c+3<e?u[c+3]<<11:0)|(c+4<e?f[c+4]<<4:0)|l}}return s}(t,n,a);const c=!!s,l=p[r].concat(o);l.sort(((e,t)=>e.y-t.y||e.x-t.x));const h=l.length,f=new Int8Array(h),u=new Int8Array(h),d=[];let m,g,b=0,y=0,C=0,x=0;for(g=0;g<h;g++){f[g]=l[g].x;u[g]=l[g].y;y=Math.min(y,l[g].x);C=Math.max(C,l[g].x);x=Math.min(x,l[g].y);g<h-1&&l[g].y===l[g+1].y&&l[g].x===l[g+1].x-1?b|=1<<h-1-g:d.push(g)}const _=d.length,B=new Int8Array(_),R=new Int8Array(_),S=new Uint16Array(_);for(m=0;m<_;m++){g=d[m];B[m]=l[g].x;R[m]=l[g].y;S[m]=1<<h-1-g}const A=-y,k=-x,I=t-C,v=w[r];let D=new Uint8Array(t);const M=[],T=a.decoder,P=a.contextCache.getContexts("GB");let E,U,L,F,O,G=0,W=0;for(let e=0;e<n;e++){if(i){G^=T.readBit(P,v);if(G){M.push(D);continue}}D=new Uint8Array(D);M.push(D);for(E=0;E<t;E++){if(c&&s[e][E]){D[E]=0;continue}if(E>=A&&E<I&&e>=k){W=W<<1&b;for(g=0;g<_;g++){U=e+R[g];L=E+B[g];F=M[U][L];if(F){F=S[g];W|=F}}}else{W=0;O=h-1;for(g=0;g<h;g++,O--){L=E+f[g];if(L>=0&&L<t){U=e+u[g];if(U>=0){F=M[U][L];F&&(W|=F<<O)}}}}const n=T.readBit(P,W);D[E]=n}}return M}function decodeRefinement(e,t,n,r,i,s,o,a,c){let l=b[n].coding;0===n&&(l=l.concat([a[0]]));const h=l.length,f=new Int32Array(h),u=new Int32Array(h);let d;for(d=0;d<h;d++){f[d]=l[d].x;u[d]=l[d].y}let m=b[n].reference;0===n&&(m=m.concat([a[1]]));const g=m.length,p=new Int32Array(g),w=new Int32Array(g);for(d=0;d<g;d++){p[d]=m[d].x;w[d]=m[d].y}const C=r[0].length,x=r.length,_=y[n],B=[],R=c.decoder,S=c.contextCache.getContexts("GR");let A=0;for(let n=0;n<t;n++){if(o){A^=R.readBit(S,_);if(A)throw new Jbig2Error("prediction is not supported")}const t=new Uint8Array(e);B.push(t);for(let o=0;o<e;o++){let a,c,l=0;for(d=0;d<h;d++){a=n+u[d];c=o+f[d];a<0||c<0||c>=e?l<<=1:l=l<<1|B[a][c]}for(d=0;d<g;d++){a=n+w[d]-s;c=o+p[d]-i;a<0||a>=x||c<0||c>=C?l<<=1:l=l<<1|r[a][c]}const m=R.readBit(S,l);t[o]=m}}return B}function decodeTextRegion(e,t,n,r,i,s,o,a,c,l,h,f,u,d,m,g,p,b,w){if(e&&t)throw new Jbig2Error("refinement with Huffman is not supported");const y=[];let C,x;for(C=0;C<r;C++){x=new Uint8Array(n);i&&x.fill(i);y.push(x)}const _=p.decoder,B=p.contextCache;let R=e?-d.tableDeltaT.decode(w):-decodeInteger(B,"IADT",_),S=0;C=0;for(;C<s;){R+=e?d.tableDeltaT.decode(w):decodeInteger(B,"IADT",_);S+=e?d.tableFirstS.decode(w):decodeInteger(B,"IAFS",_);let r=S;for(;;){let i=0;o>1&&(i=e?w.readBits(b):decodeInteger(B,"IAIT",_));const s=o*R+i,S=e?d.symbolIDTable.decode(w):decodeIAID(B,_,c),A=t&&(e?w.readBit():decodeInteger(B,"IARI",_));let k=a[S],I=k[0].length,v=k.length;if(A){const e=decodeInteger(B,"IARDW",_),t=decodeInteger(B,"IARDH",_);I+=e;v+=t;k=decodeRefinement(I,v,m,k,(e>>1)+decodeInteger(B,"IARDX",_),(t>>1)+decodeInteger(B,"IARDY",_),!1,g,p)}let D=0;l?1&f?D=v-1:r+=v-1:f>1?r+=I-1:D=I-1;const M=s-(1&f?0:v-1),T=r-(2&f?I-1:0);let P,E,U;if(l)for(P=0;P<v;P++){x=y[T+P];if(!x)continue;U=k[P];const e=Math.min(n-M,I);switch(u){case 0:for(E=0;E<e;E++)x[M+E]|=U[E];break;case 2:for(E=0;E<e;E++)x[M+E]^=U[E];break;default:throw new Jbig2Error(`operator ${u} is not supported`)}}else for(E=0;E<v;E++){x=y[M+E];if(x){U=k[E];switch(u){case 0:for(P=0;P<I;P++)x[T+P]|=U[P];break;case 2:for(P=0;P<I;P++)x[T+P]^=U[P];break;default:throw new Jbig2Error(`operator ${u} is not supported`)}}}C++;const L=e?d.tableDeltaS.decode(w):decodeInteger(B,"IADS",_);if(null===L)break;r+=D+L+h}}return y}function readSegmentHeader(e,t){const n={};n.number=readUint32(e,t);const r=e[t+4],i=63&r;if(!g[i])throw new Jbig2Error("invalid segment type: "+i);n.type=i;n.typeName=g[i];n.deferredNonRetain=!!(128&r);const s=!!(64&r),o=e[t+5];let a=o>>5&7;const c=[31&o];let l=t+6;if(7===o){a=536870911&readUint32(e,l-1);l+=3;let t=a+7>>3;c[0]=e[l++];for(;--t>0;)c.push(e[l++])}else if(5===o||6===o)throw new Jbig2Error("invalid referred-to flags");n.retainBits=c;let h=4;n.number<=256?h=1:n.number<=65536&&(h=2);const f=[];let u,d;for(u=0;u<a;u++){let t;t=1===h?e[l]:2===h?readUint16(e,l):readUint32(e,l);f.push(t);l+=h}n.referredTo=f;if(s){n.pageAssociation=readUint32(e,l);l+=4}else n.pageAssociation=e[l++];n.length=readUint32(e,l);l+=4;if(4294967295===n.length){if(38!==i)throw new Jbig2Error("invalid unknown segment length");{const t=readRegionSegmentInformation(e,l),r=!!(1&e[l+C]),i=6,s=new Uint8Array(i);if(!r){s[0]=255;s[1]=172}s[2]=t.height>>>24&255;s[3]=t.height>>16&255;s[4]=t.height>>8&255;s[5]=255&t.height;for(u=l,d=e.length;u<d;u++){let t=0;for(;t<i&&s[t]===e[u+t];)t++;if(t===i){n.length=u+i;break}}if(4294967295===n.length)throw new Jbig2Error("segment end was not found")}}n.headerEnd=l;return n}function readSegments(e,t,n,r){const i=[];let s=n;for(;s<r;){const n=readSegmentHeader(t,s);s=n.headerEnd;const r={header:n,data:t};if(!e.randomAccess){r.start=s;s+=n.length;r.end=s}i.push(r);if(51===n.type)break}if(e.randomAccess)for(let e=0,t=i.length;e<t;e++){i[e].start=s;s+=i[e].header.length;i[e].end=s}return i}function readRegionSegmentInformation(e,t){return{width:readUint32(e,t),height:readUint32(e,t+4),x:readUint32(e,t+8),y:readUint32(e,t+12),combinationOperator:7&e[t+16]}}const C=17;function processSegment(e,t){const n=e.header,r=e.data,i=e.end;let s,o,a,c,l=e.start;switch(n.type){case 0:const e={},t=readUint16(r,l);e.huffman=!!(1&t);e.refinement=!!(2&t);e.huffmanDHSelector=t>>2&3;e.huffmanDWSelector=t>>4&3;e.bitmapSizeSelector=t>>6&1;e.aggregationInstancesSelector=t>>7&1;e.bitmapCodingContextUsed=!!(256&t);e.bitmapCodingContextRetained=!!(512&t);e.template=t>>10&3;e.refinementTemplate=t>>12&1;l+=2;if(!e.huffman){c=0===e.template?4:1;o=[];for(a=0;a<c;a++){o.push({x:readInt8(r,l),y:readInt8(r,l+1)});l+=2}e.at=o}if(e.refinement&&!e.refinementTemplate){o=[];for(a=0;a<2;a++){o.push({x:readInt8(r,l),y:readInt8(r,l+1)});l+=2}e.refinementAt=o}e.numberOfExportedSymbols=readUint32(r,l);l+=4;e.numberOfNewSymbols=readUint32(r,l);l+=4;s=[e,n.number,n.referredTo,r,l,i];break;case 6:case 7:const h={};h.info=readRegionSegmentInformation(r,l);l+=C;const f=readUint16(r,l);l+=2;h.huffman=!!(1&f);h.refinement=!!(2&f);h.logStripSize=f>>2&3;h.stripSize=1<<h.logStripSize;h.referenceCorner=f>>4&3;h.transposed=!!(64&f);h.combinationOperator=f>>7&3;h.defaultPixelValue=f>>9&1;h.dsOffset=f<<17>>27;h.refinementTemplate=f>>15&1;if(h.huffman){const e=readUint16(r,l);l+=2;h.huffmanFS=3&e;h.huffmanDS=e>>2&3;h.huffmanDT=e>>4&3;h.huffmanRefinementDW=e>>6&3;h.huffmanRefinementDH=e>>8&3;h.huffmanRefinementDX=e>>10&3;h.huffmanRefinementDY=e>>12&3;h.huffmanRefinementSizeSelector=!!(16384&e)}if(h.refinement&&!h.refinementTemplate){o=[];for(a=0;a<2;a++){o.push({x:readInt8(r,l),y:readInt8(r,l+1)});l+=2}h.refinementAt=o}h.numberOfSymbolInstances=readUint32(r,l);l+=4;s=[h,n.referredTo,r,l,i];break;case 16:const u={},d=r[l++];u.mmr=!!(1&d);u.template=d>>1&3;u.patternWidth=r[l++];u.patternHeight=r[l++];u.maxPatternIndex=readUint32(r,l);l+=4;s=[u,n.number,r,l,i];break;case 22:case 23:const m={};m.info=readRegionSegmentInformation(r,l);l+=C;const g=r[l++];m.mmr=!!(1&g);m.template=g>>1&3;m.enableSkip=!!(8&g);m.combinationOperator=g>>4&7;m.defaultPixelValue=g>>7&1;m.gridWidth=readUint32(r,l);l+=4;m.gridHeight=readUint32(r,l);l+=4;m.gridOffsetX=4294967295&readUint32(r,l);l+=4;m.gridOffsetY=4294967295&readUint32(r,l);l+=4;m.gridVectorX=readUint16(r,l);l+=2;m.gridVectorY=readUint16(r,l);l+=2;s=[m,n.referredTo,r,l,i];break;case 38:case 39:const p={};p.info=readRegionSegmentInformation(r,l);l+=C;const b=r[l++];p.mmr=!!(1&b);p.template=b>>1&3;p.prediction=!!(8&b);if(!p.mmr){c=0===p.template?4:1;o=[];for(a=0;a<c;a++){o.push({x:readInt8(r,l),y:readInt8(r,l+1)});l+=2}p.at=o}s=[p,r,l,i];break;case 48:const w={width:readUint32(r,l),height:readUint32(r,l+4),resolutionX:readUint32(r,l+8),resolutionY:readUint32(r,l+12)};4294967295===w.height&&delete w.height;const y=r[l+16];readUint16(r,l+17);w.lossless=!!(1&y);w.refinement=!!(2&y);w.defaultPixelValue=y>>2&1;w.combinationOperator=y>>3&3;w.requiresBuffer=!!(32&y);w.combinationOperatorOverride=!!(64&y);s=[w];break;case 49:case 50:case 51:case 62:break;case 53:s=[n.number,r,l,i];break;default:throw new Jbig2Error(`segment type ${n.typeName}(${n.type}) is not implemented`)}const h="on"+n.typeName;h in t&&t[h].apply(t,s)}function processSegments(e,t){for(let n=0,r=e.length;n<r;n++)processSegment(e[n],t)}class SimpleSegmentVisitor{onPageInformation(e){this.currentPageInfo=e;const t=e.width+7>>3,n=new Uint8ClampedArray(t*e.height);e.defaultPixelValue&&n.fill(255);this.buffer=n}drawBitmap(e,t){const n=this.currentPageInfo,r=e.width,i=e.height,s=n.width+7>>3,o=n.combinationOperatorOverride?e.combinationOperator:n.combinationOperator,a=this.buffer,c=128>>(7&e.x);let l,h,f,u,d=e.y*s+(e.x>>3);switch(o){case 0:for(l=0;l<i;l++){f=c;u=d;for(h=0;h<r;h++){t[l][h]&&(a[u]|=f);f>>=1;if(!f){f=128;u++}}d+=s}break;case 2:for(l=0;l<i;l++){f=c;u=d;for(h=0;h<r;h++){t[l][h]&&(a[u]^=f);f>>=1;if(!f){f=128;u++}}d+=s}break;default:throw new Jbig2Error(`operator ${o} is not supported`)}}onImmediateGenericRegion(e,t,n,r){const i=e.info,s=new DecodingContext(t,n,r),o=decodeBitmap(e.mmr,i.width,i.height,e.template,e.prediction,null,e.at,s);this.drawBitmap(i,o)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(e,t,n,r,i,s){let o,a;if(e.huffman){o=function getSymbolDictionaryHuffmanTables(e,t,n){let r,i,s,o,a=0;switch(e.huffmanDHSelector){case 0:case 1:r=getStandardTable(e.huffmanDHSelector+4);break;case 3:r=getCustomHuffmanTable(a,t,n);a++;break;default:throw new Jbig2Error("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:i=getStandardTable(e.huffmanDWSelector+2);break;case 3:i=getCustomHuffmanTable(a,t,n);a++;break;default:throw new Jbig2Error("invalid Huffman DW selector")}if(e.bitmapSizeSelector){s=getCustomHuffmanTable(a,t,n);a++}else s=getStandardTable(1);o=e.aggregationInstancesSelector?getCustomHuffmanTable(a,t,n):getStandardTable(1);return{tableDeltaHeight:r,tableDeltaWidth:i,tableBitmapSize:s,tableAggregateInstances:o}}(e,n,this.customTables);a=new Reader(r,i,s)}let c=this.symbols;c||(this.symbols=c={});const l=[];for(const e of n){const t=c[e];t&&l.push(...t)}const h=new DecodingContext(r,i,s);c[t]=function decodeSymbolDictionary(e,t,n,r,i,s,o,a,c,l,h,f){if(e&&t)throw new Jbig2Error("symbol refinement with Huffman is not supported");const u=[];let d=0,m=log2(n.length+r);const g=h.decoder,p=h.contextCache;let b,w;if(e){b=getStandardTable(1);w=[];m=Math.max(m,1)}for(;u.length<r;){d+=e?s.tableDeltaHeight.decode(f):decodeInteger(p,"IADH",g);let r=0,i=0;const b=e?w.length:0;for(;;){const b=e?s.tableDeltaWidth.decode(f):decodeInteger(p,"IADW",g);if(null===b)break;r+=b;i+=r;let y;if(t){const i=decodeInteger(p,"IAAI",g);if(i>1)y=decodeTextRegion(e,t,r,d,0,i,1,n.concat(u),m,0,0,1,0,s,c,l,h,0,f);else{const e=decodeIAID(p,g,m),t=decodeInteger(p,"IARDX",g),i=decodeInteger(p,"IARDY",g);y=decodeRefinement(r,d,c,e<n.length?n[e]:u[e-n.length],t,i,!1,l,h)}u.push(y)}else if(e)w.push(r);else{y=decodeBitmap(!1,r,d,o,!1,null,a,h);u.push(y)}}if(e&&!t){const e=s.tableBitmapSize.decode(f);f.byteAlign();let t;if(0===e)t=readUncompressedBitmap(f,i,d);else{const n=f.end,r=f.position+e;f.end=r;t=decodeMMRBitmap(f,i,d,!1);f.end=n;f.position=r}const n=w.length;if(b===n-1)u.push(t);else{let e,r,i,s,o,a=0;for(e=b;e<n;e++){s=w[e];i=a+s;o=[];for(r=0;r<d;r++)o.push(t[r].subarray(a,i));u.push(o);a=i}}}}const y=[],C=[];let x,_,B=!1;const R=n.length+r;for(;C.length<R;){let t=e?b.decode(f):decodeInteger(p,"IAEX",g);for(;t--;)C.push(B);B=!B}for(x=0,_=n.length;x<_;x++)C[x]&&y.push(n[x]);for(let e=0;e<r;x++,e++)C[x]&&y.push(u[e]);return y}(e.huffman,e.refinement,l,e.numberOfNewSymbols,e.numberOfExportedSymbols,o,e.template,e.at,e.refinementTemplate,e.refinementAt,h,a)}onImmediateTextRegion(e,t,n,r,i){const s=e.info;let o,a;const c=this.symbols,l=[];for(const e of t){const t=c[e];t&&l.push(...t)}const h=log2(l.length);if(e.huffman){a=new Reader(n,r,i);o=function getTextRegionHuffmanTables(e,t,n,r,i){const s=[];for(let e=0;e<=34;e++){const t=i.readBits(4);s.push(new HuffmanLine([e,t,0,0]))}const o=new HuffmanTable(s,!1);s.length=0;for(let e=0;e<r;){const t=o.decode(i);if(t>=32){let n,r,o;switch(t){case 32:if(0===e)throw new Jbig2Error("no previous value in symbol ID table");r=i.readBits(2)+3;n=s[e-1].prefixLength;break;case 33:r=i.readBits(3)+3;n=0;break;case 34:r=i.readBits(7)+11;n=0;break;default:throw new Jbig2Error("invalid code length in symbol ID table")}for(o=0;o<r;o++){s.push(new HuffmanLine([e,n,0,0]));e++}}else{s.push(new HuffmanLine([e,t,0,0]));e++}}i.byteAlign();const a=new HuffmanTable(s,!1);let c,l,h,f=0;switch(e.huffmanFS){case 0:case 1:c=getStandardTable(e.huffmanFS+6);break;case 3:c=getCustomHuffmanTable(f,t,n);f++;break;default:throw new Jbig2Error("invalid Huffman FS selector")}switch(e.huffmanDS){case 0:case 1:case 2:l=getStandardTable(e.huffmanDS+8);break;case 3:l=getCustomHuffmanTable(f,t,n);f++;break;default:throw new Jbig2Error("invalid Huffman DS selector")}switch(e.huffmanDT){case 0:case 1:case 2:h=getStandardTable(e.huffmanDT+11);break;case 3:h=getCustomHuffmanTable(f,t,n);f++;break;default:throw new Jbig2Error("invalid Huffman DT selector")}if(e.refinement)throw new Jbig2Error("refinement with Huffman is not supported");return{symbolIDTable:a,tableFirstS:c,tableDeltaS:l,tableDeltaT:h}}(e,t,this.customTables,l.length,a)}const f=new DecodingContext(n,r,i),u=decodeTextRegion(e.huffman,e.refinement,s.width,s.height,e.defaultPixelValue,e.numberOfSymbolInstances,e.stripSize,l,h,e.transposed,e.dsOffset,e.referenceCorner,e.combinationOperator,o,e.refinementTemplate,e.refinementAt,f,e.logStripSize,a);this.drawBitmap(s,u)}onImmediateLosslessTextRegion(){this.onImmediateTextRegion(...arguments)}onPatternDictionary(e,t,n,r,i){let s=this.patterns;s||(this.patterns=s={});const o=new DecodingContext(n,r,i);s[t]=function decodePatternDictionary(e,t,n,r,i,s){const o=[];if(!e){o.push({x:-t,y:0});0===i&&o.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2})}const a=decodeBitmap(e,(r+1)*t,n,i,!1,null,o,s),c=[];for(let e=0;e<=r;e++){const r=[],i=t*e,s=i+t;for(let e=0;e<n;e++)r.push(a[e].subarray(i,s));c.push(r)}return c}(e.mmr,e.patternWidth,e.patternHeight,e.maxPatternIndex,e.template,o)}onImmediateHalftoneRegion(e,t,n,r,i){const s=this.patterns[t[0]],o=e.info,a=new DecodingContext(n,r,i),c=function decodeHalftoneRegion(e,t,n,r,i,s,o,a,c,l,h,f,u,d,m){if(o)throw new Jbig2Error("skip is not supported");if(0!==a)throw new Jbig2Error(`operator "${a}" is not supported in halftone region`);const g=[];let p,b,w;for(p=0;p<i;p++){w=new Uint8Array(r);s&&w.fill(s);g.push(w)}const y=t.length,C=t[0],x=C[0].length,_=C.length,B=log2(y),R=[];if(!e){R.push({x:n<=1?3:2,y:-1});0===n&&R.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2})}const S=[];let A,k,I,v,D,M,T,P,E,U,L;e&&(A=new Reader(m.data,m.start,m.end));for(p=B-1;p>=0;p--){k=e?decodeMMRBitmap(A,c,l,!0):decodeBitmap(!1,c,l,n,!1,null,R,m);S[p]=k}for(I=0;I<l;I++)for(v=0;v<c;v++){D=0;M=0;for(b=B-1;b>=0;b--){D^=S[b][I][v];M|=D<<b}T=t[M];P=h+I*d+v*u>>8;E=f+I*u-v*d>>8;if(P>=0&&P+x<=r&&E>=0&&E+_<=i)for(p=0;p<_;p++){L=g[E+p];U=T[p];for(b=0;b<x;b++)L[P+b]|=U[b]}else{let e,t;for(p=0;p<_;p++){t=E+p;if(!(t<0||t>=i)){L=g[t];U=T[p];for(b=0;b<x;b++){e=P+b;e>=0&&e<r&&(L[e]|=U[b])}}}}}return g}(e.mmr,s,e.template,o.width,o.height,e.defaultPixelValue,e.enableSkip,e.combinationOperator,e.gridWidth,e.gridHeight,e.gridOffsetX,e.gridOffsetY,e.gridVectorX,e.gridVectorY,a);this.drawBitmap(o,c)}onImmediateLosslessHalftoneRegion(){this.onImmediateHalftoneRegion(...arguments)}onTables(e,t,n,r){let i=this.customTables;i||(this.customTables=i={});i[e]=function decodeTablesSegment(e,t,n){const r=e[t],i=4294967295&readUint32(e,t+1),s=4294967295&readUint32(e,t+5),o=new Reader(e,t+9,n),a=1+(r>>1&7),c=1+(r>>4&7),l=[];let h,f,u=i;do{h=o.readBits(a);f=o.readBits(c);l.push(new HuffmanLine([u,h,f,0]));u+=1<<f}while(u<s);h=o.readBits(a);l.push(new HuffmanLine([i-1,h,32,0,"lower"]));h=o.readBits(a);l.push(new HuffmanLine([s,h,32,0]));if(1&r){h=o.readBits(a);l.push(new HuffmanLine([h,0]))}return new HuffmanTable(l,!1)}(t,n,r)}}class HuffmanLine{constructor(e){if(2===e.length){this.isOOB=!0;this.rangeLow=0;this.prefixLength=e[0];this.rangeLength=0;this.prefixCode=e[1];this.isLowerRange=!1}else{this.isOOB=!1;this.rangeLow=e[0];this.prefixLength=e[1];this.rangeLength=e[2];this.prefixCode=e[3];this.isLowerRange="lower"===e[4]}}}class HuffmanTreeNode{constructor(e){this.children=[];if(e){this.isLeaf=!0;this.rangeLength=e.rangeLength;this.rangeLow=e.rangeLow;this.isLowerRange=e.isLowerRange;this.isOOB=e.isOOB}else this.isLeaf=!1}buildTree(e,t){const n=e.prefixCode>>t&1;if(t<=0)this.children[n]=new HuffmanTreeNode(e);else{let r=this.children[n];r||(this.children[n]=r=new HuffmanTreeNode(null));r.buildTree(e,t-1)}}decodeNode(e){if(this.isLeaf){if(this.isOOB)return null;const t=e.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-t:t)}const t=this.children[e.readBit()];if(!t)throw new Jbig2Error("invalid Huffman data");return t.decodeNode(e)}}class HuffmanTable{constructor(e,t){t||this.assignPrefixCodes(e);this.rootNode=new HuffmanTreeNode(null);for(let t=0,n=e.length;t<n;t++){const n=e[t];n.prefixLength>0&&this.rootNode.buildTree(n,n.prefixLength-1)}}decode(e){return this.rootNode.decodeNode(e)}assignPrefixCodes(e){const t=e.length;let n=0;for(let r=0;r<t;r++)n=Math.max(n,e[r].prefixLength);const r=new Uint32Array(n+1);for(let n=0;n<t;n++)r[e[n].prefixLength]++;let i,s,o,a=1,c=0;r[0]=0;for(;a<=n;){c=c+r[a-1]<<1;i=c;s=0;for(;s<t;){o=e[s];if(o.prefixLength===a){o.prefixCode=i;i++}s++}a++}}}const x={};function getStandardTable(e){let t,n=x[e];if(n)return n;switch(e){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],[1