pdf-to-markdown/docs/bundle.worker.js

2 lines
794 KiB
JavaScript
Raw Normal View History

2021-07-12 14:48:57 +02:00
/*! For license information please see bundle.worker.js.LICENSE.txt */
!function(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,(function(){return(()=>{"use strict";var e=[,(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerTask=t.WorkerMessageHandler=void 0;var a,i=r(2),n=r(5),s=r(6),o=r(48),c=r(4),l=r(69),h=r(70),u=r(8);class d{constructor(e){this.name=e,this.terminated=!1,this._capability=(0,i.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=d;class f{static setup(e,t){var r=!1;e.on("test",(function(t){if(r)return;if(r=!0,!(t instanceof Uint8Array))return void e.send("test",null);const a=255===t[0];e.postMessageTransfers=a,e.send("test",{supportTransfers:a})})),e.on("configure",(function(e){(0,i.setVerbosityLevel)(e.verbosity)})),e.on("GetDocRequest",(function(e){return f.createDocumentHandler(e,t)}))}static createDocumentHandler(e,t){var r,a=!1,c=null,f=[];const g=(0,i.getVerbosityLevel)(),p=e.apiVersion;if("2.8.335"!==p)throw new Error(`The API version "${p}" does not match the Worker version "2.8.335".`);const m=[];for(const e in[])m.push(e);if(m.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+m.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");if("undefined"==typeof ReadableStream)throw new Error("The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g. `ReadableStream`); please use a `legacy`-build instead.");var b=e.docId,y=e.docBaseUrl,w=e.docId+"_worker",v=new l.MessageHandler(w,b,t);function S(){if(a)throw new Error("Worker was terminated")}function k(e){f.push(e)}function x(e){e.finish();var t=f.indexOf(e);f.splice(t,1)}async function A(e){await r.ensureDoc("checkHeader"),await r.ensureDoc("parseStartXRef"),await r.ensureDoc("parse",[e]),e||await r.ensureDoc("checkFirstPage");const[t,a,i]=await Promise.all([r.ensureDoc("numPages"),r.ensureDoc("fingerprint"),r.ensureDoc("isPureXfa")]);return{numPages:t,fingerprint:a,isPureXfa:i}}return v.postMessageTransfers=e.postMessageTransfers,v.on("GetPage",(function(e){return r.getPage(e.pageIndex).then((function(e){return Promise.all([r.ensure(e,"rotate"),r.ensure(e,"ref"),r.ensure(e,"userUnit"),r.ensure(e,"view")]).then((function([e,t,r,a]){return{rotate:e,ref:t,userUnit:r,view:a}}))}))})),v.on("GetPageIndex",(function({ref:e}){const t=n.Ref.get(e.num,e.gen);return r.ensureCatalog("getPageIndex",[t])})),v.on("GetDestinations",(function(e){return r.ensureCatalog("destinations")})),v.on("GetDestination",(function(e){return r.ensureCatalog("getDestination",[e.id])})),v.on("GetPageLabels",(function(e){return r.ensureCatalog("pageLabels")})),v.on("GetPageLayout",(function(e){return r.ensureCatalog("pageLayout")})),v.on("GetPageMode",(function(e){return r.ensureCatalog("pageMode")})),v.on("GetViewerPreferences",(function(e){return r.ensureCatalog("viewerPreferences")})),v.on("GetOpenAction",(function(e){return r.ensureCatalog("openAction")})),v.on("GetAttachments",(function(e){return r.ensureCatalog("attachments")})),v.on("GetJavaScript",(function(e){return r.ensureCatalog("javaScript")})),v.on("GetDocJSActions",(function(e){return r.ensureCatalog("jsActions")})),v.on("GetPageJSActions",(function({pageIndex:e}){return r.getPage(e).then((function(e){return e.jsActions}))})),v.on("GetPageXfa",(function({pageIndex:e}){return r.getPage(e).then((function(e){return r.ensure(e,"xfaData")}))})),v.on("GetIsPureXfa",(function(e){return r.ensureDoc("isPureXfa")})),v.on("GetOutline",(function(e){return r.ensureCatalog("documentOutline")})),v.on("GetOptionalContentConfig",(function(e){return r.ensureCatalog("optionalContentConfig")})),v.on("GetPermissions",(function(e){return r.ensureCatalog("permissions")})),v.on