HRM-10/HRM.UI/ClientApp/src/assets/pdf.worker-2.13.491.min.js

22 lines
1023 KiB
JavaScript
Raw Normal View History

2026-11-03 13:06:00 +06:00
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2022 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf.worker",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf.worker"]=t():e["pdfjs-dist/build/pdf.worker"]=e.pdfjsWorker=t()}(this,(()=>(()=>{"use strict";var e=[,(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});t.WorkerTask=t.WorkerMessageHandler=void 0;var r=a(2),n=a(4),i=a(5),s=a(65),o=a(71),c=a(99),l=a(100),h=a(7);Promise.allSettled||(Promise.allSettled=function(e){const t=e.filter((e=>!!e)).map((e=>e.then((e=>({status:"fulfilled",value:e}))).catch((e=>({status:"rejected",reason:e})))));return Promise.all(t)});class WorkerTask{constructor(e){this.name=e;this.terminated=!1;this._capability=(0,r.createPromiseCapability)()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}t.WorkerTask=WorkerTask;class WorkerMessageHandler{static setup(e,t){let a=!1;e.on("test",(function wphSetupTest(t){if(!a){a=!0;e.send("test",t instanceof Uint8Array&&255===t[0])}}));e.on("configure",(function wphConfigure(e){(0,r.setVerbosityLevel)(e.verbosity)}));e.on("GetDocRequest",(function wphSetupDoc(e){return WorkerMessageHandler.createDocumentHandler(e,t)}))}static createDocumentHandler(e,t){let a,u=!1,d=null;const f=[],g=(0,r.getVerbosityLevel)(),p=e.apiVersion,m="2.13.491";if(p!==m)throw new Error(`The API version "${p}" does not match the Worker version "2.13.491".`);const b=[];for(const e in[])b.push(e);if(b.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+b.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");if("undefined"==typeof ReadableStream){const e="The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g. `ReadableStream`); ";if(isNodeJS)throw new Error(e+"please use a `legacy`-build instead.");throw new Error(e+"please update to a supported browser.")}const y=e.docId,w=e.docBaseUrl,S=e.docId+"_worker";let x=new c.MessageHandler(S,y,t);function ensureNotTerminated(){if(u)throw new Error("Worker was terminated")}function startWorkerTask(e){f.push(e)}function finishWorkerTask(e){e.finish();const t=f.indexOf(e);f.splice(t,1)}async function loadDocument(e){await a.ensureDoc("checkHeader");await a.ensureDoc("parseStartXRef");await a.ensureDoc("parse",[e]);await a.ensureDoc("checkFirstPage",[e]);await a.ensureDoc("checkLastPage",[e]);const t=await a.ensureDoc("isPureXfa");if(t){const e=new WorkerTask("loadXfaFonts");startWorkerTask(e);await Promise.all([a.loadXfaFonts(x,e).catch((e=>{})).then((()=>finishWorkerTask(e))),a.loadXfaImages()])}const[r,n]=await Promise.all([a.ensureDoc("numPages"),a.ensureDoc("fingerprints")]);return{numPages:r,fingerprints:n,htmlForXfa:t?await a.ensureDoc("htmlForXfa"):null}}function getPdfManager(e,t,a){const n=(0,r.createPromiseCapability)();let s;const o=e.source;if(o.data){try{s=new i.LocalPdfManager(y,o.data,o.password,x,t,a,w);n.resolve(s)}catch(e){n.reject(e)}return n.promise}let c,h=[];try{c=new l.PDFWorkerStream(x)}catch(e){n.reject(e);return n.promise}const u=c.getFullReader();u.headersReady.then((function(){if(!u.isRangeSupported)return;const e=o.disableAutoFetch||u.isStreamingSupported;s=new i.NetworkPdfManager(y,c,{msgHandler:x,password:o.password,length:u.contentLength,disableAutoFetch:e,rangeChunkSize:o.rangeChunkSize},t,a,w);for(let e=0;e<h.length;e++)s.sendProgressiveData(h[e]);h=[];n.resolve(s);d=null})).catch((function(e){n.reject(e);d=null}));let f=0;new Promise((function(e,c){const readChunk=function({value:e,done:l}){try{ensureNotTerminated();if(l){s||function(){const e=(0,r.arraysToBytes)(h);o.length&&e.length!==o.length&&(0,r.warn)("reported HTTP length is different from actual");try{s=new i.LocalPdfManager(y,e,o.password,x,t,a,w);n.resolve(s)}catch(e){n.reject(e)}h=[]}();d=null;return}f+=(0,r.arrayByteLength)(e);u.isStreamingSupport