$wnd.web3d.runAsyncCallback13('function l8l(){}\nfunction m8l(){}\nfunction RAk(a){this.g=a}\nfunction SAk(a){this.g=a}\nfunction TAk(a){this.g=a}\nfunction UAk(a){this.g=a}\nfunction VAk(a){this.g=a}\nfunction WAk(a){this.g=a}\nfunction XAk(a){this.g=a}\nfunction YAk(a){this.g=a}\nfunction ZAk(a){this.g=a}\nfunction awm(a){this.g=a}\nfunction cwm(a){this.g=a}\nfunction dwm(a){this.g=a}\nfunction bwm(a,b){this.g=a;this.i=b}\nfunction ewm(a,b){this.g=a;this.i=b}\nfunction QAk(a,b){this.g=a;this.i=b}\nfunction MAk(a,b){OAk(a.t,b)}\nfunction OAk(a,b){MMc(a.g,b+\'%\')}\nfunction IAk(a){!!a.n||a.o.yb.click()}\nfunction n8l(){n8l=Auc;j8l=new l8l}\nfunction o8l(){o8l=Auc;k8l=new m8l}\nfunction Yvm(a,b){if(!a.i){return}LAk(a.i,b)}\nfunction CAk(a,b){(b.g[H3m]|0)==13&&yAk(a,false)}\nfunction EAk(a){IMc(a.g,J7n);BMc(a.g,QAn);a.j=false}\nfunction DAk(a){IMc(a.g,J7n);BMc(a.g,t3m);a.j=true}\nfunction FAk(a){IMc(a.g,J7n);BMc(a.g,\'hover\')}\nfunction GAk(a){a.j||(IMc(a.g,J7n),BMc(a.g,QAn))}\nfunction HAk(a){var b;b=a.s;MSl(a.Q,\'pdf.png\',b)}\nfunction AAk(a,b){var c;c=b.yb;JAk(a,c.files.item(0))}\nfunction LAk(a,b){a.r.yb.setAttribute(Mgn,b);a.s=b}\nfunction $vm(a,b){if(b>0&&b<=a.g.numPages){a.j=b;return true}return false}\nfunction Svm(a,b){var c;c={};c[\'canvasContext\']=b;c[\'viewport\']=a;return c}\nfunction Tvm(a,b){var c;if(b.lengthComputable){c=b.loaded/b.total*100;MAk(a.i,c)}return null}\nfunction BAk(a,b){var c;c=b.dataTransfer.files;JAk(a,c.item(0));b.stopPropagation();b.preventDefault()}\nfunction Wvm(a,b){var c;c=$wnd.window.pdfjsLib.getDocument(b);c.promise.then(Buc(cwm.prototype.jj,cwm,[a]))}\nfunction zAk(a,b,c,d){var e;e=new jQj(c,null,24,24);RMc(e.yb,d,true);ngm(e.yb,qMn,new qim(e,a));EKj(b,e,b.yb);return e}\nfunction PAk(a){this.i=a;dKj.call(this);RMc(this.yb,\'progressBar\',true);this.g=new dKj;aKj(this,this.g);MMc(this.g,\'0%\')}\nfunction KAk(a){$vm(a.n,1);xAk(a);if(a.n.g.numPages==1){BMc(a.k,$On);BMc(a.u,$On);LMc(a.q,false)}else{Rxl(a.g,\'\'+a.n.j)}xRj(a.L,false)}\nfunction Vvm(a,b){var c,d,e;d=b.getViewport((e={},e[Edn]=2,e));c=b.render(Svm(d,a.getContext(n3m)));a.width=d.width;a.height=d.height;return c.promise}\nfunction _vm(a,b){var c;this.i=b;c=new $wnd.FileReader;c.onprogress=Buc(awm.prototype.gj,awm,[this]);c.addEventListener(JNn,new bwm(this,c));!!a&&c.readAsDataURL(a)}\nfunction Zvm(a){var b;if(a.j>1){$vm(a,a.j-1);b=(Ced(),yed).createElement(K4m);a.g.getPage(a.j).then(Buc(dwm.prototype.jj,dwm,[b])).then(Buc(ewm.prototype.jj,ewm,[a,b]))}}\nfunction Xvm(a){var b;if(a.jnew e(t))}else{const e=r(22).PDFNetworkStream;let t;(0,s.isFetchSupported)()&&(t=r(23).PDFFetchStream),(0,n.setPDFNetworkStreamFactory)(r=>t&&(0,s.isValidFetchUrl)(r.url)?new t(r):new e(r))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addLinkAttributes=function(e,{url:t,target:r,rel:n,enabled:i=!0}={}){(0,s.assert)(t&&"string"==typeof t,\\\'addLinkAttributes: A valid "url" parameter must provided.\\\');const a=(0,s.removeNullCharacters)(t);i?e.href=e.title=a:(e.href="",e.title="Disabled: "+a,e.onclick=()=>!1);let l="";switch(r){case o.NONE:break;case o.SELF:l="_self";break;case o.BLANK:l="_blank";break;case o.PARENT:l="_parent";break;case o.TOP:l="_top"}e.target=l,e.rel="string"==typeof n?n:"noopener noreferrer nofollow"},t.getFilenameFromUrl=function(e){const t=e.indexOf("#"),r=e.indexOf("?"),s=Math.min(t>0?t:e.length,r>0?r:e.length);return e.substring(e.lastIndexOf("/",s)+1,s)},t.isFetchSupported=l,t.isValidFetchUrl=c,t.loadScript=function(e){return new Promise((t,r)=>{const s=document.createElement("script");s.src=e,s.onload=t,s.onerror=function(){r(new Error("Cannot load script at: "+s.src))},(document.head||document.documentElement).appendChild(s)})},t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.PDFDateString=t.StatTimer=t.DOMSVGFactory=t.DOMCMapReaderFactory=t.DOMCanvasFactory=t.DEFAULT_LINK_REL=t.LinkTarget=t.RenderingCancelledException=t.PageViewport=void 0;var s=r(2);t.DEFAULT_LINK_REL="noopener noreferrer nofollow";const n="http://www.w3.org/2000/svg";t.DOMCanvasFactory=class{create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const r=document.createElement("canvas"),s=r.getContext("2d");return r.width=e,r.height=t,{canvas:r,context:s}}reset(e,t,r){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=r}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}};t.DOMCMapReaderFactory=class{constructor({baseUrl:e=null,isCompressed:t=!1}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error(\\\'The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.\\\');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),r=this.isCompressed?s.CMapCompressionType.BINARY:s.CMapCompressionType.NONE;return l()&&c(t,document.baseURI)?fetch(t).then(async e=>{if(!e.ok)throw new Error(e.statusText);let t;return t=this.isCompressed?new Uint8Array(await e.arrayBuffer()):(0,s.stringToBytes)(await e.text()),{cMapData:t,compressionType:r}}).catch(e=>{throw new Error("Unable to load "+(this.isCompressed?"binary ":"")+"CMap at: "+t)}):new Promise((e,n)=>{const i=new XMLHttpRequest;i.open("GET",t,!0),this.isCompressed&&(i.responseType="arraybuffer"),i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(200===i.status||0===i.status){let t;if(this.isCompressed&&i.response?t=new Uint8Array(i.response):!this.isCompressed&&i.responseText&&(t=(0,s.stringToBytes)(i.responseText)),t)return void e({cMapData:t,compressionType:r})}n(new Error(i.statusText))}},i.send(null)}).catch(e=>{throw new Error("Unable to load "+(this.isCompressed?"binary ":"")+"CMap at: "+t)})}};t.DOMSVGFactory=class{create(e,t){(0,s.assert)(e>0&&t>0,"Invalid SVG dimensions");const r=document.createElementNS(n,"svg:svg");return r.setAttribute("version","1.1"),r.setAttribute("width",e+"px"),r.setAttribute("height",t+"px"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox","0 0 "+e+" "+t),r}createElement(e){return(0,s.assert)("string"==typeof e,"Invalid SVG element type"),document.createElementNS(n,e)}};class i{constructor({viewBox:e,scale:t,rotation:r,offsetX:s=0,offsetY:n=0,dontFlip:i=!1}){this.viewBox=e,this.scale=t,this.rotation=r,this.offsetX=s,this.offsetY=n;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,c,h,d,u,p,g,f;switch(r=(r%=360)<0?r+360:r){case 180:l=-1,c=0,h=0,d=1;break;case 90:l=0,c=1,h=1,d=0;break;case 270:l=0,c=-1,h=-1,d=0;break;case 0:l=1,c=0,h=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}i&&(h=-h,d=-d),0===l?(u=Math.abs(o-e[1])*t+s,p=Math.abs(a-e[0])*t+n,g=Math.abs(e[3]-e[1])*t,f=Math.abs(e[2]-e[0])*t):(u=Math.abs(a-e[0])*t+s,p=Math.abs(o-e[1])*t+n,g=Math.abs(e[2]-e[0])*t,f=Math.abs(e[3]-e[1])*t),this.transform=[l*t,c*t,h*t,d*t,u-l*t*a-h*t*o,p-c*t*a-d*t*o],this.width=g,this.height=f}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:r=this.offsetX,offsetY:s=this.offsetY,dontFlip:n=!1}={}){return new i({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:r,offsetY:s,dontFlip:n})}convertToViewportPoint(e,t){return s.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=s.Util.applyTransform([e[0],e[1]],this.transform),r=s.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],r[0],r[1]]}convertToPdfPoint(e,t){return s.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=i;class a extends s.BaseException{constructor(e,t){super(e),this.type=t}}t.RenderingCancelledException=a;const o={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};t.LinkTarget=o;function l(){return"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&"undefined"!=typeof ReadableStream}function c(e,t){try{const{protocol:r}=t?new URL(e,t):new URL(e);return"http:"===r||"https:"===r}catch(e){return!1}}let h;t.StatTimer=class{constructor(){this.started=Object.create(null),this.times=[]}time(e){e in this.started&&(0,s.warn)("Timer is already running for "+e),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,s.warn)("Timer has not been started for "+e),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const e of this.times){const r=e.name;r.length>t&&(t=r.length)}for(const r of this.times){const s=r.end-r.start;e.push(`${r.name.padEnd(t)} ${s}ms\\\\n`)}return e.join("")}};t.PDFDateString=class{static toDateObject(e){if(!e||!(0,s.isString)(e))return null;h||(h=new RegExp("^D:(\\\\\\\\d{4})(\\\\\\\\d{2})?(\\\\\\\\d{2})?(\\\\\\\\d{2})?(\\\\\\\\d{2})?(\\\\\\\\d{2})?([Z|+|-])?(\\\\\\\\d{2})?\\\'?(\\\\\\\\d{2})?\\\'?"));const t=h.exec(e);if(!t)return null;const r=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const c=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===c?(a+=d,o+=u):"+"===c&&(a-=d,o-=u),new Date(Date.UTC(r,n,i,a,o,l))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrayByteLength=u,t.arraysToBytes=function(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let r=0;for(let s=0;st}),e.promise=new Promise((function(r,s){e.resolve=function(e){t=!0,r(e)},e.reject=function(e){t=!0,s(e)}})),e},t.getVerbosityLevel=function(){return n},t.info=function(e){n>=s.INFOS&&console.log("Info: "+e)},t.isArrayBuffer=function(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength},t.isArrayEqual=function(e,t){if(e.length!==t.length)return!1;return e.every((function(e,r){return e===t[r]}))},t.isBool=function(e){return"boolean"==typeof e},t.isEmptyObj=function(e){for(const t in e)return!1;return!0},t.isNum=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSameOrigin=function(e,t){let r;try{if(r=new URL(e),!r.origin||"null"===r.origin)return!1}catch(e){return!1}const s=new URL(t,r);return r.origin===s.origin},t.createValidAbsoluteUrl=function(e,t){if(!e)return null;try{const r=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(e){}return null},t.removeNullCharacters=function(e){if("string"!=typeof e)return i("The argument for removeNullCharacters must be a string."),e;return e.replace(h,"")},t.setVerbosityLevel=function(e){Number.isInteger(e)&&(n=e)},t.shadow=l,t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=d,t.stringToPDFString=function(e){const t=e.length,r=[];if("\\xFE"===e[0]&&"\\xFF"===e[1])for(let s=2;s=s.WARNINGS&&console.log("Warning: "+e)}function a(e){throw new Error(e)}function o(e,t){e||a(t)}function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!1}),r}const c=function(){function e(t){this.constructor===e&&a("Cannot initialize BaseException."),this.message=t,this.name=this.constructor.name}return e.prototype=new Error,e.constructor=e,e}();t.BaseException=c;t.PasswordException=class extends c{constructor(e,t){super(e),this.code=t}};t.UnknownErrorException=class extends c{constructor(e,t){super(e),this.details=t}};t.InvalidPDFException=class extends c{};t.MissingPDFException=class extends c{};t.UnexpectedResponseException=class extends c{constructor(e,t){super(e),this.status=t}};t.FormatError=class extends c{};t.AbortException=class extends c{};const h=/\\\\x00/g;function d(e){o("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,r=new Uint8Array(t);for(let s=0;se[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){function r(e,t){return e-t}const s=[e[0],e[2],t[0],t[2]].sort(r),n=[e[1],e[3],t[1],t[3]].sort(r),i=[];return e=m.normalizeRect(e),t=m.normalizeRect(t),s[0]===e[0]&&s[1]===t[0]||s[0]===t[0]&&s[1]===e[0]?(i[0]=s[1],i[2]=s[2],n[0]===e[1]&&n[1]===t[1]||n[0]===t[1]&&n[1]===e[1]?(i[1]=n[1],i[3]=n[2],i):null):null}}t.Util=m;const A=[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];const b=function(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function(t,r,s=!1){if(!s&&URL.createObjectURL){const e=new Blob([t],{type:r});return URL.createObjectURL(e)}let n=`data:${r};base64,`;for(let r=0,s=t.length;r>2]+e[(3&i)<<4|a>>4]+e[r+1>6:64]+e[r+2{this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)})}}}();class PDFDataRangeTransport{constructor(e,t,r=!1){this.length=e,this.initialData=t,this.progressiveDone=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const r of this._rangeListeners)r(e,t)}onDataProgress(e,t){this._readyCapability.promise.then(()=>{for(const r of this._progressListeners)r(e,t)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const t of this._progressiveReadListeners)t(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e,this._transport=t}get numPages(){return this._pdfInfo.numPages}get fingerprint(){return this._pdfInfo.fingerprint}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getOpenActionDestination(){return(0,_display_utils.deprecated)("getOpenActionDestination, use getOpenAction instead."),this.getOpenAction().then((function(e){return e&&e.dest?e.dest:null}))}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getOutline(){return this._transport.getOutline()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getStats(){return this._transport.getStats()}cleanup(){return this._transport.startCleanup()}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(e,t,r,s=!1){this._pageIndex=e,this._pageInfo=t,this._transport=r,this._stats=s?new _display_utils.StatTimer:null,this._pdfBug=s,this.commonObjs=r.commonObjs,this.objs=new PDFObjects,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this.intentStates=Object.create(null),this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:r=0,offsetY:s=0,dontFlip:n=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:r,offsetY:s,dontFlip:n})}getAnnotations({intent:e=null}={}){return this.annotationsPromise&&this.annotationsIntent===e||(this.annotationsPromise=this._transport.getAnnotations(this._pageI\';a.g+=\'ndex,e),this.annotationsIntent=e),this.annotationsPromise}render({canvasContext:e,viewport:t,intent:r="display",enableWebGL:s=!1,renderInteractiveForms:n=!1,transform:i=null,imageLayer:a=null,canvasFactory:o=null,background:l=null}){this._stats&&this._stats.time("Overall");const c="print"===r?"print":"display";this.pendingCleanup=!1,this.intentStates[c]||(this.intentStates[c]=Object.create(null));const h=this.intentStates[c];h.streamReaderCancelTimeout&&(clearTimeout(h.streamReaderCancelTimeout),h.streamReaderCancelTimeout=null);const d=o||new _display_utils.DOMCanvasFactory,u=new _webgl.WebGLContext({enable:s});h.displayReadyCapability||(h.displayReadyCapability=(0,_util.createPromiseCapability)(),h.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList({pageIndex:this._pageIndex,intent:c,renderInteractiveForms:!0===n}));const p=e=>{const t=h.renderTasks.indexOf(g);t>=0&&h.renderTasks.splice(t,1),(this.cleanupAfterRender||"print"===c)&&(this.pendingCleanup=!0),this._tryCleanup(),e?(g.capability.reject(e),this._abortOperatorList({intentState:h,reason:e})):g.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},g=new InternalRenderTask({callback:p,params:{canvasContext:e,viewport:t,transform:i,imageLayer:a,background:l},objs:this.objs,commonObjs:this.commonObjs,operatorList:h.operatorList,pageIndex:this._pageIndex,canvasFactory:d,webGLContext:u,useRequestAnimationFrame:"print"!==c,pdfBug:this._pdfBug});h.renderTasks||(h.renderTasks=[]),h.renderTasks.push(g);const f=g.task;return h.displayReadyCapability.promise.then(e=>{this.pendingCleanup?p():(this._stats&&this._stats.time("Rendering"),g.initializeGraphics(e),g.operatorListChanged())}).catch(p),f}getOperatorList(){this.intentStates.oplist||(this.intentStates.oplist=Object.create(null));const e=this.intentStates.oplist;let t;return e.opListReadCapability||(t={},t.operatorListChanged=function(){if(e.operatorList.lastChunk){e.opListReadCapability.resolve(e.operatorList);const r=e.renderTasks.indexOf(t);r>=0&&e.renderTasks.splice(r,1)}},e.opListReadCapability=(0,_util.createPromiseCapability)(),e.renderTasks=[],e.renderTasks.push(t),e.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList({pageIndex:this._pageIndex,intent:"oplist"})),e.opListReadCapability.promise}streamTextContent({normalizeWhitespace:e=!1,disableCombineTextItems:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,normalizeWhitespace:!0===e,combineTextItems:!0!==t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){const t=this.streamTextContent(e);return new Promise((function(e,r){const s=t.getReader(),n={items:[],styles:Object.create(null)};!function t(){s.read().then((function({value:r,done:s}){s?e(n):(Object.assign(n.styles,r.styles),n.items.push(...r.items),t())}),r)}()}))}_destroy(){this.destroyed=!0,this._transport.pageCache[this._pageIndex]=null;const e=[];return Object.keys(this.intentStates).forEach(t=>{const r=this.intentStates[t];this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),"oplist"!==t&&r.renderTasks.forEach((function(t){const r=t.capability.promise.catch((function(){}));e.push(r),t.cancel()}))}),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1,Promise.all(e)}cleanup(e=!1){return this.pendingCleanup=!0,this._tryCleanup(e)}_tryCleanup(e=!1){return!(!this.pendingCleanup||Object.keys(this.intentStates).some(e=>{const t=this.intentStates[e];return 0!==t.renderTasks.length||!t.operatorList.lastChunk}))&&(Object.keys(this.intentStates).forEach(e=>{delete this.intentStates[e]}),this.objs.clear(),this.annotationsPromise=null,e&&this._stats&&(this._stats=new _display_utils.StatTimer),this.pendingCleanup=!1,!0)}_startRenderPage(e,t){const r=this.intentStates[t];r&&(this._stats&&this._stats.timeEnd("Page Request"),r.displayReadyCapability&&r.displayReadyCapability.resolve(e))}_renderPageChunk(e,t){for(let r=0,s=e.length;r{t.read().then(({value:e,done:t})=>{t?r.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,r),s())},e=>{if(r.streamReader=null,!this._transport.destroyed){if(r.operatorList){r.operatorList.lastChunk=!0;for(let e=0;e{this._abortOperatorList({intentState:e,reason:t,force:!0}),e.streamReaderCancelTimeout=null},RENDERING_CANCELLED_TIMEOUT))}e.streamReader.cancel(new _util.AbortException(t&&t.message)),e.streamReader=null,this._transport.destroyed||(Object.keys(this.intentStates).some(t=>this.intentStates[t]===e&&(delete this.intentStates[t],!0)),this.cleanup())}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(e=!0){this._listeners=[],this._defer=e,this._deferred=Promise.resolve(void 0)}postMessage(e,t){if(!this._defer)return void this._listeners.forEach(t=>{t.call(this,{data:e})});const r=new WeakMap,s={data:function e(s){if("object"!=typeof s||null===s)return s;if(r.has(s))return r.get(s);let n,i;if((n=s.buffer)&&(0,_util.isArrayBuffer)(n)){return i=t&&t.includes(n)?new s.constructor(n,s.byteOffset,s.byteLength):new s.constructor(s),r.set(s,i),i}i=Array.isArray(s)?[]:{},r.set(s,i);for(const t in s){let r,n=s;for(;!(r=Object.getOwnPropertyDescriptor(n,t));)n=Object.getPrototypeOf(n);if(void 0!==r.value)if("function"!=typeof r.value)i[t]=e(r.value);else if(s.hasOwnProperty&&s.hasOwnProperty(t))throw new Error("LoopbackPort.postMessage - cannot clone: "+s[t])}return i}(e)};this._deferred.then(()=>{this._listeners.forEach(e=>{e.call(this,s)})})}addEventListener(e,t){this._listeners.push(t)}removeEventListener(e,t){const r=this._listeners.indexOf(t);this._listeners.splice(r,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorker=function PDFWorkerClosure(){const pdfWorkerPorts=new WeakMap;let isWorkerDisabled=!1,fallbackWorkerSrc,nextFakeWorkerId=0,fakeWorkerCapability;if(_is_node.isNodeJS&&"function"==typeof require)isWorkerDisabled=!0,fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document&&"currentScript"in document){const e=document.currentScript&&document.currentScript.src;e&&(fallbackWorkerSrc=e.replace(/(\\\\.(?:min\\\\.)?js)(\\\\?.*)?$/i,".worker$1$2"))}function getWorkerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(void 0!==fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)(\\\'No "GlobalWorkerOptions.workerSrc" specified.\\\'),fallbackWorkerSrc;throw new Error(\\\'No "GlobalWorkerOptions.workerSrc" specified.\\\')}function getMainThreadWorkerMessageHandler(){let e;try{e=globalThis.pdfjsWorker&&globalThis.pdfjsWorker.WorkerMessageHandler}catch(e){}return e||null}function setupFakeWorkerGlobal(){if(fakeWorkerCapability)return fakeWorkerCapability.promise;fakeWorkerCapability=(0,_util.createPromiseCapability)();const loader=async function(){const mainWorkerMessageHandler=getMainThreadWorkerMessageHandler();if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&"function"==typeof require){const worker=eval("require")(getWorkerSrc());return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(getWorkerSrc()),window.pdfjsWorker.WorkerMessageHandler};return loader().then(fakeWorkerCapability.resolve,fakeWorkerCapability.reject),fakeWorkerCapability.promise}function createCDNWrapper(e){const t="importScripts(\\\'"+e+"\\\');";return URL.createObjectURL(new Blob([t]))}class PDFWorker{constructor({name:e=null,port:t=null,verbosity:r=(0,_util.getVerbosityLevel)()}={}){if(t&&pdfWorkerPorts.has(t))throw new Error("Cannot use more than one PDFWorker per port");if(this.name=e,this.destroyed=!1,this.postMessageTransfers=!0,this.verbosity=r,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t)return pdfWorkerPorts.set(t,this),void this._initializeFromPort(t);this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new _message_handler.MessageHandler("main","worker",e),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve()}_initialize(){if("undefined"!=typeof Worker&&!isWorkerDisabled&&!getMainThreadWorkerMessageHandler()){let e=getWorkerSrc();try{(0,_util.isSameOrigin)(window.location.href,e)||(e=createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e),r=new _message_handler.MessageHandler("main","worker",t),s=()=>{t.removeEventListener("error",n),r.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=()=>{this._webWorker||s()};t.addEventListener("error",n),r.on("test",e=>{t.removeEventListener("error",n),this.destroyed?s():e?(this._messageHandler=r,this._port=t,this._webWorker=t,e.supportTransfers||(this.postMessageTransfers=!1),this._readyCapability.resolve(),r.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),r.destroy(),t.terminate())}),r.on("ready",e=>{if(t.removeEventListener("error",n),this.destroyed)s();else try{i()}catch(e){this._setupFakeWorker()}});const i=()=>{const e=new Uint8Array([this.postMessageTransfers?255:0]);try{r.send("test",e,[e.buffer])}catch(t){(0,_util.warn)("Cannot use postMessage transfers."),e[0]=0,r.send("test",e)}};return void i()}catch(e){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),isWorkerDisabled=!0),setupFakeWorkerGlobal().then(e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new LoopbackPort;this._port=t;const r="fake"+nextFakeWorkerId++,s=new _message_handler.MessageHandler(r+"_worker",r,t);e.setup(s,t);const n=new _message_handler.MessageHandler(r,r+"_worker",t);this._messageHandler=n,this._readyCapability.resolve(),n.send("configure",{verbosity:this.verbosity})}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),pdfWorkerPorts.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e||!e.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return pdfWorkerPorts.has(e.port)?pdfWorkerPorts.get(e.port):new PDFWorker(e)}static getWorkerSrc(){return getWorkerSrc()}}return PDFWorker}();exports.PDFWorker=PDFWorker;class WorkerTransport{constructor(e,t,r,s){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:t.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this)}),this._params=s,this.CMapReaderFactory=new s.CMapReaderFactory({baseUrl:s.cMapUrl,isCompressed:s.cMapPacked}),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.pageCache=[],this.pagePromises=[],this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];this.pageCache.forEach((function(t){t&&e.push(t._destroy())})),this.pageCache.length=0,this.pagePromises.length=0;const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{this.fontLoader.clear(),this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:r}){r?t.close():((0,_util.assert)((0,_util.isArrayBuffer)(e),"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch(e=>{t.error(e)})},t.onCancel=e=>{this._fullReader.cancel(e)}}),e.on("ReaderHeadersReady",e=>{const r=(0,_util.createPromiseCapability)(),s=this._fullReader;return s.headersReady.then(()=>{s.isStreamingSupported&&s.isRangeSupported||(this._lastProgress&&t.onProgress&&t.onProgress(this._lastProgress),s.onProgress=e=>{t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}),r.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},r.reject),r.promise}),e.on("GetRangeReader",(e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(e.begin,e.end);r?(t.onPull=()=>{r.read().then((function({value:e,done:r}){r?t.close():((0,_util.assert)((0,_util.isArrayBuffer)(e),"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch(e=>{t.error(e)})},t.onCancel=e=>{r.cancel(e)}):t.close()}),e.on("GetDoc",({pdfInfo:e})=>{this._numPages=e.numPages,t._capability.resolve(new PDFDocumentProxy(e,this))}),e.on("DocException",(function(e){let r;switch(e.name){case"PasswordException":r=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":r=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":r=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":r=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":r=new _util.UnknownErrorException(e.message,e.details)}t._capability.reject(r)})),e.on("PasswordRequest",e=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),t.onPassword){const r=e=>{this._passwordCapability.resolve({password:e})};try{t.onPassword(r,e.code)}catch(e){this._passwordCapability.reject(e)}}else this._passwordCapability.reject(new _util.PasswordException(e.message,e.code));return this._passwordCapability.promise}),e.on("DataLoaded",e=>{t.onProgress&&t.onProgress({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on("StartRenderPage",e=>{if(this.destroyed)return;this.pageCache[e.pageIndex]._startRenderPage(e.transparency,e.intent)}),e.on("commonobj",t=>{if(this.destroyed)return;const[r,s,n]=t;if(!this.commonObjs.has(r))switch(s){case"Font":const t=this._params;if("error"in n){const e=n.error;(0,_util.warn)("Error during font loading: "+e),this.commonObjs.resolve(r,e);break}let i=null;t.pdfBug&&globalThis.FontInspector&&globalThis.FontInspector.enabled&&(i={registerFont(e,t){globalThis.FontInspector.fontAdded(e,t)}});const a=new _f\';a.g+=\'ont_loader.FontFaceObject(n,{isEvalSupported:t.isEvalSupported,disableFontFace:t.disableFontFace,ignoreErrors:t.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:i});this.fontLoader.bind(a).catch(t=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!t.fontExtraProperties&&a.data&&(a.data=null),this.commonObjs.resolve(r,a)});break;case"FontPath":case"FontType3Res":case"Image":this.commonObjs.resolve(r,n);break;default:throw new Error("Got unknown common object type "+s)}}),e.on("obj",e=>{if(this.destroyed)return;const[t,r,s,n]=e,i=this.pageCache[r];if(!i.objs.has(t))switch(s){case"Image":i.objs.resolve(t,n);const e=8e6;n&&"data"in n&&n.data.length>e&&(i.cleanupAfterRender=!0);break;default:throw new Error("Got unknown object type "+s)}}),e.on("DocProgress",e=>{this.destroyed||t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}),e.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),e.on("FetchBuiltInCMap",(e,t)=>{if(this.destroyed)return void t.error(new Error("Worker was destroyed"));let r=!1;t.onPull=()=>{r?t.close():(r=!0,this.CMapReaderFactory.fetch(e).then((function(e){t.enqueue(e,1,[e.cMapData.buffer])})).catch((function(e){t.error(e)})))}})}_onUnsupportedFeature({featureId:e}){this.destroyed||this.loadingTask.onUnsupportedFeature&&this.loadingTask.onUnsupportedFeature(e)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request"));const t=e-1;if(t in this.pagePromises)return this.pagePromises[t];const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(e=>{if(this.destroyed)throw new Error("Transport destroyed");const r=new PDFPageProxy(t,e,this,this._params.pdfBug);return this.pageCache[t]=r,r});return this.pagePromises[t]=r,r}getPageIndex(e){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:e}).catch((function(e){return Promise.reject(new Error(e))}))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.messageHandler.sendWithPromise("GetMetadata",null).then(e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?this._fullReader.filename:null}))}getStats(){return this.messageHandler.sendWithPromise("GetStats",null)}startCleanup(){return this.messageHandler.sendWithPromise("Cleanup",null).then(()=>{for(let e=0,t=this.pageCache.length;e{this._nextBound().catch(this.cancel.bind(this))}):Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this))}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&e.delete(this._canvas),this.callback())))}}}(),version="2.5.207";exports.version=version;const build="0974d605";exports.build=build},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var s=r(2);class n{constructor({docId:e,onUnsupportedFeature:t}){this.constructor===n&&(0,s.unreachable)("Cannot initialize BaseFontLoader."),this.docId=e,this._onUnsupportedFeature=t,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(e){this.nativeFontFaces.push(e),document.fonts.add(e)}insertRule(e){let t=this.styleElement;t||(t=this.styleElement=document.createElement("style"),t.id="PDFJS_FONT_STYLE_TAG_"+this.docId,document.documentElement.getElementsByTagName("head")[0].appendChild(t));const r=t.sheet;r.insertRule(e,r.cssRules.length)}clear(){this.nativeFontFaces.forEach((function(e){document.fonts.delete(e)})),this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(e){if(e.attached||e.missingFile)return;if(e.attached=!0,this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(r){throw this._onUnsupportedFeature({featureId:s.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,s.warn)(`Failed to load font \\\'${t.family}\\\': \\\'${r}\\\'.`),e.disableFontFace=!0,r}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const s=this._queueLoadingCallback(r);this._prepareFontLoadEvent([t],[e],s)})}}_queueLoadingCallback(e){(0,s.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){const e="undefined"!=typeof document&&!!document.fonts;return(0,s.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){(0,s.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,s.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(e,t,r){(0,s.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let i;t.FontLoader=i,t.FontLoader=i=class extends n{constructor(e){super(e),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){let e=!1;if("undefined"==typeof navigator)e=!0;else{const t=/Mozilla\\\\/5.0.*?rv:(\\\\d+).*? Gecko/.exec(navigator.userAgent);t&&t[1]>=14&&(e=!0)}return(0,s.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const t=this.loadingContext,r={id:"pdfjs-font-loading-"+t.nextRequestId++,done:!1,complete:function(){for((0,s.assert)(!r.done,"completeRequest() cannot be called twice."),r.done=!0;t.requests.length>0&&t.requests[0].done;){const e=t.requests.shift();setTimeout(e.callback,0)}},callback:e};return t.requests.push(r),r}get _loadTestFont(){return(0,s.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t,r){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function i(e,t,r,s){return e.substring(0,t)+s+e.substring(t+r)}let a,o;const l=document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let h=0;const d=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=i(u,976,d.length,d);let p=n(u,16);for(a=0,o=d.length-3;a30)return(0,s.warn)("Load test font never loaded."),void r();c.font="30px "+t,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?r():setTimeout(e.bind(null,t,r))}(d,(function(){document.body.removeChild(m),r.complete()}))}};t.FontFaceObject=class{constructor(e,{isEvalSupported:t=!0,disableFontFace:r=!1,ignoreErrors:s=!1,onUnsupportedFeature:n=null,fontRegistry:i=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t,this.disableFontFace=!0===r,this.ignoreErrors=!0===s,this._onUnsupportedFeature=n,this.fontRegistry=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;const e=new FontFace(this.loadedName,this.data,{});return this.fontRegistry&&this.fontRegistry.registerFont(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,s.bytesToString)(new Uint8Array(this.data)),t=`url(data:${this.mimetype};base64,${btoa(e)});`,r=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,t),r}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let r,n;try{r=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;return this._onUnsupportedFeature&&this._onUnsupportedFeature({featureId:s.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,s.warn)(`getPathGenerator - ignoring character: "${e}".`),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&s.IsEvalSupportedCached.value){let e,s="";for(let t=0,i=r.length;t>2),_=b.length,y=c+7>>3,v=4294967295,S=s.IsLittleEndianCached.value?4278190080:255;for(n=0;ny?c:8*x-7,k=-8&P,R=0,w=0;C>=1}for(;r<_;)b[r++]=0;e.putImageData(p,0,16*n)}}else if(t.kind===s.ImageKind.RGBA_32BPP){for(i=0,o=16*c*4,n=0;n=d&&(o=c*(a=h)),r=0,i=o;i--;)m[r++]=f[g++],m[r++]=f[g++],m[r++]=f[g++],m[r++]=255;e.putImageData(p,0,16*n)}}}}function r(e,t){for(var r=t.height,s=t.width,n=r%16,i=(r-n)/16,a=0===n?i:i+1,o=e.createImageData(s,16),l=0,c=t.data,h=o.data,d=0;d>=1}e.putImageData(o,0,16*d)}}function l(e,t){for(var r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],s=0,n=r.length;s>8,e[i-2]=e[i-2]*a+r*o>>8,e[i-1]=e[i-1]*a+s*o>>8}}}function d(e,t,r){for(var s=e.length,n=3;n>8]>>8:t[n]*i>>16}}function p(e,t,r,s){var n=t.canvas,i=t.context;e.setTransform(t.scaleX,0,0,t.scaleY,t.offsetX,t.offsetY);var a=t.backdrop||null;if(!t.transferMap&&s.isEnabled){const i=s.composeSMask({layer:r.canvas,mask:n,properties:{subtype:t.subtype,backdrop:a}});return e.setTransform(1,0,0,1,0,0),void e.drawImage(i,t.offsetX,t.offsetY)}!function(e,t,r,s,n,i,a){var o,l=!!i,c=l?i[0]:0,p=l?i[1]:0,g=l?i[2]:0;o="Luminosity"===n?u:d;for(var f=Math.min(s,Math.ceil(1048576/r)),m=0;m10&&"function"==typeof r,d=h?Date.now()+15:0,u=0,p=this.commonObjs,g=this.objs;;){if(void 0!==n&&o===n.nextBreakPoint)return n.breakIt(o,r),o;if((c=a[o])!==s.OPS.dependency)this[c].apply(this,i[o]);else for(const e of i[o]){const t=e.startsWith("g_")?p:g;if(!t.has(e))return t.get(e,r),o}if(++o===l)return o;if(h&&++u>10){if(Date.now()>d)return r(),o;u=0}}},endDrawing:function(){null!==this.current.activeSMask&&this.endSMaskGroup(),this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null),this.cachedCanvases.clear(),this.webGLContext.clear(),this.imageLayer&&this.imageLayer.endLayout()},setLineWidth:function(e){this.current.lineWidth=e,this.ctx.lineWidth=e},setLineCap:function(e){this.ctx.lineCap=g[e]},setLineJoin:function(e){this.ctx.lineJoin=f[e]},setMiterLimit:function(e){this.ctx.miterLimit=e},setDash:function(e,t){var r=this.ctx;void 0!==r.setLineDash&&(r.setLineDash(e),r.lineDashOffset=t)},setRenderingIntent(e){},setFlatness(e){},setGState:function(e){for(var t=0,r=e.length;t0&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask?this.suspendSMaskGroup():this.endSMaskGroup()),this.current.activeSMask=i?this.tempSMask:null,this.current.activeSMask&&this.beginSMaskGroup(),this.tempSMask=null}}},beginSMaskGroup:function(){var e=this.current.activeSMask,t=e.canvas.width,r=e.canvas.height,s="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(s,t,r,!0),i=this.ctx,a=i.mozCurrentTransform;this.ctx.save();var o=n.context;o.scale(1/e.scaleX,1/e.scaleY),o.translate(-e.offsetX,-e.offsetY),o.transform.apply(o,a),e.startTransformInverse=o.mozCurrentTransformInverse,l(i,o),this.ctx=o,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(i),this.groupLevel++},suspendSMaskGroup:function(){var e=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),p(this.ctx,this.current.activeSMask,e,this.webGLContext),this.ctx.restore(),this.ctx.save(),l(e,this.ctx),this.current.resumeSMaskCtx=e;var t=s.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t),e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,e.canvas.width,e.canvas.height),e.restore()},resumeSMaskGroup:function(){var e=this.current.resumeSMaskCtx,t=this.ctx;this.ctx=e,this.groupStack.push(t),this.groupLevel++},endSMaskGroup:function(){var e=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),p(this.ctx,this.current.activeSMask,e,this.webGLContext),this.ctx.restore(),l(e,this.ctx);var t=s.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t)},save:function(){this.ctx.save();var e=this.current;this.stateStack.push(e),this.current=e.clone(),this.current.resumeSMaskCtx=null},restore:function(){this.current.resumeSMaskCtx&&this.resumeSMaskGroup(),null===this.current.activeSMask||0!==this.stateStack.length&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask||this.endSMaskGroup(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.ctx.restore(),this.pendingClip=null,this._cachedGetSinglePixelWidth=null)},transform:function(e,t,r,s,n,i){this.ctx.transform(e,t,r,s,n,i),this._cachedGetSinglePixelWidth=null},constructPath:function(e,t){for(var r=this.ctx,n=this.current,i=n.x,a=n.y,o=0,l=0,c=e.length;o100&&(c=100),this.current.fontSizeScale=t/c,this.ctx.font=`${o} ${a} ${c}px ${l}`},setTextRenderingMode:function(e){this.current.textRenderingMode=e},setTextRise:function(e){this.current.textRise=e},moveText:function(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t},setLeadingMoveText:function(e,t){this.setLeading(-t),this.moveText(e,t)},setTextMatrix:function(e,t,r,s,n,i){this.current.textMatrix=[e,t,r,s,n,i],this.current.textMatrixScale=Math.sqrt(e*e+t*t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},nextLine:function(){this.moveText(0,this.current.leading)},paintChar(e,t,r,n){var i=this.ctx,a=this.current,o=a.font,l=a.textRenderingMode,c=a.fontSize/a.fontSizeScale,h=l&s.TextRenderingMode.FILL_STROKE_MASK,d=!!(l&s.TextRenderingMode.ADD_TO_PATH_FLAG);const u=a.patternFill&&!o.missingFile;var p;((o.disableFontFace||d||u)&&(p=o.getPathGenerator(this.commonObjs,e)),o.disableFontFace||u?(i.save(),i.translate(t,r),i.beginPath(),p(i,c),n&&i.setTransform.apply(i,n),h!==s.TextRenderingMode.FILL&&h!==s.TextRenderingMode.FILL_STROKE||i.fill(),h!==s.TextRenderingMode.STROKE&&h!==s.TextRenderingMode.FILL_STROKE||i.stroke(),i.restore()):(h!==s.TextRenderingMode.FILL&&h!==s.TextRenderingMode.FILL_STROKE||i.fillText(e,t,r),h!==s.TextRenderingMode.STROKE&&h!==s.TextRenderingMode.FILL_STROKE||i.strokeText(e,t,r)),d)&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:i.mozCurrentTransform,x:t,y:r,fontSize:c,addToPath:p})},get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);for(var t=e.getImageData(0,0,10,10).data,r=!1,n=3;n0&&t[n]<255){r=!0;break}return(0,s.shadow)(this,"isFontSubpixelAAEnabled",r)},showText:function(e){var t=this.current,r=t.font;if(r.isType3Font)return this.showType3Text(e);var n=t.fontSize;if(0===n)return;var i=this.ctx,a=t.fontSizeScale,o=t.charSpacing,l=t.wordSpacing,c=t.fontDirection,h=t.textHScale*c,d=e.length,u=r.vertical,p=u?1:-1,g=r.defaultVMetrics,f=n*t.fontMatrix[0],m=t.textRenderingMode===s.TextRenderingMode.FILL&&!r.disableFontFace&&!t.patternFill;let A;if(i.save(),t.patternFill){i.save();const e=t.fillColor.getPattern(i,this);A=i.mozCurrentTransform,i.restore(),i.fillStyle=e}i.transform.apply(i,t.textMatrix),i.translate(t.x,t.y+t.textRise),c>0?i.scale(h,-1):i.scale(h,1);var b=t.lineWidth,_=t.textMatrixScale;if(0===_||0===b){var y=t.textRenderingMode&s.TextRenderingMode.FILL_STROKE_MASK;y!==s.TextRenderingMode.STROKE&&y!==s.TextRenderingMode.FILL_STROKE||(this._cachedGetSinglePixelWidth=null,b=.65*this.getSinglePixelWidth())}else b/=_;1!==a&&(i.scale(a,a),b/=a),i.lineWidth=b;var v,S=0;for(v=0;v0){var N=1e3*i.measureText(I).width/n*a;if(Onew e(t,this.commonObjs,this.objs,this.canvasFactory,this.webGLContext)};r=new n.TilingPattern(t,s,this.ctx,a,i)}else r=(0,n.getShadingPatternFromIR)(t);return r},setStrokeColorN:function(){this.current.strokeColor=this.getColorN_Pattern(arguments)},setFillColorN:function(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0},setStrokeRGBColor:function(e,t,r){var n=s.Util.makeCssRgb(e,t,r);this.ctx.strokeStyle=n,this.current.strokeColor=n},setFillRGBColor:function(e,t,r){var n=s.Util.makeCssRgb(e,t,r);this.ctx.fillStyle=n,this.current.fillColor=n,this.current.patternFill=!1},shadingFill:function(e){var t=this.ctx;this.save();var r=(0,n.getShadingPatternFromIR)(e);t.fillStyle=r.getPattern(t,this,!0);var i=t.mozCurrentTransformInverse;if(i){var a=t.canvas,o=a.width,l=a.height,c=s.Util.applyTransform([0,0],i),h=s.Util.applyTransform([0,l],i),d=s.Util.applyTransform([o,0],i),u=s.Util.applyTransform([o,l],i),p=Math.min(c[0],h[0],d[0],u[0]),g=Math.min(c[1],h[1],d[1],u[1]),f=Math.max(c[0],h[0],d[0],u[0]),m=Math.max(c[1],h[1],d[1],u[1]);this.ctx.fillRect(p,g,f-p,m-g)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()},beginInlineImage:function(){(0,s.unreachable)("Should not call beginInlineImage")},beginImageData:function(){(0,s.unreachable)("Should not call beginImageData")},paintFormXObjectBegin:function(e,t){if(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform.apply(this,e),this.baseTransform=this.ctx.mozCurrentTransform,t){var r=t[2]-t[0],s=t[3]-t[1];this.ctx.rect(t[0],t[1],r,s),this.clip(),this.endPath()}},paintFormXObjectEnd:function(){this.restore(),this.baseTransform=this.baseTransformStack.pop()},beginGroup:function(e){this.save();var t=this.ctx;e.isolated||(0,s.info)("TODO: Support non-isolated groups."),e.knockout&&(0,s.warn)("Knockout groups not supported.");var r=t.mozCurrentTransform;if(e.matrix&&t.transform.apply(t,e.matrix),!e.bbox)throw new Error("Bounding box is required.");var n=s.Util.getAxialAlignedBoundingBox(e.bbox,t.mozCurrentTransform),i=[0,0,t.canvas.width,t.canvas.height];n=s.Util.intersect(n,i)||[0,0,0,0];var a=Math.floor(n[0]),o=Math.floor(n[1]),c=Math.max(Math.ceil(n[2])-a,1),h=Math.max(Math.ceil(n[3])-o,1),d=1,u=1;c>4096&&(d=c/4096,c=4096),h>4096&&(u=h/4096,h=4096);var p="groupAt"+this.groupLevel;e.smask&&(p+="_smask_"+this.smaskCounter++%2);var g=this.cachedCanvases.getCanvas(p,c,h,!0),f=g.context;f.scale(1/d,1/u),f.translate(-a,-o),f.transform.apply(f,r),e.smask?this.smaskStack.push({canvas:g.canvas,context:f,offsetX:a,offsetY:o,scaleX:d,scaleY:u,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(a,o),t.scale(d,u)),l(t,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++,this.current.activeSMask=null},endGroup:function(e){this.groupLevel--;var t=this.ctx;this.ctx=this.groupStack.pop(),void 0!==this.ctx.imageSmoothingEnabled?this.ctx.imageSmoothingEnabled=!1:this.ctx.mozImageSmoothingEnabled=!1,e.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(t.canvas,0,0),this.restore()},beginAnnotations:function(){this.save(),this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)},endAnnotations:function(){this.restore()},beginAnnotation:function(e,t,r){if(this.save(),c(this.ctx),this.current=new o,Array.isArray(e)&&4===e.length){var s=e[2]-e[0],n=e[3]-e[1];this.ctx.rect(e[0],e[1],s,n),this.clip(),this.endPath()}this.transform.apply(this,t),this.transform.apply(this,r)},endAnnotation:function(){this.restore()},paintImageMaskXObject:function(e){var t=this.ctx,s=e.width,n=e.height,i=this.current.fillColor,a=this.current.patternFill,o=this.processingType3;if(o&&void 0===o.compiled&&(o.compiled=s<=1e3&&n<=1e3?function(e){var t,r,s,n,i=e.width,a=e.height,o=i+1,l=new Uint8Array(o*(a+1)),c=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),h=i+7&-8,d=e.data,u=new Uint8Array(h*a),p=0;for(t=0,n=d.length;t0;)u[p++]=f&g?0:255,g>>=1;var m=0;for(0!==u[p=0]&&(l[0]=1,++m),r=1;r>2)+(u[p+1]?4:0)+(u[p-h+1]?8:0)]&&(l[s+r]=c[A],++m),p++;if(u[p-h]!==u[p]&&(l[s+r]=u[p]?2:4,++m),m>1e3)return null}for(s=t*o,0!==u[p=h*(a-1)]&&(l[s]=8,++m),r=1;r1e3)return null;var b=new Int32Array([0,o,-1,0,-o,0,0,0,1]),_=[];for(t=0;m&&t<=a;t++){for(var y=t*o,v=y+i;y>4,l[y]&=C>>2|C<<2),x.push(y%o),x.push(y/o|0),l[y]||--m}while(P!==y);_.push(x),--t}}return function(e){e.save(),e.scale(1/i,-1/a),e.translate(0,-a),e.beginPath();for(let r=0,s=_.length;r2&&f>1||p>2&&m>1;){var b=f,_=m;h>2&&f>1&&(h/=f/(b=Math.ceil(f/2))),p>2&&m>1&&(p/=m/(_=Math.ceil(m/2))),(g=(a=this.cachedCanvases.getCanvas(A,b,_)).context).clearRect(0,0,b,_),g.drawImage(i,0,0,f,m,0,0,b,_),i=a.canvas,f=b,m=_,A="prescale1"===A?"prescale2":"prescale1"}if(n.drawImage(i,0,0,f,m,0,-s,r,s),this.imageLayer){var y=this.getCanvasPosition(0,-s);this.imageLayer.appendImage({imgData:e,left:y[0],top:y[1],width:r/o[0],height:s/o[3]})}this.restore()},paintInlineImageXObjectGroup:function(e,r){var s=this.ctx,n=e.width,i=e.height,a=this.cachedCanvases.getCanvas("inlineImage",n,i);t(a.context,e);for(var o=0,l=r.length;oc[s+1]&&(l=r,r=s,s=l,l=i,i=a,a=l),c[s+1]>c[n+1]&&(l=s,s=n,n=l,l=a,a=o,o=l),c[r+1]>c[s+1]&&(l=r,r=s,s=l,l=i,i=a,a=l);var p=(c[r]+t.offsetX)*t.scaleX,g=(c[r+1]+t.offsetY)*t.scaleY,f=(c[s]+t.offsetX)*t.scaleX,m=(c[s+1]+t.offsetY)*t.scaleY,A=(c[n]+t.offsetX)*t.scaleX,b=(c[n+1]+t.offsetY)*t.scaleY;if(!(g>=b))for(var _,y,v,S,x,C,P,k,R=h[i],w=h[i+1],T=h[i+2],E=h[a],F=h[a+1],L=h[a+2],I=h[o],M=h[o+1],O=h[o+2],N=Math.round(g),D=Math.round(b),j=N;j<=D;j++){if(jb?1:m===b?0:(m-j)/(m-b),_=f-(f-A)*e,y=E-(E-I)*e,v=F-(F-M)*e,S=L-(L-O)*e}let e;e=jb?1:(g-j)/(g-b),x=p-(p-A)*e,C=R-(R-I)*e,P=w-(w-M)*e,k=T-(T-O)*e;for(var U=Math.round(Math.min(_,x)),q=Math.round(Math.max(_,x)),W=u*j+4*U,G=U;G<=q;G++)e=(_-G)/(_-x),e<0?e=0:e>1&&(e=1),d[W++]=y-(y-C)*e|0,d[W++]=v-(v-P)*e|0,d[W++]=S-(S-k)*e|0,d[W++]=255}}function t(t,r,s){var n,i,a=r.coords,o=r.colors;switch(r.type){case"lattice":var l=r.verticesPerRow,c=Math.floor(a.length/l)-1,h=l-1;for(n=0;n=s?n=s:r=n/e,{scale:r,size:n}},clipBbox:function(e,t,r,s,n,i){if(Array.isArray(t)&&4===t.length){var a=n-r,o=i-s;e.ctx.rect(r,s,a,o),e.clip(),e.endPath()}},setFillAndStrokeStyleToContext:function(r,n,i){const a=r.ctx,o=r.current;switch(n){case e:var l=this.ctx;a.fillStyle=l.fillStyle,a.strokeStyle=l.strokeStyle,o.fillColor=l.fillStyle,o.strokeColor=l.strokeStyle;break;case t:var c=s.Util.makeCssRgb(i[0],i[1],i[2]);a.fillStyle=c,a.strokeStyle=c,o.fillColor=c,o.strokeColor=c;break;default:throw new s.FormatError("Unsupported paint type: "+n)}},getPattern:function(e,t){(e=this.ctx).setTransform.apply(e,this.baseTransform),e.transform.apply(e,this.matrix);var r=this.createPatternCanvas(t);return e.createPattern(r,"repeat")}},r}();t.TilingPattern=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;const s=Object.create(null);t.GlobalWorkerOptions=s,s.workerPort=void 0===s.workerPort?null:s.workerPort,\';a.g+=\'s.workerSrc=void 0===s.workerSrc?"":s.workerSrc},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var s=r(2);const n=1,i=2,a=1,o=2,l=3,c=4,h=5,d=6,u=7,p=8;function g(e){if("object"!=typeof e||null===e)return e;switch(e.name){case"AbortException":return new s.AbortException(e.message);case"MissingPDFException":return new s.MissingPDFException(e.message);case"UnexpectedResponseException":return new s.UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new s.UnknownErrorException(e.message,e.details);default:return new s.UnknownErrorException(e.message,e.toString())}}t.MessageHandler=class{constructor(e,t,r){this.sourceName=e,this.targetName=t,this.comObj=r,this.callbackId=1,this.streamId=1,this.postMessageTransfers=!0,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=e=>{const t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream)return void this._processStreamMessage(t);if(t.callback){const e=t.callbackId,r=this.callbackCapabilities[e];if(!r)throw new Error("Cannot resolve callback "+e);if(delete this.callbackCapabilities[e],t.callback===n)r.resolve(t.data);else{if(t.callback!==i)throw new Error("Unexpected callback case");r.reject(g(t.reason))}return}const s=this.actionHandler[t.action];if(!s)throw new Error("Unknown action from worker: "+t.action);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(s(t.data))})).then((function(s){r.postMessage({sourceName:e,targetName:a,callback:n,callbackId:t.callbackId,data:s})}),(function(s){r.postMessage({sourceName:e,targetName:a,callback:i,callbackId:t.callbackId,reason:g(s)})}))}else t.streamId?this._createStreamSink(t):s(t.data)},r.addEventListener("message",this._onComObjOnMessage)}on(e,t){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=t}send(e,t,r){this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},r)}sendWithPromise(e,t,r){const n=this.callbackId++,i=(0,s.createPromiseCapability)();this.callbackCapabilities[n]=i;try{this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t},r)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,r,n){const i=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:r=>{const a=(0,s.createPromiseCapability)();return this.streamControllers[i]={controller:r,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},this._postMessage({sourceName:o,targetName:l,action:e,streamId:i,data:t,desiredSize:r.desiredSize},n),a.promise},pull:e=>{const t=(0,s.createPromiseCapability)();return this.streamControllers[i].pullCall=t,c.postMessage({sourceName:o,targetName:l,stream:d,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,s.assert)(e instanceof Error,"cancel must have a valid reason");const t=(0,s.createPromiseCapability)();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:a,streamId:i,reason:g(e)}),t.promise}},r)}_createStreamSink(e){const t=this,r=this.actionHandler[e.action],n=e.streamId,i=this.sourceName,a=e.sourceName,o=this.comObj,d={enqueue(e,r=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=r,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,s.createPromiseCapability)(),this.ready=this.sinkCapability.promise),t._postMessage({sourceName:i,targetName:a,stream:c,streamId:n,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:a,stream:l,streamId:n}),delete t.streamSinks[n])},error(e){(0,s.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:a,stream:h,streamId:n,reason:g(e)}))},sinkCapability:(0,s.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[n]=d,new Promise((function(t){t(r(e.data,d))})).then((function(){o.postMessage({sourceName:i,targetName:a,stream:p,streamId:n,success:!0})}),(function(e){o.postMessage({sourceName:i,targetName:a,stream:p,streamId:n,reason:g(e)})}))}_processStreamMessage(e){const t=e.streamId,r=this.sourceName,n=e.sourceName,i=this.comObj;switch(e.stream){case p:e.success?this.streamControllers[t].startCall.resolve():this.streamControllers[t].startCall.reject(g(e.reason));break;case u:e.success?this.streamControllers[t].pullCall.resolve():this.streamControllers[t].pullCall.reject(g(e.reason));break;case d:if(!this.streamSinks[t]){i.postMessage({sourceName:r,targetName:n,stream:u,streamId:t,success:!0});break}this.streamSinks[t].desiredSize<=0&&e.desiredSize>0&&this.streamSinks[t].sinkCapability.resolve(),this.streamSinks[t].desiredSize=e.desiredSize;const{onPull:f}=this.streamSinks[e.streamId];new Promise((function(e){e(f&&f())})).then((function(){i.postMessage({sourceName:r,targetName:n,stream:u,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:r,targetName:n,stream:u,streamId:t,reason:g(e)})}));break;case c:if((0,s.assert)(this.streamControllers[t],"enqueue should have stream controller"),this.streamControllers[t].isClosed)break;this.streamControllers[t].controller.enqueue(e.chunk);break;case l:if((0,s.assert)(this.streamControllers[t],"close should have stream controller"),this.streamControllers[t].isClosed)break;this.streamControllers[t].isClosed=!0,this.streamControllers[t].controller.close(),this._deleteStreamController(t);break;case h:(0,s.assert)(this.streamControllers[t],"error should have stream controller"),this.streamControllers[t].controller.error(g(e.reason)),this._deleteStreamController(t);break;case o:e.success?this.streamControllers[t].cancelCall.resolve():this.streamControllers[t].cancelCall.reject(g(e.reason)),this._deleteStreamController(t);break;case a:if(!this.streamSinks[t])break;const{onCancel:m}=this.streamSinks[e.streamId];new Promise((function(t){t(m&&m(g(e.reason)))})).then((function(){i.postMessage({sourceName:r,targetName:n,stream:o,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:r,targetName:n,stream:o,streamId:t,reason:g(e)})})),this.streamSinks[t].sinkCapability.reject(g(e.reason)),this.streamSinks[t].isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(e){await Promise.allSettled([this.streamControllers[e].startCall,this.streamControllers[e].pullCall,this.streamControllers[e].cancelCall].map((function(e){return e&&e.promise}))),delete this.streamControllers[e]}_postMessage(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var s=r(2),n=r(13);t.Metadata=class{constructor(e){(0,s.assert)("string"==typeof e,"Metadata: input is not a string"),e=this._repair(e);const t=(new n.SimpleXMLParser).parseFromString(e);this._metadataMap=new Map,t&&this._parse(t)}_repair(e){return e.replace(/^[^<]+/,"").replace(/>\\\\\\\\376\\\\\\\\377([^<]+)/g,(function(e,t){const r=t.replace(/\\\\\\\\([0-3])([0-7])([0-7])/g,(function(e,t,r,s){return String.fromCharCode(64*t+8*r+1*s)})).replace(/&(amp|apos|gt|lt|quot);/g,(function(e,t){switch(t){case"amp":return"&";case"apos":return"\\\'";case"gt":return">";case"lt":return"<";case"quot":return\\\'"\\\'}throw new Error(`_repair: ${t} isn\\\'t defined.`)}));let s="";for(let e=0,t=r.length;e=32&&t<127&&60!==t&&62!==t&&38!==t?String.fromCharCode(t):"&#x"+(65536+t).toString(16).substring(1)+";"}return">"+s}))}_parse(e){let t=e.documentElement;if("rdf:rdf"!==t.nodeName.toLowerCase())for(t=t.firstChild;t&&"rdf:rdf"!==t.nodeName.toLowerCase();)t=t.nextSibling;const r=t?t.nodeName.toLowerCase():null;if(!t||"rdf:rdf"!==r||!t.hasChildNodes())return;const s=t.childNodes;for(let e=0,t=s.length;e0}}t.SimpleXMLParser=class extends class{_resolveEntities(e){return e.replace(/&([^;]+);/g,(e,t)=>{if("#x"===t.substring(0,2))return String.fromCharCode(parseInt(t.substring(2),16));if("#"===t.substring(0,1))return String.fromCharCode(parseInt(t.substring(1),10));switch(t){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return\\\'"\\\'}return this.onResolveEntity(t)})}_parseContent(e,t){const r=[];let s=t;function n(){for(;s"!==e[s]&&"/"!==e[s];)++s;const i=e.substring(t,s);for(n();s"!==e[s]&&"/"!==e[s]&&"?"!==e[s];){n();let t="",i="";for(;s"!==e[r]&&"/"!==e[r];)++r;const s=e.substring(t,r);!function(){for(;r"!==e[r+1]);)++r;return{name:s,value:e.substring(n,r),parsed:r-t}}parseXml(e){let t=0;for(;t",r),t<0)return void this.onError(c);this.onEndElement(e.substring(r,t)),r=t+1;break;case"?":++r;const s=this._parseProcessingInstruction(e,r);if("?>"!==e.substring(r+s.parsed,r+s.parsed+2))return void this.onError(i);this.onPi(s.name,s.value),r+=s.parsed+2;break;case"!":if("--"===e.substring(r+1,r+3)){if(t=e.indexOf("--\\\\x3e",r+3),t<0)return void this.onError(o);this.onComment(e.substring(r+3,t)),r=t+3}else if("[CDATA["===e.substring(r+1,r+8)){if(t=e.indexOf("]]>",r+8),t<0)return void this.onError(n);this.onCdata(e.substring(r+8,t)),r=t+3}else{if("DOCTYPE"!==e.substring(r+1,r+8))return void this.onError(l);{const s=e.indexOf("[",r+8);let n=!1;if(t=e.indexOf(">",r+8),t<0)return void this.onError(a);if(s>0&&t>s){if(t=e.indexOf("]>",r+8),t<0)return void this.onError(a);n=!0}const i=e.substring(r+8,t+(n?1:0));this.onDoctype(i),r=t+(n?2:1)}}break;default:const h=this._parseContent(e,r);if(null===h)return void this.onError(l);let d=!1;if("/>"===e.substring(r+h.parsed,r+h.parsed+2))d=!0;else if(">"!==e.substring(r+h.parsed,r+h.parsed+1))return void this.onError(c);this.onBeginElement(h.name,h.attributes,d),r+=h.parsed+(d?2:1)}}else{for(;r0){const e=new Uint8Array(r).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._contentLength=e.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((e,t)=>{this._onReceiveData({begin:e,chunk:t})}),this._pdfDataRangeTransport.addProgressListener((e,t)=>{this._onProgress({loaded:e,total:t})}),this._pdfDataRangeTransport.addProgressiveReadListener(e=>{this._onReceiveData({chunk:e})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData(e){const t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{const r=this._rangeReaders.some((function(r){return r._begin===e.begin&&(r._enqueue(t),!0)}));(0,s.assert)(r,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}_onProgress(e){if(void 0===e.total){const t=this._rangeReaders[0];t&&t.onProgress&&t.onProgress({loaded:e.loaded})}else{const t=this._fullRequestReader;t&&t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,s.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new n(this,e,this._progressiveDone)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new i(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeReaders.slice(0).forEach((function(t){t.cancel(e)})),this._pdfDataRangeTransport.abort()}};class n{constructor(e,t,r=!1){this._stream=e,this._done=r||!1,this._filename=null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunks.push(e);this._loaded+=e.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._d\';a.g+=\'one)return{value:void 0,done:!0};const e=(0,s.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[]}progressiveDone(){this._done||(this._done=!0)}}class i{constructor(e,t,r){this._stream=e,this._begin=t,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1}),this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[]}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,s.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[],this._stream._removeRangeReader(this)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLContext=void 0;var s=r(2);t.WebGLContext=class{constructor({enable:e=!1}){this._enabled=!0===e}get isEnabled(){let e=this._enabled;return e&&(e=n.tryInitGL()),(0,s.shadow)(this,"isEnabled",e)}composeSMask({layer:e,mask:t,properties:r}){return n.composeSMask(e,t,r)}drawFigures({width:e,height:t,backgroundColor:r,figures:s,context:i}){return n.drawFigures(e,t,r,s,i)}clear(){n.cleanup()}};var n=function(){function e(e,t,r){var s=e.createShader(r);if(e.shaderSource(s,t),e.compileShader(s),!e.getShaderParameter(s,e.COMPILE_STATUS)){var n=e.getShaderInfoLog(s);throw new Error("Error during shader compilation: "+n)}return s}function t(t,r){return e(t,r,t.VERTEX_SHADER)}function r(t,r){return e(t,r,t.FRAGMENT_SHADER)}function s(e,t){for(var r=e.createProgram(),s=0,n=t.length;s 0.0) { maskColor.rgb = maskColor.rgb * maskColor.a + u_backdrop.rgb * (1.0 - maskColor.a); } float lum; if (u_subtype == 0) { lum = maskColor.a; } else { lum = maskColor.r * 0.3 + maskColor.g * 0.59 + maskColor.b * 0.11; } imageColor.a *= lum; imageColor.rgb *= imageColor.a; gl_FragColor = imageColor; } ")]);n.useProgram(c);var h={};h.gl=n,h.canvas=e,h.resolutionLocation=n.getUniformLocation(c,"u_resolution"),h.positionLocation=n.getAttribLocation(c,"a_position"),h.backdropLocation=n.getUniformLocation(c,"u_backdrop"),h.subtypeLocation=n.getUniformLocation(c,"u_subtype");var d=n.getAttribLocation(c,"a_texCoord"),u=n.getUniformLocation(c,"u_image"),p=n.getUniformLocation(c,"u_mask"),g=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,g),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),n.STATIC_DRAW),n.enableVertexAttribArray(d),n.vertexAttribPointer(d,2,n.FLOAT,!1,0,0),n.uniform1i(u,0),n.uniform1i(p,1),l=h}();var p=l,g=p.canvas,f=p.gl;g.width=d,g.height=u,f.viewport(0,0,f.drawingBufferWidth,f.drawingBufferHeight),f.uniform2f(p.resolutionLocation,d,u),h.backdrop?f.uniform4f(p.resolutionLocation,h.backdrop[0],h.backdrop[1],h.backdrop[2],1):f.uniform4f(p.resolutionLocation,0,0,0,0),f.uniform1i(p.subtypeLocation,"Luminosity"===h.subtype?1:0);var m=n(f,e,f.TEXTURE0),A=n(f,c,f.TEXTURE1),b=f.createBuffer();return f.bindBuffer(f.ARRAY_BUFFER,b),f.bufferData(f.ARRAY_BUFFER,new Float32Array([0,0,d,0,0,u,0,u,d,0,d,u]),f.STATIC_DRAW),f.enableVertexAttribArray(p.positionLocation),f.vertexAttribPointer(p.positionLocation,2,f.FLOAT,!1,0,0),f.clearColor(0,0,0,0),f.enable(f.BLEND),f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA),f.clear(f.COLOR_BUFFER_BIT),f.drawArrays(f.TRIANGLES,0,6),f.flush(),f.deleteTexture(m),f.deleteTexture(A),f.deleteBuffer(b),g},drawFigures:function(e,n,l,h,d){c||function(){var e,n;o(),e=a,a=null,n=i,i=null;var l=s(n,[t(n," attribute vec2 a_position; attribute vec3 a_color; uniform vec2 u_resolution; uniform vec2 u_scale; uniform vec2 u_offset; varying vec4 v_color; void main() { vec2 position = (a_position + u_offset) * u_scale; vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_color = vec4(a_color / 255.0, 1.0); } "),r(n," precision mediump float; varying vec4 v_color; void main() { gl_FragColor = v_color; } ")]);n.useProgram(l);var h={};h.gl=n,h.canvas=e,h.resolutionLocation=n.getUniformLocation(l,"u_resolution"),h.scaleLocation=n.getUniformLocation(l,"u_scale"),h.offsetLocation=n.getUniformLocation(l,"u_offset"),h.positionLocation=n.getAttribLocation(l,"a_position"),h.colorLocation=n.getAttribLocation(l,"a_color"),c=h}();var u=c,p=u.canvas,g=u.gl;p.width=e,p.height=n,g.viewport(0,0,g.drawingBufferWidth,g.drawingBufferHeight),g.uniform2f(u.resolutionLocation,e,n);var f,m,A,b=0;for(f=0,m=h.length;f0){i.style.borderWidth=t.borderStyle.width+"px",t.borderStyle.style!==n.AnnotationBorderStyleType.UNDERLINE&&(a-=2*t.borderStyle.width,o-=2*t.borderStyle.width);const e=t.borderStyle.horizontalCornerRadius,r=t.borderStyle.verticalCornerRadius;if(e>0||r>0){const t=`${e}px / ${r}px`;i.style.borderRadius=t}switch(t.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:i.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:i.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:i.style.borderBottomStyle="solid"}t.color?i.style.borderColor=n.Util.makeCssRgb(0|t.color[0],0|t.color[1],0|t.color[2]):i.style.borderWidth=0}return i.style.left=l[0]+"px",i.style.top=l[1]+"px",i.style.width=a+"px",i.style.height=o+"px",i}_createPopup(e,t,r){t||((t=document.createElement("div")).style.height=e.style.height,t.style.width=e.style.width,e.appendChild(t));const s=new m({container:e,trigger:t,color:r.color,title:r.title,modificationDate:r.modificationDate,contents:r.contents,hideWrapper:!0}).render();s.style.left=e.style.width,e.appendChild(s)}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}}class o extends a{constructor(e){super(e,!!(e.data.url||e.data.dest||e.data.action))}render(){this.container.className="linkAnnotation";const{data:e,linkService:t}=this,r=document.createElement("a");return e.url?(0,s.addLinkAttributes)(r,{url:e.url,target:e.newWindow?s.LinkTarget.BLANK:t.externalLinkTarget,rel:t.externalLinkRel,enabled:t.externalLinkEnabled}):e.action?this._bindNamedAction(r,e.action):this._bindLink(r,e.dest),this.container.appendChild(r),this.container}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.navigateTo(t),!1),t&&(e.className="internalLink")}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),e.className="internalLink"}}class l extends a{constructor(e){super(e,!!(e.data.hasPopup||e.data.title||e.data.contents))}render(){this.container.className="textAnnotation";const e=document.createElement("img");return e.style.height=this.container.style.height,e.style.width=this.container.style.width,e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.alt="[{{type}} Annotation]",e.dataset.l10nId="text_annotation_type",e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(this.container,e,this.data),this.container.appendChild(e),this.container}}class c extends a{render(){return this.container}}class h extends c{constructor(e){super(e,e.renderInteractiveForms||!e.data.hasAppearance&&!!e.data.fieldValue)}render(){const e=["left","center","right"];this.container.className="textWidgetAnnotation";let t=null;if(this.renderInteractiveForms){if(this.data.multiLine?(t=document.createElement("textarea"),t.textContent=this.data.fieldValue):(t=document.createElement("input"),t.type="text",t.setAttribute("value",this.data.fieldValue)),t.disabled=this.data.readOnly,t.name=this.data.fieldName,null!==this.data.maxLen&&(t.maxLength=this.data.maxLen),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;t.classList.add("comb"),t.style.letterSpacing=`calc(${e}px - 1ch)`}}else{t=document.createElement("div"\';a.g+=\'),t.textContent=this.data.fieldValue,t.style.verticalAlign="middle",t.style.display="table-cell";let e=null;this.data.fontRefName&&this.page.commonObjs.has(this.data.fontRefName)&&(e=this.page.commonObjs.get(this.data.fontRefName)),this._setTextStyle(t,e)}return null!==this.data.textAlignment&&(t.style.textAlign=e[this.data.textAlignment]),this.container.appendChild(t),this.container}_setTextStyle(e,t){const r=e.style;if(r.fontSize=this.data.fontSize+"px",r.direction=this.data.fontDirection<0?"rtl":"ltr",!t)return;let s="normal";t.black?s="900":t.bold&&(s="bold"),r.fontWeight=s,r.fontStyle=t.italic?"italic":"normal";const n=t.loadedName?`"${t.loadedName}", `:"",i=t.fallbackName||"Helvetica, sans-serif";r.fontFamily=n+i}}class d extends c{constructor(e){super(e,e.renderInteractiveForms)}render(){this.container.className="buttonWidgetAnnotation checkBox";const e=document.createElement("input");return e.disabled=this.data.readOnly,e.type="checkbox",e.name=this.data.fieldName,this.data.fieldValue&&"Off"!==this.data.fieldValue&&e.setAttribute("checked",!0),this.container.appendChild(e),this.container}}class u extends c{constructor(e){super(e,e.renderInteractiveForms)}render(){this.container.className="buttonWidgetAnnotation radioButton";const e=document.createElement("input");return e.disabled=this.data.readOnly,e.type="radio",e.name=this.data.fieldName,this.data.fieldValue===this.data.buttonValue&&e.setAttribute("checked",!0),this.container.appendChild(e),this.container}}class p extends o{render(){const e=super.render();return e.className="buttonWidgetAnnotation pushButton",e}}class g extends c{constructor(e){super(e,e.renderInteractiveForms)}render(){this.container.className="choiceWidgetAnnotation";const e=document.createElement("select");e.disabled=this.data.readOnly,e.name=this.data.fieldName,this.data.combo||(e.size=this.data.options.length,this.data.multiSelect&&(e.multiple=!0));for(const t of this.data.options){const r=document.createElement("option");r.textContent=t.displayValue,r.value=t.exportValue,this.data.fieldValue.includes(t.displayValue)&&r.setAttribute("selected",!0),e.appendChild(r)}return this.container.appendChild(e),this.container}}class f extends a{constructor(e){super(e,!(!e.data.title&&!e.data.contents))}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const e=`[data-annotation-id="${this.data.parentId}"]`,t=this.layer.querySelector(e);if(!t)return this.container;const r=new m({container:this.container,trigger:t,color:this.data.color,title:this.data.title,modificationDate:this.data.modificationDate,contents:this.data.contents}),s=parseFloat(t.style.left),n=parseFloat(t.style.width);return this.container.style.transformOrigin=`-${s+n}px -${t.style.top}`,this.container.style.left=s+n+"px",this.container.appendChild(r.render()),this.container}}class m{constructor(e){this.container=e.container,this.trigger=e.trigger,this.color=e.color,this.title=e.title,this.modificationDate=e.modificationDate,this.contents=e.contents,this.hideWrapper=e.hideWrapper||!1,this.pinned=!1}render(){const e=document.createElement("div");e.className="popupWrapper",this.hideElement=this.hideWrapper?e:this.container,this.hideElement.setAttribute("hidden",!0);const t=document.createElement("div");t.className="popup";const r=this.color;if(r){const e=.7*(255-r[0])+r[0],s=.7*(255-r[1])+r[1],i=.7*(255-r[2])+r[2];t.style.backgroundColor=n.Util.makeCssRgb(0|e,0|s,0|i)}const i=document.createElement("h1");i.textContent=this.title,t.appendChild(i);const a=s.PDFDateString.toDateObject(this.modificationDate);if(a){const e=document.createElement("span");e.textContent="{{date}}, {{time}}",e.dataset.l10nId="annotation_date_string",e.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()}),t.appendChild(e)}const o=this._formatContents(this.contents);return t.appendChild(o),this.trigger.addEventListener("click",this._toggle.bind(this)),this.trigger.addEventListener("mouseover",this._show.bind(this,!1)),this.trigger.addEventListener("mouseout",this._hide.bind(this,!1)),t.addEventListener("click",this._hide.bind(this,!0)),e.appendChild(t),e}_formatContents(e){const t=document.createElement("p"),r=e.split(/(?:\\\\r\\\\n?|\\\\n)/);for(let e=0,s=r.length;e1)f=!0;else if(r.transform[0]!==r.transform[3]){const e=Math.abs(r.transform[0]),t=Math.abs(r.transform[3]);e!==t&&Math.max(e,t)/Math.min(e,t)>1.5&&(f=!0)}if(f&&(h.vertical?o.canvasWidth=r.height*t._viewport.scale:o.canvasWidth=r.width*t._viewport.scale),t._textDivProperties.set(a,o),t._textContentStream&&t._layoutText(a),t._enhanceTextSelection){var m=1,A=0;0!==c&&(m=Math.cos(c),A=Math.sin(c));var b,_,y=(h.vertical?r.height:r.width)*t._viewport.scale,v=d;0!==c?(b=[m,A,-A,m,p,g],_=s.Util.getAxialAlignedBoundingBox([0,0,y,v],b)):_=[p,g,p+y,g+v],t._bounds.push({left:_[0],top:_[1],right:_[2],bottom:_[3],div:a,size:[y,v],m:b})}}function r(e){if(!e._canceled){var t=e._textDivs,r=e._capability,s=t.length;if(s>1e5)return e._renderingDone=!0,void r.resolve();if(!e._textContentStream)for(var n=0;n0&&(s=s?Math.min(r,s):r)}return s}function i(e){for(var t=e._bounds,r=e._viewport,i=function(e,t,r){var s=r.map((function(e,t){return{x1:e.left,y1:e.top,x2:e.right,y2:e.bottom,index:t,x1New:void 0,x2New:void 0}}));a(e,s);var n=new Array(r.length);return s.forEach((function(e){var t=e.index;n[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}})),r.map((function(t,r){var i=n[r],a=s[r];a.x1=t.top,a.y1=e-i.right,a.x2=t.bottom,a.y2=e-i.left,a.index=r,a.x1New=void 0,a.x2New=void 0})),a(t,s),s.forEach((function(e){var t=e.index;n[t].top=e.x1New,n[t].bottom=e.x2New})),n}(r.width,r.height,t),o=0;o=0&&r[i].start>=e.y2;)i--;var a,o,l=-1/0;for(a=t;a<=i;a++){var c;(c=(n=(s=r[a]).boundary).x2>e.x1?n.index>e.index?n.x1New:e.x1:void 0===n.x2New?(n.x2+e.x1)/2:n.x2New)>l&&(l=c)}for(e.x1New=l,a=t;a<=i;a++)void 0===(n=(s=r[a]).boundary).x2New?n.x2>e.x1?n.index>e.index&&(n.x2New=n.x2):n.x2New=l:n.x2New>l&&(n.x2New=Math.max(l,n.x2));var h=[],d=null;for(a=t;a<=i;a++){var u=(n=(s=r[a]).boundary).x2>e.x2?n:e;d===u?h[h.length-1].end=s.end:(h.push({start:s.start,end:s.end,boundary:u}),d=u)}for(r[t].start=0&&r[o].start>=n.y1;o--)p=r[o].boundary===n;for(o=i+1;!p&&o{this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)}).catch(()=>{})}return o.prototype={get promise(){return this._capability.promise},cancel:function(){this._canceled=!0,this._reader&&(this._reader.cancel(new s.AbortException("TextLayer task cancelled.")),this._reader=null),null!==this._renderTimer&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))},_processItems(e,r){for(let s=0,n=e.length;s0&&(t.scale=t.canvasWidth/i,r=`scaleX(${t.scale})`)}0!==t.angle&&(r=`rotate(${t.angle}deg) ${r}`),r.length>0&&(this._enhanceTextSelection&&(t.originalTransform=r),e.style.transform=r),this._textDivProperties.set(e,t),this._container.appendChild(e)},_render:function(e){const t=(0,s.createPromiseCapability)();let n=Object.create(null);const i=document.createElement("canvas");if(i.mozOpaque=!0,this._layoutTextCtx=i.getContext("2d",{alpha:!1}),this._textContent){const e=this._textContent.items,r=this._textContent.styles;this._processItems(e,r),t.resolve()}else{if(!this._textContentStream)throw new Error(\\\'Neither "textContent" nor "textContentStream" parameters specified.\\\');{const e=()=>{this._reader.read().then(({value:r,done:s})=>{s?t.resolve():(Object.assign(n,r.styles),this._processItems(r.items,n),e())},t.reject)};this._reader=this._textContentStream.getReader(),e()}}t.promise.then(()=>{n=null,e?this._renderTimer=setTimeout(()=>{r(this),this._renderTimer=null},e):r(this)},this._capability.reject)},expandTextDivs:function(e){if(!this._enhanceTextSelection||!this._renderingDone)return;null!==this._bounds&&(i(this),this._bounds=null);const t=[],r=[];for(var s=0,n=this._textDivs.length;s0?(r.push(i.paddingTop+"px"),t.push(`translateY(${-i.paddingTop}px)`)):r.push(0),i.paddingRight>0?r.push(i.paddingRight/i.scale+"px"):r.push(0),i.paddingBottom>0?r.push(i.paddingBottom+"px"):r.push(0),i.paddingLeft>0?(r.push(i.paddingLeft/i.scale+"px"),t.push(`translateX(${-i.paddingLeft/i.scale}px)`)):r.push(0),n.style.padding=r.join(" "),t.length&&(n.style.transform=t.join(" "))):(n.style.padding=null,n.style.transform=i.originalTransform))}}},function(e){var t=new o({textContent:e.textContent,textContentStream:e.textContentStream,container:e.container,viewport:e.viewport,textDivs:e.textDivs,textContentItemsStr:e.textContentItemsStr,enhanceTextSelection:e.enhanceTextSelection});return t._render(e.timeout),t}}();t.renderTextLayer=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var s=r(2),n=r(1),i=r(4);let a=function(){throw new Error("Not implemented: SVGGraphics")};t.SVGGraphics=a;{const e={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},r="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/1999/xlink",h=["butt","round","square"],d=["miter","round","bevel"],u=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=new Int32Array(256);for(let e=0;e<256;e++){let r=e;for(let e=0;e<8;e++)r=1&r?3988292384^r>>1&2147483647:r>>1&2147483647;t[e]=r}function r(e,r,s,n){let i=n;const a=r.length;s[i]=a>>24&255,s[i+1]=a>>16&255,s[i+2]=a>>8&255,s[i+3]=255&a,i+=4,s[i]=255&e.charCodeAt(0),s[i+1]=255&e.charCodeAt(1),s[i+2]=255&e.charCodeAt(2),s[i+3]=255&e.charCodeAt(3),i+=4,s.set(r,i),i+=r.length;const o=function(e,r,s){let n=-1;for(let i=r;i>>8^t[r]}return-1^n}(s,n+4,i);s[i]=o>>24&255,s[i+1]=o>>16&255,s[i+2]=o>>8&255,s[i+3]=255&o}function n(e){let t=e.length;const r=Math.ceil(t/65535),s=new Uint8Array(2+t+5*r+4);let n=0;s[n++]=120,s[n++]=156;let i=0;for(;t>65535;)s[n++]=0,s[n++]=255,s[n++]=255,s[n++]=0,s[n++]=0,s.set(e.subarray(i,i+65535),n),n+=65535,i+=65535,t-=65535;s[n++]=1,s[n++]=255&t,s[n++]=t>>8&255,s[n++]=255&~t,s[n++]=(65535&~t)>>8&255,s.set(e.subarray(i),n),n+=e.length-i;const a=function(e,t,r){let s=1,n=0;for(let i=t;i>24&255,s[n++]=a>>16&255,s[n++]=a>>8&255,s[n++]=255&a,s}function a(t,a,o,l){const c=t.width,h=t.height;let d,u,p;const g=t.data;switch(a){case s.ImageKind.GRAYSCALE_1BPP:u=0,d=1,p=c+7>>3;break;case s.ImageKind.RGB_24BPP:u=2,d=8,p=3*c;break;case s.ImageKind.RGBA_32BPP:u=6,d=8,p=4*c;break;default:throw new Error("invalid format")}const f=new Uint8Array((1+p)*h);let m=0,A=0;for(let e=0;e>24&255,c>>16&255,c>>8&255,255&c,h>>24&255,h>>16&255,h>>8&255,255&h,d,u,0,0,0]),_=function(e){if(!i.isNodeJS)return n(e);try{let t;t=parseInt(process.versions.node)>=8?e:Buffer.from(e);const r=require("zlib").deflateSync(t,{level:9});return r instanceof Uint8Array?r:new Uint8Array(r)}catch(e){(0,s.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return n(e)}(f),y=e.length+36+b.length+_.length,v=new Uint8Array(y);let S=0;return v.set(e,S),S+=e.length,r("IHDR",b,v,S),S+=12+b.length,r("IDATA",_,v,S),S+=12+_.length,r("IEND",new Uint8Array(0),v,S),(0,s.createObjectURL)(v,"image/png",o)}return function(e,t,r){return a(e,void 0===e.kind?s.ImageKind.GRAYSCALE_1BPP:e.kind,t,r)}}();class p{constructor(){this.fontSizeScale=1,this.fontWeight=e.fontWeight,this.fontSize=0,this.textMatrix=s.IDENTITY_MATRIX,this.fontMatrix=s.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=s.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=e.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(e,t){this.x=e,this.y=t}}function o(e){if(Number.isInteger(e))return e.toString();const t=e.toFixed(10);let r=t.length-1;if("0"!==t[r])return t;do{r--}while("0"===t[r]);return t.substring(0,"."===t[r]?r:r+1)}function l(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${o(e[0])} ${o(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2]){return`rotate(${o(180*Math.acos(e[0])/Math.PI)})`}}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${o(e[4])} ${o(e[5])})`;return`matrix(${o(e[0])} ${o(e[1])} ${o(e[2])} ${o(e[3])} ${o(e[4])} `+o(e[5])+")"}let g=0,f=0,m=0;t.SVGGraphics=a=class{constructor(e,t,r=!1){this.svgFactory=new n.DOMSVGFactory,this.current=new p,this.transformMatrix=s.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!r,this._operatorIdMapping=[];for(const e in s.OPS)this._operatorIdMapping[s.OPS[e]]=e}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){const t=e.fnArray,r=e.argsArray;for(let e=0,n=t.length;e{e.get(t,r)});this.current.dependencies.push(r)}return Promise.all(this.current.dependencies)}transform(e,t,r,n,i,a){const o=[e,t,r,n,i,a];this.transformMatrix=s.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(e,t){this.viewport=t;const r=this._initialize(t);return this.loadDependencies(e).then(()=>(this.transformMatrix=s.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),r))}convertOpList(e){const t=this._operatorIdMapping,r=e.argsArray,s=e.fnArray,n=[];for(let e=0,i=s.length;e0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=h[e]}setLineJoin(e){this.current.lineJoin=d[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,r){this.current.strokeColor=s.Util.makeCssRgb(e,t,r)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,r){this.current.fillColor=s.Util.makeCssRgb(e,t,r),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const t=this.viewport.width,r=this.viewport.height,n=s.Util.inverseTransform(this.transformMatrix),i=s.Util.applyTransform([0,0],n),a=s.Util.applyTransform([0,r],n),o=s.Util.applyTransform([t,0],n),l=s.Util.applyTransform([t,r],n),c=Math.min(i[0],a[0],o[0],l[0]),h=Math.min(i[1],a[1],o[1],l[1]),d=Math.max(i[0],a[0],o[0],l[0]),u=Math.max(i[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c),p.setAttributeNS(null,"y",h),p.setAttributeNS(null,"width",d-c),p.setAttributeNS(null,"height",u-h),p.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().appendChild(p)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],r=e[2],n=e[3]||s.IDENTITY_MATRIX,[i,a,o,l]=e[4],c=e[5],h=e[6],d=e[7],u="shading"+m++,[p,g]=s.Util.applyTransform([i,a],n),[f,A]=s.Util.applyTransform([o,l],n),[b,_]=s.Util.singularValueDecompose2dScale(n),y=c*b,v=h*_,S=this.svgFactory.createElement("svg:pattern");S.setAttributeNS(null,"id",u),S.setAttributeNS(null,"patternUnits","userSpaceOnUse"),S.setAttributeNS(null,"width",y),S.setAttributeNS(null,"height",v),S.setAttributeNS(null,"x",""+p),S.setAttributeNS(null,"y",""+g);const x=this.svg,C=this.transformMatrix,P=this.current.fillColor,k=this.current.strokeColor,R=this.svgFactory.create(f-p,A-g);if(this.svg=R,this.transformMatrix=n,2===d){const e=s.Util.makeCssRgb(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(r)),this.svg=x,this.transformMatrix=C,this.current.fillColor=P,this.current.strokeColor=k,S.appendChild(R.childNodes[0]),this.defs.appendChild(S),`url(#${u})`}_makeShadingPattern(e){switch(e[0]){case"RadialAxial":const t="shading"+m++,r=e[3];let n;switch(e[1]){case"axial":const r=e[4],s=e[5];n=this.svgFactory.createElement("svg:linearGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"x1",r[0]),n.setAttributeNS(null,"y1",r[1]),n.setAttributeNS(null,"x2",s[0]),n.setAttributeNS(null,"y2",s[1]);break;case"radial":const i=e[4],a=e[5],o=e[6],l=e[7];n=this.svgFactory.createElement("svg:radialGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"cx",a[0]),n.setAttributeNS(null,"cy",a[1]),n.setAttributeNS(null,"r",l),n.setAttributeNS(null,"fx",i[0]),n.setAttributeNS(null,"fy",i[1]),n.setAttributeNS(null,"fr",o);break;default:throw new Error("Unknown RadialAxial type: "+e[1])}for(const e of r){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]),t.setAttributeNS(null,"stop-color",e[1]),n.appendChild(t)}return this.defs.appendChild(n),`url(#${t})`;case"Mesh":return(0,s.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error("Unknown IR type: "+e[0])}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){const r=this.current;let n=r.x,i=r.y,a=[],l=0;for(const r of e)switch(0|r){case s.OPS.rectangle:n=t[l++],i=t[l++];const e=n+t[l++],r=i+t[l++];a.push("M",o(n),o(i),"L",o(e),o(i),"L",o(e),o(r),"L",o(n),o(r),"Z");break;case s.OPS.moveTo:n=t[l++],i=t[l++],a.push("M",o(n),o(i));break;case s.OPS.lineTo:n=t[l++],i=t[l++],a.push("L",o(n),o(i));break;case s.OPS.curveTo:n=t[l+4],i=t[l+5],a.push("C",o(t[l]),o(t[l+1]),o(t[l+2]),o(t[l+3]),o(n),o(i)),l+=6;break;case s.OPS.curveTo2:a.push("C",o(n),o(i),o(t[l]),o(t[l+1]),o(t[l+2]),o(t[l+3])),n=t[l+2],i=t[l+3],l+=4;break;case s.OPS.curveTo3:n=t[l+2],i=t[l+3],a.push("C",o(t[l]),o(t[l+1]),o(n),o(i),o(n),o(i)),l+=4;break;case s.OPS.closePath:a.push("Z")}a=a.join(" "),r.path&&e.length>0&&e[0]!==s.OPS.rectangle&&e[0]!==s.OPS.moveTo?a=r.path.getAttributeNS(null,"d")+a:(r.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().appendChild(r.path)),r.path.setAttributeNS(null,"d",a),r.path.setAttributeNS(null,"fill","none"),r.element=r.path,r.setCurrentPoint(n,i)}endPath(){const e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element)return void(this.pendingClip=null);const t="clippath"+g++,r=this.svgFactory.createElement("svg:clipPath");r.setAttributeNS(null,"id",t),r.setAttributeNS(null,"transform",l(this.transformMatrix));const s=e.element.cloneNode(!0);"evenodd"===this.pendingClip?s.setAttributeNS(null,"clip-rule","evenodd"):s.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,r.appendChild(s),this.defs.appendChild(r),e.activeClipUrl&&(e.clipGroup=null,this.extraStack.forEach((function(e){e.clipGroup=null})),r.setAttributeNS(null,"clip-path",e.activeClipUrl)),e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=e.path.getAttributeNS(null,"d")+"Z";e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,r]of e)switch(t){case"LW":this.setLineWidth(r);break;case"LC":this.setLineCap(r);break;case"LJ":this.setLineJoin(r);break;case"ML":this.setMiterLimit(r);break;case"D":this.setDash(r[0],r[1]);break;case"RI":this.setRenderingIntent(r);break;case"FL":this.setFlatness(r);break;case"Font":this.setFont(r);break;case"CA":this.setStrokeAlpha(r);break;case"ca":this.setFillAlpha(r);break;default:(0,s.warn)("Unimplemented graphic state operator "+t)}}fill(){const e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}stroke(){const e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(e,t=1){const r=this.current;let s=r.dashArray;1!==t&&s.length>0&&(s=s.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",r.strokeColor),e.setAttributeNS(null,"stroke-opacity",r.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",o(r.miterLimit)),e.setAttributeNS(null,"stroke-linecap",r.lineCap),e.setAttributeNS(null,"stroke-linejoin",r.lineJoin),e.setAttributeNS(null,"stroke-width",o(t*r.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",s.map(o).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",o(t*r.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().appendChild(e)}paintImageXObject(e){const t=this.objs.get(e);t?this.paintInlineImageXObject(t):(0,s.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const r=e.width,s=e.height,n=u(e,this.forceDataSchema,!!t),i=this.svgFactory.createElement("svg:rect");i.setAttributeNS(null,"x","0"),i.setAttributeNS(null,"y","0"),i.setAttributeNS(null,"width",o(r)),i.setAttributeNS(null,"height",o(s)),this.current.element=i,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(c,"xlink:href",n),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",o(-s)),a.setAttributeNS(null,"width",o(r)+"px"),a.setAttributeNS(null,"height",o(s)+"px"),a.setAttributeNS(null,"transform",`scale(${o(1/r)} ${o(-1/s)})`),t?t.appendChild(a):this._ensureTransformGroup().appendChild(a)}paintImageMaskXObject(e){const t=this.current,r=e.width,s=e.height,n=t.fillColor;t.maskId="mask"+f++;const i=this.svgFactory.createElement("svg:mask");i.setAttributeNS(null,"id",t.maskId);const a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y","0"),a.setAttributeNS(null,"width",o(r)),a.setAttributeNS(null,"height",o(s)),a.setAttributeNS(null,"fill",n),a.setAttributeNS(null,"mask",`url(#${t.maskId})`),this.defs.appendChild(i),this._ensureTransformGroup().appendChild(a),this.paintInlineImageXObject(e,i)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){const e=t[2]-t[0],r=t[3]-t[1],s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x",t[0]),s.setAttributeNS(null,"y",t[1]),s.setAttributeNS(null,"width",o(e)),s.setAttributeNS(null,"height",o(r)),this.current.element=s,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(e){const t=this.svgFactory.create(e.width,e.height),r=this.svgFactory.createElement("svg:defs");t.appendChild(r),this.defs=r;const s=this.svgFactory.createElement("svg:g");return s.setAttributeNS(null,"transform",l(e.transform)),t.appendChild(s),this.svg=s,t}_ensureClipGroup(){if(!this.current.clipGroup){const e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.appendChild(e),this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",l(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)),this.tgrp}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var s=r(2),n=r(20);const i=require("fs"),a=require("http"),o=require("https"),l=require("url"),c=/^file:\\\\/\\\\/\\\\/[a-zA-Z]:\\\\//;t.PDFNodeStream=class{constructor(e){this.source=e,this.url=function(e){const t=l.parse(e);return"file:"===t.protocol||t.host?t:/^[a-z]:[/\\\\\\\\]/i.test(e)?l.parse("file:///"+e):(t.host||(t.protocol="file:"),t)}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}getFullReader(){return(0,s.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new f(this):new p(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=this.isFsUrl?new m(this,e,t):new g(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeRequestReaders.slice(0).forEach((function(t){t.cancel(e)}))}};class h{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=(0,s.createPromiseCapability)(),this._headersCapability=(0,s.createPromiseCapability)()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=(0,s.createPromiseCapability)(),this.read();this._loaded+=e.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new s.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class d{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,s.createPromiseCapability)();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=(0,s.createPromiseCapability)(),this.read();this._loaded+=e.length,this.onProgress&&this.onProgress({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function u(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class p extends h{constructor(e){super(e);const t=t=>{if(404===t.statusCode){const e=new s.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const r=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:i,suggestedLength:a}=(0,n.validateRangeRequestCapabilities)({getResponseHeader:r,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i,this._contentLength=a||this._contentLength,this._filename=(0,n.extractFilenameFromHeader)(r)};this._request=null,"http:"===this._url.protocol?this._request=a.request(u(this._url,e.httpHeaders),t):this._request=o.request(u(this._url,e.httpHeaders),t),this._request.on("error",e=>{this._storedError=e,this._headersCapability.reject(e)}),this._request.end()}}class g extends d{constructor(e,t,r){super(e),this._httpHeaders={};for(const t in e.httpHeaders){const r=e.httpHeaders[t];void 0!==r&&(this._httpHeader\';a.g+=\'s[t]=r)}this._httpHeaders.Range=`bytes=${t}-${r-1}`;const n=e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new s.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e}};this._request=null,"http:"===this._url.protocol?this._request=a.request(u(this._url,this._httpHeaders),n):this._request=o.request(u(this._url,this._httpHeaders),n),this._request.on("error",e=>{this._storedError=e}),this._request.end()}}class f extends h{constructor(e){super(e);let t=decodeURIComponent(this._url.path);c.test(this._url.href)&&(t=t.replace(/^\\\\//,"")),i.lstat(t,(e,r)=>{if(e)return"ENOENT"===e.code&&(e=new s.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,void this._headersCapability.reject(e);this._contentLength=r.size,this._setReadableStream(i.createReadStream(t)),this._headersCapability.resolve()})}}class m extends d{constructor(e,t,r){super(e);let s=decodeURIComponent(this._url.path);c.test(this._url.href)&&(s=s.replace(/^\\\\//,"")),this._setReadableStream(i.createReadStream(s,{start:t,end:r-1}))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){if(404===e||0===e&&t.startsWith("file:"))return new s.MissingPDFException(\\\'Missing PDF "\\\'+t+\\\'".\\\');return new s.UnexpectedResponseException("Unexpected server response ("+e+\\\') while retrieving PDF "\\\'+t+\\\'".\\\',e)},t.extractFilenameFromHeader=function(e){const t=e("Content-Disposition");if(t){let e=(0,n.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(e){}if(/\\\\.pdf$/i.test(e))return e}return null},t.validateRangeRequestCapabilities=function({getResponseHeader:e,isHttp:t,rangeChunkSize:r,disableRange:n}){(0,s.assert)(r>0,"Range chunk size must be larger than zero");const i={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e("Content-Length"),10);if(!Number.isInteger(a))return i;if(i.suggestedLength=a,a<=2*r)return i;if(n||!t)return i;if("bytes"!==e("Accept-Ranges"))return i;if("identity"!==(e("Content-Encoding")||"identity"))return i;return i.allowRangeRequests=!0,i},t.validateResponseStatus=function(e){return 200===e||206===e};var s=r(2),n=r(21)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){let t=!0,r=s("filename\\\\\\\\*","i").exec(e);if(r){r=r[1];let e=a(r);return e=unescape(e),e=o(e),e=l(e),i(e)}if(r=function(e){const t=[];let r;const n=s("filename\\\\\\\\*((?!0\\\\\\\\d)\\\\\\\\d+)(\\\\\\\\*?)","ig");for(;null!==(r=n.exec(e));){let[,e,s,n]=r;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[s,n]}const i=[];for(let e=0;e=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),4!==n.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===n.status&&this.isHttp)return void(r.onError&&r.onError(n.status));const i=n.status||200;if(!(200===i&&206===r.expectedStatus)&&i!==r.expectedStatus)return void(r.onError&&r.onError(n.status));const a=function(e){const t=e.response;return"string"!=typeof t?t:(0,s.stringToBytes)(t).buffer}(n);if(206===i){const e=n.getResponseHeader("Content-Range"),t=/bytes (\\\\d+)-(\\\\d+)\\\\/(\\\\d+)/.exec(e);r.onDone({begin:parseInt(t[1],10),chunk:a})}else a?r.onDone({begin:0,chunk:a}):r.onError&&r.onError(n.status)}hasPendingRequests(){for(const e in this.pendingRequests)return!0;return!1}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortAllRequests(){for(const e in this.pendingRequests)this.abortRequest(0|e)}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}t.PDFNetworkStream=class{constructor(e){this._source=e,this._manager=new i(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return(0,s.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new a(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const r=new o(this._manager,e,t);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeRequestReaders.slice(0).forEach((function(t){t.cancel(e)}))}};class a{constructor(e,t){this._manager=e;const r={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(r),this._headersReceivedCapability=(0,s.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),r=e=>t.getResponseHeader(e),{allowRangeRequests:s,suggestedLength:i}=(0,n.validateRangeRequestCapabilities)({getResponseHeader:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=(0,n.extractFilenameFromHeader)(r),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e)if(this._requests.length>0){this._requests.shift().resolve({value:e.chunk,done:!1})}else this._cachedChunks.push(e.chunk);this._done=!0,this._cachedChunks.length>0||(this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[])}_onError(e){const t=this._url,r=(0,n.createResponseStatusError)(e,t);this._storedError=r,this._headersReceivedCapability.reject(r),this._requests.forEach((function(e){e.reject(r)})),this._requests=[],this._cachedChunks=[]}_onProgress(e){this.onProgress&&this.onProgress({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,s.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e),this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[],this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class o{constructor(e,t,r){this._manager=e;const s={onDone:this._onDone.bind(this),onProgress:this._onProgress.bind(this)};this._requestId=e.requestRange(t,r,s),this._requests=[],this._queuedChunk=null,this._done=!1,this.onProgress=null,this.onClosed=null}_close(){this.onClosed&&this.onClosed(this)}_onDone(e){const t=e.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunk=t;this._done=!0,this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[],this._close()}_onProgress(e){!this.isStreamingSupported&&this.onProgress&&this.onProgress({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,s.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[],this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var s=r(2),n=r(20);function i(e,t,r){return{method:"GET",headers:e,signal:r&&r.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function a(e){const t=new Headers;for(const r in e){const s=e[r];void 0!==s&&t.append(r,s)}return t}t.PDFFetchStream=class{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}getFullReader(){return(0,s.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new o(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new l(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeRequestReaders.slice(0).forEach((function(t){t.cancel(e)}))}};class o{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=(0,s.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),"undefined"!=typeof AbortController&&(this._abortController=new AbortController),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._headers=a(this._stream.httpHeaders);const r=t.url;fetch(r,i(this._headers,this._withCredentials,this._abortController)).then(e=>{if(!(0,n.validateResponseStatus)(e.status))throw(0,n.createResponseStatusError)(e.status,r);this._reader=e.body.getReader(),this._headersCapability.resolve();const t=t=>e.headers.get(t),{allowRangeRequests:i,suggestedLength:a}=(0,n.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i,this._contentLength=a||this._contentLength,this._filename=(0,n.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new s.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._reader&&this._reader.cancel(e),this._abortController&&this._abortController.abort()}}class l{constructor(e,t,r){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=(0,s.createPromiseCapability)(),this._isStreamingSupported=!o.disableStream,"undefined"!=typeof AbortController&&(this._abortController=new AbortController),this._headers=a(this._stream.httpHeaders),this._headers.append("Range",`bytes=${t}-${r-1}`);const l=o.url;fetch(l,i(this._headers,this._withCredentials,this._abortController)).then(e=>{if(!(0,n.validateResponseStatus)(e.status))throw(0,n.createResponseStatusError)(e.status,l);this._readCapability.resolve(),this._reader=e.body.getReader()}),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._reader&&this._reader.cancel(e),this._abortController&&this._abortController.abort()}}}])}));\';return a.g};var kdc=Mgd(7264);zuc(7265,1,Dgn,m8l);_.Ai=function(){return \'pdfWorkerJs\'};_.Bi=function(){var a;a=new sjd;a.g+=\'/**\\n * @licstart The following is the entire license notice for the\\n * Javascript code in this page\\n *\\n * Copyright 2020 Mozilla Foundation\\n *\\n * Licensed under the Apache License, Version 2.0 (the "License");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an "AS IS" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n *\\n * @licend The above is the entire license notice for the\\n * Javascript code in this page\\n */\\n!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 function(e){var t={};function a(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};e[r].call(i.exports,i,i.exports,a);i.l=!0;return i.exports}a.m=e;a.c=t;a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})};a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})};a.t=function(e,t){1&t&&(e=a(e));if(8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);a.r(r);Object.defineProperty(r,"default",{enumerable:!0,value:e});if(2&t&&"string"!=typeof e)for(var i in e)a.d(r,i,function(t){return e[t]}.bind(null,i));return r};a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};a.d(t,"a",t);return t};a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};a.p="";return a(a.s=0)}([function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"WorkerMessageHandler",{enumerable:!0,get:function(){return r.WorkerMessageHandler}});var r=a(1)},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.WorkerMessageHandler=t.WorkerTask=void 0;var r=a(2),i=a(5),n=a(6),s=a(4),o=a(45),c=a(46),l=a(8),h=function(){function e(e){this.name=e;this.terminated=!1;this._capability=(0,r.createPromiseCapability)()}e.prototype={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")}};return e}();t.WorkerTask=h;var u,d={setup(e,t){var a=!1;e.on("test",(function(t){if(a)return;a=!0;if(!(t instanceof Uint8Array)){e.send("test",null);return}const r=255===t[0];e.postMessageTransfers=r;e.send("test",{supportTransfers:r})}));e.on("configure",(function(e){(0,r.setVerbosityLevel)(e.verbosity)}));e.on("GetDocRequest",(function(e){return d.createDocumentHandler(e,t)}))},createDocumentHandler(e,t){var a,s=!1,u=null,d=[];const f=(0,r.getVerbosityLevel)(),g=e.apiVersion;if("2.5.207"!==g)throw new Error(`The API version "${g}" does not match the Worker version "2.5.207".`);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||void 0===Promise.allSettled)throw new Error("The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g. `ReadableStream` and/or `Promise.allSettled`); please use an ES5-compatible build instead.");var p=e.docId,b=e.docBaseUrl,y=e.docId+"_worker",v=new o.MessageHandler(y,p,t);v.postMessageTransfers=e.postMessageTransfers;function w(){if(s)throw new Error("Worker was terminated")}function k(e){d.push(e)}function S(e){e.finish();var t=d.indexOf(e);d.splice(t,1)}async function C(e){await a.ensureDoc("checkHeader");await a.ensureDoc("parseStartXRef");await a.ensureDoc("parse",[e]);e||await a.ensureDoc("checkFirstPage");const[t,r]=await Promise.all([a.ensureDoc("numPages"),a.ensureDoc("fingerprint")]);return{numPages:t,fingerprint:r}}function x(e,t){var a=(0,r.createPromiseCapability)();let i;var s=e.source;if(s.data){try{i=new n.LocalPdfManager(p,s.data,s.password,t,b);a.resolve(i)}catch(e){a.reject(e)}return a.promise}var o,l=[];try{o=new c.PDFWorkerStream(v)}catch(e){a.reject(e);return a.promise}var h=o.getFullReader();h.headersReady.then((function(){if(h.isRangeSupported){var e=s.disableAutoFetch||h.isStreamingSupported;i=new n.NetworkPdfManager(p,o,{msgHandler:v,password:s.password,length:h.contentLength,disableAutoFetch:e,rangeChunkSize:s.rangeChunkSize},t,b);for(let e=0;e=r.VerbosityLevel.INFOS?Date.now():0;a.getOperatorList({handler:v,sink:t,task:n,intent:e.intent,renderInteractiveForms:e.renderInteractiveForms}).then((function(e){S(n);s&&(0,r.info)(`page=${i+1} - getOperatorList: time=${Date.now()-s}ms, len=${e.length}`);t.close()}),(function(e){S(n);if(!n.terminated){v.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorOperatorList});t.error(e)}}))}))}),this);v.on("GetTextContent",(function(e,t){var i=e.pageIndex;t.onPull=function(e){};t.onCancel=function(e){};a.getPage(i).then((function(a){var n=new h("GetTextContent: page "+i);k(n);const s=f>=r.VerbosityLevel.INFOS?Date.now():0;a.extractTextContent({handler:v,task:n,sink:t,normalizeWhitespace:e.normalizeWhitespace,combineTextItems:e.combineTextItems}).then((function(){S(n);s&&(0,r.info)(`page=${i+1} - getTextContent: time=`+(Date.now()-s)+"ms");t.close()}),(function(e){S(n);n.terminated||t.error(e)}))}))}));v.on("FontFallback",(function(e){return a.fontFallback(e.id,v)}));v.on("Cleanup",(function(e){return a.cleanup(!0)}));v.on("Terminate",(function(e){s=!0;const t=[];if(a){a.terminate(new r.AbortException("Worker was terminated."));const e=a.cleanup();t.push(e);a=null}else(0,i.clearPrimitiveCaches)();u&&u(new r.AbortException("Worker was terminated."));d.forEach((function(e){t.push(e.finished);e.terminate()}));return Promise.all(t).then((function(){v.destroy();v=null}))}));v.on("Ready",(function(t){!function(e){function t(e){w();v.send("GetDoc",{pdfInfo:e})}function i(e){w();if(e instanceof r.PasswordException){var t=new h("PasswordException: response "+e.code);k(t);v.sendWithPromise("PasswordRequest",e).then((function({password:e}){S(t);a.updatePassword(e);n()})).catch((function(){S(t);v.send("DocException",e)}))}else e instanceof r.InvalidPDFException||e instanceof r.MissingPDFException||e instanceof r.UnexpectedResponseException||e instanceof r.UnknownErrorException?v.send("DocException",e):v.send("DocException",new r.UnknownErrorException(e.message,e.toString()))}function n(){w();C(!1).then(t,(function(e){w();if(e instanceof l.XRefParseException){a.requestLoadedStream();a.onLoadedStream().then((function(){w();C(!0).then(t,i)}))}else i(e)}),i)}w();x(e,{maxImageSize:e.maxImageSize,disableFontFace:e.disableFontFace,ignoreErrors:e.ignoreErrors,isEvalSupported:e.isEvalSupported,fontExtraProperties:e.fontExtraProperties}).then((function(e){if(s){e.terminate(new r.AbortException("Worker was terminated."));throw new Error("Worker was terminated")}(a=e).onLoadedStream().then((function(e){v.send("DataLoaded",{length:e.bytes.byteLength})}))})).then(n,i)}(e);e=null}));return y},initializeFromPort(e){var t=new o.MessageHandler("worker","main",e);d.setup(t,e);t.send("ready",null)}};t.WorkerMessageHandler=d;"undefined"==typeof window&&!s.isNodeJS&&"undefined"!=typeof self&&("function"==typeof(u=self).postMessage&&"onmessage"in u)&&d.initializeFromPort(self)},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.arrayByteLength=d;t.arraysToBytes=function(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let a=0;for(let r=0;rt});e.promise=new Promise((function(a,r){e.resolve=function(e){t=!0;a(e)};e.reject=function(e){t=!0;r(e)}}));return e};t.getVerbosityLevel=function(){return i};t.info=function(e){i>=r.INFOS&&console.log("Info: "+e)};t.isArrayBuffer=function(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function(e,t){if(e.length!==t.length)return!1;return e.every((function(e,a){return e===t[a]}))};t.isBool=function(e){return"boolean"==typeof e};t.isEmptyObj=function(e){for(const t in e)return!1;return!0};t.isNum=function(e){return"number"==typeof e};t.isString=function(e){return"string"==typeof e};t.isSameOrigin=function(e,t){let a;try{a=new URL(e);if(!a.origin||"null"===a.origin)return!1}catch(e){return!1}const r=new URL(t,a);return a.origin===r.origin};t.createValidAbsoluteUrl=function(e,t){if(!e)return null;try{const a=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch(e){}return null};t.removeNullCharacters=function(e){if("string"!=typeof e){n("The argument for removeNullCharacters must be a string.");return e}return e.replace(h,"")};t.setVerbosityLevel=function(e){Number.isInteger(e)&&(i=e)};t.shadow=c;t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=u;t.stringToPDFString=function(e){const t=e.length,a=[];if("\\xFE"===e[0]&&"\\xFF"===e[1])for(let r=2;r=r.WARNINGS&&console.log("Warning: "+e)}function s(e){throw new Error(e)}function o(e,t){e||s(t)}function c(e,t,a){Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!1});return a}const l=function(){function e(t){this.constructor===e&&s("Cannot initialize BaseException.");this.message=t;this.name=this.constructor.name}e.prototype=new Error;e.constructor=e;return e}();t.BaseException=l;t.PasswordException=class extends l{constructor(e,t){super(e);this.code=t}};t.UnknownErrorException=class extends l{constructor(e,t){super(e);this.details=t}};t.InvalidPDFException=class extends l{};t.MissingPDFException=class extends l{};t.UnexpectedResponseException=class extends l{constructor(e,t){super(e);this.status=t}};t.FormatError=class extends l{};t.AbortException=class extends l{};const h=/\\\\x00/g;function u(e){o("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,a=new Uint8Array(t);for(let r=0;re[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){function a(e,t){return e-t}const r=[e[0],e[2],t[0],t[2]].sort(a),i=[e[1],e[3],t[1],t[3]].sort(a),n=[];e=p.normalizeRect(e);t=p.normalizeRect(t);if(!(r[0]===e[0]&&r[1]===t[0]||r[0]===t[0]&&r[1]===e[0]))return null;n[0]=r[1];n[2]=r[2];if(!(i[0]===e[1]&&i[1]===t[1]||i[0]===t[1]&&i[1]===e[1]))return null;n[1]=i[1];n[3]=i[2];return n}}t.Util=p;const 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];const y=function(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function(t,a,r=!1){if(!r&&URL.createObjectURL){const e=new Blob([t],{type:a});return URL.createObjectURL(e)}let i=`data:${a};base64,`;for(let a=0,r=t.length;a>2]+e[(3&n)<<4|s>>4]+e[a+1>6:64]+e[a+2=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(let e=a;e=t)return;if(t<=this.progressiveDataLength)return;const a=this.chunkSize,r=Math.floor(e/a),n=Math.floor((t-1)/a)+1;for(let a=r;a=this.end)return-1;e>=this.progressiveDataLength&&this.ensureByte(e);return this.bytes[this.pos++]}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()}getBytes(e,t=!1){const a=this.bytes,r=this.pos,i=this.end;if(!e){i>this.progressiveDataLength&&this.ensureRange(r,i);const e=a.subarray(r,i);return t?new Uint8ClampedArray(e):e}let n=r+e;n>i&&(n=i);n>this.progressiveDataLength&&this.ensureRange(r,n);this.pos=n;const s=a.subarray(r,n);return t?new Uint8ClampedArray(s):s}peekByte(){const e=this.getByte();-1!==e&&this.pos--;return e}peekBytes(e,t=!1){const a=this.getBytes(e,t);this.pos-=a.length;return a}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);t>this.progressiveDataLength&&this.ensureRange(e,t);return this.bytes.subarray(e,t)}skip(e){e||(e=1);this.pos+=e}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(e,t,a){t?e+t>this.progressiveDataLength&&this.ensureRange(e,e+t):e>=this.progressiveDataLength&&this.ensureByte(e);function r(){}r.prototype=Object.create(this);r.prototype.getMissingChunks=function(){const e=this.chunkSize,t=Math.floor(this.start/e),a=Math.floor((this.end-1)/e)+1,r=[];for(let e=t;e{const s=o=>{try{if(!o.done){const e=o.value;i.push(e);n+=(0,r.arrayByteLength)(e);a.isStreamingSupported&&this.onProgress({loaded:n});a.read().then(s,t);return}const c=(0,r.arraysToBytes)(i);i=null;e(c)}catch(e){t(e)}};a.read().then(s,t)}).then(t=>{this.aborted||this.onReceiveData({chunk:t,begin:e})})}requestAllChunks(){const e=this.stream.getMissingChunks();this._requestChunks(e);return this._loadedStreamCapability.promise}_requestChunks(e){const t=this.currRequestId++,a=Object.create(null);this.chunksNeededByRequest[t]=a;for(const t of e)this.stream.hasChunk(t)||(a[t]=!0);if((0,r.isEmptyObj)(a))return Promise.resolve();const i=(0,r.createPromiseCapability)();this.promisesByRequest[t]=i;const n=[];for(let e in a){e|=0;if(!(e in this.requestsByChunk)){this.requestsByChunk[e]=[];n.push(e)}this.requestsByChunk[e].push(t)}if(!n.length)return i.promise;const s=this.groupChunks(n);for(const e of s){const t=e.beginChunk*this.chunkSize,a=Math.min(e.endChunk*this.chunkSize,this.length);this.sendRequest(t,a)}return i.promise}getStream(){return this.stream}requestRange(e,t){t=Math.min(t,this.length);const a=this.getBeginChunk(e),r=this.getEndChunk(t),i=[];for(let e=a;e=0&&r+1!==n){t.push({beginChunk:a,endChunk:r+1});a=n}i+1===e.length&&t.push({beginChunk:a,endChunk:n+1});r=n}return t}onProgress(e){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+e.loaded,total:this.length})}onReceiveData(e){const t=e.chunk,a=void 0===e.begin,i=a?this.progressiveDataLength:e.begin,n=i+t.byteLength,s=Math.floor(i/this.chunkSize),o=n100){(0,r.warn)(`getInheritableProperty: maximum loop count exceeded for "${t}"`);break}e=e.get("Parent")}return n};t.toRomanNumerals=function(e,t=!1){(0,r.assert)(Number.isInteger(e)&&e>0,"The number should be a positive integer.");const a=[];let i;for(;e>=1e3;){e-=1e3;a.push("M")}i=e/100|0;e%=100;a.push(o[i]);i=e/10|0;e%=10;a.push(o[10+i]);a.push(o[20+e]);const n=a.join("");return t?n.toLowerCase():n};t.log2=function(e){if(e<=0)return 0;return Math.ceil(Math.log2(e))};t.readInt8=function(e,t){return e[t]<<24>>24};t.readUint16=function(e,t){return e[t]<<8|e[t+1]};t.readUint32=function(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0};t.isWhiteSpace=function(e){return 32===e||9===e||13===e||10===e};t.XRefParseException=t.XRefEntryException=t.MissingDataException=void 0;var r=a(2);class i extends r.BaseException{constructor(e,t){super(`Missing data [${e}, ${t})`);this.begin=e;this.end=t}}t.MissingDataException=i;class n extends r.BaseException{}t.XRefEntryException=n;class s extends r.BaseException{}t.XRefParseException=s;const o=["","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(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFDocument=t.Page=void 0;var r=a(2),i=a(10),n=a(5),s=a(8),o=a(12),c=a(25),l=a(22),h=a(11),u=a(26),d=a(27),f=a(41);const g=[0,0,612,792];function m(e,t){return"display"===t&&e.viewable||"print"===t&&e.printable}class p{constructor({pdfManager:e,xref:t,pageIndex:a,pageDict:r,ref:i,fontCache:n,builtInCMapCache:s,globalImageCache:o,pdfFunctionFactory:c}){this.pdfManager=e;this.pageIndex=a;this.pageDict=r;this.xref=t;this.ref=i;this.fontCache=n;this.builtInCMapCache=s;this.globalImageCache=o;this.pdfFunctionFactory=c;this.evaluatorOptions=e.evaluatorOptions;this.resourcesPromise=null;const l={obj:0};this.idFactory={createObjId:()=>`p${a}_${++l.obj}`,getDocId:()=>"g_"+e.docId}}_getInheritableProperty(e,t=!1){const a=(0,s.getInheritableProperty)({dict:this.pageDict,key:e,getArray:t,stopWhenFound:!1});return Array.isArray(a)?1!==a.length&&(0,n.isDict)(a[0])?n.Dict.merge(this.xref,a):a[0]:a}get content(){return this.pageDict.get("Contents")}get resources(){return(0,r.shadow)(this,"resources",this._getInheritableProperty("Resources")||n.Dict.empty)}_getBoundingBox(e){const t=this._getInheritableProperty(e,!0);if(Array.isArray(t)&&4===t.length){if(t[2]-t[0]!=0&&t[3]-t[1]!=0)return t;(0,r.warn)(`Empty /${e} entry.`)}return null}get mediaBox(){return(0,r.shadow)(this,"mediaBox",this._getBoundingBox("MediaBox")||g)}get cropBox(){return(0,r.shadow)(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let e=this.pageDict.get("UserUnit");(!(0,r.isNum)(e)||e<=0)&&(e=1);return(0,r.shadow)(this,"userUnit",e)}get view(){const{cropBox:e,mediaBox:t}=this;let a;if(e===t||(0,r.isArrayEqual)(e,t))a=t;else{const i=r.Util.intersect(e,t);i&&i[2]-i[0]!=0&&i[3]-i[1]!=0?a=i:(0,r.warn)("Empty /CropBox and /MediaBox intersection.")}return(0,r.shadow)(this,"view",a||t)}get rotate(){let e=this._getInheritableProperty("Rotate")||0;e%90!=0?e=0:e>=360?e%=360:e<0&&(e=(e%360+360)%360);return(0,r.shadow)(this,"rotate",e)}getContentStream(){const e=this.content;let t;if(Array.isArray(e)){const a=this.xref,r=[];for(const t of e)r.push(a.fetchIfRef(t));t=new o.StreamsSequenceStream(r)}else t=(0,n.isStream)(e)?e:new o.NullStream;return t}loadResources(e){this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources"));return this.resourcesPromise.then(()=>new i.ObjectLoader(this.resources,e,this.xref).load())}getOperatorList({handler:e,sink:t,task:a,intent:i,renderInteractiveForms:n}){const s=this.pdfManager.ensure(this,"getContentStream"),o=this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"]),c=new d.PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this.idFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,globalImageCache:this.globalImageCache,options:this.evaluatorOptions,pdfFunctionFactory:this.pdfFunctionFactory}),l=Promise.all([s,o]).then(([r])=>{const n=new u.OperatorList(i,t,this.pageIndex);e.send("StartRenderPage",{transparency:c.hasBlendModes(this.resources),pageIndex:this.pageIndex,intent:i});return c.getOperatorList({stream:r,task:a,resources:this.resources,operatorList:n}).then((function(){return n}))});return Promise.all([l,this._parsedAnnotations]).then((function([e,t]){if(0===t.length){e.flush(!0);return{length:e.totalLength}}const s=[];for(const e of t)m(e,i)&&s.push(e.getOperatorList(c,a,n).catch((function(e){(0,r.warn)(`getOperatorList - ignoring annotation data during "${a.name}" task: "${e}".`);return null})));return Promise.all(s).then((function(t){e.addOp(r.OPS.beginAnnotations,[]);for(const a of t)e.addOpList(a);e.addOp(r.OPS.endAnnotations,[]);e.flush(!0);return{length:e.totalLength}}))}))}extractTextContent({handler:e,task:t,normalizeWhitespace:a,sink:r,combineTextItems:i}){const n=this.pdfManager.ensure(this,"getContentStream"),s=this.loadResources(["ExtGState","XObject","Font"]);return Promise.all([n,s]).then(([n])=>new d.PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this.idFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,globalImageCache:this.globalImageCache,options:this.evaluatorOptions,pdfFunctionFactory:this.pdfFunctionFactory}).getTextContent({stream:n,task:t,resources:this.resources,normalizeWhitespace:a,combineTextItems:i,sink:r}))}getAnnotationsData(e){return this._parsedAnnotations.then((function(t){const a=[];for(let r=0,i=t.length;r{const e=[];for(const t of this.annotations)e.push(c.AnnotationFactory.create(this.xref,t,this.pdfManager,this.idFactory).catch((function(e){(0,r.warn)(`_parsedAnnotations: "${e}".`);return null})));return Promise.all(e).then((function(e){return e.filter(e=>!!e)}))});return(0,r.shadow)(this,"_parsedAnnotations",e)}}t.Page=p;const b=new Uint8Array([37,80,68,70,45]),y=new Uint8Array([115,116,97,114,116,120,114,101,102]),v=new Uint8Array([101,110,100,111,98,106]),w=/^[1-9]\\\\.[0-9]$/;function k(e,t,a=1024,r=!1){const i=t.length,n=e.peekBytes(a),s=n.length-i;if(s<=0)return!1;if(r){const a=i-1;let r=n.length-1;for(;r>=a;){let s=0;for(;s=i){e.pos+=r-a;return!0}r--}}else{let a=0;for(;a<=s;){let r=0;for(;r=i){e.pos+=a;return!0}a++}}return!1}t.PDFDocument=class{constructor(e,t){let a;if((0,n.isStream)(t))a=t;else{if(!(0,r.isArrayBuffer)(t))throw new Error("PDFDocument: Unknown argument type");a=new o.Stream(t)}if(a.length<=0)throw new r.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=e;this.stream=a;this.xref=new i.XRef(a,e);this.pdfFunctionFactory=new f.PDFFunctionFactory({xref:this.xref,isEvalSupported:e.evaluatorOptions.isEvalSupported});this._pagePromises=[]}parse(e){this.setup(e);const t=this.catalog.catDict.get("Version");(0,n.isName)(t)&&(this.pdfFormatVersion=t.name);try{this.acroForm=this.catalog.catDict.get("AcroForm");if(this.acroForm){this.xfa=this.acroForm.get("XFA");const e=this.acroForm.get("Fields");Array.isArray(e)&&0!==e.length||this.xfa||(this.acroForm=null)}}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.info)("Cannot fetch AcroForm entry; assuming no AcroForms are present");this.acroForm=null}try{const e=this.catalog.catDict.get("Collection");(0,n.isDict)(e)&&e.getKeys().length>0&&(this.collection=e)}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.info)("Cannot fetch Collection dictionary.")}}get linearization(){let e=null;try{e=h.Linearization.create(this.stream)}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.info)(e)}return(0,r.shadow)(this,"linearization",e)}get startXRef(){const e=this.stream;let t=0;if(this.linearization){e.reset();k(e,v)&&(t=e.pos+6-e.start)}else{const a=1024,r=y.length;let i=!1,n=e.end;for(;!i&&n>0;){n-=a-r;n<0&&(n=0);e.pos=n;i=k(e,y,a,!0)}if(i){e.skip(9);let a;do{a=e.getByte()}while((0,s.isWhiteSpace)(a));let r="";for(;a>=32&&a<=57;){r+=String.fromCharCode(a);a=e.getByte()}t=parseInt(r,10);isNaN(t)&&(t=0)}}return(0,r.shadow)(this,"startXRef",t)}checkHeader(){const e=this.stream;e.reset();if(!k(e,b))return;e.moveStart();let t,a="";for(;(t=e.getByte())>32&&!(a.length>=12);)a+=String.fromCharCode(t);this.pdfFormatVersion||(this.pdfFormatVersion=a.substring(5))}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}setup(e){this.xref.parse(e);this.catalog=new i.Catalog(this.pdfManager,this.xref)}get numPages(){const e=this.linearization,t=e?e.numPages:this.catalog.numPages;return(0,r.shadow)(this,"numPages",t)}get documentInfo(){const e={Title:r.isString,Author:r.isString,Subject:r.isString,Keywords:r.isString,Creator:r.isString,Producer:r.isString,CreationDate:r.isString,ModDate:r.isString,Trapped:n.isName};let t=this.pdfFormatVersion;if("string"!=typeof t||!w.test(t)){(0,r.warn)("Invalid PDF header version number: "+t);t=null}const a={PDFFormatVersion:t,IsLinearized:!!this.linearization,IsAcroFormPresent:!!this.acroForm,IsXFAPresent:!!this.xfa,IsCollectionPresent:!!this.collection};let i;try{i=this.xref.trailer.get("Info")}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.info)("The document information dictionary is invalid.")}if((0,n.isDict)(i))for(const t of i.getKeys()){const s=i.get(t);if(e[t])e[t](s)?a[t]="string"!=typeof s?s:(0,r.stringToPDFString)(s):(0,r.info)(`Bad value in document info for "${t}".`);else if("string"==typeof t){let e;if((0,r.isString)(s))e=(0,r.stringToPDFString)(s);else{if(!((0,n.isName)(s)||(0,r.isNum)(s)||(0,r.isBool)(s))){(0,r.info)(`Unsupported value in document info for (custom) "${t}".`);continue}e=s}a.Custom||(a.Custom=Object.create(null));a.Custom[t]=e}}return(0,r.shadow)(this,"documentInfo",a)}get fingerprint(){let e;const t=this.xref.trailer.get("ID");e=Array.isArray(t)&&t[0]&&(0,r.isString)(t[0])&&"\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0"!==t[0]?(0,r.stringToBytes)(t[0]):(0,l.calculateMD5)(this.stream.getByteRange(0,1024),0,1024);const a=[];for(let t=0,r=e.length;t{if((0,n.isDict)(e,"Page")||(0,n.isDict)(e)&&!e.has("Type")&&e.has("Contents")){i&&!t.pageKidsCountCache.has(i)&&t.pageKidsCountCache.put(i,1);return[e,i]}throw new r.FormatError("The Linearization dictionary doesn\\\'t point to a valid Page dictionary.")}).catch(a=>{(0,r.info)(a);return t.getPageDict(e)})}getPage(e){if(void 0!==this._pagePromises[e])return this._pagePromises[e];const{catalog:t,linearization:a}=this,r=a&&a.pageFirst===e?this._getLinearizationPage(e):t.getPageDict(e);return this._pagePromises[e]=r.then(([a,r])=>new p({pdfManager:this.pdfManager,xref:this.xref,pageIndex:e,pageDict:a,ref:r,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,globalImageCache:t.globalImageCache,pdfFunctionFactory:this.pdfFunctionFactory}))}checkFirstPage(){return this.getPage(0).catch(async e=>{if(e instanceof s.XRefEntryException){this._pagePromises.length=0;await this.cleanup();throw new s.XRefParseException}})}fontFallback(e,t){return this.catalog.fontFallback(e,t)}async cleanup(e=!1){return this.catalog?this.catalog.cleanup(e):(0,n.clearPrimitiveCaches)()}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FileSpec=t.XRef=t.ObjectLoader=t.Catalog=void 0;var r=a(2),i=a(5),n=a(11),s=a(8),o=a(22),c=a(23),l=a(24);function h(e){return(0,i.isDict)(e)?e.get("D"):e}class u{constructor(e,t){this.pdfManager=e;this.xref=t;this.catDict=t.getCatalogObj();if(!(0,i.isDict)(this.catDict))throw new r.FormatError("Catalog object is not a dictionary.");this.fontCache=new i.RefSetCache;this.builtInCMapCache=new Map;this.globalImageCache=new l.GlobalImageCache;this.pageKidsCountCache=new i.RefSetCache}get metadata(){const e=this.catDict.getRaw("Metadata");if(!(0,i.isRef)(e))return(0,r.shadow)(this,"metadata",null);const t=!(this.xref.encrypt&&this.xref.encrypt.encryptMetadata),a=this.xref.fetch(e,t);let n;if(a&&(0,i.isDict)(a.dict)){const e=a.dict.get("Type"),t=a.dict.get("Subtype");if((0,i.isName)(e,"Metadata")&&(0,i.isName)(t,"XML"))try{n=(0,r.stringToUTF8String)((0,r.bytesToString)(a.getBytes()))}catc\';a.g+=\'h(e){if(e instanceof s.MissingDataException)throw e;(0,r.info)("Skipping invalid metadata.")}}return(0,r.shadow)(this,"metadata",n)}get toplevelPagesDict(){const e=this.catDict.get("Pages");if(!(0,i.isDict)(e))throw new r.FormatError("Invalid top-level pages dictionary.");return(0,r.shadow)(this,"toplevelPagesDict",e)}get documentOutline(){let e=null;try{e=this._readDocumentOutline()}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.warn)("Unable to read document outline.")}return(0,r.shadow)(this,"documentOutline",e)}_readDocumentOutline(){let e=this.catDict.get("Outlines");if(!(0,i.isDict)(e))return null;e=e.getRaw("First");if(!(0,i.isRef)(e))return null;const t={items:[]},a=[{obj:e,parent:t}],n=new i.RefSet;n.put(e);const s=this.xref,o=new Uint8ClampedArray(3);for(;a.length>0;){const t=a.shift(),l=s.fetchIfRef(t.obj);if(null===l)continue;if(!l.has("Title"))throw new r.FormatError("Invalid outline item encountered.");const h={url:null,dest:null};u.parseDestDictionary({destDict:l,resultObj:h,docBaseUrl:this.pdfManager.docBaseUrl});const d=l.get("Title"),f=l.get("F")||0,g=l.getArray("C"),m=l.get("Count");let p=o;!Array.isArray(g)||3!==g.length||0===g[0]&&0===g[1]&&0===g[2]||(p=c.ColorSpace.singletons.rgb.getRgb(g,0));const b={dest:h.dest,url:h.url,unsafeUrl:h.unsafeUrl,newWindow:h.newWindow,title:(0,r.stringToPDFString)(d),color:p,count:Number.isInteger(m)?m:void 0,bold:!!(2&f),italic:!!(1&f),items:[]};t.parent.items.push(b);e=l.getRaw("First");if((0,i.isRef)(e)&&!n.has(e)){a.push({obj:e,parent:b});n.put(e)}e=l.getRaw("Next");if((0,i.isRef)(e)&&!n.has(e)){a.push({obj:e,parent:t.parent});n.put(e)}}return t.items.length>0?t.items:null}get permissions(){let e=null;try{e=this._readPermissions()}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.warn)("Unable to read permissions.")}return(0,r.shadow)(this,"permissions",e)}_readPermissions(){const e=this.xref.trailer.get("Encrypt");if(!(0,i.isDict)(e))return null;let t=e.get("P");if(!(0,r.isNum)(t))return null;t+=2**32;const a=[];for(const e in r.PermissionFlag){const i=r.PermissionFlag[e];t&i&&a.push(i)}return a}get numPages(){const e=this.toplevelPagesDict.get("Count");if(!Number.isInteger(e))throw new r.FormatError("Page count in top-level pages dictionary is not an integer.");return(0,r.shadow)(this,"numPages",e)}get destinations(){const e=this._readDests(),t=Object.create(null);if(e instanceof g){const a=e.getAll();for(const e in a)t[e]=h(a[e])}else e instanceof i.Dict&&e.forEach((function(e,a){a&&(t[e]=h(a))}));return(0,r.shadow)(this,"destinations",t)}getDestination(e){const t=this._readDests();return t instanceof g||t instanceof i.Dict?h(t.get(e)||null):null}_readDests(){const e=this.catDict.get("Names");return e&&e.has("Dests")?new g(e.getRaw("Dests"),this.xref):this.catDict.has("Dests")?this.catDict.get("Dests"):void 0}get pageLabels(){let e=null;try{e=this._readPageLabels()}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.warn)("Unable to read page labels.")}return(0,r.shadow)(this,"pageLabels",e)}_readPageLabels(){const e=this.catDict.getRaw("PageLabels");if(!e)return null;const t=new Array(this.numPages);let a=null,n="";const o=new m(e,this.xref).getAll();let c="",l=1;for(let e=0,h=this.numPages;e=1))throw new r.FormatError("Invalid start in PageLabel dictionary.");l=e}else l=1}switch(a){case"D":c=l;break;case"R":case"r":c=(0,s.toRomanNumerals)(l,"r"===a);break;case"A":case"a":const e=26,t=65,i=97,n="a"===a?i:t,o=l-1,h=String.fromCharCode(n+o%e),u=[];for(let t=0,a=o/e|0;t<=a;t++)u.push(h);c=u.join("");break;default:if(a)throw new r.FormatError(`Invalid style "${a}" in PageLabel dictionary.`);c=""}t[e]=n+c;l++}return t}get pageLayout(){const e=this.catDict.get("PageLayout");let t="";if((0,i.isName)(e))switch(e.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":t=e.name}return(0,r.shadow)(this,"pageLayout",t)}get pageMode(){const e=this.catDict.get("PageMode");let t="UseNone";if((0,i.isName)(e))switch(e.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":t=e.name}return(0,r.shadow)(this,"pageMode",t)}get viewerPreferences(){const e={HideToolbar:r.isBool,HideMenubar:r.isBool,HideWindowUI:r.isBool,FitWindow:r.isBool,CenterWindow:r.isBool,DisplayDocTitle:r.isBool,NonFullScreenPageMode:i.isName,Direction:i.isName,ViewArea:i.isName,ViewClip:i.isName,PrintArea:i.isName,PrintClip:i.isName,PrintScaling:i.isName,Duplex:i.isName,PickTrayByPDFSize:r.isBool,PrintPageRange:Array.isArray,NumCopies:Number.isInteger},t=this.catDict.get("ViewerPreferences");let a=null;if((0,i.isDict)(t))for(const i in e){if(!t.has(i))continue;const n=t.get(i);if(!e[i](n)){(0,r.info)(`Bad value in ViewerPreferences for "${i}".`);continue}let s;switch(i){case"NonFullScreenPageMode":switch(n.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":s=n.name;break;default:s="UseNone"}break;case"Direction":switch(n.name){case"L2R":case"R2L":s=n.name;break;default:s="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":switch(n.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":s=n.name;break;default:s="CropBox"}break;case"PrintScaling":switch(n.name){case"None":case"AppDefault":s=n.name;break;default:s="AppDefault"}break;case"Duplex":switch(n.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":s=n.name;break;default:s="None"}break;case"PrintPageRange":if(n.length%2!=0)break;n.every((e,t,a)=>Number.isInteger(e)&&e>0&&(0===t||e>=a[t-1])&&e<=this.numPages)&&(s=n);break;case"NumCopies":n>0&&(s=n);break;default:if("boolean"!=typeof n)throw new r.FormatError("viewerPreferences - expected a boolean value for: "+i);s=n}if(void 0!==s){a||(a=Object.create(null));a[i]=s}else(0,r.info)(`Bad value in ViewerPreferences for "${i}".`)}return(0,r.shadow)(this,"viewerPreferences",a)}get openAction(){const e=this.catDict.get("OpenAction");let t=null;if((0,i.isDict)(e)){const a=new i.Dict(this.xref);a.set("A",e);const r={url:null,dest:null,action:null};u.parseDestDictionary({destDict:a,resultObj:r});if(Array.isArray(r.dest)){t||(t=Object.create(null));t.dest=r.dest}else if(r.action){t||(t=Object.create(null));t.action=r.action}}else if(Array.isArray(e)){t||(t=Object.create(null));t.dest=e}return(0,r.shadow)(this,"openAction",t)}get attachments(){const e=this.catDict.get("Names");let t=null;if(e&&e.has("EmbeddedFiles")){const a=new g(e.getRaw("EmbeddedFiles"),this.xref).getAll();for(const e in a){const i=new p(a[e],this.xref);t||(t=Object.create(null));t[(0,r.stringToPDFString)(e)]=i.serializable}}return(0,r.shadow)(this,"attachments",t)}get javaScript(){const e=this.catDict.get("Names");let t=null;function a(e){const a=e.get("S");if(!(0,i.isName)(a,"JavaScript"))return;let n=e.get("JS");if((0,i.isStream)(n))n=(0,r.bytesToString)(n.getBytes());else if(!(0,r.isString)(n))return;t||(t=[]);t.push((0,r.stringToPDFString)(n))}if(e&&e.has("JavaScript")){const t=new g(e.getRaw("JavaScript"),this.xref).getAll();for(const e in t){const r=t[e];(0,i.isDict)(r)&&a(r)}}const n=this.catDict.get("OpenAction");(0,i.isDict)(n)&&(0,i.isName)(n.get("S"),"JavaScript")&&a(n);return(0,r.shadow)(this,"javaScript",t)}fontFallback(e,t){const a=[];this.fontCache.forEach((function(e){a.push(e)}));return Promise.all(a).then(a=>{for(const r of a)if(r.loadedName===e){r.fallback(t);return}})}cleanup(e=!1){(0,i.clearPrimitiveCaches)();this.globalImageCache.clear(e);this.pageKidsCountCache.clear();const t=[];this.fontCache.forEach((function(e){t.push(e)}));return Promise.all(t).then(e=>{for(const{dict:t}of e)delete t.translated;this.fontCache.clear();this.builtInCMapCache.clear()})}getPageDict(e){const t=(0,r.createPromiseCapability)(),a=[this.catDict.getRaw("Pages")],n=new i.RefSet,s=this.xref,o=this.pageKidsCountCache;let c,l=0;!function h(){for(;a.length;){const u=a.pop();if((0,i.isRef)(u)){c=o.get(u);if(c>0&&l+c=0){const t=u.objId;t&&!o.has(t)&&o.put(t,c);if(l+c<=e){l+=c;continue}}const d=u.get("Kids");if(!Array.isArray(d)){if((0,i.isName)(u.get("Type"),"Page")||!u.has("Type")&&u.has("Contents")){if(l===e){t.resolve([u,null]);return}l++;continue}t.reject(new r.FormatError("Page dictionary kids object is not an array."));return}for(let e=d.length-1;e>=0;e--)a.push(d[e])}t.reject(new Error(`Page index ${e} not found.`))}();return t.promise}getPageIndex(e){const t=this.xref;let a=0;return function n(s){return function(a){let n,s=0;return t.fetchAsync(a).then((function(t){if((0,i.isRefsEqual)(a,e)&&!(0,i.isDict)(t,"Page")&&(!(0,i.isDict)(t)||t.has("Type")||!t.has("Contents")))throw new r.FormatError("The reference does not point to a /Page dictionary.");if(!t)return null;if(!(0,i.isDict)(t))throw new r.FormatError("Node must be a dictionary.");n=t.getRaw("Parent");return t.getAsync("Parent")})).then((function(e){if(!e)return null;if(!(0,i.isDict)(e))throw new r.FormatError("Parent must be a dictionary.");return e.getAsync("Kids")})).then((function(e){if(!e)return null;const o=[];let c=!1;for(let n=0,l=e.length;n0;){var h=l[0],u=l[1];if(!Number.isInteger(h)||!Number.isInteger(u))throw new r.FormatError(`Invalid XRef range fields: ${h}, ${u}`);if(!Number.isInteger(s)||!Number.isInteger(o)||!Number.isInteger(c))throw new r.FormatError(`Invalid XRef entry fields length: ${h}, ${u}`);for(t=i.entryNum;t=e.length);){a+=Strin\';a.g+=\'g.fromCharCode(r);r=e[t]}return a}function t(e,t,a){for(var r=a.length,i=e.length,n=0;t=r)break;t++;n++}return n}var a=/^(\\\\d+)\\\\s+(\\\\d+)\\\\s+obj\\\\b/;const o=/\\\\bendobj[\\\\b\\\\s]$/,c=/\\\\s+(\\\\d+\\\\s+\\\\d+\\\\s+obj[\\\\b\\\\s<])$/;var l=new Uint8Array([116,114,97,105,108,101,114]),h=new Uint8Array([115,116,97,114,116,120,114,101,102]);const u=new Uint8Array([111,98,106]);var d=new Uint8Array([47,88,82,101,102]);this.entries.length=0;var f=this.stream;f.pos=0;for(var g,m,p=f.getBytes(),b=f.start,y=p.length,v=[],w=[];b=y)break;k=p[b]}while(10!==k&&13!==k);else++b}for(g=0,m=w.length;g0;){const s=t.fetchIfRef(n.shift());if(!(0,i.isDict)(s))continue;if(s.has("Kids")){const e=s.get("Kids");for(let t=0,i=e.length;t10){(0,r.warn)(`Search depth limit reached for "${this._type}" tree.`);return null}const n=a.get("Kids");if(!Array.isArray(n))return null;let s=0,o=n.length-1;for(;s<=o;){const r=s+o>>1,i=t.fetchIfRef(n[r]).get("Limits");if(et.fetchIfRef(i[1]))){a=t.fetchIfRef(n[r]);break}s=r+1}}if(s>o)return null}const n=a.get(this._type);if(Array.isArray(n)){let a=0,i=n.length-2;for(;a<=i;){const r=a+i>>1,s=r+(1&r),o=t.fetchIfRef(n[s]);if(eo))return t.fetchIfRef(n[s+1]);a=s+2}}(0,r.info)(`Falling back to an exhaustive search, for key "${e}", in "${this._type}" tree.`);for(let a=0,i=n.length;a>")&&!(0,n.isEOF)(this.buf1);){if(!(0,n.isName)(this.buf1)){(0,i.info)("Malformed dictionary: key must be a name object");this.shift();continue}const t=this.buf1.name;this.shift();if((0,n.isEOF)(this.buf1))break;r.set(t,this.getObj(e))}if((0,n.isEOF)(this.buf1)){if(!this.recoveryMode)throw new i.FormatError("End of file inside dictionary");return r}if((0,n.isCmd)(this.buf2,"stream"))return this.allowStreams?this.makeStream(r,e):r;this.shift();return r;default:return t}if(Number.isInteger(t)){if(Number.isInteger(this.buf1)&&(0,n.isCmd)(this.buf2,"R")){const e=n.Ref.get(t,this.buf1);this.shift();this.shift();return e}return t}return"string"==typeof t&&e?e.decryptString(t):t}findDefaultInlineStreamEnd(e){const t=e.pos;let a,r,n=0;for(;-1!==(a=e.getByte());)if(0===n)n=69===a?1:0;else if(1===n)n=73===a?2:0;else{(0,i.assert)(2===n,"findDefaultInlineStreamEnd - invalid state.");if(32===a||10===a||13===a){r=e.pos;const t=e.peekBytes(10);for(let e=0,r=t.length;e127))){n=0;break}}if(2===n)break}else n=0}if(-1===a){(0,i.warn)("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker");if(r){(0,i.warn)(\\\'... trying to recover by using the last "EI" occurrence.\\\');e.skip(-(e.pos-r))}}let o=4;e.skip(-o);a=e.peekByte();e.skip(o);(0,s.isWhiteSpace)(a)||o--;return e.pos-o-t}findDCTDecodeInlineStreamEnd(e){const t=e.pos;let a,r,n=!1;for(;-1!==(a=e.getByte());)if(255===a){switch(e.getByte()){case 0:break;case 255:e.skip(-1);break;case 217:n=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:r=e.getUint16();r>2?e.skip(r-2):e.skip(-2)}if(n)break}const s=e.pos-t;if(-1===a){(0,i.warn)("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead.");e.skip(-s);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return s}findASCII85DecodeInlineStreamEnd(e){const t=e.pos;let a;for(;-1!==(a=e.getByte());)if(126===a){const t=e.pos;a=e.peekByte();for(;(0,s.isWhiteSpace)(a);){e.skip();a=e.peekByte()}if(62===a){e.skip();break}if(e.pos>t){const t=e.peekBytes(2);if(69===t[0]&&73===t[1])break}}const r=e.pos-t;if(-1===a){(0,i.warn)("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r}findASCIIHexDecodeInlineStreamEnd(e){const t=e.pos;let a;for(;-1!==(a=e.getByte())&&62!==a;);const r=e.pos-t;if(-1===a){(0,i.warn)("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r}inlineStreamSkipEI(e){let t,a=0;for(;-1!==(t=e.getByte());)if(0===a)a=69===t?1:0;else if(1===a)a=73===t?2:0;else if(2===a)break}makeInlineImage(e){const t=this.lexer,a=t.stream,r=new n.Dict(this.xref);let s;for(;!(0,n.isCmd)(this.buf1,"ID")&&!(0,n.isEOF)(this.buf1);){if(!(0,n.isName)(this.buf1))throw new i.FormatError("Dictionary key must be a name object");const t=this.buf1.name;this.shift();if((0,n.isEOF)(this.buf1))break;r.set(t,this.getObj(e))}-1!==t.beginInlineImagePos&&(s=a.pos-t.beginInlineImagePos);const o=r.get("Filter","F");let c;if((0,n.isName)(o))c=o.name;else if(Array.isArray(o)){const e=this.xref.fetchIfRef(o[0]);(0,n.isName)(e)&&(c=e.name)}const l=a.pos;let h;h="DCTDecode"===c||"DCT"===c?this.findDCTDecodeInlineStreamEnd(a):"ASCII85Decode"===c||"A85"===c?this.findASCII85DecodeInlineStreamEnd(a):"ASCIIHexDecode"===c||"AHx"===c?this.findASCIIHexDecodeInlineStreamEnd(a):this.findDefaultInlineStreamEnd(a);let d,f=a.makeSubStream(l,h,r);if(h<1e3&&s<5552){const e=f.getBytes();f.reset();const r=a.pos;a.pos=t.beginInlineImagePos;const i=a.getBytes(s);a.pos=r;d=u(e)+"_"+u(i);const o=this.imageCache[d];if(void 0!==o){this.buf2=n.Cmd.get("EI");this.shift();o.reset();return o}}e&&(f=e.createStream(f,h));f=this.filter(f,r,h);f.dict=r;if(void 0!==d){f.cacheKey=`inline_${h}_${d}`;this.imageCache[d]=f}this.buf2=n.Cmd.get("EI");this.shift();return f}_findStreamLength(e,t){const{stream:a}=this.lexer;a.pos=e;const r=t.length;for(;a.pos=r){a.pos+=s;return a.pos-e}s++}a.pos+=n}return-1}makeStream(e,t){const a=this.lexer;let r=a.stream;a.skipToNextLine();const o=r.pos-1;let c=e.get("Length");if(!Number.isInteger(c)){(0,i.info)(`Bad length "${c}" in stream`);c=0}r.pos=o+c;a.nextChar();if(this.tryShift()&&(0,n.isCmd)(this.buf2,"endstream"))this.shift();else{const e=new Uint8Array([101,110,100,115,116,114,1\';a.g+=\'01,97,109]);let t=this._findStreamLength(o,e);if(t<0){const a=1;for(let n=1;n<=a;n++){const a=e.length-n,c=e.slice(0,a),l=this._findStreamLength(o,c);if(l>=0){const e=r.peekBytes(a+1)[a];if(!(0,s.isWhiteSpace)(e))break;(0,i.info)(`Found "${(0,i.bytesToString)(c)}" when searching for endstream command.`);t=l;break}}if(t<0)throw new i.FormatError("Missing endstream command.")}c=t;a.nextChar();this.shift();this.shift()}this.shift();r=r.makeSubStream(o,c,e);t&&(r=t.createStream(r,c));r=this.filter(r,e,c);r.dict=e;return r}filter(e,t,a){let r=t.get("Filter","F"),s=t.get("DecodeParms","DP");if((0,n.isName)(r)){Array.isArray(s)&&(0,i.warn)("/DecodeParms should not contain an Array, when /Filter contains a Name.");return this.makeFilter(e,r.name,a,s)}let o=a;if(Array.isArray(r)){const t=r,a=s;for(let c=0,l=t.length;c=48&&e<=57?15&e:e>=65&&e<=70||e>=97&&e<=102?9+(15&e):-1}class m{constructor(e,t=null){this.stream=e;this.nextChar();this.strBuf=[];this.knownCommands=t;this._hexStringNumWarn=0;this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let e=this.currentChar,t=!1,a=0,r=0;if(45===e){r=-1;e=this.nextChar();45===e&&(e=this.nextChar())}else if(43===e){r=1;e=this.nextChar()}if(10===e||13===e)do{e=this.nextChar()}while(10===e||13===e);if(46===e){a=10;e=this.nextChar()}if(e<48||e>57){if(10===a&&0===r&&((0,s.isWhiteSpace)(e)||-1===e)){(0,i.warn)("Lexer.getNumber - treating a single decimal point as zero.");return 0}throw new i.FormatError(`Invalid number: ${String.fromCharCode(e)} (charCode ${e})`)}r=r||1;let n=e-48,o=0,c=1;for(;(e=this.nextChar())>=0;)if(e>=48&&e<=57){const r=e-48;if(t)o=10*o+r;else{0!==a&&(a*=10);n=10*n+r}}else if(46===e){if(0!==a)break;a=1}else if(45===e)(0,i.warn)("Badly formatted number: minus sign in the middle");else{if(69!==e&&101!==e)break;e=this.peekChar();if(43===e||45===e){c=45===e?-1:1;this.nextChar()}else if(e<48||e>57)break;t=!0}0!==a&&(n/=a);t&&(n*=10**(c*o));return r*n}getString(){let e=1,t=!1;const a=this.strBuf;a.length=0;let r=this.nextChar();for(;;){let n=!1;switch(0|r){case-1:(0,i.warn)("Unterminated string");t=!0;break;case 40:++e;a.push("(");break;case 41:if(0==--e){this.nextChar();t=!0}else a.push(")");break;case 92:r=this.nextChar();switch(r){case-1:(0,i.warn)("Unterminated string");t=!0;break;case 110:a.push("\\\\n");break;case 114:a.push("\\\\r");break;case 116:a.push("\\\\t");break;case 98:a.push("\\\\b");break;case 102:a.push("\\\\f");break;case 92:case 40:case 41:a.push(String.fromCharCode(r));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let e=15&r;r=this.nextChar();n=!0;if(r>=48&&r<=55){e=(e<<3)+(15&r);r=this.nextChar();if(r>=48&&r<=55){n=!1;e=(e<<3)+(15&r)}}a.push(String.fromCharCode(e));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:a.push(String.fromCharCode(r))}break;default:a.push(String.fromCharCode(r))}if(t)break;n||(r=this.nextChar())}return a.join("")}getName(){let e,t;const a=this.strBuf;a.length=0;for(;(e=this.nextChar())>=0&&!f[e];)if(35===e){e=this.nextChar();if(f[e]){(0,i.warn)("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number.");a.push("#");break}const r=g(e);if(-1!==r){t=e;e=this.nextChar();const n=g(e);if(-1===n){(0,i.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(e)}) in hexadecimal number.`);a.push("#",String.fromCharCode(t));if(f[e])break;a.push(String.fromCharCode(e));continue}a.push(String.fromCharCode(r<<4|n))}else a.push("#",String.fromCharCode(e))}else a.push(String.fromCharCode(e));a.length>127&&(0,i.warn)("Name token is longer than allowed by the spec: "+a.length);return n.Name.get(a.join(""))}_hexStringWarn(e){5!=this._hexStringNumWarn++?this._hexStringNumWarn>5||(0,i.warn)("getHexString - ignoring invalid character: "+e):(0,i.warn)("getHexString - ignoring additional invalid characters.")}getHexString(){const e=this.strBuf;e.length=0;let t,a,r=this.currentChar,n=!0;this._hexStringNumWarn=0;for(;;){if(r<0){(0,i.warn)("Unterminated hex string");break}if(62===r){this.nextChar();break}if(1!==f[r]){if(n){t=g(r);if(-1===t){this._hexStringWarn(r);r=this.nextChar();continue}}else{a=g(r);if(-1===a){this._hexStringWarn(r);r=this.nextChar();continue}e.push(String.fromCharCode(t<<4|a))}n=!n;r=this.nextChar()}else r=this.nextChar()}return e.join("")}getObj(){let e=!1,t=this.currentChar;for(;;){if(t<0)return n.EOF;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(1!==f[t])break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:this.nextChar();return n.Cmd.get("[");case 93:this.nextChar();return n.Cmd.get("]");case 60:t=this.nextChar();if(60===t){this.nextChar();return n.Cmd.get("<<")}return this.getHexString();case 62:t=this.nextChar();if(62===t){this.nextChar();return n.Cmd.get(">>")}return n.Cmd.get(">");case 123:this.nextChar();return n.Cmd.get("{");case 125:this.nextChar();return n.Cmd.get("}");case 41:this.nextChar();throw new i.FormatError("Illegal character: "+t)}let a=String.fromCharCode(t);const r=this.knownCommands;let s=r&&void 0!==r[a];for(;(t=this.nextChar())>=0&&!f[t];){const e=a+String.fromCharCode(t);if(s&&void 0===r[e])break;if(128===a.length)throw new i.FormatError("Command token too long: "+a.length);a=e;s=r&&void 0!==r[a]}if("true"===a)return!0;if("false"===a)return!1;if("null"===a)return null;"BI"===a&&(this.beginInlineImagePos=this.stream.pos);return n.Cmd.get(a)}skipToNextLine(){let e=this.currentChar;for(;e>=0;){if(13===e){e=this.nextChar();10===e&&this.nextChar();break}if(10===e){this.nextChar();break}e=this.nextChar()}}}t.Lexer=m;t.Linearization=class{static create(e){function t(e,t,a=!1){const r=e.get(t);if(Number.isInteger(r)&&(a?r>=0:r>0))return r;throw new Error(`The "${t}" parameter in the linearization dictionary is invalid.`)}const a=new d({lexer:new m(e),xref:null}),r=a.getObj(),s=a.getObj(),o=a.getObj(),c=a.getObj();let l,h;if(!(Number.isInteger(r)&&Number.isInteger(s)&&(0,n.isCmd)(o,"obj")&&(0,n.isDict)(c)&&(0,i.isNum)(l=c.get("Linearized"))&&l>0))return null;if((h=t(c,"L"))!==e.length)throw new Error(\\\'The "L" parameter in the linearization dictionary does not equal the stream length.\\\');return{length:h,hints:function(e){const t=e.get("H");let a;if(Array.isArray(t)&&(2===(a=t.length)||4===a)){for(let e=0;e0))throw new Error(`Hint (${e}) in the linearization dictionary is invalid.`)}return t}throw new Error("Hint array in the linearization dictionary is invalid.")}(c),objectNumberFirst:t(c,"O"),endFirst:t(c,"E"),numPages:t(c,"N"),mainXRefEntriesOffset:t(c,"T"),pageFirst:c.has("P")?t(c,"P",!0):0}}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LZWStream=t.StringStream=t.StreamsSequenceStream=t.Stream=t.RunLengthStream=t.PredictorStream=t.NullStream=t.FlateStream=t.DecodeStream=t.DecryptStream=t.AsciiHexStream=t.Ascii85Stream=void 0;var r=a(2),i=a(5),n=a(8),s=function(){function e(e,t,a,r){this.bytes=e instanceof Uint8Array?e:new Uint8Array(e);this.start=t||0;this.pos=this.start;this.end=t+a||this.bytes.length;this.dict=r}e.prototype={get length(){return this.end-this.start},get isEmpty(){return 0===this.length},getByte:function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},getUint16:function(){var e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t},getInt32:function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},getBytes(e,t=!1){var a=this.bytes,r=this.pos,i=this.end;if(!e){const e=a.subarray(r,i);return t?new Uint8ClampedArray(e):e}var n=r+e;n>i&&(n=i);this.pos=n;const s=a.subarray(r,n);return t?new Uint8ClampedArray(s):s},peekByte:function(){var e=this.getByte();-1!==e&&this.pos--;return e},peekBytes(e,t=!1){var a=this.getBytes(e,t);this.pos-=a.length;return a},getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);return this.bytes.subarray(e,t)},skip:function(e){e||(e=1);this.pos+=e},reset:function(){this.pos=this.start},moveStart:function(){this.start=this.pos},makeSubStream:function(t,a,r){return new e(this.bytes.buffer,t,a,r)}};return e}();t.Stream=s;var o=function(){function e(e){const t=(0,r.stringToBytes)(e);s.call(this,t)}e.prototype=s.prototype;return e}();t.StringStream=o;var c=function(){var e=new Uint8Array(0);function t(t){this._rawMinBufferLength=t||0;this.pos=0;this.bufferLength=0;this.eof=!1;this.buffer=e;this.minBufferLength=512;if(t)for(;this.minBufferLengthi&&(a=i)}else{for(;!this.eof;)this.readBlock();a=this.bufferLength}this.pos=a;const n=this.buffer.subarray(r,a);return!t||n instanceof Uint8ClampedArray?n:new Uint8ClampedArray(n)},peekByte:function(){var e=this.getByte();-1!==e&&this.pos--;return e},peekBytes(e,t=!1){var a=this.getBytes(e,t);this.pos-=a.length;return a},makeSubStream:function(e,t,a){for(var r=e+t;this.bufferLength<=r&&!this.eof;)this.readBlock();return new s(this.buffer,e,t,a)},getByteRange(e,t){(0,r.unreachable)("Should not call DecodeStream.getByteRange")},skip:function(e){e||(e=1);this.pos+=e},reset:function(){this.pos=0},getBaseStreams:function(){return this.str&&this.str.getBaseStreams?this.str.getBaseStreams():[]}};return t}();t.DecodeStream=c;var l=function(){function e(e){this.streams=e;let t=0;for(let a=0,r=e.length;a>e;this.codeSize=i-=e;return t};s.prototype.getCode=function(e){for(var t,a=this.str,i=e[0],n=e[1],s=this.codeSize,o=this.codeBuf;s>16,h=65535&c;if(l<1||s>l;this.codeSize=s-l;return h};s.prototype.generateHuffmanTable=function(e){var t,a=e.length,r=0;for(t=0;tr&&(r=e[t]);for(var i=1<>=1}for(t=h;t>=1)){var h,u;if(1===l){h=i;u=n}else{if(2!==l)throw new r.FormatError("Unknown block type in flate stream");var d,f=this.getBits(5)+257,g=this.getBits(5)+1,m=this.getBits(4)+4,p=new Uint8Array(e.length);for(d=0;d0;)S[d++]=w}h=this.generateHuffmanTable(S.subarray(0,f));u=this.generateHuffmanTable(S.subarray(f,k))}for(var A=(s=this.buffer)?s.length:0,I=this.bufferLength;;){var F=this.getCode(h);if(F<256){I+1>=A&&(A=(s=this.ensureBuffer(I+1)).length);s[I++]=F}else{if(256===F){this.bufferLength=I;return}var T=(F=t[F-=257])>>16;T>0&&(T=this.getBits(T));o=(65535&F)+T;F=this.getCode(u);(T=(F=a[F])>>16)>0&&(T=this.getBits(T));var E=(65535&F)+T;I+o>=A&&(A=(s=this.ensureBuffer(I+o)).length);for(var O=0;O15))throw new r.FormatError("Unsupported predictor: "+n);this.readBlock=2===n?this.readBlockTiff:this.readBlockPng;this.str=e;this.dict=e.dict;var s=this.colors=a.get("Colors")||1,o=this.bits=a.get("BitsPerComponent")||8,l=this.columns=a.get("Columns")||1;this.pixBytes=s*o+7>>3;this.rowBytes=l*s*o+7>>3;c.call(this,t);return this}e.prototype=Object.create(c.prototype);e.prototype.readBlockTiff=function(){var e=this.rowBytes,t=this.bufferLength,a=this.ensureBuffer(t+e),r=this.bits,i=this.colors,n=this.str.getBytes(e);this.eof=!n.length;if(!this.eof){var s,o=0,c=0,l=0,h=0,u=t;if(1===r&&1===i)for(s=0;s>1;d^=d>>2;o=(1&(d^=d>>4))<<7;a[u++]=d}else if(8===r){for(s=0;s>8&255;a[u++]=255&g}}else{var m=new Uint8Array(i+1),p=(1<>l-r)&p;l-=r;c=c<=8){a[y++]=c>>h-8&255;h-=8}}h>0&&(a[y++]=(c<<8-h)+(o&(1<<8-h)-1))}this.bufferLength+=e}};e.prototype.readBlockPng=function(){var e=this.rowBytes,t=this.pixBytes,a=this.str.getByte(),i=this.str.getBytes(e);this.eof=!i.length;if(!this.eof){var n=this.bufferLength,s=this.ensureBuffer(n+e),o=s.subarray(n-e,n);0===o.length&&(o=new Uint8Array(e));var c,l,h,u=n;switch(a){case 0:for(c=0;c>1)+i[c];for(;c>1)+i[c]&255;u++}break;case 4:for(c=0;c0;e=(0,this.decrypt)(e,!t);var a,r=this.bufferLength,i=e.length,n=this.ensureBuffer(r+i);for(a=0;a=0;--r){a[i+r]=255&o;o>>=8}}}else this.eof=!0};return e}();t.Ascii85Stream=f;var g=function(){function e(e,t){this.str=e;this.dict=e.dict;this.firstDigit=-1;t&&(t*=.5);c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBlock=function(){var e=this.str.getBytes(8e3);if(e.length){for(var t=e.length+1>>1,a=this.ensureBuffer(this.bufferLength+t),r=this.bufferLength,i=this.firstDigit,n=0,s=e.length;n=48&&c<=57)o=15&c;else{if(!(c>=65&&c<=70||c>=97&&c<=102)){if(62===c){this.eof=!0;break}continue}o=9+(15&c)}if(i<0)i=o;else{a[r++]=i<<4|o;i=-1}}if(i>=0&&this.eof){a[r++]=i<<4;i=-1}this.firstDigit=i;this.bufferLength=r}else this.eof=!0};return e}();t.AsciiHexStream=g;var m=function(){function e(e,t){this.str=e;this.dict=e.dict;c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBlock=function(){var e=this.str.getBytes(2);if(!e||e.length<2||128===e[0])this.eof=!0;else{var t,a=this.bufferLength,r=e[0];if(r<128){(t=this.ensureBuffer(a+r+1))[a++]=e[1];if(r>0){var i=this.str.getBytes(r);t.set(i,a);a+=r}}else{r=257-r;var n=e[1];t=this.ensureBuffer(a+r+1);for(var s=0;s>>t&(1<0;if(b<256){d[0]=b;f=1}else{if(!(b>=258)){if(256===b){h=9;s=258;f=0;continue}this.eof=!0;delete this.lzwState;break}if(b=0;t--){d[t]=o[a];a=l[a]}else d[f++]=d[0]}if(y){l[s]=u;c[s]=c[u]+1;o[s]=d[0];h=++s+n&s+n-1?h:0|Math.min(Math.log(s+n)/.6931471805599453+1,12)}u=b;if(r<(g+=f)){do{r+=512}while(re.getByte()};this.ccittFaxDecoder=new i.CCITTFaxDecoder(s,{K:a.get("K"),EndOfLine:a.get("EndOfLine"),EncodedByteAlign:a.get("EncodedByteAlign"),Columns:a.get("Columns"),Rows:a.get("Rows"),EndOfBlock:a.get("EndOfBlock"),BlackIs1:a.get("BlackIs1")});n.DecodeStream.call(this,t)}e.prototype=Object.create(n.DecodeStream.prototype);e.prototype.readBlock=function(){for(;!this.eof;){const e=this.ccittFaxDecoder.readNextChar();if(-1===e){this.eof=!0;return}this.ensureBuffer(this.bufferLength+1);this.buffer[this.bufferLength++]=e}};return e}();t.CCITTFaxStream=s},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CCITTFaxDecoder=void 0;var r=a(2);const i=function(){const e=[[-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]],t=[[-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]],a=[[-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]],i=[[-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\';a.g+=\'],[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]],n=[[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]],s=[[-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]];function o(e,t={}){if(!e||"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;let a,r=t.EndOfBlock;null==r&&(r=!0);this.eoblock=r;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;for(;0===(a=this._lookBits(12));)this._eatBits(1);1===a&&this._eatBits(12);if(this.encoding>0){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}}o.prototype={readNextChar(){if(this.eof)return-1;const e=this.refLine,t=this.codingLine,a=this.columns;let i,n,s,o,c;if(0===this.outputBits){this.rowsDone&&(this.eof=!0);if(this.eof)return-1;this.err=!1;let s,c,l;if(this.nextLine2D){for(o=0;t[o]=64);do{c+=l=this._getWhiteCode()}while(l>=64)}else{do{s+=l=this._getWhiteCode()}while(l>=64);do{c+=l=this._getBlackCode()}while(l>=64)}this._addPixels(t[this.codingPos]+s,n);t[this.codingPos]0?--i:++i;for(;e[i]<=t[this.codingPos]&&e[i]0?--i:++i;for(;e[i]<=t[this.codingPos]&&e[i]0?--i:++i;for(;e[i]<=t[this.codingPos]&&e[i]=64);else do{s+=l=this._getWhiteCode()}while(l>=64);this._addPixels(t[this.codingPos]+s,n);n^=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(;-1!==s&&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-1===s&&(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&&(0,r.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(-1===s){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)}}t[0]>0?this.outputBits=t[this.codingPos=0]:this.outputBits=t[this.codingPos=1];this.row++}if(this.outputBits>=8){c=1&this.codingPos?0:255;this.outputBits-=8;if(0===this.outputBits&&t[this.codingPos]s){c<<=s;1&this.codingPos||(c|=255>>8-s);this.outputBits-=s;s=0}else{c<<=this.outputBits;1&this.codingPos||(c|=255>>8-this.outputBits);s-=this.outputBits;this.outputBits=0;if(t[this.codingPos]0){c<<=s;s=0}}}while(s)}this.black&&(c^=255);return c},_addPixels(e,t){const a=this.codingLine;let i=this.codingPos;if(e>a[i]){if(e>this.columns){(0,r.info)("row is wrong length");this.err=!0;e=this.columns}1&i^t&&++i;a[i]=e}this.codingPos=i},_addPixelsNeg(e,t){const a=this.codingLine;let i=this.codingPos;if(e>a[i]){if(e>this.columns){(0,r.info)("row is wrong length");this.err=!0;e=this.columns}1&i^t&&++i;a[i]=e}else if(e0&&e=i){const t=a[e-i];if(t[0]===r){this._eatBits(r);return[!0,t[1],!0]}}}return[!1,0,!1]},_getTwoDimCode(){let t,a=0;if(this.eoblock){a=this._lookBits(7);t=e[a];if(t&&t[0]>0){this._eatBits(t[0]);return t[1]}}else{const t=this._findTableCode(1,7,e);if(t[0]&&t[2])return t[1]}(0,r.info)("Bad two dim code");return-1},_getWhiteCode(){let e,i=0;if(this.eoblock){i=this._lookBits(12);if(-1===i)return 1;e=i>>5==0?t[i]:a[i>>3];if(e[0]>0){this._eatBits(e[0]);return e[1]}}else{let e=this._findTableCode(1,9,a);if(e[0])return e[1];e=this._findTableCode(11,12,t);if(e[0])return e[1]}(0,r.info)("bad white code");this._eatBits(1);return 1},_getBlackCode(){let e,t;if(this.eoblock){e=this._lookBits(13);if(-1===e)return 1;t=e>>7==0?i[e]:e>>9==0&&e>>7!=0?n[(e>>1)-64]:s[e>>7];if(t[0]>0){this._eatBits(t[0]);return t[1]}}else{let e=this._findTableCode(2,6,s);if(e[0])return e[1];e=this._findTableCode(7,12,n,64);if(e[0])return e[1];e=this._findTableCode(10,13,i);if(e[0])return e[1]}(0,r.info)("bad black code");this._eatBits(1);return 1},_lookBits(e){let t;for(;this.inputBits>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)}};return o}();t.CCITTFaxDecoder=i},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Jbig2Stream=void 0;var r=a(5),i=a(12),n=a(16),s=a(2);const o=function(){function e(e,t,a,r){this.stream=e;this.maybeLength=t;this.dict=a;this.params=r;i.DecodeStream.call(this,t)}e.prototype=Object.create(i.DecodeStream.prototype);Object.defineProperty(e.prototype,"bytes",{get(){return(0,s.shadow)(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0});e.prototype.ensureBuffer=function(e){};e.prototype.readBlock=function(){if(this.eof)return;const e=new n.Jbig2Image,t=[];if((0,r.isDict)(this.params)){const e=this.params.get("JBIG2Globals");if((0,r.isStream)(e)){const a=e.getBytes();t.push({data:a,start:0,end:a.length})}}t.push({data:this.bytes,start:0,end:this.bytes.length});const a=e.parseChunks(t),i=a.length;for(let e=0;e>>0}var s=n(1),o=n(1)?n(1)?n(1)?n(1)?n(1)?n(32)+4436:n(12)+340:n(8)+84:n(6)+20:n(4)+4:n(2);return 0===s?o:o>0?-o:null}function c(e,t,a){for(var r=e.getContexts("IAID"),i=1,n=0;n=M&&I=D){z=z<<1&y;for(f=0;f=0&&T=0&&(O=U[F][T])&&(z|=O<=e?M<<=1:M=M<<1|x[P][B]}for(d=0;d=S||B<0||B>=k?M<<=1:M=M<<1|r[P][B]}var D=A.readBit(I,M);E[O]=D}}return x}function p(e,t,r,i,n,s,l,h,u,d,f,g,p,b,y,v,w,k,S){if(e&&t)throw new o("refinement with Huffman is not supported");var C,x,A=[];for(C=0;C1&&(i=e?S.readBits(k):a(T,"IAIT",F));var B=l*E+i,M=e?b.symbolIDTable.decode(S):c(T,F,u),D=t&&(e?S.readBit():a(T,"IARI",F)),N=h[M],L=N[0].length,R=N.length;if(D){var U=a(T,"IARDW",F),q=a(T,"IARDH",F);N=m(L+=U,R+=q,y,N,(U>>1)+a(T,"IARDX",F),(q>>1)+a(T,"IARDY",F),!1,v,w)}var _,j,z,G=B-(1&g?0:R-1),H=P-(2&g?L-1:0);if(d){for(_=0;_>5&7,u=[31&c],d=t+6;if(7===c){h=536870911&(0,i.readUint32)(e,d-1);d+=3;var f=h+7>>3;u[0]=e[d++];for(;--f>0;)u.push(e[d++])}else if(5===c||6===c)throw new o("invalid referred-to flags");a.retainBits=u;let g=4;a.number<=256?g=1:a.number<=65536&&(g=2);var m,p,b=[];for(m=0;m>>24&255;S[3]=y.height>>16&255;S[4]=y.height>>8&255;S[5]=255&y.height;for(m=d,p=e.length;m>2&3;d.huffmanDWSelector=f>>4&3;d.bitmapSizeSelector=f>>6&1;d.aggregationInstancesSelector=f>>7&1;d.bitmapCodingContextUsed=!!(256&f);d.bitmapCodingContextRetained=!!(512&f);d.template=f>>10&3;d.refinementTemplate=f>>12&1;h+=2;if(!d.huffman){s=0===d.template?4:1;r=[];for(n=0;n>2&3;g.stripSize=1<>4&3;g.transposed=!!(64&m);g.combinationOperator=m>>7&3;g.defaultPixelValue=m>>9&1;g.dsOffset=m<<17>>27;g.refinementTemplate=m>>15&1;if(g.huffman){var p=(0,i.readUint16)(l,h);h+=2;g.huffmanFS=3&p;g.huffmanDS=p>>2&3;g.huffmanDT=p>>4&3;g.huffmanRefinementDW=p>>6&3;g.huffmanRefinementDH=p>>8&3;g.huffmanRefinementDX=p>>10&3;g.huffmanRefinementDY=p>>12&3;g.huffmanRefinementSizeSelector=!!(16384&p)}if(g.refinement&&!g.refinementTemplate){r=[];for(n=0;n<2;n++){r.push({x:(0,i.readInt8)(l,h),y:(0,i.readInt8)(l,h+1)});h+=2}g.refinementAt=r}g.numberOfSymbolInstances=(0,i.readUint32)(l,h);h+=4;a=[g,c.referredTo,l,h,u];break;case 16:const e={},t=l[h++];e.mmr=!!(1&t);e.template=t>>1&3;e.patternWidth=l[h++];e.patternHeight=l[h++];e.maxPatternIndex=(0,i.readUint32)(l,h);h+=4;a=[e,c.number,l,h,u];break;case 22:case 23:const C={};C.info=v(l,h);h+=w;const x=l[h++];C.mmr=!!(1&x);C.template=x>>1&3;C.enableSkip=!!(8&x);C.combinationOperator=x>>4&7;C.defaultPixelValue=x>>7&1;C.gridWidth=(0,i.readUint32)(l,h);h+=4;C.gridHeight=(0,i.readUint32)(l,h);h+=4;C.gridOffsetX=4294967295&(0,i.readUint32)(l,h);h+=4;C.gridOffsetY=4294967295&(0,i.readUint32)(l,h);h+=4;C.gridVectorX=(0,i.readUint16)(l,h);h+=2;C.gridVectorY=(0,i.readUint16)(l,h);h+=2;a=[C,c.referredTo,l,h,u];break;case 38:case 39:var b={};b.info=v(l,h);h+=w;var y=l[h++];b.mmr=!!(1&y);b.template=y>>1&3;b.prediction=!!(8&y);if(!b.mmr){s=0===b.template?4:1;r=[];for(n=0;n>2&1;k.combinationOperator=S>>3&3;k.requiresBuffer=!!(32&S);k.combinationOperatorOverride=!!(64&S);a=[k];break;case 49:case 50:case 51:break;case 53:a=[c.number,l,h,u];break;case 62:break;default:throw new o(`segment type ${c.typeName}(${c.type}) is not implemented`)}var C="on"+c.typeName;C in t&&t[C].apply(t,a)}function S(e,t){for(var a=0,r=e.length;a>3,a=new Uint8ClampedArray(t*e.height);if(e.defaultPixelValue)for(var r=0,i=a.length;r>3,u=s.combinationOperatorOverride?e.combinationOperator:s.combinationOperator,d=this.buffer,f=128>>(7&e.x),g=e.y*h+(e.x>>3);switch(u){case 0:for(a=0;a>=1)){i=128;n++}}g+=h}break;case 2:for(a=0;a>=1)){i=128;n++}}g+=h}break;default:throw new o(`operator ${u} is not supported`)}},onImmediateGenericRegion:function(e,a,r,i){var n=e.info,s=new t(a,r,i),o=g(e.mmr,n.width,n.height,e.template,e.prediction,null,e.at,s);this.drawBitmap(n,o)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(e,r,n,s,l,h){let u,d;if(e.huffman){u=function(e,t,a){let r,i,n,s,c=0;switch(e.huffmanDHSelector){case 0:case 1:r=T(e.huffmanDHSelector+4);break;case 3:r=O(c,t,a);c++;break;default:throw new o("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:i=T(e.huffmanDWSelector+2);break;case 3:i=O(c,t,a);c++;break;default:throw new o("invalid Huffman DW selector")}if(e.bitmapSizeSelector){n=O(c,t,a);c++}else n=T(1);s=e.aggregationInstancesSelector?O(c,t,a):T(1);return{tableDeltaHeight:r,tableDeltaWidth:i,tableBitmapSize:n,tableAggregateInstances:s}}(e,n,this.customTables);d=new E(s,l,h)}var f=this.symbols;f||(this.symbols=f={});for(var b=[],y=0,v=n.length;y1)I=p(e,t,i,w,0,E,1,r.concat(v),k,0,0,1,0,l,d,f,b,0,y);else{var O=c(C,S,k),M=a(C,"IARDX",S),D=a(C,"IARDY",S);I=m(i,w,d,O=32){let a,r,s;switch(t){case 32:if(0===e)throw new o("no previous value in symbol ID table");r=i.readBits(2)+3;a=n[e-1].prefixLength;break;case 33:r=i.readBits(3)+3;a=0;break;case 34:r=i.readBits(7)+11;a=0;break;default:throw new o("invalid code length in symbol ID table")}for(s=0;s=0;v--){P=e?B(O,h,u,!0):g(!1,h,u,a,!1,null,F,b);T[v]=P}for(M=0;M=0;w--){N=T[w][M][D]^N;L|=N<>8;q=f+M*m-D*p>>8;if(U>=0&&U+x<=r&&q>=0&&q+A<=n)for(v=0;v=n)){j=y[t];_=R[v];for(w=0;w=0&&e>1&7),l=1+(r>>4&7),h=[];let u,d,f=n;do{u=o.readBits(c);d=o.readBits(l);h.push(new x([f,u,d,0]));f+=1<>t&1;if(t<=0)this.children[a]=new A(e);else{let r=this.children[a];r||(this.children[a]=r=new A(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 o("invalid Huffman data");return t.decodeNode(e)}};function I(e,t){t||this.assignPrefixCodes(e);this.rootNode=new A(null);for(let t=0,a=e.length;t0&&this.rootNode.buildTree(a,a.prefixLength-1)}}I.prototype={decode(e){return this.rootNode.decodeNode(e)},assignPrefixCodes(e){const t=e.length;let a=0;for(let r=0;r=this.end)throw new o("end of data while reading bit");this.currentByte=this.data[this.position++];this.shift=7}const e=this.currentByte>>this.shift&1;this.shift--;return e},readBits(e){let t,a=0;for(t=e-1;t>=0;t--)a|=this.readBit()<=this.end?-1:this.data[this.position++]}};function O(e,t,a){let r=0;for(let i=0,n=t.length;i>a&1;a--}}if(r&&!l){const e=5;for(let t=0;tfunction(e){for(var t=new C,a=0,r=e.length;a>=1}}return{imgData:d,width:l,height:h}}(e);this.width=a;this.height=r;return t}};return M}();t.Jbig2Image=c},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ArithmeticDecoder=void 0;const r=[{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}];t.ArithmeticDecoder=class{constructor(e,t,a){this.data=e;this.bp=t;this.dataEnd=a;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+=t65535){this.chigh+=this.clow>>16;this.clow&=65535}}readBit(e,t){let a=e[t]>>1,i=1&e[t];const n=r[a],s=n.qe;let o,c=this.a-s;if(this.chigh>15&1;this.clow=this.clow<<1&65535;this.ct--}while(0==(32768&c));this.a=c;e[t]=a<<1|i;return o}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.JpegStream=void 0;var r=a(12),i=a(5),n=a(19),s=a(2);const o=function(){function e(e,t,a,i){let n;for(;-1!==(n=e.getByte());)if(255===n){e.skip(-1);break}this.stream=e;this.maybeLength=t;this.dict=a;this.params=i;r.DecodeStream.call(this,t)}e.prototype=Object.create(r.DecodeStream.prototype);Object.defineProperty(e.prototype,"bytes",{get:function(){return(0,s.shadow)(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0});e.prototype.ensureBuffer=function(e){};e.prototype.readBlock=function(){if(this.eof)return;const e={decodeTransform:void 0,colorTransform:void 0},t=this.dict.getArray("Decode","D");if(this.forceRGB&&Array.isArray(t)){const a=this.dict.get("BitsPerComponent")||8,r=t.length,i=new Int32Array(r);let n=!1;const s=(1<0&&!e[s-1];)s--;n.push({children:[],index:0});var o,c=n[0];for(a=0;a0;)c=n.pop();c.index++;n.push(c);for(;n.length<=a;){n.push(o={children:[],index:0});c.children[c.index]=o.children;c=o}i++}if(a+10){S--;return k>>S&1}k=t[a++];if(255===k){var e=t[a++];if(e){if(220===e&&b){a+=2;const e=(0,i.readUint16)(t,a);a+=2;if(e>0&&e!==l.scanLines)throw new s("Found DNL marker (0xFFDC) while parsing scan data",e)}else if(217===e){if(b){const e=8*O;if(e>0&&e>>7}function x(e){for(var t=e;;){switch(typeof(t=t[C()])){case"number":return t;case"object":continue}throw new n("invalid huffman sequence")}}function A(e){for(var t=0;e>0;){t=t<<1|C();e--}return t}function I(e){if(1===e)return 1===C()?1:-1;var t=A(e);return t>=1<0)F--;else for(var r=f,i=g;r<=i;){var n=x(t.huffmanTableAC),s=15&n,o=n>>4;if(0!==s){var c=e[r+=o];t.blockData[a+c]=I(s)*(1<>4;if(0===(r=15&i))if(c<15){F=A(c)+(1<>4;if(0!==o){var l=e[n+=c];t.blockData[a+l]=I(o);n++}else{if(c<15)break;n+=16}}};var _,j,z,G,H=0;j=1===q?h[0].blocksPerLine*h[0].blocksPerColumn:y*l.mcusPerColumn;for(;H<=j;){var X=u?Math.min(j-H,u):j;if(X>0){for(D=0;D0?"unexpected":"excessive";(0,r.warn)(`decodeScan - ${e} MCU data, current marker is: ${_.invalid}`);a=_.offset}if(!(_.marker>=65488&&_.marker<=65495))break;a+=2}return a-w}function h(e,t,a){var r,i,s,o,c,l,h,u,d,f,g,m,p,b,y,v,w,k=e.quantizationTable,S=e.blockData;if(!k)throw new n("missing required Quantization Table.");for(var C=0;C<64;C+=8){d=S[t+C];f=S[t+C+1];g=S[t+C+2];m=S[t+C+3];p=S[t+C+4];b=S[t+C+5];y=S[t+C+6];v=S[t+C+7];d*=k[C];if(0!=(f|g|m|p|b|y|v)){f*=k[C+1];g*=k[C+2];m*=k[C+3];p*=k[C+4];b*=k[C+5];i=(r=(r=5793*d+128>>8)+(i=5793*p+128>>8)+1>>1)-i;w=3784*(s=g)+1567*(o=y*=k[C+6])+128>>8;s=1567*s-3784*o+128>>8;h=(c=(c=2896*(f-(v*=k[C+7]))+128>>8)+(h=b<<4)+1>>1)-h;l=(u=(u=2896*(f+v)+128>>8)+(l=m<<4)+1>>1)-l;o=(r=r+(o=w)+1>>1)-o;s=(i=i+s+1>>1)-s;w=2276*c+3406*u+2048>>12;c=3406*c-2276*u+2048>>12;u=w;w=799*l+4017*h+2048>>12;l=4017*l-799*h+2048>>12;h=w;a[C]=r+u;a[C+7]=r-u;a[C+1]=i+h;a[C+6]=i-h;a[C+2]=s+l;a[C+5]=s-l;a[C+3]=o+c;a[C+4]=o-c}else{w=5793*d+512>>10;a[C]=w;a[C+1]=w;a[C+2]=w;a[C+3]=w;a[C+4]=w;a[C+5]=w;a[C+6]=w;a[C+7]=w}}for(var x=0;x<8;++x){d=a[x];if(0!=((f=a[x+8])|(g=a[x+16])|(m=a[x+24])|(p=a[x+32])|(b=a[x+40])|(y=a[x+48])|(v=a[x+56]))){i=(r=4112+((r=5793*d+2048>>12)+(i=5793*p+2048>>12)+1>>1))-i;w=3784*(s=g)+1567*(o=y)+2048>>12;s=1567*s-3784*o+2048>>12;o=w;h=(c=(c=2896*(f-v)+2048>>12)+(h=b)+1>>1)-h;l=(u=(u=2896*(f+v)+2048>>12)+(l=m)+1>>1)-l;w=2276*c+3406*u+2048>>12;c=3406*c-2276*u+2048>>12;u=w;w=799*l+4017*h+2048>>12;l=4017*l-799*h+2048>>12;(d=(r=r+o+1>>1)+u)<16?d=0:d>=4080?d=255:d>>=4;(f=(i=i+s+1>>1)+(h=w))<16?f=0:f>=4080?f=255:f>>=4;(g=(s=i-s)+l)<16?g=0:g>=4080?g=255:g>>=4;(m=(o=r-o)+c)<16?m=0:m>=4080?m=255:m>>=4;(p=o-c)<16?p=0:p>=4080?p=255:p>>=4;(b=s-l)<16?b=0:b>=4080?b=255:b>>=4;(y=i-h)<16?y=0:y>=4080?y=255:y>>=4;(v=r-u)<16?v=0:v>=4080?v=255:v>>=4;S[t+x]=d;S[t+x+8]=f;S[t+x+16]=g;S[t+x+24]=m;S[t+x+32]=p;S[t+x+40]=b;S[t+x+48]=y;S[t+x+56]=v}else{w=(w=5793*d+8192>>14)<-2040?0:w>=2024?255:w+2056>>4;S[t+x]=w;S[t+x+8]=w;S[t+x+16]=w;S[t+x+24]=w;S[t+x+32]=w;S[t+x+40]=w;S[t+x+48]=w;S[t+x+56]=w}}}function u(e,t){for(var a=t.blocksPerLine,r=t.blocksPerColumn,i=new Int16Array(64),n=0;n=r)return null;var s=(0,i.readUint16)(e,t);if(s>=65472&&s<=65534)return{invalid:null,marker:s,offset:t};for(var o=(0,i.readUint16)(e,n);!(o>=65472&&o<=65534);){if(++n>=r)return null;o=(0,i.readUint16)(e,n)}return{invalid:s.toString(16),marker:o,offset:n}}t.prototype={parse(t,{dnlScanLines:c=null}={}){function h(){const e=(0,i.readUint16)(t,p);let a=(p+=2)+e-2;var n=d(t,a,p);if(n&&n.invalid){(0,r.warn)("readDataBlock - incorrect length, current marker is: "+n.invalid);a=n.offset}var s=t.subarray(p,a);p+=s.length;return s}function f(e){for(var t=Math.ceil(e.samplesPerLine/8/e.maxH),a=Math.ceil(e.scanLines/8/e.maxV),r=0;r>4==0)for(A=0;A<64;A++)O[e[A]]=t[p++];else{if(E>>4!=1)throw new n("DQT - invalid table spec");for(A=0;A<64;A++){O[e[A]]=(0,i.readUint16)(t,p);p+=2}}w[15&E]=O}break;case 65472:case 65473:case 65474:if(g)throw new n("Only single frame JPEGs supported");p+=2;(g={}).extended=65473===C;g.progressive=65474===C;g.precision=t[p++];const u=(0,i.readUint16)(t,p);p+=2;g.scanLines=c||u;g.samplesPerLine=(0,i.readUint16)(t,p);p+=2;g.components=[];g.componentIds={};var P,B=t[p++],M=0,D=0;for(x=0;x>4,L=15&t[p+1];M>4==0?S:k)[15&U]=a(q,j)}break;case 65501:p+=2;m=(0,i.readUint16)(t,p);p+=2;break;case 65498:const Z=1==++v&&!c;p+=2;var z,G=t[p++],H=[];for(x=0;x>4];z.huffmanTableAC=k[15&W];H.push(z)}var V=t[p++],K=t[p++],Y=t[p++];try{var J=l(t,p,g,H,m,V,K,Y>>4,15&Y,Z);p+=J}catch(e){if(e instanceof s){(0,r.warn)(e.message+" -- attempting to re-parse the JPEG image.");return this.parse(t,{dnlScanLines:e.scanLines})}if(e instanceof o){(0,r.warn)(e.message+" -- ignoring the rest of the image data.");break e}throw e}break;case 65500:p+=4;break;case 65535:255!==t[p]&&p--;break;default:const Q=d(t,p-2,p-3);if(Q&&Q.invalid){(0,r.warn)("JpegImage.parse - unexpected data, current marker is: "+Q.invalid);p=Q.offset;break}if(p>=t.length-1){(0,r.warn)("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break e}throw new n("JpegImage.parse - unknown marker: "+C.toString(16))}C=(0,i.readUint16)(t,p);p+=2}this.width=g.samplesPerLine;this.height=g.scanLines;this.jfif=b;this.adobe=y;this.components=[];for(x=0;x>8)+S[u+1];return v},get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform:1===this._colorTransform},_convertYccToRgb:function(e){for(var t,a,r,i=0,n=e.length;i4)throw new n("Unsupported color mode");var i=this._getLinearizedBlockData(e,t,r);if(1===this.numComponents&&a){for(var s=i.length,o=new Uint8ClampedArray(3*s),c=0,l=0;l>24&255,c>>16&255,c>>8&255,255&c);(0,r.warn)("Unsupported header type "+c+" ("+f+")")}h&&(t+=l)}else this.parseCodestream(e,0,e.length)},parseImageProperties:function(e){for(var t=e.getByte();t>=0;){if(65361===(t<<8|(t=e.getByte()))){e.skip(4);var a=e.getInt32()>>>0,r=e.getInt32()>>>0,i=e.getInt32()>>>0,n=e.getInt32()>>>0;e.skip(16);var o=e.getUint16();this.width=a-i;this.height=r-n;this.componentsCount=o;this.bitsPerComponent=8;return}}throw new s("No size marker found in JPX stream")},parseCodestream:function(e,t,n){var c={},l=!1;try{for(var h=t;h+1>5;g=[];for(;d>3;E.mu=0}else{E.epsilon=e[d]>>3;E.mu=(7&e[d])<<8|e[d+1];d+=2}g.push(E)}T.SPqcds=g;if(c.mainHeader)c.QCD=T;else{c.currentTile.QCD=T;c.currentTile.QCC=[]}break;case 65373:y=(0,i.readUint16)(e,h);var O,P={};d=h+2;if(c.SIZ.Csiz<257)O=e[d++];else{O=(0,i.readUint16)(e,d);d+=2}switch(31&(f=e[d++])){case 0:m=8;p=!0;break;case 1:m=16;p=!1;break;case 2:m=16;p=!0;break;default:throw new Error("Invalid SQcd value "+f)}P.noQuantization=8===m;P.scalarExpounded=p;P.guardBits=f>>5;g=[];for(;d>3;E.mu=0}else{E.epsilon=e[d]>>3;E.mu=(7&e[d])<<8|e[d+1];d+=2}g.push(E)}P.SPqcds=g;c.mainHeader?c.QCC[O]=P:c.currentTile.QCC[O]=P;break;case 65362:y=(0,i.readUint16)(e,h);var B={};d=h+2;var M=e[d++];B.entropyCoderWithCustomPrecincts=!!(1&M);B.sopMarkerUsed=!!(2&M);B.ephMarkerUsed=!!(4&M);B.progressionOrder=e[d++];B.layersCount=(0,i.readUint16)(e,d);d+=2;B.multipleComponentTransform=e[d++];B.decompositionLevelsCount=e[d++];B.xcb=2+(15&e[d++]);B.ycb=2+(15&e[d++]);var D=e[d++];B.selectiveArithmeticCodingBypass=!!(1&D);B.resetContextProbabilities=!!(2&D);B.terminationOnEachCodingPass=!!(4&D);B.verticallyStripe=!!(8&D);B.predictableTermination=!!(16&D);B.segmentationSymbolUsed=!!(32&D);B.reversibleTransformation=e[d++];if(B.entropyCoderWithCustomPrecincts){for(var N=[];d>4})}B.precinctsSizes=N}var R=[];B.selectiveArithmeticCodingBypass&&R.push("selectiveArithmeticCodingBypass");B.resetContextProbabilities&&R.push("resetContextProbabilities");B.terminationOnEachCodingPass&&R.push("terminationOnEachCodingPass");B.verticallyStripe&&R.push("verticallyStripe");B.predictableTermination&&R.push("predictableTermination");if(R.length>0){l=!0;throw new Error("Unsupported COD options ("+R.join(", ")+")")}if(c.mainHeader)c.COD=B;else{c.currentTile.COD=B;c.currentTile.COC=[]}break;case 65424:y=(0,i.readUint16)(e,h);(b={}).index=(0,i.readUint16)(e,h+2);b.length=(0,i.readUint32)(e,h+4);b.dataEnd=b.length+h-2;b.partIndex=e[h+8];b.partsCount=e[h+9];c.mainHeader=!1;if(0===b.partIndex){b.COD=c.COD;b.COC=c.COC.slice(0);b.QCD=c.QCD;b.QCC=c.QCC.slice(0)}c.currentTile=b;break;case 65427:if(0===(b=c.currentTile).partIndex){C(c,b.index);v(c)}w(c,e,h,y=b.dataEnd-h);break;case 65365:case 65367:case 65368:case 65380:y=(0,i.readUint16)(e,h);break;case 65363:throw new Error("Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("Unknown codestream code: "+u.toString(16))}h+=y}}catch(e){if(l||this.failOnCorruptedImage)throw new s(e.message);(0,r.warn)("JPX: Trying to recover from: "+e.message)}this.tiles=function(e){for(var t=e.SIZ,a=e.components,r=t.Csiz,i=[],n=0,s=e.tiles.length;n>2);y[w++]=e+p>>h;y[w++]=e>>h;y[w++]=e+m>>h}else for(d=0;d>h;y[w++]=g-.34413*m-.71414*p>>h;y[w++]=g+1.772*m>>h}if(k)for(d=0,w=3;d>h}else for(o=0;o>h;w+=r}}i.push(v)}return i}(c);this.width=c.SIZ.Xsiz-c.SIZ.XOsiz;this.height=c.SIZ.Ysiz-c.SIZ.YOsiz;this.componentsCount=c.SIZ.Csiz}};function a(e,t){e.x0=Math.ceil(t.XOsiz/e.XRsiz);e.x1=Math.ceil(t.Xsiz/e.XRsiz);e.y0=Math.ceil(t.YOsiz/e.YRsiz);e.y1=Math.ceil(t.Ysiz/e.YRsiz);e.width=e.x1-e.x0;e.height=e.y1-e.y0}function o(e,t){for(var a,r=e.SIZ,i=[],n=Math.ceil((r.Xsiz-r.XTOsiz)/r.XTsiz),s=Math.ceil((r.Ysiz-r.YTOsiz)/r.YTsiz),o=0;o0?Math.min(r.xcb,i.PPx-1):Math.min(r.xcb,i.PPx);i.ycb_=a>0?Math.min(r.ycb,i.PPy-1):Math.min(r.ycb,i.PPy);return i}function l(e,t,a){var r=1<t.trx0?Math.ceil(t.trx1/r)-Math.floor(t.trx0/r):0,l=t.try1>t.try0?Math.ceil(t.try1/i)-Math.floor(t.try0/i):0,h=c*l;t.precinctParameters={precinctWidth:r,precinctHeight:i,numprecinctswide:c,numprecinctshigh:l,numprecincts:h,precinctWidthInSubband:s,precinctHeightInSubband:o}}function h(e,t,a){var r,i,n,s,o=a.xcb_,c=a.ycb_,l=1<>o,d=t.tby0>>c,f=t.tbx1+l-1>>o,g=t.tby1+h-1>>c,m=t.resolution.precinctParameters,p=[],b=[];for(i=d;iy.cbxMax&&(y.cbxMax=r);iy.cbyMax&&(y.cbyMax=i)}else b[s]=y={cbxMin:r,cbyMin:i,cbxMax:r,cbyMax:i};n.precinct=y}}t.codeblockParameters={codeblockWidth:o,codeblockHeight:c,numcodeblockwide:f-u+1,numcodeblockhigh:g-d+1};t.codeblocks=p;t.precincts=b}function u(e,t,a){for(var r=[],i=e.subbands,n=0,s=i.length;ne.codingStyleParameters.decompositionLevelsCount)){for(var t=e.resolutions[h],a=t.precinctParameters.numprecincts;fe.codingStyleParameters.decompositionLevelsCount)){for(var t=e.resolutions[l],a=t.precinctParameters.numprecincts;fs.codingStyleParameters.decompositionLevelsCount)){var e=s.resolutions[a],n=e.precinctParameters.numprecincts;if(!(i>=n)){for(;t=0;--p){var b=c.resolutions[p],y=m*b.precinctParameters.precinctWidth,v=m*b.precinctParameters.precinctHeight;u=Math.min(u,y);d=Math.min(d,v);f=Math.max(f,b.precinctParameters.numprecinctswide);g=Math.max(g,b.precinctParameters.numprecinctshigh);h[p]={width:y,height:v};m<<=1}a=Math.min(a,u);r=Math.min(r,d);i=Math.max(i,f);n=Math.max(n,g);s[o]={resolutions:h,minWidth:u,minHeight:d,maxNumWide:f,maxNumHigh:g}}return{components:s,minWidth:a,minHeight:r,maxNumWide:i,maxNumHigh:n}}function v(e){for(var t=e.SIZ,a=e.currentTile.index,r=e.tiles[a],i=t.Csiz,n=0;n>>(o-=e)&(1<0;){var q=S.shift();void 0===(w=q.codeblock).data&&(w.data=[]);w.data.push({data:t,start:a+s,end:a+s+q.dataLength,codingpasses:q.codingpasses});s+=q.dataLength}}}return s}function k(e,t,a,r,i,s,o,c){for(var l=r.tbx0,h=r.tby0,u=r.tbx1-r.tbx0,d=r.codeblocks,f="H"===r.type.charAt(0)?1:0,g="H"===r.type.charAt(1)?t:0,m=0,p=d.length;m=s?D:D*(1<0?1-b:0)}var F=y.subbands[C],O=e[F.type];k(S,v,0,F,f?1:2**(d+O-I)*(1+A/2048),h+I-1,f,u)}m.push({width:v,height:w,items:S})}var P=g.calculate(m,i.tcx0,i.tcy0);return{left:i.tcx0,top:i.tcy0,width:P.width,height:P.height,items:P.items}}function C(e,t){for(var a=e.SIZ.Csiz,r=e.tiles[t],i=0;i>=1;t>>=1;r++}r--;(a=this.levels[r]).items[a.index]=i;this.currentLevel=r;delete this.value},incrementValue:function(){var e=this.levels[this.currentLevel];e.items[e.index]++},nextLevel:function(){var e=this.currentLevel,t=this.levels[e],a=t.items[t.index];if(--e<0){this.value=a;return!1}this.currentLevel=e;(t=this.levels[e]).items[t.index]=a;return!0}};return e}(),A=function(){function e(e,t,a){var r=(0,i.log2)(Math.max(e,t))+1;this.levels=[];for(var n=0;na){this.currentLevel=r;this.propagateValues();return!1}e>>=1;t>>=1;r++}this.currentLevel=r-1;return!0},incrementValue:function(e){var t=this.levels[this.currentLevel];t.items[t.index]=e+1;this.propagateValues()},propagateValues:function(){for(var e=this.currentLevel,t=this.levels[e],a=t.items[t.index];--e>=0;)(t=this.levels[e]).items[t.index]=a},nextLevel:function(){var e=this.currentLevel,t=this.levels[e],a=t.items[t.index];t.items[t.index]=255;if(--e<0)return!1;this.currentLevel=e;(t=this.levels[e]).items[t.index]=a;return!0}};return e}(),I=function(){var e=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]),t=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]),a=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]);function r(r,i,n,s,o){this.width=r;this.height=i;let c;c="HH"===n?a:"HL"===n?t:e;this.contextLabelTable=c;var l=r*i;this.neighborsSignificance=new Uint8Array(l);this.coefficentsSign=new Uint8Array(l);let h;h=o>14?new Uint32Array(l):o>6?new Uint16Array(l):new Uint8Array(l);this.coefficentsMagnitude=h;this.processingFlags=new Uint8Array(l);var u=new Uint8Array(l);if(0!==s)for(var d=0;d0,c=t+10){r=a-n;o&&(i[r-1]+=16);c&&(i[r+1]+=16);i[r]+=4}if(e+1=a)break;s[d]&=-2;if(!r[d]&&n[d]){var m=c[n[d]];if(e.readBit(o,m)){var p=this.decodeSignBit(g,u,d);i[d]=p;r[d]=1;this.setNeighborsSignificance(g,u,d);s[d]|=2}l[d]++;s[d]|=1}}},decodeSignBit:function(e,t,a){var r,i,n,s,o,c,l=this.width,h=this.height,u=this.coefficentsMagnitude,d=this.coefficentsSign;s=t>0&&0!==u[a-1];if(t+10&&0!==u[a-l];if(e+1=0){o=9+r;c=this.decoder.readBit(this.contexts,o)}else{o=9-r;c=1^this.decoder.readBit(this.contexts,o)}return c},runMagnitudeRefinementPass:function(){for(var e,t=this.decoder,a=this.width,r=this.height,i=this.coefficentsMagnitude,n=this.neighborsSignificance,s=this.contexts,o=this.bitsDecoded,c=this.processingFlags,l=a*r,h=4*a,u=0;u>1,c=-1.586134342059924,l=-.052980118572961,h=.882911075530934,u=.443506852043971,d=1.230174104914001;r=(t|=0)-3;for(i=o+4;i--;r+=2)e[r]*=.8128930661159609;n=u*e[(r=t-2)-1];for(i=o+3;i--;r+=2){s=u*e[r+1];e[r]=d*e[r]-n-s;if(!i--)break;n=u*e[(r+=2)+1];e[r]=d*e[r]-n-s}n=h*e[(r=t-1)-1];for(i=o+2;i--;r+=2){s=h*e[r+1];e[r]-=n+s;if(!i--)break;n=h*e[(r+=2)+1];e[r]-=n+s}n=l*e[(r=t)-1];for(i=o+1;i--;r+=2){s=l*e[r+1];e[r]-=n+s;if(!i--)break;n=l*e[(r+=2)+1];e[r]-=n+s}if(0!==o){n=c*e[(r=t+1)-1];for(i=o;i--;r+=2){s=c*e[r+1];e[r]-=n+s;if(!i--)break;n=c*e[(r+=2)+1];e[r]-=n+s}}};return e}(),E=function(){function e(){F.call(this)}e.prototype=Object.create(F.prototype);e.prototype.filter=function(e,t,a){var r,i,n=a>>1;for(r=t|=0,i=n+1;i--;r+=2)e[r]-=e[r-1]+e[r+1]+2>>2;for(r=t+1,i=n;i--;r+=2)e[r]+=e[r-1]+e[r+1]>>1};return e}();return t}();t.JpxImage=o},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.calculateSHA512=t.calculateSHA384=t.calculateSHA256=t.calculateMD5=t.PDF20=t.PDF17=t.CipherTransformFactory=t.ARCFourCipher=t.AES256Cipher=t.AES128Cipher=void 0;var r=a(2),i=a(5),n=a(12),s=function(){function e(e){this.a=0;this.b=0;var t,a,r=new Uint8Array(256),i=0,n=e.length;for(t=0;t<256;++t)r[t]=t;for(t=0;t<256;++t){i=i+(a=r[t])+e[t%n]&255;r[t]=r[i];r[i]=a}this.s=r}e.prototype={encryptBlock:function(e){var t,a,r,i=e.length,n=this.a,s=this.b,o=this.s,c=new Uint8Array(i);for(t=0;t>5&255;f[r++]=a>>13&255;f[r++]=a>>21&255;f[r++]=a>>>29&255;f[r++]=0;f[r++]=0;f[r++]=0;var g=new Int32Array(16);for(r=0;r>>32-C)|0;b=k}s=s+b|0;l=l+y|0;h=h+v|0;u=u+w|0}return new Uint8Array([255&s,s>>8&255,s>>16&255,s>>>24&255,255&l,l>>8&255,l>>16&255,l>>>24&255,255&h,h>>8&255,h>>16&255,h>>>24&255,255&u,u>>8&255,u>>16&255,u>>>24&255])});t.calculateMD5=l;var h=function(){function e(e,t){this.high=0|e;this.low=0|t}e.prototype={and:function(e){this.high&=e.high;this.low&=e.low},xor:function(e){this.high^=e.high;this.low^=e.low},or:function(e){this.high|=e.high;this.low|=e.low},shiftRight:function(e){if(e>=32){this.low=this.high>>>e-32|0;this.high=0}else{this.low=this.low>>>e|this.high<<32-e;this.high=this.high>>>e|0}},shiftLeft:function(e){if(e>=32){this.high=this.low<>>32-e;this.low=this.low<>>e|a<<32-e;this.high=a>>>e|t<<32-e},not:function(){this.high=~this.high;this.low=~this.low},add:function(e){var t=(this.low>>>0)+(e.low>>>0),a=(this.high>>>0)+(e.high>>>0);t>4294967295&&(a+=1);this.low=0|t;this.high=0|a},copyTo:function(e,t){e[t]=this.high>>>24&255;e[t+1]=this.high>>16&255;e[t+2]=this.high>>8&255;e[t+3]=255&this.high;e[t+4]=this.low>>>24&255;e[t+5]=this.low>>16&255;e[t+6]=this.low>>8&255;e[t+7]=255&this.low},assign:function(e){this.high=e.high;this.low=e.low}};return e}(),u=function(){function e(e,t){return e>>>t|e<<32-t}function t(e,t,a){return e&t^~e&a}function a(e,t,a){return e&t^e&a^t&a}function r(t){return e(t,2)^e(t,13)^e(t,22)}function i(t){return e(t,6)^e(t,11)^e(t,25)}function n(t){return e(t,7)^e(t,18)^t>>>3}var s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,402222\';a.g+=\'4774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function(o,c,l){var h,u,d,f=1779033703,g=3144134277,m=1013904242,p=2773480762,b=1359893119,y=2600822924,v=528734635,w=1541459225,k=64*Math.ceil((l+9)/64),S=new Uint8Array(k);for(h=0;h>>29&255;S[h++]=l>>21&255;S[h++]=l>>13&255;S[h++]=l>>5&255;S[h++]=l<<3&255;var C,x=new Uint32Array(64);for(h=0;h>>10)+x[u-7]+n(x[u-15])+x[u-16]|0;var A,I,F=f,T=g,E=m,O=p,P=b,B=y,M=v,D=w;for(u=0;u<64;++u){A=D+i(P)+t(P,B,M)+s[u]+x[u];I=r(F)+a(F,T,E);D=M;M=B;B=P;P=O+A|0;O=E;E=T;T=F;F=A+I|0}f=f+F|0;g=g+T|0;m=m+E|0;p=p+O|0;b=b+P|0;y=y+B|0;v=v+M|0;w=w+D|0}return new Uint8Array([f>>24&255,f>>16&255,f>>8&255,255&f,g>>24&255,g>>16&255,g>>8&255,255&g,m>>24&255,m>>16&255,m>>8&255,255&m,p>>24&255,p>>16&255,p>>8&255,255&p,b>>24&255,b>>16&255,b>>8&255,255&b,y>>24&255,y>>16&255,y>>8&255,255&y,v>>24&255,v>>16&255,v>>8&255,255&v,w>>24&255,w>>16&255,w>>8&255,255&w])}}();t.calculateSHA256=u;var d=function(){function e(e,t,a,r,i){e.assign(t);e.and(a);i.assign(t);i.not();i.and(r);e.xor(i)}function t(e,t,a,r,i){e.assign(t);e.and(a);i.assign(t);i.and(r);e.xor(i);i.assign(a);i.and(r);e.xor(i)}function a(e,t,a){e.assign(t);e.rotateRight(28);a.assign(t);a.rotateRight(34);e.xor(a);a.assign(t);a.rotateRight(39);e.xor(a)}function r(e,t,a){e.assign(t);e.rotateRight(14);a.assign(t);a.rotateRight(18);e.xor(a);a.assign(t);a.rotateRight(41);e.xor(a)}function i(e,t,a){e.assign(t);e.rotateRight(1);a.assign(t);a.rotateRight(8);e.xor(a);a.assign(t);a.shiftRight(7);e.xor(a)}function n(e,t,a){e.assign(t);e.rotateRight(19);a.assign(t);a.rotateRight(61);e.xor(a);a.assign(t);a.shiftRight(6);e.xor(a)}var s=[new h(1116352408,3609767458),new h(1899447441,602891725),new h(3049323471,3964484399),new h(3921009573,2173295548),new h(961987163,4081628472),new h(1508970993,3053834265),new h(2453635748,2937671579),new h(2870763221,3664609560),new h(3624381080,2734883394),new h(310598401,1164996542),new h(607225278,1323610764),new h(1426881987,3590304994),new h(1925078388,4068182383),new h(2162078206,991336113),new h(2614888103,633803317),new h(3248222580,3479774868),new h(3835390401,2666613458),new h(4022224774,944711139),new h(264347078,2341262773),new h(604807628,2007800933),new h(770255983,1495990901),new h(1249150122,1856431235),new h(1555081692,3175218132),new h(1996064986,2198950837),new h(2554220882,3999719339),new h(2821834349,766784016),new h(2952996808,2566594879),new h(3210313671,3203337956),new h(3336571891,1034457026),new h(3584528711,2466948901),new h(113926993,3758326383),new h(338241895,168717936),new h(666307205,1188179964),new h(773529912,1546045734),new h(1294757372,1522805485),new h(1396182291,2643833823),new h(1695183700,2343527390),new h(1986661051,1014477480),new h(2177026350,1206759142),new h(2456956037,344077627),new h(2730485921,1290863460),new h(2820302411,3158454273),new h(3259730800,3505952657),new h(3345764771,106217008),new h(3516065817,3606008344),new h(3600352804,1432725776),new h(4094571909,1467031594),new h(275423344,851169720),new h(430227734,3100823752),new h(506948616,1363258195),new h(659060556,3750685593),new h(883997877,3785050280),new h(958139571,3318307427),new h(1322822218,3812723403),new h(1537002063,2003034995),new h(1747873779,3602036899),new h(1955562222,1575990012),new h(2024104815,1125592928),new h(2227730452,2716904306),new h(2361852424,442776044),new h(2428436474,593698344),new h(2756734187,3733110249),new h(3204031479,2999351573),new h(3329325298,3815920427),new h(3391569614,3928383900),new h(3515267271,566280711),new h(3940187606,3454069534),new h(4118630271,4000239992),new h(116418474,1914138554),new h(174292421,2731055270),new h(289380356,3203993006),new h(460393269,320620315),new h(685471733,587496836),new h(852142971,1086792851),new h(1017036298,365543100),new h(1126000580,2618297676),new h(1288033470,3409855158),new h(1501505948,4234509866),new h(1607167915,987167468),new h(1816402316,1246189591)];return function(o,c,l,u){var d,f,g,m,p,b,y,v;if(u=!!u){d=new h(3418070365,3238371032);f=new h(1654270250,914150663);g=new h(2438529370,812702999);m=new h(355462360,4144912697);p=new h(1731405415,4290775857);b=new h(2394180231,1750603025);y=new h(3675008525,1694076839);v=new h(1203062813,3204075428)}else{d=new h(1779033703,4089235720);f=new h(3144134277,2227873595);g=new h(1013904242,4271175723);m=new h(2773480762,1595750129);p=new h(1359893119,2917565137);b=new h(2600822924,725511199);y=new h(528734635,4215389547);v=new h(1541459225,327033209)}var w,k,S,C=128*Math.ceil((l+17)/128),x=new Uint8Array(C);for(w=0;w>>29&255;x[w++]=l>>21&255;x[w++]=l>>13&255;x[w++]=l>>5&255;x[w++]=l<<3&255;var A=new Array(80);for(w=0;w<80;w++)A[w]=new h(0,0);var I,F,T=new h(0,0),E=new h(0,0),O=new h(0,0),P=new h(0,0),B=new h(0,0),M=new h(0,0),D=new h(0,0),N=new h(0,0),L=new h(0,0),R=new h(0,0),U=new h(0,0),q=new h(0,0);for(w=0;w=1;--e){a=n[13];n[13]=n[9];n[9]=n[5];n[5]=n[1];n[1]=a;a=n[14];r=n[10];n[14]=n[6];n[10]=n[2];n[6]=a;n[2]=r;a=n[15];r=n[11];i=n[7];n[15]=n[3];n[11]=a;n[7]=r;n[3]=i;for(let e=0;e<16;++e)n[e]=this._inv_s[n[e]];for(let a=0,r=16*e;a<16;++a,++r)n[a]^=t[r];for(let e=0;e<16;e+=4){const t=this._mix[n[e]],r=this._mix[n[e+1]],i=this._mix[n[e+2]],s=this._mix[n[e+3]];a=t^r>>>8^r<<24^i>>>16^i<<16^s>>>24^s<<8;n[e]=a>>>24&255;n[e+1]=a>>16&255;n[e+2]=a>>8&255;n[e+3]=255&a}}a=n[13];n[13]=n[9];n[9]=n[5];n[5]=n[1];n[1]=a;a=n[14];r=n[10];n[14]=n[6];n[10]=n[2];n[6]=a;n[2]=r;a=n[15];r=n[11];i=n[7];n[15]=n[3];n[11]=a;n[7]=r;n[3]=i;for(let e=0;e<16;++e){n[e]=this._inv_s[n[e]];n[e]^=t[e]}return n}_encrypt(e,t){const a=this._s;let r,i,n;const s=new Uint8Array(16);s.set(e);for(let e=0;e<16;++e)s[e]^=t[e];for(let e=1;e=r;--a)if(e[a]!==t){t=0;break}o-=t;n[n.length-1]=e.subarray(0,16-t)}}const c=new Uint8Array(o);for(let e=0,t=0,a=n.length;e=256&&(o=255&(27^o))}for(let t=0;t<4;++t){a[e]=r^=a[e-32];e++;a[e]=i^=a[e-32];e++;a[e]=n^=a[e-32];e++;a[e]=s^=a[e-32];e++}}return a}}t.AES256Cipher=b;var y=function(){function e(e,t){if(e.length!==t.length)return!1;for(var a=0;as-32;){var o=t.length+i.length+r.length,c=new Uint8Array(64*o),l=e(t,i);l=e(l,r);for(var h=0,g=0;h<64;h++,g+=o)c.set(l,g);n=new p(i.subarray(0,16)).encrypt(c,i.subarray(16,32));for(var m=0,b=0;b<16;b++){m*=1;m%=3;m+=(n[b]>>>0)%3;m%=3}0===m?i=u(n,0,n.length):1===m?i=f(n,0,n.length):2===m&&(i=d(n,0,n.length));s++}return i.subarray(0,32)}function a(){}function r(e,t){if(e.length!==t.length)return!1;for(var a=0;a>8&255;g[m++]=n>>16&255;g[m++]=n>>>24&255;for(u=0,d=t.length;u=4&&!h){g[m++]=255;g[m++]=255;g[m++]=255;g[m++]=255}var p=l(g,0,m),b=c>>3;if(o>=3)for(u=0;u<50;++u)p=l(p,0,b);var y,v=p.subarray(0,b);if(o>=3){for(m=0;m<32;++m)g[m]=e[m];for(u=0,d=t.length;u>3;if(r>=3)for(n=0;n<50;++n)d=l(d,0,d.length);if(r>=3){u=a;var g,m=new Uint8Array(f);for(n=19;n>=0;n--){for(g=0;g=4){var M=n.get("CF");(0,i.isDict)(M)&&(M.suppressEncryption=!0);this.cf=M;this.stmf=n.get("StmF")||a;this.strf=n.get("StrF")||a;this.eff=n.get("EFF")||this.stmf}}function o(e,t,a,r){var i,n,s=new Uint8Array(a.length+9);for(i=0,n=a.length;i>8&255;s[i++]=e>>16&255;s[i++]=255&t;s[i++]=t>>8&255;if(r){s[i++]=115;s[i++]=65;s[i++]=108;s[i++]=84}return l(s,0,i).subarray(0,Math.min(a.length+5,16))}function c(e,t,a,n,c){if(!(0,i.isName)(t))throw new r.FormatError("Invalid crypt filter name.");var l,h=e.get(t.name);null!=h&&(l=h.get("CFM"));if(!l||"None"===l.name)return function(){return new g};if("V2"===l.name)return function(){return new s(o(a,n,c,!1))};if("AESV2"===l.name)return function(){return new p(o(a,n,c,!0))};if("AESV3"===l.name)return function(){return new b(c)};throw new r.FormatError("Unknown crypto method")}n.prototype={createCipherTransform:function(e,t){if(4===this.algorithm||5===this.algorithm)return new w(c(this.cf,this.stmf,e,t,this.encryptionKey),c(this.cf,this.strf,e,t,this.encryptionKey));var a=o(e,t,this.encryptionKey,!1),r=function(){return new s(a)};return new w(r,r)}};return n}();t.CipherTransformFactory=k},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ColorSpace=void 0;var r=a(2),i=a(5);class n{constructor(e,t){this.constructor===n&&(0,r.unreachable)("Cannot initialize ColorSpace.");this.name=e;this.numComps=t}getRgb(e,t){const a=new Uint8ClampedArray(3);this.getRgbItem(e,t,a,0);return a}getRgbItem(e,t,a,i){(0,r.unreachable)("Should not call ColorSpace.getRgbItem")}getRgbBuffer(e,t,a,i,n,s,o){(0,r.unreachable)("Should not call ColorSpace.getRgbBuffer")}getOutputLength(e,t){(0,r.unreachable)("Should not call ColorSpace.getOutputLength")}isPassthrough(e){return!1}isDefaultDecode(e,t){return n.isDefaultDecode(e,this.numComps)}fillRgb(e,t,a,r,i,n,s,o,c){const l=t*a;let h=null;const u=1<u&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const t=s<=8?new Uint8Array(u):new Uint16Array(u);for(let e=0;e8?((e+16)/116)**3:e*((24/116)**3/8)}function f(r,n,f,g,m,p){const b=u(0,1,n[f]*p),y=u(0,1,n[f+1]*p),v=u(0,1,n[f+2]*p),w=b**r.GR,k=y**r.GG,S=v**r.GB,C=r.MXA*w+r.MXB*k+r.MXC*S,x=r.MYA*w+r.MYB*k+r.MYC*S,A=r.MZA*w+r.MZB*k+r.MZC*S,I=o;I[0]=C;I[1]=x;I[2]=A;const F=c;!function(a,r,i){if(1===a[0]&&1===a[2]){i[0]=r[0];i[1]=r[1];i[2]=r[2];return}const n=i;l(e,r,n);const o=s;!function(e,t,a){a[0]=1*t[0]/e[0];a[1]=1*t[1]/e[1];a[2]=1*t[2]/e[2]}(a,n,o);l(t,o,i)}(r.whitePoint,I,F);const T=o;!function(e,t,a){if(0===e[0]&&0===e[1]&&0===e[2]){a[0]=t[0];a[1]=t[1];a[2]=t[2];return}const r=d(0),i=(1-r)/(1-d(e[0])),n=1-i,s=(1-r)/(1-d(e[1])),o=1-s,c=(1-r)/(1-d(e[2])),l=1-c;a[0]=t[0]*i+n;a[1]=t[1]*s+o;a[2]=t[2]*c+l}(r.blackPoint,F,T);const E=c;!function(a,r,i){const n=i;l(e,r,n);const o=s;!function(e,t,a){a[0]=.95047*t[0]/e[0];a[1]=1*t[1]/e[1];a[2]=1.08883*t[2]/e[2]}(a,n,o);l(t,o,i)}(i,T,E);const O=o;l(a,E,O);g[m]=255*h(O[0]);g[m+1]=255*h(O[1]);g[m+2]=255*h(O[2])}return class extends n{constructor(e,t,a,i){super("CalRGB",3);if(!e)throw new r.FormatError("WhitePoint missing - required for color space CalRGB");t=t||new Float32Array(3);a=a||new Float32Array([1,1,1]);i=i||new Float32Array([1,0,0,0,1,0,0,0,1]);const n=e[0],s=e[1],o=e[2];this.whitePoint=e;const c=t[0],l=t[1],h=t[2];this.blackPoint=t;this.GR=a[0];this.GG=a[1];this.GB=a[2];this.MXA=i[0];this.MYA=i[1];this.MZA=i[2];this.MXB=i[3];this.MYB=i[4];this.MZB=i[5];this.MXC=i[6];this.MYC=i[7];this.MZC=i[8];if(n<0||o<0||1!==s)throw new r.FormatError("Invalid WhitePoint components for "+this.name+", no fallback available");if(c<0||l<0||h<0){(0,r.info)(`Invalid BlackPoint for ${this.name} [${c}, ${l}, ${h}], falling back to default.`);this.blackPoint=new Float32Array(3)}if(this.GR<0||this.GG<0||this.GB<0){(0,r.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for `+this.name+", falling back to default.");this.GR=this.GG=this.GB=1}}getRgbItem(e,t,a,r){f(this,e,t,a,r,1)}getRgbBuffer(e,t,a,r,i,n,s){const o=1/((1<=6/29?e*e*e:108/841*(e-4/29);return t}function t(e,t,a,r){return a+e*(r-a)/t}function a(a,r,i,n,s,o){let c=r[i],l=r[i+1],h=r[i+2];if(!1!==n){c=t(c,n,0,100);l=t(l,n,a.amin,a.amax);h=t(h,n,a.bmin,a.bmax)}l>a.amax?l=a.amax:la.bmax?h=a.bmax:hthis.amax||this.bmin>this.bmax){(0,r.info)("Invalid Range, falling back to defaults");this.amin=-100;this.amax=100;this.bmin=-100;this.bmax=100}}getRgbItem(e,t,r,i){a(this,e,t,!1,r,i)}getRgbBuffer(e,t,r,i,n,s,o){const c=(1<=n.MAX_IMAGES_TO_CACHE)}addPageIndex(e,t){let a=this._refCache.get(e);if(!a){a=new Set;this._refCache.put(e,a)}a.add(t)}getData(e,t){if(!this._refCache.has(e))return null;const a=this._refCache.get(e);if(a.size=n.MAX_IMAGES_TO_CACHE?(0,r.info)("GlobalImageCache.setData - ignoring image above MAX_IMAGES_TO_CACHE."):this._imageCache.put(e,t))}clear(e=!1){e||this._refCache.clear();this._imageCache.clear()}}t.GlobalImageCache=n},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getQuadPoints=h;t.MarkupAnnotation=t.AnnotationFactory=t.AnnotationBorderStyle=t.Annotation=void 0;var r=a(2),i=a(10),n=a(5),s=a(23),o=a(8),c=a(26),l=a(12);t.AnnotationFactory=class{static create(e,t,a,r){return a.ensure(this,"_create",[e,t,a,r])}static _create(e,t,a,i){const s=e.fetchIfRef(t);if(!(0,n.isDict)(s))return;const c=(0,n.isRef)(t)?t.toString():"annot_"+i.createObjId();let l=s.get("Subtype");l=(0,n.isName)(l)?l.name:null;const h={xref:e,dict:s,subtype:l,id:c,pdfManager:a};switch(l){case"Link":return new v(h);case"Text":return new y(h);case"Widget":let e=(0,o.getInheritableProperty)({dict:s,key:"FT"});e=(0,n.isName)(e)?e.name:null;switch(e){case"Tx":return new m(h);case"Btn":return new p(h);case"Ch":return new b(h)}(0,r.warn)(\\\'Unimplemented widget field type "\\\'+e+\\\'", falling back to base field type.\\\');return new g(h);case"Popup":return new w(h);case"FreeText":return new k(h);case"Line":return new S(h);case"Square":return new C(h);case"Circle":return new x(h);case"PolyLine":return new A(h);case"Polygon":return new I(h);case"Caret":return new F(h);case"Ink":return new T(h);case"Highlight":return new E(h);case"Underline":return new O(h);case"Squiggly":return new P(h);case"StrikeOut":return new B(h);case"Stamp":return new M(h);case"FileAttachment":return new D(h);default:l?(0,r.warn)(\\\'Unimplemented annotation type "\\\'+l+\\\'", falling back to base annotation.\\\'):(0,r.warn)("Annotation is missing the required /Subtype.");return new u(h)}}};function h(e,t){if(!e.has("QuadPoints"))return null;const a=e.getArray("QuadPoints");if(!Array.isArray(a)||a.length%8>0)return null;const r=[];for(let e=0,i=a.length/8;et[2]||st[3])return null;r[e].push({x:n,y:s})}}return r}class u{constructor(e){const t=e.dict;this.setContents(t.get("Contents"));this.setModificationDate(t.get("M"));this.setFlags(t.get("F"));this.setRectangle(t.getArray("Rect"));this.setColor(t.getArray("C"));this.setBorderStyle(t);this.setAppearance(t);this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,contents:this.contents,hasAppearance:!!this.appearance,id:e.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:e.subtype}}_hasFlag(e,t){return!!(e&t)}_isViewable(e){return!this._hasFlag(e,r.AnnotationFlag.INVISIBLE)&&!this._hasFlag(e,r.AnnotationFlag.HIDDEN)&&!this._hasFlag(e,r.AnnotationFlag.NOVIEW)}_isPrintable(e){return this._hasFlag(e,r.AnnotationFlag.PRINT)&&!this._hasFlag(e,r.AnnotationFlag.INVISIBLE)&&!this._hasFlag(e,r.AnnotationFlag.HIDDEN)}get viewable(){return 0===this.flags||this._isViewable(this.flags)}get printable(){return 0!==this.flags&&this._isPrintable(this.flags)}setContents(e){this.contents=(0,r.stringToPDFString)(e||"")}setModificationDate(e){this.modificationDate=(0,r.isString)(e)?e:null}setFlags(e){this.flags=Number.isInteger(e)&&e>0?e:0}hasFlag(e){return this._hasFlag(this.flags,e)}setRectangle(e){Array.isArray(e)&&4===e.length?this.rectangle=r.Util.normalizeRect(e):this.rectangle=[0,0,0,0]}setColor(e){const t=new Uint8ClampedArray(3);if(Array.isArray(e))switch(e.length){case 0:this.color=null;break;case 1:s.ColorSpace.singletons.gray.getRgbItem(e,0,t,0);this.color=t;break;case 3:s.ColorSpace.singletons.rgb.getRgbItem(e,0,t,0);this.color=t;break;case 4:s.ColorSpace.singletons.cmyk.getRgbItem(e,0,t,0);this.color=t;break;default:this.color=t}else this.color=t}setBorderStyle(e){this.borderStyle=new d;if((0,n.isDict)(e))if(e.has("BS")){const t=e.get("BS"),a=t.get("Type");if(!a||(0,n.isName)(a,"Border")){this.borderStyle.setWidth(t.get("W"),this.rectangle);this.borderStyle.setStyle(t.get("S"));this.borderStyle.setDashArray(t.getArray("D"))}}else if(e.has("Border")){const t=e.getArray("Border");if(Array.isArray(t)&&t.length>=3){this.borderStyle.setHorizontalCornerRadius(t[0]);this.borderStyle.setVerticalCornerRadius(t[1]);this.borderStyle.setWidth(t[2],this.rectangle);4===t.length&&this.borderStyle.setDashArray(t[3])}}else this.borderStyle.setWidth(0)}setAppearance(e){this.appearance=null;const t=e.get("AP");if(!(0,n.isDict)(t))return;const a=t.get("N");if((0,n.isStream)(a)){this.appearance=a;return}if(!(0,n.isDict)(a))return;const r=e.get("AS");(0,n.isName)(r)&&a.has(r.name)&&(this.appearance=a.get(r.name))}loadResources(e){return this.appearance.dict.getAsync("Resources").then(t=>{if(!t)return;return new i.ObjectLoader(t,e,t.xref).load().then((function(){return t}))})}getOperatorList(e,t,a){if(!this.appearance)return Promise.resolve(new c.OperatorList);const i=this.data,n=this.appearance.dict,s=this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"]),o=n.getArray("BBox")||[0,0,1,1],l=n.getArray("Matrix")||[1,0,0,1,0,0],h=function(e,t,a){const[i,n,s,o]=r.Util.getAxialAlignedBoundingBox(t,a);if(i===s||n===o)return[1,0,0,1,e[0],e[1]];const c=(e[2]-e[0])/(s-i),l=(e[3]-e[1])/(o-n);return[c,0,0,l,e[0]-i*c,e[1]-n*l]}(i.rect,o,l);return s.then(a=>{const n=new c.OperatorList;n.addOp(r.OPS.beginAnnotation,[i.rect,h,l]);return e.getOperatorList({stream:this.appearance,task:t,resources:a,operatorList:n}).then(()=>{n.addOp(r.OPS.endAnnotation,[]);this.appearance.reset();return n})})}}t.Annotation=u;class d{constructor(){this.width=1;this.style=r.AnnotationBorderStyleType.SOLID;this.dashArray=[3];this.horizontalCornerRadius=0;this.verticalCornerRadius=0}setWidth(e,t=[0,0,0,0]){if((0,n.isName)(e))this.width=0;else if(Number.isInteger(e)){if(e>0){const a=(t[2]-t[0])/2,i=(t[3]-t[1])/2;if(a>0&&i>0&&(e>a||e>i)){(0,r.warn)("AnnotationBorderStyle.setWidth - ignoring width: "+e);e=1}}this.width=e}}setStyle(e){if((0,n.isName)(e))switch(e.name){case"S":this.style=r.AnnotationBorderStyleType.SOLID;break;case"D":this.style=r.AnnotationBorderStyleType.DASHED;break;case"B":this.style=r.AnnotationBorderStyleType.BEVELED;break;case"I":this.style=r.AnnotationBorderStyleType.INSET;break;case"U":this.style=r.AnnotationBorderStyleType.UNDERLINE}}setDashArray(e){if(Array.isArray(e)&&e.length>0){let t=!0,a=!0;for(const r of e){if(!(+r>=0)){t=!1;break}r>0&&(a=!1)}t&&!a?this.dashArray=e:this.width=0}else e&&(this.width=0)}setHorizontalCornerRadius(e){Number.isInteger(e)&&(this.horizontalCornerRadius=e)}setVerticalCornerRadius(e){Number.isInteger(e)&&(this.verticalCornerRadius=e)}}t.AnnotationBorderStyle=d;class f extends u{constructor(e){super(e);const t=e.dict;if(t.has("IRT")){const e=t.getRaw("IRT");this.data.inReplyTo=(0,n.isRef)(e)?e.toString():null;const a=t.get("RT");this.data.replyType=(0,n.isName)(a)?a.name:r.AnnotationReplyType.REPLY}if(this.data.replyType===r.AnnotationReplyType.GROUP){const e=t.get("IRT");this.data.title=(0,r.stringToPDFString)(e.get("T")||"");this.setContents(e.get("Contents"));this.data.contents=this.contents;if(e.has("CreationDate")){this.setCreationDate(e.get("CreationDate"));this.data.creationDate=this.creationDate}else this.data.creationDate=null;if(e.has("M")){this.setModificationDate(e.get("M"));this.data.modificationDate=this.modificationDate}else this.data.modificationDate=null;this.data.hasPopup=e.has("Popup");if(e.has("C")){this.setColor(e.getArray("C"));this.data.color=this.color}else this.data.color=null}else{this.data.title=(0,r.stringToPDFString)(t.get("T")||"");this.setCreationDate(t.get("CreationDate"));this.data.creationDate=this.creationDate;this.data.hasPopup=t.has("Popup");t.has("C")||(this.data.color=null)}}setCreationDate(e){this.creationDate=(0,r.isString)(e)?e:null}}t.MarkupAnnotation=f;class g extends u{constructor(e){super(e);const t=e.dict,a=this.data;a.annotationType=r.AnnotationType.WIDGET;a.fieldName=this._constructFieldName(t);a.fieldValue=(0,o.getInheritableProperty)({dict:t,key:"V",getArray:!0});a.alternativeText=(0,r.stringToPDFString)(t.get("TU")||"");a.defaultAppearance=(0,o.getInheritableProperty)({dict:t,key:"DA"})||"";const i=(0,o.getInheritableProperty)({dict:t,key:"FT"});a.fieldType=(0,n.isName)(i)?i.name:null;this.fieldResources=(0,o.getInheritableProperty)({dict:t,key:"DR"})||n.Dict.empty;a.fieldFlags=(0,o.getInheritableProperty)({dict:t,key:"Ff"});(!Number.isInteger(a.fieldFlags)||a.fieldFlags<0)&&(a.fieldFlags=0);a.readOnly=this.hasFieldFlag(r.AnnotationFieldFlag.READONLY);if("Sig"===a.fieldType){a.fieldValue=null;this.setFlags(r.AnnotationFlag.HIDDEN)}}_constructFieldName(e){if(!e.has("T")&&!e.has("Parent")){(0,r.warn)("Unknown field name, falling back to empty field name.");return""}if(!e.has("Parent"))return(0,r.stringToPDFString)(e.get("T"));const t=[];e.has("T")&&t.unshift((0,r.stringToPDFString)(e.get("T")));let a=e;for(;a.has("Parent");){a=a.get("Parent");if(!(0,n.isDict)(a))break;a.has("T")&&t.unshift((0,r.stringToPDFString)(a.get("T")))}return t.join(".")}hasFieldFlag(e){return!!(this.data.fieldFlags&e)}getOperatorList(e,t,a){return a?Promise.resolve(new c.OperatorList):super.getOperatorList(e,t,a)}}class m extends g{constructor(e){super(e);const t=e.dict;this.data.fieldValue=(0,r.stringToPDFString)(this.data.fieldValue||"");let a=(0,o.getInheritableProperty)({dict:t,key:"Q"});(!Number.isInteger(a)||a<0||a>2)&&(a=null);this.data.textAlignment=a;let i=(0,o.getInheritableProperty)({dict:t,key:"MaxLen"});(!Number.isInteger(i)||i<0)&&(i=null);this.data.maxLen=i;this.data.multiLine=this.hasFieldFlag(r.AnnotationFieldFlag.MULTILINE);this.data.comb=this.hasFieldFlag(r.AnnotationFieldFlag.COMB)&&!this.hasFieldFlag(r.AnnotationFieldFlag.MULTILINE)&&!this.hasFieldFlag(r.\';a.g+=\'AnnotationFieldFlag.PASSWORD)&&!this.hasFieldFlag(r.AnnotationFieldFlag.FILESELECT)&&null!==this.data.maxLen}getOperatorList(e,t,a){if(a||this.appearance)return super.getOperatorList(e,t,a);const i=new c.OperatorList;if(!this.data.defaultAppearance)return Promise.resolve(i);const n=new l.Stream((0,r.stringToBytes)(this.data.defaultAppearance));return e.getOperatorList({stream:n,task:t,resources:this.fieldResources,operatorList:i}).then((function(){return i}))}}class p extends g{constructor(e){super(e);this.data.checkBox=!this.hasFieldFlag(r.AnnotationFieldFlag.RADIO)&&!this.hasFieldFlag(r.AnnotationFieldFlag.PUSHBUTTON);this.data.radioButton=this.hasFieldFlag(r.AnnotationFieldFlag.RADIO)&&!this.hasFieldFlag(r.AnnotationFieldFlag.PUSHBUTTON);this.data.pushButton=this.hasFieldFlag(r.AnnotationFieldFlag.PUSHBUTTON);this.data.checkBox?this._processCheckBox(e):this.data.radioButton?this._processRadioButton(e):this.data.pushButton?this._processPushButton(e):(0,r.warn)("Invalid field flags for button widget annotation")}_processCheckBox(e){(0,n.isName)(this.data.fieldValue)&&(this.data.fieldValue=this.data.fieldValue.name);const t=e.dict.get("AP");if(!(0,n.isDict)(t))return;const a=t.get("D");if(!(0,n.isDict)(a))return;const r=a.getKeys();2===r.length&&(this.data.exportValue="Off"===r[0]?r[1]:r[0])}_processRadioButton(e){this.data.fieldValue=this.data.buttonValue=null;const t=e.dict.get("Parent");if((0,n.isDict)(t)&&t.has("V")){const e=t.get("V");(0,n.isName)(e)&&(this.data.fieldValue=e.name)}const a=e.dict.get("AP");if(!(0,n.isDict)(a))return;const r=a.get("N");if((0,n.isDict)(r))for(const e of r.getKeys())if("Off"!==e){this.data.buttonValue=e;break}}_processPushButton(e){e.dict.has("A")?i.Catalog.parseDestDictionary({destDict:e.dict,resultObj:this.data,docBaseUrl:e.pdfManager.docBaseUrl}):(0,r.warn)("Push buttons without action dictionaries are not supported")}}class b extends g{constructor(e){super(e);this.data.options=[];const t=(0,o.getInheritableProperty)({dict:e.dict,key:"Opt"});if(Array.isArray(t)){const a=e.xref;for(let e=0,i=t.length;e1e3){u=Math.max(u,g);m+=f+2;g=0;f=0}d.push({transform:p,x:g,y:m,w:b.width,h:b.height});g+=b.width+2;f=Math.max(f,b.height)}var y=Math.max(u,g)+1,v=m+f+1,w=new Uint8ClampedArray(y*v*4),k=y<<2;for(h=0;h=0;){S[A-4]=S[A];S[A-3]=S[A+1];S[A-2]=S[A+2];S[A-1]=S[A+3];S[A+C]=S[A+C-4];S[A+C+1]=S[A+C-3];S[A+C+2]=S[A+C-2];S[A+C+3]=S[A+C-1];A-=k}}a.splice(s,4*l,r.OPS.paintInlineImageXObjectGroup);i.splice(s,4*l,[{width:y,height:v,kind:r.ImageKind.RGBA_32BPP,data:w},d]);return s+1}));e(t,[r.OPS.save,r.OPS.transform,r.OPS.paintImageMaskXObject,r.OPS.restore],null,(function(e,t){var a=e.fnArray,i=(t-(e.iCurr-3))%4;switch(i){case 0:return a[t]===r.OPS.save;case 1:return a[t]===r.OPS.transform;case 2:return a[t]===r.OPS.paintImageMaskXObject;case 3:return a[t]===r.OPS.restore}throw new Error("iterateImageMaskGroup - invalid pos: "+i)}),(function(e,t){var a,i=e.fnArray,n=e.argsArray,s=e.iCurr,o=s-3,c=s-2,l=s-1,h=Math.floor((t-o)/4);if((h=function(e,t,a,i){for(var n=e+2,s=0;s=4&&a[n-4]===a[s]&&a[n-3]===a[o]&&a[n-2]===a[c]&&a[n-1]===a[l]&&r[n-4][0]===h&&r[n-4][1]===u){d++;f-=5}for(var g=f+4,m=1;m=r)break}i=(i||t)[e[a]];if(i&&!Array.isArray(i)){s.iCurr=a;a++;if(!i.checkFn||(0,i.checkFn)(s)){n=i;i=null}else i=null}else a++}this.state=i;this.match=n;this.lastProcessed=a},push(e,t){this.queue.fnArray.push(e);this.queue.argsArray.push(t);this._optimize()},flush(){for(;this.match;){const e=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,e);this.match=null;this.state=null;this._optimize()}},reset(){this.state=null;this.match=null;this.lastProcessed=0}};return a}(),n=function(){function e(e){this.queue=e}e.prototype={push(e,t){this.queue.fnArray.push(e);this.queue.argsArray.push(t)},flush(){},reset(){}};return e}(),s=function(){function e(e,t,a){this._streamSink=t;this.fnArray=[];this.argsArray=[];this.optimizer=t&&"oplist"!==e?new i(this):new n(this);this.dependencies=Object.create(null);this._totalLength=0;this.pageIndex=a;this.intent=e;this.weight=0;this._resolved=t?null:Promise.resolve()}e.prototype={get length(){return this.argsArray.length},get ready(){return this._resolved||this._streamSink.ready},get totalLength(){return this._totalLength+this.length},addOp(e,t){this.optimizer.push(e,t);this.weight++;this._streamSink&&(this.weight>=1e3||this.weight>=995&&(e===r.OPS.restore||e===r.OPS.endText))&&this.flush()},addDependency(e){if(!(e in this.dependencies)){this.dependencies[e]=!0;this.addOp(r.OPS.dependency,[e])}},addDependencies(e){for(var t in e)this.addDependency(t)},addOpList(t){if(t instanceof e){Object.assign(this.dependencies,t.dependencies);for(var a=0,i=t.length;a{if(this.builtInCMapCache.has(e))return this.builtInCMapCache.get(e);const t=this.handler.sendWithStream("FetchBuiltInCMap",{name:e}).getReader(),a=await new Promise((function(e,a){!function r(){t.read().then((function({value:t,done:a}){if(!a){e(t);r()}}),a)}()}));a.compressionType!==r.CMapCompressionType.NONE&&this.builtInCMapCache.set(e,a);return a}}function a(){this.reset()}a.prototype={check:function(){if(++this.checked<100)return!1;this.checked=0;return this.endTime<=Date.now()},reset:function(){this.endTime=Date.now()+20;this.checked=0}};function d(e,t=!1){if(Array.isArray(e)){for(let t=0,a=e.length;tf){(0,r.warn)("Image exceeded maximum allowed size and was removed.");return}if(o.get("ImageMask","IM")||!1){var g=o.get("Width","W"),p=o.get("Height","H"),b=g+7>>3,y=t.getBytes(b*p,!0),v=o.getArray("Decode","D");(u=S.PDFImage.createMask({imgArray:y,width:g,height:p,imageIsFromDecodeStream:t instanceof m.DecodeStream,inverseDecode:!!v&&v[0]>0})).cached=!!n;d=[u];i.addOp(r.OPS.paintImageMaskXObject,d);n&&s.set(n,c,{fn:r.OPS.paintImageMaskXObject,args:d});return}var w=o.get("SMask","SM")||!1,k=o.get("Mask")||!1;if(a&&!w&&!k&&l+h<200){const n=new S.PDFImage({xref:this.xref,res:e,image:t,isInline:a,pdfFunctionFactory:this.pdfFunctionFactory});u=n.createImageData(!0);i.addOp(r.OPS.paintInlineImageXObject,[u]);return}let C="img_"+this.idFactory.createObjId(),x=!1;if(this.parsingType3Font)C=`${this.idFactory.getDocId()}_type3res_${C}`;else if(c){x=this.globalImageCache.shouldCache(c,this.pageIndex);x&&(C=`${this.idFactory.getDocId()}_${C}`)}i.addDependency(C);d=[C,l,h];const A=S.PDFImage.buildImage({xref:this.xref,res:e,image:t,isInline:a,pdfFunctionFactory:this.pdfFunctionFactory}).then(e=>{u=e.createImageData(!1);if(this.parsingType3Font)return this.handler.sendWithPromise("commonobj",[C,"FontType3Res",u],[u.data.buffer]);x?this.handler.send("commonobj",[C,"Image",u],[u.data.buffer]):this.handler.send("obj",[C,this.pageIndex,"Image",u],[u.data.buffer])}).catch(e=>{(0,r.warn)("Unable to decode image: "+e);if(this.parsingType3Font)return this.handler.sendWithPromise("commonobj",[C,"FontType3Res",null]);x?this.handler.send("commonobj",[C,"Image",null]):this.handler.send("obj",[C,this.pageIndex,"Image",null])});this.parsingType3Font&&await A;i.addOp(r.OPS.paintImageXObject,d);if(n){s.set(n,c,{fn:r.OPS.paintImageXObject,args:d});if(c){(0,r.assert)(!a,"Cannot cache an inline image globally.");this.globalImageCache.addPageIndex(c,this.pageIndex);x&&this.globalImageCache.setData(c,{objId:C,fn:r.OPS.paintImageXObject,args:d})}}},handleSMask:function(e,t,a,r,i){var n=e.get("G"),s={subtype:e.get("S").name,backdrop:e.get("BC")},o=e.get("TR");if((0,y.isPDFFunction)(o)){const e=this.pdfFunctionFactory.create(o);for(var c=new Uint8Array(256),l=new Float32Array(1),h=0;h<256;h++){l[0]=h/255;e(l,0,l,0);c[h]=255*l[0]|0}s.transferMap=c}return this.buildFormXObject(t,n,s,a,r,i.state.clone())},handleTilingType(e,t,a,i,s,o,c){const l=new k.OperatorList,h=[s.get("Resources"),a],d=n.Dict.merge(this.xref,h);return this.getOperatorList({stream:i,task:c,resources:d,operatorList:l}).then((function(){return(0,u.getTilingPatternIR)({fnArray:l.fnArray,argsArray:l.argsArray},s,t)})).then((function(t){o.addDependencies(l.dependencies);o.addOp(e,t)}),e=>{if(!(e instanceof r.AbortException)){if(!this.options.ignoreErrors)throw e;this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorTilingPattern});(0,r.warn)(`handleTilingType - ignoring pattern: "${e}".`)}})},handleSetFont:function(e,t,a,i,n,o){var c;t&&(c=(t=t.slice())[0].name);return this.loadFont(c,a,e).then(t=>t.font.isType3Font?t.loadType3Data(this,e,i,n).then((function(){return t})).catch(e=>{this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorFontLoadType3});return new x({loadedName:"g_font_error",font:new s.ErrorFont("Type3 font load error: "+e),dict:t.font,extraProperties:this.options.fontExtraProperties})}):t).then(e=>{o.font=e.font;e.send(this.handler);return e.loadedName})},handleText(e,a){const i=a.font,n=i.charsToGlyphs(e);if(i.data){(!!(a.textRenderingMode&r.TextRenderingMode.ADD_TO_PATH_FLAG)||"Pattern"===a.fillColorSpace.name||i.disableFontFace||this.options.disableFontFace)&&t.buildFontPaths(i,n,this.handler)}return n},ensureStateFont(e){if(e.font)return;const t=new r.FormatError("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw t;this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorFontState});(0,r.warn)(`ensureStateFont: "${t}".`)},setGState:function(e,t,a,i,s){for(var o=[],c=t.getKeys(),l=Promise.resolve(),h=0,u=c.length;hthis.handleSetFont(e,null,f[0],a,i,s.state).then((function(e){a.addDependency(e);o.push([u,[e,f[1]]])})));break;case"BM":o.push([u,d(f)]);break;case"SMask":if((0,n.isName)(f,"None")){o.push([u,!1]);break}if((0,n.isDict)(f)){l=l.then(()=>this.handleSMask(f,e,a,i,s));o.push([u,!0])}else(0,r.warn)("Unsupported SMask type");break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":(0,r.info)("graphic state operator "+u);break;default:(0,r.info)("Unknown graphic state operator "+u)}}return l.then((function(){o.length>0&&a.addOp(r.OPS.setGState,[o])}))},loadFont:function(e,a,i){const o=()=>Promise.resolve(new x({loadedName:"g_font_error",font:new s.ErrorFont(`Font "${e}" is not available.`),dict:a,extraProperties:this.options.fontExtraProperties}));var c,l=this.xref;if(a){if(!(0,n.isRef)(a))throw new r.FormatError(\\\'The "font" object should be a reference.\\\');c=a}else{var h=i.get("Font");h&&(c=h.getRaw(e))}if(!c){const i=`Font "${e||a&&a.toString()}" is not available`;if(!this.options.ignoreErrors&&!this.parsingType3Font){(0,r.warn)(i+".");return o()}this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorFontMissing});(0,r.warn)(i+" -- attempting to fallback to a default font.");c=t.getFallbackFontDict()}if(this.fontCache.has(c))return this.fontCache.get(c);a=l.fetchIfRef(c);if(!(0,n.isDict)(a))return o();if(a.translated)return a.translated;var u=(0,r.createPromiseCapability)(),d=this.preEvaluateFont(a);const{descriptor:f,hash:g}=d;var m,p,b=(0,n.isRef)(c);b&&(m=c.toString());if(g&&(0,n.isDict)(f)){f.fontAliases||(f.fontAliases=Object.create(null));var y=f.fontAliases;if(y[g]){var v=y[g].aliasRef;if(b&&v&&this.fontCache.has(v)){this.fontCache.putAlias(c,v);return this.fontCache.get(c)}}else y[g]={fontID:s.Font.getFontID()};b&&(y[g].aliasRef=c);m=y[g].fontID}if(b)this.fontCache.put(c,u.promise);else{m||(m=this.idFactory.createObjId());this.fontCache.put("id_"+m,u.promise)}(0,r.assert)(m,\\\'The "fontID" must be defined.\\\');a.loadedName=`${this.idFactory.getDocId()}_f${m}`;a.translated=u.promise;try{p=this.translateFont(d)}catch(e){p=Promise.reject(e)}p.then(e=>{if(void 0!==e.fontType){l.stats.fontTypes[e.fontType]=!0}u.resolve(new x({loadedName:a.loadedName,font:e,dict:a,extraProperties:this.options.fontExtraProperties}))}).catch(e=>{this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorFontTranslate});try{var t=f&&f.get("FontFile3"),i=t&&t.get("Subtype"),n=(0,s.getFontType)(d.type,i&&i.name);l.stats.fontTypes[n]=!0}catch(e){}u.resolve(new x({loadedName:a.loadedName,font:new s.ErrorFont(e instanceof Error?e.message:e),dict:a,extraProperties:this.options.fontExtraProperties}))});return u.promise},buildPath(e,t,a,i=!1){var n=e.length-1;a||(a=[]);if(n<0||e.fnArray[n]!==r.OPS.constructPath){if(i){(0,r.warn)(`Encountered path operator "${t}" inside of a text object.`);e.addOp(r.OPS.save,null)}e.addOp(r.OPS.constructPath,[[t],a]);i&&e.addOp(r.OPS.restore,null)}else{var s=e.argsArray[n];s[0].push(t);Array.prototype.push.apply(s[1],a)}},parseColorSpace({cs:e,resources:t}){return new Promise(a=>{a(g.ColorSpace.parse(e,this.xref,t,this.pdfFunctionFactory))}).catch(e=>{if(e instanceof r.AbortException)return null;if(this.options.ignoreErrors){this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorColorSpace});(0,r.warn)(`parseColorSpace - ignoring ColorSpace: "${e}".`);return null}throw e})},async handleColorN(e,t,a,i,s,o,c){var l,h=a[a.length-1];if((0,n.isName)(h)&&(l=s.get(h.name))){var d=(0,n.isStream)(l)?l.dict:l,f=d.get("PatternType");if(1===f){var g=i.base?i.base.getRgb(a,0):null;return this.handleTilingType(t,g,o,l,d,e,c)}if(2===f){var m=d.get("Shading"),p=d.getArray("Matrix");l=u.Pattern.parseShading(m,p,this.xref,o,this.handler,this.pdfFunctionFactory);e.addOp(t,l.getIR());return}throw new r.FormatError("Unknown PatternType: "+f)}throw new r.FormatError("Unknown PatternName: "+h)},getOperatorList({stream:e,task:t,resources:i,operatorList:s,initialState:o=null}){i=i||n.Dict.empty;o=o||new F;if(!s)throw new Error(\\\'getOperatorList: missing "operatorList" parameter\\\');var c=this,l=this.xref;let h=!1;const d=new v.LocalImageCache;var f=i.get("XObject")||n.Dict.empty,m=i.get("Pattern")||n.Dict.empty,p=new A(o),b=new T(e,l,p),y=new a;function w(e){for(var t=0,a=b.savedStatesDepth;t{if(!(e instanceof r.AbortExcept\';a.g+=\'ion)){if(!this.options.ignoreErrors)throw e;this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorOperatorList});(0,r.warn)(`getOperatorList - ignoring errors during "${t.name}" task: "${e}".`);w()}})},getTextContent({stream:e,task:t,resources:i,stateManager:s=null,normalizeWhitespace:o=!1,combineTextItems:c=!1,sink:h,seenStyles:u=Object.create(null)}){i=i||n.Dict.empty;s=s||new A(new I);var d=/\\\\s/g,g={items:[],styles:Object.create(null)},m={initialized:!1,str:[],width:0,height:0,vertical:!1,lastAdvanceWidth:0,lastAdvanceHeight:0,textAdvanceScale:0,spaceWidth:0,fakeSpaceMin:1/0,fakeMultiSpaceMin:1/0,fakeMultiSpaceMax:-0,textRunBreakAllowed:!1,transform:null,fontName:null},p=this,b=this.xref,y=null;const w=new v.LocalImageCache;var k,S=new T(e,b,s);function x(){if(m.initialized)return m;var e=k.font;if(!(e.loadedName in u)){u[e.loadedName]=!0;g.styles[e.loadedName]={fontFamily:e.fallbackName,ascent:e.ascent,descent:e.descent,vertical:e.vertical}}m.fontName=e.loadedName;var t=[k.fontSize*k.textHScale,0,0,k.fontSize,0,k.textRise];if(e.isType3Font&&k.fontSize<=1&&!(0,r.isArrayEqual)(k.fontMatrix,r.FONT_IDENTITY_MATRIX)){const a=e.bbox[3]-e.bbox[1];a>0&&(t[3]*=a*k.fontMatrix[3])}var a=r.Util.transform(k.ctm,r.Util.transform(k.textMatrix,t));m.transform=a;if(e.vertical){m.width=Math.sqrt(a[0]*a[0]+a[1]*a[1]);m.height=0;m.vertical=!0}else{m.width=0;m.height=Math.sqrt(a[2]*a[2]+a[3]*a[3]);m.vertical=!1}var i=k.textLineMatrix[0],n=k.textLineMatrix[1],s=Math.sqrt(i*i+n*n);i=k.ctm[0];n=k.ctm[1];var o=Math.sqrt(i*i+n*n);m.textAdvanceScale=o*s;m.lastAdvanceWidth=0;m.lastAdvanceHeight=0;var c=e.spaceWidth/1e3*k.fontSize;if(c){m.spaceWidth=c;m.fakeSpaceMin=.3*c;m.fakeMultiSpaceMin=1.5*c;m.fakeMultiSpaceMax=4*c;m.textRunBreakAllowed=!e.isMonospace}else{m.spaceWidth=0;m.fakeSpaceMin=1/0;m.fakeMultiSpaceMin=1/0;m.fakeMultiSpaceMax=0;m.textRunBreakAllowed=!1}m.initialized=!0;return m}function F(e){for(var t,a=0,r=e.length;a=32&&t<=127;)a++;return a0&&P(f,a.str)}var g=0,m=0;if(t.vertical){i+=m=c*k.fontMatrix[0]*k.fontSize+d}else{r+=g=(c*k.fontMatrix[0]*k.fontSize+d)*k.textHScale}k.translateTextMatrix(g,m);a.str.push(h)}if(t.vertical){a.lastAdvanceHeight=i;a.height+=Math.abs(i)}else{a.lastAdvanceWidth=r;a.width+=r}return a}function P(e,t){if(!(e0;)t.push(" ")}function B(){if(m.initialized){m.vertical?m.height*=m.textAdvanceScale:m.width*=m.textAdvanceScale;g.items.push((t=(e=m).str.join(""),a=(0,f.bidi)(t,-1,e.vertical),{str:o?F(a.str):a.str,dir:a.dir,width:e.width,height:e.height,transform:e.transform,fontName:e.fontName}));var e,t,a;m.initialized=!1;m.str.length=0}}function M(){const e=g.items.length;if(e>0){h.enqueue(g,e);g.items=[];g.styles=Object.create(null)}}var D=new a;return new Promise((function e(a,l){const d=function(t){M();Promise.all([t,h.ready]).then((function(){try{e(a,l)}catch(e){l(e)}}),l)};t.ensureNotTerminated();D.reset();for(var f,v={},I=[];!(f=D.check());){I.length=0;v.args=I;if(!S.read(v))break;k=s.state;var F,T=v.fn;I=v.args;switch(0|T){case r.OPS.setFont:var N=I[0].name,L=I[1];if(k.font&&N===k.fontName&&L===k.fontSize)break;B();k.fontName=N;k.fontSize=L;d(E(N,null));return;case r.OPS.setTextRise:B();k.textRise=I[0];break;case r.OPS.setHScale:B();k.textHScale=I[0]/100;break;case r.OPS.setLeading:B();k.leading=I[0];break;case r.OPS.moveText:var R=!!k.font&&0===(k.font.vertical?I[0]:I[1]);F=I[0]-I[1];if(c&&R&&m.initialized&&F>0&&F<=m.fakeMultiSpaceMax){k.translateTextLineMatrix(I[0],I[1]);m.width+=I[0]-m.lastAdvanceWidth;m.height+=I[1]-m.lastAdvanceHeight;P(I[0]-m.lastAdvanceWidth-(I[1]-m.lastAdvanceHeight),m.str);break}B();k.translateTextLineMatrix(I[0],I[1]);k.textMatrix=k.textLineMatrix.slice();break;case r.OPS.setLeadingMoveText:B();k.leading=-I[1];k.translateTextLineMatrix(I[0],I[1]);k.textMatrix=k.textLineMatrix.slice();break;case r.OPS.nextLine:B();k.carriageReturn();break;case r.OPS.setTextMatrix:F=k.calcTextLineMatrixAdvance(I[0],I[1],I[2],I[3],I[4],I[5]);if(c&&null!==F&&m.initialized&&F.value>0&&F.value<=m.fakeMultiSpaceMax){k.translateTextLineMatrix(F.width,F.height);m.width+=F.width-m.lastAdvanceWidth;m.height+=F.height-m.lastAdvanceHeight;P(F.width-m.lastAdvanceWidth-(F.height-m.lastAdvanceHeight),m.str);break}B();k.setTextMatrix(I[0],I[1],I[2],I[3],I[4],I[5]);k.setTextLineMatrix(I[0],I[1],I[2],I[3],I[4],I[5]);break;case r.OPS.setCharSpacing:k.charSpacing=I[0];break;case r.OPS.setWordSpacing:k.wordSpacing=I[0];break;case r.OPS.beginText:B();k.textMatrix=r.IDENTITY_MATRIX.slice();k.textLineMatrix=r.IDENTITY_MATRIX.slice();break;case r.OPS.showSpacedText:if(!s.state.font){p.ensureStateFont(s.state);continue}for(var U,q=I[0],_=0,j=q.length;_m.fakeMultiSpaceMax)||(m.height+=U)}else{U=(F=-F)*k.textHScale;k.translateTextMatrix(U,0);(z=m.textRunBreakAllowed&&F>m.fakeMultiSpaceMax)||(m.width+=U)}z?B():F>0&&P(F,m.str)}break;case r.OPS.showText:if(!s.state.font){p.ensureStateFont(s.state);continue}O(I[0]);break;case r.OPS.nextLineShowText:if(!s.state.font){p.ensureStateFont(s.state);continue}B();k.carriageReturn();O(I[0]);break;case r.OPS.nextLineSetSpacingShowText:if(!s.state.font){p.ensureStateFont(s.state);continue}B();k.wordSpacing=I[0];k.charSpacing=I[1];k.carriageReturn();O(I[2]);break;case r.OPS.paintXObject:B();y||(y=i.get("XObject")||n.Dict.empty);var G=I[0].name;if(G&&w.getByName(G))break;d(new Promise((function(e,a){if(!G)throw new r.FormatError("XObject must be referred to by name.");let l=y.getRaw(G);if(l instanceof n.Ref){if(w.getByRef(l)){e();return}l=b.fetch(l)}if(!l){e();return}if(!(0,n.isStream)(l))throw new r.FormatError("XObject should be a stream");const d=l.dict.get("Subtype");if(!(0,n.isName)(d))throw new r.FormatError("XObject should have a Name subtype");if("Form"!==d.name){w.set(G,l.dict.objId,!0);e();return}const f=s.state.clone(),g=new A(f),m=l.dict.getArray("Matrix");Array.isArray(m)&&6===m.length&&g.transform(m);M();const v={enqueueInvoked:!1,enqueue(e,t){this.enqueueInvoked=!0;h.enqueue(e,t)},get desiredSize(){return h.desiredSize},get ready(){return h.ready}};p.getTextContent({stream:l,task:t,resources:l.dict.get("Resources")||i,stateManager:g,normalizeWhitespace:o,combineTextItems:c,sink:v,seenStyles:u}).then((function(){v.enqueueInvoked||w.set(G,l.dict.objId,!0);e()}),a)})).catch((function(e){if(!(e instanceof r.AbortException)){if(!p.options.ignoreErrors)throw e;(0,r.warn)(`getTextContent - ignoring XObject: "${e}".`)}})));return;case r.OPS.setGState:B();var H=I[0],X=i.get("ExtGState");if(!(0,n.isDict)(X)||!(0,n.isName)(H))break;var W=X.get(H.name);if(!(0,n.isDict)(W))break;var V=W.get("Font");if(V){k.fontName=null;k.fontSize=V[1];d(E(null,V[0]));return}}if(g.items.length>=h.desiredSize){f=!0;break}}if(f)d(C);else{B();M();a()}})).catch(e=>{if(!(e instanceof r.AbortException)){if(!this.options.ignoreErrors)throw e;(0,r.warn)(`getTextContent - ignoring errors during "${t.name}" task: "${e}".`);B();M()}})},extractDataStructures:function(e,t,a){const i=this.xref;let c;var l=e.get("ToUnicode")||t.get("ToUnicode"),h=l?this.readToUnicode(l):Promise.resolve(void 0);if(a.composite){var u=e.get("CIDSystemInfo");(0,n.isDict)(u)&&(a.cidSystemInfo={registry:(0,r.stringToPDFString)(u.get("Registry")),ordering:(0,r.stringToPDFString)(u.get("Ordering")),supplement:u.get("Supplement")});var d=e.get("CIDToGIDMap");(0,n.isStream)(d)&&(c=d.getBytes())}var f,g=[],m=null;if(e.has("Encoding")){f=e.get("Encoding");if((0,n.isDict)(f)){m=f.get("BaseEncoding");m=(0,n.isName)(m)?m.name:null;if(f.has("Differences"))for(var p=f.get("Differences"),b=0,y=0,v=p.length;y0;a.dict=e;return h.then(e=>{a.toUnicode=e;return this.buildToUnicode(a)}).then(e=>{a.toUnicode=e;c&&(a.cidToGidMap=this.readCidToGidMap(c,e));return a})},_buildSimpleFontToUnicode(e,t=!1){(0,r.assert)(!e.composite,"Must be a simple font.");const a=[],i=e.defaultEncoding.slice(),n=e.baseEncodingName,c=e.differences;for(const e in c){const t=c[e];".notdef"!==t&&(i[e]=t)}const h=(0,p.getGlyphsUnicode)();for(const r in i){let s=i[r];if(""!==s)if(void 0!==h[s])a[r]=String.fromCharCode(h[s]);else{let i=0;switch(s[0]){case"G":3===s.length&&(i=parseInt(s.substring(1),16));break;case"g":5===s.length&&(i=parseInt(s.substring(1),16));break;case"C":case"c":if(s.length>=3&&s.length<=4){const a=s.substring(1);if(t){i=parseInt(a,16);break}i=+a;if(Number.isNaN(i)&&Number.isInteger(parseInt(a,16)))return this._buildSimpleFontToUnicode(e,!0)}break;default:const a=(0,l.getUnicodeForGlyph)(s,h);-1!==a&&(i=a)}if(i>0&&i<=1114111&&Number.isInteger(i)){if(n&&i===+r){const e=(0,o.getEncoding)(n);if(e&&(s=e[r])){a[r]=String.fromCharCode(h[s]);continue}}a[r]=String.fromCodePoint(i)}}}return new s.ToUnicodeMap(a)},buildToUnicode(e){e.hasIncludedToUnicodeMap=!!e.toUnicode&&e.toUnicode.length>0;if(e.hasIncludedToUnicodeMap){!e.composite&&e.hasEncoding&&(e.fallbackToUnicode=this._buildSimpleFontToUnicode(e));return Promise.resolve(e.toUnicode)}if(!e.composite)return Promise.resolve(this._buildSimpleFontToUnicode(e));if(e.composite&&(e.cMap.builtInCMap&&!(e.cMap instanceof i.IdentityCMap)||"Adobe"===e.cidSystemInfo.registry&&("GB1"===e.cidSystemInfo.ordering||"CNS1"===e.cidSystemInfo.ordering||"Japan1"===e.cidSystemInfo.ordering||"Korea1"===e.cidSystemInfo.ordering))){const t=e.cidSystemInfo.registry,a=e.cidSystemInfo.ordering,o=n.Name.get(t+"-"+a+"-UCS2");return i.CMapFactory.create({encoding:o,fetchBuiltInCMap:this.fetchBuiltInCMap,useCMap:null}).then((function(t){const a=e.cMap,i=[];a.forEach((function(e,a){if(a>65535)throw new r.FormatError("Max size of CID is 65,535");const n=t.lookup(a);n&&(i[e]=String.fromCharCode((n.charCodeAt(0)<<8)+n.charCodeAt(1)))}));return new s.ToUnicodeMap(i)}))}return Promise.resolve(new s.IdentityToUnicodeMap(e.firstChar,e.lastChar))},readToUnicode:function(e){var t=e;return(0,n.isName)(t)?i.CMapFactory.create({encoding:t,fetchBuiltInCMap:this.fetchBuiltInCMap,useCMap:null}).then((function(e){return e instanceof i.IdentityCMap?new s.IdentityToUnicodeMap(0,65535):new s.ToUnicodeMap(e.getMap())})):(0,n.isStream)(t)?i.CMapFactory.create({encoding:t,fetchBuiltInCMap:this.fetchBuiltInCMap,useCMap:null}).then((function(e){if(e instanceof i.IdentityCMap)return new s.IdentityToUnicodeMap(0,65535);var t=new Array(e.length);e.forEach((function(e,a){for(var r=[],i=0;i{if(e instanceof r.AbortException)return null;if(this.options.ignoreErrors){this.handler.send("UnsupportedFeature",{featureId:r.UNSUPPORTED_FEATURES.errorFontToUnicode});(0,r.warn)(`readToUnicode - ignoring ToUnicode data: "${e}".`);return null}throw e}):Promise.resolve(null)},readCidToGidMap(e,t){for(var a=[],r=0,i=e.length;r>1;(0!==n||t.has(i))&&(a[i]=n)}return a},extractWidths:function(e,t,a){var r,i,o,c,l,h,u,d,f=this.xref,g=[],m=0,p=[];if(a.composite){m=e.has("DW")?e.get("DW"):1e3;if(d=e.get("W"))for(i=0,o=d.length;i{if(e){const a=[];let r=f;for(let t=0,i=e.length;tthis.extractDataStructures(o,a,t)).then(e=>{this.extractWidths(o,l,e);"Type3"===u&&(e.isType3Font=!0);return new s.Font(v.name,x,e)})}};t.buildFontPaths=function(e,t,a){function r(t){e.renderer.hasBuiltPath(t)||a.send("commonobj",[`${e.loadedName}_path_${t}`,"FontPath",e.renderer.getPathJs(t)])}for(const e of t){r(e.fontChar);const t=e.accent;t&&t.fontChar&&r(t.fontChar)}};t.getFallbackFontDict=function(){if(this._fallbackFontDict)return this._fallbackFontDict;const e=new n.Dict;e.set("BaseFont",n.Name.get("PDFJS-FallbackFont"));e.set("Type",n.Name.get("FallbackType"));e.set("Subtype",n.Name.get("FallbackType"));e.set("Encoding",n.Name.get("WinAnsiEncoding"));return this._fallbackFontDict=e};return t}();t.PartialEvaluator=C;class x{constructor({loadedName:e,font:t,dict:a,extraProperties:r=!1}){this.loadedName=e;this.font=t;this.dict=a;this._extraProperties=r;this.type3Loaded=null;this.sent=!1}send(e){if(!this.sent){this.sent=!0;e.send("commonobj",[this.loadedName,"Font",this.font.exportData(this._extraProperties)])}}fallback(e){if(!this.font.data)return;this.font.disableFontFace=!0;const t=this.font.glyphCacheValues;C.buildFontPaths(this.font,t,e)}loadType3Data(e,t,a,i){if(!this.font.isType3Font)throw new Error("Must be a Type3 font.");if(this.type3Loaded)return this.type3Loaded;var n=Object.create(e.options);n.ignoreErrors=!1;var s=e.clone(n);s.parsingType3Font=!0;for(var o=this.font,c=Promise.resolve(),l=this.dict.get("CharProcs"),h=this.dict.get("Resources")||t,u=l.getKeys(),d=Object.create(null),f=0,g=u.length;fc&&(0,r.info)(`Command ${i}: expected [0, ${c}] args, but received ${l} args.`);else{if(l!==c){for(var h=this.nonProcessedArgs;l>c;){h.push(t.shift());l--}for(;l=r.OPS.moveTo&&o<=r.OPS.endPath&&++this._numInvalidPathOPS>20)throw new r.FormatError("Invalid "+e);(0,r.warn)("Skipping "+e);null!==t&&(t.length=0);continue}}this.preprocessCommand(o,t);e.fn=o;e.args=t;return!0}if(a===n.EOF)return!1;if(null!==a){null===t&&(t=[]);t.push(a);if(t.length>33)throw new r.FormatError("Too many arguments")}}},preprocessCommand:function(e,t){switch(0|e){case r.OPS.save:this.stateManager.save();break;case r.OPS.restore:this.stateManager.restore();break;case r.OPS.transform:this.stateManager.transform(t)}}};return t}()},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CMapFactory=t.IdentityCMap=t.CMap=void 0;var r=a(2),i=a(5),n=a(11),s=a(8),o=a(12),c=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"];class l{constructor(e=!1){this.codespaceRanges=[[],[],[],[]];this.numCodespaceRanges=0;this._map=[];this.name="";this.vertical=!1;this.useCMap=null;this.builtInCMap=e}addCodespaceRange(e,t,a){this.codespaceRanges[e-1].push(t,a);this.numCodespaceRanges++}mapCidRange(e,t,a){if(t-e>2**24-1)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;e<=t;)this._map[e++]=a++}mapBfRange(e,t,a){if(t-e>2**24-1)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");for(var r=a.length-1;e<=t;){this._map[e++]=a;a=a.substring(0,r)+String.fromCharCode(a.charCodeAt(r)+1)}}mapBfRangeToArray(e,t,a){if(t-e>2**24-1)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const r=a.length;let i=0;for(;e<=t&&i>>0;const s=i[n];for(let e=0,t=s.length;e=t&&r<=i){a.charcode=r;a.length=n+1;return}}}a.charcode=0;a.length=1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let e=0;e<65536;e++)if(this._map[e]!==e)return!1;return!0}}t.CMap=l;class h extends l{constructor(e,t){super();this.vertical=e;this.addCodespaceRange(t,0,65535)}mapCidRange(e,t,a){(0,r.unreachable)("should not call mapCidRange")}mapBfRange(e,t,a){(0,r.unreachable)("should not call mapBfRange")}mapBfRangeToArray(e,t,a){(0,r.unreachable)("should not call mapBfRangeToArray")}mapOne(e,t){(0,r.unreachable)("should not call mapCidOne")}lookup(e){return Number.isInteger(e)&&e<=65535?e:void 0}contains(e){return Number.isInteger(e)&&e<=65535}forEach(e){for(let t=0;t<=65535;t++)e(t,t)}charCodeOf(e){return Number.isInteger(e)&&e<=65535?e:-1}getMap(){const e=new Array(65536);for(let t=0;t<=65535;t++)e[t]=t;return e}get length(){return 65536}get isIdentityCMap(){(0,r.unreachable)("should not access .isIdentityCMap")}}t.IdentityCMap=h;var u=function(){function e(e,t){for(var a=0,r=0;r<=t;r++)a=a<<8|e[r];return a>>>0}function t(e,t){return 1===t?String.fromCharCode(e[0],e[1]):3===t?String.fromCharCode(e[0],e[1],e[2],e[3]):String.fromCharCode.apply(null,e.subarray(0,t+1))}function a(e,t,a){for(var r=0,i=a;i>=0;i--){r+=e[i]+t[i];e[i]=255&r;r>>=8}}function i(e,t){for(var a=1,r=t;r>=0&&a>\';a.g+=\'0;r--){a+=e[r];e[r]=255&a;a>>=8}}function n(e){this.buffer=e;this.pos=0;this.end=e.length;this.tmpBuf=new Uint8Array(19)}n.prototype={readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]},readNumber(){var e,t=0;do{var a=this.readByte();if(a<0)throw new r.FormatError("unexpected EOF in bcmap");e=!(128&a);t=t<<7|127&a}while(!e);return t},readSigned(){var e=this.readNumber();return 1&e?~(e>>>1):e>>>1},readHex(e,t){e.set(this.buffer.subarray(this.pos,this.pos+t+1));this.pos+=t+1},readHexNumber(e,t){var a,i=this.tmpBuf,n=0;do{var s=this.readByte();if(s<0)throw new r.FormatError("unexpected EOF in bcmap");a=!(128&s);i[n++]=127&s}while(!a);for(var o=t,c=0,l=0;o>=0;){for(;l<8&&i.length>0;){c=i[--n]<>=8;l-=8}},readHexSigned(e,t){this.readHexNumber(e,t);for(var a=1&e[t]?255:0,r=0,i=0;i<=t;i++){r=(1&r)<<8|e[i];e[i]=r>>1^a}},readString(){for(var e=this.readNumber(),t="",a=0;a=0;){var w=f>>5;if(7!==w){var k=!!(16&f),S=15&f;if(S+1>16)throw new Error("processBinaryCMap: Invalid dataSize.");var C,x=h.readNumber();switch(w){case 0:h.readHex(m,S);h.readHexNumber(p,S);a(p,m,S);s.addCodespaceRange(S+1,e(m,S),e(p,S));for(C=1;C>>0}function t(e){if(!(0,r.isString)(e))throw new r.FormatError("Malformed CMap: expected string.")}function a(e){if(!Number.isInteger(e))throw new r.FormatError("Malformed CMap: expected int.")}function d(a,r){for(;;){var n=r.getObj();if((0,i.isEOF)(n))break;if((0,i.isCmd)(n,"endbfchar"))return;t(n);var s=e(n);t(n=r.getObj());var o=n;a.mapOne(s,o)}}function f(a,n){for(;;){var s=n.getObj();if((0,i.isEOF)(s))break;if((0,i.isCmd)(s,"endbfrange"))return;t(s);var o=e(s);t(s=n.getObj());var c=e(s);s=n.getObj();if(Number.isInteger(s)||(0,r.isString)(s)){var l=Number.isInteger(s)?String.fromCharCode(s):s;a.mapBfRange(o,c,l)}else{if(!(0,i.isCmd)(s,"["))break;s=n.getObj();for(var h=[];!(0,i.isCmd)(s,"]")&&!(0,i.isEOF)(s);){h.push(s);s=n.getObj()}a.mapBfRangeToArray(o,c,h)}}throw new r.FormatError("Invalid bf range.")}function g(r,n){for(;;){var s=n.getObj();if((0,i.isEOF)(s))break;if((0,i.isCmd)(s,"endcidchar"))return;t(s);var o=e(s);a(s=n.getObj());var c=s;r.mapOne(o,c)}}function m(r,n){for(;;){var s=n.getObj();if((0,i.isEOF)(s))break;if((0,i.isCmd)(s,"endcidrange"))return;t(s);var o=e(s);t(s=n.getObj());var c=e(s);a(s=n.getObj());var l=s;r.mapCidRange(o,c,l)}}function p(t,a){for(;;){var n=a.getObj();if((0,i.isEOF)(n))break;if((0,i.isCmd)(n,"endcodespacerange"))return;if(!(0,r.isString)(n))break;var s=e(n);n=a.getObj();if(!(0,r.isString)(n))break;var o=e(n);t.addCodespaceRange(n.length,s,o)}throw new r.FormatError("Invalid codespace range.")}function b(e,t){var a=t.getObj();Number.isInteger(a)&&(e.vertical=!!a)}function y(e,t){var a=t.getObj();(0,i.isName)(a)&&(0,r.isString)(a.name)&&(e.name=a.name)}function v(e,t,a,n){var o,c;e:for(;;)try{var l=t.getObj();if((0,i.isEOF)(l))break;if((0,i.isName)(l)){"WMode"===l.name?b(e,t):"CMapName"===l.name&&y(e,t);o=l}else if((0,i.isCmd)(l))switch(l.cmd){case"endcmap":break e;case"usecmap":(0,i.isName)(o)&&(c=o.name);break;case"begincodespacerange":p(e,t);break;case"beginbfchar":d(e,t);break;case"begincidchar":g(e,t);break;case"beginbfrange":f(e,t);break;case"begincidrange":m(e,t)}}catch(e){if(e instanceof s.MissingDataException)throw e;(0,r.warn)("Invalid cMap data: "+e);continue}!n&&c&&(n=c);return n?w(e,a,n):Promise.resolve(e)}function w(e,t,a){return k(a,t).then((function(t){e.useCMap=t;if(0===e.numCodespaceRanges){for(var a=e.useCMap.codespaceRanges,r=0;r=this.firstChar&&e<=this.lastChar?e:-1},amend(e){(0,r.unreachable)("Should not call amend()")}};return e}();t.IdentityToUnicodeMap=x;var A=function(){function e(e,t,a){e[t]=a>>8&255;e[t+1]=255&a}function t(e,t,a){e[t]=a>>24&255;e[t+1]=a>>16&255;e[t+2]=a>>8&255;e[t+3]=255&a}function a(e,t,a){var r,i;if(a instanceof Uint8Array)e.set(a,t);else if("string"==typeof a)for(r=0,i=a.length;ra;){a<<=1;r++}var i=a*t;return{range:i,entry:r,rangeShift:t*e-i}};i.prototype={toArray:function(){var n=this.sfnt,s=this.tables,o=Object.keys(s);o.sort();var c,h,u,d,f,g=o.length,m=12+16*g,p=[m];for(c=0;c>>0;p.push(m)}var b=new Uint8Array(m);for(c=0;c>>0}t(b,m+4,v);t(b,m+8,p[c]);t(b,m+12,s[f].length);m+=16}return b},addTable:function(e,t){if(e in this.tables)throw new Error("Table "+e+" already exists");this.tables[e]=t}};return i}(),I=function(){function e(e,t,a){var i;this.name=e;this.loadedName=a.loadedName;this.isType3Font=a.isType3Font;this.missingFile=!1;this.glyphCache=Object.create(null);this.isSerifFont=!!(a.flags&b.Serif);this.isSymbolicFont=!!(a.flags&b.Symbolic);this.isMonospace=!!(a.flags&b.FixedPitch);var n=a.type,s=a.subtype;this.type=n;this.subtype=s;let o="sans-serif";this.isMonospace?o="monospace":this.isSerifFont&&(o="serif");this.fallbackName=o;this.differences=a.differences;this.widths=a.widths;this.defaultWidth=a.defaultWidth;this.composite=a.composite;this.cMap=a.cMap;this.ascent=a.ascent/1e3;this.descent=a.descent/1e3;this.fontMatrix=a.fontMatrix;this.bbox=a.bbox;this.defaultEncoding=a.defaultEncoding;this.toUnicode=a.toUnicode;this.fallbackToUnicode=a.fallbackToUnicode||new C;this.toFontChar=[];if("Type3"!==a.type){this.cidEncoding=a.cidEncoding;this.vertical=!!a.vertical;if(this.vertical){this.vmetrics=a.vmetrics;this.defaultVMetrics=a.defaultVMetrics}if(t&&!t.isEmpty){[n,s]=function(e,{type:t,subtype:a,composite:i}){let n,s;if(function(e){var t=e.peekBytes(4);return 65536===(0,l.readUint32)(t,0)||"true"===(0,r.bytesToString)(t)}(e)||T(e))n=i?"CIDFontType2":"TrueType";else if(function(e){var t=e.peekBytes(4);return"OTTO"===(0,r.bytesToString)(t)}(e))n=i?"CIDFontType2":"OpenType";else if(function(e){var t=e.peekBytes(2);if(37===t[0]&&33===t[1])return!0;if(128===t[0]&&1===t[1])return!0;return!1}(e))n=i?"CIDFontType0":"MMType1"===t?"MMType1":"Type1";else if(function(e){const t=e.peekBytes(4);if(t[0]>=1&&t[3]>=1&&t[3]<=4)return!0;return!1}(e))if(i){n="CIDFontType0";s="CIDFontType0C"}else{n="MMType1"===t?"MMType1":"Type1";s="Type1C"}else{(0,r.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");n=t;s=a}return[n,s]}(t,a);n===this.type&&s===this.subtype||(0,r.info)(`Inconsistent font file Type/SubType, expected: ${this.type}/${this.subtype} but found: ${n}/${s}.`);try{var c;switch(n){case"MMType1":(0,r.info)("MMType1 font ("+e+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";var h="Type1C"===s||"CIDFontType0C"===s?new O(t,a):new E(e,t,a);v(a);c=this.convert(e,h,a);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype";c=this.checkAndRepair(e,t,a);if(this.isOpenType){v(a);n="OpenType"}break;default:throw new r.FormatError(`Font ${n} is not supported`)}}catch(e){(0,r.warn)(e);this.fallbackToSystemFont();return}this.data=c;this.fontType=w(n,s);this.fontMatrix=a.fontMatrix;this.widths=a.widths;this.defaultWidth=a.defaultWidth;this.toUnicode=a.toUnicode;this.seacMap=a.seacMap}else{t&&(0,r.warn)(\\\'Font file is empty in "\\\'+e+\\\'" (\\\'+this.loadedName+")");this.fallbackToSystemFont()}}else{for(i=0;i<256;i++)this.toFontChar[i]=this.differences[i]||a.defaultEncoding[i];this.fontType=r.FontType.TYPE3}}e.getFontID=(t=1,function(){return String(t++)});var t;function a(e,t){return(e<<8)+t}function f(e,t){var a=(e<<8)+t;return 32768&a?a-65536:a}function I(e){return String.fromCharCode(e>>8&255,255&e)}function F(e){e>32767?e=32767:e<-32768&&(e=-32768);return String.fromCharCode(e>>8&255,255&e)}function T(e){const t=e.peekBytes(4);return"ttcf"===(0,r.bytesToString)(t)}function P(e,t,a){for(var r,i=[],n=0,s=e.length;nc){if(++s>=g.length){(0,r.warn)("Ran out of space in font private use area.");break}o=g[s][0];c=g[s][1]}var u=o++;0===h&&(h=a);i[u]=h;n[l]=u}}return{toFontChar:n,charCodeToGlyphId:i,nextAvailableFontCharCode:o}}function M(e,t){var a,i,n,s,o=function(e,t){var a=[];for(var r in e)e[r]>=t||a.push({fontCharCode:0|r,glyphId:e[r]});0===a.length&&a.push({fontCharCode:0,glyphId:0});a.sort((function(e,t){return e.fontCharCode-t.fontCharCode}));for(var i=[],n=a.length,s=0;s65535?2:1,l="\\\\0\\\\0"+I(c)+"\\\\0\\x03\\\\0\\x01"+(0,r.string32)(4+8*c);for(a=o.length-1;a>=0&&!(o[a][0]<=65535);--a);var h=a+1;o[a][0]<65535&&65535===o[a][1]&&(o[a][1]=65534);var u,d,f,g,m=o[a][1]<65535?1:0,p=h+m,b=A.getSearchParams(p,2),y="",v="",w="",k="",S="",C=0;for(a=0,i=h;a0){v+="\\xFF\\xFF";y+="\\xFF\\xFF";w+="\\\\0\\x01";k+="\\\\0\\\\0"}var T="\\\\0\\\\0"+I(2*p)+I(b.range)+I(b.entry)+I(b.rangeShift)+v+"\\\\0\\\\0"+y+w+k+S,E="",O="";if(c>1){l+="\\\\0\\x03\\\\0\\\\n"+(0,r.string32)(4+8*c+4+T.length);E="";for(a=0,i=o.length;a(u|=0)||!l)&&(l=u);h 123 are reserved for internal usage");o|=1<65535&&(h=65535)}else{l=0;h=255}var f=e.bbox||[0,0,0,0],g=a.unitsPerEm||1/(e.fontMatrix||r.FONT_IDENTITY_MATRIX)[0],m=e.ascentScaled?1:g/1e3,p=a.ascent||Math.round(m*(e.ascent||f[3])),b=a.descent||Math.round(m*(e.descent||f[1]));b>0&&e.descent>0&&f[1]<0&&(b=-b);var y=a.yMax||p,v=-a.yMin||-b;return"\\\\0\\x03\\x02$\\x01\\xF4\\\\0\\x05\\\\0\\\\0\\x02\\x8A\\x02\\xBB\\\\0\\\\0\\\\0\\x8C\\x02\\x8A\\x02\\xBB\\\\0\\\\0\\x01\\xDF\\\\x001\\x01\\x02\\\\0\\\\0\\\\0\\\\0\\x06"+String.fromCharCode(e.fixedPitch?9:0)+"\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0"+(0,r.string32)(i)+(0,r.string32)(n)+(0,r.string32)(s)+(0,r.string32)(o)+"*21*"+I(e.italicAngle?1:0)+I(l||e.firstChar)+I(h||e.lastChar)+I(p)+I(b)+"\\\\0d"+I(y)+I(v)+"\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0"+I(e.xHeight)+I(e.capHeight)+I(0)+I(l||e.firstChar)+"\\\\0\\x03"}function N(e){var t=Math.floor(65536*e.italicAngle);return"\\\\0\\x03\\\\0\\\\0"+(0,r.string32)(t)+"\\\\0\\\\0\\\\0\\\\0"+(0,r.string32)(e.fixedPitch)+"\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0"}function L(e,t){t||(t=[[],[]]);var a,r,i,n,s,o=[t[0][0]||"Original licence",t[0][1]||e,t[0][2]||"Unknown",t[0][3]||"uniqueID",t[0][4]||e,t[0][5]||"Version 0.11",t[0][6]||"",t[0][7]||"Unknown",t[0][8]||"Unknown",t[0][9]||"Unknown"],c=[];for(a=0,r=o.length;a0;if(u&&"CIDFontType2"===t&&this.cidEncoding.startsWith("Identity-")){const t=(0,o.getGlyphMapForStandardFonts)(),a=[];for(const e in t)a[+e]=t[e];if(/Arial-?Black/i.test(e)){var d=(0,o.getSupplementalGlyphMapForArialBlack)();for(const e in d)a[+e]=d[e]}else if(/Calibri/i.test(e)){const e=(0,o.getSupplementalGlyphMapForCalibri)();for(const t in e)a[+t]=e[t]}this.toUnicode instanceof x||this.toUnicode.forEach((function(e,t){a[+e]=t}));this.toFontChar=a;this.toUnicode=new C(a)}else if(/Symbol/i.test(i))this.toFontChar=P(s.SymbolSetEncoding,(0,n.getGlyphsUnicode)(),this.differences);else if(/Dingbats/i.test(i)){/Wingdings/i.test(e)&&(0,r.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");this.toFontChar=P(s.ZapfDingbatsEncoding,(0,n.getDingbatsGlyphsUnicode)(),this.differences)}else if(u)this.toFontChar=P(this.defaultEncoding,(0,n.getGlyphsUnicode)(),this.differences);else{const t=(0,n.getGlyphsUnicode)(),a=[];this.toUnicode.forEach((e,r)=>{if(!this.composite){var i=this.differences[e]||this.defaultEncoding[e];const a=(0,c.getUnicodeForGlyph)(i,t);-1!==a&&(r=a)}a[+e]=r});if(this.composite&&this.toUnicode instanceof x&&/Verdana/i.test(e)){const e=(0,o.getGlyphMapForStandardFonts)();for(const t in e)a[+t]=e[t]}this.toFontChar=a}this.loadedName=i.split("-")[0];this.fontType=w(t,a)},checkAndRepair:function(e,t,o){const c=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function l(e,t){const a=Object.create(null);a["OS/2"]=null;a.cmap=null;a.head=null;a.hhea=null;a.hmtx=null;a.maxp=null;a.name=null;a.post=null;for(let r=0;r>>0,i=e.getInt32()>>>0,n=e.getInt32()>>>0,s=e.pos;e.pos=e.start?e.start:0;e.skip(i);var o=e.getBytes(n);e.pos=s;if("head"===t){o[8]=o[9]=o[10]=o[11]=0;o[17]|=32}return{tag:t,checksum:a,length:n,offset:i,data:o}}function g(e){return{version:(0,r.bytesToString)(e.getBytes(4)),numTables:e.getUint16(),searchRange:e.getUint16(),entrySelector:e.getUint16(),rangeShift:e.getUint16()}}function m(e,t,a,r,i,n){var s={length:0,sizeOfInstructions:0};if(a-t<=12)return s;var o=e.subarray(t,a),c=f(o[0],o[1]);if(c<0){!function(e,t,a){e[t+1]=a;e[t]=a>>>8}(o,0,c=-1);r.set(o,i);s.length=o.length;return s}var l,h=10,u=0;for(l=0;lo.length)return s;if(!n&&g>0){r.set(o.subarray(0,d),i);r.set([0,0],i+d);r.set(o.subarray(m,v),i+d+2);v-=g;o.length-v>3&&(v=v+3&-4);s.length=v;return s}if(o.length-v>3){v=v+3&-4;r.set(o.subarray(0,v),i);s.length=v;return s}r.set(o,i);s.length=o.length;return s}function p(e){var a=(t.start?t.start:0)+e.offset;t.pos=a;var i=[[],[]],n=e.length,s=a+n;if(0!==t.getUint16()||n<6)return i;var o,c,l=t.getUint16(),h=t.getUint16(),u=[];for(o=0;os)){t.pos=g;var m=f.name;if(f.encoding){for(var p="",b=0,y=f.length;b0&&(l+=S-1)}}else{if(p||v){(0,r.warn)("TT: nested FDEFs not allowed");m=!0}p=!0;u=l;s=d.pop();t.functionsDefined[s]={data:c,i:l}}else if(!p&&!v){s=d[d.length-1];if(isNaN(s))(0,r.info)("TT: CALL empty stack (or invalid entry).");else{t.functionsUsed[s]=!0;if(s in t.functionsStackDeltas){const e=d.length+t.functionsStackDeltas[s];if(e<0){(0,r.warn)("TT: CALL invalid functions stack delta.");t.hintsValid=!1;return}d.length=e}else if(s in t.functionsDefined&&!g.includes(s)){f.push({data:c,i:l,stackTop:d.length-1});g.push(s);if(!(o=t.functionsDefined[s])){(0,r.warn)("TT: CALL non-existent function");t.hintsValid=!1;return}c=o.data;l=o.i}}}if(!p&&!v){let e=0;k<=142?e=b[k]:k>=192&&k<=223?e=-1:k>=224&&(e=-2);if(k>=113&&k<=117){i=d.pop();isNaN(i)||(e=2*-i)}for(;e<0&&d.length>0;){d.pop();e++}for(;e>0;){d.push(NaN);e--}}}t.tooComplexToFollowFunctions=m;var C=[c];l>c.length&&C.push(new Uint8Array(l-c.length));if(u>h){(0,r.warn)("TT: complementing a missing function tail");C.push(new Uint8Array([34,45]))}!function(e,t){if(t.length>1){var a,r,i=0;for(a=0,r=t.length;a>>0,s=[];for(let t=0;t>>0);const o={ttcTag:t,majorVersion:a,minorVersion:i,numFonts:n,offsetTable:s};switch(a){case 1:return o;case 2:o.dsigTag=e.getInt32()>>>0;o.dsigLength=e.getInt32()>>>0;o.dsigOffset=e.getInt32()>>>0;return o}throw new r.FormatError(`Invalid TrueType Collection majorVersion: ${a}.`)}(e);for(let n=0;n0||!(o.cMap instanceof u.IdentityCMap));if("OTTO"===S.version&&!t||!C.head||!C.hhea||!C.maxp||!C.post){I=new d.Stream(C["CFF "].data);x=new O(I,o);v(o);return this.convert(e,x,o)}delete C.glyf;delete C.loca;delete C.fpgm;delete C.prep;delete C["cvt "];this.isOpenType=!0}if(!C.maxp)throw new r.FormatError(\\\'Required "maxp" table is not found\\\');t.pos=(t.start||0)+C.maxp.offset;var E=t.getInt32();const P=t.getUint16();let R=P+1,U=!0;if(R>65535){U=!1;R=P;(0,r.warn)("Not enough space in glyfs to duplicate first glyph.")}var q=0,_=0;if(E>=65536&&C.maxp.length>=22){t.pos+=8;if(t.getUint16()>2){C.maxp.data[14]=0;C.maxp.data[15]=2}t.pos+=4;q=t.getUint16();t.pos+=4;_=t.getUint16()}C.maxp.data[4]=R>>8;C.maxp.data[5]=255&R;var j=function(e,t,a,i){var n={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};e&&w(e,n);t&&w(t,n);e&&function(e,t){if(!e.tooComplexToFollowFunctions)if(e.functionsDefined.length>t){(0,r.warn)("TT: more functions defined than expected");e.hintsValid=!1}else for(var a=0,i=e.functionsUsed.length;at){(0,r.warn)("TT: invalid function id: "+a);e.hintsValid=!1;return}if(e.functionsUsed[a]&&!e.functionsDefined[a]){(0,r.warn)("TT: undefined function: "+a);e.hintsValid=!1;return}}}(n,i);if(a&&1&a.length){var s=new Uint8Array(a.length+1);s.set(a.data);a.data=s}return n.hintsValid}(C.fpgm,C.prep,C["cvt "],q);if(!j){delete C.fpgm;delete C.prep;delete C["cvt "]}!function(e,t,a,i,n){if(t){e.pos=(e.start?e.start:0)+t.offset;e.pos+=4;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=8;e.pos+=2;var s=e.getUint16();if(s>i){(0,r.info)("The numOfMetrics ("+s+") should not be greater than the numGlyphs ("+i+")");s=i;t.data[34]=(65280&s)>>8;t.data[35]=255&s}var o=i-s-(a.length-4*s>>1);if(o>0){var c=new Uint8Array(a.length+2*o);c.set(a.data);if(n){c[a.length]=a.data[2];c[a.length+1]=a.data[3]}a.data=c}}else a&&(a.data=null)}(t,C.hhea,C.hmtx,R,U);if(!C.head)throw new r.FormatError(\\\'Required "head" table is not found\\\');!function(e,t,i){var n,s,o,c,l=e.data,h=(n=l[0],s=l[1],o=l[2],c=l[3],(n<<24)+(s<<16)+(o<<8)+c);if(h>>16!=1){(0,r.info)("Attempting to fix invalid version in head table: "+h);l[0]=0;l[1]=1;l[2]=0;l[3]=0}var u=a(l[50],l[51]);if(u<0||u>1){(0,r.info)("Attempting to fix invalid indexToLocFormat in head table: "+u);var d=t+1;if(i===d<<1){l[50]=0;l[51]=0}else{if(i!==d<<2)throw new r.FormatError("Could not fix indexToLocFormat: "+u);l[50]=0;l[51]=1}}}(C.head,P,F?C.loca.length:0);var z=Object.create(null);if(F){var G=a(C.head.data[50],C.head.data[51]),H=function(e,t,a,r,i,n,s){var o,c,l;if(r){o=4;c=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};l=function(e,t,a){e[t]=a>>>24&255;e[t+1]=a>>16&255;e[t+2]=a>>8&255;e[t+3]=255&a}}else{o=2;c=function(e,t){return e[t]<<9|e[t+1]<<1};l=function(e,t,a){e[t]=a>>9&255;e[t+1]=a>>1&255}}var h=n?a+1:a,u=o*(1+h),d=new Uint8Array(u);d.set(e.data.subarray(0,u));e.data=d;var f,g,p=t.data,b=p.length,y=new Uint8Array(b),v=c(d,0),w=0,k=Object.create(null);l(d,0,w);for(f=0,g=o;fb&&(b+3&-4)===S&&(S=b);S>b&&(v=S);var C=m(p,v,S,y,w,i),x=C.length;0===x&&(k[f]=!0);C.sizeOfInstructions>s&&(s=C.sizeOfInstructions);l(d,g,w+=x);v=S}if(0===w){var A=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(f=0,g=o;fI+w)t.data=y.subarray(0,I+w);else{t.data=new Uint8Array(I+w);t.data.set(y.subarray(0,w))}t.data.set(y.subarray(0,I),w);l(e.data,d.length-o,w+I)}else t.data=y.subarray(0,w);return{missingGlyphs:k,maxSizeOfInstructions:s}}(C.loca,C.glyf,P,G,j,U,_);z=H.missingGlyphs;if(E>=65536&&C.maxp.length>=22){C.maxp.data[26]=H.maxSizeOfInstructions>>8;C.maxp.data[27]=255&H.maxSizeOfInstructions}}if(!C.hhea)throw new r.FormatError(\\\'Required "hhea" table is not found\\\');if(0===C.hhea.data[10]&&0===C.hhea.data[11]){C.hhea.data[10]=255;C.hhea.data[11]=255}var X={unitsPerEm:a(C.head.data[18],C.head.data[19]),yMax:a(C.head.data[42],C.head.data[43]),yMin:f(C.head.data[38],C.head.data[39]),ascent:a(C.hhea.data[4],C.hhea.data[5]),descent:f(C.hhea.data[6],C.hhea.data[7])};this.ascent=X.ascent/X.unitsPerEm;this.descent=X.descent/X.unitsPerEm;C.post&&function(e,a,i){var n=(t.start?t.start:0)+e.offset;t.pos=n;var s,o=n+e.length,c=t.getInt32();t.skip(28);var l,h=!0;switch(c){case 65536:s=y;break;case\';a.g+=\' 131072:var u=t.getUint16();if(u!==i){h=!1;break}var d=[];for(l=0;l=32768){h=!1;break}d.push(f)}if(!h)break;for(var g=[],m=[];t.pos65535)throw new r.FormatError("Max size of CID is 65,535");var a=-1;Y?a=t:void 0!==K[t]&&(a=K[t]);a>=0&&a>>0,g=!1;if(!o||o.platformId!==u||o.encodingId!==d){if(0===u&&0===d)g=!0;else if(1===u&&0===d)g=!0;else if(3!==u||1!==d||!i&&o){if(a&&3===u&&0===d){g=!0;l=!0}}else{g=!0;a||(l=!0)}g&&(o={platformId:u,encodingId:d,offset:f});if(l)break}}o&&(t.pos=s+o.offset);if(!o||-1===t.peekByte()){(0,r.warn)("Could not find a preferred cmap table.");return{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1}}var m=t.getUint16();t.skip(4);var p,b,y=!1,v=[];if(0===m){for(p=0;p<256;p++){var w=t.getByte();w&&v.push({charCode:p,glyphId:w})}y=!0}else if(4===m){var k=t.getUint16()>>1;t.skip(6);var S,C=[];for(S=0;S>1)-(k-S);n.offsetIndex=I;x=Math.max(x,I+n.end-n.start+1)}else n.offsetIndex=-1}var F=[];for(p=0;p0&&V(oe)&&(W[e]=oe)}}}}else if(0===$&&0===Z)for(let e=0;e=61440&&t<=61695&&(t&=255);W[t]=Q[e].glyphId}}0===W.length&&(W[0]=0);let ce=R-1;U||(ce=0);var le=B(W,V,ce);this.toFontChar=le.toFontChar;C.cmap={tag:"cmap",data:M(le.charCodeToGlyphId,R)};C["OS/2"]&&function(e,t){t.pos=(t.start||0)+e.offset;var a=t.getUint16();t.skip(60);var r=t.getUint16();if(a<4&&768&r)return!1;if(t.getUint16()>t.getUint16())return!1;t.skip(6);if(0===t.getUint16())return!1;e.data[8]=e.data[9]=0;return!0}(C["OS/2"],t)||(C["OS/2"]={tag:"OS/2",data:D(o,le.charCodeToGlyphId,X)});if(!F)try{I=new d.Stream(C["CFF "].data);x=new i.CFFParser(I,o,!0).parse();x.duplicateFirstGlyph();var he=new i.CFFCompiler(x);C["CFF "].data=he.compile()}catch(e){(0,r.warn)("Failed to compile font "+o.loadedName)}if(C.name){var ue=p(C.name);C.name.data=L(e,ue)}else C.name={tag:"name",data:L(this.name)};var de=new A(S.version);for(var fe in C)de.addTable(fe,C[fe].data);return de.toArray()},convert:function(e,t,a){a.fixedPitch=!1;a.builtInEncoding&&function(e,t){if(!e.hasIncludedToUnicodeMap&&!(e.hasEncoding||t===e.defaultEncoding||e.toUnicode instanceof x)){var a=[],r=(0,n.getGlyphsUnicode)();for(var i in t){var s=t[i],o=(0,c.getUnicodeForGlyph)(s,r);-1!==o&&(a[i]=String.fromCharCode(o))}e.toUnicode.amend(a)}}(a,a.builtInEncoding);let i=1;t instanceof O&&(i=t.numGlyphs-1);var o=t.getGlyphMapping(a),l=B(o,t.hasGlyphId.bind(t),i);this.toFontChar=l.toFontChar;var h=t.numGlyphs;function u(e,t){var a=null;for(var r in e)if(t===e[r]){a||(a=[]);a.push(0|r)}return a}function d(e,t){for(var a in e)if(t===e[a])return 0|a;l.charCodeToGlyphId[l.nextAvailableFontCharCode]=t;return l.nextAvailableFontCharCode++}var f=t.seacs;if(f&&f.length){var g=a.fontMatrix||r.FONT_IDENTITY_MATRIX,m=t.getCharset(),p=Object.create(null);for(var b in f){var y=f[b|=0],v=s.StandardEncoding[y[2]],w=s.StandardEncoding[y[3]],k=m.indexOf(v),S=m.indexOf(w);if(!(k<0||S<0)){var C={x:y[0]*g[0]+y[1]*g[2]+g[4],y:y[0]*g[1]+y[1]*g[3]+g[5]},T=u(o,b);if(T)for(let e=0,t=T.length;e=0?r:0}}else if(l)for(i in t)c[i]=t[i];else{o=s.StandardEncoding;for(i=0;i=0?r:0}}var h,u=e.differences;if(u)for(i in u){var d=u[i];if(-1===(r=a.indexOf(d))){h||(h=(0,n.getGlyphsUnicode)());var f=k(d,h);f!==d&&(r=a.indexOf(f))}c[i]=r>=0?r:0}return c}var E=function(){function e(e,t,a){for(var r,i=e.length,n=t.length,s=i-n,o=a,c=!1;o=n){o+=r;for(;o=0&&(n[s]=a)}return T(e,n,r)},hasGlyphId:function(e){return!(e<0||e>=this.numGlyphs)&&(0===e||this.charstrings[e-1].charstring.length>0)},getSeacs:function(e){var t,a,r=[];for(t=0,a=e.length;t0;y--)b[y]-=b[y-1];g.setByName(p,b)}}s.topDict.privateDict=g;var v=new i.CFFIndex;for(l=0,h=r.length;l=t)throw new r.FormatError("Invalid CFF header");if(0!==a){(0,r.info)("cff data is shifted");e=e.subarray(a);this.bytes=e}var i=e[0],n=e[1],s=e[2],o=e[3];return{obj:new l(i,n,s,o),endPos:s}},parseDict:function(e){var t=0;function a(){var a=e[t++];if(30===a)return function(){var a="";const r=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];var i=e.length;for(;t>4,o=15&n;if(15===s)break;a+=r[s];if(15===o)break;a+=r[o]}return parseFloat(a)}();if(28===a)return a=((a=e[t++])<<24|e[t++]<<16)>>16;if(29===a)return a=(a=(a=(a=e[t++])<<8|e[t++])<<8|e[t++])<<8|e[t++];if(a>=32&&a<=246)return a-139;if(a>=247&&a<=250)return 256*(a-247)+e[t++]+108;if(a>=251&&a<=254)return-256*(a-251)-e[t++]-108;(0,r.warn)(\\\'CFFParser_parseDict: "\\\'+a+\\\'" is a reserved command.\\\');return NaN}var i=[],n=[];t=0;for(var s=e.length;t10)return!1;for(var o=a.stackSize,c=a.stack,l=i.length,h=0;h>16;h+=2;o++}else if(14===u){if(o>=4){o-=4;if(this.seacAnalysisEnabled){a.seac=c.slice(o,o+4);return!1}}d=e[u]}else if(u>=32&&u<=246){c[o]=u-139;o++}else if(u>=247&&u<=254){c[o]=u<251?(u-247<<8)+i[h]+108:-(u-251<<8)-i[h]-108;h++;o++}else if(255===u){c[o]=(i[h]<<24|i[h+1]<<16|i[h+2]<<8|i[h+3])/65536;h+=4;o++}else if(19===u||20===u){a.hints+=o>>1;h+=a.hints+7>>3;o%=2;d=e[u]}else{if(10===u||29===u){var g;if(!(g=10===u?n:s)){d=e[u];(0,r.warn)("Missing subrsIndex for "+d.id);return!1}var m=32768;g.count<1240?m=107:g.count<33900&&(m=1131);var p=c[--o]+m;if(p<0||p>=g.count||isNaN(p)){d=e[u];(0,r.warn)("Out of bounds subrIndex for "+d.id);return!1}a.stackSize=o;a.callDepth++;if(!this.parseCharString(a,g.get(p),n,s))return!1;a.callDepth--;o=a.stackSize;continue}if(11===u){a.stackSize=o;return!0}d=e[u]}if(d){if(d.stem){a.hints+=o>>1;if(3===u||23===u)a.hasVStems=!0;else if(a.hasVStems&&(1===u||18===u)){(0,r.warn)("CFF stem hints are in wrong order");i[h-1]=1===u?3:23}}if("min"in d&&!a.undefStack&&o=2&&d.stem?o%=2:o>1&&(0,r.warn)("Found too many parameters for stack-clearing command");o>0&&c[o-1]>=0&&(a.width=c[o-1])}if("stackDelta"in d){"stackFn"in d&&d.stackFn(c,o);o+=d.stackDelta}else if(d.stackClearing)o=0;else if(d.resetStack){o=0;a.undefStack=!1}else if(d.undefStack){o=0;a.undefStack=!0;a.firstStackClearing=!1}}}a.stackSize=o;return!0},parseCharStrings({charStrings:e,localSubrIndex:t,globalSubrIndex:a,fdSelect:i,fdArray:n,privateDict:s}){for(var o=[],c=[],l=e.count,h=0;h=n.length){(0,r.warn)("Invalid fd index for glyph index.");f=!1}f&&(g=(m=n[p].privateDict).subrsIndex)}else t&&(g=t);f&&(f=this.parseCharString(d,u,g,a));if(null!==d.width){const e=m.getByName("nominalWidthX");c[h]=e+d.width}else{const e=m.getByName("defaultWidthX");c[h]=e}null!==d.seac&&(o[h]=d.seac);f||e.set(h,new Uint8Array([14]))}return{charStrings:e,seacs:o,widths:c}},emptyPrivateDictionary:function(e){var t=this.createDict(g,[],e.strings);e.setByKey(18,[0,0]);e.privateDict=t},parsePrivateDict:function(e){if(e.hasName("Private")){var t=e.getByName("Private");if(Array.isArray(t)&&2===t.length){var a=t[0],r=t[1];if(0===a||r>=this.bytes.length)this.emptyPrivateDictionary(e);else{var i=r+a,n=this.bytes.subarray(r,i),s=this.parseDict(n),o=this.createDict(g,s,e.strings);e.privateDict=o;if(o.getByName("Subrs")){var c=o.getByName("Subrs"),l=r+c;if(0===c||l>=this.bytes.length)this.emptyPrivateDictionary(e);else{var h=this.parseIndex(l);o.subrsIndex=h.obj}}}}else e.removeByName("Private")}else this.emptyPrivateDictionary(e)},parseCharsets:function(e,t,a,n){if(0===e)return new p(!0,m.ISO_ADOBE,i.ISOAdobeCharset);if(1===e)return new p(!0,m.EXPERT,i.ExpertCharset);if(2===e)return new p(!0,m.EXPERT_SUBSET,i.ExpertSubsetCharset);var s=this.bytes,o=e,c=s[e++];const l=[n?0:".notdef"];var h,u,d;t-=1;switch(c){case 0:for(d=0;d=65535)(0,r.warn)("Not enough space in charstrings to duplicate first glyph.");else{var e=this.charStrings.get(0);this.charStrings.add(e);this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}},hasGlyphId:function(e){return!(e<0||e>=this.charStrings.count)&&this.charStrings.get(e).length>0}};return e}();t.CFF=c;var l=function(e,t,a,r){this.major=e;this.minor=t;this.hdrSize=a;this.offSize=r};t.CFFHeader=l;var h=function(){function e(){this.strings=[]}e.prototype={get:function(e){return e>=0&&e<=390?s[e]:e-391<=this.strings.length?this.strings[e-391]:s[0]},getSID:function(e){let t=s.indexOf(e);if(-1!==t)return t;t=this.strings.indexOf(e);return-1!==t?t+391:-1},add:function(e){this.strings.push(e)},get count(){return this.strings.length}};return e}();t.CFFStrings=h;var u=function(){function e(){this.objects=[];this.length=0}e.prototype={add:function(e){this.length+=e.length;this.objects.push(e)},set:function(e,t){this.length+=t.length-this.objects[e].length;this.objects[e]=t},get:function(e){return this.objects[e]},get count(){return this.objects.length}};return e}();t.CFFIndex=u;var d=function(){function e(e,t){this.keyToNameMap=e.keyToNameMap;this.nameToKeyMap=e.nameToKeyMap;this.defaults=e.defaults;this.types=e.types;this.opcodes=e.opcodes;this.order=e.order;this.strings=t;this.values=Object.create(null)}e.prototype={setByKey:function(e,t){if(!(e in this.keyToNameMap))return!1;var a=t.length;if(0===a)return!0;for(var i=0;i=this.fdSelect.length?-1:this.fdSelect[e]}};return e}();t.CFFFDSelect=y;var v=function(){function e(){this.offsets=Object.create(null)}e.prototype={isTracking:function(e){return e in this.offsets},track:function(e,t){if(e in this.offsets)throw new r.FormatError("Already tracking location of "+e);this.offsets[e]=t},offset:function(e){for(var t in this.offsets)this.offsets[t]+=e},setEntryLocation:function(e,t,a){if(!(e in this.offsets))throw new r.FormatError("Not tracking location of "+e);for(var i=a.data,n=this.offsets[e],s=0,o=t.length;s>24&255;i[h]=f>>16&255;i[u]=f>>8&255;i[d]=255&f}}};return e}(),w=function(){function e(e){this.cff=e}e.prototype={compile:function(){var e=this.cff,t={data:[],length:0,add:function(e){this.data=this.data.concat(e);this.length=this.data.length}},a=this.compileHeader(e.header);t.add(a);var i=this.compileNameIndex(e.names);t.add(i);if(e.isCIDFont&&e.topDict.hasName("FontMatrix")){var n=e.topDict.getByName("FontMatrix");e.topDict.removeByName("FontMatrix");for(var s=0,o=e.fdArray.length;s=-107&&e<=107?[e+139]:e>=108&&e<=1131?[247+((e-=108)>>8),255&e]:e>=-1131&&e<=-108?[251+((e=-e-108)>>8),255&e]:e>=-32768&&e<=32767?[28,e>>8&255,255&e]:[29,e>>24&255,e>>16&255,e>>8&255,255&e]},compileHeader:function(e){return[e.major,e.minor,e.hdrSize,e.offSize]},compileNameIndex:function(e){for(var t=new u,a=0,i=e.length;a"~"||"["===l||"]"===l||"("===l||")"===l||"{"===l||"}"===l||"<"===l||">"===l||"/"===l||"%"===l)&&(l="_");o[c]=l}""===(o=o.join(""))&&(o="Bad_Font_Name");t.add((0,r.stringToBytes)(o))}return this.compileIndex(t)},compileTopDicts:function(e,t,a){for(var r=[],i=new u,n=0,s=e.length;n>8&255,255&s]);else{n=new Uint8Array(1+2*s);n[0]=0;let t=0;const i=e.charset.length;let o=!1;for(let s=1;s>8&255;n[s+1]=255&c}}return this.compileTypedArray(n)},compileEncoding:function(e){return this.compileTypedArray(e.raw)},compileFDSelect:function(e){const t=e.format;let a,r;switch(t){case 0:a=new Uint8Array(1+e.fdSelect.length);a[0]=t;for(r=0;r>8&255,255&i,n];for(r=1;r>8&255,255&r,t);n=t}}const o=(s.length-3)/3;s[1]=o>>8&255;s[2]=255&o;s.push(r>>8&255,255&r);a=new Uint8Array(s)}return this.compileTypedArray(a)},compileTypedArray:function(e){for(var t=[],a=0,r=e.length;a>8&255,255&r],o=1;for(i=0;i>8&255,255&c):3===n?s.push(c>>16&255,c>>8&255,255&c):s.push(c>>>24&255,c>>16&255,c>>8&255,255&c);a[i]&&(c+=a[i].length)}for(i=0;i=65520&&e<=65535?0:e>=62976&&e<=63743?i()[e]||e:173===e?45:e};t.reverseIfRtl=function(e){var t,a,r=e.length;if(r<=1||!(t=e.charCodeAt(0),a=n[13],t>=a.begin&&t=(a=n[11]).begin&&t=0;s--)i+=e[s];return i};t.getUnicodeRangeFor=function(e){for(var t=0,a=n.length;t=r.begin&&e=5&&i<=7))return-1;r=e.substring(1)}if(r===r.toUpperCase()&&(a=parseInt(r,16))>=0)return a}return-1}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FontRendererFactory=void 0;var r=a(2),i=a(30),n=a(33),s=a(32),o=a(12),c=function(){function e(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function t(e,t){return e[t]<<8|e[t+1]}function a(e){const t=e.length;let a=32768;t<1240?a=107:t<33900&&(a=1131);return a}function c(a,i,n){var s,o,c,l=1===t(a,i+2)?e(a,i+8):e(a,i+16),h=t(a,i+l);if(4===h){t(a,i+l+2);var u=t(a,i+l+6)>>1;o=i+l+14;s=[];for(c=0;c>1;a=0&&e>16,h=0,u=0;c+=10;if(l<0)do{o=t[c]<<8|t[c+1];var d,f,g=t[c+2]<<8|t[c+3];c+=4;if(1&o){d=(t[c]<<24|t[c+1]<<16)>>16;f=(t[c+2]<<24|t[c+3]<<16)>>16;c+=4}else{d=t[c++];f=t[c++]}if(2&o){h=d;u=f}else{h=0;u=0}var m=1,p=1,b=0,y=0;if(8&o){m=p=(t[c]<<24|t[c+1]<<16)/1073741824;c+=2}else if(64&o){m=(t[c]<<24|t[c+1]<<16)/1073741824;p=(t[c+2]<<24|t[c+3]<<16)/1073741824;c+=4}else if(128&o){m=(t[c]<<24|t[c+1]<<16)/1073741824;b=(t[c+2]<<24|t[c+3]<<16)/1073741824;y=(t[c+4]<<24|t[c+5]<<16)/1073741824;p=(t[c+6]<<24|t[c+7]<<16)/1073741824;c+=8}var v=r.glyphs[g];if(v){a.push({cmd:"save"});a.push({cmd:"transform",args:[m,b,y,p,h,u]});e(v,a,r);a.push({cmd:"restore"})}}while(32&o);else{var w,k,S=[];for(w=0;w0;)x.push({flags:o})}for(w=0;w>16;c+=2;break;case 2:h-=t[c++];break;case 18:h+=t[c++]}x[w].x=h}for(w=0;w>16;c+=2;break;case 4:u-=t[c++];break;case 36:u+=t[c++]}x[w].y=u}var I=0;for(c=0;c>1;I=!0;break;case 4:g+=d.pop();c(f,g);I=!0;break;case 5:for(;d.length>0;){f+=d.shift();g+=d.shift();l(f,g)}break;case 6:for(;d.length>0;){l(f+=d.shift(),g);if(0===d.length)break;g+=d.shift();l(f,g)}break;case 7:for(;d.length>0;){g+=d.shift();l(f,g);if(0===d.length)break;l(f+=d.shift(),g)}break;case 8:for(;d.length>0;){y=f+d.shift();w=g+d.shift();v=y+d.shift();k=w+d.shift();f=v+d.shift();g=k+d.shift();u(y,w,v,k,f,g)}break;case 10:x=d.pop();A=null;if(n.isCFFCIDFont){const e=n.fdSelect.getFDIndex(o);if(e>=0&&eMath.abs(g-E)?f+=d.shift():g+=d.shift();u(y,w,v,k,f,g);break;default:throw new r.FormatError("unknown operator: 12 "+F)}break;case 14:if(d.length>=4){var O=d.pop(),P=d.pop();g=d.pop();f=d.pop();i.push({cmd:"save"});i.push({cmd:"translate",args:[f,g]});var B=h(n.cmap,String.fromCharCode(n.glyphNameMap[s.StandardEncoding[O]]));e(n.glyphs[B.glyphId],i,n,B.glyphId);i.push({cmd:"restore"});B=h(n.cmap,String.fromCharCode(n.glyphNameMap[s.StandardEncoding[P]]));e(n.glyphs[B.glyphId],i,n,B.glyphId)}return;case 18:m+=d.length>>1;I=!0;break;case 19:case 20:b+=(m+=d.length>>1)+7>>3;I=!0;break;case 21:g+=d.pop();c(f+=d.pop(),g);I=!0;break;case 22:c(f+=d.pop(),g);I=!0;break;case 23:m+=d.length>>1;I=!0;break;case 24:for(;d.length>2;){y=f+d.shift();w=g+d.shift();v=y+d.shift();k=w+d.shift();f=v+d.shift();g=k+d.shift();u(y,w,v,k,f,g)}f+=d.shift();g+=d.shift();l(f,g);break;case 25:for(;d.length>6;){f+=d.shift();g+=d.shift();l(f,g)}y=f+d.shift();w=g+d.shift();v=y+d.shift();k=w+d.shift();f=v+d.shift();g=k+d.shift();u(y,w,v,k,f,g);break;case 26:d.length%2&&(f+=d.shift());for(;d.length>0;){y=f;w=g+d.shift();v=y+d.shift();k=w+d.shift();f=v;g=k+d.shift();u(y,w,v,k,f,g)}break;case 27:d.length%2&&(g+=d.shift());for(;d.length>0;)u(y=f+d.shift(),w=g,v=y+d.shift(),k=w+d.shift(),f=v+d.shift(),g=k);break;case 28:d.push((p[b]<<24|p[b+1]<<16)>>16);b+=2;break;case 29:x=d.pop()+n.gsubrsBias;(A=n.gsubrs[x])&&t(A);break;case 30:for(;d.length>0;){y=f;w=g+d.shift();v=y+d.shift();k=w+d.shift();f=v+d.shift();g=k+(1===d.length?d.shift():0);u(y,w,v,k,f,g);if(0===d.length)break;y=f+d.shift();w=g;v=y+d.shift();k=w+d.shift();g=k+d.shift();u(y,w,v,k,f=v+(1===d.length?d.shift():0),g)}break;case 31:for(;d.length>0;){y=f+d.shift();w=g;v=y+d.shift();k=w+d.shift();g=k+d.shift();u(y,w,v,k,f=v+(1===d.length?d.shift():0),g);if(0===d.length)break;y=f;w=g+d.shift();v=y+d.shift();k=w+d.shift();f=v+d.shift();g=k+(1===d.length?d.shift():0);u(y,w,v,k,f,g)}break;default:if(F<32)throw new r.FormatError("unknown operator: "+F);if(F<247)d.push(F-139);else if(F<251)d.push(256*(F-247)+p[b++]+108);else if(F<255)d.push(256*-(F-251)-p[b++]-108);else{d.push((p[b]<<24|p[b+1]<<16|p[b+2]<<8|p[b+3])/65536);b+=4}}I&&(d.length=0)}}(t)}(e,t,this,i)}}return{create:function(a,i){for(var n,s,o,h,u,d,m=new Uint8Array(a.data),p=t(m,4),b=0,y=12;br)return!0;for(var i=r-e,n=i;n>8&255,255&s);else{s=65536*s|0;this.output.push(255,s>>24&255,s>>16&255,s>>8&255,255&s)}}this.output.push.apply(this.output,t);a?this.stack.splice(i,e):this.stack.length=0;return!1}};return d}(),c=function(){function e(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function t(e,t,a){if(a>=e.length)return new Uint8Array(0);var r,i,n=0|t;for(r=0;r>8;n=52845*(c+n)+22719&65535}return o}function a(e){return 47===e||91===e||93===e||123===e||125===e||40===e||41===e}function s(a,r,s){if(r){var o=a.getBytes(),c=!((e(o[0])||(0,i.isWhiteSpace)(o[0]))&&e(o[1])&&e(o[2])&&e(o[3])&&e(o[4])&&e(o[5])&&e(o[6])&&e(o[7]));a=new n.Stream(c?t(o,55665,4):function(t,a,r){var i,n,s=0|a,o=t.length,c=new Uint8Array(o>>>1);for(i=0,n=0;i>8;s=52845*(u+s)+22719&65535}}}return c.slice(r,n)}(o,55665,4))}this.seacAnalysisEnabled=!!s;this.stream=a;this.nextChar()}s.prototype={readNumberArray:function(){this.getToken();for(var e=[];;){var t=this.getToken();if(null===t||"]"===t||"}"===t)break;e.push(parseFloat(t||0))}return e},readNumber:function(){var e=this.getToken();return parseFloat(e||0)},readInt:function(){var e=this.getToken();return 0|parseInt(e||0,10)},readBoolean:function(){return"true"===this.getToken()?1:0},nextChar:function(){return this.currentChar=this.stream.getByte()},getToken:function(){for(var e=!1,t=this.currentChar;;){if(-1===t)return null;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!(0,i.isWhiteSpace)(t))break;t=this.nextChar()}if(a(t)){this.nextChar();return String.fromCharCode(t)}var r="";do{r+=String.fromCharCode(t);t=this.nextChar()}while(t>=0&&!(0,i.isWhiteSpace)(t)&&!a(t));return r},readCharStrings:function(e,a){return-1===a?e:t(e,4330,a)},extractFontProgram:function(e){var t=this.stream,a=[],r=[],i=Object.create(null);i.lenIV=4;for(var n,s,c,l,h,u={subrs:[],charstrings:[],properties:{privateData:i}};null!==(n=this.getToken());)if("/"===n)switch(n=this.getToken()){case"CharStrings":this.getToken();this.getToken();this.getToken();this.getToken();for(;null!==(n=this.getToken())&&"end"!==n;)if("/"===n){var d=this.getToken();s=this.readInt();this.getToken();c=s>0?t.getBytes(s):new Uint8Array(0);l=u.properties.privateData.lenIV;h=this.readCharStrings(c,l);this.nextChar();"noaccess"===(n=this.getToken())&&this.getToken();r.push({glyph:d,enco\';a.g+=\'ded:h})}break;case"Subrs":this.readInt();this.getToken();for(;"dup"===this.getToken();){const e=this.readInt();s=this.readInt();this.getToken();c=s>0?t.getBytes(s):new Uint8Array(0);l=u.properties.privateData.lenIV;h=this.readCharStrings(c,l);this.nextChar();"noaccess"===(n=this.getToken())&&this.getToken();a[e]=h}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":var f=this.readNumberArray();f.length>0&&f.length,0;break;case"StemSnapH":case"StemSnapV":u.properties.privateData[n]=this.readNumberArray();break;case"StdHW":case"StdVW":u.properties.privateData[n]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":case"ExpansionFactor":u.properties.privateData[n]=this.readNumber();break;case"ForceBold":u.properties.privateData[n]=this.readBoolean()}for(var g=0;g-1&&void 0===e.widths[t]&&t>=e.firstChar&&t<=e.lastChar&&(e.widths[t]=m.width)}}return u},extractFontHeader:function(e){for(var t;null!==(t=this.getToken());)if("/"===t)switch(t=this.getToken()){case"FontMatrix":var a=this.readNumberArray();e.fontMatrix=a;break;case"Encoding":var i,n=this.getToken();if(/^\\\\d+$/.test(n)){i=[];var s=0|parseInt(n,10);this.getToken();for(var o=0;o=u||I<=0)(0,r.info)("Bad shading domain.");else{var T,E=new Float32Array(o.numComps),O=new Float32Array(1);for(let e=0;e<=10;e++){O[0]=h+e*I;A(O,0,E,0);T=o.getRgb(E,0);var P=r.Util.makeCssRgb(T[0],T[1],T[2]);F.push([e/10,P])}var B="transparent";if(e.has("Background")){T=o.getRgb(e.get("Background"),0);B=r.Util.makeCssRgb(T[0],T[1],T[2])}if(!f){F.unshift([0,B]);F[1][0]+=g.SMALL_NUMBER}if(!m){F[F.length-1][0]-=g.SMALL_NUMBER;F.push([1,B])}this.colorStops=F}}e.prototype={getIR:function(){var e,t,a,i,n,s=this.coordsArr,l=this.shadingType;if(l===o){t=[s[0],s[1]];a=[s[2],s[3]];i=null;n=null;e="axial"}else if(l===c){t=[s[0],s[1]];a=[s[3],s[4]];i=s[2];n=s[5];e="radial"}else(0,r.unreachable)("getPattern type unknown: "+l);var h=this.matrix;if(h){t=r.Util.applyTransform(t,h);a=r.Util.applyTransform(a,h);if(l===c){var u=r.Util.singularValueDecompose2dScale(h);i*=u[0];n*=u[1]}}return["RadialAxial",e,this.bbox,this.colorStops,t,a,i,n]}};return e}();g.Mesh=function(){function e(e,t){this.stream=e;this.context=t;this.buffer=0;this.bufferLength=0;var a=t.numComps;this.tmpCompsBuf=new Float32Array(a);var r=t.colorSpace.numComps;this.tmpCsCompsBuf=t.colorFn?new Float32Array(r):this.tmpCompsBuf}e.prototype={get hasData(){if(this.stream.end)return this.stream.pos0)return!0;var e=this.stream.getByte();if(e<0)return!1;this.buffer=e;this.bufferLength=8;return!0},readBits:function(e){var t=this.buffer,a=this.bufferLength;if(32===e){if(0===a)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;t=t<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();var r=this.stream.getByte();this.buffer=r&(1<>a)>>>0}if(8===e&&0===a)return this.stream.getByte();for(;a>a},align:function(){this.buffer=0;this.bufferLength=0},readFlag:function(){return this.readBits(this.context.bitsPerFlag)},readCoordinate:function(){var e=this.context.bitsPerCoordinate,t=this.readBits(e),a=this.readBits(e),r=this.context.decode,i=e<32?1/((1<o?o:t;a=a>c?c:a;r=r=0&&"ET"===f[F];--F)f[F]="EN";for(F=p+1;F0&&(E=f[p-1]);var O=A;T+1P&&s(P)&&(M=P)}for(P=B;P>=M;--P){var D=-1;for(p=0,b=k.length;p=0){h(d,D,p);D=-1}}else D<0&&(D=p);D>=0&&h(d,D,k.length)}for(p=0,b=d.length;p"!==N||(d[p]="")}return u(d.join(""),g)};var r=a(2),i=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L"\';a.g+=\',"L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],n=["AN","AN","AN","AN","AN","AN","ON","ON","AL","ET","ET","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL"];function s(e){return 0!=(1&e)}function o(e){return 0==(1&e)}function c(e,t,a){for(var r=t,i=e.length;r>c)*h;l&=(1<a?e=a:e0&&(d=i[h-1]);var f=r[1];h>1,c=i.length>>1,u=new l(s),d=Object.create(null),f=8192,g=new Float32Array(c);return function(e,t,a,r){var i,s,l="",h=g;for(i=0;i(v=n[2*i+1]))&&(s=v);p[i]=s}if(f>0){f--;d[l]=p}a.set(p,r)}else a.set(m,r)}}};var c=function(){function e(e){this.stack=e?Array.prototype.slice.call(e,0):[]}e.prototype={push:function(e){if(this.stack.length>=100)throw new Error("PostScript function stack overflow.");this.stack.push(e)},pop:function(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()},copy:function(e){if(this.stack.length+e>=100)throw new Error("PostScript function stack overflow.");for(var t=this.stack,a=t.length-e,r=e-1;r>=0;r--,a++)t.push(t[a])},index:function(e){this.push(this.stack[this.stack.length-e-1])},roll:function(e,t){var a,r,i,n=this.stack,s=n.length-e,o=n.length-1,c=s+(t-Math.floor(t/e)*e);for(a=s,r=o;a0?n.push(a<>i);break;case"ceiling":a=n.pop();n.push(Math.ceil(a));break;case"copy":a=n.pop();n.copy(a);break;case"cos":a=n.pop();n.push(Math.cos(a));break;case"cvi":a=0|n.pop();n.push(a);break;case"cvr":break;case"div":i=n.pop();a=n.pop();n.push(a/i);break;case"dup":n.copy(1);break;case"eq":i=n.pop();a=n.pop();n.push(a===i);break;case"exch":n.roll(2,1);break;case"exp":i=n.pop();a=n.pop();n.push(a**i);break;case"false":n.push(!1);break;case"floor":a=n.pop();n.push(Math.floor(a));break;case"ge":i=n.pop();a=n.pop();n.push(a>=i);break;case"gt":i=n.pop();a=n.pop();n.push(a>i);break;case"idiv":i=n.pop();a=n.pop();n.push(a/i|0);break;case"index":a=n.pop();n.index(a);break;case"le":i=n.pop();a=n.pop();n.push(a<=i);break;case"ln":a=n.pop();n.push(Math.log(a));break;case"log":a=n.pop();n.push(Math.log(a)/Math.LN10);break;case"lt":i=n.pop();a=n.pop();n.push(a=t?new a(t):e.max<=t?e:new n(e,t)}function f(){}f.prototype={compile:function(e,r,i){var n,f,g,m,p,b,y,v,w=[],k=[],S=r.length>>1,C=i.length>>1,x=0;for(let e=0;ee.min){s.unshift("Math.max(",r,", ");s.push(")")}if(n=0&&(t>=65&&t<=90||t>=97&&t<=122);)a.push(String.fromCharCode(t));const r=a.join("");switch(r.toLowerCase()){case"if":return o.IF;case"ifelse":return o.IFELSE;default:return o.getOperator(r)}}getNumber(){let e=this.currentChar;const t=this.strBuf;t.length=0;t[0]=String.fromCharCode(e);for(;(e=this.nextChar())>=0&&(e>=48&&e<=57||45===e||46===e);)t.push(String.fromCharCode(e));const a=parseFloat(t.join(""));if(isNaN(a))throw new r.FormatError("Invalid floating point number: "+a);return a}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MurmurHash3_64=void 0;var r=a(2);t.MurmurHash3_64=class{constructor(e){this.h1=e?4294967295&e:3285377520;this.h2=e?4294967295&e:3285377520}update(e){let t,a;if((0,r.isString)(e)){t=new Uint8Array(2*e.length);a=0;for(let r=0,i=e.length;r>>8;t[a++]=255&i}}}else{if(!(0,r.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");t=e;a=t.byteLength}const i=a>>2,n=a-4*i,s=new Uint32Array(t.buffer,0,i);let o=0,c=0,l=this.h1,h=this.h2;const u=3432918353,d=461845907;for(let e=0;e>>17;o=o*d&4294901760|13715*o&65535;l^=o;l=l<<13|l>>>19;l=5*l+3864292196}else{c=s[e];c=c*u&4294901760|11601*c&65535;c=c<<15|c>>>17;c=c*d&4294901760|13715*c&65535;h^=c;h=h<<13|h>>>19;h=5*h+3864292196}o=0;switch(n){case 3:o^=t[4*i+2]<<16;case 2:o^=t[4*i+1]<<8;case 1:o^=t[4*i];o=o*u&4294901760|11601*o&65535;o=o<<15|o>>>17;o=o*d&4294901760|13715*o&65535;1&i?l^=o:h^=o}this.h1=l;this.h2=h}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&4294901760|36045*e&65535;t=4283543511*t&4294901760|(2950163797*(t<<16|e>>>16)&4294901760)>>>16;e^=t>>>1;e=444984403*e&4294901760|60499*e&65535;t=3301882366*t&4294901760|(3120437893*(t<<16|e>>>16)&4294901760)>>>16;e^=t>>>1;const a=(e>>>0).toString(16),r=(t>>>0).toString(16);return a.padStart(8,"0")+r.padStart(8,"0")}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFImage=void 0;var r=a(2),i=a(5),n=a(23),s=a(12),o=a(18),c=a(21),l=function(){function e(e,t,a,r){(e=t+e*a)<0?e=0:e>r&&(e=r);return e}function t(e,t,a,r,i,n){var s=i*n;let o;o=t<=8?new Uint8Array(s):t<=16?new Uint16Array(s):new Uint32Array(s);var c,l,h,u,d=a/i,f=r/n,g=0,m=new Uint16Array(i),p=a;for(c=0;c0&&Number.isInteger(s.height)&&s.height>0&&(s.width!==p||s.height!==b)){(0,r.warn)("PDFImage - using the Width/Height of the image data, rather than the image dictionary.");p=s.width;b=s.height}if(p<1||b<1)throw new r.FormatError(`Invalid image width: ${p} or height: ${b}`);this.width=p;this.height=b;this.interpolate=f.get("Interpolate","I")||!1;this.imageMask=f.get("ImageMask","IM")||!1;this.matte=f.get("Matte")||!1;var y=s.bitsPerComponent;if(!y&&!(y=f.get("BitsPerComponent","BPC"))){if(!this.imageMask)throw new r.FormatError("Bits per component missing in image: "+this.imageMask);y=1}this.bpc=y;if(!this.imageMask){var v=f.get("ColorSpace","CS");if(!v){(0,r.info)("JPX images (which do not require color spaces)");switch(s.numComps){case 1:v=i.Name.get("DeviceGray");break;case 3:v=i.Name.get("DeviceRGB");break;case 4:v=i.Name.get("DeviceCMYK");break;default:throw new Error(`JPX images with ${s.numComps} color components not supported.`)}}const a=o?t:null;this.colorSpace=n.ColorSpace.parse(v,e,a,d);this.numComps=this.colorSpace.numComps}this.decode=f.getArray("Decode","D");this.needsDecode=!1;if(this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,y)||u&&!n.ColorSpace.isDefaultDecode(this.decode,1))){this.needsDecode=!0;var w=(1<>3)*a,c=e.byteLength;if(!r||i&&!(o===c))if(i){(n=new Uint8ClampedArray(o)).set(e);for(s=c;s>7&1;o[d+1]=l>>6&1;o[d+2]=l>>5&1;o[d+3]=l>>4&1;o[d+4]=l>>3&1;o[d+5]=l>>2&1;o[d+6]=l>>1&1;o[d+7]=1&l;d+=8}if(d>=1}}}else{var b=0;l=0;for(d=0,c=n;d>y;a<0?a=0:a>u&&(a=u);o[d]=a;l&=(1<m[w+1]){b=255;break}}c[u]=b}}if(c)for(u=0,f=3,d=i*s;u>3;if(!e){var f;"DeviceGray"===this.colorSpace.name&&1===u?f=r.ImageKind.GRAYSCALE_1BPP:"DeviceRGB"!==this.colorSpace.name||8!==u||this.needsDecode||(f=r.ImageKind.RGB_24BPP);if(f&&!this.smask&&!this.mask&&a===l&&i===h){n.kind=f;t=this.getImageBytes(h*d);if(this.image instanceof s.DecodeStream)n.data=t;else{var g=new Uint8ClampedArray(t.length);g.set(t);n.data=g}if(this.needsDecode){(0,r.assert)(f===r.ImageKind.GRAYSCALE_1BPP,"PDFImage.createImageData: The image must be grayscale.");for(var m=n.data,p=0,b=m.length;p>3,l=this.getImageBytes(s*c),h=this.getComponents(l);if(1!==o){this.needsDecode&&this.decodeBuffer(h);i=n*s;var u=255/((1<{const t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream){this._processStreamMessage(t);return}if(t.callback){const e=t.callbackId,a=this.callbackCapabilities[e];if(!a)throw new Error("Cannot resolve callback "+e);delete this.callbackCapabilities[e];if(t.callback===i)a.resolve(t.data);else{if(t.callback!==n)throw new Error("Unexpected callback case");a.reject(g(t.reason))}return}const r=this.actionHandler[t.action];if(!r)throw new Error("Unknown action from worker: "+t.action);if(t.callbackId){const e=this.sourceName,s=t.sourceName;new Promise((function(e){e(r(t.data))})).then((function(r){a.postMessage({sourceName:e,targetName:s,callback:i,callbackId:t.callbackId,data:r})}),(function(r){a.postMessage({sourceName:e,targetName:s,callback:n,callbackId:t.callbackId,reason:g(r)})}))}else t.streamId?this._createStreamSink(t):r(t.data)};a.addEventListener("message",this._onComObjOnMessage)}on(e,t){const a=this.actionHandler;if(a[e])throw new Error(`There is already an actionName called "${e}"`);a[e]=t}send(e,t,a){this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},a)}sendWithPromise(e,t,a){const i=this.callbackId++,n=(0,r.createPromiseCapability)();this.callbackCapabilities[i]=n;try{this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},a)}catch(e){n.reject(e)}return n.promise}sendWithStream(e,t,a,i){const n=this.streamId++,o=this.sourceName,c=this.targetName,l=this.comObj;return new ReadableStream({start:a=>{const s=(0,r.createPromiseCapability)();this.streamControllers[n]={controller:a,startCall:s,pullCall:null,cancelCall:null,isClosed:!1};this._postMessage({sourceName:o,targetName:c,action:e,streamId:n,data:t,desiredSize:a.desiredSize},i);return s.promise},pull:e=>{const t=(0,r.createPromiseCapability)();this.streamControllers[n].pullCall=t;l.postMessage({sourceName:o,targetName:c,stream:u,streamId:n,desiredSize:e.desiredSize});return t.promise},cancel:e=>{(0,r.assert)(e instanceof Error,"cancel must have a valid reason");const t=(0,r.createPromiseCapability)();this.streamControllers[n].cancelCall=t;this.streamControllers[n].isClosed=!0;l.postMessage({sourceName:o,targetName:c,stream:s,streamId:n,reason:g(e)});return t.promise}},a)}_createStreamSink(e){const t=this,a=this.actionHandler[e.action],i=e.streamId,n=this.sourceName,s=e.sourceName,o=this.comObj,u={enqueue(e,a=1,o){if(this.isCancelled)return;const c=this.desiredSize;this.desiredSize-=a;if(c>0&&this.desiredSize<=0){this.sinkCapability=(0,r.createPromiseCapability)();this.ready=this.sinkCapability.promise}t._postMessage({sourceName:n,targetName:s,stream:l,streamId:i,chunk:e},o)},close(){if(!this.isCancelled){this.isCancelled=!0;o.postMessage({sourceName:n,targetName:s,stream:c,streamId:i});delete t.streamSinks[i]}},error(e){(0,r.assert)(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;o.postMessage({sourceName:n,targetName:s,stream:h,streamId:i,reason:g(e)})}},sinkCapability:(0,r.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};u.sinkCapability.resolve();u.ready=u.sinkCapability.promise;this.streamSinks[i]=u;new Promise((function(t){t(a(e.data,u))})).then((function(){o.postMessage({sourceName:n,targetName:s,stream:f,streamId:i,success:!0})}),(function(e){o.postMessage({sourceName:n,targetName:s,stream:f,streamId:i,reason:g(e)})}))}_processStreamMessage(e){const t=e.streamId,a=this.sourceName,i=e.sourceName,n=this.comObj;switch(e.stream){case f:e.success?this.streamControllers[t].startCall.resolve():this.streamControllers[t].startCall.reject(g(e.reason));break;case d:e.success?this.streamControllers[t].pullCall.resolve():this.streamControllers[t].pullCall.reject(g(e.reason));break;case u:if(!this.streamSinks[t]){n.postMessage({sourceName:a,targetName:i,stream:d,streamId:t,success:!0});break}this.streamSinks[t].desiredSize<=0&&e.desiredSize>0&&this.streamSinks[t].sinkCapability.resolve();this.streamSinks[t].desiredSize=e.desiredSize;const{onPull:m}=this.streamSinks[e.streamId];new Promise((function(e){e(m&&m())})).then((function(){n.postMessage({sourceName:a,targetName:i,stream:d,streamId:t,success:!0})}),(function(e){n.postMessage({sourceName:a,targetName:i,stream:d,streamId:t,reason:g(e)})}));break;case l:(0,r.assert)(this.streamControllers[t],"enqueue should have stream controller");if(this.streamControllers[t].isClosed)break;this.streamControllers[t].controller.enqueue(e.chunk);break;case c:(0,r.assert)(this.streamControllers[t],"close should have stream controller");if(this.streamControllers[t].isClosed)break;this.streamControllers[t].isClosed=!0;this.streamControllers[t].controller.close();this._deleteStreamController(t);break;case h:(0,r.assert)(this.streamControllers[t],"error should have stream controller");this.streamControllers[t].controller.error(g(e.reason));this._deleteStreamController(t);break;case o:e.success?this.streamControllers[t].cancelCall.resolve():this.streamControllers[t].cancelCall.reject(g(e.reason));this._deleteStreamController(t);break;case s:if(!this.streamSinks[t])break;const{onCancel:p}=this.streamSinks[e.streamId];new Promise((function(t){t(p&&p(g(e.reason)))})).then((function(){n.postMessage({sourceName:a,targetName:i,stream:o,streamId:t,success:!0})}),(function(e){n.postMessage({sourceName:a,targetName:i,stream:o,streamId:t,reason:g(e)})}));this.streamSinks[t].sinkCapability.reject(g(e.reason));this.streamSinks[t].isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(e){await Promise.allSettled([this.streamControllers[e].startCall,this.streamControllers[e].pullCall,this.streamControllers[e].cancelCall].map((function(e){return e&&e.promise})));delete this.streamControllers[e]}_postMessage(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFWorkerStream=void 0;var r=a(2);t.PDFWorkerStream=class{constructor(e){this._msgHandler=e;this._contentLength=null;this._fullRequestReader=null;this._rangeRequestReaders=[]}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once.");this._fullRequestReader=new i(this._msgHandler);return this._fullRequestReader}getRangeReader(e,t){const a=new n(e,t,this._msgHandler);this._rangeRequestReaders.push(a);return a}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeRequestReaders.slice(0).forEach((function(t){t.cancel(e)}))}};class i{constructor(e){this._msgHandler=e;this.onProgress=null;this._contentLength=null;this._isRangeSupported=!1;this._isStreamingSupported=!1;const t=this._msgHandler.sendWithStream("GetReader");this._reader=t.getReader();this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then(e=>{this._isStreamingSupported=e.isStreamingSupported;this._isRangeSupported=e.isRangeSupported;this._contentLength=e.contentLength})}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class n{constructor(e,t,a){this._msgHandler=a;this.onProgress=null;const r=this._msgHandler.sendWithStream("GetRangeReader",{begin:e,end:t});this._reader=r.getReader()}get isStreamingSupported(){return!1}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}}])}));\';return a.g};var ldc=Mgd(7265);zuc(6547,1,{},_vm);_.j=1;var Ujc=Mgd(6547);zuc(8389,$wnd.Function,{},awm);_.gj=function(a){return Tvm(this.g,a)};zuc(6548,1,{},bwm);_.handleEvent=function(a){Wvm(this.g,this.i.result)};var Tjc=Mgd(6548);zuc(8390,$wnd.Function,{},cwm);_.jj=function(a){return Uvm(this.g,a)};zuc(q9m,$wnd.Function,{},dwm);_.jj=function(a){return Vvm(this.g,a)};zuc(r9m,$wnd.Function,{},ewm);_.jj=function(a){var b;return Yvm(this.g,(b=this.i,a,b).toDataURL()),null};aZm(Qc)(13);\n//# sourceURL=web3d-13.js\n')