@syncfusion/ej2-pdf 25.1.39 → 25.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * filename: ej2-pdf.min.js
3
- * version : 25.1.39
3
+ * version : 25.1.41
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
7
7
  * licensing@syncfusion.com. Any infringement will be prosecuted under
8
8
  * applicable laws.
9
9
  */
10
- this.ej=this.ej||{},this.ej.pdf=function(t,e,i){"use strict";function r(t,e){return t&Math.pow(2,e)-1}function n(t){return t<<16>>16}function s(t){return t<<0}function a(t,e,i,r,n){null!==r&&void 0!==r||(r=0),n=void 0===n?i.length:n,r=Math.max(0,Math.min(i.length,r)),e+((n=Math.max(0,Math.min(i.length,n)))-r)>t.length&&(t.length=e+(n-r));for(var s=r,a=e;s<n;s++,a++)t[Number.parseInt(a.toString(),10)]=i[Number.parseInt(s.toString(),10)]}function o(t,e){for(var i=0;i<e.length;i++)if(e[Number.parseInt(i.toString(),10)]!==t[Number.parseInt(i.toString(),10)])return!1;return!0}function h(t){var e;if(o(t,[255,216]))e=new ir(t);else{if(!o(t,[137,80,78,71,13,10,26,10]))throw new Error("Unsupported image format");e=new _r(t)}return e}function c(e,i,r){var n=0;if(r=void 0===r||null===r?0:r,e.rotation===t.PdfRotationAngle.angle90)n=void 0===i||null===i?0:r;else if(e.rotation===t.PdfRotationAngle.angle180)n=void 0===i||null===i?0:i;else if(e.rotation===t.PdfRotationAngle.angle270){var s=e.size;n=void 0===i||null===i?0:s[0]-r}return n}function _(t,e){for(var i=-1,r=0;r<t.pageCount;r++)if(t.getPage(r)._pageDictionary===e){i=r;break}return i}function d(e){var i=[];return 0!=(e&t.PdfAnnotationFlag.hidden)&&i.push("hidden"),0!=(e&t.PdfAnnotationFlag.invisible)&&i.push("invisible"),0!=(e&t.PdfAnnotationFlag.locked)&&i.push("locked"),0!=(e&t.PdfAnnotationFlag.noRotate)&&i.push("norotate"),0!=(e&t.PdfAnnotationFlag.noView)&&i.push("noview"),0!=(e&t.PdfAnnotationFlag.noZoom)&&i.push("nozoom"),0!=(e&t.PdfAnnotationFlag.print)&&i.push("print"),0!=(e&t.PdfAnnotationFlag.readOnly)&&i.push("readonly"),0!=(e&t.PdfAnnotationFlag.toggleNoView)&&i.push("togglenoview"),0!=(e&t.PdfAnnotationFlag.default)&&i.push("default"),i.join(",")}function p(e){switch(e){case"hidden":return t.PdfAnnotationFlag.hidden;case"invisible":return t.PdfAnnotationFlag.invisible;case"locked":return t.PdfAnnotationFlag.locked;case"norotate":return t.PdfAnnotationFlag.noRotate;case"noview":return t.PdfAnnotationFlag.noView;case"nozoom":return t.PdfAnnotationFlag.noZoom;case"print":return t.PdfAnnotationFlag.print;case"readonly":return t.PdfAnnotationFlag.readOnly;case"togglenoview":return t.PdfAnnotationFlag.toggleNoView;default:return t.PdfAnnotationFlag.default}}function l(t){if(t.charCodeAt(0)>="ï".charCodeAt(0)){var e=void 0;if("ï"===t[0]&&"»"===t[1]&&"¿"===t[2]?e="utf-8":"ÿ"===t[0]&&"þ"===t[1]?e="utf-16le":"þ"===t[0]&&"ÿ"===t[1]&&(e="utf-16be"),e)try{return new TextDecoder(e,{fatal:!0}).decode(u(t))}catch(t){}}for(var i=[],r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364],n=0;n<t.length;n++){var s=r[t.charCodeAt(n)];i.push(s?String.fromCharCode(s):t.charAt(n))}return i.join("")}function u(t,e){void 0===e&&(e=!1);for(var i=[],r=0;r<t.length;++r)i.push(255&t.charCodeAt(r));return e?i:new Uint8Array(i)}function f(t,e){for(var i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}function g(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[Number.parseInt(i.toString(),10)]!==e[Number.parseInt(i.toString(),10)])return!1;return!0}function y(t){return Number.isInteger(t)?t.toString():t.toFixed(7)}function m(t,e){var i=!1;if(t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r]!==e[r]){i=!0;break}return i}function b(t){var e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);for(var i=[],r=0;r<e;r+=8192){var n=Math.min(r+8192,e),s=t.subarray(r,n);i.push(String.fromCharCode.apply(null,s))}return i.join("")}function v(t){var e=[];if(null!==t&&void 0!==t)for(var i=0;i<t.length;i++){var r=t.charCodeAt(i);e.push(r/256>>>0),e.push(255&r)}return new Uint8Array(e)}function S(t){for(var e,i=[],r=0;r<t.length;r++)(e=t[Number.parseInt(r.toString(),10)].toString(16).toUpperCase()).length<2&&(e="0"+e),i.push(e);return i.join("")}function w(t,e){void 0===e&&(e=!1);var i=[];if(t)for(var r=0;r<t.length;r+=2)i.push(Number.parseInt(t.substring(r,r+2),16));return e?i:new Uint8Array(i)}function P(t){var e="";if(t&&"#"===t[0]){t=t.substring(1);for(var i=0;i<t.length;i+=2)e+=String.fromCharCode(Number.parseInt(t.substring(i,i+2),16));return e}return t}function A(t){return 32===t||9===t||13===t||10===t}function k(t,e){void 0===e&&(e=!1);var i,r,n,s,a,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=0,c=0,_=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;t.charAt(t.length-1)===o.charAt(64)&&_--;for(var d=new Array(0|_);h<t.length;)i=o.indexOf(t.charAt(h++))<<2|(s=o.indexOf(t.charAt(h++)))>>4,r=(15&s)<<4|(a=o.indexOf(t.charAt(h++)))>>2,n=(3&a)<<6|o.indexOf(t.charAt(h++)),c<_&&(d[c++]=i),c<_&&(d[c++]=r),c<_&&(d[c++]=n);return e?d:new Uint8Array(d)}function x(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="",r=0,n=0;n<t.length;n++)n%3==0?(r=t[Number.parseInt(n.toString(),10)]>>2,i+=e[Number.parseInt(r.toString(),10)],r=t[Number.parseInt(n.toString(),10)]<<4&63):n%3==1?(r+=t[Number.parseInt(n.toString(),10)]>>4,i+=e[Number.parseInt(r.toString(),10)],r=t[Number.parseInt(n.toString(),10)]<<2&63):n%3==2&&(r+=t[Number.parseInt(n.toString(),10)]>>6,i+=e[Number.parseInt(r.toString(),10)],r=63&t[Number.parseInt(n.toString(),10)],i+=e[Number.parseInt(r.toString(),10)]);return t.length%3==1&&(i+=e[Number.parseInt(r.toString(),10)]+"=="),t.length%3==2&&(i+=e[Number.parseInt(r.toString(),10)]+"="),i}function T(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=!0);for(var n=[],s=4;s<arguments.length;s++)n[s-4]=arguments[s];for(var a,o=new Set;t instanceof xr&&t.objId&&!o.has(t.objId);){t.objId&&o.add(t.objId);var h=i?t.getArray(e):t.get(e);if(void 0!==h){if(r)return h;a||(a=[]),a.push(h)}for(var c=0,_=!1;c<n.length;){var d=n[c];if(t.has(d)){t=t.get(d),_=!0;break}c++}if(!_)break}return a}function I(t,e){var i={x:0,y:0,width:0,height:0},r=t.getArray("Rect");if(r&&Array.isArray(r)){var n=r[0],s=r[1],a=r[2],o=r[3];void 0!==n&&void 0!==s&&void 0!==a&&void 0!==o&&(i.x=Math.min(n,a),i.y=Math.min(s,o),i.width=Math.max(n,a)-i.x,i.height=Math.max(s,o)-i.y,e&&(i.height=parseFloat(i.height.toFixed(3)),r[1]<0&&(i.y=r[1],r[1]>r[3]&&(i.y-=i.height))))}return i}function N(t,e){var i;if(t.has("Rect"))if(i=I(t),e){var r=e.size,n=e.mediaBox,s=e.cropBox;s&&Array.isArray(s)&&4===s.length&&e._pageDictionary.has("CropBox")?0===s[0]&&0===s[1]&&r[0]!==s[2]&&r[1]!==s[3]||i.x===s[0]?i.y=r[1]-(i.y+i.height):(i.x-=s[0],i.y=s[3]-(i.y+i.height)):n&&Array.isArray(n)&&4===n.length&&e._pageDictionary.has("MediaBox")&&(n[0]>0||n[1]>0||r[0]===n[2]||r[1]===n[3])?(i.x-=n[0],i.y=n[3]-(i.y+i.height)):i.y=r[1]-(i.y+i.height)}else i.y=i.y+i.height;return i}function C(t){return{x:Math.min(t[0],t[2]),y:Math.min(t[1],t[3]),width:Math.abs(t[0]-t[2]),height:Math.abs(t[1]-t[3])}}function R(t){return[t.x,t.y,t.x+t.width,t.y+t.height]}function F(t,e){var i=t[0],r=t[1],n=t[2],s=t[3];if(e){var a=e.size,o=a[0],h=a[1],c=e.mediaBox,_=e.cropBox;_&&Array.isArray(_)&&4===_.length?0!==_[0]||0!==_[1]||o===_[2]||h===_[3]?(i+=_[0],r=_[3]-(r+s)):r=h-(r+s):c&&Array.isArray(c)&&4===c.length&&(c[0]>0||c[1]>0||o===c[2]||h===c[3])?(i-=c[0],r=c[3]-(r+s)):r=h-(r+s)}return[i,r,i+n,r+s]}function B(t){var e=Z(t);if(!e){var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);i&&(e=[Number.parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)])}return e}function L(t){var e;if(t)if(1===t.length){var i=t[0];if(void 0!==i){var r=Math.round(255*i);e=[r,r,r]}}else if(3===t.length){var n=t[0],s=t[1],a=t[2];void 0!==n&&void 0!==s&&void 0!==a&&(e=[Math.round(255*n),Math.round(255*s),Math.round(255*a)])}else if(4===t.length){var o=t[0],h=t[1],c=t[2],_=t[3];if(void 0!==o&&void 0!==h&&void 0!==c&&void 0!==_){var d=255*_;e=[Math.round(255-Math.min(255,o*(255-d)+d)),Math.round(255-Math.min(255,h*(255-d)+d)),Math.round(255-Math.min(255,c*(255-d)+d))]}}return e}function M(e){var i="S";switch(e){case t.PdfBorderStyle.dot:case t.PdfBorderStyle.dashed:i="D";break;case t.PdfBorderStyle.beveled:i="B";break;case t.PdfBorderStyle.inset:i="I";break;case t.PdfBorderStyle.underline:i="U"}return vr.get(i)}function D(e){var i=t.PdfBorderEffectStyle.solid;switch(e){case"C":i=t.PdfBorderEffectStyle.cloudy}return i}function O(e){var i="None";if(void 0!==e)switch(e){case t.PdfLineEndingStyle.openArrow:i="OpenArrow";break;case t.PdfLineEndingStyle.closedArrow:i="ClosedArrow";break;case t.PdfLineEndingStyle.rOpenArrow:i="ROpenArrow";break;case t.PdfLineEndingStyle.rClosedArrow:i="RClosedArrow";break;case t.PdfLineEndingStyle.butt:i="Butt";break;case t.PdfLineEndingStyle.diamond:i="Diamond";break;case t.PdfLineEndingStyle.circle:i="Circle";break;case t.PdfLineEndingStyle.square:i="Square";break;case t.PdfLineEndingStyle.slash:i="Slash"}return i}function E(e,i){var r=void 0!==i?i:t.PdfLineEndingStyle.none;switch(e.toLowerCase()){case"openarrow":r=t.PdfLineEndingStyle.openArrow;break;case"closedarrow":r=t.PdfLineEndingStyle.closedArrow;break;case"ropenarrow":r=t.PdfLineEndingStyle.rOpenArrow;break;case"rclosedarrow":r=t.PdfLineEndingStyle.rClosedArrow;break;case"butt":r=t.PdfLineEndingStyle.butt;break;case"diamond":r=t.PdfLineEndingStyle.diamond;break;case"circle":r=t.PdfLineEndingStyle.circle;break;case"square":r=t.PdfLineEndingStyle.square;break;case"slash":r=t.PdfLineEndingStyle.slash}return r}function V(e){switch(e){case"P":return t.PdfHighlightMode.push;case"N":return t.PdfHighlightMode.noHighlighting;case"O":return t.PdfHighlightMode.outline;default:return t.PdfHighlightMode.invert}}function j(e){switch(e){case t.PdfHighlightMode.push:return vr.get("P");case t.PdfHighlightMode.noHighlighting:return vr.get("N");case t.PdfHighlightMode.outline:return vr.get("O");default:return vr.get("I")}}function z(e){var i="Normal";switch(e){case t.PdfBlendMode.multiply:i="Multiply";break;case t.PdfBlendMode.screen:i="Screen";break;case t.PdfBlendMode.overlay:i="Overlay";break;case t.PdfBlendMode.darken:i="Darken";break;case t.PdfBlendMode.lighten:i="Lighten";break;case t.PdfBlendMode.colorDodge:i="ColorDodge";break;case t.PdfBlendMode.colorBurn:i="ColorBurn";break;case t.PdfBlendMode.hardLight:i="HardLight";break;case t.PdfBlendMode.softLight:i="SoftLight";break;case t.PdfBlendMode.difference:i="Difference";break;case t.PdfBlendMode.exclusion:i="Exclusion";break;case t.PdfBlendMode.hue:i="Hue";break;case t.PdfBlendMode.saturation:i="Saturation";break;case t.PdfBlendMode.color:i="Color";break;case t.PdfBlendMode.luminosity:i="Luminosity";break;default:i="Normal"}return vr.get(i)}function U(e){var i=t.PdfBlendMode.normal;switch(e.name){case"Multiply":i=t.PdfBlendMode.multiply;break;case"Screen":i=t.PdfBlendMode.screen;break;case"Overlay":i=t.PdfBlendMode.overlay;break;case"Darken":i=t.PdfBlendMode.darken;break;case"Lighten":i=t.PdfBlendMode.lighten;break;case"ColorDodge":i=t.PdfBlendMode.colorDodge;break;case"ColorBurn":i=t.PdfBlendMode.colorBurn;break;case"HardLight":i=t.PdfBlendMode.hardLight;break;case"SoftLight":i=t.PdfBlendMode.softLight;break;case"Difference":i=t.PdfBlendMode.difference;break;case"Exclusion":i=t.PdfBlendMode.exclusion;break;case"Hue":i=t.PdfBlendMode.hue;break;case"Saturation":i=t.PdfBlendMode.saturation;break;case"Color":i=t.PdfBlendMode.color;break;case"Luminosity":i=t.PdfBlendMode.luminosity;break;default:i=t.PdfBlendMode.normal}return i}function W(t){var e=t.toFixed(2);return"0.00"===e&&(e=".00"),e}function H(t,e){var i=vr.get(t);if(e.has("ProcSet")){var r=e.getArray("ProcSet");r&&-1===r.indexOf(i)&&(r.push(i),e.update("ProcSet",r))}else e.update("ProcSet",[i])}function G(){return"aaaaaaaa-aaaa-4aaa-baaa-aaaaaaaaaaaa".replace(/[ab]/g,function(t){var e=16*Math.random()|0;return("a"===t?e:3&e|8).toString(16)})}function K(t){for(var e=[],i=0,r=0;r<t.length;r++){var n=t.charCodeAt(r);(n<33||n>126||35===n||40===n||41===n||60===n||62===n||91===n||93===n||123===n||125===n||47===n||37===n)&&(i<r&&e.push(t.substring(i,r)),e.push("#"+n.toString(16)),i=r+1)}return 0===e.length?t:(i<t.length&&e.push(t.substring(i,t.length)),e.join(""))}function q(t,e,i,r,n,s){if(t>i){a=t;t=i,i=a}if(r>e){var a=e;e=r,r=a}var o,h;Math.abs(s)<=90?(o=s,h=1):o=s/(h=Math.ceil(Math.abs(s)/90));for(var c=(t+i)/2,_=(e+r)/2,d=(i-t)/2,p=(r-e)/2,l=o*(Math.PI/360),u=Math.abs(4/3*(1-Math.cos(l))/Math.sin(l)),f=[],g=0;g<h;g++){var y=(n+g*o)*(Math.PI/180),m=(n+(g+1)*o)*(Math.PI/180),b=Math.cos(y),v=Math.cos(m),S=Math.sin(y),w=Math.sin(m);o>0?(f.push(c+d*b),f.push(_-p*S),f.push(c+d*(b-u*S)),f.push(_-p*(S+u*b)),f.push(c+d*(v+u*w)),f.push(_-p*(w-u*v)),f.push(c+d*v),f.push(_-p*w)):(f.push(c+d*b),f.push(_-p*S),f.push(c+d*(b+u*S)),f.push(_-p*(S-u*b)),f.push(c+d*(v-u*w)),f.push(_-p*(w+u*v)),f.push(c+d*v),f.push(_-p*w))}return f}function X(t,e){for(var i,r=0;r<t.pageCount&&void 0===i;r++){var n=t.getPage(r);if(n&&n._pageDictionary.has("Annots")){var s=n._pageDictionary.get("Annots");if(null!==s&&void 0!==s&&s.length>0)for(var a=0;a<s.length&&void 0===i;a++){var o=s[Number.parseInt(a.toString(),10)];null!==o&&void 0!==o&&o instanceof wr&&o===e&&(i=n)}}}return i}function J(t){var e=!1;if(t.has("AS")){var i=t.get("AS");if(i)e="Off"!==i.name;else{var r=t.get("V");r&&(e=r.name===Q(t))}}return e}function Q(t){var e,i="";if(t.has("AS")&&null!==(e=t.get("AS"))&&"Off"!==e.name&&(i=e.name),""===i&&t.has("AP")){var r=t.get("AP");if(r&&r.has("N")){var n=r.get("N");if(n instanceof Nr&&(n=n.dictionary),n&&n instanceof xr){var s=[];n.forEach(function(t,e){s.push(t)});for(var a=0;a<s.length;a++)if("Off"!==s[Number.parseInt(a.toString(),10)]){i=s[Number.parseInt(a.toString(),10)];break}}}}return i}function Y(e,i){var r,n=e===t._PdfCheckFieldState.checked?Q(i._dictionary):"Off";if(i._dictionary.has("AP")){var s=i._dictionary.get("AP");if(s&&s.has("N")){var a=s.get("N");if(a&&a instanceof Nr&&(a=a.dictionary),a&&a instanceof xr&&n&&""!==n&&a.has(n)){var o=a.get(n),h=a.getRaw(n);h&&(o.reference=h),o&&(r=new Ye(o,i._crossReference))}}}return r}function Z(t){var e;switch(t){case"transparent":e=[255,255,255];break;case"aliceblue":e=[240,248,255];break;case"antiquewhite":e=[250,235,215];break;case"aqua":e=[0,255,255];break;case"aquamarine":e=[127,255,212];break;case"azure":e=[240,255,255];break;case"beige":e=[245,245,220];break;case"bisque":e=[255,228,196];break;case"black":e=[0,0,0];break;case"blanchedalmond":e=[255,235,205];break;case"blue":e=[0,0,255];break;case"blueviolet":e=[138,43,226];break;case"brown":e=[165,42,42];break;case"burlywood":e=[222,184,135];break;case"cadetBlue":e=[95,158,160];break;case"chartreuse":e=[127,255,0];break;case"chocolate":e=[210,105,30];break;case"coral":e=[255,127,80];break;case"cornflowerblue":e=[100,149,237];break;case"cornsilk":e=[255,248,220];break;case"crimson":e=[220,20,60];break;case"cyan":e=[0,255,255];break;case"darkblue":e=[0,0,139];break;case"darkcyan":e=[0,139,139];break;case"darkgoldenrod":e=[184,134,11];break;case"darkgray":e=[169,169,169];break;case"darkgreen":e=[0,100,0];break;case"darkkhaki":e=[189,183,107];break;case"darkmagenta":e=[139,0,139];break;case"darkolivegreen":e=[85,107,47];break;case"darkorange":e=[255,140,0];break;case"darkorchid":e=[153,50,204];break;case"darkred":e=[139,0,0];break;case"darksalmon":e=[233,150,122];break;case"darkseagreen":e=[143,188,139];break;case"darkslateblue":e=[72,61,139];break;case"darkslategray":e=[47,79,79];break;case"darkturquoise":e=[0,206,209];break;case"darkviolet":e=[148,0,211];break;case"deeppink":e=[255,20,147];break;case"deepskyblue":e=[0,191,255];break;case"dimgray":e=[105,105,105];break;case"dodgerblue":e=[30,144,255];break;case"firebrick":e=[178,34,34];break;case"floralwhite":e=[255,250,240];break;case"forestgreen":e=[34,139,34];break;case"fuchsia":e=[255,0,255];break;case"gainsboro":e=[220,220,220];break;case"ghostwhite":e=[248,248,255];break;case"gold":e=[255,215,0];break;case"goldenrod":e=[218,165,32];break;case"gray":e=[128,128,128];break;case"green":e=[0,128,0];break;case"greenyellow":e=[173,255,47];break;case"honeydew":e=[240,255,240];break;case"hotpink":e=[255,105,180];break;case"indianred":e=[205,92,92];break;case"indigo":e=[75,0,130];break;case"ivory":e=[255,255,240];break;case"khaki":e=[240,230,140];break;case"lavender":e=[230,230,250];break;case"lavenderblush":e=[255,240,245];break;case"lawngreen":e=[124,252,0];break;case"lemonchiffon":e=[255,250,205];break;case"lightblue":e=[173,216,230];break;case"lightcoral":e=[240,128,128];break;case"lightcyan":e=[224,255,255];break;case"lightgoldenrodyellow":e=[250,250,210];break;case"lightgreen":e=[144,238,144];break;case"lightgray":e=[211,211,211];break;case"LightPink":e=[255,182,193];break;case"lightsalmon":e=[255,160,122];break;case"lightseagreen":e=[32,178,170];break;case"lightskyblue":e=[135,206,250];break;case"lightslategray":e=[119,136,153];break;case"lightsteelblue":e=[176,196,222];break;case"lightyellow":e=[255,255,224];break;case"lime":e=[0,255,0];break;case"limeGreen":e=[50,205,50];break;case"linen":e=[250,240,230];break;case"magenta":e=[255,0,255];break;case"maroon":e=[128,0,0];break;case"mediumaquamarine":e=[102,205,170];break;case"mediumblue":e=[0,0,205];break;case"mediumorchid":e=[186,85,211];break;case"mediumpurple":e=[147,112,219];break;case"mediumseagreen":e=[60,179,113];break;case"mediumslateblue":e=[123,104,238];break;case"mediumspringgreen":e=[0,250,154];break;case"mediumturquoise":e=[72,209,204];break;case"mediumvioletred":e=[199,21,133];break;case"midnightblue":e=[25,25,112];break;case"mintcream":e=[245,255,250];break;case"mistyrose":e=[255,228,225];break;case"moccasin":e=[255,228,181];break;case"navajowhite":e=[255,222,173];break;case"navy":e=[0,0,128];break;case"oldLace":e=[253,245,230];break;case"olive":e=[128,128,0];break;case"olivedrab":e=[107,142,35];break;case"orange":e=[255,165,0];break;case"orangered":e=[255,69,0];break;case"orchid":e=[218,112,214];break;case"palegoldenrod":e=[238,232,170];break;case"palegreen":e=[152,251,152];break;case"paleturquoise":e=[175,238,238];break;case"palebioletred":e=[219,112,147];break;case"papayawhip":e=[255,239,213];break;case"peachpuff":e=[255,218,185];break;case"peru":e=[205,133,63];break;case"pink":e=[255,192,203];break;case"plum":e=[221,160,221];break;case"powderblue":e=[176,224,230];break;case"purple":e=[128,0,128];break;case"red":e=[255,0,0];break;case"rosybrown":e=[188,143,143];break;case"royalblue":e=[65,105,225];break;case"saddlebrown":e=[139,69,19];break;case"salmon":e=[250,128,114];break;case"sandybrown":e=[244,164,96];break;case"seagreen":e=[46,139,87];break;case"seashell":e=[255,245,238];break;case"sienna":e=[160,82,45];break;case"silver":e=[192,192,192];break;case"skyblue":e=[135,206,235];break;case"slateblue":e=[106,90,205];break;case"slategray":e=[112,128,144];break;case"snow":e=[255,250,250];break;case"springgreen":e=[0,255,127];break;case"steelblue":e=[70,130,180];break;case"tan":e=[210,180,140];break;case"teal":e=[0,128,128];break;case"thistle":e=[216,191,216];break;case"tomato":e=[255,99,71];break;case"turquoise":e=[64,224,208];break;case"violet":e=[238,130,238];break;case"wheat":e=[245,222,179];break;case"white":e=[255,255,255];break;case"whitesmoke":e=[245,245,245];break;case"yellow":e=[255,255,0];break;case"yellowgreen":e=[154,205,50]}return e}function $(t,e){var i=t._content.dictionary.getArray("BBox");if(i&&void 0!==e&&null!==e)if(0===e)t._content.dictionary.set("Matrix",[1,0,0,1,-i[0],-i[1]]);else{var r=new Le;90===e?r._translate(i[3],-i[0]):180===e?r._translate(i[2],i[3]):270===e&&r._translate(-i[1],i[2]),r._rotate(e),t._content.dictionary.set("Matrix",r._matrix._elements)}}function tt(e){var i="4";switch(e){case t.PdfCheckBoxStyle.circle:i="l";break;case t.PdfCheckBoxStyle.cross:i="8";break;case t.PdfCheckBoxStyle.diamond:i="u";break;case t.PdfCheckBoxStyle.square:i="n";break;case t.PdfCheckBoxStyle.star:i="H"}return i}function et(e){var i=t.PdfCheckBoxStyle.check;switch(e){case"l":i=t.PdfCheckBoxStyle.circle;break;case"8":i=t.PdfCheckBoxStyle.cross;break;case"u":i=t.PdfCheckBoxStyle.diamond;break;case"n":i=t.PdfCheckBoxStyle.square;break;case"H":i=t.PdfCheckBoxStyle.star}return i}function it(e){var i;switch(e){case"cm":i=t.PdfMeasurementUnit.centimeter;break;case"in":i=t.PdfMeasurementUnit.inch;break;case"mm":i=t.PdfMeasurementUnit.millimeter;break;case"p":i=t.PdfMeasurementUnit.pica;break;case"pt":i=t.PdfMeasurementUnit.point;break;default:i=t.PdfMeasurementUnit.centimeter}return i}function rt(e){var i;switch(e){case"Highlight":i=t.PdfTextMarkupAnnotationType.highlight;break;case"Squiggly":i=t.PdfTextMarkupAnnotationType.squiggly;break;case"StrikeOut":i=t.PdfTextMarkupAnnotationType.strikeOut;break;case"Underline":i=t.PdfTextMarkupAnnotationType.underline;break;default:i=t.PdfTextMarkupAnnotationType.highlight}return i}function nt(e){var i="Highlight";switch(e){case t.PdfTextMarkupAnnotationType.highlight:i="Highlight";break;case t.PdfTextMarkupAnnotationType.squiggly:i="Squiggly";break;case t.PdfTextMarkupAnnotationType.strikeOut:i="StrikeOut";break;case t.PdfTextMarkupAnnotationType.underline:i="Underline";break;default:i="Highlight"}return i}function st(e){var i;switch(e){case"cm":i=t._PdfGraphicsUnit.centimeter;break;case"in":i=t._PdfGraphicsUnit.inch;break;case"mm":i=t._PdfGraphicsUnit.millimeter;break;case"p":i=t._PdfGraphicsUnit.pica;break;case"pt":i=t._PdfGraphicsUnit.point;break;default:i=t._PdfGraphicsUnit.centimeter}return i}function at(e){var i;switch(e){case"#Approved":case"SBApproved":i=t.PdfRubberStampAnnotationIcon.approved;break;case"#AsIs":case"SBAsIs":i=t.PdfRubberStampAnnotationIcon.asIs;break;case"#Completed":case"SBCompleted":i=t.PdfRubberStampAnnotationIcon.completed;break;case"#Confidential":case"SBConfidential":i=t.PdfRubberStampAnnotationIcon.confidential;break;case"#Departmental":case"SBDepartmental":i=t.PdfRubberStampAnnotationIcon.departmental;break;case"#Draft":case"SBDraft":i=t.PdfRubberStampAnnotationIcon.draft;break;case"#Experimental":case"SBExperimental":i=t.PdfRubberStampAnnotationIcon.experimental;break;case"#Expired":case"SBExpired":i=t.PdfRubberStampAnnotationIcon.expired;break;case"#Final":case"SBFinal":i=t.PdfRubberStampAnnotationIcon.final;break;case"#ForComment":case"SBForComment":i=t.PdfRubberStampAnnotationIcon.forComment;break;case"#ForPublicRelease":case"SBForPublicRelease":i=t.PdfRubberStampAnnotationIcon.forPublicRelease;break;case"#InformationOnly":case"SBInformationOnly":i=t.PdfRubberStampAnnotationIcon.informationOnly;break;case"#NotApproved":case"SBNotApproved":i=t.PdfRubberStampAnnotationIcon.notApproved;break;case"#NotForPublicRelease":case"SBNotForPublicRelease":i=t.PdfRubberStampAnnotationIcon.notForPublicRelease;break;case"#PreliminaryResults":case"SBPreliminaryResults":i=t.PdfRubberStampAnnotationIcon.preliminaryResults;break;case"#Sold":case"SBSold":i=t.PdfRubberStampAnnotationIcon.sold;break;case"#TopSecret":case"SBTopSecret":i=t.PdfRubberStampAnnotationIcon.topSecret;break;case"#Void":case"SBVoid":i=t.PdfRubberStampAnnotationIcon.void;break;default:i=t.PdfRubberStampAnnotationIcon.draft}return i}function ot(e){var i;switch(e){case"Note":i=t.PdfPopupIcon.note;break;case"Comment":i=t.PdfPopupIcon.comment;break;case"Help":i=t.PdfPopupIcon.help;break;case"Insert":i=t.PdfPopupIcon.insert;break;case"Key":i=t.PdfPopupIcon.key;break;case"NewParagraph":i=t.PdfPopupIcon.newParagraph;break;case"Paragraph":i=t.PdfPopupIcon.paragraph;break;default:i=t.PdfPopupIcon.note}return i}function ht(e){var i="None";switch(e){case t.PdfAnnotationState.none:i="None";break;case t.PdfAnnotationState.accepted:i="Accepted";break;case t.PdfAnnotationState.rejected:i="Rejected";break;case t.PdfAnnotationState.cancel:i="Cancelled";break;case t.PdfAnnotationState.completed:i="Completed";break;case t.PdfAnnotationState.marked:i="Marked";break;case t.PdfAnnotationState.unmarked:i="Unmarked";break;case t.PdfAnnotationState.unknown:i="Unknown";break;default:i="None"}return i}function ct(e){var i=t.PdfAnnotationState.none;switch(e){case"None":i=t.PdfAnnotationState.none;break;case"Accepted":i=t.PdfAnnotationState.accepted;break;case"Rejected":i=t.PdfAnnotationState.rejected;break;case"Cancelled":i=t.PdfAnnotationState.cancel;break;case"Completed":i=t.PdfAnnotationState.completed;break;case"Marked":i=t.PdfAnnotationState.marked;break;case"Unmarked":i=t.PdfAnnotationState.unmarked;break;case"Unknown":i=t.PdfAnnotationState.unknown}return i}function _t(e){var i="None";switch(e){case t.PdfAnnotationStateModel.none:i="None";break;case t.PdfAnnotationStateModel.marked:i="Marked";break;case t.PdfAnnotationStateModel.review:i="Review";break;default:i="None"}return i}function dt(e){var i=t.PdfAnnotationStateModel.none;switch(e){case"None":i=t.PdfAnnotationStateModel.none;break;case"Marked":i=t.PdfAnnotationStateModel.marked;break;case"Review":i=t.PdfAnnotationStateModel.review}return i}function pt(e){var i;switch(e){case"PushPin":i=t.PdfAttachmentIcon.pushPin;break;case"Tag":i=t.PdfAttachmentIcon.tag;break;case"Graph":i=t.PdfAttachmentIcon.graph;break;case"Paperclip":i=t.PdfAttachmentIcon.paperClip;break;default:i=t.PdfAttachmentIcon.pushPin}return i}function lt(e){var i;switch(e){case"None":i=t.PdfAnnotationIntent.none;break;case"FreeTextCallout":i=t.PdfAnnotationIntent.freeTextCallout;break;case"FreeTextTypeWriter":i=t.PdfAnnotationIntent.freeTextTypeWriter;break;default:i=t.PdfAnnotationIntent.none}return i}function ut(e){var i="";switch(e){case t.PdfFontStyle.regular:i="Regular";break;case t.PdfFontStyle.bold:i="Bold";break;case t.PdfFontStyle.italic:i="Italic";break;case t.PdfFontStyle.underline:i="Underline";break;case t.PdfFontStyle.strikeout:i="Strikeout";break;default:i="Regular"}return i}function ft(t){var e;switch(t){case"head2right":e="➢";break;case"aacute":e="á";break;case"eacute":e="é";break;case"iacute":e="í";break;case"oacute":e="ó";break;case"uacute":e="ú";break;case"circleright":e="➲";break;case"bleft":e="⇦";break;case"bright":e="⇨";break;case"bup":e="⇧";break;case"bdown":e="⇩";break;case"barb4right":e="➔";break;case"bleftright":e="⬄";break;case"bupdown":e="⇳";break;case"bnw":e="⬀";break;case"bne":e="⬁";break;case"bsw":e="⬃";break;case"bse":e="⬂";break;case"bdash1":e="▭";break;case"bdash2":e="▫";break;case"xmarkbld":e="✗";break;case"checkbld":e="✓";break;case"boxxmarkbld":e="☒";break;case"boxcheckbld":e="☑";break;case"space":e=" ";break;case"pencil":e="✏";break;case"scissors":e="✂";break;case"scissorscutting":case"readingglasses":case"bell":case"book":case"telephonesolid":case"telhandsetcirc":case"envelopeback":e="✁";break;case"hourglass":e="⌛";break;case"keyboard":e="⌨";break;case"tapereel":e="✇";break;case"handwrite":e="✍";break;case"handv":e="✌";break;case"handptleft":e="☜";break;case"handptright":e="☞";break;case"handptup":e="☝";break;case"handptdown":e="☟";break;case"smileface":e="☺";break;case"frownface":e="☹";break;case"skullcrossbones":e="☠";break;case"flag":e="⚐";break;case"pennant":e="Ὢ9";break;case"airplane":e="✈";break;case"sunshine":e="☼";break;case"droplet":e="Ὂ7";break;case"snowflake":e="❄";break;case"crossshadow":e="✞";break;case"crossmaltese":e="✠";break;case"starofdavid":e="✡";break;case"crescentstar":e="☪";break;case"yinyang":e="☯";break;case"om":e="ॐ";break;case"wheel":e="☸";break;case"aries":e="♈";break;case"taurus":e="♉";break;case"gemini":e="♊";break;case"cancer":e="♋";break;case"leo":e="♌";break;case"virgo":e="♍";break;case"libra":e="♎";break;case"scorpio":e="♏";break;case"saggitarius":e="♐";break;case"capricorn":e="♑";break;case"aquarius":e="♒";break;case"pisces":e="♓";break;case"ampersanditlc":case"ampersandit":e="&";break;case"circle6":e="●";break;case"circleshadowdwn":e="❍";break;case"square6":e="■";break;case"box3":e="□";break;case"boxshadowdwn":e="❑";break;case"boxshadowup":e="❒";break;case"lozenge4":e="⬧";break;case"lozenge6":e="⧫";break;case"rhombus6":e="◆";break;case"xrhombus":e="❖";break;case"rhombus4":e="⬥";break;case"clear":e="⌧";break;case"escape":e="⍓";break;case"command":e="⌘";break;case"rosette":e="❀";break;case"rosettesolid":e="✿";break;case"quotedbllftbld":e="❝";break;case"quotedblrtbld":e="❞";break;case".notdef":e="▯";break;case"zerosans":e="⓪";break;case"onesans":e="①";break;case"twosans":e="②";break;case"threesans":e="③";break;case"foursans":e="④";break;case"fivesans":e="⑤";break;case"sixsans":e="⑥";break;case"sevensans":e="⑦";break;case"eightsans":e="⑧";break;case"ninesans":e="⑨";break;case"tensans":e="⑩";break;case"zerosansinv":e="⓿";break;case"onesansinv":e="❶";break;case"twosansinv":e="❷";break;case"threesansinv":e="❸";break;case"foursansinv":e="❹";break;case"circle2":e="·";break;case"circle4":e="•";break;case"square2":e="▪";break;case"ring2":e="○";break;case"ringbutton2":e="◉";break;case"target":e="◎";break;case"square4":e="▪";break;case"box2":e="◻";break;case"crosstar2":e="✦";break;case"pentastar2":e="★";break;case"hexstar2":e="✶";break;case"octastar2":e="✴";break;case"dodecastar3":e="✹";break;case"octastar4":e="✵";break;case"registercircle":e="⌖";break;case"cuspopen":e="⟡";break;case"cuspopen1":e="⌑";break;case"circlestar":e="★";break;case"starshadow":e="✰";break;case"deleteleft":e="⌫";break;case"deleteright":e="⌦";break;case"scissorsoutline":e="✄";break;case"telephone":e="☏";break;case"telhandset":e="ὍE";break;case"handptlft1":e="☜";break;case"handptrt1":e="☞";break;case"handptlftsld1":e="☚";break;case"handptrtsld1":e="☛";break;case"handptup1":e="☝";break;case"handptdwn1":e="☟";break;case"xmark":e="✗";break;case"check":e="✓";break;case"boxcheck":e="☑";break;case"boxx":case"boxxbld":e="☒";break;case"circlex":e="=⌔";break;case"circlexbld":e="⌔";break;case"prohibit":case"prohibitbld":e="⦸";break;case"ampersanditaldm":case"ampersandbld":case"ampersandsans":case"ampersandsandm":e="&";break;case"interrobang":case"interrobangdm":case"interrobangsans":case"interrobngsandm":e="‽";break;case"sacute":e="ś";break;case"Sacute":e="Ś";break;case"eogonek":e="ę";break;case"cacute":e="ć";break;case"aogonek":e="ą";break;default:e=t}return e}function gt(t){var e;switch(t){case"zero":e="0";break;case"one":e="1";break;case"two":e="2";break;case"three":e="3";break;case"four":e="4";break;case"five":e="5";break;case"six":e="6";break;case"seven":e="7";break;case"eight":e="8";break;case"nine":e="9";break;case"aacute":e="á";break;case"asciicircum":e="^";break;case"asciitilde":e="~";break;case"asterisk":e="*";break;case"at":e="@";break;case"atilde":e="ã";break;case"backslash":e="\\";break;case"bar":e="|";break;case"braceleft":e="{";break;case"braceright":e="}";break;case"bracketleft":e="[";break;case"bracketright":e="]";break;case"breve":e="˘";break;case"brokenbar":e="|";break;case"bullet3":case"bullet":e="•";break;case"caron":e="ˇ";break;case"ccedilla":e="ç";break;case"cedilla":e="¸";break;case"cent":e="¢";break;case"circumflex":e="ˆ";break;case"colon":e=":";break;case"comma":e=",";break;case"copyright":e="©";break;case"currency1":e="¤";break;case"dagger":e="†";break;case"daggerdbl":e="‡";break;case"degree":e="°";break;case"dieresis":e="¨";break;case"divide":e="÷";break;case"dollar":e="$";break;case"dotaccent":e="˙";break;case"dotlessi":e="ı";break;case"eacute":e="é";break;case"middot":e="˙";break;case"edieresis":e="ë";break;case"egrave":e="è";break;case"ellipsis":e="...";break;case"emdash":e="—";break;case"endash":e="–";break;case"equal":e="=";break;case"eth":e="ð";break;case"exclam":e="!";break;case"exclamdown":e="¡";break;case"florin":e="ƒ";break;case"fraction":e="⁄";break;case"germandbls":e="ß";break;case"grave":e="`";break;case"greater":e=">";break;case"guillemotleft4":e="«";break;case"guillemotright4":e="»";break;case"guilsinglleft":e="‹";break;case"guilsinglright":e="›";break;case"hungarumlaut":e="˝";break;case"hyphen5":e="-";break;case"iacute":e="í";break;case"icircumflex":e="î";break;case"idieresis":e="ï";break;case"igrave":e="ì";break;case"less":e="<";break;case"logicalnot":e="¬";break;case"lslash":e="ł";break;case"Lslash":e="Ł";break;case"macron":e="¯";break;case"minus":e="−";break;case"mu":e="μ";break;case"multiply":e="×";break;case"ntilde":e="ñ";break;case"numbersign":e="#";break;case"oacute":e="ó";break;case"ocircumflex":e="ô";break;case"odieresis":e="ö";break;case"oe":e="oe";break;case"ogonek":e="˛";break;case"ograve":e="ò";break;case"onehalf":e="1/2";break;case"onequarter":e="1/4";break;case"onesuperior":e="¹";break;case"ordfeminine":e="ª";break;case"ordmasculine":e="º";break;case"otilde":e="õ";break;case"paragraph":e="¶";break;case"parenleft":e="(";break;case"parenright":e=")";break;case"percent":e="%";break;case"period":e=".";break;case"periodcentered":e="·";break;case"perthousand":e="‰";break;case"plus":e="+";break;case"plusminus":e="±";break;case"question":e="?";break;case"questiondown":e="¿";break;case"quotedbl":e="'";break;case"quotedblbase":e="„";break;case"quotedblleft":e="“";break;case"quotedblright":e="”";break;case"quoteleft":e="‘";break;case"quoteright":e="’";break;case"quotesinglbase":e="‚";break;case"quotesingle":e="'";break;case"registered":e="®";break;case"ring":e="˚";break;case"scaron":e="š";break;case"section":e="§";break;case"semicolon":e=";";break;case"slash":e="/";break;case"space6":case"space":e=" ";break;case"udieresis":e="ü";break;case"uacute":e="ú";break;case"Ecircumflex":e="Ê";break;case"hyphen":e="-";break;case"underscore":e="_";break;case"adieresis":e="ä";break;case"ampersand":e="&";break;case"Adieresis":e="Ä";break;case"Udieresis":e="Ü";break;case"ccaron":e="č";break;case"Scaron":e="Š";break;case"zcaron":e="ž";break;case"sterling":e="£";break;case"agrave":e="à";break;case"ecircumflex":e="ê";break;case"acircumflex":e="â";break;case"Oacute":e="Ó";break;default:e=t}return e}function yt(t){for(var e="",i=0;i<t.length;i++){var r=255&t.charCodeAt(i),n=String.fromCharCode(r),s="";switch(n){case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"{":case"}":case"/":case"#":e+="#",e+=1===(s=r.toString(16).toUpperCase()).length?"0"+s:s;break;default:r>126||r<37?(e+="#",e+=1===(s=r.toString(16).toUpperCase()).length?"0"+s:s):e+=n}}return e}function mt(t,e){return e?t.reviewHistory:t.comments}function bt(t){var e=t.get("F");return(t.has("State")||t.has("StateModel"))&&(30===e||128===e)}function vt(t){var e=t.get("F");return!(t.has("State")||t.has("StateModel")||28!==e&&128!==e)}function St(e,i){switch(e.has("F")&&(delete e._map.F,e._updated=!0),i){case t.PdfFormFieldVisibility.hidden:e.update("F",t.PdfAnnotationFlag.hidden);break;case t.PdfFormFieldVisibility.hiddenPrintable:e.update("F",t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print);break;case t.PdfFormFieldVisibility.visible:if(e.has("DV")&&(delete e._map.DV,e._updated=!0),e.has("MK")){var r=e.get("MK");r&&r.has("BG")&&(delete r._map.BG,r._updated=!0)}}}function wt(t,e,i){if(t&&t.has(i)){var r=t.getRaw(i);if(r&&r instanceof wr&&r._isNew){var n=t.get(i);if(n){n instanceof wr&&(n=e._fetch(n));var s=void 0;n instanceof xr?s=n:n instanceof Nr&&(s=n.dictionary),s&&s.has("Resources")&&Pt(s.get("Resources"),e)}e._cacheMap.delete(r)}}}function Pt(t,e){t&&t.size>0&&t.forEach(function(i,r){if(void 0!==i&&void 0!==r)if(r instanceof wr){var n=r;if(n._isNew){var s=t.get(i);s&&s instanceof xr&&("XObject"===i&&s.has("Resources")&&Pt(s.get("Resources"),e),e._cacheMap.delete(n))}}else r instanceof xr&&(r.has("Resources")&&Pt(r.get("Resources"),e),"Font"!==i&&"XObject"!==i&&"ExtGState"!==i||Pt(r,e))})}function At(t,e,i,r){var n;t&&(t instanceof xr?n=t:t instanceof Cr&&(n=t.dictionary)),n&&(wt(n,e,i),wt(n,e,r))}function kt(t){return"[object String]"===Object.prototype.toString.call(t)?"$s"+t:"$o"+t.toString()}function xt(e,i,r){var n,s,a,o="";if((i&&i._dictionary.has("DA")||r._dictionary.has("DA"))&&(a=i&&i._dictionary.has("DA")?i._dictionary.get("DA"):r._dictionary.get("DA")),a&&""!==a&&-1!==a.indexOf("Tf"))for(var h=a.split(" "),c=0;c<h.length;c++)if(-1!==h[Number.parseInt(c.toString(),10)].indexOf("Tf")){for(o=h[c-2];""!==o&&o.length>1&&"/"===o[0];)o=o.substring(1);n=Number.parseFloat(h[c-1])}if(o&&(o=o.trim()),e&&e._dictionary.has("DR")){var _=e._dictionary.get("DR");if(_.has("Font")){var d=_.get("Font");if(d.has(o)){var p=d.get(o);if(p&&o&&p.has("BaseFont")){var l=p.get("BaseFont"),u=t.PdfFontStyle.regular;l&&(a=l.name,u=Tt(l.name),a.includes("-")&&(a=a.substring(0,a.indexOf("-"))),i&&i._dictionary.has("DA")?s=It(a,n,u,i):r&&r._dictionary.has("DA")&&(s=It(a,n,u,r)))}}}}return null!==s&&void 0!==s||!n||(s=new Ae(t.PdfFontFamily.helvetica,n,t.PdfFontStyle.regular)),(null===s||void 0===s||s&&1===s.size)&&(i?s=i._circleCaptionFont:r&&(s=r._circleCaptionFont)),s}function Tt(e){var i=e.indexOf("-");i<0&&(i=e.indexOf(","));var r=t.PdfFontStyle.regular;if(i>=0)switch(e.substring(i+1,e.length)){case"Bold":case"BoldMT":r=t.PdfFontStyle.bold;break;case"Italic":case"ItalicMT":case"Oblique":case"It":r=t.PdfFontStyle.italic;break;case"BoldItalic":case"BoldItalicMT":case"BoldOblique":r=t.PdfFontStyle.bold|t.PdfFontStyle.italic}return r}function It(e,i,r,n){var s,a=e||"";a.includes("-")&&(a=a.substring(0,a.indexOf("-"))),void 0===i&&n instanceof gi&&n._isLoaded&&(i=10);var o=void 0!==i?i:1;if(n._dictionary.has("DS")||n._dictionary.has("DA"))switch(a){case"Helvetica":s=new Ae(t.PdfFontFamily.helvetica,o,r);break;case"Courier":s=new Ae(t.PdfFontFamily.courier,o,r);break;case"Symbol":s=new Ae(t.PdfFontFamily.symbol,o,r);break;case"Times":case"TimesRoman":s=new Ae(t.PdfFontFamily.timesRoman,o,r);break;case"ZapfDingbats":s=new Ae(t.PdfFontFamily.zapfDingbats,o,r);break;case"MonotypeSungLight":s=new ke(t.PdfCjkFontFamily.monotypeSungLight,o,r);break;case"SinoTypeSongLight":s=new ke(t.PdfCjkFontFamily.sinoTypeSongLight,o,r);break;case"MonotypeHeiMedium":s=new ke(t.PdfCjkFontFamily.monotypeHeiMedium,o,r);break;case"HanyangSystemsGothicMedium":s=new ke(t.PdfCjkFontFamily.hanyangSystemsGothicMedium,o,r);break;case"HanyangSystemsShinMyeongJoMedium":s=new ke(t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium,o,r);break;case"HeiseiKakuGothicW5":s=new ke(t.PdfCjkFontFamily.heiseiKakuGothicW5,o,r);break;case"HeiseiMinchoW3":s=new ke(t.PdfCjkFontFamily.heiseiMinchoW3,o,r);break;default:if(n._dictionary.has("AP")){var h=Nt(n._dictionary,n._crossReference,n);if(n._hasData){var c=x(h);s=new xe(c,o,r)}}}return null!==s&&void 0!==s||(n instanceof ui?s=n._type!==t._PdfAnnotationType.widgetAnnotation?new Ae(t.PdfFontFamily.helvetica,o,r):n._circleCaptionFont:n instanceof ii&&(s=n._circleCaptionFont)),s}function Nt(t,e,i){var r,n=t.get("AP");if(n&&n.has("N")){var s=n.get("N");if(s&&s instanceof Cr&&s.dictionary.has("Resources")){var a=s.dictionary.get("Resources");if(a&&a.has("Font")){var o=a.get("Font");o&&o instanceof xr&&o.forEach(function(t,n){if(n){var s=e._fetch(n);if(s&&s.has("DescendantFonts")){var a=s.getArray("DescendantFonts");if(a&&a.length>0)for(var o=0;o<a.length;o++){var h=a[Number.parseInt(o.toString(),10)];if(h&&h instanceof xr&&h.has("FontDescriptor")){var c=h.get("FontDescriptor");if(c&&c.has("FontFile2")){var _=c.get("FontFile2");_&&_ instanceof Cr&&_.length>0&&(r=_.getByteRange(_.start,_.end))&&r.length>0&&(i._hasData=!0)}}}}}})}}}return r}function Ct(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(!g(t[Number.parseInt(i.toString(),10)],e[Number.parseInt(i.toString(),10)]))return!1;return!0}function Rt(e,i){var r,n;if(e){var s=void 0;e.has(i)&&(s=e.getArray(i));var a=e._crossReference._document,o=void 0;if(s&&Array.isArray(s)&&s.length>0){var h=s[0],d=void 0,p=void 0,l=void 0,u=void 0,f=void 0;if("number"==typeof h){var g=s[0];if(g>=0){var y=e._crossReference._document;if(y&&y.pageCount>g&&(r=y.getPage(g)),s.length>1&&(o=s[1]),o&&"XYZ"===o.name&&(s.length>2&&(d=s[2]),s.length>3&&(p=s[3]),s.length>4&&(f=s[4]),r)){var m=null===p||void 0===p?0:r.size[1]-p,b=null===d||void 0===d?0:d;r.rotation!==t.PdfRotationAngle.angle0&&c(r,p,d),(n=new $i(r,[b,m]))._index=g,n.zoom=void 0!==f&&null!==f?f:0,null!==d&&null!==p&&null!==f&&void 0!==d&&void 0!==p&&void 0!==f||n._setValidation(!1)}}}if(h instanceof xr){var v=h,S=void 0;if(a&&v&&(S=_(a,v)),void 0!==S&&null!==S&&S>=0&&(r=a.getPage(S)),s.length>1&&(o=s[1]),o)if("XYZ"===o.name){if(s.length>2&&(d=s[2]),s.length>3&&(p=s[3]),s.length>4&&(f=s[4]),r){var m=null===p||void 0===p?0:r.size[1]-p,b=null===d||void 0===d?0:d;r.rotation!==t.PdfRotationAngle.angle0&&(m=c(r,p,d)),(n=new $i(r,[b,m]))._index=S,n.zoom=void 0!==f&&null!==f?f:0,null!==d&&null!==p&&null!==f&&void 0!==d&&void 0!==p&&void 0!==f||n._setValidation(!1)}}else if("FitR"===o.name)s.length>2&&(d=s[2]),s.length>3&&(l=s[3]),s.length>4&&(u=s[4]),s.length>5&&(p=s[5]),r&&(d=null===d||void 0===d?0:d,l=null===l||void 0===l?0:l,p=null===p||void 0===p?0:p,(n=new $i(r,[d,l,u=null===u||void 0===u?0:u,p]))._index=S,n.mode=t.PdfDestinationMode.fitR);else if("FitBH"===o.name||"FitH"===o.name){if(s.length>=3&&(p=s[2]),void 0!==S&&null!==S&&S>=0&&(r=a.getPage(S)),r&&r.size){m=null===p||void 0===p?0:r.size[1]-p;(n=new $i(r,[0,m]))._index=S,n.mode=t.PdfDestinationMode.fitH,null!==p&&void 0!==p||n._setValidation(!1)}}else r&&"Fit"===o.name&&((n=new $i(r))._index=S,n.mode=t.PdfDestinationMode.fitToPage)}}}return n}function Ft(t,e){e&&(t._bounds={x:e[0],y:e[1],width:e[2],height:e[3]});var i;if(t._page&&t.bounds){if(i=[t.bounds.x,t.bounds.y+t.bounds.height,t.bounds.width,t.bounds.height],t._page._isNew&&t._page._pageSettings){var r=t._page._pageSettings,n=[r.margins.left,r.margins.top,r.size[0]-(r.margins.left+r.margins.right),r.size[1]-(r.margins.top+r.margins.bottom)];i[0]+=n[0],i[1]=r.size[1]-(n[1]+i[1])}else i=[t.bounds.x,t._page.size[1]-(t.bounds.y+t.bounds.height),t.bounds.width,t.bounds.height];return[i[0],i[1],i[0]+i[2],i[1]+i[3]]}return i}function Bt(t,e,i){if(t&&"string"==typeof t&&!e&&!i&&t.startsWith("þÿ")){(t=t.substring(2)).endsWith("ÿý")&&(t=t.substring(0,t.length-2));for(var r=u(t),n="",s=0;s<r.length;s+=2){var a=r[Number.parseInt(s.toString(),10)]<<8|r[Number.parseInt((s+1).toString(),10)];n+=String.fromCharCode(a)}t=n}return t}function Lt(){yr=Object.create(null),mr=Object.create(null),br=Object.create(null)}function Mt(t,e){return t instanceof vr&&(void 0===e||t.name===e)}function Dt(t,e){return t instanceof Sr&&(void 0===e||t.command===e)}!function(t){t[t.default=0]="default",t[t.invisible=1]="invisible",t[t.hidden=2]="hidden",t[t.print=4]="print",t[t.noZoom=8]="noZoom",t[t.noRotate=16]="noRotate",t[t.noView=32]="noView",t[t.readOnly=64]="readOnly",t[t.locked=128]="locked",t[t.toggleNoView=256]="toggleNoView"}(t.PdfAnnotationFlag||(t.PdfAnnotationFlag={})),function(t){t[t.none=0]="none",t[t.openArrow=1]="openArrow",t[t.closedArrow=2]="closedArrow",t[t.rOpenArrow=3]="rOpenArrow",t[t.rClosedArrow=4]="rClosedArrow",t[t.butt=5]="butt",t[t.diamond=6]="diamond",t[t.circle=7]="circle",t[t.square=8]="square",t[t.slash=9]="slash"}(t.PdfLineEndingStyle||(t.PdfLineEndingStyle={})),function(t){t[t.lineArrow=0]="lineArrow",t[t.lineDimension=1]="lineDimension"}(t.PdfLineIntent||(t.PdfLineIntent={})),function(t){t[t.inline=0]="inline",t[t.top=1]="top"}(t.PdfLineCaptionType||(t.PdfLineCaptionType={})),function(t){t[t.solid=0]="solid",t[t.dashed=1]="dashed",t[t.beveled=2]="beveled",t[t.inset=3]="inset",t[t.underline=4]="underline",t[t.dot=5]="dot"}(t.PdfBorderStyle||(t.PdfBorderStyle={})),function(t){t[t.solid=0]="solid",t[t.cloudy=1]="cloudy"}(t.PdfBorderEffectStyle||(t.PdfBorderEffectStyle={})),function(t){t[t.angle0=0]="angle0",t[t.angle90=1]="angle90",t[t.angle180=2]="angle180",t[t.angle270=3]="angle270"}(t.PdfRotationAngle||(t.PdfRotationAngle={})),function(t){t[t.table=0]="table",t[t.stream=1]="stream"}(t.PdfCrossReferenceType||(t.PdfCrossReferenceType={})),function(t){t[t.noHighlighting=0]="noHighlighting",t[t.invert=1]="invert",t[t.outline=2]="outline",t[t.push=3]="push"}(t.PdfHighlightMode||(t.PdfHighlightMode={})),function(t){t[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify"}(t.PdfTextAlignment||(t.PdfTextAlignment={})),function(t){t[t.visible=0]="visible",t[t.hidden=1]="hidden",t[t.visibleNotPrintable=2]="visibleNotPrintable",t[t.hiddenPrintable=3]="hiddenPrintable"}(t.PdfFormFieldVisibility||(t.PdfFormFieldVisibility={})),function(t){t[t.inch=0]="inch",t[t.pica=1]="pica",t[t.point=3]="point",t[t.centimeter=4]="centimeter",t[t.millimeter=6]="millimeter"}(t.PdfMeasurementUnit||(t.PdfMeasurementUnit={})),function(t){t[t.diameter=0]="diameter",t[t.radius=1]="radius"}(t.PdfCircleMeasurementType||(t.PdfCircleMeasurementType={})),function(t){t[t.approved=0]="approved",t[t.asIs=1]="asIs",t[t.confidential=2]="confidential",t[t.departmental=3]="departmental",t[t.draft=4]="draft",t[t.experimental=5]="experimental",t[t.expired=6]="expired",t[t.final=7]="final",t[t.forComment=8]="forComment",t[t.forPublicRelease=9]="forPublicRelease",t[t.notApproved=10]="notApproved",t[t.notForPublicRelease=11]="notForPublicRelease",t[t.sold=12]="sold",t[t.topSecret=13]="topSecret",t[t.completed=14]="completed",t[t.void=15]="void",t[t.informationOnly=16]="informationOnly",t[t.preliminaryResults=17]="preliminaryResults"}(t.PdfRubberStampAnnotationIcon||(t.PdfRubberStampAnnotationIcon={})),function(t){t[t.check=0]="check",t[t.circle=1]="circle",t[t.cross=2]="cross",t[t.diamond=3]="diamond",t[t.square=4]="square",t[t.star=5]="star"}(t.PdfCheckBoxStyle||(t.PdfCheckBoxStyle={})),function(t){t[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.squiggly=2]="squiggly",t[t.strikeOut=3]="strikeOut"}(t.PdfTextMarkupAnnotationType||(t.PdfTextMarkupAnnotationType={})),function(t){t[t.note=0]="note",t[t.comment=1]="comment",t[t.help=2]="help",t[t.insert=3]="insert",t[t.key=4]="key",t[t.newParagraph=5]="newParagraph",t[t.paragraph=6]="paragraph"}(t.PdfPopupIcon||(t.PdfPopupIcon={})),function(t){t[t.none=0]="none",t[t.accepted=1]="accepted",t[t.rejected=2]="rejected",t[t.cancel=3]="cancel",t[t.completed=4]="completed",t[t.marked=5]="marked",t[t.unmarked=6]="unmarked",t[t.unknown=7]="unknown"}(t.PdfAnnotationState||(t.PdfAnnotationState={})),function(t){t[t.none=0]="none",t[t.marked=1]="marked",t[t.review=2]="review"}(t.PdfAnnotationStateModel||(t.PdfAnnotationStateModel={})),function(t){t[t.pushPin=0]="pushPin",t[t.tag=1]="tag",t[t.graph=2]="graph",t[t.paperClip=3]="paperClip"}(t.PdfAttachmentIcon||(t.PdfAttachmentIcon={})),function(t){t[t.none=0]="none",t[t.freeTextCallout=1]="freeTextCallout",t[t.freeTextTypeWriter=2]="freeTextTypeWriter"}(t.PdfAnnotationIntent||(t.PdfAnnotationIntent={})),function(t){t[t.location=0]="location",t[t.fitToPage=1]="fitToPage",t[t.fitR=2]="fitR",t[t.fitH=3]="fitH"}(t.PdfDestinationMode||(t.PdfDestinationMode={})),function(t){t[t.fdf=0]="fdf",t[t.xfdf=1]="xfdf",t[t.json=2]="json",t[t.xml=3]="xml"}(t.DataFormat||(t.DataFormat={})),function(t){t[t.none=0]="none",t[t.row=1]="row",t[t.column=2]="column",t[t.structure=3]="structure",t[t.manual=4]="manual",t[t.widget=5]="widget"}(t.PdfFormFieldsTabOrder||(t.PdfFormFieldsTabOrder={})),function(t){t[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.strikeOut=2]="strikeOut",t[t.squiggly=3]="squiggly",t[t.redactionAnnotation=4]="redactionAnnotation",t[t.textAnnotation=5]="textAnnotation",t[t.linkAnnotation=6]="linkAnnotation",t[t.documentLinkAnnotation=7]="documentLinkAnnotation",t[t.uriAnnotation=8]="uriAnnotation",t[t.fileLinkAnnotation=9]="fileLinkAnnotation",t[t.freeTextAnnotation=10]="freeTextAnnotation",t[t.lineAnnotation=11]="lineAnnotation",t[t.circleAnnotation=12]="circleAnnotation",t[t.ellipseAnnotation=13]="ellipseAnnotation",t[t.squareAnnotation=14]="squareAnnotation",t[t.rectangleAnnotation=15]="rectangleAnnotation",t[t.polygonAnnotation=16]="polygonAnnotation",t[t.polyLineAnnotation=17]="polyLineAnnotation",t[t.textMarkupAnnotation=18]="textMarkupAnnotation",t[t.caretAnnotation=19]="caretAnnotation",t[t.rubberStampAnnotation=20]="rubberStampAnnotation",t[t.popupAnnotation=21]="popupAnnotation",t[t.fileAttachmentAnnotation=22]="fileAttachmentAnnotation",t[t.soundAnnotation=23]="soundAnnotation",t[t.movieAnnotation=24]="movieAnnotation",t[t.screenAnnotation=25]="screenAnnotation",t[t.widgetAnnotation=26]="widgetAnnotation",t[t.printerMarkAnnotation=27]="printerMarkAnnotation",t[t.trapNetworkAnnotation=28]="trapNetworkAnnotation",t[t.watermarkAnnotation=29]="watermarkAnnotation",t[t.textWebLinkAnnotation=30]="textWebLinkAnnotation",t[t.inkAnnotation=31]="inkAnnotation",t[t.richMediaAnnotation=32]="richMediaAnnotation",t[t.angleMeasurementAnnotation=33]="angleMeasurementAnnotation",t[t.null=34]="null"}(t._PdfAnnotationType||(t._PdfAnnotationType={})),function(t){t[t.centimeter=0]="centimeter",t[t.pica=1]="pica",t[t.pixel=2]="pixel",t[t.point=3]="point",t[t.inch=4]="inch",t[t.document=5]="document",t[t.millimeter=6]="millimeter"}(t._PdfGraphicsUnit||(t._PdfGraphicsUnit={})),function(t){t[t.default=0]="default",t[t.readOnly=1]="readOnly",t[t.required=2]="required",t[t.noExport=4]="noExport",t[t.multiLine=4096]="multiLine",t[t.password=8192]="password",t[t.fileSelect=1048576]="fileSelect",t[t.doNotSpellCheck=4194304]="doNotSpellCheck",t[t.doNotScroll=8388608]="doNotScroll",t[t.comb=16777216]="comb",t[t.richText=33554432]="richText",t[t.noToggleToOff=16384]="noToggleToOff",t[t.radio=32768]="radio",t[t.pushButton=65536]="pushButton",t[t.radiosInUnison=33554432]="radiosInUnison",t[t.combo=131072]="combo",t[t.edit=262144]="edit",t[t.sort=524288]="sort",t[t.multiSelect=2097152]="multiSelect",t[t.commitOnSelectChange=67108864]="commitOnSelectChange"}(t._FieldFlag||(t._FieldFlag={})),function(t){t[t.none=0]="none",t[t.signatureExists=1]="signatureExists",t[t.appendOnly=2]="appendOnly"}(t._SignatureFlag||(t._SignatureFlag={})),function(t){t[t.unchecked=0]="unchecked",t[t.checked=1]="checked",t[t.pressedUnchecked=2]="pressedUnchecked",t[t.pressedChecked=3]="pressedChecked"}(t._PdfCheckFieldState||(t._PdfCheckFieldState={})),function(t){t[t.default=0]="default",t[t.print=4]="print",t[t.editContent=8]="editContent",t[t.copyContent=16]="copyContent",t[t.editAnnotations=32]="editAnnotations",t[t.fillFields=256]="fillFields",t[t.accessibilityCopyContent=512]="accessibilityCopyContent",t[t.assembleDocument=1024]="assembleDocument",t[t.fullQualityPrint=2048]="fullQualityPrint"}(t.PdfPermissionFlag||(t.PdfPermissionFlag={})),function(t){t[t.portrait=0]="portrait",t[t.landscape=1]="landscape"}(t.PdfPageOrientation||(t.PdfPageOrientation={})),function(t){t[t.none=0]="none",t[t.leftToRight=1]="leftToRight",t[t.rightToLeft=2]="rightToLeft"}(t.PdfTextDirection||(t.PdfTextDirection={})),function(t){t[t.none=0]="none",t[t.superScript=1]="superScript",t[t.subScript=2]="subScript"}(t.PdfSubSuperScript||(t.PdfSubSuperScript={})),function(t){t[t.normal=0]="normal",t[t.multiply=1]="multiply",t[t.screen=2]="screen",t[t.overlay=3]="overlay",t[t.darken=4]="darken",t[t.lighten=5]="lighten",t[t.colorDodge=6]="colorDodge",t[t.colorBurn=7]="colorBurn",t[t.hardLight=8]="hardLight",t[t.softLight=9]="softLight",t[t.difference=10]="difference",t[t.exclusion=11]="exclusion",t[t.hue=12]="hue",t[t.saturation=13]="saturation",t[t.color=14]="color",t[t.luminosity=15]="luminosity"}(t.PdfBlendMode||(t.PdfBlendMode={})),function(t){t[t.winding=0]="winding",t[t.alternate=1]="alternate"}(t.PdfFillMode||(t.PdfFillMode={})),function(t){t[t.solid=0]="solid",t[t.dash=1]="dash",t[t.dot=2]="dot",t[t.dashDot=3]="dashDot",t[t.dashDotDot=4]="dashDotDot",t[t.custom=5]="custom"}(t.PdfDashStyle||(t.PdfDashStyle={})),function(t){t[t.flat=0]="flat",t[t.round=1]="round",t[t.square=2]="square"}(t.PdfLineCap||(t.PdfLineCap={})),function(t){t[t.miter=0]="miter",t[t.round=1]="round",t[t.bevel=2]="bevel"}(t.PdfLineJoin||(t.PdfLineJoin={})),function(t){t[t.none=0]="none",t[t.word=1]="word",t[t.wordOnly=2]="wordOnly",t[t.character=3]="character"}(t._PdfWordWrapType||(t._PdfWordWrapType={})),function(t){t[t.fixedPitch=1]="fixedPitch",t[t.serif=2]="serif",t[t.symbolic=4]="symbolic",t[t.script=8]="script",t[t.nonSymbolic=32]="nonSymbolic",t[t.italic=64]="italic",t[t.forceBold=262144]="forceBold"}(t._FontDescriptorFlag||(t._FontDescriptorFlag={})),function(t){t[t.apple=0]="apple",t[t.microsoft=4]="microsoft",t[t.trimmed=6]="trimmed"}(t._TrueTypeCmapFormat||(t._TrueTypeCmapFormat={})),function(t){t[t.unknown=0]="unknown",t[t.symbol=1]="symbol",t[t.unicode=2]="unicode",t[t.macintosh=3]="macintosh"}(t._TrueTypeCmapEncoding||(t._TrueTypeCmapEncoding={})),function(t){t[t.appleUnicode=0]="appleUnicode",t[t.macintosh=1]="macintosh",t[t.iSO=2]="iSO",t[t.microsoft=3]="microsoft"}(t._TrueTypePlatformID||(t._TrueTypePlatformID={})),function(t){t[t.undefined=0]="undefined",t[t.unicode=1]="unicode"}(t._TrueTypeMicrosoftEncodingID||(t._TrueTypeMicrosoftEncodingID={})),function(t){t[t.roman=0]="roman",t[t.japanese=1]="japanese",t[t.chinese=2]="chinese"}(t._TrueTypeMacintoshEncodingID||(t._TrueTypeMacintoshEncodingID={})),function(t){t[t.Arg1And2AreWords=1]="Arg1And2AreWords",t[t.ArgsAreXyValues=2]="ArgsAreXyValues",t[t.RoundXyToGrid=4]="RoundXyToGrid",t[t.WeHaveScale=8]="WeHaveScale",t[t.Reserved=16]="Reserved",t[t.MoreComponents=32]="MoreComponents",t[t.WeHaveAnXyScale=64]="WeHaveAnXyScale",t[t.WeHaveTwoByTwo=128]="WeHaveTwoByTwo",t[t.WeHaveInstructions=256]="WeHaveInstructions",t[t.UseMyMetrics=512]="UseMyMetrics"}(t._TrueTypeCompositeGlyphFlag||(t._TrueTypeCompositeGlyphFlag={})),function(t){t[t.unknown=0]="unknown",t[t.bmp=1]="bmp",t[t.emf=2]="emf",t[t.gif=3]="gif",t[t.jpeg=4]="jpeg",t[t.png=5]="png",t[t.wmf=6]="wmf",t[t.icon=7]="icon"}(t._ImageFormat||(t._ImageFormat={})),function(t){t[t.none=0]="none",t[t.comment=1]="comment",t[t.number=2]="number",t[t.real=3]="real",t[t.string=4]="string",t[t.hexString=5]="hexString",t[t.unicodeString=6]="unicodeString",t[t.unicodeHexString=7]="unicodeHexString",t[t.name=8]="name",t[t.operator=9]="operator",t[t.beginArray=10]="beginArray",t[t.endArray=11]="endArray",t[t.eof=12]="eof"}(t._TokenType||(t._TokenType={})),function(t){t[t.regular=0]="regular",t[t.italic=1]="italic",t[t.bold=2]="bold"}(t.PdfTextStyle||(t.PdfTextStyle={})),function(t){t[t.rgb=0]="rgb",t[t.cmyk=1]="cmyk",t[t.grayScale=2]="grayScale",t[t.indexed=3]="indexed"}(t._PdfColorSpace||(t._PdfColorSpace={}));var Ot=function(){function t(t){this._newLine="\r\n",this._whiteSpace=" ",this._stream=t}return t.prototype._writeOperator=function(t){this._stream.write(t),this._stream.write(this._newLine)},t.prototype._saveGraphicsState=function(){this._writeOperator("q")},t.prototype._restoreGraphicsState=function(){this._writeOperator("Q")},t.prototype._writeComment=function(t){t&&t.length>0&&this._writeOperator("% "+t)},t.prototype._setGraphicsState=function(t){this._stream.write("/"+K(t.name)+" "),this._writeOperator("gs")},t.prototype._modifyCtm=function(t){this._stream.write(t._toString()+" "),this._writeOperator("cm")},t.prototype._modifyTM=function(t){this._stream.write(t._toString()+" "),this._writeOperator("Tm")},t.prototype._setColorSpace=function(t,e){this._stream.write("/"+t+" "),this._writeOperator(e?"CS":"cs")},t.prototype._setColor=function(t,e){this._stream.write((t[0]/255).toFixed(3)+" "+(t[1]/255).toFixed(3)+" "+(t[2]/255).toFixed(3)+" "),this._writeOperator(e?"RG":"rg")},t.prototype._appendRectangle=function(t,e,i,r){this._writePoint(t,e),this._writePoint(i,r),this._writeOperator("re")},t.prototype._writePoint=function(t,e){this._stream.write(t.toFixed(3)+" "+(-e).toFixed(3)+" ")},t.prototype._clipPath=function(t){this._stream.write((t?"W*":"W")+" n"+this._newLine)},t.prototype._fillPath=function(t){this._writeOperator(t?"f*":"f")},t.prototype._closeFillPath=function(t){this._writeOperator("h"),this._fillPath(t)},t.prototype._strokePath=function(){this._writeOperator("S")},t.prototype._closeStrokePath=function(){this._writeOperator("s")},t.prototype._fillStrokePath=function(t){this._writeOperator(t?"B*":"B")},t.prototype._closeFillStrokePath=function(t){this._writeOperator(t?"b*":"b")},t.prototype._endPath=function(){this._writeOperator("n")},t.prototype._setFont=function(t,e){this._stream.write("/"+t+" "+e.toFixed(3)+" "),this._writeOperator("Tf")},t.prototype._setTextScaling=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tz")},t.prototype._closePath=function(){this._writeOperator("h")},t.prototype._startNextLine=function(t,e){void 0===t?this._writeOperator("T*"):(this._writePoint(t,e),this._writeOperator("Td"))},t.prototype._showText=function(t){this._writeText(t),this._writeOperator("Tj")},t.prototype._write=function(t){var e="";e+=t,e+="\r\n",this._writeOperator(e)},t.prototype._writeText=function(t){for(var e="",i=this._escapeSymbols(t),r=0;r<i.length;r++)e+=String.fromCharCode(i[r]);e="("+e+")",this._stream.write(e)},t.prototype._beginText=function(){this._writeOperator("BT")},t.prototype._endText=function(){this._writeOperator("ET")},t.prototype._beginPath=function(t,e){this._writePoint(t,e),this._writeOperator("m")},t.prototype._appendLineSegment=function(t,e){this._writePoint(t,e),this._writeOperator("l")},t.prototype._appendBezierSegment=function(t,e,i,r,n,s){this._writePoint(t,e),this._writePoint(i,r),this._writePoint(n,s),this._writeOperator("c")},t.prototype._setTextRenderingMode=function(t){this._stream.write(t.toString()+" "),this._writeOperator("Tr")},t.prototype._setCharacterSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tc")},t.prototype._setWordSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tw")},t.prototype._showNextLineText=function(t,e){null!==e&&void 0!==e&&e?(this._writeText(t),this._writeOperator("'")):(this._stream.write(t),this._writeOperator("'"))},t.prototype._setLineDashPattern=function(t,e){var i="[";if(t.length>1)for(var r=0;r<t.length;r++)r===t.length-1?i+=t[r].toString():i+=t[r].toString()+" ";i+="] ",i+=e.toString(),i+=" d",this._writeOperator(i)},t.prototype._setMiterLimit=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("M")},t.prototype._setLineWidth=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("w")},t.prototype._setLineCap=function(t){this._stream.write(t+" "),this._writeOperator("J")},t.prototype._setLineJoin=function(t){this._stream.write(t+" "),this._writeOperator("j")},t.prototype._executeObject=function(t){this._stream.write("/"+t.name+" "),this._writeOperator("Do")},t.prototype._beginMarkupSequence=function(t){this._stream.write("/"+t+" "),this._writeOperator("BMC")},t.prototype._endMarkupSequence=function(){this._writeOperator("EMC")},t.prototype._clear=function(){this._stream._bytes=[]},t.prototype._escapeSymbols=function(t){for(var e=[],i=0;i<t.length;i++){var r=t.charCodeAt(i);switch(r){case 40:case 41:e.push(92),e.push(r);break;case 13:e.push(92),e.push(114);break;case 92:e.push(92),e.push(r);break;default:e.push(r)}}return e},t}(),Et=function(){function e(e,i){this.horizontalScalingFactor=100,this.rightToLeft=!1,this._wordWrapType=t._PdfWordWrapType.word,this.lineLimit=!0,void 0!==e&&(this.alignment=e),this.lineAlignment=void 0!==i?i:t.PdfVerticalAlignment.top,this.characterSpacing=0,this.wordSpacing=0,this.lineSpacing=0,this.clipPath=!1,this.firstLineIndent=0,this._internalParagraphIndent=0,this.measureTrailingSpaces=!1,this.noClip=!1}return Object.defineProperty(e.prototype,"paragraphIndent",{get:function(){return this._internalParagraphIndent},set:function(t){this._internalParagraphIndent=t,this.firstLineIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subSuperScript",{get:function(){return void 0===this._pdfSubSuperScript||null===this._pdfSubSuperScript?t.PdfSubSuperScript.none:this._pdfSubSuperScript},set:function(t){this._pdfSubSuperScript=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_wordWrap",{get:function(){return this._wordWrapType},set:function(t){this._wordWrapType=t},enumerable:!0,configurable:!0}),e}();!function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(t.PdfVerticalAlignment||(t.PdfVerticalAlignment={}));var Vt=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),jt=function(){function e(){this._lineGap=0}return e.prototype._getAscent=function(t){return.001*this._ascent*this._getSize(t)},e.prototype._getDescent=function(t){return.001*this._descent*this._getSize(t)},e.prototype._getLineGap=function(t){return.001*this._lineGap*this._getSize(t)},e.prototype._getHeight=function(t){for(var e=["cambria","candara","constantia","corbel","cariadings"],i=[],r=0;r<e.length;r++)i.push(e[Number.parseInt(r.toString(),10)]);return this._getDescent(t)<0?this._getAscent(t)-this._getDescent(t)+this._getLineGap(t):this._getAscent(t)+this._getDescent(t)+this._getLineGap(t)},e.prototype._getSize=function(e){var i=this._size;if(null!==e&&void 0!==e)switch(e.subSuperScript){case t.PdfSubSuperScript.subScript:i/=this._subScriptSizeFactor;break;case t.PdfSubSuperScript.superScript:i/=this._superscriptSizeFactor}return i},e}(),zt=function(){function t(){}return t}(),Ut=function(t){function e(e){var i=t.call(this)||this;return i.widths=e,i}return Vt(e,t),e.prototype._itemAt=function(t){if(t<0||t>=this.widths.length)throw new Error("The character is not supported by the font.");return this.widths[Number.parseInt(t.toString(),10)]},e.prototype._toArray=function(){return this.widths},e}(zt),Wt=function(t){function e(e){var i=t.call(this)||this;return i._defaultWidth=e,i.widths=[],i}return Vt(e,t),e.prototype._itemAt=function(t){var e=this._defaultWidth;return this.widths.forEach(function(i){t>=i._from&&t<=i._to&&(e=i._itemAt(t))}),e},e.prototype._toArray=function(){var t=[];return this.widths.forEach(function(e){e._appendToArray(t)}),t},e.prototype._add=function(t){this.widths.push(t)},e}(zt),Ht=function(){function t(){}return t}(),Gt=function(t){function e(e,i,r){var n=t.call(this)||this;return n._widthFrom=e,n._widthTo=i,n._width=r,n}return Vt(e,t),Object.defineProperty(e.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_to",{get:function(){return this._widthTo},enumerable:!0,configurable:!0}),e.prototype._itemAt=function(t){if(t<this._from||t>this._to)throw new Error("Index is out of range.");return this._width},e.prototype._appendToArray=function(t){t.push(this._from,this._to,this._width)},e}(Ht),Kt=function(t){function e(e,i){var r=t.call(this)||this;return r._widthFrom=e,r._widths=i,r}return Vt(e,t),Object.defineProperty(e.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_to",{get:function(){return this._widthFrom+this._widths.length-1},enumerable:!0,configurable:!0}),e.prototype._itemAt=function(t){if(t<this._widthFrom||t>this._to)throw new Error("Index is out of range.");return this._widths[Number.parseInt(t.toString(),10)]},e.prototype._appendToArray=function(t){t.push(this._from),t.forEach(function(e){t.push(e)})},e}(Ht),qt=function(){function e(){}return e.prototype._layout=function(t,e,i,r){this._initialize(t,e,i,r);var n=this._doLayout();return this._clear(),n},e.prototype._initialize=function(t,e,i,r){this._font=e,this._format=i,this._size=r,this._rectangle=[0,0,r[0],r[1]],this._reader=new Qt(t),this._pageHeight=0},e.prototype._clear=function(){this._font=null,this._format=null,this._reader._close(),this._reader=null},e.prototype._doLayout=function(){for(var t=new Xt,e=new Xt,i=[],r=this._reader._peekLine(),n=this._getLineIndent(!0);null!==r;){if(void 0!==(e=this._layoutLine(r,n))&&null!==e){var s=0,a=this._copyToResult(t,e,i,s),o=a.success;if(s=a.flag,!o){this._reader._read(s);break}}this._reader._readLine(),r=this._reader._peekLine(),n=this._getLineIndent(!1)}return this._finalizeResult(t,i),t},e.prototype._getLineIndent=function(t){var e=0;return this._format&&(e=t?this._format.firstLineIndent:this._format.paragraphIndent,e=this._size[0]>0?Math.min(this._size[0],e):e),e},e.prototype._getLineHeight=function(){var t=this._font._metrics._getHeight();return this._format&&0!==this._format.lineSpacing&&(t=this._format.lineSpacing+this._font._metrics._getHeight()),t},e.prototype._getLineWidth=function(t){return this._font.getLineWidth(t,this._format)},e.prototype._layoutLine=function(e,i){var r=new Xt;r._lineHeight=this._getLineHeight();var n=[],s=this._size[0],a=this._getLineWidth(e)+i,o=t._LineType.firstParagraphLine,h=!0;if(s<=0||Math.round(a)<=Math.round(s))this._addToLineResult(r,n,e,a,t._LineType.newLineBreak|o);else{var c="",_="";a=i;var d=i,p=new Qt(e),l=p._peekWord();for(l.length!==p._length&&" "===l&&(_+=l,c+=l,p._position+=1,l=p._peekWord());null!==l;){_+=l;var u=this._getLineWidth(_.toString())+d;if(" "===_.toString()&&(_="",u=0),u>s){if(this._getWrapType()===t._PdfWordWrapType.none)break;if(_.length===l.length){if(this._getWrapType()===t._PdfWordWrapType.wordOnly){r._remainder=e.substring(p._position);break}if(1===_.length){c+=l;break}h=!1,_="",l=p._peek().toString();continue}if(this._getLineWidth(l.toString())>s?void 0!==this._format&&null!==this._format&&(this._format._wordWrap=t._PdfWordWrapType.character):void 0!==this._format&&null!==this._format&&(this._format._wordWrap=t._PdfWordWrapType.word),this._getWrapType()===t._PdfWordWrapType.character&&h)h=!1,_="",_+=c.toString(),l=p._peek().toString();else{var f=c.toString();" "!==f&&this._addToLineResult(r,n,f,a,t._LineType.layoutBreak|o),_="",c="",a=0,d=0,u=0,o=t._LineType.none,l=h?l:p._peekWord(),h=!0}}else c+=l,a=u,h?(p._readWord(),l=p._peekWord()):(p._read(),l=p._peek().toString())}c.length>0&&this._addToLineResult(r,n,c.toString(),a,t._LineType.newLineBreak|t._LineType.lastParagraphLine),p._close()}r._layoutLines=[];for(var g=0;g<n.length;g++)r._layoutLines.push(n[g]);return n=[],r},e.prototype._addToLineResult=function(t,e,i,r,n){var s=new Jt;s._text=i,s._width=r,s._lineType=n,e.push(s);var a=t._actualSize;a[1]=a[1]+this._getLineHeight(),a[0]=Math.max(a[0],r),t._size=a},e.prototype._copyToResult=function(t,e,i,r){var n=!0,s=this._format&&!this._format.lineLimit,a=t._actualSize[1],o=this._size[1];if(this._pageHeight>0&&o+this._rectangle[1]>this._pageHeight&&(o=this._rectangle[1]-this._pageHeight,o=Math.max(o,-o)),r=0,null!==e._lines)for(var h=0,c=e._lines.length;h<c;h++){var _=a+e._lineHeight;if(!(_<=o||o<=0||s)){n=!1;break}var d=e._lines[h];r+=d._text.length,d=this._trimLine(d,0===i.length),i.push(d);var p=t._actualSize;p[0]=Math.max(p[0],d._width),t._size=p,a=_}return a!==t._size[1]&&(t._size=[t._actualSize[0],a]),{success:n,flag:r}},e.prototype._finalizeResult=function(t,e){t._layoutLines=[];for(var i=0;i<e.length;i++)t._layoutLines.push(e[i]);t._lineHeight=this._getLineHeight(),this._reader._end||(t._remainder=this._reader._readToEnd()),e=[]},e.prototype._trimLine=function(e,i){var r=e._text.trim(),n=e._width;return r.length!==e._text.length&&(n=this._getLineWidth(r),(e._lineType&t._LineType.firstParagraphLine)>0&&(n+=this._getLineIndent(i))),e._text=r,e._width=n,e},e.prototype._getWrapType=function(){return null!==this._format&&void 0!==this._format?this._format._wordWrap:t._PdfWordWrapType.word},e}(),Xt=function(){function t(){}return Object.defineProperty(t.prototype,"_actualSize",{get:function(){return void 0===this._size&&(this._size=[0,0]),this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lines",{get:function(){return this._layoutLines},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_empty",{get:function(){return null===this._layoutLines||0===this._layoutLines.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lineCount",{get:function(){return this._empty?0:this._layoutLines.length},enumerable:!0,configurable:!0}),t}(),Jt=function(){function t(){}return t}();!function(t){t[t.none=0]="none",t[t.newLineBreak=1]="newLineBreak",t[t.layoutBreak=2]="layoutBreak",t[t.firstParagraphLine=4]="firstParagraphLine",t[t.lastParagraphLine=8]="lastParagraphLine"}(t._LineType||(t._LineType={}));var Qt=function(){function t(t){if(this._position=0,void 0===t||null===t)throw new Error("ArgumentNullException:text");this._text=t}return Object.defineProperty(t.prototype,"_length",{get:function(){return this._text.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_end",{get:function(){return this._position===this._text.length},enumerable:!0,configurable:!0}),t.prototype._readLine=function(){for(var t=this._position;t<this._length;){var e=this._text[t],i=void 0;switch(e){case"\r":case"\n":return i=this._text.substring(this._position,t),this._position=t+1,"\r"===e&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,i}t++}if(t>this._position){var r=this._text.substring(this._position,t);return this._position=t,r}return null},t.prototype._peekLine=function(){var t=this._position,e=this._readLine();return this._position=t,e},t.prototype._readWord=function(){for(var t=this._position;t<this._length;){var e=this._text[t],i=void 0;switch(e){case"\r":case"\n":return i=this._text.substring(this._position,t-this._position),this._position=t+1,"\r"===e&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,i;case" ":case"\t":return t===this._position&&t++,i=this._text.substring(this._position,t),this._position=t,i}t++}if(t>this._position){var r=this._text.substring(this._position,t);return this._position=t,r}return null},t.prototype._peekWord=function(){var t=this._position,e=this._readWord();return this._position=t,e},t.prototype._read=function(t){if(void 0===t){var e="0";return this._end||(e=this._text[this._position],this._position++),e}for(var i=0,r="";!this._end&&i<t;)r+=this._read(),i++;return r},t.prototype._peek=function(){return this._end?"0":this._text[this._position]},t.prototype._close=function(){this._text=null},t.prototype._readToEnd=function(){var t;return t=0===this._position?this._text:this._text.substring(this._position),this._position=this._length,t},t._whiteSpace=" ",t._tab="\t",t._spaces=[t._whiteSpace,t._tab],t}(),Yt=function(){function t(){}return Object.defineProperty(t.prototype,"_empty",{get:function(){return this._offset===this._length&&this._length===this._checksum&&0===this._checksum},enumerable:!0,configurable:!0}),t}(),Zt=function(){function t(){}return t}(),$t=function(){function t(){}return t}(),te=function(){function t(){}return t}(),ee=function(){function t(){}return t}(),ie=function(){function t(){}return t}(),re=function(){function t(){}return t}(),ne=function(){function t(){}return t}(),se=function(){function t(){}return t}(),ae=function(){function t(){}return t}(),oe=function(){function t(){}return t}(),he=function(){function e(t){this._int32Size=4,this._isFont=!1,this._isMacTtf=!1,this._isMacFont=!1,this._missedGlyphs=0,this._tableNames=["cvt ","fpgm","glyf","head","hhea","hmtx","loca","maxp","prep"],this._entrySelectors=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4],this._fontData=t,this._initialize()}return Object.defineProperty(e.prototype,"macintosh",{get:function(){return null!==this._macintoshDictionary&&void 0!==this._macintoshDictionary||(this._macintoshDictionary=new kr),this._macintoshDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoft",{get:function(){return null!==this._microsoftDictionary&&void 0!==this._microsoftDictionary||(this._microsoftDictionary=new kr),this._microsoftDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_macintoshGlyphs",{get:function(){return null!==this._internalMacintoshGlyphs&&void 0!==this._internalMacintoshGlyphs||(this._internalMacintoshGlyphs=new kr),this._internalMacintoshGlyphs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoftGlyphs",{get:function(){return null!==this._internalMicrosoftGlyphs&&void 0!==this._internalMicrosoftGlyphs||(this._internalMicrosoftGlyphs=new kr),this._internalMicrosoftGlyphs},enumerable:!0,configurable:!0}),e.prototype._initialize=function(){void 0!==this._metrics&&null!==this._metrics||(this._metrics=new _e),this._readFontDictionary();var t=this._readNameTable(),e=this._readHeadTable();this._initializeFontName(t),this._metrics._macStyle=e._macStyle},e.prototype._readFontDictionary=function(){this._offset=0,this._check();var t=this._readInt16(this._offset);this._readInt16(this._offset),this._readInt16(this._offset),this._readInt16(this._offset),void 0!==this._tableDirectory&&null!==this._tableDirectory||(this._tableDirectory=new kr);for(var e=0;e<t;++e){var i=new Yt,r=this._readString(this._int32Size);i._checksum=this._readInt32(this._offset),i._offset=this._readInt32(this._offset),i._length=this._readInt32(this._offset),this._tableDirectory.setValue(r,i)}this._lowestPosition=this._offset,this._isFont||this._fixOffsets()},e.prototype._fixOffsets=function(){for(var t=Number.MAX_VALUE,e=this._tableDirectory.keys(),i=0;i<e.length;i++){var r=(a=this._tableDirectory.getValue(e[Number.parseInt(i.toString(),10)]))._offset;if(t>r&&(t=r)<=this._lowestPosition)break}var n=t-this._lowestPosition;if(0!==n){for(var s=new kr,i=0;i<e.length;i++){var a=this._tableDirectory.getValue(e[Number.parseInt(i.toString(),10)]);a._offset-=n,s.setValue(e[Number.parseInt(i.toString(),10)],a)}this._tableDirectory=s}},e.prototype._check=function(){var t=this._readInt32(this._offset);if(this._isMacTtf=1953658213===t,65536!==t&&1953658213!==t&&1330926671!==t){if(this._isFont=!0,this._offset=0,"ttcf"!==this._readString(4))throw new Error("Can not read TTF font data");if(this._offset+=4,this._readInt32(this._offset)<0)throw new Error("Can not read TTF font data");this._offset=this._readInt32(this._offset),t=this._readInt32(this._offset)}return t},e.prototype._readNameTable=function(){var t=this._getTable("name");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new te;e._formatSelector=this._readUInt16(this._offset),e._recordsCount=this._readUInt16(this._offset),e._offset=this._readUInt16(this._offset),e._nameRecords=[];for(var i=this._offset,r=0;r<e._recordsCount;r++){this._offset=i;var n=new ce;n._platformID=this._readUInt16(this._offset),n._encodingID=this._readUInt16(this._offset),n._languageID=this._readUInt16(this._offset),n._nameID=this._readUInt16(this._offset),n._length=this._readUInt16(this._offset),n._offset=this._readUInt16(this._offset),this._offset=t._offset+e._offset+n._offset;var s=0===n._platformID||3===n._platformID;n._name=this._readString(n._length,s),e._nameRecords[Number.parseInt(r.toString(),10)]=n,i+=12}return e},e.prototype._readHeadTable=function(){var t=this._getTable("head");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new re;return e._version=this._readFixed(this._offset),e._fontRevision=this._readFixed(this._offset),e._checkSumAdjustment=this._readUInt32(this._offset),e._magicNumber=this._readUInt32(this._offset),e._flags=this._readUInt16(this._offset),e._unitsPerEm=this._readUInt16(this._offset),e._created=this._readInt64(this._offset),e._modified=this._readInt64(this._offset),e._xMin=this._readInt16(this._offset),e._yMin=this._readInt16(this._offset),e._xMax=this._readInt16(this._offset),e._yMax=this._readInt16(this._offset),e._macStyle=this._readUInt16(this._offset),e._lowestReadableSize=this._readUInt16(this._offset),e._fontDirectionHint=this._readInt16(this._offset),e._indexToLocalFormat=this._readInt16(this._offset),e._glyphDataFormat=this._readInt16(this._offset),e},e.prototype._readHorizontalHeaderTable=function(){var t=this._getTable("hhea");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new ie;return e._version=this._readFixed(this._offset),e._ascender=this._readInt16(this._offset),e._descender=this._readInt16(this._offset),e._lineGap=this._readInt16(this._offset),e._advanceWidthMax=this._readUInt16(this._offset),e._minLeftSideBearing=this._readInt16(this._offset),e._minRightSideBearing=this._readInt16(this._offset),e._xMaxExtent=this._readInt16(this._offset),e._caretSlopeRise=this._readInt16(this._offset),e._caretSlopeRun=this._readInt16(this._offset),this._offset+=10,e._metricDataFormat=this._readInt16(this._offset),e._numberOfHMetrics=this._readUInt16(this._offset),e},e.prototype._readOS2Table=function(){var t=this._getTable("OS/2");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new Zt;return e._version=this._readUInt16(this._offset),e._xAvgCharWidth=this._readInt16(this._offset),e._usWeightClass=this._readUInt16(this._offset),e._usWidthClass=this._readUInt16(this._offset),e._fsType=this._readInt16(this._offset),e._ySubscriptXSize=this._readInt16(this._offset),e._ySubscriptYSize=this._readInt16(this._offset),e._ySubscriptXOffset=this._readInt16(this._offset),e._ySubscriptYOffset=this._readInt16(this._offset),e._ySuperscriptXSize=this._readInt16(this._offset),e._ySuperscriptYSize=this._readInt16(this._offset),e._ySuperscriptXOffset=this._readInt16(this._offset),e._ySuperscriptYOffset=this._readInt16(this._offset),e._yStrikeoutSize=this._readInt16(this._offset),e._yStrikeoutPosition=this._readInt16(this._offset),e._sFamilyClass=this._readInt16(this._offset),e._panose=this._readBytes(10),e._ulUnicodeRange1=this._readUInt32(this._offset),e._ulUnicodeRange2=this._readUInt32(this._offset),e._ulUnicodeRange3=this._readUInt32(this._offset),e._ulUnicodeRange4=this._readUInt32(this._offset),e._vendorIdentifier=this._readBytes(4),e._fsSelection=this._readUInt16(this._offset),e._usFirstCharIndex=this._readUInt16(this._offset),e._usLastCharIndex=this._readUInt16(this._offset),e._sTypoAscender=this._readInt16(this._offset),e._sTypoDescender=this._readInt16(this._offset),e._sTypoLineGap=this._readInt16(this._offset),e._usWinAscent=this._readUInt16(this._offset),e._usWinDescent=this._readUInt16(this._offset),e._ulCodePageRange1=this._readUInt32(this._offset),e._ulCodePageRange2=this._readUInt32(this._offset),e._version>1?(e._sxHeight=this._readInt16(this._offset),e._sCapHeight=this._readInt16(this._offset),e._usDefaultChar=this._readUInt16(this._offset),e._usBreakChar=this._readUInt16(this._offset),e._usMaxContext=this._readUInt16(this._offset)):(e._sxHeight=0,e._sCapHeight=0,e._usDefaultChar=0,e._usBreakChar=0,e._usMaxContext=0),e},e.prototype._readPostTable=function(){var t=this._getTable("post");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new $t;return e._formatType=this._readFixed(this._offset),e._italicAngle=this._readFixed(this._offset),e._underlinePosition=this._readInt16(this._offset),e._underlineThickness=this._readInt16(this._offset),e._isFixedPitch=this._readUInt32(this._offset),e._minType42=this._readUInt32(this._offset),e._maxType42=this._readUInt32(this._offset),e._minType1=this._readUInt32(this._offset),e._maxType1=this._readUInt32(this._offset),e},e.prototype._readWidthTable=function(t,e){var i=this._getTable("hmtx");void 0!==i._offset&&null!==i._offset&&(this._offset=i._offset);for(var r=[],n=0;n<t;n++){var s=new de;s._advanceWidth=this._readUInt16(this._offset),s._lsb=this._readInt16(this._offset);var a=1e3*s._advanceWidth/e;r.push(Math.floor(a))}return r},e.prototype._readCmapTable=function(){var t=this._getTable("cmap");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new ne;e._version=this._readUInt16(this._offset),e._tablesCount=this._readUInt16(this._offset);for(var i=this._offset,r=[],n=0;n<e._tablesCount;n++){this._offset=i;var s=new se;s._platformID=this._readUInt16(this._offset),s._encodingID=this._readUInt16(this._offset),s._offset=this._readUInt32(this._offset),i=this._offset,this._readCmapSubTable(s),r[Number.parseInt(n.toString(),10)]=s}return r},e.prototype._readCmapSubTable=function(e){var i=this._getTable("cmap");this._offset=i._offset+e._offset;var r=this._readUInt16(this._offset),n=this._getCmapEncoding(e._platformID,e._encodingID);if(n!==t._TrueTypeCmapEncoding.unknown)switch(r){case t._TrueTypeCmapFormat.apple:this._readAppleCmapTable(e,n);break;case t._TrueTypeCmapFormat.microsoft:this._readMicrosoftCmapTable(e,n);break;case t._TrueTypeCmapFormat.trimmed:this._readTrimmedCmapTable(e,n)}},e.prototype._readAppleCmapTable=function(t,e){var i=this._getTable("cmap");this._offset=i._offset+t._offset;var r=new ae;r._format=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._version=this._readUInt16(this._offset),null!==this._maxMacIndex&&void 0!==this._maxMacIndex||(this._maxMacIndex=0);for(var n=0;n<256;++n){var s=new pe;s._index=this._readByte(this._offset),s._width=this._getWidth(s._index),s._charCode=n,this.macintosh.setValue(n,s),this._addGlyph(s,e),this._maxMacIndex=Math.max(n,this._maxMacIndex)}},e.prototype._readMicrosoftCmapTable=function(e,i){var r=this._getTable("cmap");this._offset=r._offset+e._offset;var n=i===t._TrueTypeCmapEncoding.unicode?this._microsoft:this.macintosh,s=new ee;s._format=this._readUInt16(this._offset),s._length=this._readUInt16(this._offset),s._version=this._readUInt16(this._offset),s._segCountX2=this._readUInt16(this._offset),s._searchRange=this._readUInt16(this._offset),s._entrySelector=this._readUInt16(this._offset),s._rangeShift=this._readUInt16(this._offset);var a=s._segCountX2/2;s._endCount=this._readUShortArray(a),s._reservedPad=this._readUInt16(this._offset),s._startCount=this._readUShortArray(a),s._idDelta=this._readUShortArray(a),s._idRangeOffset=this._readUShortArray(a);var o=s._length/2-8-4*a;s._glyphID=this._readUShortArray(o);for(var h=0,c=0,_=0;_<a;_++)for(var d=s._startCount[Number.parseInt(_.toString(),10)];d<=s._endCount[Number.parseInt(_.toString(),10)]&&65535!==d;d++){if(0===s._idRangeOffset[Number.parseInt(_.toString(),10)])h=d+s._idDelta[Number.parseInt(_.toString(),10)]&65535;else{if((c=_+s._idRangeOffset[Number.parseInt(_.toString(),10)]/2-a+d-s._startCount[Number.parseInt(_.toString(),10)])>=s._glyphID.length)continue;h=s._glyphID[Number.parseInt(c.toString(),10)]+s._idDelta[Number.parseInt(_.toString(),10)]&65535}var p=new pe;p._index=h,p._width=this._getWidth(p._index);var l=i===t._TrueTypeCmapEncoding.symbol&&61440==(65280&d)?255&d:d;p._charCode=l,n.setValue(l,p),this._addGlyph(p,i)}},e.prototype._readTrimmedCmapTable=function(t,e){var i=this._getTable("cmap");this._offset=i._offset+t._offset;var r=new oe;r._format=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._version=this._readUInt16(this._offset),r._firstCode=this._readUInt16(this._offset),r._entryCount=this._readUInt16(this._offset);for(var n=0;n<r._entryCount;++n){var s=new pe;s._index=this._readUInt16(this._offset),s._width=this._getWidth(s._index),s._charCode=n+r._firstCode,this.macintosh.setValue(n,s),this._addGlyph(s,e),this._maxMacIndex=Math.max(n,this._maxMacIndex)}},e.prototype._initializeFontName=function(t){for(var e=0;e<t._recordsCount;e++){var i=t._nameRecords[Number.parseInt(e.toString(),10)];if(1===i._nameID?this._metrics._fontFamily=i._name:6===i._nameID&&(this._metrics._postScriptName=i._name),null!==this._metrics._fontFamily&&"undefined"!==this._metrics._fontFamily&&null!==this._metrics._postScriptName&&"undefined"!==this._metrics._postScriptName)break}},e.prototype._getTable=function(t){var e,i=new Yt;return this._tableDirectory.containsKey(t)&&(e=this._tableDirectory.getValue(t)),null!==e&&void 0!==e&&(i=e),i},e.prototype._getWidth=function(t){return t=t<this._width.length?t:this._width.length-1,this._width[Number.parseInt(t.toString(),10)]},e.prototype._getCmapEncoding=function(e,i){var r=t._TrueTypeCmapEncoding.unknown;return e===t._TrueTypePlatformID.microsoft&&i===t._TrueTypeMicrosoftEncodingID.undefined?r=t._TrueTypeCmapEncoding.symbol:e===t._TrueTypePlatformID.microsoft&&i===t._TrueTypeMicrosoftEncodingID.unicode?r=t._TrueTypeCmapEncoding.unicode:e===t._TrueTypePlatformID.macintosh&&i===t._TrueTypeMacintoshEncodingID.roman&&(r=t._TrueTypeCmapEncoding.macintosh),r},e.prototype._addGlyph=function(e,i){var r=null;switch(i){case t._TrueTypeCmapEncoding.unicode:r=this._microsoftGlyphs;break;case t._TrueTypeCmapEncoding.macintosh:case t._TrueTypeCmapEncoding.symbol:r=this._macintoshGlyphs}r.setValue(e._index,e)},e.prototype._initializeMetrics=function(e,i,r,n,s,a){this._initializeFontName(e);for(var o=!1,h=0;h<a.length;h++){var c=a[Number.parseInt(h.toString(),10)];if(this._getCmapEncoding(c._platformID,c._encodingID)===t._TrueTypeCmapEncoding.symbol){o=!0;break}}this._metrics._isSymbol=o,this._metrics._macStyle=i._macStyle,this._metrics._isFixedPitch=0!==s._isFixedPitch,this._metrics._italicAngle=s._italicAngle;var _=1e3/i._unitsPerEm;this._metrics._winAscent=n._sTypoAscender*_,this._metrics._macAscent=r._ascender*_,this._metrics._capHeight=0!==n._sCapHeight?n._sCapHeight:.7*i._unitsPerEm*_,this._metrics._winDescent=n._sTypoDescender*_,this._metrics._macDescent=r._descender*_,this._metrics._leading=(n._sTypoAscender-n._sTypoDescender+n._sTypoLineGap)*_,this._metrics._lineGap=Math.ceil(r._lineGap*_);var d=i._xMin*_,p=Math.ceil(this._metrics._macAscent+this._metrics._lineGap),l=i._xMax*_,u=this._metrics._macDescent;this._metrics._fontBox=[d,p,l,u],this._metrics._stemV=80,this._metrics._widthTable=this._updateWidth(),this._metrics._contains=this._tableDirectory.containsKey("CFF"),this._metrics._subScriptSizeFactor=i._unitsPerEm/n._ySubscriptYSize,this._metrics._superscriptSizeFactor=i._unitsPerEm/n._ySuperscriptYSize},e.prototype._updateWidth=function(){var t=[];if(this._metrics._isSymbol)for(n=0;n<256;n++){var e=this._getGlyph(String.fromCharCode(Number.parseInt(n.toString(),10)));t[Number.parseInt(n.toString(),10)]=e._empty?0:e._width}else for(var i=[],r=String.fromCharCode(32),n=0;n<256;n++){i[0]=Number.parseInt(n.toString(),10);var s=this._getString(i,0,i.length),a=s.length>0?s[0]:"?";(e=this._getGlyph(a))._empty?(e=this._getGlyph(r),t[Number.parseInt(n.toString(),10)]=e._empty?0:e._width):t[Number.parseInt(n.toString(),10)]=e._width}return t},e.prototype._getDefaultGlyph=function(){return this._getGlyph(Qt._whiteSpace)},e.prototype._getString=function(t,e,i){for(var r="",n=0;n<i;n++)r+=String.fromCharCode(t[n+e]);return r},e.prototype._setOffset=function(t){this._offset=t},e.prototype._readFontProgram=function(t){var e=this._getGlyphChars(t),i=this._readLocaTable(this._bIsLocaShort);e&&e._size()<t._size()&&(this._missedGlyphs=t._size()-e._size()),this._updateGlyphChars(e,i);var r=this._generateGlyphTable(e,i,null,null),n=r.glyphTableSize,s=r.newLocaTable,a=r.newGlyphTable,o=this._updateLocaTable(s,this._bIsLocaShort),h=o.newLocaSize,c=o.newLocaUpdated;return this._getFontProgram(c,a,n,h)},e.prototype._generateGlyphTable=function(t,e,i,r){i=[];var n=t.keys();n.sort(function(t,e){return t-e});for(var s=0,a=0;a<n.length;a++){var o=n[Number.parseInt(a.toString(),10)];e._offsets.length>0&&(s+=e._offsets[o+1]-e._offsets[Number.parseInt(o.toString(),10)])}var h=this._align(s);r=[];for(a=0;a<h;a++)r.push(0);for(var c=0,_=0,d=this._getTable("glyf"),a=0;a<e._offsets.length;a++)if(i.push(c),_<n.length&&n[Number.parseInt(_.toString(),10)]===a){++_,i[Number.parseInt(a.toString(),10)]=c;var p=e._offsets[Number.parseInt(a.toString(),10)],l=e._offsets[a+1]-p;l>0&&(this._offset=d._offset+p,r=this._read(r,c,l).buffer,c+=l)}return{glyphTableSize:s,newLocaTable:i,newGlyphTable:r}},e.prototype._readLocaTable=function(t){var e=this._getTable("loca");this._offset=e._offset;var i=new le,r=[];if(t){n=e._length/2;r=[];for(s=0;s<n;s++)r[Number.parseInt(s.toString(),10)]=2*this._readUInt16(this._offset)}else{var n=e._length/4;r=[];for(var s=0;s<n;s++)r[Number.parseInt(s.toString(),10)]=this._readUInt32(this._offset)}return i._offsets=r,i},e.prototype._updateGlyphChars=function(t,e){t.containsKey(0)||t.setValue(0,0);for(var i=new kr,r=t.keys(),n=0;n<r.length;n++)i.setValue(r[Number.parseInt(n.toString(),10)],t.getValue(r[Number.parseInt(n.toString(),10)]));for(n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)];this._processCompositeGlyph(t,s,e)}},e.prototype._processCompositeGlyph=function(e,i,r){if(i<r._offsets.length-1){var n=r._offsets[Number.parseInt(i.toString(),10)];if(n!==r._offsets[i+1]){var s=this._getTable("glyf");this._offset=s._offset+n;var a=new ue;if(a.numberOfContours=this._readInt16(this._offset),a.xMin=this._readInt16(this._offset),a.yMin=this._readInt16(this._offset),a.xMax=this._readInt16(this._offset),a.yMax=this._readInt16(this._offset),a.numberOfContours<0)for(var o=0;;){var h=this._readUInt16(this._offset),c=this._readUInt16(this._offset);if(e.containsKey(c)||e.setValue(c,0),0==(h&t._TrueTypeCompositeGlyphFlag.MoreComponents))break;o=0!=(h&t._TrueTypeCompositeGlyphFlag.Arg1And2AreWords)?4:2,0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveScale)?o+=2:0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveAnXyScale)?o+=4:0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveTwoByTwo)&&(o+=8),this._offset+=o}}}},e.prototype._updateLocaTable=function(t,e){for(var i=e?2*t.length:4*t.length,r=this._align(i),n=new fe(r),s=0;s<t.length;s++){var a=t[Number.parseInt(s.toString(),10)];e?(a/=2,n._writeShort(a)):n._writeInt(a)}return{newLocaUpdated:n._data,newLocaSize:i}},e.prototype._align=function(t){return t+3&-4},e.prototype._getFontProgram=function(t,e,i,r){var n=this._getFontProgramLength(t,e,0),s=n.fontProgramLength,a=n.table,o=new fe(s);o._writeInt(65536),o._writeShort(a);var h=this._entrySelectors[Number.parseInt(a.toString(),10)];return o._writeShort(16*(1<<(31&h))),o._writeShort(h),o._writeShort(16*(a-(1<<(31&h)))),this._writeCheckSums(o,a,t,e,i,r),this._writeGlyphs(o,t,e),o._data},e.prototype._getFontProgramLength=function(t,e,i){var r=0;if(null!==t&&void 0!==t&&t.length>0&&null!==e&&void 0!==e&&e.length>0){i=2;for(var n=this._tableNames,s=0;s<n.length;s++){var a=n[Number.parseInt(s.toString(),10)];if("glyf"!==a&&"loca"!==a){var o=this._getTable(a);o._empty||(++i,r+=this._align(o._length))}}r+=t.length,r+=e.length,r+=16*i+12}return{fontProgramLength:r,table:i}},e.prototype._getGlyphChars=function(t){var e=new kr;if(null!==t&&void 0!==t)for(var i=t.keys(),r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)],s=this._getGlyph(n);s._empty||e.setValue(s._index,n.charCodeAt(0))}return e},e.prototype._writeCheckSums=function(t,e,i,r,n,s){if(null!==t&&void 0!==t&&null!==i&&void 0!==i&&i.length>0&&null!==r&&void 0!==r&&r.length>0)for(var a=this._tableNames,o=16*e+12,h=0,c=0;c<a.length;c++){var _=a[Number.parseInt(c.toString(),10)],d=this._getTable(_);if(!d._empty){if(t._writeString(_),"glyf"===_){p=this._calculateCheckSum(r);t._writeInt(p),h=n}else if("loca"===_){var p=this._calculateCheckSum(i);t._writeInt(p),h=s}else t._writeInt(d._checksum),h=d._length;t._writeUInt(o),t._writeUInt(h),o+=this._align(h)}}},e.prototype._calculateCheckSum=function(t){var e=0,i=0,r=0,n=0,s=0,a=0;if(null!==t&&void 0!==t&&t.length>0){for(var o=0;o<(t.length+1)/4;o++)s+=255&t[e++],n+=255&t[e++],r+=255&t[e++],i+=255&t[e++];a=i,a+=r<<8,a+=n<<16,a+=s<<24}return a},e.prototype._writeGlyphs=function(t,e,i){if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e.length>0&&null!==i&&void 0!==i&&i.length>0)for(var r=this._tableNames,n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)],a=this._getTable(s);if(!a._empty)if("glyf"===s)t._writeBytes(i);else if("loca"===s)t._writeBytes(e);else{for(var o=this._align(a._length),h=[],c=0;c<o;c++)h.push(0);this._offset=a._offset;var _=this._read(h,0,a._length);t._writeBytes(_.buffer)}}},e.prototype._read=function(t,e,i){var r=0;if(null!==t&&void 0!==t&&t.length>0){var n=0;do{for(var s=0;s<i-r&&this._offset+s<this._fontData.length;s++)t[e+s]=this._fontData[this._offset+s];n=i-r,this._offset+=n,r+=n}while(r<i)}return{buffer:t,written:r}},e.prototype._createInternals=function(){this._metrics=new _e;var t=this._readNameTable(),e=this._readHeadTable();this._bIsLocaShort=0===e._indexToLocalFormat;var i=this._readHorizontalHeaderTable(),r=this._readOS2Table(),n=this._readPostTable();this._width=this._readWidthTable(i._numberOfHMetrics,e._unitsPerEm);var s=this._readCmapTable();this._initializeMetrics(t,e,i,r,n,s)},e.prototype._getGlyph=function(t){if("number"==typeof t){var e=null;return this._metrics._isSymbol||null===this._microsoftGlyphs?this._metrics._isSymbol&&null!==this._macintoshGlyphs&&this._macintoshGlyphs.containsKey(t)&&(e=this._macintoshGlyphs.getValue(t)):this._microsoftGlyphs.containsKey(t)&&(e=this._microsoftGlyphs.getValue(t)),n=null!==e?e:this._getDefaultGlyph()}var i=null,r=t.charCodeAt(0);this._metrics._isSymbol||null===this._microsoft?(this._metrics._isSymbol&&null!==this.macintosh||this._isMacFont)&&(0!==this._maxMacIndex?r%=this._maxMacIndex+1:r=61440==(65280&r)?255&r:r,this.macintosh.containsKey(r)&&(i=this.macintosh.getValue(r),this._isFontPresent=!0)):this._microsoft.containsKey(r)?(i=this._microsoft.getValue(r),r!==Qt._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!0)):r!==Qt._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!1),t===Qt._whiteSpace&&null===i&&(i=new pe);var n=null!==i?i:this._getDefaultGlyph();return n},e.prototype._readString=function(t,e){if(void 0===e||null===e)return this._readString(t,!1);var i="";if(e)for(r=0;r<t;r++)r%2!=0&&(i+=String.fromCharCode(this._fontData[this._offset])),this._offset+=1;else for(var r=0;r<t;r++)i+=String.fromCharCode(this._fontData[this._offset]),this._offset+=1;return i},e.prototype._readFixed=function(t){return this._readInt16(t)+this._readInt16(t+2)/16384},e.prototype._readInt32=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)+3],i=this._fontData[Number.parseInt(t.toString(),10)+2],r=this._fontData[Number.parseInt(t.toString(),10)+1],n=this._fontData[Number.parseInt(t.toString(),10)];return this._offset+=4,e+(i<<8)+(r<<16)+(n<<24)},e.prototype._readUInt32=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)+3],i=this._fontData[Number.parseInt(t.toString(),10)+2],r=this._fontData[Number.parseInt(t.toString(),10)+1],n=this._fontData[Number.parseInt(t.toString(),10)];return this._offset+=4,e|i<<8|r<<16|n<<24},e.prototype._readInt16=function(t){var e=(this._fontData[Number.parseInt(t.toString(),10)]<<8)+this._fontData[Number.parseInt(t.toString(),10)+1];return e=32768&e?e-65536:e,this._offset+=2,e},e.prototype._readInt64=function(t){var e=this._readInt32(t+4),i=4294967296*this._readInt32(t)+e;return e<0&&(i+=4294967296),i},e.prototype._readUInt16=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)]<<8|this._fontData[Number.parseInt(t.toString(),10)+1];return this._offset+=2,e},e.prototype._readUShortArray=function(t){for(var e=[],i=0;i<t;i++)e[Number.parseInt(i.toString(),10)]=this._readUInt16(this._offset);return e},e.prototype._readBytes=function(t){for(var e=[],i=0;i<t;i++)e.push(this._fontData[Number.parseInt(this._offset.toString(),10)]),this._offset+=1;return e},e.prototype._readByte=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)];return this._offset+=1,e},e.prototype._getCharacterWidth=function(t){var e=this._getGlyph(t);return(e=e._empty?this._getDefaultGlyph():e)._empty?0:e._width},e.prototype._convertString=function(t){var e="";if(null!==t&&void 0!==t&&t.length>0)for(var i=0;i<t.length;i++){var r=t[Number.parseInt(i.toString(),10)],n=this._getGlyph(r);n._empty||(e+=String.fromCharCode(n._index))}return e},e}(),ce=function(){function t(){}return t}(),_e=function(){function t(){}return Object.defineProperty(t.prototype,"_isItalic",{get:function(){return 0!=(2&this._macStyle)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_isBold",{get:function(){return 0!=(1&this._macStyle)},enumerable:!0,configurable:!0}),t}(),de=function(){function t(){}return t}(),pe=function(){function t(){}return Object.defineProperty(t.prototype,"_empty",{get:function(){return this._index===this._width&&this._width===this._charCode&&0===this._charCode},enumerable:!0,configurable:!0}),t}(),le=function(){function t(){}return t}(),ue=function(){function t(){}return t}(),fe=function(){function t(t){this.int32Size=4,this.int16Size=2,this.int64Size=8,this._bufferLength=t,this._buffer=[]}return Object.defineProperty(t.prototype,"_data",{get:function(){if(this._buffer.length<this._bufferLength)for(var t=this._bufferLength-this._buffer.length,e=0;e<t;e++)this._buffer.push(0);return this._buffer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_position",{get:function(){return void 0!==this._internalPosition&&null!==this._internalPosition||(this._internalPosition=0),this._internalPosition},enumerable:!0,configurable:!0}),t.prototype._writeShort=function(t){var e=[(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeInt=function(t){var e=[(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeUInt=function(t){var e=[(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeString=function(t){if(null!==t&&void 0!==t){for(var e=[],i=0;i<t.length;i++)e.push(t.charCodeAt(i));this._flush(e)}},t.prototype._writeBytes=function(t){this._flush(t)},t.prototype._flush=function(t){if(null!==t&&void 0!==t){for(var e=this._position,i=0;i<t.length;i++)this._buffer[Number.parseInt(e.toString(),10)]=t[Number.parseInt(i.toString(),10)],e++;this._internalPosition+=t.length}},t}(),ge=function(){function e(t,e){if(this._nameString="ABCDEFGHIJKLMNOPQRSTUVWXYZ",this._isEmbedFont=!1,this._cmapPrefix="/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\r\n/CIDSystemInfo << /Registry (Adobe)/Ordering (UCS)/Supplement 0>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 beginCodeSpacerange\r\n",this._cmapEndCodeSpaceRange="endCodeSpacerange\r\n",this._cmapBeginRange="beginbfrange\r\n",this._cmapEndRange="endbfrange\r\n",this._cmapSuffix="endbfrange\nendcmap\nCMapName currentdict /CMap defineresource pop\nend end\r\n",null===t||void 0===t)throw new Error("ArgumentNullException:base64String");this._fontSize=e,this._fontString=t,this._Initialize()}return e.prototype._beginSave=function(){this._descendantFontBeginSave(),this._cmapBeginSave(),this._fontDictionaryBeginSave(),this._fontProgramBeginSave(),this._fontDescriptor&&(this._fontDescriptor.update("FontFile2",this._fontProgram),this._fontDescriptor._updated=!0,this._fontDescriptor._isFont=!0)},e.prototype._descendantFontBeginSave=function(){if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var t=this._getDescendantWidth();null!==t&&this._descendantFont.set("W",t)}},e.prototype._fontDictionaryBeginSave=function(){null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0&&this._fontDictionary.update("ToUnicode",this._cmap)},e.prototype._Initialize=function(){var t=k(this._fontString);this._fontData=t,this._ttfReader=new he(this._fontData),this._ttfMetrics=this._ttfReader._metrics},e.prototype._createInternals=function(){this._fontDictionary=new xr,this._descendantFont=new xr,this._metrics=new jt,this._ttfReader._createInternals(),this._usedChars=null;var t=[];this._fontProgram=new Cr(t,new xr),this._cmap=new Cr(t,new xr),this._ttfMetrics=this._ttfReader._metrics,this._initializeMetrics(),this._subsetName=this._getFontName(),this._createDescendantFont(),this._createFontDictionary()},e.prototype._getInternals=function(){return this._fontDictionary},e.prototype._initializeMetrics=function(){var t=this._ttfReader._metrics;this._metrics._ascent=t._macAscent,this._metrics._descent=t._macDescent,this._metrics._height=t._macAscent-t._macDescent+t._lineGap,this._metrics._name=t._fontFamily,this._metrics._postScriptName=t._postScriptName,this._metrics._size=this._fontSize,this._metrics._widthTable=new Ut(t._widthTable),this._metrics._lineGap=t._lineGap,this._metrics._subScriptSizeFactor=t._subScriptSizeFactor,this._metrics._superscriptSizeFactor=t._superscriptSizeFactor,this._metrics._isBold=t._isBold},e.prototype._getFontName=function(){for(var t="",e=0;e<6;e++){var i=Math.floor(26*Math.random())+0;t+=this._nameString[Number.parseInt(i.toString(),10)]}return t+="+",(t+=this._ttfReader._metrics._postScriptName).toString()},e.prototype._createDescendantFont=function(){this._descendantFont=new xr,this._descendantFont._updated=!0,this._descendantFont.set("Type",new vr("Font")),this._descendantFont.set("Subtype",new vr("CIDFontType2")),this._descendantFont.set("BaseFont",new vr(this._subsetName)),this._descendantFont.set("CIDToGIDMap",new vr("Identity")),this._descendantFont.set("DW",1e3),this._fontDescriptor=this._createFontDescriptor(),this._descendantFont.set("FontDescriptor",this._fontDescriptor);var t=this._createSystemInfo();this._descendantFont.set("CIDSystemInfo",t),this._descendantFont._isFont=!0},e.prototype._createFontDescriptor=function(){var t=new xr,e=this._ttfReader._metrics;return t.set("Type",new vr("FontDescriptor")),t.set("FontName",new vr(this._subsetName)),t.set("Flags",this._getDescriptorFlags()),t.set("FontBBox",this._getBoundBox()),t.set("MissingWidth",e._widthTable[32]),t.set("StemV",e._stemV),t.set("ItalicAngle",e._italicAngle),t.set("CapHeight",e._capHeight),t.set("Ascent",e._winAscent),t.set("Descent",e._winDescent),t.set("Leading",e._leading),t.set("AvgWidth",e._widthTable[32]),t.set("MaxWidth",e._widthTable[32]),t.set("XHeight",0),t.set("StemH",0),t._updated=!0,t},e.prototype._generateFontProgram=function(){var t=[];this._usedChars=null===this._usedChars||void 0===this._usedChars?new kr:this._usedChars,this._ttfReader._setOffset(0),t=this._ttfReader._readFontProgram(this._usedChars),this._fontProgram._clearStream(),this._fontProgram._writeBytes(t)},e.prototype._getBoundBox=function(){var t=this._ttfReader._metrics._fontBox,e=Math.abs(t[2]-t[0]),i=Math.abs(t[1]-t[3]);return[t[0],t[3],e,i]},e.prototype._cmapBeginSave=function(){this._generateCmap()},e.prototype._fontProgramBeginSave=function(){this._generateFontProgram()},e.prototype._toHexString=function(t,e){var i=t.toString(16);return e&&(i=i.toUpperCase()),"<0000".substring(0,5-i.length)+i+">"},e.prototype._generateCmap=function(){if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var t=this._ttfReader._getGlyphChars(this._usedChars);if(t._size()>0){var e=t.keys().sort(),i=e[0],r=e[e.length-1],n=this._toHexString(i,!1)+this._toHexString(r,!1)+"\r\n",s="";s+=this._cmapPrefix,s+=n,s+=this._cmapEndCodeSpaceRange;for(var a=0,o=0;o<e.length;o++){0===a&&(0!==o&&(s+=this._cmapEndRange),s+=a=Math.min(100,e.length-o),s+=" ",s+=this._cmapBeginRange),a-=1;var h=e[Number.parseInt(o.toString(),10)];s+=this._toHexString(h,!0)+this._toHexString(h,!0),s+=this._toHexString(t.getValue(h),!0)+"\n"}s+=this._cmapSuffix,this._cmap._clearStream(),this._cmap._write(s)}}},e.prototype._createFontDictionary=function(){this._fontDictionary._updated=!0,this._fontDictionary.set("Type",vr.get("Font")),this._fontDictionary.set("Subtype",vr.get("Type0")),this._fontDictionary.set("BaseFont",new vr(this._subsetName)),this._fontDictionary.set("Encoding",vr.get("Identity-H")),this._fontDictionary.set("DescendantFonts",this._descendantFont),this._fontDictionary._isFont=!0,this._fontDictionary._currentObj=this},e.prototype._createSystemInfo=function(){var t=new xr;return t._updated=!0,t.set("Registry","Adobe"),t.set("Ordering","Identity"),t.set("Supplement",0),t},e.prototype._getDescriptorFlags=function(){var e=0,i=this._ttfReader._metrics;return i._isFixedPitch&&(e|=t._FontDescriptorFlag.fixedPitch),i._isSymbol?e|=t._FontDescriptorFlag.symbolic:e|=t._FontDescriptorFlag.nonSymbolic,i._isItalic&&(e|=t._FontDescriptorFlag.italic),i._isBold&&(e|=t._FontDescriptorFlag.forceBold),e},e.prototype._getCharacterWidth=function(t){return this._ttfReader._getCharacterWidth(t)},e.prototype._setSymbols=function(t){if(null!==t&&void 0!==t){null!==this._usedChars&&void 0!==this._usedChars||(this._usedChars=new kr);for(var e=0;e<t.length;e++){var i=t[Number.parseInt(e.toString(),10)];this._usedChars.setValue(i,String.fromCharCode(0))}}},e.prototype._getDescendantWidth=function(){var t=new Array;if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){for(var e=[],i=this._usedChars.keys(),r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)],s=this._ttfReader._getGlyph(n);e.push(s)}e.sort(function(t,e){return t._index-e._index});for(var a=0,o=0,h=!1,c=new Array,r=0;r<e.length;r++){s=e[Number.parseInt(r.toString(),10)];h||(h=!0,a=s._index,o=s._index-1),(o+1!==s._index||r+1===e.length)&&e.length>1&&(t.push(Number(a)),0!==r&&t.push(c),a=s._index,c=new Array),c.push(Number(s._width)),r+1===e.length&&(t.push(Number(a)),t.push(c)),o=s._index}}return t},e}(),ye=function(){function t(){this._arabicCharTable=[["ء","ﺀ"],["آ","ﺁ","ﺂ"],["أ","ﺃ","ﺄ"],["ؤ","ﺅ","ﺆ"],["إ","ﺇ","ﺈ"],["ئ","ﺉ","ﺊ","ﺋ","ﺌ"],["ا","ﺍ","ﺎ"],["ب","ﺏ","ﺐ","ﺑ","ﺒ"],["ة","ﺓ","ﺔ"],["ت","ﺕ","ﺖ","ﺗ","ﺘ"],["ث","ﺙ","ﺚ","ﺛ","ﺜ"],["ج","ﺝ","ﺞ","ﺟ","ﺠ"],["ح","ﺡ","ﺢ","ﺣ","ﺤ"],["خ","ﺥ","ﺦ","ﺧ","ﺨ"],["د","ﺩ","ﺪ"],["ذ","ﺫ","ﺬ"],["ر","ﺭ","ﺮ"],["ز","ﺯ","ﺰ"],["س","ﺱ","ﺲ","ﺳ","ﺴ"],["ش","ﺵ","ﺶ","ﺷ","ﺸ"],["ص","ﺹ","ﺺ","ﺻ","ﺼ"],["ض","ﺽ","ﺾ","ﺿ","ﻀ"],["ط","ﻁ","ﻂ","ﻃ","ﻄ"],["ظ","ﻅ","ﻆ","ﻇ","ﻈ"],["ع","ﻉ","ﻊ","ﻋ","ﻌ"],["غ","ﻍ","ﻎ","ﻏ","ﻐ"],["ـ","ـ","ـ","ـ","ـ"],["ف","ﻑ","ﻒ","ﻓ","ﻔ"],["ق","ﻕ","ﻖ","ﻗ","ﻘ"],["ك","ﻙ","ﻚ","ﻛ","ﻜ"],["ل","ﻝ","ﻞ","ﻟ","ﻠ"],["م","ﻡ","ﻢ","ﻣ","ﻤ"],["ن","ﻥ","ﻦ","ﻧ","ﻨ"],["ه","ﻩ","ﻪ","ﻫ","ﻬ"],["و","ﻭ","ﻮ"],["ى","ﻯ","ﻰ","ﯨ","ﯩ"],["ي","ﻱ","ﻲ","ﻳ","ﻴ"],["ٱ","ﭐ","ﭑ"],["ٹ","ﭦ","ﭧ","ﭨ","ﭩ"],["ٺ","ﭞ","ﭟ","ﭠ","ﭡ"],["ٻ","ﭒ","ﭓ","ﭔ","ﭕ"],["پ","ﭖ","ﭗ","ﭘ","ﭙ"],["ٿ","ﭢ","ﭣ","ﭤ","ﭥ"],["ڀ","ﭚ","ﭛ","ﭜ","ﭝ"],["ڃ","ﭶ","ﭷ","ﭸ","ﭹ"],["ڄ","ﭲ","ﭳ","ﭴ","ﭵ"],["چ","ﭺ","ﭻ","ﭼ","ﭽ"],["ڇ","ﭾ","ﭿ","ﮀ","ﮁ"],["ڈ","ﮈ","ﮉ"],["ڌ","ﮄ","ﮅ"],["ڍ","ﮂ","ﮃ"],["ڎ","ﮆ","ﮇ"],["ڑ","ﮌ","ﮍ"],["ژ","ﮊ","ﮋ"],["ڤ","ﭪ","ﭫ","ﭬ","ﭭ"],["ڦ","ﭮ","ﭯ","ﭰ","ﭱ"],["ک","ﮎ","ﮏ","ﮐ","ﮑ"],["ڭ","ﯓ","ﯔ","ﯕ","ﯖ"],["گ","ﮒ","ﮓ","ﮔ","ﮕ"],["ڱ","ﮚ","ﮛ","ﮜ","ﮝ"],["ڳ","ﮖ","ﮗ","ﮘ","ﮙ"],["ں","ﮞ","ﮟ"],["ڻ","ﮠ","ﮡ","ﮢ","ﮣ"],["ھ","ﮪ","ﮫ","ﮬ","ﮭ"],["ۀ","ﮤ","ﮥ"],["ہ","ﮦ","ﮧ","ﮨ","ﮩ"],["ۅ","ﯠ","ﯡ"],["ۆ","ﯙ","ﯚ"],["ۇ","ﯗ","ﯘ"],["ۈ","ﯛ","ﯜ"],["ۉ","ﯢ","ﯣ"],["ۋ","ﯞ","ﯟ"],["ی","ﯼ","ﯽ","ﯾ","ﯿ"],["ې","ﯤ","ﯥ","ﯦ","ﯧ"],["ے","ﮮ","ﮯ"],["ۓ","ﮰ","ﮱ"]],this._alef="ا",this._alefHamza="أ",this._alefHamzaBelow="إ",this._alefMadda="آ",this._lam="ل",this._hamza="ء",this._zeroWidthJoiner="‍",this._hamzaAbove="ٔ",this._hamzaBelow="ٕ",this._wawHamza="ؤ",this._yehHamza="ئ",this._waw="و",this._alefsura="ى",this._yeh="ي",this._farsiYeh="ی",this._shadda="ّ",this._madda="ٓ",this._lwa="ﻻ",this._lwawh="ﻷ",this._lwawhb="ﻹ",this._lwawm="ﻵ",this._bwhb="ۓ",this._fathatan="ً",this._superalef="ٰ",this._vowel=1,this._arabicMapTable=new Map;for(var t=0;t<this._arabicCharTable.length;t++)this._arabicMapTable.set(this._arabicCharTable[Number.parseInt(t.toString(),10)][0],this._arabicCharTable[Number.parseInt(t.toString(),10)])}return t.prototype._getCharacterShape=function(t,e){if(t>=this._hamza&&t<=this._bwhb){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t)[e+1]}else if(t>=this._lwawm&&t<=this._lwa)return t;return t},t.prototype._shape=function(t){for(var e="",i="",r=0;r<t.length;r++){var n=t[Number.parseInt(r.toString(),10)];n>="؀"&&n<="ۿ"?i+=n:(i.length>0&&(e+=s=this._doShape(i.toString(),0),i=""),e+=n)}if(i.length>0){var s=this._doShape(i.toString(),0);e+=s}return e.toString()},t.prototype._doShape=function(t,e){for(var i="",r=0,n=0,s="",a=new me,o=new me;n<t.length;)if(s=t[n++],0===this._ligature(s,o)){var h=this._getShapeCount(s);r=1===h?0:2,a._shapes>2&&(r+=1),r%=o._shapes,o._shapeValue=this._getCharacterShape(o._shapeValue,r),i=this._append(i,a,e),a=o,(o=new me)._shapeValue=s,o._shapes=h,o._shapeLigature++}return r=a._shapes>2?1:0,r%=o._shapes,o._shapeValue=this._getCharacterShape(o._shapeValue,r),i=this._append(i,a,e),(i=this._append(i,o,e)).toString()},t.prototype._append=function(t,e,i){return""!==e._shapeValue&&(t+=e._shapeValue,e._shapeLigature-=1,""!==e._shapeType&&(0==(i&this._vowel)?(t+=e._shapeType,e._shapeLigature-=1):e._shapeLigature-=1),""!==e._shapeVowel&&(0==(i&this._vowel)?(t+=e._shapeVowel,e._shapeLigature-=1):e._shapeLigature-=1)),t},t.prototype._ligature=function(t,e){if(""!==e._shapeValue){var i=0;if(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef){if(i=1,""!==e._shapeVowel&&t!==this._shadda&&(i=2),t===this._shadda){if(""!==e._shapeType)return 0;e._shapeType=this._shadda}else t===this._hamzaBelow?e._shapeValue===this._alef?(e._shapeValue=this._alefHamzaBelow,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawhb,i=2):e._shapeType=this._hamzaBelow:t===this._hamzaAbove?e._shapeValue===this._alef?(e._shapeValue=this._alefHamza,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawh,i=2):e._shapeValue===this._waw?(e._shapeValue=this._wawHamza,i=2):e._shapeValue===this._yeh||e._shapeValue===this._alefsura||e._shapeValue===this._farsiYeh?(e._shapeValue=this._yehHamza,i=2):e._shapeType=this._hamzaAbove:t===this._madda?e._shapeValue===this._alef&&(e._shapeValue=this._alefMadda,i=2):e._shapeVowel=t;return 1===i&&e._shapeLigature++,i}return""!==e._shapeVowel?0:(e._shapeValue===this._lam&&(t===this._alef?(e._shapeValue=this._lwa,e._shapes=2,i=3):t===this._alefHamza?(e._shapeValue=this._lwawh,e._shapes=2,i=3):t===this._alefHamzaBelow?(e._shapeValue=this._lwawhb,e._shapes=2,i=3):t===this._alefMadda&&(e._shapeValue=this._lwawm,e._shapes=2,i=3)),i)}return 0},t.prototype._getShapeCount=function(t){if(t>=this._hamza&&t<=this._bwhb&&!(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef)){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t).length-1}else if(t===this._zeroWidthJoiner)return 4;return 1},t}(),me=function(){function t(){this._shapeValue="",this._shapeType="",this._shapeVowel="",this._shapeLigature=0,this._shapes=1}return t}(),be=function(){function t(){this._indexes=[],this._indexLevels=[],this._mirroringShape=new kr,this._update()}return t.prototype._doMirrorShaping=function(t){for(var e=[],i=0;i<t.length;i++)if(1==(1&this._indexLevels[Number.parseInt(i.toString(),10)])&&this._mirroringShape.containsKey(t[Number.parseInt(i.toString(),10)].charCodeAt(0))){var r=t[Number.parseInt(i.toString(),10)].charCodeAt(0);e[Number.parseInt(i.toString(),10)]=String.fromCharCode(this._mirroringShape.getValue(r))}else e[Number.parseInt(i.toString(),10)]=t[Number.parseInt(i.toString(),10)].toString();for(var n="",s=0;s<e.length;s++)n+=e[Number.parseInt(s.toString(),10)];return n},t.prototype._getLogicalToVisualString=function(t,e){var i=new ve;this._indexLevels=i._getVisualOrder(t,e),this._setDefaultIndexLevel(),this._doOrder(0,this._indexLevels.length-1);for(var r=this._doMirrorShaping(t),n="",s=0;s<this._indexes.length;s++){var a=this._indexes[Number.parseInt(s.toString(),10)];n+=r[Number.parseInt(a.toString(),10)]}return n.toString()},t.prototype._setDefaultIndexLevel=function(){for(var t=0;t<this._indexLevels.length;t++)this._indexes[Number.parseInt(t.toString(),10)]=t},t.prototype._doOrder=function(t,e){for(var i=this._indexLevels[Number.parseInt(t.toString(),10)],r=i,n=i,s=i,a=t+1;a<=e;++a){var o=this._indexLevels[Number.parseInt(a.toString(),10)];o>i?i=o:o<r&&(r=o),n&=o,s|=o}if(0!=(1&s)){if(1==(1&n))return void this._reArrange(t,e+1);for(r|=1;i>=r;){for(var h=t;;){for(;h<=e&&!(this._indexLevels[Number.parseInt(h.toString(),10)]>=i);)h+=1;if(h>e)break;for(var c=h+1;c<=e&&!(this._indexLevels[Number.parseInt(c.toString(),10)]<i);)c+=1;this._reArrange(h,c),h=c+1}i-=1}}},t.prototype._reArrange=function(t,e){var i=(t+e)/2;for(--e;t<i;++t,--e){var r=this._indexes[Number.parseInt(t.toString(),10)];this._indexes[Number.parseInt(t.toString(),10)]=this._indexes[Number.parseInt(e.toString(),10)],this._indexes[Number.parseInt(e.toString(),10)]=r}},t.prototype._update=function(){this._mirroringShape.setValue(40,41),this._mirroringShape.setValue(41,40),this._mirroringShape.setValue(60,62),this._mirroringShape.setValue(62,60),this._mirroringShape.setValue(91,93),this._mirroringShape.setValue(93,91),this._mirroringShape.setValue(123,125),this._mirroringShape.setValue(125,123),this._mirroringShape.setValue(171,187),this._mirroringShape.setValue(187,171),this._mirroringShape.setValue(8249,8250),this._mirroringShape.setValue(8250,8249),this._mirroringShape.setValue(8261,8262),this._mirroringShape.setValue(8262,8261),this._mirroringShape.setValue(8317,8318),this._mirroringShape.setValue(8318,8317),this._mirroringShape.setValue(8333,8334),this._mirroringShape.setValue(8334,8333),this._mirroringShape.setValue(8712,8715),this._mirroringShape.setValue(8713,8716),this._mirroringShape.setValue(8714,8717),this._mirroringShape.setValue(8715,8712),this._mirroringShape.setValue(8716,8713),this._mirroringShape.setValue(8717,8714),this._mirroringShape.setValue(8725,10741),this._mirroringShape.setValue(8764,8765),this._mirroringShape.setValue(8765,8764),this._mirroringShape.setValue(8771,8909),this._mirroringShape.setValue(8786,8787),this._mirroringShape.setValue(8787,8786),this._mirroringShape.setValue(8788,8789),this._mirroringShape.setValue(8789,8788),this._mirroringShape.setValue(8804,8805),this._mirroringShape.setValue(8805,8804),this._mirroringShape.setValue(8806,8807),this._mirroringShape.setValue(8807,8806),this._mirroringShape.setValue(8808,8809),this._mirroringShape.setValue(8809,8808),this._mirroringShape.setValue(8810,8811),this._mirroringShape.setValue(8811,8810),this._mirroringShape.setValue(8814,8815),this._mirroringShape.setValue(8815,8814),this._mirroringShape.setValue(8816,8817),this._mirroringShape.setValue(8817,8816),this._mirroringShape.setValue(8818,8819),this._mirroringShape.setValue(8819,8818),this._mirroringShape.setValue(8820,8821),this._mirroringShape.setValue(8821,8820),this._mirroringShape.setValue(8822,8823),this._mirroringShape.setValue(8823,8822),this._mirroringShape.setValue(8824,8825),this._mirroringShape.setValue(8825,8824),this._mirroringShape.setValue(8826,8827),this._mirroringShape.setValue(8827,8826),this._mirroringShape.setValue(8828,8829),this._mirroringShape.setValue(8829,8828),this._mirroringShape.setValue(8830,8831),this._mirroringShape.setValue(8831,8830),this._mirroringShape.setValue(8832,8833),this._mirroringShape.setValue(8833,8832),this._mirroringShape.setValue(8834,8835),this._mirroringShape.setValue(8835,8834),this._mirroringShape.setValue(8836,8837),this._mirroringShape.setValue(8837,8836),this._mirroringShape.setValue(8838,8839),this._mirroringShape.setValue(8839,8838),this._mirroringShape.setValue(8840,8841),this._mirroringShape.setValue(8841,8840),this._mirroringShape.setValue(8842,8843),this._mirroringShape.setValue(8843,8842),this._mirroringShape.setValue(8847,8848),this._mirroringShape.setValue(8848,8847),this._mirroringShape.setValue(8849,8850),this._mirroringShape.setValue(8850,8849),this._mirroringShape.setValue(8856,10680),this._mirroringShape.setValue(8866,8867),this._mirroringShape.setValue(8867,8866),this._mirroringShape.setValue(8870,10974),this._mirroringShape.setValue(8872,10980),this._mirroringShape.setValue(8873,10979),this._mirroringShape.setValue(8875,10981),this._mirroringShape.setValue(8880,8881),this._mirroringShape.setValue(8881,8880),this._mirroringShape.setValue(8882,8883),this._mirroringShape.setValue(8883,8882),this._mirroringShape.setValue(8884,8885),this._mirroringShape.setValue(8885,8884),this._mirroringShape.setValue(8886,8887),this._mirroringShape.setValue(8887,8886),this._mirroringShape.setValue(8905,8906),this._mirroringShape.setValue(8906,8905),this._mirroringShape.setValue(8907,8908),this._mirroringShape.setValue(8908,8907),this._mirroringShape.setValue(8909,8771),this._mirroringShape.setValue(8912,8913),this._mirroringShape.setValue(8913,8912),this._mirroringShape.setValue(8918,8919),this._mirroringShape.setValue(8919,8918),this._mirroringShape.setValue(8920,8921),this._mirroringShape.setValue(8921,8920),this._mirroringShape.setValue(8922,8923),this._mirroringShape.setValue(8923,8922),this._mirroringShape.setValue(8924,8925),this._mirroringShape.setValue(8925,8924),this._mirroringShape.setValue(8926,8927),this._mirroringShape.setValue(8927,8926),this._mirroringShape.setValue(8928,8929),this._mirroringShape.setValue(8929,8928),this._mirroringShape.setValue(8930,8931),this._mirroringShape.setValue(8931,8930),this._mirroringShape.setValue(8932,8933),this._mirroringShape.setValue(8933,8932),this._mirroringShape.setValue(8934,8935),this._mirroringShape.setValue(8935,8934),this._mirroringShape.setValue(8936,8937),this._mirroringShape.setValue(8937,8936),this._mirroringShape.setValue(8938,8939),this._mirroringShape.setValue(8939,8938),this._mirroringShape.setValue(8940,8941),this._mirroringShape.setValue(8941,8940),this._mirroringShape.setValue(8944,8945),this._mirroringShape.setValue(8945,8944),this._mirroringShape.setValue(8946,8954),this._mirroringShape.setValue(8947,8955),this._mirroringShape.setValue(8948,8956),this._mirroringShape.setValue(8950,8957),this._mirroringShape.setValue(8951,8958),this._mirroringShape.setValue(8954,8946),this._mirroringShape.setValue(8955,8947),this._mirroringShape.setValue(8956,8948),this._mirroringShape.setValue(8957,8950),this._mirroringShape.setValue(8958,8951),this._mirroringShape.setValue(8968,8969),this._mirroringShape.setValue(8969,8968),this._mirroringShape.setValue(8970,8971),this._mirroringShape.setValue(8971,8970),this._mirroringShape.setValue(9001,9002),this._mirroringShape.setValue(9002,9001),this._mirroringShape.setValue(10088,10089),this._mirroringShape.setValue(10089,10088),this._mirroringShape.setValue(10090,10091),this._mirroringShape.setValue(10091,10090),this._mirroringShape.setValue(10092,10093),this._mirroringShape.setValue(10093,10092),this._mirroringShape.setValue(10094,10095),this._mirroringShape.setValue(10095,10094),this._mirroringShape.setValue(10096,10097),this._mirroringShape.setValue(10097,10096),this._mirroringShape.setValue(10098,10099),this._mirroringShape.setValue(10099,10098),this._mirroringShape.setValue(10100,10101),this._mirroringShape.setValue(10101,10100),this._mirroringShape.setValue(10197,10198),this._mirroringShape.setValue(10198,10197),this._mirroringShape.setValue(10205,10206),this._mirroringShape.setValue(10206,10205),this._mirroringShape.setValue(10210,10211),this._mirroringShape.setValue(10211,10210),this._mirroringShape.setValue(10212,10213),this._mirroringShape.setValue(10213,10212),this._mirroringShape.setValue(10214,10215),this._mirroringShape.setValue(10215,10214),this._mirroringShape.setValue(10216,10217),this._mirroringShape.setValue(10217,10216),this._mirroringShape.setValue(10218,10219),this._mirroringShape.setValue(10219,10218),this._mirroringShape.setValue(10627,10628),this._mirroringShape.setValue(10628,10627),this._mirroringShape.setValue(10629,10630),this._mirroringShape.setValue(10630,10629),this._mirroringShape.setValue(10631,10632),this._mirroringShape.setValue(10632,10631),this._mirroringShape.setValue(10633,10634),this._mirroringShape.setValue(10634,10633),this._mirroringShape.setValue(10635,10636),this._mirroringShape.setValue(10636,10635),this._mirroringShape.setValue(10637,10640),this._mirroringShape.setValue(10638,10639),this._mirroringShape.setValue(10639,10638),this._mirroringShape.setValue(10640,10637),this._mirroringShape.setValue(10641,10642),this._mirroringShape.setValue(10642,10641),this._mirroringShape.setValue(10643,10644),this._mirroringShape.setValue(10644,10643),this._mirroringShape.setValue(10645,10646),this._mirroringShape.setValue(10646,10645),this._mirroringShape.setValue(10647,10648),this._mirroringShape.setValue(10648,10647),this._mirroringShape.setValue(10680,8856),this._mirroringShape.setValue(10688,10689),this._mirroringShape.setValue(10689,10688),this._mirroringShape.setValue(10692,10693),this._mirroringShape.setValue(10693,10692),this._mirroringShape.setValue(10703,10704),this._mirroringShape.setValue(10704,10703),this._mirroringShape.setValue(10705,10706),this._mirroringShape.setValue(10706,10705),this._mirroringShape.setValue(10708,10709),this._mirroringShape.setValue(10709,10708),this._mirroringShape.setValue(10712,10713),this._mirroringShape.setValue(10713,10712),this._mirroringShape.setValue(10714,10715),this._mirroringShape.setValue(10715,10714),this._mirroringShape.setValue(10741,8725),this._mirroringShape.setValue(10744,10745),this._mirroringShape.setValue(10745,10744),this._mirroringShape.setValue(10748,10749),this._mirroringShape.setValue(10749,10748),this._mirroringShape.setValue(10795,10796),this._mirroringShape.setValue(10796,10795),this._mirroringShape.setValue(10797,10796),this._mirroringShape.setValue(10798,10797),this._mirroringShape.setValue(10804,10805),this._mirroringShape.setValue(10805,10804),this._mirroringShape.setValue(10812,10813),this._mirroringShape.setValue(10813,10812),this._mirroringShape.setValue(10852,10853),this._mirroringShape.setValue(10853,10852),this._mirroringShape.setValue(10873,10874),this._mirroringShape.setValue(10874,10873),this._mirroringShape.setValue(10877,10878),this._mirroringShape.setValue(10878,10877),this._mirroringShape.setValue(10879,10880),this._mirroringShape.setValue(10880,10879),this._mirroringShape.setValue(10881,10882),this._mirroringShape.setValue(10882,10881),this._mirroringShape.setValue(10883,10884),this._mirroringShape.setValue(10884,10883),this._mirroringShape.setValue(10891,10892),this._mirroringShape.setValue(10892,10891),this._mirroringShape.setValue(10897,10898),this._mirroringShape.setValue(10898,10897),this._mirroringShape.setValue(10899,10900),this._mirroringShape.setValue(10900,10899),this._mirroringShape.setValue(10901,10902),this._mirroringShape.setValue(10902,10901),this._mirroringShape.setValue(10903,10904),this._mirroringShape.setValue(10904,10903),this._mirroringShape.setValue(10905,10906),this._mirroringShape.setValue(10906,10905),this._mirroringShape.setValue(10907,10908),this._mirroringShape.setValue(10908,10907),this._mirroringShape.setValue(10913,10914),this._mirroringShape.setValue(10914,10913),this._mirroringShape.setValue(10918,10919),this._mirroringShape.setValue(10919,10918),this._mirroringShape.setValue(10920,10921),this._mirroringShape.setValue(10921,10920),this._mirroringShape.setValue(10922,10923),this._mirroringShape.setValue(10923,10922),this._mirroringShape.setValue(10924,10925),this._mirroringShape.setValue(10925,10924),this._mirroringShape.setValue(10927,10928),this._mirroringShape.setValue(10928,10927),this._mirroringShape.setValue(10931,10932),this._mirroringShape.setValue(10932,10931),this._mirroringShape.setValue(10939,10940),this._mirroringShape.setValue(10940,10939),this._mirroringShape.setValue(10941,10942),this._mirroringShape.setValue(10942,10941),this._mirroringShape.setValue(10943,10944),this._mirroringShape.setValue(10944,10943),this._mirroringShape.setValue(10945,10946),this._mirroringShape.setValue(10946,10945),this._mirroringShape.setValue(10947,10948),this._mirroringShape.setValue(10948,10947),this._mirroringShape.setValue(10949,10950),this._mirroringShape.setValue(10950,10949),this._mirroringShape.setValue(10957,10958),this._mirroringShape.setValue(10958,10957),this._mirroringShape.setValue(10959,10960),this._mirroringShape.setValue(10960,10959),this._mirroringShape.setValue(10961,10962),this._mirroringShape.setValue(10962,10961),this._mirroringShape.setValue(10963,10964),this._mirroringShape.setValue(10964,10963),this._mirroringShape.setValue(10965,10966),this._mirroringShape.setValue(10966,10965),this._mirroringShape.setValue(10974,8870),this._mirroringShape.setValue(10979,8873),this._mirroringShape.setValue(10980,8872),this._mirroringShape.setValue(10981,8875),this._mirroringShape.setValue(10988,10989),this._mirroringShape.setValue(10989,10988),this._mirroringShape.setValue(10999,11e3),this._mirroringShape.setValue(11e3,10999),this._mirroringShape.setValue(11001,11002),this._mirroringShape.setValue(11002,11001),this._mirroringShape.setValue(12296,12297),this._mirroringShape.setValue(12297,12296),this._mirroringShape.setValue(12298,12299),this._mirroringShape.setValue(12299,12298),this._mirroringShape.setValue(12300,12301),this._mirroringShape.setValue(12301,12300),this._mirroringShape.setValue(12302,12303),this._mirroringShape.setValue(12303,12302),this._mirroringShape.setValue(12304,12305),this._mirroringShape.setValue(12305,12304),this._mirroringShape.setValue(12308,12309),this._mirroringShape.setValue(12309,12308),this._mirroringShape.setValue(12310,12311),this._mirroringShape.setValue(12311,12310),this._mirroringShape.setValue(12312,12313),this._mirroringShape.setValue(12313,12312),this._mirroringShape.setValue(12314,12315),this._mirroringShape.setValue(12315,12314),this._mirroringShape.setValue(65288,65289),this._mirroringShape.setValue(65289,65288),this._mirroringShape.setValue(65308,65310),this._mirroringShape.setValue(65310,65308),this._mirroringShape.setValue(65339,65341),this._mirroringShape.setValue(65341,65339),this._mirroringShape.setValue(65371,65373),this._mirroringShape.setValue(65373,65371),this._mirroringShape.setValue(65375,65376),this._mirroringShape.setValue(65376,65375),this._mirroringShape.setValue(65378,65379),this._mirroringShape.setValue(65379,65378)},t}(),ve=function(){function t(){this._type=[],this._textOrder=-1,this._rtlCharacterTypes=new Array(65536),this.L=0,this.lre=1,this.lro=2,this.R=3,this.AL=4,this.rle=5,this.rlo=6,this.pdf=7,this.EN=8,this.ES=9,this.ET=10,this.AN=11,this.CS=12,this.nsm=13,this.BN=14,this.B=15,this.S=16,this.WS=17,this.ON=18,this._charTypes=[this.L,this.EN,this.BN,this.ES,this.ES,this.S,this.ET,this.ET,this.B,this.AN,this.AN,this.S,this.CS,this.CS,this.WS,this.nsm,this.nsm,this.B,this.BN,27,this.BN,28,30,this.B,31,31,this.S,32,32,this.WS,33,34,this.ON,35,37,this.ET,38,42,this.ON,43,43,this.ET,44,44,this.CS,45,45,this.ET,46,46,this.CS,47,47,this.CS,48,57,this.EN,58,58,this.CS,59,64,this.ON,65,90,this.L,91,96,this.ON,97,122,this.L,123,126,this.ON,127,132,this.BN,133,133,this.B,134,159,this.BN,160,160,this.CS,161,161,this.ON,162,165,this.ET,166,169,this.ON,170,170,this.L,171,175,this.ON,176,177,this.ET,178,179,this.EN,180,180,this.ON,181,181,this.L,182,184,this.ON,185,185,this.EN,186,186,this.L,187,191,this.ON,192,214,this.L,215,215,this.ON,216,246,this.L,247,247,this.ON,248,696,this.L,697,698,this.ON,699,705,this.L,706,719,this.ON,720,721,this.L,722,735,this.ON,736,740,this.L,741,749,this.ON,750,750,this.L,751,767,this.ON,768,855,this.nsm,856,860,this.L,861,879,this.nsm,880,883,this.L,884,885,this.ON,886,893,this.L,894,894,this.ON,895,899,this.L,900,901,this.ON,902,902,this.L,903,903,this.ON,904,1013,this.L,1014,1014,this.ON,1015,1154,this.L,1155,1158,this.nsm,1159,1159,this.L,1160,1161,this.nsm,1162,1417,this.L,1418,1418,this.ON,1419,1424,this.L,1425,1441,this.nsm,1442,1442,this.L,1443,1465,this.nsm,1466,1466,this.L,1467,1469,this.nsm,1470,1470,this.R,1471,1471,this.nsm,1472,1472,this.R,1473,1474,this.nsm,1475,1475,this.R,1476,1476,this.nsm,1477,1487,this.L,1488,1514,this.R,1515,1519,this.L,1520,1524,this.R,1525,1535,this.L,1536,1539,this.AL,1540,1547,this.L,1548,1548,this.CS,1549,1549,this.AL,1550,1551,this.ON,1552,1557,this.nsm,1558,1562,this.L,1563,1563,this.AL,1564,1566,this.L,1567,1567,this.AL,1568,1568,this.L,1569,1594,this.AL,1595,1599,this.L,1600,1610,this.AL,1611,1624,this.nsm,1625,1631,this.L,1632,1641,this.AN,1642,1642,this.ET,1643,1644,this.AN,1645,1647,this.AL,1648,1648,this.nsm,1649,1749,this.AL,1750,1756,this.nsm,1757,1757,this.AL,1758,1764,this.nsm,1765,1766,this.AL,1767,1768,this.nsm,1769,1769,this.ON,1770,1773,this.nsm,1774,1775,this.AL,1776,1785,this.EN,1786,1805,this.AL,1806,1806,this.L,1807,1807,this.BN,1808,1808,this.AL,1809,1809,this.nsm,1810,1839,this.AL,1840,1866,this.nsm,1867,1868,this.L,1869,1871,this.AL,1872,1919,this.L,1920,1957,this.AL,1958,1968,this.nsm,1969,1969,this.AL,1970,2304,this.L,2305,2306,this.nsm,2307,2363,this.L,2364,2364,this.nsm,2365,2368,this.L,2369,2376,this.nsm,2377,2380,this.L,2381,2381,this.nsm,2382,2384,this.L,2385,2388,this.nsm,2389,2401,this.L,2402,2403,this.nsm,2404,2432,this.L,2433,2433,this.nsm,2434,2491,this.L,2492,2492,this.nsm,2493,2496,this.L,2497,2500,this.nsm,2501,2508,this.L,2509,2509,this.nsm,2510,2529,this.L,2530,2531,this.nsm,2532,2545,this.L,2546,2547,this.ET,2548,2560,this.L,2561,2562,this.nsm,2563,2619,this.L,2620,2620,this.nsm,2621,2624,this.L,2625,2626,this.nsm,2627,2630,this.L,2631,2632,this.nsm,2633,2634,this.L,2635,2637,this.nsm,2638,2671,this.L,2672,2673,this.nsm,2674,2688,this.L,2689,2690,this.nsm,2691,2747,this.L,2748,2748,this.nsm,2749,2752,this.L,2753,2757,this.nsm,2758,2758,this.L,2759,2760,this.nsm,2761,2764,this.L,2765,2765,this.nsm,2766,2785,this.L,2786,2787,this.nsm,2788,2800,this.L,2801,2801,this.ET,2802,2816,this.L,2817,2817,this.nsm,2818,2875,this.L,2876,2876,this.nsm,2877,2878,this.L,2879,2879,this.nsm,2880,2880,this.L,2881,2883,this.nsm,2884,2892,this.L,2893,2893,this.nsm,2894,2901,this.L,2902,2902,this.nsm,2903,2945,this.L,2946,2946,this.nsm,2947,3007,this.L,3008,3008,this.nsm,3009,3020,this.L,3021,3021,this.nsm,3022,3058,this.L,3059,3064,this.ON,3065,3065,this.ET,3066,3066,this.ON,3067,3133,this.L,3134,3136,this.nsm,3137,3141,this.L,3142,3144,this.nsm,3145,3145,this.L,3146,3149,this.nsm,3150,3156,this.L,3157,3158,this.nsm,3159,3259,this.L,3260,3260,this.nsm,3261,3275,this.L,3276,3277,this.nsm,3278,3392,this.L,3393,3395,this.nsm,3396,3404,this.L,3405,3405,this.nsm,3406,3529,this.L,3530,3530,this.nsm,3531,3537,this.L,3538,3540,this.nsm,3541,3541,this.L,3542,3542,this.nsm,3543,3632,this.L,3633,3633,this.nsm,3634,3635,this.L,3636,3642,this.nsm,3643,3646,this.L,3647,3647,this.ET,3648,3654,this.L,3655,3662,this.nsm,3663,3760,this.L,3761,3761,this.nsm,3762,3763,this.L,3764,3769,this.nsm,3770,3770,this.L,3771,3772,this.nsm,3773,3783,this.L,3784,3789,this.nsm,3790,3863,this.L,3864,3865,this.nsm,3866,3892,this.L,3893,3893,this.nsm,3894,3894,this.L,3895,3895,this.nsm,3896,3896,this.L,3897,3897,this.nsm,3898,3901,this.ON,3902,3952,this.L,3953,3966,this.nsm,3967,3967,this.L,3968,3972,this.nsm,3973,3973,this.L,3974,3975,this.nsm,3976,3983,this.L,3984,3991,this.nsm,3992,3992,this.L,3993,4028,this.nsm,4029,4037,this.L,4038,4038,this.nsm,4039,4140,this.L,4141,4144,this.nsm,4145,4145,this.L,4146,4146,this.nsm,4147,4149,this.L,4150,4151,this.nsm,4152,4152,this.L,4153,4153,this.nsm,4154,4183,this.L,4184,4185,this.nsm,4186,5759,this.L,5760,5760,this.WS,5761,5786,this.L,5787,5788,this.ON,5789,5905,this.L,5906,5908,this.nsm,5909,5937,this.L,5938,5940,this.nsm,5941,5969,this.L,5970,5971,this.nsm,5972,6001,this.L,6002,6003,this.nsm,6004,6070,this.L,6071,6077,this.nsm,6078,6085,this.L,6086,6086,this.nsm,6087,6088,this.L,6089,6099,this.nsm,6100,6106,this.L,6107,6107,this.ET,6108,6108,this.L,6109,6109,this.nsm,6110,6127,this.L,6128,6137,this.ON,6138,6143,this.L,6144,6154,this.ON,6155,6157,this.nsm,6158,6158,this.WS,6159,6312,this.L,6313,6313,this.nsm,6314,6431,this.L,6432,6434,this.nsm,6435,6438,this.L,6439,6443,this.nsm,6444,6449,this.L,6450,6450,this.nsm,6451,6456,this.L,6457,6459,this.nsm,6460,6463,this.L,6464,6464,this.ON,6465,6467,this.L,6468,6469,this.ON,6470,6623,this.L,6624,6655,this.ON,6656,8124,this.L,8125,8125,this.ON,8126,8126,this.L,8127,8129,this.ON,8130,8140,this.L,8141,8143,this.ON,8144,8156,this.L,8157,8159,this.ON,8160,8172,this.L,8173,8175,this.ON,8176,8188,this.L,8189,8190,this.ON,8191,8191,this.L,8192,8202,this.WS,8203,8205,this.BN,8206,8206,this.L,8207,8207,this.R,8208,8231,this.ON,8232,8232,this.WS,8233,8233,this.B,8234,8234,this.lre,8235,8235,this.rle,8236,8236,this.pdf,8237,8237,this.lro,8238,8238,this.rlo,8239,8239,this.WS,8240,8244,this.ET,8245,8276,this.ON,8277,8278,this.L,8279,8279,this.ON,8280,8286,this.L,8287,8287,this.WS,8288,8291,this.BN,8292,8297,this.L,8298,8303,this.BN,8304,8304,this.EN,8305,8307,this.L,8308,8313,this.EN,8314,8315,this.ET,8316,8318,this.ON,8319,8319,this.L,8320,8329,this.EN,8330,8331,this.ET,8332,8334,this.ON,8335,8351,this.L,8352,8369,this.ET,8370,8399,this.L,8400,8426,this.nsm,8427,8447,this.L,8448,8449,this.ON,8450,8450,this.L,8451,8454,this.ON,8455,8455,this.L,8456,8457,this.ON,8458,8467,this.L,8468,8468,this.ON,8469,8469,this.L,8470,8472,this.ON,8473,8477,this.L,8478,8483,this.ON,8484,8484,this.L,8485,8485,this.ON,8486,8486,this.L,8487,8487,this.ON,8488,8488,this.L,8489,8489,this.ON,8490,8493,this.L,8494,8494,this.ET,8495,8497,this.L,8498,8498,this.ON,8499,8505,this.L,8506,8507,this.ON,8508,8511,this.L,8512,8516,this.ON,8517,8521,this.L,8522,8523,this.ON,8524,8530,this.L,8531,8543,this.ON,8544,8591,this.L,8592,8721,this.ON,8722,8723,this.ET,8724,9013,this.ON,9014,9082,this.L,9083,9108,this.ON,9109,9109,this.L,9110,9168,this.ON,9169,9215,this.L,9216,9254,this.ON,9255,9279,this.L,9280,9290,this.ON,9291,9311,this.L,9312,9371,this.EN,9372,9449,this.L,9450,9450,this.EN,9451,9751,this.ON,9752,9752,this.L,9753,9853,this.ON,9854,9855,this.L,9856,9873,this.ON,9874,9887,this.L,9888,9889,this.ON,9890,9984,this.L,9985,9988,this.ON,9989,9989,this.L,9990,9993,this.ON,9994,9995,this.L,9996,10023,this.ON,10024,10024,this.L,10025,10059,this.ON,10060,10060,this.L,10061,10061,this.ON,10062,10062,this.L,10063,10066,this.ON,10067,10069,this.L,10070,10070,this.ON,10071,10071,this.L,10072,10078,this.ON,10079,10080,this.L,10081,10132,this.ON,10133,10135,this.L,10136,10159,this.ON,10160,10160,this.L,10161,10174,this.ON,10175,10191,this.L,10192,10219,this.ON,10220,10223,this.L,10224,11021,this.ON,11022,11903,this.L,11904,11929,this.ON,11930,11930,this.L,11931,12019,this.ON,12020,12031,this.L,12032,12245,this.ON,12246,12271,this.L,12272,12283,this.ON,12284,12287,this.L,12288,12288,this.WS,12289,12292,this.ON,12293,12295,this.L,12296,12320,this.ON,12321,12329,this.L,12330,12335,this.nsm,12336,12336,this.ON,12337,12341,this.L,12342,12343,this.ON,12344,12348,this.L,12349,12351,this.ON,12352,12440,this.L,12441,12442,this.nsm,12443,12444,this.ON,12445,12447,this.L,12448,12448,this.ON,12449,12538,this.L,12539,12539,this.ON,12540,12828,this.L,12829,12830,this.ON,12831,12879,this.L,12880,12895,this.ON,12896,12923,this.L,12924,12925,this.ON,12926,12976,this.L,12977,12991,this.ON,12992,13003,this.L,13004,13007,this.ON,13008,13174,this.L,13175,13178,this.ON,13179,13277,this.L,13278,13279,this.ON,13280,13310,this.L,13311,13311,this.ON,13312,19903,this.L,19904,19967,this.ON,19968,42127,this.L,42128,42182,this.ON,42183,64284,this.L,64285,64285,this.R,64286,64286,this.nsm,64287,64296,this.R,64297,64297,this.ET,64298,64310,this.R,64311,64311,this.L,64312,64316,this.R,64317,64317,this.L,64318,64318,this.R,64319,64319,this.L,64320,64321,this.R,64322,64322,this.L,64323,64324,this.R,64325,64325,this.L,64326,64335,this.R,64336,64433,this.AL,64434,64466,this.L,64467,64829,this.AL,64830,64831,this.ON,64832,64847,this.L,64848,64911,this.AL,64912,64913,this.L,64914,64967,this.AL,64968,65007,this.L,65008,65020,this.AL,65021,65021,this.ON,65022,65023,this.L,65024,65039,this.nsm,65040,65055,this.L,65056,65059,this.nsm,65060,65071,this.L,65072,65103,this.ON,65104,65104,this.CS,65105,65105,this.ON,65106,65106,this.CS,65107,65107,this.L,65108,65108,this.ON,65109,65109,this.CS,65110,65118,this.ON,65119,65119,this.ET,65120,65121,this.ON,65122,65123,this.ET,65124,65126,this.ON,65127,65127,this.L,65128,65128,this.ON,65129,65130,this.ET,65131,65131,this.ON,65132,65135,this.L,65136,65140,this.AL,65141,65141,this.L,65142,65276,this.AL,65277,65278,this.L,65279,65279,this.BN,65280,65280,this.L,65281,65282,this.ON,65283,65285,this.ET,65286,65290,this.ON,65291,65291,this.ET,65292,65292,this.CS,65293,65293,this.ET,65294,65294,this.CS,65295,65295,this.ES,65296,65305,this.EN,65306,65306,this.CS,65307,65312,this.ON,65313,65338,this.L,65339,65344,this.ON,65345,65370,this.L,65371,65381,this.ON,65382,65503,this.L,65504,65505,this.ET,65506,65508,this.ON,65509,65510,this.ET,65511,65511,this.L,65512,65518,this.ON,65519,65528,this.L,65529,65531,this.BN,65532,65533,this.ON,65534,65535,this.L];for(var t=0;t<this._charTypes.length;++t)for(var e=this._charTypes[Number.parseInt(t.toString(),10)],i=this._charTypes[++t],r=this._charTypes[++t];e<=i;)this._rtlCharacterTypes[e++]=r}return t.prototype._getVisualOrder=function(t,e){this._type=this._getCharacterCode(t),this._textOrder=e?this.lre:this.L,this._doVisualOrder();for(var i=[],r=0;r<this._levels.length;r++)i[Number.parseInt(r.toString(),10)]=this._levels[Number.parseInt(r.toString(),10)];return i},t.prototype._getCharacterCode=function(t){for(var e=[],i=0;i<t.length;i++){var r=t[Number.parseInt(i.toString(),10)].charCodeAt(0);e[Number.parseInt(i.toString(),10)]=this._rtlCharacterTypes[Number.parseInt(r.toString(),10)]}return e},t.prototype._setDefaultLevels=function(){for(var t=0;t<this._length;t++)this._levels[Number.parseInt(t.toString(),10)]=this._textOrder},t.prototype._setLevels=function(){this._setDefaultLevels();for(var t=0;t<this._length;++t){var e=this._levels[Number.parseInt(t.toString(),10)];this._levels[Number.parseInt(t.toString(),10)]=e}},t.prototype._updateLevels=function(t,e,i){if(0==(1&e))for(r=t;r<i;++r)this._result[Number.parseInt(r.toString(),10)]===this.R?this._levels[Number.parseInt(r.toString(),10)]+=1:this._result[Number.parseInt(r.toString(),10)]!==this.L&&(this._levels[Number.parseInt(r.toString(),10)]+=2);else for(var r=t;r<i;++r)this._result[Number.parseInt(r.toString(),10)]!==this.R&&(this._levels[Number.parseInt(r.toString(),10)]+=1)},t.prototype._doVisualOrder=function(){this._length=this._type.length,this._result=this._type,this._levels=[],this._setLevels(),this._length=this._getEmbeddedCharactersLength();for(var t=this._textOrder,e=0;e<this._length;){for(var i=this._levels[Number.parseInt(e.toString(),10)],r=0==(1&Math.max(t,i))?this.L:this.R,n=e+1;n<this._length&&this._levels[Number.parseInt(n.toString(),10)]===i;)++n;var s=n<this._length?this._levels[Number.parseInt(n.toString(),10)]:this._textOrder,a=0==(1&Math.max(s,i))?this.L:this.R;this._check(e,n,i,r,a),this._updateLevels(e,i,n),t=i,e=n}this._checkEmbeddedCharacters(this._length)},t.prototype._getEmbeddedCharactersLength=function(){for(var t=0,e=0;e<this._length;++e)this._type[Number.parseInt(e.toString(),10)]!==this.lre&&this._type[Number.parseInt(e.toString(),10)]!==this.rle&&this._type[Number.parseInt(e.toString(),10)]!==this.lro&&this._type[Number.parseInt(e.toString(),10)]!==this.rlo&&this._type[Number.parseInt(e.toString(),10)]!==this.pdf&&this._type[Number.parseInt(e.toString(),10)]!==this.BN&&(this._result[Number.parseInt(t.toString(),10)]=this._result[Number.parseInt(e.toString(),10)],this._levels[Number.parseInt(t.toString(),10)]=this._levels[Number.parseInt(e.toString(),10)],t++);return t},t.prototype._checkEmbeddedCharacters=function(t){for(e=this._type.length-1;e>=0;--e)this._type[Number.parseInt(e.toString(),10)]===this.lre||this._type[Number.parseInt(e.toString(),10)]===this.rle||this._type[Number.parseInt(e.toString(),10)]===this.lro||this._type[Number.parseInt(e.toString(),10)]===this.rlo||this._type[Number.parseInt(e.toString(),10)]===this.pdf||this._type[Number.parseInt(e.toString(),10)]===this.BN?(this._result[Number.parseInt(e.toString(),10)]=this._type[Number.parseInt(e.toString(),10)],this._levels[Number.parseInt(e.toString(),10)]=-1):(t-=1,this._result[Number.parseInt(e.toString(),10)]=this._result[Number.parseInt(t.toString(),10)],this._levels[Number.parseInt(e.toString(),10)]=this._levels[Number.parseInt(t.toString(),10)]);for(var e=0;e<this._type.length;e++)-1===this._levels[Number.parseInt(e.toString(),10)]&&(this._levels[Number.parseInt(e.toString(),10)]=this._levels[e-1])},t.prototype._check=function(t,e,i,r,n){for(var s=r,a=t;a<e;++a)this._result[Number.parseInt(a.toString(),10)]===this.nsm?this._result[Number.parseInt(a.toString(),10)]=s:s=this._result[Number.parseInt(a.toString(),10)];this._checkEuropeanDigits(t,e,i,r,n)},t.prototype._checkEuropeanDigits=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.EN)for(var a=s-1;a>=t;--a)if(this._result[Number.parseInt(a.toString(),10)]===this.L||this._result[Number.parseInt(a.toString(),10)]===this.R||this._result[Number.parseInt(a.toString(),10)]===this.AL){this._result[Number.parseInt(a.toString(),10)]===this.AL&&(this._result[Number.parseInt(s.toString(),10)]=this.AN);break}this._checkArabicCharacters(t,e,i,r,n)},t.prototype._checkArabicCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)this._result[Number.parseInt(s.toString(),10)]===this.AL&&(this._result[Number.parseInt(s.toString(),10)]=this.R);this._checkEuropeanNumberSeparator(t,e,i,r,n)},t.prototype._checkEuropeanNumberSeparator=function(t,e,i,r,n){for(var s=t+1;s<e-1;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.ES||this._result[Number.parseInt(s.toString(),10)]===this.CS){var a=this._result[s-1],o=this._result[s+1];a===this.EN&&o===this.EN?this._result[Number.parseInt(s.toString(),10)]=this.EN:this._result[Number.parseInt(s.toString(),10)]===this.CS&&a===this.AN&&o===this.AN&&(this._result[Number.parseInt(s.toString(),10)]=this.AN)}this._checkEuropeanNumberTerminator(t,e,i,r,n)},t.prototype._checkEuropeanNumberTerminator=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.ET){var a=s,o=[];o.push(this.ET);var h=this._getLength(a,e,o),c=a===t?r:this._result[a-1];c!==this.EN&&(c=h===e?n:this._result[Number.parseInt(h.toString(),10)]),s=h}this._checkOtherNeutrals(t,e,i,r,n)},t.prototype._checkOtherNeutrals=function(t,e,i,r,n){for(var s=t;s<e;++s)this._result[Number.parseInt(s.toString(),10)]!==this.ES&&this._result[Number.parseInt(s.toString(),10)]!==this.ET&&this._result[Number.parseInt(s.toString(),10)]!==this.CS||(this._result[Number.parseInt(s.toString(),10)]=this.ON);this._checkOtherCharacters(t,e,i,r,n)},t.prototype._checkOtherCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.EN){for(var a=r,o=s-1;o>=t;--o)if(this._result[Number.parseInt(o.toString(),10)]===this.L||this._result[Number.parseInt(o.toString(),10)]===this.R){a=this._result[Number.parseInt(o.toString(),10)];break}a===this.L&&(this._result[Number.parseInt(s.toString(),10)]=this.L)}this._checkCharacters(t,e,i,r,n)},t.prototype._getLength=function(t,e,i){for(--t;++t<e;){for(var r=this._result[Number.parseInt(t.toString(),10)],n=0;n<i.length;++n)r===i[Number.parseInt(n.toString(),10)]&&(t=this._getLength(++t,e,i));return t}return e},t.prototype._checkCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.WS||this._result[Number.parseInt(s.toString(),10)]===this.ON||this._result[Number.parseInt(s.toString(),10)]===this.B||this._result[Number.parseInt(s.toString(),10)]===this.S){var a=s,o=[this.B,this.S,this.WS,this.ON],h=this._getLength(a,e,o),c=0,_=0,d=0;a===t?c=r:(c=this._result[a-1])===this.AN?c=this.R:c===this.EN&&(c=this.R),h===e?_=n:(_=this._result[Number.parseInt(h.toString(),10)])===this.AN&&(_=this.R),d=c===_?c:0==(1&i)?this.L:this.R;for(var p=a;p<h;++p)this._result[Number.parseInt(p.toString(),10)]=d;s=h}},t}(),Se=function(){function e(){this._openBracket="(",this._closeBracket=")"}return e.prototype._layout=function(t,e,i,r,n){var s=[];return null!==e&&void 0!==e&&null!==t&&void 0!==t&&(e._isUnicode?s=this._customLayout(t,i,n,e,r):(s=[])[0]=t),s},e.prototype._splitLayout=function(t,e,i,r,n){var s=[];if(null!==e&&void 0!==e&&null!==t&&void 0!==t){s=this._customSplitLayout(t,e,i,r,n)}return s},e.prototype._getGlyphIndex=function(t,e,i){if(i=[],null!==e&&void 0!==e&&null!==t&&void 0!==t){if(0===t.length)return{_result:!1,_glyphIndex:i};var r=(new ye)._shape(t),n=e._fontInternal._ttfReader;i=[r.length];for(var s=0,a=0,o=r.length;a<o;a++){var h=r[Number.parseInt(a.toString(),10)],c=n._getGlyph(h);null!==c&&void 0!==c&&(i[s++]=c._index)}}var _=new Ce;return _._result=!0,_._glyphIndex=i,_},e.prototype._customLayout=function(e,i,r,n,s){if(null===s||void 0===s){o=null;return null!==e&&void 0!==e&&null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none&&(o=(new be)._getLogicalToVisualString(e,i)),o}var a="",o=[];if(null!==e&&void 0!==e&&null!==n&&void 0!==n){if(null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none){var h=(new ye)._shape(e);a=this._customLayout(h,i,r)}if(s){for(var c=a.split(""),_=c.length,d=0;d<_;d++)c[Number.parseInt(d.toString(),10)]=this._addCharacter(n,c[Number.parseInt(d.toString(),10)]);o=c}else(o=[])[0]=this._addCharacter(n,a)}return o},e.prototype._addCharacter=function(t,e){if(null!==t&&void 0!==t&&null!==e&&void 0!==e){var i=t._fontInternal._ttfReader;t._setSymbols(e),e=b(v(e=i._convertString(e)))}return e},e.prototype._customSplitLayout=function(t,e,i,r,n){var s=[];return null!==t&&void 0!==t&&(s=this._customLayout(t,i,n).split("")),s},e}(),we=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Pe=function(){function e(t,e){"number"==typeof t&&void 0===e?this._size=t:(this._size=t,this._style=e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUnderline",{get:function(){return(this.style&t.PdfFontStyle.underline)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isStrikeout",{get:function(){return(this.style&t.PdfFontStyle.strikeout)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_metrics",{get:function(){return this._fontMetrics},set:function(t){this._fontMetrics=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBold",{get:function(){return(this.style&t.PdfFontStyle.bold)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isItalic",{get:function(){return(this.style&t.PdfFontStyle.italic)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._metrics._getHeight()},enumerable:!0,configurable:!0}),e.prototype._setInternals=function(t){if(!t)throw new Error("ArgumentNullException:internals");this._pdfFontInternals=t},e.prototype._getCharacterCount=function(t,e){if("string"==typeof e){var i=0,r=0;for(r=t.indexOf(e,r);-1!==r;)i++,r++,r=t.indexOf(e,r);return i}for(var n=0,s=0;s<t.length;s++)-1!==e.indexOf(t[Number.parseInt(s.toString(),10)])&&n++;return n},e.prototype.measureString=function(t,e,i,r,n){if("string"==typeof t&&void 0===e)return this.measureString(t,null);if("string"==typeof t&&(e instanceof Et||null===e)&&void 0===i&&void 0===r){o=e;return this.measureString(t,o,0,0)}if("string"==typeof t&&(e instanceof Et||null===e)&&"number"==typeof i&&"number"==typeof r){o=e;return this.measureString(t,0,o,i,r)}if("string"==typeof t&&"number"==typeof e&&(i instanceof Et||null===i)&&"number"==typeof r&&"number"==typeof n){var s=[e,0],a=i;return this.measureString(t,s,a,r,n)}var o=e,a=i,h=(new qt)._layout(t,this,a,o);return r=t.length,n=h._empty?0:h._lines.length,h._actualSize},e.prototype._applyFormatSettings=function(t,e,i){var r=i;return void 0!==e&&null!==e&&i>0&&(0!==e.characterSpacing&&(r+=(t.length-1)*e.characterSpacing),0!==e.wordSpacing&&(r+=this._getCharacterCount(t,[" ","\t"])*e.wordSpacing)),r},e}(),Ae=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._fontFamily=i,s._checkStyle(),s._initializeInternals(),s}return we(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),i.prototype._checkStyle=function(){this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats||(this._style&=~(t.PdfFontStyle.bold|t.PdfFontStyle.italic))},i.prototype.getLineWidth=function(t,e){for(var i=0,r=0,n=t.length;r<n;r++)i+=this._getCharacterWidthInternal(t[Number.parseInt(r.toString(),10)]);return i*=.001*this._metrics._size,i=this._applyFormatSettings(t,e,i)},i.prototype._initializeInternals=function(){this._metrics=Te._getMetrics(this._fontFamily,this._style,this._size),this._dictionary=this._createInternals()},i.prototype._createInternals=function(){var e=new xr;return e._updated=!0,e.set("Type",vr.get("Font")),e.set("Subtype",vr.get("Type1")),e.set("BaseFont",new vr(this._metrics._postScriptName)),this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats&&e.set("Encoding",new vr("WinAnsiEncoding")),e},i.prototype._getCharacterWidthInternal=function(t){var e=0;return e=t.charCodeAt(0),"0"!==this._metrics._name&&"1"!==this._metrics._name&&"2"!==this._metrics._name&&"3"!==this._metrics._name&&"4"!==this._metrics._name||(e-=32),e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}(Pe),ke=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._fontFamily=i,s._size=r,s._initializeInternals(),s}return we(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),i.prototype._initializeInternals=function(){this._metrics=Ie._getMetrics(this._fontFamily,this._style,this._size),this._dictionary=this._createInternals()},i.prototype._createInternals=function(){var t=new xr;return t._updated=!0,t.set("Type",vr.get("Font")),t.set("Subtype",vr.get("Type0")),t.set("BaseFont",new vr(this._metrics._postScriptName)),t.set("Encoding",this._getEncoding(this._fontFamily)),t.set("DescendantFonts",this._getDescendantFont()),t},i.prototype._getEncoding=function(e){var i="Unknown";switch(e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:i="UniKS-UCS2-H";break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:case t.PdfCjkFontFamily.heiseiMinchoW3:i="UniJIS-UCS2-H";break;case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.monotypeSungLight:i="UniCNS-UCS2-H";break;case t.PdfCjkFontFamily.sinoTypeSongLight:i="UniGB-UCS2-H"}return new vr(i)},i.prototype._getDescendantFont=function(){var t=new xr;return t._updated=!0,t.set("Type",vr.get("Font")),t.set("Subtype",vr.get("CIDFontType2")),t.set("BaseFont",new vr(this._metrics._postScriptName)),t.set("DW",this._metrics._widthTable._defaultWidth),t.set("W",this._metrics._widthTable._toArray()),t.set("FontDescriptor",Ne._getFontDescriptor(this._fontFamily,this._style,this._metrics)),t.set("CIDSystemInfo",this._getSystemInformation()),[t]},i.prototype._getSystemInformation=function(){var e=new xr;switch(e._updated=!0,e.set("Registry","Adobe"),this._fontFamily){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:e.set("Ordering","Korea1"),e.set("Supplement",1);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:case t.PdfCjkFontFamily.heiseiMinchoW3:e.set("Ordering","Japan1"),e.set("Supplement",2);break;case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.monotypeSungLight:e.set("Ordering","CNS1"),e.set("Supplement","0");break;case t.PdfCjkFontFamily.sinoTypeSongLight:e.set("Ordering","GB1"),e.set("Supplement",2)}return e},i.prototype.getLineWidth=function(t,e){for(var i=0,r=0;r<t.length;r++)i+=this._getCharacterWidthInternal(t.charCodeAt(r));return i*=.001*this._metrics._size,i=this._applyFormatSettings(t,e,i)},i.prototype._getCharacterWidthInternal=function(t){return t=t>=0?t:0,this._metrics._widthTable._itemAt(t)},i}(Pe),xe=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._isEmbedFont=!1,s._isUnicode=!0,void 0!==n?s._createFontInternal(i,n):s._createFontInternal(i,t.PdfFontStyle.regular),s}return we(i,e),Object.defineProperty(i.prototype,"isUnicode",{get:function(){return this._isUnicode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isEmbed",{get:function(){return this._isEmbedFont},enumerable:!0,configurable:!0}),i.prototype._createFontInternal=function(t,e){this._fontInternal=new ge(t,this._size),this._calculateStyle(e),this._initializeInternals()},i.prototype._calculateStyle=function(e){var i=this._fontInternal._ttfMetrics._macStyle;0!=(e&t.PdfFontStyle.underline)&&(i|=t.PdfFontStyle.underline),0!=(e&t.PdfFontStyle.strikeout)&&(i|=t.PdfFontStyle.strikeout),this.style=i},i.prototype._initializeInternals=function(){var t=null;this._fontInternal instanceof ge&&(this._fontInternal._isEmbed=this._isEmbedFont),this._fontInternal._createInternals(),t=this._fontInternal._getInternals(),this._metrics=this._fontInternal._metrics,this._metrics._isUnicodeFont=!0,this._setInternals(t)},i.prototype.getLineWidth=function(e,i){var r=0;if(null!==i&&void 0!==i&&i.textDirection!==t.PdfTextDirection.none)r=this._getUnicodeLineWidth(e,r);else for(var n=0,s=e.length;n<s;n++)r+=this._getCharacterWidthInternal(e[Number.parseInt(n.toString(),10)]);return r*=.001*this._metrics._size,r=this._applyFormatSettings(e,i,r)},i.prototype._getUnicodeLineWidth=function(t,e){e=0;var i=[],r=!1,n=(new Se)._getGlyphIndex(t,this,i);if(r=n._result,i=n._glyphIndex,r&&null!==i)for(var s=this._fontInternal._ttfReader,a=0,o=i.length;a<o;a++){var h=i[Number.parseInt(a.toString(),10)],c=s._getGlyph(h);null!==c&&void 0!==c&&(e+=c._width)}return e},i.prototype._getCharacterWidth=function(t,e){var i=this._fontInternal._getCharacterWidth(t);return i*=.001*this._metrics._getSize(e)},i.prototype._setSymbols=function(t){var e=this._fontInternal;null!==e&&void 0!==e&&e._setSymbols(t)},i.prototype._getCharacterWidthInternal=function(t){var e=0;return e=t.charCodeAt(0),"0"!==this._metrics._name&&"1"!==this._metrics._name&&"2"!==this._metrics._name&&"3"!==this._metrics._name&&"4"!==this._metrics._name||(e-=32),e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}(Pe),Te=function(){function e(){}return e._getMetrics=function(e,i,r){var n=null;switch(e){case t.PdfFontFamily.helvetica:n=this._getHelveticaMetrics(i,r);break;case t.PdfFontFamily.courier:n=this._getCourierMetrics(i,r);break;case t.PdfFontFamily.timesRoman:n=this._getTimesMetrics(i,r);break;case t.PdfFontFamily.symbol:n=this._getSymbolMetrics(r);break;case t.PdfFontFamily.zapfDingbats:n=this._getZapfDingbatsMetrics(r);break;default:n=this._getHelveticaMetrics(i,r)}return n._name=e.toString(),n._subScriptSizeFactor=this._subSuperScriptFactor,n._superscriptSizeFactor=this._subSuperScriptFactor,n},e._getHelveticaMetrics=function(e,i){var r=new jt;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._helveticaBoldItalicAscent,r._descent=this._helveticaBoldItalicDescent,r._postScriptName=this._helveticaBoldItalicName,r._size=i,r._widthTable=new Ut(this._arialBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._helveticaBoldAscent,r._descent=this._helveticaBoldDescent,r._postScriptName=this._helveticaBoldName,r._size=i,r._widthTable=new Ut(this._arialBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._helveticaItalicAscent,r._descent=this._helveticaItalicDescent,r._postScriptName=this._helveticaItalicName,r._size=i,r._widthTable=new Ut(this._arialWidth),r._height=r._ascent-r._descent):(r._ascent=this._helveticaAscent,r._descent=this._helveticaDescent,r._postScriptName=this._helveticaName,r._size=i,r._widthTable=new Ut(this._arialWidth),r._height=r._ascent-r._descent),r},e._getCourierMetrics=function(e,i){var r=new jt;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._courierBoldItalicAscent,r._descent=this._courierBoldItalicDescent,r._postScriptName=this._courierBoldItalicName,r._size=i,r._widthTable=new Ut(this._fixedWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._courierBoldAscent,r._descent=this._courierBoldDescent,r._postScriptName=this._courierBoldName,r._size=i,r._widthTable=new Ut(this._fixedWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._courierItalicAscent,r._descent=this._courierItalicDescent,r._postScriptName=this._courierItalicName,r._size=i,r._widthTable=new Ut(this._fixedWidth),r._height=r._ascent-r._descent):(r._ascent=this._courierAscent,r._descent=this._courierDescent,r._postScriptName=this._courierName,r._size=i,r._widthTable=new Ut(this._fixedWidth),r._height=r._ascent-r._descent),r},e._getTimesMetrics=function(e,i){var r=new jt;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._timesBoldItalicAscent,r._descent=this._timesBoldItalicDescent,r._postScriptName=this._timesBoldItalicName,r._size=i,r._widthTable=new Ut(this._timesRomanBoldItalicWidths),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._timesBoldAscent,r._descent=this._timesBoldDescent,r._postScriptName=this._timesBoldName,r._size=i,r._widthTable=new Ut(this._timesRomanBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._timesItalicAscent,r._descent=this._timesItalicDescent,r._postScriptName=this._timesItalicName,r._size=i,r._widthTable=new Ut(this._timesRomanItalicWidth),r._height=r._ascent-r._descent):(r._ascent=this._timesAscent,r._descent=this._timesDescent,r._postScriptName=this._timesName,r._size=i,r._widthTable=new Ut(this._timesRomanWidth),r._height=r._ascent-r._descent),r},e._getSymbolMetrics=function(t){var e=new jt;return e._ascent=this._symbolAscent,e._descent=this._symbolDescent,e._postScriptName=this._symbolName,e._size=t,e._widthTable=new Ut(this._symbolWidth),e._height=e._ascent-e._descent,e},e._getZapfDingbatsMetrics=function(t){var e=new jt;return e._ascent=this._zapfDingbatsAscent,e._descent=this._zapfDingbatsDescent,e._postScriptName=this._zapfDingbatsName,e._size=t,e._widthTable=new Ut(this._zapfDingbatsWidth),e._height=e._ascent-e._descent,e},e._subSuperScriptFactor=1.52,e._helveticaAscent=931,e._helveticaDescent=-225,e._helveticaName="Helvetica",e._helveticaBoldAscent=962,e._helveticaBoldDescent=-228,e._helveticaBoldName="Helvetica-Bold",e._helveticaItalicAscent=931,e._helveticaItalicDescent=-225,e._helveticaItalicName="Helvetica-Oblique",e._helveticaBoldItalicAscent=962,e._helveticaBoldItalicDescent=-228,e._helveticaBoldItalicName="Helvetica-BoldOblique",e._courierAscent=805,e._courierDescent=-250,e._courierName="Courier",e._courierBoldAscent=801,e._courierBoldDescent=-250,e._courierBoldName="Courier-Bold",e._courierItalicAscent=805,e._courierItalicDescent=-250,e._courierItalicName="Courier-Oblique",e._courierBoldItalicAscent=801,e._courierBoldItalicDescent=-250,e._courierBoldItalicName="Courier-BoldOblique",e._timesAscent=898,e._timesDescent=-218,e._timesName="Times-Roman",e._timesBoldAscent=935,e._timesBoldDescent=-218,e._timesBoldName="Times-Bold",e._timesItalicAscent=883,e._timesItalicDescent=-217,e._timesItalicName="Times-Italic",e._timesBoldItalicAscent=921,e._timesBoldItalicDescent=-218,e._timesBoldItalicName="Times-BoldItalic",e._symbolAscent=1010,e._symbolDescent=-293,e._symbolName="Symbol",e._zapfDingbatsAscent=820,e._zapfDingbatsDescent=-143,e._zapfDingbatsName="ZapfDingbats",e._arialWidth=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,0,556,0,222,556,333,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,222,222,333,333,350,556,1e3,333,1e3,500,333,944,0,500,667,0,333,556,556,556,556,260,556,333,737,370,556,584,0,737,333,400,584,333,333,333,556,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500],e._arialBoldWidth=[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,0,556,0,278,556,500,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,278,278,500,500,350,556,1e3,333,1e3,556,333,944,0,500,667,0,333,556,556,556,556,280,556,333,737,370,556,584,0,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,611,611,611,611,611,556,611,556],e._fixedWidth=[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600],e._timesRomanWidth=[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541,0,500,0,333,500,444,1e3,500,500,333,1e3,556,333,889,0,611,0,0,333,333,444,444,350,500,1e3,333,980,389,333,722,0,444,722,0,333,500,500,500,500,200,500,333,760,276,500,564,0,760,333,400,564,300,300,333,500,453,250,333,300,310,500,750,750,750,444,722,722,722,722,722,722,889,667,611,611,611,611,333,333,333,333,722,722,722,722,722,722,722,564,722,722,722,722,722,722,556,500,444,444,444,444,444,444,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,564,500,500,500,500,500,500,500,500],e._timesRomanBoldWidth=[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,1e3,0,667,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,444,722,0,333,500,500,500,500,220,500,333,747,300,500,570,0,747,333,400,570,300,300,333,556,540,250,333,300,330,500,750,750,750,500,722,722,722,722,722,722,1e3,722,667,667,667,667,389,389,389,389,722,722,778,778,778,778,778,570,778,722,722,722,722,722,611,556,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,500,556,500],e._timesRomanItalicWidth=[250,333,420,500,500,833,778,214,333,333,500,675,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,675,675,675,500,920,611,611,667,722,611,611,722,722,333,444,667,556,833,667,722,611,722,611,500,556,722,611,833,611,556,556,389,278,389,422,500,333,500,500,444,500,444,278,500,500,278,278,444,278,722,500,500,500,500,389,389,278,500,444,667,444,444,389,400,275,400,541,0,500,0,333,500,556,889,500,500,333,1e3,500,333,944,0,556,0,0,333,333,556,556,350,500,889,333,980,389,333,667,0,389,556,0,389,500,500,500,500,275,500,333,760,276,500,675,0,760,333,400,675,300,300,333,500,523,250,333,300,310,500,750,750,750,500,611,611,611,611,611,611,889,667,611,611,611,611,333,333,333,333,722,667,722,722,722,722,722,675,722,722,722,722,722,556,611,500,500,500,500,500,500,500,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,675,500,500,500,500,500,444,500,444],e._timesRomanBoldItalicWidths=[250,389,555,500,500,833,778,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,832,667,667,667,722,667,667,722,778,389,500,667,611,889,722,722,611,722,667,556,611,722,667,889,667,611,611,333,278,333,570,500,333,500,500,444,500,444,333,500,556,278,278,500,278,778,556,500,500,500,389,389,278,556,444,667,500,444,389,348,220,348,570,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,944,0,611,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,389,611,0,389,500,500,500,500,220,500,333,747,266,500,606,0,747,333,400,570,300,300,333,576,500,250,333,300,300,500,750,750,750,500,667,667,667,667,667,667,944,667,667,667,667,667,389,389,389,389,722,722,722,722,722,722,722,570,722,722,722,722,722,611,611,500,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,444,500,444],e._symbolWidth=[250,333,713,500,549,833,778,439,333,333,500,549,250,549,250,278,500,500,500,500,500,500,500,500,500,500,278,278,549,549,549,444,549,722,667,722,612,611,763,603,722,333,631,722,686,889,722,722,768,741,556,592,611,690,439,768,645,795,611,333,863,333,658,500,500,631,549,549,494,439,521,411,603,329,603,549,549,576,521,549,549,521,549,603,439,576,713,686,493,686,494,480,200,480,549,750,620,247,549,167,713,500,753,753,753,753,1042,987,603,987,603,400,549,411,549,549,713,494,460,549,549,549,549,1e3,603,1e3,658,823,686,795,987,768,768,823,768,768,713,713,713,713,713,713,713,768,713,790,790,890,823,549,250,713,603,603,1042,987,603,987,603,494,329,790,790,786,713,384,384,384,384,384,384,494,494,494,494,329,274,686,686,686,384,384,384,384,384,384,494,494,494,-1],e._zapfDingbatsWidth=[278,974,961,974,980,719,789,790,791,690,960,939,549,855,911,933,911,945,974,755,846,762,761,571,677,763,760,759,754,494,552,537,577,692,786,788,788,790,793,794,816,823,789,841,823,833,816,831,923,744,723,749,790,792,695,776,768,792,759,707,708,682,701,826,815,789,789,707,687,696,689,786,787,713,791,785,791,873,761,762,762,759,759,892,892,788,784,438,138,277,415,392,392,668,668,390,390,317,317,276,276,509,509,410,410,234,234,334,334,732,544,544,910,667,760,760,776,595,694,626,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,894,838,1016,458,748,924,748,918,927,928,928,834,873,828,924,924,917,930,931,463,883,836,836,867,867,696,696,874,874,760,946,771,865,771,888,967,888,831,873,927,970,918],e}(),Ie=function(){function e(){}return e._getHanyangSystemsGothicMedium=function(e,i){var r=new jt,n=new Wt(1e3);return n._add(new Gt(1,127,500)),n._add(new Gt(8094,8190,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYGoThic-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HYGoThic-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYGoThic-Medium,Italic":r._postScriptName="HYGoThic-Medium",r},e._getHanyangSystemsShinMyeongJoMedium=function(e,i){var r=new jt,n=new Wt(1e3);return n._add(new Gt(1,95,500)),n._add(new Gt(8094,8190,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYSMyeongJo-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HYSMyeongJo-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYSMyeongJo-Medium,Italic":r._postScriptName="HYSMyeongJo-Medium",r},e._getHeiseiKakuGothicW5=function(e,i){var r=new jt,n=new Wt(1e3);return n._add(new Gt(1,95,500)),n._add(new Gt(231,632,500)),r._widthTable=n,r._ascent=857,r._descent=-125,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiKakuGo-W5,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HeiseiKakuGo-W5,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiKakuGo-W5,Italic":r._postScriptName="HeiseiKakuGo-W5",r},e._getHeiseiMinchoW3=function(e,i){var r=new jt,n=new Wt(1e3);return n._add(new Gt(1,95,500)),n._add(new Gt(231,632,500)),r._widthTable=n,r._ascent=857,r._descent=-143,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiMin-W3,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HeiseiMin-W3,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiMin-W3,Italic":r._postScriptName="HeiseiMin-W3",r},e._getMonotypeHeiMedium=function(e,i){var r=new jt,n=new Wt(1e3);return n._add(new Gt(1,95,500)),n._add(new Gt(13648,13742,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MHei-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="MHei-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MHei-Medium,Italic":r._postScriptName="MHei-Medium",r},e._getMonotypeSungLight=function(e,i){var r=new jt,n=new Wt(1e3);return n._add(new Gt(1,95,500)),n._add(new Gt(13648,13742,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MSung-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="MSung-Light,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MSung-Light,Italic":r._postScriptName="MSung-Light",r},e._getSinoTypeSongLight=function(e,i){var r=new jt,n=new Wt(1e3);return n._add(new Gt(1,95,500)),n._add(new Gt(814,939,500)),n._add(new Kt(7712,[500])),n._add(new Kt(7716,[500])),r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="STSong-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="STSong-Light,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="STSong-Light,Italic":r._postScriptName="STSong-Light",r._widthTable=n,r},e._getMetrics=function(e,i,r){var n;switch(e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:(n=this._getHanyangSystemsGothicMedium(i,r))._name="HanyangSystemsGothicMedium";break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:(n=this._getHanyangSystemsShinMyeongJoMedium(i,r))._name="HanyangSystemsShinMyeongJoMedium";break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:(n=this._getHeiseiKakuGothicW5(i,r))._name="HeiseiKakuGothicW5";break;case t.PdfCjkFontFamily.heiseiMinchoW3:(n=this._getHeiseiMinchoW3(i,r))._name="HeiseiMinchoW3";break;case t.PdfCjkFontFamily.monotypeHeiMedium:(n=this._getMonotypeHeiMedium(i,r))._name="MonotypeHeiMedium";break;case t.PdfCjkFontFamily.monotypeSungLight:(n=this._getMonotypeSungLight(i,r))._name="MonotypeSungLight";break;case t.PdfCjkFontFamily.sinoTypeSongLight:(n=this._getSinoTypeSongLight(i,r))._name="SinoTypeSongLight"}return n._subScriptSizeFactor=this._subSuperScriptFactor,n._superscriptSizeFactor=this._subSuperScriptFactor,n},e._subSuperScriptFactor=1.52,e}(),Ne=function(){function e(){}return e._fillMonotypeSungLight=function(t,e,i){var r={x:-160,y:-249,width:1175,height:1137};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHeiseiKakuGothicW5=function(e,i,r,n){var s={x:-92,y:-250,width:1102,height:1172},a={x:-92,y:-250,width:1102,height:1932};(i&(t.PdfFontStyle.italic|t.PdfFontStyle.bold))!==t.PdfFontStyle.italic?this._fillFontBox(e,s):this._fillFontBox(e,a),this._fillKnownInformation(e,r,n),e.set("StemV",93),e.set("StemH",93),e.set("AvgWidth",689),e.set("MaxWidth",1e3),e.set("CapHeight",718),e.set("XHeight",500),e.set("Leading",250)},e._fillHanyangSystemsShinMyeongJoMedium=function(t,e,i){var r={x:0,y:-148,width:1001,height:1028};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHeiseiMinchoW3=function(t,e,i){var r={x:-123,y:-257,width:1124,height:1167};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",702),t.set("MaxWidth",1e3),t.set("CapHeight",718),t.set("XHeight",500),t.set("Leading",250)},e._fillSinoTypeSongLight=function(t,e,i){var r={x:-25,y:-254,width:1025,height:1134};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillMonotypeHeiMedium=function(t,e,i){var r={x:-45,y:-250,width:1060,height:1137};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHanyangSystemsGothicMedium=function(t,e,i){var r={x:-6,y:-145,width:1009,height:1025};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("Flags",4),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillFontBox=function(t,e){t.set("FontBBox",R(e))},e._fillKnownInformation=function(e,i,r){switch(e.set("FontName",vr.get(r._postScriptName)),e.set("Type",vr.get("FontDescriptor")),e.set("ItalicAngle",0),e.set("MissingWidth",r._widthTable._defaultWidth),e.set("Ascent",r._ascent),e.set("Descent",r._descent),i){case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.heiseiKakuGothicW5:e.set("Flags",4);break;case t.PdfCjkFontFamily.sinoTypeSongLight:case t.PdfCjkFontFamily.monotypeSungLight:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:case t.PdfCjkFontFamily.heiseiMinchoW3:e.set("Flags",6)}},e._getFontDescriptor=function(e,i,r){var n=new xr;switch(n._updated=!0,e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:this._fillHanyangSystemsGothicMedium(n,e,r);break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:this._fillHanyangSystemsShinMyeongJoMedium(n,e,r);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:this._fillHeiseiKakuGothicW5(n,i,e,r);break;case t.PdfCjkFontFamily.heiseiMinchoW3:this._fillHeiseiMinchoW3(n,e,r);break;case t.PdfCjkFontFamily.monotypeHeiMedium:this._fillMonotypeHeiMedium(n,e,r);break;case t.PdfCjkFontFamily.monotypeSungLight:this._fillMonotypeSungLight(n,e,r);break;case t.PdfCjkFontFamily.sinoTypeSongLight:this._fillSinoTypeSongLight(n,e,r)}return n},e}();!function(t){t[t.regular=0]="regular",t[t.bold=1]="bold",t[t.italic=2]="italic",t[t.underline=4]="underline",t[t.strikeout=8]="strikeout"}(t.PdfFontStyle||(t.PdfFontStyle={})),function(t){t[t.helvetica=0]="helvetica",t[t.courier=1]="courier",t[t.timesRoman=2]="timesRoman",t[t.symbol=3]="symbol",t[t.zapfDingbats=4]="zapfDingbats"}(t.PdfFontFamily||(t.PdfFontFamily={})),function(t){t[t.heiseiKakuGothicW5=0]="heiseiKakuGothicW5",t[t.heiseiMinchoW3=1]="heiseiMinchoW3",t[t.hanyangSystemsGothicMedium=2]="hanyangSystemsGothicMedium",t[t.hanyangSystemsShinMyeongJoMedium=3]="hanyangSystemsShinMyeongJoMedium",t[t.monotypeHeiMedium=4]="monotypeHeiMedium",t[t.monotypeSungLight=5]="monotypeSungLight",t[t.sinoTypeSongLight=6]="sinoTypeSongLight"}(t.PdfCjkFontFamily||(t.PdfCjkFontFamily={}));var Ce=function(){function t(){this._result=!1,this._glyphIndex=[]}return t}(),Re=function(){function e(){this._isRoundedRectangle=!1,this._fillMode=t.PdfFillMode.winding,this._points=[],this._pathTypes=[],this._isStart=!0}return Object.defineProperty(e.prototype,"_lastPoint",{get:function(){var t=[0,0],e=this._points.length;return this._points.length>0&&(t[0]=this._points[e-1][0],t[1]=this._points[e-1][0]),t},enumerable:!0,configurable:!0}),e.prototype._addLine=function(e,i,r,n){this._addPoints([e,i,r,n],t._PathPointType.line)},e.prototype._addLines=function(e){var i=e[0];if(1===e.length)this._addPoint(e[0],t._PathPointType.line);else for(var r=1;r<e.length;r++){var n=e[Number.parseInt(r.toString(),10)];this._addLine(i[0],i[1],n[0],n[1]),i=n}},e.prototype._addPoints=function(e,i,r,n){for(var s=void 0!==r?r:0,a=void 0!==n?n:e.length,o=s;o<a;o++){var h=[e[Number.parseInt(o.toString(),10)],e[o+1]];o===s?0===this._points.length||this._isStart?(this._addPoint(h,t._PathPointType.start),this._isStart=!1):!this._isRoundedRectangle||h[0]===this._lastPoint[0]&&h[1]===this._lastPoint[1]?h[0]!==this._lastPoint[0]&&h[1]!==this._lastPoint[1]&&this._addPoint(h,t._PathPointType.line):this._addPoint(h,t._PathPointType.line):this._addPoint(h,i),o++}},e.prototype._addPoint=function(t,e){this._points.push(t),this._pathTypes.push(e)},e.prototype._addArc=function(e,i,r,n,s,a){for(var o=q(e,i,e+r,i+n,s,a),h=0;h<o.length;++h){var c=[o[Number.parseInt(h.toString(),10)],o[++h],o[++h],o[++h],o[++h],o[++h],o[++h],o[++h]];this._addPoints(c,t._PathPointType.bezier)}},e.prototype._addRectangle=function(e,i,r,n){this._startFigure(),this._addPoints([e,i,e+r,i,e+r,i+n,e,i+n],t._PathPointType.line),this._closeFigure()},e.prototype._addPolygon=function(e){var i=[];e.forEach(function(t){i.push(t[0],t[1])}),this._startFigure(),this._addPoints(i,t._PathPointType.line),this._closeFigure()},e.prototype._addEllipse=function(t,e,i,r){this._startFigure(),this._addArc(t,e,i,r,0,360),this._closeFigure()},e.prototype._addBezierPoints=function(t){if(t.length<4)throw Error("Incorrect size of array points");var e=0,i=t[Number.parseInt(e.toString(),10)];for(e++;e+3<=t.length;){var r=t[Number.parseInt(e.toString(),10)];e++;var n=t[Number.parseInt(e.toString(),10)];e++;var s=t[Number.parseInt(e.toString(),10)];e++,this._addBezier(i[0],i[1],r[0],r[1],n[0],n[1],s[0],s[1]),i=s}},e.prototype._addBezier=function(e,i,r,n,s,a,o,h){var c=[];c.push(e),c.push(i),c.push(r),c.push(n),c.push(s),c.push(a),c.push(o),c.push(h),this._addPoints(c,t._PathPointType.bezier)},e.prototype._closeFigure=function(e){if(void 0!==e){var i=this._pathTypes[Number.parseInt(e.toString(),10)];i|=t._PathPointType.closePath,this._pathTypes[Number.parseInt(e.toString(),10)]=i}else this._points.length>0&&this._closeFigure(this._points.length-1),this._startFigure()},e.prototype._startFigure=function(){this._isStart=!0},e.prototype._getBounds=function(){var t=[0,0,0,0];if(this._points.length>0){for(var e=this._points[0][0],i=this._points[0][0],r=this._points[0][1],n=this._points[0][1],s=1;s<this._points.length;++s){var a=this._points[Number.parseInt(s.toString(),10)];e=Math.min(a[0],e),i=Math.max(a[0],i),r=Math.min(a[1],r),n=Math.max(a[1],n)}t=[e,r,i-e,n-r]}return t},e}();!function(t){t[t.start=0]="start",t[t.line=1]="line",t[t.bezier=3]="bezier",t[t.pathTypeMask=7]="pathTypeMask",t[t.dashMode=16]="dashMode",t[t.pathMarker=32]="pathMarker",t[t.closePath=128]="closePath"}(t._PathPointType||(t._PathPointType={}));var Fe=function(){function e(){}return Object.defineProperty(e.prototype,"width",{get:function(){return this._imageWidth},set:function(t){this._imageWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._imageHeight},set:function(t){this._imageHeight=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"physicalDimension",{get:function(){return this._imagePhysicalDimension=this._getPointSize(this.width,this.height,this._horizontalResolution),[this.width,this.height]},enumerable:!0,configurable:!0}),e.prototype.draw=function(t,e,i){null!==e&&void 0!==e||null!==i&&void 0!==i||(e=0,i=0);var r=0!==e||0!==i,n=null;r&&(n=t.save(),t.translateTransform(e,i)),t.drawImage(this,0,0),r&&t.restore(n)},e.prototype._getPointSize=function(e,i,r){if(null===r||void 0===r){return a=this._getPointSize(e,i,96)}var n=new je,s=new je,a=[n._convertUnits(e,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point),s._convertUnits(i,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point)];return a},e}(),Be=function(){function e(t,e,i,r){if(this._pendingResource=[],this._hasResourceReference=!1,r instanceof Zi?(this._source=r._pageDictionary,this._page=r):r instanceof Ye&&(this._source=r._content.dictionary,this._template=r),this._source&&this._source.has("Resources")){var n=this._source.getRaw("Resources");n instanceof wr?(this._hasResourceReference=!0,this._resourceObject=i._fetch(n)):n instanceof xr&&(this._resourceObject=n)}else this._resourceObject=new xr,this._source.update("Resources",this._resourceObject);this._crossReference=i,this._sw=new Ot(e),this._size=t,H("PDF",this._resourceObject),this._initialize()}return Object.defineProperty(e.prototype,"clientSize",{get:function(){return[this._clipBounds[2],this._clipBounds[3]]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_matrix",{get:function(){return void 0===this._m&&(this._m=new Le),this._m},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_resources",{get:function(){var t=this;if(void 0===this._resourceMap){if(this._resourceMap=new Map,this._resourceObject.has("Font")){var e=this._resourceObject.get("Font");e&&e.size>0&&e.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof wr&&t._resourceMap.set(i,vr.get(e))})}if(this._resourceObject.has("XObject")){var i=this._resourceObject.get("XObject");i&&i.size>0&&i.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof wr&&t._resourceMap.set(i,vr.get(e))})}if(this._resourceObject.has("ExtGState")){var r=this._resourceObject.get("ExtGState");r&&r.size>0&&(this._transparencies||(this._transparencies=new Map),r.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof wr&&t._setTransparencyData(i,vr.get(e))}))}}return this._resourceMap},enumerable:!0,configurable:!0}),e.prototype.save=function(){var t=new De(this,this._matrix);return t._textRenderingMode=this._textRenderingMode,t._charSpacing=this._characterSpacing,t._textScaling=this._textScaling,t._wordSpacing=this._wordSpacing,t._currentBrush=this._currentBrush,t._currentPen=this._currentPen,t._currentFont=this._currentFont,this._graphicsState.push(t),this._sw._saveGraphicsState(),t},e.prototype.restore=function(t){if(this._graphicsState.length>0)if(void 0===t)this._doRestore();else if(this._graphicsState.length>0&&-1!==this._graphicsState.indexOf(t))for(;this._graphicsState.length>0&&this._doRestore()!==t;);},e.prototype._doRestore=function(){var t=this._graphicsState.pop();return this._m=t._transformationMatrix,this._currentBrush=t._currentBrush,this._currentPen=t._currentPen,this._currentFont=t._currentFont,this._characterSpacing=t._charSpacing,this._wordSpacing=t._wordSpacing,this._textScaling=t._textScaling,this._textRenderingMode=t._textRenderingMode,this._sw._restoreGraphicsState(),t},e.prototype.drawRectangle=function(t,e,i,r,n,s){var a,o;n instanceof Ve?(a=n,s&&(o=s)):o=n,this._stateControl(a,o),this._sw._appendRectangle(t,e,i,r),this._drawGraphicsPath(a,o)},e.prototype.drawPolygon=function(e,i,r){if(e.length>0){var n=void 0,s=void 0;i instanceof Ve?(n=i,r&&(s=r)):s=i,this._stateControl(n,s),this._sw._beginPath(e[0][0],e[0][1]);for(var a=1;a<e.length;a++)this._sw._appendLineSegment(e[Number.parseInt(a.toString(),10)][0],e[Number.parseInt(a.toString(),10)][1]);this._drawGraphicsPath(n,s,t.PdfFillMode.winding,!0)}},e.prototype.drawEllipse=function(e,i,r,n,s,a){var o,h;s instanceof Ve?(o=s,a&&(h=a)):h=s,this._stateControl(o,h),this._constructArcPath(e,i,e+r,i+n,0,360),this._drawGraphicsPath(o,h,t.PdfFillMode.winding,!0)},e.prototype.drawArc=function(e,i,r,n,s,a,o){0!==a&&(this._stateControl(o),this._constructArcPath(e,i,e+r,i+n,s,a),this._drawGraphicsPath(o,null,t.PdfFillMode.winding,!1))},e.prototype.drawImage=function(t,e,i,r,n){if("number"==typeof e&&"number"==typeof i&&void 0===r){var s=t.physicalDimension;this.drawImage(t,e,i,s[0],s[1])}else{t._save();var a=new Le;this._getTranslateTransform(e,i+n,a),this._getScaleTransform(r,n,a),this._sw._write("q"),this._sw._modifyCtm(a);var o=void 0,h=void 0,c=!0;if(this._resourceObject.has("XObject")){var _=this._resourceObject.getRaw("XObject");_ instanceof xr&&(o=_),o&&(c=!1)}c&&(o=new xr(this._crossReference),this._resourceObject.update("XObject",o)),void 0===h&&(h=vr.get(G())),this._crossReference?(this._updateImageResource(t,h,o,this._crossReference),this._source.update("Resources",this._resourceObject),this._source._updated=!0):this._pendingResource.push({resource:t,key:h,source:o}),this._sw._executeObject(h),this._sw._write("Q"),this._sw._write("\r\n"),H("ImageB",this._resourceObject),H("ImageC",this._resourceObject),H("ImageI",this._resourceObject),H("Text",this._resourceObject)}},e.prototype.drawTemplate=function(t,e){var i=this;if(void 0!==t){t._isExported&&(this._crossReference?(t._crossReference=this._crossReference,t._importStream(!0)):(t._importStream(!1),this._pendingResource.push(t)));var r=t&&t._size[0]>0?e.width/t._size[0]:1,n=t&&t._size[1]>0?e.height/t._size[1]:1,s=!(1===r&&1===n),a=void 0,o=void 0;this._page&&(a=this._page.cropBox,o=this._page.mediaBox,this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&a[0]>0&&a[1]>0&&o[0]<0&&o[1]<0&&(this.translateTransform(a[0],-a[1]),e.x=-a[0],e.y=a[1]));var h=this.save(),c=new Le;if(this._page){var _=this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&a&&o&&a[0]===o[0]&&a[1]===o[1]&&a[2]===o[2]&&a[3]===o[3]||this._page._pageDictionary.has("MediaBox")&&o&&0===o[3];c._translate(e.x,-(e.y+(this._page._origin[0]>=0||_?e.height:0)))}else c._translate(e.x,-(e.y+e.height));if(s)if(t._isAnnotationTemplate&&t._needScale){var d=!1;if(t._content&&t._content.dictionary){var p=t._content.dictionary;if(p.has("Matrix")&&p.has("BBox")){var l=p.getArray("Matrix"),u=p.getArray("BBox");if(l&&u&&l.length>5&&u.length>3){var f=Number.parseFloat(y(-l[1])),g=Number.parseFloat(y(l[2])),m=Number.parseFloat(y(r)),b=Number.parseFloat(y(n));m===f&&b===g&&u[2]===t._size[0]&&u[3]===t._size[1]&&((c=new Le)._translate(e.x-l[4],e.y+l[5]),c._scale(1,1),d=!0)}}}d||c._scale(r,n)}else c._scale(r,n);this._sw._modifyCtm(c);var v,S,w=void 0,P=!1,A=!0;if(this._resourceObject.has("XObject")){var k=this._resourceObject.getRaw("XObject");k instanceof wr?(P=!0,w=this._crossReference._fetch(k)):k instanceof xr&&(w=k),w&&(A=!1,this._resources.forEach(function(e,r){if(r&&r instanceof wr){var n=i._crossReference._fetch(r);n&&t&&n===t._content&&(v=e,S=r)}}))}A&&(w=new xr(this._crossReference),this._resourceObject.update("XObject",w)),void 0===v&&(v=vr.get(G()),t&&t._content.reference?S=t._content.reference:this._crossReference?S=this._crossReference._getNextReference():this._pendingResource.push({resource:t._content,key:v,source:w}),S&&this._crossReference&&(!this._crossReference._cacheMap.has(S)&&t&&t._content&&this._crossReference._cacheMap.set(S,t._content),w.update(v.name,S),this._resources.set(S,v)),this._resourceObject._updated=!0),P&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._executeObject(v),this.restore(h),H("ImageB",this._resourceObject),H("ImageC",this._resourceObject),H("ImageI",this._resourceObject),H("Text",this._resourceObject)}},e.prototype._processResources=function(t){if(this._crossReference=t,this._pendingResource.length>0){for(var e=0;e<this._pendingResource.length;e++){var i=this._pendingResource[Number.parseInt(e.toString(),10)];if(i instanceof Ye)i._crossReference=t,i._updatePendingResource(t);else if(i.resource instanceof Nr){var r=void 0;i.resource._reference?r=i.resource._reference:(r=t._getNextReference(),i.resource._reference=r),!t._cacheMap.has(r)&&i.resource&&t._cacheMap.set(r,i.resource),i.source.update(i.key.name,r),this._resources.set(r,i.key)}else i.resource instanceof Fe?this._updateImageResource(i.resource,i.key,i.source,t):i.resource instanceof Pe&&this._updateFontResource(i.resource,i.key,i.source,t);this._source.update("Resources",this._resourceObject),this._source._updated=!0}this._pendingResource=[]}},e.prototype._updateImageResource=function(t,e,i,r){var n;if(t._reference?n=t._reference:(n=r._getNextReference(),t._reference=n),!r._cacheMap.has(n)&&t&&t._imageStream&&t._imageStream.dictionary&&(r._cacheMap.set(n,t._imageStream),t._imageStream.dictionary._updated=!0,t._maskStream&&t._maskStream.dictionary)){var s=void 0;t._maskReference?s=t._maskReference:(s=r._getNextReference(),t._maskReference=s),r._cacheMap.set(s,t._maskStream),t._maskStream.dictionary._updated=!0,t._imageStream.dictionary.set("SMask",s)}i.update(e.name,n),this._resources.set(n,e),this._resourceObject._updated=!0},e.prototype._updateFontResource=function(t,e,i,r){var n;if(t._reference?n=t._reference:(n=r._getNextReference(),t._reference=n),!r._cacheMap.has(n))if(t._dictionary)r._cacheMap.set(n,t._dictionary),i.update(e.name,n),this._resources.set(n,e);else if(t instanceof xe){var s=t._fontInternal;s&&s._fontDictionary&&r._cacheMap.set(n,s._fontDictionary),i.update(e.name,n),this._resources.set(n,e)}},e.prototype._drawPath=function(t,e,i){(e||i)&&(this._stateControl(e,i,null),this._buildUpPath(t._points,t._pathTypes),this._drawGraphicsPath(e,i,t._fillMode,!1))},e.prototype.drawRoundedRectangle=function(t,e,i,r,n,s,a){if(null===s)throw new Error("pen");if(null===a)throw new Error("brush");var o=[t,e,i,r],h=2*n,c=[h,h],_=[o[0],o[1],c[0],c[1]],d=new Re;0===n?(d._addRectangle(o[0],o[1],o[2],o[3]),this._drawPath(d,s,a)):(d._isRoundedRectangle=!0,d._addArc(_[0],_[1],_[2],_[3],180,90),_[0]=o[0]+o[2]-h,d._addArc(_[0],_[1],_[2],_[3],270,90),_[1]=o[1]+o[3]-h,d._addArc(_[0],_[1],_[2],_[3],0,90),_[0]=o[0],d._addArc(_[0],_[1],_[2],_[3],90,90),d._closeFigure(),this._drawPath(d,s,a))},e.prototype._constructArcPath=function(t,e,i,r,n,s){var a=q(t,e,i,r,n,s);if(8!==a.length){var o=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]];this._sw._beginPath(o[0],o[1]);for(var h=0;h<a.length;h+=8)o=[a[Number.parseInt(h.toString(),10)],a[h+1],a[h+2],a[h+3],a[h+4],a[h+5],a[h+6],a[h+7]],this._sw._appendBezierSegment(o[2],o[3],o[4],o[5],o[6],o[7])}},e.prototype._writePen=function(t){for(var e=t._width,i=t._dashPattern,r=0;r<i.length;++r)i[r]*=t._width;this._sw._setLineDashPattern(i,t._dashOffset*e),this._sw._setLineWidth(t._width),this._sw._setLineJoin(t._lineJoin),this._sw._setLineCap(t._lineCap),t._miterLimit>0&&this._sw._setMiterLimit(t._miterLimit),this._sw._setColor(t._color,!0)},e.prototype.drawString=function(t,e,i,r,n,s){var a=(new qt)._layout(t,e,s,[i[2],i[3]]);if(!a._empty){var o=this._checkCorrectLayoutRectangle(a._actualSize,i[0],i[1],s);i[2]<=0&&(i[0]=o[0],i[2]=o[2]),i[3]<=0&&(i[1]=o[1],i[3]=o[3]),this._drawStringLayoutResult(a,e,r,n,i,s)}H("Text",this._resourceObject)},e.prototype._buildUpPath=function(e,i){for(var r=0;r<e.length;r++){var n=e[Number.parseInt(r.toString(),10)],s=i[Number.parseInt(r.toString(),10)];switch(15&s){case t._PathPointType.start:this._sw._beginPath(n[0],n[1]);break;case t._PathPointType.bezier:var a=this._getBezierPoint(e,i,r);r=a.index;var o=a.point;r=(a=this._getBezierPoint(e,i,r)).index;var h=a.point;this._sw._appendBezierSegment(n[0],n[1],o[0],o[1],h[0],h[1]);break;case t._PathPointType.line:this._sw._appendLineSegment(n[0],n[1]);break;default:throw new Error("Incorrect path formation.")}((s=i[Number.parseInt(r.toString(),10)])&t._PathPointType.closePath)===t._PathPointType.closePath&&this._sw._closePath()}},e.prototype._getBezierPoint=function(e,i,r){if(i[Number.parseInt(r.toString(),10)]!==t._PathPointType.bezier)throw new Error("Malforming path.");return r++,{index:r,point:e[Number.parseInt(r.toString(),10)]}},e.prototype._initialize=function(){this._mediaBoxUpperRightBound=0,this._characterSpacing=-1,this._wordSpacing=-1,this._textScaling=-100,this._textRenderingMode=-1,this._graphicsState=[],this._clipBounds=[0,0,this._size[0],this._size[1]],this._colorSpaceInitialized=!1,this._startCutIndex=-1},e.prototype._initializeCurrentColorSpace=function(){this._colorSpaceInitialized||(this._sw._setColorSpace("DeviceRGB",!0),this._sw._setColorSpace("DeviceRGB",!1),this._colorSpaceInitialized=!0)},e.prototype._brushControl=function(t){this._sw._setColor(t._color,!1),this._currentBrush=t},e.prototype._penControl=function(t){this._currentPen=t,this._writePen(t),this._currentPen=t},e.prototype._fontControl=function(t,e){var i=this,r=t._metrics._getSize(e);this._currentFont=t;var n,s,a,o=!1,h=!0,c=!1;if(this._resourceObject.has("Font")){var _=this._resourceObject.getRaw("Font");null!==_&&void 0!==_&&(_ instanceof wr?(o=!0,n=this._crossReference._fetch(_)):_ instanceof xr&&(n=_)),void 0!==n&&null!==n&&(h=!1,this._resources.forEach(function(e,r){if(i._crossReference){if(null!==r&&void 0!==r){var n=i._crossReference._fetch(r);n&&(t instanceof Ae&&n===t._dictionary||t instanceof xe&&n===t._fontInternal._fontDictionary)&&(s=e,a=r,c=!0)}}else t._reference&&t._reference===r&&(s=e,a=r,c=!0)}))}if(h&&(n=new xr(this._crossReference),this._resourceObject.update("Font",n)),void 0===s){if(s=vr.get(G()),a||(t._reference?(a=t._reference,n.update(s.name,a)):this._crossReference?a=this._crossReference._getNextReference():this._pendingResource.push({resource:t,key:s,source:n})),a&&this._crossReference)if(t._reference||(t._reference=a),t._dictionary)this._crossReference._cacheMap.set(a,t._dictionary),n.update(s.name,a);else if(t instanceof xe){var d=t._fontInternal;d&&d._fontDictionary&&this._crossReference._cacheMap.set(a,d._fontDictionary),n.update(s.name,a)}c||this._resources.set(a,s)}o&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._setFont(s.name,r)},e.prototype._stateControl=function(t,e,i,r){(t||e)&&this._initializeCurrentColorSpace(),t&&this._penControl(t),e&&this._brushControl(e),i&&this._fontControl(i,r)},e.prototype._drawStringLayoutResult=function(e,i,r,n,s,a){if(!e._empty){var o=a&&void 0!==a.lineLimit&&!a.lineLimit,h=void 0===a||a&&void 0!==a.noClip&&!a.noClip,c=o&&h,_=void 0;if(c){_=this.save();var d=[s[0],s[1],e._actualSize[0],e._actualSize[1]];s[2]>0&&(d[2]=s[2]),a.lineAlignment===t.PdfVerticalAlignment.middle?d[1]+=(s[3]-d[3])/2:a.lineAlignment===t.PdfVerticalAlignment.bottom&&(d[1]+=s[3]-d[3]),this.setClip(d)}this._applyStringSettings(i,r,n,a);var p=void 0!==a&&null!==a?a.horizontalScalingFactor:100;p!==this._textScaling&&(this._sw._setTextScaling(p),this._textScaling=p);var l=this._getTextVerticalAlignShift(e._actualSize[1],s[3],a),u=void 0===a||null===a||0===a.lineSpacing?i._metrics._getHeight(a):a.lineSpacing+i._metrics._getHeight(a),f=0;f=null!==a&&void 0!==a&&a.subSuperScript===t.PdfSubSuperScript.subScript?u-(i.height+i._metrics._getDescent(a)):u-i._metrics._getAscent(a),a&&a.lineAlignment===t.PdfVerticalAlignment.bottom&&s[3]-e._actualSize[1]!=0&&s[3]-e._actualSize[1]<i._metrics._size/2-1&&Number.parseFloat(y(s[3]))<=Number.parseFloat(y(i._metrics._getHeight(a)))&&(f=-u/i._metrics._size);var g=new Le;g._translate(s[0],-(s[1]+i._metrics._getHeight(a))-(i._metrics._getDescent(a)>0?-i._metrics._getDescent(a):i._metrics._getDescent(a))-l),this._sw._modifyTM(g),s[3]<i._metrics._size&&e._actualSize[1]-s[3]<i._metrics._size/2-1&&(l=0),0!==l&&null!==a&&a.lineAlignment===t.PdfVerticalAlignment.bottom&&s[3]-e._actualSize[1]!=0&&s[3]-e._actualSize[1]>i._metrics._size/2-1&&(l-=(f-(u-i._metrics._size))/2),this._drawLayoutResult(e,i,a,s),0!==l&&this._sw._startNextLine(0,-(l-e._lineHeight)),H("Text",this._resourceObject),this._sw._endText(),this._underlineStrikeoutText(n,e,i,s,a),c&&this.restore(_)}},e.prototype._getNextPage=function(){var t,e=this._crossReference._document.pageCount;return this._page._pageIndex<e-2&&(t=this._crossReference._document.getPage(this._page._pageIndex+1)),t},e.prototype._applyStringSettings=function(e,i,r,n){var s=t._TextRenderingMode.fill;null!==i&&null!==r?s=t._TextRenderingMode.fillStroke:i?s=t._TextRenderingMode.stroke:r&&(s=t._TextRenderingMode.fill),n&&n.clipPath&&(s|=t._TextRenderingMode.clipFlag),this._sw._beginText(),this._stateControl(i,r,e,n),s!==this._textRenderingMode&&(this._sw._setTextRenderingMode(s),this._textRenderingMode=s);var a=void 0!==n&&null!==n?n.characterSpacing:0;a!==this._characterSpacing&&(this._sw._setCharacterSpacing(a),this._characterSpacing=a);var o=void 0!==n&&null!==n?n.wordSpacing:0;o!==this._wordSpacing&&(this._sw._setWordSpacing(o),this._wordSpacing=o)},e.prototype._drawLayoutResult=function(t,e,i,r){for(var n=void 0===i||null===i||0===i.lineSpacing?e._metrics._getHeight(i):i.lineSpacing+e._metrics._getHeight(i),s=t._lines,a=e,o=null!==a&&a.isUnicode,h=0,c=s.length;h<c&&h!==this._startCutIndex;h++){var _=s[Number.parseInt(h.toString(),10)],d=_._width,p=this._getHorizontalAlignShift(d,r[2],i)+this._getLineIndent(_,i,r[2],0===h);if(0!==p&&this._sw._startNextLine(p,0),o?this._drawUnicodeLine(_,r[2],e,i):this._drawAsciiLine(_,r[2],i,e),h+1!==c){var l=this._getTextVerticalAlignShift(t._actualSize[1],r[3],i),u=new Le,f=-(r[1]+e._metrics._getHeight(i))-e._metrics._getDescent(i)-l-n*(h+1);u._translate(r[0],f),this._sw._modifyTM(u)}}},e.prototype._drawUnicodeLine=function(e,i,r,n){var s=e._text,a=null!==n&&void 0!==n&&n.rightToLeft,o=null!==n&&void 0!==n&&(0!==n.wordSpacing||n.alignment===t.PdfTextAlignment.justify),h=r,c=this._justifyLine(e,i,n,h),_=new Se;if(a||null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none){var d=[],p=null!==n&&void 0!==n&&n.alignment===t.PdfTextAlignment.right,l=[];(d=null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none?_._layout(s,h,n.textDirection===t.PdfTextDirection.rightToLeft,o,n):_._layout(s,h,p,o,n)).length>1?null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none&&(l=_._splitLayout(s,h,n.textDirection===t.PdfTextDirection.rightToLeft,o,n)):l=[s],this._drawUnicodeBlocks(d,l,h,n,c)}else if(o){var u=this._breakUnicodeLine(s,h,null),d=u.tokens,l=u.words;this._drawUnicodeBlocks(d,l,h,n,c)}else{var f=this._convertToUnicode(s,h);this._sw._showNextLineText(f,!0)}},e.prototype._drawUnicodeBlocks=function(t,e,i,r,n){if(null!==t&&void 0!==t&&t.length>0&&null!==e&&void 0!==e&&e.length>0&&null!==i&&void 0!==i){this._sw._startNextLine();var s=0,a=0,o=0,h=0;try{null!==r&&void 0!==r&&(o=r.firstLineIndent,h=r.paragraphIndent,r.firstLineIndent=0,r.paragraphIndent=0);var c=i._getCharacterWidth(Qt._whiteSpace,r)+n,_=null!==r?r.characterSpacing:0;c+=_+(null!==r&&void 0!==r&&0===n?r.wordSpacing:0);for(var d=0;d<t.length;d++){var p=t[d],l=e[d],u=0;0!==s&&this._sw._startNextLine(s,0),l.length>0&&(u+=i.measureString(l,r)[0],u+=_,this._sw._showText(p)),d!==t.length-1&&(a+=s=u+c)}a>0&&this._sw._startNextLine(-a,0)}finally{null!==r&&void 0!==r&&(r.firstLineIndent=o,r.paragraphIndent=h)}}},e.prototype._breakUnicodeLine=function(t,e,i){var r=[];if(null!==t&&void 0!==t&&t.length>0){i=t.split(null);for(var n=0;n<i.length;n++){var s=i[n],a=this._convertToUnicode(s,e);r[Number.parseInt(n.toString(),10)]=a}}return{tokens:r,words:i}},e.prototype._convertToUnicode=function(t,e){var i=null;if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e._fontInternal instanceof ge){var r=e._fontInternal._ttfReader;e._setSymbols(t),i=b(v(i=r._convertString(t)))}return i},e.prototype._getTextVerticalAlignShift=function(e,i,r){var n=0;if(i>=0&&void 0!==r&&null!==r&&r.lineAlignment!==t.PdfVerticalAlignment.top)switch(r.lineAlignment){case t.PdfVerticalAlignment.middle:n=(i-e)/2;break;case t.PdfVerticalAlignment.bottom:n=i-e}return n},e.prototype._getHorizontalAlignShift=function(e,i,r){var n=0;if(i>=0&&void 0!==r&&null!==r&&r.alignment!==t.PdfTextAlignment.left)switch(r.alignment){case t.PdfTextAlignment.center:n=(i-e)/2;break;case t.PdfTextAlignment.right:n=i-e}return n},e.prototype._getLineIndent=function(e,i,r,n){var s=0,a=(e._lineType&t._LineType.firstParagraphLine)>0;return i&&a&&(s=n?i.firstLineIndent:i.paragraphIndent,s=r>0?Math.min(r,s):s),s},e.prototype._drawAsciiLine=function(t,e,i,r){this._justifyLine(t,e,i,r);var n="";if(-1!==t._text.indexOf("(")||-1!==t._text.indexOf(")"))for(var s=0;s<t._text.length;s++)"("===t._text[Number.parseInt(s.toString(),10)]?n+="\\(":")"===t._text[Number.parseInt(s.toString(),10)]?n+="\\)":n+=t._text[Number.parseInt(s.toString(),10)];""===n&&(n=t._text),this._sw._showNextLineText("("+n+")")},e.prototype._justifyLine=function(e,i,r,n){var s=e._text,a=e._width,o=this._shouldJustify(e,i,r,n),h=r&&0!==r.wordSpacing,c=n._getCharacterCount(s,[" ","\t"]),_=0;return o?(h&&(a-=c*r.wordSpacing),_=(i-a)/c,this._sw._setWordSpacing(_)):r&&r.alignment===t.PdfTextAlignment.justify&&this._sw._setWordSpacing(0),_},e.prototype._shouldJustify=function(e,i,r,n){var s=e._text,a=e._width,o=r&&r.alignment===t.PdfTextAlignment.justify,h=i>=0&&a<i,c=n._getCharacterCount(s,[" ","\t"])>0&&" "!==s[0],_=(e._lineType&t._LineType.layoutBreak)>0;return o&&h&&c&&(_||r.alignment===t.PdfTextAlignment.justify)},e.prototype._underlineStrikeoutText=function(t,e,i,r,n){if(i.isUnderline||i.isStrikeout){var s=this._createUnderlineStrikeoutPen(t,i);if(void 0!==s&&null!==s)for(var a=this._getTextVerticalAlignShift(e._actualSize[1],r[3],n),o=r[1]+a+i._metrics._getAscent(n)+1.5*s._width,h=r[1]+a+i._metrics._getHeight(n)/2+1.5*s._width,c=e._lines,_=0;_<e._lineCount;_++){var d=c[Number.parseInt(_.toString(),10)],p=d._width,l=this._getHorizontalAlignShift(p,r[2],n),u=this._getLineIndent(d,n,r[2],0===_),f=r[0]+l,g=this._shouldJustify(d,r[2],n,i)?f+r[2]-u:f+p-u;i.isUnderline&&(this.drawLine(s,f,o,g,o),o+=e._lineHeight),i.isStrikeout&&(this.drawLine(s,f,h,g,h),h+=e._lineHeight)}}},e.prototype.drawLine=function(t,e,i,r,n){this._stateControl(t),this._sw._beginPath(e,i),this._sw._appendLineSegment(r,n),this._sw._strokePath(),H("PDF",this._resourceObject)},e.prototype._createUnderlineStrikeoutPen=function(t,e){return new Ve(t._color,e._metrics._size/20)},e.prototype._checkCorrectLayoutRectangle=function(e,i,r,n){var s=[i,r,e[0],e[0]];if(n){switch(n.alignment){case t.PdfTextAlignment.center:s[0]=s[0]-s[2]/2;break;case t.PdfTextAlignment.right:s[0]=s[0]-s[2]}switch(n.lineAlignment){case t.PdfVerticalAlignment.middle:s[1]=s[1]-s[3]/2;break;case t.PdfVerticalAlignment.bottom:s[1]=s[1]-s[3]}}return s},e.prototype._drawGraphicsPath=function(e,i,r,n){void 0===r&&(r=t.PdfFillMode.winding);var s=void 0!==i&&null!==i,a=void 0!==e&&null!==e,o=r===t.PdfFillMode.alternate;a&&s?n?this._sw._closeFillStrokePath(o):this._sw._fillStrokePath(o):a||s?a?n?this._sw._closeStrokePath():this._sw._strokePath():n?this._sw._closeFillPath(o):this._sw._fillPath(o):this._sw._endPath()},e.prototype._initializeCoordinates=function(t){var e;if(t){var i=[0,0],r=!1;if(t._pageDictionary.has("CropBox")&&t._pageDictionary.has("MediaBox")){e=t._pageDictionary.getArray("CropBox");var n=t._pageDictionary.getArray("MediaBox");e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[3]===n[3]&&(r=!0),e[0]>0&&e[3]>0&&n[0]<0&&n[1]<0?(this.translateTransform(e[0],-e[3]),i[0]=-e[0],i[1]=e[3]):t._pageDictionary.has("CropBox")||(r=!0),r&&(this._sw._writeComment("Change co-ordinate system to left/top."),this._cropBox?this.translateTransform(this._cropBox[0],-this._cropBox[3]):-t._origin[1]<this._mediaBoxUpperRightBound||0===this._mediaBoxUpperRightBound?this.translateTransform(0,-this._size[1]):this.translateTransform(0,-this._mediaBoxUpperRightBound))}}else this._sw._writeComment("Change co-ordinate system to left/top."),this._mediaBoxUpperRightBound!==-this._size[1]&&(this._cropBox&&((e=this._cropBox)[0]>0||e[1]>0||this._size[0]===e[2]||this._size[1]===e[3])?this.translateTransform(e[0],-e[3]):this._mediaBoxUpperRightBound===this._size[1]||0===this._mediaBoxUpperRightBound?this.translateTransform(0,-this._size[1]):this.translateTransform(0,-this._mediaBoxUpperRightBound))},e.prototype.scaleTransform=function(t,e){var i=new Le;i._scale(t,e),this._sw._modifyCtm(i),this._matrix._multiply(i)},e.prototype.translateTransform=function(t,e){var i=new Le;i._translate(t,-e),this._sw._modifyCtm(i),this._matrix._multiply(i)},e.prototype.rotateTransform=function(t){var e=new Le;e._rotate(-t),this._sw._modifyCtm(e),this._matrix._multiply(e)},e.prototype.setClip=function(e,i){void 0===i&&(i=t.PdfFillMode.winding),this._sw._appendRectangle(e[0],e[1],e[2],e[3]),this._sw._clipPath(i===t.PdfFillMode.alternate)},e.prototype.setTransparency=function(e,i,r){void 0===i&&(i=e),void 0===r&&(r=t.PdfBlendMode.normal),void 0===this._transparencies&&(this._transparencies=new Map);var n,s="CA:"+e.toString()+"_ca:"+i.toString()+"_BM:"+r.toString();if(this._transparencies.size>0&&this._transparencies.forEach(function(t,e){t===s&&(n=e)}),!n){n=new Oe;var a=new xr;a.update("CA",e),a.update("ca",i),a.update("BM",z(r));var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),n._dictionary=a,n._key=s,n._name=vr.get(G()),n._reference=o;var h=void 0,c=!1;if(this._resourceObject.has("ExtGState")){var _=this._resourceObject.getRaw("ExtGState");null!==_&&void 0!==_&&(_ instanceof wr?(c=!0,h=this._crossReference._fetch(_)):_ instanceof xr&&(h=_))}else h=new xr(this._crossReference),this._resourceObject.update("ExtGState",h);h.update(n._name.name,o),c&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0)}this._sw._setGraphicsState(n._name)},e.prototype._setTransparencyData=function(t,e){this._resourceMap.set(t,e);var i=this._crossReference._fetch(t),r=0,n=0,s=0;i.has("CA")&&(r=i.get("CA")),i.has("ca")&&(n=i.get("ca")),i.has("ca")&&(n=i.get("ca")),i.has("BM")&&(s=U(i.get("BM")));var a="CA:"+r.toString()+"_ca:"+n.toString()+"_BM:"+s.toString(),o=new Oe;o._dictionary=i,o._key=a,o._name=e,o._reference=t,this._transparencies.set(o,a)},e.prototype._getTranslateTransform=function(t,e,i){return i._translate(t,-e),i},e.prototype._getScaleTransform=function(t,e,i){return null!==i&&void 0!==i||(i=new Le),i._scale(t,e),i},e.prototype._clipTranslateMargins=function(t){this._clipBounds=t,this._sw._writeComment("Clip margins."),this._sw._appendRectangle(t[0],t[1],t[2],t[3]),this._sw._closePath(),this._sw._clipPath(!1),this._sw._writeComment("Translate co-ordinate system."),this.translateTransform(t[0],t[1])},e}(),Le=function(){function t(){this._matrix=new Me(1,0,0,1,0,0)}return t.prototype._translate=function(t,e){this._matrix._translate(t,e)},t.prototype._scale=function(t,e){this._matrix._elements[0]=t,this._matrix._elements[3]=e},t.prototype._rotate=function(t){t=t*Math.PI/180,this._matrix._elements[0]=Math.cos(t),this._matrix._elements[1]=Math.sin(t),this._matrix._elements[2]=-Math.sin(t),this._matrix._elements[3]=Math.cos(t)},t.prototype._multiply=function(t){this._matrix._multiply(t._matrix)},t.prototype._toString=function(){for(var t="",e=0,i=this._matrix._elements.length;e<i;e++)t+=W(this._matrix._elements[Number.parseInt(e.toString(),10)])+" ";return t},t}(),Me=function(){function t(t,e,i,r,n,s){this._elements=void 0===t?[]:"number"==typeof t?[t,e,i,r,n,s]:t}return Object.defineProperty(t.prototype,"_offsetX",{get:function(){return this._elements[4]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_offsetY",{get:function(){return this._elements[5]},enumerable:!0,configurable:!0}),t.prototype._clone=function(){return new t(this._elements.slice())},t.prototype._translate=function(t,e){this._elements[4]=t,this._elements[5]=e},t.prototype._transform=function(t){var e=t[0],i=t[1];return[e*this._elements[0]+i*this._elements[2]+this._offsetX,e*this._elements[1]+i*this._elements[3]+this._offsetY]},t.prototype._multiply=function(t){this._elements=[this._elements[0]*t._elements[0]+this._elements[1]*t._elements[2],this._elements[0]*t._elements[1]+this._elements[1]*t._elements[3],this._elements[2]*t._elements[0]+this._elements[3]*t._elements[2],this._elements[2]*t._elements[1]+this._elements[3]*t._elements[3],this._offsetX*t._elements[0]+this._offsetY*t._elements[2]+t._offsetX,this._offsetX*t._elements[1]+this._offsetY*t._elements[3]+t._offsetY]},t}(),De=function(){function e(e,i){e&&(this._g=e,this._transformationMatrix=i),this._charSpacing=0,this._wordSpacing=0,this._textScaling=100,this._textRenderingMode=t._TextRenderingMode.fill}return e}(),Oe=function(){function t(){}return t}();!function(t){t[t.fill=0]="fill",t[t.stroke=1]="stroke",t[t.fillStroke=2]="fillStroke",t[t.none=3]="none",t[t.clipFlag=4]="clipFlag",t[t.clipFill=4]="clipFill",t[t.clipStroke=5]="clipStroke",t[t.clipFillStroke=6]="clipFillStroke",t[t.clip=7]="clip"}(t._TextRenderingMode||(t._TextRenderingMode={}));var Ee=function(){function t(t){this._color=void 0!==t?t:[0,0,0]}return t}(),Ve=function(){function e(e,i){this._color=e,this._width=i,this._dashOffset=0,this._dashPattern=[],this._dashStyle=t.PdfDashStyle.solid,this._miterLimit=0,this._lineCap=t.PdfLineCap.flat,this._lineJoin=t.PdfLineJoin.miter}return e}(),je=function(){function t(){this._horizontalResolution=96,this._proportions=this._updateProportions(this._horizontalResolution)}return t.prototype._updateProportions=function(t){return[t/2.54,t/6,1,t/72,t,t/300,t/25.4]},t.prototype._convertUnits=function(t,e,i){return this._convertFromPixels(this._convertToPixels(t,e),i)},t.prototype._convertFromPixels=function(t,e){var i=e;return t/this._proportions[Number.parseInt(i.toString(),10)]},t.prototype._convertToPixels=function(t,e){var i=e;return t*this._proportions[Number.parseInt(i.toString(),10)]},t}(),ze=function(){function t(t){void 0===t&&(t=!1),this._position=0,this._bufferText="",this._buffer=new Uint8Array(0),this._namespaceStack=[],this._elementStack=[],t?(this._currentState="StartDocument",this._skipNamespace=!0):(this._currentState="Initial",this._namespaceStack.push(new Ue),this._elementStack.push(new We),this._namespaceStack[0]._set("xmlns","http://www.w3.org/2000/xmlns/","Special"),this._namespaceStack.push(new Ue),this._namespaceStack[1]._set("xml","http://www.w3.org/XML/1998/namespace","Special"),this._namespaceStack.push(new Ue),this._namespaceStack[2]._set("","","Implied"),this._elementStack[0]._set("","","",this._namespaceStack.length-1)),this._attributeStack=[]}return Object.defineProperty(t.prototype,"buffer",{get:function(){return this._flush(),this._buffer},enumerable:!0,configurable:!0}),t.prototype._writeStartDocument=function(t){if("Initial"!==this._currentState||void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");this._currentState="StartDocument",this._rawText('<?xml version="1.0" encoding="utf-8'),void 0!==t&&null!==t&&(this._rawText('" standalone="'),this._rawText(t?"yes":"no")),this._rawText('"?>')},t.prototype._writeStartElement=function(t,e,i){if(void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");if(void 0===t||null===t||0===t.length)throw new Error("ArgumentException: localName cannot be undefined, null or empty");if(this._checkName(t),"Initial"===this._currentState&&this._writeStartDocument(),"StartElement"===this._currentState&&this._startElementContent(),this._currentState="StartElement",void 0===e||null===e)void 0!==i&&null!==i&&(e=this._lookupPrefix(i)),void 0!==e&&null!==e||(e="");else if(e.length>0&&(void 0!==i&&null!==i||(i=this._lookupNamespace(e)),void 0===i||null===i||void 0!==i&&0===i.length))throw new Error("ArgumentException: Cannot use a prefix with an empty namespace");void 0!==i&&null!==i||(i=this._lookupNamespace(e)),this._writeStartElementInternal(e,t,i)},t.prototype._writeEndElement=function(){"StartElement"===this._currentState?(this._startElementContent(),this._currentState="ElementContent"):"ElementContent"===this._currentState&&(this._currentState="ElementContent"),this._currentState="EndElement";var t=this._elementStack.length-1;this._writeEndElementInternal(this._elementStack[Number.parseInt(t.toString(),10)]._prefix,this._elementStack[Number.parseInt(t.toString(),10)]._localName),this._namespaceStack.splice(this._elementStack[Number.parseInt(t.toString(),10)]._previousTop+1),this._elementStack.splice(t)},t.prototype._writeElementString=function(t,e,i,r){this._writeStartElement(t,i,r),void 0!==e&&null!==e&&0!==e.length&&this._writeString(e),this._writeEndElement()},t.prototype._writeAttributeString=function(t,e,i,r){this._writeStartAttribute(t,e,i,r),this._writeStringInternal(e,!0),this._writeEndAttribute()},t.prototype._writeString=function(t){this._writeInternal(t,!1)},t.prototype._writeRaw=function(t){this._writeInternal(t,!0)},t.prototype._writeInternal=function(t,e){if(null!==t&&void 0!==t){if("StartElement"!==this._currentState&&"ElementContent"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");"StartElement"===this._currentState&&this._startElementContent(),this._currentState="ElementContent",e?this._rawText(t):this._writeStringInternal(t,!1)}},t.prototype._save=function(){for(;this._elementStack.length-1>0;)this._writeEndElement();return""!==this._bufferText&&this._flush(),this._buffer},t.prototype._destroy=function(){this._buffer=void 0;for(t=0;t<this._namespaceStack.length;t++)this._namespaceStack[Number.parseInt(t.toString(),10)]._destroy();this._namespaceStack=[];for(var t=0;t<this._elementStack.length;t++)this._elementStack[Number.parseInt(t.toString(),10)]._destroy();this._elementStack=[],this._bufferText="",this._position=0},t.prototype._flush=function(){if(this._buffer&&this._bufferText&&""!==this._bufferText){if(this._buffer.length>0){for(var t=new Array(this._bufferText.length),e=0;e<this._bufferText.length;e++)t[Number.parseInt(e.toString(),10)]=255&this._bufferText.charCodeAt(e);var i=new Uint8Array(this._buffer.length+t.length);i.set(this._buffer),i.set(t,this._buffer.length),this._buffer=i}else this._buffer=u(this._bufferText);this._bufferText=""}},t.prototype._writeStartAttribute=function(t,e,i,r){if(void 0===t||null===t||0===t.length){if("xmlns"!==i)throw new Error("ArgumentException: localName cannot be undefined, null or empty");t="xmlns",i=""}if("StartElement"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");this._checkName(t),this._writeStartAttributePrefixAndNameSpace(t,e,i,r)},t.prototype._writeStartAttributePrefixAndNameSpace=function(t,e,i,r){void 0!==i&&null!==i||(void 0!==r&&null!==r&&("xmlns"===t&&"http://www.w3.org/2000/xmlns/"===r||(i=this._lookupPrefix(r))),void 0!==i&&null!==i||(i="")),void 0!==r&&null!==r||(void 0!==i&&null!==i&&i.length>0&&(r=this._lookupNamespace(i)),void 0!==r&&null!==r||(r="")),this._writeStartAttributeSpecialAttribute(i,t,r,e)},t.prototype._writeStartAttributeSpecialAttribute=function(t,e,i,r){if(0===t.length){if("x"===e[0]&&"xmlns"===e)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit("",r);i.length>0&&(t=this._lookupPrefix(i))}else{if("x"===t[0]){if("xmlns"===t)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit(e,r);if("xml"===t&&("space"===e||"lang"===e))return void this._skipPushAndWrite(t,e,i)}0===i.length&&(t="")}void 0!==t&&null!==t&&0!==t.length&&this._pushNamespaceImplicit(t,i),this._skipPushAndWrite(t,e,i)},t.prototype._writeEndAttribute=function(){this._currentState="StartElement",this._bufferText+='"'},t.prototype._writeStartElementInternal=function(t,e,i){this._bufferText+="<",t.length>0&&(this._rawText(t),this._bufferText+=":"),this._rawText(e);var r=this._elementStack.length;this._elementStack.push(new We),this._elementStack[Number.parseInt(r.toString(),10)]._set(t,e,i,this._namespaceStack.length-1),this._pushNamespaceImplicit(t,i);for(var n=0;n<this._attributeStack.length;n++)this._attributeStack[Number.parseInt(n.toString(),10)]._destroy();this._attributeStack=[]},t.prototype._writeEndElementInternal=function(t,e){this._position!==this._bufferText.length+1?(this._bufferText+="</",void 0!==t&&null!==t&&0!==t.length&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+=">"):(this._bufferText=this._bufferText.substring(0,this._bufferText.length-1),this._bufferText+=" />")},t.prototype._writeStartAttributeInternal=function(t,e){this._bufferText+=" ",void 0!==t&&null!==t&&t.length>0&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+='="'},t.prototype._writeNamespaceDeclaration=function(t,e){this._skipNamespace||(this._writeStartNamespaceDeclaration(t),this._writeStringInternal(e,!0),this._bufferText+='"')},t.prototype._writeStartNamespaceDeclaration=function(t){void 0===t||null===t||0===t.length?this._rawText(' xmlns="'):(this._rawText(" xmlns:"),this._rawText(t),this._bufferText+="=",this._bufferText+='"')},t.prototype._writeStringInternal=function(t,e){void 0!==t&&null!==t||(t=""),t=(t=(t=t.replace(/\&/g,"&amp;")).replace(/\</g,"&lt;")).replace(/\>/g,"&gt;"),e&&(t=t.replace(/\"/g,"&quot;")),this._bufferText+=t,e||(this._position=0)},t.prototype._startElementContent=function(){for(var t=this._elementStack[this._elementStack.length-1]._previousTop,e=this._namespaceStack.length-1;e>t;e--)"NeedToWrite"===this._namespaceStack[Number.parseInt(e.toString(),10)]._kind&&this._writeNamespaceDeclaration(this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix,this._namespaceStack[Number.parseInt(e.toString(),10)]._namespaceUri);this._bufferText+=">",this._position=this._bufferText.length+1},t.prototype._rawText=function(t){this._bufferText+=t},t.prototype._addNamespace=function(t,e,i){var r=this._namespaceStack.length;this._namespaceStack.push(new Ue),this._namespaceStack[Number.parseInt(r.toString(),10)]._set(t,e,i)},t.prototype._lookupPrefix=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[Number.parseInt(e.toString(),10)]._namespaceUri===t)return this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix},t.prototype._lookupNamespace=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix===t)return this._namespaceStack[Number.parseInt(e.toString(),10)]._namespaceUri},t.prototype._lookupNamespaceIndex=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix===t)return e;return-1},t.prototype._pushNamespaceImplicit=function(t,e){var i,r=this._lookupNamespaceIndex(t),n=!0;if(-1!==r)if(r>this._elementStack[this._elementStack.length-1]._previousTop){if(this._namespaceStack[Number.parseInt(r.toString(),10)]._namespaceUri!==e)throw new Error("XmlException namespace Uri needs to be the same as the one that is already declared");n=!1}else if("Special"===this._namespaceStack[Number.parseInt(r.toString(),10)]._kind){if("xml"!==t)throw new Error('InvalidArgumentException: Prefix "xmlns" is reserved for use by XML.');if(e!==this._namespaceStack[Number.parseInt(r.toString(),10)]._namespaceUri)throw new Error("InvalidArgumentException: Xml String");i="Implied"}else i=this._namespaceStack[Number.parseInt(r.toString(),10)]._namespaceUri===e?"Implied":"NeedToWrite";else{if("http://www.w3.org/XML/1998/namespace"===e&&"xml"!==t||"http://www.w3.org/2000/xmlns/"===e&&"xmlns"!==t)throw new Error("InvalidArgumentException");i="NeedToWrite"}n&&this._addNamespace(t,e,i)},t.prototype._pushNamespaceExplicit=function(t,e){var i=this._lookupNamespaceIndex(t);if(-1!==i&&i>this._elementStack[this._elementStack.length-1]._previousTop)return void(this._namespaceStack[Number.parseInt(i.toString(),10)]._kind="Written");this._addNamespace(t,e,"Written")},t.prototype._addAttribute=function(t,e,i){var r=this._attributeStack.length;this._attributeStack.push(new He),this._attributeStack[Number.parseInt(r.toString(),10)]._set(t,e,i);for(var n=0;n<r;n++)if(this._attributeStack[Number.parseInt(n.toString(),10)]._isDuplicate(t,e,i))throw new Error("XmlException: duplicate attribute name")},t.prototype._skipPushAndWrite=function(t,e,i){this._addAttribute(t,e,i),this._writeStartAttributeInternal(t,e)},t.prototype._checkName=function(t){if(/[ !@#$%^&*()+\=\[\]{};':"\\|,<>\/?]/.test(t))throw new Error("InvalidArgumentException: invalid name character")},t}(),Ue=function(){function t(){}return t.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=e,this._kind=i},t.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._kind=void 0},t}(),We=function(){function t(){}return t.prototype._set=function(t,e,i,r){this._previousTop=r,this._prefix=t,this._namespaceUri=i,this._localName=e},t.prototype._destroy=function(){this._previousTop=void 0,this._prefix=void 0,this._localName=void 0,this._namespaceUri=void 0},t}(),He=function(){function t(){}return t.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=i,this._localName=e},t.prototype._isDuplicate=function(t,e,i){return this._localName===e&&(this._prefix===t||this._namespaceUri===i)},t.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._localName=void 0},t}(),Ge=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ke=function(){function t(){this._asPerSpecification=!1,this._fileName="",this._formKey="",this._exportEmptyFields=!1,this._groupReferences=new Map,this._groupHolders=[],this._richTextPrefix='<?xml version="1.0"?>',this._table=new Map,this._fields=new Map,this._richTextValues=new Map,this._jsonData=[],this._openingBrace=123,this._openingBracket=91,this._closingBrace=125,this._closingBracket=93,this._colon=58,this._doubleQuotes=34,this._comma=44,this._space=32,this.fdfString="",this._xmlImport=!1}return t.prototype._exportFormFieldsData=function(t){var e="";if(null!==t&&void 0!==t&&t.export){var i=T(t._dictionary,"FT",!1,!0);if(i&&null!==i.name&&void 0!==i.name){var r=this._getEncodedFontDictionary(t._dictionary),n=t.name;null!==r&&void 0!==r&&(n=this._getEncodedValue(n,r));var s=void 0,a=void 0;switch(i.name){case"Tx":null!==(e=T(t._dictionary,"V",!1,!0))&&void 0!==e?(e=this._getEncodedValue(e,r),this._table.set(n,e)):this._exportEmptyFields&&(e="",this._table.set(n,e));break;case"Ch":if(null!==(s=T(t._dictionary,"V",!0,!0))&&void 0!==s&&(a=this._getExportValue(s)),!s&&t._dictionary.has("I")&&(t instanceof ci||t instanceof hi)&&(a=t._obtainSelectedValue()),null!==a&&void 0!==a){if("string"==typeof a&&""!==a)e=a=this._getEncodedValue(a,r),this._table.set(n,e);else if(a instanceof Array&&a.length>0){for(var o=[],h=0;h<a.length;h++)o.push(this._getEncodedValue(a[Number.parseInt(h.toString(),10)],r));return this._table.set(n,o),o}}else this._exportEmptyFields&&(e="",this._table.set(n,e));break;case"Btn":if(null!==(s=T(t._dictionary,"V",!1,!0))&&void 0!==s){var c=this._getExportValue(s,t);if(null!==c&&void 0!==c&&""!==c){var _=void 0;if(t instanceof ai&&(_=t),!t._dictionary.has("Opt")||null!==_&&void 0!==_&&-1===_.selectedIndex)e=c=this._getEncodedValue(c,r),this._table.set(n,e);else if(t._dictionary.has("Opt")){var d=t._dictionary.getArray("Opt"),p=Number.parseInt(c,10);if((null===p||void 0===p||Number.isNaN(p))&&(p=0),null!==d&&void 0!==d){var l=void 0;null!==(l=_?d[_.selectedIndex]:d[Number.parseInt(p.toString(),10)])&&void 0!==l&&(c=l),null!==c&&void 0!==c&&""!==c&&(e=c=this._getEncodedValue(c,r),this._table.set(n,e))}}}else(t instanceof ai||t instanceof si)&&(e=this._exportEmptyFields?c:"Off",this._table.set(n,e))}else if(t instanceof ai)(e=t._getAppearanceStateValue())||(e=this._exportEmptyFields?"":"Off"),this._table.set(n,e);else{var u=t.itemAt(t._defaultIndex),f=void 0;(f=u?u._dictionary:t._dictionary)&&f.has("AS")?(e=f.get("AS").name,this._table.set(n,e)):this._exportEmptyFields&&(e="",this._table.set(n,e))}}}}return e},t.prototype._exportFormFieldData=function(t){var e=T(t._dictionary,"FT",!1,!0);if(e&&null!==e.name&&void 0!==e.name){var i=this._getEncodedFontDictionary(t._dictionary),r=t.name;null!==i&&void 0!==i&&(r=this._getEncodedValue(r,i));var n=void 0,s=void 0;switch(e.name){case"Tx":if(n=T(t._dictionary,"V",!1,!0),this._asPerSpecification){if(t._dictionary.has("RV"))null!==(n=T(t._dictionary,"RV",!1,!0))&&void 0!==n&&(n+=this._key,this._formKey=this._key,this._table.set(r,n));else if(null!==n&&void 0!==n){var a=n=this._getEncodedValue(n,i);t instanceof ri&&t.multiLine&&(n=a=(a=a.replace("\n","")).replace("\r","\r\n")),this._table.set(r,n)}}else null!==n&&void 0!==n?(n=this._getEncodedValue(n,i),this._table.set(r,n)):this._exportEmptyFields&&this._table.set(r,"");break;case"Ch":if(s=T(t._dictionary,"V",!0,!0),this._asPerSpecification){if(t instanceof oi)if(Array.isArray(s))this._table.set(r,s);else if("string"==typeof s)s=this._getEncodedValue(s,i),this._table.set(r,s);else if((null===s||void 0===s)&&t._dictionary.has("I")&&null!==(c=t._obtainSelectedValue())&&void 0!==c)if("string"==typeof c&&""!==c)c=this._getEncodedValue(c,i),this._table.set(r,n);else if(c instanceof Array&&c.length>0){for(var o=[],h=0;h<c.length;h++)o.push(this._getEncodedValue(c[Number.parseInt(h.toString(),10)],i));this._table.set(r,o)}}else{var c=void 0;if(null!==s&&void 0!==s&&(c=this._getExportValue(s)),!s&&t._dictionary.has("I")&&(t instanceof ci||t instanceof hi)&&(c=t._obtainSelectedValue()),null!==c&&void 0!==c)if("string"==typeof c&&""!==c)c=this._getEncodedValue(c,i),this._table.set(r,c);else if(c instanceof Array&&c.length>0){for(var o=[],h=0;h<c.length;h++)o.push(this._getEncodedValue(c[Number.parseInt(h.toString(),10)],i));this._table.set(r,o)}else this._exportEmptyFields&&this._table.set(r,"");else this._exportEmptyFields&&this._table.set(r,"")}break;case"Btn":if(null!==(s=T(t._dictionary,"V",!1,!0))&&void 0!==s)if(null!==(u=this._getExportValue(s,t))&&void 0!==u&&""!==u){this._asPerSpecification&&"XML"!==this._format&&(u=P(u));var _=void 0;if(t instanceof ai&&(_=t),!t._dictionary.has("Opt")||null!==_&&void 0!==_&&-1===_.selectedIndex)u=this._getEncodedValue(u,i),this._table.set(r,u);else if(t._dictionary.has("Opt")){var d=t._dictionary.getArray("Opt"),p=Number.parseInt(u,10);if((null===p||void 0===p||Number.isNaN(p))&&(p=0),null!==d&&void 0!==d){var l=void 0;null!==(l=_?d[_.selectedIndex]:d[Number.parseInt(p.toString(),10)])&&void 0!==l&&(u=l),null!==u&&void 0!==u&&""!==u&&(u=this._getEncodedValue(u,i),this._table.set(r,u))}}}else(t instanceof ai||t instanceof si)&&(this._exportEmptyFields?this._table.set(r,u):this._table.set(r,"Off"));else if(t instanceof ai){var u=t._getAppearanceStateValue();u||(u=this._exportEmptyFields?"":"Off"),this._table.set(r,u)}else{var f=t.itemAt(t._defaultIndex),g=void 0;(g=f?f._dictionary:t._dictionary)&&g.has("AS")?this._table.set(r,g.get("AS").name):this._exportEmptyFields&&this._table.set(r,"")}}}},t.prototype._getAnnotationType=function(t){var e="";if(t.has("Subtype")){var i=t.get("Subtype");i&&(e=i.name)}return e},t.prototype._getValue=function(t,e){void 0===e&&(e=!1);var i="";if(void 0!==t&&null!==t)if(t instanceof vr)i=t.name;else if("boolean"==typeof t)i=t?e?"true":"yes":e?"false":"no";else if("string"==typeof t)i=this._getValidString(t);else if(Array.isArray(t)){var r=t;r.length>0&&(i=this._getValue(r[0],e));for(var n=1;n<r.length;n++)i+=","+this._getValue(r[Number.parseInt(n.toString(),10)],e)}else"number"==typeof t&&(i=t.toString());return i},t.prototype._getColor=function(t){var e="";if(t&&Array.isArray(t)&&t.length>=3){var i=Math.round(255*t[0]).toString(16).toUpperCase(),r=Math.round(255*t[1]).toString(16).toUpperCase(),n=Math.round(255*t[2]).toString(16).toUpperCase();e="#"+(1===i.length?"0"+i:i)+(1===r.length?"0"+r:r)+(1===n.length?"0"+n:n)}return e},t.prototype._getValidString=function(t){return-1!==t.indexOf("\n")&&(t=t.replace(/\n/g,"\\n")),-1!==t.indexOf("\r")&&(t=t.replace(/\r/g,"\\r")),t},t.prototype._getEncodedFontDictionary=function(t){var e,i;if(t.has("Kids")&&!t.has("AP")&&(i=t.getArray("Kids")),t.has("AP")||null!==i&&void 0!==i&&Array.isArray(i)){var r=void 0;if(null!==i&&void 0!==i&&i.length>0){var n=i[0];null!==n&&void 0!==n&&n.has("AP")&&(r=n.get("AP"))}else r=t.get("AP");if(null!==r&&void 0!==r&&r.has("N")){var s=r.get("N");if(null!==s&&void 0!==s&&s instanceof Nr&&s.dictionary.has("Resources")){var a=s.dictionary.get("Resources");null!==a&&void 0!==a&&a.has("Font")&&(e=a.get("Font"))}}}return e},t.prototype._getEncodedValue=function(t,e){var i,r=this,n=t;if(null!==this._encodeDictionary&&void 0!==this._encodeDictionary)return i=new Xe(this._encodeDictionary),this._replaceNotUsedCharacters(n,i);var s=this._document.form._dictionary;if(null!==s&&void 0!==s&&s.has("DR")){var a=s.get("DR");if(null!==a&&void 0!==a&&a.has("Encoding")){var o=a.get("Encoding");if(null!==o&&void 0!==o&&o.has("PDFDocEncoding")){var h=o.get("PDFDocEncoding");if(null!==h&&void 0!==h&&h.has("Differences")){var c=new xr(this._crossReference);c.set("Differences",h.get("Differences"));var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,c);var d=new xr(this._crossReference);if(d.set("Subtype",vr.get("Type1")),d.set("Encoding",_),null!==(i=new Xe(d))&&void 0!==i&&null!==i.differencesDictionary&&void 0!==i.differencesDictionary&&i.differencesDictionary.size>0)return this._encodeDictionary=d,this._replaceNotUsedCharacters(n,i)}}}}if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e.size>0){var p,l=!1;if(e.forEach(function(t,e){if(!l&&null!==e&&void 0!==e){var s=void 0;if(e instanceof xr)s=e;else if(e instanceof wr){var a=r._crossReference._fetch(e);null!==a&&void 0!==a&&a instanceof xr&&(s=a)}s&&(i=new Xe(s),p=r._replaceNotUsedCharacters(n,i),l=!0)}}),!l)return p}return n},t.prototype._replaceNotUsedCharacters=function(t,e){for(var i="",r=e.differencesDictionary,n=0;n<t.length;n++){var s=t[Number.parseInt(n.toString(),10)],a=t.charCodeAt(n);if(r.has(s)){var o=r.get(s);o.length>1&&"Type3"!==e._fontType||a>127&&a<=255&&"Type1"===e._fontType&&"WinAnsiEncoding"!==e._baseFontEncoding&&"Encoding"===e._fontEncoding&&"ZapfDingbats"===e._fontName?i+=s:i+=o}else i+=s}return i},t.prototype._getExportValue=function(t,e){var i;if(null!==t&&void 0!==t)if(null!==e&&void 0!==e){if(t instanceof vr?i=t.name:"string"==typeof t&&(i=t),null!==i&&void 0!==i&&""!==i&&e instanceof ai&&-1!==e.selectedIndex){var r=e.itemAt(e.selectedIndex);null!==r&&void 0!==r&&r.value===i&&(i=r.value)}}else if(t instanceof vr)i=t.name;else if("string"==typeof t)i=t;else if(Array.isArray(t)){for(var n=[],s=0;s<t.length;s++){var a=t[Number.parseInt(s.toString(),10)];a instanceof vr?n.push(a.name):"string"==typeof a&&n.push(a)}return n}return i},t.prototype._addReferenceToGroup=function(t,e){var i=e.get("NM");i&&""!==i?(this._groupReferences.set(i,t),e.has("IRT")&&this._groupHolders.push(e)):!i&&e.has("IRT")&&(i=e.get("IRT"))&&""!==i&&this._groupReferences.has(i)&&e.update("IRT",this._groupReferences.get(i))},t.prototype._handlePopup=function(t,e,i,r){if(i.has("Popup")){var n=i.getRaw("Popup"),s=i.get("Popup");if(s instanceof xr){n&&s&&s.update("Parent",e);var a=t._parseAnnotation(s),o=t._annotations.length;t._annotations.push(e),r.set("Annots",t._annotations),r._updated=!0,t._parsedAnnotations.set(o,a)}}},t.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._fields.forEach(function(r,n){var s;t._richTextValues.size>0&&t._richTextValues.has(n)&&(s=t._richTextValues.get(n));var a=e._getFieldIndex(n);if(-1!==a&&a<i){var o=e.fieldAt(a);o&&null!==o&&void 0!==o&&(s&&""!==s&&o._dictionary.update("RV",s),t._importFieldData(o,r))}})},t.prototype._importFieldData=function(t,e){if(null!==e&&void 0!==e&&e.length>0&&null!==t&&void 0!==t&&!t.readOnly){var i=e[0];if(t instanceof ri)null!==i&&void 0!==i&&(t instanceof ri&&t.multiLine&&(i=(i=i.replace("\r\n","\r")).replace("\n","\r")),t.text=i);else if(t instanceof ci||t instanceof hi){var r;r=e.length>1?e:this._xmlImport?-1!==i.indexOf(",")?i.split(","):[i]:[-1!==i.indexOf(",")?i.split(",")[0]:i];var n=[],s=t._options;s&&s.length>0&&s.forEach(function(t){-1===r.indexOf(t[0])&&-1===r.indexOf(t[1])||n.push(s.indexOf(t))}),n.length>0&&(t.selectedIndex=n,t instanceof hi&&this._asPerSpecification&&t._dictionary.has("AP")&&(delete t._dictionary._map.AP,t._dictionary._updated=!0))}else if(t instanceof si){var a=i.toLowerCase();this._containsExportValue(i,t)||"on"===a||"yes"===a?t.checked=!0:t.checked=!1}else if(t instanceof ai){for(var o=-1,h=0;h<t._kidsCount;h++){var c=t.itemAt(h);if(c&&c.value&&c.value===i){o=h;break}}-1!==o&&t.selectedIndex!==o&&(t.selectedIndex=o)}}},t.prototype._containsExportValue=function(t,e){var i=!1;if(e._kidsCount>0)for(var r=0;r<e._kidsCount;r++){var n=e.itemAt(r);if(n&&this._checkSelected(n._dictionary,t))return!0}else if(!(i=this._checkSelected(e._dictionary,t))&&this._asPerSpecification&&e._dictionary.has("AS")){var s=e._dictionary.get("AS");if(!s||"Off"!==s.name&&"No"!==s.name)i=!0;else if(e._dictionary.has("Opt")){var a=e._dictionary.getArray("Opt");a&&a.length>0&&a.forEach(function(e){e===t&&(i=!0)})}}return i},t.prototype._checkSelected=function(t,e){if(t&&t.has("AP")){var i=t.get("AP");if(i&&i instanceof xr&&i.has("N")){var r=i.get("N");if(r&&r instanceof xr&&r.has(e)&&"off"!==e.toLocaleLowerCase()&&"no"!==e.toLocaleLowerCase())return!0}}return!1},t.prototype._dispose=function(){this.exportAppearance=void 0,this._asPerSpecification=void 0,this._skipBorderStyle=void 0,this._fileName=void 0,this._document=void 0,this._crossReference=void 0,this._isAnnotationExport=void 0,this._isAnnotationImport=void 0,this._key=void 0,this._formKey=void 0,this._exportEmptyFields=void 0,this._groupReferences=void 0,this._groupHolders=void 0,this._encodeDictionary=void 0,this._annotationTypes=void 0,this._annotationAttributes=void 0,this._xmlDocument=void 0,this._parser=void 0,this._table=void 0,this._fields=void 0,this._richTextValues=void 0,this._jsonData=void 0},t}(),qe=function(e){function i(t){var i=e.call(this)||this;return null!==t&&void 0!==t&&(i._fileName=t),i}return Ge(i,e),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._save()},i.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=G(),this._save()},i.prototype._save=function(){var t=new ze;if(t._writeStartDocument(),t._writeStartElement("xfdf"),t._writeAttributeString(null,"http://ns.adobe.com/xfdf/","xmlns",null),t._writeAttributeString("space","preserve","xml",null),this._isAnnotationExport){if(t._writeStartElement("annots"),this._document)for(a=0;a<this._document.pageCount;a++)for(var e=this._document.getPage(a).annotations,i=0;i<e.count;i++){var r=e.at(i);r&&(!this._annotationTypes||0===this._annotationTypes.length||this._annotationTypes&&this._annotationTypes.length>0&&this._checkAnnotationType(r))&&this._exportAnnotationData(r,t,a)}t._writeEndElement()}else{var n=this._document.form;if(null!==n&&void 0!==n){this._exportEmptyFields=n.exportEmptyFields;for(var s=this._document.form.count,a=0;a<s;a++){var o=this._document.form.fieldAt(a);null!==o&&void 0!==o&&o.export&&this._exportFormFieldData(o)}this._writeFormFieldData(t,this._asPerSpecification)}}this._asPerSpecification||(t._writeStartElement("f"),t._writeAttributeString("href",this._fileName));var h=t._save();return t._destroy(),h},i.prototype._writeFormFieldData=function(t,e){var i=this;if(void 0===e&&(e=!1),e){t._writeStartElement("f"),t._writeAttributeString("href",this._fileName),t._writeEndElement();var r=this._getElements(this._table);if(r&&r.size>0){t._writeStartElement("fields");var n=!1;r.forEach(function(e,r){if(t._writeStartElement("field"),t._writeAttributeString("name",r.toString()),Array.isArray(e)&&e.forEach(function(e){t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement(),n=!0}),e instanceof Map)i._writeFieldName(e,t);else if(!n&&!e.toString().endsWith(i._formKey)||!n&&""===i._formKey)t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement();else if(""!==i._formKey&&e.toString().endsWith(i._formKey)){t._writeStartElement("value-richtext");var s=e.toString();s.startsWith('<?xml version="1.0"?>')&&(s=s.substring(21));var a=s.length-i._formKey.length;s=s.substring(0,a)+s.substring(a+i._formKey.length),t._writeRaw(s),t._writeEndElement()}t._writeEndElement(),n=!1}),t._writeEndElement()}t._writeStartElement("ids");var s=!1;if(this._crossReference._root.has("ID")){var a=this._crossReference._root.getArray("ID");a&&a.length>=1&&(t._writeAttributeString("original",a[0]),t._writeAttributeString("modified",a[1]),s=!0)}s||(t._writeAttributeString("original",""),t._writeAttributeString("modified","")),t._writeEndElement()}else t._writeStartElement("fields"),this._table.forEach(function(e,i){t._writeStartElement("field"),t._writeAttributeString("name",i.toString()),Array.isArray(e)?e.forEach(function(e){t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement()}):(t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement()),t._writeEndElement()}),t._writeEndElement()},i.prototype._writeFieldName=function(t,e){var i=this;t.forEach(function(t,r){if(t instanceof Map)e._writeStartElement("field"),e._writeAttributeString("name",r.toString()),i._writeFieldName(t,e),e._writeEndElement();else{if(e._writeStartElement("field"),e._writeAttributeString("name",r.toString()),Array.isArray(t))t.forEach(function(t){e._writeStartElement("value"),e._writeString(t.toString()),e._writeEndElement()});else{if(t.toString().endsWith(i._formKey)&&""!==i._formKey){e._writeStartElement("value-richtext");var n=t.toString();n.startsWith('<?xml version="1.0"?>')&&(n=n.substring(21));var s=n.length-i._formKey.length;n=n.substring(0,s)+n.substring(s+i._formKey.length),e._writeRaw(n)}else e._writeStartElement("value"),e._writeString(t.toString());e._writeEndElement()}e._writeEndElement()}})},i.prototype._getElements=function(t){var e=this,i=new Map;return t.forEach(function(t,r){var n=i;if(-1!==r.toString().indexOf("."))for(var s=r.toString().split("."),a=0;a<s.length;a++){var o=s[Number.parseInt(a.toString(),10)];if(n.has(o))e._getElements(n[o]),n=n[o];else if(a===s.length-1)n.set(o,t);else{var h=new Map;n.set(o,h),n=h}}else n.set(r,t)}),i},i.prototype._checkAnnotationType=function(t){return void 0!==t._type&&-1!==this._annotationTypes.indexOf(t._type)},i.prototype._exportAnnotationData=function(t,e,i){t._dictionary&&!(t instanceof xi||t instanceof Ni||t instanceof Ii||t instanceof Ti)&&this._writeAnnotationData(e,i,t)},i.prototype._writeAnnotationData=function(t,e,i){var r,n,s=!1;i instanceof ui?(r=i,n=i._dictionary):n=i;var a=this._getAnnotationType(n);if(this._skipBorderStyle=!1,a&&""!==a){this._annotationAttributes||(this._annotationAttributes=[]),t._writeStartElement(a.toLowerCase()),t._writeAttributeString("page",e.toString());var o=void 0;switch(a){case"Line":o=r.linePoints,t._writeAttributeString("start",o[0].toString()+","+o[1].toString()),t._writeAttributeString("end",o[2].toString()+","+o[3].toString());break;case"Stamp":case"Square":s=!0}if(n&&n.has("BE")&&n.has("BS")){var h=n.get("BE");h&&h.has("S")&&(this._skipBorderStyle=!0)}this._writeDictionary(n,e,t,s),t._writeEndElement(),this._annotationAttributes=[]}},i.prototype._writeDictionary=function(t,e,i,r){var n=this,s=!1;if(t.has("Type")){var a=t.get("Type");s=a&&"Border"===a.name&&this._skipBorderStyle}if(t.forEach(function(a,o){if((r||"AP"!==a)&&"P"!==a&&"Parent"!==a){var h=void 0;if(o instanceof wr&&(h=t.get(a)),h&&h instanceof xr)switch(a){case"BS":case"BE":n._writeDictionary(h,e,i,!1);break;case"IRT":h.has("NM")&&i._writeAttributeString("inreplyto",n._getValue(h.get("NM")))}else o instanceof xr?n._writeDictionary(o,e,i,!1):(!s||s&&"S"!==a)&&n._writeAttribute(i,a,o)}}),(this.exportAppearance||r)&&t.has("AP")){var o=this._getAppearanceString(t.get("AP"));o&&o.length>0&&(i._writeStartElement("appearance"),i._writeRaw(x(o)),i._writeEndElement())}if(t.has("Measure")&&this._exportMeasureDictionary(t.get("Measure"),i),t.has("Sound")){var h=t.get("Sound");if(h&&h.dictionary){var c=h.dictionary;c.has("B")&&i._writeAttributeString("bits",this._getValue(c.get("B"))),c.has("C")&&i._writeAttributeString("channels",this._getValue(c.get("C"))),c.has("E")&&i._writeAttributeString("encoding",this._getValue(c.get("E"))),c.has("R")&&i._writeAttributeString("rate",this._getValue(c.get("R"))),c.has("Length")&&c.get("Length")>0&&(y=S(h.getBytes()))&&""!==y&&(i._writeStartElement("data"),i._writeAttributeString("MODE","raw"),i._writeAttributeString("encoding","hex"),c.has("Length")&&i._writeAttributeString("length",this._getValue(c.get("Length"))),c.has("Filter")&&i._writeAttributeString("filter",this._getValue(c.get("Filter"))),i._writeRaw(y),i._writeEndElement())}}else if(t.has("FS")){var _=t.get("FS");if(_&&(_.has("F")&&i._writeAttributeString("file",this._getValue(_.get("F"))),_.has("EF"))){var d=_.get("EF");if(d&&d.has("F")){var p=d.get("F");if(p&&p.dictionary){var l=p.dictionary;if(l.has("Params")){var f=l.get("Params");if(f){if(f.has("CreationDate")){v=this._getValue(f.get("CreationDate"));i._writeAttributeString("creation",v)}if(f.has("ModificationDate")){v=this._getValue(f.get("ModificationDate"));i._writeAttributeString("modification",v)}if(f.has("Size")&&i._writeAttributeString("size",this._getValue(f.get("Size"))),f.has("CheckSum")){var g=S(u(v=this._getValue(f.get("CheckSum"))));i._writeAttributeString("checksum",g)}}}var y=S(p.getBytes());y&&""!==y&&(i._writeStartElement("data"),i._writeAttributeString("MODE","raw"),i._writeAttributeString("encoding","hex"),l.has("Length")&&i._writeAttributeString("length",this._getValue(l.get("Length"))),l.has("Filter")&&i._writeAttributeString("filter",this._getValue(l.get("Filter"))),i._writeRaw(y),i._writeEndElement())}}}}if(t.has("Vertices")){i._writeStartElement("vertices");var m=t.getArray("Vertices");if(m&&m.length>0){var b=m.length;if(b%2==0){for(var v="",w=0;w<b-1;w++)v+=this._getValue(m[Number.parseInt(w.toString(),10)])+(w%2!=0?";":",");(v+=this._getValue(m[b-1]))&&""!==v&&i._writeRaw(v)}}i._writeEndElement()}if(t.has("Popup")){var P=t.get("Popup");P&&this._writeAnnotationData(i,e,P)}if(t.has("DA")){var A=t.get("DA");A&&this._writeRawData(i,"defaultappearance",A)}if(t.has("DS")){var k=t.get("DS");k&&this._writeRawData(i,"defaultstyle",k)}if(t.has("InkList")){var T=t.getArray("InkList");if(T&&T.length>0){i._writeStartElement("inklist");for(var I=0;I<T.length;I++)i._writeElementString("gesture",this._getValue(T[Number.parseInt(I.toString(),10)]));i._writeEndElement()}}if(t.has("RC")&&(v=t.get("RC"))&&""!==v){var N=v.indexOf("<body");N>0&&(v=v.substring(N)),this._writeRawData(i,"contents-richtext",v)}t.has("Contents")&&(v=t.get("Contents"))&&v.length>0&&(i._writeStartElement("contents"),i._writeString(v),i._writeEndElement())},i.prototype._getAppearanceString=function(t){var e=new ze(!0);e._writeStartElement("DICT"),e._writeAttributeString("KEY","AP"),this._writeAppearanceDictionary(e,t),e._writeEndElement();var i=e.buffer;return e._destroy(),i},i.prototype._writeAppearanceDictionary=function(t,e){var i=this;e&&e.size>0&&e.forEach(function(r,n){i._writeObject(t,n instanceof wr?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r){if(null!==e&&void 0!==e)if(e instanceof vr)this._writePrefix(t,"NAME",r),t._writeAttributeString("VAL",e.name),t._writeEndElement();else if(Array.isArray(e))this._writePrefix(t,"ARRAY",r),i.has(r)?this._writeArray(t,i.getArray(r),i):this._writeArray(t,e,i),t._writeEndElement();else if("string"==typeof e)this._writePrefix(t,"STRING",r),t._writeAttributeString("VAL",e),t._writeEndElement();else if("number"==typeof e)Number.isInteger(e)?(this._writePrefix(t,"INT",r),t._writeAttributeString("VAL",e.toString())):(this._writePrefix(t,"FIXED",r),t._writeAttributeString("VAL",e.toFixed(6))),t._writeEndElement();else if("boolean"==typeof e)this._writePrefix(t,"BOOL",r),t._writeAttributeString("VAL",e?"true":"false"),t._writeEndElement();else if(e instanceof xr)this._writePrefix(t,"DICT",r),this._writeAppearanceDictionary(t,e),t._writeEndElement();else if(null===e)this._writePrefix(t,"NULL",r),t._writeEndElement();else if(e instanceof Nr&&e.dictionary){var n=e.dictionary;if(this._writePrefix(t,"STREAM",r),t._writeAttributeString("DEFINE",""),n.has("Subtype")&&"Image"===this._getValue(n.get("Subtype"))||!n.has("Type")&&!n.has("Subtype")){s=e.getString(!0);!n.has("Length")&&s&&""!==s&&n.update("Length",e.length),this._writeAppearanceDictionary(t,n),t._writeStartElement("DATA"),t._writeAttributeString("MODE","RAW"),t._writeAttributeString("ENCODING","HEX"),s&&""!==s&&t._writeRaw(s)}else{var s=e.getString();!n.has("Length")&&s&&""!==s&&n.update("Length",e.length),s=(s=s.replace(/</g,"&lt;")).replace(/>/g,"&gt;"),this._writeAppearanceDictionary(t,n),t._writeStartElement("DATA"),t._writeAttributeString("MODE","FILTERED"),t._writeAttributeString("ENCODING","ASCII"),s&&""!==s&&t._writeRaw(s)}t._writeEndElement(),t._writeEndElement()}else e instanceof wr&&this._crossReference&&this._writeObject(t,this._crossReference._fetch(e),i,r)},i.prototype._writePrefix=function(t,e,i){t._writeStartElement(e),i&&t._writeAttributeString("KEY",i)},i.prototype._writeArray=function(t,e,i){var r=this;e.forEach(function(e){r._writeObject(t,e,i)})},i.prototype._getFormatedString=function(t,e){return void 0===e&&(e=!1),t=e?(t=(t=t.replace("&amp;","&")).replace("&lt;","<")).replace("&gt;",">"):(t=(t=t.replace("&","&amp;")).replace("<","&lt;")).replace(">","&gt;")},i.prototype._writeAttribute=function(t,e,i){if(this._annotationAttributes&&-1===this._annotationAttributes.indexOf(e))switch(e){case"C":this._writeColor(t,i,"color","c");break;case"IC":this._writeColor(t,i,"interior-color");break;case"M":this._writeAttributeString(t,"date",i);break;case"NM":this._writeAttributeString(t,"name",i);break;case"Name":this._writeAttributeString(t,"icon",i);break;case"Subj":this._writeAttributeString(t,"subject",i);break;case"T":this._writeAttributeString(t,"title",i);break;case"Rotate":this._writeAttributeString(t,"rotation",i);break;case"W":this._writeAttributeString(t,"width",i);break;case"LE":i&&Array.isArray(i)?2===i.length&&(t._writeAttributeString("head",this._getValue(i[0])),t._writeAttributeString("tail",this._getValue(i[1]))):i instanceof vr&&this._writeAttributeString(t,"head",i);break;case"S":if(-1===this._annotationAttributes.indexOf("style")){switch(this._getValue(i)){case"D":t._writeAttributeString("style","dash");break;case"C":t._writeAttributeString("style","cloudy");break;case"S":t._writeAttributeString("style","solid");break;case"B":t._writeAttributeString("style","bevelled");break;case"I":t._writeAttributeString("style","inset");break;case"U":t._writeAttributeString("style","underline")}this._annotationAttributes.push("style")}break;case"D":this._writeAttributeString(t,"dashes",i);break;case"I":this._writeAttributeString(t,"intensity",i);break;case"RD":this._writeAttributeString(t,"fringe",i);break;case"IT":this._writeAttributeString(t,"IT",i);break;case"RT":this._writeAttributeString(t,"replyType",i,!0);break;case"LL":this._writeAttributeString(t,"leaderLength",i);break;case"LLE":this._writeAttributeString(t,"leaderExtend",i);break;case"Cap":this._writeAttributeString(t,"caption",i);break;case"Q":this._writeAttributeString(t,"justification",i);break;case"CP":this._writeAttributeString(t,"caption-style",i);break;case"CL":this._writeAttributeString(t,"callout",i);break;case"QuadPoints":this._writeAttributeString(t,"coords",i);break;case"CA":this._writeAttributeString(t,"opacity",i);break;case"F":if("number"==typeof i&&-1===this._annotationAttributes.indexOf("flags")){var r=d(i);t._writeAttributeString("flags",r),this._annotationAttributes.push("flags")}break;case"InkList":case"Type":case"Subtype":case"P":case"Parent":case"L":case"Contents":case"RC":case"DA":case"DS":case"FS":case"MeasurementTypes":case"Vertices":case"GroupNesting":case"ITEx":case"TextMarkupContent":break;default:this._writeAttributeString(t,e.toLowerCase(),i)}},i.prototype._writeAttributeString=function(t,e,i,r){if(void 0===r&&(r=!1),-1===this._annotationAttributes.indexOf(e)){var n=this._getValue(i);t._writeAttributeString(e,r?n.toLowerCase():n),this._annotationAttributes.push(e)}},i.prototype._writeRawData=function(t,e,i){i&&""!==i&&(t._writeStartElement(e),t._writeRaw(i),t._writeEndElement())},i.prototype._writeColor=function(t,e,i,r){var n=this._getColor(e);if("number"==typeof e&&r){var s=this._getValue(e);s&&""!==s&&-1===this._annotationAttributes.indexOf(r)&&(t._writeAttributeString(r,s),this._annotationAttributes.push(r))}n&&""!==n&&-1===this._annotationAttributes.indexOf(i)&&(t._writeAttributeString(i,n),this._annotationAttributes.push(i))},i.prototype._exportMeasureDictionary=function(t,e){if(e._writeStartElement("measure"),t){if(t.has("R")&&e._writeAttributeString("rateValue",this._getValue(t.get("R"))),t.has("A")){i=t.getArray("A");e._writeStartElement("area"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}if(t.has("D")){i=t.getArray("D");e._writeStartElement("distance"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}if(t.has("X")){var i=t.getArray("X");e._writeStartElement("xformat"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}}e._writeEndElement()},i.prototype._exportMeasureFormatDetails=function(t,e){t.has("C")&&e._writeAttributeString("c",this._getValue(t.get("C"))),t.has("F")&&e._writeAttributeString("f",this._getValue(t.get("F"))),t.has("D")&&e._writeAttributeString("d",this._getValue(t.get("D"))),t.has("RD")&&e._writeAttributeString("rd",this._getValue(t.get("RD"))),t.has("U")&&e._writeAttributeString("u",this._getValue(t.get("U"))),t.has("RT")&&e._writeAttributeString("rt",this._getValue(t.get("RT"))),t.has("SS")&&e._writeAttributeString("ss",this._getValue(t.get("SS"))),t.has("FD")&&e._writeAttributeString("fd",this._getValue(t.get("FD")))},i.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var i=b(e);this._xmlDocument=(new DOMParser).parseFromString(i,"text/xml"),this._isAnnotationImport=!0,this._readXmlData(this._xmlDocument.documentElement)},i.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._xmlDocument=(new DOMParser).parseFromString(b(e),"text/xml"),this._readXmlData(this._xmlDocument.documentElement)},i.prototype._readXmlData=function(t){if(t&&1===t.nodeType)if(this._checkXfdf(t),this._isAnnotationImport){var e=t.getElementsByTagName("annots");if(e&&e.length>0)for(o=0;o<e.length;o++){var i=e.item(o);if(i&&"annots"===i.localName&&i.hasChildNodes())for(var r=i.childNodes,n=0;n<r.length;n++){var s=r.item(n);if(s&&1===s.nodeType){var a=s;a&&1===a.nodeType&&this._parseAnnotationData(a)}}}if(this._groupHolders.length>0)for(var o=0;o<this._groupHolders.length;o++){var h=this._groupHolders[Number.parseInt(o.toString(),10)],c=h.get("IRT");c&&""!==c&&(this._groupReferences.has(c)?h.update("IRT",this._groupReferences.get(c)):delete h._map.IRT)}this._groupHolders=[],this._groupReferences=new Map}else this._parseFormData(t);this._dispose()},i.prototype._checkXfdf=function(t){if("xfdf"!==t.nodeName)throw new Error("Invalid XFDF file.")},i.prototype._parseFormData=function(t){var e=t.getElementsByTagName("f");if(e&&e.length>0){var i=e.item(0);if(i&&"f"===i.localName&&i.hasAttribute("href")){var r=i.getAttribute("href");r&&""!==r&&(this._fileName=r)}}(e=t.getElementsByTagName("ids"))&&e.length>0&&(this._asPerSpecification=!0);var n=t.childNodes;if(n&&n.length>0)for(var s=0;s<n.length;s++){var a=n.item(s);if(a&&1===a.nodeType){var o=a;if(o&&"fields"===o.localName&&o.hasChildNodes()){for(var h=o.childNodes,c=[],_=0;_<h.length;_++){var d=h.item(_);if(d&&1===d.nodeType){var p=d;p&&"field"===p.localName&&c.push(p)}}this._importFormNodes(c)}}}this._importField()},i.prototype._importFormNodes=function(t){for(var e=0;e<t.length;e++){var i=t[Number.parseInt(e.toString(),10)],r="";if(i&&(i.hasAttribute("name")&&(r=i.getAttribute("name")),r&&""!==r)){var n=i.getElementsByTagName("value");if(n&&n.length>0){for(var s=i,a="";"fields"!==s.localName;){a.length>0&&(a="."+a);c=!1;if(s.hasAttribute("name")){var o=s.getAttribute("name");o&&""!==o&&(a=o+a,c=!0)}c||(a+=s.localName),s=s.parentElement}r=a;f=void 0;f=this._fields.has(r)?this._fields.get(r):[];for(u=0;u<n.length;u++)f.push(n.item(u).textContent);this._fields.set(r,f)}else if((n=i.getElementsByTagName("value-richtext"))&&n.length>0){var h=n.item(0);if(h){for(var s=i,a="";"fields"!==s.localName;){a.length>0&&(a="."+a);var c=!1;if(s.hasAttribute("name")){var _=s.getAttribute("name");_&&""!==_&&(a=_+a,c=!0)}c||(a+=s.localName),s=s.parentElement}r=a;var d=h.textContent;if(h.childNodes&&h.childNodes.length>0){var p=h.childNodes[0];if(p&&p.hasChildNodes()){d="";for(var l=p.childNodes,u=void 0;u<l.length;u++)d+=l.item(u).textContent+"\r";d=d.length>0?d.substring(0,d.length-1):h.textContent}}var f=void 0;f=this._fields.has(r)?this._fields.get(r):[];for(u=0;u<n.length;u++)f.push(d);this._fields.set(r,f),this._richTextValues.has(r)||this._richTextValues.set(r,h.innerHTML)}}}}},i.prototype._parseAnnotationData=function(t){if(t){var e=-1;if(t.hasAttributes&&t.hasAttribute("page")&&(e=Number.parseInt(t.getAttribute("page"),10))>=0&&e<this._document.pageCount){var i=this._document.getPage(e),r=this._getAnnotationDictionary(i,t);if(r&&r.size>0){var n=i._pageDictionary;if(n){var s=i.annotations,a=s._parseAnnotation(r);if(a){a._isImported=!0;var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,r),(r.has("NM")||r.has("IRT"))&&this._addReferenceToGroup(o,r),a._ref=o;var h=s._annotations.length;s._annotations.push(o),n.set("Annots",s._annotations),n._updated=!0,s._parsedAnnotations.set(h,a),this._handlePopup(s,o,r,n)}}}}}},i.prototype._getAnnotationDictionary=function(t,e){var i=new xr(this._crossReference);i.update("Type",vr.get("Annot"));var r=!0;switch(e.localName.toLowerCase()){case"line":if(i.update("Subtype",vr.get("Line")),e.hasAttribute("start")&&e.hasAttribute("end")){var n=[];e.getAttribute("start").split(",").forEach(function(t){n.push(Number.parseFloat(t))}),e.getAttribute("end").split(",").forEach(function(t){n.push(Number.parseFloat(t))}),4===n.length&&i.update("L",n)}this._addLineEndStyle(i,e);break;case"circle":i.update("Subtype",vr.get("Circle"));break;case"square":i.update("Subtype",vr.get("Square"));break;case"polyline":i.update("Subtype",vr.get("PolyLine")),this._addLineEndStyle(i,e);break;case"polygon":i.update("Subtype",vr.get("Polygon")),this._addLineEndStyle(i,e);break;case"ink":i.update("Subtype",vr.get("Ink"));break;case"popup":i.update("Subtype",vr.get("Popup"));break;case"text":i.update("Subtype",vr.get("Text"));break;case"freetext":i.update("Subtype",vr.get("FreeText")),this._addLineEndStyle(i,e);break;case"stamp":i.update("Subtype",vr.get("Stamp"));break;case"highlight":i.update("Subtype",vr.get("Highlight"));break;case"squiggly":i.update("Subtype",vr.get("Squiggly"));break;case"underline":i.update("Subtype",vr.get("Underline"));break;case"strikeout":i.update("Subtype",vr.get("StrikeOut"));break;case"fileattachment":i.update("Subtype",vr.get("FileAttachment"));break;case"sound":i.update("Subtype",vr.get("Sound"));break;case"caret":i.update("Subtype",vr.get("Caret"));break;case"redact":i.update("Subtype",vr.get("Redact"));break;default:r=!1}return r&&this._addAnnotationData(i,e,t),i},i.prototype._addAnnotationData=function(t,e,i){this._addBorderStyle(t,e),this._applyAttributeValues(t,e.attributes),this._parseInnerElements(t,e,i),this._addMeasureDictionary(t,e)},i.prototype._addBorderStyle=function(t,e){var i=new xr(this._crossReference),r=new xr(this._crossReference);e.hasAttribute("width")&&r.update("W",Number.parseFloat(e.getAttribute("width")));var n=!0;if(e.hasAttribute("style")){var s="";switch(e.getAttribute("style")){case"dash":s="D";break;case"solid":s="S";break;case"bevelled":s="B";break;case"inset":s="I";break;case"underline":s="U";break;case"cloudy":s="C",n=!1}if(""!==s)if((n?r:i).update("S",vr.get(s)),!n&&e.hasAttribute("intensity"))i.update("I",Number.parseFloat(e.getAttribute("intensity")));else if(e.hasAttribute("dashes")){var a=[];e.getAttribute("dashes").split(",").forEach(function(t){a.push(Number.parseFloat(t))}),r.update("D",a)}}i.size>0&&t.update("BE",i),r.size>0&&(r.update("Type","Border"),t.update("BS",r))},i.prototype._applyAttributeValues=function(e,i){for(var r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)],s=n.value,a=void 0,o=void 0;switch(n.name.toLowerCase()){case"page":case"start":case"end":case"width":case"head":case"tail":case"style":case"intensity":case"itex":break;case"state":this._addString(e,"State",s);break;case"statemodel":this._addString(e,"StateModel",s);break;case"replytype":"group"===s&&e.update("RT",vr.get("Group"));break;case"inreplyto":this._addString(e,"IRT",s);break;case"rect":(a=this._obtainPoints(s))&&4===a.length&&e.update("Rect",a);break;case"color":(a=B(s))&&3===a.length&&e.update("C",[a[0]/255,a[1]/255,a[2]/255]);break;case"interior-color":(a=B(s))&&3===a.length&&e.update("IC",[a[0]/255,a[1]/255,a[2]/255]);break;case"date":this._addString(e,"M",s);break;case"creationdate":this._addString(e,"CreationDate",s);break;case"name":this._addString(e,"NM",s);break;case"icon":s&&""!==s&&e.update("Name",vr.get(s));break;case"subject":this._addString(e,"Subj",this._getFormatedString(s,!0));break;case"title":this._addString(e,"T",this._getFormatedString(s,!0));break;case"rotation":this._addInt(e,"Rotate",s);break;case"justification":this._addInt(e,"Q",s);break;case"fringe":this._addFloatPoints(e,this._obtainPoints(s),"RD");break;case"it":s&&""!==s&&e.update("IT",vr.get(s));break;case"leaderlength":this._addFloat(e,"LL",s);break;case"leaderextend":void 0!==(o=Number.parseFloat(s))&&e.update("LLE",o);break;case"caption":s&&""!==s&&e.update("Cap","yes"===s.toLowerCase());break;case"caption-style":s&&""!==s&&e.update("CP",vr.get(s));break;case"callout":this._addFloatPoints(e,this._obtainPoints(s),"CL");break;case"coords":this._addFloatPoints(e,this._obtainPoints(s),"QuadPoints");break;case"border":this._addFloatPoints(e,this._obtainPoints(s),"Border");break;case"opacity":this._addFloat(e,"CA",s);break;case"flags":if(s&&""!==s){for(var h=t.PdfAnnotationFlag.default,c=s.split(","),_=0;_<c.length;_++){var d=p(c[Number.parseInt(_.toString(),10)]);0===_?h=d:h|=d}e.update("F",h)}break;case"open":s&&""!==s&&e.update("Open","true"===s||"yes"===s);break;case"calibrate":this._addString(e,"Calibrate",s);break;case"customdata":this._addString(e,"CustomData",s);break;case"overlaytext":e.update("OverlayText",s);break;case"repeat":e.update("Repeat","true"===s||"yes"===s);break;default:this._document._allowImportCustomData&&this._addString(e,n.name,s)}}},i.prototype._obtainPoints=function(t){var e=[];return t.split(",").forEach(function(t){e.push(Number.parseFloat(t))}),e},i.prototype._parseInnerElements=function(t,e,i){if(e.hasChildNodes)for(var r=e.childNodes,n=this,s=0;s<r.length;s++)!function(s){var a=r[Number.parseInt(s.toString(),10)];if(1===a.nodeType){var o=a,h=a.textContent,c=o.innerHTML;switch(a.nodeName.toLowerCase()){case"popup":if(o&&o.hasAttributes){var _=n._getAnnotationDictionary(i,o);if(_.size>0){var d=n._crossReference._getNextReference();n._crossReference._cacheMap.set(d,_),t.update("Popup",d),_.has("NM")&&n._addReferenceToGroup(d,_)}}break;case"contents":h&&""!==h&&t.update("Contents",n._getFormatedString(h,!0));break;case"contents-richtext":c&&""!==c&&t.update("RC",n._richTextPrefix+c);break;case"defaultstyle":n._addString(t,"DS",h);break;case"defaultappearance":n._addString(t,"DA",h);break;case"vertices":if(h&&""!==h){var p=[];if(h.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){p.push(t)}):p.push(t)}),p.length>0){var l=[];p.forEach(function(t){l.push(Number.parseFloat(t))}),t.update("Vertices",l)}}break;case"appearance":n._addAppearanceData(a,t);break;case"inklist":if(a.hasChildNodes){for(var u=[],f=a.childNodes,g=0;g<f.length;g++)!function(t){var e=f[Number.parseInt(t.toString(),10)];if(e&&1===e.nodeType){var i=e;if("gesture"===i.nodeName.toLowerCase()&&i.textContent&&""!==i.textContent){var r=[];if(i.textContent.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){r.push(t)}):r.push(t)}),r.length>0){var n=[];r.forEach(function(t){n.push(Number.parseFloat(t))}),u.push(n)}}}}(g);t.update("InkList",u)}break;case"data":n._addStreamData(a,t,e)}}}(s)},i.prototype._addStreamData=function(t,e,i){if(t&&t.textContent&&""!==t.textContent){var r=w(t.textContent,!0);if(r&&r.length>0&&e.has("Subtype")){var n=e.get("Subtype");n&&"FileAttachment"===n.name?this._addFileAttachment(e,i,r):n&&"Sound"===n.name&&this._addSound(e,i,r)}}},i.prototype._addSound=function(t,e,i){var r=new Rr(i);if(r.dictionary._crossReference=this._crossReference,r.dictionary.update("Type",vr.get("Sound")),e.hasAttribute("bits")&&this._addInt(r.dictionary,"B",e.getAttribute("bits")),e.hasAttribute("rate")&&this._addInt(r.dictionary,"R",e.getAttribute("rate")),e.hasAttribute("channels")&&this._addInt(r.dictionary,"C",e.getAttribute("channels")),e.hasAttribute("encoding")){var n=e.getAttribute("encoding");n&&""!==n&&r.dictionary.update("E",vr.get(n))}e.hasAttribute("filter")&&r.dictionary.update("Filter",vr.get("FlateDecode"));var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,r),t.update("Sound",s)},i.prototype._addFileAttachment=function(t,e,i){var r=new xr(this._crossReference);if(r.update("Type",vr.get("Filespec")),e.hasAttribute("file")){var n=e.getAttribute("file");this._addString(r,"F",n),this._addString(r,"UF",n)}var s=new Rr(i);s.dictionary._crossReference=this._crossReference;var a=new xr(this._crossReference);if(e.hasAttribute("size")){var o=Number.parseInt(e.getAttribute("size"),10);void 0!==o&&(a.update("Size",o),s.dictionary.update("DL",o))}e.hasAttribute("modification")&&this._addString(a,"ModDate",e.getAttribute("modification")),e.hasAttribute("creation")&&this._addString(a,"CreationDate",e.getAttribute("creation")),s.dictionary.update("Params",a),e.hasAttribute("mimetype")&&this._addString(s.dictionary,"Subtype",e.getAttribute("mimetype")),s.dictionary.update("Filter",vr.get("FlateDecode"));var h=new xr(this._crossReference),c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,s),h.update("F",c),r.update("EF",h);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,r),t.update("FS",_)},i.prototype._addAppearanceData=function(t,e){var i=t.textContent;if(i&&""!==i){var r=(new DOMParser).parseFromString(atob(i),"text/xml");if(r&&r.hasChildNodes){var n=r.childNodes;if(n&&1===n.length){var s=n[0];if(s&&1===s.nodeType){var a=s;if("DICT"===a.nodeName.toUpperCase()&&a.hasAttribute("KEY")){var o=a.getAttribute("KEY");if(o&&"AP"===o&&a.hasChildNodes){var h=new xr(this._crossReference);n=a.childNodes;for(var c=0;c<n.length;c++)this._getAppearance(h,n[Number.parseInt(c.toString(),10)]);h.size>0&&e.update("AP",h)}}}}}}},i.prototype._getAppearance=function(t,e){var i=t instanceof xr?t:t.dictionary;if(e&&1===e.nodeType){var r=e;if(r&&r.localName){var n=void 0,s=void 0,a=void 0;switch(r.localName){case"STREAM":if(n=this._getStream(r)){o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,n),this._addKey(o,i,r)}break;case"DICT":if(s=this._getDictionary(r)){var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,s),this._addKey(o,i,r)}break;case"ARRAY":this._addKey(this._getArray(r),i,r);break;case"FIXED":this._addKey(this._getFixed(r),i,r);break;case"INT":this._addKey(this._getInt(r),i,r);break;case"STRING":this._addKey(this._getString(r),i,r);break;case"NAME":this._addKey(this._getName(r),i,r);break;case"BOOL":this._addKey(this._getBoolean(r),i,r);break;case"DATA":if((a=this._getData(r))&&a.length>0&&t instanceof Rr){t._bytes=a;var h=!1;if(i&&i.has("Subtype")){var c=i.get("Subtype");h=c&&"Image"===c.name}h?t._isCompress=!1:(t.dictionary.has("Length")&&delete t.dictionary._map.Length,t.dictionary.has("Filter")&&delete t.dictionary._map.Filter)}}}}},i.prototype._getStream=function(t){var e=new Rr([]);if(e.dictionary._crossReference=this._crossReference,t.hasChildNodes)for(var i=t.childNodes,r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n&&1===n.nodeType&&this._getAppearance(e,n)}return e},i.prototype._getDictionary=function(t){var e=new xr(this._crossReference);if(t.hasChildNodes)for(var i=t.childNodes,r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n&&1===n.nodeType&&this._getAppearance(e,n)}return e},i.prototype._getArray=function(t){var e=[];if(t.hasChildNodes)for(var i=t.childNodes,r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n&&1===n.nodeType&&this._addArrayElements(e,n)}return e},i.prototype._getData=function(t){var e=[];if(t&&t.textContent&&""!==t.textContent&&t.hasAttribute("MODE")&&t.hasAttribute("ENCODING")){var i=t.getAttribute("MODE"),r=t.getAttribute("ENCODING");if(i&&r){var n=this._getFormatedString(t.textContent,!0);"FILTERED"===i&&"ASCII"===r?e=u(n,!0):"RAW"===i&&"HEX"===r&&(e=w(n,!0))}}return e},i.prototype._addArrayElements=function(t,e){if(e&&1===e.nodeType){var i,r=e,n=void 0,s=void 0,a=void 0,o=void 0,h=void 0,c=void 0;switch(r.localName){case"STREAM":if(n=this._getStream(r)){_=this._crossReference._getNextReference();n.reference=_,this._crossReference._cacheMap.set(_,n),t.push(_)}break;case"DICT":if(s=this._getDictionary(r)){var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,s),t.push(_)}break;case"ARRAY":(a=this._getArray(r))&&t.push(a);break;case"FIXED":void 0===(o=this._getFixed(r))||isNaN(o)||t.push(o);break;case"INT":void 0===(h=this._getInt(r))||isNaN(h)||t.push(h);break;case"NAME":(i=this._getName(r))&&t.push(i);break;case"BOOL":void 0!==(c=this._getBoolean(r))&&null!==c&&t.push(c)}}},i.prototype._getFixed=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Number.parseFloat(t.getAttribute("VAL"))),e},i.prototype._getInt=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Number.parseInt(t.getAttribute("VAL"),10)),e},i.prototype._getString=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=t.getAttribute("VAL")),e},i.prototype._getName=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=vr.get(t.getAttribute("VAL"))),e},i.prototype._getBoolean=function(t){var e;return t&&t.hasAttribute("VAL")&&(e="true"===t.getAttribute("VAL")),e},i.prototype._addMeasureDictionary=function(t,e){var i,r,n,s;if(e.hasChildNodes)for(var a=e.childNodes,o=0;o<a.length;o++)if((y=a[Number.parseInt(o.toString(),10)])&&"measure"===y.localName){i=y;break}var h=new xr(this._crossReference),c=new xr(this._crossReference),_=new xr(this._crossReference),d=new xr(this._crossReference),p=[],l=[],u=[];if(i){if(h.update("Type",vr.get("Measure")),i.hasAttribute("rateValue")){var f=i.getAttribute("rateValue");f&&""!==f&&h.update("R",f)}if(i.hasChildNodes)for(var a=i.childNodes,o=0;o<a.length;o++){var g=a[Number.parseInt(o.toString(),10)];if(g&&1===g.nodeType){var y=g;switch(y.nodeName.toLowerCase()){case"distance":n=y;break;case"area":r=y;break;case"xformat":s=y}}}}if(s&&(this._addElements(s,d),u.push(d)),n&&(this._addElements(n,c),p.push(c)),r&&(this._addElements(r,_),l.push(_)),h.set("A",l),h.set("D",p),h.set("X",u),h.size>0&&h.has("Type")){var m=this._crossReference._getNextReference();this._crossReference._cacheMap.set(m,h),t.update("Measure",m)}},i.prototype._addElements=function(t,e){t.hasAttribute("d")&&this._addFloat(e,"D",t.getAttribute("d")),t.hasAttribute("c")&&this._addFloat(e,"C",t.getAttribute("c")),t.hasAttribute("rt")&&e.update("RT",t.getAttribute("rt")),t.hasAttribute("rd")&&e.update("RD",t.getAttribute("rt")),t.hasAttribute("ss")&&e.update("SS",t.getAttribute("ss")),t.hasAttribute("u")&&e.update("U",t.getAttribute("u")),t.hasAttribute("f")&&e.update("F",vr.get(t.getAttribute("f"))),t.hasAttribute("fd")&&e.update("FD","yes"===t.getAttribute("fd"))},i.prototype._addString=function(t,e,i){i&&""!==i&&t.update(e,i)},i.prototype._addInt=function(t,e,i){var r=Number.parseInt(i,10);void 0!==r&&t.update(e,r)},i.prototype._addFloat=function(t,e,i){var r=Number.parseFloat(i);void 0!==r&&t.update(e,r)},i.prototype._addFloatPoints=function(t,e,i){e&&e.length>0&&t.update(i,e)},i.prototype._addKey=function(t,e,i){void 0!==t&&null!==t&&i.hasAttribute("KEY")&&e.update(i.getAttribute("KEY"),t)},i.prototype._addLineEndStyle=function(t,e){var i="";e.hasAttribute("head")&&(i=e.getAttribute("head"));var r="";if(e.hasAttribute("tail")&&(r=e.getAttribute("tail")),i&&""!==i)if(r&&""!==r){var n=[];n.push(vr.get(i)),n.push(vr.get(r)),t.update("LE",n)}else t.update("LE",vr.get(i));else r&&""!==r&&t.update("LE",vr.get(r))},i}(Ke),Xe=function(){function t(t){this._baseFontEncoding="",this._dictionary=t,this._fontType=this._dictionary.get("Subtype").name}return Object.defineProperty(t.prototype,"differencesDictionary",{get:function(){return this._differencesDictionary||(this._differencesDictionary=this._getDifferencesDictionary()),this._differencesDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseFontEncoding",{get:function(){return this._baseFontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontEncoding",{get:function(){return this._fontEncoding||(this._fontEncoding=this._getFontEncoding()),this._fontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontName",{get:function(){return this._fontName||(this._fontName=this._getFontName()),this._fontName},enumerable:!0,configurable:!0}),t.prototype._getFontEncoding=function(){var t="";if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")){var e=this._dictionary.get("Encoding");if(e instanceof vr)t=e.name;else if(e instanceof xr){if(e.has("BaseEncoding")){var i=e.get("BaseEncoding");i&&i instanceof vr&&(this._baseFontEncoding=i.name)}if(e.has("Type")){var r=e.get("Type");null!==r&&void 0!==r&&(t=r.name)}}}return"identity#2dh"!==t.toString()&&"CMap"!==t||(t="Identity-H"),t},t.prototype._getDifferencesDictionary=function(){var t=new Map;if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")){var e=this._dictionary.get("Encoding");if(null!==e&&void 0!==e&&e instanceof xr&&e.has("Differences")){var i=e.getArray("Differences"),r=0;if(null!==i&&void 0!==i)for(var n=0;n<i.length;n++){var s="",a=i[Number.parseInt(n.toString(),10)];"number"==typeof a?(s=a.toString(),r=Number.parseInt(s,10)):a instanceof vr&&(s=a.name,"Type1"===this._fontType&&".notdef"===s?(s=" ",t.set(r.toString(),gt(s))):(s=ft(s=gt(s)),t.has(r.toString())||t.set(r.toString(),gt(s)),r++))}}}return t},t.prototype._getFontName=function(){var t="";if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("BaseFont")){var e=this._dictionary.get("BaseFont"),i=e.name;if(-1!==i.indexOf("#20")&&-1===i.indexOf("+")){var r=i.lastIndexOf("#20");i=i.substring(0,r),i+="+"}-1!==(t=-1!==e.name.indexOf("+")?e.name.split("+")[1]:e.name).indexOf("-")?t=t.split("-")[0]:-1!==t.indexOf(",")&&(t=t.split(",")[0]),-1!==t.indexOf("MT")&&(t=t.replace("MT","")),-1!==t.indexOf("#20")&&(t=t.replace("#20"," ")),-1!==t.indexOf("#")&&(t=this._decodeHexFontName(t))}return t},t.prototype._decodeHexFontName=function(t){for(var e=t,i=0;i<t.length;i++)if("#"===t[Number.parseInt(i.toString(),10)]){var r=t[i+1]+t[i+2],n=Number.parseInt(r,16);if(0!==n&&(e=e.replace("#"+r,String.fromCharCode(n)),i+=2),-1===e.indexOf("#"))break}return e},t}(),Je=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qe=function(e){function i(t){var i=e.call(this)||this;return i._isImport=!1,null!==t&&void 0!==t&&(i._fileName=t),i}return Je(i,e),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},i.prototype._exportFormFields=function(t){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var e=this._document.form;if(null!==e&&void 0!==e){this._exportEmptyFields=e.exportEmptyFields;for(var i=this._document.form.count,r=0;r<i;r++){var n=this._document.form.fieldAt(r);this._exportFormFieldsData(n)}this._writeFormFieldData()}return this._save()},i.prototype._save=function(){var t=new Uint8Array(this._jsonData);return this._jsonData=[],t},i.prototype._writeFormFieldData=function(){var t=this;this._jsonData.push(this._openingBrace);var e=0;this._table.forEach(function(i,r){r=t._getValidString(r),t._jsonData.push(t._doubleQuotes);for(n=0;n<r.length;n++)t._jsonData.push(r.charCodeAt(n));if("string"==typeof i||Array.isArray(i)&&1===i.length){i=t._getValidString("string"==typeof i?i:i[0]),t._jsonData.push(t._doubleQuotes,t._colon,t._doubleQuotes);for(var n=0;n<i.length;n++)t._jsonData.push(i.charCodeAt(n));t._jsonData.push(t._doubleQuotes)}else{t._jsonData.push(t._doubleQuotes,t._colon,t._openingBracket);for(var s=0;s<i.length;s++){t._jsonData.push(t._doubleQuotes);for(var a=i[Number.parseInt(s.toString(),10)],o=0;o<a.length;o++)t._jsonData.push(a.charCodeAt(o));t._jsonData.push(t._doubleQuotes),s<i.length-1&&t._jsonData.push(t._comma)}t._jsonData.push(t._closingBracket)}e<t._table.size-1&&t._jsonData.push(t._comma),e++}),this._jsonData.push(this._closingBrace)},i.prototype._exportAnnotationData=function(t,e){var i=this,r=!1;this._jsonData.push(this._openingBrace,this._doubleQuotes,112,100,102,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBrace);for(var n=0;n<e;n++){var s=t.getPage(n);s&&s.annotations.count>0&&(this._jsonData.push(0!==n&&r?this._comma:this._space,this._doubleQuotes),f(n.toString(),[]).forEach(function(t){i._jsonData.push(t)}),this._jsonData.push(this._doubleQuotes,this._colon,this._openingBrace,this._doubleQuotes,115,104,97,112,101,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBracket),r=!0);for(var a=0,o=0;o<s.annotations.count;o++){var h=s.annotations.at(o);h&&(0!==a&&this._jsonData.push(this._comma),a++,this._exportAnnotation(h,n),this._jsonData=f(this._convertToJson(this._table),this._jsonData),this._table.clear())}s&&s.annotations.count>0&&this._jsonData.push(this._closingBracket,this._closingBrace)}this._jsonData.push(this._closingBrace,this._closingBrace)},i.prototype._exportAnnotation=function(t,e){var i=!1,r=t._dictionary,n=this._getAnnotationType(t._dictionary);if(this._skipBorderStyle=!1,n&&""!==n){this._table.set("type",n),this._table.set("page",e.toString());var s=void 0;switch(n){case"Line":s=t.linePoints,this._table.set("start",s[0].toString()+","+s[1].toString()),this._table.set("end",s[2].toString()+","+s[3].toString());break;case"Stamp":case"Square":i=!0}if(r&&r.has("BE")&&r.has("BS")){var a=r.get("BE");a&&a.has("S")&&(this._skipBorderStyle=!0)}this._writeDictionary(r,e,i)}},i.prototype._writeDictionary=function(t,e,i){var r=this,n=!1;if(t.has("Type")){var s=t.get("Type");n=s&&"Border"===s.name&&this._skipBorderStyle}if(t.forEach(function(s,a){if((i||"AP"!==s)&&"P"!==s&&"Parent"!==s){var o=void 0;if(a instanceof wr&&(o=t.get(s)),o&&o instanceof xr)switch(s){case"BS":case"BE":r._writeDictionary(o,e,!1);break;case"IRT":o.has("NM")&&r._table.set("inreplyto",r._getValue(o.get("NM"),!0))}else a instanceof xr?r._writeDictionary(a,e,!1):(!n||n&&"S"!==s)&&r._writeAttribute(s,a,t)}}),t.has("Measure")&&this._exportMeasureDictionary(t.get("Measure")),(this.exportAppearance||i)&&t.has("AP")){var a=this._getAppearanceString(t.get("AP"));a&&a.length>0&&this._table.set("appearance",x(a))}if(t.has("Sound")){var o=t.get("Sound");if(o&&o.dictionary){var h=o.dictionary;h.has("B")&&this._table.set("bits",this._getValue(h.get("B"),!0)),h.has("C")&&this._table.set("channels",this._getValue(h.get("C"),!0)),h.has("E")&&this._table.set("encoding",this._getValue(h.get("E"),!0)),h.has("R")&&this._table.set("rate",this._getValue(h.get("R"),!0)),h.has("Length")&&h.get("Length")>0&&(y=S(o.getBytes()))&&""!==y&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),h.has("Length")&&this._table.set("length",this._getValue(h.get("Length"),!0)),h.has("Filter")&&this._table.set("filter",this._getValue(h.get("Filter"),!0)),this._table.set("data",y))}}else if(t.has("FS")){var c=t.get("FS");if(c&&(c.has("F")&&this._table.set("file",this._getValue(c.get("F"),!0)),c.has("EF"))){var _=c.get("EF");if(_&&_.has("F")){var d=_.get("F");if(d&&d.dictionary){var p=d.dictionary;if(p.has("Params")){var l=p.get("Params");if(l){if(l.has("CreationDate")){f=this._getValue(l.get("CreationDate"),!0);this._table.set("creation",f)}if(l.has("ModificationDate")){var f=this._getValue(l.get("ModificationDate"),!0);this._table.set("modification",f)}if(l.has("Size")&&this._table.set("size",this._getValue(l.get("Size"),!0)),l.has("CheckSum")){var g=S(u(f=this._getValue(l.get("CheckSum"),!0)));this._table.set("checksum",g)}}}var y=S(d.getBytes());y&&""!==y&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),p.has("Length")&&this._table.set("length",this._getValue(p.get("Length"),!0)),p.has("Filter")&&this._table.set("filter",this._getValue(p.get("Filter"),!0)),this._table.set("data",y))}}}}},i.prototype._writeColor=function(t,e,i){var r=this._getColor(t);if("number"==typeof t&&i){var n=this._getValue(t,!0);n&&""!==n&&this._table.set(i,n)}r&&""!==r&&this._table.set(e,r)},i.prototype._writeAttributeString=function(t,e,i){void 0===i&&(i=!1);var r=this._getValue(e,!0);this._table.set(t,i?r.toLowerCase():r)},i.prototype._writeAttribute=function(t,e,i){var r;switch(t){case"C":this._writeColor(e,"color","c");break;case"IC":this._writeColor(e,"interior-color");break;case"DA":(r=i.get("DA"))&&this._table.set("defaultappearance",r);break;case"M":this._writeAttributeString("date",e);break;case"NM":this._table.set("name",e);break;case"Name":this._writeAttributeString("icon",e);break;case"Subj":this._writeAttributeString("subject",e);break;case"T":this._writeAttributeString("title",e);break;case"Rect":if(r=this._getValue(e,!0)){var n=r.split(","),s=new Map;s.set("x",n[0]),s.set("y",n[1]),s.set("width",n[2]),s.set("height",n[3]),this._table.set(t.toLowerCase(),this._convertToJson(s))}break;case"CreationDate":this._writeAttributeString("creationdate",e);break;case"Rotate":this._writeAttributeString("rotation",e);break;case"W":this._writeAttributeString("width",e);break;case"LE":e&&Array.isArray(e)?2===e.length&&(this._table.set("head",this._getValue(e[0],!0)),this._table.set("tail",this._getValue(e[1],!0))):e instanceof vr&&this._writeAttributeString("head",e);break;case"S":switch(this._getValue(e,!0)){case"D":this._table.set("style","dash");break;case"C":this._table.set("style","cloudy");break;case"S":this._table.set("style","solid");break;case"B":this._table.set("style","bevelled");break;case"I":this._table.set("style","inset");break;case"U":this._table.set("style","underline")}break;case"D":this._writeAttributeString("dashes",e);break;case"I":this._writeAttributeString("intensity",e);break;case"RD":this._writeAttributeString("fringe",e);break;case"IT":this._writeAttributeString("IT",e);break;case"RT":this._writeAttributeString("replyType",e,!0);break;case"LL":this._writeAttributeString("leaderLength",e);break;case"LLE":this._writeAttributeString("leaderExtend",e);break;case"Cap":this._writeAttributeString("caption",e);break;case"CP":this._writeAttributeString("caption-style",e);break;case"CL":this._writeAttributeString("callout",e);break;case"QuadPoints":this._writeAttributeString("coords",e);break;case"CA":this._writeAttributeString("opacity",e);break;case"F":if("number"==typeof e){var a=d(e);this._table.set("flags",a)}break;case"Contents":(r=i.get("Contents"))&&r.length>0&&this._table.set("contents",this._getValidString(r));break;case"InkList":this._writeInkList(i);break;case"Vertices":this._writeVertices(i);break;case"DS":if(r=i.get("DS")){for(var o=new Map,h=r.split(";"),c=0;c<h.length;c++){var _=h[Number.parseInt(c.toString(),10)].split(":");_&&_.length>0&&_[0]&&_[0].length>1&&_[0].startsWith(" ")&&(_[0]=_[0].substring(1)),o.set(_[0],_[1])}this._table.set("defaultStyle",this._convertToJson(o))}break;case"AllowedInteractions":-1!==e.indexOf('"')&&(e=e.replace(/"/g,'\\"')),this._table.set(t,e);break;case"Type":case"Subtype":case"P":case"Parent":case"L":case"RC":case"FS":case"MeasurementTypes":case"GroupNesting":case"ITEx":case"TextMarkupContent":break;case"Border":case"A":case"R":case"X":case"ca":this._writeAttributeString(t.toLowerCase(),e);break;default:"string"==typeof e&&e.startsWith("{")&&e.endsWith("}")?this._table.set(t,e):this._writeAttributeString(t,e)}},i.prototype._writeVertices=function(t){var e=t.getArray("Vertices");if(e&&e.length>0){var i=e.length;if(i%2==0){for(var r="",n=0;n<i-1;n++)r+=this._getValue(e[Number.parseInt(n.toString(),10)],!0)+(n%2!=0?";":",");(r+=this._getValue(e[i-1],!0))&&""!==r&&this._table.set("vertices",r)}}},i.prototype._writeInkList=function(t){var e=t.getArray("InkList");if(e&&e.length>0){for(var i=new Map,r="[",n=0;n<e.length;n++)r+="["+this._getValue(e[Number.parseInt(n.toString(),10)],!0)+"]",n<e.length-1&&(r+=",");r+="]",i.set("gesture",r),this._table.set("inklist",this._convertToJson(i))}},i.prototype._exportMeasureDictionary=function(t){if(t){if(t.has("Type")&&this._table.set("type1","Measure"),t.has("R")&&this._table.set("ratevalue",this._getValue(t.get("R"),!0)),t.has("SubType")&&this._table.set("SubType",this._getValue(t.get("SubType"),!0)),t.has("TargetUnitConversion")&&this._table.set("TargetUnitConversion",this._getValue(t.get("TargetUnitConversion"),!0)),t.has("A")){e=t.getArray("A");this._exportMeasureFormatDetails("area",e[0])}if(t.has("D")){e=t.getArray("D");this._exportMeasureFormatDetails("distance",e[0])}if(t.has("X")){e=t.getArray("X");this._exportMeasureFormatDetails("xformat",e[0])}if(t.has("T")){e=t.getArray("T");this._exportMeasureFormatDetails("tformat",e[0])}if(t.has("V")){var e=t.getArray("V");this._exportMeasureFormatDetails("vformat",e[0])}}},i.prototype._exportMeasureFormatDetails=function(t,e){var i=new Map;e.has("C")&&i.set("c",this._getValue(e.get("C"),!0)),e.has("F")&&i.set("f",this._getValue(e.get("F"),!0)),e.has("D")&&i.set("d",this._getValue(e.get("D"),!0)),e.has("RD")&&i.set("rd",this._getValue(e.get("RD"),!0)),e.has("U")&&i.set("u",this._getValue(e.get("U"),!0)),e.has("RT")&&i.set("rt",this._getValue(e.get("RT"),!0)),e.has("SS")&&i.set("ss",this._getValue(e.get("SS"),!0)),e.has("FD")&&i.set("fd",this._getValue(e.get("FD"),!0)),this._table.set(t,this._convertToJson(i))},i.prototype._getAppearanceString=function(t){var e=new Map,i=new Map;return this._writeAppearanceDictionary(i,t),e.set("ap",this._convertToJson(i)),u(this._convertToJson(e))},i.prototype._writeAppearanceDictionary=function(t,e){var i=this;e&&e.size>0&&e.forEach(function(r,n){i._writeObject(t,n instanceof wr?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r,n){if(e instanceof vr)this._writeTable("name",e.name,t,r,n);else if(Array.isArray(e)){var s=[];this._writeArray(s,e,i),this._writeTable("array",this._convertToJsonArray(s),t,r,n)}else if("string"==typeof e)this._writeTable("string",e,t,r,n);else if("number"==typeof e)this._writeTable(Number.isInteger(e)?"int":"fixed",e.toString(),t,r,n);else if("boolean"==typeof e)this._writeTable("boolean",e?"true":"false",t,r,n);else if(e instanceof xr){var a=new Map;this._writeAppearanceDictionary(a,e),this._writeTable("dict",this._convertToJson(a),t,r,n)}else if(e instanceof Nr&&e.dictionary){var o=new Map,h=new Map,c=e.dictionary,_=void 0,d=e,p=!1;if(c.has("Subtype")&&"Image"===c.get("Subtype").name&&(p=!0),p&&d.stream&&d.stream instanceof Cr){var l=d.stream;_=d.getString(!0,l.getByteRange(l.start,l.end))}else _=e.getString(!0);!c.has("Length")&&_&&""!==_&&c.update("Length",e.length),this._writeAppearanceDictionary(h,c);var u=void 0;c.has("Subtype")&&(u=this._getValue(c.get("Subtype"))),!c.has("Type")&&!c.has("Subtype")||c.has("Subtype")&&("Image"===u||"Form"===u||"CIDFontType0C"===u||"OpenType"===u)?(o.set("mode","raw"),o.set("encoding","hex")):(o.set("mode","filtered"),o.set("encoding","ascii")),_&&""!==_&&o.set("bytes",_),h.set("data",this._convertToJson(o)),this._writeTable("stream",this._convertToJson(h),t,r,n)}else e instanceof wr&&this._crossReference?this._writeObject(t,this._crossReference._fetch(e),i,r,n):null!==e&&void 0!==e||this._writeTable("null","null",t,r,n)},i.prototype._writeTable=function(t,e,i,r,n){var s=new Map;s.set(t,e),r?i.set(r,this._convertToJson(s)):n&&n.push(s)},i.prototype._writeArray=function(t,e,i){for(var r=0;r<e.length;r++)this._writeObject(null,e[Number.parseInt(r.toString(),10)],i,null,t)},i.prototype._convertToJson=function(t){var e=0,i="{";return t.forEach(function(r,n){r.startsWith("{")||r.startsWith("[")?i+="AllowedInteractions"===n?'"'+n+'":"'+r+'"':'"'+n+'":'+r:(r.startsWith(" ")&&r.length>1&&("["===r[1]||"{"===r[1])&&(r=r.substring(1)),i+='"'+n+'":"'+r+'"'),e<t.size-1&&(i+=","),e++}),i+"}"},i.prototype._convertToJsonArray=function(t){for(var e="[",i=0;i<t.length;i++)e+=this._convertToJson(t[Number.parseInt(i.toString(),10)]),i<t.length-1&&(e+=",");return e+"]"},i.prototype._parseJson=function(t,e){this._document=t,this._crossReference=t._crossReference;var i=b(e);if(i.startsWith("{")&&!i.endsWith("}"))for(;i.length>0&&!i.endsWith("}");)i=i.substring(0,i.length-1);return JSON.parse(i)},i.prototype._importFormData=function(t,e){var i=this,r=this._parseJson(t,e);if(r){var n=Object.keys(r);if(n&&n.length>0){for(var s=this,a=0;a<n.length;a++)!function(t){var e=n[Number.parseInt(t.toString(),10)],a=r[e];Array.isArray(a)?s._fields.has("key")?a.forEach(function(t){i._fields.get(e).push(t)}):s._fields.set(e,a):s._fields.has("key")?s._fields.get(e).push(a):s._fields.set(e,[a])}(a);this._importField()}}},i.prototype._importAnnotations=function(t,e){var i=this,r=this._parseJson(t,e);if(r&&-1!==Object.keys(r).indexOf("pdfAnnotation")){var n=r.pdfAnnotation,s=t.pageCount,a=Object.keys(n);if(a&&a.length>0&&a.forEach(function(e){var r=Number.parseInt(e,10);if(void 0!==r&&r<s){var a=t.getPage(r),o=n[e];if(o){var h=Object.keys(o);if(h&&h.length>0&&-1!==h.indexOf("shapeAnnotation")){var c=o.shapeAnnotation;c&&c.length>0&&c.forEach(function(t){var e=Object.keys(t);if(e&&e.length>0&&-1!==e.indexOf("type")){var r=new xr(i._crossReference);r.update("Type",vr.get("Annot"));var n=!0;switch(t.type.toLowerCase()){case"line":r.update("Subtype",vr.get("Line"));break;case"circle":r.update("Subtype",vr.get("Circle"));break;case"square":r.update("Subtype",vr.get("Square"));break;case"polyline":r.update("Subtype",vr.get("PolyLine"));break;case"polygon":r.update("Subtype",vr.get("Polygon"));break;case"ink":r.update("Subtype",vr.get("Ink"));break;case"popup":r.update("Subtype",vr.get("Popup"));break;case"text":r.update("Subtype",vr.get("Text"));break;case"freetext":r.update("Subtype",vr.get("FreeText"));break;case"stamp":r.update("Subtype",vr.get("Stamp"));break;case"highlight":r.update("Subtype",vr.get("Highlight"));break;case"squiggly":r.update("Subtype",vr.get("Squiggly"));break;case"underline":r.update("Subtype",vr.get("Underline"));break;case"strikeout":r.update("Subtype",vr.get("StrikeOut"));break;case"fileattachment":r.update("Subtype",vr.get("FileAttachment"));break;case"sound":r.update("Subtype",vr.get("Sound"));break;case"redact":r.update("Subtype",vr.get("Redact"));break;case"caret":r.update("Subtype",vr.get("Caret"));break;default:n=!1}if(n){i._addAnnotationData(r,t,e);var s=a._pageDictionary;if(s){var o=a.annotations,h=o._parseAnnotation(r);if(h){h._isImported=!0;var c=i._crossReference._getNextReference();i._crossReference._cacheMap.set(c,r),(r.has("NM")||r.has("IRT"))&&i._addReferenceToGroup(c,r),h._ref=c;var _=o._annotations.length;o._annotations.push(c),s.set("Annots",o._annotations),s._updated=!0,o._parsedAnnotations.set(_,h),i._handlePopup(o,c,r,s)}}}}})}}}}),this._groupHolders.length>0)for(var o=0;o<this._groupHolders.length;o++){var h=this._groupHolders[Number.parseInt(o.toString(),10)],c=h.get("IRT");c&&""!==c&&(this._groupReferences.has(c)?h.update("IRT",this._groupReferences.get(c)):delete h._map.IRT)}this._groupHolders=[],this._groupReferences=new Map}},i.prototype._addAnnotationData=function(e,i,r){var n,s,a,o,h=this,c=new xr(this._crossReference),_=new xr(this._crossReference),d=new Map,l=[],u="";if(r.forEach(function(r){var f=i[r];switch(r.toLowerCase()){case"start":case"end":h._addLinePoints(f,l),4===l.length&&(e.update("L",l),l=[]);break;case"itex":break;case"state":h._addString(e,"State",f);break;case"statemodel":h._addString(e,"StateModel",f);break;case"replytype":"group"===f.toLowerCase()&&e.update("RT",vr.get("Group"));break;case"inreplyto":h._addString(e,"IRT",f);break;case"dashes":case"width":case"intensity":case"style":h._addBorderStyle(r,f,c,_);break;case"rect":if(a=f){var g=[];g.push(Number.parseFloat(a.x)),g.push(Number.parseFloat(a.y)),g.push(Number.parseFloat(a.width)),g.push(Number.parseFloat(a.height)),g&&4===g.length&&e.update("Rect",g)}break;case"color":(f=B(f))&&3===f.length&&e.update("C",[f[0]/255,f[1]/255,f[2]/255]);break;case"oc":if(f&&"Redact"===e.get("Subtype").name){var y=[];(o=f.split(",")).forEach(function(t){y.push(Number.parseFloat(t))}),y&&y.length>0&&e.update("OC",y)}break;case"interior-color":(f=B(f))&&3===f.length&&e.update("IC",[f[0]/255,f[1]/255,f[2]/255]);break;case"date":h._addString(e,"M",f);break;case"creationdate":h._addString(e,"CreationDate",f);break;case"name":h._addString(e,"NM",f);break;case"icon":f&&e.update("Name",vr.get(f));break;case"subject":h._addString(e,"Subj",f);break;case"title":h._addString(e,"T",f);break;case"rotation":e.update("Rotate",Number.parseFloat(f));break;case"fringe":h._addFloatPoints(e,"RD",h._parseFloatPoints(f));break;case"it":f&&e.update("IT",vr.get(f));break;case"leaderlength":e.update("LL",Number.parseFloat(f));break;case"leaderextend":e.update("LLE",Number.parseFloat(f));break;case"caption":h._addBoolean(e,"Cap",f.toLowerCase());break;case"caption-style":f&&e.update("CP",vr.get(f));break;case"callout":h._addFloatPoints(e,"CL",h._parseFloatPoints(f));break;case"coords":h._addFloatPoints(e,"QuadPoints",h._parseFloatPoints(f));break;case"border":h._addFloatPoints(e,"Border",h._parseFloatPoints(f));break;case"opacity":e.update("CA",Number.parseFloat(f));break;case"defaultstyle":if(f){var m=Object.keys(f);if(m&&m.length>0){var b="",v=0;m.forEach(function(t){var e=f[t];b+=t+":"+e,v<m.length-1&&(b+=";"),v++}),h._addString(e,"DS",b)}}break;case"defaultappearance":h._addString(e,"DA",f);break;case"flags":if(f&&"string"==typeof f){for(var S=t.PdfAnnotationFlag.default,w=f.split(","),P=0;P<w.length;P++){var A=p(w[Number.parseInt(P.toString(),10)]);0===P?S=A:S|=A}e.update("F",S)}break;case"open":h._addBoolean(e,"Open",f.toLowerCase());break;case"repeat":h._addBoolean(e,"Repeat",f.toLowerCase());break;case"overlaytext":h._addString(e,"OverlayText",f);break;case"contents":"string"==typeof f&&(-1!==f.indexOf("\\r")&&(f=f.replace("\\r","\r")),f&&h._addString(e,"Contents",f));break;case"q":e.update("Q",Number.parseInt(f,10));break;case"inklist":if(f){var k=Object.keys(f);if(k&&k.length>0&&-1!==k.indexOf("gesture")){var x=f.gesture;x&&x.length>0&&e.update("InkList",x)}}break;case"head":n=f;break;case"tail":s=f;break;case"creation":case"modification":case"file":case"bits":case"channels":case"encoding":case"rate":case"length":case"filter":case"mode":case"size":d.set(r,f);break;case"data":u=f;break;case"vertices":if(f&&"string"==typeof f){var T=f.split(/[,;]/);if(T&&T.length>0){for(var I=[],P=0;P<T.length;P++)I.push(Number.parseFloat(T[Number.parseInt(P.toString(),10)]));I.length>0&&I.length%2==0&&e.update("Vertices",I)}}break;case"appearance":h._addAppearanceData(e,f);break;case"allowedinteractions":h._addString(e,"AllowedInteractions",f);break;default:h._document._allowImportCustomData&&"type"!==r&&"page"!==r&&h._addString(e,r,"string"==typeof f?f:JSON.stringify(f))}}),this._addMeasureDictionary(e,i,r),n?s?e.update("LE",[vr.get(n),vr.get(s)]):e.update("LE",n):s&&e.update("LE",s),_.size>0){_.update("Type",vr.get("Border"));f=this._crossReference._getNextReference();_.objId=f.objectNumber+" "+f.generationNumber,this._crossReference._cacheMap.set(f,_),e.update("BS",f)}if(c.size>0){var f=this._crossReference._getNextReference();_.objId=f.objectNumber+" "+f.generationNumber,this._crossReference._cacheMap.set(f,c),e.update("BE",f)}this._addStreamData(e,d,u)},i.prototype._addLinePoints=function(t,e){t&&-1!==t.indexOf(",")&&t.split(",").forEach(function(t){e.push(Number.parseFloat(t))})},i.prototype._addString=function(t,e,i){i&&t.update(e,i)},i.prototype._addBoolean=function(t,e,i){i&&t.update(e,"yes"===i||"true"===i)},i.prototype._addBorderStyle=function(t,e,i,r){var n="",s=!0;switch(e){case"dash":n="D";break;case"solid":n="S";break;case"bevelled":n="B";break;case"inset":n="I";break;case"underline":n="U";break;case"cloudy":n="C",s=!1}switch(t.toLowerCase()){case"width":r.update("W",Number.parseFloat(e));break;case"intensity":i.update("I",Number.parseFloat(e));break;case"dashes":e&&-1!==e.indexOf(",")&&r.update("D",this._parseFloatPoints(e))}n&&(s?r.update("S",vr.get(n)):i.update("S",vr.get(n)))},i.prototype._parseFloatPoints=function(t){var e=[];return t.split(",").forEach(function(t){e.push(Number.parseFloat(t))}),e},i.prototype._addFloatPoints=function(t,e,i){i&&i.length>0&&t.update(e,i)},i.prototype._addMeasureDictionary=function(t,e,i){var r=new xr(this._crossReference),n=[],s=[],a=[],o=[],h=[];if(r.set("A",n),r.set("D",s),r.set("X",a),r.set("T",o),r.set("V",h),-1!==i.indexOf("ratevalue")&&this._addString(r,"R",e.ratevalue),-1!==i.indexOf("subtype")&&this._addString(r,"Subtype",e.subtype),-1!==i.indexOf("targetunitconversion")&&this._addString(r,"TargetUnitConversion",e.targetunitconversion),-1!==i.indexOf("area")&&n.push(this._readDictionaryElements(e.area)),-1!==i.indexOf("distance")&&s.push(this._readDictionaryElements(e.distance)),-1!==i.indexOf("xformat")&&a.push(this._readDictionaryElements(e.xformat)),-1!==i.indexOf("tformat")&&o.push(this._readDictionaryElements(e.tformat)),-1!==i.indexOf("vformat")&&h.push(this._readDictionaryElements(e.vformat)),-1!==i.indexOf("type1")){r.set("Type",vr.get("Measure"));var c=this._crossReference._getNextReference();r.objId=c.objectNumber+" "+c.generationNumber,this._crossReference._cacheMap.set(c,r),t.update("Measure",c)}},i.prototype._readDictionaryElements=function(t){var e=Object.keys(t),i=new xr(this._crossReference);return e&&e.length>0&&e.forEach(function(e){var r=t[e];if(e&&r)switch(e){case"d":i.set("D",Number.parseFloat(r));break;case"c":i.set("C",Number.parseFloat(r));break;case"rt":i.set("RT",r);break;case"rd":i.set("RD",r);break;case"ss":i.set("SS",r);break;case"u":i.set("U",r);break;case"f":i.set("F",vr.get(r));break;case"fd":i.set("FD",r);break;case"type":i.set("Type",vr.get(r))}}),i},i.prototype._addStreamData=function(t,e,i){var r=this,n=t.get("Subtype").name,s=w(i,!0);if("Sound"===n){var a=new Rr(s);a.dictionary._crossReference=this._crossReference,a.dictionary.update("Type",vr.get("Sound")),e.forEach(function(t,e){if(e&&t)switch(e){case"bits":case"rate":case"channels":a.dictionary.set(e,Number.parseInt(t,10));break;case"encoding":a.dictionary.set("E",vr.get(t));break;case"filter":a.dictionary.set("Filter",vr.get("FlateDecode"))}}),a.reference=this._crossReference._getNextReference(),a.dictionary.objId=a.reference.objectNumber+" "+a.reference.generationNumber,this._crossReference._cacheMap.set(a.reference,a),t.update("Sound",a.reference)}else if("FileAttachment"===n){var o=new xr(this._crossReference);o.update("Type",vr.get("Filespec"));var h=new Rr(s);h.dictionary._crossReference=this._crossReference;var c=new xr(this._crossReference);e.forEach(function(t,e){if(e&&t){var i=void 0;switch(e){case"file":r._addString(o,"F",t),r._addString(o,"UF",t);break;case"size":void 0!==(i=Number.parseInt(t,10))&&(c.update("Size",i),h.dictionary.update("DL",i));break;case"creation":r._addString(c,"CreationDate",t);break;case"modification":r._addString(c,"ModificationDate",t)}}}),h.dictionary.update("Params",c),h.dictionary.update("Filter",vr.get("FlateDecode")),h.reference=this._crossReference._getNextReference(),h.dictionary.objId=h.reference.objectNumber+" "+h.reference.generationNumber,this._crossReference._cacheMap.set(h.reference,h);var _=new xr(this._crossReference);_.update("F",h.reference),o.update("EF",_);var d=this._crossReference._getNextReference();o.objId=d.objectNumber+" "+d.generationNumber,this._crossReference._cacheMap.set(d,o),t.update("FS",d)}},i.prototype._addAppearanceData=function(t,e){if(e){var i=b(k(e,!1));if(i.startsWith("{")&&!i.endsWith("}"))for(;i.length>0&&!i.endsWith("}");)i=i.substring(0,i.length-1);var r=JSON.parse(i);if(r){var n=Object.keys(r);n&&n.length>0&&-1!==n.indexOf("ap")&&t.update("AP",this._parseDictionary(r.ap))}}},i.prototype._parseAppearance=function(t){var e,i=this,r=Object.keys(t);if(-1!==r.indexOf("name"))e=vr.get(t.name);else if(-1!==r.indexOf("int"))e=Number.parseInt(t.int,10);else if(-1!==r.indexOf("fixed"))e=Number.parseFloat(t.fixed);else if(-1!==r.indexOf("string"))e=t.string;else if(-1!==r.indexOf("boolean"))e="true"===t.boolean;else if(-1!==r.indexOf("array")){var n=t.array;e=[],n.forEach(function(t){e.push(i._parseAppearance(t))})}else if(-1!==r.indexOf("dict")){var s=this._parseDictionary(t.dict);e=this._crossReference._getNextReference(),s.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,s)}else if(-1!==r.indexOf("stream")){var a=this._parseStream(t.stream);e=this._crossReference._getNextReference(),a.reference=e,a.dictionary.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,a)}else e=null;return e},i.prototype._parseDictionary=function(t){var e=this,i=new xr(this._crossReference);if(t){var r=Object.keys(t);r&&r.length>0&&r.forEach(function(r){var n=t[r];if("data"!==r){var s=e._parseAppearance(n);i.update(r,s)}})}return i},i.prototype._parseStream=function(t){var e,i=Object.keys(t);if(t&&i.indexOf("data")){var r=t.data,n=void 0;if(r){var s=Object.keys(r);if(s&&-1!==s.indexOf("bytes")){var a=r.bytes;a&&(n=w(a,!0))}}n||(n=[]);var o=new Rr(n);this._crossReference?this._parseStreamElements(o,t):o._pendingResources=JSON.stringify(t),e=o}return e},i.prototype._parseStreamElements=function(t,e){if(void 0===e&&t._pendingResources&&(e=JSON.parse(t._pendingResources)),e){var i=this._parseDictionary(e),r=!1;if(i&&i.has("Subtype")){var n=i.get("Subtype");r=n&&"Image"===n.name}r?t._isCompress=!1:(i.has("Length")&&delete i._map.Length,i.has("Filter")&&delete i._map.Filter),t.dictionary=i}},i.prototype._getValidString=function(t){return-1!==t.indexOf("\\")&&(t=t.replace(/\\/g,"\\\\")),-1!==t.indexOf('"')&&(t=t.replace(/"/g,'\\"')),-1!==t.indexOf("[")&&(t=t.replace(/\[/g,"\\[")),-1!==t.indexOf("]")&&(t=t.replace(/\[/g,"\\]")),-1!==t.indexOf("{")&&(t=t.replace(/\[/g,"\\{")),-1!==t.indexOf("}")&&(t=t.replace(/\}/g,"\\}")),-1!==t.indexOf("\n")&&(t=t.replace(/\n/g,"\\n")),-1!==t.indexOf("\r")&&(t=t.replace(/\r/g,"\\r")),t},i}(Ke),Ye=function(){function t(t,e){if(this._isExported=!1,this._crossReference=e,t instanceof Nr){this._content=t,this._content.dictionary.has("Type")&&this._content.dictionary.has("Subtype")||this._initialize();var i=this._content.dictionary.getArray("BBox");if(i&&i.length>3){var r=C(i);this._size=[r.width,r.height]}this._isReadOnly=!0}else void 0!==t?(this._size=[t[2],t[3]],this._content=new Rr([]),this._content.dictionary._crossReference=this._crossReference,this._initialize(),this._content.dictionary.set("BBox",[t[0],t[1],t[0]+t[2],t[1]+t[3]])):this._isReadOnly=!0;this._writeTransformation=!0}return Object.defineProperty(t.prototype,"graphics",{get:function(){return this._isReadOnly?null:(void 0===this._g&&(this._g=new Be(this._size,this._content,this._crossReference,this),this._writeTransformation&&this._g._initializeCoordinates(),this._g._isTemplateGraphics=!0),this._g)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this._content.dictionary.set("Type",vr.get("XObject")),this._content.dictionary.set("Subtype",vr.get("Form"))},t.prototype._exportStream=function(t,e){var i=new Qe;i._crossReference=e,i._isAnnotationExport=!0;var r=new Map;i._writeObject(r,t.get("N"),t,"normal"),this._appearance=i._convertToJson(r),i._dispose()},t.prototype._importStream=function(t){var e=new Qe;t&&(e._crossReference=this._crossReference);var i=JSON.parse(this._appearance);if(i){var r=i.normal;r&&(this._content=e._parseStream(r.stream),t&&(this._content.dictionary._crossReference=this._crossReference,this._content.dictionary._updated=!0))}e._dispose()},t.prototype._updatePendingResource=function(t){if(this._content._pendingResources&&""!==this._content._pendingResources){var e=new Qe;e._crossReference=t,e._parseStreamElements(this._content),this._content._pendingResources="",e._dispose()}},t}(),Ze=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),$e=function(t){function e(e){var i=t.call(this)||this;return e instanceof $i?(i._destination=e,i._page=e.page):(i._page=e,i._destination=new $i(e,[0,0])),i._dictionary=new xr,i._dictionary.update("Type",new vr("Action")),i._dictionary.update("S",new vr("GoTo")),i}return Ze(e,t),Object.defineProperty(e.prototype,"destination",{get:function(){return this._destination},set:function(t){this._destination=t},enumerable:!0,configurable:!0}),e}(function(){function t(){}return Object.defineProperty(t.prototype,"next",{get:function(){return this._next},set:function(t){this._next=t;var e=this._page._crossReference._getNextReference();this._page._crossReference._cacheMap.set(e,t._dictionary),t._dictionary.objId=e.toString(),this._dictionary.update("Next",e)},enumerable:!0,configurable:!0}),t}()),ti=function(){function e(t){this._field=t}return Object.defineProperty(e.prototype,"mouseEnter",{get:function(){return this._mouseEnter||(this._mouseEnter=this._getPdfAction("E")),this._mouseEnter},set:function(t){t&&(this._mouseEnter=t,this._updateAction(this._mouseEnter,"E"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseLeave",{get:function(){return this._mouseLeave||(this._mouseLeave=this._getPdfAction("X")),this._mouseLeave},set:function(t){t&&(this._mouseLeave=t,this._updateAction(this._mouseLeave,"X"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseUp",{get:function(){return this._mouseUp||(this._mouseUp=this._getPdfAction("U")),this._mouseUp},set:function(t){t&&(this._mouseUp=t,this._updateAction(this._mouseUp,"U"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseDown",{get:function(){return this._mouseDown||(this._mouseDown=this._getPdfAction("D")),this._mouseDown},set:function(t){t&&(this._mouseDown=t,this._updateAction(this._mouseDown,"D"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gotFocus",{get:function(){return this._gotFocus||(this._gotFocus=this._getPdfAction("Fo")),this._gotFocus},set:function(t){t&&(this._gotFocus=t,this._updateAction(this._gotFocus,"Fo"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lostFocus",{get:function(){return this._lostFocus||(this._lostFocus=this._getPdfAction("Bl")),this._lostFocus},set:function(t){t&&(this._lostFocus=t,this._updateAction(this._lostFocus,"Bl"))},enumerable:!0,configurable:!0}),e.prototype._updateAction=function(e,i){var r;if(this._field._kidsCount>0&&(r=this._field.itemAt(0))&&r._dictionary&&e instanceof $e){var n=new xr,s=e._page,a=e.destination;a._destinationMode===t.PdfDestinationMode.location?e._dictionary.update("D",[s._ref,new vr("XYZ"),a.location[0],s.size[1],a.zoom]):a._destinationMode===t.PdfDestinationMode.fitR?e._dictionary.update("D",[s._ref,new vr("FitR"),0,0,0,0]):a._destinationMode===t.PdfDestinationMode.fitH?e._dictionary.update("D",[s._ref,new vr("FitH"),s.size[1]]):a._destinationMode===t.PdfDestinationMode.fitToPage&&e._dictionary.update("D",[s._ref,new vr("Fit")]),n.set(i,e._dictionary),n._updated=!0,r._dictionary.update("AA",n)}},e.prototype._getPdfAction=function(t){var e,i=this._field.itemAt(0);if(i&&i._dictionary&&i._dictionary.has("AA")){var r=i._dictionary.get("AA");if(r&&r.has(t)){var n=r.get(t);if(n&&n.has("S")){var s=n.get("S");s&&"GoTo"===s.name&&n.has("D")&&(n._crossReference||(n._crossReference=i._crossReference),e=new $e(Rt(n,"D")))}}}return e},e}(),ei=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ii=function(){function e(){this._visible=!0,this._isTransparentBackColor=!1,this._defaultFont=new Ae(t.PdfFontFamily.helvetica,8),this._appearanceFont=new Ae(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._defaultItemFont=new Ae(t.PdfFontFamily.timesRoman,12),this._flatten=!1,this._hasData=!1,this._circleCaptionFont=new Ae(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular)}return Object.defineProperty(e.prototype,"itemsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){if(void 0===this._name){var t=T(this._dictionary,"T",!1,!1);t&&t.length>0&&(1===t.length?this._name=t[0]:this._name=t.join("."))}return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"actualName",{get:function(){if(void 0===this._actualName&&this._dictionary.has("T")){var t=this._dictionary.get("T");t&&"string"==typeof t&&(this._actualName=t)}return this._actualName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mappingName",{get:function(){if(void 0===this._mappingName&&this._dictionary.has("TM")){var t=this._dictionary.get("TM");t&&"string"==typeof t&&(this._mappingName=t)}return this._mappingName},set:function(t){void 0!==this.mappingName&&this._mappingName===t||(this._mappingName=t,this._dictionary.update("TM",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"toolTip",{get:function(){if(void 0===this._alternateName&&this._dictionary.has("TU")){var t=this._dictionary.get("TU");t&&"string"==typeof t&&(this._alternateName=t)}return this._alternateName},set:function(t){void 0!==this.toolTip&&this._alternateName===t||(this._alternateName=t,this._dictionary.update("TU",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visibility",{get:function(){var e;if(this._isLoaded){e=t.PdfFormFieldVisibility.visible;var i=this.itemAt(this._defaultIndex),r=t.PdfAnnotationFlag.default;if(i&&i._hasFlags)r=i.flags;else{if(!this._dictionary.has("F"))return t.PdfFormFieldVisibility.visibleNotPrintable;r=this._dictionary.get("F")}var n=3;switch((r&t.PdfAnnotationFlag.hidden)===t.PdfAnnotationFlag.hidden&&(n=0),(r&t.PdfAnnotationFlag.noView)===t.PdfAnnotationFlag.noView&&(n=1),(r&t.PdfAnnotationFlag.print)!==t.PdfAnnotationFlag.print&&(n&=2),n){case 0:e=t.PdfFormFieldVisibility.hidden;break;case 1:e=t.PdfFormFieldVisibility.hiddenPrintable;break;case 2:e=t.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:e=t.PdfFormFieldVisibility.visible}}else void 0===this._visibility&&(this._visibility=t.PdfFormFieldVisibility.visible),e=this._visibility;return e},set:function(e){var i=this.itemAt(this._defaultIndex);if(this._isLoaded)!i||i._hasFlags&&this.visibility===e?this._dictionary.has("F")&&this.visibility===e||(St(this._dictionary,e),this._dictionary._updated=!0):(St(i._dictionary,e),this._dictionary._updated=!0);else if(this.visibility!==e)switch(this._visibility=e,e){case t.PdfFormFieldVisibility.hidden:i.flags=t.PdfAnnotationFlag.hidden;break;case t.PdfFormFieldVisibility.hiddenPrintable:i.flags=t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visible:i.flags=t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visibleNotPrintable:i.flags=t.PdfAnnotationFlag.default}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary.has("Rect")&&(t=N(this._dictionary,this.page)),void 0!==t&&null!==t||(t={x:0,y:0,width:0,height:0}),t},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded&&(void 0===e||this._dictionary.has("Rect"))?this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){var t,e=this.itemAt(this._defaultIndex);if(e&&void 0!==e.rotate)t=e.rotate;else if(this._dictionary.has("R"))t=this._dictionary.get("R");else for(var i=0;i<this._kidsCount&&void 0===t;i++)i!==this._defaultIndex&&(e=this.itemAt(i))&&void 0!==e.rotate&&(t=e.rotate);return void 0===t&&(t=0),t},set:function(t){var e=this.itemAt(this._defaultIndex);e?e.rotate=t:this._dictionary.has("R")&&this._dictionary.get("R")===t||this._dictionary.update("R",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&e.color?t=e.color:this._defaultAppearance&&(t=this._da.color),t},set:function(t){var e=this.itemAt(this._defaultIndex);if(e&&e.color)e.color=t;else{var i=!1;this._defaultAppearance||(this._da=new di(""),i=!0),(i||this._da.color!==t)&&(this._da.color=t,this._dictionary.update("DA",this._da.toString()))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backColor",{get:function(){return this._parseBackColor(!1)},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"borderColor",{get:function(){var t,e=this.itemAt(this._defaultIndex);if(e&&e.borderColor)t=e.borderColor;else if(this._mkDictionary){var i=this._mkDictionary;if(i&&i.has("BC")){var r=i.getArray("BC");r&&(t=L(r))}}return void 0!==t&&null!==t||(t=[0,0,0]),t},set:function(t){var e=this.itemAt(this._defaultIndex);if(e&&e.borderColor!==t)e.borderColor=t;else{var i=this._mkDictionary;if(void 0===i){var r=new xr(this._crossReference);r.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary.update("MK",r)}else i.has("BC")&&L(i.getArray("BC"))===t||(i.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary._updated=!0)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readOnly",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.readOnly)},set:function(e){e?this._fieldFlags|=t._FieldFlag.readOnly:(this._fieldFlags===t._FieldFlag.readOnly&&(this._fieldFlags|=t._FieldFlag.default),this._fieldFlags&=~t._FieldFlag.readOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.required)},set:function(e){e?this._fieldFlags|=t._FieldFlag.required:this._fieldFlags&=~t._FieldFlag.required},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){if(this._isLoaded){var e=this.itemAt(this._defaultIndex),i=t.PdfAnnotationFlag.default;return e&&e._hasFlags?i=e.flags:this._dictionary.has("F")&&(i=this._dictionary.get("F")),i!==t.PdfAnnotationFlag.hidden}return this._visible},set:function(e){this._isLoaded||this._visible===e||e||(this._visible=e,this.itemAt(this._defaultIndex).flags=t.PdfAnnotationFlag.hidden)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){var e,i=this.itemAt(this._defaultIndex);if(i&&i._dictionary.has("BS"))e=i.border;else if(e=new Gi,this instanceof ni||(e._width=0),e._dictionary=this._dictionary,this._dictionary.has("BS")){var r=this._dictionary.get("BS");if(r){if(r.has("W")&&(e._width=r.get("W")),r.has("S")){var n=r.get("S");if(n)switch(n.name){case"D":e._style=t.PdfBorderStyle.dashed;break;case"B":e._style=t.PdfBorderStyle.beveled;break;case"I":e._style=t.PdfBorderStyle.inset;break;case"U":e._style=t.PdfBorderStyle.underline;break;default:e._style=t.PdfBorderStyle.solid}}r.has("D")&&(e._dash=r.getArray("D"))}}return e},set:function(t){var e=this.itemAt(this._defaultIndex);e?this._updateBorder(e._dictionary,t):this._updateBorder(this._dictionary,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){var e=t.PdfRotationAngle.angle0,i=this.itemAt(this._defaultIndex);return i&&(e=i.rotationAngle),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"export",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.noExport))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.noExport:this._fieldFlags|=t._FieldFlag.noExport},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabIndex",{get:function(){var t;if(this.page._pageDictionary.has("Annots")&&(t=this.page._pageDictionary.get("Annots")),this._kids&&this._kids.length>0)for(var e=0;e<this._kids.length;e++){var i=this._kids[Number.parseInt(e.toString(),10)];if(i&&this.page._pageDictionary.has("Annots")&&t&&-1!==(r=t.indexOf(i)))return r}else if(this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._ref&&t){var r=t.indexOf(this._ref);if(-1!==r)return r}return-1},set:function(e){this._tabIndex=e;var i=this.page;if(i&&(this.form._tabOrder===t.PdfFormFieldsTabOrder.manual||i.tabOrder===t.PdfFormFieldsTabOrder.manual)&&i._pageDictionary.has("Annots")){var r=i._pageDictionary.get("Annots"),n=new Qi(r,this._crossReference,i);i._annotations=n;var s=r.indexOf(this._ref);s<0&&(s=this._annotationIndex);var a=i.annotations._reArrange(this._ref,this._tabIndex,s);i._pageDictionary.update("Annots",a),i._pageDictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){if(!this._page){var t,e=this.itemAt(this._defaultIndex),i=void 0!==e?e._dictionary:this._dictionary;this._crossReference&&(t=this._crossReference._document);var r=void 0;if(i.has("P")){var n=i.getRaw("P");if(n&&t)for(o=0;o<t.pageCount;o++){var s=t.getPage(o);if(s&&s._ref===n){r=s;break}}}if(!r&&t){var a=void 0!==e?e._ref:this._ref;if(!r&&a&&(r=X(t,a)),!r&&this._kids&&this._kids.length>0)for(var o=0;o<this._kids.length&&!(r=X(t,this._kids[Number.parseInt(o.toString(),10)]));o++);}this._page=r}return this._page},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_grayBrush",{get:function(){return this._gray||(this._gray=new Ee([128,128,128])),this._gray},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_silverBrush",{get:function(){return this._silver||(this._silver=new Ee([198,198,198])),this._silver},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_whiteBrush",{get:function(){return this._white||(this._white=new Ee([255,255,255])),this._white},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_blackBrush",{get:function(){return this._black||(this._black=new Ee([0,0,0])),this._black},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_kidsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_hasBackColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;if(!t){var e=this.itemAt(this._defaultIndex);e&&e._dictionary.has("MK")&&(t=e._dictionary.get("MK"))}return t&&t.has("BG")}return!this._isTransparentBackColor},enumerable:!0,configurable:!0}),e.prototype._parseBackColor=function(t){var e;if(!t||this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor){var i=this.itemAt(this._defaultIndex);if(i&&i.backColor)e=i.backColor;else if(this._mkDictionary){var r=this._mkDictionary;if(r&&r.has("BG")){var n=r.getArray("BG");n&&(e=L(n))}}void 0!==e&&null!==e||(e=[255,255,255])}return e},e.prototype._updateBackColor=function(t,e){if(void 0===e&&(e=!1),e&&4===t.length&&255!==t[3]){this._isTransparentBackColor=!0,this._dictionary.has("BG")&&delete this._dictionary._map.BG,(n=this._mkDictionary)&&n.has("BG")&&(delete n._map.BG,this._dictionary._updated=!0);var i=this.itemAt(this._defaultIndex);i&&(i.backColor=t)}else{this._isTransparentBackColor=!1;var r=this.itemAt(this._defaultIndex);if(r&&r.backColor!==t)r.backColor=t;else{var n=this._mkDictionary;if(void 0===n){var s=new xr(this._crossReference);s.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary.update("MK",s)}else n.has("BG")&&L(n.getArray("BG"))===t||(n.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary._updated=!0)}}},e.prototype.itemAt=function(t){var e;if(t>=0&&t<this._kidsCount)if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0,r=this._kids[Number.parseInt(t.toString(),10)];r&&r instanceof wr&&(i=this._crossReference._fetch(r)),i&&((e=Vi._load(i,this._crossReference))._ref=r,this._parsedItems.set(t,e))}return e},e.prototype.setAppearance=function(t){this._setAppearance=t},e.prototype.getValue=function(t){var e;if(!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(i instanceof vr)e=i.name;else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e=i}return e},e.prototype.setValue=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},e.prototype.removeItemAt=function(t){if(this._dictionary.has("Kids")&&this.itemsCount>0){var e=this.itemAt(t);if(e&&e._ref){var i=e._getPage();if(i&&i._removeAnnotation(e._ref),this._kids.splice(t,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(t),this._parsedItems.size>0){var r=new Map;this._parsedItems.forEach(function(e,i){i>t?r.set(i-1,e):r.set(i,e)}),this._parsedItems=r}}}},e.prototype.removeItem=function(t){if(t&&t._ref){var e=this._kids.indexOf(t._ref);-1!==e&&this.removeItemAt(e)}},Object.defineProperty(e.prototype,"_fieldFlags",{get:function(){return void 0===this._flags&&(this._flags=T(this._dictionary,"Ff",!1,!0),void 0===this._flags&&(this._flags=t._FieldFlag.default)),this._flags},set:function(t){this._fieldFlags!==t&&(this._flags=t,this._dictionary.update("Ff",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_defaultAppearance",{get:function(){if(void 0===this._da){var t=T(this._dictionary,"DA",!1,!0);t&&""!==t&&(this._da=new di(t))}return this._da},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),e.prototype._updateBorder=function(e,i){var r,n=!1;e.has("BS")?r=e.get("BS"):(r=new xr(this._crossReference),e.update("BS",r),n=!0),void 0!==i.width?(r.update("W",i.width),e._updated=!0):n&&r.update("W",0),void 0!==i.style?(r.update("S",M(i.style)),e._updated=!0):n&&r.update("S",M(t.PdfBorderStyle.solid)),void 0!==i.dash&&(r.update("D",i.dash),e._updated=!0)},e.prototype._checkFieldFlag=function(t){var e=t.get("F");return void 0!==e&&6===e},e.prototype._initializeFont=function(t){this._font=t;var e,i=this._crossReference._document;i&&(e=i.form._dictionary.has("DR")?i.form._dictionary.get("DR"):new xr(this._crossReference));var r,n=!1;if(e.has("Font")){var s=e.getRaw("Font");s&&s instanceof wr?(n=!0,r=this._crossReference._fetch(s)):s instanceof xr&&(r=s)}r||(r=new xr(this._crossReference),e.update("Font",r));var a=vr.get(G()),o=this._crossReference._getNextReference();t instanceof xe?this._font._pdfFontInternals&&this._crossReference._cacheMap.set(o,this._font._pdfFontInternals):this._font._dictionary&&this._crossReference._cacheMap.set(o,this._font._dictionary),r.update(a.name,o),e._updated=!0,i.form._dictionary.update("DR",e),i.form._dictionary._updated=!0,this._fontName=a.name;var h=new di;if(h.fontName=this._fontName,h.fontSize=this._font._size,h.color=this.color?this.color:[0,0,0],this._dictionary.has("Kids"))for(var c=this._dictionary.getArray("Kids"),_=0;_<c.length;_++)c[Number.parseInt(_.toString(),10)].update("DA",h.toString());else this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._dictionary.update("DA",h.toString());n&&(e._updated=!0)},e.prototype._drawRectangularControl=function(e,i){switch(e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush),this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth),i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._whiteBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}},e.prototype._drawBorder=function(e,i,r,n,s){r&&s>0&&(n===t.PdfBorderStyle.underline?e.drawLine(r,i[0],i[0]+i[3]-s/2,i[0]+i[2],i[1]+i[3]-s/2):e.drawRectangle(i[0]+s/2,i[1]+s/2,i[2]-s,i[3]-s,r))},e.prototype._drawLeftTopShadow=function(t,e,i,r){var n=new Re,s=[];s.push([e[0]+i,e[1]+i]),s.push([e[0]+i,e[1]+e[3]-i]),s.push([e[0]+2*i,e[1]+e[3]-2*i]),s.push([e[0]+2*i,e[1]+2*i]),s.push([e[0]+e[2]-2*i,e[1]+2*i]),s.push([e[0]+e[2]-i,e[1]+i]),n._addPolygon(s),t._drawPath(n,null,r)},e.prototype._drawRightBottomShadow=function(t,e,i,r){var n=new Re,s=[];s.push([e[0]+i,e[1]+e[3]-i]),s.push([e[0]+2*i,e[1]+e[3]-2*i]),s.push([e[0]+e[2]-2*i,e[1]+e[3]-2*i]),s.push([e[0]+e[2]-2*i,e[1]+2*i]),s.push([e[0]+e[2]-i,e[1]+i]),s.push([e[0]+e[2]-i,e[1]+e[3]-i]),n._addPolygon(s),t._drawPath(n,null,r)},e.prototype._drawRadioButton=function(e,i,r,n){if("l"===r){var s=i.bounds;switch(n){case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:e.drawEllipse(s[0],s[1],s[2],s[3],i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.underline?e.drawEllipse(s[0],s[1],s[2],s[3],i.backBrush):e.drawEllipse(s[0],s[1],s[2],s[3],i.shadowBrush)}if(this._drawRoundBorder(e,s,i.borderPen,i.borderWidth),this._drawRoundShadow(e,i,n),n===t._PdfCheckFieldState.checked||n===t._PdfCheckFieldState.pressedChecked){var a=[s[0]+i.borderWidth/2,s[1]+i.borderWidth/2,s[2]-i.borderWidth,s[3]-i.borderWidth];e.drawEllipse(a[0]+a[2]/4,a[1]+a[2]/4,a[2]-a[2]/2,a[3]-a[2]/2,i.foreBrush)}}else this._drawCheckBox(e,i,r,n)},e.prototype._drawRoundBorder=function(t,e,i,r){0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||t.drawEllipse(e[0]+r/2,e[1]+r/2,e[2]-r,e[3]-r,i)},e.prototype._drawRoundShadow=function(e,i,r){var n=i.borderWidth,s=-1.5*n,a=i.bounds[0]+s,o=i.bounds[1]+s,h=i.bounds[2]+2*s,c=i.bounds[3]+2*s,_=i.shadowBrush;if(_){var d=_._color,p=void 0,l=void 0;switch(i.borderStyle){case t.PdfBorderStyle.beveled:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:p=new Ve(d,n),l=new Ve([255,255,255],n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:p=new Ve([255,255,255],n),l=new Ve(d,n)}break;case t.PdfBorderStyle.inset:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:p=new Ve([0,0,0],n),l=new Ve([0,0,0],n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:p=new Ve([128,128,128],n),l=new Ve([192,192,192],n)}}p&&l&&(e.drawArc(a,o,h,c,135,180,p),e.drawArc(a,o,h,c,-45,180,l))}},e.prototype._drawCheckBox=function(e,i,r,n,s){switch(n){case t._PdfCheckFieldState.unchecked:case t._PdfCheckFieldState.checked:i.borderPen&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.underline?i.borderPen&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush):i.borderPen&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.shadowBrush)}var a=i.bounds;if(this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth),n===t._PdfCheckFieldState.pressedChecked||n===t._PdfCheckFieldState.pressedUnchecked)switch(i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._blackBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush)}else switch(i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._whiteBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}var o=0,h=0;switch(n){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.checked:if(s)s=new Ae(t.PdfFontFamily.zapfDingbats,s._size);else{var c=i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.inset,_=i.borderWidth;c&&(_*=2);var d=Math.max(c?2*i.borderWidth:i.borderWidth,1),p=Math.min(_,d),l=(h=i.bounds[2]>i.bounds[3]?i.bounds[3]:i.bounds[2])-2*p;s=new Ae(t.PdfFontFamily.zapfDingbats,l),i.bounds[2]>i.bounds[3]&&(o=(i.bounds[3]-s._metrics._getHeight())/2)}if(0===h&&(h=i.bounds[3]),i.pageRotationAngle!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var u=e.save(),f=e._size;if(i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(f[1],0),e.rotateTransform(90);var g=f[1]-(a[0]+a[2]);a=[b=a[1],g,a[3],a[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(f[0],f[1]),e.rotateTransform(-180),a=[b=f[0]-(a[0]+a[2]),g=f[1]-(a[1]+a[3]),a[2],a[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,f[0]),e.rotateTransform(270),a=[b=f[0]-(a[1]+a[3]),g=a[0],a[3],a[2]]);if(i.rotationAngle>0){if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,f[1]),e.rotateTransform(-90),a=[b=f[1]-(a[1]+a[3]),g=a[0],a[3],a[2]];else if(a[2]>a[3])e.translateTransform(0,f[1]),e.rotateTransform(-90),a=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]];else{var y=a[0];a[0]=-(a[1]+a[3]),a[1]=y;var m=a[3];a[3]=a[2]>s._metrics._getHeight()?a[2]:s._metrics._getHeight(),a[2]=m,e.rotateTransform(-90),a=[a[0],a[1],a[2],a[3]]}else if(270===i.rotationAngle)e.translateTransform(f[0],0),e.rotateTransform(-270),a=[b=a[1],g=f[0]-(a[0]+a[2]),a[3],a[2]];else if(180===i.rotationAngle){e.translateTransform(f[0],f[1]),e.rotateTransform(-180);var b=f[0]-(a[0]+a[2]);a=[b,g=f[1]-(a[1]+a[3]),a[2],a[3]]}e.drawString(r,s,[a[0],a[1]-o,a[2],a[3]],null,i.foreBrush,new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle)),e.restore(u)}else e.drawString(r,s,[a[0],a[1]-o,a[2],a[3]],null,i.foreBrush,new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle));break}}},e.prototype._addToKid=function(t){this._dictionary.has("Kids")?this._kids=this._dictionary.get("Kids"):(this._kids=[],this._dictionary.update("Kids",this._kids),this._parsedItems=new Map);var e=this._kidsCount;t._index=e,this._kids.push(t._ref),this._parsedItems.set(e,t)},e.prototype._drawTemplate=function(e,i,r){if(e&&i){var n=i.graphics;n.save(),i.rotation===t.PdfRotationAngle.angle90?(n.translateTransform(n._size[1],0),n.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(n.translateTransform(n._size[0],n._size[1]),n.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(n.translateTransform(0,n._size[0]),n.rotateTransform(270)),n._sw._setTextRenderingMode(t._TextRenderingMode.fill),n.drawTemplate(e,r),n.restore()}},e.prototype._addToOptions=function(t,e){e instanceof ci&&e._listValues.push(t._text),e._options.push([t._value,t._text]),e._dictionary.set("Opt",e._options),e._dictionary._updated=!0,!t._isFont&&t._pdfFont&&this._initializeFont(t._pdfFont)},e.prototype._addAppearance=function(t,e,i){var r=new xr;t.has("AP")?(r=t.get("AP"),wt(t.get("AP"),this._crossReference,i)):(r=new xr(this._crossReference),t.update("AP",r));var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,e._content),r.update(i,n)},e.prototype._rotateTextBox=function(e,i,r){var n=[0,0,0,0];return r===t.PdfRotationAngle.angle180?n=[i[0]-(e[0]+e[2]),i[1]-(e[1]+e[3]),e[2],e[3]]:r===t.PdfRotationAngle.angle270?n=[e[1],i[0]-(e[0]+e[2]),e[3],e[2]]:r===t.PdfRotationAngle.angle90&&(n=[i[1]-(e[1]+e[3]),e[0],e[3],e[2]]),n},e.prototype._checkIndex=function(t,e){if(t<0||0!==t&&t>=e)throw Error("Index out of range.")},e.prototype._getAppearanceStateValue=function(){var t;if(this._dictionary.has("Kids"))for(var e=0;e<this._kidsCount;e++){var i=this.itemAt(e);if(i&&i._dictionary&&i._dictionary.has("AS")&&(r=i._dictionary.get("AS"))&&"Off"!==r.name){t=r.name;break}}else if(this._dictionary.has("AS")){var r=this._dictionary.get("AS");r&&"Off"!==r.name&&(t=r.name)}return t},e.prototype._getTextAlignment=function(){if(null===this._textAlignment||void 0===this._textAlignment)if(this._isLoaded){var e=this.itemAt(this._defaultIndex);e&&e._dictionary&&e._dictionary.has("Q")?this._textAlignment=e._dictionary.get("Q"):this._dictionary.has("Q")?this._textAlignment=this._dictionary.get("Q"):this._textAlignment=t.PdfTextAlignment.left}else this._textAlignment=t.PdfTextAlignment.left;return this._textAlignment},e.prototype._setTextAlignment=function(e){var i=this.itemAt(this._defaultIndex);this._isLoaded&&!this.readOnly&&(i&&i._dictionary?i._dictionary.update("Q",e):this._dictionary.update("Q",e)),this._isLoaded||this._textAlignment===e||(i&&i._dictionary?i._dictionary.update("Q",e):this._dictionary&&this._dictionary.update("Q",e)),this._textAlignment=e,this._stringFormat=new Et(e,t.PdfVerticalAlignment.middle)},e.prototype._parseItems=function(){for(var t=[],e=0;e<this.itemsCount;e++)t.push(this.itemAt(e));return t},e}(),ri=function(e){function i(t,i,r){var n=e.call(this)||this;return n._autoResizeText=!1,t&&i&&r&&n._initialize(t,i,r),n}return ei(i,e),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},Object.defineProperty(i.prototype,"text",{get:function(){if(void 0===this._text)if(this._isLoaded){var t=T(this._dictionary,"V",!1,!0);if(t)this._text=t;else{var e=this.itemAt(this._defaultIndex);e&&(t=e._dictionary.get("V"))&&(this._text=t)}}else this._text="";return this._text},set:function(t){if(this._isLoaded){if(!this.readOnly){this._dictionary.has("V")&&this._dictionary.get("V")===t||this._dictionary.update("V",t);var e=this.itemAt(this._defaultIndex);!e||e._dictionary.has("V")&&e._dictionary.get("V")===t||e._dictionary.update("V",t)}}else this._text!==t&&(this._dictionary.update("V",t),this._text=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"defaultValue",{get:function(){if(void 0===this._defaultValue){var t=T(this._dictionary,"DV",!1,!0);t&&(this._defaultValue=t)}return this._defaultValue},set:function(t){t!==this.defaultValue&&(this._dictionary.update("DV",t),this._defaultValue=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"multiLine",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.multiLine)},set:function(e){e?this._fieldFlags|=t._FieldFlag.multiLine:this._fieldFlags&=~t._FieldFlag.multiLine},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"password",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.password)},set:function(e){e?this._fieldFlags|=t._FieldFlag.password:this._fieldFlags&=~t._FieldFlag.password},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollable",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.doNotScroll))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.doNotScroll:this._fieldFlags|=t._FieldFlag.doNotScroll},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"spellCheck",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.doNotSpellCheck))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.doNotSpellCheck:this._fieldFlags|=t._FieldFlag.doNotSpellCheck},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"insertSpaces",{get:function(){var e=this._fieldFlags;return 0!=(t._FieldFlag.comb&e)&&0==(e&t._FieldFlag.multiLine)&&0==(e&t._FieldFlag.password)&&0==(e&t._FieldFlag.fileSelect)},set:function(e){e?this._fieldFlags|=t._FieldFlag.comb:this._fieldFlags&=~t._FieldFlag.comb},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){var e,i=this.itemAt(this._defaultIndex);return i&&void 0!==i.highlightMode?e=i.highlightMode:this._dictionary.has("H")&&(e=V(this._dictionary.get("H").name)),void 0!==e?e:t.PdfHighlightMode.noHighlighting},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&V(this._dictionary.get("H"))===t||this._dictionary.update("H",j(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxLength",{get:function(){if(void 0===this._maxLength){var t=T(this._dictionary,"MaxLen",!1,!0);this._maxLength=void 0!==t&&Number.isInteger(t)?t:0}return this._maxLength},set:function(t){this.maxLength!==t&&(this._dictionary.update("MaxLen",t),this._maxLength=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isAutoResizeText",{get:function(){return this._autoResizeText},set:function(t){this._autoResizeText=t;var e=this.itemAt(this._defaultIndex);e&&(e._isAutoResize=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Pe&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initialize=function(e,i,r){this._crossReference=e._crossReference,this._page=e,this._name=i,this._text="",this._defaultValue="",this._defaultIndex=0,this._spellCheck=!1,this._insertSpaces=!1,this._multiline=!1,this._password=!1,this._scrollable=!1,this._dictionary=new xr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",vr.get("Tx")),this._dictionary.update("T",i),this._fieldFlags|=t._FieldFlag.doNotSpellCheck,this._initializeFont(this._defaultFont),this._createItem(r)},i.prototype._createItem=function(e){var i=new Vi;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.left,this._stringFormat=new Et(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new xr(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[1,1,1]),i._mkDictionary.update("CA",this.actualName),this._addToKid(i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(e>0)for(i=0;i<e;i++)(r=this.itemAt(i))&&this._postProcess(t,r);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var i=0;i<e;i++){var r=this.itemAt(i);if(r&&!this._checkFieldFlag(r._dictionary)){var n=this._createAppearance(t,r);t?this._drawTemplate(n,r._page,{x:r.bounds.x,y:r.bounds.y,width:n._size[0],height:n._size[1]}):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}}t&&(this._dictionary._updated=!1)}},i.prototype._postProcess=function(e,i){var r,n,s=i||this;if(this._form._setAppearance||this._setAppearance||e&&!s._dictionary.has("AP"))r=this._createAppearance(e,s);else if(s._dictionary.has("AP")){var a=void 0,o=s._dictionary.get("AP");if(o&&o.has("N")){a=o.get("N");var h=o.getRaw("N");h&&(a.reference=h),a&&(r=new Ye(a,this._crossReference))}}if(r)if(e){var c=s instanceof Vi?s._getPage():s.page;if(c){var _=c.graphics;_.save(),c.rotation===t.PdfRotationAngle.angle90?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(90)):c.rotation===t.PdfRotationAngle.angle180?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(-180)):c.rotation===t.PdfRotationAngle.angle270&&(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size[0],height:r._size[1]},_.drawTemplate(r,n),_.restore()}s._dictionary._updated=!1}else this._addAppearance(s._dictionary,r,"N")},i.prototype._createAppearance=function(e,i){var r=i.bounds,n=new Ye([0,0,r.width,r.height],this._crossReference);$(n,null),n._writeTransformation=!1;var s=n.graphics,a=new Xi;a.bounds=[0,0,r.width,r.height];var o=i.backColor;e&&o&&(a.backBrush=new Ee(o)),a.foreBrush=new Ee(i.color);var h=i.border;if(a.borderPen=new Ve(i.borderColor,h.width),a.borderStyle=h.style,a.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];a.shadowBrush=new Ee(_)}a.rotationAngle=i.rotate,a.insertSpaces=this.insertSpaces;var d=this.text;if(null!==d&&void 0!==d||(d=""),this.password){for(var p="",l=0;l<d.length;l++)p+="*";d=p}return a.required=this.required,this.required||(s._sw._beginMarkupSequence("Tx"),s._initializeCoordinates()),void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),void 0!==this._stringFormat&&null!==this._stringFormat||(void 0===this.textAlignment||null===this.textAlignment?this._stringFormat=new Et(this.textAlignment,t.PdfVerticalAlignment.middle):this._stringFormat=new Et(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle)),this._drawTextBox(s,a,d,this._font,this._stringFormat,this.multiLine,this.scrollable,this.maxLength),this.required||s._sw._endMarkupSequence(),n},i.prototype._drawTextBox=function(e,i,r,n,s,a,o,h){if(void 0!==h)if(i.insertSpaces){var c=0;if(void 0!==h&&h>0){c=i.bounds[2]/h,e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.borderPen,i.backBrush);for(var _=r,d=0;d<h;d++){if(s.alignment===t.PdfTextAlignment.right)r=h-_.length<=d?_[d-(h-_.length)]:"";else if(s.alignment===t.PdfTextAlignment.center&&_.length<h){var p=h/2-Math.ceil(_.length/2);r=d>=p&&d<p+_.length?_[d-p]:""}else r=_.length>d?_[Number.parseInt(d.toString(),10)]:"";i.bounds[2]=c,this._drawTextBox(e,i,r,n,new Et(t.PdfTextAlignment.center),a,o),i.bounds[0]=i.bounds[0]+c,i.borderWidth&&e.drawLine(i.borderPen,i.bounds[0],i.bounds[1],i.bounds[0],i.bounds[1]+i.bounds[3])}}else this._drawTextBox(e,i,r,n,s,a,o)}else this._drawTextBox(e,i,r,n,s,a,o);else{e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),i.insertSpaces||this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());var l=i.bounds;if(i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.inset?(l[0]=l[0]+4*i.borderWidth,l[2]=l[2]-8*i.borderWidth):(l[0]=l[0]+2*i.borderWidth,l[2]=l[2]-4*i.borderWidth),a){var u=(void 0===s||null===s||0===s.lineSpacing?n._metrics._getHeight():s.lineSpacing)-n._metrics._getAscent(s);r.indexOf("\n"),0===l[0]&&1===l[1]&&(l[1]=-(l[1]-u)),i.isAutoFontSize&&0!==i.borderWidth&&(l[1]=l[1]+2.5*i.borderWidth)}if(e._page&&void 0!==e._page.rotation&&e._page.rotation!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var f=e.save();if(void 0!==i.pageRotationAngle&&i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(e._size[1],0),e.rotateTransform(90);var g=e._size[1]-(l[0]+l[2]);l=[b=l[1],g,l[3],l[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180),l=[b=e._size[0]-(l[0]+l[2]),g=e._size[1]-(l[1]+l[3]),l[2],l[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,e._size[0]),e.rotateTransform(270),l=[b=e._size[0]-(l[1]+l[3]),g=l[0],l[3],l[2]]);if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),l=[b=e._size[1]-(l[1]+l[3]),g=l[0],l[3],l[2]];else if(l[2]>l[3])e.translateTransform(0,e._size[1]),e.rotateTransform(-90),l=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]];else{var y=l[0];l[0]=-(l[1]+l[3]),l[1]=y;var m=l[3];l[3]=l[2]>n._metrics._getHeight()?l[2]:n._metrics._getHeight(),l[2]=m,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),l=[b=l[1],g=e._size[0]-(l[0]+l[2]),l[3],l[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var b=e._size[0]-(l[0]+l[2]);l=[b,g=e._size[1]-(l[1]+l[3]),l[2],l[3]]}e.drawString(r,n,l,null,i.foreBrush,s),e.restore(f)}else e.drawString(r,n,l,null,i.foreBrush,s);e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())}},i}(ii),ni=function(e){function i(t,i,r){var n=e.call(this)||this;return t&&i&&r&&n._initialize(t,i,r),n}return ei(i,e),Object.defineProperty(i.prototype,"actions",{get:function(){return this._actions||(this._actions=new ti(this)),this._actions},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){if(this._isLoaded){if(void 0===this._text){var t=this.itemAt(this._defaultIndex);t&&t._mkDictionary&&t._mkDictionary.has("CA")?this._text=t._mkDictionary.get("CA"):this._mkDictionary&&this._mkDictionary.has("CA")&&(this._text=this._mkDictionary.get("CA"))}if(void 0===this._text){var e=T(this._dictionary,"V",!1,!0);e&&(this._text=e)}}return void 0===this._text&&(this._text=""),this._text},set:function(t){if(this._isLoaded&&!this.readOnly&&((e=this.itemAt(this._defaultIndex))&&e._dictionary?this._assignText(e._dictionary,t):this._assignText(this._dictionary,t)),!this._isLoaded&&this._text!==t){var e=this.itemAt(this._defaultIndex);this._assignText(e._dictionary,t),this._text=t}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){var e,i=this.itemAt(this._defaultIndex);return i&&void 0!==i.highlightMode?e=i.highlightMode:this._dictionary.has("H")&&(e=V(this._dictionary.get("H").name)),void 0!==e?e:t.PdfHighlightMode.invert},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&V(this._dictionary.get("H"))===t||this._dictionary.update("H",j(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Pe&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._assignText=function(t,e){var i;t.has("MK")?i=t.get("MK"):(i=new xr(this._crossReference),t.set("MK",i)),i.update("CA",e),t._updated=!0},i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},i.prototype._initialize=function(e,i,r){this._crossReference=e._crossReference,this._page=e,this._name=i,this._defaultIndex=0,this._dictionary=new xr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",vr.get("Btn")),this._dictionary.update("T",i),this._fieldFlags|=t._FieldFlag.pushButton,this._initializeFont(this._defaultFont),this._createItem(r)},i.prototype._createItem=function(e){var i=new Vi;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new Et(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new xr(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[.827451,.827451,.827451]),i._mkDictionary.update("CA",void 0!==this._name&&null!==this._name?this._name:this._actualName),this._addToKid(i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(e>0)for(i=0;i<e;i++)(r=this.itemAt(i))&&this._postProcess(t,r);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var i=0;i<e;i++){var r=this.itemAt(i);if(r&&!this._checkFieldFlag(r._dictionary)){var n=this._createAppearance(r);if(t)this._drawTemplate(n,r._getPage(),{x:r.bounds.x,y:r.bounds.y,width:n._size[0],height:n._size[1]});else{this._addAppearance(r._dictionary,n,"N");var s=this._createAppearance(r,!0);s&&this._addAppearance(r._dictionary,s,"D")}r._dictionary._updated=!t}}t&&(this._dictionary._updated=!1)}},i.prototype._postProcess=function(e,i){var r,n,s=i||this;if(this._form._setAppearance||this._setAppearance||e&&!s._dictionary.has("AP"))r=this._createAppearance(s);else if(s._dictionary.has("AP")){var a=void 0,o=s._dictionary.get("AP");if(o&&o.has("N")){a=o.get("N");var h=o.getRaw("N");h&&(a.reference=h),a&&(r=new Ye(a,this._crossReference))}}if(r)if(e){var c=s instanceof Vi?s._getPage():s.page;if(c){var _=c.graphics;_.save(),c.rotation===t.PdfRotationAngle.angle90?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(90)):c.rotation===t.PdfRotationAngle.angle180?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(-180)):c.rotation===t.PdfRotationAngle.angle270&&(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size[0],height:r._size[1]},_.drawTemplate(r,n),_.restore()}s._dictionary._updated=!1}else this._addAppearance(s._dictionary,r,"N")},i.prototype._createAppearance=function(t,e){void 0===e&&(e=!1);var i=t.bounds,r=new Ye([0,0,i.width,i.height],this._crossReference),n=new Xi;n.bounds=[0,0,i.width,i.height];var s=t.backColor;s&&(n.backBrush=new Ee(s)),n.foreBrush=new Ee(t.color);var a=t.border;if(n.borderPen=new Ve(t.borderColor,a.width),n.borderStyle=a.style,n.borderWidth=a.width,s){var o=[s[0]-64,s[1]-64,s[2]-64],h=[o[0]>=0?o[0]:0,o[1]>=0?o[1]:0,o[2]>=0?o[2]:0];n.shadowBrush=new Ee(h)}return n.rotationAngle=t.rotate,void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),e?this._drawPressedButton(r.graphics,n,this.text,this._font,this._stringFormat):this._drawButton(r.graphics,n,this.text,this._font,this._stringFormat),r},i.prototype._drawButton=function(e,i,r,n,s){this._drawRectangularControl(e,i);var a=i.bounds;if(e._page&&void 0!==e._page.rotation&&e._page.rotation!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var o=e.save();if(void 0!==i.pageRotationAngle&&i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(e._size[1],0),e.rotateTransform(90);var h=e._size[1]-(a[0]+a[2]);a=[d=a[1],h,a[3],a[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180),a=[d=e._size[0]-(a[0]+a[2]),h=e._size[1]-(a[1]+a[3]),a[2],a[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,e._size[0]),e.rotateTransform(270),a=[d=e._size[0]-(a[1]+a[3]),h=a[0],a[3],a[2]]);if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),a=[d=e._size[1]-(a[1]+a[3]),h=a[0],a[3],a[2]];else if(a[2]>a[3])e.translateTransform(0,e._size[1]),e.rotateTransform(-90),a=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]];else{var c=a[0];a[0]=-(a[1]+a[3]),a[1]=c;var _=a[3];a[3]=a[2]>n._metrics._getHeight()?a[2]:n._metrics._getHeight(),a[2]=_,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),a=[d=a[1],h=e._size[0]-(a[0]+a[2]),a[3],a[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var d=e._size[0]-(a[0]+a[2]);a=[d,h=e._size[1]-(a[1]+a[3]),a[2],a[3]]}e.drawString(r,n,a,null,i.foreBrush,s),e.restore(o)}else e.drawString(r,n,a,null,i.foreBrush,s)},i.prototype._drawPressedButton=function(e,i,r,n,s){switch(i.borderStyle){case t.PdfBorderStyle.inset:e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.shadowBrush);break;default:e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush)}this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth);var a=[i.borderWidth,i.borderWidth,i.bounds[2]-i.borderWidth,i.bounds[3]-i.borderWidth];switch(e.drawString(r,n,a,null,i.foreBrush,s),i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush);break;default:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}},i}(ii),si=function(e){function i(t,i,r){var n=e.call(this)||this;return r&&t&&i&&n._initialize(r,t,i),n}return ei(i,e),i._load=function(t,e,r,n){var s=new i;if(s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._defaultIndex=0,s._parsedItems=new Map,s._dictionary.has("Kids"))s._kids=s._dictionary.get("Kids");else{var a=ji._load(e,r,s);a._isLoaded=!0,a._ref=n,s._parsedItems.set(0,a)}return s},i.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e;if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0;if(t>=0&&this._kids&&this._kids.length>0&&t<this._kids.length){var r=this._kids[Number.parseInt(t.toString(),10)];r&&r instanceof wr&&(i=this._crossReference._fetch(r)),i&&((e=ji._load(i,this._crossReference,this))._isLoaded=!0,e._ref=r,this._parsedItems.set(t,e))}}return e},Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Pe&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"checked",{get:function(){return this._kidsCount>0?this.itemAt(this._defaultIndex).checked:J(this._dictionary)},set:function(t){if(this.checked!==t){if(this._kidsCount>0&&(this.itemAt(this._defaultIndex).checked=t),t)if(this._isLoaded){var e=Q(this._kidsCount>0?this.itemAt(this._defaultIndex)._dictionary:this._dictionary);this._dictionary.update("V",vr.get(e)),this._dictionary.update("AS",vr.get(e))}else this._dictionary.update("V",vr.get("Yes")),this._dictionary.update("AS",vr.get("Yes"));else this._dictionary.has("V")&&delete this._dictionary._map.V,this._dictionary.has("AS")&&delete this._dictionary._map.AS;this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._defaultIndex=0,this._dictionary=new xr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",vr.get("Btn")),this._dictionary.update("T",e),this._createItem(i)},i.prototype._createItem=function(e){var i=new ji;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new Et(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new xr(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[1,1,1]),i.style=t.PdfCheckBoxStyle.check,i._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),this._addToKid(i)},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=this._kidsCount;if(this._isLoaded)if(i>0){for(a=0;a<i;a++)if(o=this.itemAt(a)){if(!this._checkFieldFlag(o._dictionary))if(e){var r=void 0,n=o.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;r=this._setAppearance||this._form._setAppearance||!o._dictionary.has("AP")?this._createAppearance(o,n):Y(n,o),this._drawTemplate(r,o._getPage(),o.bounds)}else(this._setAppearance||this._form._setAppearance||!o._isLoaded)&&(o._postProcess(o.checked?"Yes":"Off"),this._drawAppearance(o));o._dictionary._updated=!e}}else{var s=this.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;this._drawTemplate(Y(s,this),this.page,this.bounds)}else for(var a=0;a<i;a++){var o=this.itemAt(a);if(o){n=o.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;if(o._postProcess(o.checked?"Yes":"Off"),e){r=this._createAppearance(o,n);this._drawTemplate(r,o._getPage(),o.bounds)}else this._drawAppearance(o);o._dictionary._updated=!e}}this._dictionary._updated=!e},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Xi;r.bounds=[0,0,i.width,i.height];var n=t.backColor;n&&(r.backBrush=new Ee(n)),r.foreBrush=new Ee(t.color);var s=t.border;if(r.borderPen=new Ve(t.borderColor,s.width),r.borderStyle=s.style,r.borderWidth=s.width,n){var a=[n[0]-64,n[1]-64,n[2]-64],o=[a[0]>=0?a[0]:0,a[1]>=0?a[1]:0,a[2]>=0?a[2]:0];r.shadowBrush=new Ee(o)}r.rotationAngle=t.rotate;var h=new Ye(r.bounds,this._crossReference),c=h.graphics;return this._drawCheckBox(c,r,tt(t._style),e),h},i.prototype._drawAppearance=function(e){var i=new xr;if(e._dictionary.has("AP"))(i=e._dictionary.get("AP"))&&(i.has("N")&&At(i.get("N"),this._crossReference,"Yes","Off"),i.has("D")&&At(i.get("D"),this._crossReference,"Yes","Off")),wt(i,this._crossReference,"N"),wt(i,this._crossReference,"D");else{var r=this._crossReference._getNextReference();i=new xr(this._crossReference),this._crossReference._cacheMap.set(r,i),e._dictionary.update("AP",r)}var n=this._createAppearance(e,t._PdfCheckFieldState.checked),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n._content);var a=this._createAppearance(e,t._PdfCheckFieldState.unchecked),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a._content);var h=new xr(this._crossReference);h.update("Yes",s),h.update("Off",o);var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,h),i.update("N",c);var _=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,_._content);var p=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),l=this._crossReference._getNextReference();this._crossReference._cacheMap.set(l,p._content);var u=new xr(this._crossReference);u.update("Yes",d),u.update("Off",l);var f=this._crossReference._getNextReference();this._crossReference._cacheMap.set(f,u),i.update("D",f),e._dictionary._updated=!0},i}(ii),ai=function(e){function i(t,i){var r=e.call(this)||this;return r._selectedIndex=-1,t&&i&&r._initialize(t,i),r}return ei(i,e),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},Object.defineProperty(i.prototype,"checked",{get:function(){var t=!1;return this._kidsCount>0&&(t=this.itemAt(this._defaultIndex).checked),t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedIndex",{get:function(){return this._isLoaded&&-1===this._selectedIndex&&(this._selectedIndex=this._obtainSelectedIndex()),this._selectedIndex},set:function(t){if(this.selectedIndex!==t){this._selectedIndex=t;for(var e=0;e<this._kidsCount;e++){var i=this.itemAt(e);if(e===t){i._dictionary.update("AS",vr.get(i.value));var r=vr.get(i.value);this._dictionary.update("V",r),this._dictionary.update("DV",r)}else i._dictionary.update("AS",vr.get("Off"))}}},enumerable:!0,configurable:!0}),i.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e;if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0;if(t>=0&&this._kids&&this._kids.length>0&&t<this._kids.length){var r=this._kids[Number.parseInt(t.toString(),10)];r&&r instanceof wr&&(i=this._crossReference._fetch(r)),i&&((e=zi._load(i,this._crossReference,this))._ref=r,e._index=t,this._parsedItems.set(t,e))}}return e},i.prototype.add=function(t,e){return t instanceof zi?(t._field=this,t._dictionary.update("Parent",this._ref),t._setField(this),this._kidsCount):new zi(t,e,this)},i.prototype.removeItemAt=function(t){var e=this.itemAt(t);if(e&&e._ref){var i=e._getPage();if(i&&i._removeAnnotation(e._ref),this._kids.splice(t,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(t),this._parsedItems.size>0){var r=new Map;this._parsedItems.forEach(function(e,i){i>t?r.set(i-1,e):r.set(i,e)}),this._parsedItems=r}if(this._dictionary.has("Opt")){var n=this._dictionary.getArray("Opt");n&&n.length>0&&(n.splice(t,1),this._dictionary.set("Opt",n))}}},i.prototype.removeItem=function(t){if(t&&t._ref){var e=this._kids.indexOf(t._ref);-1!==e&&this.removeItemAt(e)}},i.prototype._initialize=function(e,i){this._defaultIndex=0,this._crossReference=e._crossReference,this._page=e,this._name=i,this._dictionary=new xr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",vr.get("Btn")),this._dictionary.update("T",i),this._parsedItems=new Map,this._fieldFlags|=t._FieldFlag.radio},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._kidsCount,i=t.length<=e?t.length:e,r=0;r<i;r++)t[Number.parseInt(r.toString(),10)]&&(this.itemAt(r)._optionValue=t[Number.parseInt(r.toString(),10)])}},i.prototype._obtainSelectedIndex=function(){for(var t=-1,e=0;e<this._kidsCount;++e){var i=this.itemAt(e);if(i){var r=T(i._dictionary,"V",!1,!0);if(r&&i._dictionary.has("AS")){var n=i._dictionary.get("AS");if(n&&"off"!==n.name.toLowerCase())if(r instanceof vr&&"off"!==r.name.toLowerCase()){if(n.name===r.name||i._optionValue===r.name){t=e;break}}else if("string"==typeof r&&"off"!==r.toLowerCase()&&(n.name===r||i._optionValue===r)){t=e;break}}}}return t},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=this._kidsCount;if(this._isLoaded)if(i>0){for(a=0;a<i;a++)if((o=this.itemAt(a))&&!this._checkFieldFlag(o._dictionary)){if(e){var r=void 0,n=this.selectedIndex===a?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;r=this._setAppearance||this._form._setAppearance||!o._dictionary.has("AP")?this._createAppearance(o,n):Y(n,o),this._drawTemplate(r,o._getPage(),o.bounds)}else(this._setAppearance||this._form._setAppearance||!o._isLoaded)&&(o._postProcess(this.selectedIndex===a?o.value:"Off"),this._drawAppearance(o));o._dictionary._updated=!e}}else{var s=-1!==this.selectedIndex?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;this._drawTemplate(Y(s,this),this.page,this.bounds)}else for(var a=0;a<i;a++){var o=this.itemAt(a),n=this.selectedIndex===a?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;if(o._dictionary.update("AS",vr.get(this.selectedIndex===a?o.value:"Off")),e){r=this._createAppearance(o,n);this._drawTemplate(r,o._getPage(),o.bounds)}else o._postProcess(this.selectedIndex===a?o.value:"Off"),this._drawAppearance(o);o._dictionary._updated=!e}this._dictionary._updated=!e},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Xi;r.bounds=[0,0,i.width,i.height];var n=t.backColor;n&&(r.backBrush=new Ee(n)),r.foreBrush=new Ee(t.color);var s=t.border;if(r.borderPen=new Ve(t.borderColor,s.width),r.borderStyle=s.style,r.borderWidth=s.width,n){var a=[n[0]-64,n[1]-64,n[2]-64],o=[a[0]>=0?a[0]:0,a[1]>=0?a[1]:0,a[2]>=0?a[2]:0];r.shadowBrush=new Ee(o)}r.rotationAngle=t.rotate;var h=new Ye(r.bounds,this._crossReference),c=h.graphics;return this._drawRadioButton(c,r,tt(t.style),e),h},i.prototype._drawAppearance=function(e){var i=new xr;if(e._dictionary.has("AP"))(i=e._dictionary.get("AP"))&&(i.has("N")&&At(i.get("N"),this._crossReference,e.value,"Off"),i.has("D")&&At(i.get("D"),this._crossReference,e.value,"Off")),wt(i,this._crossReference,"N"),wt(i,this._crossReference,"D");else{var r=this._crossReference._getNextReference();i=new xr(this._crossReference),this._crossReference._cacheMap.set(r,i),e._dictionary.update("AP",r)}var n=this._createAppearance(e,t._PdfCheckFieldState.checked),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n._content);var a=this._createAppearance(e,t._PdfCheckFieldState.unchecked),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a._content);var h=new xr(this._crossReference);h.update(e.value,s),h.update("Off",o);var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,h),i.update("N",c);var _=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,_._content);var p=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),l=this._crossReference._getNextReference();this._crossReference._cacheMap.set(l,p._content);var u=new xr(this._crossReference);u.update(e.value,d),u.update("Off",l);var f=this._crossReference._getNextReference();this._crossReference._cacheMap.set(f,u),i.update("D",f),e._dictionary._updated=!0},i}(ii),oi=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ei(i,e),Object.defineProperty(i.prototype,"itemsCount",{get:function(){return this._options.length},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary.has("Rect")&&(t=N(this._dictionary,this.page)),t||(this._bounds?this._bounds:t)},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded?void 0===e||this._dictionary.has("Rect")?this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t):e?(e._page=this.page,e.bounds=t):this._bounds=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedIndex",{get:function(){var t=this._dictionary.get("I");return void 0===t?[]:1===t.length?t[0]:t},set:function(t){var e=this,i=this._options.length;if("number"==typeof t)this._checkIndex(t,i),this._dictionary.update("I",[t]),this._dictionary.update("V",[this._options[Number.parseInt(t.toString(),10)][0]]);else{var r=[];t.forEach(function(t){e._checkIndex(t,i),r.push(e._options[Number.parseInt(t.toString(),10)][0])}),this._dictionary.update("I",t),this._dictionary.update("V",r)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedValue",{get:function(){var t=this,e=[];if(this._dictionary.has("V")&&void 0!==(i=this._dictionary.getArray("V"))&&(Array.isArray(i)?i.forEach(function(t){e.push(t)}):"string"==typeof i&&e.push(i)),0===e.length&&this._dictionary.has("I")){var i=this._dictionary.get("I");i&&i.length>0&&i.forEach(function(i){e.push(t._options[Number.parseInt(i.toString(),10)][0])})}return 1===e.length?e[0]:e},set:function(t){var e=this;if("string"==typeof t){var i=this._tryGetIndex(t);-1!==i&&(this._dictionary.update("I",[i]),this._dictionary.update("V",[t]))}else{var r=[],n=[];t.forEach(function(t){var i=e._tryGetIndex(t);-1!==i&&(n.push(i),r.push(t))}),r.length>0&&(this._dictionary.update("I",n),this._dictionary.update("V",r))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"multiSelect",{get:function(){return this._isLoaded?0!=(this._fieldFlags&t._FieldFlag.multiSelect):this._multiSelect},set:function(e){this.multiSelect!==e&&(this._multiSelect=e,e?this._fieldFlags|=t._FieldFlag.multiSelect:this._fieldFlags&=~t._FieldFlag.multiSelect)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"editable",{get:function(){return this._isLoaded?0!=(this._fieldFlags&t._FieldFlag.edit):this._editable},set:function(e){this._editable!==e&&(this._editable=e,e?this._fieldFlags|=t._FieldFlag.edit:this._fieldFlags&=~t._FieldFlag.edit)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Pe&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_options",{get:function(){return this._optionArray||(this._dictionary.has("Opt")?this._optionArray=this._dictionary.getArray("Opt"):(this._optionArray=[],this._dictionary.update("Opt",this._optionArray))),this._optionArray},enumerable:!0,configurable:!0}),i.prototype.itemAt=function(t){var e;if(t<this._kidsCount)if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{i=void 0;(r=this._kids[Number.parseInt(t.toString(),10)])&&r instanceof wr&&(i=this._crossReference._fetch(r)),i&&((e=Ui._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[Number.parseInt(t.toString(),10)][1]:e._text="",this._parsedItems.set(t,e))}else if(this._parsedItems.has(t))e=this._parsedItems.get(t);else if(this._kidsCount>0&&this._kids&&this._kids.length>0){var i=void 0,r=void 0;(r=1===this._kidsCount?this._kids[0]:this._kids[Number.parseInt(t.toString(),10)])&&r instanceof wr&&(i=this._crossReference._fetch(r)),i&&((e=Ui._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[Number.parseInt(t.toString(),10)][1]:e._text="",this._parsedItems.set(t,e))}return e},i.prototype.addItem=function(t){return this._addToOptions(t,this),this._listValues.length-1},i.prototype.removeItemAt=function(t){var e=this.itemAt(t);if(e&&e._ref){if(this._parsedItems.delete(t),this._parsedItems.size>0){var i=new Map;this._parsedItems.forEach(function(e,r){r>t?i.set(r-1,e):i.set(r,e)}),this._parsedItems=i}if(this._dictionary.has("Opt")){var r=this._options;r&&r.length>0&&(r.splice(t,1),this._dictionary.set("Opt",r),this._optionArray=r,this._dictionary._updated=!0)}}},i.prototype.removeItem=function(t){if(t&&t.text){for(var e=void 0,i=0;i<this.itemsCount;i++){var r=this.itemAt(i);if(r&&t===r&&r.text===t.text){e=i;break}}-1!==e&&this.removeItemAt(e)}},i.prototype._initialize=function(t,e,i){this._defaultIndex=0,this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new xr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",vr.get("Ch")),this._dictionary.update("T",e),this._parsedItems=new Map,this._listValues=[],this._kids=[],this.bounds=i,this._addEmptyWidget()},i.prototype._obtainFont=function(e){var i="",r=1;if(e&&(e._dictionary.has("DS")||e._dictionary.has("DA"))){if(e._dictionary.has("DS"))for(var n=e._dictionary.get("DS").split(";"),s=0;s<n.length;s++){var a=n[Number.parseInt(s.toString(),10)].split(":");if(-1!==n[Number.parseInt(s.toString(),10)].indexOf("font-family"))i=a[1];else if(-1!==n[Number.parseInt(s.toString(),10)].indexOf("font-size"))a[1].endsWith("pt")&&(r=Number.parseFloat(a[1].replace("pt","")));else if(-1===n[Number.parseInt(s.toString(),10)].indexOf("font-style")&&-1!==n[Number.parseInt(s.toString(),10)].indexOf("font")){for(var o=a[1].split(" "),h=0;h<o.length;h++)""===o[Number.parseInt(h.toString(),10)]||o[Number.parseInt(h.toString(),10)].endsWith("pt")||(i+=o[Number.parseInt(h.toString(),10)]+" "),o[Number.parseInt(h.toString(),10)].endsWith("pt")&&(r=Number.parseFloat(o[Number.parseInt(h.toString(),10)].replace("pt","")));for(;" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-2);-1!==i.indexOf(",")&&(i=i.split(",")[0])}}else{var c=e._dictionary.get("DA");if(c&&""!==c&&-1!==c.indexOf("Tf")){for(var _=c.split(" "),s=0;s<_.length;s++)if(-1!==_[Number.parseInt(s.toString(),10)].indexOf("Tf")){for(i=_[s-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);r=Number.parseFloat(_[s-1])}var d=0;if(0===r){var p=new Ae(t.PdfFontFamily.helvetica,d);null!==p&&(d=this._getFontHeight(p._fontFamily),(Number.isNaN(d)||0===d)&&(d=12),p._size=d,r=d)}}}switch(i=i.trim()){case"Helv":this._font=new Ae(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular);break;case"Courier":case"Cour":this._font=new Ae(t.PdfFontFamily.courier,r,t.PdfFontStyle.regular);break;case"Symb":this._font=new Ae(t.PdfFontFamily.symbol,r,t.PdfFontStyle.regular);break;case"TiRo":this._font=new Ae(t.PdfFontFamily.timesRoman,r,t.PdfFontStyle.regular);break;case"ZaDb":this._font=new Ae(t.PdfFontFamily.zapfDingbats,r,t.PdfFontStyle.regular);break;default:this._font=new Ae(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular)}}return this._font},i.prototype._obtainSelectedValue=function(){var t=this,e=[];if(this._dictionary.has("V")){var i=this._dictionary.get("V"),r=this._dictionary.getArray("V");null!==i&&void 0!==i&&("string"==typeof i?e.push(i):Array.isArray(i)&&r.forEach(function(t){e.push(t)}))}else{var n=this._dictionary.get("I");null!==n&&void 0!==n&&n.length>0&&n[0]>-1&&this._options&&this._options.length>0&&n.forEach(function(i){e.push(t._options[Number.parseInt(i.toString(),10)][0])})}return e},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._kids&&this._kids.length>0)if(e>1){for(var i=0;i<e;i++)if((r=this.itemAt(i))&&!this._checkFieldFlag(r._dictionary)){n=this._createAppearance(r);t?(s=r._getPage())&&this._drawTemplate(n,s,r.bounds):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}}else{var r=this.itemAt(0),n=this._createAppearance();t?(s=this.page)&&this._drawTemplate(n,s,this.bounds):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}else if(this._dictionary){n=this._createAppearance();if(t){var s=this.page;s&&this._drawTemplate(n,s,this.bounds)}else this._addAppearance(this._dictionary,n,"N")}this._dictionary._updated=!t}},i.prototype._tryGetIndex=function(t){var e=-1;if(this._options&&this._options.length>0)for(var i=0;i<this._options.length;i++)if(t===this._options[Number.parseInt(i.toString(),10)][0]){e=i;break}return e},i.prototype._addEmptyWidget=function(){var t=new Vi;t._create(this._page,this.bounds,this),this._addToKid(t),t._dictionary.update("MK",new xr(this._crossReference)),t._mkDictionary.update("BC",[0,0,0]),t._mkDictionary.update("BG",[1,1,1]),t._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg")},i}(ii),hi=function(e){function i(i,r,n){var s=e.call(this)||this;return i&&r&&n&&(s._initialize(i,r,n),s._fieldFlags|=t._FieldFlag.combo),s}return ei(i,e),Object.defineProperty(i.prototype,"_isAutoFontSize",{get:function(){var t=!1;if(this._isLoaded&&this._form){var e=this._form._dictionary;if(e&&e.has("DA")){var i=e.get("DA");if(i){var r=new di(i);if(0===r.fontSize)if(this._kids&&this._kids.length>0){var n=!1;if(this._dictionary.has("DA")&&(i=this._dictionary.get("DA"))&&(r=new di(i))&&r.fontSize>0&&(n=!0),!n)for(var s=0;s<this._kids.length;s++){var a=void 0,o=this._kids[Number.parseInt(s.toString(),10)];if(o&&o instanceof wr&&(a=this._crossReference._fetch(o)),a)if(a.has("DA")){h=0;(i=a.get("DA"))&&(r=new di(i))&&(h=r.fontSize),0===h&&(t=!0)}else t=!0}}else if(this._dictionary.has("DA")){var h=0;(i=this._dictionary.get("DA"))&&(r=new di(i))&&(h=r.fontSize),0===h&&(t=!0)}else t=!0}}}return t},enumerable:!0,configurable:!0}),i._load=function(t,e,r,n){var s=new i;s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids"));var a=s._dictionary.getArray("Opt");return null!==a&&void 0!==a&&(s._listValues=new Array(a.length)),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._kidsCount,i=t.length<=e?t.length:e,r=0;r<i;r++){var n=t[Number.parseInt(r.toString(),10)][1];n&&(this.itemAt(r)._text=n||"")}}},i.prototype._createAppearance=function(e){var i=new Xi;if(e){var r=e.bounds,n=e._getPage();e._isLoaded&&n&&void 0!==n.rotation&&n.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],n.size,n.rotation):i.bounds=[0,0,r.width,r.height],(o=e.backColor)&&(i.backBrush=new Ee(o)),i.foreBrush=new Ee(e.color);h=e.border;if(i.borderPen=new Ve(e.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){_=[(c=[o[0]-64,o[1]-64,o[2]-64])[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ee(_)}i.rotationAngle=e.rotate;var s=void 0!==e.textAlignment?e.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Et(s,a)}else{(r=this.bounds)&&(this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],this.page.size,this.page.rotation):i.bounds=[0,0,r.width,r.height]);var o=this.backColor;o&&(i.backBrush=new Ee(o)),i.foreBrush=new Ee(this.color);var h=this.border;if(i.borderPen=new Ve(this.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ee(_)}i.rotationAngle=this.rotationAngle;var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Et(s,a)}i.required=this.required,null!==i.bounds&&void 0!==i.bounds||(i.bounds=[0,0,0,0]);var d=new Ye(i.bounds,this._crossReference),p=d.graphics;if(p._sw._clear(),this.required||(p._sw._beginMarkupSequence("Tx"),p._initializeCoordinates()),this._isLoaded){var l=void 0;e&&(l=this._obtainFont(e)),void 0!==l&&null!==l||(l=this._appearanceFont),this._drawComboBox(p,i,l,i.stringFormat)}else this._font||(this._font=new Ae(t.PdfFontFamily.timesRoman,this._getFontHeight(t.PdfFontFamily.helvetica))),this._drawComboBox(p,i,this._font,i.stringFormat);return this.required||p._sw._endMarkupSequence(),d},i.prototype._drawComboBox=function(e,i,r,n){e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());var s=this._options,a=this._dictionary.get("I"),o=-1;if(a&&a.length>0&&(o=a[0]),o>=0&&o<s.length){var h=s[Number.parseInt(o.toString(),10)],c=[0,0],_=i.borderWidth,d=2*_,p=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;p?(c[0]=2*d,c[1]=2*_):(c[0]=d+2,c[1]=1*_+1);var l=i.foreBrush,u=i.bounds,f=u[2]-d,g=u;if(g[3]-=p?d:_,e.setClip(g,t.PdfFillMode.winding),0===i.rotationAngle){w=u[0]+_;p&&(w+=_,f-=d),l=new Ee([153,193,218]),e.drawRectangle(w,c[1],f,u[3],l),l=new Ee([0,0,0])}var y=void 0;if(y=h&&Array.isArray(h)?h[1]?h[1]:h[0]:h){var m=[c[0],c[1],f-c[0],u[3]];if(i.rotationAngle>0){var b=e.save();if(90===i.rotationAngle)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),g=[e._size[1]-(g[1]+g[3]),S=g[0],g[3]+g[2],g[2]];else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),g=[g[1],S=e._size[0]-(g[0]+g[2]),g[3]+g[2],g[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var v=e._size[0]-(g[0]+g[2]),S=e._size[1]-(g[1]+g[3]);g=[v,S,g[2],g[3]]}var w=u[0]+_;p&&(w+=_,f-=d),l=new Ee([153,193,218]),e.drawRectangle(w,c[1],f,u[3],l),l=new Ee([0,0,0]),e.drawString(y,r,m,null,l,n),e.restore(b)}else e.drawString(y,r,m,null,l,n)}}e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())},i.prototype._getFontHeight=function(e){var i,r,n,s,a,o=this._dictionary.get("I"),h=this.border.width;if(this._isLoaded){r=new Ae(e,12),n=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),s=this._dictionary.getArray("Opt"),a=this.bounds;var c=[];if(o&&o.length>0)o.forEach(function(t){c.push(r.measureString(s[Number.parseInt(t.toString(),10)][1],[0,0],n,0,0)[0])});else if(s.length>0)for(var _=r.measureString(s[0][1],[0,0],n,0,0)[0],d=1;d<s.length;++d){f=r.measureString(s[Number.parseInt(d.toString(),10)][1],[0,0],n,0,0)[0];_=Math.max(_,f),c.push(_)}i=c.length>0?12*(a.width-4*h)/c.sort()[c.length-1]:12}else{if(i=0,!(o&&o.length>0))return i;r=new Ae(e,12),n=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),s=this._dictionary.getArray("Opt");f=r.measureString(s[o[0]][1],[0,0],n,0,0)[0];a=this.bounds,i=f?12*(a.width-4*h)/f:12}var p=0;if(o&&o.length>0){if(12!==i){r=new Ae(e,i);var l=s[o[0]][1],u=r.measureString(l,[0,0],n,0,0);if(u[0]>a.width||u[1]>a.height)for(var f=a.width-4*h,g=a.height-4*h,d=1;d<=a.height;d++){r._size=d;var y=r.measureString(l,[0,0],n,0,0);if(y[0]>a.width||y[1]>g){p=d;do{p-=.001,r._size=p;var m=r.getLineWidth(l,n);if(p<.248){r._size=.248;break}if(y=r.measureString(l,[0,0],n,0,0),m<f&&y[1]<g){r._size=p;break}}while(p>.248);i=p;break}}}}else i>12&&(i=12);return i},i}(oi),ci=function(e){function i(t,i,r){var n=e.call(this)||this;return t&&i&&r&&n._initialize(t,i,r),n}return ei(i,e),i._load=function(t,e,r,n){var s=new i;s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids"));var a=s._dictionary.getArray("Opt");return null!==a&&void 0!==a&&(s._listValues=new Array(a.length)),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._dictionary.get("I"),i=0;i<t.length;i++)void 0!==e&&null!==e?(this._listValues[Number.parseInt(i.toString(),10)]=t[Number.parseInt(i.toString(),10)][1],i===e?(this.itemAt(i)._text=this._listValues[Number.parseInt(i.toString(),10)],this._selectedIndex=i):this.itemAt(i)._text=this._listValues[Number.parseInt(i.toString(),10)]):this.itemAt(i)._text=""}},i.prototype._createAppearance=function(e){var i=new Xi;if(e){var r=e.bounds,n=e._getPage();e._isLoaded&&n&&void 0!==n.rotation&&n.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],n.size,n.rotation):i.bounds=[0,0,r.width,r.height],(o=e.backColor)&&(i.backBrush=new Ee(o)),i.foreBrush=new Ee(e.color);h=e.border;if(i.borderPen=new Ve(e.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){_=[(c=[o[0]-64,o[1]-64,o[2]-64])[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ee(_)}i.rotationAngle=e.rotate;var s=void 0!==e.textAlignment?e.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Et(s,a)}else{r=this.bounds;this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],this.page.size,this.page.rotation):i.bounds=[0,0,r.width,r.height];var o=this.backColor;o&&(i.backBrush=new Ee(o)),i.foreBrush=new Ee(this.color);var h=this.border;if(i.borderPen=new Ve(this.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ee(_)}i.rotationAngle=this.rotationAngle;var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Et(s,a)}i.required=this.required;var d=new Ye(i.bounds,this._crossReference),p=d.graphics;if(p._sw._clear(),this.required||(p._sw._beginMarkupSequence("Tx"),p._initializeCoordinates()),this._isLoaded){var l=this._obtainFont(e);(void 0===l||null===l||!this._isLoaded&&1===l.size)&&(l=this._appearanceFont),this._drawListBox(p,i,l,i.stringFormat)}else this._font||(this._font=this._defaultItemFont),this._drawListBox(p,i,this._font,i.stringFormat);return this.required||p._sw._endMarkupSequence(),d},i.prototype._drawListBox=function(e,i,r,n){e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());for(var s=this._options,a=this,o=0;o<s.length;++o)!function(o){var h=s[Number.parseInt(o.toString(),10)],c=[],_=i.borderWidth,d=2*_,p=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;p?(c.push(2*d),c.push((o+2)*_+r._metrics._getHeight()*o)):(c.push(d+2),c.push((o+1)*_+r._metrics._getHeight()*o+1));var l=i.foreBrush,u=i.bounds,f=u[2]-d,g=u;g[3]-=p?d:_,e.setClip(g,t.PdfFillMode.winding);var y=!1,m=a._dictionary.get("I");if(null!==m&&void 0!==m&&m.length>0&&m.forEach(function(t){y=y||t===o}),0===i.rotationAngle&&y){w=u[0]+_;p&&(w+=_,f-=d),l=new Ee([153,193,218]),e.drawRectangle(w,c[1],f,r._metrics._getHeight(),l),l=new Ee([0,0,0])}var b=h[1]?h[1]:h[0],v=[c[0],c[1],f-c[0],r._metrics._getHeight()];if(i.rotationAngle>0){var S=e.save();if(90===i.rotationAngle)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),g=[w=e._size[1]-(g[1]+g[3]),P=g[0],g[3]+g[2],g[2]];else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),g=[w=g[1],P=e._size[0]-(g[0]+g[2]),g[3]+g[2],g[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var w=e._size[0]-(g[0]+g[2]),P=e._size[1]-(g[1]+g[3]);g=[w,P,g[2],g[3]]}if(y){w=u[0]+_;p&&(w+=_,f-=d),l=new Ee([153,193,218]),e.drawRectangle(w,c[1],f,r._metrics._getHeight(),l),l=new Ee([0,0,0])}e.drawString(b,r,v,null,l,n),e.restore(S)}else e.drawString(b,r,v,null,l,n)}(o);e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())},i.prototype._getFontHeight=function(e){var i=new Ae(e,12,t.PdfFontStyle.regular),r=new Et(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),n=0;if(this._listValues.length>0){for(var s=i.measureString(this._listValues[0],[0,0],r,0,0)[0],a=1;a<this._listValues.length;++a){var o=i.measureString(this._listValues[Number.parseInt(a.toString(),10)],[0,0],r,0,0)[0];s=s>o?s:o}n=(n=12*(this.bounds.width-4*this.border.width)/s)>12?12:n}return n},i}(oi),_i=function(e){function i(t,i,r){var n=e.call(this)||this;return n._isSigned=!1,t&&i&&r&&n._initialize(t,i,r),n}return ei(i,e),Object.defineProperty(i.prototype,"isSigned",{get:function(){return this._isSigned||this._checkSigned(),this._isSigned},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new xr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",vr.get("Sig")),this._dictionary.update("T",e),this._defaultIndex=0,this._initializeFont(this._defaultFont),this._createItem(i)},i.prototype._createItem=function(t){var e=new Vi;e._create(this._page,t,this),e._dictionary.update("MK",new xr(this._crossReference)),e._mkDictionary.update("BC",[0,0,0]),e._mkDictionary.update("BG",[1,1,1]),e._dictionary.update("DA",this._fontName+" 8 Tf 0 0 0 rg"),this._addToKid(e)},i.prototype._doPostProcess=function(t){void 0===t&&(t=!1);var e=this._setAppearance||this._form._setAppearance;if(!this._isLoaded&&(t||e)&&(r=this._kidsCount)>0)for(s=0;s<r;s++)if((a=this.itemAt(s))&&a._dictionary&&(e||t&&!a._dictionary.has("AP"))){var i=this._createAppearance(a,t);this._addAppearance(a._dictionary,i,"N")}if(t){var r=this._kidsCount;if(r>0)for(var n=void 0,s=0;s<r;s++){var a=this.itemAt(s);if(a&&a._dictionary){var o=a._getPage();o&&(n||0!==s||(n=this._getItemTemplate(a._dictionary)),this._flattenSignature(a._dictionary,o,a.bounds,n))}}else this._flattenSignature(this._dictionary,this.page,this.bounds)}},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Ye([0,0,i.width,i.height],this._crossReference);$(r,null),r._writeTransformation=!1;var n=r.graphics,s=new Xi;s.bounds=[0,0,i.width,i.height];var a=t.backColor;e&&a&&(s.backBrush=new Ee(a)),s.foreBrush=new Ee(t.color);var o=t.border;if(s.borderPen=new Ve(t.borderColor,o.width),s.borderStyle=o.style,s.borderWidth=o.width,a){var h=[a[0]-64,a[1]-64,a[2]-64],c=[h[0]>=0?h[0]:0,h[1]>=0?h[1]:0,h[2]>=0?h[2]:0];s.shadowBrush=new Ee(c)}return s.rotationAngle=t.rotate,n.save(),n._initializeCoordinates(),this._drawRectangularControl(n,s),n.restore(),r},i.prototype._flattenSignature=function(e,i,r,n){var s;if(e.has("AP")){var a=e.get("AP");if(a&&a.has("N")){var o=a.get("N"),h=a.getRaw("N");if(h&&o&&(o.reference=h),o&&(s=n||new Ye(o,this._crossReference))&&i){_=(c=i.graphics).save();i.rotation!==t.PdfRotationAngle.angle0?c.drawTemplate(s,this._calculateTemplateBounds(r,i,s,c)):c.drawTemplate(s,r),c.restore(_)}}}else if(n&&i){s=n;var c=i.graphics,_=c.save();i.rotation!==t.PdfRotationAngle.angle0?c.drawTemplate(s,this._calculateTemplateBounds(r,i,s,c)):c.drawTemplate(s,r),c.restore(_)}},i.prototype._calculateTemplateBounds=function(t,e,i,r){var n=t.x,s=t.y;if(e){var a=this._obtainGraphicsRotation(r._matrix);90===a?(r.translateTransform(i._size[1],0),r.rotateTransform(90),n=t.x,s=-(e._size[1]-t.y-t.height)):180===a?(r.translateTransform(i._size[0],i._size[1]),r.rotateTransform(180),n=-(e._size[0]-(t.x+i._size[0])),s=-(e._size[1]-t.y-i._size[1])):270===a&&(r.translateTransform(0,i._size[0]),r.rotateTransform(270),n=-(e._size[0]-t.x-t.width),s=t.y)}return{x:n,y:s,width:t.width,height:t.height}},i.prototype._obtainGraphicsRotation=function(t){var e=Math.round(180*Math.atan2(t._matrix._elements[2],t._matrix._elements[0])/Math.PI);switch(e){case-90:e=90;break;case-180:e=180;break;case 90:e=270}return e},i.prototype._getItemTemplate=function(t){var e;if(t.has("AP")){var i=t.get("AP");if(i&&i.has("N")){var r=i.get("N"),n=i.getRaw("N");n&&(r.reference=n),r&&(e=new Ye(r,this._crossReference))}}return e},i.prototype._checkSigned=function(){if(this._dictionary&&this._dictionary.has("V")){var t=this._dictionary.get("V");null!==t&&void 0!==t&&t.size>0&&(this._isSigned=!0)}},i}(ii),di=function(){function t(t){var e,i="",r=0;if(t&&"string"==typeof t&&""!==t)for(var n=t.split(" "),s=0;s<n.length;s++)switch(n[Number.parseInt(s.toString(),10)]){case"g":e=[Number.parseFloat(n[s-1])];break;case"rg":e=[Number.parseFloat(n[s-3]),Number.parseFloat(n[s-2]),Number.parseFloat(n[s-1])];break;case"k":e=[Number.parseFloat(n[s-4]),Number.parseFloat(n[s-3]),Number.parseFloat(n[s-2]),Number.parseFloat(n[s-1])];break;case"Tf":r=Number.parseFloat(n[s-1]),(i=n[s-2].substring(1)).includes("#2C")&&i.replace("#2C",",")}this.fontName=i,this.fontSize=r,this.color=void 0!==e?L(e):[0,0,0]}return t.prototype.toString=function(){var t=[Number.parseFloat((this.color[0]/255).toFixed(3)),Number.parseFloat((this.color[1]/255).toFixed(3)),Number.parseFloat((this.color[2]/255).toFixed(3))];return"/"+this.fontName+" "+this.fontSize+" Tf "+t[0].toString()+" "+t[1].toString()+" "+t[2].toString()+" rg"},t}(),pi=function(){function t(t,e){this._dictionary=new xr,this._annotations=t,this._crossReference=t._crossReference,void 0!==e&&(this._bounds=e),this._initialize()}return Object.defineProperty(t.prototype,"normal",{get:function(){return!this._templateNormal&&this._dictionary.has("AP")&&(this._templateNormal=this._dictionary.get("N")),this._templateNormal},set:function(t){t&&(this._templateNormal=t,this._dictionary.set("N",this._templateNormal))},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this.normal=new Ye(this._bounds,this._crossReference)},t}(),li=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ui=function(){function e(){this._isImported=!1,this._isLoaded=!1,this._setAppearance=!1,this._isExport=!1,this._opacity=1,this._isAllRotation=!0,this._flatten=!1,this._hasData=!1,this._popUpFont=new Ae(t.PdfFontFamily.helvetica,10.5),this._authorBoldFont=new Ae(t.PdfFontFamily.helvetica,10.5,t.PdfFontStyle.bold),this._lineCaptionFont=new Ae(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._circleCaptionFont=new Ae(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular),this._isTransparentColor=!1}return Object.defineProperty(e.prototype,"author",{get:function(){if(void 0===this._author&&this._dictionary.has("Author")&&(t=this._dictionary.get("Author"))&&(this._author=t),void 0===this._author&&this._dictionary.has("T")){var t=this._dictionary.get("T");t&&(this._author=t)}return this._author},set:function(t){if(this._isLoaded&&"string"==typeof t&&t!==this.author){var e=!1;this._dictionary.has("T")&&(this._dictionary.update("T",t),this._author=t,e=!0),this._dictionary.has("Author")&&(this._dictionary.update("Author",t),this._author=t,e=!0),e||(this._dictionary.update("T",t),this._author=t)}this._isLoaded||"string"!=typeof t||this._dictionary.update("T",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){if(void 0===this._border){var e=new Ki;if(e._dictionary=this._dictionary,this._dictionary.has("Border")&&(i=this._dictionary.getArray("Border"))&&i.length>=3&&(e._hRadius=i[0],e._vRadius=i[1],e._width=i[2]),this._dictionary.has("BS")){var i=this._dictionary.get("BS");if(i){if(i.has("W")){var r=i.get("W");void 0===r||Number.isNaN(r)||(e._width=r)}if(i.has("S")){var n=i.get("S");if(n)switch(n.name){case"D":e._style=t.PdfBorderStyle.dashed;break;case"B":e._style=t.PdfBorderStyle.beveled;break;case"I":e._style=t.PdfBorderStyle.inset;break;case"U":e._style=t.PdfBorderStyle.underline;break;default:e._style=t.PdfBorderStyle.solid}}if(i.has("D")){var s=i.getArray("D");s&&(e._dash=s)}}}this._border=e}return this._border},set:function(t){var e,i=this.border;(!this._isLoaded||void 0!==t.width&&i.width!==t.width)&&(e=t.width);var r;(!this._isLoaded||void 0!==t.hRadius&&i.hRadius!==t.hRadius)&&(r=t.hRadius);var n;(!this._isLoaded||void 0!==t.vRadius&&i.vRadius!==t.vRadius)&&(n=t.vRadius);var s;(!this._isLoaded||void 0!==t.style&&i.style!==t.style)&&(s=t.style);var a;if(void 0!==t.dash&&i.dash!==t.dash&&(a=t.dash),!this._isWidget&&(this._dictionary.has("Border")||e||n||r)&&(this._border._hRadius=void 0!==r?r:i.hRadius,this._border._vRadius=void 0!==n?n:i.vRadius,this._border._width=void 0!==e?e:i.width,this._dictionary.update("Border",[this._border.hRadius,this._border.vRadius,this._border.width])),this._dictionary.has("BS")||e||s||a){this._border._width=void 0!==e?e:i.width,this._border._style=void 0!==s?s:i.style,this._border._dash=void 0!==a?a:i.dash;var o=this._dictionary.has("BS")?this._dictionary.get("BS"):new xr(this._crossReference);o.update("Type",vr.get("Border")),o.update("W",this._border.width),o.update("S",M(this._border.style)),void 0!==this._border.dash&&o.update("D",this._border.dash),this._dictionary.update("BS",o),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return void 0===this._annotFlags&&(this._annotFlags=t.PdfAnnotationFlag.default,this._dictionary.has("F")&&(this._annotFlags=this._dictionary.get("F"))),this._annotFlags},set:function(t){void 0!==t&&t!==this._annotFlags&&(this._annotFlags=t,this._dictionary.update("F",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return void 0===this._color&&this._dictionary.has("C")&&(this._color=L(this._dictionary.getArray("C"))),this._color},set:function(t){if(void 0!==t&&3===t.length){var e=this.color;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._color=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(7)),Number.parseFloat((t[1]/255).toFixed(7)),Number.parseFloat((t[2]/255).toFixed(7))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"innerColor",{get:function(){return void 0===this._innerColor&&this._dictionary.has("IC")&&(this._innerColor=L(this._dictionary.getArray("IC"))),this._innerColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.innerColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._innerColor=t,this._dictionary.update("IC",[Number.parseFloat((t[0]/255).toFixed(7)),Number.parseFloat((t[1]/255).toFixed(7)),Number.parseFloat((t[2]/255).toFixed(7))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"creationDate",{get:function(){if((void 0===this._creationDate||null===this._creationDate)&&this._dictionary.has("CreationDate")){var t=this._dictionary.get("CreationDate");null!==t&&"string"==typeof t&&(this._creationDate=this._stringToDate(t))}return this._creationDate},set:function(t){this._creationDate=t,this._dictionary.update("CreationDate",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modifiedDate",{get:function(){if(void 0===this._modifiedDate||null===this._modifiedDate){var t=void 0;this._dictionary.has("ModDate")?t=this._dictionary.get("ModDate"):this._dictionary.has("M")&&(t=this._dictionary.get("M")),null!==t&&"string"==typeof t&&(this._modifiedDate=this._stringToDate(t))}return this._modifiedDate},set:function(t){this._modifiedDate=t,this._dictionary.update("M",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return this._isLoaded&&(this._bounds=N(this._dictionary,this._page)),this._bounds},set:function(t){if(t)if(this._isBounds=!0,this._isLoaded){if(t.x!==this.bounds.x||t.y!==this.bounds.y||t.width!==this.bounds.width||t.height!==this.bounds.height){var e=this._page.size;if(e){var i=e[1]-(t.y+t.height),r=i+t.height;this._dictionary.update("Rect",[t.x,i,t.x+t.width,r]),this._bounds=t}}}else this._bounds=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"caption",{get:function(){if(void 0===this._caption){var e=new Wi;if(e._dictionary=this._dictionary,this._dictionary.has("Cap")&&(e._cap=this._dictionary.get("Cap")),this._dictionary.has("CP")){var i=this._dictionary.get("CP");i&&(e._type="Top"===i.name?t.PdfLineCaptionType.top:t.PdfLineCaptionType.inline)}this._dictionary.has("CO")&&(e._offset=this._dictionary.getArray("CO")),this._caption=e}return this._caption},set:function(t){var e=this.caption;t&&(this._isLoaded&&t.cap===e.cap||(this._caption.cap=t.cap),this._isLoaded&&t.type===e.type||(this._caption.type=t.type),this._isLoaded&&t.offset===e.offset||(this._caption.offset=t.offset))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"opacity",{get:function(){if(this._dictionary.has("CA")){var t=this._dictionary.get("CA");void 0!==t&&(this._opacity=t)}return this._opacity},set:function(t){void 0===t||Number.isNaN(t)||(t>=0&&t<=1?(this._dictionary.update("CA",t),this._opacity=t):t<0?this._dictionary.update("CA",0):this._dictionary.update("CA",1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subject",{get:function(){return void 0===this._subject&&(this._subject=this._dictionary.get("Subject","Subj")),this._subject},set:function(t){if("string"==typeof t){var e=!1;this._dictionary.has("Subj")&&(this._dictionary.update("Subj",t),this._subject=t,e=!0),e&&!this._dictionary.has("Subject")||(this._dictionary.update("Subject",t),this._subject=t)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return void 0===this._name&&this._dictionary.has("NM")&&(this._name=this._dictionary.get("NM")),this._name},set:function(t){"string"==typeof t&&(this._dictionary.update("NM",t),this._name=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return void 0===this._text&&this._dictionary.has("Contents")&&(this._text=this._dictionary.get("Contents")),this._text},set:function(t){"string"==typeof t&&(this._text=this._dictionary.get("Contents"),t!==this._text&&(this._dictionary.update("Contents",t),this._text=t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){return void 0===this._rotate&&this._dictionary.has("Rotate")&&(this._rotate=this._dictionary.get("Rotate")/90),null!==this._rotate&&void 0!==this._rotate||(this._rotate=t.PdfRotationAngle.angle0),this._rotate},set:function(t){var e=this.rotationAngle;void 0!==t&&void 0!==e&&(t=(t+e)%4),this._dictionary.update("Rotate",90*t),this._rotate=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){var t=this._getRotationAngle();return t<0&&(t=360+t),t>=360&&(t=360-t),t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flattenPopups",{get:function(){return this._isFlattenPopups},set:function(t){void 0!==t&&(this._isFlattenPopups=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_hasFlags",{get:function(){return this._dictionary.has("F")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_degreeToRadian",{get:function(){return void 0===this._ratio&&(this._ratio=Math.PI/180),this._ratio},enumerable:!0,configurable:!0}),e.prototype.setAppearance=function(t){this._setAppearance=t,t&&(this._dictionary._updated=!0)},e.prototype.getValues=function(t){var e=[];if(!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(Array.isArray(i)){i=this._dictionary.getArray(t);for(var r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n instanceof vr?e.push(n.name):"string"==typeof n?e.push(n):"number"==typeof n&&e.push(n.toString())}}else if(i instanceof vr)e.push(i.name);else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e.push(i)}return e},e.prototype.setValues=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},e.prototype._initialize=function(t,e){this._page=t,this._crossReference=t._crossReference,e&&(this._dictionary=e),this._isLoaded||(this._dictionary.set("P",this._page._ref),this._dictionary.assignXref(this._crossReference))},e.prototype._getRotationAngle=function(){var t=0;return this._dictionary.has("Rotate")?t=this._dictionary.get("Rotate"):this._dictionary.has("Rotation")&&(t=this._dictionary.get("Rotation")),t},e.prototype._getBoundsValue=function(t){var e=t.length,i=[],r=[];if(t&&e>0){for(var n=[],s=0;s<t.length;s++){var a=t[Number.parseInt(s.toString(),10)];n.push(a)}for(var o=0,h=0,s=0;s<n.length;s++)s%2==0?(i[Number.parseInt(o.toString(),10)]=n[Number.parseInt(s.toString(),10)],o++):(r[Number.parseInt(h.toString(),10)]=n[Number.parseInt(s.toString(),10)],h++)}return i.sort(function(t,e){return t>e?1:-1}),r.sort(function(t,e){return t>e?1:-1}),{x:i[0],y:r[0],width:i[i.length-1]-i[0],height:r[r.length-1]-r[0]}},e.prototype._validateTemplateMatrix=function(t,e){var i=!1,r=!0;if(null===e||void 0===e){if(t&&t.has("Matrix")){if((d=t.getArray("Matrix"))&&d.length>3&&void 0!==d[0]&&void 0!==d[1]&&void 0!==d[2]&&void 0!==d[3]&&1===d[0]&&0===d[1]&&0===d[2]&&1===d[3]){i=!0;var n=0,s=0,a=0,o=0;d.length>4&&(a=-d[4],d.length>5&&(o=-d[5]));var h=void 0;this._dictionary.has("Rect")&&(h=this._dictionary.getArray("Rect"))&&h.length>1&&(n=h[0],s=h[1]),n===a&&s===o||0!==a||0!==o||(this._locationDisplaced=!0)}}else i=!0;return i}var c=this.bounds;if(t&&t.has("Matrix")){var _=t.getArray("BBox"),d=t.getArray("Matrix");if(d&&_&&d.length>3&&_.length>2&&void 0!==d[0]&&void 0!==d[1]&&void 0!==d[2]&&void 0!==d[3]&&1===d[0]&&0===d[1]&&0===d[2]&&1===d[3]&&void 0!==_[0]&&void 0!==_[1]&&void 0!==_[2]&&void 0!==_[3]&&(_[0]!==-d[4]&&_[1]!==-d[5]||0===_[0]&&0==-d[4])){var p=this._page.graphics,l=p.save();void 0!==this.opacity&&this._opacity<1&&p.setTransparency(this._opacity),c.x-=_[0],c.y+=_[1],p.drawTemplate(e,c),p.restore(l),this._removeAnnotationFromPage(this._page,this),r=!1}}return r},e.prototype._flattenAnnotationTemplate=function(e,i){var r=this._page.graphics,n=this.bounds;if(this._type===t._PdfAnnotationType.lineAnnotation&&!this._dictionary.has("AP"))if(n=this._isLoaded?this._bounds:C([this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]),this._page){var s=this._page.size,a=this._page.mediaBox,o=this._page.cropBox;o&&Array.isArray(o)&&4===o.length&&this._page._pageDictionary.has("CropBox")&&!this._isLoaded?0===o[0]&&0===o[1]&&s[0]!==o[2]&&s[1]!==o[3]||n.x===o[0]?n.y=s[1]-(n.y+n.height):(n.x-=o[0],n.y=o[3]-(n.y+n.height)):a&&Array.isArray(a)&&4===a.length&&this._page._pageDictionary.has("MediaBox")&&!this._isLoaded?a[0]>0||a[1]>0||s[0]===a[2]||s[1]===a[3]?(n.x-=a[0],n.y=a[3]-(n.y+n.height)):n.y=s[1]-(n.y+n.height):this._isLoaded||(n.y=s[1]-(n.y+n.height))}else n.y=n.y+n.height;if(void 0!==n&&null!==n){var h=r.save();if(this._page._needInitializeGraphics=!0,this._type===t._PdfAnnotationType.rubberStampAnnotation){y=!0;if(this._dictionary.has("AP")){var c=this._dictionary.get("AP");if(c&&c.has("N")){var _=c.get("N");this.rotate===t.PdfRotationAngle.angle270&&this._page.rotation===t.PdfRotationAngle.angle270&&_.dictionary.has("Matrix")&&(u=_.dictionary.getArray("Matrix"))&&6===u.length&&0===u[4]&&0!==u[5]&&(y=!1)}!i&&this.rotate!==t.PdfRotationAngle.angle180&&y&&(e._isAnnotationTemplate=!0,e._needScale=!0)}}i||this._type===t._PdfAnnotationType.rubberStampAnnotation||(e._isAnnotationTemplate=!0,e._needScale=!0),void 0!==this.opacity&&this._opacity<1&&r.setTransparency(this._opacity);var d=this._calculateTemplateBounds(n,this._page,e,i,r);if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var p,s=void 0;this.rotate===t.PdfRotationAngle.angle0?(s=[d.width,d.height],p=[d.x,d.y]):(s=e._size,p=[d.x,d.y]);var l=!1;if(this.rotate!==t.PdfRotationAngle.angle0&&e._content&&e._content.dictionary.has("Matrix")){var u=e._content.dictionary.getArray("Matrix");u&&6===u.length&&0===u[4]&&0!==u[5]&&(l=!0)}var f=e._size[0]>0?d.width/e._size[0]:1,g=e._size[1]>0?d.height/e._size[1]:1,y=!(1===f&&1===g);this.rotate!==t.PdfRotationAngle.angle0&&l&&(this.rotate===t.PdfRotationAngle.angle90?this._page.rotation===t.PdfRotationAngle.angle270?!y||0===d.x&&0===d.y?(p[0]+=s[1],p[1]+=s[0]-s[1]+(s[0]-s[1])):(p[0]+=s[0]-s[1],p[1]+=s[0]):y||(p[0]+=s[1]):this.rotate===t.PdfRotationAngle.angle270?this._page.rotation===t.PdfRotationAngle.angle270?y&&e._isAnnotationTemplate?p[1]=d.y-d.width:y&&(p[1]+=s[0]-s[1]):y||0===d.x&&0===d.y?p[1]+=-(s[0]-s[1]):p[1]+=-s[0]:this.rotate===t.PdfRotationAngle.angle180&&(p[0]+=s[0],p[1]+=-s[1]))}r.drawTemplate(e,d),r.restore(h)}this._removeAnnotationFromPage(this._page,this)},e.prototype._calculateTemplateBounds=function(e,i,r,n,s){var a=e,o=e.x,h=e.y,c=e.width,_=e.height;if(!n){var d=this._dictionary.getArray("Rect");d&&(a=C(d))}if(void 0!==i){var p=this._obtainGraphicsRotation(s._matrix);if(90===p)s.translateTransform(r._size[1],0),s.rotateTransform(90),n||void 0!==this._rotate&&this._rotate===t.PdfRotationAngle.angle180?(o=e.x,h=this._locationDisplaced?i._origin&&0!==i._o[1]?e.y+e.height:-(i.size[1]-(e.height+e.y)+(e.height-r._size[1])):-(i.size[1]-e.y-e.height)):(o=e.x,h=-(i.size[1]-(e.height+e.y)+(e.width-r._size[1])),c=e.height,_=e.width);else if(180===p)s.translateTransform(r._size[0],r._size[1]),s.rotateTransform(180),n?(o=-(i.size[0]-(e.x+e.width)),h=-(i.size[1]-e.y-e.height)):(o=-(i.size[0]-(e.x+r._size[0])),h=-(i.size[1]-e.y-r._size[1]),void 0===this.rotationAngle||this._rotate!==t.PdfRotationAngle.angle90&&this._rotate!==t.PdfRotationAngle.angle270||(h=-(i.size[1]-e.y-r._size[1])-(e.width-e.height),c=e.height,_=e.width));else if(270===p)if(s.translateTransform(0,r._size[0]),s.rotateTransform(270),n||void 0!==this.rotationAngle&&this._rotate===t.PdfRotationAngle.angle180)o=-(i.size[0]-e.x-e.width),h=e.y;else{o=-(i.size[0]-a.x-r._size[0]);var l=r._content.dictionary.getArray("Matrix"),u=r._content.dictionary.getArray("BBox");h=l&&u&&l[5]!==u[2]?e.y-(e.height-e.width):e.y+e.height-e.width,c=e.height,_=e.width}else 0===p&&(n||void 0===this.rotationAngle||this.rotationAngle!==t.PdfRotationAngle.angle90&&this.rotationAngle!==t.PdfRotationAngle.angle270||(o=e.x,h=e.y+e.height-e.width,c=e.height,_=e.width))}return{x:o,y:h,width:c,height:_}},e.prototype._obtainGraphicsRotation=function(t){var e=Math.atan2(t._matrix._elements[2],t._matrix._elements[0]),i=Math.round(180*e/Math.PI);switch(i){case-90:i=90;break;case-180:i=180;break;case 90:i=270}return i},e.prototype._removeAnnotationFromPage=function(t,e){var i=[];t._pageDictionary&&t._pageDictionary.has("Annots")&&(i=t._pageDictionary.get("Annots")),e._dictionary.set("P",t._ref);var r=i.indexOf(e._ref);-1!==r&&(i.splice(r,1),this._crossReference._cacheMap.has(e._ref)&&this._crossReference._cacheMap.delete(e._ref)),t._pageDictionary.set("Annots",i)},e.prototype._removeAnnotation=function(t,e){t&&e&&(this._removeAnnotationFromPage(t,e),t._pageDictionary._updated=!0)},e.prototype._drawCloudStyle=function(t,e,i,r,n,s,a){if(this._isClockWise(s)){for(var o=[],h=s.length-1;h>=0;h--)o.push(s[Number.parseInt(h.toString(),10)]);s=o}for(var c=[],_=2*r*n,d=s[s.length-1],h=0;h<s.length;h++){var p=s[Number.parseInt(h.toString(),10)],l=p[0]-d[0],u=p[1]-d[1],f=Math.sqrt(l*l+u*u);l/=f,u/=f;for(var g=0;g+.1*_<f;g+=_){var y=new Ji;y.point=[d[0]+g*l,d[1]+g*u],c.push(y)}d=p}for(var m=c[c.length-1],h=0;h<c.length;h++){var b=c[Number.parseInt(h.toString(),10)],v=this._getIntersectionDegrees(m.point,b.point,r);m.endAngle=v[0],b.startAngle=v[1],m=b}for(var S=new Re,h=0;h<c.length;h++){var w=(I=c[Number.parseInt(h.toString(),10)]).startAngle%360,P=I.endAngle%360,A=0;if(w>0&&P<0)A=180-w+(180-(P<0?-P:P));else if(w<0&&P>0)A=-w+P;else if(w>0&&P>0){A=w>P?360-(w-P):P-w}else if(w<0&&P<0){A=w>P?360-(w-P):-(w+-P)}A<0&&(A=-A),I.endAngle=A,S._addArc(I.point[0]-r,I.point[1]-r,2*r,2*r,w,A)}S._closeFigure();var k=[];if(a)for(h=0;h<S._points.length;h++)k.push([S._points[Number.parseInt(h.toString(),10)][0],-S._points[Number.parseInt(h.toString(),10)][1]]);var x;a?((x=new Re)._points=k,x._pathTypes=S._pathTypes):((x=new Re)._points=S._points,x._pathTypes=S._pathTypes),null!==e&&t._drawPath(x,null,e);var T=180/(3*Math.PI);S=new Re;for(h=0;h<c.length;h++){var I=c[Number.parseInt(h.toString(),10)];S._addArc(I.point[0]-r,I.point[1]-r,2*r,2*r,I.startAngle,I.endAngle+T)}if(S._closeFigure(),k=[],a)for(h=0;h<S._points.length;h++)k.push([S._points[Number.parseInt(h.toString(),10)][0],-S._points[Number.parseInt(h.toString(),10)][1]]);a?((x=new Re)._points=k,x._pathTypes=S._pathTypes):((x=new Re)._points=S._points,x._pathTypes=S._pathTypes),t._drawPath(x,i,null)},e.prototype._isClockWise=function(t){for(var e=0,i=0;i<t.length;i++){var r=t[Number.parseInt(i.toString(),10)],n=t[(i+1)%t.length];e+=(n[0]-r[0])*(n[1]+r[1])}return e>0},e.prototype._getIntersectionDegrees=function(t,e,i){var r=e[0]-t[0],n=e[1]-t[1],s=.5*Math.sqrt(r*r+n*n)/i;s<-1?s=-1:s>1&&(s=1);var a=Math.atan2(n,r),o=Math.acos(s);return[(a-o)*(180/Math.PI),(Math.PI+a+o)*(180/Math.PI)]},e.prototype._obtainStyle=function(e,i,r,n){var s=this.border.dash;if(s&&s.length>0){for(var a=[],o=!1,h=0;h<s.length;h++)a[Number.parseInt(h.toString(),10)]=s[Number.parseInt(h.toString(),10)],a[Number.parseInt(h.toString(),10)]>0&&(o=!0);o&&this.border.style===t.PdfBorderStyle.dashed&&(e._dashStyle=t.PdfDashStyle.dash,e._dashPattern=a)}if(n)if(n instanceof Xi)!this._isBounds&&this._dictionary.has("RD")?(_=this._dictionary.getArray("RD"))&&(i[0]=i[0]+_[0],i[1]=i[1]+r+_[1],i[2]=i[2]-(_[0]+_[2]),i[3]=i[3]-(_[1]+_[3])):(i[0]=i[0]+r,i[1]=i[1]+r,i[2]=i[2]-this.border.width,i[3]=i[3]-this.border.width),n.bounds=i;else if(0!==n.intensity&&n.style===t.PdfBorderEffectStyle.cloudy){var c=5*n.intensity;i[0]=i[0]+c+r,i[1]=i[1]+c+r,i[2]=i[2]-2*c-2*r,i[3]=i[3]-2*c-2*r}else i[0]=i[0]+r,i[1]=i[1]+r,i[2]=i[2]-this.border.width,i[3]=this.bounds.height-this.border.width;else if(!this._isBounds&&this._dictionary.has("RD")){var _=this._dictionary.getArray("RD");_&&(i[0]=i[0]+_[0],i[1]=i[1]+r+_[1],i[2]=i[2]-2*_[2],i[3]=i[3]-this.border.width,i[3]=i[3]-2*_[3])}else i[1]=i[1]+r,i[3]=this.bounds.height-this.border.width;return i},e.prototype._createRectangleAppearance=function(e){var i=this.border.width,r=this._dictionary.getArray("RD");if(!r&&0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy){n={x:this.bounds.x-5*e.intensity-i/2,y:this.bounds.y-5*e.intensity-i/2,width:this.bounds.width+10*e.intensity+i,height:this.bounds.height+10*e.intensity+i};r=[(s=5*e.intensity)+i/2,s+i/2,s+i/2,s+i/2],this._dictionary.set("RD",r),this.bounds=n}if(!this._isBounds&&r){var n={x:this.bounds.x+r[0],y:this.bounds.y+r[1],width:this.bounds.width-2*r[2],height:this.bounds.height-2*r[3]};if(0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy){n.x=n.x-5*e.intensity-i/2,n.y=n.y-5*e.intensity-i/2,n.width=n.width+10*e.intensity+i,n.height=n.height+10*e.intensity+i;var s=5*e.intensity;this._dictionary.set("RD",[s+i/2,s+i/2,s+i/2,s+i/2])}else delete this._dictionary._map.RD;this.bounds=n}var a=i/2,o=[0,0,this.bounds.width,this.bounds.height],h=new Ye(o,this._crossReference);$(h,this._getRotationAngle()),0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy&&(h._writeTransformation=!1);var c=h.graphics,_=new Xi;this.innerColor&&(_.backBrush=new Ee(this._innerColor)),i>0&&this.color&&(_.borderPen=new Ve(this._color,i)),this.color&&(_.foreBrush=new Ee(this._color));var d=this._obtainStyle(_.borderPen,o,a,e);return void 0!==this.opacity&&this._opacity<1&&(c.save(),c.setTransparency(this._opacity)),0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy?this._drawRectangleAppearance(d,c,_,e.intensity):c.drawRectangle(d[0],d[1],d[2],d[3],_.borderPen,_.backBrush),void 0!==this.opacity&&this._opacity<1&&c.restore(),h},e.prototype._drawRectangleAppearance=function(t,e,i,r){var n=new Re;n._addRectangle(t[0],t[1],t[2],t[3]);var s=4.25*r;if(s>0){for(var a=[],o=0;o<n._points.length;o++){var h=[n._points[Number.parseInt(o.toString(),10)][0],-n._points[Number.parseInt(o.toString(),10)][1]];a.push(h)}(n=new Re)._addPolygon(a),this._drawCloudStyle(e,i.backBrush,i.borderPen,s,.833,n._points,!1)}else e.drawRectangle(t[0],t[1],t[2],t[3],i.borderPen,i.backBrush)},e.prototype._createCircleAppearance=function(){var t=[0,0,this.bounds.width,this.bounds.height],e=new Ye(t,this._crossReference);$(e,this._getRotationAngle()),this._dictionary.has("BE")&&(e._writeTransformation=!1),void 0===this.color&&(this._isTransparentColor=!0);var i=e.graphics,r=this.border.width,n=new Ve(this.color,r),s=new Xi;this.innerColor&&(s.backBrush=new Ee(this._innerColor)),r>0&&(s.borderPen=n),this.color&&(s.foreBrush=new Ee(this._color)),s.borderWidth=r;var a=r/2,o=this._obtainStyle(n,t,a);return void 0!==this.opacity&&this._opacity<1&&(i.save(),i.setTransparency(this._opacity)),this._dictionary.has("BE")?this._drawCircleAppearance(o,a,i,s):i.drawEllipse(o[0]+a,o[1],o[2]-r,o[3],s.borderPen,s.backBrush),void 0!==this._opacity&&this._opacity<1&&i.restore(),e},e.prototype._drawCircleAppearance=function(t,e,i,r){var n=0;if(this._dictionary.has("RD")){var s=this._dictionary.getArray("RD");s&&s.length>0&&(n=s[0])}if(n>0){var a=[t[0]+e,-t[1]-t[3],t[2]-this.border.width,t[3]],o=a[0],h=a[1],c=a[0]+a[2],_=a[1]+a[3],d=[];d.push([c,_]),d.push([o,_]),d.push([o,h]),d.push([c,h]);var p=[];p.push([c,h+a[3]/2]),p.push([o+a[2]/2,_]),p.push([o,h+a[3]/2]),p.push([o+a[2]/2,h]);var l=[];l.push([o+a[2]/2,_]),l.push([o,h+a[3]/2]),l.push([o+a[2]/2,h]),l.push([c,h+a[3]/2]);for(var u=[],f=0;f<d.length;f++)this._createBezier(p[Number.parseInt(f.toString(),10)],d[Number.parseInt(f.toString(),10)],l[Number.parseInt(f.toString(),10)],u);this._drawCloudStyle(i,r.backBrush,r.borderPen,n,.833,u,!1)}else i.drawEllipse(t[0]+e,-t[1],t[2]-this.border.width,-t[3],r.borderPen,r.backBrush)},e.prototype._createBezier=function(t,e,i,r){r.push(t),this._populateBezierPoints(t,e,i,0,r),r.push(i)},e.prototype._populateBezierPoints=function(t,e,i,r,n){if(r<2){var s=this._midPoint(t,e),a=this._midPoint(e,i),o=this._midPoint(s,a);r++,this._populateBezierPoints(t,s,o,r,n),n.push(o),this._populateBezierPoints(o,a,i,r,n)}},e.prototype._midPoint=function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]},e.prototype._getAngle=function(t){var e=t[0],i=t[1],r=t[2],n=t[3],s=0;if(r-e==0)s=n>i?90:270;else{var a=(n-i)/(r-e);s=Math.atan(a)*(180/Math.PI),(r-e<0||n-i<0)&&(s+=180),r-e>0&&n-i<0&&(s-=180),s<0&&(s+=360)}return s},e.prototype._getAxisValue=function(t,e,i){return[t[0]+Math.cos(e*this._degreeToRadian)*i,t[1]+Math.sin(e*this._degreeToRadian)*i]},e.prototype._drawLineEndStyle=function(e,i,r,n,s,a,o,h){var c,_,d,p,l,u,f,g;switch(a){case t.PdfLineEndingStyle.square:i.drawRectangle(e[0]-3*o,-(e[1]+3*o),6*o,6*o,n,s);break;case t.PdfLineEndingStyle.circle:i.drawEllipse(e[0]-3*o,-(e[1]+3*o),6*o,6*o,n,s);break;case t.PdfLineEndingStyle.openArrow:c=h?30:150,_=9*o,d=this._getAxisValue(e,r,h?o:-o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),(g=new Re)._pen=n,g._addLine(d[0],-d[1],p[0],-p[1]),g._addLine(d[0],-d[1],l[0],-l[1]),i._stateControl(n,null,null),i._buildUpPath(g._points,g._pathTypes),i._drawGraphicsPath(n,null,g._fillMode,!1);break;case t.PdfLineEndingStyle.closedArrow:c=h?30:150,_=9*o,d=this._getAxisValue(e,r,h?o:-o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),i.drawPolygon([[d[0],-d[1]],[p[0],-p[1]],[l[0],-l[1]]],n,s);break;case t.PdfLineEndingStyle.rOpenArrow:c=h?150:30,_=9*o,d=this._getAxisValue(e,r,h?-o:o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),(g=new Re)._pen=n,g._addLine(d[0],-d[1],p[0],-p[1]),g._addLine(d[0],-d[1],l[0],-l[1]),i._stateControl(n,null,null),i._buildUpPath(g._points,g._pathTypes),i._drawGraphicsPath(n,null,g._fillMode,!1);break;case t.PdfLineEndingStyle.rClosedArrow:c=h?150:30,_=9*o,d=this._getAxisValue(e,r,h?-o:o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),i.drawPolygon([[d[0],-d[1]],[p[0],-p[1]],[l[0],-l[1]]],n,s);break;case t.PdfLineEndingStyle.slash:_=9*o,p=this._getAxisValue(d,r+60,_),l=this._getAxisValue(d,r-120,_),i.drawLine(n,e[0],-e[1],p[0],-p[1]),i.drawLine(n,e[0],-e[1],l[0],-l[1]);break;case t.PdfLineEndingStyle.diamond:_=3*o,p=this._getAxisValue(e,180,_),l=this._getAxisValue(e,90,_),u=this._getAxisValue(e,0,_),f=this._getAxisValue(e,-90,_),i.drawPolygon([[p[0],-p[1]],[l[0],-l[1]],[u[0],-u[1]],[f[0],-f[1]]],n,s);break;case t.PdfLineEndingStyle.butt:_=3*o,p=this._getAxisValue(e,r+90,_),l=this._getAxisValue(e,r-90,_),i.drawLine(n,p[0],-p[1],l[0],-l[1])}},e.prototype._drawLineStyle=function(t,e,i,r,n,s,a,o){0===o&&(o=1,n=null),this._drawLineEndStyle(t,i,r,n,s,a.begin,o,!0),this._drawLineEndStyle(e,i,r,n,s,a.end,o,!1)},e.prototype._obtainFontDetails=function(){var e,i="",r=t.PdfFontStyle.regular;if(this._dictionary.has("DS")||this._dictionary.has("DA")){var n=void 0;if(this._dictionary.has("DS"))for(var s=this._dictionary.get("DS").split(";"),a=0;a<s.length;a++){var o=s[Number.parseInt(a.toString(),10)].split(":");if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font-family"))i=o[1];else if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font-size"))o[1].endsWith("pt")&&(e=Number.parseFloat(o[1].replace("pt","")));else if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font-style")||-1!==s[Number.parseInt(a.toString(),10)].indexOf("style"))n=s[Number.parseInt(a.toString(),10)];else if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font")){for(var h=o[1].split(" "),c=0;c<h.length;c++)""===h[Number.parseInt(c.toString(),10)]||h[Number.parseInt(c.toString(),10)].endsWith("pt")||(i+=h[Number.parseInt(c.toString(),10)]+" "),h[Number.parseInt(c.toString(),10)].endsWith("pt")&&(e=Number.parseFloat(h[Number.parseInt(c.toString(),10)].replace("pt","")));for(;" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-1);-1!==i.indexOf(",")&&(i=i.split(",")[0])}}else{var _=this._dictionary.get("DA");if(_&&""!==_&&-1!==_.indexOf("Tf"))for(var d=_.split(" "),a=0;a<d.length;a++)if(-1!==d[Number.parseInt(a.toString(),10)].indexOf("Tf")){for(i=d[a-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);e=Number.parseFloat(d[a-1])}}if(n&&""!==n){var p=void 0;n.includes(":")?p=n.split(":"):n.includes(",")&&(p=n.split(",")),p&&p.forEach(function(e){switch(e.toLowerCase()){case"bold":r|=t.PdfFontStyle.bold;break;case"italic":r|=t.PdfFontStyle.italic;break;case"strikeout":r|=t.PdfFontStyle.strikeout;break;case"underline":r|=t.PdfFontStyle.underline}})}i&&(i=i.trim())}return{name:i,size:e,style:r}},e.prototype._obtainFont=function(){var t=this._obtainFontDetails();return It(t.name,t.size,t.style,this)},e.prototype._getEqualPdfGraphicsUnit=function(e,i){var r;switch(e){case t.PdfMeasurementUnit.inch:r=t._PdfGraphicsUnit.inch,i="in";break;case t.PdfMeasurementUnit.centimeter:r=t._PdfGraphicsUnit.centimeter,i="cm";break;case t.PdfMeasurementUnit.millimeter:r=t._PdfGraphicsUnit.millimeter,i="mm";break;case t.PdfMeasurementUnit.pica:r=t._PdfGraphicsUnit.pica,i="p";break;case t.PdfMeasurementUnit.point:r=t._PdfGraphicsUnit.point,i="pt";break;default:r=t._PdfGraphicsUnit.inch,i="in"}return{graphicsUnit:r,unitString:i}},e.prototype._createMeasureDictionary=function(t){var e=new xr;e.set("C",1),e.set("D",100),e.set("F",vr.get("D")),e.set("RD","."),e.set("RT",""),e.set("SS",""),e.set("U",t);var i=new xr;i.set("C",1),i.set("D",100),i.set("F",vr.get("D")),i.set("RD","."),i.set("RT",""),i.set("SS",""),i.set("U","sq "+t);var r=new xr;"in"===t?r.set("C",.0138889):"cm"===t?r.set("C",.0352778):"mm"===t?r.set("C",.352778):"pt"===t?r.set("C",1):"p"===t&&r.set("C",.0833333),r.set("D",100),r.set("F",vr.get("D")),r.set("RD","."),r.set("RT",""),r.set("SS",""),r.set("U",t);var n=new xr;return n.set("A",[i]),n.set("D",[e]),n.set("R","1 "+t+" = 1 "+t),n.set("Type",vr.get("Measure")),n.set("X",[r]),n},e.prototype._colorToHex=function(t){return t?"#"+this._componentToHex(t[0])+this._componentToHex(t[1])+this._componentToHex(t[2]):"#"+this._componentToHex(0)+this._componentToHex(0)+this._componentToHex(0)},e.prototype._componentToHex=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e},e.prototype._getRotatedBounds=function(t,e){if(t.width>0&&t.height>0){var i=new Le;i._rotate(e);var r=[];r.push([t.x,t.y]),r.push([t.x+t.width,t.y]),r.push([t.x+t.width,t.y+t.height]),r.push([t.x,t.y+t.height]);for(c=0;c<r.length;c++)r[Number.parseInt(c.toString(),10)]=i._matrix._transform(r[Number.parseInt(c.toString(),10)]);var n=new Re;n._addRectangle(t.x,t.y,t.width,t.height);for(c=0;c<4;c++)n._points[Number.parseInt(c.toString(),10)]=r[Number.parseInt(c.toString(),10)];for(var s=r[0][0],a=r[3][0],o=r[0][1],h=r[3][1],c=0;c<4;c++)r[Number.parseInt(c.toString(),10)][0]<s&&(s=r[Number.parseInt(c.toString(),10)][0]),r[Number.parseInt(c.toString(),10)][0]>a&&(a=r[Number.parseInt(c.toString(),10)][0]),r[Number.parseInt(c.toString(),10)][1]<o&&(o=r[Number.parseInt(c.toString(),10)][1]),r[Number.parseInt(c.toString(),10)][1]>h&&(h=r[Number.parseInt(c.toString(),10)][1]);return{x:t.x,y:t.y,width:a-s,height:h-o}}return t},e.prototype._flattenPopUp=function(){this._flattenPop(this._page,this.color,this.bounds,this.border,this.author,this.subject,this.text)},e.prototype._flattenPop=function(e,i,r,n,s,a,o){var h=[0,0],c=r,_=[(h=e.size)[0]-180,c.y+142<h[1]?c.y:h[1]-142,180,142];if(this._dictionary.has("Popup")&&this._dictionary.get("Popup")){var d=this._dictionary.getArray("Rect");if(d&&4===d.length){var p=d[0],l=d[1];_=[p,l,d[2]-p,d[3]-l]}}void 0===i&&(i=[0,0,0]);var u=new Ee(i),f=n.width/2,g=new Ve([0,0,0],1),y=0,m=new Ee(this._getForeColor(i));if(void 0!==s&&null!==s&&""!==s)y=this._drawAuthor(s,a,_,u,m,e,y,n);else if(void 0!==a&&null!==a&&""!==a){v=[_[0]+f,_[1]+f,_[2]-n.width,40];this._saveGraphics(e,t.PdfBlendMode.hardLight),this._isTransparentColor?e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g):e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g,u),e.graphics.restore();var b=[v[0]+11,v[1],v[2],v[3]/2];b=[b[0],b[1]+b[3]-2,b[2],v[3]/2],this._saveGraphics(e,t.PdfBlendMode.normal),this._drawSubject(a,b,e),e.graphics.restore(),y=40}else{this._saveGraphics(e,t.PdfBlendMode.hardLight);var v=[_[0]+f,_[1]+f,_[2]-n.width,20];this._isTransparentColor?e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g):e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g,u),y=20,e.graphics.restore()}var S=[_[0]+f,_[1]+f+y,_[2]-n.width,_[3]-(y+n.width)];this._saveGraphics(e,t.PdfBlendMode.hardLight),e.graphics.drawRectangle(S[0],S[1],S[2],S[3],new Ve([0,0,0],1),new Ee([255,255,255])),S[0]+=11,S[1]+=5,S[2]-=22,e.graphics.restore(),this._saveGraphics(e,t.PdfBlendMode.normal),void 0!==o&&null!==o&&""!==o&&e.graphics.drawString(o,this._popUpFont,S,null,new Ee([0,0,0]),null),e.graphics.restore()},e.prototype._flattenLoadedPopUp=function(){var e="";this._dictionary.has("Contents")&&(e=this._dictionary.get("Contents"));var i=this.author,r=this.subject,n=new Ve([0,0,0],1);if(this._dictionary.has("Popup")){var s=this._getRectangleBoundsValue();void 0===this.color&&(this.color=[0,0,0]);var a=new Ee(this.color),o=this.border.width/2,h=0,c=new Ee(this._getForeColor(this.color));if(void 0!==this.author&&null!==this.author&&""!==this.author)h=this._drawAuthor(this.author,this.subject,s,a,c,this._page,h,this.border);else if(void 0!==this.subject&&null!==this.subject&&""!==this.subject){d=[s[0]+o,s[1]+o,s[2]-this.border.width,40];this._saveGraphics(this._page,t.PdfBlendMode.hardLight),this._page.graphics.drawRectangle(d[0],d[1],d[2],d[3],n,a),this._page.graphics.restore();var _=[d[0]+11,d[1],d[2],d[3]/2];_=[_[0],_[1]+_[3]-2,_[2],d[3]/2],this._saveGraphics(this._page,t.PdfBlendMode.normal),this._drawSubject(this.subject,_,this._page),h=40,this._page.graphics.restore()}else{this._saveGraphics(this._page,t.PdfBlendMode.hardLight);var d=[s[0]+o,s[1]+o,s[2]-this.border.width,20];this._page.graphics.drawRectangle(d[0],d[1],d[2],d[3],n,a),h=20,this._page.graphics.restore()}this._saveGraphics(this._page,t.PdfBlendMode.hardLight);var p=[s[0]+o,s[1]+o+h,s[2]-this.border.width,s[3]-(h+this.border.width)];this._page.graphics.drawRectangle(p[0],p[1],p[2],p[3],n,new Ee([255,255,255])),p[0]+=11,p[1]+=5,p[2]-=22,this._page.graphics.restore(),this._saveGraphics(this._page,t.PdfBlendMode.normal),this._page.graphics.restore(),void 0!==e&&null!==e&&""!==e&&this._page.graphics.drawString(e,this._popUpFont,p,null,new Ee([0,0,0]),null),this._page.graphics.restore(),this._removeAnnotationFromPage(this._page,this)}else this._flattenPop(this._page,this.color,this.bounds,this.border,i,r,e),this._removeAnnotationFromPage(this._page,this)},e.prototype._getRectangleBoundsValue=function(){if(this._dictionary.has("Popup")){var t=this._dictionary.get("Popup").getArray("Rect");return null!==t?(null!==this._page?0===t[1]&&0===t[3]?t[1]=t[1]+t[3]:t[1]=this._page._size[1]-(t[1]+t[3]):t[1]=t[1]-t[3],t):[0,0,0,0]}return[0,0,0,0]},e.prototype._getForeColor=function(t){return(t[0]+t[1]+t[2])/3>128?[0,0,0]:[255,255,255]},e.prototype._drawAuthor=function(e,i,r,n,s,a,o,h){var c=this.border.width/2,_=new Ve([0,0,0],1),d=new Et(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),p=[r[0]+c,r[1]+c,r[2]-h.width,20];if(void 0!==i&&null!==i&&""!==i){p[3]+=20,o=p[3],this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_):a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_,n),a.graphics.restore();l=[p[0]+11,p[1],p[2],p[3]/2];this._saveGraphics(this._page,t.PdfBlendMode.normal),a.graphics.drawString(e,this._authorBoldFont,l,null,s,d),l=[l[0],l[1]+l[3]-2,l[2],p[3]/2],this._drawSubject(i,l,a),a.graphics.restore()}else{this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_):a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_,n),a.graphics.restore();var l=[p[0]+11,p[1],p[2],p[3]];this._saveGraphics(a,t.PdfBlendMode.normal),a.graphics.drawString(e,this._popUpFont,l,null,s,d),o=p[3],a.graphics.restore()}return o},e.prototype._drawSubject=function(e,i,r){var n=new Et(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle);r.graphics.drawString(e,this._authorBoldFont,i,null,new Ee([0,0,0]),n)},e.prototype._saveGraphics=function(t,e){t.graphics.save(),t.graphics.setTransparency(.8,.8,e)},e.prototype._getBorderColorString=function(t){return(t[0]/255).toFixed(3)+" "+(t[1]/255).toFixed(3)+" "+(t[2]/255).toFixed(3)+" rg "},e.prototype._stringToDate=function(t){var e=new Date;if("D"===t[0]&&":"===t[1]){var i=t.substring(2,6),r=t.substring(6,8),n=t.substring(8,10),s=t.substring(10,12),a=t.substring(12,14),o=t.substring(14,16),h=0;if(23===t.length){var c=t.substring(16,22);if("+05'30'"!==c){var _=c[0],d=c.substring(1,3),p=c.substring(4,6);h=5.5-("-"===_?-1:1)*(parseInt(d,10)+parseInt(p,10)/60)}}e=new Date(i+"-"+r+"-"+n+"T"+s+":"+a+":"+o),0!==h&&e.setTime(e.getTime()+60*h*60*1e3)}else if(-1!==t.indexOf("/")){var l=t.split("/"),i=l[2].split(" ")[0];"10"!==(r=l[0])&&"11"!==r&&"12"!==r&&(r="0"+r);var n=l[1],s=l[2].split(" ")[1].split(":")[0],a=l[2].split(" ")[1].split(":")[1],o=l[2].split(" ")[1].split(":")[2];e=new Date(i+"-"+r+"-"+n+"T"+s+":"+a+":"+o)}else e=new Date(t);return e},e.prototype._dateToString=function(t){var e=(t.getMonth()+1).toString();"10"!==e&&"11"!==e&&"12"!==e&&(e="0"+e);var i=t.getDate().toString();Number.parseInt(i)<10&&(i="0"+i);var r=t.getHours().toString();Number.parseInt(r)<10&&(r="0"+r);var n=t.getMinutes().toString();Number.parseInt(n)<10&&(n="0"+n);var s=t.getSeconds().toString();return Number.parseInt(s)<10&&(s="0"+s),"D:"+t.getFullYear().toString()+e+i+r+n+s+"+05'30'"},e.prototype._obtainNativeRectangle=function(){var t,e=[this._bounds.x,this._bounds.y,this.bounds.x+this._bounds.width,this.bounds.y+this._bounds.height];if(this._page){var i=this._page.size;e[1]=i[1]-e[3];var r=this._page.cropBox;if(r&&m(r,[0,0,0,0]))t=r;else{var n=this._page.mediaBox;n&&m(n,[0,0,0,0])&&(t=n)}t&&t.length>2&&(0!==t[0]||0!==t[1])&&(e[0]+=t[0],e[1]+=t[1])}return e},e}(),fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return li(e,t),Object.defineProperty(e.prototype,"comments",{get:function(){return this._comments?this._comments:this._comments=new Yi(this,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reviewHistory",{get:function(){return this._reviewHistory?this._reviewHistory:this._reviewHistory=new Yi(this,!0)},enumerable:!0,configurable:!0}),e}(ui),gi=function(e){function i(i){var r=e.call(this)||this;return r._unit=t.PdfMeasurementUnit.centimeter,r._unitString="",r._dictionary=new xr,r._dictionary.update("Type",vr.get("Annot")),r._dictionary.update("Subtype",vr.get("Line")),void 0!==i&&(r.linePoints=i),r._type=t._PdfAnnotationType.lineAnnotation,r}return li(i,e),Object.defineProperty(i.prototype,"linePoints",{get:function(){if(void 0===this._linePoints&&this._dictionary.has("L")){var t=this._dictionary.getArray("L");t&&(this._linePoints=t)}return this._linePoints},set:function(t){if(Array.isArray(t)&&(void 0===this._linePoints||m(t,this._linePoints))){if(4!==t.length)throw new Error("Line points length should be 4.");this._dictionary.update("L",t),this._linePoints=t}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderExt",{get:function(){if(void 0===this._leaderExt&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&(this._leaderExt=t)}return this._leaderExt},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLE",t),this._leaderExt=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderLine",{get:function(){if(void 0===this._leaderLine&&this._dictionary.has("LL")){var t=this._dictionary.get("LL");void 0!==t&&(this._leaderLine=t)}return this._leaderLine},set:function(t){Number.isNaN(t)||0===this.leaderExt||(this._dictionary.update("LL",t),this._leaderLine=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineEndingStyle",{get:function(){if(void 0===this._lineEndingStyle){var t=new Hi;if(t._dictionary=this._dictionary,this._dictionary.has("LE")){var e=this._dictionary.getArray("LE");e&&Array.isArray(e)&&(t._begin=E(e[0].name),t._end=E(e[1].name))}this._lineEndingStyle=t}return this._lineEndingStyle},set:function(t){var e=this.lineEndingStyle;e.begin===t.begin&&e.end===t.end||(e.begin=t.begin,e.end=t.end)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderOffset",{get:function(){if(void 0===this._leaderOffset&&this._dictionary.has("LLO")){var t=this._dictionary.get("LLO");void 0!==t&&t>=0&&(this._leaderOffset=t)}return this._leaderOffset},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLO",t),this._leaderOffset=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineIntent",{get:function(){if(void 0===this._lineIntent&&this._dictionary.has("IT")){var e=this._dictionary.get("IT");e&&(this._lineIntent="LineDimension"===e.name?t.PdfLineIntent.lineDimension:t.PdfLineIntent.lineArrow)}return this._lineIntent},set:function(e){void 0!==e&&e!==this.lineIntent&&(this._lineIntent=e,this._dictionary.update("IT",vr.get(e===t.PdfLineIntent.lineDimension?"LineDimension":"LineArrow")))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&(this._measure=this._dictionary.has("Measure")),this._measure},set:function(t){t&&(this._isLoaded||(this._measure=t,this.caption.cap=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if((void 0===this._unit||this._isLoaded)&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.linePoints||null===this.linePoints)throw new Error("Line points cannot be null or undefined");this._dictionary.has("Cap")||this._dictionary.set("Cap",!1),this._dictionary.has("CP")||this._dictionary.set("CP",vr.get("Inline")),this._dictionary.has("LE")||(this.lineEndingStyle=new Hi),this._dictionary.has("LL")||(this.leaderLine=0),this._dictionary.has("LLE")||(this.leaderExt=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new xr(this._crossReference);i.set("Type",vr.get("Border")),this._dictionary.set("BS",i)}if(void 0===e&&(e=1),this._measure)this._appearanceTemplate=this._createLineMeasureAppearance(t);else{this._setAppearance&&(this._appearanceTemplate=this._createAppearance());var r=this._obtainLineBounds(),n={x:r[0],y:r[1],width:r[2],height:r[3]};this._bounds=n;var s=void 0;s=this._page&&this._page._isNew&&this._page._pageSettings&&!this._setAppearance&&!this.flatten?Ft(this):[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height],this._dictionary.update("Rect",s)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded)(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createLineMeasureAppearance(t):this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((p=e.getRaw("N"))&&(i.reference=p),this._appearanceTemplate=new Ye(i,this._crossReference));else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");i&&((p=e.getRaw("N"))&&(i.reference=p),this._appearanceTemplate=new Ye(i,this._crossReference))}}else this._appearanceTemplate=this._createAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var r=this._appearanceTemplate._content.dictionary,n=r&&r.has("BBox")&&!r.has("CropBox")&&!r.has("MediaBox")&&!r.has("Matrix");if(this._isLoaded&&n&&this.measure&&!this._setAppearance){var s=this._page.graphics,a=s.save();void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity);var o=this.bounds,h=this._appearanceTemplate._content.dictionary.getArray("BBox");o.x-=h[0],o.y+=h[1],s.drawTemplate(this._appearanceTemplate,o),s.restore(a),this._removeAnnotationFromPage(this._page,this)}else{var c=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,c)}}if(!t&&this._setAppearance&&!this.measure){var _=void 0;if(this._dictionary.has("AP"))_=this._dictionary.get("AP");else{var d=this._crossReference._getNextReference();_=new xr(this._crossReference),this._crossReference._cacheMap.set(d,_),this._dictionary.update("AP",d)}wt(_,this._crossReference,"N");var p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,this._appearanceTemplate._content),_.update("N",p)}},i.prototype._createLineMeasureAppearance=function(e){for(var i=[0,0,0,0],r=this._convertToUnit(),n=this._obtainLinePoints(),s=[],a=0;a<n.length;a+=2)s.push([n[Number.parseInt(a.toString(),10)],n[a+1]]);var o=new Re;o._points=s,o._pathTypes=[0,1];var h=o._getBounds();this._bounds={x:h[0],y:h[1],width:h[2],height:h[3]};var c,_=new Ve(void 0!==this.color?this._color:[0,0,0],this.border.width);this.innerColor&&(c=new Ee(this._innerColor)),i=this._obtainLineBounds();var d=new Ye(i,this._crossReference);$(d,this._getRotationAngle());var p=new Xi;d._writeTransformation=!1;var l=d.graphics;p.borderPen=_,p.backBrush=c,p.foreBrush=new Ee(this.color);var u=this._obtainLinePoints(),f=this._obtainFont();if((void 0===f||null===f||!this._isLoaded&&1===f.size)&&(f=this._lineCaptionFont,this._pdfFont=f),void 0!==u&&4===u.length){var g=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),y=f.measureString(r.toFixed(2)+" "+this._unitString,[0,0],g,0,0),m=this._getAngle(this._linePoints),b=0,v=0;this.leaderLine<0?(b=-this.leaderLine,v=m+180):(b=this.leaderLine,v=m);var S=void 0!==this.leaderOffset?b+this.leaderOffset:b,w=this._getAxisValue([this._linePoints[0],this._linePoints[1]],v+90,S),P=this._getAxisValue([this._linePoints[2],this._linePoints[3]],v+90,S),A=Math.sqrt(Math.pow(P[0]-w[0],2)+Math.pow(P[1]-w[1],2)),k=A/2-(y[0]/2+this.border.width),x=this._getAxisValue(w,m,k),T=this._getAxisValue(P,m+180,k),I=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(w,m,this.border.width):w,N=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(P,m,-this.border.width):P,C=void 0;this.opacity&&this._opacity<1&&(C=l.save(),l.setTransparency(this._opacity)),this.caption.type===t.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===t.PdfLineCaptionType.inline?l.drawLine(_,I[0],-I[1],N[0],-N[1]):(l.drawLine(_,I[0],-I[1],x[0],-x[1]),l.drawLine(_,N[0],-N[1],T[0],-T[1])),this.opacity&&this._opacity<1&&l.restore(C),this._drawLineStyle(w,P,l,m,_,c,this.lineEndingStyle,this.border.width);var R=void 0!==this.leaderExt?this._leaderExt:0,F=this._getAxisValue(w,v+90,R);l.drawLine(_,w[0],-w[1],F[0],-F[1]);var B=this._getAxisValue(P,v+90,R);l.drawLine(_,P[0],-P[1],B[0],-B[1]);var L=this._getAxisValue(w,v-90,b);l.drawLine(_,w[0],-w[1],L[0],-L[1]);var M=this._getAxisValue(P,v-90,b);l.drawLine(_,P[0],-P[1],M[0],-M[1]);var D=A/2,E=this._getAxisValue(w,m,D),V=void 0,j=f._metrics._getHeight();V=this.caption.type===t.PdfLineCaptionType.top?this._getAxisValue(E,m+90,j):this._getAxisValue(E,m+90,j/2),l.translateTransform(V[0],-V[1]),l.rotateTransform(-m),l.drawString(r.toFixed(2)+" "+this._unitString,f,[-y[0]/2,0,0,0],null,p.foreBrush),l.restore()}if(void 0!==e&&!e||!this._isLoaded){d._content.dictionary._updated=!0;var z=this._crossReference._getNextReference();this._crossReference._cacheMap.set(z,d._content),d._content.reference=z;var U=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height],W=this._page.size;U[1]=W[1]-(this.bounds.y+this.bounds.height),this._isBounds&&!this.measure?(i=U,this._dictionary.update("Rect",[U[0],U[1],U[2],U[3]])):this._dictionary.update("Rect",[i[0],i[1],i[2],i[3]]);var H="font:"+f._metrics._postScriptName+" "+f._size+"pt; color:"+this._colorToHex(this.color);if(this._dictionary.update("DS",H),void 0!==e&&!e){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var G=new xr;G.set("N",z),G._updated=!0,this._dictionary.set("AP",G);var K=this._createMeasureDictionary(this._unitString),q=this._crossReference._getNextReference();this._crossReference._cacheMap.set(q,K),K._updated=!0,this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure"),this._dictionary.update("Measure",q)}var X=[];if(X.push(vr.get(O(this.lineEndingStyle.begin))),X.push(vr.get(O(this.lineEndingStyle.end))),this._dictionary.update("LE",X),null===this._linePoints)throw new Error("LinePoints cannot be null");this._dictionary.update("L",this._linePoints),this._dictionary.update("C",[Number.parseFloat((this.color[0]/255).toFixed(3)),Number.parseFloat((this.color[1]/255).toFixed(3)),Number.parseFloat((this.color[2]/255).toFixed(3))]);S=this._dictionary.has("LLO")?this.leaderOffset:0;this._dictionary.update("Subtype",new vr("Line")),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+r.toFixed(2)+" "+this._unitString):this._dictionary.update("Contents",r.toFixed(2)+" "+this._unitString),this._dictionary.update("IT",new vr("LineDimension")),this._dictionary.update("LLE",this.leaderExt),this._dictionary.update("LLO",S),this._dictionary.update("LL",this.leaderLine),this._dictionary.update("CP",vr.get(this.caption.type===t.PdfLineCaptionType.top?"Top":"Inline")),this._dictionary.update("Cap",this.caption.cap);var J=[i[0],i[1],i[0]+i[2],i[1]+i[3]];this._dictionary.update("Rect",J),this._bounds={x:J[0],y:J[1],width:J[2],height:J[3]}}return d},i.prototype._calculateAngle=function(t,e,i,r){return-Math.atan2(r-e,i-t)*(180/Math.PI)},i.prototype._calculateLineBounds=function(t,e,i,r,n,s){var a={x:0,y:0,width:0,height:0};if(t&&4===t.length){var o=this._getAngle(t),h=0,c=0;i<0?(h=-i,c=o+180):(h=i,c=o);var _=[t[0],t[1]],d=[t[2],t[3]];if(0!==r){var p=this._getAxisValue(_,c+90,r),l=this._getAxisValue(d,c+90,r);t[0]=p[0],t[1]=p[1],t[2]=l[0],t[3]=l[1]}var u=this._getAxisValue(_,c+90,h+r),f=this._getAxisValue(d,c+90,h+r),g=this._getAxisValue(_,c+90,e+h+r),y=this._getAxisValue(d,c+90,e+h+r),m=this._getLinePoint(n.begin,s),b=this._getLinePoint(n.end,s),v=[],S=[];c>=45&&c<=135||c>=225&&c<=315?(v[0]=m.y,S[0]=m.x,v[1]=b.y,S[1]=b.x):(v[0]=m.x,S[0]=m.y,v[1]=b.x,S[1]=b.y);var w=Math.max(v[0],v[1]),P=Math.max(S[0],S[1]);0===w&&(w=1),0===P&&(P=1),u[0]===Math.min(u[0],f[0])?(u[0]-=w*s,f[0]+=w*s,u[0]=Math.min(u[0],t[0]),u[0]=Math.min(u[0],g[0]),f[0]=Math.max(f[0],t[2]),f[0]=Math.max(f[0],y[0])):(u[0]+=w*s,f[0]-=w*s,u[0]=Math.max(u[0],t[0]),u[0]=Math.max(u[0],g[0]),f[0]=Math.min(f[0],t[2]),f[0]=Math.min(f[0],y[0])),u[1]===Math.min(u[1],f[1])?(u[1]-=P*s,f[1]+=P*s,u[1]=Math.min(u[1],t[1]),u[1]=Math.min(u[1],g[1]),f[1]=Math.max(f[1],t[3]),f[1]=Math.max(f[1],y[1])):(u[1]+=P*s,f[1]-=P*s,u[1]=Math.max(u[1],t[1]),u[1]=Math.max(u[1],g[1]),f[1]=Math.min(f[1],t[3]),f[1]=Math.min(f[1],y[1])),a=this._getBounds([{x:u[0],y:u[1]},{x:f[0],y:f[1]}])}return a},i.prototype._getLinePoint=function(e,i){var r={x:0,y:0};if(e)switch(e){case t.PdfLineEndingStyle.square:case t.PdfLineEndingStyle.circle:case t.PdfLineEndingStyle.diamond:r.x=3,r.y=3;break;case t.PdfLineEndingStyle.openArrow:case t.PdfLineEndingStyle.closedArrow:r.x=1,r.y=5;break;case t.PdfLineEndingStyle.rOpenArrow:case t.PdfLineEndingStyle.rClosedArrow:r.x=9+i/2,r.y=5+i/2;break;case t.PdfLineEndingStyle.slash:r.x=5,r.y=9;break;case t.PdfLineEndingStyle.butt:r.x=1,r.y=3;break;default:r.x=0,r.y=0}return r},i.prototype._getBounds=function(t){var e={x:0,y:0,width:0,height:0};if(t.length>0){for(var i=t[0].x,r=t[0].x,n=t[0].y,s=t[0].y,a=1;a<t.length;++a){var o=t[Number.parseInt(a.toString(),10)];i=Math.min(o.x,i),r=Math.max(o.x,r),n=Math.min(o.y,n),s=Math.max(o.y,s)}e.x=i,e.y=n,e.width=r-i,e.height=s-n}return e},i.prototype._obtainLineBounds=function(){var t=this.bounds;if(void 0!==this.linePoints&&4===this._linePoints.length){var e=this._dictionary.has("LLO")?this.leaderOffset:0,i=this._dictionary.has("LLE")?this.leaderExt:0,r=this._dictionary.has("LL")?this.leaderLine:0;t={x:(t=this._calculateLineBounds(this._linePoints,i,r,e,this.lineEndingStyle,this.border.width)).x-8,y:t.y-8,width:t.width+16,height:t.height+16}}return[t.x,t.y,t.width,t.height]},i.prototype._createAppearance=function(){var e=new Ye(this._obtainLineBounds(),this._crossReference),i=new Xi;$(e,this._getRotationAngle()),e._writeTransformation=!1;var r=e.graphics,n=new Ve(void 0!==this.color?this._color:[0,0,0],this.border.width);this.border.style===t.PdfBorderStyle.dashed?n._dashStyle=t.PdfDashStyle.dash:this.border.style===t.PdfBorderStyle.dot&&(n._dashStyle=t.PdfDashStyle.dot),i.borderPen=n,i.foreBrush=new Ee(this.color);var s=new Ee(void 0!==this.innerColor?this._innerColor:[0,0,0]),a=this._obtainFont();(void 0===a||null===a||!this._isLoaded&&1===a.size)&&(a=this._lineCaptionFont,this._pdfFont=a),this.text||this._dictionary.has("Contents")||(this.text=this.subject);var o=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),h=a.measureString(this.text?this.text:"",[0,0],o,0,0)[0];if(void 0!==this.linePoints&&4===this._linePoints.length){var c=this._getAngle(this._linePoints),_=0,d=0;this.leaderLine<0?(_=-this.leaderLine,d=c+180):(_=this.leaderLine,d=c);var p=void 0!==this.leaderOffset?_+this.leaderOffset:_,l=this._getAxisValue([this._linePoints[0],this._linePoints[1]],d+90,p),u=this._getAxisValue([this._linePoints[2],this._linePoints[3]],d+90,p),f=Math.sqrt(Math.pow(u[0]-l[0],2)+Math.pow(u[1]-l[1],2)),g=f/2-(h/2+this.border.width),y=this._getAxisValue(l,c,g),m=this._getAxisValue(u,c+180,g),b=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(l,c,this.border.width):l,v=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(u,c,-this.border.width):u;if(this.opacity&&this._opacity<1){var S=r.save();r.setTransparency(this._opacity),this._drawLine(r,n,b,v,y,m),r.restore(S)}else this._drawLine(r,n,b,v,y,m);this._drawLineStyle(l,u,r,c,n,s,this.lineEndingStyle,this.border.width);var w=void 0!==this.leaderExt?this._leaderExt:0,P=this._getAxisValue(l,d+90,w);r.drawLine(n,l[0],-l[1],P[0],-P[1]);var A=this._getAxisValue(u,d+90,w);r.drawLine(n,u[0],-u[1],A[0],-A[1]);var k=this._getAxisValue(l,d-90,_);r.drawLine(n,l[0],-l[1],k[0],-k[1]);var x=this._getAxisValue(u,d-90,_);r.drawLine(n,u[0],-u[1],x[0],-x[1]);var T=f/2,I=this._getAxisValue(l,c,T),N=void 0,C=a._metrics._getHeight();N=this.caption.type===t.PdfLineCaptionType.top?this._dictionary.has("Measure")?this._getAxisValue(I,c+90,2*C):this._getAxisValue(I,c+90,C):this._dictionary.has("Measure")?this._getAxisValue(I,c+90,C/2*3):this._getAxisValue(I,c+90,C/2),r.translateTransform(N[0],-N[1]),r.rotateTransform(-c),this.caption.cap&&r.drawString(this.text,a,[-h/2,0,0,0],null,i.foreBrush),r.restore();var F=this._obtainLineBounds(),B=R({x:F[0],y:F[1],width:F[2],height:F[3]});this._page._isNew&&this._page._pageSettings&&this._setAppearance&&!this.flatten&&(B=Ft(this,F)),this.bounds={x:B[0],y:B[1],width:B[2],height:B[3]},this.measure||this._dictionary.has("Measure")||this._dictionary.update("Rect",[B[0],B[1],B[2],B[3]])}return e},i.prototype._drawLine=function(e,i,r,n,s,a){void 0===this.text||""===this._text||this.caption.type===t.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===t.PdfLineCaptionType.inline?e.drawLine(i,r[0],-r[1],n[0],-n[1]):(e.drawLine(i,r[0],-r[1],s[0],-s[1]),e.drawLine(i,n[0],-n[1],a[0],-a[1]))},i.prototype._convertToUnit=function(){for(var e=this._obtainLinePoints(),i=new Array(e.length/2),r=0,n=0;n<e.length;n+=2)i[Number.parseInt(r.toString(),10)]=[e[Number.parseInt(n.toString(),10)],e[n+1]],r++;var s=Math.sqrt(Math.pow(i[1][0]-i[0][0],2)+Math.pow(i[1][1]-i[0][1],2)),a=this._getEqualPdfGraphicsUnit(this.unit,this._unitString);return this._unitString=a.unitString,(new je)._convertUnits(s,t._PdfGraphicsUnit.point,a.graphicsUnit)},i.prototype._obtainLinePoints=function(){var t=[];if(this.linePoints)for(var e=0;e<this._linePoints.length;e++)t[Number.parseInt(e.toString(),10)]=this._linePoints[Number.parseInt(e.toString(),10)];return t},i}(fi),yi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._unit=t.PdfMeasurementUnit.centimeter,a._measureType=t.PdfCircleMeasurementType.diameter,a._unitString="",a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("Circle")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.circleAnnotation,a}return li(i,e),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){t&&(this._isLoaded||(this._measure=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if((void 0===this._unit||this._isLoaded)&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measureType",{get:function(){if(this._dictionary.has("Contents")){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString);var i=e.substring(0,e.length-2);(new je)._convertUnits(this.bounds.width/2,t._PdfGraphicsUnit.point,st(this._unitString)).toString()===i?this._measureType=t.PdfCircleMeasurementType.radius:this._measureType=t.PdfCircleMeasurementType.diameter}return this._measureType},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._measureType=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new xr(this._crossReference);i.set("Type",vr.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===e&&(e=1),this._measure?this._appearanceTemplate=this._createCircleMeasureAppearance(t):((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),this._dictionary.update("Rect",Ft(this)))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createCircleMeasureAppearance(t):this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._appearanceTemplate._content.dictionary;if(n&&n.has("BBox")&&!n.has("CropBox")&&!n.has("MediaBox")&&this.measure){var s=this._page.graphics,a=s.save();void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity);var o=this.bounds,h=this._appearanceTemplate._content.dictionary.getArray("BBox");o.x-=h[0],o.y+=h[1],s.drawTemplate(this._appearanceTemplate,o),s.restore(a),this._removeAnnotationFromPage(this._page,this)}else{var c=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,c)}}if(!t&&this._setAppearance&&!this.measure){var _=void 0;if(this._dictionary.has("AP"))_=this._dictionary.get("AP");else{var d=this._crossReference._getNextReference();_=new xr(this._crossReference),this._crossReference._cacheMap.set(d,_),this._dictionary.update("AP",d)}wt(_,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),_.update("N",i)}},i.prototype._createCircleMeasureAppearance=function(e){var i=this.border.width,r=this._obtainFont();(void 0===r||null===r||!this._isLoaded&&1===r.size)&&(r=this._circleCaptionFont,this._pdfFont=r);var n=this._convertToUnit(),s=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),a=n.toFixed(2)+" "+this._unitString,o=r.measureString(a,[0,0],s,0,0),h=this.color?this.color:[0,0,0],c=new Ve(h,i),_=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height];_[1]=_[1]-_[3];var d=new Ye(_,this._crossReference),p=new Xi;d._writeTransformation=!1;var l=d.graphics,u=i/2;p.borderPen=c,this.innerColor&&(p.backBrush=new Ee(this._innerColor)),p.foreBrush=new Ee(h);var f=[_[0],-_[1]-_[3],_[2],_[3]];if(l.save(),l.drawEllipse(f[0]+u,f[1]+u,f[2]-i,f[3]-i,new Ve(h,this.border.width)),this._measureType===t.PdfCircleMeasurementType.diameter){l.save(),l.translateTransform(_[0],-_[1]);g=_[3]/2-o[0]/2;l.drawLine(p.borderPen,0,-_[3]/2,_[0]+_[2],-_[3]/2),l.translateTransform(g,-_[3]/2-r._metrics._getHeight()),l.drawString(n.toFixed(2)+" "+this._unitString,r,[0,0,0,0],null,p.foreBrush),l.restore()}else{l.save(),l.translateTransform(_[0],-_[1]);var g=_[2]/2+(_[2]/4-o[0]/2);l.drawLine(p.borderPen,_[2]/2,-_[3]/2,_[0]+_[2],-_[3]/2),l.translateTransform(g,-_[3]/2-r._metrics._getHeight()),l.drawString(n.toFixed(2)+" "+this._unitString,r,[0,0,0,0],null,p.foreBrush),l.restore()}if(l.restore(),void 0!==e&&!e||!this._isLoaded){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var y=new xr;l._template._content.dictionary._updated=!0;var m=this._crossReference._getNextReference();this._crossReference._cacheMap.set(m,l._template._content),l._template._content.reference=m,y.set("N",m),y._updated=!0,this._dictionary.set("AP",y),this._dictionary.update("Rect",Ft(this)),this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure");var b=this._createMeasureDictionary(this._unitString),v=this._crossReference._getNextReference();this._crossReference._cacheMap.set(v,b),b._updated=!0,this._dictionary.update("Measure",v),this._dictionary.update("Subtype",new vr("Circle")),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+n.toFixed(2)+" "+this._unitString):this._dictionary.update("Contents",n.toFixed(2)+" "+this._unitString);var S="font:"+r._metrics._postScriptName+" "+r._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",S)}return d},i.prototype._convertToUnit=function(){var e=new je,i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString);this._unitString=i.unitString;var r=e._convertUnits(this.bounds.width/2,t._PdfGraphicsUnit.point,i.graphicsUnit);return this._measureType===t.PdfCircleMeasurementType.diameter&&(r*=2),r},i}(fi),mi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("Circle")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.ellipseAnnotation,a}return li(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new xr(this._crossReference);i.set("Type",vr.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===e&&(e=1),(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),this._dictionary.update("Rect",Ft(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}if(!t&&this._setAppearance){var s=void 0;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{var a=this._crossReference._getNextReference();s=new xr(this._crossReference),this._crossReference._cacheMap.set(a,s),this._dictionary.update("AP",a)}wt(s,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),s.update("N",i)}},i}(fi),bi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._unit=t.PdfMeasurementUnit.centimeter,a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("Square")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.squareAnnotation,a}return li(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var t=new qi;if(t._dictionary=this._dictionary,this._dictionary.has("BE")){var e=this._dictionary.get("BE");t._intensity=e.get("I"),t._style=D(e.get("S").name)}this._borderEffect=t}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){void 0!==t&&(this._isLoaded||(this._measure=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if(void 0===this._unit&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var i;if(this._dictionary.has("BS")?i=this.border.width:((r=new xr(this._crossReference)).set("Type",vr.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===i&&(i=1),this._measure)this._appearanceTemplate=this._createSquareMeasureAppearance(e);else if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),this._dictionary.update("Rect",Ft(this)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new xr(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",vr.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createSquareMeasureAppearance(t):this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect);if(void 0!==this.flattenPopups&&this.flattenPopups&&!this.measure&&(this._isLoaded&&!this._dictionary.has("Measure")?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._appearanceTemplate._content.dictionary;if(n&&n.has("BBox")&&!n.has("CropBox")&&!n.has("MediaBox")&&this.measure){var s=this._page.graphics,a=s.save();void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity);var o=this.bounds,h=this._appearanceTemplate._content.dictionary.getArray("BBox");o.x-=h[0],o.y+=h[1],s.drawTemplate(this._appearanceTemplate,o),s.restore(a),this._removeAnnotationFromPage(this._page,this)}else{var c=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,c)}}if(!t&&this._setAppearance&&!this.measure){var _=void 0;if(this._dictionary.has("AP"))_=this._dictionary.get("AP");else{var d=this._crossReference._getNextReference();_=new xr(this._crossReference),this._crossReference._cacheMap.set(d,_),this._dictionary.update("AP",d)}wt(_,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),_.update("N",i)}},i.prototype._createSquareMeasureAppearance=function(e){var i=this.border.width,r=this._obtainFont();(void 0===r||null===r||!this._isLoaded&&1===r.size)&&(r=this._circleCaptionFont,this._pdfFont=r);var n,s=this._calculateAreaOfSquare(),a=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),o=s.toFixed(2)+" sq "+this._unitString,h=r.measureString(o,[0,0],a,0,0),c=new Ve(this.color,i);this.innerColor&&(n=new Ee(this._innerColor));var _=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height],d=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],p=new pi(this,d);_[1]=_[1]-_[3],p.normal=new Ye(_,this._crossReference);var l=p.normal,u=new Xi;l._writeTransformation=!1;var f=p.normal.graphics,g=i/2;u.borderPen=c,u.backBrush=n,u.foreBrush=new Ee(this.color);var y=[_[0],-_[1]-_[3],_[2],_[3]];f.drawRectangle(y[0]+g,y[1]+g,y[2]-i,y[3]-i,new Ve(this.color,this.border.width)),f.save(),f.translateTransform(_[0],-_[1]);var m=_[2]/2-h[0]/2,b=_[3]/2-h[1]/2;if(f.translateTransform(m,-b-r._metrics._getHeight()),f.drawString(s.toFixed(2)+" sq "+this._unitString,r,[0,0,0,0],null,u.foreBrush),f.restore(),void 0!==e&&!e||!this._isLoaded){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var v=new xr,S=f._template._content;S.dictionary._updated=!0;var w=this._crossReference._getNextReference();this._crossReference._cacheMap.set(w,S),f._template._content.reference=w,v.set("N",w),v._updated=!0,this._dictionary.set("AP",v);var P=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],A=this._page.size;P[1]=A[1]-(this.bounds.y+this.bounds.height),P[2]=this.bounds.x+this.bounds.width,P[3]=A[1]-this.bounds.y,this._isBounds&&(_=P),this._page._isNew&&this._page._pageSettings&&(P=Ft(this)),this._dictionary.update("Rect",[P[0],P[1],P[2],P[3]]),this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure");var k=this._crossReference._getNextReference(),x=this._createMeasureDictionary(this._unitString);this._crossReference._cacheMap.set(k,x),x._updated=!0,this._dictionary.update("Measure",k);var T="font:"+r._metrics._postScriptName+" "+r._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",T),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+s.toFixed(2)+" sq "+this._unitString):this._dictionary.update("Contents",s.toFixed(2)+" sq "+this._unitString),this._dictionary.update("Subject","Area Measurement"),void 0===this.subject&&this._dictionary.update("Subject","Area Measurement"),this._dictionary.update("MeasurementTypes",129),this._dictionary.update("Subtype",new vr("Square")),this._dictionary.update("IT",new vr("SquareDimension"));var I=this._dictionary.getArray("Rect"),N=new Array(2*I.length);N[0]=I[0],N[1]=I[3],N[2]=I[0],N[3]=I[1],N[4]=I[2],N[5]=I[1],N[6]=I[2],N[7]=I[3],this._dictionary.update("Vertices",N)}return l},i.prototype._calculateAreaOfSquare=function(){var e,i,r=new je;if(this.bounds.width===this.bounds.height)i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString,e=(n=r._convertUnits(this.bounds.width,t._PdfGraphicsUnit.point,i.graphicsUnit))*n;else{i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString;var n=r._convertUnits(this.bounds.width,t._PdfGraphicsUnit.point,i.graphicsUnit);i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString,e=n*r._convertUnits(this.bounds.height,t._PdfGraphicsUnit.point,i.graphicsUnit)}return e},i}(fi),vi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("Square")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.rectangleAnnotation,a}return li(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var t=new qi;if(t._dictionary=this._dictionary,this._dictionary.has("BE")){var e=this._dictionary.get("BE");t._intensity=e.get("I"),t._style=D(e.get("S").name)}this._borderEffect=t}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var i;if(this._dictionary.has("BS")?i=this.border.width:((r=new xr(this._crossReference)).set("Type",vr.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===i&&(i=1),(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),this._dictionary.update("Rect",Ft(this)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new xr(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",vr.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded){if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")){var i=n.get("N"),r=n.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ye(i,this._crossReference))}}else if(this._postProcess(e),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){var n=this._dictionary.get("AP");if(n&&n.has("N")){var i=n.get("N"),r=n.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ye(i,this._crossReference))}}else this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect);if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);(s&&this._page.rotation!==t.PdfRotationAngle.angle0||this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate))&&this._flattenAnnotationTemplate(this._appearanceTemplate,s)}if(!e&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new xr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),a.update("N",r)}},i.prototype._isValidTemplateMatrix=function(t,e,i){var r=!0,n=e;if(t&&t.has("Matrix")){var s=t.getArray("BBox"),a=t.getArray("Matrix");if(a&&s&&a.length>3&&s.length>2&&void 0!==a[0]&&void 0!==a[1]&&void 0!==a[2]&&void 0!==a[3]&&1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&(Math.round(s[0])!==Math.round(-a[4])&&Math.round(s[1])!==Math.round(-a[5])||0===s[0]&&0===Math.round(-a[4]))){var o=this._page.graphics,h=o.save();void 0!==this.opacity&&this._opacity<1&&o.setTransparency(this._opacity),n.x-=s[0],n.y+=s[1],o.drawTemplate(i,n),o.restore(h),this._removeAnnotationFromPage(this._page,this),r=!1}}return r},i}(fi),Si=function(e){function i(i){var r=e.call(this)||this;return r._dictionary=new xr,r._dictionary.update("Type",vr.get("Annot")),r._dictionary.update("Subtype",vr.get("Polygon")),void 0!==i&&(r._points=i),r._type=t._PdfAnnotationType.polygonAnnotation,r}return li(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var t=new qi;if(t._dictionary=this._dictionary,this._dictionary.has("BE")){var e=this._dictionary.get("BE");t._intensity=e.get("I"),t._style=D(e.get("S").name)}this._borderEffect=t}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineExtension",{get:function(){if(void 0===this._lineExtension&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&t>=0&&(this._lineExtension=t)}return this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(t>=0))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var i;this._dictionary.has("BS")?i=this.border.width:((h=new xr(this._crossReference)).set("Type",vr.get("Border")),this._dictionary.set("BS",h)),void 0===i&&(i=1);for(var r=[],n=0;n<this._points.length;n++){var s=this._points[Number.parseInt(n.toString(),10)];r.push(s)}r[0]===r[r.length-2]&&r[1]===r[r.length-1]||(r[r.length]=this._points[0],r[r.length]=this._points[1]),this._points=r;var a=this._getBoundsValue(this._points),o=[a.x,a.y,a.x+a.width,a.y+a.height];if(this._dictionary.update("Rect",o),this._dictionary.update("LLE",this._lineExtension),(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolygonAppearance(e)),this._dictionary.update("Vertices",this._points),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var h=new xr(this._crossReference);h.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&h.set("S",vr.get("C")),this._dictionary.update("BE",h)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._flatten=t,this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolygonAppearance(t)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t&&this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}if(void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&s.length>=2&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._removeAnnotationFromPage(this._page,this);if(!t&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new xr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}},i.prototype._createPolygonAppearance=function(e){if(void 0!==e&&e){var i=void 0;this.color&&this.border.width>0&&(i=new Ve(this.color,this.border.width));var r=void 0;this.innerColor&&(r=new Ee(this.innerColor));c=this._page.graphics;if(i||r){var n=void 0;if(void 0!==this.opacity&&this._opacity<1&&(n=c.save(),c.setTransparency(this._opacity)),0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){d=4*this.borderEffect.intensity+.5*this.border.width;(p=new Re)._addPolygon(this._getLinePoints()),this._drawCloudStyle(c,r,i,d,.833,p._points,!1)}else c.drawPolygon(this._getLinePoints(),i,r);void 0!==this.opacity&&this._opacity<1&&c.restore(n)}return c._template}var s=void 0,a={x:0,y:0,width:0,height:0};void 0===this._points&&this._dictionary.has("Vertices")?(this._points=this._dictionary.get("Vertices"),s=this._getBoundsValue(this._points)):s=this._getBoundsValue(this._points),void 0!==this._borderEffect&&void 0!==this.borderEffect.intensity&&0!==this.borderEffect.intensity&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy?(a.x=s.x-5*this.borderEffect.intensity-this.border.width,a.y=s.y-5*this.borderEffect.intensity-this.border.width,a.width=s.width+10*this.borderEffect.intensity+2*this.border.width,a.height=s.height+10*this.borderEffect.intensity+2*this.border.width):(a.x=s.x-this.border.width,a.y=s.y-this.border.width,a.width=s.width+2*this.border.width,a.height=s.height+2*this.border.width);var o=new pi(this,[a.x,a.y,a.width,a.height]);o.normal=new Ye([a.x,a.y,a.width,a.height],this._crossReference);var h=o.normal;$(h,this._getRotationAngle()),h._writeTransformation=!1;var c=o.normal.graphics,_=new Xi;if(this.innerColor&&(_.backBrush=new Ee(this._innerColor)),this.border.width>0&&this.color&&(_.borderPen=new Ve(this._color,this.border.width)),this.color&&(_.foreBrush=new Ee(this._color)),void 0!==this.opacity&&this._opacity<1?(c.save(),c.setTransparency(this._opacity)):c.save(),0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){var d=4*this.borderEffect.intensity+.5*this.border.width,p=new Re;p._addPolygon(this._getLinePoints()),this._drawCloudStyle(c,_.backBrush,_.borderPen,d,.833,p._points,!1)}else c.drawPolygon(this._getLinePoints(),_.borderPen,_.backBrush);return void 0!==this.opacity&&this._opacity<1&&c.restore(),c.restore(),this._isBounds&&(h._content.dictionary._updated=!0,this._dictionary.update("LLE",this.lineExtension),this._dictionary.update("Vertices",this._points)),this._dictionary.update("Rect",[a.x,a.y,a.x+a.width,a.y+a.height]),h},i.prototype._getLinePoints=function(){var e,i=this._page.size,r=i[1],n=i[0];if(this._dictionary.has("Vertices")&&!this._isBounds){var s=void 0;this._page._pageDictionary.has("Rotate")&&(s=this._page._pageDictionary.get("Rotate")),this._page.rotation&&(this._page.rotation===t.PdfRotationAngle.angle90?s=90:this._page.rotation===t.PdfRotationAngle.angle180?s=180:this._page.rotation===t.PdfRotationAngle.angle270&&(s=270));var a=this._dictionary.getArray("Vertices");if(a){var o=[];a.forEach(function(t){o.push(t)}),e=[];for(d=0;d<o.length;d+=2)this.flatten?e.push([o[Number.parseInt(d.toString(),10)],r-o[d+1]]):e.push([o[Number.parseInt(d.toString(),10)],-o[d+1]]);if(s)if(270===s)for(h=0;h<e.length;h++){c=e[Number.parseInt(h.toString(),10)][0];e[Number.parseInt(h.toString(),10)][0]=e[Number.parseInt(h.toString(),10)][1],e[Number.parseInt(h.toString(),10)][1]=n-c}else if(90===s)for(h=0;h<e.length;h++){c=e[Number.parseInt(h.toString(),10)][0];0!==this._page._origin[1]?e[Number.parseInt(h.toString(),10)][0]=r-(e[Number.parseInt(h.toString(),10)][1]-r):e[Number.parseInt(h.toString(),10)][0]=r-e[Number.parseInt(h.toString(),10)][1],e[Number.parseInt(h.toString(),10)][1]=c}else if(180===s)for(var h=0;h<e.length;h++){var c=e[Number.parseInt(h.toString(),10)][0];e[Number.parseInt(h.toString(),10)][0]=n-c,e[Number.parseInt(h.toString(),10)][1]=r-e[Number.parseInt(h.toString(),10)][1]}}}else if(null!==this._points){var _=[];this._points.forEach(function(t){_.push(t)}),e=[];for(var d=0;d<this._points.length;d+=2)this.flatten?e.push([_[Number.parseInt(d.toString(),10)],r-_[d+1]]):e.push([_[Number.parseInt(d.toString(),10)],-_[d+1]])}return e},i}(fi),wi=function(e){function i(i){var r=e.call(this)||this;return r._beginLine=t.PdfLineEndingStyle.none,r._endLine=t.PdfLineEndingStyle.none,r._dictionary=new xr,r._dictionary.update("Type",vr.get("Annot")),r._dictionary.update("Subtype",vr.get("PolyLine")),void 0!==i&&(r._points=i),r._type=t._PdfAnnotationType.polyLineAnnotation,r}return li(i,e),Object.defineProperty(i.prototype,"beginLineStyle",{get:function(){if(this._dictionary.has("LE")){var t=this._dictionary.getArray("LE");t&&Array.isArray(t)&&(this._beginLine=E(t[0].name))}return this._beginLine},set:function(t){if(t!==this._beginLine&&(this._beginLine=t,this._dictionary)){var e=[];e.push(vr.get(O(t))),e.push(vr.get(O(this.endLineStyle))),this._dictionary.update("LE",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"endLineStyle",{get:function(){if(this._dictionary.has("LE")){var t=this._dictionary.getArray("LE");t&&Array.isArray(t)&&(this._endLine=E(t[1].name))}return this._endLine},set:function(t){if(t!==this._endLine&&(this._endLine=t,this._dictionary)){var e=[];e.push(vr.get(O(this.beginLineStyle))),e.push(vr.get(O(t))),this._dictionary.update("LE",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineExtension",{get:function(){if(void 0===this._lineExtension&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&t>=0&&(this._lineExtension=t)}return this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(t>=0))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new xr(this._crossReference);i.set("Type",vr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1);var r=this._getLinePoints(),n=[];n.push(0);for(var s=1;s<r.length;s++)n.push(1);this._polylinePoints=r,this._pathTypes=n;var a=new Re;a._points=r,a._pathTypes=n,this._dictionary.update("Vertices",this._points);var o=[];o.push(vr.get(O(this.beginLineStyle))),o.push(vr.get(O(this.endLineStyle))),this._dictionary.update("LE",o),this._dictionary.update("LLE",this._lineExtension);var h=this._getBoundsValue(this._points),c=[h.x,h.y,h.x+h.width,h.y+h.height];this._dictionary.update("Rect",c),(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolyLineAppearance(t))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._flatten=t,this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolyLineAppearance(t)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else this._appearanceTemplate=this._createPolyLineAppearance(t);if(void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._removeAnnotationFromPage(this._page,this);if(!t&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new xr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}},i.prototype._createPolyLineAppearance=function(t){var e=this.color?this.color:[0,0,0];if(void 0!==t&&t){var i=void 0;this.border.width>0&&(i=new Ve(e,this.border.width));_=this._page.graphics;if(i){var r=void 0;void 0!==this.opacity&&this._opacity<1&&(r=_.save(),_.setTransparency(this._opacity));var n=this._getLinePoints(),s=[];if(s.push(0),n&&n.length>0){for(l=1;l<n.length;l++)s.push(1);(p=new Re)._points=n,p._pathTypes=s,_._drawPath(p,i),void 0!==this.opacity&&this._opacity<1&&_.restore(r)}}return _._template}var a=void 0,o={x:0,y:0,width:0,height:0};void 0===this._points&&this._dictionary.has("Vertices")?(this._points=this._dictionary.get("Vertices"),a=this._getBoundsValue(this._points)):a=this._getBoundsValue(this._points),o.x=a.x-this.border.width,o.y=a.y-this.border.width,o.width=a.width+2*this.border.width,o.height=a.height+2*this.border.width;var h=new pi(this,[o.x,o.y,o.width,o.height]);h.normal=new Ye([o.x,o.y,o.width,o.height],this._crossReference);var c=h.normal;$(c,this._getRotationAngle()),c._writeTransformation=!1;var _=h.normal.graphics,d=new Xi;this.innerColor&&(d.backBrush=new Ee(this._innerColor)),this.border.width>0&&e&&(d.borderPen=new Ve(e,this.border.width)),e&&(d.foreBrush=new Ee(e)),void 0!==this.opacity&&this._opacity<1?(_.save(),_.setTransparency(this._opacity)):_.save();var p=new Re;if(void 0!==this._polylinePoints&&null!==this._polylinePoints?p._points=this._polylinePoints:p._points=this._getLinePoints(),void 0!==this._pathTypes&&null!==this._polylinePoints)p._pathTypes=this._pathTypes;else{this._pathTypes=[],this._pathTypes.push(0);for(var l=1;l<p._points.length;l++)this._pathTypes.push(1);p._pathTypes=this._pathTypes}if(_._drawPath(p,d.borderPen,d.backBrush),void 0!==this.opacity&&this._opacity<1&&_.restore(),_.restore(),this._isBounds){c._content.dictionary._updated=!0;var u=[];u.push(vr.get(O(this.beginLineStyle))),u.push(vr.get(O(this.endLineStyle))),this._dictionary.update("LE",u),this._dictionary.update("LLE",this.lineExtension),this._dictionary.update("Vertices",this._points)}return this._dictionary.update("Rect",[o.x,o.y,o.x+o.width,o.y+o.height]),c},i.prototype._getLinePoints=function(){var t,e=this._page.size[1];if(this._dictionary.has("Vertices")&&!this._isBounds&&(!this._setAppearance||this._setAppearance&&this.flatten)){var i=this._dictionary.getArray("Vertices");if(i){t=[];for(n=0;n<i.length;n+=2)t.push([i[Number.parseInt(n.toString(),10)],e-i[n+1]])}}else if(this._points){var r=[];this._points.forEach(function(t){r.push(t)}),t=[];for(var n=0;n<r.length;n+=2)this.flatten?t.push([r[Number.parseInt(n.toString(),10)],e-r[n+1]]):t.push([r[Number.parseInt(n.toString(),10)],-r[n+1]])}return t},i}(fi),Pi=function(e){function i(i){var r=e.call(this)||this;if(r._linePoints=[],r._firstIntersectionPoint=[0,0],r._secondIntersectionPoint=[0,0],r._dictionary=new xr,r._dictionary.update("Type",vr.get("Annot")),r._dictionary.update("Subtype",vr.get("PolyLine")),void 0!==i&&i.length>0){if(i.length>6)throw new Error("Points length should not be greater than 3");r._pointArray=i;for(var n=0;n<i.length;n++)r._linePoints.push(i[Number.parseInt(n.toString(),10)][0]),r._linePoints.push(i[Number.parseInt(n.toString(),10)][1])}return r._type=t._PdfAnnotationType.angleMeasurementAnnotation,r}return li(i,e),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){t&&!this._isLoaded&&(this._measure=t,this.caption.cap=!0)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(!this._pointArray)throw new Error("Points cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new xr(this._crossReference);e.set("Type",vr.get("Border")),this._dictionary.set("BS",e)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===t&&(t=1),this._appearanceTemplate=this._createAngleMeasureAppearance()},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if(!t&&this._setAppearance&&(this._appearanceTemplate=this._createAngleMeasureAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else this._appearanceTemplate=this._createAngleMeasureAppearance();if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}},i.prototype._createAngleMeasureAppearance=function(){var e=this.border.width,i=this._obtainFont();(void 0===i||null===i||!this._isLoaded&&1===i.size)&&(i=this._circleCaptionFont,this._pdfFont=i);var r=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),n=this._calculateAngle()*(180/Math.PI);n<0&&(n=-n),n>180&&(n=360-n),this._dictionary.update("Vertices",this._linePoints);var s="font:"+i._metrics._postScriptName+" "+i._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",s),this.text===" "+n.toFixed(2)+"°"?this._dictionary.update("Contents",this.text):this.text&&this._dictionary.update("Contents",this.text),void 0===this.subject&&this._dictionary.update("Subject","Angle Measurement"),this._dictionary.update("MeasurementTypes",1152),this._dictionary.update("Subtype",new vr("PolyLine")),this._dictionary.update("IT",new vr("PolyLineAngle"));var a=new xr,o=[],h=[],c=[],_=[],d=[];a.set("Type",vr.get("measureDictionary")),a.set("R","1 in = 1 in"),a.set("Subtype","RL"),a.set("TargetUnitConversion",.1388889);var p=new xr;p.set("U","in"),p.set("Type","NumberFormat"),p.set("C",1),p.set("D",1),p.set("SS",""),o.push(p);var l=new xr;l.set("U","°"),l.set("Type","NumberFormat"),l.set("C",1),l.set("D",1),l.set("FD",!0),l.set("SS",""),h.push(l);var u=new xr;u.set("U","sq in"),u.set("Type","NumberFormat"),u.set("C",1),u.set("D",1),u.set("FD",!0),u.set("SS",""),c.push(u);var f=new xr;f.set("U","cu in"),f.set("Type","NumberFormat"),f.set("C",1),f.set("D",1),f.set("FD",!0),f.set("SS",""),d.push(f);var g=new xr;g.set("U","in"),g.set("Type","NumberFormat"),g.set("C",1),g.set("D",1),g.set("SS",""),_.push(g),a.set("D",o),a.set("T",h),a.set("A",c),a.set("X",_),a.set("V",d),this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure");var y=this._crossReference._getNextReference();this._crossReference._cacheMap.set(y,a),a._updated=!0,this._dictionary.update("Measure",y);var m=[0,0,0,0],b=this._getAngleBoundsValue(),v=this._obtainLinePoints(),S=[];S.push(0);for(var w=1;w<v.length;w++)S.push(1);(new Re)._addRectangle(v[1][0]-this._radius,-(v[1][1]+this._radius),2*this._radius,2*this._radius);var P=i.measureString(n.toString()+"°",[0,0],r,0,0),A=[(this._firstIntersectionPoint[0]+this._secondIntersectionPoint[0])/2,(this._firstIntersectionPoint[1]+this._secondIntersectionPoint[1])/2],k=[v[1][0],-v[1][1]],x=v[1][0]+this._radius*Math.cos((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),T=v[1][1]+this._radius*Math.sin((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),I=[A[0],A[1]],N=I[0]-k[0],C=I[1]-k[1],R=Math.atan2(C,N)*(180/Math.PI),F=!1,B=!1,L=!1,M=!1;R>0?R<45?B=!0:R>=45&&R<135?L=!0:F=!0:0===(R=-R)?(new Re)._addRectangle(b[0],b[1],b[2],b[3]):R<45?B=!0:R>=45&&R<135?M=!0:F=!0,0===m[0]&&0===m[1]&&0===m[2]&&0===m[3]&&(m=b,this.bounds={x:b[0],y:b[1],width:b[2],height:b[3]});var D=new Re;D._pathTypes=S,D._points=v,this._dictionary.set("Rect",[m[0],m[1],m[0]+m[2],m[1]+m[3]]);var O=new pi(this,b);O.normal=new Ye(m,this._crossReference);var E=O.normal;E._writeTransformation=!1;var V=O.normal.graphics,j=e/2,z=new Ve(this._color,j);this.border.style===t.PdfBorderStyle.dashed&&(z._dashStyle=t.PdfDashStyle.dash);var U=new Ee(this._color);V.save(),D._addArc(v[1][0]-this._radius,v[1][1]-this._radius,2*this._radius,2*this._radius,this._startAngle,this._sweepAngle),V._drawPath(D,z),L?V.drawString(n.toString()+"°",i,[x-P[0]/2,-(-T+i._metrics._getHeight()+2),0,0],null,U):B?V.drawString(n.toString()+"°",i,[x+2,-(-T+i._metrics._getHeight()/2),0,0],null,U):F?V.drawString(n.toString()+"°",i,[x-P[0]-2,-(-T+i._metrics._getHeight()/2),0,0],null,U):M&&V.drawString(n.toString()+"°",i,[x-P[0]/2,T+2,0,0],null,U),V.restore(),V._template._content.dictionary._updated=!0;var W=this._crossReference._getNextReference();this._crossReference._cacheMap.set(W,V._template._content),V._template._content.reference=W,this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var H=new xr;return H.set("N",W),H._updated=!0,this._dictionary.set("AP",H),E},i.prototype._getAngleBoundsValue=function(){for(var t=this._obtainLinePoints(),e=0;e<t.length;e++)t[Number.parseInt(e.toString(),10)][1]=-t[Number.parseInt(e.toString(),10)][1];var i=new Re;return i._points=t,i._pathTypes=[0,1,1],i._getBounds()},i.prototype._obtainLinePoints=function(){var t,e;if(this._linePoints){t=new Array(this._linePoints.length);for(var i=0;i<this._linePoints.length;i++)t[Number.parseInt(i.toString(),10)]=this._linePoints[Number.parseInt(i.toString(),10)];e=new Array(t.length/2);for(var r=0,n=0;n<t.length;n+=2)e[Number.parseInt(r.toString(),10)]=[t[Number.parseInt(n.toString(),10)],-t[n+1]],r++}return e},i.prototype._calculateAngle=function(){var t=[0,0];void 0!==this._linePoints&&0===this._linePoints.length&&this._isLoaded&&this._dictionary.has("Vertices")&&(this._linePoints=this._dictionary.get("Vertices"));for(var e=0;e<this._linePoints.length;e++)t[Number.parseInt(e.toString(),10)]=this._linePoints[Number.parseInt(e.toString(),10)];for(var i=[],r=0;r<t.length;r+=2)i.push([t[Number.parseInt(r.toString(),10)],t[r+1]]);var n=i[0],s=i[1],a=i[2],o=Math.sqrt(Math.pow(s[0]-n[0],2)+Math.pow(s[1]-n[1],2)),h=Math.sqrt(Math.pow(s[0]-a[0],2)+Math.pow(s[1]-a[1],2));this._radius=Math.min(o,h)/4;var c=new Re;c._points=i,c._pathTypes=[0,1,1];var _,d,p=this._findLineCircleIntersectionPoints(s[0],s[1],this._radius,n,s,_,d);_=p.first,d=p.second,0===this._firstIntersectionPoint[0]&&0===this._firstIntersectionPoint[1]&&(this._firstIntersectionPoint=d),_=[0,0],d=[0,0],_=(p=this._findLineCircleIntersectionPoints(s[0],s[1],this._radius,a,s,_,d)).first,d=p.second,0===this._secondIntersectionPoint[0]&&0===this._secondIntersectionPoint[1]&&(this._secondIntersectionPoint=d);var l=this._firstIntersectionPoint[0]-s[0],u=this._firstIntersectionPoint[1]-s[1],f=Math.atan2(u,l)*(180/Math.PI);l=this._secondIntersectionPoint[0]-s[0],u=this._secondIntersectionPoint[1]-s[1];var g=Math.atan2(u,l)*(180/Math.PI);return f=f>0?f=360-f:-f,g=g>0?g=360-g:-g,180===f&&0===g?(this._startAngle=f,this._sweepAngle=180):0===f&&180===g?(this._startAngle=g,this._sweepAngle=180):f<180?f>g?(this._startAngle=g,this._sweepAngle=f-g):f+180<g?(this._startAngle=g,this._sweepAngle=360-g+f):(this._startAngle=f,this._sweepAngle=g-f):f<g?(this._startAngle=f,this._sweepAngle=g-f):f-180>g?(this._startAngle=f,this._sweepAngle=360-f+g):(this._startAngle=g,this._sweepAngle=f-g),Math.atan2(a[0]-s[0],a[1]-s[1])-Math.atan2(n[0]-s[0],n[1]-s[1])},i.prototype._findLineCircleIntersectionPoints=function(t,e,i,r,n,s,a){var o=n[0]-r[0],h=n[1]-r[1],c=o*o+h*h,_=2*(o*(r[0]-t)+h*(r[1]-e)),d=_*_-4*c*((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e)-i*i);if(c<=1e-7||d<0)s=[Number.NaN,Number.NaN],a=[Number.NaN,Number.NaN];else if(0===d){p=-_/(2*c);s=[r[0]+p*o,r[1]+p*h],a=[Number.NaN,Number.NaN]}else{var p=(-_+Math.sqrt(d))/(2*c);s=[r[0]+p*o,r[1]+p*h],p=(-_-Math.sqrt(d))/(2*c),a=[r[0]+p*o,r[1]+p*h]}return{first:s,second:a}},i}(fi),Ai=function(e){function i(i,r){var n=e.call(this)||this;return n._inkPointsCollection=[],n._previousCollection=[],n._isModified=!1,n._dictionary=new xr,n._dictionary.update("Type",vr.get("Annot")),n._dictionary.update("Subtype",vr.get("Ink")),void 0!==i&&(n._points=i,n.bounds={x:i[0],y:i[1],width:i[2],height:i[3]}),void 0!==r&&(n._linePoints=r),n._type=t._PdfAnnotationType.inkAnnotation,n}return li(i,e),Object.defineProperty(i.prototype,"inkPointsCollection",{get:function(){if(0===this._inkPointsCollection.length&&this._dictionary.has("InkList")){var t=this._dictionary.get("InkList");Array.isArray(t)&&t.length>0&&(this._inkPointsCollection=t)}return this._inkPointsCollection},set:function(t){Array.isArray(t)&&t.length>0&&t!==this._inkPointsCollection&&(this._inkPointsCollection=t,this._isModified=!0,this._isLoaded&&this._dictionary.update("InkList",t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");var t;this._dictionary.has("BS")?t=this.border.width:((s=new xr(this._crossReference)).set("Type",vr.get("Border")),this._dictionary.set("BS",s)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===t&&(t=1);var e=this._addInkPoints(),i=[e[0],e[1],e[0]+e[2],e[1]+e[3]];if(this._dictionary.update("Rect",i),this._setAppearance){var r=new pi(this,e);r.normal=new Ye(e,this._crossReference);var n=r.normal;$(n,this._getRotationAngle()),n._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(n),this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var s=new xr;this._appearanceTemplate._content.dictionary._updated=!0;var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=a,s.set("N",a),s._updated=!0,this._dictionary.set("AP",s)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isFlatten=t,this._isLoaded){if(this._setAppearance||t&&!this._dictionary.has("AP")){0===this._inkPointsCollection.length&&(this._inkPointsCollection=this._obtainInkListCollection());n=this._getInkBoundsValue();if($(s=new Ye(n,this._crossReference),this._getRotationAngle()),s._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(s),this._dictionary.update("Rect",[n[0],n[1],n[0]+n[2],n[1]+n[3]]),!t){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var e=new xr;this._appearanceTemplate._content.dictionary._updated=!0;r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,e.set("N",r),e._updated=!0,this._dictionary.set("AP",e)}}if(!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")){var i=e.get("N"),r=e.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ye(i,this._crossReference))}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){if((e=this._dictionary.get("AP"))&&e.has("N")){var i=e.get("N"),r=e.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ye(i,this._crossReference))}}else{0===this._inkPointsCollection.length&&(this._inkPointsCollection=this._obtainInkListCollection());var n=this._getInkBoundsValue(),s=new Ye(n,this._crossReference);$(s,this._getRotationAngle()),s._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(s),this._dictionary.update("Rect",[n[0],n[1],n[0]+n[2],n[1]+n[3]])}if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate&&null!==this._appearanceTemplate._size&&void 0!==this._appearanceTemplate._size){var a=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var o=this._appearanceTemplate._content.dictionary.getArray("BBox");o&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-o[0],-o[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,a)}},i.prototype._createInkAppearance=function(e){var i=e.graphics;if(null!==this._inkPointsCollection&&this._inkPointsCollection.length>0&&null!==this.color&&void 0!==this._color){for(var r=0;r<this._inkPointsCollection.length;r++)if(this._inkPointsCollection[Number.parseInt(r.toString(),10)].length%2==0){var n=this._inkPointsCollection[Number.parseInt(r.toString(),10)];2===n.length&&(n=[n[0]-.5,n[1]-.5,n[0]+.5,n[1]+.5]);for(var s=new Array(n.length/2),a=0,o=0;o<n.length;o+=2)s[Number.parseInt(a.toString(),10)]=[n[Number.parseInt(o.toString(),10)],n[o+1]],a++;var h=a+2*a-2,c=new Array(h),_=[],d=[],p=this._getControlPoints(s,_,d);_=p.controlP1,d=p.controlP2;for(var l=0,u=0;u<h-1;u+=3)c[Number.parseInt(u.toString(),10)]=s[Number.parseInt(l.toString(),10)],c[u+1]=_[Number.parseInt(l.toString(),10)],c[u+2]=d[Number.parseInt(l.toString(),10)],l++;if(c[h-1]=s[s.length-1],null!==c){for(var f=c,g=0;g<f.length;g++){var y=f[Number.parseInt(g.toString(),10)];f[Number.parseInt(g.toString(),10)]=[y[0],-y[1]]}var m=new Re,b=null;if(2===s.length){var v=s[1][0]-s[0][0],S=s[1][1]-s[0][1];m._addEllipse(s[0][0]+.5,-(s[0][1]+S+.5),v,S),(b=new Re)._pathTypes=m._pathTypes,b._points=m._points}else m._addBezierPoints(f),(b=new Re)._pathTypes=m._pathTypes,b._points=f;var w=new Ve(this.color,this.border.width);if(void 0!==this.opacity&&this._opacity<1){var P=i.save();i.setTransparency(this._opacity),this._isLoaded&&(w._lineCap=t.PdfLineCap.round),i._drawPath(b,w),i.restore(P)}else i._drawPath(b,w)}}this._isFlatten&&(this.bounds={x:this.bounds.x,y:this._page.size[1]-(this.bounds.y+this.bounds.height),width:this.bounds.width,height:this.bounds.height})}return e},i.prototype._getControlPoints=function(t,e,i){if(null===t)throw new Error("pointCollection");var r=t.length-1;if(r<1)throw new Error("At least two knot PointFs required pointCollection");1===r&&(i=[[2*(e=[[(2*t[0][0]+t[1][0])/3,(2*t[0][1]+t[1][1])/3]])[0][0]-t[0][0],2*e[0][1]-t[0][1]]]);for(var n=[],s=1;s<r-1;++s)n[Number.parseInt(s.toString(),10)]=4*t[Number.parseInt(s.toString(),10)][0]+2*t[s+1][0];n[0]=t[0][0]+2*t[1][0],n[r-1]=(8*t[r-1][0]+t[Number.parseInt(r.toString(),10)][0])/2;for(var a=this._getSingleControlPoint(n),s=1;s<r-1;++s)n[Number.parseInt(s.toString(),10)]=4*t[Number.parseInt(s.toString(),10)][1]+2*t[s+1][1];n[0]=t[0][1]+2*t[1][1],n[r-1]=(8*t[r-1][1]+t[Number.parseInt(r.toString(),10)][1])/2;var o=this._getSingleControlPoint(n);e=new Array(r),i=new Array(r);for(s=0;s<r;++s)if(e[Number.parseInt(s.toString(),10)]=[a[Number.parseInt(s.toString(),10)],o[Number.parseInt(s.toString(),10)]],s<r-1)i[Number.parseInt(s.toString(),10)]=[2*t[s+1][0]-a[s+1],2*t[s+1][1]-o[s+1]];else{var h=(t[Number.parseInt(r.toString(),10)][0]+a[r-1])/2,c=(t[Number.parseInt(r.toString(),10)][1]+o[r-1])/2;i[Number.parseInt(s.toString(),10)]=[h,c]}return{controlP1:e,controlP2:i}},i.prototype._getSingleControlPoint=function(t){var e=t.length,i=[],r=[],n=2;i[0]=t[0]/n;for(s=1;s<e;s++)r[Number.parseInt(s.toString(),10)]=1/n,n=(s<e-1?4:3.5)-r[Number.parseInt(s.toString(),10)],i[Number.parseInt(s.toString(),10)]=(t[Number.parseInt(s.toString(),10)]-i[s-1])/n;for(var s=1;s<e;s++)i[e-s-1]-=r[e-s]*i[e-s];return i},i.prototype._addInkPoints=function(){var t=this,e=[];null===this._linePoints||0!==this._previousCollection.length&&!this._isModified||(this._inkPointsCollection.unshift(this._linePoints),this._isModified=!1);var i=Ct(this._inkPointsCollection,this._previousCollection);if(null!==this._inkPointsCollection&&!i){for(var r=0;r<this._inkPointsCollection.length;r++){var n=this._inkPointsCollection[Number.parseInt(r.toString(),10)];e.push(n)}this._dictionary.update("InkList",e)}return this._inkPointsCollection.length>0&&this._inkPointsCollection.forEach(function(e){t._previousCollection.push(e)}),this._getInkBoundsValue()},i.prototype._getInkBoundsValue=function(){var t=[0,0,0,0];this._points&&(this.bounds={x:this._points[0],y:this._points[1],width:this._points[2],height:this._points[3]}),t=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];var e=this.border.width;if(null!==this._inkPointsCollection&&this._inkPointsCollection.length>0){for(var i=[],r=0;r<this._inkPointsCollection.length;r++){var n=this._inkPointsCollection[Number.parseInt(r.toString(),10)];if(null!==n&&n.length%2==0)for(h=0;h<n.length;h++)i.push(n[Number.parseInt(h.toString(),10)])}var s=!1;this._isLoaded||2!==i.length||(s=!0,i.push(i[0]+1),i.push(i[1]+1));for(var a=new Array(i.length/2),o=0,h=0;h<i.length;h+=2)a[Number.parseInt(o.toString(),10)]=[i[Number.parseInt(h.toString(),10)],i[h+1]],o++;if(this._isLoaded)if(a.length>0){for(var c=0,_=0,d=0,p=0,l=!0,r=0;r<a.length;r++){var u=a[Number.parseInt(r.toString(),10)];l?(c=u[0],_=u[1],l=!1):(u[0]<c?c=u[0]:u[0]>d&&(d=u[0]),u[1]<_?_=u[1]:u[1]>p&&(p=u[1]))}t=[c,_,d-c,p-_],this.bounds={x:t[0],y:t[1],width:t[2],height:t[3]},(this._isFlatten||this._setAppearance)&&(t[0]=this.bounds.x-e,t[1]=this.bounds.y-e,t[2]=this.bounds.width+2*e,t[3]=this.bounds.height+2*e)}else t=this._points?this._points:a.length>0?this._dictionary.get("Rect"):[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];else t=this._calculateInkBounds(a,t,e,s);this.bounds={x:t[0],y:t[1],width:t[2],height:t[3]}}return t},i.prototype._calculateInkBounds=function(t,e,i,r){if(t.length>5){for(var n=0,s=0,a=0,o=0,h=!0,c=0;c<t.length;c++){var _=t[Number.parseInt(c.toString(),10)];h?(n=_[0],s=_[1],a=_[0],o=_[1],h=!1):(_[0]<n?n=_[0]:_[0]>a&&(a=_[0]),_[1]<s?s=_[1]:_[1]>o&&(o=_[1]))}if(e[2]<a&&(a=e[2]),e[3]<o&&(o=e[3]),e=[n,s,a,o],this._isFlatten||this._setAppearance){var d=r?2:3;e[0]=e[0]-i,e[1]=e[1]-i,e[2]=e[2]+d*i,e[3]=e[3]+d*i}}else e=void 0===this._points&&t.length>0?this._dictionary.get("Rect"):this._points;return e},i.prototype._obtainInkListCollection=function(){var t=[];if(this._dictionary.has("InkList"))for(var e=this._dictionary.getArray("InkList"),i=[],r=0;r<e.length;r++){for(var n=e[Number.parseInt(r.toString(),10)],s=0;s<n.length;s++)i.push(n[Number.parseInt(s.toString(),10)]);t.push(i)}return t},i}(fi),ki=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._icon=t.PdfPopupIcon.note,o._iconString="",o._stateModel=t.PdfAnnotationStateModel.none,o._state=t.PdfAnnotationState.none,o._open=!1,o._isReview=!1,o._isComment=!1,o._dictionary=new xr,o._dictionary.update("Type",vr.get("Annot")),o._dictionary.update("Subtype",vr.get("Text")),void 0!==i&&(o.text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a}),o._type=t._PdfAnnotationType.popupAnnotation,o}return li(i,e),Object.defineProperty(i.prototype,"open",{get:function(){return this._dictionary.has("Open")&&(this._open=this._dictionary.get("Open")),this._open},set:function(t){void 0!==t&&(this._open=t,this._dictionary.update("Open",this._open))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=ot(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",vr.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"stateModel",{get:function(){return this._dictionary.has("StateModel")&&(this._stateModel=dt(this._dictionary.get("StateModel"))),this._stateModel},set:function(t){void 0!==t&&(this._stateModel=t,this._dictionary.update("StateModel",_t(this._stateModel)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"state",{get:function(){return this._dictionary.has("State")&&(this._state=ct(this._dictionary.get("State"))),this._state},set:function(t){void 0!==t&&(this._state=t,this._dictionary.update("State",ht(this._state)))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),e.has("IRT")&&(r._isReview=bt(e),r._isReview||(r._isComment=vt(e))),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){void 0!==this.bounds&&null!==this.bounds||(this._bounds={x:0,y:0,width:0,height:0});var t;this._dictionary.has("BS")?t=this.border.width:((i=new xr(this._crossReference)).set("Type",vr.get("Border")),this._dictionary.set("BS",i)),void 0===t&&(t=1);var e=[this.bounds.x,this.bounds.y,this.bounds.x+this.bounds.width,this.bounds.y+this.bounds.height];if(this._dictionary.update("Rect",e),this._setAppearance&&(this._appearanceTemplate=this._createPopupAppearance(),this._appearanceTemplate)){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var i=new xr;this._appearanceTemplate._content.dictionary._updated=!0;var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,i.set("N",r),i._updated=!0,this._dictionary.set("AP",i)}this._dictionary.update("Rect",Ft(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if(!this._appearanceTemplate&&this._isFlattenPopups&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")){var e=n.get("N"),i=n.getRaw("N");if(e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference)),null!==this._appearanceTemplate){var r=this._page.graphics.save();this.opacity<1&&this._page.graphics.setTransparency(this.opacity),this._page.graphics.drawTemplate(this._appearanceTemplate,this.bounds),this._page.graphics.restore(r)}}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var n=this._dictionary.get("AP");if(n&&n.has("N")){var e=n.get("N"),i=n.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ye(e,this._crossReference))}}else this._appearanceTemplate=this._createPopupAppearance();void 0!==this.flattenPopups&&this.flattenPopups&&this.flatten&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._removeAnnotation(this._page,this)},i.prototype._createPopupAppearance=function(){var t;if(this._dictionary.has("Name")&&"Comment"===this._dictionary.get("Name").name&&this._dictionary.has("Rect")){var e=[0,0,this.bounds.width,this.bounds.height];$(t=new Ye(e,this._crossReference),this._getRotationAngle());var i=t.graphics;if(null!==this._dictionary.getArray("Rect")){var r=new Ve([0,0,0],.3),n=new Ee(this.color),s=new Ve([255,255,255],1),a=new Array;a.push([6,8]),a.push([9,8]),a.push([4,12]);var o=new Re;0===this.color[0]&&0===this.color[0]&&0===this.color[0]&&(n=new Ee([255,215,0])),i.save();var h=new Ye([0,0,15,14],this._crossReference);h.graphics.drawRectangle(0,0,15,14,r,n),h.graphics.drawPolygon(a,r,new Ee([255,255,255])),o._addEllipse(2,2,11,8),h.graphics._drawPath(o,r,new Ee([255,255,255])),h.graphics.drawArc(2,2,11,8,108,12.7,s),h.graphics.drawLine(r,4,12,6.5,10),i.drawTemplate(h,{x:0,y:0,width:this.bounds.width,height:this.bounds.height}),i.restore()}}return t},i.prototype._obtainIconName=function(e){switch(e){case t.PdfPopupIcon.note:this._iconString="Note";break;case t.PdfPopupIcon.comment:this._iconString="Comment";break;case t.PdfPopupIcon.help:this._iconString="Help";break;case t.PdfPopupIcon.insert:this._iconString="Insert";break;case t.PdfPopupIcon.key:this._iconString="Key";break;case t.PdfPopupIcon.newParagraph:this._iconString="NewParagraph";break;case t.PdfPopupIcon.paragraph:this._iconString="Paragraph"}return this._iconString},i}(fi),xi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._dictionary=new xr,o._dictionary.update("Type",vr.get("Annot")),o._dictionary.update("Subtype",vr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(o.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&null!==a&&(o._fileName=a),o._type=t._PdfAnnotationType.fileLinkAnnotation,o}return li(i,e),Object.defineProperty(i.prototype,"action",{get:function(){if(void 0===this._action&&this._dictionary.has("A")){var t=this._dictionary.get("A");if(t&&t.has("Next")){var e=t.get("Next");if(Array.isArray(e))for(var i=0;i<e.length;i++){var r=e[Number.parseInt(i.toString(),10)];if(r&&r instanceof wr){var n=this._crossReference._fetch(r);n.has("JS")&&(this._action=n.get("JS"))}}}}return this._action},set:function(t){if(this._isLoaded||"string"!=typeof t||(this._action=t),this._isLoaded&&"string"==typeof t&&this.action!==t&&this._dictionary.has("A")){var e=this._dictionary.get("A");if(e&&e.has("Next")){var i=e.get("Next");if(Array.isArray(i))for(var r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];if(n&&n instanceof wr){var s=this._crossReference._fetch(n);s.has("JS")&&(s.update("JS",t),this._action=t,this._dictionary._updated=!0)}}}}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new xr(this._crossReference);e.set("Type",vr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",Ft(this))},i.prototype._addAction=function(){var t=this;if(this._dictionary.has("A")){var e=this._dictionary.get("A");if(e){if(void 0!==this._action&&null!==this._action&&e.has("Next")){var i=e.get("Next");Array.isArray(i)&&i.length>0&&i.forEach(function(e){e&&e instanceof wr&&e._isNew&&t._crossReference._cacheMap.delete(e)})}e.has("F")&&wt(e,this._crossReference,"F")}wt(this._dictionary,this._crossReference,"A")}var r=new xr;r.set("Type",vr.get("Action")),r.set("S",vr.get("Launch"));var n=new xr;if(n.set("Type",vr.get("Filespec")),n.set("UF",this._fileName),void 0!==this._action&&null!==this._action){var s=new xr;s.set("Type",vr.get("Action")),s.set("S",vr.get("JavaScript")),s.set("JS",this._action);var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,s),s._updated=!0,r.set("Next",[a])}var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,n),n._updated=!0,r.set("F",o),r._updated=!0,this._dictionary.set("A",r)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(ui),Ti=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._dictionary=new xr,o._dictionary.update("Type",vr.get("Annot")),o._dictionary.update("Subtype",vr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(o.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&null!==a&&(o._uri=a),o._type=t._PdfAnnotationType.uriAnnotation,o}return li(i,e),Object.defineProperty(i.prototype,"uri",{get:function(){if(void 0===this._uri&&this._dictionary.has("A")){var t=this._dictionary.get("A");t.has("URI")&&(this._uri=t.get("URI"))}return this._uri},set:function(t){if("string"==typeof t)if(this._isLoaded&&this._dictionary.has("A")&&t!==this.uri){var e=this._dictionary.get("A");e.has("URI")&&(this._uri=t,e.update("URI",t),this._dictionary._updated=!0)}else this._uri=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new xr(this._crossReference);e.set("Type",vr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",Ft(this))},i.prototype._addAction=function(){var t=new xr;t.set("Type",vr.get("Action")),t.set("S",vr.get("URI")),void 0!==this._uri&&t.set("URI",this._uri),t._updated=!0,this._dictionary.set("A",t),this._dictionary.update("Border",[this.border.hRadius,this.border.vRadius,this.border.width])},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(ui),Ii=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.documentLinkAnnotation,a}return li(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){return this._isLoaded&&(this.destination=this._obtainDestination()),this._destination},set:function(t){null!==t&&(this._destination=t)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._addDocument(),this._dictionary.update("Rect",Ft(this))},i.prototype._obtainDestination=function(){if(this._dictionary.has("Dest")){var e=this._dictionary.get("Dest"),i=void 0;if(e[0]instanceof wr&&(i=e[0]),(void 0===i||null===i)&&"number"==typeof e[0]){var r=e[0];if(m=this._crossReference._document.getPage(r))if("XYZ"===(d=e[1]).name){var n=e[2],s=e[3],a=e[4],o=void 0!==s&&null!==s?m.size[1]-s:0,h=void 0!==n&&null!==n?n:0;this._destination=new $i(m,[h,o]),void 0!==a&&null!==a&&(this._destination.zoom=a),(void 0===n&&null===n||void 0===s&&null===s||void 0===a&&null===a)&&this._destination._setValidation(!1)}else this._destination=new $i(m),this._destination.mode=t.PdfDestinationMode.fitToPage}if(i)if((y=_(this._crossReference._document,this._crossReference._fetch(i)))>=0){if((m=this._crossReference._document.getPage(y))&&e[1]instanceof vr&&(d=e[1]))if("XYZ"===d.name){var n=e[2],c=e[3],a=e[4],o=void 0!==c&&null!==c?m.size[1]-c:0,h=void 0!==n&&null!==n?n:0;this._destination=new $i(m,[h,o]),void 0!==a&&null!==a&&(this._destination.zoom=a),(void 0===n&&null===n||void 0===c&&null===c||void 0===a&&null===a)&&this._destination._setValidation(!1)}else"Fit"===d.name&&(this._destination=new $i(m),this._destination.mode=t.PdfDestinationMode.fitToPage)}else{this._destination=new $i;var a=e[4],d=e[1];if(void 0!==a&&null!==a&&(this._destination.zoom=a),"Fit"===d.name)this._destination.mode=t.PdfDestinationMode.fitToPage;else if("XYZ"===d.name){var n=e[2],o=e[3];(void 0===n&&null===n||void 0===o&&null===o||void 0===a&&null===a)&&this._destination._setValidation(!1)}this._destination._index=y}}else if(this._dictionary.has("A")&&!this._destination){var p=this._dictionary.get("A");if(p.has("D")){var l=p.get("D");if(null!==l&&void 0!==l){var u=void 0;if(Array.isArray(l))u=l;else if(l instanceof wr){var f=this._crossReference._fetch(l);Array.isArray(f)&&(u=f)}if(u&&(u[0]instanceof wr||"number"==typeof u[0])){var g=this._crossReference._document,y=void 0;y=u[0]instanceof wr?_(g,this._crossReference._fetch(u[0])):u[0];var m=g.getPage(y);if(m)if("FitBH"===(d=u[1]).name||"FitH"===d.name){var b=u[2],o=void 0!==b&&null!==b?m.size[1]-b:0;this._destination=new $i(m,[0,o]),void 0!==b&&null!==b||this._destination._setValidation(!1)}else if("XYZ"===d.name){var n=u[2],v=u[3],a=u[4],o=void 0!==v&&null!==v?m.size[1]-v:0,h=void 0!==n&&null!==n?n:0;this._destination=new $i(m,[h,o]),void 0!==a&&null!==a&&(this._destination.zoom=a),(void 0!==n&&null!==n||void 0!==v&&null!==v||void 0!==a&&null!==a)&&this._destination._setValidation(!1)}else if("FitR"===d.name){if(6===u.length){var n=u[2],S=u[3],w=u[4],P=u[5];this._destination=new $i(m,[n,S,w,P])}}else"Fit"===d.name&&(this._destination=new $i(m),this._destination.mode=t.PdfDestinationMode.fitToPage)}}}}return this._destination},i.prototype._addDocument=function(){this.destination&&this._dictionary.set("Dest",this.destination._array)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(ui),Ni=function(e){function i(i,r,n,s,a,o,h,c){var _=e.call(this)||this;return _._isActionAdded=!1,_._dictionary=new xr,_._dictionary.update("Type",vr.get("Annot")),_._dictionary.update("Subtype",vr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(_.bounds={x:i,y:r,width:n,height:s}),_._textWebLink=void 0!==c&&null!==c?c:"",void 0!==a&&null!==a&&(_._brush=new Ee(a)),void 0!==o&&null!==o&&(_._pen=new Ve(o,h||1)),_._type=t._PdfAnnotationType.textWebLinkAnnotation,_}return li(i,e),Object.defineProperty(i.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"url",{get:function(){if(void 0===this._url&&this._dictionary.has("A")){var t=this._dictionary.get("A");t.has("URI")&&(this._url=t.get("URI"))}return this._url},set:function(t){if("string"==typeof t)if(this._isLoaded&&this._dictionary.has("A")){var e=this._dictionary._get("A"),i=this._dictionary.get("A");i&&i.has("URI")&&(this._url=t,i.update("URI",t),e instanceof wr||(this._dictionary._updated=i._updated))}else this._url=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._isActionAdded||(this._addAction(),this._isActionAdded=!0),this._dictionary.update("Rect",Ft(this))},i.prototype._addAction=function(){var e=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];void 0!==this.font&&null!==this.font||(this.font=this._lineCaptionFont);var i=new Et(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top);this._page.graphics.drawString(this._textWebLink,this.font,e,this._pen,this._brush,i);var r=new xr;r.set("Type",vr.get("Action")),r.set("S",vr.get("URI")),void 0!==this._url&&r.set("URI",this._url),r._updated=!0,this._dictionary.set("A",r),this._dictionary.update("Border",[0,0,0])},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(ui),Ci=function(e){function i(i,r,n,s,a,o){var h=e.call(this)||this;return h._icon=t.PdfAttachmentIcon.pushPin,h._iconString="",h._dictionary=new xr,h._dictionary.update("Type",vr.get("Annot")),h._dictionary.update("Subtype",vr.get("FileAttachment")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(h.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&(h._fileName=a),h._stream=new Cr("string"==typeof o?k(o):o),h._type=t._PdfAnnotationType.fileAttachmentAnnotation,h}return li(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=pt(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",vr.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._dictionary.update("Rect",Ft(this)),this._addAttachment()},i.prototype._addAttachment=function(){if(this._dictionary.has("FS")){var t=this._dictionary.get("FS");if(t&&t.has("EF")){var e=t.get("EF");e&&e.has("F")&&wt(e,this._crossReference,"F")}wt(this._dictionary,this._crossReference,"FS")}var i=new xr;i.set("Type",vr.get("Filespec")),i.set("Desc",this._fileName),i.set("F",this._fileName),i.set("UF",this._fileName);var r=new xr;r.set("Type",vr.get("EmbeddedFile"));var n=new xr,s=new Date;n.set("CreationDate",s.toTimeString()),n.set("ModDate",(new Date).toTimeString()),n.set("Size",this._stream.length),r.set("Params",n),this._stream.dictionary=new xr,this._stream.dictionary=r,r._crossReference=this._crossReference;var a=[this._crossReference._newLine.charCodeAt(0),this._crossReference._newLine.charCodeAt(1),37,80,68,70,45];r._crossReference._writeObject(this._stream,a);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._stream),r._updated=!0;var h=new xr;h.set("F",o),i.set("EF",h);var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,i),i._updated=!0,this._dictionary.update("FS",c)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i.prototype._obtainIconName=function(e){switch(e){case t.PdfAttachmentIcon.pushPin:this._iconString="PushPin";break;case t.PdfAttachmentIcon.tag:this._iconString="Tag";break;case t.PdfAttachmentIcon.graph:this._iconString="Graph";break;case t.PdfAttachmentIcon.paperClip:this._iconString="Paperclip"}return this._iconString},i}(fi),Ri=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.movieAnnotation,i}return li(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(ui),Fi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._textMarkupType=t.PdfTextMarkupAnnotationType.highlight,o._quadPoints=new Array(8),o._boundsCollection=[],o._dictionary=new xr,o._dictionary.update("Type",vr.get("Annot")),void 0!==i&&(o._text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a},o._boundsCollection.push([o.bounds.x,o.bounds.y,o.bounds.width,o.bounds.height])),o._type=t._PdfAnnotationType.textMarkupAnnotation,o}return li(i,e),Object.defineProperty(i.prototype,"textMarkUpColor",{get:function(){return void 0===this._textMarkUpColor&&this._dictionary.has("C")&&(this._textMarkUpColor=L(this._dictionary.getArray("C"))),this._textMarkUpColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.color;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._color=t,this._textMarkUpColor=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkupType",{get:function(){if(this._dictionary.has("Subtype")){var t=this._dictionary.get("Subtype");this._textMarkupType=rt(t.name)}return this._textMarkupType},set:function(t){void 0!==t&&(this._textMarkupType=t,this._dictionary.update("Subtype",vr.get(nt(t))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boundsCollection",{get:function(){if(this._isLoaded){var t=[];if(this._dictionary.has("QuadPoints")){var e=this._dictionary.getArray("QuadPoints");if(e&&e.length>0)for(var i=e.length/8,r=0;r<i;r++){var n=e[4+8*r]-e[8*r],s=e[5+8*r]-e[1+8*r],a=Math.sqrt(n*n+s*s);n=e[6+8*r]-e[4+8*r],s=e[7+8*r]-e[5+8*r];var o=Math.sqrt(n*n+s*s),h=[e[8*r],this._page.size[1]-e[1+8*r],o,a];t.push(h)}}return t}return this._boundsCollection},set:function(t){if(!this._isLoaded&&void 0!==t)if(this._boundsCollection.length>0){this._quadPoints=new Array(8+8*t.length);for(s=0;s<t.length;s++)this._boundsCollection.push(t[Number.parseInt(s.toString(),10)])}else this._quadPoints=new Array(8),this._boundsCollection=t;if(this._isLoaded&&void 0!==t){var e=!1;if(this.boundsCollection.length===t.length){for(s=0;s<t.length;s++)for(var i=t[Number.parseInt(s.toString(),10)],r=0;r<i.length;r++)if(t[Number.parseInt(s.toString(),10)][Number.parseInt(r.toString(),10)]!==this.boundsCollection[Number.parseInt(s.toString(),10)][Number.parseInt(r.toString(),10)]){e=!0;break}}else e=!0;if(e){this._quadPoints=new Array(8*t.length);for(var n=this._page.size[1],s=0;s<t.length;s++)this._quadPoints[0+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0],this._quadPoints[1+8*Number.parseInt(s.toString(),10)]=n-t[Number.parseInt(s.toString(),10)][1],this._quadPoints[2+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0]+t[Number.parseInt(s.toString(),10)][2],this._quadPoints[3+8*Number.parseInt(s.toString(),10)]=n-t[Number.parseInt(s.toString(),10)][1],this._quadPoints[4+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0],this._quadPoints[5+8*Number.parseInt(s.toString(),10)]=this._quadPoints[1+8*s]-t[Number.parseInt(s.toString(),10)][3],this._quadPoints[6+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0]+t[Number.parseInt(s.toString(),10)][2],this._quadPoints[7+8*Number.parseInt(s.toString(),10)]=this._quadPoints[5+8*Number.parseInt(s.toString(),10)];this._dictionary.update("QuadPoints",this._quadPoints)}}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;this._dictionary.has("BS")?t=this.border.width:((n=new xr(this._crossReference)).set("Type",vr.get("Border")),n.set("W",this.border.width),this._dictionary.set("BS",n)),void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var e=this._page.size;this._setQuadPoints(e);var i=[this.bounds.x,e[1]-(this.bounds.y+this.bounds.height),this.bounds.width,this.bounds.height];if(this._dictionary.update("Subtype",vr.get(nt(this._textMarkupType))),this._dictionary.update("Rect",[i[0],i[1],i[0]+i[2],i[1]+i[3]]),this._setAppearance){if(this._appearanceTemplate=this._createMarkupAppearance(),!this._isLoaded&&this._boundsCollection.length>1){var r=this._obtainNativeRectangle();this._dictionary.update("Rect",[r[0],r[1],r[0]+r[2],r[1]+r[3]])}this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var n=new xr;this._appearanceTemplate._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=s,n.set("N",s),n._updated=!0,this._dictionary.set("AP",n)}void 0!==this._text&&null!==this._text&&this._dictionary.set("Contents",this._text)},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded){if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createMarkupAppearance(),!e)){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var i=new xr;this._appearanceTemplate._content.dictionary._updated=!0;var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,i.set("N",r),i._updated=!0,this._dictionary.set("AP",i)}!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(n=i.get("N"))&&((r=i.getRaw("N"))&&(n.reference=r),this._appearanceTemplate=new Ye(n,this._crossReference))}else if(this._postProcess(),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){if((i=this._dictionary.get("AP"))&&i.has("N")){var n=i.get("N");n&&((r=i.getRaw("N"))&&(n.reference=r),this._appearanceTemplate=new Ye(n,this._crossReference))}}else this._appearanceTemplate=this._createMarkupAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")&&!this._isLoaded){var a=this._appearanceTemplate._content.dictionary.getArray("BBox");a&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-a[0],-a[1]])}s&&void 0!==this._page.rotation&&this._page.rotation!==t.PdfRotationAngle.angle0?this._flattenAnnotationTemplate(this._appearanceTemplate,s):s&&this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary,this._appearanceTemplate)?this._flattenAnnotationTemplate(this._appearanceTemplate,s):!this._dictionary.has("AP")&&this._appearanceTemplate&&this._flattenAnnotationTemplate(this._appearanceTemplate,s)}},i.prototype._createMarkupAppearance=function(){var e,i,r=0;if(this.boundsCollection.length>1){for(var n=new Re,s=0;s<this.boundsCollection.length;s++)(w=[])[0]=this.boundsCollection[Number.parseInt(s.toString(),10)][0],w[1]=this.boundsCollection[Number.parseInt(s.toString(),10)][1],w[2]=this.boundsCollection[Number.parseInt(s.toString(),10)][2],w[3]=this.boundsCollection[Number.parseInt(s.toString(),10)][3],n._addRectangle(w[0],w[1],w[2],w[3]);i={x:(l=n._getBounds())[0],y:l[1],width:l[2],height:l[3]},this.bounds=i,e=i.width,r=i.height}else if(this._dictionary.has("QuadPoints")){var a=this._dictionary.get("QuadPoints");if(null!==this._quadPoints)for(s=0;s<a.length/8;s++)if(this._isLoaded){for(var o=new Array,h=0,c=0;c<a.length;){var _=a[Number.parseInt(c.toString(),10)],d=a[c+1];o[Number.parseInt(h.toString(),10)]=[_,d],c+=2,h++}var p=new Re;p._addLines(o);var l=p._getBounds();e=(i={x:l[0],y:l[1],width:l[2],height:l[3]}).width,r=i.height}else{var u=Math.floor(a[4+8*s])-Math.floor(a[0+8*s]),f=Math.floor(a[5+8*s])-Math.floor(a[1+8*s]);r=Math.sqrt(u*u+f*f),u=Math.floor(a[6+8*s])-Math.floor(a[4+8*s]),f=Math.floor(a[7+8*s])-Math.floor(a[5+8*s]),e=Math.sqrt(u*u+f*f),this.bounds={x:this.bounds.x,y:this.bounds.y,width:e,height:r}}}var g=new Ye([0,0,e,r],this._crossReference);$(g,this._getRotationAngle());var y=g.graphics;if(void 0!==this.opacity&&y.setTransparency(this.opacity,this.opacity,t.PdfBlendMode.multiply),this.textMarkUpColor){var m=new Ve(this.textMarkUpColor,this.border.width),b=new Ee(this.textMarkUpColor),_=0,d=0,v=0,S=0;if(this.boundsCollection.length>1)for(s=0;s<this.boundsCollection.length;s++){var w=[];w[0]=this.boundsCollection[Number.parseInt(s.toString(),10)][0],w[1]=this.boundsCollection[Number.parseInt(s.toString(),10)][1],w[2]=this.boundsCollection[Number.parseInt(s.toString(),10)][2],w[3]=this.boundsCollection[Number.parseInt(s.toString(),10)][3],this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?y.drawRectangle(w[0]-i.x,w[1]-i.y,w[2],w[3],b):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?(_=w[0]-i.x,d=w[1]-i.y+(w[3]-w[3]/2/3),v=w[2]+(w[0]-i.x),S=w[1]-i.y+(w[3]-w[3]/2/3),y.drawLine(m,_,d,v,S)):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?(_=w[0]-i.x,d=w[1]-i.y+(w[3]-w[3]/2),v=w[2]+(w[0]-i.x),S=w[1]-i.y+(w[3]-w[3]/2),y.drawLine(m,_,d,v,S)):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(m._width=.02*w[3],y.save(),y.translateTransform(w[0]-i.x,w[1]-i.y),y.setClip([0,0,w[2],w[3]]),y._drawPath(this._drawSquiggly(w[2],w[3]),m),y.restore())}else this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?y.drawRectangle(0,0,e,r,b):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?y.drawLine(m,0,r-r/2/3,e,r-r/2/3):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?y.drawLine(m,0,r/2,e,r/2):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(m._width=.02*r,y._drawPath(this._drawSquiggly(Math.round(e),Math.round(r)),m)),this._isLoaded&&this._dictionary.update("Rect",[i.x,i.y,i.x+i.width,i.y+i.height])}return g},i.prototype._drawSquiggly=function(t,e){(Math.floor(t)%2!=0||Math.round(t)>t)&&(t=Math.floor(t)+1);for(var i=new Re,r=new Array,n=Math.ceil(t/e*16),s=t/(n/2),a=parseFloat((.6*(s+s)).toFixed(2)),o=a,h=0,c=0;c<n;c++){var _=e-a+o-.02*e,d=[h,parseFloat(_.toFixed(2))];r.push(d),o=0===o?a:0,h+=s}return i._addLines(r),i},i.prototype._setQuadPoints=function(t){var e=[],i=t[1];this._boundsCollection[0]=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];for(var r=this._quadPoints.length/8,n=0;n<r;n++){var s=this._boundsCollection[Number.parseInt(n.toString(),10)][0],a=this._boundsCollection[Number.parseInt(n.toString(),10)][1];e[0+8*n]=s,e[1+8*n]=i-a,e[2+8*n]=s+this._boundsCollection[Number.parseInt(n.toString(),10)][2],e[3+8*n]=i-a,e[4+8*n]=s,e[5+8*n]=e[1+8*n]-this._boundsCollection[Number.parseInt(n.toString(),10)][3],e[6+8*n]=s+this._boundsCollection[Number.parseInt(n.toString(),10)][2],e[7+8*n]=e[5+8*n]}this._points=e,this._dictionary.set("QuadPoints",this._points)},i}(fi),Bi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._watermarkText="",o._dictionary=new xr,o._dictionary.update("Type",vr.get("Annot")),o._dictionary.update("Subtype",vr.get("Watermark")),void 0!==i&&(o._watermarkText=i,o.text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a}),o._type=t._PdfAnnotationType.watermarkAnnotation,o}return li(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new xr(this._crossReference);e.set("Type",vr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),void 0===this.color&&(this.color=[0,0,0]),this._appearanceTemplate=this._createWatermarkAppearance(),this._dictionary.update("Rect",Ft(this)),void 0!==this.opacity&&1!==this._opacity&&this._dictionary.set("CA",this._opacity)},i.prototype._createWatermarkAppearance=function(){var e=this._obtainFont();(void 0===e||null===e||!this._isLoaded&&1===e.size)&&(e=this._lineCaptionFont,this._pdfFont=e),this._rotateAngle=this._getRotationAngle(),(void 0!==this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0||this._rotateAngle!==t.PdfRotationAngle.angle0)&&(0===this._rotateAngle&&(this._rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this._rotateAngle));var i=[0,0,this.bounds.width,this.bounds.height],r=new pi(this,i);r.normal=new Ye(i,this._crossReference);var n=r.normal;$(n,this._rotateAngle);var s,a=r.normal.graphics,o=this.border.width/2,h=new Et(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top),c=new Ve(this.color,o);this.innerColor&&(s=new Ee(this._innerColor)),this._isLoaded?(this._dictionary.has("Contents")&&(this._watermarkText=this._dictionary.get("Contents")),this._dictionary.update("Contents",this._watermarkText)):this._dictionary.update("Contents",this._watermarkText),void 0!==this._watermarkText&&a.drawString(this._watermarkText,e,[0,0,0,0],c,s,h),this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var _=new xr;a._template._content.dictionary._updated=!0;var d=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(d,a._template._content),a._template._content.reference=d,_.set("N",d),_._updated=!0,this._dictionary.set("AP",_),n},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded)t||(this._appearanceTemplate=this._createWatermarkAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((r=e.getRaw("N"))&&(i.reference=r),this._appearanceTemplate=new Ye(i,this._crossReference));else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){var r=e.getRaw("N");r&&(i.reference=r),this._appearanceTemplate=new Ye(i,this._crossReference)}}}else this._appearanceTemplate=this._createWatermarkAppearance();if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}},i}(ui),Li=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._icon=t.PdfRubberStampAnnotationIcon.draft,a._stampWidth=0,a._iconString="",a.rotateAngle=0,a._stampAppearanceFont=new Ae(t.PdfFontFamily.helvetica,20,t.PdfFontStyle.italic|t.PdfFontStyle.bold),a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("Stamp")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.rubberStampAnnotation,a}return li(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=at(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",vr.get("#"+this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"appearance",{get:function(){if(this._isLoaded)return null;if(void 0===this._appearance){var t=[0,0,this.bounds.width,this.bounds.height];this._appearance=new pi(this,t),this._appearance.normal=new Ye(t,this._crossReference)}return this._appearance},enumerable:!0,configurable:!0}),i.prototype.createTemplate=function(){var t;if(this._isLoaded)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){(t=new Ye)._isExported=!0;var r=i.dictionary,n=r.getArray("Matrix"),s=r.getArray("BBox");if(n){for(var a=[],o=0;o<n.length;o++){var h=n[Number.parseInt(o.toString(),10)];a[Number.parseInt(o.toString(),10)]=h}if(s&&s.length>3){var c=C(s),_=this._transformBBox(c,a);t._size=[_[2],_[3]]}}else s&&(r.update("Matrix",[1,0,0,1,-s[0],-s[1]]),t._size=[s[2],s[3]]);t._exportStream(e,this._crossReference)}}}else t=this._createRubberStampAppearance();return t},Object.defineProperty(i.prototype,"_innerTemplateBounds",{get:function(){var t;return this._isLoaded&&((t=this._obtainInnerBounds()).x=this.bounds.x,t.y=this.bounds.y),t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new xr(this._crossReference);e.set("Type",vr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0),this._appearanceTemplate=this._createRubberStampAppearance()},i.prototype._transformBBox=function(t,e){var i=[],r=[],n=this._transformPoint(t.x,t.height,e);i[0]=n[0],r[0]=n[1];var s=this._transformPoint(t.width,t.y,e);i[1]=s[0],r[1]=s[1];var a=this._transformPoint(t.x,t.y,e);i[2]=a[0],r[2]=a[1];var o=this._transformPoint(t.width,t.height,e);return i[3]=o[0],r[3]=o[1],[this._minValue(i),this._minValue(r),this._maxValue(i),this._maxValue(r)]},i.prototype._transformPoint=function(t,e,i){var r=[];return r[0]=t*i[0]+e*i[2]+i[4],r[1]=t*i[1]+e*i[3]+i[5],r},i.prototype._minValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[Number.parseInt(i.toString(),10)]<e&&(e=t[Number.parseInt(i.toString(),10)]);return e},i.prototype._maxValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[Number.parseInt(i.toString(),10)]>e&&(e=t[Number.parseInt(i.toString(),10)]);return e},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=!1;if(this._isLoaded&&(this._setAppearance||e||this._isExport)){if((!e&&!this._isExport||this._setAppearance)&&(this._appearanceTemplate=this._createRubberStampAppearance()),!this._appearanceTemplate&&(this._isExport||e)&&this._dictionary.has("AP")&&(l=this._dictionary.get("AP"))&&l.has("N")&&(u=l.get("N"))){(f=l.getRaw("N"))&&(u.reference=f);var r=!1;if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var n=!1,s=void 0,a=void 0;if(u&&((n=this._page.rotation===t.PdfRotationAngle.angle0&&this.rotateAngle===t.PdfRotationAngle.angle0)||(n=this._page.rotation!==t.PdfRotationAngle.angle0&&this.rotateAngle===t.PdfRotationAngle.angle0)),this._appearanceTemplate=new Ye(u,this._crossReference),r=!0,i=!!n){var o=u.dictionary.getArray("Matrix");if(o){for(var h=[],c=0;c<o.length;c++){var _=o[Number.parseInt(c.toString(),10)];h[Number.parseInt(c.toString(),10)]=_}var d=u.dictionary.getArray("BBox");if(d&&d.length>3){a=C(d);var p=this._transformBBox(a,h);s=[p[2],p[3]],this._appearanceTemplate._size=s}else s=[a.width,a.height]}}else s=[a.width,a.height]}r||(this._appearanceTemplate=new Ye(u,this._crossReference))}}else if(this._isImported&&this._dictionary.has("AP")||this._postProcess(),!this._appearanceTemplate&&(e||this._isImported))if(this._dictionary.has("AP")){var l=this._dictionary.get("AP");if(l&&l.has("N")){var u=l.get("N");if(u){var f=l.getRaw("N");f&&(u.reference=f),this._appearanceTemplate=new Ye(u,this._crossReference)}}}else this._appearanceTemplate=this._createRubberStampAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var g=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var y=this._appearanceTemplate._content.dictionary.getArray("BBox");y&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-y[0],-y[1]])}i?this._flattenAnnotationTemplate(this._appearanceTemplate,i):this._flattenAnnotationTemplate(this._appearanceTemplate,g)}},i.prototype._createRubberStampAppearance=function(){var e,i=[0,0,this.bounds.width,this.bounds.height];this._appearance?(e=this._appearance,this._dictionary.has("Name")||this._dictionary.update("Name",vr.get("#23CustomStamp"))):(this._iconString=this._obtainIconName(this.icon),this._dictionary.update("Name",vr.get("#23"+this._iconString)),(e=new pi(this,i)).normal=new Ye(i,this._crossReference));var r=e.normal;void 0===this._rotate||this._rotate===t.PdfRotationAngle.angle0&&0===this._getRotationAngle()||(this.rotateAngle=this._getRotationAngle(),0===this.rotateAngle&&(this.rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this.rotateAngle)),$(r,this.rotateAngle),this._appearance||this._drawStampAppearance(r),this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var n=new xr;r._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(s,r._content),r._content.reference=s,n.set("N",s),n._updated=!0,this._dictionary.set("AP",n),this._dictionary.set("Border",[this.border.hRadius,this.border.vRadius,this.border.width]),this._dictionary.update("Rect",Ft(this)),r},i.prototype._drawStampAppearance=function(e){var i=new Et;i.alignment=t.PdfTextAlignment.center,i.lineAlignment=t.PdfVerticalAlignment.middle;var r=new Ee(this._obtainBackGroundColor()),n=new Ve(this._obtainBorderColor(),this.border.width),s=e.graphics;s.save(),s.scaleTransform(e._size[0]/(this._stampWidth+4),e._size[1]/28);var a=this._stampAppearanceFont;this._drawRubberStamp(s,n,r,a,i),s.restore()},i.prototype._obtainIconName=function(e){switch(e){case t.PdfRubberStampAnnotationIcon.approved:this._iconString="Approved",this._stampWidth=126;break;case t.PdfRubberStampAnnotationIcon.asIs:this._iconString="AsIs",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.confidential:this._iconString="Confidential",this._stampWidth=166;break;case t.PdfRubberStampAnnotationIcon.departmental:this._iconString="Departmental",this._stampWidth=186;break;case t.PdfRubberStampAnnotationIcon.draft:this._iconString="Draft",this._stampWidth=90;break;case t.PdfRubberStampAnnotationIcon.experimental:this._iconString="Experimental",this._stampWidth=176;break;case t.PdfRubberStampAnnotationIcon.expired:this._iconString="Expired",this._stampWidth=116;break;case t.PdfRubberStampAnnotationIcon.final:this._iconString="Final",this._stampWidth=90;break;case t.PdfRubberStampAnnotationIcon.forComment:this._iconString="ForComment",this._stampWidth=166;break;case t.PdfRubberStampAnnotationIcon.forPublicRelease:this._iconString="ForPublicRelease",this._stampWidth=240;break;case t.PdfRubberStampAnnotationIcon.notApproved:this._iconString="NotApproved",this._stampWidth=186;break;case t.PdfRubberStampAnnotationIcon.notForPublicRelease:this._iconString="NotForPublicRelease",this._stampWidth=290;break;case t.PdfRubberStampAnnotationIcon.sold:this._iconString="Sold",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.topSecret:this._iconString="TopSecret",this._stampWidth=146;break;case t.PdfRubberStampAnnotationIcon.completed:this._iconString="Completed",this._stampWidth=136;break;case t.PdfRubberStampAnnotationIcon.void:this._iconString="Void",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.informationOnly:this._iconString="InformationOnly",this._stampWidth=230;break;case t.PdfRubberStampAnnotationIcon.preliminaryResults:this._iconString="PreliminaryResults",this._stampWidth=260}return this._iconString},i.prototype._obtainBackGroundColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?[251,222,221]:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?[229,238,222]:[219,227,240]},i.prototype._obtainBorderColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?[151,23,15]:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?[73,110,38]:[24,37,100]},i.prototype._drawRubberStamp=function(t,e,i,r,n){t.drawRoundedRectangle(2,1,this._stampWidth,26,3,e,i);var s=new Ee(this._obtainBorderColor());t.drawString(this._iconString.toUpperCase(),r,[this._stampWidth/2+1,15,0,0],null,s,n)},i.prototype._obtainInnerBounds=function(){var t={x:0,y:0,width:0,height:0};if(this._dictionary&&this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i&&void 0!==i.dictionary){var r=i.dictionary;if(r.has("BBox")){var n=r.getArray("BBox");n&&4===n.length&&(t=C(n))}}}}return t},i}(fi),Mi=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.soundAnnotation,i}return li(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(fi),Di=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._intentString="",a._markUpFont=new Ae(t.PdfFontFamily.helvetica,7,t.PdfFontStyle.regular),a._textAlignment=t.PdfTextAlignment.left,a._cropBoxValueX=0,a._cropBoxValueY=0,a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("FreeText")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.freeTextAnnotation,a}return li(i,e),Object.defineProperty(i.prototype,"calloutLines",{get:function(){return void 0===this._calloutLines&&(this._calloutLines=this._getCalloutLinePoints()),this._calloutLines},set:function(t){this._isLoaded||(this._calloutLines=t);var e=!1;if(this._isLoaded&&t.length>=2)if(this._calloutLines.length===t.length){for(a=0;a<t.length;a++)for(var i=t[Number.parseInt(a.toString(),10)],r=0;r<i.length;r++)if(t[Number.parseInt(a.toString(),10)][Number.parseInt(r.toString(),10)]!==this._calloutLines[Number.parseInt(a.toString(),10)][Number.parseInt(r.toString(),10)]){e=!0;break}}else e=!0;if(e){for(var n=this._page.size[1],s=[],a=0;a<t.length&&a<t.length;a++)s.push(t[Number.parseInt(a.toString(),10)][0]+this._cropBoxValueX),s.push(n+this._cropBoxValueY-t[Number.parseInt(a.toString(),10)][1]);this._calloutLines=t,this._dictionary.update("CL",s)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineEndingStyle",{get:function(){return this._lineEndingStyle=this._obtainLineEndingStyle(),this._lineEndingStyle},set:function(t){void 0!==t&&this._dictionary.update("LE",vr.get(O(t))),this._lineEndingStyle=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkUpColor",{get:function(){if(void 0===this._textMarkUpColor){var t=void 0;if(this._dictionary.has("TextColor"))return this._textMarkUpColor=L(this._dictionary.getArray("TextColor")),this._textMarkUpColor;if(this._dictionary.has("DS"))for(var e=this._dictionary.get("DS").split(";"),i=0;i<e.length;i++)if(-1!==e[Number.parseInt(i.toString(),10)].indexOf("color"))return(t=e[Number.parseInt(i.toString(),10)].split(":")[1]).startsWith("#")&&(t=t.substring(1)),this._textMarkUpColor=B(t),this._textMarkUpColor;!this._textMarkUpColor&&this._dictionary.has("RC")}return this._textMarkUpColor},set:function(t){if(void 0!==t&&3===t.length){this._textMarkUpColor=t;var e="font:"+this.font._metrics._postScriptName+" "+this.font._size+"pt;style:"+ut(this.font._style)+";color:"+this._colorToHex(t);this._dictionary.update("DS",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){return this._font||(this._font=this._obtainFont(),(null===this._font||void 0===this._font||!this._isLoaded&&1===this._font.size)&&(this._font=this._markUpFont)),this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("DA")&&(this._borderColor=this._obtainColor()),this._borderColor},set:function(t){void 0!==t&&3===t.length&&(this._borderColor=t,this._dictionary.update("DA",this._getBorderColorString(this.borderColor)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"annotationIntent",{get:function(){return this._dictionary.has("IT")?this._annotationIntent=lt(this._dictionary.get("IT").name):this._annotationIntent=t.PdfAnnotationIntent.none,this._annotationIntent},set:function(e){void 0!==e&&(this._annotationIntent=e,e===t.PdfAnnotationIntent.none?this._dictionary.update("Subj","Text Box"):this._dictionary.update("IT",vr.get(this._obtainAnnotationIntent(this._annotationIntent))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._setPaddings=function(t){this._paddings=t},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new xr(this._crossReference);i.set("Type",vr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._dictionary.has("C")||(this._isTransparentColor=!0),this._updateCropBoxValues(),(t||this._setAppearance)&&(this._appearanceTemplate=this._createAppearance()),t||(this._dictionary.update("Rect",Ft(this)),this._saveFreeTextDictionary())},i.prototype._updateCropBoxValues=function(){if(this._page){var t=void 0;this._page._pageDictionary.has("CropBox")?t=this._page._pageDictionary.getArray("CropBox"):this._page._pageDictionary.has("MediaBox")&&(t=this._page._pageDictionary.getArray("MediaBox")),t&&(this._cropBoxValueX=t[0],this._cropBoxValueY=t[1])}},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded)(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(r=i.get("N"))&&((h=i.getRaw("N"))&&(r.reference=h),this._appearanceTemplate=new Ye(r,this._crossReference));else if(this._postProcess(e),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){var r=i.get("N");r&&((h=i.getRaw("N"))&&(r.reference=h),this._appearanceTemplate=new Ye(r,this._crossReference))}}else this._appearanceTemplate=this._createAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")&&!this._isLoaded){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}n&&void 0!==this._page.rotation&&this._page.rotation!==t.PdfRotationAngle.angle0?this._flattenAnnotationTemplate(this._appearanceTemplate,n):this._appearanceTemplate&&!this._dictionary.has("AP")?this._flattenAnnotationTemplate(this._appearanceTemplate,n):this._dictionary.has("AP")&&this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate)&&this._flattenAnnotationTemplate(this._appearanceTemplate,n)}if(!e&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new xr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");var h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,this._appearanceTemplate._content),a.update("N",h)}},i.prototype._isValidTemplateMatrix=function(t,e,i){var r=!0,n=e;if(t&&t.has("Matrix")){var s=t.getArray("BBox"),a=t.getArray("Matrix");if(a&&s&&a.length>3&&s.length>2&&void 0!==a[0]&&void 0!==a[1]&&void 0!==a[2]&&void 0!==a[3]&&1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&(Math.round(s[0])!==Math.round(-a[4])&&Math.round(s[1])!==Math.round(-a[5])||0===s[0]&&0===Math.round(-a[4]))){var o=this._page.graphics,h=o.save();void 0!==this.opacity&&this._opacity<1&&o.setTransparency(this._opacity),n.x-=s[0],n.y+=s[1],o.drawTemplate(i,n),o.restore(h),this._removeAnnotationFromPage(this._page,this),r=!1}}return r},i.prototype._createAppearance=function(){var e,i=this.border.width/2,r=this._obtainAppearanceBounds(),n=this.rotate;0!==n&&90!==n&&180!==n&&270!==n||(this._isAllRotation=!1),$(e=n>0&&this._isAllRotation?new Ye([0,0,r[2],r[3]],this._crossReference):new Ye(r,this._crossReference),this._getRotationAngle());var s=new Xi,a=this._obtainText();e._writeTransformation=!1;var o=e.graphics,h=this._obtainTextAlignment(),c=this._obtainColor(),_=new Ve(c,this.border.width);this.border.width>0&&(s.borderPen=_);var d=this._obtainStyle(_,r,i,s);if(this.color&&(s.foreBrush=new Ee(this._color)),this.textMarkUpColor&&(s.backBrush=new Ee(this._textMarkUpColor)),s.borderWidth=this.border.width,this.calloutLines&&this._calloutLines.length>=2){if(this._drawCallOuts(o,_),this._isLoaded&&void 0===this._lineEndingStyle&&(this._lineEndingStyle=this.lineEndingStyle),this._lineEndingStyle!==t.PdfLineEndingStyle.none){var p=this._obtainLinePoints(),l=this._getAngle(p),u=this._getAxisValue([p[2],p[3]],90,0);this._drawLineEndStyle(u,o,l,_,s.foreBrush,this.lineEndingStyle,this.border.width,!1)}(d=this._dictionary.has("RD")?[d[0],-d[1],d[2],-d[3]]:[this.bounds.x,-(this._page.size[1]-(this.bounds.y+this.bounds.height)),this.bounds.width,-this.bounds.height])[0]=d[0]+this._cropBoxValueX,d[1]=d[1]-this._cropBoxValueY,this._calculateRectangle(d),s.bounds=d}else d=[d[0],-d[1],d[2],-d[3]],s.bounds=d;for(var f=this._obtainAppearanceBounds(),g=[d[0]-f[0],-d[1]-f[1],d[2]-f[2],-d[1]-f[1]-d[3]-f[3]],y=0;y<g.length;y++)g[Number.parseInt(y.toString(),10)]<0&&(g[Number.parseInt(y.toString(),10)]=-g[Number.parseInt(y.toString(),10)]);this._dictionary.update("RD",g),this.opacity&&this._opacity<1&&(o.save(),o.setTransparency(this._opacity)),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&o.save(),this._drawFreeTextRectangle(o,s,d,h),this._drawFreeMarkUpText(o,s,d,a,h),this.opacity&&this._opacity<1&&o.restore(),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&o.restore();var m=this._obtainAppearanceBounds();return this._dictionary.set("Rect",[m[0],m[1],m[0]+m[2],m[1]+m[3]]),e},i.prototype._calculateRectangle=function(t){for(var e=this._obtainAppearanceBounds(),i=[t[0]-e[0],-t[1]-e[1],t[2]-e[2],-t[1]-e[1]-t[3]-e[3]],r=0;r<4;r++)i[Number.parseInt(r.toString(),10)]<0&&(i[Number.parseInt(r.toString(),10)]=-i[Number.parseInt(r.toString(),10)]);this._dictionary.set("RD",i)},i.prototype._obtainAnnotationIntent=function(e){switch(e){case t.PdfAnnotationIntent.freeTextCallout:this._intentString="FreeTextCallout";break;case t.PdfAnnotationIntent.freeTextTypeWriter:this._intentString="FreeTextTypeWriter"}return this._intentString},i.prototype._obtainFont=function(){var t=this._obtainFontDetails();return!t.size&&this._dictionary.has("RC"),It(t.name,t.size,t.style,this)},i.prototype._drawFreeMarkUpText=function(e,i,r,n,s){var a=!1,o=this.rotate;if(this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation?0!==o||this._isAllRotation||(r=[r[0],r[1]+r[3],r[2],r[3]]):r=[r[1]+r[3],-(r[0]+r[2]),-r[3],r[2]]:r=[-(r[0]+r[2]),-r[3],r[2],-r[3]]:r=[-r[1],r[0],-r[3],r[2]],(void 0===this._font||null===this._font||!this._isLoaded&&1===this._font.size)&&(this._font=this._markUpFont),o>0&&this._isAllRotation){a=!0;var h=this.bounds,c=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),_=this._font.measureString(n,[0,0],c,0,0);o>0&&o<=91?e.translateTransform(_[1],-h.height):o>91&&o<=181?e.translateTransform(h.width-_[1],-(h.height-_[1])):o>181&&o<=271?e.translateTransform(h.width-_[1],-_[1]):o>271&&o<360&&e.translateTransform(_[1],-_[1]),e.rotateTransform(o),i.bounds=[0,0,i.bounds[2],i.bounds[3]]}var d=[r[0],r[1],r[2],r[3]];if(this._paddings&&!this._isLoaded){var p=this._paddings._left,l=this._paddings._top,u=this._paddings._right+this._paddings._left,f=this._paddings._top+this._paddings._bottom;if(i.borderWidth>0){r=[r[0]+(i.borderWidth+p),r[1]+(i.borderWidth+l),m=r[2]-(2*i.borderWidth+u),r[3]>0?r[3]-(2*i.borderWidth+f):-r[3]-(2*i.borderWidth+f)]}else{var g=r[0]+p,y=r[1]+l,m=r[2]-u;r=[g,y,m,r[3]>0?r[3]-f:-r[3]-f]}}else i.borderWidth>0&&(r=[r[0]+1.5*i.borderWidth,r[1]+1.5*i.borderWidth,r[2]-3*i.borderWidth,r[3]>0?r[3]-3*i.borderWidth:-r[3]-3*i.borderWidth]);var b=this._font._metrics._getHeight()>(r[3]>0?r[3]:-r[3]),v=this._font._metrics._getHeight()<=(d[3]>0?d[3]:-d[3]),S=b&&v;this._drawFreeTextAnnotation(e,i,n,this._font,S?d:r,!0,s,a)},i.prototype._drawFreeTextRectangle=function(e,i,r,n){if(this._dictionary.has("BE")){for(var s=0;s<r.length;s++)r[Number.parseInt(s.toString(),10)]<0&&(r[Number.parseInt(s.toString(),10)]=-r[Number.parseInt(s.toString(),10)]);this._drawAppearance(e,i,r),this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation||e.rotateTransform(-270):e.rotateTransform(-180):e.rotateTransform(-90)}else this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation||(e.rotateTransform(-270),i.bounds=[r[1]+r[3],-r[0],-r[3],-r[2]]):(e.rotateTransform(-180),i.bounds=[-(r[2]+r[0]),-(r[3]+r[1]),r[2],r[3]]):(e.rotateTransform(-90),i.bounds=[-r[1],r[2]+r[0]-r[3],-r[2]]),this._drawFreeTextAnnotation(e,i,"",this._font,i.bounds,!1,n,!1)},i.prototype._drawAppearance=function(t,e,i){var r=new Re;if(r._addRectangle(i[0],i[1],i[2],i[3]),this._dictionary.has("BE")){var n=this._dictionary.get("BE");if(n&&n.has("I")){var s=1===n.get("I")?4:9;this._drawCloudStyle(t,e.foreBrush,e.borderPen,s,.833,r._points,!0)}}},i.prototype._drawFreeTextAnnotation=function(e,i,r,n,s,a,o,h){if(a){var c=new Et;c.lineAlignment=t.PdfVerticalAlignment.top,c.alignment=o,c.lineSpacing=0,h?e.drawString(r,n,i.bounds,null,i.backBrush,c):e.drawString(r,n,s,null,i.backBrush,c)}else e.drawRectangle(s[0],s[1],s[2],s[3],i.borderPen,i.foreBrush)},i.prototype._getCalloutLinePoints=function(){if(this._dictionary.has("CL")){var t=this._dictionary.getArray("CL");if(t){this._calloutLines=[];for(var e=0;e<t.length;e+=2){var i=[t[Number.parseInt(e.toString(),10)],this._page.size[1]-t[e+1]];this._calloutLines.push(i)}}}return this._calloutLines},i.prototype._obtainAppearanceBounds=function(){var e=[0,0,0,0];if(this.calloutLines&&this._calloutLines.length>0){for(var i=new Re,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push([0,0]);if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[Number.parseInt(s.toString(),10)]=[this._calloutsClone[Number.parseInt(s.toString(),10)][0],this._calloutsClone[Number.parseInt(s.toString(),10)][1]]}r.length>0&&(this.lineEndingStyle!==t.PdfLineEndingStyle.none&&this._expandAppearance(r),i._addLines(r)),i._addRectangle(this.bounds.x-2,this._page.size[1]-(this.bounds.y+this.bounds.height)-2,this.bounds.width+4,this.bounds.height+4),e=i._getBounds()}else e=[this.bounds.x,this._page.size[1]-(this.bounds.y+this.bounds.height),this.bounds.width,this.bounds.height];return e},i.prototype._obtainCallOutsNative=function(){if(this.calloutLines&&this._calloutLines.length>0){var t=this._page.size;this._calloutsClone=[];for(var e=0;e<this._calloutLines.length;e++)this._calloutsClone.push([this._calloutLines[Number.parseInt(e.toString(),10)][0],t[1]-this._calloutLines[Number.parseInt(e.toString(),10)][1]])}},i.prototype._obtainLinePoints=function(){var t=this._page.size[1];return[this.calloutLines[1][0],t-this.calloutLines[1][1],this.calloutLines[0][0],t-this.calloutLines[0][1]]},i.prototype._obtainLineEndingStyle=function(){var e=t.PdfLineEndingStyle.square;return this._dictionary.has("LE")&&(e=E(this._dictionary.get("LE").name,e)),e},i.prototype._obtainText=function(){var t="";if(this._dictionary.has("Contents")){var e=this._dictionary.get("Contents");return e&&(t=e),t&&""!==t&&(this._text=t),t}return this._dictionary.has("RC")?t=this._rcText:t},i.prototype._obtainTextAlignment=function(){var e,i=t.PdfTextAlignment.left;if(this._dictionary.has("Q")?void 0!==(r=this._dictionary.get("Q"))&&(i=r,e=!0):this._dictionary.has("RC"),!e&&this._dictionary.has("DS"))for(var r=this._dictionary.get("DS"),n=r.split(";"),s=0;s<n.length;s++)if(-1!==n[Number.parseInt(s.toString(),10)].indexOf("text-align"))switch(n[Number.parseInt(s.toString(),10)]){case"left":i=t.PdfTextAlignment.left;break;case"right":i=t.PdfTextAlignment.right;break;case"center":i=t.PdfTextAlignment.center;break;case"justify":i=t.PdfTextAlignment.justify}return i},i.prototype._obtainColor=function(){var t;if(this._isLoaded)if(this._dictionary.has("DA")){var e=this._dictionary.get("DA");Array.isArray(e)&&e.length>0?t=[e[0],e[1],e[2]]:"string"==typeof e&&(this._da=new di(e),t=this._da.color)}else if(this._dictionary.has("MK")){var i=this._mkDictionary;i&&i.has("BC")&&(t=L(i.getArray("BC")))}else t=[0,0,0];else t=this._borderColor?this._borderColor:[0,0,0];return t},i.prototype._expandAppearance=function(e){var i=e[0][1],r=e[0][0];i>this.bounds.y?this.lineEndingStyle!==t.PdfLineEndingStyle.openArrow&&(e[0][1]-=11*this.border.width):e[0][1]+=11*this.border.width,r<=this.bounds.x?e[0][0]-=11*this.border.width:e[0][0]+=11*this.border.width},i.prototype._drawCallOuts=function(t,e){for(var i=new Re,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push([0,0]);if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[Number.parseInt(s.toString(),10)]=[this._calloutsClone[Number.parseInt(s.toString(),10)][0],-this._calloutsClone[Number.parseInt(s.toString(),10)][1]]}r.length>0&&i._addLines(r),t._drawPath(i,e)},i.prototype._saveFreeTextDictionary=function(){(void 0===this.font||null===this.font||!this._isLoaded&&1===this.font.size)&&(this.font=this._markUpFont),this._dictionary.update("Contents",this.text),this._isLoaded&&(this._textAlignment=this.textAlignment),this._dictionary.update("Q",this._textAlignment),this.annotationIntent===t.PdfAnnotationIntent.none?this._dictionary.update("Subj","Text Box"):this._dictionary.update("IT",vr.get(this._obtainAnnotationIntent(this._annotationIntent)));var e="font:"+this.font._metrics._postScriptName+" "+this.font._size+"pt;style:"+ut(this.font._style)+";color:"+this._colorToHex(this.textMarkUpColor);this._dictionary.update("DS",e),this._dictionary.update("DA",this._getBorderColorString(this.borderColor?this._borderColor:[0,0,0]));if(this._dictionary.update("RC",'<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml"><p dir="ltr">'+(this.text?this._getXmlFormattedString(this.text):"")+"</p></body>"),this._calloutLines&&this._calloutLines.length>=2){for(var i=this._page.size[1],r=[],n=0;n<this._calloutLines.length&&n<3;n++)r.push(this._calloutLines[Number.parseInt(n.toString(),10)][0]+this._cropBoxValueX),r.push(i+this._cropBoxValueY-this._calloutLines[Number.parseInt(n.toString(),10)][1]);this._dictionary.update("CL",r)}if(this._setAppearance){var s=this._obtainAppearanceBounds();this._dictionary.update("Rect",[s[0],s[1],s[0]+s[2],s[1]+s[3]])}},i.prototype._getXmlFormattedString=function(t){return t=t.replace("&","&amp;"),t=t.replace("<","&lt;"),t=t.replace(">","&gt;")},i}(fi),Oi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._textAlignment=t.PdfTextAlignment.left,a._dictionary=new xr,a._dictionary.update("Type",vr.get("Annot")),a._dictionary.update("Subtype",vr.get("Redact")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.redactionAnnotation,a}return li(i,e),Object.defineProperty(i.prototype,"repeatText",{get:function(){return void 0===this._repeat&&this._dictionary.has("Repeat")&&(this._repeat=this._dictionary.get("Repeat")),this._repeat},set:function(t){t!==this._repeat&&(this._repeat=t,this._dictionary&&this._dictionary.update("Repeat",t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textColor",{get:function(){return void 0===this._textColor&&this._dictionary.has("C")&&(this._textColor=L(this._dictionary.getArray("C"))),this._textColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.textColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._textColor=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("OC")&&(this._borderColor=L(this._dictionary.getArray("OC"))),this._borderColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.borderColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._borderColor=t,this._dictionary.update("OC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"overlayText",{get:function(){return void 0===this._overlayText&&this._dictionary.has("OverlayText")&&(this._overlayText=this._dictionary.get("OverlayText")),this._overlayText},set:function(t){"string"==typeof t&&(this._dictionary.update("OverlayText",t),this._overlayText=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new xr(this._crossReference);i.set("Type",vr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._setAppearance&&(this._appearanceTemplate=this._createRedactionAppearance(t)),this._dictionary.update("Rect",Ft(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),!this._isImported){if(this._isLoaded)this._appearanceTemplate=this._createRedactionAppearance(t);else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){var r=e.getRaw("N");r&&(i.reference=r),this._appearanceTemplate=new Ye(i,this._crossReference)}}}else this._appearanceTemplate=this._createRedactionAppearance(t);if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}}},i.prototype._createRedactionAppearance=function(t){var e=this._createNormalAppearance();if(t)this._isLoaded&&null!==this._page&&this._removeAnnotationFromPage(this._page,this);else{var i=this._createBorderAppearance();if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");wt(r,this._crossReference,"N"),wt(r,this._crossReference,"R")}var n=new xr(this._crossReference);i._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,i._content),i._content.reference=s,n.set("N",s),e._content.dictionary._updated=!0;var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,e._content),e._content.reference=a,n.set("R",a),n._updated=!0,this._dictionary.set("AP",n)}return e},i.prototype._createBorderAppearance=function(){var t,e=[0,0,this.bounds.width,this.bounds.height],i=new Ye(e,this._crossReference),r=this.border.width/2,n=i.graphics,s=this.border.width;this.border.width>0&&this.borderColor&&(t=new Ve(this.borderColor,s));var a=[e[0],e[1],e[2],e[3]];if(this.opacity<1){var o=n.save();n.setTransparency(this.opacity),n.drawRectangle(a[0]+r,a[1]+r,a[2]-s,a[3]-s,t,null),n.restore(o)}else n.drawRectangle(a[0]+r,a[1]+r,a[2]-s,a[3]-s,t,null);return i},i.prototype._createNormalAppearance=function(){var e=[0,0,this.bounds.width,this.bounds.height],i=new Ye(e,this._crossReference);$(i,this._getRotationAngle());var r,n=this.border.width/2,s=i.graphics,a=new Xi;this.textColor&&this.border.width>0&&(r=new Ve(this.textColor,this.border.width));var o,h;this.innerColor&&(o=new Ee(this.innerColor)),h=new Ee(this.textColor?this.textColor:[128,128,128]),a.backBrush=o,a.borderWidth=n;var c=this.border.width,_=[e[0],e[1],e[2],e[3]];if(this.opacity<1){var d=s.save();s.setTransparency(this.opacity),s.drawRectangle(_[0]+n,_[1]+n,_[2]-c,_[3]-c,r,o),s.restore(d)}else s.drawRectangle(_[0]+n,_[1]+n,_[2]-c,_[3]-c,r,o);if(s.restore(),this.overlayText&&""!==this._overlayText){var p=0,l=0;void 0!==this.font&&null!==this.font||(this.font=this._lineCaptionFont);var u=0,f=0,g=0,y=void 0;this._isLoaded&&(this._textAlignment=this.textAlignment);var m=new Et(this._textAlignment,t.PdfVerticalAlignment.middle),b=this.font.measureString(this.overlayText,[0,0],m,0,0);if(this._isLoaded&&void 0===this._repeat&&(this._repeat=this.repeatText),this._repeat){b[0]<=0&&(b[0]=1),p=this.bounds.width/b[0],l=Math.floor(this.bounds.height/this.font._size),g=Math.abs(this.bounds.width-Math.floor(p)*b[0]),this._textAlignment===t.PdfTextAlignment.center&&(f=g/2),this._textAlignment===t.PdfTextAlignment.right&&(f=g);for(var v=1;v<p;v++){for(var S=0;S<l;S++)y=[f,u,0,0],s.drawString(this.overlayText,this.font,y,null,h,null),u+=this.font._size;f+=b[0],u=0}}else g=Math.abs(this.bounds.width-b[0]),this._textAlignment===t.PdfTextAlignment.center&&(f=g/2),this._textAlignment===t.PdfTextAlignment.right&&(f=g),y=[f,0,0,0],s.drawString(this.overlayText,this.font,y,null,h,null)}return i},i}(ui),Ei=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.richMediaAnnotation,i}return li(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),void 0!==this.flattenPopups&&this.flattenPopups&&this._flattenPopUp(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ye(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(ui),Vi=function(e){function i(){var i=e.call(this)||this;return i._isAutoResize=!1,i._visibility=t.PdfFormFieldVisibility.visible,i._isFont=!1,i._isTransparentBackColor=!1,i._isWidget=!0,i._type=t._PdfAnnotationType.widgetAnnotation,i}return li(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._dictionary=t,r._crossReference=e,r},Object.defineProperty(i.prototype,"page",{get:function(){return this._getPage()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return void 0===this._color&&this._defaultAppearance&&(this._color=this._da.color),this._color},set:function(t){void 0!==this.color&&this._color===t||(this._color=t);var e=!1;this._defaultAppearance||(this._da=new di(""),e=!0),(e||this._da.color!==t)&&(this._da.color=t,this._dictionary.update("DA",this._da.toString()))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_hasBackColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;return t&&t.has("BG")}return!this._isTransparentBackColor},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){if(void 0===this._borderColor){var t=this._mkDictionary;if(t&&t.has("BC")){var e=t.getArray("BC");e&&(this._borderColor=L(e))}}return void 0!==this._borderColor&&null!==this._borderColor||(this._borderColor=[0,0,0]),this._borderColor},set:function(t){void 0!==this.borderColor&&this.borderColor===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new xr(this._crossReference)),this._mkDictionary.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._borderColor=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rotate",{get:function(){return void 0===this._rotationAngle&&(this._mkDictionary&&this._mkDictionary.has("R")?this._rotationAngle=this._mkDictionary.get("R"):this._dictionary.has("R")&&(this._rotationAngle=this._dictionary.get("R"))),this._rotationAngle},set:function(t){void 0!==this.rotate&&this._rotationAngle===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new xr(this._crossReference)),this._mkDictionary.update("R",t),this._rotationAngle=t,this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){if(void 0===this._highlightMode&&this._dictionary.has("H")){var t=this._dictionary.get("H");this._highlightMode=V(t.name)}return this._highlightMode},set:function(t){this._highlightMode!==t&&this._dictionary.update("H",j(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._isLoaded&&void 0===this._bounds&&(this._bounds=N(this._dictionary,this._getPage())),void 0!==this._bounds&&null!==this._bounds||(this._bounds={x:0,y:0,width:0,height:0}),this._bounds},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");this._bounds=t,this._page&&this._page._isNew&&this._page._pageSettings?this._dictionary.update("Rect",Ft(this)):this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this._getPage()))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return void 0===this._textAlignment&&this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){void 0!==this._textAlignment&&this._textAlignment===t||this._dictionary.update("Q",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visibility",{get:function(){var e;if(!this._isLoaded)return this._visibility;e=t.PdfFormFieldVisibility.visible;var i=t.PdfAnnotationFlag.default;if(this._hasFlags){var r=3;switch(((i=this.flags)&t.PdfAnnotationFlag.hidden)===t.PdfAnnotationFlag.hidden&&(r=0),(i&t.PdfAnnotationFlag.noView)===t.PdfAnnotationFlag.noView&&(r=1),(i&t.PdfAnnotationFlag.print)!==t.PdfAnnotationFlag.print&&(r&=2),r){case 0:e=t.PdfFormFieldVisibility.hidden;break;case 1:e=t.PdfFormFieldVisibility.hiddenPrintable;break;case 2:e=t.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:e=t.PdfFormFieldVisibility.visible}}else e=t.PdfFormFieldVisibility.visibleNotPrintable;return e},set:function(e){if(this._isLoaded)St(this._dictionary,e),this._dictionary._updated=!0;else{switch(e){case t.PdfFormFieldVisibility.hidden:this.flags=t.PdfAnnotationFlag.hidden;break;case t.PdfFormFieldVisibility.hiddenPrintable:this.flags=t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visible:this.flags=t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visibleNotPrintable:this.flags=t.PdfAnnotationFlag.default}this._visibility=e}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(!this._pdfFont){var e=void 0;if(this._crossReference){var i=this._crossReference._document.form,r=this._obtainFontDetails();if(i&&i._dictionary.has("DR")){var n=i._dictionary.get("DR");if(n.has("Font")){var s=n.get("Font");if(s.has(r.name)){var a=s.get(r.name);if(a&&r.name&&a.has("BaseFont")){var o=a.get("BaseFont"),h=t.PdfFontStyle.regular;o&&(e=o.name,h=Tt(o.name),e.includes("-")&&(e=e.substring(0,e.indexOf("-"))),this._pdfFont=It(e,r.size,h,this))}}}}}}return(null===this._pdfFont||void 0===this._pdfFont||!this._isLoaded&&1===this._pdfFont.size)&&(this._pdfFont=this._circleCaptionFont),this._pdfFont},set:function(t){t&&t instanceof Pe&&(this._pdfFont=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_defaultAppearance",{get:function(){if(void 0===this._da&&this._dictionary.has("DA")){var t=this._dictionary.get("DA");t&&""!==t&&(this._da=new di(t))}return this._da},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),i.prototype._create=function(e,i,r){return this._page=e,this._crossReference=e._crossReference,this._ref=this._crossReference._getNextReference(),this._dictionary=new xr(this._crossReference),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary._currentObj=this,this._dictionary.objId=this._ref.toString(),this._dictionary.update("Type",vr.get("Annot")),this._dictionary.update("Subtype",vr.get("Widget")),this.flags|=t.PdfAnnotationFlag.print,this._dictionary.update("P",e._ref),e._addWidget(this._ref),this.border=new Ki,this.bounds=i,r&&(this._field=r,this._dictionary.update("Parent",this._field._ref)),this._dictionary},i.prototype._doPostProcess=function(e,i){if(void 0===e&&(e=!1),void 0===i&&(i=!1),e||i){var r=void 0;if(i||e&&this._dictionary.has("AP"),!r&&this._dictionary.has("AP")){var n=this._dictionary.get("AP");n&&n.has("N")&&(r=n.get("N"),(d=n.getRaw("N"))&&r&&(r.reference=d))}if(r){var s=void 0;if(e){var a=new Ye(r,this._crossReference),o=this._getPage();if(o){var h=o.graphics;h.save(),o.rotation===t.PdfRotationAngle.angle90?(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(90)):o.rotation===t.PdfRotationAngle.angle180?(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(-180)):o.rotation===t.PdfRotationAngle.angle270&&(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(270)),s={x:this.bounds.x,y:this.bounds.y,width:a._size[0],height:a._size[1]},h.drawTemplate(a,s),h.restore()}}else{var c=void 0;if(this._dictionary.has("AP"))c=this._dictionary.get("AP");else{var _=this._crossReference._getNextReference();c=new xr(this._crossReference),this._crossReference._cacheMap.set(_,c),this._dictionary.update("AP",_)}wt(c,this._crossReference,"N");var d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,r),c.update("N",d)}}this._dictionary._updated=!1}},i.prototype._initializeFont=function(t){this._pdfFont=t;var e;if(this._crossReference){var i=void 0;(e=this._crossReference._document)&&(i=e.form._dictionary.has("DR")?e.form._dictionary.get("DR"):new xr(this._crossReference));var r=void 0,n=!1;if(i.has("Font")){var s=i.getRaw("Font");s&&s instanceof wr?(n=!0,r=this._crossReference._fetch(s)):s instanceof xr&&(r=s)}r||(r=new xr(this._crossReference),i.update("Font",r));var a=vr.get(G()),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._pdfFont._dictionary),t instanceof xe?this._pdfFont._pdfFontInternals&&this._crossReference._cacheMap.set(o,this._pdfFont._pdfFontInternals):this._pdfFont._dictionary&&this._crossReference._cacheMap.set(o,this._pdfFont._dictionary),r.update(a.name,o),i._updated=!0,e.form._dictionary.update("DR",i),e.form._dictionary._updated=!0,this._fontName=a.name;var h=new di;h.fontName=this._fontName,h.fontSize=this._pdfFont._size,h.color=this.color?this.color:[0,0,0],this._dictionary.update("DA",h.toString()),n&&(i._updated=!0),this._isFont=!0}},i.prototype._getPage=function(){if(!this._page){var t;this._crossReference&&(t=this._crossReference._document);var e=void 0;if(this._dictionary.has("P")){var i=this._dictionary.getRaw("P");if(i&&t)for(var r=0;r<t.pageCount;r++){var n=t.getPage(r);if(n&&n._ref===i){e=n;break}}}!e&&t&&this._ref&&(e=X(t,this._ref)),this._page=e}return this._page},i.prototype._beginSave=function(){if(!this._isLoaded&&!this._page._isNew){var t=this._bounds;this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this._page))}},i.prototype._parseBackColor=function(){var t;if(this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor){if(void 0===this._backColor){var e=this._mkDictionary;if(e&&e.has("BG")){var i=e.getArray("BG");i&&(this._backColor=L(i))}}void 0!==this._backColor&&null!==this._backColor||(this._backColor=[255,255,255]),t=this._backColor}return t},i.prototype._updateBackColor=function(t,e){void 0===e&&(e=!1);var i=!1;if(4===t.length&&255!==t[3]){this._isTransparentBackColor=!0,this._dictionary.has("BG")&&(delete this._dictionary._map.BG,i=!0);var r=this._mkDictionary;r&&r.has("BG")&&(delete r._map.BG,this._dictionary._updated=!0,i=!0)}else this._isTransparentBackColor=!1,void 0!==this.backColor&&this._backColor===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new xr(this._crossReference)),this._mkDictionary.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._backColor=[t[0],t[1],t[2]],this._dictionary._updated=!0,i=!0);e&&i&&this._field&&(this._field._setAppearance=!0)},i}(ui),ji=function(e){function i(){return e.call(this)||this}return li(i,e),i._load=function(t,e,r){var n=new i;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=r,n},Object.defineProperty(i.prototype,"checked",{get:function(){return J(this._dictionary)},set:function(t){this.checked!==t&&this._dictionary.update("AS",vr.get(t?"Yes":"Off"))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"style",{get:function(){if(this._isLoaded){var e=this._mkDictionary;e&&e.has("CA")?this._style=et(e.get("CA")):this._style=t.PdfCheckBoxStyle.check}return this._style},set:function(t){if(this.style!==t){this._style=t;var e=this._mkDictionary;e||(e=new xr(this._crossReference),this._dictionary.update("MK",e)),e.update("CA",tt(t))}},enumerable:!0,configurable:!0}),i.prototype._doPostProcess=function(){var e=Y(this.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked,this);if(e){var i=this._getPage();if(i){var r=i.graphics;r.save(),i.rotation===t.PdfRotationAngle.angle90?(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(270)),r._sw._setTextRenderingMode(t._TextRenderingMode.fill),r.drawTemplate(e,this.bounds),r.restore()}}this._dictionary._updated=!1},i.prototype._postProcess=function(t){var e=this._field;t||(t=e&&e.checked?"Yes":"Off"),this._dictionary.update("AS",vr.get(t))},i.prototype._setField=function(e){this._field=e,this._field._stringFormat=new Et(this.textAlignment,t.PdfVerticalAlignment.middle),this._field._addToKid(this)},i}(Vi),zi=function(e){function i(t,i,r){var n=e.call(this)||this;return r&&t&&i&&(r instanceof ii?n._initializeItem(t,i,r.page,r):n._initializeItem(t,i,r)),n}return li(i,e),i._load=function(t,e,r){var n=new i;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=r,n},Object.defineProperty(i.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this._isLoaded&&!this._optionValue&&(this._optionValue=Q(this._dictionary)),this._optionValue},set:function(t){this._optionValue=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initializeItem=function(e,i,r,n){this._optionValue=e,this._page=r,this._create(this._page,i,this._field),this.textAlignment=t.PdfTextAlignment.left,this._dictionary.update("MK",new xr(this._crossReference)),this._mkDictionary.update("BC",[0,0,0]),this._mkDictionary.update("BG",[1,1,1]),this.style=t.PdfCheckBoxStyle.circle,this._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),n&&(this._setField(n),this._dictionary.update("Parent",n._ref))},i.prototype._postProcess=function(t){var e=this._field;!t&&e&&-1!==e.selectedIndex&&(t=e.itemAt(e.selectedIndex).value),this.value===t?this._dictionary.update("AS",vr.get(this.value)):this._dictionary.update("AS",vr.get("Off"))},i}(ji),Ui=function(t){function e(e,i,r){var n=t.call(this)||this;return e&&i&&n._initializeItem(e,i,r),n}return li(e,t),e._load=function(t,i,r){var n=new e;return n._isLoaded=!0,n._dictionary=t,n._crossReference=i,n._field=r,n},Object.defineProperty(e.prototype,"text",{get:function(){return void 0===this._text&&void 0!==this._field&&(this._field instanceof ci||this._field instanceof hi)&&(this._text=this._field._options[Number.parseInt(this._index.toString(),10)][1]),this._text},set:function(t){"string"==typeof t&&void 0!==this._field&&(this._field instanceof ci||this._field instanceof hi)&&t!==this._field._options[Number.parseInt(this._index.toString(),10)][1]&&(this._field._options[Number.parseInt(this._index.toString(),10)][1]=t,this._text=t,this._field._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),e.prototype._initializeItem=function(t,e,i){this._text=t,this._value=e,i&&i instanceof ci&&i._addToOptions(this,i)},e}(ji),Wi=function(){function e(e,i,r){this._cap=void 0!==e&&e,this._type=void 0!==i?i:t.PdfLineCaptionType.inline,this._offset=void 0!==r?r:[0,0]}return Object.defineProperty(e.prototype,"cap",{get:function(){return this._cap},set:function(t){t!==this._cap&&(this._cap=t,this._dictionary&&this._dictionary.update("Cap",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){e!==this._type&&(this._type=e,this._dictionary&&this._dictionary.update("CP",vr.get(e===t.PdfLineCaptionType.top?"Top":"Inline")))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"offset",{get:function(){return this._offset},set:function(t){m(t,this._offset)&&(this._offset=t,this._dictionary&&this._dictionary.update("CO",t))},enumerable:!0,configurable:!0}),e}(),Hi=function(){function e(e,i){this._begin=void 0!==e?e:t.PdfLineEndingStyle.none,this._end=void 0!==i?i:t.PdfLineEndingStyle.none}return Object.defineProperty(e.prototype,"begin",{get:function(){return this._begin},set:function(t){t!==this._begin&&(this._begin=t,this._dictionary&&this._dictionary.update("LE",[vr.get(O(t)),vr.get(O(this._end))]))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},set:function(t){t!==this._end&&(this._end=t,this._dictionary&&this._dictionary.update("LE",[vr.get(O(this._begin)),vr.get(O(t))]))},enumerable:!0,configurable:!0}),e}(),Gi=function(){function e(e,i,r){this._width=void 0!==e?e:1,this._style=void 0!==i?i:t.PdfBorderStyle.solid,void 0!==r&&Array.isArray(r)&&(this._dash=r)}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){if(t!==this._width&&(this._width=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new xr(this._crossReference);e.update("Type",vr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){if(t!==this._style&&(this._style=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new xr(this._crossReference);e.update("Type",vr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){if((void 0===this._dash||m(t,this._dash))&&(this._dash=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new xr(this._crossReference);e.update("Type",vr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),e}(),Ki=function(t){function e(e,i,r,n,s){var a=t.call(this,e,n,s)||this;return a._hRadius=void 0!==i?i:0,a._vRadius=void 0!==r?r:0,a}return li(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){if(t!==this._width&&(this._width=t,this._dictionary)){this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]);var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new xr(this._crossReference);e.update("Type",vr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hRadius",{get:function(){return this._hRadius},set:function(t){t!==this._hRadius&&(this._hRadius=t,this._dictionary&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vRadius",{get:function(){return this._vRadius},set:function(t){t!==this._vRadius&&(this._vRadius=t,this._dictionary&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]))},enumerable:!0,configurable:!0}),e}(Gi),qi=function(){function e(t){if(this._intensity=0,void 0!==t&&null!==t){if(t.has("BE")){var e=this._dictionary.get("BE");e&&(e.has("I")&&(this._intensity=e.get("I")),e.has("S")&&(this._style=this._getBorderEffect(e.get("S"))))}}else this._dictionary=new xr,this._dictionary.set("I",this._intensity),this._dictionary.set("S",this._styleToEffect(this._style))}return Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){if(t!==this._intensity){if(this._intensity=t,this._dictionary){var e=this._dictionary.has("BE")?this._dictionary.get("BE"):new xr(this._crossReference);e.update("I",this._intensity),e.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",e),this._dictionary._updated=!0}this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){if(t!==this._style&&(this._style=t,this._dictionary)){var e=this._dictionary.has("BE")?this._dictionary.get("BE"):new xr(this._crossReference);e.update("I",this._intensity),e.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),e.prototype._getBorderEffect=function(e){return"/C"===e?t.PdfBorderEffectStyle.cloudy:t.PdfBorderEffectStyle.solid},e.prototype._styleToEffect=function(e){return e===t.PdfBorderEffectStyle.cloudy?"C":"S"},e}(),Xi=function(){function t(){this.borderWidth=1}return t}(),Ji=function(){function t(){this.startAngle=0,this.endAngle=0}return t}(),Qi=function(){function t(t,e,i){this._isExport=!1,this._annotations=t,this._page=i,this._crossReference=e,this._parsedAnnotations=new Map,this._comments=[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this._annotations.length},enumerable:!0,configurable:!0}),t.prototype.at=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");if(!this._parsedAnnotations.has(t)){var e=this._annotations[Number.parseInt(t.toString(),10)];if(void 0!==e&&e instanceof wr&&(e=this._crossReference._fetch(e)),void 0!==e&&e instanceof xr){var i=this._parseAnnotation(e);i&&(i._ref=this._annotations[Number.parseInt(t.toString(),10)],this._parsedAnnotations.set(t,i))}}return this._parsedAnnotations.get(t)},t.prototype.add=function(t){if(void 0===t||null===t)throw Error("annotation cannot be null or undefined");if(t._isLoaded)throw Error("cannot add an existing annotation");t._initialize(this._page);var e;void 0!==t._ref&&t._ref._isNew?e=t._ref:(e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,t._dictionary),t._ref=e);var i=this._annotations.length;this._annotations.push(e),this._parsedAnnotations.set(i,t);var r=!1;if(this._page._pageDictionary.has("Annots")){var n=this._page._pageDictionary.get("Annots");null!==n&&void 0!==n&&-1===n.indexOf(e)&&(n.push(e),this._page._pageDictionary.set("Annots",n),r=!0)}return r||this._page._pageDictionary.set("Annots",this._annotations),this._page._pageDictionary._updated=!0,t instanceof fi&&this._addCommentsAndReview(t,t._dictionary.get("F")),this._updateCustomAppearanceResource(t),i},t.prototype.remove=function(t){if(t._ref){var e=this._annotations.indexOf(t._ref);e>-1&&this.removeAt(e)}},t.prototype.removeAt=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");var e=this._annotations[Number.parseInt(t.toString(),10)];if(e&&this._page){var i=this._page._getProperty("Annots"),r=i.indexOf(e);r>-1&&i.splice(r,1),this._page._pageDictionary.set("Annots",i),this._page._pageDictionary._updated=!0,this._annotations.indexOf(e)>-1&&this._annotations.splice(t,1),this._parsedAnnotations.has(t)&&(this._parsedAnnotations.delete(t),this._reorderParsedAnnotations(t));var n=this._page._crossReference;n&&n._cacheMap.has(e)&&n._cacheMap.delete(e)}},t.prototype._reorderParsedAnnotations=function(t){var e=new Map;this._parsedAnnotations.forEach(function(i,r){r>t?e.set(r-1,i):e.set(r,i)}),this._parsedAnnotations=e},t.prototype._updateCustomAppearanceResource=function(t){t instanceof Li&&void 0!==t._appearance&&t._appearance.normal.graphics._processResources(t._crossReference)},t.prototype._addCommentsAndReview=function(t,e){this._updateChildReference(t,t.comments,e),this._updateChildReference(t,t.reviewHistory,e)},t.prototype._updateChildReference=function(t,e,i){if(e&&e.count>0){if(30===i)throw new Error("Could not add comments/reviews to the review");for(var r=0;r<e.count;r++){var n=e._collection[Number.parseInt(r.toString(),10)];n&&!n._dictionary.has("IRT")&&(0!==r&&e._isReview?n._dictionary.update("IRT",e._collection[r-1]._ref):n._dictionary.update("IRT",t._ref),e._isReview?n._isReview=!0:n._isComment=!0,this.add(n))}}},t.prototype._parseAnnotation=function(t){var e;if(t.has("Subtype")){var i=t.get("Subtype"),r=t.get("Rect");if(i){var n=void 0;switch(i.name){case"Line":e=gi._load(this._page,t);break;case"Circle":e=t.has("Measure")?yi._load(this._page,t):r[2]-r[0]===r[3]-r[1]?yi._load(this._page,t):mi._load(this._page,t);break;case"Square":e=r[2]===r[3]?bi._load(this._page,t):vi._load(this._page,t);break;case"Polygon":e=Si._load(this._page,t);break;case"PolyLine":t.has("Measure")&&t.has("IT")&&(s=t.get("IT"))&&"PolyLineAngle"===s.name&&(e=Pi._load(this._page,t)),e||(e=wi._load(this._page,t));break;case"Ink":e=Ai._load(this._page,t);break;case"Popup":case"Text":e=ki._load(this._page,t);break;case"Link":if(t.has("A")&&(n=t.get("A")),n&&n.has("S")){var s=n.get("S").name;if(s){var a=this._hasValidBorder(t.getArray("Border"));"URI"===s?e=a?Ni._load(this._page,t):this._getLinkAnnotation(t):"Launch"===s?e=xi._load(this._page,t):"GoToR"===s?e=this._getLinkAnnotation(t):"GoTo"===s&&(e=Ii._load(this._page,t))}}else"Link"===i.name&&(e=Ii._load(this._page,t));break;case"FileAttachment":e=Ci._load(this._page,t);break;case"3D":e=Ri._load(this._page,t);break;case"FreeText":e=Di._load(this._page,t);break;case"Redact":e=Oi._load(this._page,t);break;case"RichMedia":e=Ei._load(this._page,t);break;case"Watermark":e=Bi._load(this._page,t);break;case"Stamp":e=Li._load(this._page,t);break;case"Sound":e=Mi._load(this._page,t);break;case"Highlight":case"Squiggly":case"StrikeOut":case"Underline":e=Fi._load(this._page,t)}}}return e},t.prototype._getLinkAnnotation=function(t){var e;if(t.has("A")){var i=t.get("A");if(i&&i.has("S")){var r=i.get("S");r&&"GoToR"===r.name&&i.has("F")?e=xi._load(this._page,t):r&&"URI"===r.name&&(e=Ti._load(this._page,t))}}else e=Ti._load(this._page,t);return e},t.prototype._hasValidBorder=function(t){if(void 0===t||null===t)return!1;for(var e=0;e<t.length;e++){var i=0,r=t[Number.parseInt(e.toString(),10)];if(null!==r&&void 0!==r&&(i=r),i>0)return!1}return!0},t.prototype._doPostProcess=function(t){for(var e=this.count-1;e>=0;e--){var i=this.at(e);i&&(i._isExport=this._isExport,i._doPostProcess(i.flatten||t))}},t.prototype._reArrange=function(t,e,i){if(this._annotations){e>this._annotations.length&&(e=0),i>=this._annotations.length&&(i=this._annotations.indexOf(t));var r=this._crossReference._fetch(this._annotations[Number.parseInt(i.toString(),10)]);if(r.has("Parent")){var n=r.getRaw("Parent");if(n&&n===t||t===this._annotations[Number.parseInt(i.toString(),10)]){var s=this._annotations[Number.parseInt(i.toString(),10)];this._annotations[Number.parseInt(i.toString(),10)]=this._annotations[Number.parseInt(e.toString(),10)],this._annotations[Number.parseInt(e.toString(),10)]=s}}}return this._annotations},t.prototype._clear=function(){this._annotations=[],this._parsedAnnotations=new Map,this._comments=[]},t}(),Yi=function(){function e(t,e){this._collection=[],this._annotation=t,this._isReview=e,(this._annotation._isLoaded||void 0!==t._page)&&(this._page=t._page,this._parentDictionary=t._dictionary,this._annotation._isLoaded&&this._parseCommentsOrReview())}return Object.defineProperty(e.prototype,"count",{get:function(){return this._collection.length},enumerable:!0,configurable:!0}),e.prototype.at=function(t){if(t<0||t>=this._collection.length)throw Error("Index out of range.");return this._collection[Number.parseInt(t.toString(),10)]},e.prototype.add=function(e){if(30===this._annotation._dictionary.get("F"))throw new Error("Could not add comments/reviews to the review");if(e._dictionary.update("F",this._annotation.flags===t.PdfAnnotationFlag.locked?128:this._isReview?30:28),this._annotation&&(this._annotation._isLoaded||this._page&&this._annotation._ref)){this._page.annotations.add(e);var i=this._collection.length;0!==i&&this._isReview?e._dictionary.update("IRT",this._collection[Number.parseInt((i-1).toString(),10)]._ref):e._dictionary.update("IRT",this._annotation._ref),this._isReview?e._isReview=!0:e._isComment=!0}this._collection.push(e)},e.prototype.remove=function(t){var e=this._collection.indexOf(t);e>-1&&this.removeAt(e)},e.prototype.removeAt=function(t){if(!(t>-1&&t<this._collection.length))throw new Error("Index out of range.");var e=this._collection[Number.parseInt(t.toString(),10)];if(this._isReview&&t<this._collection.length-1){var i=this._collection[Number.parseInt((t+1).toString(),10)],r=e._dictionary._get("IRT");i._dictionary.set("IRT",r),i._dictionary._updated=!0}this._collection.splice(t,1),this._page.annotations.remove(e)},e.prototype._parseCommentsOrReview=function(){this._isReview?this._parseReview():this._parseComments()},e.prototype._parseReview=function(){var t=this._page.annotations,e=new Map;if(e.set(this._annotation._ref,this._annotation),t._comments&&t._comments.length>0){for(var i=[],r=0;r<t._comments.length;r++){o=(s=t._comments[Number.parseInt(r.toString(),10)])._dictionary._get("IRT");s._isReview&&o&&e.has(o)?(this._collection.push(s),e.set(s._ref,s)):i.push(s)}i.length>0?t._comments=i:t._comments=[]}else for(var n=t.count,r=0;r<n;r++){var s=t.at(r);if(s&&s instanceof ki){var a=s._dictionary;if(s._dictionary.has("IRT")){var o=a._get("IRT");s._isReview&&o&&e.has(o)?(this._collection.push(s),e.set(s._ref,s)):t._comments.push(s)}}}e.clear()},e.prototype._parseComments=function(){var t=this._page.annotations;if(t._comments&&t._comments.length>0){for(var e=[],i=0;i<t._comments.length;i++){a=bt(s=(n=t._comments[Number.parseInt(i.toString(),10)])._dictionary);(o=s._get("IRT"))&&o===this._annotation._ref&&!a?this._collection.push(n):e.push(n)}e.length>0?t._comments=e:t._comments=[]}else for(var r=t.count,i=0;i<r;i++){var n=t.at(i);if(n&&n instanceof ki){var s=n._dictionary;if(n._dictionary.has("IRT")){var a=bt(s),o=s._get("IRT");o&&o===this._annotation._ref&&!a?this._collection.push(n):t._comments.push(n)}}}},e}(),Zi=function(){function e(t,e,i,r){this._isAnnotationParsed=!1,this._isNew=!1,this._pageIndex=e,this._pageDictionary=i,this._crossReference=t,this._ref=r}return Object.defineProperty(e.prototype,"annotations",{get:function(){if(void 0===this._annotations){if(this._pageDictionary.has("Annots")){var t=this._getProperty("Annots");if(t&&Array.isArray(t)){var e=this._crossReference._document.form._parseWidgetReferences();if(e&&e.length>0){var i=[];t.forEach(function(t){-1===e.indexOf(t)&&i.push(t)}),this._annotations=new Qi(i,this._crossReference,this)}else this._annotations=new Qi(t,this._crossReference,this)}}void 0===this._annotations&&(this._annotations=new Qi([],this._crossReference,this))}return this._annotations},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(void 0===this._size){var t=this.mediaBox,e=0,i=0;t&&(e=t[2]-t[0],i=0!==t[3]?t[3]-t[1]:t[1]),i<0&&(i=-i),e<0&&(e=-e),this._size=[e,i]}return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){var e=0;return void 0===this._rotation&&((e=T(this._pageDictionary,"Rotate",!1,!0))<0&&(e+=360),this._rotation=void 0!==e?e/90%4:t.PdfRotationAngle.angle0),this._rotation},set:function(t){if(!this._isNew){this._rotation=t;var e=90*Math.floor(this._rotation);e>=360&&(e%=360),this._pageDictionary.update("Rotate",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabOrder",{get:function(){return this._obtainTabOrder()},set:function(e){this._tabOrder=e;var i="";this._tabOrder!==t.PdfFormFieldsTabOrder.none&&(this._tabOrder===t.PdfFormFieldsTabOrder.row?i="R":this._tabOrder===t.PdfFormFieldsTabOrder.column?i="C":this._tabOrder===t.PdfFormFieldsTabOrder.structure&&(i="S")),this._pageDictionary.update("Tabs",vr.get(i))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cropBox",{get:function(){return void 0===this._cBox&&(this._cBox=T(this._pageDictionary,"CropBox",!1,!0)),void 0===this._cBox&&(this._cBox=[0,0,0,0]),this._cBox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mediaBox",{get:function(){return void 0===this._mBox&&(this._mBox=T(this._pageDictionary,"MediaBox",!1,!0)),void 0===this._mBox&&(this._mBox=[0,0,0,0]),this._mBox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){if(void 0===this._orientation&&void 0!==this.size){var e=this.size;e[0]>e[1]?this._orientation=t.PdfPageOrientation.landscape:this._orientation=t.PdfPageOrientation.portrait}return this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_origin",{get:function(){return(void 0===this._o||0===this._o[0]&&0===this._o[1])&&(this._o=[this.mediaBox[0],this._mBox[1]]),this._o},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"graphics",{get:function(){return(void 0===this._g||this._needInitializeGraphics)&&this._parseGraphics(),this._g},enumerable:!0,configurable:!0}),e.prototype._addWidget=function(t){var e;this._pageDictionary.has("Annots")&&(e=this._getProperty("Annots")),e&&Array.isArray(e)?e.push(t):this._pageDictionary.update("Annots",[t]),this._pageDictionary._updated=!0},e.prototype._getProperty=function(t,e){void 0===e&&(e=!1);var i=T(this._pageDictionary,t,e,!1);return Array.isArray(i)?1!==i.length&&i[0]instanceof xr?xr.merge(this._crossReference,i):i[0]:i},e.prototype._parseGraphics=function(){this._loadContents();var t=new Rr([32,113,32,10]),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._contents.splice(0,0,e);var i=new Rr([32,81,32,10]),r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),this._contents.push(r);var n=new Rr([]),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),this._contents.push(s),this._pageDictionary.set("Contents",this._contents),this._pageDictionary._updated=!0,this._initializeGraphics(n)},e.prototype._loadContents=function(){var t,e=this._pageDictionary.getRaw("Contents");null!==e&&void 0!==e&&e instanceof wr&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof Nr?this._contents=[t]:e&&Array.isArray(e)?this._contents=e:this._contents=[]},e.prototype._initializeGraphics=function(e){var i=!1,r=0,n=0,s=0,a=0,o=this.size,h=this.mediaBox;h&&h.length>=4&&(r=h[0],n=h[1],s=h[2],a=h[3]);var c;if(this._pageDictionary.has("CropBox"))if((c=this.cropBox)&&c.length>=4){var _=c[0],d=c[1],p=c[2],l=c[3];(_<0||d<0||p<0||l<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(_))===Math.floor(Math.abs(o[0]))?this._g=new Be([Math.max(_,p),Math.max(d,l)],e,this._crossReference,this):(this._g=new Be(o,e,this._crossReference,this),this._g._cropBox=c)}else this._g=new Be(o,e,this._crossReference,this);else if((r<0||n<0||s<0||a<0)&&Math.floor(Math.abs(n))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(s))===Math.floor(Math.abs(o[0]))){var u=Math.max(r,s),f=Math.max(n,a);(u<=0||f<=0)&&(i=!0,r<0&&(r=-r),n<0&&(n=-n),s<0&&(s=-s),a<0&&(a=-a),u=Math.max(r,s),f=Math.max(n,a)),this._g=new Be([u,f],e,this._crossReference,this)}else this._g=new Be(o,e,this._crossReference,this);this._pageDictionary.has("MediaBox")&&(this._g._mediaBoxUpperRightBound=i?-n:a),this._graphicsState=this._g.save();var g=this._origin;if(g[0]>=0&&g[1]>=0||Math.sign(g[0])!==Math.sign(g[1])?this._g._initializeCoordinates():this._g._initializeCoordinates(this),!this._isNew){var y=this.rotation;if(!Number.isNaN(y)&&(y!==t.PdfRotationAngle.angle0||this._pageDictionary.has("Rotate"))){var m=void 0;m=this._pageDictionary.has("Rotate")?this._pageDictionary.get("Rotate"):90*y;var b=this._g._clipBounds;90===m?(this._g.translateTransform(0,o[1]),this._g.rotateTransform(-90),this._g._clipBounds=[b[0],b[1],o[0],o[1]]):180===m?(this._g.translateTransform(o[0],o[1]),this._g.rotateTransform(-180)):270===m&&(this._g.translateTransform(o[0],0),this._g.rotateTransform(-270),this._g._clipBounds=[b[0],b[1],o[1],o[0]])}}if(this._isNew&&this._pageSettings){var v=this._getActualBounds(this._pageSettings);this._g._clipTranslateMargins(v)}this._needInitializeGraphics=!1},e.prototype._getActualBounds=function(t){var e=t._getActualSize();return[t.margins.left,t.margins.top,e[0],e[1]]},e.prototype._fetchResources=function(){if(void 0===this._resourceObject)if(this._pageDictionary&&this._pageDictionary.has("Resources")){var t=this._pageDictionary.getRaw("Resources");null!==t&&void 0!==t&&t instanceof wr?(this._hasResourceReference=!0,this._resourceObject=this._crossReference._fetch(t)):t instanceof xr&&(this._resourceObject=t)}else this._resourceObject=new xr(this._crossReference),this._pageDictionary.update("Resources",this._resourceObject);return this._resourceObject},e.prototype._getCropOrMediaBox=function(){var t;return this._pageDictionary.has("CropBox")?t=this._pageDictionary.getArray("CropBox"):this._pageDictionary.has("MediaBox")&&(t=this._pageDictionary.getArray("MediaBox")),t},e.prototype._beginSave=function(){void 0!==this._graphicsState&&(this.graphics.restore(this._graphicsState),this._graphicsState=null,this._needInitializeGraphics=!0)},e.prototype._destroy=function(){this._pageDictionary=void 0,this._size=void 0,this._mBox=void 0,this._cBox=void 0,this._o=void 0,this._g=void 0,this._graphicsState=void 0,this._contents=void 0},e.prototype._obtainTabOrder=function(){if(this._pageDictionary.has("Tabs")){var e=this._pageDictionary.get("Tabs");e===vr.get("R")?this._tabOrder=t.PdfFormFieldsTabOrder.row:e===vr.get("C")?this._tabOrder=t.PdfFormFieldsTabOrder.column:e===vr.get("S")?this._tabOrder=t.PdfFormFieldsTabOrder.structure:e===vr.get("W")&&(this._tabOrder=t.PdfFormFieldsTabOrder.widget)}return null!==this._tabOrder&&void 0!==this._tabOrder||(this._tabOrder=t.PdfFormFieldsTabOrder.none),this._tabOrder},e.prototype._removeAnnotation=function(t){if(this._pageDictionary.has("Annots")){var e=this._getProperty("Annots");if(e&&Array.isArray(e)){var i=e.indexOf(t);i>=0&&e.splice(i,1),this._pageDictionary.set("Annots",e),this._pageDictionary._updated=!0}}},e}(),$i=function(){function e(e,i){this._location=[0,0],this._destinationMode=t.PdfDestinationMode.location,this._zoom=0,this._isValid=!0,this._index=0,this._destinationBounds=[0,0,0,0],this._array=Array(),void 0!==e&&null!==e&&(e.rotation===t.PdfRotationAngle.angle180?this._location=[e.graphics._size[0],this._location[1]]:e.rotation===t.PdfRotationAngle.angle90?this._location=[0,0]:e.rotation===t.PdfRotationAngle.angle270?this._location=[e.graphics._size[0],0]:this._location=[0,this._location[1]],this._page=e,this._index=e._pageIndex),void 0!==i&&2===i.length&&(this._location=i),void 0!==i&&4===i.length&&(this._location=[i[0],i[1]],this._destinationBounds=i)}return Object.defineProperty(e.prototype,"zoom",{get:function(){return this._zoom},set:function(t){t!==this._zoom&&(this._zoom=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){return this._page},set:function(t){t!==this._page&&(this._page=t,this._initializePrimitive(),this._index=t._pageIndex)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageIndex",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._destinationMode},set:function(t){t!==this._destinationMode&&(this._destinationMode=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"location",{get:function(){return this._location},set:function(t){t!==this._location&&(this._location=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"destinationBounds",{get:function(){return this._destinationBounds},set:function(t){t!==this._destinationBounds&&(this._destinationBounds=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this._isValid},enumerable:!0,configurable:!0}),e.prototype._setValidation=function(t){this._isValid=t},e.prototype._initializePrimitive=function(){this._array=[];var e=this._page,i=this._page._pageDictionary;switch(void 0!==i&&null!==i&&this._array.push(this._page._ref),this._destinationMode){case t.PdfDestinationMode.location:this._array.push(vr.get("XYZ")),void 0!==e&&null!==e?(this._array.push(this._location[0]),this._array.push(this._page.graphics._size[1]-this._location[1])):(this._array.push(0),this._array.push(0)),this._array.push(this._zoom);break;case t.PdfDestinationMode.fitToPage:this._array.push(vr.get("Fit"));break;case t.PdfDestinationMode.fitR:this._array.push(vr.get("FitR")),this._array.push(this._destinationBounds[0]),this._array.push(this._destinationBounds[1]),this._array.push(this._destinationBounds[2]),this._array.push(this._destinationBounds[3]);break;case t.PdfDestinationMode.fitH:this._array.push(vr.get("FitH")),this._array.push(void 0!==e&&null!==e?e._size[1]-this._location[1]:0)}this._parent&&(this._parent._dictionary.set("D",this._array),this._parent._dictionary._updated=!0)},e}(),tr=function(){function e(){this._format=t._ImageFormat.unknown,this._height=0,this._width=0,this._bitsPerComponent=8,this._position=0,this._noOfComponents=-1}return e.prototype._reset=function(){this._position=0},e.prototype._getBuffer=function(t){return this._stream[Number.parseInt(t.toString(),10)]},e.prototype._read=function(t,e,i,r){if(r&&Array.isArray(r)){var n=0;if(i<=r.length&&r.length-e>=i)for(var s=0;s<i;s++)t[Number.parseInt(s.toString(),10)]=r[Number.parseInt(e.toString(),10)],e++,n++;return{outputBuffer:t,offset:e,length:n}}for(var a=e;a<i;a++){var o=this._position;t[Number.parseInt(a.toString(),10)]=this._getBuffer(o),this._position++}},e.prototype._readString=function(t){for(var e="",i=0;i<t;i++)e+=String.fromCharCode(this._readByte());return e},e.prototype._seek=function(t){this._position+=t},e.prototype._readByte=function(){if(this._position<this._stream.byteLength){var t=this._getBuffer(this._position);return this._position+=1,t}throw new Error("Error decoding JPEG image. Invalid offset.")},e.prototype._toUnsigned16=function(t){return t&=65535,t<0?t+65536:t},e.prototype._readUnsigned32=function(t){return this._getBuffer(t+3)|this._getBuffer(t+2)<<8|this._getBuffer(t+1)<<16|this._getBuffer(t)<<24},e}(),er=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ir=function(e){function i(t){var i=e.call(this)||this;return i._stream=t,i._initialize(),i}return er(i,e),Object.defineProperty(i.prototype,"_imageDataAsNumberArray",{get:function(){return this._imageData},enumerable:!0,configurable:!0}),i.prototype._initialize=function(){this._format=t._ImageFormat.jpeg,this._readHeader(),this._reset(),this._imageData=new Uint8Array(this._stream.byteLength),this._read(this._imageData,0,this._imageData.byteLength)},i.prototype._readHeader=function(){this._reset();var t=new Uint8Array(this._stream.byteLength);this._read(t,0,t.byteLength);for(var e=4,i=256*this._getBuffer(e)+this._getBuffer(e+1),r=!1;e<t.byteLength;){if(!((e+=i)<t.byteLength)){r=!0;break}if(192===this._getBuffer(e+1)){if(this._height=256*this._getBuffer(e+5)+this._getBuffer(e+6),this._width=256*this._getBuffer(e+7)+this._getBuffer(e+8),this._noOfComponents=this._getBuffer(e+9),0!==this._width&&0!==this._height)return}else e+=2,i=256*this._getBuffer(e)+this._getBuffer(e+1)}r&&(this._reset(),this._seek(2),this._readExceededJpegImage())},i.prototype._getImageDictionary=function(){var t=[];this._imageStream=new Cr(t,new xr),this._imageStream.isImageStream=!0;for(var e="",i="",r=0;r<this._imageDataAsNumberArray.byteLength;r++)e+=" "+String.fromCharCode(this._getBuffer(r));for(r=0;r<e.length;r++)r%2!=0&&(i+=e[Number.parseInt(r.toString(),10)]);this._imageStream.data=[i],this._imageStream._isCompress=!1;var n=new xr;n.set("Type",new vr("XObject")),n.set("Subtype",new vr("Image")),n.set("Width",this._width),n.set("Height",this._height),n.set("BitsPerComponent",this._bitsPerComponent),n.set("Filter",new vr("DCTDecode")),n.set("ColorSpace",new vr(this._getColorSpace())),n.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=n,this._imageStream.bytes=new Uint8Array(this._imageStream.data[0].length);for(r=0;r<this._imageStream.data[0].length;r++)this._imageStream.bytes[Number.parseInt(r.toString(),10)]=this._imageStream.data[0].charCodeAt(r);return this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0,this._imageStream},i.prototype._getColorSpace=function(){return 1===this._noOfComponents?"DeviceGray":4===this._noOfComponents?"DeviceCMYK":"DeviceRGB"},i.prototype._getDecodeParams=function(){var t=new xr;return t.set("Columns",this._width),t.set("BlackIs1",!0),t.set("K",-1),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},i.prototype._skipStream=function(){var t=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1);if(this._seek(2),t<2)throw new Error("Error decoding JPEG image");t>0&&this._seek(t-2)},i.prototype._readExceededJpegImage=function(){for(var t=!0;t;)switch(this._getMarker()){case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:this._seek(3),this._height=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._width=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._noOfComponents=this._getBuffer(this._position),this._seek(1),t=!1;break;default:this._skipStream()}},i.prototype._getMarker=function(){for(var t=0,e=this._readByte();255!==e;)t++,e=this._readByte();do{e=this._readByte()}while(255===e);if(0!==t)throw new Error("Error decoding JPEG image");return this._toUnsigned16(e)},i}(tr);!function(t){t[t.readingHeader=0]="readingHeader",t[t.readingBFinal=1]="readingBFinal",t[t.readingBType=2]="readingBType",t[t.readingNlCodes=3]="readingNlCodes",t[t.readingNdCodes=4]="readingNdCodes",t[t.readingCodes=5]="readingCodes",t[t.readingClCodes=6]="readingClCodes",t[t.readingTcBefore=7]="readingTcBefore",t[t.readingTcAfter=8]="readingTcAfter",t[t.decodeTop=9]="decodeTop",t[t.iLength=10]="iLength",t[t.fLength=11]="fLength",t[t.dCode=12]="dCode",t[t.unCompressedAligning=13]="unCompressedAligning",t[t.unCompressedByte1=14]="unCompressedByte1",t[t.unCompressedByte2=15]="unCompressedByte2",t[t.unCompressedByte3=16]="unCompressedByte3",t[t.unCompressedByte4=17]="unCompressedByte4",t[t.decodeUnCompressedBytes=18]="decodeUnCompressedBytes",t[t.srFooter=19]="srFooter",t[t.rFooter=20]="rFooter",t[t.vFooter=21]="vFooter",t[t.done=22]="done"}(t._InflaterState||(t._InflaterState={})),function(t){t[t.unCompressedType=0]="unCompressedType",t[t.staticType=1]="staticType",t[t.dynamicType=2]="dynamicType"}(t._BlockType||(t._BlockType={}));var rr,nr=function(){function t(){this._end=0,this._usedBytes=0,this._dOutput=Array(t._dOutSize).fill(0),this._end=0,this._usedBytes=0}return Object.defineProperty(t.prototype,"_unusedBytes",{get:function(){return t._dOutSize-this._usedBytes},enumerable:!0,configurable:!0}),t.prototype._write=function(e){this._dOutput[this._end++]=e,this._end&=t._dOutMask,++this._usedBytes},t.prototype._writeLD=function(e,i){this._usedBytes+=e;var r=this._end-i&t._dOutMask,n=t._dOutSize-e;if(r<=n&&this._end<n)if(e<=i)a(this._dOutput,this._end,this._dOutput,r,r+e),this._end+=e;else for(;e-- >0;)this._dOutput[this._end++]=this._dOutput[r++];else for(;e-- >0;)this._dOutput[this._end++]=this._dOutput[r++],this._end&=t._dOutMask,r&=t._dOutMask},t.prototype._copyFrom=function(e,i){i=Math.min(Math.min(i,t._dOutSize-this._usedBytes),e._bytes);var r,n=t._dOutSize-this._end;return i>n?(r=e._copyTo(this._dOutput,this._end,n))===n&&(r+=e._copyTo(this._dOutput,0,i-n)):r=e._copyTo(this._dOutput,this._end,i),this._end=this._end+r&t._dOutMask,this._usedBytes+=r,r},t.prototype._copyTo=function(e,i,r){var n;r>this._usedBytes?(n=this._end,r=this._usedBytes):n=this._end-this._usedBytes+r&t._dOutMask;var s=r,o=r-n,h=t._dOutSize-o;if(o>0){for(var c=0;c<o&&c+h<this._dOutput.length&&c+i<e.length;c++)e[i+c]=this._dOutput[h+c];var _=t._dOutSize-o;a(e,i,this._dOutput,_,_+o),i+=o,r=n}h=n-r;var d=n-r;return a(e,i,this._dOutput,d,n),this._usedBytes-=s,{count:s,data:e}},t._dOutSize=32768,t._dOutMask=32767,t}(),sr=function(){function t(){this._bBuffer=0,this._bInBuffer=0,this._begin=0,this._end=0}return Object.defineProperty(t.prototype,"_bytes",{get:function(){return this._end-this._begin+Math.floor(this._bInBuffer/8)},enumerable:!0,configurable:!0}),t.prototype._needsInput=function(){return this._begin===this._end},t.prototype._availableBits=function(t){if(this._bInBuffer<t){if(this._needsInput())return!1;if(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8,this._bInBuffer<t){if(this._needsInput())return!1;this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8}}return!0},t.prototype._load16Bits=function(){return this._bInBuffer<8?(this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8)):this._bInBuffer<16&&this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._bBuffer},t.prototype._getBitMask=function(t){return(r(1,32)<<t)-1},t.prototype._getBits=function(t){if(!this._availableBits(t))return-1;var e=this._bBuffer&this._getBitMask(t);return this._bBuffer>>=t,this._bInBuffer-=t,e},t.prototype._copyTo=function(t,e,i){for(var n=0;this._bInBuffer>0&&i>0;)t[e++]=r(this._bBuffer,8),this._bBuffer>>=8,this._bInBuffer-=8,i--,n++;if(0===i)return n;var s=this._end-this._begin;i>s&&(i=s);for(var a=0;a<i&&a+this._begin<this._buffer.length&&a+e<t.length;a++)t[e+a]=this._buffer[this._begin+a];return this._begin+=i,n+i},t.prototype._setInput=function(t,e,i){this._buffer=t,this._begin=e,this._end=e+i},t.prototype._skipBits=function(t){this._bBuffer>>=t,this._bInBuffer-=t},t.prototype._skipByteBoundary=function(){this._bBuffer>>=this._bInBuffer%8,this._bInBuffer=this._bInBuffer-this._bInBuffer%8},t}(),ar=function(){function t(){}return t.prototype._load=function(t){this._clArray=t,this._initialize()},t.prototype._loadTree=function(t){this._clArray=t?this._getLengthTree():this._getDepthTree(),this._initialize()},t.prototype._initialize=function(){this._clArray.length===t._maxLengthTree?this._tBits=9:this._tBits=7,this._tMask=(1<<this._tBits)-1,this._createTable()},t.prototype._getLengthTree=function(){for(var e=Array(t._maxLengthTree).fill(0),i=0;i<=143;i++)e[Number.parseInt(i.toString(),10)]=r(8,8);for(i=144;i<=255;i++)e[Number.parseInt(i.toString(),10)]=r(9,8);for(i=256;i<=279;i++)e[Number.parseInt(i.toString(),10)]=r(7,8);for(i=280;i<=287;i++)e[Number.parseInt(i.toString(),10)]=r(8,8);return e},t.prototype._getDepthTree=function(){return Array(t._maxDepthTree).fill(5)},t.prototype._calculateHashCode=function(){for(var e=Array(17).fill(0),i=0;i<this._clArray.length;i++)e[this._clArray[Number.parseInt(i.toString(),10)]]++;e[0]=0;for(var r=Array(17).fill(0),n=0,s=1;s<=16;s++)n=n+e[s-1]<<1,r[Number.parseInt(s.toString(),10)]=n;for(var a=Array(t._maxLengthTree).fill(0),i=0;i<this._clArray.length;i++){var o=this._clArray[Number.parseInt(i.toString(),10)];o>0&&(a[Number.parseInt(i.toString(),10)]=this._bitReverse(r[Number.parseInt(o.toString(),10)],o),r[Number.parseInt(o.toString(),10)]++)}return a},t.prototype._bitReverse=function(t,e){var i=0;do{i|=1&t,i<<=1,t>>=1}while(--e>0);return i>>1},t.prototype._createTable=function(){var t=this._calculateHashCode();this._table=Array(1<<this._tBits).fill(0),this._left=Array(2*this._clArray.length).fill(0),this._right=Array(2*this._clArray.length).fill(0);for(var e=n(this._clArray.length),i=0;i<this._clArray.length;i++){var r=this._clArray[Number.parseInt(i.toString(),10)];if(r>0){var s=t[Number.parseInt(i.toString(),10)];if(r<=this._tBits){var a=1<<r;if(s>=a)throw new Error("Invalid Data.");for(var o=1<<this._tBits-r,h=0;h<o;h++)this._table[Number.parseInt(s.toString(),10)]=n(i),s+=a}else{var c=r-this._tBits,_=1<<this._tBits,d=s&(1<<this._tBits)-1,p=this._table;do{var l=n(p[Number.parseInt(d.toString(),10)]);if(0===l&&(p[Number.parseInt(d.toString(),10)]=n(-e),l=n(-e),e++),l>0)throw new Error("Invalid Data.");p=0==(s&_)?this._left:this._right,d=-l,_<<=1,c--}while(0!==c);p[Number.parseInt(d.toString(),10)]=n(i)}}}},t.prototype._getNextSymbol=function(t){var e=t._load16Bits();if(0===t._bInBuffer)return-1;var i=this._table[e&this._tMask];if(i<0){var n=r(1<<this._tBits,32);do{i=-i,i=0==(e&n)?this._left[Number.parseInt(i.toString(),10)]:this._right[Number.parseInt(i.toString(),10)],n<<=1}while(i<0)}var s=this._clArray[Number.parseInt(i.toString(),10)];if(s<=0)throw new Error("Invalid Data.");return s>t._bInBuffer?-1:(t._skipBits(s),i)},t._maxLengthTree=288,t._maxDepthTree=32,t._nCLength=19,t}(),or=function(){function e(){this._extraLengthBits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],this._staticDistanceTreeTable=[0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31],this._lengthBase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],this._distanceBasePosition=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],this._codeOrder=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],this._bfinal=0,this._bLength=0,this._blBuffer=[0,0,0,0],this._blockType=t._BlockType.unCompressedType,this._caSize=0,this._clCodeCount=0,this._extraBits=0,this._lengthCode=0,this._length=0,this._llCodeCount=0,this._output=new nr,this._input=new sr,this._loopCounter=0,this._codeList=Array(ar._maxLengthTree+ar._maxDepthTree).fill(0),this._cltcl=Array(ar._nCLength).fill(0),this._inflaterState=t._InflaterState.readingBFinal}return Object.defineProperty(e.prototype,"_finished",{get:function(){return this._inflaterState===t._InflaterState.done||this._inflaterState===t._InflaterState.vFooter},enumerable:!0,configurable:!0}),e.prototype._setInput=function(t,e,i){this._input._setInput(t,e,i)},e.prototype._inflate=function(t,e,i){var r=0;do{var n=this._output._copyTo(t,e,i),s=n.count;if(t=n.data,s>0&&(e+=s,r+=s,i-=s),0===i)break}while(!this._finished&&this._decode());return{count:r,data:t}},e.prototype._decode=function(){var e=!1,i=!1;if(this._finished)return!0;if(this._inflaterState===t._InflaterState.readingBFinal){if(!this._input._availableBits(1))return!1;this._bfinal=this._input._getBits(1),this._inflaterState=t._InflaterState.readingBType}if(this._inflaterState===t._InflaterState.readingBType){if(!this._input._availableBits(2))return this._inflaterState=t._InflaterState.readingBType,!1;this._blockType=this._getBlockType(this._input._getBits(2)),this._blockType===t._BlockType.dynamicType?this._inflaterState=t._InflaterState.readingNlCodes:this._blockType===t._BlockType.staticType?(this._llTree=new ar,this._llTree._loadTree(!0),this._distanceTree=new ar,this._distanceTree._loadTree(!1),this._inflaterState=t._InflaterState.decodeTop):this._blockType===t._BlockType.unCompressedType&&(this._inflaterState=t._InflaterState.unCompressedAligning)}if(this._blockType===t._BlockType.dynamicType)this._getInflaterStateValue(this._inflaterState)<this._getInflaterStateValue(t._InflaterState.decodeTop)?i=this._decodeDynamicBlockHeader():(i=(r=this._decodeBlock(e)).result,e=r.eob,this._output=r.output);else if(this._blockType===t._BlockType.staticType)i=(r=this._decodeBlock(e)).result,e=r.eob,this._output=r.output;else if(this._blockType===t._BlockType.unCompressedType){var r=this._decodeUncompressedBlock(e);i=r.result,e=r.eob,this._output=r.output}return e&&0!==this._bfinal&&(this._inflaterState=t._InflaterState.done),i},e.prototype._decodeUncompressedBlock=function(e){for(e=!1;;)switch(this._inflaterState){case t._InflaterState.unCompressedAligning:if(this._input._skipByteBoundary(),this._inflaterState=t._InflaterState.unCompressedByte1,!this._unCompressedByte())return{result:!1,eob:e,output:this._output};break;case t._InflaterState.unCompressedByte1:case t._InflaterState.unCompressedByte2:case t._InflaterState.unCompressedByte3:case t._InflaterState.unCompressedByte4:if(!this._unCompressedByte())return{result:!1,eob:e,output:this._output};break;case t._InflaterState.decodeUnCompressedBytes:return this._bLength-=this._output._copyFrom(this._input,this._bLength),0===this._bLength?(this._inflaterState=t._InflaterState.readingBFinal,e=!0,{result:!0,eob:e,output:this._output}):0===this._output._unusedBytes?{result:!0,eob:e,output:this._output}:{result:!1,eob:e,output:this._output}}},e.prototype._unCompressedByte=function(){var e=this._input._getBits(8);if(e<0)return!1;var i=this._getInflaterStateValue(this._inflaterState),n=this._getInflaterStateValue(t._InflaterState.unCompressedByte1);if(this._blBuffer[i-n]=r(e,8),this._inflaterState===t._InflaterState.unCompressedByte4&&(this._bLength=this._blBuffer[0]+256*this._blBuffer[1],r(this._bLength,16)!==r(~(this._blBuffer[2]+256*this._blBuffer[3]),16)))throw new Error("Ivalid block length.");return this._inflaterState=this._getInflaterState(this._getInflaterStateValue(this._inflaterState)+1),!0},e.prototype._decodeBlock=function(e){e=!1;for(var i=this._output._unusedBytes;i>258;){var n=void 0,s=void 0,a=void 0,o=void 0;switch(this._inflaterState){case t._InflaterState.decodeTop:if((n=this._llTree._getNextSymbol(this._input))<0)return{result:!1,eob:e,output:this._output};if(n<256)this._output._write(r(n,8)),--i;else{if(256===n)return e=!0,this._inflaterState=t._InflaterState.readingBFinal,{result:!0,eob:e,output:this._output};if((n-=257)<8)n+=3,this._extraBits=0;else if(28===n)n=258,this._extraBits=0;else{if(n<0||n>=this._extraLengthBits.length)throw new Error("Invalid data.");this._extraBits=this._extraLengthBits[Number.parseInt(n.toString(),10)]}if(this._length=n,o=this._inLength(i),i=o.fb,!o.value)return{result:!1,eob:e,output:this._output}}break;case t._InflaterState.iLength:if(o=this._inLength(i),i=o.fb,!o.value)return{result:!1,eob:e,output:this._output};break;case t._InflaterState.fLength:if(a=this._fLength(i),i=a.fb,!a.value)return{result:!1,eob:e,output:this._output};break;case t._InflaterState.dCode:if(s=this._dcode(i),i=s.fb,!s.value)return{result:!1,eob:e,output:this._output}}}return{result:!0,eob:e,output:this._output}},e.prototype._inLength=function(e){if(this._extraBits>0){this._inflaterState=t._InflaterState.iLength;var i=this._input._getBits(this._extraBits);if(i<0)return{value:!1,fb:e};if(this._length<0||this._length>=this._lengthBase.length)throw new Error("Invalid data.");this._length=this._lengthBase[this._length]+i}this._inflaterState=t._InflaterState.fLength;var r=this._fLength(e);return e=r.fb,r.value?{value:!0,fb:e}:{value:!1,fb:e}},e.prototype._fLength=function(e){if(this._blockType===t._BlockType.dynamicType?this._distanceCode=this._distanceTree._getNextSymbol(this._input):(this._distanceCode=this._input._getBits(5),this._distanceCode>=0&&(this._distanceCode=this._staticDistanceTreeTable[this._distanceCode])),this._distanceCode<0)return{value:!1,fb:e};this._inflaterState=t._InflaterState.dCode;var i=this._dcode(e);return e=i.fb,i.value?{value:!0,fb:e}:{value:!1,fb:e}},e.prototype._dcode=function(e){var i;if(this._distanceCode>3){this._extraBits=this._distanceCode-2>>1;var r=this._input._getBits(this._extraBits);if(r<0)return{value:!1,fb:e};i=this._distanceBasePosition[this._distanceCode]+r}else i=this._distanceCode+1;return this._output._writeLD(this._length,i),e-=this._length,this._inflaterState=t._InflaterState.decodeTop,{value:!0,fb:e}},e.prototype._decodeDynamicBlockHeader=function(){switch(this._inflaterState){case t._InflaterState.readingNlCodes:if(this._llCodeCount=this._input._getBits(5),this._llCodeCount<0)return!1;if(this._llCodeCount+=257,this._inflaterState=t._InflaterState.readingNdCodes,!this._readingNDCodes())return!1;break;case t._InflaterState.readingNdCodes:if(!this._readingNDCodes())return!1;break;case t._InflaterState.readingCodes:if(!this._readingCodes())return!1;break;case t._InflaterState.readingClCodes:if(!this._readingCLCodes())return!1;break;case t._InflaterState.readingTcBefore:case t._InflaterState.readingTcAfter:if(!this._readingTCBefore())return!1}var e=Array(ar._maxLengthTree).fill(0);a(e,0,this._codeList,0,this._llCodeCount);var i=Array(ar._maxDepthTree).fill(0);return a(i,0,this._codeList,this._llCodeCount,this._llCodeCount+this._dCodeCount),this._llTree=new ar,this._llTree._load(e),this._distanceTree=new ar,this._distanceTree._load(i),this._inflaterState=t._InflaterState.decodeTop,!0},e.prototype._readingNDCodes=function(){return this._dCodeCount=this._input._getBits(5),!(this._dCodeCount<0)&&(this._dCodeCount+=1,this._inflaterState=t._InflaterState.readingCodes,!!this._readingCodes())},e.prototype._readingCodes=function(){return this._clCodeCount=this._input._getBits(4),!(this._clCodeCount<0)&&(this._clCodeCount+=4,this._loopCounter=0,this._inflaterState=t._InflaterState.readingClCodes,!!this._readingCLCodes())},e.prototype._readingCLCodes=function(){for(;this._loopCounter<this._clCodeCount;){var e=this._input._getBits(3);if(e<0)return!1;this._cltcl[this._codeOrder[this._loopCounter]]=r(e,8),++this._loopCounter}for(var i=this._clCodeCount;i<this._codeOrder.length;i++)this._cltcl[this._codeOrder[Number.parseInt(i.toString(),10)]]=0;return this._clTree=new ar,this._clTree._load(this._cltcl),this._caSize=this._llCodeCount+this._dCodeCount,this._loopCounter=0,this._inflaterState=t._InflaterState.readingTcBefore,!!this._readingTCBefore()},e.prototype._readingTCBefore=function(){for(;this._loopCounter<this._caSize;){if(this._inflaterState===t._InflaterState.readingTcBefore&&(this._lengthCode=this._clTree._getNextSymbol(this._input),this._lengthCode<0))return!1;if(this._lengthCode<=15)this._codeList[this._loopCounter++]=r(this._lengthCode,8);else{if(!this._input._availableBits(7))return this._inflaterState=t._InflaterState.readingTcAfter,!1;var e=void 0;if(16===this._lengthCode){if(0===this._loopCounter)throw new Error("Invalid data.");var i=r(this._codeList[this._loopCounter-1],8);if(e=this._input._getBits(2)+3,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(n=0;n<e;n++)this._codeList[this._loopCounter++]=i}else if(17===this._lengthCode){if(e=this._input._getBits(3)+3,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(n=0;n<e;n++)this._codeList[this._loopCounter++]=0}else{if(e=this._input._getBits(7)+11,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(var n=0;n<e;n++)this._codeList[this._loopCounter++]=0}}this._inflaterState=t._InflaterState.readingTcBefore}return!0},e.prototype._getBlockType=function(e){return e===t._BlockType.unCompressedType?t._BlockType.unCompressedType:e===t._BlockType.staticType?t._BlockType.staticType:t._BlockType.dynamicType},e.prototype._getInflaterState=function(e){switch(e){case 0:return t._InflaterState.readingHeader;case 2:return t._InflaterState.readingBFinal;case 3:return t._InflaterState.readingBType;case 4:return t._InflaterState.readingNlCodes;case 5:return t._InflaterState.readingNdCodes;case 6:return t._InflaterState.readingCodes;case 7:return t._InflaterState.readingClCodes;case 8:return t._InflaterState.readingTcBefore;case 9:return t._InflaterState.readingTcAfter;case 10:return t._InflaterState.decodeTop;case 11:return t._InflaterState.iLength;case 12:return t._InflaterState.fLength;case 13:return t._InflaterState.dCode;case 15:return t._InflaterState.unCompressedAligning;case 16:return t._InflaterState.unCompressedByte1;case 17:return t._InflaterState.unCompressedByte2;case 18:return t._InflaterState.unCompressedByte3;case 19:return t._InflaterState.unCompressedByte4;case 20:return t._InflaterState.decodeUnCompressedBytes;case 21:return t._InflaterState.srFooter;case 22:return t._InflaterState.rFooter;case 23:return t._InflaterState.vFooter;case 24:return t._InflaterState.done;default:return t._InflaterState.readingHeader}},e.prototype._getInflaterStateValue=function(e){switch(e){case t._InflaterState.readingHeader:return 0;case t._InflaterState.readingBFinal:return 2;case t._InflaterState.readingBType:return 3;case t._InflaterState.readingNlCodes:return 4;case t._InflaterState.readingNdCodes:return 5;case t._InflaterState.readingCodes:return 6;case t._InflaterState.readingClCodes:return 7;case t._InflaterState.readingTcBefore:return 8;case t._InflaterState.readingTcAfter:return 9;case t._InflaterState.decodeTop:return 10;case t._InflaterState.iLength:return 11;case t._InflaterState.fLength:return 12;case t._InflaterState.dCode:return 13;case t._InflaterState.unCompressedAligning:return 15;case t._InflaterState.unCompressedByte1:return 16;case t._InflaterState.unCompressedByte2:return 17;case t._InflaterState.unCompressedByte3:return 18;case t._InflaterState.unCompressedByte4:return 19;case t._InflaterState.decodeUnCompressedBytes:return 20;case t._InflaterState.srFooter:return 21;case t._InflaterState.rFooter:return 22;case t._InflaterState.vFooter:return 23;case t._InflaterState.done:return 24;default:return 0}},e}(),hr=function(){function t(t,e,i){this._offset=e,this._data=t,this._leaveOpen=i,this._inflater=new or,this._buffer=Array(8192).fill(0)}return t.prototype._read=function(t,e,i){for(var r,n=e,s=i;;){var a=this._inflater._inflate(t,n,s);if(r=a.count,t=a.data,n+=r,0===(s-=r))break;if(this._inflater._finished)break;var o=this._readBytes(),h=o.count;if(this._buffer=o.buffer,0===h)break;this._inflater._setInput(this._buffer,0,h)}return{count:i-s,data:t}},t.prototype._readBytes=function(){if(this._offset>=this._data.length)return{buffer:[],count:0};for(var t=0,e=0;e<this._buffer.length&&e+this._offset<this._data.length;e++)this._buffer[Number.parseInt(e.toString(),10)]=this._data[this._offset+e],t++;return this._offset+=t,{buffer:this._buffer,count:t}},t}(),cr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),_r=function(e){function i(i){var r=e.call(this)||this;return r._stream=i,r._format=t._ImageFormat.png,r._isRedGreenBlue=!1,r._isDecode=!1,r._shades=!1,r._ideateDecode=!0,r._colors=0,r._bitsPerPixel=0,r._idatLength=0,r._inputBands=0,r._position=8,r._initialize(),r}return cr(i,e),i.prototype._initialize=function(){for(var t,e=this._hasValidChunkType(t);e.hasValidChunk;){switch(t=e.type){case rr.iHDR:this._readHeader();break;case rr.iDAT:this._readImageData();break;case rr.sRGB:this._isRedGreenBlue=!0,this._ignoreChunk();break;case rr.pLTE:this._readPhotoPlate();break;case rr.iEND:this._decodeImageData();break;case rr.tRNS:this._readTransparency();break;case rr.tEXt:case rr.iTXt:case rr.zTXt:case rr.hIST:case rr.sBIT:case rr.iCCP:case rr.pHYs:case rr.tIME:case rr.bKGD:case rr.gAMA:case rr.cHRM:case rr.unknown:this._ignoreChunk()}e=this._hasValidChunkType(t)}},i.prototype._hasValidChunkType=function(t){if(t=rr.unknown,this._position+8<=this._stream.byteLength){this._currentChunkLength=this._readUnsigned32(this._position),this._seek(4);var e=this._readString(4),i=this._getChunkType(e);return void 0!==i&&null!==i?(t=i,{type:t,hasValidChunk:!0}):this._stream.byteLength===this._position?{type:t,hasValidChunk:!1}:{type:t,hasValidChunk:!0}}return{type:t,hasValidChunk:!1}},i.prototype._ignoreChunk=function(){this._currentChunkLength>0&&this._seek(this._currentChunkLength+4)},i.prototype._readHeader=function(){this._header=new dr,this._header._width=this._readUnsigned32(this._position),this._seek(4),this._header._height=this._readUnsigned32(this._position),this._seek(4),this._header._bitDepth=this._readByte(),this._header._colorType=this._readByte(),this._header._compression=this._readByte(),this._header._filter=this._getFilterType(this._readByte()),this._header._interlace=this._readByte(),this._colors=3===this._header._colorType||0==(2&this._header._colorType)?1:3,this._width=this._header._width,this._height=this._header._height,this._bitsPerComponent=this._header._bitDepth,this._setBitsPerPixel(),this._seek(4)},i.prototype._setBitsPerPixel=function(){this._bitsPerPixel=16===this._header._bitDepth?2:1,0===this._header._colorType?(this._idatLength=Number.parseInt(((this._bitsPerComponent*this._width+7)/8).toString(),10)*this._height,this._inputBands=1):2===this._header._colorType?(this._idatLength=this._width*this._height*3,this._inputBands=3,this._bitsPerPixel*=3):3===this._header._colorType?(1===this._header._interlace&&(this._idatLength=Number.parseInt(((this._header._bitDepth*this._width+7)/8).toString(),10)*this._height),this._inputBands=1,this._bitsPerPixel=1):4===this._header._colorType?(this._idatLength=this._width*this._height,this._inputBands=2,this._bitsPerPixel*=2):6===this._header._colorType&&(this._idatLength=3*this._width*this._height,this._inputBands=4,this._bitsPerPixel*=4)},i.prototype._readImageData=function(){if(this._encodedStream&&0!==this._encodedStream.length||(this._encodedStream=[]),this._currentChunkLength<=this._stream.byteLength&&this._stream.byteLength-this._position>=this._currentChunkLength)for(var t=0;t<this._currentChunkLength;t++)this._encodedStream.push(this._readByte());this._seek(4)},i.prototype._readPhotoPlate=function(){if(3===this._header._colorType){this._colorSpace=[],this._colorSpace.push(vr.get("Indexed")),this._colorSpace.push(this._getPngColorSpace()),this._colorSpace.push(this._currentChunkLength/3-1);var t=new Uint8Array(this._currentChunkLength);this._read(t,0,this._currentChunkLength),this._colorSpace.push(b(t)),this._seek(4)}else this._ignoreChunk()},i.prototype._readTransparency=function(){if(3===this._header._colorType){var t=new Uint8Array(this._currentChunkLength);this._read(t,0,this._currentChunkLength),this._seek(4),this._alpha=[];for(var e=0;e<t.length;e++){this._alpha.push(t[Number.parseInt(e.toString(),10)]);var i=255&t[Number.parseInt(e.toString(),10)];0!==i&&255!==i&&(this._shades=!0)}}else this._ignoreChunk()},i.prototype._getPngColorSpace=function(){if(this._isRedGreenBlue){var t=[],e=new xr,i=[1,1,1],r=[2.2,2.2,2.2];if(e.set("Gamma",r),this._isRedGreenBlue){var n=-.0737289,s=.2126390058715103,a=-.0527286/n,o=.3*a/.6,h=a*(.7/.6-1),c=-.005321898/n;i=[.9504300891509299,1,1.088921671149305],e.set("Matrix",[.4123907992659594,s,.01933081871559183,o,a,h,.1804549505010925,c,.9503960726390872])}return e.set("WhitePoint",i),t.push(vr.get("CalRGB")),t.push(e),t}return 0==(2&this._header._colorType)?vr.get("DeviceGray"):vr.get("DeviceRGB")},i.prototype._decodeImageData=function(){var t=this._header;this._isDecode=1===t._interlace||16===t._bitDepth||0!=(4&t._colorType)||this._shades,this._isDecode?((0!=(4&t._colorType)||this._shades)&&(this._maskData=Array(this._width*this._height).fill(0)),this._encodedStream&&(this._dataStream=this._getDeflatedData(this._encodedStream),this._dataStreamOffset=0),this._idatLength>0&&(this._decodedImageData=Array(this._idatLength).fill(0)),this._readDecodeData(),this._decodedImageData&&0===this._decodedImageData.length&&this._shades&&(this._ideateDecode=!1,this._decodedImageData=this._encodedStream)):(this._ideateDecode=!1,this._decodedImageData=this._encodedStream)},i.prototype._getDeflatedData=function(t){var e=t.slice(2,t.length-4),i=new hr(e,0,!0),r=Array(4096).fill(0),n=0,s=[];do{var a=i._read(r,0,r.length);n=a.count,r=a.data;for(var o=0;o<n;o++)s.push(r[Number.parseInt(o.toString(),10)])}while(n>0);return s},i.prototype._readDecodeData=function(){1!==this._header._interlace?this._decodeData(0,0,1,1,this._width,this._height):(this._decodeData(0,0,8,8,Math.floor((this._width+7)/8),Math.floor((this._height+7)/8)),this._decodeData(4,0,8,8,Math.floor((this._width+3)/8),Math.floor((this._height+7)/8)),this._decodeData(0,4,4,8,Math.floor((this._width+3)/4),Math.floor((this._height+3)/8)),this._decodeData(2,0,4,4,Math.floor((this._width+1)/4),Math.floor((this._height+3)/4)),this._decodeData(0,2,2,4,Math.floor((this._width+1)/2),Math.floor((this._height+1)/4)),this._decodeData(1,0,2,2,Math.floor(this._width/2),Math.floor((this._height+1)/2)),this._decodeData(0,1,1,2,this._width,Math.floor(this._height/2)))},i.prototype._decodeData=function(t,e,i,r,n,s){if(0!==n&&0!==s)for(var a=Math.floor((this._inputBands*n*this._header._bitDepth+7)/8),o=Array(a).fill(0),h=Array(a).fill(0),c=0,_=e;c<s;c++,_+=r){var d=this._dataStream[this._dataStreamOffset];switch(this._dataStreamOffset=this._dataStreamOffset+1,this._dataStreamOffset=this._readStream(this._dataStream,this._dataStreamOffset,o,a),this._getFilterType(d)){case pr.none:break;case pr.sub:this._decompressSub(o,a,this._bitsPerPixel);break;case pr.up:this._decompressUp(o,h,a);break;case pr.average:this._decompressAverage(o,h,a,this._bitsPerPixel);break;case pr.paeth:this._decompressPaeth(o,h,a,this._bitsPerPixel);break;default:throw new Error("Unknown PNG filter")}this._processPixels(o,t,i,_,n);var p=h;h=o,o=p}},i.prototype._readStream=function(t,e,i,r){var n=this._read(i,e,r,t);if(i=n.outputBuffer,e=n.offset,n.length<=0)throw new Error("Insufficient data");return e},i.prototype._decompressSub=function(t,e,i){for(var n=i;n<e;n++)t[Number.parseInt(n.toString(),10)]=r((255&t[Number.parseInt(n.toString(),10)])+(255&t[n-i]),8)},i.prototype._decompressUp=function(t,e,i){for(var n=0;n<i;n++)t[Number.parseInt(n.toString(),10)]=r((255&t[Number.parseInt(n.toString(),10)])+(255&e[Number.parseInt(n.toString(),10)]),8)},i.prototype._decompressAverage=function(t,e,i,n){for(s=0;s<n;s++)t[Number.parseInt(s.toString(),10)]=r(Math.floor(((255&t[Number.parseInt(s.toString(),10)])+(255&e[Number.parseInt(s.toString(),10)]))/2),8);for(var s=n;s<i;s++)t[Number.parseInt(s.toString(),10)]=r(Math.floor((255&t[Number.parseInt(s.toString(),10)])+((255&t[s-n])+(255&e[Number.parseInt(s.toString(),10)]))/2),8)},i.prototype._decompressPaeth=function(t,e,i,n){for(var s,a,o,h,c=0;c<n;c++)s=255&t[Number.parseInt(c.toString(),10)],o=255&e[Number.parseInt(c.toString(),10)],t[Number.parseInt(c.toString(),10)]=r(s+o,8);for(c=n;c<i;c++)s=255&t[Number.parseInt(c.toString(),10)],a=255&t[c-n],o=255&e[Number.parseInt(c.toString(),10)],h=255&e[c-n],t[Number.parseInt(c.toString(),10)]=r(s+this._paethPredictor(a,o,h),8)},i.prototype._paethPredictor=function(t,e,i){var r=t+e-i,n=Math.abs(r-t),s=Math.abs(r-e),a=Math.abs(r-i);return n<=s&&n<=a?t:s<=a?e:i},i.prototype._processPixels=function(t,e,i,n,a){var o=0,h=0,c=0,_=this._getPixel(t);if(0===this._header._colorType||3===this._header._colorType||4===this._header._colorType?c=1:2!==this._header._colorType&&6!==this._header._colorType||(c=3),this._decodedImageData&&this._decodedImageData.length>0){h=e;var d=16===this._header._bitDepth?8:this._header._bitDepth,p=Math.floor((c*a*d+7)/8);for(o=0;o<a;o++)this._decodedImageData=this._setPixel(this._decodedImageData,_,this._inputBands*o,c,h,n,this._header._bitDepth,p),h+=i}if(0!=(4&this._header._colorType)||this._shades)if(0!=(4&this._header._colorType)){if(16===this._header._bitDepth)for(var l=0;l<a;++l){var u=l*this._inputBands+c,f=r(_[Number.parseInt(u.toString(),10)],32);_[Number.parseInt(u.toString(),10)]=s(f>>8)}p=a;for(h=e,o=0;o<a;o++)this._maskData=this._setPixel(this._maskData,_,this._inputBands*o+c,1,h,n,8,p),h+=i}else{var p=a,g=[0];for(h=e,o=0;o<a;o++){var y=_[Number.parseInt(o.toString(),10)];y<this._alpha.length?g[0]=this._alpha[Number.parseInt(y.toString(),10)]:g[0]=255,this._maskData=this._setPixel(this._maskData,g,0,1,h,n,8,p),h+=i}}},i.prototype._getPixel=function(t){if(8===this._header._bitDepth){for(var e=Array(t.length).fill(0),i=0;i<e.length;++i)e[Number.parseInt(i.toString(),10)]=255&t[Number.parseInt(i.toString(),10)];return e}if(16===this._header._bitDepth){for(var e=Array(Math.floor(t.length/2)).fill(0),i=0;i<e.length;++i)e[Number.parseInt(i.toString(),10)]=((255&t[2*i])<<8)+(255&t[2*i+1]);return e}for(var e=Array(Math.floor(8*t.length/this._header._bitDepth)).fill(0),n=0,a=Math.floor(8/this._header._bitDepth),o=(1<<this._header._bitDepth)-1,h=0;h<t.length;++h)for(i=a-1;i>=0;--i){var c=this._header._bitDepth*i,_=t[Number.parseInt(h.toString(),10)];e[n++]=(c<1?_:s(r(_,32)>>c))&o}return e},i.prototype._setPixel=function(t,e,i,n,s,a,o,h){if(8===o)for(var c=h*a+n*s,_=0;_<n;++_)t[c+_]=r(e[_+i],8);else if(16===o)for(var c=h*a+n*s,_=0;_<n;++_)t[c+_]=r(e[_+i]>>8,8);else{var c=Math.floor((h*a+s)/(8/o)),d=e[Number.parseInt(i.toString(),10)]<<Number.parseInt((8-o*(s%(8/o))-o).toString(),10);t[Number.parseInt(c.toString(),10)]=t[Number.parseInt(c.toString(),10)]|r(d,8)}return t},i.prototype._getImageDictionary=function(){var t=[];this._imageStream=new Cr(t,new xr),this._imageStream.isImageStream=!0;for(var e="",i=0;i<this._decodedImageData.length;i++)e+=String.fromCharCode(this._decodedImageData[Number.parseInt(i.toString(),10)]);this._imageStream.data=[e],this._imageStream._isCompress=this._isDecode&&this._ideateDecode;var r=new xr;r.set("Type",new vr("XObject")),r.set("Subtype",new vr("Image")),r.set("Width",this._width),r.set("Height",this._height),16===this._bitsPerComponent?r.set("BitsPerComponent",8):r.set("BitsPerComponent",this._bitsPerComponent),this._isDecode&&this._ideateDecode||r.set("Filter",new vr("FlateDecode")),0==(2&this._header._colorType)?r.set("ColorSpace",vr.get("DeviceGray")):r.set("ColorSpace",vr.get("DeviceRGB")),(!this._isDecode||this._shades&&!this._ideateDecode)&&r.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=r,this._imageStream.bytes=new Uint8Array(this._imageStream.data[0].length);for(i=0;i<this._imageStream.data[0].length;i++)this._imageStream.bytes[Number.parseInt(i.toString(),10)]=this._imageStream.data[0].charCodeAt(i);return this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0,this._setMask(),this._imageStream},i.prototype._setMask=function(){if(this._maskData&&this._maskData.length>0){this._maskStream=new Cr(this._maskData,new xr),this._maskStream._isCompress=this._isDecode&&this._ideateDecode;var t=new xr;t.set("Type",new vr("XObject")),t.set("Subtype",new vr("Image")),t.set("Width",this._width),t.set("Height",this._height),16===this._bitsPerComponent?t.set("BitsPerComponent",8):t.set("BitsPerComponent",this._bitsPerComponent),t.set("ColorSpace",vr.get("DeviceGray")),this._maskStream.dictionary=t,this._maskStream.bytes=new Uint8Array(this._maskData),this._maskStream.end=this._maskStream.bytes.length,this._maskStream.dictionary._updated=!0}},i.prototype._getDecodeParams=function(){var t=new xr;return t.set("Columns",this._width),t.set("Colors",this._colors),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},i.prototype._getChunkType=function(t){switch(t){case"IHDR":return rr.iHDR;case"PLTE":return rr.pLTE;case"IDAT":return rr.iDAT;case"IEND":return rr.iEND;case"bKGD":return rr.bKGD;case"cHRM":return rr.cHRM;case"gAMA":return rr.gAMA;case"hIST":return rr.hIST;case"pHYs":return rr.pHYs;case"sBIT":return rr.sBIT;case"tEXt":return rr.tEXt;case"tIME":return rr.tIME;case"tRNS":return rr.tRNS;case"zTXt":return rr.zTXt;case"sRGB":return rr.sRGB;case"iCCP":return rr.iCCP;case"iTXt":return rr.iTXt;case"Unknown":return rr.unknown;default:return null}},i.prototype._getFilterType=function(t){switch(t){case 1:return pr.sub;case 2:return pr.up;case 3:return pr.average;case 4:return pr.paeth;default:return pr.none}},i}(tr),dr=function(){function t(){this._width=0,this._height=0,this._colorType=0,this._compression=0,this._bitDepth=0,this._interlace=0,this._filter=pr.none}return t}();!function(t){t[t.iHDR=0]="iHDR",t[t.pLTE=1]="pLTE",t[t.iDAT=2]="iDAT",t[t.iEND=3]="iEND",t[t.bKGD=4]="bKGD",t[t.cHRM=5]="cHRM",t[t.gAMA=6]="gAMA",t[t.hIST=7]="hIST",t[t.pHYs=8]="pHYs",t[t.sBIT=9]="sBIT",t[t.tEXt=10]="tEXt",t[t.tIME=11]="tIME",t[t.tRNS=12]="tRNS",t[t.zTXt=13]="zTXt",t[t.sRGB=14]="sRGB",t[t.iCCP=15]="iCCP",t[t.iTXt=16]="iTXt",t[t.unknown=17]="unknown"}(rr||(rr={}));var pr;!function(t){t[t.none=0]="none",t[t.sub=1]="sub",t[t.up=2]="up",t[t.average=3]="average",t[t.paeth=4]="paeth"}(pr||(pr={}));var lr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ur=function(){function t(t,e){this.message=t,this.name=e}return t}(),fr=function(t){function e(e){return t.call(this,e,"FormatError")||this}return lr(e,t),e}(ur),gr=function(t){function e(e){return t.call(this,e,"ParserEndOfFileException")||this}return lr(e,t),e}(ur),yr=Object.create(null),mr=Object.create(null),br=Object.create(null),vr=function(){function t(t){this.name=t}return t.get=function(e){return yr[e]||(yr[e]=new t(e))},t}(),Sr=function(){function t(t){this.command=t}return t.get=function(e){return mr[e]||(mr[e]=new t(e))},t}(),wr=function(){function t(t,e){this._isNew=!1,this.objectNumber=t,this.generationNumber=e}return t.prototype.toString=function(){return this.objectNumber+" "+this.generationNumber},t.get=function(e,i){var r=0===i?e+"R":e+"R"+i;return br[r]||(br[r]=new t(e,i))},t}(),Pr=function(){function t(t){void 0===t&&(t=null),this._set=new Set(t&&t._set)}return t.prototype.has=function(t){return this._set.has(t.toString())},t.prototype.put=function(t){this._set.add(t.toString())},t.prototype.remove=function(t){this._set.delete(t.toString())},t.prototype.clear=function(){this._set.clear()},t}(),Ar=function(){function t(){this._map=new Map}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.get=function(t){return this._map.get(t.toString())},t.prototype.has=function(t){return this._map.has(t.toString())},t.prototype.put=function(t,e){this._map.set(t.toString(),e)},t.prototype.set=function(t,e){this._map.set(t,e)},t.prototype.clear=function(){this._map.clear()},t}(),kr=function(){function t(t){this.table={},this.nElements=0,this.toStr=t||kt}return t.prototype.getValue=function(t){var e=this.table["$"+this.toStr(t)];if(void 0!==e)return e.value},t.prototype.setValue=function(t,e){var i="$"+this.toStr(t);this.table[i];this.nElements++,this.table[i]={key:t,value:e}},t.prototype.keys=function(){for(var t=[],e=Object.keys(this.table),i=0;i<e.length;i++){var r=this.table[e[i]];t.push(r.key)}return t},t.prototype.containsKey=function(t){return!(void 0===this.getValue(t))},t.prototype._size=function(){return this.nElements},t}(),xr=function(){function t(t){this._isFont=!1,this._initialize(t)}return Object.defineProperty(t.prototype,"size",{get:function(){return Object.keys(this._map).length},enumerable:!0,configurable:!0}),t.prototype.assignXref=function(t){this._crossReference=t},t.prototype.getRaw=function(t){return this._map[t]},t.prototype.getRawValues=function(){return this._map.values},t.prototype.get=function(t,e,i){var r=this._get(t,e,i);return this._crossReference&&void 0!==r&&r instanceof wr&&(r=this._crossReference._fetch(r)),r},t.prototype.getArray=function(t,e,i){var r=this.get(t,e,i);if(this._crossReference&&void 0!==r&&Array.isArray(r)){r=r.slice();for(var n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)];null!==s&&void 0!==s&&s instanceof wr&&(r[Number.parseInt(n.toString(),10)]=this._crossReference._fetch(s))}}return r},t.prototype.set=function(t,e){this._map[t]=e},t.prototype.has=function(t){return void 0!==this._map[t]},t.prototype.forEach=function(t){for(var e in this._map)t(e,this.getRaw(e))},t.prototype.update=function(t,e){if(this.has(t)){var i=this._map[t];null!==i&&void 0!==i&&i instanceof wr&&this._crossReference&&(i=this._crossReference._fetch(i)),i!==e&&(this._map[t]=e,this._updated=!0)}else this._map[t]=e,this._updated=!0},t.getEmpty=function(e){var i=new t(e);return i.set=function(t,e){throw new Error("Should not call set on the empty dictionary.")},i},t.merge=function(e,i,r){void 0===r&&(r=!1);for(var n=new t(e),s=Object.create(null),a=0,o=i;a<o.length;a++)if((w=o[a])instanceof t)for(var h=0,c=w._map;h<c.length;h++){var _=c[h],d=_[0],p=_[1],l=s.get(d);if(void 0===l)l=[],s.set(d,l);else if(!(r&&p instanceof t))continue;l.push(p)}for(var u=0,f=s;u<f.length;u++){var g=f[u],y=g[0],m=g[1];if(1!==m.length&&m[0]instanceof t){for(var b=new t(e),v=0,S=m;v<S.length;v++)for(var w=S[v],P=0,A=w._map;P<A.length;P++){var k=A[P],d=k[0],p=k[1];void 0===b._map[d]&&(b._map[d]=p)}b.size>0&&(n._map[y]=b)}else n._map[y]=m[0]}return s.clear(),n.size>0?n:t.getEmpty(e)},t.prototype._initialize=function(t){this._map=Object.create(null),this.suppressEncryption=!1,this._updated=!1,this.isCatalog=!1,this._isNew=!1,t&&(this._crossReference=t)},t.prototype._get=function(t,e,i){var r=this._map[t];return void 0===r&&(r=this._map[e],void 0!==e&&null!==e?r=this._map[e]:void 0!==i&&null!==i&&(r=this._map[i])),r},t}(),Tr=function(){function t(t){void 0===t&&(t=[]),this.value=t}return t}(),Ir=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Nr=function(){function t(){this._isCompress=!0}return t.prototype.getByte=function(){return null},t.prototype.getBytes=function(t){return null},Object.defineProperty(t.prototype,"length",{get:function(){throw new Error("Abstract getter `length` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){throw new Error("Abstract getter `isEmpty` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDataLoaded",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.peekByte=function(){var t=this.getByte();return-1!==t&&this.offset--,t},t.prototype.peekBytes=function(t){var e=this.getBytes(t);return this.offset-=e.length,e},t.prototype.getUnsignedInteger16=function(){var t=this.getByte(),e=this.getByte();return-1===t||-1===e?-1:(t<<8)+e},t.prototype.getInt32=function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},t.prototype.getByteRange=function(t,e){return null},t.prototype.makeSubStream=function(t,e,i){return null},t.prototype.readBlock=function(){return null},t.prototype.reset=function(){return null},t.prototype.moveStart=function(){return null},t.prototype.getString=function(t,e){return void 0===t&&(t=!1),void 0!==e&&null!==e||(e=this.getBytes()),t?S(e):b(e)},t.prototype.skip=function(t){this.offset+=t||1},t.prototype.getBaseStreams=function(){return null},t}(),Cr=function(t){function e(e,i,r,n){var s=t.call(this)||this;return s.isImageStream=!1,s.bytes=e instanceof Uint8Array?e:new Uint8Array(e),s.start=void 0!==r?r:0,s.position=s.start,s.end=r+n||s.bytes.length,s.dictionary=i,s}return Ir(e,t),Object.defineProperty(e.prototype,"position",{get:function(){return this.offset},set:function(t){this.offset=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.end-this.start},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.dataStream2},set:function(t){this.dataStream2=[],this.dataStream2=t},enumerable:!0,configurable:!0}),e.prototype.getByte=function(){return this.position>=this.end?-1:this.bytes[this.position++]},e.prototype.getBytes=function(t){var e=this.bytes,i=this.position,r=this.end;if(!t)return e.subarray(i,r);var n=i+t;return n>r&&(n=r),this.position=n,e.subarray(i,n)},e.prototype.getByteRange=function(t,e){return t<0&&(t=0),e>this.end&&(e=this.end),this.bytes.subarray(t,e)},e.prototype.reset=function(){this.position=this.start},e.prototype.moveStart=function(){this.start=this.position},e.prototype.makeSubStream=function(t,i,r){return void 0===r&&(r=null),new e(this.bytes.buffer,r,t,i)},e.prototype.readBlock=function(){throw new Error("Abstract method `readBlock` called")},e.prototype._clearStream=function(){null!==this.dictionary&&void 0!==this.dictionary&&this.dictionary.has("Filter")&&delete this.dictionary._map.Filter,this._isCompress=!0,this.dictionary._updated=!0},e.prototype._write=function(t){this.bytes=new Uint8Array(t.length);for(var e=0;e<t.length;e++)this.bytes[Number.parseInt(e.toString(),10)]=t.charCodeAt(e);this.end=this.bytes.length,this.dictionary._updated=!0},e.prototype._writeBytes=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[Number.parseInt(i.toString(),10)]);this.bytes=new Uint8Array(t),this.end=this.bytes.length,this.dictionary._updated=!0},e}(Nr),Rr=function(t){function e(e){var i=t.call(this)||this;return i._bytes=e,i.dictionary=new xr,i.dictionary._updated=!0,i}return Ir(e,t),Object.defineProperty(e.prototype,"length",{get:function(){return this._bytes.length},enumerable:!0,configurable:!0}),e.prototype.write=function(t){if("string"==typeof t)for(e=0;e<t.length;e++)this._bytes.push(t.charCodeAt(e));else for(var e=0;e<t.length;e++)this._bytes.push(t[Number.parseInt(e.toString(),10)]);this.dictionary._updated=!0},e.prototype.getString=function(t){void 0===t&&(t=!1);var e=new Uint8Array(this._bytes);if(void 0===e||null===e||void 0===e.length)throw new Error("Invalid argument for bytesToString");if(t)return S(e);var i=e.length;if(i<8192)return String.fromCharCode.apply(null,e);for(var r=[],n=0;n<i;n+=8192)r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+8192,i))));return r.join("")},e}(Nr),Fr=function(t){function e(){return t.call(this,new Uint8Array(0))||this}return Ir(e,t),e}(Cr),Br=function(){function e(t){this._recordCollection=[],this._operands=[],this._lexer=new Lr(t)}return e.prototype._readContent=function(){return this._parseObject(t._TokenType.eof),this._recordCollection},e.prototype._parseObject=function(e){for(var i;(i=this._getNextToken())!==t._TokenType.eof;){if(i===e||i===t._TokenType.none)return;switch(i){case t._TokenType.comment:break;case t._TokenType.number:"-"===this._lexer._operatorParams?this._operands.push("0"):this._operands.push(this._lexer._operatorParams);break;case t._TokenType.real:this._operands.push(this._lexer._operatorParams);break;case t._TokenType.string:case t._TokenType.hexString:case t._TokenType.unicodeHexString:case t._TokenType.unicodeString:case t._TokenType.name:this._operands.push(this._lexer._operatorParams);break;case t._TokenType.operator:this._createRecord(),this._operands=[];break;case t._TokenType.beginArray:break;case t._TokenType.endArray:throw new Error("Error while parsing content")}}},e.prototype._createRecord=function(){var t=this._lexer._operatorParams,e=new Mr(t,this._operands);this._recordCollection.push(e)},e.prototype._getNextToken=function(){return this._lexer._getNextToken()},e}(),Lr=function(){function e(e){this._tokenType=t._TokenType.none,this._currentCharacter="\0",this._nextCharacter="\0",this._offset=0,this._data=e instanceof Uint8Array?e:new Uint8Array(e)}return e.prototype._getNextToken=function(){this._operatorParams="";var e=this._moveToNextChar();switch(e){case"%":return this._tokenType=this._getComment();case"/":return this._tokenType=this._getName();case"[":case"(":return this._tokenType=this._getLiteralString();case"+":case"-":return this._tokenType=this._getNumber();case"<":return this._tokenType=this._getEncodedDecimalString();case".":return this._tokenType=this._getNumber();case'"':case"'":return this._tokenType=this._getOperator()}return isNaN(parseInt(e,10))?/[a-zA-Z]/.test(e)?this._tokenType=this._getOperator():e===String.fromCharCode(65535)?this._tokenType=t._TokenType.eof:this._tokenType=t._TokenType.none:this._tokenType=this._getNumber()},e.prototype._getComment=function(){this._operatorParams="";for(var e,i="\n"!==(e=this._consumeValue())&&e!==String.fromCharCode(65535);i;)i="\n"!==(e=this._consumeValue())&&e!==String.fromCharCode(65535);return t._TokenType.comment},e.prototype._getName=function(){this._operatorParams="";for(var e=!1;!e;)switch(this._consumeValue()){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"/":return e=!0,t._TokenType.name}return t._TokenType.none},e.prototype._getNumber=function(){var e=this._currentCharacter;for("+"!==e&&"-"!==e||(this._operatorParams+=this._currentCharacter,e=this._getNextChar());!isNaN(parseInt(e,10))||"."===e;){if(isNaN(parseInt(e,10))){if("."===e){if(this._operatorParams.includes("."))break;this._operatorParams+=this._currentCharacter}}else this._operatorParams+=this._currentCharacter;e=this._getNextChar()}return t._TokenType.number},e.prototype._getOperator=function(){this._operatorParams="";for(var e=this._currentCharacter;this._isOperator(e);)e=this._consumeValue();return t._TokenType.operator},e.prototype._isOperator=function(t){if(/[a-zA-Z]/.test(t))return!0;switch(t){case"*":case"'":case'"':case"1":case"0":return!0}return!1},e.prototype._getLiteralString=function(){this._operatorParams="";for(var e,i=this._currentCharacter,r=this._consumeValue(),n=!0;n;){if("("===i){e=this._getLiteralStringValue(r),this._operatorParams+=e,r=this._getNextChar(),n=!1;break}if("("!==r){if("]"===r){n=!1,r=this._consumeValue();break}r=this._consumeValue()}else r=this._consumeValue(),e=this._getLiteralStringValue(r),this._operatorParams+=e,r=this._getNextChar()}return t._TokenType.string},e.prototype._getEncodedDecimalString=function(){for(var e=0,i=this._consumeValue(),r=!0;r;)if("<"===i)e++,i=this._consumeValue();else if(">"===i){if(0===e){this._consumeValue(),r=!1;break}if(1===e){if(">"===(i=this._consumeValue())&&e--,1===e&&" "===i){r=!1;break}}else">"===i&&e--,i=this._consumeValue()}else if((i=this._consumeValue())===String.fromCharCode(65535)){r=!1;break}return t._TokenType.hexString},e.prototype._getLiteralStringValue=function(t){for(var e=0,i="",r=!0;r;)if("\\"!==t)if("("!==t)if(")"!==t||0===e){if(")"===t&&0===e)return i+=t,r=!1,i;i+=t,t=this._getNextChar()}else i+=t,t=this._getNextChar(),e--;else e++,i+=t,t=this._getNextChar();else i+=t,i+=t=this._getNextChar(),t=this._getNextChar();return i},e.prototype._consumeValue=function(){return this._operatorParams+=this._currentCharacter,this._getNextChar()},e.prototype._moveToNextChar=function(){for(;this._currentCharacter!==String.fromCharCode(65535);)switch(this._currentCharacter){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":this._getNextChar();break;default:return this._currentCharacter}return this._currentCharacter},e.prototype._getNextChar=function(){if(this._data.length<=this._offset){if("Q"===this._nextCharacter||"D"===this._currentCharacter&&"o"===this._nextCharacter)return this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(65535),this._currentCharacter;this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)}else this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&("\n"===this._nextCharacter?(this._currentCharacter=this._nextCharacter,this._data.length<=this._offset?this._nextCharacter=String.fromCharCode(65535):this._nextCharacter=String.fromCharCode(this._data[this._offset++])):this._currentCharacter="\n");return this._currentCharacter},e}(),Mr=function(){function t(t,e){this._operator=t,this._operands=e}return t}(),Dr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Or=function(t){function e(e){var i=t.call(this)||this;if(i._rawMinBufferLength=e||0,i.offset=0,i.bufferLength=0,i.eof=!1,i.buffer=new Uint8Array(0),i.minBufferLength=512,e)for(;i.minBufferLength<e;)i.minBufferLength*=2;return i}return Dr(e,t),Object.defineProperty(e.prototype,"isEmpty",{get:function(){for(;!this.eof&&0===this.bufferLength;)this.readBlock();return 0===this.bufferLength},enumerable:!0,configurable:!0}),e.prototype.ensureBuffer=function(t){var e=this.buffer;if(t<=e.byteLength)return e;for(var i=this.minBufferLength;i<t;)i*=2;var r=new Uint8Array(i);return r.set(e),this.buffer=r,this.buffer},e.prototype.getByte=function(){for(var t=this.offset;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.offset++]},e.prototype.getBytes=function(t){var e,i=this.offset;if(t){for(this.ensureBuffer(i+t),e=i+t;!this.eof&&this.bufferLength<e;)this.readBlock();var r=this.bufferLength;e>r&&(e=r)}else{for(;!this.eof;)this.readBlock();e=this.bufferLength}return this.offset=e,this.buffer.subarray(i,e)},e.prototype.reset=function(){this.offset=0},e.prototype.makeSubStream=function(t,e,i){if(void 0===e)for(;!this.eof;)this.readBlock();else for(var r=t+e;this.bufferLength<=r&&!this.eof;)this.readBlock();return new Cr(this.buffer,i,t,e)},e.prototype.getBaseStreams=function(){return this.stream?this.stream.getBaseStreams():null},e.prototype.moveStart=function(){throw new Error("Invalid call from decode stream")},e.prototype.getByteRange=function(t,e){throw new Error("Invalid call from decode stream. begin: "+t+", end: "+e)},e.prototype.readBlock=function(){throw new Error("Invalid call from decode stream")},e}(Nr),Er=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Vr=function(t){function e(e,i,r){var n=t.call(this,i)||this;return n._chunkSize=512,n.stream=e,n.dictionary=e.dictionary,n._cipher=r,n._nextChunk=null,n._initialized=!1,n}return Er(e,t),e.prototype.readBlock=function(){var t;if(this._initialized?t=this._nextChunk:(t=this.stream.getBytes(this._chunkSize),this._initialized=!0),!t||0===t.length)return void(this.eof=!0);this._nextChunk=this.stream.getBytes(this._chunkSize);var e=this._nextChunk&&this._nextChunk.length>0;t=this._cipher._decryptBlock(t,!e);for(var i=this.bufferLength,r=t.length,n=this.ensureBuffer(i+r),s=0;s<r;s++)n[i++]=t[Number.parseInt(s.toString(),10)];this.bufferLength=i},e}(Or),jr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),zr=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ur=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),Wr=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Hr=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Gr=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],Kr=function(t){function e(e,i){var r=t.call(this,i)||this;r.stream=e,r.dictionary=e.dictionary;var n=e.getByte(),s=e.getByte();if(8!=(15&n))throw new fr("Unknown compression method in flate stream: "+n+", "+s);if(((n<<8)+s)%31!=0)throw new fr("Bad flag check in flate stream: "+n+", "+s);if(32&s)throw new fr("Bad flag bit set in flate stream: "+n+", "+s);return r.codeSize=0,r.codeBuffer=0,r}return jr(e,t),e.prototype.getBits=function(t){for(var e,i=this.stream,r=this.codeSize,n=this.codeBuffer;r<t;)n|=(e=i.getByte())<<r,r+=8;return e=n&(1<<t)-1,this.codeBuffer=n>>t,this.codeSize=r-=t,e},e.prototype.getCode=function(t){for(var e=this.stream,i=t[0],r=t[1],n=this.codeSize,s=this.codeBuffer;n<r;)s|=e.getByte()<<n,n+=8;var a=i[s&(1<<r)-1],o=a>>16,h=65535&a;return o<1||n<o||(this.codeBuffer=s>>o,this.codeSize=n-o),h},e.prototype.generateHuffmanTable=function(t){var e,i=t.length,r=0;for(e=0;e<i;++e)t[e]>r&&(r=t[e]);for(var n=1<<r,s=new Int32Array(n),a=1,o=0,h=2;a<=r;++a,o<<=1,h<<=1)for(var c=0;c<i;++c)if(t[c]===a){var _=0,d=o;for(e=0;e<a;++e)_=_<<1|1&d,d>>=1;for(e=_;e<n;e+=h)s[e]=a<<16|c;++o}return[s,r]},e.prototype.readBlock=function(){var t,e,i=this.stream,r=this.getBits(3);if(1&r&&(this.eof=!0),0===(r>>=1)){var n=i.getByte(),s=n;s|=(n=i.getByte())<<8;var a=n=i.getByte();if(n=i.getByte(),(a|=n<<8)===(65535&~s)||0===s&&0===a){this.codeBuffer=0,this.codeSize=0;var o=this.bufferLength,h=o+s;if(t=this.ensureBuffer(h),this.bufferLength=h,0===s)-1===i.peekByte()&&(this.eof=!0);else{var c=i.getBytes(s);t.set(c,o),c.length<s&&(this.eof=!0)}return}}var _,d;if(1===r)_=Hr,d=Gr;else if(2===r){var p=this.getBits(5)+257,l=this.getBits(5)+1,u=this.getBits(4)+4,f=new Uint8Array(zr.length),g=void 0;for(g=0;g<u;++g)f[zr[g]]=this.getBits(3);var y=this.generateHuffmanTable(f);e=0,g=0;for(var m=p+l,b=new Uint8Array(m),v=void 0,S=void 0,w=void 0;g<m;){var P=this.getCode(y);if(16===P)v=2,S=3,w=e;else if(17===P)v=3,S=3,w=e=0;else{if(18!==P){b[g++]=e=P;continue}v=7,S=11,w=e=0}for(var A=this.getBits(v)+S;A-- >0;)b[g++]=w}_=this.generateHuffmanTable(b.subarray(0,p)),d=this.generateHuffmanTable(b.subarray(p,m))}for(var k=(t=this.buffer)?t.length:0,x=this.bufferLength;;){var T=this.getCode(_);if(T<256)x+1>=k&&(k=(t=this.ensureBuffer(x+1)).length),t[x++]=T;else{if(256===T)return void(this.bufferLength=x);var I=(T=Ur[T-=257])>>16;I>0&&(I=this.getBits(I)),e=(65535&T)+I,T=this.getCode(d),(I=(T=Wr[T])>>16)>0&&(I=this.getBits(I));var N=(65535&T)+I;x+e>=k&&(k=(t=this.ensureBuffer(x+e)).length);for(var C=0;C<e;++C,++x)t[x]=t[x-N]}}},e}(Or),qr=function(){function t(t){if(this._crossReference=t,this._catalogDictionary=t._getCatalogObj(),!(this._catalogDictionary instanceof xr))throw new fr("Catalog object is not a dictionary.");this._catalogDictionary.isCatalog=!0,this._topPagesDictionary=this._catalogDictionary.get("Pages"),this.pageKidsCountCache=new Ar,this.pageIndexCache=new Ar}return Object.defineProperty(t.prototype,"version",{get:function(){var t;if(this._catalogDictionary.has("Version")){var e=this._catalogDictionary.get("Version");e&&(t=e.name)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageCount",{get:function(){var t=this._topPagesDictionary.get("Count");if(void 0===t||!Number.isInteger(t))throw new fr("Invalid page count");return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"acroForm",{get:function(){var t;return this._catalogDictionary.has("AcroForm")&&(t=this._catalogDictionary.get("AcroForm")),null!==t&&void 0!==t||(t=this._createForm()),t},enumerable:!0,configurable:!0}),t.prototype._createForm=function(){var t=new xr(this._crossReference),e=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(e,t),this._catalogDictionary.set("AcroForm",e),this._catalogDictionary._updated=!0,t},t.prototype.getPageDictionary=function(t){var e=[this._topPagesDictionary],i=new Pr,r=this._catalogDictionary.getRaw("Pages");r instanceof wr&&i.put(r);for(var n=this._crossReference,s=this.pageKidsCountCache,a=this.pageIndexCache,o=0;e.length>0;){var h=e.pop();if(null!==h&&void 0!==h&&h instanceof wr){var c=s.get(h);if(c>=0&&o+c<=t){o+=c;continue}if(i.has(h))throw new fr("Pages tree contains circular reference.");i.put(h);var _=n._fetch(h);if(_ instanceof xr&&(null!==(u=_.getRaw("Type"))&&void 0!==u&&u instanceof wr&&(u=n._fetch(u)),Mt(u,"Page")||!_.has("Kids"))){if(s.has(h)||s.put(h,1),a.has(h)||a.put(h,o),o===t)return{dictionary:_,reference:h};o++;continue}e.push(_)}else{if(!(h instanceof xr))throw new fr("Page dictionary kid reference points to wrong type of object.");var d=h.objId,p=h.get("Count");if(null!==p&&void 0!==p&&p instanceof wr&&(p=n._fetch(p)),null!==p&&void 0!==p&&Number.isInteger(p)&&p>=0&&(d&&!s.has(d)&&s.set(d,p),o+p<=t))o+=p;else{var l=h.getRaw("Kids");if(null!==l&&void 0!==l&&l instanceof wr&&(l=n._fetch(l)),!Array.isArray(l)){var u=h.getRaw("Type");if(null!==u&&void 0!==u&&u instanceof wr&&(u=n._fetch(u)),Mt(u,"Page")||!h.has("Kids")){if(o===t)return{dictionary:h,reference:null};o++;continue}throw new fr("Page dictionary kids object is not an array.")}for(var f=l.length-1;f>=0;f--)e.push(l[f])}}}throw new Error("Page index "+t+" not found.")},t.prototype._destroy=function(){this._catalogDictionary&&(this._catalogDictionary=void 0),this._topPagesDictionary&&(this._topPagesDictionary=void 0),this.pageIndexCache&&(this.pageIndexCache.clear(),this.pageIndexCache=void 0),this.pageKidsCountCache&&(this.pageKidsCountCache.clear(),this.pageKidsCountCache=void 0)},t}(),Xr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Jr=function(t){function e(e,i,r){var n=t.call(this,i)||this;if(!(r instanceof xr))return e;var s=n.predictor=r.get("Predictor")||1;if(s<=1)return e;if(2!==s&&(s<10||s>15))throw new fr("Unsupported predictor: "+s);n.readBlock=2===s?n.readBlockTiff:n.readBlockPng,n.stream=e,n.dictionary=e.dictionary;var a=n.colors=r.get("Colors")||1,o=n.bits=r.get("BPC","BitsPerComponent")||8,h=n.columns=r.get("Columns")||1;return n.pixBytes=a*o+7>>3,n.rowBytes=h*a*o+7>>3,n}return Xr(e,t),e.prototype.readBlockTiff=function(){var t=this.rowBytes,e=this.bufferLength,i=this.ensureBuffer(e+t),r=this.bits,n=this.colors,s=this.stream.getBytes(t);if(this.eof=!s.length,!this.eof){var a,o=0,h=0,c=0,_=0,d=e;if(1===r&&1===n)for(a=0;a<t;++a){var p=s[a]^o;p^=p>>1,p^=p>>2,o=(1&(p^=p>>4))<<7,i[d++]=p}else if(8===r){for(a=0;a<n;++a)i[d++]=s[a];for(;a<t;++a)i[d]=i[d-n]+s[a],d++}else if(16===r){var l=2*n;for(a=0;a<l;++a)i[d++]=s[a];for(;a<t;a+=2){var u=((255&s[a])<<8)+(255&s[a+1])+((255&i[d-l])<<8)+(255&i[d-l+1]);i[d++]=u>>8&255,i[d++]=255&u}}else{var f=new Uint8Array(n+1),g=(1<<r)-1,y=0,m=e,b=this.columns;for(a=0;a<b;++a)for(var v=0;v<n;++v)c<r&&(o=o<<8|255&s[y++],c+=8),f[v]=f[v]+(o>>c-r)&g,c-=r,h=h<<r|f[v],(_+=r)>=8&&(i[m++]=h>>_-8&255,_-=8);_>0&&(i[m++]=(h<<8-_)+(o&(1<<8-_)-1))}this.bufferLength+=t}},e.prototype.readBlockPng=function(){var t=this.rowBytes,e=this.pixBytes,i=this.stream.getByte(),r=this.stream.getBytes(t);if(this.eof=!r.length,!this.eof){var n=this.bufferLength,s=this.ensureBuffer(n+t),a=s.subarray(n-t,n);0===a.length&&(a=new Uint8Array(t));var o,h,c,_=n;switch(i){case 0:for(o=0;o<t;++o)s[_++]=r[o];break;case 1:for(o=0;o<e;++o)s[_++]=r[o];for(;o<t;++o)s[_]=s[_-e]+r[o]&255,_++;break;case 2:for(o=0;o<t;++o)s[_++]=a[o]+r[o]&255;break;case 3:for(o=0;o<e;++o)s[_++]=(a[o]>>1)+r[o];for(;o<t;++o)s[_]=(a[o]+s[_-e]>>1)+r[o]&255,_++;break;case 4:for(o=0;o<e;++o)h=a[o],c=r[o],s[_++]=h+c;for(;o<t;++o){h=a[o];var d=a[o-e],p=s[_-e],l=p+h-d,u=l-p;u<0&&(u=-u);var f=l-h;f<0&&(f=-f);var g=l-d;g<0&&(g=-g),c=r[o],s[_++]=u<=f&&u<=g?p+c:f<=g?h+c:d+c}break;default:throw new fr("Unsupported predictor: "+i)}this.bufferLength+=t}},e}(Or),Qr=[1,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Yr=function(){function t(t){this.stream=t,this.nextChar(),this.stringBuffer=[],this._hexStringNumber=0,this.beginInlineImagePosition=-1}return t.prototype.nextChar=function(){return this.currentChar=this.stream.getByte()},t.prototype.peekChar=function(){return this.stream.peekByte()},t.prototype.getNumber=function(){var t=this.currentChar,e=!1,i=0,r=0;if(45===t?(r=-1,45===(t=this.nextChar())&&(t=this.nextChar())):43===t&&(r=1,t=this.nextChar()),10===t||13===t)do{t=this.nextChar()}while(10===t||13===t);if(46===t&&(i=10,t=this.nextChar()),t<48||t>57){if(A(t)||-1===t){if(10===i&&0===r)return 0;if(0===i&&-1===r)return 0}throw new fr("Invalid number: "+String.fromCharCode(t)+" (charCode "+t+")")}r=r||1;var n=t-48,s=0,a=1;for(t=this.nextChar();t>=0;){if(t>=48&&t<=57){var o=t-48;e?s=10*s+o:(0!==i&&(i*=10),n=10*n+o)}else if(46===t){if(0!==i)break;i=1}else{if(45===t){t=this.nextChar();continue}if(69!==t&&101!==t)break;if(43===(t=this.peekChar())||45===t)a=45===t?-1:1,this.nextChar();else if(t<48||t>57)break;e=!0}t=this.nextChar()}return 0!==i&&(n/=i),e&&(n*=Math.pow(10,a*s)),r*n},t.prototype.getString=function(){var t=1,e=!1,i=this.stringBuffer;i.length=0;for(var r=this.nextChar();;){var n=!1;switch(0|r){case-1:e=!0;break;case 40:++t,i.push("(");break;case 41:0==--t?(this.nextChar(),e=!0):i.push(")");break;case 92:switch(r=this.nextChar()){case-1:e=!0;break;case 110:i.push("\n");break;case 114:i.push("\r");break;case 116:i.push("\t");break;case 98:i.push("\b");break;case 102:i.push("\f");break;case 92:case 40:case 41:i.push(String.fromCharCode(r));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:var s=15&r;n=!0,(r=this.nextChar())>=48&&r<=55&&(s=(s<<3)+(15&r),(r=this.nextChar())>=48&&r<=55&&(n=!1,s=(s<<3)+(15&r))),i.push(String.fromCharCode(s));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:i.push(String.fromCharCode(r))}break;default:i.push(String.fromCharCode(r))}if(e)break;n||(r=this.nextChar())}return i.join("")},t.prototype.getName=function(){var t,e,i=this.stringBuffer;for(i.length=0,t=this.nextChar();t>=0&&!Qr[t];){if(35===t){if(t=this.nextChar(),Qr[t]){i.push("#");break}var r=this._toHexDigit(t);if(-1!==r){e=t,t=this.nextChar();var n=this._toHexDigit(t);if(-1===n){if(i.push("#",String.fromCharCode(e)),Qr[t])break;i.push(String.fromCharCode(t)),t=this.nextChar();continue}i.push(String.fromCharCode(r<<4|n))}else i.push("#",String.fromCharCode(t))}else i.push(String.fromCharCode(t));t=this.nextChar()}return vr.get(i.join(""))},t.prototype.getHexString=function(){var t=this.stringBuffer;t.length=0;var e,i,r=this.currentChar,n=!0;for(this._hexStringNumber=0;;){if(r<0)break;if(62===r){this.nextChar();break}if(1!==Qr[r]){if(n){if(-1===(e=this._toHexDigit(r))){r=this.nextChar();continue}}else{if(-1===(i=this._toHexDigit(r))){r=this.nextChar();continue}t.push(String.fromCharCode(e<<4|i))}n=!n,r=this.nextChar()}else r=this.nextChar()}return t.join("")},t.prototype.getObject=function(){for(var t=!1,e=this.currentChar;;){if(e<0)return"EOF";if(t)10!==e&&13!==e||(t=!1);else if(37===e)t=!0;else if(1!==Qr[e])break;e=this.nextChar()}switch(0|e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),Sr.get("[");case 93:return this.nextChar(),Sr.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),Sr.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),Sr.get(">>")):Sr.get(">");case 123:return this.nextChar(),Sr.get("{");case 125:return this.nextChar(),Sr.get("}");case 41:throw this.nextChar(),new fr("Illegal character: "+e)}var i=String.fromCharCode(e);if(e<32||e>127){var r=this.peekChar();if(r>=32&&r<=127)return this.nextChar(),Sr.get(i)}for(e=this.nextChar();e>=0&&!Qr[e];){var n=i+String.fromCharCode(e);if(128===i.length)throw new fr("Command token too long: "+i.length);i=n,e=this.nextChar()}return"true"===i||"false"!==i&&("null"===i?null:("BI"===i&&(this.beginInlineImagePosition=this.stream.position),Sr.get(i)))},t.prototype.peekObj=function(){var t,e=this.stream.position,i=this.currentChar,r=this.beginInlineImagePosition;try{t=this.getObject()}catch(t){}return this.stream.position=e,this.currentChar=i,this.beginInlineImagePosition=r,t},t.prototype.skipToNextLine=function(){for(var t=this.currentChar;t>=0;){if(13===t){10===(t=this.nextChar())&&this.nextChar();break}if(10===t){this.nextChar();break}t=this.nextChar()}},t.prototype._toHexDigit=function(t){return t>=48&&t<=57?15&t:t>=65&&t<=70||t>=97&&t<=102?9+(15&t):-1},t}(),Zr=function(){function t(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=!1),this._isColorSpace=!1,this._isPassword=!1,this.lexicalOperator=t,this.xref=e,this.allowStreams=i,this.recoveryMode=r,this.imageCache=new Map,this.refill()}return t.prototype.refill=function(){this.first=this.lexicalOperator.getObject(),this.second=this.lexicalOperator.getObject()},t.prototype.shift=function(){this.second instanceof Sr&&"ID"===this.second.command?(this.first=this.second,this.second=null):(this.first=this.second,this.second=this.lexicalOperator.getObject())},t.prototype.tryShift=function(){try{return this.shift(),!0}catch(t){return!1}},t.prototype.getObject=function(t){var e=this.first;if(this.shift(),e instanceof Sr)switch(e.command){case"BI":return this.makeInlineImage(t);case"[":for(var i=[];!Dt(this.first,"]")&&"EOF"!==this.first;){var r=this.getObject(t);0===i.length&&Mt(r,"Indexed")&&(this._isColorSpace=!0),r=Bt(r,this._isColorSpace,this._isPassword),i.push(r)}if("EOF"===this.first){if(this.recoveryMode)return i;throw new gr("End of file inside array.")}return this._isColorSpace=!1,this.shift(),i;case"<<":for(var n=new xr(this.xref);!Dt(this.first,">>")&&"EOF"!==this.first;)if(this.first instanceof vr){var s=this.first.name;if("U"!==s&&"O"!==s&&"ID"!==s||(this._isPassword=!0),this.shift(),this._checkEnd())break;var a=this.getObject(t);a=Bt(a,this._isColorSpace,this._isPassword),this._isPassword=!1,n.set(s,a)}else this.shift();if("EOF"===this.first){if(this.recoveryMode)return n;throw new gr("End of file inside dictionary.")}return Dt(this.second,"stream")?!0===this.allowStreams?this.makeStream(n,t):n:(this.shift(),n);default:return e}if(Number.isInteger(e)){if(Number.isInteger(this.first)&&Dt(this.second,"R")){var o=wr.get(e,this.first);return this.shift(),this.shift(),o}return e}return"string"==typeof e&&t?t.decryptString(e):e},t.prototype.findDiscreteDecodeInlineStreamEnd=function(t){var e,i,r=t.position,n=!1;for(e=t.getByte();-1!==e;)if(255===e){switch(t.getByte()){case 0:break;case 255:t.skip(-1);break;case 217:n=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:(i=t.getUnsignedInteger16())>2?t.skip(i-2):t.skip(-2)}if(n)break;e=t.getByte()}else e=t.getByte();var s=t.position-r;return-1===e?(t.skip(-s),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),s)},t.prototype.findDecodeInlineStreamEnd=function(t){for(var e,i=t.position;-1!==(e=t.getByte());)if(126===e){var r=t.position;for(e=t.peekByte();A(e);)t.skip(),e=t.peekByte();if(62===e){t.skip();break}if(t.position>r){var n=t.peekBytes(2);if(69===n[0]&&73===n[1])break}}var s=t.position-i;return-1===e?(t.skip(-s),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),s)},t.prototype.findHexDecodeInlineStreamEnd=function(t){var e,i=t.position;for(e=t.getByte();-1!==e&&62!==e;)e=t.getByte();var r=t.position-i;return-1===e?(t.skip(-r),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),r)},t.prototype.inlineStreamSkipEI=function(t){var e,i=0;for(e=t.getByte();-1!==e;){if(0===i)i=69===e?1:0;else if(1===i)i=73===e?2:0;else if(2===i)break;e=t.getByte()}},t.prototype.makeInlineImage=function(t){for(var e,i=this.lexicalOperator,r=i.stream,n=new xr(this.xref);!Dt(this.first,"ID")&&"EOF"!==this.first;){if(!(this.first instanceof vr))throw new fr("Dictionary key must be a name object");var s=this.first.name;if(this.shift(),"EOF"===this.first.name)break;n.set(s,this.getObject(t))}-1!==i.beginInlineImagePosition&&(e=r.position-i.beginInlineImagePosition);var a,o=n.get("F","Filter");if(o instanceof vr)a=o.name;else if(Array.isArray(o)){var h=o[0],c=null!==h&&void 0!==h&&h instanceof wr?this.xref._fetch(h):h;c&&(a=c.name)}var _,d=r.position;switch(a){case"DCT":case"DCTDecode":_=this.findDiscreteDecodeInlineStreamEnd(r);break;case"A85":case"ASCII85Decode":_=this.findDecodeInlineStreamEnd(r);break;case"AHx":case"ASCIIHexDecode":_=this.findHexDecodeInlineStreamEnd(r);break;default:_=this.findDefaultInlineStreamEnd(r)}var p,l=r.makeSubStream(d,_,n);if(_<1e3&&e<5552){var u=l.getBytes();l.reset();var f=r.position;r.position=i.beginInlineImagePosition;var g=r.getBytes(e);r.position=f,p=this._computeMaxNumber(u)+"_"+this._computeMaxNumber(g);var y=this.imageCache.get(p);if(void 0!==y)return this.second=Sr.get("EI"),this.shift(),y.reset(),y}return t&&(l=t.createStream(l,_)),l=this.filter(l,n,_),l.dictionary=n,void 0!==p&&this.imageCache.set(p,l),this.second=Sr.get("EI"),this.shift(),l},t.prototype._computeMaxNumber=function(t){for(var e=t.length,i=1,r=0,n=0;n<e;++n)r+=i+=255&t[n];return r%65521<<16|i%65521},t.prototype.makeStream=function(t,e){var i=this.lexicalOperator,r=i.stream;i.skipToNextLine();var n=r.position-1,s=t.get("Length");if(Number.isInteger(s)||(s=0),r.position=n+s,i.nextChar(),this.tryShift()&&Dt(this.second,"endstream"))this.shift();else{var a=new Uint8Array([101,110,100,115,116,114,101,97,109]),o=this._findStreamLength(n,a);if(o<0){var h=a.length-1,c=a.slice(0,h),_=this._findStreamLength(n,c);if(_>=0&&A(r.peekBytes(h+1)[h])&&(o=_),o<0)throw new fr("Missing endstream command.")}s=o,i.nextChar(),this.shift(),this.shift()}return this.shift(),r=r.makeSubStream(n,s,t),e&&(r=e.createStream(r,s)),r=this.filter(r,t,s),r.dictionary=t,r},t.prototype.filter=function(t,e,i){var r=e.get("F","Filter"),n=e.get("DP","DecodeParms");if(r instanceof vr)return this.makeFilter(t,r.name,i,n);var s=i;if(Array.isArray(r))for(var a=r,o=n,h=0;h<a.length;++h){var c=a[Number.parseInt(h.toString(),10)];if(!((r=c instanceof wr?this.xref._fetch(c):c)instanceof vr))throw new fr("Bad filter name '"+r+"'");if(n=null,Array.isArray(o)&&h in o){var _=o[Number.parseInt(h.toString(),10)];n=_ instanceof wr?this.xref._fetch(_):_}t=this.makeFilter(t,r.name,s,n),s=null}return t},t.prototype.makeFilter=function(t,e,i,r){if(0===i)return new Fr;try{return"Fl"===e||"FlateDecode"===e?r?new Jr(new Kr(t,i),i,r):new Kr(t,i):t}catch(t){return new Fr}},t.prototype._findStreamLength=function(t,e){var i=this.lexicalOperator.stream;i.position=t;for(var r=e.length;i.position<i.end;){var n=i.peekBytes(2048),s=n.length-r;if(s<=0)break;for(var a=0;a<s;){for(var o=0;o<r&&n[a+o]===e[o];)o++;if(o>=r)return i.position+=a,i.position-t;a++}i.position+=s}return-1},t.prototype.findDefaultInlineStreamEnd=function(t){var e,i,r=t.position,n=0;for(e=t.getByte();-1!==e;){if(0===n)n=69===e?1:0;else if(1===n)n=73===e?2:0;else{if(2!==n)throw new Error("findDefaultInlineStreamEnd - invalid state.");if(32===e||10===e||13===e){i=t.position;for(var s=t.peekBytes(10),a=0,o=s.length;a<o;a++)if((0!==(e=s[a])||0===s[a+1])&&10!==e&&13!==e&&(e<32||e>127)){n=0;break}if(2!==n){e=t.getByte();continue}if(2===n)break}else n=0}e=t.getByte()}-1===e&&void 0!==i&&t.skip(-(t.position-i));var h=4;return t.skip(-h),e=t.peekByte(),t.skip(h),A(e)||h--,t.position-h-r},t.prototype._checkEnd=function(){return"EOF"===this.first},t}(),$r=function(){function t(t){this.isValid=!1;var e=new Zr(new Yr(t),null),i=e.getObject(),r=e.getObject(),n=e.getObject(),s=e.getObject();if(this.isValid=Number.isInteger(i)&&Number.isInteger(r)&&Dt(n,"obj")&&void 0!==s,this.isValid){var a=s.get("Linearized");this.isValid=void 0!==a&&a>0}if(this.isValid){var o=this.getInt(s,"L");if(o!==t.length)throw new Error("The L parameter in the linearization dictionary does not equal the stream length.");this.length=o,this.hints=this.getHints(s),this.objectNumberFirst=this.getInt(s,"O"),this.endFirst=this.getInt(s,"E"),this.pageCount=this.getInt(s,"N"),this.mainXRefEntriesOffset=this.getInt(s,"T"),this.pageFirst=s.has("P")?this.getInt(s,"P",!0):0}}return t.prototype.getInt=function(t,e,i){void 0===i&&(i=!1);var r=t.get(e);if(void 0!==r&&Number.isInteger(r)&&(i?r>=0:r>0))return r;throw new Error("The '"+e+"' parameter in the linearization dictionary is invalid.")},t.prototype.getHints=function(t){var e=t.getArray("H"),i=e.length;if(e&&(2===i||4===i)){for(var r=0;r<i;r++){var n=e[r];if(!(Number.isInteger(n)&&n>0))throw new Error("Hint ("+r+") in the linearization dictionary is invalid.")}return e}throw new Error("Hint array in the linearization dictionary is invalid.")},t}(),tn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),en=function(){function t(t,e,i){void 0===i&&(i=""),this._isUserPassword=!0,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!0,this._defaultPasswordBytes=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);var r=t.get("Filter");if(!Mt(r,"Standard"))throw new fr("unknown encryption method");this._filterName=r.name,this._dictionary=t;var n=t.get("V");if(!Number.isInteger(n)||1!==n&&2!==n&&4!==n&&5!==n)throw new fr("unsupported encryption algorithm");this._algorithm=n;var s=t.get("Length");if(!s)if(n<=3)s=40;else{var a=t.get("CF"),o=t.get("StmF");if(a&&o){a.suppressEncryption=!0;var h=a.get(o.name);(s=h&&h.get("Length")||128)<40&&(s<<=3)}}if(!Number.isInteger(s)||s<40||s%8!=0)throw new fr("invalid key length");var c=u(t.get("O")).subarray(0,32),_=u(t.get("U")).subarray(0,32),d=t.get("P"),p=t.get("R");this._encryptMetaData=(4===n||5===n)&&!1!==t.get("EncryptMetadata");var l,f=u(e);i&&(6===p&&(i=encodeURIComponent(i)),l=u(i));var y;if(5!==n){if((y=this._prepareKeyData(f,l,c,_,d,p,s,this._encryptMetaData))&&(this._isUserPassword=!0,i)){var m=this._decodeUserPassword(l,c,p,s),b=this._prepareKeyData(f,m,c,_,d,p,s,this._encryptMetaData);b&&g(b,y)&&(this._hasUserPasswordOnly=!0)}}else{var v,S=u(t.get("O")),w=S.subarray(32,40),P=S.subarray(40,48),A=u(t.get("U")),k=A.subarray(0,48),x=A.subarray(32,40),T=A.subarray(40,48),I=u(t.get("OE")),N=u(t.get("UE"));v=6===p?new cn:new hn;var C=void 0;C=l?l.subarray(0,Math.min(127,l.length)):new Uint8Array([]),v._checkUserPassword(C,x,_)?(y=this._createEncryptionKey(!0,C,P,k,T,I,N,v),this._isUserPassword=!0,i.length&&v._checkOwnerPassword(C,w,k,c)&&(this._hasUserPasswordOnly=!0)):i.length&&v._checkOwnerPassword(C,w,k,c)&&(y=this._createEncryptionKey(!1,l,P,k,T,I,N,v),this._isUserPassword=!1)}if(!y){if(!i)throw new Error("Cannot open an encrypted document. The password is invalid.");m=this._decodeUserPassword(l,c,p,s);y=this._prepareKeyData(f,m,c,_,d,p,s,this._encryptMetaData),this._isUserPassword=!1}if(n>=4){var R=t.get("CF");if(R&&(R.suppressEncryption=!0,R.has("StdCF"))){var F=R.get("StdCF");if(F&&F.has("AuthEvent")){var B=F.get("AuthEvent");B&&"EFOpen"===B.name&&(this._encryptOnlyAttachment=!0)}}this._cipherDictionary=R,this._stream=t.get("StmF")||vr.get("Identity"),this._string=t.get("StrF")||vr.get("Identity"),this._eff=t.get("EFF")||this._stream}if(!y&&!this._encryptOnlyAttachment)throw new Error("Cannot open an encrypted document. The password is invalid.");this._encryptionKey=y}return Object.defineProperty(t.prototype,"_md5",{get:function(){return void 0===this._messageDigest&&(this._messageDigest=new rn),this._messageDigest},enumerable:!0,configurable:!0}),t.prototype._createEncryptionKey=function(t,e,i,r,n,s,a,o){return t?o._getUserKey(e,n,a):o._getOwnerKey(e,i,r,s)},t.prototype._prepareKeyData=function(t,e,i,r,n,s,a,o){var h,c=new Uint8Array(40+i.length+t.length),_=0,d=0;if(e)for(h=Math.min(32,e.length);_<h;++_)c[Number.parseInt(_.toString(),10)]=e[Number.parseInt(_.toString(),10)];for(;_<32;)c[_++]=this._defaultPasswordBytes[d++];for(d=0,h=i.length;d<h;++d)c[_++]=i[Number.parseInt(d.toString(),10)];for(c[_++]=255&n,c[_++]=n>>8&255,c[_++]=n>>16&255,c[_++]=n>>>24&255,d=0,h=t.length;d<h;++d)c[_++]=t[Number.parseInt(d.toString(),10)];s>=4&&!o&&(c[_++]=255,c[_++]=255,c[_++]=255,c[_++]=255);var p=this._md5.hash(c,0,_),l=a>>3;if(s>=3)for(d=0;d<50;++d)p=this._md5.hash(p,0,l);var u,f=p.subarray(0,l);if(s>=3){for(_=0;_<32;++_)c[Number.parseInt(_.toString(),10)]=this._defaultPasswordBytes[Number.parseInt(_.toString(),10)];for(d=0,h=t.length;d<h;++d)c[_++]=t[Number.parseInt(d.toString(),10)];u=new dn(f)._encryptBlock(this._md5.hash(c,0,_)),h=f.length;var g=new Uint8Array(h);for(d=1;d<=19;++d){for(var y=0;y<h;++y)g[Number.parseInt(y.toString(),10)]=f[Number.parseInt(y.toString(),10)]^d;u=new dn(g)._encryptBlock(u)}for(d=0,h=u.length;d<h;++d)if(r[Number.parseInt(d.toString(),10)]!==u[Number.parseInt(d.toString(),10)])return null}else for(d=0,h=(u=new dn(f)._encryptBlock(this._defaultPasswordBytes)).length;d<h;++d)if(r[Number.parseInt(d.toString(),10)]!==u[Number.parseInt(d.toString(),10)])return null;return f},t.prototype._decodeUserPassword=function(t,e,i,r){for(var n=new Uint8Array(32),s=0,a=0,o=Math.min(32,t.length);s<o;++s)n[Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)];for(;s<32;)n[s++]=this._defaultPasswordBytes[a++];var h=this._md5.hash(n,0,s),c=r>>3;if(i>=3)for(a=0;a<50;++a)h=this._md5.hash(h,0,h.length);var _;if(i>=3){_=e;var d=new Uint8Array(c);for(a=19;a>=0;a--){for(var p=0;p<c;++p)d[Number.parseInt(p.toString(),10)]=h[Number.parseInt(p.toString(),10)]^a;_=new dn(d)._encryptBlock(_)}}else _=new dn(h.subarray(0,c))._encryptBlock(e);return _},t.prototype._createCipherTransform=function(t,e){if(4===this._algorithm||5===this._algorithm){var i=this._buildCipherConstructor(this._cipherDictionary,this._string,t,e,this._encryptionKey),r=this._buildCipherConstructor(this._cipherDictionary,this._stream,t,e,this._encryptionKey);return new gn(i,r)}var n=this._buildObjectKey(t,e,this._encryptionKey,!1);return new gn(new dn(n),new dn(n))},t.prototype._buildCipherConstructor=function(t,e,i,r,n){var s,a=t.get(e.name);if(a&&(s=a.get("CFM")),!s)return new fn;switch(s.name){case"None":return new fn;case"AESV2":return new ln(this._buildObjectKey(i,r,n,!0));case"AESV3":return new un(n);case"V2":return new dn(this._buildObjectKey(i,r,n,!1))}throw new fr("Unknown cryptography method")},t.prototype._buildObjectKey=function(t,e,i,r){void 0===r&&(r=!1);var n,s=new Uint8Array(i.length+9);for(n=0;n<i.length;++n)s[Number.parseInt(n.toString(),10)]=i[Number.parseInt(n.toString(),10)];return s[n++]=255&t,s[n++]=t>>8&255,s[n++]=t>>16&255,s[n++]=255&e,s[n++]=e>>8&255,r&&(s[n++]=115,s[n++]=65,s[n++]=108,s[n++]=84),this._md5.hash(s,0,n).subarray(0,Math.min(i.length+5,16))},t}(),rn=function(){function t(){this._r=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),this._k=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551])}return t.prototype.hash=function(t,e,i){for(var r=1732584193,n=-271733879,s=-1732584194,a=271733878,o=i+72&-64,h=new Uint8Array(o),c=0,_=0;c<i;++c)h[Number.parseInt(c.toString(),10)]=t[e++];h[c++]=128;for(var d=o-8;c<d;)h[c++]=0;h[c++]=i<<3&255,h[c++]=i>>5&255,h[c++]=i>>13&255,h[c++]=i>>21&255,h[c++]=i>>>29&255,h[c++]=0,h[c++]=0,h[c++]=0;var p=new Int32Array(16);for(c=0;c<o;){for(_=0;_<16;++_,c+=4)p[Number.parseInt(_.toString(),10)]=h[Number.parseInt(c.toString(),10)]|h[c+1]<<8|h[c+2]<<16|h[c+3]<<24;var l=r,u=n,f=s,g=a,y=void 0,m=void 0;for(_=0;_<64;++_){_<16?(y=u&f|~u&g,m=_):_<32?(y=g&u|~g&f,m=5*_+1&15):_<48?(y=u^f^g,m=3*_+5&15):(y=f^(u|~g),m=7*_&15);var b=g,v=l+y+this._k[Number.parseInt(_.toString(),10)]+p[Number.parseInt(m.toString(),10)]|0,S=this._r[Number.parseInt(_.toString(),10)];g=f,f=u,u=u+(v<<S|v>>>32-S)|0,l=b}r=r+l|0,n=n+u|0,s=s+f|0,a=a+g|0}return new Uint8Array([255&r,r>>8&255,r>>16&255,r>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&s,s>>8&255,s>>16&255,s>>>24&255,255&a,a>>8&255,a>>16&255,a>>>24&255])},t}(),nn=function(){function t(){}return t.prototype._rotateRight=function(t,e){return t>>>e|t<<32-e},t.prototype._sigma=function(t){return this._rotateRight(t,2)^this._rotateRight(t,13)^this._rotateRight(t,22)},t.prototype._sigmaPrime=function(t){return this._rotateRight(t,6)^this._rotateRight(t,11)^this._rotateRight(t,25)},t.prototype._littleSigma=function(t){return this._rotateRight(t,7)^this._rotateRight(t,18)^t>>>3},t.prototype._littleSigmaPrime=function(t){return this._rotateRight(t,17)^this._rotateRight(t,19)^t>>>10},t.prototype._hash=function(t,e,i){for(var r,n=1779033703,s=3144134277,a=1013904242,o=2773480762,h=1359893119,c=2600822924,_=528734635,d=1541459225,p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],l=64*Math.ceil((i+9)/64),u=new Uint8Array(l),f=0;f<i;++f)u[Number.parseInt(f.toString(),10)]=t[e++];u[f++]=128;for(var g=l-8;f<g;)u[f++]=0;u[f++]=0,u[f++]=0,u[f++]=0,u[f++]=i>>>29&255,u[f++]=i>>21&255,u[f++]=i>>13&255,u[f++]=i>>5&255,u[f++]=i<<3&255;var y=new Uint32Array(64);for(f=0;f<l;){for(r=0;r<16;++r)y[Number.parseInt(r.toString(),10)]=u[Number.parseInt(f.toString(),10)]<<24|u[f+1]<<16|u[f+2]<<8|u[f+3],f+=4;for(r=16;r<64;++r)y[Number.parseInt(r.toString(),10)]=this._littleSigmaPrime(y[r-2])+y[r-7]+this._littleSigma(y[r-15])+y[r-16]|0;var m=n,b=s,v=a,S=o,w=h,P=c,A=_,k=d,x=void 0,T=void 0;for(r=0;r<64;++r)x=k+this._sigmaPrime(w)+(w&P^~w&A)+p[Number.parseInt(r.toString(),10)]+y[Number.parseInt(r.toString(),10)],T=this._sigma(m)+(m&b^m&v^b&v),k=A,A=P,P=w,w=S+x|0,S=v,v=b,b=m,m=x+T|0;n=n+m|0,s=s+b|0,a=a+v|0,o=o+S|0,h=h+w|0,c=c+P|0,_=_+A|0,d=d+k|0}return new Uint8Array([n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,h>>24&255,h>>16&255,h>>8&255,255&h,c>>24&255,c>>16&255,c>>8&255,255&c,_>>24&255,_>>16&255,_>>8&255,255&_,d>>24&255,d>>16&255,d>>8&255,255&d])},t}(),sn=function(){function t(){this._k=[new an(1116352408,3609767458),new an(1899447441,602891725),new an(3049323471,3964484399),new an(3921009573,2173295548),new an(961987163,4081628472),new an(1508970993,3053834265),new an(2453635748,2937671579),new an(2870763221,3664609560),new an(3624381080,2734883394),new an(310598401,1164996542),new an(607225278,1323610764),new an(1426881987,3590304994),new an(1925078388,4068182383),new an(2162078206,991336113),new an(2614888103,633803317),new an(3248222580,3479774868),new an(3835390401,2666613458),new an(4022224774,944711139),new an(264347078,2341262773),new an(604807628,2007800933),new an(770255983,1495990901),new an(1249150122,1856431235),new an(1555081692,3175218132),new an(1996064986,2198950837),new an(2554220882,3999719339),new an(2821834349,766784016),new an(2952996808,2566594879),new an(3210313671,3203337956),new an(3336571891,1034457026),new an(3584528711,2466948901),new an(113926993,3758326383),new an(338241895,168717936),new an(666307205,1188179964),new an(773529912,1546045734),new an(1294757372,1522805485),new an(1396182291,2643833823),new an(1695183700,2343527390),new an(1986661051,1014477480),new an(2177026350,1206759142),new an(2456956037,344077627),new an(2730485921,1290863460),new an(2820302411,3158454273),new an(3259730800,3505952657),new an(3345764771,106217008),new an(3516065817,3606008344),new an(3600352804,1432725776),new an(4094571909,1467031594),new an(275423344,851169720),new an(430227734,3100823752),new an(506948616,1363258195),new an(659060556,3750685593),new an(883997877,3785050280),new an(958139571,3318307427),new an(1322822218,3812723403),new an(1537002063,2003034995),new an(1747873779,3602036899),new an(1955562222,1575990012),new an(2024104815,1125592928),new an(2227730452,2716904306),new an(2361852424,442776044),new an(2428436474,593698344),new an(2756734187,3733110249),new an(3204031479,2999351573),new an(3329325298,3815920427),new an(3391569614,3928383900),new an(3515267271,566280711),new an(3940187606,3454069534),new an(4118630271,4000239992),new an(116418474,1914138554),new an(174292421,2731055270),new an(289380356,3203993006),new an(460393269,320620315),new an(685471733,587496836),new an(852142971,1086792851),new an(1017036298,365543100),new an(1126000580,2618297676),new an(1288033470,3409855158),new an(1501505948,4234509866),new an(1607167915,987167468),new an(1816402316,1246189591)]}return t.prototype._sigma=function(t,e,i){t.assign(e),t.rotateRight(28),i.assign(e),i.rotateRight(34),t.xor(i),i.assign(e),i.rotateRight(39),t.xor(i)},t.prototype._sigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(14),i.assign(e),i.rotateRight(18),t.xor(i),i.assign(e),i.rotateRight(41),t.xor(i)},t.prototype._littleSigma=function(t,e,i){t.assign(e),t.rotateRight(1),i.assign(e),i.rotateRight(8),t.xor(i),i.assign(e),i.shiftRight(7),t.xor(i)},t.prototype._littleSigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(19),i.assign(e),i.rotateRight(61),t.xor(i),i.assign(e),i.shiftRight(6),t.xor(i)},t.prototype._hash=function(t,e,i,r){void 0===r&&(r=!1);var n,s,a,o,h,c,_,d;r?(n=new an(3418070365,3238371032),s=new an(1654270250,914150663),a=new an(2438529370,812702999),o=new an(355462360,4144912697),h=new an(1731405415,4290775857),c=new an(2394180231,1750603025),_=new an(3675008525,1694076839),d=new an(1203062813,3204075428)):(n=new an(1779033703,4089235720),s=new an(3144134277,2227873595),a=new an(1013904242,4271175723),o=new an(2773480762,1595750129),h=new an(1359893119,2917565137),c=new an(2600822924,725511199),_=new an(528734635,4215389547),d=new an(1541459225,327033209));var p,l=128*Math.ceil((i+17)/128),u=new Uint8Array(l);for(p=0;p<i;++p)u[Number.parseInt(p.toString(),10)]=t[e++];u[p++]=128;for(var f=l-16;p<f;)u[p++]=0;u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=i>>>29&255,u[p++]=i>>21&255,u[p++]=i>>13&255,u[p++]=i>>5&255,u[p++]=i<<3&255;var g=new Array(80);for(p=0;p<80;p++)g[Number.parseInt(p.toString(),10)]=new an(0,0);var y,m=new an(0,0),b=new an(0,0),v=new an(0,0),S=new an(0,0),w=new an(0,0),P=new an(0,0),A=new an(0,0),k=new an(0,0),x=new an(0,0),T=new an(0,0),I=new an(0,0),N=new an(0,0);for(p=0;p<l;){var C=void 0;for(C=0;C<16;++C)g[Number.parseInt(C.toString(),10)].high=u[Number.parseInt(p.toString(),10)]<<24|u[p+1]<<16|u[p+2]<<8|u[p+3],g[Number.parseInt(C.toString(),10)].low=u[p+4]<<24|u[p+5]<<16|u[p+6]<<8|u[p+7],p+=8;for(C=16;C<80;++C)y=g[Number.parseInt(C.toString(),10)],this._littleSigmaPrime(y,g[C-2],N),y.add(g[C-7]),this._littleSigma(I,g[C-15],N),y.add(I),y.add(g[C-16]);for(m.assign(n),b.assign(s),v.assign(a),S.assign(o),w.assign(h),P.assign(c),A.assign(_),k.assign(d),C=0;C<80;++C)x.assign(k),this._sigmaPrime(I,w,N),x.add(I),I.assign(w),I.and(P),N.assign(w),N.not(),N.and(A),I.xor(N),x.add(I),x.add(this._k[Number.parseInt(C.toString(),10)]),x.add(g[Number.parseInt(C.toString(),10)]),this._sigma(T,m,N),I.assign(m),I.and(b),N.assign(m),N.and(v),I.xor(N),N.assign(b),N.and(v),I.xor(N),T.add(I),y=k,k=A,A=P,P=w,S.add(x),w=S,S=v,v=b,b=m,y.assign(x),y.add(T),m=y;n.add(m),s.add(b),a.add(v),o.add(S),h.add(w),c.add(P),_.add(A),d.add(k)}var R;return r?(R=new Uint8Array(48),n.copyTo(R,0),s.copyTo(R,8),a.copyTo(R,16),o.copyTo(R,24),h.copyTo(R,32),c.copyTo(R,40)):(R=new Uint8Array(64),n.copyTo(R,0),s.copyTo(R,8),a.copyTo(R,16),o.copyTo(R,24),h.copyTo(R,32),c.copyTo(R,40),_.copyTo(R,48),d.copyTo(R,56)),R},t}(),an=function(){function t(t,e){this.high=0|t,this.low=0|e}return t.prototype.and=function(t){this.high&=t.high,this.low&=t.low},t.prototype.or=function(t){this.high|=t.high,this.low|=t.low},t.prototype.not=function(){this.high=~this.high,this.low=~this.low},t.prototype.xor=function(t){this.high^=t.high,this.low^=t.low},t.prototype.shiftRight=function(t){t>=32?(this.low=this.high>>>t-32|0,this.high=0):(this.low=this.low>>>t|this.high<<32-t,this.high=this.high>>>t|0)},t.prototype.shiftLeft=function(t){t>=32?(this.high=this.low<<t-32,this.low=0):(this.high=this.high<<t|this.low>>>32-t,this.low<<=t)},t.prototype.rotateRight=function(t){var e,i;32&t?(i=this.low,e=this.high):(e=this.low,i=this.high),t&=31,this.low=e>>>t|i<<32-t,this.high=i>>>t|e<<32-t},t.prototype.add=function(t){var e=(this.low>>>0)+(t.low>>>0),i=(this.high>>>0)+(t.high>>>0);e>4294967295&&(i+=1),this.low=0|e,this.high=0|i},t.prototype.copyTo=function(t,e){t[Number.parseInt(e.toString(),10)]=this.high>>>24&255,t[e+1]=this.high>>16&255,t[e+2]=this.high>>8&255,t[e+3]=255&this.high,t[e+4]=this.low>>>24&255,t[e+5]=this.low>>16&255,t[e+6]=this.low>>8&255,t[e+7]=255&this.low},t.prototype.assign=function(t){this.high=t.high,this.low=t.low},t}(),on=function(){function t(){}return Object.defineProperty(t.prototype,"_sha256",{get:function(){return void 0===this._sha256Obj&&(this._sha256Obj=new nn),this._sha256Obj},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_sha512",{get:function(){return void 0===this._sha512Obj&&(this._sha512Obj=new sn),this._sha512Obj},enumerable:!0,configurable:!0}),t}(),hn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return tn(e,t),e.prototype._checkOwnerPassword=function(t,e,i,r){var n=new Uint8Array(t.length+56);return n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length),g(this._sha256._hash(n,0,n.length),r)},e.prototype._checkUserPassword=function(t,e,i){var r=new Uint8Array(t.length+8);return r.set(t,0),r.set(e,t.length),g(this._sha256._hash(r,0,r.length),i)},e.prototype._getOwnerKey=function(t,e,i,r){var n=new Uint8Array(t.length+56);n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length);var s=this._sha256._hash(n,0,n.length);return new un(s)._decryptBlock(r,!1,new Uint8Array(16))},e.prototype._getUserKey=function(t,e,i){var r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);var n=this._sha256._hash(r,0,r.length);return new un(n)._decryptBlock(i,!1,new Uint8Array(16))},e}(on),cn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return tn(e,t),e.prototype._checkOwnerPassword=function(t,e,i,r){var n=new Uint8Array(t.length+56);return n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length),g(this._hash(t,n,i),r)},e.prototype._checkUserPassword=function(t,e,i){var r=new Uint8Array(t.length+8);return r.set(t,0),r.set(e,t.length),g(this._hash(t,r,new Uint8Array([])),i)},e.prototype._getOwnerKey=function(t,e,i,r){var n=new Uint8Array(t.length+56);n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length);var s=this._hash(t,n,i);return new un(s)._decryptBlock(r,!1,new Uint8Array(16))},e.prototype._getUserKey=function(t,e,i){var r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);var n=this._hash(t,r,new Uint8Array([]));return new un(n)._decryptBlock(i,!1,new Uint8Array(16))},e.prototype._hash=function(t,e,i){for(var r=this._sha256._hash(e,0,e.length).subarray(0,32),n=new Uint8Array([0]),s=0;s<64||n[n.length-1]>s-32;){var a=t.length+r.length+i.length,o=new Uint8Array(a),h=0;o.set(t,h),h+=t.length,o.set(r,h),h+=r.length,o.set(i,h);for(var c=new Uint8Array(64*a),_=0,d=0;_<64;_++)c.set(o,d),d+=a;n=new ln(r.subarray(0,16))._encrypt(c,r.subarray(16,32));for(var p=0,l=0;l<16;l++)p*=1,p%=3,p+=(n[Number.parseInt(l.toString(),10)]>>>0)%3,p%=3;2===p?r=this._sha512._hash(n,0,n.length):1===p?r=this._sha512._hash(n,0,n.length,!0):0===p&&(r=this._sha256._hash(n,0,n.length)),s++}return r.subarray(0,32)},e}(on),_n=function(){function t(){}return t}(),dn=function(t){function e(e){var i=t.call(this)||this;i._a=0,i._b=0;for(var r=new Uint8Array(256),n=0;n<256;++n)r[Number.parseInt(n.toString(),10)]=n;for(var s=e.length,n=0,a=0;n<256;++n){var o=r[Number.parseInt(n.toString(),10)];a=a+o+e[n%s]&255,r[Number.parseInt(n.toString(),10)]=r[Number.parseInt(a.toString(),10)],r[Number.parseInt(a.toString(),10)]=o}return i._s=r,i}return tn(e,t),e.prototype._encryptBlock=function(t){for(var e=this._a,i=this._b,r=this._s,n=t.length,s=new Uint8Array(n),a=0;a<n;++a){e=e+1&255;var o=r[Number.parseInt(e.toString(),10)];i=i+o&255;var h=r[Number.parseInt(i.toString(),10)];r[Number.parseInt(e.toString(),10)]=h,r[Number.parseInt(i.toString(),10)]=o,s[Number.parseInt(a.toString(),10)]=t[Number.parseInt(a.toString(),10)]^r[o+h&255]}return this._a=e,this._b=i,s},e.prototype._decryptBlock=function(t){return this._encryptBlock(t)},e.prototype._encrypt=function(t){return this._encryptBlock(t)},e}(_n),pn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._buffer=new Uint8Array(16),e._position=0,e._s=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),e._inverseS=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),e._mix=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]),e}return tn(e,t),Object.defineProperty(e.prototype,"_mixCol",{get:function(){if(void 0===this._mixC){this._mixC=new Uint8Array(256);for(var t=0;t<256;t++)this._mixC[Number.parseInt(t.toString(),10)]=t<128?t<<1:t<<1^27}return this._mixC},enumerable:!0,configurable:!0}),e.prototype._decrypt=function(t,e){var i,r,n,s=new Uint8Array(16);s.set(t);for(var a=0,o=this._keySize;a<16;++a,++o)s[Number.parseInt(a.toString(),10)]^=e[Number.parseInt(o.toString(),10)];for(var h=this._cyclesOfRepetition-1;h>=1;--h){i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],n=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=n;for(a=0;a<16;++a)s[Number.parseInt(a.toString(),10)]=this._inverseS[s[Number.parseInt(a.toString(),10)]];for(var a=0,o=16*h;a<16;++a,++o)s[Number.parseInt(a.toString(),10)]^=e[Number.parseInt(o.toString(),10)];for(a=0;a<16;a+=4){var c=this._mix[s[Number.parseInt(a.toString(),10)]],_=this._mix[s[a+1]],d=this._mix[s[a+2]],p=this._mix[s[a+3]];i=c^_>>>8^_<<24^d>>>16^d<<16^p>>>24^p<<8,s[Number.parseInt(a.toString(),10)]=i>>>24&255,s[a+1]=i>>16&255,s[a+2]=i>>8&255,s[a+3]=255&i}}i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],n=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=n;for(a=0;a<16;++a)s[Number.parseInt(a.toString(),10)]=this._inverseS[s[Number.parseInt(a.toString(),10)]],s[Number.parseInt(a.toString(),10)]^=e[Number.parseInt(a.toString(),10)];return s},e.prototype._encryptBlock=function(t,e){var i,r,n,s=this._s,a=new Uint8Array(16);a.set(t);for(p=0;p<16;++p)a[Number.parseInt(p.toString(),10)]^=e[Number.parseInt(p.toString(),10)];for(var o=1;o<this._cyclesOfRepetition;o++){for(p=0;p<16;++p)a[Number.parseInt(p.toString(),10)]=s[a[Number.parseInt(p.toString(),10)]];n=a[1],a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=n,n=a[2],r=a[6],a[2]=a[10],a[6]=a[14],a[10]=n,a[14]=r,n=a[3],r=a[7],i=a[11],a[3]=a[15],a[7]=n,a[11]=r,a[15]=i;for(p=0;p<16;p+=4){var h=a[p+0],c=a[p+1],_=a[p+2],d=a[p+3];i=h^c^_^d,a[p+0]^=i^this._mixCol[h^c],a[p+1]^=i^this._mixCol[c^_],a[p+2]^=i^this._mixCol[_^d],a[p+3]^=i^this._mixCol[d^h]}for(var p=0,l=16*o;p<16;++p,++l)a[Number.parseInt(p.toString(),10)]^=e[Number.parseInt(l.toString(),10)]}for(p=0;p<16;++p)a[Number.parseInt(p.toString(),10)]=s[a[Number.parseInt(p.toString(),10)]];n=a[1],a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=n,n=a[2],r=a[6],a[2]=a[10],a[6]=a[14],a[10]=n,a[14]=r,n=a[3],r=a[7],i=a[11],a[3]=a[15],a[7]=n,a[11]=r,a[15]=i;for(var p=0,l=this._keySize;p<16;++p,++l)a[Number.parseInt(p.toString(),10)]^=e[Number.parseInt(l.toString(),10)];return a},e.prototype._decryptBlockHelper=function(t,e){for(var i=t.length,r=this._buffer,n=this._position,s=[],a=this._iv,o=0;o<i;++o)if(r[Number.parseInt(n.toString(),10)]=t[Number.parseInt(o.toString(),10)],!(++n<16)){for(var h=this._decrypt(r,this._key),c=0;c<16;++c)h[Number.parseInt(c.toString(),10)]^=a[Number.parseInt(c.toString(),10)];a=r,s.push(h),r=new Uint8Array(16),n=0}if(this._buffer=r,this._bufferLength=n,this._iv=a,0===s.length)return new Uint8Array(0);var _=16*s.length;if(e){var d=s[s.length-1],p=d[15];if(p<=16){for(var o=15,l=16-p;o>=l;--o)if(d[Number.parseInt(o.toString(),10)]!==p){p=0;break}_-=p,s[s.length-1]=d.subarray(0,16-p)}}for(var u=new Uint8Array(_),o=0,c=0;o<s.length;++o,c+=16)u.set(s[Number.parseInt(o.toString(),10)],c);return u},e.prototype._decryptBlock=function(t,e,i){var r=t.length,n=this._buffer,s=this._position;if(i)this._iv=i;else{for(var a=0;s<16&&a<r;++a,++s)n[Number.parseInt(s.toString(),10)]=t[Number.parseInt(a.toString(),10)];if(s<16)return this._bufferLength=s,new Uint8Array(0);this._iv=n,t=t.subarray(16)}return this._buffer=new Uint8Array(16),this._bufferLength=0,this._decryptBlock=this._decryptBlockHelper,this._decryptBlock(t,e)},e.prototype._encrypt=function(t,e){var i=t.length,r=this._buffer,n=this._position,s=[];e||(e=new Uint8Array(16));for(c=0;c<i;++c)if(r[Number.parseInt(n.toString(),10)]=t[Number.parseInt(c.toString(),10)],!(++n<16)){for(_=0;_<16;++_)r[Number.parseInt(_.toString(),10)]^=e[Number.parseInt(_.toString(),10)];var a=this._encryptBlock(r,this._key);e=a,s.push(a),r=new Uint8Array(16),n=0}if(this._buffer=r,this._bufferLength=n,this._iv=e,0===s.length)return new Uint8Array(0);for(var o=16*s.length,h=new Uint8Array(o),c=0,_=0;c<s.length;++c,_+=16)h.set(s[Number.parseInt(c.toString(),10)],_);return h},e}(_n),ln=function(t){function e(e){var i=t.call(this)||this;return i._cyclesOfRepetition=10,i._keySize=160,i._key=new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]),i._key=i._expandKey(e),i}return tn(e,t),e.prototype._expandKey=function(t){var e=this._s,i=this._key,r=new Uint8Array(176);r.set(t);for(var n=16,s=1;n<176;++s){var a=r[n-3],o=r[n-2],h=r[n-1],c=r[n-4];a=e[Number.parseInt(a.toString(),10)],o=e[Number.parseInt(o.toString(),10)],h=e[Number.parseInt(h.toString(),10)],c=e[Number.parseInt(c.toString(),10)],a^=i[Number.parseInt(s.toString(),10)];for(var _=0;_<4;++_)r[Number.parseInt(n.toString(),10)]=a^=r[n-16],r[n+1]=o^=r[n-15],r[n+2]=h^=r[n-14],r[n+3]=c^=r[n-13],n+=4}return r},e}(pn),un=function(t){function e(e){var i=t.call(this)||this;return i._cyclesOfRepetition=14,i._keySize=224,i._key=i._expandKey(e),i}return tn(e,t),e.prototype._expandKey=function(t){var e=this._s,i=new Uint8Array(240);i.set(t);for(var r,n,s,a,o=1,h=32,c=1;h<240;++c){h%32==16?(r=e[Number.parseInt(r.toString(),10)],n=e[Number.parseInt(n.toString(),10)],s=e[Number.parseInt(s.toString(),10)],a=e[Number.parseInt(a.toString(),10)]):h%32==0&&(r=i[h-3],n=i[h-2],s=i[h-1],a=i[h-4],r=e[Number.parseInt(r.toString(),10)],n=e[Number.parseInt(n.toString(),10)],s=e[Number.parseInt(s.toString(),10)],a=e[Number.parseInt(a.toString(),10)],r^=o,(o<<=1)>=256&&(o=255&(27^o)));for(var _=0;_<4;++_)i[Number.parseInt(h.toString(),10)]=r^=i[h-32],i[h+1]=n^=i[h-31],i[h+2]=s^=i[h-30],i[h+3]=a^=i[h-29],h+=4}return i},e}(pn),fn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return tn(e,t),e.prototype._decryptBlock=function(t){return t},e.prototype._encrypt=function(t){return t},e}(_n),gn=function(){function t(t,e){this._stringCipher=t,this._streamCipher=e}return t.prototype.createStream=function(t,e){return new Vr(t,e,this._streamCipher)},t.prototype.decryptString=function(t){return b(this._stringCipher._decryptBlock(u(t),!0))},t.prototype.encryptString=function(t){if(this._stringCipher instanceof pn){var e=16-t.length%16;t+=String.fromCharCode(e).repeat(e);var i=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(i);else for(var r=0;r<16;r++)i[Number.parseInt(r.toString(),10)]=Math.floor(256*Math.random());var n=this._stringCipher._encrypt(u(t),i),s=new Uint8Array(16+n.length);return s.set(i),s.set(n,16),b(s)}return b(this._stringCipher._encrypt(u(t)))},t}(),yn=function(){function i(t,e){this._version="",this._newLine="\r\n",this._password=e,this._document=t,this._stream=t._stream,this._entries=[],this._crossReferencePosition=Object.create(null),this._cacheMap=new Map,this._pendingRefs=new Pr}return i.prototype._setStartXRef=function(t){this._startXRefQueue=[t],this._prevStartXref=t,void 0!==this._prevXRefOffset&&null!==this._prevXRefOffset||(this._prevXRefOffset=t)},i.prototype._parse=function(e){var i;(i=e?this._indexObjects():this._readXRef()).assignXref(this),this._nextReferenceNumber=i.get("Size"),this._trailer=i;var r=i.get("Encrypt");if(r){this._document._isEncrypted=!0,this._ids=i.get("ID"),this._permissionFlags=r.get("P");var n=this._ids&&this._ids.length?this._ids[0]:"";r.suppressEncryption=!0,this._encrypt=new en(r,n,this._password),this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.stream,this._document._isUserPassword=this._encrypt._isUserPassword,this._document._encryptOnlyAttachment=this._encrypt._encryptOnlyAttachment,this._encrypt._encryptOnlyAttachment?(this._document._hasUserPasswordOnly=!0,this._document._encryptMetaData=!1):(this._document._hasUserPasswordOnly=this._encrypt._hasUserPasswordOnly,this._document._encryptMetaData=!r.has("EncryptMetadata")||r.get("EncryptMetadata"))}var s,a=!1;try{s=i.get("Root")}catch(t){throw new ur("Invalid cross reference","XRefParseException")}if(s)try{s.get("Pages")&&(this._root=s,a=!0)}catch(t){throw new ur("Invalid cross reference","InvalidXRef")}if(!a)throw e?new ur("Invalid cross reference","InvalidXRef"):new ur("Invalid cross reference","XRefParseException")},i.prototype._getEntry=function(t){var e=this._entries[t];return e&&!e.free&&e.offset?e:null},i.prototype._fetch=function(t,e){var i;if(!(t instanceof wr))throw new Error("ref object is not a reference");var r=t.objectNumber,n=this._cacheMap.get(t);if(void 0!==n)return n instanceof xr&&!n.objId&&(n.objId=r),n;var s=this._getEntry(r);if(null===s)return this._cacheMap.set(t,s),s;if(this._pendingRefs.has(t))throw this._pendingRefs.remove(t),new Error("circular reference");this._pendingRefs.put(t);try{i=s.uncompressed?this._fetchUncompressed(t,s,e):this._fetchCompressed(t,s),this._pendingRefs.remove(t)}catch(e){throw this._pendingRefs.remove(t),e}return i},i.prototype._fetchUncompressed=function(t,e,i){var r=t.generationNumber,n=t.objectNumber;if(e.gen!==r)throw new ur("Inconsistent generation in XRef: "+t,"XRefEntryException");var s=this._stream.makeSubStream(e.offset+this._stream.start,void 0),a=new Zr(new Yr(s),this,!0),o=a.getObject(),h=a.getObject(),c=a.getObject();if(o!==n||h!==r||void 0===c)throw new ur("Bad (uncompressed) XRef entry: "+t,"XRefEntryException");var _;return(_=this._encrypt&&!i?a.getObject(this._encrypt._createCipherTransform(t.objectNumber,t.generationNumber)):a.getObject())instanceof Nr||this._cacheMap.set(t,_),_ instanceof xr?_.objId=t.toString():_ instanceof Nr&&(_.dictionary.objId=t.toString()),_},i.prototype._fetchCompressed=function(t,e){var i=e.offset,r=this._fetch(wr.get(i,0));if(void 0===r)throw new fr("bad ObjStm stream");var n=r.dictionary.get("First"),s=r.dictionary.get("N"),a=t.generationNumber;if(!Number.isInteger(n)||!Number.isInteger(s))throw new fr("invalid first and n parameters for ObjStm stream");for(var o=new Zr(new Yr(r),this,!0),h=new Array(s),c=new Array(s),_=0;_<s;++_){g=o.getObject();if(!Number.isInteger(g))throw new fr("invalid object number in the ObjStm stream: "+g);var d=o.getObject();if(!Number.isInteger(d))throw new fr("invalid object offset in the ObjStm stream: "+d);h[_]=g,c[_]=d}for(var p=(r.start||0)+n,l=new Array(s),_=0;_<s;++_){var u=_<s-1?c[_+1]-c[_]:void 0;if(u<0)throw new fr("Invalid offset in the ObjStm stream.");var f=(o=new Zr(new Yr(r.makeSubStream(p+c[_],u,r.dictionary)),this,!0)).getObject();if(l[_]=f,!(f instanceof Nr)){var g=h[_],y=this._entries[g];if(y&&y.offset===i&&y.gen===_){var m=g+" "+a;this._cacheMap.set(wr.get(g,a),f),f instanceof xr&&(f.objId=m)}}}var b=l[e.gen];if(void 0===b)throw new ur("Bad (compressed) XRef entry: "+t,"XRefEntryException");return b},i.prototype._readXRef=function(e){void 0===e&&(e=!1);var i=this._stream,r=new Set;try{for(;this._startXRefQueue.length;){var n=this._startXRefQueue[0];if(this._prevStartXref<n&&(this._prevStartXref=n),r.has(n))this._startXRefQueue.shift();else{r.add(n),i.position=n+i.start;var s=new Zr(new Yr(i),this,!0),a=s.getObject(),o=void 0;if(Dt(a,"xref")){if(void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.table),o=this._processXRefTable(s),this._topDictionary||(this._topDictionary=o),a=o.get("XRefStm"),Number.isInteger(a)){var h=a;h in this._crossReferencePosition||(this._crossReferencePosition[h]=1,this._startXRefQueue.push(h))}}else{if(!Number.isInteger(a))throw new fr("Invalid XRef stream header");void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.stream);var c=s.getObject(),_=s.getObject();if(a=s.getObject(),!(void 0!==c&&Number.isInteger(c)&&Dt(_,"obj")&&a instanceof Nr))throw new fr("Invalid cross reference stream");if(o=this._processXRefStream(a),this._topDictionary||(this._topDictionary=o),!o)throw new fr("Failed to read XRef stream")}a=o.get("Prev"),Number.isInteger(a)?this._startXRefQueue.push(a):a instanceof wr&&this._startXRefQueue.push(a.objectNumber),this._startXRefQueue.shift()}}return this._topDictionary}catch(t){this._startXRefQueue.shift()}if(!e)throw new ur("Invalid cross reference","XRefParseException")},i.prototype._readToken=function(t,e){for(var i="",r=t[e];10!==r&&13!==r&&60!==r&&!(++e>=t.length);)i+=String.fromCharCode(r),r=t[e];return i},i.prototype._skipUntil=function(t,e,i){for(var r=i.length,n=t.length,s=0;e<n;){for(var a=0;a<r&&t[e+a]===i[a];)++a;if(a>=r)break;e++,s++}return s},i.prototype._indexObjects=function(){var t=/^(\d+)\s+(\d+)\s+obj\b/,e=/\bendobj[\b\s]$/,i=/\s+(\d+\s+\d+\s+obj[\b\s<])$/,r=new Uint8Array([116,114,97,105,108,101,114]),n=new Uint8Array([115,116,97,114,116,120,114,101,102]),s=new Uint8Array([111,98,106]),a=new Uint8Array([47,88,82,101,102]);this._entries.length=0,this._cacheMap.clear();var o=this._stream;o.position=0;for(var h=o.getBytes(),c=h.length,_=o.start,d=[],p=[];_<c;){var l=h[_];if(9!==l&&10!==l&&13!==l&&32!==l)if(37!==l){var u=this._readToken(h,_),f=void 0;if(u.startsWith("xref")&&(4===u.length||/\s/.test(u[4])))_+=this._skipUntil(h,_,r),d.push(_),_+=this._skipUntil(h,_,n);else if(f=t.exec(u)){var g=0|Number.parseInt(f[1]),y=0|Number.parseInt(f[2]),m=void 0,v=_+u.length,S=!1;if(this._entries[g]){if(this._entries[g].gen===y)try{var w=o.makeSubStream(v,o.length-v),P=new Yr(w);(B=new Zr(P,null)).getObject(),S=!0}catch(t){S=!(t instanceof gr)}}else S=!0;if(S){var A=new mn;A.offset=_-o.start,A.gen=y,A.uncompressed=!0,this._entries[g]=A}for(;v<h.length;){var k=v+this._skipUntil(h,v,s)+4;m=k-_;var x=Math.max(k-25,v),T=b(h.subarray(x,k));if(e.test(T))break;var I=i.exec(T);if(I&&I[1]){m-=I[1].length;break}v=k}var N=h.subarray(_,_+m),C=this._skipUntil(N,0,a);C<m&&N[C+5]<64&&(p.push(_-o.start),this._crossReferencePosition[_-o.start]=1),_+=m}else u.startsWith("trailer")&&(7===u.length||/\s/.test(u[7]))?(d.push(_),_+=this._skipUntil(h,_,n)):_+=u.length+1}else do{if(++_>=c)break;l=h[_]}while(10!==l&&13!==l);else++_}for(F=0;F<p.length;++F)this._startXRefQueue.push(p[F]),this._readXRef(!0);for(var R,F=0;F<d.length;++F){o.position=d[F];var B=new Zr(new Yr(o),this,!0,!0);if(Dt(B.getObject(),"trailer")){var L=B.getObject();if(L instanceof xr){try{var M=L.get("Root");if(!(M instanceof xr))continue;var D=M.get("Pages");if(!(D instanceof xr))continue;var O=D.get("Count");if(void 0===O||!Number.isInteger(O))continue}catch(t){continue}if(L.has("ID"))return L;R=L}}}if(R)return R;if(this._topDictionary)return this._topDictionary;throw new ur("Invalid PDF structure.","InvalidPDFException")},i.prototype._processXRefTable=function(t){if(void 0===this._tableState){var e=new bn;e.entryNum=0,e.streamPos=t.lexicalOperator.stream.position,e.parserBuf1=t.first,e.parserBuf2=t.second,this._tableState=e}if(!Dt(this._readXRefTable(t),"trailer"))throw new fr("Invalid XRef table: could not find trailer dictionary");var i,r=t.getObject();if(r&&(r instanceof xr?i=r:r instanceof Nr&&r.dictionary&&(i=r.dictionary)),!i)throw new fr("Invalid cross reference: could not parse trailer dictionary");return this._tableState=void 0,i},i.prototype._readXRefTable=function(t){var e=t.lexicalOperator.stream;e.position=this._tableState.streamPos,t.first=this._tableState.parserBuf1,t.second=this._tableState.parserBuf2;for(var i;;){if(void 0===this._tableState.firstEntryNum||void 0===this._tableState.entryCount){if(i=t.getObject(),Dt(i,"trailer"))break;this._tableState.firstEntryNum=i,this._tableState.entryCount=t.getObject()}var r=this._tableState.firstEntryNum,n=this._tableState.entryCount;if(!Number.isInteger(r)||!Number.isInteger(n))throw new fr("Invalid cross reference: wrong types in subsection header");for(var s=this._tableState.entryNum;s<n;s++){this._tableState.streamPos=e.position,this._tableState.entryNum=s,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second;var a=new mn;a.offset=t.getObject(),a.gen=t.getObject();var o=t.getObject();if(o)switch(o.command){case"f":a.free=!0;break;case"n":a.uncompressed=!0}if(!Number.isInteger(a.offset)||!Number.isInteger(a.gen)||!a.free&&!a.uncompressed)throw new fr("Invalid entry in cross reference subsection: "+r+", "+n);0===s&&a.free&&1===r&&(r=0),this._entries[s+r]||(this._entries[s+r]=a)}this._tableState.entryNum=0,this._tableState.streamPos=e.position,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second,this._tableState.firstEntryNum=void 0,this._tableState.entryCount=void 0}if(this._entries[0]&&!this._entries[0].free)throw new fr("Invalid XRef table: unexpected first object");return i},i.prototype._processXRefStream=function(t){if(void 0===this._streamState){var e=t.dictionary,i=new vn,r=e.getArray("Index");r||(r=[0,e.get("Size")]),i.entryRanges=r,i.byteWidths=e.getArray("W"),i.entryNum=0,i.streamPos=t.position,this._streamState=i}return this._readXRefStream(t),this._streamState=void 0,t.dictionary},i.prototype._readXRefStream=function(t){t.position=this._streamState.streamPos;for(var e=this._streamState.byteWidths[0],i=this._streamState.byteWidths[1],r=this._streamState.byteWidths[2],n=this._streamState.entryRanges;n.length>0;){var s=n[0],a=n[1];if(!Number.isInteger(s)||!Number.isInteger(a))throw new fr("Invalid XRef range fields: "+s+", "+a);if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r))throw new fr("Invalid XRef entry fields length: "+s+", "+a);for(var o=this._streamState.entryNum;o<a;++o){this._streamState.entryNum=o,this._streamState.streamPos=t.position;for(var h=0,c=0,_=0,d=0;d<e;++d){var p=t.getByte();if(-1===p)throw new fr("invalid cross reference byte width type.");h=h<<8|p}0===e&&(h=1);for(d=0;d<i;++d){var l=t.getByte();if(-1===l)throw new fr("invalid cross reference byte width offset.");c=c<<8|l}for(d=0;d<r;++d){var u=t.getByte();if(-1===u)throw new fr("invalid cross reference byte width generation.");_=_<<8|u}var f=new mn;switch(f.offset=c,f.gen=_,h){case 0:f.free=!0;break;case 1:f.uncompressed=!0;break;case 2:break;default:throw new fr("Invalid XRef entry type: "+h)}this._entries[s+o]||(this._entries[s+o]=f)}this._streamState.entryNum=0,this._streamState.streamPos=t.position,n.splice(0,2)}},i.prototype._getCatalogObj=function(){return this._root},i.prototype._save=function(){var e=this,i=this._stream.length,r=[this._newLine.charCodeAt(0),this._newLine.charCodeAt(1),37,80,68,70,45];this._writeString(""+this._version+this._newLine,r),r.push(37,131,146,250,254),this._writeString(this._newLine,r);var n=0,s=0;if(this._document._fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream){var a=[],o=[],h="",c=[];c.push(0,1);var _=[],d=[];this._cacheMap.forEach(function(t,n){var a;if(t instanceof Nr&&(a=t.dictionary),a&&a._updated&&(!a.isCatalog||e._allowCatalog)){c.push(n.objectNumber,1),d.push(i+r.length);var o;e._encrypt&&(o=e._encrypt._createCipherTransform(n.objectNumber,n.generationNumber)),e._writeObject(t,r,n,o),s++,a._updated=!1}}),this._cacheMap.forEach(function(t,a){if(t instanceof xr)!t._updated||t.isCatalog&&!e._allowCatalog||(h+=a.objectNumber+" "+o.length+e._newLine,_.push(a.objectNumber,1),n++,e._writeObject(t,o));else if(t instanceof Nr){var p=t.dictionary;p&&p._updated&&(!p.isCatalog||e._allowCatalog)&&(c.push(a.objectNumber,1),d.push(i+r.length),e._writeObject(t,r,a),s++,p._updated=!1)}});for(var p=0;p<_.length;p++)c.push(_[parseInt(p.toString(),10)]);var l=void 0,u=void 0;if(n>0){u=this._getNextReference(),c.push(u.objectNumber,2),this._writeString(h,a),this._writeBytes(o,a);var f=new xr(this);f.set("Type",vr.get("ObjStm")),f.set("N",n),f.set("First",h.length),f.set("Length",a.length);var g=new Cr(a,f,0,a.length);l=i+r.length;var y;this._encrypt&&(y=this._encrypt._createCipherTransform(u.objectNumber,u.generationNumber)),this._writeObject(g,r,u,y)}var m=this._getNextReference(),b=i+r.length;(k=new xr(this)).set("Type",vr.get("XRef")),k.set("Index",c),k.set("W",[1,3,1]),this._copyTrailer(k),this._ids&&this._ids.length>0&&k.update("ID",[this._ids[0],this._computeMessageDigest(b)]);var v=[];if(this._writeLong(0,1,v),this._writeLong(1,3,v),this._writeLong(-1,1,v),s>0)for(S=0;S<s;S++)this._writeLong(1,1,v),this._writeLong(d[S],3,v),this._writeLong(0,1,v);if(n>0){for(var S=0;S<n;S++)this._writeLong(2,1,v),this._writeLong(u.objectNumber,3,v),this._writeLong(S,1,v);this._writeLong(1,1,v),this._writeLong(l,3,v),this._writeLong(0,1,v)}this._writeLong(1,1,v),this._writeLong(b,3,v),this._writeLong(0,1,v),k.set("Length",v.length);var w=new Cr(v,k,0,v.length),P=void 0;this._encrypt&&(P=this._encrypt._createCipherTransform(m.objectNumber,m.generationNumber)),this._writeObject(w,r,m,P,!0),this._writeString("startxref"+this._newLine+b+this._newLine+"%%EOF"+this._newLine,r)}else{var A="";this._cacheMap.forEach(function(t,s){var a;if(t instanceof xr?a=t:t instanceof Nr&&(a=t.dictionary),a&&a._updated&&(!a.isCatalog||e._allowCatalog)){for(var o=(i+r.length).toString();o.length<10;)o="0"+o;for(var h=s.generationNumber.toString();h.length<5;)h="0"+h;A+=s.objectNumber+" 1"+e._newLine+o+" "+h+" n"+e._newLine,n++,e._writeObject(t,r,s)}});b=r.length+i;this._writeString("xref"+this._newLine+"0 1"+this._newLine+"0000000000 65535 f"+this._newLine,r),n>0&&this._writeString(A,r),this._writeString("trailer"+this._newLine,r);var k=new xr(this);this._copyTrailer(k),this._writeDictionary(k,r,this._newLine),this._writeString("startxref"+this._newLine+b+this._newLine+"%%EOF"+this._newLine,r)}var x=new Uint8Array(this._stream.length+r.length);return x.set(this._stream.bytes),x.set(r,this._stream.length),x},i.prototype._copyTrailer=function(t){t.set("Size",this._nextReferenceNumber),t.set("Prev",this._prevXRefOffset);var e=this._trailer.getRaw("Root");void 0!==e&&null!==e&&t.set("Root",e);var i=this._trailer.getRaw("Info");void 0!==i&&null!==i&&t.set("Info",i);var r=this._trailer.getRaw("Encrypt");void 0!==r&&null!==r&&t.set("Encrypt",r)},i.prototype._computeMessageDigest=function(t){var e=this,i=[Math.floor(Date.now()/1e3).toString(),"",t.toString()],r=this._trailer.getRaw("Info"),n=new xr;r&&r instanceof xr&&r.forEach(function(t,e){e&&"string"==typeof e&&n.set(t,l(e))}),n.forEach(function(t,e){i.push(e)});var s=[];return i.forEach(function(t){e._writeString(t,s)}),b((new rn).hash(new Uint8Array(s)))},i.prototype._getNextReference=function(){var t=new wr(this._nextReferenceNumber++,0);return t._isNew=!0,t},i.prototype._writeObject=function(t,e,i,r,n){i&&i instanceof wr&&this._writeString(i.objectNumber+" "+i.generationNumber+" obj"+this._newLine,e),t instanceof xr?this._writeDictionary(t,e,this._newLine,r,n):t instanceof Nr&&this._writeStream(t,e,r,n),i&&i instanceof wr&&this._writeString("endobj"+this._newLine,e)},i.prototype._writeDictionary=function(t,e,i,r,n){var s=this;t._currentObj&&t._currentObj._beginSave(),t._isFont&&this._writeFontDictionary(t),this._writeString("<<"+i,e),t.forEach(function(t,a){s._writeString("/"+K(t)+" ",e),s._writeValue(a,e,r,n),s._writeString(i,e)}),this._writeString(">>"+this._newLine,e)},i.prototype._writeFontDictionary=function(t){if(t.has("DescendantFonts")){var e=t.get("DescendantFonts"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("DescendantFonts",[i])}if(t.has("ToUnicode")){var e=t.get("ToUnicode"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("ToUnicode",i)}if(t.has("FontFile2")){var e=t.get("FontFile2"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("FontFile2",i)}if(t.has("FontDescriptor")){var e=t.get("FontDescriptor"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("FontDescriptor",i)}},i.prototype._writeStream=function(t,i,r,n){var s=[],a=t.getString();if(!n){for(var o=[],h=0;h<a.length;h++)o.push(a.charCodeAt(h));if(t._isCompress){var c=new Uint8Array(o),_=new e.CompressedStreamWriter;_.write(c,0,c.length),_.close(),a=_.getCompressedString,t.dictionary.update("Filter",vr.get("FlateDecode"))}r&&(a=r.encryptString(a))}this._writeString(a,s),t.dictionary.update("Length",s.length),this._writeDictionary(t.dictionary,i,this._newLine,r,n),this._writeString("stream"+this._newLine,i),this._writeBytes(s,i),this._writeString(this._newLine+"endstream"+this._newLine,i)},i.prototype._writeValue=function(t,e,i,r){if(t instanceof vr)this._writeString("/"+t.name,e);else if(t instanceof wr)this._writeString(t.toString()+" R",e);else if(Array.isArray(t)){this._writeString("[",e);for(var n=!0,s=0,a=t;s<a.length;s++){var o=a[s];n?n=!1:this._writeString(" ",e),this._writeValue(o,e,i,r)}this._writeString("]",e)}else"string"==typeof t?(!r&&i&&(t=i.encryptString(t)),this._writeString("("+this._escapeString(t)+")",e)):"number"==typeof t?this._writeString(y(t),e):"boolean"==typeof t?this._writeString(t.toString(),e):t instanceof xr?this._writeDictionary(t,e,this._newLine,i,r):t instanceof Nr?this._writeStream(t,e,i,r):null===t&&this._writeString("null",e)},i.prototype._writeString=function(t,e){for(var i=0;i<t.length;i++)e.push(255&t.charCodeAt(i))},i.prototype._writeBytes=function(t,e){for(var i=0;i<t.length;i++)e.push(t[i])},i.prototype._writeLong=function(t,e,i){for(var r=e-1;r>=0;--r)i.push(t>>(r<<3)&255)},i.prototype._escapeString=function(t){return t.replace(/([()\\\n\r])/g,function(t){return"\n"===t?"\\n":"\r"===t?"\\r":"\\"+t})},i.prototype._destroy=function(){this._entries=void 0,this._pendingRefs.clear(),this._pendingRefs=void 0,this._cacheMap.clear(),this._pendingRefs=void 0,this._root=void 0,this._startXRefQueue=[],this._startXRefQueue=void 0,this._stream=void 0,this._streamState=void 0,this._tableState=void 0,this._topDictionary=void 0,this._trailer=void 0,this._version=void 0,this._crossReferencePosition=void 0},i}(),mn=function(){function t(){}return t}(),bn=function(){function t(){}return t}(),vn=function(){function t(){}return t}(),Sn=function(){function e(e,i){this._hasKids=!1,this._setAppearance=!1,this._exportEmptyFields=!1,this._fieldCollection=[],this._signFlag=t._SignatureFlag.none,this._dictionary=e,this._crossReference=i,this._parsedFields=new Map,this._fields=[],this._createFields()}return Object.defineProperty(e.prototype,"count",{get:function(){return this._fields.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needAppearances",{get:function(){return this._dictionary.has("NeedAppearances")&&(this._needAppearances=this._dictionary.get("NeedAppearances")),this._needAppearances},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportEmptyFields",{get:function(){return this._exportEmptyFields},set:function(t){this._exportEmptyFields=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_signatureFlag",{get:function(){return this._signFlag},set:function(t){t!==this._signFlag&&(this._signFlag=t,this._dictionary.update("SigFlags",t))},enumerable:!0,configurable:!0}),e.prototype.fieldAt=function(e){if(e<0||e>=this._fields.length)throw Error("Index out of range.");var i;if(this._parsedFields.has(e))i=this._parsedFields.get(e);else{var r=void 0,n=this._fields[e];if(n&&n instanceof wr&&(r=this._crossReference._fetch(n)),r){var s=T(r,"FT",!1,!0),a=0,o=T(r,"Ff",!1,!0);if(void 0!==o&&(a=o),s)switch(s.name.toLowerCase()){case"tx":i=ri._load(this,r,this._crossReference,n);break;case"btn":i=0!=(a&t._FieldFlag.pushButton)?ni._load(this,r,this._crossReference,n):0!=(a&t._FieldFlag.radio)?ai._load(this,r,this._crossReference,n):si._load(this,r,this._crossReference,n);break;case"ch":i=0!=(a&t._FieldFlag.combo)?hi._load(this,r,this._crossReference,n):ci._load(this,r,this._crossReference,n);break;case"sig":i=_i._load(this,r,this._crossReference,n)}this._parsedFields.set(e,i),i&&i instanceof ii&&(i._annotationIndex=e)}}return i},e.prototype.add=function(e){if(this._fields.push(e._ref),this._dictionary.update("Fields",this._fields),this._parsedFields.set(this._fields.length-1,e),e._form=this,this._crossReference._allowCatalog=!0,this._crossReference._root._updated=!0,e._kidsCount>0)for(var i=0;i<e._kidsCount;i++){var r=e.itemAt(i);(n=r._page).annotations._annotations.push(r._ref),n._pageDictionary.set("Annots",n.annotations._annotations),n._pageDictionary._updated=!0}else if(e._dictionary.has("Subtype")&&"Widget"===e._dictionary.get("Subtype").name){var n=e._page;n.annotations._annotations.push(e._ref),e._page._pageDictionary.set("Annots",e.page.annotations._annotations),e._page._pageDictionary._updated=!0}return e instanceof _i&&(e._form._signatureFlag=t._SignatureFlag.signatureExists|t._SignatureFlag.appendOnly),this._fields.length-1},e.prototype.removeField=function(t){var e=this._fields.indexOf(t._ref);e>=0&&this.removeFieldAt(e)},e.prototype.removeFieldAt=function(t){var e=this.fieldAt(t);if(e){if(e._kidsCount>0)for(var i=e._kidsCount-1;i>=0;i--){var r=e.itemAt(i);(n=r._getPage())&&n._removeAnnotation(r._ref)}else if(e._dictionary.has("Subtype")&&"Widget"===e._dictionary.get("Subtype").name){var n=e.page;n&&n._removeAnnotation(e._ref)}this._parsedFields.delete(t)}this._fields.splice(t,1),this._dictionary.set("Fields",this._fields),this._dictionary._updated=!0},e.prototype.setDefaultAppearance=function(t){this._setAppearance=!t,this._needAppearances=t,this._dictionary.update("NeedAppearances",t)},e.prototype.orderFormFields=function(e){var i=this;if(null===e||void 0===e)this.orderFormFields(new Map);else{var r=void 0,n=this._crossReference._document,s=void 0;if(e&&e instanceof Map){var a=!0;e.size>0?this._tabCollection=e:(a=!1,this._tabCollection=e);var o=new Map;if(this._fieldCollection=this._getFields(),this._fieldCollection&&this._fieldCollection.length>0&&this._fieldCollection[0].page&&n){for(l=0;l<this._fieldCollection.length;l++){var h=this._fieldCollection[Number.parseInt(l.toString(),10)];if(h.page){var c=_(n,this._sortItemByPageIndex(h,!0)._pageDictionary);if(c>=0){o.has(c)?(s=o.get(c)).push(h):((s=[]).push(h),o.set(c,s));var d=n.getPage(c);this._tabCollection.has(c)||this._tabCollection.set(c,d.tabOrder),a&&(d.tabOrder=this._tabCollection.get(c))}}}var p=0;o.forEach(function(e,r){if(i._tabOrder=i._tabCollection.get(r),i._tabOrder!==t.PdfFormFieldsTabOrder.structure){var n=e;n.sort(function(t,e){return i._compareFields(t,e)});for(var s=0;s<n.length;s++){var a=i._fieldCollection.indexOf(n[Number.parseInt(s.toString(),10)]);if(-1!==a&&a!==p+s){var o=i._fieldCollection[Number.parseInt(a.toString(),10)];i._fieldCollection.splice(a,1),i._fieldCollection.splice(p+s,0,o)}}}p+=e.length})}}else this._tabOrder=e,r=this._getOrder(this._tabOrder),this._fieldCollection=this._getFields(),this._fieldCollection.sort(function(t,e){return i._compareFields(t,e)});this._parsedFields.clear();for(var l=0;l<this._fieldCollection.length;l++)this._parsedFields.set(Number.parseInt(l.toString(),10),this._fieldCollection[Number.parseInt(l.toString(),10)]),this._fields[Number.parseInt(l.toString(),10)]=this._fieldCollection[Number.parseInt(l.toString(),10)]._ref,r&&this._fieldCollection[Number.parseInt(l.toString(),10)].page._pageDictionary.update("Tabs",r);this._dictionary.update("Fields",this._fields)}},e.prototype._createFields=function(){var t;this._dictionary.has("Fields")&&(t=this._dictionary.get("Fields"));for(var e=0,i=[];void 0!==t&&null!==t;){for(;e<t.length;e++){var r=t[e],n=void 0;r&&r instanceof wr&&(n=this._crossReference._fetch(r));var s=void 0;if(n&&n.has("Kids")&&void 0!==(s=n.get("Kids"))&&s.length>0)for(var a=0;a<s.length;a++){var o=s[Number.parseInt(a.toString(),10)];if(o&&o instanceof wr){var h=this._crossReference._fetch(o);void 0===h||h.has("Parent")||h.update("Parent",r)}}void 0===s?void 0!==n&&-1===this._fields.indexOf(r)&&this._fields.push(r):!n.has("FT")||this._isNode(s)?(i.push({fields:t,count:e}),this._hasKids=!0,e=-1,t=s):this._fields.push(r)}if(0===i.length)break;var c=i.pop();t=c.fields,e=c.count+1}},e.prototype._isNode=function(t){var e=!1;if(void 0!==t&&t.length>0){var i=t[0],r=void 0;if(void 0!==i&&null!==i&&(i instanceof xr?r=i:i instanceof wr&&(r=this._crossReference._fetch(i))),void 0!==r&&r.has("Subtype")){var n=r.get("Subtype");n&&"Widget"!==n.name&&(e=!0)}}return e},e.prototype._parseWidgetReferences=function(){var t=this;return void 0===this._widgetReferences&&this.count>0&&(this._widgetReferences=[],this._fields.forEach(function(e){var i=t._crossReference._fetch(e);if(i)if(i.has("Kids")){var r=i.get("Kids");r&&r.length>0&&r.forEach(function(e){var i;if(e instanceof xr?i=e:e instanceof wr&&(i=t._crossReference._fetch(e)),void 0!==i&&i.has("Subtype")){var r=i.get("Subtype");r&&"Widget"===r.name&&t._widgetReferences.push(e)}})}else t._widgetReferences.push(e)})),this._widgetReferences},e.prototype._doPostProcess=function(t){for(var e=this.count-1;e>=0;e--){var i=this.fieldAt(e);i&&(i._doPostProcess(t||i.flatten),!t&&i.flatten&&this.removeFieldAt(e))}},e.prototype._getFieldIndex=function(t){var e=-1;if(this.count>0){this._fieldNames||(this._fieldNames=[]),this._indexedFieldNames||(this._indexedFieldNames=[]),this._actualFieldNames||(this._actualFieldNames=[]),this._indexedActualFieldNames||(this._indexedActualFieldNames=[]);for(var i=0;i<this.count;i++){var r=this.fieldAt(i);if(r){var n=r.name;n&&(this._fieldNames.push(n),this._indexedFieldNames.push(n.split("[")[0]));var s=r.actualName;s&&(this._actualFieldNames.push(s),this._indexedActualFieldNames.push(s.split("[")[0]))}}var a=this._fieldNames.indexOf(t);-1!==a?e=a:-1!==(a=this._indexedFieldNames.indexOf(t))?e=a:-1!==(a=this._actualFieldNames.indexOf(t))?e=a:-1!==(a=this._indexedActualFieldNames.indexOf(t))&&(e=a)}return e},e.prototype._getFields=function(){for(var t=[],e=0;e<this._fields.length;e++){var i=this.fieldAt(e);i&&i instanceof ii&&t.push(i)}return t},e.prototype._getOrder=function(e){if(e!==t.PdfFormFieldsTabOrder.none){var i="";return e===t.PdfFormFieldsTabOrder.row?i="R":e===t.PdfFormFieldsTabOrder.column?i="C":e===t.PdfFormFieldsTabOrder.structure&&(i="S"),vr.get(i)}return null},e.prototype._compareFields=function(e,i){var r,n,s=0,a=e.page,o=i.page;if(a&&!a._isNew&&a instanceof Zi&&o&&!o._isNew&&o instanceof Zi){var h=this._sortItemByPageIndex(e,!1)._pageIndex,c=this._sortItemByPageIndex(i,!1)._pageIndex,_=void 0;_=e._dictionary.has("Kids")?this._getItemRectangle(e):this._getRectangle(e._dictionary);var d=void 0;d=i._dictionary.has("Kids")?this._getItemRectangle(i):this._getRectangle(i._dictionary);var p=_[3]-_[1],l=d[3]-d[1];if(_&&_.length>=2&&d&&d.length>=2){var u=_[0],f=_[1],g=d[0],y=d[1];if("number"==typeof u&&"number"==typeof g&&"number"==typeof f&&"number"==typeof y)if(n=h-c,this._tabOrder===t.PdfFormFieldsTabOrder.row){if(0!==(r=this._compare(y,f))){var m=-1===r&&f>y&&f-p/2<y;(m=m||1===r&&y>f&&y-l/2<f)&&(r=0)}s=0!==n?n:0!==r?r:this._compare(u,g)}else if(this._tabOrder===t.PdfFormFieldsTabOrder.column)r=this._compare(u,g),s=0!==n?n:0!==r?r:this._compare(y,f);else if((this._tabOrder===t.PdfFormFieldsTabOrder.manual||this._tabOrder===t.PdfFormFieldsTabOrder.none||this._tabOrder===t.PdfFormFieldsTabOrder.structure)&&e instanceof ii&&i instanceof ii){var b=e.tabIndex,v=i.tabIndex;r=this._compare(b,v),s=0!==n?n:r}}}return s},e.prototype._getRectangle=function(t){var e;return t.has("Rect")&&(e=t.getArray("Rect")),e},e.prototype._getItemRectangle=function(t){var e,i=t._dictionary;if(i.has("Kids")){var r=i.getArray("Kids");r&&r.length>=1&&(e=1===r.length?this._getRectangle(r[0]):t&&t.itemsCount>1?this._getRectangle(t.itemAt(0)._dictionary):this._getRectangle(r[0]))}return e},e.prototype._compare=function(t,e){return t>e?1:t<e?-1:0},e.prototype._compareKidsElement=function(e,i){var r,n=this._crossReference._fetch(e),s=this._crossReference._fetch(i),a=this._getRectangle(n),o=this._getRectangle(s);if(a&&a.length>=2&&o&&o.length>=2){var h=a[0],c=a[1],_=o[0],d=o[1];if("number"==typeof h&&"number"==typeof _&&"number"==typeof c&&"number"==typeof d){var p=void 0;return r=this._tabOrder===t.PdfFormFieldsTabOrder.row?0!==(p=this._compare(d,c))?p:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column?0!==(p=this._compare(h,_))?p:this._compare(d,c):0}}return r},e.prototype._sortItemByPageIndex=function(t,e){var i=t.page,r=this._tabOrder;return this._tabOrder=e?t.page.tabOrder:r,this._sortFieldItems(t),t._isLoaded&&t._kidsCount>1&&(i=t.itemAt(0).page),this._tabOrder=r,void 0===i&&(i=t.page),i},e.prototype._sortFieldItems=function(t){var e=this;if(t._isLoaded&&(t instanceof ri||t instanceof ci||t instanceof si||t instanceof ai)){var i=t._parseItems();i.sort(function(t,i){return e._compareFieldItem(t,i)}),t._parsedItems.clear();for(var r=0;r<i.length;r++)t._parsedItems.set(r,i[Number.parseInt(r.toString(),10)])}},e.prototype._compareFieldItem=function(e,i){var r=0;if(void 0!==e&&void 0!==i){var n=e.page,s=i.page,a=this._getRectangle(e._dictionary),o=this._getRectangle(i._dictionary);if(a&&o){var h=a[0],c=a[1],_=o[0],d=o[1],p=void 0;this._tabOrder===t.PdfFormFieldsTabOrder.row?r=0!==(p=this._compare(n._pageIndex,s._pageIndex))?p:0!==(p=this._compare(d,c))?p:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column&&(r=0!==(p=this._compare(n._pageIndex,s._pageIndex))?p:0!==(p=this._compare(h,_))?p:this._compare(d,c))}}return r},e.prototype._clear=function(){this._fields=[],this._parsedFields=new Map},e}(),wn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Pn=function(t){function i(e){var i=t.call(this)||this;return i._annotationObjects=new Map,i._specialCharacters="âãÏÓ",null!==e&&void 0!==e&&(i._fileName=e),i}return wn(i,t),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},i.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=G(),this._save()},i.prototype._save=function(){var t=this,e=0,i=[];if(!this._isAnnotationExport){this._asPerSpecification?(this.fdfString+="%FDF-1.2\n%"+this._specialCharacters+"\r\n1 0 obj\r<</FDF<</F(",this.fdfString+=this._fileName+")",this.fdfString+="/Fields["):this.fdfString+="%FDF-1.2\n";var r=this._document.form;if(null!==r&&void 0!==r){this._exportEmptyFields=r.exportEmptyFields;for(var n=this._document.form.count,s=0;s<n;s++){var a=this._document.form.fieldAt(s),o=this._exportFormFieldsData(a);if((a instanceof ri||a instanceof ci||a instanceof hi||a instanceof ai||a instanceof si)&&e++,this._asPerSpecification)if(a instanceof ri||a instanceof ci||a instanceof hi){if(i.push(e),this.fdfString+="<</T("+a.name+")/V","string"==typeof o||Array.isArray(o)&&1===o.length)this.fdfString+="("+(Array.isArray(o)?o[0]:o)+")";else if(Array.isArray(o)){this.fdfString+="[";for(h=0;h<o.length;h++)this.fdfString+="("+o[Number.parseInt(h.toString(),10)]+")",h!==o.length-1&&(this.fdfString+=" ");this.fdfString+="]"}this.fdfString+=">>"}else(a instanceof ai||a instanceof si)&&(i.push(e),this.fdfString+="<</T("+a.name+")/V/"+o+">>");else if(a instanceof ri||a instanceof ci||a instanceof hi){if(i.push(e),this.fdfString+=e+" 0 obj<</T <"+this._stringToHexString(a.name)+"> /V ","string"==typeof o||Array.isArray(o)&&1===o.length)this.fdfString+="<"+this._stringToHexString(Array.isArray(o)?o[0]:o)+">";else if(Array.isArray(o)){this.fdfString+="[";for(var h=0;h<o.length;h++)this.fdfString+="<"+this._stringToHexString(o[Number.parseInt(h.toString(),10)])+">",h!==o.length-1&&(this.fdfString+=" ");this.fdfString+="]"}this.fdfString+=" >>endobj\n"}else(a instanceof ai||a instanceof si)&&(i.push(e),this.fdfString+=e+" 0 obj<</T <"+this._stringToHexString(a.name)+"> /V /",this.fdfString+=o+" >>endobj\n")}}if(this._asPerSpecification)this.fdfString+="]",this.fdfString+="/ID[]/UF("+this._fileName+")>>/Type/Catalog>>\rendobj\rtrailer\r\n<</Root 1 0 R>>\r\n",this.fdfString+="%%EOF\r\n";else{this.fdfString+=this._table.size+1+" 0 obj<</F <"+this._stringToHexString(this._fileName)+"> /Fields [";for(s=0;s<this._table.size;s++)null!==(a=this._document.form.fieldAt(s))&&void 0!==a&&a.export&&(this.fdfString+=i[Number.parseInt(s.toString(),10)]+" 0 R ");this.fdfString+="]>>endobj\n",this.fdfString+=i.length+2+" 0 obj<</Version /1.4 /FDF "+(i.length+1)+" 0 R>>endobj\n",this.fdfString+="trailer\n<</Root "+(i.length+2)+" 0 R>>"}}var c=new ArrayBuffer(1*this.fdfString.length),_=new Uint8Array(c);return _.forEach(function(e,i){_[i]=t.fdfString.charCodeAt(i)}),_},i.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(b(e));var i=new Cr(e);this._isAnnotationImport=!0;var r=new Zr(new Yr(i),null,!0,!1);this._readFdfData(r),null!==this._annotationObjects&&void 0!==this._annotationObjects&&this._annotationObjects.size>0&&this._annotationObjects.clear(),null!==this._table&&void 0!==this._table&&this._table.size>0&&this._table.clear()},i.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(b(e));var i=new Cr(e),r=new Zr(new Yr(i),null,!1,!1);this._readFdfData(r)},i.prototype._readFdfData=function(t){var e=this,i=t.getObject();if(this._isAnnotationImport){for(var r="";null!==i&&void 0!==i&&"EOF"!==i;)i instanceof xr?(this._table.set(r,i),r=""):i instanceof Cr||i instanceof Kr?(this._table.set(r,i),r=""):null!==i&&Number.isInteger(i)&&0!==i?t.first>=0&&(r=i.toString()+" "+t.first.toString()):i instanceof Sr&&null!==i.command&&void 0!==i.command&&"trailer"===i.command&&(r=i.command),i=t.getObject();this._annotationObjects=this._parseAnnotationData(),this._annotationObjects.forEach(function(t,i){var r=t;if(r._crossReference=e._crossReference,r._updated=!0,null!==r&&void 0!==r&&r.has("Page")){var n=r.get("Page");if(null!==n&&void 0!==n){var s=n;if(s<e._document.pageCount){var a=e._document.getPage(s),o=a._pageDictionary;if(null!==o&&void 0!==o){var h=a.annotations,c=h._parseAnnotation(r);if(null!==c&&void 0!==c){c._isImported=!0;var _=e._crossReference._getNextReference();e._crossReference._cacheMap.set(_,r),(r.has("NM")||r.has("IRT"))&&e._addReferenceToGroup(_,r),c._ref=_;var d=h._annotations.length;h._annotations.push(_),o.set("Annots",h._annotations),o._updated=!0,h._parsedAnnotations.set(d,c),e._handlePopup(h,_,r,o)}}}}}})}else{if(i=t.getObject(),this._asPerSpecification)for(;null!==i&&void 0!==i&&"EOF"!==i;){if(i instanceof xr&&null!==i&&null!==i._map.FDF&&void 0!==i._map.FDF&&(i=i._map.FDF)instanceof xr&&null!==i._map.Fields&&void 0!==i._map.Fields&&null!==(i=i._map.Fields)&&void 0!==i)for(var n=0;n<i.length;n++){var s=i[Number.parseInt(n.toString(),10)];if(s instanceof xr&&null!==s&&void 0!==s){var a=s.getArray("T"),o=void 0;o=s._map.V instanceof vr?s.getArray("V").name:s.getArray("V"),null!==a&&void 0!==a&&a.length>0&&this._table.set(a,o)}}i=t.getObject()}else for((i=t.getObject())instanceof Sr&&null!==i.command&&(i=i.command);null!==i&&void 0!==i&&"EOF"!==i;){if(i instanceof xr){var a=i.getArray("T"),o=void 0;o=i._map.V instanceof vr?i.getArray("V").name:i.getArray("V"),null!==a&&void 0!==a&&a.length>0&&this._table.set(a,o)}i=t.getObject()}this._importField()}},i.prototype._parseAnnotationData=function(){var t=new Map,e=new Map;if(null!==(t=this._table)&&void 0!==t&&t.size>0&&t.has("trailer")){var i=t.get("trailer");if(i instanceof xr&&null!==i&&void 0!==i&&i.has("Root")){var r=i.getRaw("Root");if(null!==r&&void 0!==r){var n=r.objectNumber.toString()+" "+r.generationNumber.toString();if(t.has(n)){var s=t.get(n);if(null!==s&&void 0!==s&&s.has("FDF")){var a=s.get("FDF");if(null!==a&&void 0!==a&&a.has("Annots")){var o=a.get("Annots");if(null!==o&&void 0!==o&&o.length>0)for(var h=0;h<o.length;h++){var c=o[Number.parseInt(h.toString(),10)],_=c.objectNumber.toString()+" "+c.generationNumber.toString();t.has(_)&&(c=t.get(_),e.set(_,c),t.delete(_))}}}}t.delete(n)}}t.delete("trailer")}return e},i.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._table.forEach(function(r,n){var s;t._table.size>0&&t._table.has(n)&&(s=t._table.get(n));var a=e._getFieldIndex(n);if(-1!==a&&a<i){var o=e.fieldAt(a);if(o){s&&""!==s&&o._dictionary.update("RV",s);var h=[];Array.isArray(r)?h=r:h.push(r),t._importFieldData(o,h)}}})},i.prototype._exportAnnotationData=function(t,e){var i=Qt._whiteSpace+"0"+Qt._whiteSpace;this.fdfString+="%FDF-1.2\r\n";for(var r=2,n=new Array,s=this.exportAppearance,a=0;a<e;a++){var o=t.getPage(a);if(null!==o&&void 0!==o&&o.annotations.count>0)for(var h=0;h<o.annotations.count;h++){var c=o.annotations.at(h);if(null!==c&&void 0!==c&&!(c instanceof xi||c instanceof Ni||c instanceof Ii||c instanceof Ti))if(c instanceof Li||c instanceof vi)r=(_=this._exportAnnotation(c,this.fdfString,r,n,a,!0)).index,n=_.annot;else{var _=this._exportAnnotation(c,this.fdfString,r,n,a,s);r=_.index,n=_.annot}}}if(2!==r){var d="1"+i;this.fdfString+=d+"obj\r\n<</FDF<</Annots[";for(a=0;a<n.length-1;a++)this.fdfString+=n[Number.parseInt(a.toString(),10)]+i+"R ";this.fdfString+=n[n.length-1]+i+"R]/F("+this._fileName+")/UF(",this.fdfString+=this._fileName+")>>/Type/Catalog>>\r\nendobj\r\n",this.fdfString+="trailer\r\n<</Root "+d+"R>>\r\n%%EOF\r\n"}},i.prototype._exportAnnotation=function(t,e,i,r,n,s){this.fdfString=e;var a=new An,o=t._dictionary,h=Qt._whiteSpace+"0"+Qt._whiteSpace+"obj\r\n";this._annotationID=i.toString(),this.fdfString+=i+h+"<<";var c=new Map,_=new Array;r.push(this._annotationID),o.set("Page",n);var d=this._getEntries(c,_,i,o,this.fdfString,s);i=d.index,c=d.list,_=d.streamReference,delete o._map.Page,this.fdfString+=">>\r\nendobj\r\n";for(var p=this;c.size>0;)!function(){var t=Array();c.forEach(function(e,i){t.push(i)});for(var e=0;e<t.length;e++){var a=t[Number.parseInt(e.toString(),10)];if((c.get(a)instanceof xr||c.get(a)instanceof Cr||c.get(a)instanceof Kr)&&null!==(o=c.get(a)instanceof xr?c.get(a):c.get(a).dictionary)&&void 0!==o){if(o instanceof xr&&o.has("Type")){var d=o.get("Type");null!==d&&void 0!==d&&"Annot"===d.name&&(r.push(a.toString()),o.set("Page",n))}p.fdfString+=a+h+"<<";var l=p._getEntries(c,_,i,o,p.fdfString,s);c=l.list,_=l.streamReference,i=l.index,o instanceof xr&&o.has("Page")&&delete o._map.Page,p.fdfString+=">>",null!==_&&void 0!==_&&-1!==_.indexOf(a)&&p._appendStream(c.get(a),p.fdfString),p.fdfString+="\r\nendobj\r\n"}c.delete(a)}}();return i++,a.index=i,a.annot=r,a},i.prototype._appendStream=function(t,i){var r=t;if(this.fdfString=i,(t instanceof Kr||t instanceof Cr)&&(r=t instanceof Kr?t.stream:t),t instanceof Kr||t instanceof Cr){var n=r.getBytes(),s=new Uint8Array(n),a=new e.CompressedStreamWriter;a.write(s,0,s.length),a.close();var o=a.getCompressedString;this.fdfString+="stream\r\n",this.fdfString+=o,this.fdfString+="\r\nendstream"}},i.prototype._getEntries=function(t,e,i,r,n,s){var a=this,o=!1,h=new An;this.fdfString=n;var c=t;return r.forEach(function(t,n){if(s||"AP"!==t){"P"!==t&&(a.fdfString+="/"+t),("Sound"===t||"F"===t||s)&&(o=!0);var h=n;if("string"==typeof h)a.fdfString+="("+a._getFormattedString(h)+")";else if(h instanceof vr)a.fdfString+="/"+h.name;else if(h instanceof Array){h=h;var _=a._appendArray(h,a.fdfString,i,o,c,e);c=_.list,e=_.streamReference,i=_.index}else if("number"==typeof h)a.fdfString+=" "+h.toString();else if("boolean"==typeof h)a.fdfString+=" "+(h?"true":"false");else if(h instanceof xr){a.fdfString+="<<",h=h;var d=a._getEntries(c,e,i,h,a.fdfString,s);c=d.list,e=d.streamReference,i=d.index,a.fdfString+=">>"}else if(h instanceof wr){var p=r.get("Page");if("Parent"===t)a.fdfString+=" "+a._annotationID+" 0 R",a.fdfString+="/Page "+p;else if("IRT"===t){if(r.has("NM")){var l=r.get("NM");null!==l&&(a.fdfString+="("+a._getFormattedString(l)+")")}}else if("P"!==t){var u=h;null!==u&&void 0!==u&&(i++,a.fdfString+=" "+i+" 0 R",o&&e.push(i),c.set(i,r.get(t)))}}o=!1}}),h.list=c,h.streamReference=e,h.index=i,h},i.prototype._appendArray=function(t,e,i,r,n,s){this.fdfString=e,this.fdfString+="[";var a=new An,o=n;if(null!==t&&t.length>0)for(var h=t.length,c=0;c<h;c++){var _=t[Number.parseInt(c.toString(),10)];0!==c&&("number"==typeof _||_ instanceof wr||"boolean"==typeof _)&&(this.fdfString+=" ");var d=this._appendElement(_,this.fdfString,i,r,o,s);o=d.list,s=d.streamReference,i=d.index}return this.fdfString+="]",a.list=o,a.streamReference=s,a.index=i,a},i.prototype._appendElement=function(t,e,i,r,n,s){this.fdfString=e;var a=new An,o=n;if("number"==typeof t)this.fdfString+=t.toString();else if(t instanceof vr)this.fdfString+=t.name.toString();else if(t instanceof Array)t=t,o=(h=this._appendArray(t,this.fdfString,i,r,o,s)).list,s=h.streamReference,i=h.index;else if(t instanceof xr){this.fdfString+="<<",t=t;var h=this._getEntries(o,s,i,t,this.fdfString,r);o=h.list,s=h.streamReference,i=h.index,this.fdfString+=">>"}return a.list=o,a.streamReference=s,a.index=i,a},i.prototype._getFormattedString=function(t){for(var e="",i=0;i<t.length;i++){var r=t.charCodeAt(i);40!==r&&41!==r||(e+="'"),e+=String.fromCharCode(r)}return e},i.prototype._checkFdf=function(t){if((t.includes(this._specialCharacters)||t.includes("âãÏÓ"))&&(this._asPerSpecification=!0),t.startsWith("%")&&"FDF-"!==t.substring(1,5))throw new Error("Invalid FDF file.")},i.prototype._stringToHexString=function(t){var e="";return null!==t&&void 0!==t&&t.length>0&&(e=S(u(t))),e},i}(Ke),An=function(){function t(){}return t}(),kn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),xn=function(){function t(t,e){this._bookMarkList=[],this._isExpanded=!1,this._isLoadedBookmark=!1,this._dictionary=t,this._crossReference=e}return Object.defineProperty(t.prototype,"count",{get:function(){return this._isLoadedBookmark&&0===this._bookMarkList.length&&this._reproduceTree(),this._bookMarkList.length},enumerable:!0,configurable:!0}),t.prototype.at=function(t){var e;if(t<0||t>=this.count)throw Error("Index out of range.");return this._bookMarkList.length>0&&t<this._bookMarkList.length&&(e=this._bookMarkList[Number.parseInt(t.toString(),10)]),e},t.prototype.contains=function(t){return-1!==this._bookMarkList.indexOf(t)},t.prototype._reproduceTree=function(){for(var t=this._getFirstBookmark(this),e=!!t;e&&t._dictionary;)this._bookMarkList.push(t),e=!!(t=t._next)},t.prototype._getFirstBookmark=function(t){var e,i=t._dictionary;if(i&&i.has("First")){var r=i.get("First");r&&(e=new Tn(r,this._crossReference))}return e},t}(),Tn=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(!r._dictionary.has("Dest")&&r._dictionary.has("A")){var n=r._dictionary.get("A");if(n&&n.has("D")){var s=n.getRaw("D");r._dictionary.update("Dest",s)}}return r._isLoadedBookmark=!0,r}return kn(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){var t,e=this._obtainNamedDestination();return null!==e&&void 0!==e||(t=Rt(this._dictionary,"Dest")),t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"namedDestination",{get:function(){return null!==this._namedDestination&&void 0!==this._namedDestination||(this._namedDestination=this._obtainNamedDestination()),this._namedDestination},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"title",{get:function(){return null!==this._title&&void 0!==this._title||(this._title=this._obtainTitle()),this._title},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return null!==this._color&&void 0!==this._color||this._dictionary.has("C")&&(this._color=L(this._dictionary.getArray("C"))),this._color?this._color:[0,0,0]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textStyle",{get:function(){return null!==this._textStyle&&void 0!==this._textStyle||(this._textStyle=this._obtainTextStyle()),this._textStyle},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isExpanded",{get:function(){return!!(this._dictionary.has("Count")&&this._dictionary.get("Count")>=0)||this._isExpanded},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_next",{get:function(){var t;if(this._dictionary.has("Next")){var e=this._dictionary.get("Next");e&&(t=new i(e,this._crossReference))}return t},enumerable:!0,configurable:!0}),i.prototype._obtainTextStyle=function(){var e=t.PdfTextStyle.regular;if(this._dictionary.has("F")){var i=this._dictionary.get("F"),r=0;void 0!==i&&null!==i&&(r=i),e|=r}return e},i.prototype._obtainTitle=function(){var t="";return this._dictionary.has("Title")&&(t=this._dictionary.get("Title")),t},i.prototype._obtainNamedDestination=function(){var t,e=this._crossReference._document;e&&(t=e._destinationCollection);var i,r;if(t){var n=this._dictionary;if(n.has("A")){var s=n.get("A");s.has("D")&&(i=s.get("D"))}else n.has("Dest")&&(i=n.get("Dest"));if(i){var a=void 0;if(i instanceof vr?a=i.name:"string"==typeof i&&(a=i),a)for(var o=t._namedDestinations,h=0;h<o.length;h++)if((r=o[Number.parseInt(h.toString(),10)])._title===a){i=r;break}}}return r},i}(xn),In=function(){function t(t,e){this._dictionary=t,this._crossReference=e}return Object.defineProperty(t.prototype,"destination",{get:function(){return this._destination},set:function(t){t&&(t._parent=this,this._destination=t,this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this._title},set:function(t){t!==this._title&&(this._title=t,this._dictionary.update("Title",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),t}(),Nn=function(){function e(t,e){if(this._namedDestinations=[],t&&(this._dictionary=t),e&&(this._crossReference=e),t&&t.has("Dests")){var i=t.get("Dests");if(i)if(i.has("Names"))this._addCollection(i);else if(i.has("Kids"))for(var r=i.getArray("Kids"),n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)];this._addCollection(s)}}}return e.prototype._addCollection=function(e){var i,r,n=e.getRaw("Names");if(n instanceof wr&&(i=this._crossReference._fetch(n)),i&&Array.isArray(i)&&i.length>0&&(n=i),n&&Array.isArray(n)&&n.length>0)for(var s=1;s<n.length;s+=2){var a=n[s];if(a instanceof wr?(p=this._crossReference._fetch(a))&&Array.isArray(p)&&p.length>0?(r=new xr).update("D",p):r=this._crossReference._fetch(a):null!==r&&void 0!==r||!Array.isArray(a)||(r=new xr).update("D",a),r){var o=new In(r,this._crossReference),h=n[s-1],d=void 0,p=void 0;if(h&&(o._title=h,r.has("D"))){p=r.get("D"),d=new $i;var l=p[0];if(p&&p[0]instanceof wr){var u=this._crossReference._fetch(l),f=this._crossReference._document,g=void 0;f&&u&&void 0!==(g=_(f,u))&&null!==g&&g>=0&&(d._index=g,d.page=f.getPage(g))}}if(p[1]instanceof vr){var y=void 0,m=void 0,b=void 0,v=p[1].name,S=d.page;switch(v){case"Fit":d._destinationMode=t.PdfDestinationMode.fitToPage;break;case"XYZ":if(d._destinationMode=t.PdfDestinationMode.location,p.length>2&&(y=p[2]),p.length>3&&(m=p[3]),p.length>4&&(b=p[4]),S){var w=S.size,P=null===m||void 0===m?0:w[1]-m,A=null===y||void 0===y?0:y;d._location=[A,P],S.rotation!==t.PdfRotationAngle.angle0&&(P=c(S,m,y)),d._zoom=void 0!==b&&null!==b?b:0,null!==y&&null!==m&&null!==b&&void 0!==y&&void 0!==m&&void 0!==b||(d._isValid=!1)}break;case"FitH":case"FitBH":if(d._destinationMode=t.PdfDestinationMode.fitH,p.length>=3&&(m=p[2]),S){var w=S.size,P=null===m||void 0===m?0:w[1]-m;d._location=[0,P]}null!==m&&void 0!==m||(d._isValid=!1);break;case"FitR":d._destinationMode=t.PdfDestinationMode.fitR}}d._parent=o,o._destination=d,this._namedDestinations.push(o)}}},e}(),Cn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Rn=function(t){function e(e){var i=t.call(this)||this;return null!==e&&void 0!==e&&(i._fileName=e),i}return Cn(e,t),e.prototype._exportAnnotations=function(){throw new Error("Method not implemented.")},e.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._format="XML",this._key=G(),this._save()},e.prototype._save=function(){var t=new ze;t._writeStartDocument(),this._asPerSpecification?(t._writeStartElement("fields"),t._writeAttributeString("xfdf","http://ns.adobe.com/xfdf-transition/","xmlns",null)):t._writeStartElement("Fields");var e=this._document.form;if(null!==e&&void 0!==e){this._exportEmptyFields=e.exportEmptyFields;for(var i=this._document.form.count,r=0;r<i;r++){var n=this._document.form.fieldAt(r);null!==n&&void 0!==n&&n.export&&this._exportFormFieldData(n)}this._writeFormFieldData(t,this._asPerSpecification)}var s=t._save();return t._destroy(),s},e.prototype._writeFormFieldData=function(t,e){void 0===e&&(e=!1),e?this._table.forEach(function(e,i){if(i.includes(" ")){var r=i.replace(/ /g,"");t._writeStartElement(r.toString()),t._writeAttributeString("original",i.toString(),"xfdf",null)}else t._writeStartElement(i.toString());t._writeString(e.toString()),t._writeEndElement()}):this._table.forEach(function(e,i){i.includes(" ")&&(i=i.replace(/ /g,"_x0020_")),t._writeStartElement(i.toString()),t._writeString(e.toString()),t._writeEndElement()}),t._writeEndElement()},e.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var i=b(e);i=(i=i.replace(/(\r\n|\n|\r)/gm,"")).replace(/[^\x20-\x7E]/g,""),this._xmlDocument=(new DOMParser).parseFromString(i,"text/xml"),this._checkXml(this._xmlDocument),this._xmlImport=!0,this._parseFormData(this._xmlDocument.documentElement),this._xmlImport=!1},e.prototype._parseFormData=function(t){var e=t.childNodes;if(null!==e&&void 0!==e&&e.length>0)for(var i=0;i<e.length;i++){var r=e.item(i);if(null!==r&&void 0!==r&&1===r.nodeType){var n=r,s="";if(null!==n.attributes&&void 0!==n.attributes&&n.attributes.length>0){var a=n.attributes.item(0);null!==a&&void 0!==a&&"xfdf:original"===a.name&&(s=a.value)}else s=n.tagName;var o=n.textContent;null!==s&&void 0!==s&&s.length>0&&this._table.set(s,o)}}this._importField()},e.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._table.forEach(function(r,n){var s;t._table.size>0&&t._table.has(n)&&(s=t._table.get(n));var a=n.toString();-1!==a.indexOf("_x0020_")&&(a=a.replace(/_x0020_/g," "));var o=e._getFieldIndex(a);if(-1!==o&&o<i){var h=e.fieldAt(o);if(h&&null!==h&&void 0!==h){s&&""!==s&&h._dictionary.update("RV",s);var c=[];c.push(r),t._importFieldData(h,c)}}})},e.prototype._checkXml=function(t){if(t.getElementsByTagName("parsererror").length>0)throw new Error("Invalid XML file.")},e}(Ke),Fn=function(){function t(){}return Object.defineProperty(t.prototype,"crossReferenceType",{get:function(){return this._crossReferenceType},set:function(t){this._crossReferenceType=t},enumerable:!0,configurable:!0}),t}(),Bn=function(){function e(e,i){if(this._headerSignature=new Uint8Array([37,80,68,70,45]),this._startXrefSignature=new Uint8Array([115,116,97,114,116,120,114,101,102]),this._endObjSignature=new Uint8Array([101,110,100,111,98,106]),this._version="",this._permissions=t.PdfPermissionFlag.default,this._isEncrypted=!1,this._isUserPassword=!1,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!1,this._isExport=!1,this._allowCustomData=!1,!e)throw new Error("PDF data cannot be undefined or null");this._stream=new Cr("string"==typeof e?k(e):e),this._fileStructure=new Fn,this._crossReference=new yn(this,i),this._pages=new Map,this._checkHeader(),this._crossReference._setStartXRef(this._startXRef);try{this._parse(!1)}catch(t){if("XRefParseException"!==t.name)throw t;this._parse(!0)}this._crossReference._version=this._version}return Object.defineProperty(e.prototype,"_allowImportCustomData",{get:function(){return this._allowCustomData},set:function(t){this._allowCustomData=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_linearization",{get:function(){if(!this._linear){var t=void 0;try{t=new $r(this._stream)}catch(t){}this._linear=t}return this._linear},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startXRef",{get:function(){var t=this._stream,e=0;if(this._linearization&&this._linearization.isValid)t.reset(),this._find(t,this._endObjSignature)&&(e=t.position+6-t.start);else{for(var i=this._startXrefSignature.length,r=!1,n=t.end;!r&&n>0;)(n-=1024-i)<0&&(n=0),t.position=n,r=this._find(t,this._startXrefSignature,1024,!0);if(r){t.skip(9);var s=void 0;do{s=t.getByte()}while(A(s));for(var a="";s>=32&&s<=57;)a+=String.fromCharCode(s),s=t.getByte();e=parseInt(a,10),isNaN(e)&&(e=0)}}return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEncrypted",{get:function(){return this._isEncrypted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUserPassword",{get:function(){return this._isUserPassword},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageCount",{get:function(){return void 0===this._pageCount&&(this._pageCount=0,this._linearization&&this._linearization.isValid?this._pageCount=this._linearization.pageCount:this._pageCount=this._catalog.pageCount),this._pageCount},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return void 0===this._form&&(this._form=new Sn(this._catalog.acroForm,this._crossReference)),this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"permissions",{get:function(){if(this._crossReference){var t=this._crossReference._permissionFlags;void 0!==t&&(this._permissions=3903&t)}return this._permissions},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bookmarks",{get:function(){var t=this._catalog;if(t&&t._catalogDictionary.has("Outlines")){var e=t._catalogDictionary.get("Outlines");e&&(this._bookmarkBase=new xn(e,this._crossReference),e.has("First")&&this._bookmarkBase._reproduceTree())}return this._bookmarkBase},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fileStructure",{get:function(){return this._fileStructure},enumerable:!0,configurable:!0}),e.prototype.getPage=function(t){if(t<0||t>=this.pageCount)throw new Error("Invalid page index");var e=this._pages.get(t);if(e)return e;var i,r=this,n=r._catalog,s=r._linearization;i=s&&s.isValid&&s.pageFirst===t?this._getLinearizationPage(t):n.getPageDictionary(t);var a=new Zi(this._crossReference,t,i.dictionary,i.reference);return this._pages.set(t,a),a},e.prototype.addPage=function(t,e){var i,r;void 0!==e?(i=e,r=t,this._checkPageNumber(r)):void 0===t?(i=new Dn,r=this.pageCount):t instanceof Dn?(i=t,r=this.pageCount):(i=new Dn,r=t,this._checkPageNumber(r));var n=new xr(this._crossReference);n.update("Type",vr.get("Pages")),n.update("Count",1),this._updatePageSettings(n,i);var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),n.objId=s.toString();var a=new xr(this._crossReference);a.update("Type",vr.get("Page"));var o=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(o,a),a.objId=o.toString(),a.update("Parent",s),n.update("Kids",[o]),0===this.pageCount)(c=this._catalog._catalogDictionary._get("Pages"))&&this._catalog._topPagesDictionary?(this._catalog._topPagesDictionary.update("Kids",[s]),n.update("Parent",c)):this._catalog._catalogDictionary.update("Pages",s),this._pages=new Map,this._pageCount=1;else{var h=this.getPage(r===this.pageCount?r-1:r);if(h&&h._pageDictionary){var c=h._pageDictionary._get("Parent"),_=this._crossReference._fetch(c);if(_&&_.has("Kids")){var d=_.get("Kids");if(d){if(r===this.pageCount)d.push(s);else{var p=[];d.forEach(function(t){t===h._ref&&p.push(s),p.push(t)}),d=p,this._updatePageCache(r)}_.update("Kids",d),n.update("Parent",c),this._updatePageCount(_,1),this._pageCount=this.pageCount+1}}}}var l=new Zi(this._crossReference,r,a,o);return l._pageSettings=i,l._isNew=!0,this._pages.set(r,l),l},e.prototype.removePage=function(t){var e=t instanceof Zi?t:this.getPage(t);this._removePage(e)},e.prototype._checkPageNumber=function(t){if(t<0||t>this.pageCount)throw new Error("Index out of range")},e.prototype._updatePageCount=function(t,e){if(t.update("Count",t.get("Count")+e),t.has("Parent")){var i=t.get("Parent");i&&"Pages"===i.get("Type").name&&this._updatePageCount(i,e)}},e.prototype._updatePageSettings=function(t,e){var i=[0,0,e.size[0],e.size[1]];t.update("MediaBox",i),t.update("CropBox",i);var r=90*Math.floor(e.rotation);r>=360&&(r%=360),t.update("Rotate",r)},e.prototype._updatePageCache=function(t,e){void 0===e&&(e=!0);for(var i=new Map,r=this.pageCount-1;r>=0;r--){var n=this.getPage(r);e?r>=t?(i.set(r+1,n),n._pageIndex=r+1):i.set(r,n):r>t?(i.set(r-1,n),n._pageIndex=r-1):r!==t&&i.set(r,n)}this._pages=i,e||(this._pageCount=this._pages.size)},e.prototype._removePage=function(t){var e=this._parseBookmarkDestination();if(e&&e.has(t)){var i=e.get(t);if(i)for(s=0;s<i.length;s++){var r=i[Number.parseInt(s.toString(),10)];if(r){var n=r._dictionary;n&&(n.has("A")&&n.update("A",null),n.update("Dest",null))}}}this._removePageTemplates(t);for(var s=this.form.count-1;s>=0;--s){var a=this.form.fieldAt(s);a&&a.page===t&&this.form.removeFieldAt(s)}this._updatePageCache(t._pageIndex,!1),this._removeParent(t._ref,t._pageDictionary),this._crossReference._cacheMap.has(t._ref)&&(t._pageDictionary._updated=!1)},e.prototype._removeParent=function(t,e){if(e.has("Parent")){var i=e._get("Parent"),r=this._crossReference._fetch(i);if(r&&r.has("Kids")){var n=r.get("Kids");1===n.length&&r&&"Pages"===r.get("Type").name?this._removeParent(i,r):(n=n.filter(function(e){return e!==t}),r.update("Kids",n),this._updatePageCount(r,-1))}}},e.prototype._parseBookmarkDestination=function(){var t=this.bookmarks;if(void 0===this._bookmarkHashTable&&t){this._bookmarkHashTable=new Map;var e=[],i={index:0,kids:t._bookMarkList};do{for(;i.index<i.kids.length;){var r=(t=i.kids[i.index]).namedDestination;if(r){if(r.destination){s=r.destination.page;(a=this._bookmarkHashTable.get(s))||(a=[]),a.push(t),this._bookmarkHashTable.set(s,a)}}else{var n=t.destination;if(n){var s=n.page,a=this._bookmarkHashTable.get(s);a||(a=[]),a.push(t),this._bookmarkHashTable.set(s,a)}}i.index+=1,t.count>0&&(e.push(i),i={index:0,kids:t._bookMarkList})}if(e.length>0)for(i=e.pop();i.index===i.kids.length&&e.length>0;)i=e.pop()}while(i.index<i.kids.length)}return this._bookmarkHashTable},e.prototype._removePageTemplates=function(t){var e;this._catalog._catalogDictionary.has("Names")&&(e=this._catalog._catalogDictionary.get("Names"))&&(this._removeInternalTemplates(e,"Pages",t),this._removeInternalTemplates(e,"Templates",t))},e.prototype._removeInternalTemplates=function(t,e,i){if(t.has(e)){var r=t.get(e);if(r&&r.has("Names")){var n=r.getArray("Names");if(n&&n.length>0){var s=this._getUpdatedPageTemplates(n,i),a=new xr(this._crossReference);a.update("Names",s);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),a.objId=o.toString(),t.update(e,o)}}}},e.prototype._getUpdatedPageTemplates=function(t,e){if(t.length>0)for(var i=1;i<=t.length;i+=2){var r=t[Number.parseInt(i.toString(),10)];if(r&&e._pageDictionary===r)return t.pop(),t.pop(),t}return t},e.prototype.reorderPages=function(t){var e=this;t.forEach(function(t){e._checkPageNumber(t)});for(var i=this._sortedArray(t),r=t.slice().sort(function(t,e){return t-e}),n=Array.from({length:this.pageCount},function(t,e){return e}).filter(function(t){return-1===i.indexOf(t)}),s=n.length-1;s>=0;s--)this.removePage(n[Number.parseInt(s.toString(),10)]);for(var a=[],o=new Map,h=this._catalog._catalogDictionary._get("Pages"),c=this,s=0;s<i.length;s++)!function(t){var n=c.getPage(r.indexOf(i[Number.parseInt(t.toString(),10)]));n._pageIndex=t,o.set(t,n);var s=new xr(c._crossReference);s.update("Type",vr.get("Pages")),s.update("Count",1),s.update("Parent",h);var _=c._crossReference._getNextReference();s.objId=_.toString(),s.update("Kids",[n._ref]),a.push(_);for(var d=n._pageDictionary.get("Parent");d&&"Pages"===d.get("Type").name&&(d.forEach(function(t,i){switch(t){case"Parent":case"Kids":case"Type":case"Count":break;case"Resources":e._cloneResources(d.get("Resources"),s);break;default:s.has(t)||s.update(t,i)}}),d.has("Parent"));)d=d.get("Parent");c._crossReference._cacheMap.set(_,s),c._crossReference._fetch(n._ref).update("Parent",_)}(s);if(this._pages=o,this._catalog){var _=this._catalog._topPagesDictionary;if(_&&_.has("Kids")){var d=_.get("Kids");d=a,_.update("Kids",d)}}},e.prototype._sortedArray=function(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),e},e.prototype._cloneResources=function(t,e){var i=this;if(e.has("Resources")){var r=e.get("Resources");t.forEach(function(t,e){r.has(t)?i._cloneInnerResources(t,e,r):r.update(t,e)})}else e.update("Resources",t)},e.prototype._cloneInnerResources=function(t,e,i){if(e instanceof xr){var r=i.get(t);if(r){var n=!1;r.forEach(function(t,e){r.has(t)||(r.update(t,e),n=!0)}),n&&(i._updated=!0)}else i.update(t,e)}else if(Array.isArray(e)){var s=i.get(t);if(s){var a=!1;e.forEach(function(t){-1===s.indexOf(t)&&(s.push(t),a=!0)}),a&&(i._updated=!0)}else i.update(t,e)}},e.prototype.save=function(t){if(this._doPostProcess(this._flatten),"string"!=typeof t)return this._crossReference._save();i.Save.save(t,new Blob([this._crossReference._save()],{type:"application/pdf"}))},e.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e){e({blobData:new Blob([t._crossReference._save()],{type:"application/pdf"})})})},e.prototype.exportAnnotations=function(e,r){this._isExport=!0,this._doPostProcessOnAnnotations();var n,s;if(e&&e instanceof Ln?s=e:r&&r instanceof Ln&&(s=r),s){if(s.dataFormat===t.DataFormat.xfdf)n=new qe;else if(s.dataFormat===t.DataFormat.json)n=new Qe;else{if(s.dataFormat!==t.DataFormat.fdf)return;n=new Pn}n.exportAppearance=s.exportAppearance}else n=new qe;var a=n._exportAnnotations(this);if(!e||"string"!=typeof e)return a;i.Save.save(e,new Blob([a],{type:"text/plain"}))},e.prototype.exportFormData=function(e,r){this._doPostProcessOnFormFields();var n,s;if(e&&e instanceof Mn?s=e:r&&r instanceof Mn&&(s=r),s){if(s.dataFormat===t.DataFormat.xfdf)n=new qe(s.exportName);else if(s.dataFormat===t.DataFormat.json)n=new Qe(s.exportName);else if(s.dataFormat===t.DataFormat.fdf)n=new Pn(s.exportName);else{if(s.dataFormat!==t.DataFormat.xml)return;n=new Rn(s.exportName)}n._asPerSpecification=s.asPerSpecification}else(n=new qe)._asPerSpecification=!1;if(!e||"string"!=typeof e)return n._exportFormFields(this);i.Save.save(e,new Blob([n._exportFormFields(this)],{type:"text/plain"}))},e.prototype.importAnnotations=function(e,i){i===t.DataFormat.xfdf?(new qe)._importAnnotations(this,"string"==typeof e?k(e):e):i===t.DataFormat.json?(new Qe)._importAnnotations(this,"string"==typeof e?k(e):e):i===t.DataFormat.fdf&&(new Pn)._importAnnotations(this,"string"==typeof e?k(e):e)},e.prototype.importFormData=function(e,i){this.form.count>0&&(i===t.DataFormat.xfdf?(new qe)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.json?(new Qe)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.fdf?(new Pn)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.xml&&(new Rn)._importFormData(this,"string"==typeof e?k(e):e))},e.prototype.destroy=function(){this._crossReference&&(this._crossReference._destroy(),this._crossReference=void 0),this._catalog&&(this._catalog._destroy(),this._catalog=void 0),this._endObjSignature=void 0,this._headerSignature=void 0,this._pages&&this._pages.size>0&&this._pages.forEach(function(t){t._destroy()}),this._pages.clear(),this._pages=void 0,this._startXrefSignature=void 0,this._stream=void 0,this._form=void 0,Lt()},Object.defineProperty(e.prototype,"_destinationCollection",{get:function(){if(null===this._namedDestinationCollection||void 0===this._namedDestinationCollection)if(this._catalog._catalogDictionary.has("Names")){var t=this._catalog._catalogDictionary.get("Names");this._namedDestinationCollection=new Nn(t,this._crossReference)}else this._namedDestinationCollection=new Nn;return this._namedDestinationCollection},enumerable:!0,configurable:!0}),e.prototype._getLinearizationPage=function(t){var e=this,i=e._catalog,r=e._linearization,n=e._crossReference,s=wr.get(r.objectNumberFirst,0);try{var a=n._fetch(s);if(a instanceof xr&&(Mt(a.get("Type"),"Page")||!a.has("Type")&&!a.has("Kids")))return i.pageKidsCountCache.has(s)||i.pageKidsCountCache.put(s,1),i.pageIndexCache.has(s)||i.pageIndexCache.put(s,0),{dictionary:a,reference:s};throw new fr("The Linearization dictionary does not point to a valid Page dictionary.")}catch(e){return i.getPageDictionary(t)}},e.prototype._checkHeader=function(){var t=this._stream;if(t.reset(),this._find(t,this._headerSignature)){t.moveStart();for(var e="",i=t.getByte();i>32&&!(e.length>=12);)e+=String.fromCharCode(i),i=t.getByte();this._version||(this._version=e.substring(5))}},e.prototype._parse=function(t){this._crossReference._parse(t),this._catalog=new qr(this._crossReference),this._catalog.version&&(this._version=this._catalog.version)},e.prototype._find=function(t,e,i,r){void 0===i&&(i=1024),void 0===r&&(r=!1);var n=e.length,s=t.peekBytes(i),a=s.length-n;if(a<=0)return!1;if(r)for(var o=n-1,h=s.length-1;h>=o;){for(c=0;c<n&&s[h-c]===e[o-c];)c++;if(c>=n)return t.position+=h-o,!0;h--}else for(h=0;h<=a;){for(var c=0;c<n&&s[h+c]===e[c];)c++;if(c>=n)return t.position+=h,!0;h++}return!1},e.prototype._doPostProcess=function(t){void 0===t&&(t=!1),this._doPostProcessOnFormFields(t),this._doPostProcessOnAnnotations(t)},e.prototype._doPostProcessOnFormFields=function(t){if(void 0===t&&(t=!1),this.form._doPostProcess(t),t){var e=this._catalog._catalogDictionary.getRaw("AcroForm"),i=new xr(this._crossReference);i._updated=!0,e instanceof wr?this._crossReference._cacheMap.set(e,i):(this.form._dictionary=i,this._crossReference._allowCatalog=!0),this.form._clear()}},e.prototype._doPostProcessOnAnnotations=function(t){void 0===t&&(t=!1);for(var e=0;e<this.pageCount;e++){var i=this.getPage(e);i.annotations._isExport=this._isExport,i.annotations._doPostProcess(t),t&&(i._pageDictionary.has("Annots")&&(delete i._pageDictionary._map.Annots,i._pageDictionary._updated=!0),i.annotations._clear())}},e.prototype._addWatermarkText=function(){if(this.pageCount>0)for(var e=0;e<this._pageCount;e++){var i=this.getPage(e);if(i)try{var r=i.graphics;r.save(),r.setTransparency(.2),r.drawRectangle(0,0,i.size[0],33.75,new Ee([255,255,255])),r.restore(),r.save(),r.setTransparency(.5);var n=new Ae(t.PdfFontFamily.helvetica,12,t.PdfFontStyle.regular),s=new Et(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle);r.drawString("Created with a trial version of Syncfusion Essential PDF",n,[0,0,i.size[0],33.75],null,new Ee([0,0,0]),s),r.restore()}catch(t){}}},e}(),Ln=function(){function e(){this._format=t.DataFormat.xfdf,this._exportAppearance=!1}return Object.defineProperty(e.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportAppearance",{get:function(){return this._exportAppearance},set:function(t){this._exportAppearance=t},enumerable:!0,configurable:!0}),e}(),Mn=function(){function e(){this._format=t.DataFormat.xfdf,this._exportName="",this._asPerSpecification=!0}return Object.defineProperty(e.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportName",{get:function(){return this._exportName},set:function(t){this._exportName=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"asPerSpecification",{get:function(){return this._asPerSpecification},set:function(t){this._asPerSpecification=t},enumerable:!0,configurable:!0}),e}(),Dn=function(){function e(){this._size=[595,842],this._isOrientation=!1,this._orientation=t.PdfPageOrientation.portrait,this._size=[595,842],this._margins=new On,this._rotation=t.PdfRotationAngle.angle0}return Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._isOrientation=!0,this._orientation!==t&&(this._orientation=t,this._updateSize(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(t){this._isOrientation?this._updateSize(t):(this._size=t,this._updateOrientation())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"margins",{get:function(){return this._margins},set:function(t){this._margins=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t,t>=4&&(this._rotation=t%4)},enumerable:!0,configurable:!0}),e.prototype._updateSize=function(e){var i,r;Array.isArray(e)?(i=this.orientation,r=e):(i=e,r=this._size),i===t.PdfPageOrientation.portrait?this._size=[Math.min(r[0],r[1]),Math.max(r[0],r[1])]:this._size=[Math.max(r[0],r[1]),Math.min(r[0],r[1])]},e.prototype._updateOrientation=function(){this._orientation=this._size[1]>=this._size[0]?t.PdfPageOrientation.portrait:t.PdfPageOrientation.landscape},e.prototype._getActualSize=function(){return[this._size[0]-(this._margins._left+this._margins._right),this._size[1]-(this._margins._top+this._margins._bottom)]},e}(),On=function(){function t(t){this._left=this._right=this._top=this._bottom=void 0===t?40:t}return Object.defineProperty(t.prototype,"left",{get:function(){return this._left},set:function(t){this._left=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this._right},set:function(t){this._right=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top},set:function(t){this._top=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this._bottom},set:function(t){this._bottom=t},enumerable:!0,configurable:!0}),t}(),En=function(){function t(t,e,i,r){this._left=0,this._right=0,this._top=0,this._bottom=0,void 0===t?(this._left=.5,this._right=.5,this._top=.5,this._bottom=.5):(this._left=t,this._right=i,this._top=e,this._bottom=r)}return t}(),Vn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),jn=function(e){function i(t){var i=e.call(this)||this;return i._imageStatus=!0,i._initializeAsync(t),i}return Vn(i,e),i.prototype._initializeAsync=function(t){var e=new Uint8Array(t.length);null!==t&&void 0!==t&&"string"==typeof t?e=k(t,!1):t instanceof Uint8Array&&(e=t),this._decoder=h(e),this.height=this._decoder._height,this.width=this._decoder._width,this._bitsPerComponent=this._decoder._bitsPerComponent},i.prototype._save=function(){if(this._imageStatus=!0,this._imageStream=this._decoder._getImageDictionary(),this._decoder&&this._decoder instanceof _r){var t=this._decoder;this._maskStream=t._maskStream,t._isDecode?t._colorSpace&&this._setColorSpace():this._setColorSpace()}else this._setColorSpace()},i.prototype._setColorSpace=function(){var e,i=this._imageStream.dictionary,r=i.get("ColorSpace");if("DeviceCMYK"===r.name?e=t._PdfColorSpace.cmyk:"DeviceGray"===r.name&&(e=t._PdfColorSpace.grayScale),this._decoder instanceof _r){var n=this._decoder._colorSpace;void 0!==n&&null!==n&&(e=t._PdfColorSpace.indexed)}switch(e){case t._PdfColorSpace.cmyk:i.update("Decode",[1,0,1,0,1,0,1,0]),i.update("ColorSpace",vr.get("DeviceCMYK"));break;case t._PdfColorSpace.grayScale:i.update("Decode",[0,1]),i.update("ColorSpace",vr.get("DeviceGray"));break;case t._PdfColorSpace.rgb:i.update("Decode",[0,1,0,1,0,1]),i.update("ColorSpace",vr.get("DeviceRGB"));break;case t._PdfColorSpace.indexed:i.update("ColorSpace",this._decoder._colorSpace)}},i}(Fe);return t._PdfBaseStream=Nr,t._PdfStream=Cr,t._PdfContentStream=Rr,t._PdfNullStream=Fr,t._ContentParser=Br,t._ContentLexer=Lr,t._PdfRecord=Mr,t._PdfDecodeStream=Or,t._PdfDecryptStream=Vr,t._PdfFlateStream=Kr,t._PdfCatalog=qr,t._PdfCrossReference=yn,t.PdfDocument=Bn,t.PdfAnnotationExportSettings=Ln,t.PdfFormFieldExportSettings=Mn,t.PdfPageSettings=Dn,t.PdfMargins=On,t.PdfFileStructure=Fn,t.PdfPage=Zi,t.PdfDestination=$i,t.PdfBookmarkBase=xn,t.PdfBookmark=Tn,t.PdfNamedDestination=In,t._PdfNamedDestinationCollection=Nn,t._PdfLexicalOperator=Yr,t._PdfParser=Zr,t._Linearization=$r,t._PdfName=vr,t._PdfCommand=Sr,t._PdfReference=wr,t._PdfReferenceSet=Pr,t._PdfReferenceSetCache=Ar,t.Dictionary=kr,t._PdfDictionary=xr,t._PdfNull=Tr,t._clearPrimitiveCaches=Lt,t._isName=Mt,t._isCommand=Dt,t.PdfPredictorStream=Jr,t._toUnsigned=r,t._toSigned16=n,t._toSigned32=s,t._copyRange=a,t._checkType=o,t._getDecoder=h,t._checkRotation=c,t._getPageIndex=_,t._annotationFlagsToString=d,t._stringToAnnotationFlags=p,t._stringToPdfString=l,t._stringToBytes=u,t._convertStringToBytes=f,t._areArrayEqual=g,t._numberToString=y,t._areNotEqual=m,t._bytesToString=b,t._stringToUnicodeArray=v,t._byteArrayToHexString=S,t._hexStringToByteArray=w,t._hexStringToString=P,t._isWhiteSpace=A,t._decode=k,t._encode=x,t._getInheritableProperty=T,t._parseRectangle=I,t._calculateBounds=N,t._toRectangle=C,t._fromRectangle=R,t._getUpdatedBounds=F,t._convertToColor=B,t._parseColor=L,t._mapBorderStyle=M,t._mapBorderEffectStyle=D,t._reverseMapEndingStyle=O,t._mapLineEndingStyle=E,t._mapHighlightMode=V,t._reverseMapHighlightMode=j,t._reverseMapBlendMode=z,t._mapBlendMode=U,t._floatToString=W,t._addProcSet=H,t._getNewGuidString=G,t._escapePdfName=K,t._getBezierArc=q,t._findPage=X,t._checkField=J,t._getItemValue=Q,t._getStateTemplate=Y,t._getColorValue=Z,t._setMatrix=$,t._styleToString=tt,t._stringToStyle=et,t._mapMeasurementUnit=it,t._mapMarkupAnnotationType=rt,t._reverseMarkupAnnotationType=nt,t._mapGraphicsUnit=st,t._mapRubberStampIcon=at,t._mapPopupIcon=ot,t._reverseMapAnnotationState=ht,t._mapAnnotationState=ct,t._reverseMapAnnotationStateModel=_t,t._mapAnnotationStateModel=dt,t._mapAttachmentIcon=pt,t._mapAnnotationIntent=lt,t._reverseMapPdfFontStyle=ut,t._getSpecialCharacter=ft,t._getLatinCharacter=gt,t._encodeValue=yt,t._getCommentsOrReview=mt,t._checkReview=bt,t._checkComment=vt,t._updateVisibility=St,t._removeDuplicateReference=wt,t._removeDuplicateFromResources=Pt,t._removeReferences=At,t.BaseException=ur,t.FormatError=fr,t.ParserEndOfFileException=gr,t._defaultToString=kt,t._obtainFontDetails=xt,t._getFontStyle=Tt,t._mapFont=It,t._tryParseFontStream=Nt,t._checkInkPoints=Ct,t._obtainDestination=Rt,t._updateBounds=Ft,t._decodeText=Bt,t.PdfAnnotationCollection=Qi,t.PdfPopupAnnotationCollection=Yi,t.PdfAnnotation=ui,t.PdfComment=fi,t.PdfLineAnnotation=gi,t.PdfCircleAnnotation=yi,t.PdfEllipseAnnotation=mi,t.PdfSquareAnnotation=bi,t.PdfRectangleAnnotation=vi,t.PdfPolygonAnnotation=Si,t.PdfPolyLineAnnotation=wi,t.PdfAngleMeasurementAnnotation=Pi,t.PdfInkAnnotation=Ai,t.PdfPopupAnnotation=ki,t.PdfFileLinkAnnotation=xi,t.PdfUriAnnotation=Ti,t.PdfDocumentLinkAnnotation=Ii,t.PdfTextWebLinkAnnotation=Ni,t.PdfAttachmentAnnotation=Ci,t.Pdf3DAnnotation=Ri,t.PdfTextMarkupAnnotation=Fi,t.PdfWatermarkAnnotation=Bi,t.PdfRubberStampAnnotation=Li,t.PdfSoundAnnotation=Mi,t.PdfFreeTextAnnotation=Di,t.PdfRedactionAnnotation=Oi,t.PdfRichMediaAnnotation=Ei,t.PdfWidgetAnnotation=Vi,t.PdfStateItem=ji,t.PdfRadioButtonListItem=zi,t.PdfListFieldItem=Ui,t.PdfAnnotationCaption=Wi,t.PdfAnnotationLineEndingStyle=Hi,t.PdfInteractiveBorder=Gi,t.PdfAnnotationBorder=Ki,t.PdfBorderEffect=qi,t._PaintParameter=Xi,t.PdfAppearance=pi,t._PdfPaddings=En,t._DecompressedOutput=nr,t._DeflateStream=hr,t._Inflater=or,t._HuffmanTree=ar,t._InBuffer=sr,t._PdfFontMetrics=jt,t._WidthTable=zt,t._StandardWidthTable=Ut,t._CjkWidthTable=Wt,t._CjkWidth=Ht,t._CjkSameWidth=Gt,t._CjkDifferentWidth=Kt,t.PdfFont=Pe,t.PdfStandardFont=Ae,t.PdfCjkStandardFont=ke,t.PdfTrueTypeFont=xe,t._PdfStandardFontMetricsFactory=Te,t._PdfCjkStandardFontMetricsFactory=Ie,t._PdfCjkFontDescriptorFactory=Ne,t._UnicodeLine=Ce,t.PdfStringFormat=Et,t._PdfStringLayouter=qt,t._PdfStringLayoutResult=Xt,t._LineInfo=Jt,t._StringTokenizer=Qt,t._TrueTypeReader=he,t._TrueTypeNameRecord=ce,t._TrueTypeMetrics=_e,t._TrueTypeLongHorMetric=de,t._TrueTypeGlyph=pe,t._TrueTypeLocaTable=le,t._TrueTypeGlyphHeader=ue,t._BigEndianWriter=fe,t._TrueTypeTableInfo=Yt,t._TrueTypeOS2Table=Zt,t._TrueTypePostTable=$t,t._TrueTypeNameTable=te,t._TrueTypeMicrosoftCmapSubTable=ee,t._TrueTypeHorizontalHeaderTable=ie,t._TrueTypeHeadTable=re,t._TrueTypeCmapTable=ne,t._TrueTypeCmapSubTable=se,t._TrueTypeAppleCmapSubTable=ae,t._TrueTypeTrimmedCmapSubTable=oe,t._UnicodeTrueTypeFont=ge,t.PdfField=ii,t.PdfTextBoxField=ri,t.PdfButtonField=ni,t.PdfCheckBoxField=si,t.PdfRadioButtonListField=ai,t.PdfListField=oi,t.PdfComboBoxField=hi,t.PdfListBoxField=ci,t.PdfSignatureField=_i,t._PdfDefaultAppearance=di,t.PdfForm=Sn,t.PdfGraphics=Be,t._PdfTransformationMatrix=Le,t._Matrix=Me,t.PdfGraphicsState=De,t.PdfBrush=Ee,t.PdfPen=Ve,t._PdfUnitConvertor=je,t._PdfPath=Re,t._PdfStreamWriter=Ot,t.PdfTemplate=Ye,t._Bidirectional=be,t._RtlCharacters=ve,t._ArabicShapeRenderer=ye,t._ArabicShape=me,t._RtlRenderer=Se,t._ImageDecoder=tr,t.PdfBitmap=jn,t.PdfImage=Fe,t._PngDecoder=_r,t._JpegDecoder=ir,t._PdfEncryptor=en,t._MD5=rn,t._Sha256=nn,t._Sha512=sn,t._Word64=an,t._EncryptionKey=on,t._BasicEncryption=hn,t._AdvancedEncryption=cn,t._Cipher=_n,t._NormalCipherFour=dn,t._AdvancedEncryptionBaseCipher=pn,t._AdvancedEncryption128Cipher=ln,t._AdvancedEncryption256Cipher=un,t._NullCipher=fn,t._CipherTransform=gn,t._ExportHelper=Ke,t._XfdfDocument=qe,t._FontStructure=Xe,t._XmlWriter=ze,t._Namespace=Ue,t._XmlElement=We,t._XmlAttribute=He,t._FdfDocument=Pn,t._FdfHelper=An,t._JsonDocument=Qe,t._XmlDocument=Rn,t}({},ej.compression,ej.fileutils),this.ejs=ej;
10
+ this.ej=this.ej||{},this.ej.pdf=function(t,e,i){"use strict";function r(t,e){return t&Math.pow(2,e)-1}function n(t){return t<<16>>16}function s(t){return t<<0}function a(t,e,i,r,n){null!==r&&void 0!==r||(r=0),n=void 0===n?i.length:n,r=Math.max(0,Math.min(i.length,r)),e+((n=Math.max(0,Math.min(i.length,n)))-r)>t.length&&(t.length=e+(n-r));for(var s=r,a=e;s<n;s++,a++)t[Number.parseInt(a.toString(),10)]=i[Number.parseInt(s.toString(),10)]}function o(t,e){for(var i=0;i<e.length;i++)if(e[Number.parseInt(i.toString(),10)]!==t[Number.parseInt(i.toString(),10)])return!1;return!0}function h(t){var e;if(o(t,[255,216]))e=new rr(t);else{if(!o(t,[137,80,78,71,13,10,26,10]))throw new Error("Unsupported image format");e=new dr(t)}return e}function c(e,i,r){var n=0;if(r=void 0===r||null===r?0:r,e.rotation===t.PdfRotationAngle.angle90)n=void 0===i||null===i?0:r;else if(e.rotation===t.PdfRotationAngle.angle180)n=void 0===i||null===i?0:i;else if(e.rotation===t.PdfRotationAngle.angle270){var s=e.size;n=void 0===i||null===i?0:s[0]-r}return n}function _(t,e){for(var i=-1,r=0;r<t.pageCount;r++)if(t.getPage(r)._pageDictionary===e){i=r;break}return i}function d(e){var i=[];return 0!=(e&t.PdfAnnotationFlag.hidden)&&i.push("hidden"),0!=(e&t.PdfAnnotationFlag.invisible)&&i.push("invisible"),0!=(e&t.PdfAnnotationFlag.locked)&&i.push("locked"),0!=(e&t.PdfAnnotationFlag.noRotate)&&i.push("norotate"),0!=(e&t.PdfAnnotationFlag.noView)&&i.push("noview"),0!=(e&t.PdfAnnotationFlag.noZoom)&&i.push("nozoom"),0!=(e&t.PdfAnnotationFlag.print)&&i.push("print"),0!=(e&t.PdfAnnotationFlag.readOnly)&&i.push("readonly"),0!=(e&t.PdfAnnotationFlag.toggleNoView)&&i.push("togglenoview"),0!=(e&t.PdfAnnotationFlag.default)&&i.push("default"),i.join(",")}function p(e){switch(e){case"hidden":return t.PdfAnnotationFlag.hidden;case"invisible":return t.PdfAnnotationFlag.invisible;case"locked":return t.PdfAnnotationFlag.locked;case"norotate":return t.PdfAnnotationFlag.noRotate;case"noview":return t.PdfAnnotationFlag.noView;case"nozoom":return t.PdfAnnotationFlag.noZoom;case"print":return t.PdfAnnotationFlag.print;case"readonly":return t.PdfAnnotationFlag.readOnly;case"togglenoview":return t.PdfAnnotationFlag.toggleNoView;default:return t.PdfAnnotationFlag.default}}function l(t){if(t.charCodeAt(0)>="ï".charCodeAt(0)){var e=void 0;if("ï"===t[0]&&"»"===t[1]&&"¿"===t[2]?e="utf-8":"ÿ"===t[0]&&"þ"===t[1]?e="utf-16le":"þ"===t[0]&&"ÿ"===t[1]&&(e="utf-16be"),e)try{return new TextDecoder(e,{fatal:!0}).decode(u(t))}catch(t){}}for(var i=[],r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364],n=0;n<t.length;n++){var s=r[t.charCodeAt(n)];i.push(s?String.fromCharCode(s):t.charAt(n))}return i.join("")}function u(t,e){void 0===e&&(e=!1);for(var i=[],r=0;r<t.length;++r)i.push(255&t.charCodeAt(r));return e?i:new Uint8Array(i)}function f(t,e){for(var i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}function g(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[Number.parseInt(i.toString(),10)]!==e[Number.parseInt(i.toString(),10)])return!1;return!0}function y(t){return Number.isInteger(t)?t.toString():t.toFixed(7)}function m(t,e){var i=!1;if(t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r]!==e[r]){i=!0;break}return i}function b(t){var e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);for(var i=[],r=0;r<e;r+=8192){var n=Math.min(r+8192,e),s=t.subarray(r,n);i.push(String.fromCharCode.apply(null,s))}return i.join("")}function v(t){var e=[];if(null!==t&&void 0!==t)for(var i=0;i<t.length;i++){var r=t.charCodeAt(i);e.push(r/256>>>0),e.push(255&r)}return new Uint8Array(e)}function S(t){for(var e,i=[],r=0;r<t.length;r++)(e=t[Number.parseInt(r.toString(),10)].toString(16).toUpperCase()).length<2&&(e="0"+e),i.push(e);return i.join("")}function w(t,e){void 0===e&&(e=!1);var i=[];if(t)for(var r=0;r<t.length;r+=2)i.push(Number.parseInt(t.substring(r,r+2),16));return e?i:new Uint8Array(i)}function P(t){var e="";if(t&&"#"===t[0]){t=t.substring(1);for(var i=0;i<t.length;i+=2)e+=String.fromCharCode(Number.parseInt(t.substring(i,i+2),16));return e}return t}function A(t){return 32===t||9===t||13===t||10===t}function k(t,e){void 0===e&&(e=!1);var i,r,n,s,a,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=0,c=0,_=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;t.charAt(t.length-1)===o.charAt(64)&&_--;for(var d=new Array(0|_);h<t.length;)i=o.indexOf(t.charAt(h++))<<2|(s=o.indexOf(t.charAt(h++)))>>4,r=(15&s)<<4|(a=o.indexOf(t.charAt(h++)))>>2,n=(3&a)<<6|o.indexOf(t.charAt(h++)),c<_&&(d[c++]=i),c<_&&(d[c++]=r),c<_&&(d[c++]=n);return e?d:new Uint8Array(d)}function x(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="",r=0,n=0;n<t.length;n++)n%3==0?(r=t[Number.parseInt(n.toString(),10)]>>2,i+=e[Number.parseInt(r.toString(),10)],r=t[Number.parseInt(n.toString(),10)]<<4&63):n%3==1?(r+=t[Number.parseInt(n.toString(),10)]>>4,i+=e[Number.parseInt(r.toString(),10)],r=t[Number.parseInt(n.toString(),10)]<<2&63):n%3==2&&(r+=t[Number.parseInt(n.toString(),10)]>>6,i+=e[Number.parseInt(r.toString(),10)],r=63&t[Number.parseInt(n.toString(),10)],i+=e[Number.parseInt(r.toString(),10)]);return t.length%3==1&&(i+=e[Number.parseInt(r.toString(),10)]+"=="),t.length%3==2&&(i+=e[Number.parseInt(r.toString(),10)]+"="),i}function T(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=!0);for(var n=[],s=4;s<arguments.length;s++)n[s-4]=arguments[s];for(var a,o=new Set;t instanceof Tr&&t.objId&&!o.has(t.objId);){t.objId&&o.add(t.objId);var h=i?t.getArray(e):t.get(e);if(void 0!==h){if(r)return h;a||(a=[]),a.push(h)}for(var c=0,_=!1;c<n.length;){var d=n[c];if(t.has(d)){t=t.get(d),_=!0;break}c++}if(!_)break}return a}function I(t,e){var i={x:0,y:0,width:0,height:0},r=t.getArray("Rect");if(r&&Array.isArray(r)){var n=r[0],s=r[1],a=r[2],o=r[3];void 0!==n&&void 0!==s&&void 0!==a&&void 0!==o&&(i.x=Math.min(n,a),i.y=Math.min(s,o),i.width=Math.max(n,a)-i.x,i.height=Math.max(s,o)-i.y,e&&(i.height=parseFloat(i.height.toFixed(3)),r[1]<0&&(i.y=r[1],r[1]>r[3]&&(i.y-=i.height))))}return i}function N(t,e){var i;if(t.has("Rect"))if(i=I(t),e){var r=e.size,n=e.mediaBox,s=e.cropBox;s&&Array.isArray(s)&&4===s.length&&e._pageDictionary.has("CropBox")?0===s[0]&&0===s[1]&&r[0]!==s[2]&&r[1]!==s[3]||i.x===s[0]?i.y=r[1]-(i.y+i.height):(i.x-=s[0],i.y=s[3]-(i.y+i.height)):n&&Array.isArray(n)&&4===n.length&&e._pageDictionary.has("MediaBox")&&(n[0]>0||n[1]>0||r[0]===n[2]||r[1]===n[3])?(i.x-=n[0],i.y=n[3]-(i.y+i.height)):i.y=r[1]-(i.y+i.height)}else i.y=i.y+i.height;return i}function C(t){return{x:Math.min(t[0],t[2]),y:Math.min(t[1],t[3]),width:Math.abs(t[0]-t[2]),height:Math.abs(t[1]-t[3])}}function R(t){return[t.x,t.y,t.x+t.width,t.y+t.height]}function F(t,e){var i=t[0],r=t[1],n=t[2],s=t[3];if(e){var a=e.size,o=a[0],h=a[1],c=e.mediaBox,_=e.cropBox;_&&Array.isArray(_)&&4===_.length?0!==_[0]||0!==_[1]||o===_[2]||h===_[3]?(i+=_[0],r=_[3]-(r+s)):r=h-(r+s):c&&Array.isArray(c)&&4===c.length&&(c[0]>0||c[1]>0||o===c[2]||h===c[3])?(i-=c[0],r=c[3]-(r+s)):r=h-(r+s)}return[i,r,i+n,r+s]}function B(t){var e=Z(t);if(!e){var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);i&&(e=[Number.parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)])}return e}function L(t){var e;if(t)if(1===t.length){var i=t[0];if(void 0!==i){var r=Math.round(255*i);e=[r,r,r]}}else if(3===t.length){var n=t[0],s=t[1],a=t[2];void 0!==n&&void 0!==s&&void 0!==a&&(e=[Math.round(255*n),Math.round(255*s),Math.round(255*a)])}else if(4===t.length){var o=t[0],h=t[1],c=t[2],_=t[3];if(void 0!==o&&void 0!==h&&void 0!==c&&void 0!==_){var d=255*_;e=[Math.round(255-Math.min(255,o*(255-d)+d)),Math.round(255-Math.min(255,h*(255-d)+d)),Math.round(255-Math.min(255,c*(255-d)+d))]}}return e}function M(e){var i="S";switch(e){case t.PdfBorderStyle.dot:case t.PdfBorderStyle.dashed:i="D";break;case t.PdfBorderStyle.beveled:i="B";break;case t.PdfBorderStyle.inset:i="I";break;case t.PdfBorderStyle.underline:i="U"}return Sr.get(i)}function D(e){var i=t.PdfBorderEffectStyle.solid;switch(e){case"C":i=t.PdfBorderEffectStyle.cloudy}return i}function O(e){var i="None";if(void 0!==e)switch(e){case t.PdfLineEndingStyle.openArrow:i="OpenArrow";break;case t.PdfLineEndingStyle.closedArrow:i="ClosedArrow";break;case t.PdfLineEndingStyle.rOpenArrow:i="ROpenArrow";break;case t.PdfLineEndingStyle.rClosedArrow:i="RClosedArrow";break;case t.PdfLineEndingStyle.butt:i="Butt";break;case t.PdfLineEndingStyle.diamond:i="Diamond";break;case t.PdfLineEndingStyle.circle:i="Circle";break;case t.PdfLineEndingStyle.square:i="Square";break;case t.PdfLineEndingStyle.slash:i="Slash"}return i}function E(e,i){var r=void 0!==i?i:t.PdfLineEndingStyle.none;switch(e.toLowerCase()){case"openarrow":r=t.PdfLineEndingStyle.openArrow;break;case"closedarrow":r=t.PdfLineEndingStyle.closedArrow;break;case"ropenarrow":r=t.PdfLineEndingStyle.rOpenArrow;break;case"rclosedarrow":r=t.PdfLineEndingStyle.rClosedArrow;break;case"butt":r=t.PdfLineEndingStyle.butt;break;case"diamond":r=t.PdfLineEndingStyle.diamond;break;case"circle":r=t.PdfLineEndingStyle.circle;break;case"square":r=t.PdfLineEndingStyle.square;break;case"slash":r=t.PdfLineEndingStyle.slash}return r}function V(e){switch(e){case"P":return t.PdfHighlightMode.push;case"N":return t.PdfHighlightMode.noHighlighting;case"O":return t.PdfHighlightMode.outline;default:return t.PdfHighlightMode.invert}}function j(e){switch(e){case t.PdfHighlightMode.push:return Sr.get("P");case t.PdfHighlightMode.noHighlighting:return Sr.get("N");case t.PdfHighlightMode.outline:return Sr.get("O");default:return Sr.get("I")}}function z(e){var i="Normal";switch(e){case t.PdfBlendMode.multiply:i="Multiply";break;case t.PdfBlendMode.screen:i="Screen";break;case t.PdfBlendMode.overlay:i="Overlay";break;case t.PdfBlendMode.darken:i="Darken";break;case t.PdfBlendMode.lighten:i="Lighten";break;case t.PdfBlendMode.colorDodge:i="ColorDodge";break;case t.PdfBlendMode.colorBurn:i="ColorBurn";break;case t.PdfBlendMode.hardLight:i="HardLight";break;case t.PdfBlendMode.softLight:i="SoftLight";break;case t.PdfBlendMode.difference:i="Difference";break;case t.PdfBlendMode.exclusion:i="Exclusion";break;case t.PdfBlendMode.hue:i="Hue";break;case t.PdfBlendMode.saturation:i="Saturation";break;case t.PdfBlendMode.color:i="Color";break;case t.PdfBlendMode.luminosity:i="Luminosity";break;default:i="Normal"}return Sr.get(i)}function U(e){var i=t.PdfBlendMode.normal;switch(e.name){case"Multiply":i=t.PdfBlendMode.multiply;break;case"Screen":i=t.PdfBlendMode.screen;break;case"Overlay":i=t.PdfBlendMode.overlay;break;case"Darken":i=t.PdfBlendMode.darken;break;case"Lighten":i=t.PdfBlendMode.lighten;break;case"ColorDodge":i=t.PdfBlendMode.colorDodge;break;case"ColorBurn":i=t.PdfBlendMode.colorBurn;break;case"HardLight":i=t.PdfBlendMode.hardLight;break;case"SoftLight":i=t.PdfBlendMode.softLight;break;case"Difference":i=t.PdfBlendMode.difference;break;case"Exclusion":i=t.PdfBlendMode.exclusion;break;case"Hue":i=t.PdfBlendMode.hue;break;case"Saturation":i=t.PdfBlendMode.saturation;break;case"Color":i=t.PdfBlendMode.color;break;case"Luminosity":i=t.PdfBlendMode.luminosity;break;default:i=t.PdfBlendMode.normal}return i}function W(t){var e=t.toFixed(2);return"0.00"===e&&(e=".00"),e}function H(t,e){var i=Sr.get(t);if(e.has("ProcSet")){var r=e.getArray("ProcSet");r&&-1===r.indexOf(i)&&(r.push(i),e.update("ProcSet",r))}else e.update("ProcSet",[i])}function G(){return"aaaaaaaa-aaaa-4aaa-baaa-aaaaaaaaaaaa".replace(/[ab]/g,function(t){var e=16*Math.random()|0;return("a"===t?e:3&e|8).toString(16)})}function K(t){for(var e=[],i=0,r=0;r<t.length;r++){var n=t.charCodeAt(r);(n<33||n>126||35===n||40===n||41===n||60===n||62===n||91===n||93===n||123===n||125===n||47===n||37===n)&&(i<r&&e.push(t.substring(i,r)),e.push("#"+n.toString(16)),i=r+1)}return 0===e.length?t:(i<t.length&&e.push(t.substring(i,t.length)),e.join(""))}function q(t,e,i,r,n,s){if(t>i){a=t;t=i,i=a}if(r>e){var a=e;e=r,r=a}var o,h;Math.abs(s)<=90?(o=s,h=1):o=s/(h=Math.ceil(Math.abs(s)/90));for(var c=(t+i)/2,_=(e+r)/2,d=(i-t)/2,p=(r-e)/2,l=o*(Math.PI/360),u=Math.abs(4/3*(1-Math.cos(l))/Math.sin(l)),f=[],g=0;g<h;g++){var y=(n+g*o)*(Math.PI/180),m=(n+(g+1)*o)*(Math.PI/180),b=Math.cos(y),v=Math.cos(m),S=Math.sin(y),w=Math.sin(m);o>0?(f.push(c+d*b),f.push(_-p*S),f.push(c+d*(b-u*S)),f.push(_-p*(S+u*b)),f.push(c+d*(v+u*w)),f.push(_-p*(w-u*v)),f.push(c+d*v),f.push(_-p*w)):(f.push(c+d*b),f.push(_-p*S),f.push(c+d*(b+u*S)),f.push(_-p*(S-u*b)),f.push(c+d*(v-u*w)),f.push(_-p*(w+u*v)),f.push(c+d*v),f.push(_-p*w))}return f}function X(t,e){for(var i,r=0;r<t.pageCount&&void 0===i;r++){var n=t.getPage(r);if(n&&n._pageDictionary.has("Annots")){var s=n._pageDictionary.get("Annots");if(null!==s&&void 0!==s&&s.length>0)for(var a=0;a<s.length&&void 0===i;a++){var o=s[Number.parseInt(a.toString(),10)];null!==o&&void 0!==o&&o instanceof Pr&&o===e&&(i=n)}}}return i}function J(t){var e=!1;if(t.has("AS")){var i=t.get("AS");if(i)e="Off"!==i.name;else{var r=t.get("V");r&&(e=r.name===Q(t))}}return e}function Q(t){var e,i="";if(t.has("AS")&&null!==(e=t.get("AS"))&&"Off"!==e.name&&(i=e.name),""===i&&t.has("AP")){var r=t.get("AP");if(r&&r.has("N")){var n=r.get("N");if(n instanceof Cr&&(n=n.dictionary),n&&n instanceof Tr){var s=[];n.forEach(function(t,e){s.push(t)});for(var a=0;a<s.length;a++)if("Off"!==s[Number.parseInt(a.toString(),10)]){i=s[Number.parseInt(a.toString(),10)];break}}}}return i}function Y(e,i){var r,n=e===t._PdfCheckFieldState.checked?Q(i._dictionary):"Off";if(i._dictionary.has("AP")){var s=i._dictionary.get("AP");if(s&&s.has("N")){var a=s.get("N");if(a&&a instanceof Cr&&(a=a.dictionary),a&&a instanceof Tr&&n&&""!==n&&a.has(n)){var o=a.get(n),h=a.getRaw(n);h&&(o.reference=h),o&&(r=new Ze(o,i._crossReference))}}}return r}function Z(t){var e;switch(t){case"transparent":e=[255,255,255];break;case"aliceblue":e=[240,248,255];break;case"antiquewhite":e=[250,235,215];break;case"aqua":e=[0,255,255];break;case"aquamarine":e=[127,255,212];break;case"azure":e=[240,255,255];break;case"beige":e=[245,245,220];break;case"bisque":e=[255,228,196];break;case"black":e=[0,0,0];break;case"blanchedalmond":e=[255,235,205];break;case"blue":e=[0,0,255];break;case"blueviolet":e=[138,43,226];break;case"brown":e=[165,42,42];break;case"burlywood":e=[222,184,135];break;case"cadetBlue":e=[95,158,160];break;case"chartreuse":e=[127,255,0];break;case"chocolate":e=[210,105,30];break;case"coral":e=[255,127,80];break;case"cornflowerblue":e=[100,149,237];break;case"cornsilk":e=[255,248,220];break;case"crimson":e=[220,20,60];break;case"cyan":e=[0,255,255];break;case"darkblue":e=[0,0,139];break;case"darkcyan":e=[0,139,139];break;case"darkgoldenrod":e=[184,134,11];break;case"darkgray":e=[169,169,169];break;case"darkgreen":e=[0,100,0];break;case"darkkhaki":e=[189,183,107];break;case"darkmagenta":e=[139,0,139];break;case"darkolivegreen":e=[85,107,47];break;case"darkorange":e=[255,140,0];break;case"darkorchid":e=[153,50,204];break;case"darkred":e=[139,0,0];break;case"darksalmon":e=[233,150,122];break;case"darkseagreen":e=[143,188,139];break;case"darkslateblue":e=[72,61,139];break;case"darkslategray":e=[47,79,79];break;case"darkturquoise":e=[0,206,209];break;case"darkviolet":e=[148,0,211];break;case"deeppink":e=[255,20,147];break;case"deepskyblue":e=[0,191,255];break;case"dimgray":e=[105,105,105];break;case"dodgerblue":e=[30,144,255];break;case"firebrick":e=[178,34,34];break;case"floralwhite":e=[255,250,240];break;case"forestgreen":e=[34,139,34];break;case"fuchsia":e=[255,0,255];break;case"gainsboro":e=[220,220,220];break;case"ghostwhite":e=[248,248,255];break;case"gold":e=[255,215,0];break;case"goldenrod":e=[218,165,32];break;case"gray":e=[128,128,128];break;case"green":e=[0,128,0];break;case"greenyellow":e=[173,255,47];break;case"honeydew":e=[240,255,240];break;case"hotpink":e=[255,105,180];break;case"indianred":e=[205,92,92];break;case"indigo":e=[75,0,130];break;case"ivory":e=[255,255,240];break;case"khaki":e=[240,230,140];break;case"lavender":e=[230,230,250];break;case"lavenderblush":e=[255,240,245];break;case"lawngreen":e=[124,252,0];break;case"lemonchiffon":e=[255,250,205];break;case"lightblue":e=[173,216,230];break;case"lightcoral":e=[240,128,128];break;case"lightcyan":e=[224,255,255];break;case"lightgoldenrodyellow":e=[250,250,210];break;case"lightgreen":e=[144,238,144];break;case"lightgray":e=[211,211,211];break;case"LightPink":e=[255,182,193];break;case"lightsalmon":e=[255,160,122];break;case"lightseagreen":e=[32,178,170];break;case"lightskyblue":e=[135,206,250];break;case"lightslategray":e=[119,136,153];break;case"lightsteelblue":e=[176,196,222];break;case"lightyellow":e=[255,255,224];break;case"lime":e=[0,255,0];break;case"limeGreen":e=[50,205,50];break;case"linen":e=[250,240,230];break;case"magenta":e=[255,0,255];break;case"maroon":e=[128,0,0];break;case"mediumaquamarine":e=[102,205,170];break;case"mediumblue":e=[0,0,205];break;case"mediumorchid":e=[186,85,211];break;case"mediumpurple":e=[147,112,219];break;case"mediumseagreen":e=[60,179,113];break;case"mediumslateblue":e=[123,104,238];break;case"mediumspringgreen":e=[0,250,154];break;case"mediumturquoise":e=[72,209,204];break;case"mediumvioletred":e=[199,21,133];break;case"midnightblue":e=[25,25,112];break;case"mintcream":e=[245,255,250];break;case"mistyrose":e=[255,228,225];break;case"moccasin":e=[255,228,181];break;case"navajowhite":e=[255,222,173];break;case"navy":e=[0,0,128];break;case"oldLace":e=[253,245,230];break;case"olive":e=[128,128,0];break;case"olivedrab":e=[107,142,35];break;case"orange":e=[255,165,0];break;case"orangered":e=[255,69,0];break;case"orchid":e=[218,112,214];break;case"palegoldenrod":e=[238,232,170];break;case"palegreen":e=[152,251,152];break;case"paleturquoise":e=[175,238,238];break;case"palebioletred":e=[219,112,147];break;case"papayawhip":e=[255,239,213];break;case"peachpuff":e=[255,218,185];break;case"peru":e=[205,133,63];break;case"pink":e=[255,192,203];break;case"plum":e=[221,160,221];break;case"powderblue":e=[176,224,230];break;case"purple":e=[128,0,128];break;case"red":e=[255,0,0];break;case"rosybrown":e=[188,143,143];break;case"royalblue":e=[65,105,225];break;case"saddlebrown":e=[139,69,19];break;case"salmon":e=[250,128,114];break;case"sandybrown":e=[244,164,96];break;case"seagreen":e=[46,139,87];break;case"seashell":e=[255,245,238];break;case"sienna":e=[160,82,45];break;case"silver":e=[192,192,192];break;case"skyblue":e=[135,206,235];break;case"slateblue":e=[106,90,205];break;case"slategray":e=[112,128,144];break;case"snow":e=[255,250,250];break;case"springgreen":e=[0,255,127];break;case"steelblue":e=[70,130,180];break;case"tan":e=[210,180,140];break;case"teal":e=[0,128,128];break;case"thistle":e=[216,191,216];break;case"tomato":e=[255,99,71];break;case"turquoise":e=[64,224,208];break;case"violet":e=[238,130,238];break;case"wheat":e=[245,222,179];break;case"white":e=[255,255,255];break;case"whitesmoke":e=[245,245,245];break;case"yellow":e=[255,255,0];break;case"yellowgreen":e=[154,205,50]}return e}function $(t,e){var i=t._content.dictionary.getArray("BBox");if(i&&void 0!==e&&null!==e)if(0===e)t._content.dictionary.set("Matrix",[1,0,0,1,-i[0],-i[1]]);else{var r=new Me;90===e?r._translate(i[3],-i[0]):180===e?r._translate(i[2],i[3]):270===e&&r._translate(-i[1],i[2]),r._rotate(e),t._content.dictionary.set("Matrix",r._matrix._elements)}}function tt(e){var i="4";switch(e){case t.PdfCheckBoxStyle.circle:i="l";break;case t.PdfCheckBoxStyle.cross:i="8";break;case t.PdfCheckBoxStyle.diamond:i="u";break;case t.PdfCheckBoxStyle.square:i="n";break;case t.PdfCheckBoxStyle.star:i="H"}return i}function et(e){var i=t.PdfCheckBoxStyle.check;switch(e){case"l":i=t.PdfCheckBoxStyle.circle;break;case"8":i=t.PdfCheckBoxStyle.cross;break;case"u":i=t.PdfCheckBoxStyle.diamond;break;case"n":i=t.PdfCheckBoxStyle.square;break;case"H":i=t.PdfCheckBoxStyle.star}return i}function it(e){var i;switch(e){case"cm":i=t.PdfMeasurementUnit.centimeter;break;case"in":i=t.PdfMeasurementUnit.inch;break;case"mm":i=t.PdfMeasurementUnit.millimeter;break;case"p":i=t.PdfMeasurementUnit.pica;break;case"pt":i=t.PdfMeasurementUnit.point;break;default:i=t.PdfMeasurementUnit.centimeter}return i}function rt(e){var i;switch(e){case"Highlight":i=t.PdfTextMarkupAnnotationType.highlight;break;case"Squiggly":i=t.PdfTextMarkupAnnotationType.squiggly;break;case"StrikeOut":i=t.PdfTextMarkupAnnotationType.strikeOut;break;case"Underline":i=t.PdfTextMarkupAnnotationType.underline;break;default:i=t.PdfTextMarkupAnnotationType.highlight}return i}function nt(e){var i="Highlight";switch(e){case t.PdfTextMarkupAnnotationType.highlight:i="Highlight";break;case t.PdfTextMarkupAnnotationType.squiggly:i="Squiggly";break;case t.PdfTextMarkupAnnotationType.strikeOut:i="StrikeOut";break;case t.PdfTextMarkupAnnotationType.underline:i="Underline";break;default:i="Highlight"}return i}function st(e){var i;switch(e){case"cm":i=t._PdfGraphicsUnit.centimeter;break;case"in":i=t._PdfGraphicsUnit.inch;break;case"mm":i=t._PdfGraphicsUnit.millimeter;break;case"p":i=t._PdfGraphicsUnit.pica;break;case"pt":i=t._PdfGraphicsUnit.point;break;default:i=t._PdfGraphicsUnit.centimeter}return i}function at(e){var i;switch(e){case"#Approved":case"SBApproved":i=t.PdfRubberStampAnnotationIcon.approved;break;case"#AsIs":case"SBAsIs":i=t.PdfRubberStampAnnotationIcon.asIs;break;case"#Completed":case"SBCompleted":i=t.PdfRubberStampAnnotationIcon.completed;break;case"#Confidential":case"SBConfidential":i=t.PdfRubberStampAnnotationIcon.confidential;break;case"#Departmental":case"SBDepartmental":i=t.PdfRubberStampAnnotationIcon.departmental;break;case"#Draft":case"SBDraft":i=t.PdfRubberStampAnnotationIcon.draft;break;case"#Experimental":case"SBExperimental":i=t.PdfRubberStampAnnotationIcon.experimental;break;case"#Expired":case"SBExpired":i=t.PdfRubberStampAnnotationIcon.expired;break;case"#Final":case"SBFinal":i=t.PdfRubberStampAnnotationIcon.final;break;case"#ForComment":case"SBForComment":i=t.PdfRubberStampAnnotationIcon.forComment;break;case"#ForPublicRelease":case"SBForPublicRelease":i=t.PdfRubberStampAnnotationIcon.forPublicRelease;break;case"#InformationOnly":case"SBInformationOnly":i=t.PdfRubberStampAnnotationIcon.informationOnly;break;case"#NotApproved":case"SBNotApproved":i=t.PdfRubberStampAnnotationIcon.notApproved;break;case"#NotForPublicRelease":case"SBNotForPublicRelease":i=t.PdfRubberStampAnnotationIcon.notForPublicRelease;break;case"#PreliminaryResults":case"SBPreliminaryResults":i=t.PdfRubberStampAnnotationIcon.preliminaryResults;break;case"#Sold":case"SBSold":i=t.PdfRubberStampAnnotationIcon.sold;break;case"#TopSecret":case"SBTopSecret":i=t.PdfRubberStampAnnotationIcon.topSecret;break;case"#Void":case"SBVoid":i=t.PdfRubberStampAnnotationIcon.void;break;default:i=t.PdfRubberStampAnnotationIcon.draft}return i}function ot(e){var i;switch(e){case"Note":i=t.PdfPopupIcon.note;break;case"Comment":i=t.PdfPopupIcon.comment;break;case"Help":i=t.PdfPopupIcon.help;break;case"Insert":i=t.PdfPopupIcon.insert;break;case"Key":i=t.PdfPopupIcon.key;break;case"NewParagraph":i=t.PdfPopupIcon.newParagraph;break;case"Paragraph":i=t.PdfPopupIcon.paragraph;break;default:i=t.PdfPopupIcon.note}return i}function ht(e){var i="None";switch(e){case t.PdfAnnotationState.none:i="None";break;case t.PdfAnnotationState.accepted:i="Accepted";break;case t.PdfAnnotationState.rejected:i="Rejected";break;case t.PdfAnnotationState.cancel:i="Cancelled";break;case t.PdfAnnotationState.completed:i="Completed";break;case t.PdfAnnotationState.marked:i="Marked";break;case t.PdfAnnotationState.unmarked:i="Unmarked";break;case t.PdfAnnotationState.unknown:i="Unknown";break;default:i="None"}return i}function ct(e){var i=t.PdfAnnotationState.none;switch(e){case"None":i=t.PdfAnnotationState.none;break;case"Accepted":i=t.PdfAnnotationState.accepted;break;case"Rejected":i=t.PdfAnnotationState.rejected;break;case"Cancelled":i=t.PdfAnnotationState.cancel;break;case"Completed":i=t.PdfAnnotationState.completed;break;case"Marked":i=t.PdfAnnotationState.marked;break;case"Unmarked":i=t.PdfAnnotationState.unmarked;break;case"Unknown":i=t.PdfAnnotationState.unknown}return i}function _t(e){var i="None";switch(e){case t.PdfAnnotationStateModel.none:i="None";break;case t.PdfAnnotationStateModel.marked:i="Marked";break;case t.PdfAnnotationStateModel.review:i="Review";break;default:i="None"}return i}function dt(e){var i=t.PdfAnnotationStateModel.none;switch(e){case"None":i=t.PdfAnnotationStateModel.none;break;case"Marked":i=t.PdfAnnotationStateModel.marked;break;case"Review":i=t.PdfAnnotationStateModel.review}return i}function pt(e){var i;switch(e){case"PushPin":i=t.PdfAttachmentIcon.pushPin;break;case"Tag":i=t.PdfAttachmentIcon.tag;break;case"Graph":i=t.PdfAttachmentIcon.graph;break;case"Paperclip":i=t.PdfAttachmentIcon.paperClip;break;default:i=t.PdfAttachmentIcon.pushPin}return i}function lt(e){var i;switch(e){case"None":i=t.PdfAnnotationIntent.none;break;case"FreeTextCallout":i=t.PdfAnnotationIntent.freeTextCallout;break;case"FreeTextTypeWriter":i=t.PdfAnnotationIntent.freeTextTypeWriter;break;default:i=t.PdfAnnotationIntent.none}return i}function ut(e){var i="";switch(e){case t.PdfFontStyle.regular:i="Regular";break;case t.PdfFontStyle.bold:i="Bold";break;case t.PdfFontStyle.italic:i="Italic";break;case t.PdfFontStyle.underline:i="Underline";break;case t.PdfFontStyle.strikeout:i="Strikeout";break;default:i="Regular"}return i}function ft(t){var e;switch(t){case"head2right":e="➢";break;case"aacute":e="á";break;case"eacute":e="é";break;case"iacute":e="í";break;case"oacute":e="ó";break;case"uacute":e="ú";break;case"circleright":e="➲";break;case"bleft":e="⇦";break;case"bright":e="⇨";break;case"bup":e="⇧";break;case"bdown":e="⇩";break;case"barb4right":e="➔";break;case"bleftright":e="⬄";break;case"bupdown":e="⇳";break;case"bnw":e="⬀";break;case"bne":e="⬁";break;case"bsw":e="⬃";break;case"bse":e="⬂";break;case"bdash1":e="▭";break;case"bdash2":e="▫";break;case"xmarkbld":e="✗";break;case"checkbld":e="✓";break;case"boxxmarkbld":e="☒";break;case"boxcheckbld":e="☑";break;case"space":e=" ";break;case"pencil":e="✏";break;case"scissors":e="✂";break;case"scissorscutting":case"readingglasses":case"bell":case"book":case"telephonesolid":case"telhandsetcirc":case"envelopeback":e="✁";break;case"hourglass":e="⌛";break;case"keyboard":e="⌨";break;case"tapereel":e="✇";break;case"handwrite":e="✍";break;case"handv":e="✌";break;case"handptleft":e="☜";break;case"handptright":e="☞";break;case"handptup":e="☝";break;case"handptdown":e="☟";break;case"smileface":e="☺";break;case"frownface":e="☹";break;case"skullcrossbones":e="☠";break;case"flag":e="⚐";break;case"pennant":e="Ὢ9";break;case"airplane":e="✈";break;case"sunshine":e="☼";break;case"droplet":e="Ὂ7";break;case"snowflake":e="❄";break;case"crossshadow":e="✞";break;case"crossmaltese":e="✠";break;case"starofdavid":e="✡";break;case"crescentstar":e="☪";break;case"yinyang":e="☯";break;case"om":e="ॐ";break;case"wheel":e="☸";break;case"aries":e="♈";break;case"taurus":e="♉";break;case"gemini":e="♊";break;case"cancer":e="♋";break;case"leo":e="♌";break;case"virgo":e="♍";break;case"libra":e="♎";break;case"scorpio":e="♏";break;case"saggitarius":e="♐";break;case"capricorn":e="♑";break;case"aquarius":e="♒";break;case"pisces":e="♓";break;case"ampersanditlc":case"ampersandit":e="&";break;case"circle6":e="●";break;case"circleshadowdwn":e="❍";break;case"square6":e="■";break;case"box3":e="□";break;case"boxshadowdwn":e="❑";break;case"boxshadowup":e="❒";break;case"lozenge4":e="⬧";break;case"lozenge6":e="⧫";break;case"rhombus6":e="◆";break;case"xrhombus":e="❖";break;case"rhombus4":e="⬥";break;case"clear":e="⌧";break;case"escape":e="⍓";break;case"command":e="⌘";break;case"rosette":e="❀";break;case"rosettesolid":e="✿";break;case"quotedbllftbld":e="❝";break;case"quotedblrtbld":e="❞";break;case".notdef":e="▯";break;case"zerosans":e="⓪";break;case"onesans":e="①";break;case"twosans":e="②";break;case"threesans":e="③";break;case"foursans":e="④";break;case"fivesans":e="⑤";break;case"sixsans":e="⑥";break;case"sevensans":e="⑦";break;case"eightsans":e="⑧";break;case"ninesans":e="⑨";break;case"tensans":e="⑩";break;case"zerosansinv":e="⓿";break;case"onesansinv":e="❶";break;case"twosansinv":e="❷";break;case"threesansinv":e="❸";break;case"foursansinv":e="❹";break;case"circle2":e="·";break;case"circle4":e="•";break;case"square2":e="▪";break;case"ring2":e="○";break;case"ringbutton2":e="◉";break;case"target":e="◎";break;case"square4":e="▪";break;case"box2":e="◻";break;case"crosstar2":e="✦";break;case"pentastar2":e="★";break;case"hexstar2":e="✶";break;case"octastar2":e="✴";break;case"dodecastar3":e="✹";break;case"octastar4":e="✵";break;case"registercircle":e="⌖";break;case"cuspopen":e="⟡";break;case"cuspopen1":e="⌑";break;case"circlestar":e="★";break;case"starshadow":e="✰";break;case"deleteleft":e="⌫";break;case"deleteright":e="⌦";break;case"scissorsoutline":e="✄";break;case"telephone":e="☏";break;case"telhandset":e="ὍE";break;case"handptlft1":e="☜";break;case"handptrt1":e="☞";break;case"handptlftsld1":e="☚";break;case"handptrtsld1":e="☛";break;case"handptup1":e="☝";break;case"handptdwn1":e="☟";break;case"xmark":e="✗";break;case"check":e="✓";break;case"boxcheck":e="☑";break;case"boxx":case"boxxbld":e="☒";break;case"circlex":e="=⌔";break;case"circlexbld":e="⌔";break;case"prohibit":case"prohibitbld":e="⦸";break;case"ampersanditaldm":case"ampersandbld":case"ampersandsans":case"ampersandsandm":e="&";break;case"interrobang":case"interrobangdm":case"interrobangsans":case"interrobngsandm":e="‽";break;case"sacute":e="ś";break;case"Sacute":e="Ś";break;case"eogonek":e="ę";break;case"cacute":e="ć";break;case"aogonek":e="ą";break;default:e=t}return e}function gt(t){var e;switch(t){case"zero":e="0";break;case"one":e="1";break;case"two":e="2";break;case"three":e="3";break;case"four":e="4";break;case"five":e="5";break;case"six":e="6";break;case"seven":e="7";break;case"eight":e="8";break;case"nine":e="9";break;case"aacute":e="á";break;case"asciicircum":e="^";break;case"asciitilde":e="~";break;case"asterisk":e="*";break;case"at":e="@";break;case"atilde":e="ã";break;case"backslash":e="\\";break;case"bar":e="|";break;case"braceleft":e="{";break;case"braceright":e="}";break;case"bracketleft":e="[";break;case"bracketright":e="]";break;case"breve":e="˘";break;case"brokenbar":e="|";break;case"bullet3":case"bullet":e="•";break;case"caron":e="ˇ";break;case"ccedilla":e="ç";break;case"cedilla":e="¸";break;case"cent":e="¢";break;case"circumflex":e="ˆ";break;case"colon":e=":";break;case"comma":e=",";break;case"copyright":e="©";break;case"currency1":e="¤";break;case"dagger":e="†";break;case"daggerdbl":e="‡";break;case"degree":e="°";break;case"dieresis":e="¨";break;case"divide":e="÷";break;case"dollar":e="$";break;case"dotaccent":e="˙";break;case"dotlessi":e="ı";break;case"eacute":e="é";break;case"middot":e="˙";break;case"edieresis":e="ë";break;case"egrave":e="è";break;case"ellipsis":e="...";break;case"emdash":e="—";break;case"endash":e="–";break;case"equal":e="=";break;case"eth":e="ð";break;case"exclam":e="!";break;case"exclamdown":e="¡";break;case"florin":e="ƒ";break;case"fraction":e="⁄";break;case"germandbls":e="ß";break;case"grave":e="`";break;case"greater":e=">";break;case"guillemotleft4":e="«";break;case"guillemotright4":e="»";break;case"guilsinglleft":e="‹";break;case"guilsinglright":e="›";break;case"hungarumlaut":e="˝";break;case"hyphen5":e="-";break;case"iacute":e="í";break;case"icircumflex":e="î";break;case"idieresis":e="ï";break;case"igrave":e="ì";break;case"less":e="<";break;case"logicalnot":e="¬";break;case"lslash":e="ł";break;case"Lslash":e="Ł";break;case"macron":e="¯";break;case"minus":e="−";break;case"mu":e="μ";break;case"multiply":e="×";break;case"ntilde":e="ñ";break;case"numbersign":e="#";break;case"oacute":e="ó";break;case"ocircumflex":e="ô";break;case"odieresis":e="ö";break;case"oe":e="oe";break;case"ogonek":e="˛";break;case"ograve":e="ò";break;case"onehalf":e="1/2";break;case"onequarter":e="1/4";break;case"onesuperior":e="¹";break;case"ordfeminine":e="ª";break;case"ordmasculine":e="º";break;case"otilde":e="õ";break;case"paragraph":e="¶";break;case"parenleft":e="(";break;case"parenright":e=")";break;case"percent":e="%";break;case"period":e=".";break;case"periodcentered":e="·";break;case"perthousand":e="‰";break;case"plus":e="+";break;case"plusminus":e="±";break;case"question":e="?";break;case"questiondown":e="¿";break;case"quotedbl":e="'";break;case"quotedblbase":e="„";break;case"quotedblleft":e="“";break;case"quotedblright":e="”";break;case"quoteleft":e="‘";break;case"quoteright":e="’";break;case"quotesinglbase":e="‚";break;case"quotesingle":e="'";break;case"registered":e="®";break;case"ring":e="˚";break;case"scaron":e="š";break;case"section":e="§";break;case"semicolon":e=";";break;case"slash":e="/";break;case"space6":case"space":e=" ";break;case"udieresis":e="ü";break;case"uacute":e="ú";break;case"Ecircumflex":e="Ê";break;case"hyphen":e="-";break;case"underscore":e="_";break;case"adieresis":e="ä";break;case"ampersand":e="&";break;case"Adieresis":e="Ä";break;case"Udieresis":e="Ü";break;case"ccaron":e="č";break;case"Scaron":e="Š";break;case"zcaron":e="ž";break;case"sterling":e="£";break;case"agrave":e="à";break;case"ecircumflex":e="ê";break;case"acircumflex":e="â";break;case"Oacute":e="Ó";break;default:e=t}return e}function yt(t){for(var e="",i=0;i<t.length;i++){var r=255&t.charCodeAt(i),n=String.fromCharCode(r),s="";switch(n){case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"{":case"}":case"/":case"#":e+="#",e+=1===(s=r.toString(16).toUpperCase()).length?"0"+s:s;break;default:r>126||r<37?(e+="#",e+=1===(s=r.toString(16).toUpperCase()).length?"0"+s:s):e+=n}}return e}function mt(t,e){return e?t.reviewHistory:t.comments}function bt(t){var e=t.get("F");return(t.has("State")||t.has("StateModel"))&&(30===e||128===e)}function vt(t){var e=t.get("F");return!(t.has("State")||t.has("StateModel")||28!==e&&128!==e)}function St(e,i){switch(e.has("F")&&(delete e._map.F,e._updated=!0),i){case t.PdfFormFieldVisibility.hidden:e.update("F",t.PdfAnnotationFlag.hidden);break;case t.PdfFormFieldVisibility.hiddenPrintable:e.update("F",t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print);break;case t.PdfFormFieldVisibility.visible:if(e.has("DV")&&(delete e._map.DV,e._updated=!0),e.has("MK")){var r=e.get("MK");r&&r.has("BG")&&(delete r._map.BG,r._updated=!0)}}}function wt(t,e,i){if(t&&t.has(i)){var r=t.getRaw(i);if(r&&r instanceof Pr&&r._isNew){var n=t.get(i);if(n){n instanceof Pr&&(n=e._fetch(n));var s=void 0;n instanceof Tr?s=n:n instanceof Cr&&(s=n.dictionary),s&&s.has("Resources")&&Pt(s.get("Resources"),e)}e._cacheMap.delete(r)}}}function Pt(t,e){t&&t.size>0&&t.forEach(function(i,r){if(void 0!==i&&void 0!==r)if(r instanceof Pr){var n=r;if(n._isNew){var s=t.get(i);s&&s instanceof Tr&&("XObject"===i&&s.has("Resources")&&Pt(s.get("Resources"),e),e._cacheMap.delete(n))}}else r instanceof Tr&&(r.has("Resources")&&Pt(r.get("Resources"),e),"Font"!==i&&"XObject"!==i&&"ExtGState"!==i||Pt(r,e))})}function At(t,e,i,r){var n;t&&(t instanceof Tr?n=t:t instanceof Rr&&(n=t.dictionary)),n&&(wt(n,e,i),wt(n,e,r))}function kt(t){return"[object String]"===Object.prototype.toString.call(t)?"$s"+t:"$o"+t.toString()}function xt(e,i,r){var n,s,a,o="";if((i&&i._dictionary.has("DA")||r._dictionary.has("DA"))&&(a=i&&i._dictionary.has("DA")?i._dictionary.get("DA"):r._dictionary.get("DA")),a&&""!==a&&-1!==a.indexOf("Tf"))for(var h=a.split(" "),c=0;c<h.length;c++)if(-1!==h[Number.parseInt(c.toString(),10)].indexOf("Tf")){for(o=h[c-2];""!==o&&o.length>1&&"/"===o[0];)o=o.substring(1);n=Number.parseFloat(h[c-1])}if(o&&(o=o.trim()),e&&e._dictionary.has("DR")){var _=e._dictionary.get("DR");if(_.has("Font")){var d=_.get("Font");if(d.has(o)){var p=d.get(o);if(p&&o&&p.has("BaseFont")){var l=p.get("BaseFont"),u=t.PdfFontStyle.regular;l&&(a=l.name,u=Tt(l.name),a.includes("-")&&(a=a.substring(0,a.indexOf("-"))),i&&i._dictionary.has("DA")?s=It(a,n,u,i):r&&r._dictionary.has("DA")&&(s=It(a,n,u,r)))}}}}return null!==s&&void 0!==s||!n||(s=new ke(t.PdfFontFamily.helvetica,n,t.PdfFontStyle.regular)),(null===s||void 0===s||s&&1===s.size)&&(i?s=i._circleCaptionFont:r&&(s=r._circleCaptionFont)),s}function Tt(e){var i=e.indexOf("-");i<0&&(i=e.indexOf(","));var r=t.PdfFontStyle.regular;if(i>=0)switch(e.substring(i+1,e.length)){case"Bold":case"BoldMT":r=t.PdfFontStyle.bold;break;case"Italic":case"ItalicMT":case"Oblique":case"It":r=t.PdfFontStyle.italic;break;case"BoldItalic":case"BoldItalicMT":case"BoldOblique":r=t.PdfFontStyle.bold|t.PdfFontStyle.italic}return r}function It(e,i,r,n){var s,a=e||"";a.includes("-")&&(a=a.substring(0,a.indexOf("-"))),void 0===i&&n instanceof yi&&n._isLoaded&&(i=10);var o=void 0!==i?i:1;if(n._dictionary.has("DS")||n._dictionary.has("DA"))switch(a){case"Helvetica":s=new ke(t.PdfFontFamily.helvetica,o,r);break;case"Courier":s=new ke(t.PdfFontFamily.courier,o,r);break;case"Symbol":s=new ke(t.PdfFontFamily.symbol,o,r);break;case"Times":case"TimesRoman":s=new ke(t.PdfFontFamily.timesRoman,o,r);break;case"ZapfDingbats":s=new ke(t.PdfFontFamily.zapfDingbats,o,r);break;case"MonotypeSungLight":s=new xe(t.PdfCjkFontFamily.monotypeSungLight,o,r);break;case"SinoTypeSongLight":s=new xe(t.PdfCjkFontFamily.sinoTypeSongLight,o,r);break;case"MonotypeHeiMedium":s=new xe(t.PdfCjkFontFamily.monotypeHeiMedium,o,r);break;case"HanyangSystemsGothicMedium":s=new xe(t.PdfCjkFontFamily.hanyangSystemsGothicMedium,o,r);break;case"HanyangSystemsShinMyeongJoMedium":s=new xe(t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium,o,r);break;case"HeiseiKakuGothicW5":s=new xe(t.PdfCjkFontFamily.heiseiKakuGothicW5,o,r);break;case"HeiseiMinchoW3":s=new xe(t.PdfCjkFontFamily.heiseiMinchoW3,o,r);break;default:if(n._dictionary.has("AP")){var h=Nt(n._dictionary,n._crossReference,n);if(n._hasData){var c=x(h);s=new Te(c,o,r)}}}return null!==s&&void 0!==s||(n instanceof fi?s=n._type!==t._PdfAnnotationType.widgetAnnotation?new ke(t.PdfFontFamily.helvetica,o,r):n._circleCaptionFont:n instanceof ri&&(s=n._circleCaptionFont)),s}function Nt(t,e,i){var r,n=t.get("AP");if(n&&n.has("N")){var s=n.get("N");if(s&&s instanceof Rr&&s.dictionary.has("Resources")){var a=s.dictionary.get("Resources");if(a&&a.has("Font")){var o=a.get("Font");o&&o instanceof Tr&&o.forEach(function(t,n){if(n){var s=e._fetch(n);if(s&&s.has("DescendantFonts")){var a=s.getArray("DescendantFonts");if(a&&a.length>0)for(var o=0;o<a.length;o++){var h=a[Number.parseInt(o.toString(),10)];if(h&&h instanceof Tr&&h.has("FontDescriptor")){var c=h.get("FontDescriptor");if(c&&c.has("FontFile2")){var _=c.get("FontFile2");_&&_ instanceof Rr&&_.length>0&&(r=_.getByteRange(_.start,_.end))&&r.length>0&&(i._hasData=!0)}}}}}})}}}return r}function Ct(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(!g(t[Number.parseInt(i.toString(),10)],e[Number.parseInt(i.toString(),10)]))return!1;return!0}function Rt(e,i){var r,n;if(e){var s=void 0;e.has(i)&&(s=e.getArray(i));var a=e._crossReference._document,o=void 0;if(s&&Array.isArray(s)&&s.length>0){var h=s[0],d=void 0,p=void 0,l=void 0,u=void 0,f=void 0;if("number"==typeof h){var g=s[0];if(g>=0){var y=e._crossReference._document;if(y&&y.pageCount>g&&(r=y.getPage(g)),s.length>1&&(o=s[1]),o&&"XYZ"===o.name&&(s.length>2&&(d=s[2]),s.length>3&&(p=s[3]),s.length>4&&(f=s[4]),r)){var m=null===p||void 0===p?0:r.size[1]-p,b=null===d||void 0===d?0:d;r.rotation!==t.PdfRotationAngle.angle0&&c(r,p,d),(n=new tr(r,[b,m]))._index=g,n.zoom=void 0!==f&&null!==f?f:0,null!==d&&null!==p&&null!==f&&void 0!==d&&void 0!==p&&void 0!==f||n._setValidation(!1)}}}if(h instanceof Tr){var v=h,S=void 0;if(a&&v&&(S=_(a,v)),void 0!==S&&null!==S&&S>=0&&(r=a.getPage(S)),s.length>1&&(o=s[1]),o)if("XYZ"===o.name){if(s.length>2&&(d=s[2]),s.length>3&&(p=s[3]),s.length>4&&(f=s[4]),r){var m=null===p||void 0===p?0:r.size[1]-p,b=null===d||void 0===d?0:d;r.rotation!==t.PdfRotationAngle.angle0&&(m=c(r,p,d)),(n=new tr(r,[b,m]))._index=S,n.zoom=void 0!==f&&null!==f?f:0,null!==d&&null!==p&&null!==f&&void 0!==d&&void 0!==p&&void 0!==f||n._setValidation(!1)}}else if("FitR"===o.name)s.length>2&&(d=s[2]),s.length>3&&(l=s[3]),s.length>4&&(u=s[4]),s.length>5&&(p=s[5]),r&&(d=null===d||void 0===d?0:d,l=null===l||void 0===l?0:l,p=null===p||void 0===p?0:p,(n=new tr(r,[d,l,u=null===u||void 0===u?0:u,p]))._index=S,n.mode=t.PdfDestinationMode.fitR);else if("FitBH"===o.name||"FitH"===o.name){if(s.length>=3&&(p=s[2]),void 0!==S&&null!==S&&S>=0&&(r=a.getPage(S)),r&&r.size){m=null===p||void 0===p?0:r.size[1]-p;(n=new tr(r,[0,m]))._index=S,n.mode=t.PdfDestinationMode.fitH,null!==p&&void 0!==p||n._setValidation(!1)}}else r&&"Fit"===o.name&&((n=new tr(r))._index=S,n.mode=t.PdfDestinationMode.fitToPage)}}}return n}function Ft(t,e){e&&(t._bounds={x:e[0],y:e[1],width:e[2],height:e[3]});var i;if(t._page&&t.bounds){if(i=[t.bounds.x,t.bounds.y+t.bounds.height,t.bounds.width,t.bounds.height],t._page._isNew&&t._page._pageSettings){var r=t._page._pageSettings,n=[r.margins.left,r.margins.top,r.size[0]-(r.margins.left+r.margins.right),r.size[1]-(r.margins.top+r.margins.bottom)];i[0]+=n[0],i[1]=r.size[1]-(n[1]+i[1])}else i=[t.bounds.x,t._page.size[1]-(t.bounds.y+t.bounds.height),t.bounds.width,t.bounds.height];return[i[0],i[1],i[0]+i[2],i[1]+i[3]]}return i}function Bt(t,e,i){if(t&&"string"==typeof t&&!e&&!i&&t.startsWith("þÿ")){(t=t.substring(2)).endsWith("ÿý")&&(t=t.substring(0,t.length-2));for(var r=u(t),n="",s=0;s<r.length;s+=2){var a=r[Number.parseInt(s.toString(),10)]<<8|r[Number.parseInt((s+1).toString(),10)];n+=String.fromCharCode(a)}t=n}return t}function Lt(t){return t<=4294967295?t<=65535?t<=255?1:2:t<=16777215?3:4:8}function Mt(){mr=Object.create(null),br=Object.create(null),vr=Object.create(null)}function Dt(t,e){return t instanceof Sr&&(void 0===e||t.name===e)}function Ot(t,e){return t instanceof wr&&(void 0===e||t.command===e)}!function(t){t[t.default=0]="default",t[t.invisible=1]="invisible",t[t.hidden=2]="hidden",t[t.print=4]="print",t[t.noZoom=8]="noZoom",t[t.noRotate=16]="noRotate",t[t.noView=32]="noView",t[t.readOnly=64]="readOnly",t[t.locked=128]="locked",t[t.toggleNoView=256]="toggleNoView"}(t.PdfAnnotationFlag||(t.PdfAnnotationFlag={})),function(t){t[t.none=0]="none",t[t.openArrow=1]="openArrow",t[t.closedArrow=2]="closedArrow",t[t.rOpenArrow=3]="rOpenArrow",t[t.rClosedArrow=4]="rClosedArrow",t[t.butt=5]="butt",t[t.diamond=6]="diamond",t[t.circle=7]="circle",t[t.square=8]="square",t[t.slash=9]="slash"}(t.PdfLineEndingStyle||(t.PdfLineEndingStyle={})),function(t){t[t.lineArrow=0]="lineArrow",t[t.lineDimension=1]="lineDimension"}(t.PdfLineIntent||(t.PdfLineIntent={})),function(t){t[t.inline=0]="inline",t[t.top=1]="top"}(t.PdfLineCaptionType||(t.PdfLineCaptionType={})),function(t){t[t.solid=0]="solid",t[t.dashed=1]="dashed",t[t.beveled=2]="beveled",t[t.inset=3]="inset",t[t.underline=4]="underline",t[t.dot=5]="dot"}(t.PdfBorderStyle||(t.PdfBorderStyle={})),function(t){t[t.solid=0]="solid",t[t.cloudy=1]="cloudy"}(t.PdfBorderEffectStyle||(t.PdfBorderEffectStyle={})),function(t){t[t.angle0=0]="angle0",t[t.angle90=1]="angle90",t[t.angle180=2]="angle180",t[t.angle270=3]="angle270"}(t.PdfRotationAngle||(t.PdfRotationAngle={})),function(t){t[t.table=0]="table",t[t.stream=1]="stream"}(t.PdfCrossReferenceType||(t.PdfCrossReferenceType={})),function(t){t[t.noHighlighting=0]="noHighlighting",t[t.invert=1]="invert",t[t.outline=2]="outline",t[t.push=3]="push"}(t.PdfHighlightMode||(t.PdfHighlightMode={})),function(t){t[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify"}(t.PdfTextAlignment||(t.PdfTextAlignment={})),function(t){t[t.visible=0]="visible",t[t.hidden=1]="hidden",t[t.visibleNotPrintable=2]="visibleNotPrintable",t[t.hiddenPrintable=3]="hiddenPrintable"}(t.PdfFormFieldVisibility||(t.PdfFormFieldVisibility={})),function(t){t[t.inch=0]="inch",t[t.pica=1]="pica",t[t.point=3]="point",t[t.centimeter=4]="centimeter",t[t.millimeter=6]="millimeter"}(t.PdfMeasurementUnit||(t.PdfMeasurementUnit={})),function(t){t[t.diameter=0]="diameter",t[t.radius=1]="radius"}(t.PdfCircleMeasurementType||(t.PdfCircleMeasurementType={})),function(t){t[t.approved=0]="approved",t[t.asIs=1]="asIs",t[t.confidential=2]="confidential",t[t.departmental=3]="departmental",t[t.draft=4]="draft",t[t.experimental=5]="experimental",t[t.expired=6]="expired",t[t.final=7]="final",t[t.forComment=8]="forComment",t[t.forPublicRelease=9]="forPublicRelease",t[t.notApproved=10]="notApproved",t[t.notForPublicRelease=11]="notForPublicRelease",t[t.sold=12]="sold",t[t.topSecret=13]="topSecret",t[t.completed=14]="completed",t[t.void=15]="void",t[t.informationOnly=16]="informationOnly",t[t.preliminaryResults=17]="preliminaryResults"}(t.PdfRubberStampAnnotationIcon||(t.PdfRubberStampAnnotationIcon={})),function(t){t[t.check=0]="check",t[t.circle=1]="circle",t[t.cross=2]="cross",t[t.diamond=3]="diamond",t[t.square=4]="square",t[t.star=5]="star"}(t.PdfCheckBoxStyle||(t.PdfCheckBoxStyle={})),function(t){t[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.squiggly=2]="squiggly",t[t.strikeOut=3]="strikeOut"}(t.PdfTextMarkupAnnotationType||(t.PdfTextMarkupAnnotationType={})),function(t){t[t.note=0]="note",t[t.comment=1]="comment",t[t.help=2]="help",t[t.insert=3]="insert",t[t.key=4]="key",t[t.newParagraph=5]="newParagraph",t[t.paragraph=6]="paragraph"}(t.PdfPopupIcon||(t.PdfPopupIcon={})),function(t){t[t.none=0]="none",t[t.accepted=1]="accepted",t[t.rejected=2]="rejected",t[t.cancel=3]="cancel",t[t.completed=4]="completed",t[t.marked=5]="marked",t[t.unmarked=6]="unmarked",t[t.unknown=7]="unknown"}(t.PdfAnnotationState||(t.PdfAnnotationState={})),function(t){t[t.none=0]="none",t[t.marked=1]="marked",t[t.review=2]="review"}(t.PdfAnnotationStateModel||(t.PdfAnnotationStateModel={})),function(t){t[t.pushPin=0]="pushPin",t[t.tag=1]="tag",t[t.graph=2]="graph",t[t.paperClip=3]="paperClip"}(t.PdfAttachmentIcon||(t.PdfAttachmentIcon={})),function(t){t[t.none=0]="none",t[t.freeTextCallout=1]="freeTextCallout",t[t.freeTextTypeWriter=2]="freeTextTypeWriter"}(t.PdfAnnotationIntent||(t.PdfAnnotationIntent={})),function(t){t[t.location=0]="location",t[t.fitToPage=1]="fitToPage",t[t.fitR=2]="fitR",t[t.fitH=3]="fitH"}(t.PdfDestinationMode||(t.PdfDestinationMode={})),function(t){t[t.fdf=0]="fdf",t[t.xfdf=1]="xfdf",t[t.json=2]="json",t[t.xml=3]="xml"}(t.DataFormat||(t.DataFormat={})),function(t){t[t.none=0]="none",t[t.row=1]="row",t[t.column=2]="column",t[t.structure=3]="structure",t[t.manual=4]="manual",t[t.widget=5]="widget"}(t.PdfFormFieldsTabOrder||(t.PdfFormFieldsTabOrder={})),function(t){t[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.strikeOut=2]="strikeOut",t[t.squiggly=3]="squiggly",t[t.redactionAnnotation=4]="redactionAnnotation",t[t.textAnnotation=5]="textAnnotation",t[t.linkAnnotation=6]="linkAnnotation",t[t.documentLinkAnnotation=7]="documentLinkAnnotation",t[t.uriAnnotation=8]="uriAnnotation",t[t.fileLinkAnnotation=9]="fileLinkAnnotation",t[t.freeTextAnnotation=10]="freeTextAnnotation",t[t.lineAnnotation=11]="lineAnnotation",t[t.circleAnnotation=12]="circleAnnotation",t[t.ellipseAnnotation=13]="ellipseAnnotation",t[t.squareAnnotation=14]="squareAnnotation",t[t.rectangleAnnotation=15]="rectangleAnnotation",t[t.polygonAnnotation=16]="polygonAnnotation",t[t.polyLineAnnotation=17]="polyLineAnnotation",t[t.textMarkupAnnotation=18]="textMarkupAnnotation",t[t.caretAnnotation=19]="caretAnnotation",t[t.rubberStampAnnotation=20]="rubberStampAnnotation",t[t.popupAnnotation=21]="popupAnnotation",t[t.fileAttachmentAnnotation=22]="fileAttachmentAnnotation",t[t.soundAnnotation=23]="soundAnnotation",t[t.movieAnnotation=24]="movieAnnotation",t[t.screenAnnotation=25]="screenAnnotation",t[t.widgetAnnotation=26]="widgetAnnotation",t[t.printerMarkAnnotation=27]="printerMarkAnnotation",t[t.trapNetworkAnnotation=28]="trapNetworkAnnotation",t[t.watermarkAnnotation=29]="watermarkAnnotation",t[t.textWebLinkAnnotation=30]="textWebLinkAnnotation",t[t.inkAnnotation=31]="inkAnnotation",t[t.richMediaAnnotation=32]="richMediaAnnotation",t[t.angleMeasurementAnnotation=33]="angleMeasurementAnnotation",t[t.null=34]="null"}(t._PdfAnnotationType||(t._PdfAnnotationType={})),function(t){t[t.centimeter=0]="centimeter",t[t.pica=1]="pica",t[t.pixel=2]="pixel",t[t.point=3]="point",t[t.inch=4]="inch",t[t.document=5]="document",t[t.millimeter=6]="millimeter"}(t._PdfGraphicsUnit||(t._PdfGraphicsUnit={})),function(t){t[t.default=0]="default",t[t.readOnly=1]="readOnly",t[t.required=2]="required",t[t.noExport=4]="noExport",t[t.multiLine=4096]="multiLine",t[t.password=8192]="password",t[t.fileSelect=1048576]="fileSelect",t[t.doNotSpellCheck=4194304]="doNotSpellCheck",t[t.doNotScroll=8388608]="doNotScroll",t[t.comb=16777216]="comb",t[t.richText=33554432]="richText",t[t.noToggleToOff=16384]="noToggleToOff",t[t.radio=32768]="radio",t[t.pushButton=65536]="pushButton",t[t.radiosInUnison=33554432]="radiosInUnison",t[t.combo=131072]="combo",t[t.edit=262144]="edit",t[t.sort=524288]="sort",t[t.multiSelect=2097152]="multiSelect",t[t.commitOnSelectChange=67108864]="commitOnSelectChange"}(t._FieldFlag||(t._FieldFlag={})),function(t){t[t.none=0]="none",t[t.signatureExists=1]="signatureExists",t[t.appendOnly=2]="appendOnly"}(t._SignatureFlag||(t._SignatureFlag={})),function(t){t[t.unchecked=0]="unchecked",t[t.checked=1]="checked",t[t.pressedUnchecked=2]="pressedUnchecked",t[t.pressedChecked=3]="pressedChecked"}(t._PdfCheckFieldState||(t._PdfCheckFieldState={})),function(t){t[t.default=0]="default",t[t.print=4]="print",t[t.editContent=8]="editContent",t[t.copyContent=16]="copyContent",t[t.editAnnotations=32]="editAnnotations",t[t.fillFields=256]="fillFields",t[t.accessibilityCopyContent=512]="accessibilityCopyContent",t[t.assembleDocument=1024]="assembleDocument",t[t.fullQualityPrint=2048]="fullQualityPrint"}(t.PdfPermissionFlag||(t.PdfPermissionFlag={})),function(t){t[t.portrait=0]="portrait",t[t.landscape=1]="landscape"}(t.PdfPageOrientation||(t.PdfPageOrientation={})),function(t){t[t.none=0]="none",t[t.leftToRight=1]="leftToRight",t[t.rightToLeft=2]="rightToLeft"}(t.PdfTextDirection||(t.PdfTextDirection={})),function(t){t[t.none=0]="none",t[t.superScript=1]="superScript",t[t.subScript=2]="subScript"}(t.PdfSubSuperScript||(t.PdfSubSuperScript={})),function(t){t[t.normal=0]="normal",t[t.multiply=1]="multiply",t[t.screen=2]="screen",t[t.overlay=3]="overlay",t[t.darken=4]="darken",t[t.lighten=5]="lighten",t[t.colorDodge=6]="colorDodge",t[t.colorBurn=7]="colorBurn",t[t.hardLight=8]="hardLight",t[t.softLight=9]="softLight",t[t.difference=10]="difference",t[t.exclusion=11]="exclusion",t[t.hue=12]="hue",t[t.saturation=13]="saturation",t[t.color=14]="color",t[t.luminosity=15]="luminosity"}(t.PdfBlendMode||(t.PdfBlendMode={})),function(t){t[t.winding=0]="winding",t[t.alternate=1]="alternate"}(t.PdfFillMode||(t.PdfFillMode={})),function(t){t[t.solid=0]="solid",t[t.dash=1]="dash",t[t.dot=2]="dot",t[t.dashDot=3]="dashDot",t[t.dashDotDot=4]="dashDotDot",t[t.custom=5]="custom"}(t.PdfDashStyle||(t.PdfDashStyle={})),function(t){t[t.flat=0]="flat",t[t.round=1]="round",t[t.square=2]="square"}(t.PdfLineCap||(t.PdfLineCap={})),function(t){t[t.miter=0]="miter",t[t.round=1]="round",t[t.bevel=2]="bevel"}(t.PdfLineJoin||(t.PdfLineJoin={})),function(t){t[t.none=0]="none",t[t.word=1]="word",t[t.wordOnly=2]="wordOnly",t[t.character=3]="character"}(t._PdfWordWrapType||(t._PdfWordWrapType={})),function(t){t[t.fixedPitch=1]="fixedPitch",t[t.serif=2]="serif",t[t.symbolic=4]="symbolic",t[t.script=8]="script",t[t.nonSymbolic=32]="nonSymbolic",t[t.italic=64]="italic",t[t.forceBold=262144]="forceBold"}(t._FontDescriptorFlag||(t._FontDescriptorFlag={})),function(t){t[t.apple=0]="apple",t[t.microsoft=4]="microsoft",t[t.trimmed=6]="trimmed"}(t._TrueTypeCmapFormat||(t._TrueTypeCmapFormat={})),function(t){t[t.unknown=0]="unknown",t[t.symbol=1]="symbol",t[t.unicode=2]="unicode",t[t.macintosh=3]="macintosh"}(t._TrueTypeCmapEncoding||(t._TrueTypeCmapEncoding={})),function(t){t[t.appleUnicode=0]="appleUnicode",t[t.macintosh=1]="macintosh",t[t.iSO=2]="iSO",t[t.microsoft=3]="microsoft"}(t._TrueTypePlatformID||(t._TrueTypePlatformID={})),function(t){t[t.undefined=0]="undefined",t[t.unicode=1]="unicode"}(t._TrueTypeMicrosoftEncodingID||(t._TrueTypeMicrosoftEncodingID={})),function(t){t[t.roman=0]="roman",t[t.japanese=1]="japanese",t[t.chinese=2]="chinese"}(t._TrueTypeMacintoshEncodingID||(t._TrueTypeMacintoshEncodingID={})),function(t){t[t.Arg1And2AreWords=1]="Arg1And2AreWords",t[t.ArgsAreXyValues=2]="ArgsAreXyValues",t[t.RoundXyToGrid=4]="RoundXyToGrid",t[t.WeHaveScale=8]="WeHaveScale",t[t.Reserved=16]="Reserved",t[t.MoreComponents=32]="MoreComponents",t[t.WeHaveAnXyScale=64]="WeHaveAnXyScale",t[t.WeHaveTwoByTwo=128]="WeHaveTwoByTwo",t[t.WeHaveInstructions=256]="WeHaveInstructions",t[t.UseMyMetrics=512]="UseMyMetrics"}(t._TrueTypeCompositeGlyphFlag||(t._TrueTypeCompositeGlyphFlag={})),function(t){t[t.unknown=0]="unknown",t[t.bmp=1]="bmp",t[t.emf=2]="emf",t[t.gif=3]="gif",t[t.jpeg=4]="jpeg",t[t.png=5]="png",t[t.wmf=6]="wmf",t[t.icon=7]="icon"}(t._ImageFormat||(t._ImageFormat={})),function(t){t[t.none=0]="none",t[t.comment=1]="comment",t[t.number=2]="number",t[t.real=3]="real",t[t.string=4]="string",t[t.hexString=5]="hexString",t[t.unicodeString=6]="unicodeString",t[t.unicodeHexString=7]="unicodeHexString",t[t.name=8]="name",t[t.operator=9]="operator",t[t.beginArray=10]="beginArray",t[t.endArray=11]="endArray",t[t.eof=12]="eof"}(t._TokenType||(t._TokenType={})),function(t){t[t.regular=0]="regular",t[t.italic=1]="italic",t[t.bold=2]="bold"}(t.PdfTextStyle||(t.PdfTextStyle={})),function(t){t[t.rgb=0]="rgb",t[t.cmyk=1]="cmyk",t[t.grayScale=2]="grayScale",t[t.indexed=3]="indexed"}(t._PdfColorSpace||(t._PdfColorSpace={}));var Et=function(){function t(t){this._newLine="\r\n",this._whiteSpace=" ",this._stream=t}return t.prototype._writeOperator=function(t){this._stream.write(t),this._stream.write(this._newLine)},t.prototype._saveGraphicsState=function(){this._writeOperator("q")},t.prototype._restoreGraphicsState=function(){this._writeOperator("Q")},t.prototype._writeComment=function(t){t&&t.length>0&&this._writeOperator("% "+t)},t.prototype._setGraphicsState=function(t){this._stream.write("/"+K(t.name)+" "),this._writeOperator("gs")},t.prototype._modifyCtm=function(t){this._stream.write(t._toString()+" "),this._writeOperator("cm")},t.prototype._modifyTM=function(t){this._stream.write(t._toString()+" "),this._writeOperator("Tm")},t.prototype._setColorSpace=function(t,e){this._stream.write("/"+t+" "),this._writeOperator(e?"CS":"cs")},t.prototype._setColor=function(t,e){this._stream.write((t[0]/255).toFixed(3)+" "+(t[1]/255).toFixed(3)+" "+(t[2]/255).toFixed(3)+" "),this._writeOperator(e?"RG":"rg")},t.prototype._appendRectangle=function(t,e,i,r){this._writePoint(t,e),this._writePoint(i,r),this._writeOperator("re")},t.prototype._writePoint=function(t,e){this._stream.write(t.toFixed(3)+" "+(-e).toFixed(3)+" ")},t.prototype._clipPath=function(t){this._stream.write((t?"W*":"W")+" n"+this._newLine)},t.prototype._fillPath=function(t){this._writeOperator(t?"f*":"f")},t.prototype._closeFillPath=function(t){this._writeOperator("h"),this._fillPath(t)},t.prototype._strokePath=function(){this._writeOperator("S")},t.prototype._closeStrokePath=function(){this._writeOperator("s")},t.prototype._fillStrokePath=function(t){this._writeOperator(t?"B*":"B")},t.prototype._closeFillStrokePath=function(t){this._writeOperator(t?"b*":"b")},t.prototype._endPath=function(){this._writeOperator("n")},t.prototype._setFont=function(t,e){this._stream.write("/"+t+" "+e.toFixed(3)+" "),this._writeOperator("Tf")},t.prototype._setTextScaling=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tz")},t.prototype._closePath=function(){this._writeOperator("h")},t.prototype._startNextLine=function(t,e){void 0===t?this._writeOperator("T*"):(this._writePoint(t,e),this._writeOperator("Td"))},t.prototype._showText=function(t){this._writeText(t),this._writeOperator("Tj")},t.prototype._write=function(t){var e="";e+=t,e+="\r\n",this._writeOperator(e)},t.prototype._writeText=function(t){for(var e="",i=this._escapeSymbols(t),r=0;r<i.length;r++)e+=String.fromCharCode(i[r]);e="("+e+")",this._stream.write(e)},t.prototype._beginText=function(){this._writeOperator("BT")},t.prototype._endText=function(){this._writeOperator("ET")},t.prototype._beginPath=function(t,e){this._writePoint(t,e),this._writeOperator("m")},t.prototype._appendLineSegment=function(t,e){this._writePoint(t,e),this._writeOperator("l")},t.prototype._appendBezierSegment=function(t,e,i,r,n,s){this._writePoint(t,e),this._writePoint(i,r),this._writePoint(n,s),this._writeOperator("c")},t.prototype._setTextRenderingMode=function(t){this._stream.write(t.toString()+" "),this._writeOperator("Tr")},t.prototype._setCharacterSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tc")},t.prototype._setWordSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tw")},t.prototype._showNextLineText=function(t,e){null!==e&&void 0!==e&&e?(this._writeText(t),this._writeOperator("'")):(this._stream.write(t),this._writeOperator("'"))},t.prototype._setLineDashPattern=function(t,e){var i="[";if(t.length>1)for(var r=0;r<t.length;r++)r===t.length-1?i+=t[r].toString():i+=t[r].toString()+" ";i+="] ",i+=e.toString(),i+=" d",this._writeOperator(i)},t.prototype._setMiterLimit=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("M")},t.prototype._setLineWidth=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("w")},t.prototype._setLineCap=function(t){this._stream.write(t+" "),this._writeOperator("J")},t.prototype._setLineJoin=function(t){this._stream.write(t+" "),this._writeOperator("j")},t.prototype._executeObject=function(t){this._stream.write("/"+t.name+" "),this._writeOperator("Do")},t.prototype._beginMarkupSequence=function(t){this._stream.write("/"+t+" "),this._writeOperator("BMC")},t.prototype._endMarkupSequence=function(){this._writeOperator("EMC")},t.prototype._clear=function(){this._stream._bytes=[]},t.prototype._escapeSymbols=function(t){for(var e=[],i=0;i<t.length;i++){var r=t.charCodeAt(i);switch(r){case 40:case 41:e.push(92),e.push(r);break;case 13:e.push(92),e.push(114);break;case 92:e.push(92),e.push(r);break;default:e.push(r)}}return e},t}(),Vt=function(){function e(e,i){this.horizontalScalingFactor=100,this.rightToLeft=!1,this._wordWrapType=t._PdfWordWrapType.word,this.lineLimit=!0,void 0!==e&&(this.alignment=e),this.lineAlignment=void 0!==i?i:t.PdfVerticalAlignment.top,this.characterSpacing=0,this.wordSpacing=0,this.lineSpacing=0,this.clipPath=!1,this.firstLineIndent=0,this._internalParagraphIndent=0,this.measureTrailingSpaces=!1,this.noClip=!1}return Object.defineProperty(e.prototype,"paragraphIndent",{get:function(){return this._internalParagraphIndent},set:function(t){this._internalParagraphIndent=t,this.firstLineIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subSuperScript",{get:function(){return void 0===this._pdfSubSuperScript||null===this._pdfSubSuperScript?t.PdfSubSuperScript.none:this._pdfSubSuperScript},set:function(t){this._pdfSubSuperScript=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_wordWrap",{get:function(){return this._wordWrapType},set:function(t){this._wordWrapType=t},enumerable:!0,configurable:!0}),e}();!function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(t.PdfVerticalAlignment||(t.PdfVerticalAlignment={}));var jt=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),zt=function(){function e(){this._lineGap=0}return e.prototype._getAscent=function(t){return.001*this._ascent*this._getSize(t)},e.prototype._getDescent=function(t){return.001*this._descent*this._getSize(t)},e.prototype._getLineGap=function(t){return.001*this._lineGap*this._getSize(t)},e.prototype._getHeight=function(t){for(var e=["cambria","candara","constantia","corbel","cariadings"],i=[],r=0;r<e.length;r++)i.push(e[Number.parseInt(r.toString(),10)]);return this._getDescent(t)<0?this._getAscent(t)-this._getDescent(t)+this._getLineGap(t):this._getAscent(t)+this._getDescent(t)+this._getLineGap(t)},e.prototype._getSize=function(e){var i=this._size;if(null!==e&&void 0!==e)switch(e.subSuperScript){case t.PdfSubSuperScript.subScript:i/=this._subScriptSizeFactor;break;case t.PdfSubSuperScript.superScript:i/=this._superscriptSizeFactor}return i},e}(),Ut=function(){function t(){}return t}(),Wt=function(t){function e(e){var i=t.call(this)||this;return i.widths=e,i}return jt(e,t),e.prototype._itemAt=function(t){if(t<0||t>=this.widths.length)throw new Error("The character is not supported by the font.");return this.widths[Number.parseInt(t.toString(),10)]},e.prototype._toArray=function(){return this.widths},e}(Ut),Ht=function(t){function e(e){var i=t.call(this)||this;return i._defaultWidth=e,i.widths=[],i}return jt(e,t),e.prototype._itemAt=function(t){var e=this._defaultWidth;return this.widths.forEach(function(i){t>=i._from&&t<=i._to&&(e=i._itemAt(t))}),e},e.prototype._toArray=function(){var t=[];return this.widths.forEach(function(e){e._appendToArray(t)}),t},e.prototype._add=function(t){this.widths.push(t)},e}(Ut),Gt=function(){function t(){}return t}(),Kt=function(t){function e(e,i,r){var n=t.call(this)||this;return n._widthFrom=e,n._widthTo=i,n._width=r,n}return jt(e,t),Object.defineProperty(e.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_to",{get:function(){return this._widthTo},enumerable:!0,configurable:!0}),e.prototype._itemAt=function(t){if(t<this._from||t>this._to)throw new Error("Index is out of range.");return this._width},e.prototype._appendToArray=function(t){t.push(this._from,this._to,this._width)},e}(Gt),qt=function(t){function e(e,i){var r=t.call(this)||this;return r._widthFrom=e,r._widths=i,r}return jt(e,t),Object.defineProperty(e.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_to",{get:function(){return this._widthFrom+this._widths.length-1},enumerable:!0,configurable:!0}),e.prototype._itemAt=function(t){if(t<this._widthFrom||t>this._to)throw new Error("Index is out of range.");return this._widths[Number.parseInt(t.toString(),10)]},e.prototype._appendToArray=function(t){t.push(this._from),t.forEach(function(e){t.push(e)})},e}(Gt),Xt=function(){function e(){}return e.prototype._layout=function(t,e,i,r){this._initialize(t,e,i,r);var n=this._doLayout();return this._clear(),n},e.prototype._initialize=function(t,e,i,r){this._font=e,this._format=i,this._size=r,this._rectangle=[0,0,r[0],r[1]],this._reader=new Yt(t),this._pageHeight=0},e.prototype._clear=function(){this._font=null,this._format=null,this._reader._close(),this._reader=null},e.prototype._doLayout=function(){for(var t=new Jt,e=new Jt,i=[],r=this._reader._peekLine(),n=this._getLineIndent(!0);null!==r;){if(void 0!==(e=this._layoutLine(r,n))&&null!==e){var s=0,a=this._copyToResult(t,e,i,s),o=a.success;if(s=a.flag,!o){this._reader._read(s);break}}this._reader._readLine(),r=this._reader._peekLine(),n=this._getLineIndent(!1)}return this._finalizeResult(t,i),t},e.prototype._getLineIndent=function(t){var e=0;return this._format&&(e=t?this._format.firstLineIndent:this._format.paragraphIndent,e=this._size[0]>0?Math.min(this._size[0],e):e),e},e.prototype._getLineHeight=function(){var t=this._font._metrics._getHeight();return this._format&&0!==this._format.lineSpacing&&(t=this._format.lineSpacing+this._font._metrics._getHeight()),t},e.prototype._getLineWidth=function(t){return this._font.getLineWidth(t,this._format)},e.prototype._layoutLine=function(e,i){var r=new Jt;r._lineHeight=this._getLineHeight();var n=[],s=this._size[0],a=this._getLineWidth(e)+i,o=t._LineType.firstParagraphLine,h=!0;if(s<=0||Math.round(a)<=Math.round(s))this._addToLineResult(r,n,e,a,t._LineType.newLineBreak|o);else{var c="",_="";a=i;var d=i,p=new Yt(e),l=p._peekWord();for(l.length!==p._length&&" "===l&&(_+=l,c+=l,p._position+=1,l=p._peekWord());null!==l;){_+=l;var u=this._getLineWidth(_.toString())+d;if(" "===_.toString()&&(_="",u=0),u>s){if(this._getWrapType()===t._PdfWordWrapType.none)break;if(_.length===l.length){if(this._getWrapType()===t._PdfWordWrapType.wordOnly){r._remainder=e.substring(p._position);break}if(1===_.length){c+=l;break}h=!1,_="",l=p._peek().toString();continue}if(this._getLineWidth(l.toString())>s?void 0!==this._format&&null!==this._format&&(this._format._wordWrap=t._PdfWordWrapType.character):void 0!==this._format&&null!==this._format&&(this._format._wordWrap=t._PdfWordWrapType.word),this._getWrapType()===t._PdfWordWrapType.character&&h)h=!1,_="",_+=c.toString(),l=p._peek().toString();else{var f=c.toString();" "!==f&&this._addToLineResult(r,n,f,a,t._LineType.layoutBreak|o),_="",c="",a=0,d=0,u=0,o=t._LineType.none,l=h?l:p._peekWord(),h=!0}}else c+=l,a=u,h?(p._readWord(),l=p._peekWord()):(p._read(),l=p._peek().toString())}c.length>0&&this._addToLineResult(r,n,c.toString(),a,t._LineType.newLineBreak|t._LineType.lastParagraphLine),p._close()}r._layoutLines=[];for(var g=0;g<n.length;g++)r._layoutLines.push(n[g]);return n=[],r},e.prototype._addToLineResult=function(t,e,i,r,n){var s=new Qt;s._text=i,s._width=r,s._lineType=n,e.push(s);var a=t._actualSize;a[1]=a[1]+this._getLineHeight(),a[0]=Math.max(a[0],r),t._size=a},e.prototype._copyToResult=function(t,e,i,r){var n=!0,s=this._format&&!this._format.lineLimit,a=t._actualSize[1],o=this._size[1];if(this._pageHeight>0&&o+this._rectangle[1]>this._pageHeight&&(o=this._rectangle[1]-this._pageHeight,o=Math.max(o,-o)),r=0,null!==e._lines)for(var h=0,c=e._lines.length;h<c;h++){var _=a+e._lineHeight;if(!(_<=o||o<=0||s)){n=!1;break}var d=e._lines[h];r+=d._text.length,d=this._trimLine(d,0===i.length),i.push(d);var p=t._actualSize;p[0]=Math.max(p[0],d._width),t._size=p,a=_}return a!==t._size[1]&&(t._size=[t._actualSize[0],a]),{success:n,flag:r}},e.prototype._finalizeResult=function(t,e){t._layoutLines=[];for(var i=0;i<e.length;i++)t._layoutLines.push(e[i]);t._lineHeight=this._getLineHeight(),this._reader._end||(t._remainder=this._reader._readToEnd()),e=[]},e.prototype._trimLine=function(e,i){var r=e._text.trim(),n=e._width;return r.length!==e._text.length&&(n=this._getLineWidth(r),(e._lineType&t._LineType.firstParagraphLine)>0&&(n+=this._getLineIndent(i))),e._text=r,e._width=n,e},e.prototype._getWrapType=function(){return null!==this._format&&void 0!==this._format?this._format._wordWrap:t._PdfWordWrapType.word},e}(),Jt=function(){function t(){}return Object.defineProperty(t.prototype,"_actualSize",{get:function(){return void 0===this._size&&(this._size=[0,0]),this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lines",{get:function(){return this._layoutLines},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_empty",{get:function(){return null===this._layoutLines||0===this._layoutLines.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lineCount",{get:function(){return this._empty?0:this._layoutLines.length},enumerable:!0,configurable:!0}),t}(),Qt=function(){function t(){}return t}();!function(t){t[t.none=0]="none",t[t.newLineBreak=1]="newLineBreak",t[t.layoutBreak=2]="layoutBreak",t[t.firstParagraphLine=4]="firstParagraphLine",t[t.lastParagraphLine=8]="lastParagraphLine"}(t._LineType||(t._LineType={}));var Yt=function(){function t(t){if(this._position=0,void 0===t||null===t)throw new Error("ArgumentNullException:text");this._text=t}return Object.defineProperty(t.prototype,"_length",{get:function(){return this._text.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_end",{get:function(){return this._position===this._text.length},enumerable:!0,configurable:!0}),t.prototype._readLine=function(){for(var t=this._position;t<this._length;){var e=this._text[t],i=void 0;switch(e){case"\r":case"\n":return i=this._text.substring(this._position,t),this._position=t+1,"\r"===e&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,i}t++}if(t>this._position){var r=this._text.substring(this._position,t);return this._position=t,r}return null},t.prototype._peekLine=function(){var t=this._position,e=this._readLine();return this._position=t,e},t.prototype._readWord=function(){for(var t=this._position;t<this._length;){var e=this._text[t],i=void 0;switch(e){case"\r":case"\n":return i=this._text.substring(this._position,t-this._position),this._position=t+1,"\r"===e&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,i;case" ":case"\t":return t===this._position&&t++,i=this._text.substring(this._position,t),this._position=t,i}t++}if(t>this._position){var r=this._text.substring(this._position,t);return this._position=t,r}return null},t.prototype._peekWord=function(){var t=this._position,e=this._readWord();return this._position=t,e},t.prototype._read=function(t){if(void 0===t){var e="0";return this._end||(e=this._text[this._position],this._position++),e}for(var i=0,r="";!this._end&&i<t;)r+=this._read(),i++;return r},t.prototype._peek=function(){return this._end?"0":this._text[this._position]},t.prototype._close=function(){this._text=null},t.prototype._readToEnd=function(){var t;return t=0===this._position?this._text:this._text.substring(this._position),this._position=this._length,t},t._whiteSpace=" ",t._tab="\t",t._spaces=[t._whiteSpace,t._tab],t}(),Zt=function(){function t(){}return Object.defineProperty(t.prototype,"_empty",{get:function(){return this._offset===this._length&&this._length===this._checksum&&0===this._checksum},enumerable:!0,configurable:!0}),t}(),$t=function(){function t(){}return t}(),te=function(){function t(){}return t}(),ee=function(){function t(){}return t}(),ie=function(){function t(){}return t}(),re=function(){function t(){}return t}(),ne=function(){function t(){}return t}(),se=function(){function t(){}return t}(),ae=function(){function t(){}return t}(),oe=function(){function t(){}return t}(),he=function(){function t(){}return t}(),ce=function(){function e(t){this._int32Size=4,this._isFont=!1,this._isMacTtf=!1,this._isMacFont=!1,this._missedGlyphs=0,this._tableNames=["cvt ","fpgm","glyf","head","hhea","hmtx","loca","maxp","prep"],this._entrySelectors=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4],this._fontData=t,this._initialize()}return Object.defineProperty(e.prototype,"macintosh",{get:function(){return null!==this._macintoshDictionary&&void 0!==this._macintoshDictionary||(this._macintoshDictionary=new xr),this._macintoshDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoft",{get:function(){return null!==this._microsoftDictionary&&void 0!==this._microsoftDictionary||(this._microsoftDictionary=new xr),this._microsoftDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_macintoshGlyphs",{get:function(){return null!==this._internalMacintoshGlyphs&&void 0!==this._internalMacintoshGlyphs||(this._internalMacintoshGlyphs=new xr),this._internalMacintoshGlyphs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoftGlyphs",{get:function(){return null!==this._internalMicrosoftGlyphs&&void 0!==this._internalMicrosoftGlyphs||(this._internalMicrosoftGlyphs=new xr),this._internalMicrosoftGlyphs},enumerable:!0,configurable:!0}),e.prototype._initialize=function(){void 0!==this._metrics&&null!==this._metrics||(this._metrics=new de),this._readFontDictionary();var t=this._readNameTable(),e=this._readHeadTable();this._initializeFontName(t),this._metrics._macStyle=e._macStyle},e.prototype._readFontDictionary=function(){this._offset=0,this._check();var t=this._readInt16(this._offset);this._readInt16(this._offset),this._readInt16(this._offset),this._readInt16(this._offset),void 0!==this._tableDirectory&&null!==this._tableDirectory||(this._tableDirectory=new xr);for(var e=0;e<t;++e){var i=new Zt,r=this._readString(this._int32Size);i._checksum=this._readInt32(this._offset),i._offset=this._readInt32(this._offset),i._length=this._readInt32(this._offset),this._tableDirectory.setValue(r,i)}this._lowestPosition=this._offset,this._isFont||this._fixOffsets()},e.prototype._fixOffsets=function(){for(var t=Number.MAX_VALUE,e=this._tableDirectory.keys(),i=0;i<e.length;i++){var r=(a=this._tableDirectory.getValue(e[Number.parseInt(i.toString(),10)]))._offset;if(t>r&&(t=r)<=this._lowestPosition)break}var n=t-this._lowestPosition;if(0!==n){for(var s=new xr,i=0;i<e.length;i++){var a=this._tableDirectory.getValue(e[Number.parseInt(i.toString(),10)]);a._offset-=n,s.setValue(e[Number.parseInt(i.toString(),10)],a)}this._tableDirectory=s}},e.prototype._check=function(){var t=this._readInt32(this._offset);if(this._isMacTtf=1953658213===t,65536!==t&&1953658213!==t&&1330926671!==t){if(this._isFont=!0,this._offset=0,"ttcf"!==this._readString(4))throw new Error("Can not read TTF font data");if(this._offset+=4,this._readInt32(this._offset)<0)throw new Error("Can not read TTF font data");this._offset=this._readInt32(this._offset),t=this._readInt32(this._offset)}return t},e.prototype._readNameTable=function(){var t=this._getTable("name");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new ee;e._formatSelector=this._readUInt16(this._offset),e._recordsCount=this._readUInt16(this._offset),e._offset=this._readUInt16(this._offset),e._nameRecords=[];for(var i=this._offset,r=0;r<e._recordsCount;r++){this._offset=i;var n=new _e;n._platformID=this._readUInt16(this._offset),n._encodingID=this._readUInt16(this._offset),n._languageID=this._readUInt16(this._offset),n._nameID=this._readUInt16(this._offset),n._length=this._readUInt16(this._offset),n._offset=this._readUInt16(this._offset),this._offset=t._offset+e._offset+n._offset;var s=0===n._platformID||3===n._platformID;n._name=this._readString(n._length,s),e._nameRecords[Number.parseInt(r.toString(),10)]=n,i+=12}return e},e.prototype._readHeadTable=function(){var t=this._getTable("head");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new ne;return e._version=this._readFixed(this._offset),e._fontRevision=this._readFixed(this._offset),e._checkSumAdjustment=this._readUInt32(this._offset),e._magicNumber=this._readUInt32(this._offset),e._flags=this._readUInt16(this._offset),e._unitsPerEm=this._readUInt16(this._offset),e._created=this._readInt64(this._offset),e._modified=this._readInt64(this._offset),e._xMin=this._readInt16(this._offset),e._yMin=this._readInt16(this._offset),e._xMax=this._readInt16(this._offset),e._yMax=this._readInt16(this._offset),e._macStyle=this._readUInt16(this._offset),e._lowestReadableSize=this._readUInt16(this._offset),e._fontDirectionHint=this._readInt16(this._offset),e._indexToLocalFormat=this._readInt16(this._offset),e._glyphDataFormat=this._readInt16(this._offset),e},e.prototype._readHorizontalHeaderTable=function(){var t=this._getTable("hhea");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new re;return e._version=this._readFixed(this._offset),e._ascender=this._readInt16(this._offset),e._descender=this._readInt16(this._offset),e._lineGap=this._readInt16(this._offset),e._advanceWidthMax=this._readUInt16(this._offset),e._minLeftSideBearing=this._readInt16(this._offset),e._minRightSideBearing=this._readInt16(this._offset),e._xMaxExtent=this._readInt16(this._offset),e._caretSlopeRise=this._readInt16(this._offset),e._caretSlopeRun=this._readInt16(this._offset),this._offset+=10,e._metricDataFormat=this._readInt16(this._offset),e._numberOfHMetrics=this._readUInt16(this._offset),e},e.prototype._readOS2Table=function(){var t=this._getTable("OS/2");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new $t;return e._version=this._readUInt16(this._offset),e._xAvgCharWidth=this._readInt16(this._offset),e._usWeightClass=this._readUInt16(this._offset),e._usWidthClass=this._readUInt16(this._offset),e._fsType=this._readInt16(this._offset),e._ySubscriptXSize=this._readInt16(this._offset),e._ySubscriptYSize=this._readInt16(this._offset),e._ySubscriptXOffset=this._readInt16(this._offset),e._ySubscriptYOffset=this._readInt16(this._offset),e._ySuperscriptXSize=this._readInt16(this._offset),e._ySuperscriptYSize=this._readInt16(this._offset),e._ySuperscriptXOffset=this._readInt16(this._offset),e._ySuperscriptYOffset=this._readInt16(this._offset),e._yStrikeoutSize=this._readInt16(this._offset),e._yStrikeoutPosition=this._readInt16(this._offset),e._sFamilyClass=this._readInt16(this._offset),e._panose=this._readBytes(10),e._ulUnicodeRange1=this._readUInt32(this._offset),e._ulUnicodeRange2=this._readUInt32(this._offset),e._ulUnicodeRange3=this._readUInt32(this._offset),e._ulUnicodeRange4=this._readUInt32(this._offset),e._vendorIdentifier=this._readBytes(4),e._fsSelection=this._readUInt16(this._offset),e._usFirstCharIndex=this._readUInt16(this._offset),e._usLastCharIndex=this._readUInt16(this._offset),e._sTypoAscender=this._readInt16(this._offset),e._sTypoDescender=this._readInt16(this._offset),e._sTypoLineGap=this._readInt16(this._offset),e._usWinAscent=this._readUInt16(this._offset),e._usWinDescent=this._readUInt16(this._offset),e._ulCodePageRange1=this._readUInt32(this._offset),e._ulCodePageRange2=this._readUInt32(this._offset),e._version>1?(e._sxHeight=this._readInt16(this._offset),e._sCapHeight=this._readInt16(this._offset),e._usDefaultChar=this._readUInt16(this._offset),e._usBreakChar=this._readUInt16(this._offset),e._usMaxContext=this._readUInt16(this._offset)):(e._sxHeight=0,e._sCapHeight=0,e._usDefaultChar=0,e._usBreakChar=0,e._usMaxContext=0),e},e.prototype._readPostTable=function(){var t=this._getTable("post");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new te;return e._formatType=this._readFixed(this._offset),e._italicAngle=this._readFixed(this._offset),e._underlinePosition=this._readInt16(this._offset),e._underlineThickness=this._readInt16(this._offset),e._isFixedPitch=this._readUInt32(this._offset),e._minType42=this._readUInt32(this._offset),e._maxType42=this._readUInt32(this._offset),e._minType1=this._readUInt32(this._offset),e._maxType1=this._readUInt32(this._offset),e},e.prototype._readWidthTable=function(t,e){var i=this._getTable("hmtx");void 0!==i._offset&&null!==i._offset&&(this._offset=i._offset);for(var r=[],n=0;n<t;n++){var s=new pe;s._advanceWidth=this._readUInt16(this._offset),s._lsb=this._readInt16(this._offset);var a=1e3*s._advanceWidth/e;r.push(Math.floor(a))}return r},e.prototype._readCmapTable=function(){var t=this._getTable("cmap");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new se;e._version=this._readUInt16(this._offset),e._tablesCount=this._readUInt16(this._offset);for(var i=this._offset,r=[],n=0;n<e._tablesCount;n++){this._offset=i;var s=new ae;s._platformID=this._readUInt16(this._offset),s._encodingID=this._readUInt16(this._offset),s._offset=this._readUInt32(this._offset),i=this._offset,this._readCmapSubTable(s),r[Number.parseInt(n.toString(),10)]=s}return r},e.prototype._readCmapSubTable=function(e){var i=this._getTable("cmap");this._offset=i._offset+e._offset;var r=this._readUInt16(this._offset),n=this._getCmapEncoding(e._platformID,e._encodingID);if(n!==t._TrueTypeCmapEncoding.unknown)switch(r){case t._TrueTypeCmapFormat.apple:this._readAppleCmapTable(e,n);break;case t._TrueTypeCmapFormat.microsoft:this._readMicrosoftCmapTable(e,n);break;case t._TrueTypeCmapFormat.trimmed:this._readTrimmedCmapTable(e,n)}},e.prototype._readAppleCmapTable=function(t,e){var i=this._getTable("cmap");this._offset=i._offset+t._offset;var r=new oe;r._format=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._version=this._readUInt16(this._offset),null!==this._maxMacIndex&&void 0!==this._maxMacIndex||(this._maxMacIndex=0);for(var n=0;n<256;++n){var s=new le;s._index=this._readByte(this._offset),s._width=this._getWidth(s._index),s._charCode=n,this.macintosh.setValue(n,s),this._addGlyph(s,e),this._maxMacIndex=Math.max(n,this._maxMacIndex)}},e.prototype._readMicrosoftCmapTable=function(e,i){var r=this._getTable("cmap");this._offset=r._offset+e._offset;var n=i===t._TrueTypeCmapEncoding.unicode?this._microsoft:this.macintosh,s=new ie;s._format=this._readUInt16(this._offset),s._length=this._readUInt16(this._offset),s._version=this._readUInt16(this._offset),s._segCountX2=this._readUInt16(this._offset),s._searchRange=this._readUInt16(this._offset),s._entrySelector=this._readUInt16(this._offset),s._rangeShift=this._readUInt16(this._offset);var a=s._segCountX2/2;s._endCount=this._readUShortArray(a),s._reservedPad=this._readUInt16(this._offset),s._startCount=this._readUShortArray(a),s._idDelta=this._readUShortArray(a),s._idRangeOffset=this._readUShortArray(a);var o=s._length/2-8-4*a;s._glyphID=this._readUShortArray(o);for(var h=0,c=0,_=0;_<a;_++)for(var d=s._startCount[Number.parseInt(_.toString(),10)];d<=s._endCount[Number.parseInt(_.toString(),10)]&&65535!==d;d++){if(0===s._idRangeOffset[Number.parseInt(_.toString(),10)])h=d+s._idDelta[Number.parseInt(_.toString(),10)]&65535;else{if((c=_+s._idRangeOffset[Number.parseInt(_.toString(),10)]/2-a+d-s._startCount[Number.parseInt(_.toString(),10)])>=s._glyphID.length)continue;h=s._glyphID[Number.parseInt(c.toString(),10)]+s._idDelta[Number.parseInt(_.toString(),10)]&65535}var p=new le;p._index=h,p._width=this._getWidth(p._index);var l=i===t._TrueTypeCmapEncoding.symbol&&61440==(65280&d)?255&d:d;p._charCode=l,n.setValue(l,p),this._addGlyph(p,i)}},e.prototype._readTrimmedCmapTable=function(t,e){var i=this._getTable("cmap");this._offset=i._offset+t._offset;var r=new he;r._format=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._version=this._readUInt16(this._offset),r._firstCode=this._readUInt16(this._offset),r._entryCount=this._readUInt16(this._offset);for(var n=0;n<r._entryCount;++n){var s=new le;s._index=this._readUInt16(this._offset),s._width=this._getWidth(s._index),s._charCode=n+r._firstCode,this.macintosh.setValue(n,s),this._addGlyph(s,e),this._maxMacIndex=Math.max(n,this._maxMacIndex)}},e.prototype._initializeFontName=function(t){for(var e=0;e<t._recordsCount;e++){var i=t._nameRecords[Number.parseInt(e.toString(),10)];if(1===i._nameID?this._metrics._fontFamily=i._name:6===i._nameID&&(this._metrics._postScriptName=i._name),null!==this._metrics._fontFamily&&"undefined"!==this._metrics._fontFamily&&null!==this._metrics._postScriptName&&"undefined"!==this._metrics._postScriptName)break}},e.prototype._getTable=function(t){var e,i=new Zt;return this._tableDirectory.containsKey(t)&&(e=this._tableDirectory.getValue(t)),null!==e&&void 0!==e&&(i=e),i},e.prototype._getWidth=function(t){return t=t<this._width.length?t:this._width.length-1,this._width[Number.parseInt(t.toString(),10)]},e.prototype._getCmapEncoding=function(e,i){var r=t._TrueTypeCmapEncoding.unknown;return e===t._TrueTypePlatformID.microsoft&&i===t._TrueTypeMicrosoftEncodingID.undefined?r=t._TrueTypeCmapEncoding.symbol:e===t._TrueTypePlatformID.microsoft&&i===t._TrueTypeMicrosoftEncodingID.unicode?r=t._TrueTypeCmapEncoding.unicode:e===t._TrueTypePlatformID.macintosh&&i===t._TrueTypeMacintoshEncodingID.roman&&(r=t._TrueTypeCmapEncoding.macintosh),r},e.prototype._addGlyph=function(e,i){var r=null;switch(i){case t._TrueTypeCmapEncoding.unicode:r=this._microsoftGlyphs;break;case t._TrueTypeCmapEncoding.macintosh:case t._TrueTypeCmapEncoding.symbol:r=this._macintoshGlyphs}r.setValue(e._index,e)},e.prototype._initializeMetrics=function(e,i,r,n,s,a){this._initializeFontName(e);for(var o=!1,h=0;h<a.length;h++){var c=a[Number.parseInt(h.toString(),10)];if(this._getCmapEncoding(c._platformID,c._encodingID)===t._TrueTypeCmapEncoding.symbol){o=!0;break}}this._metrics._isSymbol=o,this._metrics._macStyle=i._macStyle,this._metrics._isFixedPitch=0!==s._isFixedPitch,this._metrics._italicAngle=s._italicAngle;var _=1e3/i._unitsPerEm;this._metrics._winAscent=n._sTypoAscender*_,this._metrics._macAscent=r._ascender*_,this._metrics._capHeight=0!==n._sCapHeight?n._sCapHeight:.7*i._unitsPerEm*_,this._metrics._winDescent=n._sTypoDescender*_,this._metrics._macDescent=r._descender*_,this._metrics._leading=(n._sTypoAscender-n._sTypoDescender+n._sTypoLineGap)*_,this._metrics._lineGap=Math.ceil(r._lineGap*_);var d=i._xMin*_,p=Math.ceil(this._metrics._macAscent+this._metrics._lineGap),l=i._xMax*_,u=this._metrics._macDescent;this._metrics._fontBox=[d,p,l,u],this._metrics._stemV=80,this._metrics._widthTable=this._updateWidth(),this._metrics._contains=this._tableDirectory.containsKey("CFF"),this._metrics._subScriptSizeFactor=i._unitsPerEm/n._ySubscriptYSize,this._metrics._superscriptSizeFactor=i._unitsPerEm/n._ySuperscriptYSize},e.prototype._updateWidth=function(){var t=[];if(this._metrics._isSymbol)for(n=0;n<256;n++){var e=this._getGlyph(String.fromCharCode(Number.parseInt(n.toString(),10)));t[Number.parseInt(n.toString(),10)]=e._empty?0:e._width}else for(var i=[],r=String.fromCharCode(32),n=0;n<256;n++){i[0]=Number.parseInt(n.toString(),10);var s=this._getString(i,0,i.length),a=s.length>0?s[0]:"?";(e=this._getGlyph(a))._empty?(e=this._getGlyph(r),t[Number.parseInt(n.toString(),10)]=e._empty?0:e._width):t[Number.parseInt(n.toString(),10)]=e._width}return t},e.prototype._getDefaultGlyph=function(){return this._getGlyph(Yt._whiteSpace)},e.prototype._getString=function(t,e,i){for(var r="",n=0;n<i;n++)r+=String.fromCharCode(t[n+e]);return r},e.prototype._setOffset=function(t){this._offset=t},e.prototype._readFontProgram=function(t){var e=this._getGlyphChars(t),i=this._readLocaTable(this._bIsLocaShort);e&&e._size()<t._size()&&(this._missedGlyphs=t._size()-e._size()),this._updateGlyphChars(e,i);var r=this._generateGlyphTable(e,i,null,null),n=r.glyphTableSize,s=r.newLocaTable,a=r.newGlyphTable,o=this._updateLocaTable(s,this._bIsLocaShort),h=o.newLocaSize,c=o.newLocaUpdated;return this._getFontProgram(c,a,n,h)},e.prototype._generateGlyphTable=function(t,e,i,r){i=[];var n=t.keys();n.sort(function(t,e){return t-e});for(var s=0,a=0;a<n.length;a++){var o=n[Number.parseInt(a.toString(),10)];e._offsets.length>0&&(s+=e._offsets[o+1]-e._offsets[Number.parseInt(o.toString(),10)])}var h=this._align(s);r=[];for(a=0;a<h;a++)r.push(0);for(var c=0,_=0,d=this._getTable("glyf"),a=0;a<e._offsets.length;a++)if(i.push(c),_<n.length&&n[Number.parseInt(_.toString(),10)]===a){++_,i[Number.parseInt(a.toString(),10)]=c;var p=e._offsets[Number.parseInt(a.toString(),10)],l=e._offsets[a+1]-p;l>0&&(this._offset=d._offset+p,r=this._read(r,c,l).buffer,c+=l)}return{glyphTableSize:s,newLocaTable:i,newGlyphTable:r}},e.prototype._readLocaTable=function(t){var e=this._getTable("loca");this._offset=e._offset;var i=new ue,r=[];if(t){n=e._length/2;r=[];for(s=0;s<n;s++)r[Number.parseInt(s.toString(),10)]=2*this._readUInt16(this._offset)}else{var n=e._length/4;r=[];for(var s=0;s<n;s++)r[Number.parseInt(s.toString(),10)]=this._readUInt32(this._offset)}return i._offsets=r,i},e.prototype._updateGlyphChars=function(t,e){t.containsKey(0)||t.setValue(0,0);for(var i=new xr,r=t.keys(),n=0;n<r.length;n++)i.setValue(r[Number.parseInt(n.toString(),10)],t.getValue(r[Number.parseInt(n.toString(),10)]));for(n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)];this._processCompositeGlyph(t,s,e)}},e.prototype._processCompositeGlyph=function(e,i,r){if(i<r._offsets.length-1){var n=r._offsets[Number.parseInt(i.toString(),10)];if(n!==r._offsets[i+1]){var s=this._getTable("glyf");this._offset=s._offset+n;var a=new fe;if(a.numberOfContours=this._readInt16(this._offset),a.xMin=this._readInt16(this._offset),a.yMin=this._readInt16(this._offset),a.xMax=this._readInt16(this._offset),a.yMax=this._readInt16(this._offset),a.numberOfContours<0)for(var o=0;;){var h=this._readUInt16(this._offset),c=this._readUInt16(this._offset);if(e.containsKey(c)||e.setValue(c,0),0==(h&t._TrueTypeCompositeGlyphFlag.MoreComponents))break;o=0!=(h&t._TrueTypeCompositeGlyphFlag.Arg1And2AreWords)?4:2,0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveScale)?o+=2:0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveAnXyScale)?o+=4:0!=(h&t._TrueTypeCompositeGlyphFlag.WeHaveTwoByTwo)&&(o+=8),this._offset+=o}}}},e.prototype._updateLocaTable=function(t,e){for(var i=e?2*t.length:4*t.length,r=this._align(i),n=new ge(r),s=0;s<t.length;s++){var a=t[Number.parseInt(s.toString(),10)];e?(a/=2,n._writeShort(a)):n._writeInt(a)}return{newLocaUpdated:n._data,newLocaSize:i}},e.prototype._align=function(t){return t+3&-4},e.prototype._getFontProgram=function(t,e,i,r){var n=this._getFontProgramLength(t,e,0),s=n.fontProgramLength,a=n.table,o=new ge(s);o._writeInt(65536),o._writeShort(a);var h=this._entrySelectors[Number.parseInt(a.toString(),10)];return o._writeShort(16*(1<<(31&h))),o._writeShort(h),o._writeShort(16*(a-(1<<(31&h)))),this._writeCheckSums(o,a,t,e,i,r),this._writeGlyphs(o,t,e),o._data},e.prototype._getFontProgramLength=function(t,e,i){var r=0;if(null!==t&&void 0!==t&&t.length>0&&null!==e&&void 0!==e&&e.length>0){i=2;for(var n=this._tableNames,s=0;s<n.length;s++){var a=n[Number.parseInt(s.toString(),10)];if("glyf"!==a&&"loca"!==a){var o=this._getTable(a);o._empty||(++i,r+=this._align(o._length))}}r+=t.length,r+=e.length,r+=16*i+12}return{fontProgramLength:r,table:i}},e.prototype._getGlyphChars=function(t){var e=new xr;if(null!==t&&void 0!==t)for(var i=t.keys(),r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)],s=this._getGlyph(n);s._empty||e.setValue(s._index,n.charCodeAt(0))}return e},e.prototype._writeCheckSums=function(t,e,i,r,n,s){if(null!==t&&void 0!==t&&null!==i&&void 0!==i&&i.length>0&&null!==r&&void 0!==r&&r.length>0)for(var a=this._tableNames,o=16*e+12,h=0,c=0;c<a.length;c++){var _=a[Number.parseInt(c.toString(),10)],d=this._getTable(_);if(!d._empty){if(t._writeString(_),"glyf"===_){p=this._calculateCheckSum(r);t._writeInt(p),h=n}else if("loca"===_){var p=this._calculateCheckSum(i);t._writeInt(p),h=s}else t._writeInt(d._checksum),h=d._length;t._writeUInt(o),t._writeUInt(h),o+=this._align(h)}}},e.prototype._calculateCheckSum=function(t){var e=0,i=0,r=0,n=0,s=0,a=0;if(null!==t&&void 0!==t&&t.length>0){for(var o=0;o<(t.length+1)/4;o++)s+=255&t[e++],n+=255&t[e++],r+=255&t[e++],i+=255&t[e++];a=i,a+=r<<8,a+=n<<16,a+=s<<24}return a},e.prototype._writeGlyphs=function(t,e,i){if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e.length>0&&null!==i&&void 0!==i&&i.length>0)for(var r=this._tableNames,n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)],a=this._getTable(s);if(!a._empty)if("glyf"===s)t._writeBytes(i);else if("loca"===s)t._writeBytes(e);else{for(var o=this._align(a._length),h=[],c=0;c<o;c++)h.push(0);this._offset=a._offset;var _=this._read(h,0,a._length);t._writeBytes(_.buffer)}}},e.prototype._read=function(t,e,i){var r=0;if(null!==t&&void 0!==t&&t.length>0){var n=0;do{for(var s=0;s<i-r&&this._offset+s<this._fontData.length;s++)t[e+s]=this._fontData[this._offset+s];n=i-r,this._offset+=n,r+=n}while(r<i)}return{buffer:t,written:r}},e.prototype._createInternals=function(){this._metrics=new de;var t=this._readNameTable(),e=this._readHeadTable();this._bIsLocaShort=0===e._indexToLocalFormat;var i=this._readHorizontalHeaderTable(),r=this._readOS2Table(),n=this._readPostTable();this._width=this._readWidthTable(i._numberOfHMetrics,e._unitsPerEm);var s=this._readCmapTable();this._initializeMetrics(t,e,i,r,n,s)},e.prototype._getGlyph=function(t){if("number"==typeof t){var e=null;return this._metrics._isSymbol||null===this._microsoftGlyphs?this._metrics._isSymbol&&null!==this._macintoshGlyphs&&this._macintoshGlyphs.containsKey(t)&&(e=this._macintoshGlyphs.getValue(t)):this._microsoftGlyphs.containsKey(t)&&(e=this._microsoftGlyphs.getValue(t)),n=null!==e?e:this._getDefaultGlyph()}var i=null,r=t.charCodeAt(0);this._metrics._isSymbol||null===this._microsoft?(this._metrics._isSymbol&&null!==this.macintosh||this._isMacFont)&&(0!==this._maxMacIndex?r%=this._maxMacIndex+1:r=61440==(65280&r)?255&r:r,this.macintosh.containsKey(r)&&(i=this.macintosh.getValue(r),this._isFontPresent=!0)):this._microsoft.containsKey(r)?(i=this._microsoft.getValue(r),r!==Yt._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!0)):r!==Yt._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!1),t===Yt._whiteSpace&&null===i&&(i=new le);var n=null!==i?i:this._getDefaultGlyph();return n},e.prototype._readString=function(t,e){if(void 0===e||null===e)return this._readString(t,!1);var i="";if(e)for(r=0;r<t;r++)r%2!=0&&(i+=String.fromCharCode(this._fontData[this._offset])),this._offset+=1;else for(var r=0;r<t;r++)i+=String.fromCharCode(this._fontData[this._offset]),this._offset+=1;return i},e.prototype._readFixed=function(t){return this._readInt16(t)+this._readInt16(t+2)/16384},e.prototype._readInt32=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)+3],i=this._fontData[Number.parseInt(t.toString(),10)+2],r=this._fontData[Number.parseInt(t.toString(),10)+1],n=this._fontData[Number.parseInt(t.toString(),10)];return this._offset+=4,e+(i<<8)+(r<<16)+(n<<24)},e.prototype._readUInt32=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)+3],i=this._fontData[Number.parseInt(t.toString(),10)+2],r=this._fontData[Number.parseInt(t.toString(),10)+1],n=this._fontData[Number.parseInt(t.toString(),10)];return this._offset+=4,e|i<<8|r<<16|n<<24},e.prototype._readInt16=function(t){var e=(this._fontData[Number.parseInt(t.toString(),10)]<<8)+this._fontData[Number.parseInt(t.toString(),10)+1];return e=32768&e?e-65536:e,this._offset+=2,e},e.prototype._readInt64=function(t){var e=this._readInt32(t+4),i=4294967296*this._readInt32(t)+e;return e<0&&(i+=4294967296),i},e.prototype._readUInt16=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)]<<8|this._fontData[Number.parseInt(t.toString(),10)+1];return this._offset+=2,e},e.prototype._readUShortArray=function(t){for(var e=[],i=0;i<t;i++)e[Number.parseInt(i.toString(),10)]=this._readUInt16(this._offset);return e},e.prototype._readBytes=function(t){for(var e=[],i=0;i<t;i++)e.push(this._fontData[Number.parseInt(this._offset.toString(),10)]),this._offset+=1;return e},e.prototype._readByte=function(t){var e=this._fontData[Number.parseInt(t.toString(),10)];return this._offset+=1,e},e.prototype._getCharacterWidth=function(t){var e=this._getGlyph(t);return(e=e._empty?this._getDefaultGlyph():e)._empty?0:e._width},e.prototype._convertString=function(t){var e="";if(null!==t&&void 0!==t&&t.length>0)for(var i=0;i<t.length;i++){var r=t[Number.parseInt(i.toString(),10)],n=this._getGlyph(r);n._empty||(e+=String.fromCharCode(n._index))}return e},e}(),_e=function(){function t(){}return t}(),de=function(){function t(){}return Object.defineProperty(t.prototype,"_isItalic",{get:function(){return 0!=(2&this._macStyle)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_isBold",{get:function(){return 0!=(1&this._macStyle)},enumerable:!0,configurable:!0}),t}(),pe=function(){function t(){}return t}(),le=function(){function t(){}return Object.defineProperty(t.prototype,"_empty",{get:function(){return this._index===this._width&&this._width===this._charCode&&0===this._charCode},enumerable:!0,configurable:!0}),t}(),ue=function(){function t(){}return t}(),fe=function(){function t(){}return t}(),ge=function(){function t(t){this.int32Size=4,this.int16Size=2,this.int64Size=8,this._bufferLength=t,this._buffer=[]}return Object.defineProperty(t.prototype,"_data",{get:function(){if(this._buffer.length<this._bufferLength)for(var t=this._bufferLength-this._buffer.length,e=0;e<t;e++)this._buffer.push(0);return this._buffer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_position",{get:function(){return void 0!==this._internalPosition&&null!==this._internalPosition||(this._internalPosition=0),this._internalPosition},enumerable:!0,configurable:!0}),t.prototype._writeShort=function(t){var e=[(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeInt=function(t){var e=[(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeUInt=function(t){var e=[(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t];this._flush(e)},t.prototype._writeString=function(t){if(null!==t&&void 0!==t){for(var e=[],i=0;i<t.length;i++)e.push(t.charCodeAt(i));this._flush(e)}},t.prototype._writeBytes=function(t){this._flush(t)},t.prototype._flush=function(t){if(null!==t&&void 0!==t){for(var e=this._position,i=0;i<t.length;i++)this._buffer[Number.parseInt(e.toString(),10)]=t[Number.parseInt(i.toString(),10)],e++;this._internalPosition+=t.length}},t}(),ye=function(){function e(t,e){if(this._nameString="ABCDEFGHIJKLMNOPQRSTUVWXYZ",this._isEmbedFont=!1,this._cmapPrefix="/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\r\n/CIDSystemInfo << /Registry (Adobe)/Ordering (UCS)/Supplement 0>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 beginCodeSpacerange\r\n",this._cmapEndCodeSpaceRange="endCodeSpacerange\r\n",this._cmapBeginRange="beginbfrange\r\n",this._cmapEndRange="endbfrange\r\n",this._cmapSuffix="endbfrange\nendcmap\nCMapName currentdict /CMap defineresource pop\nend end\r\n",null===t||void 0===t)throw new Error("ArgumentNullException:base64String");this._fontSize=e,this._fontString=t,this._Initialize()}return e.prototype._beginSave=function(){this._descendantFontBeginSave(),this._cmapBeginSave(),this._fontDictionaryBeginSave(),this._fontProgramBeginSave(),this._fontDescriptor&&(this._fontDescriptor.update("FontFile2",this._fontProgram),this._fontDescriptor._updated=!0,this._fontDescriptor._isFont=!0)},e.prototype._descendantFontBeginSave=function(){if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var t=this._getDescendantWidth();null!==t&&this._descendantFont.set("W",t)}},e.prototype._fontDictionaryBeginSave=function(){null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0&&this._fontDictionary.update("ToUnicode",this._cmap)},e.prototype._Initialize=function(){var t=k(this._fontString);this._fontData=t,this._ttfReader=new ce(this._fontData),this._ttfMetrics=this._ttfReader._metrics},e.prototype._createInternals=function(){this._fontDictionary=new Tr,this._descendantFont=new Tr,this._metrics=new zt,this._ttfReader._createInternals(),this._usedChars=null;var t=[];this._fontProgram=new Rr(t,new Tr),this._cmap=new Rr(t,new Tr),this._ttfMetrics=this._ttfReader._metrics,this._initializeMetrics(),this._subsetName=this._getFontName(),this._createDescendantFont(),this._createFontDictionary()},e.prototype._getInternals=function(){return this._fontDictionary},e.prototype._initializeMetrics=function(){var t=this._ttfReader._metrics;this._metrics._ascent=t._macAscent,this._metrics._descent=t._macDescent,this._metrics._height=t._macAscent-t._macDescent+t._lineGap,this._metrics._name=t._fontFamily,this._metrics._postScriptName=t._postScriptName,this._metrics._size=this._fontSize,this._metrics._widthTable=new Wt(t._widthTable),this._metrics._lineGap=t._lineGap,this._metrics._subScriptSizeFactor=t._subScriptSizeFactor,this._metrics._superscriptSizeFactor=t._superscriptSizeFactor,this._metrics._isBold=t._isBold},e.prototype._getFontName=function(){for(var t="",e=0;e<6;e++){var i=Math.floor(26*Math.random())+0;t+=this._nameString[Number.parseInt(i.toString(),10)]}return t+="+",(t+=this._ttfReader._metrics._postScriptName).toString()},e.prototype._createDescendantFont=function(){this._descendantFont=new Tr,this._descendantFont._updated=!0,this._descendantFont.set("Type",new Sr("Font")),this._descendantFont.set("Subtype",new Sr("CIDFontType2")),this._descendantFont.set("BaseFont",new Sr(this._subsetName)),this._descendantFont.set("CIDToGIDMap",new Sr("Identity")),this._descendantFont.set("DW",1e3),this._fontDescriptor=this._createFontDescriptor(),this._descendantFont.set("FontDescriptor",this._fontDescriptor);var t=this._createSystemInfo();this._descendantFont.set("CIDSystemInfo",t),this._descendantFont._isFont=!0},e.prototype._createFontDescriptor=function(){var t=new Tr,e=this._ttfReader._metrics;return t.set("Type",new Sr("FontDescriptor")),t.set("FontName",new Sr(this._subsetName)),t.set("Flags",this._getDescriptorFlags()),t.set("FontBBox",this._getBoundBox()),t.set("MissingWidth",e._widthTable[32]),t.set("StemV",e._stemV),t.set("ItalicAngle",e._italicAngle),t.set("CapHeight",e._capHeight),t.set("Ascent",e._winAscent),t.set("Descent",e._winDescent),t.set("Leading",e._leading),t.set("AvgWidth",e._widthTable[32]),t.set("MaxWidth",e._widthTable[32]),t.set("XHeight",0),t.set("StemH",0),t._updated=!0,t},e.prototype._generateFontProgram=function(){var t=[];this._usedChars=null===this._usedChars||void 0===this._usedChars?new xr:this._usedChars,this._ttfReader._setOffset(0),t=this._ttfReader._readFontProgram(this._usedChars),this._fontProgram._clearStream(),this._fontProgram._writeBytes(t)},e.prototype._getBoundBox=function(){var t=this._ttfReader._metrics._fontBox,e=Math.abs(t[2]-t[0]),i=Math.abs(t[1]-t[3]);return[t[0],t[3],e,i]},e.prototype._cmapBeginSave=function(){this._generateCmap()},e.prototype._fontProgramBeginSave=function(){this._generateFontProgram()},e.prototype._toHexString=function(t,e){var i=t.toString(16);return e&&(i=i.toUpperCase()),"<0000".substring(0,5-i.length)+i+">"},e.prototype._generateCmap=function(){if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var t=this._ttfReader._getGlyphChars(this._usedChars);if(t._size()>0){var e=t.keys().sort(),i=e[0],r=e[e.length-1],n=this._toHexString(i,!1)+this._toHexString(r,!1)+"\r\n",s="";s+=this._cmapPrefix,s+=n,s+=this._cmapEndCodeSpaceRange;for(var a=0,o=0;o<e.length;o++){0===a&&(0!==o&&(s+=this._cmapEndRange),s+=a=Math.min(100,e.length-o),s+=" ",s+=this._cmapBeginRange),a-=1;var h=e[Number.parseInt(o.toString(),10)];s+=this._toHexString(h,!0)+this._toHexString(h,!0),s+=this._toHexString(t.getValue(h),!0)+"\n"}s+=this._cmapSuffix,this._cmap._clearStream(),this._cmap._write(s)}}},e.prototype._createFontDictionary=function(){this._fontDictionary._updated=!0,this._fontDictionary.set("Type",Sr.get("Font")),this._fontDictionary.set("Subtype",Sr.get("Type0")),this._fontDictionary.set("BaseFont",new Sr(this._subsetName)),this._fontDictionary.set("Encoding",Sr.get("Identity-H")),this._fontDictionary.set("DescendantFonts",this._descendantFont),this._fontDictionary._isFont=!0,this._fontDictionary._currentObj=this},e.prototype._createSystemInfo=function(){var t=new Tr;return t._updated=!0,t.set("Registry","Adobe"),t.set("Ordering","Identity"),t.set("Supplement",0),t},e.prototype._getDescriptorFlags=function(){var e=0,i=this._ttfReader._metrics;return i._isFixedPitch&&(e|=t._FontDescriptorFlag.fixedPitch),i._isSymbol?e|=t._FontDescriptorFlag.symbolic:e|=t._FontDescriptorFlag.nonSymbolic,i._isItalic&&(e|=t._FontDescriptorFlag.italic),i._isBold&&(e|=t._FontDescriptorFlag.forceBold),e},e.prototype._getCharacterWidth=function(t){return this._ttfReader._getCharacterWidth(t)},e.prototype._setSymbols=function(t){if(null!==t&&void 0!==t){null!==this._usedChars&&void 0!==this._usedChars||(this._usedChars=new xr);for(var e=0;e<t.length;e++){var i=t[Number.parseInt(e.toString(),10)];this._usedChars.setValue(i,String.fromCharCode(0))}}},e.prototype._getDescendantWidth=function(){var t=new Array;if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){for(var e=[],i=this._usedChars.keys(),r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)],s=this._ttfReader._getGlyph(n);e.push(s)}e.sort(function(t,e){return t._index-e._index});for(var a=0,o=0,h=!1,c=new Array,r=0;r<e.length;r++){s=e[Number.parseInt(r.toString(),10)];h||(h=!0,a=s._index,o=s._index-1),(o+1!==s._index||r+1===e.length)&&e.length>1&&(t.push(Number(a)),0!==r&&t.push(c),a=s._index,c=new Array),c.push(Number(s._width)),r+1===e.length&&(t.push(Number(a)),t.push(c)),o=s._index}}return t},e}(),me=function(){function t(){this._arabicCharTable=[["ء","ﺀ"],["آ","ﺁ","ﺂ"],["أ","ﺃ","ﺄ"],["ؤ","ﺅ","ﺆ"],["إ","ﺇ","ﺈ"],["ئ","ﺉ","ﺊ","ﺋ","ﺌ"],["ا","ﺍ","ﺎ"],["ب","ﺏ","ﺐ","ﺑ","ﺒ"],["ة","ﺓ","ﺔ"],["ت","ﺕ","ﺖ","ﺗ","ﺘ"],["ث","ﺙ","ﺚ","ﺛ","ﺜ"],["ج","ﺝ","ﺞ","ﺟ","ﺠ"],["ح","ﺡ","ﺢ","ﺣ","ﺤ"],["خ","ﺥ","ﺦ","ﺧ","ﺨ"],["د","ﺩ","ﺪ"],["ذ","ﺫ","ﺬ"],["ر","ﺭ","ﺮ"],["ز","ﺯ","ﺰ"],["س","ﺱ","ﺲ","ﺳ","ﺴ"],["ش","ﺵ","ﺶ","ﺷ","ﺸ"],["ص","ﺹ","ﺺ","ﺻ","ﺼ"],["ض","ﺽ","ﺾ","ﺿ","ﻀ"],["ط","ﻁ","ﻂ","ﻃ","ﻄ"],["ظ","ﻅ","ﻆ","ﻇ","ﻈ"],["ع","ﻉ","ﻊ","ﻋ","ﻌ"],["غ","ﻍ","ﻎ","ﻏ","ﻐ"],["ـ","ـ","ـ","ـ","ـ"],["ف","ﻑ","ﻒ","ﻓ","ﻔ"],["ق","ﻕ","ﻖ","ﻗ","ﻘ"],["ك","ﻙ","ﻚ","ﻛ","ﻜ"],["ل","ﻝ","ﻞ","ﻟ","ﻠ"],["م","ﻡ","ﻢ","ﻣ","ﻤ"],["ن","ﻥ","ﻦ","ﻧ","ﻨ"],["ه","ﻩ","ﻪ","ﻫ","ﻬ"],["و","ﻭ","ﻮ"],["ى","ﻯ","ﻰ","ﯨ","ﯩ"],["ي","ﻱ","ﻲ","ﻳ","ﻴ"],["ٱ","ﭐ","ﭑ"],["ٹ","ﭦ","ﭧ","ﭨ","ﭩ"],["ٺ","ﭞ","ﭟ","ﭠ","ﭡ"],["ٻ","ﭒ","ﭓ","ﭔ","ﭕ"],["پ","ﭖ","ﭗ","ﭘ","ﭙ"],["ٿ","ﭢ","ﭣ","ﭤ","ﭥ"],["ڀ","ﭚ","ﭛ","ﭜ","ﭝ"],["ڃ","ﭶ","ﭷ","ﭸ","ﭹ"],["ڄ","ﭲ","ﭳ","ﭴ","ﭵ"],["چ","ﭺ","ﭻ","ﭼ","ﭽ"],["ڇ","ﭾ","ﭿ","ﮀ","ﮁ"],["ڈ","ﮈ","ﮉ"],["ڌ","ﮄ","ﮅ"],["ڍ","ﮂ","ﮃ"],["ڎ","ﮆ","ﮇ"],["ڑ","ﮌ","ﮍ"],["ژ","ﮊ","ﮋ"],["ڤ","ﭪ","ﭫ","ﭬ","ﭭ"],["ڦ","ﭮ","ﭯ","ﭰ","ﭱ"],["ک","ﮎ","ﮏ","ﮐ","ﮑ"],["ڭ","ﯓ","ﯔ","ﯕ","ﯖ"],["گ","ﮒ","ﮓ","ﮔ","ﮕ"],["ڱ","ﮚ","ﮛ","ﮜ","ﮝ"],["ڳ","ﮖ","ﮗ","ﮘ","ﮙ"],["ں","ﮞ","ﮟ"],["ڻ","ﮠ","ﮡ","ﮢ","ﮣ"],["ھ","ﮪ","ﮫ","ﮬ","ﮭ"],["ۀ","ﮤ","ﮥ"],["ہ","ﮦ","ﮧ","ﮨ","ﮩ"],["ۅ","ﯠ","ﯡ"],["ۆ","ﯙ","ﯚ"],["ۇ","ﯗ","ﯘ"],["ۈ","ﯛ","ﯜ"],["ۉ","ﯢ","ﯣ"],["ۋ","ﯞ","ﯟ"],["ی","ﯼ","ﯽ","ﯾ","ﯿ"],["ې","ﯤ","ﯥ","ﯦ","ﯧ"],["ے","ﮮ","ﮯ"],["ۓ","ﮰ","ﮱ"]],this._alef="ا",this._alefHamza="أ",this._alefHamzaBelow="إ",this._alefMadda="آ",this._lam="ل",this._hamza="ء",this._zeroWidthJoiner="‍",this._hamzaAbove="ٔ",this._hamzaBelow="ٕ",this._wawHamza="ؤ",this._yehHamza="ئ",this._waw="و",this._alefsura="ى",this._yeh="ي",this._farsiYeh="ی",this._shadda="ّ",this._madda="ٓ",this._lwa="ﻻ",this._lwawh="ﻷ",this._lwawhb="ﻹ",this._lwawm="ﻵ",this._bwhb="ۓ",this._fathatan="ً",this._superalef="ٰ",this._vowel=1,this._arabicMapTable=new Map;for(var t=0;t<this._arabicCharTable.length;t++)this._arabicMapTable.set(this._arabicCharTable[Number.parseInt(t.toString(),10)][0],this._arabicCharTable[Number.parseInt(t.toString(),10)])}return t.prototype._getCharacterShape=function(t,e){if(t>=this._hamza&&t<=this._bwhb){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t)[e+1]}else if(t>=this._lwawm&&t<=this._lwa)return t;return t},t.prototype._shape=function(t){for(var e="",i="",r=0;r<t.length;r++){var n=t[Number.parseInt(r.toString(),10)];n>="؀"&&n<="ۿ"?i+=n:(i.length>0&&(e+=s=this._doShape(i.toString(),0),i=""),e+=n)}if(i.length>0){var s=this._doShape(i.toString(),0);e+=s}return e.toString()},t.prototype._doShape=function(t,e){for(var i="",r=0,n=0,s="",a=new be,o=new be;n<t.length;)if(s=t[n++],0===this._ligature(s,o)){var h=this._getShapeCount(s);r=1===h?0:2,a._shapes>2&&(r+=1),r%=o._shapes,o._shapeValue=this._getCharacterShape(o._shapeValue,r),i=this._append(i,a,e),a=o,(o=new be)._shapeValue=s,o._shapes=h,o._shapeLigature++}return r=a._shapes>2?1:0,r%=o._shapes,o._shapeValue=this._getCharacterShape(o._shapeValue,r),i=this._append(i,a,e),(i=this._append(i,o,e)).toString()},t.prototype._append=function(t,e,i){return""!==e._shapeValue&&(t+=e._shapeValue,e._shapeLigature-=1,""!==e._shapeType&&(0==(i&this._vowel)?(t+=e._shapeType,e._shapeLigature-=1):e._shapeLigature-=1),""!==e._shapeVowel&&(0==(i&this._vowel)?(t+=e._shapeVowel,e._shapeLigature-=1):e._shapeLigature-=1)),t},t.prototype._ligature=function(t,e){if(""!==e._shapeValue){var i=0;if(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef){if(i=1,""!==e._shapeVowel&&t!==this._shadda&&(i=2),t===this._shadda){if(""!==e._shapeType)return 0;e._shapeType=this._shadda}else t===this._hamzaBelow?e._shapeValue===this._alef?(e._shapeValue=this._alefHamzaBelow,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawhb,i=2):e._shapeType=this._hamzaBelow:t===this._hamzaAbove?e._shapeValue===this._alef?(e._shapeValue=this._alefHamza,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawh,i=2):e._shapeValue===this._waw?(e._shapeValue=this._wawHamza,i=2):e._shapeValue===this._yeh||e._shapeValue===this._alefsura||e._shapeValue===this._farsiYeh?(e._shapeValue=this._yehHamza,i=2):e._shapeType=this._hamzaAbove:t===this._madda?e._shapeValue===this._alef&&(e._shapeValue=this._alefMadda,i=2):e._shapeVowel=t;return 1===i&&e._shapeLigature++,i}return""!==e._shapeVowel?0:(e._shapeValue===this._lam&&(t===this._alef?(e._shapeValue=this._lwa,e._shapes=2,i=3):t===this._alefHamza?(e._shapeValue=this._lwawh,e._shapes=2,i=3):t===this._alefHamzaBelow?(e._shapeValue=this._lwawhb,e._shapes=2,i=3):t===this._alefMadda&&(e._shapeValue=this._lwawm,e._shapes=2,i=3)),i)}return 0},t.prototype._getShapeCount=function(t){if(t>=this._hamza&&t<=this._bwhb&&!(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef)){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t).length-1}else if(t===this._zeroWidthJoiner)return 4;return 1},t}(),be=function(){function t(){this._shapeValue="",this._shapeType="",this._shapeVowel="",this._shapeLigature=0,this._shapes=1}return t}(),ve=function(){function t(){this._indexes=[],this._indexLevels=[],this._mirroringShape=new xr,this._update()}return t.prototype._doMirrorShaping=function(t){for(var e=[],i=0;i<t.length;i++)if(1==(1&this._indexLevels[Number.parseInt(i.toString(),10)])&&this._mirroringShape.containsKey(t[Number.parseInt(i.toString(),10)].charCodeAt(0))){var r=t[Number.parseInt(i.toString(),10)].charCodeAt(0);e[Number.parseInt(i.toString(),10)]=String.fromCharCode(this._mirroringShape.getValue(r))}else e[Number.parseInt(i.toString(),10)]=t[Number.parseInt(i.toString(),10)].toString();for(var n="",s=0;s<e.length;s++)n+=e[Number.parseInt(s.toString(),10)];return n},t.prototype._getLogicalToVisualString=function(t,e){var i=new Se;this._indexLevels=i._getVisualOrder(t,e),this._setDefaultIndexLevel(),this._doOrder(0,this._indexLevels.length-1);for(var r=this._doMirrorShaping(t),n="",s=0;s<this._indexes.length;s++){var a=this._indexes[Number.parseInt(s.toString(),10)];n+=r[Number.parseInt(a.toString(),10)]}return n.toString()},t.prototype._setDefaultIndexLevel=function(){for(var t=0;t<this._indexLevels.length;t++)this._indexes[Number.parseInt(t.toString(),10)]=t},t.prototype._doOrder=function(t,e){for(var i=this._indexLevels[Number.parseInt(t.toString(),10)],r=i,n=i,s=i,a=t+1;a<=e;++a){var o=this._indexLevels[Number.parseInt(a.toString(),10)];o>i?i=o:o<r&&(r=o),n&=o,s|=o}if(0!=(1&s)){if(1==(1&n))return void this._reArrange(t,e+1);for(r|=1;i>=r;){for(var h=t;;){for(;h<=e&&!(this._indexLevels[Number.parseInt(h.toString(),10)]>=i);)h+=1;if(h>e)break;for(var c=h+1;c<=e&&!(this._indexLevels[Number.parseInt(c.toString(),10)]<i);)c+=1;this._reArrange(h,c),h=c+1}i-=1}}},t.prototype._reArrange=function(t,e){var i=(t+e)/2;for(--e;t<i;++t,--e){var r=this._indexes[Number.parseInt(t.toString(),10)];this._indexes[Number.parseInt(t.toString(),10)]=this._indexes[Number.parseInt(e.toString(),10)],this._indexes[Number.parseInt(e.toString(),10)]=r}},t.prototype._update=function(){this._mirroringShape.setValue(40,41),this._mirroringShape.setValue(41,40),this._mirroringShape.setValue(60,62),this._mirroringShape.setValue(62,60),this._mirroringShape.setValue(91,93),this._mirroringShape.setValue(93,91),this._mirroringShape.setValue(123,125),this._mirroringShape.setValue(125,123),this._mirroringShape.setValue(171,187),this._mirroringShape.setValue(187,171),this._mirroringShape.setValue(8249,8250),this._mirroringShape.setValue(8250,8249),this._mirroringShape.setValue(8261,8262),this._mirroringShape.setValue(8262,8261),this._mirroringShape.setValue(8317,8318),this._mirroringShape.setValue(8318,8317),this._mirroringShape.setValue(8333,8334),this._mirroringShape.setValue(8334,8333),this._mirroringShape.setValue(8712,8715),this._mirroringShape.setValue(8713,8716),this._mirroringShape.setValue(8714,8717),this._mirroringShape.setValue(8715,8712),this._mirroringShape.setValue(8716,8713),this._mirroringShape.setValue(8717,8714),this._mirroringShape.setValue(8725,10741),this._mirroringShape.setValue(8764,8765),this._mirroringShape.setValue(8765,8764),this._mirroringShape.setValue(8771,8909),this._mirroringShape.setValue(8786,8787),this._mirroringShape.setValue(8787,8786),this._mirroringShape.setValue(8788,8789),this._mirroringShape.setValue(8789,8788),this._mirroringShape.setValue(8804,8805),this._mirroringShape.setValue(8805,8804),this._mirroringShape.setValue(8806,8807),this._mirroringShape.setValue(8807,8806),this._mirroringShape.setValue(8808,8809),this._mirroringShape.setValue(8809,8808),this._mirroringShape.setValue(8810,8811),this._mirroringShape.setValue(8811,8810),this._mirroringShape.setValue(8814,8815),this._mirroringShape.setValue(8815,8814),this._mirroringShape.setValue(8816,8817),this._mirroringShape.setValue(8817,8816),this._mirroringShape.setValue(8818,8819),this._mirroringShape.setValue(8819,8818),this._mirroringShape.setValue(8820,8821),this._mirroringShape.setValue(8821,8820),this._mirroringShape.setValue(8822,8823),this._mirroringShape.setValue(8823,8822),this._mirroringShape.setValue(8824,8825),this._mirroringShape.setValue(8825,8824),this._mirroringShape.setValue(8826,8827),this._mirroringShape.setValue(8827,8826),this._mirroringShape.setValue(8828,8829),this._mirroringShape.setValue(8829,8828),this._mirroringShape.setValue(8830,8831),this._mirroringShape.setValue(8831,8830),this._mirroringShape.setValue(8832,8833),this._mirroringShape.setValue(8833,8832),this._mirroringShape.setValue(8834,8835),this._mirroringShape.setValue(8835,8834),this._mirroringShape.setValue(8836,8837),this._mirroringShape.setValue(8837,8836),this._mirroringShape.setValue(8838,8839),this._mirroringShape.setValue(8839,8838),this._mirroringShape.setValue(8840,8841),this._mirroringShape.setValue(8841,8840),this._mirroringShape.setValue(8842,8843),this._mirroringShape.setValue(8843,8842),this._mirroringShape.setValue(8847,8848),this._mirroringShape.setValue(8848,8847),this._mirroringShape.setValue(8849,8850),this._mirroringShape.setValue(8850,8849),this._mirroringShape.setValue(8856,10680),this._mirroringShape.setValue(8866,8867),this._mirroringShape.setValue(8867,8866),this._mirroringShape.setValue(8870,10974),this._mirroringShape.setValue(8872,10980),this._mirroringShape.setValue(8873,10979),this._mirroringShape.setValue(8875,10981),this._mirroringShape.setValue(8880,8881),this._mirroringShape.setValue(8881,8880),this._mirroringShape.setValue(8882,8883),this._mirroringShape.setValue(8883,8882),this._mirroringShape.setValue(8884,8885),this._mirroringShape.setValue(8885,8884),this._mirroringShape.setValue(8886,8887),this._mirroringShape.setValue(8887,8886),this._mirroringShape.setValue(8905,8906),this._mirroringShape.setValue(8906,8905),this._mirroringShape.setValue(8907,8908),this._mirroringShape.setValue(8908,8907),this._mirroringShape.setValue(8909,8771),this._mirroringShape.setValue(8912,8913),this._mirroringShape.setValue(8913,8912),this._mirroringShape.setValue(8918,8919),this._mirroringShape.setValue(8919,8918),this._mirroringShape.setValue(8920,8921),this._mirroringShape.setValue(8921,8920),this._mirroringShape.setValue(8922,8923),this._mirroringShape.setValue(8923,8922),this._mirroringShape.setValue(8924,8925),this._mirroringShape.setValue(8925,8924),this._mirroringShape.setValue(8926,8927),this._mirroringShape.setValue(8927,8926),this._mirroringShape.setValue(8928,8929),this._mirroringShape.setValue(8929,8928),this._mirroringShape.setValue(8930,8931),this._mirroringShape.setValue(8931,8930),this._mirroringShape.setValue(8932,8933),this._mirroringShape.setValue(8933,8932),this._mirroringShape.setValue(8934,8935),this._mirroringShape.setValue(8935,8934),this._mirroringShape.setValue(8936,8937),this._mirroringShape.setValue(8937,8936),this._mirroringShape.setValue(8938,8939),this._mirroringShape.setValue(8939,8938),this._mirroringShape.setValue(8940,8941),this._mirroringShape.setValue(8941,8940),this._mirroringShape.setValue(8944,8945),this._mirroringShape.setValue(8945,8944),this._mirroringShape.setValue(8946,8954),this._mirroringShape.setValue(8947,8955),this._mirroringShape.setValue(8948,8956),this._mirroringShape.setValue(8950,8957),this._mirroringShape.setValue(8951,8958),this._mirroringShape.setValue(8954,8946),this._mirroringShape.setValue(8955,8947),this._mirroringShape.setValue(8956,8948),this._mirroringShape.setValue(8957,8950),this._mirroringShape.setValue(8958,8951),this._mirroringShape.setValue(8968,8969),this._mirroringShape.setValue(8969,8968),this._mirroringShape.setValue(8970,8971),this._mirroringShape.setValue(8971,8970),this._mirroringShape.setValue(9001,9002),this._mirroringShape.setValue(9002,9001),this._mirroringShape.setValue(10088,10089),this._mirroringShape.setValue(10089,10088),this._mirroringShape.setValue(10090,10091),this._mirroringShape.setValue(10091,10090),this._mirroringShape.setValue(10092,10093),this._mirroringShape.setValue(10093,10092),this._mirroringShape.setValue(10094,10095),this._mirroringShape.setValue(10095,10094),this._mirroringShape.setValue(10096,10097),this._mirroringShape.setValue(10097,10096),this._mirroringShape.setValue(10098,10099),this._mirroringShape.setValue(10099,10098),this._mirroringShape.setValue(10100,10101),this._mirroringShape.setValue(10101,10100),this._mirroringShape.setValue(10197,10198),this._mirroringShape.setValue(10198,10197),this._mirroringShape.setValue(10205,10206),this._mirroringShape.setValue(10206,10205),this._mirroringShape.setValue(10210,10211),this._mirroringShape.setValue(10211,10210),this._mirroringShape.setValue(10212,10213),this._mirroringShape.setValue(10213,10212),this._mirroringShape.setValue(10214,10215),this._mirroringShape.setValue(10215,10214),this._mirroringShape.setValue(10216,10217),this._mirroringShape.setValue(10217,10216),this._mirroringShape.setValue(10218,10219),this._mirroringShape.setValue(10219,10218),this._mirroringShape.setValue(10627,10628),this._mirroringShape.setValue(10628,10627),this._mirroringShape.setValue(10629,10630),this._mirroringShape.setValue(10630,10629),this._mirroringShape.setValue(10631,10632),this._mirroringShape.setValue(10632,10631),this._mirroringShape.setValue(10633,10634),this._mirroringShape.setValue(10634,10633),this._mirroringShape.setValue(10635,10636),this._mirroringShape.setValue(10636,10635),this._mirroringShape.setValue(10637,10640),this._mirroringShape.setValue(10638,10639),this._mirroringShape.setValue(10639,10638),this._mirroringShape.setValue(10640,10637),this._mirroringShape.setValue(10641,10642),this._mirroringShape.setValue(10642,10641),this._mirroringShape.setValue(10643,10644),this._mirroringShape.setValue(10644,10643),this._mirroringShape.setValue(10645,10646),this._mirroringShape.setValue(10646,10645),this._mirroringShape.setValue(10647,10648),this._mirroringShape.setValue(10648,10647),this._mirroringShape.setValue(10680,8856),this._mirroringShape.setValue(10688,10689),this._mirroringShape.setValue(10689,10688),this._mirroringShape.setValue(10692,10693),this._mirroringShape.setValue(10693,10692),this._mirroringShape.setValue(10703,10704),this._mirroringShape.setValue(10704,10703),this._mirroringShape.setValue(10705,10706),this._mirroringShape.setValue(10706,10705),this._mirroringShape.setValue(10708,10709),this._mirroringShape.setValue(10709,10708),this._mirroringShape.setValue(10712,10713),this._mirroringShape.setValue(10713,10712),this._mirroringShape.setValue(10714,10715),this._mirroringShape.setValue(10715,10714),this._mirroringShape.setValue(10741,8725),this._mirroringShape.setValue(10744,10745),this._mirroringShape.setValue(10745,10744),this._mirroringShape.setValue(10748,10749),this._mirroringShape.setValue(10749,10748),this._mirroringShape.setValue(10795,10796),this._mirroringShape.setValue(10796,10795),this._mirroringShape.setValue(10797,10796),this._mirroringShape.setValue(10798,10797),this._mirroringShape.setValue(10804,10805),this._mirroringShape.setValue(10805,10804),this._mirroringShape.setValue(10812,10813),this._mirroringShape.setValue(10813,10812),this._mirroringShape.setValue(10852,10853),this._mirroringShape.setValue(10853,10852),this._mirroringShape.setValue(10873,10874),this._mirroringShape.setValue(10874,10873),this._mirroringShape.setValue(10877,10878),this._mirroringShape.setValue(10878,10877),this._mirroringShape.setValue(10879,10880),this._mirroringShape.setValue(10880,10879),this._mirroringShape.setValue(10881,10882),this._mirroringShape.setValue(10882,10881),this._mirroringShape.setValue(10883,10884),this._mirroringShape.setValue(10884,10883),this._mirroringShape.setValue(10891,10892),this._mirroringShape.setValue(10892,10891),this._mirroringShape.setValue(10897,10898),this._mirroringShape.setValue(10898,10897),this._mirroringShape.setValue(10899,10900),this._mirroringShape.setValue(10900,10899),this._mirroringShape.setValue(10901,10902),this._mirroringShape.setValue(10902,10901),this._mirroringShape.setValue(10903,10904),this._mirroringShape.setValue(10904,10903),this._mirroringShape.setValue(10905,10906),this._mirroringShape.setValue(10906,10905),this._mirroringShape.setValue(10907,10908),this._mirroringShape.setValue(10908,10907),this._mirroringShape.setValue(10913,10914),this._mirroringShape.setValue(10914,10913),this._mirroringShape.setValue(10918,10919),this._mirroringShape.setValue(10919,10918),this._mirroringShape.setValue(10920,10921),this._mirroringShape.setValue(10921,10920),this._mirroringShape.setValue(10922,10923),this._mirroringShape.setValue(10923,10922),this._mirroringShape.setValue(10924,10925),this._mirroringShape.setValue(10925,10924),this._mirroringShape.setValue(10927,10928),this._mirroringShape.setValue(10928,10927),this._mirroringShape.setValue(10931,10932),this._mirroringShape.setValue(10932,10931),this._mirroringShape.setValue(10939,10940),this._mirroringShape.setValue(10940,10939),this._mirroringShape.setValue(10941,10942),this._mirroringShape.setValue(10942,10941),this._mirroringShape.setValue(10943,10944),this._mirroringShape.setValue(10944,10943),this._mirroringShape.setValue(10945,10946),this._mirroringShape.setValue(10946,10945),this._mirroringShape.setValue(10947,10948),this._mirroringShape.setValue(10948,10947),this._mirroringShape.setValue(10949,10950),this._mirroringShape.setValue(10950,10949),this._mirroringShape.setValue(10957,10958),this._mirroringShape.setValue(10958,10957),this._mirroringShape.setValue(10959,10960),this._mirroringShape.setValue(10960,10959),this._mirroringShape.setValue(10961,10962),this._mirroringShape.setValue(10962,10961),this._mirroringShape.setValue(10963,10964),this._mirroringShape.setValue(10964,10963),this._mirroringShape.setValue(10965,10966),this._mirroringShape.setValue(10966,10965),this._mirroringShape.setValue(10974,8870),this._mirroringShape.setValue(10979,8873),this._mirroringShape.setValue(10980,8872),this._mirroringShape.setValue(10981,8875),this._mirroringShape.setValue(10988,10989),this._mirroringShape.setValue(10989,10988),this._mirroringShape.setValue(10999,11e3),this._mirroringShape.setValue(11e3,10999),this._mirroringShape.setValue(11001,11002),this._mirroringShape.setValue(11002,11001),this._mirroringShape.setValue(12296,12297),this._mirroringShape.setValue(12297,12296),this._mirroringShape.setValue(12298,12299),this._mirroringShape.setValue(12299,12298),this._mirroringShape.setValue(12300,12301),this._mirroringShape.setValue(12301,12300),this._mirroringShape.setValue(12302,12303),this._mirroringShape.setValue(12303,12302),this._mirroringShape.setValue(12304,12305),this._mirroringShape.setValue(12305,12304),this._mirroringShape.setValue(12308,12309),this._mirroringShape.setValue(12309,12308),this._mirroringShape.setValue(12310,12311),this._mirroringShape.setValue(12311,12310),this._mirroringShape.setValue(12312,12313),this._mirroringShape.setValue(12313,12312),this._mirroringShape.setValue(12314,12315),this._mirroringShape.setValue(12315,12314),this._mirroringShape.setValue(65288,65289),this._mirroringShape.setValue(65289,65288),this._mirroringShape.setValue(65308,65310),this._mirroringShape.setValue(65310,65308),this._mirroringShape.setValue(65339,65341),this._mirroringShape.setValue(65341,65339),this._mirroringShape.setValue(65371,65373),this._mirroringShape.setValue(65373,65371),this._mirroringShape.setValue(65375,65376),this._mirroringShape.setValue(65376,65375),this._mirroringShape.setValue(65378,65379),this._mirroringShape.setValue(65379,65378)},t}(),Se=function(){function t(){this._type=[],this._textOrder=-1,this._rtlCharacterTypes=new Array(65536),this.L=0,this.lre=1,this.lro=2,this.R=3,this.AL=4,this.rle=5,this.rlo=6,this.pdf=7,this.EN=8,this.ES=9,this.ET=10,this.AN=11,this.CS=12,this.nsm=13,this.BN=14,this.B=15,this.S=16,this.WS=17,this.ON=18,this._charTypes=[this.L,this.EN,this.BN,this.ES,this.ES,this.S,this.ET,this.ET,this.B,this.AN,this.AN,this.S,this.CS,this.CS,this.WS,this.nsm,this.nsm,this.B,this.BN,27,this.BN,28,30,this.B,31,31,this.S,32,32,this.WS,33,34,this.ON,35,37,this.ET,38,42,this.ON,43,43,this.ET,44,44,this.CS,45,45,this.ET,46,46,this.CS,47,47,this.CS,48,57,this.EN,58,58,this.CS,59,64,this.ON,65,90,this.L,91,96,this.ON,97,122,this.L,123,126,this.ON,127,132,this.BN,133,133,this.B,134,159,this.BN,160,160,this.CS,161,161,this.ON,162,165,this.ET,166,169,this.ON,170,170,this.L,171,175,this.ON,176,177,this.ET,178,179,this.EN,180,180,this.ON,181,181,this.L,182,184,this.ON,185,185,this.EN,186,186,this.L,187,191,this.ON,192,214,this.L,215,215,this.ON,216,246,this.L,247,247,this.ON,248,696,this.L,697,698,this.ON,699,705,this.L,706,719,this.ON,720,721,this.L,722,735,this.ON,736,740,this.L,741,749,this.ON,750,750,this.L,751,767,this.ON,768,855,this.nsm,856,860,this.L,861,879,this.nsm,880,883,this.L,884,885,this.ON,886,893,this.L,894,894,this.ON,895,899,this.L,900,901,this.ON,902,902,this.L,903,903,this.ON,904,1013,this.L,1014,1014,this.ON,1015,1154,this.L,1155,1158,this.nsm,1159,1159,this.L,1160,1161,this.nsm,1162,1417,this.L,1418,1418,this.ON,1419,1424,this.L,1425,1441,this.nsm,1442,1442,this.L,1443,1465,this.nsm,1466,1466,this.L,1467,1469,this.nsm,1470,1470,this.R,1471,1471,this.nsm,1472,1472,this.R,1473,1474,this.nsm,1475,1475,this.R,1476,1476,this.nsm,1477,1487,this.L,1488,1514,this.R,1515,1519,this.L,1520,1524,this.R,1525,1535,this.L,1536,1539,this.AL,1540,1547,this.L,1548,1548,this.CS,1549,1549,this.AL,1550,1551,this.ON,1552,1557,this.nsm,1558,1562,this.L,1563,1563,this.AL,1564,1566,this.L,1567,1567,this.AL,1568,1568,this.L,1569,1594,this.AL,1595,1599,this.L,1600,1610,this.AL,1611,1624,this.nsm,1625,1631,this.L,1632,1641,this.AN,1642,1642,this.ET,1643,1644,this.AN,1645,1647,this.AL,1648,1648,this.nsm,1649,1749,this.AL,1750,1756,this.nsm,1757,1757,this.AL,1758,1764,this.nsm,1765,1766,this.AL,1767,1768,this.nsm,1769,1769,this.ON,1770,1773,this.nsm,1774,1775,this.AL,1776,1785,this.EN,1786,1805,this.AL,1806,1806,this.L,1807,1807,this.BN,1808,1808,this.AL,1809,1809,this.nsm,1810,1839,this.AL,1840,1866,this.nsm,1867,1868,this.L,1869,1871,this.AL,1872,1919,this.L,1920,1957,this.AL,1958,1968,this.nsm,1969,1969,this.AL,1970,2304,this.L,2305,2306,this.nsm,2307,2363,this.L,2364,2364,this.nsm,2365,2368,this.L,2369,2376,this.nsm,2377,2380,this.L,2381,2381,this.nsm,2382,2384,this.L,2385,2388,this.nsm,2389,2401,this.L,2402,2403,this.nsm,2404,2432,this.L,2433,2433,this.nsm,2434,2491,this.L,2492,2492,this.nsm,2493,2496,this.L,2497,2500,this.nsm,2501,2508,this.L,2509,2509,this.nsm,2510,2529,this.L,2530,2531,this.nsm,2532,2545,this.L,2546,2547,this.ET,2548,2560,this.L,2561,2562,this.nsm,2563,2619,this.L,2620,2620,this.nsm,2621,2624,this.L,2625,2626,this.nsm,2627,2630,this.L,2631,2632,this.nsm,2633,2634,this.L,2635,2637,this.nsm,2638,2671,this.L,2672,2673,this.nsm,2674,2688,this.L,2689,2690,this.nsm,2691,2747,this.L,2748,2748,this.nsm,2749,2752,this.L,2753,2757,this.nsm,2758,2758,this.L,2759,2760,this.nsm,2761,2764,this.L,2765,2765,this.nsm,2766,2785,this.L,2786,2787,this.nsm,2788,2800,this.L,2801,2801,this.ET,2802,2816,this.L,2817,2817,this.nsm,2818,2875,this.L,2876,2876,this.nsm,2877,2878,this.L,2879,2879,this.nsm,2880,2880,this.L,2881,2883,this.nsm,2884,2892,this.L,2893,2893,this.nsm,2894,2901,this.L,2902,2902,this.nsm,2903,2945,this.L,2946,2946,this.nsm,2947,3007,this.L,3008,3008,this.nsm,3009,3020,this.L,3021,3021,this.nsm,3022,3058,this.L,3059,3064,this.ON,3065,3065,this.ET,3066,3066,this.ON,3067,3133,this.L,3134,3136,this.nsm,3137,3141,this.L,3142,3144,this.nsm,3145,3145,this.L,3146,3149,this.nsm,3150,3156,this.L,3157,3158,this.nsm,3159,3259,this.L,3260,3260,this.nsm,3261,3275,this.L,3276,3277,this.nsm,3278,3392,this.L,3393,3395,this.nsm,3396,3404,this.L,3405,3405,this.nsm,3406,3529,this.L,3530,3530,this.nsm,3531,3537,this.L,3538,3540,this.nsm,3541,3541,this.L,3542,3542,this.nsm,3543,3632,this.L,3633,3633,this.nsm,3634,3635,this.L,3636,3642,this.nsm,3643,3646,this.L,3647,3647,this.ET,3648,3654,this.L,3655,3662,this.nsm,3663,3760,this.L,3761,3761,this.nsm,3762,3763,this.L,3764,3769,this.nsm,3770,3770,this.L,3771,3772,this.nsm,3773,3783,this.L,3784,3789,this.nsm,3790,3863,this.L,3864,3865,this.nsm,3866,3892,this.L,3893,3893,this.nsm,3894,3894,this.L,3895,3895,this.nsm,3896,3896,this.L,3897,3897,this.nsm,3898,3901,this.ON,3902,3952,this.L,3953,3966,this.nsm,3967,3967,this.L,3968,3972,this.nsm,3973,3973,this.L,3974,3975,this.nsm,3976,3983,this.L,3984,3991,this.nsm,3992,3992,this.L,3993,4028,this.nsm,4029,4037,this.L,4038,4038,this.nsm,4039,4140,this.L,4141,4144,this.nsm,4145,4145,this.L,4146,4146,this.nsm,4147,4149,this.L,4150,4151,this.nsm,4152,4152,this.L,4153,4153,this.nsm,4154,4183,this.L,4184,4185,this.nsm,4186,5759,this.L,5760,5760,this.WS,5761,5786,this.L,5787,5788,this.ON,5789,5905,this.L,5906,5908,this.nsm,5909,5937,this.L,5938,5940,this.nsm,5941,5969,this.L,5970,5971,this.nsm,5972,6001,this.L,6002,6003,this.nsm,6004,6070,this.L,6071,6077,this.nsm,6078,6085,this.L,6086,6086,this.nsm,6087,6088,this.L,6089,6099,this.nsm,6100,6106,this.L,6107,6107,this.ET,6108,6108,this.L,6109,6109,this.nsm,6110,6127,this.L,6128,6137,this.ON,6138,6143,this.L,6144,6154,this.ON,6155,6157,this.nsm,6158,6158,this.WS,6159,6312,this.L,6313,6313,this.nsm,6314,6431,this.L,6432,6434,this.nsm,6435,6438,this.L,6439,6443,this.nsm,6444,6449,this.L,6450,6450,this.nsm,6451,6456,this.L,6457,6459,this.nsm,6460,6463,this.L,6464,6464,this.ON,6465,6467,this.L,6468,6469,this.ON,6470,6623,this.L,6624,6655,this.ON,6656,8124,this.L,8125,8125,this.ON,8126,8126,this.L,8127,8129,this.ON,8130,8140,this.L,8141,8143,this.ON,8144,8156,this.L,8157,8159,this.ON,8160,8172,this.L,8173,8175,this.ON,8176,8188,this.L,8189,8190,this.ON,8191,8191,this.L,8192,8202,this.WS,8203,8205,this.BN,8206,8206,this.L,8207,8207,this.R,8208,8231,this.ON,8232,8232,this.WS,8233,8233,this.B,8234,8234,this.lre,8235,8235,this.rle,8236,8236,this.pdf,8237,8237,this.lro,8238,8238,this.rlo,8239,8239,this.WS,8240,8244,this.ET,8245,8276,this.ON,8277,8278,this.L,8279,8279,this.ON,8280,8286,this.L,8287,8287,this.WS,8288,8291,this.BN,8292,8297,this.L,8298,8303,this.BN,8304,8304,this.EN,8305,8307,this.L,8308,8313,this.EN,8314,8315,this.ET,8316,8318,this.ON,8319,8319,this.L,8320,8329,this.EN,8330,8331,this.ET,8332,8334,this.ON,8335,8351,this.L,8352,8369,this.ET,8370,8399,this.L,8400,8426,this.nsm,8427,8447,this.L,8448,8449,this.ON,8450,8450,this.L,8451,8454,this.ON,8455,8455,this.L,8456,8457,this.ON,8458,8467,this.L,8468,8468,this.ON,8469,8469,this.L,8470,8472,this.ON,8473,8477,this.L,8478,8483,this.ON,8484,8484,this.L,8485,8485,this.ON,8486,8486,this.L,8487,8487,this.ON,8488,8488,this.L,8489,8489,this.ON,8490,8493,this.L,8494,8494,this.ET,8495,8497,this.L,8498,8498,this.ON,8499,8505,this.L,8506,8507,this.ON,8508,8511,this.L,8512,8516,this.ON,8517,8521,this.L,8522,8523,this.ON,8524,8530,this.L,8531,8543,this.ON,8544,8591,this.L,8592,8721,this.ON,8722,8723,this.ET,8724,9013,this.ON,9014,9082,this.L,9083,9108,this.ON,9109,9109,this.L,9110,9168,this.ON,9169,9215,this.L,9216,9254,this.ON,9255,9279,this.L,9280,9290,this.ON,9291,9311,this.L,9312,9371,this.EN,9372,9449,this.L,9450,9450,this.EN,9451,9751,this.ON,9752,9752,this.L,9753,9853,this.ON,9854,9855,this.L,9856,9873,this.ON,9874,9887,this.L,9888,9889,this.ON,9890,9984,this.L,9985,9988,this.ON,9989,9989,this.L,9990,9993,this.ON,9994,9995,this.L,9996,10023,this.ON,10024,10024,this.L,10025,10059,this.ON,10060,10060,this.L,10061,10061,this.ON,10062,10062,this.L,10063,10066,this.ON,10067,10069,this.L,10070,10070,this.ON,10071,10071,this.L,10072,10078,this.ON,10079,10080,this.L,10081,10132,this.ON,10133,10135,this.L,10136,10159,this.ON,10160,10160,this.L,10161,10174,this.ON,10175,10191,this.L,10192,10219,this.ON,10220,10223,this.L,10224,11021,this.ON,11022,11903,this.L,11904,11929,this.ON,11930,11930,this.L,11931,12019,this.ON,12020,12031,this.L,12032,12245,this.ON,12246,12271,this.L,12272,12283,this.ON,12284,12287,this.L,12288,12288,this.WS,12289,12292,this.ON,12293,12295,this.L,12296,12320,this.ON,12321,12329,this.L,12330,12335,this.nsm,12336,12336,this.ON,12337,12341,this.L,12342,12343,this.ON,12344,12348,this.L,12349,12351,this.ON,12352,12440,this.L,12441,12442,this.nsm,12443,12444,this.ON,12445,12447,this.L,12448,12448,this.ON,12449,12538,this.L,12539,12539,this.ON,12540,12828,this.L,12829,12830,this.ON,12831,12879,this.L,12880,12895,this.ON,12896,12923,this.L,12924,12925,this.ON,12926,12976,this.L,12977,12991,this.ON,12992,13003,this.L,13004,13007,this.ON,13008,13174,this.L,13175,13178,this.ON,13179,13277,this.L,13278,13279,this.ON,13280,13310,this.L,13311,13311,this.ON,13312,19903,this.L,19904,19967,this.ON,19968,42127,this.L,42128,42182,this.ON,42183,64284,this.L,64285,64285,this.R,64286,64286,this.nsm,64287,64296,this.R,64297,64297,this.ET,64298,64310,this.R,64311,64311,this.L,64312,64316,this.R,64317,64317,this.L,64318,64318,this.R,64319,64319,this.L,64320,64321,this.R,64322,64322,this.L,64323,64324,this.R,64325,64325,this.L,64326,64335,this.R,64336,64433,this.AL,64434,64466,this.L,64467,64829,this.AL,64830,64831,this.ON,64832,64847,this.L,64848,64911,this.AL,64912,64913,this.L,64914,64967,this.AL,64968,65007,this.L,65008,65020,this.AL,65021,65021,this.ON,65022,65023,this.L,65024,65039,this.nsm,65040,65055,this.L,65056,65059,this.nsm,65060,65071,this.L,65072,65103,this.ON,65104,65104,this.CS,65105,65105,this.ON,65106,65106,this.CS,65107,65107,this.L,65108,65108,this.ON,65109,65109,this.CS,65110,65118,this.ON,65119,65119,this.ET,65120,65121,this.ON,65122,65123,this.ET,65124,65126,this.ON,65127,65127,this.L,65128,65128,this.ON,65129,65130,this.ET,65131,65131,this.ON,65132,65135,this.L,65136,65140,this.AL,65141,65141,this.L,65142,65276,this.AL,65277,65278,this.L,65279,65279,this.BN,65280,65280,this.L,65281,65282,this.ON,65283,65285,this.ET,65286,65290,this.ON,65291,65291,this.ET,65292,65292,this.CS,65293,65293,this.ET,65294,65294,this.CS,65295,65295,this.ES,65296,65305,this.EN,65306,65306,this.CS,65307,65312,this.ON,65313,65338,this.L,65339,65344,this.ON,65345,65370,this.L,65371,65381,this.ON,65382,65503,this.L,65504,65505,this.ET,65506,65508,this.ON,65509,65510,this.ET,65511,65511,this.L,65512,65518,this.ON,65519,65528,this.L,65529,65531,this.BN,65532,65533,this.ON,65534,65535,this.L];for(var t=0;t<this._charTypes.length;++t)for(var e=this._charTypes[Number.parseInt(t.toString(),10)],i=this._charTypes[++t],r=this._charTypes[++t];e<=i;)this._rtlCharacterTypes[e++]=r}return t.prototype._getVisualOrder=function(t,e){this._type=this._getCharacterCode(t),this._textOrder=e?this.lre:this.L,this._doVisualOrder();for(var i=[],r=0;r<this._levels.length;r++)i[Number.parseInt(r.toString(),10)]=this._levels[Number.parseInt(r.toString(),10)];return i},t.prototype._getCharacterCode=function(t){for(var e=[],i=0;i<t.length;i++){var r=t[Number.parseInt(i.toString(),10)].charCodeAt(0);e[Number.parseInt(i.toString(),10)]=this._rtlCharacterTypes[Number.parseInt(r.toString(),10)]}return e},t.prototype._setDefaultLevels=function(){for(var t=0;t<this._length;t++)this._levels[Number.parseInt(t.toString(),10)]=this._textOrder},t.prototype._setLevels=function(){this._setDefaultLevels();for(var t=0;t<this._length;++t){var e=this._levels[Number.parseInt(t.toString(),10)];this._levels[Number.parseInt(t.toString(),10)]=e}},t.prototype._updateLevels=function(t,e,i){if(0==(1&e))for(r=t;r<i;++r)this._result[Number.parseInt(r.toString(),10)]===this.R?this._levels[Number.parseInt(r.toString(),10)]+=1:this._result[Number.parseInt(r.toString(),10)]!==this.L&&(this._levels[Number.parseInt(r.toString(),10)]+=2);else for(var r=t;r<i;++r)this._result[Number.parseInt(r.toString(),10)]!==this.R&&(this._levels[Number.parseInt(r.toString(),10)]+=1)},t.prototype._doVisualOrder=function(){this._length=this._type.length,this._result=this._type,this._levels=[],this._setLevels(),this._length=this._getEmbeddedCharactersLength();for(var t=this._textOrder,e=0;e<this._length;){for(var i=this._levels[Number.parseInt(e.toString(),10)],r=0==(1&Math.max(t,i))?this.L:this.R,n=e+1;n<this._length&&this._levels[Number.parseInt(n.toString(),10)]===i;)++n;var s=n<this._length?this._levels[Number.parseInt(n.toString(),10)]:this._textOrder,a=0==(1&Math.max(s,i))?this.L:this.R;this._check(e,n,i,r,a),this._updateLevels(e,i,n),t=i,e=n}this._checkEmbeddedCharacters(this._length)},t.prototype._getEmbeddedCharactersLength=function(){for(var t=0,e=0;e<this._length;++e)this._type[Number.parseInt(e.toString(),10)]!==this.lre&&this._type[Number.parseInt(e.toString(),10)]!==this.rle&&this._type[Number.parseInt(e.toString(),10)]!==this.lro&&this._type[Number.parseInt(e.toString(),10)]!==this.rlo&&this._type[Number.parseInt(e.toString(),10)]!==this.pdf&&this._type[Number.parseInt(e.toString(),10)]!==this.BN&&(this._result[Number.parseInt(t.toString(),10)]=this._result[Number.parseInt(e.toString(),10)],this._levels[Number.parseInt(t.toString(),10)]=this._levels[Number.parseInt(e.toString(),10)],t++);return t},t.prototype._checkEmbeddedCharacters=function(t){for(e=this._type.length-1;e>=0;--e)this._type[Number.parseInt(e.toString(),10)]===this.lre||this._type[Number.parseInt(e.toString(),10)]===this.rle||this._type[Number.parseInt(e.toString(),10)]===this.lro||this._type[Number.parseInt(e.toString(),10)]===this.rlo||this._type[Number.parseInt(e.toString(),10)]===this.pdf||this._type[Number.parseInt(e.toString(),10)]===this.BN?(this._result[Number.parseInt(e.toString(),10)]=this._type[Number.parseInt(e.toString(),10)],this._levels[Number.parseInt(e.toString(),10)]=-1):(t-=1,this._result[Number.parseInt(e.toString(),10)]=this._result[Number.parseInt(t.toString(),10)],this._levels[Number.parseInt(e.toString(),10)]=this._levels[Number.parseInt(t.toString(),10)]);for(var e=0;e<this._type.length;e++)-1===this._levels[Number.parseInt(e.toString(),10)]&&(this._levels[Number.parseInt(e.toString(),10)]=this._levels[e-1])},t.prototype._check=function(t,e,i,r,n){for(var s=r,a=t;a<e;++a)this._result[Number.parseInt(a.toString(),10)]===this.nsm?this._result[Number.parseInt(a.toString(),10)]=s:s=this._result[Number.parseInt(a.toString(),10)];this._checkEuropeanDigits(t,e,i,r,n)},t.prototype._checkEuropeanDigits=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.EN)for(var a=s-1;a>=t;--a)if(this._result[Number.parseInt(a.toString(),10)]===this.L||this._result[Number.parseInt(a.toString(),10)]===this.R||this._result[Number.parseInt(a.toString(),10)]===this.AL){this._result[Number.parseInt(a.toString(),10)]===this.AL&&(this._result[Number.parseInt(s.toString(),10)]=this.AN);break}this._checkArabicCharacters(t,e,i,r,n)},t.prototype._checkArabicCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)this._result[Number.parseInt(s.toString(),10)]===this.AL&&(this._result[Number.parseInt(s.toString(),10)]=this.R);this._checkEuropeanNumberSeparator(t,e,i,r,n)},t.prototype._checkEuropeanNumberSeparator=function(t,e,i,r,n){for(var s=t+1;s<e-1;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.ES||this._result[Number.parseInt(s.toString(),10)]===this.CS){var a=this._result[s-1],o=this._result[s+1];a===this.EN&&o===this.EN?this._result[Number.parseInt(s.toString(),10)]=this.EN:this._result[Number.parseInt(s.toString(),10)]===this.CS&&a===this.AN&&o===this.AN&&(this._result[Number.parseInt(s.toString(),10)]=this.AN)}this._checkEuropeanNumberTerminator(t,e,i,r,n)},t.prototype._checkEuropeanNumberTerminator=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.ET){var a=s,o=[];o.push(this.ET);var h=this._getLength(a,e,o),c=a===t?r:this._result[a-1];c!==this.EN&&(c=h===e?n:this._result[Number.parseInt(h.toString(),10)]),s=h}this._checkOtherNeutrals(t,e,i,r,n)},t.prototype._checkOtherNeutrals=function(t,e,i,r,n){for(var s=t;s<e;++s)this._result[Number.parseInt(s.toString(),10)]!==this.ES&&this._result[Number.parseInt(s.toString(),10)]!==this.ET&&this._result[Number.parseInt(s.toString(),10)]!==this.CS||(this._result[Number.parseInt(s.toString(),10)]=this.ON);this._checkOtherCharacters(t,e,i,r,n)},t.prototype._checkOtherCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.EN){for(var a=r,o=s-1;o>=t;--o)if(this._result[Number.parseInt(o.toString(),10)]===this.L||this._result[Number.parseInt(o.toString(),10)]===this.R){a=this._result[Number.parseInt(o.toString(),10)];break}a===this.L&&(this._result[Number.parseInt(s.toString(),10)]=this.L)}this._checkCharacters(t,e,i,r,n)},t.prototype._getLength=function(t,e,i){for(--t;++t<e;){for(var r=this._result[Number.parseInt(t.toString(),10)],n=0;n<i.length;++n)r===i[Number.parseInt(n.toString(),10)]&&(t=this._getLength(++t,e,i));return t}return e},t.prototype._checkCharacters=function(t,e,i,r,n){for(var s=t;s<e;++s)if(this._result[Number.parseInt(s.toString(),10)]===this.WS||this._result[Number.parseInt(s.toString(),10)]===this.ON||this._result[Number.parseInt(s.toString(),10)]===this.B||this._result[Number.parseInt(s.toString(),10)]===this.S){var a=s,o=[this.B,this.S,this.WS,this.ON],h=this._getLength(a,e,o),c=0,_=0,d=0;a===t?c=r:(c=this._result[a-1])===this.AN?c=this.R:c===this.EN&&(c=this.R),h===e?_=n:(_=this._result[Number.parseInt(h.toString(),10)])===this.AN&&(_=this.R),d=c===_?c:0==(1&i)?this.L:this.R;for(var p=a;p<h;++p)this._result[Number.parseInt(p.toString(),10)]=d;s=h}},t}(),we=function(){function e(){this._openBracket="(",this._closeBracket=")"}return e.prototype._layout=function(t,e,i,r,n){var s=[];return null!==e&&void 0!==e&&null!==t&&void 0!==t&&(e._isUnicode?s=this._customLayout(t,i,n,e,r):(s=[])[0]=t),s},e.prototype._splitLayout=function(t,e,i,r,n){var s=[];if(null!==e&&void 0!==e&&null!==t&&void 0!==t){s=this._customSplitLayout(t,e,i,r,n)}return s},e.prototype._getGlyphIndex=function(t,e,i){if(i=[],null!==e&&void 0!==e&&null!==t&&void 0!==t){if(0===t.length)return{_result:!1,_glyphIndex:i};var r=(new me)._shape(t),n=e._fontInternal._ttfReader;i=[r.length];for(var s=0,a=0,o=r.length;a<o;a++){var h=r[Number.parseInt(a.toString(),10)],c=n._getGlyph(h);null!==c&&void 0!==c&&(i[s++]=c._index)}}var _=new Re;return _._result=!0,_._glyphIndex=i,_},e.prototype._customLayout=function(e,i,r,n,s){if(null===s||void 0===s){o=null;return null!==e&&void 0!==e&&null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none&&(o=(new ve)._getLogicalToVisualString(e,i)),o}var a="",o=[];if(null!==e&&void 0!==e&&null!==n&&void 0!==n){if(null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none){var h=(new me)._shape(e);a=this._customLayout(h,i,r)}if(s){for(var c=a.split(""),_=c.length,d=0;d<_;d++)c[Number.parseInt(d.toString(),10)]=this._addCharacter(n,c[Number.parseInt(d.toString(),10)]);o=c}else(o=[])[0]=this._addCharacter(n,a)}return o},e.prototype._addCharacter=function(t,e){if(null!==t&&void 0!==t&&null!==e&&void 0!==e){var i=t._fontInternal._ttfReader;t._setSymbols(e),e=b(v(e=i._convertString(e)))}return e},e.prototype._customSplitLayout=function(t,e,i,r,n){var s=[];return null!==t&&void 0!==t&&(s=this._customLayout(t,i,n).split("")),s},e}(),Pe=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ae=function(){function e(t,e){"number"==typeof t&&void 0===e?this._size=t:(this._size=t,this._style=e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUnderline",{get:function(){return(this.style&t.PdfFontStyle.underline)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isStrikeout",{get:function(){return(this.style&t.PdfFontStyle.strikeout)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_metrics",{get:function(){return this._fontMetrics},set:function(t){this._fontMetrics=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBold",{get:function(){return(this.style&t.PdfFontStyle.bold)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isItalic",{get:function(){return(this.style&t.PdfFontStyle.italic)>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._metrics._getHeight()},enumerable:!0,configurable:!0}),e.prototype._setInternals=function(t){if(!t)throw new Error("ArgumentNullException:internals");this._pdfFontInternals=t},e.prototype._getCharacterCount=function(t,e){if("string"==typeof e){var i=0,r=0;for(r=t.indexOf(e,r);-1!==r;)i++,r++,r=t.indexOf(e,r);return i}for(var n=0,s=0;s<t.length;s++)-1!==e.indexOf(t[Number.parseInt(s.toString(),10)])&&n++;return n},e.prototype.measureString=function(t,e,i,r,n){if("string"==typeof t&&void 0===e)return this.measureString(t,null);if("string"==typeof t&&(e instanceof Vt||null===e)&&void 0===i&&void 0===r){o=e;return this.measureString(t,o,0,0)}if("string"==typeof t&&(e instanceof Vt||null===e)&&"number"==typeof i&&"number"==typeof r){o=e;return this.measureString(t,0,o,i,r)}if("string"==typeof t&&"number"==typeof e&&(i instanceof Vt||null===i)&&"number"==typeof r&&"number"==typeof n){var s=[e,0],a=i;return this.measureString(t,s,a,r,n)}var o=e,a=i,h=(new Xt)._layout(t,this,a,o);return r=t.length,n=h._empty?0:h._lines.length,h._actualSize},e.prototype._applyFormatSettings=function(t,e,i){var r=i;return void 0!==e&&null!==e&&i>0&&(0!==e.characterSpacing&&(r+=(t.length-1)*e.characterSpacing),0!==e.wordSpacing&&(r+=this._getCharacterCount(t,[" ","\t"])*e.wordSpacing)),r},e}(),ke=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._fontFamily=i,s._checkStyle(),s._initializeInternals(),s}return Pe(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),i.prototype._checkStyle=function(){this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats||(this._style&=~(t.PdfFontStyle.bold|t.PdfFontStyle.italic))},i.prototype.getLineWidth=function(t,e){for(var i=0,r=0,n=t.length;r<n;r++)i+=this._getCharacterWidthInternal(t[Number.parseInt(r.toString(),10)]);return i*=.001*this._metrics._size,i=this._applyFormatSettings(t,e,i)},i.prototype._initializeInternals=function(){this._metrics=Ie._getMetrics(this._fontFamily,this._style,this._size),this._dictionary=this._createInternals()},i.prototype._createInternals=function(){var e=new Tr;return e._updated=!0,e.set("Type",Sr.get("Font")),e.set("Subtype",Sr.get("Type1")),e.set("BaseFont",new Sr(this._metrics._postScriptName)),this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats&&e.set("Encoding",new Sr("WinAnsiEncoding")),e},i.prototype._getCharacterWidthInternal=function(t){var e=0;return e=t.charCodeAt(0),"0"!==this._metrics._name&&"1"!==this._metrics._name&&"2"!==this._metrics._name&&"3"!==this._metrics._name&&"4"!==this._metrics._name||(e-=32),e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}(Ae),xe=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._fontFamily=i,s._size=r,s._initializeInternals(),s}return Pe(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),i.prototype._initializeInternals=function(){this._metrics=Ne._getMetrics(this._fontFamily,this._style,this._size),this._dictionary=this._createInternals()},i.prototype._createInternals=function(){var t=new Tr;return t._updated=!0,t.set("Type",Sr.get("Font")),t.set("Subtype",Sr.get("Type0")),t.set("BaseFont",new Sr(this._metrics._postScriptName)),t.set("Encoding",this._getEncoding(this._fontFamily)),t.set("DescendantFonts",this._getDescendantFont()),t},i.prototype._getEncoding=function(e){var i="Unknown";switch(e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:i="UniKS-UCS2-H";break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:case t.PdfCjkFontFamily.heiseiMinchoW3:i="UniJIS-UCS2-H";break;case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.monotypeSungLight:i="UniCNS-UCS2-H";break;case t.PdfCjkFontFamily.sinoTypeSongLight:i="UniGB-UCS2-H"}return new Sr(i)},i.prototype._getDescendantFont=function(){var t=new Tr;return t._updated=!0,t.set("Type",Sr.get("Font")),t.set("Subtype",Sr.get("CIDFontType2")),t.set("BaseFont",new Sr(this._metrics._postScriptName)),t.set("DW",this._metrics._widthTable._defaultWidth),t.set("W",this._metrics._widthTable._toArray()),t.set("FontDescriptor",Ce._getFontDescriptor(this._fontFamily,this._style,this._metrics)),t.set("CIDSystemInfo",this._getSystemInformation()),[t]},i.prototype._getSystemInformation=function(){var e=new Tr;switch(e._updated=!0,e.set("Registry","Adobe"),this._fontFamily){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:e.set("Ordering","Korea1"),e.set("Supplement",1);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:case t.PdfCjkFontFamily.heiseiMinchoW3:e.set("Ordering","Japan1"),e.set("Supplement",2);break;case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.monotypeSungLight:e.set("Ordering","CNS1"),e.set("Supplement","0");break;case t.PdfCjkFontFamily.sinoTypeSongLight:e.set("Ordering","GB1"),e.set("Supplement",2)}return e},i.prototype.getLineWidth=function(t,e){for(var i=0,r=0;r<t.length;r++)i+=this._getCharacterWidthInternal(t.charCodeAt(r));return i*=.001*this._metrics._size,i=this._applyFormatSettings(t,e,i)},i.prototype._getCharacterWidthInternal=function(t){return t=t>=0?t:0,this._metrics._widthTable._itemAt(t)},i}(Ae),Te=function(e){function i(i,r,n){var s=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return s._isEmbedFont=!1,s._isUnicode=!0,void 0!==n?s._createFontInternal(i,n):s._createFontInternal(i,t.PdfFontStyle.regular),s}return Pe(i,e),Object.defineProperty(i.prototype,"isUnicode",{get:function(){return this._isUnicode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isEmbed",{get:function(){return this._isEmbedFont},enumerable:!0,configurable:!0}),i.prototype._createFontInternal=function(t,e){this._fontInternal=new ye(t,this._size),this._calculateStyle(e),this._initializeInternals()},i.prototype._calculateStyle=function(e){var i=this._fontInternal._ttfMetrics._macStyle;0!=(e&t.PdfFontStyle.underline)&&(i|=t.PdfFontStyle.underline),0!=(e&t.PdfFontStyle.strikeout)&&(i|=t.PdfFontStyle.strikeout),this.style=i},i.prototype._initializeInternals=function(){var t=null;this._fontInternal instanceof ye&&(this._fontInternal._isEmbed=this._isEmbedFont),this._fontInternal._createInternals(),t=this._fontInternal._getInternals(),this._metrics=this._fontInternal._metrics,this._metrics._isUnicodeFont=!0,this._setInternals(t)},i.prototype.getLineWidth=function(e,i){var r=0;if(null!==i&&void 0!==i&&i.textDirection!==t.PdfTextDirection.none)r=this._getUnicodeLineWidth(e,r);else for(var n=0,s=e.length;n<s;n++)r+=this._getCharacterWidthInternal(e[Number.parseInt(n.toString(),10)]);return r*=.001*this._metrics._size,r=this._applyFormatSettings(e,i,r)},i.prototype._getUnicodeLineWidth=function(t,e){e=0;var i=[],r=!1,n=(new we)._getGlyphIndex(t,this,i);if(r=n._result,i=n._glyphIndex,r&&null!==i)for(var s=this._fontInternal._ttfReader,a=0,o=i.length;a<o;a++){var h=i[Number.parseInt(a.toString(),10)],c=s._getGlyph(h);null!==c&&void 0!==c&&(e+=c._width)}return e},i.prototype._getCharacterWidth=function(t,e){var i=this._fontInternal._getCharacterWidth(t);return i*=.001*this._metrics._getSize(e)},i.prototype._setSymbols=function(t){var e=this._fontInternal;null!==e&&void 0!==e&&e._setSymbols(t)},i.prototype._getCharacterWidthInternal=function(t){var e=0;return e=t.charCodeAt(0),"0"!==this._metrics._name&&"1"!==this._metrics._name&&"2"!==this._metrics._name&&"3"!==this._metrics._name&&"4"!==this._metrics._name||(e-=32),e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}(Ae),Ie=function(){function e(){}return e._getMetrics=function(e,i,r){var n=null;switch(e){case t.PdfFontFamily.helvetica:n=this._getHelveticaMetrics(i,r);break;case t.PdfFontFamily.courier:n=this._getCourierMetrics(i,r);break;case t.PdfFontFamily.timesRoman:n=this._getTimesMetrics(i,r);break;case t.PdfFontFamily.symbol:n=this._getSymbolMetrics(r);break;case t.PdfFontFamily.zapfDingbats:n=this._getZapfDingbatsMetrics(r);break;default:n=this._getHelveticaMetrics(i,r)}return n._name=e.toString(),n._subScriptSizeFactor=this._subSuperScriptFactor,n._superscriptSizeFactor=this._subSuperScriptFactor,n},e._getHelveticaMetrics=function(e,i){var r=new zt;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._helveticaBoldItalicAscent,r._descent=this._helveticaBoldItalicDescent,r._postScriptName=this._helveticaBoldItalicName,r._size=i,r._widthTable=new Wt(this._arialBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._helveticaBoldAscent,r._descent=this._helveticaBoldDescent,r._postScriptName=this._helveticaBoldName,r._size=i,r._widthTable=new Wt(this._arialBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._helveticaItalicAscent,r._descent=this._helveticaItalicDescent,r._postScriptName=this._helveticaItalicName,r._size=i,r._widthTable=new Wt(this._arialWidth),r._height=r._ascent-r._descent):(r._ascent=this._helveticaAscent,r._descent=this._helveticaDescent,r._postScriptName=this._helveticaName,r._size=i,r._widthTable=new Wt(this._arialWidth),r._height=r._ascent-r._descent),r},e._getCourierMetrics=function(e,i){var r=new zt;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._courierBoldItalicAscent,r._descent=this._courierBoldItalicDescent,r._postScriptName=this._courierBoldItalicName,r._size=i,r._widthTable=new Wt(this._fixedWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._courierBoldAscent,r._descent=this._courierBoldDescent,r._postScriptName=this._courierBoldName,r._size=i,r._widthTable=new Wt(this._fixedWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._courierItalicAscent,r._descent=this._courierItalicDescent,r._postScriptName=this._courierItalicName,r._size=i,r._widthTable=new Wt(this._fixedWidth),r._height=r._ascent-r._descent):(r._ascent=this._courierAscent,r._descent=this._courierDescent,r._postScriptName=this._courierName,r._size=i,r._widthTable=new Wt(this._fixedWidth),r._height=r._ascent-r._descent),r},e._getTimesMetrics=function(e,i){var r=new zt;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(r._ascent=this._timesBoldItalicAscent,r._descent=this._timesBoldItalicDescent,r._postScriptName=this._timesBoldItalicName,r._size=i,r._widthTable=new Wt(this._timesRomanBoldItalicWidths),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.bold)>0?(r._ascent=this._timesBoldAscent,r._descent=this._timesBoldDescent,r._postScriptName=this._timesBoldName,r._size=i,r._widthTable=new Wt(this._timesRomanBoldWidth),r._height=r._ascent-r._descent):(e&t.PdfFontStyle.italic)>0?(r._ascent=this._timesItalicAscent,r._descent=this._timesItalicDescent,r._postScriptName=this._timesItalicName,r._size=i,r._widthTable=new Wt(this._timesRomanItalicWidth),r._height=r._ascent-r._descent):(r._ascent=this._timesAscent,r._descent=this._timesDescent,r._postScriptName=this._timesName,r._size=i,r._widthTable=new Wt(this._timesRomanWidth),r._height=r._ascent-r._descent),r},e._getSymbolMetrics=function(t){var e=new zt;return e._ascent=this._symbolAscent,e._descent=this._symbolDescent,e._postScriptName=this._symbolName,e._size=t,e._widthTable=new Wt(this._symbolWidth),e._height=e._ascent-e._descent,e},e._getZapfDingbatsMetrics=function(t){var e=new zt;return e._ascent=this._zapfDingbatsAscent,e._descent=this._zapfDingbatsDescent,e._postScriptName=this._zapfDingbatsName,e._size=t,e._widthTable=new Wt(this._zapfDingbatsWidth),e._height=e._ascent-e._descent,e},e._subSuperScriptFactor=1.52,e._helveticaAscent=931,e._helveticaDescent=-225,e._helveticaName="Helvetica",e._helveticaBoldAscent=962,e._helveticaBoldDescent=-228,e._helveticaBoldName="Helvetica-Bold",e._helveticaItalicAscent=931,e._helveticaItalicDescent=-225,e._helveticaItalicName="Helvetica-Oblique",e._helveticaBoldItalicAscent=962,e._helveticaBoldItalicDescent=-228,e._helveticaBoldItalicName="Helvetica-BoldOblique",e._courierAscent=805,e._courierDescent=-250,e._courierName="Courier",e._courierBoldAscent=801,e._courierBoldDescent=-250,e._courierBoldName="Courier-Bold",e._courierItalicAscent=805,e._courierItalicDescent=-250,e._courierItalicName="Courier-Oblique",e._courierBoldItalicAscent=801,e._courierBoldItalicDescent=-250,e._courierBoldItalicName="Courier-BoldOblique",e._timesAscent=898,e._timesDescent=-218,e._timesName="Times-Roman",e._timesBoldAscent=935,e._timesBoldDescent=-218,e._timesBoldName="Times-Bold",e._timesItalicAscent=883,e._timesItalicDescent=-217,e._timesItalicName="Times-Italic",e._timesBoldItalicAscent=921,e._timesBoldItalicDescent=-218,e._timesBoldItalicName="Times-BoldItalic",e._symbolAscent=1010,e._symbolDescent=-293,e._symbolName="Symbol",e._zapfDingbatsAscent=820,e._zapfDingbatsDescent=-143,e._zapfDingbatsName="ZapfDingbats",e._arialWidth=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,0,556,0,222,556,333,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,222,222,333,333,350,556,1e3,333,1e3,500,333,944,0,500,667,0,333,556,556,556,556,260,556,333,737,370,556,584,0,737,333,400,584,333,333,333,556,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500],e._arialBoldWidth=[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,0,556,0,278,556,500,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,278,278,500,500,350,556,1e3,333,1e3,556,333,944,0,500,667,0,333,556,556,556,556,280,556,333,737,370,556,584,0,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,611,611,611,611,611,556,611,556],e._fixedWidth=[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600],e._timesRomanWidth=[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541,0,500,0,333,500,444,1e3,500,500,333,1e3,556,333,889,0,611,0,0,333,333,444,444,350,500,1e3,333,980,389,333,722,0,444,722,0,333,500,500,500,500,200,500,333,760,276,500,564,0,760,333,400,564,300,300,333,500,453,250,333,300,310,500,750,750,750,444,722,722,722,722,722,722,889,667,611,611,611,611,333,333,333,333,722,722,722,722,722,722,722,564,722,722,722,722,722,722,556,500,444,444,444,444,444,444,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,564,500,500,500,500,500,500,500,500],e._timesRomanBoldWidth=[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,1e3,0,667,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,444,722,0,333,500,500,500,500,220,500,333,747,300,500,570,0,747,333,400,570,300,300,333,556,540,250,333,300,330,500,750,750,750,500,722,722,722,722,722,722,1e3,722,667,667,667,667,389,389,389,389,722,722,778,778,778,778,778,570,778,722,722,722,722,722,611,556,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,500,556,500],e._timesRomanItalicWidth=[250,333,420,500,500,833,778,214,333,333,500,675,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,675,675,675,500,920,611,611,667,722,611,611,722,722,333,444,667,556,833,667,722,611,722,611,500,556,722,611,833,611,556,556,389,278,389,422,500,333,500,500,444,500,444,278,500,500,278,278,444,278,722,500,500,500,500,389,389,278,500,444,667,444,444,389,400,275,400,541,0,500,0,333,500,556,889,500,500,333,1e3,500,333,944,0,556,0,0,333,333,556,556,350,500,889,333,980,389,333,667,0,389,556,0,389,500,500,500,500,275,500,333,760,276,500,675,0,760,333,400,675,300,300,333,500,523,250,333,300,310,500,750,750,750,500,611,611,611,611,611,611,889,667,611,611,611,611,333,333,333,333,722,667,722,722,722,722,722,675,722,722,722,722,722,556,611,500,500,500,500,500,500,500,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,675,500,500,500,500,500,444,500,444],e._timesRomanBoldItalicWidths=[250,389,555,500,500,833,778,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,832,667,667,667,722,667,667,722,778,389,500,667,611,889,722,722,611,722,667,556,611,722,667,889,667,611,611,333,278,333,570,500,333,500,500,444,500,444,333,500,556,278,278,500,278,778,556,500,500,500,389,389,278,556,444,667,500,444,389,348,220,348,570,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,944,0,611,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,389,611,0,389,500,500,500,500,220,500,333,747,266,500,606,0,747,333,400,570,300,300,333,576,500,250,333,300,300,500,750,750,750,500,667,667,667,667,667,667,944,667,667,667,667,667,389,389,389,389,722,722,722,722,722,722,722,570,722,722,722,722,722,611,611,500,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,444,500,444],e._symbolWidth=[250,333,713,500,549,833,778,439,333,333,500,549,250,549,250,278,500,500,500,500,500,500,500,500,500,500,278,278,549,549,549,444,549,722,667,722,612,611,763,603,722,333,631,722,686,889,722,722,768,741,556,592,611,690,439,768,645,795,611,333,863,333,658,500,500,631,549,549,494,439,521,411,603,329,603,549,549,576,521,549,549,521,549,603,439,576,713,686,493,686,494,480,200,480,549,750,620,247,549,167,713,500,753,753,753,753,1042,987,603,987,603,400,549,411,549,549,713,494,460,549,549,549,549,1e3,603,1e3,658,823,686,795,987,768,768,823,768,768,713,713,713,713,713,713,713,768,713,790,790,890,823,549,250,713,603,603,1042,987,603,987,603,494,329,790,790,786,713,384,384,384,384,384,384,494,494,494,494,329,274,686,686,686,384,384,384,384,384,384,494,494,494,-1],e._zapfDingbatsWidth=[278,974,961,974,980,719,789,790,791,690,960,939,549,855,911,933,911,945,974,755,846,762,761,571,677,763,760,759,754,494,552,537,577,692,786,788,788,790,793,794,816,823,789,841,823,833,816,831,923,744,723,749,790,792,695,776,768,792,759,707,708,682,701,826,815,789,789,707,687,696,689,786,787,713,791,785,791,873,761,762,762,759,759,892,892,788,784,438,138,277,415,392,392,668,668,390,390,317,317,276,276,509,509,410,410,234,234,334,334,732,544,544,910,667,760,760,776,595,694,626,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,894,838,1016,458,748,924,748,918,927,928,928,834,873,828,924,924,917,930,931,463,883,836,836,867,867,696,696,874,874,760,946,771,865,771,888,967,888,831,873,927,970,918],e}(),Ne=function(){function e(){}return e._getHanyangSystemsGothicMedium=function(e,i){var r=new zt,n=new Ht(1e3);return n._add(new Kt(1,127,500)),n._add(new Kt(8094,8190,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYGoThic-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HYGoThic-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYGoThic-Medium,Italic":r._postScriptName="HYGoThic-Medium",r},e._getHanyangSystemsShinMyeongJoMedium=function(e,i){var r=new zt,n=new Ht(1e3);return n._add(new Kt(1,95,500)),n._add(new Kt(8094,8190,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYSMyeongJo-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HYSMyeongJo-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HYSMyeongJo-Medium,Italic":r._postScriptName="HYSMyeongJo-Medium",r},e._getHeiseiKakuGothicW5=function(e,i){var r=new zt,n=new Ht(1e3);return n._add(new Kt(1,95,500)),n._add(new Kt(231,632,500)),r._widthTable=n,r._ascent=857,r._descent=-125,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiKakuGo-W5,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HeiseiKakuGo-W5,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiKakuGo-W5,Italic":r._postScriptName="HeiseiKakuGo-W5",r},e._getHeiseiMinchoW3=function(e,i){var r=new zt,n=new Ht(1e3);return n._add(new Kt(1,95,500)),n._add(new Kt(231,632,500)),r._widthTable=n,r._ascent=857,r._descent=-143,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiMin-W3,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="HeiseiMin-W3,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="HeiseiMin-W3,Italic":r._postScriptName="HeiseiMin-W3",r},e._getMonotypeHeiMedium=function(e,i){var r=new zt,n=new Ht(1e3);return n._add(new Kt(1,95,500)),n._add(new Kt(13648,13742,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MHei-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="MHei-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MHei-Medium,Italic":r._postScriptName="MHei-Medium",r},e._getMonotypeSungLight=function(e,i){var r=new zt,n=new Ht(1e3);return n._add(new Kt(1,95,500)),n._add(new Kt(13648,13742,500)),r._widthTable=n,r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MSung-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="MSung-Light,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="MSung-Light,Italic":r._postScriptName="MSung-Light",r},e._getSinoTypeSongLight=function(e,i){var r=new zt,n=new Ht(1e3);return n._add(new Kt(1,95,500)),n._add(new Kt(814,939,500)),n._add(new qt(7712,[500])),n._add(new qt(7716,[500])),r._ascent=880,r._descent=-120,r._size=i,r._height=r._ascent-r._descent,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?r._postScriptName="STSong-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?r._postScriptName="STSong-Light,Bold":0!=(e&t.PdfFontStyle.italic)?r._postScriptName="STSong-Light,Italic":r._postScriptName="STSong-Light",r._widthTable=n,r},e._getMetrics=function(e,i,r){var n;switch(e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:(n=this._getHanyangSystemsGothicMedium(i,r))._name="HanyangSystemsGothicMedium";break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:(n=this._getHanyangSystemsShinMyeongJoMedium(i,r))._name="HanyangSystemsShinMyeongJoMedium";break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:(n=this._getHeiseiKakuGothicW5(i,r))._name="HeiseiKakuGothicW5";break;case t.PdfCjkFontFamily.heiseiMinchoW3:(n=this._getHeiseiMinchoW3(i,r))._name="HeiseiMinchoW3";break;case t.PdfCjkFontFamily.monotypeHeiMedium:(n=this._getMonotypeHeiMedium(i,r))._name="MonotypeHeiMedium";break;case t.PdfCjkFontFamily.monotypeSungLight:(n=this._getMonotypeSungLight(i,r))._name="MonotypeSungLight";break;case t.PdfCjkFontFamily.sinoTypeSongLight:(n=this._getSinoTypeSongLight(i,r))._name="SinoTypeSongLight"}return n._subScriptSizeFactor=this._subSuperScriptFactor,n._superscriptSizeFactor=this._subSuperScriptFactor,n},e._subSuperScriptFactor=1.52,e}(),Ce=function(){function e(){}return e._fillMonotypeSungLight=function(t,e,i){var r={x:-160,y:-249,width:1175,height:1137};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHeiseiKakuGothicW5=function(e,i,r,n){var s={x:-92,y:-250,width:1102,height:1172},a={x:-92,y:-250,width:1102,height:1932};(i&(t.PdfFontStyle.italic|t.PdfFontStyle.bold))!==t.PdfFontStyle.italic?this._fillFontBox(e,s):this._fillFontBox(e,a),this._fillKnownInformation(e,r,n),e.set("StemV",93),e.set("StemH",93),e.set("AvgWidth",689),e.set("MaxWidth",1e3),e.set("CapHeight",718),e.set("XHeight",500),e.set("Leading",250)},e._fillHanyangSystemsShinMyeongJoMedium=function(t,e,i){var r={x:0,y:-148,width:1001,height:1028};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHeiseiMinchoW3=function(t,e,i){var r={x:-123,y:-257,width:1124,height:1167};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",702),t.set("MaxWidth",1e3),t.set("CapHeight",718),t.set("XHeight",500),t.set("Leading",250)},e._fillSinoTypeSongLight=function(t,e,i){var r={x:-25,y:-254,width:1025,height:1134};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillMonotypeHeiMedium=function(t,e,i){var r={x:-45,y:-250,width:1060,height:1137};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillHanyangSystemsGothicMedium=function(t,e,i){var r={x:-6,y:-145,width:1009,height:1025};this._fillFontBox(t,r),this._fillKnownInformation(t,e,i),t.set("Flags",4),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},e._fillFontBox=function(t,e){t.set("FontBBox",R(e))},e._fillKnownInformation=function(e,i,r){switch(e.set("FontName",Sr.get(r._postScriptName)),e.set("Type",Sr.get("FontDescriptor")),e.set("ItalicAngle",0),e.set("MissingWidth",r._widthTable._defaultWidth),e.set("Ascent",r._ascent),e.set("Descent",r._descent),i){case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.heiseiKakuGothicW5:e.set("Flags",4);break;case t.PdfCjkFontFamily.sinoTypeSongLight:case t.PdfCjkFontFamily.monotypeSungLight:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:case t.PdfCjkFontFamily.heiseiMinchoW3:e.set("Flags",6)}},e._getFontDescriptor=function(e,i,r){var n=new Tr;switch(n._updated=!0,e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:this._fillHanyangSystemsGothicMedium(n,e,r);break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:this._fillHanyangSystemsShinMyeongJoMedium(n,e,r);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:this._fillHeiseiKakuGothicW5(n,i,e,r);break;case t.PdfCjkFontFamily.heiseiMinchoW3:this._fillHeiseiMinchoW3(n,e,r);break;case t.PdfCjkFontFamily.monotypeHeiMedium:this._fillMonotypeHeiMedium(n,e,r);break;case t.PdfCjkFontFamily.monotypeSungLight:this._fillMonotypeSungLight(n,e,r);break;case t.PdfCjkFontFamily.sinoTypeSongLight:this._fillSinoTypeSongLight(n,e,r)}return n},e}();!function(t){t[t.regular=0]="regular",t[t.bold=1]="bold",t[t.italic=2]="italic",t[t.underline=4]="underline",t[t.strikeout=8]="strikeout"}(t.PdfFontStyle||(t.PdfFontStyle={})),function(t){t[t.helvetica=0]="helvetica",t[t.courier=1]="courier",t[t.timesRoman=2]="timesRoman",t[t.symbol=3]="symbol",t[t.zapfDingbats=4]="zapfDingbats"}(t.PdfFontFamily||(t.PdfFontFamily={})),function(t){t[t.heiseiKakuGothicW5=0]="heiseiKakuGothicW5",t[t.heiseiMinchoW3=1]="heiseiMinchoW3",t[t.hanyangSystemsGothicMedium=2]="hanyangSystemsGothicMedium",t[t.hanyangSystemsShinMyeongJoMedium=3]="hanyangSystemsShinMyeongJoMedium",t[t.monotypeHeiMedium=4]="monotypeHeiMedium",t[t.monotypeSungLight=5]="monotypeSungLight",t[t.sinoTypeSongLight=6]="sinoTypeSongLight"}(t.PdfCjkFontFamily||(t.PdfCjkFontFamily={}));var Re=function(){function t(){this._result=!1,this._glyphIndex=[]}return t}(),Fe=function(){function e(){this._isRoundedRectangle=!1,this._fillMode=t.PdfFillMode.winding,this._points=[],this._pathTypes=[],this._isStart=!0}return Object.defineProperty(e.prototype,"_lastPoint",{get:function(){var t=[0,0],e=this._points.length;return this._points.length>0&&(t[0]=this._points[e-1][0],t[1]=this._points[e-1][0]),t},enumerable:!0,configurable:!0}),e.prototype._addLine=function(e,i,r,n){this._addPoints([e,i,r,n],t._PathPointType.line)},e.prototype._addLines=function(e){var i=e[0];if(1===e.length)this._addPoint(e[0],t._PathPointType.line);else for(var r=1;r<e.length;r++){var n=e[Number.parseInt(r.toString(),10)];this._addLine(i[0],i[1],n[0],n[1]),i=n}},e.prototype._addPoints=function(e,i,r,n){for(var s=void 0!==r?r:0,a=void 0!==n?n:e.length,o=s;o<a;o++){var h=[e[Number.parseInt(o.toString(),10)],e[o+1]];o===s?0===this._points.length||this._isStart?(this._addPoint(h,t._PathPointType.start),this._isStart=!1):!this._isRoundedRectangle||h[0]===this._lastPoint[0]&&h[1]===this._lastPoint[1]?h[0]!==this._lastPoint[0]&&h[1]!==this._lastPoint[1]&&this._addPoint(h,t._PathPointType.line):this._addPoint(h,t._PathPointType.line):this._addPoint(h,i),o++}},e.prototype._addPoint=function(t,e){this._points.push(t),this._pathTypes.push(e)},e.prototype._addArc=function(e,i,r,n,s,a){for(var o=q(e,i,e+r,i+n,s,a),h=0;h<o.length;++h){var c=[o[Number.parseInt(h.toString(),10)],o[++h],o[++h],o[++h],o[++h],o[++h],o[++h],o[++h]];this._addPoints(c,t._PathPointType.bezier)}},e.prototype._addRectangle=function(e,i,r,n){this._startFigure(),this._addPoints([e,i,e+r,i,e+r,i+n,e,i+n],t._PathPointType.line),this._closeFigure()},e.prototype._addPolygon=function(e){var i=[];e.forEach(function(t){i.push(t[0],t[1])}),this._startFigure(),this._addPoints(i,t._PathPointType.line),this._closeFigure()},e.prototype._addEllipse=function(t,e,i,r){this._startFigure(),this._addArc(t,e,i,r,0,360),this._closeFigure()},e.prototype._addBezierPoints=function(t){if(t.length<4)throw Error("Incorrect size of array points");var e=0,i=t[Number.parseInt(e.toString(),10)];for(e++;e+3<=t.length;){var r=t[Number.parseInt(e.toString(),10)];e++;var n=t[Number.parseInt(e.toString(),10)];e++;var s=t[Number.parseInt(e.toString(),10)];e++,this._addBezier(i[0],i[1],r[0],r[1],n[0],n[1],s[0],s[1]),i=s}},e.prototype._addBezier=function(e,i,r,n,s,a,o,h){var c=[];c.push(e),c.push(i),c.push(r),c.push(n),c.push(s),c.push(a),c.push(o),c.push(h),this._addPoints(c,t._PathPointType.bezier)},e.prototype._closeFigure=function(e){if(void 0!==e){var i=this._pathTypes[Number.parseInt(e.toString(),10)];i|=t._PathPointType.closePath,this._pathTypes[Number.parseInt(e.toString(),10)]=i}else this._points.length>0&&this._closeFigure(this._points.length-1),this._startFigure()},e.prototype._startFigure=function(){this._isStart=!0},e.prototype._getBounds=function(){var t=[0,0,0,0];if(this._points.length>0){for(var e=this._points[0][0],i=this._points[0][0],r=this._points[0][1],n=this._points[0][1],s=1;s<this._points.length;++s){var a=this._points[Number.parseInt(s.toString(),10)];e=Math.min(a[0],e),i=Math.max(a[0],i),r=Math.min(a[1],r),n=Math.max(a[1],n)}t=[e,r,i-e,n-r]}return t},e}();!function(t){t[t.start=0]="start",t[t.line=1]="line",t[t.bezier=3]="bezier",t[t.pathTypeMask=7]="pathTypeMask",t[t.dashMode=16]="dashMode",t[t.pathMarker=32]="pathMarker",t[t.closePath=128]="closePath"}(t._PathPointType||(t._PathPointType={}));var Be=function(){function e(){}return Object.defineProperty(e.prototype,"width",{get:function(){return this._imageWidth},set:function(t){this._imageWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._imageHeight},set:function(t){this._imageHeight=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"physicalDimension",{get:function(){return this._imagePhysicalDimension=this._getPointSize(this.width,this.height,this._horizontalResolution),[this.width,this.height]},enumerable:!0,configurable:!0}),e.prototype.draw=function(t,e,i){null!==e&&void 0!==e||null!==i&&void 0!==i||(e=0,i=0);var r=0!==e||0!==i,n=null;r&&(n=t.save(),t.translateTransform(e,i)),t.drawImage(this,0,0),r&&t.restore(n)},e.prototype._getPointSize=function(e,i,r){if(null===r||void 0===r){return a=this._getPointSize(e,i,96)}var n=new ze,s=new ze,a=[n._convertUnits(e,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point),s._convertUnits(i,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point)];return a},e}(),Le=function(){function e(t,e,i,r){if(this._pendingResource=[],this._hasResourceReference=!1,r instanceof $i?(this._source=r._pageDictionary,this._page=r):r instanceof Ze&&(this._source=r._content.dictionary,this._template=r),this._source&&this._source.has("Resources")){var n=this._source.getRaw("Resources");n instanceof Pr?(this._hasResourceReference=!0,this._resourceObject=i._fetch(n)):n instanceof Tr&&(this._resourceObject=n)}else this._resourceObject=new Tr,this._source.update("Resources",this._resourceObject);this._crossReference=i,this._sw=new Et(e),this._size=t,H("PDF",this._resourceObject),this._initialize()}return Object.defineProperty(e.prototype,"clientSize",{get:function(){return[this._clipBounds[2],this._clipBounds[3]]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_matrix",{get:function(){return void 0===this._m&&(this._m=new Me),this._m},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_resources",{get:function(){var t=this;if(void 0===this._resourceMap){if(this._resourceMap=new Map,this._resourceObject.has("Font")){var e=this._resourceObject.get("Font");e&&e.size>0&&e.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof Pr&&t._resourceMap.set(i,Sr.get(e))})}if(this._resourceObject.has("XObject")){var i=this._resourceObject.get("XObject");i&&i.size>0&&i.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof Pr&&t._resourceMap.set(i,Sr.get(e))})}if(this._resourceObject.has("ExtGState")){var r=this._resourceObject.get("ExtGState");r&&r.size>0&&(this._transparencies||(this._transparencies=new Map),r.forEach(function(e,i){null!==i&&void 0!==i&&i instanceof Pr&&t._setTransparencyData(i,Sr.get(e))}))}}return this._resourceMap},enumerable:!0,configurable:!0}),e.prototype.save=function(){var t=new Oe(this,this._matrix);return t._textRenderingMode=this._textRenderingMode,t._charSpacing=this._characterSpacing,t._textScaling=this._textScaling,t._wordSpacing=this._wordSpacing,t._currentBrush=this._currentBrush,t._currentPen=this._currentPen,t._currentFont=this._currentFont,this._graphicsState.push(t),this._sw._saveGraphicsState(),t},e.prototype.restore=function(t){if(this._graphicsState.length>0)if(void 0===t)this._doRestore();else if(this._graphicsState.length>0&&-1!==this._graphicsState.indexOf(t))for(;this._graphicsState.length>0&&this._doRestore()!==t;);},e.prototype._doRestore=function(){var t=this._graphicsState.pop();return this._m=t._transformationMatrix,this._currentBrush=t._currentBrush,this._currentPen=t._currentPen,this._currentFont=t._currentFont,this._characterSpacing=t._charSpacing,this._wordSpacing=t._wordSpacing,this._textScaling=t._textScaling,this._textRenderingMode=t._textRenderingMode,this._sw._restoreGraphicsState(),t},e.prototype.drawRectangle=function(t,e,i,r,n,s){var a,o;n instanceof je?(a=n,s&&(o=s)):o=n,this._stateControl(a,o),this._sw._appendRectangle(t,e,i,r),this._drawGraphicsPath(a,o)},e.prototype.drawPolygon=function(e,i,r){if(e.length>0){var n=void 0,s=void 0;i instanceof je?(n=i,r&&(s=r)):s=i,this._stateControl(n,s),this._sw._beginPath(e[0][0],e[0][1]);for(var a=1;a<e.length;a++)this._sw._appendLineSegment(e[Number.parseInt(a.toString(),10)][0],e[Number.parseInt(a.toString(),10)][1]);this._drawGraphicsPath(n,s,t.PdfFillMode.winding,!0)}},e.prototype.drawEllipse=function(e,i,r,n,s,a){var o,h;s instanceof je?(o=s,a&&(h=a)):h=s,this._stateControl(o,h),this._constructArcPath(e,i,e+r,i+n,0,360),this._drawGraphicsPath(o,h,t.PdfFillMode.winding,!0)},e.prototype.drawArc=function(e,i,r,n,s,a,o){0!==a&&(this._stateControl(o),this._constructArcPath(e,i,e+r,i+n,s,a),this._drawGraphicsPath(o,null,t.PdfFillMode.winding,!1))},e.prototype.drawImage=function(t,e,i,r,n){if("number"==typeof e&&"number"==typeof i&&void 0===r){var s=t.physicalDimension;this.drawImage(t,e,i,s[0],s[1])}else{t._save();var a=new Me;this._getTranslateTransform(e,i+n,a),this._getScaleTransform(r,n,a),this._sw._write("q"),this._sw._modifyCtm(a);var o=void 0,h=void 0,c=!0;if(this._resourceObject.has("XObject")){var _=this._resourceObject.getRaw("XObject");_ instanceof Tr&&(o=_),o&&(c=!1)}c&&(o=new Tr(this._crossReference),this._resourceObject.update("XObject",o)),void 0===h&&(h=Sr.get(G())),this._crossReference?(this._updateImageResource(t,h,o,this._crossReference),this._source.update("Resources",this._resourceObject),this._source._updated=!0):this._pendingResource.push({resource:t,key:h,source:o}),this._sw._executeObject(h),this._sw._write("Q"),this._sw._write("\r\n"),H("ImageB",this._resourceObject),H("ImageC",this._resourceObject),H("ImageI",this._resourceObject),H("Text",this._resourceObject)}},e.prototype.drawTemplate=function(t,e){var i=this;if(void 0!==t){t._isExported&&(this._crossReference?(t._crossReference=this._crossReference,t._importStream(!0)):(t._importStream(!1),this._pendingResource.push(t)));var r=t&&t._size[0]>0?e.width/t._size[0]:1,n=t&&t._size[1]>0?e.height/t._size[1]:1,s=!(1===r&&1===n),a=void 0,o=void 0;this._page&&(a=this._page.cropBox,o=this._page.mediaBox,this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&a[0]>0&&a[1]>0&&o[0]<0&&o[1]<0&&(this.translateTransform(a[0],-a[1]),e.x=-a[0],e.y=a[1]));var h=this.save(),c=new Me;if(this._page){var _=this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&a&&o&&a[0]===o[0]&&a[1]===o[1]&&a[2]===o[2]&&a[3]===o[3]||this._page._pageDictionary.has("MediaBox")&&o&&0===o[3];c._translate(e.x,-(e.y+(this._page._origin[0]>=0||_?e.height:0)))}else c._translate(e.x,-(e.y+e.height));if(s)if(t._isAnnotationTemplate&&t._needScale){var d=!1;if(t._content&&t._content.dictionary){var p=t._content.dictionary;if(p.has("Matrix")&&p.has("BBox")){var l=p.getArray("Matrix"),u=p.getArray("BBox");if(l&&u&&l.length>5&&u.length>3){var f=Number.parseFloat(y(-l[1])),g=Number.parseFloat(y(l[2])),m=Number.parseFloat(y(r)),b=Number.parseFloat(y(n));m===f&&b===g&&u[2]===t._size[0]&&u[3]===t._size[1]&&((c=new Me)._translate(e.x-l[4],e.y+l[5]),c._scale(1,1),d=!0)}}}d||c._scale(r,n)}else c._scale(r,n);this._sw._modifyCtm(c);var v,S,w=void 0,P=!1,A=!0;if(this._resourceObject.has("XObject")){var k=this._resourceObject.getRaw("XObject");k instanceof Pr?(P=!0,w=this._crossReference._fetch(k)):k instanceof Tr&&(w=k),w&&(A=!1,this._resources.forEach(function(e,r){if(r&&r instanceof Pr){var n=i._crossReference._fetch(r);n&&t&&n===t._content&&(v=e,S=r)}}))}A&&(w=new Tr(this._crossReference),this._resourceObject.update("XObject",w)),void 0===v&&(v=Sr.get(G()),t&&t._content.reference?S=t._content.reference:this._crossReference?S=this._crossReference._getNextReference():this._pendingResource.push({resource:t._content,key:v,source:w}),S&&this._crossReference&&(!this._crossReference._cacheMap.has(S)&&t&&t._content&&this._crossReference._cacheMap.set(S,t._content),w.update(v.name,S),this._resources.set(S,v)),this._resourceObject._updated=!0),P&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._executeObject(v),this.restore(h),H("ImageB",this._resourceObject),H("ImageC",this._resourceObject),H("ImageI",this._resourceObject),H("Text",this._resourceObject)}},e.prototype._processResources=function(t){if(this._crossReference=t,this._pendingResource.length>0){for(var e=0;e<this._pendingResource.length;e++){var i=this._pendingResource[Number.parseInt(e.toString(),10)];if(i instanceof Ze)i._crossReference=t,i._updatePendingResource(t);else if(i.resource instanceof Cr){var r=void 0;i.resource._reference?r=i.resource._reference:(r=t._getNextReference(),i.resource._reference=r),!t._cacheMap.has(r)&&i.resource&&t._cacheMap.set(r,i.resource),i.source.update(i.key.name,r),this._resources.set(r,i.key)}else i.resource instanceof Be?this._updateImageResource(i.resource,i.key,i.source,t):i.resource instanceof Ae&&this._updateFontResource(i.resource,i.key,i.source,t);this._source.update("Resources",this._resourceObject),this._source._updated=!0}this._pendingResource=[]}},e.prototype._updateImageResource=function(t,e,i,r){var n;if(t._reference?n=t._reference:(n=r._getNextReference(),t._reference=n),!r._cacheMap.has(n)&&t&&t._imageStream&&t._imageStream.dictionary&&(r._cacheMap.set(n,t._imageStream),t._imageStream.dictionary._updated=!0,t._maskStream&&t._maskStream.dictionary)){var s=void 0;t._maskReference?s=t._maskReference:(s=r._getNextReference(),t._maskReference=s),r._cacheMap.set(s,t._maskStream),t._maskStream.dictionary._updated=!0,t._imageStream.dictionary.set("SMask",s)}i.update(e.name,n),this._resources.set(n,e),this._resourceObject._updated=!0},e.prototype._updateFontResource=function(t,e,i,r){var n;if(t._reference?n=t._reference:(n=r._getNextReference(),t._reference=n),!r._cacheMap.has(n))if(t._dictionary)r._cacheMap.set(n,t._dictionary),i.update(e.name,n),this._resources.set(n,e);else if(t instanceof Te){var s=t._fontInternal;s&&s._fontDictionary&&r._cacheMap.set(n,s._fontDictionary),i.update(e.name,n),this._resources.set(n,e)}},e.prototype._drawPath=function(t,e,i){(e||i)&&(this._stateControl(e,i,null),this._buildUpPath(t._points,t._pathTypes),this._drawGraphicsPath(e,i,t._fillMode,!1))},e.prototype.drawRoundedRectangle=function(t,e,i,r,n,s,a){if(null===s)throw new Error("pen");if(null===a)throw new Error("brush");var o=[t,e,i,r],h=2*n,c=[h,h],_=[o[0],o[1],c[0],c[1]],d=new Fe;0===n?(d._addRectangle(o[0],o[1],o[2],o[3]),this._drawPath(d,s,a)):(d._isRoundedRectangle=!0,d._addArc(_[0],_[1],_[2],_[3],180,90),_[0]=o[0]+o[2]-h,d._addArc(_[0],_[1],_[2],_[3],270,90),_[1]=o[1]+o[3]-h,d._addArc(_[0],_[1],_[2],_[3],0,90),_[0]=o[0],d._addArc(_[0],_[1],_[2],_[3],90,90),d._closeFigure(),this._drawPath(d,s,a))},e.prototype._constructArcPath=function(t,e,i,r,n,s){var a=q(t,e,i,r,n,s);if(8!==a.length){var o=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]];this._sw._beginPath(o[0],o[1]);for(var h=0;h<a.length;h+=8)o=[a[Number.parseInt(h.toString(),10)],a[h+1],a[h+2],a[h+3],a[h+4],a[h+5],a[h+6],a[h+7]],this._sw._appendBezierSegment(o[2],o[3],o[4],o[5],o[6],o[7])}},e.prototype._writePen=function(t){for(var e=t._width,i=t._dashPattern,r=0;r<i.length;++r)i[r]*=t._width;this._sw._setLineDashPattern(i,t._dashOffset*e),this._sw._setLineWidth(t._width),this._sw._setLineJoin(t._lineJoin),this._sw._setLineCap(t._lineCap),t._miterLimit>0&&this._sw._setMiterLimit(t._miterLimit),this._sw._setColor(t._color,!0)},e.prototype.drawString=function(t,e,i,r,n,s){var a=(new Xt)._layout(t,e,s,[i[2],i[3]]);if(!a._empty){var o=this._checkCorrectLayoutRectangle(a._actualSize,i[0],i[1],s);i[2]<=0&&(i[0]=o[0],i[2]=o[2]),i[3]<=0&&(i[1]=o[1],i[3]=o[3]),this._drawStringLayoutResult(a,e,r,n,i,s)}H("Text",this._resourceObject)},e.prototype._buildUpPath=function(e,i){for(var r=0;r<e.length;r++){var n=e[Number.parseInt(r.toString(),10)],s=i[Number.parseInt(r.toString(),10)];switch(15&s){case t._PathPointType.start:this._sw._beginPath(n[0],n[1]);break;case t._PathPointType.bezier:var a=this._getBezierPoint(e,i,r);r=a.index;var o=a.point;r=(a=this._getBezierPoint(e,i,r)).index;var h=a.point;this._sw._appendBezierSegment(n[0],n[1],o[0],o[1],h[0],h[1]);break;case t._PathPointType.line:this._sw._appendLineSegment(n[0],n[1]);break;default:throw new Error("Incorrect path formation.")}((s=i[Number.parseInt(r.toString(),10)])&t._PathPointType.closePath)===t._PathPointType.closePath&&this._sw._closePath()}},e.prototype._getBezierPoint=function(e,i,r){if(i[Number.parseInt(r.toString(),10)]!==t._PathPointType.bezier)throw new Error("Malforming path.");return r++,{index:r,point:e[Number.parseInt(r.toString(),10)]}},e.prototype._initialize=function(){this._mediaBoxUpperRightBound=0,this._characterSpacing=-1,this._wordSpacing=-1,this._textScaling=-100,this._textRenderingMode=-1,this._graphicsState=[],this._clipBounds=[0,0,this._size[0],this._size[1]],this._colorSpaceInitialized=!1,this._startCutIndex=-1},e.prototype._initializeCurrentColorSpace=function(){this._colorSpaceInitialized||(this._sw._setColorSpace("DeviceRGB",!0),this._sw._setColorSpace("DeviceRGB",!1),this._colorSpaceInitialized=!0)},e.prototype._brushControl=function(t){this._sw._setColor(t._color,!1),this._currentBrush=t},e.prototype._penControl=function(t){this._currentPen=t,this._writePen(t),this._currentPen=t},e.prototype._fontControl=function(t,e){var i=this,r=t._metrics._getSize(e);this._currentFont=t;var n,s,a,o=!1,h=!0,c=!1;if(this._resourceObject.has("Font")){var _=this._resourceObject.getRaw("Font");null!==_&&void 0!==_&&(_ instanceof Pr?(o=!0,n=this._crossReference._fetch(_)):_ instanceof Tr&&(n=_)),void 0!==n&&null!==n&&(h=!1,this._resources.forEach(function(e,r){if(i._crossReference){if(null!==r&&void 0!==r){var n=i._crossReference._fetch(r);n&&(t instanceof ke&&n===t._dictionary||t instanceof Te&&n===t._fontInternal._fontDictionary)&&(s=e,a=r,c=!0)}}else t._reference&&t._reference===r&&(s=e,a=r,c=!0)}))}if(h&&(n=new Tr(this._crossReference),this._resourceObject.update("Font",n)),void 0===s){if(s=Sr.get(G()),a||(t._reference?(a=t._reference,n.update(s.name,a)):this._crossReference?a=this._crossReference._getNextReference():this._pendingResource.push({resource:t,key:s,source:n})),a&&this._crossReference)if(t._reference||(t._reference=a),t._dictionary)this._crossReference._cacheMap.set(a,t._dictionary),n.update(s.name,a);else if(t instanceof Te){var d=t._fontInternal;d&&d._fontDictionary&&this._crossReference._cacheMap.set(a,d._fontDictionary),n.update(s.name,a)}c||this._resources.set(a,s)}o&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._setFont(s.name,r)},e.prototype._stateControl=function(t,e,i,r){(t||e)&&this._initializeCurrentColorSpace(),t&&this._penControl(t),e&&this._brushControl(e),i&&this._fontControl(i,r)},e.prototype._drawStringLayoutResult=function(e,i,r,n,s,a){if(!e._empty){var o=a&&void 0!==a.lineLimit&&!a.lineLimit,h=void 0===a||a&&void 0!==a.noClip&&!a.noClip,c=o&&h,_=void 0;if(c){_=this.save();var d=[s[0],s[1],e._actualSize[0],e._actualSize[1]];s[2]>0&&(d[2]=s[2]),a.lineAlignment===t.PdfVerticalAlignment.middle?d[1]+=(s[3]-d[3])/2:a.lineAlignment===t.PdfVerticalAlignment.bottom&&(d[1]+=s[3]-d[3]),this.setClip(d)}this._applyStringSettings(i,r,n,a);var p=void 0!==a&&null!==a?a.horizontalScalingFactor:100;p!==this._textScaling&&(this._sw._setTextScaling(p),this._textScaling=p);var l=this._getTextVerticalAlignShift(e._actualSize[1],s[3],a),u=void 0===a||null===a||0===a.lineSpacing?i._metrics._getHeight(a):a.lineSpacing+i._metrics._getHeight(a),f=0;f=null!==a&&void 0!==a&&a.subSuperScript===t.PdfSubSuperScript.subScript?u-(i.height+i._metrics._getDescent(a)):u-i._metrics._getAscent(a),a&&a.lineAlignment===t.PdfVerticalAlignment.bottom&&s[3]-e._actualSize[1]!=0&&s[3]-e._actualSize[1]<i._metrics._size/2-1&&Number.parseFloat(y(s[3]))<=Number.parseFloat(y(i._metrics._getHeight(a)))&&(f=-u/i._metrics._size);var g=new Me;g._translate(s[0],-(s[1]+i._metrics._getHeight(a))-(i._metrics._getDescent(a)>0?-i._metrics._getDescent(a):i._metrics._getDescent(a))-l),this._sw._modifyTM(g),s[3]<i._metrics._size&&e._actualSize[1]-s[3]<i._metrics._size/2-1&&(l=0),0!==l&&null!==a&&a.lineAlignment===t.PdfVerticalAlignment.bottom&&s[3]-e._actualSize[1]!=0&&s[3]-e._actualSize[1]>i._metrics._size/2-1&&(l-=(f-(u-i._metrics._size))/2),this._drawLayoutResult(e,i,a,s),0!==l&&this._sw._startNextLine(0,-(l-e._lineHeight)),H("Text",this._resourceObject),this._sw._endText(),this._underlineStrikeoutText(n,e,i,s,a),c&&this.restore(_)}},e.prototype._getNextPage=function(){var t,e=this._crossReference._document.pageCount;return this._page._pageIndex<e-2&&(t=this._crossReference._document.getPage(this._page._pageIndex+1)),t},e.prototype._applyStringSettings=function(e,i,r,n){var s=t._TextRenderingMode.fill;null!==i&&null!==r?s=t._TextRenderingMode.fillStroke:i?s=t._TextRenderingMode.stroke:r&&(s=t._TextRenderingMode.fill),n&&n.clipPath&&(s|=t._TextRenderingMode.clipFlag),this._sw._beginText(),this._stateControl(i,r,e,n),s!==this._textRenderingMode&&(this._sw._setTextRenderingMode(s),this._textRenderingMode=s);var a=void 0!==n&&null!==n?n.characterSpacing:0;a!==this._characterSpacing&&(this._sw._setCharacterSpacing(a),this._characterSpacing=a);var o=void 0!==n&&null!==n?n.wordSpacing:0;o!==this._wordSpacing&&(this._sw._setWordSpacing(o),this._wordSpacing=o)},e.prototype._drawLayoutResult=function(t,e,i,r){for(var n=void 0===i||null===i||0===i.lineSpacing?e._metrics._getHeight(i):i.lineSpacing+e._metrics._getHeight(i),s=t._lines,a=e,o=null!==a&&a.isUnicode,h=0,c=s.length;h<c&&h!==this._startCutIndex;h++){var _=s[Number.parseInt(h.toString(),10)],d=_._width,p=this._getHorizontalAlignShift(d,r[2],i)+this._getLineIndent(_,i,r[2],0===h);if(0!==p&&this._sw._startNextLine(p,0),o?this._drawUnicodeLine(_,r[2],e,i):this._drawAsciiLine(_,r[2],i,e),h+1!==c){var l=this._getTextVerticalAlignShift(t._actualSize[1],r[3],i),u=new Me,f=-(r[1]+e._metrics._getHeight(i))-e._metrics._getDescent(i)-l-n*(h+1);u._translate(r[0],f),this._sw._modifyTM(u)}}},e.prototype._drawUnicodeLine=function(e,i,r,n){var s=e._text,a=null!==n&&void 0!==n&&n.rightToLeft,o=null!==n&&void 0!==n&&(0!==n.wordSpacing||n.alignment===t.PdfTextAlignment.justify),h=r,c=this._justifyLine(e,i,n,h),_=new we;if(a||null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none){var d=[],p=null!==n&&void 0!==n&&n.alignment===t.PdfTextAlignment.right,l=[];(d=null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none?_._layout(s,h,n.textDirection===t.PdfTextDirection.rightToLeft,o,n):_._layout(s,h,p,o,n)).length>1?null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none&&(l=_._splitLayout(s,h,n.textDirection===t.PdfTextDirection.rightToLeft,o,n)):l=[s],this._drawUnicodeBlocks(d,l,h,n,c)}else if(o){var u=this._breakUnicodeLine(s,h,null),d=u.tokens,l=u.words;this._drawUnicodeBlocks(d,l,h,n,c)}else{var f=this._convertToUnicode(s,h);this._sw._showNextLineText(f,!0)}},e.prototype._drawUnicodeBlocks=function(t,e,i,r,n){if(null!==t&&void 0!==t&&t.length>0&&null!==e&&void 0!==e&&e.length>0&&null!==i&&void 0!==i){this._sw._startNextLine();var s=0,a=0,o=0,h=0;try{null!==r&&void 0!==r&&(o=r.firstLineIndent,h=r.paragraphIndent,r.firstLineIndent=0,r.paragraphIndent=0);var c=i._getCharacterWidth(Yt._whiteSpace,r)+n,_=null!==r?r.characterSpacing:0;c+=_+(null!==r&&void 0!==r&&0===n?r.wordSpacing:0);for(var d=0;d<t.length;d++){var p=t[d],l=e[d],u=0;0!==s&&this._sw._startNextLine(s,0),l.length>0&&(u+=i.measureString(l,r)[0],u+=_,this._sw._showText(p)),d!==t.length-1&&(a+=s=u+c)}a>0&&this._sw._startNextLine(-a,0)}finally{null!==r&&void 0!==r&&(r.firstLineIndent=o,r.paragraphIndent=h)}}},e.prototype._breakUnicodeLine=function(t,e,i){var r=[];if(null!==t&&void 0!==t&&t.length>0){i=t.split(null);for(var n=0;n<i.length;n++){var s=i[n],a=this._convertToUnicode(s,e);r[Number.parseInt(n.toString(),10)]=a}}return{tokens:r,words:i}},e.prototype._convertToUnicode=function(t,e){var i=null;if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e._fontInternal instanceof ye){var r=e._fontInternal._ttfReader;e._setSymbols(t),i=b(v(i=r._convertString(t)))}return i},e.prototype._getTextVerticalAlignShift=function(e,i,r){var n=0;if(i>=0&&void 0!==r&&null!==r&&r.lineAlignment!==t.PdfVerticalAlignment.top)switch(r.lineAlignment){case t.PdfVerticalAlignment.middle:n=(i-e)/2;break;case t.PdfVerticalAlignment.bottom:n=i-e}return n},e.prototype._getHorizontalAlignShift=function(e,i,r){var n=0;if(i>=0&&void 0!==r&&null!==r&&r.alignment!==t.PdfTextAlignment.left)switch(r.alignment){case t.PdfTextAlignment.center:n=(i-e)/2;break;case t.PdfTextAlignment.right:n=i-e}return n},e.prototype._getLineIndent=function(e,i,r,n){var s=0,a=(e._lineType&t._LineType.firstParagraphLine)>0;return i&&a&&(s=n?i.firstLineIndent:i.paragraphIndent,s=r>0?Math.min(r,s):s),s},e.prototype._drawAsciiLine=function(t,e,i,r){this._justifyLine(t,e,i,r);var n="";if(-1!==t._text.indexOf("(")||-1!==t._text.indexOf(")"))for(var s=0;s<t._text.length;s++)"("===t._text[Number.parseInt(s.toString(),10)]?n+="\\(":")"===t._text[Number.parseInt(s.toString(),10)]?n+="\\)":n+=t._text[Number.parseInt(s.toString(),10)];""===n&&(n=t._text),this._sw._showNextLineText("("+n+")")},e.prototype._justifyLine=function(e,i,r,n){var s=e._text,a=e._width,o=this._shouldJustify(e,i,r,n),h=r&&0!==r.wordSpacing,c=n._getCharacterCount(s,[" ","\t"]),_=0;return o?(h&&(a-=c*r.wordSpacing),_=(i-a)/c,this._sw._setWordSpacing(_)):r&&r.alignment===t.PdfTextAlignment.justify&&this._sw._setWordSpacing(0),_},e.prototype._shouldJustify=function(e,i,r,n){var s=e._text,a=e._width,o=r&&r.alignment===t.PdfTextAlignment.justify,h=i>=0&&a<i,c=n._getCharacterCount(s,[" ","\t"])>0&&" "!==s[0],_=(e._lineType&t._LineType.layoutBreak)>0;return o&&h&&c&&(_||r.alignment===t.PdfTextAlignment.justify)},e.prototype._underlineStrikeoutText=function(t,e,i,r,n){if(i.isUnderline||i.isStrikeout){var s=this._createUnderlineStrikeoutPen(t,i);if(void 0!==s&&null!==s)for(var a=this._getTextVerticalAlignShift(e._actualSize[1],r[3],n),o=r[1]+a+i._metrics._getAscent(n)+1.5*s._width,h=r[1]+a+i._metrics._getHeight(n)/2+1.5*s._width,c=e._lines,_=0;_<e._lineCount;_++){var d=c[Number.parseInt(_.toString(),10)],p=d._width,l=this._getHorizontalAlignShift(p,r[2],n),u=this._getLineIndent(d,n,r[2],0===_),f=r[0]+l,g=this._shouldJustify(d,r[2],n,i)?f+r[2]-u:f+p-u;i.isUnderline&&(this.drawLine(s,f,o,g,o),o+=e._lineHeight),i.isStrikeout&&(this.drawLine(s,f,h,g,h),h+=e._lineHeight)}}},e.prototype.drawLine=function(t,e,i,r,n){this._stateControl(t),this._sw._beginPath(e,i),this._sw._appendLineSegment(r,n),this._sw._strokePath(),H("PDF",this._resourceObject)},e.prototype._createUnderlineStrikeoutPen=function(t,e){return new je(t._color,e._metrics._size/20)},e.prototype._checkCorrectLayoutRectangle=function(e,i,r,n){var s=[i,r,e[0],e[0]];if(n){switch(n.alignment){case t.PdfTextAlignment.center:s[0]=s[0]-s[2]/2;break;case t.PdfTextAlignment.right:s[0]=s[0]-s[2]}switch(n.lineAlignment){case t.PdfVerticalAlignment.middle:s[1]=s[1]-s[3]/2;break;case t.PdfVerticalAlignment.bottom:s[1]=s[1]-s[3]}}return s},e.prototype._drawGraphicsPath=function(e,i,r,n){void 0===r&&(r=t.PdfFillMode.winding);var s=void 0!==i&&null!==i,a=void 0!==e&&null!==e,o=r===t.PdfFillMode.alternate;a&&s?n?this._sw._closeFillStrokePath(o):this._sw._fillStrokePath(o):a||s?a?n?this._sw._closeStrokePath():this._sw._strokePath():n?this._sw._closeFillPath(o):this._sw._fillPath(o):this._sw._endPath()},e.prototype._initializeCoordinates=function(t){var e;if(t){var i=[0,0],r=!1;if(t._pageDictionary.has("CropBox")&&t._pageDictionary.has("MediaBox")){e=t._pageDictionary.getArray("CropBox");var n=t._pageDictionary.getArray("MediaBox");e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]&&e[3]===n[3]&&(r=!0),e[0]>0&&e[3]>0&&n[0]<0&&n[1]<0?(this.translateTransform(e[0],-e[3]),i[0]=-e[0],i[1]=e[3]):t._pageDictionary.has("CropBox")||(r=!0),r&&(this._sw._writeComment("Change co-ordinate system to left/top."),this._cropBox?this.translateTransform(this._cropBox[0],-this._cropBox[3]):-t._origin[1]<this._mediaBoxUpperRightBound||0===this._mediaBoxUpperRightBound?this.translateTransform(0,-this._size[1]):this.translateTransform(0,-this._mediaBoxUpperRightBound))}}else this._sw._writeComment("Change co-ordinate system to left/top."),this._mediaBoxUpperRightBound!==-this._size[1]&&(this._cropBox&&((e=this._cropBox)[0]>0||e[1]>0||this._size[0]===e[2]||this._size[1]===e[3])?this.translateTransform(e[0],-e[3]):this._mediaBoxUpperRightBound===this._size[1]||0===this._mediaBoxUpperRightBound?this.translateTransform(0,-this._size[1]):this.translateTransform(0,-this._mediaBoxUpperRightBound))},e.prototype.scaleTransform=function(t,e){var i=new Me;i._scale(t,e),this._sw._modifyCtm(i),this._matrix._multiply(i)},e.prototype.translateTransform=function(t,e){var i=new Me;i._translate(t,-e),this._sw._modifyCtm(i),this._matrix._multiply(i)},e.prototype.rotateTransform=function(t){var e=new Me;e._rotate(-t),this._sw._modifyCtm(e),this._matrix._multiply(e)},e.prototype.setClip=function(e,i){void 0===i&&(i=t.PdfFillMode.winding),this._sw._appendRectangle(e[0],e[1],e[2],e[3]),this._sw._clipPath(i===t.PdfFillMode.alternate)},e.prototype.setTransparency=function(e,i,r){void 0===i&&(i=e),void 0===r&&(r=t.PdfBlendMode.normal),void 0===this._transparencies&&(this._transparencies=new Map);var n,s="CA:"+e.toString()+"_ca:"+i.toString()+"_BM:"+r.toString();if(this._transparencies.size>0&&this._transparencies.forEach(function(t,e){t===s&&(n=e)}),!n){n=new Ee;var a=new Tr;a.update("CA",e),a.update("ca",i),a.update("BM",z(r));var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),n._dictionary=a,n._key=s,n._name=Sr.get(G()),n._reference=o;var h=void 0,c=!1;if(this._resourceObject.has("ExtGState")){var _=this._resourceObject.getRaw("ExtGState");null!==_&&void 0!==_&&(_ instanceof Pr?(c=!0,h=this._crossReference._fetch(_)):_ instanceof Tr&&(h=_))}else h=new Tr(this._crossReference),this._resourceObject.update("ExtGState",h);h.update(n._name.name,o),c&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0)}this._sw._setGraphicsState(n._name)},e.prototype._setTransparencyData=function(t,e){this._resourceMap.set(t,e);var i=this._crossReference._fetch(t),r=0,n=0,s=0;i.has("CA")&&(r=i.get("CA")),i.has("ca")&&(n=i.get("ca")),i.has("ca")&&(n=i.get("ca")),i.has("BM")&&(s=U(i.get("BM")));var a="CA:"+r.toString()+"_ca:"+n.toString()+"_BM:"+s.toString(),o=new Ee;o._dictionary=i,o._key=a,o._name=e,o._reference=t,this._transparencies.set(o,a)},e.prototype._getTranslateTransform=function(t,e,i){return i._translate(t,-e),i},e.prototype._getScaleTransform=function(t,e,i){return null!==i&&void 0!==i||(i=new Me),i._scale(t,e),i},e.prototype._clipTranslateMargins=function(t){this._clipBounds=t,this._sw._writeComment("Clip margins."),this._sw._appendRectangle(t[0],t[1],t[2],t[3]),this._sw._closePath(),this._sw._clipPath(!1),this._sw._writeComment("Translate co-ordinate system."),this.translateTransform(t[0],t[1])},e}(),Me=function(){function t(){this._matrix=new De(1,0,0,1,0,0)}return t.prototype._translate=function(t,e){this._matrix._translate(t,e)},t.prototype._scale=function(t,e){this._matrix._elements[0]=t,this._matrix._elements[3]=e},t.prototype._rotate=function(t){t=t*Math.PI/180,this._matrix._elements[0]=Math.cos(t),this._matrix._elements[1]=Math.sin(t),this._matrix._elements[2]=-Math.sin(t),this._matrix._elements[3]=Math.cos(t)},t.prototype._multiply=function(t){this._matrix._multiply(t._matrix)},t.prototype._toString=function(){for(var t="",e=0,i=this._matrix._elements.length;e<i;e++)t+=W(this._matrix._elements[Number.parseInt(e.toString(),10)])+" ";return t},t}(),De=function(){function t(t,e,i,r,n,s){this._elements=void 0===t?[]:"number"==typeof t?[t,e,i,r,n,s]:t}return Object.defineProperty(t.prototype,"_offsetX",{get:function(){return this._elements[4]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_offsetY",{get:function(){return this._elements[5]},enumerable:!0,configurable:!0}),t.prototype._clone=function(){return new t(this._elements.slice())},t.prototype._translate=function(t,e){this._elements[4]=t,this._elements[5]=e},t.prototype._transform=function(t){var e=t[0],i=t[1];return[e*this._elements[0]+i*this._elements[2]+this._offsetX,e*this._elements[1]+i*this._elements[3]+this._offsetY]},t.prototype._multiply=function(t){this._elements=[this._elements[0]*t._elements[0]+this._elements[1]*t._elements[2],this._elements[0]*t._elements[1]+this._elements[1]*t._elements[3],this._elements[2]*t._elements[0]+this._elements[3]*t._elements[2],this._elements[2]*t._elements[1]+this._elements[3]*t._elements[3],this._offsetX*t._elements[0]+this._offsetY*t._elements[2]+t._offsetX,this._offsetX*t._elements[1]+this._offsetY*t._elements[3]+t._offsetY]},t}(),Oe=function(){function e(e,i){e&&(this._g=e,this._transformationMatrix=i),this._charSpacing=0,this._wordSpacing=0,this._textScaling=100,this._textRenderingMode=t._TextRenderingMode.fill}return e}(),Ee=function(){function t(){}return t}();!function(t){t[t.fill=0]="fill",t[t.stroke=1]="stroke",t[t.fillStroke=2]="fillStroke",t[t.none=3]="none",t[t.clipFlag=4]="clipFlag",t[t.clipFill=4]="clipFill",t[t.clipStroke=5]="clipStroke",t[t.clipFillStroke=6]="clipFillStroke",t[t.clip=7]="clip"}(t._TextRenderingMode||(t._TextRenderingMode={}));var Ve=function(){function t(t){this._color=void 0!==t?t:[0,0,0]}return t}(),je=function(){function e(e,i){this._color=e,this._width=i,this._dashOffset=0,this._dashPattern=[],this._dashStyle=t.PdfDashStyle.solid,this._miterLimit=0,this._lineCap=t.PdfLineCap.flat,this._lineJoin=t.PdfLineJoin.miter}return e}(),ze=function(){function t(){this._horizontalResolution=96,this._proportions=this._updateProportions(this._horizontalResolution)}return t.prototype._updateProportions=function(t){return[t/2.54,t/6,1,t/72,t,t/300,t/25.4]},t.prototype._convertUnits=function(t,e,i){return this._convertFromPixels(this._convertToPixels(t,e),i)},t.prototype._convertFromPixels=function(t,e){var i=e;return t/this._proportions[Number.parseInt(i.toString(),10)]},t.prototype._convertToPixels=function(t,e){var i=e;return t*this._proportions[Number.parseInt(i.toString(),10)]},t}(),Ue=function(){function t(t){void 0===t&&(t=!1),this._position=0,this._bufferText="",this._buffer=new Uint8Array(0),this._namespaceStack=[],this._elementStack=[],t?(this._currentState="StartDocument",this._skipNamespace=!0):(this._currentState="Initial",this._namespaceStack.push(new We),this._elementStack.push(new He),this._namespaceStack[0]._set("xmlns","http://www.w3.org/2000/xmlns/","Special"),this._namespaceStack.push(new We),this._namespaceStack[1]._set("xml","http://www.w3.org/XML/1998/namespace","Special"),this._namespaceStack.push(new We),this._namespaceStack[2]._set("","","Implied"),this._elementStack[0]._set("","","",this._namespaceStack.length-1)),this._attributeStack=[]}return Object.defineProperty(t.prototype,"buffer",{get:function(){return this._flush(),this._buffer},enumerable:!0,configurable:!0}),t.prototype._writeStartDocument=function(t){if("Initial"!==this._currentState||void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");this._currentState="StartDocument",this._rawText('<?xml version="1.0" encoding="utf-8'),void 0!==t&&null!==t&&(this._rawText('" standalone="'),this._rawText(t?"yes":"no")),this._rawText('"?>')},t.prototype._writeStartElement=function(t,e,i){if(void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");if(void 0===t||null===t||0===t.length)throw new Error("ArgumentException: localName cannot be undefined, null or empty");if(this._checkName(t),"Initial"===this._currentState&&this._writeStartDocument(),"StartElement"===this._currentState&&this._startElementContent(),this._currentState="StartElement",void 0===e||null===e)void 0!==i&&null!==i&&(e=this._lookupPrefix(i)),void 0!==e&&null!==e||(e="");else if(e.length>0&&(void 0!==i&&null!==i||(i=this._lookupNamespace(e)),void 0===i||null===i||void 0!==i&&0===i.length))throw new Error("ArgumentException: Cannot use a prefix with an empty namespace");void 0!==i&&null!==i||(i=this._lookupNamespace(e)),this._writeStartElementInternal(e,t,i)},t.prototype._writeEndElement=function(){"StartElement"===this._currentState?(this._startElementContent(),this._currentState="ElementContent"):"ElementContent"===this._currentState&&(this._currentState="ElementContent"),this._currentState="EndElement";var t=this._elementStack.length-1;this._writeEndElementInternal(this._elementStack[Number.parseInt(t.toString(),10)]._prefix,this._elementStack[Number.parseInt(t.toString(),10)]._localName),this._namespaceStack.splice(this._elementStack[Number.parseInt(t.toString(),10)]._previousTop+1),this._elementStack.splice(t)},t.prototype._writeElementString=function(t,e,i,r){this._writeStartElement(t,i,r),void 0!==e&&null!==e&&0!==e.length&&this._writeString(e),this._writeEndElement()},t.prototype._writeAttributeString=function(t,e,i,r){this._writeStartAttribute(t,e,i,r),this._writeStringInternal(e,!0),this._writeEndAttribute()},t.prototype._writeString=function(t){this._writeInternal(t,!1)},t.prototype._writeRaw=function(t){this._writeInternal(t,!0)},t.prototype._writeInternal=function(t,e){if(null!==t&&void 0!==t){if("StartElement"!==this._currentState&&"ElementContent"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");"StartElement"===this._currentState&&this._startElementContent(),this._currentState="ElementContent",e?this._rawText(t):this._writeStringInternal(t,!1)}},t.prototype._save=function(){for(;this._elementStack.length-1>0;)this._writeEndElement();return""!==this._bufferText&&this._flush(),this._buffer},t.prototype._destroy=function(){this._buffer=void 0;for(t=0;t<this._namespaceStack.length;t++)this._namespaceStack[Number.parseInt(t.toString(),10)]._destroy();this._namespaceStack=[];for(var t=0;t<this._elementStack.length;t++)this._elementStack[Number.parseInt(t.toString(),10)]._destroy();this._elementStack=[],this._bufferText="",this._position=0},t.prototype._flush=function(){if(this._buffer&&this._bufferText&&""!==this._bufferText){if(this._buffer.length>0){for(var t=new Array(this._bufferText.length),e=0;e<this._bufferText.length;e++)t[Number.parseInt(e.toString(),10)]=255&this._bufferText.charCodeAt(e);var i=new Uint8Array(this._buffer.length+t.length);i.set(this._buffer),i.set(t,this._buffer.length),this._buffer=i}else this._buffer=u(this._bufferText);this._bufferText=""}},t.prototype._writeStartAttribute=function(t,e,i,r){if(void 0===t||null===t||0===t.length){if("xmlns"!==i)throw new Error("ArgumentException: localName cannot be undefined, null or empty");t="xmlns",i=""}if("StartElement"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");this._checkName(t),this._writeStartAttributePrefixAndNameSpace(t,e,i,r)},t.prototype._writeStartAttributePrefixAndNameSpace=function(t,e,i,r){void 0!==i&&null!==i||(void 0!==r&&null!==r&&("xmlns"===t&&"http://www.w3.org/2000/xmlns/"===r||(i=this._lookupPrefix(r))),void 0!==i&&null!==i||(i="")),void 0!==r&&null!==r||(void 0!==i&&null!==i&&i.length>0&&(r=this._lookupNamespace(i)),void 0!==r&&null!==r||(r="")),this._writeStartAttributeSpecialAttribute(i,t,r,e)},t.prototype._writeStartAttributeSpecialAttribute=function(t,e,i,r){if(0===t.length){if("x"===e[0]&&"xmlns"===e)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit("",r);i.length>0&&(t=this._lookupPrefix(i))}else{if("x"===t[0]){if("xmlns"===t)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit(e,r);if("xml"===t&&("space"===e||"lang"===e))return void this._skipPushAndWrite(t,e,i)}0===i.length&&(t="")}void 0!==t&&null!==t&&0!==t.length&&this._pushNamespaceImplicit(t,i),this._skipPushAndWrite(t,e,i)},t.prototype._writeEndAttribute=function(){this._currentState="StartElement",this._bufferText+='"'},t.prototype._writeStartElementInternal=function(t,e,i){this._bufferText+="<",t.length>0&&(this._rawText(t),this._bufferText+=":"),this._rawText(e);var r=this._elementStack.length;this._elementStack.push(new He),this._elementStack[Number.parseInt(r.toString(),10)]._set(t,e,i,this._namespaceStack.length-1),this._pushNamespaceImplicit(t,i);for(var n=0;n<this._attributeStack.length;n++)this._attributeStack[Number.parseInt(n.toString(),10)]._destroy();this._attributeStack=[]},t.prototype._writeEndElementInternal=function(t,e){this._position!==this._bufferText.length+1?(this._bufferText+="</",void 0!==t&&null!==t&&0!==t.length&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+=">"):(this._bufferText=this._bufferText.substring(0,this._bufferText.length-1),this._bufferText+=" />")},t.prototype._writeStartAttributeInternal=function(t,e){this._bufferText+=" ",void 0!==t&&null!==t&&t.length>0&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+='="'},t.prototype._writeNamespaceDeclaration=function(t,e){this._skipNamespace||(this._writeStartNamespaceDeclaration(t),this._writeStringInternal(e,!0),this._bufferText+='"')},t.prototype._writeStartNamespaceDeclaration=function(t){void 0===t||null===t||0===t.length?this._rawText(' xmlns="'):(this._rawText(" xmlns:"),this._rawText(t),this._bufferText+="=",this._bufferText+='"')},t.prototype._writeStringInternal=function(t,e){void 0!==t&&null!==t||(t=""),t=(t=(t=t.replace(/\&/g,"&amp;")).replace(/\</g,"&lt;")).replace(/\>/g,"&gt;"),e&&(t=t.replace(/\"/g,"&quot;")),this._bufferText+=t,e||(this._position=0)},t.prototype._startElementContent=function(){for(var t=this._elementStack[this._elementStack.length-1]._previousTop,e=this._namespaceStack.length-1;e>t;e--)"NeedToWrite"===this._namespaceStack[Number.parseInt(e.toString(),10)]._kind&&this._writeNamespaceDeclaration(this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix,this._namespaceStack[Number.parseInt(e.toString(),10)]._namespaceUri);this._bufferText+=">",this._position=this._bufferText.length+1},t.prototype._rawText=function(t){this._bufferText+=t},t.prototype._addNamespace=function(t,e,i){var r=this._namespaceStack.length;this._namespaceStack.push(new We),this._namespaceStack[Number.parseInt(r.toString(),10)]._set(t,e,i)},t.prototype._lookupPrefix=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[Number.parseInt(e.toString(),10)]._namespaceUri===t)return this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix},t.prototype._lookupNamespace=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix===t)return this._namespaceStack[Number.parseInt(e.toString(),10)]._namespaceUri},t.prototype._lookupNamespaceIndex=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[Number.parseInt(e.toString(),10)]._prefix===t)return e;return-1},t.prototype._pushNamespaceImplicit=function(t,e){var i,r=this._lookupNamespaceIndex(t),n=!0;if(-1!==r)if(r>this._elementStack[this._elementStack.length-1]._previousTop){if(this._namespaceStack[Number.parseInt(r.toString(),10)]._namespaceUri!==e)throw new Error("XmlException namespace Uri needs to be the same as the one that is already declared");n=!1}else if("Special"===this._namespaceStack[Number.parseInt(r.toString(),10)]._kind){if("xml"!==t)throw new Error('InvalidArgumentException: Prefix "xmlns" is reserved for use by XML.');if(e!==this._namespaceStack[Number.parseInt(r.toString(),10)]._namespaceUri)throw new Error("InvalidArgumentException: Xml String");i="Implied"}else i=this._namespaceStack[Number.parseInt(r.toString(),10)]._namespaceUri===e?"Implied":"NeedToWrite";else{if("http://www.w3.org/XML/1998/namespace"===e&&"xml"!==t||"http://www.w3.org/2000/xmlns/"===e&&"xmlns"!==t)throw new Error("InvalidArgumentException");i="NeedToWrite"}n&&this._addNamespace(t,e,i)},t.prototype._pushNamespaceExplicit=function(t,e){var i=this._lookupNamespaceIndex(t);if(-1!==i&&i>this._elementStack[this._elementStack.length-1]._previousTop)return void(this._namespaceStack[Number.parseInt(i.toString(),10)]._kind="Written");this._addNamespace(t,e,"Written")},t.prototype._addAttribute=function(t,e,i){var r=this._attributeStack.length;this._attributeStack.push(new Ge),this._attributeStack[Number.parseInt(r.toString(),10)]._set(t,e,i);for(var n=0;n<r;n++)if(this._attributeStack[Number.parseInt(n.toString(),10)]._isDuplicate(t,e,i))throw new Error("XmlException: duplicate attribute name")},t.prototype._skipPushAndWrite=function(t,e,i){this._addAttribute(t,e,i),this._writeStartAttributeInternal(t,e)},t.prototype._checkName=function(t){if(/[ !@#$%^&*()+\=\[\]{};':"\\|,<>\/?]/.test(t))throw new Error("InvalidArgumentException: invalid name character")},t}(),We=function(){function t(){}return t.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=e,this._kind=i},t.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._kind=void 0},t}(),He=function(){function t(){}return t.prototype._set=function(t,e,i,r){this._previousTop=r,this._prefix=t,this._namespaceUri=i,this._localName=e},t.prototype._destroy=function(){this._previousTop=void 0,this._prefix=void 0,this._localName=void 0,this._namespaceUri=void 0},t}(),Ge=function(){function t(){}return t.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=i,this._localName=e},t.prototype._isDuplicate=function(t,e,i){return this._localName===e&&(this._prefix===t||this._namespaceUri===i)},t.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._localName=void 0},t}(),Ke=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),qe=function(){function t(){this._asPerSpecification=!1,this._fileName="",this._formKey="",this._exportEmptyFields=!1,this._groupReferences=new Map,this._groupHolders=[],this._richTextPrefix='<?xml version="1.0"?>',this._table=new Map,this._fields=new Map,this._richTextValues=new Map,this._jsonData=[],this._openingBrace=123,this._openingBracket=91,this._closingBrace=125,this._closingBracket=93,this._colon=58,this._doubleQuotes=34,this._comma=44,this._space=32,this.fdfString="",this._xmlImport=!1}return t.prototype._exportFormFieldsData=function(t){var e="";if(null!==t&&void 0!==t&&t.export){var i=T(t._dictionary,"FT",!1,!0);if(i&&null!==i.name&&void 0!==i.name){var r=this._getEncodedFontDictionary(t._dictionary),n=t.name;null!==r&&void 0!==r&&(n=this._getEncodedValue(n,r));var s=void 0,a=void 0;switch(i.name){case"Tx":null!==(e=T(t._dictionary,"V",!1,!0))&&void 0!==e?(e=this._getEncodedValue(e,r),this._table.set(n,e)):this._exportEmptyFields&&(e="",this._table.set(n,e));break;case"Ch":if(null!==(s=T(t._dictionary,"V",!0,!0))&&void 0!==s&&(a=this._getExportValue(s)),!s&&t._dictionary.has("I")&&(t instanceof _i||t instanceof ci)&&(a=t._obtainSelectedValue()),null!==a&&void 0!==a){if("string"==typeof a&&""!==a)e=a=this._getEncodedValue(a,r),this._table.set(n,e);else if(a instanceof Array&&a.length>0){for(var o=[],h=0;h<a.length;h++)o.push(this._getEncodedValue(a[Number.parseInt(h.toString(),10)],r));return this._table.set(n,o),o}}else this._exportEmptyFields&&(e="",this._table.set(n,e));break;case"Btn":if(null!==(s=T(t._dictionary,"V",!1,!0))&&void 0!==s){var c=this._getExportValue(s,t);if(null!==c&&void 0!==c&&""!==c){var _=void 0;if(t instanceof oi&&(_=t),!t._dictionary.has("Opt")||null!==_&&void 0!==_&&-1===_.selectedIndex)e=c=this._getEncodedValue(c,r),this._table.set(n,e);else if(t._dictionary.has("Opt")){var d=t._dictionary.getArray("Opt"),p=Number.parseInt(c,10);if((null===p||void 0===p||Number.isNaN(p))&&(p=0),null!==d&&void 0!==d){var l=void 0;null!==(l=_?d[_.selectedIndex]:d[Number.parseInt(p.toString(),10)])&&void 0!==l&&(c=l),null!==c&&void 0!==c&&""!==c&&(e=c=this._getEncodedValue(c,r),this._table.set(n,e))}}}else(t instanceof oi||t instanceof ai)&&(e=this._exportEmptyFields?c:"Off",this._table.set(n,e))}else if(t instanceof oi)(e=t._getAppearanceStateValue())||(e=this._exportEmptyFields?"":"Off"),this._table.set(n,e);else{var u=t.itemAt(t._defaultIndex),f=void 0;(f=u?u._dictionary:t._dictionary)&&f.has("AS")?(e=f.get("AS").name,this._table.set(n,e)):this._exportEmptyFields&&(e="",this._table.set(n,e))}}}}return e},t.prototype._exportFormFieldData=function(t){var e=T(t._dictionary,"FT",!1,!0);if(e&&null!==e.name&&void 0!==e.name){var i=this._getEncodedFontDictionary(t._dictionary),r=t.name;null!==i&&void 0!==i&&(r=this._getEncodedValue(r,i));var n=void 0,s=void 0;switch(e.name){case"Tx":if(n=T(t._dictionary,"V",!1,!0),this._asPerSpecification){if(t._dictionary.has("RV"))null!==(n=T(t._dictionary,"RV",!1,!0))&&void 0!==n&&(n+=this._key,this._formKey=this._key,this._table.set(r,n));else if(null!==n&&void 0!==n){var a=n=this._getEncodedValue(n,i);t instanceof ni&&t.multiLine&&(n=a=(a=a.replace("\n","")).replace("\r","\r\n")),this._table.set(r,n)}}else null!==n&&void 0!==n?(n=this._getEncodedValue(n,i),this._table.set(r,n)):this._exportEmptyFields&&this._table.set(r,"");break;case"Ch":if(s=T(t._dictionary,"V",!0,!0),this._asPerSpecification){if(t instanceof hi)if(Array.isArray(s))this._table.set(r,s);else if("string"==typeof s)s=this._getEncodedValue(s,i),this._table.set(r,s);else if((null===s||void 0===s)&&t._dictionary.has("I")&&null!==(c=t._obtainSelectedValue())&&void 0!==c)if("string"==typeof c&&""!==c)c=this._getEncodedValue(c,i),this._table.set(r,n);else if(c instanceof Array&&c.length>0){for(var o=[],h=0;h<c.length;h++)o.push(this._getEncodedValue(c[Number.parseInt(h.toString(),10)],i));this._table.set(r,o)}}else{var c=void 0;if(null!==s&&void 0!==s&&(c=this._getExportValue(s)),!s&&t._dictionary.has("I")&&(t instanceof _i||t instanceof ci)&&(c=t._obtainSelectedValue()),null!==c&&void 0!==c)if("string"==typeof c&&""!==c)c=this._getEncodedValue(c,i),this._table.set(r,c);else if(c instanceof Array&&c.length>0){for(var o=[],h=0;h<c.length;h++)o.push(this._getEncodedValue(c[Number.parseInt(h.toString(),10)],i));this._table.set(r,o)}else this._exportEmptyFields&&this._table.set(r,"");else this._exportEmptyFields&&this._table.set(r,"")}break;case"Btn":if(null!==(s=T(t._dictionary,"V",!1,!0))&&void 0!==s)if(null!==(u=this._getExportValue(s,t))&&void 0!==u&&""!==u){this._asPerSpecification&&"XML"!==this._format&&(u=P(u));var _=void 0;if(t instanceof oi&&(_=t),!t._dictionary.has("Opt")||null!==_&&void 0!==_&&-1===_.selectedIndex)u=this._getEncodedValue(u,i),this._table.set(r,u);else if(t._dictionary.has("Opt")){var d=t._dictionary.getArray("Opt"),p=Number.parseInt(u,10);if((null===p||void 0===p||Number.isNaN(p))&&(p=0),null!==d&&void 0!==d){var l=void 0;null!==(l=_?d[_.selectedIndex]:d[Number.parseInt(p.toString(),10)])&&void 0!==l&&(u=l),null!==u&&void 0!==u&&""!==u&&(u=this._getEncodedValue(u,i),this._table.set(r,u))}}}else(t instanceof oi||t instanceof ai)&&(this._exportEmptyFields?this._table.set(r,u):this._table.set(r,"Off"));else if(t instanceof oi){var u=t._getAppearanceStateValue();u||(u=this._exportEmptyFields?"":"Off"),this._table.set(r,u)}else{var f=t.itemAt(t._defaultIndex),g=void 0;(g=f?f._dictionary:t._dictionary)&&g.has("AS")?this._table.set(r,g.get("AS").name):this._exportEmptyFields&&this._table.set(r,"")}}}},t.prototype._getAnnotationType=function(t){var e="";if(t.has("Subtype")){var i=t.get("Subtype");i&&(e=i.name)}return e},t.prototype._getValue=function(t,e){void 0===e&&(e=!1);var i="";if(void 0!==t&&null!==t)if(t instanceof Sr)i=t.name;else if("boolean"==typeof t)i=t?e?"true":"yes":e?"false":"no";else if("string"==typeof t)i=this._getValidString(t);else if(Array.isArray(t)){var r=t;r.length>0&&(i=this._getValue(r[0],e));for(var n=1;n<r.length;n++)i+=","+this._getValue(r[Number.parseInt(n.toString(),10)],e)}else"number"==typeof t&&(i=t.toString());return i},t.prototype._getColor=function(t){var e="";if(t&&Array.isArray(t)&&t.length>=3){var i=Math.round(255*t[0]).toString(16).toUpperCase(),r=Math.round(255*t[1]).toString(16).toUpperCase(),n=Math.round(255*t[2]).toString(16).toUpperCase();e="#"+(1===i.length?"0"+i:i)+(1===r.length?"0"+r:r)+(1===n.length?"0"+n:n)}return e},t.prototype._getValidString=function(t){return-1!==t.indexOf("\n")&&(t=t.replace(/\n/g,"\\n")),-1!==t.indexOf("\r")&&(t=t.replace(/\r/g,"\\r")),t},t.prototype._getEncodedFontDictionary=function(t){var e,i;if(t.has("Kids")&&!t.has("AP")&&(i=t.getArray("Kids")),t.has("AP")||null!==i&&void 0!==i&&Array.isArray(i)){var r=void 0;if(null!==i&&void 0!==i&&i.length>0){var n=i[0];null!==n&&void 0!==n&&n.has("AP")&&(r=n.get("AP"))}else r=t.get("AP");if(null!==r&&void 0!==r&&r.has("N")){var s=r.get("N");if(null!==s&&void 0!==s&&s instanceof Cr&&s.dictionary.has("Resources")){var a=s.dictionary.get("Resources");null!==a&&void 0!==a&&a.has("Font")&&(e=a.get("Font"))}}}return e},t.prototype._getEncodedValue=function(t,e){var i,r=this,n=t;if(null!==this._encodeDictionary&&void 0!==this._encodeDictionary)return i=new Je(this._encodeDictionary),this._replaceNotUsedCharacters(n,i);var s=this._document.form._dictionary;if(null!==s&&void 0!==s&&s.has("DR")){var a=s.get("DR");if(null!==a&&void 0!==a&&a.has("Encoding")){var o=a.get("Encoding");if(null!==o&&void 0!==o&&o.has("PDFDocEncoding")){var h=o.get("PDFDocEncoding");if(null!==h&&void 0!==h&&h.has("Differences")){var c=new Tr(this._crossReference);c.set("Differences",h.get("Differences"));var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,c);var d=new Tr(this._crossReference);if(d.set("Subtype",Sr.get("Type1")),d.set("Encoding",_),null!==(i=new Je(d))&&void 0!==i&&null!==i.differencesDictionary&&void 0!==i.differencesDictionary&&i.differencesDictionary.size>0)return this._encodeDictionary=d,this._replaceNotUsedCharacters(n,i)}}}}if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e.size>0){var p,l=!1;if(e.forEach(function(t,e){if(!l&&null!==e&&void 0!==e){var s=void 0;if(e instanceof Tr)s=e;else if(e instanceof Pr){var a=r._crossReference._fetch(e);null!==a&&void 0!==a&&a instanceof Tr&&(s=a)}s&&(i=new Je(s),p=r._replaceNotUsedCharacters(n,i),l=!0)}}),!l)return p}return n},t.prototype._replaceNotUsedCharacters=function(t,e){for(var i="",r=e.differencesDictionary,n=0;n<t.length;n++){var s=t[Number.parseInt(n.toString(),10)],a=t.charCodeAt(n);if(r.has(s)){var o=r.get(s);o.length>1&&"Type3"!==e._fontType||a>127&&a<=255&&"Type1"===e._fontType&&"WinAnsiEncoding"!==e._baseFontEncoding&&"Encoding"===e._fontEncoding&&"ZapfDingbats"===e._fontName?i+=s:i+=o}else i+=s}return i},t.prototype._getExportValue=function(t,e){var i;if(null!==t&&void 0!==t)if(null!==e&&void 0!==e){if(t instanceof Sr?i=t.name:"string"==typeof t&&(i=t),null!==i&&void 0!==i&&""!==i&&e instanceof oi&&-1!==e.selectedIndex){var r=e.itemAt(e.selectedIndex);null!==r&&void 0!==r&&r.value===i&&(i=r.value)}}else if(t instanceof Sr)i=t.name;else if("string"==typeof t)i=t;else if(Array.isArray(t)){for(var n=[],s=0;s<t.length;s++){var a=t[Number.parseInt(s.toString(),10)];a instanceof Sr?n.push(a.name):"string"==typeof a&&n.push(a)}return n}return i},t.prototype._addReferenceToGroup=function(t,e){var i=e.get("NM");i&&""!==i?(this._groupReferences.set(i,t),e.has("IRT")&&this._groupHolders.push(e)):!i&&e.has("IRT")&&(i=e.get("IRT"))&&""!==i&&this._groupReferences.has(i)&&e.update("IRT",this._groupReferences.get(i))},t.prototype._handlePopup=function(t,e,i,r){if(i.has("Popup")){var n=i.getRaw("Popup"),s=i.get("Popup");if(s instanceof Tr){n&&s&&s.update("Parent",e);var a=t._parseAnnotation(s),o=t._annotations.length;t._annotations.push(e),r.set("Annots",t._annotations),r._updated=!0,t._parsedAnnotations.set(o,a)}}},t.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._fields.forEach(function(r,n){var s;t._richTextValues.size>0&&t._richTextValues.has(n)&&(s=t._richTextValues.get(n));var a=e._getFieldIndex(n);if(-1!==a&&a<i){var o=e.fieldAt(a);o&&null!==o&&void 0!==o&&(s&&""!==s&&o._dictionary.update("RV",s),t._importFieldData(o,r))}})},t.prototype._importFieldData=function(t,e){if(null!==e&&void 0!==e&&e.length>0&&null!==t&&void 0!==t&&!t.readOnly){var i=e[0];if(t instanceof ni)null!==i&&void 0!==i&&(t instanceof ni&&t.multiLine&&(i=(i=i.replace("\r\n","\r")).replace("\n","\r")),t.text=i);else if(t instanceof _i||t instanceof ci){var r;r=e.length>1?e:this._xmlImport?-1!==i.indexOf(",")?i.split(","):[i]:[-1!==i.indexOf(",")?i.split(",")[0]:i];var n=[],s=t._options;s&&s.length>0&&s.forEach(function(t){-1===r.indexOf(t[0])&&-1===r.indexOf(t[1])||n.push(s.indexOf(t))}),n.length>0&&(t.selectedIndex=n,t instanceof ci&&this._asPerSpecification&&t._dictionary.has("AP")&&(delete t._dictionary._map.AP,t._dictionary._updated=!0))}else if(t instanceof ai){var a=i.toLowerCase();this._containsExportValue(i,t)||"on"===a||"yes"===a?t.checked=!0:t.checked=!1}else if(t instanceof oi){for(var o=-1,h=0;h<t._kidsCount;h++){var c=t.itemAt(h);if(c&&c.value&&c.value===i){o=h;break}}-1!==o&&t.selectedIndex!==o&&(t.selectedIndex=o)}}},t.prototype._containsExportValue=function(t,e){var i=!1;if(e._kidsCount>0)for(var r=0;r<e._kidsCount;r++){var n=e.itemAt(r);if(n&&this._checkSelected(n._dictionary,t))return!0}else if(!(i=this._checkSelected(e._dictionary,t))&&this._asPerSpecification&&e._dictionary.has("AS")){var s=e._dictionary.get("AS");if(!s||"Off"!==s.name&&"No"!==s.name)i=!0;else if(e._dictionary.has("Opt")){var a=e._dictionary.getArray("Opt");a&&a.length>0&&a.forEach(function(e){e===t&&(i=!0)})}}return i},t.prototype._checkSelected=function(t,e){if(t&&t.has("AP")){var i=t.get("AP");if(i&&i instanceof Tr&&i.has("N")){var r=i.get("N");if(r&&r instanceof Tr&&r.has(e)&&"off"!==e.toLocaleLowerCase()&&"no"!==e.toLocaleLowerCase())return!0}}return!1},t.prototype._dispose=function(){this.exportAppearance=void 0,this._asPerSpecification=void 0,this._skipBorderStyle=void 0,this._fileName=void 0,this._document=void 0,this._crossReference=void 0,this._isAnnotationExport=void 0,this._isAnnotationImport=void 0,this._key=void 0,this._formKey=void 0,this._exportEmptyFields=void 0,this._groupReferences=void 0,this._groupHolders=void 0,this._encodeDictionary=void 0,this._annotationTypes=void 0,this._annotationAttributes=void 0,this._xmlDocument=void 0,this._parser=void 0,this._table=void 0,this._fields=void 0,this._richTextValues=void 0,this._jsonData=void 0},t}(),Xe=function(e){function i(t){var i=e.call(this)||this;return null!==t&&void 0!==t&&(i._fileName=t),i}return Ke(i,e),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._save()},i.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=G(),this._save()},i.prototype._save=function(){var t=new Ue;if(t._writeStartDocument(),t._writeStartElement("xfdf"),t._writeAttributeString(null,"http://ns.adobe.com/xfdf/","xmlns",null),t._writeAttributeString("space","preserve","xml",null),this._isAnnotationExport){if(t._writeStartElement("annots"),this._document)for(a=0;a<this._document.pageCount;a++)for(var e=this._document.getPage(a).annotations,i=0;i<e.count;i++){var r=e.at(i);r&&(!this._annotationTypes||0===this._annotationTypes.length||this._annotationTypes&&this._annotationTypes.length>0&&this._checkAnnotationType(r))&&this._exportAnnotationData(r,t,a)}t._writeEndElement()}else{var n=this._document.form;if(null!==n&&void 0!==n){this._exportEmptyFields=n.exportEmptyFields;for(var s=this._document.form.count,a=0;a<s;a++){var o=this._document.form.fieldAt(a);null!==o&&void 0!==o&&o.export&&this._exportFormFieldData(o)}this._writeFormFieldData(t,this._asPerSpecification)}}this._asPerSpecification||(t._writeStartElement("f"),t._writeAttributeString("href",this._fileName));var h=t._save();return t._destroy(),h},i.prototype._writeFormFieldData=function(t,e){var i=this;if(void 0===e&&(e=!1),e){t._writeStartElement("f"),t._writeAttributeString("href",this._fileName),t._writeEndElement();var r=this._getElements(this._table);if(r&&r.size>0){t._writeStartElement("fields");var n=!1;r.forEach(function(e,r){if(t._writeStartElement("field"),t._writeAttributeString("name",r.toString()),Array.isArray(e)&&e.forEach(function(e){t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement(),n=!0}),e instanceof Map)i._writeFieldName(e,t);else if(!n&&!e.toString().endsWith(i._formKey)||!n&&""===i._formKey)t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement();else if(""!==i._formKey&&e.toString().endsWith(i._formKey)){t._writeStartElement("value-richtext");var s=e.toString();s.startsWith('<?xml version="1.0"?>')&&(s=s.substring(21));var a=s.length-i._formKey.length;s=s.substring(0,a)+s.substring(a+i._formKey.length),t._writeRaw(s),t._writeEndElement()}t._writeEndElement(),n=!1}),t._writeEndElement()}t._writeStartElement("ids");var s=!1;if(this._crossReference._root.has("ID")){var a=this._crossReference._root.getArray("ID");a&&a.length>=1&&(t._writeAttributeString("original",a[0]),t._writeAttributeString("modified",a[1]),s=!0)}s||(t._writeAttributeString("original",""),t._writeAttributeString("modified","")),t._writeEndElement()}else t._writeStartElement("fields"),this._table.forEach(function(e,i){t._writeStartElement("field"),t._writeAttributeString("name",i.toString()),Array.isArray(e)?e.forEach(function(e){t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement()}):(t._writeStartElement("value"),t._writeString(e.toString()),t._writeEndElement()),t._writeEndElement()}),t._writeEndElement()},i.prototype._writeFieldName=function(t,e){var i=this;t.forEach(function(t,r){if(t instanceof Map)e._writeStartElement("field"),e._writeAttributeString("name",r.toString()),i._writeFieldName(t,e),e._writeEndElement();else{if(e._writeStartElement("field"),e._writeAttributeString("name",r.toString()),Array.isArray(t))t.forEach(function(t){e._writeStartElement("value"),e._writeString(t.toString()),e._writeEndElement()});else{if(t.toString().endsWith(i._formKey)&&""!==i._formKey){e._writeStartElement("value-richtext");var n=t.toString();n.startsWith('<?xml version="1.0"?>')&&(n=n.substring(21));var s=n.length-i._formKey.length;n=n.substring(0,s)+n.substring(s+i._formKey.length),e._writeRaw(n)}else e._writeStartElement("value"),e._writeString(t.toString());e._writeEndElement()}e._writeEndElement()}})},i.prototype._getElements=function(t){var e=this,i=new Map;return t.forEach(function(t,r){var n=i;if(-1!==r.toString().indexOf("."))for(var s=r.toString().split("."),a=0;a<s.length;a++){var o=s[Number.parseInt(a.toString(),10)];if(n.has(o))e._getElements(n[o]),n=n[o];else if(a===s.length-1)n.set(o,t);else{var h=new Map;n.set(o,h),n=h}}else n.set(r,t)}),i},i.prototype._checkAnnotationType=function(t){return void 0!==t._type&&-1!==this._annotationTypes.indexOf(t._type)},i.prototype._exportAnnotationData=function(t,e,i){t._dictionary&&!(t instanceof Ti||t instanceof Ci||t instanceof Ni||t instanceof Ii)&&this._writeAnnotationData(e,i,t)},i.prototype._writeAnnotationData=function(t,e,i){var r,n,s=!1;i instanceof fi?(r=i,n=i._dictionary):n=i;var a=this._getAnnotationType(n);if(this._skipBorderStyle=!1,a&&""!==a){this._annotationAttributes||(this._annotationAttributes=[]),t._writeStartElement(a.toLowerCase()),t._writeAttributeString("page",e.toString());var o=void 0;switch(a){case"Line":o=r.linePoints,t._writeAttributeString("start",o[0].toString()+","+o[1].toString()),t._writeAttributeString("end",o[2].toString()+","+o[3].toString());break;case"Stamp":case"Square":s=!0}if(n&&n.has("BE")&&n.has("BS")){var h=n.get("BE");h&&h.has("S")&&(this._skipBorderStyle=!0)}this._writeDictionary(n,e,t,s),t._writeEndElement(),this._annotationAttributes=[]}},i.prototype._writeDictionary=function(t,e,i,r){var n=this,s=!1;if(t.has("Type")){var a=t.get("Type");s=a&&"Border"===a.name&&this._skipBorderStyle}if(t.forEach(function(a,o){if((r||"AP"!==a)&&"P"!==a&&"Parent"!==a){var h=void 0;if(o instanceof Pr&&(h=t.get(a)),h&&h instanceof Tr)switch(a){case"BS":case"BE":n._writeDictionary(h,e,i,!1);break;case"IRT":h.has("NM")&&i._writeAttributeString("inreplyto",n._getValue(h.get("NM")))}else o instanceof Tr?n._writeDictionary(o,e,i,!1):(!s||s&&"S"!==a)&&n._writeAttribute(i,a,o)}}),(this.exportAppearance||r)&&t.has("AP")){var o=this._getAppearanceString(t.get("AP"));o&&o.length>0&&(i._writeStartElement("appearance"),i._writeRaw(x(o)),i._writeEndElement())}if(t.has("Measure")&&this._exportMeasureDictionary(t.get("Measure"),i),t.has("Sound")){var h=t.get("Sound");if(h&&h.dictionary){var c=h.dictionary;c.has("B")&&i._writeAttributeString("bits",this._getValue(c.get("B"))),c.has("C")&&i._writeAttributeString("channels",this._getValue(c.get("C"))),c.has("E")&&i._writeAttributeString("encoding",this._getValue(c.get("E"))),c.has("R")&&i._writeAttributeString("rate",this._getValue(c.get("R"))),c.has("Length")&&c.get("Length")>0&&(y=S(h.getBytes()))&&""!==y&&(i._writeStartElement("data"),i._writeAttributeString("MODE","raw"),i._writeAttributeString("encoding","hex"),c.has("Length")&&i._writeAttributeString("length",this._getValue(c.get("Length"))),c.has("Filter")&&i._writeAttributeString("filter",this._getValue(c.get("Filter"))),i._writeRaw(y),i._writeEndElement())}}else if(t.has("FS")){var _=t.get("FS");if(_&&(_.has("F")&&i._writeAttributeString("file",this._getValue(_.get("F"))),_.has("EF"))){var d=_.get("EF");if(d&&d.has("F")){var p=d.get("F");if(p&&p.dictionary){var l=p.dictionary;if(l.has("Params")){var f=l.get("Params");if(f){if(f.has("CreationDate")){v=this._getValue(f.get("CreationDate"));i._writeAttributeString("creation",v)}if(f.has("ModificationDate")){v=this._getValue(f.get("ModificationDate"));i._writeAttributeString("modification",v)}if(f.has("Size")&&i._writeAttributeString("size",this._getValue(f.get("Size"))),f.has("CheckSum")){var g=S(u(v=this._getValue(f.get("CheckSum"))));i._writeAttributeString("checksum",g)}}}var y=S(p.getBytes());y&&""!==y&&(i._writeStartElement("data"),i._writeAttributeString("MODE","raw"),i._writeAttributeString("encoding","hex"),l.has("Length")&&i._writeAttributeString("length",this._getValue(l.get("Length"))),l.has("Filter")&&i._writeAttributeString("filter",this._getValue(l.get("Filter"))),i._writeRaw(y),i._writeEndElement())}}}}if(t.has("Vertices")){i._writeStartElement("vertices");var m=t.getArray("Vertices");if(m&&m.length>0){var b=m.length;if(b%2==0){for(var v="",w=0;w<b-1;w++)v+=this._getValue(m[Number.parseInt(w.toString(),10)])+(w%2!=0?";":",");(v+=this._getValue(m[b-1]))&&""!==v&&i._writeRaw(v)}}i._writeEndElement()}if(t.has("Popup")){var P=t.get("Popup");P&&this._writeAnnotationData(i,e,P)}if(t.has("DA")){var A=t.get("DA");A&&this._writeRawData(i,"defaultappearance",A)}if(t.has("DS")){var k=t.get("DS");k&&this._writeRawData(i,"defaultstyle",k)}if(t.has("InkList")){var T=t.getArray("InkList");if(T&&T.length>0){i._writeStartElement("inklist");for(var I=0;I<T.length;I++)i._writeElementString("gesture",this._getValue(T[Number.parseInt(I.toString(),10)]));i._writeEndElement()}}if(t.has("RC")&&(v=t.get("RC"))&&""!==v){var N=v.indexOf("<body");N>0&&(v=v.substring(N)),this._writeRawData(i,"contents-richtext",v)}t.has("Contents")&&(v=t.get("Contents"))&&v.length>0&&(i._writeStartElement("contents"),i._writeString(v),i._writeEndElement())},i.prototype._getAppearanceString=function(t){var e=new Ue(!0);e._writeStartElement("DICT"),e._writeAttributeString("KEY","AP"),this._writeAppearanceDictionary(e,t),e._writeEndElement();var i=e.buffer;return e._destroy(),i},i.prototype._writeAppearanceDictionary=function(t,e){var i=this;e&&e.size>0&&e.forEach(function(r,n){i._writeObject(t,n instanceof Pr?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r){if(null!==e&&void 0!==e)if(e instanceof Sr)this._writePrefix(t,"NAME",r),t._writeAttributeString("VAL",e.name),t._writeEndElement();else if(Array.isArray(e))this._writePrefix(t,"ARRAY",r),i.has(r)?this._writeArray(t,i.getArray(r),i):this._writeArray(t,e,i),t._writeEndElement();else if("string"==typeof e)this._writePrefix(t,"STRING",r),t._writeAttributeString("VAL",e),t._writeEndElement();else if("number"==typeof e)Number.isInteger(e)?(this._writePrefix(t,"INT",r),t._writeAttributeString("VAL",e.toString())):(this._writePrefix(t,"FIXED",r),t._writeAttributeString("VAL",e.toFixed(6))),t._writeEndElement();else if("boolean"==typeof e)this._writePrefix(t,"BOOL",r),t._writeAttributeString("VAL",e?"true":"false"),t._writeEndElement();else if(e instanceof Tr)this._writePrefix(t,"DICT",r),this._writeAppearanceDictionary(t,e),t._writeEndElement();else if(null===e)this._writePrefix(t,"NULL",r),t._writeEndElement();else if(e instanceof Cr&&e.dictionary){var n=e.dictionary;if(this._writePrefix(t,"STREAM",r),t._writeAttributeString("DEFINE",""),n.has("Subtype")&&"Image"===this._getValue(n.get("Subtype"))||!n.has("Type")&&!n.has("Subtype")){s=e.getString(!0);!n.has("Length")&&s&&""!==s&&n.update("Length",e.length),this._writeAppearanceDictionary(t,n),t._writeStartElement("DATA"),t._writeAttributeString("MODE","RAW"),t._writeAttributeString("ENCODING","HEX"),s&&""!==s&&t._writeRaw(s)}else{var s=e.getString();!n.has("Length")&&s&&""!==s&&n.update("Length",e.length),s=(s=s.replace(/</g,"&lt;")).replace(/>/g,"&gt;"),this._writeAppearanceDictionary(t,n),t._writeStartElement("DATA"),t._writeAttributeString("MODE","FILTERED"),t._writeAttributeString("ENCODING","ASCII"),s&&""!==s&&t._writeRaw(s)}t._writeEndElement(),t._writeEndElement()}else e instanceof Pr&&this._crossReference&&this._writeObject(t,this._crossReference._fetch(e),i,r)},i.prototype._writePrefix=function(t,e,i){t._writeStartElement(e),i&&t._writeAttributeString("KEY",i)},i.prototype._writeArray=function(t,e,i){var r=this;e.forEach(function(e){r._writeObject(t,e,i)})},i.prototype._getFormatedString=function(t,e){return void 0===e&&(e=!1),t=e?(t=(t=t.replace("&amp;","&")).replace("&lt;","<")).replace("&gt;",">"):(t=(t=t.replace("&","&amp;")).replace("<","&lt;")).replace(">","&gt;")},i.prototype._writeAttribute=function(t,e,i){if(this._annotationAttributes&&-1===this._annotationAttributes.indexOf(e))switch(e){case"C":this._writeColor(t,i,"color","c");break;case"IC":this._writeColor(t,i,"interior-color");break;case"M":this._writeAttributeString(t,"date",i);break;case"NM":this._writeAttributeString(t,"name",i);break;case"Name":this._writeAttributeString(t,"icon",i);break;case"Subj":this._writeAttributeString(t,"subject",i);break;case"T":this._writeAttributeString(t,"title",i);break;case"Rotate":this._writeAttributeString(t,"rotation",i);break;case"W":this._writeAttributeString(t,"width",i);break;case"LE":i&&Array.isArray(i)?2===i.length&&(t._writeAttributeString("head",this._getValue(i[0])),t._writeAttributeString("tail",this._getValue(i[1]))):i instanceof Sr&&this._writeAttributeString(t,"head",i);break;case"S":if(-1===this._annotationAttributes.indexOf("style")){switch(this._getValue(i)){case"D":t._writeAttributeString("style","dash");break;case"C":t._writeAttributeString("style","cloudy");break;case"S":t._writeAttributeString("style","solid");break;case"B":t._writeAttributeString("style","bevelled");break;case"I":t._writeAttributeString("style","inset");break;case"U":t._writeAttributeString("style","underline")}this._annotationAttributes.push("style")}break;case"D":this._writeAttributeString(t,"dashes",i);break;case"I":this._writeAttributeString(t,"intensity",i);break;case"RD":this._writeAttributeString(t,"fringe",i);break;case"IT":this._writeAttributeString(t,"IT",i);break;case"RT":this._writeAttributeString(t,"replyType",i,!0);break;case"LL":this._writeAttributeString(t,"leaderLength",i);break;case"LLE":this._writeAttributeString(t,"leaderExtend",i);break;case"Cap":this._writeAttributeString(t,"caption",i);break;case"Q":this._writeAttributeString(t,"justification",i);break;case"CP":this._writeAttributeString(t,"caption-style",i);break;case"CL":this._writeAttributeString(t,"callout",i);break;case"QuadPoints":this._writeAttributeString(t,"coords",i);break;case"CA":this._writeAttributeString(t,"opacity",i);break;case"F":if("number"==typeof i&&-1===this._annotationAttributes.indexOf("flags")){var r=d(i);t._writeAttributeString("flags",r),this._annotationAttributes.push("flags")}break;case"InkList":case"Type":case"Subtype":case"P":case"Parent":case"L":case"Contents":case"RC":case"DA":case"DS":case"FS":case"MeasurementTypes":case"Vertices":case"GroupNesting":case"ITEx":case"TextMarkupContent":break;default:this._writeAttributeString(t,e.toLowerCase(),i)}},i.prototype._writeAttributeString=function(t,e,i,r){if(void 0===r&&(r=!1),-1===this._annotationAttributes.indexOf(e)){var n=this._getValue(i);t._writeAttributeString(e,r?n.toLowerCase():n),this._annotationAttributes.push(e)}},i.prototype._writeRawData=function(t,e,i){i&&""!==i&&(t._writeStartElement(e),t._writeRaw(i),t._writeEndElement())},i.prototype._writeColor=function(t,e,i,r){var n=this._getColor(e);if("number"==typeof e&&r){var s=this._getValue(e);s&&""!==s&&-1===this._annotationAttributes.indexOf(r)&&(t._writeAttributeString(r,s),this._annotationAttributes.push(r))}n&&""!==n&&-1===this._annotationAttributes.indexOf(i)&&(t._writeAttributeString(i,n),this._annotationAttributes.push(i))},i.prototype._exportMeasureDictionary=function(t,e){if(e._writeStartElement("measure"),t){if(t.has("R")&&e._writeAttributeString("rateValue",this._getValue(t.get("R"))),t.has("A")){i=t.getArray("A");e._writeStartElement("area"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}if(t.has("D")){i=t.getArray("D");e._writeStartElement("distance"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}if(t.has("X")){var i=t.getArray("X");e._writeStartElement("xformat"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()}}e._writeEndElement()},i.prototype._exportMeasureFormatDetails=function(t,e){t.has("C")&&e._writeAttributeString("c",this._getValue(t.get("C"))),t.has("F")&&e._writeAttributeString("f",this._getValue(t.get("F"))),t.has("D")&&e._writeAttributeString("d",this._getValue(t.get("D"))),t.has("RD")&&e._writeAttributeString("rd",this._getValue(t.get("RD"))),t.has("U")&&e._writeAttributeString("u",this._getValue(t.get("U"))),t.has("RT")&&e._writeAttributeString("rt",this._getValue(t.get("RT"))),t.has("SS")&&e._writeAttributeString("ss",this._getValue(t.get("SS"))),t.has("FD")&&e._writeAttributeString("fd",this._getValue(t.get("FD")))},i.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var i=b(e);this._xmlDocument=(new DOMParser).parseFromString(i,"text/xml"),this._isAnnotationImport=!0,this._readXmlData(this._xmlDocument.documentElement)},i.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._xmlDocument=(new DOMParser).parseFromString(b(e),"text/xml"),this._readXmlData(this._xmlDocument.documentElement)},i.prototype._readXmlData=function(t){if(t&&1===t.nodeType)if(this._checkXfdf(t),this._isAnnotationImport){var e=t.getElementsByTagName("annots");if(e&&e.length>0)for(o=0;o<e.length;o++){var i=e.item(o);if(i&&"annots"===i.localName&&i.hasChildNodes())for(var r=i.childNodes,n=0;n<r.length;n++){var s=r.item(n);if(s&&1===s.nodeType){var a=s;a&&1===a.nodeType&&this._parseAnnotationData(a)}}}if(this._groupHolders.length>0)for(var o=0;o<this._groupHolders.length;o++){var h=this._groupHolders[Number.parseInt(o.toString(),10)],c=h.get("IRT");c&&""!==c&&(this._groupReferences.has(c)?h.update("IRT",this._groupReferences.get(c)):delete h._map.IRT)}this._groupHolders=[],this._groupReferences=new Map}else this._parseFormData(t);this._dispose()},i.prototype._checkXfdf=function(t){if("xfdf"!==t.nodeName)throw new Error("Invalid XFDF file.")},i.prototype._parseFormData=function(t){var e=t.getElementsByTagName("f");if(e&&e.length>0){var i=e.item(0);if(i&&"f"===i.localName&&i.hasAttribute("href")){var r=i.getAttribute("href");r&&""!==r&&(this._fileName=r)}}(e=t.getElementsByTagName("ids"))&&e.length>0&&(this._asPerSpecification=!0);var n=t.childNodes;if(n&&n.length>0)for(var s=0;s<n.length;s++){var a=n.item(s);if(a&&1===a.nodeType){var o=a;if(o&&"fields"===o.localName&&o.hasChildNodes()){for(var h=o.childNodes,c=[],_=0;_<h.length;_++){var d=h.item(_);if(d&&1===d.nodeType){var p=d;p&&"field"===p.localName&&c.push(p)}}this._importFormNodes(c)}}}this._importField()},i.prototype._importFormNodes=function(t){for(var e=0;e<t.length;e++){var i=t[Number.parseInt(e.toString(),10)],r="";if(i&&(i.hasAttribute("name")&&(r=i.getAttribute("name")),r&&""!==r)){var n=i.getElementsByTagName("value");if(n&&n.length>0){for(var s=i,a="";"fields"!==s.localName;){a.length>0&&(a="."+a);c=!1;if(s.hasAttribute("name")){var o=s.getAttribute("name");o&&""!==o&&(a=o+a,c=!0)}c||(a+=s.localName),s=s.parentElement}r=a;f=void 0;f=this._fields.has(r)?this._fields.get(r):[];for(u=0;u<n.length;u++)f.push(n.item(u).textContent);this._fields.set(r,f)}else if((n=i.getElementsByTagName("value-richtext"))&&n.length>0){var h=n.item(0);if(h){for(var s=i,a="";"fields"!==s.localName;){a.length>0&&(a="."+a);var c=!1;if(s.hasAttribute("name")){var _=s.getAttribute("name");_&&""!==_&&(a=_+a,c=!0)}c||(a+=s.localName),s=s.parentElement}r=a;var d=h.textContent;if(h.childNodes&&h.childNodes.length>0){var p=h.childNodes[0];if(p&&p.hasChildNodes()){d="";for(var l=p.childNodes,u=void 0;u<l.length;u++)d+=l.item(u).textContent+"\r";d=d.length>0?d.substring(0,d.length-1):h.textContent}}var f=void 0;f=this._fields.has(r)?this._fields.get(r):[];for(u=0;u<n.length;u++)f.push(d);this._fields.set(r,f),this._richTextValues.has(r)||this._richTextValues.set(r,h.innerHTML)}}}}},i.prototype._parseAnnotationData=function(t){if(t){var e=-1;if(t.hasAttributes&&t.hasAttribute("page")&&(e=Number.parseInt(t.getAttribute("page"),10))>=0&&e<this._document.pageCount){var i=this._document.getPage(e),r=this._getAnnotationDictionary(i,t);if(r&&r.size>0){var n=i._pageDictionary;if(n){var s=i.annotations,a=s._parseAnnotation(r);if(a){a._isImported=!0;var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,r),(r.has("NM")||r.has("IRT"))&&this._addReferenceToGroup(o,r),a._ref=o;var h=s._annotations.length;s._annotations.push(o),n.set("Annots",s._annotations),n._updated=!0,s._parsedAnnotations.set(h,a),this._handlePopup(s,o,r,n)}}}}}},i.prototype._getAnnotationDictionary=function(t,e){var i=new Tr(this._crossReference);i.update("Type",Sr.get("Annot"));var r=!0;switch(e.localName.toLowerCase()){case"line":if(i.update("Subtype",Sr.get("Line")),e.hasAttribute("start")&&e.hasAttribute("end")){var n=[];e.getAttribute("start").split(",").forEach(function(t){n.push(Number.parseFloat(t))}),e.getAttribute("end").split(",").forEach(function(t){n.push(Number.parseFloat(t))}),4===n.length&&i.update("L",n)}this._addLineEndStyle(i,e);break;case"circle":i.update("Subtype",Sr.get("Circle"));break;case"square":i.update("Subtype",Sr.get("Square"));break;case"polyline":i.update("Subtype",Sr.get("PolyLine")),this._addLineEndStyle(i,e);break;case"polygon":i.update("Subtype",Sr.get("Polygon")),this._addLineEndStyle(i,e);break;case"ink":i.update("Subtype",Sr.get("Ink"));break;case"popup":i.update("Subtype",Sr.get("Popup"));break;case"text":i.update("Subtype",Sr.get("Text"));break;case"freetext":i.update("Subtype",Sr.get("FreeText")),this._addLineEndStyle(i,e);break;case"stamp":i.update("Subtype",Sr.get("Stamp"));break;case"highlight":i.update("Subtype",Sr.get("Highlight"));break;case"squiggly":i.update("Subtype",Sr.get("Squiggly"));break;case"underline":i.update("Subtype",Sr.get("Underline"));break;case"strikeout":i.update("Subtype",Sr.get("StrikeOut"));break;case"fileattachment":i.update("Subtype",Sr.get("FileAttachment"));break;case"sound":i.update("Subtype",Sr.get("Sound"));break;case"caret":i.update("Subtype",Sr.get("Caret"));break;case"redact":i.update("Subtype",Sr.get("Redact"));break;default:r=!1}return r&&this._addAnnotationData(i,e,t),i},i.prototype._addAnnotationData=function(t,e,i){this._addBorderStyle(t,e),this._applyAttributeValues(t,e.attributes),this._parseInnerElements(t,e,i),this._addMeasureDictionary(t,e)},i.prototype._addBorderStyle=function(t,e){var i=new Tr(this._crossReference),r=new Tr(this._crossReference);e.hasAttribute("width")&&r.update("W",Number.parseFloat(e.getAttribute("width")));var n=!0;if(e.hasAttribute("style")){var s="";switch(e.getAttribute("style")){case"dash":s="D";break;case"solid":s="S";break;case"bevelled":s="B";break;case"inset":s="I";break;case"underline":s="U";break;case"cloudy":s="C",n=!1}if(""!==s)if((n?r:i).update("S",Sr.get(s)),!n&&e.hasAttribute("intensity"))i.update("I",Number.parseFloat(e.getAttribute("intensity")));else if(e.hasAttribute("dashes")){var a=[];e.getAttribute("dashes").split(",").forEach(function(t){a.push(Number.parseFloat(t))}),r.update("D",a)}}i.size>0&&t.update("BE",i),r.size>0&&(r.update("Type","Border"),t.update("BS",r))},i.prototype._applyAttributeValues=function(e,i){for(var r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)],s=n.value,a=void 0,o=void 0;switch(n.name.toLowerCase()){case"page":case"start":case"end":case"width":case"head":case"tail":case"style":case"intensity":case"itex":break;case"state":this._addString(e,"State",s);break;case"statemodel":this._addString(e,"StateModel",s);break;case"replytype":"group"===s&&e.update("RT",Sr.get("Group"));break;case"inreplyto":this._addString(e,"IRT",s);break;case"rect":(a=this._obtainPoints(s))&&4===a.length&&e.update("Rect",a);break;case"color":(a=B(s))&&3===a.length&&e.update("C",[a[0]/255,a[1]/255,a[2]/255]);break;case"interior-color":(a=B(s))&&3===a.length&&e.update("IC",[a[0]/255,a[1]/255,a[2]/255]);break;case"date":this._addString(e,"M",s);break;case"creationdate":this._addString(e,"CreationDate",s);break;case"name":this._addString(e,"NM",s);break;case"icon":s&&""!==s&&e.update("Name",Sr.get(s));break;case"subject":this._addString(e,"Subj",this._getFormatedString(s,!0));break;case"title":this._addString(e,"T",this._getFormatedString(s,!0));break;case"rotation":this._addInt(e,"Rotate",s);break;case"justification":this._addInt(e,"Q",s);break;case"fringe":this._addFloatPoints(e,this._obtainPoints(s),"RD");break;case"it":s&&""!==s&&e.update("IT",Sr.get(s));break;case"leaderlength":this._addFloat(e,"LL",s);break;case"leaderextend":void 0!==(o=Number.parseFloat(s))&&e.update("LLE",o);break;case"caption":s&&""!==s&&e.update("Cap","yes"===s.toLowerCase());break;case"caption-style":s&&""!==s&&e.update("CP",Sr.get(s));break;case"callout":this._addFloatPoints(e,this._obtainPoints(s),"CL");break;case"coords":this._addFloatPoints(e,this._obtainPoints(s),"QuadPoints");break;case"border":this._addFloatPoints(e,this._obtainPoints(s),"Border");break;case"opacity":this._addFloat(e,"CA",s);break;case"flags":if(s&&""!==s){for(var h=t.PdfAnnotationFlag.default,c=s.split(","),_=0;_<c.length;_++){var d=p(c[Number.parseInt(_.toString(),10)]);0===_?h=d:h|=d}e.update("F",h)}break;case"open":s&&""!==s&&e.update("Open","true"===s||"yes"===s);break;case"calibrate":this._addString(e,"Calibrate",s);break;case"customdata":this._addString(e,"CustomData",s);break;case"overlaytext":e.update("OverlayText",s);break;case"repeat":e.update("Repeat","true"===s||"yes"===s);break;default:this._document._allowImportCustomData&&this._addString(e,n.name,s)}}},i.prototype._obtainPoints=function(t){var e=[];return t.split(",").forEach(function(t){e.push(Number.parseFloat(t))}),e},i.prototype._parseInnerElements=function(t,e,i){if(e.hasChildNodes)for(var r=e.childNodes,n=this,s=0;s<r.length;s++)!function(s){var a=r[Number.parseInt(s.toString(),10)];if(1===a.nodeType){var o=a,h=a.textContent,c=o.innerHTML;switch(a.nodeName.toLowerCase()){case"popup":if(o&&o.hasAttributes){var _=n._getAnnotationDictionary(i,o);if(_.size>0){var d=n._crossReference._getNextReference();n._crossReference._cacheMap.set(d,_),t.update("Popup",d),_.has("NM")&&n._addReferenceToGroup(d,_)}}break;case"contents":h&&""!==h&&t.update("Contents",n._getFormatedString(h,!0));break;case"contents-richtext":c&&""!==c&&t.update("RC",n._richTextPrefix+c);break;case"defaultstyle":n._addString(t,"DS",h);break;case"defaultappearance":n._addString(t,"DA",h);break;case"vertices":if(h&&""!==h){var p=[];if(h.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){p.push(t)}):p.push(t)}),p.length>0){var l=[];p.forEach(function(t){l.push(Number.parseFloat(t))}),t.update("Vertices",l)}}break;case"appearance":n._addAppearanceData(a,t);break;case"inklist":if(a.hasChildNodes){for(var u=[],f=a.childNodes,g=0;g<f.length;g++)!function(t){var e=f[Number.parseInt(t.toString(),10)];if(e&&1===e.nodeType){var i=e;if("gesture"===i.nodeName.toLowerCase()&&i.textContent&&""!==i.textContent){var r=[];if(i.textContent.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){r.push(t)}):r.push(t)}),r.length>0){var n=[];r.forEach(function(t){n.push(Number.parseFloat(t))}),u.push(n)}}}}(g);t.update("InkList",u)}break;case"data":n._addStreamData(a,t,e)}}}(s)},i.prototype._addStreamData=function(t,e,i){if(t&&t.textContent&&""!==t.textContent){var r=w(t.textContent,!0);if(r&&r.length>0&&e.has("Subtype")){var n=e.get("Subtype");n&&"FileAttachment"===n.name?this._addFileAttachment(e,i,r):n&&"Sound"===n.name&&this._addSound(e,i,r)}}},i.prototype._addSound=function(t,e,i){var r=new Fr(i);if(r.dictionary._crossReference=this._crossReference,r.dictionary.update("Type",Sr.get("Sound")),e.hasAttribute("bits")&&this._addInt(r.dictionary,"B",e.getAttribute("bits")),e.hasAttribute("rate")&&this._addInt(r.dictionary,"R",e.getAttribute("rate")),e.hasAttribute("channels")&&this._addInt(r.dictionary,"C",e.getAttribute("channels")),e.hasAttribute("encoding")){var n=e.getAttribute("encoding");n&&""!==n&&r.dictionary.update("E",Sr.get(n))}e.hasAttribute("filter")&&r.dictionary.update("Filter",Sr.get("FlateDecode"));var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,r),t.update("Sound",s)},i.prototype._addFileAttachment=function(t,e,i){var r=new Tr(this._crossReference);if(r.update("Type",Sr.get("Filespec")),e.hasAttribute("file")){var n=e.getAttribute("file");this._addString(r,"F",n),this._addString(r,"UF",n)}var s=new Fr(i);s.dictionary._crossReference=this._crossReference;var a=new Tr(this._crossReference);if(e.hasAttribute("size")){var o=Number.parseInt(e.getAttribute("size"),10);void 0!==o&&(a.update("Size",o),s.dictionary.update("DL",o))}e.hasAttribute("modification")&&this._addString(a,"ModDate",e.getAttribute("modification")),e.hasAttribute("creation")&&this._addString(a,"CreationDate",e.getAttribute("creation")),s.dictionary.update("Params",a),e.hasAttribute("mimetype")&&this._addString(s.dictionary,"Subtype",e.getAttribute("mimetype")),s.dictionary.update("Filter",Sr.get("FlateDecode"));var h=new Tr(this._crossReference),c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,s),h.update("F",c),r.update("EF",h);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,r),t.update("FS",_)},i.prototype._addAppearanceData=function(t,e){var i=t.textContent;if(i&&""!==i){var r=(new DOMParser).parseFromString(atob(i),"text/xml");if(r&&r.hasChildNodes){var n=r.childNodes;if(n&&1===n.length){var s=n[0];if(s&&1===s.nodeType){var a=s;if("DICT"===a.nodeName.toUpperCase()&&a.hasAttribute("KEY")){var o=a.getAttribute("KEY");if(o&&"AP"===o&&a.hasChildNodes){var h=new Tr(this._crossReference);n=a.childNodes;for(var c=0;c<n.length;c++)this._getAppearance(h,n[Number.parseInt(c.toString(),10)]);h.size>0&&e.update("AP",h)}}}}}}},i.prototype._getAppearance=function(t,e){var i=t instanceof Tr?t:t.dictionary;if(e&&1===e.nodeType){var r=e;if(r&&r.localName){var n=void 0,s=void 0,a=void 0;switch(r.localName){case"STREAM":if(n=this._getStream(r)){o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,n),this._addKey(o,i,r)}break;case"DICT":if(s=this._getDictionary(r)){var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,s),this._addKey(o,i,r)}break;case"ARRAY":this._addKey(this._getArray(r),i,r);break;case"FIXED":this._addKey(this._getFixed(r),i,r);break;case"INT":this._addKey(this._getInt(r),i,r);break;case"STRING":this._addKey(this._getString(r),i,r);break;case"NAME":this._addKey(this._getName(r),i,r);break;case"BOOL":this._addKey(this._getBoolean(r),i,r);break;case"DATA":if((a=this._getData(r))&&a.length>0&&t instanceof Fr){t._bytes=a;var h=!1;if(i&&i.has("Subtype")){var c=i.get("Subtype");h=c&&"Image"===c.name}h?t._isCompress=!1:(t.dictionary.has("Length")&&delete t.dictionary._map.Length,t.dictionary.has("Filter")&&delete t.dictionary._map.Filter)}}}}},i.prototype._getStream=function(t){var e=new Fr([]);if(e.dictionary._crossReference=this._crossReference,t.hasChildNodes)for(var i=t.childNodes,r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n&&1===n.nodeType&&this._getAppearance(e,n)}return e},i.prototype._getDictionary=function(t){var e=new Tr(this._crossReference);if(t.hasChildNodes)for(var i=t.childNodes,r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n&&1===n.nodeType&&this._getAppearance(e,n)}return e},i.prototype._getArray=function(t){var e=[];if(t.hasChildNodes)for(var i=t.childNodes,r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n&&1===n.nodeType&&this._addArrayElements(e,n)}return e},i.prototype._getData=function(t){var e=[];if(t&&t.textContent&&""!==t.textContent&&t.hasAttribute("MODE")&&t.hasAttribute("ENCODING")){var i=t.getAttribute("MODE"),r=t.getAttribute("ENCODING");if(i&&r){var n=this._getFormatedString(t.textContent,!0);"FILTERED"===i&&"ASCII"===r?e=u(n,!0):"RAW"===i&&"HEX"===r&&(e=w(n,!0))}}return e},i.prototype._addArrayElements=function(t,e){if(e&&1===e.nodeType){var i,r=e,n=void 0,s=void 0,a=void 0,o=void 0,h=void 0,c=void 0;switch(r.localName){case"STREAM":if(n=this._getStream(r)){_=this._crossReference._getNextReference();n.reference=_,this._crossReference._cacheMap.set(_,n),t.push(_)}break;case"DICT":if(s=this._getDictionary(r)){var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,s),t.push(_)}break;case"ARRAY":(a=this._getArray(r))&&t.push(a);break;case"FIXED":void 0===(o=this._getFixed(r))||isNaN(o)||t.push(o);break;case"INT":void 0===(h=this._getInt(r))||isNaN(h)||t.push(h);break;case"NAME":(i=this._getName(r))&&t.push(i);break;case"BOOL":void 0!==(c=this._getBoolean(r))&&null!==c&&t.push(c)}}},i.prototype._getFixed=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Number.parseFloat(t.getAttribute("VAL"))),e},i.prototype._getInt=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Number.parseInt(t.getAttribute("VAL"),10)),e},i.prototype._getString=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=t.getAttribute("VAL")),e},i.prototype._getName=function(t){var e;return t&&t.hasAttribute("VAL")&&(e=Sr.get(t.getAttribute("VAL"))),e},i.prototype._getBoolean=function(t){var e;return t&&t.hasAttribute("VAL")&&(e="true"===t.getAttribute("VAL")),e},i.prototype._addMeasureDictionary=function(t,e){var i,r,n,s;if(e.hasChildNodes)for(var a=e.childNodes,o=0;o<a.length;o++)if((y=a[Number.parseInt(o.toString(),10)])&&"measure"===y.localName){i=y;break}var h=new Tr(this._crossReference),c=new Tr(this._crossReference),_=new Tr(this._crossReference),d=new Tr(this._crossReference),p=[],l=[],u=[];if(i){if(h.update("Type",Sr.get("Measure")),i.hasAttribute("rateValue")){var f=i.getAttribute("rateValue");f&&""!==f&&h.update("R",f)}if(i.hasChildNodes)for(var a=i.childNodes,o=0;o<a.length;o++){var g=a[Number.parseInt(o.toString(),10)];if(g&&1===g.nodeType){var y=g;switch(y.nodeName.toLowerCase()){case"distance":n=y;break;case"area":r=y;break;case"xformat":s=y}}}}if(s&&(this._addElements(s,d),u.push(d)),n&&(this._addElements(n,c),p.push(c)),r&&(this._addElements(r,_),l.push(_)),h.set("A",l),h.set("D",p),h.set("X",u),h.size>0&&h.has("Type")){var m=this._crossReference._getNextReference();this._crossReference._cacheMap.set(m,h),t.update("Measure",m)}},i.prototype._addElements=function(t,e){t.hasAttribute("d")&&this._addFloat(e,"D",t.getAttribute("d")),t.hasAttribute("c")&&this._addFloat(e,"C",t.getAttribute("c")),t.hasAttribute("rt")&&e.update("RT",t.getAttribute("rt")),t.hasAttribute("rd")&&e.update("RD",t.getAttribute("rt")),t.hasAttribute("ss")&&e.update("SS",t.getAttribute("ss")),t.hasAttribute("u")&&e.update("U",t.getAttribute("u")),t.hasAttribute("f")&&e.update("F",Sr.get(t.getAttribute("f"))),t.hasAttribute("fd")&&e.update("FD","yes"===t.getAttribute("fd"))},i.prototype._addString=function(t,e,i){i&&""!==i&&t.update(e,i)},i.prototype._addInt=function(t,e,i){var r=Number.parseInt(i,10);void 0!==r&&t.update(e,r)},i.prototype._addFloat=function(t,e,i){var r=Number.parseFloat(i);void 0!==r&&t.update(e,r)},i.prototype._addFloatPoints=function(t,e,i){e&&e.length>0&&t.update(i,e)},i.prototype._addKey=function(t,e,i){void 0!==t&&null!==t&&i.hasAttribute("KEY")&&e.update(i.getAttribute("KEY"),t)},i.prototype._addLineEndStyle=function(t,e){var i="";e.hasAttribute("head")&&(i=e.getAttribute("head"));var r="";if(e.hasAttribute("tail")&&(r=e.getAttribute("tail")),i&&""!==i)if(r&&""!==r){var n=[];n.push(Sr.get(i)),n.push(Sr.get(r)),t.update("LE",n)}else t.update("LE",Sr.get(i));else r&&""!==r&&t.update("LE",Sr.get(r))},i}(qe),Je=function(){function t(t){this._baseFontEncoding="",this._dictionary=t,this._fontType=this._dictionary.get("Subtype").name}return Object.defineProperty(t.prototype,"differencesDictionary",{get:function(){return this._differencesDictionary||(this._differencesDictionary=this._getDifferencesDictionary()),this._differencesDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseFontEncoding",{get:function(){return this._baseFontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontEncoding",{get:function(){return this._fontEncoding||(this._fontEncoding=this._getFontEncoding()),this._fontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontName",{get:function(){return this._fontName||(this._fontName=this._getFontName()),this._fontName},enumerable:!0,configurable:!0}),t.prototype._getFontEncoding=function(){var t="";if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")){var e=this._dictionary.get("Encoding");if(e instanceof Sr)t=e.name;else if(e instanceof Tr){if(e.has("BaseEncoding")){var i=e.get("BaseEncoding");i&&i instanceof Sr&&(this._baseFontEncoding=i.name)}if(e.has("Type")){var r=e.get("Type");null!==r&&void 0!==r&&(t=r.name)}}}return"identity#2dh"!==t.toString()&&"CMap"!==t||(t="Identity-H"),t},t.prototype._getDifferencesDictionary=function(){var t=new Map;if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")){var e=this._dictionary.get("Encoding");if(null!==e&&void 0!==e&&e instanceof Tr&&e.has("Differences")){var i=e.getArray("Differences"),r=0;if(null!==i&&void 0!==i)for(var n=0;n<i.length;n++){var s="",a=i[Number.parseInt(n.toString(),10)];"number"==typeof a?(s=a.toString(),r=Number.parseInt(s,10)):a instanceof Sr&&(s=a.name,"Type1"===this._fontType&&".notdef"===s?(s=" ",t.set(r.toString(),gt(s))):(s=ft(s=gt(s)),t.has(r.toString())||t.set(r.toString(),gt(s)),r++))}}}return t},t.prototype._getFontName=function(){var t="";if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("BaseFont")){var e=this._dictionary.get("BaseFont"),i=e.name;if(-1!==i.indexOf("#20")&&-1===i.indexOf("+")){var r=i.lastIndexOf("#20");i=i.substring(0,r),i+="+"}-1!==(t=-1!==e.name.indexOf("+")?e.name.split("+")[1]:e.name).indexOf("-")?t=t.split("-")[0]:-1!==t.indexOf(",")&&(t=t.split(",")[0]),-1!==t.indexOf("MT")&&(t=t.replace("MT","")),-1!==t.indexOf("#20")&&(t=t.replace("#20"," ")),-1!==t.indexOf("#")&&(t=this._decodeHexFontName(t))}return t},t.prototype._decodeHexFontName=function(t){for(var e=t,i=0;i<t.length;i++)if("#"===t[Number.parseInt(i.toString(),10)]){var r=t[i+1]+t[i+2],n=Number.parseInt(r,16);if(0!==n&&(e=e.replace("#"+r,String.fromCharCode(n)),i+=2),-1===e.indexOf("#"))break}return e},t}(),Qe=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ye=function(e){function i(t){var i=e.call(this)||this;return i._isImport=!1,i._isColorSpace=!1,null!==t&&void 0!==t&&(i._fileName=t),i}return Qe(i,e),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},i.prototype._exportFormFields=function(t){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var e=this._document.form;if(null!==e&&void 0!==e){this._exportEmptyFields=e.exportEmptyFields;for(var i=this._document.form.count,r=0;r<i;r++){var n=this._document.form.fieldAt(r);this._exportFormFieldsData(n)}this._writeFormFieldData()}return this._save()},i.prototype._save=function(){var t=new Uint8Array(this._jsonData);return this._jsonData=[],t},i.prototype._writeFormFieldData=function(){var t=this;this._jsonData.push(this._openingBrace);var e=0;this._table.forEach(function(i,r){r=t._getValidString(r),t._jsonData.push(t._doubleQuotes);for(n=0;n<r.length;n++)t._jsonData.push(r.charCodeAt(n));if("string"==typeof i||Array.isArray(i)&&1===i.length){i=t._getValidString("string"==typeof i?i:i[0]),t._jsonData.push(t._doubleQuotes,t._colon,t._doubleQuotes);for(var n=0;n<i.length;n++)t._jsonData.push(i.charCodeAt(n));t._jsonData.push(t._doubleQuotes)}else{t._jsonData.push(t._doubleQuotes,t._colon,t._openingBracket);for(var s=0;s<i.length;s++){t._jsonData.push(t._doubleQuotes);for(var a=i[Number.parseInt(s.toString(),10)],o=0;o<a.length;o++)t._jsonData.push(a.charCodeAt(o));t._jsonData.push(t._doubleQuotes),s<i.length-1&&t._jsonData.push(t._comma)}t._jsonData.push(t._closingBracket)}e<t._table.size-1&&t._jsonData.push(t._comma),e++}),this._jsonData.push(this._closingBrace)},i.prototype._exportAnnotationData=function(t,e){var i=this,r=!1;this._jsonData.push(this._openingBrace,this._doubleQuotes,112,100,102,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBrace);for(var n=0;n<e;n++){var s=t.getPage(n);s&&s.annotations.count>0&&(this._jsonData.push(0!==n&&r?this._comma:this._space,this._doubleQuotes),f(n.toString(),[]).forEach(function(t){i._jsonData.push(t)}),this._jsonData.push(this._doubleQuotes,this._colon,this._openingBrace,this._doubleQuotes,115,104,97,112,101,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBracket),r=!0);for(var a=0,o=0;o<s.annotations.count;o++){var h=s.annotations.at(o);h&&(0!==a&&this._jsonData.push(this._comma),a++,this._exportAnnotation(h,n),this._jsonData=f(this._convertToJson(this._table),this._jsonData),this._table.clear())}s&&s.annotations.count>0&&this._jsonData.push(this._closingBracket,this._closingBrace)}this._jsonData.push(this._closingBrace,this._closingBrace)},i.prototype._exportAnnotation=function(t,e){var i=!1,r=t._dictionary,n=this._getAnnotationType(t._dictionary);if(this._skipBorderStyle=!1,n&&""!==n){this._table.set("type",n),this._table.set("page",e.toString());var s=void 0;switch(n){case"Line":s=t.linePoints,this._table.set("start",s[0].toString()+","+s[1].toString()),this._table.set("end",s[2].toString()+","+s[3].toString());break;case"Stamp":case"Square":i=!0}if(r&&r.has("BE")&&r.has("BS")){var a=r.get("BE");a&&a.has("S")&&(this._skipBorderStyle=!0)}this._writeDictionary(r,e,i)}},i.prototype._writeDictionary=function(t,e,i){var r=this,n=!1;if(t.has("Type")){var s=t.get("Type");n=s&&"Border"===s.name&&this._skipBorderStyle}if(t.forEach(function(s,a){if((i||"AP"!==s)&&"P"!==s&&"Parent"!==s){var o=void 0;if(a instanceof Pr&&(o=t.get(s)),o&&o instanceof Tr)switch(s){case"BS":case"BE":r._writeDictionary(o,e,!1);break;case"IRT":o.has("NM")&&r._table.set("inreplyto",r._getValue(o.get("NM"),!0))}else a instanceof Tr?r._writeDictionary(a,e,!1):(!n||n&&"S"!==s)&&r._writeAttribute(s,a,t)}}),t.has("Measure")&&this._exportMeasureDictionary(t.get("Measure")),(this.exportAppearance||i)&&t.has("AP")){var a=this._getAppearanceString(t.get("AP"));a&&a.length>0&&this._table.set("appearance",x(a))}if(t.has("Sound")){var o=t.get("Sound");if(o&&o.dictionary){var h=o.dictionary;h.has("B")&&this._table.set("bits",this._getValue(h.get("B"),!0)),h.has("C")&&this._table.set("channels",this._getValue(h.get("C"),!0)),h.has("E")&&this._table.set("encoding",this._getValue(h.get("E"),!0)),h.has("R")&&this._table.set("rate",this._getValue(h.get("R"),!0)),h.has("Length")&&h.get("Length")>0&&(y=S(o.getBytes()))&&""!==y&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),h.has("Length")&&this._table.set("length",this._getValue(h.get("Length"),!0)),h.has("Filter")&&this._table.set("filter",this._getValue(h.get("Filter"),!0)),this._table.set("data",y))}}else if(t.has("FS")){var c=t.get("FS");if(c&&(c.has("F")&&this._table.set("file",this._getValue(c.get("F"),!0)),c.has("EF"))){var _=c.get("EF");if(_&&_.has("F")){var d=_.get("F");if(d&&d.dictionary){var p=d.dictionary;if(p.has("Params")){var l=p.get("Params");if(l){if(l.has("CreationDate")){f=this._getValue(l.get("CreationDate"),!0);this._table.set("creation",f)}if(l.has("ModificationDate")){var f=this._getValue(l.get("ModificationDate"),!0);this._table.set("modification",f)}if(l.has("Size")&&this._table.set("size",this._getValue(l.get("Size"),!0)),l.has("CheckSum")){var g=S(u(f=this._getValue(l.get("CheckSum"),!0)));this._table.set("checksum",g)}}}var y=S(d.getBytes());y&&""!==y&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),p.has("Length")&&this._table.set("length",this._getValue(p.get("Length"),!0)),p.has("Filter")&&this._table.set("filter",this._getValue(p.get("Filter"),!0)),this._table.set("data",y))}}}}},i.prototype._writeColor=function(t,e,i){var r=this._getColor(t);if("number"==typeof t&&i){var n=this._getValue(t,!0);n&&""!==n&&this._table.set(i,n)}r&&""!==r&&this._table.set(e,r)},i.prototype._writeAttributeString=function(t,e,i){void 0===i&&(i=!1);var r=this._getValue(e,!0);this._table.set(t,i?r.toLowerCase():r)},i.prototype._writeAttribute=function(t,e,i){var r;switch(t){case"C":this._writeColor(e,"color","c");break;case"IC":this._writeColor(e,"interior-color");break;case"DA":(r=i.get("DA"))&&this._table.set("defaultappearance",r);break;case"M":this._writeAttributeString("date",e);break;case"NM":this._table.set("name",e);break;case"Name":this._writeAttributeString("icon",e);break;case"Subj":this._writeAttributeString("subject",e);break;case"T":this._writeAttributeString("title",e);break;case"Rect":if(r=this._getValue(e,!0)){var n=r.split(","),s=new Map;s.set("x",n[0]),s.set("y",n[1]),s.set("width",n[2]),s.set("height",n[3]),this._table.set(t.toLowerCase(),this._convertToJson(s))}break;case"CreationDate":this._writeAttributeString("creationdate",e);break;case"Rotate":this._writeAttributeString("rotation",e);break;case"W":this._writeAttributeString("width",e);break;case"LE":e&&Array.isArray(e)?2===e.length&&(this._table.set("head",this._getValue(e[0],!0)),this._table.set("tail",this._getValue(e[1],!0))):e instanceof Sr&&this._writeAttributeString("head",e);break;case"S":switch(this._getValue(e,!0)){case"D":this._table.set("style","dash");break;case"C":this._table.set("style","cloudy");break;case"S":this._table.set("style","solid");break;case"B":this._table.set("style","bevelled");break;case"I":this._table.set("style","inset");break;case"U":this._table.set("style","underline")}break;case"D":this._writeAttributeString("dashes",e);break;case"I":this._writeAttributeString("intensity",e);break;case"RD":this._writeAttributeString("fringe",e);break;case"IT":this._writeAttributeString("IT",e);break;case"RT":this._writeAttributeString("replyType",e,!0);break;case"LL":this._writeAttributeString("leaderLength",e);break;case"LLE":this._writeAttributeString("leaderExtend",e);break;case"Cap":this._writeAttributeString("caption",e);break;case"CP":this._writeAttributeString("caption-style",e);break;case"CL":this._writeAttributeString("callout",e);break;case"QuadPoints":this._writeAttributeString("coords",e);break;case"CA":this._writeAttributeString("opacity",e);break;case"F":if("number"==typeof e){var a=d(e);this._table.set("flags",a)}break;case"Contents":(r=i.get("Contents"))&&r.length>0&&this._table.set("contents",this._getValidString(r));break;case"InkList":this._writeInkList(i);break;case"Vertices":this._writeVertices(i);break;case"DS":if(r=i.get("DS")){for(var o=new Map,h=r.split(";"),c=0;c<h.length;c++){var _=h[Number.parseInt(c.toString(),10)].split(":");_&&_.length>0&&_[0]&&_[0].length>1&&_[0].startsWith(" ")&&(_[0]=_[0].substring(1)),o.set(_[0],_[1])}this._table.set("defaultStyle",this._convertToJson(o))}break;case"AllowedInteractions":-1!==e.indexOf('"')&&(e=e.replace(/"/g,'\\"')),this._table.set(t,e);break;case"Type":case"Subtype":case"P":case"Parent":case"L":case"RC":case"FS":case"MeasurementTypes":case"GroupNesting":case"ITEx":case"TextMarkupContent":break;case"Border":case"A":case"R":case"X":case"ca":this._writeAttributeString(t.toLowerCase(),e);break;default:"string"==typeof e&&e.startsWith("{")&&e.endsWith("}")?this._table.set(t,e):this._writeAttributeString(t,e)}},i.prototype._writeVertices=function(t){var e=t.getArray("Vertices");if(e&&e.length>0){var i=e.length;if(i%2==0){for(var r="",n=0;n<i-1;n++)r+=this._getValue(e[Number.parseInt(n.toString(),10)],!0)+(n%2!=0?";":",");(r+=this._getValue(e[i-1],!0))&&""!==r&&this._table.set("vertices",r)}}},i.prototype._writeInkList=function(t){var e=t.getArray("InkList");if(e&&e.length>0){for(var i=new Map,r="[",n=0;n<e.length;n++)r+="["+this._getValue(e[Number.parseInt(n.toString(),10)],!0)+"]",n<e.length-1&&(r+=",");r+="]",i.set("gesture",r),this._table.set("inklist",this._convertToJson(i))}},i.prototype._exportMeasureDictionary=function(t){if(t){if(t.has("Type")&&this._table.set("type1","Measure"),t.has("R")&&this._table.set("ratevalue",this._getValue(t.get("R"),!0)),t.has("SubType")&&this._table.set("SubType",this._getValue(t.get("SubType"),!0)),t.has("TargetUnitConversion")&&this._table.set("TargetUnitConversion",this._getValue(t.get("TargetUnitConversion"),!0)),t.has("A")){e=t.getArray("A");this._exportMeasureFormatDetails("area",e[0])}if(t.has("D")){e=t.getArray("D");this._exportMeasureFormatDetails("distance",e[0])}if(t.has("X")){e=t.getArray("X");this._exportMeasureFormatDetails("xformat",e[0])}if(t.has("T")){e=t.getArray("T");this._exportMeasureFormatDetails("tformat",e[0])}if(t.has("V")){var e=t.getArray("V");this._exportMeasureFormatDetails("vformat",e[0])}}},i.prototype._exportMeasureFormatDetails=function(t,e){var i=new Map;e.has("C")&&i.set("c",this._getValue(e.get("C"),!0)),e.has("F")&&i.set("f",this._getValue(e.get("F"),!0)),e.has("D")&&i.set("d",this._getValue(e.get("D"),!0)),e.has("RD")&&i.set("rd",this._getValue(e.get("RD"),!0)),e.has("U")&&i.set("u",this._getValue(e.get("U"),!0)),e.has("RT")&&i.set("rt",this._getValue(e.get("RT"),!0)),e.has("SS")&&i.set("ss",this._getValue(e.get("SS"),!0)),e.has("FD")&&i.set("fd",this._getValue(e.get("FD"),!0)),this._table.set(t,this._convertToJson(i))},i.prototype._getAppearanceString=function(t){var e=new Map,i=new Map;return this._writeAppearanceDictionary(i,t),e.set("ap",this._convertToJson(i)),u(this._convertToJson(e))},i.prototype._writeAppearanceDictionary=function(t,e){var i=this;e&&e.size>0&&e.forEach(function(r,n){i._writeObject(t,n instanceof Pr?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r,n){var s=this;if(e instanceof Sr)this._writeTable("name",e.name,t,r,n);else if(Array.isArray(e)){var a=[];"ColorSpace"===r&&e.forEach(function(t){"string"==typeof t&&(s._isColorSpace=!0)}),this._writeArray(a,e,i),this._isColorSpace=!1,this._writeTable("array",this._convertToJsonArray(a),t,r,n)}else if("string"==typeof e)if(this._isColorSpace){var o=u(e);this._writeTable("unicodeData",S(o),t,r,n)}else this._writeTable("string",e,t,r,n);else if("number"==typeof e)this._writeTable(Number.isInteger(e)?"int":"fixed",e.toString(),t,r,n);else if("boolean"==typeof e)this._writeTable("boolean",e?"true":"false",t,r,n);else if(e instanceof Tr){var h=new Map;this._writeAppearanceDictionary(h,e),this._writeTable("dict",this._convertToJson(h),t,r,n)}else if(e instanceof Cr&&e.dictionary){var c=new Map,_=new Map,d=e.dictionary,p=void 0,l=e,f=!1;if(d.has("Subtype")&&"Image"===d.get("Subtype").name&&(f=!0),f&&l.stream&&l.stream instanceof Rr){y=l.stream;p=l.getString(!0,y.getByteRange(y.start,y.end))}else if(l.stream&&l.stream.stream){var g=l.stream;if(g.stream&&g.stream instanceof Rr){var y=g.stream;p=g.getString(!0,y.getByteRange(y.start,y.end))}}else p=e.getString(!0);!d.has("Length")&&p&&""!==p&&d.update("Length",e.length),this._writeAppearanceDictionary(_,d);var m=void 0;d.has("Subtype")&&(m=this._getValue(d.get("Subtype"))),!d.has("Type")&&!d.has("Subtype")||d.has("Subtype")&&("Image"===m||"Form"===m||"CIDFontType0C"===m||"OpenType"===m)?(c.set("mode","raw"),c.set("encoding","hex")):(c.set("mode","filtered"),c.set("encoding","ascii")),p&&""!==p&&c.set("bytes",p),_.set("data",this._convertToJson(c)),this._writeTable("stream",this._convertToJson(_),t,r,n)}else e instanceof Pr&&this._crossReference?this._writeObject(t,this._crossReference._fetch(e),i,r,n):null!==e&&void 0!==e||this._writeTable("null","null",t,r,n)},i.prototype._writeTable=function(t,e,i,r,n){var s=new Map;s.set(t,e),r?i.set(r,this._convertToJson(s)):n&&n.push(s)},i.prototype._writeArray=function(t,e,i){for(var r=0;r<e.length;r++)this._writeObject(null,e[Number.parseInt(r.toString(),10)],i,null,t)},i.prototype._convertToJson=function(t){var e=0,i="{";return t.forEach(function(r,n){r.startsWith("{")||r.startsWith("[")?i+="AllowedInteractions"===n?'"'+n+'":"'+r+'"':'"'+n+'":'+r:(r.startsWith(" ")&&r.length>1&&("["===r[1]||"{"===r[1])&&(r=r.substring(1)),i+='"'+n+'":"'+r+'"'),e<t.size-1&&(i+=","),e++}),i+"}"},i.prototype._convertToJsonArray=function(t){for(var e="[",i=0;i<t.length;i++)e+=this._convertToJson(t[Number.parseInt(i.toString(),10)]),i<t.length-1&&(e+=",");return e+"]"},i.prototype._parseJson=function(t,e){this._document=t,this._crossReference=t._crossReference;var i=b(e);if(i.startsWith("{")&&!i.endsWith("}"))for(;i.length>0&&!i.endsWith("}");)i=i.substring(0,i.length-1);return JSON.parse(i)},i.prototype._importFormData=function(t,e){var i=this,r=this._parseJson(t,e);if(r){var n=Object.keys(r);if(n&&n.length>0){for(var s=this,a=0;a<n.length;a++)!function(t){var e=n[Number.parseInt(t.toString(),10)],a=r[e];Array.isArray(a)?s._fields.has("key")?a.forEach(function(t){i._fields.get(e).push(t)}):s._fields.set(e,a):s._fields.has("key")?s._fields.get(e).push(a):s._fields.set(e,[a])}(a);this._importField()}}},i.prototype._importAnnotations=function(t,e){var i=this,r=this._parseJson(t,e);if(r&&-1!==Object.keys(r).indexOf("pdfAnnotation")){var n=r.pdfAnnotation,s=t.pageCount,a=Object.keys(n);if(a&&a.length>0&&a.forEach(function(e){var r=Number.parseInt(e,10);if(void 0!==r&&r<s){var a=t.getPage(r),o=n[e];if(o){var h=Object.keys(o);if(h&&h.length>0&&-1!==h.indexOf("shapeAnnotation")){var c=o.shapeAnnotation;c&&c.length>0&&c.forEach(function(t){var e=Object.keys(t);if(e&&e.length>0&&-1!==e.indexOf("type")){var r=new Tr(i._crossReference);r.update("Type",Sr.get("Annot"));var n=!0;switch(t.type.toLowerCase()){case"line":r.update("Subtype",Sr.get("Line"));break;case"circle":r.update("Subtype",Sr.get("Circle"));break;case"square":r.update("Subtype",Sr.get("Square"));break;case"polyline":r.update("Subtype",Sr.get("PolyLine"));break;case"polygon":r.update("Subtype",Sr.get("Polygon"));break;case"ink":r.update("Subtype",Sr.get("Ink"));break;case"popup":r.update("Subtype",Sr.get("Popup"));break;case"text":r.update("Subtype",Sr.get("Text"));break;case"freetext":r.update("Subtype",Sr.get("FreeText"));break;case"stamp":r.update("Subtype",Sr.get("Stamp"));break;case"highlight":r.update("Subtype",Sr.get("Highlight"));break;case"squiggly":r.update("Subtype",Sr.get("Squiggly"));break;case"underline":r.update("Subtype",Sr.get("Underline"));break;case"strikeout":r.update("Subtype",Sr.get("StrikeOut"));break;case"fileattachment":r.update("Subtype",Sr.get("FileAttachment"));break;case"sound":r.update("Subtype",Sr.get("Sound"));break;case"redact":r.update("Subtype",Sr.get("Redact"));break;case"caret":r.update("Subtype",Sr.get("Caret"));break;default:n=!1}if(n){i._addAnnotationData(r,t,e);var s=a._pageDictionary;if(s){var o=a.annotations,h=o._parseAnnotation(r);if(h){h._isImported=!0;var c=i._crossReference._getNextReference();i._crossReference._cacheMap.set(c,r),(r.has("NM")||r.has("IRT"))&&i._addReferenceToGroup(c,r),h._ref=c;var _=o._annotations.length;o._annotations.push(c),s.set("Annots",o._annotations),s._updated=!0,o._parsedAnnotations.set(_,h),i._handlePopup(o,c,r,s)}}}}})}}}}),this._groupHolders.length>0)for(var o=0;o<this._groupHolders.length;o++){var h=this._groupHolders[Number.parseInt(o.toString(),10)],c=h.get("IRT");c&&""!==c&&(this._groupReferences.has(c)?h.update("IRT",this._groupReferences.get(c)):delete h._map.IRT)}this._groupHolders=[],this._groupReferences=new Map}},i.prototype._addAnnotationData=function(e,i,r){var n,s,a,o,h=this,c=new Tr(this._crossReference),_=new Tr(this._crossReference),d=new Map,l=[],u="";if(r.forEach(function(r){var f=i[r];switch(r.toLowerCase()){case"start":case"end":h._addLinePoints(f,l),4===l.length&&(e.update("L",l),l=[]);break;case"itex":break;case"state":h._addString(e,"State",f);break;case"statemodel":h._addString(e,"StateModel",f);break;case"replytype":"group"===f.toLowerCase()&&e.update("RT",Sr.get("Group"));break;case"inreplyto":h._addString(e,"IRT",f);break;case"dashes":case"width":case"intensity":case"style":h._addBorderStyle(r,f,c,_);break;case"rect":if(a=f){var g=[];g.push(Number.parseFloat(a.x)),g.push(Number.parseFloat(a.y)),g.push(Number.parseFloat(a.width)),g.push(Number.parseFloat(a.height)),g&&4===g.length&&e.update("Rect",g)}break;case"color":(f=B(f))&&3===f.length&&e.update("C",[f[0]/255,f[1]/255,f[2]/255]);break;case"oc":if(f&&"Redact"===e.get("Subtype").name){var y=[];(o=f.split(",")).forEach(function(t){y.push(Number.parseFloat(t))}),y&&y.length>0&&e.update("OC",y)}break;case"interior-color":(f=B(f))&&3===f.length&&e.update("IC",[f[0]/255,f[1]/255,f[2]/255]);break;case"date":h._addString(e,"M",f);break;case"creationdate":h._addString(e,"CreationDate",f);break;case"name":h._addString(e,"NM",f);break;case"icon":f&&e.update("Name",Sr.get(f));break;case"subject":h._addString(e,"Subj",f);break;case"title":h._addString(e,"T",f);break;case"rotation":e.update("Rotate",Number.parseFloat(f));break;case"fringe":h._addFloatPoints(e,"RD",h._parseFloatPoints(f));break;case"it":f&&e.update("IT",Sr.get(f));break;case"leaderlength":e.update("LL",Number.parseFloat(f));break;case"leaderextend":e.update("LLE",Number.parseFloat(f));break;case"caption":h._addBoolean(e,"Cap",f.toLowerCase());break;case"caption-style":f&&e.update("CP",Sr.get(f));break;case"callout":h._addFloatPoints(e,"CL",h._parseFloatPoints(f));break;case"coords":h._addFloatPoints(e,"QuadPoints",h._parseFloatPoints(f));break;case"border":h._addFloatPoints(e,"Border",h._parseFloatPoints(f));break;case"opacity":e.update("CA",Number.parseFloat(f));break;case"defaultstyle":if(f){var m=Object.keys(f);if(m&&m.length>0){var b="",v=0;m.forEach(function(t){var e=f[t];b+=t+":"+e,v<m.length-1&&(b+=";"),v++}),h._addString(e,"DS",b)}}break;case"defaultappearance":h._addString(e,"DA",f);break;case"flags":if(f&&"string"==typeof f){for(var S=t.PdfAnnotationFlag.default,w=f.split(","),P=0;P<w.length;P++){var A=p(w[Number.parseInt(P.toString(),10)]);0===P?S=A:S|=A}e.update("F",S)}break;case"open":h._addBoolean(e,"Open",f.toLowerCase());break;case"repeat":h._addBoolean(e,"Repeat",f.toLowerCase());break;case"overlaytext":h._addString(e,"OverlayText",f);break;case"contents":"string"==typeof f&&(-1!==f.indexOf("\\r")&&(f=f.replace("\\r","\r")),f&&h._addString(e,"Contents",f));break;case"q":e.update("Q",Number.parseInt(f,10));break;case"inklist":if(f){var k=Object.keys(f);if(k&&k.length>0&&-1!==k.indexOf("gesture")){var x=f.gesture;x&&x.length>0&&e.update("InkList",x)}}break;case"head":n=f;break;case"tail":s=f;break;case"creation":case"modification":case"file":case"bits":case"channels":case"encoding":case"rate":case"length":case"filter":case"mode":case"size":d.set(r,f);break;case"data":u=f;break;case"vertices":if(f&&"string"==typeof f){var T=f.split(/[,;]/);if(T&&T.length>0){for(var I=[],P=0;P<T.length;P++)I.push(Number.parseFloat(T[Number.parseInt(P.toString(),10)]));I.length>0&&I.length%2==0&&e.update("Vertices",I)}}break;case"appearance":h._addAppearanceData(e,f);break;case"allowedinteractions":h._addString(e,"AllowedInteractions",f);break;default:h._document._allowImportCustomData&&"type"!==r&&"page"!==r&&h._addString(e,r,"string"==typeof f?f:JSON.stringify(f))}}),this._addMeasureDictionary(e,i,r),n?s?e.update("LE",[Sr.get(n),Sr.get(s)]):e.update("LE",n):s&&e.update("LE",s),_.size>0){_.update("Type",Sr.get("Border"));f=this._crossReference._getNextReference();_.objId=f.objectNumber+" "+f.generationNumber,this._crossReference._cacheMap.set(f,_),e.update("BS",f)}if(c.size>0){var f=this._crossReference._getNextReference();_.objId=f.objectNumber+" "+f.generationNumber,this._crossReference._cacheMap.set(f,c),e.update("BE",f)}this._addStreamData(e,d,u)},i.prototype._addLinePoints=function(t,e){t&&-1!==t.indexOf(",")&&t.split(",").forEach(function(t){e.push(Number.parseFloat(t))})},i.prototype._addString=function(t,e,i){i&&t.update(e,i)},i.prototype._addBoolean=function(t,e,i){i&&t.update(e,"yes"===i||"true"===i)},i.prototype._addBorderStyle=function(t,e,i,r){var n="",s=!0;switch(e){case"dash":n="D";break;case"solid":n="S";break;case"bevelled":n="B";break;case"inset":n="I";break;case"underline":n="U";break;case"cloudy":n="C",s=!1}switch(t.toLowerCase()){case"width":r.update("W",Number.parseFloat(e));break;case"intensity":i.update("I",Number.parseFloat(e));break;case"dashes":e&&-1!==e.indexOf(",")&&r.update("D",this._parseFloatPoints(e))}n&&(s?r.update("S",Sr.get(n)):i.update("S",Sr.get(n)))},i.prototype._parseFloatPoints=function(t){var e=[];return t.split(",").forEach(function(t){e.push(Number.parseFloat(t))}),e},i.prototype._addFloatPoints=function(t,e,i){i&&i.length>0&&t.update(e,i)},i.prototype._addMeasureDictionary=function(t,e,i){var r=new Tr(this._crossReference),n=[],s=[],a=[],o=[],h=[];if(r.set("A",n),r.set("D",s),r.set("X",a),r.set("T",o),r.set("V",h),-1!==i.indexOf("ratevalue")&&this._addString(r,"R",e.ratevalue),-1!==i.indexOf("subtype")&&this._addString(r,"Subtype",e.subtype),-1!==i.indexOf("targetunitconversion")&&this._addString(r,"TargetUnitConversion",e.targetunitconversion),-1!==i.indexOf("area")&&n.push(this._readDictionaryElements(e.area)),-1!==i.indexOf("distance")&&s.push(this._readDictionaryElements(e.distance)),-1!==i.indexOf("xformat")&&a.push(this._readDictionaryElements(e.xformat)),-1!==i.indexOf("tformat")&&o.push(this._readDictionaryElements(e.tformat)),-1!==i.indexOf("vformat")&&h.push(this._readDictionaryElements(e.vformat)),-1!==i.indexOf("type1")){r.set("Type",Sr.get("Measure"));var c=this._crossReference._getNextReference();r.objId=c.objectNumber+" "+c.generationNumber,this._crossReference._cacheMap.set(c,r),t.update("Measure",c)}},i.prototype._readDictionaryElements=function(t){var e=Object.keys(t),i=new Tr(this._crossReference);return e&&e.length>0&&e.forEach(function(e){var r=t[e];if(e&&r)switch(e){case"d":i.set("D",Number.parseFloat(r));break;case"c":i.set("C",Number.parseFloat(r));break;case"rt":i.set("RT",r);break;case"rd":i.set("RD",r);break;case"ss":i.set("SS",r);break;case"u":i.set("U",r);break;case"f":i.set("F",Sr.get(r));break;case"fd":i.set("FD",r);break;case"type":i.set("Type",Sr.get(r))}}),i},i.prototype._addStreamData=function(t,e,i){var r=this,n=t.get("Subtype").name,s=w(i,!0);if("Sound"===n){var a=new Fr(s);a.dictionary._crossReference=this._crossReference,a.dictionary.update("Type",Sr.get("Sound")),e.forEach(function(t,e){if(e&&t)switch(e){case"bits":case"rate":case"channels":a.dictionary.set(e,Number.parseInt(t,10));break;case"encoding":a.dictionary.set("E",Sr.get(t));break;case"filter":a.dictionary.set("Filter",Sr.get("FlateDecode"))}}),a.reference=this._crossReference._getNextReference(),a.dictionary.objId=a.reference.objectNumber+" "+a.reference.generationNumber,this._crossReference._cacheMap.set(a.reference,a),t.update("Sound",a.reference)}else if("FileAttachment"===n){var o=new Tr(this._crossReference);o.update("Type",Sr.get("Filespec"));var h=new Fr(s);h.dictionary._crossReference=this._crossReference;var c=new Tr(this._crossReference);e.forEach(function(t,e){if(e&&t){var i=void 0;switch(e){case"file":r._addString(o,"F",t),r._addString(o,"UF",t);break;case"size":void 0!==(i=Number.parseInt(t,10))&&(c.update("Size",i),h.dictionary.update("DL",i));break;case"creation":r._addString(c,"CreationDate",t);break;case"modification":r._addString(c,"ModificationDate",t)}}}),h.dictionary.update("Params",c),h.dictionary.update("Filter",Sr.get("FlateDecode")),h.reference=this._crossReference._getNextReference(),h.dictionary.objId=h.reference.objectNumber+" "+h.reference.generationNumber,this._crossReference._cacheMap.set(h.reference,h);var _=new Tr(this._crossReference);_.update("F",h.reference),o.update("EF",_);var d=this._crossReference._getNextReference();o.objId=d.objectNumber+" "+d.generationNumber,this._crossReference._cacheMap.set(d,o),t.update("FS",d)}},i.prototype._addAppearanceData=function(t,e){if(e){var i=b(k(e,!1));if(i.startsWith("{")&&!i.endsWith("}"))for(;i.length>0&&!i.endsWith("}");)i=i.substring(0,i.length-1);var r=JSON.parse(i);if(r){var n=Object.keys(r);n&&n.length>0&&-1!==n.indexOf("ap")&&t.update("AP",this._parseDictionary(r.ap))}}},i.prototype._parseAppearance=function(t){var e,i=this,r=Object.keys(t);if(-1!==r.indexOf("name"))e=Sr.get(t.name);else if(-1!==r.indexOf("int"))e=Number.parseInt(t.int,10);else if(-1!==r.indexOf("fixed"))e=Number.parseFloat(t.fixed);else if(-1!==r.indexOf("string"))e=t.string;else if(-1!==r.indexOf("boolean"))e="true"===t.boolean;else if(-1!==r.indexOf("array")){var n=t.array;e=[],n.forEach(function(t){e.push(i._parseAppearance(t))})}else if(-1!==r.indexOf("dict")){var s=this._parseDictionary(t.dict);e=this._crossReference._getNextReference(),s.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,s)}else if(-1!==r.indexOf("stream")){var a=this._parseStream(t.stream);e=this._crossReference._getNextReference(),a.reference=e,a.dictionary.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,a)}else e=-1!==r.indexOf("unicodeData")?b(w(t.unicodeData,!0)):null;return e},i.prototype._parseDictionary=function(t){var e=this,i=new Tr(this._crossReference);if(t){var r=Object.keys(t);r&&r.length>0&&r.forEach(function(r){var n=t[r];if("data"!==r){var s=e._parseAppearance(n);i.update(r,s)}})}return i},i.prototype._parseStream=function(t){var e,i=Object.keys(t);if(t&&i.indexOf("data")){var r=t.data,n=void 0;if(r){var s=Object.keys(r);if(s&&-1!==s.indexOf("bytes")){var a=r.bytes;a&&(n=w(a,!0))}}n||(n=[]);var o=new Fr(n);this._crossReference?this._parseStreamElements(o,t):o._pendingResources=JSON.stringify(t),e=o}return e},i.prototype._parseStreamElements=function(t,e){if(void 0===e&&t._pendingResources&&(e=JSON.parse(t._pendingResources)),e){var i=this._parseDictionary(e),r=!1;if(i&&i.has("Subtype")){var n=i.get("Subtype");r=n&&"Image"===n.name}r?t._isCompress=!1:(i.has("Length")&&delete i._map.Length,i.has("Filter")&&delete i._map.Filter),t.dictionary=i}},i.prototype._getValidString=function(t){return-1!==t.indexOf("\\")&&(t=t.replace(/\\/g,"\\\\")),-1!==t.indexOf('"')&&(t=t.replace(/"/g,'\\"')),-1!==t.indexOf("[")&&(t=t.replace(/\[/g,"\\[")),-1!==t.indexOf("]")&&(t=t.replace(/\[/g,"\\]")),-1!==t.indexOf("{")&&(t=t.replace(/\[/g,"\\{")),-1!==t.indexOf("}")&&(t=t.replace(/\}/g,"\\}")),-1!==t.indexOf("\n")&&(t=t.replace(/\n/g,"\\n")),-1!==t.indexOf("\r")&&(t=t.replace(/\r/g,"\\r")),t},i}(qe),Ze=function(){function t(t,e){if(this._isExported=!1,this._crossReference=e,t instanceof Cr){this._content=t,this._content.dictionary.has("Type")&&this._content.dictionary.has("Subtype")||this._initialize();var i=this._content.dictionary.getArray("BBox");if(i&&i.length>3){var r=C(i);this._size=[r.width,r.height]}this._isReadOnly=!0}else void 0!==t?(this._size=[t[2],t[3]],this._content=new Fr([]),this._content.dictionary._crossReference=this._crossReference,this._initialize(),this._content.dictionary.set("BBox",[t[0],t[1],t[0]+t[2],t[1]+t[3]])):this._isReadOnly=!0;this._writeTransformation=!0}return Object.defineProperty(t.prototype,"graphics",{get:function(){return this._isReadOnly?null:(void 0===this._g&&(this._g=new Le(this._size,this._content,this._crossReference,this),this._writeTransformation&&this._g._initializeCoordinates(),this._g._isTemplateGraphics=!0),this._g)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this._content.dictionary.set("Type",Sr.get("XObject")),this._content.dictionary.set("Subtype",Sr.get("Form"))},t.prototype._exportStream=function(t,e){var i=new Ye;i._crossReference=e,i._isAnnotationExport=!0;var r=new Map;i._writeObject(r,t.get("N"),t,"normal"),this._appearance=i._convertToJson(r),i._dispose()},t.prototype._importStream=function(t){var e=new Ye;t&&(e._crossReference=this._crossReference);var i=JSON.parse(this._appearance);if(i){var r=i.normal;r&&(this._content=e._parseStream(r.stream),t&&(this._content.dictionary._crossReference=this._crossReference,this._content.dictionary._updated=!0))}e._dispose()},t.prototype._updatePendingResource=function(t){if(this._content._pendingResources&&""!==this._content._pendingResources){var e=new Ye;e._crossReference=t,e._parseStreamElements(this._content),this._content._pendingResources="",e._dispose()}},t}(),$e=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ti=function(t){function e(e){var i=t.call(this)||this;return e instanceof tr?(i._destination=e,i._page=e.page):(i._page=e,i._destination=new tr(e,[0,0])),i._dictionary=new Tr,i._dictionary.update("Type",new Sr("Action")),i._dictionary.update("S",new Sr("GoTo")),i}return $e(e,t),Object.defineProperty(e.prototype,"destination",{get:function(){return this._destination},set:function(t){this._destination=t},enumerable:!0,configurable:!0}),e}(function(){function t(){}return Object.defineProperty(t.prototype,"next",{get:function(){return this._next},set:function(t){this._next=t;var e=this._page._crossReference._getNextReference();this._page._crossReference._cacheMap.set(e,t._dictionary),t._dictionary.objId=e.toString(),this._dictionary.update("Next",e)},enumerable:!0,configurable:!0}),t}()),ei=function(){function e(t){this._field=t}return Object.defineProperty(e.prototype,"mouseEnter",{get:function(){return this._mouseEnter||(this._mouseEnter=this._getPdfAction("E")),this._mouseEnter},set:function(t){t&&(this._mouseEnter=t,this._updateAction(this._mouseEnter,"E"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseLeave",{get:function(){return this._mouseLeave||(this._mouseLeave=this._getPdfAction("X")),this._mouseLeave},set:function(t){t&&(this._mouseLeave=t,this._updateAction(this._mouseLeave,"X"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseUp",{get:function(){return this._mouseUp||(this._mouseUp=this._getPdfAction("U")),this._mouseUp},set:function(t){t&&(this._mouseUp=t,this._updateAction(this._mouseUp,"U"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseDown",{get:function(){return this._mouseDown||(this._mouseDown=this._getPdfAction("D")),this._mouseDown},set:function(t){t&&(this._mouseDown=t,this._updateAction(this._mouseDown,"D"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gotFocus",{get:function(){return this._gotFocus||(this._gotFocus=this._getPdfAction("Fo")),this._gotFocus},set:function(t){t&&(this._gotFocus=t,this._updateAction(this._gotFocus,"Fo"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lostFocus",{get:function(){return this._lostFocus||(this._lostFocus=this._getPdfAction("Bl")),this._lostFocus},set:function(t){t&&(this._lostFocus=t,this._updateAction(this._lostFocus,"Bl"))},enumerable:!0,configurable:!0}),e.prototype._updateAction=function(e,i){var r;if(this._field._kidsCount>0&&(r=this._field.itemAt(0))&&r._dictionary&&e instanceof ti){var n=new Tr,s=e._page,a=e.destination;a._destinationMode===t.PdfDestinationMode.location?e._dictionary.update("D",[s._ref,new Sr("XYZ"),a.location[0],s.size[1],a.zoom]):a._destinationMode===t.PdfDestinationMode.fitR?e._dictionary.update("D",[s._ref,new Sr("FitR"),0,0,0,0]):a._destinationMode===t.PdfDestinationMode.fitH?e._dictionary.update("D",[s._ref,new Sr("FitH"),s.size[1]]):a._destinationMode===t.PdfDestinationMode.fitToPage&&e._dictionary.update("D",[s._ref,new Sr("Fit")]),n.set(i,e._dictionary),n._updated=!0,r._dictionary.update("AA",n)}},e.prototype._getPdfAction=function(t){var e,i=this._field.itemAt(0);if(i&&i._dictionary&&i._dictionary.has("AA")){var r=i._dictionary.get("AA");if(r&&r.has(t)){var n=r.get(t);if(n&&n.has("S")){var s=n.get("S");s&&"GoTo"===s.name&&n.has("D")&&(n._crossReference||(n._crossReference=i._crossReference),e=new ti(Rt(n,"D")))}}}return e},e}(),ii=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ri=function(){function e(){this._visible=!0,this._isTransparentBackColor=!1,this._defaultFont=new ke(t.PdfFontFamily.helvetica,8),this._appearanceFont=new ke(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._defaultItemFont=new ke(t.PdfFontFamily.timesRoman,12),this._flatten=!1,this._hasData=!1,this._circleCaptionFont=new ke(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular)}return Object.defineProperty(e.prototype,"itemsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){if(void 0===this._name){var t=T(this._dictionary,"T",!1,!1);t&&t.length>0&&(1===t.length?this._name=t[0]:this._name=t.join("."))}return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"actualName",{get:function(){if(void 0===this._actualName&&this._dictionary.has("T")){var t=this._dictionary.get("T");t&&"string"==typeof t&&(this._actualName=t)}return this._actualName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mappingName",{get:function(){if(void 0===this._mappingName&&this._dictionary.has("TM")){var t=this._dictionary.get("TM");t&&"string"==typeof t&&(this._mappingName=t)}return this._mappingName},set:function(t){void 0!==this.mappingName&&this._mappingName===t||(this._mappingName=t,this._dictionary.update("TM",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"toolTip",{get:function(){if(void 0===this._alternateName&&this._dictionary.has("TU")){var t=this._dictionary.get("TU");t&&"string"==typeof t&&(this._alternateName=t)}return this._alternateName},set:function(t){void 0!==this.toolTip&&this._alternateName===t||(this._alternateName=t,this._dictionary.update("TU",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visibility",{get:function(){var e;if(this._isLoaded){e=t.PdfFormFieldVisibility.visible;var i=this.itemAt(this._defaultIndex),r=t.PdfAnnotationFlag.default;if(i&&i._hasFlags)r=i.flags;else{if(!this._dictionary.has("F"))return t.PdfFormFieldVisibility.visibleNotPrintable;r=this._dictionary.get("F")}var n=3;switch((r&t.PdfAnnotationFlag.hidden)===t.PdfAnnotationFlag.hidden&&(n=0),(r&t.PdfAnnotationFlag.noView)===t.PdfAnnotationFlag.noView&&(n=1),(r&t.PdfAnnotationFlag.print)!==t.PdfAnnotationFlag.print&&(n&=2),n){case 0:e=t.PdfFormFieldVisibility.hidden;break;case 1:e=t.PdfFormFieldVisibility.hiddenPrintable;break;case 2:e=t.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:e=t.PdfFormFieldVisibility.visible}}else void 0===this._visibility&&(this._visibility=t.PdfFormFieldVisibility.visible),e=this._visibility;return e},set:function(e){var i=this.itemAt(this._defaultIndex);if(this._isLoaded)!i||i._hasFlags&&this.visibility===e?this._dictionary.has("F")&&this.visibility===e||(St(this._dictionary,e),this._dictionary._updated=!0):(St(i._dictionary,e),this._dictionary._updated=!0);else if(this.visibility!==e)switch(this._visibility=e,e){case t.PdfFormFieldVisibility.hidden:i.flags=t.PdfAnnotationFlag.hidden;break;case t.PdfFormFieldVisibility.hiddenPrintable:i.flags=t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visible:i.flags=t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visibleNotPrintable:i.flags=t.PdfAnnotationFlag.default}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary.has("Rect")&&(t=N(this._dictionary,this.page)),void 0!==t&&null!==t||(t={x:0,y:0,width:0,height:0}),t},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded&&(void 0===e||this._dictionary.has("Rect"))?this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){var t,e=this.itemAt(this._defaultIndex);if(e&&void 0!==e.rotate)t=e.rotate;else if(this._dictionary.has("R"))t=this._dictionary.get("R");else for(var i=0;i<this._kidsCount&&void 0===t;i++)i!==this._defaultIndex&&(e=this.itemAt(i))&&void 0!==e.rotate&&(t=e.rotate);return void 0===t&&(t=0),t},set:function(t){var e=this.itemAt(this._defaultIndex);e?e.rotate=t:this._dictionary.has("R")&&this._dictionary.get("R")===t||this._dictionary.update("R",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&e.color?t=e.color:this._defaultAppearance&&(t=this._da.color),t},set:function(t){var e=this.itemAt(this._defaultIndex);if(e&&e.color)e.color=t;else{var i=!1;this._defaultAppearance||(this._da=new pi(""),i=!0),(i||this._da.color!==t)&&(this._da.color=t,this._dictionary.update("DA",this._da.toString()))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backColor",{get:function(){return this._parseBackColor(!1)},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"borderColor",{get:function(){var t,e=this.itemAt(this._defaultIndex);if(e&&e.borderColor)t=e.borderColor;else if(this._mkDictionary){var i=this._mkDictionary;if(i&&i.has("BC")){var r=i.getArray("BC");r&&(t=L(r))}}return void 0!==t&&null!==t||(t=[0,0,0]),t},set:function(t){var e=this.itemAt(this._defaultIndex);if(e&&e.borderColor!==t)e.borderColor=t;else{var i=this._mkDictionary;if(void 0===i){var r=new Tr(this._crossReference);r.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary.update("MK",r)}else i.has("BC")&&L(i.getArray("BC"))===t||(i.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary._updated=!0)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readOnly",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.readOnly)},set:function(e){e?this._fieldFlags|=t._FieldFlag.readOnly:(this._fieldFlags===t._FieldFlag.readOnly&&(this._fieldFlags|=t._FieldFlag.default),this._fieldFlags&=~t._FieldFlag.readOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.required)},set:function(e){e?this._fieldFlags|=t._FieldFlag.required:this._fieldFlags&=~t._FieldFlag.required},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){if(this._isLoaded){var e=this.itemAt(this._defaultIndex),i=t.PdfAnnotationFlag.default;return e&&e._hasFlags?i=e.flags:this._dictionary.has("F")&&(i=this._dictionary.get("F")),i!==t.PdfAnnotationFlag.hidden}return this._visible},set:function(e){this._isLoaded||this._visible===e||e||(this._visible=e,this.itemAt(this._defaultIndex).flags=t.PdfAnnotationFlag.hidden)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){var e,i=this.itemAt(this._defaultIndex);if(i&&i._dictionary.has("BS"))e=i.border;else if(e=new Ki,this instanceof si||(e._width=0),e._dictionary=this._dictionary,this._dictionary.has("BS")){var r=this._dictionary.get("BS");if(r){if(r.has("W")&&(e._width=r.get("W")),r.has("S")){var n=r.get("S");if(n)switch(n.name){case"D":e._style=t.PdfBorderStyle.dashed;break;case"B":e._style=t.PdfBorderStyle.beveled;break;case"I":e._style=t.PdfBorderStyle.inset;break;case"U":e._style=t.PdfBorderStyle.underline;break;default:e._style=t.PdfBorderStyle.solid}}r.has("D")&&(e._dash=r.getArray("D"))}}return e},set:function(t){var e=this.itemAt(this._defaultIndex);e?this._updateBorder(e._dictionary,t):this._updateBorder(this._dictionary,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){var e=t.PdfRotationAngle.angle0,i=this.itemAt(this._defaultIndex);return i&&(e=i.rotationAngle),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"export",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.noExport))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.noExport:this._fieldFlags|=t._FieldFlag.noExport},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabIndex",{get:function(){var t;if(this.page._pageDictionary.has("Annots")&&(t=this.page._pageDictionary.get("Annots")),this._kids&&this._kids.length>0)for(var e=0;e<this._kids.length;e++){var i=this._kids[Number.parseInt(e.toString(),10)];if(i&&this.page._pageDictionary.has("Annots")&&t&&-1!==(r=t.indexOf(i)))return r}else if(this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._ref&&t){var r=t.indexOf(this._ref);if(-1!==r)return r}return-1},set:function(e){this._tabIndex=e;var i=this.page;if(i&&(this.form._tabOrder===t.PdfFormFieldsTabOrder.manual||i.tabOrder===t.PdfFormFieldsTabOrder.manual)&&i._pageDictionary.has("Annots")){var r=i._pageDictionary.get("Annots"),n=new Yi(r,this._crossReference,i);i._annotations=n;var s=r.indexOf(this._ref);s<0&&(s=this._annotationIndex);var a=i.annotations._reArrange(this._ref,this._tabIndex,s);i._pageDictionary.update("Annots",a),i._pageDictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){if(!this._page){var t,e=this.itemAt(this._defaultIndex),i=void 0!==e?e._dictionary:this._dictionary;this._crossReference&&(t=this._crossReference._document);var r=void 0;if(i.has("P")){var n=i.getRaw("P");if(n&&t)for(o=0;o<t.pageCount;o++){var s=t.getPage(o);if(s&&s._ref===n){r=s;break}}}if(!r&&t){var a=void 0!==e?e._ref:this._ref;if(!r&&a&&(r=X(t,a)),!r&&this._kids&&this._kids.length>0)for(var o=0;o<this._kids.length&&!(r=X(t,this._kids[Number.parseInt(o.toString(),10)]));o++);}this._page=r}return this._page},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_grayBrush",{get:function(){return this._gray||(this._gray=new Ve([128,128,128])),this._gray},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_silverBrush",{get:function(){return this._silver||(this._silver=new Ve([198,198,198])),this._silver},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_whiteBrush",{get:function(){return this._white||(this._white=new Ve([255,255,255])),this._white},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_blackBrush",{get:function(){return this._black||(this._black=new Ve([0,0,0])),this._black},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_kidsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_hasBackColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;if(!t){var e=this.itemAt(this._defaultIndex);e&&e._dictionary.has("MK")&&(t=e._dictionary.get("MK"))}return t&&t.has("BG")}return!this._isTransparentBackColor},enumerable:!0,configurable:!0}),e.prototype._parseBackColor=function(t){var e;if(!t||this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor){var i=this.itemAt(this._defaultIndex);if(i&&i.backColor)e=i.backColor;else if(this._mkDictionary){var r=this._mkDictionary;if(r&&r.has("BG")){var n=r.getArray("BG");n&&(e=L(n))}}void 0!==e&&null!==e||(e=[255,255,255])}return e},e.prototype._updateBackColor=function(t,e){if(void 0===e&&(e=!1),e&&4===t.length&&255!==t[3]){this._isTransparentBackColor=!0,this._dictionary.has("BG")&&delete this._dictionary._map.BG,(n=this._mkDictionary)&&n.has("BG")&&(delete n._map.BG,this._dictionary._updated=!0);var i=this.itemAt(this._defaultIndex);i&&(i.backColor=t)}else{this._isTransparentBackColor=!1;var r=this.itemAt(this._defaultIndex);if(r&&r.backColor!==t)r.backColor=t;else{var n=this._mkDictionary;if(void 0===n){var s=new Tr(this._crossReference);s.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary.update("MK",s)}else n.has("BG")&&L(n.getArray("BG"))===t||(n.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._dictionary._updated=!0)}}},e.prototype.itemAt=function(t){var e;if(t>=0&&t<this._kidsCount)if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0,r=this._kids[Number.parseInt(t.toString(),10)];r&&r instanceof Pr&&(i=this._crossReference._fetch(r)),i&&((e=ji._load(i,this._crossReference))._ref=r,this._parsedItems.set(t,e))}return e},e.prototype.setAppearance=function(t){this._setAppearance=t},e.prototype.getValue=function(t){var e;if(!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(i instanceof Sr)e=i.name;else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e=i}return e},e.prototype.setValue=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},e.prototype.removeItemAt=function(t){if(this._dictionary.has("Kids")&&this.itemsCount>0){var e=this.itemAt(t);if(e&&e._ref){var i=e._getPage();if(i&&i._removeAnnotation(e._ref),this._kids.splice(t,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(t),this._parsedItems.size>0){var r=new Map;this._parsedItems.forEach(function(e,i){i>t?r.set(i-1,e):r.set(i,e)}),this._parsedItems=r}}}},e.prototype.removeItem=function(t){if(t&&t._ref){var e=this._kids.indexOf(t._ref);-1!==e&&this.removeItemAt(e)}},Object.defineProperty(e.prototype,"_fieldFlags",{get:function(){return void 0===this._flags&&(this._flags=T(this._dictionary,"Ff",!1,!0),void 0===this._flags&&(this._flags=t._FieldFlag.default)),this._flags},set:function(t){this._fieldFlags!==t&&(this._flags=t,this._dictionary.update("Ff",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_defaultAppearance",{get:function(){if(void 0===this._da){var t=T(this._dictionary,"DA",!1,!0);t&&""!==t&&(this._da=new pi(t))}return this._da},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),e.prototype._updateBorder=function(e,i){var r,n=!1;e.has("BS")?r=e.get("BS"):(r=new Tr(this._crossReference),e.update("BS",r),n=!0),void 0!==i.width?(r.update("W",i.width),e._updated=!0):n&&r.update("W",0),void 0!==i.style?(r.update("S",M(i.style)),e._updated=!0):n&&r.update("S",M(t.PdfBorderStyle.solid)),void 0!==i.dash&&(r.update("D",i.dash),e._updated=!0)},e.prototype._checkFieldFlag=function(t){var e=t.get("F");return void 0!==e&&6===e},e.prototype._initializeFont=function(t){this._font=t;var e,i=this._crossReference._document;i&&(e=i.form._dictionary.has("DR")?i.form._dictionary.get("DR"):new Tr(this._crossReference));var r,n=!1;if(e.has("Font")){var s=e.getRaw("Font");s&&s instanceof Pr?(n=!0,r=this._crossReference._fetch(s)):s instanceof Tr&&(r=s)}r||(r=new Tr(this._crossReference),e.update("Font",r));var a=Sr.get(G()),o=this._crossReference._getNextReference();t instanceof Te?this._font._pdfFontInternals&&this._crossReference._cacheMap.set(o,this._font._pdfFontInternals):this._font._dictionary&&this._crossReference._cacheMap.set(o,this._font._dictionary),r.update(a.name,o),e._updated=!0,i.form._dictionary.update("DR",e),i.form._dictionary._updated=!0,this._fontName=a.name;var h=new pi;if(h.fontName=this._fontName,h.fontSize=this._font._size,h.color=this.color?this.color:[0,0,0],this._dictionary.has("Kids"))for(var c=this._dictionary.getArray("Kids"),_=0;_<c.length;_++)c[Number.parseInt(_.toString(),10)].update("DA",h.toString());else this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._dictionary.update("DA",h.toString());n&&(e._updated=!0)},e.prototype._drawRectangularControl=function(e,i){switch(e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush),this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth),i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._whiteBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}},e.prototype._drawBorder=function(e,i,r,n,s){r&&s>0&&(n===t.PdfBorderStyle.underline?e.drawLine(r,i[0],i[0]+i[3]-s/2,i[0]+i[2],i[1]+i[3]-s/2):e.drawRectangle(i[0]+s/2,i[1]+s/2,i[2]-s,i[3]-s,r))},e.prototype._drawLeftTopShadow=function(t,e,i,r){var n=new Fe,s=[];s.push([e[0]+i,e[1]+i]),s.push([e[0]+i,e[1]+e[3]-i]),s.push([e[0]+2*i,e[1]+e[3]-2*i]),s.push([e[0]+2*i,e[1]+2*i]),s.push([e[0]+e[2]-2*i,e[1]+2*i]),s.push([e[0]+e[2]-i,e[1]+i]),n._addPolygon(s),t._drawPath(n,null,r)},e.prototype._drawRightBottomShadow=function(t,e,i,r){var n=new Fe,s=[];s.push([e[0]+i,e[1]+e[3]-i]),s.push([e[0]+2*i,e[1]+e[3]-2*i]),s.push([e[0]+e[2]-2*i,e[1]+e[3]-2*i]),s.push([e[0]+e[2]-2*i,e[1]+2*i]),s.push([e[0]+e[2]-i,e[1]+i]),s.push([e[0]+e[2]-i,e[1]+e[3]-i]),n._addPolygon(s),t._drawPath(n,null,r)},e.prototype._drawRadioButton=function(e,i,r,n){if("l"===r){var s=i.bounds;switch(n){case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:e.drawEllipse(s[0],s[1],s[2],s[3],i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.underline?e.drawEllipse(s[0],s[1],s[2],s[3],i.backBrush):e.drawEllipse(s[0],s[1],s[2],s[3],i.shadowBrush)}if(this._drawRoundBorder(e,s,i.borderPen,i.borderWidth),this._drawRoundShadow(e,i,n),n===t._PdfCheckFieldState.checked||n===t._PdfCheckFieldState.pressedChecked){var a=[s[0]+i.borderWidth/2,s[1]+i.borderWidth/2,s[2]-i.borderWidth,s[3]-i.borderWidth];e.drawEllipse(a[0]+a[2]/4,a[1]+a[2]/4,a[2]-a[2]/2,a[3]-a[2]/2,i.foreBrush)}}else this._drawCheckBox(e,i,r,n)},e.prototype._drawRoundBorder=function(t,e,i,r){0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||t.drawEllipse(e[0]+r/2,e[1]+r/2,e[2]-r,e[3]-r,i)},e.prototype._drawRoundShadow=function(e,i,r){var n=i.borderWidth,s=-1.5*n,a=i.bounds[0]+s,o=i.bounds[1]+s,h=i.bounds[2]+2*s,c=i.bounds[3]+2*s,_=i.shadowBrush;if(_){var d=_._color,p=void 0,l=void 0;switch(i.borderStyle){case t.PdfBorderStyle.beveled:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:p=new je(d,n),l=new je([255,255,255],n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:p=new je([255,255,255],n),l=new je(d,n)}break;case t.PdfBorderStyle.inset:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:p=new je([0,0,0],n),l=new je([0,0,0],n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:p=new je([128,128,128],n),l=new je([192,192,192],n)}}p&&l&&(e.drawArc(a,o,h,c,135,180,p),e.drawArc(a,o,h,c,-45,180,l))}},e.prototype._drawCheckBox=function(e,i,r,n,s){switch(n){case t._PdfCheckFieldState.unchecked:case t._PdfCheckFieldState.checked:i.borderPen&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.underline?i.borderPen&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush):i.borderPen&&e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.shadowBrush)}var a=i.bounds;if(this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth),n===t._PdfCheckFieldState.pressedChecked||n===t._PdfCheckFieldState.pressedUnchecked)switch(i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._blackBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush)}else switch(i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._whiteBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}var o=0,h=0;switch(n){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.checked:if(s)s=new ke(t.PdfFontFamily.zapfDingbats,s._size);else{var c=i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.inset,_=i.borderWidth;c&&(_*=2);var d=Math.max(c?2*i.borderWidth:i.borderWidth,1),p=Math.min(_,d),l=(h=i.bounds[2]>i.bounds[3]?i.bounds[3]:i.bounds[2])-2*p;s=new ke(t.PdfFontFamily.zapfDingbats,l),i.bounds[2]>i.bounds[3]&&(o=(i.bounds[3]-s._metrics._getHeight())/2)}if(0===h&&(h=i.bounds[3]),i.pageRotationAngle!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var u=e.save(),f=e._size;if(i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(f[1],0),e.rotateTransform(90);var g=f[1]-(a[0]+a[2]);a=[b=a[1],g,a[3],a[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(f[0],f[1]),e.rotateTransform(-180),a=[b=f[0]-(a[0]+a[2]),g=f[1]-(a[1]+a[3]),a[2],a[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,f[0]),e.rotateTransform(270),a=[b=f[0]-(a[1]+a[3]),g=a[0],a[3],a[2]]);if(i.rotationAngle>0){if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,f[1]),e.rotateTransform(-90),a=[b=f[1]-(a[1]+a[3]),g=a[0],a[3],a[2]];else if(a[2]>a[3])e.translateTransform(0,f[1]),e.rotateTransform(-90),a=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]];else{var y=a[0];a[0]=-(a[1]+a[3]),a[1]=y;var m=a[3];a[3]=a[2]>s._metrics._getHeight()?a[2]:s._metrics._getHeight(),a[2]=m,e.rotateTransform(-90),a=[a[0],a[1],a[2],a[3]]}else if(270===i.rotationAngle)e.translateTransform(f[0],0),e.rotateTransform(-270),a=[b=a[1],g=f[0]-(a[0]+a[2]),a[3],a[2]];else if(180===i.rotationAngle){e.translateTransform(f[0],f[1]),e.rotateTransform(-180);var b=f[0]-(a[0]+a[2]);a=[b,g=f[1]-(a[1]+a[3]),a[2],a[3]]}e.drawString(r,s,[a[0],a[1]-o,a[2],a[3]],null,i.foreBrush,new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle)),e.restore(u)}else e.drawString(r,s,[a[0],a[1]-o,a[2],a[3]],null,i.foreBrush,new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle));break}}},e.prototype._addToKid=function(t){this._dictionary.has("Kids")?this._kids=this._dictionary.get("Kids"):(this._kids=[],this._dictionary.update("Kids",this._kids),this._parsedItems=new Map);var e=this._kidsCount;t._index=e,this._kids.push(t._ref),this._parsedItems.set(e,t)},e.prototype._drawTemplate=function(e,i,r){if(e&&i){var n=i.graphics;n.save(),i.rotation===t.PdfRotationAngle.angle90?(n.translateTransform(n._size[1],0),n.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(n.translateTransform(n._size[0],n._size[1]),n.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(n.translateTransform(0,n._size[0]),n.rotateTransform(270)),n._sw._setTextRenderingMode(t._TextRenderingMode.fill),n.drawTemplate(e,r),n.restore()}},e.prototype._addToOptions=function(t,e){e instanceof _i&&e._listValues.push(t._text),e._options.push([t._value,t._text]),e._dictionary.set("Opt",e._options),e._dictionary._updated=!0,!t._isFont&&t._pdfFont&&this._initializeFont(t._pdfFont)},e.prototype._addAppearance=function(t,e,i){var r=new Tr;t.has("AP")?(r=t.get("AP"),wt(t.get("AP"),this._crossReference,i)):(r=new Tr(this._crossReference),t.update("AP",r));var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,e._content),r.update(i,n)},e.prototype._rotateTextBox=function(e,i,r){var n=[0,0,0,0];return r===t.PdfRotationAngle.angle180?n=[i[0]-(e[0]+e[2]),i[1]-(e[1]+e[3]),e[2],e[3]]:r===t.PdfRotationAngle.angle270?n=[e[1],i[0]-(e[0]+e[2]),e[3],e[2]]:r===t.PdfRotationAngle.angle90&&(n=[i[1]-(e[1]+e[3]),e[0],e[3],e[2]]),n},e.prototype._checkIndex=function(t,e){if(t<0||0!==t&&t>=e)throw Error("Index out of range.")},e.prototype._getAppearanceStateValue=function(){var t;if(this._dictionary.has("Kids"))for(var e=0;e<this._kidsCount;e++){var i=this.itemAt(e);if(i&&i._dictionary&&i._dictionary.has("AS")&&(r=i._dictionary.get("AS"))&&"Off"!==r.name){t=r.name;break}}else if(this._dictionary.has("AS")){var r=this._dictionary.get("AS");r&&"Off"!==r.name&&(t=r.name)}return t},e.prototype._getTextAlignment=function(){if(null===this._textAlignment||void 0===this._textAlignment)if(this._isLoaded){var e=this.itemAt(this._defaultIndex);e&&e._dictionary&&e._dictionary.has("Q")?this._textAlignment=e._dictionary.get("Q"):this._dictionary.has("Q")?this._textAlignment=this._dictionary.get("Q"):this._textAlignment=t.PdfTextAlignment.left}else this._textAlignment=t.PdfTextAlignment.left;return this._textAlignment},e.prototype._setTextAlignment=function(e){var i=this.itemAt(this._defaultIndex);this._isLoaded&&!this.readOnly&&(i&&i._dictionary?i._dictionary.update("Q",e):this._dictionary.update("Q",e)),this._isLoaded||this._textAlignment===e||(i&&i._dictionary?i._dictionary.update("Q",e):this._dictionary&&this._dictionary.update("Q",e)),this._textAlignment=e,this._stringFormat=new Vt(e,t.PdfVerticalAlignment.middle)},e.prototype._parseItems=function(){for(var t=[],e=0;e<this.itemsCount;e++)t.push(this.itemAt(e));return t},e}(),ni=function(e){function i(t,i,r){var n=e.call(this)||this;return n._autoResizeText=!1,t&&i&&r&&n._initialize(t,i,r),n}return ii(i,e),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},Object.defineProperty(i.prototype,"text",{get:function(){if(void 0===this._text)if(this._isLoaded){var t=T(this._dictionary,"V",!1,!0);if(t)this._text=t;else{var e=this.itemAt(this._defaultIndex);e&&(t=e._dictionary.get("V"))&&(this._text=t)}}else this._text="";return this._text},set:function(t){if(this._isLoaded){if(!this.readOnly){this._dictionary.has("V")&&this._dictionary.get("V")===t||this._dictionary.update("V",t);var e=this.itemAt(this._defaultIndex);!e||e._dictionary.has("V")&&e._dictionary.get("V")===t||e._dictionary.update("V",t)}}else this._text!==t&&(this._dictionary.update("V",t),this._text=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"defaultValue",{get:function(){if(void 0===this._defaultValue){var t=T(this._dictionary,"DV",!1,!0);t&&(this._defaultValue=t)}return this._defaultValue},set:function(t){t!==this.defaultValue&&(this._dictionary.update("DV",t),this._defaultValue=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"multiLine",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.multiLine)},set:function(e){e?this._fieldFlags|=t._FieldFlag.multiLine:this._fieldFlags&=~t._FieldFlag.multiLine},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"password",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.password)},set:function(e){e?this._fieldFlags|=t._FieldFlag.password:this._fieldFlags&=~t._FieldFlag.password},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollable",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.doNotScroll))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.doNotScroll:this._fieldFlags|=t._FieldFlag.doNotScroll},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"spellCheck",{get:function(){return!(0!=(this._fieldFlags&t._FieldFlag.doNotSpellCheck))},set:function(e){e?this._fieldFlags&=~t._FieldFlag.doNotSpellCheck:this._fieldFlags|=t._FieldFlag.doNotSpellCheck},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"insertSpaces",{get:function(){var e=this._fieldFlags;return 0!=(t._FieldFlag.comb&e)&&0==(e&t._FieldFlag.multiLine)&&0==(e&t._FieldFlag.password)&&0==(e&t._FieldFlag.fileSelect)},set:function(e){e?this._fieldFlags|=t._FieldFlag.comb:this._fieldFlags&=~t._FieldFlag.comb},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){var e,i=this.itemAt(this._defaultIndex);return i&&void 0!==i.highlightMode?e=i.highlightMode:this._dictionary.has("H")&&(e=V(this._dictionary.get("H").name)),void 0!==e?e:t.PdfHighlightMode.noHighlighting},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&V(this._dictionary.get("H"))===t||this._dictionary.update("H",j(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxLength",{get:function(){if(void 0===this._maxLength){var t=T(this._dictionary,"MaxLen",!1,!0);this._maxLength=void 0!==t&&Number.isInteger(t)?t:0}return this._maxLength},set:function(t){this.maxLength!==t&&(this._dictionary.update("MaxLen",t),this._maxLength=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isAutoResizeText",{get:function(){return this._autoResizeText},set:function(t){this._autoResizeText=t;var e=this.itemAt(this._defaultIndex);e&&(e._isAutoResize=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Ae&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initialize=function(e,i,r){this._crossReference=e._crossReference,this._page=e,this._name=i,this._text="",this._defaultValue="",this._defaultIndex=0,this._spellCheck=!1,this._insertSpaces=!1,this._multiline=!1,this._password=!1,this._scrollable=!1,this._dictionary=new Tr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Sr.get("Tx")),this._dictionary.update("T",i),this._fieldFlags|=t._FieldFlag.doNotSpellCheck,this._initializeFont(this._defaultFont),this._createItem(r)},i.prototype._createItem=function(e){var i=new ji;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.left,this._stringFormat=new Vt(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new Tr(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[1,1,1]),i._mkDictionary.update("CA",this.actualName),this._addToKid(i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(e>0)for(i=0;i<e;i++)(r=this.itemAt(i))&&this._postProcess(t,r);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var i=0;i<e;i++){var r=this.itemAt(i);if(r&&!this._checkFieldFlag(r._dictionary)){var n=this._createAppearance(t,r);t?this._drawTemplate(n,r._page,{x:r.bounds.x,y:r.bounds.y,width:n._size[0],height:n._size[1]}):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}}t&&(this._dictionary._updated=!1)}},i.prototype._postProcess=function(e,i){var r,n,s=i||this;if(this._form._setAppearance||this._setAppearance||e&&!s._dictionary.has("AP"))r=this._createAppearance(e,s);else if(s._dictionary.has("AP")){var a=void 0,o=s._dictionary.get("AP");if(o&&o.has("N")){a=o.get("N");var h=o.getRaw("N");h&&(a.reference=h),a&&(r=new Ze(a,this._crossReference))}}if(r)if(e){var c=s instanceof ji?s._getPage():s.page;if(c){var _=c.graphics;_.save(),c.rotation===t.PdfRotationAngle.angle90?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(90)):c.rotation===t.PdfRotationAngle.angle180?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(-180)):c.rotation===t.PdfRotationAngle.angle270&&(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size[0],height:r._size[1]},_.drawTemplate(r,n),_.restore()}s._dictionary._updated=!1}else this._addAppearance(s._dictionary,r,"N")},i.prototype._createAppearance=function(e,i){var r=i.bounds,n=new Ze([0,0,r.width,r.height],this._crossReference);$(n,null),n._writeTransformation=!1;var s=n.graphics,a=new Ji;a.bounds=[0,0,r.width,r.height];var o=i.backColor;e&&o&&(a.backBrush=new Ve(o)),a.foreBrush=new Ve(i.color);var h=i.border;if(a.borderPen=new je(i.borderColor,h.width),a.borderStyle=h.style,a.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];a.shadowBrush=new Ve(_)}a.rotationAngle=i.rotate,a.insertSpaces=this.insertSpaces;var d=this.text;if(null!==d&&void 0!==d||(d=""),this.password){for(var p="",l=0;l<d.length;l++)p+="*";d=p}return a.required=this.required,this.required||(s._sw._beginMarkupSequence("Tx"),s._initializeCoordinates()),void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),void 0!==this._stringFormat&&null!==this._stringFormat||(void 0===this.textAlignment||null===this.textAlignment?this._stringFormat=new Vt(this.textAlignment,t.PdfVerticalAlignment.middle):this._stringFormat=new Vt(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle)),this._drawTextBox(s,a,d,this._font,this._stringFormat,this.multiLine,this.scrollable,this.maxLength),this.required||s._sw._endMarkupSequence(),n},i.prototype._drawTextBox=function(e,i,r,n,s,a,o,h){if(void 0!==h)if(i.insertSpaces){var c=0;if(void 0!==h&&h>0){c=i.bounds[2]/h,e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.borderPen,i.backBrush);for(var _=r,d=0;d<h;d++){if(s.alignment===t.PdfTextAlignment.right)r=h-_.length<=d?_[d-(h-_.length)]:"";else if(s.alignment===t.PdfTextAlignment.center&&_.length<h){var p=h/2-Math.ceil(_.length/2);r=d>=p&&d<p+_.length?_[d-p]:""}else r=_.length>d?_[Number.parseInt(d.toString(),10)]:"";i.bounds[2]=c,this._drawTextBox(e,i,r,n,new Vt(t.PdfTextAlignment.center),a,o),i.bounds[0]=i.bounds[0]+c,i.borderWidth&&e.drawLine(i.borderPen,i.bounds[0],i.bounds[1],i.bounds[0],i.bounds[1]+i.bounds[3])}}else this._drawTextBox(e,i,r,n,s,a,o)}else this._drawTextBox(e,i,r,n,s,a,o);else{e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),i.insertSpaces||this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());var l=i.bounds;if(i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.inset?(l[0]=l[0]+4*i.borderWidth,l[2]=l[2]-8*i.borderWidth):(l[0]=l[0]+2*i.borderWidth,l[2]=l[2]-4*i.borderWidth),a){var u=(void 0===s||null===s||0===s.lineSpacing?n._metrics._getHeight():s.lineSpacing)-n._metrics._getAscent(s);r.indexOf("\n"),0===l[0]&&1===l[1]&&(l[1]=-(l[1]-u)),i.isAutoFontSize&&0!==i.borderWidth&&(l[1]=l[1]+2.5*i.borderWidth)}if(e._page&&void 0!==e._page.rotation&&e._page.rotation!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var f=e.save();if(void 0!==i.pageRotationAngle&&i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(e._size[1],0),e.rotateTransform(90);var g=e._size[1]-(l[0]+l[2]);l=[b=l[1],g,l[3],l[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180),l=[b=e._size[0]-(l[0]+l[2]),g=e._size[1]-(l[1]+l[3]),l[2],l[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,e._size[0]),e.rotateTransform(270),l=[b=e._size[0]-(l[1]+l[3]),g=l[0],l[3],l[2]]);if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),l=[b=e._size[1]-(l[1]+l[3]),g=l[0],l[3],l[2]];else if(l[2]>l[3])e.translateTransform(0,e._size[1]),e.rotateTransform(-90),l=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]];else{var y=l[0];l[0]=-(l[1]+l[3]),l[1]=y;var m=l[3];l[3]=l[2]>n._metrics._getHeight()?l[2]:n._metrics._getHeight(),l[2]=m,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),l=[b=l[1],g=e._size[0]-(l[0]+l[2]),l[3],l[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var b=e._size[0]-(l[0]+l[2]);l=[b,g=e._size[1]-(l[1]+l[3]),l[2],l[3]]}e.drawString(r,n,l,null,i.foreBrush,s),e.restore(f)}else e.drawString(r,n,l,null,i.foreBrush,s);e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())}},i}(ri),si=function(e){function i(t,i,r){var n=e.call(this)||this;return t&&i&&r&&n._initialize(t,i,r),n}return ii(i,e),Object.defineProperty(i.prototype,"actions",{get:function(){return this._actions||(this._actions=new ei(this)),this._actions},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){if(this._isLoaded){if(void 0===this._text){var t=this.itemAt(this._defaultIndex);t&&t._mkDictionary&&t._mkDictionary.has("CA")?this._text=t._mkDictionary.get("CA"):this._mkDictionary&&this._mkDictionary.has("CA")&&(this._text=this._mkDictionary.get("CA"))}if(void 0===this._text){var e=T(this._dictionary,"V",!1,!0);e&&(this._text=e)}}return void 0===this._text&&(this._text=""),this._text},set:function(t){if(this._isLoaded&&!this.readOnly&&((e=this.itemAt(this._defaultIndex))&&e._dictionary?this._assignText(e._dictionary,t):this._assignText(this._dictionary,t)),!this._isLoaded&&this._text!==t){var e=this.itemAt(this._defaultIndex);this._assignText(e._dictionary,t),this._text=t}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){var e,i=this.itemAt(this._defaultIndex);return i&&void 0!==i.highlightMode?e=i.highlightMode:this._dictionary.has("H")&&(e=V(this._dictionary.get("H").name)),void 0!==e?e:t.PdfHighlightMode.invert},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&V(this._dictionary.get("H"))===t||this._dictionary.update("H",j(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Ae&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._assignText=function(t,e){var i;t.has("MK")?i=t.get("MK"):(i=new Tr(this._crossReference),t.set("MK",i)),i.update("CA",e),t._updated=!0},i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},i.prototype._initialize=function(e,i,r){this._crossReference=e._crossReference,this._page=e,this._name=i,this._defaultIndex=0,this._dictionary=new Tr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Sr.get("Btn")),this._dictionary.update("T",i),this._fieldFlags|=t._FieldFlag.pushButton,this._initializeFont(this._defaultFont),this._createItem(r)},i.prototype._createItem=function(e){var i=new ji;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new Vt(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new Tr(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[.827451,.827451,.827451]),i._mkDictionary.update("CA",void 0!==this._name&&null!==this._name?this._name:this._actualName),this._addToKid(i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(e>0)for(i=0;i<e;i++)(r=this.itemAt(i))&&this._postProcess(t,r);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var i=0;i<e;i++){var r=this.itemAt(i);if(r&&!this._checkFieldFlag(r._dictionary)){var n=this._createAppearance(r);if(t)this._drawTemplate(n,r._getPage(),{x:r.bounds.x,y:r.bounds.y,width:n._size[0],height:n._size[1]});else{this._addAppearance(r._dictionary,n,"N");var s=this._createAppearance(r,!0);s&&this._addAppearance(r._dictionary,s,"D")}r._dictionary._updated=!t}}t&&(this._dictionary._updated=!1)}},i.prototype._postProcess=function(e,i){var r,n,s=i||this;if(this._form._setAppearance||this._setAppearance||e&&!s._dictionary.has("AP"))r=this._createAppearance(s);else if(s._dictionary.has("AP")){var a=void 0,o=s._dictionary.get("AP");if(o&&o.has("N")){a=o.get("N");var h=o.getRaw("N");h&&(a.reference=h),a&&(r=new Ze(a,this._crossReference))}}if(r)if(e){var c=s instanceof ji?s._getPage():s.page;if(c){var _=c.graphics;_.save(),c.rotation===t.PdfRotationAngle.angle90?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(90)):c.rotation===t.PdfRotationAngle.angle180?(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(-180)):c.rotation===t.PdfRotationAngle.angle270&&(_.translateTransform(_._size[0],_._size[1]),_.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size[0],height:r._size[1]},_.drawTemplate(r,n),_.restore()}s._dictionary._updated=!1}else this._addAppearance(s._dictionary,r,"N")},i.prototype._createAppearance=function(t,e){void 0===e&&(e=!1);var i=t.bounds,r=new Ze([0,0,i.width,i.height],this._crossReference),n=new Ji;n.bounds=[0,0,i.width,i.height];var s=t.backColor;s&&(n.backBrush=new Ve(s)),n.foreBrush=new Ve(t.color);var a=t.border;if(n.borderPen=new je(t.borderColor,a.width),n.borderStyle=a.style,n.borderWidth=a.width,s){var o=[s[0]-64,s[1]-64,s[2]-64],h=[o[0]>=0?o[0]:0,o[1]>=0?o[1]:0,o[2]>=0?o[2]:0];n.shadowBrush=new Ve(h)}return n.rotationAngle=t.rotate,void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),e?this._drawPressedButton(r.graphics,n,this.text,this._font,this._stringFormat):this._drawButton(r.graphics,n,this.text,this._font,this._stringFormat),r},i.prototype._drawButton=function(e,i,r,n,s){this._drawRectangularControl(e,i);var a=i.bounds;if(e._page&&void 0!==e._page.rotation&&e._page.rotation!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var o=e.save();if(void 0!==i.pageRotationAngle&&i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform(e._size[1],0),e.rotateTransform(90);var h=e._size[1]-(a[0]+a[2]);a=[d=a[1],h,a[3],a[2]]}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180),a=[d=e._size[0]-(a[0]+a[2]),h=e._size[1]-(a[1]+a[3]),a[2],a[3]]):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform(0,e._size[0]),e.rotateTransform(270),a=[d=e._size[0]-(a[1]+a[3]),h=a[0],a[3],a[2]]);if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),a=[d=e._size[1]-(a[1]+a[3]),h=a[0],a[3],a[2]];else if(a[2]>a[3])e.translateTransform(0,e._size[1]),e.rotateTransform(-90),a=[i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3]];else{var c=a[0];a[0]=-(a[1]+a[3]),a[1]=c;var _=a[3];a[3]=a[2]>n._metrics._getHeight()?a[2]:n._metrics._getHeight(),a[2]=_,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),a=[d=a[1],h=e._size[0]-(a[0]+a[2]),a[3],a[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var d=e._size[0]-(a[0]+a[2]);a=[d,h=e._size[1]-(a[1]+a[3]),a[2],a[3]]}e.drawString(r,n,a,null,i.foreBrush,s),e.restore(o)}else e.drawString(r,n,a,null,i.foreBrush,s)},i.prototype._drawPressedButton=function(e,i,r,n,s){switch(i.borderStyle){case t.PdfBorderStyle.inset:e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.shadowBrush);break;default:e.drawRectangle(i.bounds[0],i.bounds[1],i.bounds[2],i.bounds[3],i.backBrush)}this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth);var a=[i.borderWidth,i.borderWidth,i.bounds[2]-i.borderWidth,i.bounds[3]-i.borderWidth];switch(e.drawString(r,n,a,null,i.foreBrush,s),i.borderStyle){case t.PdfBorderStyle.inset:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,this._grayBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._silverBrush);break;case t.PdfBorderStyle.beveled:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush),this._drawRightBottomShadow(e,i.bounds,i.borderWidth,this._whiteBrush);break;default:this._drawLeftTopShadow(e,i.bounds,i.borderWidth,i.shadowBrush)}},i}(ri),ai=function(e){function i(t,i,r){var n=e.call(this)||this;return r&&t&&i&&n._initialize(r,t,i),n}return ii(i,e),i._load=function(t,e,r,n){var s=new i;if(s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._defaultIndex=0,s._parsedItems=new Map,s._dictionary.has("Kids"))s._kids=s._dictionary.get("Kids");else{var a=zi._load(e,r,s);a._isLoaded=!0,a._ref=n,s._parsedItems.set(0,a)}return s},i.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e;if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0;if(t>=0&&this._kids&&this._kids.length>0&&t<this._kids.length){var r=this._kids[Number.parseInt(t.toString(),10)];r&&r instanceof Pr&&(i=this._crossReference._fetch(r)),i&&((e=zi._load(i,this._crossReference,this))._isLoaded=!0,e._ref=r,this._parsedItems.set(t,e))}}return e},Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Ae&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"checked",{get:function(){return this._kidsCount>0?this.itemAt(this._defaultIndex).checked:J(this._dictionary)},set:function(t){if(this.checked!==t){if(this._kidsCount>0&&(this.itemAt(this._defaultIndex).checked=t),t)if(this._isLoaded){var e=Q(this._kidsCount>0?this.itemAt(this._defaultIndex)._dictionary:this._dictionary);this._dictionary.update("V",Sr.get(e)),this._dictionary.update("AS",Sr.get(e))}else this._dictionary.update("V",Sr.get("Yes")),this._dictionary.update("AS",Sr.get("Yes"));else this._dictionary.has("V")&&delete this._dictionary._map.V,this._dictionary.has("AS")&&delete this._dictionary._map.AS;this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._defaultIndex=0,this._dictionary=new Tr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Sr.get("Btn")),this._dictionary.update("T",e),this._createItem(i)},i.prototype._createItem=function(e){var i=new zi;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new Vt(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new Tr(this._crossReference)),i._mkDictionary.update("BC",[0,0,0]),i._mkDictionary.update("BG",[1,1,1]),i.style=t.PdfCheckBoxStyle.check,i._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),this._addToKid(i)},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=this._kidsCount;if(this._isLoaded)if(i>0){for(a=0;a<i;a++)if(o=this.itemAt(a)){if(!this._checkFieldFlag(o._dictionary))if(e){var r=void 0,n=o.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;r=this._setAppearance||this._form._setAppearance||!o._dictionary.has("AP")?this._createAppearance(o,n):Y(n,o),this._drawTemplate(r,o._getPage(),o.bounds)}else(this._setAppearance||this._form._setAppearance||!o._isLoaded)&&(o._postProcess(o.checked?"Yes":"Off"),this._drawAppearance(o));o._dictionary._updated=!e}}else{var s=this.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;this._drawTemplate(Y(s,this),this.page,this.bounds)}else for(var a=0;a<i;a++){var o=this.itemAt(a);if(o){n=o.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;if(o._postProcess(o.checked?"Yes":"Off"),e){r=this._createAppearance(o,n);this._drawTemplate(r,o._getPage(),o.bounds)}else this._drawAppearance(o);o._dictionary._updated=!e}}this._dictionary._updated=!e},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Ji;r.bounds=[0,0,i.width,i.height];var n=t.backColor;n&&(r.backBrush=new Ve(n)),r.foreBrush=new Ve(t.color);var s=t.border;if(r.borderPen=new je(t.borderColor,s.width),r.borderStyle=s.style,r.borderWidth=s.width,n){var a=[n[0]-64,n[1]-64,n[2]-64],o=[a[0]>=0?a[0]:0,a[1]>=0?a[1]:0,a[2]>=0?a[2]:0];r.shadowBrush=new Ve(o)}r.rotationAngle=t.rotate;var h=new Ze(r.bounds,this._crossReference),c=h.graphics;return this._drawCheckBox(c,r,tt(t._style),e),h},i.prototype._drawAppearance=function(e){var i=new Tr;if(e._dictionary.has("AP"))(i=e._dictionary.get("AP"))&&(i.has("N")&&At(i.get("N"),this._crossReference,"Yes","Off"),i.has("D")&&At(i.get("D"),this._crossReference,"Yes","Off")),wt(i,this._crossReference,"N"),wt(i,this._crossReference,"D");else{var r=this._crossReference._getNextReference();i=new Tr(this._crossReference),this._crossReference._cacheMap.set(r,i),e._dictionary.update("AP",r)}var n=this._createAppearance(e,t._PdfCheckFieldState.checked),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n._content);var a=this._createAppearance(e,t._PdfCheckFieldState.unchecked),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a._content);var h=new Tr(this._crossReference);h.update("Yes",s),h.update("Off",o);var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,h),i.update("N",c);var _=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,_._content);var p=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),l=this._crossReference._getNextReference();this._crossReference._cacheMap.set(l,p._content);var u=new Tr(this._crossReference);u.update("Yes",d),u.update("Off",l);var f=this._crossReference._getNextReference();this._crossReference._cacheMap.set(f,u),i.update("D",f),e._dictionary._updated=!0},i}(ri),oi=function(e){function i(t,i){var r=e.call(this)||this;return r._selectedIndex=-1,t&&i&&r._initialize(t,i),r}return ii(i,e),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},Object.defineProperty(i.prototype,"checked",{get:function(){var t=!1;return this._kidsCount>0&&(t=this.itemAt(this._defaultIndex).checked),t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedIndex",{get:function(){return this._isLoaded&&-1===this._selectedIndex&&(this._selectedIndex=this._obtainSelectedIndex()),this._selectedIndex},set:function(t){if(this.selectedIndex!==t){this._selectedIndex=t;for(var e=0;e<this._kidsCount;e++){var i=this.itemAt(e);if(e===t){i._dictionary.update("AS",Sr.get(i.value));var r=Sr.get(i.value);this._dictionary.update("V",r),this._dictionary.update("DV",r)}else i._dictionary.update("AS",Sr.get("Off"))}}},enumerable:!0,configurable:!0}),i.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e;if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{var i=void 0;if(t>=0&&this._kids&&this._kids.length>0&&t<this._kids.length){var r=this._kids[Number.parseInt(t.toString(),10)];r&&r instanceof Pr&&(i=this._crossReference._fetch(r)),i&&((e=Ui._load(i,this._crossReference,this))._ref=r,e._index=t,this._parsedItems.set(t,e))}}return e},i.prototype.add=function(t,e){return t instanceof Ui?(t._field=this,t._dictionary.update("Parent",this._ref),t._setField(this),this._kidsCount):new Ui(t,e,this)},i.prototype.removeItemAt=function(t){var e=this.itemAt(t);if(e&&e._ref){var i=e._getPage();if(i&&i._removeAnnotation(e._ref),this._kids.splice(t,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(t),this._parsedItems.size>0){var r=new Map;this._parsedItems.forEach(function(e,i){i>t?r.set(i-1,e):r.set(i,e)}),this._parsedItems=r}if(this._dictionary.has("Opt")){var n=this._dictionary.getArray("Opt");n&&n.length>0&&(n.splice(t,1),this._dictionary.set("Opt",n))}}},i.prototype.removeItem=function(t){if(t&&t._ref){var e=this._kids.indexOf(t._ref);-1!==e&&this.removeItemAt(e)}},i.prototype._initialize=function(e,i){this._defaultIndex=0,this._crossReference=e._crossReference,this._page=e,this._name=i,this._dictionary=new Tr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Sr.get("Btn")),this._dictionary.update("T",i),this._parsedItems=new Map,this._fieldFlags|=t._FieldFlag.radio},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._kidsCount,i=t.length<=e?t.length:e,r=0;r<i;r++)t[Number.parseInt(r.toString(),10)]&&(this.itemAt(r)._optionValue=t[Number.parseInt(r.toString(),10)])}},i.prototype._obtainSelectedIndex=function(){for(var t=-1,e=0;e<this._kidsCount;++e){var i=this.itemAt(e);if(i){var r=T(i._dictionary,"V",!1,!0);if(r&&i._dictionary.has("AS")){var n=i._dictionary.get("AS");if(n&&"off"!==n.name.toLowerCase())if(r instanceof Sr&&"off"!==r.name.toLowerCase()){if(n.name===r.name||i._optionValue===r.name){t=e;break}}else if("string"==typeof r&&"off"!==r.toLowerCase()&&(n.name===r||i._optionValue===r)){t=e;break}}}}return t},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=this._kidsCount;if(this._isLoaded)if(i>0){for(a=0;a<i;a++)if((o=this.itemAt(a))&&!this._checkFieldFlag(o._dictionary)){if(e){var r=void 0,n=this.selectedIndex===a?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;r=this._setAppearance||this._form._setAppearance||!o._dictionary.has("AP")?this._createAppearance(o,n):Y(n,o),this._drawTemplate(r,o._getPage(),o.bounds)}else(this._setAppearance||this._form._setAppearance||!o._isLoaded)&&(o._postProcess(this.selectedIndex===a?o.value:"Off"),this._drawAppearance(o));o._dictionary._updated=!e}}else{var s=-1!==this.selectedIndex?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;this._drawTemplate(Y(s,this),this.page,this.bounds)}else for(var a=0;a<i;a++){var o=this.itemAt(a),n=this.selectedIndex===a?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;if(o._dictionary.update("AS",Sr.get(this.selectedIndex===a?o.value:"Off")),e){r=this._createAppearance(o,n);this._drawTemplate(r,o._getPage(),o.bounds)}else o._postProcess(this.selectedIndex===a?o.value:"Off"),this._drawAppearance(o);o._dictionary._updated=!e}this._dictionary._updated=!e},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Ji;r.bounds=[0,0,i.width,i.height];var n=t.backColor;n&&(r.backBrush=new Ve(n)),r.foreBrush=new Ve(t.color);var s=t.border;if(r.borderPen=new je(t.borderColor,s.width),r.borderStyle=s.style,r.borderWidth=s.width,n){var a=[n[0]-64,n[1]-64,n[2]-64],o=[a[0]>=0?a[0]:0,a[1]>=0?a[1]:0,a[2]>=0?a[2]:0];r.shadowBrush=new Ve(o)}r.rotationAngle=t.rotate;var h=new Ze(r.bounds,this._crossReference),c=h.graphics;return this._drawRadioButton(c,r,tt(t.style),e),h},i.prototype._drawAppearance=function(e){var i=new Tr;if(e._dictionary.has("AP"))(i=e._dictionary.get("AP"))&&(i.has("N")&&At(i.get("N"),this._crossReference,e.value,"Off"),i.has("D")&&At(i.get("D"),this._crossReference,e.value,"Off")),wt(i,this._crossReference,"N"),wt(i,this._crossReference,"D");else{var r=this._crossReference._getNextReference();i=new Tr(this._crossReference),this._crossReference._cacheMap.set(r,i),e._dictionary.update("AP",r)}var n=this._createAppearance(e,t._PdfCheckFieldState.checked),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n._content);var a=this._createAppearance(e,t._PdfCheckFieldState.unchecked),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a._content);var h=new Tr(this._crossReference);h.update(e.value,s),h.update("Off",o);var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,h),i.update("N",c);var _=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,_._content);var p=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),l=this._crossReference._getNextReference();this._crossReference._cacheMap.set(l,p._content);var u=new Tr(this._crossReference);u.update(e.value,d),u.update("Off",l);var f=this._crossReference._getNextReference();this._crossReference._cacheMap.set(f,u),i.update("D",f),e._dictionary._updated=!0},i}(ri),hi=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ii(i,e),Object.defineProperty(i.prototype,"itemsCount",{get:function(){return this._options.length},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary.has("Rect")&&(t=N(this._dictionary,this.page)),t||(this._bounds?this._bounds:t)},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded?void 0===e||this._dictionary.has("Rect")?this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t):e?(e._page=this.page,e.bounds=t):this._bounds=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedIndex",{get:function(){var t=this._dictionary.get("I");return void 0===t?[]:1===t.length?t[0]:t},set:function(t){var e=this,i=this._options.length;if("number"==typeof t)this._checkIndex(t,i),this._dictionary.update("I",[t]),this._dictionary.update("V",[this._options[Number.parseInt(t.toString(),10)][0]]);else{var r=[];t.forEach(function(t){e._checkIndex(t,i),r.push(e._options[Number.parseInt(t.toString(),10)][0])}),this._dictionary.update("I",t),this._dictionary.update("V",r)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedValue",{get:function(){var t=this,e=[];if(this._dictionary.has("V")&&void 0!==(i=this._dictionary.getArray("V"))&&(Array.isArray(i)?i.forEach(function(t){e.push(t)}):"string"==typeof i&&e.push(i)),0===e.length&&this._dictionary.has("I")){var i=this._dictionary.get("I");i&&i.length>0&&i.forEach(function(i){e.push(t._options[Number.parseInt(i.toString(),10)][0])})}return 1===e.length?e[0]:e},set:function(t){var e=this;if("string"==typeof t){var i=this._tryGetIndex(t);-1!==i&&(this._dictionary.update("I",[i]),this._dictionary.update("V",[t]))}else{var r=[],n=[];t.forEach(function(t){var i=e._tryGetIndex(t);-1!==i&&(n.push(i),r.push(t))}),r.length>0&&(this._dictionary.update("I",n),this._dictionary.update("V",r))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"multiSelect",{get:function(){return this._isLoaded?0!=(this._fieldFlags&t._FieldFlag.multiSelect):this._multiSelect},set:function(e){this.multiSelect!==e&&(this._multiSelect=e,e?this._fieldFlags|=t._FieldFlag.multiSelect:this._fieldFlags&=~t._FieldFlag.multiSelect)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"editable",{get:function(){return this._isLoaded?0!=(this._fieldFlags&t._FieldFlag.edit):this._editable},set:function(e){this._editable!==e&&(this._editable=e,e?this._fieldFlags|=t._FieldFlag.edit:this._fieldFlags&=~t._FieldFlag.edit)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(this._font)return this._font;var t=this.itemAt(this._defaultIndex);return this._font=xt(this._form,t,this),this._font},set:function(t){t&&t instanceof Ae&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_options",{get:function(){return this._optionArray||(this._dictionary.has("Opt")?this._optionArray=this._dictionary.getArray("Opt"):(this._optionArray=[],this._dictionary.update("Opt",this._optionArray))),this._optionArray},enumerable:!0,configurable:!0}),i.prototype.itemAt=function(t){var e;if(t<this._kidsCount)if(this._parsedItems.has(t))e=this._parsedItems.get(t);else{i=void 0;(r=this._kids[Number.parseInt(t.toString(),10)])&&r instanceof Pr&&(i=this._crossReference._fetch(r)),i&&((e=Wi._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[Number.parseInt(t.toString(),10)][1]:e._text="",this._parsedItems.set(t,e))}else if(this._parsedItems.has(t))e=this._parsedItems.get(t);else if(this._kidsCount>0&&this._kids&&this._kids.length>0){var i=void 0,r=void 0;(r=1===this._kidsCount?this._kids[0]:this._kids[Number.parseInt(t.toString(),10)])&&r instanceof Pr&&(i=this._crossReference._fetch(r)),i&&((e=Wi._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[Number.parseInt(t.toString(),10)][1]:e._text="",this._parsedItems.set(t,e))}return e},i.prototype.addItem=function(t){return this._addToOptions(t,this),this._listValues.length-1},i.prototype.removeItemAt=function(t){var e=this.itemAt(t);if(e&&e._ref){if(this._parsedItems.delete(t),this._parsedItems.size>0){var i=new Map;this._parsedItems.forEach(function(e,r){r>t?i.set(r-1,e):i.set(r,e)}),this._parsedItems=i}if(this._dictionary.has("Opt")){var r=this._options;r&&r.length>0&&(r.splice(t,1),this._dictionary.set("Opt",r),this._optionArray=r,this._dictionary._updated=!0)}}},i.prototype.removeItem=function(t){if(t&&t.text){for(var e=void 0,i=0;i<this.itemsCount;i++){var r=this.itemAt(i);if(r&&t===r&&r.text===t.text){e=i;break}}-1!==e&&this.removeItemAt(e)}},i.prototype._initialize=function(t,e,i){this._defaultIndex=0,this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new Tr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Sr.get("Ch")),this._dictionary.update("T",e),this._parsedItems=new Map,this._listValues=[],this._kids=[],this.bounds=i,this._addEmptyWidget()},i.prototype._obtainFont=function(e){var i="",r=1;if(e&&(e._dictionary.has("DS")||e._dictionary.has("DA"))){if(e._dictionary.has("DS"))for(var n=e._dictionary.get("DS").split(";"),s=0;s<n.length;s++){var a=n[Number.parseInt(s.toString(),10)].split(":");if(-1!==n[Number.parseInt(s.toString(),10)].indexOf("font-family"))i=a[1];else if(-1!==n[Number.parseInt(s.toString(),10)].indexOf("font-size"))a[1].endsWith("pt")&&(r=Number.parseFloat(a[1].replace("pt","")));else if(-1===n[Number.parseInt(s.toString(),10)].indexOf("font-style")&&-1!==n[Number.parseInt(s.toString(),10)].indexOf("font")){for(var o=a[1].split(" "),h=0;h<o.length;h++)""===o[Number.parseInt(h.toString(),10)]||o[Number.parseInt(h.toString(),10)].endsWith("pt")||(i+=o[Number.parseInt(h.toString(),10)]+" "),o[Number.parseInt(h.toString(),10)].endsWith("pt")&&(r=Number.parseFloat(o[Number.parseInt(h.toString(),10)].replace("pt","")));for(;" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-2);-1!==i.indexOf(",")&&(i=i.split(",")[0])}}else{var c=e._dictionary.get("DA");if(c&&""!==c&&-1!==c.indexOf("Tf")){for(var _=c.split(" "),s=0;s<_.length;s++)if(-1!==_[Number.parseInt(s.toString(),10)].indexOf("Tf")){for(i=_[s-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);r=Number.parseFloat(_[s-1])}var d=0;if(0===r){var p=new ke(t.PdfFontFamily.helvetica,d);null!==p&&(d=this._getFontHeight(p._fontFamily),(Number.isNaN(d)||0===d)&&(d=12),p._size=d,r=d)}}}switch(i=i.trim()){case"Helv":this._font=new ke(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular);break;case"Courier":case"Cour":this._font=new ke(t.PdfFontFamily.courier,r,t.PdfFontStyle.regular);break;case"Symb":this._font=new ke(t.PdfFontFamily.symbol,r,t.PdfFontStyle.regular);break;case"TiRo":this._font=new ke(t.PdfFontFamily.timesRoman,r,t.PdfFontStyle.regular);break;case"ZaDb":this._font=new ke(t.PdfFontFamily.zapfDingbats,r,t.PdfFontStyle.regular);break;default:this._font=new ke(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular)}}return this._font},i.prototype._obtainSelectedValue=function(){var t=this,e=[];if(this._dictionary.has("V")){var i=this._dictionary.get("V"),r=this._dictionary.getArray("V");null!==i&&void 0!==i&&("string"==typeof i?e.push(i):Array.isArray(i)&&r.forEach(function(t){e.push(t)}))}else{var n=this._dictionary.get("I");null!==n&&void 0!==n&&n.length>0&&n[0]>-1&&this._options&&this._options.length>0&&n.forEach(function(i){e.push(t._options[Number.parseInt(i.toString(),10)][0])})}return e},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._kids&&this._kids.length>0)if(e>1){for(var i=0;i<e;i++)if((r=this.itemAt(i))&&!this._checkFieldFlag(r._dictionary)){n=this._createAppearance(r);t?(s=r._getPage())&&this._drawTemplate(n,s,r.bounds):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}}else{var r=this.itemAt(0),n=this._createAppearance();t?(s=this.page)&&this._drawTemplate(n,s,this.bounds):this._addAppearance(r._dictionary,n,"N"),r._dictionary._updated=!t}else if(this._dictionary){n=this._createAppearance();if(t){var s=this.page;s&&this._drawTemplate(n,s,this.bounds)}else this._addAppearance(this._dictionary,n,"N")}this._dictionary._updated=!t}},i.prototype._tryGetIndex=function(t){var e=-1;if(this._options&&this._options.length>0)for(var i=0;i<this._options.length;i++)if(t===this._options[Number.parseInt(i.toString(),10)][0]){e=i;break}return e},i.prototype._addEmptyWidget=function(){var t=new ji;t._create(this._page,this.bounds,this),this._addToKid(t),t._dictionary.update("MK",new Tr(this._crossReference)),t._mkDictionary.update("BC",[0,0,0]),t._mkDictionary.update("BG",[1,1,1]),t._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg")},i}(ri),ci=function(e){function i(i,r,n){var s=e.call(this)||this;return i&&r&&n&&(s._initialize(i,r,n),s._fieldFlags|=t._FieldFlag.combo),s}return ii(i,e),Object.defineProperty(i.prototype,"_isAutoFontSize",{get:function(){var t=!1;if(this._isLoaded&&this._form){var e=this._form._dictionary;if(e&&e.has("DA")){var i=e.get("DA");if(i){var r=new pi(i);if(0===r.fontSize)if(this._kids&&this._kids.length>0){var n=!1;if(this._dictionary.has("DA")&&(i=this._dictionary.get("DA"))&&(r=new pi(i))&&r.fontSize>0&&(n=!0),!n)for(var s=0;s<this._kids.length;s++){var a=void 0,o=this._kids[Number.parseInt(s.toString(),10)];if(o&&o instanceof Pr&&(a=this._crossReference._fetch(o)),a)if(a.has("DA")){h=0;(i=a.get("DA"))&&(r=new pi(i))&&(h=r.fontSize),0===h&&(t=!0)}else t=!0}}else if(this._dictionary.has("DA")){var h=0;(i=this._dictionary.get("DA"))&&(r=new pi(i))&&(h=r.fontSize),0===h&&(t=!0)}else t=!0}}}return t},enumerable:!0,configurable:!0}),i._load=function(t,e,r,n){var s=new i;s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids"));var a=s._dictionary.getArray("Opt");return null!==a&&void 0!==a&&(s._listValues=new Array(a.length)),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._kidsCount,i=t.length<=e?t.length:e,r=0;r<i;r++){var n=t[Number.parseInt(r.toString(),10)][1];n&&(this.itemAt(r)._text=n||"")}}},i.prototype._createAppearance=function(e){var i=new Ji;if(e){var r=e.bounds,n=e._getPage();e._isLoaded&&n&&void 0!==n.rotation&&n.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],n.size,n.rotation):i.bounds=[0,0,r.width,r.height],(o=e.backColor)&&(i.backBrush=new Ve(o)),i.foreBrush=new Ve(e.color);h=e.border;if(i.borderPen=new je(e.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){_=[(c=[o[0]-64,o[1]-64,o[2]-64])[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ve(_)}i.rotationAngle=e.rotate;var s=void 0!==e.textAlignment?e.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Vt(s,a)}else{(r=this.bounds)&&(this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],this.page.size,this.page.rotation):i.bounds=[0,0,r.width,r.height]);var o=this.backColor;o&&(i.backBrush=new Ve(o)),i.foreBrush=new Ve(this.color);var h=this.border;if(i.borderPen=new je(this.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ve(_)}i.rotationAngle=this.rotationAngle;var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Vt(s,a)}i.required=this.required,null!==i.bounds&&void 0!==i.bounds||(i.bounds=[0,0,0,0]);var d=new Ze(i.bounds,this._crossReference),p=d.graphics;if(p._sw._clear(),this.required||(p._sw._beginMarkupSequence("Tx"),p._initializeCoordinates()),this._isLoaded){var l=void 0;e&&(l=this._obtainFont(e)),void 0!==l&&null!==l||(l=this._appearanceFont),this._drawComboBox(p,i,l,i.stringFormat)}else this._font||(this._font=new ke(t.PdfFontFamily.timesRoman,this._getFontHeight(t.PdfFontFamily.helvetica))),this._drawComboBox(p,i,this._font,i.stringFormat);return this.required||p._sw._endMarkupSequence(),d},i.prototype._drawComboBox=function(e,i,r,n){e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());var s=this._options,a=this._dictionary.get("I"),o=-1;if(a&&a.length>0&&(o=a[0]),o>=0&&o<s.length){var h=s[Number.parseInt(o.toString(),10)],c=[0,0],_=i.borderWidth,d=2*_,p=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;p?(c[0]=2*d,c[1]=2*_):(c[0]=d+2,c[1]=1*_+1);var l=i.foreBrush,u=i.bounds,f=u[2]-d,g=u;if(g[3]-=p?d:_,e.setClip(g,t.PdfFillMode.winding),0===i.rotationAngle){w=u[0]+_;p&&(w+=_,f-=d),l=new Ve([153,193,218]),e.drawRectangle(w,c[1],f,u[3],l),l=new Ve([0,0,0])}var y=void 0;if(y=h&&Array.isArray(h)?h[1]?h[1]:h[0]:h){var m=[c[0],c[1],f-c[0],u[3]];if(i.rotationAngle>0){var b=e.save();if(90===i.rotationAngle)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),g=[e._size[1]-(g[1]+g[3]),S=g[0],g[3]+g[2],g[2]];else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),g=[g[1],S=e._size[0]-(g[0]+g[2]),g[3]+g[2],g[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var v=e._size[0]-(g[0]+g[2]),S=e._size[1]-(g[1]+g[3]);g=[v,S,g[2],g[3]]}var w=u[0]+_;p&&(w+=_,f-=d),l=new Ve([153,193,218]),e.drawRectangle(w,c[1],f,u[3],l),l=new Ve([0,0,0]),e.drawString(y,r,m,null,l,n),e.restore(b)}else e.drawString(y,r,m,null,l,n)}}e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())},i.prototype._getFontHeight=function(e){var i,r,n,s,a,o=this._dictionary.get("I"),h=this.border.width;if(this._isLoaded){r=new ke(e,12),n=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),s=this._dictionary.getArray("Opt"),a=this.bounds;var c=[];if(o&&o.length>0)o.forEach(function(t){c.push(r.measureString(s[Number.parseInt(t.toString(),10)][1],[0,0],n,0,0)[0])});else if(s.length>0)for(var _=r.measureString(s[0][1],[0,0],n,0,0)[0],d=1;d<s.length;++d){f=r.measureString(s[Number.parseInt(d.toString(),10)][1],[0,0],n,0,0)[0];_=Math.max(_,f),c.push(_)}i=c.length>0?12*(a.width-4*h)/c.sort()[c.length-1]:12}else{if(i=0,!(o&&o.length>0))return i;r=new ke(e,12),n=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),s=this._dictionary.getArray("Opt");f=r.measureString(s[o[0]][1],[0,0],n,0,0)[0];a=this.bounds,i=f?12*(a.width-4*h)/f:12}var p=0;if(o&&o.length>0){if(12!==i){r=new ke(e,i);var l=s[o[0]][1],u=r.measureString(l,[0,0],n,0,0);if(u[0]>a.width||u[1]>a.height)for(var f=a.width-4*h,g=a.height-4*h,d=1;d<=a.height;d++){r._size=d;var y=r.measureString(l,[0,0],n,0,0);if(y[0]>a.width||y[1]>g){p=d;do{p-=.001,r._size=p;var m=r.getLineWidth(l,n);if(p<.248){r._size=.248;break}if(y=r.measureString(l,[0,0],n,0,0),m<f&&y[1]<g){r._size=p;break}}while(p>.248);i=p;break}}}}else i>12&&(i=12);return i},i}(hi),_i=function(e){function i(t,i,r){var n=e.call(this)||this;return t&&i&&r&&n._initialize(t,i,r),n}return ii(i,e),i._load=function(t,e,r,n){var s=new i;s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids"));var a=s._dictionary.getArray("Opt");return null!==a&&void 0!==a&&(s._listValues=new Array(a.length)),s._defaultIndex=0,s._parsedItems=new Map,s._kidsCount>0&&s._retrieveOptionValue(),s},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&t.length>0)for(var e=this._dictionary.get("I"),i=0;i<t.length;i++)void 0!==e&&null!==e?(this._listValues[Number.parseInt(i.toString(),10)]=t[Number.parseInt(i.toString(),10)][1],i===e?(this.itemAt(i)._text=this._listValues[Number.parseInt(i.toString(),10)],this._selectedIndex=i):this.itemAt(i)._text=this._listValues[Number.parseInt(i.toString(),10)]):this.itemAt(i)._text=""}},i.prototype._createAppearance=function(e){var i=new Ji;if(e){var r=e.bounds,n=e._getPage();e._isLoaded&&n&&void 0!==n.rotation&&n.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],n.size,n.rotation):i.bounds=[0,0,r.width,r.height],(o=e.backColor)&&(i.backBrush=new Ve(o)),i.foreBrush=new Ve(e.color);h=e.border;if(i.borderPen=new je(e.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){_=[(c=[o[0]-64,o[1]-64,o[2]-64])[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ve(_)}i.rotationAngle=e.rotate;var s=void 0!==e.textAlignment?e.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Vt(s,a)}else{r=this.bounds;this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==t.PdfRotationAngle.angle0?i.bounds=this._rotateTextBox([r.x,r.y,r.width,r.height],this.page.size,this.page.rotation):i.bounds=[0,0,r.width,r.height];var o=this.backColor;o&&(i.backBrush=new Ve(o)),i.foreBrush=new Ve(this.color);var h=this.border;if(i.borderPen=new je(this.borderColor,h.width),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o[0]-64,o[1]-64,o[2]-64],_=[c[0]>=0?c[0]:0,c[1]>=0?c[1]:0,c[2]>=0?c[2]:0];i.shadowBrush=new Ve(_)}i.rotationAngle=this.rotationAngle;var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Vt(s,a)}i.required=this.required;var d=new Ze(i.bounds,this._crossReference),p=d.graphics;if(p._sw._clear(),this.required||(p._sw._beginMarkupSequence("Tx"),p._initializeCoordinates()),this._isLoaded){var l=this._obtainFont(e);(void 0===l||null===l||!this._isLoaded&&1===l.size)&&(l=this._appearanceFont),this._drawListBox(p,i,l,i.stringFormat)}else this._font||(this._font=this._defaultItemFont),this._drawListBox(p,i,this._font,i.stringFormat);return this.required||p._sw._endMarkupSequence(),d},i.prototype._drawListBox=function(e,i,r,n){e._isTemplateGraphics&&i.required&&(e.save(),e._initializeCoordinates()),this._drawRectangularControl(e,i),e._isTemplateGraphics&&i.required&&(e.restore(),e.save(),e._sw._beginMarkupSequence("Tx"),e._initializeCoordinates());for(var s=this._options,a=this,o=0;o<s.length;++o)!function(o){var h=s[Number.parseInt(o.toString(),10)],c=[],_=i.borderWidth,d=2*_,p=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;p?(c.push(2*d),c.push((o+2)*_+r._metrics._getHeight()*o)):(c.push(d+2),c.push((o+1)*_+r._metrics._getHeight()*o+1));var l=i.foreBrush,u=i.bounds,f=u[2]-d,g=u;g[3]-=p?d:_,e.setClip(g,t.PdfFillMode.winding);var y=!1,m=a._dictionary.get("I");if(null!==m&&void 0!==m&&m.length>0&&m.forEach(function(t){y=y||t===o}),0===i.rotationAngle&&y){w=u[0]+_;p&&(w+=_,f-=d),l=new Ve([153,193,218]),e.drawRectangle(w,c[1],f,r._metrics._getHeight(),l),l=new Ve([0,0,0])}var b=h[1]?h[1]:h[0],v=[c[0],c[1],f-c[0],r._metrics._getHeight()];if(i.rotationAngle>0){var S=e.save();if(90===i.rotationAngle)e.translateTransform(0,e._size[1]),e.rotateTransform(-90),g=[w=e._size[1]-(g[1]+g[3]),P=g[0],g[3]+g[2],g[2]];else if(270===i.rotationAngle)e.translateTransform(e._size[0],0),e.rotateTransform(-270),g=[w=g[1],P=e._size[0]-(g[0]+g[2]),g[3]+g[2],g[2]];else if(180===i.rotationAngle){e.translateTransform(e._size[0],e._size[1]),e.rotateTransform(-180);var w=e._size[0]-(g[0]+g[2]),P=e._size[1]-(g[1]+g[3]);g=[w,P,g[2],g[3]]}if(y){w=u[0]+_;p&&(w+=_,f-=d),l=new Ve([153,193,218]),e.drawRectangle(w,c[1],f,r._metrics._getHeight(),l),l=new Ve([0,0,0])}e.drawString(b,r,v,null,l,n),e.restore(S)}else e.drawString(b,r,v,null,l,n)}(o);e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())},i.prototype._getFontHeight=function(e){var i=new ke(e,12,t.PdfFontStyle.regular),r=new Vt(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),n=0;if(this._listValues.length>0){for(var s=i.measureString(this._listValues[0],[0,0],r,0,0)[0],a=1;a<this._listValues.length;++a){var o=i.measureString(this._listValues[Number.parseInt(a.toString(),10)],[0,0],r,0,0)[0];s=s>o?s:o}n=(n=12*(this.bounds.width-4*this.border.width)/s)>12?12:n}return n},i}(hi),di=function(e){function i(t,i,r){var n=e.call(this)||this;return n._isSigned=!1,t&&i&&r&&n._initialize(t,i,r),n}return ii(i,e),Object.defineProperty(i.prototype,"isSigned",{get:function(){return this._isSigned||this._checkSigned(),this._isSigned},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i._load=function(t,e,r,n){var s=new i;return s._isLoaded=!0,s._form=t,s._dictionary=e,s._crossReference=r,s._ref=n,s._dictionary.has("Kids")&&(s._kids=s._dictionary.get("Kids")),s._defaultIndex=0,s._parsedItems=new Map,s},i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new Tr(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",Sr.get("Sig")),this._dictionary.update("T",e),this._defaultIndex=0,this._initializeFont(this._defaultFont),this._createItem(i)},i.prototype._createItem=function(t){var e=new ji;e._create(this._page,t,this),e._dictionary.update("MK",new Tr(this._crossReference)),e._mkDictionary.update("BC",[0,0,0]),e._mkDictionary.update("BG",[1,1,1]),e._dictionary.update("DA",this._fontName+" 8 Tf 0 0 0 rg"),this._addToKid(e)},i.prototype._doPostProcess=function(t){void 0===t&&(t=!1);var e=this._setAppearance||this._form._setAppearance;if(!this._isLoaded&&(t||e)&&(r=this._kidsCount)>0)for(s=0;s<r;s++)if((a=this.itemAt(s))&&a._dictionary&&(e||t&&!a._dictionary.has("AP"))){var i=this._createAppearance(a,t);this._addAppearance(a._dictionary,i,"N")}if(t){var r=this._kidsCount;if(r>0)for(var n=void 0,s=0;s<r;s++){var a=this.itemAt(s);if(a&&a._dictionary){var o=a._getPage();o&&(n||0!==s||(n=this._getItemTemplate(a._dictionary)),this._flattenSignature(a._dictionary,o,a.bounds,n))}}else this._flattenSignature(this._dictionary,this.page,this.bounds)}},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Ze([0,0,i.width,i.height],this._crossReference);$(r,null),r._writeTransformation=!1;var n=r.graphics,s=new Ji;s.bounds=[0,0,i.width,i.height];var a=t.backColor;e&&a&&(s.backBrush=new Ve(a)),s.foreBrush=new Ve(t.color);var o=t.border;if(s.borderPen=new je(t.borderColor,o.width),s.borderStyle=o.style,s.borderWidth=o.width,a){var h=[a[0]-64,a[1]-64,a[2]-64],c=[h[0]>=0?h[0]:0,h[1]>=0?h[1]:0,h[2]>=0?h[2]:0];s.shadowBrush=new Ve(c)}return s.rotationAngle=t.rotate,n.save(),n._initializeCoordinates(),this._drawRectangularControl(n,s),n.restore(),r},i.prototype._flattenSignature=function(e,i,r,n){var s;if(e.has("AP")){var a=e.get("AP");if(a&&a.has("N")){var o=a.get("N"),h=a.getRaw("N");if(h&&o&&(o.reference=h),o&&(s=n||new Ze(o,this._crossReference))&&i){_=(c=i.graphics).save();i.rotation!==t.PdfRotationAngle.angle0?c.drawTemplate(s,this._calculateTemplateBounds(r,i,s,c)):c.drawTemplate(s,r),c.restore(_)}}}else if(n&&i){s=n;var c=i.graphics,_=c.save();i.rotation!==t.PdfRotationAngle.angle0?c.drawTemplate(s,this._calculateTemplateBounds(r,i,s,c)):c.drawTemplate(s,r),c.restore(_)}},i.prototype._calculateTemplateBounds=function(t,e,i,r){var n=t.x,s=t.y;if(e){var a=this._obtainGraphicsRotation(r._matrix);90===a?(r.translateTransform(i._size[1],0),r.rotateTransform(90),n=t.x,s=-(e._size[1]-t.y-t.height)):180===a?(r.translateTransform(i._size[0],i._size[1]),r.rotateTransform(180),n=-(e._size[0]-(t.x+i._size[0])),s=-(e._size[1]-t.y-i._size[1])):270===a&&(r.translateTransform(0,i._size[0]),r.rotateTransform(270),n=-(e._size[0]-t.x-t.width),s=t.y)}return{x:n,y:s,width:t.width,height:t.height}},i.prototype._obtainGraphicsRotation=function(t){var e=Math.round(180*Math.atan2(t._matrix._elements[2],t._matrix._elements[0])/Math.PI);switch(e){case-90:e=90;break;case-180:e=180;break;case 90:e=270}return e},i.prototype._getItemTemplate=function(t){var e;if(t.has("AP")){var i=t.get("AP");if(i&&i.has("N")){var r=i.get("N"),n=i.getRaw("N");n&&(r.reference=n),r&&(e=new Ze(r,this._crossReference))}}return e},i.prototype._checkSigned=function(){if(this._dictionary&&this._dictionary.has("V")){var t=this._dictionary.get("V");null!==t&&void 0!==t&&t.size>0&&(this._isSigned=!0)}},i}(ri),pi=function(){function t(t){var e,i="",r=0;if(t&&"string"==typeof t&&""!==t)for(var n=t.split(" "),s=0;s<n.length;s++)switch(n[Number.parseInt(s.toString(),10)]){case"g":e=[Number.parseFloat(n[s-1])];break;case"rg":e=[Number.parseFloat(n[s-3]),Number.parseFloat(n[s-2]),Number.parseFloat(n[s-1])];break;case"k":e=[Number.parseFloat(n[s-4]),Number.parseFloat(n[s-3]),Number.parseFloat(n[s-2]),Number.parseFloat(n[s-1])];break;case"Tf":r=Number.parseFloat(n[s-1]),(i=n[s-2].substring(1)).includes("#2C")&&i.replace("#2C",",")}this.fontName=i,this.fontSize=r,this.color=void 0!==e?L(e):[0,0,0]}return t.prototype.toString=function(){var t=[Number.parseFloat((this.color[0]/255).toFixed(3)),Number.parseFloat((this.color[1]/255).toFixed(3)),Number.parseFloat((this.color[2]/255).toFixed(3))];return"/"+this.fontName+" "+this.fontSize+" Tf "+t[0].toString()+" "+t[1].toString()+" "+t[2].toString()+" rg"},t}(),li=function(){function t(t,e){this._dictionary=new Tr,this._annotations=t,this._crossReference=t._crossReference,void 0!==e&&(this._bounds=e),this._initialize()}return Object.defineProperty(t.prototype,"normal",{get:function(){return!this._templateNormal&&this._dictionary.has("AP")&&(this._templateNormal=this._dictionary.get("N")),this._templateNormal},set:function(t){t&&(this._templateNormal=t,this._dictionary.set("N",this._templateNormal))},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this.normal=new Ze(this._bounds,this._crossReference)},t}(),ui=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),fi=function(){function e(){this._isImported=!1,this._isLoaded=!1,this._setAppearance=!1,this._isExport=!1,this._opacity=1,this._isAllRotation=!0,this._flatten=!1,this._hasData=!1,this._popUpFont=new ke(t.PdfFontFamily.helvetica,10.5),this._authorBoldFont=new ke(t.PdfFontFamily.helvetica,10.5,t.PdfFontStyle.bold),this._lineCaptionFont=new ke(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._circleCaptionFont=new ke(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular),this._isTransparentColor=!1}return Object.defineProperty(e.prototype,"author",{get:function(){if(void 0===this._author&&this._dictionary.has("Author")&&(t=this._dictionary.get("Author"))&&(this._author=t),void 0===this._author&&this._dictionary.has("T")){var t=this._dictionary.get("T");t&&(this._author=t)}return this._author},set:function(t){if(this._isLoaded&&"string"==typeof t&&t!==this.author){var e=!1;this._dictionary.has("T")&&(this._dictionary.update("T",t),this._author=t,e=!0),this._dictionary.has("Author")&&(this._dictionary.update("Author",t),this._author=t,e=!0),e||(this._dictionary.update("T",t),this._author=t)}this._isLoaded||"string"!=typeof t||this._dictionary.update("T",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){if(void 0===this._border){var e=new qi;if(e._dictionary=this._dictionary,this._dictionary.has("Border")&&(i=this._dictionary.getArray("Border"))&&i.length>=3&&(e._hRadius=i[0],e._vRadius=i[1],e._width=i[2]),this._dictionary.has("BS")){var i=this._dictionary.get("BS");if(i){if(i.has("W")){var r=i.get("W");void 0===r||Number.isNaN(r)||(e._width=r)}if(i.has("S")){var n=i.get("S");if(n)switch(n.name){case"D":e._style=t.PdfBorderStyle.dashed;break;case"B":e._style=t.PdfBorderStyle.beveled;break;case"I":e._style=t.PdfBorderStyle.inset;break;case"U":e._style=t.PdfBorderStyle.underline;break;default:e._style=t.PdfBorderStyle.solid}}if(i.has("D")){var s=i.getArray("D");s&&(e._dash=s)}}}this._border=e}return this._border},set:function(t){var e,i=this.border;(!this._isLoaded||void 0!==t.width&&i.width!==t.width)&&(e=t.width);var r;(!this._isLoaded||void 0!==t.hRadius&&i.hRadius!==t.hRadius)&&(r=t.hRadius);var n;(!this._isLoaded||void 0!==t.vRadius&&i.vRadius!==t.vRadius)&&(n=t.vRadius);var s;(!this._isLoaded||void 0!==t.style&&i.style!==t.style)&&(s=t.style);var a;if(void 0!==t.dash&&i.dash!==t.dash&&(a=t.dash),!this._isWidget&&(this._dictionary.has("Border")||e||n||r)&&(this._border._hRadius=void 0!==r?r:i.hRadius,this._border._vRadius=void 0!==n?n:i.vRadius,this._border._width=void 0!==e?e:i.width,this._dictionary.update("Border",[this._border.hRadius,this._border.vRadius,this._border.width])),this._dictionary.has("BS")||e||s||a){this._border._width=void 0!==e?e:i.width,this._border._style=void 0!==s?s:i.style,this._border._dash=void 0!==a?a:i.dash;var o=this._dictionary.has("BS")?this._dictionary.get("BS"):new Tr(this._crossReference);o.update("Type",Sr.get("Border")),o.update("W",this._border.width),o.update("S",M(this._border.style)),void 0!==this._border.dash&&o.update("D",this._border.dash),this._dictionary.update("BS",o),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return void 0===this._annotFlags&&(this._annotFlags=t.PdfAnnotationFlag.default,this._dictionary.has("F")&&(this._annotFlags=this._dictionary.get("F"))),this._annotFlags},set:function(t){void 0!==t&&t!==this._annotFlags&&(this._annotFlags=t,this._dictionary.update("F",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return void 0===this._color&&this._dictionary.has("C")&&(this._color=L(this._dictionary.getArray("C"))),this._color},set:function(t){if(void 0!==t&&3===t.length){var e=this.color;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._color=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(7)),Number.parseFloat((t[1]/255).toFixed(7)),Number.parseFloat((t[2]/255).toFixed(7))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"innerColor",{get:function(){return void 0===this._innerColor&&this._dictionary.has("IC")&&(this._innerColor=L(this._dictionary.getArray("IC"))),this._innerColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.innerColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._innerColor=t,this._dictionary.update("IC",[Number.parseFloat((t[0]/255).toFixed(7)),Number.parseFloat((t[1]/255).toFixed(7)),Number.parseFloat((t[2]/255).toFixed(7))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"creationDate",{get:function(){if((void 0===this._creationDate||null===this._creationDate)&&this._dictionary.has("CreationDate")){var t=this._dictionary.get("CreationDate");null!==t&&"string"==typeof t&&(this._creationDate=this._stringToDate(t))}return this._creationDate},set:function(t){this._creationDate=t,this._dictionary.update("CreationDate",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modifiedDate",{get:function(){if(void 0===this._modifiedDate||null===this._modifiedDate){var t=void 0;this._dictionary.has("ModDate")?t=this._dictionary.get("ModDate"):this._dictionary.has("M")&&(t=this._dictionary.get("M")),null!==t&&"string"==typeof t&&(this._modifiedDate=this._stringToDate(t))}return this._modifiedDate},set:function(t){this._modifiedDate=t,this._dictionary.update("M",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return this._isLoaded&&(this._bounds=N(this._dictionary,this._page)),this._bounds},set:function(t){if(t)if(this._isBounds=!0,this._isLoaded){if(t.x!==this.bounds.x||t.y!==this.bounds.y||t.width!==this.bounds.width||t.height!==this.bounds.height){var e=this._page.size;if(e){var i=e[1]-(t.y+t.height),r=i+t.height;this._dictionary.update("Rect",[t.x,i,t.x+t.width,r]),this._bounds=t}}}else this._bounds=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"caption",{get:function(){if(void 0===this._caption){var e=new Hi;if(e._dictionary=this._dictionary,this._dictionary.has("Cap")&&(e._cap=this._dictionary.get("Cap")),this._dictionary.has("CP")){var i=this._dictionary.get("CP");i&&(e._type="Top"===i.name?t.PdfLineCaptionType.top:t.PdfLineCaptionType.inline)}this._dictionary.has("CO")&&(e._offset=this._dictionary.getArray("CO")),this._caption=e}return this._caption},set:function(t){var e=this.caption;t&&(this._isLoaded&&t.cap===e.cap||(this._caption.cap=t.cap),this._isLoaded&&t.type===e.type||(this._caption.type=t.type),this._isLoaded&&t.offset===e.offset||(this._caption.offset=t.offset))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"opacity",{get:function(){if(this._dictionary.has("CA")){var t=this._dictionary.get("CA");void 0!==t&&(this._opacity=t)}return this._opacity},set:function(t){void 0===t||Number.isNaN(t)||(t>=0&&t<=1?(this._dictionary.update("CA",t),this._opacity=t):t<0?this._dictionary.update("CA",0):this._dictionary.update("CA",1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subject",{get:function(){return void 0===this._subject&&(this._subject=this._dictionary.get("Subject","Subj")),this._subject},set:function(t){if("string"==typeof t){var e=!1;this._dictionary.has("Subj")&&(this._dictionary.update("Subj",t),this._subject=t,e=!0),e&&!this._dictionary.has("Subject")||(this._dictionary.update("Subject",t),this._subject=t)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return void 0===this._name&&this._dictionary.has("NM")&&(this._name=this._dictionary.get("NM")),this._name},set:function(t){"string"==typeof t&&(this._dictionary.update("NM",t),this._name=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return void 0===this._text&&this._dictionary.has("Contents")&&(this._text=this._dictionary.get("Contents")),this._text},set:function(t){"string"==typeof t&&(this._text=this._dictionary.get("Contents"),t!==this._text&&(this._dictionary.update("Contents",t),this._text=t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){return void 0===this._rotate&&this._dictionary.has("Rotate")&&(this._rotate=this._dictionary.get("Rotate")/90),null!==this._rotate&&void 0!==this._rotate||(this._rotate=t.PdfRotationAngle.angle0),this._rotate},set:function(t){var e=this.rotationAngle;void 0!==t&&void 0!==e&&(t=(t+e)%4),this._dictionary.update("Rotate",90*t),this._rotate=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){var t=this._getRotationAngle();return t<0&&(t=360+t),t>=360&&(t=360-t),t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flattenPopups",{get:function(){return this._isFlattenPopups},set:function(t){void 0!==t&&(this._isFlattenPopups=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_hasFlags",{get:function(){return this._dictionary.has("F")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_degreeToRadian",{get:function(){return void 0===this._ratio&&(this._ratio=Math.PI/180),this._ratio},enumerable:!0,configurable:!0}),e.prototype.setAppearance=function(t){this._setAppearance=t,t&&(this._dictionary._updated=!0)},e.prototype.getValues=function(t){var e=[];if(!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(Array.isArray(i)){i=this._dictionary.getArray(t);for(var r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];n instanceof Sr?e.push(n.name):"string"==typeof n?e.push(n):"number"==typeof n&&e.push(n.toString())}}else if(i instanceof Sr)e.push(i.name);else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e.push(i)}return e},e.prototype.setValues=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},e.prototype._initialize=function(t,e){this._page=t,this._crossReference=t._crossReference,e&&(this._dictionary=e),this._isLoaded||(this._dictionary.set("P",this._page._ref),this._dictionary.assignXref(this._crossReference))},e.prototype._getRotationAngle=function(){var t=0;return this._dictionary.has("Rotate")?t=this._dictionary.get("Rotate"):this._dictionary.has("Rotation")&&(t=this._dictionary.get("Rotation")),t},e.prototype._getBoundsValue=function(t){var e=t.length,i=[],r=[];if(t&&e>0){for(var n=[],s=0;s<t.length;s++){var a=t[Number.parseInt(s.toString(),10)];n.push(a)}for(var o=0,h=0,s=0;s<n.length;s++)s%2==0?(i[Number.parseInt(o.toString(),10)]=n[Number.parseInt(s.toString(),10)],o++):(r[Number.parseInt(h.toString(),10)]=n[Number.parseInt(s.toString(),10)],h++)}return i.sort(function(t,e){return t>e?1:-1}),r.sort(function(t,e){return t>e?1:-1}),{x:i[0],y:r[0],width:i[i.length-1]-i[0],height:r[r.length-1]-r[0]}},e.prototype._validateTemplateMatrix=function(t,e){var i=!1,r=!0;if(null===e||void 0===e){if(t&&t.has("Matrix")){if((d=t.getArray("Matrix"))&&d.length>3&&void 0!==d[0]&&void 0!==d[1]&&void 0!==d[2]&&void 0!==d[3]&&1===d[0]&&0===d[1]&&0===d[2]&&1===d[3]){i=!0;var n=0,s=0,a=0,o=0;d.length>4&&(a=-d[4],d.length>5&&(o=-d[5]));var h=void 0;this._dictionary.has("Rect")&&(h=this._dictionary.getArray("Rect"))&&h.length>1&&(n=h[0],s=h[1]),n===a&&s===o||0!==a||0!==o||(this._locationDisplaced=!0)}}else i=!0;return i}var c=this.bounds;if(t&&t.has("Matrix")){var _=t.getArray("BBox"),d=t.getArray("Matrix");if(d&&_&&d.length>3&&_.length>2&&void 0!==d[0]&&void 0!==d[1]&&void 0!==d[2]&&void 0!==d[3]&&1===d[0]&&0===d[1]&&0===d[2]&&1===d[3]&&void 0!==_[0]&&void 0!==_[1]&&void 0!==_[2]&&void 0!==_[3]&&(_[0]!==-d[4]&&_[1]!==-d[5]||0===_[0]&&0==-d[4])){var p=this._page.graphics,l=p.save();void 0!==this.opacity&&this._opacity<1&&p.setTransparency(this._opacity),c.x-=_[0],c.y+=_[1],p.drawTemplate(e,c),p.restore(l),this._removeAnnotationFromPage(this._page,this),r=!1}}return r},e.prototype._flattenAnnotationTemplate=function(e,i){var r=this._page.graphics,n=this.bounds;if(this._type===t._PdfAnnotationType.lineAnnotation&&!this._dictionary.has("AP"))if(n=this._isLoaded?this._bounds:C([this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]),this._page){var s=this._page.size,a=this._page.mediaBox,o=this._page.cropBox;o&&Array.isArray(o)&&4===o.length&&this._page._pageDictionary.has("CropBox")&&!this._isLoaded?0===o[0]&&0===o[1]&&s[0]!==o[2]&&s[1]!==o[3]||n.x===o[0]?n.y=s[1]-(n.y+n.height):(n.x-=o[0],n.y=o[3]-(n.y+n.height)):a&&Array.isArray(a)&&4===a.length&&this._page._pageDictionary.has("MediaBox")&&!this._isLoaded?a[0]>0||a[1]>0||s[0]===a[2]||s[1]===a[3]?(n.x-=a[0],n.y=a[3]-(n.y+n.height)):n.y=s[1]-(n.y+n.height):this._isLoaded||(n.y=s[1]-(n.y+n.height))}else n.y=n.y+n.height;if(void 0!==n&&null!==n){var h=r.save();if(this._page._needInitializeGraphics=!0,this._type===t._PdfAnnotationType.rubberStampAnnotation){y=!0;if(this._dictionary.has("AP")){var c=this._dictionary.get("AP");if(c&&c.has("N")){var _=c.get("N");this.rotate===t.PdfRotationAngle.angle270&&this._page.rotation===t.PdfRotationAngle.angle270&&_.dictionary.has("Matrix")&&(u=_.dictionary.getArray("Matrix"))&&6===u.length&&0===u[4]&&0!==u[5]&&(y=!1)}!i&&this.rotate!==t.PdfRotationAngle.angle180&&y&&(e._isAnnotationTemplate=!0,e._needScale=!0)}}i||this._type===t._PdfAnnotationType.rubberStampAnnotation||(e._isAnnotationTemplate=!0,e._needScale=!0),void 0!==this.opacity&&this._opacity<1&&r.setTransparency(this._opacity);var d=this._calculateTemplateBounds(n,this._page,e,i,r);if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var p,s=void 0;this.rotate===t.PdfRotationAngle.angle0?(s=[d.width,d.height],p=[d.x,d.y]):(s=e._size,p=[d.x,d.y]);var l=!1;if(this.rotate!==t.PdfRotationAngle.angle0&&e._content&&e._content.dictionary.has("Matrix")){var u=e._content.dictionary.getArray("Matrix");u&&6===u.length&&0===u[4]&&0!==u[5]&&(l=!0)}var f=e._size[0]>0?d.width/e._size[0]:1,g=e._size[1]>0?d.height/e._size[1]:1,y=!(1===f&&1===g);this.rotate!==t.PdfRotationAngle.angle0&&l&&(this.rotate===t.PdfRotationAngle.angle90?this._page.rotation===t.PdfRotationAngle.angle270?!y||0===d.x&&0===d.y?(p[0]+=s[1],p[1]+=s[0]-s[1]+(s[0]-s[1])):(p[0]+=s[0]-s[1],p[1]+=s[0]):y||(p[0]+=s[1]):this.rotate===t.PdfRotationAngle.angle270?this._page.rotation===t.PdfRotationAngle.angle270?y&&e._isAnnotationTemplate?p[1]=d.y-d.width:y&&(p[1]+=s[0]-s[1]):y||0===d.x&&0===d.y?p[1]+=-(s[0]-s[1]):p[1]+=-s[0]:this.rotate===t.PdfRotationAngle.angle180&&(p[0]+=s[0],p[1]+=-s[1]))}r.drawTemplate(e,d),r.restore(h)}this._removeAnnotationFromPage(this._page,this)},e.prototype._calculateTemplateBounds=function(e,i,r,n,s){var a=e,o=e.x,h=e.y,c=e.width,_=e.height;if(!n){var d=this._dictionary.getArray("Rect");d&&(a=C(d))}if(void 0!==i){var p=this._obtainGraphicsRotation(s._matrix);if(90===p)s.translateTransform(r._size[1],0),s.rotateTransform(90),n||void 0!==this._rotate&&this._rotate===t.PdfRotationAngle.angle180?(o=e.x,h=this._locationDisplaced?i._origin&&0!==i._o[1]?e.y+e.height:-(i.size[1]-(e.height+e.y)+(e.height-r._size[1])):-(i.size[1]-e.y-e.height)):(o=e.x,h=-(i.size[1]-(e.height+e.y)+(e.width-r._size[1])),c=e.height,_=e.width);else if(180===p)s.translateTransform(r._size[0],r._size[1]),s.rotateTransform(180),n?(o=-(i.size[0]-(e.x+e.width)),h=-(i.size[1]-e.y-e.height)):(o=-(i.size[0]-(e.x+r._size[0])),h=-(i.size[1]-e.y-r._size[1]),void 0===this.rotationAngle||this._rotate!==t.PdfRotationAngle.angle90&&this._rotate!==t.PdfRotationAngle.angle270||(h=-(i.size[1]-e.y-r._size[1])-(e.width-e.height),c=e.height,_=e.width));else if(270===p)if(s.translateTransform(0,r._size[0]),s.rotateTransform(270),n||void 0!==this.rotationAngle&&this._rotate===t.PdfRotationAngle.angle180)o=-(i.size[0]-e.x-e.width),h=e.y;else{o=-(i.size[0]-a.x-r._size[0]);var l=r._content.dictionary.getArray("Matrix"),u=r._content.dictionary.getArray("BBox");h=l&&u&&l[5]!==u[2]?e.y-(e.height-e.width):e.y+e.height-e.width,c=e.height,_=e.width}else 0===p&&(n||void 0===this.rotationAngle||this.rotationAngle!==t.PdfRotationAngle.angle90&&this.rotationAngle!==t.PdfRotationAngle.angle270||(o=e.x,h=e.y+e.height-e.width,c=e.height,_=e.width))}return{x:o,y:h,width:c,height:_}},e.prototype._obtainGraphicsRotation=function(t){var e=Math.atan2(t._matrix._elements[2],t._matrix._elements[0]),i=Math.round(180*e/Math.PI);switch(i){case-90:i=90;break;case-180:i=180;break;case 90:i=270}return i},e.prototype._removeAnnotationFromPage=function(t,e){var i=[];t._pageDictionary&&t._pageDictionary.has("Annots")&&(i=t._pageDictionary.get("Annots")),e._dictionary.set("P",t._ref);var r=i.indexOf(e._ref);-1!==r&&(i.splice(r,1),this._crossReference._cacheMap.has(e._ref)&&this._crossReference._cacheMap.delete(e._ref)),t._pageDictionary.set("Annots",i)},e.prototype._removeAnnotation=function(t,e){t&&e&&(this._removeAnnotationFromPage(t,e),t._pageDictionary._updated=!0)},e.prototype._drawCloudStyle=function(t,e,i,r,n,s,a){if(this._isClockWise(s)){for(var o=[],h=s.length-1;h>=0;h--)o.push(s[Number.parseInt(h.toString(),10)]);s=o}for(var c=[],_=2*r*n,d=s[s.length-1],h=0;h<s.length;h++){var p=s[Number.parseInt(h.toString(),10)],l=p[0]-d[0],u=p[1]-d[1],f=Math.sqrt(l*l+u*u);l/=f,u/=f;for(var g=0;g+.1*_<f;g+=_){var y=new Qi;y.point=[d[0]+g*l,d[1]+g*u],c.push(y)}d=p}for(var m=c[c.length-1],h=0;h<c.length;h++){var b=c[Number.parseInt(h.toString(),10)],v=this._getIntersectionDegrees(m.point,b.point,r);m.endAngle=v[0],b.startAngle=v[1],m=b}for(var S=new Fe,h=0;h<c.length;h++){var w=(I=c[Number.parseInt(h.toString(),10)]).startAngle%360,P=I.endAngle%360,A=0;if(w>0&&P<0)A=180-w+(180-(P<0?-P:P));else if(w<0&&P>0)A=-w+P;else if(w>0&&P>0){A=w>P?360-(w-P):P-w}else if(w<0&&P<0){A=w>P?360-(w-P):-(w+-P)}A<0&&(A=-A),I.endAngle=A,S._addArc(I.point[0]-r,I.point[1]-r,2*r,2*r,w,A)}S._closeFigure();var k=[];if(a)for(h=0;h<S._points.length;h++)k.push([S._points[Number.parseInt(h.toString(),10)][0],-S._points[Number.parseInt(h.toString(),10)][1]]);var x;a?((x=new Fe)._points=k,x._pathTypes=S._pathTypes):((x=new Fe)._points=S._points,x._pathTypes=S._pathTypes),null!==e&&t._drawPath(x,null,e);var T=180/(3*Math.PI);S=new Fe;for(h=0;h<c.length;h++){var I=c[Number.parseInt(h.toString(),10)];S._addArc(I.point[0]-r,I.point[1]-r,2*r,2*r,I.startAngle,I.endAngle+T)}if(S._closeFigure(),k=[],a)for(h=0;h<S._points.length;h++)k.push([S._points[Number.parseInt(h.toString(),10)][0],-S._points[Number.parseInt(h.toString(),10)][1]]);a?((x=new Fe)._points=k,x._pathTypes=S._pathTypes):((x=new Fe)._points=S._points,x._pathTypes=S._pathTypes),t._drawPath(x,i,null)},e.prototype._isClockWise=function(t){for(var e=0,i=0;i<t.length;i++){var r=t[Number.parseInt(i.toString(),10)],n=t[(i+1)%t.length];e+=(n[0]-r[0])*(n[1]+r[1])}return e>0},e.prototype._getIntersectionDegrees=function(t,e,i){var r=e[0]-t[0],n=e[1]-t[1],s=.5*Math.sqrt(r*r+n*n)/i;s<-1?s=-1:s>1&&(s=1);var a=Math.atan2(n,r),o=Math.acos(s);return[(a-o)*(180/Math.PI),(Math.PI+a+o)*(180/Math.PI)]},e.prototype._obtainStyle=function(e,i,r,n){var s=this.border.dash;if(s&&s.length>0){for(var a=[],o=!1,h=0;h<s.length;h++)a[Number.parseInt(h.toString(),10)]=s[Number.parseInt(h.toString(),10)],a[Number.parseInt(h.toString(),10)]>0&&(o=!0);o&&this.border.style===t.PdfBorderStyle.dashed&&(e._dashStyle=t.PdfDashStyle.dash,e._dashPattern=a)}if(n)if(n instanceof Ji)!this._isBounds&&this._dictionary.has("RD")?(_=this._dictionary.getArray("RD"))&&(i[0]=i[0]+_[0],i[1]=i[1]+r+_[1],i[2]=i[2]-(_[0]+_[2]),i[3]=i[3]-(_[1]+_[3])):(i[0]=i[0]+r,i[1]=i[1]+r,i[2]=i[2]-this.border.width,i[3]=i[3]-this.border.width),n.bounds=i;else if(0!==n.intensity&&n.style===t.PdfBorderEffectStyle.cloudy){var c=5*n.intensity;i[0]=i[0]+c+r,i[1]=i[1]+c+r,i[2]=i[2]-2*c-2*r,i[3]=i[3]-2*c-2*r}else i[0]=i[0]+r,i[1]=i[1]+r,i[2]=i[2]-this.border.width,i[3]=this.bounds.height-this.border.width;else if(!this._isBounds&&this._dictionary.has("RD")){var _=this._dictionary.getArray("RD");_&&(i[0]=i[0]+_[0],i[1]=i[1]+r+_[1],i[2]=i[2]-2*_[2],i[3]=i[3]-this.border.width,i[3]=i[3]-2*_[3])}else i[1]=i[1]+r,i[3]=this.bounds.height-this.border.width;return i},e.prototype._createRectangleAppearance=function(e){var i=this.border.width,r=this._dictionary.getArray("RD");if(!r&&0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy){n={x:this.bounds.x-5*e.intensity-i/2,y:this.bounds.y-5*e.intensity-i/2,width:this.bounds.width+10*e.intensity+i,height:this.bounds.height+10*e.intensity+i};r=[(s=5*e.intensity)+i/2,s+i/2,s+i/2,s+i/2],this._dictionary.set("RD",r),this.bounds=n}if(!this._isBounds&&r){var n={x:this.bounds.x+r[0],y:this.bounds.y+r[1],width:this.bounds.width-2*r[2],height:this.bounds.height-2*r[3]};if(0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy){n.x=n.x-5*e.intensity-i/2,n.y=n.y-5*e.intensity-i/2,n.width=n.width+10*e.intensity+i,n.height=n.height+10*e.intensity+i;var s=5*e.intensity;this._dictionary.set("RD",[s+i/2,s+i/2,s+i/2,s+i/2])}else delete this._dictionary._map.RD;this.bounds=n}var a=i/2,o=[0,0,this.bounds.width,this.bounds.height],h=new Ze(o,this._crossReference);$(h,this._getRotationAngle()),0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy&&(h._writeTransformation=!1);var c=h.graphics,_=new Ji;this.innerColor&&(_.backBrush=new Ve(this._innerColor)),i>0&&this.color&&(_.borderPen=new je(this._color,i)),this.color&&(_.foreBrush=new Ve(this._color));var d=this._obtainStyle(_.borderPen,o,a,e);return void 0!==this.opacity&&this._opacity<1&&(c.save(),c.setTransparency(this._opacity)),0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy?this._drawRectangleAppearance(d,c,_,e.intensity):c.drawRectangle(d[0],d[1],d[2],d[3],_.borderPen,_.backBrush),void 0!==this.opacity&&this._opacity<1&&c.restore(),h},e.prototype._drawRectangleAppearance=function(t,e,i,r){var n=new Fe;n._addRectangle(t[0],t[1],t[2],t[3]);var s=4.25*r;if(s>0){for(var a=[],o=0;o<n._points.length;o++){var h=[n._points[Number.parseInt(o.toString(),10)][0],-n._points[Number.parseInt(o.toString(),10)][1]];a.push(h)}(n=new Fe)._addPolygon(a),this._drawCloudStyle(e,i.backBrush,i.borderPen,s,.833,n._points,!1)}else e.drawRectangle(t[0],t[1],t[2],t[3],i.borderPen,i.backBrush)},e.prototype._createCircleAppearance=function(){var t=[0,0,this.bounds.width,this.bounds.height],e=new Ze(t,this._crossReference);$(e,this._getRotationAngle()),this._dictionary.has("BE")&&(e._writeTransformation=!1),void 0===this.color&&(this._isTransparentColor=!0);var i=e.graphics,r=this.border.width,n=new je(this.color,r),s=new Ji;this.innerColor&&(s.backBrush=new Ve(this._innerColor)),r>0&&(s.borderPen=n),this.color&&(s.foreBrush=new Ve(this._color)),s.borderWidth=r;var a=r/2,o=this._obtainStyle(n,t,a);return void 0!==this.opacity&&this._opacity<1&&(i.save(),i.setTransparency(this._opacity)),this._dictionary.has("BE")?this._drawCircleAppearance(o,a,i,s):i.drawEllipse(o[0]+a,o[1],o[2]-r,o[3],s.borderPen,s.backBrush),void 0!==this._opacity&&this._opacity<1&&i.restore(),e},e.prototype._drawCircleAppearance=function(t,e,i,r){var n=0;if(this._dictionary.has("RD")){var s=this._dictionary.getArray("RD");s&&s.length>0&&(n=s[0])}if(n>0){var a=[t[0]+e,-t[1]-t[3],t[2]-this.border.width,t[3]],o=a[0],h=a[1],c=a[0]+a[2],_=a[1]+a[3],d=[];d.push([c,_]),d.push([o,_]),d.push([o,h]),d.push([c,h]);var p=[];p.push([c,h+a[3]/2]),p.push([o+a[2]/2,_]),p.push([o,h+a[3]/2]),p.push([o+a[2]/2,h]);var l=[];l.push([o+a[2]/2,_]),l.push([o,h+a[3]/2]),l.push([o+a[2]/2,h]),l.push([c,h+a[3]/2]);for(var u=[],f=0;f<d.length;f++)this._createBezier(p[Number.parseInt(f.toString(),10)],d[Number.parseInt(f.toString(),10)],l[Number.parseInt(f.toString(),10)],u);this._drawCloudStyle(i,r.backBrush,r.borderPen,n,.833,u,!1)}else i.drawEllipse(t[0]+e,-t[1],t[2]-this.border.width,-t[3],r.borderPen,r.backBrush)},e.prototype._createBezier=function(t,e,i,r){r.push(t),this._populateBezierPoints(t,e,i,0,r),r.push(i)},e.prototype._populateBezierPoints=function(t,e,i,r,n){if(r<2){var s=this._midPoint(t,e),a=this._midPoint(e,i),o=this._midPoint(s,a);r++,this._populateBezierPoints(t,s,o,r,n),n.push(o),this._populateBezierPoints(o,a,i,r,n)}},e.prototype._midPoint=function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]},e.prototype._getAngle=function(t){var e=t[0],i=t[1],r=t[2],n=t[3],s=0;if(r-e==0)s=n>i?90:270;else{var a=(n-i)/(r-e);s=Math.atan(a)*(180/Math.PI),(r-e<0||n-i<0)&&(s+=180),r-e>0&&n-i<0&&(s-=180),s<0&&(s+=360)}return s},e.prototype._getAxisValue=function(t,e,i){return[t[0]+Math.cos(e*this._degreeToRadian)*i,t[1]+Math.sin(e*this._degreeToRadian)*i]},e.prototype._drawLineEndStyle=function(e,i,r,n,s,a,o,h){var c,_,d,p,l,u,f,g;switch(a){case t.PdfLineEndingStyle.square:i.drawRectangle(e[0]-3*o,-(e[1]+3*o),6*o,6*o,n,s);break;case t.PdfLineEndingStyle.circle:i.drawEllipse(e[0]-3*o,-(e[1]+3*o),6*o,6*o,n,s);break;case t.PdfLineEndingStyle.openArrow:c=h?30:150,_=9*o,d=this._getAxisValue(e,r,h?o:-o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),(g=new Fe)._pen=n,g._addLine(d[0],-d[1],p[0],-p[1]),g._addLine(d[0],-d[1],l[0],-l[1]),i._stateControl(n,null,null),i._buildUpPath(g._points,g._pathTypes),i._drawGraphicsPath(n,null,g._fillMode,!1);break;case t.PdfLineEndingStyle.closedArrow:c=h?30:150,_=9*o,d=this._getAxisValue(e,r,h?o:-o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),i.drawPolygon([[d[0],-d[1]],[p[0],-p[1]],[l[0],-l[1]]],n,s);break;case t.PdfLineEndingStyle.rOpenArrow:c=h?150:30,_=9*o,d=this._getAxisValue(e,r,h?-o:o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),(g=new Fe)._pen=n,g._addLine(d[0],-d[1],p[0],-p[1]),g._addLine(d[0],-d[1],l[0],-l[1]),i._stateControl(n,null,null),i._buildUpPath(g._points,g._pathTypes),i._drawGraphicsPath(n,null,g._fillMode,!1);break;case t.PdfLineEndingStyle.rClosedArrow:c=h?150:30,_=9*o,d=this._getAxisValue(e,r,h?-o:o),p=this._getAxisValue(d,r+c,_),l=this._getAxisValue(d,r-c,_),i.drawPolygon([[d[0],-d[1]],[p[0],-p[1]],[l[0],-l[1]]],n,s);break;case t.PdfLineEndingStyle.slash:_=9*o,p=this._getAxisValue(d,r+60,_),l=this._getAxisValue(d,r-120,_),i.drawLine(n,e[0],-e[1],p[0],-p[1]),i.drawLine(n,e[0],-e[1],l[0],-l[1]);break;case t.PdfLineEndingStyle.diamond:_=3*o,p=this._getAxisValue(e,180,_),l=this._getAxisValue(e,90,_),u=this._getAxisValue(e,0,_),f=this._getAxisValue(e,-90,_),i.drawPolygon([[p[0],-p[1]],[l[0],-l[1]],[u[0],-u[1]],[f[0],-f[1]]],n,s);break;case t.PdfLineEndingStyle.butt:_=3*o,p=this._getAxisValue(e,r+90,_),l=this._getAxisValue(e,r-90,_),i.drawLine(n,p[0],-p[1],l[0],-l[1])}},e.prototype._drawLineStyle=function(t,e,i,r,n,s,a,o){0===o&&(o=1,n=null),this._drawLineEndStyle(t,i,r,n,s,a.begin,o,!0),this._drawLineEndStyle(e,i,r,n,s,a.end,o,!1)},e.prototype._obtainFontDetails=function(){var e,i="",r=t.PdfFontStyle.regular;if(this._dictionary.has("DS")||this._dictionary.has("DA")){var n=void 0;if(this._dictionary.has("DS"))for(var s=this._dictionary.get("DS").split(";"),a=0;a<s.length;a++){var o=s[Number.parseInt(a.toString(),10)].split(":");if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font-family"))i=o[1];else if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font-size"))o[1].endsWith("pt")&&(e=Number.parseFloat(o[1].replace("pt","")));else if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font-style")||-1!==s[Number.parseInt(a.toString(),10)].indexOf("style"))n=s[Number.parseInt(a.toString(),10)];else if(-1!==s[Number.parseInt(a.toString(),10)].indexOf("font")){for(var h=o[1].split(" "),c=0;c<h.length;c++)""===h[Number.parseInt(c.toString(),10)]||h[Number.parseInt(c.toString(),10)].endsWith("pt")||(i+=h[Number.parseInt(c.toString(),10)]+" "),h[Number.parseInt(c.toString(),10)].endsWith("pt")&&(e=Number.parseFloat(h[Number.parseInt(c.toString(),10)].replace("pt","")));for(;" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-1);-1!==i.indexOf(",")&&(i=i.split(",")[0])}}else{var _=this._dictionary.get("DA");if(_&&""!==_&&-1!==_.indexOf("Tf"))for(var d=_.split(" "),a=0;a<d.length;a++)if(-1!==d[Number.parseInt(a.toString(),10)].indexOf("Tf")){for(i=d[a-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);e=Number.parseFloat(d[a-1])}}if(n&&""!==n){var p=void 0;n.includes(":")?p=n.split(":"):n.includes(",")&&(p=n.split(",")),p&&p.forEach(function(e){switch(e.toLowerCase()){case"bold":r|=t.PdfFontStyle.bold;break;case"italic":r|=t.PdfFontStyle.italic;break;case"strikeout":r|=t.PdfFontStyle.strikeout;break;case"underline":r|=t.PdfFontStyle.underline}})}i&&(i=i.trim())}return{name:i,size:e,style:r}},e.prototype._obtainFont=function(){var t=this._obtainFontDetails();return It(t.name,t.size,t.style,this)},e.prototype._getEqualPdfGraphicsUnit=function(e,i){var r;switch(e){case t.PdfMeasurementUnit.inch:r=t._PdfGraphicsUnit.inch,i="in";break;case t.PdfMeasurementUnit.centimeter:r=t._PdfGraphicsUnit.centimeter,i="cm";break;case t.PdfMeasurementUnit.millimeter:r=t._PdfGraphicsUnit.millimeter,i="mm";break;case t.PdfMeasurementUnit.pica:r=t._PdfGraphicsUnit.pica,i="p";break;case t.PdfMeasurementUnit.point:r=t._PdfGraphicsUnit.point,i="pt";break;default:r=t._PdfGraphicsUnit.inch,i="in"}return{graphicsUnit:r,unitString:i}},e.prototype._createMeasureDictionary=function(t){var e=new Tr;e.set("C",1),e.set("D",100),e.set("F",Sr.get("D")),e.set("RD","."),e.set("RT",""),e.set("SS",""),e.set("U",t);var i=new Tr;i.set("C",1),i.set("D",100),i.set("F",Sr.get("D")),i.set("RD","."),i.set("RT",""),i.set("SS",""),i.set("U","sq "+t);var r=new Tr;"in"===t?r.set("C",.0138889):"cm"===t?r.set("C",.0352778):"mm"===t?r.set("C",.352778):"pt"===t?r.set("C",1):"p"===t&&r.set("C",.0833333),r.set("D",100),r.set("F",Sr.get("D")),r.set("RD","."),r.set("RT",""),r.set("SS",""),r.set("U",t);var n=new Tr;return n.set("A",[i]),n.set("D",[e]),n.set("R","1 "+t+" = 1 "+t),n.set("Type",Sr.get("Measure")),n.set("X",[r]),n},e.prototype._colorToHex=function(t){return t?"#"+this._componentToHex(t[0])+this._componentToHex(t[1])+this._componentToHex(t[2]):"#"+this._componentToHex(0)+this._componentToHex(0)+this._componentToHex(0)},e.prototype._componentToHex=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e},e.prototype._getRotatedBounds=function(t,e){if(t.width>0&&t.height>0){var i=new Me;i._rotate(e);var r=[];r.push([t.x,t.y]),r.push([t.x+t.width,t.y]),r.push([t.x+t.width,t.y+t.height]),r.push([t.x,t.y+t.height]);for(c=0;c<r.length;c++)r[Number.parseInt(c.toString(),10)]=i._matrix._transform(r[Number.parseInt(c.toString(),10)]);var n=new Fe;n._addRectangle(t.x,t.y,t.width,t.height);for(c=0;c<4;c++)n._points[Number.parseInt(c.toString(),10)]=r[Number.parseInt(c.toString(),10)];for(var s=r[0][0],a=r[3][0],o=r[0][1],h=r[3][1],c=0;c<4;c++)r[Number.parseInt(c.toString(),10)][0]<s&&(s=r[Number.parseInt(c.toString(),10)][0]),r[Number.parseInt(c.toString(),10)][0]>a&&(a=r[Number.parseInt(c.toString(),10)][0]),r[Number.parseInt(c.toString(),10)][1]<o&&(o=r[Number.parseInt(c.toString(),10)][1]),r[Number.parseInt(c.toString(),10)][1]>h&&(h=r[Number.parseInt(c.toString(),10)][1]);return{x:t.x,y:t.y,width:a-s,height:h-o}}return t},e.prototype._flattenPopUp=function(){this._flattenPop(this._page,this.color,this.bounds,this.border,this.author,this.subject,this.text)},e.prototype._flattenPop=function(e,i,r,n,s,a,o){var h=[0,0],c=r,_=[(h=e.size)[0]-180,c.y+142<h[1]?c.y:h[1]-142,180,142];if(this._dictionary.has("Popup")&&this._dictionary.get("Popup")){var d=this._dictionary.getArray("Rect");if(d&&4===d.length){var p=d[0],l=d[1];_=[p,l,d[2]-p,d[3]-l]}}void 0===i&&(i=[0,0,0]);var u=new Ve(i),f=n.width/2,g=new je([0,0,0],1),y=0,m=new Ve(this._getForeColor(i));if(void 0!==s&&null!==s&&""!==s)y=this._drawAuthor(s,a,_,u,m,e,y,n);else if(void 0!==a&&null!==a&&""!==a){v=[_[0]+f,_[1]+f,_[2]-n.width,40];this._saveGraphics(e,t.PdfBlendMode.hardLight),this._isTransparentColor?e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g):e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g,u),e.graphics.restore();var b=[v[0]+11,v[1],v[2],v[3]/2];b=[b[0],b[1]+b[3]-2,b[2],v[3]/2],this._saveGraphics(e,t.PdfBlendMode.normal),this._drawSubject(a,b,e),e.graphics.restore(),y=40}else{this._saveGraphics(e,t.PdfBlendMode.hardLight);var v=[_[0]+f,_[1]+f,_[2]-n.width,20];this._isTransparentColor?e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g):e.graphics.drawRectangle(v[0],v[1],v[2],v[3],g,u),y=20,e.graphics.restore()}var S=[_[0]+f,_[1]+f+y,_[2]-n.width,_[3]-(y+n.width)];this._saveGraphics(e,t.PdfBlendMode.hardLight),e.graphics.drawRectangle(S[0],S[1],S[2],S[3],new je([0,0,0],1),new Ve([255,255,255])),S[0]+=11,S[1]+=5,S[2]-=22,e.graphics.restore(),this._saveGraphics(e,t.PdfBlendMode.normal),void 0!==o&&null!==o&&""!==o&&e.graphics.drawString(o,this._popUpFont,S,null,new Ve([0,0,0]),null),e.graphics.restore()},e.prototype._flattenLoadedPopUp=function(){var e="";this._dictionary.has("Contents")&&(e=this._dictionary.get("Contents"));var i=this.author,r=this.subject,n=new je([0,0,0],1);if(this._dictionary.has("Popup")){var s=this._getRectangleBoundsValue();void 0===this.color&&(this.color=[0,0,0]);var a=new Ve(this.color),o=this.border.width/2,h=0,c=new Ve(this._getForeColor(this.color));if(void 0!==this.author&&null!==this.author&&""!==this.author)h=this._drawAuthor(this.author,this.subject,s,a,c,this._page,h,this.border);else if(void 0!==this.subject&&null!==this.subject&&""!==this.subject){d=[s[0]+o,s[1]+o,s[2]-this.border.width,40];this._saveGraphics(this._page,t.PdfBlendMode.hardLight),this._page.graphics.drawRectangle(d[0],d[1],d[2],d[3],n,a),this._page.graphics.restore();var _=[d[0]+11,d[1],d[2],d[3]/2];_=[_[0],_[1]+_[3]-2,_[2],d[3]/2],this._saveGraphics(this._page,t.PdfBlendMode.normal),this._drawSubject(this.subject,_,this._page),h=40,this._page.graphics.restore()}else{this._saveGraphics(this._page,t.PdfBlendMode.hardLight);var d=[s[0]+o,s[1]+o,s[2]-this.border.width,20];this._page.graphics.drawRectangle(d[0],d[1],d[2],d[3],n,a),h=20,this._page.graphics.restore()}this._saveGraphics(this._page,t.PdfBlendMode.hardLight);var p=[s[0]+o,s[1]+o+h,s[2]-this.border.width,s[3]-(h+this.border.width)];this._page.graphics.drawRectangle(p[0],p[1],p[2],p[3],n,new Ve([255,255,255])),p[0]+=11,p[1]+=5,p[2]-=22,this._page.graphics.restore(),this._saveGraphics(this._page,t.PdfBlendMode.normal),this._page.graphics.restore(),void 0!==e&&null!==e&&""!==e&&this._page.graphics.drawString(e,this._popUpFont,p,null,new Ve([0,0,0]),null),this._page.graphics.restore(),this._removeAnnotationFromPage(this._page,this)}else this._flattenPop(this._page,this.color,this.bounds,this.border,i,r,e),this._removeAnnotationFromPage(this._page,this)},e.prototype._getRectangleBoundsValue=function(){if(this._dictionary.has("Popup")){var t=this._dictionary.get("Popup").getArray("Rect");return null!==t?(null!==this._page?0===t[1]&&0===t[3]?t[1]=t[1]+t[3]:t[1]=this._page._size[1]-(t[1]+t[3]):t[1]=t[1]-t[3],t):[0,0,0,0]}return[0,0,0,0]},e.prototype._getForeColor=function(t){return(t[0]+t[1]+t[2])/3>128?[0,0,0]:[255,255,255]},e.prototype._drawAuthor=function(e,i,r,n,s,a,o,h){var c=this.border.width/2,_=new je([0,0,0],1),d=new Vt(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),p=[r[0]+c,r[1]+c,r[2]-h.width,20];if(void 0!==i&&null!==i&&""!==i){p[3]+=20,o=p[3],this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_):a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_,n),a.graphics.restore();l=[p[0]+11,p[1],p[2],p[3]/2];this._saveGraphics(this._page,t.PdfBlendMode.normal),a.graphics.drawString(e,this._authorBoldFont,l,null,s,d),l=[l[0],l[1]+l[3]-2,l[2],p[3]/2],this._drawSubject(i,l,a),a.graphics.restore()}else{this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_):a.graphics.drawRectangle(p[0],p[1],p[2],p[3],_,n),a.graphics.restore();var l=[p[0]+11,p[1],p[2],p[3]];this._saveGraphics(a,t.PdfBlendMode.normal),a.graphics.drawString(e,this._popUpFont,l,null,s,d),o=p[3],a.graphics.restore()}return o},e.prototype._drawSubject=function(e,i,r){var n=new Vt(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle);r.graphics.drawString(e,this._authorBoldFont,i,null,new Ve([0,0,0]),n)},e.prototype._saveGraphics=function(t,e){t.graphics.save(),t.graphics.setTransparency(.8,.8,e)},e.prototype._getBorderColorString=function(t){return(t[0]/255).toFixed(3)+" "+(t[1]/255).toFixed(3)+" "+(t[2]/255).toFixed(3)+" rg "},e.prototype._stringToDate=function(t){var e=new Date;if("D"===t[0]&&":"===t[1]){var i=t.substring(2,6),r=t.substring(6,8),n=t.substring(8,10),s=t.substring(10,12),a=t.substring(12,14),o=t.substring(14,16),h=0;if(23===t.length){var c=t.substring(16,22);if("+05'30'"!==c){var _=c[0],d=c.substring(1,3),p=c.substring(4,6);h=5.5-("-"===_?-1:1)*(parseInt(d,10)+parseInt(p,10)/60)}}e=new Date(i+"-"+r+"-"+n+"T"+s+":"+a+":"+o),0!==h&&e.setTime(e.getTime()+60*h*60*1e3)}else if(-1!==t.indexOf("/")){var l=t.split("/"),i=l[2].split(" ")[0];"10"!==(r=l[0])&&"11"!==r&&"12"!==r&&(r="0"+r);var n=l[1],s=l[2].split(" ")[1].split(":")[0],a=l[2].split(" ")[1].split(":")[1],o=l[2].split(" ")[1].split(":")[2];e=new Date(i+"-"+r+"-"+n+"T"+s+":"+a+":"+o)}else e=new Date(t);return e},e.prototype._dateToString=function(t){var e=(t.getMonth()+1).toString();"10"!==e&&"11"!==e&&"12"!==e&&(e="0"+e);var i=t.getDate().toString();Number.parseInt(i)<10&&(i="0"+i);var r=t.getHours().toString();Number.parseInt(r)<10&&(r="0"+r);var n=t.getMinutes().toString();Number.parseInt(n)<10&&(n="0"+n);var s=t.getSeconds().toString();return Number.parseInt(s)<10&&(s="0"+s),"D:"+t.getFullYear().toString()+e+i+r+n+s+"+05'30'"},e.prototype._obtainNativeRectangle=function(){var t,e=[this._bounds.x,this._bounds.y,this.bounds.x+this._bounds.width,this.bounds.y+this._bounds.height];if(this._page){var i=this._page.size;e[1]=i[1]-e[3];var r=this._page.cropBox;if(r&&m(r,[0,0,0,0]))t=r;else{var n=this._page.mediaBox;n&&m(n,[0,0,0,0])&&(t=n)}t&&t.length>2&&(0!==t[0]||0!==t[1])&&(e[0]+=t[0],e[1]+=t[1])}return e},e}(),gi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ui(e,t),Object.defineProperty(e.prototype,"comments",{get:function(){return this._comments?this._comments:this._comments=new Zi(this,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reviewHistory",{get:function(){return this._reviewHistory?this._reviewHistory:this._reviewHistory=new Zi(this,!0)},enumerable:!0,configurable:!0}),e}(fi),yi=function(e){function i(i){var r=e.call(this)||this;return r._unit=t.PdfMeasurementUnit.centimeter,r._unitString="",r._dictionary=new Tr,r._dictionary.update("Type",Sr.get("Annot")),r._dictionary.update("Subtype",Sr.get("Line")),void 0!==i&&(r.linePoints=i),r._type=t._PdfAnnotationType.lineAnnotation,r}return ui(i,e),Object.defineProperty(i.prototype,"linePoints",{get:function(){if(void 0===this._linePoints&&this._dictionary.has("L")){var t=this._dictionary.getArray("L");t&&(this._linePoints=t)}return this._linePoints},set:function(t){if(Array.isArray(t)&&(void 0===this._linePoints||m(t,this._linePoints))){if(4!==t.length)throw new Error("Line points length should be 4.");this._dictionary.update("L",t),this._linePoints=t}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderExt",{get:function(){if(void 0===this._leaderExt&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&(this._leaderExt=t)}return this._leaderExt},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLE",t),this._leaderExt=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderLine",{get:function(){if(void 0===this._leaderLine&&this._dictionary.has("LL")){var t=this._dictionary.get("LL");void 0!==t&&(this._leaderLine=t)}return this._leaderLine},set:function(t){Number.isNaN(t)||0===this.leaderExt||(this._dictionary.update("LL",t),this._leaderLine=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineEndingStyle",{get:function(){if(void 0===this._lineEndingStyle){var t=new Gi;if(t._dictionary=this._dictionary,this._dictionary.has("LE")){var e=this._dictionary.getArray("LE");e&&Array.isArray(e)&&(t._begin=E(e[0].name),t._end=E(e[1].name))}this._lineEndingStyle=t}return this._lineEndingStyle},set:function(t){var e=this.lineEndingStyle;e.begin===t.begin&&e.end===t.end||(e.begin=t.begin,e.end=t.end)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leaderOffset",{get:function(){if(void 0===this._leaderOffset&&this._dictionary.has("LLO")){var t=this._dictionary.get("LLO");void 0!==t&&t>=0&&(this._leaderOffset=t)}return this._leaderOffset},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLO",t),this._leaderOffset=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineIntent",{get:function(){if(void 0===this._lineIntent&&this._dictionary.has("IT")){var e=this._dictionary.get("IT");e&&(this._lineIntent="LineDimension"===e.name?t.PdfLineIntent.lineDimension:t.PdfLineIntent.lineArrow)}return this._lineIntent},set:function(e){void 0!==e&&e!==this.lineIntent&&(this._lineIntent=e,this._dictionary.update("IT",Sr.get(e===t.PdfLineIntent.lineDimension?"LineDimension":"LineArrow")))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&(this._measure=this._dictionary.has("Measure")),this._measure},set:function(t){t&&(this._isLoaded||(this._measure=t,this.caption.cap=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if((void 0===this._unit||this._isLoaded)&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.linePoints||null===this.linePoints)throw new Error("Line points cannot be null or undefined");this._dictionary.has("Cap")||this._dictionary.set("Cap",!1),this._dictionary.has("CP")||this._dictionary.set("CP",Sr.get("Inline")),this._dictionary.has("LE")||(this.lineEndingStyle=new Gi),this._dictionary.has("LL")||(this.leaderLine=0),this._dictionary.has("LLE")||(this.leaderExt=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new Tr(this._crossReference);i.set("Type",Sr.get("Border")),this._dictionary.set("BS",i)}if(void 0===e&&(e=1),this._measure)this._appearanceTemplate=this._createLineMeasureAppearance(t);else{this._setAppearance&&(this._appearanceTemplate=this._createAppearance());var r=this._obtainLineBounds(),n={x:r[0],y:r[1],width:r[2],height:r[3]};this._bounds=n;var s=void 0;s=this._page&&this._page._isNew&&this._page._pageSettings&&!this._setAppearance&&!this.flatten?Ft(this):[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height],this._dictionary.update("Rect",s)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded)(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createLineMeasureAppearance(t):this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((p=e.getRaw("N"))&&(i.reference=p),this._appearanceTemplate=new Ze(i,this._crossReference));else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");i&&((p=e.getRaw("N"))&&(i.reference=p),this._appearanceTemplate=new Ze(i,this._crossReference))}}else this._appearanceTemplate=this._createAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var r=this._appearanceTemplate._content.dictionary,n=r&&r.has("BBox")&&!r.has("CropBox")&&!r.has("MediaBox")&&!r.has("Matrix");if(this._isLoaded&&n&&this.measure&&!this._setAppearance){var s=this._page.graphics,a=s.save();void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity);var o=this.bounds,h=this._appearanceTemplate._content.dictionary.getArray("BBox");o.x-=h[0],o.y+=h[1],s.drawTemplate(this._appearanceTemplate,o),s.restore(a),this._removeAnnotationFromPage(this._page,this)}else{var c=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,c)}}if(!t&&this._setAppearance&&!this.measure){var _=void 0;if(this._dictionary.has("AP"))_=this._dictionary.get("AP");else{var d=this._crossReference._getNextReference();_=new Tr(this._crossReference),this._crossReference._cacheMap.set(d,_),this._dictionary.update("AP",d)}wt(_,this._crossReference,"N");var p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,this._appearanceTemplate._content),_.update("N",p)}},i.prototype._createLineMeasureAppearance=function(e){for(var i=[0,0,0,0],r=this._convertToUnit(),n=this._obtainLinePoints(),s=[],a=0;a<n.length;a+=2)s.push([n[Number.parseInt(a.toString(),10)],n[a+1]]);var o=new Fe;o._points=s,o._pathTypes=[0,1];var h=o._getBounds();this._bounds={x:h[0],y:h[1],width:h[2],height:h[3]};var c,_=new je(void 0!==this.color?this._color:[0,0,0],this.border.width);this.innerColor&&(c=new Ve(this._innerColor)),i=this._obtainLineBounds();var d=new Ze(i,this._crossReference);$(d,this._getRotationAngle());var p=new Ji;d._writeTransformation=!1;var l=d.graphics;p.borderPen=_,p.backBrush=c,p.foreBrush=new Ve(this.color);var u=this._obtainLinePoints(),f=this._obtainFont();if((void 0===f||null===f||!this._isLoaded&&1===f.size)&&(f=this._lineCaptionFont,this._pdfFont=f),void 0!==u&&4===u.length){var g=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),y=f.measureString(r.toFixed(2)+" "+this._unitString,[0,0],g,0,0),m=this._getAngle(this._linePoints),b=0,v=0;this.leaderLine<0?(b=-this.leaderLine,v=m+180):(b=this.leaderLine,v=m);var S=void 0!==this.leaderOffset?b+this.leaderOffset:b,w=this._getAxisValue([this._linePoints[0],this._linePoints[1]],v+90,S),P=this._getAxisValue([this._linePoints[2],this._linePoints[3]],v+90,S),A=Math.sqrt(Math.pow(P[0]-w[0],2)+Math.pow(P[1]-w[1],2)),k=A/2-(y[0]/2+this.border.width),x=this._getAxisValue(w,m,k),T=this._getAxisValue(P,m+180,k),I=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(w,m,this.border.width):w,N=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(P,m,-this.border.width):P,C=void 0;this.opacity&&this._opacity<1&&(C=l.save(),l.setTransparency(this._opacity)),this.caption.type===t.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===t.PdfLineCaptionType.inline?l.drawLine(_,I[0],-I[1],N[0],-N[1]):(l.drawLine(_,I[0],-I[1],x[0],-x[1]),l.drawLine(_,N[0],-N[1],T[0],-T[1])),this.opacity&&this._opacity<1&&l.restore(C),this._drawLineStyle(w,P,l,m,_,c,this.lineEndingStyle,this.border.width);var R=void 0!==this.leaderExt?this._leaderExt:0,F=this._getAxisValue(w,v+90,R);l.drawLine(_,w[0],-w[1],F[0],-F[1]);var B=this._getAxisValue(P,v+90,R);l.drawLine(_,P[0],-P[1],B[0],-B[1]);var L=this._getAxisValue(w,v-90,b);l.drawLine(_,w[0],-w[1],L[0],-L[1]);var M=this._getAxisValue(P,v-90,b);l.drawLine(_,P[0],-P[1],M[0],-M[1]);var D=A/2,E=this._getAxisValue(w,m,D),V=void 0,j=f._metrics._getHeight();V=this.caption.type===t.PdfLineCaptionType.top?this._getAxisValue(E,m+90,j):this._getAxisValue(E,m+90,j/2),l.translateTransform(V[0],-V[1]),l.rotateTransform(-m),l.drawString(r.toFixed(2)+" "+this._unitString,f,[-y[0]/2,0,0,0],null,p.foreBrush),l.restore()}if(void 0!==e&&!e||!this._isLoaded){d._content.dictionary._updated=!0;var z=this._crossReference._getNextReference();this._crossReference._cacheMap.set(z,d._content),d._content.reference=z;var U=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height],W=this._page.size;U[1]=W[1]-(this.bounds.y+this.bounds.height),this._isBounds&&!this.measure?(i=U,this._dictionary.update("Rect",[U[0],U[1],U[2],U[3]])):this._dictionary.update("Rect",[i[0],i[1],i[2],i[3]]);var H="font:"+f._metrics._postScriptName+" "+f._size+"pt; color:"+this._colorToHex(this.color);if(this._dictionary.update("DS",H),void 0!==e&&!e){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var G=new Tr;G.set("N",z),G._updated=!0,this._dictionary.set("AP",G);var K=this._createMeasureDictionary(this._unitString),q=this._crossReference._getNextReference();this._crossReference._cacheMap.set(q,K),K._updated=!0,this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure"),this._dictionary.update("Measure",q)}var X=[];if(X.push(Sr.get(O(this.lineEndingStyle.begin))),X.push(Sr.get(O(this.lineEndingStyle.end))),this._dictionary.update("LE",X),null===this._linePoints)throw new Error("LinePoints cannot be null");this._dictionary.update("L",this._linePoints),this._dictionary.update("C",[Number.parseFloat((this.color[0]/255).toFixed(3)),Number.parseFloat((this.color[1]/255).toFixed(3)),Number.parseFloat((this.color[2]/255).toFixed(3))]);S=this._dictionary.has("LLO")?this.leaderOffset:0;this._dictionary.update("Subtype",new Sr("Line")),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+r.toFixed(2)+" "+this._unitString):this._dictionary.update("Contents",r.toFixed(2)+" "+this._unitString),this._dictionary.update("IT",new Sr("LineDimension")),this._dictionary.update("LLE",this.leaderExt),this._dictionary.update("LLO",S),this._dictionary.update("LL",this.leaderLine),this._dictionary.update("CP",Sr.get(this.caption.type===t.PdfLineCaptionType.top?"Top":"Inline")),this._dictionary.update("Cap",this.caption.cap);var J=[i[0],i[1],i[0]+i[2],i[1]+i[3]];this._dictionary.update("Rect",J),this._bounds={x:J[0],y:J[1],width:J[2],height:J[3]}}return d},i.prototype._calculateAngle=function(t,e,i,r){return-Math.atan2(r-e,i-t)*(180/Math.PI)},i.prototype._calculateLineBounds=function(t,e,i,r,n,s){var a={x:0,y:0,width:0,height:0};if(t&&4===t.length){var o=this._getAngle(t),h=0,c=0;i<0?(h=-i,c=o+180):(h=i,c=o);var _=[t[0],t[1]],d=[t[2],t[3]];if(0!==r){var p=this._getAxisValue(_,c+90,r),l=this._getAxisValue(d,c+90,r);t[0]=p[0],t[1]=p[1],t[2]=l[0],t[3]=l[1]}var u=this._getAxisValue(_,c+90,h+r),f=this._getAxisValue(d,c+90,h+r),g=this._getAxisValue(_,c+90,e+h+r),y=this._getAxisValue(d,c+90,e+h+r),m=this._getLinePoint(n.begin,s),b=this._getLinePoint(n.end,s),v=[],S=[];c>=45&&c<=135||c>=225&&c<=315?(v[0]=m.y,S[0]=m.x,v[1]=b.y,S[1]=b.x):(v[0]=m.x,S[0]=m.y,v[1]=b.x,S[1]=b.y);var w=Math.max(v[0],v[1]),P=Math.max(S[0],S[1]);0===w&&(w=1),0===P&&(P=1),u[0]===Math.min(u[0],f[0])?(u[0]-=w*s,f[0]+=w*s,u[0]=Math.min(u[0],t[0]),u[0]=Math.min(u[0],g[0]),f[0]=Math.max(f[0],t[2]),f[0]=Math.max(f[0],y[0])):(u[0]+=w*s,f[0]-=w*s,u[0]=Math.max(u[0],t[0]),u[0]=Math.max(u[0],g[0]),f[0]=Math.min(f[0],t[2]),f[0]=Math.min(f[0],y[0])),u[1]===Math.min(u[1],f[1])?(u[1]-=P*s,f[1]+=P*s,u[1]=Math.min(u[1],t[1]),u[1]=Math.min(u[1],g[1]),f[1]=Math.max(f[1],t[3]),f[1]=Math.max(f[1],y[1])):(u[1]+=P*s,f[1]-=P*s,u[1]=Math.max(u[1],t[1]),u[1]=Math.max(u[1],g[1]),f[1]=Math.min(f[1],t[3]),f[1]=Math.min(f[1],y[1])),a=this._getBounds([{x:u[0],y:u[1]},{x:f[0],y:f[1]}])}return a},i.prototype._getLinePoint=function(e,i){var r={x:0,y:0};if(e)switch(e){case t.PdfLineEndingStyle.square:case t.PdfLineEndingStyle.circle:case t.PdfLineEndingStyle.diamond:r.x=3,r.y=3;break;case t.PdfLineEndingStyle.openArrow:case t.PdfLineEndingStyle.closedArrow:r.x=1,r.y=5;break;case t.PdfLineEndingStyle.rOpenArrow:case t.PdfLineEndingStyle.rClosedArrow:r.x=9+i/2,r.y=5+i/2;break;case t.PdfLineEndingStyle.slash:r.x=5,r.y=9;break;case t.PdfLineEndingStyle.butt:r.x=1,r.y=3;break;default:r.x=0,r.y=0}return r},i.prototype._getBounds=function(t){var e={x:0,y:0,width:0,height:0};if(t.length>0){for(var i=t[0].x,r=t[0].x,n=t[0].y,s=t[0].y,a=1;a<t.length;++a){var o=t[Number.parseInt(a.toString(),10)];i=Math.min(o.x,i),r=Math.max(o.x,r),n=Math.min(o.y,n),s=Math.max(o.y,s)}e.x=i,e.y=n,e.width=r-i,e.height=s-n}return e},i.prototype._obtainLineBounds=function(){var t=this.bounds;if(void 0!==this.linePoints&&4===this._linePoints.length){var e=this._dictionary.has("LLO")?this.leaderOffset:0,i=this._dictionary.has("LLE")?this.leaderExt:0,r=this._dictionary.has("LL")?this.leaderLine:0;t={x:(t=this._calculateLineBounds(this._linePoints,i,r,e,this.lineEndingStyle,this.border.width)).x-8,y:t.y-8,width:t.width+16,height:t.height+16}}return[t.x,t.y,t.width,t.height]},i.prototype._createAppearance=function(){var e=new Ze(this._obtainLineBounds(),this._crossReference),i=new Ji;$(e,this._getRotationAngle()),e._writeTransformation=!1;var r=e.graphics,n=new je(void 0!==this.color?this._color:[0,0,0],this.border.width);this.border.style===t.PdfBorderStyle.dashed?n._dashStyle=t.PdfDashStyle.dash:this.border.style===t.PdfBorderStyle.dot&&(n._dashStyle=t.PdfDashStyle.dot),i.borderPen=n,i.foreBrush=new Ve(this.color);var s=new Ve(void 0!==this.innerColor?this._innerColor:[0,0,0]),a=this._obtainFont();(void 0===a||null===a||!this._isLoaded&&1===a.size)&&(a=this._lineCaptionFont,this._pdfFont=a),this.text||this._dictionary.has("Contents")||(this.text=this.subject);var o=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),h=a.measureString(this.text?this.text:"",[0,0],o,0,0)[0];if(void 0!==this.linePoints&&4===this._linePoints.length){var c=this._getAngle(this._linePoints),_=0,d=0;this.leaderLine<0?(_=-this.leaderLine,d=c+180):(_=this.leaderLine,d=c);var p=void 0!==this.leaderOffset?_+this.leaderOffset:_,l=this._getAxisValue([this._linePoints[0],this._linePoints[1]],d+90,p),u=this._getAxisValue([this._linePoints[2],this._linePoints[3]],d+90,p),f=Math.sqrt(Math.pow(u[0]-l[0],2)+Math.pow(u[1]-l[1],2)),g=f/2-(h/2+this.border.width),y=this._getAxisValue(l,c,g),m=this._getAxisValue(u,c+180,g),b=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(l,c,this.border.width):l,v=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(u,c,-this.border.width):u;if(this.opacity&&this._opacity<1){var S=r.save();r.setTransparency(this._opacity),this._drawLine(r,n,b,v,y,m),r.restore(S)}else this._drawLine(r,n,b,v,y,m);this._drawLineStyle(l,u,r,c,n,s,this.lineEndingStyle,this.border.width);var w=void 0!==this.leaderExt?this._leaderExt:0,P=this._getAxisValue(l,d+90,w);r.drawLine(n,l[0],-l[1],P[0],-P[1]);var A=this._getAxisValue(u,d+90,w);r.drawLine(n,u[0],-u[1],A[0],-A[1]);var k=this._getAxisValue(l,d-90,_);r.drawLine(n,l[0],-l[1],k[0],-k[1]);var x=this._getAxisValue(u,d-90,_);r.drawLine(n,u[0],-u[1],x[0],-x[1]);var T=f/2,I=this._getAxisValue(l,c,T),N=void 0,C=a._metrics._getHeight();N=this.caption.type===t.PdfLineCaptionType.top?this._dictionary.has("Measure")?this._getAxisValue(I,c+90,2*C):this._getAxisValue(I,c+90,C):this._dictionary.has("Measure")?this._getAxisValue(I,c+90,C/2*3):this._getAxisValue(I,c+90,C/2),r.translateTransform(N[0],-N[1]),r.rotateTransform(-c),this.caption.cap&&r.drawString(this.text,a,[-h/2,0,0,0],null,i.foreBrush),r.restore();var F=this._obtainLineBounds(),B=R({x:F[0],y:F[1],width:F[2],height:F[3]});this._page._isNew&&this._page._pageSettings&&this._setAppearance&&!this.flatten&&(B=Ft(this,F)),this.bounds={x:B[0],y:B[1],width:B[2],height:B[3]},this.measure||this._dictionary.has("Measure")||this._dictionary.update("Rect",[B[0],B[1],B[2],B[3]])}return e},i.prototype._drawLine=function(e,i,r,n,s,a){void 0===this.text||""===this._text||this.caption.type===t.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===t.PdfLineCaptionType.inline?e.drawLine(i,r[0],-r[1],n[0],-n[1]):(e.drawLine(i,r[0],-r[1],s[0],-s[1]),e.drawLine(i,n[0],-n[1],a[0],-a[1]))},i.prototype._convertToUnit=function(){for(var e=this._obtainLinePoints(),i=new Array(e.length/2),r=0,n=0;n<e.length;n+=2)i[Number.parseInt(r.toString(),10)]=[e[Number.parseInt(n.toString(),10)],e[n+1]],r++;var s=Math.sqrt(Math.pow(i[1][0]-i[0][0],2)+Math.pow(i[1][1]-i[0][1],2)),a=this._getEqualPdfGraphicsUnit(this.unit,this._unitString);return this._unitString=a.unitString,(new ze)._convertUnits(s,t._PdfGraphicsUnit.point,a.graphicsUnit)},i.prototype._obtainLinePoints=function(){var t=[];if(this.linePoints)for(var e=0;e<this._linePoints.length;e++)t[Number.parseInt(e.toString(),10)]=this._linePoints[Number.parseInt(e.toString(),10)];return t},i}(gi),mi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._unit=t.PdfMeasurementUnit.centimeter,a._measureType=t.PdfCircleMeasurementType.diameter,a._unitString="",a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("Circle")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.circleAnnotation,a}return ui(i,e),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){t&&(this._isLoaded||(this._measure=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if((void 0===this._unit||this._isLoaded)&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measureType",{get:function(){if(this._dictionary.has("Contents")){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString);var i=e.substring(0,e.length-2);(new ze)._convertUnits(this.bounds.width/2,t._PdfGraphicsUnit.point,st(this._unitString)).toString()===i?this._measureType=t.PdfCircleMeasurementType.radius:this._measureType=t.PdfCircleMeasurementType.diameter}return this._measureType},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._measureType=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new Tr(this._crossReference);i.set("Type",Sr.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===e&&(e=1),this._measure?this._appearanceTemplate=this._createCircleMeasureAppearance(t):((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),this._dictionary.update("Rect",Ft(this)))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createCircleMeasureAppearance(t):this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._appearanceTemplate._content.dictionary;if(n&&n.has("BBox")&&!n.has("CropBox")&&!n.has("MediaBox")&&this.measure){var s=this._page.graphics,a=s.save();void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity);var o=this.bounds,h=this._appearanceTemplate._content.dictionary.getArray("BBox");o.x-=h[0],o.y+=h[1],s.drawTemplate(this._appearanceTemplate,o),s.restore(a),this._removeAnnotationFromPage(this._page,this)}else{var c=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,c)}}if(!t&&this._setAppearance&&!this.measure){var _=void 0;if(this._dictionary.has("AP"))_=this._dictionary.get("AP");else{var d=this._crossReference._getNextReference();_=new Tr(this._crossReference),this._crossReference._cacheMap.set(d,_),this._dictionary.update("AP",d)}wt(_,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),_.update("N",i)}},i.prototype._createCircleMeasureAppearance=function(e){var i=this.border.width,r=this._obtainFont();(void 0===r||null===r||!this._isLoaded&&1===r.size)&&(r=this._circleCaptionFont,this._pdfFont=r);var n=this._convertToUnit(),s=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),a=n.toFixed(2)+" "+this._unitString,o=r.measureString(a,[0,0],s,0,0),h=this.color?this.color:[0,0,0],c=new je(h,i),_=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height];_[1]=_[1]-_[3];var d=new Ze(_,this._crossReference),p=new Ji;d._writeTransformation=!1;var l=d.graphics,u=i/2;p.borderPen=c,this.innerColor&&(p.backBrush=new Ve(this._innerColor)),p.foreBrush=new Ve(h);var f=[_[0],-_[1]-_[3],_[2],_[3]];if(l.save(),l.drawEllipse(f[0]+u,f[1]+u,f[2]-i,f[3]-i,new je(h,this.border.width)),this._measureType===t.PdfCircleMeasurementType.diameter){l.save(),l.translateTransform(_[0],-_[1]);g=_[3]/2-o[0]/2;l.drawLine(p.borderPen,0,-_[3]/2,_[0]+_[2],-_[3]/2),l.translateTransform(g,-_[3]/2-r._metrics._getHeight()),l.drawString(n.toFixed(2)+" "+this._unitString,r,[0,0,0,0],null,p.foreBrush),l.restore()}else{l.save(),l.translateTransform(_[0],-_[1]);var g=_[2]/2+(_[2]/4-o[0]/2);l.drawLine(p.borderPen,_[2]/2,-_[3]/2,_[0]+_[2],-_[3]/2),l.translateTransform(g,-_[3]/2-r._metrics._getHeight()),l.drawString(n.toFixed(2)+" "+this._unitString,r,[0,0,0,0],null,p.foreBrush),l.restore()}if(l.restore(),void 0!==e&&!e||!this._isLoaded){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var y=new Tr;l._template._content.dictionary._updated=!0;var m=this._crossReference._getNextReference();this._crossReference._cacheMap.set(m,l._template._content),l._template._content.reference=m,y.set("N",m),y._updated=!0,this._dictionary.set("AP",y),this._dictionary.update("Rect",Ft(this)),this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure");var b=this._createMeasureDictionary(this._unitString),v=this._crossReference._getNextReference();this._crossReference._cacheMap.set(v,b),b._updated=!0,this._dictionary.update("Measure",v),this._dictionary.update("Subtype",new Sr("Circle")),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+n.toFixed(2)+" "+this._unitString):this._dictionary.update("Contents",n.toFixed(2)+" "+this._unitString);var S="font:"+r._metrics._postScriptName+" "+r._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",S)}return d},i.prototype._convertToUnit=function(){var e=new ze,i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString);this._unitString=i.unitString;var r=e._convertUnits(this.bounds.width/2,t._PdfGraphicsUnit.point,i.graphicsUnit);return this._measureType===t.PdfCircleMeasurementType.diameter&&(r*=2),r},i}(gi),bi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("Circle")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.ellipseAnnotation,a}return ui(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new Tr(this._crossReference);i.set("Type",Sr.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===e&&(e=1),(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),this._dictionary.update("Rect",Ft(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}if(!t&&this._setAppearance){var s=void 0;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{var a=this._crossReference._getNextReference();s=new Tr(this._crossReference),this._crossReference._cacheMap.set(a,s),this._dictionary.update("AP",a)}wt(s,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),s.update("N",i)}},i}(gi),vi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._unit=t.PdfMeasurementUnit.centimeter,a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("Square")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.squareAnnotation,a}return ui(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var t=new Xi;if(t._dictionary=this._dictionary,this._dictionary.has("BE")){var e=this._dictionary.get("BE");t._intensity=e.get("I"),t._style=D(e.get("S").name)}this._borderEffect=t}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){void 0!==t&&(this._isLoaded||(this._measure=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if(void 0===this._unit&&(this._unit=t.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=it(this._unitString)}return this._unit},set:function(t){this._measure&&(this._isLoaded||void 0===t||(this._unit=t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var i;if(this._dictionary.has("BS")?i=this.border.width:((r=new Tr(this._crossReference)).set("Type",Sr.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===i&&(i=1),this._measure)this._appearanceTemplate=this._createSquareMeasureAppearance(e);else if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),this._dictionary.update("Rect",Ft(this)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new Tr(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",Sr.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createSquareMeasureAppearance(t):this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect);if(void 0!==this.flattenPopups&&this.flattenPopups&&!this.measure&&(this._isLoaded&&!this._dictionary.has("Measure")?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var n=this._appearanceTemplate._content.dictionary;if(n&&n.has("BBox")&&!n.has("CropBox")&&!n.has("MediaBox")&&this.measure){var s=this._page.graphics,a=s.save();void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity);var o=this.bounds,h=this._appearanceTemplate._content.dictionary.getArray("BBox");o.x-=h[0],o.y+=h[1],s.drawTemplate(this._appearanceTemplate,o),s.restore(a),this._removeAnnotationFromPage(this._page,this)}else{var c=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,c)}}if(!t&&this._setAppearance&&!this.measure){var _=void 0;if(this._dictionary.has("AP"))_=this._dictionary.get("AP");else{var d=this._crossReference._getNextReference();_=new Tr(this._crossReference),this._crossReference._cacheMap.set(d,_),this._dictionary.update("AP",d)}wt(_,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),_.update("N",i)}},i.prototype._createSquareMeasureAppearance=function(e){var i=this.border.width,r=this._obtainFont();(void 0===r||null===r||!this._isLoaded&&1===r.size)&&(r=this._circleCaptionFont,this._pdfFont=r);var n,s=this._calculateAreaOfSquare(),a=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),o=s.toFixed(2)+" sq "+this._unitString,h=r.measureString(o,[0,0],a,0,0),c=new je(this.color,i);this.innerColor&&(n=new Ve(this._innerColor));var _=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height],d=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],p=new li(this,d);_[1]=_[1]-_[3],p.normal=new Ze(_,this._crossReference);var l=p.normal,u=new Ji;l._writeTransformation=!1;var f=p.normal.graphics,g=i/2;u.borderPen=c,u.backBrush=n,u.foreBrush=new Ve(this.color);var y=[_[0],-_[1]-_[3],_[2],_[3]];f.drawRectangle(y[0]+g,y[1]+g,y[2]-i,y[3]-i,new je(this.color,this.border.width)),f.save(),f.translateTransform(_[0],-_[1]);var m=_[2]/2-h[0]/2,b=_[3]/2-h[1]/2;if(f.translateTransform(m,-b-r._metrics._getHeight()),f.drawString(s.toFixed(2)+" sq "+this._unitString,r,[0,0,0,0],null,u.foreBrush),f.restore(),void 0!==e&&!e||!this._isLoaded){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var v=new Tr,S=f._template._content;S.dictionary._updated=!0;var w=this._crossReference._getNextReference();this._crossReference._cacheMap.set(w,S),f._template._content.reference=w,v.set("N",w),v._updated=!0,this._dictionary.set("AP",v);var P=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],A=this._page.size;P[1]=A[1]-(this.bounds.y+this.bounds.height),P[2]=this.bounds.x+this.bounds.width,P[3]=A[1]-this.bounds.y,this._isBounds&&(_=P),this._page._isNew&&this._page._pageSettings&&(P=Ft(this)),this._dictionary.update("Rect",[P[0],P[1],P[2],P[3]]),this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure");var k=this._crossReference._getNextReference(),x=this._createMeasureDictionary(this._unitString);this._crossReference._cacheMap.set(k,x),x._updated=!0,this._dictionary.update("Measure",k);var T="font:"+r._metrics._postScriptName+" "+r._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",T),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+s.toFixed(2)+" sq "+this._unitString):this._dictionary.update("Contents",s.toFixed(2)+" sq "+this._unitString),this._dictionary.update("Subject","Area Measurement"),void 0===this.subject&&this._dictionary.update("Subject","Area Measurement"),this._dictionary.update("MeasurementTypes",129),this._dictionary.update("Subtype",new Sr("Square")),this._dictionary.update("IT",new Sr("SquareDimension"));var I=this._dictionary.getArray("Rect"),N=new Array(2*I.length);N[0]=I[0],N[1]=I[3],N[2]=I[0],N[3]=I[1],N[4]=I[2],N[5]=I[1],N[6]=I[2],N[7]=I[3],this._dictionary.update("Vertices",N)}return l},i.prototype._calculateAreaOfSquare=function(){var e,i,r=new ze;if(this.bounds.width===this.bounds.height)i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString,e=(n=r._convertUnits(this.bounds.width,t._PdfGraphicsUnit.point,i.graphicsUnit))*n;else{i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString;var n=r._convertUnits(this.bounds.width,t._PdfGraphicsUnit.point,i.graphicsUnit);i=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=i.unitString,e=n*r._convertUnits(this.bounds.height,t._PdfGraphicsUnit.point,i.graphicsUnit)}return e},i}(gi),Si=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("Square")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.rectangleAnnotation,a}return ui(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var t=new Xi;if(t._dictionary=this._dictionary,this._dictionary.has("BE")){var e=this._dictionary.get("BE");t._intensity=e.get("I"),t._style=D(e.get("S").name)}this._borderEffect=t}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var i;if(this._dictionary.has("BS")?i=this.border.width:((r=new Tr(this._crossReference)).set("Type",Sr.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===i&&(i=1),(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),this._dictionary.update("Rect",Ft(this)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new Tr(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",Sr.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded){if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")){var i=n.get("N"),r=n.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ze(i,this._crossReference))}}else if(this._postProcess(e),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){var n=this._dictionary.get("AP");if(n&&n.has("N")){var i=n.get("N"),r=n.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ze(i,this._crossReference))}}else this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect);if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);(s&&this._page.rotation!==t.PdfRotationAngle.angle0||this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate))&&this._flattenAnnotationTemplate(this._appearanceTemplate,s)}if(!e&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new Tr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),a.update("N",r)}},i.prototype._isValidTemplateMatrix=function(t,e,i){var r=!0,n=e;if(t&&t.has("Matrix")){var s=t.getArray("BBox"),a=t.getArray("Matrix");if(a&&s&&a.length>3&&s.length>2&&void 0!==a[0]&&void 0!==a[1]&&void 0!==a[2]&&void 0!==a[3]&&1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&(Math.round(s[0])!==Math.round(-a[4])&&Math.round(s[1])!==Math.round(-a[5])||0===s[0]&&0===Math.round(-a[4]))){var o=this._page.graphics,h=o.save();void 0!==this.opacity&&this._opacity<1&&o.setTransparency(this._opacity),n.x-=s[0],n.y+=s[1],o.drawTemplate(i,n),o.restore(h),this._removeAnnotationFromPage(this._page,this),r=!1}}return r},i}(gi),wi=function(e){function i(i){var r=e.call(this)||this;return r._dictionary=new Tr,r._dictionary.update("Type",Sr.get("Annot")),r._dictionary.update("Subtype",Sr.get("Polygon")),void 0!==i&&(r._points=i),r._type=t._PdfAnnotationType.polygonAnnotation,r}return ui(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var t=new Xi;if(t._dictionary=this._dictionary,this._dictionary.has("BE")){var e=this._dictionary.get("BE");t._intensity=e.get("I"),t._style=D(e.get("S").name)}this._borderEffect=t}return this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineExtension",{get:function(){if(void 0===this._lineExtension&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&t>=0&&(this._lineExtension=t)}return this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(t>=0))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(e){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var i;this._dictionary.has("BS")?i=this.border.width:((h=new Tr(this._crossReference)).set("Type",Sr.get("Border")),this._dictionary.set("BS",h)),void 0===i&&(i=1);for(var r=[],n=0;n<this._points.length;n++){var s=this._points[Number.parseInt(n.toString(),10)];r.push(s)}r[0]===r[r.length-2]&&r[1]===r[r.length-1]||(r[r.length]=this._points[0],r[r.length]=this._points[1]),this._points=r;var a=this._getBoundsValue(this._points),o=[a.x,a.y,a.x+a.width,a.y+a.height];if(this._dictionary.update("Rect",o),this._dictionary.update("LLE",this._lineExtension),(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolygonAppearance(e)),this._dictionary.update("Vertices",this._points),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var h=new Tr(this._crossReference);h.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&h.set("S",Sr.get("C")),this._dictionary.update("BE",h)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._flatten=t,this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolygonAppearance(t)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t&&this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}if(void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&s.length>=2&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._removeAnnotationFromPage(this._page,this);if(!t&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new Tr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}},i.prototype._createPolygonAppearance=function(e){if(void 0!==e&&e){var i=void 0;this.color&&this.border.width>0&&(i=new je(this.color,this.border.width));var r=void 0;this.innerColor&&(r=new Ve(this.innerColor));c=this._page.graphics;if(i||r){var n=void 0;if(void 0!==this.opacity&&this._opacity<1&&(n=c.save(),c.setTransparency(this._opacity)),0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){d=4*this.borderEffect.intensity+.5*this.border.width;(p=new Fe)._addPolygon(this._getLinePoints()),this._drawCloudStyle(c,r,i,d,.833,p._points,!1)}else c.drawPolygon(this._getLinePoints(),i,r);void 0!==this.opacity&&this._opacity<1&&c.restore(n)}return c._template}var s=void 0,a={x:0,y:0,width:0,height:0};void 0===this._points&&this._dictionary.has("Vertices")?(this._points=this._dictionary.get("Vertices"),s=this._getBoundsValue(this._points)):s=this._getBoundsValue(this._points),void 0!==this._borderEffect&&void 0!==this.borderEffect.intensity&&0!==this.borderEffect.intensity&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy?(a.x=s.x-5*this.borderEffect.intensity-this.border.width,a.y=s.y-5*this.borderEffect.intensity-this.border.width,a.width=s.width+10*this.borderEffect.intensity+2*this.border.width,a.height=s.height+10*this.borderEffect.intensity+2*this.border.width):(a.x=s.x-this.border.width,a.y=s.y-this.border.width,a.width=s.width+2*this.border.width,a.height=s.height+2*this.border.width);var o=new li(this,[a.x,a.y,a.width,a.height]);o.normal=new Ze([a.x,a.y,a.width,a.height],this._crossReference);var h=o.normal;$(h,this._getRotationAngle()),h._writeTransformation=!1;var c=o.normal.graphics,_=new Ji;if(this.innerColor&&(_.backBrush=new Ve(this._innerColor)),this.border.width>0&&this.color&&(_.borderPen=new je(this._color,this.border.width)),this.color&&(_.foreBrush=new Ve(this._color)),void 0!==this.opacity&&this._opacity<1?(c.save(),c.setTransparency(this._opacity)):c.save(),0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){var d=4*this.borderEffect.intensity+.5*this.border.width,p=new Fe;p._addPolygon(this._getLinePoints()),this._drawCloudStyle(c,_.backBrush,_.borderPen,d,.833,p._points,!1)}else c.drawPolygon(this._getLinePoints(),_.borderPen,_.backBrush);return void 0!==this.opacity&&this._opacity<1&&c.restore(),c.restore(),this._isBounds&&(h._content.dictionary._updated=!0,this._dictionary.update("LLE",this.lineExtension),this._dictionary.update("Vertices",this._points)),this._dictionary.update("Rect",[a.x,a.y,a.x+a.width,a.y+a.height]),h},i.prototype._getLinePoints=function(){var e,i=this._page.size,r=i[1],n=i[0];if(this._dictionary.has("Vertices")&&!this._isBounds){var s=void 0;this._page._pageDictionary.has("Rotate")&&(s=this._page._pageDictionary.get("Rotate")),this._page.rotation&&(this._page.rotation===t.PdfRotationAngle.angle90?s=90:this._page.rotation===t.PdfRotationAngle.angle180?s=180:this._page.rotation===t.PdfRotationAngle.angle270&&(s=270));var a=this._dictionary.getArray("Vertices");if(a){var o=[];a.forEach(function(t){o.push(t)}),e=[];for(d=0;d<o.length;d+=2)this.flatten?e.push([o[Number.parseInt(d.toString(),10)],r-o[d+1]]):e.push([o[Number.parseInt(d.toString(),10)],-o[d+1]]);if(s)if(270===s)for(h=0;h<e.length;h++){c=e[Number.parseInt(h.toString(),10)][0];e[Number.parseInt(h.toString(),10)][0]=e[Number.parseInt(h.toString(),10)][1],e[Number.parseInt(h.toString(),10)][1]=n-c}else if(90===s)for(h=0;h<e.length;h++){c=e[Number.parseInt(h.toString(),10)][0];0!==this._page._origin[1]?e[Number.parseInt(h.toString(),10)][0]=r-(e[Number.parseInt(h.toString(),10)][1]-r):e[Number.parseInt(h.toString(),10)][0]=r-e[Number.parseInt(h.toString(),10)][1],e[Number.parseInt(h.toString(),10)][1]=c}else if(180===s)for(var h=0;h<e.length;h++){var c=e[Number.parseInt(h.toString(),10)][0];e[Number.parseInt(h.toString(),10)][0]=n-c,e[Number.parseInt(h.toString(),10)][1]=r-e[Number.parseInt(h.toString(),10)][1]}}}else if(null!==this._points){var _=[];this._points.forEach(function(t){_.push(t)}),e=[];for(var d=0;d<this._points.length;d+=2)this.flatten?e.push([_[Number.parseInt(d.toString(),10)],r-_[d+1]]):e.push([_[Number.parseInt(d.toString(),10)],-_[d+1]])}return e},i}(gi),Pi=function(e){function i(i){var r=e.call(this)||this;return r._beginLine=t.PdfLineEndingStyle.none,r._endLine=t.PdfLineEndingStyle.none,r._dictionary=new Tr,r._dictionary.update("Type",Sr.get("Annot")),r._dictionary.update("Subtype",Sr.get("PolyLine")),void 0!==i&&(r._points=i),r._type=t._PdfAnnotationType.polyLineAnnotation,r}return ui(i,e),Object.defineProperty(i.prototype,"beginLineStyle",{get:function(){if(this._dictionary.has("LE")){var t=this._dictionary.getArray("LE");t&&Array.isArray(t)&&(this._beginLine=E(t[0].name))}return this._beginLine},set:function(t){if(t!==this._beginLine&&(this._beginLine=t,this._dictionary)){var e=[];e.push(Sr.get(O(t))),e.push(Sr.get(O(this.endLineStyle))),this._dictionary.update("LE",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"endLineStyle",{get:function(){if(this._dictionary.has("LE")){var t=this._dictionary.getArray("LE");t&&Array.isArray(t)&&(this._endLine=E(t[1].name))}return this._endLine},set:function(t){if(t!==this._endLine&&(this._endLine=t,this._dictionary)){var e=[];e.push(Sr.get(O(this.beginLineStyle))),e.push(Sr.get(O(t))),this._dictionary.update("LE",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineExtension",{get:function(){if(void 0===this._lineExtension&&this._dictionary.has("LLE")){var t=this._dictionary.get("LLE");void 0!==t&&t>=0&&(this._lineExtension=t)}return this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(t>=0))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0);var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new Tr(this._crossReference);i.set("Type",Sr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1);var r=this._getLinePoints(),n=[];n.push(0);for(var s=1;s<r.length;s++)n.push(1);this._polylinePoints=r,this._pathTypes=n;var a=new Fe;a._points=r,a._pathTypes=n,this._dictionary.update("Vertices",this._points);var o=[];o.push(Sr.get(O(this.beginLineStyle))),o.push(Sr.get(O(this.endLineStyle))),this._dictionary.update("LE",o),this._dictionary.update("LLE",this._lineExtension);var h=this._getBoundsValue(this._points),c=[h.x,h.y,h.x+h.width,h.y+h.height];this._dictionary.update("Rect",c),(this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolyLineAppearance(t))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._flatten=t,this._isLoaded){if((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolyLineAppearance(t)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else this._appearanceTemplate=this._createPolyLineAppearance(t);if(void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._removeAnnotationFromPage(this._page,this);if(!t&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new Tr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}},i.prototype._createPolyLineAppearance=function(t){var e=this.color?this.color:[0,0,0];if(void 0!==t&&t){var i=void 0;this.border.width>0&&(i=new je(e,this.border.width));_=this._page.graphics;if(i){var r=void 0;void 0!==this.opacity&&this._opacity<1&&(r=_.save(),_.setTransparency(this._opacity));var n=this._getLinePoints(),s=[];if(s.push(0),n&&n.length>0){for(l=1;l<n.length;l++)s.push(1);(p=new Fe)._points=n,p._pathTypes=s,_._drawPath(p,i),void 0!==this.opacity&&this._opacity<1&&_.restore(r)}}return _._template}var a=void 0,o={x:0,y:0,width:0,height:0};void 0===this._points&&this._dictionary.has("Vertices")?(this._points=this._dictionary.get("Vertices"),a=this._getBoundsValue(this._points)):a=this._getBoundsValue(this._points),o.x=a.x-this.border.width,o.y=a.y-this.border.width,o.width=a.width+2*this.border.width,o.height=a.height+2*this.border.width;var h=new li(this,[o.x,o.y,o.width,o.height]);h.normal=new Ze([o.x,o.y,o.width,o.height],this._crossReference);var c=h.normal;$(c,this._getRotationAngle()),c._writeTransformation=!1;var _=h.normal.graphics,d=new Ji;this.innerColor&&(d.backBrush=new Ve(this._innerColor)),this.border.width>0&&e&&(d.borderPen=new je(e,this.border.width)),e&&(d.foreBrush=new Ve(e)),void 0!==this.opacity&&this._opacity<1?(_.save(),_.setTransparency(this._opacity)):_.save();var p=new Fe;if(void 0!==this._polylinePoints&&null!==this._polylinePoints?p._points=this._polylinePoints:p._points=this._getLinePoints(),void 0!==this._pathTypes&&null!==this._polylinePoints)p._pathTypes=this._pathTypes;else{this._pathTypes=[],this._pathTypes.push(0);for(var l=1;l<p._points.length;l++)this._pathTypes.push(1);p._pathTypes=this._pathTypes}if(_._drawPath(p,d.borderPen,d.backBrush),void 0!==this.opacity&&this._opacity<1&&_.restore(),_.restore(),this._isBounds){c._content.dictionary._updated=!0;var u=[];u.push(Sr.get(O(this.beginLineStyle))),u.push(Sr.get(O(this.endLineStyle))),this._dictionary.update("LE",u),this._dictionary.update("LLE",this.lineExtension),this._dictionary.update("Vertices",this._points)}return this._dictionary.update("Rect",[o.x,o.y,o.x+o.width,o.y+o.height]),c},i.prototype._getLinePoints=function(){var t,e=this._page.size[1];if(this._dictionary.has("Vertices")&&!this._isBounds&&(!this._setAppearance||this._setAppearance&&this.flatten)){var i=this._dictionary.getArray("Vertices");if(i){t=[];for(n=0;n<i.length;n+=2)t.push([i[Number.parseInt(n.toString(),10)],e-i[n+1]])}}else if(this._points){var r=[];this._points.forEach(function(t){r.push(t)}),t=[];for(var n=0;n<r.length;n+=2)this.flatten?t.push([r[Number.parseInt(n.toString(),10)],e-r[n+1]]):t.push([r[Number.parseInt(n.toString(),10)],-r[n+1]])}return t},i}(gi),Ai=function(e){function i(i){var r=e.call(this)||this;if(r._linePoints=[],r._firstIntersectionPoint=[0,0],r._secondIntersectionPoint=[0,0],r._dictionary=new Tr,r._dictionary.update("Type",Sr.get("Annot")),r._dictionary.update("Subtype",Sr.get("PolyLine")),void 0!==i&&i.length>0){if(i.length>6)throw new Error("Points length should not be greater than 3");r._pointArray=i;for(var n=0;n<i.length;n++)r._linePoints.push(i[Number.parseInt(n.toString(),10)][0]),r._linePoints.push(i[Number.parseInt(n.toString(),10)][1])}return r._type=t._PdfAnnotationType.angleMeasurementAnnotation,r}return ui(i,e),Object.defineProperty(i.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){t&&!this._isLoaded&&(this._measure=t,this.caption.cap=!0)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(!this._pointArray)throw new Error("Points cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new Tr(this._crossReference);e.set("Type",Sr.get("Border")),this._dictionary.set("BS",e)}this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===t&&(t=1),this._appearanceTemplate=this._createAngleMeasureAppearance()},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if(!t&&this._setAppearance&&(this._appearanceTemplate=this._createAngleMeasureAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else this._appearanceTemplate=this._createAngleMeasureAppearance();if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}},i.prototype._createAngleMeasureAppearance=function(){var e=this.border.width,i=this._obtainFont();(void 0===i||null===i||!this._isLoaded&&1===i.size)&&(i=this._circleCaptionFont,this._pdfFont=i);var r=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),n=this._calculateAngle()*(180/Math.PI);n<0&&(n=-n),n>180&&(n=360-n),this._dictionary.update("Vertices",this._linePoints);var s="font:"+i._metrics._postScriptName+" "+i._size+"pt; color:"+this._colorToHex(this.color);this._dictionary.update("DS",s),this.text===" "+n.toFixed(2)+"°"?this._dictionary.update("Contents",this.text):this.text&&this._dictionary.update("Contents",this.text),void 0===this.subject&&this._dictionary.update("Subject","Angle Measurement"),this._dictionary.update("MeasurementTypes",1152),this._dictionary.update("Subtype",new Sr("PolyLine")),this._dictionary.update("IT",new Sr("PolyLineAngle"));var a=new Tr,o=[],h=[],c=[],_=[],d=[];a.set("Type",Sr.get("measureDictionary")),a.set("R","1 in = 1 in"),a.set("Subtype","RL"),a.set("TargetUnitConversion",.1388889);var p=new Tr;p.set("U","in"),p.set("Type","NumberFormat"),p.set("C",1),p.set("D",1),p.set("SS",""),o.push(p);var l=new Tr;l.set("U","°"),l.set("Type","NumberFormat"),l.set("C",1),l.set("D",1),l.set("FD",!0),l.set("SS",""),h.push(l);var u=new Tr;u.set("U","sq in"),u.set("Type","NumberFormat"),u.set("C",1),u.set("D",1),u.set("FD",!0),u.set("SS",""),c.push(u);var f=new Tr;f.set("U","cu in"),f.set("Type","NumberFormat"),f.set("C",1),f.set("D",1),f.set("FD",!0),f.set("SS",""),d.push(f);var g=new Tr;g.set("U","in"),g.set("Type","NumberFormat"),g.set("C",1),g.set("D",1),g.set("SS",""),_.push(g),a.set("D",o),a.set("T",h),a.set("A",c),a.set("X",_),a.set("V",d),this._dictionary.has("Measure")&&wt(this._dictionary,this._crossReference,"Measure");var y=this._crossReference._getNextReference();this._crossReference._cacheMap.set(y,a),a._updated=!0,this._dictionary.update("Measure",y);var m=[0,0,0,0],b=this._getAngleBoundsValue(),v=this._obtainLinePoints(),S=[];S.push(0);for(var w=1;w<v.length;w++)S.push(1);(new Fe)._addRectangle(v[1][0]-this._radius,-(v[1][1]+this._radius),2*this._radius,2*this._radius);var P=i.measureString(n.toString()+"°",[0,0],r,0,0),A=[(this._firstIntersectionPoint[0]+this._secondIntersectionPoint[0])/2,(this._firstIntersectionPoint[1]+this._secondIntersectionPoint[1])/2],k=[v[1][0],-v[1][1]],x=v[1][0]+this._radius*Math.cos((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),T=v[1][1]+this._radius*Math.sin((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),I=[A[0],A[1]],N=I[0]-k[0],C=I[1]-k[1],R=Math.atan2(C,N)*(180/Math.PI),F=!1,B=!1,L=!1,M=!1;R>0?R<45?B=!0:R>=45&&R<135?L=!0:F=!0:0===(R=-R)?(new Fe)._addRectangle(b[0],b[1],b[2],b[3]):R<45?B=!0:R>=45&&R<135?M=!0:F=!0,0===m[0]&&0===m[1]&&0===m[2]&&0===m[3]&&(m=b,this.bounds={x:b[0],y:b[1],width:b[2],height:b[3]});var D=new Fe;D._pathTypes=S,D._points=v,this._dictionary.set("Rect",[m[0],m[1],m[0]+m[2],m[1]+m[3]]);var O=new li(this,b);O.normal=new Ze(m,this._crossReference);var E=O.normal;E._writeTransformation=!1;var V=O.normal.graphics,j=e/2,z=new je(this._color,j);this.border.style===t.PdfBorderStyle.dashed&&(z._dashStyle=t.PdfDashStyle.dash);var U=new Ve(this._color);V.save(),D._addArc(v[1][0]-this._radius,v[1][1]-this._radius,2*this._radius,2*this._radius,this._startAngle,this._sweepAngle),V._drawPath(D,z),L?V.drawString(n.toString()+"°",i,[x-P[0]/2,-(-T+i._metrics._getHeight()+2),0,0],null,U):B?V.drawString(n.toString()+"°",i,[x+2,-(-T+i._metrics._getHeight()/2),0,0],null,U):F?V.drawString(n.toString()+"°",i,[x-P[0]-2,-(-T+i._metrics._getHeight()/2),0,0],null,U):M&&V.drawString(n.toString()+"°",i,[x-P[0]/2,T+2,0,0],null,U),V.restore(),V._template._content.dictionary._updated=!0;var W=this._crossReference._getNextReference();this._crossReference._cacheMap.set(W,V._template._content),V._template._content.reference=W,this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var H=new Tr;return H.set("N",W),H._updated=!0,this._dictionary.set("AP",H),E},i.prototype._getAngleBoundsValue=function(){for(var t=this._obtainLinePoints(),e=0;e<t.length;e++)t[Number.parseInt(e.toString(),10)][1]=-t[Number.parseInt(e.toString(),10)][1];var i=new Fe;return i._points=t,i._pathTypes=[0,1,1],i._getBounds()},i.prototype._obtainLinePoints=function(){var t,e;if(this._linePoints){t=new Array(this._linePoints.length);for(var i=0;i<this._linePoints.length;i++)t[Number.parseInt(i.toString(),10)]=this._linePoints[Number.parseInt(i.toString(),10)];e=new Array(t.length/2);for(var r=0,n=0;n<t.length;n+=2)e[Number.parseInt(r.toString(),10)]=[t[Number.parseInt(n.toString(),10)],-t[n+1]],r++}return e},i.prototype._calculateAngle=function(){var t=[0,0];void 0!==this._linePoints&&0===this._linePoints.length&&this._isLoaded&&this._dictionary.has("Vertices")&&(this._linePoints=this._dictionary.get("Vertices"));for(var e=0;e<this._linePoints.length;e++)t[Number.parseInt(e.toString(),10)]=this._linePoints[Number.parseInt(e.toString(),10)];for(var i=[],r=0;r<t.length;r+=2)i.push([t[Number.parseInt(r.toString(),10)],t[r+1]]);var n=i[0],s=i[1],a=i[2],o=Math.sqrt(Math.pow(s[0]-n[0],2)+Math.pow(s[1]-n[1],2)),h=Math.sqrt(Math.pow(s[0]-a[0],2)+Math.pow(s[1]-a[1],2));this._radius=Math.min(o,h)/4;var c=new Fe;c._points=i,c._pathTypes=[0,1,1];var _,d,p=this._findLineCircleIntersectionPoints(s[0],s[1],this._radius,n,s,_,d);_=p.first,d=p.second,0===this._firstIntersectionPoint[0]&&0===this._firstIntersectionPoint[1]&&(this._firstIntersectionPoint=d),_=[0,0],d=[0,0],_=(p=this._findLineCircleIntersectionPoints(s[0],s[1],this._radius,a,s,_,d)).first,d=p.second,0===this._secondIntersectionPoint[0]&&0===this._secondIntersectionPoint[1]&&(this._secondIntersectionPoint=d);var l=this._firstIntersectionPoint[0]-s[0],u=this._firstIntersectionPoint[1]-s[1],f=Math.atan2(u,l)*(180/Math.PI);l=this._secondIntersectionPoint[0]-s[0],u=this._secondIntersectionPoint[1]-s[1];var g=Math.atan2(u,l)*(180/Math.PI);return f=f>0?f=360-f:-f,g=g>0?g=360-g:-g,180===f&&0===g?(this._startAngle=f,this._sweepAngle=180):0===f&&180===g?(this._startAngle=g,this._sweepAngle=180):f<180?f>g?(this._startAngle=g,this._sweepAngle=f-g):f+180<g?(this._startAngle=g,this._sweepAngle=360-g+f):(this._startAngle=f,this._sweepAngle=g-f):f<g?(this._startAngle=f,this._sweepAngle=g-f):f-180>g?(this._startAngle=f,this._sweepAngle=360-f+g):(this._startAngle=g,this._sweepAngle=f-g),Math.atan2(a[0]-s[0],a[1]-s[1])-Math.atan2(n[0]-s[0],n[1]-s[1])},i.prototype._findLineCircleIntersectionPoints=function(t,e,i,r,n,s,a){var o=n[0]-r[0],h=n[1]-r[1],c=o*o+h*h,_=2*(o*(r[0]-t)+h*(r[1]-e)),d=_*_-4*c*((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e)-i*i);if(c<=1e-7||d<0)s=[Number.NaN,Number.NaN],a=[Number.NaN,Number.NaN];else if(0===d){p=-_/(2*c);s=[r[0]+p*o,r[1]+p*h],a=[Number.NaN,Number.NaN]}else{var p=(-_+Math.sqrt(d))/(2*c);s=[r[0]+p*o,r[1]+p*h],p=(-_-Math.sqrt(d))/(2*c),a=[r[0]+p*o,r[1]+p*h]}return{first:s,second:a}},i}(gi),ki=function(e){function i(i,r){var n=e.call(this)||this;return n._inkPointsCollection=[],n._previousCollection=[],n._isModified=!1,n._dictionary=new Tr,n._dictionary.update("Type",Sr.get("Annot")),n._dictionary.update("Subtype",Sr.get("Ink")),void 0!==i&&(n._points=i,n.bounds={x:i[0],y:i[1],width:i[2],height:i[3]}),void 0!==r&&(n._linePoints=r),n._type=t._PdfAnnotationType.inkAnnotation,n}return ui(i,e),Object.defineProperty(i.prototype,"inkPointsCollection",{get:function(){if(0===this._inkPointsCollection.length&&this._dictionary.has("InkList")){var t=this._dictionary.get("InkList");Array.isArray(t)&&t.length>0&&(this._inkPointsCollection=t)}return this._inkPointsCollection},set:function(t){Array.isArray(t)&&t.length>0&&t!==this._inkPointsCollection&&(this._inkPointsCollection=t,this._isModified=!0,this._isLoaded&&this._dictionary.update("InkList",t))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");var t;this._dictionary.has("BS")?t=this.border.width:((s=new Tr(this._crossReference)).set("Type",Sr.get("Border")),this._dictionary.set("BS",s)),this._dictionary.has("C")||(this.color=[0,0,0],this._isTransparentColor=!0),void 0===t&&(t=1);var e=this._addInkPoints(),i=[e[0],e[1],e[0]+e[2],e[1]+e[3]];if(this._dictionary.update("Rect",i),this._setAppearance){var r=new li(this,e);r.normal=new Ze(e,this._crossReference);var n=r.normal;$(n,this._getRotationAngle()),n._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(n),this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var s=new Tr;this._appearanceTemplate._content.dictionary._updated=!0;var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=a,s.set("N",a),s._updated=!0,this._dictionary.set("AP",s)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isFlatten=t,this._isLoaded){if(this._setAppearance||t&&!this._dictionary.has("AP")){0===this._inkPointsCollection.length&&(this._inkPointsCollection=this._obtainInkListCollection());n=this._getInkBoundsValue();if($(s=new Ze(n,this._crossReference),this._getRotationAngle()),s._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(s),this._dictionary.update("Rect",[n[0],n[1],n[0]+n[2],n[1]+n[3]]),!t){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var e=new Tr;this._appearanceTemplate._content.dictionary._updated=!0;r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,e.set("N",r),e._updated=!0,this._dictionary.set("AP",e)}}if(!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")){var i=e.get("N"),r=e.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ze(i,this._crossReference))}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){if((e=this._dictionary.get("AP"))&&e.has("N")){var i=e.get("N"),r=e.getRaw("N");i&&(r&&(i.reference=r),this._appearanceTemplate=new Ze(i,this._crossReference))}}else{0===this._inkPointsCollection.length&&(this._inkPointsCollection=this._obtainInkListCollection());var n=this._getInkBoundsValue(),s=new Ze(n,this._crossReference);$(s,this._getRotationAngle()),s._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(s),this._dictionary.update("Rect",[n[0],n[1],n[0]+n[2],n[1]+n[3]])}if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate&&null!==this._appearanceTemplate._size&&void 0!==this._appearanceTemplate._size){var a=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var o=this._appearanceTemplate._content.dictionary.getArray("BBox");o&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-o[0],-o[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,a)}},i.prototype._createInkAppearance=function(e){var i=e.graphics;if(null!==this._inkPointsCollection&&this._inkPointsCollection.length>0&&null!==this.color&&void 0!==this._color){for(var r=0;r<this._inkPointsCollection.length;r++)if(this._inkPointsCollection[Number.parseInt(r.toString(),10)].length%2==0){var n=this._inkPointsCollection[Number.parseInt(r.toString(),10)];2===n.length&&(n=[n[0]-.5,n[1]-.5,n[0]+.5,n[1]+.5]);for(var s=new Array(n.length/2),a=0,o=0;o<n.length;o+=2)s[Number.parseInt(a.toString(),10)]=[n[Number.parseInt(o.toString(),10)],n[o+1]],a++;var h=a+2*a-2,c=new Array(h),_=[],d=[],p=this._getControlPoints(s,_,d);_=p.controlP1,d=p.controlP2;for(var l=0,u=0;u<h-1;u+=3)c[Number.parseInt(u.toString(),10)]=s[Number.parseInt(l.toString(),10)],c[u+1]=_[Number.parseInt(l.toString(),10)],c[u+2]=d[Number.parseInt(l.toString(),10)],l++;if(c[h-1]=s[s.length-1],null!==c){for(var f=c,g=0;g<f.length;g++){var y=f[Number.parseInt(g.toString(),10)];f[Number.parseInt(g.toString(),10)]=[y[0],-y[1]]}var m=new Fe,b=null;if(2===s.length){var v=s[1][0]-s[0][0],S=s[1][1]-s[0][1];m._addEllipse(s[0][0]+.5,-(s[0][1]+S+.5),v,S),(b=new Fe)._pathTypes=m._pathTypes,b._points=m._points}else m._addBezierPoints(f),(b=new Fe)._pathTypes=m._pathTypes,b._points=f;var w=new je(this.color,this.border.width);if(void 0!==this.opacity&&this._opacity<1){var P=i.save();i.setTransparency(this._opacity),this._isLoaded&&(w._lineCap=t.PdfLineCap.round),i._drawPath(b,w),i.restore(P)}else i._drawPath(b,w)}}this._isFlatten&&(this.bounds={x:this.bounds.x,y:this._page.size[1]-(this.bounds.y+this.bounds.height),width:this.bounds.width,height:this.bounds.height})}return e},i.prototype._getControlPoints=function(t,e,i){if(null===t)throw new Error("pointCollection");var r=t.length-1;if(r<1)throw new Error("At least two knot PointFs required pointCollection");1===r&&(i=[[2*(e=[[(2*t[0][0]+t[1][0])/3,(2*t[0][1]+t[1][1])/3]])[0][0]-t[0][0],2*e[0][1]-t[0][1]]]);for(var n=[],s=1;s<r-1;++s)n[Number.parseInt(s.toString(),10)]=4*t[Number.parseInt(s.toString(),10)][0]+2*t[s+1][0];n[0]=t[0][0]+2*t[1][0],n[r-1]=(8*t[r-1][0]+t[Number.parseInt(r.toString(),10)][0])/2;for(var a=this._getSingleControlPoint(n),s=1;s<r-1;++s)n[Number.parseInt(s.toString(),10)]=4*t[Number.parseInt(s.toString(),10)][1]+2*t[s+1][1];n[0]=t[0][1]+2*t[1][1],n[r-1]=(8*t[r-1][1]+t[Number.parseInt(r.toString(),10)][1])/2;var o=this._getSingleControlPoint(n);e=new Array(r),i=new Array(r);for(s=0;s<r;++s)if(e[Number.parseInt(s.toString(),10)]=[a[Number.parseInt(s.toString(),10)],o[Number.parseInt(s.toString(),10)]],s<r-1)i[Number.parseInt(s.toString(),10)]=[2*t[s+1][0]-a[s+1],2*t[s+1][1]-o[s+1]];else{var h=(t[Number.parseInt(r.toString(),10)][0]+a[r-1])/2,c=(t[Number.parseInt(r.toString(),10)][1]+o[r-1])/2;i[Number.parseInt(s.toString(),10)]=[h,c]}return{controlP1:e,controlP2:i}},i.prototype._getSingleControlPoint=function(t){var e=t.length,i=[],r=[],n=2;i[0]=t[0]/n;for(s=1;s<e;s++)r[Number.parseInt(s.toString(),10)]=1/n,n=(s<e-1?4:3.5)-r[Number.parseInt(s.toString(),10)],i[Number.parseInt(s.toString(),10)]=(t[Number.parseInt(s.toString(),10)]-i[s-1])/n;for(var s=1;s<e;s++)i[e-s-1]-=r[e-s]*i[e-s];return i},i.prototype._addInkPoints=function(){var t=this,e=[];null===this._linePoints||0!==this._previousCollection.length&&!this._isModified||(this._inkPointsCollection.unshift(this._linePoints),this._isModified=!1);var i=Ct(this._inkPointsCollection,this._previousCollection);if(null!==this._inkPointsCollection&&!i){for(var r=0;r<this._inkPointsCollection.length;r++){var n=this._inkPointsCollection[Number.parseInt(r.toString(),10)];e.push(n)}this._dictionary.update("InkList",e)}return this._inkPointsCollection.length>0&&this._inkPointsCollection.forEach(function(e){t._previousCollection.push(e)}),this._getInkBoundsValue()},i.prototype._getInkBoundsValue=function(){var t=[0,0,0,0];this._points&&(this.bounds={x:this._points[0],y:this._points[1],width:this._points[2],height:this._points[3]}),t=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];var e=this.border.width;if(null!==this._inkPointsCollection&&this._inkPointsCollection.length>0){for(var i=[],r=0;r<this._inkPointsCollection.length;r++){var n=this._inkPointsCollection[Number.parseInt(r.toString(),10)];if(null!==n&&n.length%2==0)for(h=0;h<n.length;h++)i.push(n[Number.parseInt(h.toString(),10)])}var s=!1;this._isLoaded||2!==i.length||(s=!0,i.push(i[0]+1),i.push(i[1]+1));for(var a=new Array(i.length/2),o=0,h=0;h<i.length;h+=2)a[Number.parseInt(o.toString(),10)]=[i[Number.parseInt(h.toString(),10)],i[h+1]],o++;if(this._isLoaded)if(a.length>0){for(var c=0,_=0,d=0,p=0,l=!0,r=0;r<a.length;r++){var u=a[Number.parseInt(r.toString(),10)];l?(c=u[0],_=u[1],l=!1):(u[0]<c?c=u[0]:u[0]>d&&(d=u[0]),u[1]<_?_=u[1]:u[1]>p&&(p=u[1]))}t=[c,_,d-c,p-_],this.bounds={x:t[0],y:t[1],width:t[2],height:t[3]},(this._isFlatten||this._setAppearance)&&(t[0]=this.bounds.x-e,t[1]=this.bounds.y-e,t[2]=this.bounds.width+2*e,t[3]=this.bounds.height+2*e)}else t=this._points?this._points:a.length>0?this._dictionary.get("Rect"):[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];else t=this._calculateInkBounds(a,t,e,s);this.bounds={x:t[0],y:t[1],width:t[2],height:t[3]}}return t},i.prototype._calculateInkBounds=function(t,e,i,r){if(t.length>5){for(var n=0,s=0,a=0,o=0,h=!0,c=0;c<t.length;c++){var _=t[Number.parseInt(c.toString(),10)];h?(n=_[0],s=_[1],a=_[0],o=_[1],h=!1):(_[0]<n?n=_[0]:_[0]>a&&(a=_[0]),_[1]<s?s=_[1]:_[1]>o&&(o=_[1]))}if(e[2]<a&&(a=e[2]),e[3]<o&&(o=e[3]),e=[n,s,a,o],this._isFlatten||this._setAppearance){var d=r?2:3;e[0]=e[0]-i,e[1]=e[1]-i,e[2]=e[2]+d*i,e[3]=e[3]+d*i}}else e=void 0===this._points&&t.length>0?this._dictionary.get("Rect"):this._points;return e},i.prototype._obtainInkListCollection=function(){var t=[];if(this._dictionary.has("InkList"))for(var e=this._dictionary.getArray("InkList"),i=[],r=0;r<e.length;r++){for(var n=e[Number.parseInt(r.toString(),10)],s=0;s<n.length;s++)i.push(n[Number.parseInt(s.toString(),10)]);t.push(i)}return t},i}(gi),xi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._icon=t.PdfPopupIcon.note,o._iconString="",o._stateModel=t.PdfAnnotationStateModel.none,o._state=t.PdfAnnotationState.none,o._open=!1,o._isReview=!1,o._isComment=!1,o._dictionary=new Tr,o._dictionary.update("Type",Sr.get("Annot")),o._dictionary.update("Subtype",Sr.get("Text")),void 0!==i&&(o.text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a}),o._type=t._PdfAnnotationType.popupAnnotation,o}return ui(i,e),Object.defineProperty(i.prototype,"open",{get:function(){return this._dictionary.has("Open")&&(this._open=this._dictionary.get("Open")),this._open},set:function(t){void 0!==t&&(this._open=t,this._dictionary.update("Open",this._open))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=ot(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",Sr.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"stateModel",{get:function(){return this._dictionary.has("StateModel")&&(this._stateModel=dt(this._dictionary.get("StateModel"))),this._stateModel},set:function(t){void 0!==t&&(this._stateModel=t,this._dictionary.update("StateModel",_t(this._stateModel)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"state",{get:function(){return this._dictionary.has("State")&&(this._state=ct(this._dictionary.get("State"))),this._state},set:function(t){void 0!==t&&(this._state=t,this._dictionary.update("State",ht(this._state)))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),e.has("IRT")&&(r._isReview=bt(e),r._isReview||(r._isComment=vt(e))),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){void 0!==this.bounds&&null!==this.bounds||(this._bounds={x:0,y:0,width:0,height:0});var t;this._dictionary.has("BS")?t=this.border.width:((i=new Tr(this._crossReference)).set("Type",Sr.get("Border")),this._dictionary.set("BS",i)),void 0===t&&(t=1);var e=[this.bounds.x,this.bounds.y,this.bounds.x+this.bounds.width,this.bounds.y+this.bounds.height];if(this._dictionary.update("Rect",e),this._setAppearance&&(this._appearanceTemplate=this._createPopupAppearance(),this._appearanceTemplate)){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var i=new Tr;this._appearanceTemplate._content.dictionary._updated=!0;var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,i.set("N",r),i._updated=!0,this._dictionary.set("AP",i)}this._dictionary.update("Rect",Ft(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if(!this._appearanceTemplate&&this._isFlattenPopups&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")){var e=n.get("N"),i=n.getRaw("N");if(e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference)),null!==this._appearanceTemplate){var r=this._page.graphics.save();this.opacity<1&&this._page.graphics.setTransparency(this.opacity),this._page.graphics.drawTemplate(this._appearanceTemplate,this.bounds),this._page.graphics.restore(r)}}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var n=this._dictionary.get("AP");if(n&&n.has("N")){var e=n.get("N"),i=n.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Ze(e,this._crossReference))}}else this._appearanceTemplate=this._createPopupAppearance();void 0!==this.flattenPopups&&this.flattenPopups&&this.flatten&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._removeAnnotation(this._page,this)},i.prototype._createPopupAppearance=function(){var t;if(this._dictionary.has("Name")&&"Comment"===this._dictionary.get("Name").name&&this._dictionary.has("Rect")){var e=[0,0,this.bounds.width,this.bounds.height];$(t=new Ze(e,this._crossReference),this._getRotationAngle());var i=t.graphics;if(null!==this._dictionary.getArray("Rect")){var r=new je([0,0,0],.3),n=new Ve(this.color),s=new je([255,255,255],1),a=new Array;a.push([6,8]),a.push([9,8]),a.push([4,12]);var o=new Fe;0===this.color[0]&&0===this.color[0]&&0===this.color[0]&&(n=new Ve([255,215,0])),i.save();var h=new Ze([0,0,15,14],this._crossReference);h.graphics.drawRectangle(0,0,15,14,r,n),h.graphics.drawPolygon(a,r,new Ve([255,255,255])),o._addEllipse(2,2,11,8),h.graphics._drawPath(o,r,new Ve([255,255,255])),h.graphics.drawArc(2,2,11,8,108,12.7,s),h.graphics.drawLine(r,4,12,6.5,10),i.drawTemplate(h,{x:0,y:0,width:this.bounds.width,height:this.bounds.height}),i.restore()}}return t},i.prototype._obtainIconName=function(e){switch(e){case t.PdfPopupIcon.note:this._iconString="Note";break;case t.PdfPopupIcon.comment:this._iconString="Comment";break;case t.PdfPopupIcon.help:this._iconString="Help";break;case t.PdfPopupIcon.insert:this._iconString="Insert";break;case t.PdfPopupIcon.key:this._iconString="Key";break;case t.PdfPopupIcon.newParagraph:this._iconString="NewParagraph";break;case t.PdfPopupIcon.paragraph:this._iconString="Paragraph"}return this._iconString},i}(gi),Ti=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._dictionary=new Tr,o._dictionary.update("Type",Sr.get("Annot")),o._dictionary.update("Subtype",Sr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(o.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&null!==a&&(o._fileName=a),o._type=t._PdfAnnotationType.fileLinkAnnotation,o}return ui(i,e),Object.defineProperty(i.prototype,"action",{get:function(){if(void 0===this._action&&this._dictionary.has("A")){var t=this._dictionary.get("A");if(t&&t.has("Next")){var e=t.get("Next");if(Array.isArray(e))for(var i=0;i<e.length;i++){var r=e[Number.parseInt(i.toString(),10)];if(r&&r instanceof Pr){var n=this._crossReference._fetch(r);n.has("JS")&&(this._action=n.get("JS"))}}}}return this._action},set:function(t){if(this._isLoaded||"string"!=typeof t||(this._action=t),this._isLoaded&&"string"==typeof t&&this.action!==t&&this._dictionary.has("A")){var e=this._dictionary.get("A");if(e&&e.has("Next")){var i=e.get("Next");if(Array.isArray(i))for(var r=0;r<i.length;r++){var n=i[Number.parseInt(r.toString(),10)];if(n&&n instanceof Pr){var s=this._crossReference._fetch(n);s.has("JS")&&(s.update("JS",t),this._action=t,this._dictionary._updated=!0)}}}}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new Tr(this._crossReference);e.set("Type",Sr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",Ft(this))},i.prototype._addAction=function(){var t=this;if(this._dictionary.has("A")){var e=this._dictionary.get("A");if(e){if(void 0!==this._action&&null!==this._action&&e.has("Next")){var i=e.get("Next");Array.isArray(i)&&i.length>0&&i.forEach(function(e){e&&e instanceof Pr&&e._isNew&&t._crossReference._cacheMap.delete(e)})}e.has("F")&&wt(e,this._crossReference,"F")}wt(this._dictionary,this._crossReference,"A")}var r=new Tr;r.set("Type",Sr.get("Action")),r.set("S",Sr.get("Launch"));var n=new Tr;if(n.set("Type",Sr.get("Filespec")),n.set("UF",this._fileName),void 0!==this._action&&null!==this._action){var s=new Tr;s.set("Type",Sr.get("Action")),s.set("S",Sr.get("JavaScript")),s.set("JS",this._action);var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,s),s._updated=!0,r.set("Next",[a])}var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,n),n._updated=!0,r.set("F",o),r._updated=!0,this._dictionary.set("A",r)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(fi),Ii=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._dictionary=new Tr,o._dictionary.update("Type",Sr.get("Annot")),o._dictionary.update("Subtype",Sr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(o.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&null!==a&&(o._uri=a),o._type=t._PdfAnnotationType.uriAnnotation,o}return ui(i,e),Object.defineProperty(i.prototype,"uri",{get:function(){if(void 0===this._uri&&this._dictionary.has("A")){var t=this._dictionary.get("A");t.has("URI")&&(this._uri=t.get("URI"))}return this._uri},set:function(t){if("string"==typeof t)if(this._isLoaded&&this._dictionary.has("A")&&t!==this.uri){var e=this._dictionary.get("A");e.has("URI")&&(this._uri=t,e.update("URI",t),this._dictionary._updated=!0)}else this._uri=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new Tr(this._crossReference);e.set("Type",Sr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",Ft(this))},i.prototype._addAction=function(){var t=new Tr;t.set("Type",Sr.get("Action")),t.set("S",Sr.get("URI")),void 0!==this._uri&&t.set("URI",this._uri),t._updated=!0,this._dictionary.set("A",t),this._dictionary.update("Border",[this.border.hRadius,this.border.vRadius,this.border.width])},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(fi),Ni=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.documentLinkAnnotation,a}return ui(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){return this._isLoaded&&(this.destination=this._obtainDestination()),this._destination},set:function(t){null!==t&&(this._destination=t)},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._addDocument(),this._dictionary.update("Rect",Ft(this))},i.prototype._obtainDestination=function(){if(this._dictionary.has("Dest")){var e=this._dictionary.get("Dest"),i=void 0;if(e[0]instanceof Pr&&(i=e[0]),(void 0===i||null===i)&&"number"==typeof e[0]){var r=e[0];if(m=this._crossReference._document.getPage(r))if("XYZ"===(d=e[1]).name){var n=e[2],s=e[3],a=e[4],o=void 0!==s&&null!==s?m.size[1]-s:0,h=void 0!==n&&null!==n?n:0;this._destination=new tr(m,[h,o]),void 0!==a&&null!==a&&(this._destination.zoom=a),(void 0===n&&null===n||void 0===s&&null===s||void 0===a&&null===a)&&this._destination._setValidation(!1)}else this._destination=new tr(m),this._destination.mode=t.PdfDestinationMode.fitToPage}if(i)if((y=_(this._crossReference._document,this._crossReference._fetch(i)))>=0){if((m=this._crossReference._document.getPage(y))&&e[1]instanceof Sr&&(d=e[1]))if("XYZ"===d.name){var n=e[2],c=e[3],a=e[4],o=void 0!==c&&null!==c?m.size[1]-c:0,h=void 0!==n&&null!==n?n:0;this._destination=new tr(m,[h,o]),void 0!==a&&null!==a&&(this._destination.zoom=a),(void 0===n&&null===n||void 0===c&&null===c||void 0===a&&null===a)&&this._destination._setValidation(!1)}else"Fit"===d.name&&(this._destination=new tr(m),this._destination.mode=t.PdfDestinationMode.fitToPage)}else{this._destination=new tr;var a=e[4],d=e[1];if(void 0!==a&&null!==a&&(this._destination.zoom=a),"Fit"===d.name)this._destination.mode=t.PdfDestinationMode.fitToPage;else if("XYZ"===d.name){var n=e[2],o=e[3];(void 0===n&&null===n||void 0===o&&null===o||void 0===a&&null===a)&&this._destination._setValidation(!1)}this._destination._index=y}}else if(this._dictionary.has("A")&&!this._destination){var p=this._dictionary.get("A");if(p.has("D")){var l=p.get("D");if(null!==l&&void 0!==l){var u=void 0;if(Array.isArray(l))u=l;else if(l instanceof Pr){var f=this._crossReference._fetch(l);Array.isArray(f)&&(u=f)}if(u&&(u[0]instanceof Pr||"number"==typeof u[0])){var g=this._crossReference._document,y=void 0;y=u[0]instanceof Pr?_(g,this._crossReference._fetch(u[0])):u[0];var m=g.getPage(y);if(m)if("FitBH"===(d=u[1]).name||"FitH"===d.name){var b=u[2],o=void 0!==b&&null!==b?m.size[1]-b:0;this._destination=new tr(m,[0,o]),void 0!==b&&null!==b||this._destination._setValidation(!1)}else if("XYZ"===d.name){var n=u[2],v=u[3],a=u[4],o=void 0!==v&&null!==v?m.size[1]-v:0,h=void 0!==n&&null!==n?n:0;this._destination=new tr(m,[h,o]),void 0!==a&&null!==a&&(this._destination.zoom=a),(void 0!==n&&null!==n||void 0!==v&&null!==v||void 0!==a&&null!==a)&&this._destination._setValidation(!1)}else if("FitR"===d.name){if(6===u.length){var n=u[2],S=u[3],w=u[4],P=u[5];this._destination=new tr(m,[n,S,w,P])}}else"Fit"===d.name&&(this._destination=new tr(m),this._destination.mode=t.PdfDestinationMode.fitToPage)}}}}return this._destination},i.prototype._addDocument=function(){this.destination&&this._dictionary.set("Dest",this.destination._array)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(fi),Ci=function(e){function i(i,r,n,s,a,o,h,c){var _=e.call(this)||this;return _._isActionAdded=!1,_._dictionary=new Tr,_._dictionary.update("Type",Sr.get("Annot")),_._dictionary.update("Subtype",Sr.get("Link")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(_.bounds={x:i,y:r,width:n,height:s}),_._textWebLink=void 0!==c&&null!==c?c:"",void 0!==a&&null!==a&&(_._brush=new Ve(a)),void 0!==o&&null!==o&&(_._pen=new je(o,h||1)),_._type=t._PdfAnnotationType.textWebLinkAnnotation,_}return ui(i,e),Object.defineProperty(i.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"url",{get:function(){if(void 0===this._url&&this._dictionary.has("A")){var t=this._dictionary.get("A");t.has("URI")&&(this._url=t.get("URI"))}return this._url},set:function(t){if("string"==typeof t)if(this._isLoaded&&this._dictionary.has("A")){var e=this._dictionary._get("A"),i=this._dictionary.get("A");i&&i.has("URI")&&(this._url=t,i.update("URI",t),e instanceof Pr||(this._dictionary._updated=i._updated))}else this._url=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._isActionAdded||(this._addAction(),this._isActionAdded=!0),this._dictionary.update("Rect",Ft(this))},i.prototype._addAction=function(){var e=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];void 0!==this.font&&null!==this.font||(this.font=this._lineCaptionFont);var i=new Vt(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top);this._page.graphics.drawString(this._textWebLink,this.font,e,this._pen,this._brush,i);var r=new Tr;r.set("Type",Sr.get("Action")),r.set("S",Sr.get("URI")),void 0!==this._url&&r.set("URI",this._url),r._updated=!0,this._dictionary.set("A",r),this._dictionary.update("Border",[0,0,0])},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(fi),Ri=function(e){function i(i,r,n,s,a,o){var h=e.call(this)||this;return h._icon=t.PdfAttachmentIcon.pushPin,h._iconString="",h._dictionary=new Tr,h._dictionary.update("Type",Sr.get("Annot")),h._dictionary.update("Subtype",Sr.get("FileAttachment")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(h.bounds={x:i,y:r,width:n,height:s}),void 0!==a&&(h._fileName=a),h._stream=new Rr("string"==typeof o?k(o):o),h._type=t._PdfAnnotationType.fileAttachmentAnnotation,h}return ui(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=pt(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",Sr.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._dictionary.update("Rect",Ft(this)),this._addAttachment()},i.prototype._addAttachment=function(){if(this._dictionary.has("FS")){var t=this._dictionary.get("FS");if(t&&t.has("EF")){var e=t.get("EF");e&&e.has("F")&&wt(e,this._crossReference,"F")}wt(this._dictionary,this._crossReference,"FS")}var i=new Tr;i.set("Type",Sr.get("Filespec")),i.set("Desc",this._fileName),i.set("F",this._fileName),i.set("UF",this._fileName);var r=new Tr;r.set("Type",Sr.get("EmbeddedFile"));var n=new Tr,s=new Date;n.set("CreationDate",s.toTimeString()),n.set("ModDate",(new Date).toTimeString()),n.set("Size",this._stream.length),r.set("Params",n),this._stream.dictionary=new Tr,this._stream.dictionary=r,r._crossReference=this._crossReference;var a=[this._crossReference._newLine.charCodeAt(0),this._crossReference._newLine.charCodeAt(1),37,80,68,70,45];r._crossReference._writeObject(this._stream,a);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._stream),r._updated=!0;var h=new Tr;h.set("F",o),i.set("EF",h);var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,i),i._updated=!0,this._dictionary.update("FS",c)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i.prototype._obtainIconName=function(e){switch(e){case t.PdfAttachmentIcon.pushPin:this._iconString="PushPin";break;case t.PdfAttachmentIcon.tag:this._iconString="Tag";break;case t.PdfAttachmentIcon.graph:this._iconString="Graph";break;case t.PdfAttachmentIcon.paperClip:this._iconString="Paperclip"}return this._iconString},i}(gi),Fi=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.movieAnnotation,i}return ui(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(fi),Bi=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._textMarkupType=t.PdfTextMarkupAnnotationType.highlight,o._quadPoints=new Array(8),o._boundsCollection=[],o._dictionary=new Tr,o._dictionary.update("Type",Sr.get("Annot")),void 0!==i&&(o._text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a},o._boundsCollection.push([o.bounds.x,o.bounds.y,o.bounds.width,o.bounds.height])),o._type=t._PdfAnnotationType.textMarkupAnnotation,o}return ui(i,e),Object.defineProperty(i.prototype,"textMarkUpColor",{get:function(){return void 0===this._textMarkUpColor&&this._dictionary.has("C")&&(this._textMarkUpColor=L(this._dictionary.getArray("C"))),this._textMarkUpColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.color;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._color=t,this._textMarkUpColor=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkupType",{get:function(){if(this._dictionary.has("Subtype")){var t=this._dictionary.get("Subtype");this._textMarkupType=rt(t.name)}return this._textMarkupType},set:function(t){void 0!==t&&(this._textMarkupType=t,this._dictionary.update("Subtype",Sr.get(nt(t))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boundsCollection",{get:function(){if(this._isLoaded){var t=[];if(this._dictionary.has("QuadPoints")){var e=this._dictionary.getArray("QuadPoints");if(e&&e.length>0)for(var i=e.length/8,r=0;r<i;r++){var n=e[4+8*r]-e[8*r],s=e[5+8*r]-e[1+8*r],a=Math.sqrt(n*n+s*s);n=e[6+8*r]-e[4+8*r],s=e[7+8*r]-e[5+8*r];var o=Math.sqrt(n*n+s*s),h=[e[8*r],this._page.size[1]-e[1+8*r],o,a];t.push(h)}}return t}return this._boundsCollection},set:function(t){if(!this._isLoaded&&void 0!==t)if(this._boundsCollection.length>0){this._quadPoints=new Array(8+8*t.length);for(s=0;s<t.length;s++)this._boundsCollection.push(t[Number.parseInt(s.toString(),10)])}else this._quadPoints=new Array(8),this._boundsCollection=t;if(this._isLoaded&&void 0!==t){var e=!1;if(this.boundsCollection.length===t.length){for(s=0;s<t.length;s++)for(var i=t[Number.parseInt(s.toString(),10)],r=0;r<i.length;r++)if(t[Number.parseInt(s.toString(),10)][Number.parseInt(r.toString(),10)]!==this.boundsCollection[Number.parseInt(s.toString(),10)][Number.parseInt(r.toString(),10)]){e=!0;break}}else e=!0;if(e){this._quadPoints=new Array(8*t.length);for(var n=this._page.size[1],s=0;s<t.length;s++)this._quadPoints[0+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0],this._quadPoints[1+8*Number.parseInt(s.toString(),10)]=n-t[Number.parseInt(s.toString(),10)][1],this._quadPoints[2+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0]+t[Number.parseInt(s.toString(),10)][2],this._quadPoints[3+8*Number.parseInt(s.toString(),10)]=n-t[Number.parseInt(s.toString(),10)][1],this._quadPoints[4+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0],this._quadPoints[5+8*Number.parseInt(s.toString(),10)]=this._quadPoints[1+8*s]-t[Number.parseInt(s.toString(),10)][3],this._quadPoints[6+8*Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)][0]+t[Number.parseInt(s.toString(),10)][2],this._quadPoints[7+8*Number.parseInt(s.toString(),10)]=this._quadPoints[5+8*Number.parseInt(s.toString(),10)];this._dictionary.update("QuadPoints",this._quadPoints)}}},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;this._dictionary.has("BS")?t=this.border.width:((n=new Tr(this._crossReference)).set("Type",Sr.get("Border")),n.set("W",this.border.width),this._dictionary.set("BS",n)),void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var e=this._page.size;this._setQuadPoints(e);var i=[this.bounds.x,e[1]-(this.bounds.y+this.bounds.height),this.bounds.width,this.bounds.height];if(this._dictionary.update("Subtype",Sr.get(nt(this._textMarkupType))),this._dictionary.update("Rect",[i[0],i[1],i[0]+i[2],i[1]+i[3]]),this._setAppearance){if(this._appearanceTemplate=this._createMarkupAppearance(),!this._isLoaded&&this._boundsCollection.length>1){var r=this._obtainNativeRectangle();this._dictionary.update("Rect",[r[0],r[1],r[0]+r[2],r[1]+r[3]])}this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var n=new Tr;this._appearanceTemplate._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=s,n.set("N",s),n._updated=!0,this._dictionary.set("AP",n)}void 0!==this._text&&null!==this._text&&this._dictionary.set("Contents",this._text)},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded){if((this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createMarkupAppearance(),!e)){this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var i=new Tr;this._appearanceTemplate._content.dictionary._updated=!0;var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=r,i.set("N",r),i._updated=!0,this._dictionary.set("AP",i)}!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(n=i.get("N"))&&((r=i.getRaw("N"))&&(n.reference=r),this._appearanceTemplate=new Ze(n,this._crossReference))}else if(this._postProcess(),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){if((i=this._dictionary.get("AP"))&&i.has("N")){var n=i.get("N");n&&((r=i.getRaw("N"))&&(n.reference=r),this._appearanceTemplate=new Ze(n,this._crossReference))}}else this._appearanceTemplate=this._createMarkupAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")&&!this._isLoaded){var a=this._appearanceTemplate._content.dictionary.getArray("BBox");a&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-a[0],-a[1]])}s&&void 0!==this._page.rotation&&this._page.rotation!==t.PdfRotationAngle.angle0?this._flattenAnnotationTemplate(this._appearanceTemplate,s):s&&this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary,this._appearanceTemplate)?this._flattenAnnotationTemplate(this._appearanceTemplate,s):!this._dictionary.has("AP")&&this._appearanceTemplate&&this._flattenAnnotationTemplate(this._appearanceTemplate,s)}},i.prototype._createMarkupAppearance=function(){var e,i,r=0;if(this.boundsCollection.length>1){for(var n=new Fe,s=0;s<this.boundsCollection.length;s++)(w=[])[0]=this.boundsCollection[Number.parseInt(s.toString(),10)][0],w[1]=this.boundsCollection[Number.parseInt(s.toString(),10)][1],w[2]=this.boundsCollection[Number.parseInt(s.toString(),10)][2],w[3]=this.boundsCollection[Number.parseInt(s.toString(),10)][3],n._addRectangle(w[0],w[1],w[2],w[3]);i={x:(l=n._getBounds())[0],y:l[1],width:l[2],height:l[3]},this.bounds=i,e=i.width,r=i.height}else if(this._dictionary.has("QuadPoints")){var a=this._dictionary.get("QuadPoints");if(null!==this._quadPoints)for(s=0;s<a.length/8;s++)if(this._isLoaded){for(var o=new Array,h=0,c=0;c<a.length;){var _=a[Number.parseInt(c.toString(),10)],d=a[c+1];o[Number.parseInt(h.toString(),10)]=[_,d],c+=2,h++}var p=new Fe;p._addLines(o);var l=p._getBounds();e=(i={x:l[0],y:l[1],width:l[2],height:l[3]}).width,r=i.height}else{var u=Math.floor(a[4+8*s])-Math.floor(a[0+8*s]),f=Math.floor(a[5+8*s])-Math.floor(a[1+8*s]);r=Math.sqrt(u*u+f*f),u=Math.floor(a[6+8*s])-Math.floor(a[4+8*s]),f=Math.floor(a[7+8*s])-Math.floor(a[5+8*s]),e=Math.sqrt(u*u+f*f),this.bounds={x:this.bounds.x,y:this.bounds.y,width:e,height:r}}}var g=new Ze([0,0,e,r],this._crossReference);$(g,this._getRotationAngle());var y=g.graphics;if(void 0!==this.opacity&&y.setTransparency(this.opacity,this.opacity,t.PdfBlendMode.multiply),this.textMarkUpColor){var m=new je(this.textMarkUpColor,this.border.width),b=new Ve(this.textMarkUpColor),_=0,d=0,v=0,S=0;if(this.boundsCollection.length>1)for(s=0;s<this.boundsCollection.length;s++){var w=[];w[0]=this.boundsCollection[Number.parseInt(s.toString(),10)][0],w[1]=this.boundsCollection[Number.parseInt(s.toString(),10)][1],w[2]=this.boundsCollection[Number.parseInt(s.toString(),10)][2],w[3]=this.boundsCollection[Number.parseInt(s.toString(),10)][3],this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?y.drawRectangle(w[0]-i.x,w[1]-i.y,w[2],w[3],b):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?(_=w[0]-i.x,d=w[1]-i.y+(w[3]-w[3]/2/3),v=w[2]+(w[0]-i.x),S=w[1]-i.y+(w[3]-w[3]/2/3),y.drawLine(m,_,d,v,S)):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?(_=w[0]-i.x,d=w[1]-i.y+(w[3]-w[3]/2),v=w[2]+(w[0]-i.x),S=w[1]-i.y+(w[3]-w[3]/2),y.drawLine(m,_,d,v,S)):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(m._width=.02*w[3],y.save(),y.translateTransform(w[0]-i.x,w[1]-i.y),y.setClip([0,0,w[2],w[3]]),y._drawPath(this._drawSquiggly(w[2],w[3]),m),y.restore())}else this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?y.drawRectangle(0,0,e,r,b):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?y.drawLine(m,0,r-r/2/3,e,r-r/2/3):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?y.drawLine(m,0,r/2,e,r/2):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(m._width=.02*r,y._drawPath(this._drawSquiggly(Math.round(e),Math.round(r)),m)),this._isLoaded&&this._dictionary.update("Rect",[i.x,i.y,i.x+i.width,i.y+i.height])}return g},i.prototype._drawSquiggly=function(t,e){(Math.floor(t)%2!=0||Math.round(t)>t)&&(t=Math.floor(t)+1);for(var i=new Fe,r=new Array,n=Math.ceil(t/e*16),s=t/(n/2),a=parseFloat((.6*(s+s)).toFixed(2)),o=a,h=0,c=0;c<n;c++){var _=e-a+o-.02*e,d=[h,parseFloat(_.toFixed(2))];r.push(d),o=0===o?a:0,h+=s}return i._addLines(r),i},i.prototype._setQuadPoints=function(t){var e=[],i=t[1];this._boundsCollection[0]=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];for(var r=this._quadPoints.length/8,n=0;n<r;n++){var s=this._boundsCollection[Number.parseInt(n.toString(),10)][0],a=this._boundsCollection[Number.parseInt(n.toString(),10)][1];e[0+8*n]=s,e[1+8*n]=i-a,e[2+8*n]=s+this._boundsCollection[Number.parseInt(n.toString(),10)][2],e[3+8*n]=i-a,e[4+8*n]=s,e[5+8*n]=e[1+8*n]-this._boundsCollection[Number.parseInt(n.toString(),10)][3],e[6+8*n]=s+this._boundsCollection[Number.parseInt(n.toString(),10)][2],e[7+8*n]=e[5+8*n]}this._points=e,this._dictionary.set("QuadPoints",this._points)},i}(gi),Li=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._watermarkText="",o._dictionary=new Tr,o._dictionary.update("Type",Sr.get("Annot")),o._dictionary.update("Subtype",Sr.get("Watermark")),void 0!==i&&(o._watermarkText=i,o.text=i),void 0!==r&&void 0!==n&&void 0!==s&&void 0!==a&&(o.bounds={x:r,y:n,width:s,height:a}),o._type=t._PdfAnnotationType.watermarkAnnotation,o}return ui(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new Tr(this._crossReference);e.set("Type",Sr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),void 0===this.color&&(this.color=[0,0,0]),this._appearanceTemplate=this._createWatermarkAppearance(),this._dictionary.update("Rect",Ft(this)),void 0!==this.opacity&&1!==this._opacity&&this._dictionary.set("CA",this._opacity)},i.prototype._createWatermarkAppearance=function(){var e=this._obtainFont();(void 0===e||null===e||!this._isLoaded&&1===e.size)&&(e=this._lineCaptionFont,this._pdfFont=e),this._rotateAngle=this._getRotationAngle(),(void 0!==this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0||this._rotateAngle!==t.PdfRotationAngle.angle0)&&(0===this._rotateAngle&&(this._rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this._rotateAngle));var i=[0,0,this.bounds.width,this.bounds.height],r=new li(this,i);r.normal=new Ze(i,this._crossReference);var n=r.normal;$(n,this._rotateAngle);var s,a=r.normal.graphics,o=this.border.width/2,h=new Vt(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top),c=new je(this.color,o);this.innerColor&&(s=new Ve(this._innerColor)),this._isLoaded?(this._dictionary.has("Contents")&&(this._watermarkText=this._dictionary.get("Contents")),this._dictionary.update("Contents",this._watermarkText)):this._dictionary.update("Contents",this._watermarkText),void 0!==this._watermarkText&&a.drawString(this._watermarkText,e,[0,0,0,0],c,s,h),this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var _=new Tr;a._template._content.dictionary._updated=!0;var d=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(d,a._template._content),a._template._content.reference=d,_.set("N",d),_._updated=!0,this._dictionary.set("AP",_),n},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded)t||(this._appearanceTemplate=this._createWatermarkAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((r=e.getRaw("N"))&&(i.reference=r),this._appearanceTemplate=new Ze(i,this._crossReference));else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){var r=e.getRaw("N");r&&(i.reference=r),this._appearanceTemplate=new Ze(i,this._crossReference)}}}else this._appearanceTemplate=this._createWatermarkAppearance();if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}},i}(fi),Mi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._icon=t.PdfRubberStampAnnotationIcon.draft,a._stampWidth=0,a._iconString="",a.rotateAngle=0,a._stampAppearanceFont=new ke(t.PdfFontFamily.helvetica,20,t.PdfFontStyle.italic|t.PdfFontStyle.bold),a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("Stamp")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.rubberStampAnnotation,a}return ui(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=at(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",Sr.get("#"+this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"appearance",{get:function(){if(this._isLoaded)return null;if(void 0===this._appearance){var t=[0,0,this.bounds.width,this.bounds.height];this._appearance=new li(this,t),this._appearance.normal=new Ze(t,this._crossReference)}return this._appearance},enumerable:!0,configurable:!0}),i.prototype.createTemplate=function(){var t;if(this._isLoaded)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){(t=new Ze)._isExported=!0;var r=i.dictionary,n=r.getArray("Matrix"),s=r.getArray("BBox");if(n){for(var a=[],o=0;o<n.length;o++){var h=n[Number.parseInt(o.toString(),10)];a[Number.parseInt(o.toString(),10)]=h}if(s&&s.length>3){var c=C(s),_=this._transformBBox(c,a);t._size=[_[2],_[3]]}}else s&&(r.update("Matrix",[1,0,0,1,-s[0],-s[1]]),t._size=[s[2],s[3]]);t._exportStream(e,this._crossReference)}}}else t=this._createRubberStampAppearance();return t},Object.defineProperty(i.prototype,"_innerTemplateBounds",{get:function(){var t;return this._isLoaded&&((t=this._obtainInnerBounds()).x=this.bounds.x,t.y=this.bounds.y),t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(){var t;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new Tr(this._crossReference);e.set("Type",Sr.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0),this._appearanceTemplate=this._createRubberStampAppearance()},i.prototype._transformBBox=function(t,e){var i=[],r=[],n=this._transformPoint(t.x,t.height,e);i[0]=n[0],r[0]=n[1];var s=this._transformPoint(t.width,t.y,e);i[1]=s[0],r[1]=s[1];var a=this._transformPoint(t.x,t.y,e);i[2]=a[0],r[2]=a[1];var o=this._transformPoint(t.width,t.height,e);return i[3]=o[0],r[3]=o[1],[this._minValue(i),this._minValue(r),this._maxValue(i),this._maxValue(r)]},i.prototype._transformPoint=function(t,e,i){var r=[];return r[0]=t*i[0]+e*i[2]+i[4],r[1]=t*i[1]+e*i[3]+i[5],r},i.prototype._minValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[Number.parseInt(i.toString(),10)]<e&&(e=t[Number.parseInt(i.toString(),10)]);return e},i.prototype._maxValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[Number.parseInt(i.toString(),10)]>e&&(e=t[Number.parseInt(i.toString(),10)]);return e},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1);var i=!1;if(this._isLoaded&&(this._setAppearance||e||this._isExport)){if((!e&&!this._isExport||this._setAppearance)&&(this._appearanceTemplate=this._createRubberStampAppearance()),!this._appearanceTemplate&&(this._isExport||e)&&this._dictionary.has("AP")&&(l=this._dictionary.get("AP"))&&l.has("N")&&(u=l.get("N"))){(f=l.getRaw("N"))&&(u.reference=f);var r=!1;if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var n=!1,s=void 0,a=void 0;if(u&&((n=this._page.rotation===t.PdfRotationAngle.angle0&&this.rotateAngle===t.PdfRotationAngle.angle0)||(n=this._page.rotation!==t.PdfRotationAngle.angle0&&this.rotateAngle===t.PdfRotationAngle.angle0)),this._appearanceTemplate=new Ze(u,this._crossReference),r=!0,i=!!n){var o=u.dictionary.getArray("Matrix");if(o){for(var h=[],c=0;c<o.length;c++){var _=o[Number.parseInt(c.toString(),10)];h[Number.parseInt(c.toString(),10)]=_}var d=u.dictionary.getArray("BBox");if(d&&d.length>3){a=C(d);var p=this._transformBBox(a,h);s=[p[2],p[3]],this._appearanceTemplate._size=s}else s=[a.width,a.height]}}else s=[a.width,a.height]}r||(this._appearanceTemplate=new Ze(u,this._crossReference))}}else if(this._isImported&&this._dictionary.has("AP")||this._postProcess(),!this._appearanceTemplate&&(e||this._isImported))if(this._dictionary.has("AP")){var l=this._dictionary.get("AP");if(l&&l.has("N")){var u=l.get("N");if(u){var f=l.getRaw("N");f&&(u.reference=f),this._appearanceTemplate=new Ze(u,this._crossReference)}}}else this._appearanceTemplate=this._createRubberStampAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var g=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var y=this._appearanceTemplate._content.dictionary.getArray("BBox");y&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-y[0],-y[1]])}i?this._flattenAnnotationTemplate(this._appearanceTemplate,i):this._flattenAnnotationTemplate(this._appearanceTemplate,g)}},i.prototype._createRubberStampAppearance=function(){var e,i=[0,0,this.bounds.width,this.bounds.height];this._appearance?(e=this._appearance,this._dictionary.has("Name")||this._dictionary.update("Name",Sr.get("#23CustomStamp"))):(this._iconString=this._obtainIconName(this.icon),this._dictionary.update("Name",Sr.get("#23"+this._iconString)),(e=new li(this,i)).normal=new Ze(i,this._crossReference));var r=e.normal;void 0===this._rotate||this._rotate===t.PdfRotationAngle.angle0&&0===this._getRotationAngle()||(this.rotateAngle=this._getRotationAngle(),0===this.rotateAngle&&(this.rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this.rotateAngle)),$(r,this.rotateAngle),this._appearance||this._drawStampAppearance(r),this._dictionary.has("AP")&&wt(this._dictionary.get("AP"),this._crossReference,"N");var n=new Tr;r._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(s,r._content),r._content.reference=s,n.set("N",s),n._updated=!0,this._dictionary.set("AP",n),this._dictionary.set("Border",[this.border.hRadius,this.border.vRadius,this.border.width]),this._dictionary.update("Rect",Ft(this)),r},i.prototype._drawStampAppearance=function(e){var i=new Vt;i.alignment=t.PdfTextAlignment.center,i.lineAlignment=t.PdfVerticalAlignment.middle;var r=new Ve(this._obtainBackGroundColor()),n=new je(this._obtainBorderColor(),this.border.width),s=e.graphics;s.save(),s.scaleTransform(e._size[0]/(this._stampWidth+4),e._size[1]/28);var a=this._stampAppearanceFont;this._drawRubberStamp(s,n,r,a,i),s.restore()},i.prototype._obtainIconName=function(e){switch(e){case t.PdfRubberStampAnnotationIcon.approved:this._iconString="Approved",this._stampWidth=126;break;case t.PdfRubberStampAnnotationIcon.asIs:this._iconString="AsIs",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.confidential:this._iconString="Confidential",this._stampWidth=166;break;case t.PdfRubberStampAnnotationIcon.departmental:this._iconString="Departmental",this._stampWidth=186;break;case t.PdfRubberStampAnnotationIcon.draft:this._iconString="Draft",this._stampWidth=90;break;case t.PdfRubberStampAnnotationIcon.experimental:this._iconString="Experimental",this._stampWidth=176;break;case t.PdfRubberStampAnnotationIcon.expired:this._iconString="Expired",this._stampWidth=116;break;case t.PdfRubberStampAnnotationIcon.final:this._iconString="Final",this._stampWidth=90;break;case t.PdfRubberStampAnnotationIcon.forComment:this._iconString="ForComment",this._stampWidth=166;break;case t.PdfRubberStampAnnotationIcon.forPublicRelease:this._iconString="ForPublicRelease",this._stampWidth=240;break;case t.PdfRubberStampAnnotationIcon.notApproved:this._iconString="NotApproved",this._stampWidth=186;break;case t.PdfRubberStampAnnotationIcon.notForPublicRelease:this._iconString="NotForPublicRelease",this._stampWidth=290;break;case t.PdfRubberStampAnnotationIcon.sold:this._iconString="Sold",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.topSecret:this._iconString="TopSecret",this._stampWidth=146;break;case t.PdfRubberStampAnnotationIcon.completed:this._iconString="Completed",this._stampWidth=136;break;case t.PdfRubberStampAnnotationIcon.void:this._iconString="Void",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.informationOnly:this._iconString="InformationOnly",this._stampWidth=230;break;case t.PdfRubberStampAnnotationIcon.preliminaryResults:this._iconString="PreliminaryResults",this._stampWidth=260}return this._iconString},i.prototype._obtainBackGroundColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?[251,222,221]:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?[229,238,222]:[219,227,240]},i.prototype._obtainBorderColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?[151,23,15]:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?[73,110,38]:[24,37,100]},i.prototype._drawRubberStamp=function(t,e,i,r,n){t.drawRoundedRectangle(2,1,this._stampWidth,26,3,e,i);var s=new Ve(this._obtainBorderColor());t.drawString(this._iconString.toUpperCase(),r,[this._stampWidth/2+1,15,0,0],null,s,n)},i.prototype._obtainInnerBounds=function(){var t={x:0,y:0,width:0,height:0};if(this._dictionary&&this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i&&void 0!==i.dictionary){var r=i.dictionary;if(r.has("BBox")){var n=r.getArray("BBox");n&&4===n.length&&(t=C(n))}}}}return t},i}(gi),Di=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.soundAnnotation,i}return ui(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(gi),Oi=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._intentString="",a._markUpFont=new ke(t.PdfFontFamily.helvetica,7,t.PdfFontStyle.regular),a._textAlignment=t.PdfTextAlignment.left,a._cropBoxValueX=0,a._cropBoxValueY=0,a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("FreeText")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.freeTextAnnotation,a}return ui(i,e),Object.defineProperty(i.prototype,"calloutLines",{get:function(){return void 0===this._calloutLines&&(this._calloutLines=this._getCalloutLinePoints()),this._calloutLines},set:function(t){this._isLoaded||(this._calloutLines=t);var e=!1;if(this._isLoaded&&t.length>=2)if(this._calloutLines.length===t.length){for(a=0;a<t.length;a++)for(var i=t[Number.parseInt(a.toString(),10)],r=0;r<i.length;r++)if(t[Number.parseInt(a.toString(),10)][Number.parseInt(r.toString(),10)]!==this._calloutLines[Number.parseInt(a.toString(),10)][Number.parseInt(r.toString(),10)]){e=!0;break}}else e=!0;if(e){for(var n=this._page.size[1],s=[],a=0;a<t.length&&a<t.length;a++)s.push(t[Number.parseInt(a.toString(),10)][0]+this._cropBoxValueX),s.push(n+this._cropBoxValueY-t[Number.parseInt(a.toString(),10)][1]);this._calloutLines=t,this._dictionary.update("CL",s)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineEndingStyle",{get:function(){return this._lineEndingStyle=this._obtainLineEndingStyle(),this._lineEndingStyle},set:function(t){void 0!==t&&this._dictionary.update("LE",Sr.get(O(t))),this._lineEndingStyle=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkUpColor",{get:function(){if(void 0===this._textMarkUpColor){var t=void 0;if(this._dictionary.has("TextColor"))return this._textMarkUpColor=L(this._dictionary.getArray("TextColor")),this._textMarkUpColor;if(this._dictionary.has("DS"))for(var e=this._dictionary.get("DS").split(";"),i=0;i<e.length;i++)if(-1!==e[Number.parseInt(i.toString(),10)].indexOf("color"))return(t=e[Number.parseInt(i.toString(),10)].split(":")[1]).startsWith("#")&&(t=t.substring(1)),this._textMarkUpColor=B(t),this._textMarkUpColor;!this._textMarkUpColor&&this._dictionary.has("RC")}return this._textMarkUpColor},set:function(t){if(void 0!==t&&3===t.length){this._textMarkUpColor=t;var e="font:"+this.font._metrics._postScriptName+" "+this.font._size+"pt;style:"+ut(this.font._style)+";color:"+this._colorToHex(t);this._dictionary.update("DS",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){return this._font||(this._font=this._obtainFont(),(null===this._font||void 0===this._font||!this._isLoaded&&1===this._font.size)&&(this._font=this._markUpFont)),this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("DA")&&(this._borderColor=this._obtainColor()),this._borderColor},set:function(t){void 0!==t&&3===t.length&&(this._borderColor=t,this._dictionary.update("DA",this._getBorderColorString(this.borderColor)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"annotationIntent",{get:function(){return this._dictionary.has("IT")?this._annotationIntent=lt(this._dictionary.get("IT").name):this._annotationIntent=t.PdfAnnotationIntent.none,this._annotationIntent},set:function(e){void 0!==e&&(this._annotationIntent=e,e===t.PdfAnnotationIntent.none?this._dictionary.update("Subj","Text Box"):this._dictionary.update("IT",Sr.get(this._obtainAnnotationIntent(this._annotationIntent))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._setPaddings=function(t){this._paddings=t},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new Tr(this._crossReference);i.set("Type",Sr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._dictionary.has("C")||(this._isTransparentColor=!0),this._updateCropBoxValues(),(t||this._setAppearance)&&(this._appearanceTemplate=this._createAppearance()),t||(this._dictionary.update("Rect",Ft(this)),this._saveFreeTextDictionary())},i.prototype._updateCropBoxValues=function(){if(this._page){var t=void 0;this._page._pageDictionary.has("CropBox")?t=this._page._pageDictionary.getArray("CropBox"):this._page._pageDictionary.has("MediaBox")&&(t=this._page._pageDictionary.getArray("MediaBox")),t&&(this._cropBoxValueX=t[0],this._cropBoxValueY=t[1])}},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded)(this._setAppearance||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&e&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(r=i.get("N"))&&((h=i.getRaw("N"))&&(r.reference=h),this._appearanceTemplate=new Ze(r,this._crossReference));else if(this._postProcess(e),!this._appearanceTemplate&&e)if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){var r=i.get("N");r&&((h=i.getRaw("N"))&&(r.reference=h),this._appearanceTemplate=new Ze(r,this._crossReference))}}else this._appearanceTemplate=this._createAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")&&!this._isLoaded){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}n&&void 0!==this._page.rotation&&this._page.rotation!==t.PdfRotationAngle.angle0?this._flattenAnnotationTemplate(this._appearanceTemplate,n):this._appearanceTemplate&&!this._dictionary.has("AP")?this._flattenAnnotationTemplate(this._appearanceTemplate,n):this._dictionary.has("AP")&&this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate)&&this._flattenAnnotationTemplate(this._appearanceTemplate,n)}if(!e&&this._setAppearance){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{var o=this._crossReference._getNextReference();a=new Tr(this._crossReference),this._crossReference._cacheMap.set(o,a),this._dictionary.update("AP",o)}wt(a,this._crossReference,"N");var h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,this._appearanceTemplate._content),a.update("N",h)}},i.prototype._isValidTemplateMatrix=function(t,e,i){var r=!0,n=e;if(t&&t.has("Matrix")){var s=t.getArray("BBox"),a=t.getArray("Matrix");if(a&&s&&a.length>3&&s.length>2&&void 0!==a[0]&&void 0!==a[1]&&void 0!==a[2]&&void 0!==a[3]&&1===a[0]&&0===a[1]&&0===a[2]&&1===a[3]&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&(Math.round(s[0])!==Math.round(-a[4])&&Math.round(s[1])!==Math.round(-a[5])||0===s[0]&&0===Math.round(-a[4]))){var o=this._page.graphics,h=o.save();void 0!==this.opacity&&this._opacity<1&&o.setTransparency(this._opacity),n.x-=s[0],n.y+=s[1],o.drawTemplate(i,n),o.restore(h),this._removeAnnotationFromPage(this._page,this),r=!1}}return r},i.prototype._createAppearance=function(){var e,i=this.border.width/2,r=this._obtainAppearanceBounds(),n=this.rotate;0!==n&&90!==n&&180!==n&&270!==n||(this._isAllRotation=!1),$(e=n>0&&this._isAllRotation?new Ze([0,0,r[2],r[3]],this._crossReference):new Ze(r,this._crossReference),this._getRotationAngle());var s=new Ji,a=this._obtainText();e._writeTransformation=!1;var o=e.graphics,h=this._obtainTextAlignment(),c=this._obtainColor(),_=new je(c,this.border.width);this.border.width>0&&(s.borderPen=_);var d=this._obtainStyle(_,r,i,s);if(this.color&&(s.foreBrush=new Ve(this._color)),this.textMarkUpColor&&(s.backBrush=new Ve(this._textMarkUpColor)),s.borderWidth=this.border.width,this.calloutLines&&this._calloutLines.length>=2){if(this._drawCallOuts(o,_),this._isLoaded&&void 0===this._lineEndingStyle&&(this._lineEndingStyle=this.lineEndingStyle),this._lineEndingStyle!==t.PdfLineEndingStyle.none){var p=this._obtainLinePoints(),l=this._getAngle(p),u=this._getAxisValue([p[2],p[3]],90,0);this._drawLineEndStyle(u,o,l,_,s.foreBrush,this.lineEndingStyle,this.border.width,!1)}(d=this._dictionary.has("RD")?[d[0],-d[1],d[2],-d[3]]:[this.bounds.x,-(this._page.size[1]-(this.bounds.y+this.bounds.height)),this.bounds.width,-this.bounds.height])[0]=d[0]+this._cropBoxValueX,d[1]=d[1]-this._cropBoxValueY,this._calculateRectangle(d),s.bounds=d}else d=[d[0],-d[1],d[2],-d[3]],s.bounds=d;for(var f=this._obtainAppearanceBounds(),g=[d[0]-f[0],-d[1]-f[1],d[2]-f[2],-d[1]-f[1]-d[3]-f[3]],y=0;y<g.length;y++)g[Number.parseInt(y.toString(),10)]<0&&(g[Number.parseInt(y.toString(),10)]=-g[Number.parseInt(y.toString(),10)]);this._dictionary.update("RD",g),this.opacity&&this._opacity<1&&(o.save(),o.setTransparency(this._opacity)),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&o.save(),this._drawFreeTextRectangle(o,s,d,h),this._drawFreeMarkUpText(o,s,d,a,h),this.opacity&&this._opacity<1&&o.restore(),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&o.restore();var m=this._obtainAppearanceBounds();return this._dictionary.set("Rect",[m[0],m[1],m[0]+m[2],m[1]+m[3]]),e},i.prototype._calculateRectangle=function(t){for(var e=this._obtainAppearanceBounds(),i=[t[0]-e[0],-t[1]-e[1],t[2]-e[2],-t[1]-e[1]-t[3]-e[3]],r=0;r<4;r++)i[Number.parseInt(r.toString(),10)]<0&&(i[Number.parseInt(r.toString(),10)]=-i[Number.parseInt(r.toString(),10)]);this._dictionary.set("RD",i)},i.prototype._obtainAnnotationIntent=function(e){switch(e){case t.PdfAnnotationIntent.freeTextCallout:this._intentString="FreeTextCallout";break;case t.PdfAnnotationIntent.freeTextTypeWriter:this._intentString="FreeTextTypeWriter"}return this._intentString},i.prototype._obtainFont=function(){var t=this._obtainFontDetails();return!t.size&&this._dictionary.has("RC"),It(t.name,t.size,t.style,this)},i.prototype._drawFreeMarkUpText=function(e,i,r,n,s){var a=!1,o=this.rotate;if(this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation?0!==o||this._isAllRotation||(r=[r[0],r[1]+r[3],r[2],r[3]]):r=[r[1]+r[3],-(r[0]+r[2]),-r[3],r[2]]:r=[-(r[0]+r[2]),-r[3],r[2],-r[3]]:r=[-r[1],r[0],-r[3],r[2]],(void 0===this._font||null===this._font||!this._isLoaded&&1===this._font.size)&&(this._font=this._markUpFont),o>0&&this._isAllRotation){a=!0;var h=this.bounds,c=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),_=this._font.measureString(n,[0,0],c,0,0);o>0&&o<=91?e.translateTransform(_[1],-h.height):o>91&&o<=181?e.translateTransform(h.width-_[1],-(h.height-_[1])):o>181&&o<=271?e.translateTransform(h.width-_[1],-_[1]):o>271&&o<360&&e.translateTransform(_[1],-_[1]),e.rotateTransform(o),i.bounds=[0,0,i.bounds[2],i.bounds[3]]}var d=[r[0],r[1],r[2],r[3]];if(this._paddings&&!this._isLoaded){var p=this._paddings._left,l=this._paddings._top,u=this._paddings._right+this._paddings._left,f=this._paddings._top+this._paddings._bottom;if(i.borderWidth>0){r=[r[0]+(i.borderWidth+p),r[1]+(i.borderWidth+l),m=r[2]-(2*i.borderWidth+u),r[3]>0?r[3]-(2*i.borderWidth+f):-r[3]-(2*i.borderWidth+f)]}else{var g=r[0]+p,y=r[1]+l,m=r[2]-u;r=[g,y,m,r[3]>0?r[3]-f:-r[3]-f]}}else i.borderWidth>0&&(r=[r[0]+1.5*i.borderWidth,r[1]+1.5*i.borderWidth,r[2]-3*i.borderWidth,r[3]>0?r[3]-3*i.borderWidth:-r[3]-3*i.borderWidth]);var b=this._font._metrics._getHeight()>(r[3]>0?r[3]:-r[3]),v=this._font._metrics._getHeight()<=(d[3]>0?d[3]:-d[3]),S=b&&v;this._drawFreeTextAnnotation(e,i,n,this._font,S?d:r,!0,s,a)},i.prototype._drawFreeTextRectangle=function(e,i,r,n){if(this._dictionary.has("BE")){for(var s=0;s<r.length;s++)r[Number.parseInt(s.toString(),10)]<0&&(r[Number.parseInt(s.toString(),10)]=-r[Number.parseInt(s.toString(),10)]);this._drawAppearance(e,i,r),this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation||e.rotateTransform(-270):e.rotateTransform(-180):e.rotateTransform(-90)}else this.rotationAngle!==t.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==t.PdfRotationAngle.angle270||this._isAllRotation||(e.rotateTransform(-270),i.bounds=[r[1]+r[3],-r[0],-r[3],-r[2]]):(e.rotateTransform(-180),i.bounds=[-(r[2]+r[0]),-(r[3]+r[1]),r[2],r[3]]):(e.rotateTransform(-90),i.bounds=[-r[1],r[2]+r[0]-r[3],-r[2]]),this._drawFreeTextAnnotation(e,i,"",this._font,i.bounds,!1,n,!1)},i.prototype._drawAppearance=function(t,e,i){var r=new Fe;if(r._addRectangle(i[0],i[1],i[2],i[3]),this._dictionary.has("BE")){var n=this._dictionary.get("BE");if(n&&n.has("I")){var s=1===n.get("I")?4:9;this._drawCloudStyle(t,e.foreBrush,e.borderPen,s,.833,r._points,!0)}}},i.prototype._drawFreeTextAnnotation=function(e,i,r,n,s,a,o,h){if(a){var c=new Vt;c.lineAlignment=t.PdfVerticalAlignment.top,c.alignment=o,c.lineSpacing=0,h?e.drawString(r,n,i.bounds,null,i.backBrush,c):e.drawString(r,n,s,null,i.backBrush,c)}else e.drawRectangle(s[0],s[1],s[2],s[3],i.borderPen,i.foreBrush)},i.prototype._getCalloutLinePoints=function(){if(this._dictionary.has("CL")){var t=this._dictionary.getArray("CL");if(t){this._calloutLines=[];for(var e=0;e<t.length;e+=2){var i=[t[Number.parseInt(e.toString(),10)],this._page.size[1]-t[e+1]];this._calloutLines.push(i)}}}return this._calloutLines},i.prototype._obtainAppearanceBounds=function(){var e=[0,0,0,0];if(this.calloutLines&&this._calloutLines.length>0){for(var i=new Fe,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push([0,0]);if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[Number.parseInt(s.toString(),10)]=[this._calloutsClone[Number.parseInt(s.toString(),10)][0],this._calloutsClone[Number.parseInt(s.toString(),10)][1]]}r.length>0&&(this.lineEndingStyle!==t.PdfLineEndingStyle.none&&this._expandAppearance(r),i._addLines(r)),i._addRectangle(this.bounds.x-2,this._page.size[1]-(this.bounds.y+this.bounds.height)-2,this.bounds.width+4,this.bounds.height+4),e=i._getBounds()}else e=[this.bounds.x,this._page.size[1]-(this.bounds.y+this.bounds.height),this.bounds.width,this.bounds.height];return e},i.prototype._obtainCallOutsNative=function(){if(this.calloutLines&&this._calloutLines.length>0){var t=this._page.size;this._calloutsClone=[];for(var e=0;e<this._calloutLines.length;e++)this._calloutsClone.push([this._calloutLines[Number.parseInt(e.toString(),10)][0],t[1]-this._calloutLines[Number.parseInt(e.toString(),10)][1]])}},i.prototype._obtainLinePoints=function(){var t=this._page.size[1];return[this.calloutLines[1][0],t-this.calloutLines[1][1],this.calloutLines[0][0],t-this.calloutLines[0][1]]},i.prototype._obtainLineEndingStyle=function(){var e=t.PdfLineEndingStyle.square;return this._dictionary.has("LE")&&(e=E(this._dictionary.get("LE").name,e)),e},i.prototype._obtainText=function(){var t="";if(this._dictionary.has("Contents")){var e=this._dictionary.get("Contents");return e&&(t=e),t&&""!==t&&(this._text=t),t}return this._dictionary.has("RC")?t=this._rcText:t},i.prototype._obtainTextAlignment=function(){var e,i=t.PdfTextAlignment.left;if(this._dictionary.has("Q")?void 0!==(r=this._dictionary.get("Q"))&&(i=r,e=!0):this._dictionary.has("RC"),!e&&this._dictionary.has("DS"))for(var r=this._dictionary.get("DS"),n=r.split(";"),s=0;s<n.length;s++)if(-1!==n[Number.parseInt(s.toString(),10)].indexOf("text-align"))switch(n[Number.parseInt(s.toString(),10)]){case"left":i=t.PdfTextAlignment.left;break;case"right":i=t.PdfTextAlignment.right;break;case"center":i=t.PdfTextAlignment.center;break;case"justify":i=t.PdfTextAlignment.justify}return i},i.prototype._obtainColor=function(){var t;if(this._isLoaded)if(this._dictionary.has("DA")){var e=this._dictionary.get("DA");Array.isArray(e)&&e.length>0?t=[e[0],e[1],e[2]]:"string"==typeof e&&(this._da=new pi(e),t=this._da.color)}else if(this._dictionary.has("MK")){var i=this._mkDictionary;i&&i.has("BC")&&(t=L(i.getArray("BC")))}else t=[0,0,0];else t=this._borderColor?this._borderColor:[0,0,0];return t},i.prototype._expandAppearance=function(e){var i=e[0][1],r=e[0][0];i>this.bounds.y?this.lineEndingStyle!==t.PdfLineEndingStyle.openArrow&&(e[0][1]-=11*this.border.width):e[0][1]+=11*this.border.width,r<=this.bounds.x?e[0][0]-=11*this.border.width:e[0][0]+=11*this.border.width},i.prototype._drawCallOuts=function(t,e){for(var i=new Fe,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push([0,0]);if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[Number.parseInt(s.toString(),10)]=[this._calloutsClone[Number.parseInt(s.toString(),10)][0],-this._calloutsClone[Number.parseInt(s.toString(),10)][1]]}r.length>0&&i._addLines(r),t._drawPath(i,e)},i.prototype._saveFreeTextDictionary=function(){(void 0===this.font||null===this.font||!this._isLoaded&&1===this.font.size)&&(this.font=this._markUpFont),this._dictionary.update("Contents",this.text),this._isLoaded&&(this._textAlignment=this.textAlignment),this._dictionary.update("Q",this._textAlignment),this.annotationIntent===t.PdfAnnotationIntent.none?this._dictionary.update("Subj","Text Box"):this._dictionary.update("IT",Sr.get(this._obtainAnnotationIntent(this._annotationIntent)));var e="font:"+this.font._metrics._postScriptName+" "+this.font._size+"pt;style:"+ut(this.font._style)+";color:"+this._colorToHex(this.textMarkUpColor);this._dictionary.update("DS",e),this._dictionary.update("DA",this._getBorderColorString(this.borderColor?this._borderColor:[0,0,0]));if(this._dictionary.update("RC",'<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml"><p dir="ltr">'+(this.text?this._getXmlFormattedString(this.text):"")+"</p></body>"),this._calloutLines&&this._calloutLines.length>=2){for(var i=this._page.size[1],r=[],n=0;n<this._calloutLines.length&&n<3;n++)r.push(this._calloutLines[Number.parseInt(n.toString(),10)][0]+this._cropBoxValueX),r.push(i+this._cropBoxValueY-this._calloutLines[Number.parseInt(n.toString(),10)][1]);this._dictionary.update("CL",r)}if(this._setAppearance){var s=this._obtainAppearanceBounds();this._dictionary.update("Rect",[s[0],s[1],s[0]+s[2],s[1]+s[3]])}},i.prototype._getXmlFormattedString=function(t){return t=t.replace("&","&amp;"),t=t.replace("<","&lt;"),t=t.replace(">","&gt;")},i}(gi),Ei=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._textAlignment=t.PdfTextAlignment.left,a._dictionary=new Tr,a._dictionary.update("Type",Sr.get("Annot")),a._dictionary.update("Subtype",Sr.get("Redact")),void 0!==i&&void 0!==r&&void 0!==n&&void 0!==s&&(a.bounds={x:i,y:r,width:n,height:s}),a._type=t._PdfAnnotationType.redactionAnnotation,a}return ui(i,e),Object.defineProperty(i.prototype,"repeatText",{get:function(){return void 0===this._repeat&&this._dictionary.has("Repeat")&&(this._repeat=this._dictionary.get("Repeat")),this._repeat},set:function(t){t!==this._repeat&&(this._repeat=t,this._dictionary&&this._dictionary.update("Repeat",t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textColor",{get:function(){return void 0===this._textColor&&this._dictionary.has("C")&&(this._textColor=L(this._dictionary.getArray("C"))),this._textColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.textColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._textColor=t,this._dictionary.update("C",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("OC")&&(this._borderColor=L(this._dictionary.getArray("OC"))),this._borderColor},set:function(t){if(void 0!==t&&3===t.length){var e=this.borderColor;this._isLoaded&&void 0!==e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||(this._borderColor=t,this._dictionary.update("OC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"overlayText",{get:function(){return void 0===this._overlayText&&this._dictionary.has("OverlayText")&&(this._overlayText=this._dictionary.get("OverlayText")),this._overlayText},set:function(t){"string"==typeof t&&(this._dictionary.update("OverlayText",t),this._overlayText=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new Tr(this._crossReference);i.set("Type",Sr.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._setAppearance&&(this._appearanceTemplate=this._createRedactionAppearance(t)),this._dictionary.update("Rect",Ft(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),!this._isImported){if(this._isLoaded)this._appearanceTemplate=this._createRedactionAppearance(t);else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e&&e.has("N")){var i=e.get("N");if(i){var r=e.getRaw("N");r&&(i.reference=r),this._appearanceTemplate=new Ze(i,this._crossReference)}}}else this._appearanceTemplate=this._createRedactionAppearance(t);if(t&&this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var s=this._appearanceTemplate._content.dictionary.getArray("BBox");s&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-s[0],-s[1]])}this._flattenAnnotationTemplate(this._appearanceTemplate,n)}}},i.prototype._createRedactionAppearance=function(t){var e=this._createNormalAppearance();if(t)this._isLoaded&&null!==this._page&&this._removeAnnotationFromPage(this._page,this);else{var i=this._createBorderAppearance();if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");wt(r,this._crossReference,"N"),wt(r,this._crossReference,"R")}var n=new Tr(this._crossReference);i._content.dictionary._updated=!0;var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,i._content),i._content.reference=s,n.set("N",s),e._content.dictionary._updated=!0;var a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,e._content),e._content.reference=a,n.set("R",a),n._updated=!0,this._dictionary.set("AP",n)}return e},i.prototype._createBorderAppearance=function(){var t,e=[0,0,this.bounds.width,this.bounds.height],i=new Ze(e,this._crossReference),r=this.border.width/2,n=i.graphics,s=this.border.width;this.border.width>0&&this.borderColor&&(t=new je(this.borderColor,s));var a=[e[0],e[1],e[2],e[3]];if(this.opacity<1){var o=n.save();n.setTransparency(this.opacity),n.drawRectangle(a[0]+r,a[1]+r,a[2]-s,a[3]-s,t,null),n.restore(o)}else n.drawRectangle(a[0]+r,a[1]+r,a[2]-s,a[3]-s,t,null);return i},i.prototype._createNormalAppearance=function(){var e=[0,0,this.bounds.width,this.bounds.height],i=new Ze(e,this._crossReference);$(i,this._getRotationAngle());var r,n=this.border.width/2,s=i.graphics,a=new Ji;this.textColor&&this.border.width>0&&(r=new je(this.textColor,this.border.width));var o,h;this.innerColor&&(o=new Ve(this.innerColor)),h=new Ve(this.textColor?this.textColor:[128,128,128]),a.backBrush=o,a.borderWidth=n;var c=this.border.width,_=[e[0],e[1],e[2],e[3]];if(this.opacity<1){var d=s.save();s.setTransparency(this.opacity),s.drawRectangle(_[0]+n,_[1]+n,_[2]-c,_[3]-c,r,o),s.restore(d)}else s.drawRectangle(_[0]+n,_[1]+n,_[2]-c,_[3]-c,r,o);if(s.restore(),this.overlayText&&""!==this._overlayText){var p=0,l=0;void 0!==this.font&&null!==this.font||(this.font=this._lineCaptionFont);var u=0,f=0,g=0,y=void 0;this._isLoaded&&(this._textAlignment=this.textAlignment);var m=new Vt(this._textAlignment,t.PdfVerticalAlignment.middle),b=this.font.measureString(this.overlayText,[0,0],m,0,0);if(this._isLoaded&&void 0===this._repeat&&(this._repeat=this.repeatText),this._repeat){b[0]<=0&&(b[0]=1),p=this.bounds.width/b[0],l=Math.floor(this.bounds.height/this.font._size),g=Math.abs(this.bounds.width-Math.floor(p)*b[0]),this._textAlignment===t.PdfTextAlignment.center&&(f=g/2),this._textAlignment===t.PdfTextAlignment.right&&(f=g);for(var v=1;v<p;v++){for(var S=0;S<l;S++)y=[f,u,0,0],s.drawString(this.overlayText,this.font,y,null,h,null),u+=this.font._size;f+=b[0],u=0}}else g=Math.abs(this.bounds.width-b[0]),this._textAlignment===t.PdfTextAlignment.center&&(f=g/2),this._textAlignment===t.PdfTextAlignment.right&&(f=g),y=[f,0,0,0],s.drawString(this.overlayText,this.font,y,null,h,null)}return i},i}(fi),Vi=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.richMediaAnnotation,i}return ui(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),r},i.prototype._initialize=function(t,i){e.prototype._initialize.call(this,t,i)},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),void 0!==this.flattenPopups&&this.flattenPopups&&this._flattenPopUp(),t){var e=void 0;if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){e=i.get("N");var r=i.getRaw("N");r&&e&&(e.reference=r)}}if(e){var n=new Ze(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(fi),ji=function(e){function i(){var i=e.call(this)||this;return i._isAutoResize=!1,i._visibility=t.PdfFormFieldVisibility.visible,i._isFont=!1,i._isTransparentBackColor=!1,i._isWidget=!0,i._type=t._PdfAnnotationType.widgetAnnotation,i}return ui(i,e),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._dictionary=t,r._crossReference=e,r},Object.defineProperty(i.prototype,"page",{get:function(){return this._getPage()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return void 0===this._color&&this._defaultAppearance&&(this._color=this._da.color),this._color},set:function(t){void 0!==this.color&&this._color===t||(this._color=t);var e=!1;this._defaultAppearance||(this._da=new pi(""),e=!0),(e||this._da.color!==t)&&(this._da.color=t,this._dictionary.update("DA",this._da.toString()))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_hasBackColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;return t&&t.has("BG")}return!this._isTransparentBackColor},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){if(void 0===this._borderColor){var t=this._mkDictionary;if(t&&t.has("BC")){var e=t.getArray("BC");e&&(this._borderColor=L(e))}}return void 0!==this._borderColor&&null!==this._borderColor||(this._borderColor=[0,0,0]),this._borderColor},set:function(t){void 0!==this.borderColor&&this.borderColor===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new Tr(this._crossReference)),this._mkDictionary.update("BC",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._borderColor=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rotate",{get:function(){return void 0===this._rotationAngle&&(this._mkDictionary&&this._mkDictionary.has("R")?this._rotationAngle=this._mkDictionary.get("R"):this._dictionary.has("R")&&(this._rotationAngle=this._dictionary.get("R"))),this._rotationAngle},set:function(t){void 0!==this.rotate&&this._rotationAngle===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new Tr(this._crossReference)),this._mkDictionary.update("R",t),this._rotationAngle=t,this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"highlightMode",{get:function(){if(void 0===this._highlightMode&&this._dictionary.has("H")){var t=this._dictionary.get("H");this._highlightMode=V(t.name)}return this._highlightMode},set:function(t){this._highlightMode!==t&&this._dictionary.update("H",j(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._isLoaded&&void 0===this._bounds&&(this._bounds=N(this._dictionary,this._getPage())),void 0!==this._bounds&&null!==this._bounds||(this._bounds={x:0,y:0,width:0,height:0}),this._bounds},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");this._bounds=t,this._page&&this._page._isNew&&this._page._pageSettings?this._dictionary.update("Rect",Ft(this)):this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this._getPage()))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){return void 0===this._textAlignment&&this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){void 0!==this._textAlignment&&this._textAlignment===t||this._dictionary.update("Q",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visibility",{get:function(){var e;if(!this._isLoaded)return this._visibility;e=t.PdfFormFieldVisibility.visible;var i=t.PdfAnnotationFlag.default;if(this._hasFlags){var r=3;switch(((i=this.flags)&t.PdfAnnotationFlag.hidden)===t.PdfAnnotationFlag.hidden&&(r=0),(i&t.PdfAnnotationFlag.noView)===t.PdfAnnotationFlag.noView&&(r=1),(i&t.PdfAnnotationFlag.print)!==t.PdfAnnotationFlag.print&&(r&=2),r){case 0:e=t.PdfFormFieldVisibility.hidden;break;case 1:e=t.PdfFormFieldVisibility.hiddenPrintable;break;case 2:e=t.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:e=t.PdfFormFieldVisibility.visible}}else e=t.PdfFormFieldVisibility.visibleNotPrintable;return e},set:function(e){if(this._isLoaded)St(this._dictionary,e),this._dictionary._updated=!0;else{switch(e){case t.PdfFormFieldVisibility.hidden:this.flags=t.PdfAnnotationFlag.hidden;break;case t.PdfFormFieldVisibility.hiddenPrintable:this.flags=t.PdfAnnotationFlag.noView|t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visible:this.flags=t.PdfAnnotationFlag.print;break;case t.PdfFormFieldVisibility.visibleNotPrintable:this.flags=t.PdfAnnotationFlag.default}this._visibility=e}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"font",{get:function(){if(!this._pdfFont){var e=void 0;if(this._crossReference){var i=this._crossReference._document.form,r=this._obtainFontDetails();if(i&&i._dictionary.has("DR")){var n=i._dictionary.get("DR");if(n.has("Font")){var s=n.get("Font");if(s.has(r.name)){var a=s.get(r.name);if(a&&r.name&&a.has("BaseFont")){var o=a.get("BaseFont"),h=t.PdfFontStyle.regular;o&&(e=o.name,h=Tt(o.name),e.includes("-")&&(e=e.substring(0,e.indexOf("-"))),this._pdfFont=It(e,r.size,h,this))}}}}}}return(null===this._pdfFont||void 0===this._pdfFont||!this._isLoaded&&1===this._pdfFont.size)&&(this._pdfFont=this._circleCaptionFont),this._pdfFont},set:function(t){t&&t instanceof Ae&&(this._pdfFont=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_defaultAppearance",{get:function(){if(void 0===this._da&&this._dictionary.has("DA")){var t=this._dictionary.get("DA");t&&""!==t&&(this._da=new pi(t))}return this._da},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary.has("MK")&&(t=this._dictionary.get("MK")),t},enumerable:!0,configurable:!0}),i.prototype._create=function(e,i,r){return this._page=e,this._crossReference=e._crossReference,this._ref=this._crossReference._getNextReference(),this._dictionary=new Tr(this._crossReference),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary._currentObj=this,this._dictionary.objId=this._ref.toString(),this._dictionary.update("Type",Sr.get("Annot")),this._dictionary.update("Subtype",Sr.get("Widget")),this.flags|=t.PdfAnnotationFlag.print,this._dictionary.update("P",e._ref),e._addWidget(this._ref),this.border=new qi,this.bounds=i,r&&(this._field=r,this._dictionary.update("Parent",this._field._ref)),this._dictionary},i.prototype._doPostProcess=function(e,i){if(void 0===e&&(e=!1),void 0===i&&(i=!1),e||i){var r=void 0;if(i||e&&this._dictionary.has("AP"),!r&&this._dictionary.has("AP")){var n=this._dictionary.get("AP");n&&n.has("N")&&(r=n.get("N"),(d=n.getRaw("N"))&&r&&(r.reference=d))}if(r){var s=void 0;if(e){var a=new Ze(r,this._crossReference),o=this._getPage();if(o){var h=o.graphics;h.save(),o.rotation===t.PdfRotationAngle.angle90?(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(90)):o.rotation===t.PdfRotationAngle.angle180?(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(-180)):o.rotation===t.PdfRotationAngle.angle270&&(h.translateTransform(h._size[0],h._size[1]),h.rotateTransform(270)),s={x:this.bounds.x,y:this.bounds.y,width:a._size[0],height:a._size[1]},h.drawTemplate(a,s),h.restore()}}else{var c=void 0;if(this._dictionary.has("AP"))c=this._dictionary.get("AP");else{var _=this._crossReference._getNextReference();c=new Tr(this._crossReference),this._crossReference._cacheMap.set(_,c),this._dictionary.update("AP",_)}wt(c,this._crossReference,"N");var d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,r),c.update("N",d)}}this._dictionary._updated=!1}},i.prototype._initializeFont=function(t){this._pdfFont=t;var e;if(this._crossReference){var i=void 0;(e=this._crossReference._document)&&(i=e.form._dictionary.has("DR")?e.form._dictionary.get("DR"):new Tr(this._crossReference));var r=void 0,n=!1;if(i.has("Font")){var s=i.getRaw("Font");s&&s instanceof Pr?(n=!0,r=this._crossReference._fetch(s)):s instanceof Tr&&(r=s)}r||(r=new Tr(this._crossReference),i.update("Font",r));var a=Sr.get(G()),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._pdfFont._dictionary),t instanceof Te?this._pdfFont._pdfFontInternals&&this._crossReference._cacheMap.set(o,this._pdfFont._pdfFontInternals):this._pdfFont._dictionary&&this._crossReference._cacheMap.set(o,this._pdfFont._dictionary),r.update(a.name,o),i._updated=!0,e.form._dictionary.update("DR",i),e.form._dictionary._updated=!0,this._fontName=a.name;var h=new pi;h.fontName=this._fontName,h.fontSize=this._pdfFont._size,h.color=this.color?this.color:[0,0,0],this._dictionary.update("DA",h.toString()),n&&(i._updated=!0),this._isFont=!0}},i.prototype._getPage=function(){if(!this._page){var t;this._crossReference&&(t=this._crossReference._document);var e=void 0;if(this._dictionary.has("P")){var i=this._dictionary.getRaw("P");if(i&&t)for(var r=0;r<t.pageCount;r++){var n=t.getPage(r);if(n&&n._ref===i){e=n;break}}}!e&&t&&this._ref&&(e=X(t,this._ref)),this._page=e}return this._page},i.prototype._beginSave=function(){if(!this._isLoaded&&!this._page._isNew){var t=this._bounds;this._dictionary.update("Rect",F([t.x,t.y,t.width,t.height],this._page))}},i.prototype._parseBackColor=function(){var t;if(this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor){if(void 0===this._backColor){var e=this._mkDictionary;if(e&&e.has("BG")){var i=e.getArray("BG");i&&(this._backColor=L(i))}}void 0!==this._backColor&&null!==this._backColor||(this._backColor=[255,255,255]),t=this._backColor}return t},i.prototype._updateBackColor=function(t,e){void 0===e&&(e=!1);var i=!1;if(4===t.length&&255!==t[3]){this._isTransparentBackColor=!0,this._dictionary.has("BG")&&(delete this._dictionary._map.BG,i=!0);var r=this._mkDictionary;r&&r.has("BG")&&(delete r._map.BG,this._dictionary._updated=!0,i=!0)}else this._isTransparentBackColor=!1,void 0!==this.backColor&&this._backColor===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new Tr(this._crossReference)),this._mkDictionary.update("BG",[Number.parseFloat((t[0]/255).toFixed(3)),Number.parseFloat((t[1]/255).toFixed(3)),Number.parseFloat((t[2]/255).toFixed(3))]),this._backColor=[t[0],t[1],t[2]],this._dictionary._updated=!0,i=!0);e&&i&&this._field&&(this._field._setAppearance=!0)},i}(fi),zi=function(e){function i(){return e.call(this)||this}return ui(i,e),i._load=function(t,e,r){var n=new i;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=r,n},Object.defineProperty(i.prototype,"checked",{get:function(){return J(this._dictionary)},set:function(t){this.checked!==t&&this._dictionary.update("AS",Sr.get(t?"Yes":"Off"))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"style",{get:function(){if(this._isLoaded){var e=this._mkDictionary;e&&e.has("CA")?this._style=et(e.get("CA")):this._style=t.PdfCheckBoxStyle.check}return this._style},set:function(t){if(this.style!==t){this._style=t;var e=this._mkDictionary;e||(e=new Tr(this._crossReference),this._dictionary.update("MK",e)),e.update("CA",tt(t))}},enumerable:!0,configurable:!0}),i.prototype._doPostProcess=function(){var e=Y(this.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked,this);if(e){var i=this._getPage();if(i){var r=i.graphics;r.save(),i.rotation===t.PdfRotationAngle.angle90?(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(r.translateTransform(r._size[0],r._size[1]),r.rotateTransform(270)),r._sw._setTextRenderingMode(t._TextRenderingMode.fill),r.drawTemplate(e,this.bounds),r.restore()}}this._dictionary._updated=!1},i.prototype._postProcess=function(t){var e=this._field;t||(t=e&&e.checked?"Yes":"Off"),this._dictionary.update("AS",Sr.get(t))},i.prototype._setField=function(e){this._field=e,this._field._stringFormat=new Vt(this.textAlignment,t.PdfVerticalAlignment.middle),this._field._addToKid(this)},i}(ji),Ui=function(e){function i(t,i,r){var n=e.call(this)||this;return r&&t&&i&&(r instanceof ri?n._initializeItem(t,i,r.page,r):n._initializeItem(t,i,r)),n}return ui(i,e),i._load=function(t,e,r){var n=new i;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=r,n},Object.defineProperty(i.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this._isLoaded&&!this._optionValue&&(this._optionValue=Q(this._dictionary)),this._optionValue},set:function(t){this._optionValue=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),i.prototype._initializeItem=function(e,i,r,n){this._optionValue=e,this._page=r,this._create(this._page,i,this._field),this.textAlignment=t.PdfTextAlignment.left,this._dictionary.update("MK",new Tr(this._crossReference)),this._mkDictionary.update("BC",[0,0,0]),this._mkDictionary.update("BG",[1,1,1]),this.style=t.PdfCheckBoxStyle.circle,this._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),n&&(this._setField(n),this._dictionary.update("Parent",n._ref))},i.prototype._postProcess=function(t){var e=this._field;!t&&e&&-1!==e.selectedIndex&&(t=e.itemAt(e.selectedIndex).value),this.value===t?this._dictionary.update("AS",Sr.get(this.value)):this._dictionary.update("AS",Sr.get("Off"))},i}(zi),Wi=function(t){function e(e,i,r){var n=t.call(this)||this;return e&&i&&n._initializeItem(e,i,r),n}return ui(e,t),e._load=function(t,i,r){var n=new e;return n._isLoaded=!0,n._dictionary=t,n._crossReference=i,n._field=r,n},Object.defineProperty(e.prototype,"text",{get:function(){return void 0===this._text&&void 0!==this._field&&(this._field instanceof _i||this._field instanceof ci)&&(this._text=this._field._options[Number.parseInt(this._index.toString(),10)][1]),this._text},set:function(t){"string"==typeof t&&void 0!==this._field&&(this._field instanceof _i||this._field instanceof ci)&&t!==this._field._options[Number.parseInt(this._index.toString(),10)][1]&&(this._field._options[Number.parseInt(this._index.toString(),10)][1]=t,this._text=t,this._field._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),e.prototype._initializeItem=function(t,e,i){this._text=t,this._value=e,i&&i instanceof _i&&i._addToOptions(this,i)},e}(zi),Hi=function(){function e(e,i,r){this._cap=void 0!==e&&e,this._type=void 0!==i?i:t.PdfLineCaptionType.inline,this._offset=void 0!==r?r:[0,0]}return Object.defineProperty(e.prototype,"cap",{get:function(){return this._cap},set:function(t){t!==this._cap&&(this._cap=t,this._dictionary&&this._dictionary.update("Cap",t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){e!==this._type&&(this._type=e,this._dictionary&&this._dictionary.update("CP",Sr.get(e===t.PdfLineCaptionType.top?"Top":"Inline")))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"offset",{get:function(){return this._offset},set:function(t){m(t,this._offset)&&(this._offset=t,this._dictionary&&this._dictionary.update("CO",t))},enumerable:!0,configurable:!0}),e}(),Gi=function(){function e(e,i){this._begin=void 0!==e?e:t.PdfLineEndingStyle.none,this._end=void 0!==i?i:t.PdfLineEndingStyle.none}return Object.defineProperty(e.prototype,"begin",{get:function(){return this._begin},set:function(t){t!==this._begin&&(this._begin=t,this._dictionary&&this._dictionary.update("LE",[Sr.get(O(t)),Sr.get(O(this._end))]))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},set:function(t){t!==this._end&&(this._end=t,this._dictionary&&this._dictionary.update("LE",[Sr.get(O(this._begin)),Sr.get(O(t))]))},enumerable:!0,configurable:!0}),e}(),Ki=function(){function e(e,i,r){this._width=void 0!==e?e:1,this._style=void 0!==i?i:t.PdfBorderStyle.solid,void 0!==r&&Array.isArray(r)&&(this._dash=r)}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){if(t!==this._width&&(this._width=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new Tr(this._crossReference);e.update("Type",Sr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){if(t!==this._style&&(this._style=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new Tr(this._crossReference);e.update("Type",Sr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){if((void 0===this._dash||m(t,this._dash))&&(this._dash=t,this._dictionary)){var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new Tr(this._crossReference);e.update("Type",Sr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),e}(),qi=function(t){function e(e,i,r,n,s){var a=t.call(this,e,n,s)||this;return a._hRadius=void 0!==i?i:0,a._vRadius=void 0!==r?r:0,a}return ui(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){if(t!==this._width&&(this._width=t,this._dictionary)){this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]);var e=this._dictionary.has("BS")?this._dictionary.get("BS"):new Tr(this._crossReference);e.update("Type",Sr.get("Border")),e.update("W",this._width),e.update("S",M(this._style)),this._dash&&e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hRadius",{get:function(){return this._hRadius},set:function(t){t!==this._hRadius&&(this._hRadius=t,this._dictionary&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vRadius",{get:function(){return this._vRadius},set:function(t){t!==this._vRadius&&(this._vRadius=t,this._dictionary&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]))},enumerable:!0,configurable:!0}),e}(Ki),Xi=function(){function e(t){if(this._intensity=0,void 0!==t&&null!==t){if(t.has("BE")){var e=this._dictionary.get("BE");e&&(e.has("I")&&(this._intensity=e.get("I")),e.has("S")&&(this._style=this._getBorderEffect(e.get("S"))))}}else this._dictionary=new Tr,this._dictionary.set("I",this._intensity),this._dictionary.set("S",this._styleToEffect(this._style))}return Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){if(t!==this._intensity){if(this._intensity=t,this._dictionary){var e=this._dictionary.has("BE")?this._dictionary.get("BE"):new Tr(this._crossReference);e.update("I",this._intensity),e.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",e),this._dictionary._updated=!0}this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){if(t!==this._style&&(this._style=t,this._dictionary)){var e=this._dictionary.has("BE")?this._dictionary.get("BE"):new Tr(this._crossReference);e.update("I",this._intensity),e.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),e.prototype._getBorderEffect=function(e){return"/C"===e?t.PdfBorderEffectStyle.cloudy:t.PdfBorderEffectStyle.solid},e.prototype._styleToEffect=function(e){return e===t.PdfBorderEffectStyle.cloudy?"C":"S"},e}(),Ji=function(){function t(){this.borderWidth=1}return t}(),Qi=function(){function t(){this.startAngle=0,this.endAngle=0}return t}(),Yi=function(){function t(t,e,i){this._isExport=!1,this._annotations=t,this._page=i,this._crossReference=e,this._parsedAnnotations=new Map,this._comments=[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this._annotations.length},enumerable:!0,configurable:!0}),t.prototype.at=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");if(!this._parsedAnnotations.has(t)){var e=this._annotations[Number.parseInt(t.toString(),10)];if(void 0!==e&&e instanceof Pr&&(e=this._crossReference._fetch(e)),void 0!==e&&e instanceof Tr){var i=this._parseAnnotation(e);i&&(i._ref=this._annotations[Number.parseInt(t.toString(),10)],this._parsedAnnotations.set(t,i))}}return this._parsedAnnotations.get(t)},t.prototype.add=function(t){if(void 0===t||null===t)throw Error("annotation cannot be null or undefined");if(t._isLoaded)throw Error("cannot add an existing annotation");t._initialize(this._page);var e;void 0!==t._ref&&t._ref._isNew?e=t._ref:(e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,t._dictionary),t._ref=e);var i=this._annotations.length;this._annotations.push(e),this._parsedAnnotations.set(i,t);var r=!1;if(this._page._pageDictionary.has("Annots")){var n=this._page._pageDictionary.get("Annots");null!==n&&void 0!==n&&-1===n.indexOf(e)&&(n.push(e),this._page._pageDictionary.set("Annots",n),r=!0)}return r||this._page._pageDictionary.set("Annots",this._annotations),this._page._pageDictionary._updated=!0,t instanceof gi&&this._addCommentsAndReview(t,t._dictionary.get("F")),this._updateCustomAppearanceResource(t),i},t.prototype.remove=function(t){if(t._ref){var e=this._annotations.indexOf(t._ref);e>-1&&this.removeAt(e)}},t.prototype.removeAt=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");var e=this._annotations[Number.parseInt(t.toString(),10)];if(e&&this._page){var i=this._page._getProperty("Annots"),r=i.indexOf(e);r>-1&&i.splice(r,1),this._page._pageDictionary.set("Annots",i),this._page._pageDictionary._updated=!0,this._annotations.indexOf(e)>-1&&this._annotations.splice(t,1),this._parsedAnnotations.has(t)&&(this._parsedAnnotations.delete(t),this._reorderParsedAnnotations(t));var n=this._page._crossReference;n&&n._cacheMap.has(e)&&n._cacheMap.delete(e)}},t.prototype._reorderParsedAnnotations=function(t){var e=new Map;this._parsedAnnotations.forEach(function(i,r){r>t?e.set(r-1,i):e.set(r,i)}),this._parsedAnnotations=e},t.prototype._updateCustomAppearanceResource=function(t){t instanceof Mi&&void 0!==t._appearance&&t._appearance.normal.graphics._processResources(t._crossReference)},t.prototype._addCommentsAndReview=function(t,e){this._updateChildReference(t,t.comments,e),this._updateChildReference(t,t.reviewHistory,e)},t.prototype._updateChildReference=function(t,e,i){if(e&&e.count>0){if(30===i)throw new Error("Could not add comments/reviews to the review");for(var r=0;r<e.count;r++){var n=e._collection[Number.parseInt(r.toString(),10)];n&&!n._dictionary.has("IRT")&&(0!==r&&e._isReview?n._dictionary.update("IRT",e._collection[r-1]._ref):n._dictionary.update("IRT",t._ref),e._isReview?n._isReview=!0:n._isComment=!0,this.add(n))}}},t.prototype._parseAnnotation=function(t){var e;if(t.has("Subtype")){var i=t.get("Subtype"),r=t.get("Rect");if(i){var n=void 0;switch(i.name){case"Line":e=yi._load(this._page,t);break;case"Circle":e=t.has("Measure")?mi._load(this._page,t):r[2]-r[0]===r[3]-r[1]?mi._load(this._page,t):bi._load(this._page,t);break;case"Square":e=r[2]===r[3]?vi._load(this._page,t):Si._load(this._page,t);break;case"Polygon":e=wi._load(this._page,t);break;case"PolyLine":t.has("Measure")&&t.has("IT")&&(s=t.get("IT"))&&"PolyLineAngle"===s.name&&(e=Ai._load(this._page,t)),e||(e=Pi._load(this._page,t));break;case"Ink":e=ki._load(this._page,t);break;case"Popup":case"Text":e=xi._load(this._page,t);break;case"Link":if(t.has("A")&&(n=t.get("A")),n&&n.has("S")){var s=n.get("S").name;if(s){var a=this._hasValidBorder(t.getArray("Border"));"URI"===s?e=a?Ci._load(this._page,t):this._getLinkAnnotation(t):"Launch"===s?e=Ti._load(this._page,t):"GoToR"===s?e=this._getLinkAnnotation(t):"GoTo"===s&&(e=Ni._load(this._page,t))}}else"Link"===i.name&&(e=Ni._load(this._page,t));break;case"FileAttachment":e=Ri._load(this._page,t);break;case"3D":e=Fi._load(this._page,t);break;case"FreeText":e=Oi._load(this._page,t);break;case"Redact":e=Ei._load(this._page,t);break;case"RichMedia":e=Vi._load(this._page,t);break;case"Watermark":e=Li._load(this._page,t);break;case"Stamp":e=Mi._load(this._page,t);break;case"Sound":e=Di._load(this._page,t);break;case"Highlight":case"Squiggly":case"StrikeOut":case"Underline":e=Bi._load(this._page,t)}}}return e},t.prototype._getLinkAnnotation=function(t){var e;if(t.has("A")){var i=t.get("A");if(i&&i.has("S")){var r=i.get("S");r&&"GoToR"===r.name&&i.has("F")?e=Ti._load(this._page,t):r&&"URI"===r.name&&(e=Ii._load(this._page,t))}}else e=Ii._load(this._page,t);return e},t.prototype._hasValidBorder=function(t){if(void 0===t||null===t)return!1;for(var e=0;e<t.length;e++){var i=0,r=t[Number.parseInt(e.toString(),10)];if(null!==r&&void 0!==r&&(i=r),i>0)return!1}return!0},t.prototype._doPostProcess=function(t){for(var e=this.count-1;e>=0;e--){var i=this.at(e);i&&(i._isExport=this._isExport,i._doPostProcess(i.flatten||t))}},t.prototype._reArrange=function(t,e,i){if(this._annotations){e>this._annotations.length&&(e=0),i>=this._annotations.length&&(i=this._annotations.indexOf(t));var r=this._crossReference._fetch(this._annotations[Number.parseInt(i.toString(),10)]);if(r.has("Parent")){var n=r.getRaw("Parent");if(n&&n===t||t===this._annotations[Number.parseInt(i.toString(),10)]){var s=this._annotations[Number.parseInt(i.toString(),10)];this._annotations[Number.parseInt(i.toString(),10)]=this._annotations[Number.parseInt(e.toString(),10)],this._annotations[Number.parseInt(e.toString(),10)]=s}}}return this._annotations},t.prototype._clear=function(){this._annotations=[],this._parsedAnnotations=new Map,this._comments=[]},t}(),Zi=function(){function e(t,e){this._collection=[],this._annotation=t,this._isReview=e,(this._annotation._isLoaded||void 0!==t._page)&&(this._page=t._page,this._parentDictionary=t._dictionary,this._annotation._isLoaded&&this._parseCommentsOrReview())}return Object.defineProperty(e.prototype,"count",{get:function(){return this._collection.length},enumerable:!0,configurable:!0}),e.prototype.at=function(t){if(t<0||t>=this._collection.length)throw Error("Index out of range.");return this._collection[Number.parseInt(t.toString(),10)]},e.prototype.add=function(e){if(30===this._annotation._dictionary.get("F"))throw new Error("Could not add comments/reviews to the review");if(e._dictionary.update("F",this._annotation.flags===t.PdfAnnotationFlag.locked?128:this._isReview?30:28),this._annotation&&(this._annotation._isLoaded||this._page&&this._annotation._ref)){this._page.annotations.add(e);var i=this._collection.length;0!==i&&this._isReview?e._dictionary.update("IRT",this._collection[Number.parseInt((i-1).toString(),10)]._ref):e._dictionary.update("IRT",this._annotation._ref),this._isReview?e._isReview=!0:e._isComment=!0}this._collection.push(e)},e.prototype.remove=function(t){var e=this._collection.indexOf(t);e>-1&&this.removeAt(e)},e.prototype.removeAt=function(t){if(!(t>-1&&t<this._collection.length))throw new Error("Index out of range.");var e=this._collection[Number.parseInt(t.toString(),10)];if(this._isReview&&t<this._collection.length-1){var i=this._collection[Number.parseInt((t+1).toString(),10)],r=e._dictionary._get("IRT");i._dictionary.set("IRT",r),i._dictionary._updated=!0}this._collection.splice(t,1),this._page.annotations.remove(e)},e.prototype._parseCommentsOrReview=function(){this._isReview?this._parseReview():this._parseComments()},e.prototype._parseReview=function(){var t=this._page.annotations,e=new Map;if(e.set(this._annotation._ref,this._annotation),t._comments&&t._comments.length>0){for(var i=[],r=0;r<t._comments.length;r++){o=(s=t._comments[Number.parseInt(r.toString(),10)])._dictionary._get("IRT");s._isReview&&o&&e.has(o)?(this._collection.push(s),e.set(s._ref,s)):i.push(s)}i.length>0?t._comments=i:t._comments=[]}else for(var n=t.count,r=0;r<n;r++){var s=t.at(r);if(s&&s instanceof xi){var a=s._dictionary;if(s._dictionary.has("IRT")){var o=a._get("IRT");s._isReview&&o&&e.has(o)?(this._collection.push(s),e.set(s._ref,s)):t._comments.push(s)}}}e.clear()},e.prototype._parseComments=function(){var t=this._page.annotations;if(t._comments&&t._comments.length>0){for(var e=[],i=0;i<t._comments.length;i++){a=bt(s=(n=t._comments[Number.parseInt(i.toString(),10)])._dictionary);(o=s._get("IRT"))&&o===this._annotation._ref&&!a?this._collection.push(n):e.push(n)}e.length>0?t._comments=e:t._comments=[]}else for(var r=t.count,i=0;i<r;i++){var n=t.at(i);if(n&&n instanceof xi){var s=n._dictionary;if(n._dictionary.has("IRT")){var a=bt(s),o=s._get("IRT");o&&o===this._annotation._ref&&!a?this._collection.push(n):t._comments.push(n)}}}},e}(),$i=function(){function e(t,e,i,r){this._isAnnotationParsed=!1,this._isNew=!1,this._pageIndex=e,this._pageDictionary=i,this._crossReference=t,this._ref=r}return Object.defineProperty(e.prototype,"annotations",{get:function(){if(void 0===this._annotations){if(this._pageDictionary.has("Annots")){var t=this._getProperty("Annots");if(t&&Array.isArray(t)){var e;if(this._crossReference._document._catalog._catalogDictionary.has("AcroForm")&&(e=this._crossReference._document.form._parseWidgetReferences()),e&&e.length>0){var i=[];t.forEach(function(t){-1===e.indexOf(t)&&i.push(t)}),this._annotations=new Yi(i,this._crossReference,this)}else this._annotations=new Yi(t,this._crossReference,this)}}void 0===this._annotations&&(this._annotations=new Yi([],this._crossReference,this))}return this._annotations},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(void 0===this._size){var t=this.mediaBox,e=0,i=0;t&&(e=t[2]-t[0],i=0!==t[3]?t[3]-t[1]:t[1]),i<0&&(i=-i),e<0&&(e=-e),this._size=[e,i]}return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){var e=0;return void 0===this._rotation&&((e=T(this._pageDictionary,"Rotate",!1,!0))<0&&(e+=360),this._rotation=void 0!==e?e/90%4:t.PdfRotationAngle.angle0),this._rotation},set:function(t){if(!this._isNew){this._rotation=t;var e=90*Math.floor(this._rotation);e>=360&&(e%=360),this._pageDictionary.update("Rotate",e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabOrder",{get:function(){return this._obtainTabOrder()},set:function(e){this._tabOrder=e;var i="";this._tabOrder!==t.PdfFormFieldsTabOrder.none&&(this._tabOrder===t.PdfFormFieldsTabOrder.row?i="R":this._tabOrder===t.PdfFormFieldsTabOrder.column?i="C":this._tabOrder===t.PdfFormFieldsTabOrder.structure&&(i="S")),this._pageDictionary.update("Tabs",Sr.get(i))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cropBox",{get:function(){return void 0===this._cBox&&(this._cBox=T(this._pageDictionary,"CropBox",!1,!0)),void 0===this._cBox&&(this._cBox=[0,0,0,0]),this._cBox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mediaBox",{get:function(){return void 0===this._mBox&&(this._mBox=T(this._pageDictionary,"MediaBox",!1,!0)),void 0===this._mBox&&(this._mBox=[0,0,0,0]),this._mBox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){if(void 0===this._orientation&&void 0!==this.size){var e=this.size;e[0]>e[1]?this._orientation=t.PdfPageOrientation.landscape:this._orientation=t.PdfPageOrientation.portrait}return this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_origin",{get:function(){return(void 0===this._o||0===this._o[0]&&0===this._o[1])&&(this._o=[this.mediaBox[0],this._mBox[1]]),this._o},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"graphics",{get:function(){return(void 0===this._g||this._needInitializeGraphics)&&this._parseGraphics(),this._g},enumerable:!0,configurable:!0}),e.prototype._addWidget=function(t){var e;this._pageDictionary.has("Annots")&&(e=this._getProperty("Annots")),e&&Array.isArray(e)?e.push(t):this._pageDictionary.update("Annots",[t]),this._pageDictionary._updated=!0},e.prototype._getProperty=function(t,e){void 0===e&&(e=!1);var i=T(this._pageDictionary,t,e,!1);return Array.isArray(i)?1!==i.length&&i[0]instanceof Tr?Tr.merge(this._crossReference,i):i[0]:i},e.prototype._parseGraphics=function(){this._loadContents();var t=new Fr([32,113,32,10]),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._contents.splice(0,0,e);var i=new Fr([32,81,32,10]),r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),this._contents.push(r);var n=new Fr([]),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),this._contents.push(s),this._pageDictionary.set("Contents",this._contents),this._pageDictionary._updated=!0,this._initializeGraphics(n)},e.prototype._loadContents=function(){var t,e=this._pageDictionary.getRaw("Contents");null!==e&&void 0!==e&&e instanceof Pr&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof Cr?this._contents=[t]:e&&Array.isArray(e)?this._contents=e:this._contents=[]},e.prototype._initializeGraphics=function(e){var i=!1,r=0,n=0,s=0,a=0,o=this.size,h=this.mediaBox;h&&h.length>=4&&(r=h[0],n=h[1],s=h[2],a=h[3]);var c;if(this._pageDictionary.has("CropBox"))if((c=this.cropBox)&&c.length>=4){var _=c[0],d=c[1],p=c[2],l=c[3];(_<0||d<0||p<0||l<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(_))===Math.floor(Math.abs(o[0]))?this._g=new Le([Math.max(_,p),Math.max(d,l)],e,this._crossReference,this):(this._g=new Le(o,e,this._crossReference,this),this._g._cropBox=c)}else this._g=new Le(o,e,this._crossReference,this);else if((r<0||n<0||s<0||a<0)&&Math.floor(Math.abs(n))===Math.floor(Math.abs(o[1]))&&Math.floor(Math.abs(s))===Math.floor(Math.abs(o[0]))){var u=Math.max(r,s),f=Math.max(n,a);(u<=0||f<=0)&&(i=!0,r<0&&(r=-r),n<0&&(n=-n),s<0&&(s=-s),a<0&&(a=-a),u=Math.max(r,s),f=Math.max(n,a)),this._g=new Le([u,f],e,this._crossReference,this)}else this._g=new Le(o,e,this._crossReference,this);this._pageDictionary.has("MediaBox")&&(this._g._mediaBoxUpperRightBound=i?-n:a),this._graphicsState=this._g.save();var g=this._origin;if(g[0]>=0&&g[1]>=0||Math.sign(g[0])!==Math.sign(g[1])?this._g._initializeCoordinates():this._g._initializeCoordinates(this),!this._isNew){var y=this.rotation;if(!Number.isNaN(y)&&(y!==t.PdfRotationAngle.angle0||this._pageDictionary.has("Rotate"))){var m=void 0;m=this._pageDictionary.has("Rotate")?this._pageDictionary.get("Rotate"):90*y;var b=this._g._clipBounds;90===m?(this._g.translateTransform(0,o[1]),this._g.rotateTransform(-90),this._g._clipBounds=[b[0],b[1],o[0],o[1]]):180===m?(this._g.translateTransform(o[0],o[1]),this._g.rotateTransform(-180)):270===m&&(this._g.translateTransform(o[0],0),this._g.rotateTransform(-270),this._g._clipBounds=[b[0],b[1],o[1],o[0]])}}if(this._isNew&&this._pageSettings){var v=this._getActualBounds(this._pageSettings);this._g._clipTranslateMargins(v)}this._needInitializeGraphics=!1},e.prototype._getActualBounds=function(t){var e=t._getActualSize();return[t.margins.left,t.margins.top,e[0],e[1]]},e.prototype._fetchResources=function(){if(void 0===this._resourceObject)if(this._pageDictionary&&this._pageDictionary.has("Resources")){var t=this._pageDictionary.getRaw("Resources");null!==t&&void 0!==t&&t instanceof Pr?(this._hasResourceReference=!0,this._resourceObject=this._crossReference._fetch(t)):t instanceof Tr&&(this._resourceObject=t)}else this._resourceObject=new Tr(this._crossReference),this._pageDictionary.update("Resources",this._resourceObject);return this._resourceObject},e.prototype._getCropOrMediaBox=function(){var t;return this._pageDictionary.has("CropBox")?t=this._pageDictionary.getArray("CropBox"):this._pageDictionary.has("MediaBox")&&(t=this._pageDictionary.getArray("MediaBox")),t},e.prototype._beginSave=function(){void 0!==this._graphicsState&&(this.graphics.restore(this._graphicsState),this._graphicsState=null,this._needInitializeGraphics=!0)},e.prototype._destroy=function(){this._pageDictionary=void 0,this._size=void 0,this._mBox=void 0,this._cBox=void 0,this._o=void 0,this._g=void 0,this._graphicsState=void 0,this._contents=void 0},e.prototype._obtainTabOrder=function(){if(this._pageDictionary.has("Tabs")){var e=this._pageDictionary.get("Tabs");e===Sr.get("R")?this._tabOrder=t.PdfFormFieldsTabOrder.row:e===Sr.get("C")?this._tabOrder=t.PdfFormFieldsTabOrder.column:e===Sr.get("S")?this._tabOrder=t.PdfFormFieldsTabOrder.structure:e===Sr.get("W")&&(this._tabOrder=t.PdfFormFieldsTabOrder.widget)}return null!==this._tabOrder&&void 0!==this._tabOrder||(this._tabOrder=t.PdfFormFieldsTabOrder.none),this._tabOrder},e.prototype._removeAnnotation=function(t){if(this._pageDictionary.has("Annots")){var e=this._getProperty("Annots");if(e&&Array.isArray(e)){var i=e.indexOf(t);i>=0&&e.splice(i,1),this._pageDictionary.set("Annots",e),this._pageDictionary._updated=!0}}},e}(),tr=function(){function e(e,i){this._location=[0,0],this._destinationMode=t.PdfDestinationMode.location,this._zoom=0,this._isValid=!0,this._index=0,this._destinationBounds=[0,0,0,0],this._array=Array(),void 0!==e&&null!==e&&(e.rotation===t.PdfRotationAngle.angle180?this._location=[e.graphics._size[0],this._location[1]]:e.rotation===t.PdfRotationAngle.angle90?this._location=[0,0]:e.rotation===t.PdfRotationAngle.angle270?this._location=[e.graphics._size[0],0]:this._location=[0,this._location[1]],this._page=e,this._index=e._pageIndex),void 0!==i&&2===i.length&&(this._location=i),void 0!==i&&4===i.length&&(this._location=[i[0],i[1]],this._destinationBounds=i)}return Object.defineProperty(e.prototype,"zoom",{get:function(){return this._zoom},set:function(t){t!==this._zoom&&(this._zoom=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){return this._page},set:function(t){t!==this._page&&(this._page=t,this._initializePrimitive(),this._index=t._pageIndex)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageIndex",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._destinationMode},set:function(t){t!==this._destinationMode&&(this._destinationMode=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"location",{get:function(){return this._location},set:function(t){t!==this._location&&(this._location=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"destinationBounds",{get:function(){return this._destinationBounds},set:function(t){t!==this._destinationBounds&&(this._destinationBounds=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this._isValid},enumerable:!0,configurable:!0}),e.prototype._setValidation=function(t){this._isValid=t},e.prototype._initializePrimitive=function(){this._array=[];var e=this._page,i=this._page._pageDictionary;switch(void 0!==i&&null!==i&&this._array.push(this._page._ref),this._destinationMode){case t.PdfDestinationMode.location:this._array.push(Sr.get("XYZ")),void 0!==e&&null!==e?(this._array.push(this._location[0]),this._array.push(this._page.graphics._size[1]-this._location[1])):(this._array.push(0),this._array.push(0)),this._array.push(this._zoom);break;case t.PdfDestinationMode.fitToPage:this._array.push(Sr.get("Fit"));break;case t.PdfDestinationMode.fitR:this._array.push(Sr.get("FitR")),this._array.push(this._destinationBounds[0]),this._array.push(this._destinationBounds[1]),this._array.push(this._destinationBounds[2]),this._array.push(this._destinationBounds[3]);break;case t.PdfDestinationMode.fitH:this._array.push(Sr.get("FitH")),this._array.push(void 0!==e&&null!==e?e._size[1]-this._location[1]:0)}this._parent&&(this._parent._dictionary.set("D",this._array),this._parent._dictionary._updated=!0)},e}(),er=function(){function e(){this._format=t._ImageFormat.unknown,this._height=0,this._width=0,this._bitsPerComponent=8,this._position=0,this._noOfComponents=-1}return e.prototype._reset=function(){this._position=0},e.prototype._getBuffer=function(t){return this._stream[Number.parseInt(t.toString(),10)]},e.prototype._read=function(t,e,i,r){if(r&&Array.isArray(r)){var n=0;if(i<=r.length&&r.length-e>=i)for(var s=0;s<i;s++)t[Number.parseInt(s.toString(),10)]=r[Number.parseInt(e.toString(),10)],e++,n++;return{outputBuffer:t,offset:e,length:n}}for(var a=e;a<i;a++){var o=this._position;t[Number.parseInt(a.toString(),10)]=this._getBuffer(o),this._position++}},e.prototype._readString=function(t){for(var e="",i=0;i<t;i++)e+=String.fromCharCode(this._readByte());return e},e.prototype._seek=function(t){this._position+=t},e.prototype._readByte=function(){if(this._position<this._stream.byteLength){var t=this._getBuffer(this._position);return this._position+=1,t}throw new Error("Error decoding JPEG image. Invalid offset.")},e.prototype._toUnsigned16=function(t){return t&=65535,t<0?t+65536:t},e.prototype._readUnsigned32=function(t){return this._getBuffer(t+3)|this._getBuffer(t+2)<<8|this._getBuffer(t+1)<<16|this._getBuffer(t)<<24},e}(),ir=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),rr=function(e){function i(t){var i=e.call(this)||this;return i._stream=t,i._initialize(),i}return ir(i,e),Object.defineProperty(i.prototype,"_imageDataAsNumberArray",{get:function(){return this._imageData},enumerable:!0,configurable:!0}),i.prototype._initialize=function(){this._format=t._ImageFormat.jpeg,this._readHeader(),this._reset(),this._imageData=new Uint8Array(this._stream.byteLength),this._read(this._imageData,0,this._imageData.byteLength)},i.prototype._readHeader=function(){this._reset();var t=new Uint8Array(this._stream.byteLength);this._read(t,0,t.byteLength);for(var e=4,i=256*this._getBuffer(e)+this._getBuffer(e+1),r=!1;e<t.byteLength;){if(!((e+=i)<t.byteLength)){r=!0;break}if(192===this._getBuffer(e+1)){if(this._height=256*this._getBuffer(e+5)+this._getBuffer(e+6),this._width=256*this._getBuffer(e+7)+this._getBuffer(e+8),this._noOfComponents=this._getBuffer(e+9),0!==this._width&&0!==this._height)return}else e+=2,i=256*this._getBuffer(e)+this._getBuffer(e+1)}r&&(this._reset(),this._seek(2),this._readExceededJpegImage())},i.prototype._getImageDictionary=function(){var t=[];this._imageStream=new Rr(t,new Tr),this._imageStream.isImageStream=!0;for(var e="",i="",r=0;r<this._imageDataAsNumberArray.byteLength;r++)e+=" "+String.fromCharCode(this._getBuffer(r));for(r=0;r<e.length;r++)r%2!=0&&(i+=e[Number.parseInt(r.toString(),10)]);this._imageStream.data=[i],this._imageStream._isCompress=!1;var n=new Tr;n.set("Type",new Sr("XObject")),n.set("Subtype",new Sr("Image")),n.set("Width",this._width),n.set("Height",this._height),n.set("BitsPerComponent",this._bitsPerComponent),n.set("Filter",new Sr("DCTDecode")),n.set("ColorSpace",new Sr(this._getColorSpace())),n.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=n,this._imageStream.bytes=new Uint8Array(this._imageStream.data[0].length);for(r=0;r<this._imageStream.data[0].length;r++)this._imageStream.bytes[Number.parseInt(r.toString(),10)]=this._imageStream.data[0].charCodeAt(r);return this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0,this._imageStream},i.prototype._getColorSpace=function(){return 1===this._noOfComponents?"DeviceGray":4===this._noOfComponents?"DeviceCMYK":"DeviceRGB"},i.prototype._getDecodeParams=function(){var t=new Tr;return t.set("Columns",this._width),t.set("BlackIs1",!0),t.set("K",-1),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},i.prototype._skipStream=function(){var t=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1);if(this._seek(2),t<2)throw new Error("Error decoding JPEG image");t>0&&this._seek(t-2)},i.prototype._readExceededJpegImage=function(){for(var t=!0;t;)switch(this._getMarker()){case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:this._seek(3),this._height=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._width=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._noOfComponents=this._getBuffer(this._position),this._seek(1),t=!1;break;default:this._skipStream()}},i.prototype._getMarker=function(){for(var t=0,e=this._readByte();255!==e;)t++,e=this._readByte();do{e=this._readByte()}while(255===e);if(0!==t)throw new Error("Error decoding JPEG image");return this._toUnsigned16(e)},i}(er);!function(t){t[t.readingHeader=0]="readingHeader",t[t.readingBFinal=1]="readingBFinal",t[t.readingBType=2]="readingBType",t[t.readingNlCodes=3]="readingNlCodes",t[t.readingNdCodes=4]="readingNdCodes",t[t.readingCodes=5]="readingCodes",t[t.readingClCodes=6]="readingClCodes",t[t.readingTcBefore=7]="readingTcBefore",t[t.readingTcAfter=8]="readingTcAfter",t[t.decodeTop=9]="decodeTop",t[t.iLength=10]="iLength",t[t.fLength=11]="fLength",t[t.dCode=12]="dCode",t[t.unCompressedAligning=13]="unCompressedAligning",t[t.unCompressedByte1=14]="unCompressedByte1",t[t.unCompressedByte2=15]="unCompressedByte2",t[t.unCompressedByte3=16]="unCompressedByte3",t[t.unCompressedByte4=17]="unCompressedByte4",t[t.decodeUnCompressedBytes=18]="decodeUnCompressedBytes",t[t.srFooter=19]="srFooter",t[t.rFooter=20]="rFooter",t[t.vFooter=21]="vFooter",t[t.done=22]="done"}(t._InflaterState||(t._InflaterState={})),function(t){t[t.unCompressedType=0]="unCompressedType",t[t.staticType=1]="staticType",t[t.dynamicType=2]="dynamicType"}(t._BlockType||(t._BlockType={}));var nr,sr=function(){function t(){this._end=0,this._usedBytes=0,this._dOutput=Array(t._dOutSize).fill(0),this._end=0,this._usedBytes=0}return Object.defineProperty(t.prototype,"_unusedBytes",{get:function(){return t._dOutSize-this._usedBytes},enumerable:!0,configurable:!0}),t.prototype._write=function(e){this._dOutput[this._end++]=e,this._end&=t._dOutMask,++this._usedBytes},t.prototype._writeLD=function(e,i){this._usedBytes+=e;var r=this._end-i&t._dOutMask,n=t._dOutSize-e;if(r<=n&&this._end<n)if(e<=i)a(this._dOutput,this._end,this._dOutput,r,r+e),this._end+=e;else for(;e-- >0;)this._dOutput[this._end++]=this._dOutput[r++];else for(;e-- >0;)this._dOutput[this._end++]=this._dOutput[r++],this._end&=t._dOutMask,r&=t._dOutMask},t.prototype._copyFrom=function(e,i){i=Math.min(Math.min(i,t._dOutSize-this._usedBytes),e._bytes);var r,n=t._dOutSize-this._end;return i>n?(r=e._copyTo(this._dOutput,this._end,n))===n&&(r+=e._copyTo(this._dOutput,0,i-n)):r=e._copyTo(this._dOutput,this._end,i),this._end=this._end+r&t._dOutMask,this._usedBytes+=r,r},t.prototype._copyTo=function(e,i,r){var n;r>this._usedBytes?(n=this._end,r=this._usedBytes):n=this._end-this._usedBytes+r&t._dOutMask;var s=r,o=r-n,h=t._dOutSize-o;if(o>0){for(var c=0;c<o&&c+h<this._dOutput.length&&c+i<e.length;c++)e[i+c]=this._dOutput[h+c];var _=t._dOutSize-o;a(e,i,this._dOutput,_,_+o),i+=o,r=n}h=n-r;var d=n-r;return a(e,i,this._dOutput,d,n),this._usedBytes-=s,{count:s,data:e}},t._dOutSize=32768,t._dOutMask=32767,t}(),ar=function(){function t(){this._bBuffer=0,this._bInBuffer=0,this._begin=0,this._end=0}return Object.defineProperty(t.prototype,"_bytes",{get:function(){return this._end-this._begin+Math.floor(this._bInBuffer/8)},enumerable:!0,configurable:!0}),t.prototype._needsInput=function(){return this._begin===this._end},t.prototype._availableBits=function(t){if(this._bInBuffer<t){if(this._needsInput())return!1;if(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8,this._bInBuffer<t){if(this._needsInput())return!1;this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8}}return!0},t.prototype._load16Bits=function(){return this._bInBuffer<8?(this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8)):this._bInBuffer<16&&this._begin<this._end&&(this._bBuffer|=r(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._bBuffer},t.prototype._getBitMask=function(t){return(r(1,32)<<t)-1},t.prototype._getBits=function(t){if(!this._availableBits(t))return-1;var e=this._bBuffer&this._getBitMask(t);return this._bBuffer>>=t,this._bInBuffer-=t,e},t.prototype._copyTo=function(t,e,i){for(var n=0;this._bInBuffer>0&&i>0;)t[e++]=r(this._bBuffer,8),this._bBuffer>>=8,this._bInBuffer-=8,i--,n++;if(0===i)return n;var s=this._end-this._begin;i>s&&(i=s);for(var a=0;a<i&&a+this._begin<this._buffer.length&&a+e<t.length;a++)t[e+a]=this._buffer[this._begin+a];return this._begin+=i,n+i},t.prototype._setInput=function(t,e,i){this._buffer=t,this._begin=e,this._end=e+i},t.prototype._skipBits=function(t){this._bBuffer>>=t,this._bInBuffer-=t},t.prototype._skipByteBoundary=function(){this._bBuffer>>=this._bInBuffer%8,this._bInBuffer=this._bInBuffer-this._bInBuffer%8},t}(),or=function(){function t(){}return t.prototype._load=function(t){this._clArray=t,this._initialize()},t.prototype._loadTree=function(t){this._clArray=t?this._getLengthTree():this._getDepthTree(),this._initialize()},t.prototype._initialize=function(){this._clArray.length===t._maxLengthTree?this._tBits=9:this._tBits=7,this._tMask=(1<<this._tBits)-1,this._createTable()},t.prototype._getLengthTree=function(){for(var e=Array(t._maxLengthTree).fill(0),i=0;i<=143;i++)e[Number.parseInt(i.toString(),10)]=r(8,8);for(i=144;i<=255;i++)e[Number.parseInt(i.toString(),10)]=r(9,8);for(i=256;i<=279;i++)e[Number.parseInt(i.toString(),10)]=r(7,8);for(i=280;i<=287;i++)e[Number.parseInt(i.toString(),10)]=r(8,8);return e},t.prototype._getDepthTree=function(){return Array(t._maxDepthTree).fill(5)},t.prototype._calculateHashCode=function(){for(var e=Array(17).fill(0),i=0;i<this._clArray.length;i++)e[this._clArray[Number.parseInt(i.toString(),10)]]++;e[0]=0;for(var r=Array(17).fill(0),n=0,s=1;s<=16;s++)n=n+e[s-1]<<1,r[Number.parseInt(s.toString(),10)]=n;for(var a=Array(t._maxLengthTree).fill(0),i=0;i<this._clArray.length;i++){var o=this._clArray[Number.parseInt(i.toString(),10)];o>0&&(a[Number.parseInt(i.toString(),10)]=this._bitReverse(r[Number.parseInt(o.toString(),10)],o),r[Number.parseInt(o.toString(),10)]++)}return a},t.prototype._bitReverse=function(t,e){var i=0;do{i|=1&t,i<<=1,t>>=1}while(--e>0);return i>>1},t.prototype._createTable=function(){var t=this._calculateHashCode();this._table=Array(1<<this._tBits).fill(0),this._left=Array(2*this._clArray.length).fill(0),this._right=Array(2*this._clArray.length).fill(0);for(var e=n(this._clArray.length),i=0;i<this._clArray.length;i++){var r=this._clArray[Number.parseInt(i.toString(),10)];if(r>0){var s=t[Number.parseInt(i.toString(),10)];if(r<=this._tBits){var a=1<<r;if(s>=a)throw new Error("Invalid Data.");for(var o=1<<this._tBits-r,h=0;h<o;h++)this._table[Number.parseInt(s.toString(),10)]=n(i),s+=a}else{var c=r-this._tBits,_=1<<this._tBits,d=s&(1<<this._tBits)-1,p=this._table;do{var l=n(p[Number.parseInt(d.toString(),10)]);if(0===l&&(p[Number.parseInt(d.toString(),10)]=n(-e),l=n(-e),e++),l>0)throw new Error("Invalid Data.");p=0==(s&_)?this._left:this._right,d=-l,_<<=1,c--}while(0!==c);p[Number.parseInt(d.toString(),10)]=n(i)}}}},t.prototype._getNextSymbol=function(t){var e=t._load16Bits();if(0===t._bInBuffer)return-1;var i=this._table[e&this._tMask];if(i<0){var n=r(1<<this._tBits,32);do{i=-i,i=0==(e&n)?this._left[Number.parseInt(i.toString(),10)]:this._right[Number.parseInt(i.toString(),10)],n<<=1}while(i<0)}var s=this._clArray[Number.parseInt(i.toString(),10)];if(s<=0)throw new Error("Invalid Data.");return s>t._bInBuffer?-1:(t._skipBits(s),i)},t._maxLengthTree=288,t._maxDepthTree=32,t._nCLength=19,t}(),hr=function(){function e(){this._extraLengthBits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],this._staticDistanceTreeTable=[0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31],this._lengthBase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],this._distanceBasePosition=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],this._codeOrder=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],this._bfinal=0,this._bLength=0,this._blBuffer=[0,0,0,0],this._blockType=t._BlockType.unCompressedType,this._caSize=0,this._clCodeCount=0,this._extraBits=0,this._lengthCode=0,this._length=0,this._llCodeCount=0,this._output=new sr,this._input=new ar,this._loopCounter=0,this._codeList=Array(or._maxLengthTree+or._maxDepthTree).fill(0),this._cltcl=Array(or._nCLength).fill(0),this._inflaterState=t._InflaterState.readingBFinal}return Object.defineProperty(e.prototype,"_finished",{get:function(){return this._inflaterState===t._InflaterState.done||this._inflaterState===t._InflaterState.vFooter},enumerable:!0,configurable:!0}),e.prototype._setInput=function(t,e,i){this._input._setInput(t,e,i)},e.prototype._inflate=function(t,e,i){var r=0;do{var n=this._output._copyTo(t,e,i),s=n.count;if(t=n.data,s>0&&(e+=s,r+=s,i-=s),0===i)break}while(!this._finished&&this._decode());return{count:r,data:t}},e.prototype._decode=function(){var e=!1,i=!1;if(this._finished)return!0;if(this._inflaterState===t._InflaterState.readingBFinal){if(!this._input._availableBits(1))return!1;this._bfinal=this._input._getBits(1),this._inflaterState=t._InflaterState.readingBType}if(this._inflaterState===t._InflaterState.readingBType){if(!this._input._availableBits(2))return this._inflaterState=t._InflaterState.readingBType,!1;this._blockType=this._getBlockType(this._input._getBits(2)),this._blockType===t._BlockType.dynamicType?this._inflaterState=t._InflaterState.readingNlCodes:this._blockType===t._BlockType.staticType?(this._llTree=new or,this._llTree._loadTree(!0),this._distanceTree=new or,this._distanceTree._loadTree(!1),this._inflaterState=t._InflaterState.decodeTop):this._blockType===t._BlockType.unCompressedType&&(this._inflaterState=t._InflaterState.unCompressedAligning)}if(this._blockType===t._BlockType.dynamicType)this._getInflaterStateValue(this._inflaterState)<this._getInflaterStateValue(t._InflaterState.decodeTop)?i=this._decodeDynamicBlockHeader():(i=(r=this._decodeBlock(e)).result,e=r.eob,this._output=r.output);else if(this._blockType===t._BlockType.staticType)i=(r=this._decodeBlock(e)).result,e=r.eob,this._output=r.output;else if(this._blockType===t._BlockType.unCompressedType){var r=this._decodeUncompressedBlock(e);i=r.result,e=r.eob,this._output=r.output}return e&&0!==this._bfinal&&(this._inflaterState=t._InflaterState.done),i},e.prototype._decodeUncompressedBlock=function(e){for(e=!1;;)switch(this._inflaterState){case t._InflaterState.unCompressedAligning:if(this._input._skipByteBoundary(),this._inflaterState=t._InflaterState.unCompressedByte1,!this._unCompressedByte())return{result:!1,eob:e,output:this._output};break;case t._InflaterState.unCompressedByte1:case t._InflaterState.unCompressedByte2:case t._InflaterState.unCompressedByte3:case t._InflaterState.unCompressedByte4:if(!this._unCompressedByte())return{result:!1,eob:e,output:this._output};break;case t._InflaterState.decodeUnCompressedBytes:return this._bLength-=this._output._copyFrom(this._input,this._bLength),0===this._bLength?(this._inflaterState=t._InflaterState.readingBFinal,e=!0,{result:!0,eob:e,output:this._output}):0===this._output._unusedBytes?{result:!0,eob:e,output:this._output}:{result:!1,eob:e,output:this._output}}},e.prototype._unCompressedByte=function(){var e=this._input._getBits(8);if(e<0)return!1;var i=this._getInflaterStateValue(this._inflaterState),n=this._getInflaterStateValue(t._InflaterState.unCompressedByte1);if(this._blBuffer[i-n]=r(e,8),this._inflaterState===t._InflaterState.unCompressedByte4&&(this._bLength=this._blBuffer[0]+256*this._blBuffer[1],r(this._bLength,16)!==r(~(this._blBuffer[2]+256*this._blBuffer[3]),16)))throw new Error("Ivalid block length.");return this._inflaterState=this._getInflaterState(this._getInflaterStateValue(this._inflaterState)+1),!0},e.prototype._decodeBlock=function(e){e=!1;for(var i=this._output._unusedBytes;i>258;){var n=void 0,s=void 0,a=void 0,o=void 0;switch(this._inflaterState){case t._InflaterState.decodeTop:if((n=this._llTree._getNextSymbol(this._input))<0)return{result:!1,eob:e,output:this._output};if(n<256)this._output._write(r(n,8)),--i;else{if(256===n)return e=!0,this._inflaterState=t._InflaterState.readingBFinal,{result:!0,eob:e,output:this._output};if((n-=257)<8)n+=3,this._extraBits=0;else if(28===n)n=258,this._extraBits=0;else{if(n<0||n>=this._extraLengthBits.length)throw new Error("Invalid data.");this._extraBits=this._extraLengthBits[Number.parseInt(n.toString(),10)]}if(this._length=n,o=this._inLength(i),i=o.fb,!o.value)return{result:!1,eob:e,output:this._output}}break;case t._InflaterState.iLength:if(o=this._inLength(i),i=o.fb,!o.value)return{result:!1,eob:e,output:this._output};break;case t._InflaterState.fLength:if(a=this._fLength(i),i=a.fb,!a.value)return{result:!1,eob:e,output:this._output};break;case t._InflaterState.dCode:if(s=this._dcode(i),i=s.fb,!s.value)return{result:!1,eob:e,output:this._output}}}return{result:!0,eob:e,output:this._output}},e.prototype._inLength=function(e){if(this._extraBits>0){this._inflaterState=t._InflaterState.iLength;var i=this._input._getBits(this._extraBits);if(i<0)return{value:!1,fb:e};if(this._length<0||this._length>=this._lengthBase.length)throw new Error("Invalid data.");this._length=this._lengthBase[this._length]+i}this._inflaterState=t._InflaterState.fLength;var r=this._fLength(e);return e=r.fb,r.value?{value:!0,fb:e}:{value:!1,fb:e}},e.prototype._fLength=function(e){if(this._blockType===t._BlockType.dynamicType?this._distanceCode=this._distanceTree._getNextSymbol(this._input):(this._distanceCode=this._input._getBits(5),this._distanceCode>=0&&(this._distanceCode=this._staticDistanceTreeTable[this._distanceCode])),this._distanceCode<0)return{value:!1,fb:e};this._inflaterState=t._InflaterState.dCode;var i=this._dcode(e);return e=i.fb,i.value?{value:!0,fb:e}:{value:!1,fb:e}},e.prototype._dcode=function(e){var i;if(this._distanceCode>3){this._extraBits=this._distanceCode-2>>1;var r=this._input._getBits(this._extraBits);if(r<0)return{value:!1,fb:e};i=this._distanceBasePosition[this._distanceCode]+r}else i=this._distanceCode+1;return this._output._writeLD(this._length,i),e-=this._length,this._inflaterState=t._InflaterState.decodeTop,{value:!0,fb:e}},e.prototype._decodeDynamicBlockHeader=function(){switch(this._inflaterState){case t._InflaterState.readingNlCodes:if(this._llCodeCount=this._input._getBits(5),this._llCodeCount<0)return!1;if(this._llCodeCount+=257,this._inflaterState=t._InflaterState.readingNdCodes,!this._readingNDCodes())return!1;break;case t._InflaterState.readingNdCodes:if(!this._readingNDCodes())return!1;break;case t._InflaterState.readingCodes:if(!this._readingCodes())return!1;break;case t._InflaterState.readingClCodes:if(!this._readingCLCodes())return!1;break;case t._InflaterState.readingTcBefore:case t._InflaterState.readingTcAfter:if(!this._readingTCBefore())return!1}var e=Array(or._maxLengthTree).fill(0);a(e,0,this._codeList,0,this._llCodeCount);var i=Array(or._maxDepthTree).fill(0);return a(i,0,this._codeList,this._llCodeCount,this._llCodeCount+this._dCodeCount),this._llTree=new or,this._llTree._load(e),this._distanceTree=new or,this._distanceTree._load(i),this._inflaterState=t._InflaterState.decodeTop,!0},e.prototype._readingNDCodes=function(){return this._dCodeCount=this._input._getBits(5),!(this._dCodeCount<0)&&(this._dCodeCount+=1,this._inflaterState=t._InflaterState.readingCodes,!!this._readingCodes())},e.prototype._readingCodes=function(){return this._clCodeCount=this._input._getBits(4),!(this._clCodeCount<0)&&(this._clCodeCount+=4,this._loopCounter=0,this._inflaterState=t._InflaterState.readingClCodes,!!this._readingCLCodes())},e.prototype._readingCLCodes=function(){for(;this._loopCounter<this._clCodeCount;){var e=this._input._getBits(3);if(e<0)return!1;this._cltcl[this._codeOrder[this._loopCounter]]=r(e,8),++this._loopCounter}for(var i=this._clCodeCount;i<this._codeOrder.length;i++)this._cltcl[this._codeOrder[Number.parseInt(i.toString(),10)]]=0;return this._clTree=new or,this._clTree._load(this._cltcl),this._caSize=this._llCodeCount+this._dCodeCount,this._loopCounter=0,this._inflaterState=t._InflaterState.readingTcBefore,!!this._readingTCBefore()},e.prototype._readingTCBefore=function(){for(;this._loopCounter<this._caSize;){if(this._inflaterState===t._InflaterState.readingTcBefore&&(this._lengthCode=this._clTree._getNextSymbol(this._input),this._lengthCode<0))return!1;if(this._lengthCode<=15)this._codeList[this._loopCounter++]=r(this._lengthCode,8);else{if(!this._input._availableBits(7))return this._inflaterState=t._InflaterState.readingTcAfter,!1;var e=void 0;if(16===this._lengthCode){if(0===this._loopCounter)throw new Error("Invalid data.");var i=r(this._codeList[this._loopCounter-1],8);if(e=this._input._getBits(2)+3,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(n=0;n<e;n++)this._codeList[this._loopCounter++]=i}else if(17===this._lengthCode){if(e=this._input._getBits(3)+3,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(n=0;n<e;n++)this._codeList[this._loopCounter++]=0}else{if(e=this._input._getBits(7)+11,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(var n=0;n<e;n++)this._codeList[this._loopCounter++]=0}}this._inflaterState=t._InflaterState.readingTcBefore}return!0},e.prototype._getBlockType=function(e){return e===t._BlockType.unCompressedType?t._BlockType.unCompressedType:e===t._BlockType.staticType?t._BlockType.staticType:t._BlockType.dynamicType},e.prototype._getInflaterState=function(e){switch(e){case 0:return t._InflaterState.readingHeader;case 2:return t._InflaterState.readingBFinal;case 3:return t._InflaterState.readingBType;case 4:return t._InflaterState.readingNlCodes;case 5:return t._InflaterState.readingNdCodes;case 6:return t._InflaterState.readingCodes;case 7:return t._InflaterState.readingClCodes;case 8:return t._InflaterState.readingTcBefore;case 9:return t._InflaterState.readingTcAfter;case 10:return t._InflaterState.decodeTop;case 11:return t._InflaterState.iLength;case 12:return t._InflaterState.fLength;case 13:return t._InflaterState.dCode;case 15:return t._InflaterState.unCompressedAligning;case 16:return t._InflaterState.unCompressedByte1;case 17:return t._InflaterState.unCompressedByte2;case 18:return t._InflaterState.unCompressedByte3;case 19:return t._InflaterState.unCompressedByte4;case 20:return t._InflaterState.decodeUnCompressedBytes;case 21:return t._InflaterState.srFooter;case 22:return t._InflaterState.rFooter;case 23:return t._InflaterState.vFooter;case 24:return t._InflaterState.done;default:return t._InflaterState.readingHeader}},e.prototype._getInflaterStateValue=function(e){switch(e){case t._InflaterState.readingHeader:return 0;case t._InflaterState.readingBFinal:return 2;case t._InflaterState.readingBType:return 3;case t._InflaterState.readingNlCodes:return 4;case t._InflaterState.readingNdCodes:return 5;case t._InflaterState.readingCodes:return 6;case t._InflaterState.readingClCodes:return 7;case t._InflaterState.readingTcBefore:return 8;case t._InflaterState.readingTcAfter:return 9;case t._InflaterState.decodeTop:return 10;case t._InflaterState.iLength:return 11;case t._InflaterState.fLength:return 12;case t._InflaterState.dCode:return 13;case t._InflaterState.unCompressedAligning:return 15;case t._InflaterState.unCompressedByte1:return 16;case t._InflaterState.unCompressedByte2:return 17;case t._InflaterState.unCompressedByte3:return 18;case t._InflaterState.unCompressedByte4:return 19;case t._InflaterState.decodeUnCompressedBytes:return 20;case t._InflaterState.srFooter:return 21;case t._InflaterState.rFooter:return 22;case t._InflaterState.vFooter:return 23;case t._InflaterState.done:return 24;default:return 0}},e}(),cr=function(){function t(t,e,i){this._offset=e,this._data=t,this._leaveOpen=i,this._inflater=new hr,this._buffer=Array(8192).fill(0)}return t.prototype._read=function(t,e,i){for(var r,n=e,s=i;;){var a=this._inflater._inflate(t,n,s);if(r=a.count,t=a.data,n+=r,0===(s-=r))break;if(this._inflater._finished)break;var o=this._readBytes(),h=o.count;if(this._buffer=o.buffer,0===h)break;this._inflater._setInput(this._buffer,0,h)}return{count:i-s,data:t}},t.prototype._readBytes=function(){if(this._offset>=this._data.length)return{buffer:[],count:0};for(var t=0,e=0;e<this._buffer.length&&e+this._offset<this._data.length;e++)this._buffer[Number.parseInt(e.toString(),10)]=this._data[this._offset+e],t++;return this._offset+=t,{buffer:this._buffer,count:t}},t}(),_r=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),dr=function(e){function i(i){var r=e.call(this)||this;return r._stream=i,r._format=t._ImageFormat.png,r._isRedGreenBlue=!1,r._isDecode=!1,r._shades=!1,r._ideateDecode=!0,r._colors=0,r._bitsPerPixel=0,r._idatLength=0,r._inputBands=0,r._position=8,r._initialize(),r}return _r(i,e),i.prototype._initialize=function(){for(var t,e=this._hasValidChunkType(t);e.hasValidChunk;){switch(t=e.type){case nr.iHDR:this._readHeader();break;case nr.iDAT:this._readImageData();break;case nr.sRGB:this._isRedGreenBlue=!0,this._ignoreChunk();break;case nr.pLTE:this._readPhotoPlate();break;case nr.iEND:this._decodeImageData();break;case nr.tRNS:this._readTransparency();break;case nr.tEXt:case nr.iTXt:case nr.zTXt:case nr.hIST:case nr.sBIT:case nr.iCCP:case nr.pHYs:case nr.tIME:case nr.bKGD:case nr.gAMA:case nr.cHRM:case nr.unknown:this._ignoreChunk()}e=this._hasValidChunkType(t)}},i.prototype._hasValidChunkType=function(t){if(t=nr.unknown,this._position+8<=this._stream.byteLength){this._currentChunkLength=this._readUnsigned32(this._position),this._seek(4);var e=this._readString(4),i=this._getChunkType(e);return void 0!==i&&null!==i?(t=i,{type:t,hasValidChunk:!0}):this._stream.byteLength===this._position?{type:t,hasValidChunk:!1}:{type:t,hasValidChunk:!0}}return{type:t,hasValidChunk:!1}},i.prototype._ignoreChunk=function(){this._currentChunkLength>0&&this._seek(this._currentChunkLength+4)},i.prototype._readHeader=function(){this._header=new pr,this._header._width=this._readUnsigned32(this._position),this._seek(4),this._header._height=this._readUnsigned32(this._position),this._seek(4),this._header._bitDepth=this._readByte(),this._header._colorType=this._readByte(),this._header._compression=this._readByte(),this._header._filter=this._getFilterType(this._readByte()),this._header._interlace=this._readByte(),this._colors=3===this._header._colorType||0==(2&this._header._colorType)?1:3,this._width=this._header._width,this._height=this._header._height,this._bitsPerComponent=this._header._bitDepth,this._setBitsPerPixel(),this._seek(4)},i.prototype._setBitsPerPixel=function(){this._bitsPerPixel=16===this._header._bitDepth?2:1,0===this._header._colorType?(this._idatLength=Number.parseInt(((this._bitsPerComponent*this._width+7)/8).toString(),10)*this._height,this._inputBands=1):2===this._header._colorType?(this._idatLength=this._width*this._height*3,this._inputBands=3,this._bitsPerPixel*=3):3===this._header._colorType?(1===this._header._interlace&&(this._idatLength=Number.parseInt(((this._header._bitDepth*this._width+7)/8).toString(),10)*this._height),this._inputBands=1,this._bitsPerPixel=1):4===this._header._colorType?(this._idatLength=this._width*this._height,this._inputBands=2,this._bitsPerPixel*=2):6===this._header._colorType&&(this._idatLength=3*this._width*this._height,this._inputBands=4,this._bitsPerPixel*=4)},i.prototype._readImageData=function(){if(this._encodedStream&&0!==this._encodedStream.length||(this._encodedStream=[]),this._currentChunkLength<=this._stream.byteLength&&this._stream.byteLength-this._position>=this._currentChunkLength)for(var t=0;t<this._currentChunkLength;t++)this._encodedStream.push(this._readByte());this._seek(4)},i.prototype._readPhotoPlate=function(){if(3===this._header._colorType){this._colorSpace=[],this._colorSpace.push(Sr.get("Indexed")),this._colorSpace.push(this._getPngColorSpace()),this._colorSpace.push(this._currentChunkLength/3-1);var t=new Uint8Array(this._currentChunkLength);this._read(t,0,this._currentChunkLength),this._colorSpace.push(b(t)),this._seek(4)}else this._ignoreChunk()},i.prototype._readTransparency=function(){if(3===this._header._colorType){var t=new Uint8Array(this._currentChunkLength);this._read(t,0,this._currentChunkLength),this._seek(4),this._alpha=[];for(var e=0;e<t.length;e++){this._alpha.push(t[Number.parseInt(e.toString(),10)]);var i=255&t[Number.parseInt(e.toString(),10)];0!==i&&255!==i&&(this._shades=!0)}}else this._ignoreChunk()},i.prototype._getPngColorSpace=function(){if(this._isRedGreenBlue){var t=[],e=new Tr,i=[1,1,1],r=[2.2,2.2,2.2];if(e.set("Gamma",r),this._isRedGreenBlue){var n=-.0737289,s=.2126390058715103,a=-.0527286/n,o=.3*a/.6,h=a*(.7/.6-1),c=-.005321898/n;i=[.9504300891509299,1,1.088921671149305],e.set("Matrix",[.4123907992659594,s,.01933081871559183,o,a,h,.1804549505010925,c,.9503960726390872])}return e.set("WhitePoint",i),t.push(Sr.get("CalRGB")),t.push(e),t}return 0==(2&this._header._colorType)?Sr.get("DeviceGray"):Sr.get("DeviceRGB")},i.prototype._decodeImageData=function(){var t=this._header;this._isDecode=1===t._interlace||16===t._bitDepth||0!=(4&t._colorType)||this._shades,this._isDecode?((0!=(4&t._colorType)||this._shades)&&(this._maskData=Array(this._width*this._height).fill(0)),this._encodedStream&&(this._dataStream=this._getDeflatedData(this._encodedStream),this._dataStreamOffset=0),this._idatLength>0&&(this._decodedImageData=Array(this._idatLength).fill(0)),this._readDecodeData(),this._decodedImageData&&0===this._decodedImageData.length&&this._shades&&(this._ideateDecode=!1,this._decodedImageData=this._encodedStream)):(this._ideateDecode=!1,this._decodedImageData=this._encodedStream)},i.prototype._getDeflatedData=function(t){var e=t.slice(2,t.length-4),i=new cr(e,0,!0),r=Array(4096).fill(0),n=0,s=[];do{var a=i._read(r,0,r.length);n=a.count,r=a.data;for(var o=0;o<n;o++)s.push(r[Number.parseInt(o.toString(),10)])}while(n>0);return s},i.prototype._readDecodeData=function(){1!==this._header._interlace?this._decodeData(0,0,1,1,this._width,this._height):(this._decodeData(0,0,8,8,Math.floor((this._width+7)/8),Math.floor((this._height+7)/8)),this._decodeData(4,0,8,8,Math.floor((this._width+3)/8),Math.floor((this._height+7)/8)),this._decodeData(0,4,4,8,Math.floor((this._width+3)/4),Math.floor((this._height+3)/8)),this._decodeData(2,0,4,4,Math.floor((this._width+1)/4),Math.floor((this._height+3)/4)),this._decodeData(0,2,2,4,Math.floor((this._width+1)/2),Math.floor((this._height+1)/4)),this._decodeData(1,0,2,2,Math.floor(this._width/2),Math.floor((this._height+1)/2)),this._decodeData(0,1,1,2,this._width,Math.floor(this._height/2)))},i.prototype._decodeData=function(t,e,i,r,n,s){if(0!==n&&0!==s)for(var a=Math.floor((this._inputBands*n*this._header._bitDepth+7)/8),o=Array(a).fill(0),h=Array(a).fill(0),c=0,_=e;c<s;c++,_+=r){var d=this._dataStream[this._dataStreamOffset];switch(this._dataStreamOffset=this._dataStreamOffset+1,this._dataStreamOffset=this._readStream(this._dataStream,this._dataStreamOffset,o,a),this._getFilterType(d)){case lr.none:break;case lr.sub:this._decompressSub(o,a,this._bitsPerPixel);break;case lr.up:this._decompressUp(o,h,a);break;case lr.average:this._decompressAverage(o,h,a,this._bitsPerPixel);break;case lr.paeth:this._decompressPaeth(o,h,a,this._bitsPerPixel);break;default:throw new Error("Unknown PNG filter")}this._processPixels(o,t,i,_,n);var p=h;h=o,o=p}},i.prototype._readStream=function(t,e,i,r){var n=this._read(i,e,r,t);if(i=n.outputBuffer,e=n.offset,n.length<=0)throw new Error("Insufficient data");return e},i.prototype._decompressSub=function(t,e,i){for(var n=i;n<e;n++)t[Number.parseInt(n.toString(),10)]=r((255&t[Number.parseInt(n.toString(),10)])+(255&t[n-i]),8)},i.prototype._decompressUp=function(t,e,i){for(var n=0;n<i;n++)t[Number.parseInt(n.toString(),10)]=r((255&t[Number.parseInt(n.toString(),10)])+(255&e[Number.parseInt(n.toString(),10)]),8)},i.prototype._decompressAverage=function(t,e,i,n){for(s=0;s<n;s++)t[Number.parseInt(s.toString(),10)]=r(Math.floor(((255&t[Number.parseInt(s.toString(),10)])+(255&e[Number.parseInt(s.toString(),10)]))/2),8);for(var s=n;s<i;s++)t[Number.parseInt(s.toString(),10)]=r(Math.floor((255&t[Number.parseInt(s.toString(),10)])+((255&t[s-n])+(255&e[Number.parseInt(s.toString(),10)]))/2),8)},i.prototype._decompressPaeth=function(t,e,i,n){for(var s,a,o,h,c=0;c<n;c++)s=255&t[Number.parseInt(c.toString(),10)],o=255&e[Number.parseInt(c.toString(),10)],t[Number.parseInt(c.toString(),10)]=r(s+o,8);for(c=n;c<i;c++)s=255&t[Number.parseInt(c.toString(),10)],a=255&t[c-n],o=255&e[Number.parseInt(c.toString(),10)],h=255&e[c-n],t[Number.parseInt(c.toString(),10)]=r(s+this._paethPredictor(a,o,h),8)},i.prototype._paethPredictor=function(t,e,i){var r=t+e-i,n=Math.abs(r-t),s=Math.abs(r-e),a=Math.abs(r-i);return n<=s&&n<=a?t:s<=a?e:i},i.prototype._processPixels=function(t,e,i,n,a){var o=0,h=0,c=0,_=this._getPixel(t);if(0===this._header._colorType||3===this._header._colorType||4===this._header._colorType?c=1:2!==this._header._colorType&&6!==this._header._colorType||(c=3),this._decodedImageData&&this._decodedImageData.length>0){h=e;var d=16===this._header._bitDepth?8:this._header._bitDepth,p=Math.floor((c*a*d+7)/8);for(o=0;o<a;o++)this._decodedImageData=this._setPixel(this._decodedImageData,_,this._inputBands*o,c,h,n,this._header._bitDepth,p),h+=i}if(0!=(4&this._header._colorType)||this._shades)if(0!=(4&this._header._colorType)){if(16===this._header._bitDepth)for(var l=0;l<a;++l){var u=l*this._inputBands+c,f=r(_[Number.parseInt(u.toString(),10)],32);_[Number.parseInt(u.toString(),10)]=s(f>>8)}p=a;for(h=e,o=0;o<a;o++)this._maskData=this._setPixel(this._maskData,_,this._inputBands*o+c,1,h,n,8,p),h+=i}else{var p=a,g=[0];for(h=e,o=0;o<a;o++){var y=_[Number.parseInt(o.toString(),10)];y<this._alpha.length?g[0]=this._alpha[Number.parseInt(y.toString(),10)]:g[0]=255,this._maskData=this._setPixel(this._maskData,g,0,1,h,n,8,p),h+=i}}},i.prototype._getPixel=function(t){if(8===this._header._bitDepth){for(var e=Array(t.length).fill(0),i=0;i<e.length;++i)e[Number.parseInt(i.toString(),10)]=255&t[Number.parseInt(i.toString(),10)];return e}if(16===this._header._bitDepth){for(var e=Array(Math.floor(t.length/2)).fill(0),i=0;i<e.length;++i)e[Number.parseInt(i.toString(),10)]=((255&t[2*i])<<8)+(255&t[2*i+1]);return e}for(var e=Array(Math.floor(8*t.length/this._header._bitDepth)).fill(0),n=0,a=Math.floor(8/this._header._bitDepth),o=(1<<this._header._bitDepth)-1,h=0;h<t.length;++h)for(i=a-1;i>=0;--i){var c=this._header._bitDepth*i,_=t[Number.parseInt(h.toString(),10)];e[n++]=(c<1?_:s(r(_,32)>>c))&o}return e},i.prototype._setPixel=function(t,e,i,n,s,a,o,h){if(8===o)for(var c=h*a+n*s,_=0;_<n;++_)t[c+_]=r(e[_+i],8);else if(16===o)for(var c=h*a+n*s,_=0;_<n;++_)t[c+_]=r(e[_+i]>>8,8);else{var c=Math.floor((h*a+s)/(8/o)),d=e[Number.parseInt(i.toString(),10)]<<Number.parseInt((8-o*(s%(8/o))-o).toString(),10);t[Number.parseInt(c.toString(),10)]=t[Number.parseInt(c.toString(),10)]|r(d,8)}return t},i.prototype._getImageDictionary=function(){var t=[];this._imageStream=new Rr(t,new Tr),this._imageStream.isImageStream=!0;for(var e="",i=0;i<this._decodedImageData.length;i++)e+=String.fromCharCode(this._decodedImageData[Number.parseInt(i.toString(),10)]);this._imageStream.data=[e],this._imageStream._isCompress=this._isDecode&&this._ideateDecode;var r=new Tr;r.set("Type",new Sr("XObject")),r.set("Subtype",new Sr("Image")),r.set("Width",this._width),r.set("Height",this._height),16===this._bitsPerComponent?r.set("BitsPerComponent",8):r.set("BitsPerComponent",this._bitsPerComponent),this._isDecode&&this._ideateDecode||r.set("Filter",new Sr("FlateDecode")),0==(2&this._header._colorType)?r.set("ColorSpace",Sr.get("DeviceGray")):r.set("ColorSpace",Sr.get("DeviceRGB")),(!this._isDecode||this._shades&&!this._ideateDecode)&&r.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=r,this._imageStream.bytes=new Uint8Array(this._imageStream.data[0].length);for(i=0;i<this._imageStream.data[0].length;i++)this._imageStream.bytes[Number.parseInt(i.toString(),10)]=this._imageStream.data[0].charCodeAt(i);return this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0,this._setMask(),this._imageStream},i.prototype._setMask=function(){if(this._maskData&&this._maskData.length>0){this._maskStream=new Rr(this._maskData,new Tr),this._maskStream._isCompress=this._isDecode&&this._ideateDecode;var t=new Tr;t.set("Type",new Sr("XObject")),t.set("Subtype",new Sr("Image")),t.set("Width",this._width),t.set("Height",this._height),16===this._bitsPerComponent?t.set("BitsPerComponent",8):t.set("BitsPerComponent",this._bitsPerComponent),t.set("ColorSpace",Sr.get("DeviceGray")),this._maskStream.dictionary=t,this._maskStream.bytes=new Uint8Array(this._maskData),this._maskStream.end=this._maskStream.bytes.length,this._maskStream.dictionary._updated=!0}},i.prototype._getDecodeParams=function(){var t=new Tr;return t.set("Columns",this._width),t.set("Colors",this._colors),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},i.prototype._getChunkType=function(t){switch(t){case"IHDR":return nr.iHDR;case"PLTE":return nr.pLTE;case"IDAT":return nr.iDAT;case"IEND":return nr.iEND;case"bKGD":return nr.bKGD;case"cHRM":return nr.cHRM;case"gAMA":return nr.gAMA;case"hIST":return nr.hIST;case"pHYs":return nr.pHYs;case"sBIT":return nr.sBIT;case"tEXt":return nr.tEXt;case"tIME":return nr.tIME;case"tRNS":return nr.tRNS;case"zTXt":return nr.zTXt;case"sRGB":return nr.sRGB;case"iCCP":return nr.iCCP;case"iTXt":return nr.iTXt;case"Unknown":return nr.unknown;default:return null}},i.prototype._getFilterType=function(t){switch(t){case 1:return lr.sub;case 2:return lr.up;case 3:return lr.average;case 4:return lr.paeth;default:return lr.none}},i}(er),pr=function(){function t(){this._width=0,this._height=0,this._colorType=0,this._compression=0,this._bitDepth=0,this._interlace=0,this._filter=lr.none}return t}();!function(t){t[t.iHDR=0]="iHDR",t[t.pLTE=1]="pLTE",t[t.iDAT=2]="iDAT",t[t.iEND=3]="iEND",t[t.bKGD=4]="bKGD",t[t.cHRM=5]="cHRM",t[t.gAMA=6]="gAMA",t[t.hIST=7]="hIST",t[t.pHYs=8]="pHYs",t[t.sBIT=9]="sBIT",t[t.tEXt=10]="tEXt",t[t.tIME=11]="tIME",t[t.tRNS=12]="tRNS",t[t.zTXt=13]="zTXt",t[t.sRGB=14]="sRGB",t[t.iCCP=15]="iCCP",t[t.iTXt=16]="iTXt",t[t.unknown=17]="unknown"}(nr||(nr={}));var lr;!function(t){t[t.none=0]="none",t[t.sub=1]="sub",t[t.up=2]="up",t[t.average=3]="average",t[t.paeth=4]="paeth"}(lr||(lr={}));var ur=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),fr=function(){function t(t,e){this.message=t,this.name=e}return t}(),gr=function(t){function e(e){return t.call(this,e,"FormatError")||this}return ur(e,t),e}(fr),yr=function(t){function e(e){return t.call(this,e,"ParserEndOfFileException")||this}return ur(e,t),e}(fr),mr=Object.create(null),br=Object.create(null),vr=Object.create(null),Sr=function(){function t(t){this.name=t}return t.get=function(e){return mr[e]||(mr[e]=new t(e))},t}(),wr=function(){function t(t){this.command=t}return t.get=function(e){return br[e]||(br[e]=new t(e))},t}(),Pr=function(){function t(t,e){this._isNew=!1,this.objectNumber=t,this.generationNumber=e}return t.prototype.toString=function(){return this.objectNumber+" "+this.generationNumber},t.get=function(e,i){var r=0===i?e+"R":e+"R"+i;return vr[r]||(vr[r]=new t(e,i))},t}(),Ar=function(){function t(t){void 0===t&&(t=null),this._set=new Set(t&&t._set)}return t.prototype.has=function(t){return this._set.has(t.toString())},t.prototype.put=function(t){this._set.add(t.toString())},t.prototype.remove=function(t){this._set.delete(t.toString())},t.prototype.clear=function(){this._set.clear()},t}(),kr=function(){function t(){this._map=new Map}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.get=function(t){return this._map.get(t.toString())},t.prototype.has=function(t){return this._map.has(t.toString())},t.prototype.put=function(t,e){this._map.set(t.toString(),e)},t.prototype.set=function(t,e){this._map.set(t,e)},t.prototype.clear=function(){this._map.clear()},t}(),xr=function(){function t(t){this.table={},this.nElements=0,this.toStr=t||kt}return t.prototype.getValue=function(t){var e=this.table["$"+this.toStr(t)];if(void 0!==e)return e.value},t.prototype.setValue=function(t,e){var i="$"+this.toStr(t);this.table[i];this.nElements++,this.table[i]={key:t,value:e}},t.prototype.keys=function(){for(var t=[],e=Object.keys(this.table),i=0;i<e.length;i++){var r=this.table[e[i]];t.push(r.key)}return t},t.prototype.containsKey=function(t){return!(void 0===this.getValue(t))},t.prototype._size=function(){return this.nElements},t}(),Tr=function(){function t(t){this._isFont=!1,this._initialize(t)}return Object.defineProperty(t.prototype,"size",{get:function(){return Object.keys(this._map).length},enumerable:!0,configurable:!0}),t.prototype.assignXref=function(t){this._crossReference=t},t.prototype.getRaw=function(t){return this._map[t]},t.prototype.getRawValues=function(){return this._map.values},t.prototype.get=function(t,e,i){var r=this._get(t,e,i);return this._crossReference&&void 0!==r&&r instanceof Pr&&(r=this._crossReference._fetch(r)),r},t.prototype.getArray=function(t,e,i){var r=this.get(t,e,i);if(this._crossReference&&void 0!==r&&Array.isArray(r)){r=r.slice();for(var n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)];null!==s&&void 0!==s&&s instanceof Pr&&(r[Number.parseInt(n.toString(),10)]=this._crossReference._fetch(s))}}return r},t.prototype.set=function(t,e){this._map[t]=e},t.prototype.has=function(t){return void 0!==this._map[t]},t.prototype.forEach=function(t){for(var e in this._map)t(e,this.getRaw(e))},t.prototype.update=function(t,e){if(this.has(t)){var i=this._map[t];null!==i&&void 0!==i&&i instanceof Pr&&this._crossReference&&(i=this._crossReference._fetch(i)),i!==e&&(this._map[t]=e,this._updated=!0)}else this._map[t]=e,this._updated=!0},t.getEmpty=function(e){var i=new t(e);return i.set=function(t,e){throw new Error("Should not call set on the empty dictionary.")},i},t.merge=function(e,i,r){void 0===r&&(r=!1);for(var n=new t(e),s=Object.create(null),a=0,o=i;a<o.length;a++)if((w=o[a])instanceof t)for(var h=0,c=w._map;h<c.length;h++){var _=c[h],d=_[0],p=_[1],l=s.get(d);if(void 0===l)l=[],s.set(d,l);else if(!(r&&p instanceof t))continue;l.push(p)}for(var u=0,f=s;u<f.length;u++){var g=f[u],y=g[0],m=g[1];if(1!==m.length&&m[0]instanceof t){for(var b=new t(e),v=0,S=m;v<S.length;v++)for(var w=S[v],P=0,A=w._map;P<A.length;P++){var k=A[P],d=k[0],p=k[1];void 0===b._map[d]&&(b._map[d]=p)}b.size>0&&(n._map[y]=b)}else n._map[y]=m[0]}return s.clear(),n.size>0?n:t.getEmpty(e)},t.prototype._initialize=function(t){this._map=Object.create(null),this.suppressEncryption=!1,this._updated=!1,this.isCatalog=!1,this._isNew=!1,t&&(this._crossReference=t)},t.prototype._get=function(t,e,i){var r=this._map[t];return void 0===r&&(r=this._map[e],void 0!==e&&null!==e?r=this._map[e]:void 0!==i&&null!==i&&(r=this._map[i])),r},t}(),Ir=function(){function t(t){void 0===t&&(t=[]),this.value=t}return t}(),Nr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Cr=function(){function t(){this._isCompress=!0}return t.prototype.getByte=function(){return null},t.prototype.getBytes=function(t){return null},Object.defineProperty(t.prototype,"length",{get:function(){throw new Error("Abstract getter `length` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){throw new Error("Abstract getter `isEmpty` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDataLoaded",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.peekByte=function(){var t=this.getByte();return-1!==t&&this.offset--,t},t.prototype.peekBytes=function(t){var e=this.getBytes(t);return this.offset-=e.length,e},t.prototype.getUnsignedInteger16=function(){var t=this.getByte(),e=this.getByte();return-1===t||-1===e?-1:(t<<8)+e},t.prototype.getInt32=function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},t.prototype.getByteRange=function(t,e){return null},t.prototype.makeSubStream=function(t,e,i){return null},t.prototype.readBlock=function(){return null},t.prototype.reset=function(){return null},t.prototype.moveStart=function(){return null},t.prototype.getString=function(t,e){return void 0===t&&(t=!1),void 0!==e&&null!==e||(e=this.getBytes()),t?S(e):b(e)},t.prototype.skip=function(t){this.offset+=t||1},t.prototype.getBaseStreams=function(){return null},t}(),Rr=function(t){function e(e,i,r,n){var s=t.call(this)||this;return s.isImageStream=!1,s.bytes=e instanceof Uint8Array?e:new Uint8Array(e),s.start=void 0!==r?r:0,s.position=s.start,s.end=r+n||s.bytes.length,s.dictionary=i,s}return Nr(e,t),Object.defineProperty(e.prototype,"position",{get:function(){return this.offset},set:function(t){this.offset=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.end-this.start},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.dataStream2},set:function(t){this.dataStream2=[],this.dataStream2=t},enumerable:!0,configurable:!0}),e.prototype.getByte=function(){return this.position>=this.end?-1:this.bytes[this.position++]},e.prototype.getBytes=function(t){var e=this.bytes,i=this.position,r=this.end;if(!t)return e.subarray(i,r);var n=i+t;return n>r&&(n=r),this.position=n,e.subarray(i,n)},e.prototype.getByteRange=function(t,e){return t<0&&(t=0),e>this.end&&(e=this.end),this.bytes.subarray(t,e)},e.prototype.reset=function(){this.position=this.start},e.prototype.moveStart=function(){this.start=this.position},e.prototype.makeSubStream=function(t,i,r){return void 0===r&&(r=null),new e(this.bytes.buffer,r,t,i)},e.prototype.readBlock=function(){throw new Error("Abstract method `readBlock` called")},e.prototype._clearStream=function(){null!==this.dictionary&&void 0!==this.dictionary&&this.dictionary.has("Filter")&&delete this.dictionary._map.Filter,this._isCompress=!0,this.dictionary._updated=!0},e.prototype._write=function(t){this.bytes=new Uint8Array(t.length);for(var e=0;e<t.length;e++)this.bytes[Number.parseInt(e.toString(),10)]=t.charCodeAt(e);this.end=this.bytes.length,this.dictionary._updated=!0},e.prototype._writeBytes=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[Number.parseInt(i.toString(),10)]);this.bytes=new Uint8Array(t),this.end=this.bytes.length,this.dictionary._updated=!0},e}(Cr),Fr=function(t){function e(e){var i=t.call(this)||this;return i._bytes=e,i.dictionary=new Tr,i.dictionary._updated=!0,i}return Nr(e,t),Object.defineProperty(e.prototype,"length",{get:function(){return this._bytes.length},enumerable:!0,configurable:!0}),e.prototype.write=function(t){if("string"==typeof t)for(e=0;e<t.length;e++)this._bytes.push(t.charCodeAt(e));else for(var e=0;e<t.length;e++)this._bytes.push(t[Number.parseInt(e.toString(),10)]);this.dictionary._updated=!0},e.prototype.getString=function(t){void 0===t&&(t=!1);var e=new Uint8Array(this._bytes);if(void 0===e||null===e||void 0===e.length)throw new Error("Invalid argument for bytesToString");if(t)return S(e);var i=e.length;if(i<8192)return String.fromCharCode.apply(null,e);for(var r=[],n=0;n<i;n+=8192)r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+8192,i))));return r.join("")},e}(Cr),Br=function(t){function e(){return t.call(this,new Uint8Array(0))||this}return Nr(e,t),e}(Rr),Lr=function(){function e(t){this._recordCollection=[],this._operands=[],this._lexer=new Mr(t)}return e.prototype._readContent=function(){return this._parseObject(t._TokenType.eof),this._recordCollection},e.prototype._parseObject=function(e){for(var i;(i=this._getNextToken())!==t._TokenType.eof;){if(i===e||i===t._TokenType.none)return;switch(i){case t._TokenType.comment:break;case t._TokenType.number:"-"===this._lexer._operatorParams?this._operands.push("0"):this._operands.push(this._lexer._operatorParams);break;case t._TokenType.real:this._operands.push(this._lexer._operatorParams);break;case t._TokenType.string:case t._TokenType.hexString:case t._TokenType.unicodeHexString:case t._TokenType.unicodeString:case t._TokenType.name:this._operands.push(this._lexer._operatorParams);break;case t._TokenType.operator:this._createRecord(),this._operands=[];break;case t._TokenType.beginArray:break;case t._TokenType.endArray:throw new Error("Error while parsing content")}}},e.prototype._createRecord=function(){var t=this._lexer._operatorParams,e=new Dr(t,this._operands);this._recordCollection.push(e)},e.prototype._getNextToken=function(){return this._lexer._getNextToken()},e}(),Mr=function(){function e(e){this._tokenType=t._TokenType.none,this._currentCharacter="\0",this._nextCharacter="\0",this._offset=0,this._data=e instanceof Uint8Array?e:new Uint8Array(e)}return e.prototype._getNextToken=function(){this._operatorParams="";var e=this._moveToNextChar();switch(e){case"%":return this._tokenType=this._getComment();case"/":return this._tokenType=this._getName();case"[":case"(":return this._tokenType=this._getLiteralString();case"+":case"-":return this._tokenType=this._getNumber();case"<":return this._tokenType=this._getEncodedDecimalString();case".":return this._tokenType=this._getNumber();case'"':case"'":return this._tokenType=this._getOperator()}return isNaN(parseInt(e,10))?/[a-zA-Z]/.test(e)?this._tokenType=this._getOperator():e===String.fromCharCode(65535)?this._tokenType=t._TokenType.eof:this._tokenType=t._TokenType.none:this._tokenType=this._getNumber()},e.prototype._getComment=function(){this._operatorParams="";for(var e,i="\n"!==(e=this._consumeValue())&&e!==String.fromCharCode(65535);i;)i="\n"!==(e=this._consumeValue())&&e!==String.fromCharCode(65535);return t._TokenType.comment},e.prototype._getName=function(){this._operatorParams="";for(var e=!1;!e;)switch(this._consumeValue()){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"/":return e=!0,t._TokenType.name}return t._TokenType.none},e.prototype._getNumber=function(){var e=this._currentCharacter;for("+"!==e&&"-"!==e||(this._operatorParams+=this._currentCharacter,e=this._getNextChar());!isNaN(parseInt(e,10))||"."===e;){if(isNaN(parseInt(e,10))){if("."===e){if(this._operatorParams.includes("."))break;this._operatorParams+=this._currentCharacter}}else this._operatorParams+=this._currentCharacter;e=this._getNextChar()}return t._TokenType.number},e.prototype._getOperator=function(){this._operatorParams="";for(var e=this._currentCharacter;this._isOperator(e);)e=this._consumeValue();return t._TokenType.operator},e.prototype._isOperator=function(t){if(/[a-zA-Z]/.test(t))return!0;switch(t){case"*":case"'":case'"':case"1":case"0":return!0}return!1},e.prototype._getLiteralString=function(){this._operatorParams="";for(var e,i=this._currentCharacter,r=this._consumeValue(),n=!0;n;){if("("===i){e=this._getLiteralStringValue(r),this._operatorParams+=e,r=this._getNextChar(),n=!1;break}if("("!==r){if("]"===r){n=!1,r=this._consumeValue();break}r=this._consumeValue()}else r=this._consumeValue(),e=this._getLiteralStringValue(r),this._operatorParams+=e,r=this._getNextChar()}return t._TokenType.string},e.prototype._getEncodedDecimalString=function(){for(var e=0,i=this._consumeValue(),r=!0;r;)if("<"===i)e++,i=this._consumeValue();else if(">"===i){if(0===e){this._consumeValue(),r=!1;break}if(1===e){if(">"===(i=this._consumeValue())&&e--,1===e&&" "===i){r=!1;break}}else">"===i&&e--,i=this._consumeValue()}else if((i=this._consumeValue())===String.fromCharCode(65535)){r=!1;break}return t._TokenType.hexString},e.prototype._getLiteralStringValue=function(t){for(var e=0,i="",r=!0;r;)if("\\"!==t)if("("!==t)if(")"!==t||0===e){if(")"===t&&0===e)return i+=t,r=!1,i;i+=t,t=this._getNextChar()}else i+=t,t=this._getNextChar(),e--;else e++,i+=t,t=this._getNextChar();else i+=t,i+=t=this._getNextChar(),t=this._getNextChar();return i},e.prototype._consumeValue=function(){return this._operatorParams+=this._currentCharacter,this._getNextChar()},e.prototype._moveToNextChar=function(){for(;this._currentCharacter!==String.fromCharCode(65535);)switch(this._currentCharacter){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":this._getNextChar();break;default:return this._currentCharacter}return this._currentCharacter},e.prototype._getNextChar=function(){if(this._data.length<=this._offset){if("Q"===this._nextCharacter||"D"===this._currentCharacter&&"o"===this._nextCharacter)return this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(65535),this._currentCharacter;this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)}else this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&("\n"===this._nextCharacter?(this._currentCharacter=this._nextCharacter,this._data.length<=this._offset?this._nextCharacter=String.fromCharCode(65535):this._nextCharacter=String.fromCharCode(this._data[this._offset++])):this._currentCharacter="\n");return this._currentCharacter},e}(),Dr=function(){function t(t,e){this._operator=t,this._operands=e}return t}(),Or=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Er=function(t){function e(e){var i=t.call(this)||this;if(i._rawMinBufferLength=e||0,i.offset=0,i.bufferLength=0,i.eof=!1,i.buffer=new Uint8Array(0),i.minBufferLength=512,e)for(;i.minBufferLength<e;)i.minBufferLength*=2;return i}return Or(e,t),Object.defineProperty(e.prototype,"isEmpty",{get:function(){for(;!this.eof&&0===this.bufferLength;)this.readBlock();return 0===this.bufferLength},enumerable:!0,configurable:!0}),e.prototype.ensureBuffer=function(t){var e=this.buffer;if(t<=e.byteLength)return e;for(var i=this.minBufferLength;i<t;)i*=2;var r=new Uint8Array(i);return r.set(e),this.buffer=r,this.buffer},e.prototype.getByte=function(){for(var t=this.offset;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.offset++]},e.prototype.getBytes=function(t){var e,i=this.offset;if(t){for(this.ensureBuffer(i+t),e=i+t;!this.eof&&this.bufferLength<e;)this.readBlock();var r=this.bufferLength;e>r&&(e=r)}else{for(;!this.eof;)this.readBlock();e=this.bufferLength}return this.offset=e,this.buffer.subarray(i,e)},e.prototype.reset=function(){this.offset=0},e.prototype.makeSubStream=function(t,e,i){if(void 0===e)for(;!this.eof;)this.readBlock();else for(var r=t+e;this.bufferLength<=r&&!this.eof;)this.readBlock();return new Rr(this.buffer,i,t,e)},e.prototype.getBaseStreams=function(){return this.stream?this.stream.getBaseStreams():null},e.prototype.moveStart=function(){throw new Error("Invalid call from decode stream")},e.prototype.getByteRange=function(t,e){throw new Error("Invalid call from decode stream. begin: "+t+", end: "+e)},e.prototype.readBlock=function(){throw new Error("Invalid call from decode stream")},e}(Cr),Vr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),jr=function(t){function e(e,i,r){var n=t.call(this,i)||this;return n._chunkSize=512,n.stream=e,n.dictionary=e.dictionary,n._cipher=r,n._nextChunk=null,n._initialized=!1,n}return Vr(e,t),e.prototype.readBlock=function(){var t;if(this._initialized?t=this._nextChunk:(t=this.stream.getBytes(this._chunkSize),this._initialized=!0),!t||0===t.length)return void(this.eof=!0);this._nextChunk=this.stream.getBytes(this._chunkSize);var e=this._nextChunk&&this._nextChunk.length>0;t=this._cipher._decryptBlock(t,!e);for(var i=this.bufferLength,r=t.length,n=this.ensureBuffer(i+r),s=0;s<r;s++)n[i++]=t[Number.parseInt(s.toString(),10)];this.bufferLength=i},e}(Er),zr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ur=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wr=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),Hr=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Gr=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Kr=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],qr=function(t){function e(e,i){var r=t.call(this,i)||this;r.stream=e,r.dictionary=e.dictionary;var n=e.getByte(),s=e.getByte();if(8!=(15&n))throw new gr("Unknown compression method in flate stream: "+n+", "+s);if(((n<<8)+s)%31!=0)throw new gr("Bad flag check in flate stream: "+n+", "+s);if(32&s)throw new gr("Bad flag bit set in flate stream: "+n+", "+s);return r.codeSize=0,r.codeBuffer=0,r}return zr(e,t),e.prototype.getBits=function(t){for(var e,i=this.stream,r=this.codeSize,n=this.codeBuffer;r<t;)n|=(e=i.getByte())<<r,r+=8;return e=n&(1<<t)-1,this.codeBuffer=n>>t,this.codeSize=r-=t,e},e.prototype.getCode=function(t){for(var e=this.stream,i=t[0],r=t[1],n=this.codeSize,s=this.codeBuffer;n<r;)s|=e.getByte()<<n,n+=8;var a=i[s&(1<<r)-1],o=a>>16,h=65535&a;return o<1||n<o||(this.codeBuffer=s>>o,this.codeSize=n-o),h},e.prototype.generateHuffmanTable=function(t){var e,i=t.length,r=0;for(e=0;e<i;++e)t[e]>r&&(r=t[e]);for(var n=1<<r,s=new Int32Array(n),a=1,o=0,h=2;a<=r;++a,o<<=1,h<<=1)for(var c=0;c<i;++c)if(t[c]===a){var _=0,d=o;for(e=0;e<a;++e)_=_<<1|1&d,d>>=1;for(e=_;e<n;e+=h)s[e]=a<<16|c;++o}return[s,r]},e.prototype.readBlock=function(){var t,e,i=this.stream,r=this.getBits(3);if(1&r&&(this.eof=!0),0===(r>>=1)){var n=i.getByte(),s=n;s|=(n=i.getByte())<<8;var a=n=i.getByte();if(n=i.getByte(),(a|=n<<8)===(65535&~s)||0===s&&0===a){this.codeBuffer=0,this.codeSize=0;var o=this.bufferLength,h=o+s;if(t=this.ensureBuffer(h),this.bufferLength=h,0===s)-1===i.peekByte()&&(this.eof=!0);else{var c=i.getBytes(s);t.set(c,o),c.length<s&&(this.eof=!0)}return}}var _,d;if(1===r)_=Gr,d=Kr;else if(2===r){var p=this.getBits(5)+257,l=this.getBits(5)+1,u=this.getBits(4)+4,f=new Uint8Array(Ur.length),g=void 0;for(g=0;g<u;++g)f[Ur[g]]=this.getBits(3);var y=this.generateHuffmanTable(f);e=0,g=0;for(var m=p+l,b=new Uint8Array(m),v=void 0,S=void 0,w=void 0;g<m;){var P=this.getCode(y);if(16===P)v=2,S=3,w=e;else if(17===P)v=3,S=3,w=e=0;else{if(18!==P){b[g++]=e=P;continue}v=7,S=11,w=e=0}for(var A=this.getBits(v)+S;A-- >0;)b[g++]=w}_=this.generateHuffmanTable(b.subarray(0,p)),d=this.generateHuffmanTable(b.subarray(p,m))}for(var k=(t=this.buffer)?t.length:0,x=this.bufferLength;;){var T=this.getCode(_);if(T<256)x+1>=k&&(k=(t=this.ensureBuffer(x+1)).length),t[x++]=T;else{if(256===T)return void(this.bufferLength=x);var I=(T=Wr[T-=257])>>16;I>0&&(I=this.getBits(I)),e=(65535&T)+I,T=this.getCode(d),(I=(T=Hr[T])>>16)>0&&(I=this.getBits(I));var N=(65535&T)+I;x+e>=k&&(k=(t=this.ensureBuffer(x+e)).length);for(var C=0;C<e;++C,++x)t[x]=t[x-N]}}},e}(Er),Xr=function(){function t(t){if(this._crossReference=t,this._catalogDictionary=t._getCatalogObj(),!(this._catalogDictionary instanceof Tr))throw new gr("Catalog object is not a dictionary.");this._catalogDictionary.isCatalog=!0,this._topPagesDictionary=this._catalogDictionary.get("Pages"),this.pageKidsCountCache=new kr,this.pageIndexCache=new kr}return Object.defineProperty(t.prototype,"version",{get:function(){var t;if(this._catalogDictionary.has("Version")){var e=this._catalogDictionary.get("Version");e&&(t=e.name)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageCount",{get:function(){var t=this._topPagesDictionary.get("Count");if(void 0===t||!Number.isInteger(t))throw new gr("Invalid page count");return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"acroForm",{get:function(){var t;return this._catalogDictionary.has("AcroForm")&&(t=this._catalogDictionary.get("AcroForm")),null!==t&&void 0!==t||(t=this._createForm()),t},enumerable:!0,configurable:!0}),t.prototype._createForm=function(){var t=new Tr(this._crossReference),e=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(e,t),this._catalogDictionary.set("AcroForm",e),this._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0,t._updated=!0,t},t.prototype.getPageDictionary=function(t){var e=[this._topPagesDictionary],i=new Ar,r=this._catalogDictionary.getRaw("Pages");r instanceof Pr&&i.put(r);for(var n=this._crossReference,s=this.pageKidsCountCache,a=this.pageIndexCache,o=0;e.length>0;){var h=e.pop();if(null!==h&&void 0!==h&&h instanceof Pr){var c=s.get(h);if(c>=0&&o+c<=t){o+=c;continue}if(i.has(h))throw new gr("Pages tree contains circular reference.");i.put(h);var _=n._fetch(h);if(_ instanceof Tr&&(null!==(u=_.getRaw("Type"))&&void 0!==u&&u instanceof Pr&&(u=n._fetch(u)),Dt(u,"Page")||!_.has("Kids"))){if(s.has(h)||s.put(h,1),a.has(h)||a.put(h,o),o===t)return{dictionary:_,reference:h};o++;continue}e.push(_)}else{if(!(h instanceof Tr))throw new gr("Page dictionary kid reference points to wrong type of object.");var d=h.objId,p=h.get("Count");if(null!==p&&void 0!==p&&p instanceof Pr&&(p=n._fetch(p)),null!==p&&void 0!==p&&Number.isInteger(p)&&p>=0&&(d&&!s.has(d)&&s.set(d,p),o+p<=t))o+=p;else{var l=h.getRaw("Kids");if(null!==l&&void 0!==l&&l instanceof Pr&&(l=n._fetch(l)),!Array.isArray(l)){var u=h.getRaw("Type");if(null!==u&&void 0!==u&&u instanceof Pr&&(u=n._fetch(u)),Dt(u,"Page")||!h.has("Kids")){if(o===t)return{dictionary:h,reference:null};o++;continue}throw new gr("Page dictionary kids object is not an array.")}for(var f=l.length-1;f>=0;f--)e.push(l[f])}}}throw new Error("Page index "+t+" not found.")},t.prototype._destroy=function(){this._catalogDictionary&&(this._catalogDictionary=void 0),this._topPagesDictionary&&(this._topPagesDictionary=void 0),this.pageIndexCache&&(this.pageIndexCache.clear(),this.pageIndexCache=void 0),this.pageKidsCountCache&&(this.pageKidsCountCache.clear(),this.pageKidsCountCache=void 0)},t}(),Jr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qr=function(t){function e(e,i,r){var n=t.call(this,i)||this;if(!(r instanceof Tr))return e;var s=n.predictor=r.get("Predictor")||1;if(s<=1)return e;if(2!==s&&(s<10||s>15))throw new gr("Unsupported predictor: "+s);n.readBlock=2===s?n.readBlockTiff:n.readBlockPng,n.stream=e,n.dictionary=e.dictionary;var a=n.colors=r.get("Colors")||1,o=n.bits=r.get("BPC","BitsPerComponent")||8,h=n.columns=r.get("Columns")||1;return n.pixBytes=a*o+7>>3,n.rowBytes=h*a*o+7>>3,n}return Jr(e,t),e.prototype.readBlockTiff=function(){var t=this.rowBytes,e=this.bufferLength,i=this.ensureBuffer(e+t),r=this.bits,n=this.colors,s=this.stream.getBytes(t);if(this.eof=!s.length,!this.eof){var a,o=0,h=0,c=0,_=0,d=e;if(1===r&&1===n)for(a=0;a<t;++a){var p=s[a]^o;p^=p>>1,p^=p>>2,o=(1&(p^=p>>4))<<7,i[d++]=p}else if(8===r){for(a=0;a<n;++a)i[d++]=s[a];for(;a<t;++a)i[d]=i[d-n]+s[a],d++}else if(16===r){var l=2*n;for(a=0;a<l;++a)i[d++]=s[a];for(;a<t;a+=2){var u=((255&s[a])<<8)+(255&s[a+1])+((255&i[d-l])<<8)+(255&i[d-l+1]);i[d++]=u>>8&255,i[d++]=255&u}}else{var f=new Uint8Array(n+1),g=(1<<r)-1,y=0,m=e,b=this.columns;for(a=0;a<b;++a)for(var v=0;v<n;++v)c<r&&(o=o<<8|255&s[y++],c+=8),f[v]=f[v]+(o>>c-r)&g,c-=r,h=h<<r|f[v],(_+=r)>=8&&(i[m++]=h>>_-8&255,_-=8);_>0&&(i[m++]=(h<<8-_)+(o&(1<<8-_)-1))}this.bufferLength+=t}},e.prototype.readBlockPng=function(){var t=this.rowBytes,e=this.pixBytes,i=this.stream.getByte(),r=this.stream.getBytes(t);if(this.eof=!r.length,!this.eof){var n=this.bufferLength,s=this.ensureBuffer(n+t),a=s.subarray(n-t,n);0===a.length&&(a=new Uint8Array(t));var o,h,c,_=n;switch(i){case 0:for(o=0;o<t;++o)s[_++]=r[o];break;case 1:for(o=0;o<e;++o)s[_++]=r[o];for(;o<t;++o)s[_]=s[_-e]+r[o]&255,_++;break;case 2:for(o=0;o<t;++o)s[_++]=a[o]+r[o]&255;break;case 3:for(o=0;o<e;++o)s[_++]=(a[o]>>1)+r[o];for(;o<t;++o)s[_]=(a[o]+s[_-e]>>1)+r[o]&255,_++;break;case 4:for(o=0;o<e;++o)h=a[o],c=r[o],s[_++]=h+c;for(;o<t;++o){h=a[o];var d=a[o-e],p=s[_-e],l=p+h-d,u=l-p;u<0&&(u=-u);var f=l-h;f<0&&(f=-f);var g=l-d;g<0&&(g=-g),c=r[o],s[_++]=u<=f&&u<=g?p+c:f<=g?h+c:d+c}break;default:throw new gr("Unsupported predictor: "+i)}this.bufferLength+=t}},e}(Er),Yr=[1,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Zr=function(){function t(t){this.stream=t,this.nextChar(),this.stringBuffer=[],this._hexStringNumber=0,this.beginInlineImagePosition=-1}return t.prototype.nextChar=function(){return this.currentChar=this.stream.getByte()},t.prototype.peekChar=function(){return this.stream.peekByte()},t.prototype.getNumber=function(){var t=this.currentChar,e=!1,i=0,r=0;if(45===t?(r=-1,45===(t=this.nextChar())&&(t=this.nextChar())):43===t&&(r=1,t=this.nextChar()),10===t||13===t)do{t=this.nextChar()}while(10===t||13===t);if(46===t&&(i=10,t=this.nextChar()),t<48||t>57){if(A(t)||-1===t){if(10===i&&0===r)return 0;if(0===i&&-1===r)return 0}throw new gr("Invalid number: "+String.fromCharCode(t)+" (charCode "+t+")")}r=r||1;var n=t-48,s=0,a=1;for(t=this.nextChar();t>=0;){if(t>=48&&t<=57){var o=t-48;e?s=10*s+o:(0!==i&&(i*=10),n=10*n+o)}else if(46===t){if(0!==i)break;i=1}else{if(45===t){t=this.nextChar();continue}if(69!==t&&101!==t)break;if(43===(t=this.peekChar())||45===t)a=45===t?-1:1,this.nextChar();else if(t<48||t>57)break;e=!0}t=this.nextChar()}return 0!==i&&(n/=i),e&&(n*=Math.pow(10,a*s)),r*n},t.prototype.getString=function(){var t=1,e=!1,i=this.stringBuffer;i.length=0;for(var r=this.nextChar();;){var n=!1;switch(0|r){case-1:e=!0;break;case 40:++t,i.push("(");break;case 41:0==--t?(this.nextChar(),e=!0):i.push(")");break;case 92:switch(r=this.nextChar()){case-1:e=!0;break;case 110:i.push("\n");break;case 114:i.push("\r");break;case 116:i.push("\t");break;case 98:i.push("\b");break;case 102:i.push("\f");break;case 92:case 40:case 41:i.push(String.fromCharCode(r));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:var s=15&r;n=!0,(r=this.nextChar())>=48&&r<=55&&(s=(s<<3)+(15&r),(r=this.nextChar())>=48&&r<=55&&(n=!1,s=(s<<3)+(15&r))),i.push(String.fromCharCode(s));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:i.push(String.fromCharCode(r))}break;default:i.push(String.fromCharCode(r))}if(e)break;n||(r=this.nextChar())}return i.join("")},t.prototype.getName=function(){var t,e,i=this.stringBuffer;for(i.length=0,t=this.nextChar();t>=0&&!Yr[t];){if(35===t){if(t=this.nextChar(),Yr[t]){i.push("#");break}var r=this._toHexDigit(t);if(-1!==r){e=t,t=this.nextChar();var n=this._toHexDigit(t);if(-1===n){if(i.push("#",String.fromCharCode(e)),Yr[t])break;i.push(String.fromCharCode(t)),t=this.nextChar();continue}i.push(String.fromCharCode(r<<4|n))}else i.push("#",String.fromCharCode(t))}else i.push(String.fromCharCode(t));t=this.nextChar()}return Sr.get(i.join(""))},t.prototype.getHexString=function(){var t=this.stringBuffer;t.length=0;var e,i,r=this.currentChar,n=!0;for(this._hexStringNumber=0;;){if(r<0)break;if(62===r){this.nextChar();break}if(1!==Yr[r]){if(n){if(-1===(e=this._toHexDigit(r))){r=this.nextChar();continue}}else{if(-1===(i=this._toHexDigit(r))){r=this.nextChar();continue}t.push(String.fromCharCode(e<<4|i))}n=!n,r=this.nextChar()}else r=this.nextChar()}return t.join("")},t.prototype.getObject=function(){for(var t=!1,e=this.currentChar;;){if(e<0)return"EOF";if(t)10!==e&&13!==e||(t=!1);else if(37===e)t=!0;else if(1!==Yr[e])break;e=this.nextChar()}switch(0|e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),wr.get("[");case 93:return this.nextChar(),wr.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),wr.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),wr.get(">>")):wr.get(">");case 123:return this.nextChar(),wr.get("{");case 125:return this.nextChar(),wr.get("}");case 41:throw this.nextChar(),new gr("Illegal character: "+e)}var i=String.fromCharCode(e);if(e<32||e>127){var r=this.peekChar();if(r>=32&&r<=127)return this.nextChar(),wr.get(i)}for(e=this.nextChar();e>=0&&!Yr[e];){var n=i+String.fromCharCode(e);if(128===i.length)throw new gr("Command token too long: "+i.length);i=n,e=this.nextChar()}return"true"===i||"false"!==i&&("null"===i?null:("BI"===i&&(this.beginInlineImagePosition=this.stream.position),wr.get(i)))},t.prototype.peekObj=function(){var t,e=this.stream.position,i=this.currentChar,r=this.beginInlineImagePosition;try{t=this.getObject()}catch(t){}return this.stream.position=e,this.currentChar=i,this.beginInlineImagePosition=r,t},t.prototype.skipToNextLine=function(){for(var t=this.currentChar;t>=0;){if(13===t){10===(t=this.nextChar())&&this.nextChar();break}if(10===t){this.nextChar();break}t=this.nextChar()}},t.prototype._toHexDigit=function(t){return t>=48&&t<=57?15&t:t>=65&&t<=70||t>=97&&t<=102?9+(15&t):-1},t}(),$r=function(){function t(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=!1),this._isColorSpace=!1,this._isPassword=!1,this.lexicalOperator=t,this.xref=e,this.allowStreams=i,this.recoveryMode=r,this.imageCache=new Map,this.refill()}return t.prototype.refill=function(){this.first=this.lexicalOperator.getObject(),this.second=this.lexicalOperator.getObject()},t.prototype.shift=function(){this.second instanceof wr&&"ID"===this.second.command?(this.first=this.second,this.second=null):(this.first=this.second,this.second=this.lexicalOperator.getObject())},t.prototype.tryShift=function(){try{return this.shift(),!0}catch(t){return!1}},t.prototype.getObject=function(t){var e=this.first;if(this.shift(),e instanceof wr)switch(e.command){case"BI":return this.makeInlineImage(t);case"[":for(var i=[];!Ot(this.first,"]")&&"EOF"!==this.first;){var r=this.getObject(t);0===i.length&&Dt(r,"Indexed")&&(this._isColorSpace=!0),r=Bt(r,this._isColorSpace,this._isPassword),i.push(r)}if("EOF"===this.first){if(this.recoveryMode)return i;throw new yr("End of file inside array.")}return this._isColorSpace=!1,this.shift(),i;case"<<":for(var n=new Tr(this.xref);!Ot(this.first,">>")&&"EOF"!==this.first;)if(this.first instanceof Sr){var s=this.first.name;if("U"!==s&&"O"!==s&&"ID"!==s||(this._isPassword=!0),this.shift(),this._checkEnd())break;var a=this.getObject(t);a=Bt(a,this._isColorSpace,this._isPassword),this._isPassword=!1,n.set(s,a)}else this.shift();if("EOF"===this.first){if(this.recoveryMode)return n;throw new yr("End of file inside dictionary.")}return Ot(this.second,"stream")?!0===this.allowStreams?this.makeStream(n,t):n:(this.shift(),n);default:return e}if(Number.isInteger(e)){if(Number.isInteger(this.first)&&Ot(this.second,"R")){var o=Pr.get(e,this.first);return this.shift(),this.shift(),o}return e}return"string"==typeof e&&t?t.decryptString(e):e},t.prototype.findDiscreteDecodeInlineStreamEnd=function(t){var e,i,r=t.position,n=!1;for(e=t.getByte();-1!==e;)if(255===e){switch(t.getByte()){case 0:break;case 255:t.skip(-1);break;case 217:n=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:(i=t.getUnsignedInteger16())>2?t.skip(i-2):t.skip(-2)}if(n)break;e=t.getByte()}else e=t.getByte();var s=t.position-r;return-1===e?(t.skip(-s),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),s)},t.prototype.findDecodeInlineStreamEnd=function(t){for(var e,i=t.position;-1!==(e=t.getByte());)if(126===e){var r=t.position;for(e=t.peekByte();A(e);)t.skip(),e=t.peekByte();if(62===e){t.skip();break}if(t.position>r){var n=t.peekBytes(2);if(69===n[0]&&73===n[1])break}}var s=t.position-i;return-1===e?(t.skip(-s),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),s)},t.prototype.findHexDecodeInlineStreamEnd=function(t){var e,i=t.position;for(e=t.getByte();-1!==e&&62!==e;)e=t.getByte();var r=t.position-i;return-1===e?(t.skip(-r),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),r)},t.prototype.inlineStreamSkipEI=function(t){var e,i=0;for(e=t.getByte();-1!==e;){if(0===i)i=69===e?1:0;else if(1===i)i=73===e?2:0;else if(2===i)break;e=t.getByte()}},t.prototype.makeInlineImage=function(t){for(var e,i=this.lexicalOperator,r=i.stream,n=new Tr(this.xref);!Ot(this.first,"ID")&&"EOF"!==this.first;){if(!(this.first instanceof Sr))throw new gr("Dictionary key must be a name object");var s=this.first.name;if(this.shift(),"EOF"===this.first.name)break;n.set(s,this.getObject(t))}-1!==i.beginInlineImagePosition&&(e=r.position-i.beginInlineImagePosition);var a,o=n.get("F","Filter");if(o instanceof Sr)a=o.name;else if(Array.isArray(o)){var h=o[0],c=null!==h&&void 0!==h&&h instanceof Pr?this.xref._fetch(h):h;c&&(a=c.name)}var _,d=r.position;switch(a){case"DCT":case"DCTDecode":_=this.findDiscreteDecodeInlineStreamEnd(r);break;case"A85":case"ASCII85Decode":_=this.findDecodeInlineStreamEnd(r);break;case"AHx":case"ASCIIHexDecode":_=this.findHexDecodeInlineStreamEnd(r);break;default:_=this.findDefaultInlineStreamEnd(r)}var p,l=r.makeSubStream(d,_,n);if(_<1e3&&e<5552){var u=l.getBytes();l.reset();var f=r.position;r.position=i.beginInlineImagePosition;var g=r.getBytes(e);r.position=f,p=this._computeMaxNumber(u)+"_"+this._computeMaxNumber(g);var y=this.imageCache.get(p);if(void 0!==y)return this.second=wr.get("EI"),this.shift(),y.reset(),y}return t&&(l=t.createStream(l,_)),l=this.filter(l,n,_),l.dictionary=n,void 0!==p&&this.imageCache.set(p,l),this.second=wr.get("EI"),this.shift(),l},t.prototype._computeMaxNumber=function(t){for(var e=t.length,i=1,r=0,n=0;n<e;++n)r+=i+=255&t[n];return r%65521<<16|i%65521},t.prototype.makeStream=function(t,e){var i=this.lexicalOperator,r=i.stream;i.skipToNextLine();var n=r.position-1,s=t.get("Length");if(Number.isInteger(s)||(s=0),r.position=n+s,i.nextChar(),this.tryShift()&&Ot(this.second,"endstream"))this.shift();else{var a=new Uint8Array([101,110,100,115,116,114,101,97,109]),o=this._findStreamLength(n,a);if(o<0){var h=a.length-1,c=a.slice(0,h),_=this._findStreamLength(n,c);if(_>=0&&A(r.peekBytes(h+1)[h])&&(o=_),o<0)throw new gr("Missing endstream command.")}s=o,i.nextChar(),this.shift(),this.shift()}return this.shift(),r=r.makeSubStream(n,s,t),e&&(r=e.createStream(r,s)),r=this.filter(r,t,s),r.dictionary=t,r},t.prototype.filter=function(t,e,i){var r=e.get("F","Filter"),n=e.get("DP","DecodeParms");if(r instanceof Sr)return this.makeFilter(t,r.name,i,n);var s=i;if(Array.isArray(r))for(var a=r,o=n,h=0;h<a.length;++h){var c=a[Number.parseInt(h.toString(),10)];if(!((r=c instanceof Pr?this.xref._fetch(c):c)instanceof Sr))throw new gr("Bad filter name '"+r+"'");if(n=null,Array.isArray(o)&&h in o){var _=o[Number.parseInt(h.toString(),10)];n=_ instanceof Pr?this.xref._fetch(_):_}t=this.makeFilter(t,r.name,s,n),s=null}return t},t.prototype.makeFilter=function(t,e,i,r){if(0===i)return new Br;try{return"Fl"===e||"FlateDecode"===e?r?new Qr(new qr(t,i),i,r):new qr(t,i):t}catch(t){return new Br}},t.prototype._findStreamLength=function(t,e){var i=this.lexicalOperator.stream;i.position=t;for(var r=e.length;i.position<i.end;){var n=i.peekBytes(2048),s=n.length-r;if(s<=0)break;for(var a=0;a<s;){for(var o=0;o<r&&n[a+o]===e[o];)o++;if(o>=r)return i.position+=a,i.position-t;a++}i.position+=s}return-1},t.prototype.findDefaultInlineStreamEnd=function(t){var e,i,r=t.position,n=0;for(e=t.getByte();-1!==e;){if(0===n)n=69===e?1:0;else if(1===n)n=73===e?2:0;else{if(2!==n)throw new Error("findDefaultInlineStreamEnd - invalid state.");if(32===e||10===e||13===e){i=t.position;for(var s=t.peekBytes(10),a=0,o=s.length;a<o;a++)if((0!==(e=s[a])||0===s[a+1])&&10!==e&&13!==e&&(e<32||e>127)){n=0;break}if(2!==n){e=t.getByte();continue}if(2===n)break}else n=0}e=t.getByte()}-1===e&&void 0!==i&&t.skip(-(t.position-i));var h=4;return t.skip(-h),e=t.peekByte(),t.skip(h),A(e)||h--,t.position-h-r},t.prototype._checkEnd=function(){return"EOF"===this.first},t}(),tn=function(){function t(t){this.isValid=!1;var e=new $r(new Zr(t),null),i=e.getObject(),r=e.getObject(),n=e.getObject(),s=e.getObject();if(this.isValid=Number.isInteger(i)&&Number.isInteger(r)&&Ot(n,"obj")&&void 0!==s,this.isValid){var a=s.get("Linearized");this.isValid=void 0!==a&&a>0}if(this.isValid){var o=this.getInt(s,"L");if(o!==t.length)throw new Error("The L parameter in the linearization dictionary does not equal the stream length.");this.length=o,this.hints=this.getHints(s),this.objectNumberFirst=this.getInt(s,"O"),this.endFirst=this.getInt(s,"E"),this.pageCount=this.getInt(s,"N"),this.mainXRefEntriesOffset=this.getInt(s,"T"),this.pageFirst=s.has("P")?this.getInt(s,"P",!0):0}}return t.prototype.getInt=function(t,e,i){void 0===i&&(i=!1);var r=t.get(e);if(void 0!==r&&Number.isInteger(r)&&(i?r>=0:r>0))return r;throw new Error("The '"+e+"' parameter in the linearization dictionary is invalid.")},t.prototype.getHints=function(t){var e=t.getArray("H"),i=e.length;if(e&&(2===i||4===i)){for(var r=0;r<i;r++){var n=e[r];if(!(Number.isInteger(n)&&n>0))throw new Error("Hint ("+r+") in the linearization dictionary is invalid.")}return e}throw new Error("Hint array in the linearization dictionary is invalid.")},t}(),en=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),rn=function(){function t(t,e,i){void 0===i&&(i=""),this._isUserPassword=!0,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!0,this._defaultPasswordBytes=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);var r=t.get("Filter");if(!Dt(r,"Standard"))throw new gr("unknown encryption method");this._filterName=r.name,this._dictionary=t;var n=t.get("V");if(!Number.isInteger(n)||1!==n&&2!==n&&4!==n&&5!==n)throw new gr("unsupported encryption algorithm");this._algorithm=n;var s=t.get("Length");if(!s)if(n<=3)s=40;else{var a=t.get("CF"),o=t.get("StmF");if(a&&o){a.suppressEncryption=!0;var h=a.get(o.name);(s=h&&h.get("Length")||128)<40&&(s<<=3)}}if(!Number.isInteger(s)||s<40||s%8!=0)throw new gr("invalid key length");var c=u(t.get("O")).subarray(0,32),_=u(t.get("U")).subarray(0,32),d=t.get("P"),p=t.get("R");this._encryptMetaData=(4===n||5===n)&&!1!==t.get("EncryptMetadata");var l,f=u(e);i&&(6===p&&(i=encodeURIComponent(i)),l=u(i));var y;if(5!==n){if((y=this._prepareKeyData(f,l,c,_,d,p,s,this._encryptMetaData))&&(this._isUserPassword=!0,i)){var m=this._decodeUserPassword(l,c,p,s),b=this._prepareKeyData(f,m,c,_,d,p,s,this._encryptMetaData);b&&g(b,y)&&(this._hasUserPasswordOnly=!0)}}else{var v,S=u(t.get("O")),w=S.subarray(32,40),P=S.subarray(40,48),A=u(t.get("U")),k=A.subarray(0,48),x=A.subarray(32,40),T=A.subarray(40,48),I=u(t.get("OE")),N=u(t.get("UE"));v=6===p?new _n:new cn;var C=void 0;C=l?l.subarray(0,Math.min(127,l.length)):new Uint8Array([]),v._checkUserPassword(C,x,_)?(y=this._createEncryptionKey(!0,C,P,k,T,I,N,v),this._isUserPassword=!0,i.length&&v._checkOwnerPassword(C,w,k,c)&&(this._hasUserPasswordOnly=!0)):i.length&&v._checkOwnerPassword(C,w,k,c)&&(y=this._createEncryptionKey(!1,l,P,k,T,I,N,v),this._isUserPassword=!1)}if(!y){if(!i)throw new Error("Cannot open an encrypted document. The password is invalid.");m=this._decodeUserPassword(l,c,p,s);y=this._prepareKeyData(f,m,c,_,d,p,s,this._encryptMetaData),this._isUserPassword=!1}if(n>=4){var R=t.get("CF");if(R&&(R.suppressEncryption=!0,R.has("StdCF"))){var F=R.get("StdCF");if(F&&F.has("AuthEvent")){var B=F.get("AuthEvent");B&&"EFOpen"===B.name&&(this._encryptOnlyAttachment=!0)}}this._cipherDictionary=R,this._stream=t.get("StmF")||Sr.get("Identity"),this._string=t.get("StrF")||Sr.get("Identity"),this._eff=t.get("EFF")||this._stream}if(!y&&!this._encryptOnlyAttachment)throw new Error("Cannot open an encrypted document. The password is invalid.");this._encryptionKey=y}return Object.defineProperty(t.prototype,"_md5",{get:function(){return void 0===this._messageDigest&&(this._messageDigest=new nn),this._messageDigest},enumerable:!0,configurable:!0}),t.prototype._createEncryptionKey=function(t,e,i,r,n,s,a,o){return t?o._getUserKey(e,n,a):o._getOwnerKey(e,i,r,s)},t.prototype._prepareKeyData=function(t,e,i,r,n,s,a,o){var h,c=new Uint8Array(40+i.length+t.length),_=0,d=0;if(e)for(h=Math.min(32,e.length);_<h;++_)c[Number.parseInt(_.toString(),10)]=e[Number.parseInt(_.toString(),10)];for(;_<32;)c[_++]=this._defaultPasswordBytes[d++];for(d=0,h=i.length;d<h;++d)c[_++]=i[Number.parseInt(d.toString(),10)];for(c[_++]=255&n,c[_++]=n>>8&255,c[_++]=n>>16&255,c[_++]=n>>>24&255,d=0,h=t.length;d<h;++d)c[_++]=t[Number.parseInt(d.toString(),10)];s>=4&&!o&&(c[_++]=255,c[_++]=255,c[_++]=255,c[_++]=255);var p=this._md5.hash(c,0,_),l=a>>3;if(s>=3)for(d=0;d<50;++d)p=this._md5.hash(p,0,l);var u,f=p.subarray(0,l);if(s>=3){for(_=0;_<32;++_)c[Number.parseInt(_.toString(),10)]=this._defaultPasswordBytes[Number.parseInt(_.toString(),10)];for(d=0,h=t.length;d<h;++d)c[_++]=t[Number.parseInt(d.toString(),10)];u=new pn(f)._encryptBlock(this._md5.hash(c,0,_)),h=f.length;var g=new Uint8Array(h);for(d=1;d<=19;++d){for(var y=0;y<h;++y)g[Number.parseInt(y.toString(),10)]=f[Number.parseInt(y.toString(),10)]^d;u=new pn(g)._encryptBlock(u)}for(d=0,h=u.length;d<h;++d)if(r[Number.parseInt(d.toString(),10)]!==u[Number.parseInt(d.toString(),10)])return null}else for(d=0,h=(u=new pn(f)._encryptBlock(this._defaultPasswordBytes)).length;d<h;++d)if(r[Number.parseInt(d.toString(),10)]!==u[Number.parseInt(d.toString(),10)])return null;return f},t.prototype._decodeUserPassword=function(t,e,i,r){for(var n=new Uint8Array(32),s=0,a=0,o=Math.min(32,t.length);s<o;++s)n[Number.parseInt(s.toString(),10)]=t[Number.parseInt(s.toString(),10)];for(;s<32;)n[s++]=this._defaultPasswordBytes[a++];var h=this._md5.hash(n,0,s),c=r>>3;if(i>=3)for(a=0;a<50;++a)h=this._md5.hash(h,0,h.length);var _;if(i>=3){_=e;var d=new Uint8Array(c);for(a=19;a>=0;a--){for(var p=0;p<c;++p)d[Number.parseInt(p.toString(),10)]=h[Number.parseInt(p.toString(),10)]^a;_=new pn(d)._encryptBlock(_)}}else _=new pn(h.subarray(0,c))._encryptBlock(e);return _},t.prototype._createCipherTransform=function(t,e){if(4===this._algorithm||5===this._algorithm){var i=this._buildCipherConstructor(this._cipherDictionary,this._string,t,e,this._encryptionKey),r=this._buildCipherConstructor(this._cipherDictionary,this._stream,t,e,this._encryptionKey);return new yn(i,r)}var n=this._buildObjectKey(t,e,this._encryptionKey,!1);return new yn(new pn(n),new pn(n))},t.prototype._buildCipherConstructor=function(t,e,i,r,n){var s,a=t.get(e.name);if(a&&(s=a.get("CFM")),!s)return new gn;switch(s.name){case"None":return new gn;case"AESV2":return new un(this._buildObjectKey(i,r,n,!0));case"AESV3":return new fn(n);case"V2":return new pn(this._buildObjectKey(i,r,n,!1))}throw new gr("Unknown cryptography method")},t.prototype._buildObjectKey=function(t,e,i,r){void 0===r&&(r=!1);var n,s=new Uint8Array(i.length+9);for(n=0;n<i.length;++n)s[Number.parseInt(n.toString(),10)]=i[Number.parseInt(n.toString(),10)];return s[n++]=255&t,s[n++]=t>>8&255,s[n++]=t>>16&255,s[n++]=255&e,s[n++]=e>>8&255,r&&(s[n++]=115,s[n++]=65,s[n++]=108,s[n++]=84),this._md5.hash(s,0,n).subarray(0,Math.min(i.length+5,16))},t}(),nn=function(){function t(){this._r=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),this._k=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551])}return t.prototype.hash=function(t,e,i){for(var r=1732584193,n=-271733879,s=-1732584194,a=271733878,o=i+72&-64,h=new Uint8Array(o),c=0,_=0;c<i;++c)h[Number.parseInt(c.toString(),10)]=t[e++];h[c++]=128;for(var d=o-8;c<d;)h[c++]=0;h[c++]=i<<3&255,h[c++]=i>>5&255,h[c++]=i>>13&255,h[c++]=i>>21&255,h[c++]=i>>>29&255,h[c++]=0,h[c++]=0,h[c++]=0;var p=new Int32Array(16);for(c=0;c<o;){for(_=0;_<16;++_,c+=4)p[Number.parseInt(_.toString(),10)]=h[Number.parseInt(c.toString(),10)]|h[c+1]<<8|h[c+2]<<16|h[c+3]<<24;var l=r,u=n,f=s,g=a,y=void 0,m=void 0;for(_=0;_<64;++_){_<16?(y=u&f|~u&g,m=_):_<32?(y=g&u|~g&f,m=5*_+1&15):_<48?(y=u^f^g,m=3*_+5&15):(y=f^(u|~g),m=7*_&15);var b=g,v=l+y+this._k[Number.parseInt(_.toString(),10)]+p[Number.parseInt(m.toString(),10)]|0,S=this._r[Number.parseInt(_.toString(),10)];g=f,f=u,u=u+(v<<S|v>>>32-S)|0,l=b}r=r+l|0,n=n+u|0,s=s+f|0,a=a+g|0}return new Uint8Array([255&r,r>>8&255,r>>16&255,r>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&s,s>>8&255,s>>16&255,s>>>24&255,255&a,a>>8&255,a>>16&255,a>>>24&255])},t}(),sn=function(){function t(){}return t.prototype._rotateRight=function(t,e){return t>>>e|t<<32-e},t.prototype._sigma=function(t){return this._rotateRight(t,2)^this._rotateRight(t,13)^this._rotateRight(t,22)},t.prototype._sigmaPrime=function(t){return this._rotateRight(t,6)^this._rotateRight(t,11)^this._rotateRight(t,25)},t.prototype._littleSigma=function(t){return this._rotateRight(t,7)^this._rotateRight(t,18)^t>>>3},t.prototype._littleSigmaPrime=function(t){return this._rotateRight(t,17)^this._rotateRight(t,19)^t>>>10},t.prototype._hash=function(t,e,i){for(var r,n=1779033703,s=3144134277,a=1013904242,o=2773480762,h=1359893119,c=2600822924,_=528734635,d=1541459225,p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],l=64*Math.ceil((i+9)/64),u=new Uint8Array(l),f=0;f<i;++f)u[Number.parseInt(f.toString(),10)]=t[e++];u[f++]=128;for(var g=l-8;f<g;)u[f++]=0;u[f++]=0,u[f++]=0,u[f++]=0,u[f++]=i>>>29&255,u[f++]=i>>21&255,u[f++]=i>>13&255,u[f++]=i>>5&255,u[f++]=i<<3&255;var y=new Uint32Array(64);for(f=0;f<l;){for(r=0;r<16;++r)y[Number.parseInt(r.toString(),10)]=u[Number.parseInt(f.toString(),10)]<<24|u[f+1]<<16|u[f+2]<<8|u[f+3],f+=4;for(r=16;r<64;++r)y[Number.parseInt(r.toString(),10)]=this._littleSigmaPrime(y[r-2])+y[r-7]+this._littleSigma(y[r-15])+y[r-16]|0;var m=n,b=s,v=a,S=o,w=h,P=c,A=_,k=d,x=void 0,T=void 0;for(r=0;r<64;++r)x=k+this._sigmaPrime(w)+(w&P^~w&A)+p[Number.parseInt(r.toString(),10)]+y[Number.parseInt(r.toString(),10)],T=this._sigma(m)+(m&b^m&v^b&v),k=A,A=P,P=w,w=S+x|0,S=v,v=b,b=m,m=x+T|0;n=n+m|0,s=s+b|0,a=a+v|0,o=o+S|0,h=h+w|0,c=c+P|0,_=_+A|0,d=d+k|0}return new Uint8Array([n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,h>>24&255,h>>16&255,h>>8&255,255&h,c>>24&255,c>>16&255,c>>8&255,255&c,_>>24&255,_>>16&255,_>>8&255,255&_,d>>24&255,d>>16&255,d>>8&255,255&d])},t}(),an=function(){function t(){this._k=[new on(1116352408,3609767458),new on(1899447441,602891725),new on(3049323471,3964484399),new on(3921009573,2173295548),new on(961987163,4081628472),new on(1508970993,3053834265),new on(2453635748,2937671579),new on(2870763221,3664609560),new on(3624381080,2734883394),new on(310598401,1164996542),new on(607225278,1323610764),new on(1426881987,3590304994),new on(1925078388,4068182383),new on(2162078206,991336113),new on(2614888103,633803317),new on(3248222580,3479774868),new on(3835390401,2666613458),new on(4022224774,944711139),new on(264347078,2341262773),new on(604807628,2007800933),new on(770255983,1495990901),new on(1249150122,1856431235),new on(1555081692,3175218132),new on(1996064986,2198950837),new on(2554220882,3999719339),new on(2821834349,766784016),new on(2952996808,2566594879),new on(3210313671,3203337956),new on(3336571891,1034457026),new on(3584528711,2466948901),new on(113926993,3758326383),new on(338241895,168717936),new on(666307205,1188179964),new on(773529912,1546045734),new on(1294757372,1522805485),new on(1396182291,2643833823),new on(1695183700,2343527390),new on(1986661051,1014477480),new on(2177026350,1206759142),new on(2456956037,344077627),new on(2730485921,1290863460),new on(2820302411,3158454273),new on(3259730800,3505952657),new on(3345764771,106217008),new on(3516065817,3606008344),new on(3600352804,1432725776),new on(4094571909,1467031594),new on(275423344,851169720),new on(430227734,3100823752),new on(506948616,1363258195),new on(659060556,3750685593),new on(883997877,3785050280),new on(958139571,3318307427),new on(1322822218,3812723403),new on(1537002063,2003034995),new on(1747873779,3602036899),new on(1955562222,1575990012),new on(2024104815,1125592928),new on(2227730452,2716904306),new on(2361852424,442776044),new on(2428436474,593698344),new on(2756734187,3733110249),new on(3204031479,2999351573),new on(3329325298,3815920427),new on(3391569614,3928383900),new on(3515267271,566280711),new on(3940187606,3454069534),new on(4118630271,4000239992),new on(116418474,1914138554),new on(174292421,2731055270),new on(289380356,3203993006),new on(460393269,320620315),new on(685471733,587496836),new on(852142971,1086792851),new on(1017036298,365543100),new on(1126000580,2618297676),new on(1288033470,3409855158),new on(1501505948,4234509866),new on(1607167915,987167468),new on(1816402316,1246189591)]}return t.prototype._sigma=function(t,e,i){t.assign(e),t.rotateRight(28),i.assign(e),i.rotateRight(34),t.xor(i),i.assign(e),i.rotateRight(39),t.xor(i)},t.prototype._sigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(14),i.assign(e),i.rotateRight(18),t.xor(i),i.assign(e),i.rotateRight(41),t.xor(i)},t.prototype._littleSigma=function(t,e,i){t.assign(e),t.rotateRight(1),i.assign(e),i.rotateRight(8),t.xor(i),i.assign(e),i.shiftRight(7),t.xor(i)},t.prototype._littleSigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(19),i.assign(e),i.rotateRight(61),t.xor(i),i.assign(e),i.shiftRight(6),t.xor(i)},t.prototype._hash=function(t,e,i,r){void 0===r&&(r=!1);var n,s,a,o,h,c,_,d;r?(n=new on(3418070365,3238371032),s=new on(1654270250,914150663),a=new on(2438529370,812702999),o=new on(355462360,4144912697),h=new on(1731405415,4290775857),c=new on(2394180231,1750603025),_=new on(3675008525,1694076839),d=new on(1203062813,3204075428)):(n=new on(1779033703,4089235720),s=new on(3144134277,2227873595),a=new on(1013904242,4271175723),o=new on(2773480762,1595750129),h=new on(1359893119,2917565137),c=new on(2600822924,725511199),_=new on(528734635,4215389547),d=new on(1541459225,327033209));var p,l=128*Math.ceil((i+17)/128),u=new Uint8Array(l);for(p=0;p<i;++p)u[Number.parseInt(p.toString(),10)]=t[e++];u[p++]=128;for(var f=l-16;p<f;)u[p++]=0;u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=i>>>29&255,u[p++]=i>>21&255,u[p++]=i>>13&255,u[p++]=i>>5&255,u[p++]=i<<3&255;var g=new Array(80);for(p=0;p<80;p++)g[Number.parseInt(p.toString(),10)]=new on(0,0);var y,m=new on(0,0),b=new on(0,0),v=new on(0,0),S=new on(0,0),w=new on(0,0),P=new on(0,0),A=new on(0,0),k=new on(0,0),x=new on(0,0),T=new on(0,0),I=new on(0,0),N=new on(0,0);for(p=0;p<l;){var C=void 0;for(C=0;C<16;++C)g[Number.parseInt(C.toString(),10)].high=u[Number.parseInt(p.toString(),10)]<<24|u[p+1]<<16|u[p+2]<<8|u[p+3],g[Number.parseInt(C.toString(),10)].low=u[p+4]<<24|u[p+5]<<16|u[p+6]<<8|u[p+7],p+=8;for(C=16;C<80;++C)y=g[Number.parseInt(C.toString(),10)],this._littleSigmaPrime(y,g[C-2],N),y.add(g[C-7]),this._littleSigma(I,g[C-15],N),y.add(I),y.add(g[C-16]);for(m.assign(n),b.assign(s),v.assign(a),S.assign(o),w.assign(h),P.assign(c),A.assign(_),k.assign(d),C=0;C<80;++C)x.assign(k),this._sigmaPrime(I,w,N),x.add(I),I.assign(w),I.and(P),N.assign(w),N.not(),N.and(A),I.xor(N),x.add(I),x.add(this._k[Number.parseInt(C.toString(),10)]),x.add(g[Number.parseInt(C.toString(),10)]),this._sigma(T,m,N),I.assign(m),I.and(b),N.assign(m),N.and(v),I.xor(N),N.assign(b),N.and(v),I.xor(N),T.add(I),y=k,k=A,A=P,P=w,S.add(x),w=S,S=v,v=b,b=m,y.assign(x),y.add(T),m=y;n.add(m),s.add(b),a.add(v),o.add(S),h.add(w),c.add(P),_.add(A),d.add(k)}var R;return r?(R=new Uint8Array(48),n.copyTo(R,0),s.copyTo(R,8),a.copyTo(R,16),o.copyTo(R,24),h.copyTo(R,32),c.copyTo(R,40)):(R=new Uint8Array(64),n.copyTo(R,0),s.copyTo(R,8),a.copyTo(R,16),o.copyTo(R,24),h.copyTo(R,32),c.copyTo(R,40),_.copyTo(R,48),d.copyTo(R,56)),R},t}(),on=function(){function t(t,e){this.high=0|t,this.low=0|e}return t.prototype.and=function(t){this.high&=t.high,this.low&=t.low},t.prototype.or=function(t){this.high|=t.high,this.low|=t.low},t.prototype.not=function(){this.high=~this.high,this.low=~this.low},t.prototype.xor=function(t){this.high^=t.high,this.low^=t.low},t.prototype.shiftRight=function(t){t>=32?(this.low=this.high>>>t-32|0,this.high=0):(this.low=this.low>>>t|this.high<<32-t,this.high=this.high>>>t|0)},t.prototype.shiftLeft=function(t){t>=32?(this.high=this.low<<t-32,this.low=0):(this.high=this.high<<t|this.low>>>32-t,this.low<<=t)},t.prototype.rotateRight=function(t){var e,i;32&t?(i=this.low,e=this.high):(e=this.low,i=this.high),t&=31,this.low=e>>>t|i<<32-t,this.high=i>>>t|e<<32-t},t.prototype.add=function(t){var e=(this.low>>>0)+(t.low>>>0),i=(this.high>>>0)+(t.high>>>0);e>4294967295&&(i+=1),this.low=0|e,this.high=0|i},t.prototype.copyTo=function(t,e){t[Number.parseInt(e.toString(),10)]=this.high>>>24&255,t[e+1]=this.high>>16&255,t[e+2]=this.high>>8&255,t[e+3]=255&this.high,t[e+4]=this.low>>>24&255,t[e+5]=this.low>>16&255,t[e+6]=this.low>>8&255,t[e+7]=255&this.low},t.prototype.assign=function(t){this.high=t.high,this.low=t.low},t}(),hn=function(){function t(){}return Object.defineProperty(t.prototype,"_sha256",{get:function(){return void 0===this._sha256Obj&&(this._sha256Obj=new sn),this._sha256Obj},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_sha512",{get:function(){return void 0===this._sha512Obj&&(this._sha512Obj=new an),this._sha512Obj},enumerable:!0,configurable:!0}),t}(),cn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return en(e,t),e.prototype._checkOwnerPassword=function(t,e,i,r){var n=new Uint8Array(t.length+56);return n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length),g(this._sha256._hash(n,0,n.length),r)},e.prototype._checkUserPassword=function(t,e,i){var r=new Uint8Array(t.length+8);return r.set(t,0),r.set(e,t.length),g(this._sha256._hash(r,0,r.length),i)},e.prototype._getOwnerKey=function(t,e,i,r){var n=new Uint8Array(t.length+56);n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length);var s=this._sha256._hash(n,0,n.length);return new fn(s)._decryptBlock(r,!1,new Uint8Array(16))},e.prototype._getUserKey=function(t,e,i){var r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);var n=this._sha256._hash(r,0,r.length);return new fn(n)._decryptBlock(i,!1,new Uint8Array(16))},e}(hn),_n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return en(e,t),e.prototype._checkOwnerPassword=function(t,e,i,r){var n=new Uint8Array(t.length+56);return n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length),g(this._hash(t,n,i),r)},e.prototype._checkUserPassword=function(t,e,i){var r=new Uint8Array(t.length+8);return r.set(t,0),r.set(e,t.length),g(this._hash(t,r,new Uint8Array([])),i)},e.prototype._getOwnerKey=function(t,e,i,r){var n=new Uint8Array(t.length+56);n.set(t,0),n.set(e,t.length),n.set(i,t.length+e.length);var s=this._hash(t,n,i);return new fn(s)._decryptBlock(r,!1,new Uint8Array(16))},e.prototype._getUserKey=function(t,e,i){var r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);var n=this._hash(t,r,new Uint8Array([]));return new fn(n)._decryptBlock(i,!1,new Uint8Array(16))},e.prototype._hash=function(t,e,i){for(var r=this._sha256._hash(e,0,e.length).subarray(0,32),n=new Uint8Array([0]),s=0;s<64||n[n.length-1]>s-32;){var a=t.length+r.length+i.length,o=new Uint8Array(a),h=0;o.set(t,h),h+=t.length,o.set(r,h),h+=r.length,o.set(i,h);for(var c=new Uint8Array(64*a),_=0,d=0;_<64;_++)c.set(o,d),d+=a;n=new un(r.subarray(0,16))._encrypt(c,r.subarray(16,32));for(var p=0,l=0;l<16;l++)p*=1,p%=3,p+=(n[Number.parseInt(l.toString(),10)]>>>0)%3,p%=3;2===p?r=this._sha512._hash(n,0,n.length):1===p?r=this._sha512._hash(n,0,n.length,!0):0===p&&(r=this._sha256._hash(n,0,n.length)),s++}return r.subarray(0,32)},e}(hn),dn=function(){function t(){}return t}(),pn=function(t){function e(e){var i=t.call(this)||this;i._a=0,i._b=0;for(var r=new Uint8Array(256),n=0;n<256;++n)r[Number.parseInt(n.toString(),10)]=n;for(var s=e.length,n=0,a=0;n<256;++n){var o=r[Number.parseInt(n.toString(),10)];a=a+o+e[n%s]&255,r[Number.parseInt(n.toString(),10)]=r[Number.parseInt(a.toString(),10)],r[Number.parseInt(a.toString(),10)]=o}return i._s=r,i}return en(e,t),e.prototype._encryptBlock=function(t){for(var e=this._a,i=this._b,r=this._s,n=t.length,s=new Uint8Array(n),a=0;a<n;++a){e=e+1&255;var o=r[Number.parseInt(e.toString(),10)];i=i+o&255;var h=r[Number.parseInt(i.toString(),10)];r[Number.parseInt(e.toString(),10)]=h,r[Number.parseInt(i.toString(),10)]=o,s[Number.parseInt(a.toString(),10)]=t[Number.parseInt(a.toString(),10)]^r[o+h&255]}return this._a=e,this._b=i,s},e.prototype._decryptBlock=function(t){return this._encryptBlock(t)},e.prototype._encrypt=function(t){return this._encryptBlock(t)},e}(dn),ln=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._buffer=new Uint8Array(16),e._position=0,e._s=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),e._inverseS=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),e._mix=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]),e}return en(e,t),Object.defineProperty(e.prototype,"_mixCol",{get:function(){if(void 0===this._mixC){this._mixC=new Uint8Array(256);for(var t=0;t<256;t++)this._mixC[Number.parseInt(t.toString(),10)]=t<128?t<<1:t<<1^27}return this._mixC},enumerable:!0,configurable:!0}),e.prototype._decrypt=function(t,e){var i,r,n,s=new Uint8Array(16);s.set(t);for(var a=0,o=this._keySize;a<16;++a,++o)s[Number.parseInt(a.toString(),10)]^=e[Number.parseInt(o.toString(),10)];for(var h=this._cyclesOfRepetition-1;h>=1;--h){i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],n=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=n;for(a=0;a<16;++a)s[Number.parseInt(a.toString(),10)]=this._inverseS[s[Number.parseInt(a.toString(),10)]];for(var a=0,o=16*h;a<16;++a,++o)s[Number.parseInt(a.toString(),10)]^=e[Number.parseInt(o.toString(),10)];for(a=0;a<16;a+=4){var c=this._mix[s[Number.parseInt(a.toString(),10)]],_=this._mix[s[a+1]],d=this._mix[s[a+2]],p=this._mix[s[a+3]];i=c^_>>>8^_<<24^d>>>16^d<<16^p>>>24^p<<8,s[Number.parseInt(a.toString(),10)]=i>>>24&255,s[a+1]=i>>16&255,s[a+2]=i>>8&255,s[a+3]=255&i}}i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],n=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=n;for(a=0;a<16;++a)s[Number.parseInt(a.toString(),10)]=this._inverseS[s[Number.parseInt(a.toString(),10)]],s[Number.parseInt(a.toString(),10)]^=e[Number.parseInt(a.toString(),10)];return s},e.prototype._encryptBlock=function(t,e){var i,r,n,s=this._s,a=new Uint8Array(16);a.set(t);for(p=0;p<16;++p)a[Number.parseInt(p.toString(),10)]^=e[Number.parseInt(p.toString(),10)];for(var o=1;o<this._cyclesOfRepetition;o++){for(p=0;p<16;++p)a[Number.parseInt(p.toString(),10)]=s[a[Number.parseInt(p.toString(),10)]];n=a[1],a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=n,n=a[2],r=a[6],a[2]=a[10],a[6]=a[14],a[10]=n,a[14]=r,n=a[3],r=a[7],i=a[11],a[3]=a[15],a[7]=n,a[11]=r,a[15]=i;for(p=0;p<16;p+=4){var h=a[p+0],c=a[p+1],_=a[p+2],d=a[p+3];i=h^c^_^d,a[p+0]^=i^this._mixCol[h^c],a[p+1]^=i^this._mixCol[c^_],a[p+2]^=i^this._mixCol[_^d],a[p+3]^=i^this._mixCol[d^h]}for(var p=0,l=16*o;p<16;++p,++l)a[Number.parseInt(p.toString(),10)]^=e[Number.parseInt(l.toString(),10)]}for(p=0;p<16;++p)a[Number.parseInt(p.toString(),10)]=s[a[Number.parseInt(p.toString(),10)]];n=a[1],a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=n,n=a[2],r=a[6],a[2]=a[10],a[6]=a[14],a[10]=n,a[14]=r,n=a[3],r=a[7],i=a[11],a[3]=a[15],a[7]=n,a[11]=r,a[15]=i;for(var p=0,l=this._keySize;p<16;++p,++l)a[Number.parseInt(p.toString(),10)]^=e[Number.parseInt(l.toString(),10)];return a},e.prototype._decryptBlockHelper=function(t,e){for(var i=t.length,r=this._buffer,n=this._position,s=[],a=this._iv,o=0;o<i;++o)if(r[Number.parseInt(n.toString(),10)]=t[Number.parseInt(o.toString(),10)],!(++n<16)){for(var h=this._decrypt(r,this._key),c=0;c<16;++c)h[Number.parseInt(c.toString(),10)]^=a[Number.parseInt(c.toString(),10)];a=r,s.push(h),r=new Uint8Array(16),n=0}if(this._buffer=r,this._bufferLength=n,this._iv=a,0===s.length)return new Uint8Array(0);var _=16*s.length;if(e){var d=s[s.length-1],p=d[15];if(p<=16){for(var o=15,l=16-p;o>=l;--o)if(d[Number.parseInt(o.toString(),10)]!==p){p=0;break}_-=p,s[s.length-1]=d.subarray(0,16-p)}}for(var u=new Uint8Array(_),o=0,c=0;o<s.length;++o,c+=16)u.set(s[Number.parseInt(o.toString(),10)],c);return u},e.prototype._decryptBlock=function(t,e,i){var r=t.length,n=this._buffer,s=this._position;if(i)this._iv=i;else{for(var a=0;s<16&&a<r;++a,++s)n[Number.parseInt(s.toString(),10)]=t[Number.parseInt(a.toString(),10)];if(s<16)return this._bufferLength=s,new Uint8Array(0);this._iv=n,t=t.subarray(16)}return this._buffer=new Uint8Array(16),this._bufferLength=0,this._decryptBlock=this._decryptBlockHelper,this._decryptBlock(t,e)},e.prototype._encrypt=function(t,e){var i=t.length,r=this._buffer,n=this._position,s=[];e||(e=new Uint8Array(16));for(c=0;c<i;++c)if(r[Number.parseInt(n.toString(),10)]=t[Number.parseInt(c.toString(),10)],!(++n<16)){for(_=0;_<16;++_)r[Number.parseInt(_.toString(),10)]^=e[Number.parseInt(_.toString(),10)];var a=this._encryptBlock(r,this._key);e=a,s.push(a),r=new Uint8Array(16),n=0}if(this._buffer=r,this._bufferLength=n,this._iv=e,0===s.length)return new Uint8Array(0);for(var o=16*s.length,h=new Uint8Array(o),c=0,_=0;c<s.length;++c,_+=16)h.set(s[Number.parseInt(c.toString(),10)],_);return h},e}(dn),un=function(t){function e(e){var i=t.call(this)||this;return i._cyclesOfRepetition=10,i._keySize=160,i._key=new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]),i._key=i._expandKey(e),i}return en(e,t),e.prototype._expandKey=function(t){var e=this._s,i=this._key,r=new Uint8Array(176);r.set(t);for(var n=16,s=1;n<176;++s){var a=r[n-3],o=r[n-2],h=r[n-1],c=r[n-4];a=e[Number.parseInt(a.toString(),10)],o=e[Number.parseInt(o.toString(),10)],h=e[Number.parseInt(h.toString(),10)],c=e[Number.parseInt(c.toString(),10)],a^=i[Number.parseInt(s.toString(),10)];for(var _=0;_<4;++_)r[Number.parseInt(n.toString(),10)]=a^=r[n-16],r[n+1]=o^=r[n-15],r[n+2]=h^=r[n-14],r[n+3]=c^=r[n-13],n+=4}return r},e}(ln),fn=function(t){function e(e){var i=t.call(this)||this;return i._cyclesOfRepetition=14,i._keySize=224,i._key=i._expandKey(e),i}return en(e,t),e.prototype._expandKey=function(t){var e=this._s,i=new Uint8Array(240);i.set(t);for(var r,n,s,a,o=1,h=32,c=1;h<240;++c){h%32==16?(r=e[Number.parseInt(r.toString(),10)],n=e[Number.parseInt(n.toString(),10)],s=e[Number.parseInt(s.toString(),10)],a=e[Number.parseInt(a.toString(),10)]):h%32==0&&(r=i[h-3],n=i[h-2],s=i[h-1],a=i[h-4],r=e[Number.parseInt(r.toString(),10)],n=e[Number.parseInt(n.toString(),10)],s=e[Number.parseInt(s.toString(),10)],a=e[Number.parseInt(a.toString(),10)],r^=o,(o<<=1)>=256&&(o=255&(27^o)));for(var _=0;_<4;++_)i[Number.parseInt(h.toString(),10)]=r^=i[h-32],i[h+1]=n^=i[h-31],i[h+2]=s^=i[h-30],i[h+3]=a^=i[h-29],h+=4}return i},e}(ln),gn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return en(e,t),e.prototype._decryptBlock=function(t){return t},e.prototype._encrypt=function(t){return t},e}(dn),yn=function(){function t(t,e){this._stringCipher=t,this._streamCipher=e}return t.prototype.createStream=function(t,e){return new jr(t,e,this._streamCipher)},t.prototype.decryptString=function(t){return b(this._stringCipher._decryptBlock(u(t),!0))},t.prototype.encryptString=function(t){if(this._stringCipher instanceof ln){var e=16-t.length%16;t+=String.fromCharCode(e).repeat(e);var i=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(i);else for(var r=0;r<16;r++)i[Number.parseInt(r.toString(),10)]=Math.floor(256*Math.random());var n=this._stringCipher._encrypt(u(t),i),s=new Uint8Array(16+n.length);return s.set(i),s.set(n,16),b(s)}return b(this._stringCipher._encrypt(u(t)))},t}(),mn=function(){function i(t,e){this._version="",this._newLine="\r\n",this._password=e,this._document=t,this._stream=t._stream,this._entries=[],this._crossReferencePosition=Object.create(null),this._cacheMap=new Map,this._pendingRefs=new Ar}return i.prototype._setStartXRef=function(t){this._startXRefQueue=[t],this._prevStartXref=t,void 0!==this._prevXRefOffset&&null!==this._prevXRefOffset||(this._prevXRefOffset=t)},i.prototype._parse=function(e){var i;(i=e?this._indexObjects():this._readXRef()).assignXref(this),this._nextReferenceNumber=i.get("Size"),this._trailer=i;var r=i.get("Encrypt");if(r){this._document._isEncrypted=!0,this._ids=i.get("ID"),this._permissionFlags=r.get("P");var n=this._ids&&this._ids.length?this._ids[0]:"";r.suppressEncryption=!0,this._encrypt=new rn(r,n,this._password),this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.stream,this._document._isUserPassword=this._encrypt._isUserPassword,this._document._encryptOnlyAttachment=this._encrypt._encryptOnlyAttachment,this._encrypt._encryptOnlyAttachment?(this._document._hasUserPasswordOnly=!0,this._document._encryptMetaData=!1):(this._document._hasUserPasswordOnly=this._encrypt._hasUserPasswordOnly,this._document._encryptMetaData=!r.has("EncryptMetadata")||r.get("EncryptMetadata"))}var s,a=!1;try{s=i.get("Root")}catch(t){throw new fr("Invalid cross reference","XRefParseException")}if(s)try{s.get("Pages")&&(this._root=s,a=!0)}catch(t){throw new fr("Invalid cross reference","InvalidXRef")}if(!a)throw e?new fr("Invalid cross reference","InvalidXRef"):new fr("Invalid cross reference","XRefParseException")},i.prototype._getEntry=function(t){var e=this._entries[t];return e&&!e.free&&e.offset?e:null},i.prototype._fetch=function(t,e){var i;if(!(t instanceof Pr))throw new Error("ref object is not a reference");var r=t.objectNumber,n=this._cacheMap.get(t);if(void 0!==n)return n instanceof Tr&&!n.objId&&(n.objId=r),n;var s=this._getEntry(r);if(null===s)return this._cacheMap.set(t,s),s;if(this._pendingRefs.has(t))throw this._pendingRefs.remove(t),new Error("circular reference");this._pendingRefs.put(t);try{i=s.uncompressed?this._fetchUncompressed(t,s,e):this._fetchCompressed(t,s),this._pendingRefs.remove(t)}catch(e){throw this._pendingRefs.remove(t),e}return i},i.prototype._fetchUncompressed=function(t,e,i){var r=t.generationNumber,n=t.objectNumber;if(e.gen!==r)throw new fr("Inconsistent generation in XRef: "+t,"XRefEntryException");var s=this._stream.makeSubStream(e.offset+this._stream.start,void 0),a=new $r(new Zr(s),this,!0),o=a.getObject(),h=a.getObject(),c=a.getObject();if(o!==n||h!==r||void 0===c)throw new fr("Bad (uncompressed) XRef entry: "+t,"XRefEntryException");var _;return(_=this._encrypt&&!i?a.getObject(this._encrypt._createCipherTransform(t.objectNumber,t.generationNumber)):a.getObject())instanceof Cr||this._cacheMap.set(t,_),_ instanceof Tr?_.objId=t.toString():_ instanceof Cr&&(_.dictionary.objId=t.toString()),_},i.prototype._fetchCompressed=function(t,e){var i=e.offset,r=this._fetch(Pr.get(i,0));if(void 0===r)throw new gr("bad ObjStm stream");var n=r.dictionary.get("First"),s=r.dictionary.get("N"),a=t.generationNumber;if(!Number.isInteger(n)||!Number.isInteger(s))throw new gr("invalid first and n parameters for ObjStm stream");for(var o=new $r(new Zr(r),this,!0),h=new Array(s),c=new Array(s),_=0;_<s;++_){g=o.getObject();if(!Number.isInteger(g))throw new gr("invalid object number in the ObjStm stream: "+g);var d=o.getObject();if(!Number.isInteger(d))throw new gr("invalid object offset in the ObjStm stream: "+d);h[_]=g,c[_]=d}for(var p=(r.start||0)+n,l=new Array(s),_=0;_<s;++_){var u=_<s-1?c[_+1]-c[_]:void 0;if(u<0)throw new gr("Invalid offset in the ObjStm stream.");var f=(o=new $r(new Zr(r.makeSubStream(p+c[_],u,r.dictionary)),this,!0)).getObject();if(l[_]=f,!(f instanceof Cr)){var g=h[_],y=this._entries[g];if(y&&y.offset===i&&y.gen===_){var m=g+" "+a;this._cacheMap.set(Pr.get(g,a),f),f instanceof Tr&&(f.objId=m)}}}var b=l[e.gen];if(void 0===b)throw new fr("Bad (compressed) XRef entry: "+t,"XRefEntryException");return b},i.prototype._readXRef=function(e){void 0===e&&(e=!1);var i=this._stream,r=new Set;try{for(;this._startXRefQueue.length;){var n=this._startXRefQueue[0];if(this._prevStartXref<n&&(this._prevStartXref=n),r.has(n))this._startXRefQueue.shift();else{r.add(n),i.position=n+i.start;var s=new $r(new Zr(i),this,!0),a=s.getObject(),o=void 0;if(Ot(a,"xref")){if(void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.table),o=this._processXRefTable(s),this._topDictionary||(this._topDictionary=o),a=o.get("XRefStm"),Number.isInteger(a)){var h=a;h in this._crossReferencePosition||(this._crossReferencePosition[h]=1,this._startXRefQueue.push(h))}}else{if(!Number.isInteger(a))throw new gr("Invalid XRef stream header");void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.stream);var c=s.getObject(),_=s.getObject();if(a=s.getObject(),!(void 0!==c&&Number.isInteger(c)&&Ot(_,"obj")&&a instanceof Cr))throw new gr("Invalid cross reference stream");if(o=this._processXRefStream(a),this._topDictionary||(this._topDictionary=o),!o)throw new gr("Failed to read XRef stream")}a=o.get("Prev"),Number.isInteger(a)?this._startXRefQueue.push(a):a instanceof Pr&&this._startXRefQueue.push(a.objectNumber),this._startXRefQueue.shift()}}return this._topDictionary}catch(t){this._startXRefQueue.shift()}if(!e)throw new fr("Invalid cross reference","XRefParseException")},i.prototype._readToken=function(t,e){for(var i="",r=t[e];10!==r&&13!==r&&60!==r&&!(++e>=t.length);)i+=String.fromCharCode(r),r=t[e];return i},i.prototype._skipUntil=function(t,e,i){for(var r=i.length,n=t.length,s=0;e<n;){for(var a=0;a<r&&t[e+a]===i[a];)++a;if(a>=r)break;e++,s++}return s},i.prototype._indexObjects=function(){var t=/^(\d+)\s+(\d+)\s+obj\b/,e=/\bendobj[\b\s]$/,i=/\s+(\d+\s+\d+\s+obj[\b\s<])$/,r=new Uint8Array([116,114,97,105,108,101,114]),n=new Uint8Array([115,116,97,114,116,120,114,101,102]),s=new Uint8Array([111,98,106]),a=new Uint8Array([47,88,82,101,102]);this._entries.length=0,this._cacheMap.clear();var o=this._stream;o.position=0;for(var h=o.getBytes(),c=h.length,_=o.start,d=[],p=[];_<c;){var l=h[_];if(9!==l&&10!==l&&13!==l&&32!==l)if(37!==l){var u=this._readToken(h,_),f=void 0;if(u.startsWith("xref")&&(4===u.length||/\s/.test(u[4])))_+=this._skipUntil(h,_,r),d.push(_),_+=this._skipUntil(h,_,n);else if(f=t.exec(u)){var g=0|Number.parseInt(f[1]),y=0|Number.parseInt(f[2]),m=void 0,v=_+u.length,S=!1;if(this._entries[g]){if(this._entries[g].gen===y)try{var w=o.makeSubStream(v,o.length-v),P=new Zr(w);(B=new $r(P,null)).getObject(),S=!0}catch(t){S=!(t instanceof yr)}}else S=!0;if(S){var A=new bn;A.offset=_-o.start,A.gen=y,A.uncompressed=!0,this._entries[g]=A}for(;v<h.length;){var k=v+this._skipUntil(h,v,s)+4;m=k-_;var x=Math.max(k-25,v),T=b(h.subarray(x,k));if(e.test(T))break;var I=i.exec(T);if(I&&I[1]){m-=I[1].length;break}v=k}var N=h.subarray(_,_+m),C=this._skipUntil(N,0,a);C<m&&N[C+5]<64&&(p.push(_-o.start),this._crossReferencePosition[_-o.start]=1),_+=m}else u.startsWith("trailer")&&(7===u.length||/\s/.test(u[7]))?(d.push(_),_+=this._skipUntil(h,_,n)):_+=u.length+1}else do{if(++_>=c)break;l=h[_]}while(10!==l&&13!==l);else++_}for(F=0;F<p.length;++F)this._startXRefQueue.push(p[F]),this._readXRef(!0);for(var R,F=0;F<d.length;++F){o.position=d[F];var B=new $r(new Zr(o),this,!0,!0);if(Ot(B.getObject(),"trailer")){var L=B.getObject();if(L instanceof Tr){try{var M=L.get("Root");if(!(M instanceof Tr))continue;var D=M.get("Pages");if(!(D instanceof Tr))continue;var O=D.get("Count");if(void 0===O||!Number.isInteger(O))continue}catch(t){continue}if(L.has("ID"))return L;R=L}}}if(R)return R;if(this._topDictionary)return this._topDictionary;throw new fr("Invalid PDF structure.","InvalidPDFException")},i.prototype._processXRefTable=function(t){if(void 0===this._tableState){var e=new vn;e.entryNum=0,e.streamPos=t.lexicalOperator.stream.position,e.parserBuf1=t.first,e.parserBuf2=t.second,this._tableState=e}if(!Ot(this._readXRefTable(t),"trailer"))throw new gr("Invalid XRef table: could not find trailer dictionary");var i,r=t.getObject();if(r&&(r instanceof Tr?i=r:r instanceof Cr&&r.dictionary&&(i=r.dictionary)),!i)throw new gr("Invalid cross reference: could not parse trailer dictionary");return this._tableState=void 0,i},i.prototype._readXRefTable=function(t){var e=t.lexicalOperator.stream;e.position=this._tableState.streamPos,t.first=this._tableState.parserBuf1,t.second=this._tableState.parserBuf2;for(var i;;){if(void 0===this._tableState.firstEntryNum||void 0===this._tableState.entryCount){if(i=t.getObject(),Ot(i,"trailer"))break;this._tableState.firstEntryNum=i,this._tableState.entryCount=t.getObject()}var r=this._tableState.firstEntryNum,n=this._tableState.entryCount;if(!Number.isInteger(r)||!Number.isInteger(n))throw new gr("Invalid cross reference: wrong types in subsection header");for(var s=this._tableState.entryNum;s<n;s++){this._tableState.streamPos=e.position,this._tableState.entryNum=s,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second;var a=new bn;a.offset=t.getObject(),a.gen=t.getObject();var o=t.getObject();if(o)switch(o.command){case"f":a.free=!0;break;case"n":a.uncompressed=!0}if(!Number.isInteger(a.offset)||!Number.isInteger(a.gen)||!a.free&&!a.uncompressed)throw new gr("Invalid entry in cross reference subsection: "+r+", "+n);0===s&&a.free&&1===r&&(r=0),this._entries[s+r]||(this._entries[s+r]=a)}this._tableState.entryNum=0,this._tableState.streamPos=e.position,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second,this._tableState.firstEntryNum=void 0,this._tableState.entryCount=void 0}if(this._entries[0]&&!this._entries[0].free)throw new gr("Invalid XRef table: unexpected first object");return i},i.prototype._processXRefStream=function(t){if(void 0===this._streamState){var e=t.dictionary,i=new Sn,r=e.getArray("Index");r||(r=[0,e.get("Size")]),i.entryRanges=r,i.byteWidths=e.getArray("W"),i.entryNum=0,i.streamPos=t.position,this._streamState=i}return this._readXRefStream(t),this._streamState=void 0,t.dictionary},i.prototype._readXRefStream=function(t){t.position=this._streamState.streamPos;for(var e=this._streamState.byteWidths[0],i=this._streamState.byteWidths[1],r=this._streamState.byteWidths[2],n=this._streamState.entryRanges;n.length>0;){var s=n[0],a=n[1];if(!Number.isInteger(s)||!Number.isInteger(a))throw new gr("Invalid XRef range fields: "+s+", "+a);if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r))throw new gr("Invalid XRef entry fields length: "+s+", "+a);for(var o=this._streamState.entryNum;o<a;++o){this._streamState.entryNum=o,this._streamState.streamPos=t.position;for(var h=0,c=0,_=0,d=0;d<e;++d){var p=t.getByte();if(-1===p)throw new gr("invalid cross reference byte width type.");h=h<<8|p}0===e&&(h=1);for(d=0;d<i;++d){var l=t.getByte();if(-1===l)throw new gr("invalid cross reference byte width offset.");c=c<<8|l}for(d=0;d<r;++d){var u=t.getByte();if(-1===u)throw new gr("invalid cross reference byte width generation.");_=_<<8|u}var f=new bn;switch(f.offset=c,f.gen=_,h){case 0:f.free=!0;break;case 1:f.uncompressed=!0;break;case 2:break;default:throw new gr("Invalid XRef entry type: "+h)}this._entries[s+o]||(this._entries[s+o]=f)}this._streamState.entryNum=0,this._streamState.streamPos=t.position,n.splice(0,2)}},i.prototype._getCatalogObj=function(){return this._root},i.prototype._save=function(){var e=this,i=this._stream.length,r=[this._newLine.charCodeAt(0),this._newLine.charCodeAt(1),37,80,68,70,45];this._writeString(""+this._version+this._newLine,r),r.push(37,131,146,250,254),this._writeString(this._newLine,r);var n=0,s=0;if(this._document._fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream){var a=[],o=[],h="",c=[];c.push(0,1);var _=[],d=[];this._cacheMap.forEach(function(t,n){var a;if(t instanceof Cr&&(a=t.dictionary),a&&a._updated&&(!a.isCatalog||e._allowCatalog)){c.push(n.objectNumber,1),d.push(i+r.length);var o;e._encrypt&&(o=e._encrypt._createCipherTransform(n.objectNumber,n.generationNumber)),e._writeObject(t,r,n,o),s++,a._updated=!1}}),this._cacheMap.forEach(function(t,a){if(t instanceof Tr)!t._updated||t.isCatalog&&!e._allowCatalog||(h+=a.objectNumber+" "+o.length+e._newLine,_.push(a.objectNumber,1),n++,e._writeObject(t,o));else if(t instanceof Cr){var p=t.dictionary;p&&p._updated&&(!p.isCatalog||e._allowCatalog)&&(c.push(a.objectNumber,1),d.push(i+r.length),e._writeObject(t,r,a),s++,p._updated=!1)}});for(var p=0;p<_.length;p++)c.push(_[parseInt(p.toString(),10)]);var l=void 0,u=void 0;if(n>0){u=this._getNextReference(),c.push(u.objectNumber,2),this._writeString(h,a),this._writeBytes(o,a);var f=new Tr(this);f.set("Type",Sr.get("ObjStm")),f.set("N",n),f.set("First",h.length),f.set("Length",a.length);var g=new Rr(a,f,0,a.length);l=i+r.length;var y;this._encrypt&&(y=this._encrypt._createCipherTransform(u.objectNumber,u.generationNumber)),this._writeObject(g,r,u,y)}var m=Math.max(Lt(this._stream.bytes.length+r.length),Lt(this._nextReferenceNumber)),b=this._getNextReference(),v=i+r.length;(x=new Tr(this)).set("Type",Sr.get("XRef")),x.set("Index",c),x.set("W",[1,m,1]),this._copyTrailer(x),this._ids&&this._ids.length>0&&x.update("ID",[this._ids[0],this._computeMessageDigest(v)]);var S=[];if(this._writeLong(0,1,S),this._writeLong(1,m,S),this._writeLong(-1,1,S),s>0)for(w=0;w<s;w++)this._writeLong(1,1,S),this._writeLong(d[w],m,S),this._writeLong(0,1,S);if(n>0){for(var w=0;w<n;w++)this._writeLong(2,1,S),this._writeLong(u.objectNumber,m,S),this._writeLong(w,1,S);this._writeLong(1,1,S),this._writeLong(l,m,S),this._writeLong(0,1,S)}this._writeLong(1,1,S),this._writeLong(v,m,S),this._writeLong(0,1,S),x.set("Length",S.length);var P=new Rr(S,x,0,S.length),A=void 0;this._encrypt&&(A=this._encrypt._createCipherTransform(b.objectNumber,b.generationNumber)),this._writeObject(P,r,b,A,!0),this._writeString("startxref"+this._newLine+v+this._newLine+"%%EOF"+this._newLine,r)}else{var k="";this._cacheMap.forEach(function(t,s){var a;if(t instanceof Tr?a=t:t instanceof Cr&&(a=t.dictionary),a&&a._updated&&(!a.isCatalog||e._allowCatalog)){for(var o=(i+r.length).toString();o.length<10;)o="0"+o;for(var h=s.generationNumber.toString();h.length<5;)h="0"+h;k+=s.objectNumber+" 1"+e._newLine+o+" "+h+" n"+e._newLine,n++,e._writeObject(t,r,s)}});v=r.length+i;this._writeString("xref"+this._newLine+"0 1"+this._newLine+"0000000000 65535 f"+this._newLine,r),n>0&&this._writeString(k,r),this._writeString("trailer"+this._newLine,r);var x=new Tr(this);this._copyTrailer(x),this._writeDictionary(x,r,this._newLine),this._writeString("startxref"+this._newLine+v+this._newLine+"%%EOF"+this._newLine,r)}var T=new Uint8Array(this._stream.length+r.length);return T.set(this._stream.bytes),T.set(r,this._stream.length),T},i.prototype._copyTrailer=function(t){var e=this._getNextReference();t.set("Size",e.objectNumber),t.set("Prev",this._prevXRefOffset);var i=this._trailer.getRaw("Root");void 0!==i&&null!==i&&t.set("Root",i);var r=this._trailer.getRaw("Info");void 0!==r&&null!==r&&t.set("Info",r);var n=this._trailer.getRaw("Encrypt");void 0!==n&&null!==n&&t.set("Encrypt",n)},i.prototype._computeMessageDigest=function(t){var e=this,i=[Math.floor(Date.now()/1e3).toString(),"",t.toString()],r=this._trailer.getRaw("Info"),n=new Tr;r&&r instanceof Tr&&r.forEach(function(t,e){e&&"string"==typeof e&&n.set(t,l(e))}),n.forEach(function(t,e){i.push(e)});var s=[];return i.forEach(function(t){e._writeString(t,s)}),b((new nn).hash(new Uint8Array(s)))},i.prototype._getNextReference=function(){var t=new Pr(this._nextReferenceNumber++,0);return t._isNew=!0,t},i.prototype._writeObject=function(t,e,i,r,n){i&&i instanceof Pr&&this._writeString(i.objectNumber+" "+i.generationNumber+" obj"+this._newLine,e),t instanceof Tr?this._writeDictionary(t,e,this._newLine,r,n):t instanceof Cr&&this._writeStream(t,e,r,n),i&&i instanceof Pr&&this._writeString("endobj"+this._newLine,e)},i.prototype._writeDictionary=function(t,e,i,r,n){var s=this;t._currentObj&&t._currentObj._beginSave(),t._isFont&&this._writeFontDictionary(t),this._writeString("<<"+i,e),t.forEach(function(t,a){s._writeString("/"+K(t)+" ",e),s._writeValue(a,e,r,n),s._writeString(i,e)}),this._writeString(">>"+this._newLine,e)},i.prototype._writeFontDictionary=function(t){if(t.has("DescendantFonts")){var e=t.get("DescendantFonts"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("DescendantFonts",[i])}if(t.has("ToUnicode")){var e=t.get("ToUnicode"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("ToUnicode",i)}if(t.has("FontFile2")){var e=t.get("FontFile2"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("FontFile2",i)}if(t.has("FontDescriptor")){var e=t.get("FontDescriptor"),i=this._getNextReference();this._cacheMap.set(i,e),t.update("FontDescriptor",i)}},i.prototype._writeStream=function(t,i,r,n){var s=[],a=t.getString();if(!n){for(var o=[],h=0;h<a.length;h++)o.push(a.charCodeAt(h));if(t._isCompress){var c=new Uint8Array(o),_=new e.CompressedStreamWriter;_.write(c,0,c.length),_.close(),a=_.getCompressedString,t.dictionary.update("Filter",Sr.get("FlateDecode"))}r&&(a=r.encryptString(a))}this._writeString(a,s),t.dictionary.update("Length",s.length),this._writeDictionary(t.dictionary,i,this._newLine,r,n),this._writeString("stream"+this._newLine,i),this._writeBytes(s,i),this._writeString(this._newLine+"endstream"+this._newLine,i)},i.prototype._writeValue=function(t,e,i,r){if(t instanceof Sr)this._writeString("/"+t.name,e);else if(t instanceof Pr)this._writeString(t.toString()+" R",e);else if(Array.isArray(t)){this._writeString("[",e);for(var n=!0,s=0,a=t;s<a.length;s++){var o=a[s];n?n=!1:this._writeString(" ",e),this._writeValue(o,e,i,r)}this._writeString("]",e)}else"string"==typeof t?(!r&&i&&(t=i.encryptString(t)),this._writeString("("+this._escapeString(t)+")",e)):"number"==typeof t?this._writeString(y(t),e):"boolean"==typeof t?this._writeString(t.toString(),e):t instanceof Tr?this._writeDictionary(t,e,this._newLine,i,r):t instanceof Cr?this._writeStream(t,e,i,r):null===t&&this._writeString("null",e)},i.prototype._writeString=function(t,e){for(var i=0;i<t.length;i++)e.push(255&t.charCodeAt(i))},i.prototype._writeBytes=function(t,e){for(var i=0;i<t.length;i++)e.push(t[i])},i.prototype._writeLong=function(t,e,i){for(var r=e-1;r>=0;--r)i.push(t>>(r<<3)&255)},i.prototype._escapeString=function(t){return t.replace(/([()\\\n\r])/g,function(t){return"\n"===t?"\\n":"\r"===t?"\\r":"\\"+t})},i.prototype._destroy=function(){this._entries=void 0,this._pendingRefs.clear(),this._pendingRefs=void 0,this._cacheMap.clear(),this._pendingRefs=void 0,this._root=void 0,this._startXRefQueue=[],this._startXRefQueue=void 0,this._stream=void 0,this._streamState=void 0,this._tableState=void 0,this._topDictionary=void 0,this._trailer=void 0,this._version=void 0,this._crossReferencePosition=void 0},i}(),bn=function(){function t(){}return t}(),vn=function(){function t(){}return t}(),Sn=function(){function t(){}return t}(),wn=function(){function e(e,i){this._hasKids=!1,this._setAppearance=!1,this._exportEmptyFields=!1,this._fieldCollection=[],this._signFlag=t._SignatureFlag.none,this._dictionary=e,this._crossReference=i,this._parsedFields=new Map,this._fields=[],this._createFields()}return Object.defineProperty(e.prototype,"count",{get:function(){return this._fields.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needAppearances",{get:function(){return this._dictionary.has("NeedAppearances")&&(this._needAppearances=this._dictionary.get("NeedAppearances")),this._needAppearances},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportEmptyFields",{get:function(){return this._exportEmptyFields},set:function(t){this._exportEmptyFields=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_signatureFlag",{get:function(){return this._signFlag},set:function(t){t!==this._signFlag&&(this._signFlag=t,this._dictionary.update("SigFlags",t))},enumerable:!0,configurable:!0}),e.prototype.fieldAt=function(e){if(e<0||e>=this._fields.length)throw Error("Index out of range.");var i;if(this._parsedFields.has(e))i=this._parsedFields.get(e);else{var r=void 0,n=this._fields[e];if(n&&n instanceof Pr&&(r=this._crossReference._fetch(n)),r){var s=T(r,"FT",!1,!0),a=0,o=T(r,"Ff",!1,!0);if(void 0!==o&&(a=o),s)switch(s.name.toLowerCase()){case"tx":i=ni._load(this,r,this._crossReference,n);break;case"btn":i=0!=(a&t._FieldFlag.pushButton)?si._load(this,r,this._crossReference,n):0!=(a&t._FieldFlag.radio)?oi._load(this,r,this._crossReference,n):ai._load(this,r,this._crossReference,n);break;case"ch":i=0!=(a&t._FieldFlag.combo)?ci._load(this,r,this._crossReference,n):_i._load(this,r,this._crossReference,n);break;case"sig":i=di._load(this,r,this._crossReference,n)}this._parsedFields.set(e,i),i&&i instanceof ri&&(i._annotationIndex=e)}}return i},e.prototype.add=function(e){if(this._fields.push(e._ref),this._dictionary.update("Fields",this._fields),this._parsedFields.set(this._fields.length-1,e),e._form=this,this._crossReference._root._updated=!0,e._kidsCount>0)for(var i=0;i<e._kidsCount;i++){var r=e.itemAt(i);(n=r._page).annotations._annotations.push(r._ref),n._pageDictionary.set("Annots",n.annotations._annotations),n._pageDictionary._updated=!0}else if(e._dictionary.has("Subtype")&&"Widget"===e._dictionary.get("Subtype").name){var n=e._page;n.annotations._annotations.push(e._ref),e._page._pageDictionary.set("Annots",e.page.annotations._annotations),e._page._pageDictionary._updated=!0}return e instanceof di&&(e._form._signatureFlag=t._SignatureFlag.signatureExists|t._SignatureFlag.appendOnly),this._fields.length-1},e.prototype.removeField=function(t){var e=this._fields.indexOf(t._ref);e>=0&&this.removeFieldAt(e)},e.prototype.removeFieldAt=function(t){var e=this.fieldAt(t);if(e){if(e._kidsCount>0)for(var i=e._kidsCount-1;i>=0;i--){var r=e.itemAt(i);(n=r._getPage())&&n._removeAnnotation(r._ref)}else if(e._dictionary.has("Subtype")&&"Widget"===e._dictionary.get("Subtype").name){var n=e.page;n&&n._removeAnnotation(e._ref)}this._parsedFields.delete(t)}this._fields.splice(t,1),this._dictionary.set("Fields",this._fields),this._dictionary._updated=!0},e.prototype.setDefaultAppearance=function(t){this._setAppearance=!t,this._needAppearances=t,this._dictionary.update("NeedAppearances",t)},e.prototype.orderFormFields=function(e){var i=this;if(null===e||void 0===e)this.orderFormFields(new Map);else{var r=void 0,n=this._crossReference._document,s=void 0;if(e&&e instanceof Map){var a=!0;e.size>0?this._tabCollection=e:(a=!1,this._tabCollection=e);var o=new Map;if(this._fieldCollection=this._getFields(),this._fieldCollection&&this._fieldCollection.length>0&&this._fieldCollection[0].page&&n){for(l=0;l<this._fieldCollection.length;l++){var h=this._fieldCollection[Number.parseInt(l.toString(),10)];if(h.page){var c=_(n,this._sortItemByPageIndex(h,!0)._pageDictionary);if(c>=0){o.has(c)?(s=o.get(c)).push(h):((s=[]).push(h),o.set(c,s));var d=n.getPage(c);this._tabCollection.has(c)||this._tabCollection.set(c,d.tabOrder),a&&(d.tabOrder=this._tabCollection.get(c))}}}var p=0;o.forEach(function(e,r){if(i._tabOrder=i._tabCollection.get(r),i._tabOrder!==t.PdfFormFieldsTabOrder.structure){var n=e;n.sort(function(t,e){return i._compareFields(t,e)});for(var s=0;s<n.length;s++){var a=i._fieldCollection.indexOf(n[Number.parseInt(s.toString(),10)]);if(-1!==a&&a!==p+s){var o=i._fieldCollection[Number.parseInt(a.toString(),10)];i._fieldCollection.splice(a,1),i._fieldCollection.splice(p+s,0,o)}}}p+=e.length})}}else this._tabOrder=e,r=this._getOrder(this._tabOrder),this._fieldCollection=this._getFields(),this._fieldCollection.sort(function(t,e){return i._compareFields(t,e)});this._parsedFields.clear();for(var l=0;l<this._fieldCollection.length;l++)this._parsedFields.set(Number.parseInt(l.toString(),10),this._fieldCollection[Number.parseInt(l.toString(),10)]),this._fields[Number.parseInt(l.toString(),10)]=this._fieldCollection[Number.parseInt(l.toString(),10)]._ref,r&&this._fieldCollection[Number.parseInt(l.toString(),10)].page._pageDictionary.update("Tabs",r);this._dictionary.update("Fields",this._fields)}},e.prototype._createFields=function(){var t;this._dictionary.has("Fields")&&(t=this._dictionary.get("Fields"));for(var e=0,i=[];void 0!==t&&null!==t;){for(;e<t.length;e++){var r=t[e],n=void 0;r&&r instanceof Pr&&(n=this._crossReference._fetch(r));var s=void 0;if(n&&n.has("Kids")&&void 0!==(s=n.get("Kids"))&&s.length>0)for(var a=0;a<s.length;a++){var o=s[Number.parseInt(a.toString(),10)];if(o&&o instanceof Pr){var h=this._crossReference._fetch(o);void 0===h||h.has("Parent")||h.update("Parent",r)}}void 0===s?void 0!==n&&-1===this._fields.indexOf(r)&&this._fields.push(r):!n.has("FT")||this._isNode(s)?(i.push({fields:t,count:e}),this._hasKids=!0,e=-1,t=s):this._fields.push(r)}if(0===i.length)break;var c=i.pop();t=c.fields,e=c.count+1}},e.prototype._isNode=function(t){var e=!1;if(void 0!==t&&t.length>0){var i=t[0],r=void 0;if(void 0!==i&&null!==i&&(i instanceof Tr?r=i:i instanceof Pr&&(r=this._crossReference._fetch(i))),void 0!==r&&r.has("Subtype")){var n=r.get("Subtype");n&&"Widget"!==n.name&&(e=!0)}}return e},e.prototype._parseWidgetReferences=function(){var t=this;return void 0===this._widgetReferences&&this.count>0&&(this._widgetReferences=[],this._fields.forEach(function(e){var i=t._crossReference._fetch(e);if(i)if(i.has("Kids")){var r=i.get("Kids");r&&r.length>0&&r.forEach(function(e){var i;if(e instanceof Tr?i=e:e instanceof Pr&&(i=t._crossReference._fetch(e)),void 0!==i&&i.has("Subtype")){var r=i.get("Subtype");r&&"Widget"===r.name&&t._widgetReferences.push(e)}})}else t._widgetReferences.push(e)})),this._widgetReferences},e.prototype._doPostProcess=function(t){for(var e=this.count-1;e>=0;e--){var i=this.fieldAt(e);i&&(i._doPostProcess(t||i.flatten),!t&&i.flatten&&this.removeFieldAt(e))}},e.prototype._getFieldIndex=function(t){var e=-1;if(this.count>0){this._fieldNames||(this._fieldNames=[]),this._indexedFieldNames||(this._indexedFieldNames=[]),this._actualFieldNames||(this._actualFieldNames=[]),this._indexedActualFieldNames||(this._indexedActualFieldNames=[]);for(var i=0;i<this.count;i++){var r=this.fieldAt(i);if(r){var n=r.name;n&&(this._fieldNames.push(n),this._indexedFieldNames.push(n.split("[")[0]));var s=r.actualName;s&&(this._actualFieldNames.push(s),this._indexedActualFieldNames.push(s.split("[")[0]))}}var a=this._fieldNames.indexOf(t);-1!==a?e=a:-1!==(a=this._indexedFieldNames.indexOf(t))?e=a:-1!==(a=this._actualFieldNames.indexOf(t))?e=a:-1!==(a=this._indexedActualFieldNames.indexOf(t))&&(e=a)}return e},e.prototype._getFields=function(){for(var t=[],e=0;e<this._fields.length;e++){var i=this.fieldAt(e);i&&i instanceof ri&&t.push(i)}return t},e.prototype._getOrder=function(e){if(e!==t.PdfFormFieldsTabOrder.none){var i="";return e===t.PdfFormFieldsTabOrder.row?i="R":e===t.PdfFormFieldsTabOrder.column?i="C":e===t.PdfFormFieldsTabOrder.structure&&(i="S"),Sr.get(i)}return null},e.prototype._compareFields=function(e,i){var r,n,s=0,a=e.page,o=i.page;if(a&&!a._isNew&&a instanceof $i&&o&&!o._isNew&&o instanceof $i){var h=this._sortItemByPageIndex(e,!1)._pageIndex,c=this._sortItemByPageIndex(i,!1)._pageIndex,_=void 0;_=e._dictionary.has("Kids")?this._getItemRectangle(e):this._getRectangle(e._dictionary);var d=void 0;d=i._dictionary.has("Kids")?this._getItemRectangle(i):this._getRectangle(i._dictionary);var p=_[3]-_[1],l=d[3]-d[1];if(_&&_.length>=2&&d&&d.length>=2){var u=_[0],f=_[1],g=d[0],y=d[1];if("number"==typeof u&&"number"==typeof g&&"number"==typeof f&&"number"==typeof y)if(n=h-c,this._tabOrder===t.PdfFormFieldsTabOrder.row){if(0!==(r=this._compare(y,f))){var m=-1===r&&f>y&&f-p/2<y;(m=m||1===r&&y>f&&y-l/2<f)&&(r=0)}s=0!==n?n:0!==r?r:this._compare(u,g)}else if(this._tabOrder===t.PdfFormFieldsTabOrder.column)r=this._compare(u,g),s=0!==n?n:0!==r?r:this._compare(y,f);else if((this._tabOrder===t.PdfFormFieldsTabOrder.manual||this._tabOrder===t.PdfFormFieldsTabOrder.none||this._tabOrder===t.PdfFormFieldsTabOrder.structure)&&e instanceof ri&&i instanceof ri){var b=e.tabIndex,v=i.tabIndex;r=this._compare(b,v),s=0!==n?n:r}}}return s},e.prototype._getRectangle=function(t){var e;return t.has("Rect")&&(e=t.getArray("Rect")),e},e.prototype._getItemRectangle=function(t){var e,i=t._dictionary;if(i.has("Kids")){var r=i.getArray("Kids");r&&r.length>=1&&(e=1===r.length?this._getRectangle(r[0]):t&&t.itemsCount>1?this._getRectangle(t.itemAt(0)._dictionary):this._getRectangle(r[0]))}return e},e.prototype._compare=function(t,e){return t>e?1:t<e?-1:0},e.prototype._compareKidsElement=function(e,i){var r,n=this._crossReference._fetch(e),s=this._crossReference._fetch(i),a=this._getRectangle(n),o=this._getRectangle(s);if(a&&a.length>=2&&o&&o.length>=2){var h=a[0],c=a[1],_=o[0],d=o[1];if("number"==typeof h&&"number"==typeof _&&"number"==typeof c&&"number"==typeof d){var p=void 0;return r=this._tabOrder===t.PdfFormFieldsTabOrder.row?0!==(p=this._compare(d,c))?p:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column?0!==(p=this._compare(h,_))?p:this._compare(d,c):0}}return r},e.prototype._sortItemByPageIndex=function(t,e){var i=t.page,r=this._tabOrder;return this._tabOrder=e?t.page.tabOrder:r,this._sortFieldItems(t),t._isLoaded&&t._kidsCount>1&&(i=t.itemAt(0).page),this._tabOrder=r,void 0===i&&(i=t.page),i},e.prototype._sortFieldItems=function(t){var e=this;if(t._isLoaded&&(t instanceof ni||t instanceof _i||t instanceof ai||t instanceof oi)){var i=t._parseItems();i.sort(function(t,i){return e._compareFieldItem(t,i)}),t._parsedItems.clear();for(var r=0;r<i.length;r++)t._parsedItems.set(r,i[Number.parseInt(r.toString(),10)])}},e.prototype._compareFieldItem=function(e,i){var r=0;if(void 0!==e&&void 0!==i){var n=e.page,s=i.page,a=this._getRectangle(e._dictionary),o=this._getRectangle(i._dictionary);if(a&&o){var h=a[0],c=a[1],_=o[0],d=o[1],p=void 0;this._tabOrder===t.PdfFormFieldsTabOrder.row?r=0!==(p=this._compare(n._pageIndex,s._pageIndex))?p:0!==(p=this._compare(d,c))?p:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column&&(r=0!==(p=this._compare(n._pageIndex,s._pageIndex))?p:0!==(p=this._compare(h,_))?p:this._compare(d,c))}}return r},e.prototype._clear=function(){this._fields=[],this._parsedFields=new Map},e}(),Pn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),An=function(t){function i(e){var i=t.call(this)||this;return i._annotationObjects=new Map,i._specialCharacters="âãÏÓ",null!==e&&void 0!==e&&(i._fileName=e),i}return Pn(i,t),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},i.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=G(),this._save()},i.prototype._save=function(){var t=this,e=0,i=[];if(!this._isAnnotationExport){this._asPerSpecification?(this.fdfString+="%FDF-1.2\n%"+this._specialCharacters+"\r\n1 0 obj\r<</FDF<</F(",this.fdfString+=this._fileName+")",this.fdfString+="/Fields["):this.fdfString+="%FDF-1.2\n";var r=this._document.form;if(null!==r&&void 0!==r){this._exportEmptyFields=r.exportEmptyFields;for(var n=this._document.form.count,s=0;s<n;s++){var a=this._document.form.fieldAt(s),o=this._exportFormFieldsData(a);if((a instanceof ni||a instanceof _i||a instanceof ci||a instanceof oi||a instanceof ai)&&e++,this._asPerSpecification)if(a instanceof ni||a instanceof _i||a instanceof ci){if(i.push(e),this.fdfString+="<</T("+a.name+")/V","string"==typeof o||Array.isArray(o)&&1===o.length)this.fdfString+="("+(Array.isArray(o)?o[0]:o)+")";else if(Array.isArray(o)){this.fdfString+="[";for(h=0;h<o.length;h++)this.fdfString+="("+o[Number.parseInt(h.toString(),10)]+")",h!==o.length-1&&(this.fdfString+=" ");this.fdfString+="]"}this.fdfString+=">>"}else(a instanceof oi||a instanceof ai)&&(i.push(e),this.fdfString+="<</T("+a.name+")/V/"+o+">>");else if(a instanceof ni||a instanceof _i||a instanceof ci){if(i.push(e),this.fdfString+=e+" 0 obj<</T <"+this._stringToHexString(a.name)+"> /V ","string"==typeof o||Array.isArray(o)&&1===o.length)this.fdfString+="<"+this._stringToHexString(Array.isArray(o)?o[0]:o)+">";else if(Array.isArray(o)){this.fdfString+="[";for(var h=0;h<o.length;h++)this.fdfString+="<"+this._stringToHexString(o[Number.parseInt(h.toString(),10)])+">",h!==o.length-1&&(this.fdfString+=" ");this.fdfString+="]"}this.fdfString+=" >>endobj\n"}else(a instanceof oi||a instanceof ai)&&(i.push(e),this.fdfString+=e+" 0 obj<</T <"+this._stringToHexString(a.name)+"> /V /",this.fdfString+=o+" >>endobj\n")}}if(this._asPerSpecification)this.fdfString+="]",this.fdfString+="/ID[]/UF("+this._fileName+")>>/Type/Catalog>>\rendobj\rtrailer\r\n<</Root 1 0 R>>\r\n",this.fdfString+="%%EOF\r\n";else{this.fdfString+=this._table.size+1+" 0 obj<</F <"+this._stringToHexString(this._fileName)+"> /Fields [";for(s=0;s<this._table.size;s++)null!==(a=this._document.form.fieldAt(s))&&void 0!==a&&a.export&&(this.fdfString+=i[Number.parseInt(s.toString(),10)]+" 0 R ");this.fdfString+="]>>endobj\n",this.fdfString+=i.length+2+" 0 obj<</Version /1.4 /FDF "+(i.length+1)+" 0 R>>endobj\n",this.fdfString+="trailer\n<</Root "+(i.length+2)+" 0 R>>"}}var c=new ArrayBuffer(1*this.fdfString.length),_=new Uint8Array(c);return _.forEach(function(e,i){_[i]=t.fdfString.charCodeAt(i)}),_},i.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(b(e));var i=new Rr(e);this._isAnnotationImport=!0;var r=new $r(new Zr(i),null,!0,!1);this._readFdfData(r),null!==this._annotationObjects&&void 0!==this._annotationObjects&&this._annotationObjects.size>0&&this._annotationObjects.clear(),null!==this._table&&void 0!==this._table&&this._table.size>0&&this._table.clear()},i.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(b(e));var i=new Rr(e),r=new $r(new Zr(i),null,!1,!1);this._readFdfData(r)},i.prototype._readFdfData=function(t){var e=this,i=t.getObject();if(this._isAnnotationImport){for(var r="";null!==i&&void 0!==i&&"EOF"!==i;)i instanceof Tr?(this._table.set(r,i),r=""):i instanceof Rr||i instanceof qr?(this._table.set(r,i),r=""):null!==i&&Number.isInteger(i)&&0!==i?t.first>=0&&(r=i.toString()+" "+t.first.toString()):i instanceof wr&&null!==i.command&&void 0!==i.command&&"trailer"===i.command&&(r=i.command),i=t.getObject();this._annotationObjects=this._parseAnnotationData(),this._annotationObjects.forEach(function(t,i){var r=t;if(r._crossReference=e._crossReference,r._updated=!0,null!==r&&void 0!==r&&r.has("Page")){var n=r.get("Page");if(null!==n&&void 0!==n){var s=n;if(s<e._document.pageCount){var a=e._document.getPage(s),o=a._pageDictionary;if(null!==o&&void 0!==o){var h=a.annotations,c=h._parseAnnotation(r);if(null!==c&&void 0!==c){c._isImported=!0;var _=e._crossReference._getNextReference();e._crossReference._cacheMap.set(_,r),(r.has("NM")||r.has("IRT"))&&e._addReferenceToGroup(_,r),c._ref=_;var d=h._annotations.length;h._annotations.push(_),o.set("Annots",h._annotations),o._updated=!0,h._parsedAnnotations.set(d,c),e._handlePopup(h,_,r,o)}}}}}})}else{if(i=t.getObject(),this._asPerSpecification)for(;null!==i&&void 0!==i&&"EOF"!==i;){if(i instanceof Tr&&null!==i&&null!==i._map.FDF&&void 0!==i._map.FDF&&(i=i._map.FDF)instanceof Tr&&null!==i._map.Fields&&void 0!==i._map.Fields&&null!==(i=i._map.Fields)&&void 0!==i)for(var n=0;n<i.length;n++){var s=i[Number.parseInt(n.toString(),10)];if(s instanceof Tr&&null!==s&&void 0!==s){var a=s.getArray("T"),o=void 0;o=s._map.V instanceof Sr?s.getArray("V").name:s.getArray("V"),null!==a&&void 0!==a&&a.length>0&&this._table.set(a,o)}}i=t.getObject()}else for((i=t.getObject())instanceof wr&&null!==i.command&&(i=i.command);null!==i&&void 0!==i&&"EOF"!==i;){if(i instanceof Tr){var a=i.getArray("T"),o=void 0;o=i._map.V instanceof Sr?i.getArray("V").name:i.getArray("V"),null!==a&&void 0!==a&&a.length>0&&this._table.set(a,o)}i=t.getObject()}this._importField()}},i.prototype._parseAnnotationData=function(){var t=new Map,e=new Map;if(null!==(t=this._table)&&void 0!==t&&t.size>0&&t.has("trailer")){var i=t.get("trailer");if(i instanceof Tr&&null!==i&&void 0!==i&&i.has("Root")){var r=i.getRaw("Root");if(null!==r&&void 0!==r){var n=r.objectNumber.toString()+" "+r.generationNumber.toString();if(t.has(n)){var s=t.get(n);if(null!==s&&void 0!==s&&s.has("FDF")){var a=s.get("FDF");if(null!==a&&void 0!==a&&a.has("Annots")){var o=a.get("Annots");if(null!==o&&void 0!==o&&o.length>0)for(var h=0;h<o.length;h++){var c=o[Number.parseInt(h.toString(),10)],_=c.objectNumber.toString()+" "+c.generationNumber.toString();t.has(_)&&(c=t.get(_),e.set(_,c),t.delete(_))}}}}t.delete(n)}}t.delete("trailer")}return e},i.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._table.forEach(function(r,n){var s;t._table.size>0&&t._table.has(n)&&(s=t._table.get(n));var a=e._getFieldIndex(n);if(-1!==a&&a<i){var o=e.fieldAt(a);if(o){s&&""!==s&&o._dictionary.update("RV",s);var h=[];Array.isArray(r)?h=r:h.push(r),t._importFieldData(o,h)}}})},i.prototype._exportAnnotationData=function(t,e){var i=Yt._whiteSpace+"0"+Yt._whiteSpace;this.fdfString+="%FDF-1.2\r\n";for(var r=2,n=new Array,s=this.exportAppearance,a=0;a<e;a++){var o=t.getPage(a);if(null!==o&&void 0!==o&&o.annotations.count>0)for(var h=0;h<o.annotations.count;h++){var c=o.annotations.at(h);if(null!==c&&void 0!==c&&!(c instanceof Ti||c instanceof Ci||c instanceof Ni||c instanceof Ii))if(c instanceof Mi||c instanceof Si)r=(_=this._exportAnnotation(c,this.fdfString,r,n,a,!0)).index,n=_.annot;else{var _=this._exportAnnotation(c,this.fdfString,r,n,a,s);r=_.index,n=_.annot}}}if(2!==r){var d="1"+i;this.fdfString+=d+"obj\r\n<</FDF<</Annots[";for(a=0;a<n.length-1;a++)this.fdfString+=n[Number.parseInt(a.toString(),10)]+i+"R ";this.fdfString+=n[n.length-1]+i+"R]/F("+this._fileName+")/UF(",this.fdfString+=this._fileName+")>>/Type/Catalog>>\r\nendobj\r\n",this.fdfString+="trailer\r\n<</Root "+d+"R>>\r\n%%EOF\r\n"}},i.prototype._exportAnnotation=function(t,e,i,r,n,s){this.fdfString=e;var a=new kn,o=t._dictionary,h=Yt._whiteSpace+"0"+Yt._whiteSpace+"obj\r\n";this._annotationID=i.toString(),this.fdfString+=i+h+"<<";var c=new Map,_=new Array;r.push(this._annotationID),o.set("Page",n);var d=this._getEntries(c,_,i,o,this.fdfString,s);i=d.index,c=d.list,_=d.streamReference,delete o._map.Page,this.fdfString+=">>\r\nendobj\r\n";for(var p=this;c.size>0;)!function(){var t=Array();c.forEach(function(e,i){t.push(i)});for(var e=0;e<t.length;e++){var a=t[Number.parseInt(e.toString(),10)];if((c.get(a)instanceof Tr||c.get(a)instanceof Rr||c.get(a)instanceof qr)&&null!==(o=c.get(a)instanceof Tr?c.get(a):c.get(a).dictionary)&&void 0!==o){if(o instanceof Tr&&o.has("Type")){var d=o.get("Type");null!==d&&void 0!==d&&"Annot"===d.name&&(r.push(a.toString()),o.set("Page",n))}p.fdfString+=a+h+"<<";var l=p._getEntries(c,_,i,o,p.fdfString,s);c=l.list,_=l.streamReference,i=l.index,o instanceof Tr&&o.has("Page")&&delete o._map.Page,p.fdfString+=">>",null!==_&&void 0!==_&&-1!==_.indexOf(a)&&p._appendStream(c.get(a),p.fdfString),p.fdfString+="\r\nendobj\r\n"}c.delete(a)}}();return i++,a.index=i,a.annot=r,a},i.prototype._appendStream=function(t,i){var r=t;if(this.fdfString=i,(t instanceof qr||t instanceof Rr)&&(r=t instanceof qr?t.stream:t),t instanceof qr||t instanceof Rr){var n=r.getBytes(),s=new Uint8Array(n),a=new e.CompressedStreamWriter;a.write(s,0,s.length),a.close();var o=a.getCompressedString;this.fdfString+="stream\r\n",this.fdfString+=o,this.fdfString+="\r\nendstream"}},i.prototype._getEntries=function(t,e,i,r,n,s){var a=this,o=!1,h=new kn;this.fdfString=n;var c=t;return r.forEach(function(t,n){if(s||"AP"!==t){"P"!==t&&(a.fdfString+="/"+t),("Sound"===t||"F"===t||s)&&(o=!0);var h=n;if("string"==typeof h)a.fdfString+="("+a._getFormattedString(h)+")";else if(h instanceof Sr)a.fdfString+="/"+h.name;else if(h instanceof Array){h=h;var _=a._appendArray(h,a.fdfString,i,o,c,e);c=_.list,e=_.streamReference,i=_.index}else if("number"==typeof h)a.fdfString+=" "+h.toString();else if("boolean"==typeof h)a.fdfString+=" "+(h?"true":"false");else if(h instanceof Tr){a.fdfString+="<<",h=h;var d=a._getEntries(c,e,i,h,a.fdfString,s);c=d.list,e=d.streamReference,i=d.index,a.fdfString+=">>"}else if(h instanceof Pr){var p=r.get("Page");if("Parent"===t)a.fdfString+=" "+a._annotationID+" 0 R",a.fdfString+="/Page "+p;else if("IRT"===t){if(r.has("NM")){var l=r.get("NM");null!==l&&(a.fdfString+="("+a._getFormattedString(l)+")")}}else if("P"!==t){var u=h;null!==u&&void 0!==u&&(i++,a.fdfString+=" "+i+" 0 R",o&&e.push(i),c.set(i,r.get(t)))}}o=!1}}),h.list=c,h.streamReference=e,h.index=i,h},i.prototype._appendArray=function(t,e,i,r,n,s){this.fdfString=e,this.fdfString+="[";var a=new kn,o=n;if(null!==t&&t.length>0)for(var h=t.length,c=0;c<h;c++){var _=t[Number.parseInt(c.toString(),10)];0!==c&&("number"==typeof _||_ instanceof Pr||"boolean"==typeof _)&&(this.fdfString+=" ");var d=this._appendElement(_,this.fdfString,i,r,o,s);o=d.list,s=d.streamReference,i=d.index}return this.fdfString+="]",a.list=o,a.streamReference=s,a.index=i,a},i.prototype._appendElement=function(t,e,i,r,n,s){this.fdfString=e;var a=new kn,o=n;if("number"==typeof t)this.fdfString+=t.toString();else if(t instanceof Sr)this.fdfString+=t.name.toString();else if(t instanceof Array)t=t,o=(h=this._appendArray(t,this.fdfString,i,r,o,s)).list,s=h.streamReference,i=h.index;else if(t instanceof Tr){this.fdfString+="<<",t=t;var h=this._getEntries(o,s,i,t,this.fdfString,r);o=h.list,s=h.streamReference,i=h.index,this.fdfString+=">>"}return a.list=o,a.streamReference=s,a.index=i,a},i.prototype._getFormattedString=function(t){for(var e="",i=0;i<t.length;i++){var r=t.charCodeAt(i);40!==r&&41!==r||(e+="'"),e+=String.fromCharCode(r)}return e},i.prototype._checkFdf=function(t){if((t.includes(this._specialCharacters)||t.includes("âãÏÓ"))&&(this._asPerSpecification=!0),t.startsWith("%")&&"FDF-"!==t.substring(1,5))throw new Error("Invalid FDF file.")},i.prototype._stringToHexString=function(t){var e="";return null!==t&&void 0!==t&&t.length>0&&(e=S(u(t))),e},i}(qe),kn=function(){function t(){}return t}(),xn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Tn=function(){function t(t,e){this._bookMarkList=[],this._isExpanded=!1,this._isLoadedBookmark=!1,this._dictionary=t,this._crossReference=e}return Object.defineProperty(t.prototype,"count",{get:function(){return this._isLoadedBookmark&&0===this._bookMarkList.length&&this._reproduceTree(),this._bookMarkList.length},enumerable:!0,configurable:!0}),t.prototype.at=function(t){var e;if(t<0||t>=this.count)throw Error("Index out of range.");return this._bookMarkList.length>0&&t<this._bookMarkList.length&&(e=this._bookMarkList[Number.parseInt(t.toString(),10)]),e},t.prototype.contains=function(t){return-1!==this._bookMarkList.indexOf(t)},t.prototype._reproduceTree=function(){for(var t=this._getFirstBookmark(this),e=!!t;e&&t._dictionary;)this._bookMarkList.push(t),e=!!(t=t._next)},t.prototype._getFirstBookmark=function(t){var e,i=t._dictionary;if(i&&i.has("First")){var r=i.get("First");r&&(e=new In(r,this._crossReference))}return e},t}(),In=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(!r._dictionary.has("Dest")&&r._dictionary.has("A")){var n=r._dictionary.get("A");if(n&&n.has("D")){var s=n.getRaw("D");r._dictionary.update("Dest",s)}}return r._isLoadedBookmark=!0,r}return xn(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){var t,e=this._obtainNamedDestination();return null!==e&&void 0!==e||(t=Rt(this._dictionary,"Dest")),t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"namedDestination",{get:function(){return null!==this._namedDestination&&void 0!==this._namedDestination||(this._namedDestination=this._obtainNamedDestination()),this._namedDestination},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"title",{get:function(){return null!==this._title&&void 0!==this._title||(this._title=this._obtainTitle()),this._title},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return null!==this._color&&void 0!==this._color||this._dictionary.has("C")&&(this._color=L(this._dictionary.getArray("C"))),this._color?this._color:[0,0,0]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textStyle",{get:function(){return null!==this._textStyle&&void 0!==this._textStyle||(this._textStyle=this._obtainTextStyle()),this._textStyle},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isExpanded",{get:function(){return!!(this._dictionary.has("Count")&&this._dictionary.get("Count")>=0)||this._isExpanded},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_next",{get:function(){var t;if(this._dictionary.has("Next")){var e=this._dictionary.get("Next");e&&(t=new i(e,this._crossReference))}return t},enumerable:!0,configurable:!0}),i.prototype._obtainTextStyle=function(){var e=t.PdfTextStyle.regular;if(this._dictionary.has("F")){var i=this._dictionary.get("F"),r=0;void 0!==i&&null!==i&&(r=i),e|=r}return e},i.prototype._obtainTitle=function(){var t="";return this._dictionary.has("Title")&&(t=this._dictionary.get("Title")),t},i.prototype._obtainNamedDestination=function(){var t,e=this._crossReference._document;e&&(t=e._destinationCollection);var i,r;if(t){var n=this._dictionary;if(n.has("A")){var s=n.get("A");s.has("D")&&(i=s.get("D"))}else n.has("Dest")&&(i=n.get("Dest"));if(i){var a=void 0;if(i instanceof Sr?a=i.name:"string"==typeof i&&(a=i),a)for(var o=t._namedDestinations,h=0;h<o.length;h++)if((r=o[Number.parseInt(h.toString(),10)])._title===a){i=r;break}}}return r},i}(Tn),Nn=function(){function t(t,e){this._dictionary=t,this._crossReference=e}return Object.defineProperty(t.prototype,"destination",{get:function(){return this._destination},set:function(t){t&&(t._parent=this,this._destination=t,this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this._title},set:function(t){t!==this._title&&(this._title=t,this._dictionary.update("Title",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),t}(),Cn=function(){function e(t,e){if(this._namedDestinations=[],t&&(this._dictionary=t),e&&(this._crossReference=e),t&&t.has("Dests")){var i=t.get("Dests");if(i)if(i.has("Names"))this._addCollection(i);else if(i.has("Kids"))for(var r=i.getArray("Kids"),n=0;n<r.length;n++){var s=r[Number.parseInt(n.toString(),10)];this._addCollection(s)}}}return e.prototype._addCollection=function(e){var i,r,n=e.getRaw("Names");if(n instanceof Pr&&(i=this._crossReference._fetch(n)),i&&Array.isArray(i)&&i.length>0&&(n=i),n&&Array.isArray(n)&&n.length>0)for(var s=1;s<n.length;s+=2){var a=n[s];if(a instanceof Pr?(p=this._crossReference._fetch(a))&&Array.isArray(p)&&p.length>0?(r=new Tr).update("D",p):r=this._crossReference._fetch(a):null!==r&&void 0!==r||!Array.isArray(a)||(r=new Tr).update("D",a),r){var o=new Nn(r,this._crossReference),h=n[s-1],d=void 0,p=void 0;if(h&&(o._title=h,r.has("D"))){p=r.get("D"),d=new tr;var l=p[0];if(p&&p[0]instanceof Pr){var u=this._crossReference._fetch(l),f=this._crossReference._document,g=void 0;f&&u&&void 0!==(g=_(f,u))&&null!==g&&g>=0&&(d._index=g,d.page=f.getPage(g))}}if(p[1]instanceof Sr){var y=void 0,m=void 0,b=void 0,v=p[1].name,S=d.page;switch(v){case"Fit":d._destinationMode=t.PdfDestinationMode.fitToPage;break;case"XYZ":if(d._destinationMode=t.PdfDestinationMode.location,p.length>2&&(y=p[2]),p.length>3&&(m=p[3]),p.length>4&&(b=p[4]),S){var w=S.size,P=null===m||void 0===m?0:w[1]-m,A=null===y||void 0===y?0:y;d._location=[A,P],S.rotation!==t.PdfRotationAngle.angle0&&(P=c(S,m,y)),d._zoom=void 0!==b&&null!==b?b:0,null!==y&&null!==m&&null!==b&&void 0!==y&&void 0!==m&&void 0!==b||(d._isValid=!1)}break;case"FitH":case"FitBH":if(d._destinationMode=t.PdfDestinationMode.fitH,p.length>=3&&(m=p[2]),S){var w=S.size,P=null===m||void 0===m?0:w[1]-m;d._location=[0,P]}null!==m&&void 0!==m||(d._isValid=!1);break;case"FitR":d._destinationMode=t.PdfDestinationMode.fitR}}d._parent=o,o._destination=d,this._namedDestinations.push(o)}}},e}(),Rn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Fn=function(t){function e(e){var i=t.call(this)||this;return null!==e&&void 0!==e&&(i._fileName=e),i}return Rn(e,t),e.prototype._exportAnnotations=function(){throw new Error("Method not implemented.")},e.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._format="XML",this._key=G(),this._save()},e.prototype._save=function(){var t=new Ue;t._writeStartDocument(),this._asPerSpecification?(t._writeStartElement("fields"),t._writeAttributeString("xfdf","http://ns.adobe.com/xfdf-transition/","xmlns",null)):t._writeStartElement("Fields");var e=this._document.form;if(null!==e&&void 0!==e){this._exportEmptyFields=e.exportEmptyFields;for(var i=this._document.form.count,r=0;r<i;r++){var n=this._document.form.fieldAt(r);null!==n&&void 0!==n&&n.export&&this._exportFormFieldData(n)}this._writeFormFieldData(t,this._asPerSpecification)}var s=t._save();return t._destroy(),s},e.prototype._writeFormFieldData=function(t,e){void 0===e&&(e=!1),e?this._table.forEach(function(e,i){if(i.includes(" ")){var r=i.replace(/ /g,"");t._writeStartElement(r.toString()),t._writeAttributeString("original",i.toString(),"xfdf",null)}else t._writeStartElement(i.toString());t._writeString(e.toString()),t._writeEndElement()}):this._table.forEach(function(e,i){i.includes(" ")&&(i=i.replace(/ /g,"_x0020_")),t._writeStartElement(i.toString()),t._writeString(e.toString()),t._writeEndElement()}),t._writeEndElement()},e.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;var i=b(e);i=(i=i.replace(/(\r\n|\n|\r)/gm,"")).replace(/[^\x20-\x7E]/g,""),this._xmlDocument=(new DOMParser).parseFromString(i,"text/xml"),this._checkXml(this._xmlDocument),this._xmlImport=!0,this._parseFormData(this._xmlDocument.documentElement),this._xmlImport=!1},e.prototype._parseFormData=function(t){var e=t.childNodes;if(null!==e&&void 0!==e&&e.length>0)for(var i=0;i<e.length;i++){var r=e.item(i);if(null!==r&&void 0!==r&&1===r.nodeType){var n=r,s="";if(null!==n.attributes&&void 0!==n.attributes&&n.attributes.length>0){var a=n.attributes.item(0);null!==a&&void 0!==a&&"xfdf:original"===a.name&&(s=a.value)}else s=n.tagName;var o=n.textContent;null!==s&&void 0!==s&&s.length>0&&this._table.set(s,o)}}this._importField()},e.prototype._importField=function(){var t=this,e=this._document.form,i=e.count;i&&this._table.forEach(function(r,n){var s;t._table.size>0&&t._table.has(n)&&(s=t._table.get(n));var a=n.toString();-1!==a.indexOf("_x0020_")&&(a=a.replace(/_x0020_/g," "));var o=e._getFieldIndex(a);if(-1!==o&&o<i){var h=e.fieldAt(o);if(h&&null!==h&&void 0!==h){s&&""!==s&&h._dictionary.update("RV",s);var c=[];c.push(r),t._importFieldData(h,c)}}})},e.prototype._checkXml=function(t){if(t.getElementsByTagName("parsererror").length>0)throw new Error("Invalid XML file.")},e}(qe),Bn=function(){function t(){}return Object.defineProperty(t.prototype,"crossReferenceType",{get:function(){return this._crossReferenceType},set:function(t){this._crossReferenceType=t},enumerable:!0,configurable:!0}),t}(),Ln=function(){function e(e,i){if(this._headerSignature=new Uint8Array([37,80,68,70,45]),this._startXrefSignature=new Uint8Array([115,116,97,114,116,120,114,101,102]),this._endObjSignature=new Uint8Array([101,110,100,111,98,106]),this._version="",this._permissions=t.PdfPermissionFlag.default,this._isEncrypted=!1,this._isUserPassword=!1,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!1,this._isExport=!1,this._allowCustomData=!1,!e)throw new Error("PDF data cannot be undefined or null");this._stream=new Rr("string"==typeof e?k(e):e),this._fileStructure=new Bn,this._crossReference=new mn(this,i),this._pages=new Map,this._checkHeader(),this._crossReference._setStartXRef(this._startXRef);try{this._parse(!1)}catch(t){if("XRefParseException"!==t.name)throw t;this._parse(!0)}this._crossReference._version=this._version}return Object.defineProperty(e.prototype,"_allowImportCustomData",{get:function(){return this._allowCustomData},set:function(t){this._allowCustomData=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_linearization",{get:function(){if(!this._linear){var t=void 0;try{t=new tn(this._stream)}catch(t){}this._linear=t}return this._linear},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startXRef",{get:function(){var t=this._stream,e=0;if(this._linearization&&this._linearization.isValid)t.reset(),this._find(t,this._endObjSignature)&&(e=t.position+6-t.start);else{for(var i=this._startXrefSignature.length,r=!1,n=t.end;!r&&n>0;)(n-=1024-i)<0&&(n=0),t.position=n,r=this._find(t,this._startXrefSignature,1024,!0);if(r){t.skip(9);var s=void 0;do{s=t.getByte()}while(A(s));for(var a="";s>=32&&s<=57;)a+=String.fromCharCode(s),s=t.getByte();e=parseInt(a,10),isNaN(e)&&(e=0)}}return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEncrypted",{get:function(){return this._isEncrypted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUserPassword",{get:function(){return this._isUserPassword},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageCount",{get:function(){return void 0===this._pageCount&&(this._pageCount=0,this._linearization&&this._linearization.isValid?this._pageCount=this._linearization.pageCount:this._pageCount=this._catalog.pageCount),this._pageCount},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return void 0===this._form&&(this._form=new wn(this._catalog.acroForm,this._crossReference)),this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"permissions",{get:function(){if(this._crossReference){var t=this._crossReference._permissionFlags;void 0!==t&&(this._permissions=3903&t)}return this._permissions},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bookmarks",{get:function(){var t=this._catalog;if(t&&t._catalogDictionary.has("Outlines")){var e=t._catalogDictionary.get("Outlines");e&&(this._bookmarkBase=new Tn(e,this._crossReference),e.has("First")&&this._bookmarkBase._reproduceTree())}return this._bookmarkBase},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fileStructure",{get:function(){return this._fileStructure},enumerable:!0,configurable:!0}),e.prototype.getPage=function(t){if(t<0||t>=this.pageCount)throw new Error("Invalid page index");var e=this._pages.get(t);if(e)return e;var i,r=this,n=r._catalog,s=r._linearization;i=s&&s.isValid&&s.pageFirst===t?this._getLinearizationPage(t):n.getPageDictionary(t);var a=new $i(this._crossReference,t,i.dictionary,i.reference);return this._pages.set(t,a),a},e.prototype.addPage=function(t,e){var i,r;void 0!==e?(i=e,r=t,this._checkPageNumber(r)):void 0===t?(i=new On,r=this.pageCount):t instanceof On?(i=t,r=this.pageCount):(i=new On,r=t,this._checkPageNumber(r));var n=new Tr(this._crossReference);n.update("Type",Sr.get("Pages")),n.update("Count",1),this._updatePageSettings(n,i);var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),n.objId=s.toString();var a=new Tr(this._crossReference);a.update("Type",Sr.get("Page"));var o=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(o,a),a.objId=o.toString(),a.update("Parent",s),n.update("Kids",[o]),0===this.pageCount)(c=this._catalog._catalogDictionary._get("Pages"))&&this._catalog._topPagesDictionary?(this._catalog._topPagesDictionary.update("Kids",[s]),n.update("Parent",c)):this._catalog._catalogDictionary.update("Pages",s),this._pages=new Map,this._pageCount=1;else{var h=this.getPage(r===this.pageCount?r-1:r);if(h&&h._pageDictionary){var c=h._pageDictionary._get("Parent"),_=this._crossReference._fetch(c);if(_&&_.has("Kids")){var d=_.get("Kids");if(d){if(r===this.pageCount)d.push(s);else{var p=[];d.forEach(function(t){t===h._ref&&p.push(s),p.push(t)}),d=p,this._updatePageCache(r)}_.update("Kids",d),n.update("Parent",c),this._updatePageCount(_,1),this._pageCount=this.pageCount+1}}}}var l=new $i(this._crossReference,r,a,o);return l._pageSettings=i,l._isNew=!0,this._pages.set(r,l),l},e.prototype.removePage=function(t){var e=t instanceof $i?t:this.getPage(t);this._removePage(e)},e.prototype._checkPageNumber=function(t){if(t<0||t>this.pageCount)throw new Error("Index out of range")},e.prototype._updatePageCount=function(t,e){if(t.update("Count",t.get("Count")+e),t.has("Parent")){var i=t.get("Parent");i&&"Pages"===i.get("Type").name&&this._updatePageCount(i,e)}},e.prototype._updatePageSettings=function(t,e){var i=[0,0,e.size[0],e.size[1]];t.update("MediaBox",i),t.update("CropBox",i);var r=90*Math.floor(e.rotation);r>=360&&(r%=360),t.update("Rotate",r)},e.prototype._updatePageCache=function(t,e){void 0===e&&(e=!0);for(var i=new Map,r=this.pageCount-1;r>=0;r--){var n=this.getPage(r);e?r>=t?(i.set(r+1,n),n._pageIndex=r+1):i.set(r,n):r>t?(i.set(r-1,n),n._pageIndex=r-1):r!==t&&i.set(r,n)}this._pages=i,e||(this._pageCount=this._pages.size)},e.prototype._removePage=function(t){var e=this._parseBookmarkDestination();if(e&&e.has(t)){var i=e.get(t);if(i)for(s=0;s<i.length;s++){var r=i[Number.parseInt(s.toString(),10)];if(r){var n=r._dictionary;n&&(n.has("A")&&n.update("A",null),n.update("Dest",null))}}}this._removePageTemplates(t);for(var s=this.form.count-1;s>=0;--s){var a=this.form.fieldAt(s);a&&a.page===t&&this.form.removeFieldAt(s)}this._updatePageCache(t._pageIndex,!1),this._removeParent(t._ref,t._pageDictionary),this._crossReference._cacheMap.has(t._ref)&&(t._pageDictionary._updated=!1)},e.prototype._removeParent=function(t,e){if(e.has("Parent")){var i=e._get("Parent"),r=this._crossReference._fetch(i);if(r&&r.has("Kids")){var n=r.get("Kids");1===n.length&&r&&"Pages"===r.get("Type").name?this._removeParent(i,r):(n=n.filter(function(e){return e!==t}),r.update("Kids",n),this._updatePageCount(r,-1))}}},e.prototype._parseBookmarkDestination=function(){var t=this.bookmarks;if(void 0===this._bookmarkHashTable&&t){this._bookmarkHashTable=new Map;var e=[],i={index:0,kids:t._bookMarkList};do{for(;i.index<i.kids.length;){var r=(t=i.kids[i.index]).namedDestination;if(r){if(r.destination){s=r.destination.page;(a=this._bookmarkHashTable.get(s))||(a=[]),a.push(t),this._bookmarkHashTable.set(s,a)}}else{var n=t.destination;if(n){var s=n.page,a=this._bookmarkHashTable.get(s);a||(a=[]),a.push(t),this._bookmarkHashTable.set(s,a)}}i.index+=1,t.count>0&&(e.push(i),i={index:0,kids:t._bookMarkList})}if(e.length>0)for(i=e.pop();i.index===i.kids.length&&e.length>0;)i=e.pop()}while(i.index<i.kids.length)}return this._bookmarkHashTable},e.prototype._removePageTemplates=function(t){var e;this._catalog._catalogDictionary.has("Names")&&(e=this._catalog._catalogDictionary.get("Names"))&&(this._removeInternalTemplates(e,"Pages",t),this._removeInternalTemplates(e,"Templates",t))},e.prototype._removeInternalTemplates=function(t,e,i){if(t.has(e)){var r=t.get(e);if(r&&r.has("Names")){var n=r.getArray("Names");if(n&&n.length>0){var s=this._getUpdatedPageTemplates(n,i),a=new Tr(this._crossReference);a.update("Names",s);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),a.objId=o.toString(),t.update(e,o)}}}},e.prototype._getUpdatedPageTemplates=function(t,e){if(t.length>0)for(var i=1;i<=t.length;i+=2){var r=t[Number.parseInt(i.toString(),10)];if(r&&e._pageDictionary===r)return t.pop(),t.pop(),t}return t},e.prototype.reorderPages=function(t){var e=this;t.forEach(function(t){e._checkPageNumber(t)});for(var i=this._sortedArray(t),r=t.slice().sort(function(t,e){return t-e}),n=Array.from({length:this.pageCount},function(t,e){return e}).filter(function(t){return-1===i.indexOf(t)}),s=n.length-1;s>=0;s--)this.removePage(n[Number.parseInt(s.toString(),10)]);for(var a=[],o=new Map,h=this._catalog._catalogDictionary._get("Pages"),c=this,s=0;s<i.length;s++)!function(t){var n=c.getPage(r.indexOf(i[Number.parseInt(t.toString(),10)]));n._pageIndex=t,o.set(t,n);var s=new Tr(c._crossReference);s.update("Type",Sr.get("Pages")),s.update("Count",1),s.update("Parent",h);var _=c._crossReference._getNextReference();s.objId=_.toString(),s.update("Kids",[n._ref]),a.push(_);for(var d=n._pageDictionary.get("Parent");d&&"Pages"===d.get("Type").name&&(d.forEach(function(t,i){switch(t){case"Parent":case"Kids":case"Type":case"Count":break;case"Resources":e._cloneResources(d.get("Resources"),s);break;default:s.has(t)||s.update(t,i)}}),d.has("Parent"));)d=d.get("Parent");c._crossReference._cacheMap.set(_,s),c._crossReference._fetch(n._ref).update("Parent",_)}(s);if(this._pages=o,this._catalog){var _=this._catalog._topPagesDictionary;if(_&&_.has("Kids")){var d=_.get("Kids");d=a,_.update("Kids",d)}}},e.prototype._sortedArray=function(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),e},e.prototype._cloneResources=function(t,e){var i=this;if(e.has("Resources")){var r=e.get("Resources");t.forEach(function(t,e){r.has(t)?i._cloneInnerResources(t,e,r):r.update(t,e)})}else e.update("Resources",t)},e.prototype._cloneInnerResources=function(t,e,i){if(e instanceof Tr){var r=i.get(t);if(r){var n=!1;r.forEach(function(t,e){r.has(t)||(r.update(t,e),n=!0)}),n&&(i._updated=!0)}else i.update(t,e)}else if(Array.isArray(e)){var s=i.get(t);if(s){var a=!1;e.forEach(function(t){-1===s.indexOf(t)&&(s.push(t),a=!0)}),a&&(i._updated=!0)}else i.update(t,e)}},e.prototype.save=function(t){if(this._doPostProcess(this._flatten),"string"!=typeof t)return this._crossReference._save();i.Save.save(t,new Blob([this._crossReference._save()],{type:"application/pdf"}))},e.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e){e({blobData:new Blob([t._crossReference._save()],{type:"application/pdf"})})})},e.prototype.exportAnnotations=function(e,r){this._isExport=!0,this._doPostProcessOnAnnotations();var n,s;if(e&&e instanceof Mn?s=e:r&&r instanceof Mn&&(s=r),s){if(s.dataFormat===t.DataFormat.xfdf)n=new Xe;else if(s.dataFormat===t.DataFormat.json)n=new Ye;else{if(s.dataFormat!==t.DataFormat.fdf)return;n=new An}n.exportAppearance=s.exportAppearance}else n=new Xe;var a=n._exportAnnotations(this);if(!e||"string"!=typeof e)return a;i.Save.save(e,new Blob([a],{type:"text/plain"}))},e.prototype.exportFormData=function(e,r){this._doPostProcessOnFormFields();var n,s;if(e&&e instanceof Dn?s=e:r&&r instanceof Dn&&(s=r),s){if(s.dataFormat===t.DataFormat.xfdf)n=new Xe(s.exportName);else if(s.dataFormat===t.DataFormat.json)n=new Ye(s.exportName);else if(s.dataFormat===t.DataFormat.fdf)n=new An(s.exportName);else{if(s.dataFormat!==t.DataFormat.xml)return;n=new Fn(s.exportName)}n._asPerSpecification=s.asPerSpecification}else(n=new Xe)._asPerSpecification=!1;if(!e||"string"!=typeof e)return n._exportFormFields(this);i.Save.save(e,new Blob([n._exportFormFields(this)],{type:"text/plain"}))},e.prototype.importAnnotations=function(e,i){i===t.DataFormat.xfdf?(new Xe)._importAnnotations(this,"string"==typeof e?k(e):e):i===t.DataFormat.json?(new Ye)._importAnnotations(this,"string"==typeof e?k(e):e):i===t.DataFormat.fdf&&(new An)._importAnnotations(this,"string"==typeof e?k(e):e)},e.prototype.importFormData=function(e,i){this.form.count>0&&(i===t.DataFormat.xfdf?(new Xe)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.json?(new Ye)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.fdf?(new An)._importFormData(this,"string"==typeof e?k(e):e):i===t.DataFormat.xml&&(new Fn)._importFormData(this,"string"==typeof e?k(e):e))},e.prototype.destroy=function(){this._crossReference&&(this._crossReference._destroy(),this._crossReference=void 0),this._catalog&&(this._catalog._destroy(),this._catalog=void 0),this._endObjSignature=void 0,this._headerSignature=void 0,this._pages&&this._pages.size>0&&this._pages.forEach(function(t){t._destroy()}),this._pages.clear(),this._pages=void 0,this._startXrefSignature=void 0,this._stream=void 0,this._form=void 0,Mt()},Object.defineProperty(e.prototype,"_destinationCollection",{get:function(){if(null===this._namedDestinationCollection||void 0===this._namedDestinationCollection)if(this._catalog._catalogDictionary.has("Names")){var t=this._catalog._catalogDictionary.get("Names");this._namedDestinationCollection=new Cn(t,this._crossReference)}else this._namedDestinationCollection=new Cn;return this._namedDestinationCollection},enumerable:!0,configurable:!0}),e.prototype._getLinearizationPage=function(t){var e=this,i=e._catalog,r=e._linearization,n=e._crossReference,s=Pr.get(r.objectNumberFirst,0);try{var a=n._fetch(s);if(a instanceof Tr&&(Dt(a.get("Type"),"Page")||!a.has("Type")&&!a.has("Kids")))return i.pageKidsCountCache.has(s)||i.pageKidsCountCache.put(s,1),i.pageIndexCache.has(s)||i.pageIndexCache.put(s,0),{dictionary:a,reference:s};throw new gr("The Linearization dictionary does not point to a valid Page dictionary.")}catch(e){return i.getPageDictionary(t)}},e.prototype._checkHeader=function(){var t=this._stream;if(t.reset(),this._find(t,this._headerSignature)){t.moveStart();for(var e="",i=t.getByte();i>32&&!(e.length>=12);)e+=String.fromCharCode(i),i=t.getByte();this._version||(this._version=e.substring(5))}},e.prototype._parse=function(t){this._crossReference._parse(t),this._catalog=new Xr(this._crossReference),this._catalog.version&&(this._version=this._catalog.version)},e.prototype._find=function(t,e,i,r){void 0===i&&(i=1024),void 0===r&&(r=!1);var n=e.length,s=t.peekBytes(i),a=s.length-n;if(a<=0)return!1;if(r)for(var o=n-1,h=s.length-1;h>=o;){for(c=0;c<n&&s[h-c]===e[o-c];)c++;if(c>=n)return t.position+=h-o,!0;h--}else for(h=0;h<=a;){for(var c=0;c<n&&s[h+c]===e[c];)c++;if(c>=n)return t.position+=h,!0;h++}return!1},e.prototype._doPostProcess=function(t){void 0===t&&(t=!1),this._doPostProcessOnFormFields(t),this._doPostProcessOnAnnotations(t)},e.prototype._doPostProcessOnFormFields=function(t){if(void 0===t&&(t=!1),this._catalog._catalogDictionary.has("AcroForm")&&(this.form._doPostProcess(t),t)){var e=this._catalog._catalogDictionary.getRaw("AcroForm"),i=new Tr(this._crossReference);i._updated=!0,e instanceof Pr?this._crossReference._cacheMap.set(e,i):(this.form._dictionary=i,this._crossReference._allowCatalog=!0),this.form._clear()}},e.prototype._doPostProcessOnAnnotations=function(t){void 0===t&&(t=!1);for(var e=0;e<this.pageCount;e++){var i=this.getPage(e);i.annotations._isExport=this._isExport,i.annotations._doPostProcess(t),t&&(i._pageDictionary.has("Annots")&&(delete i._pageDictionary._map.Annots,i._pageDictionary._updated=!0),i.annotations._clear())}},e.prototype._addWatermarkText=function(){if(this.pageCount>0)for(var e=0;e<this._pageCount;e++){var i=this.getPage(e);if(i)try{var r=i.graphics;r.save(),r.setTransparency(.2),r.drawRectangle(0,0,i.size[0],33.75,new Ve([255,255,255])),r.restore(),r.save(),r.setTransparency(.5);var n=new ke(t.PdfFontFamily.helvetica,12,t.PdfFontStyle.regular),s=new Vt(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle);r.drawString("Created with a trial version of Syncfusion Essential PDF",n,[0,0,i.size[0],33.75],null,new Ve([0,0,0]),s),r.restore()}catch(t){}}},e}(),Mn=function(){function e(){this._format=t.DataFormat.xfdf,this._exportAppearance=!1}return Object.defineProperty(e.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportAppearance",{get:function(){return this._exportAppearance},set:function(t){this._exportAppearance=t},enumerable:!0,configurable:!0}),e}(),Dn=function(){function e(){this._format=t.DataFormat.xfdf,this._exportName="",this._asPerSpecification=!0}return Object.defineProperty(e.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exportName",{get:function(){return this._exportName},set:function(t){this._exportName=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"asPerSpecification",{get:function(){return this._asPerSpecification},set:function(t){this._asPerSpecification=t},enumerable:!0,configurable:!0}),e}(),On=function(){function e(){this._size=[595,842],this._isOrientation=!1,this._orientation=t.PdfPageOrientation.portrait,this._size=[595,842],this._margins=new En,this._rotation=t.PdfRotationAngle.angle0}return Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._isOrientation=!0,this._orientation!==t&&(this._orientation=t,this._updateSize(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(t){this._isOrientation?this._updateSize(t):(this._size=t,this._updateOrientation())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"margins",{get:function(){return this._margins},set:function(t){this._margins=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t,t>=4&&(this._rotation=t%4)},enumerable:!0,configurable:!0}),e.prototype._updateSize=function(e){var i,r;Array.isArray(e)?(i=this.orientation,r=e):(i=e,r=this._size),i===t.PdfPageOrientation.portrait?this._size=[Math.min(r[0],r[1]),Math.max(r[0],r[1])]:this._size=[Math.max(r[0],r[1]),Math.min(r[0],r[1])]},e.prototype._updateOrientation=function(){this._orientation=this._size[1]>=this._size[0]?t.PdfPageOrientation.portrait:t.PdfPageOrientation.landscape},e.prototype._getActualSize=function(){return[this._size[0]-(this._margins._left+this._margins._right),this._size[1]-(this._margins._top+this._margins._bottom)]},e}(),En=function(){function t(t){this._left=this._right=this._top=this._bottom=void 0===t?40:t}return Object.defineProperty(t.prototype,"left",{get:function(){return this._left},set:function(t){this._left=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this._right},set:function(t){this._right=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top},set:function(t){this._top=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this._bottom},set:function(t){this._bottom=t},enumerable:!0,configurable:!0}),t}(),Vn=function(){function t(t,e,i,r){this._left=0,this._right=0,this._top=0,this._bottom=0,void 0===t?(this._left=.5,this._right=.5,this._top=.5,this._bottom=.5):(this._left=t,this._right=i,this._top=e,this._bottom=r)}return t}(),jn=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),zn=function(e){function i(t){var i=e.call(this)||this;return i._imageStatus=!0,i._initializeAsync(t),i}return jn(i,e),i.prototype._initializeAsync=function(t){var e=new Uint8Array(t.length);null!==t&&void 0!==t&&"string"==typeof t?e=k(t,!1):t instanceof Uint8Array&&(e=t),this._decoder=h(e),this.height=this._decoder._height,this.width=this._decoder._width,this._bitsPerComponent=this._decoder._bitsPerComponent},i.prototype._save=function(){if(this._imageStatus=!0,this._imageStream=this._decoder._getImageDictionary(),this._decoder&&this._decoder instanceof dr){var t=this._decoder;this._maskStream=t._maskStream,t._isDecode?t._colorSpace&&this._setColorSpace():this._setColorSpace()}else this._setColorSpace()},i.prototype._setColorSpace=function(){var e,i=this._imageStream.dictionary,r=i.get("ColorSpace");if("DeviceCMYK"===r.name?e=t._PdfColorSpace.cmyk:"DeviceGray"===r.name&&(e=t._PdfColorSpace.grayScale),this._decoder instanceof dr){var n=this._decoder._colorSpace;void 0!==n&&null!==n&&(e=t._PdfColorSpace.indexed)}switch(e){case t._PdfColorSpace.cmyk:i.update("Decode",[1,0,1,0,1,0,1,0]),i.update("ColorSpace",Sr.get("DeviceCMYK"));break;case t._PdfColorSpace.grayScale:i.update("Decode",[0,1]),i.update("ColorSpace",Sr.get("DeviceGray"));break;case t._PdfColorSpace.rgb:i.update("Decode",[0,1,0,1,0,1]),i.update("ColorSpace",Sr.get("DeviceRGB"));break;case t._PdfColorSpace.indexed:i.update("ColorSpace",this._decoder._colorSpace)}},i}(Be);return t._PdfBaseStream=Cr,t._PdfStream=Rr,t._PdfContentStream=Fr,t._PdfNullStream=Br,t._ContentParser=Lr,t._ContentLexer=Mr,t._PdfRecord=Dr,t._PdfDecodeStream=Er,t._PdfDecryptStream=jr,t._PdfFlateStream=qr,t._PdfCatalog=Xr,t._PdfCrossReference=mn,t.PdfDocument=Ln,t.PdfAnnotationExportSettings=Mn,t.PdfFormFieldExportSettings=Dn,t.PdfPageSettings=On,t.PdfMargins=En,t.PdfFileStructure=Bn,t.PdfPage=$i,t.PdfDestination=tr,t.PdfBookmarkBase=Tn,t.PdfBookmark=In,t.PdfNamedDestination=Nn,t._PdfNamedDestinationCollection=Cn,t._PdfLexicalOperator=Zr,t._PdfParser=$r,t._Linearization=tn,t._PdfName=Sr,t._PdfCommand=wr,t._PdfReference=Pr,t._PdfReferenceSet=Ar,t._PdfReferenceSetCache=kr,t.Dictionary=xr,t._PdfDictionary=Tr,t._PdfNull=Ir,t._clearPrimitiveCaches=Mt,t._isName=Dt,t._isCommand=Ot,t.PdfPredictorStream=Qr,t._toUnsigned=r,t._toSigned16=n,t._toSigned32=s,t._copyRange=a,t._checkType=o,t._getDecoder=h,t._checkRotation=c,t._getPageIndex=_,t._annotationFlagsToString=d,t._stringToAnnotationFlags=p,t._stringToPdfString=l,t._stringToBytes=u,t._convertStringToBytes=f,t._areArrayEqual=g,t._numberToString=y,t._areNotEqual=m,t._bytesToString=b,t._stringToUnicodeArray=v,t._byteArrayToHexString=S,t._hexStringToByteArray=w,t._hexStringToString=P,t._isWhiteSpace=A,t._decode=k,t._encode=x,t._getInheritableProperty=T,t._parseRectangle=I,t._calculateBounds=N,t._toRectangle=C,t._fromRectangle=R,t._getUpdatedBounds=F,t._convertToColor=B,t._parseColor=L,t._mapBorderStyle=M,t._mapBorderEffectStyle=D,t._reverseMapEndingStyle=O,t._mapLineEndingStyle=E,t._mapHighlightMode=V,t._reverseMapHighlightMode=j,t._reverseMapBlendMode=z,t._mapBlendMode=U,t._floatToString=W,t._addProcSet=H,t._getNewGuidString=G,t._escapePdfName=K,t._getBezierArc=q,t._findPage=X,t._checkField=J,t._getItemValue=Q,t._getStateTemplate=Y,t._getColorValue=Z,t._setMatrix=$,t._styleToString=tt,t._stringToStyle=et,t._mapMeasurementUnit=it,t._mapMarkupAnnotationType=rt,t._reverseMarkupAnnotationType=nt,t._mapGraphicsUnit=st,t._mapRubberStampIcon=at,t._mapPopupIcon=ot,t._reverseMapAnnotationState=ht,t._mapAnnotationState=ct,t._reverseMapAnnotationStateModel=_t,t._mapAnnotationStateModel=dt,t._mapAttachmentIcon=pt,t._mapAnnotationIntent=lt,t._reverseMapPdfFontStyle=ut,t._getSpecialCharacter=ft,t._getLatinCharacter=gt,t._encodeValue=yt,t._getCommentsOrReview=mt,t._checkReview=bt,t._checkComment=vt,t._updateVisibility=St,t._removeDuplicateReference=wt,t._removeDuplicateFromResources=Pt,t._removeReferences=At,t.BaseException=fr,t.FormatError=gr,t.ParserEndOfFileException=yr,t._defaultToString=kt,t._obtainFontDetails=xt,t._getFontStyle=Tt,t._mapFont=It,t._tryParseFontStream=Nt,t._checkInkPoints=Ct,t._obtainDestination=Rt,t._updateBounds=Ft,t._decodeText=Bt,t._getSize=Lt,t.PdfAnnotationCollection=Yi,t.PdfPopupAnnotationCollection=Zi,t.PdfAnnotation=fi,t.PdfComment=gi,t.PdfLineAnnotation=yi,t.PdfCircleAnnotation=mi,t.PdfEllipseAnnotation=bi,t.PdfSquareAnnotation=vi,t.PdfRectangleAnnotation=Si,t.PdfPolygonAnnotation=wi,t.PdfPolyLineAnnotation=Pi,t.PdfAngleMeasurementAnnotation=Ai,t.PdfInkAnnotation=ki,t.PdfPopupAnnotation=xi,t.PdfFileLinkAnnotation=Ti,t.PdfUriAnnotation=Ii,t.PdfDocumentLinkAnnotation=Ni,t.PdfTextWebLinkAnnotation=Ci,t.PdfAttachmentAnnotation=Ri,t.Pdf3DAnnotation=Fi,t.PdfTextMarkupAnnotation=Bi,t.PdfWatermarkAnnotation=Li,t.PdfRubberStampAnnotation=Mi,t.PdfSoundAnnotation=Di,t.PdfFreeTextAnnotation=Oi,t.PdfRedactionAnnotation=Ei,t.PdfRichMediaAnnotation=Vi,t.PdfWidgetAnnotation=ji,t.PdfStateItem=zi,t.PdfRadioButtonListItem=Ui,t.PdfListFieldItem=Wi,t.PdfAnnotationCaption=Hi,t.PdfAnnotationLineEndingStyle=Gi,t.PdfInteractiveBorder=Ki,t.PdfAnnotationBorder=qi,t.PdfBorderEffect=Xi,t._PaintParameter=Ji,t.PdfAppearance=li,t._PdfPaddings=Vn,t._DecompressedOutput=sr,t._DeflateStream=cr,t._Inflater=hr,t._HuffmanTree=or,t._InBuffer=ar,t._PdfFontMetrics=zt,t._WidthTable=Ut,t._StandardWidthTable=Wt,t._CjkWidthTable=Ht,t._CjkWidth=Gt,t._CjkSameWidth=Kt,t._CjkDifferentWidth=qt,t.PdfFont=Ae,t.PdfStandardFont=ke,t.PdfCjkStandardFont=xe,t.PdfTrueTypeFont=Te,t._PdfStandardFontMetricsFactory=Ie,t._PdfCjkStandardFontMetricsFactory=Ne,t._PdfCjkFontDescriptorFactory=Ce,t._UnicodeLine=Re,t.PdfStringFormat=Vt,t._PdfStringLayouter=Xt,t._PdfStringLayoutResult=Jt,t._LineInfo=Qt,t._StringTokenizer=Yt,t._TrueTypeReader=ce,t._TrueTypeNameRecord=_e,t._TrueTypeMetrics=de,t._TrueTypeLongHorMetric=pe,t._TrueTypeGlyph=le,t._TrueTypeLocaTable=ue,t._TrueTypeGlyphHeader=fe,t._BigEndianWriter=ge,t._TrueTypeTableInfo=Zt,t._TrueTypeOS2Table=$t,t._TrueTypePostTable=te,t._TrueTypeNameTable=ee,t._TrueTypeMicrosoftCmapSubTable=ie,t._TrueTypeHorizontalHeaderTable=re,t._TrueTypeHeadTable=ne,t._TrueTypeCmapTable=se,t._TrueTypeCmapSubTable=ae,t._TrueTypeAppleCmapSubTable=oe,t._TrueTypeTrimmedCmapSubTable=he,t._UnicodeTrueTypeFont=ye,t.PdfField=ri,t.PdfTextBoxField=ni,t.PdfButtonField=si,t.PdfCheckBoxField=ai,t.PdfRadioButtonListField=oi,t.PdfListField=hi,t.PdfComboBoxField=ci,t.PdfListBoxField=_i,t.PdfSignatureField=di,t._PdfDefaultAppearance=pi,t.PdfForm=wn,t.PdfGraphics=Le,t._PdfTransformationMatrix=Me,t._Matrix=De,t.PdfGraphicsState=Oe,t.PdfBrush=Ve,t.PdfPen=je,t._PdfUnitConvertor=ze,t._PdfPath=Fe,t._PdfStreamWriter=Et,t.PdfTemplate=Ze,t._Bidirectional=ve,t._RtlCharacters=Se,t._ArabicShapeRenderer=me,t._ArabicShape=be,t._RtlRenderer=we,t._ImageDecoder=er,t.PdfBitmap=zn,t.PdfImage=Be,t._PngDecoder=dr,t._JpegDecoder=rr,t._PdfEncryptor=rn,t._MD5=nn,t._Sha256=sn,t._Sha512=an,t._Word64=on,t._EncryptionKey=hn,t._BasicEncryption=cn,t._AdvancedEncryption=_n,t._Cipher=dn,t._NormalCipherFour=pn,t._AdvancedEncryptionBaseCipher=ln,t._AdvancedEncryption128Cipher=un,t._AdvancedEncryption256Cipher=fn,t._NullCipher=gn,t._CipherTransform=yn,t._ExportHelper=qe,t._XfdfDocument=Xe,t._FontStructure=Je,t._XmlWriter=Ue,t._Namespace=We,t._XmlElement=He,t._XmlAttribute=Ge,t._FdfDocument=An,t._FdfHelper=kn,t._JsonDocument=Ye,t._XmlDocument=Fn,t}({},ej.compression,ej.fileutils),this.ejs=ej;
11
11
  //# sourceMappingURL=ej2-pdf.min.js.map