Files
TERES_web_frontend/public/pdfjs-dist/pdf.worker.min.mjs

28 lines
1.0 MiB
JavaScript
Raw Permalink Normal View History

/**
* @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.4.394
* pdfjsBuild = 2cc809ade
*/const e=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),t=[.001,0,0,.001,0,0],a=1.35,r=.35,i=.25925925925925924,n=1,s=2,o=4,c=8,l=16,h=64,u=128,d=256,f="pdfjs_internal_editor_",g=3,p=9,m=13,b=15,y=101,w={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},x=1,S=2,k=3,C=0,v=4,F=1,T=2,O=3,M={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},D="Group",R="R",N=1,E=2,L=4,_=16,U=32,j=128,X=512,q=1,H=2,W=4096,G=8192,z=32768,$=65536,V=131072,K=1048576,J=2097152,Y=8388608,Z=16777216,Q=1,ee=2,te=3,ae=4,re=5,ie={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"},ne={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},se={O:"PageOpen",C:"PageClose"},oe=1,ce=5,le=1,he=2,ue=3,de=4,fe=5,ge=6,pe=7,me=8,be=9,ye=10,we=11,xe=12,Se=13,Ae=14,ke=15,Ce=16,ve=17,Fe=18,Ie=19,Te=20,Oe=21,Me=22,De=23,Be=24,Re=25,Ne=26,Ee=27,Pe=28,Le=29,_e=30,Ue=31,je=32,Xe=33,qe=34,He=35,We=36,Ge=37,ze=38,$e=39,Ve=40,Ke=41,Je=42,Ye=43,Ze=44,Qe=45,et=46,tt=47,at=48,rt=49,it=50,nt=51,st=52,ot=53,ct=54,lt=55,ht=56,ut=57,dt=58,ft=59,gt=60,pt=61,mt=62,bt=63,yt=64,wt=65,xt=66,St=67,At=68,kt=69,Ct=70,vt=71,Ft=72,It=73,Tt=74,Ot=75,Mt=76,Dt=77,Bt=80,Rt=81,Nt=83,Et=84,Pt=85,Lt=86,_t=87,Ut=88,jt=89,Xt=90,qt=91,Ht=92,Wt=93,Gt=94,zt=0,$t=1,Vt=2,Kt=3,Jt=4,Yt=1,Zt=2;let Qt=oe;function getVerbosityLevel(){return Qt}function info(e){Qt>=ce&&console.info(`Info: ${e}`)}function warn(e){Qt>=oe&&console.warn(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function createValidAbsoluteUrl(e,t=null,a=null){if(!e)return null;if(a&&"string"==typeof e){if(a.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(a.tryConvertEncoding)try{e=stringToUTF8String(e)}catch{}}const r=t?URL.parse(e,t):URL.parse(e);return function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r)?r:null}function shadow(e,t,a,r=!1){Object.defineProperty(e,t,{value:a,enumerable:!r,configurable:!0,writable:!1});return a}const ea=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class PasswordException extends ea{constructor(e,t){super(e,"PasswordException");this.code=t}}class UnknownErrorException extends ea{constructor(e,t){super(e,"UnknownErrorException");this.details=t}}class InvalidPDFException extends ea{constructor(e){super(e,"InvalidPDFException")}}class ResponseException extends ea{constructor(e,t,a){super(e,"ResponseException");this.status=t;this.missing=a}}class FormatError extends ea{constructor(e){super(e,"FormatError")}}class AbortException extends ea{constructor(e){super(e,"AbortException")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,a=8192;if(t<a)return String.fromCharCode.apply(null,e);const r=[];for(let i=0;i<t;i+=a){const n=Math.min(i+a,t),s=e.subarray(i,n);r.push(String.fromCharCode.apply(null,s))}return r.join("")}function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,a=new Uint8Array(t);for(let r=0;r<t;++r)a[r]=255&e.charCodeAt(r);return a}function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function objectSize(e){return Object.keys(e).length}class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittle
/*webpackIgnore: true*/
/*@vite-ignore*/
t)).default()}catch(e){warn(`JpxImage#getJsModule: ${e}`)}e(a)}static async#j(e,t,a){const r="openjpeg.wasm";try{this.#E||(this.#_?this.#E=await fetchBinaryData(`${this.#F}${r}`):this.#E=await this.#P.sendWithPromise("FetchBinaryData",{type:"wasmFactory",filename:r}));return a((await WebAssembly.instantiate(this.#E,t)).instance)}catch(t){warn(`JpxImage#instantiateWasm: ${t}`);this.#U(e);return null}finally{this.#P=null}}static async decode(e,{numComponents:t=4,isIndexedColormap:a=!1,smaskInData:r=!1,reducePower:i=0}={}){if(!this.#L){const{promise:e,resolve:t}=Promise.withResolvers(),a=[e];this.#v?a.push(Na({warn,instantiateWasm:this.#j.bind(this,t)})):this.#U(t);this.#L=Promise.race(a)}const n=await this.#L;if(!n)throw new JpxError("OpenJPEG failed to initialize");let s;try{const o=e.length;s=n._malloc(o);n.writeArrayToMemory(e,s);if(n._jp2_decode(s,o,t>0?t:0,!!a,!!r,i)){const{errorMessages:e}=n;if(e){delete n.errorMessages;throw new JpxError(e)}throw new JpxError("Unknown error")}const{imageData:c}=n;n.imageData=null;return c}finally{s&&n._free(s)}}static cleanup(){this.#L=null}static parseImageProperties(e){let t=e.getByte();for(;t>=0;){const a=t;t=e.getByte();if(65361===(a<<8|t)){e.skip(4);const t=e.getInt32()>>>0,a=e.getInt32()>>>0,r=e.getInt32()>>>0,i=e.getInt32()>>>0;e.skip(16);return{width:t-r,height:a-i,bitsPerComponent:8,componentsCount:e.getUint16()}}}throw new JpxError("No size marker found in JPX stream")}}function addState(e,t,a,r,i){let n=e;for(let e=0,a=t.length-1;e<a;e++){const a=t[e];n=n[a]||=[]}n[t.at(-1)]={checkFn:a,iterateFn:r,processFn:i}}const Ea=[];addState(Ea,[ye,xe,Lt,we],null,function iterateInlineImageGroup(e,t){const a=e.fnArray,r=(t-(e.iCurr-3))%4;switch(r){case 0:return a[t]===ye;case 1:return a[t]===xe;case 2:return a[t]===Lt;case 3:return a[t]===we}throw new Error(`iterateInlineImageGroup - invalid pos: ${r}`)},function foundInlineImageGroup(e,t){const a=e.fnArray,r=e.argsArray,i=e.iCurr,n=i-3,s=i-2,o=i-1,c=Math.min(Math.floor((t-n)/4),200);if(c<10)return t-(t-n)%4;let l=0;const h=[];let u=0,d=1,f=1;for(let e=0;e<c;e++){const t=r[s+(e<<2)],a=r[o+(e<<2)][0];if(d+a.width>1e3){l=Math.max(l,d);f+=u+2;d=0;u=0}h.push({transform:t,x:d,y:f,w:a.width,h:a.height});d+=a.width+2;u=Math.max(u,a.height)}const g=Math.max(l,d)+1,p=f+u+1,m=new Uint8Array(g*p*4),b=g<<2;for(let e=0;e<c;e++){const t=r[o+(e<<2)][0].data,a=h[e].w<<2;let i=0,n=h[e].x+h[e].y*g<<2;m.set(t.subarray(0,a),n-b);for(let r=0,s=h[e].h;r<s;r++){m.set(t.subarray(i,i+a),n);i+=a;n+=b}m.set(t.subarray(i-a,i),n);for(;n>=0;){t[n-4]=t[n];t[n-3]=t[n+1];t[n-2]=t[n+2];t[n-1]=t[n+3];t[n+a]=t[n+a-4];t[n+a+1]=t[n+a-3];t[n+a+2]=t[n+a-2];t[n+a+3]=t[n+a-1];n-=b}}const y={width:g,height:p};if(e.isOffscreenCanvasSupported){const e=new OffscreenCanvas(g,p);e.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(m.buffer),g,p),0,0);y.bitmap=e.transferToImageBitmap();y.data=null}else{y.kind=O;y.data=m}a.splice(n,4*c,_t);r.splice(n,4*c,[y,h]);return n+1});addState(Ea,[ye,xe,Nt,we],null,function iterateImageMaskGroup(e,t){const a=e.fnArray,r=(t-(e.iCurr-3))%4;switch(r){case 0:return a[t]===ye;case 1:return a[t]===xe;case 2:return a[t]===Nt;case 3:return a[t]===we}throw new Error(`iterateImageMaskGroup - invalid pos: ${r}`)},function foundImageMaskGroup(e,t){const a=e.fnArray,r=e.argsArray,i=e.iCurr,n=i-3,s=i-2,o=i-1;let c=Math.floor((t-n)/4);if(c<10)return t-(t-n)%4;let l,h,u=!1;const d=r[o][0],f=r[s][0],g=r[s][1],p=r[s][2],m=r[s][3];if(g===p){u=!0;l=s+4;let e=o+4;for(let t=1;t<c;t++,l+=4,e+=4){h=r[l];if(r[e][0]!==d||h[0]!==f||h[1]!==g||h[2]!==p||h[3]!==m){t<10?u=!1:c=t;break}}}if(u){c=Math.min(c,1e3);const e=new Float32Array(2*c);l=s;for(let t=0;t<c;t++,l+=4){h=r[l];e[t<<1]=h[4];e[1+(t<<1)]=h[5]}a.splice(n,4*c,jt);r.splice(n,4*c,[d,f,g,p,m,e])}else{c=Math.min(c,100);const e=[];for(let t=0;t<c;t++){h=r[s+(t<<2)];const a=r[o+(t<<2)][0];e.push({data:a.data,width:a.width,height:a.height,interpolate:a.interpolate,count:a.count,transform:h})}a.splice(n,4*c,Et);r.splice(n,4*c,[e])}return n+1});addState(Ea,[ye,xe,Pt,we],function(e){const t=e.argsArray,a=e