var e;(function(){var e;e=class extends this.OS.application.BaseApplication{constructor(e){super("Preview",e)}main(){return this.currfile=void 0,this.args&&this.args.length>0&&(this.currfile=this.args[0].path.asFileHandle()),this.view=this.find("view"),this.status=this.find("status"),this.zoom=this.find("zoom"),this.btnext=this.find("btnext"),this.btprev=this.find("btprev"),this.btreset=this.find("btreset"),this.txtpage=this.find("txtpage"),this.zoom.onvaluechange=e=>this.setViewScale(e.data),this.btreset.onbtclick=e=>(this.zoom.value=100,this.setViewScale(100)),this.btnext.onbtclick=e=>{var t;if(t=parseInt($(this.txtpage).val()),!isNaN(t))return $(this.txtpage).val(t+1),this.gotoPage()},this.btprev.onbtclick=e=>{var t;if(t=parseInt($(this.txtpage).val()),!isNaN(t))return $(this.txtpage).val(t-1),this.gotoPage()},$(this.txtpage).keyup(e=>{if(13===e.which&&this.pdf)return this.gotoPage()}),PDFJS.workerSrc=(this.path()+"/pdf.worker.js").asFileHandle().getlink(),this.pdf=void 0,this.img=void 0,this.bindKey("ALT-O",()=>this.actionFile(this.name+"-Open")),this.bindKey("CTRL-X",()=>this.actionFile(this.name+"-Close")),this.zoom.max=200,this.zoom.value=100,this.open(this.currfile)}open(e){if(e)return this.currfile!==e&&(this.currfile=e),e.onready().then(()=>(e.info.size=(e.info.size/1024).toFixed(2),this.renderFile())).catch(t=>this.error(__("File not found {0}",e.path),t))}gotoPage(){var e;if(this.pdf&&(e=parseInt($(this.txtpage).val()),!isNaN(e)&&!(e<=0||e>this.pdf.numPages)))return $(this.view).empty(),this.renderPDFPages(e,this.zoom.value/100,!1).catch(t=>this.error(__("Unable to render page {0}",e),t))}renderFile(){var e;if(e=this.currfile.info.mime)return this.pdf=void 0,this.img=void 0,$(this.view).empty(),this.zoom.value=100,e.match(/^[^\/]+\/.*pdf.*/g)?this.renderPDF():e.match(/image\/.*svg.*/g)?this.renderSVG():e.match(/image\/.*/g)?this.renderImage():this.notify(__("Mime type {0} is not supported",file.info.mime))}setStatus(e){return $(this.status).html(e)}setViewScale(e){var t,r,n,i,a,s;if(this.currfile){if(a=e/100,(i=this.currfile.info.mime).match(/^[^\/]+\/.*pdf.*/g)){if(!this.pdf)return;return $(this.view).empty(),this.load(this.renderPDFPages(1,a)).catch(e=>this.error(__("Unable to set view scale"),e))}if(i.match(/image\/.*svg.*/g))return $($(this.view).children()[0]).css("width",Math.round(e)+"%").css("height",Math.round(e)+"%");if(i.match(/image\/.*/g)){if(!this.img)return;return r=(t=$(this.view).children()[0]).getContext("2d"),s=this.img.width*a,n=this.img.height*a,t.height=n,t.width=s,r.clearRect(0,0,t.width,t.height),r.scale(a,a),r.drawImage(this.img,0,0)}}}renderPDFPages(e,t,r){return new Promise((n,i)=>{var a;return a=`${this.currfile.info.name} (${this.currfile.info.size} Kb)`,e>this.pdf.numPages?n():this.pdf.getPage(e).then(s=>{var o,l,c,u,h;return h=s.getViewport(t),c=$("
").attr("id","page-"+(s.pageIndex+1)).attr("scale",t).addClass("pdf-page"),$(this.view).append(c),o=$("")[0],c.append(o),l=o.getContext("2d"),o.height=h.height,o.width=h.width,u={canvasContext:l,viewport:h},s.render(u),s._canvas=o,this.setStatus(`${a} - page ${e}/${this.pdf.numPages} loaded`),r?this.renderPDFPages(e+1,t,r).then((function(){return n()})).catch((function(e){return i(__e(e))})):n()}).catch((function(e){return i(__e(e))}))})}renderPDF(){return this.load(new Promise((e,t)=>this.currfile.read("binary").then(r=>($(this.view).removeClass(),PDFJS.getDocument({data:r}).then(r=>(this.pdf=r,this.renderPDFPages(1,1,!1).then(()=>($(this.txtpage).val("1"),e())).catch((function(e){return t(__e(e))})))).catch((function(e){return t(__e(e))})))).catch((function(e){return t(__e(e))})))).catch(e=>this.error(__("Unable to view file: {0}",this.currfile.path),e))}renderSVG(){return $(this.view).attr("class","image"),this.currfile.read().then(e=>(this.view.innerHTML=e,$($(this.view).children()[0]).css("width","100%").css("height","100%"))).catch(e=>this.error(__("Unable to read file: {0}",this.currfile.path),e))}renderImage(){return $(this.view).attr("class","image"),this.currfile.read("binary").then(e=>{var t,r,n;return n=new Image,r=$("")[0],$(this.view).append(r),n.onload=()=>{var e;return e=r.getContext("2d"),r.height=n.height,r.width=n.width,this.img=n,e.drawImage(n,0,0),this.setStatus(`${this.currfile.info.name} (${this.currfile.info.size} Kb) - ${n.width}x${n.height}`)},t=new Blob([e],{type:this.currfile.info.mime}),n.src=URL.createObjectURL(t)}).catch(e=>this.error(__("Unable to read file: {0}",this.currfile.path),e))}menu(){return[{text:"__(File)",nodes:[{text:"__(Open)",dataid:this.name+"-Open",shortcut:"A-O"},{text:"__(Close)",dataid:this.name+"-Close",shortcut:"C-X"}],onchildselect:e=>this.actionFile(e.data.item.data.dataid)}]}actionFile(e){switch(e){case this.name+"-Open":return this.openDialog("FileDialog",{title:__("Open file"),mimes:this.meta().mimes}).then(e=>this.open(e.file.path.asFileHandle()));case this.name+"-Close":return this.quit()}}},this.OS.register("Preview",e)}).call(this),e=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unreachable=t.warn=t.utf8StringToString=t.stringToUTF8String=t.stringToPDFString=t.stringToBytes=t.string32=t.shadow=t.setVerbosityLevel=t.ReadableStream=t.removeNullCharacters=t.readUint32=t.readUint16=t.readInt8=t.log2=t.loadJpegStream=t.isEvalSupported=t.isLittleEndian=t.createValidAbsoluteUrl=t.isSameOrigin=t.isNodeJS=t.isSpace=t.isString=t.isNum=t.isInt=t.isEmptyObj=t.isBool=t.isArrayBuffer=t.isArray=t.info=t.globalScope=t.getVerbosityLevel=t.getLookupTableFactory=t.deprecated=t.createObjectURL=t.createPromiseCapability=t.createBlob=t.bytesToString=t.assert=t.arraysToBytes=t.arrayByteLength=t.FormatError=t.XRefParseException=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.StatTimer=t.PasswordResponses=t.PasswordException=t.PageViewport=t.NotImplementedException=t.NativeImageDecoding=t.MissingPDFException=t.MissingDataException=t.MessageHandler=t.InvalidPDFException=t.AbortException=t.CMapCompressionType=t.ImageKind=t.FontType=t.AnnotationType=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.UNSUPPORTED_FEATURES=t.VERBOSITY_LEVELS=t.OPS=t.IDENTITY_MATRIX=t.FONT_IDENTITY_MATRIX=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r(16);var i=r(17),a="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:void 0,s={errors:0,warnings:1,infos:5},o=s.warnings;function l(e){o>=s.warnings&&console.log("Warning: "+e)}function c(e){throw new Error(e)}function u(e,t){e||c(t)}var h=function(){function e(e,t){this.name="PasswordException",this.message=e,this.code=t}return e.prototype=new Error,e.constructor=e,e}(),d=function(){function e(e,t){this.name="UnknownErrorException",this.message=e,this.details=t}return e.prototype=new Error,e.constructor=e,e}(),f=function(){function e(e){this.name="InvalidPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),p=function(){function e(e){this.name="MissingPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),m=function(){function e(e,t){this.name="UnexpectedResponseException",this.message=e,this.status=t}return e.prototype=new Error,e.constructor=e,e}(),g=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="NotImplementedException",e.constructor=e,e}(),v=function(){function e(e,t){this.begin=e,this.end=t,this.message="Missing data ["+e+", "+t+")"}return e.prototype=new Error,e.prototype.name="MissingDataException",e.constructor=e,e}(),b=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="XRefParseException",e.constructor=e,e}(),_=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="FormatError",e.constructor=e,e}(),y=function(){function e(e){this.name="AbortException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),A=/\x00/g;function S(e){u("string"==typeof e,"Invalid argument for stringToBytes");for(var t=e.length,r=new Uint8Array(t),n=0;ne[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t},e.intersect=function(t,r){function n(e,t){return e-t}var i=[t[0],t[2],r[0],r[2]].sort(n),a=[t[1],t[3],r[1],r[3]].sort(n),s=[];return t=e.normalizeRect(t),r=e.normalizeRect(r),(i[0]===t[0]&&i[1]===r[0]||i[0]===r[0]&&i[1]===t[0])&&(s[0]=i[1],s[2]=i[2],(a[0]===t[1]&&a[1]===r[1]||a[0]===r[1]&&a[1]===t[1])&&(s[1]=a[1],s[3]=a[2],s))},e.sign=function(e){return e<0?-1:1};var r=["","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"];return e.toRoman=function(e,t){u(k(e)&&e>0,"The number should be a positive integer.");for(var n,i=[];e>=1e3;)e-=1e3,i.push("M");n=e/100|0,e%=100,i.push(r[n]),n=e/10|0,e%=10,i.push(r[10+n]),i.push(r[20+e]);var a=i.join("");return t?a.toLowerCase():a},e.appendToArray=function(e,t){Array.prototype.push.apply(e,t)},e.prependToArray=function(e,t){Array.prototype.unshift.apply(e,t)},e.extendObj=function(e,t){for(var r in t)e[r]=t[r]},e.getInheritableProperty=function(e,t,r){for(;e&&!e.has(t);)e=e.get("Parent");return e?r?e.getArray(t):e.get(t):null},e.inherit=function(e,t,r){for(var n in e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r)e.prototype[n]=r[n]},e.loadScript=function(e,t){var r=document.createElement("script"),n=!1;r.setAttribute("src",e),t&&(r.onload=function(){n||t(),n=!0}),document.getElementsByTagName("head")[0].appendChild(r)},e}(),C=function(){function e(e,t,r,n,i,a){this.viewBox=e,this.scale=t,this.rotation=r,this.offsetX=n,this.offsetY=i;var s,o,l,c,u,h,d,f,p=(e[2]+e[0])/2,m=(e[3]+e[1])/2;switch(r=(r%=360)<0?r+360:r){case 180:s=-1,o=0,l=0,c=1;break;case 90:s=0,o=1,l=1,c=0;break;case 270:s=0,o=-1,l=-1,c=0;break;default:s=1,o=0,l=0,c=-1}a&&(l=-l,c=-c),0===s?(u=Math.abs(m-e[1])*t+n,h=Math.abs(p-e[0])*t+i,d=Math.abs(e[3]-e[1])*t,f=Math.abs(e[2]-e[0])*t):(u=Math.abs(p-e[0])*t+n,h=Math.abs(m-e[1])*t+i,d=Math.abs(e[2]-e[0])*t,f=Math.abs(e[3]-e[1])*t),this.transform=[s*t,o*t,l*t,c*t,u-s*t*p-l*t*m,h-o*t*p-c*t*m],this.width=d,this.height=f,this.fontScale=t}return e.prototype={clone:function(t){var r="scale"in(t=t||{})?t.scale:this.scale,n="rotation"in t?t.rotation:this.rotation;return new e(this.viewBox.slice(),r,n,this.offsetX,this.offsetY,t.dontFlip)},convertToViewportPoint:function(e,t){return P.applyTransform([e,t],this.transform)},convertToViewportRectangle:function(e){var t=P.applyTransform([e[0],e[1]],this.transform),r=P.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],r[0],r[1]]},convertToPdfPoint:function(e,t){return P.applyInverseTransform([e,t],this.transform)}},e}(),R=[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];function k(e){return"number"==typeof e&&(0|e)===e}function x(){var e={};return e.promise=new Promise((function(t,r){e.resolve=t,e.reject=r})),e}var T,E=function(){function e(e,t,r){for(;e.lengtha&&(a=s.length)}for(t=0,r=n.length;t2&&void 0!==arguments[2]&&arguments[2];if(!r&&URL.createObjectURL){var n=I(e,t);return URL.createObjectURL(n)}for(var i="data:"+t+";base64,",a=0,s=e.length;a>2,h=(3&o)<<4|l>>4,d=a+1>6:64,f=a+22&&void 0!==arguments[2]?arguments[2]:null;return e?new Promise((function(n,i){n(e.apply(r,t))})):Promise.resolve(void 0)}function O(e){if("object"!==(void 0===e?"undefined":n(e)))return e;switch(e.name){case"AbortException":return new y(e.message);case"MissingPDFException":return new p(e.message);case"UnexpectedResponseException":return new m(e.message,e.status);default:return new d(e.message,e.details)}}function F(e,t,r){t?e.resolve():e.reject(r)}function N(e,t,r){var n=this;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);var i=this.callbacksCapabilities=Object.create(null),a=this.actionHandler=Object.create(null);this._onComObjOnMessage=function(e){var t=e.data;if(t.targetName===n.sourceName)if(t.stream)n._processStreamMessage(t);else if(t.isReply){var s=t.callbackId;if(!(t.callbackId in i))throw new Error("Cannot resolve callback "+s);var o=i[s];delete i[s],"error"in t?o.reject(O(t.error)):o.resolve(t.data)}else{if(!(t.action in a))throw new Error("Unknown action from worker: "+t.action);var l=a[t.action];if(t.callbackId){var c=n.sourceName,u=t.sourceName;Promise.resolve().then((function(){return l[0].call(l[1],t.data)})).then((function(e){r.postMessage({sourceName:c,targetName:u,isReply:!0,callbackId:t.callbackId,data:e})}),(function(e){e instanceof Error&&(e+=""),r.postMessage({sourceName:c,targetName:u,isReply:!0,callbackId:t.callbackId,error:e})}))}else t.streamId?n._createStreamSink(t):l[0].call(l[1],t.data)}},r.addEventListener("message",this._onComObjOnMessage)}N.prototype={on:function(e,t,r){var n=this.actionHandler;if(n[e])throw new Error('There is already an actionName called "'+e+'"');n[e]=[t,r]},send:function(e,t,r){var n={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t};this.postMessage(n,r)},sendWithPromise:function(e,t,r){var n=this.callbackId++,i={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t,callbackId:n},a=x();this.callbacksCapabilities[n]=a;try{this.postMessage(i,r)}catch(e){a.reject(e)}return a.promise},sendWithStream:function(e,t,r,n){var a=this,s=this.streamId++,o=this.sourceName,l=this.targetName;return new i.ReadableStream({start:function(r){var n=x();return a.streamControllers[s]={controller:r,startCall:n,isClosed:!1},a.postMessage({sourceName:o,targetName:l,action:e,streamId:s,data:t,desiredSize:r.desiredSize}),n.promise},pull:function(e){var t=x();return a.streamControllers[s].pullCall=t,a.postMessage({sourceName:o,targetName:l,stream:"pull",streamId:s,desiredSize:e.desiredSize}),t.promise},cancel:function(e){var t=x();return a.streamControllers[s].cancelCall=t,a.streamControllers[s].isClosed=!0,a.postMessage({sourceName:o,targetName:l,stream:"cancel",reason:e,streamId:s}),t.promise}},r)},_createStreamSink:function(e){var t=this,r=this,n=this.actionHandler[e.action],i=e.streamId,a=e.desiredSize,s=this.sourceName,o=e.sourceName,l=x(),c=function(e){var r=e.stream,n=e.chunk,a=e.transfers,l=e.success,c=e.reason;t.postMessage({sourceName:s,targetName:o,stream:r,streamId:i,chunk:n,success:l,reason:c},a)},u={enqueue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments[2];if(!this.isCancelled){var n=this.desiredSize;this.desiredSize-=t,n>0&&this.desiredSize<=0&&(this.sinkCapability=x(),this.ready=this.sinkCapability.promise),c({stream:"enqueue",chunk:e,transfers:r})}},close:function(){this.isCancelled||(c({stream:"close"}),delete r.streamSinks[i])},error:function(e){this.isCancelled||(this.isCancelled=!0,c({stream:"error",reason:e}))},sinkCapability:l,onPull:null,onCancel:null,isCancelled:!1,desiredSize:a,ready:null};u.sinkCapability.resolve(),u.ready=u.sinkCapability.promise,this.streamSinks[i]=u,D(n[0],[e.data,u],n[1]).then((function(){c({stream:"start_complete",success:!0})}),(function(e){c({stream:"start_complete",success:!1,reason:e})}))},_processStreamMessage:function(e){var t=this,r=this.sourceName,n=e.sourceName,i=e.streamId,a=function(e){var a=e.stream,s=e.success,o=e.reason;t.comObj.postMessage({sourceName:r,targetName:n,stream:a,success:s,streamId:i,reason:o})},s=function(){Promise.all([t.streamControllers[e.streamId].startCall,t.streamControllers[e.streamId].pullCall,t.streamControllers[e.streamId].cancelCall].map((function(e){return e&&(t=e.promise,Promise.resolve(t).catch((function(){})));var t}))).then((function(){delete t.streamControllers[e.streamId]}))};switch(e.stream){case"start_complete":F(this.streamControllers[e.streamId].startCall,e.success,O(e.reason));break;case"pull_complete":F(this.streamControllers[e.streamId].pullCall,e.success,O(e.reason));break;case"pull":if(!this.streamSinks[e.streamId]){a({stream:"pull_complete",success:!0});break}this.streamSinks[e.streamId].desiredSize<=0&&e.desiredSize>0&&this.streamSinks[e.streamId].sinkCapability.resolve(),this.streamSinks[e.streamId].desiredSize=e.desiredSize,D(this.streamSinks[e.streamId].onPull).then((function(){a({stream:"pull_complete",success:!0})}),(function(e){a({stream:"pull_complete",success:!1,reason:e})}));break;case"enqueue":u(this.streamControllers[e.streamId],"enqueue should have stream controller"),this.streamControllers[e.streamId].isClosed||this.streamControllers[e.streamId].controller.enqueue(e.chunk);break;case"close":if(u(this.streamControllers[e.streamId],"close should have stream controller"),this.streamControllers[e.streamId].isClosed)break;this.streamControllers[e.streamId].isClosed=!0,this.streamControllers[e.streamId].controller.close(),s();break;case"error":u(this.streamControllers[e.streamId],"error should have stream controller"),this.streamControllers[e.streamId].controller.error(O(e.reason)),s();break;case"cancel_complete":F(this.streamControllers[e.streamId].cancelCall,e.success,O(e.reason)),s();break;case"cancel":if(!this.streamSinks[e.streamId])break;D(this.streamSinks[e.streamId].onCancel,[O(e.reason)]).then((function(){a({stream:"cancel_complete",success:!0})}),(function(e){a({stream:"cancel_complete",success:!1,reason:e})})),this.streamSinks[e.streamId].sinkCapability.reject(O(e.reason)),this.streamSinks[e.streamId].isCancelled=!0,delete this.streamSinks[e.streamId];break;default:throw new Error("Unexpected stream case")}},postMessage:function(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)},destroy:function(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}},t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},t.VERBOSITY_LEVELS=s,t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},t.FontType={UNKNOWN:0,TYPE1:1,TYPE1C:2,CIDFONTTYPE0:3,CIDFONTTYPE0C:4,TRUETYPE:5,CIDFONTTYPE2:6,TYPE3:7,OPENTYPE:8,TYPE0:9,MMTYPE1:10},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},t.AbortException=y,t.InvalidPDFException=f,t.MessageHandler=N,t.MissingDataException=v,t.MissingPDFException=p,t.NativeImageDecoding={NONE:"none",DECODE:"decode",DISPLAY:"display"},t.NotImplementedException=g,t.PageViewport=C,t.PasswordException=h,t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},t.StatTimer=E,t.StreamType={UNKNOWN:0,FLATE:1,LZW:2,DCT:3,JPX:4,JBIG:5,A85:6,AHX:7,CCF:8,RL:9},t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},t.UnexpectedResponseException=m,t.UnknownErrorException=d,t.Util=P,t.XRefParseException=b,t.FormatError=_,t.arrayByteLength=w,t.arraysToBytes=function(e){if(1===e.length&&e[0]instanceof Uint8Array)return e[0];var t,r,n,i=0,a=e.length;for(t=0;t=s.infos&&console.log("Info: "+e)},t.isArray=function(e){return e instanceof Array},t.isArrayBuffer=function(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e&&void 0!==e.byteLength},t.isBool=function(e){return"boolean"==typeof e},t.isEmptyObj=function(e){for(var t in e)return!1;return!0},t.isInt=k,t.isNum=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSpace=function(e){return 32===e||9===e||13===e||10===e},t.isNodeJS=function(){return"object"===("undefined"==typeof process?"undefined":n(process))&&process+""=="[object process]"},t.isSameOrigin=function(e,t){try{var r=new URL(e);if(!r.origin||"null"===r.origin)return!1}catch(e){return!1}var n=new URL(t,r);return r.origin===n.origin},t.createValidAbsoluteUrl=function(e,t){if(!e)return null;try{var 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.isLittleEndian=function(){var e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]},t.isEvalSupported=function(){try{return new Function(""),!0}catch(e){return!1}},t.loadJpegStream=function(e,t,r){var n=new Image;n.onload=function(){r.resolve(e,n)},n.onerror=function(){r.resolve(e,null),l("Error during JPEG image loading")},n.src=t},t.log2=function(e){for(var t=1,r=0;e>t;)t<<=1,r++;return r},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.removeNullCharacters=function(e){return"string"!=typeof e?(l("The argument for removeNullCharacters must be a string."),e):e.replace(A,"")},t.ReadableStream=i.ReadableStream,t.setVerbosityLevel=function(e){o=e},t.shadow=function(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!1}),r},t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=S,t.stringToPDFString=function(e){var t,r=e.length,n=[];if("þ"===e[0]&&"ÿ"===e[1])for(t=2;t0?t:e.length,r>0?r:e.length);return e.substring(e.lastIndexOf("/",n)+1,n)},t.LinkTarget=u,t.getDefaultSetting=d,t.DEFAULT_LINK_REL="noopener noreferrer nofollow",t.DOMCanvasFactory=s,t.DOMCMapReaderFactory=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.build=t.version=t._UnsupportedManager=t.setPDFNetworkStreamClass=t.PDFPageProxy=t.PDFDocumentProxy=t.PDFWorker=t.PDFDataRangeTransport=t.LoopbackPort=t.getDocument=void 0;var n,i,a=function(){function e(e,t){for(var r=0;r=0&&a.renderTasks.splice(n,1),t.cleanupAfterRender&&(t.pendingCleanup=!0),t._tryCleanup(),e?c.capability.reject(e):c.capability.resolve(),r.timeEnd("Rendering"),r.timeEnd("Overall")},c=new E(s,e,this.objs,this.commonObjs,a.operatorList,this.pageNumber,i);c.useRequestAnimationFrame="print"!==n,a.renderTasks||(a.renderTasks=[]),a.renderTasks.push(c);var u=c.task;return e.continueCallback&&((0,o.deprecated)("render is used with continueCallback parameter"),u.onContinue=e.continueCallback),a.displayReadyCapability.promise.then((function(e){t.pendingCleanup?s():(r.time("Rendering"),c.initializeGraphics(e),c.operatorListChanged())})).catch(s),u},getOperatorList:function(){this.intentStates.oplist||(this.intentStates.oplist=Object.create(null));var e,t=this.intentStates.oplist;return t.opListReadCapability||((e={}).operatorListChanged=function(){if(t.operatorList.lastChunk){t.opListReadCapability.resolve(t.operatorList);var r=t.renderTasks.indexOf(e);r>=0&&t.renderTasks.splice(r,1)}},t.receivingOperatorList=!0,t.opListReadCapability=(0,o.createPromiseCapability)(),t.renderTasks=[],t.renderTasks.push(e),t.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageIndex,intent:"oplist"})),t.opListReadCapability.promise},streamTextContent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=100;return this.transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this.pageNumber-1,normalizeWhitespace:!0===e.normalizeWhitespace,combineTextItems:!0!==e.disableCombineTextItems},{highWaterMark:t,size:function(e){return e.items.length}})},getTextContent:function(e){e=e||{};var t=this.streamTextContent(e);return new Promise((function(e,r){var n=t.getReader(),i={items:[],styles:Object.create(null)};!function t(){n.read().then((function(r){var n=r.value;r.done?e(i):(o.Util.extendObj(i.styles,n.styles),o.Util.appendToArray(i.items,n.items),t())}),r)}()}))},_destroy:function(){this.destroyed=!0,this.transport.pageCache[this.pageIndex]=null;var e=[];return Object.keys(this.intentStates).forEach((function(t){"oplist"!==t&&this.intentStates[t].renderTasks.forEach((function(t){var r=t.capability.promise.catch((function(){}));e.push(r),t.cancel()}))}),this),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1,Promise.all(e)},destroy:function(){(0,o.deprecated)("page destroy method, use cleanup() instead"),this.cleanup()},cleanup:function(){this.pendingCleanup=!0,this._tryCleanup()},_tryCleanup:function(){this.pendingCleanup&&!Object.keys(this.intentStates).some((function(e){var t=this.intentStates[e];return 0!==t.renderTasks.length||t.receivingOperatorList}),this)&&(Object.keys(this.intentStates).forEach((function(e){delete this.intentStates[e]}),this),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1)},_startRenderPage:function(e,t){var r=this.intentStates[t];r.displayReadyCapability&&r.displayReadyCapability.resolve(e)},_renderPageChunk:function(e,t){var r,n,i=this.intentStates[t];for(r=0,n=e.length;r=0;return i=r===a?r:l?new r.constructor(a,r.byteOffset,r.byteLength):new r.constructor(r),n.set(r,i),i}for(var c in i=(0,o.isArray)(r)?[]:{},n.set(r,i),r){for(var u,h=r;!(u=Object.getOwnPropertyDescriptor(h,c));)h=Object.getPrototypeOf(h);void 0!==u.value&&"function"!=typeof u.value&&(i[c]=e(u.value))}return i}(e)};this._deferred.then((function(){r._listeners.forEach((function(e){e.call(this,i)}),r)}))}else this._listeners.forEach((function(t){t.call(this,{data:e})}),this)}},{key:"addEventListener",value:function(e,t){this._listeners.push(t)}},{key:"removeEventListener",value:function(e,t){var r=this._listeners.indexOf(t);this._listeners.splice(r,1)}},{key:"terminate",value:function(){this._listeners=[]}}]),e}(),R=function(){var e=0;function t(){if(void 0!==n)return n;if((0,l.getDefaultSetting)("workerSrc"))return(0,l.getDefaultSetting)("workerSrc");if(m)return m.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2");throw new Error("No PDFJS.workerSrc specified")}var r=void 0,a=new WeakMap;function s(e,t){if(t&&a.has(t))throw new Error("Cannot use more than one PDFWorker per port");if(this.name=e,this.destroyed=!1,this.postMessageTransfers=!0,this._readyCapability=(0,o.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t)return a.set(t,this),void this._initializeFromPort(t);this._initialize()}return s.prototype={get promise(){return this._readyCapability.promise},get port(){return this._port},get messageHandler(){return this._messageHandler},_initializeFromPort:function(e){this._port=e,this._messageHandler=new o.MessageHandler("main","worker",e),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve()},_initialize:function(){var e,r=this;if(!f&&!(0,l.getDefaultSetting)("disableWorker")&&"undefined"!=typeof Worker){var n=t();try{(0,o.isSameOrigin)(window.location.href,n)||(e="importScripts('"+new URL(n,window.location).href+"');",n=URL.createObjectURL(new Blob([e])));var i=new Worker(n),a=new o.MessageHandler("main","worker",i),s=function(){i.removeEventListener("error",c),a.destroy(),i.terminate(),r.destroyed?r._readyCapability.reject(new Error("Worker was destroyed")):r._setupFakeWorker()},c=function(){r._webWorker||s()};i.addEventListener("error",c),a.on("test",(function(e){i.removeEventListener("error",c),r.destroyed?s():e&&e.supportTypedArray?(r._messageHandler=a,r._port=i,r._webWorker=i,e.supportTransfers||(r.postMessageTransfers=!1,p=!0),r._readyCapability.resolve(),a.send("configure",{verbosity:(0,o.getVerbosityLevel)()})):(r._setupFakeWorker(),a.destroy(),i.terminate())})),a.on("console_log",(function(e){console.log.apply(console,e)})),a.on("console_error",(function(e){console.error.apply(console,e)})),a.on("ready",(function(e){if(i.removeEventListener("error",c),r.destroyed)s();else try{u()}catch(e){r._setupFakeWorker()}}));var u=function(){var e=(0,l.getDefaultSetting)("postMessageTransfers")&&!p,t=new Uint8Array([e?255:0]);try{a.send("test",t,[t.buffer])}catch(e){(0,o.info)("Cannot use postMessage transfers"),t[0]=0,a.send("test",t)}};return void u()}catch(e){(0,o.info)("The worker has been disabled.")}}this._setupFakeWorker()},_setupFakeWorker:function(){var n=this;f||(0,l.getDefaultSetting)("disableWorker")||((0,o.warn)("Setting up fake worker."),f=!0),(r||(r=(0,o.createPromiseCapability)(),(i||function(e){o.Util.loadScript(t(),(function(){e(window.pdfjsDistBuildPdfWorker.WorkerMessageHandler)}))})(r.resolve)),r.promise).then((function(t){if(n.destroyed)n._readyCapability.reject(new Error("Worker was destroyed"));else{var r=Uint8Array!==Float32Array,i=new C(r);n._port=i;var a="fake"+e++,s=new o.MessageHandler(a+"_worker",a,i);t.setup(s,i);var l=new o.MessageHandler(a,a+"_worker",i);n._messageHandler=l,n._readyCapability.resolve()}}))},destroy:function(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),a.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}},s.fromPort=function(e){return a.has(e)?a.get(e):new s(null,e)},s}(),k=function(){function e(e,t,r,n){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new x,this.fontLoader=new c.FontLoader(t.docId),this.CMapReaderFactory=new n({baseUrl:(0,l.getDefaultSetting)("cMapUrl"),isCompressed:(0,l.getDefaultSetting)("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,o.createPromiseCapability)(),this.setupMessageHandler()}return e.prototype={destroy:function(){var e=this;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,o.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));var t=[];this.pageCache.forEach((function(e){e&&t.push(e._destroy())})),this.pageCache=[],this.pagePromises=[];var r=this.messageHandler.sendWithPromise("Terminate",null);return t.push(r),Promise.all(t).then((function(){e.fontLoader.clear(),e._networkStream&&e._networkStream.cancelAllRequests(),e.messageHandler&&(e.messageHandler.destroy(),e.messageHandler=null),e.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise},setupMessageHandler:function(){var e=this.messageHandler,t=this.loadingTask;e.on("GetReader",(function(e,t){var r=this;(0,o.assert)(this._networkStream),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=function(e){r._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=function(){r._fullReader.read().then((function(e){var r=e.value;e.done?t.close():((0,o.assert)((0,o.isArrayBuffer)(r)),t.enqueue(new Uint8Array(r),1,[r]))})).catch((function(e){t.error(e)}))},t.onCancel=function(e){r._fullReader.cancel(e)}}),this),e.on("ReaderHeadersReady",(function(e){var t=this,r=(0,o.createPromiseCapability)(),n=this._fullReader;return n.headersReady.then((function(){if(!n.isStreamingSupported||!n.isRangeSupported){if(t._lastProgress){var e=t.loadingTask;e.onProgress&&e.onProgress(t._lastProgress)}n.onProgress=function(e){var r=t.loadingTask;r.onProgress&&r.onProgress({loaded:e.loaded,total:e.total})}}r.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})}),r.reject),r.promise}),this),e.on("GetRangeReader",(function(e,t){(0,o.assert)(this._networkStream);var r=this._networkStream.getRangeReader(e.begin,e.end);t.onPull=function(){r.read().then((function(e){var r=e.value;e.done?t.close():((0,o.assert)((0,o.isArrayBuffer)(r)),t.enqueue(new Uint8Array(r),1,[r]))})).catch((function(e){t.error(e)}))},t.onCancel=function(e){r.cancel(e)}}),this),e.on("GetDoc",(function(e){var t=e.pdfInfo;this.numPages=e.pdfInfo.numPages;var r=this.loadingTask,n=new w(t,this,r);this.pdfDocument=n,r._capability.resolve(n)}),this),e.on("PasswordRequest",(function(e){var r=this;return this._passwordCapability=(0,o.createPromiseCapability)(),t.onPassword?t.onPassword((function(e){r._passwordCapability.resolve({password:e})}),e.code):this._passwordCapability.reject(new o.PasswordException(e.message,e.code)),this._passwordCapability.promise}),this),e.on("PasswordException",(function(e){t._capability.reject(new o.PasswordException(e.message,e.code))}),this),e.on("InvalidPDF",(function(e){this.loadingTask._capability.reject(new o.InvalidPDFException(e.message))}),this),e.on("MissingPDF",(function(e){this.loadingTask._capability.reject(new o.MissingPDFException(e.message))}),this),e.on("UnexpectedResponse",(function(e){this.loadingTask._capability.reject(new o.UnexpectedResponseException(e.message,e.status))}),this),e.on("UnknownError",(function(e){this.loadingTask._capability.reject(new o.UnknownErrorException(e.message,e.details))}),this),e.on("DataLoaded",(function(e){this.downloadInfoCapability.resolve(e)}),this),e.on("PDFManagerReady",(function(e){}),this),e.on("StartRenderPage",(function(e){if(!this.destroyed){var t=this.pageCache[e.pageIndex];t.stats.timeEnd("Page Request"),t._startRenderPage(e.transparency,e.intent)}}),this),e.on("RenderPageChunk",(function(e){this.destroyed||this.pageCache[e.pageIndex]._renderPageChunk(e.operatorList,e.intent)}),this),e.on("commonobj",(function(e){var t=this;if(!this.destroyed){var r=e[0],n=e[1];if(!this.commonObjs.hasData(r))switch(n){case"Font":var i=e[2];if("error"in i){var a=i.error;(0,o.warn)("Error during font loading: "+a),this.commonObjs.resolve(r,a);break}var s=null;(0,l.getDefaultSetting)("pdfBug")&&o.globalScope.FontInspector&&o.globalScope.FontInspector.enabled&&(s={registerFont:function(e,t){o.globalScope.FontInspector.fontAdded(e,t)}});var u=new c.FontFaceObject(i,{isEvalSuported:(0,l.getDefaultSetting)("isEvalSupported"),disableFontFace:(0,l.getDefaultSetting)("disableFontFace"),fontRegistry:s});this.fontLoader.bind([u],(function(e){t.commonObjs.resolve(r,u)}));break;case"FontPath":this.commonObjs.resolve(r,e[2]);break;default:throw new Error("Got unknown common object type "+n)}}}),this),e.on("obj",(function(e){if(!this.destroyed){var t,r=e[0],n=e[1],i=e[2],a=this.pageCache[n];if(!a.objs.hasData(r))switch(i){case"JpegStream":t=e[3],(0,o.loadJpegStream)(r,t,a.objs);break;case"Image":t=e[3],a.objs.resolve(r,t),t&&"data"in t&&t.data.length>8e6&&(a.cleanupAfterRender=!0);break;default:throw new Error("Got unknown object type "+i)}}}),this),e.on("DocProgress",(function(e){if(!this.destroyed){var t=this.loadingTask;t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}),this),e.on("PageError",(function(e){if(!this.destroyed){var t=this.pageCache[e.pageNum-1].intentStates[e.intent];if(!t.displayReadyCapability)throw new Error(e.error);if(t.displayReadyCapability.reject(e.error),t.operatorList){t.operatorList.lastChunk=!0;for(var r=0;rthis.numPages)return Promise.reject(new Error("Invalid page request"));var n=e-1;if(n in this.pagePromises)return this.pagePromises[n];var i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then((function(e){if(r.destroyed)throw new Error("Transport destroyed");var t=new P(n,e,r);return r.pageCache[n]=t,t}));return this.pagePromises[n]=i,i},getPageIndex:function(e){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:e}).catch((function(e){return Promise.reject(new Error(e))}))},getAnnotations:function(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})},getDestinations:function(){return this.messageHandler.sendWithPromise("GetDestinations",null)},getDestination:function(e){return this.messageHandler.sendWithPromise("GetDestination",{id:e})},getPageLabels:function(){return this.messageHandler.sendWithPromise("GetPageLabels",null)},getPageMode:function(){return this.messageHandler.sendWithPromise("GetPageMode",null)},getAttachments:function(){return this.messageHandler.sendWithPromise("GetAttachments",null)},getJavaScript:function(){return this.messageHandler.sendWithPromise("GetJavaScript",null)},getOutline:function(){return this.messageHandler.sendWithPromise("GetOutline",null)},getMetadata:function(){return this.messageHandler.sendWithPromise("GetMetadata",null).then((function(e){return{info:e[0],metadata:e[1]?new h.Metadata(e[1]):null}}))},getStats:function(){return this.messageHandler.sendWithPromise("GetStats",null)},startCleanup:function(){var e=this;this.messageHandler.sendWithPromise("Cleanup",null).then((function(){for(var t=0,r=e.pageCache.length;t1&&(0,o.deprecated)("getDocument is called with pdfDataRangeTransport, passwordCallback or progressCallback argument"),t&&(t instanceof S||((t=Object.create(t)).length=e.length,t.initialData=e.initialData,t.abort||(t.abort=function(){})),(e=Object.create(e)).range=t),a.onPassword=r||null,a.onProgress=n||null,"string"==typeof e)i={url:e};else if((0,o.isArrayBuffer)(e))i={data:e};else if(e instanceof S)i={range:e};else{if("object"!==(void 0===e?"undefined":s(e)))throw new Error("Invalid parameter in getDocument, need either Uint8Array, string or a parameter object");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");i=e}var c={},u=null,h=null,f=l.DOMCMapReaderFactory;for(var p in i)if("url"!==p||"undefined"==typeof window)if("range"!==p)if("worker"!==p)if("data"!==p||i[p]instanceof Uint8Array)"CMapReaderFactory"!==p?c[p]=i[p]:f=i[p];else{var m=i[p];if("string"==typeof m)c[p]=(0,o.stringToBytes)(m);else if("object"!==(void 0===m?"undefined":s(m))||null===m||isNaN(m.length)){if(!(0,o.isArrayBuffer)(m))throw new Error("Invalid PDF binary data: either typed array, string or array-like object is expected in the data property.");c[p]=new Uint8Array(m)}else c[p]=new Uint8Array(m)}else h=i[p];else u=i[p];else c[p]=new URL(i[p],window.location).href;if(c.rangeChunkSize=c.rangeChunkSize||65536,c.ignoreErrors=!0!==c.stopAtErrors,void 0!==c.disableNativeImageDecoder&&(0,o.deprecated)("parameter disableNativeImageDecoder, use nativeImageDecoderSupport instead"),c.nativeImageDecoderSupport=c.nativeImageDecoderSupport||(!0===c.disableNativeImageDecoder?o.NativeImageDecoding.NONE:o.NativeImageDecoding.DECODE),c.nativeImageDecoderSupport!==o.NativeImageDecoding.DECODE&&c.nativeImageDecoderSupport!==o.NativeImageDecoding.NONE&&c.nativeImageDecoderSupport!==o.NativeImageDecoding.DISPLAY&&((0,o.warn)("Invalid parameter nativeImageDecoderSupport: need a state of enum {NativeImageDecoding}"),c.nativeImageDecoderSupport=o.NativeImageDecoding.DECODE),!h){var g=(0,l.getDefaultSetting)("workerPort");h=g?R.fromPort(g):new R,a._worker=h}var b=a.docId;return h.promise.then((function(){if(a.destroyed)throw new Error("Loading aborted");return _(h,c,u,b).then((function(e){if(a.destroyed)throw new Error("Loading aborted");var t=void 0;u?t=new d.PDFDataTransportStream(c,u):c.data||(t=new v({source:c,disableRange:(0,l.getDefaultSetting)("disableRange")}));var r=new o.MessageHandler(b,e,h.port);r.postMessageTransfers=h.postMessageTransfers;var n=new k(r,a,t,f);a._transport=n,r.send("Ready",null)}))})).catch(a._capability.reject),a},t.LoopbackPort=C,t.PDFDataRangeTransport=S,t.PDFWorker=R,t.PDFDocumentProxy=w,t.PDFPageProxy=P,t.setPDFNetworkStreamClass=function(e){v=e},t._UnsupportedManager=I,t.version="1.9.426",t.build="2558a58d"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayer=void 0;var n=r(1),i=r(0);function a(){}a.prototype={create:function(e){switch(e.data.annotationType){case i.AnnotationType.LINK:return new o(e);case i.AnnotationType.TEXT:return new l(e);case i.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new u(e);case"Btn":if(e.data.radioButton)return new d(e);if(e.data.checkBox)return new h(e);(0,i.warn)("Unimplemented button widget annotation: pushbutton");break;case"Ch":return new f(e)}return new c(e);case i.AnnotationType.POPUP:return new p(e);case i.AnnotationType.LINE:return new g(e);case i.AnnotationType.HIGHLIGHT:return new v(e);case i.AnnotationType.UNDERLINE:return new b(e);case i.AnnotationType.SQUIGGLY:return new _(e);case i.AnnotationType.STRIKEOUT:return new y(e);case i.AnnotationType.FILEATTACHMENT:return new A(e);default:return new s(e)}}};var s=function(){function e(e,t,r){this.isRenderable=t||!1,this.data=e.data,this.layer=e.layer,this.page=e.page,this.viewport=e.viewport,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderInteractiveForms=e.renderInteractiveForms,t&&(this.container=this._createContainer(r))}return e.prototype={_createContainer:function(e){var t=this.data,r=this.page,a=this.viewport,s=document.createElement("section"),o=t.rect[2]-t.rect[0],l=t.rect[3]-t.rect[1];s.setAttribute("data-annotation-id",t.id);var c=i.Util.normalizeRect([t.rect[0],r.view[3]-t.rect[1]+r.view[1],t.rect[2],r.view[3]-t.rect[3]+r.view[1]]);if(n.CustomStyle.setProp("transform",s,"matrix("+a.transform.join(",")+")"),n.CustomStyle.setProp("transformOrigin",s,-c[0]+"px "+-c[1]+"px"),!e&&t.borderStyle.width>0){s.style.borderWidth=t.borderStyle.width+"px",t.borderStyle.style!==i.AnnotationBorderStyleType.UNDERLINE&&(o-=2*t.borderStyle.width,l-=2*t.borderStyle.width);var u=t.borderStyle.horizontalCornerRadius,h=t.borderStyle.verticalCornerRadius;if(u>0||h>0){var d=u+"px / "+h+"px";n.CustomStyle.setProp("borderRadius",s,d)}switch(t.borderStyle.style){case i.AnnotationBorderStyleType.SOLID:s.style.borderStyle="solid";break;case i.AnnotationBorderStyleType.DASHED:s.style.borderStyle="dashed";break;case i.AnnotationBorderStyleType.BEVELED:(0,i.warn)("Unimplemented border style: beveled");break;case i.AnnotationBorderStyleType.INSET:(0,i.warn)("Unimplemented border style: inset");break;case i.AnnotationBorderStyleType.UNDERLINE:s.style.borderBottomStyle="solid"}t.color?s.style.borderColor=i.Util.makeCssRgb(0|t.color[0],0|t.color[1],0|t.color[2]):s.style.borderWidth=0}return s.style.left=c[0]+"px",s.style.top=c[1]+"px",s.style.width=o+"px",s.style.height=l+"px",s},_createPopup:function(e,t,r){t||((t=document.createElement("div")).style.height=e.style.height,t.style.width=e.style.width,e.appendChild(t));var n=new m({container:e,trigger:t,color:r.color,title:r.title,contents:r.contents,hideWrapper:!0}).render();n.style.left=e.style.width,e.appendChild(n)},render:function(){throw new Error("Abstract method AnnotationElement.render called")}},e}(),o=function(){function e(e){s.call(this,e,!0)}return i.Util.inherit(e,s,{render:function(){this.container.className="linkAnnotation";var e=document.createElement("a");return(0,n.addLinkAttributes)(e,{url:this.data.url,target:this.data.newWindow?n.LinkTarget.BLANK:void 0}),this.data.url||(this.data.action?this._bindNamedAction(e,this.data.action):this._bindLink(e,this.data.dest)),this.container.appendChild(e),this.container},_bindLink:function(e,t){var r=this;e.href=this.linkService.getDestinationHash(t),e.onclick=function(){return t&&r.linkService.navigateTo(t),!1},t&&(e.className="internalLink")},_bindNamedAction:function(e,t){var r=this;e.href=this.linkService.getAnchorUrl(""),e.onclick=function(){return r.linkService.executeNamedAction(t),!1},e.className="internalLink"}}),e}(),l=function(){function e(e){var t=!!(e.data.hasPopup||e.data.title||e.data.contents);s.call(this,e,t)}return i.Util.inherit(e,s,{render:function(){this.container.className="textAnnotation";var 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}}),e}(),c=function(){function e(e,t){s.call(this,e,t)}return i.Util.inherit(e,s,{render:function(){return this.container}}),e}(),u=function(){var e=["left","center","right"];function t(e){var t=e.renderInteractiveForms||!e.data.hasAppearance&&!!e.data.fieldValue;c.call(this,e,t)}return i.Util.inherit(t,c,{render:function(){this.container.className="textWidgetAnnotation";var t=null;if(this.renderInteractiveForms){if(this.data.multiLine?(t=document.createElement("textarea")).textContent=this.data.fieldValue:((t=document.createElement("input")).type="text",t.setAttribute("value",this.data.fieldValue)),t.disabled=this.data.readOnly,null!==this.data.maxLen&&(t.maxLength=this.data.maxLen),this.data.comb){var r=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;t.classList.add("comb"),t.style.letterSpacing="calc("+r+"px - 1ch)"}}else{(t=document.createElement("div")).textContent=this.data.fieldValue,t.style.verticalAlign="middle",t.style.display="table-cell";var n=null;this.data.fontRefName&&(n=this.page.commonObjs.getData(this.data.fontRefName)),this._setTextStyle(t,n)}return null!==this.data.textAlignment&&(t.style.textAlign=e[this.data.textAlignment]),this.container.appendChild(t),this.container},_setTextStyle:function(e,t){var r=e.style;if(r.fontSize=this.data.fontSize+"px",r.direction=this.data.fontDirection<0?"rtl":"ltr",t){r.fontWeight=t.black?t.bold?"900":"bold":t.bold?"bold":"normal",r.fontStyle=t.italic?"italic":"normal";var n=t.loadedName?'"'+t.loadedName+'", ':"",i=t.fallbackName||"Helvetica, sans-serif";r.fontFamily=n+i}}}),t}(),h=function(){function e(e){c.call(this,e,e.renderInteractiveForms)}return i.Util.inherit(e,c,{render:function(){this.container.className="buttonWidgetAnnotation checkBox";var e=document.createElement("input");return e.disabled=this.data.readOnly,e.type="checkbox",this.data.fieldValue&&"Off"!==this.data.fieldValue&&e.setAttribute("checked",!0),this.container.appendChild(e),this.container}}),e}(),d=function(){function e(e){c.call(this,e,e.renderInteractiveForms)}return i.Util.inherit(e,c,{render:function(){this.container.className="buttonWidgetAnnotation radioButton";var 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}}),e}(),f=function(){function e(e){c.call(this,e,e.renderInteractiveForms)}return i.Util.inherit(e,c,{render:function(){this.container.className="choiceWidgetAnnotation";var e=document.createElement("select");e.disabled=this.data.readOnly,this.data.combo||(e.size=this.data.options.length,this.data.multiSelect&&(e.multiple=!0));for(var t=0,r=this.data.options.length;t=0&&i.setAttribute("selected",!0),e.appendChild(i)}return this.container.appendChild(e),this.container}}),e}(),p=function(){var e=["Line"];function t(e){var t=!(!e.data.title&&!e.data.contents);s.call(this,e,t)}return i.Util.inherit(t,s,{render:function(){if(this.container.className="popupAnnotation",e.indexOf(this.data.parentType)>=0)return this.container;var t='[data-annotation-id="'+this.data.parentId+'"]',r=this.layer.querySelector(t);if(!r)return this.container;var i=new m({container:this.container,trigger:r,color:this.data.color,title:this.data.title,contents:this.data.contents}),a=parseFloat(r.style.left),s=parseFloat(r.style.width);return n.CustomStyle.setProp("transformOrigin",this.container,-(a+s)+"px -"+r.style.top),this.container.style.left=a+s+"px",this.container.appendChild(i.render()),this.container}}),t}(),m=function(){function e(e){this.container=e.container,this.trigger=e.trigger,this.color=e.color,this.title=e.title,this.contents=e.contents,this.hideWrapper=e.hideWrapper||!1,this.pinned=!1}return e.prototype={render:function(){var e=document.createElement("div");e.className="popupWrapper",this.hideElement=this.hideWrapper?e:this.container,this.hideElement.setAttribute("hidden",!0);var t=document.createElement("div");t.className="popup";var r=this.color;if(r){var n=.7*(255-r[0])+r[0],a=.7*(255-r[1])+r[1],s=.7*(255-r[2])+r[2];t.style.backgroundColor=i.Util.makeCssRgb(0|n,0|a,0|s)}var o=this._formatContents(this.contents),l=document.createElement("h1");return l.textContent=this.title,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)),t.appendChild(l),t.appendChild(o),e.appendChild(t),e},_formatContents:function(e){for(var t=document.createElement("p"),r=e.split(/(?:\r\n?|\n)/),n=0,i=r.length;n>1&2147483647:n>>1&2147483647;t[r]=n}function s(e,r,n,i){var a=i,s=r.length;n[a]=s>>24&255,n[a+1]=s>>16&255,n[a+2]=s>>8&255,n[a+3]=255&s,n[a+=4]=255&e.charCodeAt(0),n[a+1]=255&e.charCodeAt(1),n[a+2]=255&e.charCodeAt(2),n[a+3]=255&e.charCodeAt(3),a+=4,n.set(r,a);var o=function(e,r,n){for(var i=-1,a=r;a>>8^t[s]}return-1^i}(n,i+4,a+=r.length);n[a]=o>>24&255,n[a+1]=o>>16&255,n[a+2]=o>>8&255,n[a+3]=255&o}function o(e){var t=e.length,r=Math.ceil(t/65535),n=new Uint8Array(2+t+5*r+4),i=0;n[i++]=120,n[i++]=156;for(var a=0;t>65535;)n[i++]=0,n[i++]=255,n[i++]=255,n[i++]=0,n[i++]=0,n.set(e.subarray(a,a+65535),i),i+=65535,a+=65535,t-=65535;n[i++]=1,n[i++]=255&t,n[i++]=t>>8&255,n[i++]=255&~t,n[i++]=(65535&~t)>>8&255,n.set(e.subarray(a),i),i+=e.length-a;var s=function(e,t,r){for(var n=1,i=0,a=0;a>24&255,n[i++]=s>>16&255,n[i++]=s>>8&255,n[i++]=255&s,n}return function(t,r){return function(t,r,n){var a,l,c,u=t.width,h=t.height,d=t.data;switch(r){case i.ImageKind.GRAYSCALE_1BPP:l=0,a=1,c=u+7>>3;break;case i.ImageKind.RGB_24BPP:l=2,a=8,c=3*u;break;case i.ImageKind.RGBA_32BPP:l=6,a=8,c=4*u;break;default:throw new Error("invalid format")}var f,p,m=new Uint8Array((1+c)*h),g=0,v=0;for(f=0;f>24&255,u>>16&255,u>>8&255,255&u,h>>24&255,h>>16&255,h>>8&255,255&h,a,l,0,0,0]),_=function(e){if(!(0,i.isNodeJS)())return o(e);try{var t;t=parseInt(process.versions.node)>=8?e:new Buffer(e);var r=require("zlib").deflateSync(t,{level:9});return r instanceof Uint8Array?r:new Uint8Array(r)}catch(e){(0,i.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return o(e)}(m),y=e.length+36+b.length+_.length,A=new Uint8Array(y),S=0;return A.set(e,S),s("IHDR",b,A,S+=e.length),s("IDATA",_,A,S+=12+b.length),S+=12+_.length,s("IEND",new Uint8Array(0),A,S),(0,i.createObjectURL)(A,"image/png",n)}(t,void 0===t.kind?i.ImageKind.GRAYSCALE_1BPP:t.kind,r)}}(),s=function(){function e(){this.fontSizeScale=1,this.fontWeight="normal",this.fontSize=0,this.textMatrix=i.IDENTITY_MATRIX,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,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="#000000",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=""}return e.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(e,t){this.x=e,this.y=t}},e}();t.SVGGraphics=n=function(){function e(e){if(e===(0|e))return e.toString();var t=e.toFixed(10),r=t.length-1;if("0"!==t[r])return t;do{r--}while("0"===t[r]);return t.substr(0,"."===t[r]?r:r+1)}function t(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":"scale("+e(t[0])+" "+e(t[3])+")";if(t[0]===t[3]&&t[1]===-t[2])return"rotate("+e(180*Math.acos(t[0])/Math.PI)+")"}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return"translate("+e(t[4])+" "+e(t[5])+")";return"matrix("+e(t[0])+" "+e(t[1])+" "+e(t[2])+" "+e(t[3])+" "+e(t[4])+" "+e(t[5])+")"}function r(e,t,r){this.current=new s,this.transformMatrix=i.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}var n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xlink",l=["butt","round","square"],c=["miter","round","bevel"],u=0,h=0;return r.prototype={save:function(){this.transformStack.push(this.transformMatrix);var e=this.current;this.extraStack.push(e),this.current=e.clone()},restore:function(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null},group:function(e){this.save(),this.executeOpTree(e),this.restore()},loadDependencies:function(e){for(var t=this,r=e.fnArray,n=r.length,a=e.argsArray,s=0;s1&&(d.vertical?c.canvasWidth=a.height*r._viewport.scale:c.canvasWidth=a.width*r._viewport.scale),r._textDivProperties.set(l,c),r._textContentStream&&r._layoutText(l),r._enhanceTextSelection){var v=1,b=0;0!==h&&(v=Math.cos(h),b=Math.sin(h));var _,y,A=(d.vertical?a.height:a.width)*r._viewport.scale,S=m;0!==h?(_=[v,b,-b,v,f,p],y=n.Util.getAxialAlignedBoundingBox([0,0,A,S],_)):y=[f,p,f+A,p+S],r._bounds.push({left:y[0],top:y[1],right:y[2],bottom:y[3],div:l,size:[A,S],m:_})}}function a(e){if(!e._canceled){var t=e._textDivs,r=e._capability,n=t.length;if(n>1e5)return e._renderingDone=!0,void r.resolve();if(!e._textContentStream)for(var i=0;i=0&&r[a].start>=e.y2;)a--;var s,o,l=-1/0;for(s=t;s<=a;s++){var c;(c=(i=(n=r[s]).boundary).x2>e.x1?i.index>e.index?i.x1New:e.x1:void 0===i.x2New?(i.x2+e.x1)/2:i.x2New)>l&&(l=c)}for(e.x1New=l,s=t;s<=a;s++)void 0===(i=(n=r[s]).boundary).x2New?i.x2>e.x1?i.index>e.index&&(i.x2New=i.x2):i.x2New=l:i.x2New>l&&(i.x2New=Math.max(l,i.x2));var u=[],h=null;for(s=t;s<=a;s++){var d=(i=(n=r[s]).boundary).x2>e.x2?i:e;h===d?u[u.length-1].end=n.end:(u.push({start:n.start,end:n.end,boundary:d}),h=d)}for(r[t].start=0&&r[o].start>=i.y1;o--)f=r[o].boundary===i;for(o=a+1;!f&&o0&&(r.scale=r.canvasWidth/s,o="scaleX("+r.scale+")"),0!==r.angle&&(o="rotate("+r.angle+"deg) "+o),""!==o&&(r.originalTransform=o,i.CustomStyle.setProp("transform",e,o)),this._textDivProperties.set(e,r),t.appendChild(e)}},_render:function(e){var t=this,r=(0,n.createPromiseCapability)(),i=Object.create(null),s=document.createElement("canvas");if(s.mozOpaque=!0,this._layoutTextCtx=s.getContext("2d",{alpha:!1}),this._textContent){var o=this._textContent.items,l=this._textContent.styles;this._processItems(o,l),r.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');this._reader=this._textContentStream.getReader(),function e(){t._reader.read().then((function(a){var s=a.value;a.done?r.resolve():(n.Util.extendObj(i,s.styles),t._processItems(s.items,i),e())}),r.reject)}()}r.promise.then((function(){i=null,e?t._renderTimer=setTimeout((function(){a(t),t._renderTimer=null}),e):a(t)}),this._capability.reject)},expandTextDivs:function(e){if(this._enhanceTextSelection&&this._renderingDone){null!==this._bounds&&(function(e){for(var t=e._bounds,r=e._viewport,i=function(e,t,r){var n=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}}));s(e,n);var i=new Array(r.length);return n.forEach((function(e){var t=e.index;i[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}})),r.map((function(t,r){var a=i[r],s=n[r];s.x1=t.top,s.y1=e-a.right,s.x2=t.bottom,s.y2=e-a.left,s.index=r,s.x1New=void 0,s.x2New=void 0})),s(t,n),n.forEach((function(e){var t=e.index;i[t].top=e.x1New,i[t].bottom=e.x2New})),i}(r.width,r.height,t),a=0;a0&&(n=n?Math.min(a,n):a)}return n},v=1+Math.min(Math.abs(d),Math.abs(f));l.paddingLeft=g(m,32,16)/v,l.paddingTop=g(m,48,16)/v,l.paddingRight=g(m,0,16)/v,l.paddingBottom=g(m,16,16)/v,e._textDivProperties.set(o,l)}else l.paddingLeft=t[a].left-i[a].left,l.paddingTop=t[a].top-i[a].top,l.paddingRight=i[a].right-t[a].right,l.paddingBottom=i[a].bottom-t[a].bottom,e._textDivProperties.set(o,l)}}(this),this._bounds=null);for(var t=0,r=this._textDivs.length;t\\376\\377([^<]+)/g,(function(e,t){for(var r=t.replace(/\\([0-3])([0-7])([0-7])/g,(function(e,t,r,n){return String.fromCharCode(64*t+8*r+1*n)})),n="",i=0;i=32&&a<127&&60!==a&&62!==a&&38!==a?String.fromCharCode(a):"&#x"+(65536+a).toString(16).substring(1)+";"}return">"+n}))}(e),e=(new DOMParser).parseFromString(e,"application/xml");else if(!(e instanceof Document))throw new Error("Metadata: Invalid metadata object");this.metaDocument=e,this.metadata=Object.create(null),this.parse()}Object.defineProperty(t,"__esModule",{value:!0}),n.prototype={parse:function(){var e=this.metaDocument.documentElement;if("rdf:rdf"!==e.nodeName.toLowerCase())for(e=e.firstChild;e&&"rdf:rdf"!==e.nodeName.toLowerCase();)e=e.nextSibling;var t=e?e.nodeName.toLowerCase():null;if(e&&"rdf:rdf"===t&&e.hasChildNodes()){var r,n,i,a,s,o,l,c=e.childNodes;for(a=0,o=c.length;a 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(i);var s={};s.gl=n,s.canvas=e,s.resolutionLocation=n.getUniformLocation(i,"u_resolution"),s.positionLocation=n.getAttribLocation(i,"a_position"),s.backdropLocation=n.getUniformLocation(i,"u_backdrop"),s.subtypeLocation=n.getUniformLocation(i,"u_subtype");var h=n.getAttribLocation(i,"a_texCoord"),d=n.getUniformLocation(i,"u_image"),f=n.getUniformLocation(i,"u_mask"),p=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,p),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),n.STATIC_DRAW),n.enableVertexAttribArray(h),n.vertexAttribPointer(h,2,n.FLOAT,!1,0,0),n.uniform1i(d,0),n.uniform1i(f,1),u=s}();var f=u,p=f.canvas,m=f.gl;p.width=h,p.height=d,m.viewport(0,0,m.drawingBufferWidth,m.drawingBufferHeight),m.uniform2f(f.resolutionLocation,h,d),i.backdrop?m.uniform4f(f.resolutionLocation,i.backdrop[0],i.backdrop[1],i.backdrop[2],1):m.uniform4f(f.resolutionLocation,0,0,0,0),m.uniform1i(f.subtypeLocation,"Luminosity"===i.subtype?1:0);var g=s(m,e,m.TEXTURE0),v=s(m,n,m.TEXTURE1),b=m.createBuffer();return m.bindBuffer(m.ARRAY_BUFFER,b),m.bufferData(m.ARRAY_BUFFER,new Float32Array([0,0,h,0,0,d,0,d,h,0,h,d]),m.STATIC_DRAW),m.enableVertexAttribArray(f.positionLocation),m.vertexAttribPointer(f.positionLocation,2,m.FLOAT,!1,0,0),m.clearColor(0,0,0,0),m.enable(m.BLEND),m.blendFunc(m.ONE,m.ONE_MINUS_SRC_ALPHA),m.clear(m.COLOR_BUFFER_BIT),m.drawArrays(m.TRIANGLES,0,6),m.flush(),m.deleteTexture(g),m.deleteTexture(v),m.deleteBuffer(b),p},drawFigures:function(e,n,i,s,u){h||function(){var e,n;c(),e=l,l=null,n=o,o=null;var i=a(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(i);var s={};s.gl=n,s.canvas=e,s.resolutionLocation=n.getUniformLocation(i,"u_resolution"),s.scaleLocation=n.getUniformLocation(i,"u_scale"),s.offsetLocation=n.getUniformLocation(i,"u_offset"),s.positionLocation=n.getAttribLocation(i,"a_position"),s.colorLocation=n.getAttribLocation(i,"a_color"),h=s}();var d=h,f=d.canvas,p=d.gl;f.width=e,f.height=n,p.viewport(0,0,p.drawingBufferWidth,p.drawingBufferHeight),p.uniform2f(d.resolutionLocation,e,n);var m,g,v,b=0;for(m=0,g=s.length;m=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),4===n.readyState&&e in this.pendingRequests)if(delete this.pendingRequests[e],0===n.status&&this.isHttp)r.onError&&r.onError(n.status);else{var i=n.status||200;if(200===i&&206===r.expectedStatus||i===r.expectedStatus){this.loadedRequests[e]=!0;var a=s(n);if(206===i){var o=n.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(o),c=parseInt(l[1],10);r.onDone({begin:c,chunk:a})}else r.onProgressiveData?r.onDone(null):a?r.onDone({begin:0,chunk:a}):r.onError&&r.onError(n.status)}else r.onError&&r.onError(n.status)}}},hasPendingRequests:function(){for(var e in this.pendingRequests)return!0;return!1},getRequestXhr:function(e){return this.pendingRequests[e].xhr},isStreamingRequest:function(e){return!!this.pendingRequests[e].onProgressiveData},isPendingRequest:function(e){return e in this.pendingRequests},isLoadedRequest:function(e){return e in this.loadedRequests},abortAllRequests:function(){for(var e in this.pendingRequests)this.abortRequest(0|e)},abortRequest:function(e){var t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}},l.prototype={_onRangeRequestReaderClosed:function(e){var t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)},getFullReader:function(){return(0,n.assert)(!this._fullRequestReader),this._fullRequestReader=new c(this._manager,this._options),this._fullRequestReader},getRangeReader:function(e,t){var r=new u(this._manager,e,t);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r},cancelAllRequests:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeRequestReaders.slice(0).forEach((function(t){t.cancel(e)}))}},c.prototype={_validateRangeRequestCapabilities:function(){if(this._disableRange)return!1;var e=this._manager;if(!e.isHttp)return!1;var t=this._fullRequestId,r=e.getRequestXhr(t);if("bytes"!==r.getResponseHeader("Accept-Ranges"))return!1;if("identity"!==(r.getResponseHeader("Content-Encoding")||"identity"))return!1;var i=r.getResponseHeader("Content-Length");return i=parseInt(i,10),!(!(0,n.isInt)(i)||(this._contentLength=i,i<=2*this._rangeChunkSize))},_onHeadersReceived:function(){this._validateRangeRequestCapabilities()&&(this._isRangeSupported=!0);var e=this._manager,t=this._fullRequestId;e.isStreamingRequest(t)?this._isStreamingSupported=!0:this._isRangeSupported&&e.abortRequest(t),this._headersReceivedCapability.resolve()},_onProgressiveData:function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e)},_onDone:function(e){e&&this._onProgressiveData(e.chunk),this._done=!0,this._cachedChunks.length>0||(this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[])},_onError:function(e){var t,r=this._url;t=404===e||0===e&&/^file:/.test(r)?new n.MissingPDFException('Missing PDF "'+r+'".'):new n.UnexpectedResponseException("Unexpected server response ("+e+') while retrieving PDF "'+r+'".',e),this._storedError=t,this._headersReceivedCapability.reject(t),this._requests.forEach((function(e){e.reject(t)})),this._requests=[],this._cachedChunks=[]},_onProgress:function(e){this.onProgress&&this.onProgress({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})},get isRangeSupported(){return this._isRangeSupported},get isStreamingSupported(){return this._isStreamingSupported},get contentLength(){return this._contentLength},get headersReady(){return this._headersReceivedCapability.promise},read:function(){if(this._storedError)return Promise.reject(this._storedError);if(this._cachedChunks.length>0){var e=this._cachedChunks.shift();return Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(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}},u.prototype={_close:function(){this.onClosed&&this.onClosed(this)},_onDone:function(e){var t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[],this._close()},_onProgress:function(e){!this.isStreamingSupported&&this.onProgress&&this.onProgress({loaded:e.loaded})},get isStreamingSupported(){return!1},read:function(){if(null!==this._queuedChunk){var e=this._queuedChunk;return this._queuedChunk=null,Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(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()}},(0,i.setPDFNetworkStreamClass)(l),t.PDFNetworkStream=l,t.NetworkManager=a},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){for(var r in t)e[r]=t[r]}(t,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}([function(e,t,r){var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},a=r(1).assert;function s(e){return"string"==typeof e||"symbol"===(void 0===e?"undefined":i(e))}function o(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}t.typeIsObject=function(e){return"object"===(void 0===e?"undefined":i(e))&&null!==e||"function"==typeof e},t.createDataProperty=function(e,r,n){a(t.typeIsObject(e)),Object.defineProperty(e,r,{value:n,writable:!0,enumerable:!0,configurable:!0})},t.createArrayFromList=function(e){return e.slice()},t.ArrayBufferCopy=function(e,t,r,n,i){new Uint8Array(e).set(new Uint8Array(r,n,i),t)},t.CreateIterResultObject=function(e,t){a("boolean"==typeof t);var r={};return Object.defineProperty(r,"value",{value:e,enumerable:!0,writable:!0,configurable:!0}),Object.defineProperty(r,"done",{value:t,enumerable:!0,writable:!0,configurable:!0}),r},t.IsFiniteNonNegativeNumber=function(e){return!(Number.isNaN(e)||e===1/0||e<0)},t.InvokeOrNoop=function(e,t,r){a(void 0!==e),a(s(t)),a(Array.isArray(r));var n=e[t];if(void 0!==n)return o(n,e,r)},t.PromiseInvokeOrNoop=function(e,r,n){a(void 0!==e),a(s(r)),a(Array.isArray(n));try{return Promise.resolve(t.InvokeOrNoop(e,r,n))}catch(e){return Promise.reject(e)}},t.PromiseInvokeOrPerformFallback=function(e,t,r,n,i){a(void 0!==e),a(s(t)),a(Array.isArray(r)),a(Array.isArray(i));var l=void 0;try{l=e[t]}catch(e){return Promise.reject(e)}if(void 0===l)return n.apply(null,i);try{return Promise.resolve(o(l,e,r))}catch(e){return Promise.reject(e)}},t.TransferArrayBuffer=function(e){return e.slice()},t.ValidateAndNormalizeHighWaterMark=function(e){if(e=Number(e),Number.isNaN(e)||e<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return e},t.ValidateAndNormalizeQueuingStrategy=function(e,r){if(void 0!==e&&"function"!=typeof e)throw new TypeError("size property of a queuing strategy must be a function");return{size:e,highWaterMark:r=t.ValidateAndNormalizeHighWaterMark(r)}}},function(e,t,r){function n(e){this.name="AssertionError",this.message=e||"",this.stack=(new Error).stack}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,e.exports={rethrowAssertionErrorRejection:function(e){e&&e.constructor===n&&setTimeout((function(){throw e}),0)},AssertionError:n,assert:function(e,t){if(!e)throw new n(t)}}},function(e,t,r){var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.size,a=r.highWaterMark,s=void 0===a?1:a;i(this,e),this._state="writable",this._storedError=void 0,this._writer=void 0,this._writableStreamController=void 0,this._writeRequests=[],this._inFlightWriteRequest=void 0,this._closeRequest=void 0,this._inFlightCloseRequest=void 0,this._pendingAbortRequest=void 0,this._backpressure=!1;var o=t.type;if(void 0!==o)throw new RangeError("Invalid type is specified");this._writableStreamController=new N(this,t,n,s),this._writableStreamController.__startSteps()}return n(e,[{key:"abort",value:function(e){return!1===y(this)?Promise.reject(B("abort")):!0===A(this)?Promise.reject(new TypeError("Cannot abort a stream that already has a writer")):S(this,e)}},{key:"getWriter",value:function(){if(!1===y(this))throw B("getWriter");return _(this)}},{key:"locked",get:function(){if(!1===y(this))throw B("locked");return A(this)}}]),e}();function _(e){return new E(e)}function y(e){return!!c(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function A(e){return h(!0===y(e),"IsWritableStreamLocked should only be used on known writable streams"),void 0!==e._writer}function S(e,t){var r=e._state;if("closed"===r)return Promise.resolve(void 0);if("errored"===r)return Promise.reject(e._storedError);var n=new TypeError("Requested to abort");if(void 0!==e._pendingAbortRequest)return Promise.reject(n);h("writable"===r||"erroring"===r,"state must be writable or erroring");var i=!1;"erroring"===r&&(i=!0,t=void 0);var a=new Promise((function(r,n){e._pendingAbortRequest={_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:i}}));return!1===i&&P(e,n),a}function w(e,t){var r=e._state;"writable"!==r?(h("erroring"===r),C(e)):P(e,t)}function P(e,t){h(void 0===e._storedError,"stream._storedError === undefined"),h("writable"===e._state,"state must be writable");var r=e._writableStreamController;h(void 0!==r,"controller must not be undefined"),e._state="erroring",e._storedError=t;var n=e._writer;void 0!==n&&D(n,t),!1===k(e)&&!0===r._started&&C(e)}function C(e){h("erroring"===e._state,"stream._state === erroring"),h(!1===k(e),"WritableStreamHasOperationMarkedInFlight(stream) === false"),e._state="errored",e._writableStreamController.__errorSteps();for(var t=e._storedError,r=0;r0,"Spec-level failure: should never dequeue from an empty queue.");var t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value},t.EnqueueValueWithSize=function(e,t,r){if(i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and [[queueTotalSize]]."),r=Number(r),!n(r))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r},t.PeekQueueValue=function(e){return i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]]."),i(e._queue.length>0,"Spec-level failure: should never peek at an empty queue."),e._queue[0].value},t.ResetQueue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]]."),e._queue=[],e._queueTotalSize=0}},function(e,t,r){var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.size,a=r.highWaterMark;i(this,e),this._state="readable",this._reader=void 0,this._storedError=void 0,this._disturbed=!1,this._readableStreamController=void 0;var s=t.type,o=String(s);if("bytes"===o)void 0===a&&(a=0),this._readableStreamController=new fe(this,t,a);else{if(void 0!==s)throw new RangeError("Invalid type is specified");void 0===a&&(a=1),this._readableStreamController=new ie(this,t,n,a)}}return n(e,[{key:"cancel",value:function(e){return!1===M(this)?Promise.reject(Ee("cancel")):!0===j(this)?Promise.reject(new TypeError("Cannot cancel a stream that already has a reader")):B(this,e)}},{key:"getReader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mode;if(!1===M(this))throw Ee("getReader");if(void 0===t)return N(this);if("byob"===(t=String(t)))return F(this);throw new RangeError("Invalid mode is specified")}},{key:"pipeThrough",value:function(e,t){var r=e.writable,n=e.readable;return function(e){try{Promise.prototype.then.call(e,void 0,(function(){}))}catch(e){}}(this.pipeTo(r,t)),n}},{key:"pipeTo",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.preventClose,i=r.preventAbort,a=r.preventCancel;if(!1===M(this))return Promise.reject(Ee("pipeTo"));if(!1===k(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));if(n=Boolean(n),i=Boolean(i),a=Boolean(a),!0===j(this))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(!0===x(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));var s=N(this),o=R(e),l=!1,c=Promise.resolve();return new Promise((function(r,u){var h,d,f;if(g(t,s._closedPromise,(function(t){!1===i?v((function(){return T(e,t)}),!0,t):b(!0,t)})),g(e,o._closedPromise,(function(e){!1===a?v((function(){return B(t,e)}),!0,e):b(!0,e)})),h=t,d=s._closedPromise,f=function(){!1===n?v((function(){return E(o)})):b()},"closed"===h._state?f():d.then(f).catch(y),!0===D(e)||"closed"===e._state){var p=new TypeError("the destination writable stream closed before all data could be piped to it");!1===a?v((function(){return B(t,p)}),!0,p):b(!0,p)}function m(){var e=c;return c.then((function(){return e!==c?m():void 0}))}function g(e,t,r){"errored"===e._state?r(e._storedError):t.catch(r).catch(y)}function v(t,r,n){function i(){t().then((function(){return _(r,n)}),(function(e){return _(!0,e)})).catch(y)}!0!==l&&(l=!0,"writable"===e._state&&!1===D(e)?m().then(i):i())}function b(t,r){!0!==l&&(l=!0,"writable"===e._state&&!1===D(e)?m().then((function(){return _(t,r)})).catch(y):_(t,r))}function _(e,t){I(o),re(s),e?u(t):r(void 0)}(function e(){return c=Promise.resolve(),!0===l?Promise.resolve():o._readyPromise.then((function(){return ne(s).then((function(e){var t=e.value;!0!==e.done&&(c=L(o,t).catch((function(){})))}))})).then(e)})().catch((function(e){c=Promise.resolve(),y(e)}))}))}},{key:"tee",value:function(){if(!1===M(this))throw Ee("tee");var e=q(this,!1);return m(e)}},{key:"locked",get:function(){if(!1===M(this))throw Ee("locked");return j(this)}}]),e}();function F(e){return new K(e)}function N(e){return new Q(e)}function M(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function j(e){return _(!0===M(e),"IsReadableStreamLocked should only be used on known readable streams"),void 0!==e._reader}function q(e,t){_(!0===M(e)),_("boolean"==typeof t);var r=N(e),n={closedOrErrored:!1,canceled1:!1,canceled2:!1,reason1:void 0,reason2:void 0};n.promise=new Promise((function(e){n._resolve=e}));var i=function e(){var t=e._branch1,r=e._branch2,n=e._teeState;return ne(e._reader).then((function(e){_(v(e));var i=e.value,a=e.done;if(_("boolean"==typeof a),!0===a&&!1===n.closedOrErrored&&(!1===n.canceled1&&oe(t),!1===n.canceled2&&oe(r),n.closedOrErrored=!0),!0!==n.closedOrErrored){var s=i,o=i;!1===n.canceled1&&le(t,s),!1===n.canceled2&&le(r,o)}}))};i._reader=r,i._teeState=n,i._cloneForBranch2=t;var a=function e(t){var r=e._stream,n=e._teeState;if(n.canceled1=!0,n.reason1=t,!0===n.canceled2){var i=B(r,m([n.reason1,n.reason2]));n._resolve(i)}return n.promise};a._stream=e,a._teeState=n;var s=function e(t){var r=e._stream,n=e._teeState;if(n.canceled2=!0,n.reason2=t,!0===n.canceled1){var i=B(r,m([n.reason1,n.reason2]));n._resolve(i)}return n.promise};s._stream=e,s._teeState=n;var o=Object.create(Object.prototype);g(o,"pull",i),g(o,"cancel",a);var l=new O(o),c=Object.create(Object.prototype);g(c,"pull",i),g(c,"cancel",s);var u=new O(c);return i._branch1=l._readableStreamController,i._branch2=u._readableStreamController,r._closedPromise.catch((function(e){!0!==n.closedOrErrored&&(ce(i._branch1,e),ce(i._branch2,e),n.closedOrErrored=!0)})),[l,u]}function U(e){return _(!0===$(e._reader)),_("readable"===e._state||"closed"===e._state),new Promise((function(t,r){var n={_resolve:t,_reject:r};e._reader._readIntoRequests.push(n)}))}function W(e){return _(!0===Z(e._reader)),_("readable"===e._state),new Promise((function(t,r){var n={_resolve:t,_reject:r};e._reader._readRequests.push(n)}))}function B(e,t){return e._disturbed=!0,"closed"===e._state?Promise.resolve(void 0):"errored"===e._state?Promise.reject(e._storedError):(z(e),e._readableStreamController.__cancelSteps(t).then((function(){})))}function z(e){_("readable"===e._state),e._state="closed";var t=e._reader;if(void 0!==t){if(!0===Z(t)){for(var r=0;r0),n._readRequests.shift()._resolve(o(t,r))}function X(e){return e._reader._readIntoRequests.length}function Y(e){return e._reader._readRequests.length}function V(e){var t=e._reader;return void 0!==t&&!1!==$(t)}function J(e){var t=e._reader;return void 0!==t&&!1!==Z(t)}e.exports={ReadableStream:O,IsReadableStreamDisturbed:function(e){return _(!0===M(e),"IsReadableStreamDisturbed should only be used on known readable streams"),e._disturbed},ReadableStreamDefaultControllerClose:oe,ReadableStreamDefaultControllerEnqueue:le,ReadableStreamDefaultControllerError:ce,ReadableStreamDefaultControllerGetDesiredSize:he};var Q=function(){function e(t){if(i(this,e),!1===M(t))throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===j(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ee(this,t),this._readRequests=[]}return n(e,[{key:"cancel",value:function(e){return!1===Z(this)?Promise.reject(Le("cancel")):void 0===this._ownerReadableStream?Promise.reject(Ie("cancel")):te(this,e)}},{key:"read",value:function(){return!1===Z(this)?Promise.reject(Le("read")):void 0===this._ownerReadableStream?Promise.reject(Ie("read from")):ne(this)}},{key:"releaseLock",value:function(){if(!1===Z(this))throw Le("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");re(this)}}},{key:"closed",get:function(){return!1===Z(this)?Promise.reject(Le("closed")):this._closedPromise}}]),e}(),K=function(){function e(t){if(i(this,e),!M(t))throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===pe(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(j(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ee(this,t),this._readIntoRequests=[]}return n(e,[{key:"cancel",value:function(e){return $(this)?void 0===this._ownerReadableStream?Promise.reject(Ie("cancel")):te(this,e):Promise.reject(Oe("cancel"))}},{key:"read",value:function(e){return $(this)?void 0===this._ownerReadableStream?Promise.reject(Ie("read from")):ArrayBuffer.isView(e)?0===e.byteLength?Promise.reject(new TypeError("view must have non-zero byteLength")):function(e,t){var r=e._ownerReadableStream;return _(void 0!==r),r._disturbed=!0,"errored"===r._state?Promise.reject(r._storedError):function(e,t){var r=e._controlledReadableStream,n=1;t.constructor!==DataView&&(n=t.constructor.BYTES_PER_ELEMENT);var i=t.constructor,a={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:n,ctor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return a.buffer=h(a.buffer),e._pendingPullIntos.push(a),U(r);if("closed"===r._state){var s=new t.constructor(a.buffer,a.byteOffset,0);return Promise.resolve(o(s,!0))}if(e._queueTotalSize>0){if(!0===Ae(e,a)){var l=_e(a);return we(e),Promise.resolve(o(l,!1))}if(!0===e._closeRequested){var c=new TypeError("Insufficient bytes to fill elements in the given buffer");return xe(e,c),Promise.reject(c)}}a.buffer=h(a.buffer),e._pendingPullIntos.push(a);var u=U(r);return ge(e),u}(r._readableStreamController,t)}(this,e):Promise.reject(new TypeError("view must be an array buffer view")):Promise.reject(Oe("read"))}},{key:"releaseLock",value:function(){if(!$(this))throw Oe("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");re(this)}}},{key:"closed",get:function(){return $(this)?this._closedPromise:Promise.reject(Oe("closed"))}}]),e}();function $(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Z(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function ee(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?function(e){e._closedPromise=new Promise((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r}))}(e):"closed"===t._state?function(e){e._closedPromise=Promise.resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e):(_("errored"===t._state,"state must be errored"),function(e,t){e._closedPromise=Promise.reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e,t._storedError),e._closedPromise.catch((function(){})))}function te(e,t){var r=e._ownerReadableStream;return _(void 0!==r),B(r,t)}function re(e){_(void 0!==e._ownerReadableStream),_(e._ownerReadableStream._reader===e),"readable"===e._ownerReadableStream._state?De(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){_(void 0===e._closedPromise_resolve),_(void 0===e._closedPromise_reject),e._closedPromise=Promise.reject(t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._closedPromise.catch((function(){})),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function ne(e){var t=e._ownerReadableStream;return _(void 0!==t),t._disturbed=!0,"closed"===t._state?Promise.resolve(o(void 0,!0)):"errored"===t._state?Promise.reject(t._storedError):(_("readable"===t._state),t._readableStreamController.__pullSteps())}var ie=function(){function e(t,r,n,a){if(i(this,e),!1===M(t))throw new TypeError("ReadableStreamDefaultController can only be constructed with a ReadableStream instance");if(void 0!==t._readableStreamController)throw new TypeError("ReadableStreamDefaultController instances can only be created by the ReadableStream constructor");this._controlledReadableStream=t,this._underlyingSource=r,this._queue=void 0,this._queueTotalSize=void 0,P(this),this._started=!1,this._closeRequested=!1,this._pullAgain=!1,this._pulling=!1;var s=d(n,a);this._strategySize=s.size,this._strategyHWM=s.highWaterMark;var o=this,l=c(r,"start",[this]);Promise.resolve(l).then((function(){o._started=!0,_(!1===o._pulling),_(!1===o._pullAgain),se(o)}),(function(e){ue(o,e)})).catch(y)}return n(e,[{key:"close",value:function(){if(!1===ae(this))throw Fe("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");oe(this)}},{key:"enqueue",value:function(e){if(!1===ae(this))throw Fe("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");return le(this,e)}},{key:"error",value:function(e){if(!1===ae(this))throw Fe("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");ce(this,e)}},{key:"__cancelSteps",value:function(e){return P(this),u(this._underlyingSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;if(this._queue.length>0){var t=S(this);return!0===this._closeRequested&&0===this._queue.length?z(e):se(this),Promise.resolve(o(t,!1))}var r=W(e);return se(this),r}},{key:"desiredSize",get:function(){if(!1===ae(this))throw Fe("desiredSize");return he(this)}}]),e}();function ae(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingSource")}function se(e){!1!==function(e){var t=e._controlledReadableStream;return"closed"!==t._state&&"errored"!==t._state&&!0!==e._closeRequested&&!1!==e._started&&(!0===j(t)&&Y(t)>0||he(e)>0)}(e)&&(!0!==e._pulling?(_(!1===e._pullAgain),e._pulling=!0,u(e._underlyingSource,"pull",[e]).then((function(){if(e._pulling=!1,!0===e._pullAgain)return e._pullAgain=!1,se(e)}),(function(t){ue(e,t)})).catch(y)):e._pullAgain=!0)}function oe(e){var t=e._controlledReadableStream;_(!1===e._closeRequested),_("readable"===t._state),e._closeRequested=!0,0===e._queue.length&&z(t)}function le(e,t){var r=e._controlledReadableStream;if(_(!1===e._closeRequested),_("readable"===r._state),!0===j(r)&&Y(r)>0)H(r,t,!1);else{var n=1;if(void 0!==e._strategySize){var i=e._strategySize;try{n=i(t)}catch(t){throw ue(e,t),t}}try{w(e,t,n)}catch(t){throw ue(e,t),t}}se(e)}function ce(e,t){var r=e._controlledReadableStream;_("readable"===r._state),P(e),G(r,t)}function ue(e,t){"readable"===e._controlledReadableStream._state&&ce(e,t)}function he(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}var de=function(){function e(t,r){i(this,e),this._associatedReadableByteStreamController=t,this._view=r}return n(e,[{key:"respond",value:function(e){if(!1===me(this))throw Ne("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){if(t=Number(t),!1===l(t))throw new RangeError("bytesWritten must be a finite");_(e._pendingPullIntos.length>0),Re(e,t)}(this._associatedReadableByteStreamController,e)}},{key:"respondWithNewView",value:function(e){if(!1===me(this))throw Ne("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");!function(e,t){_(e._pendingPullIntos.length>0);var r=e._pendingPullIntos[0];if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,Re(e,t.byteLength)}(this._associatedReadableByteStreamController,e)}},{key:"view",get:function(){return this._view}}]),e}(),fe=function(){function e(t,r,n){if(i(this,e),!1===M(t))throw new TypeError("ReadableByteStreamController can only be constructed with a ReadableStream instance given a byte source");if(void 0!==t._readableStreamController)throw new TypeError("ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte source");this._controlledReadableStream=t,this._underlyingByteSource=r,this._pullAgain=!1,this._pulling=!1,ve(this),this._queue=this._queueTotalSize=void 0,P(this),this._closeRequested=!1,this._started=!1,this._strategyHWM=f(n);var a=r.autoAllocateChunkSize;if(void 0!==a&&(!1===Number.isInteger(a)||a<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");this._autoAllocateChunkSize=a,this._pendingPullIntos=[];var s=this,o=c(r,"start",[this]);Promise.resolve(o).then((function(){s._started=!0,_(!1===s._pulling),_(!1===s._pullAgain),ge(s)}),(function(e){"readable"===t._state&&xe(s,e)})).catch(y)}return n(e,[{key:"close",value:function(){if(!1===pe(this))throw Me("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableStream;if(_(!1===e._closeRequested),_("readable"===t._state),e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0&&e._pendingPullIntos[0].bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw xe(e,r),r}z(t)}}(this)}},{key:"enqueue",value:function(e){if(!1===pe(this))throw Me("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(e))throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");!function(e,t){var r=e._controlledReadableStream;_(!1===e._closeRequested),_("readable"===r._state);var n=t.buffer,i=t.byteOffset,a=t.byteLength,s=h(n);!0===J(r)?0===Y(r)?ye(e,s,i,a):(_(0===e._queue.length),H(r,new Uint8Array(s,i,a),!1)):!0===V(r)?(ye(e,s,i,a),Ce(e)):(_(!1===j(r),"stream must not be locked"),ye(e,s,i,a))}(this,e)}},{key:"error",value:function(e){if(!1===pe(this))throw Me("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");xe(this,e)}},{key:"__cancelSteps",value:function(e){return this._pendingPullIntos.length>0&&(this._pendingPullIntos[0].bytesFilled=0),P(this),u(this._underlyingByteSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;if(_(!0===J(e)),this._queueTotalSize>0){_(0===Y(e));var t=this._queue.shift();this._queueTotalSize-=t.byteLength,we(this);var r=void 0;try{r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch(e){return Promise.reject(e)}return Promise.resolve(o(r,!1))}var n=this._autoAllocateChunkSize;if(void 0!==n){var i=void 0;try{i=new ArrayBuffer(n)}catch(e){return Promise.reject(e)}var a={buffer:i,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(a)}var s=W(e);return ge(this),s}},{key:"byobRequest",get:function(){if(!1===pe(this))throw Me("byobRequest");if(void 0===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos[0],t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled);this._byobRequest=new de(this,t)}return this._byobRequest}},{key:"desiredSize",get:function(){if(!1===pe(this))throw Me("desiredSize");return Te(this)}}]),e}();function pe(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingByteSource")}function me(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function ge(e){!1!==function(e){var t=e._controlledReadableStream;return"readable"===t._state&&!0!==e._closeRequested&&!1!==e._started&&(!0===J(t)&&Y(t)>0||!0===V(t)&&X(t)>0||Te(e)>0)}(e)&&(!0!==e._pulling?(_(!1===e._pullAgain),e._pulling=!0,u(e._underlyingByteSource,"pull",[e]).then((function(){e._pulling=!1,!0===e._pullAgain&&(e._pullAgain=!1,ge(e))}),(function(t){"readable"===e._controlledReadableStream._state&&xe(e,t)})).catch(y)):e._pullAgain=!0)}function ve(e){Pe(e),e._pendingPullIntos=[]}function be(e,t){_("errored"!==e._state,"state must not be errored");var r=!1;"closed"===e._state&&(_(0===t.bytesFilled),r=!0);var n=_e(t);"default"===t.readerType?H(e,n,r):(_("byob"===t.readerType),function(e,t,r){var n=e._reader;_(n._readIntoRequests.length>0),n._readIntoRequests.shift()._resolve(o(t,r))}(e,n,r))}function _e(e){var t=e.bytesFilled,r=e.elementSize;return _(t<=e.byteLength),_(t%r==0),new e.ctor(e.buffer,e.byteOffset,t/r)}function ye(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function Ae(e,t){var r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,o=a-a%r,l=i,c=!1;o>n&&(l=o-t.bytesFilled,c=!0);for(var u=e._queue;l>0;){var h=u[0],d=Math.min(l,h.byteLength),f=t.byteOffset+t.bytesFilled;s(t.buffer,f,h.buffer,h.byteOffset,d),h.byteLength===d?u.shift():(h.byteOffset+=d,h.byteLength-=d),e._queueTotalSize-=d,Se(e,d,t),l-=d}return!1===c&&(_(0===e._queueTotalSize,"queue must be empty"),_(t.bytesFilled>0),_(t.bytesFilled0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos[0];!0===Ae(e,t)&&(ke(e),be(e._controlledReadableStream,t))}}function Re(e,t){var r=e._pendingPullIntos[0],n=e._controlledReadableStream;if("closed"===n._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=h(t.buffer),_(0===t.bytesFilled,"bytesFilled must be 0");var r=e._controlledReadableStream;if(!0===V(r))for(;X(r)>0;)be(r,ke(e))}(e,r)}else _("readable"===n._state),function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(Se(e,t,r),!(r.bytesFilled0){var i=r.byteOffset+r.bytesFilled,a=r.buffer.slice(i-n,i);ye(e,a,0,a.byteLength)}r.buffer=h(r.buffer),r.bytesFilled-=n,be(e._controlledReadableStream,r),Ce(e)}}(e,t,r)}function ke(e){var t=e._pendingPullIntos.shift();return Pe(e),t}function xe(e,t){var r=e._controlledReadableStream;_("readable"===r._state),ve(e),P(e),G(r,t)}function Te(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ee(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function Ie(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Le(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}function De(e,t){_(void 0!==e._closedPromise_resolve),_(void 0!==e._closedPromise_reject),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}function Oe(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Fe(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function Ne(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function Me(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}},function(e,t,r){var n=r(6),i=r(4),a=r(2);t.TransformStream=n.TransformStream,t.ReadableStream=i.ReadableStream,t.IsReadableStreamDisturbed=i.IsReadableStreamDisturbed,t.ReadableStreamDefaultControllerClose=i.ReadableStreamDefaultControllerClose,t.ReadableStreamDefaultControllerEnqueue=i.ReadableStreamDefaultControllerEnqueue,t.ReadableStreamDefaultControllerError=i.ReadableStreamDefaultControllerError,t.ReadableStreamDefaultControllerGetDesiredSize=i.ReadableStreamDefaultControllerGetDesiredSize,t.AcquireWritableStreamDefaultWriter=a.AcquireWritableStreamDefaultWriter,t.IsWritableStream=a.IsWritableStream,t.IsWritableStreamLocked=a.IsWritableStreamLocked,t.WritableStream=a.WritableStream,t.WritableStreamAbort=a.WritableStreamAbort,t.WritableStreamDefaultControllerError=a.WritableStreamDefaultControllerError,t.WritableStreamDefaultWriterCloseWithErrorPropagation=a.WritableStreamDefaultWriterCloseWithErrorPropagation,t.WritableStreamDefaultWriterRelease=a.WritableStreamDefaultWriterRelease,t.WritableStreamDefaultWriterWrite=a.WritableStreamDefaultWriterWrite},function(e,t,r){var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this._transformer=t;var r=t.readableStrategy,n=t.writableStrategy;this._transforming=!1,this._errored=!1,this._storedError=void 0,this._writableController=void 0,this._readableController=void 0,this._transformStreamController=void 0,this._writableDone=!1,this._readableClosed=!1,this._backpressure=void 0,this._backpressureChangePromise=void 0,this._backpressureChangePromise_resolve=void 0,this._transformStreamController=new I(this);var s=void 0,l=new Promise((function(e){s=e})),c=new E(this,l);this._readable=new d(c,r);var u=new T(this,l);this._writable=new b(u,n),a(void 0!==this._writableController),a(void 0!==this._readableController);var h=g(this._readableController);C(this,h<=0);var f=this,p=o(t,"start",[f._transformStreamController]);s(p),l.catch((function(e){!1===f._errored&&(f._errored=!0,f._storedError=e)}))}return n(e,[{key:"readable",get:function(){if(!1===x(this))throw O("readable");return this._readable}},{key:"writable",get:function(){if(!1===x(this))throw O("writable");return this._writable}}]),e}();function D(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function O(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}e.exports={TransformStream:L}},function(e,t,r){e.exports=r(5)}]))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var n=r(0),i=r(13),a=r(7),s={get value(){return(0,n.shadow)(s,"value",(0,n.isLittleEndian)())}};function o(e){e.mozCurrentTransform||(e._originalSave=e.save,e._originalRestore=e.restore,e._originalRotate=e.rotate,e._originalScale=e.scale,e._originalTranslate=e.translate,e._originalTransform=e.transform,e._originalSetTransform=e.setTransform,e._transformMatrix=e._transformMatrix||[1,0,0,1,0,0],e._transformStack=[],Object.defineProperty(e,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(e,"mozCurrentTransformInverse",{get:function(){var e=this._transformMatrix,t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],s=e[5],o=t*i-r*n,l=r*n-t*i;return[i/o,r/l,n/l,t/o,(i*a-n*s)/l,(r*a-t*s)/o]}}),e.save=function(){var e=this._transformMatrix;this._transformStack.push(e),this._transformMatrix=e.slice(0,6),this._originalSave()},e.restore=function(){var e=this._transformStack.pop();e&&(this._transformMatrix=e,this._originalRestore())},e.translate=function(e,t){var r=this._transformMatrix;r[4]=r[0]*e+r[2]*t+r[4],r[5]=r[1]*e+r[3]*t+r[5],this._originalTranslate(e,t)},e.scale=function(e,t){var r=this._transformMatrix;r[0]=r[0]*e,r[1]=r[1]*e,r[2]=r[2]*t,r[3]=r[3]*t,this._originalScale(e,t)},e.transform=function(t,r,n,i,a,s){var o=this._transformMatrix;this._transformMatrix=[o[0]*t+o[2]*r,o[1]*t+o[3]*r,o[0]*n+o[2]*i,o[1]*n+o[3]*i,o[0]*a+o[2]*s+o[4],o[1]*a+o[3]*s+o[5]],e._originalTransform(t,r,n,i,a,s)},e.setTransform=function(t,r,n,i,a,s){this._transformMatrix=[t,r,n,i,a,s],e._originalSetTransform(t,r,n,i,a,s)},e.rotate=function(e){var t=Math.cos(e),r=Math.sin(e),n=this._transformMatrix;this._transformMatrix=[n[0]*t+n[2]*r,n[1]*t+n[3]*r,n[0]*-r+n[2]*t,n[1]*-r+n[3]*t,n[4],n[5]],this._originalRotate(e)})}var l=function(){function e(e){this.canvasFactory=e,this.cache=Object.create(null)}return e.prototype={getCanvas:function(e,t,r,n){var i;return void 0!==this.cache[e]?(i=this.cache[e],this.canvasFactory.reset(i,t,r),i.context.setTransform(1,0,0,1,0,0)):(i=this.canvasFactory.create(t,r),this.cache[e]=i),n&&o(i.context),i},clear:function(){for(var e in this.cache){var t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}},e}(),c=function(){function e(){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=n.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=n.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=n.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.resumeSMaskCtx=null}return e.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(e,t){this.x=e,this.y=t}},e}(),u=function(){function e(e,t,r,n,i){this.ctx=e,this.current=new c,this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=r,this.canvasFactory=n,this.imageLayer=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.cachedCanvases=new l(this.canvasFactory),e&&o(e),this.cachedGetSinglePixelWidth=null}function t(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)e.putImageData(t,0,0);else{var r,i,a,o,l,c=t.height,u=t.width,h=c%16,d=(c-h)/16,f=0===h?d:d+1,p=e.createImageData(u,16),m=0,g=t.data,v=p.data;if(t.kind===n.ImageKind.GRAYSCALE_1BPP){var b=g.byteLength,_=new Uint32Array(v.buffer,0,v.byteLength>>2),y=_.length,A=u+7>>3,S=4294967295,w=s.value?4278190080:255;for(i=0;iA?u:8*P-7,k=-8&R,x=0,T=0;C>=1}for(;r=d&&(l=u*(o=h)),r=0,a=l;a--;)v[r++]=g[m++],v[r++]=g[m++],v[r++]=g[m++],v[r++]=255;e.putImageData(p,0,16*i)}}}}function r(e,t){for(var r=t.height,n=t.width,i=r%16,a=(r-i)/16,s=0===i?a:a+1,o=e.createImageData(n,16),l=0,c=t.data,u=o.data,h=0;h>=1}e.putImageData(o,0,16*h)}}function u(e,t){for(var r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],n=0,i=r.length;n>8,e[a-2]=e[a-2]*s+r*o>>8,e[a-1]=e[a-1]*s+n*o>>8}}}function f(e,t,r){for(var n=e.length,i=3;i>8]>>8:t[i]*a>>16}}function m(e,t,r){var n=t.canvas,i=t.context;e.setTransform(t.scaleX,0,0,t.scaleY,t.offsetX,t.offsetY);var s=t.backdrop||null;if(!t.transferMap&&a.WebGLUtils.isEnabled){var o=a.WebGLUtils.composeSMask(r.canvas,n,{subtype:t.subtype,backdrop:s});return e.setTransform(1,0,0,1,0,0),void e.drawImage(o,t.offsetX,t.offsetY)}!function(e,t,r,n,i,a,s){var o,l=!!a,c=l?a[0]:0,u=l?a[1]:0,h=l?a[2]:0;o="Luminosity"===i?p:f;for(var m=Math.min(n,Math.ceil(1048576/r)),g=0;g10&&"function"==typeof r,h=u?Date.now()+15:0,d=0,f=this.commonObjs,p=this.objs;;){if(void 0!==i&&o===i.nextBreakPoint)return i.breakIt(o,r),o;if((c=s[o])!==n.OPS.dependency)this[c].apply(this,a[o]);else for(var m=a[o],g=0,v=m.length;g10){if(Date.now()>h)return r(),o;d=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(),a.WebGLUtils.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=v[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:function(e){},setFlatness:function(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=a?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,n="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(n,t,r,!0),a=this.ctx,s=a.mozCurrentTransform;this.ctx.save();var o=i.context;o.scale(1/e.scaleX,1/e.scaleY),o.translate(-e.offsetX,-e.offsetY),o.transform.apply(o,s),e.startTransformInverse=o.mozCurrentTransformInverse,u(a,o),this.ctx=o,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(a),this.groupLevel++},suspendSMaskGroup:function(){var e=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),m(this.ctx,this.current.activeSMask,e),this.ctx.restore(),this.ctx.save(),u(e,this.ctx),this.current.resumeSMaskCtx=e;var t=n.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(),m(this.ctx,this.current.activeSMask,e),this.ctx.restore(),u(e,this.ctx);var t=n.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,n,i,a){this.ctx.transform(e,t,r,n,i,a),this.cachedGetSinglePixelWidth=null},constructPath:function(e,t){for(var r=this.ctx,i=this.current,a=i.x,s=i.y,o=0,l=0,c=e.length;o100?100:t;this.current.fontSizeScale=t/c;var u=o+" "+s+" "+c+"px "+l;this.ctx.font=u}},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,n,i,a){this.current.textMatrix=[e,t,r,n,i,a],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:function(e,t,r){var i,a=this.ctx,s=this.current,o=s.font,l=s.textRenderingMode,c=s.fontSize/s.fontSizeScale,u=l&n.TextRenderingMode.FILL_STROKE_MASK,h=!!(l&n.TextRenderingMode.ADD_TO_PATH_FLAG);(o.disableFontFace||h)&&(i=o.getPathGenerator(this.commonObjs,e)),o.disableFontFace?(a.save(),a.translate(t,r),a.beginPath(),i(a,c),u!==n.TextRenderingMode.FILL&&u!==n.TextRenderingMode.FILL_STROKE||a.fill(),u!==n.TextRenderingMode.STROKE&&u!==n.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(u!==n.TextRenderingMode.FILL&&u!==n.TextRenderingMode.FILL_STROKE||a.fillText(e,t,r),u!==n.TextRenderingMode.STROKE&&u!==n.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,r)),h&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:a.mozCurrentTransform,x:t,y:r,fontSize:c,addToPath:i})},get isFontSubpixelAAEnabled(){var e=this.canvasFactory.create(10,10).context;e.scale(1.5,1),e.fillText("I",0,10);for(var t=e.getImageData(0,0,10,10).data,r=!1,i=3;i0&&t[i]<255){r=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",r)},showText:function(e){var t=this.current,r=t.font;if(r.isType3Font)return this.showType3Text(e);var i=t.fontSize;if(0!==i){var a=this.ctx,s=t.fontSizeScale,o=t.charSpacing,l=t.wordSpacing,c=t.fontDirection,u=t.textHScale*c,h=e.length,d=r.vertical,f=d?1:-1,p=r.defaultVMetrics,m=i*t.fontMatrix[0],g=t.textRenderingMode===n.TextRenderingMode.FILL&&!r.disableFontFace;a.save(),a.transform.apply(a,t.textMatrix),a.translate(t.x,t.y+t.textRise),t.patternFill&&(a.fillStyle=t.fillColor.getPattern(a,this)),c>0?a.scale(u,-1):a.scale(u,1);var v=t.lineWidth,b=t.textMatrixScale;if(0===b||0===v){var _=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;_!==n.TextRenderingMode.STROKE&&_!==n.TextRenderingMode.FILL_STROKE||(this.cachedGetSinglePixelWidth=null,v=.65*this.getSinglePixelWidth())}else v/=b;1!==s&&(a.scale(s,s),v/=s),a.lineWidth=v;var y,A=0;for(y=0;y0){var F=1e3*a.measureText(L).width/i*s;if(O4096&&(h=l/4096,l=4096),c>4096&&(d=c/4096,c=4096);var f="groupAt"+this.groupLevel;e.smask&&(f+="_smask_"+this.smaskCounter++%2);var p=this.cachedCanvases.getCanvas(f,l,c,!0),m=p.context;m.scale(1/h,1/d),m.translate(-s,-o),m.transform.apply(m,r),e.smask?this.smaskStack.push({canvas:p.canvas,context:m,offsetX:s,offsetY:o,scaleX:h,scaleY:d,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(s,o),t.scale(h,d)),u(t,m),this.ctx=m,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(),h(this.ctx),this.current=new c,(0,n.isArray)(e)&&4===e.length){var i=e[2]-e[0],a=e[3]-e[1];this.ctx.rect(e[0],e[1],i,a),this.clip(),this.endPath()}this.transform.apply(this,t),this.transform.apply(this,r)},endAnnotation:function(){this.restore()},paintJpegXObject:function(e,t,r){var i=this.objs.get(e);if(i){this.save();var a=this.ctx;if(a.scale(1/t,-1/r),a.drawImage(i,0,0,i.width,i.height,0,-r,t,r),this.imageLayer){var s=a.mozCurrentTransformInverse,o=this.getCanvasPosition(0,0);this.imageLayer.appendImage({objId:e,left:o[0],top:o[1],width:t/s[0],height:r/s[3]})}this.restore()}else(0,n.warn)("Dependent image isn't ready yet")},paintImageMaskXObject:function(e){var t=this.ctx,n=e.width,i=e.height,a=this.current.fillColor,s=this.current.patternFill,o=this.processingType3;if(o&&void 0===o.compiled&&(o.compiled=n<=1e3&&i<=1e3?function(e){var t,r,n,i,a=e.width,s=e.height,o=a+1,l=new Uint8Array(o*(s+1)),c=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),u=a+7&-8,h=e.data,d=new Uint8Array(u*s),f=0;for(t=0,i=h.length;t0;)d[f++]=m&p?0:255,p>>=1;var g=0;for(0!==d[f=0]&&(l[0]=1,++g),r=1;r>2)+(d[f+1]?4:0)+(d[f-u+1]?8:0)]&&(l[n+r]=c[v],++g),f++;if(d[f-u]!==d[f]&&(l[n+r]=d[f]?2:4,++g),g>1e3)return null}for(n=t*o,0!==d[f=u*(s-1)]&&(l[n]=8,++g),r=1;r1e3)return null;var b=new Int32Array([0,o,-1,0,-o,0,0,0,1]),_=[];for(t=0;g&&t<=s;t++){for(var y=t*o,A=y+a;y>4,l[y]&=P>>2|P<<2),w.push(y%o),w.push(y/o|0),--g}while(C!==y);_.push(w),--t}}return function(e){e.save(),e.scale(1/a,-1/s),e.translate(0,-s),e.beginPath();for(var t=0,r=_.length;t2&&m>1||f>2&&g>1;){var b=m,_=g;u>2&&m>1&&(u/=m/(b=Math.ceil(m/2))),f>2&&g>1&&(f/=g/(_=Math.ceil(g/2))),(p=(s=this.cachedCanvases.getCanvas(v,b,_)).context).clearRect(0,0,b,_),p.drawImage(a,0,0,m,g,0,0,b,_),a=s.canvas,m=b,g=_,v="prescale1"===v?"prescale2":"prescale1"}if(i.drawImage(a,0,0,m,g,0,-n,r,n),this.imageLayer){var y=this.getCanvasPosition(0,-n);this.imageLayer.appendImage({imgData:e,left:y[0],top:y[1],width:r/o[0],height:n/o[3]})}this.restore()},paintInlineImageXObjectGroup:function(e,r){var n=this.ctx,i=e.width,a=e.height,s=this.cachedCanvases.getCanvas("inlineImage",i,a);t(s.context,e);for(var o=0,l=r.length;o0&&!i.isSyncFontLoadingSupported?this.prepareFontLoadEvent(r,a,p):p.complete()},i.prototype.queueLoadingCallback=function(e){var t=this.loadingContext,r={id:"pdfjs-font-loading-"+t.nextRequestId++,complete:function(){for((0,n.assert)(!r.end,"completeRequest() cannot be called twice"),r.end=Date.now();t.requests.length>0&&t.requests[0].end;){var e=t.requests.shift();setTimeout(e.callback,0)}},callback:e,started:Date.now()};return t.requests.push(r),r},i.prototype.prepareFontLoadEvent=function(e,t,r){function i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function a(e,t,r,n){return e.substr(0,t)+n+e.substr(t+r)}var s,o,l=document.createElement("canvas");l.width=1,l.height=1;var c=l.getContext("2d"),u=0,h="lt"+Date.now()+this.loadTestFontId++,d=this.loadTestFont,f=i(d=a(d,976,h.length,h),16);for(s=0,o=h.length-3;s30)return(0,n.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))}(h,(function(){document.body.removeChild(g),r.complete()}))},i.isFontLoadingAPISupported="undefined"!=typeof document&&!!document.fonts,Object.defineProperty(i,"isSyncFontLoadingSupported",{get:function(){return(0,n.shadow)(i,"isSyncFontLoadingSupported",function(){if("undefined"==typeof navigator)return!0;var e=!1,t=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);return t&&t[1]>=14&&(e=!0),e}())},enumerable:!0,configurable:!0});var a={get value(){return(0,n.shadow)(this,"value",(0,n.isEvalSupported)())}},s=function(){function e(e,t){for(var r in this.compiledGlyphs=Object.create(null),e)this[r]=e[r];this.options=t}return e.prototype={createNativeFontFace:function(){if(!this.data)return null;if(this.options.disableFontFace)return this.disableFontFace=!0,null;var e=new FontFace(this.loadedName,this.data,{});return this.options.fontRegistry&&this.options.fontRegistry.registerFont(this),e},createFontFaceRule:function(){if(!this.data)return null;if(this.options.disableFontFace)return this.disableFontFace=!0,null;var e=(0,n.bytesToString)(new Uint8Array(this.data)),t=this.loadedName,r="url(data:"+this.mimetype+";base64,"+btoa(e)+");",i='@font-face { font-family:"'+t+'";src:'+r+"}";return this.options.fontRegistry&&this.options.fontRegistry.registerFont(this,r),i},getPathGenerator:function(e,t){if(!(t in this.compiledGlyphs)){var r,n,i,s=e.get(this.loadedName+"_path_"+t);if(this.options.isEvalSupported&&a.value){var o,l="";for(n=0,i=s.length;nc[n+1]&&(l=r,r=n,n=l,l=a,a=s,s=l),c[n+1]>c[i+1]&&(l=n,n=i,i=l,l=s,s=o,o=l),c[r+1]>c[n+1]&&(l=r,r=n,n=l,l=a,a=s,s=l);var f=(c[r]+t.offsetX)*t.scaleX,p=(c[r+1]+t.offsetY)*t.scaleY,m=(c[n]+t.offsetX)*t.scaleX,g=(c[n+1]+t.offsetY)*t.scaleY,v=(c[i]+t.offsetX)*t.scaleX,b=(c[i+1]+t.offsetY)*t.scaleY;if(!(p>=b))for(var _,y,A,S,w,P,C,R,k,x=u[a],T=u[a+1],E=u[a+2],I=u[s],L=u[s+1],D=u[s+2],O=u[o],F=u[o+1],N=u[o+2],M=Math.round(p),j=Math.round(b),q=M;q<=j;q++){qb?1:g===b?0:(g-q)/(g-b)),y=I-(I-O)*k,A=L-(L-F)*k,S=D-(D-N)*k),w=f-(f-v)*(k=qb?1:(p-q)/(p-b)),P=x-(x-O)*k,C=T-(T-F)*k,R=E-(E-N)*k;for(var U=Math.round(Math.min(_,w)),W=Math.round(Math.max(_,w)),B=d*q+4*U,z=U;z<=W;z++)k=(k=(_-z)/(_-w))<0?0:k>1?1:k,h[B++]=y-(y-P)*k|0,h[B++]=A-(A-C)*k|0,h[B++]=S-(S-R)*k|0,h[B++]=255}}function t(t,r,n){var i,a,s=r.coords,o=r.colors;switch(r.type){case"lattice":var l=r.verticesPerRow,c=Math.floor(s.length/l)-1,u=l-1;for(i=0;i0){var a=new Uint8Array(i).buffer;this._queuedChunks.push(a)}this._pdfDataRangeTransport=t,this._isRangeSupported=!e.disableRange,this._isStreamingSupported=!e.disableStream,this._contentLength=e.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((function(e,t){r._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener((function(e){r._onProgress({loaded:e})})),this._pdfDataRangeTransport.addProgressiveReadListener((function(e){r._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.transportReady()}function t(e,t){this._stream=e,this._done=!1,this._queuedChunks=t||[],this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}function r(e,t,r){this._stream=e,this._begin=t,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}return e.prototype={_onReceiveData:function(e){var t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{var r=this._rangeReaders.some((function(r){return r._begin===e.begin&&(r._enqueue(t),!0)}));(0,n.assert)(r)}},_onProgress:function(e){if(this._rangeReaders.length>0){var t=this._rangeReaders[0];t.onProgress&&t.onProgress({loaded:e.loaded})}},_removeRangeReader:function(e){var t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)},getFullReader:function(){(0,n.assert)(!this._fullRequestReader);var e=this._queuedChunks;return this._queuedChunks=null,new t(this,e)},getRangeReader:function(e,t){var n=new r(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n},cancelAllRequests:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeReaders.slice(0).forEach((function(t){t.cancel(e)})),this._pdfDataRangeTransport.abort()}},t.prototype={_enqueue:function(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e))},get headersReady(){return this._headersReady},get isRangeSupported(){return this._stream._isRangeSupported},get isStreamingSupported(){return this._stream._isStreamingSupported},get contentLength(){return this._stream._contentLength},read:function(){if(this._queuedChunks.length>0){var e=this._queuedChunks.shift();return Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(e){this._done=!0,this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[]}},r.prototype={_enqueue:function(e){this._done||(0===this._requests.length?this._queuedChunk=e:(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},read:function(){if(this._queuedChunk){var e=this._queuedChunk;return this._queuedChunk=null,Promise.resolve({value:e,done:!1})}if(this._done)return Promise.resolve({value:void 0,done:!0});var t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise},cancel:function(e){this._done=!0,this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})})),this._requests=[],this._stream._removeRangeReader(this)}},e}();t.PDFDataTransportStream=i},function(e,t,r){"use strict";var n=r(0),i=r(8),a=r(2),s=r(5),o=r(3),l=r(1),c=r(4);r(9),t.PDFJS=i.PDFJS,t.build=a.build,t.version=a.version,t.getDocument=a.getDocument,t.LoopbackPort=a.LoopbackPort,t.PDFDataRangeTransport=a.PDFDataRangeTransport,t.PDFWorker=a.PDFWorker,t.renderTextLayer=s.renderTextLayer,t.AnnotationLayer=o.AnnotationLayer,t.CustomStyle=l.CustomStyle,t.createPromiseCapability=n.createPromiseCapability,t.PasswordResponses=n.PasswordResponses,t.InvalidPDFException=n.InvalidPDFException,t.MissingPDFException=n.MissingPDFException,t.SVGGraphics=c.SVGGraphics,t.NativeImageDecoding=n.NativeImageDecoding,t.UnexpectedResponseException=n.UnexpectedResponseException,t.OPS=n.OPS,t.UNSUPPORTED_FEATURES=n.UNSUPPORTED_FEATURES,t.isValidUrl=l.isValidUrl,t.createValidAbsoluteUrl=n.createValidAbsoluteUrl,t.createObjectURL=n.createObjectURL,t.removeNullCharacters=n.removeNullCharacters,t.shadow=n.shadow,t.createBlob=n.createBlob,t.RenderingCancelledException=l.RenderingCancelledException,t.getFilenameFromUrl=l.getFilenameFromUrl,t.addLinkAttributes=l.addLinkAttributes,t.StatTimer=n.StatTimer},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};if("undefined"==typeof PDFJS||!PDFJS.compatibilityChecked){var i="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:{},a="undefined"!=typeof navigator&&navigator.userAgent||"",s=/Android/.test(a),o=/Android\s[0-2][^\d]/.test(a),l=/Android\s[0-4][^\d]/.test(a),c=a.indexOf("Chrom")>=0,u=/Chrome\/(39|40)\./.test(a),h=a.indexOf("CriOS")>=0,d=a.indexOf("Trident")>=0,f=/\b(iPad|iPhone|iPod)(?=;)/.test(a),p=a.indexOf("Opera")>=0,m=/Safari\//.test(a)&&!/(Chrome\/|Android\s)/.test(a),g="object"===("undefined"==typeof window?"undefined":n(window))&&"object"===("undefined"==typeof document?"undefined":n(document));"undefined"==typeof PDFJS&&(i.PDFJS={}),PDFJS.compatibilityChecked=!0,function(){if("undefined"!=typeof Uint8Array)return void 0===Uint8Array.prototype.subarray&&(Uint8Array.prototype.subarray=function(e,t){return new Uint8Array(this.slice(e,t))},Float32Array.prototype.subarray=function(e,t){return new Float32Array(this.slice(e,t))}),void("undefined"==typeof Float64Array&&(i.Float64Array=Float32Array));function e(e,t){return new o(this.slice(e,t))}function t(e,t){arguments.length<2&&(t=0);for(var r=0,n=e.length;r>>0},set:function(t){var r=this.buffer,n=e<<2;r[n]=255&t,r[n+1]=t>>8&255,r[n+2]=t>>16&255,r[n+3]=t>>>24&255}}}function o(r){var i,a,s;if("number"==typeof r)for(i=[],a=0;a>4,c=r+1>6:64,u=r+2>2)+e.charAt(l)+e.charAt(c)+e.charAt(u)}return i}}}(),"atob"in i||(i.atob=function(e){if((e=e.replace(/=+$/,"")).length%4==1)throw new Error("bad atob input");for(var t,r,n=0,i=0,a="";r=e.charAt(i++);~r&&(t=n%4?64*t+r:r,n++%4)?a+=String.fromCharCode(255&t>>(-2*n&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a}),void 0===Function.prototype.bind&&(Function.prototype.bind=function(e){var t=this,r=Array.prototype.slice.call(arguments,1),n=function(){var n=r.concat(Array.prototype.slice.call(arguments));return t.apply(e,n)};return n}),g&&("dataset"in document.createElement("div")||Object.defineProperty(HTMLElement.prototype,"dataset",{get:function(){if(this._dataset)return this._dataset;for(var e={},t=0,r=this.attributes.length;t=0&&n&&i.splice(a,1),e.className=i.join(" "),a>=0}if(g&&!("classList"in document.createElement("div"))){var t={add:function(t){e(this.element,t,!0,!1)},contains:function(t){return e(this.element,t,!1,!1)},remove:function(t){e(this.element,t,!1,!0)},toggle:function(t){e(this.element,t,!0,!0)}};Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){if(this._classList)return this._classList;var e=Object.create(t,{element:{value:this,writable:!1,enumerable:!0}});return Object.defineProperty(this,"_classList",{value:e,writable:!1,enumerable:!1}),e},enumerable:!0})}}(),function(){if("undefined"!=typeof importScripts&&!("console"in i)){var e={},t={log:function(){var e=Array.prototype.slice.call(arguments);i.postMessage({targetName:"main",action:"console_log",data:e})},error:function(){var e=Array.prototype.slice.call(arguments);i.postMessage({targetName:"main",action:"console_error",data:e})},time:function(t){e[t]=Date.now()},timeEnd:function(t){var r=e[t];if(!r)throw new Error("Unknown timer name "+t);this.log("Timer:",t,Date.now()-r)}};i.console=t}}(),function(){if(g){var e;if("console"in window)return"bind"in console.log?void 0:(console.log=(e=console.log,function(t){return e(t)}),console.error=function(e){return function(t){return e(t)}}(console.error),void(console.warn=function(e){return function(t){return e(t)}}(console.warn)));window.console={log:function(){},error:function(){},warn:function(){}}}}(),p&&document.addEventListener("click",(function(e){(function e(t){return t.disabled||t.parentNode&&e(t.parentNode)})(e.target)&&e.stopPropagation()}),!0),(d||h)&&(PDFJS.disableCreateObjectURL=!0),"undefined"!=typeof navigator&&("language"in navigator||(PDFJS.locale=navigator.userLanguage||"en-US")),(m||o||u||f)&&(PDFJS.disableRange=!0,PDFJS.disableStream=!0),g&&(history.pushState&&!o||(PDFJS.disableHistory=!0)),function(){if(g)if(window.CanvasPixelArray)"function"!=typeof window.CanvasPixelArray.prototype.set&&(window.CanvasPixelArray.prototype.set=function(e){for(var t=0,r=this.length;t0;){var t=this.handlers.shift(),r=t.thisPromise._status,n=t.thisPromise._value;try{1===r?"function"==typeof t.onResolve&&(n=t.onResolve(n)):"function"==typeof t.onReject&&(n=t.onReject(n),r=1,t.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(t.thisPromise))}catch(e){r=2,n=e}if(t.nextPromise._updateStatus(r,n),Date.now()>=e)break}this.handlers.length>0?setTimeout(this.runHandlers.bind(this),0):this.running=!1},addUnhandledRejection:function(e){this.unhandledRejections.push({promise:e,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(e){e._unhandledRejection=!1;for(var t=0;t500){var n=e.unhandledRejections[r].promise._value,i="Unhandled rejection: "+n;n.stack&&(i+="\n"+n.stack);try{throw new Error(i)}catch(e){console.warn(i)}e.unhandledRejections.splice(r),r--}e.unhandledRejections.length&&e.scheduleRejectionCheck()}),500))}},t=function(e){this._status=0,this._handlers=[];try{e.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(e){this._reject(e)}};t.all=function(e){var r,n,i=new t((function(e,t){r=e,n=t})),a=e.length,s=[];if(0===a)return r(s),i;function o(e){2!==i._status&&(s=[],n(e))}for(var l=0,c=e.length;l32&&t<127&&-1===[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function p(e){var t=e.charCodeAt(0);return t>32&&t<127&&-1===[34,35,60,62,96].indexOf(t)?e:encodeURIComponent(e)}function m(e,t,n){function i(e){_.push(e)}var c=t||"scheme start",m=0,g="",v=!1,b=!1,_=[];e:for(;(e[m-1]!==s||0===m)&&!this._isInvalid;){var y=e[m];switch(c){case"scheme start":if(!y||!o.test(y)){if(t){i("Invalid scheme.");break e}g="",c="no scheme";continue}g+=y.toLowerCase(),c="scheme";break;case"scheme":if(y&&l.test(y))g+=y.toLowerCase();else{if(":"!==y){if(t){if(y===s)break e;i("Code point not allowed in scheme: "+y);break e}g="",m=0,c="no scheme";continue}if(this._scheme=g,g="",t)break e;u(this._scheme)&&(this._isRelative=!0),c="file"===this._scheme?"relative":this._isRelative&&n&&n._scheme===this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"===y?(this._query="?",c="query"):"#"===y?(this._fragment="#",c="fragment"):y!==s&&"\t"!==y&&"\n"!==y&&"\r"!==y&&(this._schemeData+=f(y));break;case"no scheme":if(n&&u(n._scheme)){c="relative";continue}i("Missing scheme."),h.call(this);break;case"relative or authority":if("/"!==y||"/"!==e[m+1]){i("Expected /, got: "+y),c="relative";continue}c="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!==this._scheme&&(this._scheme=n._scheme),y===s){this._host=n._host,this._port=n._port,this._path=n._path.slice(),this._query=n._query,this._username=n._username,this._password=n._password;break e}if("/"===y||"\\"===y)"\\"===y&&i("\\ is an invalid code point."),c="relative slash";else if("?"===y)this._host=n._host,this._port=n._port,this._path=n._path.slice(),this._query="?",this._username=n._username,this._password=n._password,c="query";else{if("#"!==y){var A=e[m+1],S=e[m+2];("file"!==this._scheme||!o.test(y)||":"!==A&&"|"!==A||S!==s&&"/"!==S&&"\\"!==S&&"?"!==S&&"#"!==S)&&(this._host=n._host,this._port=n._port,this._username=n._username,this._password=n._password,this._path=n._path.slice(),this._path.pop()),c="relative path";continue}this._host=n._host,this._port=n._port,this._path=n._path.slice(),this._query=n._query,this._fragment="#",this._username=n._username,this._password=n._password,c="fragment"}break;case"relative slash":if("/"!==y&&"\\"!==y){"file"!==this._scheme&&(this._host=n._host,this._port=n._port,this._username=n._username,this._password=n._password),c="relative path";continue}"\\"===y&&i("\\ is an invalid code point."),c="file"===this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!==y){i("Expected '/', got: "+y),c="authority ignore slashes";continue}c="authority second slash";break;case"authority second slash":if(c="authority ignore slashes","/"!==y){i("Expected '/', got: "+y);continue}break;case"authority ignore slashes":if("/"!==y&&"\\"!==y){c="authority";continue}i("Expected authority, got: "+y);break;case"authority":if("@"===y){v&&(i("@ already seen."),g+="%40"),v=!0;for(var w=0;w