2
0

pdf.min.js 574 KB

12345678910111213141516171819202122
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. !function webpackUniversalModuleDefinition(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],r):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=r():t["pdfjs-dist/build/pdf"]=t.pdfjsLib=r()}(globalThis,(()=>(()=>{var __webpack_modules__=[,(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.VerbosityLevel=r.Util=r.UnknownErrorException=r.UnexpectedResponseException=r.UNSUPPORTED_FEATURES=r.TextRenderingMode=r.StreamType=r.RenderingIntentFlag=r.PermissionFlag=r.PasswordResponses=r.PasswordException=r.PageActionEventType=r.OPS=r.MissingPDFException=r.LINE_FACTOR=r.LINE_DESCENT_FACTOR=r.InvalidPDFException=r.ImageKind=r.IDENTITY_MATRIX=r.FormatError=r.FontType=r.FeatureTest=r.FONT_IDENTITY_MATRIX=r.DocumentActionEventType=r.CMapCompressionType=r.BaseException=r.AnnotationType=r.AnnotationStateModelType=r.AnnotationReviewState=r.AnnotationReplyType=r.AnnotationMode=r.AnnotationMarkedState=r.AnnotationFlag=r.AnnotationFieldFlag=r.AnnotationEditorType=r.AnnotationEditorPrefix=r.AnnotationEditorParamsType=r.AnnotationBorderStyleType=r.AnnotationActionEventType=r.AbortException=void 0;r.arrayByteLength=arrayByteLength;r.arraysToBytes=function arraysToBytes(t){var r=t.length;if(1===r&&t[0]instanceof Uint8Array)return t[0];for(var a=0,i=0;i<r;i++)a+=arrayByteLength(t[i]);for(var o=0,l=new Uint8Array(a),c=0;c<r;c++){var u=t[c];u instanceof Uint8Array||(u="string"==typeof u?stringToBytes(u):new Uint8Array(u));var d=u.byteLength;l.set(u,o);o+=d}return l};r.assert=function assert(t,r){t||unreachable(r)};r.bytesToString=function bytesToString(t){"object"===_typeof(t)&&null!==t&&void 0!==t.length||unreachable("Invalid argument for bytesToString");var r=t.length,a=8192;if(r<a)return String.fromCharCode.apply(null,t);for(var i=[],o=0;o<r;o+=a){var l=Math.min(o+a,r),c=t.subarray(o,l);i.push(String.fromCharCode.apply(null,c))}return i.join("")};r.createPromiseCapability=function createPromiseCapability(){var t=Object.create(null),r=!1;Object.defineProperty(t,"settled",{get:function get(){return r}});t.promise=new Promise((function(a,i){t.resolve=function(t){r=!0;a(t)};t.reject=function(t){r=!0;i(t)}}));return t};r.createValidAbsoluteUrl=function createValidAbsoluteUrl(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(a&&"string"==typeof t){if(a.addDefaultProtocol&&t.startsWith("www.")){var i=t.match(/\./g);i&&i.length>=2&&(t="http://".concat(t))}if(a.tryConvertEncoding)try{t=stringToUTF8String(t)}catch(t){}}var o=r?new URL(t,r):new URL(t);if(_isValidProtocol(o))return o}catch(t){}return null};r.escapeString=function escapeString(t){return t.replace(/([()\\\n\r])/g,(function(t){return"\n"===t?"\\n":"\r"===t?"\\r":"\\".concat(t)}))};r.getModificationDate=function getModificationDate(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,r=[t.getUTCFullYear().toString(),(t.getUTCMonth()+1).toString().padStart(2,"0"),t.getUTCDate().toString().padStart(2,"0"),t.getUTCHours().toString().padStart(2,"0"),t.getUTCMinutes().toString().padStart(2,"0"),t.getUTCSeconds().toString().padStart(2,"0")];return r.join("")};r.getVerbosityLevel=function getVerbosityLevel(){return o};r.info=function info(t){o>=i.INFOS&&console.log("Info: ".concat(t))};r.isArrayBuffer=function isArrayBuffer(t){return"object"===_typeof(t)&&null!==t&&void 0!==t.byteLength};r.isArrayEqual=function isArrayEqual(t,r){if(t.length!==r.length)return!1;for(var a=0,i=t.length;a<i;a++)if(t[a]!==r[a])return!1;return!0};r.isAscii=function isAscii(t){return/^[\x00-\x7F]*$/.test(t)};r.objectFromMap=function objectFromMap(t){var r,a=Object.create(null),i=function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}(t);try{for(i.s();!(r=i.n()).done;){var o=(u=r.value,d=2,function _arrayWithHoles(t){if(Array.isArray(t))return t}(u)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(u,d)||_unsupportedIterableToArray(u,d)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=o[0],c=o[1];a[l]=c}}catch(t){i.e(t)}finally{i.f()}var u,d;return a};r.objectSize=function objectSize(t){return Object.keys(t).length};r.setVerbosityLevel=function setVerbosityLevel(t){Number.isInteger(t)&&(o=t)};r.shadow=shadow;r.string32=function string32(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)};r.stringToBytes=stringToBytes;r.stringToPDFString=function stringToPDFString(t){if(t[0]>="ï"){var r;"þ"===t[0]&&"ÿ"===t[1]?r="utf-16be":"ÿ"===t[0]&&"þ"===t[1]?r="utf-16le":"ï"===t[0]&&"»"===t[1]&&"¿"===t[2]&&(r="utf-8");if(r)try{var a=new TextDecoder(r,{fatal:!0}),i=stringToBytes(t);return a.decode(i)}catch(t){warn('stringToPDFString: "'.concat(t,'".'))}}for(var o=[],l=0,c=t.length;l<c;l++){var u=b[t.charCodeAt(l)];o.push(u?String.fromCharCode(u):t.charAt(l))}return o.join("")};r.stringToUTF16BEString=function stringToUTF16BEString(t){for(var r=["þÿ"],a=0,i=t.length;a<i;a++){var o=t.charCodeAt(a);r.push(String.fromCharCode(o>>8&255),String.fromCharCode(255&o))}return r.join("")};r.stringToUTF8String=stringToUTF8String;r.unreachable=unreachable;r.utf8StringToString=function utf8StringToString(t){return unescape(encodeURIComponent(t))};r.warn=warn;a(2);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}r.IDENTITY_MATRIX=[1,0,0,1,0,0];r.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];r.LINE_FACTOR=1.35;r.LINE_DESCENT_FACTOR=.35;r.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};r.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};r.AnnotationEditorPrefix="pdfjs_internal_editor_";r.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};r.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};r.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};r.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};r.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};r.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};r.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};r.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};r.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};r.AnnotationReplyType={GROUP:"Group",REPLY:"R"};r.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};r.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};r.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};r.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};r.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};r.PageActionEventType={O:"PageOpen",C:"PageClose"};r.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};r.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};var i={ERRORS:0,WARNINGS:1,INFOS:5};r.VerbosityLevel=i;r.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};r.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};r.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};r.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};var o=i.WARNINGS;function warn(t){o>=i.WARNINGS&&console.log("Warning: ".concat(t))}function unreachable(t){throw new Error(t)}function _isValidProtocol(t){if(!t)return!1;switch(t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function shadow(t,r,a){Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!1});return a}var l=function BaseExceptionClosure(){function BaseException(t,r){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=t;this.name=r}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();r.BaseException=l;var c=function(t){_inherits(PasswordException,t);var r=_createSuper(PasswordException);function PasswordException(t,a){var i;_classCallCheck(this,PasswordException);(i=r.call(this,t,"PasswordException")).code=a;return i}return _createClass(PasswordException)}(l);r.PasswordException=c;var u=function(t){_inherits(UnknownErrorException,t);var r=_createSuper(UnknownErrorException);function UnknownErrorException(t,a){var i;_classCallCheck(this,UnknownErrorException);(i=r.call(this,t,"UnknownErrorException")).details=a;return i}return _createClass(UnknownErrorException)}(l);r.UnknownErrorException=u;var d=function(t){_inherits(InvalidPDFException,t);var r=_createSuper(InvalidPDFException);function InvalidPDFException(t){_classCallCheck(this,InvalidPDFException);return r.call(this,t,"InvalidPDFException")}return _createClass(InvalidPDFException)}(l);r.InvalidPDFException=d;var h=function(t){_inherits(MissingPDFException,t);var r=_createSuper(MissingPDFException);function MissingPDFException(t){_classCallCheck(this,MissingPDFException);return r.call(this,t,"MissingPDFException")}return _createClass(MissingPDFException)}(l);r.MissingPDFException=h;var p=function(t){_inherits(UnexpectedResponseException,t);var r=_createSuper(UnexpectedResponseException);function UnexpectedResponseException(t,a){var i;_classCallCheck(this,UnexpectedResponseException);(i=r.call(this,t,"UnexpectedResponseException")).status=a;return i}return _createClass(UnexpectedResponseException)}(l);r.UnexpectedResponseException=p;var v=function(t){_inherits(FormatError,t);var r=_createSuper(FormatError);function FormatError(t){_classCallCheck(this,FormatError);return r.call(this,t,"FormatError")}return _createClass(FormatError)}(l);r.FormatError=v;var y=function(t){_inherits(AbortException,t);var r=_createSuper(AbortException);function AbortException(t){_classCallCheck(this,AbortException);return r.call(this,t,"AbortException")}return _createClass(AbortException)}(l);r.AbortException=y;function stringToBytes(t){"string"!=typeof t&&unreachable("Invalid argument for stringToBytes");for(var r=t.length,a=new Uint8Array(r),i=0;i<r;++i)a[i]=255&t.charCodeAt(i);return a}function arrayByteLength(t){if(void 0!==t.length)return t.length;if(void 0!==t.byteLength)return t.byteLength;unreachable("Invalid argument for arrayByteLength")}var g=function(){function FeatureTest(){_classCallCheck(this,FeatureTest)}_createClass(FeatureTest,null,[{key:"isLittleEndian",get:function get(){return shadow(this,"isLittleEndian",function isLittleEndian(){var t=new Uint8Array(4);t[0]=1;return 1===new Uint32Array(t.buffer,0,1)[0]}())}},{key:"isEvalSupported",get:function get(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch(t){return!1}}())}},{key:"isOffscreenCanvasSupported",get:function get(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}}]);return FeatureTest}();r.FeatureTest=g;var _=_toConsumableArray(Array(256).keys()).map((function(t){return t.toString(16).padStart(2,"0")})),m=function(){function Util(){_classCallCheck(this,Util)}_createClass(Util,null,[{key:"makeHexColor",value:function makeHexColor(t,r,a){return"#".concat(_[t]).concat(_[r]).concat(_[a])}},{key:"scaleMinMax",value:function scaleMinMax(t,r){var a;if(t[0]){if(t[0]<0){a=r[0];r[0]=r[1];r[1]=a}r[0]*=t[0];r[1]*=t[0];if(t[3]<0){a=r[2];r[2]=r[3];r[3]=a}r[2]*=t[3];r[3]*=t[3]}else{a=r[0];r[0]=r[2];r[2]=a;a=r[1];r[1]=r[3];r[3]=a;if(t[1]<0){a=r[2];r[2]=r[3];r[3]=a}r[2]*=t[1];r[3]*=t[1];if(t[2]<0){a=r[0];r[0]=r[1];r[1]=a}r[0]*=t[2];r[1]*=t[2]}r[0]+=t[4];r[1]+=t[4];r[2]+=t[5];r[3]+=t[5]}},{key:"transform",value:function transform(t,r){return[t[0]*r[0]+t[2]*r[1],t[1]*r[0]+t[3]*r[1],t[0]*r[2]+t[2]*r[3],t[1]*r[2]+t[3]*r[3],t[0]*r[4]+t[2]*r[5]+t[4],t[1]*r[4]+t[3]*r[5]+t[5]]}},{key:"applyTransform",value:function applyTransform(t,r){return[t[0]*r[0]+t[1]*r[2]+r[4],t[0]*r[1]+t[1]*r[3]+r[5]]}},{key:"applyInverseTransform",value:function applyInverseTransform(t,r){var a=r[0]*r[3]-r[1]*r[2];return[(t[0]*r[3]-t[1]*r[2]+r[2]*r[5]-r[4]*r[3])/a,(-t[0]*r[1]+t[1]*r[0]+r[4]*r[1]-r[5]*r[0])/a]}},{key:"getAxialAlignedBoundingBox",value:function getAxialAlignedBoundingBox(t,r){var a=Util.applyTransform(t,r),i=Util.applyTransform(t.slice(2,4),r),o=Util.applyTransform([t[0],t[3]],r),l=Util.applyTransform([t[2],t[1]],r);return[Math.min(a[0],i[0],o[0],l[0]),Math.min(a[1],i[1],o[1],l[1]),Math.max(a[0],i[0],o[0],l[0]),Math.max(a[1],i[1],o[1],l[1])]}},{key:"inverseTransform",value:function inverseTransform(t){var r=t[0]*t[3]-t[1]*t[2];return[t[3]/r,-t[1]/r,-t[2]/r,t[0]/r,(t[2]*t[5]-t[4]*t[3])/r,(t[4]*t[1]-t[5]*t[0])/r]}},{key:"apply3dTransform",value:function apply3dTransform(t,r){return[t[0]*r[0]+t[1]*r[1]+t[2]*r[2],t[3]*r[0]+t[4]*r[1]+t[5]*r[2],t[6]*r[0]+t[7]*r[1]+t[8]*r[2]]}},{key:"singularValueDecompose2dScale",value:function singularValueDecompose2dScale(t){var r=[t[0],t[2],t[1],t[3]],a=t[0]*r[0]+t[1]*r[2],i=t[0]*r[1]+t[1]*r[3],o=t[2]*r[0]+t[3]*r[2],l=t[2]*r[1]+t[3]*r[3],c=(a+l)/2,u=Math.sqrt(Math.pow(a+l,2)-4*(a*l-o*i))/2,d=c+u||1,h=c-u||1;return[Math.sqrt(d),Math.sqrt(h)]}},{key:"normalizeRect",value:function normalizeRect(t){var r=t.slice(0);if(t[0]>t[2]){r[0]=t[2];r[2]=t[0]}if(t[1]>t[3]){r[1]=t[3];r[3]=t[1]}return r}},{key:"intersect",value:function intersect(t,r){var a=Math.max(Math.min(t[0],t[2]),Math.min(r[0],r[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(r[0],r[2]));if(a>i)return null;var o=Math.max(Math.min(t[1],t[3]),Math.min(r[1],r[3])),l=Math.min(Math.max(t[1],t[3]),Math.max(r[1],r[3]));return o>l?null:[a,o,i,l]}},{key:"bezierBoundingBox",value:function bezierBoundingBox(t,r,a,i,o,l,c,u){for(var d,h,p,v,y,g,_,m,b=[],A=[[],[]],k=0;k<2;++k){if(0===k){h=6*t-12*a+6*o;d=-3*t+9*a-9*o+3*c;p=3*a-3*t}else{h=6*r-12*i+6*l;d=-3*r+9*i-9*l+3*u;p=3*i-3*r}if(Math.abs(d)<1e-12){if(Math.abs(h)<1e-12)continue;0<(v=-p/h)&&v<1&&b.push(v)}else{_=h*h-4*p*d;m=Math.sqrt(_);if(!(_<0)){0<(y=(-h+m)/(2*d))&&y<1&&b.push(y);0<(g=(-h-m)/(2*d))&&g<1&&b.push(g)}}}for(var P,S=b.length,w=S;S--;){P=1-(v=b[S]);A[0][S]=P*P*P*t+3*P*P*v*a+3*P*v*v*o+v*v*v*c;A[1][S]=P*P*P*r+3*P*P*v*i+3*P*v*v*l+v*v*v*u}A[0][w]=t;A[1][w]=r;A[0][w+1]=c;A[1][w+1]=u;A[0].length=A[1].length=w+2;return[Math.min.apply(Math,_toConsumableArray(A[0])),Math.min.apply(Math,_toConsumableArray(A[1])),Math.max.apply(Math,_toConsumableArray(A[0])),Math.max.apply(Math,_toConsumableArray(A[1]))]}}]);return Util}();r.Util=m;var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToUTF8String(t){return decodeURIComponent(escape(t))}},(t,r,a)=>{"use strict";var i=a(3);if(!globalThis._pdfjsCompatibilityChecked){globalThis._pdfjsCompatibilityChecked=!0;!function checkNodeBtoa(){!globalThis.btoa&&i.isNodeJS&&(globalThis.btoa=function(t){return Buffer.from(t,"binary").toString("base64")})}();!function checkNodeAtob(){!globalThis.atob&&i.isNodeJS&&(globalThis.atob=function(t){return Buffer.from(t,"base64").toString("binary")})}();!function checkDOMMatrix(){!globalThis.DOMMatrix&&i.isNodeJS&&(globalThis.DOMMatrix=require("dommatrix/dist/dommatrix.js"))}();!function checkReadableStream(){!globalThis.ReadableStream&&i.isNodeJS&&(globalThis.ReadableStream=require("web-streams-polyfill/dist/ponyfill.js").ReadableStream)}();!function checkArrayAt(){Array.prototype.at||a(4)}();!function checkTypedArrayAt(){Uint8Array.prototype.at||a(76)}();!function checkStructuredClone(){globalThis.structuredClone||a(86)}()}},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.isNodeJS=void 0;function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}var a=!("object"!==("undefined"==typeof process?"undefined":_typeof(process))||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);r.isNodeJS=a},(t,r,a)=>{a(5);var i=a(75);t.exports=i("Array","at")},(t,r,a)=>{"use strict";var i=a(6),o=a(41),l=a(65),c=a(63),u=a(70);i({target:"Array",proto:!0},{at:function at(t){var r=o(this),a=l(r),i=c(t),u=i>=0?i:a+i;return u<0||u>=a?void 0:r[u]}});u("at")},(t,r,a)=>{var i=a(7),o=a(8).f,l=a(45),c=a(49),u=a(39),d=a(57),h=a(69);t.exports=function(t,r){var a,p,v,y,g,_=t.target,m=t.global,b=t.stat;if(a=m?i:b?i[_]||u(_,{}):(i[_]||{}).prototype)for(p in r){y=r[p];v=t.dontCallGetSet?(g=o(a,p))&&g.value:a[p];if(!h(m?p:_+(b?".":"#")+p,t.forced)&&void 0!==v){if(typeof y==typeof v)continue;d(y,v)}(t.sham||v&&v.sham)&&l(y,"sham",!0);c(a,p,y,t)}}},t=>{var check=function(t){return t&&t.Math==Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||Function("return this")()},(t,r,a)=>{var i=a(9),o=a(11),l=a(13),c=a(14),u=a(15),d=a(20),h=a(40),p=a(43),v=Object.getOwnPropertyDescriptor;r.f=i?v:function getOwnPropertyDescriptor(t,r){t=u(t);r=d(r);if(p)try{return v(t,r)}catch(t){}if(h(t,r))return c(!o(l.f,t,r),t[r])}},(t,r,a)=>{var i=a(10);t.exports=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},(t,r,a)=>{var i=a(12),o=Function.prototype.call;t.exports=i?o.bind(o):function(){return o.apply(o,arguments)}},(t,r,a)=>{var i=a(10);t.exports=!i((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},(t,r)=>{"use strict";var a={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,o=i&&!a.call({1:2},1);r.f=o?function propertyIsEnumerable(t){var r=i(this,t);return!!r&&r.enumerable}:a},t=>{t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},(t,r,a)=>{var i=a(16),o=a(19);t.exports=function(t){return i(o(t))}},(t,r,a)=>{var i=a(17),o=a(10),l=a(18),c=Object,u=i("".split);t.exports=o((function(){return!c("z").propertyIsEnumerable(0)}))?function(t){return"String"==l(t)?u(t,""):c(t)}:c},(t,r,a)=>{var i=a(12),o=Function.prototype,l=o.bind,c=o.call,u=i&&l.bind(c,c);t.exports=i?function(t){return t&&u(t)}:function(t){return t&&function(){return c.apply(t,arguments)}}},(t,r,a)=>{var i=a(17),o=i({}.toString),l=i("".slice);t.exports=function(t){return l(o(t),8,-1)}},t=>{var r=TypeError;t.exports=function(t){if(null==t)throw r("Can't call method on "+t);return t}},(t,r,a)=>{var i=a(21),o=a(24);t.exports=function(t){var r=i(t,"string");return o(r)?r:r+""}},(t,r,a)=>{var i=a(11),o=a(22),l=a(24),c=a(31),u=a(34),d=a(35),h=TypeError,p=d("toPrimitive");t.exports=function(t,r){if(!o(t)||l(t))return t;var a,d=c(t,p);if(d){void 0===r&&(r="default");a=i(d,t,r);if(!o(a)||l(a))return a;throw h("Can't convert object to primitive value")}void 0===r&&(r="number");return u(t,r)}},(t,r,a)=>{var i=a(23);t.exports=function(t){return"object"==typeof t?null!==t:i(t)}},t=>{t.exports=function(t){return"function"==typeof t}},(t,r,a)=>{var i=a(25),o=a(23),l=a(26),c=a(27),u=Object;t.exports=c?function(t){return"symbol"==typeof t}:function(t){var r=i("Symbol");return o(r)&&l(r.prototype,u(t))}},(t,r,a)=>{var i=a(7),o=a(23),aFunction=function(t){return o(t)?t:void 0};t.exports=function(t,r){return arguments.length<2?aFunction(i[t]):i[t]&&i[t][r]}},(t,r,a)=>{var i=a(17);t.exports=i({}.isPrototypeOf)},(t,r,a)=>{var i=a(28);t.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(t,r,a)=>{var i=a(29),o=a(10);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},(t,r,a)=>{var i,o,l=a(7),c=a(30),u=l.process,d=l.Deno,h=u&&u.versions||d&&d.version,p=h&&h.v8;p&&(o=(i=p.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1]));!o&&c&&(!(i=c.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=c.match(/Chrome\/(\d+)/))&&(o=+i[1]);t.exports=o},(t,r,a)=>{var i=a(25);t.exports=i("navigator","userAgent")||""},(t,r,a)=>{var i=a(32);t.exports=function(t,r){var a=t[r];return null==a?void 0:i(a)}},(t,r,a)=>{var i=a(23),o=a(33),l=TypeError;t.exports=function(t){if(i(t))return t;throw l(o(t)+" is not a function")}},t=>{var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},(t,r,a)=>{var i=a(11),o=a(23),l=a(22),c=TypeError;t.exports=function(t,r){var a,u;if("string"===r&&o(a=t.toString)&&!l(u=i(a,t)))return u;if(o(a=t.valueOf)&&!l(u=i(a,t)))return u;if("string"!==r&&o(a=t.toString)&&!l(u=i(a,t)))return u;throw c("Can't convert object to primitive value")}},(t,r,a)=>{var i=a(7),o=a(36),l=a(40),c=a(42),u=a(28),d=a(27),h=o("wks"),p=i.Symbol,v=p&&p.for,y=d?p:p&&p.withoutSetter||c;t.exports=function(t){if(!l(h,t)||!u&&"string"!=typeof h[t]){var r="Symbol."+t;u&&l(p,t)?h[t]=p[t]:h[t]=d&&v?v(r):y(r)}return h[t]}},(t,r,a)=>{var i=a(37),o=a(38);(t.exports=function(t,r){return o[t]||(o[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.23.5",mode:i?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.23.5/LICENSE",source:"https://github.com/zloirock/core-js"})},t=>{t.exports=!1},(t,r,a)=>{var i=a(7),o=a(39),l="__core-js_shared__",c=i[l]||o(l,{});t.exports=c},(t,r,a)=>{var i=a(7),o=Object.defineProperty;t.exports=function(t,r){try{o(i,t,{value:r,configurable:!0,writable:!0})}catch(a){i[t]=r}return r}},(t,r,a)=>{var i=a(17),o=a(41),l=i({}.hasOwnProperty);t.exports=Object.hasOwn||function hasOwn(t,r){return l(o(t),r)}},(t,r,a)=>{var i=a(19),o=Object;t.exports=function(t){return o(i(t))}},(t,r,a)=>{var i=a(17),o=0,l=Math.random(),c=i(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+c(++o+l,36)}},(t,r,a)=>{var i=a(9),o=a(10),l=a(44);t.exports=!i&&!o((function(){return 7!=Object.defineProperty(l("div"),"a",{get:function(){return 7}}).a}))},(t,r,a)=>{var i=a(7),o=a(22),l=i.document,c=o(l)&&o(l.createElement);t.exports=function(t){return c?l.createElement(t):{}}},(t,r,a)=>{var i=a(9),o=a(46),l=a(14);t.exports=i?function(t,r,a){return o.f(t,r,l(1,a))}:function(t,r,a){t[r]=a;return t}},(t,r,a)=>{var i=a(9),o=a(43),l=a(47),c=a(48),u=a(20),d=TypeError,h=Object.defineProperty,p=Object.getOwnPropertyDescriptor,v="enumerable",y="configurable",g="writable";r.f=i?l?function defineProperty(t,r,a){c(t);r=u(r);c(a);if("function"==typeof t&&"prototype"===r&&"value"in a&&g in a&&!a.writable){var i=p(t,r);if(i&&i.writable){t[r]=a.value;a={configurable:y in a?a.configurable:i.configurable,enumerable:v in a?a.enumerable:i.enumerable,writable:!1}}}return h(t,r,a)}:h:function defineProperty(t,r,a){c(t);r=u(r);c(a);if(o)try{return h(t,r,a)}catch(t){}if("get"in a||"set"in a)throw d("Accessors not supported");"value"in a&&(t[r]=a.value);return t}},(t,r,a)=>{var i=a(9),o=a(10);t.exports=i&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},(t,r,a)=>{var i=a(22),o=String,l=TypeError;t.exports=function(t){if(i(t))return t;throw l(o(t)+" is not an object")}},(t,r,a)=>{var i=a(23),o=a(46),l=a(50),c=a(39);t.exports=function(t,r,a,u){u||(u={});var d=u.enumerable,h=void 0!==u.name?u.name:r;i(a)&&l(a,h,u);if(u.global)d?t[r]=a:c(r,a);else{try{u.unsafe?t[r]&&(d=!0):delete t[r]}catch(t){}d?t[r]=a:o.f(t,r,{value:a,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return t}},(t,r,a)=>{var i=a(10),o=a(23),l=a(40),c=a(9),u=a(51).CONFIGURABLE,d=a(52),h=a(53),p=h.enforce,v=h.get,y=Object.defineProperty,g=c&&!i((function(){return 8!==y((function(){}),"length",{value:8}).length})),_=String(String).split("String"),m=t.exports=function(t,r,a){"Symbol("===String(r).slice(0,7)&&(r="["+String(r).replace(/^Symbol\(([^)]*)\)/,"$1")+"]");a&&a.getter&&(r="get "+r);a&&a.setter&&(r="set "+r);(!l(t,"name")||u&&t.name!==r)&&(c?y(t,"name",{value:r,configurable:!0}):t.name=r);g&&a&&l(a,"arity")&&t.length!==a.arity&&y(t,"length",{value:a.arity});try{a&&l(a,"constructor")&&a.constructor?c&&y(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var i=p(t);l(i,"source")||(i.source=_.join("string"==typeof r?r:""));return t};Function.prototype.toString=m((function toString(){return o(this)&&v(this).source||d(this)}),"toString")},(t,r,a)=>{var i=a(9),o=a(40),l=Function.prototype,c=i&&Object.getOwnPropertyDescriptor,u=o(l,"name"),d=u&&"something"===function something(){}.name,h=u&&(!i||i&&c(l,"name").configurable);t.exports={EXISTS:u,PROPER:d,CONFIGURABLE:h}},(t,r,a)=>{var i=a(17),o=a(23),l=a(38),c=i(Function.toString);o(l.inspectSource)||(l.inspectSource=function(t){return c(t)});t.exports=l.inspectSource},(t,r,a)=>{var i,o,l,c=a(54),u=a(7),d=a(17),h=a(22),p=a(45),v=a(40),y=a(38),g=a(55),_=a(56),m="Object already initialized",b=u.TypeError,A=u.WeakMap;if(c||y.state){var k=y.state||(y.state=new A),P=d(k.get),S=d(k.has),w=d(k.set);i=function(t,r){if(S(k,t))throw new b(m);r.facade=t;w(k,t,r);return r};o=function(t){return P(k,t)||{}};l=function(t){return S(k,t)}}else{var x=g("state");_[x]=!0;i=function(t,r){if(v(t,x))throw new b(m);r.facade=t;p(t,x,r);return r};o=function(t){return v(t,x)?t[x]:{}};l=function(t){return v(t,x)}}t.exports={set:i,get:o,has:l,enforce:function(t){return l(t)?o(t):i(t,{})},getterFor:function(t){return function(r){var a;if(!h(r)||(a=o(r)).type!==t)throw b("Incompatible receiver, "+t+" required");return a}}}},(t,r,a)=>{var i=a(7),o=a(23),l=a(52),c=i.WeakMap;t.exports=o(c)&&/native code/.test(l(c))},(t,r,a)=>{var i=a(36),o=a(42),l=i("keys");t.exports=function(t){return l[t]||(l[t]=o(t))}},t=>{t.exports={}},(t,r,a)=>{var i=a(40),o=a(58),l=a(8),c=a(46);t.exports=function(t,r,a){for(var u=o(r),d=c.f,h=l.f,p=0;p<u.length;p++){var v=u[p];i(t,v)||a&&i(a,v)||d(t,v,h(r,v))}}},(t,r,a)=>{var i=a(25),o=a(17),l=a(59),c=a(68),u=a(48),d=o([].concat);t.exports=i("Reflect","ownKeys")||function ownKeys(t){var r=l.f(u(t)),a=c.f;return a?d(r,a(t)):r}},(t,r,a)=>{var i=a(60),o=a(67).concat("length","prototype");r.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return i(t,o)}},(t,r,a)=>{var i=a(17),o=a(40),l=a(15),c=a(61).indexOf,u=a(56),d=i([].push);t.exports=function(t,r){var a,i=l(t),h=0,p=[];for(a in i)!o(u,a)&&o(i,a)&&d(p,a);for(;r.length>h;)o(i,a=r[h++])&&(~c(p,a)||d(p,a));return p}},(t,r,a)=>{var i=a(15),o=a(62),l=a(65),createMethod=function(t){return function(r,a,c){var u,d=i(r),h=l(d),p=o(c,h);if(t&&a!=a){for(;h>p;)if((u=d[p++])!=u)return!0}else for(;h>p;p++)if((t||p in d)&&d[p]===a)return t||p||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},(t,r,a)=>{var i=a(63),o=Math.max,l=Math.min;t.exports=function(t,r){var a=i(t);return a<0?o(a+r,0):l(a,r)}},(t,r,a)=>{var i=a(64);t.exports=function(t){var r=+t;return r!=r||0===r?0:i(r)}},t=>{var r=Math.ceil,a=Math.floor;t.exports=Math.trunc||function trunc(t){var i=+t;return(i>0?a:r)(i)}},(t,r,a)=>{var i=a(66);t.exports=function(t){return i(t.length)}},(t,r,a)=>{var i=a(63),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(t,r)=>{r.f=Object.getOwnPropertySymbols},(t,r,a)=>{var i=a(10),o=a(23),l=/#|\.prototype\./,isForced=function(t,r){var a=u[c(t)];return a==h||a!=d&&(o(r)?i(r):!!r)},c=isForced.normalize=function(t){return String(t).replace(l,".").toLowerCase()},u=isForced.data={},d=isForced.NATIVE="N",h=isForced.POLYFILL="P";t.exports=isForced},(t,r,a)=>{var i=a(35),o=a(71),l=a(46).f,c=i("unscopables"),u=Array.prototype;null==u[c]&&l(u,c,{configurable:!0,value:o(null)});t.exports=function(t){u[c][t]=!0}},(t,r,a)=>{var i,o=a(48),l=a(72),c=a(67),u=a(56),d=a(74),h=a(44),p=a(55),v=p("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"</"+"script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag(""));t.close();var r=t.parentWindow.Object;t=null;return r},NullProtoObject=function(){try{i=new ActiveXObject("htmlfile")}catch(t){}NullProtoObject="undefined"!=typeof document?document.domain&&i?NullProtoObjectViaActiveX(i):function(){var t,r=h("iframe");r.style.display="none";d.appendChild(r);r.src=String("javascript:");(t=r.contentWindow.document).open();t.write(scriptTag("document.F=Object"));t.close();return t.F}():NullProtoObjectViaActiveX(i);for(var t=c.length;t--;)delete NullProtoObject.prototype[c[t]];return NullProtoObject()};u[v]=!0;t.exports=Object.create||function create(t,r){var a;if(null!==t){EmptyConstructor.prototype=o(t);a=new EmptyConstructor;EmptyConstructor.prototype=null;a[v]=t}else a=NullProtoObject();return void 0===r?a:l.f(a,r)}},(t,r,a)=>{var i=a(9),o=a(47),l=a(46),c=a(48),u=a(15),d=a(73);r.f=i&&!o?Object.defineProperties:function defineProperties(t,r){c(t);for(var a,i=u(r),o=d(r),h=o.length,p=0;h>p;)l.f(t,a=o[p++],i[a]);return t}},(t,r,a)=>{var i=a(60),o=a(67);t.exports=Object.keys||function keys(t){return i(t,o)}},(t,r,a)=>{var i=a(25);t.exports=i("document","documentElement")},(t,r,a)=>{var i=a(7),o=a(17);t.exports=function(t,r){return o(i[t].prototype[r])}},(t,r,a)=>{a(77)},(t,r,a)=>{"use strict";var i=a(78),o=a(65),l=a(63),c=i.aTypedArray;(0,i.exportTypedArrayMethod)("at",(function at(t){var r=c(this),a=o(r),i=l(t),u=i>=0?i:a+i;return u<0||u>=a?void 0:r[u]}))},(t,r,a)=>{"use strict";var i,o,l,c=a(79),u=a(9),d=a(7),h=a(23),p=a(22),v=a(40),y=a(80),g=a(33),_=a(45),m=a(49),b=a(46).f,A=a(26),k=a(82),P=a(84),S=a(35),w=a(42),x=a(53),C=x.enforce,T=x.get,E=d.Int8Array,I=E&&E.prototype,O=d.Uint8ClampedArray,M=O&&O.prototype,R=E&&k(E),D=I&&k(I),L=Object.prototype,G=d.TypeError,j=S("toStringTag"),N=w("TYPED_ARRAY_TAG"),B="TypedArrayConstructor",W=c&&!!P&&"Opera"!==y(d.opera),U=!1,H={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},z={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(t){var r=k(t);if(p(r)){var a=T(r);return a&&v(a,B)?a.TypedArrayConstructor:getTypedArrayConstructor(r)}},isTypedArray=function(t){if(!p(t))return!1;var r=y(t);return v(H,r)||v(z,r)};for(i in H)(l=(o=d[i])&&o.prototype)?C(l).TypedArrayConstructor=o:W=!1;for(i in z)(l=(o=d[i])&&o.prototype)&&(C(l).TypedArrayConstructor=o);if(!W||!h(R)||R===Function.prototype){R=function TypedArray(){throw G("Incorrect invocation")};if(W)for(i in H)d[i]&&P(d[i],R)}if(!W||!D||D===L){D=R.prototype;if(W)for(i in H)d[i]&&P(d[i].prototype,D)}W&&k(M)!==D&&P(M,D);if(u&&!v(D,j)){U=!0;b(D,j,{get:function(){return p(this)?this[N]:void 0}});for(i in H)d[i]&&_(d[i],N,i)}t.exports={NATIVE_ARRAY_BUFFER_VIEWS:W,TYPED_ARRAY_TAG:U&&N,aTypedArray:function(t){if(isTypedArray(t))return t;throw G("Target is not a typed array")},aTypedArrayConstructor:function(t){if(h(t)&&(!P||A(R,t)))return t;throw G(g(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,r,a,i){if(u){if(a)for(var o in H){var l=d[o];if(l&&v(l.prototype,t))try{delete l.prototype[t]}catch(a){try{l.prototype[t]=r}catch(t){}}}D[t]&&!a||m(D,t,a?r:W&&I[t]||r,i)}},exportTypedArrayStaticMethod:function(t,r,a){var i,o;if(u){if(P){if(a)for(i in H)if((o=d[i])&&v(o,t))try{delete o[t]}catch(t){}if(R[t]&&!a)return;try{return m(R,t,a?r:W&&R[t]||r)}catch(t){}}for(i in H)!(o=d[i])||o[t]&&!a||m(o,t,r)}},getTypedArrayConstructor:getTypedArrayConstructor,isView:function isView(t){if(!p(t))return!1;var r=y(t);return"DataView"===r||v(H,r)||v(z,r)},isTypedArray:isTypedArray,TypedArray:R,TypedArrayPrototype:D}},t=>{t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},(t,r,a)=>{var i=a(81),o=a(23),l=a(18),c=a(35)("toStringTag"),u=Object,d="Arguments"==l(function(){return arguments}());t.exports=i?l:function(t){var r,a,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(a=function(t,r){try{return t[r]}catch(t){}}(r=u(t),c))?a:d?l(r):"Object"==(i=l(r))&&o(r.callee)?"Arguments":i}},(t,r,a)=>{var i={};i[a(35)("toStringTag")]="z";t.exports="[object z]"===String(i)},(t,r,a)=>{var i=a(40),o=a(23),l=a(41),c=a(55),u=a(83),d=c("IE_PROTO"),h=Object,p=h.prototype;t.exports=u?h.getPrototypeOf:function(t){var r=l(t);if(i(r,d))return r[d];var a=r.constructor;return o(a)&&r instanceof a?a.prototype:r instanceof h?p:null}},(t,r,a)=>{var i=a(10);t.exports=!i((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},(t,r,a)=>{var i=a(17),o=a(48),l=a(85);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,a={};try{(t=i(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(a,[]);r=a instanceof Array}catch(t){}return function setPrototypeOf(a,i){o(a);l(i);r?t(a,i):a.__proto__=i;return a}}():void 0)},(t,r,a)=>{var i=a(23),o=String,l=TypeError;t.exports=function(t){if("object"==typeof t||i(t))return t;throw l("Can't set "+o(t)+" as a prototype")}},(t,r,a)=>{a(87);a(93);a(95);a(117);a(119);var i=a(128);t.exports=i.structuredClone},(t,r,a)=>{"use strict";var i=a(15),o=a(70),l=a(88),c=a(53),u=a(46).f,d=a(89),h=a(37),p=a(9),v="Array Iterator",y=c.set,g=c.getterFor(v);t.exports=d(Array,"Array",(function(t,r){y(this,{type:v,target:i(t),index:0,kind:r})}),(function(){var t=g(this),r=t.target,a=t.kind,i=t.index++;if(!r||i>=r.length){t.target=void 0;return{value:void 0,done:!0}}return"keys"==a?{value:i,done:!1}:"values"==a?{value:r[i],done:!1}:{value:[i,r[i]],done:!1}}),"values");var _=l.Arguments=l.Array;o("keys");o("values");o("entries");if(!h&&p&&"values"!==_.name)try{u(_,"name",{value:"values"})}catch(t){}},t=>{t.exports={}},(t,r,a)=>{"use strict";var i=a(6),o=a(11),l=a(37),c=a(51),u=a(23),d=a(90),h=a(82),p=a(84),v=a(92),y=a(45),g=a(49),_=a(35),m=a(88),b=a(91),A=c.PROPER,k=c.CONFIGURABLE,P=b.IteratorPrototype,S=b.BUGGY_SAFARI_ITERATORS,w=_("iterator"),x="keys",C="values",T="entries",returnThis=function(){return this};t.exports=function(t,r,a,c,_,b,E){d(a,r,c);var I,O,M,getIterationMethod=function(t){if(t===_&&j)return j;if(!S&&t in L)return L[t];switch(t){case x:return function keys(){return new a(this,t)};case C:return function values(){return new a(this,t)};case T:return function entries(){return new a(this,t)}}return function(){return new a(this)}},R=r+" Iterator",D=!1,L=t.prototype,G=L[w]||L["@@iterator"]||_&&L[_],j=!S&&G||getIterationMethod(_),N="Array"==r&&L.entries||G;if(N&&(I=h(N.call(new t)))!==Object.prototype&&I.next){l||h(I)===P||(p?p(I,P):u(I[w])||g(I,w,returnThis));v(I,R,!0,!0);l&&(m[R]=returnThis)}if(A&&_==C&&G&&G.name!==C)if(!l&&k)y(L,"name",C);else{D=!0;j=function values(){return o(G,this)}}if(_){O={values:getIterationMethod(C),keys:b?j:getIterationMethod(x),entries:getIterationMethod(T)};if(E)for(M in O)(S||D||!(M in L))&&g(L,M,O[M]);else i({target:r,proto:!0,forced:S||D},O)}l&&!E||L[w]===j||g(L,w,j,{name:_});m[r]=j;return O}},(t,r,a)=>{"use strict";var i=a(91).IteratorPrototype,o=a(71),l=a(14),c=a(92),u=a(88),returnThis=function(){return this};t.exports=function(t,r,a,d){var h=r+" Iterator";t.prototype=o(i,{next:l(+!d,a)});c(t,h,!1,!0);u[h]=returnThis;return t}},(t,r,a)=>{"use strict";var i,o,l,c=a(10),u=a(23),d=a(71),h=a(82),p=a(49),v=a(35),y=a(37),g=v("iterator"),_=!1;[].keys&&("next"in(l=[].keys())?(o=h(h(l)))!==Object.prototype&&(i=o):_=!0);null==i||c((function(){var t={};return i[g].call(t)!==t}))?i={}:y&&(i=d(i));u(i[g])||p(i,g,(function(){return this}));t.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:_}},(t,r,a)=>{var i=a(46).f,o=a(40),l=a(35)("toStringTag");t.exports=function(t,r,a){t&&!a&&(t=t.prototype);t&&!o(t,l)&&i(t,l,{configurable:!0,value:r})}},(t,r,a)=>{var i=a(81),o=a(49),l=a(94);i||o(Object.prototype,"toString",l,{unsafe:!0})},(t,r,a)=>{"use strict";var i=a(81),o=a(80);t.exports=i?{}.toString:function toString(){return"[object "+o(this)+"]"}},(t,r,a)=>{a(96)},(t,r,a)=>{"use strict";a(97)("Map",(function(t){return function Map(){return t(this,arguments.length?arguments[0]:void 0)}}),a(114))},(t,r,a)=>{"use strict";var i=a(6),o=a(7),l=a(17),c=a(69),u=a(49),d=a(98),h=a(105),p=a(111),v=a(23),y=a(22),g=a(10),_=a(112),m=a(92),b=a(113);t.exports=function(t,r,a){var A=-1!==t.indexOf("Map"),k=-1!==t.indexOf("Weak"),P=A?"set":"add",S=o[t],w=S&&S.prototype,x=S,C={},fixMethod=function(t){var r=l(w[t]);u(w,t,"add"==t?function add(t){r(this,0===t?0:t);return this}:"delete"==t?function(t){return!(k&&!y(t))&&r(this,0===t?0:t)}:"get"==t?function get(t){return k&&!y(t)?void 0:r(this,0===t?0:t)}:"has"==t?function has(t){return!(k&&!y(t))&&r(this,0===t?0:t)}:function set(t,a){r(this,0===t?0:t,a);return this})};if(c(t,!v(S)||!(k||w.forEach&&!g((function(){(new S).entries().next()}))))){x=a.getConstructor(r,t,A,P);d.enable()}else if(c(t,!0)){var T=new x,E=T[P](k?{}:-0,1)!=T,I=g((function(){T.has(1)})),O=_((function(t){new S(t)})),M=!k&&g((function(){for(var t=new S,r=5;r--;)t[P](r,r);return!t.has(-0)}));if(!O){(x=r((function(t,r){p(t,w);var a=b(new S,t,x);null!=r&&h(r,a[P],{that:a,AS_ENTRIES:A});return a}))).prototype=w;w.constructor=x}if(I||M){fixMethod("delete");fixMethod("has");A&&fixMethod("get")}(M||E)&&fixMethod(P);k&&w.clear&&delete w.clear}C[t]=x;i({global:!0,constructor:!0,forced:x!=S},C);m(x,t);k||a.setStrong(x,t,A);return x}},(t,r,a)=>{var i=a(6),o=a(17),l=a(56),c=a(22),u=a(40),d=a(46).f,h=a(59),p=a(99),v=a(102),y=a(42),g=a(104),_=!1,m=y("meta"),b=0,setMetadata=function(t){d(t,m,{value:{objectID:"O"+b++,weakData:{}}})},A=t.exports={enable:function(){A.enable=function(){};_=!0;var t=h.f,r=o([].splice),a={};a[m]=1;if(t(a).length){h.f=function(a){for(var i=t(a),o=0,l=i.length;o<l;o++)if(i[o]===m){r(i,o,1);break}return i};i({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:p.f})}},fastKey:function(t,r){if(!c(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!u(t,m)){if(!v(t))return"F";if(!r)return"E";setMetadata(t)}return t[m].objectID},getWeakData:function(t,r){if(!u(t,m)){if(!v(t))return!0;if(!r)return!1;setMetadata(t)}return t[m].weakData},onFreeze:function(t){g&&_&&v(t)&&!u(t,m)&&setMetadata(t);return t}};l[m]=!0},(t,r,a)=>{var i=a(18),o=a(15),l=a(59).f,c=a(100),u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function getOwnPropertyNames(t){return u&&"Window"==i(t)?function(t){try{return l(t)}catch(t){return c(u)}}(t):l(o(t))}},(t,r,a)=>{var i=a(62),o=a(65),l=a(101),c=Array,u=Math.max;t.exports=function(t,r,a){for(var d=o(t),h=i(r,d),p=i(void 0===a?d:a,d),v=c(u(p-h,0)),y=0;h<p;h++,y++)l(v,y,t[h]);v.length=y;return v}},(t,r,a)=>{"use strict";var i=a(20),o=a(46),l=a(14);t.exports=function(t,r,a){var c=i(r);c in t?o.f(t,c,l(0,a)):t[c]=a}},(t,r,a)=>{var i=a(10),o=a(22),l=a(18),c=a(103),u=Object.isExtensible,d=i((function(){u(1)}));t.exports=d||c?function isExtensible(t){return!!o(t)&&((!c||"ArrayBuffer"!=l(t))&&(!u||u(t)))}:u},(t,r,a)=>{var i=a(10);t.exports=i((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}))},(t,r,a)=>{var i=a(10);t.exports=!i((function(){return Object.isExtensible(Object.preventExtensions({}))}))},(t,r,a)=>{var i=a(106),o=a(11),l=a(48),c=a(33),u=a(107),d=a(65),h=a(26),p=a(108),v=a(109),y=a(110),g=TypeError,Result=function(t,r){this.stopped=t;this.result=r},_=Result.prototype;t.exports=function(t,r,a){var m,b,A,k,P,S,w,x=a&&a.that,C=!(!a||!a.AS_ENTRIES),T=!(!a||!a.IS_RECORD),E=!(!a||!a.IS_ITERATOR),I=!(!a||!a.INTERRUPTED),O=i(r,x),stop=function(t){m&&y(m,"normal",t);return new Result(!0,t)},callFn=function(t){if(C){l(t);return I?O(t[0],t[1],stop):O(t[0],t[1])}return I?O(t,stop):O(t)};if(T)m=t.iterator;else if(E)m=t;else{if(!(b=v(t)))throw g(c(t)+" is not iterable");if(u(b)){for(A=0,k=d(t);k>A;A++)if((P=callFn(t[A]))&&h(_,P))return P;return new Result(!1)}m=p(t,b)}S=T?t.next:m.next;for(;!(w=o(S,m)).done;){try{P=callFn(w.value)}catch(t){y(m,"throw",t)}if("object"==typeof P&&P&&h(_,P))return P}return new Result(!1)}},(t,r,a)=>{var i=a(17),o=a(32),l=a(12),c=i(i.bind);t.exports=function(t,r){o(t);return void 0===r?t:l?c(t,r):function(){return t.apply(r,arguments)}}},(t,r,a)=>{var i=a(35),o=a(88),l=i("iterator"),c=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||c[l]===t)}},(t,r,a)=>{var i=a(11),o=a(32),l=a(48),c=a(33),u=a(109),d=TypeError;t.exports=function(t,r){var a=arguments.length<2?u(t):r;if(o(a))return l(i(a,t));throw d(c(t)+" is not iterable")}},(t,r,a)=>{var i=a(80),o=a(31),l=a(88),c=a(35)("iterator");t.exports=function(t){if(null!=t)return o(t,c)||o(t,"@@iterator")||l[i(t)]}},(t,r,a)=>{var i=a(11),o=a(48),l=a(31);t.exports=function(t,r,a){var c,u;o(t);try{if(!(c=l(t,"return"))){if("throw"===r)throw a;return a}c=i(c,t)}catch(t){u=!0;c=t}if("throw"===r)throw a;if(u)throw c;o(c);return a}},(t,r,a)=>{var i=a(26),o=TypeError;t.exports=function(t,r){if(i(r,t))return t;throw o("Incorrect invocation")}},(t,r,a)=>{var i=a(35)("iterator"),o=!1;try{var l=0,c={next:function(){return{done:!!l++}},return:function(){o=!0}};c[i]=function(){return this};Array.from(c,(function(){throw 2}))}catch(t){}t.exports=function(t,r){if(!r&&!o)return!1;var a=!1;try{var l={};l[i]=function(){return{next:function(){return{done:a=!0}}}};t(l)}catch(t){}return a}},(t,r,a)=>{var i=a(23),o=a(22),l=a(84);t.exports=function(t,r,a){var c,u;l&&i(c=r.constructor)&&c!==a&&o(u=c.prototype)&&u!==a.prototype&&l(t,u);return t}},(t,r,a)=>{"use strict";var i=a(46).f,o=a(71),l=a(115),c=a(106),u=a(111),d=a(105),h=a(89),p=a(116),v=a(9),y=a(98).fastKey,g=a(53),_=g.set,m=g.getterFor;t.exports={getConstructor:function(t,r,a,h){var p=t((function(t,i){u(t,g);_(t,{type:r,index:o(null),first:void 0,last:void 0,size:0});v||(t.size=0);null!=i&&d(i,t[h],{that:t,AS_ENTRIES:a})})),g=p.prototype,b=m(r),define=function(t,r,a){var i,o,l=b(t),c=getEntry(t,r);if(c)c.value=a;else{l.last=c={index:o=y(r,!0),key:r,value:a,previous:i=l.last,next:void 0,removed:!1};l.first||(l.first=c);i&&(i.next=c);v?l.size++:t.size++;"F"!==o&&(l.index[o]=c)}return t},getEntry=function(t,r){var a,i=b(t),o=y(r);if("F"!==o)return i.index[o];for(a=i.first;a;a=a.next)if(a.key==r)return a};l(g,{clear:function clear(){for(var t=b(this),r=t.index,a=t.first;a;){a.removed=!0;a.previous&&(a.previous=a.previous.next=void 0);delete r[a.index];a=a.next}t.first=t.last=void 0;v?t.size=0:this.size=0},delete:function(t){var r=this,a=b(r),i=getEntry(r,t);if(i){var o=i.next,l=i.previous;delete a.index[i.index];i.removed=!0;l&&(l.next=o);o&&(o.previous=l);a.first==i&&(a.first=o);a.last==i&&(a.last=l);v?a.size--:r.size--}return!!i},forEach:function forEach(t){for(var r,a=b(this),i=c(t,arguments.length>1?arguments[1]:void 0);r=r?r.next:a.first;){i(r.value,r.key,this);for(;r&&r.removed;)r=r.previous}},has:function has(t){return!!getEntry(this,t)}});l(g,a?{get:function get(t){var r=getEntry(this,t);return r&&r.value},set:function set(t,r){return define(this,0===t?0:t,r)}}:{add:function add(t){return define(this,t=0===t?0:t,t)}});v&&i(g,"size",{get:function(){return b(this).size}});return p},setStrong:function(t,r,a){var i=r+" Iterator",o=m(r),l=m(i);h(t,r,(function(t,r){_(this,{type:i,target:t,state:o(t),kind:r,last:void 0})}),(function(){for(var t=l(this),r=t.kind,a=t.last;a&&a.removed;)a=a.previous;if(!t.target||!(t.last=a=a?a.next:t.state.first)){t.target=void 0;return{value:void 0,done:!0}}return"keys"==r?{value:a.key,done:!1}:"values"==r?{value:a.value,done:!1}:{value:[a.key,a.value],done:!1}}),a?"entries":"values",!a,!0);p(r)}}},(t,r,a)=>{var i=a(49);t.exports=function(t,r,a){for(var o in r)i(t,o,r[o],a);return t}},(t,r,a)=>{"use strict";var i=a(25),o=a(46),l=a(35),c=a(9),u=l("species");t.exports=function(t){var r=i(t),a=o.f;c&&r&&!r[u]&&a(r,u,{configurable:!0,get:function(){return this}})}},(t,r,a)=>{a(118)},(t,r,a)=>{"use strict";a(97)("Set",(function(t){return function Set(){return t(this,arguments.length?arguments[0]:void 0)}}),a(114))},(t,r,a)=>{var i,o=a(37),l=a(6),c=a(7),u=a(25),d=a(17),h=a(10),p=a(42),v=a(23),y=a(120),g=a(22),_=a(24),m=a(105),b=a(48),A=a(80),k=a(40),P=a(101),S=a(45),w=a(65),x=a(121),C=a(122),T=a(124),E=a(29),I=a(125),O=a(126),M=a(127),R=c.Object,D=c.Date,L=c.Error,G=c.EvalError,j=c.RangeError,N=c.ReferenceError,B=c.SyntaxError,W=c.TypeError,U=c.URIError,H=c.PerformanceMark,z=c.WebAssembly,V=z&&z.CompileError||L,X=z&&z.LinkError||L,Y=z&&z.RuntimeError||L,K=u("DOMException"),J=u("Set"),Q=u("Map"),$=Q.prototype,Z=d($.has),ee=d($.get),te=d($.set),re=d(J.prototype.add),ne=u("Object","keys"),ae=d([].push),ie=d((!0).valueOf),oe=d(1..valueOf),se=d("".valueOf),le=d(D.prototype.getTime),ce=p("structuredClone"),ue="DataCloneError",de="Transferring",checkBasicSemantic=function(t){return!h((function(){var r=new c.Set([7]),a=t(r),i=t(R(7));return a==r||!a.has(7)||"object"!=typeof i||7!=i}))&&t},checkErrorsCloning=function(t,r){return!h((function(){var a=new r,i=t({a:a,b:a});return!(i&&i.a===i.b&&i.a instanceof r&&i.a.stack===a.stack)}))},he=c.structuredClone,fe=o||!checkErrorsCloning(he,L)||!checkErrorsCloning(he,K)||!(i=he,!h((function(){var t=i(new c.AggregateError([1],ce,{cause:3}));return"AggregateError"!=t.name||1!=t.errors[0]||t.message!=ce||3!=t.cause}))),pe=!he&&checkBasicSemantic((function(t){return new H(ce,{detail:t}).detail})),ve=checkBasicSemantic(he)||pe,throwUncloneable=function(t){throw new K("Uncloneable type: "+t,ue)},throwUnpolyfillable=function(t,r){throw new K((r||"Cloning")+" of "+t+" cannot be properly polyfilled in this engine",ue)},structuredCloneInternal=function(t,r){_(t)&&throwUncloneable("Symbol");if(!g(t))return t;if(r){if(Z(r,t))return ee(r,t)}else r=new Q;var a,i,o,l,d,h,p,m,b,x,E=A(t),I=!1;switch(E){case"Array":o=[];I=!0;break;case"Object":o={};I=!0;break;case"Map":o=new Q;I=!0;break;case"Set":o=new J;I=!0;break;case"RegExp":o=new RegExp(t.source,C(t));break;case"Error":switch(i=t.name){case"AggregateError":o=u("AggregateError")([]);break;case"EvalError":o=G();break;case"RangeError":o=j();break;case"ReferenceError":o=N();break;case"SyntaxError":o=B();break;case"TypeError":o=W();break;case"URIError":o=U();break;case"CompileError":o=V();break;case"LinkError":o=X();break;case"RuntimeError":o=Y();break;default:o=L()}I=!0;break;case"DOMException":o=new K(t.message,t.name);I=!0;break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":a=c[E];g(a)||throwUnpolyfillable(E);o=new a(structuredCloneInternal(t.buffer,r),t.byteOffset,"DataView"===E?t.byteLength:t.length);break;case"DOMQuad":try{o=new DOMQuad(structuredCloneInternal(t.p1,r),structuredCloneInternal(t.p2,r),structuredCloneInternal(t.p3,r),structuredCloneInternal(t.p4,r))}catch(r){ve?o=ve(t):throwUnpolyfillable(E)}break;case"FileList":a=c.DataTransfer;if(y(a)){l=new a;for(d=0,h=w(t);d<h;d++)l.items.add(structuredCloneInternal(t[d],r));o=l.files}else ve?o=ve(t):throwUnpolyfillable(E);break;case"ImageData":try{o=new ImageData(structuredCloneInternal(t.data,r),t.width,t.height,{colorSpace:t.colorSpace})}catch(r){ve?o=ve(t):throwUnpolyfillable(E)}break;default:if(ve)o=ve(t);else switch(E){case"BigInt":o=R(t.valueOf());break;case"Boolean":o=R(ie(t));break;case"Number":o=R(oe(t));break;case"String":o=R(se(t));break;case"Date":o=new D(le(t));break;case"ArrayBuffer":(a=c.DataView)||"function"==typeof t.slice||throwUnpolyfillable(E);try{if("function"==typeof t.slice)o=t.slice(0);else{h=t.byteLength;o=new ArrayBuffer(h);b=new a(t);x=new a(o);for(d=0;d<h;d++)x.setUint8(d,b.getUint8(d))}}catch(t){throw new K("ArrayBuffer is detached",ue)}break;case"SharedArrayBuffer":o=t;break;case"Blob":try{o=t.slice(0,t.size,t.type)}catch(t){throwUnpolyfillable(E)}break;case"DOMPoint":case"DOMPointReadOnly":a=c[E];try{o=a.fromPoint?a.fromPoint(t):new a(t.x,t.y,t.z,t.w)}catch(t){throwUnpolyfillable(E)}break;case"DOMRect":case"DOMRectReadOnly":a=c[E];try{o=a.fromRect?a.fromRect(t):new a(t.x,t.y,t.width,t.height)}catch(t){throwUnpolyfillable(E)}break;case"DOMMatrix":case"DOMMatrixReadOnly":a=c[E];try{o=a.fromMatrix?a.fromMatrix(t):new a(t)}catch(t){throwUnpolyfillable(E)}break;case"AudioData":case"VideoFrame":v(t.clone)||throwUnpolyfillable(E);try{o=t.clone()}catch(t){throwUncloneable(E)}break;case"File":try{o=new File([t],t.name,t)}catch(t){throwUnpolyfillable(E)}break;case"CryptoKey":case"GPUCompilationMessage":case"GPUCompilationInfo":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":throwUnpolyfillable(E);default:throwUncloneable(E)}}te(r,t,o);if(I)switch(E){case"Array":case"Object":p=ne(t);for(d=0,h=w(p);d<h;d++){m=p[d];P(o,m,structuredCloneInternal(t[m],r))}break;case"Map":t.forEach((function(t,a){te(o,structuredCloneInternal(a,r),structuredCloneInternal(t,r))}));break;case"Set":t.forEach((function(t){re(o,structuredCloneInternal(t,r))}));break;case"Error":S(o,"message",structuredCloneInternal(t.message,r));k(t,"cause")&&S(o,"cause",structuredCloneInternal(t.cause,r));"AggregateError"==i&&(o.errors=structuredCloneInternal(t.errors,r));case"DOMException":T&&S(o,"stack",structuredCloneInternal(t.stack,r))}return o},ye=he&&!h((function(){if(O&&E>92||M&&E>94||I&&E>97)return!1;var t=new ArrayBuffer(8),r=he(t,{transfer:[t]});return 0!=t.byteLength||8!=r.byteLength})),tryToTransfer=function(t,r){if(!g(t))throw W("Transfer option cannot be converted to a sequence");var a=[];m(t,(function(t){ae(a,b(t))}));var i,o,l,u,d,h,p=0,_=w(a);if(ye){u=he(a,{transfer:a});for(;p<_;)te(r,a[p],u[p++])}else for(;p<_;){i=a[p++];if(Z(r,i))throw new K("Duplicate transferable",ue);switch(o=A(i)){case"ImageBitmap":l=c.OffscreenCanvas;y(l)||throwUnpolyfillable(o,de);try{(h=new l(i.width,i.height)).getContext("bitmaprenderer").transferFromImageBitmap(i);d=h.transferToImageBitmap()}catch(t){}break;case"AudioData":case"VideoFrame":v(i.clone)&&v(i.close)||throwUnpolyfillable(o,de);try{d=i.clone();i.close()}catch(t){}break;case"ArrayBuffer":case"MessagePort":case"OffscreenCanvas":case"ReadableStream":case"TransformStream":case"WritableStream":throwUnpolyfillable(o,de)}if(void 0===d)throw new K("This object cannot be transferred: "+o,ue);te(r,i,d)}};l({global:!0,enumerable:!0,sham:!ye,forced:fe},{structuredClone:function structuredClone(t){var r,a=x(arguments.length,1)>1&&null!=arguments[1]?b(arguments[1]):void 0,i=a?a.transfer:void 0;if(void 0!==i){r=new Q;tryToTransfer(i,r)}return structuredCloneInternal(t,r)}})},(t,r,a)=>{var i=a(17),o=a(10),l=a(23),c=a(80),u=a(25),d=a(52),noop=function(){},h=[],p=u("Reflect","construct"),v=/^\s*(?:class|function)\b/,y=i(v.exec),g=!v.exec(noop),_=function isConstructor(t){if(!l(t))return!1;try{p(noop,h,t);return!0}catch(t){return!1}},m=function isConstructor(t){if(!l(t))return!1;switch(c(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return g||!!y(v,d(t))}catch(t){return!0}};m.sham=!0;t.exports=!p||o((function(){var t;return _(_.call)||!_(Object)||!_((function(){t=!0}))||t}))?m:_},t=>{var r=TypeError;t.exports=function(t,a){if(t<a)throw r("Not enough arguments");return t}},(t,r,a)=>{var i=a(11),o=a(40),l=a(26),c=a(123),u=RegExp.prototype;t.exports=function(t){var r=t.flags;return void 0!==r||"flags"in u||o(t,"flags")||!l(u,t)?r:i(c,t)}},(t,r,a)=>{"use strict";var i=a(48);t.exports=function(){var t=i(this),r="";t.hasIndices&&(r+="d");t.global&&(r+="g");t.ignoreCase&&(r+="i");t.multiline&&(r+="m");t.dotAll&&(r+="s");t.unicode&&(r+="u");t.unicodeSets&&(r+="v");t.sticky&&(r+="y");return r}},(t,r,a)=>{var i=a(10),o=a(14);t.exports=!i((function(){var t=Error("a");if(!("stack"in t))return!0;Object.defineProperty(t,"stack",o(1,7));return 7!==t.stack}))},t=>{t.exports="object"==typeof window&&"object"!=typeof Deno},t=>{t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},(t,r,a)=>{var i=a(18),o=a(7);t.exports="process"==i(o.process)},(t,r,a)=>{var i=a(7);t.exports=i},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.StatTimer=r.RenderingCancelledException=r.PixelsPerInch=r.PageViewport=r.PDFDateString=r.DOMStandardFontDataFactory=r.DOMSVGFactory=r.DOMCanvasFactory=r.DOMCMapReaderFactory=void 0;r.binarySearchFirstItem=function binarySearchFirstItem(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=a,o=t.length-1;if(o<0||!r(t[o]))return t.length;if(r(t[i]))return i;for(;i<o;){var l=i+o>>1,c=t[l];r(c)?o=l:i=l+1}return i};r.deprecated=function deprecated(t){console.log("Deprecated API usage: "+t)};r.getColorValues=function getColorValues(t){var r=document.createElement("span");r.style.visibility="hidden";document.body.append(r);var a,i=_createForOfIteratorHelper(t.keys());try{for(i.s();!(a=i.n()).done;){var o=a.value;r.style.color=o;var l=window.getComputedStyle(r).color;t.set(o,getRGB(l))}}catch(t){i.e(t)}finally{i.f()}r.remove()};r.getFilenameFromUrl=function getFilenameFromUrl(t){var r=t.indexOf("#"),a=t.indexOf("?"),i=Math.min(r>0?r:t.length,a>0?a:t.length);return t.substring(t.lastIndexOf("/",i)+1,i)};r.getPdfFilenameFromUrl=function getPdfFilenameFromUrl(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return r;if(isDataScheme(t)){(0,o.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return r}var a=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,l=a.exec(t),c=i.exec(l[1])||i.exec(l[2])||i.exec(l[3]);if(c&&(c=c[0]).includes("%"))try{c=i.exec(decodeURIComponent(c))[0]}catch(t){}return c||r};r.getRGB=getRGB;r.getXfaPageViewport=function getXfaPageViewport(t,r){var a=r.scale,i=void 0===a?1:a,o=r.rotation,l=void 0===o?0:o,c=t.attributes.style,u=c.width,d=c.height,h=[0,0,parseInt(u),parseInt(d)];return new p({viewBox:h,scale:i,rotation:l})};r.isDataScheme=isDataScheme;r.isPdfFile=function isPdfFile(t){return"string"==typeof t&&/\.pdf$/i.test(t)};r.isValidFetchUrl=isValidFetchUrl;r.loadScript=function loadScript(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((function(a,i){var o=document.createElement("script");o.src=t;o.onload=function(t){r&&o.remove();a(t)};o.onerror=function(){i(new Error("Cannot load script at: ".concat(o.src)))};(document.head||document.documentElement).append(o)}))};var i=a(130),o=a(1);function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}var l=_createClass((function PixelsPerInch(){_classCallCheck(this,PixelsPerInch)}));r.PixelsPerInch=l;_defineProperty(l,"CSS",96);_defineProperty(l,"PDF",72);_defineProperty(l,"PDF_TO_CSS_UNITS",l.CSS/l.PDF);var c=function(t){_inherits(DOMCanvasFactory,t);var r=_createSuper(DOMCanvasFactory);function DOMCanvasFactory(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=a.ownerDocument,o=void 0===i?globalThis.document:i;_classCallCheck(this,DOMCanvasFactory);(t=r.call(this))._document=o;return t}_createClass(DOMCanvasFactory,[{key:"_createCanvas",value:function _createCanvas(t,r){var a=this._document.createElement("canvas");a.width=t;a.height=r;return a}}]);return DOMCanvasFactory}(i.BaseCanvasFactory);r.DOMCanvasFactory=c;function fetchData(t){return _fetchData.apply(this,arguments)}function _fetchData(){_fetchData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(t){var r,a,i=arguments;return _regeneratorRuntime().wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:r=i.length>1&&void 0!==i[1]&&i[1];if(!isValidFetchUrl(t,document.baseURI)){l.next=21;break}l.next=4;return fetch(t);case 4:if((a=l.sent).ok){l.next=7;break}throw new Error(a.statusText);case 7:if(!r){l.next=15;break}l.t1=Uint8Array;l.next=11;return a.arrayBuffer();case 11:l.t2=l.sent;l.t0=new l.t1(l.t2);l.next=20;break;case 15:l.t3=o.stringToBytes;l.next=18;return a.text();case 18:l.t4=l.sent;l.t0=(0,l.t3)(l.t4);case 20:return l.abrupt("return",l.t0);case 21:return l.abrupt("return",new Promise((function(a,i){var l=new XMLHttpRequest;l.open("GET",t,!0);r&&(l.responseType="arraybuffer");l.onreadystatechange=function(){if(l.readyState===XMLHttpRequest.DONE){if(200===l.status||0===l.status){var t;r&&l.response?t=new Uint8Array(l.response):!r&&l.responseText&&(t=(0,o.stringToBytes)(l.responseText));if(t){a(t);return}}i(new Error(l.statusText))}};l.send(null)})));case 22:case"end":return l.stop()}}),_callee)})));return _fetchData.apply(this,arguments)}var u=function(t){_inherits(DOMCMapReaderFactory,t);var r=_createSuper(DOMCMapReaderFactory);function DOMCMapReaderFactory(){_classCallCheck(this,DOMCMapReaderFactory);return r.apply(this,arguments)}_createClass(DOMCMapReaderFactory,[{key:"_fetchData",value:function _fetchData(t,r){return fetchData(t,this.isCompressed).then((function(t){return{cMapData:t,compressionType:r}}))}}]);return DOMCMapReaderFactory}(i.BaseCMapReaderFactory);r.DOMCMapReaderFactory=u;var d=function(t){_inherits(DOMStandardFontDataFactory,t);var r=_createSuper(DOMStandardFontDataFactory);function DOMStandardFontDataFactory(){_classCallCheck(this,DOMStandardFontDataFactory);return r.apply(this,arguments)}_createClass(DOMStandardFontDataFactory,[{key:"_fetchData",value:function _fetchData(t){return fetchData(t,!0)}}]);return DOMStandardFontDataFactory}(i.BaseStandardFontDataFactory);r.DOMStandardFontDataFactory=d;var h=function(t){_inherits(DOMSVGFactory,t);var r=_createSuper(DOMSVGFactory);function DOMSVGFactory(){_classCallCheck(this,DOMSVGFactory);return r.apply(this,arguments)}_createClass(DOMSVGFactory,[{key:"_createSVG",value:function _createSVG(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}]);return DOMSVGFactory}(i.BaseSVGFactory);r.DOMSVGFactory=h;var p=function(){function PageViewport(t){var r=t.viewBox,a=t.scale,i=t.rotation,o=t.offsetX,l=void 0===o?0:o,c=t.offsetY,u=void 0===c?0:c,d=t.dontFlip,h=void 0!==d&&d;_classCallCheck(this,PageViewport);this.viewBox=r;this.scale=a;this.rotation=i;this.offsetX=l;this.offsetY=u;var p,v,y,g,_,m,b,A,k=(r[2]+r[0])/2,P=(r[3]+r[1])/2;(i%=360)<0&&(i+=360);switch(i){case 180:p=-1;v=0;y=0;g=1;break;case 90:p=0;v=1;y=1;g=0;break;case 270:p=0;v=-1;y=-1;g=0;break;case 0:p=1;v=0;y=0;g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(h){y=-y;g=-g}if(0===p){_=Math.abs(P-r[1])*a+l;m=Math.abs(k-r[0])*a+u;b=Math.abs(r[3]-r[1])*a;A=Math.abs(r[2]-r[0])*a}else{_=Math.abs(k-r[0])*a+l;m=Math.abs(P-r[1])*a+u;b=Math.abs(r[2]-r[0])*a;A=Math.abs(r[3]-r[1])*a}this.transform=[p*a,v*a,y*a,g*a,_-p*a*k-y*a*P,m-v*a*k-g*a*P];this.width=b;this.height=A}_createClass(PageViewport,[{key:"clone",value:function clone(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.scale,a=void 0===r?this.scale:r,i=t.rotation,o=void 0===i?this.rotation:i,l=t.offsetX,c=void 0===l?this.offsetX:l,u=t.offsetY,d=void 0===u?this.offsetY:u,h=t.dontFlip,p=void 0!==h&&h;return new PageViewport({viewBox:this.viewBox.slice(),scale:a,rotation:o,offsetX:c,offsetY:d,dontFlip:p})}},{key:"convertToViewportPoint",value:function convertToViewportPoint(t,r){return o.Util.applyTransform([t,r],this.transform)}},{key:"convertToViewportRectangle",value:function convertToViewportRectangle(t){var r=o.Util.applyTransform([t[0],t[1]],this.transform),a=o.Util.applyTransform([t[2],t[3]],this.transform);return[r[0],r[1],a[0],a[1]]}},{key:"convertToPdfPoint",value:function convertToPdfPoint(t,r){return o.Util.applyInverseTransform([t,r],this.transform)}}]);return PageViewport}();r.PageViewport=p;var v=function(t){_inherits(RenderingCancelledException,t);var r=_createSuper(RenderingCancelledException);function RenderingCancelledException(t,a){var i;_classCallCheck(this,RenderingCancelledException);(i=r.call(this,t,"RenderingCancelledException")).type=a;return i}return _createClass(RenderingCancelledException)}(o.BaseException);r.RenderingCancelledException=v;function isDataScheme(t){for(var r=t.length,a=0;a<r&&""===t[a].trim();)a++;return"data:"===t.substring(a,a+5).toLowerCase()}var y,g=function(){function StatTimer(){_classCallCheck(this,StatTimer);this.started=Object.create(null);this.times=[]}_createClass(StatTimer,[{key:"time",value:function time(t){t in this.started&&(0,o.warn)("Timer is already running for ".concat(t));this.started[t]=Date.now()}},{key:"timeEnd",value:function timeEnd(t){t in this.started||(0,o.warn)("Timer has not been started for ".concat(t));this.times.push({name:t,start:this.started[t],end:Date.now()});delete this.started[t]}},{key:"toString",value:function toString(){var t,r=[],a=0,i=_createForOfIteratorHelper(this.times);try{for(i.s();!(t=i.n()).done;){var o=t.value.name;o.length>a&&(a=o.length)}}catch(t){i.e(t)}finally{i.f()}var l,c=_createForOfIteratorHelper(this.times);try{for(c.s();!(l=c.n()).done;){var u=l.value,d=u.end-u.start;r.push("".concat(u.name.padEnd(a)," ").concat(d,"ms\n"))}}catch(t){c.e(t)}finally{c.f()}return r.join("")}}]);return StatTimer}();r.StatTimer=g;function isValidFetchUrl(t,r){try{var a=(r?new URL(t,r):new URL(t)).protocol;return"http:"===a||"https:"===a}catch(t){return!1}}var _=function(){function PDFDateString(){_classCallCheck(this,PDFDateString)}_createClass(PDFDateString,null,[{key:"toDateObject",value:function toDateObject(t){if(!t||"string"!=typeof t)return null;y||(y=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));var r=y.exec(t);if(!r)return null;var a=parseInt(r[1],10),i=parseInt(r[2],10);i=i>=1&&i<=12?i-1:0;var o=parseInt(r[3],10);o=o>=1&&o<=31?o:1;var l=parseInt(r[4],10);l=l>=0&&l<=23?l:0;var c=parseInt(r[5],10);c=c>=0&&c<=59?c:0;var u=parseInt(r[6],10);u=u>=0&&u<=59?u:0;var d=r[7]||"Z",h=parseInt(r[8],10);h=h>=0&&h<=23?h:0;var p=parseInt(r[9],10)||0;p=p>=0&&p<=59?p:0;if("-"===d){l+=h;c+=p}else if("+"===d){l-=h;c-=p}return new Date(Date.UTC(a,i,o,l,c,u))}}]);return PDFDateString}();r.PDFDateString=_;function getRGB(t){if(t.startsWith("#")){var r=parseInt(t.slice(1),16);return[(16711680&r)>>16,(65280&r)>>8,255&r]}if(t.startsWith("rgb("))return t.slice(4,-1).split(",").map((function(t){return parseInt(t)}));if(t.startsWith("rgba("))return t.slice(5,-1).split(",").map((function(t){return parseInt(t)})).slice(0,3);(0,o.warn)('Not a valid color format: "'.concat(t,'"'));return[0,0,0]}},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.BaseStandardFontDataFactory=r.BaseSVGFactory=r.BaseCanvasFactory=r.BaseCMapReaderFactory=void 0;var i=a(1);function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}var o=function(){function BaseCanvasFactory(){_classCallCheck(this,BaseCanvasFactory);this.constructor===BaseCanvasFactory&&(0,i.unreachable)("Cannot initialize BaseCanvasFactory.")}_createClass(BaseCanvasFactory,[{key:"create",value:function create(t,r){if(t<=0||r<=0)throw new Error("Invalid canvas size");var a=this._createCanvas(t,r);return{canvas:a,context:a.getContext("2d")}}},{key:"reset",value:function reset(t,r,a){if(!t.canvas)throw new Error("Canvas is not specified");if(r<=0||a<=0)throw new Error("Invalid canvas size");t.canvas.width=r;t.canvas.height=a}},{key:"destroy",value:function destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0;t.canvas.height=0;t.canvas=null;t.context=null}},{key:"_createCanvas",value:function _createCanvas(t,r){(0,i.unreachable)("Abstract method `_createCanvas` called.")}}]);return BaseCanvasFactory}();r.BaseCanvasFactory=o;var l=function(){function BaseCMapReaderFactory(t){var r=t.baseUrl,a=void 0===r?null:r,o=t.isCompressed,l=void 0!==o&&o;_classCallCheck(this,BaseCMapReaderFactory);this.constructor===BaseCMapReaderFactory&&(0,i.unreachable)("Cannot initialize BaseCMapReaderFactory.");this.baseUrl=a;this.isCompressed=l}_createClass(BaseCMapReaderFactory,[{key:"fetch",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(t){var r,a,o,l=this;return _regeneratorRuntime().wrap((function _callee$(c){for(;;)switch(c.prev=c.next){case 0:r=t.name;if(this.baseUrl){c.next=3;break}throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');case 3:if(r){c.next=5;break}throw new Error("CMap name must be specified.");case 5:a=this.baseUrl+r+(this.isCompressed?".bcmap":"");o=this.isCompressed?i.CMapCompressionType.BINARY:i.CMapCompressionType.NONE;return c.abrupt("return",this._fetchData(a,o).catch((function(t){throw new Error("Unable to load ".concat(l.isCompressed?"binary ":"","CMap at: ").concat(a))})));case 8:case"end":return c.stop()}}),_callee,this)}))),function fetch(r){return t.apply(this,arguments)})},{key:"_fetchData",value:function _fetchData(t,r){(0,i.unreachable)("Abstract method `_fetchData` called.")}}]);var t;return BaseCMapReaderFactory}();r.BaseCMapReaderFactory=l;var c=function(){function BaseStandardFontDataFactory(t){var r=t.baseUrl,a=void 0===r?null:r;_classCallCheck(this,BaseStandardFontDataFactory);this.constructor===BaseStandardFontDataFactory&&(0,i.unreachable)("Cannot initialize BaseStandardFontDataFactory.");this.baseUrl=a}_createClass(BaseStandardFontDataFactory,[{key:"fetch",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(t){var r,a;return _regeneratorRuntime().wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:r=t.filename;if(this.baseUrl){i.next=3;break}throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');case 3:if(r){i.next=5;break}throw new Error("Font filename must be specified.");case 5:a="".concat(this.baseUrl).concat(r);return i.abrupt("return",this._fetchData(a).catch((function(t){throw new Error("Unable to load font data at: ".concat(a))})));case 7:case"end":return i.stop()}}),_callee2,this)}))),function fetch(r){return t.apply(this,arguments)})},{key:"_fetchData",value:function _fetchData(t){(0,i.unreachable)("Abstract method `_fetchData` called.")}}]);var t;return BaseStandardFontDataFactory}();r.BaseStandardFontDataFactory=c;var u=function(){function BaseSVGFactory(){_classCallCheck(this,BaseSVGFactory);this.constructor===BaseSVGFactory&&(0,i.unreachable)("Cannot initialize BaseSVGFactory.")}_createClass(BaseSVGFactory,[{key:"create",value:function create(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||r<=0)throw new Error("Invalid SVG dimensions");var i=this._createSVG("svg:svg");i.setAttribute("version","1.1");if(!a){i.setAttribute("width","".concat(t,"px"));i.setAttribute("height","".concat(r,"px"))}i.setAttribute("preserveAspectRatio","none");i.setAttribute("viewBox","0 0 ".concat(t," ").concat(r));return i}},{key:"createElement",value:function createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}},{key:"_createSVG",value:function _createSVG(t){(0,i.unreachable)("Abstract method `_createSVG` called.")}}]);return BaseSVGFactory}();r.BaseSVGFactory=u},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0;exports.getDocument=getDocument;exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory;exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(132),_display_utils=__w_pdfjs_require__(129),_font_loader=__w_pdfjs_require__(136),_canvas=__w_pdfjs_require__(137),_worker_options=__w_pdfjs_require__(140),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(141),_metadata=__w_pdfjs_require__(142),_optional_content_config=__w_pdfjs_require__(143),_transport_stream=__w_pdfjs_require__(144),_xfa_text=__w_pdfjs_require__(145);function _classPrivateMethodInitSpec(t,r){_checkPrivateRedeclaration(t,r);r.add(t)}function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}function _classPrivateFieldInitSpec(t,r,a){_checkPrivateRedeclaration(t,r);r.set(t,a)}function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldSet(t,r,a){_classApplyDescriptorSet(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classPrivateFieldGet(t,r){return _classApplyDescriptorGet(t,_classExtractFieldDescriptor(t,r,"get"))}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _classStaticPrivateFieldSpecSet(t,r,a,i){_classCheckPrivateStaticAccess(t,r);_classCheckPrivateStaticFieldDescriptor(a,"set");_classApplyDescriptorSet(t,a,i);return i}function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}function _classStaticPrivateFieldSpecGet(t,r,a){_classCheckPrivateStaticAccess(t,r);_classCheckPrivateStaticFieldDescriptor(a,"get");return _classApplyDescriptorGet(t,a)}function _classCheckPrivateStaticFieldDescriptor(t,r){if(void 0===t)throw new TypeError("attempted to "+r+" private static field before its declaration")}function _classCheckPrivateStaticAccess(t,r){if(t!==r)throw new TypeError("Private static access of wrong provenance")}function _classApplyDescriptorGet(t,r){return r.get?r.get.call(t):r.value}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _slicedToArray(t,r){return _arrayWithHoles(t)||_iterableToArrayLimit(t,r)||_unsupportedIterableToArray(t,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}var DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;var DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;var DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;if(_is_node.isNodeJS){var _require=__w_pdfjs_require__(146),NodeCanvasFactory=_require.NodeCanvasFactory,NodeCMapReaderFactory=_require.NodeCMapReaderFactory,NodeStandardFontDataFactory=_require.NodeStandardFontDataFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory=NodeCanvasFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=NodeCMapReaderFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=NodeStandardFontDataFactory}function setPDFNetworkStreamFactory(t){createPDFNetworkStream=t}function getDocument(t){var r,a=new PDFDocumentLoadingTask;if("string"==typeof t||t instanceof URL)r={url:t};else if((0,_util.isArrayBuffer)(t))r={data:t};else if(t instanceof PDFDataRangeTransport)r={range:t};else{if("object"!==_typeof(t))throw new Error("Invalid parameter in getDocument, need either string, URL, Uint8Array, or parameter object.");if(!t.url&&!t.data&&!t.range)throw new Error("Invalid parameter object: need either .data, .range or .url");r=t}var i=Object.create(null),o=null,l=null;for(var c in r){var u=r[c];switch(c){case"url":if("undefined"!=typeof window)try{i[c]=new URL(u,window.location).href;continue}catch(t){(0,_util.warn)('Cannot create valid URL: "'.concat(t,'".'))}else if("string"==typeof u||u instanceof URL){i[c]=u.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":o=u;continue;case"worker":l=u;continue;case"data":if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&u instanceof Buffer)i[c]=new Uint8Array(u);else{if(u instanceof Uint8Array)break;if("string"==typeof u)i[c]=(0,_util.stringToBytes)(u);else if("object"!==_typeof(u)||null===u||isNaN(u.length)){if(!(0,_util.isArrayBuffer)(u))throw new Error("Invalid PDF binary data: either typed array, string, or array-like object is expected in the data property.");i[c]=new Uint8Array(u)}else i[c]=new Uint8Array(u)}continue}i[c]=u}i.CMapReaderFactory=i.CMapReaderFactory||DefaultCMapReaderFactory;i.StandardFontDataFactory=i.StandardFontDataFactory||DefaultStandardFontDataFactory;i.ignoreErrors=!0!==i.stopAtErrors;i.fontExtraProperties=!0===i.fontExtraProperties;i.pdfBug=!0===i.pdfBug;i.enableXfa=!0===i.enableXfa;(!Number.isInteger(i.rangeChunkSize)||i.rangeChunkSize<1)&&(i.rangeChunkSize=DEFAULT_RANGE_CHUNK_SIZE);("string"!=typeof i.docBaseUrl||(0,_display_utils.isDataScheme)(i.docBaseUrl))&&(i.docBaseUrl=null);(!Number.isInteger(i.maxImageSize)||i.maxImageSize<-1)&&(i.maxImageSize=-1);"string"!=typeof i.cMapUrl&&(i.cMapUrl=null);"string"!=typeof i.standardFontDataUrl&&(i.standardFontDataUrl=null);"boolean"!=typeof i.useWorkerFetch&&(i.useWorkerFetch=i.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&i.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory);"boolean"!=typeof i.isEvalSupported&&(i.isEvalSupported=!0);"boolean"!=typeof i.disableFontFace&&(i.disableFontFace=_is_node.isNodeJS);"boolean"!=typeof i.useSystemFonts&&(i.useSystemFonts=!_is_node.isNodeJS&&!i.disableFontFace);"object"===_typeof(i.ownerDocument)&&null!==i.ownerDocument||(i.ownerDocument=globalThis.document);"boolean"!=typeof i.disableRange&&(i.disableRange=!1);"boolean"!=typeof i.disableStream&&(i.disableStream=!1);"boolean"!=typeof i.disableAutoFetch&&(i.disableAutoFetch=!1);(0,_util.setVerbosityLevel)(i.verbosity);if(!l){var d={verbosity:i.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};l=d.port?PDFWorker.fromPort(d):new PDFWorker(d);a._worker=l}var h=a.docId;l.promise.then((function(){if(a.destroyed)throw new Error("Loading aborted");var t=_fetchDocument(l,i,o,h),r=new Promise((function(t){var r;o?r=new _transport_stream.PDFDataTransportStream({length:i.length,initialData:i.initialData,progressiveDone:i.progressiveDone,contentDispositionFilename:i.contentDispositionFilename,disableRange:i.disableRange,disableStream:i.disableStream},o):i.data||(r=createPDFNetworkStream({url:i.url,length:i.length,httpHeaders:i.httpHeaders,withCredentials:i.withCredentials,rangeChunkSize:i.rangeChunkSize,disableRange:i.disableRange,disableStream:i.disableStream}));t(r)}));return Promise.all([t,r]).then((function(t){var r=_slicedToArray(t,2),o=r[0],c=r[1];if(a.destroyed)throw new Error("Loading aborted");var u=new _message_handler.MessageHandler(h,o,l.port),d=new WorkerTransport(u,a,c,i);a._transport=d;u.send("Ready",null)}))})).catch(a._capability.reject);return a}function _fetchDocument(t,r,a,i){return _fetchDocument2.apply(this,arguments)}function _fetchDocument2(){return(_fetchDocument2=_asyncToGenerator(_regeneratorRuntime().mark((function _callee7(t,r,a,i){var o;return _regeneratorRuntime().wrap((function _callee7$(l){for(;;)switch(l.prev=l.next){case 0:if(!t.destroyed){l.next=2;break}throw new Error("Worker was destroyed");case 2:if(a){r.length=a.length;r.initialData=a.initialData;r.progressiveDone=a.progressiveDone;r.contentDispositionFilename=a.contentDispositionFilename}l.next=5;return t.messageHandler.sendWithPromise("GetDocRequest",{docId:i,apiVersion:"2.15.349",source:{data:r.data,url:r.url,password:r.password,disableAutoFetch:r.disableAutoFetch,rangeChunkSize:r.rangeChunkSize,length:r.length},maxImageSize:r.maxImageSize,disableFontFace:r.disableFontFace,docBaseUrl:r.docBaseUrl,ignoreErrors:r.ignoreErrors,isEvalSupported:r.isEvalSupported,fontExtraProperties:r.fontExtraProperties,enableXfa:r.enableXfa,useSystemFonts:r.useSystemFonts,cMapUrl:r.useWorkerFetch?r.cMapUrl:null,standardFontDataUrl:r.useWorkerFetch?r.standardFontDataUrl:null});case 5:o=l.sent;r.data&&(r.data=null);if(!t.destroyed){l.next=9;break}throw new Error("Worker was destroyed");case 9:return l.abrupt("return",o);case 10:case"end":return l.stop()}}),_callee7)})))).apply(this,arguments)}var PDFDocumentLoadingTask=function(){function PDFDocumentLoadingTask(){var t,r;_classCallCheck(this,PDFDocumentLoadingTask);this._capability=(0,_util.createPromiseCapability)();this._transport=null;this._worker=null;this.docId="d".concat((_classStaticPrivateFieldSpecSet(PDFDocumentLoadingTask,PDFDocumentLoadingTask,_docId,(t=_classStaticPrivateFieldSpecGet(PDFDocumentLoadingTask,PDFDocumentLoadingTask,_docId),r=t++,t)),r));this.destroyed=!1;this.onPassword=null;this.onProgress=null;this.onUnsupportedFeature=null}_createClass(PDFDocumentLoadingTask,[{key:"promise",get:function get(){return this._capability.promise}},{key:"destroy",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var t;return _regeneratorRuntime().wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:this.destroyed=!0;r.next=3;return null===(t=this._transport)||void 0===t?void 0:t.destroy();case 3:this._transport=null;if(this._worker){this._worker.destroy();this._worker=null}case 5:case"end":return r.stop()}}),_callee,this)}))),function destroy(){return t.apply(this,arguments)})}]);var t;return PDFDocumentLoadingTask}();exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;var _docId={writable:!0,value:0},PDFDataRangeTransport=function(){function PDFDataRangeTransport(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,PDFDataRangeTransport);this.length=t;this.initialData=r;this.progressiveDone=a;this.contentDispositionFilename=i;this._rangeListeners=[];this._progressListeners=[];this._progressiveReadListeners=[];this._progressiveDoneListeners=[];this._readyCapability=(0,_util.createPromiseCapability)()}_createClass(PDFDataRangeTransport,[{key:"addRangeListener",value:function addRangeListener(t){this._rangeListeners.push(t)}},{key:"addProgressListener",value:function addProgressListener(t){this._progressListeners.push(t)}},{key:"addProgressiveReadListener",value:function addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}},{key:"addProgressiveDoneListener",value:function addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}},{key:"onDataRange",value:function onDataRange(t,r){var a,i=_createForOfIteratorHelper(this._rangeListeners);try{for(i.s();!(a=i.n()).done;){(0,a.value)(t,r)}}catch(t){i.e(t)}finally{i.f()}}},{key:"onDataProgress",value:function onDataProgress(t,r){var a=this;this._readyCapability.promise.then((function(){var i,o=_createForOfIteratorHelper(a._progressListeners);try{for(o.s();!(i=o.n()).done;){(0,i.value)(t,r)}}catch(t){o.e(t)}finally{o.f()}}))}},{key:"onDataProgressiveRead",value:function onDataProgressiveRead(t){var r=this;this._readyCapability.promise.then((function(){var a,i=_createForOfIteratorHelper(r._progressiveReadListeners);try{for(i.s();!(a=i.n()).done;){(0,a.value)(t)}}catch(t){i.e(t)}finally{i.f()}}))}},{key:"onDataProgressiveDone",value:function onDataProgressiveDone(){var t=this;this._readyCapability.promise.then((function(){var r,a=_createForOfIteratorHelper(t._progressiveDoneListeners);try{for(a.s();!(r=a.n()).done;){(0,r.value)()}}catch(t){a.e(t)}finally{a.f()}}))}},{key:"transportReady",value:function transportReady(){this._readyCapability.resolve()}},{key:"requestDataRange",value:function requestDataRange(t,r){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}},{key:"abort",value:function abort(){}}]);return PDFDataRangeTransport}();exports.PDFDataRangeTransport=PDFDataRangeTransport;var PDFDocumentProxy=function(){function PDFDocumentProxy(t,r){var a,i=this;_classCallCheck(this,PDFDocumentProxy);this._pdfInfo=t;this._transport=r;Object.defineProperty(this,"fingerprint",{get:function get(){(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead.");return this.fingerprints[0]}});Object.defineProperty(this,"getStats",{value:(a=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(){return _regeneratorRuntime().wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:(0,_display_utils.deprecated)("`PDFDocumentProxy.getStats`, please use the `PDFDocumentProxy.stats`-getter instead.");return t.abrupt("return",i.stats||{streamTypes:{},fontTypes:{}});case 2:case"end":return t.stop()}}),_callee2)}))),function value(){return a.apply(this,arguments)})})}_createClass(PDFDocumentProxy,[{key:"annotationStorage",get:function get(){return this._transport.annotationStorage}},{key:"numPages",get:function get(){return this._pdfInfo.numPages}},{key:"fingerprints",get:function get(){return this._pdfInfo.fingerprints}},{key:"stats",get:function get(){return this._transport.stats}},{key:"isPureXfa",get:function get(){return!!this._transport._htmlForXfa}},{key:"allXfaHtml",get:function get(){return this._transport._htmlForXfa}},{key:"getPage",value:function getPage(t){return this._transport.getPage(t)}},{key:"getPageIndex",value:function getPageIndex(t){return this._transport.getPageIndex(t)}},{key:"getDestinations",value:function getDestinations(){return this._transport.getDestinations()}},{key:"getDestination",value:function getDestination(t){return this._transport.getDestination(t)}},{key:"getPageLabels",value:function getPageLabels(){return this._transport.getPageLabels()}},{key:"getPageLayout",value:function getPageLayout(){return this._transport.getPageLayout()}},{key:"getPageMode",value:function getPageMode(){return this._transport.getPageMode()}},{key:"getViewerPreferences",value:function getViewerPreferences(){return this._transport.getViewerPreferences()}},{key:"getOpenAction",value:function getOpenAction(){return this._transport.getOpenAction()}},{key:"getAttachments",value:function getAttachments(){return this._transport.getAttachments()}},{key:"getJavaScript",value:function getJavaScript(){return this._transport.getJavaScript()}},{key:"getJSActions",value:function getJSActions(){return this._transport.getDocJSActions()}},{key:"getOutline",value:function getOutline(){return this._transport.getOutline()}},{key:"getOptionalContentConfig",value:function getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}},{key:"getPermissions",value:function getPermissions(){return this._transport.getPermissions()}},{key:"getMetadata",value:function getMetadata(){return this._transport.getMetadata()}},{key:"getMarkInfo",value:function getMarkInfo(){return this._transport.getMarkInfo()}},{key:"getData",value:function getData(){return this._transport.getData()}},{key:"getDownloadInfo",value:function getDownloadInfo(){return this._transport.downloadInfoCapability.promise}},{key:"cleanup",value:function cleanup(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}},{key:"destroy",value:function destroy(){return this.loadingTask.destroy()}},{key:"loadingParams",get:function get(){return this._transport.loadingParams}},{key:"loadingTask",get:function get(){return this._transport.loadingTask}},{key:"saveDocument",value:function saveDocument(){this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");return this._transport.saveDocument()}},{key:"getFieldObjects",value:function getFieldObjects(){return this._transport.getFieldObjects()}},{key:"hasJSActions",value:function hasJSActions(){return this._transport.hasJSActions()}},{key:"getCalculationOrderIds",value:function getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}]);return PDFDocumentProxy}();exports.PDFDocumentProxy=PDFDocumentProxy;var PDFPageProxy=function(){function PDFPageProxy(t,r,a,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];_classCallCheck(this,PDFPageProxy);this._pageIndex=t;this._pageInfo=r;this._ownerDocument=i;this._transport=a;this._stats=o?new _display_utils.StatTimer:null;this._pdfBug=o;this.commonObjs=a.commonObjs;this.objs=new PDFObjects;this._bitmaps=new Set;this.cleanupAfterRender=!1;this.pendingCleanup=!1;this._intentStates=new Map;this._annotationPromises=new Map;this.destroyed=!1}_createClass(PDFPageProxy,[{key:"pageNumber",get:function get(){return this._pageIndex+1}},{key:"rotate",get:function get(){return this._pageInfo.rotate}},{key:"ref",get:function get(){return this._pageInfo.ref}},{key:"userUnit",get:function get(){return this._pageInfo.userUnit}},{key:"view",get:function get(){return this._pageInfo.view}},{key:"getViewport",value:function getViewport(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.scale,a=t.rotation,i=void 0===a?this.rotate:a,o=t.offsetX,l=void 0===o?0:o,c=t.offsetY,u=void 0===c?0:c,d=t.dontFlip,h=void 0!==d&&d;return new _display_utils.PageViewport({viewBox:this.view,scale:r,rotation:i,offsetX:l,offsetY:u,dontFlip:h})}},{key:"getAnnotations",value:function getAnnotations(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.intent,a=void 0===r?"display":r,i=this._transport.getRenderingIntent(a),o=this._annotationPromises.get(i.cacheKey);if(!o){o=this._transport.getAnnotations(this._pageIndex,i.renderingIntent);this._annotationPromises.set(i.cacheKey,o);o=o.then((function(t){var r,a=_createForOfIteratorHelper(t);try{var i=function _loop(){var t=r.value;void 0!==t.titleObj&&Object.defineProperty(t,"title",{get:function get(){(0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead.");return t.titleObj.str}});void 0!==t.contentsObj&&Object.defineProperty(t,"contents",{get:function get(){(0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead.");return t.contentsObj.str}})};for(a.s();!(r=a.n()).done;)i()}catch(t){a.e(t)}finally{a.f()}return t}))}return o}},{key:"getJSActions",value:function getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}},{key:"getXfa",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee3(){var t;return _regeneratorRuntime().wrap((function _callee3$(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null);case 1:case"end":return r.stop()}}),_callee3,this)}))),function getXfa(){return t.apply(this,arguments)})},{key:"render",value:function render(t){var r,a,i,o=this,l=t.canvasContext,c=t.viewport,u=t.intent,d=void 0===u?"display":u,h=t.annotationMode,p=void 0===h?_util.AnnotationMode.ENABLE:h,v=t.transform,y=void 0===v?null:v,g=t.imageLayer,_=void 0===g?null:g,m=t.canvasFactory,b=void 0===m?null:m,A=t.background,k=void 0===A?null:A,P=t.optionalContentConfigPromise,S=void 0===P?null:P,w=t.annotationCanvasMap,x=void 0===w?null:w,C=t.pageColors,T=void 0===C?null:C,E=t.printAnnotationStorage,I=void 0===E?null:E;if(void 0!==(null===(r=arguments[0])||void 0===r?void 0:r.renderInteractiveForms)){(0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead.");!0===arguments[0].renderInteractiveForms&&p===_util.AnnotationMode.ENABLE&&(p=_util.AnnotationMode.ENABLE_FORMS)}if(void 0!==(null===(a=arguments[0])||void 0===a?void 0:a.includeAnnotationStorage)){(0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead.");!0===arguments[0].includeAnnotationStorage&&p===_util.AnnotationMode.ENABLE&&(p=_util.AnnotationMode.ENABLE_STORAGE)}this._stats&&this._stats.time("Overall");var O=this._transport.getRenderingIntent(d,p,I);this.pendingCleanup=!1;S||(S=this._transport.getOptionalContentConfig());var M=this._intentStates.get(O.cacheKey);if(!M){M=Object.create(null);this._intentStates.set(O.cacheKey,M)}if(M.streamReaderCancelTimeout){clearTimeout(M.streamReaderCancelTimeout);M.streamReaderCancelTimeout=null}var R=b||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),D=!!(O.renderingIntent&_util.RenderingIntentFlag.PRINT);if(!M.displayReadyCapability){M.displayReadyCapability=(0,_util.createPromiseCapability)();M.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats&&this._stats.time("Page Request");this._pumpOperatorList(O)}var L=function complete(t){M.renderTasks.delete(G);(o.cleanupAfterRender||D)&&(o.pendingCleanup=!0);o._tryCleanup();if(t){G.capability.reject(t);o._abortOperatorList({intentState:M,reason:t instanceof Error?t:new Error(t)})}else G.capability.resolve();if(o._stats){o._stats.timeEnd("Rendering");o._stats.timeEnd("Overall")}},G=new InternalRenderTask({callback:L,params:{canvasContext:l,viewport:c,transform:y,imageLayer:_,background:k},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:x,operatorList:M.operatorList,pageIndex:this._pageIndex,canvasFactory:R,useRequestAnimationFrame:!D,pdfBug:this._pdfBug,pageColors:T});((i=M).renderTasks||(i.renderTasks=new Set)).add(G);var j=G.task;Promise.all([M.displayReadyCapability.promise,S]).then((function(t){var r=_slicedToArray(t,2),a=r[0],i=r[1];if(o.pendingCleanup)L();else{o._stats&&o._stats.time("Rendering");G.initializeGraphics({transparency:a,optionalContentConfig:i});G.operatorListChanged()}})).catch(L);return j}},{key:"getOperatorList",value:function getOperatorList(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.intent,a=void 0===r?"display":r,i=t.annotationMode,o=void 0===i?_util.AnnotationMode.ENABLE:i,l=t.printAnnotationStorage,c=void 0===l?null:l;function operatorListChanged(){if(h.operatorList.lastChunk){h.opListReadCapability.resolve(h.operatorList);h.renderTasks.delete(u)}}var u,d=this._transport.getRenderingIntent(a,o,c,!0),h=this._intentStates.get(d.cacheKey);if(!h){h=Object.create(null);this._intentStates.set(d.cacheKey,h)}if(!h.opListReadCapability){var p;(u=Object.create(null)).operatorListChanged=operatorListChanged;h.opListReadCapability=(0,_util.createPromiseCapability)();((p=h).renderTasks||(p.renderTasks=new Set)).add(u);h.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats&&this._stats.time("Page Request");this._pumpOperatorList(d)}return h.opListReadCapability.promise}},{key:"streamTextContent",value:function streamTextContent(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.disableCombineTextItems,a=void 0!==r&&r,i=t.includeMarkedContent,o=void 0!==i&&i,l=100;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==a,includeMarkedContent:!0===o},{highWaterMark:l,size:function size(t){return t.items.length}})}},{key:"getTextContent",value:function getTextContent(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((function(t){return _xfa_text.XfaText.textContent(t)}));var r=this.streamTextContent(t);return new Promise((function(t,a){var i=r.getReader(),o={items:[],styles:Object.create(null)};!function pump(){i.read().then((function(r){var a,i=r.value;if(r.done)t(o);else{Object.assign(o.styles,i.styles);(a=o.items).push.apply(a,_toConsumableArray(i.items));pump()}}),a)}()}))}},{key:"getStructTree",value:function getStructTree(){return this._structTreePromise||(this._structTreePromise=this._transport.getStructTree(this._pageIndex))}},{key:"_destroy",value:function _destroy(){this.destroyed=!0;var t,r=[],a=_createForOfIteratorHelper(this._intentStates.values());try{for(a.s();!(t=a.n()).done;){var i=t.value;this._abortOperatorList({intentState:i,reason:new Error("Page was destroyed."),force:!0});if(!i.opListReadCapability){var o,l=_createForOfIteratorHelper(i.renderTasks);try{for(l.s();!(o=l.n()).done;){var c=o.value;r.push(c.completed);c.cancel()}}catch(t){l.e(t)}finally{l.f()}}}}catch(t){a.e(t)}finally{a.f()}this.objs.clear();var u,d=_createForOfIteratorHelper(this._bitmaps);try{for(d.s();!(u=d.n()).done;){u.value.close()}}catch(t){d.e(t)}finally{d.f()}this._bitmaps.clear();this._annotationPromises.clear();this._jsActionsPromise=null;this._structTreePromise=null;this.pendingCleanup=!1;return Promise.all(r)}},{key:"cleanup",value:function cleanup(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.pendingCleanup=!0;return this._tryCleanup(t)}},{key:"_tryCleanup",value:function _tryCleanup(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.pendingCleanup)return!1;var r,a=_createForOfIteratorHelper(this._intentStates.values());try{for(a.s();!(r=a.n()).done;){var i=r.value,o=i.renderTasks,l=i.operatorList;if(o.size>0||!l.lastChunk)return!1}}catch(t){a.e(t)}finally{a.f()}this._intentStates.clear();this.objs.clear();this._annotationPromises.clear();this._jsActionsPromise=null;this._structTreePromise=null;t&&this._stats&&(this._stats=new _display_utils.StatTimer);var c,u=_createForOfIteratorHelper(this._bitmaps);try{for(u.s();!(c=u.n()).done;){var d=c.value;d.close()}}catch(t){u.e(t)}finally{u.f()}this._bitmaps.clear();this.pendingCleanup=!1;return!0}},{key:"_startRenderPage",value:function _startRenderPage(t,r){var a=this._intentStates.get(r);if(a){this._stats&&this._stats.timeEnd("Page Request");a.displayReadyCapability&&a.displayReadyCapability.resolve(t)}}},{key:"_renderPageChunk",value:function _renderPageChunk(t,r){for(var a=0,i=t.length;a<i;a++){r.operatorList.fnArray.push(t.fnArray[a]);r.operatorList.argsArray.push(t.argsArray[a])}r.operatorList.lastChunk=t.lastChunk;r.operatorList.separateAnnots=t.separateAnnots;var o,l=_createForOfIteratorHelper(r.renderTasks);try{for(l.s();!(o=l.n()).done;){o.value.operatorListChanged()}}catch(t){l.e(t)}finally{l.f()}t.lastChunk&&this._tryCleanup()}},{key:"_pumpOperatorList",value:function _pumpOperatorList(t){var r=this,a=t.renderingIntent,i=t.cacheKey,o=t.annotationStorageMap,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:a,cacheKey:i,annotationStorage:o}).getReader(),c=this._intentStates.get(i);c.streamReader=l;!function pump(){l.read().then((function(t){var a=t.value;if(t.done)c.streamReader=null;else if(!r._transport.destroyed){r._renderPageChunk(a,c);pump()}}),(function(t){c.streamReader=null;if(!r._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;var a,i=_createForOfIteratorHelper(c.renderTasks);try{for(i.s();!(a=i.n()).done;){a.value.operatorListChanged()}}catch(t){i.e(t)}finally{i.f()}r._tryCleanup()}if(c.displayReadyCapability)c.displayReadyCapability.reject(t);else{if(!c.opListReadCapability)throw t;c.opListReadCapability.reject(t)}}}))}()}},{key:"_abortOperatorList",value:function _abortOperatorList(t){var r=this,a=t.intentState,i=t.reason,o=t.force,l=void 0!==o&&o;if(a.streamReader){if(!l){if(a.renderTasks.size>0)return;if(i instanceof _display_utils.RenderingCancelledException){a.streamReaderCancelTimeout=setTimeout((function(){r._abortOperatorList({intentState:a,reason:i,force:!0});a.streamReaderCancelTimeout=null}),RENDERING_CANCELLED_TIMEOUT);return}}a.streamReader.cancel(new _util.AbortException(i.message)).catch((function(){}));a.streamReader=null;if(!this._transport.destroyed){var c,u=_createForOfIteratorHelper(this._intentStates);try{for(u.s();!(c=u.n()).done;){var d=_slicedToArray(c.value,2),h=d[0];if(d[1]===a){this._intentStates.delete(h);break}}}catch(t){u.e(t)}finally{u.f()}this.cleanup()}}}},{key:"stats",get:function get(){return this._stats}}]);var t;return PDFPageProxy}();exports.PDFPageProxy=PDFPageProxy;var LoopbackPort=function(){function LoopbackPort(){_classCallCheck(this,LoopbackPort);this._listeners=[];this._deferred=Promise.resolve()}_createClass(LoopbackPort,[{key:"postMessage",value:function postMessage(t,r){var a=this,i={data:structuredClone(t,r)};this._deferred.then((function(){var t,r=_createForOfIteratorHelper(a._listeners);try{for(r.s();!(t=r.n()).done;){t.value.call(a,i)}}catch(t){r.e(t)}finally{r.f()}}))}},{key:"addEventListener",value:function addEventListener(t,r){this._listeners.push(r)}},{key:"removeEventListener",value:function removeEventListener(t,r){var a=this._listeners.indexOf(r);this._listeners.splice(a,1)}},{key:"terminate",value:function terminate(){this._listeners.length=0}}]);return LoopbackPort}();exports.LoopbackPort=LoopbackPort;var PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;if(_is_node.isNodeJS&&"function"==typeof require){PDFWorkerUtil.isWorkerDisabled=!0;PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js"}else if("object"===("undefined"==typeof document?"undefined":_typeof(document))){var _document,_document$currentScri,pdfjsFilePath=null===(_document=document)||void 0===_document||null===(_document$currentScri=_document.currentScript)||void 0===_document$currentScri?void 0:_document$currentScri.src;pdfjsFilePath&&(PDFWorkerUtil.fallbackWorkerSrc=pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(t,r){var a;try{if(!(a=new URL(t)).origin||"null"===a.origin)return!1}catch(t){return!1}var i=new URL(r,a);return a.origin===i.origin};PDFWorkerUtil.createCDNWrapper=function(t){var r='importScripts("'.concat(t,'");');return URL.createObjectURL(new Blob([r]))};var PDFWorker=function(){function PDFWorker(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.name,a=void 0===r?null:r,i=t.port,o=void 0===i?null:i,l=t.verbosity,c=void 0===l?(0,_util.getVerbosityLevel)():l;_classCallCheck(this,PDFWorker);if(o&&_classStaticPrivateFieldSpecGet(PDFWorker,PDFWorker,_workerPorts).has(o))throw new Error("Cannot use more than one PDFWorker per port.");this.name=a;this.destroyed=!1;this.verbosity=c;this._readyCapability=(0,_util.createPromiseCapability)();this._port=null;this._webWorker=null;this._messageHandler=null;if(o){_classStaticPrivateFieldSpecGet(PDFWorker,PDFWorker,_workerPorts).set(o,this);this._initializeFromPort(o)}else this._initialize()}_createClass(PDFWorker,[{key:"promise",get:function get(){return this._readyCapability.promise}},{key:"port",get:function get(){return this._port}},{key:"messageHandler",get:function get(){return this._messageHandler}},{key:"_initializeFromPort",value:function _initializeFromPort(t){this._port=t;this._messageHandler=new _message_handler.MessageHandler("main","worker",t);this._messageHandler.on("ready",(function(){}));this._readyCapability.resolve()}},{key:"_initialize",value:function _initialize(){var t=this;if("undefined"!=typeof Worker&&!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){var r=PDFWorker.workerSrc;try{PDFWorkerUtil.isSameOrigin(window.location.href,r)||(r=PDFWorkerUtil.createCDNWrapper(new URL(r,window.location).href));var a=new Worker(r),i=new _message_handler.MessageHandler("main","worker",a),o=function terminateEarly(){a.removeEventListener("error",l);i.destroy();a.terminate();t.destroyed?t._readyCapability.reject(new Error("Worker was destroyed")):t._setupFakeWorker()},l=function onWorkerError(){t._webWorker||o()};a.addEventListener("error",l);i.on("test",(function(r){a.removeEventListener("error",l);if(t.destroyed)o();else if(r){t._messageHandler=i;t._port=a;t._webWorker=a;t._readyCapability.resolve();i.send("configure",{verbosity:t.verbosity})}else{t._setupFakeWorker();i.destroy();a.terminate()}}));i.on("ready",(function(r){a.removeEventListener("error",l);if(t.destroyed)o();else try{c()}catch(r){t._setupFakeWorker()}}));var c=function sendTest(){var t=new Uint8Array;i.send("test",t,[t.buffer])};c();return}catch(t){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}},{key:"_setupFakeWorker",value:function _setupFakeWorker(){var t=this;if(!PDFWorkerUtil.isWorkerDisabled){(0,_util.warn)("Setting up fake worker.");PDFWorkerUtil.isWorkerDisabled=!0}PDFWorker._setupFakeWorkerGlobal.then((function(r){if(t.destroyed)t._readyCapability.reject(new Error("Worker was destroyed"));else{var a=new LoopbackPort;t._port=a;var i="fake".concat(PDFWorkerUtil.fakeWorkerId++),o=new _message_handler.MessageHandler(i+"_worker",i,a);r.setup(o,a);var l=new _message_handler.MessageHandler(i,i+"_worker",a);t._messageHandler=l;t._readyCapability.resolve();l.send("configure",{verbosity:t.verbosity})}})).catch((function(r){t._readyCapability.reject(new Error('Setting up fake worker failed: "'.concat(r.message,'".')))}))}},{key:"destroy",value:function destroy(){this.destroyed=!0;if(this._webWorker){this._webWorker.terminate();this._webWorker=null}_classStaticPrivateFieldSpecGet(PDFWorker,PDFWorker,_workerPorts).delete(this._port);this._port=null;if(this._messageHandler){this._messageHandler.destroy();this._messageHandler=null}}}],[{key:"fromPort",value:function fromPort(t){if(null==t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return _classStaticPrivateFieldSpecGet(this,PDFWorker,_workerPorts).has(t.port)?_classStaticPrivateFieldSpecGet(this,PDFWorker,_workerPorts).get(t.port):new PDFWorker(t)}},{key:"workerSrc",get:function get(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc){_is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');return PDFWorkerUtil.fallbackWorkerSrc}throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}},{key:"_mainThreadWorkerMessageHandler",get:function get(){try{var t;return(null===(t=globalThis.pdfjsWorker)||void 0===t?void 0:t.WorkerMessageHandler)||null}catch(t){return null}}},{key:"_setupFakeWorkerGlobal",get:function get(){var _this11=this,loader=function(){var _ref15=_asyncToGenerator(_regeneratorRuntime().mark((function _callee4(){var mainWorkerMessageHandler,worker;return _regeneratorRuntime().wrap((function _callee4$(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:mainWorkerMessageHandler=_this11._mainThreadWorkerMessageHandler;if(!mainWorkerMessageHandler){_context4.next=3;break}return _context4.abrupt("return",mainWorkerMessageHandler);case 3:if(!_is_node.isNodeJS||"function"!=typeof require){_context4.next=6;break}worker=eval("require")(_this11.workerSrc);return _context4.abrupt("return",worker.WorkerMessageHandler);case 6:_context4.next=8;return(0,_display_utils.loadScript)(_this11.workerSrc);case 8:return _context4.abrupt("return",window.pdfjsWorker.WorkerMessageHandler);case 9:case"end":return _context4.stop()}}),_callee4)})));return function loader(){return _ref15.apply(this,arguments)}}();return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}]);return PDFWorker}();exports.PDFWorker=PDFWorker;var _workerPorts={writable:!0,value:new WeakMap};PDFWorker.getWorkerSrc=function(){(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead.");return this.workerSrc};var _docStats=new WeakMap,_pageCache=new WeakMap,_pagePromises=new WeakMap,_metadataPromise=new WeakMap,WorkerTransport=function(){function WorkerTransport(t,r,a,i){_classCallCheck(this,WorkerTransport);_classPrivateFieldInitSpec(this,_docStats,{writable:!0,value:null});_classPrivateFieldInitSpec(this,_pageCache,{writable:!0,value:new Map});_classPrivateFieldInitSpec(this,_pagePromises,{writable:!0,value:new Map});_classPrivateFieldInitSpec(this,_metadataPromise,{writable:!0,value:null});this.messageHandler=t;this.loadingTask=r;this.commonObjs=new PDFObjects;this.fontLoader=new _font_loader.FontLoader({docId:r.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:i.ownerDocument,styleElement:i.styleElement});this._params=i;if(!i.useWorkerFetch){this.CMapReaderFactory=new i.CMapReaderFactory({baseUrl:i.cMapUrl,isCompressed:i.cMapPacked});this.StandardFontDataFactory=new i.StandardFontDataFactory({baseUrl:i.standardFontDataUrl})}this.destroyed=!1;this.destroyCapability=null;this._passwordCapability=null;this._networkStream=a;this._fullReader=null;this._lastProgress=null;this.downloadInfoCapability=(0,_util.createPromiseCapability)();this.setupMessageHandler()}_createClass(WorkerTransport,[{key:"annotationStorage",get:function get(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}},{key:"stats",get:function get(){return _classPrivateFieldGet(this,_docStats)}},{key:"getRenderingIntent",value:function getRenderingIntent(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_util.AnnotationMode.ENABLE,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=_util.RenderingIntentFlag.DISPLAY,l=null;switch(t){case"any":o=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":o=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)("getRenderingIntent - invalid intent: ".concat(t))}switch(r){case _util.AnnotationMode.DISABLE:o+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:o+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:var c=(o+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE)&_util.RenderingIntentFlag.PRINT&&a instanceof _annotation_storage.PrintAnnotationStorage?a:this.annotationStorage;l=c.serializable;break;default:(0,_util.warn)("getRenderingIntent - invalid annotationMode: ".concat(r))}i&&(o+=_util.RenderingIntentFlag.OPLIST);return{renderingIntent:o,cacheKey:"".concat(o,"_").concat(_annotation_storage.AnnotationStorage.getHash(l)),annotationStorageMap:l}}},{key:"destroy",value:function destroy(){var t=this;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=(0,_util.createPromiseCapability)();this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));var r,a=[],i=_createForOfIteratorHelper(_classPrivateFieldGet(this,_pageCache).values());try{for(i.s();!(r=i.n()).done;){var o=r.value;a.push(o._destroy())}}catch(t){i.e(t)}finally{i.f()}_classPrivateFieldGet(this,_pageCache).clear();_classPrivateFieldGet(this,_pagePromises).clear();this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();var l=this.messageHandler.sendWithPromise("Terminate",null);a.push(l);Promise.all(a).then((function(){t.commonObjs.clear();t.fontLoader.clear();_classPrivateFieldSet(t,_metadataPromise,null);t._getFieldObjectsPromise=null;t._hasJSActionsPromise=null;t._networkStream&&t._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));if(t.messageHandler){t.messageHandler.destroy();t.messageHandler=null}t.destroyCapability.resolve()}),this.destroyCapability.reject);return this.destroyCapability.promise}},{key:"setupMessageHandler",value:function setupMessageHandler(){var t=this,r=this.messageHandler,a=this.loadingTask;r.on("GetReader",(function(r,a){(0,_util.assert)(t._networkStream,"GetReader - no `IPDFStream` instance available.");t._fullReader=t._networkStream.getFullReader();t._fullReader.onProgress=function(r){t._lastProgress={loaded:r.loaded,total:r.total}};a.onPull=function(){t._fullReader.read().then((function(t){var r=t.value;if(t.done)a.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(r),"GetReader - expected an ArrayBuffer.");a.enqueue(new Uint8Array(r),1,[r])}})).catch((function(t){a.error(t)}))};a.onCancel=function(r){t._fullReader.cancel(r);a.ready.catch((function(r){if(!t.destroyed)throw r}))}}));r.on("ReaderHeadersReady",(function(r){var i=(0,_util.createPromiseCapability)(),o=t._fullReader;o.headersReady.then((function(){if(!o.isStreamingSupported||!o.isRangeSupported){if(t._lastProgress){var r;null===(r=a.onProgress)||void 0===r||r.call(a,t._lastProgress)}o.onProgress=function(t){var r;null===(r=a.onProgress)||void 0===r||r.call(a,{loaded:t.loaded,total:t.total})}}i.resolve({isStreamingSupported:o.isStreamingSupported,isRangeSupported:o.isRangeSupported,contentLength:o.contentLength})}),i.reject);return i.promise}));r.on("GetRangeReader",(function(r,a){(0,_util.assert)(t._networkStream,"GetRangeReader - no `IPDFStream` instance available.");var i=t._networkStream.getRangeReader(r.begin,r.end);if(i){a.onPull=function(){i.read().then((function(t){var r=t.value;if(t.done)a.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(r),"GetRangeReader - expected an ArrayBuffer.");a.enqueue(new Uint8Array(r),1,[r])}})).catch((function(t){a.error(t)}))};a.onCancel=function(r){i.cancel(r);a.ready.catch((function(r){if(!t.destroyed)throw r}))}}else a.close()}));r.on("GetDoc",(function(r){var i=r.pdfInfo;t._numPages=i.numPages;t._htmlForXfa=i.htmlForXfa;delete i.htmlForXfa;a._capability.resolve(new PDFDocumentProxy(i,t))}));r.on("DocException",(function(t){var r;switch(t.name){case"PasswordException":r=new _util.PasswordException(t.message,t.code);break;case"InvalidPDFException":r=new _util.InvalidPDFException(t.message);break;case"MissingPDFException":r=new _util.MissingPDFException(t.message);break;case"UnexpectedResponseException":r=new _util.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":r=new _util.UnknownErrorException(t.message,t.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}a._capability.reject(r)}));r.on("PasswordRequest",(function(r){t._passwordCapability=(0,_util.createPromiseCapability)();if(a.onPassword){try{a.onPassword((function updatePassword(r){r instanceof Error?t._passwordCapability.reject(r):t._passwordCapability.resolve({password:r})}),r.code)}catch(r){t._passwordCapability.reject(r)}}else t._passwordCapability.reject(new _util.PasswordException(r.message,r.code));return t._passwordCapability.promise}));r.on("DataLoaded",(function(r){var i;null===(i=a.onProgress)||void 0===i||i.call(a,{loaded:r.length,total:r.length});t.downloadInfoCapability.resolve(r)}));r.on("StartRenderPage",(function(r){if(!t.destroyed){_classPrivateFieldGet(t,_pageCache).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}}));r.on("commonobj",(function(a){var i,o=_slicedToArray(a,3),l=o[0],c=o[1],u=o[2];if(!t.destroyed&&!t.commonObjs.has(l))switch(c){case"Font":var d=t._params;if("error"in u){var h=u.error;(0,_util.warn)("Error during font loading: ".concat(h));t.commonObjs.resolve(l,h);break}var p=null;d.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled&&(p={registerFont:function registerFont(t,r){globalThis.FontInspector.fontAdded(t,r)}});var v=new _font_loader.FontFaceObject(u,{isEvalSupported:d.isEvalSupported,disableFontFace:d.disableFontFace,ignoreErrors:d.ignoreErrors,onUnsupportedFeature:t._onUnsupportedFeature.bind(t),fontRegistry:p});t.fontLoader.bind(v).catch((function(t){return r.sendWithPromise("FontFallback",{id:l})})).finally((function(){!d.fontExtraProperties&&v.data&&(v.data=null);t.commonObjs.resolve(l,v)}));break;case"FontPath":case"Image":t.commonObjs.resolve(l,u);break;default:throw new Error("Got unknown common object type ".concat(c))}}));r.on("obj",(function(r){var a=_slicedToArray(r,4),i=a[0],o=a[1],l=a[2],c=a[3];if(!t.destroyed){var u=_classPrivateFieldGet(t,_pageCache).get(o);if(!u.objs.has(i))switch(l){case"Image":u.objs.resolve(i,c);if(c){var d;if(c.bitmap){var h=c.bitmap;d=c.width*c.height*4;u._bitmaps.add(h)}else{var p;d=(null===(p=c.data)||void 0===p?void 0:p.length)||0}d>8e6&&(u.cleanupAfterRender=!0)}break;case"Pattern":u.objs.resolve(i,c);break;default:throw new Error("Got unknown object type ".concat(l))}}}));r.on("DocProgress",(function(r){var i;t.destroyed||null===(i=a.onProgress)||void 0===i||i.call(a,{loaded:r.loaded,total:r.total})}));r.on("DocStats",(function(r){t.destroyed||_classPrivateFieldSet(t,_docStats,Object.freeze({streamTypes:Object.freeze(r.streamTypes),fontTypes:Object.freeze(r.fontTypes)}))}));r.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this));r.on("FetchBuiltInCMap",(function(r){return t.destroyed?Promise.reject(new Error("Worker was destroyed.")):t.CMapReaderFactory?t.CMapReaderFactory.fetch(r):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))}));r.on("FetchStandardFontData",(function(r){return t.destroyed?Promise.reject(new Error("Worker was destroyed.")):t.StandardFontDataFactory?t.StandardFontDataFactory.fetch(r):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))}))}},{key:"_onUnsupportedFeature",value:function _onUnsupportedFeature(t){var r,a,i=t.featureId;this.destroyed||null===(r=(a=this.loadingTask).onUnsupportedFeature)||void 0===r||r.call(a,i)}},{key:"getData",value:function getData(){return this.messageHandler.sendWithPromise("GetData",null)}},{key:"getPage",value:function getPage(t){var r=this;if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));var a=t-1,i=_classPrivateFieldGet(this,_pagePromises).get(a);if(i)return i;var o=this.messageHandler.sendWithPromise("GetPage",{pageIndex:a}).then((function(t){if(r.destroyed)throw new Error("Transport destroyed");var i=new PDFPageProxy(a,t,r,r._params.ownerDocument,r._params.pdfBug);_classPrivateFieldGet(r,_pageCache).set(a,i);return i}));_classPrivateFieldGet(this,_pagePromises).set(a,o);return o}},{key:"getPageIndex",value:function getPageIndex(t){return"object"!==_typeof(t)||null===t||!Number.isInteger(t.num)||t.num<0||!Number.isInteger(t.gen)||t.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen})}},{key:"getAnnotations",value:function getAnnotations(t,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:r})}},{key:"saveDocument",value:function saveDocument(){var t,r,a=this;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:null!==(t=null===(r=this._fullReader)||void 0===r?void 0:r.filename)&&void 0!==t?t:null}).finally((function(){a.annotationStorage.resetModified()}))}},{key:"getFieldObjects",value:function getFieldObjects(){return this._getFieldObjectsPromise||(this._getFieldObjectsPromise=this.messageHandler.sendWithPromise("GetFieldObjects",null))}},{key:"hasJSActions",value:function hasJSActions(){return this._hasJSActionsPromise||(this._hasJSActionsPromise=this.messageHandler.sendWithPromise("HasJSActions",null))}},{key:"getCalculationOrderIds",value:function getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}},{key:"getDestinations",value:function getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}},{key:"getDestination",value:function getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}},{key:"getPageLabels",value:function getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}},{key:"getPageLayout",value:function getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}},{key:"getPageMode",value:function getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}},{key:"getViewerPreferences",value:function getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}},{key:"getOpenAction",value:function getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}},{key:"getAttachments",value:function getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}},{key:"getJavaScript",value:function getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}},{key:"getDocJSActions",value:function getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}},{key:"getPageJSActions",value:function getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}},{key:"getStructTree",value:function getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}},{key:"getOutline",value:function getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}},{key:"getOptionalContentConfig",value:function getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((function(t){return new _optional_content_config.OptionalContentConfig(t)}))}},{key:"getPermissions",value:function getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}},{key:"getMetadata",value:function getMetadata(){var t=this;return _classPrivateFieldGet(this,_metadataPromise)||_classPrivateFieldSet(this,_metadataPromise,this.messageHandler.sendWithPromise("GetMetadata",null).then((function(r){var a,i,o,l;return{info:r[0],metadata:r[1]?new _metadata.Metadata(r[1]):null,contentDispositionFilename:null!==(a=null===(i=t._fullReader)||void 0===i?void 0:i.filename)&&void 0!==a?a:null,contentLength:null!==(o=null===(l=t._fullReader)||void 0===l?void 0:l.contentLength)&&void 0!==o?o:null}})))}},{key:"getMarkInfo",value:function getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}},{key:"startCleanup",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee5(){var t,r,a,i,o=arguments;return _regeneratorRuntime().wrap((function _callee5$(l){for(;;)switch(l.prev=l.next){case 0:t=o.length>0&&void 0!==o[0]&&o[0];l.next=3;return this.messageHandler.sendWithPromise("Cleanup",null);case 3:if(!this.destroyed){l.next=5;break}return l.abrupt("return");case 5:r=_createForOfIteratorHelper(_classPrivateFieldGet(this,_pageCache).values());l.prev=6;r.s();case 8:if((a=r.n()).done){l.next=15;break}if((i=a.value).cleanup()){l.next=13;break}throw new Error("startCleanup: Page ".concat(i.pageNumber," is currently rendering."));case 13:l.next=8;break;case 15:l.next=20;break;case 17:l.prev=17;l.t0=l.catch(6);r.e(l.t0);case 20:l.prev=20;r.f();return l.finish(20);case 23:this.commonObjs.clear();t||this.fontLoader.clear();_classPrivateFieldSet(this,_metadataPromise,null);this._getFieldObjectsPromise=null;this._hasJSActionsPromise=null;case 28:case"end":return l.stop()}}),_callee5,this,[[6,17,20,23]])}))),function startCleanup(){return t.apply(this,arguments)})},{key:"loadingParams",get:function get(){var t=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch,enableXfa:t.enableXfa})}}]);var t;return WorkerTransport}(),_objs=new WeakMap,_ensureObj=new WeakSet,PDFObjects=function(){function PDFObjects(){_classCallCheck(this,PDFObjects);_classPrivateMethodInitSpec(this,_ensureObj);_classPrivateFieldInitSpec(this,_objs,{writable:!0,value:Object.create(null)})}_createClass(PDFObjects,[{key:"get",value:function get(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(r){var a=_classPrivateMethodGet(this,_ensureObj,_ensureObj2).call(this,t);a.capability.promise.then((function(){return r(a.data)}));return null}var i=_classPrivateFieldGet(this,_objs)[t];if(null==i||!i.capability.settled)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}},{key:"has",value:function has(t){var r=_classPrivateFieldGet(this,_objs)[t];return(null==r?void 0:r.capability.settled)||!1}},{key:"resolve",value:function resolve(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=_classPrivateMethodGet(this,_ensureObj,_ensureObj2).call(this,t);a.data=r;a.capability.resolve()}},{key:"clear",value:function clear(){_classPrivateFieldSet(this,_objs,Object.create(null))}}]);return PDFObjects}();function _ensureObj2(t){var r=_classPrivateFieldGet(this,_objs)[t];return r||(_classPrivateFieldGet(this,_objs)[t]={capability:(0,_util.createPromiseCapability)(),data:null})}var _internalRenderTask=new WeakMap,RenderTask=function(){function RenderTask(t){_classCallCheck(this,RenderTask);_classPrivateFieldInitSpec(this,_internalRenderTask,{writable:!0,value:null});_classPrivateFieldSet(this,_internalRenderTask,t);this.onContinue=null}_createClass(RenderTask,[{key:"promise",get:function get(){return _classPrivateFieldGet(this,_internalRenderTask).capability.promise}},{key:"cancel",value:function cancel(){_classPrivateFieldGet(this,_internalRenderTask).cancel()}},{key:"separateAnnots",get:function get(){var t=_classPrivateFieldGet(this,_internalRenderTask).operatorList.separateAnnots;if(!t)return!1;var r=_classPrivateFieldGet(this,_internalRenderTask).annotationCanvasMap;return t.form||t.canvas&&(null==r?void 0:r.size)>0}}]);return RenderTask}();exports.RenderTask=RenderTask;var InternalRenderTask=function(){function InternalRenderTask(t){var r=t.callback,a=t.params,i=t.objs,o=t.commonObjs,l=t.annotationCanvasMap,c=t.operatorList,u=t.pageIndex,d=t.canvasFactory,h=t.useRequestAnimationFrame,p=void 0!==h&&h,v=t.pdfBug,y=void 0!==v&&v,g=t.pageColors,_=void 0===g?null:g;_classCallCheck(this,InternalRenderTask);this.callback=r;this.params=a;this.objs=i;this.commonObjs=o;this.annotationCanvasMap=l;this.operatorListIdx=null;this.operatorList=c;this._pageIndex=u;this.canvasFactory=d;this._pdfBug=y;this.pageColors=_;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===p&&"undefined"!=typeof window;this.cancelled=!1;this.capability=(0,_util.createPromiseCapability)();this.task=new RenderTask(this);this._cancelBound=this.cancel.bind(this);this._continueBound=this._continue.bind(this);this._scheduleNextBound=this._scheduleNext.bind(this);this._nextBound=this._next.bind(this);this._canvas=a.canvasContext.canvas}_createClass(InternalRenderTask,[{key:"completed",get:function get(){return this.capability.promise.catch((function(){}))}},{key:"initializeGraphics",value:function initializeGraphics(t){var r,a=t.transparency,i=void 0!==a&&a,o=t.optionalContentConfig;if(!this.cancelled){if(this._canvas){if(_classStaticPrivateFieldSpecGet(InternalRenderTask,InternalRenderTask,_canvasInUse).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");_classStaticPrivateFieldSpecGet(InternalRenderTask,InternalRenderTask,_canvasInUse).add(this._canvas)}if(this._pdfBug&&null!==(r=globalThis.StepperManager)&&void 0!==r&&r.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}var l=this.params,c=l.canvasContext,u=l.viewport,d=l.transform,h=l.imageLayer,p=l.background;this.gfx=new _canvas.CanvasGraphics(c,this.commonObjs,this.objs,this.canvasFactory,h,o,this.annotationCanvasMap,this.pageColors);this.gfx.beginDrawing({transform:d,viewport:u,transparency:i,background:p});this.operatorListIdx=0;this.graphicsReady=!0;this.graphicsReadyCallback&&this.graphicsReadyCallback()}}},{key:"cancel",value:function cancel(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.running=!1;this.cancelled=!0;this.gfx&&this.gfx.endDrawing();this._canvas&&_classStaticPrivateFieldSpecGet(InternalRenderTask,InternalRenderTask,_canvasInUse).delete(this._canvas);this.callback(t||new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this._pageIndex+1),"canvas"))}},{key:"operatorListChanged",value:function operatorListChanged(){if(this.graphicsReady){this.stepper&&this.stepper.updateOperatorList(this.operatorList);this.running||this._continue()}else this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}},{key:"_continue",value:function _continue(){this.running=!0;this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}},{key:"_scheduleNext",value:function _scheduleNext(){var t=this;this._useRequestAnimationFrame?window.requestAnimationFrame((function(){t._nextBound().catch(t._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}},{key:"_next",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee6(){return _regeneratorRuntime().wrap((function _callee6$(t){for(;;)switch(t.prev=t.next){case 0:if(!this.cancelled){t.next=2;break}return t.abrupt("return");case 2:this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper);if(this.operatorListIdx===this.operatorList.argsArray.length){this.running=!1;if(this.operatorList.lastChunk){this.gfx.endDrawing();this._canvas&&_classStaticPrivateFieldSpecGet(InternalRenderTask,InternalRenderTask,_canvasInUse).delete(this._canvas);this.callback()}}case 4:case"end":return t.stop()}}),_callee6,this)}))),function _next(){return t.apply(this,arguments)})}]);var t;return InternalRenderTask}(),_canvasInUse={writable:!0,value:new WeakSet},version="2.15.349";exports.version=version;var build="b8aa9c622";exports.build=build},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PrintAnnotationStorage=r.AnnotationStorage=void 0;var i=a(1),o=a(133),l=a(135);function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}var c=new WeakSet,u=function(){function AnnotationStorage(){_classCallCheck(this,AnnotationStorage);!function _classPrivateMethodInitSpec(t,r){_checkPrivateRedeclaration(t,r);r.add(t)}(this,c);this._storage=new Map;this._modified=!1;this.onSetModified=null;this.onResetModified=null}_createClass(AnnotationStorage,[{key:"getValue",value:function getValue(t,r){var a=this._storage.get(t);return void 0===a?r:Object.assign(r,a)}},{key:"getRawValue",value:function getRawValue(t){return this._storage.get(t)}},{key:"removeKey",value:function removeKey(t){this._storage.delete(t);0===this._storage.size&&this.resetModified()}},{key:"setValue",value:function setValue(t,r){var a=this._storage.get(t),i=!1;if(void 0!==a)for(var o=0,l=Object.entries(r);o<l.length;o++){var u=_slicedToArray(l[o],2),d=u[0],h=u[1];if(a[d]!==h){i=!0;a[d]=h}}else{i=!0;this._storage.set(t,r)}i&&function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}(this,c,_setModified2).call(this)}},{key:"has",value:function has(t){return this._storage.has(t)}},{key:"getAll",value:function getAll(){return this._storage.size>0?(0,i.objectFromMap)(this._storage):null}},{key:"size",get:function get(){return this._storage.size}},{key:"resetModified",value:function resetModified(){if(this._modified){this._modified=!1;"function"==typeof this.onResetModified&&this.onResetModified()}}},{key:"print",get:function get(){return new h(this)}},{key:"serializable",get:function get(){if(0===this._storage.size)return null;var t,r=new Map,a=_createForOfIteratorHelper(this._storage);try{for(a.s();!(t=a.n()).done;){var i=_slicedToArray(t.value,2),l=i[0],c=i[1],u=c instanceof o.AnnotationEditor?c.serialize():c;u&&r.set(l,u)}}catch(t){a.e(t)}finally{a.f()}return r}}],[{key:"getHash",value:function getHash(t){if(!t)return"";var r,a=new l.MurmurHash3_64,i=_createForOfIteratorHelper(t);try{for(i.s();!(r=i.n()).done;){var o=_slicedToArray(r.value,2),c=o[0],u=o[1];a.update("".concat(c,":").concat(JSON.stringify(u)))}}catch(t){i.e(t)}finally{i.f()}return a.hexdigest()}}]);return AnnotationStorage}();r.AnnotationStorage=u;function _setModified2(){if(!this._modified){this._modified=!0;"function"==typeof this.onSetModified&&this.onSetModified()}}var d=new WeakMap,h=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}(PrintAnnotationStorage,t);var r=_createSuper(PrintAnnotationStorage);function PrintAnnotationStorage(t){var a;_classCallCheck(this,PrintAnnotationStorage);!function _classPrivateFieldInitSpec(t,r,a){_checkPrivateRedeclaration(t,r);r.set(t,a)}(_assertThisInitialized(a=r.call(this)),d,{writable:!0,value:null});_classPrivateFieldSet(_assertThisInitialized(a),d,structuredClone(t.serializable));return a}_createClass(PrintAnnotationStorage,[{key:"print",get:function get(){(0,i.unreachable)("Should not call PrintAnnotationStorage.print")}},{key:"serializable",get:function get(){return function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){return r.get?r.get.call(t):r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}(this,d)}}]);return PrintAnnotationStorage}(u);r.PrintAnnotationStorage=h},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.AnnotationEditor=void 0;var i=a(134),o=a(1);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _classPrivateFieldInitSpec(t,r,a){!function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,r);r.set(t,a)}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){if(r.get)return r.get.call(t);return r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}var l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap,v=function(){function AnnotationEditor(t){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,AnnotationEditor);_classPrivateFieldInitSpec(this,l,{writable:!0,value:this.focusin.bind(this)});_classPrivateFieldInitSpec(this,c,{writable:!0,value:this.focusout.bind(this)});_classPrivateFieldInitSpec(this,u,{writable:!0,value:!1});_classPrivateFieldInitSpec(this,d,{writable:!0,value:!1});_classPrivateFieldInitSpec(this,h,{writable:!0,value:!1});_classPrivateFieldInitSpec(this,p,{writable:!0,value:AnnotationEditor._zIndex++});this.constructor===AnnotationEditor&&(0,o.unreachable)("Cannot initialize AnnotationEditor.");this.parent=t.parent;this.id=t.id;this.width=this.height=null;this.pageIndex=t.parent.pageIndex;this.name=t.name;this.div=null;var r=_slicedToArray(this.parent.viewportBaseDimensions,2),a=r[0],i=r[1];this.x=t.x/a;this.y=t.y/i;this.rotation=this.parent.viewport.rotation;this.isAttachedToDOM=!1}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(AnnotationEditor,[{key:"setInBackground",value:function setInBackground(){this.div.style.zIndex=0}},{key:"setInForeground",value:function setInForeground(){this.div.style.zIndex=_classPrivateFieldGet(this,p)}},{key:"focusin",value:function focusin(t){_classPrivateFieldGet(this,u)?_classPrivateFieldSet(this,u,!1):this.parent.setSelected(this)}},{key:"focusout",value:function focusout(t){if(this.isAttachedToDOM){var r=t.relatedTarget;if(null==r||!r.closest("#".concat(this.id))){t.preventDefault();this.parent.isMultipleSelection||this.commitOrRemove()}}}},{key:"commitOrRemove",value:function commitOrRemove(){this.isEmpty()?this.remove():this.commit()}},{key:"commit",value:function commit(){this.parent.addToAnnotationStorage(this)}},{key:"dragstart",value:function dragstart(t){var r=this.parent.div.getBoundingClientRect();this.startX=t.clientX-r.x;this.startY=t.clientY-r.y;t.dataTransfer.setData("text/plain",this.id);t.dataTransfer.effectAllowed="move"}},{key:"setAt",value:function setAt(t,r,a,i){var o=_slicedToArray(this.parent.viewportBaseDimensions,2),l=o[0],c=o[1],u=_slicedToArray(this.screenToPageTranslation(a,i),2);a=u[0];i=u[1];this.x=(t+a)/l;this.y=(r+i)/c;this.div.style.left="".concat(100*this.x,"%");this.div.style.top="".concat(100*this.y,"%")}},{key:"translate",value:function translate(t,r){var a=_slicedToArray(this.parent.viewportBaseDimensions,2),i=a[0],o=a[1],l=_slicedToArray(this.screenToPageTranslation(t,r),2);t=l[0];r=l[1];this.x+=t/i;this.y+=r/o;this.div.style.left="".concat(100*this.x,"%");this.div.style.top="".concat(100*this.y,"%")}},{key:"screenToPageTranslation",value:function screenToPageTranslation(t,r){switch(this.parent.viewport.rotation){case 90:return[r,-t];case 180:return[-t,-r];case 270:return[-r,t];default:return[t,r]}}},{key:"setDims",value:function setDims(t,r){var a=_slicedToArray(this.parent.viewportBaseDimensions,2),i=a[0],o=a[1];this.div.style.width="".concat(100*t/i,"%");this.div.style.height="".concat(100*r/o,"%")}},{key:"getInitialTranslation",value:function getInitialTranslation(){return[0,0]}},{key:"render",value:function render(){this.div=document.createElement("div");this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360);this.div.className=this.name;this.div.setAttribute("id",this.id);this.div.setAttribute("tabIndex",0);this.setInForeground();this.div.addEventListener("focusin",_classPrivateFieldGet(this,l));this.div.addEventListener("focusout",_classPrivateFieldGet(this,c));var t=_slicedToArray(this.getInitialTranslation(),2),r=t[0],a=t[1];this.translate(r,a);(0,i.bindEvents)(this,this.div,["dragstart","pointerdown"]);return this.div}},{key:"pointerdown",value:function pointerdown(t){var r=i.KeyboardManager.platform.isMac;if(0!==t.button||t.ctrlKey&&r)t.preventDefault();else{t.ctrlKey&&!r||t.shiftKey||t.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this);_classPrivateFieldSet(this,u,!0)}}},{key:"getRect",value:function getRect(t,r){var a=_slicedToArray(this.parent.viewportBaseDimensions,2),i=a[0],o=a[1],l=_slicedToArray(this.parent.pageDimensions,2),c=l[0],u=l[1],d=c*t/i,h=u*r/o,p=this.x*c,v=this.y*u,y=this.width*c,g=this.height*u;switch(this.rotation){case 0:return[p+d,u-v-h-g,p+d+y,u-v-h];case 90:return[p+h,u-v+d,p+h+g,u-v+d+y];case 180:return[p-d-y,u-v+h,p-d,u-v+h+g];case 270:return[p-h-g,u-v-d-y,p-h,u-v-d];default:throw new Error("Invalid rotation")}}},{key:"getRectInCurrentCoords",value:function getRectInCurrentCoords(t,r){var a=_slicedToArray(t,4),i=a[0],o=a[1],l=a[2],c=a[3],u=l-i,d=c-o;switch(this.rotation){case 0:return[i,r-c,u,d];case 90:return[i,r-o,d,u];case 180:return[l,r-o,u,d];case 270:return[l,r-c,d,u];default:throw new Error("Invalid rotation")}}},{key:"onceAdded",value:function onceAdded(){}},{key:"isEmpty",value:function isEmpty(){return!1}},{key:"enableEditMode",value:function enableEditMode(){_classPrivateFieldSet(this,h,!0)}},{key:"disableEditMode",value:function disableEditMode(){_classPrivateFieldSet(this,h,!1)}},{key:"isInEditMode",value:function isInEditMode(){return _classPrivateFieldGet(this,h)}},{key:"shouldGetKeyboardEvents",value:function shouldGetKeyboardEvents(){return!1}},{key:"needsToBeRebuilt",value:function needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}},{key:"rebuild",value:function rebuild(){var t;null===(t=this.div)||void 0===t||t.addEventListener("focusin",_classPrivateFieldGet(this,l))}},{key:"serialize",value:function serialize(){(0,o.unreachable)("An editor must be serializable")}},{key:"remove",value:function remove(){this.div.removeEventListener("focusin",_classPrivateFieldGet(this,l));this.div.removeEventListener("focusout",_classPrivateFieldGet(this,c));this.isEmpty()||this.commit();this.parent.remove(this)}},{key:"select",value:function select(){var t;null===(t=this.div)||void 0===t||t.classList.add("selectedEditor")}},{key:"unselect",value:function unselect(){var t;null===(t=this.div)||void 0===t||t.classList.remove("selectedEditor")}},{key:"updateParams",value:function updateParams(t,r){}},{key:"disableEditing",value:function disableEditing(){}},{key:"enableEditing",value:function enableEditing(){}},{key:"getIdForTextLayer",value:function getIdForTextLayer(){return this.id}},{key:"propertiesToUpdate",get:function get(){return{}}},{key:"contentDiv",get:function get(){return this.div}},{key:"isEditing",get:function get(){return _classPrivateFieldGet(this,d)},set:function set(t){_classPrivateFieldSet(this,d,t);if(t){this.parent.setSelected(this);this.parent.setActiveEditor(this)}else this.parent.setActiveEditor(null)}}],[{key:"_defaultLineColor",get:function get(){return(0,o.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}},{key:"deserialize",value:function deserialize(t,r){var a=new this.prototype.constructor({parent:r,id:r.getNextId()});a.rotation=t.rotation;var i=_slicedToArray(r.pageDimensions,2),o=i[0],l=i[1],c=_slicedToArray(a.getRectInCurrentCoords(t.rect,l),4),u=c[0],d=c[1],h=c[2],p=c[3];a.x=u/o;a.y=d/l;a.width=h/o;a.height=p/l;return a}}]);return AnnotationEditor}();r.AnnotationEditor=v;_defineProperty(v,"_colorManager",new i.ColorManager);_defineProperty(v,"_zIndex",1)},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.KeyboardManager=r.CommandManager=r.ColorManager=r.AnnotationEditorUIManager=void 0;r.bindEvents=function bindEvents(t,r,a){var i,o=_createForOfIteratorHelper(a);try{for(o.s();!(i=o.n()).done;){var l=i.value;r.addEventListener(l,t[l].bind(t))}}catch(t){o.e(t)}finally{o.f()}};r.opacityToHex=function opacityToHex(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")};var i=a(1),o=a(129);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _classPrivateMethodInitSpec(t,r){_checkPrivateRedeclaration(t,r);r.add(t)}function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _classPrivateFieldInitSpec(t,r,a){_checkPrivateRedeclaration(t,r);r.set(t,a)}function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){if(r.get)return r.get.call(t);return r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}var l=new WeakMap,c=function(){function IdManager(){_classCallCheck(this,IdManager);_classPrivateFieldInitSpec(this,l,{writable:!0,value:0})}_createClass(IdManager,[{key:"getId",value:function getId(){var t,r;return"".concat(i.AnnotationEditorPrefix).concat((_classPrivateFieldSet(this,l,(t=_classPrivateFieldGet(this,l),r=t++,t)),r))}}]);return IdManager}(),u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap,v=function(){function CommandManager(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;_classCallCheck(this,CommandManager);_classPrivateFieldInitSpec(this,u,{writable:!0,value:[]});_classPrivateFieldInitSpec(this,d,{writable:!0,value:!1});_classPrivateFieldInitSpec(this,h,{writable:!0,value:void 0});_classPrivateFieldInitSpec(this,p,{writable:!0,value:-1});_classPrivateFieldSet(this,h,t)}_createClass(CommandManager,[{key:"add",value:function add(t){var r=t.cmd,a=t.undo,i=t.mustExec,o=t.type,l=void 0===o?NaN:o,c=t.overwriteIfSameType,v=void 0!==c&&c,y=t.keepUndo,g=void 0!==y&&y;i&&r();if(!_classPrivateFieldGet(this,d)){var _={cmd:r,undo:a,type:l};if(-1!==_classPrivateFieldGet(this,p))if(v&&_classPrivateFieldGet(this,u)[_classPrivateFieldGet(this,p)].type===l){g&&(_.undo=_classPrivateFieldGet(this,u)[_classPrivateFieldGet(this,p)].undo);_classPrivateFieldGet(this,u)[_classPrivateFieldGet(this,p)]=_}else{var m=_classPrivateFieldGet(this,p)+1;if(m===_classPrivateFieldGet(this,h))_classPrivateFieldGet(this,u).splice(0,1);else{_classPrivateFieldSet(this,p,m);m<_classPrivateFieldGet(this,u).length&&_classPrivateFieldGet(this,u).splice(m)}_classPrivateFieldGet(this,u).push(_)}else{_classPrivateFieldGet(this,u).length>0&&(_classPrivateFieldGet(this,u).length=0);_classPrivateFieldSet(this,p,0);_classPrivateFieldGet(this,u).push(_)}}}},{key:"undo",value:function undo(){if(-1!==_classPrivateFieldGet(this,p)){_classPrivateFieldSet(this,d,!0);_classPrivateFieldGet(this,u)[_classPrivateFieldGet(this,p)].undo();_classPrivateFieldSet(this,d,!1);_classPrivateFieldSet(this,p,_classPrivateFieldGet(this,p)-1)}}},{key:"redo",value:function redo(){if(_classPrivateFieldGet(this,p)<_classPrivateFieldGet(this,u).length-1){_classPrivateFieldSet(this,p,_classPrivateFieldGet(this,p)+1);_classPrivateFieldSet(this,d,!0);_classPrivateFieldGet(this,u)[_classPrivateFieldGet(this,p)].cmd();_classPrivateFieldSet(this,d,!1)}}},{key:"hasSomethingToUndo",value:function hasSomethingToUndo(){return-1!==_classPrivateFieldGet(this,p)}},{key:"hasSomethingToRedo",value:function hasSomethingToRedo(){return _classPrivateFieldGet(this,p)<_classPrivateFieldGet(this,u).length-1}},{key:"destroy",value:function destroy(){_classPrivateFieldSet(this,u,null)}}]);return CommandManager}();r.CommandManager=v;var y=new WeakSet,g=function(){function KeyboardManager(t){_classCallCheck(this,KeyboardManager);_classPrivateMethodInitSpec(this,y);this.buffer=[];this.callbacks=new Map;this.allKeys=new Set;var r,a=KeyboardManager.platform.isMac,i=_createForOfIteratorHelper(t);try{for(i.s();!(r=i.n()).done;){var o,l=_slicedToArray(r.value,2),c=l[0],u=l[1],d=_createForOfIteratorHelper(c);try{for(d.s();!(o=d.n()).done;){var h=o.value,p=h.startsWith("mac+");if(a&&p){this.callbacks.set(h.slice(4),u);this.allKeys.add(h.split("+").at(-1))}else if(!a&&!p){this.callbacks.set(h,u);this.allKeys.add(h.split("+").at(-1))}}}catch(t){d.e(t)}finally{d.f()}}}catch(t){i.e(t)}finally{i.f()}}_createClass(KeyboardManager,[{key:"exec",value:function exec(t,r){if(this.allKeys.has(r.key)){var a=this.callbacks.get(_classPrivateMethodGet(this,y,_serialize2).call(this,r));if(a){a.bind(t)();r.stopPropagation();r.preventDefault()}}}}],[{key:"platform",get:function get(){var t="undefined"!=typeof navigator?navigator.platform:"";return(0,i.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}}]);return KeyboardManager}();r.KeyboardManager=g;function _serialize2(t){t.altKey&&this.buffer.push("alt");t.ctrlKey&&this.buffer.push("ctrl");t.metaKey&&this.buffer.push("meta");t.shiftKey&&this.buffer.push("shift");this.buffer.push(t.key);var r=this.buffer.join("+");this.buffer.length=0;return r}var _=new WeakMap,m=function(){function ClipboardManager(){_classCallCheck(this,ClipboardManager);_classPrivateFieldInitSpec(this,_,{writable:!0,value:null})}_createClass(ClipboardManager,[{key:"copy",value:function copy(t){if(t){Array.isArray(t)?_classPrivateFieldSet(this,_,t.map((function(t){return t.serialize()}))):_classPrivateFieldSet(this,_,[t.serialize()]);_classPrivateFieldSet(this,_,_classPrivateFieldGet(this,_).filter((function(t){return!!t})));0===_classPrivateFieldGet(this,_).length&&_classPrivateFieldSet(this,_,null)}}},{key:"paste",value:function paste(){return _classPrivateFieldGet(this,_)}},{key:"isEmpty",value:function isEmpty(){return null===_classPrivateFieldGet(this,_)}},{key:"destroy",value:function destroy(){_classPrivateFieldSet(this,_,null)}}]);return ClipboardManager}(),b=function(){function ColorManager(){_classCallCheck(this,ColorManager)}_createClass(ColorManager,[{key:"_colors",get:function get(){var t=new Map([["CanvasText",null],["Canvas",null]]);(0,o.getColorValues)(t);return(0,i.shadow)(this,"_colors",t)}},{key:"convert",value:function convert(t){var r=(0,o.getRGB)(t);if(!window.matchMedia("(forced-colors: active)").matches)return r;var a,i=_createForOfIteratorHelper(this._colors);try{for(i.s();!(a=i.n()).done;){var l=_slicedToArray(a.value,2),c=l[0];if(l[1].every((function(t,a){return t===r[a]})))return ColorManager._colorsMapping.get(c)}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"getHexCode",value:function getHexCode(t){var r=this._colors.get(t);return r?i.Util.makeHexColor.apply(i.Util,_toConsumableArray(r)):t}}]);return ColorManager}();r.ColorManager=b;_defineProperty(b,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var A=new WeakMap,k=new WeakMap,P=new WeakMap,S=new WeakMap,w=new WeakMap,x=new WeakMap,C=new WeakMap,T=new WeakMap,E=new WeakMap,I=new WeakMap,O=new WeakMap,M=new WeakMap,R=new WeakMap,D=new WeakMap,L=new WeakMap,G=new WeakMap,j=new WeakMap,N=new WeakMap,B=new WeakSet,W=new WeakSet,U=new WeakSet,H=new WeakSet,z=new WeakSet,V=new WeakSet,X=new WeakSet,Y=new WeakSet,K=new WeakSet,J=function(){function AnnotationEditorUIManager(t,r){_classCallCheck(this,AnnotationEditorUIManager);_classPrivateMethodInitSpec(this,K);_classPrivateMethodInitSpec(this,Y);_classPrivateMethodInitSpec(this,X);_classPrivateMethodInitSpec(this,V);_classPrivateMethodInitSpec(this,z);_classPrivateMethodInitSpec(this,H);_classPrivateMethodInitSpec(this,U);_classPrivateMethodInitSpec(this,W);_classPrivateMethodInitSpec(this,B);_classPrivateFieldInitSpec(this,A,{writable:!0,value:null});_classPrivateFieldInitSpec(this,k,{writable:!0,value:new Map});_classPrivateFieldInitSpec(this,P,{writable:!0,value:new Map});_classPrivateFieldInitSpec(this,S,{writable:!0,value:new m});_classPrivateFieldInitSpec(this,w,{writable:!0,value:new v});_classPrivateFieldInitSpec(this,x,{writable:!0,value:0});_classPrivateFieldInitSpec(this,C,{writable:!0,value:null});_classPrivateFieldInitSpec(this,T,{writable:!0,value:null});_classPrivateFieldInitSpec(this,E,{writable:!0,value:new c});_classPrivateFieldInitSpec(this,I,{writable:!0,value:!1});_classPrivateFieldInitSpec(this,O,{writable:!0,value:i.AnnotationEditorType.NONE});_classPrivateFieldInitSpec(this,M,{writable:!0,value:new Set});_classPrivateFieldInitSpec(this,R,{writable:!0,value:this.keydown.bind(this)});_classPrivateFieldInitSpec(this,D,{writable:!0,value:this.onEditingAction.bind(this)});_classPrivateFieldInitSpec(this,L,{writable:!0,value:this.onPageChanging.bind(this)});_classPrivateFieldInitSpec(this,G,{writable:!0,value:this.onTextLayerRendered.bind(this)});_classPrivateFieldInitSpec(this,j,{writable:!0,value:{isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1}});_classPrivateFieldInitSpec(this,N,{writable:!0,value:null});_classPrivateFieldSet(this,N,t);_classPrivateFieldSet(this,T,r);_classPrivateFieldGet(this,T)._on("editingaction",_classPrivateFieldGet(this,D));_classPrivateFieldGet(this,T)._on("pagechanging",_classPrivateFieldGet(this,L));_classPrivateFieldGet(this,T)._on("textlayerrendered",_classPrivateFieldGet(this,G))}_createClass(AnnotationEditorUIManager,[{key:"destroy",value:function destroy(){_classPrivateMethodGet(this,W,_removeKeyboardManager2).call(this);_classPrivateFieldGet(this,T)._off("editingaction",_classPrivateFieldGet(this,D));_classPrivateFieldGet(this,T)._off("pagechanging",_classPrivateFieldGet(this,L));_classPrivateFieldGet(this,T)._off("textlayerrendered",_classPrivateFieldGet(this,G));var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,P).values());try{for(r.s();!(t=r.n()).done;){t.value.destroy()}}catch(t){r.e(t)}finally{r.f()}_classPrivateFieldGet(this,P).clear();_classPrivateFieldGet(this,k).clear();_classPrivateFieldSet(this,A,null);_classPrivateFieldGet(this,M).clear();_classPrivateFieldGet(this,S).destroy();_classPrivateFieldGet(this,w).destroy()}},{key:"onPageChanging",value:function onPageChanging(t){var r=t.pageNumber;_classPrivateFieldSet(this,x,r-1)}},{key:"onTextLayerRendered",value:function onTextLayerRendered(t){var r=t.pageNumber-1,a=_classPrivateFieldGet(this,P).get(r);null==a||a.onTextLayerRendered()}},{key:"focusMainContainer",value:function focusMainContainer(){_classPrivateFieldGet(this,N).focus()}},{key:"keydown",value:function keydown(t){var r;null!==(r=this.getActive())&&void 0!==r&&r.shouldGetKeyboardEvents()||AnnotationEditorUIManager._keyboardManager.exec(this,t)}},{key:"onEditingAction",value:function onEditingAction(t){["undo","redo","cut","copy","paste","delete","selectAll"].includes(t.name)&&this[t.name]()}},{key:"setEditingState",value:function setEditingState(t){if(t){_classPrivateMethodGet(this,B,_addKeyboardManager2).call(this);_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{isEditing:_classPrivateFieldGet(this,O)!==i.AnnotationEditorType.NONE,isEmpty:_classPrivateMethodGet(this,Y,_isEmpty2).call(this),hasSomethingToUndo:_classPrivateFieldGet(this,w).hasSomethingToUndo(),hasSomethingToRedo:_classPrivateFieldGet(this,w).hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:_classPrivateFieldGet(this,S).isEmpty()})}else{_classPrivateMethodGet(this,W,_removeKeyboardManager2).call(this);_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{isEditing:!1})}}},{key:"registerEditorTypes",value:function registerEditorTypes(t){_classPrivateFieldSet(this,C,t);var r,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,C));try{for(a.s();!(r=a.n()).done;){var i=r.value;_classPrivateMethodGet(this,H,_dispatchUpdateUI2).call(this,i.defaultPropertiesToUpdate)}}catch(t){a.e(t)}finally{a.f()}}},{key:"getId",value:function getId(){return _classPrivateFieldGet(this,E).getId()}},{key:"addLayer",value:function addLayer(t){_classPrivateFieldGet(this,P).set(t.pageIndex,t);_classPrivateFieldGet(this,I)?t.enable():t.disable()}},{key:"removeLayer",value:function removeLayer(t){_classPrivateFieldGet(this,P).delete(t.pageIndex)}},{key:"updateMode",value:function updateMode(t){_classPrivateFieldSet(this,O,t);if(t===i.AnnotationEditorType.NONE){this.setEditingState(!1);_classPrivateMethodGet(this,V,_disableAll2).call(this)}else{this.setEditingState(!0);_classPrivateMethodGet(this,z,_enableAll2).call(this);var r,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,P).values());try{for(a.s();!(r=a.n()).done;){r.value.updateMode(t)}}catch(t){a.e(t)}finally{a.f()}}}},{key:"updateToolbar",value:function updateToolbar(t){t!==_classPrivateFieldGet(this,O)&&_classPrivateFieldGet(this,T).dispatch("switchannotationeditormode",{source:this,mode:t})}},{key:"updateParams",value:function updateParams(t,r){var a,i=_createForOfIteratorHelper(_classPrivateFieldGet(this,M));try{for(i.s();!(a=i.n()).done;){a.value.updateParams(t,r)}}catch(t){i.e(t)}finally{i.f()}var o,l=_createForOfIteratorHelper(_classPrivateFieldGet(this,C));try{for(l.s();!(o=l.n()).done;){o.value.updateDefaultParams(t,r)}}catch(t){l.e(t)}finally{l.f()}}},{key:"getEditors",value:function getEditors(t){var r,a=[],i=_createForOfIteratorHelper(_classPrivateFieldGet(this,k).values());try{for(i.s();!(r=i.n()).done;){var o=r.value;o.pageIndex===t&&a.push(o)}}catch(t){i.e(t)}finally{i.f()}return a}},{key:"getEditor",value:function getEditor(t){return _classPrivateFieldGet(this,k).get(t)}},{key:"addEditor",value:function addEditor(t){_classPrivateFieldGet(this,k).set(t.id,t)}},{key:"removeEditor",value:function removeEditor(t){_classPrivateFieldGet(this,k).delete(t.id);this.unselect(t)}},{key:"setActiveEditor",value:function setActiveEditor(t){if(_classPrivateFieldGet(this,A)!==t){_classPrivateFieldSet(this,A,t);t&&_classPrivateMethodGet(this,H,_dispatchUpdateUI2).call(this,t.propertiesToUpdate)}}},{key:"toggleSelected",value:function toggleSelected(t){if(_classPrivateFieldGet(this,M).has(t)){_classPrivateFieldGet(this,M).delete(t);t.unselect();_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSelectedEditor:this.hasSelection})}else{_classPrivateFieldGet(this,M).add(t);t.select();_classPrivateMethodGet(this,H,_dispatchUpdateUI2).call(this,t.propertiesToUpdate);_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSelectedEditor:!0})}}},{key:"setSelected",value:function setSelected(t){var r,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,M));try{for(a.s();!(r=a.n()).done;){var i=r.value;i!==t&&i.unselect()}}catch(t){a.e(t)}finally{a.f()}_classPrivateFieldGet(this,M).clear();_classPrivateFieldGet(this,M).add(t);t.select();_classPrivateMethodGet(this,H,_dispatchUpdateUI2).call(this,t.propertiesToUpdate);_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSelectedEditor:!0})}},{key:"isSelected",value:function isSelected(t){return _classPrivateFieldGet(this,M).has(t)}},{key:"unselect",value:function unselect(t){t.unselect();_classPrivateFieldGet(this,M).delete(t);_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSelectedEditor:this.hasSelection})}},{key:"hasSelection",get:function get(){return 0!==_classPrivateFieldGet(this,M).size}},{key:"undo",value:function undo(){_classPrivateFieldGet(this,w).undo();_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSomethingToUndo:_classPrivateFieldGet(this,w).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:_classPrivateMethodGet(this,Y,_isEmpty2).call(this)})}},{key:"redo",value:function redo(){_classPrivateFieldGet(this,w).redo();_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:_classPrivateFieldGet(this,w).hasSomethingToRedo(),isEmpty:_classPrivateMethodGet(this,Y,_isEmpty2).call(this)})}},{key:"addCommands",value:function addCommands(t){_classPrivateFieldGet(this,w).add(t);_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:_classPrivateMethodGet(this,Y,_isEmpty2).call(this)})}},{key:"delete",value:function _delete(){var t=this;_classPrivateFieldGet(this,A)&&_classPrivateFieldGet(this,A).commitOrRemove();if(this.hasSelection){var r=_toConsumableArray(_classPrivateFieldGet(this,M));this.addCommands({cmd:function cmd(){var t,a=_createForOfIteratorHelper(r);try{for(a.s();!(t=a.n()).done;){t.value.remove()}}catch(t){a.e(t)}finally{a.f()}},undo:function undo(){var a,i=_createForOfIteratorHelper(r);try{for(i.s();!(a=i.n()).done;){var o=a.value;_classPrivateMethodGet(t,X,_addEditorToLayer2).call(t,o)}}catch(t){i.e(t)}finally{i.f()}},mustExec:!0})}}},{key:"copy",value:function copy(){_classPrivateFieldGet(this,A)&&_classPrivateFieldGet(this,A).commitOrRemove();if(this.hasSelection){var t,r=[],a=_createForOfIteratorHelper(_classPrivateFieldGet(this,M));try{for(a.s();!(t=a.n()).done;){var i=t.value;i.isEmpty()||r.push(i)}}catch(t){a.e(t)}finally{a.f()}if(0===r.length)return;_classPrivateFieldGet(this,S).copy(r);_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasEmptyClipboard:!1})}}},{key:"cut",value:function cut(){this.copy();this.delete()}},{key:"paste",value:function paste(){var t=this;if(!_classPrivateFieldGet(this,S).isEmpty()){this.unselectAll();var r=_classPrivateFieldGet(this,P).get(_classPrivateFieldGet(this,x)),a=_classPrivateFieldGet(this,S).paste().map((function(t){return r.deserialize(t)}));this.addCommands({cmd:function cmd(){var r,i=_createForOfIteratorHelper(a);try{for(i.s();!(r=i.n()).done;){var o=r.value;_classPrivateMethodGet(t,X,_addEditorToLayer2).call(t,o)}}catch(t){i.e(t)}finally{i.f()}_classPrivateMethodGet(t,K,_selectEditors2).call(t,a)},undo:function undo(){var t,r=_createForOfIteratorHelper(a);try{for(r.s();!(t=r.n()).done;){t.value.remove()}}catch(t){r.e(t)}finally{r.f()}},mustExec:!0})}}},{key:"selectAll",value:function selectAll(){var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,M));try{for(r.s();!(t=r.n()).done;){t.value.commit()}}catch(t){r.e(t)}finally{r.f()}_classPrivateMethodGet(this,K,_selectEditors2).call(this,_classPrivateFieldGet(this,k).values())}},{key:"unselectAll",value:function unselectAll(){if(_classPrivateFieldGet(this,A))_classPrivateFieldGet(this,A).commitOrRemove();else if(0!==_classPrivateMethodGet(this,K,_selectEditors2).size){var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,M));try{for(r.s();!(t=r.n()).done;){t.value.unselect()}}catch(t){r.e(t)}finally{r.f()}_classPrivateFieldGet(this,M).clear();_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSelectedEditor:!1})}}},{key:"isActive",value:function isActive(t){return _classPrivateFieldGet(this,A)===t}},{key:"getActive",value:function getActive(){return _classPrivateFieldGet(this,A)}},{key:"getMode",value:function getMode(){return _classPrivateFieldGet(this,O)}}]);return AnnotationEditorUIManager}();r.AnnotationEditorUIManager=J;function _addKeyboardManager2(){_classPrivateFieldGet(this,N).addEventListener("keydown",_classPrivateFieldGet(this,R))}function _removeKeyboardManager2(){_classPrivateFieldGet(this,N).removeEventListener("keydown",_classPrivateFieldGet(this,R))}function _dispatchUpdateStates2(t){var r=this;Object.entries(t).some((function(t){var a=_slicedToArray(t,2),i=a[0],o=a[1];return _classPrivateFieldGet(r,j)[i]!==o}))&&_classPrivateFieldGet(this,T).dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(_classPrivateFieldGet(this,j),t)})}function _dispatchUpdateUI2(t){_classPrivateFieldGet(this,T).dispatch("annotationeditorparamschanged",{source:this,details:t})}function _enableAll2(){if(!_classPrivateFieldGet(this,I)){_classPrivateFieldSet(this,I,!0);var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,P).values());try{for(r.s();!(t=r.n()).done;){t.value.enable()}}catch(t){r.e(t)}finally{r.f()}}}function _disableAll2(){this.unselectAll();if(_classPrivateFieldGet(this,I)){_classPrivateFieldSet(this,I,!1);var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,P).values());try{for(r.s();!(t=r.n()).done;){t.value.disable()}}catch(t){r.e(t)}finally{r.f()}}}function _addEditorToLayer2(t){var r=_classPrivateFieldGet(this,P).get(t.pageIndex);r?r.addOrRebuild(t):this.addEditor(t)}function _isEmpty2(){if(0===_classPrivateFieldGet(this,k).size)return!0;if(1===_classPrivateFieldGet(this,k).size){var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,k).values());try{for(r.s();!(t=r.n()).done;){return t.value.isEmpty()}}catch(t){r.e(t)}finally{r.f()}}return!1}function _selectEditors2(t){_classPrivateFieldGet(this,M).clear();var r,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var i=r.value;if(!i.isEmpty()){_classPrivateFieldGet(this,M).add(i);i.select()}}}catch(t){a.e(t)}finally{a.f()}_classPrivateMethodGet(this,U,_dispatchUpdateStates2).call(this,{hasSelectedEditor:!0})}_defineProperty(J,"_keyboardManager",new g([[["ctrl+a","mac+meta+a"],J.prototype.selectAll],[["ctrl+c","mac+meta+c"],J.prototype.copy],[["ctrl+v","mac+meta+v"],J.prototype.paste],[["ctrl+x","mac+meta+x"],J.prototype.cut],[["ctrl+z","mac+meta+z"],J.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],J.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],J.prototype.delete],[["Escape","mac+Escape"],J.prototype.unselectAll]]))},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.MurmurHash3_64=void 0;var i=a(1);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=3285377520,l=4294901760,c=65535,u=function(){function MurmurHash3_64(t){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,MurmurHash3_64);this.h1=t?4294967295&t:o;this.h2=t?4294967295&t:o}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(MurmurHash3_64,[{key:"update",value:function update(t){var r,a;if("string"==typeof t){r=new Uint8Array(2*t.length);a=0;for(var o=0,u=t.length;o<u;o++){var d=t.charCodeAt(o);if(d<=255)r[a++]=d;else{r[a++]=d>>>8;r[a++]=255&d}}}else{if(!(0,i.isArrayBuffer)(t))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");a=(r=t.slice()).byteLength}for(var h=a>>2,p=a-4*h,v=new Uint32Array(r.buffer,0,h),y=0,g=0,_=this.h1,m=this.h2,b=3432918353,A=461845907,k=11601,P=13715,S=0;S<h;S++)1&S?_=5*(_=(_^=y=(y=(y=(y=v[S])*b&l|y*k&c)<<15|y>>>17)*A&l|y*P&c)<<13|_>>>19)+3864292196:m=5*(m=(m^=g=(g=(g=(g=v[S])*b&l|g*k&c)<<15|g>>>17)*A&l|g*P&c)<<13|m>>>19)+3864292196;y=0;switch(p){case 3:y^=r[4*h+2]<<16;case 2:y^=r[4*h+1]<<8;case 1:y=(y=(y=(y^=r[4*h])*b&l|y*k&c)<<15|y>>>17)*A&l|y*P&c;1&h?_^=y:m^=y}this.h1=_;this.h2=m}},{key:"hexdigest",value:function hexdigest(){var t=this.h1,r=this.h2;t=3981806797*(t^=r>>>1)&l|36045*t&c;t=444984403*(t^=(r=4283543511*r&l|(2950163797*(r<<16|t>>>16)&l)>>>16)>>>1)&l|60499*t&c;var a=((t^=(r=3301882366*r&l|(3120437893*(r<<16|t>>>16)&l)>>>16)>>>1)>>>0).toString(16),i=(r>>>0).toString(16);return a.padStart(8,"0")+i.padStart(8,"0")}}]);return MurmurHash3_64}();r.MurmurHash3_64=u},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.FontLoader=r.FontFaceObject=void 0;var i=a(1);function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}var o,l=function(){function BaseFontLoader(t){var r=t.docId,a=t.onUnsupportedFeature,o=t.ownerDocument,l=void 0===o?globalThis.document:o;t.styleElement;_classCallCheck(this,BaseFontLoader);this.constructor===BaseFontLoader&&(0,i.unreachable)("Cannot initialize BaseFontLoader.");this.docId=r;this._onUnsupportedFeature=a;this._document=l;this.nativeFontFaces=[];this.styleElement=null}_createClass(BaseFontLoader,[{key:"addNativeFontFace",value:function addNativeFontFace(t){this.nativeFontFaces.push(t);this._document.fonts.add(t)}},{key:"insertRule",value:function insertRule(t){var r=this.styleElement;if(!r){(r=this.styleElement=this._document.createElement("style")).id="PDFJS_FONT_STYLE_TAG_".concat(this.docId);this._document.documentElement.getElementsByTagName("head")[0].append(r)}var a=r.sheet;a.insertRule(t,a.cssRules.length)}},{key:"clear",value:function clear(){var t,r=_createForOfIteratorHelper(this.nativeFontFaces);try{for(r.s();!(t=r.n()).done;){var a=t.value;this._document.fonts.delete(a)}}catch(t){r.e(t)}finally{r.f()}this.nativeFontFaces.length=0;if(this.styleElement){this.styleElement.remove();this.styleElement=null}}},{key:"bind",value:(t=function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}(_regeneratorRuntime().mark((function _callee(t){var r,a,o=this;return _regeneratorRuntime().wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:if(!t.attached&&!t.missingFile){l.next=2;break}return l.abrupt("return");case 2:t.attached=!0;if(!this.isFontLoadingAPISupported){l.next=19;break}if(!(r=t.createNativeFontFace())){l.next=18;break}this.addNativeFontFace(r);l.prev=7;l.next=10;return r.loaded;case 10:l.next=18;break;case 12:l.prev=12;l.t0=l.catch(7);this._onUnsupportedFeature({featureId:i.UNSUPPORTED_FEATURES.errorFontLoadNative});(0,i.warn)("Failed to load font '".concat(r.family,"': '").concat(l.t0,"'."));t.disableFontFace=!0;throw l.t0;case 18:return l.abrupt("return");case 19:if(!(a=t.createFontFaceRule())){l.next=26;break}this.insertRule(a);if(!this.isSyncFontLoadingSupported){l.next=24;break}return l.abrupt("return");case 24:l.next=26;return new Promise((function(r){var i=o._queueLoadingCallback(r);o._prepareFontLoadEvent([a],[t],i)}));case 26:case"end":return l.stop()}}),_callee,this,[[7,12]])}))),function bind(r){return t.apply(this,arguments)})},{key:"_queueLoadingCallback",value:function _queueLoadingCallback(t){(0,i.unreachable)("Abstract method `_queueLoadingCallback`.")}},{key:"isFontLoadingAPISupported",get:function get(){var t,r=!(null===(t=this._document)||void 0===t||!t.fonts);return(0,i.shadow)(this,"isFontLoadingAPISupported",r)}},{key:"isSyncFontLoadingSupported",get:function get(){(0,i.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}},{key:"_loadTestFont",get:function get(){(0,i.unreachable)("Abstract method `_loadTestFont`.")}},{key:"_prepareFontLoadEvent",value:function _prepareFontLoadEvent(t,r,a){(0,i.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}]);var t;return BaseFontLoader}();r.FontLoader=o;r.FontLoader=o=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}(GenericFontLoader,t);var r=_createSuper(GenericFontLoader);function GenericFontLoader(t){var a;_classCallCheck(this,GenericFontLoader);(a=r.call(this,t)).loadingContext={requests:[],nextRequestId:0};a.loadTestFontId=0;return a}_createClass(GenericFontLoader,[{key:"isSyncFontLoadingSupported",get:function get(){var t=!1;if("undefined"==typeof navigator)t=!0;else{var r=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);(null==r?void 0:r[1])>=14&&(t=!0)}return(0,i.shadow)(this,"isSyncFontLoadingSupported",t)}},{key:"_queueLoadingCallback",value:function _queueLoadingCallback(t){var r=this.loadingContext,a={id:"pdfjs-font-loading-".concat(r.nextRequestId++),done:!1,complete:function completeRequest(){(0,i.assert)(!a.done,"completeRequest() cannot be called twice.");a.done=!0;for(;r.requests.length>0&&r.requests[0].done;){var t=r.requests.shift();setTimeout(t.callback,0)}},callback:t};r.requests.push(a);return a}},{key:"_loadTestFont",get:function get(){return(0,i.shadow)(this,"_loadTestFont",function getLoadTestFont(){return atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==")}())}},{key:"_prepareFontLoadEvent",value:function _prepareFontLoadEvent(t,r,a){function int32(t,r){return t.charCodeAt(r)<<24|t.charCodeAt(r+1)<<16|t.charCodeAt(r+2)<<8|255&t.charCodeAt(r+3)}function spliceString(t,r,a,i){return t.substring(0,r)+i+t.substring(r+a)}var o,l,c=this._document.createElement("canvas");c.width=1;c.height=1;var u=c.getContext("2d"),d=0;var h="lt".concat(Date.now()).concat(this.loadTestFontId++),p=this._loadTestFont,v=1482184792,y=int32(p=spliceString(p,976,h.length,h),16);for(o=0,l=h.length-3;o<l;o+=4)y=y-v+int32(h,o)|0;o<h.length&&(y=y-v+int32(h+"XXX",o)|0);p=spliceString(p,16,4,(0,i.string32)(y));var g="url(data:font/opentype;base64,".concat(btoa(p),");"),_='@font-face {font-family:"'.concat(h,'";src:').concat(g,"}");this.insertRule(_);var m,b=[],A=_createForOfIteratorHelper(r);try{for(A.s();!(m=A.n()).done;){var k=m.value;b.push(k.loadedName)}}catch(t){A.e(t)}finally{A.f()}b.push(h);var P=this._document.createElement("div");P.style.visibility="hidden";P.style.width=P.style.height="10px";P.style.position="absolute";P.style.top=P.style.left="0px";for(var S=0,w=b;S<w.length;S++){var x=w[S],C=this._document.createElement("span");C.textContent="Hi";C.style.fontFamily=x;P.append(C)}this._document.body.append(P);!function isFontReady(t,r){if(++d>30){(0,i.warn)("Load test font never loaded.");r()}else{u.font="30px "+t;u.fillText(".",0,20);u.getImageData(0,0,1,1).data[3]>0?r():setTimeout(isFontReady.bind(null,t,r))}}(h,(function(){P.remove();a.complete()}))}}]);return GenericFontLoader}(l);var c=function(){function FontFaceObject(t,r){var a=r.isEvalSupported,i=void 0===a||a,o=r.disableFontFace,l=void 0!==o&&o,c=r.ignoreErrors,u=void 0!==c&&c,d=r.onUnsupportedFeature,h=r.fontRegistry,p=void 0===h?null:h;_classCallCheck(this,FontFaceObject);this.compiledGlyphs=Object.create(null);for(var v in t)this[v]=t[v];this.isEvalSupported=!1!==i;this.disableFontFace=!0===l;this.ignoreErrors=!0===u;this._onUnsupportedFeature=d;this.fontRegistry=p}_createClass(FontFaceObject,[{key:"createNativeFontFace",value:function createNativeFontFace(){if(!this.data||this.disableFontFace)return null;var t;if(this.cssFontInfo){var r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg"));t=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}else t=new FontFace(this.loadedName,this.data,{});this.fontRegistry&&this.fontRegistry.registerFont(this);return t}},{key:"createFontFaceRule",value:function createFontFaceRule(){if(!this.data||this.disableFontFace)return null;var t,r=(0,i.bytesToString)(this.data),a="url(data:".concat(this.mimetype,";base64,").concat(btoa(r),");");if(this.cssFontInfo){var o="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(o+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;"));t='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(o,"src:").concat(a,"}")}else t='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(a,"}");this.fontRegistry&&this.fontRegistry.registerFont(this,a);return t}},{key:"getPathGenerator",value:function getPathGenerator(t,r){if(void 0!==this.compiledGlyphs[r])return this.compiledGlyphs[r];var a;try{a=t.get(this.loadedName+"_path_"+r)}catch(t){if(!this.ignoreErrors)throw t;this._onUnsupportedFeature({featureId:i.UNSUPPORTED_FEATURES.errorFontGetPath});(0,i.warn)('getPathGenerator - ignoring character: "'.concat(t,'".'));return this.compiledGlyphs[r]=function(t,r){}}if(this.isEvalSupported&&i.FeatureTest.isEvalSupported){var o,l=[],c=_createForOfIteratorHelper(a);try{for(c.s();!(o=c.n()).done;){var u=o.value,d=void 0!==u.args?u.args.join(","):"";l.push("c.",u.cmd,"(",d,");\n")}}catch(t){c.e(t)}finally{c.f()}return this.compiledGlyphs[r]=new Function("c","size",l.join(""))}return this.compiledGlyphs[r]=function(t,r){var i,o=_createForOfIteratorHelper(a);try{for(o.s();!(i=o.n()).done;){var l=i.value;"scale"===l.cmd&&(l.args=[r,-r]);t[l.cmd].apply(t,l.args)}}catch(t){o.e(t)}finally{o.f()}}}}]);return FontFaceObject}();r.FontFaceObject=c},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.CanvasGraphics=void 0;var i=a(1),o=a(129),l=a(138),c=a(139),u=a(3);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _classPrivateMethodInitSpec(t,r){!function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,r);r.add(t)}function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}var d=4096,h=16;function addContextCurrentTransform(t){t._transformStack&&(t._transformStack=[]);if(!t.mozCurrentTransform){t._originalSave=t.save;t._originalRestore=t.restore;t._originalRotate=t.rotate;t._originalScale=t.scale;t._originalTranslate=t.translate;t._originalTransform=t.transform;t._originalSetTransform=t.setTransform;t._originalResetTransform=t.resetTransform;t._transformMatrix=t._transformMatrix||[1,0,0,1,0,0];t._transformStack=[];try{var r=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"lineWidth");t._setLineWidth=r.set;t._getLineWidth=r.get;Object.defineProperty(t,"lineWidth",{set:function setLineWidth(t){this._setLineWidth(1.000001*t)},get:function getLineWidth(){return this._getLineWidth()}})}catch(t){}Object.defineProperty(t,"mozCurrentTransform",{get:function getCurrentTransform(){return this._transformMatrix}});Object.defineProperty(t,"mozCurrentTransformInverse",{get:function getCurrentTransformInverse(){var t=_slicedToArray(this._transformMatrix,6),r=t[0],a=t[1],i=t[2],o=t[3],l=t[4],c=t[5],u=r*o-a*i,d=a*i-r*o;return[o/u,a/d,i/d,r/u,(o*l-i*c)/d,(a*l-r*c)/u]}});t.save=function ctxSave(){var t=this._transformMatrix;this._transformStack.push(t);this._transformMatrix=t.slice(0,6);this._originalSave()};t.restore=function ctxRestore(){0===this._transformStack.length&&(0,i.warn)("Tried to restore a ctx when the stack was already empty.");var t=this._transformStack.pop();if(t){this._transformMatrix=t;this._originalRestore()}};t.translate=function ctxTranslate(t,r){var a=this._transformMatrix;a[4]=a[0]*t+a[2]*r+a[4];a[5]=a[1]*t+a[3]*r+a[5];this._originalTranslate(t,r)};t.scale=function ctxScale(t,r){var a=this._transformMatrix;a[0]*=t;a[1]*=t;a[2]*=r;a[3]*=r;this._originalScale(t,r)};t.transform=function ctxTransform(r,a,i,o,l,c){var u=this._transformMatrix;this._transformMatrix=[u[0]*r+u[2]*a,u[1]*r+u[3]*a,u[0]*i+u[2]*o,u[1]*i+u[3]*o,u[0]*l+u[2]*c+u[4],u[1]*l+u[3]*c+u[5]];t._originalTransform(r,a,i,o,l,c)};t.setTransform=function ctxSetTransform(r,a,i,o,l,c){this._transformMatrix=[r,a,i,o,l,c];t._originalSetTransform(r,a,i,o,l,c)};t.resetTransform=function ctxResetTransform(){this._transformMatrix=[1,0,0,1,0,0];t._originalResetTransform()};t.rotate=function ctxRotate(t){var r=Math.cos(t),a=Math.sin(t),i=this._transformMatrix;this._transformMatrix=[i[0]*r+i[2]*a,i[1]*r+i[3]*a,i[0]*-a+i[2]*r,i[1]*-a+i[3]*r,i[4],i[5]];this._originalRotate(t)}}}var p=function(){function CachedCanvases(t){_classCallCheck(this,CachedCanvases);this.canvasFactory=t;this.cache=Object.create(null)}_createClass(CachedCanvases,[{key:"getCanvas",value:function getCanvas(t,r,a,i){var o;if(void 0!==this.cache[t]){o=this.cache[t];this.canvasFactory.reset(o,r,a);o.context.setTransform(1,0,0,1,0,0)}else{o=this.canvasFactory.create(r,a);this.cache[t]=o}i&&addContextCurrentTransform(o.context);return o}},{key:"delete",value:function _delete(t){delete this.cache[t]}},{key:"clear",value:function clear(){for(var t in this.cache){var r=this.cache[t];this.canvasFactory.destroy(r);delete this.cache[t]}}}]);return CachedCanvases}();function drawImageAtIntegerCoords(t,r,a,i,o,l,c,u,d,h){var p=_slicedToArray(t.mozCurrentTransform,6),v=p[0],y=p[1],g=p[2],_=p[3],m=p[4],b=p[5];if(0===y&&0===g){var A=c*v+m,k=Math.round(A),P=u*_+b,S=Math.round(P),w=(c+d)*v+m,x=Math.abs(Math.round(w)-k)||1,C=(u+h)*_+b,T=Math.abs(Math.round(C)-S)||1;t.setTransform(Math.sign(v),0,0,Math.sign(_),k,S);t.drawImage(r,a,i,o,l,0,0,x,T);t.setTransform(v,y,g,_,m,b);return[x,T]}if(0===v&&0===_){var E=u*g+m,I=Math.round(E),O=c*y+b,M=Math.round(O),R=(u+h)*g+m,D=Math.abs(Math.round(R)-I)||1,L=(c+d)*y+b,G=Math.abs(Math.round(L)-M)||1;t.setTransform(0,Math.sign(y),Math.sign(g),0,I,M);t.drawImage(r,a,i,o,l,0,0,G,D);t.setTransform(v,y,g,_,m,b);return[G,D]}t.drawImage(r,a,i,o,l,c,u,d,h);return[Math.hypot(v,y)*d,Math.hypot(g,_)*h]}var v=function(){function CanvasExtraState(t,r){_classCallCheck(this,CanvasExtraState);this.alphaIsShape=!1;this.fontSize=0;this.fontSizeScale=1;this.textMatrix=i.IDENTITY_MATRIX;this.textMatrixScale=1;this.fontMatrix=i.FONT_IDENTITY_MATRIX;this.leading=0;this.x=0;this.y=0;this.lineX=0;this.lineY=0;this.charSpacing=0;this.wordSpacing=0;this.textHScale=1;this.textRenderingMode=i.TextRenderingMode.FILL;this.textRise=0;this.fillColor="#000000";this.strokeColor="#000000";this.patternFill=!1;this.fillAlpha=1;this.strokeAlpha=1;this.lineWidth=1;this.activeSMask=null;this.transferMaps=null;this.startNewPathAndClipBox([0,0,t,r])}_createClass(CanvasExtraState,[{key:"clone",value:function clone(){var clone=Object.create(this);clone.clipBox=this.clipBox.slice();return clone}},{key:"setCurrentPoint",value:function setCurrentPoint(t,r){this.x=t;this.y=r}},{key:"updatePathMinMax",value:function updatePathMinMax(t,r,a){var o=_slicedToArray(i.Util.applyTransform([r,a],t),2);r=o[0];a=o[1];this.minX=Math.min(this.minX,r);this.minY=Math.min(this.minY,a);this.maxX=Math.max(this.maxX,r);this.maxY=Math.max(this.maxY,a)}},{key:"updateRectMinMax",value:function updateRectMinMax(t,r){var a=i.Util.applyTransform(r,t),o=i.Util.applyTransform(r.slice(2),t);this.minX=Math.min(this.minX,a[0],o[0]);this.minY=Math.min(this.minY,a[1],o[1]);this.maxX=Math.max(this.maxX,a[0],o[0]);this.maxY=Math.max(this.maxY,a[1],o[1])}},{key:"updateScalingPathMinMax",value:function updateScalingPathMinMax(t,r){i.Util.scaleMinMax(t,r);this.minX=Math.min(this.minX,r[0]);this.maxX=Math.max(this.maxX,r[1]);this.minY=Math.min(this.minY,r[2]);this.maxY=Math.max(this.maxY,r[3])}},{key:"updateCurvePathMinMax",value:function updateCurvePathMinMax(t,r,a,o,l,c,u,d,h,p){var v=i.Util.bezierBoundingBox(r,a,o,l,c,u,d,h);if(p){p[0]=Math.min(p[0],v[0],v[2]);p[1]=Math.max(p[1],v[0],v[2]);p[2]=Math.min(p[2],v[1],v[3]);p[3]=Math.max(p[3],v[1],v[3])}else this.updateRectMinMax(t,v)}},{key:"getPathBoundingBox",value:function getPathBoundingBox(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.PathType.FILL,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=[this.minX,this.minY,this.maxX,this.maxY];if(t===l.PathType.STROKE){r||(0,i.unreachable)("Stroke bounding box must include transform.");var o=i.Util.singularValueDecompose2dScale(r),c=o[0]*this.lineWidth/2,u=o[1]*this.lineWidth/2;a[0]-=c;a[1]-=u;a[2]+=c;a[3]+=u}return a}},{key:"updateClipFromPath",value:function updateClipFromPath(){var t=i.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}},{key:"isEmptyClip",value:function isEmptyClip(){return this.minX===1/0}},{key:"startNewPathAndClipBox",value:function startNewPathAndClipBox(t){this.clipBox=t;this.minX=1/0;this.minY=1/0;this.maxX=0;this.maxY=0}},{key:"getClippedPathBoundingBox",value:function getClippedPathBoundingBox(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.PathType.FILL,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return i.Util.intersect(this.clipBox,this.getPathBoundingBox(t,r))}}]);return CanvasExtraState}();function putBinaryImageData(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("undefined"!=typeof ImageData&&r instanceof ImageData)t.putImageData(r,0,0);else{var o,l,c,u,d,p,v,y,g,_=r.height,m=r.width,b=_%h,A=(_-b)/h,k=0===b?A:A+1,P=t.createImageData(m,h),S=0,w=r.data,x=P.data;if(a)switch(a.length){case 1:p=a[0];v=a[0];y=a[0];g=a[0];break;case 4:p=a[0];v=a[1];y=a[2];g=a[3]}if(r.kind===i.ImageKind.GRAYSCALE_1BPP){var C=w.byteLength,T=new Uint32Array(x.buffer,0,x.byteLength>>2),E=T.length,I=m+7>>3,O=4294967295,M=i.FeatureTest.isLittleEndian?4278190080:255;if(g&&255===g[0]&&0===g[255]){var R=[M,O];O=R[0];M=R[1]}for(l=0;l<k;l++){u=l<A?h:b;o=0;for(c=0;c<u;c++){for(var D=C-S,L=0,G=D>I?m:8*D-7,j=-8&G,N=0,B=0;L<j;L+=8){B=w[S++];T[o++]=128&B?O:M;T[o++]=64&B?O:M;T[o++]=32&B?O:M;T[o++]=16&B?O:M;T[o++]=8&B?O:M;T[o++]=4&B?O:M;T[o++]=2&B?O:M;T[o++]=1&B?O:M}for(;L<G;L++){if(0===N){B=w[S++];N=128}T[o++]=B&N?O:M;N>>=1}}for(;o<E;)T[o++]=0;t.putImageData(P,0,l*h)}}else if(r.kind===i.ImageKind.RGBA_32BPP){var W=!!(p||v||y);c=0;d=m*h*4;for(l=0;l<A;l++){x.set(w.subarray(S,S+d));S+=d;if(W)for(var U=0;U<d;U+=4){p&&(x[U+0]=p[x[U+0]]);v&&(x[U+1]=v[x[U+1]]);y&&(x[U+2]=y[x[U+2]])}t.putImageData(P,0,c);c+=h}if(l<k){d=m*b*4;x.set(w.subarray(S,S+d));if(W)for(var H=0;H<d;H+=4){p&&(x[H+0]=p[x[H+0]]);v&&(x[H+1]=v[x[H+1]]);y&&(x[H+2]=y[x[H+2]])}t.putImageData(P,0,c)}}else{if(r.kind!==i.ImageKind.RGB_24BPP)throw new Error("bad image kind: ".concat(r.kind));var z=!!(p||v||y);d=m*(u=h);for(l=0;l<k;l++){l>=A&&(d=m*(u=b));o=0;for(c=d;c--;){x[o++]=w[S++];x[o++]=w[S++];x[o++]=w[S++];x[o++]=255}if(z)for(var V=0;V<o;V+=4){p&&(x[V+0]=p[x[V+0]]);v&&(x[V+1]=v[x[V+1]]);y&&(x[V+2]=y[x[V+2]])}t.putImageData(P,0,l*h)}}}}function putBinaryImageMask(t,r){if(r.bitmap)t.drawImage(r.bitmap,0,0);else for(var a=r.height,i=r.width,o=a%h,l=(a-o)/h,u=0===o?l:l+1,d=t.createImageData(i,h),p=0,v=r.data,y=d.data,g=0;g<u;g++){var _=g<l?h:o;p=(0,c.applyMaskImageData)({src:v,srcPos:p,dest:y,width:i,height:_}).srcPos;t.putImageData(d,0,g*h)}}function copyCtxState(t,r){for(var a=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],i=0,o=a.length;i<o;i++){var l=a[i];void 0!==t[l]&&(r[l]=t[l])}if(void 0!==t.setLineDash){r.setLineDash(t.getLineDash());r.lineDashOffset=t.lineDashOffset}}function resetCtxToDefault(t,r){t.strokeStyle=t.fillStyle=r||"#000000";t.fillRule="nonzero";t.globalAlpha=1;t.lineWidth=1;t.lineCap="butt";t.lineJoin="miter";t.miterLimit=10;t.globalCompositeOperation="source-over";t.font="10px sans-serif";if(void 0!==t.setLineDash){t.setLineDash([]);t.lineDashOffset=0}}function composeSMaskBackdrop(t,r,a,i){for(var o=t.length,l=3;l<o;l+=4){var c=t[l];if(0===c){t[l-3]=r;t[l-2]=a;t[l-1]=i}else if(c<255){var u=255-c;t[l-3]=t[l-3]*c+r*u>>8;t[l-2]=t[l-2]*c+a*u>>8;t[l-1]=t[l-1]*c+i*u>>8}}}function composeSMaskAlpha(t,r,a){for(var i=t.length,o=3;o<i;o+=4){var l=a?a[t[o]]:t[o];r[o]=r[o]*l*.00392156862745098|0}}function composeSMaskLuminosity(t,r,a){for(var i=t.length,o=3;o<i;o+=4){var l=77*t[o-3]+152*t[o-2]+28*t[o-1];r[o]=a?r[o]*a[l>>8]>>8:r[o]*l>>16}}function composeSMask(t,r,a,i){var o=i[0],l=i[1],c=i[2]-o,u=i[3]-l;if(0!==c&&0!==u){!function genericComposeSMask(t,r,a,i,o,l,c,u,d,h,p){var v,y=!!l,g=y?l[0]:0,_=y?l[1]:0,m=y?l[2]:0;v="Luminosity"===o?composeSMaskLuminosity:composeSMaskAlpha;for(var b=Math.min(i,Math.ceil(1048576/a)),A=0;A<i;A+=b){var k=Math.min(b,i-A),P=t.getImageData(u-h,A+(d-p),a,k),S=r.getImageData(u,A+d,a,k);y&&composeSMaskBackdrop(P.data,g,_,m);v(P.data,S.data,c);r.putImageData(S,u,A+d)}}(r.context,a,c,u,r.subtype,r.backdrop,r.transferMap,o,l,r.offsetX,r.offsetY);t.save();t.globalAlpha=1;t.globalCompositeOperation="source-over";t.setTransform(1,0,0,1,0,0);t.drawImage(a.canvas,0,0);t.restore()}}function getImageSmoothingEnabled(t,r){var a=i.Util.singularValueDecompose2dScale(t);a[0]=Math.fround(a[0]);a[1]=Math.fround(a[1]);var l=Math.fround((globalThis.devicePixelRatio||1)*o.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==r?r:a[0]<=l||a[1]<=l}var y=["butt","round","square"],g=["miter","round","bevel"],_={},m={},b=new WeakSet,A=function(){function CanvasGraphics(t,r,a,i,o,l,c,u){_classCallCheck(this,CanvasGraphics);_classPrivateMethodInitSpec(this,b);this.ctx=t;this.current=new v(this.ctx.canvas.width,this.ctx.canvas.height);this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.res=null;this.xobjs=null;this.commonObjs=r;this.objs=a;this.canvasFactory=i;this.imageLayer=o;this.groupStack=[];this.processingType3=null;this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.suspendedCtx=null;this.contentVisible=!0;this.markedContentStack=[];this.optionalContentConfig=l;this.cachedCanvases=new p(this.canvasFactory);this.cachedPatterns=new Map;this.annotationCanvasMap=c;this.viewportScale=1;this.outputScaleX=1;this.outputScaleY=1;this.backgroundColor=(null==u?void 0:u.background)||null;this.foregroundColor=(null==u?void 0:u.foreground)||null;t&&addContextCurrentTransform(t);this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null;this._cachedBitmapsMap=new Map}_createClass(CanvasGraphics,[{key:"getObject",value:function getObject(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):r}},{key:"beginDrawing",value:function beginDrawing(t){var r=t.transform,a=t.viewport,i=t.transparency,l=void 0!==i&&i,c=t.background,u=void 0===c?null:c,d=this.ctx.canvas.width,h=this.ctx.canvas.height,p=u||"#ffffff";this.ctx.save();if(this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;var v=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;var y,g,_=this.backgroundColor=this.ctx.fillStyle;this.ctx.fillStyle=p;y="string"==typeof(g=this.ctx.fillStyle)&&/^#[0-9A-Fa-f]{6}$/.test(g);if("#000000"===v&&"#ffffff"===_||v===_||!y)this.foregroundColor=this.backgroundColor=null;else{var m=_slicedToArray((0,o.getRGB)(g),3),b=m[0],A=m[1],k=m[2],P=function newComp(t){return(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)},S=Math.round(.2126*P(b)+.7152*P(A)+.0722*P(k));this.selectColor=function(t,r,a){var i=.2126*P(t)+.7152*P(r)+.0722*P(a);return Math.round(i)===S?_:v}}}this.ctx.fillStyle=this.backgroundColor||p;this.ctx.fillRect(0,0,d,h);this.ctx.restore();if(l){var w=this.cachedCanvases.getCanvas("transparent",d,h,!0);this.compositeCtx=this.ctx;this.transparentCanvas=w.canvas;this.ctx=w.context;this.ctx.save();this.ctx.transform.apply(this.ctx,this.compositeCtx.mozCurrentTransform)}this.ctx.save();resetCtxToDefault(this.ctx,this.foregroundColor);if(r){this.ctx.transform.apply(this.ctx,r);this.outputScaleX=r[0];this.outputScaleY=r[0]}this.ctx.transform.apply(this.ctx,a.transform);this.viewportScale=a.scale;this.baseTransform=this.ctx.mozCurrentTransform.slice();this.imageLayer&&this.imageLayer.beginLayout()}},{key:"executeOperatorList",value:function executeOperatorList(t,r,a,o){var l=t.argsArray,c=t.fnArray,u=r||0,d=l.length;if(d===u)return u;for(var h,p=d-u>10&&"function"==typeof a,v=p?Date.now()+15:0,y=0,g=this.commonObjs,_=this.objs;;){if(void 0!==o&&u===o.nextBreakPoint){o.breakIt(u,a);return u}if((h=c[u])!==i.OPS.dependency)this[h].apply(this,l[u]);else{var m,b=_createForOfIteratorHelper(l[u]);try{for(b.s();!(m=b.n()).done;){var A=m.value,k=A.startsWith("g_")?g:_;if(!k.has(A)){k.get(A,a);return u}}}catch(t){b.e(t)}finally{b.f()}}if(++u===d)return u;if(p&&++y>10){if(Date.now()>v){a();return u}y=0}}}},{key:"endDrawing",value:function endDrawing(){_classPrivateMethodGet(this,b,_restoreInitialState2).call(this);this.cachedCanvases.clear();this.cachedPatterns.clear();var t,r=_createForOfIteratorHelper(this._cachedBitmapsMap.values());try{for(r.s();!(t=r.n()).done;){var a,i=t.value,o=_createForOfIteratorHelper(i.values());try{for(o.s();!(a=o.n()).done;){var l=a.value;"undefined"!=typeof HTMLCanvasElement&&l instanceof HTMLCanvasElement&&(l.width=l.height=0)}}catch(t){o.e(t)}finally{o.f()}i.clear()}}catch(t){r.e(t)}finally{r.f()}this._cachedBitmapsMap.clear();this.imageLayer&&this.imageLayer.endLayout()}},{key:"_scaleImage",value:function _scaleImage(t,r){for(var a,i,o=t.width,l=t.height,c=Math.max(Math.hypot(r[0],r[1]),1),u=Math.max(Math.hypot(r[2],r[3]),1),d=o,h=l,p="prescale1";c>2&&d>1||u>2&&h>1;){var v=d,y=h;c>2&&d>1&&(c/=d/(v=Math.ceil(d/2)));u>2&&h>1&&(u/=h/(y=Math.ceil(h/2)));(i=(a=this.cachedCanvases.getCanvas(p,v,y,!1)).context).clearRect(0,0,v,y);i.drawImage(t,0,0,d,h,0,0,v,y);t=a.canvas;d=v;h=y;p="prescale1"===p?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:h}}},{key:"_createMaskCanvas",value:function _createMaskCanvas(t){var r,a,o,c,u=this.ctx,d=t.width,h=t.height,p=this.current.fillColor,v=this.current.patternFill,y=u.mozCurrentTransform;if((t.bitmap||t.data)&&t.count>1){var g=t.bitmap||t.data.buffer,_=y.slice(0,4);a=JSON.stringify(v?_:[_,p]);if(!(r=this._cachedBitmapsMap.get(g))){r=new Map;this._cachedBitmapsMap.set(g,r)}var m=r.get(a);if(m&&!v){return{canvas:m,offsetX:Math.round(Math.min(y[0],y[2])+y[4]),offsetY:Math.round(Math.min(y[1],y[3])+y[5])}}o=m}o||putBinaryImageMask((c=this.cachedCanvases.getCanvas("maskCanvas",d,h,!1)).context,t);var b=i.Util.transform(y,[1/d,0,0,-1/h,0,0]);b=i.Util.transform(b,[1,0,0,1,0,-h]);var A=i.Util.applyTransform([0,0],b),k=i.Util.applyTransform([d,h],b),P=i.Util.normalizeRect([A[0],A[1],k[0],k[1]]),S=Math.round(P[2]-P[0])||1,w=Math.round(P[3]-P[1])||1,x=this.cachedCanvases.getCanvas("fillCanvas",S,w,!0),C=x.context,T=Math.min(A[0],k[0]),E=Math.min(A[1],k[1]);C.translate(-T,-E);C.transform.apply(C,b);if(!o){o=(o=this._scaleImage(c.canvas,C.mozCurrentTransformInverse)).img;r&&v&&r.set(a,o)}C.imageSmoothingEnabled=getImageSmoothingEnabled(C.mozCurrentTransform,t.interpolate);drawImageAtIntegerCoords(C,o,0,0,o.width,o.height,0,0,d,h);C.globalCompositeOperation="source-in";var I=i.Util.transform(C.mozCurrentTransformInverse,[1,0,0,1,-T,-E]);C.fillStyle=v?p.getPattern(u,this,I,l.PathType.FILL):p;C.fillRect(0,0,d,h);if(r&&!v){this.cachedCanvases.delete("fillCanvas");r.set(a,x.canvas)}return{canvas:x.canvas,offsetX:Math.round(T),offsetY:Math.round(E)}}},{key:"setLineWidth",value:function setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking=null);this.current.lineWidth=t;this.ctx.lineWidth=t}},{key:"setLineCap",value:function setLineCap(t){this.ctx.lineCap=y[t]}},{key:"setLineJoin",value:function setLineJoin(t){this.ctx.lineJoin=g[t]}},{key:"setMiterLimit",value:function setMiterLimit(t){this.ctx.miterLimit=t}},{key:"setDash",value:function setDash(t,r){var a=this.ctx;if(void 0!==a.setLineDash){a.setLineDash(t);a.lineDashOffset=r}}},{key:"setRenderingIntent",value:function setRenderingIntent(t){}},{key:"setFlatness",value:function setFlatness(t){}},{key:"setGState",value:function setGState(t){for(var r=0,a=t.length;r<a;r++){var i=t[r],o=i[0],l=i[1];switch(o){case"LW":this.setLineWidth(l);break;case"LC":this.setLineCap(l);break;case"LJ":this.setLineJoin(l);break;case"ML":this.setMiterLimit(l);break;case"D":this.setDash(l[0],l[1]);break;case"RI":this.setRenderingIntent(l);break;case"FL":this.setFlatness(l);break;case"Font":this.setFont(l[0],l[1]);break;case"CA":this.current.strokeAlpha=i[1];break;case"ca":this.current.fillAlpha=i[1];this.ctx.globalAlpha=i[1];break;case"BM":this.ctx.globalCompositeOperation=l;break;case"SMask":this.current.activeSMask=l?this.tempSMask:null;this.tempSMask=null;this.checkSMaskState();break;case"TR":this.current.transferMaps=l}}}},{key:"inSMaskMode",get:function get(){return!!this.suspendedCtx}},{key:"checkSMaskState",value:function checkSMaskState(){var t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}},{key:"beginSMaskMode",value:function beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");var t=this.ctx.canvas.width,r=this.ctx.canvas.height,a="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(a,t,r,!0);this.suspendedCtx=this.ctx;this.ctx=i.context;var o=this.ctx;o.setTransform.apply(o,this.suspendedCtx.mozCurrentTransform);copyCtxState(this.suspendedCtx,o);!function mirrorContextOperations(t,r){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save;t.__originalRestore=t.restore;t.__originalRotate=t.rotate;t.__originalScale=t.scale;t.__originalTranslate=t.translate;t.__originalTransform=t.transform;t.__originalSetTransform=t.setTransform;t.__originalResetTransform=t.resetTransform;t.__originalClip=t.clip;t.__originalMoveTo=t.moveTo;t.__originalLineTo=t.lineTo;t.__originalBezierCurveTo=t.bezierCurveTo;t.__originalRect=t.rect;t.__originalClosePath=t.closePath;t.__originalBeginPath=t.beginPath;t._removeMirroring=function(){t.save=t.__originalSave;t.restore=t.__originalRestore;t.rotate=t.__originalRotate;t.scale=t.__originalScale;t.translate=t.__originalTranslate;t.transform=t.__originalTransform;t.setTransform=t.__originalSetTransform;t.resetTransform=t.__originalResetTransform;t.clip=t.__originalClip;t.moveTo=t.__originalMoveTo;t.lineTo=t.__originalLineTo;t.bezierCurveTo=t.__originalBezierCurveTo;t.rect=t.__originalRect;t.closePath=t.__originalClosePath;t.beginPath=t.__originalBeginPath;delete t._removeMirroring};t.save=function ctxSave(){r.save();this.__originalSave()};t.restore=function ctxRestore(){r.restore();this.__originalRestore()};t.translate=function ctxTranslate(t,a){r.translate(t,a);this.__originalTranslate(t,a)};t.scale=function ctxScale(t,a){r.scale(t,a);this.__originalScale(t,a)};t.transform=function ctxTransform(t,a,i,o,l,c){r.transform(t,a,i,o,l,c);this.__originalTransform(t,a,i,o,l,c)};t.setTransform=function ctxSetTransform(t,a,i,o,l,c){r.setTransform(t,a,i,o,l,c);this.__originalSetTransform(t,a,i,o,l,c)};t.resetTransform=function ctxResetTransform(){r.resetTransform();this.__originalResetTransform()};t.rotate=function ctxRotate(t){r.rotate(t);this.__originalRotate(t)};t.clip=function ctxRotate(t){r.clip(t);this.__originalClip(t)};t.moveTo=function(t,a){r.moveTo(t,a);this.__originalMoveTo(t,a)};t.lineTo=function(t,a){r.lineTo(t,a);this.__originalLineTo(t,a)};t.bezierCurveTo=function(t,a,i,o,l,c){r.bezierCurveTo(t,a,i,o,l,c);this.__originalBezierCurveTo(t,a,i,o,l,c)};t.rect=function(t,a,i,o){r.rect(t,a,i,o);this.__originalRect(t,a,i,o)};t.closePath=function(){r.closePath();this.__originalClosePath()};t.beginPath=function(){r.beginPath();this.__originalBeginPath()}}(o,this.suspendedCtx);this.setGState([["BM","source-over"],["ca",1],["CA",1]])}},{key:"endSMaskMode",value:function endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring();copyCtxState(this.ctx,this.suspendedCtx);this.ctx=this.suspendedCtx;this.suspendedCtx=null}},{key:"compose",value:function compose(t){if(this.current.activeSMask){if(t){t[0]=Math.floor(t[0]);t[1]=Math.floor(t[1]);t[2]=Math.ceil(t[2]);t[3]=Math.ceil(t[3])}else t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];var r=this.current.activeSMask;composeSMask(this.suspendedCtx,r,this.ctx,t);this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height);this.ctx.restore()}}},{key:"save",value:function save(){if(this.inSMaskMode){copyCtxState(this.ctx,this.suspendedCtx);this.suspendedCtx.save()}else this.ctx.save();var t=this.current;this.stateStack.push(t);this.current=t.clone()}},{key:"restore",value:function restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode();if(0!==this.stateStack.length){this.current=this.stateStack.pop();if(this.inSMaskMode){this.suspendedCtx.restore();copyCtxState(this.suspendedCtx,this.ctx)}else this.ctx.restore();this.checkSMaskState();this.pendingClip=null;this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null}}},{key:"transform",value:function transform(t,r,a,i,o,l){this.ctx.transform(t,r,a,i,o,l);this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null}},{key:"constructPath",value:function constructPath(t,r,a){for(var o,l,c=this.ctx,u=this.current,d=u.x,h=u.y,p=c.mozCurrentTransform,v=0===p[0]&&0===p[3]||0===p[1]&&0===p[2],y=v?a.slice(0):null,g=0,_=0,m=t.length;g<m;g++)switch(0|t[g]){case i.OPS.rectangle:d=r[_++];h=r[_++];var b=r[_++],A=r[_++],k=d+b,P=h+A;c.moveTo(d,h);if(0===b||0===A)c.lineTo(k,P);else{c.lineTo(k,h);c.lineTo(k,P);c.lineTo(d,P)}v||u.updateRectMinMax(p,[d,h,k,P]);c.closePath();break;case i.OPS.moveTo:d=r[_++];h=r[_++];c.moveTo(d,h);v||u.updatePathMinMax(p,d,h);break;case i.OPS.lineTo:d=r[_++];h=r[_++];c.lineTo(d,h);v||u.updatePathMinMax(p,d,h);break;case i.OPS.curveTo:o=d;l=h;d=r[_+4];h=r[_+5];c.bezierCurveTo(r[_],r[_+1],r[_+2],r[_+3],d,h);u.updateCurvePathMinMax(p,o,l,r[_],r[_+1],r[_+2],r[_+3],d,h,y);_+=6;break;case i.OPS.curveTo2:o=d;l=h;c.bezierCurveTo(d,h,r[_],r[_+1],r[_+2],r[_+3]);u.updateCurvePathMinMax(p,o,l,d,h,r[_],r[_+1],r[_+2],r[_+3],y);d=r[_+2];h=r[_+3];_+=4;break;case i.OPS.curveTo3:o=d;l=h;d=r[_+2];h=r[_+3];c.bezierCurveTo(r[_],r[_+1],d,h,d,h);u.updateCurvePathMinMax(p,o,l,r[_],r[_+1],d,h,d,h,y);_+=4;break;case i.OPS.closePath:c.closePath()}v&&u.updateScalingPathMinMax(p,y);u.setCurrentPoint(d,h)}},{key:"closePath",value:function closePath(){this.ctx.closePath()}},{key:"stroke",value:function stroke(t){t=void 0===t||t;var r=this.ctx,a=this.current.strokeColor;r.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"===_typeof(a)&&null!=a&&a.getPattern){r.save();r.strokeStyle=a.getPattern(r,this,r.mozCurrentTransformInverse,l.PathType.STROKE);this.rescaleAndStroke(!1);r.restore()}else this.rescaleAndStroke(!0);t&&this.consumePath(this.current.getClippedPathBoundingBox());r.globalAlpha=this.current.fillAlpha}},{key:"closeStroke",value:function closeStroke(){this.closePath();this.stroke()}},{key:"fill",value:function fill(t){t=void 0===t||t;var r=this.ctx,a=this.current.fillColor,i=!1;if(this.current.patternFill){r.save();r.fillStyle=a.getPattern(r,this,r.mozCurrentTransformInverse,l.PathType.FILL);i=!0}var o=this.current.getClippedPathBoundingBox();if(this.contentVisible&&null!==o)if(this.pendingEOFill){r.fill("evenodd");this.pendingEOFill=!1}else r.fill();i&&r.restore();t&&this.consumePath(o)}},{key:"eoFill",value:function eoFill(){this.pendingEOFill=!0;this.fill()}},{key:"fillStroke",value:function fillStroke(){this.fill(!1);this.stroke(!1);this.consumePath()}},{key:"eoFillStroke",value:function eoFillStroke(){this.pendingEOFill=!0;this.fillStroke()}},{key:"closeFillStroke",value:function closeFillStroke(){this.closePath();this.fillStroke()}},{key:"closeEOFillStroke",value:function closeEOFillStroke(){this.pendingEOFill=!0;this.closePath();this.fillStroke()}},{key:"endPath",value:function endPath(){this.consumePath()}},{key:"clip",value:function clip(){this.pendingClip=_}},{key:"eoClip",value:function eoClip(){this.pendingClip=m}},{key:"beginText",value:function beginText(){this.current.textMatrix=i.IDENTITY_MATRIX;this.current.textMatrixScale=1;this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}},{key:"endText",value:function endText(){var t=this.pendingTextPaths,r=this.ctx;if(void 0!==t){r.save();r.beginPath();var a,i=_createForOfIteratorHelper(t);try{for(i.s();!(a=i.n()).done;){var o=a.value;r.setTransform.apply(r,o.transform);r.translate(o.x,o.y);o.addToPath(r,o.fontSize)}}catch(t){i.e(t)}finally{i.f()}r.restore();r.clip();r.beginPath();delete this.pendingTextPaths}else r.beginPath()}},{key:"setCharSpacing",value:function setCharSpacing(t){this.current.charSpacing=t}},{key:"setWordSpacing",value:function setWordSpacing(t){this.current.wordSpacing=t}},{key:"setHScale",value:function setHScale(t){this.current.textHScale=t/100}},{key:"setLeading",value:function setLeading(t){this.current.leading=-t}},{key:"setFont",value:function setFont(t,r){var a=this.commonObjs.get(t),o=this.current;if(!a)throw new Error("Can't find font for ".concat(t));o.fontMatrix=a.fontMatrix||i.FONT_IDENTITY_MATRIX;0!==o.fontMatrix[0]&&0!==o.fontMatrix[3]||(0,i.warn)("Invalid font matrix for font "+t);if(r<0){r=-r;o.fontDirection=-1}else o.fontDirection=1;this.current.font=a;this.current.fontSize=r;if(!a.isType3Font){var l=a.loadedName||"sans-serif",c="normal";a.black?c="900":a.bold&&(c="bold");var u=a.italic?"italic":"normal",d='"'.concat(l,'", ').concat(a.fallbackName),h=r;r<16?h=16:r>100&&(h=100);this.current.fontSizeScale=r/h;this.ctx.font="".concat(u," ").concat(c," ").concat(h,"px ").concat(d)}}},{key:"setTextRenderingMode",value:function setTextRenderingMode(t){this.current.textRenderingMode=t}},{key:"setTextRise",value:function setTextRise(t){this.current.textRise=t}},{key:"moveText",value:function moveText(t,r){this.current.x=this.current.lineX+=t;this.current.y=this.current.lineY+=r}},{key:"setLeadingMoveText",value:function setLeadingMoveText(t,r){this.setLeading(-r);this.moveText(t,r)}},{key:"setTextMatrix",value:function setTextMatrix(t,r,a,i,o,l){this.current.textMatrix=[t,r,a,i,o,l];this.current.textMatrixScale=Math.hypot(t,r);this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}},{key:"nextLine",value:function nextLine(){this.moveText(0,this.current.leading)}},{key:"paintChar",value:function paintChar(t,r,a,o){var l,c=this.ctx,u=this.current,d=u.font,h=u.textRenderingMode,p=u.fontSize/u.fontSizeScale,v=h&i.TextRenderingMode.FILL_STROKE_MASK,y=!!(h&i.TextRenderingMode.ADD_TO_PATH_FLAG),g=u.patternFill&&!d.missingFile;(d.disableFontFace||y||g)&&(l=d.getPathGenerator(this.commonObjs,t));if(d.disableFontFace||g){c.save();c.translate(r,a);c.beginPath();l(c,p);o&&c.setTransform.apply(c,o);v!==i.TextRenderingMode.FILL&&v!==i.TextRenderingMode.FILL_STROKE||c.fill();v!==i.TextRenderingMode.STROKE&&v!==i.TextRenderingMode.FILL_STROKE||c.stroke();c.restore()}else{v!==i.TextRenderingMode.FILL&&v!==i.TextRenderingMode.FILL_STROKE||c.fillText(t,r,a);v!==i.TextRenderingMode.STROKE&&v!==i.TextRenderingMode.FILL_STROKE||c.strokeText(t,r,a)}if(y){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:c.mozCurrentTransform,x:r,y:a,fontSize:p,addToPath:l})}}},{key:"isFontSubpixelAAEnabled",get:function get(){var t=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10,!1).context;t.scale(1.5,1);t.fillText("I",0,10);for(var r=t.getImageData(0,0,10,10).data,a=!1,o=3;o<r.length;o+=4)if(r[o]>0&&r[o]<255){a=!0;break}return(0,i.shadow)(this,"isFontSubpixelAAEnabled",a)}},{key:"showText",value:function showText(t){var r=this.current,a=r.font;if(a.isType3Font)return this.showType3Text(t);var o=r.fontSize;if(0!==o){var c,u=this.ctx,d=r.fontSizeScale,h=r.charSpacing,p=r.wordSpacing,v=r.fontDirection,y=r.textHScale*v,g=t.length,_=a.vertical,m=_?1:-1,b=a.defaultVMetrics,A=o*r.fontMatrix[0],k=r.textRenderingMode===i.TextRenderingMode.FILL&&!a.disableFontFace&&!r.patternFill;u.save();u.transform.apply(u,r.textMatrix);u.translate(r.x,r.y+r.textRise);v>0?u.scale(y,-1):u.scale(y,1);if(r.patternFill){u.save();var P=r.fillColor.getPattern(u,this,u.mozCurrentTransformInverse,l.PathType.FILL);c=u.mozCurrentTransform;u.restore();u.fillStyle=P}var S=r.lineWidth,w=r.textMatrixScale;if(0===w||0===S){var x=r.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;x!==i.TextRenderingMode.STROKE&&x!==i.TextRenderingMode.FILL_STROKE||(S=this.getSinglePixelWidth())}else S/=w;if(1!==d){u.scale(d,d);S/=d}u.lineWidth=S;var C,T=0;for(C=0;C<g;++C){var E=t[C];if("number"!=typeof E){var I=!1,O=(E.isSpace?p:0)+h,M=E.fontChar,R=E.accent,D=void 0,L=void 0,G=E.width;if(_){var j=E.vmetric||b,N=-(E.vmetric?j[1]:.5*G)*A,B=j[2]*A;G=j?-j[0]:G;D=N/d;L=(T+B)/d}else{D=T/d;L=0}if(a.remeasure&&G>0){var W=1e3*u.measureText(M).width/o*d;if(G<W&&this.isFontSubpixelAAEnabled){var U=G/W;I=!0;u.save();u.scale(U,1);D/=U}else G!==W&&(D+=(G-W)/2e3*o/d)}if(this.contentVisible&&(E.isInFont||a.missingFile))if(k&&!R)u.fillText(M,D,L);else{this.paintChar(M,D,L,c);if(R){var H=D+o*R.offset.x/d,z=L-o*R.offset.y/d;this.paintChar(R.fontChar,H,z,c)}}T+=_?G*A-O*v:G*A+O*v;I&&u.restore()}else T+=m*E*o/1e3}_?r.y-=T:r.x+=T*y;u.restore();this.compose()}}},{key:"showType3Text",value:function showType3Text(t){var r,a,o,l,c=this.ctx,u=this.current,d=u.font,h=u.fontSize,p=u.fontDirection,v=d.vertical?1:-1,y=u.charSpacing,g=u.wordSpacing,_=u.textHScale*p,m=u.fontMatrix||i.FONT_IDENTITY_MATRIX,b=t.length;if(!(u.textRenderingMode===i.TextRenderingMode.INVISIBLE)&&0!==h){this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null;c.save();c.transform.apply(c,u.textMatrix);c.translate(u.x,u.y);c.scale(_,p);for(r=0;r<b;++r)if("number"!=typeof(a=t[r])){var A=(a.isSpace?g:0)+y,k=d.charProcOperatorList[a.operatorListId];if(k){if(this.contentVisible){this.processingType3=a;this.save();c.scale(h,h);c.transform.apply(c,m);this.executeOperatorList(k);this.restore()}o=i.Util.applyTransform([a.width,0],m)[0]*h+A;c.translate(o,0);u.x+=o*_}else(0,i.warn)('Type3 character "'.concat(a.operatorListId,'" is not available.'))}else{l=v*a*h/1e3;this.ctx.translate(l,0);u.x+=l*_}c.restore();this.processingType3=null}}},{key:"setCharWidth",value:function setCharWidth(t,r){}},{key:"setCharWidthAndBounds",value:function setCharWidthAndBounds(t,r,a,i,o,l){this.ctx.rect(a,i,o-a,l-i);this.ctx.clip();this.endPath()}},{key:"getColorN_Pattern",value:function getColorN_Pattern(t){var r,a=this;if("TilingPattern"===t[0]){var i=t[1],o=this.baseTransform||this.ctx.mozCurrentTransform.slice(),c={createCanvasGraphics:function createCanvasGraphics(t){return new CanvasGraphics(t,a.commonObjs,a.objs,a.canvasFactory)}};r=new l.TilingPattern(t,i,this.ctx,c,o)}else r=this._getPattern(t[1],t[2]);return r}},{key:"setStrokeColorN",value:function setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}},{key:"setFillColorN",value:function setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments);this.current.patternFill=!0}},{key:"setStrokeRGBColor",value:function setStrokeRGBColor(t,r,a){var o,l=(null===(o=this.selectColor)||void 0===o?void 0:o.call(this,t,r,a))||i.Util.makeHexColor(t,r,a);this.ctx.strokeStyle=l;this.current.strokeColor=l}},{key:"setFillRGBColor",value:function setFillRGBColor(t,r,a){var o,l=(null===(o=this.selectColor)||void 0===o?void 0:o.call(this,t,r,a))||i.Util.makeHexColor(t,r,a);this.ctx.fillStyle=l;this.current.fillColor=l;this.current.patternFill=!1}},{key:"_getPattern",value:function _getPattern(t){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.cachedPatterns.has(t))r=this.cachedPatterns.get(t);else{r=(0,l.getShadingPattern)(this.objs.get(t));this.cachedPatterns.set(t,r)}a&&(r.matrix=a);return r}},{key:"shadingFill",value:function shadingFill(t){if(this.contentVisible){var r=this.ctx;this.save();var a=this._getPattern(t);r.fillStyle=a.getPattern(r,this,r.mozCurrentTransformInverse,l.PathType.SHADING);var o=r.mozCurrentTransformInverse;if(o){var c=r.canvas,u=c.width,d=c.height,h=i.Util.applyTransform([0,0],o),p=i.Util.applyTransform([0,d],o),v=i.Util.applyTransform([u,0],o),y=i.Util.applyTransform([u,d],o),g=Math.min(h[0],p[0],v[0],y[0]),_=Math.min(h[1],p[1],v[1],y[1]),m=Math.max(h[0],p[0],v[0],y[0]),b=Math.max(h[1],p[1],v[1],y[1]);this.ctx.fillRect(g,_,m-g,b-_)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox());this.restore()}}},{key:"beginInlineImage",value:function beginInlineImage(){(0,i.unreachable)("Should not call beginInlineImage")}},{key:"beginImageData",value:function beginImageData(){(0,i.unreachable)("Should not call beginImageData")}},{key:"paintFormXObjectBegin",value:function paintFormXObjectBegin(t,r){if(this.contentVisible){this.save();this.baseTransformStack.push(this.baseTransform);Array.isArray(t)&&6===t.length&&this.transform.apply(this,t);this.baseTransform=this.ctx.mozCurrentTransform;if(r){var a=r[2]-r[0],i=r[3]-r[1];this.ctx.rect(r[0],r[1],a,i);this.current.updateRectMinMax(this.ctx.mozCurrentTransform,r);this.clip();this.endPath()}}}},{key:"paintFormXObjectEnd",value:function paintFormXObjectEnd(){if(this.contentVisible){this.restore();this.baseTransform=this.baseTransformStack.pop()}}},{key:"beginGroup",value:function beginGroup(t){if(this.contentVisible){this.save();if(this.inSMaskMode){this.endSMaskMode();this.current.activeSMask=null}var r=this.ctx;t.isolated||(0,i.info)("TODO: Support non-isolated groups.");t.knockout&&(0,i.warn)("Knockout groups not supported.");var a=r.mozCurrentTransform;t.matrix&&r.transform.apply(r,t.matrix);if(!t.bbox)throw new Error("Bounding box is required.");var o=i.Util.getAxialAlignedBoundingBox(t.bbox,r.mozCurrentTransform),l=[0,0,r.canvas.width,r.canvas.height];o=i.Util.intersect(o,l)||[0,0,0,0];var c=Math.floor(o[0]),u=Math.floor(o[1]),h=Math.max(Math.ceil(o[2])-c,1),p=Math.max(Math.ceil(o[3])-u,1),v=1,y=1;if(h>d){v=h/d;h=d}if(p>d){y=p/d;p=d}this.current.startNewPathAndClipBox([0,0,h,p]);var g="groupAt"+this.groupLevel;t.smask&&(g+="_smask_"+this.smaskCounter++%2);var _=this.cachedCanvases.getCanvas(g,h,p,!0),m=_.context;m.scale(1/v,1/y);m.translate(-c,-u);m.transform.apply(m,a);if(t.smask)this.smaskStack.push({canvas:_.canvas,context:m,offsetX:c,offsetY:u,scaleX:v,scaleY:y,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null});else{r.setTransform(1,0,0,1,0,0);r.translate(c,u);r.scale(v,y);r.save()}copyCtxState(r,m);this.ctx=m;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(r);this.groupLevel++}}},{key:"endGroup",value:function endGroup(t){if(this.contentVisible){this.groupLevel--;var r=this.ctx,a=this.groupStack.pop();this.ctx=a;this.ctx.imageSmoothingEnabled=!1;if(t.smask){this.tempSMask=this.smaskStack.pop();this.restore()}else{this.ctx.restore();var o=this.ctx.mozCurrentTransform;this.restore();this.ctx.save();this.ctx.setTransform.apply(this.ctx,o);var l=i.Util.getAxialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],o);this.ctx.drawImage(r.canvas,0,0);this.ctx.restore();this.compose(l)}}}},{key:"beginAnnotation",value:function beginAnnotation(t,r,a,o,l){_classPrivateMethodGet(this,b,_restoreInitialState2).call(this);resetCtxToDefault(this.ctx,this.foregroundColor);this.ctx.save();this.save();this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform);if(Array.isArray(r)&&4===r.length){var c=r[2]-r[0],u=r[3]-r[1];if(l&&this.annotationCanvasMap){(a=a.slice())[4]-=r[0];a[5]-=r[1];(r=r.slice())[0]=r[1]=0;r[2]=c;r[3]=u;var d=_slicedToArray(i.Util.singularValueDecompose2dScale(this.ctx.mozCurrentTransform),2),h=d[0],p=d[1],y=this.viewportScale,g=Math.ceil(c*this.outputScaleX*y),_=Math.ceil(u*this.outputScaleY*y);this.annotationCanvas=this.canvasFactory.create(g,_);var m=this.annotationCanvas,A=m.canvas,k=m.context;this.annotationCanvasMap.set(t,A);this.annotationCanvas.savedCtx=this.ctx;this.ctx=k;addContextCurrentTransform(this.ctx);this.ctx.setTransform(h,0,0,-p,0,u*p);resetCtxToDefault(this.ctx,this.foregroundColor)}else{resetCtxToDefault(this.ctx,this.foregroundColor);this.ctx.rect(r[0],r[1],c,u);this.ctx.clip();this.endPath()}}this.current=new v(this.ctx.canvas.width,this.ctx.canvas.height);this.transform.apply(this,a);this.transform.apply(this,o)}},{key:"endAnnotation",value:function endAnnotation(){if(this.annotationCanvas){this.ctx=this.annotationCanvas.savedCtx;delete this.annotationCanvas.savedCtx;delete this.annotationCanvas}}},{key:"paintImageMaskXObject",value:function paintImageMaskXObject(t){if(this.contentVisible){var r=t.count;(t=this.getObject(t.data,t)).count=r;var a=this.ctx,i=this.processingType3;if(i){void 0===i.compiled&&(i.compiled=function compileType3Glyph(t){var r=t.width,a=t.height;if(r>1e3||a>1e3)return null;var i,o,l,c,d=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),h=r+1,p=new Uint8Array(h*(a+1)),v=r+7&-8,y=new Uint8Array(v*a),g=0,_=_createForOfIteratorHelper(t.data);try{for(_.s();!(c=_.n()).done;)for(var m=c.value,b=128;b>0;){y[g++]=m&b?0:255;b>>=1}}catch(t){_.e(t)}finally{_.f()}var A=0;if(0!==y[g=0]){p[0]=1;++A}for(o=1;o<r;o++){if(y[g]!==y[g+1]){p[o]=y[g]?2:1;++A}g++}if(0!==y[g]){p[o]=2;++A}for(i=1;i<a;i++){l=i*h;if(y[(g=i*v)-v]!==y[g]){p[l]=y[g]?1:8;++A}var k=(y[g]?4:0)+(y[g-v]?8:0);for(o=1;o<r;o++){if(d[k=(k>>2)+(y[g+1]?4:0)+(y[g-v+1]?8:0)]){p[l+o]=d[k];++A}g++}if(y[g-v]!==y[g]){p[l+o]=y[g]?2:4;++A}if(A>1e3)return null}l=i*h;if(0!==y[g=v*(a-1)]){p[l]=8;++A}for(o=1;o<r;o++){if(y[g]!==y[g+1]){p[l+o]=y[g]?4:8;++A}g++}if(0!==y[g]){p[l+o]=4;++A}if(A>1e3)return null;var P,S,w,x=new Int32Array([0,h,-1,0,-h,0,0,0,1]);u.isNodeJS?S=[]:P=new Path2D;for(i=0;A&&i<=a;i++){for(var C=i*h,T=C+r;C<T&&!p[C];)C++;if(C!==T){P?P.moveTo(C%h,i):w=[C%h,i];var E=C,I=p[C];do{var O=x[I];do{C+=O}while(!p[C]);var M=p[C];if(5!==M&&10!==M){I=M;p[C]=0}else{I=M&51*I>>4;p[C]&=I>>2|I<<2}P?P.lineTo(C%h,C/h|0):w.push(C%h,C/h|0);p[C]||--A}while(E!==C);P||S.push(w);--i}}y=null;p=null;return function drawOutline(t){t.save();t.scale(1/r,-1/a);t.translate(0,-a);if(P)t.fill(P);else{t.beginPath();var i,o=_createForOfIteratorHelper(S);try{for(o.s();!(i=o.n()).done;){var l=i.value;t.moveTo(l[0],l[1]);for(var c=2,u=l.length;c<u;c+=2)t.lineTo(l[c],l[c+1])}}catch(t){o.e(t)}finally{o.f()}t.fill()}t.beginPath();t.restore()}}(t));if(i.compiled){i.compiled(a);return}}var o=this._createMaskCanvas(t),l=o.canvas;a.save();a.setTransform(1,0,0,1,0,0);a.drawImage(l,o.offsetX,o.offsetY);a.restore();this.compose()}}},{key:"paintImageMaskXObjectRepeat",value:function paintImageMaskXObjectRepeat(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,l=arguments.length>4?arguments[4]:void 0,c=arguments.length>5?arguments[5]:void 0;if(this.contentVisible){t=this.getObject(t.data,t);var u=this.ctx;u.save();var d=u.mozCurrentTransform;u.transform(r,a,o,l,0,0);var h=this._createMaskCanvas(t);u.setTransform(1,0,0,1,0,0);for(var p=0,v=c.length;p<v;p+=2){var y=i.Util.transform(d,[r,a,o,l,c[p],c[p+1]]),g=i.Util.applyTransform([0,0],y),_=_slicedToArray(g,2),m=_[0],b=_[1];u.drawImage(h.canvas,m,b)}u.restore();this.compose()}}},{key:"paintImageMaskXObjectGroup",value:function paintImageMaskXObjectGroup(t){if(this.contentVisible){var r,a=this.ctx,i=this.current.fillColor,o=this.current.patternFill,c=_createForOfIteratorHelper(t);try{for(c.s();!(r=c.n()).done;){var u=r.value,d=u.data,h=u.width,p=u.height,v=u.transform,y=this.cachedCanvases.getCanvas("maskCanvas",h,p,!1),g=y.context;g.save();putBinaryImageMask(g,this.getObject(d,u));g.globalCompositeOperation="source-in";g.fillStyle=o?i.getPattern(g,this,a.mozCurrentTransformInverse,l.PathType.FILL):i;g.fillRect(0,0,h,p);g.restore();a.save();a.transform.apply(a,v);a.scale(1,-1);drawImageAtIntegerCoords(a,y.canvas,0,0,h,p,0,-1,1,1);a.restore()}}catch(t){c.e(t)}finally{c.f()}this.compose()}}},{key:"paintImageXObject",value:function paintImageXObject(t){if(this.contentVisible){var r=this.getObject(t);r?this.paintInlineImageXObject(r):(0,i.warn)("Dependent image isn't ready yet")}}},{key:"paintImageXObjectRepeat",value:function paintImageXObjectRepeat(t,r,a,o){if(this.contentVisible){var l=this.getObject(t);if(l){for(var c=l.width,u=l.height,d=[],h=0,p=o.length;h<p;h+=2)d.push({transform:[r,0,0,a,o[h],o[h+1]],x:0,y:0,w:c,h:u});this.paintInlineImageXObjectGroup(l,d)}else(0,i.warn)("Dependent image isn't ready yet")}}},{key:"paintInlineImageXObject",value:function paintInlineImageXObject(t){if(this.contentVisible){var r,a=t.width,i=t.height,o=this.ctx;this.save();o.scale(1/a,-1/i);if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)r=t;else{var l=this.cachedCanvases.getCanvas("inlineImage",a,i,!1);putBinaryImageData(l.context,t,this.current.transferMaps);r=l.canvas}var c=this._scaleImage(r,o.mozCurrentTransformInverse);o.imageSmoothingEnabled=getImageSmoothingEnabled(o.mozCurrentTransform,t.interpolate);var u=_slicedToArray(drawImageAtIntegerCoords(o,c.img,0,0,c.paintWidth,c.paintHeight,0,-i,a,i),2),d=u[0],h=u[1];if(this.imageLayer){var p=this.getCanvasPosition(0,-i);this.imageLayer.appendImage({imgData:t,left:p[0],top:p[1],width:d,height:h})}this.compose();this.restore()}}},{key:"paintInlineImageXObjectGroup",value:function paintInlineImageXObjectGroup(t,r){if(this.contentVisible){var a=this.ctx,i=t.width,o=t.height,l=this.cachedCanvases.getCanvas("inlineImage",i,o,!1);putBinaryImageData(l.context,t,this.current.transferMaps);for(var c=0,u=r.length;c<u;c++){var d=r[c];a.save();a.transform.apply(a,d.transform);a.scale(1,-1);drawImageAtIntegerCoords(a,l.canvas,d.x,d.y,d.w,d.h,0,-1,1,1);if(this.imageLayer){var h=this.getCanvasPosition(d.x,d.y);this.imageLayer.appendImage({imgData:t,left:h[0],top:h[1],width:i,height:o})}a.restore()}this.compose()}}},{key:"paintSolidColorImageMask",value:function paintSolidColorImageMask(){if(this.contentVisible){this.ctx.fillRect(0,0,1,1);this.compose()}}},{key:"markPoint",value:function markPoint(t){}},{key:"markPointProps",value:function markPointProps(t,r){}},{key:"beginMarkedContent",value:function beginMarkedContent(t){this.markedContentStack.push({visible:!0})}},{key:"beginMarkedContentProps",value:function beginMarkedContentProps(t,r){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}},{key:"endMarkedContent",value:function endMarkedContent(){this.markedContentStack.pop();this.contentVisible=this.isContentVisible()}},{key:"beginCompat",value:function beginCompat(){}},{key:"endCompat",value:function endCompat(){}},{key:"consumePath",value:function consumePath(t){var r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath();this.pendingClip||this.compose(t);var a=this.ctx;if(this.pendingClip){r||(this.pendingClip===m?a.clip("evenodd"):a.clip());this.pendingClip=null}this.current.startNewPathAndClipBox(this.current.clipBox);a.beginPath()}},{key:"getSinglePixelWidth",value:function getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){var t=this.ctx.mozCurrentTransform;if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{var r=Math.abs(t[0]*t[3]-t[2]*t[1]),a=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(a,i)/r}}return this._cachedGetSinglePixelWidth}},{key:"getScaleForStroking",value:function getScaleForStroking(){if(!this._cachedScaleForStroking){var t,r,a=this.current.lineWidth,i=this.ctx.mozCurrentTransform;if(0===i[1]&&0===i[2]){var o=Math.abs(i[0]),l=Math.abs(i[3]);if(0===a){t=1/o;r=1/l}else{var c=o*a,u=l*a;t=c<1?1/c:1;r=u<1?1/u:1}}else{var d=Math.abs(i[0]*i[3]-i[2]*i[1]),h=Math.hypot(i[0],i[1]),p=Math.hypot(i[2],i[3]);if(0===a){t=p/d;r=h/d}else{var v=a*d;t=p>v?p/v:1;r=h>v?h/v:1}}this._cachedScaleForStroking=[t,r]}return this._cachedScaleForStroking}},{key:"rescaleAndStroke",value:function rescaleAndStroke(t){var r=this.ctx,a=this.current.lineWidth,i=_slicedToArray(this.getScaleForStroking(),2),o=i[0],l=i[1];r.lineWidth=a||1;if(1!==o||1!==l){var c,u,d;if(t){c=r.mozCurrentTransform.slice();u=r.getLineDash().slice();d=r.lineDashOffset}r.scale(o,l);var h=Math.max(o,l);r.setLineDash(r.getLineDash().map((function(t){return t/h})));r.lineDashOffset/=h;r.stroke();if(t){r.setTransform.apply(r,_toConsumableArray(c));r.setLineDash(u);r.lineDashOffset=d}}else r.stroke()}},{key:"getCanvasPosition",value:function getCanvasPosition(t,r){var a=this.ctx.mozCurrentTransform;return[a[0]*t+a[2]*r+a[4],a[1]*t+a[3]*r+a[5]]}},{key:"isContentVisible",value:function isContentVisible(){for(var t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}]);return CanvasGraphics}();r.CanvasGraphics=A;function _restoreInitialState2(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore();if(this.transparentCanvas){this.ctx=this.compositeCtx;this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.drawImage(this.transparentCanvas,0,0);this.ctx.restore();this.transparentCanvas=null}}for(var k in i.OPS)void 0!==A.prototype[k]&&(A.prototype[i.OPS[k]]=A.prototype[k])},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.TilingPattern=r.PathType=void 0;r.getShadingPattern=function getShadingPattern(t){switch(t[0]){case"RadialAxial":return new u(t);case"Mesh":return new d(t);case"Dummy":return new h}throw new Error("Unknown IR type: ".concat(t[0]))};var i=a(1),o=a(3);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}var l={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};r.PathType=l;function applyBoundingBox(t,r){if(r&&!o.isNodeJS){var a=r[2]-r[0],i=r[3]-r[1],l=new Path2D;l.rect(r[0],r[1],a,i);t.clip(l)}}var c=function(){function BaseShadingPattern(){_classCallCheck(this,BaseShadingPattern);this.constructor===BaseShadingPattern&&(0,i.unreachable)("Cannot initialize BaseShadingPattern.")}_createClass(BaseShadingPattern,[{key:"getPattern",value:function getPattern(){(0,i.unreachable)("Abstract method `getPattern` called.")}}]);return BaseShadingPattern}(),u=function(t){_inherits(RadialAxialShadingPattern,t);var r=_createSuper(RadialAxialShadingPattern);function RadialAxialShadingPattern(t){var a;_classCallCheck(this,RadialAxialShadingPattern);(a=r.call(this))._type=t[1];a._bbox=t[2];a._colorStops=t[3];a._p0=t[4];a._p1=t[5];a._r0=t[6];a._r1=t[7];a.matrix=null;return a}_createClass(RadialAxialShadingPattern,[{key:"_createGradient",value:function _createGradient(t){var r;"axial"===this._type?r=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(r=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));var a,i=_createForOfIteratorHelper(this._colorStops);try{for(i.s();!(a=i.n()).done;){var o=a.value;r.addColorStop(o[0],o[1])}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"getPattern",value:function getPattern(t,r,a,o){var c;if(o===l.STROKE||o===l.FILL){var u=r.current.getClippedPathBoundingBox(o,t.mozCurrentTransform)||[0,0,0,0],d=Math.ceil(u[2]-u[0])||1,h=Math.ceil(u[3]-u[1])||1,p=r.cachedCanvases.getCanvas("pattern",d,h,!0),v=p.context;v.clearRect(0,0,v.canvas.width,v.canvas.height);v.beginPath();v.rect(0,0,v.canvas.width,v.canvas.height);v.translate(-u[0],-u[1]);a=i.Util.transform(a,[1,0,0,1,u[0],u[1]]);v.transform.apply(v,r.baseTransform);this.matrix&&v.transform.apply(v,this.matrix);applyBoundingBox(v,this._bbox);v.fillStyle=this._createGradient(v);v.fill();c=t.createPattern(p.canvas,"no-repeat");var y=new DOMMatrix(a);try{c.setTransform(y)}catch(t){(0,i.warn)('RadialAxialShadingPattern.getPattern: "'.concat(null==t?void 0:t.message,'".'))}}else{applyBoundingBox(t,this._bbox);c=this._createGradient(t)}return c}}]);return RadialAxialShadingPattern}(c);function drawTriangle(t,r,a,i,o,l,c,u){var d,h=r.coords,p=r.colors,v=t.data,y=4*t.width;if(h[a+1]>h[i+1]){d=a;a=i;i=d;d=l;l=c;c=d}if(h[i+1]>h[o+1]){d=i;i=o;o=d;d=c;c=u;u=d}if(h[a+1]>h[i+1]){d=a;a=i;i=d;d=l;l=c;c=d}var g=(h[a]+r.offsetX)*r.scaleX,_=(h[a+1]+r.offsetY)*r.scaleY,m=(h[i]+r.offsetX)*r.scaleX,b=(h[i+1]+r.offsetY)*r.scaleY,A=(h[o]+r.offsetX)*r.scaleX,k=(h[o+1]+r.offsetY)*r.scaleY;if(!(_>=k))for(var P,S,w,x,C,T,E,I,O=p[l],M=p[l+1],R=p[l+2],D=p[c],L=p[c+1],G=p[c+2],j=p[u],N=p[u+1],B=p[u+2],W=Math.round(_),U=Math.round(k),H=W;H<=U;H++){if(H<b){var z=void 0;P=g-(g-m)*(z=H<_?0:(_-H)/(_-b));S=O-(O-D)*z;w=M-(M-L)*z;x=R-(R-G)*z}else{var V=void 0;P=m-(m-A)*(V=H>k?1:b===k?0:(b-H)/(b-k));S=D-(D-j)*V;w=L-(L-N)*V;x=G-(G-B)*V}var X=void 0;C=g-(g-A)*(X=H<_?0:H>k?1:(_-H)/(_-k));T=O-(O-j)*X;E=M-(M-N)*X;I=R-(R-B)*X;for(var Y=Math.round(Math.min(P,C)),K=Math.round(Math.max(P,C)),J=y*H+4*Y,Q=Y;Q<=K;Q++){(X=(P-Q)/(P-C))<0?X=0:X>1&&(X=1);v[J++]=S-(S-T)*X|0;v[J++]=w-(w-E)*X|0;v[J++]=x-(x-I)*X|0;v[J++]=255}}}function drawFigure(t,r,a){var i,o,l=r.coords,c=r.colors;switch(r.type){case"lattice":var u=r.verticesPerRow,d=Math.floor(l.length/u)-1,h=u-1;for(i=0;i<d;i++)for(var p=i*u,v=0;v<h;v++,p++){drawTriangle(t,a,l[p],l[p+1],l[p+u],c[p],c[p+1],c[p+u]);drawTriangle(t,a,l[p+u+1],l[p+1],l[p+u],c[p+u+1],c[p+1],c[p+u])}break;case"triangles":for(i=0,o=l.length;i<o;i+=3)drawTriangle(t,a,l[i],l[i+1],l[i+2],c[i],c[i+1],c[i+2]);break;default:throw new Error("illegal figure")}}var d=function(t){_inherits(MeshShadingPattern,t);var r=_createSuper(MeshShadingPattern);function MeshShadingPattern(t){var a;_classCallCheck(this,MeshShadingPattern);(a=r.call(this))._coords=t[2];a._colors=t[3];a._figures=t[4];a._bounds=t[5];a._bbox=t[7];a._background=t[8];a.matrix=null;return a}_createClass(MeshShadingPattern,[{key:"_createMeshCanvas",value:function _createMeshCanvas(t,r,a){var i=Math.floor(this._bounds[0]),o=Math.floor(this._bounds[1]),l=Math.ceil(this._bounds[2])-i,c=Math.ceil(this._bounds[3])-o,u=Math.min(Math.ceil(Math.abs(l*t[0]*1.1)),3e3),d=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3),h=l/u,p=c/d,v={coords:this._coords,colors:this._colors,offsetX:-i,offsetY:-o,scaleX:1/h,scaleY:1/p},y=u+4,g=d+4,_=a.getCanvas("mesh",y,g,!1),m=_.context,b=m.createImageData(u,d);if(r)for(var A=b.data,k=0,P=A.length;k<P;k+=4){A[k]=r[0];A[k+1]=r[1];A[k+2]=r[2];A[k+3]=255}var S,w=_createForOfIteratorHelper(this._figures);try{for(w.s();!(S=w.n()).done;){drawFigure(b,S.value,v)}}catch(t){w.e(t)}finally{w.f()}m.putImageData(b,2,2);return{canvas:_.canvas,offsetX:i-2*h,offsetY:o-2*p,scaleX:h,scaleY:p}}},{key:"getPattern",value:function getPattern(t,r,a,o){applyBoundingBox(t,this._bbox);var c;if(o===l.SHADING)c=i.Util.singularValueDecompose2dScale(t.mozCurrentTransform);else{c=i.Util.singularValueDecompose2dScale(r.baseTransform);if(this.matrix){var u=i.Util.singularValueDecompose2dScale(this.matrix);c=[c[0]*u[0],c[1]*u[1]]}}var d=this._createMeshCanvas(c,o===l.SHADING?null:this._background,r.cachedCanvases);if(o!==l.SHADING){t.setTransform.apply(t,r.baseTransform);this.matrix&&t.transform.apply(t,this.matrix)}t.translate(d.offsetX,d.offsetY);t.scale(d.scaleX,d.scaleY);return t.createPattern(d.canvas,"no-repeat")}}]);return MeshShadingPattern}(c),h=function(t){_inherits(DummyShadingPattern,t);var r=_createSuper(DummyShadingPattern);function DummyShadingPattern(){_classCallCheck(this,DummyShadingPattern);return r.apply(this,arguments)}_createClass(DummyShadingPattern,[{key:"getPattern",value:function getPattern(){return"hotpink"}}]);return DummyShadingPattern}(c);var p=1,v=2,y=function(){function TilingPattern(t,r,a,i,o){_classCallCheck(this,TilingPattern);this.operatorList=t[2];this.matrix=t[3]||[1,0,0,1,0,0];this.bbox=t[4];this.xstep=t[5];this.ystep=t[6];this.paintType=t[7];this.tilingType=t[8];this.color=r;this.ctx=a;this.canvasGraphicsFactory=i;this.baseTransform=o}_createClass(TilingPattern,[{key:"createPatternCanvas",value:function createPatternCanvas(t){var r=this.operatorList,a=this.bbox,o=this.xstep,l=this.ystep,c=this.paintType,u=this.tilingType,d=this.color,h=this.canvasGraphicsFactory;(0,i.info)("TilingType: "+u);var p=a[0],v=a[1],y=a[2],g=a[3],_=i.Util.singularValueDecompose2dScale(this.matrix),m=i.Util.singularValueDecompose2dScale(this.baseTransform),b=[_[0]*m[0],_[1]*m[1]],A=this.getSizeAndScale(o,this.ctx.canvas.width,b[0]),k=this.getSizeAndScale(l,this.ctx.canvas.height,b[1]),P=t.cachedCanvases.getCanvas("pattern",A.size,k.size,!0),S=P.context,w=h.createCanvasGraphics(S);w.groupLevel=t.groupLevel;this.setFillAndStrokeStyleToContext(w,c,d);var x=p,C=v,T=y,E=g;if(p<0){x=0;T+=Math.abs(p)}if(v<0){C=0;E+=Math.abs(v)}S.translate(-A.scale*x,-k.scale*C);w.transform(A.scale,0,0,k.scale,0,0);S.save();this.clipBbox(w,x,C,T,E);w.baseTransform=w.ctx.mozCurrentTransform.slice();w.executeOperatorList(r);w.endDrawing();return{canvas:P.canvas,scaleX:A.scale,scaleY:k.scale,offsetX:x,offsetY:C}}},{key:"getSizeAndScale",value:function getSizeAndScale(t,r,a){t=Math.abs(t);var i=Math.max(TilingPattern.MAX_PATTERN_SIZE,r),o=Math.ceil(t*a);o>=i?o=i:a=o/t;return{scale:a,size:o}}},{key:"clipBbox",value:function clipBbox(t,r,a,i,o){var l=i-r,c=o-a;t.ctx.rect(r,a,l,c);t.current.updateRectMinMax(t.ctx.mozCurrentTransform,[r,a,i,o]);t.clip();t.endPath()}},{key:"setFillAndStrokeStyleToContext",value:function setFillAndStrokeStyleToContext(t,r,a){var o=t.ctx,l=t.current;switch(r){case p:var c=this.ctx;o.fillStyle=c.fillStyle;o.strokeStyle=c.strokeStyle;l.fillColor=c.fillStyle;l.strokeColor=c.strokeStyle;break;case v:var u=i.Util.makeHexColor(a[0],a[1],a[2]);o.fillStyle=u;o.strokeStyle=u;l.fillColor=u;l.strokeColor=u;break;default:throw new i.FormatError("Unsupported paint type: ".concat(r))}}},{key:"getPattern",value:function getPattern(t,r,a,o){var c=a;if(o!==l.SHADING){c=i.Util.transform(c,r.baseTransform);this.matrix&&(c=i.Util.transform(c,this.matrix))}var u=this.createPatternCanvas(r),d=new DOMMatrix(c);d=(d=d.translate(u.offsetX,u.offsetY)).scale(1/u.scaleX,1/u.scaleY);var h=t.createPattern(u.canvas,"repeat");try{h.setTransform(d)}catch(t){(0,i.warn)('TilingPattern.getPattern: "'.concat(null==t?void 0:t.message,'".'))}return h}}],[{key:"MAX_PATTERN_SIZE",get:function get(){return(0,i.shadow)(this,"MAX_PATTERN_SIZE",3e3)}}]);return TilingPattern}();r.TilingPattern=y},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.applyMaskImageData=function applyMaskImageData(t){var r=t.src,a=t.srcPos,o=void 0===a?0:a,l=t.dest,c=t.destPos,u=void 0===c?0:c,d=t.width,h=t.height,p=t.inverseDecode,v=void 0!==p&&p,y=i.FeatureTest.isLittleEndian?4278190080:255,g=function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(v?[0,y]:[y,0],2),_=g[0],m=g[1],b=d>>3,A=7&d,k=r.length;l=new Uint32Array(l.buffer);for(var P=0;P<h;P++){for(var S=o+b;o<S;o++){var w=o<k?r[o]:255;l[u++]=128&w?m:_;l[u++]=64&w?m:_;l[u++]=32&w?m:_;l[u++]=16&w?m:_;l[u++]=8&w?m:_;l[u++]=4&w?m:_;l[u++]=2&w?m:_;l[u++]=1&w?m:_}if(0!==A)for(var x=o<k?r[o++]:255,C=0;C<A;C++)l[u++]=x&1<<7-C?m:_}return{srcPos:o,destPos:u}};var i=a(1);function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.GlobalWorkerOptions=void 0;var a=Object.create(null);r.GlobalWorkerOptions=a;a.workerPort=void 0===a.workerPort?null:a.workerPort;a.workerSrc=void 0===a.workerSrc?"":a.workerSrc},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.MessageHandler=void 0;var i=a(1);function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}var o=1,l=2,c=1,u=2,d=3,h=4,p=5,v=6,y=7,g=8;function wrapReason(t){t instanceof Error||"object"===_typeof(t)&&null!==t||(0,i.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(t.name){case"AbortException":return new i.AbortException(t.message);case"MissingPDFException":return new i.MissingPDFException(t.message);case"PasswordException":return new i.PasswordException(t.message,t.code);case"UnexpectedResponseException":return new i.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new i.UnknownErrorException(t.message,t.details);default:return new i.UnknownErrorException(t.message,t.toString())}}var _=function(){function MessageHandler(t,r,a){var i=this;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,MessageHandler);this.sourceName=t;this.targetName=r;this.comObj=a;this.callbackId=1;this.streamId=1;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);this._onComObjOnMessage=function(t){var r=t.data;if(r.targetName===i.sourceName)if(r.stream)i._processStreamMessage(r);else if(r.callback){var c=r.callbackId,u=i.callbackCapabilities[c];if(!u)throw new Error("Cannot resolve callback ".concat(c));delete i.callbackCapabilities[c];if(r.callback===o)u.resolve(r.data);else{if(r.callback!==l)throw new Error("Unexpected callback case");u.reject(wrapReason(r.reason))}}else{var d=i.actionHandler[r.action];if(!d)throw new Error("Unknown action from worker: ".concat(r.action));if(r.callbackId){var h=i.sourceName,p=r.sourceName;new Promise((function(t){t(d(r.data))})).then((function(t){a.postMessage({sourceName:h,targetName:p,callback:o,callbackId:r.callbackId,data:t})}),(function(t){a.postMessage({sourceName:h,targetName:p,callback:l,callbackId:r.callbackId,reason:wrapReason(t)})}))}else r.streamId?i._createStreamSink(r):d(r.data)}};a.addEventListener("message",this._onComObjOnMessage)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(MessageHandler,[{key:"on",value:function on(t,r){var a=this.actionHandler;if(a[t])throw new Error('There is already an actionName called "'.concat(t,'"'));a[t]=r}},{key:"send",value:function send(t,r,a){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:r},a)}},{key:"sendWithPromise",value:function sendWithPromise(t,r,a){var o=this.callbackId++,l=(0,i.createPromiseCapability)();this.callbackCapabilities[o]=l;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:o,data:r},a)}catch(t){l.reject(t)}return l.promise}},{key:"sendWithStream",value:function sendWithStream(t,r,a,o){var l=this,u=this.streamId++,d=this.sourceName,h=this.targetName,p=this.comObj;return new ReadableStream({start:function start(a){var c=(0,i.createPromiseCapability)();l.streamControllers[u]={controller:a,startCall:c,pullCall:null,cancelCall:null,isClosed:!1};p.postMessage({sourceName:d,targetName:h,action:t,streamId:u,data:r,desiredSize:a.desiredSize},o);return c.promise},pull:function pull(t){var r=(0,i.createPromiseCapability)();l.streamControllers[u].pullCall=r;p.postMessage({sourceName:d,targetName:h,stream:v,streamId:u,desiredSize:t.desiredSize});return r.promise},cancel:function cancel(t){(0,i.assert)(t instanceof Error,"cancel must have a valid reason");var r=(0,i.createPromiseCapability)();l.streamControllers[u].cancelCall=r;l.streamControllers[u].isClosed=!0;p.postMessage({sourceName:d,targetName:h,stream:c,streamId:u,reason:wrapReason(t)});return r.promise}},a)}},{key:"_createStreamSink",value:function _createStreamSink(t){var r=t.streamId,a=this.sourceName,o=t.sourceName,l=this.comObj,c=this,u=this.actionHandler[t.action],v={enqueue:function enqueue(t){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,u=arguments.length>2?arguments[2]:void 0;if(!this.isCancelled){var d=this.desiredSize;this.desiredSize-=c;if(d>0&&this.desiredSize<=0){this.sinkCapability=(0,i.createPromiseCapability)();this.ready=this.sinkCapability.promise}l.postMessage({sourceName:a,targetName:o,stream:h,streamId:r,chunk:t},u)}},close:function close(){if(!this.isCancelled){this.isCancelled=!0;l.postMessage({sourceName:a,targetName:o,stream:d,streamId:r});delete c.streamSinks[r]}},error:function error(t){(0,i.assert)(t instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;l.postMessage({sourceName:a,targetName:o,stream:p,streamId:r,reason:wrapReason(t)})}},sinkCapability:(0,i.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};v.sinkCapability.resolve();v.ready=v.sinkCapability.promise;this.streamSinks[r]=v;new Promise((function(r){r(u(t.data,v))})).then((function(){l.postMessage({sourceName:a,targetName:o,stream:g,streamId:r,success:!0})}),(function(t){l.postMessage({sourceName:a,targetName:o,stream:g,streamId:r,reason:wrapReason(t)})}))}},{key:"_processStreamMessage",value:function _processStreamMessage(t){var r=t.streamId,a=this.sourceName,o=t.sourceName,l=this.comObj,_=this.streamControllers[r],m=this.streamSinks[r];switch(t.stream){case g:t.success?_.startCall.resolve():_.startCall.reject(wrapReason(t.reason));break;case y:t.success?_.pullCall.resolve():_.pullCall.reject(wrapReason(t.reason));break;case v:if(!m){l.postMessage({sourceName:a,targetName:o,stream:y,streamId:r,success:!0});break}m.desiredSize<=0&&t.desiredSize>0&&m.sinkCapability.resolve();m.desiredSize=t.desiredSize;new Promise((function(t){t(m.onPull&&m.onPull())})).then((function(){l.postMessage({sourceName:a,targetName:o,stream:y,streamId:r,success:!0})}),(function(t){l.postMessage({sourceName:a,targetName:o,stream:y,streamId:r,reason:wrapReason(t)})}));break;case h:(0,i.assert)(_,"enqueue should have stream controller");if(_.isClosed)break;_.controller.enqueue(t.chunk);break;case d:(0,i.assert)(_,"close should have stream controller");if(_.isClosed)break;_.isClosed=!0;_.controller.close();this._deleteStreamController(_,r);break;case p:(0,i.assert)(_,"error should have stream controller");_.controller.error(wrapReason(t.reason));this._deleteStreamController(_,r);break;case u:t.success?_.cancelCall.resolve():_.cancelCall.reject(wrapReason(t.reason));this._deleteStreamController(_,r);break;case c:if(!m)break;new Promise((function(r){r(m.onCancel&&m.onCancel(wrapReason(t.reason)))})).then((function(){l.postMessage({sourceName:a,targetName:o,stream:u,streamId:r,success:!0})}),(function(t){l.postMessage({sourceName:a,targetName:o,stream:u,streamId:r,reason:wrapReason(t)})}));m.sinkCapability.reject(wrapReason(t.reason));m.isCancelled=!0;delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}}},{key:"_deleteStreamController",value:(t=function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}(_regeneratorRuntime().mark((function _callee(t,r){return _regeneratorRuntime().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return Promise.allSettled([t.startCall&&t.startCall.promise,t.pullCall&&t.pullCall.promise,t.cancelCall&&t.cancelCall.promise]);case 2:delete this.streamControllers[r];case 3:case"end":return a.stop()}}),_callee,this)}))),function _deleteStreamController(r,a){return t.apply(this,arguments)})},{key:"destroy",value:function destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}]);var t;return MessageHandler}();r.MessageHandler=_},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.Metadata=void 0;var i=a(1);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _classPrivateFieldInitSpec(t,r,a){!function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,r);r.set(t,a)}function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){if(r.get)return r.get.call(t);return r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}var o=new WeakMap,l=new WeakMap,c=function(){function Metadata(t){var r=t.parsedData,a=t.rawData;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,Metadata);_classPrivateFieldInitSpec(this,o,{writable:!0,value:void 0});_classPrivateFieldInitSpec(this,l,{writable:!0,value:void 0});_classPrivateFieldSet(this,o,r);_classPrivateFieldSet(this,l,a)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(Metadata,[{key:"getRaw",value:function getRaw(){return _classPrivateFieldGet(this,l)}},{key:"get",value:function get(t){var r;return null!==(r=_classPrivateFieldGet(this,o).get(t))&&void 0!==r?r:null}},{key:"getAll",value:function getAll(){return(0,i.objectFromMap)(_classPrivateFieldGet(this,o))}},{key:"has",value:function has(t){return _classPrivateFieldGet(this,o).has(t)}}]);return Metadata}();r.Metadata=c},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.OptionalContentConfig=void 0;var i=a(1);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _classPrivateFieldInitSpec(t,r,a){_checkPrivateRedeclaration(t,r);r.set(t,a)}function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){if(r.get)return r.get.call(t);return r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}var o=Symbol("INTERNAL"),l=new WeakMap,c=function(){function OptionalContentGroup(t,r){_classCallCheck(this,OptionalContentGroup);_classPrivateFieldInitSpec(this,l,{writable:!0,value:!0});this.name=t;this.intent=r}_createClass(OptionalContentGroup,[{key:"visible",get:function get(){return _classPrivateFieldGet(this,l)}},{key:"_setVisible",value:function _setVisible(t,r){t!==o&&(0,i.unreachable)("Internal method `_setVisible` called.");_classPrivateFieldSet(this,l,r)}}]);return OptionalContentGroup}(),u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap,v=new WeakSet,y=function(){function OptionalContentConfig(t){_classCallCheck(this,OptionalContentConfig);!function _classPrivateMethodInitSpec(t,r){_checkPrivateRedeclaration(t,r);r.add(t)}(this,v);_classPrivateFieldInitSpec(this,u,{writable:!0,value:!0});_classPrivateFieldInitSpec(this,d,{writable:!0,value:new Map});_classPrivateFieldInitSpec(this,h,{writable:!0,value:null});_classPrivateFieldInitSpec(this,p,{writable:!0,value:null});this.name=null;this.creator=null;if(null!==t){this.name=t.name;this.creator=t.creator;_classPrivateFieldSet(this,p,t.order);var r,a=_createForOfIteratorHelper(t.groups);try{for(a.s();!(r=a.n()).done;){var i=r.value;_classPrivateFieldGet(this,d).set(i.id,new c(i.name,i.intent))}}catch(t){a.e(t)}finally{a.f()}if("OFF"===t.baseState){var l,y=_createForOfIteratorHelper(_classPrivateFieldGet(this,d).values());try{for(y.s();!(l=y.n()).done;){l.value._setVisible(o,!1)}}catch(t){y.e(t)}finally{y.f()}}var g,_=_createForOfIteratorHelper(t.on);try{for(_.s();!(g=_.n()).done;){var m=g.value;_classPrivateFieldGet(this,d).get(m)._setVisible(o,!0)}}catch(t){_.e(t)}finally{_.f()}var b,A=_createForOfIteratorHelper(t.off);try{for(A.s();!(b=A.n()).done;){var k=b.value;_classPrivateFieldGet(this,d).get(k)._setVisible(o,!1)}}catch(t){A.e(t)}finally{A.f()}_classPrivateFieldSet(this,h,new Map);var P,S=_createForOfIteratorHelper(_classPrivateFieldGet(this,d));try{for(S.s();!(P=S.n()).done;){var w=_slicedToArray(P.value,2),x=w[0],C=w[1];_classPrivateFieldGet(this,h).set(x,C.visible)}}catch(t){S.e(t)}finally{S.f()}}}_createClass(OptionalContentConfig,[{key:"isVisible",value:function isVisible(t){if(0===_classPrivateFieldGet(this,d).size)return!0;if(!t){(0,i.warn)("Optional content group not defined.");return!0}if("OCG"===t.type){if(!_classPrivateFieldGet(this,d).has(t.id)){(0,i.warn)("Optional content group not found: ".concat(t.id));return!0}return _classPrivateFieldGet(this,d).get(t.id).visible}if("OCMD"===t.type){if(t.expression)return _classPrivateMethodGet(this,v,_evaluateVisibilityExpression2).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){var r,a=_createForOfIteratorHelper(t.ids);try{for(a.s();!(r=a.n()).done;){var o=r.value;if(!_classPrivateFieldGet(this,d).has(o)){(0,i.warn)("Optional content group not found: ".concat(o));return!0}if(_classPrivateFieldGet(this,d).get(o).visible)return!0}}catch(t){a.e(t)}finally{a.f()}return!1}if("AllOn"===t.policy){var l,c=_createForOfIteratorHelper(t.ids);try{for(c.s();!(l=c.n()).done;){var u=l.value;if(!_classPrivateFieldGet(this,d).has(u)){(0,i.warn)("Optional content group not found: ".concat(u));return!0}if(!_classPrivateFieldGet(this,d).get(u).visible)return!1}}catch(t){c.e(t)}finally{c.f()}return!0}if("AnyOff"===t.policy){var h,p=_createForOfIteratorHelper(t.ids);try{for(p.s();!(h=p.n()).done;){var y=h.value;if(!_classPrivateFieldGet(this,d).has(y)){(0,i.warn)("Optional content group not found: ".concat(y));return!0}if(!_classPrivateFieldGet(this,d).get(y).visible)return!0}}catch(t){p.e(t)}finally{p.f()}return!1}if("AllOff"===t.policy){var g,_=_createForOfIteratorHelper(t.ids);try{for(_.s();!(g=_.n()).done;){var m=g.value;if(!_classPrivateFieldGet(this,d).has(m)){(0,i.warn)("Optional content group not found: ".concat(m));return!0}if(_classPrivateFieldGet(this,d).get(m).visible)return!1}}catch(t){_.e(t)}finally{_.f()}return!0}(0,i.warn)("Unknown optional content policy ".concat(t.policy,"."));return!0}(0,i.warn)("Unknown group type ".concat(t.type,"."));return!0}},{key:"setVisibility",value:function setVisibility(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(_classPrivateFieldGet(this,d).has(t)){_classPrivateFieldGet(this,d).get(t)._setVisible(o,!!r);_classPrivateFieldSet(this,u,null)}else(0,i.warn)("Optional content group not found: ".concat(t))}},{key:"hasInitialVisibility",get:function get(){if(null!==_classPrivateFieldGet(this,u))return _classPrivateFieldGet(this,u);var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,d));try{for(r.s();!(t=r.n()).done;){var a=_slicedToArray(t.value,2),i=a[0],o=a[1],l=_classPrivateFieldGet(this,h).get(i);if(o.visible!==l)return _classPrivateFieldSet(this,u,!1)}}catch(t){r.e(t)}finally{r.f()}return _classPrivateFieldSet(this,u,!0)}},{key:"getOrder",value:function getOrder(){return _classPrivateFieldGet(this,d).size?_classPrivateFieldGet(this,p)?_classPrivateFieldGet(this,p).slice():_toConsumableArray(_classPrivateFieldGet(this,d).keys()):null}},{key:"getGroups",value:function getGroups(){return _classPrivateFieldGet(this,d).size>0?(0,i.objectFromMap)(_classPrivateFieldGet(this,d)):null}},{key:"getGroup",value:function getGroup(t){return _classPrivateFieldGet(this,d).get(t)||null}}]);return OptionalContentConfig}();r.OptionalContentConfig=y;function _evaluateVisibilityExpression2(t){var r=t.length;if(r<2)return!0;for(var a=t[0],o=1;o<r;o++){var l=t[o],c=void 0;if(Array.isArray(l))c=_classPrivateMethodGet(this,v,_evaluateVisibilityExpression2).call(this,l);else{if(!_classPrivateFieldGet(this,d).has(l)){(0,i.warn)("Optional content group not found: ".concat(l));return!0}c=_classPrivateFieldGet(this,d).get(l).visible}switch(a){case"And":if(!c)return!1;break;case"Or":if(c)return!0;break;case"Not":return!c;default:return!0}}return"And"===a}},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFDataTransportStream=void 0;var i=a(1),o=a(129);function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}var l=function(){function PDFDataTransportStream(t,r){var a=this;_classCallCheck(this,PDFDataTransportStream);(0,i.assert)(r,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');this._queuedChunks=[];this._progressiveDone=t.progressiveDone||!1;this._contentDispositionFilename=t.contentDispositionFilename||null;var o=t.initialData;if((null==o?void 0:o.length)>0){var l=new Uint8Array(o).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=r;this._isStreamingSupported=!t.disableStream;this._isRangeSupported=!t.disableRange;this._contentLength=t.length;this._fullRequestReader=null;this._rangeReaders=[];this._pdfDataRangeTransport.addRangeListener((function(t,r){a._onReceiveData({begin:t,chunk:r})}));this._pdfDataRangeTransport.addProgressListener((function(t,r){a._onProgress({loaded:t,total:r})}));this._pdfDataRangeTransport.addProgressiveReadListener((function(t){a._onReceiveData({chunk:t})}));this._pdfDataRangeTransport.addProgressiveDoneListener((function(){a._onProgressiveDone()}));this._pdfDataRangeTransport.transportReady()}_createClass(PDFDataTransportStream,[{key:"_onReceiveData",value:function _onReceiveData(t){var r=new Uint8Array(t.chunk).buffer;if(void 0===t.begin)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{var a=this._rangeReaders.some((function(a){if(a._begin!==t.begin)return!1;a._enqueue(r);return!0}));(0,i.assert)(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}},{key:"_progressiveDataLength",get:function get(){var t,r;return null!==(t=null===(r=this._fullRequestReader)||void 0===r?void 0:r._loaded)&&void 0!==t?t:0}},{key:"_onProgress",value:function _onProgress(t){if(void 0===t.total){var r=this._rangeReaders[0];null!=r&&r.onProgress&&r.onProgress({loaded:t.loaded})}else{var a=this._fullRequestReader;null!=a&&a.onProgress&&a.onProgress({loaded:t.loaded,total:t.total})}}},{key:"_onProgressiveDone",value:function _onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone();this._progressiveDone=!0}},{key:"_removeRangeReader",value:function _removeRangeReader(t){var r=this._rangeReaders.indexOf(t);r>=0&&this._rangeReaders.splice(r,1)}},{key:"getFullReader",value:function getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");var t=this._queuedChunks;this._queuedChunks=null;return new c(this,t,this._progressiveDone,this._contentDispositionFilename)}},{key:"getRangeReader",value:function getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;var a=new u(this,t,r);this._pdfDataRangeTransport.requestDataRange(t,r);this._rangeReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);var r,a=_createForOfIteratorHelper(this._rangeReaders.slice(0));try{for(a.s();!(r=a.n()).done;){r.value.cancel(t)}}catch(t){a.e(t)}finally{a.f()}this._pdfDataRangeTransport.abort()}}]);return PDFDataTransportStream}();r.PDFDataTransportStream=l;var c=function(){function PDFDataTransportStreamReader(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,PDFDataTransportStreamReader);this._stream=t;this._done=a||!1;this._filename=(0,o.isPdfFile)(i)?i:null;this._queuedChunks=r||[];this._loaded=0;var l,c=_createForOfIteratorHelper(this._queuedChunks);try{for(c.s();!(l=c.n()).done;){var u=l.value;this._loaded+=u.byteLength}}catch(t){c.e(t)}finally{c.f()}this._requests=[];this._headersReady=Promise.resolve();t._fullRequestReader=this;this.onProgress=null}_createClass(PDFDataTransportStreamReader,[{key:"_enqueue",value:function _enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}},{key:"headersReady",get:function get(){return this._headersReady}},{key:"filename",get:function get(){return this._filename}},{key:"isRangeSupported",get:function get(){return this._stream._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._stream._isStreamingSupported}},{key:"contentLength",get:function get(){return this._stream._contentLength}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var t,r;return _regeneratorRuntime().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(!(this._queuedChunks.length>0)){a.next=3;break}t=this._queuedChunks.shift();return a.abrupt("return",{value:t,done:!1});case 3:if(!this._done){a.next=5;break}return a.abrupt("return",{value:void 0,done:!0});case 5:r=(0,i.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 8:case"end":return a.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0}},{key:"progressiveDone",value:function progressiveDone(){this._done||(this._done=!0)}}]);var t;return PDFDataTransportStreamReader}(),u=function(){function PDFDataTransportStreamRangeReader(t,r,a){_classCallCheck(this,PDFDataTransportStreamRangeReader);this._stream=t;this._begin=r;this._end=a;this._queuedChunk=null;this._requests=[];this._done=!1;this.onProgress=null}_createClass(PDFDataTransportStreamRangeReader,[{key:"_enqueue",value:function _enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0}this._done=!0;this._stream._removeRangeReader(this)}}},{key:"isStreamingSupported",get:function get(){return!1}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(){var t,r;return _regeneratorRuntime().wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:if(!this._queuedChunk){a.next=4;break}t=this._queuedChunk;this._queuedChunk=null;return a.abrupt("return",{value:t,done:!1});case 4:if(!this._done){a.next=6;break}return a.abrupt("return",{value:void 0,done:!0});case 6:r=(0,i.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 9:case"end":return a.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._stream._removeRangeReader(this)}}]);var t;return PDFDataTransportStreamRangeReader}()},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.XfaText=void 0;function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var a=function(){function XfaText(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,XfaText)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(XfaText,null,[{key:"textContent",value:function textContent(t){var r=[],a={items:r,styles:Object.create(null)};!function walk(t){var a;if(t){var i=null,o=t.name;if("#text"===o)i=t.value;else{if(!XfaText.shouldBuildText(o))return;null!=t&&null!==(a=t.attributes)&&void 0!==a&&a.textContent?i=t.attributes.textContent:t.value&&(i=t.value)}null!==i&&r.push({str:i});if(t.children){var l,c=_createForOfIteratorHelper(t.children);try{for(c.s();!(l=c.n()).done;){walk(l.value)}}catch(t){c.e(t)}finally{c.f()}}}}(t);return a}},{key:"shouldBuildText",value:function shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}]);return XfaText}();r.XfaText=a},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.NodeStandardFontDataFactory=r.NodeCanvasFactory=r.NodeCMapReaderFactory=void 0;var i=a(130);function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}var o=function fetchData(t){return new Promise((function(r,a){require("fs").readFile(t,(function(t,i){!t&&i?r(new Uint8Array(i)):a(new Error(t))}))}))},l=function(t){_inherits(NodeCanvasFactory,t);var r=_createSuper(NodeCanvasFactory);function NodeCanvasFactory(){_classCallCheck(this,NodeCanvasFactory);return r.apply(this,arguments)}_createClass(NodeCanvasFactory,[{key:"_createCanvas",value:function _createCanvas(t,r){return require("canvas").createCanvas(t,r)}}]);return NodeCanvasFactory}(i.BaseCanvasFactory);r.NodeCanvasFactory=l;var c=function(t){_inherits(NodeCMapReaderFactory,t);var r=_createSuper(NodeCMapReaderFactory);function NodeCMapReaderFactory(){_classCallCheck(this,NodeCMapReaderFactory);return r.apply(this,arguments)}_createClass(NodeCMapReaderFactory,[{key:"_fetchData",value:function _fetchData(t,r){return o(t).then((function(t){return{cMapData:t,compressionType:r}}))}}]);return NodeCMapReaderFactory}(i.BaseCMapReaderFactory);r.NodeCMapReaderFactory=c;var u=function(t){_inherits(NodeStandardFontDataFactory,t);var r=_createSuper(NodeStandardFontDataFactory);function NodeStandardFontDataFactory(){_classCallCheck(this,NodeStandardFontDataFactory);return r.apply(this,arguments)}_createClass(NodeStandardFontDataFactory,[{key:"_fetchData",value:function _fetchData(t){return o(t)}}]);return NodeStandardFontDataFactory}(i.BaseStandardFontDataFactory);r.NodeStandardFontDataFactory=u},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.AnnotationEditorLayer=void 0;var i=a(1),o=a(134),l=a(129),c=a(148),u=a(149);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _classPrivateMethodInitSpec(t,r){_checkPrivateRedeclaration(t,r);r.add(t)}function _classPrivateFieldInitSpec(t,r,a){_checkPrivateRedeclaration(t,r);r.set(t,a)}function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}function _classStaticPrivateMethodGet(t,r,a){!function _classCheckPrivateStaticAccess(t,r){if(t!==r)throw new TypeError("Private static access of wrong provenance")}(t,r);return a}function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){if(r.get)return r.get.call(t);return r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}var d=new WeakMap,h=new WeakMap,p=new WeakMap,v=new WeakMap,y=new WeakMap,g=new WeakMap,_=new WeakMap,m=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakSet,P=new WeakSet,S=new WeakSet,w=new WeakSet,x=function(){function AnnotationEditorLayer(t){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,AnnotationEditorLayer);_classPrivateMethodInitSpec(this,w);_classPrivateMethodInitSpec(this,S);_classPrivateMethodInitSpec(this,P);_classPrivateMethodInitSpec(this,k);_classPrivateFieldInitSpec(this,A,{get:_get_hasTextLayer,set:void 0});_classPrivateFieldInitSpec(this,d,{writable:!0,value:!1});_classPrivateFieldInitSpec(this,h,{writable:!0,value:this.pointerup.bind(this)});_classPrivateFieldInitSpec(this,p,{writable:!0,value:this.pointerdown.bind(this)});_classPrivateFieldInitSpec(this,v,{writable:!0,value:new Map});_classPrivateFieldInitSpec(this,y,{writable:!0,value:!1});_classPrivateFieldInitSpec(this,g,{writable:!0,value:new WeakMap});_classPrivateFieldInitSpec(this,_,{writable:!0,value:new Map});_classPrivateFieldInitSpec(this,m,{writable:!0,value:void 0});_classPrivateFieldInitSpec(this,b,{writable:!0,value:new Set});if(!AnnotationEditorLayer._initialized){AnnotationEditorLayer._initialized=!0;c.FreeTextEditor.initialize(t.l10n);u.InkEditor.initialize(t.l10n);t.uiManager.registerEditorTypes([c.FreeTextEditor,u.InkEditor])}_classPrivateFieldSet(this,m,t.uiManager);this.annotationStorage=t.annotationStorage;this.pageIndex=t.pageIndex;this.div=t.div;_classPrivateFieldGet(this,m).addLayer(this)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(AnnotationEditorLayer,[{key:"textLayerElements",get:function get(){var t=this.div.parentNode.getElementsByClassName("textLayer").item(0);if(!t)return(0,i.shadow)(this,"textLayerElements",null);var r=_classPrivateFieldGet(this,g).get(t);if(r)return r;if(0===(r=t.querySelectorAll('span[role="presentation"]')).length)return(0,i.shadow)(this,"textLayerElements",null);(r=Array.from(r)).sort(_classStaticPrivateMethodGet(AnnotationEditorLayer,AnnotationEditorLayer,_compareElementPositions));_classPrivateFieldGet(this,g).set(t,r);return r}},{key:"updateToolbar",value:function updateToolbar(t){_classPrivateFieldGet(this,m).updateToolbar(t)}},{key:"updateMode",value:function updateMode(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_classPrivateFieldGet(this,m).getMode();_classPrivateMethodGet(this,w,_cleanup2).call(this);if(t===i.AnnotationEditorType.INK){this.addInkEditorIfNeeded(!1);this.disableClick()}else this.enableClick();_classPrivateFieldGet(this,m).unselectAll()}},{key:"addInkEditorIfNeeded",value:function addInkEditorIfNeeded(t){if(t||_classPrivateFieldGet(this,m).getMode()===i.AnnotationEditorType.INK){if(!t){var r,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,v).values());try{for(a.s();!(r=a.n()).done;){var o=r.value;if(o.isEmpty()){o.setInBackground();return}}}catch(t){a.e(t)}finally{a.f()}}_classPrivateMethodGet(this,S,_createAndAddNewEditor2).call(this,{offsetX:0,offsetY:0}).setInBackground()}}},{key:"setEditingState",value:function setEditingState(t){_classPrivateFieldGet(this,m).setEditingState(t)}},{key:"addCommands",value:function addCommands(t){_classPrivateFieldGet(this,m).addCommands(t)}},{key:"enable",value:function enable(){this.div.style.pointerEvents="auto";var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,v).values());try{for(r.s();!(t=r.n()).done;){t.value.enableEditing()}}catch(t){r.e(t)}finally{r.f()}}},{key:"disable",value:function disable(){this.div.style.pointerEvents="none";var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,v).values());try{for(r.s();!(t=r.n()).done;){t.value.disableEditing()}}catch(t){r.e(t)}finally{r.f()}}},{key:"setActiveEditor",value:function setActiveEditor(t){_classPrivateFieldGet(this,m).getActive()!==t&&_classPrivateFieldGet(this,m).setActiveEditor(t)}},{key:"enableClick",value:function enableClick(){this.div.addEventListener("pointerdown",_classPrivateFieldGet(this,p));this.div.addEventListener("pointerup",_classPrivateFieldGet(this,h))}},{key:"disableClick",value:function disableClick(){this.div.removeEventListener("pointerdown",_classPrivateFieldGet(this,p));this.div.removeEventListener("pointerup",_classPrivateFieldGet(this,h))}},{key:"attach",value:function attach(t){_classPrivateFieldGet(this,v).set(t.id,t)}},{key:"detach",value:function detach(t){_classPrivateFieldGet(this,v).delete(t.id);this.removePointerInTextLayer(t)}},{key:"remove",value:function remove(t){var r=this;_classPrivateFieldGet(this,m).removeEditor(t);this.detach(t);this.annotationStorage.removeKey(t.id);t.div.style.display="none";setTimeout((function(){t.div.style.display="";t.div.remove();t.isAttachedToDOM=!1;document.activeElement===document.body&&_classPrivateFieldGet(r,m).focusMainContainer()}),0);_classPrivateFieldGet(this,y)||this.addInkEditorIfNeeded(!1)}},{key:"onTextLayerRendered",value:function onTextLayerRendered(){_classPrivateFieldGet(this,_).clear();var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,b));try{for(r.s();!(t=r.n()).done;){var a=t.value;a.isAttachedToDOM&&this.addPointerInTextLayer(a)}}catch(t){r.e(t)}finally{r.f()}_classPrivateFieldGet(this,b).clear()}},{key:"removePointerInTextLayer",value:function removePointerInTextLayer(t){var r;if(_classPrivateFieldGet(this,A)){var a=t.id,i=_classPrivateFieldGet(this,_).get(a);if(i){_classPrivateFieldGet(this,_).delete(a);var o=i.getAttribute("aria-owns");if(null!==(r=o)&&void 0!==r&&r.includes(a))if(o=o.split(" ").filter((function(t){return t!==a})).join(" "))i.setAttribute("aria-owns",o);else{i.removeAttribute("aria-owns");i.setAttribute("role","presentation")}}}else _classPrivateFieldGet(this,b).delete(t)}},{key:"addPointerInTextLayer",value:function addPointerInTextLayer(t){if(_classPrivateFieldGet(this,A)){this.removePointerInTextLayer(t);var r=this.textLayerElements;if(r){var a=t.contentDiv,i=t.getIdForTextLayer(),o=(0,l.binarySearchFirstItem)(r,(function(t){return _classStaticPrivateMethodGet(AnnotationEditorLayer,AnnotationEditorLayer,_compareElementPositions).call(AnnotationEditorLayer,a,t)<0})),c=r[Math.max(0,o-1)],u=c.getAttribute("aria-owns");null!=u&&u.includes(i)||c.setAttribute("aria-owns",u?"".concat(u," ").concat(i):i);c.removeAttribute("role");_classPrivateFieldGet(this,_).set(i,c)}}else _classPrivateFieldGet(this,b).add(t)}},{key:"moveDivInDOM",value:function moveDivInDOM(t){this.addPointerInTextLayer(t);var r=t.div,a=t.contentDiv;if(this.div.hasChildNodes()){var i=Array.from(this.div.childNodes).filter((function(t){return t!==r}));if(0!==i.length){var o=(0,l.binarySearchFirstItem)(i,(function(t){return _classStaticPrivateMethodGet(AnnotationEditorLayer,AnnotationEditorLayer,_compareElementPositions).call(AnnotationEditorLayer,a,t)<0}));0===o?i[0].before(r):i[o-1].after(r)}}else this.div.append(r)}},{key:"add",value:function add(t){_classPrivateMethodGet(this,k,_changeParent2).call(this,t);this.addToAnnotationStorage(t);_classPrivateFieldGet(this,m).addEditor(t);this.attach(t);if(!t.isAttachedToDOM){var r=t.render();this.div.append(r);t.isAttachedToDOM=!0}this.moveDivInDOM(t);t.onceAdded()}},{key:"addToAnnotationStorage",value:function addToAnnotationStorage(t){t.isEmpty()||this.annotationStorage.has(t.id)||this.annotationStorage.setValue(t.id,t)}},{key:"addOrRebuild",value:function addOrRebuild(t){t.needsToBeRebuilt()?t.rebuild():this.add(t)}},{key:"addANewEditor",value:function addANewEditor(t){var r=this;this.addCommands({cmd:function cmd(){r.addOrRebuild(t)},undo:function undo(){t.remove()},mustExec:!0})}},{key:"addUndoableEditor",value:function addUndoableEditor(t){var r=this;this.addCommands({cmd:function cmd(){r.addOrRebuild(t)},undo:function undo(){t.remove()},mustExec:!1})}},{key:"getNextId",value:function getNextId(){return _classPrivateFieldGet(this,m).getId()}},{key:"deserialize",value:function deserialize(t){switch(t.annotationType){case i.AnnotationEditorType.FREETEXT:return c.FreeTextEditor.deserialize(t,this);case i.AnnotationEditorType.INK:return u.InkEditor.deserialize(t,this)}return null}},{key:"setSelected",value:function setSelected(t){_classPrivateFieldGet(this,m).setSelected(t)}},{key:"toggleSelected",value:function toggleSelected(t){_classPrivateFieldGet(this,m).toggleSelected(t)}},{key:"isSelected",value:function isSelected(t){return _classPrivateFieldGet(this,m).isSelected(t)}},{key:"unselect",value:function unselect(t){_classPrivateFieldGet(this,m).unselect(t)}},{key:"pointerup",value:function pointerup(t){var r=o.KeyboardManager.platform.isMac;0!==t.button||t.ctrlKey&&r||t.target===this.div&&(_classPrivateFieldGet(this,d)?_classPrivateMethodGet(this,S,_createAndAddNewEditor2).call(this,t):_classPrivateFieldSet(this,d,!0))}},{key:"pointerdown",value:function pointerdown(t){var r=o.KeyboardManager.platform.isMac;if(!(0!==t.button||t.ctrlKey&&r)&&t.target===this.div){var a=_classPrivateFieldGet(this,m).getActive();_classPrivateFieldSet(this,d,!a||a.isEmpty())}}},{key:"drop",value:function drop(t){var r=t.dataTransfer.getData("text/plain"),a=_classPrivateFieldGet(this,m).getEditor(r);if(a){t.preventDefault();t.dataTransfer.dropEffect="move";_classPrivateMethodGet(this,k,_changeParent2).call(this,a);var i=this.div.getBoundingClientRect(),o=t.clientX-i.x,l=t.clientY-i.y;a.translate(o-a.startX,l-a.startY);this.moveDivInDOM(a);a.div.focus()}}},{key:"dragover",value:function dragover(t){t.preventDefault()}},{key:"destroy",value:function destroy(){var t;(null===(t=_classPrivateFieldGet(this,m).getActive())||void 0===t?void 0:t.parent)===this&&_classPrivateFieldGet(this,m).setActiveEditor(null);var r,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,v).values());try{for(a.s();!(r=a.n()).done;){var i=r.value;this.removePointerInTextLayer(i);i.isAttachedToDOM=!1;i.div.remove();i.parent=null}}catch(t){a.e(t)}finally{a.f()}_classPrivateFieldGet(this,_).clear();this.div=null;_classPrivateFieldGet(this,v).clear();_classPrivateFieldGet(this,b).clear();_classPrivateFieldGet(this,m).removeLayer(this)}},{key:"render",value:function render(t){this.viewport=t.viewport;(0,o.bindEvents)(this,this.div,["dragover","drop"]);this.setDimensions();var r,a=_createForOfIteratorHelper(_classPrivateFieldGet(this,m).getEditors(this.pageIndex));try{for(a.s();!(r=a.n()).done;){var i=r.value;this.add(i)}}catch(t){a.e(t)}finally{a.f()}this.updateMode()}},{key:"update",value:function update(t){this.viewport=t.viewport;this.setDimensions();this.updateMode()}},{key:"scaleFactor",get:function get(){return this.viewport.scale}},{key:"pageDimensions",get:function get(){var t=_slicedToArray(this.viewport.viewBox,4),r=t[0],a=t[1];return[t[2]-r,t[3]-a]}},{key:"viewportBaseDimensions",get:function get(){var t=this.viewport,r=t.width,a=t.height;return t.rotation%180==0?[r,a]:[a,r]}},{key:"setDimensions",value:function setDimensions(){var t=this.viewport,r=t.width,a=t.height,i=t.rotation,o=i%180!=0,l=Math.floor(r)+"px",c=Math.floor(a)+"px";this.div.style.width=o?c:l;this.div.style.height=o?l:c;this.div.setAttribute("data-main-rotation",i)}}]);return AnnotationEditorLayer}();r.AnnotationEditorLayer=x;function _get_hasTextLayer(){return!!this.div.parentNode.querySelector(".textLayer .endOfContent")}function _changeParent2(t){var r;if(t.parent!==this){this.attach(t);t.pageIndex=this.pageIndex;null===(r=t.parent)||void 0===r||r.detach(t);t.parent=this;if(t.div&&t.isAttachedToDOM){t.div.remove();this.div.append(t.div)}}}function _compareElementPositions(t,r){var a=t.getBoundingClientRect(),i=r.getBoundingClientRect();return a.y+a.height<=i.y?-1:i.y+i.height<=a.y?1:a.x+a.width/2-(i.x+i.width/2)}function _createNewEditor2(t){switch(_classPrivateFieldGet(this,m).getMode()){case i.AnnotationEditorType.FREETEXT:return new c.FreeTextEditor(t);case i.AnnotationEditorType.INK:return new u.InkEditor(t)}return null}function _createAndAddNewEditor2(t){var r=this.getNextId(),a=_classPrivateMethodGet(this,P,_createNewEditor2).call(this,{parent:this,id:r,x:t.offsetX,y:t.offsetY});a&&this.add(a);return a}function _cleanup2(){_classPrivateFieldSet(this,y,!0);var t,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,v).values());try{for(r.s();!(t=r.n()).done;){var a=t.value;a.isEmpty()&&a.remove()}}catch(t){r.e(t)}finally{r.f()}_classPrivateFieldSet(this,y,!1)}!function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}(x,"_initialized",!1)},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.FreeTextEditor=void 0;var i=a(1),o=a(134),l=a(133);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),a.push.apply(a,i)}return a}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){_defineProperty(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _get(){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function _get(t,r,a){var i=_superPropBase(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:a):o.value}};return _get.apply(this,arguments)}function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _classPrivateMethodInitSpec(t,r){_checkPrivateRedeclaration(t,r);r.add(t)}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _classPrivateFieldInitSpec(t,r,a){_checkPrivateRedeclaration(t,r);r.set(t,a)}function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){if(r.get)return r.get.call(t);return r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}var c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap,v=new WeakMap,y=new WeakMap,g=new WeakMap,_=new WeakSet,m=new WeakSet,b=new WeakSet,A=new WeakSet,k=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}(FreeTextEditor,t);var r=_createSuper(FreeTextEditor);function FreeTextEditor(t){var a;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,FreeTextEditor);_classPrivateMethodInitSpec(_assertThisInitialized(a=r.call(this,_objectSpread(_objectSpread({},t),{},{name:"freeTextEditor"}))),A);_classPrivateMethodInitSpec(_assertThisInitialized(a),b);_classPrivateMethodInitSpec(_assertThisInitialized(a),m);_classPrivateMethodInitSpec(_assertThisInitialized(a),_);_classPrivateFieldInitSpec(_assertThisInitialized(a),c,{writable:!0,value:a.editorDivBlur.bind(_assertThisInitialized(a))});_classPrivateFieldInitSpec(_assertThisInitialized(a),u,{writable:!0,value:a.editorDivFocus.bind(_assertThisInitialized(a))});_classPrivateFieldInitSpec(_assertThisInitialized(a),d,{writable:!0,value:a.editorDivKeydown.bind(_assertThisInitialized(a))});_classPrivateFieldInitSpec(_assertThisInitialized(a),h,{writable:!0,value:void 0});_classPrivateFieldInitSpec(_assertThisInitialized(a),p,{writable:!0,value:""});_classPrivateFieldInitSpec(_assertThisInitialized(a),v,{writable:!0,value:""});_classPrivateFieldInitSpec(_assertThisInitialized(a),y,{writable:!0,value:!1});_classPrivateFieldInitSpec(_assertThisInitialized(a),g,{writable:!0,value:void 0});_classPrivateFieldSet(_assertThisInitialized(a),h,t.color||FreeTextEditor._defaultColor||l.AnnotationEditor._defaultLineColor);_classPrivateFieldSet(_assertThisInitialized(a),g,t.fontSize||FreeTextEditor._defaultFontSize);return a}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(FreeTextEditor,[{key:"updateParams",value:function updateParams(t,r){switch(t){case i.AnnotationEditorParamsType.FREETEXT_SIZE:_classPrivateMethodGet(this,_,_updateFontSize2).call(this,r);break;case i.AnnotationEditorParamsType.FREETEXT_COLOR:_classPrivateMethodGet(this,m,_updateColor2).call(this,r)}}},{key:"propertiesToUpdate",get:function get(){return[[i.AnnotationEditorParamsType.FREETEXT_SIZE,_classPrivateFieldGet(this,g)],[i.AnnotationEditorParamsType.FREETEXT_COLOR,_classPrivateFieldGet(this,h)]]}},{key:"getInitialTranslation",value:function getInitialTranslation(){return[-FreeTextEditor._internalPadding*this.parent.scaleFactor,-(FreeTextEditor._internalPadding+_classPrivateFieldGet(this,g))*this.parent.scaleFactor]}},{key:"rebuild",value:function rebuild(){_get(_getPrototypeOf(FreeTextEditor.prototype),"rebuild",this).call(this);null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}},{key:"enableEditMode",value:function enableEditMode(){if(!this.isInEditMode()){this.parent.setEditingState(!1);this.parent.updateToolbar(i.AnnotationEditorType.FREETEXT);_get(_getPrototypeOf(FreeTextEditor.prototype),"enableEditMode",this).call(this);this.overlayDiv.classList.remove("enabled");this.editorDiv.contentEditable=!0;this.div.draggable=!1;this.editorDiv.addEventListener("keydown",_classPrivateFieldGet(this,d));this.editorDiv.addEventListener("focus",_classPrivateFieldGet(this,u));this.editorDiv.addEventListener("blur",_classPrivateFieldGet(this,c))}}},{key:"disableEditMode",value:function disableEditMode(){if(this.isInEditMode()){this.parent.setEditingState(!0);_get(_getPrototypeOf(FreeTextEditor.prototype),"disableEditMode",this).call(this);this.overlayDiv.classList.add("enabled");this.editorDiv.contentEditable=!1;this.div.draggable=!0;this.editorDiv.removeEventListener("keydown",_classPrivateFieldGet(this,d));this.editorDiv.removeEventListener("focus",_classPrivateFieldGet(this,u));this.editorDiv.removeEventListener("blur",_classPrivateFieldGet(this,c));this.div.focus();this.isEditing=!1}}},{key:"focusin",value:function focusin(t){_get(_getPrototypeOf(FreeTextEditor.prototype),"focusin",this).call(this,t);t.target!==this.editorDiv&&this.editorDiv.focus()}},{key:"onceAdded",value:function onceAdded(){if(!this.width){this.enableEditMode();this.editorDiv.focus()}}},{key:"isEmpty",value:function isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}},{key:"remove",value:function remove(){this.isEditing=!1;this.parent.setEditingState(!0);_get(_getPrototypeOf(FreeTextEditor.prototype),"remove",this).call(this)}},{key:"commit",value:function commit(){_get(_getPrototypeOf(FreeTextEditor.prototype),"commit",this).call(this);if(!_classPrivateFieldGet(this,y)){_classPrivateFieldSet(this,y,!0);this.parent.addUndoableEditor(this)}this.disableEditMode();_classPrivateFieldSet(this,v,this.editorDiv.innerHTML);_classPrivateFieldSet(this,p,_classPrivateMethodGet(this,b,_extractText2).call(this).trimEnd());_classPrivateMethodGet(this,A,_setEditorDimensions2).call(this)}},{key:"shouldGetKeyboardEvents",value:function shouldGetKeyboardEvents(){return this.isInEditMode()}},{key:"dblclick",value:function dblclick(t){this.enableEditMode();this.editorDiv.focus()}},{key:"keydown",value:function keydown(t){if(t.target===this.div&&"Enter"===t.key){this.enableEditMode();this.editorDiv.focus()}}},{key:"editorDivKeydown",value:function editorDivKeydown(t){FreeTextEditor._keyboardManager.exec(this,t)}},{key:"editorDivFocus",value:function editorDivFocus(t){this.isEditing=!0}},{key:"editorDivBlur",value:function editorDivBlur(t){this.isEditing=!1}},{key:"disableEditing",value:function disableEditing(){this.editorDiv.setAttribute("role","comment");this.editorDiv.removeAttribute("aria-multiline")}},{key:"enableEditing",value:function enableEditing(){this.editorDiv.setAttribute("role","textbox");this.editorDiv.setAttribute("aria-multiline",!0)}},{key:"getIdForTextLayer",value:function getIdForTextLayer(){return this.editorDiv.id}},{key:"render",value:function render(){var t,r,a=this;if(this.div)return this.div;if(this.width){t=this.x;r=this.y}_get(_getPrototypeOf(FreeTextEditor.prototype),"render",this).call(this);this.editorDiv=document.createElement("div");this.editorDiv.className="internal";this.editorDiv.setAttribute("id","".concat(this.id,"-editor"));this.enableEditing();FreeTextEditor._l10nPromise.get("editor_free_text_aria_label").then((function(t){var r;return null===(r=a.editorDiv)||void 0===r?void 0:r.setAttribute("aria-label",t)}));FreeTextEditor._l10nPromise.get("free_text_default_content").then((function(t){var r;return null===(r=a.editorDiv)||void 0===r?void 0:r.setAttribute("default-content",t)}));this.editorDiv.contentEditable=!0;var i=this.editorDiv.style;i.fontSize="calc(".concat(_classPrivateFieldGet(this,g),"px * var(--scale-factor))");i.color=_classPrivateFieldGet(this,h);this.div.append(this.editorDiv);this.overlayDiv=document.createElement("div");this.overlayDiv.classList.add("overlay","enabled");this.div.append(this.overlayDiv);(0,o.bindEvents)(this,this.div,["dblclick","keydown"]);if(this.width){var l=_slicedToArray(this.parent.viewportBaseDimensions,2),c=l[0],u=l[1];this.setAt(t*c,r*u,this.width*c,this.height*u);this.editorDiv.innerHTML=_classPrivateFieldGet(this,v);this.div.draggable=!0;this.editorDiv.contentEditable=!1}else{this.div.draggable=!1;this.editorDiv.contentEditable=!0}return this.div}},{key:"contentDiv",get:function get(){return this.editorDiv}},{key:"serialize",value:function serialize(){if(this.isEmpty())return null;var t=FreeTextEditor._internalPadding*this.parent.scaleFactor,r=this.getRect(t,t),a=l.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:i.AnnotationEditorType.FREETEXT,color:a,fontSize:_classPrivateFieldGet(this,g),value:_classPrivateFieldGet(this,p),pageIndex:this.parent.pageIndex,rect:r,rotation:this.rotation}}}],[{key:"initialize",value:function initialize(t){this._l10nPromise=new Map(["free_text_default_content","editor_free_text_aria_label"].map((function(r){return[r,t.get(r)]})));var r=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(r.getPropertyValue("--freetext-padding"))}},{key:"updateDefaultParams",value:function updateDefaultParams(t,r){switch(t){case i.AnnotationEditorParamsType.FREETEXT_SIZE:FreeTextEditor._defaultFontSize=r;break;case i.AnnotationEditorParamsType.FREETEXT_COLOR:FreeTextEditor._defaultColor=r}}},{key:"defaultPropertiesToUpdate",get:function get(){return[[i.AnnotationEditorParamsType.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[i.AnnotationEditorParamsType.FREETEXT_COLOR,FreeTextEditor._defaultColor||l.AnnotationEditor._defaultLineColor]]}},{key:"deserialize",value:function deserialize(t,r){var a=_get(_getPrototypeOf(FreeTextEditor),"deserialize",this).call(this,t,r);_classPrivateFieldSet(a,g,t.fontSize);_classPrivateFieldSet(a,h,i.Util.makeHexColor.apply(i.Util,_toConsumableArray(t.color)));_classPrivateFieldSet(a,p,t.value);_classPrivateFieldSet(a,v,t.value.split("\n").map((function(t){return"<div>".concat(t,"</div>")})).join(""));return a}}]);return FreeTextEditor}(l.AnnotationEditor);r.FreeTextEditor=k;function _updateFontSize2(t){var r=this,a=function setFontsize(t){r.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))");r.translate(0,-(t-_classPrivateFieldGet(r,g))*r.parent.scaleFactor);_classPrivateFieldSet(r,g,t);_classPrivateMethodGet(r,A,_setEditorDimensions2).call(r)},o=_classPrivateFieldGet(this,g);this.parent.addCommands({cmd:function cmd(){a(t)},undo:function undo(){a(o)},mustExec:!0,type:i.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function _updateColor2(t){var r=this,a=_classPrivateFieldGet(this,h);this.parent.addCommands({cmd:function cmd(){_classPrivateFieldSet(r,h,t);r.editorDiv.style.color=t},undo:function undo(){_classPrivateFieldSet(r,h,a);r.editorDiv.style.color=a},mustExec:!0,type:i.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function _extractText2(){var t=this.editorDiv.getElementsByTagName("div");if(0===t.length)return this.editorDiv.innerText;for(var r=[],a=0,i=t.length;a<i;a++){var o=t[a].firstChild;"#text"===(null==o?void 0:o.nodeName)?r.push(o.data):r.push("")}return r.join("\n")}function _setEditorDimensions2(){var t=_slicedToArray(this.parent.viewportBaseDimensions,2),r=t[0],a=t[1],i=this.div.getBoundingClientRect();this.width=i.width/r;this.height=i.height/a}_defineProperty(k,"_freeTextDefaultContent","");_defineProperty(k,"_l10nPromise",void 0);_defineProperty(k,"_internalPadding",0);_defineProperty(k,"_defaultColor",null);_defineProperty(k,"_defaultFontSize",10);_defineProperty(k,"_keyboardManager",new o.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],k.prototype.commitOrRemove]]))},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.InkEditor=void 0;Object.defineProperty(r,"fitCurve",{enumerable:!0,get:function get(){return l.fitCurve}});var i=a(1),o=a(133),l=a(150),c=a(134);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),a.push.apply(a,i)}return a}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){_defineProperty(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _get(){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function _get(t,r,a){var i=_superPropBase(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:a):o.value}};return _get.apply(this,arguments)}function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _classPrivateMethodInitSpec(t,r){_checkPrivateRedeclaration(t,r);r.add(t)}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _classPrivateFieldInitSpec(t,r,a){_checkPrivateRedeclaration(t,r);r.set(t,a)}function _checkPrivateRedeclaration(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classStaticPrivateMethodGet(t,r,a){!function _classCheckPrivateStaticAccess(t,r){if(t!==r)throw new TypeError("Private static access of wrong provenance")}(t,r);return a}function _classPrivateFieldSet(t,r,a){!function _classApplyDescriptorSet(t,r,a){if(r.set)r.set.call(t,a);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=a}}(t,_classExtractFieldDescriptor(t,r,"set"),a);return a}function _classPrivateFieldGet(t,r){return function _classApplyDescriptorGet(t,r){if(r.get)return r.get.call(t);return r.value}(t,_classExtractFieldDescriptor(t,r,"get"))}function _classExtractFieldDescriptor(t,r,a){if(!r.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return r.get(t)}function _classPrivateMethodGet(t,r,a){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return a}var u=16,d=new WeakMap,h=new WeakMap,p=new WeakMap,v=new WeakMap,y=new WeakMap,g=new WeakMap,_=new WeakMap,m=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakMap,P=new WeakMap,S=new WeakMap,w=new WeakMap,x=new WeakSet,C=new WeakSet,T=new WeakSet,E=new WeakSet,I=new WeakSet,O=new WeakSet,M=new WeakSet,R=new WeakSet,D=new WeakSet,L=new WeakSet,G=new WeakSet,j=new WeakSet,N=new WeakSet,B=new WeakSet,W=new WeakSet,U=new WeakSet,H=new WeakSet,z=new WeakSet,V=new WeakSet,X=new WeakSet,Y=new WeakSet,K=new WeakSet,J=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}(InkEditor,t);var r=_createSuper(InkEditor);function InkEditor(t){var a;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,InkEditor);_classPrivateMethodInitSpec(_assertThisInitialized(a=r.call(this,_objectSpread(_objectSpread({},t),{},{name:"inkEditor"}))),K);_classPrivateMethodInitSpec(_assertThisInitialized(a),Y);_classPrivateMethodInitSpec(_assertThisInitialized(a),X);_classPrivateMethodInitSpec(_assertThisInitialized(a),V);_classPrivateMethodInitSpec(_assertThisInitialized(a),z);_classPrivateMethodInitSpec(_assertThisInitialized(a),H);_classPrivateMethodInitSpec(_assertThisInitialized(a),U);_classPrivateMethodInitSpec(_assertThisInitialized(a),W);_classPrivateMethodInitSpec(_assertThisInitialized(a),B);_classPrivateMethodInitSpec(_assertThisInitialized(a),N);_classPrivateMethodInitSpec(_assertThisInitialized(a),j);_classPrivateMethodInitSpec(_assertThisInitialized(a),G);_classPrivateMethodInitSpec(_assertThisInitialized(a),L);_classPrivateMethodInitSpec(_assertThisInitialized(a),D);_classPrivateMethodInitSpec(_assertThisInitialized(a),R);_classPrivateMethodInitSpec(_assertThisInitialized(a),M);_classPrivateMethodInitSpec(_assertThisInitialized(a),O);_classPrivateMethodInitSpec(_assertThisInitialized(a),I);_classPrivateMethodInitSpec(_assertThisInitialized(a),E);_classPrivateMethodInitSpec(_assertThisInitialized(a),T);_classPrivateMethodInitSpec(_assertThisInitialized(a),C);_classPrivateMethodInitSpec(_assertThisInitialized(a),x);_classPrivateFieldInitSpec(_assertThisInitialized(a),d,{writable:!0,value:0});_classPrivateFieldInitSpec(_assertThisInitialized(a),h,{writable:!0,value:0});_classPrivateFieldInitSpec(_assertThisInitialized(a),p,{writable:!0,value:0});_classPrivateFieldInitSpec(_assertThisInitialized(a),v,{writable:!0,value:a.canvasPointermove.bind(_assertThisInitialized(a))});_classPrivateFieldInitSpec(_assertThisInitialized(a),y,{writable:!0,value:a.canvasPointerleave.bind(_assertThisInitialized(a))});_classPrivateFieldInitSpec(_assertThisInitialized(a),g,{writable:!0,value:a.canvasPointerup.bind(_assertThisInitialized(a))});_classPrivateFieldInitSpec(_assertThisInitialized(a),_,{writable:!0,value:a.canvasPointerdown.bind(_assertThisInitialized(a))});_classPrivateFieldInitSpec(_assertThisInitialized(a),m,{writable:!0,value:!1});_classPrivateFieldInitSpec(_assertThisInitialized(a),b,{writable:!0,value:!1});_classPrivateFieldInitSpec(_assertThisInitialized(a),A,{writable:!0,value:null});_classPrivateFieldInitSpec(_assertThisInitialized(a),k,{writable:!0,value:null});_classPrivateFieldInitSpec(_assertThisInitialized(a),P,{writable:!0,value:0});_classPrivateFieldInitSpec(_assertThisInitialized(a),S,{writable:!0,value:0});_classPrivateFieldInitSpec(_assertThisInitialized(a),w,{writable:!0,value:null});a.color=t.color||null;a.thickness=t.thickness||null;a.opacity=t.opacity||null;a.paths=[];a.bezierPath2D=[];a.currentPath=[];a.scaleFactor=1;a.translationX=a.translationY=0;a.x=0;a.y=0;return a}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(InkEditor,[{key:"updateParams",value:function updateParams(t,r){switch(t){case i.AnnotationEditorParamsType.INK_THICKNESS:_classPrivateMethodGet(this,x,_updateThickness2).call(this,r);break;case i.AnnotationEditorParamsType.INK_COLOR:_classPrivateMethodGet(this,C,_updateColor2).call(this,r);break;case i.AnnotationEditorParamsType.INK_OPACITY:_classPrivateMethodGet(this,T,_updateOpacity2).call(this,r)}}},{key:"propertiesToUpdate",get:function get(){var t;return[[i.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||InkEditor._defaultThickness],[i.AnnotationEditorParamsType.INK_COLOR,this.color||InkEditor._defaultColor||o.AnnotationEditor._defaultLineColor],[i.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(null!==(t=this.opacity)&&void 0!==t?t:InkEditor._defaultOpacity))]]}},{key:"rebuild",value:function rebuild(){_get(_getPrototypeOf(InkEditor.prototype),"rebuild",this).call(this);if(null!==this.div){if(!this.canvas){_classPrivateMethodGet(this,G,_createCanvas2).call(this);_classPrivateMethodGet(this,j,_createObserver2).call(this)}if(!this.isAttachedToDOM){this.parent.add(this);_classPrivateMethodGet(this,N,_setCanvasDims2).call(this)}_classPrivateMethodGet(this,Y,_fitToContent2).call(this)}}},{key:"remove",value:function remove(){if(null!==this.canvas){this.isEmpty()||this.commit();this.canvas.width=this.canvas.height=0;this.canvas.remove();this.canvas=null;_classPrivateFieldGet(this,k).disconnect();_classPrivateFieldSet(this,k,null);_get(_getPrototypeOf(InkEditor.prototype),"remove",this).call(this)}}},{key:"enableEditMode",value:function enableEditMode(){if(!_classPrivateFieldGet(this,m)&&null!==this.canvas){_get(_getPrototypeOf(InkEditor.prototype),"enableEditMode",this).call(this);this.div.draggable=!1;this.canvas.addEventListener("pointerdown",_classPrivateFieldGet(this,_));this.canvas.addEventListener("pointerup",_classPrivateFieldGet(this,g))}}},{key:"disableEditMode",value:function disableEditMode(){if(this.isInEditMode()&&null!==this.canvas){_get(_getPrototypeOf(InkEditor.prototype),"disableEditMode",this).call(this);this.div.draggable=!this.isEmpty();this.div.classList.remove("editing");this.canvas.removeEventListener("pointerdown",_classPrivateFieldGet(this,_));this.canvas.removeEventListener("pointerup",_classPrivateFieldGet(this,g))}}},{key:"onceAdded",value:function onceAdded(){this.div.draggable=!this.isEmpty()}},{key:"isEmpty",value:function isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}},{key:"commit",value:function commit(){if(!_classPrivateFieldGet(this,m)){_get(_getPrototypeOf(InkEditor.prototype),"commit",this).call(this);this.isEditing=!1;this.disableEditMode();this.setInForeground();_classPrivateFieldSet(this,m,!0);this.div.classList.add("disabled");_classPrivateMethodGet(this,Y,_fitToContent2).call(this,!0);this.parent.addInkEditorIfNeeded(!0);this.parent.moveDivInDOM(this);this.div.focus()}}},{key:"focusin",value:function focusin(t){_get(_getPrototypeOf(InkEditor.prototype),"focusin",this).call(this,t);this.enableEditMode()}},{key:"canvasPointerdown",value:function canvasPointerdown(t){if(0===t.button&&this.isInEditMode()&&!_classPrivateFieldGet(this,m)){this.setInForeground();"mouse"!==t.type&&this.div.focus();t.stopPropagation();this.canvas.addEventListener("pointerleave",_classPrivateFieldGet(this,y));this.canvas.addEventListener("pointermove",_classPrivateFieldGet(this,v));_classPrivateMethodGet(this,O,_startDrawing2).call(this,t.offsetX,t.offsetY)}}},{key:"canvasPointermove",value:function canvasPointermove(t){t.stopPropagation();_classPrivateMethodGet(this,M,_draw2).call(this,t.offsetX,t.offsetY)}},{key:"canvasPointerup",value:function canvasPointerup(t){if(0===t.button&&this.isInEditMode()&&0!==this.currentPath.length){t.stopPropagation();_classPrivateMethodGet(this,L,_endDrawing2).call(this,t);this.setInBackground()}}},{key:"canvasPointerleave",value:function canvasPointerleave(t){_classPrivateMethodGet(this,L,_endDrawing2).call(this,t);this.setInBackground()}},{key:"render",value:function render(){var t,r,a=this;if(this.div)return this.div;if(this.width){t=this.x;r=this.y}_get(_getPrototypeOf(InkEditor.prototype),"render",this).call(this);InkEditor._l10nPromise.get("editor_ink_aria_label").then((function(t){var r;return null===(r=a.div)||void 0===r?void 0:r.setAttribute("aria-label",t)}));var i=_slicedToArray(_classPrivateMethodGet(this,E,_getInitialBBox2).call(this),4),o=i[0],l=i[1],c=i[2],u=i[3];this.setAt(o,l,0,0);this.setDims(c,u);_classPrivateMethodGet(this,G,_createCanvas2).call(this);if(this.width){var d=_slicedToArray(this.parent.viewportBaseDimensions,2),h=d[0],p=d[1];this.setAt(t*h,r*p,this.width*h,this.height*p);_classPrivateFieldSet(this,b,!0);_classPrivateMethodGet(this,N,_setCanvasDims2).call(this);this.setDims(this.width*h,this.height*p);_classPrivateMethodGet(this,D,_redraw2).call(this);_classPrivateMethodGet(this,K,_setMinDims2).call(this);this.div.classList.add("disabled")}else{this.div.classList.add("editing");this.enableEditMode()}_classPrivateMethodGet(this,j,_createObserver2).call(this);return this.div}},{key:"setDimensions",value:function setDimensions(t,r){var a=Math.round(t),i=Math.round(r);if(_classPrivateFieldGet(this,P)!==a||_classPrivateFieldGet(this,S)!==i){_classPrivateFieldSet(this,P,a);_classPrivateFieldSet(this,S,i);this.canvas.style.visibility="hidden";if(_classPrivateFieldGet(this,d)&&Math.abs(_classPrivateFieldGet(this,d)-t/r)>.01){r=Math.ceil(t/_classPrivateFieldGet(this,d));this.setDims(t,r)}var o=_slicedToArray(this.parent.viewportBaseDimensions,2),l=o[0],c=o[1];this.width=t/l;this.height=r/c;_classPrivateFieldGet(this,m)&&_classPrivateMethodGet(this,B,_setScaleFactor2).call(this,t,r);_classPrivateMethodGet(this,N,_setCanvasDims2).call(this);_classPrivateMethodGet(this,D,_redraw2).call(this);this.canvas.style.visibility="visible"}}},{key:"serialize",value:function serialize(){if(this.isEmpty())return null;var t=this.getRect(0,0),r=this.rotation%180==0?t[3]-t[1]:t[2]-t[0],a=o.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:i.AnnotationEditorType.INK,color:a,thickness:this.thickness,opacity:this.opacity,paths:_classPrivateMethodGet(this,U,_serializePaths2).call(this,this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,r),pageIndex:this.parent.pageIndex,rect:t,rotation:this.rotation}}}],[{key:"initialize",value:function initialize(t){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink_aria_label"].map((function(r){return[r,t.get(r)]})))}},{key:"updateDefaultParams",value:function updateDefaultParams(t,r){switch(t){case i.AnnotationEditorParamsType.INK_THICKNESS:InkEditor._defaultThickness=r;break;case i.AnnotationEditorParamsType.INK_COLOR:InkEditor._defaultColor=r;break;case i.AnnotationEditorParamsType.INK_OPACITY:InkEditor._defaultOpacity=r/100}}},{key:"defaultPropertiesToUpdate",get:function get(){return[[i.AnnotationEditorParamsType.INK_THICKNESS,InkEditor._defaultThickness],[i.AnnotationEditorParamsType.INK_COLOR,InkEditor._defaultColor||o.AnnotationEditor._defaultLineColor],[i.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*InkEditor._defaultOpacity)]]}},{key:"deserialize",value:function deserialize(t,r){var a=_get(_getPrototypeOf(InkEditor),"deserialize",this).call(this,t,r);a.thickness=t.thickness;a.color=i.Util.makeHexColor.apply(i.Util,_toConsumableArray(t.color));a.opacity=t.opacity;var o=_slicedToArray(r.pageDimensions,2),l=o[0],c=o[1],u=a.width*l,v=a.height*c,y=r.scaleFactor,g=t.thickness/2;_classPrivateFieldSet(a,d,u/v);_classPrivateFieldSet(a,m,!0);_classPrivateFieldSet(a,P,Math.round(u));_classPrivateFieldSet(a,S,Math.round(v));var _,b=_createForOfIteratorHelper(t.paths);try{for(b.s();!(_=b.n()).done;){var A=_.value.bezier,k=[];a.paths.push(k);for(var w=y*(A[0]-g),x=y*(v-A[1]-g),C=2,T=A.length;C<T;C+=6){var E=y*(A[C]-g),I=y*(v-A[C+1]-g),O=y*(A[C+2]-g),M=y*(v-A[C+3]-g),R=y*(A[C+4]-g),D=y*(v-A[C+5]-g);k.push([[w,x],[E,I],[O,M],[R,D]]);w=R;x=D}var L=_classStaticPrivateMethodGet(this,InkEditor,_buildPath2D).call(this,k);a.bezierPath2D.push(L)}}catch(t){b.e(t)}finally{b.f()}var G=_classPrivateMethodGet(a,V,_getBbox2).call(a);_classPrivateFieldSet(a,p,G[2]-G[0]);_classPrivateFieldSet(a,h,G[3]-G[1]);_classPrivateMethodGet(a,B,_setScaleFactor2).call(a,u,v);return a}}]);return InkEditor}(o.AnnotationEditor);r.InkEditor=J;function _updateThickness2(t){var r=this,a=this.thickness;this.parent.addCommands({cmd:function cmd(){r.thickness=t;_classPrivateMethodGet(r,Y,_fitToContent2).call(r)},undo:function undo(){r.thickness=a;_classPrivateMethodGet(r,Y,_fitToContent2).call(r)},mustExec:!0,type:i.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function _updateColor2(t){var r=this,a=this.color;this.parent.addCommands({cmd:function cmd(){r.color=t;_classPrivateMethodGet(r,D,_redraw2).call(r)},undo:function undo(){r.color=a;_classPrivateMethodGet(r,D,_redraw2).call(r)},mustExec:!0,type:i.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function _updateOpacity2(t){var r=this;t/=100;var a=this.opacity;this.parent.addCommands({cmd:function cmd(){r.opacity=t;_classPrivateMethodGet(r,D,_redraw2).call(r)},undo:function undo(){r.opacity=a;_classPrivateMethodGet(r,D,_redraw2).call(r)},mustExec:!0,type:i.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function _getInitialBBox2(){var t=this.parent.viewport,r=t.width,a=t.height;switch(t.rotation){case 90:return[0,r,r,a];case 180:return[r,a,r,a];case 270:return[a,0,r,a];default:return[0,0,r,a]}}function _setStroke2(){this.ctx.lineWidth=this.thickness*this.parent.scaleFactor/this.scaleFactor;this.ctx.lineCap="round";this.ctx.lineJoin="round";this.ctx.miterLimit=10;this.ctx.strokeStyle="".concat(this.color).concat((0,c.opacityToHex)(this.opacity))}function _startDrawing2(t,r){var a=this;this.isEditing=!0;if(!_classPrivateFieldGet(this,b)){var i;_classPrivateFieldSet(this,b,!0);_classPrivateMethodGet(this,N,_setCanvasDims2).call(this);this.thickness||(this.thickness=J._defaultThickness);this.color||(this.color=J._defaultColor||o.AnnotationEditor._defaultLineColor);null!==(i=this.opacity)&&void 0!==i||(this.opacity=J._defaultOpacity)}this.currentPath.push([t,r]);_classPrivateFieldSet(this,A,null);_classPrivateMethodGet(this,I,_setStroke2).call(this);this.ctx.beginPath();this.ctx.moveTo(t,r);_classPrivateFieldSet(this,w,(function(){if(_classPrivateFieldGet(a,w)){if(_classPrivateFieldGet(a,A)){var t;if(a.isEmpty()){a.ctx.setTransform(1,0,0,1,0,0);a.ctx.clearRect(0,0,a.canvas.width,a.canvas.height)}else _classPrivateMethodGet(a,D,_redraw2).call(a);(t=a.ctx).lineTo.apply(t,_toConsumableArray(_classPrivateFieldGet(a,A)));_classPrivateFieldSet(a,A,null);a.ctx.stroke()}window.requestAnimationFrame(_classPrivateFieldGet(a,w))}}));window.requestAnimationFrame(_classPrivateFieldGet(this,w))}function _draw2(t,r){var a=_slicedToArray(this.currentPath.at(-1),2),i=a[0],o=a[1];if(t!==i||r!==o){this.currentPath.push([t,r]);_classPrivateFieldSet(this,A,[t,r])}}function _stopDrawing2(t,r){var a=this;this.ctx.closePath();_classPrivateFieldSet(this,w,null);t=Math.min(Math.max(t,0),this.canvas.width);r=Math.min(Math.max(r,0),this.canvas.height);var i,o=_slicedToArray(this.currentPath.at(-1),2),c=o[0],u=o[1];t===c&&r===u||this.currentPath.push([t,r]);if(1!==this.currentPath.length)i=(0,l.fitCurve)(this.currentPath,30,null);else{var d=[t,r];i=[[d,d.slice(),d.slice(),d]]}var h=_classStaticPrivateMethodGet(J,J,_buildPath2D).call(J,i);this.currentPath.length=0;this.parent.addCommands({cmd:function cmd(){a.paths.push(i);a.bezierPath2D.push(h);a.rebuild()},undo:function undo(){a.paths.pop();a.bezierPath2D.pop();if(0===a.paths.length)a.remove();else{if(!a.canvas){_classPrivateMethodGet(a,G,_createCanvas2).call(a);_classPrivateMethodGet(a,j,_createObserver2).call(a)}_classPrivateMethodGet(a,Y,_fitToContent2).call(a)}},mustExec:!0})}function _redraw2(){if(this.isEmpty())_classPrivateMethodGet(this,W,_updateTransform2).call(this);else{_classPrivateMethodGet(this,I,_setStroke2).call(this);var t=this.canvas,r=this.ctx;r.setTransform(1,0,0,1,0,0);r.clearRect(0,0,t.width,t.height);_classPrivateMethodGet(this,W,_updateTransform2).call(this);var a,i=_createForOfIteratorHelper(this.bezierPath2D);try{for(i.s();!(a=i.n()).done;){var o=a.value;r.stroke(o)}}catch(t){i.e(t)}finally{i.f()}}}function _endDrawing2(t){_classPrivateMethodGet(this,R,_stopDrawing2).call(this,t.offsetX,t.offsetY);this.canvas.removeEventListener("pointerleave",_classPrivateFieldGet(this,y));this.canvas.removeEventListener("pointermove",_classPrivateFieldGet(this,v));this.parent.addToAnnotationStorage(this)}function _createCanvas2(){var t=this;this.canvas=document.createElement("canvas");this.canvas.width=this.canvas.height=0;this.canvas.className="inkEditorCanvas";J._l10nPromise.get("editor_ink_canvas_aria_label").then((function(r){var a;return null===(a=t.canvas)||void 0===a?void 0:a.setAttribute("aria-label",r)}));this.div.append(this.canvas);this.ctx=this.canvas.getContext("2d")}function _createObserver2(){var t=this;_classPrivateFieldSet(this,k,new ResizeObserver((function(r){var a=r[0].contentRect;a.width&&a.height&&t.setDimensions(a.width,a.height)})));_classPrivateFieldGet(this,k).observe(this.div)}function _setCanvasDims2(){if(_classPrivateFieldGet(this,b)){var t=_slicedToArray(this.parent.viewportBaseDimensions,2),r=t[0],a=t[1];this.canvas.width=Math.ceil(this.width*r);this.canvas.height=Math.ceil(this.height*a);_classPrivateMethodGet(this,W,_updateTransform2).call(this)}}function _setScaleFactor2(t,r){var a=_classPrivateMethodGet(this,X,_getPadding2).call(this),i=(t-a)/_classPrivateFieldGet(this,p),o=(r-a)/_classPrivateFieldGet(this,h);this.scaleFactor=Math.min(i,o)}function _updateTransform2(){var t=_classPrivateMethodGet(this,X,_getPadding2).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}function _buildPath2D(t){for(var r=new Path2D,a=0,i=t.length;a<i;a++){var o=_slicedToArray(t[a],4),l=o[0],c=o[1],u=o[2],d=o[3];0===a&&r.moveTo.apply(r,_toConsumableArray(l));r.bezierCurveTo(c[0],c[1],u[0],u[1],d[0],d[1])}return r}function _serializePaths2(t,r,a,i){var o,l,c,u=[],d=this.thickness/2,h=_createForOfIteratorHelper(this.paths);try{for(h.s();!(c=h.n()).done;){var p=c.value;o=[];l=[];for(var v=0,y=p.length;v<y;v++){var g=_slicedToArray(p[v],4),_=g[0],m=g[1],b=g[2],A=g[3],k=t*(_[0]+r)+d,P=i-t*(_[1]+a)-d,S=t*(m[0]+r)+d,w=i-t*(m[1]+a)-d,x=t*(b[0]+r)+d,C=i-t*(b[1]+a)-d,T=t*(A[0]+r)+d,E=i-t*(A[1]+a)-d;if(0===v){o.push(k,P);l.push(k,P)}o.push(S,w,x,C,T,E);_classPrivateMethodGet(this,H,_extractPointsOnBezier2).call(this,k,P,S,w,x,C,T,E,4,l)}u.push({bezier:o,points:l})}}catch(t){h.e(t)}finally{h.f()}return u}function _extractPointsOnBezier2(t,r,a,i,o,l,c,u,d,h){if(_classPrivateMethodGet(this,z,_isAlmostFlat2).call(this,t,r,a,i,o,l,c,u))h.push(c,u);else{for(var p=1;p<d-1;p++){var v=p/d,y=1-v,g=v*t+y*a,_=v*r+y*i,m=v*a+y*o,b=v*i+y*l;g=v*(g=v*g+y*m)+y*(m=v*m+y*(v*o+y*c));_=v*(_=v*_+y*b)+y*(b=v*b+y*(v*l+y*u));h.push(g,_)}h.push(c,u)}}function _isAlmostFlat2(t,r,a,i,o,l,c,u){var d=Math.pow(3*a-2*t-c,2),h=Math.pow(3*i-2*r-u,2),p=Math.pow(3*o-t-2*c,2),v=Math.pow(3*l-r-2*u,2);return Math.max(d,p)+Math.max(h,v)<=10}function _getBbox2(){var t,r=1/0,a=-1/0,o=1/0,l=-1/0,c=_createForOfIteratorHelper(this.paths);try{for(c.s();!(t=c.n()).done;){var u,d=_createForOfIteratorHelper(t.value);try{for(d.s();!(u=d.n()).done;){var h=_slicedToArray(u.value,4),p=h[0],v=h[1],y=h[2],g=h[3],_=i.Util.bezierBoundingBox.apply(i.Util,_toConsumableArray(p).concat(_toConsumableArray(v),_toConsumableArray(y),_toConsumableArray(g)));r=Math.min(r,_[0]);o=Math.min(o,_[1]);a=Math.max(a,_[2]);l=Math.max(l,_[3])}}catch(t){d.e(t)}finally{d.f()}}}catch(t){c.e(t)}finally{c.f()}return[r,o,a,l]}function _getPadding2(){return _classPrivateFieldGet(this,m)?Math.ceil(this.thickness*this.parent.scaleFactor):0}function _fitToContent2(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isEmpty())if(_classPrivateFieldGet(this,m)){var r=_classPrivateMethodGet(this,V,_getBbox2).call(this),a=_classPrivateMethodGet(this,X,_getPadding2).call(this);_classPrivateFieldSet(this,p,Math.max(u,r[2]-r[0]));_classPrivateFieldSet(this,h,Math.max(u,r[3]-r[1]));var i=Math.ceil(a+_classPrivateFieldGet(this,p)*this.scaleFactor),o=Math.ceil(a+_classPrivateFieldGet(this,h)*this.scaleFactor),l=_slicedToArray(this.parent.viewportBaseDimensions,2),c=l[0],v=l[1];this.width=i/c;this.height=o/v;_classPrivateFieldSet(this,d,i/o);_classPrivateMethodGet(this,K,_setMinDims2).call(this);var y=this.translationX,g=this.translationY;this.translationX=-r[0];this.translationY=-r[1];_classPrivateMethodGet(this,N,_setCanvasDims2).call(this);_classPrivateMethodGet(this,D,_redraw2).call(this);_classPrivateFieldSet(this,P,i);_classPrivateFieldSet(this,S,o);this.setDims(i,o);var _=t?a/this.scaleFactor/2:0;this.translate(y-this.translationX-_,g-this.translationY-_)}else _classPrivateMethodGet(this,D,_redraw2).call(this)}function _setMinDims2(){var t=this.div.style;if(_classPrivateFieldGet(this,d)>=1){t.minHeight="".concat(u,"px");t.minWidth="".concat(Math.round(_classPrivateFieldGet(this,d)*u),"px")}else{t.minWidth="".concat(u,"px");t.minHeight="".concat(Math.round(u/_classPrivateFieldGet(this,d)),"px")}}_defineProperty(J,"_defaultColor",null);_defineProperty(J,"_defaultOpacity",1);_defineProperty(J,"_defaultThickness",1);_defineProperty(J,"_l10nPromise",void 0)},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.fitCurve=void 0;var i=a(151);r.fitCurve=i},t=>{"use strict";function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function fitCubic(t,r,i,o,l){var c,u,d,h,p,v,y,g,_,m,b,A,k;if(2===t.length){A=a.vectorLen(a.subtract(t[0],t[1]))/3;return[c=[t[0],a.addArrays(t[0],a.mulItems(r,A)),a.addArrays(t[1],a.mulItems(i,A)),t[1]]]}u=function chordLengthParameterize(t){var r,i,o,l=[];t.forEach((function(t,c){r=c?i+a.vectorLen(a.subtract(t,o)):0;l.push(r);i=r;o=t}));return l=l.map((function(t){return t/i}))}(t);var P=_slicedToArray(generateAndReport(t,u,u,r,i,l),3);c=P[0];h=P[1];v=P[2];if(0===h||h<o)return[c];if(h<o*o){d=u;p=h;y=v;for(k=0;k<20;k++){var S=_slicedToArray(generateAndReport(t,u,d=reparameterize(c,t,d),r,i,l),3);c=S[0];h=S[1];v=S[2];if(h<o)return[c];if(v===y){var w=h/p;if(w>.9999&&w<1.0001)break}p=h;y=v}}b=[];if((g=a.subtract(t[v-1],t[v+1])).every((function(t){return 0===t}))){var x=[-(g=a.subtract(t[v-1],t[v]))[1],g[0]];g[0]=x[0];g[1]=x[1]}_=a.normalize(g);m=a.mulItems(_,-1);return b=(b=b.concat(fitCubic(t.slice(0,v+1),r,_,o,l))).concat(fitCubic(t.slice(v),m,i,o,l))}function generateAndReport(t,o,l,c,u,d){var h,p,v;h=function generateBezier(t,r,o,l){var c,u,d,h,p,v,y,g,_,m,b,A,k,P,S,w,x,C=t[0],T=t[t.length-1];c=[C,null,null,T];u=a.zeros_Xx2x2(r.length);for(k=0,P=r.length;k<P;k++){x=1-(w=r[k]);(d=u[k])[0]=a.mulItems(o,3*w*(x*x));d[1]=a.mulItems(l,3*x*(w*w))}h=[[0,0],[0,0]];p=[0,0];for(k=0,P=t.length;k<P;k++){w=r[k];d=u[k];h[0][0]+=a.dot(d[0],d[0]);h[0][1]+=a.dot(d[0],d[1]);h[1][0]+=a.dot(d[0],d[1]);h[1][1]+=a.dot(d[1],d[1]);S=a.subtract(t[k],i.q([C,C,T,T],w));p[0]+=a.dot(d[0],S);p[1]+=a.dot(d[1],S)}v=h[0][0]*h[1][1]-h[1][0]*h[0][1];y=h[0][0]*p[1]-h[1][0]*p[0];g=p[0]*h[1][1]-p[1]*h[0][1];_=0===v?0:g/v;m=0===v?0:y/v;A=a.vectorLen(a.subtract(C,T));if(_<(b=1e-6*A)||m<b){c[1]=a.addArrays(C,a.mulItems(o,A/3));c[2]=a.addArrays(T,a.mulItems(l,A/3))}else{c[1]=a.addArrays(C,a.mulItems(o,_));c[2]=a.addArrays(T,a.mulItems(l,m))}return c}(t,l,c,u);var y=function computeMaxError(t,o,l){var c,u,d,h,p,v,y,g;u=0;d=Math.floor(t.length/2);var _=r(o,10);for(p=0,v=t.length;p<v;p++){y=t[p];g=find_t(o,l[p],_,10);if((c=(h=a.subtract(i.q(o,g),y))[0]*h[0]+h[1]*h[1])>u){u=c;d=p}}return[u,d]}(t,h,o),g=_slicedToArray(y,2);p=g[0];v=g[1];d&&d({bez:h,points:t,params:o,maxErr:p,maxPoint:v});return[h,p,v]}function reparameterize(t,r,a){return a.map((function(a,i){return newtonRaphsonRootFind(t,r[i],a)}))}function newtonRaphsonRootFind(t,r,o){var l=a.subtract(i.q(t,o),r),c=i.qprime(t,o),u=a.mulMatrix(l,c),d=a.sum(a.squareItems(c))+2*a.mulMatrix(l,i.qprimeprime(t,o));return 0===d?o:o-u/d}var r=function mapTtoRelativeDistances(t,r){for(var o,l=[0],c=t[0],u=0,d=1;d<=r;d++){o=i.q(t,d/r);u+=a.vectorLen(a.subtract(o,c));l.push(u);c=o}return l=l.map((function(t){return t/u}))};function find_t(t,r,a,i){if(r<0)return 0;if(r>1)return 1;for(var o,l,c,u,d=1;d<=i;d++)if(r<=a[d]){c=(d-1)/i;l=d/i;u=(r-(o=a[d-1]))/(a[d]-o)*(l-c)+c;break}return u}function createTangent(t,r){return a.normalize(a.subtract(t,r))}var a=function(){function maths(){_classCallCheck(this,maths)}_createClass(maths,null,[{key:"zeros_Xx2x2",value:function zeros_Xx2x2(t){for(var r=[];t--;)r.push([0,0]);return r}},{key:"mulItems",value:function mulItems(t,r){return t.map((function(t){return t*r}))}},{key:"mulMatrix",value:function mulMatrix(t,r){return t.reduce((function(t,a,i){return t+a*r[i]}),0)}},{key:"subtract",value:function subtract(t,r){return t.map((function(t,a){return t-r[a]}))}},{key:"addArrays",value:function addArrays(t,r){return t.map((function(t,a){return t+r[a]}))}},{key:"addItems",value:function addItems(t,r){return t.map((function(t){return t+r}))}},{key:"sum",value:function sum(t){return t.reduce((function(t,r){return t+r}))}},{key:"dot",value:function dot(t,r){return maths.mulMatrix(t,r)}},{key:"vectorLen",value:function vectorLen(t){return Math.hypot.apply(Math,_toConsumableArray(t))}},{key:"divItems",value:function divItems(t,r){return t.map((function(t){return t/r}))}},{key:"squareItems",value:function squareItems(t){return t.map((function(t){return t*t}))}},{key:"normalize",value:function normalize(t){return this.divItems(t,this.vectorLen(t))}}]);return maths}(),i=function(){function bezier(){_classCallCheck(this,bezier)}_createClass(bezier,null,[{key:"q",value:function q(t,r){var i=1-r,o=a.mulItems(t[0],i*i*i),l=a.mulItems(t[1],3*i*i*r),c=a.mulItems(t[2],3*i*r*r),u=a.mulItems(t[3],r*r*r);return a.addArrays(a.addArrays(o,l),a.addArrays(c,u))}},{key:"qprime",value:function qprime(t,r){var i=1-r,o=a.mulItems(a.subtract(t[1],t[0]),3*i*i),l=a.mulItems(a.subtract(t[2],t[1]),6*i*r),c=a.mulItems(a.subtract(t[3],t[2]),3*r*r);return a.addArrays(a.addArrays(o,l),c)}},{key:"qprimeprime",value:function qprimeprime(t,r){return a.addArrays(a.mulItems(a.addArrays(a.subtract(t[2],a.mulItems(t[1],2)),t[0]),6*(1-r)),a.mulItems(a.addArrays(a.subtract(t[3],a.mulItems(t[2],2)),t[1]),6*r))}}]);return bezier}();t.exports=function fitCurve(t,r,a){if(!Array.isArray(t))throw new TypeError("First argument should be an array");t.forEach((function(r){if(!Array.isArray(r)||r.some((function(t){return"number"!=typeof t}))||r.length!==t[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")}));if((t=t.filter((function(r,a){return 0===a||!r.every((function(r,i){return r===t[a-1][i]}))}))).length<2)return[];var i=t.length,o=createTangent(t[1],t[0]),l=createTangent(t[i-2],t[i-1]);return fitCubic(t,o,l,r,a)};t.exports.fitCubic=fitCubic;t.exports.createTangent=createTangent},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.AnnotationLayer=void 0;var i=a(1),o=a(129),l=a(132),c=a(153),u=a(154);function _classStaticPrivateMethodGet(t,r,a){!function _classCheckPrivateStaticAccess(t,r){if(t!==r)throw new TypeError("Private static access of wrong provenance")}(t,r);return a}function _get(){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function _get(t,r,a){var i=_superPropBase(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:a):o.value}};return _get.apply(this,arguments)}function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}var d=1e3,h=new WeakSet;function getRectDims(t){return{width:t[2]-t[0],height:t[3]-t[1]}}var p=function(){function AnnotationElementFactory(){_classCallCheck(this,AnnotationElementFactory)}_createClass(AnnotationElementFactory,null,[{key:"create",value:function create(t){switch(t.data.annotationType){case i.AnnotationType.LINK:return new y(t);case i.AnnotationType.TEXT:return new g(t);case i.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new m(t);case"Btn":return t.data.radioButton?new A(t):t.data.checkBox?new b(t):new k(t);case"Ch":return new P(t)}return new _(t);case i.AnnotationType.POPUP:return new S(t);case i.AnnotationType.FREETEXT:return new x(t);case i.AnnotationType.LINE:return new C(t);case i.AnnotationType.SQUARE:return new T(t);case i.AnnotationType.CIRCLE:return new E(t);case i.AnnotationType.POLYLINE:return new I(t);case i.AnnotationType.CARET:return new M(t);case i.AnnotationType.INK:return new R(t);case i.AnnotationType.POLYGON:return new O(t);case i.AnnotationType.HIGHLIGHT:return new D(t);case i.AnnotationType.UNDERLINE:return new L(t);case i.AnnotationType.SQUIGGLY:return new G(t);case i.AnnotationType.STRIKEOUT:return new j(t);case i.AnnotationType.STAMP:return new N(t);case i.AnnotationType.FILEATTACHMENT:return new B(t);default:return new v(t)}}}]);return AnnotationElementFactory}(),v=function(){function AnnotationElement(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.isRenderable,i=void 0!==a&&a,o=r.ignoreBorder,l=void 0!==o&&o,c=r.createQuadrilaterals,u=void 0!==c&&c;_classCallCheck(this,AnnotationElement);this.isRenderable=i;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;this._mouseState=t.mouseState;i&&(this.container=this._createContainer(l));u&&(this.quadrilaterals=this._createQuadrilaterals(l))}_createClass(AnnotationElement,[{key:"_createContainer",value:function _createContainer(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.data,a=this.page,o=this.viewport,l=document.createElement("section"),c=getRectDims(r.rect),u=c.width,d=c.height,h=_slicedToArray(o.viewBox,4),p=h[0],v=h[1],y=h[2],g=h[3],_=y-p,m=g-v;l.setAttribute("data-annotation-id",r.id);var b=i.Util.normalizeRect([r.rect[0],a.view[3]-r.rect[1]+a.view[1],r.rect[2],a.view[3]-r.rect[3]+a.view[1]]);if(!t&&r.borderStyle.width>0){l.style.borderWidth="".concat(r.borderStyle.width,"px");var A=r.borderStyle.horizontalCornerRadius,k=r.borderStyle.verticalCornerRadius;if(A>0||k>0){var P="calc(".concat(A,"px * var(--scale-factor)) / calc(").concat(k,"px * var(--scale-factor))");l.style.borderRadius=P}switch(r.borderStyle.style){case i.AnnotationBorderStyleType.SOLID:l.style.borderStyle="solid";break;case i.AnnotationBorderStyleType.DASHED:l.style.borderStyle="dashed";break;case i.AnnotationBorderStyleType.BEVELED:(0,i.warn)("Unimplemented border style: beveled");break;case i.AnnotationBorderStyleType.INSET:(0,i.warn)("Unimplemented border style: inset");break;case i.AnnotationBorderStyleType.UNDERLINE:l.style.borderBottomStyle="solid"}var S=r.borderColor||null;S?l.style.borderColor=i.Util.makeHexColor(0|S[0],0|S[1],0|S[2]):l.style.borderWidth=0}l.style.left="".concat(100*(b[0]-p)/_,"%");l.style.top="".concat(100*(b[1]-v)/m,"%");var w=r.rotation;if(r.hasOwnCanvas||0===w){l.style.width="".concat(100*u/_,"%");l.style.height="".concat(100*d/m,"%")}else this.setRotation(w,l);return l}},{key:"setRotation",value:function setRotation(t){var r,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container,o=_slicedToArray(this.viewport.viewBox,4),l=o[0],c=o[1],u=o[2],d=o[3],h=u-l,p=d-c,v=getRectDims(this.data.rect),y=v.width,g=v.height;if(t%180==0){r=100*y/h;a=100*g/p}else{r=100*g/h;a=100*y/p}i.style.width="".concat(r,"%");i.style.height="".concat(a,"%");i.setAttribute("data-main-rotation",(360-t)%360)}},{key:"_commonActions",get:function get(){var t=this,r=function setColor(t,r,a){var i=a.detail[t];a.target.style[r]=c.ColorConverters["".concat(i[0],"_HTML")](i.slice(1))};return(0,i.shadow)(this,"_commonActions",{display:function display(r){var a=r.detail.display%2==1;t.container.style.visibility=a?"hidden":"visible";t.annotationStorage.setValue(t.data.id,{hidden:a,print:0===r.detail.display||3===r.detail.display})},print:function print(r){t.annotationStorage.setValue(t.data.id,{print:r.detail.print})},hidden:function hidden(r){t.container.style.visibility=r.detail.hidden?"hidden":"visible";t.annotationStorage.setValue(t.data.id,{hidden:r.detail.hidden})},focus:function focus(t){setTimeout((function(){return t.target.focus({preventScroll:!1})}),0)},userName:function userName(t){t.target.title=t.detail.userName},readonly:function readonly(t){t.detail.readonly?t.target.setAttribute("readonly",""):t.target.removeAttribute("readonly")},required:function required(r){t._setRequired(r.target,r.detail.required)},bgColor:function bgColor(t){r("bgColor","backgroundColor",t)},fillColor:function fillColor(t){r("fillColor","backgroundColor",t)},fgColor:function fgColor(t){r("fgColor","color",t)},textColor:function textColor(t){r("textColor","color",t)},borderColor:function borderColor(t){r("borderColor","borderColor",t)},strokeColor:function strokeColor(t){r("strokeColor","borderColor",t)},rotation:function rotation(r){var a=r.detail.rotation;t.setRotation(a);t.annotationStorage.setValue(t.data.id,{rotation:a})}})}},{key:"_dispatchEventFromSandbox",value:function _dispatchEventFromSandbox(t,r){for(var a=this._commonActions,i=0,o=Object.keys(r.detail);i<o.length;i++){var l=o[i],c=t[l]||a[l];c&&c(r)}}},{key:"_setDefaultPropertiesFromJS",value:function _setDefaultPropertiesFromJS(t){if(this.enableScripting){var r=this.annotationStorage.getRawValue(this.data.id);if(r)for(var a=this._commonActions,i=0,o=Object.entries(r);i<o.length;i++){var l=_slicedToArray(o[i],2),c=l[0],u=l[1],d=a[c];if(d){d({detail:u,target:t});delete r[c]}}}}},{key:"_createQuadrilaterals",value:function _createQuadrilaterals(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.data.quadPoints)return null;var r,a=[],i=this.data.rect,o=_createForOfIteratorHelper(this.data.quadPoints);try{for(o.s();!(r=o.n()).done;){var l=r.value;this.data.rect=[l[2].x,l[2].y,l[1].x,l[1].y];a.push(this._createContainer(t))}}catch(t){o.e(t)}finally{o.f()}this.data.rect=i;return a}},{key:"_createPopup",value:function _createPopup(t,r){var a=this.container;if(this.quadrilaterals){t=t||this.quadrilaterals;a=this.quadrilaterals[0]}if(!t){(t=document.createElement("div")).className="popupTriggerArea";a.append(t)}var i=new w({container:a,trigger:t,color:r.color,titleObj:r.titleObj,modificationDate:r.modificationDate,contentsObj:r.contentsObj,richText:r.richText,hideWrapper:!0}).render();i.style.left="100%";a.append(i)}},{key:"_renderQuadrilaterals",value:function _renderQuadrilaterals(t){var r,a=_createForOfIteratorHelper(this.quadrilaterals);try{for(a.s();!(r=a.n()).done;){r.value.className=t}}catch(t){a.e(t)}finally{a.f()}return this.quadrilaterals}},{key:"render",value:function render(){(0,i.unreachable)("Abstract method `AnnotationElement.render` called")}},{key:"_getElementsByName",value:function _getElementsByName(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=[];if(this._fieldObjects){var o=this._fieldObjects[t];if(o){var l,c=_createForOfIteratorHelper(o);try{for(c.s();!(l=c.n()).done;){var u=l.value,d=u.page,p=u.id,v=u.exportValues;if(-1!==d&&p!==r){var y="string"==typeof v?v:null,g=document.querySelector('[data-element-id="'.concat(p,'"]'));!g||h.has(g)?a.push({id:p,exportValue:y,domElement:g}):(0,i.warn)("_getElementsByName - element not allowed: ".concat(p))}}}catch(t){c.e(t)}finally{c.f()}}return a}var _,m=_createForOfIteratorHelper(document.getElementsByName(t));try{for(m.s();!(_=m.n()).done;){var b=_.value,A=b.id,k=b.exportValue;A!==r&&(h.has(b)&&a.push({id:A,exportValue:k,domElement:b}))}}catch(t){m.e(t)}finally{m.f()}return a}}],[{key:"platform",get:function get(){var t="undefined"!=typeof navigator?navigator.platform:"";return(0,i.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}}]);return AnnotationElement}(),y=function(t){_inherits(LinkAnnotationElement,t);var r=_createSuper(LinkAnnotationElement);function LinkAnnotationElement(t){var a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_classCallCheck(this,LinkAnnotationElement);(a=r.call(this,t,{isRenderable:!0,ignoreBorder:!(null==i||!i.ignoreBorder),createQuadrilaterals:!0})).isTooltipOnly=t.data.isTooltipOnly;return a}_createClass(LinkAnnotationElement,[{key:"render",value:function render(){var t=this.data,r=this.linkService,a=document.createElement("a");a.setAttribute("data-element-id",t.id);var i=!1;if(t.url){r.addLinkAttributes(a,t.url,t.newWindow);i=!0}else if(t.action){this._bindNamedAction(a,t.action);i=!0}else if(t.dest){this._bindLink(a,t.dest);i=!0}else{if(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions){this._bindJSAction(a,t);i=!0}if(t.resetForm){this._bindResetFormAction(a,t.resetForm);i=!0}else if(this.isTooltipOnly&&!i){this._bindLink(a,"");i=!0}}if(this.quadrilaterals)return this._renderQuadrilaterals("linkAnnotation").map((function(t,r){var i=0===r?a:a.cloneNode();t.append(i);return t}));this.container.className="linkAnnotation";i&&this.container.append(a);return this.container}},{key:"_bindLink",value:function _bindLink(t,r){var a=this;t.href=this.linkService.getDestinationHash(r);t.onclick=function(){r&&a.linkService.goToDestination(r);return!1};(r||""===r)&&(t.className="internalLink")}},{key:"_bindNamedAction",value:function _bindNamedAction(t,r){var a=this;t.href=this.linkService.getAnchorUrl("");t.onclick=function(){a.linkService.executeNamedAction(r);return!1};t.className="internalLink"}},{key:"_bindJSAction",value:function _bindJSAction(t,r){var a=this;t.href=this.linkService.getAnchorUrl("");for(var i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]),o=function _loop(){var o=c[l],u=i.get(o);if(!u)return"continue";t[u]=function(){var t;null===(t=a.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:a,detail:{id:r.id,name:o}});return!1}},l=0,c=Object.keys(r.actions);l<c.length;l++)o();t.onclick||(t.onclick=function(){return!1});t.className="internalLink"}},{key:"_bindResetFormAction",value:function _bindResetFormAction(t,r){var a=this,o=t.onclick;o||(t.href=this.linkService.getAnchorUrl(""));t.className="internalLink";if(this._fieldObjects)t.onclick=function(){o&&o();var t=r.fields,l=r.refs,c=r.include,u=[];if(0!==t.length||0!==l.length){var d,p=new Set(l),v=_createForOfIteratorHelper(t);try{for(v.s();!(d=v.n()).done;){var y,g=d.value,_=_createForOfIteratorHelper(a._fieldObjects[g]||[]);try{for(_.s();!(y=_.n()).done;){var m=y.value.id;p.add(m)}}catch(t){_.e(t)}finally{_.f()}}}catch(t){v.e(t)}finally{v.f()}for(var b=0,A=Object.values(a._fieldObjects);b<A.length;b++){var k,P=_createForOfIteratorHelper(A[b]);try{for(P.s();!(k=P.n()).done;){var S=k.value;p.has(S.id)===c&&u.push(S)}}catch(t){P.e(t)}finally{P.f()}}}else for(var w=0,x=Object.values(a._fieldObjects);w<x.length;w++){var C=x[w];u.push.apply(u,_toConsumableArray(C))}for(var T=a.annotationStorage,E=[],I=0,O=u;I<O.length;I++){var M=O[I],R=M.id;E.push(R);switch(M.type){case"text":var D=M.defaultValue||"";T.setValue(R,{value:D});break;case"checkbox":case"radiobutton":var L=M.defaultValue===M.exportValues;T.setValue(R,{value:L});break;case"combobox":case"listbox":var G=M.defaultValue||"";T.setValue(R,{value:G});break;default:continue}var j=document.querySelector('[data-element-id="'.concat(R,'"]'));j&&(h.has(j)?j.dispatchEvent(new Event("resetform")):(0,i.warn)("_bindResetFormAction - element not allowed: ".concat(R)))}if(a.enableScripting){var N;null===(N=a.linkService.eventBus)||void 0===N||N.dispatch("dispatcheventinsandbox",{source:a,detail:{id:"app",ids:E,name:"ResetForm"}})}return!1};else{(0,i.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.');o||(t.onclick=function(){return!1})}}}]);return LinkAnnotationElement}(v),g=function(t){_inherits(TextAnnotationElement,t);var r=_createSuper(TextAnnotationElement);function TextAnnotationElement(t){var a,i,o;_classCallCheck(this,TextAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l})}_createClass(TextAnnotationElement,[{key:"render",value:function render(){this.container.className="textAnnotation";var t=document.createElement("img");t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg";t.alt="[{{type}} Annotation]";t.dataset.l10nId="text_annotation_type";t.dataset.l10nArgs=JSON.stringify({type:this.data.name});this.data.hasPopup||this._createPopup(t,this.data);this.container.append(t);return this.container}}]);return TextAnnotationElement}(v),_=function(t){_inherits(WidgetAnnotationElement,t);var r=_createSuper(WidgetAnnotationElement);function WidgetAnnotationElement(){_classCallCheck(this,WidgetAnnotationElement);return r.apply(this,arguments)}_createClass(WidgetAnnotationElement,[{key:"render",value:function render(){this.data.alternativeText&&(this.container.title=this.data.alternativeText);return this.container}},{key:"_getKeyModifier",value:function _getKeyModifier(t){var r=v.platform,a=r.isWin,i=r.isMac;return a&&t.ctrlKey||i&&t.metaKey}},{key:"_setEventListener",value:function _setEventListener(t,r,a,i){var o=this;r.includes("mouse")?t.addEventListener(r,(function(t){var r;null===(r=o.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:o,detail:{id:o.data.id,name:a,value:i(t),shift:t.shiftKey,modifier:o._getKeyModifier(t)}})})):t.addEventListener(r,(function(t){var r;null===(r=o.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:o,detail:{id:o.data.id,name:a,value:i(t)}})}))}},{key:"_setEventListeners",value:function _setEventListeners(t,r,a){var i,o=_createForOfIteratorHelper(r);try{for(o.s();!(i=o.n()).done;){var l,c=_slicedToArray(i.value,2),u=c[0],d=c[1];("Action"===d||null!==(l=this.data.actions)&&void 0!==l&&l[d])&&this._setEventListener(t,u,d,a)}}catch(t){o.e(t)}finally{o.f()}}},{key:"_setBackgroundColor",value:function _setBackgroundColor(t){var r=this.data.backgroundColor||null;t.style.backgroundColor=null===r?"transparent":i.Util.makeHexColor(r[0],r[1],r[2])}},{key:"_setTextStyle",value:function _setTextStyle(t){var r,a=this.data.defaultAppearanceData.fontColor,o=this.data.defaultAppearanceData.fontSize||9,l=t.style;if(this.data.multiLine){var c=Math.abs(this.data.rect[3]-this.data.rect[1]),u=c/(Math.round(c/(i.LINE_FACTOR*o))||1);r=Math.min(o,Math.round(u/i.LINE_FACTOR))}else{var d=Math.abs(this.data.rect[3]-this.data.rect[1]);r=Math.min(o,Math.round(d/i.LINE_FACTOR))}l.fontSize="calc(".concat(r,"px * var(--scale-factor))");l.color=i.Util.makeHexColor(a[0],a[1],a[2]);null!==this.data.textAlignment&&(l.textAlign=["left","center","right"][this.data.textAlignment])}},{key:"_setRequired",value:function _setRequired(t,r){r?t.setAttribute("required",!0):t.removeAttribute("required");t.setAttribute("aria-required",r)}}]);return WidgetAnnotationElement}(v),m=function(t){_inherits(TextWidgetAnnotationElement,t);var r=_createSuper(TextWidgetAnnotationElement);function TextWidgetAnnotationElement(t){_classCallCheck(this,TextWidgetAnnotationElement);var a=t.renderForms||!t.data.hasAppearance&&!!t.data.fieldValue;return r.call(this,t,{isRenderable:a})}_createClass(TextWidgetAnnotationElement,[{key:"setPropertyOnSiblings",value:function setPropertyOnSiblings(t,r,a,i){var o,l=this.annotationStorage,c=_createForOfIteratorHelper(this._getElementsByName(t.name,t.id));try{for(c.s();!(o=c.n()).done;){var u=o.value;u.domElement&&(u.domElement[r]=a);l.setValue(u.id,_defineProperty({},i,a))}}catch(t){c.e(t)}finally{c.f()}}},{key:"render",value:function render(){var t=this,r=this.annotationStorage,a=this.data.id;this.container.className="textWidgetAnnotation";var i=null;if(this.renderForms){var o=r.getValue(a,{value:this.data.fieldValue}),l=o.formattedValue||o.value||"",c={userValue:l,formattedValue:null,valueOnFocus:""};if(this.data.multiLine){(i=document.createElement("textarea")).textContent=l;this.data.doNotScroll&&(i.style.overflowY="hidden")}else{(i=document.createElement("input")).type="text";i.setAttribute("value",l);this.data.doNotScroll&&(i.style.overflowX="hidden")}h.add(i);i.setAttribute("data-element-id",a);i.disabled=this.data.readOnly;i.name=this.data.fieldName;i.tabIndex=d;this._setRequired(i,this.data.required);i.addEventListener("input",(function(o){r.setValue(a,{value:o.target.value});t.setPropertyOnSiblings(i,"value",o.target.value,"value")}));i.addEventListener("resetform",(function(r){var a,o=null!==(a=t.data.defaultFieldValue)&&void 0!==a?a:"";i.value=c.userValue=o;c.formattedValue=null}));var u=function blurListener(t){var r=c.formattedValue;null!=r&&(t.target.value=r);t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var p;i.addEventListener("focus",(function(t){c.userValue&&(t.target.value=c.userValue);c.valueOnFocus=t.target.value}));i.addEventListener("updatefromsandbox",(function(i){var o={value:function value(t){var i;c.userValue=null!==(i=t.detail.value)&&void 0!==i?i:"";r.setValue(a,{value:c.userValue.toString()});t.target.value=c.userValue},formattedValue:function formattedValue(t){var formattedValue=t.detail.formattedValue;c.formattedValue=formattedValue;null!=formattedValue&&t.target!==document.activeElement&&(t.target.value=formattedValue);r.setValue(a,{formattedValue:formattedValue})},selRange:function selRange(t){var r;(r=t.target).setSelectionRange.apply(r,_toConsumableArray(t.detail.selRange))}};t._dispatchEventFromSandbox(o,i)}));i.addEventListener("keydown",(function(r){var i,o=-1;"Escape"===r.key?o=0:"Enter"===r.key?o=2:"Tab"===r.key&&(o=3);if(-1!==o){var l=r.target.value;if(c.valueOnFocus!==l){c.userValue=l;null===(i=t.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:l,willCommit:!0,commitKey:o,selStart:r.target.selectionStart,selEnd:r.target.selectionEnd}})}}}));var v=u;u=null;i.addEventListener("blur",(function(r){var i=r.target.value;c.userValue=i;if(t._mouseState.isDown&&c.valueOnFocus!==i){var o;null===(o=t.linkService.eventBus)||void 0===o||o.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:i,willCommit:!0,commitKey:1,selStart:r.target.selectionStart,selEnd:r.target.selectionEnd}})}v(r)}));null!==(p=this.data.actions)&&void 0!==p&&p.Keystroke&&i.addEventListener("beforeinput",(function(r){var i,o=r.data,l=r.target,c=l.value,u=l.selectionStart,d=l.selectionEnd,h=u,p=d;switch(r.inputType){case"deleteWordBackward":var v=c.substring(0,u).match(/\w*[^\w]*$/);v&&(h-=v[0].length);break;case"deleteWordForward":var y=c.substring(u).match(/^[^\w]*\w*/);y&&(p+=y[0].length);break;case"deleteContentBackward":u===d&&(h-=1);break;case"deleteContentForward":u===d&&(p+=1)}r.preventDefault();null===(i=t.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:c,change:o||"",willCommit:!1,selStart:h,selEnd:p}})}));this._setEventListeners(i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(t){return t.target.value}))}u&&i.addEventListener("blur",u);null!==this.data.maxLen&&(i.maxLength=this.data.maxLen);if(this.data.comb){var y=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;i.classList.add("comb");i.style.letterSpacing="calc(".concat(y,"px * var(--scale-factor) - 1ch)")}}else{(i=document.createElement("div")).textContent=this.data.fieldValue;i.style.verticalAlign="middle";i.style.display="table-cell"}this._setTextStyle(i);this._setBackgroundColor(i);this._setDefaultPropertiesFromJS(i);this.container.append(i);return this.container}}]);return TextWidgetAnnotationElement}(_),b=function(t){_inherits(CheckboxWidgetAnnotationElement,t);var r=_createSuper(CheckboxWidgetAnnotationElement);function CheckboxWidgetAnnotationElement(t){_classCallCheck(this,CheckboxWidgetAnnotationElement);return r.call(this,t,{isRenderable:t.renderForms})}_createClass(CheckboxWidgetAnnotationElement,[{key:"render",value:function render(){var t=this,r=this.annotationStorage,a=this.data,i=a.id,o=r.getValue(i,{value:a.exportValue===a.fieldValue}).value;if("string"==typeof o){o="Off"!==o;r.setValue(i,{value:o})}this.container.className="buttonWidgetAnnotation checkBox";var l=document.createElement("input");h.add(l);l.setAttribute("data-element-id",i);l.disabled=a.readOnly;this._setRequired(l,this.data.required);l.type="checkbox";l.name=a.fieldName;o&&l.setAttribute("checked",!0);l.setAttribute("exportValue",a.exportValue);l.tabIndex=d;l.addEventListener("change",(function(o){var l,c=o.target,u=c.name,d=c.checked,h=_createForOfIteratorHelper(t._getElementsByName(u,i));try{for(h.s();!(l=h.n()).done;){var p=l.value,v=d&&p.exportValue===a.exportValue;p.domElement&&(p.domElement.checked=v);r.setValue(p.id,{value:v})}}catch(t){h.e(t)}finally{h.f()}r.setValue(i,{value:d})}));l.addEventListener("resetform",(function(t){var r=a.defaultFieldValue||"Off";t.target.checked=r===a.exportValue}));if(this.enableScripting&&this.hasJSActions){l.addEventListener("updatefromsandbox",(function(a){var o={value:function value(t){t.target.checked="Off"!==t.detail.value;r.setValue(i,{value:t.target.checked})}};t._dispatchEventFromSandbox(o,a)}));this._setEventListeners(l,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(t){return t.target.checked}))}this._setBackgroundColor(l);this._setDefaultPropertiesFromJS(l);this.container.append(l);return this.container}}]);return CheckboxWidgetAnnotationElement}(_),A=function(t){_inherits(RadioButtonWidgetAnnotationElement,t);var r=_createSuper(RadioButtonWidgetAnnotationElement);function RadioButtonWidgetAnnotationElement(t){_classCallCheck(this,RadioButtonWidgetAnnotationElement);return r.call(this,t,{isRenderable:t.renderForms})}_createClass(RadioButtonWidgetAnnotationElement,[{key:"render",value:function render(){var t=this;this.container.className="buttonWidgetAnnotation radioButton";var r=this.annotationStorage,a=this.data,i=a.id,o=r.getValue(i,{value:a.fieldValue===a.buttonValue}).value;if("string"==typeof o){o=o!==a.buttonValue;r.setValue(i,{value:o})}var l=document.createElement("input");h.add(l);l.setAttribute("data-element-id",i);l.disabled=a.readOnly;this._setRequired(l,this.data.required);l.type="radio";l.name=a.fieldName;o&&l.setAttribute("checked",!0);l.tabIndex=d;l.addEventListener("change",(function(a){var o,l=a.target,c=l.name,u=l.checked,d=_createForOfIteratorHelper(t._getElementsByName(c,i));try{for(d.s();!(o=d.n()).done;){var h=o.value;r.setValue(h.id,{value:!1})}}catch(t){d.e(t)}finally{d.f()}r.setValue(i,{value:u})}));l.addEventListener("resetform",(function(t){var r=a.defaultFieldValue;t.target.checked=null!=r&&r===a.buttonValue}));if(this.enableScripting&&this.hasJSActions){var c=a.buttonValue;l.addEventListener("updatefromsandbox",(function(a){var o={value:function value(a){var o,l=c===a.detail.value,u=_createForOfIteratorHelper(t._getElementsByName(a.target.name));try{for(u.s();!(o=u.n()).done;){var d=o.value,h=l&&d.id===i;d.domElement&&(d.domElement.checked=h);r.setValue(d.id,{value:h})}}catch(t){u.e(t)}finally{u.f()}}};t._dispatchEventFromSandbox(o,a)}));this._setEventListeners(l,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(t){return t.target.checked}))}this._setBackgroundColor(l);this._setDefaultPropertiesFromJS(l);this.container.append(l);return this.container}}]);return RadioButtonWidgetAnnotationElement}(_),k=function(t){_inherits(PushButtonWidgetAnnotationElement,t);var r=_createSuper(PushButtonWidgetAnnotationElement);function PushButtonWidgetAnnotationElement(t){_classCallCheck(this,PushButtonWidgetAnnotationElement);return r.call(this,t,{ignoreBorder:t.data.hasAppearance})}_createClass(PushButtonWidgetAnnotationElement,[{key:"render",value:function render(){var t=this,r=_get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype),"render",this).call(this);r.className="buttonWidgetAnnotation pushButton";this.data.alternativeText&&(r.title=this.data.alternativeText);var a=r.lastChild;if(this.enableScripting&&this.hasJSActions&&a){this._setDefaultPropertiesFromJS(a);a.addEventListener("updatefromsandbox",(function(r){t._dispatchEventFromSandbox({},r)}))}return r}}]);return PushButtonWidgetAnnotationElement}(y),P=function(t){_inherits(ChoiceWidgetAnnotationElement,t);var r=_createSuper(ChoiceWidgetAnnotationElement);function ChoiceWidgetAnnotationElement(t){_classCallCheck(this,ChoiceWidgetAnnotationElement);return r.call(this,t,{isRenderable:t.renderForms})}_createClass(ChoiceWidgetAnnotationElement,[{key:"render",value:function render(){var t=this;this.container.className="choiceWidgetAnnotation";var r=this.annotationStorage,a=this.data.id,i=r.getValue(a,{value:this.data.fieldValue}),o=document.createElement("select");h.add(o);o.setAttribute("data-element-id",a);o.disabled=this.data.readOnly;this._setRequired(o,this.data.required);o.name=this.data.fieldName;o.tabIndex=d;var l=this.data.combo&&this.data.options.length>0;if(!this.data.combo){o.size=this.data.options.length;this.data.multiSelect&&(o.multiple=!0)}o.addEventListener("resetform",(function(r){var a,i=t.data.defaultFieldValue,l=_createForOfIteratorHelper(o.options);try{for(l.s();!(a=l.n()).done;){var c=a.value;c.selected=c.value===i}}catch(t){l.e(t)}finally{l.f()}}));var c,u=_createForOfIteratorHelper(this.data.options);try{for(u.s();!(c=u.n()).done;){var p=c.value,v=document.createElement("option");v.textContent=p.displayValue;v.value=p.exportValue;if(i.value.includes(p.exportValue)){v.setAttribute("selected",!0);l=!1}o.append(v)}}catch(t){u.e(t)}finally{u.f()}var y=null;if(l){var g=document.createElement("option");g.value=" ";g.setAttribute("hidden",!0);g.setAttribute("selected",!0);o.prepend(g);y=function removeEmptyEntry(){g.remove();o.removeEventListener("input",y);y=null};o.addEventListener("input",y)}var _=function getValue(t,r){var a=r?"value":"textContent",i=t.target.options;return t.target.multiple?Array.prototype.filter.call(i,(function(t){return t.selected})).map((function(t){return t[a]})):-1===i.selectedIndex?null:i[i.selectedIndex][a]},m=function getItems(t){var r=t.target.options;return Array.prototype.map.call(r,(function(t){return{displayValue:t.textContent,exportValue:t.value}}))};if(this.enableScripting&&this.hasJSActions){o.addEventListener("updatefromsandbox",(function(i){var l={value:function value(t){var i;null===(i=y)||void 0===i||i();var l,value=t.detail.value,c=new Set(Array.isArray(value)?value:[value]),u=_createForOfIteratorHelper(o.options);try{for(u.s();!(l=u.n()).done;){var d=l.value;d.selected=c.has(d.value)}}catch(t){u.e(t)}finally{u.f()}r.setValue(a,{value:_(t,!0)})},multipleSelection:function multipleSelection(t){o.multiple=!0},remove:function remove(t){var i=o.options,l=t.detail.remove;i[l].selected=!1;o.remove(l);if(i.length>0){var c=Array.prototype.findIndex.call(i,(function(t){return t.selected}));-1===c&&(i[0].selected=!0)}r.setValue(a,{value:_(t,!0),items:m(t)})},clear:function clear(t){for(;0!==o.length;)o.remove(0);r.setValue(a,{value:null,items:[]})},insert:function insert(t){var i=t.detail.insert,l=i.index,c=i.displayValue,u=i.exportValue,d=o.children[l],h=document.createElement("option");h.textContent=c;h.value=u;d?d.before(h):o.append(h);r.setValue(a,{value:_(t,!0),items:m(t)})},items:function items(t){for(var items=t.detail.items;0!==o.length;)o.remove(0);var i,l=_createForOfIteratorHelper(items);try{for(l.s();!(i=l.n()).done;){var c=i.value,u=c.displayValue,d=c.exportValue,h=document.createElement("option");h.textContent=u;h.value=d;o.append(h)}}catch(t){l.e(t)}finally{l.f()}o.options.length>0&&(o.options[0].selected=!0);r.setValue(a,{value:_(t,!0),items:m(t)})},indices:function indices(t){var i,indices=new Set(t.detail.indices),o=_createForOfIteratorHelper(t.target.options);try{for(o.s();!(i=o.n()).done;){var l=i.value;l.selected=indices.has(l.index)}}catch(t){o.e(t)}finally{o.f()}r.setValue(a,{value:_(t,!0)})},editable:function editable(t){t.target.disabled=!t.detail.editable}};t._dispatchEventFromSandbox(l,i)}));o.addEventListener("input",(function(i){var o,l=_(i,!0),c=_(i,!1);r.setValue(a,{value:l});null===(o=t.linkService.eventBus)||void 0===o||o.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:c,changeEx:l,willCommit:!0,commitKey:1,keyDown:!1}})}));this._setEventListeners(o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],(function(t){return t.target.checked}))}else o.addEventListener("input",(function(t){r.setValue(a,{value:_(t,!0)})}));this.data.combo&&this._setTextStyle(o);this._setBackgroundColor(o);this._setDefaultPropertiesFromJS(o);this.container.append(o);return this.container}}]);return ChoiceWidgetAnnotationElement}(_),S=function(t){_inherits(PopupAnnotationElement,t);var r=_createSuper(PopupAnnotationElement);function PopupAnnotationElement(t){var a,i,o;_classCallCheck(this,PopupAnnotationElement);var l=!!(null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l})}_createClass(PopupAnnotationElement,[{key:"render",value:function render(){this.container.className="popupAnnotation";if(["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;var t='[data-annotation-id="'.concat(this.data.parentId,'"]'),r=this.layer.querySelectorAll(t);if(0===r.length)return this.container;var a=new w({container:this.container,trigger:Array.from(r),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),o=this.page,l=i.Util.normalizeRect([this.data.parentRect[0],o.view[3]-this.data.parentRect[1]+o.view[1],this.data.parentRect[2],o.view[3]-this.data.parentRect[3]+o.view[1]]),c=l[0]+this.data.parentRect[2]-this.data.parentRect[0],u=l[1],d=_slicedToArray(this.viewport.viewBox,4),h=d[0],p=d[1],v=d[2]-h,y=d[3]-p;this.container.style.left="".concat(100*(c-h)/v,"%");this.container.style.top="".concat(100*(u-p)/y,"%");this.container.append(a.render());return this.container}}]);return PopupAnnotationElement}(v),w=function(){function PopupElement(t){_classCallCheck(this,PopupElement);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}_createClass(PopupElement,[{key:"render",value:function render(){var t,r,a=document.createElement("div");a.className="popupWrapper";this.hideElement=this.hideWrapper?a:this.container;this.hideElement.hidden=!0;var l=document.createElement("div");l.className="popup";var c=this.color;if(c){var d=.7*(255-c[0])+c[0],h=.7*(255-c[1])+c[1],p=.7*(255-c[2])+c[2];l.style.backgroundColor=i.Util.makeHexColor(0|d,0|h,0|p)}var v=document.createElement("h1");v.dir=this.titleObj.dir;v.textContent=this.titleObj.str;l.append(v);var y=o.PDFDateString.toDateObject(this.modificationDate);if(y){var g=document.createElement("span");g.className="popupDate";g.textContent="{{date}}, {{time}}";g.dataset.l10nId="annotation_date_string";g.dataset.l10nArgs=JSON.stringify({date:y.toLocaleDateString(),time:y.toLocaleTimeString()});l.append(g)}if(null===(t=this.richText)||void 0===t||!t.str||null!==(r=this.contentsObj)&&void 0!==r&&r.str&&this.contentsObj.str!==this.richText.str){var _=this._formatContents(this.contentsObj);l.append(_)}else{u.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:l});l.lastChild.className="richText popupContent"}Array.isArray(this.trigger)||(this.trigger=[this.trigger]);var m,b=_createForOfIteratorHelper(this.trigger);try{for(b.s();!(m=b.n()).done;){var A=m.value;A.addEventListener("click",this._toggle.bind(this));A.addEventListener("mouseover",this._show.bind(this,!1));A.addEventListener("mouseout",this._hide.bind(this,!1))}}catch(t){b.e(t)}finally{b.f()}l.addEventListener("click",this._hide.bind(this,!0));a.append(l);return a}},{key:"_formatContents",value:function _formatContents(t){var r=t.str,a=t.dir,i=document.createElement("p");i.className="popupContent";i.dir=a;for(var o=r.split(/(?:\r\n?|\n)/),l=0,c=o.length;l<c;++l){var u=o[l];i.append(document.createTextNode(u));l<c-1&&i.append(document.createElement("br"))}return i}},{key:"_toggle",value:function _toggle(){this.pinned?this._hide(!0):this._show(!0)}},{key:"_show",value:function _show(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&(this.pinned=!0);if(this.hideElement.hidden){this.hideElement.hidden=!1;this.container.style.zIndex+=1}}},{key:"_hide",value:function _hide(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t&&(this.pinned=!1);if(!this.hideElement.hidden&&!this.pinned){this.hideElement.hidden=!0;this.container.style.zIndex-=1}}}]);return PopupElement}(),x=function(t){_inherits(FreeTextAnnotationElement,t);var r=_createSuper(FreeTextAnnotationElement);function FreeTextAnnotationElement(t){var a,i,o;_classCallCheck(this,FreeTextAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0})}_createClass(FreeTextAnnotationElement,[{key:"render",value:function render(){this.container.className="freeTextAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}]);return FreeTextAnnotationElement}(v),C=function(t){_inherits(LineAnnotationElement,t);var r=_createSuper(LineAnnotationElement);function LineAnnotationElement(t){var a,i,o;_classCallCheck(this,LineAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0})}_createClass(LineAnnotationElement,[{key:"render",value:function render(){this.container.className="lineAnnotation";var t=this.data,r=getRectDims(t.rect),a=r.width,i=r.height,o=this.svgFactory.create(a,i,!0),l=this.svgFactory.createElement("svg:line");l.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]);l.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]);l.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]);l.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]);l.setAttribute("stroke-width",t.borderStyle.width||1);l.setAttribute("stroke","transparent");l.setAttribute("fill","transparent");o.append(l);this.container.append(o);this._createPopup(l,t);return this.container}}]);return LineAnnotationElement}(v),T=function(t){_inherits(SquareAnnotationElement,t);var r=_createSuper(SquareAnnotationElement);function SquareAnnotationElement(t){var a,i,o;_classCallCheck(this,SquareAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0})}_createClass(SquareAnnotationElement,[{key:"render",value:function render(){this.container.className="squareAnnotation";var t=this.data,r=getRectDims(t.rect),a=r.width,i=r.height,o=this.svgFactory.create(a,i,!0),l=t.borderStyle.width,c=this.svgFactory.createElement("svg:rect");c.setAttribute("x",l/2);c.setAttribute("y",l/2);c.setAttribute("width",a-l);c.setAttribute("height",i-l);c.setAttribute("stroke-width",l||1);c.setAttribute("stroke","transparent");c.setAttribute("fill","transparent");o.append(c);this.container.append(o);this._createPopup(c,t);return this.container}}]);return SquareAnnotationElement}(v),E=function(t){_inherits(CircleAnnotationElement,t);var r=_createSuper(CircleAnnotationElement);function CircleAnnotationElement(t){var a,i,o;_classCallCheck(this,CircleAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0})}_createClass(CircleAnnotationElement,[{key:"render",value:function render(){this.container.className="circleAnnotation";var t=this.data,r=getRectDims(t.rect),a=r.width,i=r.height,o=this.svgFactory.create(a,i,!0),l=t.borderStyle.width,c=this.svgFactory.createElement("svg:ellipse");c.setAttribute("cx",a/2);c.setAttribute("cy",i/2);c.setAttribute("rx",a/2-l/2);c.setAttribute("ry",i/2-l/2);c.setAttribute("stroke-width",l||1);c.setAttribute("stroke","transparent");c.setAttribute("fill","transparent");o.append(c);this.container.append(o);this._createPopup(c,t);return this.container}}]);return CircleAnnotationElement}(v),I=function(t){_inherits(PolylineAnnotationElement,t);var r=_createSuper(PolylineAnnotationElement);function PolylineAnnotationElement(t){var a,i,o,l;_classCallCheck(this,PolylineAnnotationElement);var c=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);(l=r.call(this,t,{isRenderable:c,ignoreBorder:!0})).containerClassName="polylineAnnotation";l.svgElementName="svg:polyline";return l}_createClass(PolylineAnnotationElement,[{key:"render",value:function render(){this.container.className=this.containerClassName;var t,r=this.data,a=getRectDims(r.rect),i=a.width,o=a.height,l=this.svgFactory.create(i,o,!0),c=[],u=_createForOfIteratorHelper(r.vertices);try{for(u.s();!(t=u.n()).done;){var d=t.value,h=d.x-r.rect[0],p=r.rect[3]-d.y;c.push(h+","+p)}}catch(t){u.e(t)}finally{u.f()}c=c.join(" ");var v=this.svgFactory.createElement(this.svgElementName);v.setAttribute("points",c);v.setAttribute("stroke-width",r.borderStyle.width||1);v.setAttribute("stroke","transparent");v.setAttribute("fill","transparent");l.append(v);this.container.append(l);this._createPopup(v,r);return this.container}}]);return PolylineAnnotationElement}(v),O=function(t){_inherits(PolygonAnnotationElement,t);var r=_createSuper(PolygonAnnotationElement);function PolygonAnnotationElement(t){var a;_classCallCheck(this,PolygonAnnotationElement);(a=r.call(this,t)).containerClassName="polygonAnnotation";a.svgElementName="svg:polygon";return a}return _createClass(PolygonAnnotationElement)}(I),M=function(t){_inherits(CaretAnnotationElement,t);var r=_createSuper(CaretAnnotationElement);function CaretAnnotationElement(t){var a,i,o;_classCallCheck(this,CaretAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0})}_createClass(CaretAnnotationElement,[{key:"render",value:function render(){this.container.className="caretAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}]);return CaretAnnotationElement}(v),R=function(t){_inherits(InkAnnotationElement,t);var r=_createSuper(InkAnnotationElement);function InkAnnotationElement(t){var a,i,o,l;_classCallCheck(this,InkAnnotationElement);var c=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);(l=r.call(this,t,{isRenderable:c,ignoreBorder:!0})).containerClassName="inkAnnotation";l.svgElementName="svg:polyline";return l}_createClass(InkAnnotationElement,[{key:"render",value:function render(){this.container.className=this.containerClassName;var t,r=this.data,a=getRectDims(r.rect),i=a.width,o=a.height,l=this.svgFactory.create(i,o,!0),c=_createForOfIteratorHelper(r.inkLists);try{for(c.s();!(t=c.n()).done;){var u,d=t.value,h=[],p=_createForOfIteratorHelper(d);try{for(p.s();!(u=p.n()).done;){var v=u.value,y=v.x-r.rect[0],g=r.rect[3]-v.y;h.push("".concat(y,",").concat(g))}}catch(t){p.e(t)}finally{p.f()}h=h.join(" ");var _=this.svgFactory.createElement(this.svgElementName);_.setAttribute("points",h);_.setAttribute("stroke-width",r.borderStyle.width||1);_.setAttribute("stroke","transparent");_.setAttribute("fill","transparent");this._createPopup(_,r);l.append(_)}}catch(t){c.e(t)}finally{c.f()}this.container.append(l);return this.container}}]);return InkAnnotationElement}(v),D=function(t){_inherits(HighlightAnnotationElement,t);var r=_createSuper(HighlightAnnotationElement);function HighlightAnnotationElement(t){var a,i,o;_classCallCheck(this,HighlightAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(HighlightAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("highlightAnnotation");this.container.className="highlightAnnotation";return this.container}}]);return HighlightAnnotationElement}(v),L=function(t){_inherits(UnderlineAnnotationElement,t);var r=_createSuper(UnderlineAnnotationElement);function UnderlineAnnotationElement(t){var a,i,o;_classCallCheck(this,UnderlineAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(UnderlineAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("underlineAnnotation");this.container.className="underlineAnnotation";return this.container}}]);return UnderlineAnnotationElement}(v),G=function(t){_inherits(SquigglyAnnotationElement,t);var r=_createSuper(SquigglyAnnotationElement);function SquigglyAnnotationElement(t){var a,i,o;_classCallCheck(this,SquigglyAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(SquigglyAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("squigglyAnnotation");this.container.className="squigglyAnnotation";return this.container}}]);return SquigglyAnnotationElement}(v),j=function(t){_inherits(StrikeOutAnnotationElement,t);var r=_createSuper(StrikeOutAnnotationElement);function StrikeOutAnnotationElement(t){var a,i,o;_classCallCheck(this,StrikeOutAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(StrikeOutAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("strikeoutAnnotation");this.container.className="strikeoutAnnotation";return this.container}}]);return StrikeOutAnnotationElement}(v),N=function(t){_inherits(StampAnnotationElement,t);var r=_createSuper(StampAnnotationElement);function StampAnnotationElement(t){var a,i,o;_classCallCheck(this,StampAnnotationElement);var l=!!(t.data.hasPopup||null!==(a=t.data.titleObj)&&void 0!==a&&a.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(o=t.data.richText)&&void 0!==o&&o.str);return r.call(this,t,{isRenderable:l,ignoreBorder:!0})}_createClass(StampAnnotationElement,[{key:"render",value:function render(){this.container.className="stampAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}]);return StampAnnotationElement}(v),B=function(t){_inherits(FileAttachmentAnnotationElement,t);var r=_createSuper(FileAttachmentAnnotationElement);function FileAttachmentAnnotationElement(t){var a,i;_classCallCheck(this,FileAttachmentAnnotationElement);var l=(i=r.call(this,t,{isRenderable:!0})).data.file,c=l.filename,u=l.content;i.filename=(0,o.getFilenameFromUrl)(c);i.content=u;null===(a=i.linkService.eventBus)||void 0===a||a.dispatch("fileattachmentannotation",{source:_assertThisInitialized(i),filename:c,content:u});return i}_createClass(FileAttachmentAnnotationElement,[{key:"render",value:function render(){var t,r;this.container.className="fileAttachmentAnnotation";var a=document.createElement("div");a.className="popupTriggerArea";a.addEventListener("dblclick",this._download.bind(this));!this.data.hasPopup&&(null!==(t=this.data.titleObj)&&void 0!==t&&t.str||null!==(r=this.data.contentsObj)&&void 0!==r&&r.str||this.data.richText)&&this._createPopup(a,this.data);this.container.append(a);return this.container}},{key:"_download",value:function _download(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.container,this.content,this.filename)}}]);return FileAttachmentAnnotationElement}(v),W=function(){function AnnotationLayer(){_classCallCheck(this,AnnotationLayer)}_createClass(AnnotationLayer,null,[{key:"render",value:function render(t){var r=t.annotations,a=t.div,c=t.viewport;_classStaticPrivateMethodGet(this,AnnotationLayer,_setDimensions).call(this,a,c);var u,d=[],h=[],v=_createForOfIteratorHelper(r);try{for(v.s();!(u=v.n()).done;){var y=u.value;if(y)if(y.annotationType!==i.AnnotationType.POPUP){var g=getRectDims(y.rect),_=g.width,m=g.height;_<=0||m<=0||d.push(y)}else h.push(y)}}catch(t){v.e(t)}finally{v.f()}h.length&&d.push.apply(d,h);for(var b=0,A=d;b<A.length;b++){var k=A[b],P=p.create({data:k,layer:a,page:t.page,viewport:c,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new o.DOMSVGFactory,annotationStorage:t.annotationStorage||new l.AnnotationStorage,enableScripting:t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,mouseState:t.mouseState||{isDown:!1}});if(P.isRenderable){var w=P.render();k.hidden&&(w.style.visibility="hidden");if(Array.isArray(w)){var x,C=_createForOfIteratorHelper(w);try{for(C.s();!(x=C.n()).done;){var T=x.value;a.append(T)}}catch(t){C.e(t)}finally{C.f()}}else P instanceof S?a.prepend(w):a.append(w)}}_classStaticPrivateMethodGet(this,AnnotationLayer,_setAnnotationCanvasMap).call(this,a,t.annotationCanvasMap)}},{key:"update",value:function update(t){var r=t.annotationCanvasMap,a=t.div,i=t.viewport;_classStaticPrivateMethodGet(this,AnnotationLayer,_setDimensions).call(this,a,i);_classStaticPrivateMethodGet(this,AnnotationLayer,_setAnnotationCanvasMap).call(this,a,r);a.hidden=!1}}]);return AnnotationLayer}();r.AnnotationLayer=W;function _setDimensions(t,r){var a=r.width,i=r.height,o=r.rotation,l=t.style,c=o%180!=0,u=Math.floor(a)+"px",d=Math.floor(i)+"px";l.width=c?d:u;l.height=c?u:d;t.setAttribute("data-main-rotation",o)}function _setAnnotationCanvasMap(t,r){if(r){var a,i=_createForOfIteratorHelper(r);try{for(i.s();!(a=i.n()).done;){var o=_slicedToArray(a.value,2),l=o[0],c=o[1],u=t.querySelector('[data-annotation-id="'.concat(l,'"]'));if(u){var d=u.firstChild;d?"CANVAS"===d.nodeName?d.replaceWith(c):d.before(c):u.append(c)}}}catch(t){i.e(t)}finally{i.f()}r.clear()}}},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.ColorConverters=void 0;function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function makeColorComp(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}var a=function(){function ColorConverters(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,ColorConverters)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(ColorConverters,null,[{key:"CMYK_G",value:function CMYK_G(t){var r=_slicedToArray(t,4),a=r[0],i=r[1],o=r[2],l=r[3];return["G",1-Math.min(1,.3*a+.59*o+.11*i+l)]}},{key:"G_CMYK",value:function G_CMYK(t){return["CMYK",0,0,0,1-_slicedToArray(t,1)[0]]}},{key:"G_RGB",value:function G_RGB(t){var r=_slicedToArray(t,1)[0];return["RGB",r,r,r]}},{key:"G_HTML",value:function G_HTML(t){var r=makeColorComp(_slicedToArray(t,1)[0]);return"#".concat(r).concat(r).concat(r)}},{key:"RGB_G",value:function RGB_G(t){var r=_slicedToArray(t,3);return["G",.3*r[0]+.59*r[1]+.11*r[2]]}},{key:"RGB_HTML",value:function RGB_HTML(t){var r=_slicedToArray(t,3),a=r[0],i=r[1],o=r[2],l=makeColorComp(a),c=makeColorComp(i),u=makeColorComp(o);return"#".concat(l).concat(c).concat(u)}},{key:"T_HTML",value:function T_HTML(){return"#00000000"}},{key:"CMYK_RGB",value:function CMYK_RGB(t){var r=_slicedToArray(t,4),a=r[0],i=r[1],o=r[2],l=r[3];return["RGB",1-Math.min(1,a+l),1-Math.min(1,o+l),1-Math.min(1,i+l)]}},{key:"CMYK_HTML",value:function CMYK_HTML(t){var r=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(r)}},{key:"RGB_CMYK",value:function RGB_CMYK(t){var r=_slicedToArray(t,3),a=1-r[0],i=1-r[1],o=1-r[2];return["CMYK",a,i,o,Math.min(a,i,o)]}}]);return ColorConverters}();r.ColorConverters=a},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.XfaLayer=void 0;var i=a(145);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=function(){function XfaLayer(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,XfaLayer)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(XfaLayer,null,[{key:"setupStorage",value:function setupStorage(t,r,a,i,o){var l=i.getValue(r,{value:null});switch(a.name){case"textarea":null!==l.value&&(t.textContent=l.value);if("print"===o)break;t.addEventListener("input",(function(t){i.setValue(r,{value:t.target.value})}));break;case"input":if("radio"===a.attributes.type||"checkbox"===a.attributes.type){l.value===a.attributes.xfaOn?t.setAttribute("checked",!0):l.value===a.attributes.xfaOff&&t.removeAttribute("checked");if("print"===o)break;t.addEventListener("change",(function(t){i.setValue(r,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})}))}else{null!==l.value&&t.setAttribute("value",l.value);if("print"===o)break;t.addEventListener("input",(function(t){i.setValue(r,{value:t.target.value})}))}break;case"select":if(null!==l.value){var c,u=_createForOfIteratorHelper(a.children);try{for(u.s();!(c=u.n()).done;){var d=c.value;d.attributes.value===l.value&&(d.attributes.selected=!0)}}catch(t){u.e(t)}finally{u.f()}}t.addEventListener("input",(function(t){var a=t.target.options,o=-1===a.selectedIndex?"":a[a.selectedIndex].value;i.setValue(r,{value:o})}))}}},{key:"setAttributes",value:function setAttributes(t){var r=t.html,a=t.element,i=t.storage,o=void 0===i?null:i,l=t.intent,c=t.linkService,u=a.attributes,d=r instanceof HTMLAnchorElement;"radio"===u.type&&(u.name="".concat(u.name,"-").concat(l));for(var h=0,p=Object.entries(u);h<p.length;h++){var v=_slicedToArray(p[h],2),y=v[0],g=v[1];if(null!=g)switch(y){case"class":g.length&&r.setAttribute(y,g.join(" "));break;case"dataId":break;case"id":r.setAttribute("data-element-id",g);break;case"style":Object.assign(r.style,g);break;case"textContent":r.textContent=g;break;default:(!d||"href"!==y&&"newWindow"!==y)&&r.setAttribute(y,g)}}d&&c.addLinkAttributes(r,u.href,u.newWindow);o&&u.dataId&&this.setupStorage(r,u.dataId,a,o)}},{key:"render",value:function render(t){var r=t.annotationStorage,a=t.linkService,o=t.xfaHtml,l=t.intent||"display",c=document.createElement(o.name);o.attributes&&this.setAttributes({html:c,element:o,intent:l,linkService:a});var u=[[o,-1,c]],d=t.div;d.append(c);if(t.viewport){var h="matrix(".concat(t.viewport.transform.join(","),")");d.style.transform=h}"richText"!==l&&d.setAttribute("class","xfaLayer xfaFont");for(var p=[];u.length>0;){var v,y=_slicedToArray(u.at(-1),3),g=y[0],_=y[1],m=y[2];if(_+1!==g.children.length){var b=g.children[++u.at(-1)[1]];if(null!==b){var A=b.name;if("#text"!==A){var k=void 0;k=null!=b&&null!==(v=b.attributes)&&void 0!==v&&v.xmlns?document.createElementNS(b.attributes.xmlns,A):document.createElement(A);m.append(k);b.attributes&&this.setAttributes({html:k,element:b,storage:r,intent:l,linkService:a});if(b.children&&b.children.length>0)u.push([b,-1,k]);else if(b.value){var P=document.createTextNode(b.value);i.XfaText.shouldBuildText(A)&&p.push(P);k.append(P)}}else{var S=document.createTextNode(b.value);p.push(S);m.append(S)}}}else u.pop()}var w,x=_createForOfIteratorHelper(d.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"));try{for(x.s();!(w=x.n()).done;){w.value.setAttribute("readOnly",!0)}}catch(t){x.e(t)}finally{x.f()}return{textDivs:p}}},{key:"update",value:function update(t){var r="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=r;t.div.hidden=!1}}]);return XfaLayer}();r.XfaLayer=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.TextLayerRenderTask=void 0;r.renderTextLayer=function renderTextLayer(t){var r=new d({textContent:t.textContent,textContentStream:t.textContentStream,container:t.container,viewport:t.viewport,textDivs:t.textDivs,textContentItemsStr:t.textContentItemsStr,enhanceTextSelection:t.enhanceTextSelection});r._render(t.timeout);return r};var i=a(1),o=a(129);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}var l=30,c=new Map,u=/^\s+$/g;function appendText(t,r,a,o){var d=document.createElement("span"),h=t._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:""!==r.str,hasEOL:r.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1,fontSize:0}:{angle:0,canvasWidth:0,hasText:""!==r.str,hasEOL:r.hasEOL,fontSize:0};t._textDivs.push(d);var p=i.Util.transform(t._viewport.transform,r.transform),v=Math.atan2(p[1],p[0]),y=a[r.fontName];y.vertical&&(v+=Math.PI/2);var g,_,m=Math.hypot(p[2],p[3]),b=m*function getAscent(t,r){var a=c.get(t);if(a)return a;r.save();r.font="".concat(l,"px ").concat(t);var i=r.measureText(""),o=i.fontBoundingBoxAscent,u=Math.abs(i.fontBoundingBoxDescent);if(o){r.restore();var d=o/(o+u);c.set(t,d);return d}r.strokeStyle="red";r.clearRect(0,0,l,l);r.strokeText("g",0,0);var h=r.getImageData(0,0,l,l).data;u=0;for(var p=h.length-1-3;p>=0;p-=4)if(h[p]>0){u=Math.ceil(p/4/l);break}r.clearRect(0,0,l,l);r.strokeText("A",0,l);o=0;for(var v=0,y=(h=r.getImageData(0,0,l,l).data).length;v<y;v+=4)if(h[v]>0){o=l-Math.floor(v/4/l);break}r.restore();if(o){var g=o/(o+u);c.set(t,g);return g}c.set(t,.8);return.8}(y.fontFamily,o);if(0===v){g=p[4];_=p[5]-b}else{g=p[4]+b*Math.sin(v);_=p[5]-b*Math.cos(v)}d.style.left="".concat(g,"px");d.style.top="".concat(_,"px");d.style.fontSize="".concat(m,"px");d.style.fontFamily=y.fontFamily;h.fontSize=m;d.setAttribute("role","presentation");d.textContent=r.str;d.dir=r.dir;t._fontInspectorEnabled&&(d.dataset.fontName=r.fontName);0!==v&&(h.angle=v*(180/Math.PI));var A=!1;if(r.str.length>1||t._enhanceTextSelection&&u.test(r.str))A=!0;else if(" "!==r.str&&r.transform[0]!==r.transform[3]){var k=Math.abs(r.transform[0]),P=Math.abs(r.transform[3]);k!==P&&Math.max(k,P)/Math.min(k,P)>1.5&&(A=!0)}A&&(y.vertical?h.canvasWidth=r.height*t._viewport.scale:h.canvasWidth=r.width*t._viewport.scale);t._textDivProperties.set(d,h);t._textContentStream&&t._layoutText(d);if(t._enhanceTextSelection&&h.hasText){var S=1,w=0;if(0!==v){S=Math.cos(v);w=Math.sin(v)}var x,C,T=(y.vertical?r.height:r.width)*t._viewport.scale,E=m;if(0!==v){x=[S,w,-w,S,g,_];C=i.Util.getAxialAlignedBoundingBox([0,0,T,E],x)}else C=[g,_,g+T,_+E];t._bounds.push({left:C[0],top:C[1],right:C[2],bottom:C[3],div:d,size:[T,E],m:x})}}function render(t){if(!t._canceled){var r=t._textDivs,a=t._capability,i=r.length;if(i>1e5){t._renderingDone=!0;a.resolve()}else{if(!t._textContentStream)for(var o=0;o<i;o++)t._layoutText(r[o]);t._renderingDone=!0;a.resolve()}}}function findPositiveMin(t,r,a){for(var i=0,o=0;o<a;o++){var l=t[r++];l>0&&(i=i?Math.min(l,i):l)}return i}function expand(t){for(var r=t._bounds,a=t._viewport,o=function expandBounds(t,r,a){var i=a.map((function(t,r){return{x1:t.left,y1:t.top,x2:t.right,y2:t.bottom,index:r,x1New:void 0,x2New:void 0}}));expandBoundsLTR(t,i);var o,l=new Array(a.length),c=_createForOfIteratorHelper(i);try{for(c.s();!(o=c.n()).done;){var u=o.value,d=u.index;l[d]={left:u.x1New,top:0,right:u.x2New,bottom:0}}}catch(t){c.e(t)}finally{c.f()}a.map((function(r,a){var o=l[a],c=i[a];c.x1=r.top;c.y1=t-o.right;c.x2=r.bottom;c.y2=t-o.left;c.index=a;c.x1New=void 0;c.x2New=void 0}));expandBoundsLTR(r,i);var h,p=_createForOfIteratorHelper(i);try{for(p.s();!(h=p.n()).done;){var v=h.value,y=v.index;l[y].top=v.x1New;l[y].bottom=v.x2New}}catch(t){p.e(t)}finally{p.f()}return l}(a.width,a.height,r),l=0;l<o.length;l++){var c=r[l].div,u=t._textDivProperties.get(c);if(0!==u.angle){for(var d=o[l],h=r[l],p=h.m,v=p[0],y=p[1],g=[[0,0],[0,h.size[1]],[h.size[0],0],h.size],_=new Float64Array(64),m=0,b=g.length;m<b;m++){var A=i.Util.applyTransform(g[m],p);_[m+0]=v&&(d.left-A[0])/v;_[m+4]=y&&(d.top-A[1])/y;_[m+8]=v&&(d.right-A[0])/v;_[m+12]=y&&(d.bottom-A[1])/y;_[m+16]=y&&(d.left-A[0])/-y;_[m+20]=v&&(d.top-A[1])/v;_[m+24]=y&&(d.right-A[0])/-y;_[m+28]=v&&(d.bottom-A[1])/v;_[m+32]=v&&(d.left-A[0])/-v;_[m+36]=y&&(d.top-A[1])/-y;_[m+40]=v&&(d.right-A[0])/-v;_[m+44]=y&&(d.bottom-A[1])/-y;_[m+48]=y&&(d.left-A[0])/y;_[m+52]=v&&(d.top-A[1])/-v;_[m+56]=y&&(d.right-A[0])/y;_[m+60]=v&&(d.bottom-A[1])/-v}var k=1+Math.min(Math.abs(v),Math.abs(y));u.paddingLeft=findPositiveMin(_,32,16)/k;u.paddingTop=findPositiveMin(_,48,16)/k;u.paddingRight=findPositiveMin(_,0,16)/k;u.paddingBottom=findPositiveMin(_,16,16)/k;t._textDivProperties.set(c,u)}else{u.paddingLeft=r[l].left-o[l].left;u.paddingTop=r[l].top-o[l].top;u.paddingRight=o[l].right-r[l].right;u.paddingBottom=o[l].bottom-r[l].bottom;t._textDivProperties.set(c,u)}}}function expandBoundsLTR(t,r){r.sort((function(t,r){return t.x1-r.x1||t.index-r.index}));var a,i=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}],o=_createForOfIteratorHelper(r);try{for(o.s();!(a=o.n()).done;){for(var l=a.value,c=0;c<i.length&&i[c].end<=l.y1;)c++;for(var u=i.length-1;u>=0&&i[u].start>=l.y2;)u--;var d=void 0,h=void 0,p=void 0,v=void 0,y=-1/0;for(p=c;p<=u;p++){h=(d=i[p]).boundary;var g=void 0;(g=h.x2>l.x1?h.index>l.index?h.x1New:l.x1:void 0===h.x2New?(h.x2+l.x1)/2:h.x2New)>y&&(y=g)}l.x1New=y;for(p=c;p<=u;p++)void 0===(h=(d=i[p]).boundary).x2New?h.x2>l.x1?h.index>l.index&&(h.x2New=h.x2):h.x2New=y:h.x2New>y&&(h.x2New=Math.max(y,h.x2));var _=[],m=null;for(p=c;p<=u;p++){var b=(h=(d=i[p]).boundary).x2>l.x2?h:l;if(m===b)_.at(-1).end=d.end;else{_.push({start:d.start,end:d.end,boundary:b});m=b}}if(i[c].start<l.y1){_[0].start=l.y1;_.unshift({start:i[c].start,end:l.y1,boundary:i[c].boundary})}if(l.y2<i[u].end){_.at(-1).end=l.y2;_.push({start:l.y2,end:i[u].end,boundary:i[u].boundary})}for(p=c;p<=u;p++)if(void 0===(h=(d=i[p]).boundary).x2New){var A=!1;for(v=c-1;!A&&v>=0&&i[v].start>=h.y1;v--)A=i[v].boundary===h;for(v=u+1;!A&&v<i.length&&i[v].end<=h.y2;v++)A=i[v].boundary===h;for(v=0;!A&&v<_.length;v++)A=_[v].boundary===h;A||(h.x2New=y)}Array.prototype.splice.apply(i,[c,u-c+1].concat(_))}}catch(t){o.e(t)}finally{o.f()}for(var k=0,P=i;k<P.length;k++){var S=P[k].boundary;void 0===S.x2New&&(S.x2New=Math.max(t,S.x2))}}var d=function(){function TextLayerRenderTask(t){var r,a=this,l=t.textContent,c=t.textContentStream,u=t.container,d=t.viewport,h=t.textDivs,p=t.textContentItemsStr,v=t.enhanceTextSelection;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,TextLayerRenderTask);v&&(0,o.deprecated)("The `enhanceTextSelection` functionality will be removed in the future.");this._textContent=l;this._textContentStream=c;this._container=u;this._document=u.ownerDocument;this._viewport=d;this._textDivs=h||[];this._textContentItemsStr=p||[];this._enhanceTextSelection=!!v;this._fontInspectorEnabled=!(null===(r=globalThis.FontInspector)||void 0===r||!r.enabled);this._reader=null;this._layoutTextLastFontSize=null;this._layoutTextLastFontFamily=null;this._layoutTextCtx=null;this._textDivProperties=new WeakMap;this._renderingDone=!1;this._canceled=!1;this._capability=(0,i.createPromiseCapability)();this._renderTimer=null;this._bounds=[];this._devicePixelRatio=globalThis.devicePixelRatio||1;this._capability.promise.finally((function(){a._enhanceTextSelection||(a._textDivProperties=null);if(a._layoutTextCtx){a._layoutTextCtx.canvas.width=0;a._layoutTextCtx.canvas.height=0;a._layoutTextCtx=null}})).catch((function(){}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}(TextLayerRenderTask,[{key:"promise",get:function get(){return this._capability.promise}},{key:"cancel",value:function cancel(){this._canceled=!0;if(this._reader){this._reader.cancel(new i.AbortException("TextLayer task cancelled.")).catch((function(){}));this._reader=null}if(null!==this._renderTimer){clearTimeout(this._renderTimer);this._renderTimer=null}this._capability.reject(new Error("TextLayer task cancelled."))}},{key:"_processItems",value:function _processItems(t,r){for(var a=0,i=t.length;a<i;a++)if(void 0!==t[a].str){this._textContentItemsStr.push(t[a].str);appendText(this,t[a],r,this._layoutTextCtx)}else if("beginMarkedContentProps"===t[a].type||"beginMarkedContent"===t[a].type){var o=this._container;this._container=document.createElement("span");this._container.classList.add("markedContent");null!==t[a].id&&this._container.setAttribute("id","".concat(t[a].id));o.append(this._container)}else"endMarkedContent"===t[a].type&&(this._container=this._container.parentNode)}},{key:"_layoutText",value:function _layoutText(t){var r=this._textDivProperties.get(t),a="";if(0!==r.canvasWidth&&r.hasText){var i=t.style.fontFamily,o=r.fontSize;if(o!==this._layoutTextLastFontSize||i!==this._layoutTextLastFontFamily){this._layoutTextCtx.font="".concat(o*this._devicePixelRatio,"px ").concat(i);this._layoutTextLastFontSize=o;this._layoutTextLastFontFamily=i}var l=this._layoutTextCtx.measureText(t.textContent).width;if(l>0){var c=this._devicePixelRatio*r.canvasWidth/l;this._enhanceTextSelection&&(r.scale=c);a="scaleX(".concat(c,")")}}0!==r.angle&&(a="rotate(".concat(r.angle,"deg) ").concat(a));if(a.length>0){this._enhanceTextSelection&&(r.originalTransform=a);t.style.transform=a}r.hasText&&this._container.append(t);if(r.hasEOL){var u=document.createElement("br");u.setAttribute("role","presentation");this._container.append(u)}}},{key:"_render",value:function _render(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,a=(0,i.createPromiseCapability)(),o=Object.create(null),c=this._document.createElement("canvas");c.height=c.width=l;this._layoutTextCtx=c.getContext("2d",{alpha:!1});if(this._textContent){var u=this._textContent.items,d=this._textContent.styles;this._processItems(u,d);a.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');var h=function pump(){t._reader.read().then((function(r){var i=r.value;if(r.done)a.resolve();else{Object.assign(o,i.styles);t._processItems(i.items,o);pump()}}),a.reject)};this._reader=this._textContentStream.getReader();h()}a.promise.then((function(){o=null;r?t._renderTimer=setTimeout((function(){render(t);t._renderTimer=null}),r):render(t)}),this._capability.reject)}},{key:"expandTextDivs",value:function expandTextDivs(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._enhanceTextSelection&&this._renderingDone){if(null!==this._bounds){expand(this);this._bounds=null}for(var r=[],a=[],i=0,o=this._textDivs.length;i<o;i++){var l=this._textDivs[i],c=this._textDivProperties.get(l);if(c.hasText)if(t){r.length=0;a.length=0;c.originalTransform&&r.push(c.originalTransform);if(c.paddingTop>0){a.push("".concat(c.paddingTop,"px"));r.push("translateY(".concat(-c.paddingTop,"px)"))}else a.push(0);c.paddingRight>0?a.push("".concat(c.paddingRight/c.scale,"px")):a.push(0);c.paddingBottom>0?a.push("".concat(c.paddingBottom,"px")):a.push(0);if(c.paddingLeft>0){a.push("".concat(c.paddingLeft/c.scale,"px"));r.push("translateX(".concat(-c.paddingLeft/c.scale,"px)"))}else a.push(0);l.style.padding=a.join(" ");r.length&&(l.style.transform=r.join(" "))}else{l.style.padding=null;l.style.transform=c.originalTransform}}}}}]);return TextLayerRenderTask}();r.TextLayerRenderTask=d},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.SVGGraphics=void 0;var i=a(129),o=a(1),l=a(3);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}var c=_createClass((function SVGGraphics(){_classCallCheck(this,SVGGraphics);(0,o.unreachable)("Not implemented: SVGGraphics")}));r.SVGGraphics=c;var u=function pf(t){if(Number.isInteger(t))return t.toString();var r=t.toFixed(10),a=r.length-1;if("0"!==r[a])return r;do{a--}while("0"===r[a]);return r.substring(0,"."===r[a]?a:a+1)},d=function pm(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":"scale(".concat(u(t[0])," ").concat(u(t[3]),")");if(t[0]===t[3]&&t[1]===-t[2]){var r=180*Math.acos(t[0])/Math.PI;return"rotate(".concat(u(r),")")}}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return"translate(".concat(u(t[4])," ").concat(u(t[5]),")");return"matrix(".concat(u(t[0])," ").concat(u(t[1])," ").concat(u(t[2])," ").concat(u(t[3])," ").concat(u(t[4])," ")+"".concat(u(t[5]),")")},h={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},p=["butt","round","square"],v=["miter","round","bevel"],y=function createObjectURL(t){var r=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([t],{type:r}));for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="data:".concat(r,";base64,"),l=0,c=t.length;l<c;l+=3){var u=255&t[l],d=255&t[l+1],h=255&t[l+2],p=u>>2,v=(3&u)<<4|d>>4,y=l+1<c?(15&d)<<2|h>>6:64,g=l+2<c?63&h:64;o+=i[p]+i[v]+i[y]+i[g]}return o},g=function(){for(var t=new Uint8Array([137,80,78,71,13,10,26,10]),r=new Int32Array(256),a=0;a<256;a++){for(var i=a,c=0;c<8;c++)i=1&i?3988292384^i>>1&2147483647:i>>1&2147483647;r[a]=i}function writePngChunk(t,a,i,o){var l=o,c=a.length;i[l]=c>>24&255;i[l+1]=c>>16&255;i[l+2]=c>>8&255;i[l+3]=255&c;i[l+=4]=255&t.charCodeAt(0);i[l+1]=255&t.charCodeAt(1);i[l+2]=255&t.charCodeAt(2);i[l+3]=255&t.charCodeAt(3);l+=4;i.set(a,l);var u=function crc32(t,a,i){for(var o=-1,l=a;l<i;l++){var c=255&(o^t[l]);o=o>>>8^r[c]}return-1^o}(i,o+4,l+=a.length);i[l]=u>>24&255;i[l+1]=u>>16&255;i[l+2]=u>>8&255;i[l+3]=255&u}function deflateSyncUncompressed(t){var r=t.length,a=65535,i=Math.ceil(r/a),o=new Uint8Array(2+r+5*i+4),l=0;o[l++]=120;o[l++]=156;for(var c=0;r>a;){o[l++]=0;o[l++]=255;o[l++]=255;o[l++]=0;o[l++]=0;o.set(t.subarray(c,c+a),l);l+=a;c+=a;r-=a}o[l++]=1;o[l++]=255&r;o[l++]=r>>8&255;o[l++]=255&~r;o[l++]=(65535&~r)>>8&255;o.set(t.subarray(c),l);l+=t.length-c;var u=function adler32(t,r,a){for(var i=1,o=0,l=r;l<a;++l)o=(o+(i=(i+(255&t[l]))%65521))%65521;return o<<16|i}(t,0,t.length);o[l++]=u>>24&255;o[l++]=u>>16&255;o[l++]=u>>8&255;o[l++]=255&u;return o}function encode(r,a,i,c){var u,d,h,p=r.width,v=r.height,g=r.data;switch(a){case o.ImageKind.GRAYSCALE_1BPP:d=0;u=1;h=p+7>>3;break;case o.ImageKind.RGB_24BPP:d=2;u=8;h=3*p;break;case o.ImageKind.RGBA_32BPP:d=6;u=8;h=4*p;break;default:throw new Error("invalid format")}for(var _=new Uint8Array((1+h)*v),m=0,b=0,A=0;A<v;++A){_[m++]=0;_.set(g.subarray(b,b+h),m);b+=h;m+=h}if(a===o.ImageKind.GRAYSCALE_1BPP&&c){m=0;for(var k=0;k<v;k++){m++;for(var P=0;P<h;P++)_[m++]^=255}}var S=new Uint8Array([p>>24&255,p>>16&255,p>>8&255,255&p,v>>24&255,v>>16&255,v>>8&255,255&v,u,d,0,0,0]),w=function deflateSync(t){if(!l.isNodeJS)return deflateSyncUncompressed(t);try{var r;r=parseInt(process.versions.node)>=8?t:Buffer.from(t);var a=require("zlib").deflateSync(r,{level:9});return a instanceof Uint8Array?a:new Uint8Array(a)}catch(t){(0,o.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+t)}return deflateSyncUncompressed(t)}(_),x=t.length+36+S.length+w.length,C=new Uint8Array(x),T=0;C.set(t,T);writePngChunk("IHDR",S,C,T+=t.length);writePngChunk("IDATA",w,C,T+=12+S.length);T+=12+w.length;writePngChunk("IEND",new Uint8Array(0),C,T);return y(C,"image/png",i)}return function convertImgDataToPng(t,r,a){return encode(t,void 0===t.kind?o.ImageKind.GRAYSCALE_1BPP:t.kind,r,a)}}(),_=function(){function SVGExtraState(){_classCallCheck(this,SVGExtraState);this.fontSizeScale=1;this.fontWeight=h.fontWeight;this.fontSize=0;this.textMatrix=o.IDENTITY_MATRIX;this.fontMatrix=o.FONT_IDENTITY_MATRIX;this.leading=0;this.textRenderingMode=o.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=h.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=""}_createClass(SVGExtraState,[{key:"clone",value:function clone(){return Object.create(this)}},{key:"setCurrentPoint",value:function setCurrentPoint(t,r){this.x=t;this.y=r}}]);return SVGExtraState}(),m=0,b=0,A=0;r.SVGGraphics=c=function(){function SVGGraphics(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];_classCallCheck(this,SVGGraphics);(0,i.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future.");this.svgFactory=new i.DOMSVGFactory;this.current=new _;this.transformMatrix=o.IDENTITY_MATRIX;this.transformStack=[];this.extraStack=[];this.commonObjs=t;this.objs=r;this.pendingClip=null;this.pendingEOFill=!1;this.embedFonts=!1;this.embeddedFonts=Object.create(null);this.cssStyle=null;this.forceDataSchema=!!a;this._operatorIdMapping=[];for(var l in o.OPS)this._operatorIdMapping[o.OPS[l]]=l}_createClass(SVGGraphics,[{key:"save",value:function save(){this.transformStack.push(this.transformMatrix);var t=this.current;this.extraStack.push(t);this.current=t.clone()}},{key:"restore",value:function restore(){this.transformMatrix=this.transformStack.pop();this.current=this.extraStack.pop();this.pendingClip=null;this.tgrp=null}},{key:"group",value:function group(t){this.save();this.executeOpTree(t);this.restore()}},{key:"loadDependencies",value:function loadDependencies(t){for(var r=this,a=t.fnArray,i=t.argsArray,l=0,c=a.length;l<c;l++)if(a[l]===o.OPS.dependency){var u,d=_createForOfIteratorHelper(i[l]);try{var h=function _loop(){var t=u.value,a=t.startsWith("g_")?r.commonObjs:r.objs,i=new Promise((function(r){a.get(t,r)}));r.current.dependencies.push(i)};for(d.s();!(u=d.n()).done;)h()}catch(t){d.e(t)}finally{d.f()}}return Promise.all(this.current.dependencies)}},{key:"transform",value:function transform(t,r,a,i,l,c){var u=[t,r,a,i,l,c];this.transformMatrix=o.Util.transform(this.transformMatrix,u);this.tgrp=null}},{key:"getSVG",value:function getSVG(t,r){var a=this;this.viewport=r;var i=this._initialize(r);return this.loadDependencies(t).then((function(){a.transformMatrix=o.IDENTITY_MATRIX;a.executeOpTree(a.convertOpList(t));return i}))}},{key:"convertOpList",value:function convertOpList(t){for(var r=this._operatorIdMapping,a=t.argsArray,i=t.fnArray,o=[],l=0,c=i.length;l<c;l++){var u=i[l];o.push({fnId:u,fn:r[u],args:a[l]})}return function opListToTree(t){var r,a=[],i=[],o=_createForOfIteratorHelper(t);try{for(o.s();!(r=o.n()).done;){var l=r.value;if("save"!==l.fn)"restore"===l.fn?a=i.pop():a.push(l);else{a.push({fnId:92,fn:"group",items:[]});i.push(a);a=a.at(-1).items}}}catch(t){o.e(t)}finally{o.f()}return a}(o)}},{key:"executeOpTree",value:function executeOpTree(t){var r,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var i=r.value,l=i.fn,c=i.fnId,u=i.args;switch(0|c){case o.OPS.beginText:this.beginText();break;case o.OPS.dependency:break;case o.OPS.setLeading:this.setLeading(u);break;case o.OPS.setLeadingMoveText:this.setLeadingMoveText(u[0],u[1]);break;case o.OPS.setFont:this.setFont(u);break;case o.OPS.showText:case o.OPS.showSpacedText:this.showText(u[0]);break;case o.OPS.endText:this.endText();break;case o.OPS.moveText:this.moveText(u[0],u[1]);break;case o.OPS.setCharSpacing:this.setCharSpacing(u[0]);break;case o.OPS.setWordSpacing:this.setWordSpacing(u[0]);break;case o.OPS.setHScale:this.setHScale(u[0]);break;case o.OPS.setTextMatrix:this.setTextMatrix(u[0],u[1],u[2],u[3],u[4],u[5]);break;case o.OPS.setTextRise:this.setTextRise(u[0]);break;case o.OPS.setTextRenderingMode:this.setTextRenderingMode(u[0]);break;case o.OPS.setLineWidth:this.setLineWidth(u[0]);break;case o.OPS.setLineJoin:this.setLineJoin(u[0]);break;case o.OPS.setLineCap:this.setLineCap(u[0]);break;case o.OPS.setMiterLimit:this.setMiterLimit(u[0]);break;case o.OPS.setFillRGBColor:this.setFillRGBColor(u[0],u[1],u[2]);break;case o.OPS.setStrokeRGBColor:this.setStrokeRGBColor(u[0],u[1],u[2]);break;case o.OPS.setStrokeColorN:this.setStrokeColorN(u);break;case o.OPS.setFillColorN:this.setFillColorN(u);break;case o.OPS.shadingFill:this.shadingFill(u[0]);break;case o.OPS.setDash:this.setDash(u[0],u[1]);break;case o.OPS.setRenderingIntent:this.setRenderingIntent(u[0]);break;case o.OPS.setFlatness:this.setFlatness(u[0]);break;case o.OPS.setGState:this.setGState(u[0]);break;case o.OPS.fill:this.fill();break;case o.OPS.eoFill:this.eoFill();break;case o.OPS.stroke:this.stroke();break;case o.OPS.fillStroke:this.fillStroke();break;case o.OPS.eoFillStroke:this.eoFillStroke();break;case o.OPS.clip:this.clip("nonzero");break;case o.OPS.eoClip:this.clip("evenodd");break;case o.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case o.OPS.paintImageXObject:this.paintImageXObject(u[0]);break;case o.OPS.paintInlineImageXObject:this.paintInlineImageXObject(u[0]);break;case o.OPS.paintImageMaskXObject:this.paintImageMaskXObject(u[0]);break;case o.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(u[0],u[1]);break;case o.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case o.OPS.closePath:this.closePath();break;case o.OPS.closeStroke:this.closeStroke();break;case o.OPS.closeFillStroke:this.closeFillStroke();break;case o.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case o.OPS.nextLine:this.nextLine();break;case o.OPS.transform:this.transform(u[0],u[1],u[2],u[3],u[4],u[5]);break;case o.OPS.constructPath:this.constructPath(u[0],u[1]);break;case o.OPS.endPath:this.endPath();break;case 92:this.group(i.items);break;default:(0,o.warn)("Unimplemented operator ".concat(l))}}}catch(t){a.e(t)}finally{a.f()}}},{key:"setWordSpacing",value:function setWordSpacing(t){this.current.wordSpacing=t}},{key:"setCharSpacing",value:function setCharSpacing(t){this.current.charSpacing=t}},{key:"nextLine",value:function nextLine(){this.moveText(0,this.current.leading)}},{key:"setTextMatrix",value:function setTextMatrix(t,r,a,i,o,l){var c=this.current;c.textMatrix=c.lineMatrix=[t,r,a,i,o,l];c.textMatrixScale=Math.hypot(t,r);c.x=c.lineX=0;c.y=c.lineY=0;c.xcoords=[];c.ycoords=[];c.tspan=this.svgFactory.createElement("svg:tspan");c.tspan.setAttributeNS(null,"font-family",c.fontFamily);c.tspan.setAttributeNS(null,"font-size","".concat(u(c.fontSize),"px"));c.tspan.setAttributeNS(null,"y",u(-c.y));c.txtElement=this.svgFactory.createElement("svg:text");c.txtElement.append(c.tspan)}},{key:"beginText",value:function beginText(){var t=this.current;t.x=t.lineX=0;t.y=t.lineY=0;t.textMatrix=o.IDENTITY_MATRIX;t.lineMatrix=o.IDENTITY_MATRIX;t.textMatrixScale=1;t.tspan=this.svgFactory.createElement("svg:tspan");t.txtElement=this.svgFactory.createElement("svg:text");t.txtgrp=this.svgFactory.createElement("svg:g");t.xcoords=[];t.ycoords=[]}},{key:"moveText",value:function moveText(t,r){var a=this.current;a.x=a.lineX+=t;a.y=a.lineY+=r;a.xcoords=[];a.ycoords=[];a.tspan=this.svgFactory.createElement("svg:tspan");a.tspan.setAttributeNS(null,"font-family",a.fontFamily);a.tspan.setAttributeNS(null,"font-size","".concat(u(a.fontSize),"px"));a.tspan.setAttributeNS(null,"y",u(-a.y))}},{key:"showText",value:function showText(t){var r=this.current,a=r.font,i=r.fontSize;if(0!==i){var l,c=r.fontSizeScale,p=r.charSpacing,v=r.wordSpacing,y=r.fontDirection,g=r.textHScale*y,_=a.vertical,m=_?1:-1,b=a.defaultVMetrics,A=i*r.fontMatrix[0],k=0,P=_createForOfIteratorHelper(t);try{for(P.s();!(l=P.n()).done;){var S=l.value;if(null!==S)if("number"!=typeof S){var w=(S.isSpace?v:0)+p,x=S.fontChar,C=void 0,T=void 0,E=S.width;if(_){var I=void 0,O=S.vmetric||b;I=-(I=S.vmetric?O[1]:.5*E)*A;var M=O[2]*A;E=O?-O[0]:E;C=I/c;T=(k+M)/c}else{C=k/c;T=0}if(S.isInFont||a.missingFile){r.xcoords.push(r.x+C);_&&r.ycoords.push(-r.y+T);r.tspan.textContent+=x}k+=_?E*A-w*y:E*A+w*y}else k+=m*S*i/1e3;else k+=y*v}}catch(t){P.e(t)}finally{P.f()}r.tspan.setAttributeNS(null,"x",r.xcoords.map(u).join(" "));_?r.tspan.setAttributeNS(null,"y",r.ycoords.map(u).join(" ")):r.tspan.setAttributeNS(null,"y",u(-r.y));_?r.y-=k:r.x+=k*g;r.tspan.setAttributeNS(null,"font-family",r.fontFamily);r.tspan.setAttributeNS(null,"font-size","".concat(u(r.fontSize),"px"));r.fontStyle!==h.fontStyle&&r.tspan.setAttributeNS(null,"font-style",r.fontStyle);r.fontWeight!==h.fontWeight&&r.tspan.setAttributeNS(null,"font-weight",r.fontWeight);var R=r.textRenderingMode&o.TextRenderingMode.FILL_STROKE_MASK;if(R===o.TextRenderingMode.FILL||R===o.TextRenderingMode.FILL_STROKE){r.fillColor!==h.fillColor&&r.tspan.setAttributeNS(null,"fill",r.fillColor);r.fillAlpha<1&&r.tspan.setAttributeNS(null,"fill-opacity",r.fillAlpha)}else r.textRenderingMode===o.TextRenderingMode.ADD_TO_PATH?r.tspan.setAttributeNS(null,"fill","transparent"):r.tspan.setAttributeNS(null,"fill","none");if(R===o.TextRenderingMode.STROKE||R===o.TextRenderingMode.FILL_STROKE){var D=1/(r.textMatrixScale||1);this._setStrokeAttributes(r.tspan,D)}var L=r.textMatrix;0!==r.textRise&&((L=L.slice())[5]+=r.textRise);r.txtElement.setAttributeNS(null,"transform","".concat(d(L)," scale(").concat(u(g),", -1)"));r.txtElement.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve");r.txtElement.append(r.tspan);r.txtgrp.append(r.txtElement);this._ensureTransformGroup().append(r.txtElement)}}},{key:"setLeadingMoveText",value:function setLeadingMoveText(t,r){this.setLeading(-r);this.moveText(t,r)}},{key:"addFontStyle",value:function addFontStyle(t){if(!t.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');if(!this.cssStyle){this.cssStyle=this.svgFactory.createElement("svg:style");this.cssStyle.setAttributeNS(null,"type","text/css");this.defs.append(this.cssStyle)}var r=y(t.data,t.mimetype,this.forceDataSchema);this.cssStyle.textContent+='@font-face { font-family: "'.concat(t.loadedName,'";')+" src: url(".concat(r,"); }\n")}},{key:"setFont",value:function setFont(t){var r=this.current,a=this.commonObjs.get(t[0]),i=t[1];r.font=a;if(this.embedFonts&&!a.missingFile&&!this.embeddedFonts[a.loadedName]){this.addFontStyle(a);this.embeddedFonts[a.loadedName]=a}r.fontMatrix=a.fontMatrix||o.FONT_IDENTITY_MATRIX;var l="normal";a.black?l="900":a.bold&&(l="bold");var c=a.italic?"italic":"normal";if(i<0){i=-i;r.fontDirection=-1}else r.fontDirection=1;r.fontSize=i;r.fontFamily=a.loadedName;r.fontWeight=l;r.fontStyle=c;r.tspan=this.svgFactory.createElement("svg:tspan");r.tspan.setAttributeNS(null,"y",u(-r.y));r.xcoords=[];r.ycoords=[]}},{key:"endText",value:function endText(){var t,r=this.current;if(r.textRenderingMode&o.TextRenderingMode.ADD_TO_PATH_FLAG&&null!==(t=r.txtElement)&&void 0!==t&&t.hasChildNodes()){r.element=r.txtElement;this.clip("nonzero");this.endPath()}}},{key:"setLineWidth",value:function setLineWidth(t){t>0&&(this.current.lineWidth=t)}},{key:"setLineCap",value:function setLineCap(t){this.current.lineCap=p[t]}},{key:"setLineJoin",value:function setLineJoin(t){this.current.lineJoin=v[t]}},{key:"setMiterLimit",value:function setMiterLimit(t){this.current.miterLimit=t}},{key:"setStrokeAlpha",value:function setStrokeAlpha(t){this.current.strokeAlpha=t}},{key:"setStrokeRGBColor",value:function setStrokeRGBColor(t,r,a){this.current.strokeColor=o.Util.makeHexColor(t,r,a)}},{key:"setFillAlpha",value:function setFillAlpha(t){this.current.fillAlpha=t}},{key:"setFillRGBColor",value:function setFillRGBColor(t,r,a){this.current.fillColor=o.Util.makeHexColor(t,r,a);this.current.tspan=this.svgFactory.createElement("svg:tspan");this.current.xcoords=[];this.current.ycoords=[]}},{key:"setStrokeColorN",value:function setStrokeColorN(t){this.current.strokeColor=this._makeColorN_Pattern(t)}},{key:"setFillColorN",value:function setFillColorN(t){this.current.fillColor=this._makeColorN_Pattern(t)}},{key:"shadingFill",value:function shadingFill(t){var r=this.viewport.width,a=this.viewport.height,i=o.Util.inverseTransform(this.transformMatrix),l=o.Util.applyTransform([0,0],i),c=o.Util.applyTransform([0,a],i),u=o.Util.applyTransform([r,0],i),d=o.Util.applyTransform([r,a],i),h=Math.min(l[0],c[0],u[0],d[0]),p=Math.min(l[1],c[1],u[1],d[1]),v=Math.max(l[0],c[0],u[0],d[0]),y=Math.max(l[1],c[1],u[1],d[1]),g=this.svgFactory.createElement("svg:rect");g.setAttributeNS(null,"x",h);g.setAttributeNS(null,"y",p);g.setAttributeNS(null,"width",v-h);g.setAttributeNS(null,"height",y-p);g.setAttributeNS(null,"fill",this._makeShadingPattern(t));this.current.fillAlpha<1&&g.setAttributeNS(null,"fill-opacity",this.current.fillAlpha);this._ensureTransformGroup().append(g)}},{key:"_makeColorN_Pattern",value:function _makeColorN_Pattern(t){return"TilingPattern"===t[0]?this._makeTilingPattern(t):this._makeShadingPattern(t)}},{key:"_makeTilingPattern",value:function _makeTilingPattern(t){var r=t[1],a=t[2],i=t[3]||o.IDENTITY_MATRIX,l=_slicedToArray(t[4],4),c=l[0],u=l[1],d=l[2],h=l[3],p=t[5],v=t[6],y=t[7],g="shading".concat(A++),_=_slicedToArray(o.Util.normalizeRect([].concat(_toConsumableArray(o.Util.applyTransform([c,u],i)),_toConsumableArray(o.Util.applyTransform([d,h],i)))),4),m=_[0],b=_[1],k=_[2],P=_[3],S=_slicedToArray(o.Util.singularValueDecompose2dScale(i),2),w=p*S[0],x=v*S[1],C=this.svgFactory.createElement("svg:pattern");C.setAttributeNS(null,"id",g);C.setAttributeNS(null,"patternUnits","userSpaceOnUse");C.setAttributeNS(null,"width",w);C.setAttributeNS(null,"height",x);C.setAttributeNS(null,"x","".concat(m));C.setAttributeNS(null,"y","".concat(b));var T=this.svg,E=this.transformMatrix,I=this.current.fillColor,O=this.current.strokeColor,M=this.svgFactory.create(k-m,P-b);this.svg=M;this.transformMatrix=i;if(2===y){var R=o.Util.makeHexColor.apply(o.Util,_toConsumableArray(r));this.current.fillColor=R;this.current.strokeColor=R}this.executeOpTree(this.convertOpList(a));this.svg=T;this.transformMatrix=E;this.current.fillColor=I;this.current.strokeColor=O;C.append(M.childNodes[0]);this.defs.append(C);return"url(#".concat(g,")")}},{key:"_makeShadingPattern",value:function _makeShadingPattern(t){"string"==typeof t&&(t=this.objs.get(t));switch(t[0]){case"RadialAxial":var r,a="shading".concat(A++),i=t[3];switch(t[1]){case"axial":var l=t[4],c=t[5];(r=this.svgFactory.createElement("svg:linearGradient")).setAttributeNS(null,"id",a);r.setAttributeNS(null,"gradientUnits","userSpaceOnUse");r.setAttributeNS(null,"x1",l[0]);r.setAttributeNS(null,"y1",l[1]);r.setAttributeNS(null,"x2",c[0]);r.setAttributeNS(null,"y2",c[1]);break;case"radial":var u=t[4],d=t[5],h=t[6],p=t[7];(r=this.svgFactory.createElement("svg:radialGradient")).setAttributeNS(null,"id",a);r.setAttributeNS(null,"gradientUnits","userSpaceOnUse");r.setAttributeNS(null,"cx",d[0]);r.setAttributeNS(null,"cy",d[1]);r.setAttributeNS(null,"r",p);r.setAttributeNS(null,"fx",u[0]);r.setAttributeNS(null,"fy",u[1]);r.setAttributeNS(null,"fr",h);break;default:throw new Error("Unknown RadialAxial type: ".concat(t[1]))}var v,y=_createForOfIteratorHelper(i);try{for(y.s();!(v=y.n()).done;){var g=v.value,_=this.svgFactory.createElement("svg:stop");_.setAttributeNS(null,"offset",g[0]);_.setAttributeNS(null,"stop-color",g[1]);r.append(_)}}catch(t){y.e(t)}finally{y.f()}this.defs.append(r);return"url(#".concat(a,")");case"Mesh":(0,o.warn)("Unimplemented pattern Mesh");return null;case"Dummy":return"hotpink";default:throw new Error("Unknown IR type: ".concat(t[0]))}}},{key:"setDash",value:function setDash(t,r){this.current.dashArray=t;this.current.dashPhase=r}},{key:"constructPath",value:function constructPath(t,r){var a,i=this.current,l=i.x,c=i.y,d=[],h=0,p=_createForOfIteratorHelper(t);try{for(p.s();!(a=p.n()).done;){switch(0|a.value){case o.OPS.rectangle:l=r[h++];c=r[h++];var v=r[h++],y=r[h++],g=l+v,_=c+y;d.push("M",u(l),u(c),"L",u(g),u(c),"L",u(g),u(_),"L",u(l),u(_),"Z");break;case o.OPS.moveTo:l=r[h++];c=r[h++];d.push("M",u(l),u(c));break;case o.OPS.lineTo:l=r[h++];c=r[h++];d.push("L",u(l),u(c));break;case o.OPS.curveTo:l=r[h+4];c=r[h+5];d.push("C",u(r[h]),u(r[h+1]),u(r[h+2]),u(r[h+3]),u(l),u(c));h+=6;break;case o.OPS.curveTo2:d.push("C",u(l),u(c),u(r[h]),u(r[h+1]),u(r[h+2]),u(r[h+3]));l=r[h+2];c=r[h+3];h+=4;break;case o.OPS.curveTo3:l=r[h+2];c=r[h+3];d.push("C",u(r[h]),u(r[h+1]),u(l),u(c),u(l),u(c));h+=4;break;case o.OPS.closePath:d.push("Z")}}}catch(t){p.e(t)}finally{p.f()}d=d.join(" ");if(i.path&&t.length>0&&t[0]!==o.OPS.rectangle&&t[0]!==o.OPS.moveTo)d=i.path.getAttributeNS(null,"d")+d;else{i.path=this.svgFactory.createElement("svg:path");this._ensureTransformGroup().append(i.path)}i.path.setAttributeNS(null,"d",d);i.path.setAttributeNS(null,"fill","none");i.element=i.path;i.setCurrentPoint(l,c)}},{key:"endPath",value:function endPath(){var t=this.current;t.path=null;if(this.pendingClip)if(t.element){var r="clippath".concat(m++),a=this.svgFactory.createElement("svg:clipPath");a.setAttributeNS(null,"id",r);a.setAttributeNS(null,"transform",d(this.transformMatrix));var i=t.element.cloneNode(!0);"evenodd"===this.pendingClip?i.setAttributeNS(null,"clip-rule","evenodd"):i.setAttributeNS(null,"clip-rule","nonzero");this.pendingClip=null;a.append(i);this.defs.append(a);if(t.activeClipUrl){t.clipGroup=null;var o,l=_createForOfIteratorHelper(this.extraStack);try{for(l.s();!(o=l.n()).done;){o.value.clipGroup=null}}catch(t){l.e(t)}finally{l.f()}a.setAttributeNS(null,"clip-path",t.activeClipUrl)}t.activeClipUrl="url(#".concat(r,")");this.tgrp=null}else this.pendingClip=null}},{key:"clip",value:function clip(t){this.pendingClip=t}},{key:"closePath",value:function closePath(){var t=this.current;if(t.path){var r="".concat(t.path.getAttributeNS(null,"d"),"Z");t.path.setAttributeNS(null,"d",r)}}},{key:"setLeading",value:function setLeading(t){this.current.leading=-t}},{key:"setTextRise",value:function setTextRise(t){this.current.textRise=t}},{key:"setTextRenderingMode",value:function setTextRenderingMode(t){this.current.textRenderingMode=t}},{key:"setHScale",value:function setHScale(t){this.current.textHScale=t/100}},{key:"setRenderingIntent",value:function setRenderingIntent(t){}},{key:"setFlatness",value:function setFlatness(t){}},{key:"setGState",value:function setGState(t){var r,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var i=_slicedToArray(r.value,2),l=i[0],c=i[1];switch(l){case"LW":this.setLineWidth(c);break;case"LC":this.setLineCap(c);break;case"LJ":this.setLineJoin(c);break;case"ML":this.setMiterLimit(c);break;case"D":this.setDash(c[0],c[1]);break;case"RI":this.setRenderingIntent(c);break;case"FL":this.setFlatness(c);break;case"Font":this.setFont(c);break;case"CA":this.setStrokeAlpha(c);break;case"ca":this.setFillAlpha(c);break;default:(0,o.warn)("Unimplemented graphic state operator ".concat(l))}}}catch(t){a.e(t)}finally{a.f()}}},{key:"fill",value:function fill(){var t=this.current;if(t.element){t.element.setAttributeNS(null,"fill",t.fillColor);t.element.setAttributeNS(null,"fill-opacity",t.fillAlpha);this.endPath()}}},{key:"stroke",value:function stroke(){var t=this.current;if(t.element){this._setStrokeAttributes(t.element);t.element.setAttributeNS(null,"fill","none");this.endPath()}}},{key:"_setStrokeAttributes",value:function _setStrokeAttributes(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=this.current,i=a.dashArray;1!==r&&i.length>0&&(i=i.map((function(t){return r*t})));t.setAttributeNS(null,"stroke",a.strokeColor);t.setAttributeNS(null,"stroke-opacity",a.strokeAlpha);t.setAttributeNS(null,"stroke-miterlimit",u(a.miterLimit));t.setAttributeNS(null,"stroke-linecap",a.lineCap);t.setAttributeNS(null,"stroke-linejoin",a.lineJoin);t.setAttributeNS(null,"stroke-width",u(r*a.lineWidth)+"px");t.setAttributeNS(null,"stroke-dasharray",i.map(u).join(" "));t.setAttributeNS(null,"stroke-dashoffset",u(r*a.dashPhase)+"px")}},{key:"eoFill",value:function eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd");this.fill()}},{key:"fillStroke",value:function fillStroke(){this.stroke();this.fill()}},{key:"eoFillStroke",value:function eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd");this.fillStroke()}},{key:"closeStroke",value:function closeStroke(){this.closePath();this.stroke()}},{key:"closeFillStroke",value:function closeFillStroke(){this.closePath();this.fillStroke()}},{key:"closeEOFillStroke",value:function closeEOFillStroke(){this.closePath();this.eoFillStroke()}},{key:"paintSolidColorImageMask",value:function paintSolidColorImageMask(){var t=this.svgFactory.createElement("svg:rect");t.setAttributeNS(null,"x","0");t.setAttributeNS(null,"y","0");t.setAttributeNS(null,"width","1px");t.setAttributeNS(null,"height","1px");t.setAttributeNS(null,"fill",this.current.fillColor);this._ensureTransformGroup().append(t)}},{key:"paintImageXObject",value:function paintImageXObject(t){var r=t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t);r?this.paintInlineImageXObject(r):(0,o.warn)("Dependent image with object ID ".concat(t," is not ready yet"))}},{key:"paintInlineImageXObject",value:function paintInlineImageXObject(t,r){var a=t.width,i=t.height,o=g(t,this.forceDataSchema,!!r),l=this.svgFactory.createElement("svg:rect");l.setAttributeNS(null,"x","0");l.setAttributeNS(null,"y","0");l.setAttributeNS(null,"width",u(a));l.setAttributeNS(null,"height",u(i));this.current.element=l;this.clip("nonzero");var c=this.svgFactory.createElement("svg:image");c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);c.setAttributeNS(null,"x","0");c.setAttributeNS(null,"y",u(-i));c.setAttributeNS(null,"width",u(a)+"px");c.setAttributeNS(null,"height",u(i)+"px");c.setAttributeNS(null,"transform","scale(".concat(u(1/a)," ").concat(u(-1/i),")"));r?r.append(c):this._ensureTransformGroup().append(c)}},{key:"paintImageMaskXObject",value:function paintImageMaskXObject(t){var r=this.current,a=t.width,i=t.height,o=r.fillColor;r.maskId="mask".concat(b++);var l=this.svgFactory.createElement("svg:mask");l.setAttributeNS(null,"id",r.maskId);var c=this.svgFactory.createElement("svg:rect");c.setAttributeNS(null,"x","0");c.setAttributeNS(null,"y","0");c.setAttributeNS(null,"width",u(a));c.setAttributeNS(null,"height",u(i));c.setAttributeNS(null,"fill",o);c.setAttributeNS(null,"mask","url(#".concat(r.maskId,")"));this.defs.append(l);this._ensureTransformGroup().append(c);this.paintInlineImageXObject(t,l)}},{key:"paintFormXObjectBegin",value:function paintFormXObjectBegin(t,r){Array.isArray(t)&&6===t.length&&this.transform(t[0],t[1],t[2],t[3],t[4],t[5]);if(r){var a=r[2]-r[0],i=r[3]-r[1],o=this.svgFactory.createElement("svg:rect");o.setAttributeNS(null,"x",r[0]);o.setAttributeNS(null,"y",r[1]);o.setAttributeNS(null,"width",u(a));o.setAttributeNS(null,"height",u(i));this.current.element=o;this.clip("nonzero");this.endPath()}}},{key:"paintFormXObjectEnd",value:function paintFormXObjectEnd(){}},{key:"_initialize",value:function _initialize(t){var r=this.svgFactory.create(t.width,t.height),a=this.svgFactory.createElement("svg:defs");r.append(a);this.defs=a;var i=this.svgFactory.createElement("svg:g");i.setAttributeNS(null,"transform",d(t.transform));r.append(i);this.svg=i;return r}},{key:"_ensureClipGroup",value:function _ensureClipGroup(){if(!this.current.clipGroup){var t=this.svgFactory.createElement("svg:g");t.setAttributeNS(null,"clip-path",this.current.activeClipUrl);this.svg.append(t);this.current.clipGroup=t}return this.current.clipGroup}},{key:"_ensureTransformGroup",value:function _ensureTransformGroup(){if(!this.tgrp){this.tgrp=this.svgFactory.createElement("svg:g");this.tgrp.setAttributeNS(null,"transform",d(this.transformMatrix));this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)}return this.tgrp}}]);return SVGGraphics}()},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFNodeStream=void 0;var i=a(1),o=a(158);function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});Object.defineProperty(t,"prototype",{writable:!1});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}var l=require("fs"),c=require("http"),u=require("https"),d=require("url"),h=/^file:\/\/\/[a-zA-Z]:\//;var p=function(){function PDFNodeStream(t){_classCallCheck(this,PDFNodeStream);this.source=t;this.url=function parseUrl(t){var r=d.parse(t);if("file:"===r.protocol||r.host)return r;if(/^[a-z]:[/\\]/i.test(t))return d.parse("file:///".concat(t));r.host||(r.protocol="file:");return r}(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=[]}_createClass(PDFNodeStream,[{key:"_progressiveDataLength",get:function get(){var t,r;return null!==(t=null===(r=this._fullRequestReader)||void 0===r?void 0:r._loaded)&&void 0!==t?t:0}},{key:"getFullReader",value:function getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once.");this._fullRequestReader=this.isFsUrl?new m(this):new g(this);return this._fullRequestReader}},{key:"getRangeReader",value:function getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;var a=this.isFsUrl?new b(this,t,r):new _(this,t,r);this._rangeRequestReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);var r,a=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(a.s();!(r=a.n()).done;){r.value.cancel(t)}}catch(t){a.e(t)}finally{a.f()}}}]);return PDFNodeStream}();r.PDFNodeStream=p;var v=function(){function BaseFullReader(t){_classCallCheck(this,BaseFullReader);this._url=t.url;this._done=!1;this._storedError=null;this.onProgress=null;var r=t.source;this._contentLength=r.length;this._loaded=0;this._filename=null;this._disableRange=r.disableRange||!1;this._rangeChunkSize=r.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!r.disableStream;this._isRangeSupported=!r.disableRange;this._readableStream=null;this._readCapability=(0,i.createPromiseCapability)();this._headersCapability=(0,i.createPromiseCapability)()}_createClass(BaseFullReader,[{key:"headersReady",get:function get(){return this._headersCapability.promise}},{key:"filename",get:function get(){return this._filename}},{key:"contentLength",get:function get(){return this._contentLength}},{key:"isRangeSupported",get:function get(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var t,r;return _regeneratorRuntime().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return this._readCapability.promise;case 2:if(!this._done){a.next=4;break}return a.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){a.next=6;break}throw this._storedError;case 6:if(null!==(t=this._readableStream.read())){a.next=10;break}this._readCapability=(0,i.createPromiseCapability)();return a.abrupt("return",this.read());case 10:this._loaded+=t.length;this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});r=new Uint8Array(t).buffer;return a.abrupt("return",{value:r,done:!1});case 14:case"end":return a.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}},{key:"_error",value:function _error(t){this._storedError=t;this._readCapability.resolve()}},{key:"_setReadableStream",value:function _setReadableStream(t){var r=this;this._readableStream=t;t.on("readable",(function(){r._readCapability.resolve()}));t.on("end",(function(){t.destroy();r._done=!0;r._readCapability.resolve()}));t.on("error",(function(t){r._error(t)}));!this._isStreamingSupported&&this._isRangeSupported&&this._error(new i.AbortException("streaming is disabled"));this._storedError&&this._readableStream.destroy(this._storedError)}}]);var t;return BaseFullReader}(),y=function(){function BaseRangeReader(t){_classCallCheck(this,BaseRangeReader);this._url=t.url;this._done=!1;this._storedError=null;this.onProgress=null;this._loaded=0;this._readableStream=null;this._readCapability=(0,i.createPromiseCapability)();var r=t.source;this._isStreamingSupported=!r.disableStream}_createClass(BaseRangeReader,[{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(){var t,r;return _regeneratorRuntime().wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return this._readCapability.promise;case 2:if(!this._done){a.next=4;break}return a.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){a.next=6;break}throw this._storedError;case 6:if(null!==(t=this._readableStream.read())){a.next=10;break}this._readCapability=(0,i.createPromiseCapability)();return a.abrupt("return",this.read());case 10:this._loaded+=t.length;this.onProgress&&this.onProgress({loaded:this._loaded});r=new Uint8Array(t).buffer;return a.abrupt("return",{value:r,done:!1});case 14:case"end":return a.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}},{key:"_error",value:function _error(t){this._storedError=t;this._readCapability.resolve()}},{key:"_setReadableStream",value:function _setReadableStream(t){var r=this;this._readableStream=t;t.on("readable",(function(){r._readCapability.resolve()}));t.on("end",(function(){t.destroy();r._done=!0;r._readCapability.resolve()}));t.on("error",(function(t){r._error(t)}));this._storedError&&this._readableStream.destroy(this._storedError)}}]);var t;return BaseRangeReader}();function createRequestOptions(t,r){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:r}}var g=function(t){_inherits(PDFNodeStreamFullReader,t);var r=_createSuper(PDFNodeStreamFullReader);function PDFNodeStreamFullReader(t){var a;_classCallCheck(this,PDFNodeStreamFullReader);var l=function handleResponse(r){if(404!==r.statusCode){a._headersCapability.resolve();a._setReadableStream(r);var l=function getResponseHeader(t){return a._readableStream.headers[t.toLowerCase()]},c=(0,o.validateRangeRequestCapabilities)({getResponseHeader:l,isHttp:t.isHttp,rangeChunkSize:a._rangeChunkSize,disableRange:a._disableRange}),u=c.allowRangeRequests,d=c.suggestedLength;a._isRangeSupported=u;a._contentLength=d||a._contentLength;a._filename=(0,o.extractFilenameFromHeader)(l)}else{var h=new i.MissingPDFException('Missing PDF "'.concat(a._url,'".'));a._storedError=h;a._headersCapability.reject(h)}};(a=r.call(this,t))._request=null;"http:"===a._url.protocol?a._request=c.request(createRequestOptions(a._url,t.httpHeaders),l):a._request=u.request(createRequestOptions(a._url,t.httpHeaders),l);a._request.on("error",(function(t){a._storedError=t;a._headersCapability.reject(t)}));a._request.end();return a}return _createClass(PDFNodeStreamFullReader)}(v),_=function(t){_inherits(PDFNodeStreamRangeReader,t);var r=_createSuper(PDFNodeStreamRangeReader);function PDFNodeStreamRangeReader(t,a,o){var l;_classCallCheck(this,PDFNodeStreamRangeReader);(l=r.call(this,t))._httpHeaders={};for(var d in t.httpHeaders){var h=t.httpHeaders[d];void 0!==h&&(l._httpHeaders[d]=h)}l._httpHeaders.Range="bytes=".concat(a,"-").concat(o-1);var p=function handleResponse(t){if(404!==t.statusCode)l._setReadableStream(t);else{var r=new i.MissingPDFException('Missing PDF "'.concat(l._url,'".'));l._storedError=r}};l._request=null;"http:"===l._url.protocol?l._request=c.request(createRequestOptions(l._url,l._httpHeaders),p):l._request=u.request(createRequestOptions(l._url,l._httpHeaders),p);l._request.on("error",(function(t){l._storedError=t}));l._request.end();return l}return _createClass(PDFNodeStreamRangeReader)}(y),m=function(t){_inherits(PDFNodeStreamFsFullReader,t);var r=_createSuper(PDFNodeStreamFsFullReader);function PDFNodeStreamFsFullReader(t){var a;_classCallCheck(this,PDFNodeStreamFsFullReader);a=r.call(this,t);var o=decodeURIComponent(a._url.path);h.test(a._url.href)&&(o=o.replace(/^\//,""));l.lstat(o,(function(t,r){if(t){"ENOENT"===t.code&&(t=new i.MissingPDFException('Missing PDF "'.concat(o,'".')));a._storedError=t;a._headersCapability.reject(t)}else{a._contentLength=r.size;a._setReadableStream(l.createReadStream(o));a._headersCapability.resolve()}}));return a}return _createClass(PDFNodeStreamFsFullReader)}(v),b=function(t){_inherits(PDFNodeStreamFsRangeReader,t);var r=_createSuper(PDFNodeStreamFsRangeReader);function PDFNodeStreamFsRangeReader(t,a,i){var o;_classCallCheck(this,PDFNodeStreamFsRangeReader);o=r.call(this,t);var c=decodeURIComponent(o._url.path);h.test(o._url.href)&&(c=c.replace(/^\//,""));o._setReadableStream(l.createReadStream(c,{start:a,end:i-1}));return o}return _createClass(PDFNodeStreamFsRangeReader)}(y)},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.createResponseStatusError=function createResponseStatusError(t,r){if(404===t||0===t&&r.startsWith("file:"))return new i.MissingPDFException('Missing PDF "'+r+'".');return new i.UnexpectedResponseException("Unexpected server response (".concat(t,') while retrieving PDF "').concat(r,'".'),t)};r.extractFilenameFromHeader=function extractFilenameFromHeader(t){var r=t("Content-Disposition");if(r){var a=(0,o.getFilenameFromContentDispositionHeader)(r);if(a.includes("%"))try{a=decodeURIComponent(a)}catch(t){}if((0,l.isPdfFile)(a))return a}return null};r.validateRangeRequestCapabilities=function validateRangeRequestCapabilities(t){var r=t.getResponseHeader,a=t.isHttp,i=t.rangeChunkSize,o=t.disableRange,l={allowRangeRequests:!1,suggestedLength:void 0},c=parseInt(r("Content-Length"),10);if(!Number.isInteger(c))return l;l.suggestedLength=c;if(c<=2*i)return l;if(o||!a)return l;if("bytes"!==r("Accept-Ranges"))return l;if("identity"!==(r("Content-Encoding")||"identity"))return l;l.allowRangeRequests=!0;return l};r.validateResponseStatus=function validateResponseStatus(t){return 200===t||206===t};var i=a(1),o=a(159),l=a(129)},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.getFilenameFromContentDispositionHeader=function getFilenameFromContentDispositionHeader(t){var r=!0,a=toParamRegExp("filename\\*","i").exec(t);if(a){var o=rfc2616unquote(a=a[1]);return fixupEncoding(o=rfc2047decode(o=rfc5987decode(o=unescape(o))))}if(a=function rfc2231getparam(t){var r,a=[],i=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(r=i.exec(t));){var o=_slicedToArray(r,4),l=o[1],c=o[2],u=o[3];if((l=parseInt(l,10))in a){if(0===l)break}else a[l]=[c,u]}for(var d=[],h=0;h<a.length&&h in a;++h){var p=_slicedToArray(a[h],2),v=p[0],y=p[1];y=rfc2616unquote(y);if(v){y=unescape(y);0===h&&(y=rfc5987decode(y))}d.push(y)}return d.join("")}(t)){return fixupEncoding(rfc2047decode(a))}if(a=toParamRegExp("filename","i").exec(t)){var l=rfc2616unquote(a=a[1]);return fixupEncoding(l=rfc2047decode(l))}function toParamRegExp(t,r){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',r)}function textdecode(t,a){if(t){if(!/^[\x00-\xFF]+$/.test(a))return a;try{var o=new TextDecoder(t,{fatal:!0}),l=(0,i.stringToBytes)(a);a=o.decode(l);r=!1}catch(t){}}return a}function fixupEncoding(t){if(r&&/[\x80-\xff]/.test(t)){t=textdecode("utf-8",t);r&&(t=textdecode("iso-8859-1",t))}return t}function rfc2616unquote(t){if(t.startsWith('"')){for(var r=t.slice(1).split('\\"'),a=0;a<r.length;++a){var i=r[a].indexOf('"');if(-1!==i){r[a]=r[a].slice(0,i);r.length=a+1}r[a]=r[a].replace(/\\(.)/g,"$1")}t=r.join('"')}return t}function rfc5987decode(t){var r=t.indexOf("'");return-1===r?t:textdecode(t.slice(0,r),t.slice(r+1).replace(/^[^']*'/,""))}function rfc2047decode(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,r,a,i){if("q"===a||"Q"===a)return textdecode(r,i=(i=i.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(t,r){return String.fromCharCode(parseInt(r,16))})));try{i=atob(i)}catch(t){}return textdecode(r,i)}))}return""};var i=a(1);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],c=!0,u=!1;try{for(a=a.call(t);!(c=(i=a.next()).done);c=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){u=!0;o=t}finally{try{c||null==a.return||a.return()}finally{if(u)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFNetworkStream=void 0;var i=a(1),o=a(158);function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}var l=function(){function NetworkManager(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,NetworkManager);this.url=t;this.isHttp=/^https?:/i.test(t);this.httpHeaders=this.isHttp&&r.httpHeaders||Object.create(null);this.withCredentials=r.withCredentials||!1;this.getXhr=r.getXhr||function NetworkManager_getXhr(){return new XMLHttpRequest};this.currXhrId=0;this.pendingRequests=Object.create(null)}_createClass(NetworkManager,[{key:"requestRange",value:function requestRange(t,r,a){var i={begin:t,end:r};for(var o in a)i[o]=a[o];return this.request(i)}},{key:"requestFull",value:function requestFull(t){return this.request(t)}},{key:"request",value:function request(t){var r=this.getXhr(),a=this.currXhrId++,i=this.pendingRequests[a]={xhr:r};r.open("GET",this.url);r.withCredentials=this.withCredentials;for(var o in this.httpHeaders){var l=this.httpHeaders[o];void 0!==l&&r.setRequestHeader(o,l)}if(this.isHttp&&"begin"in t&&"end"in t){r.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1));i.expectedStatus=206}else i.expectedStatus=200;r.responseType="arraybuffer";t.onError&&(r.onerror=function(a){t.onError(r.status)});r.onreadystatechange=this.onStateChange.bind(this,a);r.onprogress=this.onProgress.bind(this,a);i.onHeadersReceived=t.onHeadersReceived;i.onDone=t.onDone;i.onError=t.onError;i.onProgress=t.onProgress;r.send(null);return a}},{key:"onProgress",value:function onProgress(t,r){var a,i=this.pendingRequests[t];i&&(null===(a=i.onProgress)||void 0===a||a.call(i,r))}},{key:"onStateChange",value:function onStateChange(t,r){var a=this.pendingRequests[t];if(a){var o=a.xhr;if(o.readyState>=2&&a.onHeadersReceived){a.onHeadersReceived();delete a.onHeadersReceived}if(4===o.readyState&&t in this.pendingRequests){delete this.pendingRequests[t];if(0===o.status&&this.isHttp){var l;null===(l=a.onError)||void 0===l||l.call(a,o.status)}else{var c=o.status||200;if(200===c&&206===a.expectedStatus||c===a.expectedStatus){var u=function getArrayBuffer(t){var r=t.response;return"string"!=typeof r?r:(0,i.stringToBytes)(r).buffer}(o);if(206===c){var d=o.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(d);a.onDone({begin:parseInt(h[1],10),chunk:u})}else if(u)a.onDone({begin:0,chunk:u});else{var p;null===(p=a.onError)||void 0===p||p.call(a,o.status)}}else{var v;null===(v=a.onError)||void 0===v||v.call(a,o.status)}}}}}},{key:"getRequestXhr",value:function getRequestXhr(t){return this.pendingRequests[t].xhr}},{key:"isPendingRequest",value:function isPendingRequest(t){return t in this.pendingRequests}},{key:"abortRequest",value:function abortRequest(t){var r=this.pendingRequests[t].xhr;delete this.pendingRequests[t];r.abort()}}]);return NetworkManager}(),c=function(){function PDFNetworkStream(t){_classCallCheck(this,PDFNetworkStream);this._source=t;this._manager=new l(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials});this._rangeChunkSize=t.rangeChunkSize;this._fullRequestReader=null;this._rangeRequestReaders=[]}_createClass(PDFNetworkStream,[{key:"_onRangeRequestReaderClosed",value:function _onRangeRequestReaderClosed(t){var r=this._rangeRequestReaders.indexOf(t);r>=0&&this._rangeRequestReaders.splice(r,1)}},{key:"getFullReader",value:function getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once.");this._fullRequestReader=new u(this._manager,this._source);return this._fullRequestReader}},{key:"getRangeReader",value:function getRangeReader(t,r){var a=new d(this._manager,t,r);a.onClosed=this._onRangeRequestReaderClosed.bind(this);this._rangeRequestReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){var r;null===(r=this._fullRequestReader)||void 0===r||r.cancel(t);var a,i=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(i.s();!(a=i.n()).done;){a.value.cancel(t)}}catch(t){i.e(t)}finally{i.f()}}}]);return PDFNetworkStream}();r.PDFNetworkStream=c;var u=function(){function PDFNetworkStreamFullRequestReader(t,r){_classCallCheck(this,PDFNetworkStreamFullRequestReader);this._manager=t;var a={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=r.url;this._fullRequestId=t.requestFull(a);this._headersReceivedCapability=(0,i.createPromiseCapability)();this._disableRange=r.disableRange||!1;this._contentLength=r.length;this._rangeChunkSize=r.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}_createClass(PDFNetworkStreamFullRequestReader,[{key:"_onHeadersReceived",value:function _onHeadersReceived(){var t=this._fullRequestId,r=this._manager.getRequestXhr(t),a=function getResponseHeader(t){return r.getResponseHeader(t)},i=(0,o.validateRangeRequestCapabilities)({getResponseHeader:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),l=i.allowRangeRequests,c=i.suggestedLength;l&&(this._isRangeSupported=!0);this._contentLength=c||this._contentLength;this._filename=(0,o.extractFilenameFromHeader)(a);this._isRangeSupported&&this._manager.abortRequest(t);this._headersReceivedCapability.resolve()}},{key:"_onDone",value:function _onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);this._done=!0;if(!(this._cachedChunks.length>0)){var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0}}},{key:"_onError",value:function _onError(t){this._storedError=(0,o.createResponseStatusError)(t,this._url);this._headersReceivedCapability.reject(this._storedError);var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.reject(this._storedError)}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._cachedChunks.length=0}},{key:"_onProgress",value:function _onProgress(t){var r;null===(r=this.onProgress)||void 0===r||r.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}},{key:"filename",get:function get(){return this._filename}},{key:"isRangeSupported",get:function get(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"contentLength",get:function get(){return this._contentLength}},{key:"headersReady",get:function get(){return this._headersReceivedCapability.promise}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var t,r;return _regeneratorRuntime().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(!this._storedError){a.next=2;break}throw this._storedError;case 2:if(!(this._cachedChunks.length>0)){a.next=5;break}t=this._cachedChunks.shift();return a.abrupt("return",{value:t,done:!1});case 5:if(!this._done){a.next=7;break}return a.abrupt("return",{value:void 0,done:!0});case 7:r=(0,i.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 10:case"end":return a.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;this._headersReceivedCapability.reject(t);var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId);this._fullRequestReader=null}}]);var t;return PDFNetworkStreamFullRequestReader}(),d=function(){function PDFNetworkStreamRangeRequestReader(t,r,a){_classCallCheck(this,PDFNetworkStreamRangeRequestReader);this._manager=t;var i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url;this._requestId=t.requestRange(r,a,i);this._requests=[];this._queuedChunk=null;this._done=!1;this._storedError=void 0;this.onProgress=null;this.onClosed=null}_createClass(PDFNetworkStreamRangeRequestReader,[{key:"_close",value:function _close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}},{key:"_onDone",value:function _onDone(t){var r=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:r,done:!1})}else this._queuedChunk=r;this._done=!0;var a,i=_createForOfIteratorHelper(this._requests);try{for(i.s();!(a=i.n()).done;){a.value.resolve({value:void 0,done:!0})}}catch(t){i.e(t)}finally{i.f()}this._requests.length=0;this._close()}},{key:"_onError",value:function _onError(t){this._storedError=(0,o.createResponseStatusError)(t,this._url);var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.reject(this._storedError)}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._queuedChunk=null}},{key:"_onProgress",value:function _onProgress(t){if(!this.isStreamingSupported){var r;null===(r=this.onProgress)||void 0===r||r.call(this,{loaded:t.loaded})}}},{key:"isStreamingSupported",get:function get(){return!1}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(){var t,r;return _regeneratorRuntime().wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:if(!this._storedError){a.next=2;break}throw this._storedError;case 2:if(null===this._queuedChunk){a.next=6;break}t=this._queuedChunk;this._queuedChunk=null;return a.abrupt("return",{value:t,done:!1});case 6:if(!this._done){a.next=8;break}return a.abrupt("return",{value:void 0,done:!0});case 8:r=(0,i.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 11:case"end":return a.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId);this._close()}}]);var t;return PDFNetworkStreamRangeRequestReader}()},(t,r,a)=>{"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFFetchStream=void 0;var i=a(1),o=a(158);function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function define(t,r,a){return Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),c=new Context(i||[]);return l._invoke=function(t,r,a){var i="suspendedStart";return function(o,l){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw l;return doneResult()}for(a.method=o,a.arg=l;;){var c=a.delegate;if(c){var d=maybeInvokeDelegate(c,a);if(d){if(d===u)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===i)throw i="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i="executing";var h=tryCatch(t,r,a);if("normal"===h.type){if(i=a.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:a.done}}"throw"===h.type&&(i="completed",a.method="throw",a.arg=h.arg)}}}(t,a,c),l}function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var d={};define(d,o,(function(){return this}));var h=Object.getPrototypeOf,p=h&&h(h(values([])));p&&p!==r&&a.call(p,o)&&(d=p);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(d);function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,o,l,c){var u=tryCatch(t[i],t,o);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"==_typeof(h)&&a.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,c)}),(function(t){invoke("throw",t,l,c)})):r.resolve(h).then((function(t){d.value=t,l(d)}),(function(t){return invoke("throw",t,l,c)}))}c(u.arg)}var i;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,a,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var a=t.iterator[r.method];if(void 0===a){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,maybeInvokeDelegate(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=tryCatch(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,u;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,l=function next(){for(;++i<t.length;)if(a.call(t,i))return next.value=t[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(v,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var c=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),define(v,o,(function(){return this})),define(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var a in t)r.push(a);return r.reverse(),function next(){for(;r.length;){var a=r.pop();if(a in t)return next.value=a,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(a,i){return l.type="throw",l.arg=t,r.next=a,i&&(r.method="next",r.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var c=l?l.completion:{};return c.type=t,c.arg=r,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),u}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,a){return this.delegate={iterator:values(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=void 0),u}},t}function asyncGeneratorStep(t,r,a,i,o,l,c){try{var u=t[l](c),d=u.value}catch(t){a(t);return}u.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}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 l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();c=t.done;return t},e:function e(t){u=!0;l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);Object.defineProperty(t,"prototype",{writable:!1});return t}function createFetchOptions(t,r,a){return{method:"GET",headers:t,signal:null==a?void 0:a.signal,mode:"cors",credentials:r?"include":"same-origin",redirect:"follow"}}function createHeaders(t){var r=new Headers;for(var a in t){var i=t[a];void 0!==i&&r.append(a,i)}return r}var l=function(){function PDFFetchStream(t){_classCallCheck(this,PDFFetchStream);this.source=t;this.isHttp=/^https?:/i.test(t.url);this.httpHeaders=this.isHttp&&t.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}_createClass(PDFFetchStream,[{key:"_progressiveDataLength",get:function get(){var t,r;return null!==(t=null===(r=this._fullRequestReader)||void 0===r?void 0:r._loaded)&&void 0!==t?t:0}},{key:"getFullReader",value:function getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once.");this._fullRequestReader=new c(this);return this._fullRequestReader}},{key:"getRangeReader",value:function getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;var a=new u(this,t,r);this._rangeRequestReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);var r,a=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(a.s();!(r=a.n()).done;){r.value.cancel(t)}}catch(t){a.e(t)}finally{a.f()}}}]);return PDFFetchStream}();r.PDFFetchStream=l;var c=function(){function PDFFetchStreamReader(t){var r=this;_classCallCheck(this,PDFFetchStreamReader);this._stream=t;this._reader=null;this._loaded=0;this._filename=null;var a=t.source;this._withCredentials=a.withCredentials||!1;this._contentLength=a.length;this._headersCapability=(0,i.createPromiseCapability)();this._disableRange=a.disableRange||!1;this._rangeChunkSize=a.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._isStreamingSupported=!a.disableStream;this._isRangeSupported=!a.disableRange;this._headers=createHeaders(this._stream.httpHeaders);var l=a.url;fetch(l,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((function(t){if(!(0,o.validateResponseStatus)(t.status))throw(0,o.createResponseStatusError)(t.status,l);r._reader=t.body.getReader();r._headersCapability.resolve();var a=function getResponseHeader(r){return t.headers.get(r)},c=(0,o.validateRangeRequestCapabilities)({getResponseHeader:a,isHttp:r._stream.isHttp,rangeChunkSize:r._rangeChunkSize,disableRange:r._disableRange}),u=c.allowRangeRequests,d=c.suggestedLength;r._isRangeSupported=u;r._contentLength=d||r._contentLength;r._filename=(0,o.extractFilenameFromHeader)(a);!r._isStreamingSupported&&r._isRangeSupported&&r.cancel(new i.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject);this.onProgress=null}_createClass(PDFFetchStreamReader,[{key:"headersReady",get:function get(){return this._headersCapability.promise}},{key:"filename",get:function get(){return this._filename}},{key:"contentLength",get:function get(){return this._contentLength}},{key:"isRangeSupported",get:function get(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var t,r,a,i;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:o.next=2;return this._headersCapability.promise;case 2:o.next=4;return this._reader.read();case 4:t=o.sent;r=t.value;if(!(a=t.done)){o.next=9;break}return o.abrupt("return",{value:r,done:a});case 9:this._loaded+=r.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});i=new Uint8Array(r).buffer;return o.abrupt("return",{value:i,done:!1});case 13:case"end":return o.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._reader&&this._reader.cancel(t);this._abortController&&this._abortController.abort()}}]);var t;return PDFFetchStreamReader}(),u=function(){function PDFFetchStreamRangeReader(t,r,a){var l=this;_classCallCheck(this,PDFFetchStreamRangeReader);this._stream=t;this._reader=null;this._loaded=0;var c=t.source;this._withCredentials=c.withCredentials||!1;this._readCapability=(0,i.createPromiseCapability)();this._isStreamingSupported=!c.disableStream;"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._headers=createHeaders(this._stream.httpHeaders);this._headers.append("Range","bytes=".concat(r,"-").concat(a-1));var u=c.url;fetch(u,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((function(t){if(!(0,o.validateResponseStatus)(t.status))throw(0,o.createResponseStatusError)(t.status,u);l._readCapability.resolve();l._reader=t.body.getReader()})).catch(this._readCapability.reject);this.onProgress=null}_createClass(PDFFetchStreamRangeReader,[{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(){var t,r,a,i;return _regeneratorRuntime().wrap((function _callee2$(o){for(;;)switch(o.prev=o.next){case 0:o.next=2;return this._readCapability.promise;case 2:o.next=4;return this._reader.read();case 4:t=o.sent;r=t.value;if(!(a=t.done)){o.next=9;break}return o.abrupt("return",{value:r,done:a});case 9:this._loaded+=r.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded});i=new Uint8Array(r).buffer;return o.abrupt("return",{value:i,done:!1});case 13:case"end":return o.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._reader&&this._reader.cancel(t);this._abortController&&this._abortController.abort()}}]);var t;return PDFFetchStreamRangeReader}()}],__webpack_module_cache__={};function __w_pdfjs_require__(t){var r=__webpack_module_cache__[t];if(void 0!==r)return r.exports;var a=__webpack_module_cache__[t]={exports:{}};__webpack_modules__[t](a,a.exports,__w_pdfjs_require__);return a.exports}var __webpack_exports__={};(()=>{"use strict";var t=__webpack_exports__;Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"AnnotationEditorLayer",{enumerable:!0,get:function get(){return o.AnnotationEditorLayer}});Object.defineProperty(t,"AnnotationEditorParamsType",{enumerable:!0,get:function get(){return r.AnnotationEditorParamsType}});Object.defineProperty(t,"AnnotationEditorType",{enumerable:!0,get:function get(){return r.AnnotationEditorType}});Object.defineProperty(t,"AnnotationEditorUIManager",{enumerable:!0,get:function get(){return l.AnnotationEditorUIManager}});Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function get(){return c.AnnotationLayer}});Object.defineProperty(t,"AnnotationMode",{enumerable:!0,get:function get(){return r.AnnotationMode}});Object.defineProperty(t,"CMapCompressionType",{enumerable:!0,get:function get(){return r.CMapCompressionType}});Object.defineProperty(t,"GlobalWorkerOptions",{enumerable:!0,get:function get(){return u.GlobalWorkerOptions}});Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function get(){return r.InvalidPDFException}});Object.defineProperty(t,"LoopbackPort",{enumerable:!0,get:function get(){return i.LoopbackPort}});Object.defineProperty(t,"MissingPDFException",{enumerable:!0,get:function get(){return r.MissingPDFException}});Object.defineProperty(t,"OPS",{enumerable:!0,get:function get(){return r.OPS}});Object.defineProperty(t,"PDFDataRangeTransport",{enumerable:!0,get:function get(){return i.PDFDataRangeTransport}});Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function get(){return a.PDFDateString}});Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function get(){return i.PDFWorker}});Object.defineProperty(t,"PasswordResponses",{enumerable:!0,get:function get(){return r.PasswordResponses}});Object.defineProperty(t,"PermissionFlag",{enumerable:!0,get:function get(){return r.PermissionFlag}});Object.defineProperty(t,"PixelsPerInch",{enumerable:!0,get:function get(){return a.PixelsPerInch}});Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function get(){return a.RenderingCancelledException}});Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function get(){return p.SVGGraphics}});Object.defineProperty(t,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function get(){return r.UNSUPPORTED_FEATURES}});Object.defineProperty(t,"UnexpectedResponseException",{enumerable:!0,get:function get(){return r.UnexpectedResponseException}});Object.defineProperty(t,"Util",{enumerable:!0,get:function get(){return r.Util}});Object.defineProperty(t,"VerbosityLevel",{enumerable:!0,get:function get(){return r.VerbosityLevel}});Object.defineProperty(t,"XfaLayer",{enumerable:!0,get:function get(){return v.XfaLayer}});Object.defineProperty(t,"binarySearchFirstItem",{enumerable:!0,get:function get(){return a.binarySearchFirstItem}});Object.defineProperty(t,"build",{enumerable:!0,get:function get(){return i.build}});Object.defineProperty(t,"createPromiseCapability",{enumerable:!0,get:function get(){return r.createPromiseCapability}});Object.defineProperty(t,"createValidAbsoluteUrl",{enumerable:!0,get:function get(){return r.createValidAbsoluteUrl}});Object.defineProperty(t,"getDocument",{enumerable:!0,get:function get(){return i.getDocument}});Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function get(){return a.getFilenameFromUrl}});Object.defineProperty(t,"getPdfFilenameFromUrl",{enumerable:!0,get:function get(){return a.getPdfFilenameFromUrl}});Object.defineProperty(t,"getXfaPageViewport",{enumerable:!0,get:function get(){return a.getXfaPageViewport}});Object.defineProperty(t,"isPdfFile",{enumerable:!0,get:function get(){return a.isPdfFile}});Object.defineProperty(t,"loadScript",{enumerable:!0,get:function get(){return a.loadScript}});Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function get(){return h.renderTextLayer}});Object.defineProperty(t,"shadow",{enumerable:!0,get:function get(){return r.shadow}});Object.defineProperty(t,"version",{enumerable:!0,get:function get(){return i.version}});var r=__w_pdfjs_require__(1),a=__w_pdfjs_require__(129),i=__w_pdfjs_require__(131),o=__w_pdfjs_require__(147),l=__w_pdfjs_require__(134),c=__w_pdfjs_require__(152),u=__w_pdfjs_require__(140),d=__w_pdfjs_require__(3),h=__w_pdfjs_require__(155),p=__w_pdfjs_require__(156),v=__w_pdfjs_require__(154);if(d.isNodeJS){var y=__w_pdfjs_require__(157).PDFNodeStream;(0,i.setPDFNetworkStreamFactory)((function(t){return new y(t)}))}else{var g=__w_pdfjs_require__(160).PDFNetworkStream,_=__w_pdfjs_require__(161).PDFFetchStream;(0,i.setPDFNetworkStreamFactory)((function(t){return(0,a.isValidFetchUrl)(t.url)?new _(t):new g(t)}))}})();return __webpack_exports__})()));