>>24|h<<8|4278190080,i[o+2]=h>>>16|v<<16|4278190080,i[o+3]=v>>>8|4278190080}for(var f=4*l,p=t.length;f>>8|255,i[o+2]=g<<16|y>>>16|255,i[o+3]=y<<8|255}for(var m=4*l,b=t.length;m>3,g=7&s,y=t.length;i=new Uint32Array(i.buffer);for(var m=0,b=0;b1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2?arguments[2]:void 0;if(!this.isCancelled){var l=this.desiredSize;this.desiredSize-=s,l>0&&this.desiredSize<=0&&(this.sinkCapability=new r.PromiseCapability,this.ready=this.sinkCapability.promise),i.postMessage({sourceName:a,targetName:n,stream:c,streamId:t,chunk:e},o)}},close:function(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:a,targetName:n,stream:l,streamId:t}),delete s.streamSinks[t])},error:function(e){(0,r.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:a,targetName:n,stream:u,streamId:t,reason:f(e)}))},sinkCapability:new r.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,new Promise((function(t){t(o(e.data,d))})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:v,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:v,streamId:t,reason:f(e)})}))}function b(e){var t=e.streamId,a=this.sourceName,n=e.sourceName,i=this.comObj,p=this.streamControllers[t],_=this.streamSinks[t];switch(e.stream){case v:e.success?p.startCall.resolve():p.startCall.reject(f(e.reason));break;case h:e.success?p.pullCall.resolve():p.pullCall.reject(f(e.reason));break;case d:if(!_){i.postMessage({sourceName:a,targetName:n,stream:h,streamId:t,success:!0});break}_.desiredSize<=0&&e.desiredSize>0&&_.sinkCapability.resolve(),_.desiredSize=e.desiredSize,new Promise((function(e){var t;e(null===(t=_.onPull)||void 0===t?void 0:t.call(_))})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:h,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:h,streamId:t,reason:f(e)})}));break;case c:if((0,r.assert)(p,"enqueue should have stream controller"),p.isClosed)break;p.controller.enqueue(e.chunk);break;case l:if((0,r.assert)(p,"close should have stream controller"),p.isClosed)break;p.isClosed=!0,p.controller.close(),_classPrivateMethodGet(this,g,k).call(this,p,t);break;case u:(0,r.assert)(p,"error should have stream controller"),p.controller.error(f(e.reason)),_classPrivateMethodGet(this,g,k).call(this,p,t);break;case o:e.success?p.cancelCall.resolve():p.cancelCall.reject(f(e.reason)),_classPrivateMethodGet(this,g,k).call(this,p,t);break;case s:if(!_)break;new Promise((function(t){var a;t(null===(a=_.onCancel)||void 0===a?void 0:a.call(_,f(e.reason)))})).then((function(){i.postMessage({sourceName:a,targetName:n,stream:o,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:a,targetName:n,stream:o,streamId:t,reason:f(e)})})),_.sinkCapability.reject(f(e.reason)),_.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}function k(e,t){return A.apply(this,arguments)}function A(){return(A=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,a){var r,n,i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.allSettled([null===(r=t.startCall)||void 0===r?void 0:r.promise,null===(n=t.pullCall)||void 0===n?void 0:n.promise,null===(i=t.cancelCall)||void 0===i?void 0:i.promise]);case 2:delete this.streamControllers[a];case 3:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}t.MessageHandler=y},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var r=a(1),n=new WeakMap,i=new WeakMap,s=function(){function e(t){var a=t.parsedData,r=t.rawData;_classCallCheck(this,e),_classPrivateFieldInitSpec(this,n,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,i,{writable:!0,value:void 0}),_classPrivateFieldSet(this,n,a),_classPrivateFieldSet(this,i,r)}return _createClass(e,[{key:"getRaw",value:function(){return _classPrivateFieldGet(this,i)}},{key:"get",value:function(e){var t;return null!==(t=_classPrivateFieldGet(this,n).get(e))&&void 0!==t?t:null}},{key:"getAll",value:function(){return(0,r.objectFromMap)(_classPrivateFieldGet(this,n))}},{key:"has",value:function(e){return _classPrivateFieldGet(this,n).has(e)}}]),e}();t.Metadata=s},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var r=a(1),n=a(8),i=Symbol("INTERNAL"),s=new WeakMap,o=function(){function e(t,a){_classCallCheck(this,e),_classPrivateFieldInitSpec(this,s,{writable:!0,value:!0}),this.name=t,this.intent=a}return _createClass(e,[{key:"visible",get:function(){return _classPrivateFieldGet(this,s)}},{key:"_setVisible",value:function(e,t){e!==i&&(0,r.unreachable)("Internal method `_setVisible` called."),_classPrivateFieldSet(this,s,t)}}]),e}(),l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakSet,v=function(){function e(t){if(_classCallCheck(this,e),_classPrivateMethodInitSpec(this,h),_classPrivateFieldInitSpec(this,l,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,c,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,u,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,d,{writable:!0,value:null}),this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,_classPrivateFieldSet(this,d,t.order);var a,r=_createForOfIteratorHelper(t.groups);try{for(r.s();!(a=r.n()).done;){var n=a.value;_classPrivateFieldGet(this,c).set(n.id,new o(n.name,n.intent))}}catch(b){r.e(b)}finally{r.f()}if("OFF"===t.baseState){var s,v=_createForOfIteratorHelper(_classPrivateFieldGet(this,c).values());try{for(v.s();!(s=v.n()).done;)s.value._setVisible(i,!1)}catch(b){v.e(b)}finally{v.f()}}var f,p=_createForOfIteratorHelper(t.on);try{for(p.s();!(f=p.n()).done;){var _=f.value;_classPrivateFieldGet(this,c).get(_)._setVisible(i,!0)}}catch(b){p.e(b)}finally{p.f()}var g,y=_createForOfIteratorHelper(t.off);try{for(y.s();!(g=y.n()).done;){var m=g.value;_classPrivateFieldGet(this,c).get(m)._setVisible(i,!1)}}catch(b){y.e(b)}finally{y.f()}_classPrivateFieldSet(this,u,this.getHash())}}return _createClass(e,[{key:"isVisible",value:function(e){if(0===_classPrivateFieldGet(this,c).size)return!0;if(!e)return(0,r.warn)("Optional content group not defined."),!0;if("OCG"===e.type)return _classPrivateFieldGet(this,c).has(e.id)?_classPrivateFieldGet(this,c).get(e.id).visible:((0,r.warn)("Optional content group not found: ".concat(e.id)),!0);if("OCMD"===e.type){if(e.expression)return _classPrivateMethodGet(this,h,f).call(this,e.expression);if(!e.policy||"AnyOn"===e.policy){var t,a=_createForOfIteratorHelper(e.ids);try{for(a.s();!(t=a.n()).done;){var n=t.value;if(!_classPrivateFieldGet(this,c).has(n))return(0,r.warn)("Optional content group not found: ".concat(n)),!0;if(_classPrivateFieldGet(this,c).get(n).visible)return!0}}catch(g){a.e(g)}finally{a.f()}return!1}if("AllOn"===e.policy){var i,s=_createForOfIteratorHelper(e.ids);try{for(s.s();!(i=s.n()).done;){var o=i.value;if(!_classPrivateFieldGet(this,c).has(o))return(0,r.warn)("Optional content group not found: ".concat(o)),!0;if(!_classPrivateFieldGet(this,c).get(o).visible)return!1}}catch(g){s.e(g)}finally{s.f()}return!0}if("AnyOff"===e.policy){var l,u=_createForOfIteratorHelper(e.ids);try{for(u.s();!(l=u.n()).done;){var d=l.value;if(!_classPrivateFieldGet(this,c).has(d))return(0,r.warn)("Optional content group not found: ".concat(d)),!0;if(!_classPrivateFieldGet(this,c).get(d).visible)return!0}}catch(g){u.e(g)}finally{u.f()}return!1}if("AllOff"===e.policy){var v,p=_createForOfIteratorHelper(e.ids);try{for(p.s();!(v=p.n()).done;){var _=v.value;if(!_classPrivateFieldGet(this,c).has(_))return(0,r.warn)("Optional content group not found: ".concat(_)),!0;if(_classPrivateFieldGet(this,c).get(_).visible)return!1}}catch(g){p.e(g)}finally{p.f()}return!0}return(0,r.warn)("Unknown optional content policy ".concat(e.policy,".")),!0}return(0,r.warn)("Unknown group type ".concat(e.type,".")),!0}},{key:"setVisibility",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];_classPrivateFieldGet(this,c).has(e)?(_classPrivateFieldGet(this,c).get(e)._setVisible(i,!!t),_classPrivateFieldSet(this,l,null)):(0,r.warn)("Optional content group not found: ".concat(e))}},{key:"hasInitialVisibility",get:function(){return this.getHash()===_classPrivateFieldGet(this,u)}},{key:"getOrder",value:function(){return _classPrivateFieldGet(this,c).size?_classPrivateFieldGet(this,d)?_classPrivateFieldGet(this,d).slice():_toConsumableArray(_classPrivateFieldGet(this,c).keys()):null}},{key:"getGroups",value:function(){return _classPrivateFieldGet(this,c).size>0?(0,r.objectFromMap)(_classPrivateFieldGet(this,c)):null}},{key:"getGroup",value:function(e){return _classPrivateFieldGet(this,c).get(e)||null}},{key:"getHash",value:function(){if(null!==_classPrivateFieldGet(this,l))return _classPrivateFieldGet(this,l);var e,t=new n.MurmurHash3_64,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,c));try{for(a.s();!(e=a.n()).done;){var r=_slicedToArray(e.value,2),i=r[0],s=r[1];t.update("".concat(i,":").concat(s.visible))}}catch(o){a.e(o)}finally{a.f()}return _classPrivateFieldSet(this,l,t.hexdigest())}}]),e}();function f(e){var t=e.length;if(t<2)return!0;for(var a=e[0],n=1;n0){var p=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(p)}this._pdfDataRangeTransport=a,this._isStreamingSupported=!f,this._isRangeSupported=!h,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((function(e,t){n._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener((function(e,t){n._onProgress({loaded:e,total:t})})),this._pdfDataRangeTransport.addProgressiveReadListener((function(e){n._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.addProgressiveDoneListener((function(){n._onProgressiveDone()})),this._pdfDataRangeTransport.transportReady()}return _createClass(e,[{key:"_onReceiveData",value:function(e){var t=e.begin,a=e.chunk,n=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;if(void 0===t)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{var i=this._rangeReaders.some((function(e){return e._begin===t&&(e._enqueue(n),!0)}));(0,r.assert)(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}},{key:"_progressiveDataLength",get:function(){var e,t;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}},{key:"_onProgress",value:function(e){var t,a,r,n;void 0===e.total?null===(t=this._rangeReaders[0])||void 0===t||null===(a=t.onProgress)||void 0===a||a.call(t,{loaded:e.loaded}):null===(r=this._fullRequestReader)||void 0===r||null===(n=r.onProgress)||void 0===n||n.call(r,{loaded:e.loaded,total:e.total})}},{key:"_onProgressiveDone",value:function(){var e;null===(e=this._fullRequestReader)||void 0===e||e.progressiveDone(),this._progressiveDone=!0}},{key:"_removeRangeReader",value:function(e){var t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}},{key:"getFullReader",value:function(){(0,r.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");var e=this._queuedChunks;return this._queuedChunks=null,new s(this,e,this._progressiveDone,this._contentDispositionFilename)}},{key:"getRangeReader",value:function(e,t){if(t<=this._progressiveDataLength)return null;var a=new o(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(a),a}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var a,r=_createForOfIteratorHelper(this._rangeReaders.slice(0));try{for(r.s();!(a=r.n()).done;)a.value.cancel(e)}catch(n){r.e(n)}finally{r.f()}this._pdfDataRangeTransport.abort()}}]),e}();t.PDFDataTransportStream=i;var s=function(){function e(t,a){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,e),this._stream=t,this._done=r||!1,this._filename=(0,n.isPdfFile)(i)?i:null,this._queuedChunks=a||[],this._loaded=0;var s,o=_createForOfIteratorHelper(this._queuedChunks);try{for(o.s();!(s=o.n()).done;){var l=s.value;this._loaded+=l.byteLength}}catch(c){o.e(c)}finally{o.f()}this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}return _createClass(e,[{key:"_enqueue",value:function(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}},{key:"headersReady",get:function(){return this._headersReady}},{key:"filename",get:function(){return this._filename}},{key:"isRangeSupported",get:function(){return this._stream._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._stream._isStreamingSupported}},{key:"contentLength",get:function(){return this._stream._contentLength}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._queuedChunks.length>0)){e.next=3;break}return t=this._queuedChunks.shift(),e.abrupt("return",{value:t,done:!1});case 3:if(!this._done){e.next=5;break}return e.abrupt("return",{value:void 0,done:!0});case 5:return a=new r.PromiseCapability,this._requests.push(a),e.abrupt("return",a.promise);case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0;var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){a.e(r)}finally{a.f()}this._requests.length=0}},{key:"progressiveDone",value:function(){this._done||(this._done=!0)}}]),e}(),o=function(){function e(t,a,r){_classCallCheck(this,e),this._stream=t,this._begin=a,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}return _createClass(e,[{key:"_enqueue",value:function(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){a.e(r)}finally{a.f()}this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}},{key:"isStreamingSupported",get:function(){return!1}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._queuedChunk){e.next=4;break}return t=this._queuedChunk,this._queuedChunk=null,e.abrupt("return",{value:t,done:!1});case 4:if(!this._done){e.next=6;break}return e.abrupt("return",{value:void 0,done:!0});case 6:return a=new r.PromiseCapability,this._requests.push(a),e.abrupt("return",a.promise);case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0;var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){a.e(r)}finally{a.f()}this._requests.length=0,this._stream._removeRangeReader(this)}}]),e}()},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;var a=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"textContent",value:function(t){var a=[],r={items:a,styles:Object.create(null)};return function t(r){var n;if(r){var i=null,s=r.name;if("#text"===s)i=r.value;else{if(!e.shouldBuildText(s))return;null!==r&&void 0!==r&&null!==(n=r.attributes)&&void 0!==n&&n.textContent?i=r.attributes.textContent:r.value&&(i=r.value)}if(null!==i&&a.push({str:i}),r.children){var o,l=_createForOfIteratorHelper(r.children);try{for(l.s();!(o=l.n()).done;)t(o.value)}catch(c){l.e(c)}finally{l.f()}}}}(t),r}},{key:"shouldBuildText",value:function(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}]),e}();t.XfaText=a},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeFilterFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var r=a(7),n=function(e){return new Promise((function(t,a){__webpack_require__(70172).readFile(e,(function(e,r){!e&&r?t(new Uint8Array(r)):a(new Error(e))}))}))},i=function(e){_inherits(a,e);var t=_createSuper(a);function a(){return _classCallCheck(this,a),t.apply(this,arguments)}return _createClass(a)}(r.BaseFilterFactory);t.NodeFilterFactory=i;var s=function(e){_inherits(a,e);var t=_createSuper(a);function a(){return _classCallCheck(this,a),t.apply(this,arguments)}return _createClass(a,[{key:"_createCanvas",value:function(e,t){return __webpack_require__(93414).createCanvas(e,t)}}]),a}(r.BaseCanvasFactory);t.NodeCanvasFactory=s;var o=function(e){_inherits(a,e);var t=_createSuper(a);function a(){return _classCallCheck(this,a),t.apply(this,arguments)}return _createClass(a,[{key:"_fetchData",value:function(e,t){return n(e).then((function(e){return{cMapData:e,compressionType:t}}))}}]),a}(r.BaseCMapReaderFactory);t.NodeCMapReaderFactory=o;var l=function(e){_inherits(a,e);var t=_createSuper(a);function a(){return _classCallCheck(this,a),t.apply(this,arguments)}return _createClass(a,[{key:"_fetchData",value:function(e){return n(e)}}]),a}(r.BaseStandardFontDataFactory);t.NodeStandardFontDataFactory=l},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var r=a(1),n=a(22),i=__webpack_require__(70172),s=__webpack_require__(2001),o=__webpack_require__(33779),l=__webpack_require__(66558),c=/^file:\/\/\/[a-zA-Z]:\//,u=function(){function e(t){_classCallCheck(this,e),this.source=t,this.url=function(e){var t=l.parse(e);return"file:"===t.protocol||t.host?t:/^[a-z]:[/\\]/i.test(e)?l.parse("file:///".concat(e)):(t.host||(t.protocol="file:"),t)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}return _createClass(e,[{key:"_progressiveDataLength",get:function(){var e,t;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}},{key:"getFullReader",value:function(){return(0,r.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new _(this):new f(this),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){if(t<=this._progressiveDataLength)return null;var a=this.isFsUrl?new g(this,e,t):new p(this,e,t);return this._rangeRequestReaders.push(a),a}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var a,r=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(r.s();!(a=r.n()).done;)a.value.cancel(e)}catch(n){r.e(n)}finally{r.f()}}}]),e}();t.PDFNodeStream=u;var d=function(){function e(t){_classCallCheck(this,e),this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;var a=t.source;this._contentLength=a.length,this._loaded=0,this._filename=null,this._disableRange=a.disableRange||!1,this._rangeChunkSize=a.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!a.disableStream,this._isRangeSupported=!a.disableRange,this._readableStream=null,this._readCapability=new r.PromiseCapability,this._headersCapability=new r.PromiseCapability}return _createClass(e,[{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:if(!this._done){e.next=4;break}return e.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){e.next=6;break}throw this._storedError;case 6:if(null!==(a=this._readableStream.read())){e.next=10;break}return this._readCapability=new r.PromiseCapability,e.abrupt("return",this.read());case 10:return this._loaded+=a.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),n=new Uint8Array(a).buffer,e.abrupt("return",{value:n,done:!1});case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._storedError=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",(function(){t._readCapability.resolve()})),e.on("end",(function(){e.destroy(),t._done=!0,t._readCapability.resolve()})),e.on("error",(function(e){t._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new r.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}]),e}(),h=function(){function e(t){_classCallCheck(this,e),this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new r.PromiseCapability;var a=t.source;this._isStreamingSupported=!a.disableStream}return _createClass(e,[{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:if(!this._done){e.next=4;break}return e.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){e.next=6;break}throw this._storedError;case 6:if(null!==(a=this._readableStream.read())){e.next=10;break}return this._readCapability=new r.PromiseCapability,e.abrupt("return",this.read());case 10:return this._loaded+=a.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),n=new Uint8Array(a).buffer,e.abrupt("return",{value:n,done:!1});case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._storedError=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",(function(){t._readCapability.resolve()})),e.on("end",(function(){e.destroy(),t._done=!0,t._readCapability.resolve()})),e.on("error",(function(e){t._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}]),e}();function v(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}var f=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var i;_classCallCheck(this,a);var l=function(t){if(404===t.statusCode){var a=new r.MissingPDFException('Missing PDF "'.concat(i._url,'".'));return i._storedError=a,void i._headersCapability.reject(a)}i._headersCapability.resolve(),i._setReadableStream(t);var s=function(e){return i._readableStream.headers[e.toLowerCase()]},o=(0,n.validateRangeRequestCapabilities)({getResponseHeader:s,isHttp:e.isHttp,rangeChunkSize:i._rangeChunkSize,disableRange:i._disableRange}),l=o.allowRangeRequests,c=o.suggestedLength;i._isRangeSupported=l,i._contentLength=c||i._contentLength,i._filename=(0,n.extractFilenameFromHeader)(s)};return(i=t.call(this,e))._request=null,"http:"===i._url.protocol?i._request=s.request(v(i._url,e.httpHeaders),l):i._request=o.request(v(i._url,e.httpHeaders),l),i._request.on("error",(function(e){i._storedError=e,i._headersCapability.reject(e)})),i._request.end(),i}return _createClass(a)}(d),p=function(e){_inherits(a,e);var t=_createSuper(a);function a(e,n,i){var l;for(var c in _classCallCheck(this,a),(l=t.call(this,e))._httpHeaders={},e.httpHeaders){var u=e.httpHeaders[c];void 0!==u&&(l._httpHeaders[c]=u)}l._httpHeaders.Range="bytes=".concat(n,"-").concat(i-1);var d=function(e){if(404!==e.statusCode)l._setReadableStream(e);else{var t=new r.MissingPDFException('Missing PDF "'.concat(l._url,'".'));l._storedError=t}};return l._request=null,"http:"===l._url.protocol?l._request=s.request(v(l._url,l._httpHeaders),d):l._request=o.request(v(l._url,l._httpHeaders),d),l._request.on("error",(function(e){l._storedError=e})),l._request.end(),l}return _createClass(a)}(h),_=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var n;_classCallCheck(this,a),n=t.call(this,e);var s=decodeURIComponent(n._url.path);return c.test(n._url.href)&&(s=s.replace(/^\//,"")),i.lstat(s,(function(e,t){if(e)return"ENOENT"===e.code&&(e=new r.MissingPDFException('Missing PDF "'.concat(s,'".'))),n._storedError=e,void n._headersCapability.reject(e);n._contentLength=t.size,n._setReadableStream(i.createReadStream(s)),n._headersCapability.resolve()})),n}return _createClass(a)}(d),g=function(e){_inherits(a,e);var t=_createSuper(a);function a(e,r,n){var s;_classCallCheck(this,a),s=t.call(this,e);var o=decodeURIComponent(s._url.path);return c.test(s._url.href)&&(o=o.replace(/^\//,"")),s._setReadableStream(i.createReadStream(o,{start:r,end:n-1})),s}return _createClass(a)}(h)},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){return 404===e||0===e&&t.startsWith("file:")?new r.MissingPDFException('Missing PDF "'+t+'".'):new r.UnexpectedResponseException("Unexpected server response (".concat(e,') while retrieving PDF "').concat(t,'".'),e)},t.extractFilenameFromHeader=function(e){var t=e("Content-Disposition");if(t){var a=(0,n.getFilenameFromContentDispositionHeader)(t);if(a.includes("%"))try{a=decodeURIComponent(a)}catch(r){}if((0,i.isPdfFile)(a))return a}return null},t.validateRangeRequestCapabilities=function(e){var t=e.getResponseHeader,a=e.isHttp,r=e.rangeChunkSize,n=e.disableRange,i={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(t("Content-Length"),10);return Number.isInteger(s)?(i.suggestedLength=s,s<=2*r||n||!a||"bytes"!==t("Accept-Ranges")||"identity"!==(t("Content-Encoding")||"identity")||(i.allowRangeRequests=!0),i):i},t.validateResponseStatus=function(e){return 200===e||206===e};var r=a(1),n=a(23),i=a(6)},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){var t=!0,a=s("filename\\*","i").exec(e);if(a){var n=c(a=a[1]);return l(n=d(n=u(n=unescape(n))))}if(a=function(e){for(var t,a=[],r=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");null!==(t=r.exec(e));){var n=_slicedToArray(t,4),i=n[1],o=n[2],l=n[3];if((i=parseInt(i,10))in a){if(0===i)break}else a[i]=[o,l]}for(var d=[],h=0;h1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,e),this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&a.httpHeaders||Object.create(null),this.withCredentials=a.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}return _createClass(e,[{key:"requestRange",value:function(e,t,a){var r={begin:e,end:t};for(var n in a)r[n]=a[n];return this.request(r)}},{key:"requestFull",value:function(e){return this.request(e)}},{key:"request",value:function(e){var t=new XMLHttpRequest,a=this.currXhrId++,r=this.pendingRequests[a]={xhr:t};for(var n in t.open("GET",this.url),t.withCredentials=this.withCredentials,this.httpHeaders){var i=this.httpHeaders[n];void 0!==i&&t.setRequestHeader(n,i)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range","bytes=".concat(e.begin,"-").concat(e.end-1)),r.expectedStatus=206):r.expectedStatus=200,t.responseType="arraybuffer",e.onError&&(t.onerror=function(a){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,a),t.onprogress=this.onProgress.bind(this,a),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),a}},{key:"onProgress",value:function(e,t){var a,r=this.pendingRequests[e];r&&(null===(a=r.onProgress)||void 0===a||a.call(r,t))}},{key:"onStateChange",value:function(e,t){var a=this.pendingRequests[e];if(a){var n=a.xhr;if(n.readyState>=2&&a.onHeadersReceived&&(a.onHeadersReceived(),delete a.onHeadersReceived),4===n.readyState&&e in this.pendingRequests)if(delete this.pendingRequests[e],0===n.status&&this.isHttp){var i;null===(i=a.onError)||void 0===i||i.call(a,n.status)}else{var s=n.status||200;if(200===s&&206===a.expectedStatus||s===a.expectedStatus){var o=function(e){var t=e.response;return"string"!==typeof t?t:(0,r.stringToBytes)(t).buffer}(n);if(206===s){var l=n.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);a.onDone({begin:parseInt(c[1],10),chunk:o})}else if(o)a.onDone({begin:0,chunk:o});else{var u;null===(u=a.onError)||void 0===u||u.call(a,n.status)}}else{var d;null===(d=a.onError)||void 0===d||d.call(a,n.status)}}}}},{key:"getRequestXhr",value:function(e){return this.pendingRequests[e].xhr}},{key:"isPendingRequest",value:function(e){return e in this.pendingRequests}},{key:"abortRequest",value:function(e){var t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}]),e}(),s=function(){function e(t){_classCallCheck(this,e),this._source=t,this._manager=new i(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}return _createClass(e,[{key:"_onRangeRequestReaderClosed",value:function(e){var t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}},{key:"getFullReader",value:function(){return(0,r.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new o(this._manager,this._source),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){var a=new l(this._manager,e,t);return a.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(a),a}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var a,r=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(r.s();!(a=r.n()).done;)a.value.cancel(e)}catch(n){r.e(n)}finally{r.f()}}}]),e}();t.PDFNetworkStream=s;var o=function(){function e(t,a){_classCallCheck(this,e),this._manager=t;var n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=a.url,this._fullRequestId=t.requestFull(n),this._headersReceivedCapability=new r.PromiseCapability,this._disableRange=a.disableRange||!1,this._contentLength=a.length,this._rangeChunkSize=a.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}return _createClass(e,[{key:"_onHeadersReceived",value:function(){var e=this._fullRequestId,t=this._manager.getRequestXhr(e),a=function(e){return t.getResponseHeader(e)},r=(0,n.validateRangeRequestCapabilities)({getResponseHeader:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),i=r.allowRangeRequests,s=r.suggestedLength;i&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=(0,n.extractFilenameFromHeader)(a),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}},{key:"_onDone",value:function(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){a.e(r)}finally{a.f()}this._requests.length=0}}},{key:"_onError",value:function(e){this._storedError=(0,n.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.reject(this._storedError)}catch(r){a.e(r)}finally{a.f()}this._requests.length=0,this._cachedChunks.length=0}},{key:"_onProgress",value:function(e){var t;null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}},{key:"filename",get:function(){return this._filename}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"contentLength",get:function(){return this._contentLength}},{key:"headersReady",get:function(){return this._headersReceivedCapability.promise}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._storedError){e.next=2;break}throw this._storedError;case 2:if(!(this._cachedChunks.length>0)){e.next=5;break}return t=this._cachedChunks.shift(),e.abrupt("return",{value:t,done:!1});case 5:if(!this._done){e.next=7;break}return e.abrupt("return",{value:void 0,done:!0});case 7:return a=new r.PromiseCapability,this._requests.push(a),e.abrupt("return",a.promise);case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0,this._headersReceivedCapability.reject(e);var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){a.e(r)}finally{a.f()}this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}]),e}(),l=function(){function e(t,a,r){_classCallCheck(this,e),this._manager=t;var n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(a,r,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}return _createClass(e,[{key:"_close",value:function(){var e;null===(e=this.onClosed)||void 0===e||e.call(this,this)}},{key:"_onDone",value:function(e){var t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;var a,r=_createForOfIteratorHelper(this._requests);try{for(r.s();!(a=r.n()).done;)a.value.resolve({value:void 0,done:!0})}catch(n){r.e(n)}finally{r.f()}this._requests.length=0,this._close()}},{key:"_onError",value:function(e){this._storedError=(0,n.createResponseStatusError)(e,this._url);var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.reject(this._storedError)}catch(r){a.e(r)}finally{a.f()}this._requests.length=0,this._queuedChunk=null}},{key:"_onProgress",value:function(e){var t;this.isStreamingSupported||null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:e.loaded})}},{key:"isStreamingSupported",get:function(){return!1}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._storedError){e.next=2;break}throw this._storedError;case 2:if(null===this._queuedChunk){e.next=6;break}return t=this._queuedChunk,this._queuedChunk=null,e.abrupt("return",{value:t,done:!1});case 6:if(!this._done){e.next=8;break}return e.abrupt("return",{value:void 0,done:!0});case 8:return a=new r.PromiseCapability,this._requests.push(a),e.abrupt("return",a.promise);case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0;var t,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(t=a.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){a.e(r)}finally{a.f()}this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}]),e}()},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var r=a(1),n=a(22);function i(e,t,a){return{method:"GET",headers:e,signal:a.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function s(e){var t=new Headers;for(var a in e){var r=e[a];void 0!==r&&t.append(a,r)}return t}function o(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,r.warn)("getArrayBuffer - unexpected data format: ".concat(e)),new Uint8Array(e).buffer)}var l=function(){function e(t){_classCallCheck(this,e),this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}return _createClass(e,[{key:"_progressiveDataLength",get:function(){var e,t;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}},{key:"getFullReader",value:function(){return(0,r.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new c(this),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){if(t<=this._progressiveDataLength)return null;var a=new u(this,e,t);return this._rangeRequestReaders.push(a),a}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var a,r=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(r.s();!(a=r.n()).done;)a.value.cancel(e)}catch(n){r.e(n)}finally{r.f()}}}]),e}();t.PDFFetchStream=l;var c=function(){function e(t){var a=this;_classCallCheck(this,e),this._stream=t,this._reader=null,this._loaded=0,this._filename=null;var o=t.source;this._withCredentials=o.withCredentials||!1,this._contentLength=o.length,this._headersCapability=new r.PromiseCapability,this._disableRange=o.disableRange||!1,this._rangeChunkSize=o.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!o.disableStream,this._isRangeSupported=!o.disableRange,this._headers=s(this._stream.httpHeaders);var l=o.url;fetch(l,i(this._headers,this._withCredentials,this._abortController)).then((function(e){if(!(0,n.validateResponseStatus)(e.status))throw(0,n.createResponseStatusError)(e.status,l);a._reader=e.body.getReader(),a._headersCapability.resolve();var t=function(t){return e.headers.get(t)},i=(0,n.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:a._stream.isHttp,rangeChunkSize:a._rangeChunkSize,disableRange:a._disableRange}),s=i.allowRangeRequests,o=i.suggestedLength;a._isRangeSupported=s,a._contentLength=o||a._contentLength,a._filename=(0,n.extractFilenameFromHeader)(t),!a._isStreamingSupported&&a._isRangeSupported&&a.cancel(new r.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}return _createClass(e,[{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a,r,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._headersCapability.promise;case 2:return e.next=4,this._reader.read();case 4:if(a=e.sent,r=a.value,!(n=a.done)){e.next=9;break}return e.abrupt("return",{value:r,done:n});case 9:return this._loaded+=r.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),e.abrupt("return",{value:o(r),done:!1});case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){var t;null===(t=this._reader)||void 0===t||t.cancel(e),this._abortController.abort()}}]),e}(),u=function(){function e(t,a,o){var l=this;_classCallCheck(this,e),this._stream=t,this._reader=null,this._loaded=0;var c=t.source;this._withCredentials=c.withCredentials||!1,this._readCapability=new r.PromiseCapability,this._isStreamingSupported=!c.disableStream,this._abortController=new AbortController,this._headers=s(this._stream.httpHeaders),this._headers.append("Range","bytes=".concat(a,"-").concat(o-1));var u=c.url;fetch(u,i(this._headers,this._withCredentials,this._abortController)).then((function(e){if(!(0,n.validateResponseStatus)(e.status))throw(0,n.createResponseStatusError)(e.status,u);l._readCapability.resolve(),l._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}return _createClass(e,[{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,a,r,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:return e.next=4,this._reader.read();case 4:if(a=e.sent,r=a.value,!(n=a.done)){e.next=9;break}return e.abrupt("return",{value:r,done:n});case 9:return this._loaded+=r.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),e.abrupt("return",{value:o(r),done:!1});case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){var t;null===(t=this._reader)||void 0===t||t.cancel(e),this._abortController.abort()}}]),e}()},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=function(e){e.textContentSource||!e.textContent&&!e.textContentStream||((0,n.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),e.textContentSource=e.textContent||e.textContentStream);var t=e.container,a=e.viewport,r=getComputedStyle(t),i=r.getPropertyValue("visibility"),s=parseFloat(r.getPropertyValue("--scale-factor"));"visible"===i&&(!s||Math.abs(s-a.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");var o=new d(e);return o._render(),o},t.updateTextLayer=function(e){var t=e.container,a=e.viewport,r=e.textDivs,i=e.textDivProperties,s=e.isOffscreenCanvasSupported,o=e.mustRotate,c=void 0===o||o,d=e.mustRescale,h=void 0===d||d;if(c&&(0,n.setLayerDimensions)(t,{rotation:a.rotation}),h){var v,f=l(0,s),p={prevFontSize:null,prevFontFamily:null,div:null,scale:a.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:f},_=_createForOfIteratorHelper(r);try{for(_.s();!(v=_.n()).done;){var g=v.value;p.properties=i.get(g),p.div=g,u(p)}}catch(y){_.e(y)}finally{_.f()}}};var r=a(1),n=a(6),i=30,s=.8,o=new Map;function l(e,t){var a;if(t&&r.FeatureTest.isOffscreenCanvasSupported)a=new OffscreenCanvas(e,e).getContext("2d",{alpha:!1});else{var n=document.createElement("canvas");n.width=n.height=e,a=n.getContext("2d",{alpha:!1})}return a}function c(e,t,a){var n=document.createElement("span"),c={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(n);var u=r.Util.transform(e._transform,t.transform),d=Math.atan2(u[1],u[0]),h=a[t.fontName];h.vertical&&(d+=Math.PI/2);var v,f,p=Math.hypot(u[2],u[3]),_=p*function(e,t){var a=o.get(e);if(a)return a;var r=l(i,t);r.font="".concat(i,"px ").concat(e);var n=r.measureText(""),c=n.fontBoundingBoxAscent,u=Math.abs(n.fontBoundingBoxDescent);if(c){var d=c/(c+u);return o.set(e,d),r.canvas.width=r.canvas.height=0,d}r.strokeStyle="red",r.clearRect(0,0,i,i),r.strokeText("g",0,0);var h=r.getImageData(0,0,i,i).data;u=0;for(var v=h.length-1-3;v>=0;v-=4)if(h[v]>0){u=Math.ceil(v/4/i);break}r.clearRect(0,0,i,i),r.strokeText("A",0,i),c=0;for(var f=0,p=(h=r.getImageData(0,0,i,i).data).length;f0){c=i-Math.floor(f/4/i);break}if(r.canvas.width=r.canvas.height=0,c){var _=c/(c+u);return o.set(e,_),_}return o.set(e,s),s}(h.fontFamily,e._isOffscreenCanvasSupported);0===d?(v=u[4],f=u[5]-_):(v=u[4]+_*Math.sin(d),f=u[5]-_*Math.cos(d));var g="calc(var(--scale-factor)*",y=n.style;e._container===e._rootContainer?(y.left="".concat((100*v/e._pageWidth).toFixed(2),"%"),y.top="".concat((100*f/e._pageHeight).toFixed(2),"%")):(y.left="".concat(g).concat(v.toFixed(2),"px)"),y.top="".concat(g).concat(f.toFixed(2),"px)")),y.fontSize="".concat(g).concat(p.toFixed(2),"px)"),y.fontFamily=h.fontFamily,c.fontSize=p,n.setAttribute("role","presentation"),n.textContent=t.str,n.dir=t.dir,e._fontInspectorEnabled&&(n.dataset.fontName=t.fontName),0!==d&&(c.angle=d*(180/Math.PI));var m=!1;if(t.str.length>1)m=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){var b=Math.abs(t.transform[0]),k=Math.abs(t.transform[3]);b!==k&&Math.max(b,k)/Math.min(b,k)>1.5&&(m=!0)}m&&(c.canvasWidth=h.vertical?t.height:t.width),e._textDivProperties.set(n,c),e._isReadableStream&&e._layoutText(n)}function u(e){var t=e.div,a=e.scale,r=e.properties,n=e.ctx,i=e.prevFontSize,s=e.prevFontFamily,o=t.style,l="";if(0!==r.canvasWidth&&r.hasText){var c=o.fontFamily,u=r.canvasWidth,d=r.fontSize;i===d&&s===c||(n.font="".concat(d*a,"px ").concat(c),e.prevFontSize=d,e.prevFontFamily=c);var h=n.measureText(t.textContent).width;h>0&&(l="scaleX(".concat(u*a/h,")"))}0!==r.angle&&(l="rotate(".concat(r.angle,"deg) ").concat(l)),l.length>0&&(o.transform=l)}var d=function(){function e(t){var a,i=this,s=t.textContentSource,o=t.container,c=t.viewport,u=t.textDivs,d=t.textDivProperties,h=t.textContentItemsStr,v=t.isOffscreenCanvasSupported;_classCallCheck(this,e),this._textContentSource=s,this._isReadableStream=s instanceof ReadableStream,this._container=this._rootContainer=o,this._textDivs=u||[],this._textContentItemsStr=h||[],this._isOffscreenCanvasSupported=v,this._fontInspectorEnabled=!(null===(a=globalThis.FontInspector)||void 0===a||!a.enabled),this._reader=null,this._textDivProperties=d||new WeakMap,this._canceled=!1,this._capability=new r.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:c.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:l(0,v)};var f=c.rawDims,p=f.pageWidth,_=f.pageHeight,g=f.pageX,y=f.pageY;this._transform=[1,0,0,-1,-g,y+_],this._pageWidth=p,this._pageHeight=_,(0,n.setLayerDimensions)(o,c),this._capability.promise.finally((function(){i._layoutTextParams=null})).catch((function(){}))}return _createClass(e,[{key:"promise",get:function(){return this._capability.promise}},{key:"cancel",value:function(){this._canceled=!0,this._reader&&(this._reader.cancel(new r.AbortException("TextLayer task cancelled.")).catch((function(){})),this._reader=null),this._capability.reject(new r.AbortException("TextLayer task cancelled."))}},{key:"_processItems",value:function(e,t){var a,r=_createForOfIteratorHelper(e);try{for(r.s();!(a=r.n()).done;){var n=a.value;if(void 0!==n.str)this._textContentItemsStr.push(n.str),c(this,n,t);else if("beginMarkedContentProps"===n.type||"beginMarkedContent"===n.type){var i=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==n.id&&this._container.setAttribute("id","".concat(n.id)),i.append(this._container)}else"endMarkedContent"===n.type&&(this._container=this._container.parentNode)}}catch(s){r.e(s)}finally{r.f()}}},{key:"_layoutText",value:function(e){var t=this._layoutTextParams.properties=this._textDivProperties.get(e);if(this._layoutTextParams.div=e,u(this._layoutTextParams),t.hasText&&this._container.append(e),t.hasEOL){var a=document.createElement("br");a.setAttribute("role","presentation"),this._container.append(a)}}},{key:"_render",value:function(){var e=this,t=new r.PromiseCapability,a=Object.create(null);if(this._isReadableStream)this._reader=this._textContentSource.getReader(),function r(){e._reader.read().then((function(n){var i=n.value;n.done?t.resolve():(Object.assign(a,i.styles),e._processItems(i.items,a),r())}),t.reject)}();else{if(!this._textContentSource)throw new Error('No "textContentSource" parameter specified.');var n=this._textContentSource,i=n.items,s=n.styles;this._processItems(i,s),t.resolve()}t.promise.then((function(){a=null,function(e){if(!e._canceled){var t=e._textDivs,a=e._capability;if(t.length>1e5)a.resolve();else{if(!e._isReadableStream){var r,n=_createForOfIteratorHelper(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;e._layoutText(i)}}catch(s){n.e(s)}finally{n.f()}}a.resolve()}}}(e)}),this._capability.reject)}}]),e}();t.TextLayerRenderTask=d},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var r=a(1),n=a(5),i=a(28),s=a(29),o=a(6),l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,v=new WeakMap,f=new WeakMap,p=new WeakMap,_=new WeakSet,g=new WeakSet,y=new WeakSet,m=new WeakSet,b=function(){function e(t){_classCallCheck(this,e),_classPrivateMethodInitSpec(this,m),_classPrivateMethodInitSpec(this,y),_classPrivateMethodInitSpec(this,g),_classPrivateMethodInitSpec(this,_),_classPrivateFieldInitSpec(this,l,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,c,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,u,{writable:!0,value:this.pointerup.bind(this)}),_classPrivateFieldInitSpec(this,d,{writable:!0,value:this.pointerdown.bind(this)}),_classPrivateFieldInitSpec(this,h,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,v,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,f,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,p,{writable:!0,value:void 0}),e._initialized||(e._initialized=!0,i.FreeTextEditor.initialize(t.l10n),s.InkEditor.initialize(t.l10n)),t.uiManager.registerEditorTypes([i.FreeTextEditor,s.InkEditor]),_classPrivateFieldSet(this,p,t.uiManager),this.pageIndex=t.pageIndex,this.div=t.div,_classPrivateFieldSet(this,l,t.accessibilityManager),_classPrivateFieldGet(this,p).addLayer(this)}return _createClass(e,[{key:"isEmpty",get:function(){return 0===_classPrivateFieldGet(this,h).size}},{key:"updateToolbar",value:function(e){_classPrivateFieldGet(this,p).updateToolbar(e)}},{key:"updateMode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_classPrivateFieldGet(this,p).getMode();_classPrivateMethodGet(this,m,S).call(this),e===r.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),_classPrivateFieldGet(this,p).unselectAll(),e!==r.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",e===r.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",e===r.AnnotationEditorType.INK),this.div.hidden=!1)}},{key:"addInkEditorIfNeeded",value:function(e){if(e||_classPrivateFieldGet(this,p).getMode()===r.AnnotationEditorType.INK){if(!e){var t,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(a.s();!(t=a.n()).done;){var n=t.value;if(n.isEmpty())return void n.setInBackground()}}catch(i){a.e(i)}finally{a.f()}}_classPrivateMethodGet(this,y,P).call(this,{offsetX:0,offsetY:0}).setInBackground()}}},{key:"setEditingState",value:function(e){_classPrivateFieldGet(this,p).setEditingState(e)}},{key:"addCommands",value:function(e){_classPrivateFieldGet(this,p).addCommands(e)}},{key:"enable",value:function(){this.div.style.pointerEvents="auto";var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(t.s();!(e=t.n()).done;)e.value.enableEditing()}catch(a){t.e(a)}finally{t.f()}}},{key:"disable",value:function(){this.div.style.pointerEvents="none";var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(t.s();!(e=t.n()).done;)e.value.disableEditing()}catch(a){t.e(a)}finally{t.f()}_classPrivateMethodGet(this,m,S).call(this),this.isEmpty&&(this.div.hidden=!0)}},{key:"setActiveEditor",value:function(e){_classPrivateFieldGet(this,p).getActive()!==e&&_classPrivateFieldGet(this,p).setActiveEditor(e)}},{key:"enableClick",value:function(){this.div.addEventListener("pointerdown",_classPrivateFieldGet(this,d)),this.div.addEventListener("pointerup",_classPrivateFieldGet(this,u))}},{key:"disableClick",value:function(){this.div.removeEventListener("pointerdown",_classPrivateFieldGet(this,d)),this.div.removeEventListener("pointerup",_classPrivateFieldGet(this,u))}},{key:"attach",value:function(e){_classPrivateFieldGet(this,h).set(e.id,e)}},{key:"detach",value:function(e){var t;_classPrivateFieldGet(this,h).delete(e.id),null===(t=_classPrivateFieldGet(this,l))||void 0===t||t.removePointerInTextLayer(e.contentDiv)}},{key:"remove",value:function(e){var t=this;_classPrivateFieldGet(this,p).removeEditor(e),this.detach(e),e.div.style.display="none",setTimeout((function(){e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&_classPrivateFieldGet(t,p).focusMainContainer()}),0),_classPrivateFieldGet(this,f)||this.addInkEditorIfNeeded(!1)}},{key:"add",value:function(e){if(_classPrivateMethodGet(this,_,k).call(this,e),_classPrivateFieldGet(this,p).addEditor(e),this.attach(e),!e.isAttachedToDOM){var t=e.render();this.div.append(t),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),_classPrivateFieldGet(this,p).addToAnnotationStorage(e)}},{key:"moveEditorInDOM",value:function(e){var t;null===(t=_classPrivateFieldGet(this,l))||void 0===t||t.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}},{key:"addOrRebuild",value:function(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}},{key:"addANewEditor",value:function(e){var t=this;this.addCommands({cmd:function(){t.addOrRebuild(e)},undo:function(){e.remove()},mustExec:!0})}},{key:"addUndoableEditor",value:function(e){var t=this;this.addCommands({cmd:function(){t.addOrRebuild(e)},undo:function(){e.remove()},mustExec:!1})}},{key:"getNextId",value:function(){return _classPrivateFieldGet(this,p).getId()}},{key:"deserialize",value:function(e){switch(e.annotationType){case r.AnnotationEditorType.FREETEXT:return i.FreeTextEditor.deserialize(e,this,_classPrivateFieldGet(this,p));case r.AnnotationEditorType.INK:return s.InkEditor.deserialize(e,this,_classPrivateFieldGet(this,p))}return null}},{key:"setSelected",value:function(e){_classPrivateFieldGet(this,p).setSelected(e)}},{key:"toggleSelected",value:function(e){_classPrivateFieldGet(this,p).toggleSelected(e)}},{key:"isSelected",value:function(e){return _classPrivateFieldGet(this,p).isSelected(e)}},{key:"unselect",value:function(e){_classPrivateFieldGet(this,p).unselect(e)}},{key:"pointerup",value:function(e){var t=r.FeatureTest.platform.isMac;0!==e.button||e.ctrlKey&&t||e.target===this.div&&_classPrivateFieldGet(this,v)&&(_classPrivateFieldSet(this,v,!1),_classPrivateFieldGet(this,c)?_classPrivateMethodGet(this,y,P).call(this,e):_classPrivateFieldSet(this,c,!0))}},{key:"pointerdown",value:function(e){var t=r.FeatureTest.platform.isMac;if(!(0!==e.button||e.ctrlKey&&t)&&e.target===this.div){_classPrivateFieldSet(this,v,!0);var a=_classPrivateFieldGet(this,p).getActive();_classPrivateFieldSet(this,c,!a||a.isEmpty())}}},{key:"drop",value:function(e){var t=e.dataTransfer.getData("text/plain"),a=_classPrivateFieldGet(this,p).getEditor(t);if(a){e.preventDefault(),e.dataTransfer.dropEffect="move",_classPrivateMethodGet(this,_,k).call(this,a);var r=this.div.getBoundingClientRect(),n=e.clientX-r.x,i=e.clientY-r.y;a.translate(n-a.startX,i-a.startY),this.moveEditorInDOM(a),a.div.focus()}}},{key:"dragover",value:function(e){e.preventDefault()}},{key:"destroy",value:function(){var e;(null===(e=_classPrivateFieldGet(this,p).getActive())||void 0===e?void 0:e.parent)===this&&_classPrivateFieldGet(this,p).setActiveEditor(null);var t,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(a.s();!(t=a.n()).done;){var r,n=t.value;null===(r=_classPrivateFieldGet(this,l))||void 0===r||r.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove()}}catch(i){a.e(i)}finally{a.f()}this.div=null,_classPrivateFieldGet(this,h).clear(),_classPrivateFieldGet(this,p).removeLayer(this)}},{key:"render",value:function(e){var t=e.viewport;this.viewport=t,(0,o.setLayerDimensions)(this.div,t),(0,n.bindEvents)(this,this.div,["dragover","drop"]);var a,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,p).getEditors(this.pageIndex));try{for(r.s();!(a=r.n()).done;){var i=a.value;this.add(i)}}catch(s){r.e(s)}finally{r.f()}this.updateMode()}},{key:"update",value:function(e){var t=e.viewport;_classPrivateFieldGet(this,p).commitOrRemove(),this.viewport=t,(0,o.setLayerDimensions)(this.div,{rotation:t.rotation}),this.updateMode()}},{key:"pageDimensions",get:function(){var e=this.viewport.rawDims;return[e.pageWidth,e.pageHeight]}}]),e}();function k(e){var t;e.parent!==this&&(this.attach(e),null===(t=e.parent)||void 0===t||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}function A(e){switch(_classPrivateFieldGet(this,p).getMode()){case r.AnnotationEditorType.FREETEXT:return new i.FreeTextEditor(e);case r.AnnotationEditorType.INK:return new s.InkEditor(e)}return null}function P(e){var t=this.getNextId(),a=_classPrivateMethodGet(this,g,A).call(this,{parent:this,id:t,x:e.offsetX,y:e.offsetY,uiManager:_classPrivateFieldGet(this,p)});return a&&this.add(a),a}function S(){_classPrivateFieldSet(this,f,!0);var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(t.s();!(e=t.n()).done;){var a=e.value;a.isEmpty()&&a.remove()}}catch(r){t.e(r)}finally{t.f()}_classPrivateFieldSet(this,f,!1)}_defineProperty(b,"_initialized",!1),t.AnnotationEditorLayer=b},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var r=a(1),n=a(5),i=a(4),s=new WeakMap,o=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,v=new WeakMap,f=new WeakMap,p=new WeakSet,_=new WeakSet,g=new WeakSet,y=new WeakSet,m=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r;return _classCallCheck(this,a),r=t.call(this,_objectSpread(_objectSpread({},e),{},{name:"freeTextEditor"})),_classPrivateMethodInitSpec(_assertThisInitialized(r),y),_classPrivateMethodInitSpec(_assertThisInitialized(r),g),_classPrivateMethodInitSpec(_assertThisInitialized(r),_),_classPrivateMethodInitSpec(_assertThisInitialized(r),p),_classPrivateFieldInitSpec(_assertThisInitialized(r),s,{writable:!0,value:r.editorDivBlur.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),o,{writable:!0,value:r.editorDivFocus.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),l,{writable:!0,value:r.editorDivInput.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),c,{writable:!0,value:r.editorDivKeydown.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),u,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),d,{writable:!0,value:""}),_classPrivateFieldInitSpec(_assertThisInitialized(r),h,{writable:!0,value:"".concat(r.id,"-editor")}),_classPrivateFieldInitSpec(_assertThisInitialized(r),v,{writable:!0,value:!1}),_classPrivateFieldInitSpec(_assertThisInitialized(r),f,{writable:!0,value:void 0}),_classPrivateFieldSet(_assertThisInitialized(r),u,e.color||a._defaultColor||i.AnnotationEditor._defaultLineColor),_classPrivateFieldSet(_assertThisInitialized(r),f,e.fontSize||a._defaultFontSize),r}return _createClass(a,[{key:"updateParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:_classPrivateMethodGet(this,p,b).call(this,t);break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:_classPrivateMethodGet(this,_,k).call(this,t)}}},{key:"propertiesToUpdate",get:function(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,_classPrivateFieldGet(this,f)],[r.AnnotationEditorParamsType.FREETEXT_COLOR,_classPrivateFieldGet(this,u)]]}},{key:"getInitialTranslation",value:function(){var e=this.parentScale;return[-a._internalPadding*e,-(a._internalPadding+_classPrivateFieldGet(this,f))*e]}},{key:"rebuild",value:function(){_get(_getPrototypeOf(a.prototype),"rebuild",this).call(this),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}},{key:"enableEditMode",value:function(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(r.AnnotationEditorType.FREETEXT),_get(_getPrototypeOf(a.prototype),"enableEditMode",this).call(this),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",_classPrivateFieldGet(this,c)),this.editorDiv.addEventListener("focus",_classPrivateFieldGet(this,o)),this.editorDiv.addEventListener("blur",_classPrivateFieldGet(this,s)),this.editorDiv.addEventListener("input",_classPrivateFieldGet(this,l)))}},{key:"disableEditMode",value:function(){this.isInEditMode()&&(this.parent.setEditingState(!0),_get(_getPrototypeOf(a.prototype),"disableEditMode",this).call(this),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",_classPrivateFieldGet(this,h)),this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",_classPrivateFieldGet(this,c)),this.editorDiv.removeEventListener("focus",_classPrivateFieldGet(this,o)),this.editorDiv.removeEventListener("blur",_classPrivateFieldGet(this,s)),this.editorDiv.removeEventListener("input",_classPrivateFieldGet(this,l)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}},{key:"focusin",value:function(e){_get(_getPrototypeOf(a.prototype),"focusin",this).call(this,e),e.target!==this.editorDiv&&this.editorDiv.focus()}},{key:"onceAdded",value:function(){this.width||(this.enableEditMode(),this.editorDiv.focus())}},{key:"isEmpty",value:function(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}},{key:"remove",value:function(){this.isEditing=!1,this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing"),_get(_getPrototypeOf(a.prototype),"remove",this).call(this)}},{key:"commit",value:function(){this.isInEditMode()&&(_get(_getPrototypeOf(a.prototype),"commit",this).call(this),_classPrivateFieldGet(this,v)||(_classPrivateFieldSet(this,v,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),_classPrivateFieldSet(this,d,_classPrivateMethodGet(this,g,A).call(this).trimEnd()),_classPrivateMethodGet(this,y,P).call(this))}},{key:"shouldGetKeyboardEvents",value:function(){return this.isInEditMode()}},{key:"dblclick",value:function(e){this.enableEditMode(),this.editorDiv.focus()}},{key:"keydown",value:function(e){e.target===this.div&&"Enter"===e.key&&(this.enableEditMode(),this.editorDiv.focus())}},{key:"editorDivKeydown",value:function(e){a._keyboardManager.exec(this,e)}},{key:"editorDivFocus",value:function(e){this.isEditing=!0}},{key:"editorDivBlur",value:function(e){this.isEditing=!1}},{key:"editorDivInput",value:function(e){this.parent.div.classList.toggle("freeTextEditing",this.isEmpty())}},{key:"disableEditing",value:function(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}},{key:"enableEditing",value:function(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}},{key:"render",value:function(){var e,t,r=this;if(this.div)return this.div;this.width&&(e=this.x,t=this.y),_get(_getPrototypeOf(a.prototype),"render",this).call(this),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",_classPrivateFieldGet(this,h)),this.enableEditing(),a._l10nPromise.get("editor_free_text2_aria_label").then((function(e){var t;return null===(t=r.editorDiv)||void 0===t?void 0:t.setAttribute("aria-label",e)})),a._l10nPromise.get("free_text2_default_content").then((function(e){var t;return null===(t=r.editorDiv)||void 0===t?void 0:t.setAttribute("default-content",e)})),this.editorDiv.contentEditable=!0;var i=this.editorDiv.style;if(i.fontSize="calc(".concat(_classPrivateFieldGet(this,f),"px * var(--scale-factor))"),i.color=_classPrivateFieldGet(this,u),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,n.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){var s=_slicedToArray(this.parentDimensions,2),o=s[0],l=s[1];this.setAt(e*o,t*l,this.width*o,this.height*l);var c,v=_createForOfIteratorHelper(_classPrivateFieldGet(this,d).split("\n"));try{for(v.s();!(c=v.n()).done;){var p=c.value,_=document.createElement("div");_.append(p?document.createTextNode(p):document.createElement("br")),this.editorDiv.append(_)}}catch(g){v.e(g)}finally{v.f()}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}},{key:"contentDiv",get:function(){return this.editorDiv}},{key:"serialize",value:function(){if(this.isEmpty())return null;var e=a._internalPadding*this.parentScale,t=this.getRect(e,e),n=i.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:_classPrivateFieldGet(this,u));return{annotationType:r.AnnotationEditorType.FREETEXT,color:n,fontSize:_classPrivateFieldGet(this,f),value:_classPrivateFieldGet(this,d),pageIndex:this.pageIndex,rect:t,rotation:this.rotation}}}],[{key:"initialize",value:function(e){this._l10nPromise=new Map(["free_text2_default_content","editor_free_text2_aria_label"].map((function(t){return[t,e.get(t)]})));var t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}},{key:"updateDefaultParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:a._defaultFontSize=t;break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:a._defaultColor=t}}},{key:"defaultPropertiesToUpdate",get:function(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,a._defaultFontSize],[r.AnnotationEditorParamsType.FREETEXT_COLOR,a._defaultColor||i.AnnotationEditor._defaultLineColor]]}},{key:"deserialize",value:function(e,t,n){var i,s=_get(_getPrototypeOf(a),"deserialize",this).call(this,e,t,n);return _classPrivateFieldSet(s,f,e.fontSize),_classPrivateFieldSet(s,u,(i=r.Util).makeHexColor.apply(i,_toConsumableArray(e.color))),_classPrivateFieldSet(s,d,e.value),s}}]),a}(i.AnnotationEditor);function b(e){var t=this,a=function(e){t.editorDiv.style.fontSize="calc(".concat(e,"px * var(--scale-factor))"),t.translate(0,-(e-_classPrivateFieldGet(t,f))*t.parentScale),_classPrivateFieldSet(t,f,e),_classPrivateMethodGet(t,y,P).call(t)},n=_classPrivateFieldGet(this,f);this.addCommands({cmd:function(){a(e)},undo:function(){a(n)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function k(e){var t=this,a=_classPrivateFieldGet(this,u);this.addCommands({cmd:function(){_classPrivateFieldSet(t,u,t.editorDiv.style.color=e)},undo:function(){_classPrivateFieldSet(t,u,t.editorDiv.style.color=a)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function A(){var e=this.editorDiv.getElementsByTagName("div");if(0===e.length)return this.editorDiv.innerText;var t,a=[],r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;a.push(n.innerText.replace(/\r\n?|\n/,""))}}catch(i){r.e(i)}finally{r.f()}return a.join("\n")}function P(){var e,t=_slicedToArray(this.parentDimensions,2),a=t[0],r=t[1];if(this.isAttachedToDOM)e=this.div.getBoundingClientRect();else{var n=this.currentLayer,i=this.div,s=i.style.display;i.style.display="hidden",n.div.append(this.div),e=i.getBoundingClientRect(),i.remove(),i.style.display=s}this.width=e.width/a,this.height=e.height/r}_defineProperty(m,"_freeTextDefaultContent",""),_defineProperty(m,"_l10nPromise",void 0),_defineProperty(m,"_internalPadding",0),_defineProperty(m,"_defaultColor",null),_defineProperty(m,"_defaultFontSize",10),_defineProperty(m,"_keyboardManager",new n.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],m.prototype.commitOrRemove]])),_defineProperty(m,"_type","freetext"),t.FreeTextEditor=m},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0,Object.defineProperty(t,"fitCurve",{enumerable:!0,get:function(){return i.fitCurve}});var r=a(1),n=a(4),i=a(30),s=a(5),o=16,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,v=new WeakMap,f=new WeakMap,p=new WeakMap,_=new WeakMap,g=new WeakMap,y=new WeakMap,m=new WeakMap,b=new WeakMap,k=new WeakMap,A=new WeakSet,P=new WeakSet,S=new WeakSet,F=new WeakSet,C=new WeakSet,x=new WeakSet,w=new WeakSet,E=new WeakSet,T=new WeakSet,M=new WeakSet,I=new WeakSet,R=new WeakSet,O=new WeakSet,D=new WeakSet,G=new WeakSet,L=new WeakSet,N=new WeakSet,j=new WeakSet,W=new WeakSet,B=new WeakSet,H=new WeakSet,U=new WeakSet,q=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r;return _classCallCheck(this,a),r=t.call(this,_objectSpread(_objectSpread({},e),{},{name:"inkEditor"})),_classPrivateMethodInitSpec(_assertThisInitialized(r),U),_classPrivateMethodInitSpec(_assertThisInitialized(r),H),_classPrivateMethodInitSpec(_assertThisInitialized(r),B),_classPrivateMethodInitSpec(_assertThisInitialized(r),W),_classPrivateMethodInitSpec(_assertThisInitialized(r),j),_classPrivateMethodInitSpec(_assertThisInitialized(r),N),_classPrivateMethodInitSpec(_assertThisInitialized(r),L),_classPrivateMethodInitSpec(_assertThisInitialized(r),G),_classPrivateMethodInitSpec(_assertThisInitialized(r),D),_classPrivateMethodInitSpec(_assertThisInitialized(r),O),_classPrivateMethodInitSpec(_assertThisInitialized(r),R),_classPrivateMethodInitSpec(_assertThisInitialized(r),I),_classPrivateMethodInitSpec(_assertThisInitialized(r),M),_classPrivateMethodInitSpec(_assertThisInitialized(r),T),_classPrivateMethodInitSpec(_assertThisInitialized(r),E),_classPrivateMethodInitSpec(_assertThisInitialized(r),w),_classPrivateMethodInitSpec(_assertThisInitialized(r),x),_classPrivateMethodInitSpec(_assertThisInitialized(r),C),_classPrivateMethodInitSpec(_assertThisInitialized(r),F),_classPrivateMethodInitSpec(_assertThisInitialized(r),S),_classPrivateMethodInitSpec(_assertThisInitialized(r),P),_classPrivateMethodInitSpec(_assertThisInitialized(r),A),_classPrivateFieldInitSpec(_assertThisInitialized(r),l,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),c,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),u,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),d,{writable:!0,value:r.canvasPointermove.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),h,{writable:!0,value:r.canvasPointerleave.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),v,{writable:!0,value:r.canvasPointerup.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),f,{writable:!0,value:r.canvasPointerdown.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),p,{writable:!0,value:!1}),_classPrivateFieldInitSpec(_assertThisInitialized(r),_,{writable:!0,value:!1}),_classPrivateFieldInitSpec(_assertThisInitialized(r),g,{writable:!0,value:null}),_classPrivateFieldInitSpec(_assertThisInitialized(r),y,{writable:!0,value:null}),_classPrivateFieldInitSpec(_assertThisInitialized(r),m,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),b,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),k,{writable:!0,value:null}),r.color=e.color||null,r.thickness=e.thickness||null,r.opacity=e.opacity||null,r.paths=[],r.bezierPath2D=[],r.currentPath=[],r.scaleFactor=1,r.translationX=r.translationY=0,r.x=0,r.y=0,r}return _createClass(a,[{key:"updateParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:_classPrivateMethodGet(this,A,z).call(this,t);break;case r.AnnotationEditorParamsType.INK_COLOR:_classPrivateMethodGet(this,P,V).call(this,t);break;case r.AnnotationEditorParamsType.INK_OPACITY:_classPrivateMethodGet(this,S,X).call(this,t)}}},{key:"propertiesToUpdate",get:function(){var e;return[[r.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||a._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,this.color||a._defaultColor||n.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(null!==(e=this.opacity)&&void 0!==e?e:a._defaultOpacity))]]}},{key:"rebuild",value:function(){_get(_getPrototypeOf(a.prototype),"rebuild",this).call(this),null!==this.div&&(this.canvas||(_classPrivateMethodGet(this,I,te).call(this),_classPrivateMethodGet(this,R,ae).call(this)),this.isAttachedToDOM||(this.parent.add(this),_classPrivateMethodGet(this,O,re).call(this)),_classPrivateMethodGet(this,H,he).call(this))}},{key:"remove",value:function(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,_classPrivateFieldGet(this,y).disconnect(),_classPrivateFieldSet(this,y,null),_get(_getPrototypeOf(a.prototype),"remove",this).call(this))}},{key:"setParent",value:function(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&null===e&&this._uiManager.addShouldRescale(this),_get(_getPrototypeOf(a.prototype),"setParent",this).call(this,e)}},{key:"onScaleChanging",value:function(){var e=_slicedToArray(this.parentDimensions,2),t=e[0],a=e[1],r=this.width*t,n=this.height*a;this.setDimensions(r,n)}},{key:"enableEditMode",value:function(){_classPrivateFieldGet(this,p)||null===this.canvas||(_get(_getPrototypeOf(a.prototype),"enableEditMode",this).call(this),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",_classPrivateFieldGet(this,f)),this.canvas.addEventListener("pointerup",_classPrivateFieldGet(this,v)))}},{key:"disableEditMode",value:function(){this.isInEditMode()&&null!==this.canvas&&(_get(_getPrototypeOf(a.prototype),"disableEditMode",this).call(this),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",_classPrivateFieldGet(this,f)),this.canvas.removeEventListener("pointerup",_classPrivateFieldGet(this,v)))}},{key:"onceAdded",value:function(){this.div.draggable=!this.isEmpty()}},{key:"isEmpty",value:function(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}},{key:"commit",value:function(){_classPrivateFieldGet(this,p)||(_get(_getPrototypeOf(a.prototype),"commit",this).call(this),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),_classPrivateFieldSet(this,p,!0),this.div.classList.add("disabled"),_classPrivateMethodGet(this,H,he).call(this,!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus({preventScroll:!0}))}},{key:"focusin",value:function(e){_get(_getPrototypeOf(a.prototype),"focusin",this).call(this,e),this.enableEditMode()}},{key:"canvasPointerdown",value:function(e){0===e.button&&this.isInEditMode()&&!_classPrivateFieldGet(this,p)&&(this.setInForeground(),"mouse"!==e.type&&this.div.focus(),e.stopPropagation(),this.canvas.addEventListener("pointerleave",_classPrivateFieldGet(this,h)),this.canvas.addEventListener("pointermove",_classPrivateFieldGet(this,d)),_classPrivateMethodGet(this,x,Z).call(this,e.offsetX,e.offsetY))}},{key:"canvasPointermove",value:function(e){e.stopPropagation(),_classPrivateMethodGet(this,w,J).call(this,e.offsetX,e.offsetY)}},{key:"canvasPointerup",value:function(e){0===e.button&&this.isInEditMode()&&0!==this.currentPath.length&&(e.stopPropagation(),_classPrivateMethodGet(this,M,ee).call(this,e),this.setInBackground())}},{key:"canvasPointerleave",value:function(e){_classPrivateMethodGet(this,M,ee).call(this,e),this.setInBackground()}},{key:"render",value:function(){var e,t,r=this;if(this.div)return this.div;this.width&&(e=this.x,t=this.y),_get(_getPrototypeOf(a.prototype),"render",this).call(this),a._l10nPromise.get("editor_ink2_aria_label").then((function(e){var t;return null===(t=r.div)||void 0===t?void 0:t.setAttribute("aria-label",e)}));var n=_classPrivateMethodGet(this,F,Y).call(this),i=_slicedToArray(n,4),s=i[0],o=i[1],l=i[2],c=i[3];if(this.setAt(s,o,0,0),this.setDims(l,c),_classPrivateMethodGet(this,I,te).call(this),this.width){var u=_slicedToArray(this.parentDimensions,2),d=u[0],h=u[1];this.setAt(e*d,t*h,this.width*d,this.height*h),_classPrivateFieldSet(this,_,!0),_classPrivateMethodGet(this,O,re).call(this),this.setDims(this.width*d,this.height*h),_classPrivateMethodGet(this,T,$).call(this),_classPrivateMethodGet(this,U,ve).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return _classPrivateMethodGet(this,R,ae).call(this),this.div}},{key:"setDimensions",value:function(e,t){var a=Math.round(e),r=Math.round(t);if(_classPrivateFieldGet(this,m)!==a||_classPrivateFieldGet(this,b)!==r){_classPrivateFieldSet(this,m,a),_classPrivateFieldSet(this,b,r),this.canvas.style.visibility="hidden",_classPrivateFieldGet(this,l)&&Math.abs(_classPrivateFieldGet(this,l)-e/t)>.01&&(t=Math.ceil(e/_classPrivateFieldGet(this,l)),this.setDims(e,t));var n=_slicedToArray(this.parentDimensions,2),i=n[0],s=n[1];this.width=e/i,this.height=t/s,_classPrivateFieldGet(this,p)&&_classPrivateMethodGet(this,D,ne).call(this,e,t),_classPrivateMethodGet(this,O,re).call(this),_classPrivateMethodGet(this,T,$).call(this),this.canvas.style.visibility="visible",this.fixDims()}}},{key:"serialize",value:function(){if(this.isEmpty())return null;var e=this.getRect(0,0),t=this.rotation%180===0?e[3]-e[1]:e[2]-e[0],a=n.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:r.AnnotationEditorType.INK,color:a,thickness:this.thickness,opacity:this.opacity,paths:_classPrivateMethodGet(this,L,oe).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:e,rotation:this.rotation}}}],[{key:"initialize",value:function(e){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map((function(t){return[t,e.get(t)]})))}},{key:"updateDefaultParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:a._defaultThickness=t;break;case r.AnnotationEditorParamsType.INK_COLOR:a._defaultColor=t;break;case r.AnnotationEditorParamsType.INK_OPACITY:a._defaultOpacity=t/100}}},{key:"defaultPropertiesToUpdate",get:function(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,a._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,a._defaultColor||n.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*a._defaultOpacity)]]}},{key:"deserialize",value:function(e,t,n){var i,s=_get(_getPrototypeOf(a),"deserialize",this).call(this,e,t,n);s.thickness=e.thickness,s.color=(i=r.Util).makeHexColor.apply(i,_toConsumableArray(e.color)),s.opacity=e.opacity;var d=_slicedToArray(s.pageDimensions,2),h=d[0],v=d[1],f=s.width*h,_=s.height*v,g=s.parentScale,y=e.thickness/2;_classPrivateFieldSet(s,l,f/_),_classPrivateFieldSet(s,p,!0),_classPrivateFieldSet(s,m,Math.round(f)),_classPrivateFieldSet(s,b,Math.round(_));var k,A=_createForOfIteratorHelper(e.paths);try{for(A.s();!(k=A.n()).done;){var P=k.value.bezier,S=[];s.paths.push(S);for(var F=g*(P[0]-y),C=g*(_-P[1]-y),x=2,w=P.length;x0&&void 0!==arguments[0]&&arguments[0];if(!this.isEmpty())if(_classPrivateFieldGet(this,p)){var t=_classPrivateMethodGet(this,W,ue).call(this),a=_classPrivateMethodGet(this,B,de).call(this);_classPrivateFieldSet(this,u,Math.max(o,t[2]-t[0])),_classPrivateFieldSet(this,c,Math.max(o,t[3]-t[1]));var r=Math.ceil(a+_classPrivateFieldGet(this,u)*this.scaleFactor),n=Math.ceil(a+_classPrivateFieldGet(this,c)*this.scaleFactor),i=_slicedToArray(this.parentDimensions,2),s=i[0],d=i[1];this.width=r/s,this.height=n/d,_classPrivateFieldSet(this,l,r/n),_classPrivateMethodGet(this,U,ve).call(this);var h=this.translationX,v=this.translationY;this.translationX=-t[0],this.translationY=-t[1],_classPrivateMethodGet(this,O,re).call(this),_classPrivateMethodGet(this,T,$).call(this),_classPrivateFieldSet(this,m,r),_classPrivateFieldSet(this,b,n),this.setDims(r,n);var f=e?a/this.scaleFactor/2:0;this.translate(h-this.translationX-f,v-this.translationY-f)}else _classPrivateMethodGet(this,T,$).call(this)}function ve(){var e=this.div.style;_classPrivateFieldGet(this,l)>=1?(e.minHeight="".concat(o,"px"),e.minWidth="".concat(Math.round(_classPrivateFieldGet(this,l)*o),"px")):(e.minWidth="".concat(o,"px"),e.minHeight="".concat(Math.round(o/_classPrivateFieldGet(this,l)),"px"))}_defineProperty(q,"_defaultColor",null),_defineProperty(q,"_defaultOpacity",1),_defineProperty(q,"_defaultThickness",1),_defineProperty(q,"_l10nPromise",void 0),_defineProperty(q,"_type","ink"),t.InkEditor=q},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.fitCurve=void 0;var r=a(31);t.fitCurve=r},function(e){function t(e,n,i,s,o){var c,u,d,h,v,f,p,_,g,y,m,b,k;if(2===e.length)return b=l.vectorLen(l.subtract(e[0],e[1]))/3,[c=[e[0],l.addArrays(e[0],l.mulItems(n,b)),l.addArrays(e[1],l.mulItems(i,b)),e[1]]];u=function(e){var t,a,r,n=[];return e.forEach((function(e,i){t=i?a+l.vectorLen(l.subtract(e,r)):0,n.push(t),a=t,r=e})),n=n.map((function(e){return e/a}))}(e);var A=a(e,u,u,n,i,o),P=_slicedToArray(A,3);if(c=P[0],h=P[1],f=P[2],0===h||h.9999&&C<1.0001)break}v=h,p=f}if(m=[],(_=l.subtract(e[f-1],e[f+1])).every((function(e){return 0===e}))){var x=[-(_=l.subtract(e[f-1],e[f]))[1],_[0]];_[0]=x[0],_[1]=x[1]}return g=l.normalize(_),y=l.mulItems(g,-1),m=(m=m.concat(t(e.slice(0,f+1),n,g,s,o))).concat(t(e.slice(f),y,i,s,o))}function a(e,t,a,r,n,o){var u,d,h;u=function(e,t,a,r){var n,i,s,o,u,d,h,v,f,p,_,g,y,m,b,k,A,P=e[0],S=e[e.length-1];for(n=[P,null,null,S],i=l.zeros_Xx2x2(t.length),y=0,m=t.length;yn&&(n=r,o=d);return[n,o]}(e,u,t),f=_slicedToArray(v,2);return d=f[0],h=f[1],o&&o({bez:u,points:e,params:t,maxErr:d,maxPoint:h}),[u,d,h]}function r(e,t,a){return a.map((function(a,r){return n(e,t[r],a)}))}function n(e,t,a){var r=l.subtract(c.q(e,a),t),n=c.qprime(e,a),i=l.mulMatrix(r,n),s=l.sum(l.squareItems(n))+2*l.mulMatrix(r,c.qprimeprime(e,a));return 0===s?a:a-i/s}var i=function(e,t){for(var a,r=[0],n=e[0],i=0,s=1;s<=t;s++)a=c.q(e,s/t),i+=l.vectorLen(l.subtract(a,n)),r.push(i),n=a;return r=r.map((function(e){return e/i}))};function s(e,t,a,r){if(t<0)return 0;if(t>1)return 1;for(var n,i,s,o,l=1;l<=r;l++)if(t<=a[l]){s=(l-1)/r,i=l/r,o=(t-(n=a[l-1]))/(a[l]-n)*(i-s)+s;break}return o}function o(e,t){return l.normalize(l.subtract(e,t))}var l=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"zeros_Xx2x2",value:function(e){for(var t=[];e--;)t.push([0,0]);return t}},{key:"mulItems",value:function(e,t){return e.map((function(e){return e*t}))}},{key:"mulMatrix",value:function(e,t){return e.reduce((function(e,a,r){return e+a*t[r]}),0)}},{key:"subtract",value:function(e,t){return e.map((function(e,a){return e-t[a]}))}},{key:"addArrays",value:function(e,t){return e.map((function(e,a){return e+t[a]}))}},{key:"addItems",value:function(e,t){return e.map((function(e){return e+t}))}},{key:"sum",value:function(e){return e.reduce((function(e,t){return e+t}))}},{key:"dot",value:function(t,a){return e.mulMatrix(t,a)}},{key:"vectorLen",value:function(e){return Math.hypot.apply(Math,_toConsumableArray(e))}},{key:"divItems",value:function(e,t){return e.map((function(e){return e/t}))}},{key:"squareItems",value:function(e){return e.map((function(e){return e*e}))}},{key:"normalize",value:function(e){return this.divItems(e,this.vectorLen(e))}}]),e}(),c=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"q",value:function(e,t){var a=1-t,r=l.mulItems(e[0],a*a*a),n=l.mulItems(e[1],3*a*a*t),i=l.mulItems(e[2],3*a*t*t),s=l.mulItems(e[3],t*t*t);return l.addArrays(l.addArrays(r,n),l.addArrays(i,s))}},{key:"qprime",value:function(e,t){var a=1-t,r=l.mulItems(l.subtract(e[1],e[0]),3*a*a),n=l.mulItems(l.subtract(e[2],e[1]),6*a*t),i=l.mulItems(l.subtract(e[3],e[2]),3*t*t);return l.addArrays(l.addArrays(r,n),i)}},{key:"qprimeprime",value:function(e,t){return l.addArrays(l.mulItems(l.addArrays(l.subtract(e[2],l.mulItems(e[1],2)),e[0]),6*(1-t)),l.mulItems(l.addArrays(l.subtract(e[3],l.mulItems(e[2],2)),e[1]),6*t))}}]),e}();e.exports=function(e,a,r){if(!Array.isArray(e))throw new TypeError("First argument should be an array");if(e.forEach((function(t){if(!Array.isArray(t)||t.some((function(e){return"number"!==typeof e}))||t.length!==e[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")})),(e=e.filter((function(t,a){return 0===a||!t.every((function(t,r){return t===e[a-1][r]}))}))).length<2)return[];var n=e.length,i=o(e[1],e[0]),s=o(e[n-2],e[n-1]);return t(e,i,s,a,r)},e.exports.fitCubic=t,e.exports.createTangent=o},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayer=void 0;var r=a(1),n=a(6),i=a(3),s=a(33),o=a(34),l=1e3,c=new WeakSet;function u(e){return{width:e[2]-e[0],height:e[3]-e[1]}}var d=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"create",value:function(e){switch(e.data.annotationType){case r.AnnotationType.LINK:return new p(e);case r.AnnotationType.TEXT:return new y(e);case r.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new b(e);case"Btn":return e.data.radioButton?new A(e):e.data.checkBox?new k(e):new P(e);case"Ch":return new S(e)}return new m(e);case r.AnnotationType.POPUP:return new F(e);case r.AnnotationType.FREETEXT:return new x(e);case r.AnnotationType.LINE:return new w(e);case r.AnnotationType.SQUARE:return new E(e);case r.AnnotationType.CIRCLE:return new T(e);case r.AnnotationType.POLYLINE:return new M(e);case r.AnnotationType.CARET:return new R(e);case r.AnnotationType.INK:return new O(e);case r.AnnotationType.POLYGON:return new I(e);case r.AnnotationType.HIGHLIGHT:return new D(e);case r.AnnotationType.UNDERLINE:return new G(e);case r.AnnotationType.SQUIGGLY:return new L(e);case r.AnnotationType.STRIKEOUT:return new N(e);case r.AnnotationType.STAMP:return new j(e);case r.AnnotationType.FILEATTACHMENT:return new W(e);default:return new h(e)}}}]),e}(),h=function(){function e(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=a.isRenderable,n=void 0!==r&&r,i=a.ignoreBorder,s=void 0!==i&&i,o=a.createQuadrilaterals,l=void 0!==o&&o;_classCallCheck(this,e),this.isRenderable=n,this.data=t.data,this.layer=t.layer,this.page=t.page,this.viewport=t.viewport,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,n&&(this.container=this._createContainer(s)),l&&(this.quadrilaterals=this._createQuadrilaterals(s))}return _createClass(e,[{key:"_createContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.data,a=this.page,n=this.viewport,i=document.createElement("section");i.setAttribute("data-annotation-id",t.id),t.noRotate&&i.classList.add("norotate");var s=n.rawDims,o=s.pageWidth,l=s.pageHeight,c=s.pageX,d=s.pageY,h=u(t.rect),v=h.width,f=h.height,p=r.Util.normalizeRect([t.rect[0],a.view[3]-t.rect[1]+a.view[1],t.rect[2],a.view[3]-t.rect[3]+a.view[1]]);if(!e&&t.borderStyle.width>0){i.style.borderWidth="".concat(t.borderStyle.width,"px");var _=t.borderStyle.horizontalCornerRadius,g=t.borderStyle.verticalCornerRadius;if(_>0||g>0){var y="calc(".concat(_,"px * var(--scale-factor)) / calc(").concat(g,"px * var(--scale-factor))");i.style.borderRadius=y}else if(this instanceof A){var m="calc(".concat(v,"px * var(--scale-factor)) / calc(").concat(f,"px * var(--scale-factor))");i.style.borderRadius=m}switch(t.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:i.style.borderStyle="solid";break;case r.AnnotationBorderStyleType.DASHED:i.style.borderStyle="dashed";break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)("Unimplemented border style: beveled");break;case r.AnnotationBorderStyleType.INSET:(0,r.warn)("Unimplemented border style: inset");break;case r.AnnotationBorderStyleType.UNDERLINE:i.style.borderBottomStyle="solid"}var b=t.borderColor||null;b?i.style.borderColor=r.Util.makeHexColor(0|b[0],0|b[1],0|b[2]):i.style.borderWidth=0}i.style.left="".concat(100*(p[0]-c)/o,"%"),i.style.top="".concat(100*(p[1]-d)/l,"%");var k=t.rotation;return t.hasOwnCanvas||0===k?(i.style.width="".concat(100*v/o,"%"),i.style.height="".concat(100*f/l,"%")):this.setRotation(k,i),i}},{key:"setRotation",value:function(e){var t,a,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container,n=this.viewport.rawDims,i=n.pageWidth,s=n.pageHeight,o=u(this.data.rect),l=o.width,c=o.height;e%180===0?(t=100*l/i,a=100*c/s):(t=100*c/i,a=100*l/s),r.style.width="".concat(t,"%"),r.style.height="".concat(a,"%"),r.setAttribute("data-main-rotation",(360-e)%360)}},{key:"_commonActions",get:function(){var e=this,t=function(e,t,a){var r=a.detail[e];a.target.style[t]=s.ColorConverters["".concat(r[0],"_HTML")](r.slice(1))};return(0,r.shadow)(this,"_commonActions",{display:function(t){var a=t.detail.display%2===1;e.container.style.visibility=a?"hidden":"visible",e.annotationStorage.setValue(e.data.id,{hidden:a,print:0===t.detail.display||3===t.detail.display})},print:function(t){e.annotationStorage.setValue(e.data.id,{print:t.detail.print})},hidden:function(t){e.container.style.visibility=t.detail.hidden?"hidden":"visible",e.annotationStorage.setValue(e.data.id,{hidden:t.detail.hidden})},focus:function(e){setTimeout((function(){return e.target.focus({preventScroll:!1})}),0)},userName:function(e){e.target.title=e.detail.userName},readonly:function(e){e.detail.readonly?e.target.setAttribute("readonly",""):e.target.removeAttribute("readonly")},required:function(t){e._setRequired(t.target,t.detail.required)},bgColor:function(e){t("bgColor","backgroundColor",e)},fillColor:function(e){t("fillColor","backgroundColor",e)},fgColor:function(e){t("fgColor","color",e)},textColor:function(e){t("textColor","color",e)},borderColor:function(e){t("borderColor","borderColor",e)},strokeColor:function(e){t("strokeColor","borderColor",e)},rotation:function(t){var a=t.detail.rotation;e.setRotation(a),e.annotationStorage.setValue(e.data.id,{rotation:a})}})}},{key:"_dispatchEventFromSandbox",value:function(e,t){for(var a=this._commonActions,r=0,n=Object.keys(t.detail);r0&&void 0!==arguments[0]&&arguments[0];if(!this.data.quadPoints)return null;var t,a=[],r=this.data.rect,n=_createForOfIteratorHelper(this.data.quadPoints);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.data.rect=[i[2].x,i[2].y,i[1].x,i[1].y],a.push(this._createContainer(e))}}catch(s){n.e(s)}finally{n.f()}return this.data.rect=r,a}},{key:"_createPopup",value:function(e,t){var a=this.container;this.quadrilaterals&&(e||(e=this.quadrilaterals),a=this.quadrilaterals[0]),e||((e=document.createElement("div")).classList.add("popupTriggerArea"),a.append(e));var r=new C({container:a,trigger:e,color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,hideWrapper:!0}).render();r.style.left="100%",a.append(r)}},{key:"_renderQuadrilaterals",value:function(e){var t,a=_createForOfIteratorHelper(this.quadrilaterals);try{for(a.s();!(t=a.n()).done;)t.value.classList.add(e)}catch(r){a.e(r)}finally{a.f()}return this.quadrilaterals}},{key:"render",value:function(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}},{key:"_getElementsByName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=[];if(this._fieldObjects){var n=this._fieldObjects[e];if(n){var i,s=_createForOfIteratorHelper(n);try{for(s.s();!(i=s.n()).done;){var o=i.value,l=o.page,u=o.id,d=o.exportValues;if(-1!==l&&u!==t){var h="string"===typeof d?d:null,v=document.querySelector('[data-element-id="'.concat(u,'"]'));!v||c.has(v)?a.push({id:u,exportValue:h,domElement:v}):(0,r.warn)("_getElementsByName - element not allowed: ".concat(u))}}}catch(m){s.e(m)}finally{s.f()}}return a}var f,p=_createForOfIteratorHelper(document.getElementsByName(e));try{for(p.s();!(f=p.n()).done;){var _=f.value,g=_.exportValue,y=_.getAttribute("data-element-id");y!==t&&c.has(_)&&a.push({id:y,exportValue:g,domElement:_})}}catch(m){p.e(m)}finally{p.f()}return a}}]),e}(),v=new WeakSet,f=new WeakSet,p=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return _classCallCheck(this,a),r=t.call(this,e,{isRenderable:!0,ignoreBorder:!(null===n||void 0===n||!n.ignoreBorder),createQuadrilaterals:!0}),_classPrivateMethodInitSpec(_assertThisInitialized(r),f),_classPrivateMethodInitSpec(_assertThisInitialized(r),v),r.isTooltipOnly=e.data.isTooltipOnly,r}return _createClass(a,[{key:"render",value:function(){var e=this.data,t=this.linkService,a=document.createElement("a");a.setAttribute("data-element-id",e.id);var r=!1;return e.url?(t.addLinkAttributes(a,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(a,e.action),r=!0):e.attachment?(this._bindAttachment(a,e.attachment),r=!0):e.setOCGState?(_classPrivateMethodGet(this,f,g).call(this,a,e.setOCGState),r=!0):e.dest?(this._bindLink(a,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(a,e),r=!0),e.resetForm?(this._bindResetFormAction(a,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(a,""),r=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((function(e,t){var r=0===t?a:a.cloneNode();return e.append(r),e})):(this.container.classList.add("linkAnnotation"),r&&this.container.append(a),this.container)}},{key:"_bindLink",value:function(e,t){var a=this;e.href=this.linkService.getDestinationHash(t),e.onclick=function(){return t&&a.linkService.goToDestination(t),!1},(t||""===t)&&_classPrivateMethodGet(this,v,_).call(this)}},{key:"_bindNamedAction",value:function(e,t){var a=this;e.href=this.linkService.getAnchorUrl(""),e.onclick=function(){return a.linkService.executeNamedAction(t),!1},_classPrivateMethodGet(this,v,_).call(this)}},{key:"_bindAttachment",value:function(e,t){var a=this;e.href=this.linkService.getAnchorUrl(""),e.onclick=function(){var e;return null===(e=a.downloadManager)||void 0===e||e.openOrDownloadData(a.container,t.content,t.filename),!1},_classPrivateMethodGet(this,v,_).call(this)}},{key:"_bindJSAction",value:function(e,t){var a=this;e.href=this.linkService.getAnchorUrl("");for(var r=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]),n=function(){var n=s[i],o=r.get(n);if(!o)return"continue";e[o]=function(){var e;return null===(e=a.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:a,detail:{id:t.id,name:n}}),!1}},i=0,s=Object.keys(t.actions);is&&(i=i.slice(0,s));var o={userValue:i,formattedValue:null,lastCommittedValue:null,commitKey:1};this.data.multiLine?((r=document.createElement("textarea")).textContent=i,this.data.doNotScroll&&(r.style.overflowY="hidden")):((r=document.createElement("input")).type="text",r.setAttribute("value",i),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),c.add(r),r.setAttribute("data-element-id",a),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=l,this._setRequired(r,this.data.required),s&&(r.maxLength=s),r.addEventListener("input",(function(n){t.setValue(a,{value:n.target.value}),e.setPropertyOnSiblings(r,"value",n.target.value,"value")})),r.addEventListener("resetform",(function(t){var a,n=null!==(a=e.data.defaultFieldValue)&&void 0!==a?a:"";r.value=o.userValue=n,o.formattedValue=null}));var u=function(e){var t=o.formattedValue;null!==t&&void 0!==t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var d;r.addEventListener("focus",(function(e){var t=e.target;o.userValue&&(t.value=o.userValue),o.lastCommittedValue=t.value,o.commitKey=1})),r.addEventListener("updatefromsandbox",(function(r){e.showElementAndHideCanvas(r.target);var n={value:function(e){var r;o.userValue=null!==(r=e.detail.value)&&void 0!==r?r:"",t.setValue(a,{value:o.userValue.toString()}),e.target.value=o.userValue},formattedValue:function(e){var r=e.detail.formattedValue;o.formattedValue=r,null!==r&&void 0!==r&&e.target!==document.activeElement&&(e.target.value=r),t.setValue(a,{formattedValue:r})},selRange:function(e){var t;(t=e.target).setSelectionRange.apply(t,_toConsumableArray(e.detail.selRange))},charLimit:function(r){var n,i=r.detail.charLimit,s=r.target;if(0!==i){s.setAttribute("maxLength",i);var l=o.userValue;!l||l.length<=i||(l=l.slice(0,i),s.value=o.userValue=l,t.setValue(a,{value:l}),null===(n=e.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:e,detail:{id:a,name:"Keystroke",value:l,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}else s.removeAttribute("maxLength")}};e._dispatchEventFromSandbox(n,r)})),r.addEventListener("keydown",(function(t){var r;o.commitKey=1;var n=-1;if("Escape"===t.key?n=0:"Enter"!==t.key||e.data.multiLine?"Tab"===t.key&&(o.commitKey=3):n=2,-1!==n){var i=t.target.value;o.lastCommittedValue!==i&&(o.lastCommittedValue=i,o.userValue=i,null===(r=e.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:e,detail:{id:a,name:"Keystroke",value:i,willCommit:!0,commitKey:n,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}}));var h=u;u=null,r.addEventListener("blur",(function(t){if(t.relatedTarget){var r,n=t.target.value;o.userValue=n,o.lastCommittedValue!==n&&(null===(r=e.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:e,detail:{id:a,name:"Keystroke",value:n,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})),h(t)}})),null!==(d=this.data.actions)&&void 0!==d&&d.Keystroke&&r.addEventListener("beforeinput",(function(t){var r;o.lastCommittedValue=null;var n=t.data,i=t.target,s=i.value,l=i.selectionStart,c=i.selectionEnd,u=l,d=c;switch(t.inputType){case"deleteWordBackward":var h=s.substring(0,l).match(/\w*[^\w]*$/);h&&(u-=h[0].length);break;case"deleteWordForward":var v=s.substring(l).match(/^[^\w]*\w*/);v&&(d+=v[0].length);break;case"deleteContentBackward":l===c&&(u-=1);break;case"deleteContentForward":l===c&&(d+=1)}t.preventDefault(),null===(r=e.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:e,detail:{id:a,name:"Keystroke",value:s,change:n||"",willCommit:!1,selStart:u,selEnd:d}})})),this._setEventListeners(r,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(e){return e.target.value}))}if(u&&r.addEventListener("blur",u),this.data.comb){var v=(this.data.rect[2]-this.data.rect[0])/s;r.classList.add("comb"),r.style.letterSpacing="calc(".concat(v,"px * var(--scale-factor) - 1ch)")}}else(r=document.createElement("div")).textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell";return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}]),a}(m),k=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){return _classCallCheck(this,a),t.call(this,e,{isRenderable:e.renderForms})}return _createClass(a,[{key:"render",value:function(){var e=this,t=this.annotationStorage,a=this.data,r=a.id,n=t.getValue(r,{value:a.exportValue===a.fieldValue}).value;"string"===typeof n&&(n="Off"!==n,t.setValue(r,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");var i=document.createElement("input");return c.add(i),i.setAttribute("data-element-id",r),i.disabled=a.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=a.fieldName,n&&i.setAttribute("checked",!0),i.setAttribute("exportValue",a.exportValue),i.tabIndex=l,i.addEventListener("change",(function(n){var i,s=n.target,o=s.name,l=s.checked,c=_createForOfIteratorHelper(e._getElementsByName(o,r));try{for(c.s();!(i=c.n()).done;){var u=i.value,d=l&&u.exportValue===a.exportValue;u.domElement&&(u.domElement.checked=d),t.setValue(u.id,{value:d})}}catch(h){c.e(h)}finally{c.f()}t.setValue(r,{value:l})})),i.addEventListener("resetform",(function(e){var t=a.defaultFieldValue||"Off";e.target.checked=t===a.exportValue})),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",(function(a){var n={value:function(e){e.target.checked="Off"!==e.detail.value,t.setValue(r,{value:e.target.checked})}};e._dispatchEventFromSandbox(n,a)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(e){return e.target.checked}))),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}]),a}(m),A=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){return _classCallCheck(this,a),t.call(this,e,{isRenderable:e.renderForms})}return _createClass(a,[{key:"render",value:function(){var e=this;this.container.classList.add("buttonWidgetAnnotation","radioButton");var t=this.annotationStorage,a=this.data,r=a.id,n=t.getValue(r,{value:a.fieldValue===a.buttonValue}).value;"string"===typeof n&&(n=n!==a.buttonValue,t.setValue(r,{value:n}));var i=document.createElement("input");if(c.add(i),i.setAttribute("data-element-id",r),i.disabled=a.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=a.fieldName,n&&i.setAttribute("checked",!0),i.tabIndex=l,i.addEventListener("change",(function(a){var n,i=a.target,s=i.name,o=i.checked,l=_createForOfIteratorHelper(e._getElementsByName(s,r));try{for(l.s();!(n=l.n()).done;){var c=n.value;t.setValue(c.id,{value:!1})}}catch(u){l.e(u)}finally{l.f()}t.setValue(r,{value:o})})),i.addEventListener("resetform",(function(e){var t=a.defaultFieldValue;e.target.checked=null!==t&&void 0!==t&&t===a.buttonValue})),this.enableScripting&&this.hasJSActions){var s=a.buttonValue;i.addEventListener("updatefromsandbox",(function(a){var n={value:function(a){var n,i=s===a.detail.value,o=_createForOfIteratorHelper(e._getElementsByName(a.target.name));try{for(o.s();!(n=o.n()).done;){var l=n.value,c=i&&l.id===r;l.domElement&&(l.domElement.checked=c),t.setValue(l.id,{value:c})}}catch(u){o.e(u)}finally{o.f()}}};e._dispatchEventFromSandbox(n,a)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(e){return e.target.checked}))}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}]),a}(m),P=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){return _classCallCheck(this,a),t.call(this,e,{ignoreBorder:e.data.hasAppearance})}return _createClass(a,[{key:"render",value:function(){var e=this,t=_get(_getPrototypeOf(a.prototype),"render",this).call(this);t.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(t.title=this.data.alternativeText);var r=t.lastChild;return this.enableScripting&&this.hasJSActions&&r&&(this._setDefaultPropertiesFromJS(r),r.addEventListener("updatefromsandbox",(function(t){e._dispatchEventFromSandbox({},t)}))),t}}]),a}(p),S=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){return _classCallCheck(this,a),t.call(this,e,{isRenderable:e.renderForms})}return _createClass(a,[{key:"render",value:function(){var e=this;this.container.classList.add("choiceWidgetAnnotation");var t=this.annotationStorage,a=this.data.id,r=t.getValue(a,{value:this.data.fieldValue}),n=document.createElement("select");c.add(n),n.setAttribute("data-element-id",a),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=l;var i=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(function(t){var a,r=e.data.defaultFieldValue,i=_createForOfIteratorHelper(n.options);try{for(i.s();!(a=i.n()).done;){var s=a.value;s.selected=s.value===r}}catch(o){i.e(o)}finally{i.f()}}));var s,o=_createForOfIteratorHelper(this.data.options);try{for(o.s();!(s=o.n()).done;){var u=s.value,d=document.createElement("option");d.textContent=u.displayValue,d.value=u.exportValue,r.value.includes(u.exportValue)&&(d.setAttribute("selected",!0),i=!1),n.append(d)}}catch(g){o.e(g)}finally{o.f()}var h=null;if(i){var v=document.createElement("option");v.value=" ",v.setAttribute("hidden",!0),v.setAttribute("selected",!0),n.prepend(v),h=function(){v.remove(),n.removeEventListener("input",h),h=null},n.addEventListener("input",h)}var f=function(e){var t=e?"value":"textContent",a=n.options;return n.multiple?Array.prototype.filter.call(a,(function(e){return e.selected})).map((function(e){return e[t]})):-1===a.selectedIndex?null:a[a.selectedIndex][t]},p=f(!1),_=function(e){var t=e.target.options;return Array.prototype.map.call(t,(function(e){return{displayValue:e.textContent,exportValue:e.value}}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(function(r){var i={value:function(e){var r;null===(r=h)||void 0===r||r();var i,s=e.detail.value,o=new Set(Array.isArray(s)?s:[s]),l=_createForOfIteratorHelper(n.options);try{for(l.s();!(i=l.n()).done;){var c=i.value;c.selected=o.has(c.value)}}catch(g){l.e(g)}finally{l.f()}t.setValue(a,{value:f(!0)}),p=f(!1)},multipleSelection:function(e){n.multiple=!0},remove:function(e){var r=n.options,i=e.detail.remove;if(r[i].selected=!1,n.remove(i),r.length>0){var s=Array.prototype.findIndex.call(r,(function(e){return e.selected}));-1===s&&(r[0].selected=!0)}t.setValue(a,{value:f(!0),items:_(e)}),p=f(!1)},clear:function(e){for(;0!==n.length;)n.remove(0);t.setValue(a,{value:null,items:[]}),p=f(!1)},insert:function(e){var r=e.detail.insert,i=r.index,s=r.displayValue,o=r.exportValue,l=n.children[i],c=document.createElement("option");c.textContent=s,c.value=o,l?l.before(c):n.append(c),t.setValue(a,{value:f(!0),items:_(e)}),p=f(!1)},items:function(e){for(var r=e.detail.items;0!==n.length;)n.remove(0);var i,s=_createForOfIteratorHelper(r);try{for(s.s();!(i=s.n()).done;){var o=i.value,l=o.displayValue,c=o.exportValue,u=document.createElement("option");u.textContent=l,u.value=c,n.append(u)}}catch(g){s.e(g)}finally{s.f()}n.options.length>0&&(n.options[0].selected=!0),t.setValue(a,{value:f(!0),items:_(e)}),p=f(!1)},indices:function(e){var r,n=new Set(e.detail.indices),i=_createForOfIteratorHelper(e.target.options);try{for(i.s();!(r=i.n()).done;){var s=r.value;s.selected=n.has(s.index)}}catch(g){i.e(g)}finally{i.f()}t.setValue(a,{value:f(!0)}),p=f(!1)},editable:function(e){e.target.disabled=!e.detail.editable}};e._dispatchEventFromSandbox(i,r)})),n.addEventListener("input",(function(r){var n,i=f(!0);t.setValue(a,{value:i}),r.preventDefault(),null===(n=e.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:e,detail:{id:a,name:"Keystroke",value:p,changeEx:i,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(function(e){return e.target.value}))):n.addEventListener("input",(function(e){t.setValue(a,{value:f(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}]),a}(m),F=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=e.data,o=!a.IGNORE_TYPES.has(s.parentType)&&!!(null!==(r=s.titleObj)&&void 0!==r&&r.str||null!==(n=s.contentsObj)&&void 0!==n&&n.str||null!==(i=s.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o})}return _createClass(a,[{key:"render",value:function(){this.container.classList.add("popupAnnotation");var e=this.layer.querySelectorAll('[data-annotation-id="'.concat(this.data.parentId,'"]'));if(0===e.length)return this.container;var t=new C({container:this.container,trigger:Array.from(e),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),a=this.page,n=r.Util.normalizeRect([this.data.parentRect[0],a.view[3]-this.data.parentRect[1]+a.view[1],this.data.parentRect[2],a.view[3]-this.data.parentRect[3]+a.view[1]]),i=n[0]+this.data.parentRect[2]-this.data.parentRect[0],s=n[1],o=this.viewport.rawDims,l=o.pageWidth,c=o.pageHeight,u=o.pageX,d=o.pageY;return this.container.style.left="".concat(100*(i-u)/l,"%"),this.container.style.top="".concat(100*(s-d)/c,"%"),this.container.append(t.render()),this.container}}]),a}(h);_defineProperty(F,"IGNORE_TYPES",new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]));var C=function(){function e(t){_classCallCheck(this,e),this.container=t.container,this.trigger=t.trigger,this.color=t.color,this.titleObj=t.titleObj,this.modificationDate=t.modificationDate,this.contentsObj=t.contentsObj,this.richText=t.richText,this.hideWrapper=t.hideWrapper||!1,this.pinned=!1}return _createClass(e,[{key:"render",value:function(){var e,t,a=document.createElement("div");a.classList.add("popupWrapper"),this.hideElement=this.hideWrapper?a:this.container,this.hideElement.hidden=!0;var i=document.createElement("div");i.classList.add("popup");var s=this.color;if(s){var l=.7*(255-s[0])+s[0],c=.7*(255-s[1])+s[1],u=.7*(255-s[2])+s[2];i.style.backgroundColor=r.Util.makeHexColor(0|l,0|c,0|u)}var d=document.createElement("h1");d.dir=this.titleObj.dir,d.textContent=this.titleObj.str,i.append(d);var h=n.PDFDateString.toDateObject(this.modificationDate);if(h){var v=document.createElement("span");v.classList.add("popupDate"),v.textContent="{{date}}, {{time}}",v.dataset.l10nId="annotation_date_string",v.dataset.l10nArgs=JSON.stringify({date:h.toLocaleDateString(),time:h.toLocaleTimeString()}),i.append(v)}if(null===(e=this.richText)||void 0===e||!e.str||null!==(t=this.contentsObj)&&void 0!==t&&t.str&&this.contentsObj.str!==this.richText.str){var f=this._formatContents(this.contentsObj);i.append(f)}else o.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:i}),i.lastChild.classList.add("richText","popupContent");Array.isArray(this.trigger)||(this.trigger=[this.trigger]);var p,_=_createForOfIteratorHelper(this.trigger);try{for(_.s();!(p=_.n()).done;){var g=p.value;g.addEventListener("click",this._toggle.bind(this)),g.addEventListener("mouseover",this._show.bind(this,!1)),g.addEventListener("mouseout",this._hide.bind(this,!1))}}catch(y){_.e(y)}finally{_.f()}return i.addEventListener("click",this._hide.bind(this,!0)),a.append(i),a}},{key:"_formatContents",value:function(e){var t=e.str,a=e.dir,r=document.createElement("p");r.classList.add("popupContent"),r.dir=a;for(var n=t.split(/(?:\r\n?|\n)/),i=0,s=n.length;i0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}},{key:"_hide",value:function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}]),e}(),x=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i,s;_classCallCheck(this,a);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return(s=t.call(this,e,{isRenderable:o,ignoreBorder:!0})).textContent=e.data.textContent,s}return _createClass(a,[{key:"render",value:function(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){var e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");var t,a=_createForOfIteratorHelper(this.textContent);try{for(a.s();!(t=a.n()).done;){var r=t.value,n=document.createElement("span");n.textContent=r,e.append(n)}}catch(i){a.e(i)}finally{a.f()}this.container.append(e)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}]),a}(h),w=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0})}return _createClass(a,[{key:"render",value:function(){this.container.classList.add("lineAnnotation");var e=this.data,t=u(e.rect),a=t.width,r=t.height,n=this.svgFactory.create(a,r,!0),i=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),n.append(i),this.container.append(n),this._createPopup(i,e),this.container}}]),a}(h),E=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0})}return _createClass(a,[{key:"render",value:function(){this.container.classList.add("squareAnnotation");var e=this.data,t=u(e.rect),a=t.width,r=t.height,n=this.svgFactory.create(a,r,!0),i=e.borderStyle.width,s=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",i/2),s.setAttribute("y",i/2),s.setAttribute("width",a-i),s.setAttribute("height",r-i),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,e),this.container}}]),a}(h),T=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0})}return _createClass(a,[{key:"render",value:function(){this.container.classList.add("circleAnnotation");var e=this.data,t=u(e.rect),a=t.width,r=t.height,n=this.svgFactory.create(a,r,!0),i=e.borderStyle.width,s=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",a/2),s.setAttribute("cy",r/2),s.setAttribute("rx",a/2-i/2),s.setAttribute("ry",r/2-i/2),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,e),this.container}}]),a}(h),M=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i,s;_classCallCheck(this,a);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return(s=t.call(this,e,{isRenderable:o,ignoreBorder:!0})).containerClassName="polylineAnnotation",s.svgElementName="svg:polyline",s}return _createClass(a,[{key:"render",value:function(){this.container.classList.add(this.containerClassName);var e,t=this.data,a=u(t.rect),r=a.width,n=a.height,i=this.svgFactory.create(r,n,!0),s=[],o=_createForOfIteratorHelper(t.vertices);try{for(o.s();!(e=o.n()).done;){var l=e.value,c=l.x-t.rect[0],d=t.rect[3]-l.y;s.push(c+","+d)}}catch(v){o.e(v)}finally{o.f()}s=s.join(" ");var h=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",s),h.setAttribute("stroke-width",t.borderStyle.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),i.append(h),this.container.append(i),this._createPopup(h,t),this.container}}]),a}(h),I=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r;return _classCallCheck(this,a),(r=t.call(this,e)).containerClassName="polygonAnnotation",r.svgElementName="svg:polygon",r}return _createClass(a)}(M),R=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0})}return _createClass(a,[{key:"render",value:function(){return this.container.classList.add("caretAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}]),a}(h),O=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i,s;_classCallCheck(this,a);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return(s=t.call(this,e,{isRenderable:o,ignoreBorder:!0})).containerClassName="inkAnnotation",s.svgElementName="svg:polyline",s}return _createClass(a,[{key:"render",value:function(){this.container.classList.add(this.containerClassName);var e,t=this.data,a=u(t.rect),r=a.width,n=a.height,i=this.svgFactory.create(r,n,!0),s=_createForOfIteratorHelper(t.inkLists);try{for(s.s();!(e=s.n()).done;){var o,l=e.value,c=[],d=_createForOfIteratorHelper(l);try{for(d.s();!(o=d.n()).done;){var h=o.value,v=h.x-t.rect[0],f=t.rect[3]-h.y;c.push("".concat(v,",").concat(f))}}catch(_){d.e(_)}finally{d.f()}c=c.join(" ");var p=this.svgFactory.createElement(this.svgElementName);p.setAttribute("points",c),p.setAttribute("stroke-width",t.borderStyle.width||1),p.setAttribute("stroke","transparent"),p.setAttribute("fill","transparent"),this._createPopup(p,t),i.append(p)}}catch(_){s.e(_)}finally{s.f()}return this.container.append(i),this.container}}]),a}(h),D=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(a,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.classList.add("highlightAnnotation"),this.container)}}]),a}(h),G=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(a,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.classList.add("underlineAnnotation"),this.container)}}]),a}(h),L=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(a,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.classList.add("squigglyAnnotation"),this.container)}}]),a}(h),N=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(a,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.classList.add("strikeoutAnnotation"),this.container)}}]),a}(h),j=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,n,i;_classCallCheck(this,a);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(n=e.data.contentsObj)&&void 0!==n&&n.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s,ignoreBorder:!0})}return _createClass(a,[{key:"render",value:function(){return this.container.classList.add("stampAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}]),a}(h),W=function(e){_inherits(a,e);var t=_createSuper(a);function a(e){var r,i;_classCallCheck(this,a);var s=(i=t.call(this,e,{isRenderable:!0})).data.file,o=s.filename,l=s.content;return i.filename=(0,n.getFilenameFromUrl)(o,!0),i.content=l,null===(r=i.linkService.eventBus)||void 0===r||r.dispatch("fileattachmentannotation",{source:_assertThisInitialized(i),filename:o,content:l}),i}return _createClass(a,[{key:"render",value:function(){var e,t,a;return this.container.classList.add("fileAttachmentAnnotation"),this.data.hasAppearance?a=document.createElement("div"):(a=document.createElement("img")).src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(this.data.name)?"paperclip":"pushpin",".svg"),a.classList.add("popupTriggerArea"),a.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(null!==(e=this.data.titleObj)&&void 0!==e&&e.str||null!==(t=this.data.contentsObj)&&void 0!==t&&t.str||this.data.richText)&&this._createPopup(a,this.data),this.container.append(a),this.container}},{key:"_download",value:function(){var e;null===(e=this.downloadManager)||void 0===e||e.openOrDownloadData(this.container,this.content,this.filename)}}]),a}(h),B=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"render",value:function(t){var a=t.annotations,s=t.div,o=t.viewport,l=t.accessibilityManager;(0,n.setLayerDimensions)(s,o);var c,h={data:null,layer:s,page:t.page,viewport:o,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new n.DOMSVGFactory,annotationStorage:t.annotationStorage||new i.AnnotationStorage,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects},v=0,f=_createForOfIteratorHelper(a);try{for(f.s();!(c=f.n()).done;){var p=c.value;if(!p.noHTML){if(p.annotationType!==r.AnnotationType.POPUP){var _=u(p.rect),g=_.width,y=_.height;if(g<=0||y<=0)continue}h.data=p;var m=d.create(h);if(m.isRenderable){var b=m.render();if(p.hidden&&(b.style.visibility="hidden"),Array.isArray(b)){var k,A=_createForOfIteratorHelper(b);try{for(A.s();!(k=A.n()).done;){var P=k.value;P.style.zIndex=v++,_classStaticPrivateMethodGet(e,e,H).call(e,P,p.id,s,l)}}catch(S){A.e(S)}finally{A.f()}}else b.style.zIndex=v++,m instanceof F?s.prepend(b):_classStaticPrivateMethodGet(e,e,H).call(e,b,p.id,s,l)}}}}catch(S){f.e(S)}finally{f.f()}_classStaticPrivateMethodGet(this,e,U).call(this,s,t.annotationCanvasMap)}},{key:"update",value:function(t){var a=t.annotationCanvasMap,r=t.div,i=t.viewport;(0,n.setLayerDimensions)(r,{rotation:i.rotation}),_classStaticPrivateMethodGet(this,e,U).call(this,r,a),r.hidden=!1}}]),e}();function H(e,t,a,r){var i=e.firstChild||e;i.id="".concat(n.AnnotationPrefix).concat(t),a.append(e),null===r||void 0===r||r.moveElementInDOM(a,e,i,!1)}function U(e,t){if(t){var a,r=_createForOfIteratorHelper(t);try{for(r.s();!(a=r.n()).done;){var n=_slicedToArray(a.value,2),i=n[0],s=n[1],o=e.querySelector('[data-annotation-id="'.concat(i,'"]'));if(o){var l=o.firstChild;l?"CANVAS"===l.nodeName?l.replaceWith(s):l.before(s):o.append(s)}}}catch(c){r.e(c)}finally{r.f()}t.clear()}}t.AnnotationLayer=B},function(e,t){function a(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0;var r=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"CMYK_G",value:function(e){var t=_slicedToArray(e,4),a=t[0],r=t[1],n=t[2],i=t[3];return["G",1-Math.min(1,.3*a+.59*n+.11*r+i)]}},{key:"G_CMYK",value:function(e){return["CMYK",0,0,0,1-_slicedToArray(e,1)[0]]}},{key:"G_RGB",value:function(e){var t=_slicedToArray(e,1)[0];return["RGB",t,t,t]}},{key:"G_HTML",value:function(e){var t=a(_slicedToArray(e,1)[0]);return"#".concat(t).concat(t).concat(t)}},{key:"RGB_G",value:function(e){var t=_slicedToArray(e,3);return["G",.3*t[0]+.59*t[1]+.11*t[2]]}},{key:"RGB_HTML",value:function(e){var t=_slicedToArray(e,3),r=t[0],n=t[1],i=t[2],s=a(r),o=a(n),l=a(i);return"#".concat(s).concat(o).concat(l)}},{key:"T_HTML",value:function(){return"#00000000"}},{key:"CMYK_RGB",value:function(e){var t=_slicedToArray(e,4),a=t[0],r=t[1],n=t[2],i=t[3];return["RGB",1-Math.min(1,a+i),1-Math.min(1,n+i),1-Math.min(1,r+i)]}},{key:"CMYK_HTML",value:function(e){var t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}},{key:"RGB_CMYK",value:function(e){var t=_slicedToArray(e,3),a=1-t[0],r=1-t[1],n=1-t[2];return["CMYK",a,r,n,Math.min(a,r,n)]}}]),e}();t.ColorConverters=r},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var r=a(19),n=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"setupStorage",value:function(e,t,a,r,n){var i=r.getValue(t,{value:null});switch(a.name){case"textarea":if(null!==i.value&&(e.textContent=i.value),"print"===n)break;e.addEventListener("input",(function(e){r.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===a.attributes.type||"checkbox"===a.attributes.type){if(i.value===a.attributes.xfaOn?e.setAttribute("checked",!0):i.value===a.attributes.xfaOff&&e.removeAttribute("checked"),"print"===n)break;e.addEventListener("change",(function(e){r.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==i.value&&e.setAttribute("value",i.value),"print"===n)break;e.addEventListener("input",(function(e){r.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==i.value){var s,o=_createForOfIteratorHelper(a.children);try{for(o.s();!(s=o.n()).done;){var l=s.value;l.attributes.value===i.value&&(l.attributes.selected=!0)}}catch(c){o.e(c)}finally{o.f()}}e.addEventListener("input",(function(e){var a=e.target.options,n=-1===a.selectedIndex?"":a[a.selectedIndex].value;r.setValue(t,{value:n})}))}}},{key:"setAttributes",value:function(e){var t=e.html,a=e.element,r=e.storage,n=void 0===r?null:r,i=e.intent,s=e.linkService,o=a.attributes,l=t instanceof HTMLAnchorElement;"radio"===o.type&&(o.name="".concat(o.name,"-").concat(i));for(var c=0,u=Object.entries(o);c0;){var d,h=o.at(-1),v=_slicedToArray(h,3),f=v[0],p=v[1],_=v[2];if(p+1!==f.children.length){var g=f.children[++o.at(-1)[1]];if(null!==g){var y=g.name;if("#text"!==y){var m=void 0;if(m=null!==g&&void 0!==g&&null!==(d=g.attributes)&&void 0!==d&&d.xmlns?document.createElementNS(g.attributes.xmlns,y):document.createElement(y),_.append(m),g.attributes&&this.setAttributes({html:m,element:g,storage:t,intent:i,linkService:a}),g.children&&g.children.length>0)o.push([g,-1,m]);else if(g.value){var b=document.createTextNode(g.value);r.XfaText.shouldBuildText(y)&&u.push(b),m.append(b)}}else{var k=document.createTextNode(g.value);u.push(k),_.append(k)}}}else o.pop()}var A,P=_createForOfIteratorHelper(l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"));try{for(P.s();!(A=P.n()).done;)A.value.setAttribute("readOnly",!0)}catch(S){P.e(S)}finally{P.f()}return{textDivs:u}}},{key:"update",value:function(e){var t="matrix(".concat(e.viewport.transform.join(","),")");e.div.style.transform=t,e.div.hidden=!1}}]),e}();t.XfaLayer=n},function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var r=a(6),n=a(1),i=a(10),s=_createClass((function e(){_classCallCheck(this,e),(0,n.unreachable)("Not implemented: SVGGraphics")}));t.SVGGraphics=s;var o=function(e){if(Number.isInteger(e))return e.toString();var t=e.toFixed(10),a=t.length-1;if("0"!==t[a])return t;do{a--}while("0"===t[a]);return t.substring(0,"."===t[a]?a:a+1)},l=function(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":"scale(".concat(o(e[0])," ").concat(o(e[3]),")");if(e[0]===e[3]&&e[1]===-e[2]){var t=180*Math.acos(e[0])/Math.PI;return"rotate(".concat(o(t),")")}}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return"translate(".concat(o(e[4])," ").concat(o(e[5]),")");return"matrix(".concat(o(e[0])," ").concat(o(e[1])," ").concat(o(e[2])," ").concat(o(e[3])," ").concat(o(e[4])," ")+"".concat(o(e[5]),")")},c={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},u=["butt","round","square"],d=["miter","round","bevel"],h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(URL.createObjectURL&&"undefined"!==typeof Blob&&!a)return URL.createObjectURL(new Blob([e],{type:t}));for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="data:".concat(t,";base64,"),i=0,s=e.length;i>2]+r[(3&o)<<4|l>>4]+r[i+1>6:64]+r[i+2>1&2147483647:r>>1&2147483647;t[a]=r}function o(e,a,r,n){var i=n,s=a.length;r[i]=s>>24&255,r[i+1]=s>>16&255,r[i+2]=s>>8&255,r[i+3]=255&s,r[i+=4]=255&e.charCodeAt(0),r[i+1]=255&e.charCodeAt(1),r[i+2]=255&e.charCodeAt(2),r[i+3]=255&e.charCodeAt(3),i+=4,r.set(a,i);var o=function(e,a,r){for(var n=-1,i=a;i>>8^t[s]}return-1^n}(r,n+4,i+=a.length);r[i]=o>>24&255,r[i+1]=o>>16&255,r[i+2]=o>>8&255,r[i+3]=255&o}function l(e){var t=e.length,a=65535,r=Math.ceil(t/a),n=new Uint8Array(2+t+5*r+4),i=0;n[i++]=120,n[i++]=156;for(var s=0;t>a;)n[i++]=0,n[i++]=255,n[i++]=255,n[i++]=0,n[i++]=0,n.set(e.subarray(s,s+a),i),i+=a,s+=a,t-=a;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(s),i),i+=e.length-s;var o=function(e,t,a){for(var r=1,n=0,i=t;i>24&255,n[i++]=o>>16&255,n[i++]=o>>8&255,n[i++]=255&o,n}function c(t,a,r,s){var c,u,d,v=t.width,f=t.height,p=t.data;switch(a){case n.ImageKind.GRAYSCALE_1BPP:u=0,c=1,d=v+7>>3;break;case n.ImageKind.RGB_24BPP:u=2,c=8,d=3*v;break;case n.ImageKind.RGBA_32BPP:u=6,c=8,d=4*v;break;default:throw new Error("invalid format")}for(var _=new Uint8Array((1+d)*f),g=0,y=0,m=0;m>24&255,v>>16&255,v>>8&255,255&v,f>>24&255,f>>16&255,f>>8&255,255&f,c,u,0,0,0]),P=function(e){if(!i.isNodeJS)return l(e);try{var t;t=parseInt(process.versions.node)>=8?e:Buffer.from(e);var a=__webpack_require__(82258).deflateSync(t,{level:9});return a instanceof Uint8Array?a:new Uint8Array(a)}catch(r){(0,n.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+r)}return l(e)}(_),S=e.length+36+A.length+P.length,F=new Uint8Array(S),C=0;return F.set(e,C),o("IHDR",A,F,C+=e.length),o("IDATA",P,F,C+=12+A.length),C+=12+P.length,o("IEND",new Uint8Array(0),F,C),h(F,"image/png",r)}return function(e,t,a){return c(e,void 0===e.kind?n.ImageKind.GRAYSCALE_1BPP:e.kind,t,a)}}(),f=function(){function e(){_classCallCheck(this,e),this.fontSizeScale=1,this.fontWeight=c.fontWeight,this.fontSize=0,this.textMatrix=n.IDENTITY_MATRIX,this.fontMatrix=n.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=n.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=c.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}return _createClass(e,[{key:"clone",value:function(){return Object.create(this)}},{key:"setCurrentPoint",value:function(e,t){this.x=e,this.y=t}}]),e}(),p=0,_=0,g=0;t.SVGGraphics=s=function(){function e(t,a){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var s in _classCallCheck(this,e),(0,r.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new r.DOMSVGFactory,this.current=new f,this.transformMatrix=n.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=t,this.objs=a,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!i,this._operatorIdMapping=[],n.OPS)this._operatorIdMapping[n.OPS[s]]=s}return _createClass(e,[{key:"getObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"===typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}},{key:"save",value:function(){this.transformStack.push(this.transformMatrix);var e=this.current;this.extraStack.push(e),this.current=e.clone()}},{key:"restore",value:function(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}},{key:"group",value:function(e){this.save(),this.executeOpTree(e),this.restore()}},{key:"loadDependencies",value:function(e){for(var t=this,a=e.fnArray,r=e.argsArray,i=0,s=a.length;i0&&(this.current.lineWidth=e)}},{key:"setLineCap",value:function(e){this.current.lineCap=u[e]}},{key:"setLineJoin",value:function(e){this.current.lineJoin=d[e]}},{key:"setMiterLimit",value:function(e){this.current.miterLimit=e}},{key:"setStrokeAlpha",value:function(e){this.current.strokeAlpha=e}},{key:"setStrokeRGBColor",value:function(e,t,a){this.current.strokeColor=n.Util.makeHexColor(e,t,a)}},{key:"setFillAlpha",value:function(e){this.current.fillAlpha=e}},{key:"setFillRGBColor",value:function(e,t,a){this.current.fillColor=n.Util.makeHexColor(e,t,a),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}},{key:"setStrokeColorN",value:function(e){this.current.strokeColor=this._makeColorN_Pattern(e)}},{key:"setFillColorN",value:function(e){this.current.fillColor=this._makeColorN_Pattern(e)}},{key:"shadingFill",value:function(e){var t=this.viewport.width,a=this.viewport.height,r=n.Util.inverseTransform(this.transformMatrix),i=n.Util.applyTransform([0,0],r),s=n.Util.applyTransform([0,a],r),o=n.Util.applyTransform([t,0],r),l=n.Util.applyTransform([t,a],r),c=Math.min(i[0],s[0],o[0],l[0]),u=Math.min(i[1],s[1],o[1],l[1]),d=Math.max(i[0],s[0],o[0],l[0]),h=Math.max(i[1],s[1],o[1],l[1]),v=this.svgFactory.createElement("svg:rect");v.setAttributeNS(null,"x",c),v.setAttributeNS(null,"y",u),v.setAttributeNS(null,"width",d-c),v.setAttributeNS(null,"height",h-u),v.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&v.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(v)}},{key:"_makeColorN_Pattern",value:function(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}},{key:"_makeTilingPattern",value:function(e){var t=e[1],a=e[2],r=e[3]||n.IDENTITY_MATRIX,i=_slicedToArray(e[4],4),s=i[0],o=i[1],l=i[2],c=i[3],u=e[5],d=e[6],h=e[7],v="shading".concat(g++),f=n.Util.normalizeRect([].concat(_toConsumableArray(n.Util.applyTransform([s,o],r)),_toConsumableArray(n.Util.applyTransform([l,c],r)))),p=_slicedToArray(f,4),_=p[0],y=p[1],m=p[2],b=p[3],k=n.Util.singularValueDecompose2dScale(r),A=_slicedToArray(k,2),P=u*A[0],S=d*A[1],F=this.svgFactory.createElement("svg:pattern");F.setAttributeNS(null,"id",v),F.setAttributeNS(null,"patternUnits","userSpaceOnUse"),F.setAttributeNS(null,"width",P),F.setAttributeNS(null,"height",S),F.setAttributeNS(null,"x","".concat(_)),F.setAttributeNS(null,"y","".concat(y));var C=this.svg,x=this.transformMatrix,w=this.current.fillColor,E=this.current.strokeColor,T=this.svgFactory.create(m-_,b-y);if(this.svg=T,this.transformMatrix=r,2===h){var M,I=(M=n.Util).makeHexColor.apply(M,_toConsumableArray(t));this.current.fillColor=I,this.current.strokeColor=I}return this.executeOpTree(this.convertOpList(a)),this.svg=C,this.transformMatrix=x,this.current.fillColor=w,this.current.strokeColor=E,F.append(T.childNodes[0]),this.defs.append(F),"url(#".concat(v,")")}},{key:"_makeShadingPattern",value:function(e){switch("string"===typeof e&&(e=this.objs.get(e)),e[0]){case"RadialAxial":var t,a="shading".concat(g++),r=e[3];switch(e[1]){case"axial":var i=e[4],s=e[5];(t=this.svgFactory.createElement("svg:linearGradient")).setAttributeNS(null,"id",a),t.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),t.setAttributeNS(null,"x1",i[0]),t.setAttributeNS(null,"y1",i[1]),t.setAttributeNS(null,"x2",s[0]),t.setAttributeNS(null,"y2",s[1]);break;case"radial":var o=e[4],l=e[5],c=e[6],u=e[7];(t=this.svgFactory.createElement("svg:radialGradient")).setAttributeNS(null,"id",a),t.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),t.setAttributeNS(null,"cx",l[0]),t.setAttributeNS(null,"cy",l[1]),t.setAttributeNS(null,"r",u),t.setAttributeNS(null,"fx",o[0]),t.setAttributeNS(null,"fy",o[1]),t.setAttributeNS(null,"fr",c);break;default:throw new Error("Unknown RadialAxial type: ".concat(e[1]))}var d,h=_createForOfIteratorHelper(r);try{for(h.s();!(d=h.n()).done;){var v=d.value,f=this.svgFactory.createElement("svg:stop");f.setAttributeNS(null,"offset",v[0]),f.setAttributeNS(null,"stop-color",v[1]),t.append(f)}}catch(p){h.e(p)}finally{h.f()}return this.defs.append(t),"url(#".concat(a,")");case"Mesh":return(0,n.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error("Unknown IR type: ".concat(e[0]))}}},{key:"setDash",value:function(e,t){this.current.dashArray=e,this.current.dashPhase=t}},{key:"constructPath",value:function(e,t){var a,r=this.current,i=r.x,s=r.y,l=[],c=0,u=_createForOfIteratorHelper(e);try{for(u.s();!(a=u.n()).done;)switch(0|a.value){case n.OPS.rectangle:i=t[c++],s=t[c++];var d=t[c++],h=t[c++],v=i+d,f=s+h;l.push("M",o(i),o(s),"L",o(v),o(s),"L",o(v),o(f),"L",o(i),o(f),"Z");break;case n.OPS.moveTo:i=t[c++],s=t[c++],l.push("M",o(i),o(s));break;case n.OPS.lineTo:i=t[c++],s=t[c++],l.push("L",o(i),o(s));break;case n.OPS.curveTo:i=t[c+4],s=t[c+5],l.push("C",o(t[c]),o(t[c+1]),o(t[c+2]),o(t[c+3]),o(i),o(s)),c+=6;break;case n.OPS.curveTo2:l.push("C",o(i),o(s),o(t[c]),o(t[c+1]),o(t[c+2]),o(t[c+3])),i=t[c+2],s=t[c+3],c+=4;break;case n.OPS.curveTo3:i=t[c+2],s=t[c+3],l.push("C",o(t[c]),o(t[c+1]),o(i),o(s),o(i),o(s)),c+=4;break;case n.OPS.closePath:l.push("Z")}}catch(p){u.e(p)}finally{u.f()}l=l.join(" "),r.path&&e.length>0&&e[0]!==n.OPS.rectangle&&e[0]!==n.OPS.moveTo?l=r.path.getAttributeNS(null,"d")+l:(r.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(r.path)),r.path.setAttributeNS(null,"d",l),r.path.setAttributeNS(null,"fill","none"),r.element=r.path,r.setCurrentPoint(i,s)}},{key:"endPath",value:function(){var e=this.current;if(e.path=null,this.pendingClip)if(e.element){var t="clippath".concat(p++),a=this.svgFactory.createElement("svg:clipPath");a.setAttributeNS(null,"id",t),a.setAttributeNS(null,"transform",l(this.transformMatrix));var r=e.element.cloneNode(!0);if("evenodd"===this.pendingClip?r.setAttributeNS(null,"clip-rule","evenodd"):r.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,a.append(r),this.defs.append(a),e.activeClipUrl){e.clipGroup=null;var n,i=_createForOfIteratorHelper(this.extraStack);try{for(i.s();!(n=i.n()).done;)n.value.clipGroup=null}catch(s){i.e(s)}finally{i.f()}a.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl="url(#".concat(t,")"),this.tgrp=null}else this.pendingClip=null}},{key:"clip",value:function(e){this.pendingClip=e}},{key:"closePath",value:function(){var e=this.current;if(e.path){var t="".concat(e.path.getAttributeNS(null,"d"),"Z");e.path.setAttributeNS(null,"d",t)}}},{key:"setLeading",value:function(e){this.current.leading=-e}},{key:"setTextRise",value:function(e){this.current.textRise=e}},{key:"setTextRenderingMode",value:function(e){this.current.textRenderingMode=e}},{key:"setHScale",value:function(e){this.current.textHScale=e/100}},{key:"setRenderingIntent",value:function(e){}},{key:"setFlatness",value:function(e){}},{key:"setGState",value:function(e){var t,a=_createForOfIteratorHelper(e);try{for(a.s();!(t=a.n()).done;){var r=_slicedToArray(t.value,2),i=r[0],s=r[1];switch(i){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s);break;case"CA":this.setStrokeAlpha(s);break;case"ca":this.setFillAlpha(s);break;default:(0,n.warn)("Unimplemented graphic state operator ".concat(i))}}}catch(o){a.e(o)}finally{a.f()}}},{key:"fill",value:function(){var e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}},{key:"stroke",value:function(){var e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}},{key:"_setStrokeAttributes",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=this.current,r=a.dashArray;1!==t&&r.length>0&&(r=r.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",a.strokeColor),e.setAttributeNS(null,"stroke-opacity",a.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",o(a.miterLimit)),e.setAttributeNS(null,"stroke-linecap",a.lineCap),e.setAttributeNS(null,"stroke-linejoin",a.lineJoin),e.setAttributeNS(null,"stroke-width",o(t*a.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",r.map(o).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",o(t*a.dashPhase)+"px")}},{key:"eoFill",value:function(){var e;null===(e=this.current.element)||void 0===e||e.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}},{key:"fillStroke",value:function(){this.stroke(),this.fill()}},{key:"eoFillStroke",value:function(){var e;null===(e=this.current.element)||void 0===e||e.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}},{key:"closeStroke",value:function(){this.closePath(),this.stroke()}},{key:"closeFillStroke",value:function(){this.closePath(),this.fillStroke()}},{key:"closeEOFillStroke",value:function(){this.closePath(),this.eoFillStroke()}},{key:"paintSolidColorImageMask",value:function(){var e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(e)}},{key:"paintImageXObject",value:function(e){var t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,n.warn)("Dependent image with object ID ".concat(e," is not ready yet"))}},{key:"paintInlineImageXObject",value:function(e,t){var a=e.width,r=e.height,n=v(e,this.forceDataSchema,!!t),i=this.svgFactory.createElement("svg:rect");i.setAttributeNS(null,"x","0"),i.setAttributeNS(null,"y","0"),i.setAttributeNS(null,"width",o(a)),i.setAttributeNS(null,"height",o(r)),this.current.element=i,this.clip("nonzero");var s=this.svgFactory.createElement("svg:image");s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n),s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y",o(-r)),s.setAttributeNS(null,"width",o(a)+"px"),s.setAttributeNS(null,"height",o(r)+"px"),s.setAttributeNS(null,"transform","scale(".concat(o(1/a)," ").concat(o(-1/r),")")),t?t.append(s):this._ensureTransformGroup().append(s)}},{key:"paintImageMaskXObject",value:function(e){var t=this.getObject(e.data,e);if(t.bitmap)(0,n.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");else{var a=this.current,r=t.width,i=t.height,s=a.fillColor;a.maskId="mask".concat(_++);var l=this.svgFactory.createElement("svg:mask");l.setAttributeNS(null,"id",a.maskId);var c=this.svgFactory.createElement("svg:rect");c.setAttributeNS(null,"x","0"),c.setAttributeNS(null,"y","0"),c.setAttributeNS(null,"width",o(r)),c.setAttributeNS(null,"height",o(i)),c.setAttributeNS(null,"fill",s),c.setAttributeNS(null,"mask","url(#".concat(a.maskId,")")),this.defs.append(l),this._ensureTransformGroup().append(c),this.paintInlineImageXObject(t,l)}}},{key:"paintFormXObjectBegin",value:function(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){var a=t[2]-t[0],r=t[3]-t[1],n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x",t[0]),n.setAttributeNS(null,"y",t[1]),n.setAttributeNS(null,"width",o(a)),n.setAttributeNS(null,"height",o(r)),this.current.element=n,this.clip("nonzero"),this.endPath()}}},{key:"paintFormXObjectEnd",value:function(){}},{key:"_initialize",value:function(e){var t=this.svgFactory.create(e.width,e.height),a=this.svgFactory.createElement("svg:defs");t.append(a),this.defs=a;var r=this.svgFactory.createElement("svg:g");return r.setAttributeNS(null,"transform",l(e.transform)),t.append(r),this.svg=r,t}},{key:"_ensureClipGroup",value:function(){if(!this.current.clipGroup){var e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(e),this.current.clipGroup=e}return this.current.clipGroup}},{key:"_ensureTransformGroup",value:function(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",l(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}]),e}()}],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var a=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](a,a.exports,__w_pdfjs_require__),a.exports}var __nested_webpack_exports__={};return function(){var e=__nested_webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AbortException",{enumerable:!0,get:function(){return t.AbortException}}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return i.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return s.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return o.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"FeatureTest",{enumerable:!0,get:function(){return t.FeatureTest}}),Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return l.GlobalWorkerOptions}}),Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}}),Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}}),Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}}),Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return a.PDFDataRangeTransport}}),Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return r.PDFDateString}}),Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return a.PDFWorker}}),Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}}),Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}}),Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return r.PixelsPerInch}}),Object.defineProperty(e,"PromiseCapability",{enumerable:!0,get:function(){return t.PromiseCapability}}),Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return r.RenderingCancelledException}}),Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return c.SVGGraphics}}),Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}}),Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}}),Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}}),Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return u.XfaLayer}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return a.build}}),Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}}),Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return a.getDocument}}),Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return r.getFilenameFromUrl}}),Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return r.getPdfFilenameFromUrl}}),Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return r.getXfaPageViewport}}),Object.defineProperty(e,"isDataScheme",{enumerable:!0,get:function(){return r.isDataScheme}}),Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return r.isPdfFile}}),Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return r.loadScript}}),Object.defineProperty(e,"normalizeUnicode",{enumerable:!0,get:function(){return t.normalizeUnicode}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return n.renderTextLayer}}),Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return r.setLayerDimensions}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return n.updateTextLayer}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return a.version}});var t=__w_pdfjs_require__(1),a=__w_pdfjs_require__(2),r=__w_pdfjs_require__(6),n=__w_pdfjs_require__(26),i=__w_pdfjs_require__(27),s=__w_pdfjs_require__(5),o=__w_pdfjs_require__(32),l=__w_pdfjs_require__(14),c=__w_pdfjs_require__(35),u=__w_pdfjs_require__(34)}(),__nested_webpack_exports__}()},module.exports=factory()},66115:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},17156:function(e){function t(e,t,a,r,n,i,s){try{var o=e[i](s),l=o.value}catch(c){return void a(c)}o.done?t(l):Promise.resolve(l).then(r,n)}e.exports=function(e){return function(){var a=this,r=arguments;return new Promise((function(n,i){var s=e.apply(a,r);function o(e){t(s,n,i,o,l,"next",e)}function l(e){t(s,n,i,o,l,"throw",e)}o(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},56521:function(e){e.exports=function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")},e.exports.__esModule=!0,e.exports.default=e.exports},48912:function(e){e.exports=function(e,t){return t.get?t.get.call(e):t.value},e.exports.__esModule=!0,e.exports.default=e.exports},43448:function(e){e.exports=function(e,t,a){if(t.set)t.set.call(e,a);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=a}},e.exports.__esModule=!0,e.exports.default=e.exports},72625:function(e){e.exports=function(e,t){if(e!==t)throw new TypeError("Private static access of wrong provenance")},e.exports.__esModule=!0,e.exports.default=e.exports},22506:function(e){e.exports=function(e,t){if(void 0===e)throw new TypeError("attempted to "+t+" private static field before its declaration")},e.exports.__esModule=!0,e.exports.default=e.exports},54069:function(e){e.exports=function(e,t,a){if(!t.has(e))throw new TypeError("attempted to "+a+" private field on non-instance");return t.get(e)},e.exports.__esModule=!0,e.exports.default=e.exports},50468:function(e,t,a){var r=a(48912),n=a(54069);e.exports=function(e,t){var a=n(e,t,"get");return r(e,a)},e.exports.__esModule=!0,e.exports.default=e.exports},19159:function(e,t,a){var r=a(56521);e.exports=function(e,t,a){r(e,t),t.set(e,a)},e.exports.__esModule=!0,e.exports.default=e.exports},65661:function(e,t,a){var r=a(43448),n=a(54069);e.exports=function(e,t,a){var i=n(e,t,"set");return r(e,i,a),a},e.exports.__esModule=!0,e.exports.default=e.exports},54467:function(e){e.exports=function(e,t,a){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return a},e.exports.__esModule=!0,e.exports.default=e.exports},71860:function(e,t,a){var r=a(56521);e.exports=function(e,t){r(e,t),t.add(e)},e.exports.__esModule=!0,e.exports.default=e.exports},61280:function(e,t,a){var r=a(48912),n=a(72625),i=a(22506);e.exports=function(e,t,a){return n(e,t),i(a,"get"),r(e,a)},e.exports.__esModule=!0,e.exports.default=e.exports},62306:function(e,t,a){var r=a(43448),n=a(72625),i=a(22506);e.exports=function(e,t,a,s){return n(e,t),i(a,"set"),r(e,a,s),s},e.exports.__esModule=!0,e.exports.default=e.exports},55764:function(e,t,a){var r=a(72625);e.exports=function(e,t,a){return r(e,t),a},e.exports.__esModule=!0,e.exports.default=e.exports},74704:function(e,t,a){var r=a(86116);e.exports=function(e,t){var a="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=r(e))||t&&e&&"number"===typeof e.length){a&&(e=a);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw s}}}},e.exports.__esModule=!0,e.exports.default=e.exports},26389:function(e,t,a){var r=a(73808),n=a(69617),i=a(94993);e.exports=function(e){var t=n();return function(){var a,n=r(e);if(t){var s=r(this).constructor;a=Reflect.construct(n,arguments,s)}else a=n.apply(this,arguments);return i(this,a)}},e.exports.__esModule=!0,e.exports.default=e.exports},41588:function(e,t,a){var r=a(1753);function n(){return"undefined"!==typeof Reflect&&Reflect.get?(e.exports=n=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=n=function(e,t,a){var n=r(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:a):i.value}},e.exports.__esModule=!0,e.exports.default=e.exports),n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},73808:function(e){function t(a){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(a)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},61655:function(e,t,a){var r=a(6015);e.exports=function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},69617:function(e){e.exports=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},94993:function(e,t,a){var r=a(18698).default,n=a(66115);e.exports=function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},17061:function(e,t,a){var r=a(18698).default;function n(){"use strict";e.exports=n=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},a=Object.prototype,i=a.hasOwnProperty,s=Object.defineProperty||function(e,t,a){e[t]=a.value},o="function"==typeof Symbol?Symbol:{},l=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function d(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(M){d=function(e,t,a){return e[t]=a}}function h(e,t,a,r){var n=t&&t.prototype instanceof p?t:p,i=Object.create(n.prototype),o=new w(r||[]);return s(i,"_invoke",{value:S(e,a,o)}),i}function v(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(M){return{type:"throw",arg:M}}}t.wrap=h;var f={};function p(){}function _(){}function g(){}var y={};d(y,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(E([])));b&&b!==a&&i.call(b,l)&&(y=b);var k=g.prototype=p.prototype=Object.create(y);function A(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function a(n,s,o,l){var c=v(e[n],e,s);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==r(d)&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){a("next",e,o,l)}),(function(e){a("throw",e,o,l)})):t.resolve(d).then((function(e){u.value=e,o(u)}),(function(e){return a("throw",e,o,l)}))}l(c.arg)}var n;s(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,n){a(e,r,t,n)}))}return n=n?n.then(i,i):i()}})}function S(e,t,a){var r="suspendedStart";return function(n,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===n)throw i;return T()}for(a.method=n,a.arg=i;;){var s=a.delegate;if(s){var o=F(s,a);if(o){if(o===f)continue;return o}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===r)throw r="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);r="executing";var l=v(e,t,a);if("normal"===l.type){if(r=a.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:a.done}}"throw"===l.type&&(r="completed",a.method="throw",a.arg=l.arg)}}}function F(e,t){var a=t.method,r=e.iterator[a];if(void 0===r)return t.delegate=null,"throw"===a&&e.iterator.return&&(t.method="return",t.arg=void 0,F(e,t),"throw"===t.method)||"return"!==a&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+a+"' method")),f;var n=v(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function E(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,r=function t(){for(;++a=0;--r){var n=this.tryEntries[r],s=n.completion;if("root"===n.tryLoc)return a("end");if(n.tryLoc<=this.prev){var o=i.call(n,"catchLoc"),l=i.call(n,"finallyLoc");if(o&&l){if(this.prev=0;--a){var r=this.tryEntries[a];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),x(a),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var r=a.completion;if("throw"===r.type){var n=r.arg;x(a)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,a){return this.delegate={iterator:E(e),resultName:t,nextLoc:a},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},6015:function(e){function t(a,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(a,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},1753:function(e,t,a){var r=a(73808);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},19330:function(e,t,a){"use strict";function r(e){var t=!1;return{promise:new Promise((function(a,r){e.then((function(e){return!t&&a(e)})).catch((function(e){return!t&&r(e)}))})),cancel:function(){t=!0}}}a.d(t,{Z:function(){return r}})},24246:function(e,t,a){"use strict";a.d(t,{Tu:function(){return n},ZP:function(){return i}});var r=function(e,t,a){if(a||2===arguments.length)for(var r,n=0,i=t.length;n was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to and handle navigating by yourself or ensure that all pages are rendered within ."))}}});(0,s.useImperativeHandle)(t,(function(){return{linkService:ie,pages:se,viewer:oe}}),[]),(0,s.useEffect)((function(){Z({type:"RESET"})}),[w,Z]);var le=(0,s.useCallback)((function(){return k(a,void 0,void 0,(0,n.Z)().mark((function e(){var t,a,r,i,s;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w){e.next=2;break}return e.abrupt("return",null);case 2:if("string"!==typeof w){e.next=8;break}if(!(0,y.gJ)(w)){e.next=6;break}return t=(0,y.us)(w),e.abrupt("return",{data:t});case 6:return(0,y.tN)(),e.abrupt("return",{url:w});case 8:if(!(w instanceof P)){e.next=10;break}return e.abrupt("return",{range:w});case 10:if(!(0,y.eP)(w)){e.next=12;break}return e.abrupt("return",{data:w});case 12:if(!y.jU){e.next=18;break}if(!(0,y.Lj)(w)){e.next=18;break}return e.next=16,(0,y.eR)(w);case 16:return a=e.sent,e.abrupt("return",{data:a});case 18:if((0,d.Z)("object"===typeof w,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),(0,d.Z)("data"in w||"range"in w||"url"in w,"Invalid parameter object: need either .data, .range or .url"),!("url"in w)||"string"!==typeof w.url){e.next=26;break}if(!(0,y.gJ)(w.url)){e.next=25;break}return r=w.url,i=A(w,["url"]),s=(0,y.us)(r),e.abrupt("return",Object.assign({data:s},i));case 25:(0,y.tN)();case 26:return e.abrupt("return",w);case 27:case"end":return e.stop()}}),e)})))}),[w]);function ce(e,t){se.current[e]=t}function ue(e){delete se.current[e]}(0,s.useEffect)((function(){var e=(0,c.Z)(le());return e.promise.then((function(e){Z({type:"RESOLVE",value:e})})).catch((function(e){Z({type:"REJECT",error:e})})),function(){(0,y.LJ)(e)}}),[le,Z]),(0,s.useEffect)((function(){"undefined"!==typeof J&&(!1!==J?H&&H():Q&&((0,h.Z)(!1,Q.toString()),B&&B(Q)))}),[J]),(0,s.useEffect)((function(){ae({type:"RESET"})}),[ae,J]),(0,s.useEffect)((function(){if(J){var e=U?Object.assign(Object.assign({},J),U):J,t=v.getDocument(e);L&&(t.onProgress=L),W&&(t.onPassword=W);var a=t;return a.promise.then((function(e){ae({type:"RESOLVE",value:e})})).catch((function(e){a.destroyed||ae({type:"REJECT",error:e})})),function(){a.destroy()}}}),[U,ae,J]),(0,s.useEffect)((function(){"undefined"!==typeof re&&(!1!==re?re&&(N&&N(re),se.current=new Array(re.numPages),ie.current.setDocument(re)):ne&&((0,h.Z)(!1,ne.toString()),G&&G(ne)))}),[re]),(0,s.useEffect)((function(){ie.current.setViewer(oe.current),ie.current.setExternalLinkRel(C),ie.current.setExternalLinkTarget(x)}),[C,x]);var de=(0,s.useMemo)((function(){return{imageResourcesPath:T,linkService:ie.current,onItemClick:D,pdf:re,registerPage:ce,renderMode:q,rotate:z,unregisterPage:ue}}),[T,D,re,q,z]),he=(0,s.useMemo)((function(){return(0,l.ZP)(V,(function(){return re}))}),[V,re]);return s.createElement("div",Object.assign({className:(0,u.Z)("react-pdf__Document",g),ref:E,style:(0,r.Z)({},"--scale-factor","1")},he),w?void 0===re||null===re?s.createElement(p.Z,{type:"loading"},"function"===typeof I?I():I):!1===re?s.createElement(p.Z,{type:"error"},"function"===typeof F?F():F):s.createElement(f.Z.Provider,{value:de},o):s.createElement(p.Z,{type:"no-data"},"function"===typeof O?O():O))})),C=o.oneOfType([o.func,o.node]);F.propTypes=Object.assign(Object.assign({},b.Gg),{children:o.node,className:b.$n,error:C,externalLinkRel:o.string,externalLinkTarget:o.oneOf(["_self","_blank","_parent","_top"]),file:b.zE,imageResourcesPath:o.string,inputRef:b.dq,loading:C,noData:C,onItemClick:o.func,onLoadError:o.func,onLoadProgress:o.func,onLoadSuccess:o.func,onPassword:o.func,onSourceError:o.func,onSourceSuccess:o.func,options:o.shape({canvasFactory:o.any,canvasMaxAreaInBytes:o.number,cMapPacked:o.bool,CMapReaderFactory:o.any,cMapUrl:o.string,disableAutoFetch:o.bool,disableFontFace:o.bool,disableRange:o.bool,disableStream:o.bool,docBaseUrl:o.string,enableXfa:o.bool,filterFactory:o.any,fontExtraProperties:o.bool,httpHeaders:o.object,isEvalSupported:o.bool,isOffscreenCanvasSupported:o.bool,length:o.number,maxImageSize:o.number,ownerDocument:o.any,password:o.string,pdfBug:o.bool,rangeChunkSize:o.number,StandardFontDataFactory:o.any,standardFontDataUrl:o.string,stopAtErrors:o.bool,useSystemFonts:o.bool,useWorkerFetch:o.bool,verbosity:o.number,withCredentials:o.bool,worker:o.any}),rotate:o.number});var x=F},16358:function(e,t,a){"use strict";var r=a(72791);t.Z=(0,r.createContext)(null)},35768:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});var r=a(15671),n=a(43144),i=a(44554),s=function(){function e(){(0,r.Z)(this,e),this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}return(0,n.Z)(e,[{key:"setDocument",value:function(e){this.pdfDocument=e}},{key:"setViewer",value:function(e){this.pdfViewer=e}},{key:"setExternalLinkRel",value:function(e){this.externalLinkRel=e}},{key:"setExternalLinkTarget",value:function(e){this.externalLinkTarget=e}},{key:"setHistory",value:function(){}},{key:"pagesCount",get:function(){return this.pdfDocument?this.pdfDocument.numPages:0}},{key:"page",get:function(){return(0,i.Z)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0},set:function(e){(0,i.Z)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}},{key:"rotation",get:function(){return 0},set:function(e){}},{key:"goToDestination",value:function(e){var t=this;return new Promise((function(a){(0,i.Z)(t.pdfDocument,"PDF document not loaded."),(0,i.Z)(e,"Destination is not specified."),"string"===typeof e?t.pdfDocument.getDestination(e).then(a):Array.isArray(e)?a(e):e.then(a)})).then((function(e){(0,i.Z)(Array.isArray(e),'"'.concat(e,'" is not a valid destination array.'));var a=e[0];new Promise((function(e){(0,i.Z)(t.pdfDocument,"PDF document not loaded."),a instanceof Object?t.pdfDocument.getPageIndex(a).then((function(t){e(t)})).catch((function(){(0,i.Z)(!1,'"'.concat(a,'" is not a valid page reference.'))})):"number"===typeof a?e(a):(0,i.Z)(!1,'"'.concat(a,'" is not a valid destination reference.'))})).then((function(a){var r=a+1;(0,i.Z)(t.pdfViewer,"PDF viewer is not initialized."),(0,i.Z)(r>=1&&r<=t.pagesCount,'"'.concat(r,'" is not a valid page number.')),t.pdfViewer.scrollPageIntoView({dest:e,pageIndex:a,pageNumber:r})}))}))}},{key:"navigateTo",value:function(e){this.goToDestination(e)}},{key:"goToPage",value:function(e){var t=e-1;(0,i.Z)(this.pdfViewer,"PDF viewer is not initialized."),(0,i.Z)(e>=1&&e<=this.pagesCount,'"'.concat(e,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}},{key:"addLinkAttributes",value:function(e,t,a){e.href=t,e.rel=this.externalLinkRel||"noopener noreferrer nofollow",e.target=a?"_blank":this.externalLinkTarget||""}},{key:"getDestinationHash",value:function(){return"#"}},{key:"getAnchorUrl",value:function(){return"#"}},{key:"setHash",value:function(){}},{key:"executeNamedAction",value:function(){}},{key:"cachePageRef",value:function(){}},{key:"isPageVisible",value:function(){return!0}},{key:"isPageCached",value:function(){return!0}},{key:"executeSetOCGState",value:function(){}}]),e}()},48739:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var r=a(72791);function n(e){var t=e.children,a=e.type;return r.createElement("div",{className:"react-pdf__message react-pdf__message--".concat(a)},t)}},96695:function(e,t,a){"use strict";a.d(t,{Z:function(){return j}});var r=a(4942),n=a(29439),i=a(72791),s=a(52007),o=a(19330),l=a(24246),c=a(98896);function u(){for(var e=[],t=0;t *:not(.markedContent"):e.children;if(t){var n=0;A.items.forEach((function(e,a){if(function(e){return"str"in e}(e)){var i=r[n];if(i){var s=t(Object.assign({pageIndex:v,pageNumber:f,itemIndex:a},e));i.innerHTML=s,n+=e.str&&e.hasEOL?2:1}}}))}E()})).catch(T),function(){return(0,C.LJ)(i)}}}}),[t,T,E,u,v,f,A,M]),i.createElement("div",{className:(0,c.Z)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){var e=w.current;e&&e.classList.remove("active")},onMouseDown:function(){var e=w.current;e&&e.classList.add("active")},ref:x})}var I=a(16358);function R(){return(0,i.useContext)(I.Z)}function O(){var e=R();(0,d.Z)(e,"Unable to find Document context. Did you wrap in ?");var t=S();(0,d.Z)(t,"Unable to find Page context.");var a=Object.assign(Object.assign({},e),t),r=a.imageResourcesPath,s=a.linkService,l=a.onGetAnnotationsError,u=a.onGetAnnotationsSuccess,v=a.onRenderAnnotationLayerError,f=a.onRenderAnnotationLayerSuccess,_=a.page,g=a.pdf,y=a.renderForms,m=a.rotate,b=a.scale,k=void 0===b?1:b;(0,d.Z)(_,"Attempted to load page annotations, but no page was specified.");var A=(0,F.Z)(),P=(0,n.Z)(A,2),x=P[0],w=P[1],E=x.value,T=x.error,M=(0,i.useRef)(null);(0,h.Z)(1===parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,i.useEffect)((function(){w({type:"RESET"})}),[w,_]),(0,i.useEffect)((function(){if(_){var e=(0,o.Z)(_.getAnnotations()),t=e;return e.promise.then((function(e){w({type:"RESOLVE",value:e})})).catch((function(e){w({type:"REJECT",error:e})})),function(){(0,C.LJ)(t)}}}),[w,_,y]),(0,i.useEffect)((function(){void 0!==E&&(!1!==E?E&&u&&u(E):T&&((0,h.Z)(!1,T.toString()),l&&l(T)))}),[E]);var I=(0,i.useMemo)((function(){return _.getViewport({scale:k,rotation:m})}),[_,m,k]);return(0,i.useEffect)((function(){if(g&&_&&E){var e=M.current;if(e){var t=I.clone({dontFlip:!0}),a={annotations:E,annotationStorage:g.annotationStorage,div:e,downloadManager:null,imageResourcesPath:r,linkService:s,page:_,renderForms:y,viewport:t};e.innerHTML="";try{p.AnnotationLayer.render(a),f&&f()}catch(n){!function(e){(0,h.Z)(!1,"".concat(e)),v&&v(e)}(n)}return function(){}}}}),[E,r,s,_,y,I]),i.createElement("div",{className:(0,c.Z)("react-pdf__Page__annotations","annotationLayer"),ref:M})}var D=a(34122),G=function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n in ?");var s=Object.assign(Object.assign({},a),e),p=s._className,_=void 0===p?"react-pdf__Page":p,g=s._enableRegisterUnregisterPage,y=void 0===g||g,m=s.canvasBackground,b=s.canvasRef,k=s.children,A=s.className,P=s.customRenderer,S=s.customTextRenderer,x=s.devicePixelRatio,w=s.error,I=void 0===w?"Failed to load the page.":w,D=s.height,L=s.inputRef,N=s.loading,j=void 0===N?"Loading page\u2026":N,W=s.noData,B=void 0===W?"No page specified.":W,H=s.onGetAnnotationsError,U=s.onGetAnnotationsSuccess,q=s.onGetStructTreeError,z=s.onGetStructTreeSuccess,V=s.onGetTextError,X=s.onGetTextSuccess,Y=s.onLoadError,K=s.onLoadSuccess,Z=s.onRenderAnnotationLayerError,J=s.onRenderAnnotationLayerSuccess,Q=s.onRenderError,$=s.onRenderSuccess,ee=s.onRenderTextLayerError,te=s.onRenderTextLayerSuccess,ae=s.pageIndex,re=s.pageNumber,ne=s.pdf,ie=s.registerPage,se=s.renderAnnotationLayer,oe=void 0===se||se,le=s.renderForms,ce=void 0!==le&&le,ue=s.renderMode,de=void 0===ue?"canvas":ue,he=s.renderTextLayer,ve=void 0===he||he,fe=s.rotate,pe=s.scale,_e=void 0===pe?1:pe,ge=s.unregisterPage,ye=s.width,me=G(s,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),be=(0,F.Z)(),ke=(0,n.Z)(be,2),Ae=ke[0],Pe=ke[1],Se=Ae.value,Fe=Ae.error,Ce=(0,i.useRef)(null);(0,d.Z)(ne,"Attempted to load a page, but no document was specified.");var xe=(0,C.T8)(re)?re-1:null!==ae&&void 0!==ae?ae:null,we=null!==re&&void 0!==re?re:(0,C.T8)(ae)?ae+1:null,Ee=null!==fe&&void 0!==fe?fe:Se?Se.rotate:null,Te=(0,i.useMemo)((function(){if(!Se)return null;var e=1,t=null!==_e&&void 0!==_e?_e:1;if(ye||D){var a=Se.getViewport({scale:1,rotation:Ee});ye?e=ye/a.width:D&&(e=D/a.height)}return t*e}),[D,Se,Ee,_e,ye]);(0,i.useEffect)((function(){return function(){(0,C.T8)(xe)&&y&&ge&&ge(xe)}}),[y,ne,xe,ge]),(0,i.useEffect)((function(){Pe({type:"RESET"})}),[Pe,ne,xe]),(0,i.useEffect)((function(){if(ne&&we){var e=(0,o.Z)(ne.getPage(we)),t=e;return e.promise.then((function(e){Pe({type:"RESOLVE",value:e})})).catch((function(e){Pe({type:"REJECT",error:e})})),function(){return(0,C.LJ)(t)}}}),[Pe,ne,xe,we,ie]),(0,i.useEffect)((function(){void 0!==Se&&(!1!==Se?function(){if(K){if(!Se||!Te)return;K((0,C.XZ)(Se,Te))}if(y&&ie){if(!(0,C.T8)(xe)||!Ce.current)return;ie(xe,Ce.current)}}():Fe&&((0,h.Z)(!1,Fe.toString()),Y&&Y(Fe)))}),[Se,Te]);var Me=(0,i.useMemo)((function(){return Se&&(0,C.T8)(xe)&&we&&(0,C.T8)(Ee)&&(0,C.T8)(Te)?{_className:_,canvasBackground:m,customTextRenderer:S,devicePixelRatio:x,onGetAnnotationsError:H,onGetAnnotationsSuccess:U,onGetStructTreeError:q,onGetStructTreeSuccess:z,onGetTextError:V,onGetTextSuccess:X,onRenderAnnotationLayerError:Z,onRenderAnnotationLayerSuccess:J,onRenderError:Q,onRenderSuccess:$,onRenderTextLayerError:ee,onRenderTextLayerSuccess:te,page:Se,pageIndex:xe,pageNumber:we,renderForms:ce,renderTextLayer:ve,rotate:Ee,scale:Te}:null}),[_,m,S,x,H,U,q,z,V,X,Z,J,Q,$,ee,te,Se,xe,we,ce,ve,Ee,Te]),Ie=(0,i.useMemo)((function(){return(0,l.ZP)(me,(function(){return Se?Te?(0,C.XZ)(Se,Te):void 0:Se}))}),[me,Se,Te]),Re="".concat(xe,"@").concat(Te,"/").concat(Ee),Oe="".concat(xe,"/").concat(Ee);function De(){return i.createElement(v.Provider,{value:Me},function(){switch(de){case"custom":return(0,d.Z)(P,'renderMode was set to "custom", but no customRenderer was passed.'),i.createElement(P,{key:"".concat(Re,"_custom")});case"none":return null;case"svg":return i.createElement(T,{key:"".concat(Oe,"_svg")});default:return i.createElement(E,{key:"".concat(Re,"_canvas"),canvasRef:b})}}(),ve?i.createElement(M,{key:"".concat(Re,"_text")}):null,oe?i.createElement(O,{key:"".concat(Re,"_annotations")}):null,k)}return i.createElement("div",Object.assign({className:(0,c.Z)(_,A),"data-page-number":we,ref:u(L,Ce),style:(t={},(0,r.Z)(t,"--scale-factor","".concat(Te)),(0,r.Z)(t,"backgroundColor",m||"white"),(0,r.Z)(t,"position","relative"),(0,r.Z)(t,"minWidth","min-content"),(0,r.Z)(t,"minHeight","min-content"),t)},Ie),we?null===ne||void 0===Se||null===Se?i.createElement(f.Z,{type:"loading"},"function"===typeof j?j():j):!1===ne||!1===Se?i.createElement(f.Z,{type:"error"},"function"===typeof I?I():I):De():i.createElement(f.Z,{type:"no-data"},"function"===typeof B?B():B))},N=s.oneOfType([s.func,s.node]);L.propTypes=Object.assign(Object.assign({},D.Gg),{canvasBackground:s.string,canvasRef:D.dq,children:s.node,className:D.$n,customRenderer:s.func,customTextRenderer:s.func,devicePixelRatio:s.number,error:N,height:s.number,imageResourcesPath:s.string,inputRef:D.dq,loading:N,noData:N,onGetTextError:s.func,onGetTextSuccess:s.func,onLoadError:s.func,onLoadSuccess:s.func,onRenderError:s.func,onRenderSuccess:s.func,onRenderTextLayerError:s.func,onRenderTextLayerSuccess:s.func,pageIndex:D.qd,pageNumber:D.F$,pdf:D.Ze,renderAnnotationLayer:s.bool,renderForms:s.bool,renderMode:D.DV,renderTextLayer:s.bool,rotate:D.lA,scale:s.number,width:s.number});var j=L},6711:function(e,t,a){"use strict";a.d(t,{Z:function(){return i}});var r=a(72791);function n(e,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return e}}function i(){return(0,r.useReducer)(n,{value:void 0,error:void 0})}},34122:function(e,t,a){"use strict";a.d(t,{$n:function(){return d},DV:function(){return g},F$:function(){return f},Gg:function(){return l},Ze:function(){return p},dq:function(){return _},lA:function(){return y},qd:function(){return v},zE:function(){return h}});var r=a(52007),n=a(24246),i=a(43661),s=a(78884),o=a(35768),l=function(){var e={};return n.Tu.forEach((function(t){e[t]=r.func})),e}(),c=r.oneOfType([r.instanceOf(Int8Array),r.instanceOf(Uint8Array),r.instanceOf(Uint8ClampedArray),r.instanceOf(Int16Array),r.instanceOf(Uint16Array),r.instanceOf(Int32Array),r.instanceOf(Uint32Array),r.instanceOf(Float32Array),r.instanceOf(Float64Array)]),u=[r.string,r.instanceOf(ArrayBuffer),r.shape({data:r.oneOfType([r.string,r.instanceOf(ArrayBuffer),r.arrayOf(r.number.isRequired),c]).isRequired}),r.shape({range:r.instanceOf(i.PDFDataRangeTransport).isRequired}),r.shape({url:r.string.isRequired})];"undefined"!==typeof Blob&&u.push(r.instanceOf(Blob));var d=r.oneOfType([r.string,r.arrayOf(r.string)]),h=r.oneOfType(u),v=(r.instanceOf(o.Z),r.oneOf(["_self","_blank","_parent","_top"]),r.shape({commonObjs:r.shape({}).isRequired,getAnnotations:r.func.isRequired,getTextContent:r.func.isRequired,getViewport:r.func.isRequired,render:r.func.isRequired}),function(e,t,a){var r=e[t],n=e.pageNumber,i=e.pdf;if(!(0,s.$K)(i))return null;if((0,s.$K)(r)){if("number"!==typeof r)return new Error("`".concat(t,"` of type `").concat(typeof r,"` supplied to `").concat(a,"`, expected `number`."));if(r<0)return new Error("Expected `".concat(t,"` to be greater or equal to 0."));var o=i.numPages;if(r+1>o)return new Error("Expected `".concat(t,"` to be less or equal to ").concat(o-1,"."))}else if(!(0,s.$K)(n))return new Error("`".concat(t,"` not supplied. Either pageIndex or pageNumber must be supplied to `").concat(a,"`."));return null}),f=function(e,t,a){var r=e[t],n=e.pageIndex,i=e.pdf;if(!(0,s.$K)(i))return null;if((0,s.$K)(r)){if("number"!==typeof r)return new Error("`".concat(t,"` of type `").concat(typeof r,"` supplied to `").concat(a,"`, expected `number`."));if(r<1)return new Error("Expected `".concat(t,"` to be greater or equal to 1."));var o=i.numPages;if(r>o)return new Error("Expected `".concat(t,"` to be less or equal to ").concat(o,"."))}else if(!(0,s.$K)(n))return new Error("`".concat(t,"` not supplied. Either pageIndex or pageNumber must be supplied to `").concat(a,"`."));return null},p=r.oneOfType([r.any,r.oneOf([!1])]),_=r.oneOfType([r.func,r.exact({current:r.any})]),g=r.oneOf(["canvas","custom","none","svg"]),y=r.oneOf([0,90,180,270])},78884:function(e,t,a){"use strict";a.d(t,{$K:function(){return l},DE:function(){return m},LJ:function(){return g},Lj:function(){return d},T8:function(){return c},XZ:function(){return y},eP:function(){return u},eR:function(){return b},gJ:function(){return h},jU:function(){return s},tN:function(){return _},us:function(){return v},x_:function(){return f}});var r=a(29439),n=a(44554),i=a(15501),s="undefined"!==typeof document,o=s&&"file:"===window.location.protocol;function l(e){return"undefined"!==typeof e}function c(e){return l(e)&&null!==e}function u(e){return e instanceof ArrayBuffer}function d(e){return(0,n.Z)(s,"isBlob can only be used in a browser environment"),e instanceof Blob}function h(e){return function(e){return"string"===typeof e}(e)&&/^data:/.test(e)}function v(e){(0,n.Z)(h(e),"Invalid data URI.");var t=e.split(","),a=(0,r.Z)(t,2),i=a[0],s=void 0===i?"":i,o=a[1],l=void 0===o?"":o;return-1!==s.split(";").indexOf("base64")?atob(l):unescape(l)}function f(){return s&&window.devicePixelRatio||1}var p="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function _(){(0,i.Z)(!o,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(p))}function g(e){e&&e.cancel&&e.cancel()}function y(e,t){return Object.defineProperty(e,"width",{get:function(){return this.view[2]*t},configurable:!0}),Object.defineProperty(e,"height",{get:function(){return this.view[3]*t},configurable:!0}),Object.defineProperty(e,"originalWidth",{get:function(){return this.view[2]},configurable:!0}),Object.defineProperty(e,"originalHeight",{get:function(){return this.view[3]},configurable:!0}),e}function m(e){return"RenderingCancelledException"===e.name}function b(e){return new Promise((function(t,a){var r=new FileReader;r.onload=function(){if(!r.result)return a(new Error("Error while reading a file."));t(r.result)},r.onerror=function(e){if(!e.target)return a(new Error("Error while reading a file."));var t=e.target.error;if(!t)return a(new Error("Error while reading a file."));switch(t.code){case t.NOT_FOUND_ERR:return a(new Error("Error while reading a file: File not found."));case t.SECURITY_ERR:return a(new Error("Error while reading a file: Security error."));case t.ABORT_ERR:return a(new Error("Error while reading a file: Aborted."));default:return a(new Error("Error while reading a file."))}},r.readAsArrayBuffer(e)}))}},98896:function(e,t,a){"use strict";function r(e){var t,a,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t {\nreturn ","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Skip compatibility checks for modern builds and if we already ran the module.\nif (\n typeof PDFJSDev !== \"undefined\" &&\n !PDFJSDev.test(\"SKIP_BABEL\") &&\n !globalThis._pdfjsCompatibilityChecked\n) {\n globalThis._pdfjsCompatibilityChecked = true;\n require(\"./compatibility.js\");\n}\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\n\nconst MAX_IMAGE_SIZE_TO_CACHE = 10e6; // Ten megabytes.\n\n// Represent the percentage of the height of a single-line field over\n// the font size. Acrobat seems to use this value.\nconst LINE_FACTOR = 1.35;\nconst LINE_DESCENT_FACTOR = 0.35;\nconst BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;\n\n/**\n * Refer to the `WorkerTransport.getRenderingIntent`-method in the API, to see\n * how these flags are being used:\n * - ANY, DISPLAY, and PRINT are the normal rendering intents, note the\n * `PDFPageProxy.{render, getOperatorList, getAnnotations}`-methods.\n * - ANNOTATIONS_FORMS, ANNOTATIONS_STORAGE, ANNOTATIONS_DISABLE control which\n * annotations are rendered onto the canvas (i.e. by being included in the\n * operatorList), note the `PDFPageProxy.{render, getOperatorList}`-methods\n * and their `annotationMode`-option.\n * - OPLIST is used with the `PDFPageProxy.getOperatorList`-method, note the\n * `OperatorList`-constructor (on the worker-thread).\n */\nconst RenderingIntentFlag = {\n ANY: 0x01,\n DISPLAY: 0x02,\n PRINT: 0x04,\n SAVE: 0x08,\n ANNOTATIONS_FORMS: 0x10,\n ANNOTATIONS_STORAGE: 0x20,\n ANNOTATIONS_DISABLE: 0x40,\n OPLIST: 0x100,\n};\n\nconst AnnotationMode = {\n DISABLE: 0,\n ENABLE: 1,\n ENABLE_FORMS: 2,\n ENABLE_STORAGE: 3,\n};\n\nconst AnnotationEditorPrefix = \"pdfjs_internal_editor_\";\n\nconst AnnotationEditorType = {\n DISABLE: -1,\n NONE: 0,\n FREETEXT: 3,\n INK: 15,\n};\n\nconst AnnotationEditorParamsType = {\n FREETEXT_SIZE: 1,\n FREETEXT_COLOR: 2,\n FREETEXT_OPACITY: 3,\n INK_COLOR: 11,\n INK_THICKNESS: 12,\n INK_OPACITY: 13,\n};\n\n// Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.\nconst PermissionFlag = {\n PRINT: 0x04,\n MODIFY_CONTENTS: 0x08,\n COPY: 0x10,\n MODIFY_ANNOTATIONS: 0x20,\n FILL_INTERACTIVE_FORMS: 0x100,\n COPY_FOR_ACCESSIBILITY: 0x200,\n ASSEMBLE: 0x400,\n PRINT_HIGH_QUALITY: 0x800,\n};\n\nconst TextRenderingMode = {\n FILL: 0,\n STROKE: 1,\n FILL_STROKE: 2,\n INVISIBLE: 3,\n FILL_ADD_TO_PATH: 4,\n STROKE_ADD_TO_PATH: 5,\n FILL_STROKE_ADD_TO_PATH: 6,\n ADD_TO_PATH: 7,\n FILL_STROKE_MASK: 3,\n ADD_TO_PATH_FLAG: 4,\n};\n\nconst ImageKind = {\n GRAYSCALE_1BPP: 1,\n RGB_24BPP: 2,\n RGBA_32BPP: 3,\n};\n\nconst AnnotationType = {\n TEXT: 1,\n LINK: 2,\n FREETEXT: 3,\n LINE: 4,\n SQUARE: 5,\n CIRCLE: 6,\n POLYGON: 7,\n POLYLINE: 8,\n HIGHLIGHT: 9,\n UNDERLINE: 10,\n SQUIGGLY: 11,\n STRIKEOUT: 12,\n STAMP: 13,\n CARET: 14,\n INK: 15,\n POPUP: 16,\n FILEATTACHMENT: 17,\n SOUND: 18,\n MOVIE: 19,\n WIDGET: 20,\n SCREEN: 21,\n PRINTERMARK: 22,\n TRAPNET: 23,\n WATERMARK: 24,\n THREED: 25,\n REDACT: 26,\n};\n\nconst AnnotationStateModelType = {\n MARKED: \"Marked\",\n REVIEW: \"Review\",\n};\n\nconst AnnotationMarkedState = {\n MARKED: \"Marked\",\n UNMARKED: \"Unmarked\",\n};\n\nconst AnnotationReviewState = {\n ACCEPTED: \"Accepted\",\n REJECTED: \"Rejected\",\n CANCELLED: \"Cancelled\",\n COMPLETED: \"Completed\",\n NONE: \"None\",\n};\n\nconst AnnotationReplyType = {\n GROUP: \"Group\",\n REPLY: \"R\",\n};\n\nconst AnnotationFlag = {\n INVISIBLE: 0x01,\n HIDDEN: 0x02,\n PRINT: 0x04,\n NOZOOM: 0x08,\n NOROTATE: 0x10,\n NOVIEW: 0x20,\n READONLY: 0x40,\n LOCKED: 0x80,\n TOGGLENOVIEW: 0x100,\n LOCKEDCONTENTS: 0x200,\n};\n\nconst AnnotationFieldFlag = {\n READONLY: 0x0000001,\n REQUIRED: 0x0000002,\n NOEXPORT: 0x0000004,\n MULTILINE: 0x0001000,\n PASSWORD: 0x0002000,\n NOTOGGLETOOFF: 0x0004000,\n RADIO: 0x0008000,\n PUSHBUTTON: 0x0010000,\n COMBO: 0x0020000,\n EDIT: 0x0040000,\n SORT: 0x0080000,\n FILESELECT: 0x0100000,\n MULTISELECT: 0x0200000,\n DONOTSPELLCHECK: 0x0400000,\n DONOTSCROLL: 0x0800000,\n COMB: 0x1000000,\n RICHTEXT: 0x2000000,\n RADIOSINUNISON: 0x2000000,\n COMMITONSELCHANGE: 0x4000000,\n};\n\nconst AnnotationBorderStyleType = {\n SOLID: 1,\n DASHED: 2,\n BEVELED: 3,\n INSET: 4,\n UNDERLINE: 5,\n};\n\nconst AnnotationActionEventType = {\n E: \"Mouse Enter\",\n X: \"Mouse Exit\",\n D: \"Mouse Down\",\n U: \"Mouse Up\",\n Fo: \"Focus\",\n Bl: \"Blur\",\n PO: \"PageOpen\",\n PC: \"PageClose\",\n PV: \"PageVisible\",\n PI: \"PageInvisible\",\n K: \"Keystroke\",\n F: \"Format\",\n V: \"Validate\",\n C: \"Calculate\",\n};\n\nconst DocumentActionEventType = {\n WC: \"WillClose\",\n WS: \"WillSave\",\n DS: \"DidSave\",\n WP: \"WillPrint\",\n DP: \"DidPrint\",\n};\n\nconst PageActionEventType = {\n O: \"PageOpen\",\n C: \"PageClose\",\n};\n\nconst VerbosityLevel = {\n ERRORS: 0,\n WARNINGS: 1,\n INFOS: 5,\n};\n\nconst CMapCompressionType = {\n NONE: 0,\n BINARY: 1,\n};\n\n// All the possible operations for an operator list.\nconst OPS = {\n // Intentionally start from 1 so it is easy to spot bad operators that will be\n // 0's.\n // PLEASE NOTE: We purposely keep any removed operators commented out, since\n // re-numbering the list would risk breaking third-party users.\n dependency: 1,\n setLineWidth: 2,\n setLineCap: 3,\n setLineJoin: 4,\n setMiterLimit: 5,\n setDash: 6,\n setRenderingIntent: 7,\n setFlatness: 8,\n setGState: 9,\n save: 10,\n restore: 11,\n transform: 12,\n moveTo: 13,\n lineTo: 14,\n curveTo: 15,\n curveTo2: 16,\n curveTo3: 17,\n closePath: 18,\n rectangle: 19,\n stroke: 20,\n closeStroke: 21,\n fill: 22,\n eoFill: 23,\n fillStroke: 24,\n eoFillStroke: 25,\n closeFillStroke: 26,\n closeEOFillStroke: 27,\n endPath: 28,\n clip: 29,\n eoClip: 30,\n beginText: 31,\n endText: 32,\n setCharSpacing: 33,\n setWordSpacing: 34,\n setHScale: 35,\n setLeading: 36,\n setFont: 37,\n setTextRenderingMode: 38,\n setTextRise: 39,\n moveText: 40,\n setLeadingMoveText: 41,\n setTextMatrix: 42,\n nextLine: 43,\n showText: 44,\n showSpacedText: 45,\n nextLineShowText: 46,\n nextLineSetSpacingShowText: 47,\n setCharWidth: 48,\n setCharWidthAndBounds: 49,\n setStrokeColorSpace: 50,\n setFillColorSpace: 51,\n setStrokeColor: 52,\n setStrokeColorN: 53,\n setFillColor: 54,\n setFillColorN: 55,\n setStrokeGray: 56,\n setFillGray: 57,\n setStrokeRGBColor: 58,\n setFillRGBColor: 59,\n setStrokeCMYKColor: 60,\n setFillCMYKColor: 61,\n shadingFill: 62,\n beginInlineImage: 63,\n beginImageData: 64,\n endInlineImage: 65,\n paintXObject: 66,\n markPoint: 67,\n markPointProps: 68,\n beginMarkedContent: 69,\n beginMarkedContentProps: 70,\n endMarkedContent: 71,\n beginCompat: 72,\n endCompat: 73,\n paintFormXObjectBegin: 74,\n paintFormXObjectEnd: 75,\n beginGroup: 76,\n endGroup: 77,\n // beginAnnotations: 78,\n // endAnnotations: 79,\n beginAnnotation: 80,\n endAnnotation: 81,\n // paintJpegXObject: 82,\n paintImageMaskXObject: 83,\n paintImageMaskXObjectGroup: 84,\n paintImageXObject: 85,\n paintInlineImageXObject: 86,\n paintInlineImageXObjectGroup: 87,\n paintImageXObjectRepeat: 88,\n paintImageMaskXObjectRepeat: 89,\n paintSolidColorImageMask: 90,\n constructPath: 91,\n};\n\nconst PasswordResponses = {\n NEED_PASSWORD: 1,\n INCORRECT_PASSWORD: 2,\n};\n\nlet verbosity = VerbosityLevel.WARNINGS;\n\nfunction setVerbosityLevel(level) {\n if (Number.isInteger(level)) {\n verbosity = level;\n }\n}\n\nfunction getVerbosityLevel() {\n return verbosity;\n}\n\n// A notice for devs. These are good for things that are helpful to devs, such\n// as warning that Workers were disabled, which is important to devs but not\n// end users.\nfunction info(msg) {\n if (verbosity >= VerbosityLevel.INFOS) {\n console.log(`Info: ${msg}`);\n }\n}\n\n// Non-fatal warnings.\nfunction warn(msg) {\n if (verbosity >= VerbosityLevel.WARNINGS) {\n console.log(`Warning: ${msg}`);\n }\n}\n\nfunction unreachable(msg) {\n throw new Error(msg);\n}\n\nfunction assert(cond, msg) {\n if (!cond) {\n unreachable(msg);\n }\n}\n\n// Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.\nfunction _isValidProtocol(url) {\n switch (url?.protocol) {\n case \"http:\":\n case \"https:\":\n case \"ftp:\":\n case \"mailto:\":\n case \"tel:\":\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Attempts to create a valid absolute URL.\n *\n * @param {URL|string} url - An absolute, or relative, URL.\n * @param {URL|string} [baseUrl] - An absolute URL.\n * @param {Object} [options]\n * @returns Either a valid {URL}, or `null` otherwise.\n */\nfunction createValidAbsoluteUrl(url, baseUrl = null, options = null) {\n if (!url) {\n return null;\n }\n try {\n if (options && typeof url === \"string\") {\n // Let URLs beginning with \"www.\" default to using the \"http://\" protocol.\n if (options.addDefaultProtocol && url.startsWith(\"www.\")) {\n const dots = url.match(/\\./g);\n // Avoid accidentally matching a *relative* URL pointing to a file named\n // e.g. \"www.pdf\" or similar.\n if (dots?.length >= 2) {\n url = `http://${url}`;\n }\n }\n\n // According to ISO 32000-1:2008, section 12.6.4.7, URIs should be encoded\n // in 7-bit ASCII. Some bad PDFs use UTF-8 encoding; see bug 1122280.\n if (options.tryConvertEncoding) {\n try {\n url = stringToUTF8String(url);\n } catch (ex) {}\n }\n }\n\n const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n if (_isValidProtocol(absoluteUrl)) {\n return absoluteUrl;\n }\n } catch (ex) {\n /* `new URL()` will throw on incorrect data. */\n }\n return null;\n}\n\nfunction shadow(obj, prop, value, nonSerializable = false) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n assert(\n prop in obj,\n `shadow: Property \"${prop && prop.toString()}\" not found in object.`\n );\n }\n Object.defineProperty(obj, prop, {\n value,\n enumerable: !nonSerializable,\n configurable: true,\n writable: false,\n });\n return value;\n}\n\n/**\n * @type {any}\n */\nconst BaseException = (function BaseExceptionClosure() {\n // eslint-disable-next-line no-shadow\n function BaseException(message, name) {\n if (this.constructor === BaseException) {\n unreachable(\"Cannot initialize BaseException.\");\n }\n this.message = message;\n this.name = name;\n }\n BaseException.prototype = new Error();\n BaseException.constructor = BaseException;\n\n return BaseException;\n})();\n\nclass PasswordException extends BaseException {\n constructor(msg, code) {\n super(msg, \"PasswordException\");\n this.code = code;\n }\n}\n\nclass UnknownErrorException extends BaseException {\n constructor(msg, details) {\n super(msg, \"UnknownErrorException\");\n this.details = details;\n }\n}\n\nclass InvalidPDFException extends BaseException {\n constructor(msg) {\n super(msg, \"InvalidPDFException\");\n }\n}\n\nclass MissingPDFException extends BaseException {\n constructor(msg) {\n super(msg, \"MissingPDFException\");\n }\n}\n\nclass UnexpectedResponseException extends BaseException {\n constructor(msg, status) {\n super(msg, \"UnexpectedResponseException\");\n this.status = status;\n }\n}\n\n/**\n * Error caused during parsing PDF data.\n */\nclass FormatError extends BaseException {\n constructor(msg) {\n super(msg, \"FormatError\");\n }\n}\n\n/**\n * Error used to indicate task cancellation.\n */\nclass AbortException extends BaseException {\n constructor(msg) {\n super(msg, \"AbortException\");\n }\n}\n\nfunction bytesToString(bytes) {\n if (typeof bytes !== \"object\" || bytes?.length === undefined) {\n unreachable(\"Invalid argument for bytesToString\");\n }\n const length = bytes.length;\n const MAX_ARGUMENT_COUNT = 8192;\n if (length < MAX_ARGUMENT_COUNT) {\n return String.fromCharCode.apply(null, bytes);\n }\n const strBuf = [];\n for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {\n const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);\n const chunk = bytes.subarray(i, chunkEnd);\n strBuf.push(String.fromCharCode.apply(null, chunk));\n }\n return strBuf.join(\"\");\n}\n\nfunction stringToBytes(str) {\n if (typeof str !== \"string\") {\n unreachable(\"Invalid argument for stringToBytes\");\n }\n const length = str.length;\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; ++i) {\n bytes[i] = str.charCodeAt(i) & 0xff;\n }\n return bytes;\n}\n\nfunction string32(value) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n assert(\n typeof value === \"number\" && Math.abs(value) < 2 ** 32,\n `string32: Unexpected input \"${value}\".`\n );\n }\n return String.fromCharCode(\n (value >> 24) & 0xff,\n (value >> 16) & 0xff,\n (value >> 8) & 0xff,\n value & 0xff\n );\n}\n\nfunction objectSize(obj) {\n return Object.keys(obj).length;\n}\n\n// Ensure that the returned Object has a `null` prototype; hence why\n// `Object.fromEntries(...)` is not used.\nfunction objectFromMap(map) {\n const obj = Object.create(null);\n for (const [key, value] of map) {\n obj[key] = value;\n }\n return obj;\n}\n\n// Checks the endianness of the platform.\nfunction isLittleEndian() {\n const buffer8 = new Uint8Array(4);\n buffer8[0] = 1;\n const view32 = new Uint32Array(buffer8.buffer, 0, 1);\n return view32[0] === 1;\n}\n\n// Checks if it's possible to eval JS expressions.\nfunction isEvalSupported() {\n try {\n new Function(\"\"); // eslint-disable-line no-new, no-new-func\n return true;\n } catch (e) {\n return false;\n }\n}\n\nclass FeatureTest {\n static get isLittleEndian() {\n return shadow(this, \"isLittleEndian\", isLittleEndian());\n }\n\n static get isEvalSupported() {\n return shadow(this, \"isEvalSupported\", isEvalSupported());\n }\n\n static get isOffscreenCanvasSupported() {\n return shadow(\n this,\n \"isOffscreenCanvasSupported\",\n typeof OffscreenCanvas !== \"undefined\"\n );\n }\n\n static get platform() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n typeof navigator === \"undefined\"\n ) {\n return shadow(this, \"platform\", { isWin: false, isMac: false });\n }\n return shadow(this, \"platform\", {\n isWin: navigator.platform.includes(\"Win\"),\n isMac: navigator.platform.includes(\"Mac\"),\n });\n }\n}\n\nconst hexNumbers = [...Array(256).keys()].map(n =>\n n.toString(16).padStart(2, \"0\")\n);\n\nclass Util {\n static makeHexColor(r, g, b) {\n return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;\n }\n\n // Apply a scaling matrix to some min/max values.\n // If a scaling factor is negative then min and max must be\n // swaped.\n static scaleMinMax(transform, minMax) {\n let temp;\n if (transform[0]) {\n if (transform[0] < 0) {\n temp = minMax[0];\n minMax[0] = minMax[1];\n minMax[1] = temp;\n }\n minMax[0] *= transform[0];\n minMax[1] *= transform[0];\n\n if (transform[3] < 0) {\n temp = minMax[2];\n minMax[2] = minMax[3];\n minMax[3] = temp;\n }\n minMax[2] *= transform[3];\n minMax[3] *= transform[3];\n } else {\n temp = minMax[0];\n minMax[0] = minMax[2];\n minMax[2] = temp;\n temp = minMax[1];\n minMax[1] = minMax[3];\n minMax[3] = temp;\n\n if (transform[1] < 0) {\n temp = minMax[2];\n minMax[2] = minMax[3];\n minMax[3] = temp;\n }\n minMax[2] *= transform[1];\n minMax[3] *= transform[1];\n\n if (transform[2] < 0) {\n temp = minMax[0];\n minMax[0] = minMax[1];\n minMax[1] = temp;\n }\n minMax[0] *= transform[2];\n minMax[1] *= transform[2];\n }\n minMax[0] += transform[4];\n minMax[1] += transform[4];\n minMax[2] += transform[5];\n minMax[3] += transform[5];\n }\n\n // Concatenates two transformation matrices together and returns the result.\n static transform(m1, m2) {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5],\n ];\n }\n\n // For 2d affine transforms\n static applyTransform(p, m) {\n const xt = p[0] * m[0] + p[1] * m[2] + m[4];\n const yt = p[0] * m[1] + p[1] * m[3] + m[5];\n return [xt, yt];\n }\n\n static applyInverseTransform(p, m) {\n const d = m[0] * m[3] - m[1] * m[2];\n const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n return [xt, yt];\n }\n\n // Applies the transform to the rectangle and finds the minimum axially\n // aligned bounding box.\n static getAxialAlignedBoundingBox(r, m) {\n const p1 = Util.applyTransform(r, m);\n const p2 = Util.applyTransform(r.slice(2, 4), m);\n const p3 = Util.applyTransform([r[0], r[3]], m);\n const p4 = Util.applyTransform([r[2], r[1]], m);\n return [\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1]),\n ];\n }\n\n static inverseTransform(m) {\n const d = m[0] * m[3] - m[1] * m[2];\n return [\n m[3] / d,\n -m[1] / d,\n -m[2] / d,\n m[0] / d,\n (m[2] * m[5] - m[4] * m[3]) / d,\n (m[4] * m[1] - m[5] * m[0]) / d,\n ];\n }\n\n // This calculation uses Singular Value Decomposition.\n // The SVD can be represented with formula A = USV. We are interested in the\n // matrix S here because it represents the scale values.\n static singularValueDecompose2dScale(m) {\n const transpose = [m[0], m[2], m[1], m[3]];\n\n // Multiply matrix m with its transpose.\n const a = m[0] * transpose[0] + m[1] * transpose[2];\n const b = m[0] * transpose[1] + m[1] * transpose[3];\n const c = m[2] * transpose[0] + m[3] * transpose[2];\n const d = m[2] * transpose[1] + m[3] * transpose[3];\n\n // Solve the second degree polynomial to get roots.\n const first = (a + d) / 2;\n const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;\n const sx = first + second || 1;\n const sy = first - second || 1;\n\n // Scale values are the square roots of the eigenvalues.\n return [Math.sqrt(sx), Math.sqrt(sy)];\n }\n\n // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)\n // For coordinate systems whose origin lies in the bottom-left, this\n // means normalization to (BL,TR) ordering. For systems with origin in the\n // top-left, this means (TL,BR) ordering.\n static normalizeRect(rect) {\n const r = rect.slice(0); // clone rect\n if (rect[0] > rect[2]) {\n r[0] = rect[2];\n r[2] = rect[0];\n }\n if (rect[1] > rect[3]) {\n r[1] = rect[3];\n r[3] = rect[1];\n }\n return r;\n }\n\n // Returns a rectangle [x1, y1, x2, y2] corresponding to the\n // intersection of rect1 and rect2. If no intersection, returns 'null'\n // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]\n static intersect(rect1, rect2) {\n const xLow = Math.max(\n Math.min(rect1[0], rect1[2]),\n Math.min(rect2[0], rect2[2])\n );\n const xHigh = Math.min(\n Math.max(rect1[0], rect1[2]),\n Math.max(rect2[0], rect2[2])\n );\n if (xLow > xHigh) {\n return null;\n }\n const yLow = Math.max(\n Math.min(rect1[1], rect1[3]),\n Math.min(rect2[1], rect2[3])\n );\n const yHigh = Math.min(\n Math.max(rect1[1], rect1[3]),\n Math.max(rect2[1], rect2[3])\n );\n if (yLow > yHigh) {\n return null;\n }\n\n return [xLow, yLow, xHigh, yHigh];\n }\n\n // From https://github.com/adobe-webplatform/Snap.svg/blob/b365287722a72526000ac4bfcf0ce4cac2faa015/src/path.js#L852\n static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {\n const tvalues = [],\n bounds = [[], []];\n let a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n for (let i = 0; i < 2; ++i) {\n if (i === 0) {\n b = 6 * x0 - 12 * x1 + 6 * x2;\n a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n c = 3 * x1 - 3 * x0;\n } else {\n b = 6 * y0 - 12 * y1 + 6 * y2;\n a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n c = 3 * y1 - 3 * y0;\n }\n if (Math.abs(a) < 1e-12) {\n if (Math.abs(b) < 1e-12) {\n continue;\n }\n t = -c / b;\n if (0 < t && t < 1) {\n tvalues.push(t);\n }\n continue;\n }\n b2ac = b * b - 4 * c * a;\n sqrtb2ac = Math.sqrt(b2ac);\n if (b2ac < 0) {\n continue;\n }\n t1 = (-b + sqrtb2ac) / (2 * a);\n if (0 < t1 && t1 < 1) {\n tvalues.push(t1);\n }\n t2 = (-b - sqrtb2ac) / (2 * a);\n if (0 < t2 && t2 < 1) {\n tvalues.push(t2);\n }\n }\n\n let j = tvalues.length,\n mt;\n const jlen = j;\n while (j--) {\n t = tvalues[j];\n mt = 1 - t;\n bounds[0][j] =\n mt * mt * mt * x0 +\n 3 * mt * mt * t * x1 +\n 3 * mt * t * t * x2 +\n t * t * t * x3;\n bounds[1][j] =\n mt * mt * mt * y0 +\n 3 * mt * mt * t * y1 +\n 3 * mt * t * t * y2 +\n t * t * t * y3;\n }\n\n bounds[0][jlen] = x0;\n bounds[1][jlen] = y0;\n bounds[0][jlen + 1] = x3;\n bounds[1][jlen + 1] = y3;\n bounds[0].length = bounds[1].length = jlen + 2;\n\n return [\n Math.min(...bounds[0]),\n Math.min(...bounds[1]),\n Math.max(...bounds[0]),\n Math.max(...bounds[1]),\n ];\n }\n}\n\nconst PDFStringTranslateTable = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8,\n 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 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,\n 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,\n 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,\n 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192,\n 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018,\n 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d,\n 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac,\n];\n\nfunction stringToPDFString(str) {\n if (str[0] >= \"\\xEF\") {\n let encoding;\n if (str[0] === \"\\xFE\" && str[1] === \"\\xFF\") {\n encoding = \"utf-16be\";\n } else if (str[0] === \"\\xFF\" && str[1] === \"\\xFE\") {\n encoding = \"utf-16le\";\n } else if (str[0] === \"\\xEF\" && str[1] === \"\\xBB\" && str[2] === \"\\xBF\") {\n encoding = \"utf-8\";\n }\n\n if (encoding) {\n try {\n const decoder = new TextDecoder(encoding, { fatal: true });\n const buffer = stringToBytes(str);\n return decoder.decode(buffer);\n } catch (ex) {\n warn(`stringToPDFString: \"${ex}\".`);\n }\n }\n }\n // ISO Latin 1\n const strBuf = [];\n for (let i = 0, ii = str.length; i < ii; i++) {\n const code = PDFStringTranslateTable[str.charCodeAt(i)];\n strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));\n }\n return strBuf.join(\"\");\n}\n\nfunction stringToUTF8String(str) {\n return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n return unescape(encodeURIComponent(str));\n}\n\nfunction isArrayBuffer(v) {\n return typeof v === \"object\" && v?.byteLength !== undefined;\n}\n\nfunction isArrayEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n for (let i = 0, ii = arr1.length; i < ii; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction getModificationDate(date = new Date()) {\n const buffer = [\n date.getUTCFullYear().toString(),\n (date.getUTCMonth() + 1).toString().padStart(2, \"0\"),\n date.getUTCDate().toString().padStart(2, \"0\"),\n date.getUTCHours().toString().padStart(2, \"0\"),\n date.getUTCMinutes().toString().padStart(2, \"0\"),\n date.getUTCSeconds().toString().padStart(2, \"0\"),\n ];\n\n return buffer.join(\"\");\n}\n\nclass PromiseCapability {\n #settled = false;\n\n constructor() {\n /**\n * @type {Promise} The Promise object.\n */\n this.promise = new Promise((resolve, reject) => {\n /**\n * @type {function} Fulfills the Promise.\n */\n this.resolve = data => {\n this.#settled = true;\n resolve(data);\n };\n\n /**\n * @type {function} Rejects the Promise.\n */\n this.reject = reason => {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n assert(reason instanceof Error, 'Expected valid \"reason\" argument.');\n }\n this.#settled = true;\n reject(reason);\n };\n });\n }\n\n /**\n * @type {boolean} If the Promise has been fulfilled/rejected.\n */\n get settled() {\n return this.#settled;\n }\n}\n\nlet NormalizeRegex = null;\nlet NormalizationMap = null;\nfunction normalizeUnicode(str) {\n if (!NormalizeRegex) {\n // In order to generate the following regex:\n // - create a PDF containing all the chars in the range 0000-FFFF with\n // a NFKC which is different of the char.\n // - copy and paste all those chars and get the ones where NFKC is\n // required.\n // It appears that most the chars here contain some ligatures.\n NormalizeRegex =\n /([\\u00a0\\u00b5\\u037e\\u0eb3\\u2000-\\u200a\\u202f\\u2126\\ufb00-\\ufb04\\ufb06\\ufb20-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufba1\\ufba4-\\ufba9\\ufbae-\\ufbb1\\ufbd3-\\ufbdc\\ufbde-\\ufbe7\\ufbea-\\ufbf8\\ufbfc-\\ufbfd\\ufc00-\\ufc5d\\ufc64-\\ufcf1\\ufcf5-\\ufd3d\\ufd88\\ufdf4\\ufdfa-\\ufdfb\\ufe71\\ufe77\\ufe79\\ufe7b\\ufe7d]+)|(\\ufb05+)/gu;\n NormalizationMap = new Map([[\"ſt\", \"ſt\"]]);\n }\n return str.replaceAll(NormalizeRegex, (_, p1, p2) => {\n return p1 ? p1.normalize(\"NFKC\") : NormalizationMap.get(p2);\n });\n}\n\nexport {\n AbortException,\n AnnotationActionEventType,\n AnnotationBorderStyleType,\n AnnotationEditorParamsType,\n AnnotationEditorPrefix,\n AnnotationEditorType,\n AnnotationFieldFlag,\n AnnotationFlag,\n AnnotationMarkedState,\n AnnotationMode,\n AnnotationReplyType,\n AnnotationReviewState,\n AnnotationStateModelType,\n AnnotationType,\n assert,\n BaseException,\n BASELINE_FACTOR,\n bytesToString,\n CMapCompressionType,\n createValidAbsoluteUrl,\n DocumentActionEventType,\n FeatureTest,\n FONT_IDENTITY_MATRIX,\n FormatError,\n getModificationDate,\n getVerbosityLevel,\n IDENTITY_MATRIX,\n ImageKind,\n info,\n InvalidPDFException,\n isArrayBuffer,\n isArrayEqual,\n LINE_DESCENT_FACTOR,\n LINE_FACTOR,\n MAX_IMAGE_SIZE_TO_CACHE,\n MissingPDFException,\n normalizeUnicode,\n objectFromMap,\n objectSize,\n OPS,\n PageActionEventType,\n PasswordException,\n PasswordResponses,\n PermissionFlag,\n PromiseCapability,\n RenderingIntentFlag,\n setVerbosityLevel,\n shadow,\n string32,\n stringToBytes,\n stringToPDFString,\n stringToUTF8String,\n TextRenderingMode,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n utf8StringToString,\n Util,\n VerbosityLevel,\n warn,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @module pdfjsLib\n */\n\nimport {\n AbortException,\n AnnotationMode,\n assert,\n getVerbosityLevel,\n info,\n InvalidPDFException,\n isArrayBuffer,\n MAX_IMAGE_SIZE_TO_CACHE,\n MissingPDFException,\n PasswordException,\n PromiseCapability,\n RenderingIntentFlag,\n setVerbosityLevel,\n shadow,\n stringToBytes,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n warn,\n} from \"../shared/util.js\";\nimport {\n AnnotationStorage,\n PrintAnnotationStorage,\n} from \"./annotation_storage.js\";\nimport {\n deprecated,\n DOMCanvasFactory,\n DOMCMapReaderFactory,\n DOMFilterFactory,\n DOMStandardFontDataFactory,\n isDataScheme,\n isValidFetchUrl,\n loadScript,\n PageViewport,\n RenderingCancelledException,\n StatTimer,\n} from \"./display_utils.js\";\nimport { FontFaceObject, FontLoader } from \"./font_loader.js\";\nimport { CanvasGraphics } from \"./canvas.js\";\nimport { GlobalWorkerOptions } from \"./worker_options.js\";\nimport { isNodeJS } from \"../shared/is_node.js\";\nimport { MessageHandler } from \"../shared/message_handler.js\";\nimport { Metadata } from \"./metadata.js\";\nimport { OptionalContentConfig } from \"./optional_content_config.js\";\nimport { PDFDataTransportStream } from \"./transport_stream.js\";\nimport { XfaText } from \"./xfa_text.js\";\n\nconst DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536\nconst RENDERING_CANCELLED_TIMEOUT = 100; // ms\nconst DELAYED_CLEANUP_TIMEOUT = 5000; // ms\n\nlet DefaultCanvasFactory = DOMCanvasFactory;\nlet DefaultCMapReaderFactory = DOMCMapReaderFactory;\nlet DefaultFilterFactory = DOMFilterFactory;\nlet DefaultStandardFontDataFactory = DOMStandardFontDataFactory;\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\") && isNodeJS) {\n const {\n NodeCanvasFactory,\n NodeCMapReaderFactory,\n NodeFilterFactory,\n NodeStandardFontDataFactory,\n } = require(\"./node_utils.js\");\n\n DefaultCanvasFactory = NodeCanvasFactory;\n DefaultCMapReaderFactory = NodeCMapReaderFactory;\n DefaultFilterFactory = NodeFilterFactory;\n DefaultStandardFontDataFactory = NodeStandardFontDataFactory;\n}\n\nlet createPDFNetworkStream;\nif (typeof PDFJSDev === \"undefined\") {\n const streamsPromise = Promise.all([\n import(\"./network.js\"),\n import(\"./fetch_stream.js\"),\n ]);\n\n createPDFNetworkStream = async params => {\n const [{ PDFNetworkStream }, { PDFFetchStream }] = await streamsPromise;\n\n return isValidFetchUrl(params.url)\n ? new PDFFetchStream(params)\n : new PDFNetworkStream(params);\n };\n} else if (PDFJSDev.test(\"GENERIC || CHROME\")) {\n if (PDFJSDev.test(\"GENERIC\") && isNodeJS) {\n const { PDFNodeStream } = require(\"./node_stream.js\");\n\n createPDFNetworkStream = params => {\n return new PDFNodeStream(params);\n };\n } else {\n const { PDFNetworkStream } = require(\"./network.js\");\n const { PDFFetchStream } = require(\"./fetch_stream.js\");\n\n createPDFNetworkStream = params => {\n return isValidFetchUrl(params.url)\n ? new PDFFetchStream(params)\n : new PDFNetworkStream(params);\n };\n }\n}\n\n/**\n * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |\n * Int16Array | Uint16Array |\n * Int32Array | Uint32Array | Float32Array |\n * Float64Array\n * } TypedArray\n */\n\n/**\n * @typedef { TypedArray | ArrayBuffer | Array | string } BinaryData\n */\n\n/**\n * @typedef {Object} RefProxy\n * @property {number} num\n * @property {number} gen\n */\n\n/**\n * Document initialization / loading parameters object.\n *\n * @typedef {Object} DocumentInitParameters\n * @property {string | URL} [url] - The URL of the PDF.\n * @property {BinaryData} [data] - Binary PDF data.\n * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is\n * BASE64-encoded, use `atob()` to convert it to a binary string first.\n *\n * NOTE: If TypedArrays are used they will generally be transferred to the\n * worker-thread. This will help reduce main-thread memory usage, however\n * it will take ownership of the TypedArrays.\n * @property {Object} [httpHeaders] - Basic authentication headers.\n * @property {boolean} [withCredentials] - Indicates whether or not\n * cross-site Access-Control requests should be made using credentials such\n * as cookies or authorization headers. The default is `false`.\n * @property {string} [password] - For decrypting password-protected PDFs.\n * @property {number} [length] - The PDF file length. It's used for progress\n * reports and range requests operations.\n * @property {PDFDataRangeTransport} [range] - Allows for using a custom range\n * transport implementation.\n * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched\n * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.\n * @property {PDFWorker} [worker] - The worker that will be used for loading and\n * parsing the PDF data.\n * @property {number} [verbosity] - Controls the logging level; the constants\n * from {@link VerbosityLevel} should be used.\n * @property {string} [docBaseUrl] - The base URL of the document, used when\n * attempting to recover valid absolute URLs for annotations, and outline\n * items, that (incorrectly) only specify relative URLs.\n * @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are\n * located. Include the trailing slash.\n * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary\n * packed or not. The default value is `true`.\n * @property {Object} [CMapReaderFactory] - The factory that will be used when\n * reading built-in CMap files. Providing a custom factory is useful for\n * environments without Fetch API or `XMLHttpRequest` support, such as\n * Node.js. The default value is {DOMCMapReaderFactory}.\n * @property {boolean} [useSystemFonts] - When `true`, fonts that aren't\n * embedded in the PDF document will fallback to a system font.\n * The default value is `true` in web environments and `false` in Node.js;\n * unless `disableFontFace === true` in which case this defaults to `false`\n * regardless of the environment (to prevent completely broken fonts).\n * @property {string} [standardFontDataUrl] - The URL where the standard font\n * files are located. Include the trailing slash.\n * @property {Object} [StandardFontDataFactory] - The factory that will be used\n * when reading the standard font files. Providing a custom factory is useful\n * for environments without Fetch API or `XMLHttpRequest` support, such as\n * Node.js. The default value is {DOMStandardFontDataFactory}.\n * @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the\n * worker-thread when reading CMap and standard font files. When `true`,\n * the `CMapReaderFactory` and `StandardFontDataFactory` options are ignored.\n * The default value is `true` in web environments and `false` in Node.js.\n * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.\n * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated\n * PDF data cannot be successfully parsed, instead of attempting to recover\n * whatever possible of the data. The default value is `false`.\n * @property {number} [maxImageSize] - The maximum allowed image size in total\n * pixels, i.e. width * height. Images above this value will not be rendered.\n * Use -1 for no limit, which is also the default value.\n * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings\n * as JavaScript. Primarily used to improve performance of font rendering, and\n * when parsing PDF functions. The default value is `true`.\n * @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use\n * `OffscreenCanvas` in the worker. Primarily used to improve performance of\n * image conversion/rendering.\n * The default value is `true` in web environments and `false` in Node.js.\n * @property {boolean} [canvasMaxAreaInBytes] - The integer value is used to\n * know when an image must be resized (uses `OffscreenCanvas` in the worker).\n * If it's -1 then a possibly slow algorithm is used to guess the max value.\n * @property {boolean} [disableFontFace] - By default fonts are converted to\n * OpenType fonts and loaded via the Font Loading API or `@font-face` rules.\n * If disabled, fonts will be rendered using a built-in font renderer that\n * constructs the glyphs with primitive path commands.\n * The default value is `false` in web environments and `true` in Node.js.\n * @property {boolean} [fontExtraProperties] - Include additional properties,\n * which are unused during rendering of PDF documents, when exporting the\n * parsed font data from the worker-thread. This may be useful for debugging\n * purposes (and backwards compatibility), but note that it will lead to\n * increased memory usage. The default value is `false`.\n * @property {boolean} [enableXfa] - Render Xfa forms if any.\n * The default value is `false`.\n * @property {HTMLDocument} [ownerDocument] - Specify an explicit document\n * context to create elements with and to load resources, such as fonts,\n * into. Defaults to the current document.\n * @property {boolean} [disableRange] - Disable range request loading of PDF\n * files. When enabled, and if the server supports partial content requests,\n * then the PDF will be fetched in chunks. The default value is `false`.\n * @property {boolean} [disableStream] - Disable streaming of PDF file data.\n * By default PDF.js attempts to load PDF files in chunks. The default value\n * is `false`.\n * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file\n * data. When range requests are enabled PDF.js will automatically keep\n * fetching more data even if it isn't needed to display the current page.\n * The default value is `false`.\n *\n * NOTE: It is also necessary to disable streaming, see above, in order for\n * disabling of pre-fetching to work correctly.\n * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js\n * (see `web/debugger.js`). The default value is `false`.\n * @property {Object} [canvasFactory] - The factory instance that will be used\n * when creating canvases. The default value is {new DOMCanvasFactory()}.\n * @property {Object} [filterFactory] - A factory instance that will be used\n * to create SVG filters when rendering some images on the main canvas.\n */\n\n/**\n * This is the main entry point for loading a PDF and interacting with it.\n *\n * NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or\n * XHR as fallback) is used, which means it must follow same origin rules,\n * e.g. no cross-domain requests without CORS.\n *\n * @param {string | URL | TypedArray | ArrayBuffer | DocumentInitParameters}\n * src - Can be a URL where a PDF file is located, a typed array (Uint8Array)\n * already populated with data, or a parameter object.\n * @returns {PDFDocumentLoadingTask}\n */\nfunction getDocument(src) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (typeof src === \"string\" || src instanceof URL) {\n src = { url: src };\n } else if (isArrayBuffer(src)) {\n src = { data: src };\n }\n }\n if (typeof src !== \"object\") {\n throw new Error(\"Invalid parameter in getDocument, need parameter object.\");\n }\n if (!src.url && !src.data && !src.range) {\n throw new Error(\n \"Invalid parameter object: need either .data, .range or .url\"\n );\n }\n const task = new PDFDocumentLoadingTask();\n const { docId } = task;\n\n const url = src.url ? getUrlProp(src.url) : null;\n const data = src.data ? getDataProp(src.data) : null;\n const httpHeaders = src.httpHeaders || null;\n const withCredentials = src.withCredentials === true;\n const password = src.password ?? null;\n const rangeTransport =\n src.range instanceof PDFDataRangeTransport ? src.range : null;\n const rangeChunkSize =\n Number.isInteger(src.rangeChunkSize) && src.rangeChunkSize > 0\n ? src.rangeChunkSize\n : DEFAULT_RANGE_CHUNK_SIZE;\n let worker = src.worker instanceof PDFWorker ? src.worker : null;\n const verbosity = src.verbosity;\n // Ignore \"data:\"-URLs, since they can't be used to recover valid absolute\n // URLs anyway. We want to avoid sending them to the worker-thread, since\n // they contain the *entire* PDF document and can thus be arbitrarily long.\n const docBaseUrl =\n typeof src.docBaseUrl === \"string\" && !isDataScheme(src.docBaseUrl)\n ? src.docBaseUrl\n : null;\n const cMapUrl = typeof src.cMapUrl === \"string\" ? src.cMapUrl : null;\n const cMapPacked = src.cMapPacked !== false;\n const CMapReaderFactory = src.CMapReaderFactory || DefaultCMapReaderFactory;\n const standardFontDataUrl =\n typeof src.standardFontDataUrl === \"string\"\n ? src.standardFontDataUrl\n : null;\n const StandardFontDataFactory =\n src.StandardFontDataFactory || DefaultStandardFontDataFactory;\n const ignoreErrors = src.stopAtErrors !== true;\n const maxImageSize =\n Number.isInteger(src.maxImageSize) && src.maxImageSize > -1\n ? src.maxImageSize\n : -1;\n const isEvalSupported = src.isEvalSupported !== false;\n const isOffscreenCanvasSupported =\n typeof src.isOffscreenCanvasSupported === \"boolean\"\n ? src.isOffscreenCanvasSupported\n : !isNodeJS;\n const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes)\n ? src.canvasMaxAreaInBytes\n : -1;\n const disableFontFace =\n typeof src.disableFontFace === \"boolean\" ? src.disableFontFace : isNodeJS;\n const fontExtraProperties = src.fontExtraProperties === true;\n const enableXfa = src.enableXfa === true;\n const ownerDocument = src.ownerDocument || globalThis.document;\n const disableRange = src.disableRange === true;\n const disableStream = src.disableStream === true;\n const disableAutoFetch = src.disableAutoFetch === true;\n const pdfBug = src.pdfBug === true;\n\n // Parameters whose default values depend on other parameters.\n const length = rangeTransport ? rangeTransport.length : src.length ?? NaN;\n const useSystemFonts =\n typeof src.useSystemFonts === \"boolean\"\n ? src.useSystemFonts\n : !isNodeJS && !disableFontFace;\n const useWorkerFetch =\n typeof src.useWorkerFetch === \"boolean\"\n ? src.useWorkerFetch\n : (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n (CMapReaderFactory === DOMCMapReaderFactory &&\n StandardFontDataFactory === DOMStandardFontDataFactory &&\n isValidFetchUrl(cMapUrl, document.baseURI) &&\n isValidFetchUrl(standardFontDataUrl, document.baseURI));\n const canvasFactory =\n src.canvasFactory || new DefaultCanvasFactory({ ownerDocument });\n const filterFactory =\n src.filterFactory || new DefaultFilterFactory({ docId, ownerDocument });\n\n // Parameters only intended for development/testing purposes.\n const styleElement =\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")\n ? src.styleElement\n : null;\n\n // Set the main-thread verbosity level.\n setVerbosityLevel(verbosity);\n\n // Ensure that the various factories can be initialized, when necessary,\n // since the user may provide *custom* ones.\n const transportFactory = {\n canvasFactory,\n filterFactory,\n };\n if (!useWorkerFetch) {\n transportFactory.cMapReaderFactory = new CMapReaderFactory({\n baseUrl: cMapUrl,\n isCompressed: cMapPacked,\n });\n transportFactory.standardFontDataFactory = new StandardFontDataFactory({\n baseUrl: standardFontDataUrl,\n });\n }\n\n if (!worker) {\n const workerParams = {\n verbosity,\n port: GlobalWorkerOptions.workerPort,\n };\n // Worker was not provided -- creating and owning our own. If message port\n // is specified in global worker options, using it.\n worker = workerParams.port\n ? PDFWorker.fromPort(workerParams)\n : new PDFWorker(workerParams);\n task._worker = worker;\n }\n\n const fetchDocParams = {\n docId,\n apiVersion:\n typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"TESTING\")\n ? PDFJSDev.eval(\"BUNDLE_VERSION\")\n : null,\n data,\n password,\n disableAutoFetch,\n rangeChunkSize,\n length,\n docBaseUrl,\n enableXfa,\n evaluatorOptions: {\n maxImageSize,\n disableFontFace,\n ignoreErrors,\n isEvalSupported,\n isOffscreenCanvasSupported,\n canvasMaxAreaInBytes,\n fontExtraProperties,\n useSystemFonts,\n cMapUrl: useWorkerFetch ? cMapUrl : null,\n standardFontDataUrl: useWorkerFetch ? standardFontDataUrl : null,\n },\n };\n const transportParams = {\n ignoreErrors,\n isEvalSupported,\n disableFontFace,\n fontExtraProperties,\n enableXfa,\n ownerDocument,\n disableAutoFetch,\n pdfBug,\n styleElement,\n };\n\n worker.promise\n .then(function () {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const workerIdPromise = _fetchDocument(worker, fetchDocParams);\n const networkStreamPromise = new Promise(function (resolve) {\n let networkStream;\n if (rangeTransport) {\n networkStream = new PDFDataTransportStream(\n {\n length,\n initialData: rangeTransport.initialData,\n progressiveDone: rangeTransport.progressiveDone,\n contentDispositionFilename:\n rangeTransport.contentDispositionFilename,\n disableRange,\n disableStream,\n },\n rangeTransport\n );\n } else if (!data) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: createPDFNetworkStream\");\n }\n networkStream = createPDFNetworkStream({\n url,\n length,\n httpHeaders,\n withCredentials,\n rangeChunkSize,\n disableRange,\n disableStream,\n });\n }\n resolve(networkStream);\n });\n\n return Promise.all([workerIdPromise, networkStreamPromise]).then(\n function ([workerId, networkStream]) {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const messageHandler = new MessageHandler(\n docId,\n workerId,\n worker.port\n );\n const transport = new WorkerTransport(\n messageHandler,\n task,\n networkStream,\n transportParams,\n transportFactory\n );\n task._transport = transport;\n messageHandler.send(\"Ready\", null);\n }\n );\n })\n .catch(task._capability.reject);\n\n return task;\n}\n\n/**\n * Starts fetching of specified PDF document/data.\n *\n * @param {PDFWorker} worker\n * @param {Object} source\n * @returns {Promise} A promise that is resolved when the worker ID of\n * the `MessageHandler` is known.\n * @private\n */\nasync function _fetchDocument(worker, source) {\n if (worker.destroyed) {\n throw new Error(\"Worker was destroyed\");\n }\n const workerId = await worker.messageHandler.sendWithPromise(\n \"GetDocRequest\",\n source,\n source.data ? [source.data.buffer] : null\n );\n\n if (worker.destroyed) {\n throw new Error(\"Worker was destroyed\");\n }\n return workerId;\n}\n\nfunction getUrlProp(val) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return null; // The 'url' is unused with `PDFDataRangeTransport`.\n }\n if (val instanceof URL) {\n return val.href;\n }\n try {\n // The full path is required in the 'url' field.\n return new URL(val, window.location).href;\n } catch (ex) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC\") &&\n isNodeJS &&\n typeof val === \"string\"\n ) {\n return val; // Use the url as-is in Node.js environments.\n }\n }\n throw new Error(\n \"Invalid PDF url data: \" +\n \"either string or URL-object is expected in the url property.\"\n );\n}\n\nfunction getDataProp(val) {\n // Converting string or array-like data to Uint8Array.\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC\") &&\n isNodeJS &&\n typeof Buffer !== \"undefined\" && // eslint-disable-line no-undef\n val instanceof Buffer // eslint-disable-line no-undef\n ) {\n deprecated(\n \"Please provide binary data as `Uint8Array`, rather than `Buffer`.\"\n );\n return new Uint8Array(val);\n }\n if (val instanceof Uint8Array && val.byteLength === val.buffer.byteLength) {\n // Use the data as-is when it's already a Uint8Array that completely\n // \"utilizes\" its underlying ArrayBuffer, to prevent any possible\n // issues when transferring it to the worker-thread.\n return val;\n }\n if (typeof val === \"string\") {\n return stringToBytes(val);\n }\n if ((typeof val === \"object\" && !isNaN(val?.length)) || isArrayBuffer(val)) {\n return new Uint8Array(val);\n }\n throw new Error(\n \"Invalid PDF binary data: either TypedArray, \" +\n \"string, or array-like object is expected in the data property.\"\n );\n}\n\n/**\n * @typedef {Object} OnProgressParameters\n * @property {number} loaded - Currently loaded number of bytes.\n * @property {number} total - Total number of bytes in the PDF file.\n */\n\n/**\n * The loading task controls the operations required to load a PDF document\n * (such as network requests) and provides a way to listen for completion,\n * after which individual pages can be rendered.\n */\nclass PDFDocumentLoadingTask {\n static #docId = 0;\n\n constructor() {\n this._capability = new PromiseCapability();\n this._transport = null;\n this._worker = null;\n\n /**\n * Unique identifier for the document loading task.\n * @type {string}\n */\n this.docId = `d${PDFDocumentLoadingTask.#docId++}`;\n\n /**\n * Whether the loading task is destroyed or not.\n * @type {boolean}\n */\n this.destroyed = false;\n\n /**\n * Callback to request a password if a wrong or no password was provided.\n * The callback receives two parameters: a function that should be called\n * with the new password, and a reason (see {@link PasswordResponses}).\n * @type {function}\n */\n this.onPassword = null;\n\n /**\n * Callback to be able to monitor the loading progress of the PDF file\n * (necessary to implement e.g. a loading bar).\n * The callback receives an {@link OnProgressParameters} argument.\n * @type {function}\n */\n this.onProgress = null;\n }\n\n /**\n * Promise for document loading task completion.\n * @type {Promise}\n */\n get promise() {\n return this._capability.promise;\n }\n\n /**\n * Abort all network requests and destroy the worker.\n * @returns {Promise} A promise that is resolved when destruction is\n * completed.\n */\n async destroy() {\n this.destroyed = true;\n await this._transport?.destroy();\n\n this._transport = null;\n if (this._worker) {\n this._worker.destroy();\n this._worker = null;\n }\n }\n}\n\n/**\n * Abstract class to support range requests file loading.\n *\n * NOTE: The TypedArrays passed to the constructor and relevant methods below\n * will generally be transferred to the worker-thread. This will help reduce\n * main-thread memory usage, however it will take ownership of the TypedArrays.\n */\nclass PDFDataRangeTransport {\n /**\n * @param {number} length\n * @param {Uint8Array|null} initialData\n * @param {boolean} [progressiveDone]\n * @param {string} [contentDispositionFilename]\n */\n constructor(\n length,\n initialData,\n progressiveDone = false,\n contentDispositionFilename = null\n ) {\n this.length = length;\n this.initialData = initialData;\n this.progressiveDone = progressiveDone;\n this.contentDispositionFilename = contentDispositionFilename;\n\n this._rangeListeners = [];\n this._progressListeners = [];\n this._progressiveReadListeners = [];\n this._progressiveDoneListeners = [];\n this._readyCapability = new PromiseCapability();\n }\n\n /**\n * @param {function} listener\n */\n addRangeListener(listener) {\n this._rangeListeners.push(listener);\n }\n\n /**\n * @param {function} listener\n */\n addProgressListener(listener) {\n this._progressListeners.push(listener);\n }\n\n /**\n * @param {function} listener\n */\n addProgressiveReadListener(listener) {\n this._progressiveReadListeners.push(listener);\n }\n\n /**\n * @param {function} listener\n */\n addProgressiveDoneListener(listener) {\n this._progressiveDoneListeners.push(listener);\n }\n\n /**\n * @param {number} begin\n * @param {Uint8Array|null} chunk\n */\n onDataRange(begin, chunk) {\n for (const listener of this._rangeListeners) {\n listener(begin, chunk);\n }\n }\n\n /**\n * @param {number} loaded\n * @param {number|undefined} total\n */\n onDataProgress(loaded, total) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressListeners) {\n listener(loaded, total);\n }\n });\n }\n\n /**\n * @param {Uint8Array|null} chunk\n */\n onDataProgressiveRead(chunk) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveReadListeners) {\n listener(chunk);\n }\n });\n }\n\n onDataProgressiveDone() {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveDoneListeners) {\n listener();\n }\n });\n }\n\n transportReady() {\n this._readyCapability.resolve();\n }\n\n /**\n * @param {number} begin\n * @param {number} end\n */\n requestDataRange(begin, end) {\n unreachable(\"Abstract method PDFDataRangeTransport.requestDataRange\");\n }\n\n abort() {}\n}\n\n/**\n * Proxy to a `PDFDocument` in the worker thread.\n */\nclass PDFDocumentProxy {\n constructor(pdfInfo, transport) {\n this._pdfInfo = pdfInfo;\n this._transport = transport;\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n // For testing purposes.\n Object.defineProperty(this, \"getXFADatasets\", {\n value: () => {\n return this._transport.getXFADatasets();\n },\n });\n Object.defineProperty(this, \"getXRefPrevValue\", {\n value: () => {\n return this._transport.getXRefPrevValue();\n },\n });\n }\n }\n\n /**\n * @type {AnnotationStorage} Storage for annotation data in forms.\n */\n get annotationStorage() {\n return this._transport.annotationStorage;\n }\n\n /**\n * @type {Object} The filter factory instance.\n */\n get filterFactory() {\n return this._transport.filterFactory;\n }\n\n /**\n * @type {number} Total number of pages in the PDF file.\n */\n get numPages() {\n return this._pdfInfo.numPages;\n }\n\n /**\n * @type {Array} A (not guaranteed to be) unique ID to\n * identify the PDF document.\n * NOTE: The first element will always be defined for all PDF documents,\n * whereas the second element is only defined for *modified* PDF documents.\n */\n get fingerprints() {\n return this._pdfInfo.fingerprints;\n }\n\n /**\n * @type {boolean} True if only XFA form.\n */\n get isPureXfa() {\n return shadow(this, \"isPureXfa\", !!this._transport._htmlForXfa);\n }\n\n /**\n * NOTE: This is (mostly) intended to support printing of XFA forms.\n *\n * @type {Object | null} An object representing a HTML tree structure\n * to render the XFA, or `null` when no XFA form exists.\n */\n get allXfaHtml() {\n return this._transport._htmlForXfa;\n }\n\n /**\n * @param {number} pageNumber - The page number to get. The first page is 1.\n * @returns {Promise} A promise that is resolved with\n * a {@link PDFPageProxy} object.\n */\n getPage(pageNumber) {\n return this._transport.getPage(pageNumber);\n }\n\n /**\n * @param {RefProxy} ref - The page reference.\n * @returns {Promise} A promise that is resolved with the page index,\n * starting from zero, that is associated with the reference.\n */\n getPageIndex(ref) {\n return this._transport.getPageIndex(ref);\n }\n\n /**\n * @returns {Promise