@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
12 lines • 1.39 MB
JavaScript
/*!
* filename: ej2-pdf.min.js
* version : 34.2.4
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
this.ej=this.ej||{},this.ej.pdf=function(t,e,i,r){"use strict";function n(t,e){return t&Math.pow(2,e)-1}function s(t){return t<<16>>16}function a(t,e,i,r,n){void 0===r&&(r=0),void 0===n&&(n=i.length),r=Math.max(0,Math.min(i.length,r));var s=(n=Math.max(0,Math.min(i.length,n)))-r;t.length=Math.max(t.length,e+s);for(var a=0;a<s;a++)t[e+a]=i[r+a]}function o(t,e){return e.every(function(e,i){return e===t[i]})}function h(t){var e;if(o(t,[255,216]))e=new is(t);else{if(!o(t,[137,80,78,71,13,10,26,10]))throw new Error("Unsupported image format");e=new _s(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.width-r}return n}function _(t,e){var i=-1;if(e&&e instanceof Ts)for(var r=0;r<t.pageCount;r++){var n=t.getPage(r);if(n&&n._pageDictionary&&(n._pageDictionary===e||n._pageDictionary.objId===e.objId)){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 u(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("string"==typeof t&&t.length>0&&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(f(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 f(t,e,i,r){if(void 0===e&&(e=!1),void 0===i&&(i=!1),i){var n=t.length;if(r){for(a=0;a<n;a++)r.push(t.charCodeAt(a));return r}for(var s=new Uint8Array(n),a=0;a<n;a++)s[a]=t.charCodeAt(a);return e?Array.from(s):s}for(var o=0,a=0;a<t.length;a++)(_=t.charCodeAt(a))<128?o+=1:_<2048?o+=2:_<55296||_>=57344?o+=3:(a++,o+=4);for(var h=new Uint8Array(o),c=0,a=0;a<t.length;a++){var _=t.charCodeAt(a);_<128?h[c++]=_:_<2048?(h[c++]=_>>6|192,h[c++]=63&_|128):_<55296||_>=57344?(h[c++]=_>>12|224,h[c++]=_>>6&63|128,h[c++]=63&_|128):(a++,_=65536+((1023&_)<<10|1023&t.charCodeAt(a)),h[c++]=_>>18|240,h[c++]=_>>12&63|128,h[c++]=_>>6&63|128,h[c++]=63&_|128)}if(r){for(a=0;a<h.length;a++)r.push(h[a]);return r}return e?Array.from(h):h}function p(t,e){return t.length===e.length&&t.every(function(t,i){return t===e[i]})}function g(t,e){return t.length===e.length&&t.every(function(t,i){return t.x===e[i].x&&t.y===e[i].y})}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,e){if(t.length!==e.length)return!0;for(var i=0;i<t.length;i++)if(t[i].x!==e[i].x||t[i].y!==e[i].y)return!0;return!1}function v(t,e){if(void 0===e&&(e=!1),!t||0===t.length)return"";if(e)return S(t);for(var i="",r=0;r<t.length;r+=8192){var n=r+8192<t.length?r+8192:t.length;i+=String.fromCharCode.apply(null,t.subarray(r,n))}return i}function w(t){if(!t||0===t.length)return t;return t.replace(/_[Xx]([0-9A-Fa-f]{4}|[0-9A-Fa-f]{8})_/g,function(t,e){var i=parseInt(e,16);if(isNaN(i))return t;if(i<=65535)return String.fromCharCode(i);var r=i-65536,n=55296+(r>>10),s=56320+(1023&r);return String.fromCharCode(n,s)})}function S(t){var e=t.length;if(0===e)return"";for(var i="",r=new Uint16Array(4096),n=0,s=0;n<e;){var a=t[n++];if(a<128)r[s++]=a;else if(a<224)r[s++]=(31&a)<<6|63&t[n++];else if(a<240)r[s++]=(15&a)<<12|(63&t[n++])<<6|63&t[n++];else{var o=(7&a)<<18|(63&t[n++])<<12|(63&t[n++])<<6|(63&t[n++])-65536;r[s++]=55296+(o>>10),r[s++]=56320+(1023&o)}s>=4094&&(i+=String.fromCharCode.apply(null,r.subarray(0,s)),s=0)}return s>0&&(i+=String.fromCharCode.apply(null,r.subarray(0,s))),i}function x(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 P(t){for(var e=new Array(256),i=0;i<256;i++){var r=i.toString(16).toUpperCase();e[i]=1===r.length?"0"+r:r}var n=t.length;if(0===n)return"";for(var s=new Array(n),i=0;i<n;i++)s[i]=e[t[i]];return s.join("")}function A(t,e){void 0===e&&(e=!1);for(var i=new Int16Array(256).fill(-1),r=0;r<10;r++)i[48+r]=r;for(r=0;r<6;r++)i[65+r]=10+r,i[97+r]=10+r;if(!t)return e?[]:new Uint8Array(0);for(var n=t.length>>1,s=new Uint8Array(n),a=0,r=0;r<n;r++){var o=i[t.charCodeAt(a++)],h=i[t.charCodeAt(a++)];s[r]=o<<4|h}return e?Array.from(s):s}function T(t){var e="";if(t&&"#"===t[0]){t=t.substring(1);for(var i=0;i<t.length;i+=2)e+=String.fromCharCode(parseInt(t.substring(i,i+2),16));return e}return t}function C(t){return 32===t||9===t||13===t||10===t}function k(t){var e,i,r,n,s,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,h=0,c=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;t.charAt(t.length-1)===a.charAt(64)&&c--;for(var _=new Array(0|c);o<t.length;)e=a.indexOf(t.charAt(o++))<<2|(n=a.indexOf(t.charAt(o++)))>>4,i=(15&n)<<4|(s=a.indexOf(t.charAt(o++)))>>2,r=(3&s)<<6|a.indexOf(t.charAt(o++)),h<c&&(_[h++]=e),h<c&&(_[h++]=i),h<c&&(_[h++]=r);return new Uint8Array(_)}function R(t,e){void 0===e&&(e=!1);if(t.length>=3e6){t=t.replace(/[^A-Za-z0-9+/=]/g,"");for(var i=[],r=0,n=0;n<t.length;n+=3e6){var s=k(_=t.substring(n,n+3e6));i.push(s),r+=s.length}for(var a=new Uint8Array(r),o=0,h=0,c=i;h<c.length;h++){var _=c[h];a.set(_,o),o+=_.length}return e?Array.from(a):a}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=void 0,l=void 0,f=void 0,p=void 0,g=void 0,n=0,y=0,r=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;t.charAt(t.length-1)===d.charAt(64)&&r--;for(a=new Array(0|r);n<t.length;)u=d.indexOf(t.charAt(n++))<<2|(p=d.indexOf(t.charAt(n++)))>>4,l=(15&p)<<4|(g=d.indexOf(t.charAt(n++)))>>2,f=(3&g)<<6|d.indexOf(t.charAt(n++)),y<r&&(a[y++]=u),y<r&&(a[y++]=l),y<r&&(a[y++]=f);return e?a:new Uint8Array(a)}function F(t,e){void 0===e&&(e=!1);for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],n=t.length,s=0;s<n;){var a=t[s++],o=s<n?t[s++]:0,h=s<n?t[s++]:0;r.push(i[a>>2],i[(3&a)<<4|o>>4],s-1>n?"=":i[(15&o)<<2|h>>6],s>n?"=":i[63&h])}return e&&(n%3==1?(r[r.length-1]="=",r[r.length-2]="="):n%3==2&&(r[r.length-1]="=")),r.join("")}function I(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=t.length;if(i>=3e6){s=[];if(i>3e6)for(var r=0;r<i;r+=3e6){var n=t.subarray(r,Math.min(r+3e6,i));r+3e6>=i?s.push(F(n,!0)):s.push(F(n))}else s.push(F(t,!0));return s.join("")}for(var s="",a=0,o=0;o<t.length;o++)o%3==0?(s+=e[a=t[o]>>2],a=t[o]<<4&63):o%3==1?(s+=e[a+=t[o]>>4],a=t[o]<<2&63):o%3==2&&(s+=e[a+=t[o]>>6],s+=e[a=63&t[o]]);return t.length%3==1&&(s+=e[a]+"=="),t.length%3==2&&(s+=e[a]+"="),s}function D(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 Ts&&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 B(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 L(t,e){var i;if(t.has("Rect"))if(i=B(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.width!==s[2]&&r.height!==s[3]||i.x===s[0]?i.y=r.height-(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.width===n[2]||r.height===n[3])?(i.x-=n[0],i.y=n[3]-(i.y+i.height)):i.y=r.height-(i.y+i.height)}else i.y=i.y+i.height;return i}function O(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 M(t){return[t.x,t.y,t.x+t.width,t.y+t.height]}function E(t,e){var i=t[0],r=t[1],n=t[2],s=t[3];if(e){var a=e.size,o=a.width,h=a.height,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 N(t){var e=ut(t);if(!e){var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);i&&(e=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)])}return e?{r:e[0],g:e[1],b:e[2]}:void 0}function j(t){return Array.isArray(t)&&t.every(function(t){return t&&"number"==typeof t.x&&"number"==typeof t.y})}function V(t){for(var e=[],i=0;i<t.length;i+=2)e.push({x:t[i],y:t[i+1]});return e}function z(t){return t.map(function(t){for(var e=[],i=0;i<t.length;i+=2)e.push({x:t[i],y:t[i+1]});return e})}function U(t){for(var e=[],i=0,r=t;i<r.length;i++)for(var n=r[i],s=0;s<n.length;s+=2)e.push({x:n[s],y:n[s+1]});return e}function H(t){return t.map(function(t){for(var e=[],i=0,r=t;i<r.length;i++){var n=r[i];e.push(n.x,n.y)}return e})}function W(t){for(var e=[],i=0;i<t.length;i++){var r=t[i];e.push(r.x,r.y)}return e}function q(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,g:r,b: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={r:Math.round(255*n),g:Math.round(255*s),b: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={r:Math.round(255-Math.min(255,o*(255-d)+d)),g:Math.round(255-Math.min(255,h*(255-d)+d)),b:Math.round(255-Math.min(255,c*(255-d)+d))}}}return e}function G(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 vs.get(i)}function K(e){var i=t.PdfBorderEffectStyle.solid;switch(e){case"C":i=t.PdfBorderEffectStyle.cloudy}return i}function X(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 J(e,i){var r;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;break;default:r=t.PdfLineEndingStyle.none}return r}function Y(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 Q(e){switch(e){case t.PdfHighlightMode.push:return vs.get("P");case t.PdfHighlightMode.noHighlighting:return vs.get("N");case t.PdfHighlightMode.outline:return vs.get("O");default:return vs.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 vs.get(i)}function $(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 tt(t){var e=t.toFixed(2);return"0.00"===e&&(e=".00"),e}function et(t,e){var i=vs.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 it(){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 rt(t){if(!t||0===t.length)return t;for(var e=[],i=0;i<t.length;){var r=t[i],n=t.charCodeAt(i);if("#"===r&&i+2<t.length){var s=t[i+1],a=t[i+2];if(at(s)&&at(a)){e.push("#",s.toUpperCase(),a.toUpperCase()),i+=3;continue}}var o=n>=33&&n<=126,h="("===r||")"===r||"<"===r||">"===r||"["===r||"]"===r||"{"===r||"}"===r||"/"===r||"%"===r||"#"===r;if(!o||h)if(n<=127)e.push("#",st(n)),i+=1;else{var c=void 0;if(n>=55296&&n<=56319)if(i+1<t.length){var _=t.charCodeAt(i+1);_>=56320&&_<=57343?(c=_-56320+(n-55296<<10)+65536,i+=2):(c=65533,i+=1)}else c=65533,i+=1;else n>=56320&&n<=57343?(c=65533,i+=1):(c=n,i+=1);for(var d=nt(c),u=0;u<d.length;u++)e.push("#",st(d[u]))}else e.push(r),i++}return e.join("")}function nt(t){return t<=127?[t]:t<=2047?[192|t>>6,128|63&t]:t<=65535?[224|t>>12,128|t>>6&63,128|63&t]:[240|t>>18,128|t>>12&63,128|t>>6&63,128|63&t]}function st(t){var e=t.toString(16).toUpperCase();return 1===e.length?"0"+e:e}function at(t){var e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function ot(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,u=(r-e)/2,l=o*(Math.PI/360),f=Math.abs(4/3*(1-Math.cos(l))/Math.sin(l)),p=[],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),w=Math.sin(y),S=Math.sin(m);o>0?(p.push(c+d*b),p.push(_-u*w),p.push(c+d*(b-f*w)),p.push(_-u*(w+f*b)),p.push(c+d*(v+f*S)),p.push(_-u*(S-f*v)),p.push(c+d*v),p.push(_-u*S)):(p.push(c+d*b),p.push(_-u*w),p.push(c+d*(b+f*w)),p.push(_-u*(w-f*b)),p.push(c+d*(v-f*S)),p.push(_-u*(S+f*v)),p.push(c+d*v),p.push(_-u*S))}return p}function ht(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");Array.isArray(s)&&void 0===i&&s.some(function(t){return t instanceof Ss&&t===e})&&(i=n)}}return i}function ct(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===_t(t))}}return e}function _t(t){var e,i="";if(t&&t instanceof Ts&&(t.has("AS")?null!==(e=t.get("AS"))&&"Off"!==e.name&&(i=e.name):t.has("V")&&null!==(e=t.get("V"))&&"Off"!==e.name&&(i=e.name),""===i&&t&&t.has("AP"))){var r=t.get("AP");if(r&&r.has("N")){var n=r.get("N");if(n instanceof Rs&&(n=n.dictionary),n&&n instanceof Ts){var s=!1;n.forEach(function(t,e){s||"Off"===t||(i=t,s=!0)})}}}return i}function dt(e,i){var r,n=e===t._PdfCheckFieldState.checked?_t(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 Rs&&(a=a.dictionary),a&&a instanceof Ts&&n&&""!==n&&a.has(n)){var o=a.get(n),h=a.getRaw(n);h&&(o.reference=h),o&&(r=new Mi(o,i._crossReference))}}}return r}function ut(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 lt(t,e,i){var r=t._content.dictionary.getArray("BBox"),n=.1,s=.1;if(r&&void 0!==e&&null!==e)if(0===e)t._content.dictionary.set("Matrix",[1,0,0,1,-r[0],-r[1]]);else{var a=new Kn;if(90===e?a._translate(r[3],-r[0]):180===e?a._translate(r[2],r[3]):270===e&&(i?a._translate(-r[1],r[2]):a._translate(-r[1],r[3])),e%90!=0&&i&&i instanceof bn){var o=void 0,h=void 0;r&&Array.isArray(r)&&r.length>1&&(o=r[0],h=r[1]);var c=i.bounds.width,_=i.bounds.height;if("number"==typeof o&&"number"==typeof h&&0!==o&&0!==h){var d=ft(e,r,n,i),u=pt(e,r,s,i);if(d>0)if(c>d)for(;Math.round(10*c)/10!=Math.round(10*ft(e,r,n,i))/10&&Math.round(10*c)/10>Math.round(10*ft(e,r,n,i))/10;)n+=.1;else for(;Math.round(10*c)/10!=Math.round(10*ft(e,r,n,i))/10&&Math.round(10*c)/10<Math.round(10*ft(e,r,n,i))/10;)n-=.1;else for(;Math.round(10*c)/10!=Math.round(10*ft(e,r,n,i))/10&&Math.round(10*c)/10>Math.round(10*ft(e,r,n,i))/10;)n+=.1;if(u>0)if(_>u)for(;Math.round(10*_)/10!=Math.round(10*pt(e,r,s,i))/10&&Math.round(10*_)/10>Math.round(10*pt(e,r,s,i))/10;)s+=.1;else for(;Math.round(10*_)/10!=Math.round(10*pt(e,r,s,i))/10&&Math.round(10*_)/10<Math.round(10*pt(e,r,s,i))/10;)s-=.1;else for(;Math.round(10*_)/10!=Math.round(10*pt(e,r,s,i))/10&&Math.round(10*_)/10>Math.round(10*pt(e,r,s,i))/10;)s+=.1;a._translate(n,s)}else{var l=Math.abs(i.bounds.width-Math.round(ft(e,r,n,i))),f=Math.abs(i.bounds.height-Math.round(pt(e,r,s,i)));Math.round(i.bounds.width)>n&&(n=Math.round(l/n)*n),Math.round(i.bounds.width)>s&&(s=Math.round(f/s)*s),a._translate(n,s)}}a._rotate(e),t._content.dictionary.set("Matrix",a._matrix._elements)}}function ft(t,e,i,r){var n=new Kn;return n._translate(i,i),n._rotate(t),r._transformBBox({x:e[0],y:e[1],width:e[2],height:e[3]},n._matrix._elements)[2]}function pt(t,e,i,r){var n=new Kn;return n._translate(i,i),n._rotate(t),r._transformBBox({x:e[0],y:e[1],width:e[2],height:e[3]},n._matrix._elements)[3]}function gt(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 yt(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 mt(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 bt(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 vt(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 wt(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 St(e){e.includes("23")&&(e=e.replace(/\s+/g,"").replace(/23/g,""));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 xt(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 Pt(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 At(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 Tt(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 Ct(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 kt(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 Rt(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 Ft(e){var i=[];return(e&t.PdfFontStyle.bold)>0&&i.push("Bold"),(e&t.PdfFontStyle.italic)>0&&i.push("Italic"),(e&t.PdfFontStyle.underline)>0&&i.push("Underline"),(e&t.PdfFontStyle.strikeout)>0&&i.push("Strikeout"),0===i.length?"Regular":i.join(", ")}function It(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 Dt(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 Bt(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 Lt(t,e){return e?t.reviewHistory:t.comments}function Ot(t){var e=t.get("F");return(t.has("State")||t.has("StateModel"))&&(30===e||128===e)}function Mt(t){var e=t.get("F");return!(t.has("State")||t.has("StateModel")||28!==e&&128!==e)}function Et(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 Nt(t,e,i){if(t&&t.has(i)){var r=t.getRaw(i);if(r&&r instanceof Ss&&r._isNew){var n=t.get(i);if(n){n instanceof Ss&&(n=e._fetch(n));var s=void 0;n instanceof Ts?s=n:n instanceof Rs&&(s=n.dictionary),s&&s.has("Resources")&&jt(s.get("Resources"),e)}e._cacheMap.delete(r)}}}function jt(t,e){t&&t.size>0&&t.forEach(function(i,r){if(void 0!==i&&void 0!==r)if(r instanceof Ss){var n=r;if(n._isNew){var s=t.get(i);s&&s instanceof Ts&&("XObject"===i&&s.has("Resources")&&jt(s.get("Resources"),e),e._cacheMap.delete(n))}}else r instanceof Ts&&(r.has("Resources")&&jt(r.get("Resources"),e),"Font"!==i&&"XObject"!==i&&"ExtGState"!==i||jt(r,e))})}function Vt(t,e,i,r){var n;t&&(t instanceof Ts?n=t:t instanceof Fs&&(n=t.dictionary)),n&&(Nt(n,e,i),Nt(n,e,r))}function zt(t){return"[object String]"===Object.prototype.toString.call(t)?"$s"+t:"$o"+t.toString()}function Ut(e,i,r){var n,s,a,o,h="",c=!0;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 instanceof vs&&(a=a.name),a&&a.includes("Tf")){var _=a.trim().split(/\s+/),d=_.indexOf("Tf");d>=2&&((h=_[d-2]).startsWith("/")&&(h=h.slice(1)),h&&(h=ve(h)),n=parseFloat(_[d-1]))}if(h&&(h=h.trim()),e&&e._dictionary.has("DR")){var u=e._dictionary.get("DR");if(u.has("Font")&&(b=u.get("Font")).has(h)&&(v=b.get(h))&&h&&v.has("BaseFont")){var l=v.get("BaseFont"),f=t.PdfFontStyle.regular,p=t.PdfFontFamily.helvetica;if(null!==h&&void 0!==h&&""!==h&&(p=qt(h)),0===n&&(n=Wt(r,p)),r&&r._dictionary.has("AP")&&(c=Yt(r)),c&&(o=h+"_"+n+"_"+f),l&&(a=l.name,"Helvetica"===l.name&&(l.name="Helv"),f=Gt(l.name),e&&e._fontCache&&e._fontCache.has(o)&&0!==n&&(s=e._fontCache.get(o),r&&r._dictionary&&r._dictionary.has("V")&&s instanceof Ar&&(s._isUnicode=Xt(r._dictionary))),s||(a.includes("-")&&(a=a.substring(0,a.indexOf("-"))),i&&i._dictionary.has("DA")?s=i._dictionary.has("AP")?Kt(a,n,f,i):Kt(a,n,f,i,v):r&&r._dictionary.has("DA")&&(s=r._dictionary.has("AP")?Kt(a,n,f,r):Kt(a,n,f,r,v)))),!c&&s instanceof xr&&r instanceof jr&&!r._isTextChanged&&v){var g=s._metrics._widthTable,y=Ht(v,s.height,l.name,s);y&&(s._metrics=y),s._metrics._widthTable=g}}if(s&&s._dictionary&&s._dictionary.has("BaseFont")){var m=s._dictionary.get("BaseFont").name;if(m&&m!==h){var b=u.get("Font");if(b&&b.has(h)){var v=b.get(h),w=v.get("Subtype").name;if(v&&h&&v.has("BaseFont")){f=(l=v.get("BaseFont"))?Gt(l.name):t.PdfFontStyle.regular;if("TrueType"===w){var S=ye(e,v);if(S&&S.length>0){var x=I(S);if(x&&x.length>0){var P=!0;if(i||r){var A=i?i._dictionary:r._dictionary;if(A&&A.has("V")){var T=A.get("V");if(null!==T&&void 0!==T&&(P=me(T),A.has("FT")&&"Ch"===A.get("FT").name&&A.has("Opt"))){var C=A.get("Opt");if(C&&C.length>0)for(var k=0,R=C.filter(function(t){return t.length>1});k<R.length;k++){var F=R[k],D=F[0],B=F[1];if(D===T){P=me(B);break}}}}}(s=new Ar(x,n,f))._isUnicode=P}}}}}}}}if((null===s||void 0===s)&&void 0!==n){p=t.PdfFontFamily.helvetica;null!==h&&void 0!==h&&""!==h&&(p=qt(h)),0===n&&(n=Wt(r,p)),s=new xr(p,n,t.PdfFontStyle.regular)}return(null===s||void 0===s||s&&1===s.size)&&(!i||i._field instanceof Wr?r&&(s=r._circleCaptionFont):s=i._circleCaptionFont),e&&e._fontCache&&0!==n&&s&&"string"==typeof o&&!e._fontCache.has(o)&&e._fontCache.set(o,s),s}function Ht(t,e,i,r){var n;if(t.has("FontDescriptor")){n=new ji;var s=t.get("FontDescriptor");s&&(r._ascent=s.get("Ascent"),r._descent=s.get("Descent"),r._ascent=s.get("Ascent"),r._height=r._ascent-r._descent,n._postScriptName=i)}if(n&&t.has("Widths")){var a=t.getArray("Widths");n._widthTable=new zi(a)}return n&&(n._name=i),n}function Wt(e,i){var r,n=[],s=0;try{if(e instanceof Wr){var a=e.bounds.width,o=e.bounds.height,h=new xr(i,12);if("number"==typeof e.selectedIndex){var c=e.itemAt(e.selectedIndex);c&&"string"==typeof c.text&&(r=c.text,n.push(h.measureString(r)))}else if(Array.isArray(e.selectedIndex))for(P=0;P<e.selectedIndex.length;P++)r=e.itemAt(e.selectedIndex[P]).text,n.push(h.measureString(r));var _=[0,0],d=2*(F=e.border.width),u=2,l=e.border.style===t.PdfBorderStyle.inset||e.border.style===t.PdfBorderStyle.beveled;l?(_[0]=2*d,_[1]=2*F):(_[0]=d+u,_[1]=1*F+(u-1));var f=[0,0,a,o],p=f[2]-d,g=f;if(g[3]-=l?d:F,0===e.rotationAngle&&l&&(p-=d),n.length>0){var y=12*(p-_[0])/n[n.length-1].width,m=12*(f[3]-_[1])/n[n.length-1].height;s=Math.min(y,m)}else s=12;if(0!==e._obtainSelectedValue().length){var b=new xr(i,s),v=void 0;if(void 0!==(R=e._dictionary.get("V"))&&(v=Array.isArray(R)&&R.length>=1?b.measureString(R[0]):b.measureString(R)),void 0!==v&&(v.width>a||v.height>o))for(var w=a-4*e.border.width,S=o-4*e.border.width,x=s,P=1;P<=o;P++){(b=new xr(i,P))._size=P;var A=void 0;if(void 0!==R&&(A=Array.isArray(R)&&R.length>=1?b.measureString(R[0]):b.measureString(R)),A.width>a||A.height>S){x=P;do{if((x-=.001)<.248){b._size=.248;break}(b=new xr(i,x))._size=x;var T=e._getStringFormat();Array.isArray(R)&&R.length>=1&&(R=R[0]);var C=b.getLineWidth(R,T),k=b.measureString(R,T);if(C<w&&k.height<S){b._size=x;break}}while(x>.248);s=x;break}}}else s>12&&(s=12)}else if(e instanceof jr){var a=e.bounds.width,o=e.bounds.height,R=e.text||"",_=[0,0],F=e.border.width,d=2*F,u=2;e.border.style===t.PdfBorderStyle.inset||e.border.style===t.PdfBorderStyle.beveled?(_[0]=2*d,_[1]=2*F):(_[0]=d+u,_[1]=F+u-1);var I=a-_[0],D=o-_[1],B=new xr(i,12);if(e.multiLine)s=12.5;else{var L=B.measureString(R);if(L.width>0&&L.height>0){var O=12*I/L.width,M=12*D/L.height;s=Math.min(O,M)}else s=8}}}catch(t){s=e instanceof jr?e.multiLine?12.5:8:12}return 0===s?12:s}function qt(e){var i=e||"";switch(i.includes("-")&&(i=i.substring(0,i.indexOf("-"))),i){case"Helv":case"Helvetica":return t.PdfFontFamily.helvetica;case"Cour":case"Courier":return t.PdfFontFamily.courier;case"Symb":case"Symbol":return t.PdfFontFamily.symbol;case"Times":case"TiRo":case"TimesRoman":return t.PdfFontFamily.timesRoman;case"ZaDb":case"ZapfDingbats":return t.PdfFontFamily.zapfDingbats}return t.PdfFontFamily.helvetica}function Gt(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 Kt(e,i,r,n,s){var a,o,h=e||"";h.includes("-")&&(h=h.substring(0,h.indexOf("-"))),void 0===i&&n instanceof tn&&n._isLoaded&&(i=10);var c=void 0!==i?i:1;if(n._dictionary.has("DS")||n._dictionary.has("DA")||n instanceof Sn&&n._dictionary.has("AP"))switch(h){case"Helv":case"Helvetica":a=new xr(t.PdfFontFamily.helvetica,c,r);break;case"Cour":case"Courier":a=new xr(t.PdfFontFamily.courier,c,r);break;case"Symb":case"Symbol":a=new xr(t.PdfFontFamily.symbol,c,r);break;case"Times":case"TiRo":case"TimesRoman":a=new xr(t.PdfFontFamily.timesRoman,c,r);break;case"ZaDb":case"ZapfDingbats":a=new xr(t.PdfFontFamily.zapfDingbats,c,r);break;case"MonotypeSungLight":a=new Pr(t.PdfCjkFontFamily.monotypeSungLight,c,r);break;case"SinoTypeSongLight":a=new Pr(t.PdfCjkFontFamily.sinoTypeSongLight,c,r);break;case"MonotypeHeiMedium":a=new Pr(t.PdfCjkFontFamily.monotypeHeiMedium,c,r);break;case"HanyangSystemsGothicMedium":a=new Pr(t.PdfCjkFontFamily.hanyangSystemsGothicMedium,c,r);break;case"HanyangSystemsShinMyeongJoMedium":a=new Pr(t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium,c,r);break;case"HeiseiKakuGothicW5":a=new Pr(t.PdfCjkFontFamily.heiseiKakuGothicW5,c,r);break;case"HeiseiMinchoW3":a=new Pr(t.PdfCjkFontFamily.heiseiMinchoW3,c,r);break;default:if(n._dictionary.has("AP")?o=Qt(n._crossReference,n,e):s&&(o=Zt(s)),o&&o.length>0){var _=new Ar(o,c,r);n._dictionary&&n._dictionary.has("V")&&(_._isUnicode=Xt(n._dictionary)),a=_}}if(null===a||void 0===a){var d=n instanceof Zr,u=n instanceof Nr;if(d&&!(n instanceof Sn)||u){var l=n._type,f=n._circleCaptionFont&&c>n._circleCaptionFont.size,p=d&&l!==t._PdfAnnotationType.widgetAnnotation,g=n instanceof jr&&f,y=n instanceof Wr&&f;a=p||g||y?new xr(t.PdfFontFamily.helvetica,c,r):n._circleCaptionFont,l===t._PdfAnnotationType.widgetAnnotation&&f&&(a=new xr(t.PdfFontFamily.helvetica,c,r))}}return a}function Xt(t){var e=!0,i=t.get("V");if(null!==i&&void 0!==i&&(e=me(i),t.has("FT")&&"Ch"===t.get("FT").name&&t.has("Opt"))){var r=t.get("Opt");if(r&&r.length>0)for(var n=0;n<r.length;n++){var s=r[n];if(s&&s.length>1){var a=s[0],o=s[1];if(a&&o&&a===i&&o){e=me(o);break}}}}return e}function Jt(t){var e,i=t._dictionary;if(i&&i.has("AP")){var r=i.get("AP");if(r&&r instanceof Ts&&r.has("N")){var n=r.get("N"),s=void 0;if(n&&(n instanceof Fs?s=n:n.stream&&n.stream instanceof Fs&&(s=n.stream)),s&&s.dictionary&&s.dictionary.has("Resources")){var a=s.dictionary.get("Resources");if(a&&a instanceof Ts&&a.has("Font")){var o=a.get("Font");o instanceof Ts&&(e=o)}}}}return e}function Yt(t){var e=!1,i=Jt(t);if(i&&t instanceof Nr){var r=t.form;if(r&&r._dictionary.has("DR")){var n=r._dictionary.get("DR");if(n.has("Font")){r._fontResources||(r._fontResources=n.get("Font"));var s=r._fontResources;s&&i.forEach(function(t,i){s.has(t)&&(e=!0)})}}}return e}function Qt(t,e,i){var r,n=Jt(e);if(n&&n.forEach(function(e,i){if(!r&&i instanceof Ss){var n=t._fetch(i);r=Zt(n)}}),!r&&e instanceof Nr&&i){var s=e.form;if(s&&s._dictionary.has("DR")){var a=s._dictionary.get("DR");if(a&&a.has("Font")){var o=a.get("Font");if(o&&o.has(i)){var h=o.get(i);h&&(r=Zt(h))}}}}return r}function Zt(t){var e,i;if(t&&t.has("DescendantFonts")){var r=t.getArray("DescendantFonts");r&&r.length>0&&r.forEach(function(t){t&&t instanceof Ts&&t.has("FontDescriptor")&&(i=t.get("FontDescriptor"))})}else t&&t.has("FontDescriptor")&&(i=t.get("FontDescriptor"));if(i&&i.has("FontFile2")){var n=i.get("FontFile2");if(n instanceof Fs&&n.length>0)e=n.getByteRange(n.start,n.end);else if(n.stream&&n.dictionary&&(n.dictionary.has("Length1")||n.dictionary.has("Length"))){var s=n.dictionary.get(n.dictionary.has("Length1")?"Length1":"Length");n.getBytes(s),e=n.buffer.subarray(0,s)}}return e}function $t(t,e){return t.length===e.length&&t.every(function(t,i){return g(t,e[i])})}function te(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.width-(r.margins.left+r.margins.right),r.size.height-(r.margins.top+r.margins.bottom)];i[0]+=n[0],i[1]=r.size.height-(n[1]+i[1])}else{var s=t._page.size;i[1]=s.height-(t.bounds.y+t.bounds.height);var a=t._getCropOrMediaBox();a&&a.length>2&&(0!==a[0]||0!==a[1])&&(i[0]+=a[0],i[1]+=a[1])}if(t._page&&"function"==typeof t._page._getTemplateReservedSpace){var o=t._page._getTemplateReservedSpace();o&&o.length>=4&&(i[0]+=o[3],i[1]-=o[0])}return[i[0],i[1],i[0]+i[2],i[1]+i[3]]}return i}function ee(t,e){if(!t||!e)return t;if(t.length<e.length)return t;for(var i=t.length-e.length,r=0;r<e.length;r++)if(t.charCodeAt(i+r)!==e.charCodeAt(r))return t;return t.substring(0,i)}function ie(t,e,i){if(!t||"string"!=typeof t||e||i)return t;if(t.length<2)return t;var r=255&t.charCodeAt(0),n=255&t.charCodeAt(1),s=254===r&&255===n,a=255===r&&254===n;if(!s&&!a)return t;var o=t.substring(2);(o=s?ee(o,"ÿý"):ee(o,"ýÿ")).length>0&&0==(255&o.charCodeAt(o.length-1))&&(o=o.substring(0,o.length-1));var h=o.length;if(0===h)return"";for(var c=new Uint8Array(h),_=0;_<h;_++)c[_]=255&o.charCodeAt(_);if(0!=(1&c.length)){var d=new Uint8Array(c.length+1);return a?(d.set(c,0),d[c.length]=0):(d[0]=0,d.set(c,1)),re(d,s)}return re(c,s)}function re(t,e){var i=t.length,r=i/2,n=new Array(r);if(e)for(var s=0,a=0;s<i;s+=2,a++)n[a]=t[s]<<8|t[s+1];else for(var s=0,a=0;s<i;s+=2,a++)n[a]=t[s+1]<<8|t[s];return String.fromCharCode.apply(null,n)}function ne(t){return t<=4294967295?t<=65535?t<=255?1:2:t<=16777215?3:4:8}function se(t){for(var e=[],i=0;i<t.length;i++){var r=t.charCodeAt(i);r<=65535&&(e.push(r>>8&255),e.push(255&r))}return e}function ae(e,i){switch(i){case t.PdfNumberStyle.none:return"";case t.PdfNumberStyle.numeric:return e.toString();case t.PdfNumberStyle.lowerLatin:return he(e).toLowerCase();case t.PdfNumberStyle.lowerRoman:return oe(e).toLowerCase();case t.PdfNumberStyle.upperLatin:return he(e);case t.PdfNumberStyle.upperRoman:return oe(e)}}function oe(t){for(var e="",i=0,r=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];i<r.length;i++)for(var n=r[i],s=n[0],a=n[1];t>=s;)e+=a,t-=s;return e}function he(t){for(var e="";t>0;){var i=t%26;t=Math.floor(t/26),0===i&&(t--,i=26),e=ce(i)+e}return e}function ce(t){if(t<=0||t>26)throw new Error("Value can not be less 0 and greater 26");return String.fromCharCode(64+t)}function _e(t){return null!==t&&void 0!==t}function de(t,e,i,r){return void 0===r&&(r=!1),Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}function ue(t,e){void 0===e&&(e=!1);var r;if(t instanceof Fs&&t.bytes&&t.isImageStream)r=t.bytes;else{for(var n=t.getString(),s=[],a=0;a<n.length;a++)s.push(n.charCodeAt(a));r=new Uint8Array(s)}var o=new i.CompressedStreamWriter;o.write(r,0,r.length),o.close();var h=o.getCompressedString;if(t.dictionary.update("Filter",vs.get("FlateDecode")),e){for(var c=[],a=0;a<h.length;a++)c.push(255&h.charCodeAt(a));return P(new Uint8Array(c))}return h}function le(t){return/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(t)}function fe(t,e){if(t.update("Count",t.get("Count")+e),t.has("Parent")){var i=t.get("Parent");i&&"Pages"===i.get("Type").name&&fe(i,e)}}function pe(t,e){var i=[0,0,e.size.width,e.size.height];t.update("MediaBox",i),t.update("CropBox",i);var r=90*Math.floor(e.rotation);r>=360&&(r%=360),t.update("Rotate",r)}function ge(t){var e=/[^\x00-\x7F]/;return t.split("").some(function(t){return null!==e.exec(t)})}function ye(t,e){var i;return e&&e.forEach(function(e,r){if(r&&r.objectNumber){var n=t._crossReference._fetch(r);n&&n instanceof Ts&&n.forEach(function(t,e){if(e&&e instanceof vs&&"FontDescriptor"===e.name){var r=void 0;n&&n.has("FontFile2")?(r=n.get("FontFile2"))&&r instanceof Rs&&(i=r.getBytes()):n&&n.has("FontFile3")&&(r=n.get("FontFile3"))&&r instanceof Rs&&(i=r.getBytes())}})}}),i}function me(t){if(null===t||void 0===t)throw new Error("ArgumentNullException: value");for(var e=0;e<t.length;e++)if(t.charCodeAt(e)>127)return!0;return!1}function be(t){if(t>="0"&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);if(t>="A"&&t<="F")return t.charCodeAt(0)-"A".charCodeAt(0)+10;if(t>="a"&&t<="f")return t.charCodeAt(0)-"a".charCodeAt(0)+10;throw new Error("Invalid hex character: "+t)}function ve(t){for(var e=[],i=t.length,r=0;r<i;++r){var n=t[r];if("#"===n){var s=be(t[r+1]),a=be(t[r+2]);n=String.fromCharCode((s<<4)+a),r+=2}e.push(n)}return e.join("")}function we(e,i){e.style===t.PdfBorderStyle.dashed&&(i.borderPen._dashStyle=t.PdfDashStyle.dash,i.borderPen._dashPattern=[3])}function Se(t,e){return t[e]<<8|t[e+1]}function xe(t,e){e&&t!==e.rotate&&(t<0&&(t=360+t),t>=360&&(t=360-t),e._dictionary.update("Rotate",t))}function Pe(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function Ae(t,e){return t[e]<<24>>24}function Te(t){return t>0?Math.ceil(Math.log2(t)):0}function Ce(t,e,i,r){return void 0===r&&(r=!1),Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}function ke(t,e,i){return Math.min(Math.max(t,e),i)}function Re(t){throw new Error(t)}function Fe(t,e){if(Ie())for(var i=0,r=t.length;i<r;i++)e[i]=65793*t[i]|4278190080;else for(var i=0,r=t.length;i<r;i++)e[i]=16843008*t[i]|255}function Ie(){var t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}function De(e){var i=e._getSequence();if(3===i.length){var r=i[2];if(r._tagClass===t._TagClassType.universal&&r._getTagNumber()===t._UniversalType.abstractSyntaxSet&&r._construction===t._ConstructionType.constructed)return r}}function Be(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function Le(t,e,i){var r=ze(),n=r(1);for(t%=i;e>r(0);)e%r(2)===r(1)&&(n=n*t%i),e>>=r(1),t=t*t%i;return n}function Oe(t,e){var i=ze(),r=e,n=i(0),s=i(1);if(e===i(1))return i(0);for(;t>i(1);){if(e===i(0))return i(1);var a=t/e,o=e;e=t%e,t=o,o=n,n=s-a*n,s=o}return s<i(0)&&(s+=r),s}function Me(t){for(var e=ze(),i=e(0),r=0;r<t.length;r++)i=(i<<e(8))+e(t[r]);return i}function Ee(t){if(t===ze()(0))return new Uint8Array([0]);var e=t.toString(16);e.length%2!=0&&(e="0"+e);for(var i=e.length/2,r=new Uint8Array(i),n=0;n<i;n++)r[n]=parseInt(e.substr(2*n,2),16);return r}function Ne(t){for(var e=Math.ceil(t/8),i=new Uint8Array(e),r=0;r<e;r++)i[r]=Math.floor(256*Math.random());var n=(1<<t%8)-1;return n>0&&(i[0]&=n),Me(i)}function je(t,e){if(t>=e)return t;for(var i=e.toString(2).length,r=0;r<1e3;r++){var n=Ne(i);if(n>=t&&n<=e)return n}return Ne((e-t).toString(2).length-1)+t}function Ve(t){var e=t.length;return 77!==e&&109!==e&&93!==e&&65!==e||49!==t[0]?135!==e&&212!==e&&180!==e||49!==t[0]||129!==t[1]?119===e&&49===t[0]?t.slice(1):t:t.slice(2):t.slice(1)}function ze(){return Function("return BigInt")()}function Ue(t){return t<10?"0"+t:""+t}function He(t){return"D:"+t.getUTCFullYear()+Ue(t.getUTCMonth()+1)+Ue(t.getUTCDate())+Ue(t.getUTCHours())+Ue(t.getUTCMinutes())+Ue(t.getUTCSeconds())+"Z"}function We(t){if(t.startsWith("D:")){var e=parseInt(t.substring(2,6),10),i=parseInt(t.substring(6,8),10)-1,r=parseInt(t.substring(8,10),10),n=parseInt(t.substring(10,12),10),s=parseInt(t.substring(12,14),10),a=parseInt(t.substring(14,16),10),o=Date.UTC(e,i,r,n,s,a);if(t.length>=17){var h=t[16];if("Z"===h)return new Date(o);if(("+"===h||"-"===h)&&t.length>=23){var c=6e4*(60*parseInt(t.substring(17,19),10)+parseInt(t.substring(20,22),10));return o-="+"===h?c:-c,new Date(o)}}return o-=198e5,new Date(o)}return new Date(t)}function qe(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 vs(i)}function Ge(t,e,i){var r=new Ts;return r._updated=!0,r.set("Type",vs.get("Font")),r.set("Subtype",vs.get("CIDFontType2")),r.set("BaseFont",new vs(i._postScriptName)),r.set("DW",i._widthTable._defaultWidth),r.set("W",i._widthTable._toArray()),r.set("CIDSystemInfo",Ke(t)),[r]}function Ke(e){var i=new Ts;switch(i._updated=!0,i.set("Registry","Adobe"),e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:i.set("Ordering","Korea1"),i.set("Supplement",1);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:case t.PdfCjkFontFamily.heiseiMinchoW3:i.set("Ordering","Japan1"),i.set("Supplement",2);break;case t.PdfCjkFontFamily.monotypeHeiMedium:case t.PdfCjkFontFamily.monotypeSungLight:i.set("Ordering","CNS1"),i.set("Supplement","0");break;case t.PdfCjkFontFamily.sinoTypeSongLight:i.set("Ordering","GB1"),i.set("Supplement",2)}return i}function Xe(e){return e.includes("Helvetica")?t.PdfFontFamily.helvetica:e.includes("Courier")?t.PdfFontFamily.courier:e.includes("Times")?t.PdfFontFamily.timesRoman:e.includes("Symbol")?t.PdfFontFamily.symbol:e.includes("ZapfDingbats")?t.PdfFontFamily.zapfDingbats:t.PdfFontFamily.helvetica}function Je(e){switch(e){case"HeiseiKakuGo-W5":case"HeiseiKakuGo-W5,BoldItalic":case"HeiseiKakuGo-W5,Bold":case"HeiseiKakuGo-W5,Italic":return t.PdfCjkFontFamily.heiseiKakuGothicW5;case"HeiseiMin-W3":case"HeiseiMin-W3,BoldItalic":case"HeiseiMin-W3,Bold":case"HeiseiMin-W3,Italic":return t.PdfCjkFontFamily.heiseiMinchoW3;case"HYGoThic-Medium":case"HYGoThic-Medium,BoldItalic":case"HYGoThic-Medium,Bold":case"HYGoThic-Medium,Italic":return t.PdfCjkFontFamily.hanyangSystemsGothicMedium;case"HYSMyeongJo-Medium":case"HYSMyeongJo-Medium,BoldItalic":case"HYSMyeongJo-Medium,Bold":case"HYSMyeongJo-Medium,Italic":return t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium;case"MHei-Medium":case"MHei-Medium,BoldItalic":case"MHei-Medium,Bold":case"MHei-Medium,Italic":return t.PdfCjkFontFamily.monotypeHeiMedium;case"MSung-Light":case"MSung-Light,BoldItalic":case"MSung-Light,Bold":case"MSung-Light,Italic":return t.PdfCjkFontFamily.monotypeSungLight;case"STSong-Light":case"STSong-Light,BoldItalic":case"STSong-Light,Bold":case"STSong-Light,Italic":return t.PdfCjkFontFamily.sinoTypeSongLight;default:throw new Error("Unknown CJK font family for: "+e)}}function Ye(t,e,i){if(void 0===i&&(i="0"),e>>=0,i=String(i||" "),t.length>=e)return t;var r=e-t.length;return r>i.length&&(i+=i.repeat(r/i.length)),i.slice(0,r)+t}function Qe(t){return Array.from(t).map(function(t){return Ye(t.toString(16),2,"0")}).join("").toUpperCase()}function Ze(e,i){switch(i){case t.PdfNumberStyle.numeric:return e.toString();case t.PdfNumberStyle.upperRoman:return $e(e).toUpperCase();case t.PdfNumberStyle.lowerRoman:return $e(e).toLowerCase();case t.PdfNumberStyle.upperLatin:return ti(e).toUpperCase();case t.PdfNumberStyle.lowerLatin:return ti(e).toLowerCase();default:return e.toString()}}function $e(t){for(var e=[1e3,900,500,400,100,90,50,40,10,9,5,4,1],i=["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"],r="",n=0;n<e.length;n++)for(;t>=e[n];)r+=i[n],t-=e[n];return r}function ti(t){for(var e="";t>0;)t--,e=String.fromCharCode(97+t%26)+e,t=Math.floor(t/26);return e}function ei(){ys=Object.create(null),ms=Object.create(null),bs=Object.create(null)}function ii(t,e){return t instanceof vs&&(void 0===e||t.name===e)}function ri(t,e){return t instanceof ws&&(void 0===e||t.command===e)}function ni(t){var e=t.length;if(0===e)return 0;if(e>4)throw new Error("Input too large to convert to number without BigInt.");for(var i=0,r=0;r<e;r++)i=i<<8|t[r];return i}function si(t){if(t>=-128&&t<=127){e=new Uint8Array(1);return(i=new DataView(e.buffer)).setInt8(0,t),e}if(t>=-32768&&t<=32767){e=new Uint8Array(2);return(i=new DataView(e.buffer)).setInt16(0,t,!1),e}if(t>=-8388608&&t<=8388607){e=new Uint8Array(4);return(i=new DataView(e.buffer)).setInt32(0,t,!1),e.subarray(1)}if(t>=-2147483648&&t<=2147483647){var e=new Uint8Array(4),i=new DataView(e.buffer);return i.setInt32(0,t,!1),e}throw new Error("Integer out of range for 32-bit encoding without BigInt.")}function ai(t){var e=t.length;if(0===e)return 0;if(e>4)throw new Error("Number too long to decode.");var i=new Uint8Array(4),r=0!=(128&t[0]);return i.fill(r?255:0,0,4-e),i.set(t,4-e),new DataView(i.buffer).getInt32(0,!1)}function oi(t){var e=t.length;if(0===e)return 0;if(e>4)throw new Error("Number on "+e+" bytes is too long to decode.");var i=new Uint8Array(4);return i.set(t,4-e),new DataView(i.buffer).getUint32(0,!1)}function hi(t){var e=new Float64Array([t]),i=new Uint32Array(e.buffer);return{negative:t<0,exponent:((2146435072&i[1])>>>20)-1023-31,mantissa:2147483648+((1048575&i[1])<<11|(4292870144&i[0])>>>21)}}function ci(t){if(t<-2147483648)throw Error("Number "+t+" too small to be encoded as a big-endian signed integer.");if(t>2147483647)throw Error("Number "+t+" too big to be encoded as a big-endian signed integer.");return t<=127&&t>=-128?new Uint8Array([255&t]):t<=32767&&t>=-32768?new Uint8Array([t>>8&255,255&t]):t<=8388607&&t>=-8388608?new Uint8Array([t>>16&255,t>>8&255,255&t]):new Uint8Array([t>>24&255,t>>16&255,t>>8&255,255&t])}function _i(t){if(t<0)throw new Error("Number "+t+" too small to be encoded as a big-endian unsigned integer.");if(t>4294967295)throw new Error("Number "+t+" too big to be encoded as a big-endian unsigned integer.");var e=new Uint8Array(4);new DataView(e.buffer).setUint32(0,t,!1);for(var i=0,r=0;r<e.length-1&&0===e[r];r++)i++;return e.subarray(i)}function di(e){if(0===e)return new Uint8Array(0);if(Number.isNaN(e))return new Uint8Array([t._RealValueType.notANumber]);if(e===1/0)return new Uint8Array([t._RealValueType.plusInfinity]);if(e===-1/0)return new Uint8Array([t._RealValueType.minusInfinity]);for(var i=hi(e);0!==i.mantissa&&i.mantissa%2==0;)i.mantissa=i.mantissa>>>1,i.exponent++;if(i.exponent<=-1020)throw new Error("Real number "+e+" (having exponent "+i.exponent+") is too precise to encode.");var r=i.exponent<=127&&i.exponent>=-128,n=128|(e>=0?0:64)|(r?0:1),s=ci(i.exponent),a=_i(i.mantissa),o=new Uint8Array(1+s.length+a.length);return o[0]=n,o.set(s,1),o.set(a,1+s.length),o}function ui(t,e){return(t[t.length-(Math.floor(e/8)+1)]&1<<e%8)>0}function li(t){for(var e=Math.ceil(t.length/8),i=new Uint8Array(e),r=-1,n=0;n<t.length;n++){var s=n%8;0===s&&r++,0!==t[n]&&(i[r]|=1<<7-s)}return i}function fi(t,e,i){var r=t.length-(Math.floor(e/7)+1);i?t[r]|=1<<e%7:t[r]&=~(1<<e%7)}function pi(t,e,i){var r=t.length-(Math.floor(e/8)+1);i?t[r]|=1<<e%8:t[r]&=~(1<<e%8)}function gi(t,e){if(void 0===e&&(e="utf-8"),"utf-8"!==e)throw new Error("Only utf-8 encoding is supported in fallback.");for(var i="",r=0;r<t.length;){var n=t[r++];if(n<128)i+=String.fromCharCode(n);else if(n>=192&&n<224){s=t[r++];i+=String.fromCharCode((31&n)<<6|63&s)}else if(n>=224&&n<240){var s=t[r++],a=t[r++];i+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&a)}else if(n>=240){var o=(7&n)<<18|(63&(s=t[r++]))<<12|(63&(a=t[r++]))<<6|63&t[r++],h=55296+(o-65536>>10),c=56320+(o-65536&1023);i+=String.fromCharCode(h,c)}}return i}function yi(t){for(var e=0;e<t.length-1;e++)if(48===t[e]&&128===t[e+1])return!0;return!1}function mi(t,e,i){return function(r,n){if(!Number.isInteger(n))throw new Error("Non-integral "+t+" supplied to "+r+".");if(n>i)throw new Error("Encountered "+t+" greater than "+i+" in "+r+".");if(n<e)throw new Error("Encountered "+t+" less than "+e+" in "+r+".")}}function bi(t){return t<=127}function vi(t){return t>=32&&t<=126}function wi(t){return t>=39&&t<=57&&42!==t||t>=65&&t<=90||t>=97&&t<=122||32===t||58===t||61===t||63===t}function Si(t,e,i,r){if(!Number.isSafeInteger(e))throw new Error("Invalid year in "+t);if(!Number.isSafeInteger(i))throw new Error("Invalid month in "+t);if(!Number.isSafeInteger(r)||r<1)throw new Error("Invalid day in "+t);switch(i){case 0:case 2:case 4:case 6:case 7:case 9:case 11:if(r>31)throw new Error("Day > 31 encountered in "+t+" with 31-day month.");break;case 3:case 5:case 8:case 10:if(r>30)throw new Error("Day > 31 encountered in "+t+" with 30-day month.");break;case 1:if(e%4==0&&e%100!=0||e%400==0){if(r>29)throw new Error("Day > 29 encountered in "+t+" with month of February in leap year.")}else if(r>28)throw new Error("Day > 28 encountered in "+t+" with month of February and non leap year.");break;default:throw new Error("Invalid month in "+t)}}function xi(t,e,i,r){if(!Number.isSafeInteger(e))throw new Error("Invalid hours in "+t);if(!Number.isSafeInteger(i))throw new Error("Invalid minutes in "+t);if(!Number.isSafeInteger(r)||r<0)throw new Error("Invalid seconds in "+t);if(e>23)throw new Error("Hours > 23 encountered in "+t+".");if(i>59)throw new Error("Minutes > 60 encountered in "+t+".");if(r>59)throw new Error("Seconds > 60 encountered in "+t+".")}function Pi(t,e,i,r,n,s,a){Si(t,e,i,r),xi(t,n,s,a)}function Ai(t){return t>=48&&t<=57||32===t}!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.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={})),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.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.regular=0]="regular",t[t.italic=1]="italic",t[t.bold=2]="bold"}(t.PdfTextStyle||(t.PdfTextStyle={})),function(t){t[t.none=0]="none",t[t.numeric=1]="numeric",t[t.lowerLatin=2]="lowerLatin",t[t.lowerRoman=3]="lowerRoman",t[t.upperLatin=4]="upperLatin",t[t.upperRoman=5]="upperRoman"}(t.PdfNumberStyle||(t.PdfNumberStyle={})),function(t){t[t.none=0]="none",t[t.disk=1]="disk",t[t.square=2]="square",t[t.asterisk=3]="asterisk",t[t.circle=4]="circle"}(t.PdfUnorderedListStyle||(t.PdfUnorderedListStyle={})),function(t){t[t.paginate=0]="paginate",t[t.onePage=1]="onePage"}(t.PdfLayoutType||(t.PdfLayoutType={})),function(t){t[t.fitPage=0]="fitPage",t[t.fitElement=1]="fitElement"}(t.PdfLayoutBreakType||(t.PdfLayoutBreakType={})),function(t){t[t.left=0]="left",t[t.right=1]="right"}(t.PdfListMarkerAlignment||(t.PdfListMarkerAlignment={})),function(t){t[t.alwaysPrint=0]="alwaysPrint",t[t.neverPrint=1]="neverPrint",t[t.printWhenVisible=2]="printWhenVisible"}(t.PdfPrintState||(t.PdfPrintState={})),function(t){t[t.sha1=0]="sha1",t[t.sha256=1]="sha256",t[t.sha384=2]="sha384",t[t.sha512=3]="sha512",t[t.ripemd160=4]="ripemd160"}(t.DigestAlgorithm||(t.DigestAlgorithm={})),function(t){t[t.cms=0]="cms",t[t.cades=1]="cades"}(t.CryptographicStandard||(t.CryptographicStandard={})),function(t){t[t.forbidChanges=1]="forbidChanges",t[t.allowFormFill=2]="allowFormFill",t[t.allowComments=3]="allowComments"}(t.PdfCertificationFlags||(t.PdfCertificationFlags={})),function(t){t[t.noCheck=0]="noCheck",t[t.online=1]="online",t[t.offline=2]="offline"}(t._PdfX509RevocationMode||(t._PdfX509RevocationMode={})),function(t){t[t.ocsp=0]="ocsp",t[t.crl=1]="crl",t[t.ocspAndCrl=2]="ocspAndCrl",t[t.ocspOrCrl=3]="ocspOrCrl"}(t._RevocationType||(t._RevocationType={})),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.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.rgb=0]="rgb",t[t.cmyk=1]="cmyk",t[t.grayScale=2]="grayScale",t[t.indexed=3]="indexed"}(t._PdfColorSpace||(t._PdfColorSpace={})),function(t){t.basic="Basic",t.dublinCore="DublinCore",t.pdf="PDF",t.pagedText="PagedText",t.basicJobTicket="BasicJobTicket",t.rightsManagement="RightsManagement",t.custom="Custom"}(t.PdfXmpSchemaType||(t.PdfXmpSchemaType={})),function(t){t[t.background=0]="background",t[t.foreground=1]="foreground"}(t.PdfTemplateLayerMode||(t.PdfTemplateLayerMode={})),function(t){t[t.none=0]="none",t[t.left=1]="left",t[t.center=2]="center",t[t.right=3]="right"}(t.PdfTemplateHorizontalAlignment||(t.PdfTemplateHorizontalAlignment={})),function(t){t[t.none=0]="none",t[t.top=1]="top",t[t.middle=2]="middle",t[t.bottom=3]="bottom"}(t.PdfTemplateVerticalAlignment||(t.PdfTemplateVerticalAlignment={})),function(t){t[t.topLeft=0]="topLeft",t[t.topCenter=1]="topCenter",t[t.topRight=2]="topRight",t[t.middleLeft=3]="middleLeft",t[t.middleCenter=4]="middleCenter",t[t.middleRight=5]="middleRight",t[t.bottomLeft=6]="bottomLeft",t[t.bottomCenter=7]="bottomCenter",t[t.bottomRight=8]="bottomRight"}(t._PdfAlignmentStyle||(t._PdfAlignmentStyle={})),function(t){t[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right",t[t.evenTop=4]="evenTop",t[t.evenBottom=5]="evenBottom",t[t.evenLeft=6]="evenLeft",t[t.evenRight=7]="evenRight",t[t.oddTop=8]="oddTop",t[t.oddBottom=9]="oddBottom",t[t.oddLeft=10]="oddLeft",t[t.oddRight=11]="oddRight"}(t._PdfDocumentTemplateKey||(t._PdfDocumentTemplateKey={})),function(t){t[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right"}(t._TemplateSide||(t._TemplateSide={})),function(t){t[t.universal=0]="universal",t[t.application=1]="application",t[t.context=2]="context",t[t.abstractSyntaxPrivate=3]="abstractSyntaxPrivate",t[t.nullValue=5]="nullValue"}(t._TagClassType||(t._TagClassType={})),function(t){t[t.primitive=0]="primitive",t[t.constructed=1]="constructed"}(t._ConstructionType||(t._ConstructionType={})),function(t){t[t.plusInfinity=64]="plusInfinity",t[t.minusInfinity=65]="minusInfinity",t[t.notANumber=66]="notANumber",t[t.minusZero=67]="minusZero"}(t._RealValueType||(t._RealValueType={})),function(t){t[t.base2=0]="base2",t[t.base8=16]="base8",t[t.base16=32]="base16"}(t._RealEncodingBase||(t._RealEncodingBase={})),function(t){t[t.scale0=0]="scale0",t[t.scale1=4]="scale1",t[t.scale2=8]="scale2",t[t.scale3=12]="scale3"}(t._RealEncodingScale||(t._RealEncodingScale={})),function(t){t[t.endOfContent=0]="endOfContent",t[t.abstractSyntaxBoolean=1]="abstractSyntaxBoolean",t[t.integer=2]="integer",t[t.bitString=3]="bitString",t[t.octetString=4]="octetString",t[t.nullValue=5]="nullValue",t[t.objectIdentifier=6]="objectIdentifier",t[t.objectDescriptor=7]="objectDescriptor",t[t.external=8]="external",t[t.realNumber=9]="realNumber",t[t.enumerated=10]="enumerated",t[t.embeddedDataValue=11]="embeddedDataValue",t[t.utf8String=12]="utf8String",t[t.relativeObjectIdentifier=13]="relativeObjectIdentifier",t[t.reservedBit14=14]="reservedBit14",t[t.time=14]="time",t[t.reservedBit15=15]="reservedBit15",t[t.sequence=16]="sequence",t[t.abstractSyntaxSet=17]="abstractSyntaxSet",t[t.numericString=18]="numericString",t[t.printableString=19]="printableString",t[t.teleprinterTextExchange=20]="teleprinterTextExchange",t[t.videoTextInformationSystem=21]="videoTextInformationSystem",t[t.internationalAlphabetString=22]="internationalAlphabetString",t[t.universalTime=23]="universalTime",t[t.generalizedTime=24]="generalizedTime",t[t.graphicString=25]="graphicString",t[t.visibleString=26]="visibleString",t[t.generalString=27]="generalString",t[t.universalString=28]="universalString",t[t.characterString=29]="characterString",t[t.bmpString=30]="bmpString",t[t.date=31]="date",t[t.timeOfDay=32]="timeOfDay",t[t.dateTime=33]="dateTime",t[t.duration=34]="duration",t[t.objectIdResourceIdentifier=35]="objectIdResourceIdentifier",t[t.relativeResourceIdentifier=36]="relativeResourceIdentifier"}(t._UniversalType||(t._UniversalType={}));var Ti=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 Ci),this._elementStack.push(new ki),this._namespaceStack[0]._set("xmlns","http://www.w3.org/2000/xmlns/","Special"),this._namespaceStack.push(new Ci),this._namespaceStack[1]._set("xml","http://www.w3.org/XML/1998/namespace","Special"),this._namespaceStack.push(new Ci),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[t]._prefix,this._elementStack[t]._localName),this._namespaceStack.splice(this._elementStack[t]._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[t]._destroy();this._namespaceStack=[];for(var t=0;t<this._elementStack.length;t++)this._elementStack[t]._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[e]=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=f(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 ki),this._elementStack[r]._set(t,e,i,this._namespaceStack.length-1),this._pushNamespaceImplicit(t,i);for(var n=0;n<this._attributeStack.length;n++)this._attributeStack[n]._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=t.replace(/\&/g,"&")).replace(/\</g,"<")).replace(/\>/g,">")).replace(/\u0000/g,""),e&&(t=t.replace(/\"/g,""")),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[e]._kind&&this._writeNamespaceDeclaration(this._namespaceStack[e]._prefix,this._namespaceStack[e]._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 Ci),this._namespaceStack[r]._set(t,e,i)},t.prototype._lookupPrefix=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[e]._namespaceUri===t)return this._namespaceStack[e]._prefix},t.prototype._lookupNamespace=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[e]._prefix===t)return this._namespaceStack[e]._namespaceUri},t.prototype._lookupNamespaceIndex=function(t){for(var e=this._namespaceStack.length-1;e>=0;e--)if(this._namespaceStack[e]._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[r]._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[r]._kind){if("xml"!==t)throw new Error('InvalidArgumentException: Prefix "xmlns" is reserved for use by XML.');if(e!==this._namespaceStack[r]._namespaceUri)throw new Error("InvalidArgumentException: Xml String");i="Implied"}else i=this._namespaceStack[r]._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[i]._kind="Written");this._addNamespace(t,e,"Written")},t.prototype._addAttribute=function(t,e,i){var r=this._attributeStack.length;this._attributeStack.push(new Ri),this._attributeStack[r]._set(t,e,i);for(var n=0;n<r;n++)if(this._attributeStack[n]._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}(),Ci=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}(),ki=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}(),Ri=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}(),Fi=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 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,i="";if(null!==t&&void 0!==t&&t.export){var r=D(t._dictionary,"FT",!1,!0);if(r&&null!==r.name&&void 0!==r.name){var n=this._getEncodedFontDictionary(t._dictionary),s=t.name;if(null!==n&&void 0!==n){var a=this._getEncodedValue(s,n);s="string"==typeof a?a:s}var o=void 0,h=void 0;switch(r.name){case"Tx":null!==(i=D(t._dictionary,"V",!1,!0))&&void 0!==i?(i="string"==typeof(e=this._getEncodedValue(i,n))?e:i,this._table.set(s,i)):this._exportEmptyFields&&(i="",this._table.set(s,i));break;case"Ch":if(null!==(o=D(t._dictionary,"V",!0,!0))&&void 0!==o&&(h=this._getExportValue(o)),!o&&t._dictionary.has("I")&&(t instanceof qr||t instanceof Wr)&&(h=t._obtainSelectedValue()),null!==h&&void 0!==h){if("string"==typeof h&&""!==h)i="string"==typeof(e=this._getEncodedValue(h,n))?e:h,this._table.set(s,i);else if(h instanceof Array&&h.length>0){for(var c=[],_=0;_<h.length;_++)e=this._getEncodedValue(h[_],n),c.push("string"==typeof e?e:h[_]);return this._table.set(s,c),c}}else this._exportEmptyFields&&(i="",this._table.set(s,i));break;case"Btn":if(null!==(o=D(t._dictionary,"V",!1,!0))&&void 0!==o){var d=this._getExportValue(o,t);if(null!==d&&void 0!==d&&""!==d){var u=void 0;if(t instanceof Ur&&(u=t),!t._dictionary.has("Opt")||null!==u&&void 0!==u&&-1===u.selectedIndex)i=d="string"==typeof(e=this._getEncodedValue(d,n))?e:d,this._table.set(s,i);else if(t._dictionary.has("Opt")){var l=t._dictionary.getArray("Opt"),f=Number(d);if((null===f||void 0===f||Number.isNaN(f))&&(f=0),null!==l&&void 0!==l){var p=void 0;null!==(p=u?l[u.selectedIndex]:l[f])&&void 0!==p&&(d=p),null!==d&&void 0!==d&&""!==d&&(i=d="string"==typeof(e=this._getEncodedValue(d,n))?e:d,this._table.set(s,i))}}}else(t instanceof Ur||t instanceof zr)&&(i=this._exportEmptyFields?d:"Off",this._table.set(s,i))}else if(t instanceof Ur)(i=t._getAppearanceStateValue())||(i=this._exportEmptyFields?"":"Off"),this._table.set(s,i);else{var g=t.itemAt(t._defaultIndex),y=void 0;(y=g?g._dictionary:t._dictionary)&&y.has("AS")?(i=y.get("AS").name,this._table.set(s,i)):this._exportEmptyFields&&(i="",this._table.set(s,i))}}}}return i},t.prototype._exportFormFieldData=function(t){var e,i,r=D(t._dictionary,"FT",!1,!0);if(r&&null!==r.name&&void 0!==r.name){var n=this._getEncodedFontDictionary(t._dictionary),s=t.name;null!==n&&void 0!==n&&(s="string"==typeof(e=this._getEncodedValue(s,n))?e:s);var a=void 0,o=void 0;switch(r.name){case"Tx":if(a=D(t._dictionary,"V",!1,!0),this._asPerSpecification){if(t._dictionary.has("RV"))null!==(a=D(t._dictionary,"RV",!1,!0))&&void 0!==a&&(a+=this._key,this._formKey=this._key,this._table.set(s,a));else if(null!==a&&void 0!==a){var h=a="string"==typeof(i=this._getEncodedValue(a,n))?i:a;t instanceof jr&&t.multiLine&&(a=h=(h=h.replace("\n","")).replace("\r","\r\n")),this._table.set(s,a)}}else null!==a&&void 0!==a?(a="string"==typeof(i=this._getEncodedValue(a,n))?i:a,this._table.set(s,a)):this._exportEmptyFields&&this._table.set(s,"");break;case"Ch":if(o=D(t._dictionary,"V",!0,!0),this._asPerSpecification){if(t instanceof Hr)if(Array.isArray(o))this._table.set(s,o);else if("string"==typeof o)o="string"==typeof(i=this._getEncodedValue(o,n))?i:o,this._table.set(s,o);else if((null===o||void 0===o)&&t._dictionary.has("I")&&null!==(d=t._obtainSelectedValue())&&void 0!==d)if("string"==typeof d&&""!==d)d="string"==typeof(i=this._getEncodedValue(d,n))?i:d,this._table.set(s,a);else if(d instanceof Array&&d.length>0){for(var c=[],_=0;_<d.length;_++)i=this._getEncodedValue(d[_],n),c.push("string"==typeof i?i:d[_]);this._table.set(s,c)}}else{var d=void 0;if(null!==o&&void 0!==o&&(d=this._getExportValue(o)),!o&&t._dictionary.has("I")&&(t instanceof qr||t instanceof Wr)&&(d=t._obtainSelectedValue()),null!==d&&void 0!==d)if("string"==typeof d&&""!==d)d="string"==typeof(i=this._getEncodedValue(d,n))?i:d,this._table.set(s,d);else if(d instanceof Array&&d.length>0){for(var c=[],_=0;_<d.length;_++)i=this._getEncodedValue(d[_],n),c.push("string"==typeof i?i:d[_]);this._table.set(s,c)}else this._exportEmptyFields&&this._table.set(s,"");else this._exportEmptyFields&&this._table.set(s,"")}break;case"Btn":if(null!==(o=D(t._dictionary,"V",!1,!0))&&void 0!==o)if(null!==(g=this._getExportValue(o,t))&&void 0!==g&&""!==g){this._asPerSpecification&&"XML"!==this._format&&(g=T(g));var u=void 0;if(t instanceof Ur&&(u=t),!t._dictionary.has("Opt")||null!==u&&void 0!==u&&-1===u.selectedIndex)g="string"==typeof(i=this._getEncodedValue(g,n))?i:g,this._table.set(s,g);else if(t._dictionary.has("Opt")){var l=t._dictionary.getArray("Opt"),f=Number(g);if((null===f||void 0===f||Number.isNaN(f))&&(f=0),null!==l&&void 0!==l){var p=void 0;null!==(p=u?l[u.selectedIndex]:l[f])&&void 0!==p&&(g=p),null!==g&&void 0!==g&&""!==g&&(g="string"==typeof(i=this._getEncodedValue(g,n))?i:g,this._table.set(s,g))}}}else(t instanceof Ur||t instanceof zr)&&(this._exportEmptyFields?this._table.set(s,g):this._table.set(s,"Off"));else if(t instanceof Ur){var g=t._getAppearanceStateValue();g||(g=this._exportEmptyFields?"":"Off"),this._table.set(s,g)}else{var y=t.itemAt(t._defaultIndex),m=void 0;(m=y?y._dictionary:t._dictionary)&&m.has("AS")?this._table.set(s,m.get("AS").name):this._exportEmptyFields&&this._table.set(s,"")}}}},t.prototype._getAnnotationType=function(t){var e="";if(t&&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 vs)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[n],e)}else"number"==typeof t?i=t.toString():t instanceof Ss&&(i=this._getValue(this._crossReference._fetch(t),e));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 Rs&&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 Bi(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 Ts(this._crossReference);c.set("Differences",h.get("Differences"));var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,c);var d=new Ts(this._crossReference);if(d.set("Subtype",vs.get("Type1")),d.set("Encoding",_),null!==(i=new Bi(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 u,l=!1;if(e.forEach(function(t,e){if(!l&&null!==e&&void 0!==e){var s=void 0;if(e instanceof Ts)s=e;else if(e instanceof Ss){var a=r._crossReference._fetch(e);null!==a&&void 0!==a&&a instanceof Ts&&(s=a)}s&&(i=new Bi(s),u=r._replaceNotUsedCharacters(n,i),l=!0)}}),!l)return u}return n},t.prototype._replaceNotUsedCharacters=function(t,e){for(var i="",r=e.differencesDictionary,n=0;n<t.length;n++){var s=t[n],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 vs?i=t.name:"string"==typeof t&&(i=t),null!==i&&void 0!==i&&""!==i&&e instanceof Ur&&-1!==e.selectedIndex){var r=e.itemAt(e.selectedIndex);null!==r&&void 0!==r&&r.value===i&&(i=r.value)}}else if(t instanceof vs)i=t.name;else if("string"==typeof t)i=t;else if(Array.isArray(t)){var n=[];return t.forEach(function(t){t instanceof vs?n.push(t.name):"string"==typeof t&&n.push(t)}),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&&i.has("Popup")){var n=i.getRaw("Popup"),s=i.get("Popup");if(s&&s instanceof Ts){n&&s&&s.update("Parent",e);var a=t._parseAnnotation(s),o=t._annotations.length;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 jr)null!==i&&void 0!==i&&(t instanceof jr&&t.multiLine&&(i=(i=i.replace("\r\n","\r")).replace("\n","\r")),t.text=i);else if(t instanceof qr||t instanceof Wr){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 Wr&&this._asPerSpecification&&t._dictionary.has("AP")&&(delete t._dictionary._map.AP,t._dictionary._updated=!0))}else if(t instanceof zr){var a=i.toLowerCase();this._containsExportValue(i,t)||"on"===a||"yes"===a?t.checked=!0:t.checked=!1}else if(t instanceof Ur){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 e._defaultIndex=r,!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 Ts&&i.has("N")){var r=i.get("N");if(r&&r instanceof Ts&&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}(),Di=function(e){function i(t){var i=e.call(this)||this;return i._isColoSpace=!1,null!==t&&void 0!==t&&(i._fileName=t),i}return Fi(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=it(),this._save()},i.prototype._save=function(){var t=new Ti;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 instanceof _n&&r._dictionary.has("Parent")||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(".")){var s=r.toString().split(".");s.forEach(function(i,r){if(n.has(i))e._getElements(n.get(i)),n=n.get(i);else if(r===s.length-1)n.set(i,t);else{var a=new Map;n.set(i,a),n=a}})}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 dn||t instanceof fn||t instanceof ln||t instanceof gn)&&this._writeAnnotationData(e,i,t)},i.prototype._writeAnnotationData=function(t,e,i){var r,n,s=!1;i instanceof Zr?(r=i,n=i._dictionary):n=i;var a=this._getAnnotationType(n);if(this._skipBorderStyle=!1,a&&""!==a){this._annotationAttributes=[],t._writeStartElement(a.toLowerCase()),t._writeAttributeString("page",e.toString()),this._annotationAttributes.push("page");var o=void 0;switch(a){case"Line":o=r.linePoints,t._writeAttributeString("start",o[0].x.toString()+","+o[0].y.toString()),t._writeAttributeString("end",o[1].x.toString()+","+o[1].y.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&&"Measure"!==a&&"Popup"!==a&&-1===a.indexOf(":")){var h=void 0;if((h=o instanceof Ss?t.get(a):o)&&h instanceof Ts)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")));break;default:n._writeDictionary(h,e,i,!1)}else(!s||s&&"S"!==a)&&n._writeAttribute(i,a,h)}}),(this.exportAppearance||r)&&t.has("AP")){var o=this._getAppearanceString(t.get("AP"));o&&o.length>0&&(i._writeStartElement("appearance"),i._writeRaw(I(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=P(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")){i._writeStartElement("data");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 u=d.get("F");if(u&&u.dictionary){var l=u.dictionary;if(l.has("Params")){var p=l.get("Params");if(p){if(p.has("CreationDate")){v=this._getValue(p.get("CreationDate"));i._writeAttributeString("creation",v)}if(p.has("ModificationDate")){v=this._getValue(p.get("ModificationDate"));i._writeAttributeString("modification",v)}if(p.has("Size")&&i._writeAttributeString("size",this._getValue(p.get("Size"))),p.has("CheckSum")){var g=P(f(v=this._getValue(p.get("CheckSum"))));i._writeAttributeString("checksum",g)}}}var y=P(u.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())}}}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[w])+(w%2!=0?";":",");(v+=this._getValue(m[b-1]))&&""!==v&&i._writeRaw(v)}}i._writeEndElement()}if(t.has("Popup")){var S=t.get("Popup");S&&this._writeAnnotationData(i,e,S)}if(t.has("DA")){var x=t.get("DA");x&&this._writeRawData(i,"defaultappearance",x)}if(t.has("DS")){var A=t.get("DS");A&&this._writeRawData(i,"defaultstyle",A)}if(t.has("InkList")){var T=t.getArray("InkList");if(T&&T.length>0){i._writeStartElement("inklist");for(var C=0;C<T.length;C++)i._writeElementString("gesture",this._getValue(T[C]));i._writeEndElement()}}if(t.has("RC")&&(v=t.get("RC"))&&""!==v){var k=v.indexOf("<body");k>0&&(v=v.substring(k)),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 Ti(!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 Ss?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r,n){if(null!==e&&void 0!==e)if(e instanceof vs)this._writePrefix(t,"NAME",r),t._writeAttributeString("VAL",e.name),t._writeEndElement();else if(Array.isArray(e))this._writePrefix(t,"ARRAY",r),r&&"ColorSpace"===r&&(this._isColoSpace=!0),i.has(r)?this._writeArray(t,i.getArray(r),i):this._writeArray(t,e,i),this._isColoSpace=!1,t._writeEndElement();else if("string"==typeof e)if(this._writePrefix(t,"STRING",r),this._isColoSpace){var s=f(e);t._writeAttributeString("VAL",P(s)),t._writeEndElement()}else 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 Ts)this._writePrefix(t,"DICT",r),this._writeAppearanceDictionary(t,e),t._writeEndElement();else if(e instanceof Rs&&e.dictionary){var a=e.dictionary;if(this._writePrefix(t,"STREAM",r),t._writeAttributeString("DEFINE",""),a.has("Subtype")&&("Image"===this._getValue(a.get("Subtype"))||"Form"===this._getValue(a.get("Subtype")))||!a.has("Type")&&!a.has("Subtype")&&"ToUnicode"!==r){o=void 0;o=n?a.has("Filter")&&"DCTDecode"===a.get("Filter").name||a.has("Subtype")&&"Form"===a.get("Subtype").name?e.getString(!0):ue(e,!0):e.getString(!0),!a.has("Length")&&o&&""!==o&&a.update("Length",e.length),this._writeAppearanceDictionary(t,a),t._writeStartElement("DATA"),t._writeAttributeString("MODE","RAW"),t._writeAttributeString("ENCODING","HEX"),o&&""!==o&&t._writeRaw(o)}else{var o=e.getString();!a.has("Length")&&o&&""!==o&&a.update("Length",e.length),o=(o=o.replace(/</g,"<")).replace(/>/g,">"),this._writeAppearanceDictionary(t,a),t._writeStartElement("DATA"),t._writeAttributeString("MODE","FILTERED"),t._writeAttributeString("ENCODING","ASCII"),o&&""!==o&&t._writeRaw(o)}t._writeEndElement(),t._writeEndElement()}else e instanceof Ss&&this._crossReference&&this._writeObject(t,this._crossReference._fetch(e),i,r,e._isNew)},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){if(r._isColoSpace&&"string"==typeof e){var n=P(f(e));t._writeStartElement("DATA"),t._writeAttributeString("MODE","RAW"),t._writeAttributeString("ENCODING","HEX"),t._writeRaw(n),t._writeEndElement()}else r._writeObject(t,e,i)})},i.prototype._getFormatedString=function(t,e){return void 0===e&&(e=!1),t=e?(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">"):(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">")},i.prototype._writeAttribute=function(t,e,i){var r;if(this._annotationAttributes&&-1===this._annotationAttributes.indexOf(e))switch(e){case"C":this._writeColor(t,i,"color","c");break;case"OC":this._writeColor(t,i,"oc");break;case"AFC":this._writeColor(t,i,"afc");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 vs&&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 n=d(i);t._writeAttributeString("flags",n),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":break;case"TextMarkupContent":r=f(i),this._writeAttributeString(t,e.toLowerCase(),P(r));break;case"AllowedInteractions":case"AnnotationSelectorSettings":this._writeAttributeString(t,e,i);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=v(e,!0);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(v(e,!0),"text/xml"),this._readXmlData(this._xmlDocument.documentElement)},i.prototype._readXmlData=function(t){var e=this;if(t&&1===t.nodeType)if(this._checkXfdf(t),this._isAnnotationImport){var i=t.getElementsByTagName("annots");if(i&&i.length>0)for(var r=0;r<i.length;r++){var n=i.item(r);if(n&&"annots"===n.localName&&n.hasChildNodes())for(var s=n.childNodes,a=0;a<s.length;a++){var o=s.item(a);if(o&&1===o.nodeType){var h=o;h&&1===h.nodeType&&this._parseAnnotationData(h)}}}this._groupHolders.length>0&&this._groupHolders.forEach(function(t){var i=t.get("IRT");i&&""!==i&&(e._groupReferences.has(i)?t.update("IRT",e._groupReferences.get(i)):delete t._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 u=d;u&&"field"===u.localName&&c.push(u)}}this._importFormNodes(c)}}}this._importField()},i.prototype._importFormNodes=function(t){var e=this;t.forEach(function(t){if(t&&"field"===t.localName){for(var i=[],r=0;r<t.children.length;r++){var n=t.children[r];"field"===n.localName&&i.push(n)}if(i.length>0)return void e._importFormNodes(i);var s=e._getFieldName(t),a=e._fields.get(s)||[],o=t.getElementsByTagName("value");if(o&&o.length>0){for(r=0;r<o.length;r++)a.push(o[r].textContent||"");return void e._fields.set(s,a)}if((o=t.getElementsByTagName("value-richtext"))&&o.length>0){var h=o.item(0),c=h.textContent||"";if(h.childNodes.length>0){var _=h.childNodes[0];if(_&&_.hasChildNodes()){c="";for(var d=0;d<_.childNodes.length;d++)c+=(_.childNodes[d].textContent||"")+"\r";c=c.length?c.substring(0,c.length-1):h.textContent||""}}a.push(c),e._fields.set(s,a),e._richTextValues.has(s)||e._richTextValues.set(s,h.innerHTML)}}})},i.prototype._getFieldName=function(t){for(var e="",i=t;i&&"fields"!==i.localName;)e.length>0&&(e="."+e),e=i.hasAttribute("name")&&""!==i.getAttribute("name")?i.getAttribute("name")+e:i.localName+e,i=i.parentElement;return e},i.prototype._parseAnnotationData=function(t){if(t){var e=-1;if(t.hasAttributes&&t.hasAttribute("page")&&(e=Number(t.getAttribute("page")))>=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),r.has("Popup")&&s._annotations.push(r.getRaw("Popup")),s._comments&&s._comments.length>0&&(s._comments=[]),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 Ts(this._crossReference);i.update("Type",vs.get("Annot"));var r=!0;switch(e.localName.toLowerCase()){case"line":if(i.update("Subtype",vs.get("Line")),e.hasAttribute("start")&&e.hasAttribute("end")){var n=e.getAttribute("start").split(",").map(function(t){return Number.parseFloat(t)}).concat(e.getAttribute("end").split(",").map(function(t){return Number.parseFloat(t)}));4===n.length&&i.update("L",n)}this._addLineEndStyle(i,e);break;case"circle":i.update("Subtype",vs.get("Circle"));break;case"square":i.update("Subtype",vs.get("Square"));break;case"polyline":i.update("Subtype",vs.get("PolyLine")),this._addLineEndStyle(i,e);break;case"polygon":i.update("Subtype",vs.get("Polygon")),this._addLineEndStyle(i,e);break;case"ink":i.update("Subtype",vs.get("Ink"));break;case"popup":i.update("Subtype",vs.get("Popup"));break;case"text":i.update("Subtype",vs.get("Text"));break;case"freetext":i.update("Subtype",vs.get("FreeText")),this._addLineEndStyle(i,e);break;case"stamp":i.update("Subtype",vs.get("Stamp"));break;case"highlight":i.update("Subtype",vs.get("Highlight"));break;case"squiggly":i.update("Subtype",vs.get("Squiggly"));break;case"underline":i.update("Subtype",vs.get("Underline"));break;case"strikeout":i.update("Subtype",vs.get("StrikeOut"));break;case"fileattachment":i.update("Subtype",vs.get("FileAttachment"));break;case"sound":i.update("Subtype",vs.get("Sound"));break;case"caret":i.update("Subtype",vs.get("Caret"));break;case"redact":i.update("Subtype",vs.get("Redact"));break;case"link":i.update("Subtype",vs.get("Link"));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 Ts(this._crossReference),r=new Ts(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",vs.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(",").map(function(t){return 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){var r=this;Array.from(i).forEach(function(i){var n,s,a,o,h=i.value;switch(i.name.toLowerCase()){case"page":case"start":case"end":case"width":case"head":case"tail":case"style":case"intensity":case"itex":break;case"state":r._addString(e,"State",h);break;case"statemodel":r._addString(e,"StateModel",h);break;case"replytype":"group"===h&&e.update("RT",vs.get("Group"));break;case"inreplyto":r._addString(e,"IRT",h);break;case"rect":(a=r._obtainPoints(h))&&4===a.length&&e.update("Rect",a);break;case"color":(s=N(h))&&e.update("C",[s.r/255,s.g/255,s.b/255]);break;case"oc":h&&"Redact"===e.get("Subtype").name&&(s=N(h))&&e.update("OC",[s.r/255,s.g/255,s.b/255]);break;case"afc":h&&"Redact"===e.get("Subtype").name&&(s=N(h))&&e.update("AFC",[s.r/255,s.g/255,s.b/255]);break;case"interior-color":(s=N(h))&&e.update("IC",[s.r/255,s.g/255,s.b/255]);break;case"date":r._addString(e,"M",h);break;case"creationdate":r._addString(e,"CreationDate",h);break;case"name":r._addString(e,"NM",h);break;case"uri":if(h){var c=new Ts(r._crossReference);c.update("Type",new vs("Action")),c.update("S",new vs("URI")),c.update("URI",h);var _=r._crossReference._getNextReference();r._crossReference._cacheMap.set(_,c),e.update("A",_)}break;case"icon":h&&""!==h&&e.update("Name",vs.get(h));break;case"subject":r._addString(e,"Subj",r._getFormatedString(h,!0));break;case"title":r._addString(e,"T",r._getFormatedString(h,!0));break;case"rotation":r._addInt(e,"Rotate",h);break;case"justification":r._addInt(e,"Q",h);break;case"fringe":r._addFloatPoints(e,r._obtainPoints(h),"RD");break;case"it":h&&""!==h&&e.update("IT",vs.get(h));break;case"leaderlength":r._addFloat(e,"LL",h);break;case"leaderextend":void 0!==(o=Number.parseFloat(h))&&e.update("LLE",o);break;case"caption":h&&""!==h&&e.update("Cap","yes"===h.toLowerCase());break;case"caption-style":h&&""!==h&&e.update("CP",vs.get(h));break;case"callout":r._addFloatPoints(e,r._obtainPoints(h),"CL");break;case"coords":r._addFloatPoints(e,r._obtainPoints(h),"QuadPoints");break;case"border":r._addFloatPoints(e,r._obtainPoints(h),"Border");break;case"opacity":r._addFloat(e,"CA",h);break;case"flags":if(h&&""!==h){var d=t.PdfAnnotationFlag.default;h.split(",").forEach(function(t,e){var i=u(t);0===e?d=i:d|=i}),e.update("F",d)}break;case"open":h&&""!==h&&e.update("Open","true"===h||"yes"===h);break;case"calibrate":r._addString(e,"Calibrate",h);break;case"customdata":r._addString(e,"CustomData",h);break;case"overlaytext":e.update("OverlayText",h);break;case"repeat":e.update("Repeat","true"===h||"yes"===h);break;default:if(r._document._allowImportCustomData){var l=void 0;if("string"!=typeof h||-1===h.indexOf(":")||h.startsWith("{")||h.endsWith("}"))l="string"==typeof h?h:JSON.stringify(h);else{var f=h.split(":");l=Array.isArray(f)&&2===f.length?JSON.stringify((n={},n[f[0]]=f[1],n)):h}r._addString(e,i.name,l)}}})},i.prototype._obtainPoints=function(t){return t.split(",").map(function(t){return Number.parseFloat(t)})},i.prototype._parseInnerElements=function(t,e,i){var r=this;if(e.hasChildNodes){var n=e.childNodes;Array.from(n).forEach(function(n){if(1===n.nodeType){var s=n,a=n.textContent,o=s.innerHTML;switch(n.nodeName.toLowerCase()){case"popup":if(s&&s.hasAttributes){var h=r._getAnnotationDictionary(i,s);if(h.size>0){var c=r._crossReference._getNextReference();r._crossReference._cacheMap.set(c,h),t.update("Popup",c),h.has("NM")&&r._addReferenceToGroup(c,h)}}break;case"contents":a&&""!==a&&t.update("Contents",r._getFormatedString(a,!0));break;case"contents-richtext":o&&""!==o&&t.update("RC",r._richTextPrefix+o);break;case"defaultstyle":r._addString(t,"DS",a);break;case"defaultappearance":r._addString(t,"DA",a);break;case"vertices":if(a&&""!==a){var _=[];if(a.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){_.push(t)}):_.push(t)}),_.length>0){var d=_.map(function(t){return Number.parseFloat(t)});t.update("Vertices",d)}}break;case"appearance":r._addAppearanceData(n,t);break;case"inklist":if(n.hasChildNodes){var u=[],l=n.childNodes;Array.from(l).forEach(function(t){if(t&&1===t.nodeType){var e=t;if("gesture"===e.nodeName.toLowerCase()&&e.textContent&&""!==e.textContent){var i=[];if(e.textContent.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){i.push(t)}):i.push(t)}),i.length>0){var r=i.map(function(t){return Number.parseFloat(t)});u.push(r)}}}}),t.update("InkList",u)}break;case"data":r._addStreamData(n,t,e)}}})}},i.prototype._addStreamData=function(t,e,i){if(t&&t.textContent&&""!==t.textContent){var r=A(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 Is(i);if(r.dictionary._crossReference=this._crossReference,r.dictionary.update("Type",vs.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",vs.get(n))}e.hasAttribute("filter")&&r.dictionary.update("Filter",vs.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 Ts(this._crossReference);if(r.update("Type",vs.get("Filespec")),e.hasAttribute("file")){var n=e.getAttribute("file");this._addString(r,"F",n),this._addString(r,"UF",n)}var s=new Is(i);s.dictionary._crossReference=this._crossReference;var a=new Ts(this._crossReference);if(e.hasAttribute("size")){var o=Number(e.getAttribute("size"));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",vs.get("FlateDecode"));var h=new Ts(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=this,r=t.textContent;if(r&&""!==r){var n=(new DOMParser).parseFromString(atob(r),"text/xml");if(n&&n.hasChildNodes){var s=n.childNodes;if(s&&1===s.length){var a=s[0];if(a&&1===a.nodeType){var o=a;if("DICT"===o.nodeName.toUpperCase()&&o.hasAttribute("KEY")){var h=o.getAttribute("KEY");if(h&&"AP"===h&&o.hasChildNodes){var c=new Ts(this._crossReference);s=o.childNodes,Array.from(s).forEach(function(t){i._getAppearance(c,t)}),c.size>0&&e.update("AP",c)}}}}}}},i.prototype._getAppearance=function(t,e){var i=t instanceof Ts?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 Is){t._bytes=a;var h=!1;if(i&&i.has("Subtype")){var c=i.get("Subtype");h=c&&"Image"===c.name}h?t._isCompress=!0:(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=this,i=new Is([]);if(i.dictionary._crossReference=this._crossReference,t.hasChildNodes){var r=t.childNodes;Array.from(r).forEach(function(t){1===t.nodeType&&e._getAppearance(i,t)})}return i},i.prototype._getDictionary=function(t){var e=this,i=new Ts(this._crossReference);if(t.hasChildNodes){var r=t.childNodes;Array.from(r).forEach(function(t){1===t.nodeType&&e._getAppearance(i,t)})}return i},i.prototype._getArray=function(t){var e=this,i=[];if(t.hasChildNodes){var r=t.childNodes;Array.from(r).forEach(function(t){1===t.nodeType&&e._addArrayElements(i,t)})}return i},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=f(n,!0):"RAW"===i&&"HEX"===r&&(e=A(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,_=void 0,d=void 0;switch(r.localName){case"DATA":d=this._getData(r),(_=v(new Uint8Array(d),!0))&&_.length>0&&t.push(_);break;case"STREAM":if(n=this._getStream(r)){u=this._crossReference._getNextReference();n.reference=u,this._crossReference._cacheMap.set(u,n),t.push(u)}break;case"DICT":if(s=this._getDictionary(r)){var u=this._crossReference._getNextReference();this._crossReference._cacheMap.set(u,s),t.push(u)}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(t.getAttribute("VAL"))),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=vs.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++){var h=a[o];if(h&&"measure"===h.localName){i=h;break}}var c=new Ts(this._crossReference),_=new Ts(this._crossReference),d=new Ts(this._crossReference),u=new Ts(this._crossReference),l=[],f=[],p=[];if(i){if(c.update("Type",vs.get("Measure")),i.hasAttribute("rateValue")){var g=i.getAttribute("rateValue");g&&""!==g&&c.update("R",g)}if(i.hasChildNodes){a=i.childNodes;Array.from(a).forEach(function(t){if(t&&1===t.nodeType){var e=t;switch(e.nodeName.toLowerCase()){case"distance":n=e;break;case"area":r=e;break;case"xformat":s=e}}})}}if(s&&(this._addElements(s,u),p.push(u)),n&&(this._addElements(n,_),l.push(_)),r&&(this._addElements(r,d),f.push(d)),c.set("A",f),c.set("D",l),c.set("X",p),c.size>0&&c.has("Type")){var y=this._crossReference._getNextReference();this._crossReference._cacheMap.set(y,c),t.update("Measure",y)}},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",vs.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(i);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(vs.get(i)),n.push(vs.get(r)),t.update("LE",n)}else t.update("LE",vs.get(i));else r&&""!==r&&t.update("LE",vs.get(r))},i}(Ii),Bi=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 vs)t=e.name;else if(e instanceof Ts){if(e.has("BaseEncoding")){var i=e.get("BaseEncoding");i&&i instanceof vs&&(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=this,e=new Map;if(null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")){var i=this._dictionary.get("Encoding");if(null!==i&&void 0!==i&&i instanceof Ts&&i.has("Differences")){var r=i.getArray("Differences"),n=0;null!==r&&void 0!==r&&r.forEach(function(i){var r="";"number"==typeof i?(r=i.toString(),n=Number(r)):i instanceof vs&&(r=i.name,"Type1"===t._fontType&&".notdef"===r?(r=" ",e.set(n.toString(),Dt(r))):(r=It(r=Dt(r)),e.has(n.toString())||e.set(n.toString(),Dt(r)),n++))})}}return e},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[i]){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}(),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)}}(),Oi=function(e){function i(t){var i=e.call(this)||this;return i._isImport=!1,i._isColorSpace=!1,i._isDuplicate=!1,i._isGroupingSupport=!1,null!==t&&void 0!==t&&(i._fileName=t),i}return Li(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){if(r=t._getValidString(r),t._jsonData.push(t._doubleQuotes),t._jsonData=f(r,!0,!1,t._jsonData),"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),t._jsonData=f(i,!0,!1,t._jsonData),t._jsonData.push(t._doubleQuotes);else{t._jsonData.push(t._doubleQuotes,t._colon,t._openingBracket);for(var n=0;n<i.length;n++){t._jsonData.push(t._doubleQuotes);var s=i[n];t._jsonData=f(s,!0,!1,t._jsonData),t._jsonData.push(t._doubleQuotes),n<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(),!0,!1,[]).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),!0,!1,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].x.toString()+","+s[0].y.toString()),this._table.set("end",s[1].x.toString()+","+s[1].y.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&&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&&"Measure"!==s){var o=void 0;if((o=a instanceof Ss?t.get(s):a)&&o instanceof Ts)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));break;default:r._writeDictionary(o,e,!1)}else(!n||n&&"S"!==s)&&r._writeAttribute(s,o,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",I(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=P(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 u=d.dictionary;if(u.has("Params")){var l=u.get("Params");if(l){if(l.has("CreationDate")){p=this._getValue(l.get("CreationDate"),!0);this._table.set("creation",p)}if(l.has("ModificationDate")){var p=this._getValue(l.get("ModificationDate"),!0);this._table.set("modification",p)}if(l.has("Size")&&this._table.set("size",this._getValue(l.get("Size"),!0)),l.has("CheckSum")){var g=P(f(p=this._getValue(l.get("CheckSum"),!0)));this._table.set("checksum",g)}}}var y=P(d.getBytes());y&&""!==y&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),u.has("Length")&&this._table.set("length",this._getValue(u.get("Length"),!0)),u.has("Filter")&&this._table.set("filter",this._getValue(u.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,n,s;switch(t){case"C":this._writeColor(e,"color","c");break;case"IC":this._writeColor(e,"interior-color");break;case"OC":this._writeColor(e,"oc");break;case"AFC":this._writeColor(e,"afc");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._table.has("title")||this._writeAttributeString("title",e);break;case"Rect":if(r=this._getValue(e,!0)){var a=r.split(","),o=new Map;o.set("x",a[0]),o.set("y",a[1]),o.set("width",a[2]),o.set("height",a[3]),this._table.set(t.toLowerCase(),this._convertToJson(o))}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 vs&&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 h=d(e);this._table.set("flags",h)}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"),_e(r)){var c=new Map;r.split(";").forEach(function(t){var e=t.split(":");e&&e.length>0&&e[0]&&e[0].length>1&&e[0].startsWith(" ")&&(e[0]=e[0].substring(1)),c.set(e[0],e[1])}),this._table.set("defaultStyle",this._convertToJson(c))}break;case"AllowedInteractions":if(e){var _=P(f(e,!1,!0)),u=new Map;u.set("encoding","hex"),u.set("bytes",_),this._table.set(t,this._convertToJson(u))}break;case"RC":if("string"==typeof(n=i.get("RC"))&&n.includes("<body")){var l=n.indexOf("<body");l>0&&(n=n.substring(l)),this._writeAttributeString("contents-richtext",n)}break;case"Type":case"Subtype":case"P":case"Parent":case"L":case"FS":case"MeasurementTypes":case"GroupNesting":case"ITEx":break;case"TextMarkupContent":s=f(e),this._writeAttributeString(t,P(s));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)&&e.length>0){var i=e.length;if(i%2==0){for(var r="",n=0;n<i-1;n++)r+=this._getValue(e[n],!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[n],!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&&(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"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("area",e[0]),t.has("D")&&(e=t.getArray("D"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("distance",e[0]),t.has("X")&&(e=t.getArray("X"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("xformat",e[0]),t.has("T")&&(e=t.getArray("T"))&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("tformat",e[0]),t.has("V"))){var e=t.getArray("V");e&&e.length>0&&e[0]&&this._exportMeasureFormatDetails("vformat",e[0])}},i.prototype._exportMeasureFormatDetails=function(t,e){var i=new Map;e&&(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)),f(this._convertToJson(e))},i.prototype._writeAppearanceDictionary=function(t,e){var i=this;e&&e.size>0&&e.forEach(function(r,n){("OC"===r&&n instanceof Array||"P"!==r&&"Parent"!==r&&"Dest"!==r&&"OC"!==r&&("AP"!==r||!i._isGroupingSupport))&&i._writeObject(t,n instanceof Ss?e.get(r):n,e,r)})},i.prototype._writeObject=function(t,e,i,r,n,s,a){if(void 0===s&&(s=!1),void 0===a&&(a=!1),e instanceof vs)e.name=this._getValidString(e.name),this._writeTable("name",e.name,t,r,n);else if(Array.isArray(e)){var o=[];"ColorSpace"===r||s?this._writeArray(o,e,i,!0):this._writeArray(o,e,i),this._isColorSpace=!1,this._writeTable("array",this._convertToJsonArray(o),t,r,n)}else if("string"==typeof e){var h=!1;if(-1!==e.indexOf("\t")&&(h=!0),"AllowedInteractions"===r||this._isColorSpace||(e=this._getValidString(e)),this._isColorSpace||"AllowedInteractions"===r||ge(e)||h){var c=P(w=f(e,!1,!0)),_=new Map;_.set("encoding","hex"),_.set("bytes",c),this._writeTable("string",this._convertToJson(_),t,r,n),h=!1}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 Ts){var d=new Map;this._writeAppearanceDictionary(d,e),this._writeTable("dict",this._convertToJson(d),t,r,n)}else if(e instanceof Rs&&e.dictionary){var u=new Map,l=new Map,p=e.dictionary,g=void 0,y=e,m=!1;if(p.has("Subtype")&&"Image"===p.get("Subtype").name&&(m=!0),a&&m)g=e.dictionary.has("Filter")&&"DCTDecode"===e.dictionary.get("Filter").name?e.getString(!0):ue(e,!0);else if(m&&y.stream)if(y.stream instanceof Fs)if("boolean"==typeof y._initialized&&y._cipher){v=y.stream.end-y.stream.start;y.getBytes(v);w=y.buffer.subarray(0,y.bufferLength);g=y.getString(!0,w)}else{S=y.stream;g=y.getString(!0,S.getByteRange(S.start,S.end))}else if(y.stream.stream){var b=y.stream;if(b.stream instanceof Fs&&"boolean"==typeof b._initialized&&b._cipher){var v=b.stream.end-b.stream.start;b.getBytes(v);var w=b.buffer.subarray(0,b.bufferLength);g=b.getString(!0,w)}else if(b.stream instanceof Fs){var S=b.stream;g=b.getString(!0,S.getByteRange(S.start,S.end))}}else g=e.getString(!0);else g=e.getString(!0);!p.has("Length")&&g&&""!==g&&p.update("Length",e.length),this._writeAppearanceDictionary(l,p);var x=void 0;p.has("Subtype")&&(x=this._getValue(p.get("Subtype"))),!p.has("Type")&&!p.has("Subtype")||p.has("Subtype")&&("Image"===x||"Form"===x||"CIDFontType0C"===x||"OpenType"===x)?(u.set("mode","raw"),u.set("encoding","hex")):(u.set("mode","filtered"),u.set("encoding","ascii")),g&&""!==g&&u.set("bytes",g),l.set("data",this._convertToJson(u)),this._writeTable("stream",this._convertToJson(l),t,r,n)}else e instanceof Ss&&this._crossReference?this._writeObject(t,this._crossReference._fetch(e),i,r,n,s,e._isNew):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,r){var n=this;void 0===r&&(r=!1),e.forEach(function(e){r&&"string"==typeof e&&(n._isColorSpace=!0),n._writeObject(null,e,i,null,t,r)})},i.prototype._convertToJson=function(t){var e=this,i=0,r="{";return t.forEach(function(n,s){var a=n.startsWith("{")&&n.endsWith("}"),o=n.startsWith("[")&&n.endsWith("]")&&e._isValidJsonArray(n);r+=a||o?'"'+s+'":'+n:'"'+s+'":"'+n+'"',i<t.size-1&&(r+=","),i++}),r+"}"},i.prototype._isValidJsonArray=function(t){try{return JSON.parse('{"test":'+t+"}"),!0}catch(t){return!1}},i.prototype._convertToJsonArray=function(t){for(var e="[",i=0;i<t.length;i++)e+=this._convertToJson(t[i]),i<t.length-1&&(e+=",");return e+"]"},i.prototype._parseJson=function(t,e){this._document=t,this._crossReference=t._crossReference;var i=v(e,!0);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[t],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;this._isImport=!0;var r=this._parseJson(t,e);if(r&&-1!==Object.keys(r).indexOf("pdfAnnotation")){var n=r.pdfAnnotation,s=t.pageCount,a=Object.keys(n);a&&a.length>0&&a.forEach(function(e){var r=Number(e);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&&(Array.isArray(c)?c:Object.keys(c).map(function(t){return c[t]})).forEach(function(t){var e=Object.keys(t);if(e&&e.length>0&&-1!==e.indexOf("type")){var r=new Ts(i._crossReference);r.update("Type",vs.get("Annot"));var n=!0;switch(t.type.toLowerCase()){case"line":r.update("Subtype",vs.get("Line"));break;case"circle":r.update("Subtype",vs.get("Circle"));break;case"square":r.update("Subtype",vs.get("Square"));break;case"polyline":r.update("Subtype",vs.get("PolyLine"));break;case"polygon":r.update("Subtype",vs.get("Polygon"));break;case"ink":r.update("Subtype",vs.get("Ink"));break;case"popup":r.update("Subtype",vs.get("Popup"));break;case"text":r.update("Subtype",vs.get("Text"));break;case"freetext":r.update("Subtype",vs.get("FreeText"));break;case"stamp":r.update("Subtype",vs.get("Stamp"));break;case"highlight":r.update("Subtype",vs.get("Highlight"));break;case"squiggly":r.update("Subtype",vs.get("Squiggly"));break;case"underline":r.update("Subtype",vs.get("Underline"));break;case"strikeout":r.update("Subtype",vs.get("StrikeOut"));break;case"fileattachment":r.update("Subtype",vs.get("FileAttachment"));break;case"sound":r.update("Subtype",vs.get("Sound"));break;case"redact":r.update("Subtype",vs.get("Redact"));break;case"caret":r.update("Subtype",vs.get("Caret"));break;case"link":r.update("Subtype",vs.get("Link"));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),o._comments&&o._comments.length>0&&(o._comments=[]),s.set("Annots",o._annotations),s._updated=!0,o._parsedAnnotations.set(_,h),i._handlePopup(o,c,r,s)}}}}})}}}}),this._groupHolders.length>0&&this._groupHolders.forEach(function(t){var e=t.get("IRT");e&&""!==e&&(i._groupReferences.has(e)?t.update("IRT",i._groupReferences.get(e)):delete t._map.IRT)}),this._groupHolders=[],this._groupReferences=new Map}},i.prototype._addAnnotationData=function(e,i,r){var n,s,a,o,h,c=this,_=new Ts(this._crossReference),d=new Ts(this._crossReference),l=new Map,f=[],p="";if(r.forEach(function(r){var g,y=i[r];switch(r.toLowerCase()){case"start":case"end":c._addLinePoints(y,f),4===f.length&&(e.update("L",f),f=[]);break;case"itex":break;case"state":c._addString(e,"State",y);break;case"statemodel":c._addString(e,"StateModel",y);break;case"replytype":"group"===y.toLowerCase()&&e.update("RT",vs.get("Group"));break;case"inreplyto":c._addString(e,"IRT",y);break;case"dashes":case"width":case"intensity":case"style":c._addBorderStyle(r,y,_,d);break;case"rect":if(a=y){var m=[];m.push(Number.parseFloat(a.x)),m.push(Number.parseFloat(a.y)),m.push(Number.parseFloat(a.width)),m.push(Number.parseFloat(a.height)),m&&4===m.length&&e.update("Rect",m)}break;case"color":(y=N(y))&&3===y.length?e.update("C",[y[0]/255,y[1]/255,y[2]/255]):y&&3===Object.keys(y).length&&e.update("C",[y.r/255,y.g/255,y.b/255]);break;case"oc":y&&"Redact"===e.get("Subtype").name&&((y=N(y))&&3===y.length?e.update("OC",[y[0]/255,y[1]/255,y[2]/255]):y&&3===Object.keys(y).length&&e.update("OC",[y.r/255,y.g/255,y.b/255]));break;case"afc":(y=N(y))&&3===y.length?e.update("AFC",[y[0]/255,y[1]/255,y[2]/255]):y&&3===Object.keys(y).length&&e.update("AFC",[y.r/255,y.g/255,y.b/255]);break;case"interior-color":(y=N(y))&&3===y.length?e.update("IC",[y[0]/255,y[1]/255,y[2]/255]):y&&3===Object.keys(y).length&&e.update("IC",[y.r/255,y.g/255,y.b/255]);break;case"date":c._addString(e,"M",y);break;case"creationdate":c._addString(e,"CreationDate",y);break;case"name":c._addString(e,"NM",y);break;case"uri":(o=new Ts(c._crossReference)).update("Type",new vs("Action")),o.update("S",new vs("URI")),o.update("URI",y),h=c._crossReference._getNextReference(),c._crossReference._cacheMap.set(h,o),e.update("A",h);break;case"icon":y&&e.update("Name",vs.get(y));break;case"subject":c._addString(e,"Subj",y);break;case"title":c._addString(e,"T",y);break;case"rotation":e.update("Rotate",Number.parseFloat(y));break;case"fringe":c._addFloatPoints(e,"RD",c._parseFloatPoints(y));break;case"it":y&&e.update("IT",vs.get(y));break;case"leaderlength":e.update("LL",Number.parseFloat(y));break;case"leaderextend":e.update("LLE",Number.parseFloat(y));break;case"caption":c._addBoolean(e,"Cap",y.toLowerCase());break;case"caption-style":y&&e.update("CP",vs.get(y));break;case"callout":c._addFloatPoints(e,"CL",c._parseFloatPoints(y));break;case"coords":c._addFloatPoints(e,"QuadPoints",c._parseFloatPoints(y));break;case"border":c._addFloatPoints(e,"Border",c._parseFloatPoints(y));break;case"opacity":e.update("CA",Number.parseFloat(y));break;case"defaultstyle":if(y){var b=Object.keys(y);if(b&&b.length>0){var w="",S=0;b.forEach(function(t){var e=y[t];w+=t+":"+e,S<b.length-1&&(w+=";"),S++}),c._addString(e,"DS",w)}}break;case"defaultappearance":c._addString(e,"DA",y);break;case"contents-richtext":"string"==typeof y&&c._addString(e,"RC",y);break;case"flags":if(y&&"string"==typeof y){var x=t.PdfAnnotationFlag.default;y.split(",").forEach(function(t,e){var i=u(t);0===e?x=i:x|=i}),e.update("F",x)}break;case"open":c._addBoolean(e,"Open",y.toLowerCase());break;case"repeat":c._addBoolean(e,"Repeat",y.toLowerCase());break;case"overlaytext":c._addString(e,"OverlayText",y);break;case"contents":"string"==typeof y&&(-1!==y.indexOf("\\r")&&(y=y.replace("\\r","\r")),y&&c._addString(e,"Contents",y));break;case"q":e.update("Q",Number(y));break;case"inklist":if(y){var P=Object.keys(y);if(P&&P.length>0&&-1!==P.indexOf("gesture")){var T=y.gesture;T&&T.length>0&&e.update("InkList",T)}}break;case"head":n=y;break;case"tail":s=y;break;case"creation":case"modification":case"file":case"bits":case"channels":case"encoding":case"rate":case"length":case"filter":case"mode":case"size":l.set(r,y);break;case"data":p=y;break;case"vertices":if(y&&"string"==typeof y){var C=y.split(/[,;]/);if(C&&C.length>0){var k=C.map(function(t){return Number(t)});k.length>0&&k.length%2==0&&e.update("Vertices",k)}}break;case"appearance":c._addAppearanceData(e,y);break;case"allowedinteractions":if(y)if(y&&"string"==typeof y)c._addString(e,"AllowedInteractions",y);else{var R=Object.keys(y);if(R&&R.length>0)if(-1!==R.indexOf("encoding")&&-1!==R.indexOf("bytes")){var F=y.bytes;"hex"===y.encoding&&(y=v(A(F,!1),!0),c._addString(e,"AllowedInteractions",y))}else if(-1!==R.indexOf("unicodeData")){var I=JSON.stringify(y.unicodeData);I=I.substring(1,I.length-1),y=v(A(I,!1),!0),c._addString(e,"AllowedInteractions",y)}}break;default:if(c._document._allowImportCustomData&&"type"!==r&&"page"!==r){var D=void 0;if("string"!=typeof y||-1===y.indexOf(":")||y.startsWith("{")||y.endsWith("}"))D="string"==typeof y?y:JSON.stringify(y);else{var B=y.split(":");D=Array.isArray(B)&&2===B.length?JSON.stringify((g={},g[B[0]]=B[1],g)):y}c._addString(e,r,D)}}}),this._addMeasureDictionary(e,i,r),n?s?e.update("LE",[vs.get(n),vs.get(s)]):e.update("LE",n):s&&e.update("LE",s),d.size>0){d.update("Type",vs.get("Border"));g=this._crossReference._getNextReference();d.objId=g.objectNumber+" "+g.generationNumber,this._crossReference._cacheMap.set(g,d),e.update("BS",g)}if(_.size>0){var g=this._crossReference._getNextReference();d.objId=g.objectNumber+" "+g.generationNumber,this._crossReference._cacheMap.set(g,_),e.update("BE",g)}this._addStreamData(e,l,p)},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",vs.get(n)):i.update("S",vs.get(n)))},i.prototype._parseFloatPoints=function(t){return t.split(",").map(function(t){return Number.parseFloat(t)})},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 Ts(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",vs.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 Ts(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",vs.get(r));break;case"fd":i.set("FD",r);break;case"type":i.set("Type",vs.get(r))}}),i},i.prototype._addStreamData=function(t,e,i){var r=this,n=t.get("Subtype").name,s=A(i,!0);if("Sound"===n){var a=new Is(s);a.dictionary._crossReference=this._crossReference,a.dictionary.update("Type",vs.get("Sound")),e.forEach(function(t,e){if(e&&t)switch(e){case"bits":case"rate":case"channels":a.dictionary.set(e,Number(t));break;case"encoding":a.dictionary.set("E",vs.get(t));break;case"filter":a.dictionary.set("Filter",vs.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 Ts(this._crossReference);o.update("Type",vs.get("Filespec"));var h=new Is(s);h.dictionary._crossReference=this._crossReference;var c=new Ts(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(t))&&(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",vs.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 Ts(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=v(R(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=vs.get(t.name);else if(-1!==r.indexOf("int"))e=Number(t.int);else if(-1!==r.indexOf("fixed"))e=Number.parseFloat(t.fixed);else if(-1!==r.indexOf("string"))if("string"==typeof t.string)e=t.string;else{var n=t.string.bytes;"hex"===t.string.encoding&&(e=v(A(n,!1),!1))}else if(-1!==r.indexOf("boolean"))e="true"===t.boolean;else if(-1!==r.indexOf("array")){var s=t.array;e=[],s.forEach(function(t){e.push(i._parseAppearance(t))})}else if(-1!==r.indexOf("dict")){var a=this._parseDictionary(t.dict);a.size>0?(e=this._crossReference._getNextReference(),a.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,a)):e=new Ts(this._crossReference)}else if(-1!==r.indexOf("stream")){var o=this._parseStream(t.stream);e=this._crossReference._getNextReference(),o.reference=e,o.dictionary.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,o)}else e=-1!==r.indexOf("unicodeData")?v(A(t.unicodeData,!1),!0):null;return e},i.prototype._parseDictionary=function(t){var e=this,i=new Ts(this._crossReference);if(t){var r=Object.keys(t);r&&r.length>0&&r.forEach(function(r){var n=t[r];if("data"!==r){r=w(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=A(a,!0))}}n||(n=[]);var o=new Is(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||this._isImport&&t._isCompress?(t._isCompress=!1,r||delete i._map.Filter):(i.has("Length")&&delete i._map.Length,i.has("Filter")&&delete i._map.Filter),t.dictionary=i}},i.prototype._getValidString=function(t){return null===t?t:(t=t.replace(/\\/g,"\\\\"),t=t.replace(/"/g,'\\"'),t=t.replace(/\n/g,"\\n"),t=t.replace(/\r/g,"\\r"),t=t.replace(/\t/g,"\\t"),t=t.replace(/\u0008/g,"\\b"),t=t.replace(/\f/g,"\\f"),t=t.replace(/[\u0000-\u0007\u000B\u000E-\u001F\u007F]/g,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))},i}(Ii),Mi=function(){function t(t,e){if(this._isExported=!1,this._isResourceExport=!1,this._isSignature=!1,this._isNew=!1,e&&(this._crossReference=e),null===t||void 0===t)this._isReadOnly=!0;else if(t instanceof Rs){if(this._content=t,this._content.dictionary.has("Type")&&this._content.dictionary.has("Subtype")||this._initialize(),(r=this._content.dictionary.getArray("BBox"))&&r.length>3){var i=O(r);this._size={width:i.width,height:i.height},this._templateOriginalSize=this._size}this._isReadOnly=!0}else if(Array.isArray(t))this._size={width:t[2],height:t[3]},this._content=new Is([]),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]]);else if(null!==t.width&&null!==t.height&&void 0!==t.width&&void 0!==t.height){var r=void 0,n=t;r=null!==n.x&&void 0!==n.x&&null!==n.y&&void 0!==n.y?{x:n.x,y:n.y,width:n.width,height:n.height}:{x:0,y:0,width:n.width,height:n.height},this._size={width:r.width,height:r.height},this._content=new Is([]),this._crossReference?this._content.dictionary._crossReference=this._crossReference:this._isNew=!0,this._initialize(),this._content.dictionary.set("BBox",[r.x,r.y,r.x+r.width,r.y+r.height])}this._writeTransformation=!0}return Object.defineProperty(t.prototype,"graphics",{get:function(){return this._isReadOnly?null:(void 0===this._g&&(this._g=new Gn(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}),Object.defineProperty(t.prototype,"_originalSize",{get:function(){return this._templateOriginalSize},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this._content.dictionary.set("Type",vs.get("XObject")),this._content.dictionary.set("Subtype",vs.get("Form"))},t.prototype._exportStream=function(t,e,i){var r=new Oi;r._crossReference=e,r._isAnnotationExport=!0;var n=new Map;r._writeObject(n,t.get(i),t,"normal"),this._appearance=r._convertToJson(n),r._dispose()},t.prototype._importStream=function(t,e){var i=new Oi;t&&(i._crossReference=this._crossReference);var r=JSON.parse(this._appearance);if(r){var n=r[e?"resources":"normal"];if(n)if(e){var s=i._parseDictionary(n.dict);t&&this._content.dictionary.update("Resources",s)}else this._content=i._parseStream(n.stream),t&&(this._content.dictionary._crossReference=this._crossReference,this._content.dictionary._updated=!0)}i._dispose()},t.prototype._updatePendingResource=function(t){if(this._content._pendingResources&&""!==this._content._pendingResources){var e=new Oi;e._crossReference=t,e._parseStreamElements(this._content),this._content._pendingResources="",e._dispose()}},t}(),Ei=function(){function e(e,i){this.horizontalScalingFactor=100,this.rightToLeft=!1,this._wordWrapType=t._PdfWordWrapType.word,this._isList=!1,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 Ni=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)}}(),ji=function(){function t(){}return t}(),Vi=function(){function t(){}return t}(),zi=function(t){function e(e){var i=t.call(this)||this;return i.widths=e,i}return Ni(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[t]},e.prototype._toArray=function(){return this.widths},e}(Vi),Ui=function(t){function e(e){var i=t.call(this)||this;return i._defaultWidth=e,i.widths=[],i}return Ni(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}(Vi),Hi=function(){function t(){}return t}(),Wi=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 Ni(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}(Hi),qi=function(t){function e(e,i){var r=t.call(this)||this;return r._widthFrom=e,r._widths=i,r}return Ni(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[t]},e.prototype._appendToArray=function(t){t.push(this._from),t.forEach(function(e){t.push(e)})},e}(Hi),Gi=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 Ji(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 Ki,e=new Ki,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._getHeight();return this._format&&0!==this._format.lineSpacing&&(t=this._format.lineSpacing+this._font._getHeight()),t},e.prototype._getLineWidth=function(t){return this._font.getLineWidth(t,this._format)},e.prototype._layoutLine=function(e,i){var r=new Ki;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,u=new Ji(e),l=u._peekWord();for(l.length!==u._length&&" "===l&&(_+=l,c+=l,u._position+=1,l=u._peekWord());null!==l;){_+=l;var f=this._getLineWidth(_.toString())+d;if(" "===_.toString()&&(_="",f=0),f>s){if(this._getWrapType()===t._PdfWordWrapType.none)break;if(_.length===l.length){if(this._getWrapType()===t._PdfWordWrapType.wordOnly){r._remainder=e.substring(u._position);break}if(1===_.length){c+=l;break}h=!1,_="",l=u._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=u._peek().toString();else{var p=c.toString();" "!==p&&this._addToLineResult(r,n,p,a,t._LineType.layoutBreak|o),_="",c="",a=0,d=0,f=0,o=t._LineType.none,l=h?l:u._peekWord(),h=!0}}else c+=l,a=f,h?(u._readWord(),l=u._peekWord()):(u._read(),l=u._peek().toString())}c.length>0&&this._addToLineResult(r,n,c.toString(),a,t._LineType.newLineBreak|t._LineType.lastParagraphLine),u._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 Xi;s._text=i,s._width=r,s._lineType=n,e.push(s);var a=t._actualSize;a.height=a.height+this._getLineHeight(),a.width=Math.max(a.width,r),t._size=a},e.prototype._copyToResult=function(t,e,i,r){var n=!0,s=this._format&&!this._format.lineLimit,a=t._actualSize.height,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(!(Math.floor(_)<=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 u=t._actualSize;if(u.width=Math.max(u.width,d._width),t._size=u,_>=o&&o>0&&this._format&&!this._format.noClip&&!this._format.lineLimit){var l=_-o;a+=e._lineHeight-l,n=!1;break}a=_}return a!==t._size.height&&(t._size={width:t._actualSize.width,height: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}(),Ki=function(){function t(){}return Object.defineProperty(t.prototype,"_actualSize",{get:function(){return void 0===this._size&&(this._size={width:0,height: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}(),Xi=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 Ji=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}(),Yi=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}(),Qi=function(){function t(){}return t}(),Zi=function(){function t(){}return t}(),$i=function(){function t(){}return t}(),tr=function(){function t(){}return t}(),er=function(){function t(){}return t}(),ir=function(){function t(){}return t}(),rr=function(){function t(){}return t}(),nr=function(){function t(){}return t}(),sr=function(){function t(){}return t}(),ar=function(){function t(){}return t}(),or=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._isOpenType=!1,this._fontData=t,this._initialize()}return Object.defineProperty(e.prototype,"macintosh",{get:function(){return null!==this._macintoshDictionary&&void 0!==this._macintoshDictionary||(this._macintoshDictionary=new As),this._macintoshDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoft",{get:function(){return null!==this._microsoftDictionary&&void 0!==this._microsoftDictionary||(this._microsoftDictionary=new As),this._microsoftDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_macintoshGlyphs",{get:function(){return null!==this._internalMacintoshGlyphs&&void 0!==this._internalMacintoshGlyphs||(this._internalMacintoshGlyphs=new As),this._internalMacintoshGlyphs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_microsoftGlyphs",{get:function(){return null!==this._internalMicrosoftGlyphs&&void 0!==this._internalMicrosoftGlyphs||(this._internalMicrosoftGlyphs=new As),this._internalMicrosoftGlyphs},enumerable:!0,configurable:!0}),e.prototype._initialize=function(){void 0!==this._metrics&&null!==this._metrics||(this._metrics=new cr),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 As);for(var e=0;e<t;++e){var i=new Yi,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=this,e=Number.MAX_VALUE,i=this._tableDirectory.keys(),r=0;r<i.length;r++){var n=this._tableDirectory.getValue(i[r])._offset;if(e>n&&(e=n)<=this._lowestPosition)break}var s=e-this._lowestPosition;if(0!==s){var a=new As;i.forEach(function(e){var i=t._tableDirectory.getValue(e);i._offset-=s,a.setValue(e,i)}),this._tableDirectory=a}},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 1330926671===t&&(this._isOpenType=!0),t},e.prototype._readNameTable=function(){var t=this._getTable("name");void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset);var e=new $i;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 hr;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[r]=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 ir;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 er;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 Qi;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 Zi;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 _r;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 rr;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 nr;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[n]=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 sr;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 dr;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 tr;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[_];d<=s._endCount[_]&&65535!==d;d++){if(0===s._idRangeOffset[_])h=d+s._idDelta[_]&65535;else{if((c=_+s._idRangeOffset[_]/2-a+d-s._startCount[_])>=s._glyphID.length)continue;h=s._glyphID[c]+s._idDelta[_]&65535}var u=new dr;u._index=h,u._width=this._getWidth(u._index);var l=i===t._TrueTypeCmapEncoding.symbol&&61440==(65280&d)?255&d:d;u._charCode=l,n.setValue(l,u),this._addGlyph(u,i)}},e.prototype._readTrimmedCmapTable=function(t,e){var i=this._getTable("cmap");this._offset=i._offset+t._offset;var r=new ar;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 dr;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._readCompactFontFormatTable=function(){var t=this._getTable("CFF ");return void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),this._readBytes(t._length)},e.prototype._initializeFontName=function(t){for(var e=0;e<t._recordsCount;e++){var i=t._nameRecords[e];if(1===i._nameID?this._metrics._fontFamily=i._name:6===i._nameID&&(this._metrics._postScriptName=i._name),null!==this._metrics._fontFamily&&void 0!==this._metrics._fontFamily&&null!==this._metrics._postScriptName&&void 0!==this._metrics._postScriptName)break}},e.prototype._getTable=function(t){var e,i=new Yi;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[t]},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}e&&void 0!==e._index&&r.setValue(e._index,e)},e.prototype._initializeMetrics=function(e,i,r,n,s,a){var o=this;this._initializeFontName(e);var h=!1;h=a.some(function(e){return o._getCmapEncoding(e._platformID,e._encodingID)===t._TrueTypeCmapEncoding.symbol}),this._metrics._isSymbol=h,this._metrics._macStyle=i._macStyle,this._metrics._isFixedPitch=0!==s._isFixedPitch,this._metrics._italicAngle=s._italicAngle;var c=1e3/i._unitsPerEm;this._metrics._winAscent=n._sTypoAscender*c,this._metrics._macAscent=r._ascender*c,this._metrics._capHeight=0!==n._sCapHeight?n._sCapHeight:.7*i._unitsPerEm*c,this._metrics._winDescent=n._sTypoDescender*c,this._metrics._macDescent=r._descender*c,this._metrics._leading=(n._sTypoAscender-n._sTypoDescender+n._sTypoLineGap)*c,this._metrics._lineGap=Math.ceil(r._lineGap*c);var _=i._xMin*c,d=Math.ceil(this._metrics._macAscent+this._metrics._lineGap),u=i._xMax*c,l=this._metrics._macDescent;this._metrics._fontBox=[_,d,u,l],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(n));t[n]=e._empty?0:e._width}else for(var i=[],r=String.fromCharCode(32),n=0;n<256;n++){i[0]=n;var s=this._getString(i,0,i.length),a=s.length>0?s[0]:"?";(e=this._getGlyph(a))._empty?(e=this._getGlyph(r),t[n]=e._empty?0:e._width):t[n]=e._width}return t},e.prototype._getDefaultGlyph=function(){return this._getGlyph(Ji._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});var s=0;n.forEach(function(t){e._offsets.length>0&&(s+=e._offsets[t+1]-e._offsets[t])});var a=this._align(s);r=[];for(_=0;_<a;_++)r.push(0);for(var o=0,h=0,c=this._getTable("glyf"),_=0;_<e._offsets.length;_++)if(i.push(o),h<n.length&&n[h]===_){++h,i[_]=o;var d=e._offsets[_],u=e._offsets[_+1]-d;u>0&&(this._offset=c._offset+d,r=this._read(r,o,u).buffer,o+=u)}return{glyphTableSize:s,newLocaTable:i,newGlyphTable:r}},e.prototype._readLocaTable=function(t){var e=this._getTable("loca");this._offset=e._offset;var i=new ur,r=[];if(t){n=e._length/2;r=[];for(s=0;s<n;s++)r[s]=2*this._readUInt16(this._offset)}else{var n=e._length/4;r=[];for(var s=0;s<n;s++)r[s]=this._readUInt32(this._offset)}return i._offsets=r,i},e.prototype._updateGlyphChars=function(t,e){var i=this;t.containsKey(0)||t.setValue(0,0);var r=new As,n=t.keys();n.forEach(function(e){r.setValue(e,t.getValue(e))}),n.forEach(function(r){i._processCompositeGlyph(t,r,e)})},e.prototype._processCompositeGlyph=function(e,i,r){if(i<r._offsets.length-1){var n=r._offsets[i];if(n!==r._offsets[i+1]){var s=this._getTable("glyf");this._offset=s._offset+n;var a=new lr;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){var i=e?2*t.length:4*t.length,r=this._align(i),n=new fr(r);return t.forEach(function(t){e?(t/=2,n._writeShort(t)):n._writeInt(t)}),{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 fr(s);o._writeInt(65536),o._writeShort(a);var h=this._entrySelectors[a];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=this,n=0;return null!==t&&void 0!==t&&t.length>0&&null!==e&&void 0!==e&&e.length>0&&(i=2,this._tableNames.forEach(function(t){if("glyf"!==t&&"loca"!==t){var e=r._getTable(t);e._empty||(++i,n+=r._align(e._length))}}),n+=t.length,n+=e.length,n+=16*i+12),{fontProgramLength:n,table:i}},e.prototype._getGlyphChars=function(t){var e=this,i=new As;return null!==t&&void 0!==t&&t.keys().forEach(function(t){var r=e._getGlyph(t);r._empty||i.setValue(r._index,t.charCodeAt(0))}),i},e.prototype._writeCheckSums=function(t,e,i,r,n,s){var a=this;if(null!==t&&void 0!==t&&null!==i&&void 0!==i&&i.length>0&&null!==r&&void 0!==r&&r.length>0){var o=16*e+12,h=0;this._tableNames.forEach(function(e){var c=a._getTable(e);if(!c._empty){if(t._writeString(e),"glyf"===e){_=a._calculateCheckSum(r);t._writeInt(_),h=n}else if("loca"===e){var _=a._calculateCheckSum(i);t._writeInt(_),h=s}else t._writeInt(c._checksum),h=c._length;t._writeUInt(o),t._writeUInt(h),o+=a._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){var r=this;null!==t&&void 0!==t&&null!==e&&void 0!==e&&e.length>0&&null!==i&&void 0!==i&&i.length>0&&this._tableNames.forEach(function(n){var s=r._getTable(n);if(!s._empty)if("glyf"===n)t._writeBytes(i);else if("loca"===n)t._writeBytes(e);else{for(var a=r._align(s._length),o=[],h=0;h<a;h++)o.push(0);r._offset=s._offset;var c=r._read(o,0,s._length);t._writeBytes(c.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 cr;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!==Ji._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!0)):r!==Ji._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!1),t===Ji._whiteSpace&&null===i&&(i=new dr);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[t+3],i=this._fontData[t+2],r=this._fontData[t+1],n=this._fontData[t];return this._offset+=4,e+(i<<8)+(r<<16)+(n<<24)},e.prototype._readUInt32=function(t){var e=this._fontData[t+3],i=this._fontData[t+2],r=this._fontData[t+1],n=this._fontData[t];return this._offset+=4,e|i<<8|r<<16|n<<24},e.prototype._readInt16=function(t){var e=(this._fontData[t]<<8)+this._fontData[t+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[t]<<8|this._fontData[t+1];return this._offset+=2,e},e.prototype._readUShortArray=function(t){for(var e=[],i=0;i<t;i++)e[i]=this._readUInt16(this._offset);return e},e.prototype._readBytes=function(t){for(var e=[],i=0;i<t;i++)e.push(this._fontData[this._offset]),this._offset+=1;return e},e.prototype._readByte=function(t){var e=this._fontData[t];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[i],n=this._getGlyph(r);n._empty||(e+=String.fromCharCode(n._index))}return e},e}(),hr=function(){function t(){}return t}(),cr=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}(),_r=function(){function t(){}return t}(),dr=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}(),ur=function(){function t(){}return t}(),lr=function(){function t(){}return t}(),fr=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[e]=t[i],e++;this._internalPosition+=t.length}},t}(),pr=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");null!==e&&void 0!==e&&(this._fontSize=e),this._fontData="string"==typeof t?R(t):t,this._ttfReader=new or(this._fontData),this._ttfMetrics=this._ttfReader._metrics}return e.prototype._beginSave=function(){this._descendantFontBeginSave(),this._cmapBeginSave(),this._fontDictionaryBeginSave(),this._fontProgramBeginSave(),this._fontDescriptor&&(this._fontDescriptor.update(this._ttfMetrics._contains?"FontFile3":"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&&!this._fontDictionary.has("ToUnicode")&&this._fontDictionary.update("ToUnicode",this._cmap)},e.prototype._createInternals=function(){this._fontDictionary=new Ts,this._descendantFont=new Ts,this._metrics=new ji,this._ttfReader._createInternals(),this._usedChars=null;var t=[];this._fontProgram=new Fs(t,new Ts),this._cmap=new Fs(t,new Ts),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._name=t._fontFamily,this._metrics._postScriptName=t._postScriptName,this._metrics._widthTable=new zi(t._widthTable),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[i]}return t+="+",(t+=this._ttfReader._metrics._postScriptName).toString()},e.prototype._createDescendantFont=function(){this._descendantFont=new Ts,this._descendantFont._updated=!0,this._descendantFont.set("Type",new vs("Font")),this._descendantFont.set("Subtype",new vs("CIDFontType2")),this._descendantFont.set("BaseFont",new vs(this._subsetName)),this._descendantFont.set("CIDToGIDMap",new vs("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 Ts,e=this._ttfReader._metrics;return t.set("Type",new vs("FontDescriptor")),t.set("FontName",new vs(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 As:this._usedChars,this._ttfReader._setOffset(0),this._ttfReader._isOpenType&&this._ttfMetrics._contains?(t=this._ttfReader._readCompactFontFormatTable(),this._fontProgram.dictionary.update("Subtype",vs.get("CIDFontType0C"))):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(){var t=this;if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var e=this._ttfReader._getGlyphChars(this._usedChars);if(e._size()>0){var i=e.keys().sort(),r=i[0],n=i[i.length-1],s=this._toHexString(r,!1)+this._toHexString(n,!1)+"\r\n",a="";a+=this._cmapPrefix,a+=s,a+=this._cmapEndCodeSpaceRange;var o=0;i.forEach(function(r,n){0===o&&(0!==n&&(a+=t._cmapEndRange),o=Math.min(100,i.length-n),a+=o,a+=" ",a+=t._cmapBeginRange),o-=1,a+=t._toHexString(r,!0)+t._toHexString(r,!0),a+=t._toHexString(e.getValue(r),!0)+"\n"}),a+=this._cmapSuffix,this._cmap._clearStream(),this._cmap._write(a)}}},e.prototype._createFontDictionary=function(){this._fontDictionary._updated=!0,this._fontDictionary.set("Type",vs.get("Font")),this._fontDictionary.set("Subtype",vs.get("Type0")),this._fontDictionary.set("BaseFont",new vs(this._subsetName)),this._fontDictionary.set("Encoding",vs.get("Identity-H")),this._fontDictionary.set("DescendantFonts",this._descendantFont),this._fontDictionary._isFont=!0,this._fontDictionary._currentObj=this},e.prototype._createSystemInfo=function(){var t=new Ts;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){var e=this;null!==t&&void 0!==t&&(null!==this._usedChars&&void 0!==this._usedChars||(this._usedChars=new As),t.split("").forEach(function(t){e._usedChars.setValue(t,String.fromCharCode(0))}))},e.prototype._getDescendantWidth=function(){var t=this,e=new Array;if(null!==this._usedChars&&void 0!==this._usedChars&&this._usedChars._size()>0){var i=[];this._usedChars.keys().forEach(function(e){var r=t._ttfReader._getGlyph(e);i.push(r)}),i.sort(function(t,e){return t._index-e._index});var r=0,n=0,s=!1,a=new Array;i.forEach(function(t,o){s||(s=!0,r=t._index,n=t._index-1),(n+1!==t._index||o+1===i.length)&&i.length>1&&(e.push(Number(r)),0!==o&&e.push(a),r=t._index,a=new Array),a.push(Number(t._width)),o+1===i.length&&(e.push(Number(r)),e.push(a)),n=t._index})}return e},e}(),gr=function(){function t(){var t=this;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,this._arabicCharTable.forEach(function(e){t._arabicMapTable.set(e[0],e)})}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[r];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 yr,o=new yr;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 yr)._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}(),yr=function(){function t(){this._shapeValue="",this._shapeType="",this._shapeVowel="",this._shapeLigature=0,this._shapes=1}return t}(),mr=function(){function t(){this._indexes=[],this._indexLevels=[],this._mirroringShape=new As,this._update()}return t.prototype._doMirrorShaping=function(t){for(var e=[],i=0;i<t.length;i++)if(1==(1&this._indexLevels[i])&&this._mirroringShape.containsKey(t[i].charCodeAt(0))){var r=t[i].charCodeAt(0);e[i]=String.fromCharCode(this._mirroringShape.getValue(r))}else e[i]=t[i].toString();return e.join("")},t.prototype._getLogicalToVisualString=function(t,e){var i=new br;this._indexLevels=i._getVisualOrder(t,e),this._setDefaultIndexLevel(),this._doOrder(0,this._indexLevels.length-1);var r=this._doMirrorShaping(t);return this._indexes.map(function(t){return r[t]}).join("").toString()},t.prototype._setDefaultIndexLevel=function(){for(var t=0;t<this._indexLevels.length;t++)this._indexes[t]=t},t.prototype._doOrder=function(t,e){for(var i=this._indexLevels[t],r=i,n=i,s=i,a=t+1;a<=e;++a){var o=this._indexLevels[a];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[h]>=i);)h+=1;if(h>e)break;for(var c=h+1;c<=e&&!(this._indexLevels[c]<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[t];this._indexes[t]=this._indexes[e],this._indexes[e]=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}(),br=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[t],i=this._charTypes[++t],r=this._charTypes[++t];e<=i;)this._rtlCharacterTypes[e++]=r}return t.prototype._getVisualOrder=function(t,e){return this._type=this._getCharacterCode(t),this._textOrder=e?this.lre:this.L,this._doVisualOrder(),this._levels.slice()},t.prototype._getCharacterCode=function(t){for(var e=[],i=0;i<t.length;i++){var r=t[i].charCodeAt(0);e[i]=this._rtlCharacterTypes[r]}return e},t.prototype._setDefaultLevels=function(){for(var t=0;t<this._length;t++)this._levels[t]=this._textOrder},t.prototype._setLevels=function(){this._setDefaultLevels();for(var t=0;t<this._length;++t){var e=this._levels[t];this._levels[t]=e}},t.prototype._updateLevels=function(t,e,i){if(0==(1&e))for(r=t;r<i;++r)this._result[r]===this.R?this._levels[r]+=1:this._result[r]!==this.L&&(this._levels[r]+=2);else for(var r=t;r<i;++r)this._result[r]!==this.R&&(this._levels[r]+=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[e],r=0==(1&Math.max(t,i))?this.L:this.R,n=e+1;n<this._length&&this._levels[n]===i;)++n;var s=n<this._length?this._levels[n]: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[e]!==this.lre&&this._type[e]!==this.rle&&this._type[e]!==this.lro&&this._type[e]!==this.rlo&&this._type[e]!==this.pdf&&this._type[e]!==this.BN&&(this._result[t]=this._result[e],this._levels[t]=this._levels[e],t++);return t},t.prototype._checkEmbeddedCharacters=function(t){for(e=this._type.length-1;e>=0;--e)this._type[e]===this.lre||this._type[e]===this.rle||this._type[e]===this.lro||this._type[e]===this.rlo||this._type[e]===this.pdf||this._type[e]===this.BN?(this._result[e]=this._type[e],this._levels[e]=-1):(t-=1,this._result[e]=this._result[t],this._levels[e]=this._levels[t]);for(var e=0;e<this._type.length;e++)-1===this._levels[e]&&(this._levels[e]=this._levels[e-1])},t.prototype._check=function(t,e,i,r,n){for(var s=r,a=t;a<e;++a)this._result[a]===this.nsm?this._result[a]=s:s=this._result[a];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[s]===this.EN)for(var a=s-1;a>=t;--a)if(this._result[a]===this.L||this._result[a]===this.R||this._result[a]===this.AL){this._result[a]===this.AL&&(this._result[s]=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[s]===this.AL&&(this._result[s]=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[s]===this.ES||this._result[s]===this.CS){var a=this._result[s-1],o=this._result[s+1];a===this.EN&&o===this.EN?this._result[s]=this.EN:this._result[s]===this.CS&&a===this.AN&&o===this.AN&&(this._result[s]=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[s]===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[h]),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[s]!==this.ES&&this._result[s]!==this.ET&&this._result[s]!==this.CS||(this._result[s]=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[s]===this.EN){for(var a=r,o=s-1;o>=t;--o)if(this._result[o]===this.L||this._result[o]===this.R){a=this._result[o];break}a===this.L&&(this._result[s]=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[t],n=0;n<i.length;++n)r===i[n]&&(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[s]===this.WS||this._result[s]===this.ON||this._result[s]===this.B||this._result[s]===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[h])===this.AN&&(_=this.R),d=c===_?c:0==(1&i)?this.L:this.R;for(var u=a;u<h;++u)this._result[u]=d;s=h}},t}(),vr=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 gr)._shape(t),n=e._fontInternal._ttfReader;i=[r.length];for(var s=0,a=0,o=r.length;a<o;a++){var h=r[a],c=n._getGlyph(h);null!==c&&void 0!==c&&(i[s++]=c._index)}}var _=new Rr;return _._result=!0,_._glyphIndex=i,_},e.prototype._customLayout=function(e,i,r,n,s){var a=this;if(null===s||void 0===s){h=null;return null!==e&&void 0!==e&&null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none&&(h=(new mr)._getLogicalToVisualString(e,i)),h}var o="",h=[];if(null!==e&&void 0!==e&&null!==n&&void 0!==n){if(null!==r&&void 0!==r&&r.textDirection!==t.PdfTextDirection.none){var c=(new gr)._shape(e);o=this._customLayout(c,i,r)}if(s){var _=o.split("");h=_=_.map(function(t){return a._addCharacter(n,t)})}else(h=[])[0]=this._addCharacter(n,o)}return h},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=v(x(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}(),wr=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)}}(),Sr=function(){function e(t,e){this._lineGap=0,"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._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[s])&&n++;return n},e.prototype._getSize=function(e){var i=this._size;if(null!==e&&void 0!==e)switch(e.subSuperScript){case t.PdfSubSuperScript.subScript:i/=this._metrics._subScriptSizeFactor;break;case t.PdfSubSuperScript.superScript:i/=this._metrics._superscriptSizeFactor}return i},e.prototype._getHeight=function(t){var e=["cambria","candara","constantia","corbel","cariadings"],i=[];return i.push.apply(i,e),this._getDescent(t)<0?this._getAscent(t)-this._getDescent(t)+this._getLineGap(t):this._getAscent(t)+this._getDescent(t)+this._getLineGap(t)},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.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 Ei||null===e)&&void 0===i&&void 0===r){s=e;return this.measureString(t,s,0,0)}if("string"==typeof t&&(e instanceof Ei||null===e)&&"number"==typeof i&&"number"==typeof r){var s=e;return this.measureString(t,0,s,i,r)}if("string"==typeof t&&"number"==typeof e&&(i instanceof Ei||null===i)&&"number"==typeof r&&"number"==typeof n){a=i;return this.measureString(t,{width:e,height:0},a,r,n)}var a=i,o=e,h=(new Gi)._layout(t,this,a,[o.width,o.height]);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}(),xr=function(e){function i(i,r,n,s){var a=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return a._fontFamily=i,a._checkStyle(),a._initializeInternals(s),a}return wr(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),i.prototype.getLineWidth=function(t,e){var i=this,r=0;return t.split("").forEach(function(t){r+=i._getCharacterWidthInternal(t)}),r*=.001*this._size,r=this._applyFormatSettings(t,e,r)},i.prototype.getFont=function(t,e){return this._document?this._document.embedFont(this._fontFamily,t,e):new i(this._fontFamily,t,e)},i.prototype._checkStyle=function(){this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats||(this._style&=~(t.PdfFontStyle.bold|t.PdfFontStyle.italic))},i.prototype._initializeInternals=function(t){null!==t&&void 0!==t?(this._metrics=t.metrices,this._handleMetrics(),this._dictionary=t.dictionary):(this._metrics=Tr._getMetrics(this._fontFamily,this._style),this._handleMetrics(),this._dictionary=this._createInternals())},i.prototype._handleMetrics=function(){switch(this._fontFamily){case 0:this._handleHelveticaMetrics();break;case 1:this._handleCourierMetrics();break;case 2:this._handleTimesMetrics();break;case 3:this._handleSymbolMetrics();break;case 4:this._handleZapfDingbatsMetrics()}},i.prototype._handleHelveticaMetrics=function(){(this._style&t.PdfFontStyle.bold)>0&&(this._style&t.PdfFontStyle.italic)>0?(this._ascent=Tr._helveticaBoldItalicAscent,this._descent=Tr._helveticaBoldItalicDescent,this._height=this._ascent-this._descent):(this._style&t.PdfFontStyle.bold)>0?(this._ascent=Tr._helveticaBoldAscent,this._descent=Tr._helveticaBoldDescent,this._height=this._ascent-this._descent):(this._style&t.PdfFontStyle.italic)>0?(this._ascent=Tr._helveticaItalicAscent,this._descent=Tr._helveticaItalicDescent,this._height=this._ascent-this._descent):(this._ascent=Tr._helveticaAscent,this._descent=Tr._helveticaDescent,this._height=this._ascent-this._descent)},i.prototype._handleCourierMetrics=function(){(this._style&t.PdfFontStyle.bold)>0&&(this._style&t.PdfFontStyle.italic)>0?(this._ascent=Tr._courierBoldItalicAscent,this._descent=Tr._courierBoldItalicDescent,this._height=this._ascent-this._descent):(this._style&t.PdfFontStyle.bold)>0?(this._ascent=Tr._courierBoldAscent,this._descent=Tr._courierBoldDescent,this._height=this._ascent-this._descent):(this._style&t.PdfFontStyle.italic)>0?(this._ascent=Tr._courierItalicAscent,this._descent=Tr._courierItalicDescent,this._height=this._ascent-this._descent):(this._ascent=Tr._courierAscent,this._descent=Tr._courierDescent,this._height=this._ascent-this._descent)},i.prototype._handleTimesMetrics=function(){(this._style&t.PdfFontStyle.bold)>0&&(this._style&t.PdfFontStyle.italic)>0?(this._ascent=Tr._timesBoldItalicAscent,this._descent=Tr._timesBoldItalicDescent,this._height=this._ascent-this._descent):(this._style&t.PdfFontStyle.bold)>0?(this._ascent=Tr._timesBoldAscent,this._descent=Tr._timesBoldDescent,this._height=this._ascent-this._descent):(this._style&t.PdfFontStyle.italic)>0?(this._ascent=Tr._timesItalicAscent,this._descent=Tr._timesItalicDescent,this._height=this._ascent-this._descent):(this._ascent=Tr._timesAscent,this._descent=Tr._timesDescent,this._height=this._ascent-this._descent)},i.prototype._handleSymbolMetrics=function(){this._ascent=Tr._symbolAscent,this._descent=Tr._symbolDescent,this._height=this._ascent-this._descent},i.prototype._handleZapfDingbatsMetrics=function(){this._ascent=Tr._zapfDingbatsAscent,this._descent=Tr._zapfDingbatsDescent,this._height=this._ascent-this._descent},i.prototype._createInternals=function(){var e=new Ts;return e._updated=!0,e.set("Type",vs.get("Font")),e.set("Subtype",vs.get("Type1")),e.set("BaseFont",new vs(this._metrics._postScriptName)),this._fontFamily!==t.PdfFontFamily.symbol&&this._fontFamily!==t.PdfFontFamily.zapfDingbats&&e.set("Encoding",new vs("WinAnsiEncoding")),e},i.prototype._getCharacterWidthInternal=function(t){var e=t.charCodeAt(0);return"Helvetica"!==this._metrics._name&&"Courier"!==this._metrics._name&&"TimesRoman"!==this._metrics._name&&"Symbol"!==this._metrics._name&&"ZapfDingbats"!==this._metrics._name||(e-=32),e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}(Sr),Pr=function(e){function i(i,r,n,s){var a=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return a._fontFamily=i,a._size=r,null!==s&&void 0!==s?a._initializeInternals(s):a._initializeInternals(),a}return wr(i,e),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),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._size,i=this._applyFormatSettings(t,e,i)},i.prototype.getFont=function(t,e){return this._document?this._document.embedFont(this._fontFamily,t,e,!0):new i(this._fontFamily,t,e)},i.prototype._initializeInternals=function(t){t?(this._metrics=t.metrices,this._handleMetric(),this._dictionary=t.dictionary,this._dictionary.get("DescendantFonts")[0].set("FontDescriptor",kr._getFontDescriptor(this._fontFamily,this._style,this._metrics,this._ascent,this._descent))):(this._metrics=Cr._getMetrics(this._fontFamily,this._style),this._handleMetric(),this._dictionary=this._createInternals())},i.prototype._handleMetric=function(){switch(this._fontFamily){case 0:this._ascent=857,this._descent=-125,this._height=this._ascent-this._descent;break;case 1:this._ascent=857,this._descent=-143,this._height=this._ascent-this._descent;break;default:this._ascent=880,this._descent=-120,this._height=this._ascent-this._descent}},i.prototype._createInternals=function(){var t=new Ts;return t._updated=!0,t.set("Type",vs.get("Font")),t.set("Subtype",vs.get("Type0")),t.set("BaseFont",new vs(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 vs(i)},i.prototype._getDescendantFont=function(){var t=new Ts;return t._updated=!0,t.set("Type",vs.get("Font")),t.set("Subtype",vs.get("CIDFontType2")),t.set("BaseFont",new vs(this._metrics._postScriptName)),t.set("DW",this._metrics._widthTable._defaultWidth),t.set("W",this._metrics._widthTable._toArray()),t.set("FontDescriptor",kr._getFontDescriptor(this._fontFamily,this._style,this._metrics,this._ascent,this._descent)),t.set("CIDSystemInfo",this._getSystemInformation()),[t]},i.prototype._getSystemInformation=function(){var e=new Ts;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._getCharacterWidthInternal=function(t){return t=t>=0?t:0,this._metrics._widthTable._itemAt(t)},i}(Sr),Ar=function(e){function i(i,r,n,s){var a=e.call(this,r,void 0===n?t.PdfFontStyle.regular:n)||this;return a._isEmbedFont=!1,a._isUnicode=!0,void 0!==n?a._createFontInternal(i,n,s):a._createFontInternal(i,t.PdfFontStyle.regular,s),a}return wr(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.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[n]);return isNaN(r)&&(r=0),r*=.001*this._size,r=this._applyFormatSettings(e,i,r)},i.prototype.getFont=function(e,r){if(this._document){var n=!1,s=!1;return r&&(r&t.PdfFontStyle.underline&&(n=!0),r&t.PdfFontStyle.strikeout&&(s=!0)),this._document.embedFont(this._fontInternal._fontData,e,{shouldStrikeout:n,shouldUnderline:s})}return new i(this._fontInternal._fontData,e,r)},i.prototype._createFontInternal=function(t,e,i){this.style=e,null!==i&&void 0!==i?(this._fontInternal=i.fontInternal,this._fontInternal._fontSize=this._size,this._metrics=i.metrices,this._handleMetrics(),this._setInternals(i.dictionary)):(this._fontInternal=new pr(t,this._size),this._initializeInternals())},i.prototype._initializeInternals=function(){var t=null;this._fontInternal instanceof pr&&(this._fontInternal._isEmbed=this._isEmbedFont),this._fontInternal._createInternals(),this._handleMetrics(),t=this._fontInternal._getInternals(),this._metrics=this._fontInternal._metrics,this._metrics._isUnicodeFont=!0,this._setInternals(t)},i.prototype._handleMetrics=function(){var t=this._fontInternal._ttfMetrics;this._ascent=t._macAscent,this._descent=t._macDescent,this._height=t._macAscent-t._macDescent+t._lineGap,this._lineGap=t._lineGap},i.prototype._getUnicodeLineWidth=function(t,e){e=0;var i=[],r=!1,n=(new vr)._getGlyphIndex(t,this,i);if(r=n._result,i=n._glyphIndex,r&&null!==i){var s=this._fontInternal._ttfReader;i.forEach(function(t){if(null!==t&&void 0!==t){var i=s._getGlyph(t);null!==i&&void 0!==i&&(e+=i._width)}})}return e},i.prototype._getCharacterWidth=function(t,e){var i=this._fontInternal._getCharacterWidth(t);return i*=.001*this._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=t.charCodeAt(0);return e=e>=0&&128!==e?e:0,this._metrics._widthTable._itemAt(e)},i}(Sr),Tr=function(){function e(){}return e._getMetrics=function(i,r){var n=null;switch(i){case t.PdfFontFamily.helvetica:(n=this._getHelveticaMetrics(r))._name="Helvetica";break;case t.PdfFontFamily.courier:(n=this._getCourierMetrics(r))._name="Courier";break;case t.PdfFontFamily.timesRoman:(n=this._getTimesMetrics(r))._name="TimesRoman";break;case t.PdfFontFamily.symbol:(n=this._getSymbolMetrics())._name="Symbol";break;case t.PdfFontFamily.zapfDingbats:(n=this._getZapfDingbatsMetrics())._name="ZapfDingbats";break;default:(n=this._getHelveticaMetrics(r))._name="Helvetica"}return n._subScriptSizeFactor=e._subSuperScriptFactor,n._superscriptSizeFactor=e._subSuperScriptFactor,n},e._getHelveticaMetrics=function(e){var i=new ji;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(i._postScriptName=this._helveticaBoldItalicName,i._widthTable=new zi(this._arialBoldWidth)):(e&t.PdfFontStyle.bold)>0?(i._postScriptName=this._helveticaBoldName,i._widthTable=new zi(this._arialBoldWidth)):(e&t.PdfFontStyle.italic)>0?(i._postScriptName=this._helveticaItalicName,i._widthTable=new zi(this._arialWidth)):(i._postScriptName=this._helveticaName,i._widthTable=new zi(this._arialWidth)),i},e._getCourierMetrics=function(e){var i=new ji;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(i._postScriptName=this._courierBoldItalicName,i._widthTable=new zi(this._fixedWidth)):(e&t.PdfFontStyle.bold)>0?(i._postScriptName=this._courierBoldName,i._widthTable=new zi(this._fixedWidth)):(e&t.PdfFontStyle.italic)>0?(i._postScriptName=this._courierItalicName,i._widthTable=new zi(this._fixedWidth)):(i._postScriptName=this._courierName,i._widthTable=new zi(this._fixedWidth)),i},e._getTimesMetrics=function(e){var i=new ji;return(e&t.PdfFontStyle.bold)>0&&(e&t.PdfFontStyle.italic)>0?(i._postScriptName=this._timesBoldItalicName,i._widthTable=new zi(this._timesRomanBoldItalicWidths)):(e&t.PdfFontStyle.bold)>0?(i._postScriptName=this._timesBoldName,i._widthTable=new zi(this._timesRomanBoldWidth)):(e&t.PdfFontStyle.italic)>0?(i._postScriptName=this._timesItalicName,i._widthTable=new zi(this._timesRomanItalicWidth)):(i._postScriptName=this._timesName,i._widthTable=new zi(this._timesRomanWidth)),i},e._getSymbolMetrics=function(){var t=new ji;return t._postScriptName=this._symbolName,t._widthTable=new zi(this._symbolWidth),t},e._getZapfDingbatsMetrics=function(){var t=new ji;return t._postScriptName=this._zapfDingbatsName,t._widthTable=new zi(this._zapfDingbatsWidth),t},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}(),Cr=function(){function e(){}return e._getHanyangSystemsGothicMedium=function(e){var i=new ji,r=new Ui(1e3);return r._add(new Wi(1,127,500)),r._add(new Wi(8094,8190,500)),i._widthTable=r,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HYGoThic-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?i._postScriptName="HYGoThic-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HYGoThic-Medium,Italic":i._postScriptName="HYGoThic-Medium",i},e._getHanyangSystemsShinMyeongJoMedium=function(e){var i=new ji,r=new Ui(1e3);return r._add(new Wi(1,95,500)),r._add(new Wi(8094,8190,500)),i._widthTable=r,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HYSMyeongJo-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?i._postScriptName="HYSMyeongJo-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HYSMyeongJo-Medium,Italic":i._postScriptName="HYSMyeongJo-Medium",i},e._getHeiseiKakuGothicW5=function(e){var i=new ji,r=new Ui(1e3);return r._add(new Wi(1,95,500)),r._add(new Wi(231,632,500)),i._widthTable=r,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HeiseiKakuGo-W5,BoldItalic":0!=(e&t.PdfFontStyle.bold)?i._postScriptName="HeiseiKakuGo-W5,Bold":0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HeiseiKakuGo-W5,Italic":i._postScriptName="HeiseiKakuGo-W5",i},e._getHeiseiMinchoW3=function(e){var i=new ji,r=new Ui(1e3);return r._add(new Wi(1,95,500)),r._add(new Wi(231,632,500)),i._widthTable=r,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HeiseiMin-W3,BoldItalic":0!=(e&t.PdfFontStyle.bold)?i._postScriptName="HeiseiMin-W3,Bold":0!=(e&t.PdfFontStyle.italic)?i._postScriptName="HeiseiMin-W3,Italic":i._postScriptName="HeiseiMin-W3",i},e._getMonotypeHeiMedium=function(e){var i=new ji,r=new Ui(1e3);return r._add(new Wi(1,95,500)),r._add(new Wi(13648,13742,500)),i._widthTable=r,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?i._postScriptName="MHei-Medium,BoldItalic":0!=(e&t.PdfFontStyle.bold)?i._postScriptName="MHei-Medium,Bold":0!=(e&t.PdfFontStyle.italic)?i._postScriptName="MHei-Medium,Italic":i._postScriptName="MHei-Medium",i},e._getMonotypeSungLight=function(e){var i=new ji,r=new Ui(1e3);return r._add(new Wi(1,95,500)),r._add(new Wi(13648,13742,500)),i._widthTable=r,0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?i._postScriptName="MSung-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?i._postScriptName="MSung-Light,Bold":0!=(e&t.PdfFontStyle.italic)?i._postScriptName="MSung-Light,Italic":i._postScriptName="MSung-Light",i},e._getSinoTypeSongLight=function(e){var i=new ji,r=new Ui(1e3);return r._add(new Wi(1,95,500)),r._add(new Wi(814,939,500)),r._add(new qi(7712,[500])),r._add(new qi(7716,[500])),0!=(e&t.PdfFontStyle.bold)&&0!=(e&t.PdfFontStyle.italic)?i._postScriptName="STSong-Light,BoldItalic":0!=(e&t.PdfFontStyle.bold)?i._postScriptName="STSong-Light,Bold":0!=(e&t.PdfFontStyle.italic)?i._postScriptName="STSong-Light,Italic":i._postScriptName="STSong-Light",i._widthTable=r,i},e._getMetrics=function(e,i){var r;switch(e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:(r=this._getHanyangSystemsGothicMedium(i))._name="HanyangSystemsGothicMedium";break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:(r=this._getHanyangSystemsShinMyeongJoMedium(i))._name="HanyangSystemsShinMyeongJoMedium";break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:(r=this._getHeiseiKakuGothicW5(i))._name="HeiseiKakuGothicW5";break;case t.PdfCjkFontFamily.heiseiMinchoW3:(r=this._getHeiseiMinchoW3(i))._name="HeiseiMinchoW3";break;case t.PdfCjkFontFamily.monotypeHeiMedium:(r=this._getMonotypeHeiMedium(i))._name="MonotypeHeiMedium";break;case t.PdfCjkFontFamily.monotypeSungLight:(r=this._getMonotypeSungLight(i))._name="MonotypeSungLight";break;case t.PdfCjkFontFamily.sinoTypeSongLight:(r=this._getSinoTypeSongLight(i))._name="SinoTypeSongLight"}return r._subScriptSizeFactor=this._subSuperScriptFactor,r._superscriptSizeFactor=this._subSuperScriptFactor,r},e._subSuperScriptFactor=1.52,e}(),kr=function(){function e(){}return e._fillMonotypeSungLight=function(t,e,i,r,n){var s={x:-160,y:-249,width:1175,height:1137};this._fillFontBox(t,s),this._fillKnownInformation(t,e,i,r,n),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,s,a){var o={x:-92,y:-250,width:1102,height:1172},h={x:-92,y:-250,width:1102,height:1932};(i&(t.PdfFontStyle.italic|t.PdfFontStyle.bold))!==t.PdfFontStyle.italic?this._fillFontBox(e,o):this._fillFontBox(e,h),this._fillKnownInformation(e,r,n,s,a),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,r,n){var s={x:0,y:-148,width:1001,height:1028};this._fillFontBox(t,s),this._fillKnownInformation(t,e,i,r,n),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,r,n){var s={x:-123,y:-257,width:1124,height:1167};this._fillFontBox(t,s),this._fillKnownInformation(t,e,i,r,n),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,r,n){var s={x:-25,y:-254,width:1025,height:1134};this._fillFontBox(t,s),this._fillKnownInformation(t,e,i,r,n),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,r,n){var s={x:-45,y:-250,width:1060,height:1137};this._fillFontBox(t,s),this._fillKnownInformation(t,e,i,r,n),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,r,n){var s={x:-6,y:-145,width:1009,height:1025};this._fillFontBox(t,s),this._fillKnownInformation(t,e,i,r,n),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",M(e))},e._fillKnownInformation=function(e,i,r,n,s){switch(e.set("FontName",vs.get(r._postScriptName)),e.set("Type",vs.get("FontDescriptor")),e.set("ItalicAngle",0),e.set("MissingWidth",r._widthTable._defaultWidth),e.set("Ascent",n),e.set("Descent",s),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,n,s){var a=new Ts;switch(a._updated=!0,e){case t.PdfCjkFontFamily.hanyangSystemsGothicMedium:this._fillHanyangSystemsGothicMedium(a,e,r,n,s);break;case t.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:this._fillHanyangSystemsShinMyeongJoMedium(a,e,r,n,s);break;case t.PdfCjkFontFamily.heiseiKakuGothicW5:this._fillHeiseiKakuGothicW5(a,i,e,r,n,s);break;case t.PdfCjkFontFamily.heiseiMinchoW3:this._fillHeiseiMinchoW3(a,e,r,n,s);break;case t.PdfCjkFontFamily.monotypeHeiMedium:this._fillMonotypeHeiMedium(a,e,r,n,s);break;case t.PdfCjkFontFamily.monotypeSungLight:this._fillMonotypeSungLight(a,e,r,n,s);break;case t.PdfCjkFontFamily.sinoTypeSongLight:this._fillSinoTypeSongLight(a,e,r,n,s)}return a},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 Rr=function(){function t(){this._result=!1,this._glyphIndex=[]}return t}(),Fr=function(){function t(t,e){this._isNormalKey=!0,this._dictionary=new Ts,_e(t)?this._bounds=t:this._bounds={x:0,y:0,width:0,height:0},e instanceof Zr?(this._annotations=e,this._crossReference=e._crossReference):this._isNormalKey=!1,this._initialize()}return Object.defineProperty(t.prototype,"normal",{get:function(){return!this._templateNormal&&this._dictionary&&this._dictionary.has("AP")&&(this._templateNormal=this._dictionary.get("N")),this._templateNormal},set:function(t){t&&(this._templateNormal=t,this._isNormalKey&&this._dictionary.set("N",this._templateNormal))},enumerable:!0,configurable:!0}),t.prototype._initialize=function(){this.normal=new Mi(this._bounds,this._crossReference)},t}(),Ir=function(){function e(e,i){if(this._points=[],this._pathTypes=[],this._isRoundedRectangle=!1,this._fillMode=t.PdfFillMode.winding,this._isStart=!0,this._isXps=!1,this._brush=void 0,this._pen=void 0,e&&i){if(!Array.isArray(e)||!Array.isArray(i))throw new Error("Invalid constructor arguments.");this._points=e,this._pathTypes=i}else this._points=[],this._pathTypes=[]}return Object.defineProperty(e.prototype,"lastPoint",{get:function(){var t={x:0,y:0},e=this._points.length;return this._points.length>0&&(t.x=this._points[e-1].x,t.y=this._points[e-1].y),t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pathPoints",{get:function(){return this._points},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pathTypes",{get:function(){return this._pathTypes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillMode",{get:function(){return this._fillMode},set:function(t){this._fillMode=t},enumerable:!0,configurable:!0}),e.prototype.addPath=function(t,i){t instanceof e?this._addPath(t._points,t._pathTypes):Array.isArray(t)&&Array.isArray(i)&&this._addPath(t,i)},e.prototype._addPath=function(t,e){if(!t||0===t.length)throw new Error("Path points cannot be null or undefined.");if(!e||0===e.length)throw new Error("Path types cannot be null or undefined.");if(t.length!==e.length)throw new Error("The argument arrays should be of equal length.");for(var i=0;i<t.length;i++){if(i>=t.length||i<0)throw new Error("Index"+i+"is out of bounds.");var r=t[i];Array.isArray(r)?this._points.push({x:r[0],y:r[1]}):this._points.push(r),this._pathTypes.push(e[i])}},e.prototype.addLine=function(e,i){this._addPoints([e.x,e.y,i.x,i.y],t.PathPointType.line)},e.prototype._addLines=function(e){var i=e[0];if(1===e.length)this._addPoint(i,t.PathPointType.line);else for(var r=1;r<e.length;r++){var n=e[r];this.addLine(i,n),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+=2){var h={x:e[o],y:e[o+1]};o===s?0===this._points.length||this._isStart?(this._addPoint(h,t.PathPointType.start),this._isStart=!1):!this._isRoundedRectangle||h.x===this.lastPoint.x&&h.y===this.lastPoint.y?h.x!==this.lastPoint.x&&h.y!==this.lastPoint.y&&this._addPoint(h,t.PathPointType.line):this._addPoint(h,t.PathPointType.line):this._addPoint(h,i)}},e.prototype._addPoint=function(t,e){this._points.push(t),this._pathTypes.push(e)},e.prototype.addArc=function(e,i,r){for(var n=ot(e.x,e.y,e.x+e.width,e.y+e.height,i,r),s=0;s<n.length;++s){var a=[n[s],n[++s],n[++s],n[++s],n[++s],n[++s],n[++s],n[++s]];this._addPoints(a,t.PathPointType.bezier)}},e.prototype.addRectangle=function(e){this.startFigure(),this._addPoints([e.x,e.y,e.x+e.width,e.y,e.x+e.width,e.y+e.height,e.x,e.y+e.height],t.PathPointType.line),this.closeFigure()},e.prototype.addPolygon=function(e){for(var i=[],r=0;r<e.length;r++){var n=e[r];i.push(n.x,n.y)}this.startFigure(),this._addPoints(i,t.PathPointType.line),this.closeFigure()},e.prototype.addEllipse=function(t){this.startFigure(),this.addArc(t,0,360),this.closeFigure()},e.prototype.addBezier=function(e,i,r,n){var s=[e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y];this._addPoints(s,t.PathPointType.bezier)},e.prototype._addBezierPoints=function(t){if(t.length<4)throw Error("Incorrect size of array points");var e=0,i=t[e];for(e++;e+3<=t.length;){var r=t[e],n=t[++e],s=t[++e];e++,this.addBezier({x:i[0],y:i[1]},{x:r[0],y:r[1]},{x:n[0],y:n[1]},{x:s[0],y:s[1]}),i=s}},e.prototype.addPie=function(e,i,r){this.startFigure(),this.addArc(e,i,r),this._addPoint({x:e.x+e.width/2,y:e.y+e.height/2},t.PathPointType.line),this.closeFigure()},e.prototype.startFigure=function(){this._isStart=!0},e.prototype.closeFigure=function(e){if(void 0!==e){var i=this._pathTypes[e];i|=t.PathPointType.closePath,this._pathTypes[e]=i}else this._points.length>0&&this.closeFigure(this._points.length-1),this.startFigure()},e.prototype.closeAllFigures=function(){for(var e=0;e<this._points.length;++e){var i=this._pathTypes[e],r=!1;0!==e&&i===t.PathPointType.start?(this.closeFigure(e-1),r=!0):e===this._pathTypes.length-1&&!r&&this._isXps&&this._points[0].x===this._points[e].x&&this._points[0].y===this._points[e].y&&this.closeFigure(e)}},e.prototype._getBounds=function(){var t=[0,0,0,0];if(this._points.length>0){for(var e=this._points[0].x,i=this._points[0].x,r=this._points[0].y,n=this._points[0].y,s=1;s<this._points.length;s++){var a=this._points[s];e=Math.min(a.x,e),i=Math.max(a.x,i),r=Math.min(a.y,r),n=Math.max(a.y,n)}t=[e,r,i-e,n-r]}return t},e}(),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)}}(),Br=function(){function t(){}return t.prototype._initialize=function(){this._dictionary=new Ts,this._dictionary.update("Type",new vs("Action"))},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}(),Lr=function(t){function e(e){var i=t.call(this)||this;return i._initialize(),i._script=e,i._dictionary.update("S",new vs("JavaScript")),i}return Dr(e,t),Object.defineProperty(e.prototype,"script",{get:function(){return this._script},set:function(t){this._script=t},enumerable:!0,configurable:!0}),e}(Br),Or=function(t){function e(e){var i=t.call(this)||this;return i._initialize(),e instanceof Un?(i._destination=e,i._page=e.page):(i._page=e,i._destination=new Un(e,{x:0,y:0})),i._dictionary.update("S",new vs("GoTo")),i}return Dr(e,t),Object.defineProperty(e.prototype,"destination",{get:function(){return this._destination},set:function(t){this._destination=t},enumerable:!0,configurable:!0}),e}(Br),Mr=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}),Object.defineProperty(e.prototype,"keyPressed",{get:function(){return this._keyPressed||(this._keyPressed=this._getFieldAction("K")),this._keyPressed},set:function(t){t&&(this._keyPressed=t,this._updateFieldAction(this._keyPressed,"K"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format||(this._format=this._getFieldAction("F")),this._format},set:function(t){t&&(this._format=t,this._updateFieldAction(this._format,"F"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"validate",{get:function(){return this._validate||(this._validate=this._getFieldAction("V")),this._validate},set:function(t){t&&(this._validate=t,this._updateFieldAction(this._validate,"V"))},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 Or){var n=new Ts,s=e._page,a=e.destination;a._destinationMode===t.PdfDestinationMode.location?e._dictionary.update("D",[s._ref,new vs("XYZ"),a.location.x,s.size.height,a.zoom]):a._destinationMode===t.PdfDestinationMode.fitR?e._dictionary.update("D",[s._ref,new vs("FitR"),0,0,0,0]):a._destinationMode===t.PdfDestinationMode.fitH?e._dictionary.update("D",[s._ref,new vs("FitH"),s.size.height]):a._destinationMode===t.PdfDestinationMode.fitToPage&&e._dictionary.update("D",[s._ref,new vs("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");if(s&&"GoTo"===s.name&&n.has("D")){n._crossReference||(n._crossReference=i._crossReference);var a=new Hn(n,"D");e=new Or(a._obtainDestination())}}}}return e},e.prototype._updateFieldAction=function(t,e){if(this._field&&this._field._dictionary&&t&&e){var i=this._field._dictionary,r=i.get("AA");r&&r instanceof Ts||(r=new Ts,i.update("AA",r));var n=t._dictionary,s=t._script;s&&""!==s&&n.update("JS",s),r.set(e,n),n._updated=!0,r._updated=!0,i._updated=!0,i.update("AA",r)}},e.prototype._getFieldAction=function(t){var e;if(this._field&&this._field._dictionary&&t){var i=this._field._dictionary;if(i.has("AA")){var r=i.get("AA");if(r&&r instanceof Ts&&r.has(t)){var n=r.get(t);if(n&&n instanceof Ts&&n.has("S")){var s=n.get("S");if(s&&"JavaScript"===s.name&&n.has("JS")){var a=n.get("JS");(e=new Lr(""))._dictionary=n,e._script=a}}}}}return e},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)}}(),Nr=function(){function e(){this._enableGrouping=!1,this._isDuplicatePage=!1,this._visible=!0,this._isTransparentBackColor=!1,this._isTransparentBorderColor=!1,this._defaultFont=new xr(t.PdfFontFamily.helvetica,8),this._appearanceFont=new xr(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._defaultItemFont=new xr(t.PdfFontFamily.timesRoman,12),this._flatten=!1,this._circleCaptionFont=new xr(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular),this._isUpdating=!1,this._isImport=!1,this._exportValue="Yes"}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=D(this._dictionary,"T",!1,!1);t&&t.length>0&&(1===t.length?this._name=t[0]:this._name=t.slice().reverse().join("."))}return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"actualName",{get:function(){if(void 0===this._actualName&&this._dictionary&&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&&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||(Et(this._dictionary,e),this._dictionary._updated=!0):(Et(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&&this._dictionary.has("Rect")&&(t=L(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",E([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._mkDictionary&&this._mkDictionary.has("R"))t=this._mkDictionary.get("R");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={r:0,g:0,b:0},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(t))e.color=t;else{var i=!1;this._defaultAppearance||(this._da=new Kr(""),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(){return this._parseBorderColor(!0)},set:function(t){this._updateBorderColor(t,!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 Fn({style:t.PdfBorderStyle.solid}),this instanceof Vr||(e._width=0),e._dictionary=this._dictionary,null!==this._dictionary&&void 0!==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?(e.border.width=t.width,e.border.style=t.style,this._updateBorder(e._dictionary,t)):this._updateBorder(this._dictionary,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){var e,i=this.itemAt(this._defaultIndex);if((e=i?i._dictionary.get("MK"):this._mkDictionary)&&e.has("R")){var r=e.get("R");if(void 0!==r)switch(r){case 90:return t.PdfRotationAngle.angle90;case 180:return t.PdfRotationAngle.angle180;case 270:return t.PdfRotationAngle.angle270;default:return t.PdfRotationAngle.angle0}}return i?i.rotationAngle:t.PdfRotationAngle.angle0},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(){if(this._isLoaded){var t=void 0;if(this.page._pageDictionary.has("Annots")&&(t=this.page._pageDictionary.get("Annots")),this._kids&&this._kids.length>0)for(var e=0,i=this._kids;e<i.length;e++){var r=i[e];if(r&&this.page._pageDictionary.has("Annots")&&t&&-1!==(n=t.indexOf(r)))return n}else if(this._dictionary&&this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._ref&&t){var n=t.indexOf(this._ref);if(-1!==n)return n}return-1}return this._tabIndex},set:function(e){if(this._tabIndex=e,this._isLoaded){var i=this.page;if(i&&(i.tabOrder===t.PdfFormFieldsTabOrder.manual||this.form&&this.form._tabOrder===t.PdfFormFieldsTabOrder.manual)&&i._pageDictionary.has("Annots")){var r=i._pageDictionary.get("Annots"),n=new On(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&&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=ht(t,a)),!r&&this._kids&&this._kids.length>0)for(var o=0;o<this._kids.length&&!(r=ht(t,this._kids[o]));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 Qn({r:128,g:128,b:128})),this._gray},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_silverBrush",{get:function(){return this._silver||(this._silver=new Qn({r:198,g:198,b:198})),this._silver},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_whiteBrush",{get:function(){return this._white||(this._white=new Qn({r:255,g:255,b:255})),this._white},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_blackBrush",{get:function(){return this._black||(this._black=new Qn({r:0,g:0,b: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}),Object.defineProperty(e.prototype,"_hasBorderColor",{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("BC")}return!this._isTransparentBorderColor},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=q(n))}}void 0!==e&&null!==e||(e={r:255,g:255,b:255})}return e},e.prototype._parseBorderColor=function(t){var e;if(!t||this._isLoaded&&this._hasBorderColor||!this._isLoaded&&!this._isTransparentBorderColor){var i=this.itemAt(this._defaultIndex);if(i&&i.borderColor)e=i.borderColor;else if(this._mkDictionary){var r=this._mkDictionary;if(r.has("BC")){var n=r.getArray("BC");n&&(e=q(n))}}null!==e&&void 0!==e||(e={r:0,g:0,b:0})}return e},e.prototype._updateBackColor=function(t,e){if(void 0===e&&(e=!1),e&&_e(t)&&t.isTransparent){this._isTransparentBackColor=!0,this._dictionary&&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 Ts(this._crossReference);s.update("BG",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._dictionary.update("MK",s)}else n.has("BG")&&q(n.getArray("BG"))===t||(n.update("BG",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._dictionary._updated=!0)}}},e.prototype._updateBorderColor=function(t,e){if(void 0===e&&(e=!1),e&&t.isTransparent){if(this._isTransparentBorderColor=!0,this._dictionary.has("BC")&&delete this._dictionary._map.BC,(s=this._mkDictionary)&&s.has("BC")){if(delete s._map.BC,this._dictionary.has("BS")){var i=this._dictionary.get("BS");i&&i.has("W")&&delete i._map.W}this._dictionary._updated=!0}var r=this.itemAt(this._defaultIndex);r&&(r.borderColor=t)}else{this._isTransparentBorderColor=!1;var n=this.itemAt(this._defaultIndex);if(n&&n.borderColor!==t)n.borderColor=t;else{var s=this._mkDictionary;if(void 0===s){var a=new Ts(this._crossReference);a.update("BC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._dictionary.update("MK",a)}else s.has("BC")&&q(s.getArray("BC"))===t||(s.update("BC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/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[t];r&&r instanceof Ss&&(i=this._crossReference._fetch(r)),i&&((e=Pn._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||!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(null!==i&&void 0!==i&&i instanceof vs)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(null!==this._dictionary&&void 0!==this._dictionary&&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=D(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=D(this._dictionary,"DA",!1,!0);t&&""!==t&&(this._da=new Kr(t))}return this._da},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_mkDictionary",{get:function(){var t;return this._dictionary&&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&&e.has("BS")?r=e.get("BS"):(r=new Ts(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",G(i.style)),e._updated=!0):n&&r.update("S",G(t.PdfBorderStyle.solid)),void 0!==i.dash&&(r.update("D",i.dash),e._updated=!0)},e.prototype._checkFieldFlag=function(t){var e;return t&&t instanceof Ts&&(e=t.get("F")),void 0!==e&&6===e},e.prototype._initializeFont=function(t){var e=this;this._font=t;var i,r=this._crossReference._document;r&&(i=r.form._dictionary.has("DR")?r.form._dictionary.get("DR"):new Ts(this._crossReference));var n,s=!1;if(i&&i.has("Font")){var a=i.getRaw("Font");a&&a instanceof Ss?(s=!0,n=this._crossReference._fetch(a)):a instanceof Ts&&(n=a)}n||(n=new Ts(this._crossReference),i.update("Font",n));var o,h,c=!1;this._font&&null!==this._font._key&&void 0!==this._font._key&&this._font._reference?(o=vs.get(this._font._key),h=this._font._reference,c=!0):(o=vs.get(it()),h=this._crossReference._getNextReference(),this._font&&(this._font._key=o.name,this._font._reference=h)),h&&!c&&(t instanceof Ar?this._font._pdfFontInternals&&(this._crossReference._cacheMap.set(h,this._font._pdfFontInternals),this._font._reference=h):this._font._dictionary&&(this._crossReference._cacheMap.set(h,this._font._dictionary),n.update(o.name,h),i._updated=!0,r.form._dictionary.update("DR",i),r.form._dictionary._updated=!0)),n.update(o.name,h),i._updated=!0,r.form._dictionary.update("DR",i),r.form._dictionary._updated=!0,this._fontName=o.name;var _=new Kr;_.fontName=this._fontName,_.fontSize=this._font._size,_.color=this.color?this.color:{r:0,g:0,b:0},this._dictionary.has("Kids")?this._dictionary.getArray("Kids").forEach(function(t,i){var r=e.itemAt(i);t.update("DA",_.toString()),r&&(r._da=_)}):this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._dictionary.update("DA",_.toString()),s&&(i._updated=!0)},e.prototype._drawRectangularControl=function(e,i){switch(e.drawRectangle(i.bounds,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){if(r&&s>0)if(n===t.PdfBorderStyle.underline)e.drawLine(r,{x:i.x,y:i.x+i.height-s/2},{x:i.x+i.width,y:i.y+i.height-s/2});else{var a={x:i.x+s/2,y:i.y+s/2,width:i.width-s,height:i.height-s};e.drawRectangle(a,r)}},e.prototype._drawLeftTopShadow=function(t,e,i,r){var n=new Ir,s=[];s.push({x:e.x+i,y:e.y+i}),s.push({x:e.x+i,y:e.y+e.height-i}),s.push({x:e.x+2*i,y:e.y+e.height-2*i}),s.push({x:e.x+2*i,y:e.y+2*i}),s.push({x:e.x+e.width-2*i,y:e.y+2*i}),s.push({x:e.x+e.width-i,y:e.y+i}),n.addPolygon(s),t.drawPath(n,r)},e.prototype._drawRightBottomShadow=function(t,e,i,r){var n=new Ir,s=[];s.push({x:e.x+i,y:e.y+e.height-i}),s.push({x:e.x+2*i,y:e.y+e.height-2*i}),s.push({x:e.x+e.width-2*i,y:e.y+e.height-2*i}),s.push({x:e.x+e.width-2*i,y:e.y+2*i}),s.push({x:e.x+e.width-i,y:e.y+i}),s.push({x:e.x+e.width-i,y:e.y+e.height-i}),n.addPolygon(s),t.drawPath(n,r)},e.prototype._drawRadioButton=function(e,i,r,n){if("l"===r){var s=i.bounds,a=s.width;switch(this._enableGrouping&&(a=Math.min(s.width,s.height)),n){case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:e.drawEllipse({x:s.x,y:s.y,width:a,height:s.height},i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.underline?e.drawEllipse(s,i.backBrush):e.drawEllipse({x:s.x,y:s.y,width:a,height:s.height},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 o=[s.x+i.borderWidth/2,s.y+i.borderWidth/2,a-i.borderWidth,s.height-i.borderWidth];e.drawEllipse({x:o[0]+o[2]/4,y:o[1]+o[2]/4,width:o[2]-o[2]/2,height:o[3]-o[2]/2},i.foreBrush)}}else this._drawCheckBox(e,i,r,n)},e.prototype._drawRoundBorder=function(t,e,i,r){0===e.x&&0===e.y&&0===e.width&&0===e.height||t.drawEllipse({x:e.x+r/2,y:e.y+r/2,width:(this._enableGrouping?Math.min(e.width,e.height):e.width)-r,height:e.height-r},i)},e.prototype._drawRoundShadow=function(e,i,r){var n=i.borderWidth,s=-1.5*n,a=i.bounds.x+s,o=i.bounds.y+s,h=i.bounds.width+2*s,c=i.bounds.height+2*s,_=i.shadowBrush;if(_){var d=_._color,u=void 0,l=void 0;switch(i.borderStyle){case t.PdfBorderStyle.beveled:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:u=new Zn(d,n),l=new Zn({r:255,g:255,b:255},n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:u=new Zn({r:255,g:255,b:255},n),l=new Zn(d,n)}break;case t.PdfBorderStyle.inset:switch(r){case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:u=new Zn({r:0,g:0,b:0},n),l=new Zn({r:0,g:0,b:0},n);break;case t._PdfCheckFieldState.checked:case t._PdfCheckFieldState.unchecked:u=new Zn({r:128,g:128,b:128},n),l=new Zn({r:192,g:192,b:192},n)}}u&&l&&(e.drawArc({x:a,y:o,width:h,height:c},135,180,u),e.drawArc({x:a,y:o,width:h,height: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||i.backBrush)&&e.drawRectangle(i.bounds,i.backBrush);break;case t._PdfCheckFieldState.pressedChecked:case t._PdfCheckFieldState.pressedUnchecked:i.borderStyle===t.PdfBorderStyle.beveled||i.backBrush||i.borderStyle===t.PdfBorderStyle.underline?(i.borderPen||i.backBrush)&&e.drawRectangle(i.bounds,i.backBrush):(i.borderPen||i.shadowBrush)&&e.drawRectangle(i.bounds,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 xr(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),u=Math.min(_,d),l=(h=i.bounds.width>i.bounds.height?i.bounds.height:i.bounds.width)-2*u;s=new xr(t.PdfFontFamily.zapfDingbats,l),i.bounds.width>i.bounds.height&&(o=(i.bounds.height-s._getHeight())/2)}if(0===h&&(h=i.bounds.height),i.pageRotationAngle!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var f=e.save(),p=e._size;if(i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform({x:p.height,y:0}),e.rotateTransform(90);var g=p.height-(a.x+a.width);a={x:b=a.y,y:g,width:a.height,height:a.width}}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform({x:p.width,y:p.height}),e.rotateTransform(-180),a={x:b=p.width-(a.x+a.width),y:g=p.height-(a.y+a.height),width:a.width,height:a.height}):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform({x:0,y:p.width}),e.rotateTransform(270),a={x:b=p.width-(a.y+a.height),y:g=a.x,width:a.height,height:a.width});if(i.rotationAngle>0){if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform({x:0,y:p.height}),e.rotateTransform(-90),a={x:b=p.height-(a.y+a.height),y:g=a.x,width:a.height,height:a.width};else if(a.width>a.height)e.translateTransform({x:0,y:p.height}),e.rotateTransform(-90),a=i.bounds;else{var y=a.x;a.x=-(a.y+a.height),a.y=y;var m=a.height;a.height=a.width>s._getHeight()?a.width:s._getHeight(),a.width=m,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform({x:p.width,y:0}),e.rotateTransform(-270),a={x:b=a.y,y:g=p.width-(a.x+a.width),width:a.height,height:a.width};else if(180===i.rotationAngle){e.translateTransform({x:p.width,y:p.height}),e.rotateTransform(-180);var b=p.width-(a.x+a.width);a={x:b,y:g=p.height-(a.y+a.height),width:a.width,height:a.height}}e.drawString(r,s,{x:a.x,y:a.y-o,width:a.width,height:a.height},null,i.foreBrush,new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle)),e.restore(f)}else e.drawString(r,s,{x:a.x,y:a.y-o,width:a.width,height:a.height},null,i.foreBrush,new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle));break}}},e.prototype._addToKid=function(t){if(this._dictionary&&this._dictionary.has("Kids")?this._kids=this._dictionary.get("Kids"):(this._kids=[],this._dictionary.update("Kids",this._kids),this._parsedItems=new Map),-1===this._kids.indexOf(t._ref)){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({x:n._size.height,y:0}),n.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(n.translateTransform({x:n._size.width,y:n._size.height}),n.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(n.translateTransform({x:0,y:n._size.width}),n.rotateTransform(270)),n._sw._setTextRenderingMode(t._TextRenderingMode.fill),n.drawTemplate(e,r),n.restore()}},e.prototype._addToOptions=function(t,e){e instanceof qr&&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 Ts;t&&t.has("AP")?(r=t.get("AP"),Nt(t.get("AP"),this._crossReference,i)):(r=new Ts(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={x:0,y:0,width:0,height:0};return r===t.PdfRotationAngle.angle180?n={x:i.width-(e.x+e.width),y:i.height-(e.y+e.height),width:e.width,height:e.height}:r===t.PdfRotationAngle.angle270?n={x:e.y,y:i.width-(e.x+e.width),width:e.height,height:e.width}:r===t.PdfRotationAngle.angle90&&(n={x:i.height-(e.y+e.height),y:e.x,width:e.height,height:e.width}),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&&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&&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 Ei(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}(),jr=function(e){function i(t,i,r,n){var s=e.call(this)||this;return s._autoResizeText=!1,s._isTextChanged=!1,t&&i&&r&&s._initialize(t,i,r),n&&("text"in n&&_e(n.text)&&(s.text=n.text),"toolTip"in n&&_e(n.toolTip)&&(s.toolTip=n.toolTip),"color"in n&&_e(n.color)&&(s.color=n.color),"border"in n&&_e(n.border)&&(s.border=n.border),"backColor"in n&&_e(n.backColor)&&(s.backColor=n.backColor),"borderColor"in n&&_e(n.borderColor)&&(s.borderColor=n.borderColor),"font"in n&&_e(n.font)&&(s.font=n.font)),s}return Er(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,"actions",{get:function(){return this._actions||(this._actions=new Mr(this)),this._actions},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){if(void 0===this._text)if(this._isLoaded){var t=D(this._dictionary,"V",!1,!0);if(t)this._text=l(t);else{var e=this.itemAt(this._defaultIndex);e&&(t=e._dictionary.get("V"))&&(this._text=l(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),this._text=t,this._isTextChanged=!0}}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=D(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,this._stringFormat&&(this._stringFormat.lineAlignment=e?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle)},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&&this._dictionary.has("H")&&(e=Y(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")&&Y(this._dictionary.get("H"))===t||this._dictionary.update("H",Q(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxLength",{get:function(){if(void 0===this._maxLength){var t=D(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=Ut(this._form,t,this),this._font},set:function(t){t&&t instanceof Sr&&(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 Ts(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",vs.get("Tx")),this._dictionary.update("T",i),this._fieldFlags|=t._FieldFlag.doNotSpellCheck,this._createItem(r),this._initializeFont(this._defaultFont)},i.prototype._createItem=function(e){var i=new Pn;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.left,this._stringFormat=new Ei(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new Ts(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);if(t){var s={x:r.bounds.x,y:r.bounds.y,width:n._size.width,height:n._size.height};this._drawTemplate(n,r._page,s)}else 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(null!==i&&void 0!==i&&i._setAppearance&&i._enableGrouping||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 Mi(a,this._crossReference))}}if(r)if(e){var c=s instanceof Pn?s._getPage():s.page;if(c){var _=c.graphics;_.save(),c.rotation===t.PdfRotationAngle.angle90?(_.translateTransform({x:_._size.width,y:_._size.height}),_.rotateTransform(90)):c.rotation===t.PdfRotationAngle.angle180?(_.translateTransform({x:_._size.width,y:_._size.height}),_.rotateTransform(-180)):c.rotation===t.PdfRotationAngle.angle270&&(_.translateTransform({x:_._size.width,y:_._size.height}),_.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size.width,height:r._size.height},_.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=270===i.rotate&&this.page.rotation===t.PdfRotationAngle.angle270,s=n?r.height:r.width,a=n?r.width:r.height,o=new Mi([0,0,s,a],this._crossReference);lt(o,n?i.rotate:null),o._writeTransformation=!1;var h=o.graphics,c=new Bn;c.bounds={x:0,y:0,width:s,height:a};var _=i.backColor;_&&!_.isTransparent&&(c.backBrush=new Qn(_)),c.foreBrush=new Qn(i.color);var d=i.border;if(i.borderColor&&(0===d.width&&(i.borderColor={r:255,g:255,b:255}),c.borderPen=new Zn(i.borderColor,d.width),we(d,c)),c.borderWidth=d.width,c.borderStyle=d.style,_){var u=[_.r-64,_.g-64,_.b-64],l={r:u[0]>=0?u[0]:0,g:u[1]>=0?u[1]:0,b:u[2]>=0?u[2]:0};c.shadowBrush=new Qn(l)}c.rotationAngle=i.rotate,c.insertSpaces=this.insertSpaces;var f,p,g=this.text,y=!1,m=this.actions;if(m){var b=m.format;if(b){var v=b.script,w=this._tryParseAcrobatFormFormat(v);w&&(g=this._normalizeDateValue(this.text,w))}}if(null!==g&&void 0!==g||(g=""),this.password){for(var S="",x=0;x<g.length;x++)S+="*";g=S}return this.maxLength&&g.length>this.maxLength&&(g=g.substring(0,this.maxLength)),c.required=this.required,this.required||(h._sw._beginMarkupSequence("Tx"),h._initializeCoordinates()),null!==i&&void 0!==i&&i instanceof Pn&&i._enableGrouping&&(y=!0),y&&null!==i.font&&void 0!==i.font?f=i.font:void 0!==this._font&&null!==this._font||(this._font=this.font?this.font:this._defaultFont),y&&null!==i.textAlignment&&void 0!==i.textAlignment?p=p=new Ei(i.textAlignment,t.PdfVerticalAlignment.middle):void 0!==this._stringFormat&&null!==this._stringFormat||(void 0===this.textAlignment||null===this.textAlignment?this._stringFormat=new Ei(this.textAlignment,t.PdfVerticalAlignment.middle):this._stringFormat=new Ei(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle)),le(g)&&(this._stringFormat.textDirection=t.PdfTextDirection.rightToLeft),this._isLoaded&&!this.multiLine&&(this._stringFormat?this._stringFormat.lineLimit=!1:p&&(p.lineLimit=!1)),y?this._drawTextBox(h,c,g,f,p,this.multiLine,this.scrollable,this.maxLength):this._drawTextBox(h,c,g,this._font,this._stringFormat,this.multiLine,this.scrollable,this.maxLength),this.required||h._sw._endMarkupSequence(),o},i.prototype._normalizeDateValue=function(t,e){var i=this._parseUnknownDate(t);return i?this._formatDateUsingAcrobatFormat(i,e):t},i.prototype._parseUnknownDate=function(t){var e;if(t){var i=t.trim().replace(/[.-]/g,"/"),r=new Date(i);if(!1===isNaN(r.getTime()))e=r;else{var n=i.trim().split(/\s+/),s=n[0],a=void 0;s&&(a=s.match(/^(\d{1,4})\/(\d{1,2})\/(\d{1,4})$/));var o=n[1];if(a){var h=function(t){return isNaN(Number(t))?0:Number(t)},c=h(a[1]),_=h(a[2]),d=h(a[3]),u=void 0,l=void 0,f=void 0;if(d>31){u=d,c>12&&(f=c,l=_-1);var p=0,g=0,y=0;if(o){var m=o.split(":");if(m.length>=2&&m.length<=3){var b=h(m[0]),v=h(m[1]),w=m[2]?h(m[2]):0;b>=0&&b<=99&&v>=0&&v<=59&&w>=0&&w<=59&&(p=b,g=v,y=w)}}e=new Date(u,l,f,p,g,y)}}}}return e},i.prototype._formatDateUsingAcrobatFormat=function(t,e){var i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=["January","February","March","April","May","June","July","August","September","October","November","December"],n=function(t){return("0"+t).slice(-2)},s=t.getHours(),a=s%12||12,o=new Map([["yyyy",t.getFullYear().toString()],["yy",t.getFullYear().toString().slice(-2)],["mmmm",r[t.getMonth()]],["mmm",i[t.getMonth()]],["mm",n(t.getMonth()+1)],["m",(t.getMonth()+1).toString()],["dd",n(t.getDate())],["d",t.getDate().toString()],["HH",n(s)],["H",s.toString()],["hh",n(a)],["h",a.toString()],["MM",n(t.getMinutes())],["M",t.getMinutes().toString()],["ss",n(t.getSeconds())],["s",t.getSeconds().toString()],["tt",s<12?"AM":"PM"]]);return e.replace(/yyyy|mmmm|mmm|mm|dd|HH|hh|MM|ss|yy|H|h|m|d|M|s|tt/g,function(t){return o.get(t)})},i.prototype._tryParseAcrobatFormFormat=function(t){var e;if("string"==typeof t){var i=t.replace(/\s+/g," ").trim().match(/[a-zA-Z0-9_]*_FormatEx\s*\(\s*(['"])(.*?)\1\s*\)/i);Array.isArray(i)&&i.length>2&&"string"==typeof i[2]&&(e=i[2])}return e},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&&this.borderColor){c=i.bounds.width/h,e.drawRectangle(i.bounds,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 u=Math.floor(h/2-Math.ceil(_.length/2));r=d>=u&&d<u+_.length?_[d-u]:""}else r=_.length>d?_[d]:"";i.bounds.width=c;var l=new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle);this._drawTextBox(e,i,r,n,l,a,o),i.bounds.x=i.bounds.x+c,i.borderWidth&&e.drawLine(i.borderPen,{x:i.bounds.x,y:i.bounds.y},{x:i.bounds.x,y:i.bounds.y+i.bounds.height})}}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 f=i.bounds,p=this.rotate;if(null!==p&&void 0!==p&&90===p&&(f.y=f.width/2),i.borderStyle===t.PdfBorderStyle.beveled||i.borderStyle===t.PdfBorderStyle.inset?(f.x=f.x+4*i.borderWidth,f.width=f.width-8*i.borderWidth):(f.x=f.x+2*i.borderWidth,f.width=f.width-4*i.borderWidth),a){var g=(void 0===s||null===s||0===s.lineSpacing?n._getHeight():s.lineSpacing)-n._getAscent(s);r.indexOf("\n"),0===f.x&&1===f.y&&(f.y=-(f.y-g)),i.isAutoFontSize&&0!==i.borderWidth&&(f.y=f.y+2.5*i.borderWidth)}if(e._page&&void 0!==e._page.rotation&&e._page.rotation!==t.PdfRotationAngle.angle0||i.rotationAngle>0){var y=e.save();if(void 0!==i.pageRotationAngle&&i.pageRotationAngle!==t.PdfRotationAngle.angle0)if(i.pageRotationAngle===t.PdfRotationAngle.angle90){e.translateTransform({x:e._size.height,y:0}),e.rotateTransform(90);var m=e._size.height-(f.x+f.width);f={x:w=f.y,y:m,width:f.height,height:f.width}}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180),f={x:w=e._size.width-(f.x+f.width),y:m=e._size.height-(f.y+f.height),width:f.width,height:f.height}):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform({x:0,y:e._size.width}),e.rotateTransform(270),f={x:w=e._size.width-(f.y+f.height),y:m=f.x,width:f.height,height:f.width});if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform({x:0,y:e._size.height}),e.rotateTransform(-90),f={x:w=e._size.height-(f.y+f.height),y:m=f.x,width:f.height,height:f.width},i.stringFormat=new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle);else if(f.width>f.height)e.translateTransform({x:0,y:e._size.height}),e.rotateTransform(-90),(f=i.bounds).y=f.width/2-8*i.borderWidth;else{var b=f.x;f.x=-(f.y+f.height),f.y=b;var v=f.height;f.height=f.width>n._getHeight()?f.width:n._getHeight(),f.width=v,e.rotateTransform(-90)}else if(270===i.rotationAngle)f={x:f.x,y:f.y,width:f.width-4*i.borderWidth,height:f.height};else if(180===i.rotationAngle){e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180);var w=e._size.width-(f.x+f.width);f={x:w,y:m=e._size.height-(f.y+f.height),width:f.width,height:f.height}}e.drawString(r,n,f,null,i.foreBrush,s),e.restore(y)}else e.drawString(r,n,f,null,i.foreBrush,s);e._isTemplateGraphics&&i.required&&(e._sw._endMarkupSequence(),e.restore())}},i}(Nr),Vr=function(e){function i(t,i,r,n){var s=e.call(this)||this;return t&&i&&r&&s._initialize(t,i,r),n&&("text"in n&&_e(n.text)&&(s.text=n.text),"toolTip"in n&&_e(n.toolTip)&&(s.toolTip=n.toolTip),"color"in n&&_e(n.color)&&(s.color=n.color),"border"in n&&_e(n.border)&&(s.border=n.border),"backColor"in n&&_e(n.backColor)&&(s.backColor=n.backColor),"borderColor"in n&&_e(n.borderColor)&&(s.borderColor=n.borderColor),"highlightMode"in n&&_e(n.highlightMode)&&(s.highlightMode=n.highlightMode)),s}return Er(i,e),Object.defineProperty(i.prototype,"actions",{get:function(){return this._actions||(this._actions=new Mr(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=D(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._text=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&&this._dictionary.has("H")&&(e=Y(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")&&Y(this._dictionary.get("H"))===t||this._dictionary.update("H",Q(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=Ut(this._form,t,this),this._font},set:function(t){t&&t instanceof Sr&&(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&&t.has("MK")?i=t.get("MK"):(i=new Ts(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 Ts(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",vs.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 Pn;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new Ei(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new Ts(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){var s={x:r.bounds.x,y:r.bounds.y,width:n._size.width,height:n._size.height};this._drawTemplate(n,r._getPage(),s)}else{this._addAppearance(r._dictionary,n,"N");var a=this._createAppearance(r,!0);a&&this._addAppearance(r._dictionary,a,"D")}r._dictionary._updated=!t}}t&&(this._dictionary._updated=!1)}},i.prototype._postProcess=function(e,i){var r,n,s=i||this;if(null!==i&&void 0!==i&&i._setAppearance&&i._enableGrouping||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");if(h&&(a.reference=h),a&&a instanceof Ts&&s._dictionary.has("AS")){var c=s._dictionary.get("AS");if(c&&c instanceof vs&&a.has(c.name)){var _=a.getRaw(c.name),d=a.get(c.name);_&&d&&d instanceof Rs&&((a=d).reference=_)}}a&&(r=new Mi(a,this._crossReference))}}if(r)if(e){var u=s instanceof Pn?s._getPage():s.page;if(u){var l=u.graphics;l.save(),u.rotation===t.PdfRotationAngle.angle90?(l.translateTransform({x:l._size.width,y:l._size.height}),l.rotateTransform(90)):u.rotation===t.PdfRotationAngle.angle180?(l.translateTransform({x:l._size.width,y:l._size.height}),l.rotateTransform(-180)):u.rotation===t.PdfRotationAngle.angle270&&(l.translateTransform({x:l._size.width,y:l._size.height}),l.rotateTransform(270)),n={x:s.bounds.x,y:s.bounds.y,width:r._size.width,height:r._size.height},l.drawTemplate(r,n),l.restore()}s._dictionary._updated=!1}else this._addAppearance(s._dictionary,r,"N")},i.prototype._createAppearance=function(e,i){void 0===i&&(i=!1);var r=e.bounds,n=new Mi([0,0,r.width,r.height],this._crossReference),s=new Bn;s.bounds={x:0,y:0,width:r.width,height:r.height};var a,o,h,c=!1,_=!1,d=e.backColor;d&&!d.isTransparent&&(s.backBrush=new Qn(d)),s.foreBrush=new Qn(e.color);var u=e.border;if(e.borderColor&&(s.borderPen=new Zn(e.borderColor,u.width),we(u,s)),s.borderWidth=u.width,s.borderStyle=u.style,d){var l=[d.r-64,d.g-64,d.b-64],f=[l[0]>=0?l[0]:0,l[1]>=0?l[1]:0,l[2]>=0?l[2]:0];s.shadowBrush=new Qn({r:f[0],g:f[1],b:f[2]})}if(s.rotationAngle=e.rotate,null!==e&&void 0!==e&&e instanceof Pn&&e._enableGrouping&&(c=!0),c?(a=e._mkDictionary&&e._mkDictionary&&e._mkDictionary.has("CA")?e._mkDictionary.get("CA"):"",void 0!==e.font&&null!==e.font.size&&0!==e.font.size&&(o=e.font),h=new Ei(e.textAlignment,t.PdfVerticalAlignment.middle)):void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),this._isLoaded&&e instanceof Pn&&null!==e&&void 0!==e&&e._defaultAppearance){var p=e._defaultAppearance.fontName;null!==p&&void 0!==p||(p="Helvetica");var g=e._defaultAppearance.fontSize;null===g||void 0===g?g=this._defaultFont.size:0===g&&(_=!0);var y,m=void 0,b=void 0;this._stringFormat=new Ei,this._stringFormat.lineAlignment=t.PdfVerticalAlignment.middle,this._stringFormat.alignment=t.PdfTextAlignment.center,null!==g&&void 0!==g&&p&&(y=Kt(p,g,t.PdfFontStyle.regular,e));var v=(b=null!==y&&void 0!==y?y:this._defaultFont).measureString(this.text,this._stringFormat);if(_&&b&&b instanceof xr&&this._isLoaded&&!e._dictionary.has("AP")){for(var w=e.bounds.width-8*u.width,S=e.bounds.height-8*u.width;v.width<w||v.height<S;)if(m=b,b=new xr(b.fontFamily,b._size+1),(v=b.measureString(this.text,this._stringFormat)).width>w||v.height>S){b=m;break}this._font=b}}return c?i?this._drawPressedButton(n.graphics,s,a,o,h):this._drawButton(n.graphics,s,a,o,h):i?this._drawPressedButton(n.graphics,s,this.text,this._font,this._stringFormat):this._drawButton(n.graphics,s,this.text,this._font,this._stringFormat),n},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({x:e._size.height,y:0}),e.rotateTransform(90);var h=e._size.height-(a.x+a.width);a={x:d=a.y,y:h,width:a.height,height:a.width}}else i.pageRotationAngle===t.PdfRotationAngle.angle180?(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180),a={x:d=e._size.width-(a.x+a.width),y:h=e._size.height-(a.y+a.height),width:a.width,height:a.height}):i.pageRotationAngle===t.PdfRotationAngle.angle270&&(e.translateTransform({x:0,y:e._size.width}),e.rotateTransform(270),a={x:d=e._size.width-(a.y+a.height),y:h=a.x,width:a.height,height:a.width});if(i.rotationAngle)if(90===i.rotationAngle)if(i.pageRotationAngle===t.PdfRotationAngle.angle90)e.translateTransform({x:0,y:e._size.height}),e.rotateTransform(-90),a={x:d=e._size.height-(a.y+a.height),y:h=a.x,width:a.height,height:a.width};else if(a.width>a.height)e.translateTransform({x:0,y:e._size.height}),e.rotateTransform(-90),a={x:d=e._size.height-(a.y+a.height),y:h=a.x,width:a.height,height:a.width},s._wordWrapType=t._PdfWordWrapType.none;else{var c=a.x;a.x=-(a.y+a.height),a.y=c;var _=a.height;a.height=a.width>n._getHeight()?a.width:n._getHeight(),a.width=_,e.rotateTransform(-90)}else if(270===i.rotationAngle)e.translateTransform({x:e._size.width,y:0}),e.rotateTransform(-270),a={x:d=a.y,y:h=e._size.width-(a.x+a.width),width:a.height,height:a.width},s._wordWrapType=t._PdfWordWrapType.none;else if(180===i.rotationAngle){e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180);var d=e._size.width-(a.x+a.width);a={x:d,y:h=e._size.height-(a.y+a.height),width:a.width,height:a.height}}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,i.shadowBrush);break;default:e.drawRectangle(i.bounds,i.backBrush)}this._drawBorder(e,i.bounds,i.borderPen,i.borderStyle,i.borderWidth);var a={x:i.borderWidth,y:i.borderWidth,width:i.bounds.width-i.borderWidth,height:i.bounds.height-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}(Nr),zr=function(e){function i(t,i,r,n){var s=e.call(this)||this;return r&&t&&i&&s._initialize(r,t,i),n&&("toolTip"in n&&_e(n.toolTip)&&(s.toolTip=n.toolTip),"color"in n&&_e(n.color)&&(s.color=n.color),"border"in n&&_e(n.border)&&(s.border=n.border),"backColor"in n&&_e(n.backColor)&&(s.backColor=n.backColor),"borderColor"in n&&_e(n.borderColor)&&(s.borderColor=n.borderColor),"checked"in n&&_e(n.checked)&&(s.checked=n.checked)),s}return Er(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=An._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[t];r&&r instanceof Ss&&(i=this._crossReference._fetch(r)),i&&((e=An._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=Ut(this._form,t,this),this._font},set:function(t){t&&t instanceof Sr&&(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:ct(this._dictionary)},set:function(t){if(this.checked!==t){if(this._crossReference&&this._crossReference._document&&this._crossReference._document._isFormImport&&this._kidsCount>0&&(i=this.itemAt(this._defaultIndex)).checked!==t)return void(i.checked=t);if(this._kidsCount>0)for(var e=0;e<this._kidsCount;e++){var i=this.itemAt(e);i.checked!==t&&(i.checked=t)}if(t)if(this._isLoaded){var r=_t(this._kidsCount>0?this.itemAt(this._defaultIndex)._dictionary:this._dictionary);this._dictionary.update("V",vs.get(r)),this._dictionary.update("AS",vs.get(r))}else this._dictionary.update("V",vs.get(this.exportValue)),this._dictionary.update("AS",vs.get(this.exportValue));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,"exportValue",{get:function(){return this._isLoaded&&"string"==typeof this._exportValue&&"Yes"!==this._exportValue?this._exportValue:this._isLoaded?_t(this._dictionary):this._exportValue},set:function(t){this.itemAt(this._defaultIndex)&&(this.itemAt(this._defaultIndex).exportValue=t),this._dictionary.has("V")||""===t||(this._exportValue=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,"borderColor",{get:function(){return this._parseBorderColor(!0)},set:function(t){this._updateBorderColor(t,!0),this._isLoaded&&(this._setAppearance=!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 Ts(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",vs.get("Btn")),this._dictionary.update("T",e),this._createItem(i)},i.prototype._createItem=function(e){var i=new An;i._create(this._page,e,this),i.textAlignment=t.PdfTextAlignment.center,this._stringFormat=new Ei(i.textAlignment,t.PdfVerticalAlignment.middle),i._dictionary.update("MK",new Ts(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(e||this._setAppearance||this._dictionary._updated||this._isImport)if(i>0)for(o=0;o<i;o++){var r=this.itemAt(o);if(r){if(!this._checkFieldFlag(r._dictionary))if(e){var n=void 0,s=r.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;n=this._setAppearance||this._form._setAppearance||!r._dictionary.has("AP")?this._createAppearance(r,s):dt(s,r),this._drawTemplate(n,r._getPage(),r.bounds)}else(this._setAppearance||this._form._setAppearance||!r._isLoaded)&&(r._postProcess(r.checked?r.exportValue:"Off"),this._drawAppearance(r,r.exportValue));r._dictionary._updated=!e}}else{var a=this.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;this._drawTemplate(dt(a,this),this.page,this.bounds)}}else for(var o=0;o<i;o++)if(r=this.itemAt(o)){s=r.checked?t._PdfCheckFieldState.checked:t._PdfCheckFieldState.unchecked;if(r._postProcess(r.checked?r.exportValue:"Off"),e){n=this._createAppearance(r,s);this._drawTemplate(n,r._getPage(),r.bounds)}else{var h=void 0;h=""===r.exportValue?"Yes":r.exportValue,this._drawAppearance(r,h)}r._dictionary._updated=!e}this._dictionary._updated=!e},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Bn;r.bounds={x:0,y:0,width:i.width,height:i.height};var n=t.backColor;n&&!n.isTransparent&&(r.backBrush=new Qn(n)),r.foreBrush=new Qn(t.color);var s=t.border;if(t.borderColor&&(r.borderPen=new Zn(t.borderColor,s.width)),r.borderWidth=s.width,r.borderStyle=s.style,n){var a=[n.r-64,n.g-64,n.b-64],o={r:a[0]>=0?a[0]:0,g:a[1]>=0?a[1]:0,b:a[2]>=0?a[2]:0};r.shadowBrush=new Qn(o)}r.rotationAngle=t.rotate;var h=new Mi(r.bounds,this._crossReference),c=h.graphics;return t._styleText?this._drawCheckBox(c,r,t._styleText,e):this._drawCheckBox(c,r,gt(t._style),e),h},i.prototype._drawAppearance=function(e,i){var r=new Ts;if(e._dictionary.has("AP"))(r=e._dictionary.get("AP"))&&(r.has("N")&&Vt(r.get("N"),this._crossReference,"Yes","Off"),r.has("D")&&Vt(r.get("D"),this._crossReference,"Yes","Off")),Nt(r,this._crossReference,"N"),Nt(r,this._crossReference,"D");else{var n=this._crossReference._getNextReference();r=new Ts(this._crossReference),this._crossReference._cacheMap.set(n,r),e._dictionary.update("AP",n)}var s=this._createAppearance(e,t._PdfCheckFieldState.checked),a=this._crossReference._getNextReference();this._crossReference._cacheMap.set(a,s._content);var o=this._createAppearance(e,t._PdfCheckFieldState.unchecked),h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,o._content);var c=new Ts(this._crossReference);null!==i&&void 0!==i?c.update(i,a):c.update("Yes",a),c.update("Off",h);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,c),r.update("N",_);var d=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),u=this._crossReference._getNextReference();this._crossReference._cacheMap.set(u,d._content);var l=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),f=this._crossReference._getNextReference();this._crossReference._cacheMap.set(f,l._content);var p=new Ts(this._crossReference);null!==i&&void 0!==i?p.update(i,u):p.update("Yes",u),p.update("Off",f);var g=this._crossReference._getNextReference();this._crossReference._cacheMap.set(g,p),r.update("D",g),e._dictionary._updated=!0},i}(Nr),Ur=function(e){function i(t,i,r){var n=e.call(this)||this;return n._selectedIndex=-1,n._allowUnisonSelection=!1,n._hasDuplicates=!1,t&&i&&n._initialize(t,i),r&&("items"in r&&_e(r.items)&&r.items.forEach(function(t){n.add(new Tn(t.name,t.bounds,n))}),"toolTip"in r&&_e(r.toolTip)&&(n.toolTip=r.toolTip),"color"in r&&_e(r.color)&&(n.color=r.color),"border"in r&&_e(r.border)&&(n.border=r.border),"backColor"in r&&_e(r.backColor)&&(n.backColor=r.backColor),"borderColor"in r&&_e(r.borderColor)&&(n.borderColor=r.borderColor),"allowUnisonSelection"in r&&_e(r.allowUnisonSelection)&&(n.allowUnisonSelection=r.allowUnisonSelection),"selectedIndex"in r&&_e(r.selectedIndex)&&(n.selectedIndex=r.selectedIndex)),n}return Er(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){var e=this.itemAt(t);this._hasDuplicates=this._hasDuplicateItems();var i=!1,r=!1;if(this._isLoaded){if(i=this.allowUnisonSelection,this.selectedIndex>=0){var n=this.itemAt(this.selectedIndex);n&&n._dictionary&&n._dictionary.has("AS")&&n._dictionary.get("AS").name===n.value&&(r=!0)}}else i=!(!this.allowUnisonSelection||!this._isUserRequired);for(var s=0;s<this._kidsCount;s++){var a=this.itemAt(s);i&&!this._isLoaded||i&&r&&this._isLoaded?a.value===e.value?(a._dictionary.update("AS",vs.get(a.value)),this._dictionary.update("V",vs.get(a.value)),this._dictionary.update("DV",vs.get(a.value))):a._dictionary.update("AS",vs.get("Off")):s===t?this._hasDuplicates?(a._dictionary.update("AS",vs.get(s.toString())),this._dictionary.update("V",vs.get(s.toString())),this._dictionary.update("DV",vs.get(s.toString()))):(a._dictionary.update("AS",vs.get(a.value)),this._dictionary.update("V",vs.get(a.value)),this._dictionary.update("DV",vs.get(a.value))):a._dictionary.update("AS",vs.get("Off"))}this._selectedIndex=t}},enumerable:!0,configurable:!0}),i.prototype._hasDuplicateItems=function(){if(this._kidsCount>2||this.itemsCount>2){for(var t=new Set,e=new Set,i=0;i<this._kidsCount;i++){var r=this.itemAt(i);t.has(r.value)?e.has(r.value)||e.add(r.value):t.add(r.value)}return e.size>0}return!1},Object.defineProperty(i.prototype,"allowUnisonSelection",{get:function(){return 0!=(this._fieldFlags&t._FieldFlag.radiosInUnison)&&(this._allowUnisonSelection=!0),this._allowUnisonSelection},set:function(e){e&&(this._fieldFlags|=t._FieldFlag.radiosInUnison),this._isUserRequired=e,this._allowUnisonSelection=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return this._parseBorderColor(!this._isLoaded)},set:function(t){this._updateBorderColor(t,!0)},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[t];r&&r instanceof Ss&&(i=this._crossReference._fetch(r)),i&&((e=Tn._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 Tn?(t._field=this,t._dictionary.update("Parent",this._ref),t._setField(this),this._kidsCount):new Tn(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 Ts(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",vs.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[r]&&(this.itemAt(r)._optionValue=t[r])}},i.prototype._obtainSelectedIndex=function(){for(var t=-1,e=0;e<this._kidsCount;++e){var i=this.itemAt(e);if(i){var r=D(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 vs&&"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),this._hasDuplicates=this._hasDuplicateItems();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):dt(n,o),this._drawTemplate(r,o._getPage(),o.bounds)}else(this._setAppearance||this._form._setAppearance||!o._isLoaded)&&(o._postProcess(this.allowUnisonSelection?this.selectedIndex>=0&&o.value===this.itemAt(this.selectedIndex).value?o.value:"Off":this._hasDuplicates?this.selectedIndex===a?a.toString():"Off":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(dt(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(this._isDuplicatePage||o._dictionary.update("AS",vs.get(this.selectedIndex===a?o.value:"Off")),e){r=this._createAppearance(o,n);this._drawTemplate(r,o._getPage(),o.bounds)}else this._isDuplicatePage||(o._postProcess(this.allowUnisonSelection&&this._isUserRequired?this.selectedIndex>=0&&o.value===this.itemAt(this.selectedIndex).value?o.value:"Off":this._hasDuplicates?this.selectedIndex===a?a.toString():"Off":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 Bn;r.bounds={x:0,y:0,width:i.width,height:i.height};var n=t.backColor;n&&(r.backBrush=new Qn(n)),r.foreBrush=new Qn(t.color);var s=t.border;if(t.borderColor&&(r.borderPen=new Zn(t.borderColor,s.width)),r.borderWidth=s.width,r.borderStyle=s.style,n){var a=[n.r-64,n.g-64,n.b-64],o=[a[0]>=0?a[0]:0,a[1]>=0?a[1]:0,a[2]>=0?a[2]:0];r.shadowBrush=new Qn({r:o[0],g:o[1],b:o[2]})}r.rotationAngle=t.rotate;var h=new Mi(r.bounds,this._crossReference),c=h.graphics;return t._styleText?this._drawRadioButton(c,r,t._styleText,e):this._drawRadioButton(c,r,gt(t.style),e),h},i.prototype._drawAppearance=function(e){var i=new Ts;if(e._dictionary.has("AP"))(i=e._dictionary.get("AP"))&&(i.has("N")&&Vt(i.get("N"),this._crossReference,e.value,"Off"),i.has("D")&&Vt(i.get("D"),this._crossReference,e.value,"Off")),Nt(i,this._crossReference,"N"),Nt(i,this._crossReference,"D");else{var r=this._crossReference._getNextReference();i=new Ts(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,c=new Ts(this._crossReference),_=e._field;!(h=this._isLoaded?_.allowUnisonSelection?e.value:this._hasDuplicates?e._index.toString():e.value:this.allowUnisonSelection&&this._isUserRequired&&_.allowUnisonSelection?e.value:this._hasDuplicates?e._index.toString():e.value)&&e._enableGrouping&&(h="check"+e._index),c.update(h,s),c.update("Off",o);var d=this._crossReference._getNextReference();this._crossReference._cacheMap.set(d,c),i.update("N",d);var u=this._createAppearance(e,t._PdfCheckFieldState.pressedChecked),l=this._crossReference._getNextReference();this._crossReference._cacheMap.set(l,u._content);var f=this._createAppearance(e,t._PdfCheckFieldState.pressedUnchecked),p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,f._content);var g=new Ts(this._crossReference);g.update(h,l),g.update("Off",p);var y=this._crossReference._getNextReference();this._crossReference._cacheMap.set(y,g),i.update("D",y),e._dictionary._updated=!0},i}(Nr),Hr=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Er(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=L(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",E([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[t][0]]);else{var r=[];t.forEach(function(t){e._checkIndex(t,i),r.push(e._options[t][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&&this._dictionary.has("V")&&void 0!==(i=this._dictionary.getArray("V"))&&(Array.isArray(i)?e.push.apply(e,i):"string"==typeof i&&e.push(i)),0===e.length&&this._dictionary&&this._dictionary.has("I")){var i=this._dictionary.get("I");i&&i.length>0&&e.push.apply(e,i.map(function(e){return t._options[e][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=Ut(this._form,t,this),this._font},set:function(t){t&&t instanceof Sr&&(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&&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[t])&&r instanceof Ss&&(i=this._crossReference._fetch(r)),i&&((e=Cn._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[t][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[t])&&r instanceof Ss&&(i=this._crossReference._fetch(r)),i&&((e=Cn._load(i,this._crossReference,this))._index=t,e._ref=r,this._options&&this._options.length>0&&t<this._options.length?e._text=this._options[t][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&&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 Ts(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",vs.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"))e._dictionary.get("DS").split(";").forEach(function(t){var e=t.split(":");if(-1!==t.indexOf("font-family"))i=e[1];else if(-1!==t.indexOf("font-size"))e[1].endsWith("pt")&&(r=Number.parseFloat(e[1].replace("pt","")));else if(-1===t.indexOf("font-style")&&-1!==t.indexOf("font")){for(e[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(i+=t+" "),t.endsWith("pt")&&(r=Number.parseFloat(t.replace("pt","")))});" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-2);-1!==i.indexOf(",")&&(i=i.split(",")[0])}});else{var n=e._dictionary.get("DA");if(n&&""!==n&&-1!==n.indexOf("Tf")){var s=n.split(" ");s.forEach(function(t,e){if(-1!==t.indexOf("Tf")){for(i=s[e-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);r=Number.parseFloat(s[e-1])}});var a=0;if(0===r){var o=new xr(t.PdfFontFamily.helvetica,a);null!==o&&(a=this._getFontHeight(o._fontFamily),(Number.isNaN(a)||0===a)&&(a=12),o._size=a,r=a)}}}switch((i=i.trim())&&(i=ve(i)),i){case"Helv":this._font=new xr(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular);break;case"Courier":case"Cour":this._font=new xr(t.PdfFontFamily.courier,r,t.PdfFontStyle.regular);break;case"Symb":this._font=new xr(t.PdfFontFamily.symbol,r,t.PdfFontStyle.regular);break;case"TiRo":this._font=new xr(t.PdfFontFamily.timesRoman,r,t.PdfFontStyle.regular);break;case"ZaDb":this._font=new xr(t.PdfFontFamily.zapfDingbats,r,t.PdfFontStyle.regular);break;default:this._font=new xr(t.PdfFontFamily.helvetica,r,t.PdfFontStyle.regular)}if(this._font&&this._font._dictionary&&this._font._dictionary.has("BaseFont")){var h=this._font._dictionary.get("BaseFont").name;if(h&&h!==i&&this.form._dictionary.has("DR")){var c=this.form._dictionary.get("DR").get("Font");if(c&&c.has(i)){var _=c.get(i),d=_.get("Subtype").name;if(_&&i&&_.has("BaseFont")){var u=_.get("BaseFont"),l=t.PdfFontStyle.regular;if(u&&null!==u.name&&void 0!==u.name)if(l=Gt(u.name),d&&"TrueType"===d)(f=ye(this.form,_))&&f.length>0&&(p=I(f))&&p.length>0&&(this._font=new Ar(p,r,l));else if(d&&"Type0"===d){var f=Zt(_);if(f&&f.length>0){var p=I(f);p&&p.length>0&&(this._font=new Ar(p,r,l))}}}}}}}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)&&e.push.apply(e,r))}else{var n=this._dictionary.get("I");null!==n&&void 0!==n&&n.length>0&&n[0]>-1&&this._options&&this._options.length>0&&e.push.apply(e,n.map(function(e){return t._options[e][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[i][0]){e=i;break}return e},i.prototype._addEmptyWidget=function(){var t=new Pn;t._create(this._page,this.bounds,this),this._addToKid(t),t._dictionary.update("MK",new Ts(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.prototype._getStringFormat=function(){var e=this.itemAt(this._defaultIndex),i=new Ei;if(i.lineAlignment=(this._fieldFlags&t._FieldFlag.multiLine)>0?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle,e&&e._dictionary.has("Q")){var r=e._dictionary.get("Q");null!==r&&void 0!==r&&(i.alignment=r)}return i},i}(Nr),Wr=function(e){function i(i,r,n,s){var a=e.call(this)||this;return i&&r&&n&&(a._initialize(i,r,n),a._fieldFlags|=t._FieldFlag.combo),s&&("items"in s&&_e(s.items)&&s.items.forEach(function(t){a.addItem(new Cn(t.text,t.value))}),"toolTip"in s&&_e(s.toolTip)&&(a.toolTip=s.toolTip),"color"in s&&_e(s.color)&&(a.color=s.color),"border"in s&&_e(s.border)&&(a.border=s.border),"backColor"in s&&_e(s.backColor)&&(a.backColor=s.backColor),"borderColor"in s&&_e(s.borderColor)&&(a.borderColor=s.borderColor),"font"in s&&_e(s.font)&&(a.font=s.font),"selectedIndex"in s&&_e(s.selectedIndex)&&(a.selectedIndex=s.selectedIndex)),a}return Er(i,e),Object.defineProperty(i.prototype,"_isAutoFontSize",{get:function(){var t=this,e=!1;if(this._isLoaded&&this._form){var i=this._form._dictionary;if(i&&i.has("DA")){var r=i.get("DA");if(r){var n=new Kr(r);if(0===n.fontSize)if(this._kids&&this._kids.length>0){var s=!1;this._dictionary.has("DA")&&(r=this._dictionary.get("DA"))&&(n=new Kr(r))&&n.fontSize>0&&(s=!0),s||this._kids.forEach(function(i){var s;if(i&&i instanceof Ss&&(s=t._crossReference._fetch(i)),s)if(s.has("DA")){var a=0;(r=s.get("DA"))&&(n=new Kr(r))&&(a=n.fontSize),0===a&&(e=!0)}else e=!0})}else if(this._dictionary.has("DA")){var a=0;(r=this._dictionary.get("DA"))&&(n=new Kr(r))&&(a=n.fontSize),0===a&&(e=!0)}else e=!0}}}return e},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[r][1];n&&(this.itemAt(r)._text=n||"")}}},i.prototype._createAppearance=function(e){var i=new Bn;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,n.size,n.rotation):i.bounds={x:0,y:0,width:r.width,height:r.height},(o=e.backColor)&&!o.isTransparent&&(i.backBrush=new Qn(o)),i.foreBrush=new Qn(e.color?e.color:this.color);h=e.border;if(e.borderColor&&(i.borderPen=new Zn(e.borderColor,h.width),we(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){_={r:(c=[o.r-64,o.g-64,o.b-64])[0]>=0?c[0]:0,g:c[1]>=0?c[1]:0,b:c[2]>=0?c[2]:0};i.shadowBrush=new Qn(_)}var s=void 0!==e.textAlignment?e.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Ei(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,this.page.size,this.page.rotation):i.bounds={x:0,y:0,width:r.width,height:r.height});var o=this.backColor;o&&!o.isTransparent&&(i.backBrush=new Qn(o)),i.foreBrush=new Qn(this.color);var h=this.border;if(this.borderColor&&(i.borderPen=new Zn(this.borderColor,h.width),we(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o.r-64,o.g-64,o.b-64],_={r:c[0]>=0?c[0]:0,g:c[1]>=0?c[1]:0,b:c[2]>=0?c[2]:0};i.shadowBrush=new Qn(_)}i.rotationAngle=this.rotationAngle,null!==this.rotate&&void 0!==this.rotate&&(i.rotationAngle=this.rotate);var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Ei(s,a)}i.required=this.required,null!==i.bounds&&void 0!==i.bounds||(i.bounds={x:0,y:0,width:0,height:0});var d=new Mi(i.bounds,this._crossReference),u=d.graphics;if(u._sw._clear(),this.required||(u._sw._beginMarkupSequence("Tx"),u._initializeCoordinates()),this._isLoaded){var l=void 0;e&&(l=this._obtainFont(e)),void 0!==l&&null!==l||(l=this.font),l&&0!==l.size||(l=this._appearanceFont),this._drawComboBox(u,i,l,i.stringFormat)}else this._font||(this._font=new xr(t.PdfFontFamily.timesRoman,this._getFontHeight(t.PdfFontFamily.helvetica))),this._drawComboBox(u,i,this._font,i.stringFormat);return this.required||u._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[o],c=[0,0],_=i.borderWidth,d=2*_,u=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;u?(c[0]=2*d,c[1]=2*_):(c[0]=d+2,c[1]=1*_);var l=i.foreBrush,f=i.bounds,p=f.width-d,g=f;g.height-=u?d:_,e.setClip(g,t.PdfFillMode.winding),0===i.rotationAngle&&(u&&(p-=d),l=new Qn(this.color?this.color:{r:0,g:0,b:0}));var y=void 0;if(y=h&&Array.isArray(h)?h[1]?h[1]:h[0]:h){var m={x:c[0],y:c[1],width:p-c[0],height:f.height};if(i.rotationAngle>0){var b=e.save();if(90===i.rotationAngle)e.translateTransform({x:0,y:e._size.height}),e.rotateTransform(-90),g={x:v=e._size.height-(g.y+g.height),y:w=g.x,width:g.height+g.width,height:g.width};else if(270===i.rotationAngle)e.translateTransform({x:e._size.width,y:0}),e.rotateTransform(-270),g={x:v=g.y,y:w=e._size.width-(g.x+g.width),width:g.height+g.width,height:g.width};else if(180===i.rotationAngle){e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180);var v=e._size.width-(g.x+g.width),w=e._size.height-(g.y+g.height);g={x:v,y:w,width:g.width,height:g.height}}u&&(p-=d),l=new Qn({r:0,g:0,b: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 xr(e,12),n=new Ei(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[t][1],{width:0,height:0},n,0,0).width)});else if(s.length>0)for(var _=r.measureString(s[0][1],{width:0,height:0},n,0,0).width,d=1;d<s.length;++d){l=r.measureString(s[d][1],{width:0,height:0},n,0,0).width;_=Math.max(_,l),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 xr(e,12),n=new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),s=this._dictionary.getArray("Opt");var u=this.selectedValue,l=r.measureString(null!==u&&"string"==typeof u?u:s[o[0]][1],{width:0,height:0},n,0,0).width;a=this.bounds,i=l?12*(a.width-4*h)/l:12}var f=0;if(o&&o.length>0){if(12!==i){r=new xr(e,i);var p=null!==(u=this.selectedValue)&&"string"==typeof u?u:s[o[0]][1],g=r.measureString(p);if(g.width>a.width||g.height>a.height)for(var l=a.width-4*h,y=a.height-4*h,d=1;d<=a.height;d++){var m=(r=new xr(e,d)).measureString(p);if(m.width>a.width||m.height>y){f=d;do{var b=(r=new xr(e,f-=.001)).getLineWidth(p,n);if(f<.248){r._size=.248;break}if(m=r.measureString(p,{width:0,height:0},n,0,0),b<l&&m.height<y){r._size=f;break}}while(f>.248);i=f;break}}}}else i>12&&(i=12);return i},i}(Hr),qr=function(e){function i(t,i,r,n){var s=e.call(this)||this;return t&&i&&r&&s._initialize(t,i,r),n&&("items"in n&&_e(n.items)&&n.items.forEach(function(t){s.addItem(new Cn(t.text,t.value))}),"toolTip"in n&&_e(n.toolTip)&&(s.toolTip=n.toolTip),"color"in n&&_e(n.color)&&(s.color=n.color),"border"in n&&_e(n.border)&&(s.border=n.border),"backColor"in n&&_e(n.backColor)&&(s.backColor=n.backColor),"borderColor"in n&&_e(n.borderColor)&&(s.borderColor=n.borderColor),"font"in n&&_e(n.font)&&(s.font=n.font),"multiSelect"in n&&_e(n.multiSelect)&&(s.multiSelect=n.multiSelect),"selectedIndex"in n&&_e(n.selectedIndex)&&(s.selectedIndex=n.selectedIndex)),s}return Er(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},i.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt"),e=this._kidsCount,i=t.length<=e?t.length:e;if(this._listValues=new Array(i),t&&t.length>0){var r=this._dictionary.get("I");Array.isArray(r)&&r.length>0&&(r=r[0],this._selectedIndex=r);for(var n=0;n<i;n++){var s=this.itemAt(n);if(s)if(_e(r)&&null!==this._listValues&&void 0!==this._listValues){var a=t[n];Array.isArray(a)?this._listValues[n]=a[1]:this._listValues[n]=a,n===r?(s._text=this._listValues[n],this._selectedIndex=n):s._text=this._listValues[n]}else s._text=""}}}},i.prototype._createAppearance=function(e){var i=new Bn;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,n.size,n.rotation):i.bounds={x:0,y:0,width:r.width,height:r.height},(o=e.backColor)&&!o.isTransparent&&(i.backBrush=new Qn(o)),i.foreBrush=new Qn(e.color?e.color:this.color);h=e.border;if(e.borderColor&&(i.borderPen=new Zn(e.borderColor,h.width),we(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){_={r:(c=[o.r-64,o.g-64,o.b-64])[0]>=0?c[0]:0,g:c[1]>=0?c[1]:0,b:c[2]>=0?c[2]:0};i.shadowBrush=new Qn(_)}e._enableGrouping&&void 0===e.rotate?i.rotationAngle=0: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 Ei(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,this.page.size,this.page.rotation):i.bounds={x:0,y:0,width:r.width,height:r.height};var o=this.backColor;o&&!o.isTransparent&&(i.backBrush=new Qn(o)),i.foreBrush=new Qn(this.color);var h=this.border;if(this.borderColor&&(i.borderPen=new Zn(this.borderColor,h.width),we(h,i)),i.borderStyle=h.style,i.borderWidth=h.width,o){var c=[o.r-64,o.g-64,o.b-64],_={r:c[0]>=0?c[0]:0,g:c[1]>=0?c[1]:0,b:c[2]>=0?c[2]:0};i.shadowBrush=new Qn(_)}i.rotationAngle=this.rotationAngle,null!==this.rotate&&void 0!==this.rotate&&(i.rotationAngle=this.rotate);var s=void 0!==this.textAlignment?this.textAlignment:t.PdfTextAlignment.left,a=this.multiSelect?t.PdfVerticalAlignment.top:t.PdfVerticalAlignment.middle;i.stringFormat=new Ei(s,a)}i.required=this.required;var d=new Mi(i.bounds,this._crossReference),u=d.graphics;if(u._sw._clear(),this.required||(u._sw._beginMarkupSequence("Tx"),u._initializeCoordinates()),this._isLoaded){var l=this._obtainFont(e);(void 0===l||null===l||!this._isLoaded&&1===l.size)&&(l=this._appearanceFont),this._drawListBox(u,i,l,i.stringFormat)}else this._font||(this._font=this._defaultItemFont),this._drawListBox(u,i,this._font,i.stringFormat);return this.required||u._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[o],c=[],_=i.borderWidth,d=2*_,u=i.borderStyle===t.PdfBorderStyle.inset||i.borderStyle===t.PdfBorderStyle.beveled;u?(c.push(2*d),c.push((o+2)*_+r._getHeight()*o)):(c.push(d+2),c.push((o+1)*_+r._getHeight()*o+1));var l=i.foreBrush,f=i.bounds,p=f.width-d,g=f;g.height-=u?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){S=f.x+_;u&&(S+=_,p-=d),l=new Qn({r:153,g:193,b:218}),e.drawRectangle({x:S,y:c[1],width:p,height:r._getHeight()},l),l=new Qn(a.color?a.color:{r:0,g:0,b:0})}var b=void 0;b=h&&"string"==typeof h?h:h[1]?h[1]:h[0];var v={x:c[0],y:c[1],width:p-c[0],height:r._getHeight()};if(i.rotationAngle>0){var w=e.save();if(90===i.rotationAngle)e.translateTransform({x:0,y:e._size.height}),e.rotateTransform(-90),g={x:S=e._size.height-(g.y+g.height),y:x=g.x,width:g.height+g.width,height:g.width};else if(270===i.rotationAngle)e.translateTransform({x:e._size.width,y:0}),e.rotateTransform(-270),g={x:S=g.y,y:x=e._size.width-(g.x+g.width),width:g.height+g.width,height:g.width};else if(180===i.rotationAngle){e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180);var S=e._size.width-(g.x+g.width),x=e._size.height-(g.y+g.height);g={x:S,y:x,width:g.width,height:g.height}}if(y){S=f.x+_;u&&(S+=_,p-=d),l=new Qn({r:153,g:193,b:218}),e.drawRectangle({x:S,y:c[1],width:p,height:r._getHeight()},l),l=new Qn(a.color?a.color:{r:0,g:0,b:0})}e.drawString(b,r,v,null,l,n),e.restore(w)}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 xr(e,12,t.PdfFontStyle.regular),r=new Ei(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),n=0;if(_e(this._listValues)&&this._listValues.length>0){for(var s=i.measureString(this._listValues[0],{width:0,height:0},r,0,0).width,a=1;a<this._listValues.length;++a){var o=i.measureString(this._listValues[a],{width:0,height:0},r,0,0).width;s=s>o?s:o}n=(n=12*(this.bounds.width-4*this.border.width)/s)>12?12:n}return n},i}(Hr),Gr=function(e){function i(t,i,r,n){var s=e.call(this)||this;return s._rotateAngle=0,s._isSigned=!1,s._revision=-1,t&&i&&r&&s._initialize(t,i,r),n&&("toolTip"in n&&_e(n.toolTip)&&(s.toolTip=n.toolTip),"color"in n&&_e(n.color)&&(s.color=n.color),"border"in n&&_e(n.border)&&(s.border=n.border),"backColor"in n&&_e(n.backColor)&&(s.backColor=n.backColor),"borderColor"in n&&_e(n.borderColor)&&(s.borderColor=n.borderColor)),s}return Er(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.getSignature=function(){return!this._signature&&this._dictionary.has("V")&&(this._signature=this._crossReference._document._getSignature(this._dictionary.get("V"),this)),this._signature},i.prototype.setSignature=function(e){if(this._crossReference){this._crossReference._document.form._signatureFlag=t._SignatureFlag.signatureExists|t._SignatureFlag.appendOnly,e._signatureField=this,e._signatureDictionary=e._createDictionary(this._crossReference._document,e),this._signature=e;var i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,e._signatureDictionary._dictionary),e._reference=i,e._signatureDictionary._dictionary._isSignature=!0,this._crossReference._signature=e._signatureDictionary,this._dictionary.update("V",i),this._dictionary.update("Ff",0),this._crossReference._signatureCollection.push(e)}},i.prototype.getAppearance=function(){if(this._isLoaded)return null;if(!this._appearance){var t={x:0,y:0,width:this.bounds.width,height:this.bounds.height};this._appearance=new Fr(t,this._widgetAnnot),this._appearance.normal=new Mi(t,this._crossReference)}return this._appearance},i.prototype.getRevision=function(){return this.isSigned&&-1===this._revision&&(this._revision=this._getSignedRevision()),this._revision},i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new Ts(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",vs.get("Sig")),this._dictionary.update("T",e),this._defaultIndex=0,this._initializeFont(this._defaultFont),this._createItem(i)},i.prototype._createItem=function(t){this._widgetAnnot=new Pn,this._widgetAnnot._create(this._page,t,this),this._widgetAnnot._dictionary.update("MK",new Ts(this._crossReference)),this._widgetAnnot._mkDictionary.update("BC",[0,0,0]),this._widgetAnnot._mkDictionary.update("BG",[1,1,1]),this._widgetAnnot._dictionary.update("DA",this._fontName+" 8 Tf 0 0 0 rg"),this._addToKid(this._widgetAnnot)},i.prototype._doPostProcess=function(t){void 0===t&&(t=!1),this._signature&&this._signature._isLocked&&!this._signature._certify&&!this._signature._signed&&this._signature._lockSignature();var e=this._setAppearance||this._form._setAppearance;if((t||e||this._appearance)&&(a=this._kidsCount)>0)for(h=0;h<a;h++){var i=this.itemAt(h);if(this._appearance){s=this._appearance.normal;this._rotateAngle=this._widgetAnnot._getRotationAngle(),lt(s,this.rotate);var r=new Ts;s._content.dictionary._updated=!0;var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,s._content),s._content.reference=n,r.set("N",n),r._updated=!0,this._widgetAnnot._dictionary.set("AP",r)}else if(i&&i._dictionary&&(e||t&&!i._dictionary.has("AP"))){var s=this._createAppearance(i,t);this._addAppearance(i._dictionary,s,"N")}}if(t){var a=this._kidsCount;if(a>0){for(var o=void 0,h=0;h<a;h++)if((i=this.itemAt(h))&&i._dictionary){var c=i.page;c&&(o||0!==h||(o=this._getItemTemplate(i._dictionary)),this._appearance&&(o=this._appearance.normal),this._flattenSignature(i._dictionary,c,i.bounds,o))}}else this._flattenSignature(this._dictionary,this.page,this.bounds)}},i.prototype._createAppearance=function(t,e){var i=t.bounds,r=new Mi([0,0,i.width,i.height],this._crossReference);lt(r,null),r._writeTransformation=!1;var n=r.graphics,s=new Bn;s.bounds={x:0,y:0,width:i.width,height:i.height};var a=t.backColor;e&&a&&!a.isTransparent&&(s.backBrush=new Qn(a)),s.foreBrush=new Qn(t.color);var o=t.border;if(t.borderColor&&(s.borderPen=new Zn(t.borderColor,o.width)),s.borderWidth=o.width,s.borderStyle=o.style,a){var h=[a.r-64,a.g-64,a.b-64],c={r:h[0]>=0?h[0]:0,g:h[1]>=0?h[1]:0,b:h[2]>=0?h[2]:0};s.shadowBrush=new Qn(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 Mi(o,this._crossReference))&&i){_=(c=i.graphics).save();this.isSigned&&(s._isSignature=!0),i.rotation!==t.PdfRotationAngle.angle0?(d=new Gn(c._size,c._sw._stream,c._crossReference,i)).drawTemplate(s,this._calculateTemplateBounds(r,i,s,d)):c.drawTemplate(s,r),c.restore(_)}}}else if(n&&i){s=n;var c=i.graphics,_=c.save();if(i.rotation!==t.PdfRotationAngle.angle0){var d=new Gn(c._size,c._sw._stream,c._crossReference,i);d.drawTemplate(s,this._calculateTemplateBounds(r,i,s,d))}else 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(e.graphics._matrix);if(90===a)r.translateTransform({x:i._size.height,y:0}),r.rotateTransform(90),n=t.x,s=-(e._size.height-t.y-t.height);else if(180===a)r.translateTransform({x:i._size.width,y:i._size.height}),r.rotateTransform(180),n=-(e._size.width-(t.x+i._size.width)),s=-(e._size.height-t.y-i._size.height);else if(270===a)if(r.translateTransform({x:0,y:i._size.width}),r.rotateTransform(270),e._size.width>e._size.height&&i._content&&i._content.dictionary&&i._content.dictionary.has("Matrix")){var o=i._content.dictionary.get("Matrix");if(-1!==o[1]||1!==o[2])return n=-(e._size.width-t.x-t.width),s=t.y+t.x+i._size.width,{x:n,y:s,width:t.height,height:t.width};n=-(e._size.width-t.x-i.size.width),s=t.y-t.height}else n=-(e._size.width-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&&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 Mi(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.prototype._getSignedRevision=function(){var t=this._dictionary.get("V").getArray("ByteRange"),e=t[0]+t[1],i=t[2]+t[3],r=-1;if(this._crossReference&&this._crossReference._document){var n=this._crossReference._document.getRevisions();if(n&&Array.isArray(n)&&n.length>0)for(var s=0;s<n.length;s++){var a=n[s];if(a>e&&a===i){r=s+1;break}}}return r},i}(Nr),Kr=function(){function t(t){var e,i="",r=0;if(t&&"string"==typeof t&&""!==t){var n=t.split(" ");n.forEach(function(t,s){switch(t){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?q(e):{r:0,g:0,b:0}}return t.prototype.toString=function(){var t=[Number.parseFloat((this.color.r/255).toFixed(3)),Number.parseFloat((this.color.g/255).toFixed(3)),Number.parseFloat((this.color.b/255).toFixed(3))];return"/"+this.fontName+" "+this.fontSize+" Tf "+t[0].toString()+" "+t[1].toString()+" "+t[2].toString()+" rg"},t}(),Xr=function(){function e(t){this._recordCollection=[],this._operands=[],this._inlineImageBytes=[],this._isByteOperand=!1,this._lexer=new Jr(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:if("ID"===this._lexer._operatorParams){this._createRecord(),this._operands=[],this._consumeValue();break}this._createRecord(),this._operands=[];break;case t._TokenType.beginArray:break;case t._TokenType.endArray:throw new Error("Error while parsing content")}}},e.prototype._consumeValue=function(){for(var t,e,i,r;;){var n=0;if("E"===(t=this._lexer._getNextCharForInlineStream())||t===String.fromCharCode(65535))if("I"===(e=this._lexer._getNextInlineChar())||e===String.fromCharCode(65535)&&t===String.fromCharCode(65535)){for(i=this._lexer._nextCharacter,r=this._lexer._nextCharacter;" "===r||"\r"===r||"\n"===r;)r=this._lexer._getNextChar(),n++;if(this._lexer._resetContentPointer(n)," "===i||"\n"===i||i===String.fromCharCode(65535)||"\r"===i){if("Q"===r||r===String.fromCharCode(65535)||"S"===r||r>="0"&&r<="9"){this._lexer._operatorParams="",this._lexer._operatorParams+=t,this._lexer._operatorParams+=e,this._isByteOperand=!0,this._createRecord(),this._isByteOperand=!1,this._inlineImageBytes=[],e=this._lexer._getNextInlineChar();break}}else this._inlineImageBytes.push(255&t.charCodeAt(0)),this._inlineImageBytes.push(255&e.charCodeAt(0)),this._inlineImageBytes.push(255&i.charCodeAt(0)),this._inlineImageBytes.push(255&r.charCodeAt(0)),t=this._lexer._getNextCharForInlineStream()}else this._inlineImageBytes.push(255&t.charCodeAt(0)),this._inlineImageBytes.push(255&e.charCodeAt(0));else this._inlineImageBytes.push(255&t.charCodeAt(0))}},e.prototype._createRecord=function(){var t,e=this._lexer._operatorParams;(t=this._isByteOperand?new Yr(e,new Uint8Array(this._inlineImageBytes)):new Yr(e,this._operands))._splitText=this._lexer._text,this._recordCollection.push(t)},e.prototype._getNextToken=function(){return this._lexer._getNextToken()},e}(),Jr=function(){function e(e){this._tokenType=t._TokenType.none,this._currentCharacter="\0",this._nextCharacter="\0",this._offset=0,this._text=[],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="";var e,i=this._currentCharacter,r=this._consumeValue(),n=!0,s=0,a="";for(this._text=[];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._text[s]="<"+a,s++,a=""):"<"===r&&(""!==a&&(this._text[s]=a.slice(0,-1),s++),a=""),a+=r=this._consumeValue()}else""!==a&&(this._text[s]=a.slice(0,-1),a="",s++),r=this._consumeValue(),e=this._getLiteralStringValue(r),this._text[s]="("+e,s++,this._operatorParams+=e,a+=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._resetContentPointer=function(t){this._offset=this._offset-t},e.prototype._getNextInlineChar=function(){return this._data.length<=this._offset?(this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)):(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&("\n"===this._nextCharacter?this._currentCharacter="\r":this._currentCharacter="\n")),this._currentCharacter},e.prototype._getNextCharForInlineStream=function(){return this._data.length<=this._offset?(this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)):(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&"\n"===this._nextCharacter&&this._data.length<=this._offset&&(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(65535))),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}(),Yr=function(){function t(t,e){this._operator=t,Array.isArray(e)?this._operands=e:this._inlineImageBytes=e}return t}(),Qr=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=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._popUpFont=new xr(t.PdfFontFamily.helvetica,10.5),this._authorBoldFont=new xr(t.PdfFontFamily.helvetica,10.5,t.PdfFontStyle.bold),this._lineCaptionFont=new xr(t.PdfFontFamily.helvetica,10,t.PdfFontStyle.regular),this._circleCaptionFont=new xr(t.PdfFontFamily.helvetica,8,t.PdfFontStyle.regular),this._isTransparentColor=!1,this._isRotated=!1,this._isChanged=!1,this._quadPoints=new Array(8),this._boundsCollection=[],this._customTemplate=new Map,this._isTextUpdated=!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&&this._dictionary.has("T")&&(this._dictionary.update("T",t),this._author=t,e=!0),this._dictionary&&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 In({width:1,style:t.PdfBorderStyle.solid});e._dictionary=this._dictionary,this._dictionary&&this._dictionary.has("Border")&&(r=this._dictionary.getArray("Border"))&&r.length>=3&&(e._hRadius=r[0],e._vRadius=r[1],e._width=r[2]);var i=void 0;if(this._dictionary&&this._dictionary.has("BS")?i=this._dictionary:this instanceof Tn&&this._field&&this._field._dictionary&&this._field._dictionary.has("BS")&&(i=this._field._dictionary),i){var r=i.get("BS");if(r){if(r.has("W")){var n=r.get("W");void 0===n||Number.isNaN(n)||(e._width=n)}if(r.has("S")){var s=r.get("S");if(s)switch(s.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(r.has("D")){var a=r.getArray("D");a&&(e._dash=a)}}}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&&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])),null!==this._dictionary&&this._dictionary&&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 Ts(this._crossReference);o.update("Type",vs.get("Border")),o.update("W",this._border.width),o.update("S",G(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&&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=q(this._dictionary.getArray("C"))),this._color},set:function(t){if(null!==t&&void 0!==t){var e=this.color;this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._color=t,this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(7)),Number.parseFloat((t.g/255).toFixed(7)),Number.parseFloat((t.b/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=q(this._dictionary.getArray("IC"))),this._innerColor},set:function(t){if(t){var e=this.innerColor;this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._innerColor=t,this._dictionary.update("IC",[Number.parseFloat((t.r/255).toFixed(7)),Number.parseFloat((t.g/255).toFixed(7)),Number.parseFloat((t.b/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&&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=L(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.height-(t.y+t.height),r=i+t.height;this._dictionary.update("Rect",[t.x,i,t.x+t.width,r]),this._bounds=t,this._isChanged=!0}}}else this._bounds=t,this._isChanged=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"caption",{get:function(){if(void 0===this._caption){var e=new kn;if(e._dictionary=this._dictionary,this._dictionary&&this._dictionary.has("Cap")&&(e._cap=this._dictionary.get("Cap")),this._dictionary&&this._dictionary.has("CP")){var i=this._dictionary.get("CP");i&&(e._type="Top"===i.name?t.PdfLineCaptionType.top:t.PdfLineCaptionType.inline)}if(this._dictionary&&this._dictionary.has("CO")){var r=this._dictionary.getArray("CO");e._offset={x:r[0],y:r[1]}}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&&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){"string"==typeof t&&this.subject!==t&&(this._dictionary.update("Subj",t),this._subject=t,this._dictionary.has("Subject")&&this._dictionary.update("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){if("string"==typeof t&&(this._text=this._dictionary.get("Contents"),t!==this._text)){if((this instanceof tn||this instanceof en||this instanceof nn)&&this.measure&&(void 0===this._unit||this._isLoaded)&&this._dictionary.has("Contents")){this._isTextUpdated=!0;var e=this._dictionary.get("Contents");this._unit=mt(e.substring(e.length-2))}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&&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._isRotated=!0,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}),Object.defineProperty(e.prototype,"layer",{get:function(){return this._layer||(this._layer=this._getDocumentLayer()),this._layer},set:function(t){this._layer||(this._layer=t,this._layer?this._dictionary.update("OC",this._layer._referenceHolder):delete this._dictionary._map.OC)},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||!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)).forEach(function(t){t instanceof vs?e.push(t.name):"string"==typeof t?e.push(t):"number"==typeof t&&e.push(t.toString())});else if(i instanceof vs)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._export=function(e){if(!this._page||!this._dictionary)throw new Error("Annotation must be added to a page before export.");var i,r=this._crossReference._document;if(i=this._dictionary&&this._dictionary.has("P")?_(r,this._dictionary.get("P")):this._page._pageIndex,e===t.DataFormat.xfdf)return this._exportAsXfdf(r,i);if(e===t.DataFormat.json)return this._exportAsJson(r,i);throw new Error("Unsupported export format. Use DataFormat.xfdf or DataFormat.json.")},e.prototype._exportAsXfdf=function(t,e){var i=new Di;i.exportAppearance=!0,i._document=t,i._crossReference=t._crossReference,this._crossReference=t._crossReference,i._isAnnotationExport=!0;var r=new Ti;r._writeStartDocument(),r._writeStartElement("xfdf"),r._writeAttributeString(null,"http://ns.adobe.com/xfdf/","xmlns",null),r._writeAttributeString("space","preserve","xml",null),r._writeStartElement("annots"),this._doPostProcess(!1),i._exportAnnotationData(this,r,e);var n=this;if(n&&n.reviewHistory&&n.reviewHistory.count>0)for(a=0;a<n.reviewHistory.count;a++){var s=n.reviewHistory.at(a);s._page=this._page,s._doPostProcess(!1),i._exportAnnotationData(s,r,e)}if(n&&n.comments&&n.comments.count>0)for(var a=0;a<n.comments.count;a++){var o=n.comments.at(a);o._page=this._page,o._doPostProcess(!1),i._exportAnnotationData(o,r,e);var h=o;if(h&&h.reviewHistory&&h.reviewHistory.count>0)for(var c=0;c<h.reviewHistory.count;c++){var _=h.reviewHistory.at(c);_._page=this._page,_._doPostProcess(!1),i._exportAnnotationData(_,r,e)}}r._writeEndElement(),i._asPerSpecification||(r._writeStartElement("f"),r._writeAttributeString("href",i._fileName||""),r._writeEndElement()),r._writeEndElement();var d=r._save();return r._destroy(),d},e.prototype._exportAsJson=function(t,e){var i,r=new Oi;r.exportAppearance=!0,r._document=t,r._crossReference=t._crossReference,this._crossReference=t._crossReference,r._isAnnotationExport=!0;var n={pdfAnnotation:(i={},i[e]={shapeAnnotation:[]},i)};this._doPostProcess(!1),r._table.clear(),r._exportAnnotation(this,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(r._convertToJson(r._table)));var s=this;if(s&&s.reviewHistory&&s.reviewHistory.count>0)for(o=0;o<s.reviewHistory.count;o++){var a=s.reviewHistory.at(o);a._page=this._page,a._doPostProcess(!1),r._table.clear(),r._exportAnnotation(a,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(r._convertToJson(r._table)))}if(s&&s.comments&&s.comments.count>0)for(var o=0;o<s.comments.count;o++){var h=s.comments.at(o);h._page=this._page,h._doPostProcess(!1),r._table.clear(),r._exportAnnotation(h,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(r._convertToJson(r._table)));var c=h;if(c&&c.reviewHistory&&c.reviewHistory.count>0)for(var _=0;_<c.reviewHistory.count;_++){var d=c.reviewHistory.at(_);d._page=this._page,d._doPostProcess(!1),r._table.clear(),r._exportAnnotation(d,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(r._convertToJson(r._table)))}}return f(JSON.stringify(n))},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||this instanceof sn||this instanceof an||(this._dictionary.has("Rotate")?t=this._dictionary.get("Rotate"):this._dictionary.has("Rotation")&&(t=this._dictionary.get("Rotation"))),t},e.prototype._getMediaOrCropBox=function(t){var e;return t&&t._pageDictionary&&t._pageDictionary.has("MediaBox")?e=t._pageDictionary.get("MediaBox"):t&&t._pageDictionary&&t._pageDictionary.has("CropBox")&&(e=t._pageDictionary.get("CropBox")),e},e.prototype._getBoundsValue=function(t,e){var i=0;_e(t)&&(i=t.length);var r=[],n=[];if(i>0&&t.forEach(function(t,e){e%2==0?r.push(t):n.push(t)}),r.sort(function(t,e){return t>e?1:-1}),n.sort(function(t,e){return t>e?1:-1}),e){var s=2*this.border.width;return{x:r[0]-s,y:n[0]-s,width:r[r.length-1]-r[0]+2*s,height:n[n.length-1]-n[0]+2*s}}return{x:r[0],y:n[0],width:r[r.length-1]-r[0],height:n[n.length-1]-n[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&&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]&&(this._page&&_[0]!==-d[4]&&_[1]!==-d[5]||0===_[0]&&0==-d[4])){var u=this._page.graphics,l=u.save();void 0!==this.opacity&&this._opacity<1&&u.setTransparency(this._opacity),c.x-=_[0],c.y+=_[1],u.drawTemplate(e,c),u.restore(l),this._page.annotations.remove(this),r=!1}}return r},e.prototype._flattenAnnotationTemplate=function(e,i,r){void 0===r&&(r=!1),this._page._isLineAnnotation=r;var n=this._page.graphics,s=this.bounds;if(this instanceof tn&&this._dictionary&&!this._dictionary.has("AP"))if(s=this._isLoaded?this._bounds:this instanceof tn&&!this.measure?O([this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]):this._setAppearance&&this.flatten&&!this.measure?this._bounds:O([this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]),this._page){var a=this._page.size,o=this._page.mediaBox,h=this._page.cropBox;h&&Array.isArray(h)&&4===h.length&&this._page._pageDictionary.has("CropBox")&&!this._isLoaded&&!this._flatten?0===h[0]&&0===h[1]&&a.width!==h[2]&&a.height!==h[3]||s.x===h[0]?s.y=a.height-(s.y+s.height):(s.x-=h[0],s.y=h[3]-(s.y+s.height)):o&&Array.isArray(o)&&4===o.length&&this._page._pageDictionary.has("MediaBox")&&!this._isLoaded&&!this._flatten?o[0]>0||o[1]>0||a.width===o[2]||a.height===o[3]?(s.x-=o[0],s.y=o[3]-(s.y+s.height)):s.y=a.height-(s.y+s.height):this instanceof tn&&!this.measure&&!this._isLoaded?s.y=a.height-(s.y+s.height):this._setAppearance&&this.flatten&&!this.measure?s=this.bounds:this._isLoaded||(s.y=a.height-(s.y+s.height))}else s.y=s.y+s.height;if(void 0!==s&&null!==s){if(this._page&&"function"==typeof this._page._getTemplateReservedSpace){var c=this._page._getTemplateReservedSpace();c&&Array.isArray(c)&&4===c.length&&(s.x+=c[3],s.y-=c[0])}var _=n.save();if(this._page._needInitializeGraphics=!0,this._type===t._PdfAnnotationType.rubberStampAnnotation){b=!0;if(this._dictionary&&this._dictionary.has("AP")){var d=this._dictionary.get("AP");if(d&&d.has("N")){var u=d.get("N");270===this.rotate&&this._page.rotation===t.PdfRotationAngle.angle270&&u&&u.dictionary&&u.dictionary.has("Matrix")&&(g=u.dictionary.getArray("Matrix"))&&6===g.length&&0===g[4]&&0!==g[5]&&(b=!1)}!i&&this.rotate!==t.PdfRotationAngle.angle180&&b&&(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&&n.setTransparency(this._opacity);var l=this._calculateTemplateBounds(s,this._page,e,i,n);if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var f,a=void 0;this.rotate===t.PdfRotationAngle.angle0?(a={width:l.width,height:l.height},f=[l.x,l.y]):(a=e._size,f=[l.x,l.y]);var p=!1;if(this.rotate!==t.PdfRotationAngle.angle0&&e._content&&e._content.dictionary.has("Matrix")){var g=e._content.dictionary.getArray("Matrix");g&&6===g.length&&0===g[4]&&0!==g[5]&&(p=!0)}var y=e._size.width>0?l.width/e._size.width:1,m=e._size.height>0?l.height/e._size.height:1,b=!(Math.trunc(1e3*y)/1e3==1&&Math.trunc(1e3*m)/1e3==1);this.rotate!==t.PdfRotationAngle.angle0&&p&&(this.rotate===t.PdfRotationAngle.angle90?this._page&&this._page.rotation===t.PdfRotationAngle.angle270?!b||0===l.x&&0===l.y?(f[0]+=a.height,f[1]+=a.width-a.height+(a.width-a.height)):(f[0]+=a.width-a.height,f[1]+=a.width):b||(f[0]+=a.height):this.rotate===t.PdfRotationAngle.angle270?this._page&&this._page.rotation===t.PdfRotationAngle.angle270?b&&e._isAnnotationTemplate?f[1]=l.y-l.width:b&&(f[1]+=a.width-a.height):b||0===l.x&&0===l.y?f[1]+=-(a.width-a.height):f[1]+=-a.width:this.rotate===t.PdfRotationAngle.angle180&&(f[0]+=a.width,f[1]+=-a.height))}if(!e._content.dictionary.has("Matrix")&&e._content.dictionary.has("BBox")){var v=e._content.dictionary.getArray("BBox");l.x-=v[0],l.y+=v[1]}this instanceof hn&&!this._isLoaded&&(l=L(this._dictionary,this._page)),n.drawTemplate(e,l),n.restore(_)}this._page.annotations.remove(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=O(d))}if(void 0!==i){var u=this._obtainGraphicsRotation(s._matrix);if(90===u)s.translateTransform({x:r._size.height,y: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.height-(e.height+e.y)+(e.height-r._size.height)):-(i.size.height-e.y-e.height)):(o=e.x,h=-(i.size.height-(e.height+e.y)+(e.width-r._size.height)),c=e.height,_=e.width);else if(180===u)s.translateTransform({x:r._size.width,y:r._size.height}),s.rotateTransform(180),n?(o=-(i.size.width-(e.x+e.width)),h=-(i.size.height-e.y-e.height)):(o=-(i.size.width-(e.x+r._size.width)),h=-(i.size.height-e.y-r._size.height),void 0===this.rotationAngle||this._rotate!==t.PdfRotationAngle.angle90&&this._rotate!==t.PdfRotationAngle.angle270||(h=-(i.size.height-e.y-r._size.height)-(e.width-e.height),c=e.height,_=e.width));else if(270===u)if(s.translateTransform({x:0,y:r._size.width}),s.rotateTransform(270),n||void 0!==this.rotationAngle&&this._rotate===t.PdfRotationAngle.angle180)o=-(i.size.width-e.x-e.width),h=e.y;else{o=-(i.size.width-a.x-r._size.width);var l=r._content.dictionary.getArray("Matrix"),f=r._content.dictionary.getArray("BBox");h=l&&f&&l[5]!==f[2]?e.y-(e.height-e.width):e.y+e.height-e.width,c=e.height,_=e.width}else 0===u&&(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._removeAnnotation=function(t,e){t&&e&&(t.annotations.remove(e),t._pageDictionary._updated=!0)},e.prototype._drawCloudStyle=function(t,e,i,r,n,s,a){_e(s)&&this._isClockWise(s)&&s.reverse();var o,h=[],c=2*r*n;_e(s)?o=s[s.length-1]:s=[];for(y=0;y<s.length;y++){var _=s[y],d=_.x-o.x,u=_.y-o.y,l=Math.sqrt(d*d+u*u);d/=l,u/=l;for(var f=0;f+.1*c<l;f+=c){var p=new Ln;p.point={x:o.x+f*d,y:o.y+f*u},h.push(p)}o=_}for(var g=h[h.length-1],y=0;y<h.length;y++){var m=h[y],b=this._getIntersectionDegrees([g.point.x,g.point.y],[m.point.x,m.point.y],r);g.endAngle=b[0],m.startAngle=b[1],g=m}for(var v=new Ir,y=0;y<h.length;y++){var w=(C=h[y]).startAngle%360,S=C.endAngle%360,x=0;if(w>0&&S<0)x=180-w+(180-(S<0?-S:S));else if(w<0&&S>0)x=-w+S;else if(w>0&&S>0){x=w>S?360-(w-S):S-w}else if(w<0&&S<0){x=w>S?360-(w-S):-(w+-S)}x<0&&(x=-x),C.endAngle=x,v.addArc({x:C.point.x-r,y:C.point.y-r,width:2*r,height:2*r},w,x)}v.closeFigure();var P=[];a&&(P=v._points.map(function(t){return{x:t.x,y:-t.y}}));var A;a?((A=new Ir)._points=P,A._pathTypes=v._pathTypes):((A=new Ir)._points=v._points,A._pathTypes=v._pathTypes),_e(e)&&t.drawPath(A,e);var T=180/(3*Math.PI);v=new Ir;for(y=0;y<h.length;y++){var C=h[y];v.addArc({x:C.point.x-r,y:C.point.y-r,width:2*r,height:2*r},C.startAngle,C.endAngle+T)}v.closeFigure(),P=[],a&&(P=v._points.map(function(t){return{x:t.x,y:-t.y}})),a?((A=new Ir)._points=P,A._pathTypes=v._pathTypes):((A=new Ir)._points=v._points,A._pathTypes=v._pathTypes),t.drawPath(A,i)},e.prototype._isClockWise=function(t){var e=0;if(_e(t))for(var i=0;i<t.length;i++){var r=t[i],n=t[(i+1)%t.length];e+=(n.x-r.x)*(n.y+r.y)}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){var a=s.slice();s.some(function(t){return t>0})&&this.border.style===t.PdfBorderStyle.dashed&&(e._dashStyle=t.PdfDashStyle.dash,e._dashPattern=a)}if(n)if(n instanceof Bn)!this._isBounds&&this._dictionary.has("RD")?(h=this._dictionary.getArray("RD"))&&(i[0]=i[0]+h[0],i[1]=i[1]+r+h[1],i[2]=i[2]-(h[0]+h[2]),i[3]=i[3]-(h[1]+h[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={x:i[0],y:i[1],width:i[2],height:i[3]};else if(0!==n.intensity&&n.style===t.PdfBorderEffectStyle.cloudy){var o=5*n.intensity;i[0]=i[0]+o+r,i[1]=i[1]+o+r,i[2]=i[2]-2*o-2*r,i[3]=i[3]-2*o-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&&this._dictionary.has("RD")){var h=this._dictionary.getArray("RD");h&&(i[0]=i[0]+h[0],i[1]=i[1]+r+h[1],i[2]=i[2]-2*h[2],i[3]=i[3]-this.border.width,i[3]=i[3]-2*h[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&&null!==e&&void 0!==e&&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,o=i/2,h=[0,0,this.bounds.width,this.bounds.height];if(this._customTemplate.has("N"))a=this._customTemplate.get("N");else{lt(a=new Mi(h,this._crossReference),this._getRotationAngle()),0!==e.intensity&&e.style===t.PdfBorderEffectStyle.cloudy&&(a._writeTransformation=!1);var c=a.graphics,_=new Bn;this.innerColor&&(_.backBrush=new Qn(this._innerColor)),i>0&&this.color&&(_.borderPen=new Zn(this._color,i)),this.color&&(_.foreBrush=new Qn(this._color));var d=this._obtainStyle(_.borderPen,h,o,e);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({x:d[0],y:d[1],width:d[2],height:d[3]},_.borderPen,_.backBrush),void 0!==this.opacity&&this._opacity<1&&c.restore()}return a},e.prototype._drawRectangleAppearance=function(t,e,i,r){var n=new Ir;_e(t)&&4===t.length&&n.addRectangle({x:t[0],y:t[1],width:t[2],height:t[3]});var s=0;if(_e(r)&&(s=4.25*r),s>0){var a=n._points.map(function(t){return{x:t.x,y:-t.y}});(n=new Ir).addPolygon(a),this._drawCloudStyle(e,i.backBrush,i.borderPen,s,.833,n._points,!1)}else e.drawRectangle({x:t[0],y:t[1],width:t[2],height:t[3]},i.borderPen,i.backBrush)},e.prototype._createCircleAppearance=function(){var e,i=[0,0,this.bounds.width,this.bounds.height];if(this._customTemplate.has("N"))e=this._customTemplate.get("N");else{lt(e=new Mi(i,this._crossReference),this._getRotationAngle(),this),this._dictionary.has("BE")&&(e._writeTransformation=!1),void 0===this.color&&(this._isTransparentColor=!0);var r=e.graphics,n=this.border.width,s=new Zn(this.color,n);this.border.style===t.PdfBorderStyle.dashed?(s._dashStyle=t.PdfDashStyle.dash,s._dashPattern=[3,1]):this.border.style===t.PdfBorderStyle.dot&&(s._dashStyle=t.PdfDashStyle.dot,s._dashPattern=[1,1]);var a=new Bn;this.innerColor&&(a.backBrush=new Qn(this._innerColor)),n>0&&(a.borderPen=s),this.color&&(a.foreBrush=new Qn(this._color)),a.borderWidth=n;var o=n/2,h=this._obtainStyle(s,i,o);void 0!==this.opacity&&this._opacity<1&&(r.save(),r.setTransparency(this._opacity)),this._dictionary.has("BE")?this._drawCircleAppearance(h,o,r,a):r.drawEllipse({x:h[0]+o,y:h[1],width:h[2]-n,height:h[3]},a.borderPen,a.backBrush),void 0!==this._opacity&&this._opacity<1&&r.restore()}return 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 u=[];u.push([c,h+a[3]/2]),u.push([o+a[2]/2,_]),u.push([o,h+a[3]/2]),u.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 f=[],p=0;p<d.length;p++)this._createBezier(u[p],d[p],l[p],f);this._drawCloudStyle(i,r.backBrush,r.borderPen,n,.833,f.map(function(t){return{x:t[0],y:t[1]}}),!1)}else i.drawEllipse({x:t[0]+e,y:-t[1],width:t[2]-this.border.width,height:-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].x,i=t[0].y,r=t[1].x,n=t[1].y,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 null!==i&&void 0!==i||(i=0),{x:t.x+Math.cos(e*this._degreeToRadian)*i,y:t.y+Math.sin(e*this._degreeToRadian)*i}},e.prototype._prepareOpenArrow=function(t,e,i,r){var n=t?30:150,s=9*r,a=this._getAxisValue(e,i,t?r:-r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareReverseOpenArrow=function(t,e,i,r){var n=t?150:30,s=9*r,a=this._getAxisValue(e,i,t?-r:r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareClosedArrow=function(t,e,i,r){var n=t?30:150,s=9*r,a=this._getAxisValue(e,i,t?r:-r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareReverseCloseArrow=function(t,e,i,r){var n=t?150:30,s=9*r,a=this._getAxisValue(e,i,t?-r:r);return{startPoint:a,first:this._getAxisValue(a,i+n,s),second:this._getAxisValue(a,i-n,s)}},e.prototype._prepareSlash=function(t,e,i){var r=9*i;return{first:this._getAxisValue(t,e+60,r),second:this._getAxisValue(t,e-120,r)}},e.prototype._prepareDiamond=function(t,e){var i=3*e;return{first:this._getAxisValue(t,180,i),second:this._getAxisValue(t,90,i),third:this._getAxisValue(t,0,i),fourth:this._getAxisValue(t,-90,i)}},e.prototype._prepareButt=function(t,e,i){var r=3*i;return{first:this._getAxisValue(t,e+90,r),second:this._getAxisValue(t,e-90,r)}},e.prototype._getBoundsFromLineEndStyle=function(e,i,r,n,s,a){var o,h,c,_;switch(n){case t.PdfLineEndingStyle.square:case t.PdfLineEndingStyle.circle:o={x:e.x-3*s,y:e.y+3*s,width:6*s,height:6*s};break;case t.PdfLineEndingStyle.openArrow:_=this._prepareOpenArrow(a,e,i,s),(h=new Ir)._pen=r,h.addLine({x:_.startPoint.x,y:_.startPoint.y},{x:_.first.x,y:_.first.y}),h.addLine({x:_.startPoint.x,y:_.startPoint.y},{x:_.second.x,y:_.second.y}),o={x:(c=h._getBounds())[0],y:c[1],width:c[2],height:c[3]};break;case t.PdfLineEndingStyle.closedArrow:_=this._prepareClosedArrow(a,e,i,s),o=this._getBoundsValue([_.startPoint.x,_.startPoint.y,_.first.x,_.first.y,_.second.x,_.second.y]);break;case t.PdfLineEndingStyle.rOpenArrow:_=this._prepareReverseOpenArrow(a,e,i,s),(h=new Ir)._pen=r,h.addLine({x:_.startPoint.x,y:_.startPoint.y},{x:_.first.x,y:_.first.y}),h.addLine({x:_.startPoint.x,y:_.startPoint.y},{x:_.second.x,y:_.second.y}),o={x:(c=h._getBounds())[0],y:c[1],width:c[2],height:c[3]};break;case t.PdfLineEndingStyle.rClosedArrow:_=this._prepareReverseCloseArrow(a,e,i,s),o=this._getBoundsValue([_.startPoint.x,_.startPoint.y,_.first.x,_.first.y,_.second.x,_.second.y]);break;case t.PdfLineEndingStyle.slash:_=this._prepareSlash(e,i,s),o=this._getBoundsValue([e.x,e.y,_.first.x,_.first.y,_.second.x,_.second.y]);break;case t.PdfLineEndingStyle.diamond:_=this._prepareDiamond(e,s),o=this._getBoundsValue([_.first.x,_.first.y,_.second.x,_.second.y,_.third.x,_.third.y,_.fourth.x,_.fourth.y]);break;case t.PdfLineEndingStyle.butt:_=this._prepareButt(e,i,s),o=this._getBoundsValue([_.first.x,_.first.y,_.second.x,_.second.y])}return o},e.prototype._drawLineEndStyle=function(e,i,r,n,s,a,o,h){var c,_;switch(a){case t.PdfLineEndingStyle.square:i.drawRectangle({x:e.x-3*o,y:-(e.y+3*o),width:6*o,height:6*o},n,s);break;case t.PdfLineEndingStyle.circle:i.drawEllipse({x:e.x-3*o,y:-(e.y+3*o),width:6*o,height:6*o},n,s);break;case t.PdfLineEndingStyle.openArrow:_=this._prepareOpenArrow(h,e,r,o),(c=new Ir)._pen=n,c.addLine({x:_.startPoint.x,y:-_.startPoint.y},{x:_.first.x,y:-_.first.y}),c.addLine({x:_.startPoint.x,y:-_.startPoint.y},{x:_.second.x,y:-_.second.y}),i._stateControl(n,null,null),i._buildUpPath(c._points,c._pathTypes),i._drawGraphicsPath(n,null,c._fillMode,!1);break;case t.PdfLineEndingStyle.closedArrow:_=this._prepareClosedArrow(h,e,r,o),i.drawPolygon([{x:_.startPoint.x,y:-_.startPoint.y},{x:_.first.x,y:-_.first.y},{x:_.second.x,y:-_.second.y}],n,s);break;case t.PdfLineEndingStyle.rOpenArrow:_=this._prepareReverseOpenArrow(h,e,r,o),(c=new Ir)._pen=n,c.addLine({x:_.startPoint.x,y:-_.startPoint.y},{x:_.first.x,y:-_.first.y}),c.addLine({x:_.startPoint.x,y:-_.startPoint.y},{x:_.second.x,y:-_.second.y}),i._stateControl(n,null,null),i._buildUpPath(c._points,c._pathTypes),i._drawGraphicsPath(n,null,c._fillMode,!1);break;case t.PdfLineEndingStyle.rClosedArrow:_=this._prepareReverseCloseArrow(h,e,r,o),i.drawPolygon([{x:_.startPoint.x,y:-_.startPoint.y},{x:_.first.x,y:-_.first.y},{x:_.second.x,y:-_.second.y}],n,s);break;case t.PdfLineEndingStyle.slash:_=this._prepareSlash(e,r,o),i.drawLine(n,{x:e.x,y:-e.y},{x:_.first.x,y:-_.first.y}),i.drawLine(n,{x:e.x,y:-e.y},{x:_.second.x,y:-_.second.y});break;case t.PdfLineEndingStyle.diamond:_=this._prepareDiamond(e,o),i.drawPolygon([{x:_.first.x,y:-_.first.y},{x:_.second.x,y:-_.second.y},{x:_.third.x,y:-_.third.y},{x:_.fourth.x,y:-_.fourth.y}],n,s);break;case t.PdfLineEndingStyle.butt:_=this._prepareButt(e,r,o),i.drawLine(n,{x:_.first.x,y:-_.first.y},{x:_.second.x,y:-_.second.y})}},e.prototype._getCombinedRectangleBounds=function(t,e){var i=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:i,y:r,width:Math.max(t.x+t.width,e.x+e.width)-i,height:Math.max(t.y+t.height,e.y+e.height)-r}},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,s=!1;if(this._dictionary.has("DS"))this._dictionary.get("DS").split(";").forEach(function(t){var r=t.split(":");if(-1!==t.indexOf("font-family"))i=r[1];else if(-1!==t.indexOf("font-size"))r[1].endsWith("pt")&&(e=Number.parseFloat(r[1].replace("pt","")));else if(-1!==t.indexOf("font-style")||-1!==t.indexOf("style"))n=r[1];else if(-1!==t.indexOf("font")){for(r[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(i+=t+" "),t.endsWith("pt")&&(e=Number.parseFloat(t.replace("pt","")))});" "!==i&&i.endsWith(" ");)i=i.substring(0,i.length-1);-1!==i.indexOf(",")&&(i=i.split(",")[0])}});else{var a=this._dictionary.get("DA");if(a&&""!==a&&-1!==a.indexOf("Tf")){var o=a.split(" ");o.forEach(function(t,r){if(-1!==t.indexOf("Tf")){for(i=o[r-2];""!==i&&i.length>1&&"/"===i[0];)i=i.substring(1);e=Number.parseFloat(o[r-1])}})}else if(this._dictionary.has("AP")){c=this._dictionary.get("AP");switch((_=this._parseFontFromAppearance(c,this instanceof Sn?["R","N","D"]:["N","R","D"])).name){case"Helvetica":case"Courier":case"Symbol":case"TimesRoman":case"ZapfDingbats":case"MonotypeSungLight":case"SinoTypeSongLight":case"MonotypeHeiMedium":case"HanyangSystemsGothicMedium":case"HanyangSystemsShinMyeongJoMedium":case"HeiseiKakuGothicW5":case"HeiseiMinchoW3":i=_.name;break;case"Times-Roman":i="TimesRoman";break;default:i="Helvetica"}e=_.fontSize,r=void 0===_.style||null===_.style?t.PdfFontStyle.regular:_.style,s=!0}}if(!s&&n&&""!==n){var h=[n];n.includes(":")?h=n.split(":"):n.includes(",")&&(h=n.split(",")),h&&h.forEach(function(e){switch((e=e.trim()).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())}else if(this._dictionary.has("AP")){var c=this._dictionary.get("AP"),_=this._parseFontFromAppearance(c,this instanceof Sn?["R","N","D"]:["N","R","D"]);i=_.name,e=_.fontSize,r=_.style}return this instanceof wn&&this._font&&this._font.style!==r&&(r=this._font.style),{name:i,size:e,style:r}},e.prototype._parseFontFromAppearance=function(t,e){var i;if(t)for(var r=0,n=e;r<n.length;r++){var s=n[r];if(t.has(s)){var a=t.get(s);a&&(i=this._obtainAppearanceFont(a,void 0,void 0,void 0));break}}return i},e.prototype._obtainAppearanceFont=function(e,i,r,n){if(e&&e instanceof Rs&&e.dictionary&&e.dictionary.has("Resources"))for(var s=e.dictionary.get("Resources"),a=0,o=new Xr(e.getBytes())._readContent();a<o.length;a++){var h=o[a],c=h._operands;if("Tf"===h._operator){var _=c[0];if(s.has("Font")){var d=s.get("Font");if(d&&_.includes("/")){_=_.replace(/\//g,"");var u=d.get(_);if(u&&u.has("BaseFont")&&(i=u.get("BaseFont").name)){var l=i.includes("Bold"),f=i.includes("Italic")||i.includes("Oblique");(i.includes("Times")||i.includes("Helvetica")||i.includes("Courier"))&&(l&&f?n=t.PdfFontStyle.bold|t.PdfFontStyle.italic:l?n=t.PdfFontStyle.bold:f&&(n=t.PdfFontStyle.italic)),c[1]&&(r=Number.parseFloat(c[1]))}}}}}return{name:i,fontSize:r,style:n}},e.prototype._obtainFont=function(){var t=this._obtainFontDetails();return Kt(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 Ts;e.set("C",1),e.set("D",100),e.set("F",vs.get("D")),e.set("RD","."),e.set("RT",""),e.set("SS",""),e.set("U",t);var i=new Ts;i.set("C",1),i.set("D",100),i.set("F",vs.get("D")),i.set("RD","."),i.set("RT",""),i.set("SS",""),i.set("U","sq "+t);var r=new Ts;"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",vs.get("D")),r.set("RD","."),r.set("RT",""),r.set("SS",""),r.set("U",t);var n=new Ts;return n.set("A",[i]),n.set("D",[e]),n.set("R","1 "+t+" = 1 "+t),n.set("Type",vs.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 Kn;i._rotate(e);var r=[];r.push({x:t.x,y:t.y}),r.push({x:t.x+t.width,y:t.y}),r.push({x:t.x+t.width,y:t.y+t.height}),r.push({x:t.x,y:t.y+t.height}),r=r.map(function(t){return i._matrix._transform(t)});var n=new Ir;n.addRectangle({x:t.x,y:t.y,width:t.width,height:t.height}),n._points=r.slice(0,4);for(var s=r[0].x,a=r[3].x,o=r[0].y,h=r[3].y,c=0;c<4;c++)r[c].x<s&&(s=r[c].x),r[c].x>a&&(a=r[c].x),r[c].y<o&&(o=r[c].y),r[c].y>h&&(h=r[c].y);return{x:t.x,y:t.y,width:Math.round(a-s),height:Math.round(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={width:0,height:0};e&&e.size&&(h=e.size);var c=r,_=[h.width-180,c.y+142<h.height?c.y:h.height-142,180,142];if(this._dictionary.has("Popup")&&this._dictionary.get("Popup")){var d=this._dictionary.getArray("Rect");if(d&&4===d.length){var u=d[0],l=d[1];_=[u,l,d[2]-u,d[3]-l]}}void 0===i&&(i={r:0,g:0,b:0});var f=new Qn(i),p=n.width/2,g=new Zn({r:0,g:0,b:0},1),y=0,m=new Qn(this._getForeColor(i));if(void 0!==s&&null!==s&&""!==s)y=this._drawAuthor(s,a,_,f,m,e,y,n);else if(void 0!==a&&null!==a&&""!==a){v=[_[0]+p,_[1]+p,_[2]-n.width,40];this._saveGraphics(e,t.PdfBlendMode.hardLight),this._isTransparentColor?e.graphics.drawRectangle({x:v[0],y:v[1],width:v[2],height:v[3]},g):e.graphics.drawRectangle({x:v[0],y:v[1],width:v[2],height:v[3]},g,f),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,{x:b[0],y:b[1],width:b[2],height:b[3]},e),e.graphics.restore(),y=40}else{this._saveGraphics(e,t.PdfBlendMode.hardLight);var v=[_[0]+p,_[1]+p,_[2]-n.width,20];this._isTransparentColor?e.graphics.drawRectangle({x:v[0],y:v[1],width:v[2],height:v[3]},g):e.graphics.drawRectangle({x:v[0],y:v[1],width:v[2],height:v[3]},g,f),y=20,e.graphics.restore()}var w=[_[0]+p,_[1]+p+y,_[2]-n.width,_[3]-(y+n.width)];this._saveGraphics(e,t.PdfBlendMode.hardLight),e.graphics.drawRectangle({x:w[0],y:w[1],width:w[2],height:w[3]},new Zn({r:0,g:0,b:0},1),new Qn({r:255,g:255,b:255})),w[0]+=11,w[1]+=5,w[2]-=22,e.graphics.restore(),this._saveGraphics(e,t.PdfBlendMode.normal),void 0!==o&&null!==o&&""!==o&&e.graphics.drawString(o,this._popUpFont,{x:w[0],y:w[1],width:w[2],height:w[3]},null,new Qn({r:0,g:0,b: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 Zn({r:0,g:0,b:0},1);if(this._dictionary.has("Popup")){var s=this._getRectangleBoundsValue();void 0===this.color&&(this.color={r:0,g:0,b:0});var a=new Qn(this.color),o=this.border.width/2,h=0,c=new Qn(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({x:d[0],y:d[1],width:d[2],height: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,{x:_[0],y:_[1],width:_[2],height:_[3]},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({x:d[0],y:d[1],width:d[2],height:d[3]},n,a),h=20,this._page.graphics.restore()}this._saveGraphics(this._page,t.PdfBlendMode.hardLight);var u=[s[0]+o,s[1]+o+h,s[2]-this.border.width,s[3]-(h+this.border.width)];this._page.graphics.drawRectangle({x:u[0],y:u[1],width:u[2],height:u[3]},n,new Qn({r:255,g:255,b:255})),u[0]+=11,u[1]+=5,u[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,{x:u[0],y:u[1],width:u[2],height:u[3]},null,new Qn({r:0,g:0,b:0}),null),this._page.graphics.restore(),this._page.annotations.remove(this)}else this._flattenPop(this._page,this.color,this.bounds,this.border,i,r,e),this._page.annotations.remove(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.height-(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.r+t.g+t.b)/3>128?{r:0,g:0,b:0}:{r:255,g:255,b:255}},e.prototype._drawAuthor=function(e,i,r,n,s,a,o,h){var c=this.border.width/2,_=new Zn({r:0,g:0,b:0},1),d=new Ei(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle),u=[r[0]+c,r[1]+c,r[2]-h.width,20];if(void 0!==i&&null!==i&&""!==i){u[3]+=20,o=u[3],this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle({x:u[0],y:u[1],width:u[2],height:u[3]},_):a.graphics.drawRectangle({x:u[0],y:u[1],width:u[2],height:u[3]},_,n),a.graphics.restore();l={x:u[0]+11,y:u[1],width:u[2],height:u[3]/2};this._saveGraphics(this._page,t.PdfBlendMode.normal),a.graphics.drawString(e,this._authorBoldFont,l,null,s,d),l={x:l.x,y:l.y+l.height-2,width:l.width,height:u[3]/2},this._drawSubject(i,l,a),a.graphics.restore()}else{this._saveGraphics(a,t.PdfBlendMode.hardLight),this._isTransparentColor?a.graphics.drawRectangle({x:u[0],y:u[1],width:u[2],height:u[3]},_):a.graphics.drawRectangle({x:u[0],y:u[1],width:u[2],height:u[3]},_,n),a.graphics.restore();var l={x:u[0]+11,y:u[1],width:u[2],height:u[3]};this._saveGraphics(a,t.PdfBlendMode.normal),a.graphics.drawString(e,this._popUpFont,l,null,s,d),o=u[3],a.graphics.restore()}return o},e.prototype._drawSubject=function(e,i,r){var n=new Ei(t.PdfTextAlignment.left,t.PdfVerticalAlignment.middle);r.graphics.drawString(e,this._authorBoldFont,i,null,new Qn({r:0,g:0,b:0}),n)},e.prototype._saveGraphics=function(t,e){t.graphics.save(),t.graphics.setTransparency(.8,.8,e)},e.prototype._getBorderColorString=function(t){return(t.r/255).toFixed(3)+" "+(t.g/255).toFixed(3)+" "+(t.b/255).toFixed(3)+" rg "},e.prototype._dateToString=function(t){var e=t.getFullYear(),i=Ue(t.getMonth()+1),r=Ue(t.getDate()),n=Ue(t.getHours()),s=Ue(t.getMinutes()),a=Ue(t.getSeconds()),o=-t.getTimezoneOffset(),h=o>=0?"+":"-",c=Math.abs(o);return"D:"+e+i+r+n+s+a+h+Ue(Math.floor(c/60))+"'"+Ue(c%60)+"'"},e.prototype._stringToDate=function(t){if(!t||"string"!=typeof t)return new Date(t);if(-1!==t.indexOf("/")){var e=t.split("/"),i=parseInt(e[2].split(" ")[0],10),r=parseInt(e[0],10)-1,n=parseInt(e[1],10),s=(e[2].split(" ")[1]||"00:00:00").split(":"),a=parseInt(s[0]||"0",10),o=parseInt(s[1]||"0",10),h=parseInt(s[2]||"0",10);return new Date(i,r,n,a,o,h)}t.startsWith("D:")&&(t=t.substring(2));var c=t.replace(/'/g,"").trim(),_=parseInt(c.slice(0,4),10),d=c.length>=6,u=c.length>=8,l=c.length>=10,f=c.length>=12,p=c.length>=14,g=d?parseInt(c.slice(4,6),10):1,y=u?parseInt(c.slice(6,8),10):1,m=l?parseInt(c.slice(8,10),10):0,b=f?parseInt(c.slice(10,12),10):0,v=p?parseInt(c.slice(12,14),10):0,w=c.slice(14);/^[+-]\d{2}:\d{2}$/.test(w)&&(w=w.replace(":",""));var S=!1,x=0,P=0,A=0;if(w&&(/^[Zz]$/.test(w)?(S=!0,x=1,P=0,A=0):/^[+-]\d{2}\d{2}$/.test(w)?(S=!0,x="+"===w[0]?1:-1,P=parseInt(w.slice(1,3),10),A=parseInt(w.slice(3,5),10)):/^[+-]\d{2}$/.test(w)&&(S=!0,x="+"===w[0]?1:-1,P=parseInt(w.slice(1,3),10),A=0)),S){var T=Date.UTC(_,g-1,y,m,b,v),C=x*(60*P+A);return new Date(T-60*C*1e3)}return new Date(_,g-1,y,m,b,v)},e.prototype._obtainNativeRectangle=function(){var t=[this._bounds.x,this._bounds.y,this.bounds.x+this._bounds.width,this.bounds.y+this._bounds.height],e=this._getCropOrMediaBox();if(this._page){var i=this._page.size;t[1]=i.height-t[3],e&&e.length>2&&(0!==e[0]||0!==e[1])&&(t[0]+=e[0],t[1]+=e[1])}return t},e.prototype._getPoints=function(t){var e=this._getCropOrMediaBox(),i=t?t.map(function(t){return{x:t.x,y:t.y}}):[];if(e&&e.length>3&&"number"==typeof e[0]&&"number"==typeof e[1]&&(0!==e[0]||0!==e[1]))for(var r=0;r<i.length;r++){var n=i[r].x,s=i[r].y;i[r].x=n+e[0],this._page._pageDictionary.has("MediaBox")&&!this._page._pageDictionary.has("CropBox")&&0===e[3]&&e[1]>0?i[r].y=s+e[3]:i[r].y=s+e[1]}return i},e.prototype._getCropOrMediaBox=function(){var t;if(this._page&&this._page._pageDictionary.has("CropBox")&&(t=this._page.cropBox),!t&&this._page&&this._page._pageDictionary.has("MediaBox")&&(t=this._page.mediaBox),t&&t[3]<0){var e=t[1],i=t[3];t[3]=e,t[1]=i}return t||[0,0,0,0]},e.prototype._getDocumentLayer=function(){if(this._dictionary.has("OC")){var t=this._dictionary.getRaw("OC"),e=this._page;if(t&&e&&this._crossReference._document){var i=this._crossReference._document.layers;i&&this._isMatched(i,t,e)}}return this.layer},e.prototype._isMatched=function(t,e,i){for(var r=0;r<t.count;r++){var n=t.at(r)._referenceHolder;if(n&&n===e){if(t.at(r).name){this._layer=t.at(r);break}}else t.at(r).layers&&t.at(r).layers.count>0&&this._isMatched(t.at(r).layers,e,i)}},e.prototype._setQuadPoints=function(t){var e,i=[],r=t.height;if(this._page&&this._page._isNew&&this._page._pageSettings&&this._page._pageSettings.margins){var n=this._page._pageSettings.margins;e={left:n.left,top:n.top,right:n.right,bottom:n.bottom}}else e={left:0,top:0,right:0,bottom:0};0!==this.bounds.x&&0!==this.bounds.y&&0!==this.bounds.width&&0!==this.bounds.height&&(this._boundsCollection[0]=this.bounds);var s=this._quadPoints.length/8,a=this._getMediaOrCropBox(this._page),o=!1;if(!this._isLoaded&&a&&a.length>3&&!this.flatten){var h=a[0],c=a[1];if(0!==h||0!==c){for(l=0;l<s;l++){var _=(u=this._boundsCollection[l]).x+e.left+h,d=c+e.top;i[0+8*l]=_+e.left,i[1+8*l]=r+d-e.top-u.y,i[2+8*l]=_+u.width+e.left,i[3+8*l]=r+d-e.top-u.y,i[4+8*l]=_+e.left,i[5+8*l]=i[1+8*l]-u.height,i[6+8*l]=_+u.width+e.left,i[7+8*l]=i[5+8*l]}o=!0}}if(!o&&this._boundsCollection.length>0)for(l=0;l<s;l++){var u=this._boundsCollection[l],_=u.x,d=u.y;i[0+8*l]=_+e.left,i[1+8*l]=r-d-e.top,i[2+8*l]=_+u.width+e.left,i[3+8*l]=r-d-e.top,i[4+8*l]=_+e.left,i[5+8*l]=i[1+8*l]-u.height,i[6+8*l]=_+u.width+e.left,i[7+8*l]=i[5+8*l]}this._points=[];for(var l=0;l<i.length;l+=2)this._points.push({x:i[l],y:i[l+1]});this._dictionary.set("QuadPoints",i)},e.prototype._createTemplate=function(t){var e;if(this._isLoaded&&(t||(t="N"),this._dictionary.has("AP"))){var i=this._dictionary.get("AP");if(i&&i.has(t)){var r=i.get(t),n=i.getRaw(t);if(n&&r){(e=new Mi)._isExported=!0;var s=r.dictionary,a=s.getArray("Matrix"),o=s.getArray("BBox");if(a){for(var h=[],c=0;c<a.length;c++){var _=a[c];h[c]=_}if(o&&o.length>3){var d=O(o),u=this._transformBBox(d,h);e._size={width:u[2],height:u[3]},e._templateOriginalSize={width:d.width,height:d.height}}r&&"number"==typeof r.offset&&0!==r.offset&&(r.offset=0)}else if(o&&o[2]===this.bounds.width&&o[3]===this.bounds.height||p(this._dictionary.get("Rect"),o))s.update("Matrix",[1,0,0,1,-o[0],-o[1]]),this._dictionary.has("Vertices")?e._size={width:o[2],height:o[3]}:(e._size={width:this.bounds.width,height:this.bounds.height},this._crossReference._cacheMap.set(n,r));else{var l=[1,0,0,1,0,0],f=this._getTransformMatrix(this._dictionary.get("Rect"),o,l);this.bounds.width===f[0]&&this.bounds.height===f[3]?(s.update("Matrix",[f[0],0,0,f[3],0,0]),e._size={width:f[0],height:f[3]},this._crossReference._cacheMap.set(n,r)):(s.update("Matrix",[1,0,0,1,-o[0],-o[1]]),e._size={width:o[2],height:o[3]})}e._exportStream(i,this._crossReference,t)}}}return e},e.prototype._getTransformMatrix=function(t,e,i){var r=this._getAxialAlignedBoundingBox(e,i),n=r[0],s=r[1],a=r[2],o=r[3];if(n===a||s===o)return[1,0,0,1,t[0],t[1]];var h=(t[2]-t[0])/(a-n),c=(t[3]-t[1])/(o-s);return[h,0,0,c,t[0]-n*h,t[1]-s*c]},e.prototype._getAxialAlignedBoundingBox=function(t,e){var i=this._applyTransform(t,e),r=this._applyTransform(t.slice(2,4),e),n=this._applyTransform([t[0],t[3]],e),s=this._applyTransform([t[2],t[1]],e);return[Math.min(i[0],r[0],n[0],s[0]),Math.min(i[1],r[1],n[1],s[1]),Math.max(i[0],r[0],n[0],s[0]),Math.max(i[1],r[1],n[1],s[1])]},e.prototype._applyTransform=function(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]},e.prototype._transformBBox=function(t,e){var i=[],r=[],n=this._transformPoint(t.x,t.y+t.height,e);i[0]=n[0],r[0]=n[1];var s=this._transformPoint(t.x+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.x+t.width,t.y+t.height,e);return i[3]=o[0],r[3]=o[1],[this._minValue(i),this._minValue(r),this._maxValue(i),this._maxValue(r)]},e.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},e.prototype._minValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[i]<e&&(e=t[i]);return e},e.prototype._maxValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[i]>e&&(e=t[i]);return e},e.prototype._drawTemplate=function(t,e){t&&e&&((t._isExported||t._isResourceExport)&&(this._crossReference?(t._crossReference=this._crossReference,t._importStream(!0,t._isResourceExport)):t._importStream(!1,t._isResourceExport)),this._customTemplate.set(e,t))},e.prototype._drawCustomAppearance=function(t){var e=this;this._customTemplate.forEach(function(i,r){Nt(t,e._crossReference,r);var n=e._crossReference._getNextReference();i._content.reference=n,i._content.dictionary._update=!0,e._crossReference._cacheMap.set(n,i._content),t.update(r,n)})},e}(),$r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Qr(e,t),Object.defineProperty(e.prototype,"comments",{get:function(){return this._comments?this._comments:this._comments=new Mn(this,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reviewHistory",{get:function(){return this._reviewHistory?this._reviewHistory:this._reviewHistory=new Mn(this,!0)},enumerable:!0,configurable:!0}),e}(Zr),tn=function(e){function i(i,r,n){var s=e.call(this)||this;return s._unit=t.PdfMeasurementUnit.centimeter,s._unitString="",s._dictionary=new Ts,s._dictionary.update("Type",vs.get("Annot")),s._dictionary.update("Subtype",vs.get("Line")),null!==i&&void 0!==i&&null!==r&&void 0!==r&&(s.linePoints=[i,r]),s._type=t._PdfAnnotationType.lineAnnotation,n&&("text"in n&&_e(n.text)&&(s.text=n.text),"author"in n&&_e(n.author)&&(s.author=n.author),"subject"in n&&_e(n.subject)&&(s.subject=n.subject),"color"in n&&_e(n.color)&&(s.color=n.color),"innerColor"in n&&_e(n.innerColor)&&(s.innerColor=n.innerColor),"lineEndingStyle"in n&&_e(n.lineEndingStyle)&&(s.lineEndingStyle=n.lineEndingStyle),"opacity"in n&&_e(n.opacity)&&(s.opacity=n.opacity),"border"in n&&_e(n.border)&&(s.border=n.border),"measurementUnit"in n&&_e(n.measurementUnit)&&(s.measure=!0,s.unit=n.measurementUnit)),s}return Qr(i,e),Object.defineProperty(i.prototype,"linePoints",{get:function(){if(void 0===this._linePoints&&this._dictionary.has("L")){var t=this._dictionary.getArray("L");4===t.length&&(this._linePoints=[{x:t[0],y:t[1]},{x:t[2],y:t[3]}])}return this._linePoints},set:function(t){if(Array.isArray(t)&&(void 0===this._linePoints||b(t,this._linePoints))){if(2!==t.length)throw new Error("Line points length should be 2.");this._dictionary.update("L",[t[0].x,t[0].y,t[1].x,t[1].y]),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 Rn;if(t._dictionary=this._dictionary,this._dictionary.has("LE")){var e=this._dictionary.getArray("LE");e&&Array.isArray(e)&&(t._begin=J(e[0].name),t._end=J(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",vs.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(this._isTextUpdated)return this._unit;if(void 0===this._unit||this._isLoaded)if(this._dictionary.has("Contents")){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=mt(this._unitString)}else this._unit=t.PdfMeasurementUnit.centimeter;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.linePoints||null===this.linePoints)throw new Error("Line points cannot be null or undefined");var i=this._getCropOrMediaBox();i&&i.length>3&&this.linePoints.length>1&&"number"==typeof i[0]&&"number"==typeof i[1]&&(0!==i[0]||0!==i[1])&&(this._linePoints[0].x+=i[0],this._linePoints[0].y+=i[1],this._linePoints[1].x+=i[0],this._linePoints[1].y+=i[1],this._dictionary.update("L",[this._linePoints[0].x,this._linePoints[0].y,this._linePoints[1].x,this._linePoints[1].y])),this._dictionary.has("Cap")||this._dictionary.set("Cap",!1),this._dictionary.has("CP")||this._dictionary.set("CP",vs.get("Inline")),this._dictionary.has("LE")||(this.lineEndingStyle=new Rn),this._dictionary.has("LL")||(this.leaderLine=0),this._dictionary.has("LLE")||(this.leaderExt=0),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0);var r;if(this._dictionary.has("BS"))r=this.border.width;else{var n=new Ts(this._crossReference);n.set("Type",vs.get("Border")),this._dictionary.set("BS",n)}if(void 0===r&&(r=1),null!==this.border.dash&&void 0!==this.border.dash||(this.border.dash=[],this.border.style===t.PdfBorderStyle.dashed?this.border.dash=[3,1]:this.border.style===t.PdfBorderStyle.dot&&(this.border.dash=[1,1])),this._measure)this._appearanceTemplate=this._createLineMeasureAppearance(e);else{var s=!1;if(this._setAppearance||this._customTemplate.has("N")){if(this._appearanceTemplate=this._createAppearance(),this._page._isNew&&!this._flatten&&!e){h={x:(o=this._obtainLineBounds())[0],y:o[1],width:o[2],height:o[3]};this._bounds=h;c=[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height];this._dictionary.update("Rect",c),s=!0}}else{var a=M({x:(h=this._obtainLineBounds())[0],y:h[1],width:h[2],height:h[3]});this._page._isNew&&this._page._pageSettings&&this._setAppearance&&!this.flatten&&(a=te(this,h)),this.bounds={x:a[0],y:a[1],width:a[2],height:a[3]},this._dictionary.update("Rect",a),s=!0}if(this._dictionary.has("Measure")&&!s){var o=this._obtainLineBounds(),h={x:o[0],y:o[1],width:o[2],height:o[3]};this._bounds=h;var c=void 0;c=this._page&&this._page._isNew&&this._page._pageSettings&&!this._setAppearance&&!this.flatten?te(this):[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height],this._dictionary.update("Rect",c),this.flatten&&!this.measure&&this._page&&this._page.size&&Array.isArray(this._page.size)&&this._page.size.length>=2&&(this._bounds={x:o[0],y:this._page.size[1]-(o[1]+o[3]),width:o[2],height:o[3]})}}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded)(this._setAppearance||this._customTemplate.size>0||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"))instanceof Rs&&((s=e.getRaw("N"))&&(i.reference=s),this._appearanceTemplate=new Mi(i,this._crossReference));else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(null!==e&&void 0!==e&&e.has("N")){var i=e.get("N");i&&((s=e.getRaw("N"))&&(i.reference=s),this._appearanceTemplate=new Mi(i,this._crossReference))}}else this._appearanceTemplate=this._createAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t)if(this._appearanceTemplate){var r=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,r,!0)}else this._page.annotations.remove(this);else{var n=void 0;if(this._setAppearance||this._customTemplate.size>0)if(this._dictionary.has("AP"))n=this._dictionary.get("AP");else{s=this._crossReference._getNextReference();(n=new Ts(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(s,n),this._dictionary.update("AP",s)}if(this._customTemplate.size>0)this._drawCustomAppearance(n);else if(n&&this._appearanceTemplate&&this._appearanceTemplate._content){Nt(n,this._crossReference,"N");var s=this._crossReference._getNextReference();this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=s,this._crossReference._cacheMap.set(s,this._appearanceTemplate._content),n.update("N",s)}}},i.prototype._createLineMeasureAppearance=function(e){var i=[0,0,0,0],r=this._convertToUnit(),n=this._obtainLinePoints().slice(),s=new Ir;s._points=n,s._pathTypes=[0,1];var a=s._getBounds();this._bounds={x:a[0],y:a[1],width:a[2],height:a[3]};var o,h=new Zn(void 0!==this.color?this._color:{r:0,g:0,b:0},this.border.width);this.innerColor&&(o=new Qn(this._innerColor)),i=this._obtainLineBounds();var c;if(this._customTemplate.has("N")){c=this._customTemplate.get("N");G=[i[0],i[1],i[0]+i[2],i[1]+i[3]];this._dictionary.update("Rect",G),this._bounds={x:G[0],y:G[1],width:G[2],height:G[3]}}else{lt(c=new Mi(i,this._crossReference),0);var _=new Bn;c._writeTransformation=!1;var d=c.graphics;_.borderPen=h,this.border.style===t.PdfBorderStyle.dashed?(_.borderPen._dashStyle=t.PdfDashStyle.dash,_.borderPen._dashPattern=[3,1]):this.border.style===t.PdfBorderStyle.dot&&(_.borderPen._dashStyle=t.PdfDashStyle.dot,_.borderPen._dashPattern=[1,1]),_.backBrush=o,_.foreBrush=new Qn(this.color);var u=this._obtainLinePoints(),l=this._obtainFont();if((void 0===l||null===l||!this._isLoaded&&1===l.size)&&(l=this._lineCaptionFont,this._pdfFont=l),void 0!==u&&2===u.length){var f=new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),p=l.measureString(r.toFixed(2)+" "+this._unitString,{width:0,height:0},f,0,0),g=this._getAngle(this._linePoints),y=0,m=0;this.leaderLine<0?(y=-this.leaderLine,m=g+180):(y=this.leaderLine,m=g);var b=void 0!==this.leaderOffset?y+this.leaderOffset:y,v=this._getAxisValue(this._linePoints[0],m+90,b),w=this._getAxisValue(this._linePoints[1],m+90,b),S=Math.sqrt(Math.pow(w.x-v.x,2)+Math.pow(w.y-v.y,2)),x=S/2-(p.width/2+this.border.width),P=this._getAxisValue(v,g,x),A=this._getAxisValue(w,g+180,x),T=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(v,g,this.border.width):v,C=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(w,g,-this.border.width):w,k=void 0;this.opacity&&this._opacity<1&&(k=d.save(),d.setTransparency(this._opacity)),this.caption.type===t.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===t.PdfLineCaptionType.inline?d.drawLine(h,{x:T.x,y:-T.y},{x:C.x,y:-C.y}):(d.drawLine(h,{x:T.x,y:-T.y},{x:P.x,y:-P.y}),d.drawLine(h,{x:C.x,y:-C.y},{x:A.x,y:-A.y})),this.opacity&&this._opacity<1&&d.restore(k),this._drawLineStyle(v,w,d,g,h,o,this.lineEndingStyle,this.border.width);var R=void 0!==this.leaderExt?this._leaderExt:0,F=this._getAxisValue(v,m+90,R);d.drawLine(h,{x:v.x,y:-v.y},{x:F.x,y:-F.y});var I=this._getAxisValue(w,m+90,R);d.drawLine(h,{x:w.x,y:-w.y},{x:I.x,y:-I.y});var D=this._getAxisValue(v,m-90,y);d.drawLine(h,{x:v.x,y:-v.y},{x:D.x,y:-D.y});var B=this._getAxisValue(w,m-90,y);d.drawLine(h,{x:w.x,y:-w.y},{x:B.x,y:-B.y});var L=S/2,O=this._getAxisValue(v,g,L),M=void 0,E=l._getHeight();M=this.caption.type===t.PdfLineCaptionType.top?this._getAxisValue(O,g+90,E):this._getAxisValue(O,g+90,E/2),d.translateTransform({x:M.x,y:-M.y}),d.rotateTransform(-g),d.drawString(r.toFixed(2)+" "+this._unitString,l,{x:-p.width/2,y:0,width:0,height:0},null,_.foreBrush),d.restore()}if(void 0!==e&&!e||!this._isLoaded){c._content.dictionary._updated=!0;var N=this._crossReference._getNextReference();this._crossReference._cacheMap.set(N,c._content),c._content.reference=N;var j=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height],V=this._page.size;j[1]=V.height-(this.bounds.y+this.bounds.height),this._isBounds&&!this.measure?(i=j,this._dictionary.update("Rect",[j[0],j[1],j[2],j[3]])):this._dictionary.update("Rect",[i[0],i[1],i[2],i[3]]);var z="font:"+l._metrics._postScriptName+" "+l._size+"pt; color:"+this._colorToHex([this.color.r,this.color.g,this.color.b]);if(this._dictionary.update("DS",z),void 0!==e&&!e){this._dictionary.has("AP")&&Nt(this._dictionary.get("AP"),this._crossReference,"N");var U=new Ts;U.set("N",N),U._updated=!0,this._dictionary.set("AP",U);var H=this._createMeasureDictionary(this._unitString),W=this._crossReference._getNextReference();this._crossReference._cacheMap.set(W,H),H._updated=!0,this._dictionary.has("Measure")&&Nt(this._dictionary,this._crossReference,"Measure"),this._dictionary.update("Measure",W)}var q=[];if(q.push(vs.get(X(this.lineEndingStyle.begin))),q.push(vs.get(X(this.lineEndingStyle.end))),this._dictionary.update("LE",q),null===this._linePoints)throw new Error("LinePoints cannot be null");this._dictionary.update("L",[this._linePoints[0].x,this._linePoints[0].y,this._linePoints[1].x,this._linePoints[1].y]),this._dictionary.update("C",[Number.parseFloat((this.color.r/255).toFixed(3)),Number.parseFloat((this.color.g/255).toFixed(3)),Number.parseFloat((this.color.b/255).toFixed(3))]);b=this._dictionary.has("LLO")?this.leaderOffset:0;this._dictionary.update("Subtype",new vs("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 vs("LineDimension")),this._dictionary.update("LLE",this.leaderExt),this._dictionary.update("LLO",b),void 0!==this.leaderLine&&null!==this.leaderLine&&this._dictionary.update("LL",this.leaderLine),this._dictionary.update("CP",vs.get(this.caption.type===t.PdfLineCaptionType.top?"Top":"Inline")),this._dictionary.update("Cap",this.caption.cap);var G=[i[0],i[1],i[0]+i[2],i[1]+i[3]];this._dictionary.update("Rect",G),this._bounds={x:G[0],y:G[1],width:G[2],height:G[3]}}}return c},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&&2===t.length){var o=this._getAngle(t),h=0,c=0;i<0?(h=-i,c=o+180):(h=i,c=o);var _={x:t[0].x,y:t[0].y},d={x:t[1].x,y:t[1].y};if(0!==r){var u=this._getAxisValue(_,c+90,r),l=this._getAxisValue(d,c+90,r);t[0].x=u.x,t[0].y=u.y,t[1].x=l.x,t[1].y=l.y,this._dictionary.update("L",[t[0].x,t[0].y,t[1].x,t[1].y])}var f=this._getAxisValue(_,c+90,h+r),p=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=[],w=[];c>=45&&c<=135||c>=225&&c<=315?(v[0]=m.y,w[0]=m.x,v[1]=b.y,w[1]=b.x):(v[0]=m.x,w[0]=m.y,v[1]=b.x,w[1]=b.y);var S=Math.max(v[0],v[1]),x=Math.max(w[0],w[1]);0===S&&(S=1),0===x&&(x=1),f.x===Math.min(f.x,p.x)?(f.x-=S*s,p.x+=S*s,f.x=Math.min(f.x,t[0].x),f.x=Math.min(f.x,g.x),p.x=Math.max(p.x,t[1].x),p.x=Math.max(p.x,y.x)):(f.x+=S*s,p.x-=S*s,f.x=Math.max(f.x,t[0].x),f.x=Math.max(f.x,g.x),p.x=Math.min(p.x,t[1].x),p.x=Math.min(p.x,y.x)),f.y===Math.min(f.y,p.y)?(f.y-=x*s,p.y+=x*s,f.y=Math.min(f.y,t[0].y),f.y=Math.min(f.y,g.y),p.y=Math.max(p.y,t[1].y),p.y=Math.max(p.y,y.y)):(f.y+=x*s,p.y-=x*s,f.y=Math.max(f.y,t[0].y),f.y=Math.max(f.y,g.y),p.y=Math.min(p.y,t[1].y),p.y=Math.min(p.y,y.y)),a=this._getBounds([f,p])}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[a];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&&2===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,i=this._obtainLineBounds();if(this._customTemplate.has("N"))e=this._customTemplate.get("N");else{lt(e=new Mi(i,this._crossReference),0);var r=new Bn;e._writeTransformation=!1;var n=e.graphics,s=new Zn(void 0!==this.color?this._color:{r:0,g:0,b:0},this.border.width);this.border.style===t.PdfBorderStyle.dashed?(s._dashStyle=t.PdfDashStyle.dash,s._dashPattern=[3,1]):this.border.style===t.PdfBorderStyle.dot&&(s._dashStyle=t.PdfDashStyle.dot,s._dashPattern=[1,1]),this.border.style!==t.PdfBorderStyle.solid&&this.border.dash&&(s._dashPattern=this.border.dash),r.borderPen=s,r.foreBrush=new Qn(this.color);var a=void 0;this.innerColor&&(a=new Qn(this._innerColor));var o=this._obtainFont();(void 0===o||null===o||!this._isLoaded&&1===o.size)&&(o=this._lineCaptionFont,this._pdfFont=o),this.text||this._dictionary.has("Contents")||(this.text=this.subject);var h=new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),c=0;if(this.caption.cap&&(c=o.measureString(this.text?this.text:"",{width:0,height:0},h,0,0).width),void 0!==this.linePoints&&2===this._linePoints.length){var _=this._getAngle(this._linePoints),d=0,u=0,l=this.leaderLine;null!==l&&void 0!==l||(this._leaderLine=0,l=0),l<0?(d=-l,u=_+180):(d=l,u=_);var f=void 0!==this.leaderOffset?d+this.leaderOffset:d,p=this._getAxisValue(this._linePoints[0],u+90,f),g=this._getAxisValue(this._linePoints[1],u+90,f),y=Math.sqrt(Math.pow(g.x-p.x,2)+Math.pow(g.y-p.y,2)),m=y/2-(c/2+this.border.width),b=this._getAxisValue(p,_,m),v=this._getAxisValue(g,_+180,m),w=this.lineEndingStyle.begin===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(p,_,this.border.width):p,S=this.lineEndingStyle.end===t.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===t.PdfLineEndingStyle.closedArrow?this._getAxisValue(g,_,-this.border.width):g;if(this.opacity&&this._opacity<1){var x=n.save();n.setTransparency(this._opacity),this._drawLine(n,s,w,S,b,v),n.restore(x)}else this._drawLine(n,s,w,S,b,v);this._drawLineStyle(p,g,n,_,s,a,this.lineEndingStyle,this.border.width);var P=void 0!==this.leaderExt?this._leaderExt:0,A=this._getAxisValue(p,u+90,P);n.drawLine(s,{x:p.x,y:-p.y},{x:A.x,y:-A.y});var T=this._getAxisValue(g,u+90,P);n.drawLine(s,{x:g.x,y:-g.y},{x:T.x,y:-T.y});var C=this._getAxisValue(p,u-90,d);n.drawLine(s,{x:p.x,y:-p.y},{x:C.x,y:-C.y});var k=this._getAxisValue(g,u-90,d);n.drawLine(s,{x:g.x,y:-g.y},{x:k.x,y:-k.y});var R=y/2,F=this._getAxisValue(p,_,R),I=void 0,D=o._getHeight();I=this.caption.type===t.PdfLineCaptionType.top?this._measure?this._getAxisValue(F,_+90,2*D):this._getAxisValue(F,_+90,D):this._measure?this._getAxisValue(F,_+90,D/2*3):this._getAxisValue(F,_+90,D/2),n.translateTransform({x:I.x,y:-I.y}),n.rotateTransform(-_),this.caption.cap&&n.drawString(this.text,o,{x:-c/2,y:0,width:0,height:0},null,r.foreBrush),n.restore()}}var B=M({x:i[0],y:i[1],width:i[2],height:i[3]});return 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]]),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,{x:r.x,y:-r.y},{x:n.x,y:-n.y}):(e.drawLine(i,{x:r.x,y:-r.y},{x:s.x,y:-s.y}),e.drawLine(i,{x:n.x,y:-n.y},{x:a.x,y:-a.y}))},i.prototype._convertToUnit=function(){for(var e=W(this._obtainLinePoints()),i=new Array(e.length/2),r=0,n=0;n<e.length;n+=2)i[r]=[e[n],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 $n)._convertUnits(s,t._PdfGraphicsUnit.point,a.graphicsUnit)},i.prototype._obtainLinePoints=function(){return this.linePoints?this._linePoints.slice():[]},i}($r),en=function(e){function i(i,r){var n=e.call(this)||this;if(n._unit=t.PdfMeasurementUnit.centimeter,n._measureType=t.PdfCircleMeasurementType.diameter,n._unitString="",n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("Circle")),null!==i&&void 0!==i&&void 0!==i.x&&void 0!==i.y&&void 0!==i.width&&void 0!==i.height&&(n.bounds=i),n._type=t._PdfAnnotationType.circleAnnotation,r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"color"in r&&_e(r.color)&&(n.color=r.color),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border),"measure"in r&&_e(r.measure))){var s=r.measure;"unit"in s&&_e(s.unit)&&(n.measure=!0,n.unit=s.unit),"type"in s&&_e(s.type)&&(n.measure=!0,n.measureType=s.type)}return n}return Qr(i,e),Object.defineProperty(i.prototype,"measure",{get:function(){return this._measure||(this._measure=this._dictionary.has("Measure")),this._measure},set:function(t){t&&(this._isLoaded||(this._measure=t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"unit",{get:function(){if(this._isTextUpdated)return this._unit;if(void 0===this._unit||this._isLoaded)if(this._dictionary.has("Contents")){var e=this._dictionary.get("Contents");this._unitString=e.substring(e.length-2),this._unit=mt(this._unitString)}else this._unit=t.PdfMeasurementUnit.centimeter;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=mt(this._unitString);var i=e.substring(0,e.length-2);(new $n)._convertUnits(this.bounds.width/2,t._PdfGraphicsUnit.point,wt(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 Ts(this._crossReference);i.set("Type",vs.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===e&&(e=1),this._measure?this._appearanceTemplate=this._createCircleMeasureAppearance(t):(this._dictionary.update("Rect",te(this)),(this._setAppearance||t&&!this._dictionary.has("AP")||this._customTemplate.size>0)&&(this._appearanceTemplate=this._createCircleAppearance()))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||this._customTemplate.size>0||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 Mi(e,this._crossReference))}}else if(this._postProcess(t),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");if(null!==r&&void 0!==r&&r.has("N")){var e=r.get("N"),i=r.getRaw("N");e&&(i&&(e.reference=i),this._appearanceTemplate=new Mi(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._page.annotations.remove(this);else if(this._setAppearance||this._customTemplate.size>0){var s=void 0,a=this._crossReference;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{i=a._getNextReference();(s=new Ts(a))._updated=!0,a._cacheMap.set(i,s),this._dictionary.update("AP",i)}if(this._customTemplate.size>0)this._drawCustomAppearance(s);else{Nt(s,a,"N");i=this._crossReference._getNextReference();this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=i,a._cacheMap.set(i,this._appearanceTemplate._content),s.update("N",i)}}},i.prototype._createCircleMeasureAppearance=function(e){var i=this.border.width,r=this._dictionary,n=this._obtainFont();(void 0===n||null===n||!this._isLoaded&&1===n.size)&&(n=this._circleCaptionFont,this._pdfFont=n);var s=this._convertToUnit(),a=new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),o=s.toFixed(2)+" "+this._unitString,h=n.measureString(o,{width:0,height:0},a,0,0),c=this.color?this.color:{r:0,g:0,b:0},_=new Zn(c,i),d=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height];d[1]=d[1]-d[3];var u;if(this._customTemplate.has("N"))u=this._customTemplate.get("N"),r.update("Rect",te(this));else{u=new Mi(d,this._crossReference);var l=new Bn;u._writeTransformation=!1;var f=u.graphics,p=i/2;l.borderPen=_,this.innerColor&&(l.backBrush=new Qn(this._innerColor)),l.foreBrush=new Qn(c);var g=[d[0],-d[1]-d[3],d[2],d[3]];if(f.save(),f.drawEllipse({x:g[0]+p,y:g[1]+p,width:g[2]-i,height:g[3]-i},new Zn(c,this.border.width)),this._measureType===t.PdfCircleMeasurementType.diameter){f.save(),f.translateTransform({x:d[0],y:-d[1]});y=d[3]/2-h.width/2;f.drawLine(l.borderPen,{x:0,y:-d[3]/2},{x:d[0]+d[2],y:-d[3]/2}),f.translateTransform({x:y,y:-d[3]/2-n._getHeight()}),f.drawString(s.toFixed(2)+" "+this._unitString,n,{x:0,y:0,width:0,height:0},null,l.foreBrush),f.restore()}else{f.save(),f.translateTransform({x:d[0],y:-d[1]});var y=d[2]/2+(d[2]/4-h.width/2);f.drawLine(l.borderPen,{x:d[2]/2,y:-d[3]/2},{x:d[0]+d[2],y:-d[3]/2}),f.translateTransform({x:y,y:-d[3]/2-n._getHeight()}),f.drawString(s.toFixed(2)+" "+this._unitString,n,{x:0,y:0,width:0,height:0},null,l.foreBrush),f.restore()}if(f.restore(),void 0!==e&&!e||!this._isLoaded){r.has("AP")&&Nt(r.get("AP"),this._crossReference,"N");var m=new Ts;f._template._content.dictionary._updated=!0;var b=this._crossReference._getNextReference();this._crossReference._cacheMap.set(b,f._template._content),f._template._content.reference=b,m.set("N",b),m._updated=!0,r.set("AP",m),r.update("Rect",te(this)),r.has("Measure")&&Nt(r,this._crossReference,"Measure");var v=this._createMeasureDictionary(this._unitString),w=this._crossReference._getNextReference();this._crossReference._cacheMap.set(w,v),v._updated=!0,r.update("Measure",w),r.update("Subtype",new vs("Circle")),this._text&&""!==this._text?r.update("Contents",this._text+" "+s.toFixed(2)+" "+this._unitString):r.update("Contents",s.toFixed(2)+" "+this._unitString);var S="font:"+n._metrics._postScriptName+" "+n._size+"pt; color:"+this._colorToHex([this.color.r,this.color.g,this.color.b]);r.update("DS",S)}}return u},i.prototype._convertToUnit=function(){var e=new $n,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}($r),rn=function(e){function i(i,r){var n=e.call(this)||this;return n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("Circle")),null!==i&&void 0!==i&&void 0!==i.x&&void 0!==i.y&&void 0!==i.width&&void 0!==i.height&&(n.bounds=i),n._type=t._PdfAnnotationType.ellipseAnnotation,r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"color"in r&&_e(r.color)&&(n.color=r.color),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border)),n}return Qr(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 Ts(this._crossReference);i.set("Type",vs.get("Border")),this._dictionary.set("BS",i)}this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===e&&(e=1),(this._setAppearance||t&&!this._dictionary.has("AP")||this._customTemplate.size>0)&&(this._appearanceTemplate=this._createCircleAppearance()),this._dictionary.update("Rect",te(this))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||this._customTemplate.size>0||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 Mi(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 Mi(e,this._crossReference))}}else this._appearanceTemplate=this._createCircleAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._page.annotations.remove(this);else if(this._setAppearance||this._customTemplate.size>0){var s=void 0,a=this._crossReference;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{i=a._getNextReference();(s=new Ts(a))._updated=!0,a._cacheMap.set(i,s),this._dictionary.update("AP",i)}if(this._customTemplate.size>0)this._drawCustomAppearance(s);else{Nt(s,a,"N");i=a._getNextReference();this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=i,a._cacheMap.set(i,this._appearanceTemplate._content),s.update("N",i)}}},i}($r),nn=function(e){function i(i,r){var n=e.call(this)||this;return n._unit=t.PdfMeasurementUnit.centimeter,n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("Square")),null!==i&&void 0!==i&&void 0!==i.x&&void 0!==i.y&&void 0!==i.width&&void 0!==i.height&&(n.bounds=i),n._type=t._PdfAnnotationType.squareAnnotation,r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"color"in r&&_e(r.color)&&(n.color=r.color),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border),"measurementUnit"in r&&_e(r.measurementUnit)&&(n.measure=!0,n.unit=r.measurementUnit)),n}return Qr(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var e=new Dn;if(e._dictionary=this._dictionary,this._dictionary.has("BE")){var i=this._dictionary.get("BE");e._intensity=i.get("I"),e._style=K(i.get("S").name)}else e._style=t.PdfBorderEffectStyle.solid;this._borderEffect=e}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(this._isTextUpdated)return this._unit;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=mt(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 Ts(this._crossReference)).set("Type",vs.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color={r:0,g:0,b: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._customTemplate.size>0)&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),this._dictionary.update("Rect",te(this)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new Ts(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",vs.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isLoaded){if((this._setAppearance||this._customTemplate.size>0||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 Mi(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 Mi(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)if(this._appearanceTemplate){var n=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,n)}else this._page.annotations.remove(this);else if(this._setAppearance||this._customTemplate.size>0){var s=void 0,a=this._crossReference;if(this._dictionary.has("AP"))s=this._dictionary.get("AP");else{i=a._getNextReference();(s=new Ts(this._crossReference))._updated=!0,a._cacheMap.set(i,s),this._dictionary.update("AP",i)}if(this._customTemplate.size>0)this._drawCustomAppearance(s);else{Nt(s,a,"N");i=a._getNextReference();this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=i,a._cacheMap.set(i,this._appearanceTemplate._content),s.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 Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),o=s.toFixed(2)+" sq "+this._unitString,h=r.measureString(o,{width:0,height:0},a,0,0),c=new Zn(this.color,i);this.innerColor&&(n=new Qn(this._innerColor));var _,d=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height];if(this._customTemplate.has("N")){_=this._customTemplate.get("N");var u=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],l=this._page.size,f=this.bounds;u[1]=l.height-(f.y+f.height),u[2]=f.x+f.width,u[3]=l.height-f.y,this._isBounds&&(d=u),this._page._isNew&&this._page._pageSettings&&(u=te(this)),this._dictionary.update("Rect",[u[0],u[1],u[2],u[3]])}else{var p=new Fr({x:this.bounds.x,y:this.bounds.y,width:this.bounds.width,height:this.bounds.height},this);d[1]=d[1]-d[3],p.normal=new Mi(d,this._crossReference),_=p.normal;var g=new Bn;_._writeTransformation=!1;var y=p.normal.graphics,m=i/2;g.borderPen=c,g.backBrush=n,g.foreBrush=new Qn(this.color);var b=[d[0],-d[1]-d[3],d[2],d[3]];y.drawRectangle({x:b[0]+m,y:b[1]+m,width:b[2]-i,height:b[3]-i},new Zn(this.color,this.border.width)),y.save(),y.translateTransform({x:d[0],y:-d[1]});var v=d[2]/2-h.width/2,w=d[3]/2-h.height/2;if(y.translateTransform({x:v,y:-w-r._getHeight()}),y.drawString(s.toFixed(2)+" sq "+this._unitString,r,{x:0,y:0,width:0,height:0},null,g.foreBrush),y.restore(),void 0!==e&&!e||!this._isLoaded){this._dictionary.has("AP")&&Nt(this._dictionary.get("AP"),this._crossReference,"N");var S=new Ts,x=y._template._content;x.dictionary._updated=!0;var P=this._crossReference._getNextReference();this._crossReference._cacheMap.set(P,x),y._template._content.reference=P,S.set("N",P),S._updated=!0,this._dictionary.set("AP",S);var u=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],l=this._page.size;u[1]=l.height-(this.bounds.y+this.bounds.height),u[2]=this.bounds.x+this.bounds.width,u[3]=l.height-this.bounds.y,this._isBounds&&(d=u),this._page._isNew&&this._page._pageSettings&&(u=te(this)),this._dictionary.update("Rect",[u[0],u[1],u[2],u[3]]),this._dictionary.has("Measure")&&Nt(this._dictionary,this._crossReference,"Measure");var A=this._crossReference._getNextReference(),T=this._createMeasureDictionary(this._unitString);this._crossReference._cacheMap.set(A,T),T._updated=!0,this._dictionary.update("Measure",A);var C="font:"+r._metrics._postScriptName+" "+r._size+"pt; color:"+this._colorToHex([this.color.r,this.color.g,this.color.b]);this._dictionary.update("DS",C),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 vs("Square")),this._dictionary.update("IT",new vs("SquareDimension"));var k=this._dictionary.getArray("Rect"),R=new Array(2*k.length);R[0]=k[0],R[1]=k[3],R[2]=k[0],R[3]=k[1],R[4]=k[2],R[5]=k[1],R[6]=k[2],R[7]=k[3],this._dictionary.update("Vertices",R)}}return _},i.prototype._calculateAreaOfSquare=function(){var e,i,r=new $n;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}($r),sn=function(e){function i(i,r){var n=e.call(this)||this;return n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("Square")),null!==i&&void 0!==i&&void 0!==i.x&&void 0!==i.y&&void 0!==i.width&&void 0!==i.height&&(n.bounds=i),n._type=t._PdfAnnotationType.rectangleAnnotation,r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"color"in r&&_e(r.color)&&(n.color=r.color),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border)),n}return Qr(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var e=new Dn;if(e._dictionary=this._dictionary,this._dictionary.has("BE")){var i=this._dictionary.get("BE");e._intensity=i.get("I"),e._style=K(i.get("S").name)}else e._style=t.PdfBorderEffectStyle.solid;this._borderEffect=e}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 Ts(this._crossReference)).set("Type",vs.get("Border")),this._dictionary.set("BS",r)),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===i&&(i=1),this._dictionary.update("Rect",te(this)),(this._setAppearance||this._customTemplate.size>0||e&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var r=new Ts(this._crossReference);r.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&r.set("S",vs.get("C")),this._dictionary.update("BE",r)}},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded){if((this._setAppearance||this._customTemplate.size>0||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 Mi(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 Mi(i,this._crossReference))}}else this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect);if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),e)if(this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);(s&&this._page&&this._page.rotation!==t.PdfRotationAngle.angle0||this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate))&&this._flattenAnnotationTemplate(this._appearanceTemplate,s)}else this._page.annotations.remove(this);else if(this._setAppearance||this._customTemplate.size>0){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{r=this._crossReference._getNextReference();a=new Ts(this._crossReference),this._crossReference._cacheMap.set(r,a),this._dictionary.update("AP",r)}if(this._customTemplate.size>0)this._drawCustomAppearance(a);else{Nt(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._page.annotations.remove(this),r=!1}}return r},i}($r),an=function(e){function i(i,r){var n=e.call(this)||this;return n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("Polygon")),void 0!==i&&(n._points=i),n._type=t._PdfAnnotationType.polygonAnnotation,r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"color"in r&&_e(r.color)&&(n.color=r.color),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border)),n}return Qr(i,e),Object.defineProperty(i.prototype,"borderEffect",{get:function(){if(void 0===this._borderEffect){var e=new Dn;if(e._dictionary=this._dictionary,this._dictionary.has("BE")){var i=this._dictionary.get("BE");e._intensity=i.get("I"),e._style=K(i.get("S").name)}else e._style=t.PdfBorderEffectStyle.solid;this._borderEffect=e}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={r:0,g:0,b:0},this._isTransparentColor=!0);var i;this._dictionary.has("BS")?i=this.border.width:((h=new Ts(this._crossReference)).set("Type",vs.get("Border")),this._dictionary.set("BS",h)),void 0===i&&(i=1);var r=[];r.push.apply(r,this._points),this._points=this._getPoints(this._points),r[0]===r[r.length-2]&&r[1]===r[r.length-1]||this._points.push(this._points[0]);var n=W(this._points),s=this._getBoundsValue(n),a=[s.x,s.y,s.x+s.width,s.y+s.height];this._dictionary.update("Rect",a),this._dictionary.update("LLE",this._lineExtension),(this._setAppearance||e&&!this._dictionary.has("AP")||this._customTemplate.size>0)&&(this._appearanceTemplate=this._createPolygonAppearance(e));var o=W(this._points);if(this._dictionary.update("Vertices",o),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy){var h=new Ts(this._crossReference);h.set("I",this.borderEffect._intensity),this.borderEffect._style===t.PdfBorderEffectStyle.cloudy&&h.set("S",vs.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||this._customTemplate.size>0||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 Mi(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 Mi(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._page.annotations.remove(this);else if(this._setAppearance||this._customTemplate.size>0){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{i=this._crossReference._getNextReference();(a=new Ts(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(i,a),this._dictionary.update("AP",i)}if(this._customTemplate.size>0)this._drawCustomAppearance(a);else{Nt(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=i,this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}}},i.prototype._createPolygonAppearance=function(e){if(void 0!==e&&e){c=void 0;if(this._customTemplate.has("N")){c=this._customTemplate.get("N");var i=W(this._points),r=this._getBoundsValue(i);this.bounds={x:r.x,y:this._page.size.height-r.y,width:r.width,height:r.height}}else{var n=void 0;this.color&&this.border.width>0&&(n=new Zn(this.color,this.border.width));var s=void 0;this.innerColor&&(s=new Qn(this.innerColor));d=this._page.graphics;if(n||s){var a=void 0;if(void 0!==this.opacity&&this._opacity<1&&(a=d.save(),d.setTransparency(this._opacity)),0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){l=4*this.borderEffect.intensity+.5*this.border.width;(f=new Ir).addPolygon(this._getLinePoints()),this._drawCloudStyle(d,s,n,l,.833,f._points,!1)}else d.drawPolygon(this._getLinePoints(),n,s);void 0!==this.opacity&&this._opacity<1&&d.restore(a)}c=d._template}return c}var o=void 0,h={x:0,y:0,width:0,height:0};if(void 0===this._points&&this._dictionary.has("Vertices")){p=this._dictionary.get("Vertices");this._points=V(p),o=this._getBoundsValue(p)}else{p=W(this._points);o=this._getBoundsValue(p)}void 0!==this._borderEffect&&void 0!==this.borderEffect.intensity&&0!==this.borderEffect.intensity&&this._borderEffect.style===t.PdfBorderEffectStyle.cloudy?(h.x=o.x-5*this.borderEffect.intensity-this.border.width,h.y=o.y-5*this.borderEffect.intensity-this.border.width,h.width=o.width+10*this.borderEffect.intensity+2*this.border.width,h.height=o.height+10*this.borderEffect.intensity+2*this.border.width):(h.x=o.x-this.border.width,h.y=o.y-this.border.width,h.width=o.width+2*this.border.width,h.height=o.height+2*this.border.width);var c=void 0;if(this._customTemplate.has("N"))c=this._customTemplate.get("N");else{var _=new Fr({x:h.x,y:h.y,width:h.width,height:h.height},this);_.normal=new Mi([h.x,h.y,h.width,h.height],this._crossReference),lt(c=_.normal,this._getRotationAngle()),c._writeTransformation=!1;var d=_.normal.graphics,u=new Bn;if(this.innerColor&&(u.backBrush=new Qn(this._innerColor)),this.border.width>0&&this.color&&(u.borderPen=new Zn(this._color,this.border.width)),this.color&&(u.foreBrush=new Qn(this._color)),void 0!==this.opacity&&this._opacity<1?(d.save(),d.setTransparency(this._opacity)):d.save(),_e(this.borderEffect)&&_e(this.borderEffect.intensity)&&0!==this.borderEffect.intensity&&this.borderEffect.style===t.PdfBorderEffectStyle.cloudy){var l=4*this.borderEffect.intensity+.5*this.border.width,f=new Ir;f.addPolygon(this._getLinePoints()),this._drawCloudStyle(d,u.backBrush,u.borderPen,l,.833,f._points,!1)}else d.drawPolygon(this._getLinePoints(),u.borderPen,u.backBrush);if(void 0!==this.opacity&&this._opacity<1&&d.restore(),d.restore(),this._isBounds){c._content.dictionary._updated=!0,"number"==typeof this.lineExtension&&this._dictionary.update("LLE",this.lineExtension);var p=W(this._points);this._dictionary.update("Vertices",p)}}return this._dictionary.update("Rect",[h.x,h.y,h.x+h.width,h.y+h.height]),c},i.prototype._getLinePoints=function(){var e,i=this,r=this._page.size,n=r.height,s=r.width;if(this._dictionary.has("Vertices")&&!this._isBounds){var a=void 0;this._page._pageDictionary.has("Rotate")&&(a=this._page._pageDictionary.get("Rotate"));var o=this._page.rotation;this._page&&o&&(o===t.PdfRotationAngle.angle90?a=90:o===t.PdfRotationAngle.angle180?a=180:o===t.PdfRotationAngle.angle270&&(a=270));var h=this._dictionary.getArray("Vertices");if(h){c=h.slice();e=[];for(_=0;_<c.length;_+=2){d=this.flatten?n-c[_+1]:-c[_+1];e.push([c[_],d])}a&&(270===a?e.forEach(function(t){var e=t[0];t[0]=t[1],t[1]=s-e}):90===a?e.forEach(function(t){var e=t[0];0!==i._page._origin[1]?t[0]=n-(t[1]-n):t[0]=n-t[1],t[1]=e}):180===a&&e.forEach(function(t){var e=t[0];t[0]=s-e,t[1]=n-t[1]}))}}else if(this._points){var c=W(this._points);e=[];for(var _=0;_<c.length;_+=2){var d=this.flatten?n-c[_+1]:-c[_+1];e.push([c[_],d])}}return U(e)},i}($r),on=function(e){function i(i,r){var n=e.call(this)||this;return n._beginLine=t.PdfLineEndingStyle.none,n._endLine=t.PdfLineEndingStyle.none,n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("PolyLine")),n._points=void 0!==i?i:[],n._type=t._PdfAnnotationType.polyLineAnnotation,r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"color"in r&&_e(r.color)&&(n.color=r.color),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"lineEndingStyle"in r&&_e(r.lineEndingStyle)&&(n.beginLineStyle=r.lineEndingStyle.begin,n.endLineStyle=r.lineEndingStyle.end),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border)),n}return Qr(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=J(t[0].name))}return this._beginLine},set:function(t){if(t!==this._beginLine&&(this._beginLine=t,this._dictionary)){var e=[];e.push(vs.get(X(t))),e.push(vs.get(X(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=J(t[1].name))}return this._endLine},set:function(t){if(t!==this._endLine&&(this._endLine=t,this._dictionary)){var e=[];e.push(vs.get(X(this.beginLineStyle))),e.push(vs.get(X(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={r:0,g:0,b:0},this._isTransparentColor=!0);var e;if(this._dictionary.has("BS"))e=this.border.width;else{var i=new Ts(this._crossReference);i.set("Type",vs.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 Ir;a._points=r,a._pathTypes=n;for(var o=[],h=0,c=this._points;h<c.length;h++){var _=c[h];o.push(_.x,_.y)}this._dictionary.update("Vertices",o);var d=[];d.push(vs.get(X(this.beginLineStyle))),d.push(vs.get(X(this.endLineStyle))),this._dictionary.update("LE",d),this._dictionary.update("LLE",this._lineExtension);var u=W(this._points),l=this._getBoundsValue(u),f=[l.x,l.y,l.x+l.width,l.y+l.height];this._dictionary.update("Rect",f),(this._setAppearance||t&&!this._dictionary.has("AP")||this._customTemplate.size>0)&&(this._appearanceTemplate=this._createPolyLineAppearance(t))},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._flatten=t,this._isLoaded){if((this._setAppearance||this._customTemplate.size>0||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 Mi(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 Mi(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._page.annotations.remove(this);else if(this._setAppearance||this._customTemplate.size>0){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{i=this._crossReference._getNextReference();(a=new Ts(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(i,a),this._dictionary.update("AP",i)}if(this._customTemplate.size>0)this._drawCustomAppearance(a);else{Nt(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=i,this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}}},i.prototype._transformToPdfCoordinates=function(t){return{x:t.x,y:-t.y}},i.prototype._updateBorder=function(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}},i.prototype._prepareStartEndAngle=function(t){var e=this._transformToPdfCoordinates(t._points[0]),i=this._transformToPdfCoordinates(t._points[1]),r=this._transformToPdfCoordinates(t._points[t._points.length-1]),n=this._transformToPdfCoordinates(t._points[t._points.length-2]);return{startAngle:this._getAngle([e,i]),endAngle:this._getAngle([n,r]),transformedStart:e,transformedEnd:r}},i.prototype._createPolyLineAppearance=function(e){var i=this.color?this.color:{r:0,g:0,b:0};if(void 0!==e&&e){x=void 0;if(this._customTemplate.has("N")){x=this._customTemplate.get("N");var r=W(this._points),n=this._getBoundsValue(r);this.bounds={x:n.x,y:this._page.size.height-n.y,width:n.width,height:n.height}}else{var s=void 0;this.border.width>0&&(s=new Zn(i,this.border.width));var a=void 0;this.innerColor&&(a=new Qn(this._innerColor));A=this._page.graphics;if(s){var o=void 0;void 0!==this.opacity&&this._opacity<1&&(o=A.save(),A.setTransparency(this._opacity));var h=this._getLinePoints(),c=[];if(c.push(0),h&&h.length>0){for(g=1;g<h.length;g++)c.push(1);(p=new Ir)._points=h,p._pathTypes=c;var _=this._prepareStartEndAngle(p),d=y=this._getAxisValue(_.transformedStart,_.startAngle+90),u=m=this._getAxisValue(_.transformedEnd,_.endAngle+90);this.beginLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.beginLineStyle!==t.PdfLineEndingStyle.openArrow||(d=this._getAxisValue(y,_.startAngle,this.border.width),p._points[0].x=d.x,p._points[0].y=-d.y),this.endLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.endLineStyle!==t.PdfLineEndingStyle.openArrow||(u=this._getAxisValue(m,_.endAngle,-this.border.width),p._points[p._points.length-1].x=u.x),A.drawPath(p,s),this.beginLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(y,A,_.startAngle,s,a,this.beginLineStyle,this.border.width,!0),this.endLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(m,A,_.endAngle,s,a,this.endLineStyle,this.border.width,!1),void 0!==this.opacity&&this._opacity<1&&A.restore(o)}}x=A._template}return x}var l={x:0,y:0,width:0,height:0},r=void 0;(void 0===this._points||this._points&&0===this._points.length)&&this._dictionary.has("Vertices")?(r=this._dictionary.get("Vertices"),this._points=V(r)):j(this._points)&&(r=W(this._points)),l=this._updateBorder(this._getBoundsValue(r),this.border.width);var f=new Bn;this.innerColor&&(f.backBrush=new Qn(this._innerColor)),this.border.width>0&&i&&(f.borderPen=new Zn(i,this.border.width)),i&&(f.foreBrush=new Qn(i));var p=new Ir;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 g=1;g<p._points.length;g++)this._pathTypes.push(1);p._pathTypes=this._pathTypes}var _=this._prepareStartEndAngle(p),y=this._getAxisValue(_.transformedStart,_.startAngle+90),m=this._getAxisValue(_.transformedEnd,_.endAngle+90),b=y,v=m;this.beginLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.beginLineStyle!==t.PdfLineEndingStyle.openArrow||(b=this._getAxisValue(y,_.startAngle,this.border.width),p._points[0].x=b.x,p._points[0].y=-b.y),this.endLineStyle!==t.PdfLineEndingStyle.closedArrow&&this.endLineStyle!==t.PdfLineEndingStyle.openArrow||(v=this._getAxisValue(m,_.endAngle,-this.border.width),p._points[p._points.length-1].x=v.x);var w=void 0;this.beginLineStyle!==t.PdfLineEndingStyle.none&&(w=this._getBoundsFromLineEndStyle(y,_.startAngle,f.borderPen,this.beginLineStyle,this.border.width,!0),l=this._getCombinedRectangleBounds(l,w));var S=void 0;this.endLineStyle!==t.PdfLineEndingStyle.none&&(S=this._getBoundsFromLineEndStyle(m,_.endAngle,f.borderPen,this.endLineStyle,this.border.width,!1),l=this._getCombinedRectangleBounds(l,S));var x=void 0;if(this._customTemplate.has("N"))x=this._customTemplate.get("N");else{var P=new Fr({x:l.x,y:l.y,width:l.width,height:l.height},this);P.normal=new Mi([l.x,l.y,l.width,l.height],this._crossReference),lt(x=P.normal,0),x._writeTransformation=!1;var A=P.normal.graphics;if(void 0!==this.opacity&&this._opacity<1?(A.save(),A.setTransparency(this._opacity)):A.save(),A.drawPath(p,f.borderPen),this.beginLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(y,A,_.startAngle,f.borderPen,f.backBrush,this.beginLineStyle,this.border.width,!0),this.endLineStyle!==t.PdfLineEndingStyle.none&&this._drawLineEndStyle(m,A,_.endAngle,f.borderPen,f.backBrush,this.endLineStyle,this.border.width,!1),void 0!==this.opacity&&this._opacity<1&&A.restore(),A.restore(),this._isBounds){x._content.dictionary._updated=!0,this._dictionary.update("LE",[vs.get(X(this.beginLineStyle)),vs.get(X(this.endLineStyle))]),this._dictionary.update("LLE",this.lineExtension);var T=[];this._points.forEach(function(t){T.push(t.x,t.y)}),this._dictionary.update("Vertices",T)}}return this._dictionary.update("Rect",[l.x,l.y,l.x+l.width,l.y+l.height]),x},i.prototype._getLinePoints=function(){var t=this._page.size.height,e=[];if(this._dictionary.has("Vertices")&&!this._isBounds&&(!this._setAppearance||this._setAppearance&&this.flatten)){var i=this._dictionary.getArray("Vertices");if(i)for(n=0;n<i.length;n+=2)e.push({x:i[n],y:t-i[n+1]})}else if(this._points){this._points=this._getPoints(this._points);var r=[];this._points.forEach(function(t){r.push(t.x,t.y)});for(var n=0;n<r.length;n+=2){var s=this.flatten?t-r[n+1]:-r[n+1];e.push({x:r[n],y:s})}}return e},i}($r),hn=function(e){function i(i,r,n,s){var a=e.call(this)||this;if(a._linePoints=[],a._firstIntersectionPoint=[0,0],a._secondIntersectionPoint=[0,0],a._dictionary=new Ts,a._dictionary.update("Type",vs.get("Annot")),a._dictionary.update("Subtype",vs.get("PolyLine")),i&&r&&n&&(a._pointArray=[i,r,n]),Array.isArray(a._pointArray)&&a._pointArray.length>3)throw new Error("Points length should not be greater than 3");return a._linePoints=[],Array.isArray(a._pointArray)&&a._pointArray.length>0&&a._pointArray.forEach(function(t){a._linePoints.push(t.x),a._linePoints.push(t.y)}),a._type=t._PdfAnnotationType.angleMeasurementAnnotation,s&&("text"in s&&_e(s.text)&&(a.text=s.text),"author"in s&&_e(s.author)&&(a.author=s.author),"subject"in s&&_e(s.subject)&&(a.subject=s.subject),"color"in s&&_e(s.color)&&(a.color=s.color),"opacity"in s&&_e(s.opacity)&&(a.opacity=s.opacity),"border"in s&&_e(s.border)&&(a.border=s.border)),a}return Qr(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 Ts(this._crossReference);e.set("Type",vs.get("Border")),this._dictionary.set("BS",e)}this._dictionary.has("C")||(this.color={r:0,g:0,b: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._customTemplate.size>0)&&(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 Mi(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 Mi(e,this._crossReference))}}else this._appearanceTemplate=this._createAngleMeasureAppearance();if(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._page.annotations.remove(this);else if(this._setAppearance||this._customTemplate.size>0){var a=void 0;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{i=this._crossReference._getNextReference();(a=new Ts(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(i,a),this._dictionary.update("AP",i)}if(this._customTemplate.size>0)this._drawCustomAppearance(a);else{Nt(a,this._crossReference,"N");i=this._crossReference._getNextReference();this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=i,this._crossReference._cacheMap.set(i,this._appearanceTemplate._content),a.update("N",i)}}},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 Ei(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.r,this.color.g,this.color.b]);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 vs("PolyLine")),this._dictionary.update("IT",new vs("PolyLineAngle"));var a=new Ts,o=[],h=[],c=[],_=[],d=[];a.set("Type",vs.get("measureDictionary")),a.set("R","1 in = 1 in"),a.set("Subtype","RL"),a.set("TargetUnitConversion",.1388889);var u=new Ts;u.set("U","in"),u.set("Type","NumberFormat"),u.set("C",1),u.set("D",1),u.set("SS",""),o.push(u);var l=new Ts;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 f=new Ts;f.set("U","sq in"),f.set("Type","NumberFormat"),f.set("C",1),f.set("D",1),f.set("FD",!0),f.set("SS",""),c.push(f);var p=new Ts;p.set("U","cu in"),p.set("Type","NumberFormat"),p.set("C",1),p.set("D",1),p.set("FD",!0),p.set("SS",""),d.push(p);var g=new Ts;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")&&Nt(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(),w=[];w.push(0);for(var S=1;S<v.length;S++)w.push(1);(new Ir).addRectangle({x:v[1][0]-this._radius,y:-(v[1][1]+this._radius),width:2*this._radius,height:2*this._radius});var x=i.measureString(n.toString()+"°",{width:0,height:0},r,0,0),P=[(this._firstIntersectionPoint[0]+this._secondIntersectionPoint[0])/2,(this._firstIntersectionPoint[1]+this._secondIntersectionPoint[1])/2],A=[v[1][0],-v[1][1]],T=v[1][0]+this._radius*Math.cos((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),C=v[1][1]+this._radius*Math.sin((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),k=[P[0],P[1]],R=k[0]-A[0],F=k[1]-A[1],I=Math.atan2(F,R)*(180/Math.PI),D=!1,B=!1,L=!1,O=!1;I>0?I<45?B=!0:I>=45&&I<135?L=!0:D=!0:0===(I=-I)?(new Ir).addRectangle({x:b[0],y:b[1],width:b[2],height:b[3]}):I<45?B=!0:I>=45&&I<135?O=!0:D=!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 M=new Ir;M._pathTypes=w,M._points=v.map(function(t){return{x:t[0],y:t[1]}}),this._dictionary.set("Rect",[m[0],m[1],m[0]+m[2],m[1]+m[3]]);var E;if(this._customTemplate.has("N"))E=this._customTemplate.get("N");else{var N=new Fr({x:b[0],y:b[1],width:b[2],height:b[3]},this);N.normal=new Mi(m,this._crossReference),(E=N.normal)._writeTransformation=!1;var j=N.normal.graphics,V=e/2,z=new Zn(this._color,V);this.border.style===t.PdfBorderStyle.dashed&&(z._dashStyle=t.PdfDashStyle.dash);var U=new Qn(this._color);j.save(),j.drawPath(M,z),M.addArc({x:v[1][0]-this._radius,y:v[1][1]-this._radius,width:2*this._radius,height:2*this._radius},this._startAngle,this._sweepAngle),L?j.drawString(n.toString()+"°",i,{x:T-x.width/2,y:-(-C+i._getHeight()+2),width:0,height:0},null,U):B?j.drawString(n.toString()+"°",i,{x:T+2,y:-(-C+i._getHeight()/2),width:0,height:0},null,U):D?j.drawString(n.toString()+"°",i,{x:T-x.width-2,y:-(-C+i._getHeight()/2),width:0,height:0},null,U):O&&j.drawString(n.toString()+"°",i,{x:T-x.width/2,y:C+2,width:0,height:0},null,U),j.restore(),j._template._content.dictionary._updated=!0;var H=this._crossReference._getNextReference();this._crossReference._cacheMap.set(H,j._template._content),j._template._content.reference=H,this._dictionary.has("AP")&&Nt(this._dictionary.get("AP"),this._crossReference,"N");var W=new Ts;W.set("N",H),W._updated=!0,this._dictionary.set("AP",W)}return E},i.prototype._getAngleBoundsValue=function(){for(var t=this._obtainLinePoints(),e=0;e<t.length;e++)t[e][1]=-t[e][1];var i=new Ir;return i._points=t.map(function(t){return{x:t[0],y:t[1]}}),i._pathTypes=[0,1,1],i._getBounds()},i.prototype._obtainLinePoints=function(){var t,e;if(this._linePoints){t=this._linePoints.slice(),e=new Array(t.length/2);for(var i=0,r=0;r<t.length;r+=2)e[i]=[t[r],-t[r+1]],i++}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")),t=this._linePoints.slice();for(var e=[],i=0;i<t.length;i+=2)e.push([t[i],t[i+1]]);var r=e[0],n=e[1],s=e[2],a=Math.sqrt(Math.pow(n[0]-r[0],2)+Math.pow(n[1]-r[1],2)),o=Math.sqrt(Math.pow(n[0]-s[0],2)+Math.pow(n[1]-s[1],2));this._radius=Math.min(a,o)/4;var h=new Ir;h._points=e.map(function(t){return{x:t[0],y:t[1]}}),h._pathTypes=[0,1,1];var c,_,d=this._findLineCircleIntersectionPoints(n[0],n[1],this._radius,r,n,c,_);c=d.first,_=d.second,0===this._firstIntersectionPoint[0]&&0===this._firstIntersectionPoint[1]&&(this._firstIntersectionPoint=_),c=[0,0],_=[0,0],c=(d=this._findLineCircleIntersectionPoints(n[0],n[1],this._radius,s,n,c,_)).first,_=d.second,0===this._secondIntersectionPoint[0]&&0===this._secondIntersectionPoint[1]&&(this._secondIntersectionPoint=_);var u=this._firstIntersectionPoint[0]-n[0],l=this._firstIntersectionPoint[1]-n[1],f=Math.atan2(l,u)*(180/Math.PI);u=this._secondIntersectionPoint[0]-n[0],l=this._secondIntersectionPoint[1]-n[1];var p=Math.atan2(l,u)*(180/Math.PI);return f=f>0?f=360-f:-f,p=p>0?p=360-p:-p,180===f&&0===p?(this._startAngle=f,this._sweepAngle=180):0===f&&180===p?(this._startAngle=p,this._sweepAngle=180):f<180?f>p?(this._startAngle=p,this._sweepAngle=f-p):f+180<p?(this._startAngle=p,this._sweepAngle=360-p+f):(this._startAngle=f,this._sweepAngle=p-f):f<p?(this._startAngle=f,this._sweepAngle=p-f):f-180>p?(this._startAngle=f,this._sweepAngle=360-f+p):(this._startAngle=p,this._sweepAngle=f-p),Math.atan2(s[0]-n[0],s[1]-n[1])-Math.atan2(r[0]-n[0],r[1]-n[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){u=-_/(2*c);s=[r[0]+u*o,r[1]+u*h],a=[Number.NaN,Number.NaN]}else{var u=(-_+Math.sqrt(d))/(2*c);s=[r[0]+u*o,r[1]+u*h],u=(-_-Math.sqrt(d))/(2*c),a=[r[0]+u*o,r[1]+u*h]}return{first:s,second:a}},i}($r),cn=function(e){function i(i,r,n){var s=e.call(this)||this;return s._inkPointsCollection=[],s._previousCollection=[],s._isModified=!1,s._isEnableControlPoints=!0,s._dictionary=new Ts,s._dictionary.update("Type",vs.get("Annot")),s._dictionary.update("Subtype",vs.get("Ink")),void 0!==r&&(s._points=[{x:i.x,y:i.y},{x:i.width,y:i.height}],s.bounds=i),void 0!==r&&(s._linePoints=r),s._type=t._PdfAnnotationType.inkAnnotation,n&&("text"in n&&_e(n.text)&&(s.text=n.text),"author"in n&&_e(n.author)&&(s.author=n.author),"subject"in n&&_e(n.subject)&&(s.subject=n.subject),"color"in n&&_e(n.color)&&(s.color=n.color),"thickness"in n&&_e(n.thickness)&&(s.border.width=n.thickness),"opacity"in n&&_e(n.opacity)&&(s.opacity=n.opacity),"pointsCollection"in n&&_e(n.pointsCollection)&&(s.inkPointsCollection=n.pointsCollection)),s}return Qr(i,e),Object.defineProperty(i.prototype,"inkPointsCollection",{get:function(){if(0===this._inkPointsCollection.length&&this._dictionary.has("InkList")){var t=this._dictionary.get("InkList");if(Array.isArray(t)&&t.length>0){var e=this._getMediaOrCropBox(this._page),i=e&&e.length>0?e[0]:0,r=e&&e.length>1?e[1]:0;if(0!==i||0!==r){var n=t.map(function(t){for(var e=t.slice(),n=0;n<e.length;n+=2)e[n]=e[n]-i,e[n+1]=e[n+1]-r;return e});this._inkPointsCollection=z(n)}else this._inkPointsCollection=z(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",H(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;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new Ts(this._crossReference);e.set("Type",vs.get("Border")),this._dictionary.set("BS",e)}this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===t&&(t=1);var i=this._addInkPoints(),r=[i.x,i.y,i.x+i.width,i.y+i.height];if(this._dictionary.update("Rect",r),this._setAppearance||this._customTemplate.size>0){var n=void 0;if(this._dictionary.has("AP"))n=this._dictionary.get("AP");else{o=this._crossReference._getNextReference();n=new Ts(this._crossReference),this._crossReference._cacheMap.set(o,n),this._dictionary.update("AP",o)}if(this._customTemplate.size>0)this._appearanceTemplate=this._customTemplate.get("N"),this._drawCustomAppearance(n);else{Nt(this._dictionary.get("AP"),this._crossReference,"N");var s=new Fr(i,this);s.normal=new Mi(i,this._crossReference);var a=s.normal;lt(a,0,this),a._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(a),this._appearanceTemplate._content.dictionary._updated=!0;var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=o,n.set("N",o),n._updated=!0}}},i.prototype._doPostProcess=function(t){if(void 0===t&&(t=!1),this._isFlatten=t,this._isLoaded){if(this._setAppearance||this._customTemplate.size>0||t&&!this._dictionary.has("AP")){0===this._inkPointsCollection.length&&(this._inkPointsCollection=z(this._obtainInkListCollection()));o=this._getInkBoundsValue();if(this._customTemplate.size>0)this._appearanceTemplate=this._customTemplate.get("N");else{var e=(h=new Mi(o,this._crossReference))._content.dictionary.getArray("BBox"),i=this._getRotationAngle();e&&null!==i&&void 0!==i&&h._content.dictionary.set("Matrix",[1,0,0,1,-e[0],-e[1]]),h._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(h)}if(this._dictionary.update("Rect",[o[0],o[1],o[0]+o[2],o[1]+o[3]]),!t){var r=void 0;if(this._dictionary.has("AP"))r=this._dictionary.get("AP");else{s=this._crossReference._getNextReference();(r=new Ts(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(s,r),this._dictionary.update("AP",s)}if(this._customTemplate.size>0)this._drawCustomAppearance(r);else{Nt(r,this._crossReference,"N"),this._appearanceTemplate._content.dictionary._updated=!0;s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=s,r.set("N",s),r._updated=!0}}}else if(!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(a=this._dictionary.get("AP"))&&a.has("N")){var n=a.get("N"),s=a.getRaw("N");n&&(s&&(n.reference=s),this._appearanceTemplate=new Mi(n,this._crossReference))}}else if(this._postProcess(),!this._appearanceTemplate&&t)if(this._dictionary.has("AP")){var a=this._dictionary.get("AP");if(a&&a.has("N")){var n=a.get("N"),s=a.getRaw("N");n&&(s&&(n.reference=s),this._appearanceTemplate=new Mi(n,this._crossReference))}}else{0===this._inkPointsCollection.length&&(this._inkPointsCollection=z(this._obtainInkListCollection()));var o=this._getInkBoundsValue(),h=new Mi(o,this._crossReference);lt(h,this._getRotationAngle(),this),h._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(h),this._dictionary.update("Rect",[o[0],o[1],o[0]+o[2],o[1]+o[3]])}if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t){if(this._appearanceTemplate&&null!==this._appearanceTemplate._size&&void 0!==this._appearanceTemplate._size){var c=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),e=void 0,_=void 0;this._appearanceTemplate._content.dictionary.has("BBox")&&(e=this._appearanceTemplate._content.dictionary.getArray("BBox")),this._appearanceTemplate._content.dictionary.has("Matrix")&&(_=this._appearanceTemplate._content.dictionary.getArray("Matrix")),e&&_&&(e[0]!==-_[4]||e[1]!==-_[5])&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-e[0],-e[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,c)}else this._page.annotations.remove(this);if(!this.flattenPopups&&this._dictionary.has("Popup")){s=this._dictionary.getRaw("Popup");if(this._page._pageDictionary.has("Annots")){var d=this._page._pageDictionary.getRaw("Annots");if(d&&Array.isArray(d)&&d.length>0){var u=d.indexOf(s);u>=0&&this._page.annotations.removeAt(u)}}}}},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++){var n=!1,s=H(this.inkPointsCollection)[r];2===s.length&&(s=[s[0]-.5,s[1]-.5,s[0]+.5,s[1]+.5],n=!0);for(var a=new Array(s.length/2),o=0,h=0;h<s.length;h+=2)a[o]=[s[h],s[h+1]],o++;var c=o+2*o-2,_=new Array(c);if(this._isEnableControlPoints){var d=[],u=[],l=this._getControlPoints(a,d,u);d=l.controlP1,u=l.controlP2;for(var f=0,p=0;p<c-1;p+=3)_[p]=a[f],_[p+1]=d[f],_[p+2]=u[f],f++}else if(o%3==1)c=o,_=new Array(c),_=a;else if(o%3==0){c=o+1,_=new Array(c);for(p=0;p<a.length;p++)_[p]=a[p]}else{c=o+2,_=new Array(c);for(p=0;p<a.length;p++)_[p]=a[p];_[c-2]=a[a.length-2]}if(_[c-1]=a[a.length-1],null!==_){for(var g=_,y=0;y<g.length;y++){var m=g[y];g[y]=[m[0],-m[1]]}var b=new Ir,v=null;if(n){var w=a[1][0]-a[0][0],S=a[1][1]-a[0][1];b.addEllipse({x:a[0][0]+.5,y:-(a[0][1]+S+.5),width:w,height:S}),(v=new Ir)._pathTypes=b._pathTypes,v._points=b._points}else 2===a.length?(b.addLine({x:a[0][0],y:-a[0][1]},{x:a[1][0],y:-a[1][1]}),(v=new Ir)._pathTypes=b._pathTypes,v._points=b._points):(b._addBezierPoints(g),(v=new Ir)._pathTypes=b._pathTypes,v._points=U(g));var x=new Zn(this.color,this.border.width);if(this._isLoaded&&(x._lineCap=t.PdfLineCap.round),void 0!==this.opacity&&this._opacity<1){var P=i.save();i.setTransparency(this._opacity),i.drawPath(v,x),i.restore(P)}else i.drawPath(v,x)}}if(this._isFlatten)if(this._page&&this._page._isNew&&this._page._pageSettings&&this._page._pageSettings.margins){var A=this._page._pageSettings.margins;this.bounds={x:this.bounds.x-A.left,y:this._page.size.height-(this.bounds.y+this.bounds.height)-A.top,width:this.bounds.width,height:this.bounds.height}}else this.bounds={x:this.bounds.x,y:this._page.size.height-(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[s]=4*t[s][0]+2*t[s+1][0];n[0]=t[0][0]+2*t[1][0],n[r-1]=(8*t[r-1][0]+t[r][0])/2;for(var a=this._getSingleControlPoint(n),s=1;s<r-1;++s)n[s]=4*t[s][1]+2*t[s+1][1];n[0]=t[0][1]+2*t[1][1],n[r-1]=(8*t[r-1][1]+t[r][1])/2;var o=this._getSingleControlPoint(n);e=new Array(r),i=new Array(r);for(s=0;s<r;++s)if(e[s]=[a[s],o[s]],s<r-1)i[s]=[2*t[s+1][0]-a[s+1],2*t[s+1][1]-o[s+1]];else{var h=(t[r][0]+a[r-1])/2,c=(t[r][1]+o[r-1])/2;i[s]=[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[s]=1/n,n=(s<e-1?4:3.5)-r[s],i[s]=(t[s]-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,e=this,i=[];null===this._linePoints||0!==this._previousCollection.length&&!this._isModified||this._inkPointsCollection.unshift(this._linePoints),0===this.inkPointsCollection.length&&this._previousCollection.length>0&&(this._inkPointsCollection=this._previousCollection);var r=$t(this._inkPointsCollection,this._previousCollection),n=H(this._inkPointsCollection);null!==n&&n.length>0&&!r&&(n.forEach(function(t){var e=t.slice();i.push(e)}),this._dictionary.update("InkList",i)),this._inkPointsCollection.length>0&&(!r||this._isModified)&&((t=this._previousCollection).push.apply(t,this._inkPointsCollection),this._isModified=!1);var s=this._getCropOrMediaBox(),a=!1;if(s&&s.length>3&&"number"==typeof s[0]&&"number"==typeof s[1]&&(0!==s[0]||0!==s[1])&&(a=!0,i.forEach(function(t,r){for(var n=t,a=0;a<t.length;a+=2){var o=t[a],h=t[a+1];o+=s[0],e._page._pageDictionary.has("MediaBox")&&!e._page._pageDictionary.has("CropBox")&&0===s[3]&&s[1]>0?h+=s[3]:h+=s[1],n[a]=o,n[a+1]=h,i[r]=n}}),this._dictionary.update("InkList",i)),this._isEnableControlPoints||a){var o=this._getInkBoundsValue(i);return{x:o[0],y:o[1],width:o[2],height:o[3]}}return this._isFlatten||this._updateInkListCollection(i),this.bounds},i.prototype._updateInkListCollection=function(t){var e=t.map(function(t){for(var e=[],i=0;i<t.length;i+=2)e.push({x:t[i],y:t[i+1]});return e});this._inkPointsCollection=e},i.prototype._getInkBoundsValue=function(t){var e=[0,0,0,0];if(this._points&&this._points.length>0){var i=this._points[0];if("number"==typeof i.x&&"number"==typeof i.y)if(this._points.length>1){var r=this._points[1];"number"==typeof r.x&&"number"==typeof r.y?this.bounds={x:i.x,y:i.y,width:r.x,height:r.y}:this.bounds={x:i.x,y:i.y,width:0,height:0}}else this.bounds={x:i.x,y:i.y,width:0,height:0}}e=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];var n=this.border.width;if(null!==this._inkPointsCollection&&this._inkPointsCollection.length>0){var s=[];H(this._inkPointsCollection).forEach(function(t){null!==t&&t.length%2==0&&s.push.apply(s,t)});var a=!1;this._isLoaded||2!==s.length||(a=!0,s.push(s[0]+1),s.push(s[1]+1));for(var o=new Array(s.length/2),h=0,c=0;c<s.length;c+=2)o[h]=[s[c],s[c+1]],h++;if(this._isLoaded)if(o.length>0){var _=0,d=0,u=0,l=0,f=!0;o.forEach(function(t){f?(_=t[0],d=t[1],f=!1):(t[0]<_?_=t[0]:t[0]>u&&(u=t[0]),t[1]<d?d=t[1]:t[1]>l&&(l=t[1]))}),e=[_,d,u-_,l-d],this.bounds={x:e[0],y:e[1],width:e[2],height:e[3]},(this._isFlatten||this._setAppearance)&&(e[0]=this.bounds.x-n,e[1]=this.bounds.y-n,e[2]=this.bounds.width+2*n,e[3]=this.bounds.height+2*n)}else e=this._points?W(this._points):o.length>0?this._dictionary.get("Rect"):[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height];else e=t?this._calculateInkBounds(o,e,n,a,t):this._calculateInkBounds(o,e,n,a);if(Array.isArray(e)&&e.length>0){var p="number"==typeof e[0]?e[0]:0,g="number"==typeof e[1]?e[1]:0,y="number"==typeof e[2]?e[2]:0,m="number"==typeof e[3]?e[3]:0;this.bounds={x:p,y:g,width:y,height:m}}}return e},i.prototype._calculateInkBounds=function(t,e,i,r,n){if(t.length>5){var s=0,a=0,o=0,h=0,c=!0;t.forEach(function(t){c?(s=t[0],a=t[1],o=t[0],h=t[1],c=!1):(t[0]<s?s=t[0]:t[0]>o&&(o=t[0]),t[1]<a?a=t[1]:t[1]>h&&(h=t[1]))});var _=this._getCropOrMediaBox();if(e[2]<o?o=e[2]:_&&(o-=s),e[3]<h?h=e[3]:_&&(h-=a),_&&(s+=_[0],a+=_[1]),e=[s,a,o,h],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"):W(this._points);return!this._isFlatten&&n&&this._updateInkListCollection(n),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[r],s=0;s<n.length;s++)i.push(n[s]);t.push(i),i.length===n.length&&(i=[])}return t},i}($r),_n=function(e){function i(i,r,n){var s=e.call(this)||this;return s._icon=t.PdfPopupIcon.note,s._iconString="",s._stateModel=t.PdfAnnotationStateModel.none,s._state=t.PdfAnnotationState.none,s._open=!1,s._isReview=!1,s._isComment=!1,s._comment="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 9 5.0908 cm 7.74 12.616 m -7.74 12.616 l -8.274 12.616 -8.707 12.184 -8.707 11.649 c h f Q 0 G ",s._commentSecondHalf="0 i 0.60 w 4 M 1 j 0 J [0 100]1 d 1 0 0 1 9 5.0908 cm 4.1 1.71 m -0.54 -2.29 l -0.54 1.71 l -5.5 1.71 l -5.5 14.42 l 10.5 14.42 l 10.5 1.71 l 4.1 1.71 l -2.33 9.66 m 7.34 9.66 l 7.34 8.83 l -2.33 8.83 l -2.33 9.66 l -2.33 7.28 m 5.88 7.28 l 5.88 6.46 l -2.33 6.46 l -2.33 7.28 l 14.9 23.1235 m -14.9 23.1235 l -14.9 -20.345 l 14.9 -20.345 l 14.9 23.1235 l b ",s._note="0 G 0 i 0.61 w 4 M 0 j 0 J []0 d q 1 0 0 1 16.959 1.3672 cm 0 0 m 0 -0.434 -0.352 -0.785 -0.784 -0.785 c -14.911 -0.785 l -15.345 -0.785 -15.696 -0.434 -15.696 0 c -15.696 17.266 l -15.696 17.699 -15.345 18.051 -14.911 18.051 c -0.784 18.051 l -0.352 18.051 0 17.699 0 17.266 c h b Q q 1 0 0 1 4.4023 13.9243 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4019 11.2207 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4023 8.5176 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4023 5.8135 cm 0 0 m 9.418 0 l S Q ",s._help="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 12.1465 10.5137 cm -2.146 9.403 m -7.589 9.403 -12.001 4.99 -12.001 -0.453 c -12.001 -5.895 -7.589 -10.309 -2.146 -10.309 c 3.296 -10.309 7.709 -5.895 7.709 -0.453 c 7.709 4.99 3.296 9.403 -2.146 9.403 c h f Q ",s._helpSecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 12.1465 10.5137 cm 0 0 m -0.682 -0.756 -0.958 -1.472 -0.938 -2.302 c -0.938 -2.632 l -3.385 -2.632 l -3.403 -2.154 l -3.459 -1.216 -3.147 -0.259 -2.316 0.716 c -1.729 1.433 -1.251 2.022 -1.251 2.647 c -1.251 3.291 -1.674 3.715 -2.594 3.751 c -3.202 3.751 -3.937 3.531 -4.417 3.2 c -5.041 5.205 l -4.361 5.591 -3.274 5.959 -1.968 5.959 c 0.46 5.959 1.563 4.616 1.563 3.089 c 1.563 1.691 0.699 0.771 0 0 c -2.227 -6.863 m -2.245 -6.863 l -3.202 -6.863 -3.864 -6.146 -3.864 -5.189 c -3.864 -4.196 -3.182 -3.516 -2.227 -3.516 c -1.233 -3.516 -0.589 -4.196 -0.57 -5.189 c -0.57 -6.146 -1.233 -6.863 -2.227 -6.863 c -2.146 9.403 m -7.589 9.403 -12.001 4.99 -12.001 -0.453 c -12.001 -5.895 -7.589 -10.309 -2.146 -10.309 c 3.296 -10.309 7.709 -5.895 7.709 -0.453 c 7.709 4.99 3.296 9.403 -2.146 9.403 c b ",s._insert=" 0 i 0.59 w 4 M 0 j 0 J []0 d 1 0 0 1 8.5386 19.8545 cm 0 0 m -8.39 -19.719 l 8.388 -19.719 l h B ",s._key="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 6.5 12.6729 cm 0.001 5.138 m -2.543 5.138 -4.604 3.077 -4.604 0.534 c -4.604 -1.368 -3.449 -3.001 -1.802 -3.702 c -1.802 -4.712 l -0.795 -5.719 l -1.896 -6.82 l -0.677 -8.039 l -1.595 -8.958 l -0.602 -9.949 l -1.479 -10.829 l -0.085 -12.483 l 1.728 -10.931 l 1.728 -3.732 l 1.737 -3.728 1.75 -3.724 1.76 -3.721 c 3.429 -3.03 4.604 -1.385 4.604 0.534 c 4.604 3.077 2.542 5.138 0.001 5.138 c f Q ",s._keySecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 6.5 12.6729 cm 0 0 m -1.076 0 -1.95 0.874 -1.95 1.95 c -1.95 3.028 -1.076 3.306 0 3.306 c 1.077 3.306 1.95 3.028 1.95 1.95 c 1.95 0.874 1.077 0 0 0 c 0.001 5.138 m -2.543 5.138 -4.604 3.077 -4.604 0.534 c -4.604 -1.368 -3.449 -3.001 -1.802 -3.702 c -1.802 -4.712 l -0.795 -5.719 l -1.896 -6.82 l -0.677 -8.039 l -1.595 -8.958 l -0.602 -9.949 l -1.479 -10.829 l -0.085 -12.483 l 1.728 -10.931 l 1.728 -3.732 l 1.737 -3.728 1.75 -3.724 1.76 -3.721 c 3.429 -3.03 4.604 -1.385 4.604 0.534 c 4.604 3.077 2.542 5.138 0.001 5.138 c b ",s._newParagraph="1 0.819611 0 rg 0 G 0 i 0.58 w 4 M 0 j 0 J []0 d ",s._newParagraphSecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d q 1 0 0 1 6.4995 20 cm 0 0 m -6.205 -12.713 l 6.205 -12.713 l h b Q q 1 0 0 1 1.1909 6.2949 cm 0 0 m 1.278 0 l 1.353 0 1.362 -0.02 1.391 -0.066 c 2.128 -1.363 3.78 -4.275 3.966 -4.713 c 3.985 -4.713 l 3.976 -4.453 3.957 -3.91 3.957 -3.137 c 3.957 -0.076 l 3.957 -0.02 3.976 0 4.041 0 c 4.956 0 l 5.021 0 5.04 -0.029 5.04 -0.084 c 5.04 -6.049 l 5.04 -6.113 5.021 -6.133 4.947 -6.133 c 3.695 -6.133 l 3.621 -6.133 3.611 -6.113 3.574 -6.066 c 3.052 -4.955 1.353 -2.063 0.971 -1.186 c 0.961 -1.186 l 0.999 -1.68 0.999 -2.146 1.008 -3.025 c 1.008 -6.049 l 1.008 -6.104 0.989 -6.133 0.933 -6.133 c 0.009 -6.133 l -0.046 -6.133 -0.075 -6.123 -0.075 -6.049 c -0.075 -0.066 l -0.075 -0.02 -0.056 0 0 0 c f Q q 1 0 0 1 9.1367 3.0273 cm 0 0 m 0.075 0 0.215 -0.008 0.645 -0.008 c 1.4 -0.008 2.119 0.281 2.119 1.213 c 2.119 1.969 1.633 2.381 0.737 2.381 c 0.354 2.381 0.075 2.371 0 2.361 c h -1.146 3.201 m -1.146 3.238 -1.129 3.268 -1.082 3.268 c -0.709 3.275 0.02 3.285 0.729 3.285 c 2.613 3.285 3.248 2.314 3.258 1.232 c 3.258 -0.27 2.007 -0.914 0.607 -0.914 c 0.327 -0.914 0.057 -0.914 0 -0.904 c 0 -2.789 l 0 -2.836 -0.019 -2.865 -0.074 -2.865 c -1.082 -2.865 l -1.119 -2.865 -1.146 -2.846 -1.146 -2.799 c h f Q ",s._paragraph="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 19.6973 10.0005 cm 0 0 m 0 -5.336 -4.326 -9.662 -9.663 -9.662 c -14.998 -9.662 -19.324 -5.336 -19.324 0 c -19.324 5.335 -14.998 9.662 -9.663 9.662 c -4.326 9.662 0 5.335 0 0 c h f Q ",s._paragraphSecondHalf="0 G 0 i 0.59 w 4 M 1 j 0 J []0 d q 1 0 0 1 19.6973 10.0005 cm 0 0 m 0 -5.336 -4.326 -9.662 -9.663 -9.662 c -14.998 -9.662 -19.324 -5.336 -19.324 0 c -19.324 5.335 -14.998 9.662 -9.663 9.662 c -4.326 9.662 0 5.335 0 0 c h S Q q 1 0 0 1 11.6787 2.6582 cm 0 0 m -1.141 0 l -1.227 0 -1.244 0.052 -1.227 0.139 c -0.656 1.157 -0.52 2.505 -0.52 3.317 c -0.52 3.594 l -2.833 3.783 -5.441 4.838 -5.441 8.309 c -5.441 10.778 -3.714 12.626 -0.57 13.024 c -0.535 13.508 -0.381 14.129 -0.242 14.389 c -0.207 14.44 -0.174 14.475 -0.104 14.475 c 1.088 14.475 l 1.156 14.475 1.191 14.458 1.175 14.372 c 1.105 14.095 0.881 13.127 0.881 12.402 c 0.881 9.431 0.932 7.324 0.95 4.06 c 0.95 2.298 0.708 0.813 0.189 0.07 c 0.155 0.034 0.103 0 0 0 c b Q ",s._dictionary=new Ts,s._dictionary.update("Type",vs.get("Annot")),s._dictionary.update("Subtype",vs.get("Text")),null!==i&&void 0!==i&&"string"==typeof i?s.text=i:i&&"object"==typeof i&&(n=i),r&&(s.bounds=r),s._type=t._PdfAnnotationType.popupAnnotation,n&&("author"in n&&_e(n.author)&&(s.author=n.author),"subject"in n&&_e(n.subject)&&(s.subject=n.subject),"color"in n&&_e(n.color)&&(s.color=n.color),"icon"in n&&_e(n.icon)&&(s.icon=n.icon),"open"in n&&_e(n.open)&&(s.open=n.open),"state"in n&&_e(n.state)&&(s.state=n.state),"stateModel"in n&&_e(n.stateModel)&&(s.stateModel=n.stateModel)),s}return Qr(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=xt(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",vs.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"stateModel",{get:function(){return this._dictionary.has("StateModel")&&(this._stateModel=Ct(this._dictionary.get("StateModel"))),this._stateModel},set:function(t){void 0!==t&&(this._stateModel=t,this._dictionary.update("StateModel",Tt(this._stateModel)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"state",{get:function(){return this._dictionary.has("State")&&(this._state=At(this._dictionary.get("State"))),this._state},set:function(t){void 0!==t&&(this._state=t,this._dictionary.update("State",Pt(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=Ot(e),r._isReview||(r._isComment=Mt(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;if(this._dictionary.has("BS"))t=this.border.width;else{var e=new Ts(this._crossReference);e.set("Type",vs.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1);var i=[this.bounds.x,this.bounds.y,this.bounds.x+this.bounds.width,this.bounds.y+this.bounds.height];if(this._dictionary.update("Rect",i),this._setAppearance||this._customTemplate.size>0){var r=void 0;if(this._dictionary.has("AP"))r=this._dictionary.get("AP");else{n=this._crossReference._getNextReference();r=new Ts(this._crossReference),this._crossReference._cacheMap.set(n,r),this._dictionary.update("AP",n)}if(this._customTemplate.size>0)this._appearanceTemplate=this._customTemplate.get("N"),this._drawCustomAppearance(r);else if(this._appearanceTemplate=this._createPopupAppearance(),this._appearanceTemplate){Nt(this._dictionary.get("AP"),this._crossReference,"N"),this._appearanceTemplate._content.dictionary._updated=!0;var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=n,r.set("N",n),r._updated=!0}}this._dictionary.update("Rect",te(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 Mi(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 Mi(e,this._crossReference))}}else this._appearanceTemplate=this._createPopupAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&this.flatten&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);this._flattenAnnotationTemplate(this._appearanceTemplate,s)}t&&this._removeAnnotation(this._page,this)},i.prototype._createPopupAppearance=function(){var e=[0,0,this.bounds.width,this.bounds.height],i=new Mi(e,this._crossReference),r=i.graphics;switch(r._sw._clear(),this.opacity<1&&(r.save(),r.setTransparency(this.opacity)),this.icon){case t.PdfPopupIcon.comment:r._sw._write(this._comment),this.color&&r._sw._setColorSpace([this.color.r,this.color.g,this.color.b],t._PdfColorSpace.rgb,!1),r._sw._write(this._commentSecondHalf);break;case t.PdfPopupIcon.paragraph:r._sw._write(this._paragraph),this.color&&r._sw._setColorSpace([this.color.r,this.color.g,this.color.b],t._PdfColorSpace.rgb,!1),r._sw._write(this._paragraphSecondHalf);break;case t.PdfPopupIcon.help:r._sw._write(this._help),this.color&&r._sw._setColorSpace([this.color.r,this.color.g,this.color.b],t._PdfColorSpace.rgb,!1),r._sw._write(this._helpSecondHalf);break;case t.PdfPopupIcon.note:this.color&&r._sw._setColorSpace([this.color.r,this.color.g,this.color.b],t._PdfColorSpace.rgb,!1),r._sw._write(this._note);break;case t.PdfPopupIcon.insert:r._sw._write("0 G "),this.color&&r._sw._setColorSpace([this.color.r,this.color.g,this.color.b],t._PdfColorSpace.rgb,!1),r._sw._write(this._insert);break;case t.PdfPopupIcon.key:r._sw._write(this._key),this.color&&r._sw._setColorSpace([this.color.r,this.color.g,this.color.b],t._PdfColorSpace.rgb,!1),r._sw._write(this._keySecondHalf);break;case t.PdfPopupIcon.newParagraph:r._sw._write(this._newParagraph),this.color&&r._sw._setColorSpace([this.color.r,this.color.g,this.color.b],t._PdfColorSpace.rgb,!1),r._sw._write(this._newParagraphSecondHalf)}return this.opacity<1&&r.restore(),i},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}($r),dn=function(e){function i(i,r,n){var s=e.call(this)||this;return s._dictionary=new Ts,s._dictionary.update("Type",vs.get("Annot")),s._dictionary.update("Subtype",vs.get("Link")),i&&(s.bounds=i),void 0!==r&&null!==r&&(s._fileName=r),s._type=t._PdfAnnotationType.fileLinkAnnotation,n&&("text"in n&&_e(n.text)&&(s.text=n.text),"author"in n&&_e(n.author)&&(s.author=n.author),"subject"in n&&_e(n.subject)&&(s.subject=n.subject),"color"in n&&_e(n.color)&&(s.color=n.color),"opacity"in n&&_e(n.opacity)&&(s.opacity=n.opacity),"action"in n&&_e(n.action)&&(s.action=n.action)),s}return Qr(i,e),Object.defineProperty(i.prototype,"action",{get:function(){var t=this;if(void 0===this._action&&this._dictionary.has("A")){var e=this._dictionary.get("A");if(e&&e.has("Next")){var i=e.get("Next");Array.isArray(i)&&i.forEach(function(e){if(e&&e instanceof Ss){var i=t._crossReference._fetch(e);i.has("JS")&&(t._action=i.get("JS"))}})}}return this._action},set:function(t){var e=this;if(this._isLoaded||"string"!=typeof t||(this._action=t),this._isLoaded&&"string"==typeof t&&this.action!==t&&this._dictionary.has("A")){var i=this._dictionary.get("A");if(i&&i.has("Next")){var r=i.get("Next");Array.isArray(r)&&r.forEach(function(i){if(i&&i instanceof Ss){var r=e._crossReference._fetch(i);r.has("JS")&&(r.update("JS",t),e._action=t,e._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 Ts(this._crossReference);e.set("Type",vs.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",te(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 Ss&&e._isNew&&t._crossReference._cacheMap.delete(e)})}e.has("F")&&Nt(e,this._crossReference,"F")}Nt(this._dictionary,this._crossReference,"A")}var r=new Ts;r.set("Type",vs.get("Action")),r.set("S",vs.get("Launch"));var n=new Ts;if(n.set("Type",vs.get("Filespec")),n.set("UF",this._fileName),void 0!==this._action&&null!==this._action){var s=new Ts;s.set("Type",vs.get("Action")),s.set("S",vs.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 Mi(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(Zr),un=function(e){function i(i,r,n){var s=e.call(this)||this;return s._dictionary=new Ts,s._dictionary.update("Type",vs.get("Annot")),s._dictionary.update("Subtype",vs.get("Link")),i&&(s.bounds=i),void 0!==r&&null!==r&&(s._uri=r),s._type=t._PdfAnnotationType.uriAnnotation,n&&("text"in n&&_e(n.text)&&(s.text=n.text),"author"in n&&_e(n.author)&&(s.author=n.author),"subject"in n&&_e(n.subject)&&(s.subject=n.subject),"color"in n&&_e(n.color)&&(s.color=n.color),"innerColor"in n&&_e(n.innerColor)&&(s.innerColor=n.innerColor),"opacity"in n&&_e(n.opacity)&&(s.opacity=n.opacity),"border"in n&&_e(n.border)&&(s.border=n.border)),s}return Qr(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 Ts(this._crossReference);e.set("Type",vs.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",te(this))},i.prototype._addAction=function(){var t=new Ts;t.set("Type",vs.get("Action")),t.set("S",vs.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 Mi(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(Zr),ln=function(e){function i(i,r,n){var s=e.call(this)||this;return s._dictionary=new Ts,s._dictionary.update("Type",vs.get("Annot")),s._dictionary.update("Subtype",vs.get("Link")),null!==i&&void 0!==i&&(s.bounds=i),null!==r&&void 0!==r&&(s.destination=r),s._type=t._PdfAnnotationType.documentLinkAnnotation,n&&("text"in n&&_e(n.text)&&(s.text=n.text),"author"in n&&_e(n.author)&&(s.author=n.author),"subject"in n&&_e(n.subject)&&(s.subject=n.subject),"color"in n&&_e(n.color)&&(s.color=n.color),"innerColor"in n&&_e(n.innerColor)&&(s.innerColor=n.innerColor),"opacity"in n&&_e(n.opacity)&&(s.opacity=n.opacity),"border"in n&&_e(n.border)&&(s.border=n.border)),s}return Qr(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){if(this._isLoaded&&!this._destination){var t=void 0;if(this._dictionary.has("Dest"))t=new Hn(this._dictionary,"Dest"),this.destination=t._obtainDestination();else if(!this._destination&&this._dictionary.has("A")){var e=this._dictionary.get("A");e&&e instanceof Ts&&e.has("D")&&(t=new Hn(e,"D"),this.destination=t._obtainDestination())}}return this._destination},set:function(t){t&&(this._destination=t,this._isLoaded&&this._destination._initializePrimitive())},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",te(this))},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._destination&&this._dictionary.update("Dest",this._destination._array):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 Mi(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(Zr),fn=function(e){function i(i,r,n,s,a){var o=e.call(this)||this;return o._isActionAdded=!1,o._dictionary=new Ts,o._dictionary.update("Type",vs.get("Annot")),o._dictionary.update("Subtype",vs.get("Link")),i&&(o.bounds=i),o._textWebLink=a&&void 0!==a.text&&null!==a.text?a.text:"",void 0!==r&&null!==r&&(o._brush=new Qn(r)),void 0!==n&&null!==n&&(o._pen=new Zn(n,s||1)),o._type=t._PdfAnnotationType.textWebLinkAnnotation,a&&("url"in a&&_e(a.url)&&(o.url=a.url),"font"in a&&_e(a.font)&&(o.font=a.font),"text"in a&&_e(a.text)&&(o.text=a.text),"author"in a&&_e(a.author)&&(o.author=a.author),"subject"in a&&_e(a.subject)&&(o.subject=a.subject),"color"in a&&_e(a.color)&&(o.color=a.color),"opacity"in a&&_e(a.opacity)&&(o.opacity=a.opacity),"border"in a&&_e(a.border)&&(o.border=a.border)),o}return Qr(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 Ss||(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",te(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 Ei(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top);this._page.graphics.drawString(this._textWebLink,this.font,{x:e[0],y:e[1],width:e[2],height:e[3]},this._pen,this._brush,i);var r=new Ts;r.set("Type",vs.get("Action")),r.set("S",vs.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 Mi(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(Zr),pn=function(e){function i(i,r,n,s){var a=e.call(this)||this;return a._icon=t.PdfAttachmentIcon.pushPin,a._iconString="",a._dictionary=new Ts,a._dictionary.update("Type",vs.get("Annot")),a._dictionary.update("Subtype",vs.get("FileAttachment")),i&&(a.bounds=i),void 0!==r&&(a._fileName=r),a._stream=new Fs("string"==typeof n?R(n):n),a._type=t._PdfAnnotationType.fileAttachmentAnnotation,s&&("icon"in s&&_e(s.icon)&&(a.icon=s.icon),"text"in s&&_e(s.text)&&(a.text=s.text),"author"in s&&_e(s.author)&&(a.author=s.author),"subject"in s&&_e(s.subject)&&(a.subject=s.subject),"color"in s&&_e(s.color)&&(a.color=s.color),"opacity"in s&&_e(s.opacity)&&(a.opacity=s.opacity),"border"in s&&_e(s.border)&&(a.border=s.border)),a}return Qr(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=kt(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",vs.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",te(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")&&Nt(e,this._crossReference,"F")}Nt(this._dictionary,this._crossReference,"FS")}var i=new Ts;i.set("Type",vs.get("Filespec")),i.set("Desc",this._fileName),i.set("F",this._fileName),i.set("UF",this._fileName);var r=new Ts;r.set("Type",vs.get("EmbeddedFile"));var n=new Ts,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 Ts,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 Ts;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 Mi(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}($r),gn=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.movieAnnotation,i}return Qr(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 Mi(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(Zr),yn=function(e){function i(i,r,n){var s=e.call(this)||this;return s._textMarkupType=t.PdfTextMarkupAnnotationType.highlight,s._dictionary=new Ts,s._dictionary.update("Type",vs.get("Annot")),void 0!==i&&(s._text=i),r&&(s.bounds=r),s._type=t._PdfAnnotationType.textMarkupAnnotation,n&&("boundsCollection"in n&&_e(n.boundsCollection)&&(s.boundsCollection=n.boundsCollection),"author"in n&&_e(n.author)&&(s.author=n.author),"subject"in n&&_e(n.subject)&&(s.subject=n.subject),"innerColor"in n&&_e(n.innerColor)&&(s.innerColor=n.innerColor),"textMarkUpColor"in n&&_e(n.textMarkUpColor)&&(s.textMarkUpColor=n.textMarkUpColor),"textMarkupType"in n&&_e(n.textMarkupType)&&(s.textMarkupType=n.textMarkupType),"opacity"in n&&_e(n.opacity)&&(s.opacity=n.opacity),"border"in n&&_e(n.border)&&(s.border=n.border)),s}return Qr(i,e),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._isLoaded&&(this._bounds=L(this._dictionary,this._page)),this._bounds},set:function(t){if(t)if(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.height-(t.y+t.height),r=i+t.height;this._dictionary.update("Rect",[t.x,i,t.x+t.width,r]),this._bounds=t,this._isChanged=!0}}}else{this._bounds=t;var n=this._obtainNativeRectangle();this._dictionary.update("Rect",M({x:n[0],y:n[1],width:n[2],height:n[3]})),this._isChanged=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textMarkUpColor",{get:function(){return void 0===this._textMarkUpColor&&this._dictionary.has("C")&&(this._textMarkUpColor=q(this._dictionary.getArray("C"))),this._textMarkUpColor},set:function(t){if(t){var e=this.color;this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._color=t,this._textMarkUpColor=t,this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/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=bt(t.name)}return this._textMarkupType},set:function(t){void 0!==t&&(this._textMarkupType=t,this._dictionary.update("Subtype",vs.get(vt(t))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boundsCollection",{get:function(){if(!this._isLoaded)return this._boundsCollection;var t=[];if(!this._dictionary.has("QuadPoints"))return t;var e=this._dictionary.getArray("QuadPoints");if(!e||0===e.length)return t;for(var i=this._getMediaOrCropBox(this._page),r=i&&i.length>0?i[0]:0,n=i&&i.length>1?i[1]:0,s=this._page.size.height,a=e.length/8,o=0;o<a;o++){var h=8*o,c=e[h+4]-e[h],_=e[h+5]-e[h+1],d=Math.sqrt(c*c+_*_);c=e[h+6]-e[h+4],_=e[h+7]-e[h+5];var u=Math.sqrt(c*c+_*_),l=e[h]-r,f=s-e[h+1]-n;t.push({x:l,y:f,width:u,height:d})}return t},set:function(t){var e;if(this._isLoaded||void 0===t||(t.length>0?(this._quadPoints=new Array(8*t.length),(e=this._boundsCollection).push.apply(e,t)):(this._quadPoints=new Array(8),this._boundsCollection=t),this._isChanged=!0),this._isLoaded&&void 0!==t){var i=!1;if(this.boundsCollection.length===t.length)for(a=0;a<t.length;a++){var r=t[a],n=this.boundsCollection[a];if(r.x!==n.x||r.y!==n.y||r.width!==n.width||r.height!==n.height){i=!0;break}}else i=!0;if(i){this._quadPoints=new Array(8*t.length);for(var s=this._page.size.height,a=0;a<t.length;a++){var o=t[a];this._quadPoints[0+8*a]=o.x,this._quadPoints[1+8*a]=s-o.y,this._quadPoints[2+8*a]=o.x+o.width,this._quadPoints[3+8*a]=s-o.y,this._quadPoints[4+8*a]=o.x,this._quadPoints[5+8*a]=this._quadPoints[1+8*a]-o.height,this._quadPoints[6+8*a]=o.x+o.width,this._quadPoints[7+8*a]=this._quadPoints[5+8*a]}this._dictionary.update("QuadPoints",this._quadPoints),this._isChanged=!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._obtainNativeRectangle=function(){var t,e=[this._bounds.x,this._bounds.y+this._bounds.height,this._bounds.width,this._bounds.height];if(this._page&&!this._page._isNew){i=this._page.size;e[1]=i.height-e[1],t=this._getCropOrMediaBox()}else if(this._page&&this._page._isNew){var i=this._page._getActualBounds(this._page._pageSettings);e[0]+=i[0],e[1]=this._page._pageSettings.size.height-(i[1]+e[1]),t=this._getCropOrMediaBox()}if(t){if(t[3]<0){var r=t[1],n=t[3];t[1]=n,t[3]=r}t.length>2&&(0!==t[0]||0!==t[1])&&(e[0]+=t[0],this._page&&this._page._pageDictionary.has("MediaBox")&&!this._page._pageDictionary.has("CropBox")&&t[1]>0&&0===t[3]?e[1]+=t[3]:e[1]+=t[1])}return e},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:((r=new Ts(this._crossReference)).set("Type",vs.get("Border")),r.set("W",this.border.width),this._dictionary.set("BS",r)),void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var e=this._page.size;if(this._dictionary.update("Subtype",vs.get(vt(this._textMarkupType))),this._isChanged&&(this._setQuadPoints(e),this._dictionary.update("Rect",te(this))),this._setAppearance){if(this._appearanceTemplate=this._createMarkupAppearance(),!this._isLoaded&&this._boundsCollection.length>1&&this._isChanged){var i=this._obtainNativeRectangle();this._dictionary.update("Rect",[i[0],i[1],i[0]+i[2],i[1]+i[3]])}this._dictionary.has("AP")&&Nt(this._dictionary.get("AP"),this._crossReference,"N");var r=new Ts;this._appearanceTemplate._content.dictionary._updated=!0;var n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=n,r.set("N",n),r._updated=!0,this._dictionary.set("AP",r)}void 0!==this._text&&null!==this._text&&this._dictionary.set("Contents",this._text),this._isChanged=!1},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")&&Nt(this._dictionary.get("AP"),this._crossReference,"N");var i=new Ts;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 Mi(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 Mi(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)}e&&this._page.annotations.remove(this)},i.prototype._createMarkupAppearance=function(){var e,i=0,r=0;if(this.boundsCollection.length>1){for(var n=new Ir,s=0;s<this.boundsCollection.length;s++)(v=[])[0]=this.boundsCollection[s].x,v[1]=this.boundsCollection[s].y,v[2]=this.boundsCollection[s].width,v[3]=this.boundsCollection[s].height,n.addRectangle({x:v[0],y:v[1],width:v[2],height:v[3]});e={x:(S=n._getBounds())[0],y:S[1],width:S[2],height:S[3]},this.bounds=e,i=e.width,r=e.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=[],h=0;h<a.length;){var c=a[h],_=a[h+1];o.push({x:c,y:_}),h+=2}var d=new Ir;d._addLines(o),i=(e={x:(S=d._getBounds())[0],y:S[1],width:S[2],height:S[3]}).width,r=e.height}else{var u=Math.floor(a[4+8*s])-Math.floor(a[0+8*s]),l=Math.floor(a[5+8*s])-Math.floor(a[1+8*s]);r=Math.sqrt(u*u+l*l),u=Math.floor(a[6+8*s])-Math.floor(a[4+8*s]),l=Math.floor(a[7+8*s])-Math.floor(a[5+8*s]),i=Math.sqrt(u*u+l*l),this.bounds={x:this.bounds.x,y:this.bounds.y,width:i,height:r}}}var f=new Mi([0,0,i,r],this._crossReference);lt(f,this._getRotationAngle());var p=f.graphics;if(void 0!==this.opacity&&p.setTransparency(this.opacity,this.opacity,t.PdfBlendMode.multiply),this.textMarkUpColor){var g=new Zn(this.textMarkUpColor,this.border.width),y=new Qn(this.textMarkUpColor),c=0,_=0,m=0,b=0;if(this.boundsCollection.length>1)for(s=0;s<this.boundsCollection.length;s++){var v=[];v[0]=this.boundsCollection[s].x,v[1]=this.boundsCollection[s].y,v[2]=this.boundsCollection[s].width,v[3]=this.boundsCollection[s].height,this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?p.drawRectangle({x:v[0]-e.x,y:v[1]-e.y,width:v[2],height:v[3]},y):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?(c=v[0]-e.x,_=v[1]-e.y+(v[3]-v[3]/2/3),m=v[2]+(v[0]-e.x),b=v[1]-e.y+(v[3]-v[3]/2/3),p.drawLine(g,{x:c,y:_},{x:m,y:b})):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?(c=v[0]-e.x,_=v[1]-e.y+(v[3]-v[3]/2),m=v[2]+(v[0]-e.x),b=v[1]-e.y+(v[3]-v[3]/2),p.drawLine(g,{x:c,y:_},{x:m,y:b})):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(g._width=.02*v[3],p.save(),p.translateTransform({x:v[0]-e.x,y:v[1]-e.y}),p.setClip({x:0,y:0,width:v[2],height:v[3]}),p.drawPath(this._drawSquiggly(v[2],v[3]),g),p.restore())}else if(this.textMarkupType===t.PdfTextMarkupAnnotationType.highlight?p.drawRectangle({x:0,y:0,width:i,height:r},y):this.textMarkupType===t.PdfTextMarkupAnnotationType.underline?p.drawLine(g,{x:0,y:r-r/2/3},{x:i,y:r-r/2/3}):this.textMarkupType===t.PdfTextMarkupAnnotationType.strikeOut?p.drawLine(g,{x:0,y:r/2},{x:i,y:r/2}):this.textMarkupType===t.PdfTextMarkupAnnotationType.squiggly&&(g._width=.02*r,p.drawPath(this._drawSquiggly(Math.round(i),Math.round(r)),g)),this._isLoaded){var w=[e.x,e.y,e.x+e.width,e.y+e.height],S=this._setAppearance?te(this):w;this._dictionary.update("Rect",S)}}return f},i.prototype._drawSquiggly=function(t,e){(Math.floor(t)%2!=0||Math.round(t)>t)&&(t=Math.floor(t)+1);for(var i=new Ir,r=[],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={x:h,y:parseFloat(_.toFixed(2))};r.push(d),o=0===o?a:0,h+=s}return i._addLines(r),i},i}($r),mn=function(i){function r(r,n,s){var a=i.call(this)||this;return a._watermarkText="",null!==r&&void 0!==r&&n&&e.initializeTelemetryFeature("Watermark","PDFLibrary"),a._dictionary=new Ts,a._dictionary.update("Type",vs.get("Annot")),a._dictionary.update("Subtype",vs.get("Watermark")),void 0!==r&&(a._watermarkText=r,a.text=r),n&&(a.bounds=n),a._type=t._PdfAnnotationType.watermarkAnnotation,s&&("author"in s&&_e(s.author)&&(a.author=s.author),"subject"in s&&_e(s.subject)&&(a.subject=s.subject),"color"in s&&_e(s.color)&&(a.color=s.color),"innerColor"in s&&_e(s.innerColor)&&(a.innerColor=s.innerColor),"opacity"in s&&_e(s.opacity)&&(a.opacity=s.opacity),"border"in s&&_e(s.border)&&(a.border=s.border)),a}return Qr(r,i),r._load=function(t,e){var i=new r;return i._isLoaded=!0,i._initialize(t,e),i},r.prototype._initialize=function(t,e){i.prototype._initialize.call(this,t,e)},r.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 Ts(this._crossReference);e.set("Type",vs.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),void 0===this.color&&(this.color={r:0,g:0,b:0}),this._appearanceTemplate=this._createWatermarkAppearance(),this._dictionary.update("Rect",te(this)),void 0!==this.opacity&&1!==this._opacity&&this._dictionary.set("CA",this._opacity)},r.prototype._createWatermarkAppearance=function(){var e=this._obtainFont();(void 0===e||null===e||(!this._isLoaded||this._page&&this._page._isDuplicate)&&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 Fr({x:0,y:0,width:this.bounds.width,height:this.bounds.height},this);r.normal=new Mi(i,this._crossReference);var n=r.normal;lt(n,this._rotateAngle);var s,a=r.normal.graphics,o=this.border.width/2,h=new Ei(t.PdfTextAlignment.left,t.PdfVerticalAlignment.top),c=new Zn(this.color,o);if(this.innerColor&&(s=new Qn(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,{x:0,y:0,width:0,height:0},c,s,h),this._dictionary.has("AP")){var _=this._dictionary.get("AP");_&&_ instanceof Ts&&Nt(_,this._crossReference,"N")}var d=new Ts;a._template._content.dictionary._updated=!0;var u=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(u,a._template._content),a._template._content.reference=u,d.set("N",u),d._updated=!0,this._dictionary.set("AP",d),n},r.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 Mi(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 Mi(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)}else t&&this._page.annotations.remove(this)},r}(Zr),bn=function(e){function i(i,r){var n=e.call(this)||this;return n._icon=t.PdfRubberStampAnnotationIcon.draft,n._stampWidth=0,n._iconString="",n.rotateAngle=0,n._alterRotateBounds=!0,n._stampAppearanceFont=new xr(t.PdfFontFamily.helvetica,20,t.PdfFontStyle.italic|t.PdfFontStyle.bold),n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("Stamp")),i&&(n.bounds=i),n._type=t._PdfAnnotationType.rubberStampAnnotation,r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"color"in r&&_e(r.color)&&(n.color=r.color),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"icon"in r&&_e(r.icon)&&(n.icon=r.icon),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border)),n}return Qr(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=St(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",vs.get("#"+this._obtainIconName(this._icon).replace(/\s+/g,""))))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"appearance",{get:function(){if(this._isLoaded)return null;if(void 0===this._appearance){var t={x:0,y:0,width:this.bounds.width,height:this.bounds.height};this._appearance=new Fr(t,this),this._appearance.normal=new Mi(t,this._crossReference)}return this._appearance},enumerable:!0,configurable:!0}),i.prototype.createTemplate=function(){var t=this._createTemplate();return void 0===t&&(t=this._createRubberStampAppearance()),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 Ts(this._crossReference);e.set("Type",vs.get("Border")),this._dictionary.set("BS",e)}void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0),this._dictionary.has("AP")&&this._isLoaded?this._parseStampAppearance():this._appearanceTemplate=this._createRubberStampAppearance()},i.prototype._doPostProcess=function(t){void 0===t&&(t=!1);var e=!1;if(this._isLoaded&&(this._setAppearance||t||this._isExport))(!t&&!this._isExport||this._setAppearance||this._isRotated)&&(this._appearanceTemplate=this._createRubberStampAppearance()),!this._appearanceTemplate&&(this._isExport||t)&&this._dictionary.has("AP")&&(e=this._parseStampAppearance());else if(this._isImported&&this._dictionary.has("AP")||this._postProcess(),!this._appearanceTemplate&&(t||this._isImported))if(this._dictionary.has("AP")){var i=this._dictionary.get("AP");if(i&&i.has("N")){var r=i.get("N");if(r){var n=i.getRaw("N");n&&(r.reference=n),this._appearanceTemplate=new Mi(r,this._crossReference)}}}else this._appearanceTemplate=this._createRubberStampAppearance();if(void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate){var s=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);if(!this._appearanceTemplate._content.dictionary.has("Matrix")){var a=this._appearanceTemplate._content.dictionary.getArray("BBox");a&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-a[0],-a[1]])}e?this._flattenAnnotationTemplate(this._appearanceTemplate,e):this._flattenAnnotationTemplate(this._appearanceTemplate,s)}else t&&this._page.annotations.remove(this)},i.prototype._parseStampAppearance=function(){var e=!1,i=this._dictionary.get("AP");if(i&&i.has("N")){var r=i.get("N");if(r){var n=i.getRaw("N");n&&(r.reference=n);var s=!1;if(this._type===t._PdfAnnotationType.rubberStampAnnotation){var a=!1,o=void 0,h=void 0;if(r&&((a=this._page.rotation===t.PdfRotationAngle.angle0&&this.rotationAngle===t.PdfRotationAngle.angle0)||(a=this._page.rotation!==t.PdfRotationAngle.angle0&&this.rotationAngle===t.PdfRotationAngle.angle0)),this._appearanceTemplate=new Mi(r,this._crossReference),s=!0,(e=!!a)&&r instanceof Rs){var c=r.dictionary.getArray("Matrix");if(c){var _=c.slice(),d=r.dictionary.getArray("BBox");if(d&&d.length>3){h=O(d);var u=this._transformBBox(h,_);o=[u[2],u[3]],this._appearanceTemplate._size={width:o[0],height:o[1]}}else o=[h.width,h.height]}}else h&&(o=[h.width,h.height])}s||(this._appearanceTemplate=new Mi(r,this._crossReference))}}return e},i.prototype._createRubberStampAppearance=function(){var e,i={x:0,y:0,width:this.bounds.width,height:this.bounds.height};this._appearance?(e=this._appearance,this._dictionary.has("Name")||this._dictionary.update("Name",vs.get("#23CustomStamp"))):(this._iconString=this._obtainIconName(this.icon),this._dictionary.update("Name",vs.get("#23"+this._iconString.replace(/\s+/g,""))),(e=new Fr(i,this)).normal=new Mi(i,this._crossReference));var r=e.normal;!this._alterRotateBounds||void 0===this._rotate||this._rotate===t.PdfRotationAngle.angle0&&0===this._getRotationAngle()?this.rotateAngle=this._getRotationAngle():(this.rotateAngle=this._getRotationAngle(),0===this.rotateAngle&&(this.rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this.rotate)),lt(r,this.rotate,this),this._appearance||this._drawStampAppearance(r);var n,s;if(this._dictionary&&this._dictionary.has("AP")){var a=this._dictionary.get("AP");a&&a.has("N")&&(s=a.getRaw("N"))instanceof Ss&&(this._crossReference._cacheMap.delete(s),n=!0)}var o=new Ts;return r._content.dictionary._updated=!0,n||(s=this._crossReference._getNextReference()),this._crossReference._cacheMap.set(s,r._content),r._content.reference=s,o.set("N",s),o._updated=!0,this._dictionary.set("AP",o),this._dictionary.set("Border",[this.border.hRadius,this.border.vRadius,this.border.width]),this._dictionary.update("Rect",te(this)),r},i.prototype._drawStampAppearance=function(e){var i=new Ei;i.alignment=t.PdfTextAlignment.center,i.lineAlignment=t.PdfVerticalAlignment.middle;var r=new Qn(this._obtainBackGroundColor()),n=new Zn(this._obtainBorderColor(),this.border.width),s=e.graphics;s.save(),s.scaleTransform(e._size.width/(this._stampWidth+4),e._size.height/28);var a=this._stampAppearanceFont;void 0!==this.opacity&&this._opacity<1&&s.setTransparency(this._opacity),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="As Is",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="For Comment",this._stampWidth=166;break;case t.PdfRubberStampAnnotationIcon.forPublicRelease:this._iconString="For Public Release",this._stampWidth=240;break;case t.PdfRubberStampAnnotationIcon.notApproved:this._iconString="Not Approved",this._stampWidth=186;break;case t.PdfRubberStampAnnotationIcon.notForPublicRelease:this._iconString="Not For Public Release",this._stampWidth=290;break;case t.PdfRubberStampAnnotationIcon.sold:this._iconString="Sold",this._stampWidth=75;break;case t.PdfRubberStampAnnotationIcon.topSecret:this._iconString="Top Secret",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="Information Only",this._stampWidth=230;break;case t.PdfRubberStampAnnotationIcon.preliminaryResults:this._iconString="Preliminary Results",this._stampWidth=260}return this._iconString},i.prototype._obtainBackGroundColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?{r:251,g:222,b:221}:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?{r:229,g:238,b:222}:{r:219,g:227,b:240}},i.prototype._obtainBorderColor=function(){return this._icon===t.PdfRubberStampAnnotationIcon.notApproved||this._icon===t.PdfRubberStampAnnotationIcon.void?{r:151,g:23,b:15}:this._icon===t.PdfRubberStampAnnotationIcon.approved||this._icon===t.PdfRubberStampAnnotationIcon.final||this._icon===t.PdfRubberStampAnnotationIcon.completed?{r:73,g:110,b:38}:{r:24,g:37,b:100}},i.prototype._drawRubberStamp=function(t,e,i,r,n){var s={x:2,y:1,width:this._stampWidth,height:26};t.drawRoundedRectangle(s,3,e,i);var a=new Qn(this._obtainBorderColor());t.drawString(this._iconString.toUpperCase(),r,s,null,a,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=O(n))}}}}return t},i}($r),vn=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.soundAnnotation,i}return Qr(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 Mi(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}($r),wn=function(e){function i(i,r){var n=e.call(this)||this;return n._intentString="",n._markUpFont=new xr(t.PdfFontFamily.helvetica,7,t.PdfFontStyle.regular),n._textAlignment=t.PdfTextAlignment.left,n._cropBoxValueX=0,n._cropBoxValueY=0,n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("FreeText")),i&&(n.bounds=i),n._isContentUpdated=!1,n._type=t._PdfAnnotationType.freeTextAnnotation,n._parsedXMLData=[],r&&("text"in r&&_e(r.text)&&(n.text=r.text),"author"in r&&_e(r.author)&&(n.author=r.author),"subject"in r&&_e(r.subject)&&(n.subject=r.subject),"textMarkUpColor"in r&&_e(r.textMarkUpColor)&&(n.textMarkUpColor=r.textMarkUpColor),"innerColor"in r&&_e(r.innerColor)&&(n.innerColor=r.innerColor),"lineEndingStyle"in r&&_e(r.lineEndingStyle)&&(n.lineEndingStyle=r.lineEndingStyle),"opacity"in r&&_e(r.opacity)&&(n.opacity=r.opacity),"border"in r&&_e(r.border)&&(n.border=r.border),"borderColor"in r&&_e(r.borderColor)&&(n.borderColor=r.borderColor),"annotationIntent"in r&&_e(r.annotationIntent)&&(n.annotationIntent=r.annotationIntent),"textAlignment"in r&&_e(r.textAlignment)&&(n.textAlignment=r.textAlignment),"font"in r&&_e(r.font)&&(n.font=r.font),"calloutLines"in r&&_e(r.calloutLines)&&(n.calloutLines=r.calloutLines)),n}return Qr(i,e),Object.defineProperty(i.prototype,"calloutLines",{get:function(){return null!==this._calloutLines&&void 0!==this._calloutLines||(this._calloutLines=this._getCalloutLinePoints()),this._calloutLines},set:function(t){if(!this._isLoaded)return void(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++){var i=t[a],r=this._calloutLines[a];if(i.x!==r.x||i.y!==r.y){e=!0;break}}else e=!0;if(e){for(var n=this._page.size.height,s=[],a=0;a<t.length;a++)s.push(t[a].x+this._cropBoxValueX),s.push(n+this._cropBoxValueY-t[a].y);this._calloutLines=t,this._dictionary.update("CL",s)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineEndingStyle",{get:function(){return this._isLoaded?this._lineEndingStyle=this._obtainLineEndingStyle():void 0===this._lineEndingStyle&&(this._lineEndingStyle=t.PdfLineEndingStyle.none),this._lineEndingStyle},set:function(t){void 0!==t&&this._dictionary.update("LE",vs.get(X(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=q(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++)-1!==e[i].indexOf("color")&&((t=e[i].split(":")[1]).startsWith("#")&&(t=t.substring(1)),this._textMarkUpColor=N(t));if(!this._textMarkUpColor&&this._dictionary.has("RC")){var r=void 0;this._parsedXMLData.length>0&&this._parsedXMLData[3]&&(r=this._parsedXMLData[3]._color,this._textMarkUpColor=r)}this._isLoaded&&!this._textMarkUpColor&&this._dictionary.has("DA")?this._textMarkUpColor=this._obtainColor():this._isLoaded||this._textMarkUpColor||(this._textMarkUpColor={r:0,g:0,b:0})}return this._textMarkUpColor},set:function(t){t&&(this._textMarkUpColor=t,this._updateStyle(this.font,t,this.textAlignment)),this._isContentUpdated=!0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textAlignment",{get:function(){if(this._dictionary.has("Q"))this._textAlignment=this._dictionary.get("Q");else if(this._dictionary.has("RC")){var t=void 0;this._parsedXMLData.length>0&&this._parsedXMLData[1]&&(t=this._parsedXMLData[1],this._textAlignment=t)}return this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t,this._isContentUpdated=!0},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,this._isContentUpdated=!0},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){t&&(this._borderColor=t,this._dictionary.update("DA",this._getBorderColorString(this.borderColor)))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"annotationIntent",{get:function(){return void 0!==this._annotationIntent&&null!==this._annotationIntent||(this._dictionary.has("IT")?this._annotationIntent=Rt(this._dictionary.get("IT").name):this._annotationIntent=t.PdfAnnotationIntent.none),this._annotationIntent},set:function(e){void 0!==e&&(this._annotationIntent=e,void 0!==this.subject&&"null"!==this.subject||e!==t.PdfAnnotationIntent.none||this._calloutLines&&(!this._calloutLines||0!==this._calloutLines.length)?this._dictionary.update("IT",vs.get(this._obtainAnnotationIntent(this._annotationIntent))):this._dictionary.update("Subj","Text Box"))},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}),Object.defineProperty(i.prototype,"_innerBounds",{get:function(){var t=this.border.width/2,e=this._obtainAppearanceBounds(),i=new Bn,r=this._obtainColor(),n=new Zn(r,this.border.width);this.border.width>0&&(i.borderPen=n);var s=this._obtainStyle(n,e,t,i);return this.calloutLines&&this._calloutLines.length>0&&(this._innerTextBoxBounds={x:s[0],y:this._page.size.height-(s[1]+s[3]),width:s[2],height:s[3]}),this._innerTextBoxBounds},enumerable:!0,configurable:!0}),i._load=function(t,e){var r=new i;return r._isLoaded=!0,r._initialize(t,e),e.has("RC")&&(r._parsedXMLData=r._parseMarkupLanguageData(e.get("RC"))),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 Ts(this._crossReference);i.set("Type",vs.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var r=this._getCropOrMediaBox();r&&r.length>3&&"number"==typeof r[0]&&"number"==typeof r[1]&&(0!==r[0]||0!==r[1])&&(this._cropBoxValueX=r[0],this._cropBoxValueY=r[1]),(t||this._setAppearance||this._customTemplate.size>0)&&(this._appearanceTemplate=this._createAppearance()),t||(this._dictionary.update("Rect",te(this)),this._saveFreeTextDictionary())},i.prototype._doPostProcess=function(e){if(void 0===e&&(e=!1),this._isLoaded)(this._setAppearance||this._customTemplate.size>0||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 Mi(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 Mi(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)}else e&&this._page.annotations.remove(this);if(this._dictionary.has("RC")&&this._isContentUpdated&&this._updateStyle(this.font,this._textMarkUpColor,this.textAlignment),!e&&(this._setAppearance||this._customTemplate.size>0)){var a=void 0,o=this._crossReference;if(this._dictionary.has("AP"))a=this._dictionary.get("AP");else{h=o._getNextReference();a=new Ts(o),o._cacheMap.set(h,a),a._updated=!0,this._dictionary.update("AP",h)}if(this._customTemplate.size>0)this._drawCustomAppearance(a);else{Nt(a,o,"N");var h=o._getNextReference();o._cacheMap.set(h,this._appearanceTemplate._content),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=h,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._page.annotations.remove(this),r=!1}}return r},i.prototype._createAppearance=function(){var e,i;if(this._page&&this._page._pageSettings&&this._page._pageSettings.margins&&(i=this._page._pageSettings.margins),this._customTemplate.has("N"))e=this._customTemplate.get("N");else{var r=this.border.width/2,n=this._obtainAppearanceBounds(),s=this.rotate;0!==s&&90!==s&&180!==s&&270!==s||(this._isAllRotation=!1);var a=(e=s>0&&this._isAllRotation?new Mi([0,0,n[2],n[3]],this._crossReference):new Mi(n,this._crossReference))._content.dictionary.getArray("BBox"),o=this._getRotationAngle();a&&null!==o&&void 0!==o&&e._content.dictionary.set("Matrix",[1,0,0,1,-a[0],-a[1]]);var h=new Bn,c=this._obtainText();e._writeTransformation=!1;var _=e.graphics,d=this._obtainTextAlignment(),u=this._obtainColor(),l=new Zn(u,this.border.width);this.border.width>0&&(h.borderPen=l);var f=this._obtainStyle(l,n,r,h);this.color&&(h.foreBrush=new Qn(this._color));var p=this.textMarkUpColor?this._textMarkUpColor:{r:0,g:0,b:0};if(h.backBrush=new Qn(p),h.borderWidth=this.border.width,this.calloutLines&&this._calloutLines.length>=2){if(this._drawCallOuts(_,l),this._isLoaded&&void 0===this._lineEndingStyle&&(this._lineEndingStyle=this.lineEndingStyle),this._lineEndingStyle!==t.PdfLineEndingStyle.none){for(var g=this._obtainLinePoints(),y=[],m=0;m<g.length;m+=2)y.push({x:g[m],y:g[m+1]});var b=this._getAngle(y),v=this._getAxisValue({x:g[2],y:g[3]},90,0);this._drawLineEndStyle(v,_,b,l,h.foreBrush,this.lineEndingStyle,this.border.width,!1)}(f=this._dictionary.has("RD")?[f[0],-f[1],f[2],-f[3]]:[this.bounds.x+(i?i.left:0),-(this._page.size.height-(this.bounds.y+this.bounds.height+(i?i.top:0))),this.bounds.width,-this.bounds.height])[0]=f[0]+this._cropBoxValueX,f[1]=f[1]-this._cropBoxValueY,this._calculateRectangle(f),h.bounds={x:f[0],y:f[1],width:f[2],height:f[3]}}else f=[f[0],-f[1],f[2],-f[3]],h.bounds={x:f[0],y:f[1],width:f[2],height:f[3]};for(var w=this._obtainAppearanceBounds(),S=[f[0]-w[0],-f[1]-w[1],f[2]-w[2],-f[1]-w[1]-f[3]-w[3]],m=0;m<S.length;m++)S[m]<0&&(S[m]=-S[m]);this._dictionary.update("RD",S),this.opacity&&this._opacity<1&&(_.save(),_.setTransparency(this._opacity)),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&_.save(),this._drawFreeTextRectangle(_,h,f,d),c&&this._drawFreeMarkUpText(_,h,f,c,d),this.opacity&&this._opacity<1&&_.restore(),this.rotationAngle&&this._rotate!==t.PdfRotationAngle.angle0&&_.restore()}var x=this._obtainAppearanceBounds();return this.flatten&&(this._bounds={x:x[0]-(i?i.left:0),y:this._page.size.height-(x[1]+x[3])-(i?i.top:0),width:x[2],height:x[3]}),this._dictionary.set("Rect",[x[0],x[1],x[0]+x[2],x[1]+x[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[r]<0&&(i[r]=-i[r]);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();if(this._parsedXMLData.length>0&&this._dictionary.has("RC")){var e=void 0;if(this._parsedXMLData.length>0&&this._parsedXMLData[0]&&(e=this._parsedXMLData[0]),e instanceof xr){i=e;t.size=i.size,t.style=i.style,t.name=this._getFontFamily(i._fontFamily)}else if(e instanceof Pr){var i=e;t.size=i.size,t.style=i.style,t.name=i._fontFamily.toString()}}return Kt(t.name,t.size,t.style,this)},i.prototype._getFontFamily=function(e){switch(Math.floor(e)){case t.PdfFontFamily.helvetica:return"Helvetica";case t.PdfFontFamily.courier:return"Courier";case t.PdfFontFamily.timesRoman:return"TimesRoman";case t.PdfFontFamily.symbol:return"Symbol";case t.PdfFontFamily.zapfDingbats:return"ZapfDingbats";default:return"Helvetica"}},i.prototype._updateStyle=function(e,i,r){var n;i&&(n=[i.r,i.g,i.b]);var s=e._metrics._name.includes("Times")?"Times":e._metrics._name,a="font:"+s+" "+e.size+"pt;style:"+Ft(e.style)+";color:"+this._colorToHex(n);this._dictionary.update("DS",a);var o,h,c='<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" style="font:'+s+" "+e.size+"pt;font-weight:"+(e.isBold?"bold":"normal")+";color:"+this._colorToHex(n)+'"><p dir="ltr">';if(null!==r&&void 0!==r){switch(r){case t.PdfTextAlignment.left:h="left";break;case t.PdfTextAlignment.center:h="center";break;case t.PdfTextAlignment.right:h="right";break;case t.PdfTextAlignment.justify:h="justify"}h&&(o="text-align:"+h+";")}var _,d="",u="font-style:italic",l="font-style:bold";e.isUnderline?(d=e.isStrikeout?"text-decoration:word line-through":"text-decoration:word",e.isItalic?d+=";"+u:e.isBold&&(d+=";"+l)):e.isStrikeout?(d="text-decoration:line-through",e.isItalic?d+=";"+u:e.isBold&&(d+=";"+l)):e.isItalic?d+=u:e.isBold&&(d+=l),_=""!==d?'<span style = "'+o+d+'">'+(this.text?this._getXmlFormattedString(this.text):"")+"</span>":'<span style = "'+o+'">'+(this.text?this._getXmlFormattedString(this.text):"")+"</span>",this._dictionary.update("RC",c+_+"</p></body>")},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[2]+r[0]),-r[1],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 Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),_=this._font.measureString(n,{width:0,height:0},c,0,0);o>0&&o<=91?e.translateTransform({x:_.height,y:-h.height}):o>91&&o<=181?e.translateTransform({x:h.width-_.height,y:-(h.height-_.height)}):o>181&&o<=271?e.translateTransform({x:h.width-_.height,y:-_.height}):o>271&&o<360&&e.translateTransform({x:_.height,y:-_.height}),e.rotateTransform(o),i.bounds={x:0,y:0,width:i.bounds.width,height:i.bounds.height}}r[0],r[1],r[2],r[3];if(this._paddings&&!this._isLoaded){var d=this._paddings._left,u=this._paddings._top,l=this._paddings._right+this._paddings._left,f=this._paddings._top+this._paddings._bottom;if(i.borderWidth>0){r=[p=r[0]+(i.borderWidth+d),g=r[1]+(i.borderWidth+u),y=r[2]-(2*i.borderWidth+l),r[3]>0?r[3]-(2*i.borderWidth+f):-r[3]-(2*i.borderWidth+f)]}else{var p=r[0]+d,g=r[1]+u,y=r[2]-l;r=[p,g,y,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]);this._drawFreeTextAnnotation(e,i,n,this._font,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[s]<0&&(r[s]=-r[s]);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={x:r[1]+r[3],y:-r[0],width:-r[3],height:-r[2]}):(e.rotateTransform(-180),i.bounds={x:-(r[2]+r[0]),y:-(r[3]+r[1]),width:r[2],height:r[3]}):(e.rotateTransform(-90),i.bounds={x:-r[1],y:r[2]+r[0],width:-r[3],height:-r[2]}),i.borderWidth>0&&!this._isAllRotation&&(r=[i.bounds.x,i.bounds.y,i.bounds.width,i.bounds.height]),this._drawFreeTextAnnotation(e,i,"",this._font,r,!1,n,!1)},i.prototype._drawAppearance=function(t,e,i){var r=new Ir;if(r.addRectangle({x:i[0],y:i[1],width:i[2],height: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 Ei;c.lineAlignment=t.PdfVerticalAlignment.top,c.alignment=o,c.lineSpacing=0,c.lineLimit=!1,h?e.drawString(r,n,i.bounds,i.backBrush,c):e.drawString(r,n,{x:s[0],y:s[1],width:s[2],height:s[3]},i.backBrush,c)}else e.drawRectangle({x:s[0],y:s[1],width:s[2],height: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={x:t[e],y:this._page.size.height-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 Ir,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push({x:0,y:0});if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[s]={x:this._calloutsClone[s][0],y:this._calloutsClone[s][1]}}r.length>0&&(this.lineEndingStyle!==t.PdfLineEndingStyle.none&&this._expandAppearance(r),i._addLines(r)),e=i._getBounds();var a=void 0;this._page&&this._page._pageSettings&&this._page._pageSettings.margins&&(a=this._page._pageSettings.margins),this._page&&this._page._isNew?i.addRectangle({x:this.bounds.x+this._cropBoxValueX+a.left-2,y:this._page.size.height+this._cropBoxValueY-(this.bounds.y+this.bounds.height+a.top)-2,width:this.bounds.width+4,height:this.bounds.height+4}):i.addRectangle({x:this.bounds.x+this._cropBoxValueX-2,y:this._page.size.height+this._cropBoxValueY-(this.bounds.y+this.bounds.height)-2,width:this.bounds.width+4,height:this.bounds.height+4}),e=i._getBounds()}else if(this._page)if(this._page._isNew){var o=this._page._pageSettings.margins;e=[this.bounds.x+o.left,this._page.size.height-(this.bounds.y+this.bounds.height+o.top),this.bounds.width,this.bounds.height]}else e=[this.bounds.x+this._cropBoxValueX,this._page.size.height+this._cropBoxValueY-(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,e=void 0;this._page&&this._page._pageSettings&&this._page._pageSettings.margins&&(e=this._page._pageSettings.margins),this._calloutsClone=[];for(var i=0;i<this._calloutLines.length;i++)this._calloutsClone.push([this._calloutLines[i].x+(e?e.left:0)+this._cropBoxValueX,t.height+this._cropBoxValueY-(this._calloutLines[i].y+(e?e.top:0))])}},i.prototype._obtainLinePoints=function(){var t=this._page.size.height;return[this.calloutLines[1].x+this._cropBoxValueX,t+this._cropBoxValueY-this.calloutLines[1].y,this.calloutLines[0].x+this._cropBoxValueX,t+this._cropBoxValueY-this.calloutLines[0].y]},i.prototype._obtainLineEndingStyle=function(){var t;if(this._dictionary.has("LE")){var e=this._dictionary.get("LE");e instanceof vs&&(e=e.name),t=J(e)}return t},i.prototype._obtainText=function(){var t="",e=this._dictionary.has("Contents");if(e){var i=this._dictionary.get("Contents");return i&&(t=i),t&&""!==t&&(this._text=t),t}return this._dictionary.has("RC")&&!e&&null===t?t=this._rcText:t},i.prototype._obtainTextAlignment=function(){var e,i=t.PdfTextAlignment.left;if(this._dictionary.has("Q"))void 0!==(n=this._dictionary.get("Q"))&&(i=n,e=!0);else if(this._dictionary.has("RC")&&this._parsedXMLData.length>0&&this._parsedXMLData[1]){var r=this._parsedXMLData[1];i=r,e=!0}if(!e&&this._dictionary.has("DS")){var n=this._dictionary.get("DS");n.split(";").forEach(function(e){if(-1!==e.indexOf("text-align"))switch(e){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={r:e[0],g:e[1],b:e[2]}:"string"==typeof e&&(this._da=new Kr(e),t=this._da.color)}else if(this._dictionary.has("MK")){var i=this._mkDictionary;i&&i.has("BC")&&(t=q(i.getArray("BC")))}else t={r:0,g:0,b:0};else t=this._borderColor?this._borderColor:{r:0,g:0,b:0};return t},i.prototype._expandAppearance=function(e){var i=e[0].y,r=e[0].x;this._isLoaded||(i=this._page.size.height-i),i>this.bounds.y?this.lineEndingStyle!==t.PdfLineEndingStyle.openArrow&&(e[0].y-=11*this.border.width):e[0].y+=11*this.border.width,r<=this.bounds.x?e[0].x-=11*this.border.width:e[0].x+=11*this.border.width},i.prototype._drawCallOuts=function(t,e){for(var i=new Ir,r=[],n=2===this._calloutLines.length?2:3,s=0;s<n;s++)r.push({x:0,y:0});if(this._calloutLines.length>=2){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)r[s]={x:this._calloutsClone[s][0],y:-this._calloutsClone[s][1]}}r.length>0&&i._addLines(r),t.drawPath(i,e)},i.prototype._saveFreeTextDictionary=function(){if((void 0===this.font||null===this.font||!this._isLoaded&&1===this.font.size)&&(this.font=this._markUpFont),"string"==typeof this.text&&null!==this.text&&this._dictionary.update("Contents",this.text),this._isLoaded&&(this._textAlignment=this.textAlignment),this._dictionary.update("Q",this._textAlignment),void 0!==this.subject&&"null"!==this.subject||this.annotationIntent!==t.PdfAnnotationIntent.none||this._calloutLines&&(!this._calloutLines||0!==this._calloutLines.length)?(this._calloutLines&&this._calloutLines.length>=2&&this.annotationIntent===t.PdfAnnotationIntent.none&&(this._annotationIntent=t.PdfAnnotationIntent.freeTextCallout),this._dictionary.update("IT",vs.get(this._obtainAnnotationIntent(this._annotationIntent)))):this._dictionary.update("Subj","Text Box"),this._updateStyle(this.font,this.textMarkUpColor,this._textAlignment),this._dictionary.update("DA",this._getBorderColorString(this.borderColor?this._borderColor:{r:0,g:0,b:0})),this._calloutLines&&this._calloutLines.length>=2){for(var e=this._page.size.height,i=[],r=0;r<this._calloutLines.length&&r<3;r++)i.push(this._calloutLines[r].x+this._cropBoxValueX),i.push(e+this._cropBoxValueY-this._calloutLines[r].y);this._dictionary.update("CL",i)}if(this._setAppearance){var n=this._obtainAppearanceBounds();this._dictionary.update("Rect",[n[0],n[1],n[0]+n[2],n[1]+n[3]])}},i.prototype._getXmlFormattedString=function(t){return t=t.replace("&","&"),t=t.replace("<","<"),t=t.replace(">",">")},i.prototype._parseMarkupLanguageData=function(e){var i,r=this,n=t.PdfFontStyle.regular,s=[],a=e;if(!(this._dictionary.has("Contents")?this._dictionary.get("Contents"):"").split("").some(function(t){return r._isSymbol(t)})&&null!==a&&void 0!==a){var o=(i=(new DOMParser).parseFromString(a,"text/xml")).documentElement,h=o&&o.namespaceURI||"";if(o){var c=this._collectStyles(o),_=void 0;if(c.size>0){_=this._extractStylesToInput(c);var d=this._getFontDetails(_,this.font.size,this.textAlignment,n,null),u=this._updateFontProperties(d,"",n,null),l=u.fontName,f=u.fontStyle,p=u.brush,g=Kt(l,this.font._size,f,this);s=this._fontCollection(s,g,h,this._textAlignment,p)}else 0===c.size&&this._dictionary.has("DS")&&(_=this._dictionary.get("DS").split(";")||[]);n=this.font.style;var y=this._getFontDetails(_,this.font.size,this.textAlignment,n,null),m=this._updateFontProperties(y,"",n,null),b=m.fontName,v=m.fontStyle,w=m.brush,S=Kt(b,this.font._size,v,this);this._font=S,s=this._fontCollection(s,S,h,this._textAlignment,w)}}return this._parsedXMLData=s,s},i.prototype._collectStyles=function(t,e){if(void 0===e&&(e=new Map),!t)return e;var i=t.tagName.toLowerCase(),r=t.getAttribute("style");if(r){var n=r.split(";").map(function(t){return t.trim()}).filter(Boolean);e.set(i,n)}for(var s=t.firstElementChild;s;)this._collectStyles(s,e),s=s.nextElementSibling;return e},i.prototype._extractStylesToInput=function(t){var e=[];return t.forEach(function(t){e.push.apply(e,t)}),e},i.prototype._isSymbol=function(t){var e=t.charCodeAt(0);return"_"!==t&&"+"!==t&&"-"!==t&&"*"!==t&&"="!==t&&(e>=8352&&e<=8399||e>=8704&&e<=8959||e>=10752&&e<=11007||e>=8448&&e<=8527||e>=8960&&e<=9215||11088===e)},i.prototype._updateFontProperties=function(t,e,i,r){var n,s,a=this;return t.forEach(function(t,o){switch(o){case"font-family":e=t;break;case"font-size":a.font._size=parseFloat(t);break;case"font-style":case"font-weight":case"text-decoration":n=parseFloat(t),s=a._getStyles(n),i=a._maxStyle(i,s);break;case"text-align":a._textAlignment=a._parseTextAlignment(t);break;case"color":r=t;break;case"xfa-spacerun":a._rcText=t}}),{fontName:e,fontStyle:i,brush:r}},i.prototype._getStyles=function(e){var i=e&(t.PdfFontStyle.bold|t.PdfFontStyle.italic|t.PdfFontStyle.underline|t.PdfFontStyle.strikeout);return 0===i?t.PdfFontStyle.regular:i},i.prototype._maxStyle=function(t,e){return t>=e?t:e},i.prototype._parseTextAlignment=function(e){switch(parseFloat(e)){case 0:return t.PdfTextAlignment.left;case 1:return t.PdfTextAlignment.center;case 2:return t.PdfTextAlignment.right;case 3:return t.PdfTextAlignment.justify;default:return t.PdfTextAlignment.left}},i.prototype._getFontDetails=function(t,e,i,r,n){var s=this,a=new Map;return t.forEach(function(t){var o=t.split(":").map(function(t){return t.trim()}),h=o[0],c=o[1];if(h&&c)switch(h.toLowerCase()){case"font":s._parseFont(c,a);break;case"font-size":e=s._parseFontSize(c),a.set("font-size",e);break;case"font-weight":r=s._parseFontWeight(c,r),a.set("font-weight",r);break;case"font-family":a.set("font-family",s._parseFontFamily(c));break;case"color":n=new Qn(s._rgbStringToArray(c)),a.set("color",n);break;case"font-style":r=s._parseFontStyle(c,r),a.set("font-style",r);break;case"text-decoration":r=s._parseTextDecoration(c,r),a.set("text-decoration",r);break;case"text-align":i=s._parseTextAlign(c),a.set("text-align",i);break;case"xfa-spacerun":s._rcText=c.length>1&&c.includes("yes")?s._rcText+" ":s._rcText,a.set("xfa-spacerun",s._rcText)}}),a},i.prototype._parseFont=function(t,e){var i="";t.split(" ").map(function(t){return t.trim()}).forEach(function(t){t&&!t.endsWith("pt")?i+=t+" ":t.endsWith("pt")&&e.set("font-size",parseFloat(t.replace("pt","").replace(",",".").trim()))}),e.set("font-family",i.trim().replace(/['",]/g,""))},i.prototype._parseFontSize=function(t){return t.endsWith("pt")?parseFloat(t.replace("pt","").replace(",",".").trim()):0},i.prototype._parseFontWeight=function(e,i){return e.includes("bold")&&(i|=t.PdfFontStyle.bold),i},i.prototype._parseFontFamily=function(t){return t.replace(/^'+|'+$/g,"").trim()},i.prototype._parseFontStyle=function(e,i){return(e.includes("normal")||e.includes("regular"))&&(i|=t.PdfFontStyle.regular),e.includes("underline")&&(i|=t.PdfFontStyle.underline),e.includes("strikeout")&&(i|=t.PdfFontStyle.strikeout),e.includes("italic")&&(i|=t.PdfFontStyle.italic),e.includes("bold")&&(i|=t.PdfFontStyle.bold),i},i.prototype._parseTextDecoration=function(e,i){return(e.includes("word")||e.includes("underline"))&&(i|=t.PdfFontStyle.underline),e.includes("line-through")&&(i|=t.PdfFontStyle.strikeout),i},i.prototype._parseTextAlign=function(e){switch(e.trim().toLowerCase()){case"left":return t.PdfTextAlignment.left;case"right":return t.PdfTextAlignment.right;case"center":return t.PdfTextAlignment.center;case"justify":return t.PdfTextAlignment.justify;default:return t.PdfTextAlignment.left}},i.prototype._rgbStringToArray=function(t){var e=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(e)return{r:r=parseInt(e[1],10),g:n=parseInt(e[2],10),b:s=parseInt(e[3],10)};var i=t.match(/^#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);if(i){var r=parseInt(i[1],16),n=parseInt(i[2],16),s=parseInt(i[3],16);return{r:r,g:n,b:s}}throw new Error("Invalid RGB string format")},i.prototype._fontCollection=function(t,e,i,r,n){return t.concat([e,r,i,n])},i}($r),Sn=function(e){function i(i,r){var n=e.call(this)||this;return n._textAlignment=t.PdfTextAlignment.left,n._dictionary=new Ts,n._dictionary.update("Type",vs.get("Annot")),n._dictionary.update("Subtype",vs.get("Redact")),i&&(n.bounds=i,r&&(_e(r.borderColor)&&(n.borderColor=r.borderColor),_e(r.repeatText)&&(n.repeatText=r.repeatText),_e(r.overlayText)&&(n.overlayText=r.overlayText),r.font&&(n.font=r.font),_e(r.textColor)&&(n.textColor=r.textColor),_e(r.appearanceFillColor)&&(n.appearanceFillColor=r.appearanceFillColor),_e(r.innerColor)&&(n.innerColor=r.innerColor),_e(r.textAlignment)&&(n.textAlignment=r.textAlignment),_e(r.text)&&(n.text=r.text),_e(r.author)&&(n.author=r.author),_e(r.subject)&&(n.subject=r.subject),_e(r.opacity)&&(n.opacity=r.opacity),_e(r.boundsCollection)&&Array.isArray(r.boundsCollection)&&r.boundsCollection.length>0&&(n.boundsCollection=r.boundsCollection))),n._type=t._PdfAnnotationType.redactionAnnotation,n}return Qr(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){void 0!==t&&null!==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=q(this._dictionary.getArray("C"))),this._textColor},set:function(t){if(t){var e=this.textColor;this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._textColor=t,this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/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=q(this._dictionary.getArray("OC"))),this._borderColor},set:function(t){if(t){var e=this.borderColor;this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._borderColor=t,this._dictionary.update("OC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/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||(this._font=this._obtainFont()),this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"appearanceFillColor",{get:function(){if((null===this._appearanceFillColor||void 0===this._appearanceFillColor)&&this._dictionary.has("AFC")){var t=this._dictionary.getArray("AFC");t&&(this._appearanceFillColor=q(t))}return this._appearanceFillColor},set:function(t){if(t){var e=this.appearanceFillColor;this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._appearanceFillColor=t,this._dictionary.update("AFC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]))}},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=this._getMediaOrCropBox(this._page),r=i&&i.length>0?i[0]:0,n=i&&i.length>1?i[1]:0,s=e.length/8,a=0;a<s;a++){var o=e[4+8*a]-e[8*a],h=e[5+8*a]-e[1+8*a],c=Math.sqrt(o*o+h*h);o=e[6+8*a]-e[4+8*a],h=e[7+8*a]-e[5+8*a];var _=Math.sqrt(o*o+h*h),d={x:e[8*a]-r,y:this._page.size.height-e[1+8*a]-n,width:_,height:c};t.push(d)}}return t}return this._boundsCollection},set:function(t){var e;if(this._isLoaded||void 0===t||(t.length>0?(this._quadPoints=new Array(8*t.length),(e=this._boundsCollection).push.apply(e,t)):(this._quadPoints=new Array(8),this._boundsCollection=t),this._isChanged=!0),this._isLoaded&&void 0!==t){var i=!1;if(this.boundsCollection.length===t.length)for(a=0;a<t.length;a++){var r=t[a],n=this.boundsCollection[a];if(r.x!==n.x||r.y!==n.y||r.width!==n.width||r.height!==n.height){i=!0;break}}else i=!0;if(i){this._quadPoints=new Array(8*t.length);for(var s=this._page.size.height,a=0;a<t.length;a++){var o=t[a],h=8*a;this._quadPoints[h+0]=o.x,this._quadPoints[h+1]=s-o.y,this._quadPoints[h+2]=o.x+o.width,this._quadPoints[h+3]=s-o.y,this._quadPoints[h+4]=o.x,this._quadPoints[h+5]=this._quadPoints[h+1]-o.height,this._quadPoints[h+6]=o.x+o.width,this._quadPoints[h+7]=this._quadPoints[h+5]}this._dictionary.update("QuadPoints",this._quadPoints),this._isChanged=!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(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 Ts(this._crossReference);i.set("Type",vs.get("Border")),this._dictionary.set("BS",i)}void 0===e&&(e=1),this._isChanged&&this._setQuadPoints(this._page.size),(this._setAppearance||this._customTemplate.size>0)&&(this._appearanceTemplate=this._createRedactionAppearance(t)),this._dictionary.update("Rect",te(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 Mi(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)}else t&&this._page.annotations.remove(this)}},i.prototype._createRedactionAppearance=function(t){var e=this._createNormalAppearance();if(t)this._isLoaded&&null!==this._page&&this._page.annotations.remove(this);else{var i=this._createBorderAppearance();if(this._dictionary.has("AP")){var r=this._dictionary.get("AP");r&&r instanceof Ts&&(Nt(r,this._crossReference,"N"),Nt(r,this._crossReference,"R"))}var n=void 0;if(this._dictionary.has("AP"))n=this._dictionary.get("AP");else{a=this._crossReference._getNextReference();n=new Ts(this._crossReference),this._crossReference._cacheMap.set(a,n),this._dictionary.update("AP",a)}if(this._customTemplate.size>0)e=this._customTemplate.get("R"),this._drawCustomAppearance(n);else{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}}return e},i.prototype._createBorderAppearance=function(){var t;if(this.boundsCollection.length>1){for(var e=new Ir,i=0,r=this.boundsCollection;i<r.length;i++){l=r[i];e.addRectangle(l)}var n=e._getBounds();t={x:n[0],y:n[1],width:n[2],height:n[3]},this.bounds=t}else{var s=this.boundsCollection[0];t=s||this.bounds}var a,o,h=[0,0,this.bounds.width,this.bounds.height],c=new Mi(h,this._crossReference),_=c.graphics;this.border.width>0&&this.borderColor&&(a=new Zn(this.borderColor,this.border.width)),this.appearanceFillColor&&(o=new Qn(this.appearanceFillColor));for(var d=0,u=this.boundsCollection&&this.boundsCollection.length>0?this.boundsCollection:[{x:this.bounds.x,y:this.bounds.y,width:this.bounds.width,height:this.bounds.height}];d<u.length;d++){var l=u[d];if(this.opacity<1){var f=_.save();_.setTransparency(this.opacity),_.drawRectangle({x:l.x-t.x,y:l.y-t.y,width:l.width,height:l.height},a,o),_.restore(f)}else _.drawRectangle({x:l.x-t.x,y:l.y-t.y,width:l.width,height:l.height},a,o)}return c},i.prototype._drawText=function(t,e){if(this.overlayText){this.font||(this.font=this._lineCaptionFont),this._isLoaded&&(this._textAlignment=this.textAlignment);var i=new Qn(this.textColor?this.textColor:{r:128,g:128,b:128}),r=this.boundsCollection&&this.boundsCollection.length>0?this.boundsCollection:[{x:this.bounds.x,y:this.bounds.y,width:this.bounds.width,height:this.bounds.height}],n=[];this.overlayText.trim().split(/\s+/).forEach(function(t){t.length>0&&n.push(t)});for(var s=0,a=0,o=r;a<o.length;a++){var h=o[a],c=h.x-e.x,_=h.y-e.y,d=h.width,u=h.height;if(s=this._drawWrappedTextAligned(t,c,_,d,u,n,s,this._textAlignment,i,this.repeatText),!this.repeatText&&s>=n.length)break}}},i.prototype._drawWrappedTextAligned=function(e,i,r,n,s,a,o,h,c,_){for(var d=this._getLineHeight(),u=new Ei(0,t.PdfVerticalAlignment.top),l=1===a.length,f=this._getSpaceWidth(),p=r,g=o;p+d<=r+s;){for(var y=[],m="",b=0;;){if(g>=a.length){if(!_)break;if(g=0,++b>1&&0===y.length)break}if(g>=a.length)break;var v=a[g],w=0===y.length?v:l?m+v:m+" "+v;if(!(this._measureText(w)<=n+.25)){if(0===y.length){var S=this._breakWordToFit(v,n,this._measureText.bind(this));S.text.length>0&&(y.push(S.text),m=S.text),S.remainder&&S.remainder.length>0?a[g]=S.remainder:g++}break}y.push(v),m=w,g++}if(0===y.length)break;var x=!_&&g>=a.length;if(h===t.PdfTextAlignment.right){var P=this._measureText(m),A=i+Math.max(0,n-P);e.drawString(m,this.font,{x:A,y:p,width:P,height:d},null,c,u)}else if(h===t.PdfTextAlignment.center){var P=this._measureText(m),A=i+Math.max(0,(n-P)/2);e.drawString(m,this.font,{x:A,y:p,width:P,height:d},null,c,u)}else if(h===t.PdfTextAlignment.justify&&!x&&y.length>1&&!l){for(var T=0,C=0,k=y;C<k.length;C++){v=k[C];T+=this._measureText(v)}var R=n-T-(y.length-1)*f;R<0&&(R=0);for(var F=R/(y.length-1),A=i,I=0;I<y.length;I++){var v=y[I],D=this._measureText(v);e.drawString(v,this.font,{x:A,y:p,width:D,height:d},null,c,u),A+=D,I<y.length-1&&(A+=f+F)}}else e.drawString(m,this.font,{x:i,y:p,width:Math.min(this._measureText(m),n),height:d},null,c,u);p+=d}return g},i.prototype._breakWordToFit=function(t,e,i){if(!t)return{text:"",remainder:null};for(var r=1,n=t.length,s=0;r<=n;){var a=r+n>>1;i(t.slice(0,a))<=e?(s=a,r=a+1):n=a-1}return{text:t.slice(0,s),remainder:s<t.length?t.slice(s):null}},i.prototype._measureText=function(t){return this.font.measureString(t,{width:0,height:0}).width},i.prototype._getSpaceWidth=function(){return this._measureText(" ")},i.prototype._getLineHeight=function(){return this.font._getHeight()},i.prototype._createNormalAppearance=function(e,i,r){var n,s=new Ir,a=!1;if(i)n=i,s.addRectangle(n),a="number"==typeof e&&e>=0;else if("number"==typeof e&&e>=0&&e<this.boundsCollection.length)n=this.boundsCollection[e],s.addRectangle(n),a=!0;else for(var o=0,h=this.boundsCollection;o<h.length;o++){var c=h[o];s.addRectangle(c)}var _=s._getBounds();0===_[2]&&0===_[3]&&(_[0]=i?i.x:this.bounds.x,_[1]=i?i.y:this.bounds.y,_[2]=i?i.width:this.bounds.width,_[3]=i?i.height:this.bounds.height);var d={x:_[0],y:_[1],width:_[2],height:_[3]};this.bounds=d;var u,l,f=[0,0,d.width,d.height],p=new Mi(f,this._crossReference),g=p.graphics,y=this.border.width/2,m=this.border.width;this.borderColor&&this.border.width>0&&(u=new Zn(this.borderColor,this.border.width)),this.innerColor&&(l=new Qn(this.innerColor));var b,v=this.opacity<1;if(v&&(b=g.save(),g.setTransparency(this.opacity)),this.boundsCollection&&this.boundsCollection.length>0)if(a&&n)g.drawRectangle({x:n.x-d.x,y:n.y-d.y,width:n.width,height:n.height},u,l);else for(var w=0,S=this.boundsCollection;w<S.length;w++){var x=S[w];g.drawRectangle({x:x.x-d.x,y:x.y-d.y,width:x.width,height:x.height},u,l)}else g.drawRectangle({x:f[0]+y,y:f[1]+y,width:f[2]-m,height:f[3]-m},u,l);if(v&&b&&g.restore(b),this.overlayText){var P=g.save(),A=f[2],T=f[3];switch(r){case t.PdfRotationAngle.angle90:g.rotateTransform(90),g.translateTransform({x:0,y:-A});break;case t.PdfRotationAngle.angle180:g.rotateTransform(180),g.translateTransform({x:-A,y:-T});break;case t.PdfRotationAngle.angle270:g.rotateTransform(270),g.translateTransform({x:-T,y:0});break;case t.PdfRotationAngle.angle0:}var C=d;void 0===r||null===r||r!==t.PdfRotationAngle.angle90&&r!==t.PdfRotationAngle.angle270||(C.width=d.height,C.height=d.width),this._drawText(g,C),g.restore(P)}return p},i}($r),xn=function(e){function i(){var i=e.call(this)||this;return i._type=t._PdfAnnotationType.richMediaAnnotation,i}return Qr(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 Mi(e,this._crossReference),s=this._validateTemplateMatrix(n._content.dictionary);this._flattenAnnotationTemplate(n,s)}else this._removeAnnotation(this._page,this)}},i}(Zr),Pn=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._isTransparentBorderColor=!1,i._isWidget=!0,i._type=t._PdfAnnotationType.widgetAnnotation,i}return Qr(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 Kr(""),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,"_hasBorderColor",{get:function(){if(this._isLoaded){var t=this._mkDictionary;return t&&t.has("BC")}return!this._isTransparentBorderColor},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"borderColor",{get:function(){return this._parseBorderColor()},set:function(t){this._updateBorderColor(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 Ts(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=Y(t.name)}return this._highlightMode},set:function(t){this._highlightMode!==t&&this._dictionary.update("H",Q(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._isLoaded&&void 0===this._bounds&&(this._bounds=L(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",te(this)):this._dictionary.update("Rect",E([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)Et(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(){var e=this;if(!this._pdfFont){var i=void 0;if(this._crossReference){var r=this._crossReference._document.form,n=this._obtainFontDetails(),s=n.name+"_"+n.size+"_"+n.style;if(r&&r._fontCache.has(s))return r._fontCache.get(s);if(r&&r._dictionary.has("DR")){var a=r._dictionary.get("DR");if(a.has("Font")){var o=a.get("Font");if(o.has(n.name)){var h=o.get(n.name);if(h&&n.name&&h.has("BaseFont")){var c=h.get("BaseFont"),_=t.PdfFontStyle.regular;c&&(i=c.name,_=Gt(c.name),i.includes("-")&&(i=i.substring(0,i.indexOf("-"))),this._dictionary.has("DA")?this._pdfFont=Ut(r,this):this._pdfFont=Kt(i,n.size,_,this),r._fontCache.has(s)||r._fontCache.set(s,this._pdfFont))}}}}null!==r&&void 0!==r&&(null===this._pdfFont||void 0===this._pdfFont)&&r._parsedFields&&r._parsedFields.size>0&&(r._parsedFields.forEach(function(t){t instanceof jr&&t._kidsCount>0&&(e._pdfFont=Ut(r,e,t))}),r._fontCache.has(s)||r._fontCache.set(s,this._pdfFont))}}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 Sr&&(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 Kr(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 Ts(this._crossReference),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary._currentObj=this,this._dictionary.objId=this._ref.toString(),this._dictionary.update("Type",vs.get("Annot")),this._dictionary.update("Subtype",vs.get("Widget")),this.flags|=t.PdfAnnotationFlag.print,this._dictionary.update("P",e._ref),e._addWidget(this._ref),this.border=new In,i&&(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 Mi(r,this._crossReference),o=this._getPage();if(o){var h=o.graphics;h.save(),o.rotation===t.PdfRotationAngle.angle90?(h.translateTransform({x:h._size.width,y:h._size.height}),h.rotateTransform(90)):o.rotation===t.PdfRotationAngle.angle180?(h.translateTransform({x:h._size.width,y:h._size.height}),h.rotateTransform(-180)):o.rotation===t.PdfRotationAngle.angle270&&(h.translateTransform({x:h._size.width,y:h._size.height}),h.rotateTransform(270)),s={x:this.bounds.x,y:this.bounds.y,width:a._size.width,height:a._size.height},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 Ts(this._crossReference),this._crossReference._cacheMap.set(_,c),this._dictionary.update("AP",_)}Nt(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 Ts(this._crossReference));var r=void 0,n=!1;if(i.has("Font")){var s=i.getRaw("Font");s&&s instanceof Ss?(n=!0,r=this._crossReference._fetch(s)):s instanceof Ts&&(r=s)}r||(r=new Ts(this._crossReference),i.update("Font",r));var a=vs.get(it()),o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,this._pdfFont._dictionary),t instanceof Ar?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 Kr;h.fontName=this._fontName,h.fontSize=this._pdfFont._size,h.color=this.color?this.color:{r:0,g:0,b: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=ht(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",E([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=q(i))}}void 0!==this._backColor&&null!==this._backColor||(this._backColor={r:255,g:255,b:255}),t=this._backColor}return t},i.prototype._parseBorderColor=function(){var t;if(this._isLoaded&&this._hasBorderColor||!this._isLoaded&&!this._isTransparentBorderColor){if(void 0===this._borderColor){var e=this._mkDictionary;if(e&&e.has("BC")){var i=e.getArray("BC");i&&(this._borderColor=q(i))}}void 0!==this._borderColor&&null!==this._borderColor||(this._borderColor={r:0,g:0,b:0}),t=this._borderColor}return t},i.prototype._updateBackColor=function(t,e){void 0===e&&(e=!1);var i=!1;if(t&&t.isTransparent){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;var n=void 0;n&&(n={r:this._backColor.r,g:this._backColor.g,b:this._backColor.b}),void 0!==this.backColor&&n===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new Ts(this._crossReference)),this._mkDictionary.update("BG",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._backColor=t,this._dictionary._updated=!0,i=!0)}e&&i&&this._field&&(this._field._setAppearance=!0)},i.prototype._updateBorderColor=function(t){if(t&&t.isTransparent){this._isTransparentBorderColor=!0,this._dictionary.has("BC")&&delete this._dictionary._map.BC;var e=this._mkDictionary;if(e&&e.has("BC")){if(delete e._map.BC,this._dictionary.has("BS")){var i=this._dictionary.get("BS");i&&i.has("W")&&delete i._map.W}this._dictionary._updated=!0}}else{this._isTransparentBorderColor=!1;var r=void 0;this.borderColor&&(r=this.borderColor),void 0!==this.borderColor&&r===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new Ts(this._crossReference)),this._mkDictionary.update("BC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._borderColor=t,this._dictionary._updated=!0)}},i}(Zr),An=function(e){function i(){var t=e.call(this)||this;return t._exportValue="Yes",t}return Qr(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 ct(this._dictionary)},set:function(t){this.checked!==t&&(this._field&&(this._setCheckedStatus(t),this._field._setAppearance=!0),this._exportValue?this._dictionary.update("AS",vs.get(t?this._exportValue:"Off")):this._field&&null!==this._field._exportValue&&void 0!==this._field._exportValue?this._dictionary.update("AS",vs.get(t?this._field._exportValue:"Off")):this._dictionary.update("AS",vs.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=yt(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 Ts(this._crossReference),this._dictionary.update("MK",e)),e.update("CA",gt(t))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"exportValue",{get:function(){return this._tryGetExportValue(this)},set:function(t){if(""!==t&&(this._exportValue=t),this.checked?(this._dictionary.update("AS",vs.get(t)),this._setCheckedStatus(this.checked)):this._dictionary.update("AS",vs.get("Off")),this._dictionary.has("AP")){var e=this._dictionary.get("AP");if(e.has("N")||e.has("D")){var i=this._tryGetExportValue(this),r=t;if(e.has("N")){var n=e.get("N");if(n&&n.has(i)){a=n.getRaw(i);delete n._map[i],n.update(r,a),n._updated=!0}}if(e.has("D")){var s=e.get("D");if(s&&s.has(i)){var a=s.getRaw(i);delete s._map[i],s.update(r,a),s._updated=!0}}}}this._dictionary._updated=!0},enumerable:!0,configurable:!0}),i.prototype._setCheckedStatus=function(t){var e=t,i=this._tryGetExportValue(this);if(this._unCheckOthers(this,i,t),e)i?this._exportValue=i:i="Yes",this._field._dictionary.update("V",vs.get(i)),this._field._dictionary.update("AS",vs.get(i)),this._dictionary.update("AS",vs.get(i)),this._dictionary.update("V",vs.get(i));else if(this._field._dictionary){if(this._field._dictionary.has("V")){var r=this._field._dictionary.get("V");r&&r.name===i&&delete this._field._dictionary._map.V}this._field._dictionary.update("AS",vs.get("Off"))}},i.prototype._unCheckOthers=function(t,e,i){if(!this._field._isUpdating){this._field._isUpdating=!0;for(var r=this._field.itemsCount,n=0;n<r;++n){var s=this._field.itemAt(n);if(s)if(s!==t){var a=this._tryGetExportValue(s);s.checked=a===e&&i}else s.checked||(s.checked=!0)}}},i.prototype._tryGetExportValue=function(t){var e=t._exportValue;if(t._dictionary&&t._dictionary.has("AP")){var i=t._dictionary.get("AP");if(i&&i.has("N")){var r=[];if(i.get("N").forEach(function(t,e){r.push(t)}),r.length>0)for(var n=0;n<r.length;n++){var s=r[n];if(s&&"Off"!==s){e=s;break}}}}else if(t._dictionary&&t._dictionary.has("AS")){var a=t._dictionary.get("AS");a&&"Off"!==a.name&&(e=a.name)}return e},i.prototype._doPostProcess=function(){var e=dt(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({x:r._size.width,y:r._size.height}),r.rotateTransform(90)):i.rotation===t.PdfRotationAngle.angle180?(r.translateTransform({x:r._size.width,y:r._size.height}),r.rotateTransform(-180)):i.rotation===t.PdfRotationAngle.angle270&&(r.translateTransform({x:r._size.width,y:r._size.height}),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",vs.get(t))},i.prototype._setField=function(e){this._field=e,this._field._stringFormat=new Ei(this.textAlignment,t.PdfVerticalAlignment.middle),this._field._addToKid(this)},i}(Pn),Tn=function(e){function i(t,i,r){var n=e.call(this)||this;return r&&t&&i&&(r instanceof Nr?n._initializeItem(t,i,r.page,r):n._initializeItem(t,i,r)),n}return Qr(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=_t(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 Ts(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){this._field&&(this.value===t||this._index.toString()===t?this._dictionary.update("AS",vs.get(t)):this._dictionary.update("AS",vs.get("Off")))},i}(An),Cn=function(t){function e(e,i,r){var n=t.call(this)||this;return e&&i&&n._initializeItem(e,i,r),n}return Qr(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 qr||this._field instanceof Wr)&&(this._text=this._field._options[this._index][1]),this._text},set:function(t){"string"==typeof t&&void 0!==this._field&&(this._field instanceof qr||this._field instanceof Wr)&&t!==this._field._options[this._index][1]&&(this._field._options[this._index][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 qr&&i._addToOptions(this,i)},e}(An),kn=function(){function e(e){e&&"cap"in e&&null!==e.cap&&"boolean"==typeof e.cap?this._cap=e.cap:this._cap=!1,e&&"type"in e&&null!==e.type&&void 0!==e.type?this._type=e.type:this._type=t.PdfLineCaptionType.inline,e&&"offset"in e&&null!==e.offset&&void 0!==e.offset?this._offset=e.offset:this._offset={x:0,y: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",vs.get(e===t.PdfLineCaptionType.top?"Top":"Inline")))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"offset",{get:function(){return this._offset},set:function(t){t&&!this._offset?(this._offset=t,this._dictionary.update("CO",[t.x,t.y])):t&&this._offset&&(t.x!==this._offset.x||t.y!==this._offset.y)&&(this._offset=t,this._dictionary&&this._dictionary.update("CO",[t.x,t.y]))},enumerable:!0,configurable:!0}),e}(),Rn=function(){function e(e){e&&"begin"in e&&null!==e.begin&&void 0!==e.begin?this._begin=e.begin:this._begin=t.PdfLineEndingStyle.none,e&&"end"in e&&null!==e.end&&void 0!==e.end?this._end=e.end:this._begin=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",[vs.get(X(t)),vs.get(X(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",[vs.get(X(this._begin)),vs.get(X(t))]))},enumerable:!0,configurable:!0}),e}(),Fn=function(){function e(e){e&&"width"in e&&null!==e.width&&void 0!==e.width?this._width=e.width:this._width=1,e&&"style"in e&&null!==e.style&&void 0!==e.style?this._style=e.style:this._style=t.PdfBorderStyle.solid,e&&"dash"in e&&null!==e.dash&&Array.isArray(e.dash)&&(this._dash=e.dash)}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 Ts(this._crossReference);e.update("Type",vs.get("Border")),e.update("W",this._width),e.update("S",G(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(e){if(e!==this._style&&(this._style=e,(Array.isArray(this._dash)&&0===this._dash.length||!this._dash)&&(e===t.PdfBorderStyle.dot?this._dash=[1,1]:e===t.PdfBorderStyle.dashed&&(this._dash=[3,1])),this._dictionary)){var i=this._dictionary.has("BS")?this._dictionary.get("BS"):new Ts(this._crossReference);i.update("Type",vs.get("Border")),i.update("W",this._width),i.update("S",G(this._style)),this._dash&&i.update("D",this._dash),this._dictionary.update("BS",i),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 Ts(this._crossReference);e.update("Type",vs.get("Border")),e.update("W",this._width),e.update("S",G(this._style)),e.update("D",this._dash),this._dictionary.update("BS",e),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),e}(),In=function(t){function e(e){var i=t.call(this,e)||this;return null!==e&&void 0!==e&&(e&&"hRadius"in e&&null!==e.hRadius&&void 0!==e.hRadius?i._hRadius=e.hRadius:i._hRadius=0,e&&"vRadius"in e&&null!==e.vRadius&&void 0!==e.vRadius?i._vRadius=e.vRadius:i._vRadius=0),i}return Qr(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 Ts(this._crossReference);e.update("Type",vs.get("Border")),e.update("W",this._width),e.update("S",G(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}(Fn),Dn=function(){function e(t){if(this._intensity=0,void 0!==t&&null!==t)if(t instanceof Ts){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"intensity"in t&&null!==t.intensity&&void 0!==t.intensity&&(this._intensity=t.intensity),"style"in t&&null!==t.style&&void 0!==t.style&&(this._style=t.style),this._dictionary=new Ts,this._dictionary.set("I",this._intensity),this._dictionary.set("S",this._styleToEffect(this._style));else this._dictionary=new Ts,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 Ts(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 Ts(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}(),Bn=function(){function t(){this.borderWidth=1}return t}(),Ln=function(){function t(){this.startAngle=0,this.endAngle=0}return t}(),On=function(){function t(t,e,i){this._isExport=!1,_e(t)?this._annotations=t:this._annotations=[],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[t];if(e&&e instanceof Ss&&(e=this._crossReference._fetch(e)),e&&e instanceof Ts){var i=this._parseAnnotation(e,t);i&&(i._ref=this._annotations[t],this._parsedAnnotations.set(t,i))}}return this._parsedAnnotations.get(t)},t.prototype.add=function(t){var i=this;if(e.initializeTelemetryFeature("Annotation","PDFLibrary"),void 0===t||null===t)throw Error("annotation cannot be null or undefined");if(t instanceof _n&&(t._isReview||t._isComment)&&t.bounds&&(t.bounds.y=-t.bounds.y,t.bounds.height=-t.bounds.height),t._isLoaded)throw Error("cannot add an existing annotation");t._initialize(this._page);var r;void 0!==t._ref&&t._ref._isNew?r=t._ref:(r=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(r,t._dictionary),t._ref=r);var n=this._annotations.length;this._annotations.push(r),this._parsedAnnotations.set(n,t);var s=!1;if(this._page&&this._page._pageDictionary.has("Annots")){var a=this._page._pageDictionary.get("Annots");null!==a&&void 0!==a&&-1===a.indexOf(r)&&(a.push(r),this._page._pageDictionary.set("Annots",a),s=!0)}return s||this._page._pageDictionary.set("Annots",this._annotations),this._page._pageDictionary._updated=!0,t&&t instanceof $r&&this._addCommentsAndReview(t,t._dictionary.get("F")),this._updateCustomAppearanceResource(t),t._customTemplate&&t._customTemplate.size>0&&t._customTemplate.forEach(function(t,e){t._updatePendingResource(i._crossReference)}),n},t.prototype.remove=function(t){if(t&&t._ref){var e=this._annotations.lastIndexOf(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[t];if(e&&this._page){var i=this._page._getProperty("Annots"),r=void 0;if(this._parsedAnnotations.has(t))r=this._parsedAnnotations.get(t);else{var n=this._crossReference._fetch(e);(r=this._parseAnnotation(n))._ref=e}if(r){var s=r.comments,a=r.reviewHistory;if(this._processAnnotations(s,i),this._processAnnotations(a,i),r._dictionary&&r._dictionary.has("Popup")){var o=r._dictionary.getRaw("Popup"),h=o&&o instanceof Ss?i.indexOf(o):-1;h>-1&&i.splice(h,1)}}var c=i.indexOf(e);c>-1&&i.splice(c,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 _=this._page._crossReference;_&&_._cacheMap.has(e)&&_._cacheMap.delete(e)}},t.prototype._processReferences=function(t,e){var i=this;t.forEach(function(t){if(t&&-1!==e.indexOf(t)){var r=e.indexOf(t);e.splice(r,1);var n=i._annotations.indexOf(t);n>-1&&i._annotations.splice(n,1),i._parsedAnnotations.has(r)&&(i._parsedAnnotations.delete(r),i._reorderParsedAnnotations(r));var s=i._page._crossReference;s&&s._cacheMap.has(t)&&s._cacheMap.delete(t)}})},t.prototype._processAnnotations=function(t,e){var i=this;t&&t._collection.length>0&&t._collection.forEach(function(t){var r=[t._ref];t.reviewHistory&&t.reviewHistory._collection.length>0&&r.push.apply(r,t.reviewHistory._collection.map(function(t){return t._ref})),i._processReferences(r,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&&t instanceof bn&&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){var r=this;if(e&&e.count>0){if(30===i)throw new Error("Could not add comments/reviews to the review");e._collection.forEach(function(i,n){i&&!i._dictionary.has("IRT")&&(0!==n&&e._isReview?i._dictionary.update("IRT",e._collection[n-1]._ref):i._dictionary.update("IRT",t._ref),e._isReview?i._isReview=!0:i._isComment=!0,r.add(i))})}},t.prototype._getAnnotations=function(){if(0===this._parsedAnnotations.size)for(var t=0;t<this._annotations.length;t++){var e=this._annotations[t];if(e&&e instanceof Ss&&(e=this._crossReference._fetch(e)),e&&e instanceof Ts){var i=this._isPopupWithExternalParent(e),r=this._parseAnnotation(e,t);r?(r._ref=this._annotations[t],this._parsedAnnotations.set(t,r)):i&&t--}}},t.prototype._isPopupWithExternalParent=function(t){if(t&&t.has("Subtype")){var e=t.get("Subtype");if(e&&"Popup"===e.name&&t.has("Parent"))return!0}return!1},t.prototype._parseAnnotation=function(t,e){var i,r=!1;if(t&&t.has("Subtype")&&null!==this._page&&void 0!==this._page){var n=t.get("Subtype"),s=t.get("Rect");if(n){var a=void 0;switch(n.name){case"Line":i=tn._load(this._page,t);break;case"Circle":i=t.has("Measure")?en._load(this._page,t):s[2]-s[0]===s[3]-s[1]?en._load(this._page,t):rn._load(this._page,t);break;case"Square":i=s&&s.length>=4&&s[2]===s[3]?nn._load(this._page,t):sn._load(this._page,t);break;case"Polygon":i=an._load(this._page,t);break;case"PolyLine":t.has("Measure")&&t.has("IT")&&(o=t.get("IT"))&&"PolyLineAngle"===o.name&&(i=hn._load(this._page,t)),i||(i=on._load(this._page,t));break;case"Ink":i=cn._load(this._page,t);break;case"Popup":r=this._isPopupWithExternalParent(t),"number"==typeof e&&r?this._annotations.splice(e,1):i=_n._load(this._page,t);break;case"Text":i=_n._load(this._page,t);break;case"Link":if(t.has("A")&&(a=t.get("A")),a&&a.has("S")){var o=a.get("S").name;if(o){var h=this._hasValidBorder(t.getArray("Border"));"URI"===o?i=h?fn._load(this._page,t):this._getLinkAnnotation(t):"Launch"===o?i=dn._load(this._page,t):"GoToR"===o?i=this._getLinkAnnotation(t):"GoTo"===o&&(i=ln._load(this._page,t))}}else"Link"===n.name&&(i=ln._load(this._page,t));break;case"FileAttachment":i=pn._load(this._page,t);break;case"3D":i=gn._load(this._page,t);break;case"FreeText":i=wn._load(this._page,t);break;case"Redact":i=Sn._load(this._page,t);break;case"RichMedia":i=xn._load(this._page,t);break;case"Watermark":i=mn._load(this._page,t);break;case"Stamp":i=bn._load(this._page,t);break;case"Sound":i=vn._load(this._page,t);break;case"Caret":case"Highlight":case"Squiggly":case"StrikeOut":case"Underline":i=yn._load(this._page,t)}}}return i},t.prototype._getLinkAnnotation=function(t){var e;if(this._page)if(t&&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=dn._load(this._page,t):r&&"URI"===r.name&&(e=un._load(this._page,t))}}else e=un._load(this._page,t);return e},t.prototype._hasValidBorder=function(t){return void 0!==t&&null!==t&&!t.some(function(t){return void 0!==t&&null!==t&&t>0})},t.prototype._doPostProcess=function(t){for(var e=0;e<this.count;){var i=this.at(e);if(i){var r=i.flatten||t;r&&!i.flatten&&(i.flatten=r),i._isExport=this._isExport,r&&-1===this._annotations.lastIndexOf(i._ref)&&e++,i._doPostProcess(r),r||e++}else e++}},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[i]);if(r&&r.has("Parent")){var n=r.getRaw("Parent");if(n&&n===t||t===this._annotations[i]){var s=this._annotations[i];this._annotations[i]=this._annotations[e],this._annotations[e]=s}}}return this._annotations},t.prototype._clear=function(){this._annotations=[],this._parsedAnnotations=new Map,this._comments=[]},t}(),Mn=function(){function e(t,e){this._collection=[],t&&(this._annotation=t),this._isReview=e,(t&&this._annotation._isLoaded||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[t]},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[i-1]._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[t];if(this._isReview&&t<this._collection.length-1){var i=this._collection[t+1],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,e=this;this._page&&(t=this._page.annotations);var i=new Map;if(i.set(this._annotation._ref,this._annotation),t&&t._comments&&t._comments.length>0){var r=[];t._comments.forEach(function(t){var n=t._dictionary._get("IRT");t._isReview&&n&&i.has(n)?(e._collection.push(t),i.set(t._ref,t)):r.push(t)}),r.length>0?t._comments=r:t._comments=[]}else if(t)for(var n=t.count,s=0;s<n;s++){var a=t.at(s);if(a&&a instanceof _n){var o=a._dictionary;if(a._dictionary.has("IRT")){var h=o._get("IRT");a._isReview&&h&&i.has(h)?(this._collection.push(a),i.set(a._ref,a)):t._comments.push(a)}}}i.clear()},e.prototype._parseComments=function(){var t,e=this;if(this._page&&(t=this._page.annotations),t&&t._comments&&t._comments.length>0){var i=[];t._comments.forEach(function(t){var r=t._dictionary,n=Ot(r),s=r._get("IRT");s&&s===e._annotation._ref&&!n?e._collection.push(t):i.push(t)}),i.length>0?t._comments=i:t._comments=[]}else if(t)for(var r=t.count,n=0;n<r;n++){var s=t.at(n);if(s&&s instanceof _n){var a=s._dictionary;if(s._dictionary.has("IRT")){var o=Ot(a),h=a._get("IRT");h&&h===this._annotation._ref&&!o?this._collection.push(s):t._comments.push(s)}}}},e}(),En=function(){function e(e){this._boundSet=!1,e?(this.break=e.break,this.layout=e.layout,this.paginateBounds=e.paginateBounds,this._boundSet=e._boundSet):(this.layout=t.PdfLayoutType.paginate,this.break=t.PdfLayoutBreakType.fitPage)}return Object.defineProperty(e.prototype,"layout",{get:function(){return this._layout},set:function(t){this._layout=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"break",{get:function(){return this._break},set:function(t){this._break=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paginateBounds",{get:function(){return this._paginateBounds},set:function(t){this._paginateBounds=t,this._boundSet=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usePaginateBounds",{get:function(){return this._boundSet},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(t){this._columns=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnGutter",{get:function(){return this._columnGutter},set:function(t){this._columnGutter=t},enumerable:!0,configurable:!0}),e}(),Nn=function(){function t(t,e,i,r){this._hasRenderedContent=!1,this._page=t,this._bounds=e,this._lastLineBounds=i||e,"undefined"!==r&&null!==r&&(this._remainingText=r)}return Object.defineProperty(t.prototype,"Page",{get:function(){return this._page},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bounds",{get:function(){return this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"remainingText",{get:function(){return this._remainingText},enumerable:!0,configurable:!0}),t}(),jn=function(){function t(){this.markerWrote=!1,this.markerWidth=0,this.markerX=0}return t}(),Vn=function(){function t(){}return t}(),zn=function(){function e(t,e,i,r){this._isAnnotationParsed=!1,this._isNew=!1,this._isDuplicate=!1,this._isLineAnnotation=!1,this._accessedBeforeTemplate=!1,this._templatesRendered=!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&&this._pageDictionary.has("Annots")){var t=this._getProperty("Annots");if(_e(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 On(i,this._crossReference,this)}else this._annotations=new On(t,this._crossReference,this)}}void 0===this._annotations&&(this._annotations=new On([],this._crossReference,this)),this._annotations._getAnnotations()}return this._annotations},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(void 0===this._size||void 0===this._size.width||void 0===this._size.height){var t=D(this._pageDictionary,"MediaBox",!1,!0),e=D(this._pageDictionary,"CropBox",!1,!0),i=0,r=0,n=this._pageDictionary&&this._pageDictionary.has("Rotate")?D(this._pageDictionary,"Rotate",!1,!0):0;if(e=this._parseBoxValues(e,"CropBox"),t=this._parseBoxValues(t,"MediaBox"),e&&null!==n&&void 0!==n){i=e[2]-e[0],r=e[3]-e[1];var s=!(t&&t[2]-t[0]<i);(0===n||180===n)&&i<r||(90===n||270===n)&&i>r||s||0!==n||!t||(i=t[2]-t[0],r=0!==t[3]?t[3]-t[1]:t[1])}else t?(i=t[2]-t[0],r=0!==t[3]?t[3]-t[1]:t[1]):(this._pageDictionary.update("MediaBox",[0,0,612,792]),i=612,r=792);this._size={width:Math.abs(i),height:Math.abs(r)}}return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){var e=0;return void 0===this._rotation&&((e=D(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",vs.get(i))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cropBox",{get:function(){return void 0===this._cBox&&(this._cBox=D(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=D(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.width>e.height?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._crossReference&&this._crossReference._document&&this._crossReference._document._hasTemplateContentValue&&!this._templatesRendered&&!this._crossReference._document._templateRenderingStarted&&(this._accessedBeforeTemplate=!0),this._g},enumerable:!0,configurable:!0}),e.prototype.drawTextElement=function(t,e){if(void 0===t||null===t)throw new Error("PdfTextElement cannot be null or undefined");if("string"!=typeof t.text||0===t.text.length)throw new Error("PdfTextElement.text must be a non-empty string");if(void 0===t.font||null===t.font)throw new Error("PdfTextElement.font is required");if(void 0!==t.layoutFormat&&null!==t.layoutFormat&&!(t.layoutFormat instanceof En))throw new Error("PdfTextElement.layoutFormat must be an instance of PdfLayoutFormat");var i=this.graphics._isRectangle(e)?{x:e.x,y:e.y,width:e.width,height:e.height}:{x:e.x,y:e.y,width:0,height:0},r=t.brush?t.brush:new Qn({r:0,g:0,b:0});if(t.layoutFormat||"number"==typeof i.width&&"number"==typeof i.height&&(i.width>0||i.height>0)){var n=new Vn,s=this._getActualBounds(this._pageSettings);if(i.y<0&&(i.y=0),0===i.height)i.height=s[3]-i.y;else{var a=s[3]-i.y;i.height>a&&(i.height=a)}return n._page=this,n._bounds=[i.x,i.y,i.width,i.height],n._format=t.layoutFormat?t.layoutFormat:new En,n._graphics=this.graphics,this._layoutTextElement(n,t)}return this.graphics.drawString(t.text,t.font,i,t.pen,r,t.stringFormat),new Nn(this,i)},e.prototype._addWidget=function(t){var e;if(this._pageDictionary.has("Annots")){var i=this._pageDictionary.getRaw("Annots");e=this._getProperty("Annots"),i&&i instanceof Ss&&(delete this._pageDictionary._map.Annots,this._pageDictionary.update("Annots",e))}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=D(this._pageDictionary,t,e,!1);return Array.isArray(i)?1!==i.length&&i[0]instanceof Ts?Ts.merge(this._crossReference,i):i[0]:i},e.prototype._parseGraphics=function(){this._loadContents();var t=new Is([32,113,32,10]),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._contents.splice(0,0,e);var i=new Is([32,81,32,10]),r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),this._contents.push(r);var n=new Is([]),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 Ss&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof Rs?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],u=c[2],l=c[3];(_<0||d<0||u<0||l<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(o.height))&&Math.floor(Math.abs(_))===Math.floor(Math.abs(o.width))?this._g=new Gn({width:Math.max(_,u),height:Math.max(d,l)},e,this._crossReference,this):(this._g=new Gn(o,e,this._crossReference,this),this._g._cropBox=c)}else this._g=new Gn(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.height))&&Math.floor(Math.abs(s))===Math.floor(Math.abs(o.width))){var f=Math.max(r,s),p=Math.max(n,a);(f<=0||p<=0)&&(i=!0,r<0&&(r=-r),n<0&&(n=-n),s<0&&(s=-s),a<0&&(a=-a),f=Math.max(r,s),p=Math.max(n,a)),this._g=new Gn({width:f,height:p},e,this._crossReference,this)}else this._g=new Gn(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({x:0,y:o.height}),this._g.rotateTransform(-90),this._g._clipBounds=[b[0],b[1],o.width,o.height]):180===m?(this._g.translateTransform({x:o.width,y:o.height}),this._g.rotateTransform(-180)):270===m&&(this._g.translateTransform({x:o.width,y:0}),this._g.rotateTransform(-270),this._g._clipBounds=[b[0],b[1],o.height,o.width])}}if(this._isNew&&this._pageSettings&&!this._isLineAnnotation){var v=this._getActualBounds(this._pageSettings);if(this._crossReference._document._hasTemplateContentValue){var w=[v[0],v[1],this._pageSettings.margins._left,this._pageSettings.margins._top,this._pageSettings.margins._right,this._pageSettings.margins._bottom];this._g._clipTranslateMarginsWithBounds(w)}else this._g._clipTranslateMargins(v)}this._needInitializeGraphics=!1},e.prototype._getActualBounds=function(t,e){var i=e?[t.size.width,t.size.height]:t._getActualSize(),r=this._getTemplateReservedSpace(e);return[t.margins.left+r[3],t.margins.top+r[0],i[0]-r[3]-r[1],i[1]-r[0]-r[2]]},e.prototype._getActualTemplateBounds=function(t,e){var i=t._getActualSize(),r=this._getTemplateReservedSpace(e);return[r[3],r[0],i[0]-r[3]-r[1],i[1]-r[0]-r[2]]},e.prototype._getTemplateReservedSpace=function(t){var e=!!t;return[this._crossReference._document._getTopIndentHeight(this,e),this._crossReference._document._getRightIndentWidth(this,e),this._crossReference._document._getBottomIndentHeight(this,e),this._crossReference._document._getLeftIndentWidth(this,e)]},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 Ss?(this._hasResourceReference=!0,this._resourceObject=this._crossReference._fetch(t)):t&&t instanceof Ts&&(this._resourceObject=t)}else this._resourceObject=new Ts(this._crossReference),this._pageDictionary.update("Resources",this._resourceObject);return this._resourceObject},e.prototype._getCropOrMediaBox=function(){var t;return this._pageDictionary&&(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&&this._pageDictionary.has("Tabs")){var e=this._pageDictionary.get("Tabs");e===vs.get("R")?this._tabOrder=t.PdfFormFieldsTabOrder.row:e===vs.get("C")?this._tabOrder=t.PdfFormFieldsTabOrder.column:e===vs.get("S")?this._tabOrder=t.PdfFormFieldsTabOrder.structure:e===vs.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&&this._pageDictionary.has("Annots")){var e=this._getProperty("Annots");_e(e)&&Array.isArray(e)&&(e=e.filter(function(e){return e!==t}),this._pageDictionary.set("Annots",e),this._pageDictionary._updated=!0)}},Object.defineProperty(e.prototype,"_contentTemplate",{get:function(){this._fetchResources();var t=this._combineContent(),e=new Is(Array.from(t)),i=new Mi(e,this._crossReference);return i._content.dictionary.set("Resources",this._resourceObject),this.cropBox[0]>0||this.cropBox[1]>0?(i._content.dictionary.set("BBox",this.cropBox),p(this.cropBox,this.mediaBox)?i._size={width:this.cropBox[0],height:this.cropBox[1]}:i._size={width:this.cropBox[2],height:this.cropBox[3]}):this.mediaBox[0]>0||this.mediaBox[1]>0?(i._content.dictionary.set("BBox",this.mediaBox),i._size={width:this.mediaBox[0],height:this.mediaBox[1]}):(i._content.dictionary.set("BBox",[0,0,this.size.width,this.size.height]),i._size={width:this.size.width,height:this.size.height}),i},enumerable:!0,configurable:!0}),e.prototype._combineIntoSingleArray=function(t){var e=t.reduce(function(t,e){return t+e.length},0),i=new Uint8Array(e),r=0;return t.forEach(function(t){i.set(t,r),r+=t.length}),i},e.prototype._combineContent=function(){var t,e=this,i=[];return this._loadContents(),i.push(new Uint8Array([32,113,32,10])),this._contents.forEach(function(r){var n=e._crossReference._fetch(r);n&&(n instanceof Is?t=new Uint8Array(n._bytes):n instanceof Rs&&(t=n.getBytes()),t&&(i.push(t),i.push(new Uint8Array([13,10]))))}),i.push(new Uint8Array([32,81,32,10])),i.push(new Uint8Array([13,10])),this._combineIntoSingleArray(i)},e.prototype._layoutTextElement=function(e,i){for(var r,n=e._format,s=i.text?i.text:"",a=e._page,o=e._bounds.slice(),h=n&&n.paginateBounds,c=n&&n.usePaginateBounds&&h,_=!0,d=!1;s.length>0;){var u=void 0;u=_?o.slice():c?[h.x,h.y,h.width,h.height]:[o[0],0,o[2],o[3]];var l=s;if(r=this._layoutOnPage(s,a,u,e,i),s=r.remainingText?r.remainingText:"",n.layout===t.PdfLayoutType.onePage&&n.break===t.PdfLayoutBreakType.fitElement)return r;if(n.break!==t.PdfLayoutBreakType.fitElement&&n.break!==t.PdfLayoutBreakType.fitPage||!_||s!==l){r._hasRenderedContent&&!_&&(d=!0);var f=n.break;if(n.layout===t.PdfLayoutType.paginate&&f===t.PdfLayoutBreakType.fitElement&&d)return r;if(s===l)break;if(!s||0===s.length)break;if(n.layout===t.PdfLayoutType.onePage)break;var p=a._crossReference._document;a=a._pageIndex+1<p.pageCount?p.getPage(a._pageIndex+1):p.addPage(),_=!1}else{var g=a._crossReference._document;a=a._pageIndex+1<g.pageCount?g.getPage(a._pageIndex+1):g.addPage(),_=!1}}return r},e.prototype._parseBoxValues=function(t,e){if(!Array.isArray(t)||4!==t.length)return t;for(var i=new Array(4),r=0;r<4;r++){var n=t[parseInt(r.toString(),10)];if(!(n instanceof Ss))return t;i[parseInt(r.toString(),10)]=Number(this._crossReference._fetch(n))}return this._pageDictionary.update(e,i),i},e.prototype._layoutOnPage=function(e,i,r,n,s){for(var a=s.font,o=s.brush?s.brush:new Qn({r:0,g:0,b:0}),h=n._format,c=s.stringFormat?s.stringFormat:new Ei,_=new Gi,d=i.graphics.clientSize.height-r[1],u=h&&h._columns?Math.max(1,h._columns):1,l=h&&h._columnGutter?h._columnGutter:0,f=(r[2]-(u-1)*l)/u,p=e,g=0;g<u&&p.length>0;g++){if((A=_._layout(p,a,c,[f,d]))._empty)return new Nn(i,{x:r[0],y:r[1],width:0,height:0},void 0,p);p=A._remainder?A._remainder:""}var y=!p||0===p.length,m=i===n._page;if(h.break===t.PdfLayoutBreakType.fitElement&&m&&!y)return new Nn(i,{x:r[0],y:r[1],width:0,height:0},void 0,e);for(var b=e,v={x:r[0],y:r[1],width:0,height:0},w=v,S=!1,g=0;g<u&&b.length>0;g++){var x=r[0]+g*(f+l),P=r[1],A=_._layout(b,a,c,[f,d]);if(A._empty)return new Nn(i,v,w,b);var T=A._remainder?A._remainder:"";if(T===b)break;var C=b.length-T.length,k=b.substring(0,C);i.graphics.drawString(k,a,{x:x,y:P,width:f,height:A._actualSize.height},o,c),S=!0,v={x:x,y:P,width:A._actualSize.width,height:A._actualSize.height},w={x:x,y:P+Math.max(0,A._actualSize.height-A._lineHeight),width:A._actualSize.width,height:A._lineHeight},b=T}var R=new Nn(i,v,w,b);return R._hasRenderedContent=S,R},e.prototype._getSectionIndex=function(){var t=this._pageDictionary.getRaw("Parent");return t?this._crossReference._document._getSectionIndexByPage(t):-1},e}(),Un=function(){function e(e,i,r){this._location={x:0,y:0},this._destinationMode=t.PdfDestinationMode.location,this._zoom=0,this._isValid=!0,this._destinationBounds={x:0,y:0,width:0,height:0},this._array=Array(),void 0!==e&&null!==e&&(e.rotation===t.PdfRotationAngle.angle180?this._location={x:e.graphics._size.width,y:this._location.y}:e.rotation===t.PdfRotationAngle.angle90?this._location={x:0,y:0}:e.rotation===t.PdfRotationAngle.angle270?this._location={x:e.graphics._size.width,y:0}:this._location={x:0,y:this._location.y},this._page=e,this._index=e._pageIndex),null!==i&&void 0!==i&&(this._location={x:i.x,y:i.y},"width"in i&&"height"in i&&"number"==typeof i.width&&"number"==typeof i.height&&(this._destinationBounds=i)),null!==r&&void 0!==r&&("mode"in r&&null!==r.mode&&void 0!==r.mode&&(this.mode=r.mode),"zoom"in r&&null!==r.zoom&&void 0!==r.zoom&&(this.zoom=r.zoom))}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;if(e&&e._pageDictionary){var i=e._pageDictionary;switch(void 0!==i&&null!==i&&this._array.push(this._page._ref),this._destinationMode){case t.PdfDestinationMode.location:this._array.push(vs.get("XYZ")),this._array.push(this._location.x),this._array.push(this._page.graphics._size.height-this._location.y),this._array.push(this._zoom);break;case t.PdfDestinationMode.fitToPage:this._array.push(vs.get("Fit"));break;case t.PdfDestinationMode.fitR:this._array.push(vs.get("FitR")),this._array.push(this._destinationBounds.x),this._array.push(this._destinationBounds.y),this._array.push(this._destinationBounds.width),this._array.push(this._destinationBounds.height);break;case t.PdfDestinationMode.fitH:this._array.push(vs.get("FitH")),this._array.push(void 0!==e&&null!==e?e.size.height-this._location.y:0)}this._parent&&(this._parent._dictionary.set(this._isBookmark?"Dest":"D",this._array),this._parent._dictionary._updated=!0)}},e}(),Hn=function(){function e(t,e){t&&"string"==typeof e&&(this._dictionary=t,this._key=e)}return e.prototype._obtainDestination=function(){var e,i,r;if(this._dictionary&&(this._dictionary.has(this._key)||this._dictionary.has("D"))){this._dictionary&&this._dictionary._crossReference&&this._dictionary._crossReference._document&&(r=this._dictionary._crossReference._document),this._dictionary.has("D")&&(this._key="D");var n=this._dictionary.getArray(this._key);("string"==typeof n||n instanceof vs&&"string"==typeof n.name)&&r&&(n=this._getDestination(n,r));var s;Array.isArray(n)&&n.length>0&&(s=n[0]);var a,o,h,d,u,l,f,p,g;if("number"==typeof s)f=s;else if(s instanceof Ts)f=_(r,s);else if(s instanceof Ss){var y=r._crossReference._fetch(s);y&&y instanceof Ts&&(f=_(r,y))}if(!i&&"number"==typeof f&&f>=0&&f<r.pageCount&&(i=r.getPage(f)),Array.isArray(n)&&n.length>0&&(a=n[1]),a&&i&&n)switch(a.name){case"XYZ":o=n[2],h=n[3],l=n[4],p="number"==typeof h?i.size.height-h:0,g="number"==typeof o?o:0,i.rotation!==t.PdfRotationAngle.angle0&&(p=c(i,h,o)),(e=new Un(i,{x:g,y:p}))._index=i._pageIndex,e.zoom=void 0!==l&&null!==l?l:0,null!==o&&null!==h&&null!==l&&void 0!==o&&void 0!==h&&void 0!==l||e._setValidation(!1);break;case"FitR":n.length>2&&(o=n[2]),n.length>3&&(d=n[3]),n.length>4&&(u=n[4]),n.length>5&&(h=n[5]),(e=new Un(i,{x:o=void 0!==o&&null!==o?o:0,y:d=void 0!==d&&null!==d?d:0,width:u=void 0!==u&&null!==u?u:0,height:h=void 0!==h&&null!==h?h:0}))._index=i._pageIndex,e.mode=t.PdfDestinationMode.fitR;break;case"FitH":case"FitBH":n.length>2&&(h=n[2]),p="number"==typeof h?i.size.height-h:0,(e=new Un(i,{x:0,y:p}))._index=i._pageIndex,e.mode=t.PdfDestinationMode.fitH,null!==h&&void 0!==h||e._setValidation(!1);break;case"Fit":(e=new Un(i))._index=i._pageIndex,e.mode=t.PdfDestinationMode.fitToPage}else Array.isArray(n)&&(e=new Un,n.length>4&&(l=n[4]),n.length>1&&(a=n[1]),"number"==typeof l&&(e.zoom=l),a&&("Fit"===a.name?e.mode=t.PdfDestinationMode.fitToPage:"XYZ"===a.name&&(n.length>2&&(o=n[2]),n.length>3&&(p=n[3]),void 0!==o&&null!==o&&void 0!==p&&null!==p&&void 0!==l&&null!==l||e._setValidation(!1))),"number"==typeof f&&f>=0&&f<r.pageCount&&(e._index=f));return e}},e.prototype._getDestination=function(t,e){var i;return e&&(i=this._getNamedDestination(e,t)),i},e.prototype._getNamedDestination=function(t,e){var i,r=t._catalog;if(r&&r._catalogDictionary)if(e&&"string"==typeof e){if(r._catalogDictionary.has("Names")){var n=r._catalogDictionary.get("Names");if(n&&n.has("Dests")){var s=n.get("Dests");if(s){var a=this._getNamedObjectFromTree(s,e);i=this._extractDestination(a,t)}}}}else if(e&&e instanceof vs){var o=r._catalogDictionary.get("Dests");o&&(i=o.get(e.name))}return i},e.prototype._extractDestination=function(t,e){var i,r;return t&&t instanceof Ss&&(i=e._crossReference._fetch(t)),i&&(i instanceof Ts&&i.has("D")?r=i.getRaw("D"):Array.isArray(i)&&(r=i)),r||t},e.prototype._getNamedObjectFromTree=function(t,e){for(var i,r=!1,n=t;!r&&n;)n&&n.has("Kids")?n=this._getProperKid(n,e):n&&n.has("Names")&&(i=this._findName(n,e),r=!0);return i},e.prototype._findName=function(t,e){var i,r=t.get("Names");if(!Array.isArray(r)||0===r.length)return i;for(var n=0;n<r.length;n+=2){var s=r[n];if(s instanceof Ss&&(s=t._crossReference._fetch(s)),0===this._stringCompare(e,s))return i=r[n+1]}return i},e.prototype._getProperKid=function(t,e){var i,r;if(t&&t.has("Kids")&&(i=t.getRaw("Kids")),i&&Array.isArray(i)&&0!==i.length)for(var n=(i=t.getArray("Kids")).length-1;n>=0&&(r=i[Number.parseInt(n.toString(),10)],!this._checkLimits(r,e));n--);return r},e.prototype._checkLimits=function(t,e){var i=!1;if(t&&t.has("Limits")){var r=t.get("Limits"),n=r[0],s=r[1],a=this._stringCompare(n,e),o=this._stringCompare(s,e);i=0===a||0===o||a<0&&o>0}return i},e.prototype._stringCompare=function(t,e){for(var i=f(t),r=f(e),n=Math.min(i.length,r.length),s=0,a=0;a<n&&0===(s=i[Number.parseInt(a.toString(),10)]-r[Number.parseInt(a.toString(),10)]);a++);return 0===s&&(s=i.length-r.length),s},e}(),Wn=function(){function e(t){this._newLine="\r\n",this._whiteSpace=" ",this._stream=t}return e.prototype._writeOperator=function(t){this._stream.write(t),this._stream.write(this._newLine)},e.prototype._saveGraphicsState=function(){this._writeOperator("q")},e.prototype._restoreGraphicsState=function(){this._writeOperator("Q")},e.prototype._writeComment=function(t){t&&t.length>0&&this._writeOperator("% "+t)},e.prototype._setGraphicsState=function(t){this._stream.write("/"+rt(t.name)+" "),this._writeOperator("gs")},e.prototype._modifyCtm=function(t){this._stream.write(t._toString()+" "),this._writeOperator("cm")},e.prototype._modifyTM=function(t){this._stream.write(t._toString()+" "),this._writeOperator("Tm")},e.prototype._setColorSpace=function(e,i,r){if("string"==typeof e&&"boolean"==typeof i)this._stream.write("/"+e+" "),this._writeOperator(i?"CS":"cs");else if(Array.isArray(e)&&"number"==typeof i&&"boolean"==typeof r){var n=void 0;switch(i){case t._PdfColorSpace.rgb:n="DeviceRGB";break;case t._PdfColorSpace.cmyk:n="DeviceCMYK";break;case t._PdfColorSpace.grayScale:n="DeviceGray";break;default:n="DeviceRGB"}this._stream.write("/"+n+" "),this._writeOperator(r?"CS":"cs"),this._setColor(e,r)}},e.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")},e.prototype._appendRectangle=function(t,e,i,r){this._writePoint(t,e),this._writePoint(i,r),this._writeOperator("re")},e.prototype._writePoint=function(t,e){this._stream.write(t.toFixed(3)+" "+(-e).toFixed(3)+" ")},e.prototype._clipPath=function(t){this._stream.write((t?"W*":"W")+" n"+this._newLine)},e.prototype._fillPath=function(t){this._writeOperator(t?"f*":"f")},e.prototype._closeFillPath=function(t){this._writeOperator("h"),this._fillPath(t)},e.prototype._strokePath=function(){this._writeOperator("S")},e.prototype._closeStrokePath=function(){this._writeOperator("s")},e.prototype._fillStrokePath=function(t){this._writeOperator(t?"B*":"B")},e.prototype._closeFillStrokePath=function(t){this._writeOperator(t?"b*":"b")},e.prototype._endPath=function(){this._writeOperator("n")},e.prototype._setFont=function(t,e){this._stream.write("/"+t+" "+e.toFixed(3)+" "),this._writeOperator("Tf")},e.prototype._setTextScaling=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tz")},e.prototype._closePath=function(){this._writeOperator("h")},e.prototype._startNextLine=function(t,e){void 0===t?this._writeOperator("T*"):(this._writePoint(t,e),this._writeOperator("Td"))},e.prototype._setLeading=function(t){this._write(t.toFixed(3)+" "),this._write(this._whiteSpace),this._writeOperator("TL")},e.prototype._showText=function(t){this._writeText(t),this._writeOperator("Tj")},e.prototype._write=function(t){var e="";e+=t,e+="\r\n",this._writeOperator(e)},e.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)},e.prototype._beginText=function(){this._writeOperator("BT")},e.prototype._endText=function(){this._writeOperator("ET")},e.prototype._beginPath=function(t,e){this._writePoint(t,e),this._writeOperator("m")},e.prototype._appendLineSegment=function(t,e){this._writePoint(t,e),this._writeOperator("l")},e.prototype._appendBezierSegment=function(t,e,i,r,n,s){this._writePoint(t,e),this._writePoint(i,r),this._writePoint(n,s),this._writeOperator("c")},e.prototype._setTextRenderingMode=function(t){this._stream.write(t.toString()+" "),this._writeOperator("Tr")},e.prototype._setCharacterSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tc")},e.prototype._setWordSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tw")},e.prototype._showNextLineText=function(t,e){null!==e&&void 0!==e&&e?(this._writeText(t),this._writeOperator("'")):(this._stream.write(t),this._writeOperator("'"))},e.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)},e.prototype._setMiterLimit=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("M")},e.prototype._setLineWidth=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("w")},e.prototype._setLineCap=function(t){this._stream.write(t+" "),this._writeOperator("J")},e.prototype._setLineJoin=function(t){this._stream.write(t+" "),this._writeOperator("j")},e.prototype._executeObject=function(t){this._stream.write("/"+t.name+" "),this._writeOperator("Do")},e.prototype._beginMarkupSequence=function(t){this._stream.write("/"+t+" "),this._writeOperator("BMC")},e.prototype._endMarkupSequence=function(){this._writeOperator("EMC")},e.prototype._clear=function(){this._stream._bytes=[]},e.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},e}(),qn=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),{width:this.width,height:this.height}},enumerable:!0,configurable:!0}),e.prototype.draw=function(t,e){!e||null!==e.x&&void 0!==e.x||null!==e.y&&void 0!==e.y||(e.x=0,e.y=0);var i;e&&(i=0!==e.x||0!==e.y);var r=null;i&&(r=t.save(),t.translateTransform(e)),t.drawImage(this,{x:0,y:0}),i&&t.restore(r)},e.prototype._getPointSize=function(e,i,r){if(null===r||void 0===r){return a=this._getPointSize(e,i,96)}var n=new $n,s=new $n,a=[n._convertUnits(e,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point),s._convertUnits(i,t._PdfGraphicsUnit.pixel,t._PdfGraphicsUnit.point)];return a},e}(),Gn=function(){function i(t,e,i,r){if(this._pendingResource=[],this._isItalic=!1,this._isLayouter=!1,this._hasResourceReference=!1,r instanceof zn?(this._source=r._pageDictionary,this._page=r):r instanceof Mi&&(this._source=r._content.dictionary,this._template=r),this._source){var n=void 0;if(this._source.has("Resources"))n=this._source.getRaw("Resources");else if(this._source.has("Parent")){var s=this._source.get("Parent");s&&s.has("Resources")&&(n=s.getRaw("Resources"))&&n instanceof Ts&&this._source.update("Resources",n)}n&&n instanceof Ss?(this._hasResourceReference=!0,this._resourceObject=i._fetch(n),this._resourceObject&&this._resourceObject instanceof Fs&&(this._resourceObject=this._resourceObject.dictionary)):n&&n instanceof Ts?this._resourceObject=n:(this._resourceObject=new Ts,this._source.update("Resources",this._resourceObject))}this._crossReference=i,this._sw=new Wn(e),this._size=t,et("PDF",this._resourceObject),this._initialize()}return Object.defineProperty(i.prototype,"_matrix",{get:function(){return void 0===this._m&&(this._m=new Kn),this._m},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_resources",{get:function(){var t=this;if(void 0===this._resourceMap){if(this._resourceMap=new Map,this._resourceObject&&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 Ss&&t._resourceMap.set(i,vs.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 Ss&&t._resourceMap.set(i,vs.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 Ss&&t._setTransparencyData(i,vs.get(e))}))}}return this._resourceMap},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"clientSize",{get:function(){if(this._page&&this._crossReference&&this._crossReference._document._hasTemplateContentValue){var t=!!this._isLayouter,e=this._page._getActualBounds(this._page._pageSettings,t);return{width:e[2],height:e[3]}}return{width:this._clipBounds[2],height:this._clipBounds[3]}},enumerable:!0,configurable:!0}),i.prototype.save=function(){var t=new Jn(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},i.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;);},i.prototype.scaleTransform=function(t,e){var i=new Kn;i._scale(t,e),this._sw._modifyCtm(i),this._matrix._multiply(i)},i.prototype.translateTransform=function(t){var e=new Kn;e._translate(t.x,-t.y),this._sw._modifyCtm(e),this._matrix._multiply(e)},i.prototype.rotateTransform=function(t){var e=new Kn;e._rotate(-t),this._sw._modifyCtm(e),this._matrix._multiply(e)},i.prototype.setClip=function(e,i){void 0===i&&(i=t.PdfFillMode.winding),this._sw._appendRectangle(e.x,e.y,e.width,e.height),this._sw._clipPath(i===t.PdfFillMode.alternate)},i.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 Yn;var a=new Ts;a.update("CA",e),a.update("ca",i),a.update("BM",Z(r)),n._dictionary=a,n._key=s,n._name=vs.get(it());var o=void 0,h=!1;if(this._resourceObject.has("ExtGState")){var c=this._resourceObject.getRaw("ExtGState");null!==c&&void 0!==c&&(c instanceof Ss?(h=!0,o=this._crossReference._fetch(c)):c instanceof Ts&&(o=c))}else o=new Ts(this._crossReference),this._resourceObject.update("ExtGState",o);if(this._crossReference){var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,a),n._reference=_,o.update(n._name.name,_)}else this._pendingResource.push({resource:a,key:n._name,source:o});h&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0)}this._sw._setGraphicsState(n._name)},i.prototype.drawLine=function(t,e,i){this._beginMarkContent(),this._stateControl(t),this._sw._beginPath(e.x,e.y),this._sw._appendLineSegment(i.x,i.y),this._sw._strokePath(),et("PDF",this._resourceObject),this._endMarkContent()},i.prototype.drawRectangle=function(t,e,i){this._beginMarkContent();var r=this._setPenBrush(e,i);this._sw._appendRectangle(t.x,t.y,t.width,t.height),this._drawGraphicsPath(r.pen,r.brush),this._endMarkContent()},i.prototype.drawBezier=function(t,e,i,r,n){this._beginMarkContent(),this._stateControl(n,null,null),this._sw._beginPath(t.x,t.y),this._sw._appendBezierSegment(e.x,e.y,i.x,i.y,r.x,r.y),this._drawGraphicsPath(n),this._endMarkContent()},i.prototype.drawPie=function(t,e,i,r,n){this._beginMarkContent();var s=this._setPenBrush(r,n);this._constructPiePath(t.x,t.y,t.x+t.width,t.y+t.height,e,i),this._sw._appendLineSegment(t.x+t.width/2,t.y+t.height/2),this._drawGraphicsPath(s.pen,s.brush,null,!0),this._endMarkContent()},i.prototype.drawPolygon=function(e,i,r){var n=this;if(this._beginMarkContent(),e.length>0){var s=this._setPenBrush(i,r);this._sw._beginPath(e[0].x,e[0].y),e.forEach(function(t,e){e>0&&n._sw._appendLineSegment(t.x,t.y)}),this._drawGraphicsPath(s.pen,s.brush,t.PdfFillMode.winding,!0)}this._endMarkContent()},i.prototype.drawEllipse=function(e,i,r){this._beginMarkContent();var n=this._setPenBrush(i,r);this._constructArcPath(e.x,e.y,e.x+e.width,e.y+e.height,0,360),this._drawGraphicsPath(n.pen,n.brush,t.PdfFillMode.winding,!0),this._endMarkContent()},i.prototype.drawArc=function(e,i,r,n){0!==r&&(this._beginMarkContent(),this._stateControl(n),this._constructArcPath(e.x,e.y,e.x+e.width,e.y+e.height,i,r),this._drawGraphicsPath(n,null,t.PdfFillMode.winding,!1),this._endMarkContent())},i.prototype.drawImage=function(t,i){if(e.initializeTelemetryFeature("ImageToPDF","PDFLibrary"),this._beginMarkContent(),i&&this._isRectangle(i)){t._save();var r=new Kn;this._getTranslateTransform(i.x,i.y+i.height,r),this._getScaleTransform(i.width,i.height,r),this._sw._write("q"),this._sw._modifyCtm(r);var n=void 0,s=void 0,a=!0;if(this._resourceObject.has("XObject")){var o=this._resourceObject.getRaw("XObject");o instanceof Ts?n=o:o instanceof Ss&&this._crossReference&&(n=this._crossReference._fetch(o)),n&&(a=!1)}a&&(n=new Ts(this._crossReference),this._resourceObject.update("XObject",n)),void 0===s&&(t._key||(t._key=it()),s=vs.get(t._key)),this._crossReference?(this._updateImageResource(t,s,n,this._crossReference),this._source.update("Resources",this._resourceObject),this._source._updated=!0):this._pendingResource.push({resource:t,key:s,source:n}),this._sw._executeObject(s),this._sw._write("Q"),this._sw._write("\r\n"),et("ImageB",this._resourceObject),et("ImageC",this._resourceObject),et("ImageI",this._resourceObject),et("Text",this._resourceObject)}else{var h=t.physicalDimension;this.drawImage(t,{x:i.x,y:i.y,width:h.width,height:h.height})}this._endMarkContent()},i.prototype.drawTemplate=function(e,i){var r=this;this._beginMarkContent();var n=!0;if(void 0!==e){(e._isExported||e._isResourceExport)&&(this._crossReference?(e._crossReference=this._crossReference,e._importStream(!0,e._isResourceExport)):(e._importStream(!1,e._isResourceExport),this._pendingResource.push(e),n=!1));var s=void 0,a=void 0;this._page&&this._page.rotation&&e._isSignature&&this._page._size.width>this._page._size.height&&this._page.rotation===t.PdfRotationAngle.angle270&&e._content&&e._content.dictionary&&e._content.dictionary.has("Matrix")?(s=e&&e._size.width>0?i.width/e._size.height:1,a=e&&e._size.height>0?i.height/e._size.width:1):(s=e&&e._size.width>0?i.width/e._size.width:1,a=e&&e._size.height>0?i.height/e._size.height:1);var o=!(Math.trunc(1e3*s)/1e3==1&&Math.trunc(1e3*a)/1e3==1),h=void 0,c=void 0;this._page&&(h=this._page.cropBox,c=this._page.mediaBox,this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&h[0]>0&&h[1]>0&&c[0]<0&&c[1]<0&&(this.translateTransform({x:h[0],y:-h[1]}),i.x=-h[0],i.y=h[1]));var _=this.save(),d=new Kn;if(this._page){var u=this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&h&&c&&h[0]===c[0]&&h[1]===c[1]&&h[2]===c[2]&&h[3]===c[3]||this._page._pageDictionary.has("MediaBox")&&c&&0===c[3],l=i.y+(this._page._origin[0]>=0||u?i.height:0);if(e&&e._isSignature&&e._content&&e._content.dictionary&&e._content.dictionary.has("BBox")){var f=e._content.dictionary.get("BBox"),p=0!==f[2]&&0!==f[3],g=f[0]>0&&p?0:i.x,m=f[1]>0&&p?this._page.size.height:l;d._translate(g,-m)}else d._translate(i.x,-l)}else d._translate(i.x,-(i.y+i.height));var b=!1;if(e._content&&e._content.dictionary){var v=e._content.dictionary;if(v.has("Matrix")&&v.has("BBox")){var w=v.getArray("Matrix"),S=v.getArray("BBox");if(w&&S&&w.length>5&&S.length>3){var x=Number.parseFloat(y(-w[1])),P=Number.parseFloat(y(w[2])),A=Number.parseFloat(y(s)),T=Number.parseFloat(y(a));A===x&&T===P&&S[2]===e._size.width&&S[3]===e._size.height&&e._isAnnotationTemplate&&e._needScale&&o?((d=new Kn)._translate(i.x-w[4],-(i.y+w[5])),d._scale(1,1),b=!0):0!==S[0]&&0!==S[1]&&S[0]===i.x&&this._page&&e._isSignature&&(d._translate(i.x-S[0],-this._page.size.height),d._scale(s,a),b=!0)}}}o&&!b&&d._scale(s,a),this._sw._modifyCtm(d);var C,k,R=void 0,F=!1,I=!0;if(this._resourceObject.has("XObject")){var D=this._resourceObject.getRaw("XObject");D&&(D instanceof Ss?(F=!0,R=this._crossReference._fetch(D)):D instanceof Ts&&(R=D)),R&&(I=!1,this._resources.forEach(function(t,i){if(i&&i instanceof Ss){var n=r._crossReference._fetch(i);n&&e&&n===e._content&&(C=t,k=i)}}))}I&&(R=new Ts(this._crossReference),this._resourceObject.update("XObject",R)),void 0===C&&(e._key||(e._key=it()),C=vs.get(e._key),e&&e._content.reference?k=e._content.reference:this._crossReference?k=this._crossReference._getNextReference():(this._pendingResource.push({resource:e._content,key:C,source:R}),this._template&&n&&this._pendingResource.push(e)),k&&this._crossReference&&(!this._crossReference._cacheMap.has(k)&&e&&e._content&&this._crossReference._cacheMap.set(k,e._content),R.update(C.name,k),this._resources.set(k,C)),this._resourceObject._updated=!0),e._isNew&&this._crossReference&&e.graphics._processResources(this._crossReference),F&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._executeObject(C),this.restore(_),et("ImageB",this._resourceObject),et("ImageC",this._resourceObject),et("ImageI",this._resourceObject),et("Text",this._resourceObject)}this._endMarkContent()},i.prototype.drawPath=function(t,e,i){this._beginMarkContent();var r=this._setPenBrush(e,i);(r.pen||r.brush)&&(this._buildUpPath(t._points,t._pathTypes),this._drawGraphicsPath(r.pen,r.brush,t.fillMode,!1)),this._endMarkContent()},i.prototype.drawRoundedRectangle=function(t,e,i,r){if(null===i||void 0===i)throw new Error("Pen cannot be null or undefined");if(null===r||void 0===r)throw new Error("Brush cannot be null or undefined");var n=2*e,s=[n,n],a=[t.x,t.y,s[0],s[1]],o=new Ir;0===e?(o.addRectangle(t),this.drawPath(o,i,r)):(o._isRoundedRectangle=!0,o.addArc({x:a[0],y:a[1],width:a[2],height:a[3]},180,90),a[0]=t.x+t.width-n,o.addArc({x:a[0],y:a[1],width:a[2],height:a[3]},270,90),a[1]=t.y+t.height-n,o.addArc({x:a[0],y:a[1],width:a[2],height:a[3]},0,90),a[0]=t.x,o.addArc({x:a[0],y:a[1],width:a[2],height:a[3]},90,90),o.closeFigure(),this.drawPath(o,i,r))},i.prototype.drawString=function(t,e,i,r,n,s){var a,o,h;r instanceof Zn?(a=r,n instanceof Qn?(o=n,s instanceof Ei&&(h=s)):n instanceof Ei&&(h=n)):r instanceof Qn?(o=r,n instanceof Ei&&(h=n)):n instanceof Qn&&(o=n),n&&n instanceof Ei&&(h=n),s&&s instanceof Ei&&(h=s),this._beginMarkContent(),e&&e._document&&e._document._crossReference&&(this._crossReference=e._document._crossReference);var c=this._stringLayouter;if(void 0===c&&(c=new Gi,this._stringLayouter=c),h||(h=new Ei),t&&(t=this._normalizeText(e,t)),this._isRectangle(i)){var _=c._layout(t,e,h,[i.width,i.height]);if(!_._empty){var d=this._checkCorrectLayoutRectangle([_._actualSize.width,_._actualSize.height],i.x,i.y,h);i.width<=0&&(i.x=d[0],i.width=d[2]),i.height<=0&&(i.y=d[1],i.height=d[3]),this._drawStringLayoutResult(_,e,a,o,[i.x,i.y,i.width,i.height],h)}}et("Text",this._resourceObject),this._endMarkContent()},i.prototype.drawTextElement=function(t,e){if(void 0===t||null===t)throw new Error("PdfTextElement cannot be null or undefined");if("string"!=typeof t.text||0===t.text.length)throw new Error("PdfTextElement.text must be a non-empty string");if(void 0===t.font||null===t.font)throw new Error("PdfTextElement.font is required");if(void 0!==t.layoutFormat&&null!==t.layoutFormat&&!(t.layoutFormat instanceof En))throw new Error("PdfTextElement.layoutFormat must be an instance of PdfLayoutFormat");var i=this._isRectangle(e)?{x:e.x,y:e.y,width:e.width,height:e.height}:{x:e.x,y:e.y,width:0,height:0},r=new Qn({r:0,g:0,b:0}),n=void 0===t.brush||null===t.brush?r:t.brush;this.drawString(t.text,t.font,i,t.pen,n,t.stringFormat)},i.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},i.prototype._beginMarkContent=function(){this._layer&&this._layer._beginLayer(this)},i.prototype._endMarkContent=function(){if(this._layer){if(this._layer._isEndState&&0!==this._layer._parentLayer.length)for(var t=0;t<this._layer._parentLayer.length;t++)this._sw._write("EMC");this._layer._isEndState&&this._sw._write("EMC")}},i.prototype._processResources=function(t){var e=this;this._crossReference=t,this._pendingResource.length>0&&(this._pendingResource.forEach(function(i,r){if(i instanceof Mi)i._crossReference=t,i._isNew?i.graphics._processResources(t):i._updatePendingResource(t);else if(i.resource instanceof Rs||i.resource instanceof Ts){var n=void 0;i.resource._reference?n=i.resource._reference:(n=t._getNextReference(),i.resource._reference=n),!t._cacheMap.has(n)&&i.resource&&t._cacheMap.set(n,i.resource),i.source.update(i.key.name,n),e._resources.set(n,i.key)}else i.resource instanceof qn?e._updateImageResource(i.resource,i.key,i.source,t):i.resource instanceof Sr&&e._updateFontResource(i.resource,i.key,i.source,t);e._source.update("Resources",e._resourceObject),e._source._updated=!0}),this._pendingResource=[])},i.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},i.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 Ar){var s=t._fontInternal;s&&s._fontDictionary&&r._cacheMap.set(n,s._fontDictionary),i.update(e.name,n),this._resources.set(n,e)}},i.prototype._constructArcPath=function(t,e,i,r,n,s){var a=ot(t,e,i,r,n,s);if(0!==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[h],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])}},i.prototype._constructPiePath=function(t,e,i,r,n,s){var a=ot(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[h],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])}},i.prototype._writePen=function(t){var e=t._width,i=t._dashPattern;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.r,t._color.g,t._color.b],!0)},i.prototype._isRectangle=function(t){return"width"in t&&"height"in t},i.prototype._normalizeText=function(t,e){var i="";if(t instanceof xr){var r=[];if(null!==e&&void 0!==e&&e.length>0)for(s=0;s<e.length;s++){var n=e.charCodeAt(s);n>=19968&&n<=40959||r.push(n)}if(r&&r.length>0)for(var s=0;s<r.length;++s)i+=String.fromCharCode(r[Number.parseInt(s.toString(),10)])}else i=e;return i},i.prototype._buildUpPath=function(e,i){for(var r=0;r<e.length;r++){var n=e[r],s=i[r];switch(15&s){case t.PathPointType.start:this._sw._beginPath(n.x,n.y);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.x,n.y,o.x,o.y,h.x,h.y);break;case t.PathPointType.line:this._sw._appendLineSegment(n.x,n.y);break;default:throw new Error("Incorrect path formation.")}((s=i[Number.parseInt(r.toString(),10)])&t.PathPointType.closePath)===t.PathPointType.closePath&&this._sw._closePath()}},i.prototype._getBezierPoint=function(e,i,r){if(i[r]!==t.PathPointType.bezier)throw new Error("Malforming path.");return r++,{index:r,point:e[r]}},i.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.width,this._size.height],this._colorSpaceInitialized=!1,this._startCutIndex=-1},i.prototype._initializeCurrentColorSpace=function(){this._colorSpaceInitialized||(this._sw._setColorSpace("DeviceRGB",!0),this._sw._setColorSpace("DeviceRGB",!1),this._colorSpaceInitialized=!0)},i.prototype._brushControl=function(t){this._sw._setColor([t._color.r,t._color.g,t._color.b],!1),this._currentBrush=t},i.prototype._penControl=function(t){this._currentPen=t,this._writePen(t),this._currentPen=t},i.prototype._fontControl=function(t,e){var i=this,r=t._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 Ss?(o=!0,n=this._crossReference._fetch(_)):_ instanceof Ts&&(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 xr&&n===t._dictionary||t instanceof Ar&&n===t._fontInternal._fontDictionary||t instanceof Pr&&n===t._dictionary)&&(s=e,a=r,c=!0)}}else t._reference&&t._reference===r&&(s=e,a=r,c=!0)}))}if(h&&(n=new Ts(this._crossReference),this._resourceObject.update("Font",n)),void 0===s){if(t._key||(t._key=it()),s=vs.get(t._key),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 Ar){var d=t._fontInternal;d&&d._fontDictionary&&!d._fontDictionary._currentObj&&this._crossReference._cacheMap.set(a,d._fontDictionary),n.update(s.name,a)}!c&&a&&this._resources.set(a,s)}o&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._setFont(s.name,r)},i.prototype._setPenBrush=function(t,e){var i,r;return t&&(t instanceof Zn?i=t:r=t),e&&e instanceof Qn&&(r=e),this._stateControl(i,r,null),{pen:i,brush:r}},i.prototype._stateControl=function(t,e,i,r){(t||e)&&this._initializeCurrentColorSpace(),t&&this._penControl(t),e&&this._brushControl(e),i&&this._fontControl(i,r)},i.prototype._drawStringLayoutResult=function(e,i,r,n,s,a){var o=this;if(!e._empty){var h=a&&void 0!==a.lineLimit&&!a.lineLimit,c=void 0===a||a&&void 0!==a.noClip&&!a.noClip,_=h&&c,d=void 0;if(_){d=this.save();var u=[s[0],s[1],e._actualSize.width,e._actualSize.height];s[2]>0&&(u[2]=s[2]),a.lineAlignment===t.PdfVerticalAlignment.middle?u[1]+=(s[3]-u[3])/2:a.lineAlignment===t.PdfVerticalAlignment.bottom&&(u[1]+=s[3]-u[3]),this.setClip({x:u[0],y:u[1],width:u[2],height:u[3]})}i&&i instanceof Ar&&i._fontInternal&&i._fontInternal instanceof pr&&i.isItalic&&(i._fontInternal._ttfMetrics._isItalic||(d=this.save(),this._isItalic=!0)),this._applyStringSettings(i,r,n,a);var l=void 0!==a&&null!==a?a.horizontalScalingFactor:100;l!==this._textScaling&&(this._sw._setTextScaling(l),this._textScaling=l);var f=this._getTextVerticalAlignShift(e._actualSize.height,s[3],a),p=void 0===a||null===a||0===a.lineSpacing?i._getHeight(a):a.lineSpacing+i._getHeight(a),g=0;if(g=null!==a&&void 0!==a&&a.subSuperScript===t.PdfSubSuperScript.subScript?p-(i.height+i._getDescent(a)):p-i._getAscent(a),a&&a.lineAlignment===t.PdfVerticalAlignment.bottom){var m=y(s[3]),b=y(i._getHeight(a));s[3]-e._actualSize.height!=0&&s[3]-e._actualSize.height<i._size/2-1&&+m<=+b&&(g=-p/i._size)}var v=new Kn;this._isItalic?(this.translateTransform({x:s[0]+i.size/5,y:s[1]-g+f}),this._skewTransform(0,-11)):(v._translate(s[0],-(s[1]+i._getHeight(a))-(i._getDescent(a)>0?-i._getDescent(a):i._getDescent(a))-f),this._sw._modifyTM(v)),s[3]<i._size&&e._actualSize.height-s[3]<i._size/2-1&&(f=0),0!==f&&null!==a&&a.lineAlignment===t.PdfVerticalAlignment.bottom&&s[3]-e._actualSize.height!=0&&s[3]-e._actualSize.height>i._size/2-1&&(f-=(g-(p-i._size))/2),this._isItalic&&(this._sw._startNextLine(0,0),this._sw._setLeading(+p)),this._drawLayoutResult(e,i,a,s);var w=this._currentFont._fontInternal;i instanceof Ar&&i.isUnicode&&w&&w._fontDictionary&&w._fontDictionary._currentObj&&this._resourceMap.forEach(function(t,e){o._crossReference&&o._crossReference._cacheMap&&!o._crossReference._cacheMap.has(e)&&(w._fontDictionary._currentObj._beginSave(),o._crossReference._writeFontDictionary(w._fontDictionary),o._crossReference._cacheMap.set(e,w._fontDictionary))}),0!==f&&this._sw._startNextLine(0,-(f-e._lineHeight)),et("Text",this._resourceObject),this._sw._endText(),this._isItalic&&this.restore(d),this._underlineStrikeoutText(n,e,i,s,a),_&&this.restore(d)}},i.prototype._getNextPage=function(){var t=this._crossReference._document.pageCount;return this._page._pageIndex<=t-2?this._crossReference._document.getPage(this._page._pageIndex+1):this._crossReference._document.addPage()},i.prototype._applyStringSettings=function(e,i,r,n){var s=t._TextRenderingMode.fill,a=!1;if(i&&r?s=t._TextRenderingMode.fillStroke:i?s=t._TextRenderingMode.stroke:r&&(s=t._TextRenderingMode.fill),e&&e instanceof Ar&&(e.isUnicode||0!=(e._style&t.PdfFontStyle.bold))){var o=e._fontInternal._metrics._postScriptName,h=!1;o&&o.toLocaleLowerCase().includes("bold")&&(h=!0),e._fontInternal&&e._fontInternal._metrics&&e._fontInternal._metrics._isBold!==e.isBold&&!0===e.isBold&&!h&&(!i&&r&&(i=new Zn(r._color,1)),s=t._TextRenderingMode.fillStroke,a=!0)}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 c=void 0!==n&&null!==n?n.characterSpacing:0;c!==this._characterSpacing&&(this._sw._setCharacterSpacing(c),this._characterSpacing=c);var _=void 0!==n&&null!==n?n.wordSpacing:0;_!==this._wordSpacing&&(this._sw._setWordSpacing(_),this._wordSpacing=_),e&&a&&this._sw._setLineWidth(e.size/30)},i.prototype._drawLayoutResult=function(t,e,i,r){for(var n=void 0===i||null===i||0===i.lineSpacing?e._getHeight(i):i.lineSpacing+e._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[h],d=_._width,u=this._getHorizontalAlignShift(d,r[2],i)+this._getLineIndent(_,i,r[2],0===h);if(0!==u&&this._sw._startNextLine(u,0),e instanceof Pr?this._drawCjkString(_,r,e,i):o?this._drawUnicodeLine(_,r[2],e,i):this._drawAsciiLine(_,r[2],i,e),h+1!==c){var l=this._getTextVerticalAlignShift(t._actualSize.height,r[3],i),f=new Kn,p=-(r[1]+e._getHeight(i))-e._getDescent(i)-l-n*(h+1);f._translate(r[0],p),this._sw._modifyTM(f)}}},i.prototype._drawCjkString=function(t,e,i,r){if(i){this._justifyLine(t,e[2],r,i);var n=t._text,s=v(this._getCjkString(n));this._sw._showNextLineText("("+s+")",!1)}},i.prototype._getCjkString=function(t){if(null===t||void 0===t)throw new Error("line cannot be null");var e=x(t);return e=this._escapeSymbols(e)},i.prototype._escapeSymbols=function(t){if(null===t)throw new Error("data cannot be null");for(var e=[],i=0,r=t.length;i<r;i++){var n=t[i];switch(n){case 40:case 41:case 92:e.push(92),e.push(n);break;case 13:e.push(92),e.push(114);break;default:e.push(n)}}return new Uint8Array(e)},i.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&&n.wordSpacing>0,h=r,c=this._justifyLine(e,i,n,h),_=new vr;if(a||null!==n&&void 0!==n&&n.textDirection!==t.PdfTextDirection.none){var d=[],u=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,u,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 f=this._breakUnicodeLine(s,h,null),d=f.tokens,l=f.words;this._drawUnicodeBlocks(d,l,h,n,c)}else{var p=this._convertToUnicode(s,h);this._sw._showNextLineText(p,!0)}},i.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(Ji._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 u=t[d],l=e[d],f=0;0!==s&&this._sw._startNextLine(s,0),l.length>0&&(f+=i.measureString(l,r).width,f+=_,this._sw._showText(u)),d!==t.length-1&&(a+=s=f+c)}a>0&&this._sw._startNextLine(-a,0)}finally{null!==r&&void 0!==r&&(r.firstLineIndent=o,r.paragraphIndent=h)}}},i.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.push(a)}}return{tokens:r,words:i}},i.prototype._convertToUnicode=function(t,e){var i=null;if(null!==t&&void 0!==t&&null!==e&&void 0!==e&&e._fontInternal instanceof pr){var r=e._fontInternal._ttfReader;e._setSymbols(t),i=v(x(i=r._convertString(t)))}return i},i.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},i.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},i.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},i.prototype._drawAsciiLine=function(t,e,i,r){this._justifyLine(t,e,i,r);var n="";if(-1!==t._text.indexOf("(")||-1!==t._text.indexOf(")")||-1!==t._text.indexOf("\\")||-1!==t._text.indexOf("\r"))for(var s=t._text,a=0,o=s.length;a<o;a++){var h=s[a];n+="("===h?"\\(":")"===h?"\\)":"\\"===h?"\\\\":"\r"===h?"\\r":h}""===n&&(n=t._text),this._sw._showNextLineText("("+n+")")},i.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),_},i.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&&_},i.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.height,r[3],n),o=r[1]+a+i._getAscent(n)+1.5*s._width,h=r[1]+a+i._getHeight(n)/2+1.5*s._width,c=e._lines,_=0,d=c.length;_<d;_++){var u=c[_],l=u._width,f=this._getHorizontalAlignShift(l,r[2],n),p=this._getLineIndent(u,n,r[2],0===_),g=r[0]+f,y=this._shouldJustify(u,r[2],n,i)?g+r[2]-p:g+l-p;i.isUnderline&&(this.drawLine(s,{x:g,y:o},{x:y,y:o}),o+=e._lineHeight),i.isStrikeout&&(this.drawLine(s,{x:g,y:h},{x:y,y:h}),h+=e._lineHeight)}}},i.prototype._createUnderlineStrikeoutPen=function(t,e){var i=t?t._color:void 0;return new Zn(i,e._size/20)},i.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},i.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()},i.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({x:e[0],y:-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({x:this._cropBox[0],y:-this._cropBox[3]}):-t._origin[1]<this._mediaBoxUpperRightBound||0===this._mediaBoxUpperRightBound?this.translateTransform({x:0,y:-this._size.height}):this.translateTransform({x:0,y:-this._mediaBoxUpperRightBound}))}}else this._sw._writeComment("Change co-ordinate system to left/top."),this._mediaBoxUpperRightBound!==-this._size.height&&(this._cropBox&&((e=this._cropBox)[0]>0||e[1]>0||this._size.width===e[2]||this._size.height===e[3])?this.translateTransform({x:e[0],y:-e[3]}):this._mediaBoxUpperRightBound===this._size.height||0===this._mediaBoxUpperRightBound?this.translateTransform({x:0,y:-this._size.height}):this.translateTransform({x:0,y:-this._mediaBoxUpperRightBound}))},i.prototype._setTransparencyData=function(t,e){this._resourceMap.set(t,e);var i=this._crossReference._fetch(t),r=0,n=0,s=0;i&&(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=$(i.get("BM"))));var a="CA:"+r.toString()+"_ca:"+n.toString()+"_BM:"+s.toString(),o=new Yn;o._dictionary=i,o._key=a,o._name=e,o._reference=t,this._transparencies.set(o,a)},i.prototype._getTranslateTransform=function(t,e,i){return i._translate(t,-e),i},i.prototype._getScaleTransform=function(t,e,i){return null!==i&&void 0!==i||(i=new Kn),i._scale(t,e),i},i.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({x:t[0],y:t[1]})},i.prototype._clipTranslateMarginsWithBounds=function(t){var e=[t[2],t[3],this._size.width-t[2]-t[4],this._size.height-t[3]-t[4]];this._clipBounds=e,this._sw._writeComment("Clip margins."),this._sw._appendRectangle(e[0],e[1],e[2],e[3]),this._sw._closePath(),this._sw._clipPath(!1),this._sw._writeComment("Translate co-ordinate system."),this.translateTransform({x:t[0],y:t[1]})},i.prototype._skewTransform=function(t,e){var i=new Kn;this._getSkewTransform(t,e,i),this._sw._modifyCtm(i),i._multiply(i)},i.prototype._getSkewTransform=function(t,e,i){return i._skew(-t,-e),i},i}(),Kn=function(){function t(){this._matrix=new Xn(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(){var t="";return this._matrix._elements.forEach(function(e){t+=tt(e)+" "}),t},t.prototype._skew=function(t,e){var i=Math.tan(this._degreeToRadians(t)),r=Math.tan(this._degreeToRadians(e)),n=new Xn(1,i,r,1,0,0);this._matrix._multiply(n)},t.prototype._degreeToRadians=function(t){return Math.PI/180*t},t}(),Xn=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.x,i=t.y;return{x:e*this._elements[0]+i*this._elements[2]+this._offsetX,y: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}(),Jn=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}(),Yn=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 Qn=function(){function t(t){this._color=void 0!==t?t:{r:0,g:0,b:0}}return t}(),Zn=function(){function e(e,i,r){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,r&&(_e(r.dashOffset)&&(this._dashOffset=r.dashOffset),_e(r.dashPattern)&&Array.isArray(r.dashPattern)&&(this._dashPattern=r.dashPattern),_e(r.dashStyle)&&(this._dashStyle=r.dashStyle),_e(r.miterLimit)&&(this._miterLimit=r.miterLimit),_e(r.lineCap)&&(this._lineCap=r.lineCap),_e(r.lineJoin)&&(this._lineJoin=r.lineJoin))}return Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){_e(t)&&(this._color=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){!Number.isNaN(t)&&t>0&&(this._width=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dashOffset",{get:function(){return this._dashOffset},set:function(t){!Number.isNaN(t)&&t>0&&(this._dashOffset=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dashPattern",{get:function(){return this._dashPattern},set:function(t){Array.isArray(t)&&t.length>0&&(this._dashPattern=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dashStyle",{get:function(){return this._dashStyle},set:function(e){!Number.isNaN(e)&&e>=t.PdfDashStyle.solid&&e<=t.PdfDashStyle.custom&&(this._dashStyle=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){!Number.isNaN(t)&&_e(t)&&(this._miterLimit=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineCap",{get:function(){return this._lineCap},set:function(e){!Number.isNaN(e)&&e>=t.PdfLineCap.flat&&e<=t.PdfLineCap.square&&(this._lineCap=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(e){!Number.isNaN(e)&&e>=t.PdfLineJoin.miter&&e<=t.PdfLineJoin.bevel&&(this._lineJoin=e)},enumerable:!0,configurable:!0}),e}(),$n=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[i]},t.prototype._convertToPixels=function(t,e){var i=e;return t*this._proportions[i]},t}(),ts=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[t]},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[s]=r[e],e++,n++;return{outputBuffer:t,offset:e,length:n}}for(var a=e;a<i;a++){var o=this._position;t[a]=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}(),es=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)}}(),is=function(e){function i(t){var i=e.call(this)||this;return i._stream=t,i._initialize(),i}return es(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(){if(this._imageStream&&this._imageStream.length>0)return this._imageStream;var t=[];this._imageStream=new Fs(t,new Ts),this._imageStream.isImageStream=!0;var e=this._imageDataAsNumberArray.byteLength;this._imageStream.bytes=new Uint8Array(e);for(var i=0;i<e;i+=1024)for(var r=Math.min(1024,e-i),n=0;n<r;n++)this._imageStream.bytes[i+n]=this._getBuffer(i+n);this._imageStream._isCompress=!1;var s=new Ts;return s.set("Type",new vs("XObject")),s.set("Subtype",new vs("Image")),s.set("Width",this._width),s.set("Height",this._height),s.set("BitsPerComponent",this._bitsPerComponent),s.set("Filter",new vs("DCTDecode")),s.set("ColorSpace",new vs(this._getColorSpace())),s.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=s,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 Ts;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}(ts);!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 rs,ns=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}(),ss=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|=n(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8,this._bInBuffer<t){if(this._needsInput())return!1;this._bBuffer|=n(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|=n(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._begin<this._end&&(this._bBuffer|=n(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8)):this._bInBuffer<16&&this._begin<this._end&&(this._bBuffer|=n(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._bBuffer},t.prototype._getBitMask=function(t){return(n(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 r=0;this._bInBuffer>0&&i>0;)t[e++]=n(this._bBuffer,8),this._bBuffer>>=8,this._bInBuffer-=8,i--,r++;if(0===i)return r;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,r+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}(),as=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[i]=n(8,8);for(i=144;i<=255;i++)e[i]=n(9,8);for(i=256;i<=279;i++)e[i]=n(7,8);for(i=280;i<=287;i++)e[i]=n(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[i]]++;e[0]=0;for(var r=Array(17).fill(0),n=0,s=1;s<=16;s++)n=n+e[s-1]<<1,r[s]=n;for(var a=Array(t._maxLengthTree).fill(0),i=0;i<this._clArray.length;i++){var o=this._clArray[i];o>0&&(a[i]=this._bitReverse(r[o],o),r[o]++)}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=s(this._clArray.length),i=0;i<this._clArray.length;i++){var r=this._clArray[i];if(r>0){var n=t[i];if(r<=this._tBits){var a=1<<r;if(n>=a)throw new Error("Invalid Data.");for(var o=1<<this._tBits-r,h=0;h<o;h++)this._table[n]=s(i),n+=a}else{var c=r-this._tBits,_=1<<this._tBits,d=n&(1<<this._tBits)-1,u=this._table;do{var l=s(u[d]);if(0===l&&(u[d]=s(-e),l=s(-e),e++),l>0)throw new Error("Invalid Data.");u=0==(n&_)?this._left:this._right,d=-l,_<<=1,c--}while(0!==c);u[d]=s(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 r=n(1<<this._tBits,32);do{i=-i,i=0==(e&r)?this._left[i]:this._right[i],r<<=1}while(i<0)}var s=this._clArray[i];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}(),os=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 ns,this._input=new ss,this._loopCounter=0,this._codeList=Array(as._maxLengthTree+as._maxDepthTree).fill(0),this._cltcl=Array(as._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 as,this._llTree._loadTree(!0),this._distanceTree=new as,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),r=this._getInflaterStateValue(t._InflaterState.unCompressedByte1);if(this._blBuffer[i-r]=n(e,8),this._inflaterState===t._InflaterState.unCompressedByte4&&(this._bLength=this._blBuffer[0]+256*this._blBuffer[1],n(this._bLength,16)!==n(~(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 r=void 0,s=void 0,a=void 0,o=void 0;switch(this._inflaterState){case t._InflaterState.decodeTop:if((r=this._llTree._getNextSymbol(this._input))<0)return{result:!1,eob:e,output:this._output};if(r<256)this._output._write(n(r,8)),--i;else{if(256===r)return e=!0,this._inflaterState=t._InflaterState.readingBFinal,{result:!0,eob:e,output:this._output};if((r-=257)<8)r+=3,this._extraBits=0;else if(28===r)r=258,this._extraBits=0;else{if(r<0||r>=this._extraLengthBits.length)throw new Error("Invalid data.");this._extraBits=this._extraLengthBits[r]}if(this._length=r,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(as._maxLengthTree).fill(0);a(e,0,this._codeList,0,this._llCodeCount);var i=Array(as._maxDepthTree).fill(0);return a(i,0,this._codeList,this._llCodeCount,this._llCodeCount+this._dCodeCount),this._llTree=new as,this._llTree._load(e),this._distanceTree=new as,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]]=n(e,8),++this._loopCounter}for(var i=this._clCodeCount;i<this._codeOrder.length;i++)this._cltcl[this._codeOrder[i]]=0;return this._clTree=new as,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++]=n(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=n(this._codeList[this._loopCounter-1],8);if(e=this._input._getBits(2)+3,this._loopCounter+e>this._caSize)throw new Error("Invalid data.");for(r=0;r<e;r++)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(r=0;r<e;r++)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 r=0;r<e;r++)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}(),hs=function(){function t(t,e,i){_e(t)?this._data=t:this._data=[],_e(i)&&(this._leaveOpen=i),this._offset=e,this._inflater=new os,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(_e(this._offset)&&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[e]=this._data[this._offset+e],t++;return this._offset+=t,{buffer:this._buffer,count:t}},t}(),cs=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)}}(),_s=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 cs(i,e),i.prototype._initialize=function(){for(var t,e=this._hasValidChunkType(t);e.hasValidChunk;){switch(t=e.type){case rs.iHDR:this._readHeader();break;case rs.iDAT:this._readImageData();break;case rs.sRGB:this._isRedGreenBlue=!0,this._ignoreChunk();break;case rs.pLTE:this._readPhotoPlate();break;case rs.iEND:this._decodeImageData();break;case rs.tRNS:this._readTransparency();break;case rs.tEXt:case rs.iTXt:case rs.zTXt:case rs.hIST:case rs.sBIT:case rs.iCCP:case rs.pHYs:case rs.tIME:case rs.bKGD:case rs.gAMA:case rs.cHRM:case rs.unknown:this._ignoreChunk()}e=this._hasValidChunkType(t)}},i.prototype._hasValidChunkType=function(t){if(t=rs.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 ds,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=Math.floor((this._bitsPerComponent*this._width+7)/8)*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&&0!==this._header._interlace||(this._idatLength=Math.floor((this._header._bitDepth*this._width+7)/8)*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){var t=Math.max(2*this._currentChunkLength,1024);this._encodedStream=new Uint8Array(t),this._encodedStreamLength=0}if(this._currentChunkLength<=this._stream.byteLength&&this._stream.byteLength-this._position>=this._currentChunkLength){var e=this._encodedStreamLength,i=e+this._currentChunkLength;if(this._encodedStream.length<i){var r=2*this._encodedStream.length,n=Math.max(i,r),s=new Uint8Array(n);s.set(this._encodedStream.subarray(0,e)),this._encodedStream=s}this._encodedStream.set(this._stream.subarray(this._position,this._position+this._currentChunkLength),e),this._encodedStreamLength=i,this._position+=this._currentChunkLength}this._seek(4)},i.prototype._readPhotoPlate=function(){if(3===this._header._colorType){this._colorSpace=[],this._colorSpace.push(vs.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(v(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);var e=t.length;this._alpha=new Uint8Array(e);for(var i=!1,r=0;r<e;r++){var n=255&t[r];this._alpha[r]=n,i||0===n||255===n||(i=!0)}this._shades=i}else this._ignoreChunk()},i.prototype._getPngColorSpace=function(){if(this._isRedGreenBlue){var t=[],e=new Ts,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(vs.get("CalRGB")),t.push(e),t}return 0==(2&this._header._colorType)?vs.get("DeviceGray"):vs.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=new Uint8Array(this._width*this._height)),this._encodedStream&&(this._dataStream=this._getDeflatedData(this._encodedStream.subarray(0,this._encodedStreamLength)),this._dataStreamOffset=0),this._idatLength>0&&(this._decodedImageData=new Uint8Array(this._idatLength)),this._readDecodeData(),this._decodedImageData&&0===this._decodedImageData.length&&this._shades&&(this._ideateDecode=!1,this._decodedImageData=this._encodedStream.subarray(0,this._encodedStreamLength))):(this._ideateDecode=!1,this._decodedImageData=this._encodedStream.subarray(0,this._encodedStreamLength))},i.prototype._getDeflatedData=function(t){for(var e=t.subarray(2,t.length-4),i=new hs(Array.from(e),0,!0),r=[],n=0;;){var s=new Array(4096),a=i._read(s,0,4096),o=a.count,h=a.data;if(o<=0)break;for(var c=new Uint8Array(o),_=0;_<o;_++)c[_]=h[_];r.push(c),n+=o}for(var d=new Uint8Array(n),u=0,l=0,f=r;l<f.length;l++){c=f[l];d.set(c,u),u+=c.length}return d},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){var a;if(0!==n&&0!==s)for(var o=Math.floor((this._inputBands*n*this._header._bitDepth+7)/8),h=new Uint8Array(o),c=new Uint8Array(o),_=0,d=e;_<s;_++,d+=r){var u=this._dataStream[this._dataStreamOffset++];switch(this._dataStreamOffset=this._readStream(this._dataStream,this._dataStreamOffset,h,o),this._getFilterType(u)){case us.none:break;case us.sub:this._decompressSub(h,o,this._bitsPerPixel);break;case us.up:this._decompressUp(h,c,o);break;case us.average:this._decompressAverage(h,c,o,this._bitsPerPixel);break;case us.paeth:this._decompressPaeth(h,c,o,this._bitsPerPixel);break;default:throw new Error("Unknown PNG filter")}this._processPixels(h,t,i,d,n),c=(a=[h,c])[0],h=a[1]}},i.prototype._readStream=function(t,e,i,r){if(e+r>t.length)throw new Error("Insufficient data");return i.set(t.subarray(e,e+r)),e+r},i.prototype._decompressSub=function(t,e,i){for(var r=i;r<e;r++)t[r]=t[r]+t[r-i]&255},i.prototype._decompressUp=function(t,e,i){for(var r=0;r<i;r++)t[r]=t[r]+e[r]&255},i.prototype._decompressAverage=function(t,e,i,r){for(n=0;n<r;n++)t[n]=t[n]+(e[n]>>1)&255;for(var n=r;n<i;n++)t[n]=t[n]+(t[n-r]+e[n]>>1)&255},i.prototype._decompressPaeth=function(t,e,i,r){for(n=0;n<r;n++)t[n]=t[n]+e[n]&255;for(var n=r;n<i;n++)t[n]=t[n]+this._paethPredictor(t[n-r],e[n],e[n-r])&255},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,r,n){var s=0,a=0,o=0,h=this._getPixel(t);if(0===this._header._colorType||3===this._header._colorType||4===this._header._colorType?o=1:2!==this._header._colorType&&6!==this._header._colorType||(o=3),this._decodedImageData&&this._decodedImageData.length>0){a=e;var c=16===this._header._bitDepth?8:this._header._bitDepth,_=Math.floor((o*n*c+7)/8);for(s=0;s<n;s++)this._setPixel(this._decodedImageData,h,this._inputBands*s,o,a,r,this._header._bitDepth,_),a+=i}if(0!=(4&this._header._colorType)||this._shades)if(0!=(4&this._header._colorType)){if(16===this._header._bitDepth)for(var d=h,u=0;u<n;++u){var l=u*this._inputBands+o;d[l]=d[l]>>8}_=n;for(a=e,s=0;s<n;s++)this._setPixel(this._maskData,h,this._inputBands*s+o,1,a,r,8,_),a+=i}else{var _=n,f=new Uint8Array(1);for(a=e,s=0;s<n;s++){var p=h[s];f[0]=p<this._alpha.length?this._alpha[p]:255,this._setPixel(this._maskData,f,0,1,a,r,8,_),a+=i}}},i.prototype._getPixel=function(t){var e=this._header._bitDepth;if(8===e)return t;if(16===e){for(var i=Math.floor(t.length/2),r=new Uint16Array(i),n=0;n<i;n++)r[n]=t[2*n]<<8|t[2*n+1];return r}for(var i=Math.floor(8*t.length/e),r=new Uint8Array(i),s=0,a=Math.floor(8/e),o=(1<<e)-1,h=0;h<t.length;h++)for(var c=t[h],n=a-1;n>=0;n--)r[s++]=c>>e*n&o;return r},i.prototype._setPixel=function(t,e,i,r,n,s,a,o){if(8===a)for(var h=o*s+r*n,c=0;c<r;++c)t[h+c]=e[c+i];else if(16===a)for(var h=o*s+r*n,c=0;c<r;++c)t[h+c]=e[c+i]>>8;else{var h=Math.floor((o*s+n)/(8/a)),_=e[i]<<8-a*(n%(8/a))-a;t[h]=t[h]|255&_}},i.prototype._getImageDictionary=function(){if(this._imageStream&&this._imageStream.length>0)return this._imageStream;var t=[];this._imageStream=new Fs(t,new Ts),this._imageStream.isImageStream=!0,this._imageStream.bytes=this._decodedImageData,this._imageStream._isCompress=this._isDecode&&this._ideateDecode;var e=new Ts;return e.set("Type",new vs("XObject")),e.set("Subtype",new vs("Image")),e.set("Width",this._width),e.set("Height",this._height),16===this._bitsPerComponent?e.set("BitsPerComponent",8):e.set("BitsPerComponent",this._bitsPerComponent),this._isDecode&&this._ideateDecode||e.set("Filter",new vs("FlateDecode")),0==(2&this._header._colorType)?e.set("ColorSpace",vs.get("DeviceGray")):e.set("ColorSpace",vs.get("DeviceRGB")),(!this._isDecode||this._shades&&!this._ideateDecode)&&e.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=e,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 Fs(this._maskData,new Ts),this._maskStream.bytes=this._maskData,this._maskStream._isCompress=this._isDecode&&this._ideateDecode;var t=new Ts;t.set("Type",new vs("XObject")),t.set("Subtype",new vs("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",vs.get("DeviceGray")),this._maskStream.dictionary=t,this._maskStream.end=this._maskStream.bytes.length,this._maskStream.dictionary._updated=!0}},i.prototype._getDecodeParams=function(){var t=new Ts;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 rs.iHDR;case"PLTE":return rs.pLTE;case"IDAT":return rs.iDAT;case"IEND":return rs.iEND;case"bKGD":return rs.bKGD;case"cHRM":return rs.cHRM;case"gAMA":return rs.gAMA;case"hIST":return rs.hIST;case"pHYs":return rs.pHYs;case"sBIT":return rs.sBIT;case"tEXt":return rs.tEXt;case"tIME":return rs.tIME;case"tRNS":return rs.tRNS;case"zTXt":return rs.zTXt;case"sRGB":return rs.sRGB;case"iCCP":return rs.iCCP;case"iTXt":return rs.iTXt;case"Unknown":return rs.unknown;default:return null}},i.prototype._getFilterType=function(t){switch(t){case 1:return us.sub;case 2:return us.up;case 3:return us.average;case 4:return us.paeth;default:return us.none}},i.prototype.dispose=function(){this._encodedStream=null,this._maskData=null,this._alpha=null,this._dataStream=null,this._decodedImageData=null,this._colorSpace=null},i}(ts),ds=function(){function t(){this._width=0,this._height=0,this._colorType=0,this._compression=0,this._bitDepth=0,this._interlace=0,this._filter=us.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"}(rs||(rs={}));var us;!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"}(us||(us={}));var ls=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)}}(),fs=function(){function t(t,e){this.message=t,this.name=e}return t}(),ps=function(t){function e(e){return t.call(this,e,"FormatError")||this}return ls(e,t),e}(fs),gs=function(t){function e(e){return t.call(this,e,"ParserEndOfFileException")||this}return ls(e,t),e}(fs),ys=Object.create(null),ms=Object.create(null),bs=Object.create(null),vs=function(){function t(t){this.name=t}return t.get=function(e){return ys[e]||(ys[e]=new t(e))},t}(),ws=function(){function t(t){this.command=t}return t.get=function(e){return ms[e]||(ms[e]=new t(e))},t}(),Ss=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 bs[r]||(bs[r]=new t(e,i))},t}(),xs=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}(),Ps=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}(),As=function(){function t(t){this.table={},this.nElements=0,this.toStr=t||zt}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}(),Ts=function(){function t(t){this._isFont=!1,this._isProcessed=!1,this._isSignature=!1,this._isVisited=!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 Ss&&(r=this._crossReference._fetch(r)),r},t.prototype.getArray=function(t,e,i){var r=this,n=this.get(t,e,i);return this._crossReference&&Array.isArray(n)?n.map(function(t){return t instanceof Ss?r._crossReference._fetch(t):t}):n},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 Ss&&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((S=o[a])instanceof t)for(var h=0,c=S._map;h<c.length;h++){var _=c[h],d=_[0],u=_[1],l=s.get(d);if(void 0===l)l=[],s.set(d,l);else if(!(r&&u instanceof t))continue;l.push(u)}for(var f=0,p=s;f<p.length;f++){var g=p[f],y=g[0],m=g[1];if(1!==m.length&&m[0]instanceof t){for(var b=new t(e),v=0,w=m;v<w.length;v++)for(var S=w[v],x=0,P=S._map;x<P.length;x++){var A=P[x],d=A[0],u=A[1];void 0===b._map[d]&&(b._map[d]=u)}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}(),Cs=function(){function t(t){void 0===t&&(t=[]),this.value=t}return t}(),ks=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)}}(),Rs=function(){function t(){this._isCompress=!0,this._isImage=!1}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?P(e):v(e)},t.prototype.skip=function(t){this.offset+=t||1},t.prototype.getBaseStreams=function(){return null},t}(),Fs=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 ks(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}),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[e]=t.charCodeAt(e);this.end=this.bytes.length,this.dictionary._updated=!0},e.prototype._writeBytes=function(t){this.bytes=new Uint8Array(t),this.end=this.bytes.length,this.dictionary._updated=!0},e}(Rs),Is=function(t){function e(e){var i=t.call(this)||this;return _e(e)?i._bytes=e:i._bytes=[],i.dictionary=new Ts,i.dictionary._updated=!0,i}return ks(e,t),Object.defineProperty(e.prototype,"length",{get:function(){return this._bytes.length},enumerable:!0,configurable:!0}),e.prototype.write=function(t){var e;if("string"==typeof t)for(var i=0;i<t.length;i++)this._bytes.push(t.charCodeAt(i));else(e=this._bytes).push.apply(e,t);this.dictionary._updated=!0},e.prototype.getString=function(t){void 0===t&&(t=!1);var e=new Uint8Array(this._bytes);if(t)return P(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}(Rs),Ds=function(t){function e(){return t.call(this,new Uint8Array(0))||this}return ks(e,t),e}(Fs),Bs=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)}}(),Ls=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 Bs(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 Fs(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}(Rs),Os=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)}}(),Ms=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 Os(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,i=(t=this._cipher._decryptBlock(t,!e)).length;this.ensureBuffer(this.bufferLength+i).set(t,this.bufferLength),this.bufferLength+=i},e}(Ls),Es=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)}}(),Ns=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),js=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]),Vs=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]),zs=[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],Us=[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],Hs=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 ps("Unknown compression method in flate stream: "+n+", "+s);if(((n<<8)+s)%31!=0)throw new ps("Bad flag check in flate stream: "+n+", "+s);if(32&s)throw new ps("Bad flag bit set in flate stream: "+n+", "+s);return r.codeSize=0,r.codeBuffer=0,r}return Es(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)_=zs,d=Us;else if(2===r){var u=this.getBits(5)+257,l=this.getBits(5)+1,f=this.getBits(4)+4,p=new Uint8Array(Ns.length),g=void 0;for(g=0;g<f;++g)p[Ns[g]]=this.getBits(3);var y=this.generateHuffmanTable(p);e=0,g=0;for(var m=u+l,b=new Uint8Array(m),v=void 0,w=void 0,S=void 0;g<m;){var x=this.getCode(y);if(16===x)v=2,w=3,S=e;else if(17===x)v=3,w=3,S=e=0;else{if(18!==x){b[g++]=e=x;continue}v=7,w=11,S=e=0}for(var P=this.getBits(v)+w;P-- >0;)b[g++]=S}_=this.generateHuffmanTable(b.subarray(0,u)),d=this.generateHuffmanTable(b.subarray(u,m))}for(var A=(t=this.buffer)?t.length:0,T=this.bufferLength;;){var C=this.getCode(_);if(C<256)T+1>=A&&(A=(t=this.ensureBuffer(T+1)).length),t[T++]=C;else{if(256===C)return void(this.bufferLength=T);var k=(C=js[C-=257])>>16;k>0&&(k=this.getBits(k)),e=(65535&C)+k,C=this.getCode(d),(k=(C=Vs[C])>>16)>0&&(k=this.getBits(k));var R=(65535&C)+k;T+e>=A&&(A=(t=this.ensureBuffer(T+e)).length);for(var F=0;F<e;++F,++T)t[T]=t[T-R]}}},e}(Ls),Ws=function(){function t(t){if(this._parsedPages=[],this._pageCache=new Map,this._crossReference=t,this._catalogDictionary=t._getCatalogObj(),!(this._catalogDictionary instanceof Ts))throw new ps("Catalog object is not a dictionary.");this._catalogDictionary.isCatalog=!0,this._topPagesDictionary=this._catalogDictionary.get("Pages"),this.pageKidsCountCache=new Ps,this.pageIndexCache=new Ps}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 ps("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 Ts(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._addToCache=function(t,e,i){this._pageCache.set(t,{dictionary:e,reference:i,parent:e.get("Parent")}),this._parsedPages.push(t)},t.prototype._getPageDictionary=function(t){if(0!==t&&this._checkPageTreeFormat()){var e=this._findNearestIndex(t);if(e>0){var i=this._pageCache.get(e);if(i){var r=this._traverseFromCached(e,i,t);if(r)return r}}}return this._traverseFromRoot(t)},t.prototype._checkPageTreeFormat=function(){if(void 0===this._hasInvalidPageTree){var t=this._topPagesDictionary.get("Kids");Array.isArray(t)&&(this._hasInvalidPageTree=this.pageCount===t.length)}return this._hasInvalidPageTree},t.prototype._findNearestIndex=function(t){for(var e=this._parsedPages.length,i=this._parsedPages[0],r=Math.abs(i-t),n=1;n<e;n++){var s=this._parsedPages[n],a=Math.abs(s-t);a<r&&(i=s,r=a)}return i},t.prototype._traverseFromCached=function(t,e,i){var r=new xs,n=i>t?1:-1,s=e.dictionary,a=t,o=e.parent,h=e.reference;if(a===i&&ii(s.get("Type"),"Page"))return{dictionary:s,reference:h};for(;s&&a!==i;){if(s instanceof Ss){if(r.has(s))throw new ps("Pages tree contains circular reference.");r.put(s)}var c=this._findNextPage(s,o,n);if(!c)break;if(s=c.dictionary,h=c.reference,(a+=n)===i&&ii(s.get("Type"),"Page"))return this._addToCache(a,c.dictionary,c.reference),{dictionary:s,reference:h}}return null},t.prototype._findNextPage=function(t,e,i){var r=this;if(!e||!e.has("Kids"))return null;var n=e.getRaw("Kids");if(n instanceof Ss&&(n=this._crossReference._fetch(n)),!Array.isArray(n))throw new ps("Page dictionary kids object is not an array.");var s=-1;if(-1===(s=t._reference?n.indexOf(t._reference):n.findIndex(function(e){return e instanceof Ss&&(e=r._crossReference._fetch(e)),e===t})))return null;var a=s+i;if(a<0||a>=n.length)return null;var o=n[a],h=o instanceof Ss?this._crossReference._fetch(o):o;if(!(h instanceof Ts))throw new ps("Invalid page dictionary type.");return{dictionary:h,reference:o instanceof Ss?o:null}},t.prototype._traverseFromRoot=function(t){var e=[this._topPagesDictionary],i=new xs,r=this._catalogDictionary.getRaw("Pages");r&&r instanceof Ss&&i.put(r);for(var n=this._crossReference,s=this.pageKidsCountCache,a=this.pageIndexCache,o=0;e.length>0;){var h=e.pop();if(h&&h instanceof Ss){var c=s.get(h);if(c>=0&&o+c<=t){o+=c;continue}if(i.has(h))throw new ps("Pages tree contains circular reference.");i.put(h);var _=n._fetch(h);if(_&&_ instanceof Ts&&((f=_.getRaw("Type"))instanceof Ss&&(f=n._fetch(f)),ii(f,"Page")||!_.has("Kids"))){if(s.has(h)||s.put(h,1),a.has(h)||a.put(h,o),o===t)return this._addToCache(o,_,h),{dictionary:_,reference:h};o++;continue}e.push(_)}else{if(!(h instanceof Ts))throw new ps("Page dictionary kid reference points to wrong type of object.");var d=h.objId,u=h.get("Count");if(u instanceof Ss&&(u=n._fetch(u)),null!==u&&void 0!==u&&Number.isInteger(u)&&u>=0&&(d&&!s.has(d)&&s.set(d,u),o+u<=t))o+=u;else{var l=h.getRaw("Kids");if(l instanceof Ss&&(l=n._fetch(l)),!Array.isArray(l)){var f=h.getRaw("Type");if(f instanceof Ss&&(f=n._fetch(f)),ii(f,"Page")||!h.has("Kids")){if(o===t)return this._addToCache(o,h,null),{dictionary:h,reference:null};o++;continue}throw new ps("Page dictionary kids object is not an array.")}for(var p=l.length-1;p>=0;p--)e.push(l[p])}}}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),this._hasInvalidPageTree=void 0,this._pageCache.clear(),this._parsedPages=[]},t}(),qs=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)}}(),Gs=function(t){function e(e,i,r){var n=t.call(this,i)||this;if(!(r instanceof Ts))return e;var s=n.predictor=r.get("Predictor")||1;if(s<=1)return e;if(2!==s&&(s<10||s>15))throw new ps("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 qs(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 u=s[a]^o;u^=u>>1,u^=u>>2,o=(1&(u^=u>>4))<<7,i[d++]=u}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 f=((255&s[a])<<8)+(255&s[a+1])+((255&i[d-l])<<8)+(255&i[d-l+1]);i[d++]=f>>8&255,i[d++]=255&f}}else{var p=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),p[v]=p[v]+(o>>c-r)&g,c-=r,h=h<<r|p[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],u=s[_-e],l=u+h-d,f=l-u;f<0&&(f=-f);var p=l-h;p<0&&(p=-p);var g=l-d;g<0&&(g=-g),c=r[o],s[_++]=f<=p&&f<=g?u+c:p<=g?h+c:d+c}break;default:throw new ps("Unsupported predictor: "+i)}this.bufferLength+=t}},e}(Ls),Ks=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)}}(),Xs=function(t){function e(e,i,r){var n=t.call(this,i)||this;return n._jpegStreamStart=0,n._needsReprocessing=!1,n.stream=e,n.params=r,n.maybeLength=i,n}return Ks(e,t),e.prototype.readBlock=function(){this.decodeImage()},e.prototype.decodeImage=function(t){return this.eof?this.buffer:(t=this.skipUselessBytes(t||this.stream.getBytes(this.maybeLength)),this.buffer=t,this.bufferLength=t.length,this.eof=!0,this.buffer)},e.prototype.skipUselessBytes=function(t){for(var e=0,i=t.length-1;e<i;e++)if(255===t[e]&&216===t[e+1]){e>0&&(t=t.subarray(e));break}return t},e}(Ls),Js=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)}}(),Ys=function(t){function e(e,i,r){var n=t.call(this,i)||this;n.stream=e,n.cachedData=0,n.bitsCached=0;for(var s={earlyChange:r||0,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(4096),dictionaryLengths:new Uint16Array(4096),dictionaryPrevCodes:new Uint16Array(4096),currentSequence:new Uint8Array(4096),currentSequenceLength:0},a=0;a<256;++a)s.dictionaryValues[a]=a,s.dictionaryLengths[a]=1;return n.lzwState=s,n.lastCode=null,n}return Js(e,t),e.prototype.readBits=function(t){for(var e=this.bitsCached,i=this.cachedData;e<t;){var r=this.stream.getByte();if(-1===r)return this.eof=!0,null;i=i<<8|r,e+=8}return this.bitsCached=e-=t,this.cachedData=i,this.lastCode=null,i>>>e&(1<<t)-1},e.prototype.readBlock=function(){var t,e,i,r=1024,n=this.lzwState;if(n){var s=n.earlyChange,a=n.nextCode,o=n.dictionaryValues,h=n.dictionaryLengths,c=n.dictionaryPrevCodes,_=n.codeLength,d=n.prevCode,u=n.currentSequence,l=n.currentSequenceLength,f=0,p=this.bufferLength,g=this.ensureBuffer(this.bufferLength+r);for(t=0;t<512;t++){var y=this.readBits(_),m=l>0;if(null===y)break;if(y<256)u[0]=y,l=1;else{if(!(y>=258)){if(256===y){_=9,a=258,l=0;continue}this.eof=!0,this.lzwState=null;break}if(y<a)for(e=(l=h[y])-1,i=y;e>=0;e--)u[e]=o[i],i=c[i];else u[l++]=u[0]}if(m&&(c[a]=d,h[a]=h[d]+1,o[a]=u[0],_=++a+s&a+s-1?_:Math.min(Math.log(a+s)/.6931471805599453+1|0,12)),d=y,f+=l,r<f){do{r+=512}while(r<f);g=this.ensureBuffer(this.bufferLength+r)}for(e=0;e<l;e++)g[p]=u[e],p++}n.nextCode=a,n.codeLength=_,n.prevCode=d,n.currentSequenceLength=l,this.bufferLength=p}},e}(Ls),Qs=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)}}(),Zs=function(t){function e(e,i,r){var n=t.call(this,i)||this;return n.stream=e,n.maybeLength=i,n.params=r,n}return Qs(e,t),Object.defineProperty(e.prototype,"bytes",{get:function(){return this.stream.getBytes(this.maybeLength)},enumerable:!0,configurable:!0}),e.prototype.readBlock=function(){throw new Error("JpxStream.readBlock")},Object.defineProperty(e.prototype,"isAsyncDecoder",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.decodeImage=function(t){return this.eof?this.buffer:(t=t||this.bytes,this.eof=!0,t)},Object.defineProperty(e.prototype,"canAsyncDecodeImageFromBuffer",{get:function(){return this.stream.isAsync},enumerable:!0,configurable:!0}),e}(Ls),$s=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)}}(),ta=function(t){function e(e,i){var r=this;return i&&(i*=.8),r=t.call(this,i)||this,r.stream=e,r.input=new Uint8Array(5),r}return $s(e,t),e.prototype.readBlock=function(){for(var t=this.stream,e=t.getByte();C(e);)e=t.getByte();if(-1===e||126===e)return void(this.eof=!0);var i,r,n=this.bufferLength;if(122===e){for(i=this.ensureBuffer(n+4),r=0;r<4;++r)i[n+r]=0;this.bufferLength+=4}else{var s=this.input;for(s[0]=e,r=1;r<5;++r){for(e=t.getByte();C(e);)e=t.getByte();if(s[Number.parseInt(r.toString(),10)]=e,-1===e||126===e)break}if(i=this.ensureBuffer(n+r-1),this.bufferLength+=r-1,r<5){for(;r<5;++r)s[Number.parseInt(r.toString(),10)]=117;this.eof=!0}var a=0;for(r=0;r<5;++r)a=85*a+(s[Number.parseInt(r.toString(),10)]-33);for(r=3;r>=0;--r)i[n+r]=255&a,a>>=8}},e}(Ls),ea=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)}}(),ia=function(t){function e(e,i){var r=this;return i&&(i*=.5),r=t.call(this,i)||this,r.stream=e,r.firstDigit=-1,r}return ea(e,t),e.prototype.readBlock=function(){var t=this.stream.getBytes(8e3);if(!t.length)return void(this.eof=!0);for(var e=t.length+1>>1,i=this.ensureBuffer(this.bufferLength+e),r=this.bufferLength,n=this.firstDigit,s=0,a=t;s<a.length;s++){var o=a[s],h=void 0;if(o>=48&&o<=57)h=15&o;else{if(!(o>=65&&o<=70||o>=97&&o<=102)){if(62===o){this.eof=!0;break}continue}h=9+(15&o)}n<0?n=h:(i[r++]=n<<4|h,n=-1)}n>=0&&this.eof&&(i[r++]=n<<4,n=-1),this.firstDigit=n,this.bufferLength=r},e}(Ls),ra=function(){function t(t,e){if(void 0===e&&(e={}),this._text="",!t||"function"!=typeof t.next)throw new Error("CCITTFaxDecoder - invalid source parameter.");this._source=t,this._eof=!1,this._encoding=e.K||0,this._endOfLine=e.EndOfLine||!1,this._byteAlign=e.EncodedByteAlign||!1,this._columns=e.Columns||1728,this._rows=e.Rows||0,this._endOfBlock=void 0===e.EndOfBlock||null===e.EndOfBlock||e.EndOfBlock,this._black=e.BlackIs1||!1,this._codingLine=new Uint32Array(this._columns+1),this._referenceLine=new Uint32Array(this._columns+2),this._codingLine[0]=this._columns,this._codingPosition=0,this._row=0,this._nextLine=this._encoding<0,this._inputBits=0,this._inputBuffer=0,this._outputBits=0,this._rowsDone=!1;for(var i=this._lookBits(12);0===i;)this._eatBits(1);1===i&&this._eatBits(12),this._encoding>0&&(this._nextLine=!this._lookBits(1),this._eatBits(1))}return t.prototype.readNextChar=function(){if(this._eof)return-1;var t,e,i,r,n=this._referenceLine,s=this._codingLine,a=this._columns;if(0===this._outputBits){if(this._rowsDone&&(this._eof=!0),this._eof)return-1;this.err=!1;var o=void 0,h=void 0,c=void 0;if(this._nextLine){for(r=0;s[Number.parseInt(r.toString(),10)]<a;++r)n[Number.parseInt(r.toString(),10)]=s[Number.parseInt(r.toString(),10)];for(n[Number.parseInt(r.toString(),10)]=a,r++,n[Number.parseInt(r.toString(),10)]=a,s[0]=0,this._codingPosition=0,t=0,e=0;s[this._codingPosition]<a;)switch(o=this._getTwoDimCode()){case 0:this._addPixels(n[t+1],e),n[t+1]<a&&(t+=2);break;case 1:if(o=h=0,e){do{o+=c=this._getBlackCode()}while(c>=64);do{h+=c=this._getWhiteCode()}while(c>=64)}else{do{o+=c=this._getWhiteCode()}while(c>=64);do{h+=c=this._getBlackCode()}while(c>=64)}for(this._addPixels(s[this._codingPosition]+o,e),s[this._codingPosition]<a&&this._addPixels(s[this._codingPosition]+h,1^e);n[Number.parseInt(t.toString(),10)]<=s[Number.parseInt(this._codingPosition.toString(),10)]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case 7:if(this._addPixels(n[Number.parseInt(t.toString(),10)]+3,e),e^=1,s[this._codingPosition]<a)for(++t;n[Number.parseInt(t.toString(),10)]<=s[this._codingPosition]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case 5:if(this._addPixels(n[Number.parseInt(t.toString(),10)]+2,e),e^=1,s[this._codingPosition]<a)for(++t;n[Number.parseInt(t.toString(),10)]<=s[this._codingPosition]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case 3:if(this._addPixels(n[Number.parseInt(t.toString(),10)]+1,e),e^=1,s[this._codingPosition]<a)for(++t;n[Number.parseInt(t.toString(),10)]<=s[this._codingPosition]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case 2:if(this._addPixels(n[Number.parseInt(t.toString(),10)],e),e^=1,s[this._codingPosition]<a)for(++t;n[Number.parseInt(t.toString(),10)]<=s[this._codingPosition]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case 8:if(this._addPixelsNeg(n[Number.parseInt(t.toString(),10)]-3,e),e^=1,s[this._codingPosition]<a)for(t>0?--t:++t;n[Number.parseInt(t.toString(),10)]<=s[this._codingPosition]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case 6:if(this._addPixelsNeg(n[Number.parseInt(t.toString(),10)]-2,e),e^=1,s[this._codingPosition]<a)for(t>0?--t:++t;n[Number.parseInt(t.toString(),10)]<=s[this._codingPosition]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case 4:if(this._addPixelsNeg(n[Number.parseInt(t.toString(),10)]-1,e),e^=1,s[this._codingPosition]<a)for(t>0?--t:++t;n[Number.parseInt(t.toString(),10)]<=s[this._codingPosition]&&n[Number.parseInt(t.toString(),10)]<a;)t+=2;break;case-1:this._addPixels(a,0),this._eof=!0;break;default:this._addPixels(a,0),this.err=!0}}else for(s[0]=0,this._codingPosition=0,e=0;s[this._codingPosition]<a;){if(o=0,e)do{o+=c=this._getBlackCode()}while(c>=64);else do{o+=c=this._getWhiteCode()}while(c>=64);this._addPixels(s[this._codingPosition]+o,e),e^=1}var _=!1;if(this._byteAlign&&(this._inputBits&=-8),this._endOfBlock||this._row!==this._rows-1){if(o=this._lookBits(12),this._endOfLine)for(;-1!==o&&1!==o;)this._eatBits(1),o=this._lookBits(12);else for(;0===o;)this._eatBits(1),o=this._lookBits(12);1===o?(this._eatBits(12),_=!0):-1===o&&(this._eof=!0)}else this._rowsDone=!0;if(!this._eof&&this._encoding>0&&!this._rowsDone&&(this._nextLine=!this._lookBits(1),this._eatBits(1)),this._endOfBlock&&_&&this._byteAlign){if(1===(o=this._lookBits(12))){if(this._eatBits(12),this._encoding>0&&(this._lookBits(1),this._eatBits(1)),this._encoding>=0)for(r=0;r<4;++r)o=this._lookBits(12),this._eatBits(12),this._encoding>0&&(this._lookBits(1),this._eatBits(1));this._eof=!0}}else if(this.err&&this._endOfLine){for(;;){if(-1===(o=this._lookBits(13)))return this._eof=!0,-1;if(o>>1==1)break;this._eatBits(1)}this._eatBits(12),this._encoding>0&&(this._eatBits(1),this._nextLine=!(1&o))}this._outputBits=s[0]>0?s[this._codingPosition=0]:s[this._codingPosition=1],this._row++}var d;if(this._outputBits>=8)d=1&this._codingPosition?0:255,this._outputBits-=8,0===this._outputBits&&s[this._codingPosition]<a&&(this._codingPosition++,this._outputBits=s[this._codingPosition]-s[this._codingPosition-1]);else{i=8,d=0;do{if("number"!=typeof this._outputBits)throw new Error('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');this._outputBits>i?(d<<=i,1&this._codingPosition||(d|=255>>8-i),this._outputBits-=i,i=0):(d<<=this._outputBits,1&this._codingPosition||(d|=255>>8-this._outputBits),i-=this._outputBits,this._outputBits=0,s[this._codingPosition]<a?(this._codingPosition++,this._outputBits=s[this._codingPosition]-s[this._codingPosition-1]):i>0&&(d<<=i,i=0))}while(i)}return this._black&&(d^=255),d},t.prototype._addPixels=function(t,e){var i=this._codingLine,r=this._codingPosition;t>i[Number.parseInt(r.toString(),10)]&&(t>this._columns&&(this.err=!0,t=this._columns),1&r^e&&++r,i[Number.parseInt(r.toString(),10)]=t),this._codingPosition=r},t.prototype._addPixelsNeg=function(t,e){var i=this._codingLine,r=this._codingPosition;if(t>i[Number.parseInt(r.toString(),10)])t>this._columns&&(this.err=!0,t=this._columns),1&r^e&&++r,i[Number.parseInt(r.toString(),10)]=t;else if(t<i[Number.parseInt(r.toString(),10)]){for(t<0&&(this.err=!0,t=0);r>0&&t<i[r-1];)--r;i[Number.parseInt(r.toString(),10)]=t}this._codingPosition=r},t.prototype._findTableCode=function(t,e,i,r){for(var n=void 0!==r&&null!==r?r:0,s=t;s<=e;++s){var a=this._lookBits(s);if(-1===a)return[!0,1,!1];if(s<e&&(a<<=e-s),!n||a>=n){var o=i[a-n];if(o[0]===s)return this._eatBits(s),[!0,o[1],!0]}}return[!1,0,!1]},t.prototype._getTwoDimCode=function(){var t,e=0,i=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]];if(this._endOfBlock){if(e=this._lookBits(7),this._text+=e,(t=i[e])&&t[0]>0)return this._eatBits(t[0]),t[1]}else{var r=this._findTableCode(1,7,i);if(r[0]&&r[2])return r[1]}return-1},t.prototype._getWhiteCode=function(){var t,e=0,i=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],r=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]];if(this._endOfBlock){if(-1===(e=this._lookBits(12)))return 1;if((t=e>>5==0?i[Number.parseInt(e.toString(),10)]:r[e>>3])[0]>0)return this._eatBits(t[0]),t[1]}else{var n=this._findTableCode(1,9,r);if(n[0])return n[1];if((n=this._findTableCode(11,12,i))[0])return n[1]}return this._eatBits(1),1},t.prototype._getBlackCode=function(){var t,e,i=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],r=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],n=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];if(this._endOfBlock){if(-1===(t=this._lookBits(13)))return 1;if((e=t>>7==0?i[Number.parseInt(t.toString(),10)]:t>>9==0&&t>>7!=0?r[(t>>1)-64]:n[t>>7])[0]>0)return this._eatBits(e[0]),e[1]}else{var s=this._findTableCode(2,6,n);if(s[0])return s[1];if((s=this._findTableCode(7,12,r,64))[0])return s[1];if((s=this._findTableCode(10,13,i))[0])return s[1]}return this._eatBits(1),1},t.prototype._lookBits=function(t){for(;this._inputBits<t;){var e=this._source.next();if(-1===e)return 0===this._inputBits?-1:this._inputBuffer<<t-this._inputBits&65535>>16-t;this._inputBuffer=this._inputBuffer<<8|e,this._inputBits+=8}return this._inputBuffer>>this._inputBits-t&65535>>16-t},t.prototype._eatBits=function(t){this._inputBits-=t,this._inputBits<0&&(this._inputBits=0)},t}(),na=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)}}(),sa=function(t){function e(e,i,r){var n=t.call(this,i)||this;n.stream=e,r instanceof Ts||(r=new Ts(null));var s={next:function(){return e.getByte()}};return n.ccittFaxDecoder=new ra(s,{K:r.get("K"),EndOfLine:r.get("EndOfLine"),EncodedByteAlign:r.get("EncodedByteAlign"),Columns:r.get("Columns"),Rows:r.get("Rows"),EndOfBlock:r.get("EndOfBlock"),BlackIs1:r.get("BlackIs1")}),n}return na(e,t),e.prototype.readBlock=function(){for(;!this.eof;){var t=this.ccittFaxDecoder.readNextChar();if(-1===t)return void(this.eof=!0);this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=t}},e}(Ls),aa=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)}}(),oa=function(t){function e(e,i){var r=t.call(this,i)||this;return r.stream=e,r.dict=e.dict,r}return aa(e,t),e.prototype.readBlock=function(){var t=this.stream.getBytes(2);if(!t||t.length<2||128===t[0])return void(this.eof=!0);var e,i=this.bufferLength,r=t[0];if(r<128){if(e=this.ensureBuffer(i+r+1),e[i++]=t[1],r>0){var n=this.stream.getBytes(r);e.set(n,i),i+=r}}else r=257-r,(e=this.ensureBuffer(i+r+1)).fill(t[1],i,i+r),i+=r;this.bufferLength=i},e}(Ls),ha=function(){function t(t,e,i){this._quantizationTable=[{estimate:22017,nextMostProbableState:1,nextLeastProbableState:1,switchFlag:1},{estimate:13313,nextMostProbableState:2,nextLeastProbableState:6,switchFlag:0},{estimate:6145,nextMostProbableState:3,nextLeastProbableState:9,switchFlag:0},{estimate:2753,nextMostProbableState:4,nextLeastProbableState:12,switchFlag:0},{estimate:1313,nextMostProbableState:5,nextLeastProbableState:29,switchFlag:0},{estimate:545,nextMostProbableState:38,nextLeastProbableState:33,switchFlag:0},{estimate:22017,nextMostProbableState:7,nextLeastProbableState:6,switchFlag:1},{estimate:21505,nextMostProbableState:8,nextLeastProbableState:14,switchFlag:0},{estimate:18433,nextMostProbableState:9,nextLeastProbableState:14,switchFlag:0},{estimate:14337,nextMostProbableState:10,nextLeastProbableState:14,switchFlag:0},{estimate:12289,nextMostProbableState:11,nextLeastProbableState:17,switchFlag:0},{estimate:9217,nextMostProbableState:12,nextLeastProbableState:18,switchFlag:0},{estimate:7169,nextMostProbableState:13,nextLeastProbableState:20,switchFlag:0},{estimate:5633,nextMostProbableState:29,nextLeastProbableState:21,switchFlag:0},{estimate:22017,nextMostProbableState:15,nextLeastProbableState:14,switchFlag:1},{estimate:21505,nextMostProbableState:16,nextLeastProbableState:14,switchFlag:0},{estimate:20737,nextMostProbableState:17,nextLeastProbableState:15,switchFlag:0},{estimate:18433,nextMostProbableState:18,nextLeastProbableState:16,switchFlag:0},{estimate:14337,nextMostProbableState:19,nextLeastProbableState:17,switchFlag:0},{estimate:13313,nextMostProbableState:20,nextLeastProbableState:18,switchFlag:0},{estimate:12289,nextMostProbableState:21,nextLeastProbableState:19,switchFlag:0},{estimate:10241,nextMostProbableState:22,nextLeastProbableState:19,switchFlag:0},{estimate:9217,nextMostProbableState:23,nextLeastProbableState:20,switchFlag:0},{estimate:8705,nextMostProbableState:24,nextLeastProbableState:21,switchFlag:0},{estimate:7169,nextMostProbableState:25,nextLeastProbableState:22,switchFlag:0},{estimate:6145,nextMostProbableState:26,nextLeastProbableState:23,switchFlag:0},{estimate:5633,nextMostProbableState:27,nextLeastProbableState:24,switchFlag:0},{estimate:5121,nextMostProbableState:28,nextLeastProbableState:25,switchFlag:0},{estimate:4609,nextMostProbableState:29,nextLeastProbableState:26,switchFlag:0},{estimate:4353,nextMostProbableState:30,nextLeastProbableState:27,switchFlag:0},{estimate:2753,nextMostProbableState:31,nextLeastProbableState:28,switchFlag:0},{estimate:2497,nextMostProbableState:32,nextLeastProbableState:29,switchFlag:0},{estimate:2209,nextMostProbableState:33,nextLeastProbableState:30,switchFlag:0},{estimate:1313,nextMostProbableState:34,nextLeastProbableState:31,switchFlag:0},{estimate:1089,nextMostProbableState:35,nextLeastProbableState:32,switchFlag:0},{estimate:673,nextMostProbableState:36,nextLeastProbableState:33,switchFlag:0},{estimate:545,nextMostProbableState:37,nextLeastProbableState:34,switchFlag:0},{estimate:321,nextMostProbableState:38,nextLeastProbableState:35,switchFlag:0},{estimate:273,nextMostProbableState:39,nextLeastProbableState:36,switchFlag:0},{estimate:133,nextMostProbableState:40,nextLeastProbableState:37,switchFlag:0},{estimate:73,nextMostProbableState:41,nextLeastProbableState:38,switchFlag:0},{estimate:37,nextMostProbableState:42,nextLeastProbableState:39,switchFlag:0},{estimate:21,nextMostProbableState:43,nextLeastProbableState:40,switchFlag:0},{estimate:9,nextMostProbableState:44,nextLeastProbableState:41,switchFlag:0},{estimate:5,nextMostProbableState:45,nextLeastProbableState:42,switchFlag:0},{estimate:1,nextMostProbableState:45,nextLeastProbableState:43,switchFlag:0},{estimate:22017,nextMostProbableState:46,nextLeastProbableState:46,switchFlag:0}],this._data=t,this._bitPosition=e,this._dataEnd=i,this._high=t[e],this._low=0,this._byteIn(),this._high=this._high<<7&65535|this._low>>9&127,this._low=this._low<<7&65535,this._bitCount-=7,this._range=32768}return t.prototype._byteIn=function(){var t=this._data,e=this._bitPosition;255===t[e]?t[e+1]>143?(this._low+=65280,this._bitCount=8):(e++,this._low+=t[e]<<9,this._bitCount=7,this._bitPosition=e):(e++,this._low+=e<this._dataEnd?t[e]<<8:65280,this._bitCount=8,this._bitPosition=e),this._low>65535&&(this._high+=this._low>>16,this._low&=65535)},t.prototype._readBit=function(t,e){var i,r=t[e],n=r>>1,s=1&r,a=this._quantizationTable[n],o=a.estimate,h=this._range-o;if(this._high<o)h<o?(h=o,i=s,n=a.nextMostProbableState):(h=o,i=1^s,1===a.switchFlag&&(s=i),n=a.nextLeastProbableState);else{if(this._high-=o,0!=(32768&h))return this._range=h,s;h<o?(i=1^s,1===a.switchFlag&&(s=i),n=a.nextLeastProbableState):(i=s,n=a.nextMostProbableState)}do{0===this._bitCount&&this._byteIn(),h<<=1,this._high=this._high<<1&65535|this._low>>15&1,this._low=this._low<<1&65535,this._bitCount--}while(0==(32768&h));return this._range=h,t[e]=n<<1|s,i},t}(),ca=function(){function t(){this.prev=1}return t.prototype._readBits=function(t,e,i){for(var r=0,n=0;n<t;n++){var s=e._readBit(i,this.prev);this.prev=this.prev<256?this.prev<<1|s:511&(this.prev<<1|s)|256,r=r<<1|s}return r>>>0},t}(),_a=function(){function t(){this.cache={}}return t.prototype.getContexts=function(t){var e=t.toString();return e in this.cache||(this.cache[e]=new Int8Array(65536)),this.cache[e]},t}(),da=function(){function t(t,e,i){this._data=t,this._start=e,this._end=i}return Object.defineProperty(t.prototype,"decoder",{get:function(){return Ce(this,"decoder",new ha(this._data,this._start,this._end))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contextCache",{get:function(){return Ce(this,"contextCache",new _a)},enumerable:!0,configurable:!0}),t}(),ua=function(){function t(){this._standardTablesCache={},this._codingTemplates=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],this._refinementTemplates=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],this._reusedContexts=[39717,1941,229,405],this._refinementReusedContexts=[32,8]}return t.prototype._onPageInformation=function(t){this._currentPageInfo=t;var e=t[0].width+7>>3,i=new Uint8ClampedArray(e*t[0].height);t.defaultPixelValue&&i.fill(255),this._buffer=i},t.prototype._drawBitmap=function(t,e){var i,r,n,s,a=this._currentPageInfo,o=t.width,h=t.height,c=a[0].width+7>>3,_=a[0].combinationOperatorOverride?t.combinationOperator:a[0].combinationOperator,d=this._buffer,u=128>>(7&t.x),l=t.y*c+(t.x>>3);switch(_){case 0:for(i=0;i<h;i++){for(n=u,s=l,r=0;r<o;r++)e[i][r]&&(d[s]|=n),(n>>=1)||(n=128,s++);l+=c}break;case 2:for(i=0;i<h;i++){for(n=u,s=l,r=0;r<o;r++)e[i][r]&&(d[s]^=n),(n>>=1)||(n=128,s++);l+=c}break;default:throw new Error("The combination operator "+_+" is not supported")}},t.prototype._onImmediateGenericRegion=function(t,e,i,r){var n=t.info,s=new da(e,i,r),a=this._decodeBitmap(t.mmr,n.width,n.height,t.template,t.prediction,null,t.at,s);this._drawBitmap(n,a)},t.prototype._getCustomHuffmanTable=function(t,e,i){for(var r=0,n=0,s=e.length;n<s;n++){var a=i[e[n]];if(a){if(t===r)return a;r++}}throw new Error("Custom Huffman table not found in the input data.")},t.prototype._getTextRegionHuffmanTables=function(t,e,i,r,n){for(var s=[],a=0;a<=34;a++){var o=n._readBits(4);s.push(new la([a,o,0,0]))}var h=new pa(s,!1);s.length=0;for(a=0;a<r;)if((o=h.decode(n))>=32){var c=void 0,_=void 0,d=void 0;switch(o){case 32:if(0===a)throw new Error("No previous value found in the symbol ID table");_=n._readBits(2)+3,c=s[a-1].prefixLength;break;case 33:_=n._readBits(3)+3,c=0;break;case 34:_=n._readBits(7)+11,c=0;break;default:throw new Error("JBIG2 decoding error: Invalid code length found in the symbol ID table")}for(d=0;d<_;d++)s.push(new la([a,c,0,0])),a++}else s.push(new la([a,o,0,0])),a++;n.byteAlign();var u,l,f,p=new pa(s,!1),g=0;switch(t.huffmanFS){case 0:case 1:u=this._getStandardTable(t.huffmanFS+6);break;case 3:u=this._getCustomHuffmanTable(g,e,i),g++;break;default:throw new Error("Invalid Huffman File Segment Selector: Selector does not match any recognized Huffman-coded segment.")}switch(t.huffmanDS){case 0:case 1:case 2:l=this._getStandardTable(t.huffmanDS+8);break;case 3:l=this._getCustomHuffmanTable(g,e,i),g++;break;default:throw new Error("Jbig2 decode error: Detected invalid Huffman Data Stream selector.")}switch(t.huffmanDT){case 0:case 1:case 2:f=this._getStandardTable(t.huffmanDT+11);break;case 3:f=this._getCustomHuffmanTable(g,e,i),g++;break;default:throw new Error("Invalid Huffman Decoding Table (DT) selector encountered.")}if(t.refinement)throw new Error("Refinement with Huffman encoding is not supported.");return{symbolIDTable:p,tableFirstS:u,tableDeltaS:l,tableDeltaT:f}},t.prototype._getStandardTable=function(t){var e=this._standardTablesCache[t];if(e)return e;var i;switch(t){case 1:i=[[0,1,4,0],[16,2,8,2],[272,3,16,6],[65808,3,32,7]];break;case 2:i=[[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[75,6,32,62],[6,63]];break;case 3:i=[[-256,8,8,254],[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[-257,8,32,255,"lower"],[75,7,32,126],[6,62]];break;case 4:i=[[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[76,5,32,31]];break;case 5:i=[[-255,7,8,126],[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[-256,7,32,127,"lower"],[76,6,32,62]];break;case 6:i=[[-2048,5,10,28],[-1024,4,9,8],[-512,4,8,9],[-256,4,7,10],[-128,5,6,29],[-64,5,5,30],[-32,4,5,11],[0,2,7,0],[128,3,7,2],[256,3,8,3],[512,4,9,12],[1024,4,10,13],[-2049,6,32,62,"lower"],[2048,6,32,63]];break;case 7:i=[[-1024,4,9,8],[-512,3,8,0],[-256,4,7,9],[-128,5,6,26],[-64,5,5,27],[-32,4,5,10],[0,4,5,11],[32,5,5,28],[64,5,6,29],[128,4,7,12],[256,3,8,1],[512,3,9,2],[1024,3,10,3],[-1025,5,32,30,"lower"],[2048,5,32,31]];break;case 8:i=[[-15,8,3,252],[-7,9,1,508],[-5,8,1,253],[-3,9,0,509],[-2,7,0,124],[-1,4,0,10],[0,2,1,0],[2,5,0,26],[3,6,0,58],[4,3,4,4],[20,6,1,59],[22,4,4,11],[38,4,5,12],[70,5,6,27],[134,5,7,28],[262,6,7,60],[390,7,8,125],[646,6,10,61],[-16,9,32,510,"lower"],[1670,9,32,511]];break;case 9:i=[[-31,8,4,252],[-15,9,2,508],[-11,8,2,253],[-7,9,1,509],[-5,7,1,124],[-3,4,1,10],[-1,3,1,2],[1,3,1,3],[3,5,1,26],[5,6,1,58],[7,3,5,4],[39,6,2,59],[43,4,5,11],[75,4,6,12],[139,5,7,27],[267,5,8,28],[523,6,8,60],[779,7,9,125],[1291,6,11,61],[-32,9,32,510,"lower"],[3339,9,32,511]];break;case 10:i=[[-21,7,4,122],[-5,8,0,252],[-4,7,0,123],[-3,5,0,24],[-2,2,2,0],[2,5,0,25],[3,6,0,54],[4,7,0,124],[5,8,0,253],[6,2,6,1],[70,5,5,26],[102,6,5,55],[134,6,6,56],[198,6,7,57],[326,6,8,58],[582,6,9,59],[1094,6,10,60],[2118,7,11,125],[-22,8,32,254,"lower"],[4166,8,32,255]];break;case 11:i=[[1,1,0,0],[2,2,1,2],[4,4,0,12],[5,4,1,13],[7,5,1,28],[9,5,2,29],[13,6,2,60],[17,7,2,122],[21,7,3,123],[29,7,4,124],[45,7,5,125],[77,7,6,126],[141,7,32,127]];break;case 12:i=[[1,1,0,0],[2,2,0,2],[3,3,1,6],[5,5,0,28],[6,5,1,29],[8,6,1,60],[10,7,0,122],[11,7,1,123],[13,7,2,124],[17,7,3,125],[25,7,4,126],[41,8,5,254],[73,8,32,255]];break;case 13:i=[[1,1,0,0],[2,3,0,4],[3,4,0,12],[4,5,0,28],[5,4,1,13],[7,3,3,5],[15,6,1,58],[17,6,2,59],[21,6,3,60],[29,6,4,61],[45,6,5,62],[77,7,6,126],[141,7,32,127]];break;case 14:i=[[-2,3,0,4],[-1,3,0,5],[0,1,0,0],[1,3,0,6],[2,3,0,7]];break;case 15:i=[[-24,7,4,124],[-8,6,2,60],[-4,5,1,28],[-2,4,0,12],[-1,3,0,4],[0,1,0,0],[1,3,0,5],[2,4,0,13],[3,5,1,29],[5,6,2,61],[9,7,4,125],[-25,7,32,126,"lower"],[25,7,32,127]];break;default:throw new Error("Standard table B."+t+" does not exist")}for(var r=0,n=i.length;r<n;r++)i[r]=new la(i[r]);return e=new pa(i,!0),this._standardTablesCache[t]=e,e},t.prototype._getSymbolDictionaryHuffmanTables=function(t,e,i){var r,n,s=0;switch(t.huffmanDHSelector){case 0:case 1:r=this._getStandardTable(t.huffmanDHSelector+4);break;case 3:r=this._getCustomHuffmanTable(s,e,i),s++;break;default:throw new Error("Invalid Huffman DH selector: the provided selector value is not recognized or supported.")}switch(t.huffmanDWSelector){case 0:case 1:n=this._getStandardTable(t.huffmanDWSelector+2);break;case 3:n=this._getCustomHuffmanTable(s,e,i),s++;break;default:throw new Error("Invalid Huffman Dictionary Word selector: failed during decoding process.")}var a,o;return t.bitmapSizeSelector?(a=this._getCustomHuffmanTable(s,e,i),s++):a=this._getStandardTable(1),o=t.aggregationInstancesSelector?this._getCustomHuffmanTable(s,e,i):this._getStandardTable(1),{tableDeltaHeight:r,tableDeltaWidth:n,tableBitmapSize:a,tableAggregateInstances:o}},t.prototype._readUncompressedBitmap=function(t,e,i){for(var r=[],n=0;n<i;n++){var s=new Uint8Array(e);r.push(s);for(var a=0;a<e;a++)s[a]=t._readBit();t.byteAlign()}return r},t.prototype._decodeMmrBitmap=function(t,e,i,r){for(var n,s=new ra(t,{K:-1,Columns:e,Rows:i,BlackIs1:!0,EndOfBlock:r}),a=[],o=!1,h=0;h<i;h++){var c=new Uint8Array(e);a.push(c);for(var _=-1,d=0;d<e;d++)_<0&&(-1===(n=s.readNextChar())&&(n=0,o=!0),_=7),c[d]=n>>_&1,_--}if(r&&!o)for(var u=0;u<5&&-1!==s.readNextChar();u++);return a},t.prototype._onSymbolDictionary=function(t,e,i,r,n,s){var a,o;t.huffman&&(a=this._getSymbolDictionaryHuffmanTables(t,i,this._customTables),o=new ga(r,n,s));var h=this._symbols;h||(this._symbols=h={});for(var c=[],_=0,d=i;_<d.length;_++){var u=h[d[_]];u&&c.push.apply(c,u)}var l=new da(r,n,s);h[e]=this._decodeSymbolDictionary(t.huffman,t.refinement,c,t.numberOfNewSymbols,t.numberOfExportedSymbols,a,t.template,t.at,t.refinementTemplate,t.refinementAt,l,o)},t.prototype._onImmediateTextRegion=function(t,e,i,r,n){for(var s,a,o=t.info,h=this._symbols,c=[],_=0,d=e;_<d.length;_++){var u=d[_],l=h[Number.parseInt(u.toString(),10)];l&&c.push.apply(c,l)}var f=Te(c.length);t.huffman&&(a=new ga(i,r,n),s=this._getTextRegionHuffmanTables(t,e,this._customTables,c.length,a));var p=new da(i,r,n),g=this._decodeTextRegion(t.huffman,t.refinement,o.width,o.height,t.defaultPixelValue,t.numberOfSymbolInstances,t.stripSize,c,f,t.transposed,t.dsOffset,t.referenceCorner,t.combinationOperator,s,t.refinementTemplate,t.refinementAt,p,t.logStripSize,a);this._drawBitmap(o,g)},t.prototype._onPatternDictionary=function(t,e,i,r,n){var s=this._patterns;s||(this._patterns=s={});var a=new da(i,r,n);s[Number.parseInt(e.toString(),10)]=this._decodePatternDictionary(t.mmr,t.patternWidth,t.patternHeight,t.maxPatternIndex,t.template,a)},t.prototype._onImmediateHalftoneRegion=function(t,e,i,r,n){var s=this._patterns[e[0]],a=t.info,o=new da(i,r,n),h=this._decodeHalftoneRegion(t.mmr,s,t.template,a.width,a.height,t.defaultPixelValue,t.enableSkip,t.combinationOperator,t.gridWidth,t.gridHeight,t.gridOffsetX,t.gridOffsetY,t.gridVectorX,t.gridVectorY,o);this._drawBitmap(a,h)},t.prototype._onTables=function(t,e,i,r){var n=this._customTables;n||(this._customTables=n={}),n[Number.parseInt(t.toString(),10)]=this._decodeTablesSegment(e,i,r)},t.prototype._decodeTablesSegment=function(t,e,i){var r,n,s=t[e],a=4294967295&Pe(t,e+1),o=4294967295&Pe(t,e+5),h=new ga(t,e+9,i),c=1+(s>>1&7),_=1+(s>>4&7),d=[],u=a;do{r=h._readBits(c),n=h._readBits(_),d.push(new la([u,r,n,0])),u+=1<<n}while(u<o);return r=h._readBits(c),d.push(new la([a-1,r,32,0,"lower"])),r=h._readBits(c),d.push(new la([o,r,32,0])),1&s&&(r=h._readBits(c),d.push(new la([r,0]))),new pa(d,!1)},t.prototype._decodeBitmapTemplate0=function(t,e,i){var r,n,s,a,o,h,c,_=i.decoder,d=i.contextCache.getContexts("GB"),u=[];for(n=0;n<e;n++)for(o=u[n]=new Uint8Array(t),h=n<1?o:u[n-1],r=(c=n<2?o:u[n-2])[0]<<13|c[1]<<12|c[2]<<11|h[0]<<7|h[1]<<6|h[2]<<5|h[3]<<4,s=0;s<t;s++)o[s]=a=_._readBit(d,r),r=(31735&r)<<1|(s+3<t?c[s+3]<<11:0)|(s+4<t?h[s+4]<<4:0)|a;return u},t.prototype._decodeBitmap=function(t,e,i,r,n,s,a,o){if(t){var h=new ga(o._data,o._start,o._end);return this._decodeMmrBitmap(h,e,i,!1)}if(0===r&&!s&&!n&&4===a.length&&3===a[0].x&&-1===a[0].y&&-3===a[1].x&&-1===a[1].y&&2===a[2].x&&-2===a[2].y&&-2===a[3].x&&-2===a[3].y)return this._decodeBitmapTemplate0(e,i,o);var c=!!s,_=this._codingTemplates[r].concat(a);_.sort(function(t,e){return t.y-e.y||t.x-e.x});var d,u,l=_.length,f=new Int8Array(l),p=new Int8Array(l),g=[],y=0,m=0,b=0,v=0;for(u=0;u<l;u++)f[u]=_[u].x,p[u]=_[u].y,m=Math.min(m,_[u].x),b=Math.max(b,_[u].x),v=Math.min(v,_[u].y),u<l-1&&_[u].y===_[u+1].y&&_[u].x===_[u+1].x-1?y|=1<<l-1-u:g.push(u);var w=g.length,S=new Int8Array(w),x=new Int8Array(w),P=new Uint16Array(w);for(d=0;d<w;d++)u=g[d],S[d]=_[u].x,x[d]=_[u].y,P[d]=1<<l-1-u;for(var A,T,C,k,R,F=-m,I=-v,D=e-b,B=this._reusedContexts[r],L=new Uint8Array(e),O=[],M=o.decoder,E=o.contextCache.getContexts("GB"),N=0,j=0,V=0;V<i;V++)if(n&&(N^=M._readBit(E,B)))O.push(L);else for(L=new Uint8Array(L),O.push(L),A=0;A<e;A++)if(c&&s[V][A])L[A]=0;else{if(A>=F&&A<D&&V>=I)for(j=j<<1&y,u=0;u<w;u++)T=V+x[u],C=A+S[u],(k=O[T][C])&&(j|=k=P[u]);else for(j=0,R=l-1,u=0;u<l;u++,R--)(C=A+f[u])>=0&&C<e&&(T=V+p[u])>=0&&(k=O[T][C])&&(j|=k<<R);var z=M._readBit(E,j);L[A]=z}return O},t.prototype._decodeRefinement=function(t,e,i,r,n,s,a,o,h){var c=this._refinementTemplates[i].coding;0===i&&(c=c.concat([o[0]]));for(var _=c.length,d=new Int32Array(_),u=new Int32Array(_),l=0;l<_;l++)d[l]=c[l].x,u[l]=c[l].y;var f=this._refinementTemplates[i].reference;0===i&&(f=f.concat([o[1]]));for(var p=f.length,g=new Int32Array(p),y=new Int32Array(p),l=0;l<p;l++)g[l]=f[l].x,y[l]=f[l].y;for(var m=r[0].length,b=r.length,v=this._refinementReusedContexts[i],w=[],S=h.decoder,x=h.contextCache.getContexts("GR"),P=0,A=0;A<e;A++){if(a&&(P^=S._readBit(x,v)))throw new Error("Prediction functionality is not supported.");var T=new Uint8Array(t);w.push(T);for(var C=0;C<t;C++){for(var k=void 0,R=void 0,F=0,l=0;l<_;l++)k=A+u[l],R=C+d[l],k<0||R<0||R>=t?F<<=1:F=F<<1|w[k][R];for(l=0;l<p;l++)k=A+y[l]-s,R=C+g[l]-n,k<0||k>=b||R<0||R>=m?F<<=1:F=F<<1|r[k][R];var I=S._readBit(x,F);T[C]=I}}return w},t.prototype._decodeSymbolDictionary=function(t,e,i,r,n,s,a,o,h,c,_,d){if(t&&e)throw new Error("Huffman coding with symbol refinement is not supported.");var u,l=[],f=0,p=Te(i.length+r),g=_.decoder,y=_.contextCache,m=[];for(t&&(u=this._getStandardTable(1),p=Math.max(p,1));l.length<r;){f+=t?s.tableDeltaHeight.decode(d):this._decodeInteger(y,"IADH",g);for(var b=0,v=0,w=t?m.length:0;;){var S=t?s.tableDeltaWidth.decode(d):this._decodeInteger(y,"IADW",g);if(void 0===S)break;v+=b+=S;var x=void 0;if(e){var P=this._decodeInteger(y,"IAAI",g);if(P>1)x=this._decodeTextRegion(t,e,b,f,0,P,1,i.concat(l),p,0,0,1,0,s,h,c,_,0,d);else{var A=this._decodeImageData(y,g,p),T=this._decodeInteger(y,"IARDX",g),C=this._decodeInteger(y,"IARDY",g),k=A<i.length?i[A]:l[A-i.length];x=this._decodeRefinement(b,f,h,k,T,C,!1,c,_)}l.push(x)}else t?m.push(b):(x=this._decodeBitmap(!1,b,f,a,!1,null,o,_),l.push(x))}if(t&&!e){var R=s.tableBitmapSize.decode(d);d.byteAlign();var F=void 0;if(0===R)F=this._readUncompressedBitmap(d,v,f);else{var I=d.end,D=d.position+R;d.end=D,F=this._decodeMmrBitmap(d,v,f,!1),d.end=I,d.position=D}var B=m.length;if(w===B-1)l.push(F);else for(var L=0,O=void 0,M=void 0,E=w;E<B;E++){O=L+m[E],M=[];for(var N=0;N<f;N++)M.push(F[N].subarray(L,O));l.push(M),L=O}}}for(var j=[],V=[],z=!1,U=0,H=i.length+r;V.length<H;){for(var W=t?u.decode(d):this._decodeInteger(y,"IAEX",g);W--;)V.push(z);z=!z}for(var q=0;q<i.length;q++)V[q]&&j.push(i[q]);for(var G=0;G<r;G++,U++)V[U]&&j.push(l[G]);return j},t.prototype._decodeInteger=function(t,e,i){var r,n=t.getContexts(e),s=new ca,a=s._readBits(1,i,n),o=s._readBits(1,i,n)?s._readBits(1,i,n)?s._readBits(1,i,n)?s._readBits(1,i,n)?s._readBits(1,i,n)?s._readBits(32,i,n)+4436:s._readBits(12,i,n)+340:s._readBits(8,i,n)+84:s._readBits(6,i,n)+20:s._readBits(4,i,n)+4:s._readBits(2,i,n);if(0===a?r=o:o>0&&(r=-o),r>=-Math.pow(2,31)&&r<=Math.pow(2,31)-1)return r},t.prototype._decodeImageData=function(t,e,i){for(var r=t.getContexts("IAID"),n=1,s=0;s<i;s++)n=n<<1|e._readBit(r,n);return i<31?n&(1<<i)-1:2147483647&n},t.prototype._decodeTextRegion=function(t,e,i,r,n,s,a,o,h,c,_,d,u,l,f,p,g,y,m){if(t&&e)throw new Error("Huffman encoding with refinement is currently not supported.");for(var b=[],v=0;v<r;v++){var w=new Uint8Array(i);n&&w.fill(n),b.push(w)}for(var S=g.decoder,x=g.contextCache,P=t?-l.tableDeltaT.decode(m):-this._decodeInteger(x,"IADT",S),A=0,T=0;T<s;){P+=t?l.tableDeltaT.decode(m):this._decodeInteger(x,"IADT",S);for(var C=A+=t?l.tableFirstS.decode(m):this._decodeInteger(x,"IAFS",S);;){var k=0;a>1&&(k=t?m._readBits(y):this._decodeInteger(x,"IAIT",S));var R=a*P+k,F=t?l.symbolIDTable.decode(m):this._decodeImageData(x,S,h),I=e&&(t?m._readBit():this._decodeInteger(x,"IARI",S)),D=o[F],B=D[0].length,L=D.length;if(I){var O=this._decodeInteger(x,"IARDW",S),M=this._decodeInteger(x,"IARDH",S),E=this._decodeInteger(x,"IARDX",S),N=this._decodeInteger(x,"IARDY",S);B+=O,L+=M,D=this._decodeRefinement(B,L,f,D,(O>>1)+E,(M>>1)+N,!1,p,g)}var j=0;c?1&d?j=L-1:C+=L-1:d>1?C+=B-1:j=B-1;var V=R-(1&d?0:L-1),z=C-(2&d?B-1:0),U=void 0,H=void 0,W=void 0;if(c){for(U=0;U<L;U++)if(w=b[z+U]){W=D[U];var q=Math.min(i-V,B);switch(u){case 0:for(H=0;H<q;H++)w[V+H]|=W[H];break;case 2:for(H=0;H<q;H++)w[V+H]^=W[H];break;default:throw new Error("The combination operator "+u+" is not supported.")}}}else for(H=0;H<L;H++)if(w=b[V+H])switch(W=D[H],u){case 0:for(U=0;U<B;U++)w[z+U]|=W[U];break;case 2:for(U=0;U<B;U++)w[z+U]^=W[U];break;default:throw new Error("The combination operator "+u+" is not supported.")}T++;var G=t?l.tableDeltaS.decode(m):this._decodeInteger(x,"IADS",S);if(null===G||void 0===G)break;C+=j+G+_}}return b},t.prototype._decodePatternDictionary=function(t,e,i,r,n,s){var a=[];t||(a.push({x:-e,y:0}),0===n&&a.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2}));for(var o=(r+1)*e,h=this._decodeBitmap(t,o,i,n,!1,null,a,s),c=[],_=0;_<=r;_++){for(var d=[],u=e*_,l=u+e,f=0;f<i;f++)d.push(h[f].subarray(u,l));c.push(d)}return c},t.prototype._decodeHalftoneRegion=function(t,e,i,r,n,s,a,o,h,c,_,d,u,l,f){if(a)throw new Error("Operation failed: skip is not implemented or allowed here.");if(0!==o)throw new Error("The operator '"+o+"' is not supported in halftone region");for(var p=[],g=0;g<n;g++){var y=new Uint8Array(r);s&&y.fill(s),p.push(y)}var m=e.length,b=e[0],v=b[0].length,w=b.length,S=Te(m),x=[];t||(x.push({x:i<=1?3:2,y:-1}),0===i&&x.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2}));var P,A,T=[];t&&(P=new ga(f.data,f.start,f.end));for(g=S-1;g>=0;g--)A=t?this._decodeMmrBitmap(P,h,c,!0):this._decodeBitmap(!1,h,c,i,!1,null,x,f),T[g]=A;for(var C=0;C<c;C++)for(var k=0;k<h;k++){for(var R=0,F=0,I=S-1;I>=0;I--)F|=(R^=T[I][C][k])<<I;var D=e[F],B=_+C*l+k*u>>8,L=d+C*u-k*l>>8;if(B>=0&&B+v<=r&&L>=0&&L+w<=n)for(g=0;g<w;g++)for(var O=p[L+g],M=D[g],I=0;I<v;I++)O[B+I]|=M[I];else for(var E=void 0,N=void 0,g=0;g<w;g++)if(!((N=L+g)<0||N>=n))for(var O=p[N],M=D[g],I=0;I<v;I++)(E=B+I)>=0&&E<r&&(O[E]|=M[I])}return p},t}(),la=function(){function t(t){2===t.length?(this.isoob=!0,this.rangeLow=0,this.prefixLength=t[0],this.rangeLength=0,this.prefixCode=t[1],this.isLowerRange=!1):(this.isoob=!1,this.rangeLow=t[0],this.prefixLength=t[1],this.rangeLength=t[2],this.prefixCode=t[3],this.isLowerRange="lower"===t[4])}return t}(),fa=function(){function t(t){this.children=[],t?(this.isLeaf=!0,this.rangeLength=t.rangeLength,this.rangeLow=t.rangeLow,this.isLowerRange=t.isLowerRange,this.isoob=t.isoob):this.isLeaf=!1}return t.prototype._buildTree=function(e,i){var r=e.prefixCode>>i&1;if(i<=0)this.children[r]=new t(e);else{var n=this.children[r];n||(this.children[r]=n=new t(null)),n._buildTree(e,i-1)}},t.prototype._decodeNode=function(t){if(this.isLeaf){if(this.isoob)return null;var e=t._readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-e:e)}var i=this.children[t._readBit()];if(!i)throw new Error("Failed to decode: Huffman data is invalid or corrupted.");return i._decodeNode(t)},t}(),pa=function(){function t(t,e){e||this.assignPrefixCodes(t),this.rootNode=new fa(null);for(var i=0,r=t.length;i<r;i++){var n=t[i];n.prefixLength>0&&this.rootNode._buildTree(n,n.prefixLength-1)}}return t.prototype.decode=function(t){return this.rootNode._decodeNode(t)},t.prototype.assignPrefixCodes=function(t){for(var e=t.length,i=0,r=0;r<e;r++)i=Math.max(i,t[r].prefixLength);for(var n=new Uint32Array(i+1),r=0;r<e;r++)n[t[r].prefixLength]++;var s,a,o,h=1,c=0;for(n[0]=0;h<=i;){for(s=c=c+n[h-1]<<1,a=0;a<e;)(o=t[a]).prefixLength===h&&(o.prefixCode=s,s++),a++;h++}},t}(),ga=function(){function t(t,e,i){this.data=t,this.start=e,this.end=i,this.position=e,this.shift=-1,this.currentByte=0}return t.prototype._readBit=function(){if(this.shift<0){if(this.position>=this.end)throw new Error("Unexpected end of input: No more data available while attempting to read a bit.");this.currentByte=this.data[this.position++],this.shift=7}var t=this.currentByte>>this.shift&1;return this.shift--,t},t.prototype._readBits=function(t){for(var e=0,i=t-1;i>=0;i--)e|=this._readBit()<<i;return e},t.prototype.byteAlign=function(){this.shift=-1},t.prototype.next=function(){return this.position>=this.end?-1:this.data[this.position++]},t}(),ya=function(){function t(){this._regionSegmentInformationFieldLength=17,this._segmentTypes=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"PatternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"]}return t.prototype._parseChunks=function(t){return this._parseJbig2Chunks(t)},t.prototype._parse=function(t){var e=this._parseJbig2(t),i=e.imgData,r=e.width,n=e.height;return this.width=r,this.height=n,i},t.prototype._processSegments=function(t,e){for(var i=0,r=t.length;i<r;i++)this._processSegment(t[i],e)},t.prototype._parseJbig2=function(t){var e=t.length,i=0;if(151!==t[i]||74!==t[i+1]||66!==t[i+2]||50!==t[i+3]||13!==t[i+4]||10!==t[i+5]||26!==t[i+6]||10!==t[i+7])throw new Error("JBIG2 parsing error: The image header is invalid or malformed.");var r=Object.create(null);i+=8;var n=t[i++];r.randomAccess=!(1&n),2&n||(r.numberOfPages=Pe(t,i),i+=4);var s=this._readSegments(r,t,i,e),a=new ua;this._processSegments(s,a);for(var o=a._currentPageInfo,h=o.width,c=o.height,_=a._buffer,d=new Uint8ClampedArray(h*c),u=0,l=0,f=0;f<c;f++)for(var p=0,g=void 0,y=0;y<h;y++)p||(p=128,g=_[l++]),d[u++]=g&p?0:255,p>>=1;return{imgData:d,width:h,height:c}},t.prototype._parseJbig2Chunks=function(t){for(var e=new ua,i=0,r=t.length;i<r;i++){var n=t[i],s=this._readSegments({},n.data,n.start,n.end);this._processSegments(s,e)}return e._buffer},t.prototype._readSegmentHeader=function(t,e){var i={number:Pe(t,e),type:0,typeName:null,deferredNonRetain:!1,retainBits:[],pageAssociation:0,length:0,referredTo:[],headerEnd:e},r=t[e+4],n=63&r;if(!this._segmentTypes[n])throw new Error("JBIG2 decoding error: Encountered an unknown or unsupported segment type"+n);i.type=n,i.typeName=this._segmentTypes[n],i.deferredNonRetain=!!(128&r);var s=!!(64&r),a=t[e+5],o=a>>5&7,h=[31&a],c=e+6;if(7===a){o=536870911&Pe(t,c-1),c+=3;var _=o+7>>3;for(h[0]=t[c++];--_>0;)h.push(t[c++])}else if(5===a||6===a)throw new Error("JBIG2 decoding error: Encountered invalid or malformed referred-to flags in the segment header.");i.retainBits=h;var d=4;i.number<=256?d=1:i.number<=65536&&(d=2);for(var u=[],l=0;l<o;l++){var f=void 0;f=1===d?t[c]:2===d?Se(t,c):Pe(t,c),u.push(f),c+=d}if(i.referredTo=u,s?(i.pageAssociation=Pe(t,c),c+=4):i.pageAssociation=t[c++],i.length=Pe(t,c),c+=4,4294967295===i.length){if(38!==n)throw new Error("Segment length is unknown or invalid");var p=this._readRegionSegmentInformation(t,c),g=!!(1&t[c+this._regionSegmentInformationFieldLength]),y=new Uint8Array(6);g||(y[0]=255,y[1]=172),y[2]=p.height>>>24&255,y[3]=p.height>>16&255,y[4]=p.height>>8&255,y[5]=255&p.height;for(var l=c,m=t.length;l<m;l++){for(var b=0;b<6&&y[b]===t[l+b];)b++;if(6===b){i.length=l+6;break}}if(4294967295===i.length)throw new Error("Decoding error: Unable to find the end of the segment")}return i.headerEnd=c,i},t.prototype._readSegments=function(t,e,i,r){for(var n=[],s=i;s<r;){var a=this._readSegmentHeader(e,s);s=a.headerEnd;var o={header:a,data:e};if(t.randomAccess||(o.start=s,s+=a.length,o.end=s),n.push(o),51===a.type)break}if(t.randomAccess)for(var h=0,c=n.length;h<c;h++)n[h].start=s,s+=n[h].header.length,n[h].end=s;return n},t.prototype._processSegment=function(t,e){var i,r,n,s,a,o,h,c,_,d,u,l,f,p,g,y,m=t.header,b=t.data,v=t.end,w=t.start;switch(m.type){case 0:if(i={},r=Se(b,w),i.huffman=!!(1&r),i.refinement=!!(2&r),i.huffmanDHSelector=r>>2&3,i.huffmanDWSelector=r>>4&3,i.bitmapSizeSelector=r>>6&1,i.aggregationInstancesSelector=r>>7&1,i.bitmapCodingContextUsed=!!(256&r),i.bitmapCodingContextRetained=!!(512&r),i.template=r>>10&3,i.refinementTemplate=r>>12&1,w+=2,!i.huffman){for(y=0===i.template?4:1,p=[],g=0;g<y;g++)p.push({x:Ae(b,w),y:Ae(b,w+1)}),w+=2;i.at=p}if(i.refinement&&!i.refinementTemplate){for(p=[],g=0;g<2;g++)p.push({x:Ae(b,w),y:Ae(b,w+1)}),w+=2;i.refinementAt=p}i.numberOfExportedSymbols=Pe(b,w),w+=4,i.numberOfNewSymbols=Pe(b,w),w+=4,f=[i,m.number,m.referredTo,b,w,v];break;case 6:case 7:if(n={},n.info=this._readRegionSegmentInformation(b,w),w+=this._regionSegmentInformationFieldLength,l=Se(b,w),w+=2,n.huffman=!!(1&l),n.refinement=!!(2&l),n.logStripSize=l>>2&3,n.stripSize=1<<n.logStripSize,n.referenceCorner=l>>4&3,n.transposed=!!(64&l),n.combinationOperator=l>>7&3,n.defaultPixelValue=l>>9&1,n.dsOffset=l<<17>>27,n.refinementTemplate=l>>15&1,n.huffman){var S=Se(b,w);w+=2,n.huffmanFS=3&S,n.huffmanDS=S>>2&3,n.huffmanDT=S>>4&3,n.huffmanRefinementDW=S>>6&3,n.huffmanRefinementDH=S>>8&3,n.huffmanRefinementDX=S>>10&3,n.huffmanRefinementDY=S>>12&3,n.huffmanRefinementSizeSelector=!!(16384&S)}if(n.refinement&&!n.refinementTemplate){for(p=[],g=0;g<2;g++)p.push({x:Ae(b,w),y:Ae(b,w+1)}),w+=2;n.refinementAt=p}n.numberOfSymbolInstances=Pe(b,w),w+=4,f=[n,m.referredTo,b,w,v];break;case 16:s={},a=b[w++],s.mmr=!!(1&a),s.template=a>>1&3,s.patternWidth=b[w++],s.patternHeight=b[w++],s.maxPatternIndex=Pe(b,w),w+=4,f=[s,m.number,b,w,v];break;case 22:case 23:(o={}).info=this._readRegionSegmentInformation(b,w),w+=this._regionSegmentInformationFieldLength,h=b[w++],o.mmr=!!(1&h),o.template=h>>1&3,o.enableSkip=!!(8&h),o.combinationOperator=h>>4&7,o.defaultPixelValue=h>>7&1,o.gridWidth=Pe(b,w),w+=4,o.gridHeight=Pe(b,w),w+=4,o.gridOffsetX=4294967295&Pe(b,w),w+=4,o.gridOffsetY=4294967295&Pe(b,w),w+=4,o.gridVectorX=Se(b,w),w+=2,o.gridVectorY=Se(b,w),w+=2,f=[o,m.referredTo,b,w,v];break;case 38:case 39:if(c={},c.info=this._readRegionSegmentInformation(b,w),w+=this._regionSegmentInformationFieldLength,_=b[w++],c.mmr=!!(1&_),c.template=_>>1&3,c.prediction=!!(8&_),!c.mmr){for(y=0===c.template?4:1,p=[],g=0;g<y;g++)p.push({x:Ae(b,w),y:Ae(b,w+1)}),w+=2;c.at=p}f=[c,b,w,v];break;case 48:4294967295===(d={width:Pe(b,w),height:Pe(b,w+4),resolutionX:Pe(b,w+8),resolutionY:Pe(b,w+12)}).height&&delete d.height,u=b[w+16],Se(b,w+17),d.lossless=!!(1&u),d.refinement=!!(2&u),d.defaultPixelValue=u>>2&1,d.combinationOperator=u>>3&3,d.requiresBuffer=!!(32&u),d.combinationOperatorOverride=!!(64&u),f=[d];break;case 49:case 50:case 51:break;case 53:f=[m.number,b,w,v];break;case 62:break;default:throw new Error("Segment type "+m.typeName+"("+m.type+") is not implemented")}var x="_on"+m.typeName;"_onImmediateLosslessGenericRegion"===x?e._onImmediateGenericRegion(f[0],f[1],f[2],f[3],f[4]):"_onImmediateLosslessTextRegion"===x?e._onImmediateTextRegion(f[0],f[1],f[2],f[3],f[4]):"_onImmediateLosslessHalftoneRegion"===x?e._onImmediateHalftoneRegion(f[0],f[1],f[2],f[3],f[4]):"_onPageInformation"===x?e._onPageInformation(f):"_onSymbolDictionary"===x&&e._onSymbolDictionary(f[0],f[1],f[2],f[3],f[4],f[5])},t.prototype._readRegionSegmentInformation=function(t,e){return{width:Pe(t,e),height:Pe(t,e+4),x:Pe(t,e+8),y:Pe(t,e+12),combinationOperator:7&t[e+16]}},t}(),ma=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)}}(),ba=function(t){function e(e,i,r){var n=t.call(this,i)||this;return n.stream=e,n.maybeLength=i,n.params=r,n}return ma(e,t),Object.defineProperty(e.prototype,"bytes",{get:function(){return this.stream.getBytes(this.maybeLength)},enumerable:!0,configurable:!0}),e.prototype.readBlock=function(){this.decodeImage()},e.prototype.decodeImage=function(t){if(this.eof)return this.buffer;t=t||this.bytes;var e=new ya,i=[];if(this.params instanceof Ts){var r=this.params.get("JBIG2Globals");if(r instanceof Rs){var n=r.getBytes();i.push({data:n,start:0,end:n.length})}}i.push({data:t,start:0,end:t.length});for(var s=e._parseChunks(i),a=s.length,o=0;o<a;o++)s[o]^=255;return this.buffer=s,this.bufferLength=a,this.eof=!0,this.buffer},e}(Ls),va=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)}}(),wa=function(){function t(){}return t}(),Sa=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 va(e,t),Object.defineProperty(e.prototype,"_mixCol",{get:function(){if(void 0===this._mixC||null===this._mixC){this._mixC=new Uint8Array(256);for(var t=0;t<256;t++)this._mixC[t]=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[a]^=e[o];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[a]=this._inverseS[s[a]];for(var a=0,o=16*h;a<16;++a,++o)s[a]^=e[o];for(a=0;a<16;a+=4){var c=this._mix[s[a]],_=this._mix[s[a+1]],d=this._mix[s[a+2]],u=this._mix[s[a+3]];i=c^_>>>8^_<<24^d>>>16^d<<16^u>>>24^u<<8,s[a]=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[a]=this._inverseS[s[a]],s[a]^=e[a];return s},e.prototype._encryptBlock=function(t,e){var i,r,n,s=this._s,a=new Uint8Array(16);a.set(t);for(u=0;u<16;++u)a[u]^=e[u];for(var o=1;o<this._cyclesOfRepetition;o++){for(u=0;u<16;++u)a[u]=s[a[u]];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(u=0;u<16;u+=4){var h=a[u+0],c=a[u+1],_=a[u+2],d=a[u+3];i=h^c^_^d,a[u+0]^=i^this._mixCol[h^c],a[u+1]^=i^this._mixCol[c^_],a[u+2]^=i^this._mixCol[_^d],a[u+3]^=i^this._mixCol[d^h]}for(var u=0,l=16*o;u<16;++u,++l)a[u]^=e[l]}for(u=0;u<16;++u)a[u]=s[a[u]];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 u=0,l=this._keySize;u<16;++u,++l)a[u]^=e[l];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[n]=t[o],!(++n<16)){for(var h=this._decrypt(r,this._key),c=0;c<16;++c)h[c]^=a[c];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],u=d[15];if(u<=16){for(var o=15,l=16-u;o>=l;--o)if(d[o]!==u){u=0;break}_-=u,s[s.length-1]=d.subarray(0,16-u)}}for(var f=new Uint8Array(_),o=0,c=0;o<s.length;++o,c+=16)f.set(s[o],c);return f},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[s]=t[a];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[n]=t[c],!(++n<16)){for(_=0;_<16;++_)r[_]^=e[_];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[c],_);return h},e}(wa),xa=function(){function t(t,e){this._stringCipher=t,this._streamCipher=e}return t.prototype.createStream=function(t,e){return new Ms(t,e,this._streamCipher)},t.prototype.decryptString=function(t){var e=f(t,!1,!0);return v(this._stringCipher._decryptBlock(e,!0))},t.prototype.encryptString=function(t){if(this._stringCipher instanceof Sa){var e=16-t.length%16;t+=String.fromCharCode(e).repeat(e);var i=new Uint8Array(16);if("undefined"!=typeof crypto&&null!==crypto)crypto.getRandomValues(i);else for(var r=0;r<16;r++)i[r]=Math.floor(256*Math.random());var n=this._stringCipher._encrypt(f(t,!1,!0),i),s=new Uint8Array(16+n.length);return s.set(i),s.set(n,16),v(s)}return v(this._stringCipher._encrypt(f(t,!1,!0)))},t}(),Pa=function(){function t(t,e){void 0===e&&(e=!0),this.blockSize=8,this._byteBit=[128,64,32,16,8,4,2,1],this._bigByte=[8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1],this._sp1=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],this._sp2=[2148565024,2147516416,32768,1081376,1048576,32,2148532256,2147516448,2147483680,2148565024,2148564992,2147483648,2147516416,1048576,32,2148532256,1081344,1048608,2147516448,0,2147483648,32768,1081376,2148532224,1048608,2147483680,0,1081344,32800,2148564992,2148532224,32800,0,1081376,2148532256,1048576,2147516448,2148532224,2148564992,32768,2148532224,2147516416,32,2148565024,1081376,32,32768,2147483648,32800,2148564992,1048576,2147483680,1048608,2147516448,2147483680,1048608,1081344,0,2147516416,32800,2147483648,2148532256,2148565024,1081344],this._sp3=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],this._sp4=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],this._sp5=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],this._sp6=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],this._sp7=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],this._sp8=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],this._pc1=[56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3],this._rotationTable=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],this._pc2=[13,16,10,23,0,4,2,27,14,5,20,9,22,18,11,3,25,7,15,6,26,19,12,1,40,51,30,36,46,54,29,39,50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31],this._keys=[],this._keys=this._generateWorkingKey(e,t)}return t.prototype._beToUint32=function(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0},t.prototype._uint32ToBe=function(t,e,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t},t.prototype._generateWorkingKey=function(t,e){for(var i=new Array(32).fill(0),r=new Array(56).fill(!1),n=new Array(56).fill(!1),s=0;s<56;s++){var a=this._pc1[s];r[s]=0!=(e[a>>3]&this._byteBit[7&a])}for(_=0;_<16;_++){var o=t?_<<1:15-_<<1,h=o+1;i[o]=i[h]=0;for(s=0;s<28;s++){c=s+this._rotationTable[_];n[s]=c<28?r[c]:r[c-28]}for(s=28;s<56;s++){var c=s+this._rotationTable[_];n[s]=c<56?r[c]:r[c-28]}for(s=0;s<24;s++)n[this._pc2[s]]&&(i[o]|=this._bigByte[s]),n[this._pc2[s+24]]&&(i[h]|=this._bigByte[s])}for(var _=0;32!==_;_+=2){var d=i[_],u=i[_+1];i[_]=(16515072&d)<<6|(4032&d)<<10|(16515072&u)>>>10|(4032&u)>>>6,i[_+1]=(258048&d)<<12|(63&d)<<16|(258048&u)>>>4|63&u}return i},t.prototype._processBlock=function(t,e,i,r){var n=this._beToUint32(t,e)>>>0,s=this._beToUint32(t,e+4)>>>0,a=252645135&(n>>>4^s);s^=a,s^=a=65535&((n^=a<<4)>>>16^s),s^=(a=858993459&(s>>>2^(n^=a<<16)))<<2,s=((s^=(a=16711935&(s>>>8^(n^=a)))<<8)<<1|s>>>31)>>>0,s^=a=2863311530&((n^=a)^s),n=((n^=a)<<1|n>>>31)>>>0;for(var o=0;o<8;o++){a=(s<<28|s>>>4)>>>0,a^=this._keys[4*o+0];var h=this._sp7[63&a]|this._sp5[a>>>8&63]|this._sp3[a>>>16&63]|this._sp1[a>>>24&63];a=(s^this._keys[4*o+1])>>>0,a=((n^=h|=this._sp8[63&a]|this._sp6[a>>>8&63]|this._sp4[a>>>16&63]|this._sp2[a>>>24&63])<<28|n>>>4)>>>0,a^=this._keys[4*o+2],h=this._sp7[63&a]|this._sp5[a>>>8&63]|this._sp3[a>>>16&63]|this._sp1[a>>>24&63],a=(n^this._keys[4*o+3])>>>0,s^=h|=this._sp8[63&a]|this._sp6[a>>>8&63]|this._sp4[a>>>16&63]|this._sp2[a>>>24&63]}n=((n^=a=2863311530&(n^(s=(s<<31|s>>>1)>>>0)))<<31|n>>>1)>>>0,n^=(a=16711935&(n>>>8^(s^=a)))<<8,n^=(a=858993459&(n>>>2^(s^=a)))<<2,n^=a=65535&((s^=a)>>>16^n),n^=a=252645135&((s^=a<<16)>>>4^n),s^=a<<4,this._uint32ToBe(s,i,r),this._uint32ToBe(n,i,r+4)},t}(),Aa=[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],Ta=function(){function t(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1),this.stream=t,this.nextChar(),this.stringBuffer=[],this._hexStringNumber=0,this.beginInlineImagePosition=-1,this._isFormsDataFormat=e,this._isAnnotationImport=i}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(C(t)||-1===t){if(10===i&&0===r)return 0;if(0===i&&-1===r)return 0}throw new ps("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;i.length=0;var r=["Root","T","V"];for(t=this.nextChar();t>=0;)if(!this._isFormsDataFormat||32!==t||r.indexOf(i.join(""))>=0||this._isAnnotationImport){if(Aa[t])break;if(35===t){if(t=this.nextChar(),Aa[t]){i.push("#");break}var n=this._toHexDigit(t);if(-1!==n){e=t,t=this.nextChar();var s=this._toHexDigit(t);if(-1===s){if(i.push("#",String.fromCharCode(e)),Aa[t])break;i.push(String.fromCharCode(t)),t=this.nextChar();continue}i.push(String.fromCharCode(n<<4|s))}else i.push("#",String.fromCharCode(t))}else i.push(String.fromCharCode(t));t=this.nextChar()}else{var a=this.peekChar();Aa[a]||i.push(String.fromCharCode(t)),t=this.nextChar()}return vs.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!==Aa[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){if(10!==e&&13!==e||(t=!1),92===e)break}else if(37===e)t=!0;else if(92===e){var i=this.peekChar();if(114===i||110===i)break}else if(1!==Aa[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(),ws.get("[");case 93:return this.nextChar(),ws.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),ws.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),ws.get(">>")):ws.get(">");case 123:return this.nextChar(),ws.get("{");case 125:return this.nextChar(),ws.get("}");case 41:throw this.nextChar(),new ps("Illegal character: "+e)}var r=String.fromCharCode(e);if(e<32||e>127){var n=this.peekChar();if(n>=32&&n<=127)return this.nextChar(),ws.get(r)}for(e=this.nextChar();e>=0&&!Aa[e];){var s=r+String.fromCharCode(e);if(!this._isFormsDataFormat&&128===r.length)throw new ps("Command token too long: "+r.length);r=s,e=this.nextChar()}return"true"===r||"false"!==r&&("null"===r?null:("BI"===r&&(this.beginInlineImagePosition=this.stream.position),ws.get(r)))},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}(),Ca=function(){function t(t,e,i,r,n){void 0===i&&(i=!1),void 0===r&&(r=!1),this._isColorSpace=!1,this._isPassword=!1,this._isImageExtraction=!1,this.lexicalOperator=t,this.xref=e,this.allowStreams=i,this.recoveryMode=r,this.imageCache=new Map,this._encryptor=n,this.refill()}return t.prototype.refill=function(){this.first=this.lexicalOperator.getObject(),this.second=this.lexicalOperator.getObject()},t.prototype.shift=function(){this.second instanceof ws&&"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,e,i){var r,n=this.first;if(this.shift(),n instanceof ws)switch(n.command){case"BI":return"number"==typeof t&&"number"==typeof e?this.makeInlineImage(t,e,i):t instanceof xa?this.makeInlineImage(t):this.makeInlineImage();case"[":for(var s=[];!ri(this.first,"]")&&"EOF"!==this.first;){var a=void 0;"number"==typeof t&&"number"==typeof e?(r=this._encryptor._createCipherTransform(t,e),a=this.getObject(t,e,i)):t instanceof xa?(r=t,a=this.getObject(t)):a=this.getObject(t),0===s.length&&ii(a,"Indexed")&&(this._isColorSpace=!0),a=ie(a,this._isColorSpace,this._isPassword),s.push(a)}if("EOF"===this.first){if(this.recoveryMode)return s;throw new gs("End of file inside array.")}return this._isColorSpace=!1,this.shift(),s;case"<<":for(var o=new Ts(this.xref);!ri(this.first,">>")&&"EOF"!==this.first;)if(this.first instanceof vs){var h=this.first.name;if("U"!==h&&"O"!==h&&"ID"!==h||(this._isPassword=!0),this.shift(),this._checkEnd()||ri(this.first,">>")&&ri(this.second,"stream"))break;"number"==typeof t&&"number"==typeof e&&(r=this._encryptor._createCipherTransform(t,e));var c=void 0;if(c="number"==typeof t&&"number"==typeof e?this.getObject(t,e,i):t instanceof xa?this.getObject(t):this.getObject(),(c=ie(c,this._isColorSpace,this._isPassword))&&c instanceof vs){var _=c.name;_.includes("#20")&&(c.name=_.replace(/#20/g," "))}this._isPassword=!1,o.set(h,c)}else this.shift();if("EOF"===this.first){if(this.recoveryMode)return o;throw new gs("End of file inside dictionary.")}return ri(this.second,"stream")?!0===this.allowStreams?(t instanceof xa?r=t:i&&"number"==typeof e&&(r=this._encryptor._createCipherTransform(t,e)),"boolean"==typeof e&&e?this.makeStream(o,r,e):this.makeStream(o,r)):o:(this.shift(),o);default:return n}if(Number.isInteger(n)){if(Number.isInteger(this.first)&&ri(this.second,"R")){var d=Ss.get(n,this.first);return this.shift(),this.shift(),d}return n}return"string"==typeof n?(t instanceof xa?r=t:"number"==typeof t&&"number"==typeof e&&(r=this._encryptor._createCipherTransform(t,e)),r?r.decryptString(n):n):n},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();C(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,e,i){var r,n,s=this.lexicalOperator,a=s.stream,o=new Ts(this.xref);for(i&&(n=t instanceof xa?t:this._encryptor._createCipherTransform(t,e));!ri(this.first,"ID")&&"EOF"!==this.first;){if(!(this.first instanceof vs))throw new ps("Dictionary key must be a name object");var h=this.first.name;if(this.shift(),"EOF"===this.first.name)break;t instanceof xa?o.set(h,this.getObject(t)):o.set(h,this.getObject(t,e,i))}-1!==s.beginInlineImagePosition&&(r=a.position-s.beginInlineImagePosition);var c,_=o.get("F","Filter");if(_ instanceof vs)c=_.name;else if(Array.isArray(_)){var d=_[0],u=null!==d&&void 0!==d&&d instanceof Ss?this.xref._fetch(d):d;u&&(c=u.name)}var l,f=a.position;switch(c){case"DCT":case"DCTDecode":l=this.findDiscreteDecodeInlineStreamEnd(a);break;case"A85":case"ASCII85Decode":l=this.findDecodeInlineStreamEnd(a);break;case"AHx":case"ASCIIHexDecode":l=this.findHexDecodeInlineStreamEnd(a);break;default:l=this.findDefaultInlineStreamEnd(a)}var p,g=a.makeSubStream(f,l,o);if(l<1e3&&r<5552){var y=g.getBytes();g.reset();var m=a.position;a.position=s.beginInlineImagePosition;var b=a.getBytes(r);a.position=m,p=this._computeMaxNumber(y)+"_"+this._computeMaxNumber(b);var v=this.imageCache.get(p);if(void 0!==v)return this.second=ws.get("EI"),this.shift(),v.reset(),v}return n&&(g=n.createStream(g,l)),g=this.filter(g,o,l),g.dictionary=o,void 0!==p&&this.imageCache.set(p,g),this.second=ws.get("EI"),this.shift(),g},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,i){void 0===i&&(i=!1);var r=this.lexicalOperator,n=r.stream;r.skipToNextLine();var s=n.position-1,a=t.get("Length");if(Number.isInteger(a)||(a=0),n.position=s+a,r.nextChar(),this.tryShift()&&ri(this.second,"endstream"))this.shift();else{var o=new Uint8Array([101,110,100,115,116,114,101,97,109]),h=this._findStreamLength(s,o);if(h<0){var c=o.length-1,_=o.slice(0,c),d=this._findStreamLength(s,_);if(d>=0&&C(n.peekBytes(c+1)[c])&&(h=d),h<0)throw new ps("Missing endstream command.")}a=h,r.nextChar(),this.shift(),this.shift()}return this.shift(),n=n.makeSubStream(s,a,t),i||(e&&(n=e.createStream(n,a)),n=this.filter(n,t,a)),n.dictionary=t,n},t.prototype.filter=function(t,e,i){var r=this,n=e.get("F","Filter"),s=e.get("DP","DecodeParms");if(n instanceof vs)return this.makeFilter(t,n.name,i,s);if(Array.isArray(n)&&!this._isImageExtraction){var a=n[0];if(a instanceof vs)return this.makeFilter(t,a.name,i,s);if(a instanceof ws)return this.makeFilter(t,a.command,i,s)}var o=i;if(Array.isArray(n)){var h=s;n.forEach(function(e,i){if(!((n=e instanceof Ss?r.xref._fetch(e):e)instanceof vs||n instanceof ws))throw new ps("Bad filter name '"+n+"'");if(s=null,Array.isArray(h)&&null!==i&&void 0!==i&&i in h){var a=h[i];s=a instanceof Ss?r.xref._fetch(a):a}n instanceof vs?t=r.makeFilter(t,n.name,o,s):n instanceof ws&&(t=r.makeFilter(t,n.command,o,s)),o=null})}return t},t.prototype.makeFilter=function(t,e,i,r){if(0===i)return new Ds;var n=1;try{if("Fl"===e||"FlateDecode"===e)return r?new Gs(new Hs(t,i),i,r):new Hs(t,i);if(!this._isImageExtraction)return t;switch(e){case"LZW":case"LZWDecode":return r?(r.has("EarlyChange")&&(n=r.get("EarlyChange")),new Gs(new Ys(t,i,n),i,r)):new Ys(t,i,n);case"DCT":case"DCTDecode":return new Xs(t,i,r);case"JPX":case"JPXDecode":return new Zs(t,i,r);case"A85":case"ASCII85Decode":return new ta(t,i);case"AHx":case"ASCIIHexDecode":return new ia(t,i);case"CCF":case"CCITTFaxDecode":return new sa(t,i,r);case"RL":case"RunLengthDecode":return new oa(t,i);case"JBIG2Decode":return new ba(t,i,r);default:return t}}catch(t){return new Ds}},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),C(e)||h--,t.position-h-r},t.prototype._checkEnd=function(){return"EOF"===this.first},t}(),ka=function(){function t(t){this.isValid=!1;var e=new Ca(new Ta(t),null),i=e.getObject(),r=e.getObject(),n=e.getObject(),s=e.getObject();if(this.isValid=Number.isInteger(i)&&Number.isInteger(r)&&ri(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}(),Ra=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[c]=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 u=new Int32Array(16);for(c=0;c<o;){for(_=0;_<16;++_,c+=4)u[_]=h[c]|h[c+1]<<8|h[c+2]<<16|h[c+3]<<24;var l=r,f=n,p=s,g=a,y=void 0,m=void 0;for(_=0;_<64;++_){_<16?(y=f&p|~f&g,m=_):_<32?(y=g&f|~g&p,m=5*_+1&15):_<48?(y=f^p^g,m=3*_+5&15):(y=p^(f|~g),m=7*_&15);var b=g,v=l+y+this._k[_]+u[m]|0,w=this._r[_];g=p,p=f,f=f+(v<<w|v>>>32-w)|0,l=b}r=r+l|0,n=n+f|0,s=s+p|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}(),Fa=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)}}(),Ia=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 Fa(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[a],o=e[o],h=e[h],c=e[c],a^=i[s];for(var _=0;_<4;++_)r[n]=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}(Sa),Da=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 Fa(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[r],n=e[n],s=e[s],a=e[a]):h%32==0&&(r=i[h-3],n=i[h-2],s=i[h-1],a=i[h-4],r=e[r],n=e[n],s=e[s],a=e[a],r^=o,(o<<=1)>=256&&(o=255&(27^o)));for(var _=0;_<4;++_)i[h]=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}(Sa),Ba=function(){function t(){this._events=[]}return t.prototype._add=function(t){this._events.push(t),this._result=t.bytes},t.prototype._setResult=function(t){this._result=t,this._events=[{bytes:t}]},t.prototype._getResult=function(){return this._events.length>0?this._events[this._events.length-1].bytes:this._result},t}(),La=function(){function t(t,e){this._buffer=[],this._closed=!1,this._hasher=t,this._outputSink=e}return t.prototype._add=function(t){if(this._closed)throw new Error("Cannot add data to closed hash input");for(var e=0;e<t.length;e++)this._buffer.push(t[e])},t.prototype._close=function(){if(!this._closed&&(this._closed=!0,this._buffer.length>0)){var t=new Uint8Array(this._buffer),e=this._hasher._hash(t,0,t.length);this._outputSink._add({bytes:e})}},t}(),Oa=function(){function t(t){this._oid=t}return t.prototype._getEncoded=function(){var t=this._encodeObjectIdentifier(this._oid),e=new Uint8Array([5,0]),i=t.length+e.length,r=[];return r.push(48),r.push(i),r.push.apply(r,Array.from(t)),r.push.apply(r,Array.from(e)),new Uint8Array(r)},t.prototype._encodeObjectIdentifier=function(t){var e=t.split(".").map(Number),i=[];i.push(40*e[0]+e[1]);for(var r=2;r<e.length;r++){var n=e[r];if(n<128)i.push(n);else{for(var s=[];n>0;)s.unshift(127&n),n=Math.floor(n/128);for(var a=0;a<s.length-1;a++)s[a]|=128;i.push.apply(i,s)}}var o=[];return o.push(6),o.push(i.length),o.push.apply(o,i),new Uint8Array(o)},t}(),Ma=function(){function t(){}return t.prototype._startChunkedConversion=function(t){return new La(this,t)},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,u=[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),f=new Uint8Array(l),p=0;p<i;++p)f[p]=t[e++];f[p++]=128;for(var g=l-8;p<g;)f[p++]=0;f[p++]=0,f[p++]=0,f[p++]=0,f[p++]=i>>>29&255,f[p++]=i>>21&255,f[p++]=i>>13&255,f[p++]=i>>5&255,f[p++]=i<<3&255;var y=new Uint32Array(64);for(p=0;p<l;){for(r=0;r<16;++r)y[r]=f[p]<<24|f[p+1]<<16|f[p+2]<<8|f[p+3],p+=4;for(r=16;r<64;++r)y[r]=this._littleSigmaPrime(y[r-2])+y[r-7]+this._littleSigma(y[r-15])+y[r-16]|0;var m=n,b=s,v=a,w=o,S=h,x=c,P=_,A=d,T=void 0,C=void 0;for(r=0;r<64;++r)T=A+this._sigmaPrime(S)+(S&x^~S&P)+u[r]+y[r],C=this._sigma(m)+(m&b^m&v^b&v),A=P,P=x,x=S,S=w+T|0,w=v,v=b,b=m,m=T+C|0;n=n+m|0,s=s+b|0,a=a+v|0,o=o+w|0,h=h+S|0,c=c+x|0,_=_+P|0,d=d+A|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}(),Ea=function(){function t(){this._k=[new Xa(1116352408,3609767458),new Xa(1899447441,602891725),new Xa(3049323471,3964484399),new Xa(3921009573,2173295548),new Xa(961987163,4081628472),new Xa(1508970993,3053834265),new Xa(2453635748,2937671579),new Xa(2870763221,3664609560),new Xa(3624381080,2734883394),new Xa(310598401,1164996542),new Xa(607225278,1323610764),new Xa(1426881987,3590304994),new Xa(1925078388,4068182383),new Xa(2162078206,991336113),new Xa(2614888103,633803317),new Xa(3248222580,3479774868),new Xa(3835390401,2666613458),new Xa(4022224774,944711139),new Xa(264347078,2341262773),new Xa(604807628,2007800933),new Xa(770255983,1495990901),new Xa(1249150122,1856431235),new Xa(1555081692,3175218132),new Xa(1996064986,2198950837),new Xa(2554220882,3999719339),new Xa(2821834349,766784016),new Xa(2952996808,2566594879),new Xa(3210313671,3203337956),new Xa(3336571891,1034457026),new Xa(3584528711,2466948901),new Xa(113926993,3758326383),new Xa(338241895,168717936),new Xa(666307205,1188179964),new Xa(773529912,1546045734),new Xa(1294757372,1522805485),new Xa(1396182291,2643833823),new Xa(1695183700,2343527390),new Xa(1986661051,1014477480),new Xa(2177026350,1206759142),new Xa(2456956037,344077627),new Xa(2730485921,1290863460),new Xa(2820302411,3158454273),new Xa(3259730800,3505952657),new Xa(3345764771,106217008),new Xa(3516065817,3606008344),new Xa(3600352804,1432725776),new Xa(4094571909,1467031594),new Xa(275423344,851169720),new Xa(430227734,3100823752),new Xa(506948616,1363258195),new Xa(659060556,3750685593),new Xa(883997877,3785050280),new Xa(958139571,3318307427),new Xa(1322822218,3812723403),new Xa(1537002063,2003034995),new Xa(1747873779,3602036899),new Xa(1955562222,1575990012),new Xa(2024104815,1125592928),new Xa(2227730452,2716904306),new Xa(2361852424,442776044),new Xa(2428436474,593698344),new Xa(2756734187,3733110249),new Xa(3204031479,2999351573),new Xa(3329325298,3815920427),new Xa(3391569614,3928383900),new Xa(3515267271,566280711),new Xa(3940187606,3454069534),new Xa(4118630271,4000239992),new Xa(116418474,1914138554),new Xa(174292421,2731055270),new Xa(289380356,3203993006),new Xa(460393269,320620315),new Xa(685471733,587496836),new Xa(852142971,1086792851),new Xa(1017036298,365543100),new Xa(1126000580,2618297676),new Xa(1288033470,3409855158),new Xa(1501505948,4234509866),new Xa(1607167915,987167468),new Xa(1816402316,1246189591)]}return t.prototype._startChunkedConversion=function(t){return new La(this,t)},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 Xa(3418070365,3238371032),s=new Xa(1654270250,914150663),a=new Xa(2438529370,812702999),o=new Xa(355462360,4144912697),h=new Xa(1731405415,4290775857),c=new Xa(2394180231,1750603025),_=new Xa(3675008525,1694076839),d=new Xa(1203062813,3204075428)):(n=new Xa(1779033703,4089235720),s=new Xa(3144134277,2227873595),a=new Xa(1013904242,4271175723),o=new Xa(2773480762,1595750129),h=new Xa(1359893119,2917565137),c=new Xa(2600822924,725511199),_=new Xa(528734635,4215389547),d=new Xa(1541459225,327033209));var u,l=128*Math.ceil((i+17)/128),f=new Uint8Array(l);for(u=0;u<i;++u)f[u]=t[e++];f[u++]=128;for(var p=l-16;u<p;)f[u++]=0;f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=0,f[u++]=i>>>29&255,f[u++]=i>>21&255,f[u++]=i>>13&255,f[u++]=i>>5&255,f[u++]=i<<3&255;var g=new Array(80);for(u=0;u<80;u++)g[u]=new Xa(0,0);var y,m=new Xa(0,0),b=new Xa(0,0),v=new Xa(0,0),w=new Xa(0,0),S=new Xa(0,0),x=new Xa(0,0),P=new Xa(0,0),A=new Xa(0,0),T=new Xa(0,0),C=new Xa(0,0),k=new Xa(0,0),R=new Xa(0,0);for(u=0;u<l;){var F=void 0;for(F=0;F<16;++F)g[F].high=f[u]<<24|f[u+1]<<16|f[u+2]<<8|f[u+3],g[F].low=f[u+4]<<24|f[u+5]<<16|f[u+6]<<8|f[u+7],u+=8;for(F=16;F<80;++F)y=g[F],this._littleSigmaPrime(y,g[F-2],R),y.add(g[F-7]),this._littleSigma(k,g[F-15],R),y.add(k),y.add(g[F-16]);for(m.assign(n),b.assign(s),v.assign(a),w.assign(o),S.assign(h),x.assign(c),P.assign(_),A.assign(d),F=0;F<80;++F)T.assign(A),this._sigmaPrime(k,S,R),T.add(k),k.assign(S),k.and(x),R.assign(S),R.not(),R.and(P),k.xor(R),T.add(k),T.add(this._k[F]),T.add(g[F]),this._sigma(C,m,R),k.assign(m),k.and(b),R.assign(m),R.and(v),k.xor(R),R.assign(b),R.and(v),k.xor(R),C.add(k),y=A,A=P,P=x,x=S,w.add(T),S=w,w=v,v=b,b=m,y.assign(T),y.add(C),m=y;n.add(m),s.add(b),a.add(v),o.add(w),h.add(S),c.add(x),_.add(P),d.add(A)}var I;return r?(I=new Uint8Array(48),n.copyTo(I,0),s.copyTo(I,8),a.copyTo(I,16),o.copyTo(I,24),h.copyTo(I,32),c.copyTo(I,40)):(I=new Uint8Array(64),n.copyTo(I,0),s.copyTo(I,8),a.copyTo(I,16),o.copyTo(I,24),h.copyTo(I,32),c.copyTo(I,40),_.copyTo(I,48),d.copyTo(I,56)),I},t}(),Na=function(){function t(){}return t.prototype._startChunkedConversion=function(t){return new La(this,t)},t.prototype._hash=function(t,e,i){return(new Ea)._hash(t,e,i,!0)},t}(),ja=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)}}(),Va=function(){function t(){}return Object.defineProperty(t.prototype,"_sha256",{get:function(){return void 0!==this._sha256Obj&&null!==this._sha256Obj||(this._sha256Obj=new Ma),this._sha256Obj},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_sha512",{get:function(){return void 0!==this._sha512Obj&&null!==this._sha512Obj||(this._sha512Obj=new Ea),this._sha512Obj},enumerable:!0,configurable:!0}),t}(),za=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ja(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),p(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),p(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 Da(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 Da(n)._decryptBlock(i,!1,new Uint8Array(16))},e}(Va),Ua=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ja(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),p(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),p(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 Da(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 Da(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 Ia(r.subarray(0,16))._encrypt(c,r.subarray(16,32));for(var u=0,l=0;l<16;l++)u*=1,u%=3,u+=(n[l]>>>0)%3,u%=3;2===u?r=this._sha512._hash(n,0,n.length):1===u?r=this._sha512._hash(n,0,n.length,!0):0===u&&(r=this._sha256._hash(n,0,n.length)),s++}return r.subarray(0,32)},e}(Va),Ha=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)}}(),Wa=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[n]=n;for(var s=e.length,n=0,a=0;n<256;++n){var o=r[n];a=a+o+e[n%s]&255,r[n]=r[a],r[a]=o}return i._s=r,i}return Ha(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){var o=r[e=e+1&255],h=r[i=i+o&255];r[e]=h,r[i]=o,s[a]=t[a]^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}(wa),qa=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ha(e,t),e.prototype._decryptBlock=function(t){return t},e.prototype._encrypt=function(t){return t},e}(wa),Ga=function(t){function e(e,i){void 0===i&&(i=64);var r=t.call(this)||this;if(r._blockSize=8,r._effectiveKeyBits=64,!(e instanceof Uint8Array)||e.length<5||e.length>128)throw new Error("RC2 key must be between 5 and 128 bytes.");return r._key=e,r._effectiveKeyBits=i,r._expandedKey=r._expandKey(e,r._effectiveKeyBits),r}return Ha(e,t),e.prototype._expandKey=function(t,e){var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],r=new Uint8Array(128);r.set(t);var n=t.length;if(n<128)for(var s=0,a=r[n-1];n<128;)a=255&i[a+r[s++]&255],r[n++]=a;var o=e+7>>3,h=255>>(7&-e),c=255&i[r[128-o]&h];r[128-o]=c;for(d=128-o-1;d>=0;d--)c=255&i[c^r[d+o]],r[d]=c;for(var _=new Uint16Array(64),d=0;d<64;d++)_[d]=r[2*d]+(r[2*d+1]<<8);return _},e.prototype._rotateLeft=function(t,e){return 65535&(t<<e|t>>>16-e)},e.prototype._rotateRight=function(t,e){return 65535&(t>>>e|t<<16-e)},e.prototype._encryptBlock=function(t){for(var e=new Uint16Array(4),i=0;i<4;i++)e[i]=t[2*i]+(t[2*i+1]<<8);for(var r=0,n=0;n<16;n++)e[0]=this._rotateLeft(e[0]+(e[1]&~e[3])+(e[2]&e[3])+this._expandedKey[r++]&65535,1),e[1]=this._rotateLeft(e[1]+(e[2]&~e[0])+(e[3]&e[0])+this._expandedKey[r++]&65535,2),e[2]=this._rotateLeft(e[2]+(e[3]&~e[1])+(e[0]&e[1])+this._expandedKey[r++]&65535,3),e[3]=this._rotateLeft(e[3]+(e[0]&~e[2])+(e[1]&e[2])+this._expandedKey[r++]&65535,5),4!==n&&10!==n||(e[0]=e[0]+this._expandedKey[63&e[3]]&65535,e[1]=e[1]+this._expandedKey[63&e[0]]&65535,e[2]=e[2]+this._expandedKey[63&e[1]]&65535,e[3]=e[3]+this._expandedKey[63&e[2]]&65535);for(var s=new Uint8Array(8),i=0;i<4;i++)s[2*i]=255&e[i],s[2*i+1]=e[i]>>>8;return s},e.prototype._decryptBlock=function(t){for(var e=new Uint16Array(4),i=0;i<4;i++)e[i]=t[2*i]+(t[2*i+1]<<8);for(var r=63,n=15;n>=0;n--)4!==n&&10!==n||(e[3]=e[3]-this._expandedKey[63&e[2]]&65535,e[2]=e[2]-this._expandedKey[63&e[1]]&65535,e[1]=e[1]-this._expandedKey[63&e[0]]&65535,e[0]=e[0]-this._expandedKey[63&e[3]]&65535),e[3]=this._rotateRight(e[3],5),e[3]=e[3]-(e[0]&~e[2])-(e[1]&e[2])-this._expandedKey[r--]&65535,e[2]=this._rotateRight(e[2],3),e[2]=e[2]-(e[3]&~e[1])-(e[0]&e[1])-this._expandedKey[r--]&65535,e[1]=this._rotateRight(e[1],2),e[1]=e[1]-(e[2]&~e[0])-(e[3]&e[0])-this._expandedKey[r--]&65535,e[0]=this._rotateRight(e[0],1),e[0]=e[0]-(e[1]&~e[3])-(e[2]&e[3])-this._expandedKey[r--]&65535;for(var s=new Uint8Array(8),i=0;i<4;i++)s[2*i]=255&e[i],s[2*i+1]=e[i]>>>8;return s},e.prototype._encrypt=function(t){var e=this._blockSize-t.length%this._blockSize,i=new Uint8Array(t.length+e);i.set(t),i.fill(e,t.length);for(var r=[],n=0;n<i.length;n+=this._blockSize){var s=i.subarray(n,n+this._blockSize);r.push(this._encryptBlock(s))}for(var a=r.reduce(function(t,e){return t+e.length},0),o=new Uint8Array(a),h=0,c=0,_=r;c<_.length;c++){var d=_[c];o.set(d,h),h+=d.length}return o},e.prototype._decrypt=function(t,e){for(var i=[],r=e,n=0;n<t.length;n+=this._blockSize){for(var s=t.subarray(n,n+this._blockSize),a=this._decryptBlock(s),o=0;o<this._blockSize;o++)a[o]^=r[o];i.push(a),r=s}for(var h=i.reduce(function(t,e){return t+e.length},0),c=new Uint8Array(h),_=0,d=0,u=i;d<u.length;d++){var l=u[d];c.set(l,_),_+=l.length}var f=c[c.length-1];if(f>0&&f<=this._blockSize){for(var p=!0,n=c.length-f;n<c.length;n++)if(c[n]!==f){p=!1;break}if(p)return c.subarray(0,c.length-f)}return c},e}(wa),Ka=function(){function t(t,e,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]),null!==i&&void 0!==i||(i="");var r=t.get("Filter");if(!ii(r,"Standard"))throw new ps("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 ps("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 ps("invalid key length");var c=f(t.get("O"),!1,!0).subarray(0,32),_=f(t.get("U"),!1,!0).subarray(0,32),d=t.get("P"),u=t.get("R");this._encryptMetaData=(4===n||5===n)&&!1!==t.get("EncryptMetadata");var l,g=f(e,!1,!0);i&&(l=f(i,!1,!0));var y;if(5!==n){if((y=this._prepareKeyData(g,l,c,_,d,u,s,this._encryptMetaData))&&(this._isUserPassword=!0,i)){var m=this._decodeUserPassword(l,c,u,s),b=this._prepareKeyData(g,m,c,_,d,u,s,this._encryptMetaData);b&&p(b,y)&&(this._hasUserPasswordOnly=!0)}}else{var v,w=f(t.get("O"),!1,!0),S=w.subarray(32,40),x=w.subarray(40,48),P=f(t.get("U"),!1,!0),A=P.subarray(0,48),T=P.subarray(32,40),C=P.subarray(40,48),k=f(t.get("OE"),!1,!0),R=f(t.get("UE"),!1,!0);v=6===u?new Ua:new za;var F=void 0;F=l?l.subarray(0,Math.min(127,l.length)):new Uint8Array([]),v._checkUserPassword(F,T,_)?(y=this._createEncryptionKey(!0,F,x,A,C,k,R,v),this._isUserPassword=!0,i.length&&v._checkOwnerPassword(F,S,A,c)&&(this._hasUserPasswordOnly=!0)):i.length&&v._checkOwnerPassword(F,S,A,c)&&(y=this._createEncryptionKey(!1,l,x,A,C,k,R,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,u,s);y=this._prepareKeyData(g,m,c,_,d,u,s,this._encryptMetaData),this._isUserPassword=!1}if(n>=4){var I=t.get("CF");if(I&&(I.suppressEncryption=!0,I.has("StdCF"))){var D=I.get("StdCF");if(D&&D.has("AuthEvent")){var B=D.get("AuthEvent");B&&"EFOpen"===B.name&&(this._encryptOnlyAttachment=!0)}}this._cipherDictionary=I,this._stream=t.get("StmF")||vs.get("Identity"),this._string=t.get("StrF")||vs.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&&null!==this._messageDigest||(this._messageDigest=new Ra),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[_]=e[_];for(;_<32;)c[_++]=this._defaultPasswordBytes[d++];for(d=0,h=i.length;d<h;++d)c[_++]=i[d];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[d];s>=4&&!o&&(c[_++]=255,c[_++]=255,c[_++]=255,c[_++]=255);var u=this._md5.hash(c,0,_),l=a>>3;if(s>=3)for(d=0;d<50;++d)u=this._md5.hash(u,0,l);var f,p=u.subarray(0,l);if(s>=3){for(_=0;_<32;++_)c[_]=this._defaultPasswordBytes[_];for(d=0,h=t.length;d<h;++d)c[_++]=t[d];f=new Wa(p)._encryptBlock(this._md5.hash(c,0,_)),h=p.length;var g=new Uint8Array(h);for(d=1;d<=19;++d){for(var y=0;y<h;++y)g[y]=p[y]^d;f=new Wa(g)._encryptBlock(f)}for(d=0,h=f.length;d<h;++d)if(r[d]!==f[d])return null}else for(d=0,h=(f=new Wa(p)._encryptBlock(this._defaultPasswordBytes)).length;d<h;++d)if(r[d]!==f[d])return null;return p},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[s]=t[s];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 u=0;u<c;++u)d[u]=h[u]^a;_=new Wa(d)._encryptBlock(_)}}else _=new Wa(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 xa(i,r)}var n=this._buildObjectKey(t,e,this._encryptionKey,!1);return new xa(new Wa(n),new Wa(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 qa;switch(s.name){case"None":return new qa;case"AESV2":return new Ia(this._buildObjectKey(i,r,n,!0));case"AESV3":return new Da(n);case"V2":return new Wa(this._buildObjectKey(i,r,n,!1))}throw new ps("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[n]=i[n];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}(),Xa=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[e]=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}(),Ja=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{h(r.next(t))}catch(t){s(t)}}function o(t){try{h(r.throw(t))}catch(t){s(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,o)}h((r=r.apply(t,e||[])).next())})},Ya=function(t,e){function i(t){return function(e){return r([t,e])}}function r(i){if(n)throw new TypeError("Generator is already executing.");for(;h;)try{if(n=1,s&&(a=2&i[0]?s.return:i[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,i[1])).done)return a;switch(s=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return h.label++,{value:i[1],done:!1};case 5:h.label++,s=i[1],i=[0];continue;case 7:i=h.ops.pop(),h.trys.pop();continue;default:if(a=h.trys,!(a=a.length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){h=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){h.label=i[1];break}if(6===i[0]&&h.label<a[1]){h.label=a[1],a=i;break}if(a&&h.label<a[2]){h.label=a[2],h.ops.push(i);break}a[2]&&h.ops.pop(),h.trys.pop();continue}i=e.call(t,h)}catch(t){i=[6,t],s=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}var n,s,a,o,h={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o},Qa=function(){function i(t,e){this._uint8Chunks=[],this._version="",this._newLine="\r\n",this._bufferLength=0,this._isDecoderSupport=!1,this._signatureCollection=[],this._isCrossReferenceTable=!1,this._isCrossReferenceStream=!1,this._password=e,this._document=t,this._stream=t._stream,this._entries=[],this._crossReferencePosition=Object.create(null),this._cacheMap=new Map,this._offsetReference=new Map,this._pendingRefs=new xs,this._offsets=[]}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(i){var r;(r=i?this._indexObjects():this._readXRef()).assignXref(this);var n=r.get("Size");this._entries.length<n||this._entries.length===n?this._nextReferenceNumber=n:this._entries.length>n&&(this._nextReferenceNumber=this._entries.length>0?this._entries.length:1),this._trailer=r;var s=r.get("Encrypt");if(s){e.initializeTelemetryFeature("DecryptPDF","PDFLibrary"),this._document._isEncrypted=!0,this._ids=r.get("ID"),this._permissionFlags=s.get("P");var a=this._ids&&this._ids.length?this._ids[0]:"";s.suppressEncryption=!0,this._encrypt=new Ka(s,a,this._password),this._document._isUserPassword=this._encrypt._isUserPassword,this._document._encryptOnlyAttachment=this._encrypt._encryptOnlyAttachment,this._document._encryptOnlyAttachment&&(this._document.fileStructure.isIncrementalUpdate=!1),this._document.fileStructure.isIncrementalUpdate?this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.stream:this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.table,this._encrypt._encryptOnlyAttachment?(this._document._hasUserPasswordOnly=!0,this._document._encryptMetaData=!1):(this._document._hasUserPasswordOnly=this._encrypt._hasUserPasswordOnly,this._document._encryptMetaData=!s.has("EncryptMetadata")||s.get("EncryptMetadata"))}var o,h=!1;try{o=r.get("Root")}catch(t){throw new fs("Invalid cross reference","XRefParseException")}if(o)try{o.get("Pages")&&(this._root=o,h=!0)}catch(t){throw new fs("Invalid cross reference","InvalidXRef")}if(!h)throw i?new fs("Invalid cross reference","InvalidXRef"):new fs("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 Ss))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 Ts&&!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 fs("Inconsistent generation in XRef: "+t,"XRefEntryException");var s=this._stream.makeSubStream(e.offset+this._stream.start,void 0),a=new Ca(new Ta(s),this,!0,!1,this._encrypt);a._isImageExtraction=this._isDecoderSupport;var o=a.getObject(),h=a.getObject(),c=a.getObject();if(o!==n||h!==r||void 0===c)throw new fs("Bad (uncompressed) XRef entry: "+t,"XRefEntryException");var _;return(_=this._encrypt&&!i?a.getObject(t.objectNumber,t.generationNumber,!0):a.getObject(null,i))instanceof Rs||this._cacheMap.set(t,_),_ instanceof Ts?_.objId=t.toString():_ instanceof Rs&&(_.dictionary.objId=t.toString()),_},i.prototype._fetchCompressed=function(t,e){var i=e.offset,r=this._fetch(Ss.get(i,0));if(void 0===r)throw new ps("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 ps("invalid first and n parameters for ObjStm stream");var o=new Ca(new Ta(r),this,!0);o._isImageExtraction=this._isDecoderSupport;for(var h=new Array(s),c=new Array(s),_=0;_<s;++_){g=o.getObject();if(!Number.isInteger(g))throw new ps("invalid object number in the ObjStm stream: "+g);var d=o.getObject();if(!Number.isInteger(d))throw new ps("invalid object offset in the ObjStm stream: "+d);h[_]=g,c[_]=d}for(var u=(r.start||0)+n,l=new Array(s),_=0;_<s;++_){var f=_<s-1?c[_+1]-c[_]:void 0;if(f<0)throw new ps("Invalid offset in the ObjStm stream.");var p=(o=new Ca(new Ta(r.makeSubStream(u+c[_],f,r.dictionary)),this,!0)).getObject();if(l[_]=p,!(p instanceof Rs)){var g=h[_],y=this._entries[g];if(y&&y.offset===i&&y.gen===_){var m=g+" "+a;this._cacheMap.set(Ss.get(g,a),p),p instanceof Ts&&(p.objId=m)}}}var b=l[e.gen];if(void 0===b)throw new fs("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 Ca(new Ta(i),this,!0),a=s.getObject(),o=void 0;if(ri(a,"xref")){if(void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.table,this._isCrossReferenceTable=!0),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 ps("Invalid XRef stream header");void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=t.PdfCrossReferenceType.stream,this._isCrossReferenceStream=!0);var c=s.getObject(),_=s.getObject();if(a=s.getObject(),!(void 0!==c&&Number.isInteger(c)&&ri(_,"obj")&&a instanceof Rs))throw new ps("Invalid cross reference stream");if(o=this._processXRefStream(a),this._topDictionary||(this._topDictionary=o),!o)throw new ps("Failed to read XRef stream")}a=o.get("Prev"),Number.isInteger(a)?this._startXRefQueue.push(a):a instanceof Ss&&this._startXRefQueue.push(a.objectNumber),this._startXRefQueue.shift()}}var d=[];return r.forEach(function(t){return d.push(t)}),this._document._startXRefParsedCache=d,this._topDictionary}catch(t){this._startXRefQueue.shift()}if(!e)throw new fs("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=[],u=[];_<c;){var l=h[_];if(9!==l&&10!==l&&13!==l&&32!==l)if(37!==l){var f=this._readToken(h,_),p=void 0;if(f.startsWith("xref")&&(4===f.length||/\s/.test(f[4])))_+=this._skipUntil(h,_,r),d.push(_),_+=this._skipUntil(h,_,n);else if(p=t.exec(f)){var g=0|p[1],y=0|p[2],m=void 0,b=_+f.length,w=!1;if(this._entries[g]){if(this._entries[g].gen===y)try{var S=o.makeSubStream(b,o.length-b),x=new Ta(S);(B=new Ca(x,null)).getObject(),w=!0}catch(t){w=!(t instanceof gs)}}else w=!0;if(w){var P=new Za;P.offset=_-o.start,P.gen=y,P.uncompressed=!0,this._entries[g]=P}for(;b<h.length;){var A=b+this._skipUntil(h,b,s)+4;m=A-_;var T=Math.max(A-25,b),C=v(h.subarray(T,A));if(e.test(C))break;var k=i.exec(C);if(k&&k[1]){m-=k[1].length;break}b=A}var R=h.subarray(_,_+m),F=this._skipUntil(R,0,a);F<m&&R[F+5]<64&&(u.push(_-o.start),this._crossReferencePosition[_-o.start]=1),_+=m}else f.startsWith("trailer")&&(7===f.length||/\s/.test(f[7]))?(d.push(_),_+=this._skipUntil(h,_,n)):_+=f.length+1}else do{if(++_>=c)break;l=h[_]}while(10!==l&&13!==l);else++_}for(D=0;D<u.length;++D)this._startXRefQueue.push(u[D]),this._readXRef(!0);for(var I,D=0;D<d.length;++D){o.position=d[D];var B=new Ca(new Ta(o),this,!0,!0);if(ri(B.getObject(),"trailer")){var L=B.getObject();if(L instanceof Ts){try{var O=L.get("Root");if(!(O instanceof Ts))continue;var M=O.get("Pages");if(!(M instanceof Ts))continue;var E=M.get("Count");if(void 0===E||!Number.isInteger(E))continue}catch(t){continue}if(L.has("ID"))return L;I=L}}}if(I)return I;if(this._topDictionary)return this._topDictionary;throw new fs("Invalid PDF structure.","InvalidPDFException")},i.prototype._processXRefTable=function(t){if(void 0===this._tableState){var e=new $a;e.entryNum=0,e.streamPos=t.lexicalOperator.stream.position,e.parserBuf1=t.first,e.parserBuf2=t.second,this._tableState=e}if(!ri(this._readXRefTable(t),"trailer"))throw new ps("Invalid XRef table: could not find trailer dictionary");var i,r=t.getObject();if(r&&(r instanceof Ts?i=r:r instanceof Rs&&r.dictionary&&(i=r.dictionary)),!i)throw new ps("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(),ri(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 ps("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 Za;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 ps("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 ps("Invalid XRef table: unexpected first object");return i},i.prototype._processXRefStream=function(t){if(void 0===this._streamState){var e=t.dictionary,i=new to,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 ps("Invalid XRef range fields: "+s+", "+a);if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r))throw new ps("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 u=t.getByte();if(-1===u)throw new ps("invalid cross reference byte width type.");h=h<<8|u}0===e&&(h=1);for(d=0;d<i;++d){var l=t.getByte();if(-1===l)throw new ps("invalid cross reference byte width offset.");c=c<<8|l}for(d=0;d<r;++d){var f=t.getByte();if(-1===f)throw new ps("invalid cross reference byte width generation.");_=_<<8|f}var p=new Za;switch(p.offset=c,p.gen=_,h){case 0:p.free=!0;break;case 1:p.uncompressed=!0;break;case 2:break;default:throw new ps("Invalid XRef entry type: "+h)}this._entries[s+o]||(this._entries[s+o]=p)}this._streamState.entryNum=0,this._streamState.streamPos=t.position,n.splice(0,2)}},i.prototype._getCatalogObj=function(){return this._root},i.prototype._flushBuffer=function(t){if(0!==t.length){for(var e=new Uint8Array(t.length),i=0;i<t.length;i++)e[i]=t[i];this._uint8Chunks.push(e),this._bufferLength+=e.length,t.length=0}},i.prototype._save=function(){this._uint8Chunks=[],this._bufferLength=0;var e=[37,80,68,70,45];this._writeString(""+this._version+this._newLine,e),e.push(37,131,146,250,254),this._writeString(this._newLine,e);var i,r=0;if(this._signatureCollection&&this._signatureCollection.length>0){this._isCrossReferenceStream?this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.stream:this._isCrossReferenceTable&&(this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.table);for(var n=this._signatureCollection.length,s=0;s<n;s++)this._signatureCollection[s]._catalogBeginSave()}this._document.fileStructure.isIncrementalUpdate?(this._currentLength=this._stream.length,this._document._fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream?this._saveAsStream(this._currentLength,e):this._saveAsTable(this._currentLength,e),e.length>0&&this._flushBuffer(e),(i=new Uint8Array(this._stream.length+this._bufferLength)).set(this._stream.bytes),r=this._stream.length):(this._currentLength=0,this._objectCollection=new io(this),this._writeObjectCollection(this._objectCollection._mainObjectCollection,e),e.length>0&&this._flushBuffer(e),i=new Uint8Array(this._bufferLength));for(var a=0,o=this._uint8Chunks;a<o.length;a++){var h=o[a];i.set(h,r),r+=h.length}if(this._signatureCollection&&this._signatureCollection.length>0)for(var n=this._signatureCollection.length,s=0;s<n;s++)this._signature=this._signatureCollection[s]._signatureDictionary,this._signature._documentSaved(i);if(!this._document.fileStructure.isIncrementalUpdate){var c=new Fs(i);this._stream=c,this._document._stream=c}return this._uint8Chunks=[],i},i.prototype._saveAsStream=function(t,e){var i=this,r=new Map;this._indexes=[],this._indexes.push(0,1),this._offsets=[];this._cacheMap.forEach(function(t){var e=t instanceof Rs?t.dictionary:t instanceof Ts?t:void 0;e&&(e._isProcessed=!1)}),this._cacheMap.forEach(function(r,n){if(r instanceof Rs){var s=r.dictionary;if(s&&s._updated&&(!s.isCatalog||i._allowCatalog)&&!s._isProcessed){var a=void 0;i._encrypt&&(a=i._encrypt._createCipherTransform(n.objectNumber,n.generationNumber)),i._updatedDictionary(t,n,e,r,a),s._isProcessed=!0,e.length>512e3&&i._flushBuffer(e)}}}),this._cacheMap.forEach(function(n,s){if(n instanceof Ts)n._updated&&!n.isCatalog&&!n._isProcessed||n._isSignature?n._isSignature?i._updatedDictionary(t,s,e,n):i._writeArchiveStream(r,s,n):n._updated&&(n.isCatalog||i._allowCatalog)&&(i._updatedDictionary(t,s,e,n),e.length>512e3&&i._flushBuffer(e));else if(n instanceof Rs){var a=n.dictionary;!a||!a._updated||a.isCatalog&&!i._allowCatalog||a._isProcessed||(i._updatedDictionary(t,s,e,n),e.length>512e3&&i._flushBuffer(e))}}),this._objectStream=void 0,this._objectStreamCollection=r,this._writeXrefStream(e)},i.prototype._writeXrefStream=function(t){var e=this;this._objectStreamCollection.forEach(function(i,r){var n;i._save(t,e._currentLength),Array.isArray(i._collection)&&(n=e._indexes).push.apply(n,i._collection),e._indexes.push(r.objectNumber,1),t.length>524288&&e._flushBuffer(t)});var i=Math.max(ne(this._currentLength+this._bufferLength+t.length),ne(this._nextReferenceNumber)),r=this._getNextReference();this._indexes.push(r.objectNumber,1);var n=this._currentLength+this._bufferLength+t.length,s=new Ts(this);s.set("Type",vs.get("XRef")),s.set("Index",this._indexes),s.set("W",[1,i,1]),this._copyTrailer(s),this._ids&&this._ids.length>0&&s.update("ID",[this._ids[0],this._computeMessageDigest(n)]);var a=[];if(this._writeLong(0,1,a),this._writeLong(0,i,a),this._writeLong(-1,1,a),this._offsets.length>0)for(var o=0;o<this._offsets.length;o++)this._writeLong(1,1,a),this._writeLong(this._offsets[o],i,a),this._writeLong(0,1,a);this._objectStreamCollection.size>0&&this._objectStreamCollection.forEach(function(t,r){for(var n=0;n<t._length;n++)e._writeLong(2,1,a),e._writeLong(r.objectNumber,i,a),e._writeLong(n,1,a);e._writeLong(1,1,a),e._writeLong(t._archiveOffset,i,a),e._writeLong(0,1,a)}),this._writeLong(1,1,a),this._writeLong(n,i,a),this._writeLong(0,1,a),s.set("Length",a.length);var h,c=new Fs(a,s,0,a.length);this._encrypt&&(h=this._encrypt._createCipherTransform(r.objectNumber,r.generationNumber)),this._writeObject(c,t,r,h,!0),this._writeString("startxref"+this._newLine+n+this._newLine+"%%EOF"+this._newLine,t),t.length>0&&this._flushBuffer(t)},i.prototype._updatedDictionary=function(t,e,i,r,n){this._indexes.push(e.objectNumber,1),this._offsets.push(t+this._bufferLength+i.length),this._writeObject(r,i,e,n),r._updated=!1},i.prototype._writeXrefTable=function(t){var e=this,i="",r=this._getSortedReferences(this._offsetReference);r.forEach(function(t,r){var n=e._processString(t.toString(),10),s=e._processString(r.generationNumber?"0":"",5);i+=0!==t?n+" "+s+" n"+e._newLine:n+" "+s+" f"+e._newLine});var n=t.length+this._bufferLength,s="xref"+this._newLine,a="0 "+(r.size+1)+this._newLine,o="0000000000 65535 f"+this._newLine;this._writeString(s+a+o,t),this._writeXref(t,i,n),t.length>512e3&&this._flushBuffer(t)},i.prototype._writeXref=function(t,e,i){this._writeString(e,t),this._writeString("trailer"+this._newLine,t);var r=new Ts(this);this._copyTrailer(r),this._writeDictionary(r,t,this._newLine),this._writeString("startxref"+this._newLine+i+this._newLine+"%%EOF"+this._newLine,t)},i.prototype._processString=function(t,e){for(;t.length<e;)t="0"+t;return t},i.prototype._copyTrailer=function(t){var e=this._getNextReference();t.set("Size",e.objectNumber),this._document.fileStructure.isIncrementalUpdate&&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 Ts;r&&r instanceof Ts&&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)}),v((new Ra).hash(new Uint8Array(s)))},i.prototype._getNextReference=function(){var t=new Ss(this._nextReferenceNumber++,0);return t._isNew=!0,t},i.prototype._writeObject=function(t,e,i,r,n){var s=this;if(i&&i instanceof Ss&&this._writeString(i.objectNumber+" "+i.generationNumber+" obj"+this._newLine,e),t instanceof Ts?this._writeDictionary(t,e,this._newLine,r,n):t instanceof Rs?this._writeStream(t,e,r,n):Array.isArray(t)&&t.length>0?(this._writeString("[ ",e),t.forEach(function(i,a){if(i instanceof Ss)s._writeString(i.objectNumber+" "+i.generationNumber+" R",e);else if(Array.isArray(i))s._writeString("[ ",e),i.forEach(function(t){t instanceof Ss?s._writeString(t.objectNumber+" "+t.generationNumber+" R",e):t instanceof vs?s._writeString("/"+rt(t.name),e):s._writeString(t+" ",e)}),s._writeString("]",e);else if(i instanceof vs)s._writeString("/"+rt(i.name),e);else if(i instanceof Ts)s._writeDictionary(i,e,s._newLine,r,n);else if("string"==typeof i)if(ge(i)){var o=P(f(i));s._writeString("<",e),s._writeString(""+o,e),s._writeString(">",e)}else s._writeString(i+"\n",e);else s._writeString(i+"\n",e);a<t.length-1&&s._writeString(" ",e)}),this._writeString("]",e),this._writeString("\n",e)):"number"==typeof t?this._writeString(t+"\n",e):"string"==typeof t&&this._writeString("("+rt(t)+")\n",e),t instanceof vs){-1!==t.name.indexOf(" ")&&(t.name=t.name.replace(/ /g,"#20"));var a=t.name;this._writeString("/"+a,e)}i&&i instanceof Ss&&this._writeString("endobj"+this._newLine,e)},i.prototype._writeDictionary=function(t,e,i,r,n){var s=this;if(t._currentObj&&t._currentObj._beginSave(),t._isFont&&this._writeFontDictionary(t),this._writeString("<<"+i,e),t._isSignature&&this._signatureCollection&&this._signatureCollection.length>0){var a=this._signatureCollection.find(function(e){return e._signatureDictionary._dictionary.objId===t.objId});a&&a._signatureDictionary._dictionarySave(e)}t.forEach(function(t,a){s._writeString("/"+rt(t)+" ",e),s._writeValue(a,t,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");if(!Array.isArray(e)){var i=this._getNextReference();this._cacheMap.set(i,e),t.update("DescendantFonts",[i])}}this._createFontReference("ToUnicode",t),this._createFontReference("FontFile2",t),this._createFontReference("FontFile3",t),this._createFontReference("FontDescriptor",t)},i.prototype._createFontReference=function(t,e){if(e.has(t)){var i=e.get(t);if(!(i instanceof Ss)){var r=this._getNextReference();this._cacheMap.set(r,i),!1===this._document.fileStructure.isIncrementalUpdate&&this._objectCollection&&this._objectCollection._mainObjectCollection&&this._objectCollection._mainObjectCollection.set(r,i),e.update(t,r)}}},i.prototype._writeStream=function(t,e,i,r){var n,s=[];r?n=t.getString():(n=t._isCompress&&!t._isImage?ue(t):t.getString(),i&&(n=i.encryptString(n))),this._writeString(n,s),t.dictionary.update("Length",s.length),this._writeDictionary(t.dictionary,e,this._newLine,i,r),this._writeString("stream"+this._newLine,e),this._writeBytes(s,e),this._writeString(this._newLine+"endstream"+this._newLine,e)},i.prototype._writeValue=function(t,e,i,r,n){if(t instanceof vs){-1!==t.name.indexOf(" ")&&(t.name=t.name.replace(/ /g,"#20"));var s="V"===e||"AS"===e?rt(t.name):t.name;this._writeString("/"+s,i)}else if(t instanceof Ss)this._writeString(t.toString()+" R",i);else if(Array.isArray(t)){this._writeString("[",i);for(var a=!0,o=0,h=t;o<h.length;o++){var c=h[o];a?a=!1:this._writeString(" ",i),this._writeValue(c,e,i,r,n)}this._writeString("]",i)}else if("string"==typeof t){!n&&r&&(t=r.encryptString(t));for(var _=!1,d=0;d<t.length;d++)if(t.charCodeAt([d])>255){_=!0;break}_?this._writeUnicodeString(t,i):this._writeString("("+this._escapeString(t)+")",i)}else"number"==typeof t?this._writeString(y(t),i):"boolean"==typeof t?this._writeString(t.toString(),i):t instanceof Ts?this._writeDictionary(t,i,this._newLine,r,n):t instanceof Rs?this._writeStream(t,i,r,n):null===t&&this._writeString("null",i)},i.prototype._writeUnicodeString=function(t,e){var i=se(t);i.unshift(254,255);var r=[];i.forEach(function(t){switch(t){case 40:case 41:r.push(92),r.push(t);break;case 13:r.push(92),r.push(114);break;case 92:r.push(92),r.push(t);break;default:r.push(t)}}),e.push(255&"(".charCodeAt(0)),r.forEach(function(t){e.push(255&t)}),e.push(255&")".charCodeAt(0))},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&&(this._pendingRefs.clear(),this._pendingRefs=void 0),this._cacheMap&&this._cacheMap.clear(),this._offsetReference&&this._offsetReference.clear(),this._objectStreamCollection&&this._objectStreamCollection.clear(),this._objectCollection&&(this._objectCollection=void 0),this._offsets=[],this._startXRefQueue=[],this._root=void 0,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.prototype._writeObjectCollection=function(e,i){var r=this,n=new Map;this._indexes=[],this._indexes.push(0,1);e.forEach(function(t,e){r._writeObjectToBuffer(e,t,i,n),i.length>512e3&&r._flushBuffer(i)}),this._cacheMap.size>e.size&&this._cacheMap.forEach(function(t,s){e.has(s)||(r._writeObjectToBuffer(s,t,i,n),i.length>512e3&&r._flushBuffer(i))}),this._document.fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream?(this._objectStream=void 0,this._objectStreamCollection=n,this._writeXrefStream(i)):this._writeXrefTable(i)},i.prototype._saveAsTable=function(t,e){var i=this,r="",n=0;this._cacheMap.forEach(function(s,a){var o;if(s instanceof Ts?o=s:s instanceof Rs&&(o=s.dictionary),o&&(o._updated&&(!o.isCatalog||i._allowCatalog)||o._isSignature)){var h=i._processString((t+i._bufferLength+e.length).toString(),10),c=i._processString(a.generationNumber.toString(),5);r+=a.objectNumber+" 1"+i._newLine+h+" "+c+" n"+i._newLine,i._writeObject(s,e,a),n++,(e.length>512e3||n%2==0)&&i._flushBuffer(e)}});var s=this._bufferLength+e.length+t;this._writeString("xref"+this._newLine+"0 1"+this._newLine+"0000000000 65535 f"+this._newLine,e),this._writeXref(e,r,s),e.length>0&&this._flushBuffer(e)},i.prototype._writeArchiveStream=function(t,e,i){if(void 0===this._objectStream||100===this._objectStream._length){var r=new eo(this);t.set(r._reference,r),this._objectStream=r}this._objectStream._writeObject(e,i)},i.prototype._writeObjectToBuffer=function(e,i,r,n){var s;if(i instanceof Ts&&i.isCatalog)this._writeToBuffer(r,e,i);else if(i instanceof vs)this._document.fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream?this._writeArchiveStream(n,e,i):this._writeToBuffer(r,e,i);else if(i instanceof Ts){var a=i.get("Filter"),o=a&&"Standard"===a.name;this._document.fileStructure._crossReferenceType===t.PdfCrossReferenceType.stream?o||i._isSignature?this._writeToBuffer(r,e,i):this._writeArchiveStream(n,e,i):(this._offsetReference.set(e,this._bufferLength+r.length),this._indexes.push(e.objectNumber,1),this._writeObject(i,r,e))}else{if(i instanceof Rs){var h=i.dictionary;h&&h._updated&&!h.isCatalog&&(this._encrypt&&(s=this._encrypt._createCipherTransform(e.objectNumber,e.generationNumber)),h._updated=!1)}else if((!Array.isArray(i)||0===i.length)&&"number"!=typeof i&&"string"!=typeof i)return;this._writeToBuffer(r,e,i,s)}},i.prototype._writeToBuffer=function(t,e,i,r){this._offsets.push(this._bufferLength+t.length),this._offsetReference.set(e,this._bufferLength+t.length),this._indexes.push(e.objectNumber,1),this._writeObject(i,t,e,r),t.length>512e3&&this._flushBuffer(t)},i.prototype._getSortedReferences=function(t){var e=[];t.forEach(function(t,i){e.push([i,t])}),e.sort(function(t,e){return t[0].objectNumber-e[0].objectNumber});for(var i=new Map,r=1,n=0,s=e;n<s.length;n++){for(var a=s[n],o=a[0],h=a[1],c=o.objectNumber;r<c;)i.set({objectNumber:r},0),r++;i.set(o,h),r=c+1}return i},i.prototype._saveAsync=function(){return Ja(this,void 0,void 0,function(){var e,i,r,n,s,a,o,h,c,_;return Ya(this,function(d){switch(d.label){case 0:return this._uint8Chunks=[],this._bufferLength=0,e=[37,80,68,70,45],[4,this._writeStringAsync(""+this._version+this._newLine,e)];case 1:return d.sent(),e.push(37,131,146,250,254),[4,this._writeStringAsync(this._newLine,e)];case 2:if(d.sent(),r=0,!(this._signatureCollection&&this._signatureCollection.length>0))return[3,6];this._isCrossReferenceStream?this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.stream:this._isCrossReferenceTable&&(this._document.fileStructure.crossReferenceType=t.PdfCrossReferenceType.table),h=this._signatureCollection.length,c=0,d.label=3;case 3:return c<h?(this._signatureCollection[c]._catalogBeginSave(),c%50!=0?[3,5]:[4,new Promise(function(t){return setTimeout(t,0)})]):[3,6];case 4:d.sent(),d.label=5;case 5:return c++,[3,3];case 6:return this._document.fileStructure.isIncrementalUpdate?[3,10]:(this._currentLength=0,n=new io(this),[4,this._writeObjectCollectionAsync(n._mainObjectCollection,e)]);case 7:return d.sent(),e.length>0?[4,this._flushBufferAsync(e)]:[3,9];case 8:d.sent(),d.label=9;case 9:return i=new Uint8Array(this._bufferLength),[3,17];case 10:return this._currentLength=this._stream.length,this._document._fileStructure._crossReferenceType!==t.PdfCrossReferenceType.stream?[3,12]:[4,this._saveAsStreamAsync(this._currentLength,e)];case 11:return d.sent(),[3,14];case 12:return[4,this._saveAsTableAsync(this._currentLength,e)];case 13:d.sent(),d.label=14;case 14:return e.length>0?[4,this._flushBufferAsync(e)]:[3,16];case 15:d.sent(),d.label=16;case 16:(i=new Uint8Array(this._stream.length+this._bufferLength)).set(this._stream.bytes),r=this._stream.length,d.label=17;case 17:for(s=0,a=this._uint8Chunks;s<a.length;s++)o=a[s],i.set(o,r),r+=o.length;if(!(this._signatureCollection&&this._signatureCollection.length>0))return[3,21];h=this._signatureCollection.length,c=0,d.label=18;case 18:return c<h?(this._signature=this._signatureCollection[c]._signatureDictionary,[4,this._signature._documentSavedAsync(i)]):[3,21];case 19:d.sent(),d.label=20;case 20:return c++,[3,18];case 21:return this._document.fileStructure.isIncrementalUpdate||(_=new Fs(i),this._stream=_,this._document._stream=_),this._uint8Chunks=[],[2,i]}})})},i.prototype._writeStringAsync=function(t,e){return Ja(this,void 0,void 0,function(){var i;return Ya(this,function(r){switch(r.label){case 0:i=0,r.label=1;case 1:return i<t.length?(e.push(255&t.charCodeAt(i)),i%1e4!=0?[3,3]:[4,new Promise(function(t){return setTimeout(t,0)})]):[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},i.prototype._writeObjectCollectionAsync=function(e,i){return Ja(this,void 0,void 0,function(){var r,n,s,a=this;return Ya(this,function(o){switch(o.label){case 0:return r=new Map,this._indexes=[],this._indexes.push(0,1),n=512e3,s=0,e.forEach(function(t,e){return Ja(a,void 0,void 0,function(){return Ya(this,function(a){switch(a.label){case 0:return this._writeObjectToBuffer(e,t,i,r),i.length>n?[4,this._flushBufferAsync(i)]:[3,2];case 1:a.sent(),a.label=2;case 2:return++s%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:a.sent(),a.label=4;case 4:return[2]}})})}),this._cacheMap.forEach(function(t,o){return Ja(a,void 0,void 0,function(){return Ya(this,function(a){switch(a.label){case 0:return e.has(o)?[3,4]:(this._writeObjectToBuffer(o,t,i,r),i.length>n?[4,this._flushBufferAsync(i)]:[3,2]);case 1:a.sent(),a.label=2;case 2:return++s%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:a.sent(),a.label=4;case 4:return[2]}})})}),this._document.fileStructure._crossReferenceType!==t.PdfCrossReferenceType.stream?[3,2]:(this._objectStream=void 0,this._objectStreamCollection=r,[4,this._writeXrefStreamAsync(i)]);case 1:return o.sent(),[3,4];case 2:return[4,this._writeXrefTableAsync(i)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},i.prototype._flushBufferAsync=function(t){return Ja(this,void 0,void 0,function(){var e,i;return Ya(this,function(r){if(0===t.length)return[2];for(e=new Uint8Array(t.length),i=0;i<t.length;i++)e[i]=t[i];return this._uint8Chunks.push(e),this._bufferLength+=e.length,t.length=0,[2]})})},i.prototype._writeXrefStreamAsync=function(t){return Ja(this,void 0,void 0,function(){return Ya(this,function(e){return this._writeXrefStream(t),[2]})})},i.prototype._writeXrefTableAsync=function(t){return Ja(this,void 0,void 0,function(){return Ya(this,function(e){return this._writeXrefTable(t),[2]})})},i.prototype._saveAsStreamAsync=function(t,e){return Ja(this,void 0,void 0,function(){var i,r,n,s=this;return Ya(this,function(a){switch(a.label){case 0:return i=new Map,this._indexes=[],this._indexes.push(0,1),this._offsets=[],r=512e3,n=0,this._cacheMap.forEach(function(i,a){return Ja(s,void 0,void 0,function(){var s,o;return Ya(this,function(h){switch(h.label){case 0:return i instanceof Rs?!(s=i.dictionary)||!s._updated||s.isCatalog&&!this._allowCatalog||s._isProcessed?[3,4]:(o=void 0,this._encrypt&&(o=this._encrypt._createCipherTransform(a.objectNumber,a.generationNumber)),this._updatedDictionary(t,a,e,i,o),s._isProcessed=!0,e.length>r?[4,this._flushBufferAsync(e)]:[3,2]):[3,4];case 1:h.sent(),h.label=2;case 2:return++n%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:h.sent(),h.label=4;case 4:return[2]}})})}),this._cacheMap.forEach(function(a,o){return Ja(s,void 0,void 0,function(){var s;return Ya(this,function(h){switch(h.label){case 0:return a instanceof Ts?a._updated&&!a.isCatalog&&!a._isProcessed||a._isSignature?(a._isSignature?this._updatedDictionary(t,o,e,a):this._writeArchiveStream(i,o,a),[3,3]):[3,1]:[3,4];case 1:return a._updated&&(a.isCatalog||this._allowCatalog)?(this._updatedDictionary(t,o,e,a),e.length>r?[4,this._flushBufferAsync(e)]:[3,3]):[3,3];case 2:h.sent(),h.label=3;case 3:return[3,6];case 4:return a instanceof Rs?!(s=a.dictionary)||!s._updated||s.isCatalog&&!this._allowCatalog||s._isProcessed?[3,6]:(this._updatedDictionary(t,o,e,a),e.length>r?[4,this._flushBufferAsync(e)]:[3,6]):[3,6];case 5:h.sent(),h.label=6;case 6:return++n%100!=0?[3,8]:[4,new Promise(function(t){return setTimeout(t,0)})];case 7:h.sent(),h.label=8;case 8:return[2]}})})}),this._objectStream=void 0,this._objectStreamCollection=i,[4,this._writeXrefStreamAsync(e)];case 1:return a.sent(),[2]}})})},i.prototype._saveAsTableAsync=function(t,e){return Ja(this,void 0,void 0,function(){var i,r,n,s,a=this;return Ya(this,function(o){switch(o.label){case 0:return i="",r=512e3,n=0,this._cacheMap.forEach(function(s,o){return Ja(a,void 0,void 0,function(){var a,h,c;return Ya(this,function(_){switch(_.label){case 0:return s instanceof Ts?a=s:s instanceof Rs&&(a=s.dictionary),a?a._updated&&(!a.isCatalog||this._allowCatalog)||a._isSignature?(h=this._processString((t+this._bufferLength+e.length).toString(),10),c=this._processString(o.generationNumber.toString(),5),i+=o.objectNumber+" 1"+this._newLine+h+" "+c+" n"+this._newLine,this._writeObject(s,e,o),n++,e.length>r||n%2==0?[4,this._flushBufferAsync(e)]:[3,2]):[3,4]:[3,4];case 1:_.sent(),_.label=2;case 2:return n%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:_.sent(),_.label=4;case 4:return[2]}})})}),s=this._bufferLength+e.length+t,[4,this._writeStringAsync("xref"+this._newLine+"0 1"+this._newLine+"0000000000 65535 f"+this._newLine,e)];case 1:return o.sent(),[4,this._writeXrefAsync(e,i,s)];case 2:return o.sent(),e.length>0?[4,this._flushBufferAsync(e)]:[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}})})},i.prototype._writeXrefAsync=function(t,e,i){return Ja(this,void 0,void 0,function(){return Ya(this,function(r){return this._writeXref(t,e,i),[2]})})},i}(),Za=function(){function t(){}return t}(),$a=function(){function t(){}return t}(),to=function(){function t(){}return t}(),eo=function(){function t(t){this._indexes="",this._length=0,this._crossReference=t,this._reference=t._getNextReference(),this._archiveXRef="",this._updatedStream=[],this._collection=[]}return t.prototype._writeObject=function(t,e){this._archiveXRef+=t.objectNumber+" "+this._updatedStream.length+this._crossReference._newLine,this._collection.push(t.objectNumber,1),this._crossReference._writeObject(e,this._updatedStream),this._length++},t.prototype._save=function(t,e){var i=[];this._crossReference._writeString(this._archiveXRef,i),this._crossReference._writeBytes(this._updatedStream,i);var r=new Ts(this._crossReference);r.set("Type",vs.get("ObjStm")),r.set("N",this._length),r.set("First",this._archiveXRef.length),r.set("Length",i.length);var n=new Fs(i,r,0,i.length);this._archiveOffset=this._crossReference._bufferLength+e+t.length;var s;this._crossReference._encrypt&&(s=this._crossReference._encrypt._createCipherTransform(this._reference.objectNumber,this._reference.generationNumber)),this._crossReference._writeObject(n,t,this._reference,s)},t}(),io=function(){function t(t){var e=this;if(this._pointer=0,!(t._cacheMap instanceof Map))throw new Error("Expected _cacheMap to be a Map.");this._reference=[],this._cache=t._cacheMap,this._mainObjectCollection=new Map;var i=!1;if(this._crossReference=t,this._cache.forEach(function(t,r){!i&&t instanceof Ts&&t.isCatalog&&(e._addToMainObjectCollection(r,t),i=!0)}),t._trailer&&t._trailer.has("Info")){var r=t._trailer.getRaw("Info");if(r&&r instanceof Ss){var n=t._fetch(r);n&&n instanceof Ts&&(n._updated=!0,this._addToMainObjectCollection(r,n))}else r&&r instanceof Ts&&(r._updated=!0,this._addToMainObjectCollection(this._crossReference._getNextReference(),r))}this._parseObjectCollection()}return t.prototype._parseObjectCollection=function(){for(var t=this,e=this;this._pointer<this._mainObjectCollection.size;)!function(){var i=new Map,r=0;e._mainObjectCollection.forEach(function(e,n){r===t._pointer&&(i.set(n,e),t._parse(n,e)),r++}),e._pointer++}();return this._addReferencesToMainCollection(),this._mainObjectCollection},t.prototype._addToMainObjectCollection=function(t,e){this._reference.push(t),this._mainObjectCollection.set(t,e)},t.prototype._parseFetchValue=function(t){var e=this._crossReference._fetch(t);this._parse(t,e)},t.prototype._parse=function(t,e){var i=this;e instanceof Ts?this._parseDictionary(e):e instanceof Rs?this._parseStream(t,e):e instanceof Ss?this._parseFetchValue(e):Array.isArray(e)&&e.length>0?e.every(function(t){return t instanceof Ss})?e.forEach(function(t){return i._parseFetchValue(t)}):(e.forEach(function(t){t instanceof Ss&&i._parseFetchValue(t)}),-1!==this._reference.indexOf(t)||this._mainObjectCollection.has(t)||this._addToMainObjectCollection(t,e)):"number"==typeof e&&(-1!==this._reference.indexOf(t)||this._mainObjectCollection.has(t)||this._addToMainObjectCollection(t,e))},t.prototype._addReferencesToMainCollection=function(){var t=this,e=[];this._cache.forEach(function(i,r){t._mainObjectCollection.has(r)||e.push({key:r,value:i})}),e.forEach(function(e){var i=e.key,r=e.value;t._addToMainObjectCollection(i,r)})},t.prototype._parseDictionary=function(t){var e=this;t._isVisited||(t._isVisited=!0,t.forEach(function(t,i){var r=function(t){if(!e._mainObjectCollection.has(t)&&-1===e._reference.indexOf(t)){var i=e._crossReference._fetch(t);i instanceof Ss&&(i=e._crossReference._fetch(i)),i instanceof Rs?e._parseStream(t,i):e._addToMainObjectCollection(t,i)}};i instanceof Ss?r(i):Array.isArray(i)?i.forEach(function(t){t instanceof Ss?r(t):t instanceof Ts&&e._parseDictionary(t)}):i instanceof Ts&&e._parseDictionary(i)}))},t.prototype._parseStream=function(t,e){if(this._parseDictionary(e.dictionary),-1===this._reference.indexOf(t)&&!this._mainObjectCollection.has(t)){var i=e.dictionary.get("Type"),r=e.dictionary.get("Subtype"),n=void 0;e.dictionary._updated||i&&("XObject"===i.name||"Metadata"===i.name)&&("Form"===r.name||"XML"===r.name)?n=this._crossReference._fetch(t):(n=this._crossReference._fetch(t,!0))._isCompress=!1,this._addToMainObjectCollection(t,n)}},t}(),ro=function(){function i(e,i){this._isDefaultAppearance=!1,this._hasKids=!1,this._setAppearance=!1,this._exportEmptyFields=!1,this._fieldCollection=[],this._signFlag=t._SignatureFlag.none,this._isNeedAppearances=!1,this._formNames=[],this._fieldAutoNaming=!1,this._fieldName=[],this._fontCache=new Map,this._requiresPostProcessing=!1,this._isValidKids=!1,this._dictionary=e,this._crossReference=i,this._parsedFields=new Map,this._fields=[],this._addedFieldNames=new Set,this._createFields()}return Object.defineProperty(i.prototype,"count",{get:function(){return this._fields.length},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"needAppearances",{get:function(){return this._dictionary.has("NeedAppearances")&&(this._needAppearances=this._dictionary.get("NeedAppearances")),this._needAppearances},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"exportEmptyFields",{get:function(){return this._exportEmptyFields},set:function(t){this._exportEmptyFields=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.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}),Object.defineProperty(i.prototype,"fieldAutoNaming",{get:function(){return this._fieldAutoNaming},set:function(t){this._fieldAutoNaming=t},enumerable:!0,configurable:!0}),i.prototype.fieldAt=function(t){if(t<0||t>=this._fields.length)throw Error("Index out of range.");var e;if(this._parsedFields.has(t))e=this._parsedFields.get(t),this._isNeedAppearances=!0;else{var i=void 0,r=this._fields[t];r&&r instanceof Ss&&(i=this._crossReference._fetch(r)),i&&(e=this._parseFields(i,r),this._parsedFields.set(t,e),e&&e instanceof Nr&&(e._annotationIndex=t))}return e},i.prototype._getPageWidgetCollection=function(){this._pageWidgetReference=new Map;var t=this._crossReference._document;if(t)for(var e=0;e<t.pageCount;e++){var i=t.getPage(e);if(i&&i._pageDictionary){var r=[];if(i._pageDictionary.has("Annots")&&(r=i._pageDictionary.getRaw("Annots"))instanceof Ss&&(r=this._crossReference._fetch(r)),r&&Array.isArray(r))for(var n=0;n<r.length;n++){var s=r[n];if(s&&s instanceof Ss){var a=this._crossReference._fetch(s);a&&a.has("Subtype")&&a.get("Subtype")&&"Widget"===a.get("Subtype").name&&this._pageWidgetReference.set(s,a)}}}}},i.prototype._getField=function(t){var e=this;if(!this._terminalFields||t<0||t>=this._terminalFields.length)return null;this._pageWidgetReference||this._getPageWidgetCollection();var i=this._terminalFields[t],r=i._reference;if((this._dictionary?this._dictionary.get("Fields"):null)&&this._pageWidgetReference&&this._pageWidgetReference.size>0){var n=!1;this._pageWidgetReference.forEach(function(t,s){n||i&&e._compareWidgets(t,i)&&(i.has("P")||(i=t,e._fieldsMap&&e._fieldsMap.has(t)&&(r=e._fieldsMap.get(t))),n=!0)})}var s=this._parseFields(i,r);return s&&(s._form=this),s},i.prototype._getFieldFromDictionary=function(t){var e=this;this._pageWidgetReference||this._getPageWidgetCollection();var i=t,r=i._reference;if((this._dictionary?this._dictionary.get("Fields"):null)&&this._pageWidgetReference&&this._pageWidgetReference.size>0){var n=!1;this._pageWidgetReference.forEach(function(t,s){n||i&&e._compareWidgets(t,i)&&(i.has("P")||(i=t,e._fieldsMap&&e._fieldsMap.has(t)&&(r=e._fieldsMap.get(t))),n=!0)})}var s=this._parseFields(i,r);return s&&(s._form=this),s},i.prototype._parseFields=function(e,i){var r;if(e){var n=D(e,"FT",!1,!0),s=0,a=D(e,"Ff",!1,!0);if(void 0!==a&&(s=a),n)switch(n.name.toLowerCase()){case"tx":r=jr._load(this,e,this._crossReference,i);break;case"btn":r=0!=(s&t._FieldFlag.pushButton)?Vr._load(this,e,this._crossReference,i):0!=(s&t._FieldFlag.radio)?Ur._load(this,e,this._crossReference,i):zr._load(this,e,this._crossReference,i);break;case"ch":r=0!=(s&t._FieldFlag.combo)?Wr._load(this,e,this._crossReference,i):qr._load(this,e,this._crossReference,i);break;case"sig":r=Gr._load(this,e,this._crossReference,i)}}return r},i.prototype.add=function(t){if(e.initializeTelemetryFeature("AcroForm","PDFLibrary"),this._fields.length>0){var i=this._getFields().find(function(e){return e.name===t.name});if(i&&this._fieldAutoNaming){var r=this._getCorrectName(t._name);return t._name=r,t._dictionary.update("T",r),this._fieldName.push(t._name),this._doAdd(t)}if(i&&(i instanceof Gr&&(i._isLoaded||i._crossReference._document._isLoaded)||!(i instanceof Gr))&&this._checkType(i,t))return this._fieldName.push(t._name),this._groupingFormFields(t,i)}return this._requiresPostProcessing=!0,this._fieldName.push(t._name),this._doAdd(t)},i.prototype._doAdd=function(e){return-1===this._fields.indexOf(e._ref)&&(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 instanceof Gr&&(e._form._signatureFlag=t._SignatureFlag.signatureExists|t._SignatureFlag.appendOnly),this._isNeedAppearances=!0),this._fields.length-1},i.prototype._groupingFormFields=function(t,e){if(e._name===t._name&&(e.flatten||t.flatten)&&(t.flatten=!0,e.flatten=!0),t instanceof Ur&&e instanceof Ur){var i=e._dictionary;i&&i.has("Opt")&&delete i._map.Opt;var r=[];r.push(e),r.push(t);var n=0,s=-1;if(r.forEach(function(t){if(t.selectedIndex>=0){var e=n+t.selectedIndex;e>s&&(s=e)}n+=t._kids.length}),e._kids.length!==e._parsedItems.size)for(u=0;u<e._kids.length;u++){var a=e._parsedItems.get(u);a&&a.value===e.itemAt(u).value||e._parsedItems.set(u,e.itemAt(u))}if(t._dictionary.get("Kids").length>0){for(var o=e._dictionary.get("Kids"),h=e.itemsCount,c=0;c<t.itemsCount;c++){var _=t.itemAt(c)._dictionary;_&&_.has("Parent")&&delete _._map.Parent,_.set("Parent",e._ref),t.itemAt(c)._field=e,t.itemAt(c)._index=h++,n++;l=t.itemAt(c)._ref;o.push(l)}e._dictionary.update("Kids",o),e._dictionary._updated=!0}e.allowUnisonSelection=t.allowUnisonSelection;for(var d=e._parsedItems.size,u=0;u<t.itemsCount;u++)e._parsedItems.set(d,t.itemAt(u)),d++;return t.allowUnisonSelection||this._addItemsToOptionsArray(e),r.length>0&&s>=0&&s<n&&(r[0].selectedIndex=s),this._fields.length-1}(_=t.itemAt(0)._dictionary)&&_.has("Parent")&&delete _._map.Parent,t.itemAt(0)._dictionary.set("Parent",e._ref);var l=t.itemAt(0)._ref;if((o=e._dictionary.get("Kids"))&&o.length>0?(o.push(l),e._dictionary.update("Kids",o),e._dictionary._updated=!0):this._updateFieldsKids(e,t),t instanceof zr&&e instanceof zr){var f=t.itemAt(0),p=void 0;f&&"string"==typeof f.exportValue&&(p=f.exportValue);var g=e.itemsCount-1;if(e._parsedItems.set(g,f),f._field=e,f._index=g,!p&&""!==p)return this._fields.length-1;var y=this._findFirstByExportValue(e,p),m=y>=0,b=this._getSelectedExportValue(e);if(f.checked)m?((v=e.itemAt(y))&&!v.checked&&(v._field._isUpdating=!1,v.checked=!0),f.checked||(f.checked=!0)):f.checked=!0;else if(b&&b===p)f.checked=!0;else if(m){var v=e.itemAt(y);v&&v.checked&&!f.checked&&(f.checked=!0)}return this._fields.length-1}return t instanceof Vr&&e instanceof Vr&&(e._setAppearance||(e._setAppearance=!0)),this._fields.length-1},i.prototype._findFirstByExportValue=function(t,e){if(!t||t.itemsCount<=0||null==e)return-1;for(var i=0;i<t.itemsCount;i++){var r=t.itemAt(i);if(r&&r.exportValue===e)return i}return-1},i.prototype._getSelectedExportValue=function(t){var e;if(t){if(t._dictionary&&t._dictionary.has("V")){var i=t._dictionary.get("V");i&&"string"==typeof i.name&&(e=i.name)}for(var r=0;r<t.itemsCount;r++){var n=t.itemAt(r);n&&n.checked&&(e=n.exportValue)}return e}},i.prototype._updateFieldsKids=function(t,e){var i=t._dictionary,r=new Ts(this._crossReference),n=this._crossReference._getNextReference();["FT","T","V","Ff","Opt","I","TU"].forEach(function(t){i.has(t)&&(r.update(t,i.get(t)),delete i._map[t])}),t._dictionary._updated=!0,i.set("Parent",n),e.itemAt(0)._dictionary.set("Parent",n);var s=[];s.push(t._ref);var a=e.itemAt(0)._ref;s.push(a),r.update("Kids",s),r._updated=!0,this._crossReference._cacheMap.set(n,r);var o=this._crossReference._document._catalog._catalogDictionary.get("AcroForm").get("Fields"),h=o.indexOf(t._ref);-1!==h&&(o[h]=n),t._ref=n,t._dictionary=r,t._kids=r.get("Kids"),t._dictionary._updated=!0},i.prototype._addItemsToOptionsArray=function(t){for(var e=new Set,i=new Set,r=[],n=t,s=0;s<n.itemsCount;s++){var a=n.itemAt(s).value;r.push(a),e.has(a)?i.add(a):e.add(a)}i.size>0&&t._dictionary.set("Opt",r)},i.prototype._getCorrectName=function(t){var e=t;return-1!==this._fieldName.indexOf(t)&&(e=t+"_"+this._generateUniqueIdentifier()),e},i.prototype._generateUniqueIdentifier=function(){return Math.floor(1e4*Math.random()).toString()},i.prototype.removeField=function(t){var e=this._fields.indexOf(t._ref);e>=0&&this.removeFieldAt(e)},i.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=void 0;r&&(n=r._getPage())&&n._removeAnnotation(r._ref)}else e._dictionary.has("Subtype")&&"Widget"===e._dictionary.get("Subtype").name&&(n=e.page)&&n._removeAnnotation(e._ref);this._parsedFields.delete(t),this._reorderParsedAnnotations(t)}this._fields.splice(t,1);var s=this._crossReference._document,a=s._catalog;0===this._fields.length&&s&&a&&a._catalogDictionary&&(a._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0),this._dictionary.set("Fields",this._fields),this._dictionary._updated=!0},i.prototype._reorderParsedAnnotations=function(t){var e=new Map;this._parsedFields.forEach(function(i,r){r>t?e.set(r-1,i):e.set(r,i)}),this._parsedFields=e},i.prototype.setDefaultAppearance=function(t){this._setAppearance=!t,this._needAppearances=t,this._isDefaultAppearance=t},i.prototype.orderFormFields=function(e){var i=this;if(null===e||void 0===e)this.orderFormFields(new Map);else{var r,n,s=this._crossReference._document;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(),_e(this._fieldCollection)&&this._fieldCollection.length>0&&this._fieldCollection[0].page&&s){this._fieldCollection.forEach(function(t){if(t.page){var e=_(s,i._sortItemByPageIndex(t,!0)._pageDictionary);if(e>=0){o.has(e)?(n=o.get(e)).push(t):((n=[]).push(t),o.set(e,n));var r=s.getPage(e);i._tabCollection.has(e)||i._tabCollection.set(e,r.tabOrder),a&&(r.tabOrder=i._tabCollection.get(e))}}});var h=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)}),n.forEach(function(t,e){var r=i._fieldCollection.indexOf(t);if(-1!==r&&r!==h+e){var n=i._fieldCollection[r];i._fieldCollection.splice(r,1),i._fieldCollection.splice(h+e,0,n)}})}h+=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(),this._fieldCollection.forEach(function(t,e){i._parsedFields.set(e,t),i._fields[e]=t._ref,r&&t.page._pageDictionary.update("Tabs",r)}),this._dictionary.update("Fields",this._fields)}},i.prototype._createFields=function(){var t,e=this,i=new Map;this._dictionary&&this._dictionary.has("Fields")&&(t=this._dictionary.get("Fields"));for(var r=0,n=[],s=[];t&&t.length>0;){for(var a=this;r<t.length;r++)!function(){var o=t[r],h=void 0;o&&o instanceof Ss&&(h=a._crossReference._fetch(o))&&h instanceof Ts&&i.set(h,o);var c=void 0;if(h&&h instanceof Ts&&h.has("Kids")&&(c=h.get("Kids"))&&c.length>0&&c.forEach(function(t){if(t instanceof Ss){var r=e._crossReference._fetch(t);r&&(i.set(r,t),r.has("Parent")||r.update("Parent",o))}}),c){if(!h.has("FT")||a._isNode(c))n.push({fields:t,count:r}),a._hasKids=!0,r=-1,t=c;else if(s.push(h),h.has("T")){_=h.get("T");-1===a._formNames.indexOf(_)&&a._formNames.push(_)}}else if(h&&h instanceof Ts&&-1===s.indexOf(h)&&(s.push(h),h.has("T"))){var _=h.get("T");-1===a._formNames.indexOf(_)&&a._formNames.push(_)}}();if(0===n.length)break;var o=n.pop();t=o.fields,r=o.count+1}this._terminalFields=s,this._fieldsMap=i,this._createFieldCollection(s,i)},i.prototype._createFieldCollection=function(t,e){var i=new Map,r=this._crossReference._document,n=[];if(this._widgetDictionary=new Map,r)for(f=0;f<r.pageCount;f++){var s=r.getPage(f);if(s&&s._pageDictionary){var a=s._pageDictionary,o=[];a&&a.has("Annots")&&(o=a.getRaw("Annots"))instanceof Ss&&(o=this._crossReference._fetch(o));var h=[];if(o&&Array.isArray(o)&&o.length>0){for(var c=0;c<o.length;c++){var _=o[c];if(_&&_ instanceof Ss){n.push(_);var d=this._crossReference._fetch(_);if(d&&d.has("Subtype")&&"Widget"===d.get("Subtype").name){if(d._reference=_,d.has("T")){var u=d.get("T");if(-1===this._formNames.indexOf(u)&&u){var l=this._widgetDictionary.get(u);l||(l=[],this._widgetDictionary.set(u,l)),l.push(d)}}h.push(d)}}}i.set(f,h)}}}for(var f=0;f<t.length;f++){var p=t[f],g=e.get(p);g&&this._removeInvalidFields(p,i,g,n)&&-1===this._fields.indexOf(g)&&this._fields.push(g)}t.length>0&&this._processRemainingWidgets(),this._createFormFieldsFromWidgets(t.length)},i.prototype._processRemainingWidgets=function(){for(var t=this._crossReference._document,e=0;e<t.pageCount;e++){var i=t.getPage(e);if(i&&i._pageDictionary){var r=i._pageDictionary,n=[];r.has("Annots")&&(n=r.getRaw("Annots"))instanceof Ss&&(n=this._crossReference._fetch(n));for(var s=0;s<n.length;s++){var a=n[s];if(a instanceof Ss&&-1===this._fields.indexOf(a)){var o=this._crossReference._fetch(a);if(o&&o.has("Subtype")&&o.get("Subtype")&&"Widget"===o.get("Subtype").name&&o.has("P"))if(o.has("Parent")){var h=o.getRaw("Parent"),c=void 0;if(h&&h instanceof Ss&&(c=this._crossReference._fetch(h))&&c.has("T")){var _=c.get("T");-1===this._formNames.indexOf(_)&&-1===this._fields.indexOf(h)&&this._fields.push(h)}}else o.has("FT")&&o.has("T")&&-1===this._formNames.indexOf(o.get("T"))&&this._fields.push(a)}}}}},i.prototype._hasValidKids=function(t){var e=t.get("Kids");return e&&e.length>0},i.prototype._removeInvalidFields=function(t,e,i,r){if(!t)return!1;if(t.has("Kids")&&this._hasValidKids(t)){this._isValidKids=!0;for(var n=t.get("Kids"),s=[],a=!1,o=0;o<n.length;o++){var h=void 0,c=n[o];if(c instanceof Ss?h=this._crossReference._fetch(c):c instanceof Ts&&(h=c),h){if(h.has("P")){var _=h.get("P"),d=void 0;if(_ instanceof Ss?d=this._crossReference._fetch(_):_ instanceof Ts&&(d=_),d&&d.has("Annots")){var u=d.get("Annots");if(u instanceof Ss&&(u=this._crossReference._fetch(u)),u&&Array.isArray(u)&&!(-1!==u.indexOf(c))){s.push(o);continue}}}this._removeInvalidFields(h,e,c,r)?a=!0:s.push(o)}else s.push(o)}for(o=s.length-1;o>=0;o--)n.splice(s[o],1);return this._isValidKids=!1,!!(n.length>0&&a)&&(t.update("Kids",n),!0)}return this._validateField(t,e,i,r)},i.prototype._validateField=function(t,e,i,r){var n=this;if(!t||!e)return!1;if(t.has("P")&&t.has("Rect"))return!0;if(r&&-1!==r.indexOf(i))return!0;var s=!1;return e.forEach(function(e,i){if(e&&e.length>0)for(var r=0;r<e.length;r++){var a=e[r];if(a&&n._compareWidgets(a,t)){if(n._isValidKids){if(s=!0,!t.has("P")&&!a.has("P")){o=a._crossReference._document.getPage(i);t.update("P",o._ref)}return}if(-1===n._fields.indexOf(a._reference)){if(a.has("FT")&&a.has("Type")&&"Annot"===a.get("Type").name&&a.has("Subtype")&&"Widget"===a.get("Subtype").name&&!a.has("P")){var o=a._crossReference._document.getPage(i);a.update("P",o._ref)}return void n._fields.push(a._reference)}}}}),s},i.prototype._compareWidgets=function(t,e){var i=!1;if(t&&e){var r=t.size,n=e.size;if(r===n||r+1===n||r===n+1){var s=t.get("FT"),a=e.get("FT");if(s&&a&&s.name===a.name){var o=t.get("T"),h=e.get("T");if(o&&h&&o===h){var c=t.get("V"),_=e.get("V");if(c&&_&&c===_)i=!0;else if(t.has("Parent")&&e.has("Parent")){var d=t.getRaw("Parent"),u=e.getRaw("Parent");d&&u&&d===u&&(i=!0)}else if(t.has("TU")&&e.has("TU")){var l=t.get("TU"),f=e.get("TU");l&&f&&l===f&&(i=!0)}else if(t.has("Rect")&&e.has("Rect")){var p=t.get("Rect"),g=e.get("Rect");if(Array.isArray(p)&&Array.isArray(g)&&p.length===g.length){var y=p[0],m=g[0],b=p[1],v=g[1];"number"==typeof y&&"number"==typeof m&&"number"==typeof b&&"number"==typeof v&&y===m&&b===v&&(i=!0)}}}}else if(!s&&!a){if(t.has("TU")&&e.has("TU")){var l=t.get("TU"),f=e.get("TU");i=!(!l||!f||l!==f)}if(t.has("Rect")&&e.has("Rect")){var p=t.get("Rect"),g=e.get("Rect");if(Array.isArray(p)&&Array.isArray(g)&&p.length===g.length){var y=p[0],m=g[0],b=p[1],v=g[1];"number"==typeof y&&"number"==typeof m&&"number"==typeof b&&"number"==typeof v&&(i=y===m&&b===v)}}}}}return i},i.prototype._createFormFieldsFromWidgets=function(t){this._terminalFields&&(this._processTerminalFields(t),this._processWidgetDictionary())},i.prototype._processTerminalFields=function(t){for(var e=t;e<this._terminalFields.length;e++){var i=this.fieldAt(e);if(i){var r=i.name;r&&!this._addedFieldNames.has(r)?(this._doAdd(i),this._addedFieldNames.add(r)):r||this._doAdd(i)}}},i.prototype._processWidgetDictionary=function(){var t=this;this._widgetDictionary&&this._widgetDictionary.forEach(function(e){e&&0!==e.length&&(e.length>1?t._processMultipleWidgets(e):t._processSingleWidget(e[0]))})},i.prototype._processMultipleWidgets=function(t){var e=t[0],i=this._getFieldFromDictionary(e);i&&(this._terminalFields.push(i._dictionary),this._doAdd(i));for(var r=i instanceof Ur?i:void 0,n=1;n<t.length;n++){var s=t[n],a=this._getFieldFromDictionary(s);a&&(r&&a instanceof Ur&&this._mergeRadioButtonItems(r,a),a.name&&this._handleFieldNaming(a),this._terminalFields.push(a._dictionary),this._doAdd(a))}},i.prototype._mergeRadioButtonItems=function(t,e){for(var i=0;i<e.itemsCount;i++){var r=e.itemAt(i);if(r){var n=t._parsedItems.size;t._parsedItems.set(n,r)}}},i.prototype._handleFieldNaming=function(t){this._validFieldName(t)?this._fieldName.push(t.name):t._dictionary.update("T",this._getCorrectName(t.name))},i.prototype._processSingleWidget=function(t){if(t){-1===this._terminalFields.indexOf(t)&&this._terminalFields.push(t);var e=this._terminalFields.length-1,i=e>=0?this._getField(e):void 0;i&&this._doAdd(i)}},i.prototype._validFieldName=function(t){return-1===this._fieldName.indexOf(t.name)},i.prototype._isNode=function(t){var e=!1;if(_e(t)&&t.length>0){var i=t[0],r=void 0;if(_e(i)&&(i instanceof Ts?r=i:i instanceof Ss&&(r=this._crossReference._fetch(i))),r&&r.has("Subtype")){var n=r.get("Subtype");n&&"Widget"!==n.name&&(e=!0)}}return e},i.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&&e instanceof Ts?i=e:e&&e instanceof Ss&&(i=t._crossReference._fetch(e)),i&&i.has("Subtype")){var r=i.get("Subtype");r&&"Widget"===r.name&&t._widgetReferences.push(e)}})}else t._widgetReferences.push(e)})),this._widgetReferences},i.prototype._doPostProcess=function(e,i){for(var r=this.count-1;r>=0;r--){var n=this.fieldAt(r);if(n&&!n._isLoaded&&void 0!==n._tabIndex&&n._tabIndex>=0){var s=n._page;if(s&&s._pageDictionary.has("Annots")&&(s.tabOrder===t.PdfFormFieldsTabOrder.manual||this._tabOrder===t.PdfFormFieldsTabOrder.manual)){var a=s._pageDictionary.get("Annots"),o=new On(a,this._crossReference,s);s._annotations=o;for(var h=0;h<n.itemsCount;h++){var c=n.itemAt(h);if(c&&c instanceof Pn){var _=a.indexOf(c._ref);if(_<0&&(_=n._annotationIndex),_>=0){var d=s.annotations._reArrange(n._ref,n._tabIndex,_);s._pageDictionary.update("Annots",d),s._pageDictionary._updated=!0}}}}}n&&(i&&n.page===i||!i)&&(i&&(n._isImport=!0),n._doPostProcess(e||n.flatten),(!e&&n.flatten||e&&i&&n.page===i)&&this.removeFieldAt(r))}},i.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},i.prototype._getFields=function(){for(var t=[],e=0;e<this._fields.length;e++){var i=this.fieldAt(e);i&&i instanceof Nr&&t.push(i)}return t},i.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"),vs.get(i)}return null},i.prototype._compareFields=function(e,i){var r,n,s=0,a=e.page,o=i.page,h=a.rotation;if(a&&!a._isNew&&a instanceof zn&&o&&!o._isNew&&o instanceof zn){var c=this._sortItemByPageIndex(e,!1)._pageIndex,_=this._sortItemByPageIndex(i,!1)._pageIndex,d=void 0;d=e._dictionary.has("Kids")?this._getItemRectangle(e):this._getRectangle(e._dictionary);var u=void 0;u=i._dictionary.has("Kids")?this._getItemRectangle(i):this._getRectangle(i._dictionary);var l=d[3]-d[1],f=u[3]-u[1];if(d&&d.length>=2&&u&&u.length>=2){var p=d[0],g=d[1],y=u[0],m=u[1];if("number"==typeof p&&"number"==typeof y&&"number"==typeof g&&"number"==typeof m){n=c-_;if(this._tabOrder===t.PdfFormFieldsTabOrder.row){if(h===t.PdfRotationAngle.angle0){if(0!==(r=this._compare(m,g))){var b=-1===r&&g>m&&g-l/2<m;(b=b||1===r&&m>g&&m-f/2<g)&&(r=0)}s=0!==n?n:0!==r?r:this._compare(p,y)}else if(h===t.PdfRotationAngle.angle270){var v=Math.abs(p-y);s=0!==n?n:v<=2?this._compare(m,g):this._compare(y,p)}}else if(this._tabOrder===t.PdfFormFieldsTabOrder.column)r=this._compare(p,y),s=0!==n?n:0!==r?r:this._compare(m,g);else if((this._tabOrder===t.PdfFormFieldsTabOrder.manual||this._tabOrder===t.PdfFormFieldsTabOrder.none||this._tabOrder===t.PdfFormFieldsTabOrder.structure||this._tabOrder===t.PdfFormFieldsTabOrder.widget)&&e instanceof Nr&&i instanceof Nr){var w=e.tabIndex,S=i.tabIndex;r=this._compare(w,S),s=0!==n?n:r}}}}return s},i.prototype._getRectangle=function(t){var e;return t&&t.has("Rect")&&(e=t.getArray("Rect")),e},i.prototype._getItemRectangle=function(t){var e,i=t._dictionary;if(i.has("Kids")||(e=this._getRectangle(i)),i.has("Kids")){var r=i.getArray("Kids");if(r&&0!==r.length||(e=this._getRectangle(i)),_e(r)&&r.length>=1)if(1===r.length)e=this._getRectangle(r[0]);else{if(!(t&&t.itemsCount>1)){for(var n=i.getArray("Kids"),s=Number.MAX_VALUE,a=Number.MIN_VALUE,o=Number.MIN_VALUE,h=Number.MAX_VALUE,c=!1,_=0;_<n.length;_++){var d=void 0;(d=t&&t.itemsCount>_&&t.itemAt(_)?this._getRectangle(t.itemAt(_)._dictionary):this._getRectangle(n[_]))&&4===d.length&&(c=!0,s=Math.min(s,d[0]),h=Math.min(h,d[1]),o=Math.max(o,d[2]),a=Math.max(a,d[3]))}return c?[s,h,o,a]:this._getRectangle(i)}e=this._getRectangle(t.itemAt(0)._dictionary)}}return e},i.prototype._compare=function(t,e){return t>e?1:t<e?-1:0},i.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 u=void 0;return r=this._tabOrder===t.PdfFormFieldsTabOrder.row?0!==(u=this._compare(d,c))?u:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column?0!==(u=this._compare(h,_))?u:this._compare(d,c):0}}return r},i.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},i.prototype._sortFieldItems=function(t){var e=this;if(t._isLoaded&&(t instanceof jr||t instanceof qr||t instanceof zr||t instanceof Ur)){var i=t._parseItems();i.sort(function(t,i){return e._compareFieldItem(t,i)}),t._parsedItems.clear(),i.forEach(function(e,i){t._parsedItems.set(i,e)})}},i.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],u=void 0;this._tabOrder===t.PdfFormFieldsTabOrder.row?r=0!==(u=this._compare(n._pageIndex,s._pageIndex))?u:0!==(u=this._compare(d,c))?u:this._compare(h,_):this._tabOrder===t.PdfFormFieldsTabOrder.column&&(r=0!==(u=this._compare(n._pageIndex,s._pageIndex))?u:0!==(u=this._compare(h,_))?u:this._compare(d,c))}}return r},i.prototype._clear=function(){this._fields=[],this._parsedFields=new Map},i.prototype._checkType=function(t,e){return t instanceof jr&&e instanceof jr||t instanceof Vr&&e instanceof Vr||t instanceof zr&&e instanceof zr||t instanceof Wr&&e instanceof Wr||t instanceof qr&&e instanceof qr||t instanceof Ur&&e instanceof Ur||t instanceof Gr&&e instanceof Gr},i}(),no=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)}}(),so=function(t){function e(e){var i=t.call(this)||this;return i._annotationObjects=new Map,i._specialCharacters="âãÏÓ",null!==e&&void 0!==e&&(i._fileName=e),i}return no(e,t),e.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},e.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=it(),this._save()},e.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=this,a=0;a<n;a++)!function(r){var n=s._document.form.fieldAt(r),a=s._exportFormFieldsData(n);(n instanceof jr||n instanceof qr||n instanceof Wr||n instanceof Ur||n instanceof zr)&&e++,s._asPerSpecification?n instanceof jr||n instanceof qr||n instanceof Wr?(i.push(e),s.fdfString+="<</T("+n.name+")/V","string"==typeof a||Array.isArray(a)&&1===a.length?s.fdfString+="("+(Array.isArray(a)?a[0]:a)+")":Array.isArray(a)&&(s.fdfString+="[",a.forEach(function(e,i){t.fdfString+="("+e+")",i!==a.length-1&&(t.fdfString+=" ")}),s.fdfString+="]"),s.fdfString+=">>"):(n instanceof Ur||n instanceof zr)&&(i.push(e),s.fdfString+="<</T("+n.name+")/V/"+a+">>"):n instanceof jr||n instanceof qr||n instanceof Wr?(i.push(e),s.fdfString+=e+" 0 obj<</T <"+s._stringToHexString(n.name)+"> /V ","string"==typeof a||Array.isArray(a)&&1===a.length?s.fdfString+="<"+s._stringToHexString(Array.isArray(a)?a[0]:a)+">":Array.isArray(a)&&(s.fdfString+="[",a.forEach(function(e,i){t.fdfString+="<"+t._stringToHexString(e)+">",i!==a.length-1&&(t.fdfString+=" ")}),s.fdfString+="]"),s.fdfString+=" >>endobj\n"):(n instanceof Ur||n instanceof zr)&&(i.push(e),s.fdfString+=e+" 0 obj<</T <"+s._stringToHexString(n.name)+"> /V /",s.fdfString+=a+" >>endobj\n")}(a)}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(a=0;a<this._table.size;a++){var o=this._document.form.fieldAt(a);null!==o&&void 0!==o&&o.export&&(this.fdfString+=i[a]+" 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 h=new ArrayBuffer(1*this.fdfString.length),c=new Uint8Array(h);return c.forEach(function(e,i){c[i]=t.fdfString.charCodeAt(i)}),c},e.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(v(e));var i=new Fs(e);this._isAnnotationImport=!0;var r=new Ca(new Ta(i,!0,this._isAnnotationImport),null,!0,!1);this._readFdfData(r),_e(this._annotationObjects)&&this._annotationObjects.size>0&&this._annotationObjects.clear(),_e(this._table)&&this._table.size>0&&this._table.clear()},e.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(v(e));var i=new Fs(e),r=new Ca(new Ta(i,!0,this._isAnnotationExport),null,!1,!1);this._readFdfData(r)},e.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 Ts?(this._table.set(r,i),r=""):i instanceof Fs||i instanceof Hs?(this._table.set(r,i),r=""):i instanceof vs||Array.isArray(i)?(this._table.set(r,i),r=""):null!==i&&Number.isInteger(i)&&0!==i?t.first>=0&&(r=i.toString()+" "+t.first.toString()):i instanceof ws&&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(e._parseDictionary(r),r._crossReference=e._crossReference,r._updated=!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(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;if(!c._dictionary.has("P")&&"Popup"!==c._dictionary.get("Subtype").name){var u=o.objId.split(" ").map(Number),l=u[0],f=u[1];c._dictionary.update("P",Ss.get(l,f))}if(delete c._dictionary._map.Page,h._annotations.push(_),h._comments&&h._comments.length>0&&(h._comments=[]),o.set("Annots",h._annotations),o._updated=!0,h._parsedAnnotations.set(d,c),e._handlePopup(h,_,r,o),c instanceof _n&&c._dictionary.has("Parent")){var p=c._dictionary.getRaw("Parent");if(p&&p instanceof Ss){var g=e._crossReference._cacheMap.get(p);if(g&&g instanceof Ts&&g.has("Popup")){var y=g.get("Popup");y instanceof Ts&&y.has("Parent")&&g.update("Popup",_)}}}}}}}}}),this._groupHolders&&this._groupHolders.length>0&&this._groupHolders.forEach(function(t){if(t&&t.has("IRT")){var i=t.get("IRT");i&&(e._groupReferences&&e._groupReferences.has(i)?t.update("IRT",e._groupReferences.get(i)):delete t._map.IRT)}}),this._groupHolders=[],this._groupReferences=new Map}else{if(i=t.getObject(),this._asPerSpecification)for(;null!==i&&void 0!==i&&"EOF"!==i;)i instanceof Ts&&null!==i&&null!==i._map.FDF&&void 0!==i._map.FDF&&(i=i._map.FDF)instanceof Ts&&null!==i._map.Fields&&void 0!==i._map.Fields&&null!==(i=i._map.Fields)&&void 0!==i&&i.forEach(function(t){if(t instanceof Ts&&null!==t&&void 0!==t){var i=t.getArray("T"),r=void 0;r=t._map&&t._map.V instanceof vs?t.get("V").name:t.getArray("V"),null!==i&&void 0!==i&&i.length>0&&e._table.set(i,r)}}),i=t.getObject();else for((i=t.getObject())instanceof ws&&null!==i.command&&(i=i.command);null!==i&&void 0!==i&&"EOF"!==i;){if(i instanceof Ts){var n=i.getArray("T"),s=void 0;s=i._map&&i._map.V instanceof vs?i.get("V").name:i.getArray("V"),null!==n&&void 0!==n&&n.length>0&&this._table.set(n,s)}i=t.getObject()}this._importField()}},e.prototype._parseDictionary=function(t){var e=this;null!=t&&t.size>0&&t.forEach(function(i,r){"Parent"!==i&&"P"!==i&&"Page"!==i&&e._parseDictionaryData(t,i)})},e.prototype._parseDictionaryData=function(t,e){var i=t.get(e);if(i instanceof Ts)this._parseDictionary(i);else if(i instanceof Hs)this._parseDictionary(i.dictionary);else if(Array.isArray(i))this._parseArray(i);else if(i instanceof Ss){var r=i;if(r){var n=r.objectNumber+" "+r.generationNumber;if(this._annotationObjects.has(n))t.update(e,this._annotationObjects.get(n));else if(this._table.has(n)){var s=this._table,a=s.get(n);if(a instanceof Fs||a instanceof Hs){this._parseDictionary(a.dictionary);var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),a.dictionary._updated=!0,t.update(e,o),s.set(n,o)}else if(a instanceof Ts){this._parseDictionary(a);var h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,a),t.update(e,h),s.set(n,h)}else if(a instanceof Ss)t.update(e,a);else if(a instanceof vs){var c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,a),t.update(e,c),s.set(n,c)}else if(Array.isArray(a)){this._parseArray(a);var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,a),t.update(e,_),s.set(n,_)}}else delete t._map[e.toString()]}}},e.prototype._parseArray=function(t){if(Array.isArray(t)&&t.length>0)for(var e=t.length,i=0;i<e;i++){var r=t[Number.parseInt(i.toString(),10)];if(r&&r instanceof Ss){var n=r.objectNumber+" "+r.generationNumber;if(this._annotationObjects.has(n))t[Number.parseInt(i.toString(),10)]=this._annotationObjects.get(n);else if(this._table.has(n)){var s=this._table,a=s.get(n);if(a instanceof Ss)t[Number.parseInt(i.toString(),10)]=a;else if(a instanceof Ts||a instanceof Fs){var o=this._crossReference._getNextReference();this._crossReference._cacheMap.set(o,a),t[Number.parseInt(i.toString(),10)]=o,s.set(n,o)}}}}},e.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 Ts&&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"))for(var o=0,h=a.get("Annots")||[];o<h.length;o++){var c=h[o],_=c.objectNumber+" "+c.generationNumber,d=t.get(_);if(d){if(d instanceof Ts&&d.has("Parent")&&d.has("Subtype")){var u=d.get("Subtype"),l=d._get("Parent");if("Popup"===u.name&&l.objectNumber===c.objectNumber)continue}e.set(_,d)}t.delete(_)}}}t.delete(n)}}t.delete("trailer")}return e},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=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)}}})},e.prototype._exportAnnotationData=function(t,e){var i=Ji._whiteSpace+"0"+Ji._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 dn||c instanceof fn||c instanceof ln)){if(c instanceof _n&&c._dictionary.has("Parent"))continue;if(c instanceof bn||c instanceof sn)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[a]+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"}},e.prototype._exportAnnotation=function(t,e,i,r,n,s){this.fdfString=e;var a=new ao,o=t._dictionary,h=Ji._whiteSpace+"0"+Ji._whiteSpace+"obj\r\n",c="\r\nendobj\r\n";this._annotationID=i.toString(),this.fdfString+=i+h+"<<";var _=new Map,d=new Array;r.push(this._annotationID),o.set("Page",n);var u=this._getEntries(_,d,i,o,this.fdfString,s);i=u.index,_=u.list,d=u.streamReference,delete o._map.Page,this.fdfString+=">>"+c;for(var l=this;_.size>0;)!function(){var t=Array();_.forEach(function(e,i){t.push(i)});for(var e=0;e<t.length;e++){var a=t[e];if(_.get(a)instanceof Ts||_.get(a)instanceof Fs||_.get(a)instanceof Is||_.get(a)instanceof Hs){if(null!==(o=_.get(a)instanceof Ts?_.get(a):_.get(a).dictionary)&&void 0!==o){if(o instanceof Ts&&o.has("Type")){var u=o.get("Type");null!==u&&void 0!==u&&"Annot"===u.name&&(r.push(a.toString()),o.set("Page",n))}l.fdfString+=a+h+"<<";p=l._getEntries(_,d,i,o,l.fdfString,s);_=p.list,d=p.streamReference,i=p.index,o instanceof Ts&&o.has("Page")&&delete o._map.Page,l.fdfString+=">>",null!==d&&void 0!==d&&-1!==d.indexOf(a)&&l._appendStream(_.get(a),l.fdfString),l.fdfString+=c}}else if(_.get(a)instanceof vs)l.fdfString+=a+h,l.fdfString+="/"+_.get(a).name,l.fdfString+=c;else if(Array.isArray(_.get(a))){l.fdfString+=a+h;var f=_.get(a),p=l._appendArray(f,l.fdfString,i,s,_,d);i=p.index,l.fdfString+=c}else"boolean"==typeof _.get(a)?(l.fdfString+=a+h,l.fdfString+=" "+(_.get(a)?"true":"false"),l.fdfString+=c):"string"==typeof _.get(a)&&(l.fdfString+=a+h,l.fdfString+="("+l._getFormattedString(_.get(a))+")",l.fdfString+=c);_.delete(a)}}();return i++,a.index=i,a.annot=r,a},e.prototype._appendStream=function(t,e){var r=t;if(this.fdfString=e,(t instanceof Hs||t instanceof Fs||t instanceof Is)&&(r=t instanceof Hs?t.stream:t),t instanceof Hs||t instanceof Fs||t instanceof Is){var n=void 0,s=void 0,a=void 0;if(t instanceof Is)s=r.getString();else if(t instanceof Hs||t instanceof Fs)n=r.getByteRange(r.start,r.end),s=v(a=new Uint8Array(n));else{n=r.getBytes(),a=new Uint8Array(n);var o=new i.CompressedStreamWriter;o.write(a,0,a.length),o.close(),s=o.getCompressedString}this.fdfString+="stream\r\n",this.fdfString+=s,this.fdfString+="\r\nendstream"}},e.prototype._getEntries=function(t,e,i,r,n,s){var a=this,o=!1,h=new ao;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 vs)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 Ts){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 Ss){var u=r.get("Page");if("Parent"===t)a.fdfString+=" "+a._annotationID+" 0 R",a.fdfString+="/Page "+u;else if("IRT"===t){if(a._crossReference&&a._crossReference._fetch&&h){var l=a._crossReference._fetch(h);if(l&&l.has("NM")){var f=l.get("NM");null!==f&&void 0!==f&&(a.fdfString+="("+a._getFormattedString(f)+")")}}}else if("P"!==t){var p=h;null!==p&&void 0!==p&&(i++,a.fdfString+=" "+i+" 0 R",o&&e.push(i),r._crossReference||r.assignXref(a._crossReference),c.set(i,r.get(t)))}}o=!1}}),h.list=c,h.streamReference=e,h.index=i,h},e.prototype._appendArray=function(t,e,i,r,n,s){this.fdfString=e,this.fdfString+="[";var a=new ao,o=n;if(_e(t)&&t.length>0)for(var h=t.length,c=0;c<h;c++){var _=t[c];0!==c&&("number"==typeof _||_ instanceof Ss||"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},e.prototype._appendElement=function(t,e,i,r,n,s){this.fdfString=e;var a=new ao,o=n;if("number"==typeof t)this.fdfString+=t.toString();else if(t instanceof vs)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 Ts){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+=">>"}else if(t instanceof Ss){var c=t;null!==c&&void 0!==c&&(i++,this.fdfString+=" "+i+" 0 R",r&&s.push(i),o.set(i,this._crossReference._cacheMap.get(t)))}else"boolean"==typeof t?this.fdfString+=" "+(t?"true":"false"):"string"==typeof t&&(this.fdfString+="("+this._getFormattedString(t)+")");return a.list=o,a.streamReference=s,a.index=i,a},e.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},e.prototype._checkFdf=function(t){if((t.includes(this._specialCharacters)||t.includes("âãÃÃ")||t.includes("%����"))&&(this._asPerSpecification=!0),t.startsWith("%")&&"FDF-"!==t.substring(1,5))throw new Error("Invalid FDF file.")},e.prototype._stringToHexString=function(t){var e="";return null!==t&&void 0!==t&&t.length>0&&(e=P(f(t))),e},e}(Ii),ao=function(){function t(){}return t}(),oo=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)}}(),ho=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}),Object.defineProperty(t.prototype,"isExpanded",{get:function(){return this._dictionary&&this._dictionary.has("Count")?this._dictionary.get("Count")>=0:this._isExpanded},set:function(t){this._isExpanded=t,this.count>0&&this._dictionary&&this._dictionary.update("Count",t?this._bookMarkList.length:-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 _e(this._bookMarkList)&&this._bookMarkList.length>0&&t<this._bookMarkList.length&&(e=this._bookMarkList[t]),e},t.prototype.contains=function(t){return-1!==this._bookMarkList.indexOf(t)},t.prototype.add=function(t,e,i){var r,n;if(void 0!==e&&null!==e&&"number"==typeof e?n=e:e&&"object"==typeof e&&(i=e),this._dictionary){var s=new Ts(this._crossReference);s.update("Parent",this._reference);var a=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(a,s),r=new co(s,this._crossReference),r._reference=a,r.title=t,void 0===n){if(0===this.count)this._dictionary.update("First",a),this._dictionary.update("Last",a);else{o=this.at(this.count-1);this._dictionary.update("Last",a),o&&o._reference&&(s.update("Prev",o._reference),o._dictionary.update("Next",a))}this._bookMarkList.push(r)}else{if(n<0||n>this.count)throw new Error("Index out of range");if(0===this.count)this._dictionary.update("First",a),this._dictionary.update("Last",a),this._bookMarkList.push(r);else if(n===this.count){var o=this.at(this.count-1);this._dictionary.update("Last",a),o&&o._reference&&(s.update("Prev",o._reference),o._dictionary.update("Next",a)),this._bookMarkList.push(r)}else if(0===n){var h=this.at(0);this._dictionary.update("First",a),h&&h._reference&&(s.update("Next",h._reference),h._dictionary.update("Prev",a)),this._updateBookmarkList(n,r)}else{var c=this.at(n),_=this.at(n-1);_&&_._reference&&c&&c._reference&&(s.update("Prev",_._reference),_._dictionary.update("Next",a),c._dictionary.update("Prev",a),s.update("Next",c._reference)),this._updateBookmarkList(n,r)}}this._updateCount()}return i&&r&&("textStyle"in i&&_e(i.textStyle)&&(r.textStyle=i.textStyle),"color"in i&&_e(i.color)&&(r.color=i.color),"destination"in i&&_e(i.destination)&&(r.destination=i.destination),"namedDestination"in i&&_e(i.namedDestination)&&(r.namedDestination=i.namedDestination)),r},t.prototype.remove=function(t){if("string"==typeof t)for(var e=this._bookMarkList.length-1;e>=0;e--){var i=this.at(e);i.title===t?this.remove(e):i.count>0&&i.remove(t)}else if(t>=0&&t<this.count)if(1===this.count)this._removeFirst(this._dictionary),this._removeLast(this._dictionary),this._removeCount(this._dictionary),this._bookMarkList=[];else{if(0===t){n=this.at(t+1);this._dictionary&&n&&n._reference&&(this._removePrevious(n._dictionary),this._dictionary.update("First",n._reference))}else if(t===this.count-1){r=this.at(t-1);this._dictionary&&r&&r._reference&&(this._removeNext(r._dictionary),this._dictionary.update("Last",r._reference))}else{var r=this.at(t-1),n=this.at(t+1);r&&r._reference&&n&&n._reference&&(r._dictionary.update("Next",n._reference),n._dictionary.update("Prev",r._reference))}this._updateBookmarkList(t),this._dictionary&&this._updateCount()}},t.prototype.clear=function(){this._removeFirst(this._dictionary),this._removeLast(this._dictionary),this._removeCount(this._dictionary),this._bookMarkList=[]},t.prototype._removeFirst=function(t){t&&t.has("First")&&(delete t._map.First,t._updated=!0)},t.prototype._removeLast=function(t){t&&t.has("Last")&&(delete t._map.Last,t._updated=!0)},t.prototype._removeNext=function(t){t&&t.has("Next")&&(delete t._map.Next,t._updated=!0)},t.prototype._removePrevious=function(t){t&&t.has("Prev")&&(delete t._map.Prev,t._updated=!0)},t.prototype._removeCount=function(t){t&&t.has("Count")&&(delete t._map.Count,t._updated=!0)},t.prototype._updateBookmarkList=function(t,e){var i=this,r=[],n=0;void 0===e?this._bookMarkList.forEach(function(e){if(n!==t)r.push(e);else{var s=e._reference;s&&i._crossReference._cacheMap.has(s)&&(i._crossReference._cacheMap.get(s)._updated=!1)}n++}):this._bookMarkList.forEach(function(i){n===t&&r.push(e),r.push(i),n++}),this._bookMarkList=r},t.prototype._updateCount=function(){this.isExpanded||!this._dictionary.has("Count")?this._dictionary.update("Count",this._bookMarkList.length):this._dictionary.update("Count",-this._bookMarkList.length)},t.prototype._reproduceTree=function(){for(var t=this._getBookmark(this),e=!!t;e&&t._dictionary;)this._bookMarkList.push(t),e=!!(t=t._next)},t.prototype._getBookmark=function(t,e){void 0===e&&(e=!0);var i,r=t._dictionary;if(r&&r.has(e?"First":"Last")){var n=r._get(e?"First":"Last");if(_e(n)){var s=this._crossReference._fetch(n);s&&((i=new co(s,this._crossReference))._reference=n)}}return i},t}(),co=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(r._dictionary&&!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 oo(i,e),Object.defineProperty(i.prototype,"destination",{get:function(){if(!this._destination){var t=this._obtainNamedDestination(),e=new Hn(this._dictionary,"Dest");if(this._destination=e._obtainDestination(),!this._destination&&t&&t.destination)return t.destination}return this._destination},set:function(t){t&&(t._parent=this,t._isBookmark=!0,this._destination=t,this._destination._initializePrimitive())},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},set:function(t){if(this._namedDestination!==t&&this._dictionary){this._namedDestination=t;var e=new Ts(this._crossReference);e.update("D",t.title),e.update("S",vs.get("GoTo"));var i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,e),this._dictionary.update("A",i)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"title",{get:function(){return null!==this._title&&void 0!==this._title||(this._dictionary&&this._dictionary.has("Title")?this._title=this._dictionary.get("Title"):this._title=""),this._title},set:function(t){this._title=t,this._dictionary&&this._dictionary.update("Title",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return null!==this._color&&void 0!==this._color||this._dictionary&&this._dictionary.has("C")&&(this._color=q(this._dictionary.getArray("C"))),this._color?this._color:{r:0,g:0,b:0}},set:function(t){this._color=t,this._dictionary&&this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(7)),Number.parseFloat((t.g/255).toFixed(7)),Number.parseFloat((t.b/255).toFixed(7))])},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},set:function(t){this._textStyle=t,this._updateTextStyle(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_next",{get:function(){var t;if(this._dictionary&&this._dictionary.has("Next")){var e=this._dictionary._get("Next");if(_e(e)){var r=this._crossReference._fetch(e);r&&((t=new i(r,this._crossReference))._reference=e)}}return t},enumerable:!0,configurable:!0}),i.prototype._updateTextStyle=function(e){e===t.PdfTextStyle.regular?this._dictionary&&this._dictionary.has("F")&&delete this._dictionary._map.F:this._dictionary&&this._dictionary.update("F",e)},i.prototype._obtainTextStyle=function(){var e=t.PdfTextStyle.regular;if(this._dictionary&&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._obtainNamedDestination=function(){var t,e=this._crossReference._document;e&&(t=e._destinationCollection);var i,r;if(t){var n=this._dictionary;if(n)if(n.has("A")){var s=n.get("A");s&&s.has("D")&&(i=s.get("D"))}else n.has("Dest")&&(i=n.get("Dest"));if(i){var a;if(i instanceof vs?a=i.name:"string"==typeof i&&(a=i),a){var o=t._namedDestinations;if(o&&o.length>0){var h=o.find(function(t){return t._title===a});h&&(i=h,r=h)}}}}return r},i}(ho),_o=function(){function t(t,e){t instanceof Ts&&e instanceof Qa?(this._dictionary=t,this._crossReference=e):"string"==typeof t&&(this._initialize(),this.title=t,e&&e instanceof Un&&(this.destination=e))}return Object.defineProperty(t.prototype,"destination",{get:function(){return this._destination},set:function(t){t&&(t._parent=this,t._isBookmark=!1,this._destination=t,this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this._title},set:function(t){if(t!==this._title&&this._dictionary){var e=this._title;this._title=t,this._dictionary.update("Title",t),this._dictionary._updated=!0,this._updateNamedDestinationTitle(t,e)}},enumerable:!0,configurable:!0}),t.prototype._updateNamedDestinationTitle=function(t,e){var i=this._crossReference;if(i&&i._document){var r=i._document._catalog._catalogDictionary;if(r&&r.has("Names")){var n=r.get("Names");if(n&&n.has("Dests")){var s=n.get("Dests");if(s&&s.has("Names")){var a=s.get("Names"),o=a.indexOf(e);-1!==o&&(a.splice(o,1,t),delete s._map.Names,s.update("Names",a),s._updated=!0)}}}}},t.prototype._initialize=function(){this._dictionary=new Ts,this._dictionary.update("S",vs.get("GoTo"))},t}(),uo=function(){function e(t,e){var i=this;if(this._namedDestinations=[],t&&(this._dictionary=t),e&&(this._crossReference=e),t&&t.has("Dests")){var r=t.get("Dests");r&&(r.has("Names")?this._addCollection(r):r.has("Kids")&&r.getArray("Kids").forEach(function(t){i._findDestination(t)}))}}return e.prototype._findDestination=function(t){var e=this;if(t)if(t.has("Names"))this._addCollection(t);else if(t.has("Kids")){var i=t.getArray("Kids");i&&Array.isArray(i)&&i.length>0&&i.forEach(function(t){e._findDestination(t)})}},e.prototype._addCollection=function(e){var i,r=e.getRaw("Names");if(r&&r instanceof Ss&&(i=this._crossReference._fetch(r)),i&&Array.isArray(i)&&i.length>0&&(r=i),r&&Array.isArray(r)&&r.length>0)for(var n=1;n<r.length;n+=2){var s=void 0,a=r[n];if(a&&a instanceof Ss){var o=this._crossReference._fetch(a);o&&Array.isArray(o)&&o.length>0?(s=new Ts).update("D",o):s=this._crossReference._fetch(a)}else null!==s&&void 0!==s||!Array.isArray(a)||(s=new Ts).update("D",a);if(s){var h=new _o(s,this._crossReference),d=r[n-1],u=void 0,l=void 0;if(d&&(h._title=d,s.has("D"))){l=s.get("D"),u=new Un;var f=l[0];if(f&&l&&l[0]instanceof Ss){var p=this._crossReference._fetch(f),g=this._crossReference._document,y=void 0;g&&p&&void 0!==(y=_(g,p))&&null!==y&&y>=0&&(u._index=y,u.page=g.getPage(y))}}if(l[1]instanceof vs){var m=void 0,b=void 0,v=void 0,w=l[1].name,S=u.page;switch(w){case"Fit":u._destinationMode=t.PdfDestinationMode.fitToPage;break;case"XYZ":if(u._destinationMode=t.PdfDestinationMode.location,l.length>2&&(m=l[2]),l.length>3&&(b=l[3]),l.length>4&&(v=l[4]),S){var x=S.size,P=null===b||void 0===b?0:x.height-b,A=null===m||void 0===m?0:m;u._location={x:A,y:P},S.rotation!==t.PdfRotationAngle.angle0&&(P=c(S,b,m)),u._zoom=void 0!==v&&null!==v?v:0,null!==m&&null!==b&&null!==v&&void 0!==m&&void 0!==b&&void 0!==v||(u._isValid=!1)}break;case"FitH":case"FitBH":if(u._destinationMode=t.PdfDestinationMode.fitH,l.length>=3&&(b=l[2]),S){var x=S.size,P=null===b||void 0===b?0:x.height-b;u._location={x:0,y:P}}null!==b&&void 0!==b||(u._isValid=!1);break;case"FitR":u._destinationMode=t.PdfDestinationMode.fitR}}u._parent=h,u._isBookmark=!1,h._destination=u,this._namedDestinations.push(h)}}},e}(),lo=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)}}(),fo=function(t){function e(e){var i=t.call(this)||this;return null!==e&&void 0!==e&&(i._fileName=e),i}return lo(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=it(),this._save()},e.prototype._save=function(){var t=new Ti;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=v(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}(Ii),po=function(){function t(){this._incrementalUpdate=!0}return Object.defineProperty(t.prototype,"crossReferenceType",{get:function(){return this._crossReferenceType},set:function(t){this._crossReferenceType=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isIncrementalUpdate",{get:function(){return this._incrementalUpdate},set:function(t){this._incrementalUpdate=t},enumerable:!0,configurable:!0}),t}(),go=function(){function t(t){this._optimizeResources=!0,this._groupFormFields=!1,t&&"targetIndex"in t&&null!==t.targetIndex&&void 0!==t.targetIndex&&(this._targetIndex=t.targetIndex),t&&"rotation"in t&&null!==t.rotation&&void 0!==t.rotation&&(this._rotation=t.rotation),t&&"optimizeResources"in t&&null!==t.optimizeResources&&void 0!==t.optimizeResources&&(this._optimizeResources=t.optimizeResources),t&&"groupFormFields"in t&&null!==t.groupFormFields&&void 0!==t.groupFormFields&&(this._groupFormFields=t.groupFormFields)}return Object.defineProperty(t.prototype,"targetIndex",{get:function(){return this._targetIndex},set:function(t){this._targetIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"optimizeResources",{get:function(){return this._optimizeResources},set:function(t){this._optimizeResources=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"groupFormFields",{get:function(){return this._groupFormFields},set:function(t){this._groupFormFields=t},enumerable:!0,configurable:!0}),t}(),yo=function(){function e(t,e,i,r,n){this._namedDestinations=[],this._bookmarks=[],this._fields=[],this._pageReference=new Map,this._bookmarksPageLinkReference=new Map,this._destination=[],this._newList=new Map,this._annotationLayer=new Map,this._isLayersPresent=!1,this._fieldNames=[],this._options=new go,this._kidsReference=[],this._formFieldsCollection=new Map,this._formFields=[],this._isDuplicatePage=!1,this._fieldCount=0,this._crossReference=t,this._destinationDocument=e,this._sourceDocument=i,this._pageReference=r,void 0!==n&&(this._options=n),this._copier=new mo(this._crossReference,this._sourceDocument._crossReference)}return e.prototype._importPages=function(t,e,i,r,n,s){var a,o,h,c=this,_=t._pageDictionary;if(this._isDuplicatePage=r,this._options.rotation=n?n.rotation:t.rotation,h="number"==typeof e?this._insertNewPage(t,e):this._isDuplicatePage?this._insertNewPage(t,t._pageIndex+1):this._insertNewPage(t),(r||s)&&this._options.optimizeResources){var d=[];_.forEach(function(t,e){if("Contents"===t&&0===d.length){var i=e;if(i instanceof Ss){var r=s?c._copier._copy(i):i;h._pageDictionary.update(t,r)}else i instanceof Array&&(i.forEach(function(t){var e=s?c._copier._copy(t):t;d.push(e)}),h._pageDictionary.update(t,d))}else if("Resources"===t&&e){var n=s?c._copier._copy(e):e;n&&h._pageDictionary.update(t,n)}else"Resources"!==t&&"MediaBox"!==t&&"CropBox"!==t&&"Parent"!==t&&"Annots"!==t&&"Contents"!==t&&"Rotate"!==t&&h._pageDictionary.update(t,e)})}else o=t._contentTemplate,h.graphics.drawTemplate(o,{x:0,y:0,width:o._size.width,height:o._size.height}),o._content.dictionary.update("Resources",this._copier._copy(_.getRaw("Resources"))),this._pageReference.set(_,h),r||this._bookmarksPageLinkReference.set(t._ref,h._pageIndex);if(_.has("Annots")&&(this._importAnnotation(t,h),void 0!==this._options&&this._options.groupFormFields&&this._sourceDocument._catalog._catalogDictionary.has("AcroForm")&&this._destinationDocument.form.count>0?this._formFieldsGroupingSupport(this._sourceDocument.form,t,h):this._sourceDocument._catalog._catalogDictionary.has("AcroForm")&&this._importFormField(t,this._sourceDocument.form,h)),!r){var u=this._sourceDocument._parseBookmarkDestination();if(u&&u.has(t)){var l=u.get(t);(a=this._bookmarks).push.apply(a,l)}}(!r&&i||!this._options.optimizeResources)&&this._mergeLayer(h._pageDictionary,_,this._sourceDocument._crossReference),h._pageDictionary._updated=!0},e.prototype._importAnnotation=function(t,e){var i=t.annotations._annotations;if(i&&0!==i.length){for(var r=this._crossReference,n=this._sourceDocument._crossReference,s=[],a=i.length,o=0;o<a;o++){var h=i[o];if(h){var c=n._fetch(h);if(c){var _=void 0;if(c.has("Dest")){var d=c.get("Dest"),u=c._get("Dest");Array.isArray(d)?_=d.slice():u instanceof Ss&&(_=[u])}if(_&&_.length>0&&this._destination.push(_),c.has("OC")){var l=c.getRaw("OC");l instanceof Ss&&this._annotationLayer.set(o,l)}var f=this._copier._copy(h),p=r._fetch(f);_&&_.length>0&&p.update("Dest",_),p.update("P",e._ref),s.push(f)}}}s.length>0&&e._pageDictionary.update("Annots",s)}},e.prototype._formFieldsGroupingSupport=function(t,e,i){var r,n=[],s=[],a=[],o=t._dictionary.get("DR");if(t._dictionary.has("DR")&&(o=t._dictionary.get("DR")),i._pageDictionary.has("Annots")&&(n=i._pageDictionary.get("Annots")),e._pageDictionary.has("Annots")&&(a=e._pageDictionary.get("Annots")),!this._isDuplicatePage){r=this._destinationDocument.form,this._fieldCount=r.count;for(var h=0;h<this._fieldCount;h++)s.push(r.fieldAt(h).name)}for(var c=0;c<t.count;c++){var _=t.fieldAt(c),d=void 0,u=[],l=_._dictionary.get("Kids");if(-1!==s.indexOf(_.name)||this._isDuplicatePage){if(this._isDuplicatePage?(d=_,u=l):(d=r.fieldAt(s.indexOf(_.name)))._dictionary.get("Kids")&&(u=d._dictionary.get("Kids")),_._isDuplicatePage=!0,_ instanceof Gr&&d instanceof Gr||!(_ instanceof Gr))if(void 0!==l&&l.length>0)for(var f=0;f<l.length;f++){var p=_.itemAt(f);p.page===e&&(d._page=i,n=this._groupFormFieldsKids(d,_,a,u,l,i._ref,n,f,c,o,p))}else n=this._groupFormFieldsKids(d,_,a,u,l,i._ref,n,0,c,o)}else n=this._insertFormFields(c,_,t,i._ref,n,a)}n.length>0&&i._pageDictionary.update("Annots",n)},e.prototype._groupFormFieldsKids=function(t,e,i,r,n,s,a,o,h,c,_){if(e._dictionary.has("Kids")&&t._dictionary.has("Kids")){if(null!==o&&void 0!==o&&o>=0&&n.length>o){var d=n[o];if(d&&-1!==i.indexOf(d)){var u=e._crossReference._fetch(d),l=this._copier._copyDictionary(u,!this._isDuplicatePage);l.update("P",s);p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,l),a.push(p),l.update("Parent",t._ref),r.push(p),l._updated=!0,t._dictionary._updated=!0,this._isDuplicatePage||((t instanceof jr||t instanceof Vr||t instanceof Wr)&&l.has("AS")&&delete l._map.AS,this._createAppearance(t,e,u,l,c,_))}}}else if(e._dictionary.has("Kids")&&!t._dictionary.has("Kids")||this._isDuplicatePage){g=this._copier._copyDictionary(t._dictionary,!this._isDuplicatePage);this._updateFieldsWithKids(t,e,g,o,h,s,n,a,c,t._dictionary)}else if(!e._dictionary.has("Kids")&&t._dictionary.has("Kids")){var f=this._copier._copyDictionary(e._dictionary);this._updateFieldDictionary(f,s,t._ref);var p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,f),r.push(p),a.push(p),t._dictionary._updated=!0,this._createAppearance(t,e,e._dictionary,f,c,_)}else if(!e._dictionary.has("Kids")&&!t._dictionary.has("Kids")){var g=this._copier._copyDictionary(t._dictionary),y=this._copier._copyDictionary(e._dictionary,!this._isDuplicatePage);this._removeFieldDictionary(y,["Parent","FT","T","Ff"]),y.update("P",s),this._updateFieldsWithKids(t,e,g,o,h,s,n,a,c,y)}return a},e.prototype._updateFieldsWithKids=function(t,e,i,r,n,s,a,o,h,c){var _=this._crossReference._getNextReference(),d=this._createNewFieldDictionary(i,t._dictionary);d.objId=_.toString(),this._crossReference._cacheMap.set(_,d);var u=this._destinationDocument.form._parseFields(d,_);t._dictionary.update("Parent",_),u._dictionary._updated=!0,this._updateFieldDictionary(i,s,_),this._destinationDocument.form._dictionary._updated=!0;var l;l=void 0!==a&&a.length>0&&void 0!==r&&null!==r&&a.length>r&&r>=0?e._crossReference._fetch(a[r]):c;var f=this._copier._copyDictionary(l,!this._isDuplicatePage);(t instanceof jr||t instanceof Vr||t instanceof Wr)&&f.has("AS")&&delete f._map.AS;var p=this._crossReference._getNextReference();this._crossReference._cacheMap.set(p,f),f.update("P",s),o.push(p),f.update("Parent",u._ref);var g=[];g.push(t._ref),g.push(p),f._updated=!0,t._dictionary._updated=!0,d.update("Kids",g),u._kids=g,this._formFieldsCollection.set(n,_),this._destinationDocument.form._parsedFields.set(n,u),this._isDuplicatePage||this._createAppearance(u,e,l,f,h),d._updated=!0},e.prototype._removeFieldDictionary=function(t,e){return e.forEach(function(e){t.has(e)&&delete t._map[e]}),t},e.prototype._updateFieldDictionary=function(t,e,i){(t=this._removeFieldDictionary(t,["Parent","FT","T","Ff"])).update("P",e),t.update("Parent",i),t._updated=!0},e.prototype._createNewFieldDictionary=function(t,e){var i=new Ts(this._crossReference);return["Parent","FT","T","V","Ff","TU","Opt","I"].forEach(function(r){t.has(r)&&(i.update(r,t.get(r)),delete t._map[r],delete e._map[r])}),i},e.prototype._getItemStyle=function(t,e){var i=t._dictionary.get("MK");i&&i.has("CA")?t._styleText=i.get("CA").charAt(0):t._styleText=e instanceof Ur?"l":"4"},e.prototype._createAppearance=function(t,e,i,r,n,s){var a,o=t._kidsCount-1;if(t instanceof zr)(h=t.itemAt(o))._enableGrouping=!0,this._getItemStyle(h,t),e instanceof Ur?(h._dictionary.update("AS",vs.get("Off")),a=_t(i)):h._postProcess(t.checked?"Yes":"Off"),t._drawAppearance(h,a);else if(t instanceof Ur){h=t.itemAt(o);this._getItemStyle(h,t),h._dictionary.has("AS")?h._postProcess(h._dictionary.get("AS").name):h._postProcess("Off"),h._enableGrouping=!0,t._enableGrouping=!0,t._drawAppearance(h)}else if(t instanceof Hr){var h=t.itemAt(o);if(void 0!==s&&(h.rotationAngle=s.rotationAngle),h&&!t._checkFieldFlag(h._dictionary)){h._enableGrouping=!0;var c=t._createAppearance(h);t._addAppearance(h._dictionary,c,"N"),h._dictionary._updated=!0}}else if(t instanceof jr||t instanceof Vr||t instanceof Gr){var _=Pn._load(r,this._crossReference);if(void 0!==s&&null!==s&&t instanceof Gr)t._createAppearance(s,!1);else{_.setAppearance(!0),_._enableGrouping=!0;var d=void 0;d=void 0!==s&&null!==s?this._obtainFont(s._dictionary,n):this._obtainFont(r,n),_._pdfFont=d,t instanceof Gr?t._createAppearance(_,!1):t._postProcess(!1,_)}}},e.prototype._obtainFont=function(e,i){var r,n="",s=8;if(e&&(e.has("DS")||e.has("DA")))if(e.has("DS"))e.get("DS").split(";").forEach(function(t){var e=t.split(":");if(-1!==t.indexOf("font-family"))n=e[1];else if(-1===t.indexOf("font-style")&&-1!==t.indexOf("font")){for(e[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(n+=t+" ")});" "!==n&&n.endsWith(" ");)n=n.substring(0,n.length-2);-1!==n.indexOf(",")&&(n=n.split(",")[0])}});else{var a=e.get("DA");if(a&&""!==a&&-1!==a.indexOf("Tf")){var o=a.split(" ");o.forEach(function(t,e){if(-1!==t.indexOf("Tf")){for(n=o[e-2];""!==n&&n.length>1&&"/"===n[0];)n=n.substring(1);s=Number.parseFloat(o[e-1])}}),0===s&&(s=8)}}n=n.trim();var h,c=t.PdfFontStyle.regular;if(void 0!==i&&i.has("Font")){var _=i.get("Font").get(n);void 0!==_&&(h=_.get("BaseFont").name,c=this._getFontStyle(h))}switch(n){case"Helv":r=new xr(t.PdfFontFamily.helvetica,s,c);break;case"Courier":case"Cour":r=new xr(t.PdfFontFamily.courier,s,c);break;case"Symb":r=new xr(t.PdfFontFamily.symbol,s,c);break;case"TiRo":case"TiIt":r=new xr(t.PdfFontFamily.timesRoman,s,c);break;case"ZaDb":r=new xr(t.PdfFontFamily.zapfDingbats,s,c);break;default:r=new xr(t.PdfFontFamily.helvetica,s,c)}return r},e.prototype._getFontStyle=function(e){var i=t.PdfFontStyle.regular;return e.includes("Bold")?i=t.PdfFontStyle.bold:e.includes("Italic")&&(i=t.PdfFontStyle.italic),i},e.prototype._importFormField=function(t,e,i){var r=this._destinationDocument.form,n=[];i&&i._pageDictionary&&i._pageDictionary.has("Annots")&&(n=i._pageDictionary.get("Annots"));var s=[],a=[];if(this._destinationDocument.form._dictionary.has("Fields")){var o=this._destinationDocument.form;this._fieldCount=o.count;for(var h=0;h<this._fieldCount;h++){var c=o.fieldAt(h).name;this._fieldNames.push(c)}}t._pageDictionary.has("Annots")&&(a=t._pageDictionary.get("Annots"));for(var _=e.count,d=0;d<_;++d){var u=e.fieldAt(d);if(u._dictionary.has("Kids"))if((s=u._dictionary.get("Kids")).length>1){for(var l=0;l<s.length;l++)if(u.itemAt(l).page===t){n=this._insertFormFields(d,u,r,i._ref,n,a);break}}else 1===s.length&&u.page===t&&(n=this._insertFormFields(d,u,r,i._ref,n,a));else u.page===t&&(n=this._insertFormFields(d,u,r,i._ref,n,a))}if(e._dictionary.has("DR")){var f=e._dictionary.get("DR"),p=this._copier._copyDictionary(f),g=void 0;if(p.has("Font")&&(g=p.get("Font")),this._destinationDocument.form._dictionary.has("DR")){var y=this._destinationDocument.form._dictionary.get("DR");if(y.has("Font")){var m=y.get("Font");g&&g.forEach(function(t,e){m.set(t,e)}),m._updated=!0}}else this._destinationDocument.form._dictionary.update("DR",p)}n.length>0&&i._pageDictionary.update("Annots",n)},e.prototype._insertFormFields=function(t,e,i,r,n,s){var a=this,o=new Ts;e._dictionary.has("Kids")?e._dictionary.forEach(function(t,e){"Kids"!==t&&o.update(t,e)}):o=this._copier._copyDictionary(e._dictionary);var h=this._crossReference._getNextReference();o.objId=h.toString();var c=i._parseFields(o,r);if(c._ref=h,this._crossReference._cacheMap.set(h,c._dictionary),e._dictionary.has("Kids")){var _=[];e._dictionary.get("Kids").forEach(function(t){if(-1!==s.indexOf(t)){var i=e._crossReference._fetch(t),o=a._copier._copyDictionary(i);o.update("P",r),o.update("Parent",h),o._updated=!0;var c=a._crossReference._getNextReference();a._crossReference._cacheMap.set(c,o),n.push(c),_.push(c)}}),o.update("Kids",_),c._kids=_}else c._dictionary.update("P",r),n.push(h);c._dictionary._updated=!0;for(var d=0,u=c.name,l=!1;-1!==this._fieldNames.indexOf(u);)u=c.name+d,l=!0,++d;return l&&(c._dictionary.update("T",u),c._name=u),c._dictionary._updated=!0,this._fieldCount>0?(this._destinationDocument.form._parsedFields.set(this._fieldCount,c),c._annotationIndex=this._fieldCount,this._fieldCount++):(this._destinationDocument.form._parsedFields.set(t,c),c._annotationIndex=t),this._destinationDocument.form._fields.push(h),n},e.prototype._mergeFormFieldsWithDocument=function(){var t=[];if(this._formFieldsCollection.size>0){var e=this._destinationDocument.form._dictionary;e&&e.has("Fields")&&(t=e.get("Fields")),this._formFieldsCollection.forEach(function(e,i){t[i]=e})}else t=this._destinationDocument.form._fields;this._destinationDocument.form._dictionary.get("NeedAppearances")&&this._destinationDocument.form._dictionary.set("NeedAppearances",!1),this._destinationDocument.form._dictionary.set("Fields",t),this._destinationDocument.form._fields=t,this._destinationDocument.form._dictionary._updated=!0},e.prototype._importLayers=function(t,e){if(this._isLayersPresent=e,this._isLayersPresent&&this._destinationDocument._catalog._catalogDictionary.has("OCProperties")){var i=this._destinationDocument._catalog._catalogDictionary.get("OCProperties"),r=t.get("OCProperties");if(i.has("OCGs")){var n=i.get("OCGs"),s=r.get("OCGs");n.length>0&&n.push.apply(n,s)}if(i._updated=!0,i.has("D")&&r.has("D")){var a=i.get("D"),o=r.get("D");if(a&&o){if(a.has("Order")&&o.has("Order")){var h=a.get("Order"),c=o.get("Order");h.length>0&&c.length>0&&h.push.apply(h,c)}else o.has("Order")&&a.set("Order",o.get("Order"));if(a.has("RBGroups")&&o.has("RBGroups")){var _=a.get("RBGroups"),d=o.get("RBGroups");_.length>0&&d.length>0&&_.push.apply(_,d)}else o.has("RBGroups")&&(a.set("RBGroups",o.get("RBGroups")),a._updated=!0);if(a.has("ON")&&o.has("ON")){var u=a.get("ON"),l=o.get("ON");u.length>0&&l.length>0&&u.push.apply(u,l)}else o.has("ON")&&a.set("ON",o.get("ON"));if(a.has("AS")&&o.has("AS")){var f=a.get("AS"),p=o.get("AS");if(f.length>0&&p.length>0){var g=p[0],y=f[0];if(g instanceof Ss&&y instanceof Ss&&(g=this._crossReference._fetch(g),y=this._crossReference._fetch(y)),g.has("OCGs")&&y.has("OCGs")){var m=g.get("OCGs"),b=y.get("OCGs");m.length>0&&b.length>0&&b.push.apply(b,m)}f.push.apply(f,p)}}else o.has("AS")&&a.set("AS",o.get("AS"));if(a.has("OFF")&&o.has("OFF")){var v=a.get("OFF"),w=o.get("OFF");v.length>0&&w.length>0&&v.push.apply(v,w)}else o.has("OFF")&&a.set("OFF",o.get("OFF"))}if(a.has("Locked")&&o.has("Locked")){var S=a.get("Locked"),x=o.get("Locked");S.length>0&&x.length>0&&S.push.apply(S,x)}else o.has("Locked")&&a.set("Locked",o.get("Locked"))}else r.has("D")&&i.set("D",r.get("D"));i._updated=!0,this._destinationDocument._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0}else this._isLayersPresent&&(this._destinationDocument._catalog._catalogDictionary.update("OCProperties",t.get("OCProperties")),this._destinationDocument._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0)},e.prototype._mergeLayer=function(t,e,i){var r,n=this,s=t.get("Resources").get("XObject");s&&s.forEach(function(t,e){r=n._crossReference._fetch(e)});var a;r&&(a=r.dictionary.get("Resources"));var o,h,c=new Map,_=e.get("Resources");if(_.has("Properties")){_.get("Properties").forEach(function(t,e){c.set(t,e)});var d=new Ts(this._crossReference);c.forEach(function(t,e){n._newList.forEach(function(i,r){t===r&&d.set(e,i)})}),a.set("Properties",d),a._updated=!0,d._updated=!0}else _.has("XObject")&&(o=a.get("XObject"),_.get("XObject").forEach(function(t,e){e instanceof Ss&&(h=i._fetch(e)).dictionary.forEach(function(e,i){"OC"===e&&n._newList.forEach(function(r,n){if(n===i&&o.has(t)){var s=o.get(t);s.dictionary.set(e,r),s._updated=!0}})})}));if(this._annotationLayer.size>0){var u=t._get("Annots");this._annotationLayer.forEach(function(t,e){var i=u[e],r=n._crossReference._fetch(i);n._newList.forEach(function(e,i){t===i&&r.set("OC",e)})})}},e.prototype._exportBookmarks=function(t,e){var i=this;if(this._bookmarks.length>0){var r=this._bookmarks,n=this._destinationDocument.bookmarks,s=t.bookmarks,a=void 0;if(s){var o=[],h={index:0,base:n,kids:s._bookMarkList};t.pageCount!==e&&(h={index:0,base:n,kids:r},a=[]);do{for(var c=this;h.index<h.kids.length;)!function(){if(s=h.kids[h.index],-1!==r.indexOf(s)&&void 0!==a&&-1===a.indexOf(s.title)){var _=s,d=n.add(_.title),u=_.destination;d.color=_.color,d.textStyle=_.textStyle;var l=null,f=null,p=null;if(b=_.namedDestination){if(b.destination&&(p=b.destination.page,c._bookmarksPageLinkReference.forEach(function(t,e){p._ref===e&&(f=i._destinationDocument.getPage(t))}),f)){v=c._getNamedDestination(b,f);d.namedDestination=v,delete d._dictionary._map.C,c._namedDestinations.push(v._title);var g=c._crossReference._getNextReference();c._crossReference._cacheMap.set(g,v._dictionary),c._namedDestinations.push(g)}}else u&&(p=u.page,c._bookmarksPageLinkReference.forEach(function(t,e){p._ref===e&&(f=i._destinationDocument.getPage(t))}),f&&((l=new Un(f,u.location)).mode=u.mode,l.zoom=u.zoom,l.location=u.location,d.destination=l));n=d,a.push(d.title)}else if(void 0===a||void 0!==a&&-1===a.indexOf(s.title)){var u=(_=s).destination,l=null,y=null,m=null,b=_.namedDestination;if(t.pageCount===e){d=n.add(_.title);if(_._dictionary.has("A")&&d._dictionary.update("A",_._dictionary.get("A")),d.textStyle=_.textStyle,d.color=_.color,b){if(b._destination&&(m=b.destination.page,c._bookmarksPageLinkReference.forEach(function(t,e){m._ref===e&&(y=i._destinationDocument.getPage(t))}),y)){var v=c._getNamedDestination(b,y);d.namedDestination=v,delete d._dictionary._map.C,c._namedDestinations.push(v._title);var w=c._crossReference._getNextReference();c._crossReference._cacheMap.set(w,v._dictionary),c._namedDestinations.push(w)}}else u&&(m=u.page,c._bookmarksPageLinkReference.forEach(function(t,e){m._ref===e&&(y=i._destinationDocument.getPage(t))}),y&&((l=new Un(y,u.location)).mode=u.mode,l.zoom=u.zoom,l.location=u.location,d.destination=l));n=d}}h.index+=1,s.count>0?(o.push(h),h={index:0,base:n,kids:s._bookMarkList}):n=h.base}();if(o.length>0){for(h=o.pop();h.index===h.kids.length&&o.length>0;)h=o.pop();n=h.base}}while(h.index<h.kids.length)}var _=void 0;if(this._namedDestinations.length>0){var d=new Ts(this._crossReference);d.update("Names",this._namedDestinations),_=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(_,d),(d=new Ts(this._crossReference)).update("Dests",_),_=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(_,d),this._destinationDocument._catalog._catalogDictionary.set("Names",_)}this._destinationDocument._catalog._catalogDictionary._updated=!0,this._destinationDocument._catalog._catalogDictionary.isCatalog=!0,this._crossReference._allowCatalog=!0}},e.prototype._getNamedDestination=function(t,e){var i=new _o(t.title);return i.destination=this._getDestination(e,t.destination),i},e.prototype._getDestination=function(t,e){var i=new Un(t,e.location);return i._location=e._location,i.mode=e.mode,i.zoom=e.zoom,i.location=e.location,i},e.prototype._writeObject=function(t,e,i,r,n,s,a){if(i instanceof vs||"string"==typeof i||"number"==typeof i||"boolean"==typeof i)this._writeDictionary(i,e,n,s,a,null);else if(Array.isArray(i)){var o=[];this._writeArray(t,o,i,r),this._writeDictionary(null,e,n,s,a,o)}else if(i instanceof Ts){var h=new Ts(this._crossReference);this._writePropertiesDictionary(t,h,i),this._writeDictionary(null,e,n,s,a,h)}else i instanceof Ss&&this._crossReference?this._writeObject(t,e,t._crossReference._fetch(i),r,n,s,i):null!==i&&void 0!==i||this._writeDictionary("null",e,n,s,a,null)},e.prototype._writeDictionary=function(t,e,i,r,n,s){if(i&&t)e.set(i,t);else if(i&&s)e.set(i,s);else if(s&&!n)r.push(s);else if(t)r.push(t);else if(n){var a;if(this._newList&&this._newList.size>0&&this._newList.forEach(function(t,e){e===n&&(a=t)}),a)r.push(a);else{var o=s;a=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(a,o),o._updated=!0,r.push(a),this._newList.set(n,a)}}},e.prototype._writeArray=function(t,e,i,r){for(var n=0,s=i.length;n<s;n++)this._writeObject(t,null,i[n],r,null,e)},e.prototype._writePropertiesDictionary=function(t,e,i){var r=this;i&&i.size>0&&i.forEach(function(n,s){r._writeObject(t,e,s instanceof Ss?i.get(n):s,i,n)})},e.prototype._fixDestinations=function(t){var e=this._pageReference;this._destination.length>0&&this._destination.forEach(function(i){if(i instanceof Array){var r=i;if(r.length>0&&r[0]&&r[0]instanceof Ss){var n=t._crossReference._fetch(r[0]),s=e.get(n);n&&e.has(n)&&null!==s&&(r[0]=s._ref),n&&e.has(n)&&null===s&&(r[0]=null)}}})},e.prototype._insertNewPage=function(e,i){var r,n=new Uh;n.size=e.size,n.margins.left=0,n.margins.top=0,n.margins.right=0,n.margins.bottom=0,void 0!==this._options&&void 0!==this._options.rotation?n.rotation=this._options.rotation:n.rotation=e.rotation,n.orientation=e.size.width>e.size.height?t.PdfPageOrientation.landscape:t.PdfPageOrientation.portrait,r=void 0!==i?this._destinationDocument.addPage(i,n):this._destinationDocument.addPage(n);var s=e._pageDictionary;if(s._get("MediaBox")){var a=s._get("MediaBox");r._pageDictionary.update("MediaBox",a)}if(s._get("CropBox")){var o=s._get("CropBox");r._pageDictionary.update("CropBox",o)}if(void 0!==this._options.rotation||e._pageDictionary.has("Rotate")){var h=void 0;h=(h=void 0!==this._options.rotation?90*Math.floor(this._options.rotation):90*Math.floor(e.rotation))>=360?h%360:h,r._pageDictionary.update("Rotate",h)}return r},e.prototype._objectDispose=function(){this._bookmarkHashTable=new Map,this._namedDestinations=[],this._bookmarks=[],this._pageReference=new Map,this._bookmarksPageLinkReference.clear(),this._destination=[],this._newList=new Map,this._annotationLayer=new Map,this._fieldNames=[],this._destinationDocument&&this._destinationDocument._form&&this._destinationDocument._form._widgetReferences&&(this._destinationDocument._form._widgetReferences=[])},e}(),mo=function(){function t(t,e){this._traversedObjects=new Map,this._isGroupingSupport=!1,this._targetCrossReference=t,this._sourceCrossReference=e}return t.prototype._copy=function(t){var e;return t instanceof Ts?e=this._copyDictionary(t):Array.isArray(t)?e=this._copyArray(t):t instanceof Rs?e=this._copyStream(t):t instanceof Ss?e=this._copyReference(t):(t instanceof vs||"number"==typeof t||"string"==typeof t||"boolean"==typeof t)&&(e=t),e},t.prototype._copyDictionary=function(t,e){var i=this,r=new Ts(this._targetCrossReference);return t&&t.size>0&&t.forEach(function(t,n){if("OC"===t&&n instanceof Array||"P"!==t&&"Parent"!==t&&"Dest"!==t&&"OC"!==t&&("AP"!==t||!e)){var s=i._copy(n);null!==s&&void 0!==s&&r.update(t,s)}}),r._updated=!0,r},t.prototype._copyArray=function(t){for(var e=[],i=0,r=t.length;i<r;i++)e.push(this._copy(t[i]));return e},t.prototype._copyStream=function(t){var e,i=!1,r=t;if(t.dictionary.has("Subtype")&&"Image"===t.dictionary.get("Subtype").name)if(i=!0,t instanceof Fs)e=t.getByteRange(t.offset,t.end);else if(t&&r.stream&&r.stream instanceof Fs)if("boolean"==typeof r._initialized&&r._cipher){s=r.stream.end-r.stream.start;r.getBytes(s),e=r.buffer.subarray(0,r.bufferLength)}else e=(a=r.stream).getByteRange(a.start,a.end);else if(r.stream&&r.stream.stream){var n=r.stream;if(n.stream instanceof Fs&&"boolean"==typeof n._initialized&&n._cipher){var s=n.stream.end-n.stream.start;n.getBytes(s),e=n.buffer.subarray(0,n.bufferLength)}else if(n.stream&&n.stream instanceof Fs){var a=n.stream;e=a.getByteRange(a.start,a.end)}else e=[]}else(!(e=t.getBytes())||0===e.length)&&t instanceof Is&&(e=t._bytes);else(!(e=t.getBytes())||0===e.length)&&t instanceof Is&&(e=t._bytes);var o=new Is(e instanceof Array?e:Array.from(e));return o._isImage=i,o.dictionary=this._copyDictionary(t.dictionary),o.dictionary._updated=!0,o},t.prototype._copyReference=function(t){if(this._traversedObjects.has(t))return this._traversedObjects.get(t);this._traversedObjects.set(t,null);var e=this._sourceCrossReference._fetch(t),i=this._copy(e);if(i instanceof Ts||i instanceof Rs){var r=this._addToDestination(i);return this._traversedObjects.set(t,r),r}return this._traversedObjects.set(t,i),i},t.prototype._addToDestination=function(t){var e=this._targetCrossReference._getNextReference();return this._targetCrossReference._cacheMap.set(e,t),t.objId=e.objectNumber+" "+e.generationNumber,e},t}(),bo=function(){function e(){this._visible=!0,this._printState=t.PdfPrintState.printWhenVisible,this._isEndState=!1,this._dictionary=new Ts,this._pages=[],this._subLayer=[],this._locked=!1,this._parentLayer=[],this._child=[],this._graphicsCollection=new Map,this._pageGraphics=new Map,this._pageParsed=!1,this._xObject=[],this._content=new Is([])}return Object.defineProperty(e.prototype,"_layerPage",{get:function(){return this._pageParsed||this._parseLayerPage(),this._page},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_layerId",{get:function(){return this._pageParsed||this._parseLayerPage(),this._id},set:function(t){this._id=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name||""},set:function(t){this._name=t,this._dictionary&&this._name&&""!==this.name&&this._dictionary.update("Name",this._name)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){if(this._dictionary){var t=this._dictionary.get("Visible");"boolean"==typeof t&&(this._visible=t)}return this._visible},set:function(t){this._visible=t,this._dictionary&&this._dictionary.update("Visible",t),this._setVisibility(t),this._document._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locked",{get:function(){return this._locked},set:function(t){this._locked=t,"boolean"==typeof t&&this._setLock(t),this._document._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"printState",{get:function(){return this._printState},set:function(e){this._printState=e,this._printOption?this.printState===t.PdfPrintState.alwaysPrint?this._printOption.update("PrintState",new vs("ON")):this.printState===t.PdfPrintState.neverPrint&&this._printOption.update("PrintState",new vs("OFF")):this._setPrintState()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"layers",{get:function(){return this._layers||(this._layers=new vo(this._document,this._layer),this._layers._subLayer=!0),this._layers},enumerable:!0,configurable:!0}),e.prototype.createGraphics=function(t){return this._graphics&&!this._needInitializeGraphics||(this._page=t,this._crossReference=t._crossReference,this._parseGraphics()),this._graphics},e.prototype._parseGraphics=function(){this._loadContents();var t=new Is([32,113,32,10]),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._page._contents.splice(0,0,e);var i=new Is([32,81,32,10]),r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),this._page._contents.push(r);var n=new Is([]),s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),this._page._contents.push(s),this._page._pageDictionary.set("Contents",this._page._contents),this._page._pageDictionary._updated=!0,this._initializeGraphics(n),this._initializeProperties()},e.prototype._initializeProperties=function(){var t=this._graphics._resourceObject;if(t&&t.has("Properties"))if(i=t.get("Properties"))i.update(this._id,this._referenceHolder);else{var e=new Ts;e.update(this._id,this._referenceHolder),t.update("Properties",e)}else{var i=new Ts;i.update(this._id,this._referenceHolder),t.update("Properties",i)}},e.prototype._loadContents=function(){var t,e=this._page._pageDictionary.getRaw("Contents");e&&e&&e instanceof Ss&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof Rs?this._page._contents=[t]:e&&Array.isArray(e)?this._page._contents=e:this._page._contents=[]},e.prototype._initializeGraphics=function(e){var i=!1,r=0,n=0,s=0,a=0,o=this._page.size,h=this._page.mediaBox;h&&h.length>=4&&(r=h[0],n=h[1],s=h[2],a=h[3]);var c;if(this._page._pageDictionary.has("CropBox"))if((c=this._page.cropBox)&&c.length>=4){var _=c[0],d=c[1],u=c[2],l=c[3];(_<0||d<0||u<0||l<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(o.height))&&Math.floor(Math.abs(_))===Math.floor(Math.abs(o.width))?this._graphics=new Gn({width:Math.max(_,u),height:Math.max(d,l)},e,this._crossReference,this._page):(this._graphics=new Gn(o,e,this._crossReference,this._page),this._graphics._cropBox=c)}else this._graphics=new Gn(o,e,this._crossReference,this._page);else if((r<0||n<0||s<0||a<0)&&Math.floor(Math.abs(n))===Math.floor(Math.abs(o.height))&&Math.floor(Math.abs(s))===Math.floor(Math.abs(o.width))){var f=Math.max(r,s),p=Math.max(n,a);(f<=0||p<=0)&&(i=!0,r<0&&(r=-r),n<0&&(n=-n),s<0&&(s=-s),a<0&&(a=-a),f=Math.max(r,s),p=Math.max(n,a)),this._graphics=new Gn({width:f,height:p},e,this._crossReference,this._page)}else this._graphics=new Gn(o,e,this._crossReference,this._page);this._page._pageDictionary.has("MediaBox")&&(this._graphics._mediaBoxUpperRightBound=i?-n:a),this._graphicsState=this._graphics.save();var g=this._page._origin;if(g[0]>=0&&g[1]>=0||Math.sign(g[0])!==Math.sign(g[1])?this._graphics._initializeCoordinates():this._graphics._initializeCoordinates(this._page),!this._page._isNew){var y=this._page.rotation;if(!Number.isNaN(y)&&(y!==t.PdfRotationAngle.angle0||this._page._pageDictionary.has("Rotate"))){var m=void 0;m=this._page._pageDictionary.has("Rotate")?this._page._pageDictionary.get("Rotate"):90*y;var b=this._graphics._clipBounds;90===m?(this._graphics.translateTransform({x:0,y:o.height}),this._graphics.rotateTransform(-90),this._graphics._clipBounds=[b[0],b[1],o.width,o.height]):180===m?(this._graphics.translateTransform({x:o.width,y:o.height}),this._graphics.rotateTransform(-180)):270===m&&(this._graphics.translateTransform({x:o.width,y:0}),this._graphics.rotateTransform(-270),this._graphics._clipBounds=[b[0],b[1],o.height,o.width])}}if(this._page._isNew&&this._page._pageSettings){var v=this._page._getActualBounds(this._page._pageSettings);this._graphics._clipTranslateMargins(v)}this._needInitializeGraphics=!1,this._graphicsCollection.has(this._graphics)||this._graphicsCollection.set(this._graphics,this._graphics),this._pageGraphics.has(this._page)||this._pageGraphics.set(this._page,this._graphics),-1===this._pages.indexOf(this._page)&&this._pages.push(this._page),this._graphics._layer=this},e.prototype._beginLayer=function(t){var e=this;if(this._graphicsCollection&&(this._graphicsCollection.has(t)?this._graphics=this._graphicsCollection.get(t):this._graphics=t),this._graphics&&this._name&&""!==this._name){this._graphics._isEmptyLayer=!0,0!==this._parentLayer.length&&this._parentLayer.forEach(function(t){t._id&&""!==t._layerId&&e._graphics._sw._write("/OC /"+t._id+" BDC")});var i="/OC /"+this._id+" BDC";this.name&&""!==this.name?(this._graphics._sw._write(i),this._isEndState=!0):this._content.write(i)}},e.prototype._setVisibility=function(t){var e,i=this._document._catalog._catalogDictionary;if(i.has("OCProperties")&&((e=i.get("OCProperties"))||(e=new Ts(this._crossReference))),e){var r=void 0,n=void 0,s=e.get("D");if(s||(s=new Ts(this._crossReference)),s){if(s.has("ON")&&((n=s.get("ON"))||(n=[])),s.has("OFF")&&((r=s.get("OFF"))||(r=[])),this._referenceHolder)if(t){if(r&&-1!==(a=r.indexOf(this._referenceHolder))&&r.splice(a,1),n){var a=n.indexOf(this._referenceHolder);-1!==a&&n.splice(a)}n.push(this._referenceHolder)}else n&&-1!==(a=n.indexOf(this._referenceHolder))&&n.splice(a,1),void 0===r&&(r=[],s.update("OFF",r)),r&&-1!==(a=r.indexOf(this._referenceHolder))&&r.splice(a),r.push(this._referenceHolder);s._updated=!0}e._updated=!0}},e.prototype._setLock=function(t){var e,i=this._document._catalog._catalogDictionary;if(i.has("OCProperties")&&((e=i.get("OCProperties"))||(e=new Ts(this._crossReference))),e){var r=e.get("D");if(r||(r=new Ts(this._crossReference)),r){var n=r.get("Locked");if(this._referenceHolder)if(t)n?-1===n.indexOf(this._referenceHolder)&&n.push(this._referenceHolder):(this._lock=[],this._lock.push(this._referenceHolder),r.update("Locked",this._lock));else if(n){var s=n.indexOf(this._referenceHolder);-1!==s&&n.splice(s,1)}r._updated=!0}e._updated=!0}},e.prototype._parseLayerPage=function(){if(this._document)for(var t=0;t<this._document.pageCount;t++){var e=this._document.getPage(t)._pageDictionary,i=this._document.getPage(t);if(e.has("Resources")){var r=e.get("Resources");if(r&&(r.has("Properties")||r.has("XObject"))){var n=r.get("Properties"),s=r.get("XObject");if(n){_=n._map;for(var a in _)if(_[String(a)]instanceof Ss){var o=_[String(a)],h=this._crossReference._fetch(o),c=a;if(l=this._parseDictionary(h,o,i,c))break}}if(s){var _=s._map;for(var a in _)if(_[String(a)]instanceof Ss){o=_[String(a)];if((h=this._crossReference._fetch(o).dictionary).has("OC")){var d=a,u=h.getRaw("OC");h=this._crossReference._fetch(u);var l=this._parseDictionary(h,u,i,d);if(l){this._layer._xObject.push(d);break}}}}}}}},e.prototype._parseDictionary=function(t,e,i,r){var n=this,s=!1;if(t.has("Name")&&t.has("OCGs")){var a=t.get("OCGs");a?a.forEach(function(a){a instanceof Ss&&(e=a,t=n._crossReference._fetch(e),s=n._setLayerPage(e,i,r))}):(e=t.getRaw("OCGs"),(t=t.get("OCGs"))&&t.has("Name")&&(s=this._setLayerPage(e,i,r)))}else t.has("Name")&&(s=this._setLayerPage(e,i,r));return s},e.prototype._setLayerPage=function(t,e,i){var r=!1;return this._layer._referenceHolder&&this._layer._referenceHolder===t&&(this._layer._pageParsed=!0,r=!0,this._layer._layerId=i,this._layer._page=e,-1===this._layer._pages.indexOf(e)&&this._layer._pages.push(e)),r},e.prototype._setPrintState=function(){var e,i,r=this._document._catalog._catalogDictionary;r.has("OCProperties")&&((e=r.get("OCProperties"))||(e=new Ts(this._crossReference)));var n=e.get("OCGs");n||(n=[]),i=this._dictionary.has("Usage")?this._dictionary.get("Usage"):new Ts,this._layer._printOption=new Ts,this._layer._printOption.update("Subtype",new vs("Print")),this._layer._printState===t.PdfPrintState.neverPrint?this._layer._printOption.update("PrintState",new vs("OFF")):this._layer.printState===t.PdfPrintState.alwaysPrint&&this._layer._printOption.update("PrintState",new vs("ON"));var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,this._layer._printOption),i.update("Print",s),this._layer._usage=i,this._dictionary.update("Usage",this._layer._usage);var a=[];a.push(new vs("Print"));var o=new Ts;o.update("Category",a),o.update("OCGs",n),o.update("Event",new vs("Print"));var h=[];s=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(s,o),h.push(s);var c=e.get("D");c||(c=new Ts(this._crossReference)),c.update("D",h)},e}(),vo=function(){function e(t,e){var i=this;if(this._subLayer=!1,this._isLayerContainsResource=!1,this._layerDictionary=new Map,this._bdcCount=0,this._list||(this._list=[]),this._crossReference=t._crossReference,this._catalog=t._catalog,this._document=t,e)this._parent=e;else{var r,n;if(this._document&&this._document._catalog&&this._document._catalog._catalogDictionary&&this._document._catalog._catalogDictionary.has("OCProperties")){var s=this._document._catalog._catalogDictionary.get("OCProperties");if(s&&s.has("OCGs")){var a=s.get("OCGs");a&&Array.isArray(a)&&a.forEach(function(e){if((n=e)instanceof Ss){r=i._crossReference._fetch(n);var s=new bo;if(r){if(r.has("Name")){var a=r.get("Name");s.name=a,s._dictionary=r,s._crossReference=i._document._crossReference,s._referenceHolder=n;var o=r.get("LayerID");o&&(s._layerId=o.name);var h=r.getRaw("Usage");if(h&&h instanceof Ts){var c=h.get("Print");c&&c instanceof Ts&&(s._printOption=c,c.has("PrintState")&&i._setPrintState(c,s)),(f=h.get("View"))&&f instanceof Ts&&f.has("ViewState")&&"OFF"===(p=f.get("ViewState")).name&&(s.visible=!1)}if(h&&h instanceof Ss){var _=i._crossReference._fetch(h);if(_&&_ instanceof Ts){var d=_.getRaw("Print");if(d&&d instanceof Ss){var u=i._crossReference._fetch(d);u&&u instanceof Ts&&(s._printOption=u,u.has("PrintState")&&i._setPrintState(u,s))}var l=_.getRaw("View");if(l&&l instanceof Ss){var f=i._crossReference._fetch(l);if(f&&f instanceof Ts&&f.has("ViewState")){var p=f.get("ViewState");"OFF"===p.name&&(s.visible=!1)}}}}}s._document=t,s._layer=s,i._layerDictionary.set(n,s),i._list.push(s)}}}),this._checkLayerLock(s),this._checkLayerVisible(s),this._checkParentLayer(s),this._createLayerHierarchical(s)}}}}return Object.defineProperty(e.prototype,"_isSkip",{get:function(){return this._bdcCount>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._list.length},enumerable:!0,configurable:!0}),e.prototype.at=function(t){return this._list[t]},e.prototype.add=function(t,e){var i=new bo;return i._document=this._document,i._crossReference=this._document._crossReference,i.name=t,null!==e&&void 0!==e&&(i.visible=e),i._layerId="OCG_"+it(),i._subLayerPosition=0,i._layer=i,this._addLayer(i),i},e.prototype.contains=function(t){if(!t)throw new Error("Layer cannot be null or undefined");return"string"==typeof t?this._list.some(function(e){return e.name===t}):t instanceof bo&&-1!==this._list.indexOf(t)},e.prototype.clear=function(){for(var t=this._list.length-1;t>-1;t--){var e=this._list[t];this._removeLayer(e,!0)}this._list.length=0},e.prototype.indexOf=function(t){if(!t)throw new Error("Layer cannot be null or undefined");return this._list.indexOf(t)},e.prototype.move=function(t,e){if(t<0||t>=this._list.length)throw new Error("Index cannot be less than 0 or greater than array length");if(!e)throw new Error("Layer cannot be null or undefined");for(var i,r=0;r<this._list.length;r++)if(this._list[r]===e){i=this.indexOf(this._list[r]);break}null!==i&&void 0!==i&&i!==t&&(this._list.splice(i,1),this._list.splice(t,0,e),this._insertLayer(t,e))},e.prototype.removeAt=function(t,e){if(t<0||t>=this._list.length)throw new Error("Index cannot be less than 0 or greater than array length");var i=this._list[t];if(this._list.splice(t,1),i&&(this._removeLayer(i,e||!1),i._child.length>0))for(var r=0,n=i._child;r<n.length;r++){var s=n[r];this._removeLayer(s,!1);var a=this._list.indexOf(s);-1!==a&&this._list.splice(a,1)}},e.prototype.remove=function(t,e){if(t instanceof bo){r=t;-1!==(n=this._list.indexOf(r))&&this.removeAt(n,e||!1)}else if("string"==typeof t)for(var i=0;i<this._list.length;i++){var r=this._list[i],n=this._list.indexOf(r);r.name===t&&-1!==n&&(this.removeAt(n,e||!1),i-=1)}},e.prototype._setPrintState=function(e,i){var r=e.get("PrintState");r&&r instanceof vs&&("ON"===r.name?i.printState=t.PdfPrintState.alwaysPrint:i.printState=t.PdfPrintState.neverPrint)},e.prototype._addLayer=function(t){this._list.push(t);var e=this._list.length-1;return this._document instanceof jh&&this._createLayer(t),t._layer=t,e},e.prototype._createLayer=function(t){var e=this,i=new Ts(this._crossReference),r=this._createOptionalContentDictionary(t),n=!1;if(this._document&&this._document._catalog&&this._document._catalog._catalogDictionary.has("OCProperties")&&this._isLayerContainsResource){var s=this._document._catalog._catalogDictionary.get("OCProperties");if(s&&s.has("OCGs")){var a=s.get("OCGs");if(a&&r){n=!0;for(var o=0,h=r;o<h.length;o++){var c=h[o];-1===a.indexOf(c)&&a.push(c)}}if(s.has("D")){var _=s.get("D");if(_){var d=void 0,u=void 0,l=void 0;_.has("Order")||_.update("Order",this._document._order),_.has("OFF")&&(u=_.get("OFF")),_.has("ON")&&(d=_.get("ON")),_.has("AS")&&(l=_.get("AS")),l&&l.forEach(function(i){var n,s=i;if(s instanceof Ss&&(n=e._crossReference._fetch(s))&&n instanceof Ts){var a=n.get("OCGs");a&&r&&-1===a.indexOf(t._referenceHolder)&&a.push(t._referenceHolder)}}),t.visible?d&&r&&-1===d.indexOf(t._referenceHolder)&&d.push(t._referenceHolder):u&&r&&-1===u.indexOf(t._referenceHolder)&&u.push(t._referenceHolder)}}this._document._catalog._catalogDictionary._updated=!0}}n||(i.update("OCGs",r),i.update("D",this._createOptionalContentViews()),this._catalog._catalogDictionary.update("OCProperties",i)),this._crossReference._allowCatalog=!0},e.prototype._createOptionalContentDictionary=function(e){var i=new Ts(this._crossReference),r=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(r,i),i.update("Name",e.name),i.update("Type",new vs("OCG")),i.update("LayerID",new vs(e._layerId)),i.update("Visible",e.visible),e.printState===t.PdfPrintState.alwaysPrint||e.printState===t.PdfPrintState.neverPrint||e.printState===t.PdfPrintState.printWhenVisible){var n=this._setPrintOption(e);i.update("Usage",n),this._document._printLayer.push(r)}this._document._optionalContentDictionaries.push(r),e._dictionary=i,e._referenceHolder=r;var s=this._document._catalog._catalogDictionary.get("OCProperties");return this._createSublayer(s,r,e),e.visible?this._document._on.push(r):this._document._off.push(r),this._isLayerContainsResource=!0,this._document._optionalContentDictionaries},e.prototype._createOptionalContentViews=function(){var t=new Ts;t.update("Name","Layers"),t.update("Order",this._document._order),t.update("ON",this._document._on),t.update("OFF",this._document._off);var e=[];e.push(new vs("Print"));var i=new Ts;i.update("Category",e),i.update("OCGs",this._document._printLayer),i.update("Event",new vs("Print"));var r=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(r,i),this._document._as.push(r),t.update("AS",this._document._as),t},e.prototype._setPrintOption=function(e){var i=new Ts,r=new Ts,n=this._crossReference._getNextReference(),s=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(n,i),this._crossReference._cacheMap.set(s,r),r.update("Subtype",new vs("Print")),e.printState===t.PdfPrintState.neverPrint?r.update("PrintState",new vs("OFF")):e.printState===t.PdfPrintState.alwaysPrint&&r.update("PrintState",new vs("ON")),e._usage=i,e._printOption=r,i.update("Print",s),n},e.prototype._createSublayer=function(t,e,i){if(this._subLayer){if(i._parent=this._parent,t){var r=void 0,n=t.get("D");n&&(r=n.get("Order")),this._document._order&&r&&(this._document._order=r)}if(0===this._parent._child.length)this._parent._subLayer.push(e);else if(-1!==this._document._order.indexOf(this._parent._referenceHolder)){h=this._document._order.indexOf(this._parent._referenceHolder);this._document._order.splice(h+1,1),this._parent._subLayer.push(e)}else this._parent._subLayer.push(e);if(-1!==this._document._order.indexOf(this._parent._referenceHolder)){h=this._document._order.indexOf(this._parent._referenceHolder);this._document._order.splice(h+1,0,this._parent._subLayer)}else if(this._parent._parent){if(-1!==this._parent._parent._subLayer.indexOf(this._parent._referenceHolder)){h=this._parent._parent._subLayer.indexOf(this._parent._referenceHolder);if(1===this._parent._subLayer.length&&this._parent._parent._subLayer.splice(h+1,0,this._parent._subLayer),-1!==this._document._order.indexOf(this._parent._parent._referenceHolder)){var s=this._document._order.indexOf(this._parent._parent._referenceHolder);this._document._order.splice(s+1,1),this._document._order.splice(s+1,0,this._parent._parent._subLayer)}}}else if(document instanceof jh)for(var a=0;a<document._order.length;a++)if(Array.isArray(document._order[a])){var o=document._order[a];if(-1!==o.indexOf(this._parent._referenceHolder)){var h=o.indexOf(this._parent._referenceHolder);if(1===this._parent._subLayer.length){o.splice(h+1,0,this._parent._subLayer);break}}}-1===this._parent._child.indexOf(i)&&this._parent._child.push(i),0===this._parent._parentLayer.length?i._parentLayer.push(this._parent):(this._parent._parentLayer.forEach(function(t){-1===i._parentLayer.indexOf(t)&&i._parentLayer.push(t)}),-1===i._parentLayer.indexOf(this._parent)&&i._parentLayer.push(this._parent))}else if(t){r=void 0;(n=t.get("D"))&&(r=n.get("Order")),r&&(this._document._order=r),this._document._order.push(e)}else this._document._order.push(e)},e.prototype._checkLayerLock=function(t){var e,i=this,r=t.get("D");r&&r.has("Locked")&&(e=r.get("Locked")),e&&e.forEach(function(t){if(t&&t instanceof Ss){var e=i._layerDictionary.get(t);e&&(e.locked=!0)}})},e.prototype._checkLayerVisible=function(t){var e,i=this,r=this._document;if(r._catalog&&r._catalog._catalogDictionary.has("OCProperties")){var n=t.get("D");n&&n.has("OFF")&&(e=n.get("OFF")),e&&e.forEach(function(t){if(t instanceof Ss){var e=i._layerDictionary;if(e&&e.size>0&&t&&e.has(t)){var r=e.get(t);r&&r._visible&&(r._visible=!1,r._dictionary&&r._dictionary.set("Visible",!1))}}})}},e.prototype._checkParentLayer=function(t){var e=t.get("D");if(e){var i=e.get("Order");i&&this._parsingLayerOrder(null,i,this._layerDictionary)}},e.prototype._parsingLayerOrder=function(t,e,i){for(var r,n,s=0;s<e.length;s++)if((r=e[s])instanceof Ss){if(i.has(r)&&(n=i.get(r)),n&&(t&&(-1===t._child.indexOf(n)&&t._child.push(n),0===t._parentLayer.length?(n._parentLayer.push(t),n._parent=t):(t._parentLayer.forEach(function(t){-1===n._parentLayer.indexOf(t)&&(t instanceof bo||!t||n._parentLayer.push(t))}),n._parentLayer.push(t),n._parent=t)),e.length>s+1&&Array.isArray(e[s+1]))){var a=e[++s];n._subLayer=a,this._parsingLayerOrder(n,a,i)}}else if(Array.isArray(e[s])){var o=e[s];if(!o||0===o.length)return;"string"==typeof o[0]?(t=null,this._parsingLayerOrder(t,o,i)):(t=null,this._parsingLayerOrder(t,e[s],i))}},e.prototype._createLayerHierarchical=function(t){var e=this,i=t.get("D");i&&i.has("Order")&&this._layerDictionary&&this._layerDictionary.size>0&&(this._list.splice(0,this._list.length),this._layerDictionary.forEach(function(t,i){t instanceof bo&&i instanceof Ss&&(t._parent||-1!==e._list.indexOf(t)?t._child.length>0?e._addChildLayer(t._parent):t._parent&&0===t._child.length&&!t._parent.layers.contains(t)&&t._parent.layers._addNestedLayer(t):e._list.push(t))}))},e.prototype._addChildLayer=function(t){t._child.forEach(function(e){-1===t.layers.indexOf(e)&&t.layers._addNestedLayer(e)})},e.prototype._addNestedLayer=function(t){this._list.push(t);var e=this._list.length-1;return t._layer=t,e},e.prototype._removeLayer=function(t,e){var i;if(t&&this._document){if((i=this._document._catalog._catalogDictionary)&&i.has("OCProperties")){var r=i.get("OCProperties");if(r){var n=r.get("OCGs");if(n&&this._removeOCG(t,n),r.has("D")){var s=r.get("D");if(s){var a=void 0,o=void 0;if(s.has("Order")){var h=s.get("Order");if(h){var c=[];this._removeOrder(t,h,c)}}if(s.has("Locked")){var _=s.get("Locked");_&&this._removeLocked(t,_)}if(s.has("OFF")&&(o=s.get("OFF")),s.has("ON")&&(a=s.get("ON")),s.has("AS")){var d=s.get("AS");d&&this._removeUsage(t,d)}this._removeVisible(t,a,o)}s._updated=!0}if(t._layerPage){var u=t._layerPage._pageDictionary.get("Resources");if(u.has("Properties")){var l=u.get("Properties");l&&l.has(t._layerId)&&delete l._map[t._layerId]}}var f=this._crossReference._cacheMap;if(f.has(t._referenceHolder)){var p=this._crossReference._cacheMap.get(t._referenceHolder);if(p){var g=p.getRaw("Usage");if(g instanceof Ss&&(p=this._crossReference._cacheMap.get(g))){var y=p.getRaw("Print");f.delete(t._referenceHolder),f.delete(g),f.delete(y)}}}r._updated=!0,i._updated=!0}this._crossReference._allowCatalog=!0}e&&this._removeLayerContent(t)}},e.prototype._removeOCG=function(t,e){e&&-1!==e.indexOf(t._referenceHolder)&&e.splice(e.indexOf(t._referenceHolder),1)},e.prototype._removeUsage=function(t,e){if(e)for(var i=!1,r=0;r<e.length;r++){var n=e[r];if(n){var s=void 0;if(n instanceof Ss&&(s=this._crossReference._fetch(e[r])),n instanceof Ts&&(s=n),s){var a=s.get("OCGs");if(a&&(-1!==a.indexOf(t._referenceHolder)&&(a.splice(a.indexOf(t._referenceHolder),1),i=!0),i))break}}}},e.prototype._removeOrder=function(t,e,i){var r=!1;if(e)for(s=0;s<e.length;s++){var n=e[s];if(n&&n instanceof Ss&&n===t._referenceHolder){if(s!==e.length-1){if(Array.isArray(e[s+1])){e.splice(s,2),r=!0;break}e.splice(s,1),r=!0;break}e.splice(s,1),r=!0;break}Array.isArray(n)&&i.push(e[s])}if(!r&&i)for(var s=0;s<i.length;s++)e=i[s],i.splice(s,1),s-=1,this._removeOrder(t,e,i)},e.prototype._removeVisible=function(t,e,i){if(t.visible)e&&-1!==e.indexOf(t._referenceHolder)&&(r=e.indexOf(t._referenceHolder))>-1&&e.splice(r,1);else if(i&&-1!==i.indexOf(t._referenceHolder)){var r=i.indexOf(t._referenceHolder);r>-1&&i.splice(r,1)}},e.prototype._removeLocked=function(t,e){e&&-1!==e.indexOf(t._referenceHolder)&&e.splice(e.indexOf(t._referenceHolder),1)},e.prototype._removeLayerContent=function(t){var e,i,r=!1;if(t._layerPage)for(var n=0;n<t._pages.length;n++){var s=t._pages[n]._pageDictionary.get("Resources");if(s&&(e=s.get("Properties"),i=s.get("XObject"),e&&t._layerId.trim().length>0&&e.has(t._layerId)&&delete e._map[t._layerId],i&&t._xObject.length>0)){for(var a=i._map,o=0,h=a;o<h.length;o++){var c=h[o];if(-1!==t._xObject.indexOf(a[String(c)])){delete i._map[String(c)];break}}-1!==t._xObject.indexOf(t._layerId)&&t._xObject.splice(t._xObject.indexOf(t._layerId),1)}for(var _=t._pages[n]._pageDictionary.getArray("Contents"),d=0;d<_.length;d++){for(var u=new Is([]),l=_[d],f=l.dictionary.objId,p=l.getBytes(),g=void 0,y=(g=new Xr(l instanceof Is?l._bytes:p))._readContent(),m=0;m<y.length;m++){var b=y[m],v=b._operator;if("BMC"===v||"EMC"===v||"BDC"===v){var w=b._operands;this._processBeginMarkContent(t,v,w,u,f),r=!0}var S=!1;"Do"===v&&"/"+t._layerId===b._operands[0]&&(S=!0),S||("q"===v||"Q"===v||"w"===v||"J"===v||"j"===v||"M"===v||"d"===v||"ri"===v||"i"===v||"gs"===v||"g"===v||"cm"===v||"G"===v||"rg"===v||"RG"===v||"k"===v||"K"===v||"cs"===v||"CS"===v||"scn"===v||"SCN"===v||"sc"===v||"SC"===v?(r||this._streamWrite(b._operands,v,!1,u),r=!1):(r||this._streamWrite(b._operands,v,!0,u),r=!1))}if(u.length>0){var x=t._pages[n],P=x._pageDictionary.getRaw("Contents")[d];this._crossReference._cacheMap.set(P,u),x._pageDictionary._updated=!0}}t._pages[n]._pageDictionary._updated=!0}},e.prototype._processBeginMarkContent=function(t,e,i,r,n){if("BDC"===e){var s=void 0;if(i.length>1&&"OC"===i[0].substring(1)&&(s=i[1].substring(1)),this._bdcCount>0)return void this._bdcCount++;if(s&&s===t._layerId){this._bdcCount++;var a=t._pages[0]._pageDictionary.getRaw("Contents");if(n){var o=n.split(" "),h=a.indexOf(Ss.get(Number(o[0]),Number(o[1])));t._pages[0]._pageDictionary.getRaw("Contents").splice(h,1)}}}this._streamWrite(i,e,!0,r),"EMC"===e&&this._bdcCount>0&&this._bdcCount--},e.prototype._streamWrite=function(t,e,i,r){var n;if(!i||!this._isSkip){if(t)for(var s=0,a=t;s<a.length;s++)n=a[s],r.write(n),r.write(" ");n=e,r.write(n),r.write("\r\n")}},e.prototype._insertLayer=function(t,e){var i=e._referenceHolder;if(this._document){var r=this._document._catalog._catalogDictionary;if(r.has("OCProperties")){var n=r.get("OCProperties");if(n){var s=n.get("OCGs");if(n.has("D")){var a=n.get("D");if(a){var o=a.get("Order");if(o&&s&&-1!==o.indexOf(i)&&t<o.length&&o[t]instanceof Ss&&t+1<o.length&&t+2<o.length){var h=t+2;if(o[t+1]instanceof Ss&&o[h]instanceof Ss){var c=o.indexOf(i);if(o.splice(c,1),o.splice(t,0,i),-1!==s.indexOf(i)){var _=s.indexOf(i);s.splice(_,1),s.splice(t,0,i)}}}}}}}}},e}(),wo=function(){function t(t,e){this._pageCount=0,this._document=t,this._crossReference=t._crossReference;var i=new Ts(this._crossReference);i.update("Type",vs.get("Pages")),this._pageSettings=e,pe(i,e);var r=this._crossReference._getNextReference();this._crossReference._cacheMap.set(r,i),i.objId=r.toString(),i.update("Kids",[]),i.update("Count",0),this._dictionary=i,this._reference=r;var n=this._document.pageCount;if(0===n){var s=this._document._catalog._catalogDictionary._get("Pages"),a=this._document._catalog._topPagesDictionary;a&&(a.has("Kids")?(c=a.get("Kids"))&&(c.push(r),a.update("Kids",c),i.update("Parent",s)):(a.update("Kids",[r]),i.update("Parent",s)))}else{var o=this._document.getPage(n-1);if(o&&o._pageDictionary){var s=o._pageDictionary._get("Parent"),h=this._crossReference._fetch(s);if(h&&h.has("Kids")){var c=h.get("Kids");c&&(c.push(r),h.update("Kids",c),i.update("Parent",s))}}}}return Object.defineProperty(t.prototype,"template",{get:function(){return this._document._isLoaded?this._template:(this._template||(this._template={}),this._template)},enumerable:!0,configurable:!0}),t.prototype.addPage=function(){var t=0===this._document.pageCount?0:this._document.pageCount,e=new Ts(this._crossReference);e.update("Type",vs.get("Page"));var i=this._crossReference._getNextReference();if(this._crossReference._cacheMap.set(i,e),e.objId=i.toString(),e.update("Parent",this._reference),this._dictionary.has("Kids")){var r=this._dictionary.get("Kids");r&&(r.push(i),this._dictionary.update("Kids",r),fe(this._dictionary,1),this._document._pageCount++)}else this._dictionary.update("Kids",[i]),fe(this._dictionary,1),this._document._pageCount=1;this._pageCount++;var n=new zn(this._crossReference,t,e,i);return n._pageSettings=this._pageSettings,n._isNew=!0,this._document._pages.set(t,n),n},t}(),So=function(){function t(t){void 0===t&&(t="0"),this.digits=this._parseDecimalString(t)}return t.prototype._parseDecimalString=function(t){return t.split("").reverse().map(function(t){return parseInt(t,10)})},t.prototype._toString=function(){return this.digits.slice().reverse().join("").replace(/^0+/,"")||"0"},t.prototype._toBigInt=function(){var t=this.digits.slice().reverse().join("").replace(/^0+/,"")||"0";return ze()(t)},t.prototype._add=function(t){for(var e=t,i=0;i<this.digits.length||e>0;i++){var r=(this.digits[i]||0)+e;this.digits[i]=r%10,e=Math.floor(r/10)}},t.prototype._multiply=function(){for(var t=0,e=0;e<this.digits.length;e++){var i=256*this.digits[e]+t;this.digits[e]=i%10,t=Math.floor(i/10)}for(;t>0;)this.digits.push(t%10),t=Math.floor(t/10)},t.prototype._bitLength=function(){for(var t=this.digits.slice(),e=0;t.length>1||0!==t[0];){for(var i=0,r=t.length-1;r>=0;r--){var n=10*i+t[r];t[r]=Math.floor(n/2),i=n%2}for(;t.length>1&&0===t[t.length-1];)t.pop();e++}return e},t}(),xo=function(){function t(t){t.pubicKey&&t.id?this._identifier=(new Qo)._createSubjectKeyID(t.pubicKey,t.id)._bytes:t.id&&(this._identifier=t.id)}return t.prototype.equals=function(e){if(!(e instanceof t))return!1;if(!this._identifier||!e._identifier||this._identifier.length!==e._identifier.length)return!1;for(var i=0;i<this._identifier.length;i++)if(this._identifier[i]!==e._identifier[i])return!1;return!0},t.prototype._getHashCode=function(){if(!this._identifier)return 0;for(var t=0,e=0;e<this._identifier.length;e++)t=(t<<5)-t+this._identifier[e],t|=0;return t},t}(),Po=function(){function t(){this._orig=new Map,this._orig=new Map,this._keys=new Map}return t.prototype._getKeys=function(){var t=[];return this._orig.forEach(function(e,i){t.push(i)}),t},t.prototype._clear=function(){this._orig.clear(),this._keys.clear()},t.prototype._remove=function(t){var e,i=t.toLowerCase();if(this._keys.forEach(function(t,r){r.toLowerCase()===i&&(e=t)}),!e)return null;this._keys.delete(i);var r=this._orig.get(e);return this._orig.delete(e),r},t.prototype._get=function(t){var e,i=t.toLowerCase(),r=[];this._keys.forEach(function(t,e){r.push([e,t])});for(var n=0;n<r.length;n++){var s=r[n],a=s[0],o=s[1];if(a.toLowerCase()===i){e=o;break}}return e?this._orig.get(e):null},t.prototype._setValue=function(t,e){var i,r=t.toLowerCase(),n=[];this._keys.forEach(function(t,e){n.push([e,t])});for(var s=0;s<n.length;s++){var a=n[s],o=a[0],h=a[1];if(o.toLowerCase()===r){i=h;break}}i&&this._orig.delete(i),this._keys.set(r,t),this._orig.set(t,e)},t}(),Ao=function(){function t(){}return t.prototype._startChunkedConversion=function(t){return new La(this,t)},t.prototype._rotateLeft=function(t,e){return t<<e|t>>>32-e},t.prototype._hash=function(t,e,i){for(var r=i+9+63>>6<<6,n=new Uint8Array(r),s=0;s<i;++s)n[s]=t[e++];n[s++]=128;var a=8*i;n[r-4]=a>>>24&255,n[r-3]=a>>>16&255,n[r-2]=a>>>8&255,n[r-1]=255&a;for(var o=1732584193,h=4023233417,c=2562383102,_=271733878,d=3285377520,u=new Uint32Array(80),l=0;l<r;l+=64){for(v=0;v<16;++v){var f=l+4*v;u[v]=n[f]<<24|n[f+1]<<16|n[f+2]<<8|n[f+3]}for(v=16;v<80;++v)u[v]=this._rotateLeft(u[v-3]^u[v-8]^u[v-14]^u[v-16],1);for(var p=o,g=h,y=c,m=_,b=d,v=0;v<80;++v){var w=void 0,S=void 0;v<20?(w=g&y|~g&m,S=1518500249):v<40?(w=g^y^m,S=1859775393):v<60?(w=g&y|g&m|y&m,S=2400959708):(w=g^y^m,S=3395469782);var x=this._rotateLeft(p,5)+w+b+S+u[v]>>>0;b=m,m=y,y=this._rotateLeft(g,30),g=p,p=x}o=o+p>>>0,h=h+g>>>0,c=c+y>>>0,_=_+m>>>0,d=d+b>>>0}return new Uint8Array([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}(),To=function(){function t(t){this._bytes=this._generateKeyID(t)}return t.prototype._generateKeyID=function(t){var e=new Ao,i=t._publicKey._data;return e._hash(i,0,i.length)},t}(),Co=function(){function t(){this._encoding=new Uint8Array(0),this._period=".".charCodeAt(0)}return t.prototype._fromParts=function(e,i){var r="number"==typeof i?[i].concat(e):e;if(!i||"number"==typeof i){if(r.length<2)throw new Error("An oid must contain at least two nodes");if(r[0]<0||r[0]>2)throw new Error("Invalid oid: The first node must be 0, 1, or 2.");if(r[0]<2&&r[1]>39)throw new Error("Invalid oid: When Node #1 is 0 or 1, Node #2 must be 0–39. Received: "+r+".")}var n=new t,s=n._encodeRelativeObjectIdentifier("number"==typeof i?[40*r[0]+r[1]].concat(r.slice(2)):r);return n._encoding=i&&"number"!=typeof i?this._mergeUint8Arrays(i._encoding,s):s,n},t.prototype._getNodes=function(){var t=this._decodeRelativeObjectIdentifier(this._encoding);return[Math.min(2,Math.floor(t[0]/40)),t[0]>=80?t[0]-80:t[0]%40].concat(t.slice(1))},t.prototype._getDotDelimitedNotation=function(){return this._getNodes().join(".")},t.prototype._getAbstractSyntaxNotation=function(){return"{ "+this._getNodes().map(function(t){return t.toString()}).join(" ")+" }"},t.prototype._mergeUint8Arrays=function(t,e){var i=new Uint8Array(t.length+e.length);return i.set(t,0),i.set(e,t.length),i},t.prototype._fromString=function(t){for(var e=[],i=0,r=0;r<t.length;r++)if(t.charCodeAt(r)===this._period){var n=Number.parseInt(t.slice(i,r),10);e.push(n),i=r+1}var s=Number.parseInt(t.slice(i),10);return e.push(s),this._fromParts(e)},t.prototype._fromBytes=function(e){if(0===e.length)throw new Error("Encoded value was too short to be an object identifier");if(0!=(128&e[e.length-1]))throw new Error("oid was truncated.");for(var i=0,r=1;r<e.length;r++){var n=e[r];if(0===i&&128===n)throw new Error("Padding is not allowed in object identifier nodes");n<128?i=0:i++}var s=new t;return s._encoding=new Uint8Array(e),s},t.prototype._fromBytesUnsafe=function(e){var i=new t;return i._encoding=new Uint8Array(e),i},t.prototype.toString=function(){return this._getDotDelimitedNotation()},t.prototype._toJson=function(){return this._getDotDelimitedNotation()},t.prototype._toBytes=function(){return new Uint8Array(this._encoding)},t.prototype._encodeRelativeObjectIdentifier=function(t){for(var e=[],i=0,r=t;i<r.length;i++){var n=r[i];if(n<128)e.push(n);else{for(var s=0,a=n;a>0;)s++,a>>>=7;for(var o=s-1;o>=0;o--){var h=n>>>7*o&127;0!==o&&(h|=128),e.push(h)}}}return new Uint8Array(e)},t.prototype._decodeRelativeObjectIdentifier=function(t){if(0===t.length)return[];if(t.length>1&&0!=(128&t[t.length-1]))throw new Error("The relative object identifier is too long and was shortened.");for(var e=[],i=0,r=0;r<t.length;r++){var n=t[r];if(128===n&&0===i)throw new Error("Relative oid node has unsupported padding.");i<<=7,i+=127&n,0==(128&n)&&(e.push(i),i=0)}return e},t}(),ko=function(){function e(){this._recursionCount=0,this._nestingRecursionLimit=5,this._name="",this._tagClass=t._TagClassType.universal,this._construction=t._ConstructionType.primitive,this._tagNumber=0}return e.prototype._getTagNumber=function(){return this._tagNumber},e.prototype._setTagNumber=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("Tag "+t+" was not a non-negative number.");this._tagNumber=t},e.prototype._getLength=function(){return this._getValue().length},e.prototype._tagLength=function(){var t=this._getTagNumber();if(t<31)return 1;for(var e=t,i=0;0!==e;)e>>>=7,i++;return 1+i},e.prototype._toBytes=function(){for(var t=this._toBuffers(),e=t.reduce(function(t,e){return t+e.length},0),i=new Uint8Array(e),r=0,n=0,s=t;n<s.length;n++){var a=s[n];i.set(a,r),r+=a.length}return i},e.prototype._validateSize=function(t,e,i,r,n){var s=void 0===n?1/0:n;if(i<r)throw new Error(t+" must be at least "+r+" "+e+", but was "+i+" "+e+".");if(i>s)throw new Error(t+" must not exceed "+s+" "+e+", but was "+i+" "+e+".")},e.prototype._validateRange=function(t,e,i,r){if(e<i)throw new Error(t+" must be at least "+i+", but was "+e+".");if(void 0!==r&&null!==r&&e>r)throw new Error(t+" must not exceed "+r+", but was "+e+".")},e.prototype._sizeConstrainedString=function(t,e){var i=this._getBitString();return this._validateSize(this._name||"Bit string","bits",i.length,t,e),i},e.prototype._sizeConstrainedUtf8String=function(t,e){var i=this._getUtf8String();return this._validateSize(this._name||"Unicode string","characters",i.length,t,e),i},e.prototype._sizeConstrainedSequenceOf=function(t,e){var i=this._getSequenceOf();return this._validateSize(this._name||"Sequence of","elements",i.length,t,e),i},e.prototype._sizeConstrainedSetOf=function(t,e){var i=this._getSequenceOf();return this._validateSize(this._name||"Set of","elements",i.length,t,e),i},e.prototype._sizeConstrainedNumericString=function(t,e){var i=this._getNumericString();return this._validateSize(this._name||"Numeric string","characters",i.length,t,e),i},e.prototype._sizeConstrainedPrintableString=function(t,e){var i=this._getPrintableString();return this._validateSize(this._name||"Printable ASCII string","characters",i.length,t,e),i},e.prototype._sizeConstrainedTextString=function(t,e){var i=this._getTeleprinterText();return this._validateSize(this._name||"Legacy encoded string","characters",i.length,t,e),i},e.prototype._sizeConstrainedVideoString=function(t,e){var i=this._getVideoTextInformation();return this._validateSize(this._name||"Videotex string","characters",i.length,t,e),i},e.prototype._sizeConstrainedIA5String=function(t,e){var i=this._getInternationalAlphabetString();return this._validateSize(this._name||"ASCII string","characters",i.length,t,e),i},e.prototype._sizeConstrainedGraphicString=function(t,e){var i=this._getGraphicString();return this._validateSize(this._name||"Graphic string","characters",i.length,t,e),i},e.prototype._sizeConstrainedVisibleString=function(t,e){var i=this._getVisibleString();return this._validateSize(this._name||"Visible string","characters",i.length,t,e),i},e.prototype._sizeConstrainedUniversalString=function(t,e){var i=this._getUniversalString();return this._validateSize(this._name||"Unicode string","characters",i.length,t,e),i},e.prototype._rangeConstrainedNumber=function(t,e){var i=this._getInteger();return this._validateRange(this._name||"Number",i,t,e),i},e.prototype._validateTag=function(t,e,i){return-1===t.indexOf(this._tagClass)?-1:-1===e.indexOf(this._construction)?-2:-1===i.indexOf(this._getTagNumber())?-3:0},e.prototype._toElement=function(){return this},e.prototype._fromElement=function(t){this._tagClass=t._tagClass,this._construction=t._construction;var e=t._getTagNumber();this._setTagNumber(e);var i=t._getValue();this._setValue(i)},e.prototype._toString=function(){if(this._tagClass!==t._TagClassType.universal)return this._tagClass===t._TagClassType.context?"[CTXT "+this._getTagNumber()+"]: "+this._getValue().toString():this._tagClass===t._TagClassType.abstractSyntaxPrivate?"[PRIV "+this._getTagNumber()+"]: "+this._getValue().toString():"[APPL "+this._getTagNumber()+"]: "+this._getValue().toString();switch(this._getTagNumber()){case t._UniversalType.endOfContent:return"END-OF-CONTENT";case t._UniversalType.abstractSyntaxBoolean:return this._getBooleanValue()?"TRUE":"FALSE";case t._UniversalType.integer:return this._getInteger().toString();case t._UniversalType.octetString:return"'"+Array.from(this._getOctetString()).map(function(t){return Ye(t.toString(16),2,"0")}).join("")+"'H";case t._UniversalType.nullValue:return"NULL";case t._UniversalType.objectIdentifier:return this._getObjectIdentifier()._getAbstractSyntaxNotation();case t._UniversalType.objectDescriptor:return'"'+this._getObjectDescriptor()+'"';case t._UniversalType.external:return"_PdfExternal";case t._UniversalType.enumerated:return this._getEnumerated().toString();case t._UniversalType.embeddedDataValue:return"EMBEDDED PDV";case t._UniversalType.utf8String:return'"'+this._getUtf8String()+'"';case t._UniversalType.relativeObjectIdentifier:return"{ "+this._getRelativeObjectIdentifier().map(function(t){return t.toString()}).join(".")+" }";case t._UniversalType.time:return'"'+this._getTime()+'"';case t._UniversalType.sequence:return"{ "+this._getSequenceOf().map(function(t){return t.name.length?t.name+" "+t.toString():t.toString()}).join(" , ")+" }";case t._UniversalType.abstractSyntaxSet:return"{ "+this._getAbstractSetOf().map(function(t){return t.name.length?t.name+" "+t.toString():t.toString()}).join(" , ")+" }";case t._UniversalType.numericString:return'"'+this._getNumericString()+'"';case t._UniversalType.printableString:return'"'+this._getPrintableString()+'"';case t._UniversalType.teleprinterTextExchange:return"TeletexString";case t._UniversalType.videoTextInformationSystem:return"VideotexString";case t._UniversalType.internationalAlphabetString:return'"'+this._getInternationalAlphabetString()+'"';case t._UniversalType.characterString:return"CHARACTER STRING";case t._UniversalType.date:return'"'+this._getDate().toISOString()+'"';case t._UniversalType.timeOfDay:var e=this._getTimeOfDay();return'"'+e.getUTCHours()+":"+e.getUTCMinutes()+":"+e.getUTCSeconds()+'"';case t._UniversalType.dateTime:return'"'+this._getDateTime().toISOString()+'"';case t._UniversalType.objectIdResourceIdentifier:return this._getObjectIdResourceIdentifier();case t._UniversalType.relativeResourceIdentifier:return this._getRelativeResourceIdentifier();default:return"[UNIV "+this._getTagNumber()+"]: "+this._getValue().toString()}},e.prototype._toJson=function(){if(this._tagClass===t._TagClassType.universal)switch(this._getTagNumber()){case t._UniversalType.endOfContent:return;case t._UniversalType.abstractSyntaxBoolean:return this._getBooleanValue();case t._UniversalType.integer:return this._getInteger();case t._UniversalType.bitString:var e=this._getBitString();return{length:e.length,value:Array.from(li(e)).map(function(t){return t.toString(16)}).join("")};case t._UniversalType.octetString:return Array.from(this._getOctetString()).map(function(t){return t.toString(16)}).join("");case t._UniversalType.nullValue:return null;case t._UniversalType.objectIdentifier:return this._getObjectIdentifier()._toJson();case t._UniversalType.objectDescriptor:return this._getObjectDescriptor();case t._UniversalType.enumerated:return this._getEnumerated().toString();case t._UniversalType.utf8String:return this._getUtf8String();case t._UniversalType.relativeObjectIdentifier:return this._getRelativeObjectIdentifier().map(function(t){return t.toString()}).join(".");case t._UniversalType.teleprinterTextExchange:return String.fromCodePoint.apply(String,Array.from(this._getTeleprinterText()));case t._UniversalType.videoTextInformationSystem:return String.fromCodePoint.apply(String,Array.from(this._getVideoTextInformation()));case t._UniversalType.graphicString:return this._getGraphicString();case t._UniversalType.visibleString:return this._getVisibleString();case t._UniversalType.universalString:return this._getUniversalString();case t._UniversalType.bmpString:return this._getBmpString();case t._UniversalType.date:return this._getDate().toISOString();case t._UniversalType.timeOfDay:var i=this._getTimeOfDay();return i.getUTCHours()+":"+i.getUTCMinutes()+":"+i.getUTCSeconds();case t._UniversalType.dateTime:return this._getDateTime().toISOString();case t._UniversalType.objectIdResourceIdentifier:return this._getObjectIdResourceIdentifier();case t._UniversalType.relativeResourceIdentifier:return this._getRelativeResourceIdentifier();default:return}},e.prototype._sortCanonically=function(t){return t.sort(function(t,e){for(var i=t._toBytes(),r=e._toBytes(),n=Math.min(i.length,r.length),s=0;s<n;s++)if(i[s]!==r[s])return i[s]-r[s];return i.length-r.length})},e.prototype._isUniquelyTagged=function(t){for(var e=new Set([]),i=0;i<t.length;i++){var r=(t[i]._tagClass<<30)+t[i]._getTagNumber();if(e.has(r))return!1;e.add(r)}return!0},e.prototype._getInteger=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Number cannot be constructed.");var e=this._getValue();return this._decodeInteger(e)},e.prototype._setInteger=function(t){this._setValue(this._encodeInteger(t))},e.prototype._getObjectIdentifier=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Object identifier cannot be constructed.");return this._decodeObjectIdentifier(this._getValue())},e.prototype._setObjectIdentifier=function(t){this._setValue(this._encodeObjectIdentifier(t))},e.prototype._getEnumerated=function(){return Number(this._getInteger())},e.prototype._setEnumerated=function(t){this._setInteger(t)},e.prototype._getRelativeObjectIdentifier=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Relative oid cannot be constructed.");return this._decodeRelativeObjectIdentifier(this._getValue())},e.prototype._setRelativeObjectIdentifier=function(t){this._setValue(this._encodeRelativeObjectIdentifier(t))},e.prototype._getTime=function(){return this._decodeTime(this._getValue())},e.prototype._setTime=function(t){this._setValue(this._encodeTime(t))},e.prototype._getDate=function(){return this._decodeDate(this._getValue())},e.prototype._setDate=function(t){this._setValue(this._encodeDate(t))},e.prototype._getTimeOfDay=function(){return this._decodeTimeOfDay(this._getValue())},e.prototype._setTimeOfDay=function(t){this._setValue(this._encodeTimeOfDay(t))},e.prototype._getDateTime=function(){return this._decodeDateTime(this._getValue())},e.prototype._setDateTime=function(t){this._setValue(this._encodeDateTime(t))},e.prototype._getObjectIdResourceIdentifier=function(){return this._decodeObjectIdResourceIdentifier(this._getValue())},e.prototype._setObjectIdResourceIdentifier=function(t){this._setValue(this._encodeObjectIdResourceIdentifier(t))},e.prototype._getRelativeResourceIdentifier=function(){return this._decodeRelativeResourceIdentifier(this._getValue())},e.prototype._setRelativeResourceIdentifier=function(t){this._setValue(this._encodeRelativeResourceIdentifier(t))},e.prototype._encodeInteger=function(t){return si(t)},e.prototype._decodeInteger=function(t){if(0===t.length)throw new Error("Integer or enumeration encoded on zero bytes");if(t.length>2&&(255===t[0]&&t[1]>=128||0===t[0]&&t[1]<128)){var e=t.slice(0,16),i=Array.from(e).map(function(t){return Ye(t.toString(16),2,"0")}).join("");throw new Error("Unnecessary padding bytes on . First 16 bytes of the offending value were: 0x"+i)}return ni(t)},e.prototype._encodeObjectIdentifier=function(t){return t._toBytes()},e.prototype._decodeObjectIdentifier=function(t){return(new Co)._fromBytes(t)},e.prototype._encodeRelativeObjectIdentifier=function(t){for(var e=[],i=0,r=t;i<r.length;i++){var n=r[i];if(n<128)e.push(n);else{for(var s=0,a=n;a>0;)s++,a>>>=7;for(var o=s-1;o>=0;o--){var h=n>>>7*o&127;0!==o&&(h|=128),e.push(h)}}}return new Uint8Array(e)},e.prototype._decodeRelativeObjectIdentifier=function(t){if(0===t.length)return[];if(t.length>1&&0!=(128&t[t.length-1]))throw new Error("The relative object identifier is too long and was shortened.");for(var e=[],i=0,r=0;r<t.length;r++){var n=t[r];if(128===n&&0===i)throw new Error("The relative object identifier node has unsupported padding.");i<<=7,i+=127&n,0==(128&n)&&(e.push(i),i=0)}return e},e.prototype._encodeTime=function(t){return f(t.replace(/,/g,"."))},e.prototype._decodeTime=function(t){return gi(t)},e.prototype._encodeDate=function(t){if(t.getFullYear()<1582||t.getFullYear()>9999)throw new Error("The Date "+t.toISOString()+" may not be encoded, because the year must be greater than 1581 and less than 10000.");return f(Ye(t.getFullYear().toString(),4,"0")+Ye((t.getMonth()+1).toString(),2,"0")+Ye(t.getDate().toString(),2,"0"))},e.prototype._decodeDate=function(t){var e=gi(t),i=parseInt(e.slice(0,4),10),r=parseInt(e.slice(4,6),10)-1,n=parseInt(e.slice(6,8),10);return Si("DATE",i,r,n),new Date(i,r,n)},e.prototype._encodeTimeOfDay=function(t){return f(Ye(t.getHours().toString(),2,"0")+Ye(t.getMinutes().toString(),2,"0")+Ye(t.getSeconds().toString(),2,"0"))},e.prototype._decodeTimeOfDay=function(t){var e=gi(t),i=parseInt(e.slice(0,2),10),r=parseInt(e.slice(2,4),10),n=parseInt(e.slice(4,6),10);xi("TIME-OF-DAY",i,r,n);var s=new Date;return s.setHours(i),s.setMinutes(r),s.setSeconds(n),s},e.prototype._decodeDateTime=function(t){var e=gi(t),i=parseInt(e.slice(0,4),10),r=parseInt(e.slice(4,6),10)-1,n=parseInt(e.slice(6,8),10),s=parseInt(e.slice(8,10),10),a=parseInt(e.slice(10,12),10),o=parseInt(e.slice(12,14),10);return Pi("DATE-TIME",i,r,n,s,a,o),new Date(i,r,n,s,a,o)},e.prototype._decodeGeneralString=function(t){for(var e=0;e<t.length;e++)if(!bi(t[e]))throw new Error("The input must contain only standard ASCII characters.");return gi(t)},e.prototype._decodeGraphicString=function(t){for(var e=0;e<t.length;e++)if(!vi(t[e]))throw new Error("Only standard printable ASCII characters are allowed.");return gi(t)},e.prototype._decodeNumericString=function(t){for(var e=0;e<t.length;e++)if(!Ai(t[e]))throw new Error("The input must contain only numeric characters and spaces.");return gi(t)},e.prototype._decodeObjectDescriptor=function(t){for(var e=0;e<t.length;e++)if(!vi(t[e]))throw new Error("Only standard printable ASCII characters are allowed in the object descriptor.");return gi(t)},e.prototype._decodeObjectIdResourceIdentifier=function(t){return gi(t)},e.prototype._decodeRelativeResourceIdentifier=function(t){return gi(t)},e.prototype._decodePrintableString=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(!wi(i))throw new Error("Printable ASCII string can only contain these characters: etaoinsrhdlucmfywgpbvkxqjzETAOINSRHDLUCMFYWGPBVKXQJZ0123456789 '()+,-./:=?. Encountered character code "+i+".")}return gi(t)},e.prototype._decodeVisibleString=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(!vi(i))throw new Error("Visible string can only contain characters between 0x20 and 0x7E. Encountered character code "+i+".")}return gi(t)},e.prototype._encodeBitString=function(t){if(0===t.length)return new Uint8Array([0]);var e=(t.length>>>3)+(t.length%8!=0?1:0),i=new Uint8Array(e+1);return i[0]=8-t.length%8,8===i[0]&&(i[0]=0),i.set(li(t),1),i},e.prototype._encodeBoolean=function(t){return new Uint8Array([t?255:0])},e.prototype._encodeDateTime=function(t){var e=t.getFullYear();if(e<1582||e>9999)throw new Error("The date cannot be encoded");return f(Ye(e.toString(),4,"0")+Ye((t.getMonth()+1).toString(),2,"0")+Ye(t.getDate().toString(),2,"0")+Ye(t.getHours().toString(),2,"0")+Ye(t.getMinutes().toString(),2,"0")+Ye(t.getSeconds().toString(),2,"0"))},e.prototype._encodeObjectIdResourceIdentifier=function(t){return f(t)},e.prototype._encodeRelativeResourceIdentifier=function(t){return f(t)},e.prototype._encodeSequence=function(t){for(var e=t.map(function(t){return t._toBytes()}),i=e.reduce(function(t,e){return t+e.length},0),r=new Uint8Array(i),n=0,s=0,a=e;s<a.length;s++){var o=a[s];r.set(o,n),n+=o.length}return r},e.prototype._encodeNumericString=function(t){return f(t)},e.prototype._encodePrintableString=function(t){return f(t)},e.prototype._encodeGraphicString=function(t){return f(t)},e.prototype._encodeVisibleString=function(t){return f(t)},e.prototype._encodeObjectDescriptor=function(t){return f(t)},e.prototype._toEncodedBytes=function(){return this._toBytes()},e.prototype._isTagged=function(){return this._tagClass===t._TagClassType.context},e.prototype._isConstructed=function(){return this._construction===t._ConstructionType.constructed},e}(),Ro=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)}}(),Fo=function(e){function i(i,r,n,s){void 0===i&&(i=t._TagClassType.universal),void 0===r&&(r=t._ConstructionType.primitive),void 0===n&&(n=t._UniversalType.endOfContent),void 0===s&&(s=void 0);var a=e.call(this)||this;return a._value=new Uint8Array(0),a._encode(s),a._tagClass=i,a._construction=r,a._setTagNumber(n),a}return Ro(i,e),i.prototype._getValue=function(){if(Array.isArray(this._value)){var t=this._encodeSequence(this._value);return this._currentValueLength=t.length,t}var e=Ve(this._value);return e!==this._value&&(this._value=e),this._currentValueLength=e.length,e},i.prototype._setValue=function(t){this._currentValueLength=t.length,this._value=t},i.prototype._getBooleanValue=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("boolean cannot be constructed.");return this._decodeBoolean(this._getValue())},i.prototype._setBooleanValue=function(t){this._setValue(this._encodeBoolean(t))},i.prototype._getBitString=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Bit string cannot be constructed.");return this._decodeBitString(this._getValue())},i.prototype._setBitString=function(t){this._setValue(this._encodeBitString(t))},i.prototype._getOctetString=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Octet string cannot be constructed.");return new Uint8Array(this._getValue())},i.prototype._setOctetString=function(t){this._setValue(new Uint8Array(t))},i.prototype._getObjectDescriptor=function(){return this._decodeObjectDescriptor(this._getValue())},i.prototype._setObjectDescriptor=function(t){this._setValue(this._encodeObjectDescriptor(t))},i.prototype._getUtf8String=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Unicode text cannot be constructed.");return gi(this._getValue())},i.prototype._setUtf8String=function(t){this._setValue(f(t))},i.prototype._getSequence=function(){if(this._construction!==t._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodeSequence(this._getValue())},i.prototype._setSequence=function(e){this._construct(e),this._construction=t._ConstructionType.constructed},i.prototype._getAbstractSetValue=function(){var t=this._getSequence();if(!this._isUniquelyTagged(t))throw new Error("Duplicate tag in Set.");return t},i.prototype._setAbstractSetValue=function(t){this._sortCanonically(t),this._setSequence(t)},i.prototype._getSequenceOf=function(){if(this._construction!==t._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodeSequence(this._getValue())},i.prototype._setSequenceOf=function(e){this._construct(e),this._construction=t._ConstructionType.constructed},i.prototype._getAbstractSetOf=function(){return this._getSequence()},i.prototype._setAbstractSetOf=function(t){this._setSequence(t)},i.prototype._getNumericString=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Numeric string cannot be constructed.");return this._decodeNumericString(this._getValue())},i.prototype._setNumericString=function(t){this._setValue(this._encodeNumericString(t))},i.prototype._getPrintableString=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Printable ASCII string cannot be constructed.");return this._decodePrintableString(this._getValue())},i.prototype._setPrintableString=function(t){this._setValue(this._encodePrintableString(t))},i.prototype._getTeleprinterText=function(){return this._serialize()},i.prototype._setTeleprinterText=function(t){this._setValue(new Uint8Array(t))},i.prototype._getVideoTextInformation=function(){return this._getOctetString()},i.prototype._setVideoTextInformation=function(t){this._setValue(new Uint8Array(t))},i.prototype._getInternationalAlphabetString=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("ASCII string cannot be constructed.");return gi(this._getValue())},i.prototype._setInternationalAlphabetString=function(t){this._setValue(f(t))},i.prototype._getGraphicString=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("Graphic string cannot be constructed.");return this._decodeGraphicString(this._getValue())},i.prototype._setGraphicString=function(t){this._setValue(this._encodeGraphicString(t))},i.prototype._getVisibleString=function(){return this._decodeVisibleString(this._getValue())},i.prototype._setVisibleString=function(t){this._setValue(this._encodeVisibleString(t))},i.prototype._getUniversalString=function(){var e=this._getValue();if(this._construction!==t._ConstructionType.primitive)throw new Error("Universal string cannot be constructed.");if(e.length%4)throw new Error("Universal string encoded on non-mulitple of four bytes.");for(var i="",r=0;r<e.length;r+=4)i+=String.fromCharCode((e[r+0]<<24)+(e[r+1]<<16)+(e[r+2]<<8)+(e[r+3]<<0));return i},i.prototype._setUniversalString=function(t){for(var e=new Uint8Array(t.length<<2),i=0;i<t.length;i++)e[i<<2]=t.charCodeAt(i)>>>24,e[1+(i<<2)]=t.charCodeAt(i)>>>16,e[2+(i<<2)]=t.charCodeAt(i)>>>8,e[3+(i<<2)]=t.charCodeAt(i);this._setValue(e)},i.prototype._getBmpString=function(){var e=this._getValue();if(this._construction!==t._ConstructionType.primitive)throw new Error("BMPString cannot be constructed.");if(e.length%2!=0)throw new Error("BMPString encoded on non-multiple of two bytes.");if("undefined"!=typeof TextDecoder)return new TextDecoder("utf-16be").decode(e);for(var i="",r=0;r<e.length;r+=2){var n=e[r]<<8|e[r+1];i+=String.fromCharCode(n)}return i},i.prototype._setBmpString=function(t){for(var e=new Uint8Array(t.length<<1),i=0;i<t.length;i++){var r=t.charCodeAt(i);e[i<<1]=r>>8,e[1+(i<<1)]=255&r}this._setValue(e)},i.prototype._construct=function(t){this._currentValueLength=void 0,this._value=t},i.prototype._encode=function(e){switch(typeof e){case"undefined":this._setValue(new Uint8Array(0));break;case"boolean":this._setTagNumber(t._UniversalType.abstractSyntaxBoolean),this._setBooleanValue(e);break;case"number":Number.isInteger(e)&&(this._setTagNumber(t._UniversalType.integer),this._setInteger(e));break;case"string":this._setTagNumber(t._UniversalType.utf8String),this._setUtf8String(e);break;case"object":if(e)if(e instanceof Uint8Array)this._setTagNumber(t._UniversalType.octetString),this._setOctetString(e);else if(e instanceof Uint8ClampedArray)this._setTagNumber(t._UniversalType.bitString),this._setBitString(e);else if(e instanceof ko)this._construction=t._ConstructionType.constructed,this._setSequence([e]);else if(Array.isArray(e))this._construction=t._ConstructionType.constructed,this._setTagNumber(t._UniversalType.sequence),this._setSequence(e.map(function(t){var e=new i;return e._encode(t),e}));else{if(!(e instanceof Co))throw new Error("Cannot encode value of type "+e.constructor.name+".");this._setTagNumber(t._UniversalType.objectIdentifier),this._setObjectIdentifier(e)}else this._setTagNumber(t._UniversalType.nullValue),this._setValue(new Uint8Array(0));break;default:throw new Error("Cannot encode value of type "+typeof e+".")}},i.prototype._fromSet=function(e){var r=new i(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.abstractSyntaxSet);return r._setAbstractSetValue(e.filter(function(t){return Boolean(t)})),r},i.prototype._fromSetOf=function(e){var r=new i(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.abstractSyntaxSet);return r._setAbstractSetOf(e.filter(function(t){return Boolean(t)})),r},i.prototype._getInner=function(){if(this._construction!==t._ConstructionType.constructed)throw new Error("An explicitly-encoded element cannot be encoded using primitive construction.");if(Array.isArray(this._value)){if(1!==this._value.length)throw new Error("An explicitly-encoding element contained "+this._value.length+" encoded elements.");return this._value[0]}var e=new i;if(e._fromBytes(this._value)!==this._value.length)throw new Error("An explicitly-encoding element contained more than one single ");return e},i.prototype._setInner=function(e){this._construction=t._ConstructionType.constructed,this._value=[e]},i.prototype._fromBytes=function(e){if(e.length<2)throw new Error("Tried to decode a DER element that is less than two bytes.");var i=0;switch(192&e[i]){case 0:this._tagClass=t._TagClassType.universal;break;case 64:this._tagClass=t._TagClassType.application;break;case 128:this._tagClass=t._TagClassType.context;break;case 192:this._tagClass=t._TagClassType.abstractSyntaxPrivate}this._construction=32&e[i]?t._ConstructionType.constructed:t._ConstructionType.primitive,this._setTagNumber(31&e[i]),i++;var r=this._getTagNumber();if(r>=31){if(128===e[i])throw new Error("Leading padding byte on long tag number encoding.");r=0;for(var n=e.length-1>=4?4:e.length-1;i<n&&128&e[i++];);if(128&e[i-1])throw n===e.length-1?new Error("ASN1 tag number appears to have been truncated."):new Error("ASN1 tag number too large.");for(o=1;o<i;o++)r<<=7,r|=127&e[o];if(r<31)throw new Error("ASN1 tag number could have been encoded in short form.")}if(128==(128&e[i])){var s=127&e[i];if(127===s)throw new Error("Length byte with undefined meaning encountered.");if(s>4)throw new Error("Element length too long to decode to an integer.");if(i+s>=e.length)throw new Error("Element length bytes appear to have been truncated.");i++;for(var a=new Uint8Array(4),o=s;o>0;o--)a[4-o]=e[i+s-o];var h=0;if(a.forEach(function(t){h<<=8,h+=t}),i+h<i)throw new Error("ASN1 element too large.");if((i+=s)+h>e.length)throw new Error("ASN1 element truncated.");if(h<=127&&h>=-128&&s>1||h<=32767&&h>=-32768&&s>2||h<=8388607&&h>=-8388608&&s>3)throw new Error("DER-encoded long-form length encoded on more octets than necessary");return this._setValue(e.slice(i,i+h)),i+h}var c=127&e[i++];if(i+c>e.length)throw new Error("ASN1 element was truncated.");return this._setValue(e.slice(i,i+c)),i+c},i.prototype._tagAndLengthBytes=function(){var t=this._getTagNumber(),e=(3&this._tagClass)<<6|(1&this._construction)<<5,i=[];if(t<31)i=[e|31&t];else{i=[31|e];var r=[],n=t;do{r.unshift(127&n),n>>>=7}while(n>0);for(var s=0;s<r.length;s++)i.push(s<r.length-1?128|r[s]:r[s])}var a=this._getLengthOctets(),o=new Uint8Array(i.length+a.length);return o.set(i,0),o.set(a,i.length),o},i.prototype._toBuffers=function(){var t=[this._tagAndLengthBytes()];if(Array.isArray(this._value))for(var e=0,i=this._value;e<i.length;e++){var r=i[e];t.push.apply(t,r._toBuffers())}else t.push(this._serialize());return t},i.prototype._serialize=function(){return new Uint8Array(this._getValue())},i.prototype._getLengthOctets=function(){var t=this._valueLength();if(t<128)return[t];for(var e=[],i=t;i>0;)e.unshift(255&i),i>>>=8;return[128|e.length].concat(e)},i.prototype._getComponents=function(){if(Array.isArray(this._value))return this._value;for(var t=[],e=0;e<this._value.length;){var r=new i;e+=r._fromBytes(this._getValue().subarray(e)),t.push(r)}return t},i.prototype._decodeBitString=function(t){if(0===t.length)throw new Error("ASN1 bit string cannot be encoded on zero bytes!");if(1===t.length&&0!==t[0])throw new Error("ASN1 bit string encoded with deceptive first byte!");if(t[0]>7)throw new Error("First byte of an ASN1 bit string must be <= 7!");for(var e=[],i=1;i<t.length;i++){var r=t[i];e.push(128&r?1:0,64&r?1:0,32&r?1:0,16&r?1:0,8&r?1:0,4&r?1:0,2&r?1:0,1&r?1:0)}for(var n=t[0],s=0,a=e.slice(e.length-n);s<a.length;s++)if(0!==a[s])throw new Error("bit string had a trailing set bit.");return e.length-=n,new Uint8ClampedArray(e)},i.prototype._decodeBoolean=function(t){if(1!==t.length)throw new Error("Invalid Boolean format: Boolean values must be exactly one byte.");if(0!==t[0]&&255!==t[0])throw new Error("Boolean must be encoded as 0xFF or 0x00.");return 0!==t[0]},i.prototype._encodeCharacterString=function(e){return this._encodeSequence([e._identification,new i(t._TagClassType.universal,t._ConstructionType.primitive,t._UniversalType.octetString,e._stringValue)])},i.prototype._decodeSequence=function(t){if(0===t.length)return[];for(var e=[],r=0;r<t.length;){var n=new i;r+=n._fromBytes(t.subarray(r)),e.push(n)}return e},i.prototype._fromSequence=function(e){var r=new i(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.sequence);return r._setSequence(e.filter(function(t){return Boolean(t)})),r},i.prototype._getExternalEncoding=function(t){switch(t._getTagNumber()){case 0:return t._getInner();case 1:return t._getOctetString();case 2:return t._getBitString();default:throw new Error("External does not know of an encoding option having tag number "+t._getTagNumber()+".")}},i.prototype._valueLength=function(){if(void 0!==this._currentValueLength&&null!==this._currentValueLength&&!Array.isArray(this._value))return this._currentValueLength;if(!Array.isArray(this._value)){var t=this._getValue();return this._currentValueLength=t.length,t.length}for(var e=0,i=0,r=this._value;i<r.length;i++)e+=r[i]._tagValueLength();return this._currentValueLength=e,e},i.prototype._lengthLength=function(t){var e=null!==t&&void 0!==t?t:this._valueLength();if(e<128)return 1;for(var i=0,r=e;r>0;)i++,r>>>=8;return 1+i},i.prototype._tagValueLength=function(){var t=this._valueLength();return this._tagLength()+this._lengthLength(t)+t},i}(ko),Io=function(){function e(t){if(t){this._element=t;var e=t._getSequence();if(!e||e.length<1||e.length>2)throw new Error("Invalid Algorithm Identifier sequence length");var i=e[0]._getValue();this._objectID=(new Co)._fromBytes(i),2===e.length?(this._parameters=e[1],this._parametersDefined=!0):this._parametersDefined=!1}}return e.prototype._getAlgorithms=function(t){return t instanceof e?t:t instanceof ko?new e(t):void 0},e.prototype._uniqueEncoderEncode=function(){if(this._element)return this._element._getValue();throw new Error("Cannot DER encode: not a DER element")},e.prototype._getUniqueEncoderNull=function(){var t=new Fo;return t._setTagNumber(5),t._tagClass=0,t._setValue(new Uint8Array(0)),t},e.prototype._getAbstractSyntax=function(){var e=new Fo(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.sequence),i=[new Fo(t._TagClassType.universal,t._ConstructionType.primitive,6)];return e._setSequence(i),e},e}(),Do=function(){function e(t,e){this._data=new Uint8Array(0),this._extraBits=0,this._table=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],t&&t.length>0&&(this._data=t,this._extraBits="number"==typeof e?e:0)}return e.prototype._fromAbstractSyntaxOctets=function(t){return new e(t.subarray(1),t[0])},e.prototype._getBytes=function(){return this._data},e.prototype._getUniqueEncoded=function(){var t=new Uint8Array(this._data.length+1);return t[0]=this._extraBits,t.set(this._data,1),t},e.prototype._equals=function(t){if(!(t instanceof e))return!1;if(this._extraBits!==t._extraBits)return!1;if(this._data.length!==t._data.length)return!1;for(var i=0;i<this._data.length;i++)if(this._data[i]!==t._data[i])return!1;return!0},e.prototype._getUniqueBitStringFromTag=function(t,i){var r=t._getInner(),n=new e;return i||r instanceof e?n._getUniqueBitString(r):n._fromAbstractSyntaxOctets(r._getOctetString())},e.prototype._getUniqueBitString=function(t){if(null===t||void 0===t)return null;if(t instanceof e)return t;throw new Error("Invalid Entry")},e.prototype._getAbstractSyntax=function(){var e=new Fo(t._TagClassType.universal,t._ConstructionType.primitive,t._UniversalType.bitString);return e._setValue(this._getUniqueEncoded()),e},e}(),Bo=function(){function t(t,e){t&&e&&(this._algorithms=t,this._publicKey=e)}return t.prototype._fromAbstractSyntax=function(e){var i=e._getSequence();if(!Array.isArray(i)||2!==i.length)throw new Error("Invalid length in sequence");return new t((new Io)._getAlgorithms(i[0]),(new Do)._fromAbstractSyntaxOctets(i[1]._getValue()))},t.prototype._getPublicKeyInformation=function(e){return e instanceof t?e:e&&e._getSequence()?this._fromAbstractSyntax(e):void 0},t}(),Lo=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)}}(),Oo=function(e){function i(i,r,n,s){void 0===i&&(i=t._TagClassType.universal),void 0===r&&(r=t._ConstructionType.primitive),void 0===n&&(n=t._UniversalType.endOfContent),void 0===s&&(s=void 0);var a=e.call(this)||this;return a._lengthEncodingPreference=t._EncodingLength.definite,a._value=new Uint8Array(0),a._period=".".charCodeAt(0),a._comma=",".charCodeAt(0),a._z="Z".charCodeAt(0),a._plus="+".charCodeAt(0),a._minus="-".charCodeAt(0),a._encode(s),a._tagClass=i,a._construction=r,a._setTagNumber(n),a}return Lo(i,e),i.prototype._getValue=function(){if(this._value instanceof Uint8Array)return this._value;var t=this._encodeSequence(this._value);return this._value=t,t},i.prototype._setValue=function(t){this._currentValueLength=t.length,this._value=t},i.prototype._getBooleanValue=function(){if(this._construction!==t._ConstructionType.primitive)throw new Error("boolean cannot be constructed.");return this._decodeBoolean(this._getValue())},i.prototype._setBooleanValue=function(t){this._setValue(this._encodeBoolean(t))},i.prototype._getBitString=function(){if(this._construction===t._ConstructionType.primitive)return this._decodeBitString(this._getValue());if(this._recursionCount+1>this._nestingRecursionLimit)throw new Error;for(var e=[],i=this._getSequence(),r=0,n=i.slice(0,i.length-1);r<n.length;r++){var s=(h=n[r])._getValue();if(h._construction===t._ConstructionType.primitive&&s.length>0&&0!==s[0])throw new Error("Only the final part of a multi-part bit string may start with a non-zero value.")}for(var a=0,o=i;a<o.length;a++){var h=o[a];if(h._tagClass!==this._tagClass)throw new Error("Invalid tag class in recursively-encoded bit string.");if(h._getTagNumber()!==this._getTagNumber())throw new Error("Invalid tag class in recursively-encoded bit string.");h._recursionCount=this._recursionCount+1,e.push.apply(e,Array.from(h._getBitString()).map(function(t){return 0!==t}))}return new Uint8ClampedArray(e.map(function(t){return t?1:0}))},i.prototype._setBitString=function(t){this._setValue(this._encodeBitString(t))},i.prototype._getOctetString=function(){return this._serialize("OCTET STRING")},i.prototype._setOctetString=function(t){this._setValue(new Uint8Array(t))},i.prototype._getObjectDescriptor=function(){var t=this._serialize("ObjectDescriptor");return this._decodeObjectDescriptor(t)},i.prototype._setObjectDescriptor=function(t){this._setValue(this._encodeObjectDescriptor(t))},i.prototype._getUtf8String=function(){return gi(this._serialize("UTF8String"))},i.prototype._setUtf8String=function(t){this._setValue(f(t))},i.prototype._getSequence=function(){if(this._construction!==t._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodedSequence(this._getValue())},i.prototype._setSequence=function(e){this._construct(e),this._construction=t._ConstructionType.constructed},i.prototype._getAbstractSetValue=function(){var t=this._getSequence();if(!this._isUniquelyTagged(t))throw new Error("Duplicate tag in Set.");return t},i.prototype._setAbstractSetValue=function(t){this._setSequence(t)},i.prototype._getSequenceOf=function(){if(this._construction!==t._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodedSequence(this._getValue())},i.prototype._setSequenceOf=function(e){this._construct(e),this._construction=t._ConstructionType.constructed},i.prototype._getAbstractSetOf=function(){return this._getSequence()},i.prototype._setAbstractSetOf=function(t){this._setSequence(t)},i.prototype._getNumericString=function(){var t=this._serialize("NumericString");return this._decodeNumericString(t)},i.prototype._setNumericString=function(t){this._setValue(this._encodeNumericString(t))},i.prototype._getPrintableString=function(){var t=this._serialize("PrintableString");return this._decodePrintableString(t)},i.prototype._setPrintableString=function(t){this._setValue(this._encodePrintableString(t))},i.prototype._getTeleprinterText=function(){return this._serialize("TeletexString")},i.prototype._setTeleprinterText=function(t){this._setValue(new Uint8Array(t))},i.prototype._getVideoTextInformation=function(){return this._serialize("VideotexString")},i.prototype._setVideoTextInformation=function(t){this._setValue(new Uint8Array(t))},i.prototype._getInternationalAlphabetString=function(){return gi(this._serialize("IA5String"))},i.prototype._setInternationalAlphabetString=function(t){this._setValue(f(t))},i.prototype._getGraphicString=function(){var t=this._serialize("GraphicString");return this._decodeGraphicString(t)},i.prototype._setGraphicString=function(t){this._setValue(this._encodeGraphicString(t))},i.prototype._getVisibleString=function(){return this._decodeVisibleString(this._getValue())},i.prototype._setVisibleString=function(t){this._setValue(this._encodeVisibleString(t))},i.prototype._getGeneralString=function(){var t=this._serialize("GeneralString");return this._decodeGeneralString(t)},i.prototype._setCharacterString=function(e){this._setValue(this._encodeCharacterString(e)),this._construction=t._ConstructionType.constructed},i.prototype._getUniversalString=function(){var t=this._serialize("UniversalString");if(t.length%4)throw new Error("Unicode string encoded on non-mulitple of four bytes.");for(var e="",i=0;i<t.length;i+=4)e+=String.fromCharCode((t[i+0]<<24)+(t[i+1]<<16)+(t[i+2]<<8)+(t[i+3]<<0));return e},i.prototype._setUniversalString=function(t){for(var e=new Uint8Array(t.length<<2),i=0;i<t.length;i++)e[i<<2]=t.charCodeAt(i)>>>24,e[1+(i<<2)]=t.charCodeAt(i)>>>16,e[2+(i<<2)]=t.charCodeAt(i)>>>8,e[3+(i<<2)]=t.charCodeAt(i);this._setValue(e)},i.prototype._getBmpString=function(){var t=this._serialize("BMPString");if(t.length%2!=0)throw new Error("BMPString encoded on non-multiple of two bytes.");if("undefined"!=typeof TextDecoder)return new TextDecoder("utf-16be").decode(t);for(var e="",i=0;i<t.length;i+=2){var r=t[i]<<8|t[i+1];e+=String.fromCharCode(r)}return e},i.prototype._setBmpString=function(t){for(var e=new Uint8Array(t.length<<1),i=0;i<t.length;i++){var r=t.charCodeAt(i);e[i<<1]=r>>>8,e[1+(i<<1)]=255&r}this._setValue(e)},i.prototype._construct=function(t){this._currentValueLength=void 0,this._value=t},i.prototype._encode=function(e){switch(typeof e){case"undefined":this._setValue(new Uint8Array(0));break;case"boolean":this._setTagNumber(t._UniversalType.abstractSyntaxBoolean),this._setBooleanValue(e);break;case"number":Number.isInteger(e)&&(this._setTagNumber(t._UniversalType.integer),this._setInteger(e));break;case"string":this._setTagNumber(t._UniversalType.utf8String),this._setUtf8String(e);break;case"object":if(e)if(e instanceof Uint8Array)this._setTagNumber(t._UniversalType.octetString),this._setOctetString(e);else if(e instanceof Uint8ClampedArray)this._setTagNumber(t._UniversalType.bitString),this._setBitString(e);else if(e instanceof ko)this._construction=t._ConstructionType.constructed,this._setSequence([e]);else if(Array.isArray(e)&&e.every(function(t){return t instanceof ko}))this._construction=t._ConstructionType.constructed,this._setAbstractSetValue(Array.from(e));else if(e instanceof Co)this._setTagNumber(t._UniversalType.objectIdentifier),this._setObjectIdentifier(e);else{if(!Array.isArray(e))throw new Error("Cannot encode value of type "+e.constructor.name+".");this._construction=t._ConstructionType.constructed,this._setTagNumber(t._UniversalType.sequence),this._setSequence(e.map(function(t){var e=new i;return e._encode(t),e}))}else this._setTagNumber(t._UniversalType.nullValue),this._setValue(new Uint8Array(0));break;default:throw new Error("Cannot encode value of type "+typeof e+".")}},i.prototype._fromBerSequence=function(e){var r=new i(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.sequence);return r._setSequence(e.filter(function(t){return Boolean(t)})),r},i.prototype._fromSet=function(e){var r=new i(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.abstractSyntaxSet);return r._setAbstractSetValue(e.filter(function(t){return Boolean(t)})),r},i.prototype._fromSetOf=function(e){var r=new i(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.abstractSyntaxSet);return r._setAbstractSetOf(e.filter(function(t){return Boolean(t)})),r},i.prototype._getInner=function(e){if(this._construction!==t._ConstructionType.constructed)throw new Error("An explicitly-encoded element cannot be encoded using primitive construction.");if(Array.isArray(this._value)){if(1!==this._value.length)throw new Error("An explicitly-encoding element contained "+this._value.length+" encoded elements.");return this._value[0]}var r=new i,n=r._fromBytes(this._value);if(n!==this._value.length&&!e)throw new Error("An explicitly-encoding element contained more than one single encoded element. The tag number of the first decoded element was "+r._getTagNumber()+", and it was encoded on "+n+" bytes.");return r},i.prototype._setInner=function(e){this._construction=t._ConstructionType.constructed,this._value=[e]},i.prototype._fromBytes=function(e){if(e.length<2)throw new Error("Tried to decode a BER element that is less than two bytes.");if(this._recursionCount+1>this._nestingRecursionLimit)throw new Error;var r=0,n=e[r];switch(192&n){case 0:this._tagClass=t._TagClassType.universal;break;case 64:this._tagClass=t._TagClassType.application;break;case 128:this._tagClass=t._TagClassType.context;break;case 192:this._tagClass=t._TagClassType.abstractSyntaxPrivate}this._construction=32&n?t._ConstructionType.constructed:t._ConstructionType.primitive;var s=31&n;if(r++,s>=31){if(r>=e.length)throw new Error("ASN1 tag number appears to have been truncated.");if(128===e[r])throw new Error("Leading padding byte on long tag number encoding.");s=0;for(var a=!0;a;){if(r>=e.length)throw new Error("ASN1 tag number appears to have been truncated.");var o=e[r++];s=s<<7|127&o,0==(128&o)&&(a=!1)}if(s<31)throw new Error("ASN1 tag number could have been encoded in short form.");this._setTagNumber(s)}else this._setTagNumber(s);if(r>=e.length)throw new Error("Element length bytes appear to have been truncated.");var h=e[r++];if(128==(128&h)){var c=127&h;if(0===c){if(this._construction!==t._ConstructionType.constructed)throw new Error("Invalid format: indefinite-length elements must be constructed, not primitive.");for(var _=r,d=r;d<e.length;){var u=new i;if(d+=u._fromBytes(e.subarray(d)),u._tagClass===t._TagClassType.universal&&u._construction===t._ConstructionType.primitive&&u._getTagNumber()===t._UniversalType.endOfContent&&0===u._getValue().length)break}if(d===e.length&&(0!==e[d-1]||0!==e[d-2]))throw new Error("Invalid format: indefinite-length ASN1 elements must end with an End-of-Content marker");return this._setValue(e.slice(_,d-2)),d}var l=c;if(r+l>e.length)throw new Error("Element length bytes appear to have been truncated.");for(var f=0,p=0;p<l;p++)f=f<<8|e[r+p];if((r+=l)+f<r)throw new Error("ASN1 element too large.");if(r+f>e.length)throw new Error("ASN1 element truncated.");return this._setValue(e.slice(r,r+f)),r+f}var g=127&h;if(r+g>e.length)throw new Error("ASN1 element was truncated.");return this._setValue(e.slice(r,r+g)),r+g},i.prototype._lengthLength=function(e){if(this._lengthEncodingPreference===t._EncodingLength.indefinite)return 1;var i=null!==e&&void 0!==e?e:this._valueLength();if(i<128)return 1;for(var r=0,n=i;n>0;)r++,n>>>=8;return 1+r},i.prototype._valueLength=function(){if(void 0!==this._currentValueLength&&null!==this._currentValueLength&&!Array.isArray(this._value))return this._currentValueLength;if(!Array.isArray(this._value)){var t=this._getValue();return this._currentValueLength=t.length,t.length}for(var e=0,i=0,r=this._value;i<r.length;i++)e+=r[i]._tagValueLength();return this._currentValueLength=e,e},i.prototype._tagAndLengthBytes=function(){var e=[0];e[0]|=this._tagClass<<6,e[0]|=this._lengthEncodingPreference===t._EncodingLength.indefinite||this._construction===t._ConstructionType.constructed?32:0;var i=this._getTagNumber();if(i<31)e[0]|=i;else{e[0]|=31;var r=i,n=[];do{n.unshift(127&r),r>>>=7}while(r>0);for(var s=0;s<n.length-1;s++)n[s]|=128;e.push.apply(e,n)}var a=[],o=this._valueLength();switch(this._lengthEncodingPreference){case t._EncodingLength.definite:if(o<128)a=[o];else{for(var h=[],c=o;c>0;)h.unshift(255&c),c>>>=8;a=[128|h.length].concat(h)}break;case t._EncodingLength.indefinite:a=[128];break;default:throw new Error("An unsupported length encoding preference was detected")}var _=new Uint8Array(e.length+a.length);return _.set(e,0),_.set(a,e.length),_},i.prototype._toBuffers=function(){var e=[];if(e.push(this._tagAndLengthBytes()),Array.isArray(this._value))for(var i=0,r=this._value;i<r.length;i++)for(var n=0,s=r[i]._toBuffers();n<s.length;n++){var a=s[n];e.push(a)}else e.push(this._value);return this._lengthEncodingPreference===t._EncodingLength.indefinite&&e.push(new Uint8Array(2)),e},i.prototype._serialize=function(e){if(this._construction===t._ConstructionType.primitive)return this._getValue();if(this._recursionCount+1>this._nestingRecursionLimit)throw new Error("Exceeded recursion limit while deconstructing "+e);for(var i=[],r=this._getSequence(),n=this._getTagNumber(),s=0,a=r;s<a.length;s++){var o=a[s];if(n===t._UniversalType.octetString){if(o._tagClass!==t._TagClassType.universal||o._getTagNumber()!==t._UniversalType.octetString)throw new Error("Invalid constructed OCTET STRING: children must be OCTET STRING (tag 4).")}else if(o._tagClass!==this._tagClass||o._getTagNumber()!==n)throw new Error("Invalid constructed "+e+": children must be of the same type as the parent.");o._recursionCount=this._recursionCount+1,i.push(o._getValue())}for(var h=i.reduce(function(t,e){return t+e.length},0),c=new Uint8Array(h),_=0,d=0,u=i;d<u.length;d++){var l=u[d];c.set(l,_),_+=l.length}return c},i.prototype._getComponents=function(){if(Array.isArray(this._value))return this._value;for(var t=[],e=0;e<this._value.length;){var r=new i;e+=r._fromBytes(this._getValue().subarray(e)),t.push(r)}return t},i.prototype._decodeBitString=function(t){if(0===t.length)throw new Error("ASN1 Bit String cannot be encoded on zero bytes!");if(1===t.length&&0!==t[0])throw new Error("ASN1 Bit String encoded with deceptive first byte!");if(t[0]>7)throw new Error("First byte of an ASN1 Bit String must be <= 7!");for(var e=[],i=1;i<t.length;i++){var r=t[i];e.push(128&r?1:0,64&r?1:0,32&r?1:0,16&r?1:0,8&r?1:0,4&r?1:0,2&r?1:0,1&r?1:0)}return e.length-=t[0],new Uint8ClampedArray(e)},i.prototype._decodeBoolean=function(t){if(1!==t.length)throw new Error("Invalid Boolean format: Boolean values must be exactly one byte.");return 0!==t[0]},i.prototype._decodedSequence=function(t){for(var e=[],r=0;r<t.length;){var n=new i;r+=n._fromBytes(t.subarray(r)),e.push(n)}return e},i.prototype._getRealEncodingBase=function(e){switch(48&e){case t._RealEncodingBase.base2:return 2;case t._RealEncodingBase.base8:return 8;case t._RealEncodingBase.base16:return 16;default:throw new Error("Impossible real encoding base encountered.")}},i.prototype._encodeCharacterString=function(e){return this._encodeSequence([e._identification,new Fo(t._TagClassType.universal,t._ConstructionType.primitive,t._UniversalType.octetString,e._stringValue)])},i.prototype._decodeSequence=function(t){if(0===t.length)return[];for(var e=[],i=0;i<t.length;){var r=new Fo;i+=r._fromBytes(t.subarray(i)),e.push(r)}return e},i.prototype._fromSequence=function(e){var i=new Fo(t._TagClassType.universal,t._ConstructionType.constructed,t._UniversalType.sequence);return i._setSequence(e.filter(function(t){return Boolean(t)})),i},i.prototype._getExternalEncoding=function(t){switch(t._getTagNumber()){case 0:return t._getInner();case 1:return t._getOctetString();case 2:return t._getBitString();default:throw new Error("external does not know of an encoding option having tag number "+t._getTagNumber()+".")}},i.prototype._tagValueLength=function(){var t=this._valueLength();return this._tagLength()+this._lengthLength(t)+t},i}(ko);!function(t){t[t.definite=0]="definite",t[t.indefinite=1]="indefinite"}(t._EncodingLength||(t._EncodingLength={}));var Mo=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)}}(),Eo=function(){function t(t){this._isPrivate=t}return t}(),No=function(t){function e(e,i,r){var n=t.call(this,e)||this;return n._modulus=i,n._exponent=r,n}return Mo(e,t),e}(Eo),jo=function(){function t(t,e){this._value=e,this._critical=t}return t}(),Vo=function(){function t(t,e){if(this._extensions=new Map,this._ordering=[],this._authorityKeyIdentifier=(new Co)._fromString("2.5.29.35"),this._certificateRevocationListPoints=(new Co)._fromString("2.5.29.31"),this._authorityInfoAccess=(new Co)._fromString("1.3.6.1.5.5.7.1.1"),t||e){var i=[];t.forEach(function(t,e){i.push(e)}),this._ordering=null!=e?e:i;for(var r=0,n=this._ordering;r<n.length;r++){var s=n[r],a=t.get(s);a&&this._extensions.set(s,a)}}}return t.prototype._fromSequence=function(e){for(var i=new Map,r=0,n=e;r<n.length;r++){var s=n[r]._getSequence();if(!s||s.length<2||s.length>3)throw new Error("Bad sequence size");var a=s[0]._getObjectIdentifier().toString(),o=3===s.length&&s[1]._getBooleanValue(),h=s[s.length-1];i.set(a,new jo(o,h))}return new t(i)},t.prototype._getInstance=function(e){if(e instanceof t)return e;if(e instanceof ko){var i=new t,r=e._getSequence();return i._fromSequence(r[0]._getSequence())}throw new Error("Unknown object in factory")},t.prototype._getExtension=function(t){var e=t._encoding.toString().replace(/,/g,"."),i=this._extensions.get(e);return i||null},t}(),zo=function(){function t(){}return t.prototype._getExtension=function(t){var e=this._getExtensions();if(e){var i=e._getExtension(t);return i?i._value:null}return null},t}(),Uo=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)}}(),Ho=function(e){function i(i){var r=e.call(this)||this;r._keyUsage=[],r._structure=i;var n=(new Co)._fromString("2.5.29.15"),s=r._getExtension(n);if(s){var a=s._getValue(),o=yi(a)?new Oo:new Fo;o._fromBytes(a);var h=(o._construction===t._ConstructionType.constructed?o._getInner():o)._getValue(),c=h[0],_=h.slice(1),d=8*_.length-c;r._keyUsage=Array.from({length:Math.max(9,d)},function(t,e){return 0!=(_[Math.floor(e/8)]&128>>e%8)})}else r._keyUsage=null;return r}return Uo(i,e),i.prototype._getExtensions=function(){var t=this._structure._getSignedCertificate();return 3===t._getVersion()?t._extensions:new Vo},i.prototype._getPublicKey=function(){var t=this._structure._getSignedCertificate();return this._createKey(t._publicKeyInformation)},i.prototype._createKey=function(t){var e=t._algorithms._objectID.toString(),i=new Fo;if(i._fromBytes(t._publicKey._getBytes()),this._publicKeyBytes=t._publicKey._data,"1.2.840.113549.1.1.1"===e)return this._parsePublicKey(i);throw new Error("Unsupported Algorithm")},i.prototype._parsePublicKey=function(t){var e=t._getSequence();if(!e||e.length<2)throw new Error("Invalid RSA public key structure");var i=e[0]._getValue(),r=e[1]._getValue();return new No(!0,i,r)},i.prototype._getTobeSignedCertificate=function(){return this._structure._getSignedCertificate()._getDistinguishEncoded()},i.prototype._getEncoded=function(){return this._structure._getDerEncoded()},i.prototype._getEncodedString=function(){return this._getEncoded()},i}(zo),Wo=function(){function t(t){this._hashValueSet=!1,this._certificate=t}return t}(),qo=function(){function t(t){var e=this;this._ordering=[],this._values=[],this._added=[],this._countryNameOid="2.5.4.6",this._organizationNameOid="2.5.4.10",this._organizationalUnitNameOid="2.5.4.11",this._titleOid="2.5.4.12",this._commonNameOid="2.5.4.3",this._sequence=t,this._defaultSymbols=new Map([[this._countryNameOid,"C"],[this._organizationNameOid,"O"],[this._organizationalUnitNameOid,"OU"],[this._titleOid,"T"],[this._commonNameOid,"CN"]]),t.forEach(function(t){t&&t._getSequence().forEach(function(t,i){var r=[];if(t&&(r=t._getSequence()),r&&r.length>=2){var n=(new Co)._fromBytes(r[0]._getValue());e._ordering.push(n);var s=r[1],a="";(s instanceof Fo||s instanceof Oo)&&(a=v(s._getOctetString())),e._values.push(a),e._added.push(0!==i)}})})}return t}(),Go=function(){function t(t){this._time=t}return t.prototype._getUniversalTime=function(){if(23===this._time._getTagNumber()){var t=this._time._getValue();if("string"==typeof t)return t.trim();if(t instanceof Uint8Array){for(var e=[],i=0;i<t.length;i++)e.push(t[i]);return String.fromCharCode.apply(null,e).trim()}}},t.prototype._toDate=function(){var t=this._getUniversalTime();if(t){var e=t.match(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z$/);if(e||(e=t.match(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z$/)),e){var i=parseInt(e[1],10);i+=i<50?2e3:1900;var r=parseInt(e[2],10)-1,n=parseInt(e[3],10),s=parseInt(e[4],10),a=parseInt(e[5],10),o=e.length>6&&void 0!==e[6]?parseInt(e[6],10):0;return new Date(Date.UTC(i,r,n,s,a,o))}}},t}(),Ko=function(){function e(t){this._sequence=t._getSequence();var e=0;0===this._sequence[0]._getTagNumber()&&2===this._sequence[0]._tagClass?this._version=2:(e=-1,this._version=0),this._serialNumber=this._sequence[e+1]._getValue(),this._signature=new Io(this._sequence[e+2]),this._issuer=new qo(this._sequence[e+3]._getSequence());var i=this._sequence[e+4]._getSequence();this._startDate=new Go(i[0]),this._endDate=new Go(i[1]),this._subject=new qo(this._sequence[e+5]._getSequence()),this._publicKeyInformation=(new Bo)._getPublicKeyInformation(this._sequence[e+6]);for(var r=e+6,n=this._sequence.length-1;n>r;n--){var s=this._sequence[n],a=new Do;switch(s._getTagNumber()){case 1:this._issuerID=a._getUniqueBitStringFromTag(s,!1);break;case 2:this._subjectID=a._getUniqueBitStringFromTag(s,!1);break;case 3:this._extensions=(new Vo)._getInstance(s)}}}return e.prototype._getVersion=function(){return this._version+1},e.prototype._getDistinguishEncoded=function(){var e=new Fo;return e._tagClass=t._TagClassType.universal,e._construction=t._ConstructionType.constructed,e._setTagNumber(t._UniversalType.sequence),e._setSequence(this._sequence),e._toBytes()},e}(),Xo=function(){function e(t){if(t){if(!Array.isArray(t)||3!==t.length)throw new Error("Invalid certificate sequence length: "+t.length);this._sequence=t,this._toBeSignedCertificate=new Ko(t[0]),this._signatureAlgorithmIdentifier=new Io(t[1]),this._signature=new Do(t[2]._getValue())}}return e.prototype._getSignedCertificate=function(){return this._toBeSignedCertificate},e.prototype._getInstance=function(t){return Array.isArray(t)&&t.every(function(t){return t instanceof ko})?new e(t):null},e.prototype._getDerEncoded=function(){var e=new Fo;return e._tagClass=t._TagClassType.universal,e._construction=t._ConstructionType.constructed,e._setTagNumber(t._UniversalType.sequence),e._setSequence(this._sequence),e._toBytes()},e}(),Jo=function(){function e(){this._sDataObjectCount=0}return e.prototype._readDistinguishEncoderCertificate=function(e,i){var r=new Xo,n=new Oo;n._fromBytes(e);var s=n._getSequence(),a=s[0]._getTagNumber();if(s.length>1&&a===t._UniversalType.objectIdentifier&&"1.2.840.113549.1.7.2"===s[0]._getObjectIdentifier()._getDotDelimitedNotation()){if(s.length>=2)for(var o=0,h=s[1]._getInner()._getSequence();o<h.length;o++){var c=h[o];if(c instanceof Oo&&c._tagClass===t._TagClassType.context&&0===c._getTagNumber()){var _=c._getInner(i),d=void 0;d=i?_._getSequence():_._getAbstractSetValue(),this._sData=d;break}}return this._getCertificate(i)}return this._createX509Certificate(r._getInstance(s))},e.prototype._getCertificate=function(e){var i=new Xo;if(this._sData){if(e)return this._createX509Certificate(i._getInstance(this._sData));for(;this._sDataObjectCount<this._sData.length;){var r=this._sData[this._sDataObjectCount++];if(r._getTagNumber()===t._UniversalType.sequence)return this._createX509Certificate(i._getInstance(r._getSequence()))}}return null},e.prototype._createX509Certificate=function(t){return new Ho(t)},e.prototype._readCertificate=function(t,e){return void 0===e&&(e=!1),this._readCertificateFromStream(t,e)},e.prototype._readCertificateFromStream=function(t,e){if(!t||0===t.length)throw new Error("Input stream is empty or null");return this._currentStream!==t&&(this._currentStream=t,this._sData=null,this._sDataObjectCount=0),this._sData&&this._sDataObjectCount<this._sData.length?this._getCertificate():t[0]<0?null:this._readDistinguishEncoderCertificate(t,e)},e}(),Yo=function(){function t(t,e){if(void 0===e&&(e=!0),this._blockSize=8,this._isEncryption=!0,this._sp1=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],this._sp2=[2148565024,2147516416,32768,1081376,1048576,32,2148532256,2147516448,2147483680,2148565024,2148564992,2147483648,2147516416,1048576,32,2148532256,1081344,1048608,2147516448,0,2147483648,32768,1081376,2148532224,1048608,2147483680,0,1081344,32800,2148564992,2148532224,32800,0,1081376,2148532256,1048576,2147516448,2148532224,2148564992,32768,2148532224,2147516416,32,2148565024,1081376,32,32768,2147483648,32800,2148564992,1048576,2147483680,1048608,2147516448,2147483680,1048608,1081344,0,2147516416,32800,2147483648,2148532256,2148565024,1081344],this._sp3=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],this._sp4=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],this._sp5=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],this._sp6=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],this._sp7=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],this._sp8=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],!(t instanceof Uint8Array)||16!==t.length&&24!==t.length)throw new Error("Triple DES key must be 16 or 24 bytes.");this._isEncryption=e;var i=t.subarray(0,8),r=t.subarray(8,16),n=24===t.length?t.subarray(16,24):i;this._key1=this._generateWorkingKey(e,i),this._key2=this._generateWorkingKey(!e,r),this._key3=this._generateWorkingKey(e,n)}return t.prototype._beToUint32=function(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0},t.prototype._uint32ToBe=function(t,e,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t},t.prototype._generateWorkingKey=function(t,e){for(var i=[128,64,32,16,8,4,2,1],r=[8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1],n=[56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3],s=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],a=[13,16,10,23,0,4,2,27,14,5,20,9,22,18,11,3,25,7,15,6,26,19,12,1,40,51,30,36,46,54,29,39,50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31],o=new Int32Array(32),h=new Array(56).fill(!1),c=new Array(56).fill(!1),_=0;_<56;_++){var d=n[_];h[_]=0!=(e[d>>3]&i[7&d])}for(p=0;p<16;p++){var u=t?p<<1:15-p<<1,l=u+1;o[u]=o[l]=0;for(_=0;_<28;_++){f=_+s[p];c[_]=f<28?h[f]:h[f-28]}for(_=28;_<56;_++){var f=_+s[p];c[_]=f<56?h[f]:h[f-28]}for(_=0;_<24;_++)c[a[_]]&&(o[u]|=r[_]),c[a[_+24]]&&(o[l]|=r[_])}for(var p=0;32!==p;p+=2){var g=o[p],y=o[p+1];o[p]=(16515072&g)<<6|(4032&g)<<10|(16515072&y)>>>10|(4032&y)>>>6,o[p+1]=(258048&g)<<12|(63&g)<<16|(258048&y)>>>4|63&y}return o},t.prototype._processEncryptionBlock=function(t,e,i,r,n){var s=this._beToUint32(e,i)>>>0,a=this._beToUint32(e,i+4)>>>0,o=252645135&(s>>>4^a);a^=o,a^=o=65535&((s^=o<<4)>>>16^a),a^=(o=858993459&(a>>>2^(s^=o<<16)))<<2,a=((a^=(o=16711935&(a>>>8^(s^=o)))<<8)<<1|a>>>31)>>>0,a^=o=2863311530&((s^=o)^a),s=((s^=o)<<1|s>>>31)>>>0;for(var h=0;h<8;h++){o=(a<<28|a>>>4)>>>0,o^=t[4*h+0];var c=this._sp7[63&o]|this._sp5[o>>>8&63]|this._sp3[o>>>16&63]|this._sp1[o>>>24&63];o=(a^t[4*h+1])>>>0,o=((s^=c|=this._sp8[63&o]|this._sp6[o>>>8&63]|this._sp4[o>>>16&63]|this._sp2[o>>>24&63])<<28|s>>>4)>>>0,o^=t[4*h+2],c=this._sp7[63&o]|this._sp5[o>>>8&63]|this._sp3[o>>>16&63]|this._sp1[o>>>24&63],o=(s^t[4*h+3])>>>0,a^=c|=this._sp8[63&o]|this._sp6[o>>>8&63]|this._sp4[o>>>16&63]|this._sp2[o>>>24&63]}s=((s^=o=2863311530&(s^(a=(a<<31|a>>>1)>>>0)))<<31|s>>>1)>>>0,s^=(o=16711935&(s>>>8^(a^=o)))<<8,s^=(o=858993459&(s>>>2^(a^=o)))<<2,s^=o=65535&((a^=o)>>>16^s),s^=o=252645135&((a^=o<<16)>>>4^s),a^=o<<4,this._uint32ToBe(a,r,n),this._uint32ToBe(s,r,n+4)},t.prototype._processBlock=function(t,e,i,r){var n=this._blockSize,s=new Uint8Array(n);return this._isEncryption?(this._processEncryptionBlock(this._key1,t,e,s,0),this._processEncryptionBlock(this._key2,s,0,s,0),this._processEncryptionBlock(this._key3,s,0,i,r)):(this._processEncryptionBlock(this._key3,t,e,s,0),this._processEncryptionBlock(this._key2,s,0,s,0),this._processEncryptionBlock(this._key1,s,0,i,r)),n},t}(),Qo=function(){function e(t,e){this._certificateChain=[],this._keys=new Map,this._localIdentifiers=new Map,this._data="1.2.840.113549.1.7.1",this._encryptedData="1.2.840.113549.1.7.6",this._certificateBag="1.2.840.113549.1.12.10.1.3",this._shroudedKeyBag="1.2.840.113549.1.12.10.1.2",this._keyBag="1.2.840.113549.1.12.10.1.1",this._attributes={},this._certificates=new Po,this._isUnMarkedKey=!1,t&&t.length>0&&null!==e&&this._loadCertificate(t,e)}return e.prototype._createSubjectKeyID=function(t,e){if(t instanceof No){var i=new Io;i._objectID=(new Co)._fromString("1.2.840.113549.1.1.1"),i._parameters=i._getUniqueEncoderNull(),i._parametersDefined=!0;var r=new Do(e,0),n=new Bo(i,r);return new To(n)}throw new Error("Invalid Key: "+t)},e.prototype._loadCertificate=function(t,e){if(!t||0===t.length)throw new Error("input is null");if(!e)throw new Error("password is null");var i=new Fo;i._fromBytes(t);var r=i._getSequence()[1]._getSequence()[1]._getSequence(),n=r&&r[0];if(!n||!n._getOctetString())throw new Error("Missing or invalid content octets");var s=n._getOctetString(),a=yi(s)?new Oo:new Fo;a._fromBytes(s);for(var o=0,h=a._getSequence();o<h.length;o++){var c=h[o]._getSequence(),_=c[0]._getObjectIdentifier().toString();if(_===this._data){var d=c[1];(l=d._getSequence()&&d._getSequence()[0])&&this._processData(l,e)}else if(_===this._encryptedData){var u=c[1],l=u._getSequence()?u._getSequence()[0]:void 0;this._processEncryptedData(l,e)}}this._certificateChain&&this._certificateChain.length>0&&this._processCertificateCollection(this._certificateChain)},e.prototype._processCertificateCollection=function(t){this._certificates=new Po,this._chainCertificates=new Map,this._keyCertificates=new Map;for(var e=0,i=t;e<i.length;e++){var r=i[e],n=r._getSequence()[1]._getSequence()[0]._getSequence()[1]._getSequence()[0]._getValue();if(n){var s=(new Jo)._readCertificate(n);if(s){var a={},o=void 0,h=void 0,c=De(r);if(c){var _=void 0;try{c&&(_=c._getAbstractSetValue())}catch(t){c&&(_=c._getSequence())}for(var d=0,u=_;d<u.length;d++){var l=u[d]._getSequence();if(l&&!(l.length<2)){var f=l[0]._getObjectIdentifier().toString(),p=void 0!==l[1]._getAbstractSetValue()&&null!==l[1]._getAbstractSetValue()?l[1]._getAbstractSetValue():l[1]._getSequence();if(p&&0!==p.length){var g=p[0];if(a[f]){if(JSON.stringify(a[f])!==JSON.stringify(g))throw new Error("attempt to add existing attribute with different value")}else a[f]=g;"1.2.840.113549.1.9.20"===f?h=g._getBmpString():"1.2.840.113549.1.9.21"===f&&(o=g._getOctetString())}}}}var y=new xo({pubicKey:s._getPublicKey(),id:s._publicKeyBytes}),m=new Wo(s);if(this._chainCertificates.set(y,m),this._isUnMarkedKey){var b=Qe(y._identifier);this._keyCertificates.set(b,m);var v=this._keys.get("unmarked");this._keys.delete("unmarked"),this._keys.set("name",v)}else{if(o){var w=Qe(o);this._keyCertificates.set(w,m)}h&&this._certificates._setValue(h,m)}}}}},e.prototype._processData=function(t,e){var i=t._getOctetString();if(i){var r=yi(i)?new Oo:new Fo;r._fromBytes(i);for(var n=0,s=r._getSequence();n<s.length;n++){var a=s[n],o=a._getSequence(),h=o[0]._getObjectIdentifier().toString();if("1.2.840.113549.1.12.10.1.2"===h){var c=o[1]._getSequence()[0]._getSequence(),_=c[0]._getSequence(),d=c[1]._getOctetString(),u=this._getCryptographicData(_,d,e),l=yi(i)?new Oo:new Fo;l._fromBytes(u);var f=l._getSequence(),p=f[1]._getSequence()[0]._getObjectIdentifier().toString(),g=f[2]._getOctetString(),y=void 0;if("1.2.840.113549.1.1.1"===p){var m=this._parsePrivateKey(g);y=this._createPrivateKey(m.modulus,m.publicExponent,m.privateExponent,m.prime1,m.prime2,m.exponent1,m.exponent2,m.coefficient)}var b=void 0,v=void 0,w={},S=void 0;y&&(S={privateKey:y,attributes:w});var x=(o[2]&&o[2]._getSequence()?o[2]._getSequence():[]).map(function(t){return t});if(x&&x.length>0)for(var P=0,A=x;P<A.length;P++){var T=A[P]._getSequence(),C=T[0]._getObjectIdentifier().toString(),k=T[1]._getAbstractSetValue();if(k&&k.length>0){var R=k[0];if(w[C]&&w[C]!==R)throw new Error("Should not add existing attribute with different value");w[C]=R,"1.2.840.113549.1.9.20"===C?b=R._getBmpString()?R._getBmpString():R._getUtf8String()?R._getUtf8String():"":"1.2.840.113549.1.9.21"===C&&(v=R._getOctetString())}}if(v){var F=Array.from(v).map(function(t){return Ye(t.toString(16),2,"0")}).join("");b?(this._localIdentifiers.set(b,F),this._keys.set(b,S)):this._keys.set(F,S)}else this._isUnMarkedKey=!0,this._keys.set("unmarked",y)}else h===this._certificateBag&&this._certificateChain.push(a)}}},e.prototype._parseAndDecrypt=function(t,e){var i=t._getSequence()[1]._getSequence(),r=i[1]._getSequence(),n=i[2]._getOctetString();return this._getCryptographicData(r,n,e)},e.prototype._decodeDecryptedBytes=function(t){var e=yi(t)?new Oo:new Fo;return e._fromBytes(t),e._getSequence()},e.prototype._handleCertificateBag=function(t){this._certificateChain.push(t)},e.prototype._extractPrivateKeyFromKeyInfo=function(t,e,i){if(i){var r=t._getSequence()[0]._getSequence(),n=r[0]._getSequence(),s=r[1]._getOctetString(),a=this._getCryptographicData(n,s,e),o=yi(a)?new Oo:new Fo;o._fromBytes(a);var h=o._getSequence(),c=h[1]._getSequence()[0]._getObjectIdentifier().toString(),_=h[2]._getOctetString(),d=void 0;if("1.2.840.113549.1.1.1"===c){l=this._parsePrivateKey(_);d=this._createPrivateKey(l.modulus,l.publicExponent,l.privateExponent,l.prime1,l.prime2,l.exponent1,l.exponent2,l.coefficient)}return{privateKey:d,attributesRoot:null}}var u=t._getSequence()[0]._getSequence(),c=u[1]._getSequence()[0]._getObjectIdentifier().toString(),_=u[2]._getOctetString(),d=void 0;if("1.2.840.113549.1.1.1"===c){var l=this._parsePrivateKey(_);d=this._createPrivateKey(l.modulus,l.publicExponent,l.privateExponent,l.prime1,l.prime2,l.exponent1,l.exponent2,l.coefficient)}return{privateKey:d,attributesRoot:null}},e.prototype._extractLocalIdentifiers=function(t){for(var e,i,r=0,n=(t&&t._getSequence()?t._getSequence():[]).map(function(t){return t});r<n.length;r++){var s=n[r]._getSequence(),a=s[0]._getObjectIdentifier().toString(),o=s[1]._getAbstractSetValue();if(o.length>0){var h=o[0];"1.2.840.113549.1.9.20"===a?e=h._getBmpString()?h._getBmpString():h._getUtf8String()?h._getUtf8String():"":"1.2.840.113549.1.9.21"===a&&(i=h._getOctetString())}}return{localIdentifier:e,localId:i}},e.prototype._storeKeyEntry=function(t,e,i){if(e){var r=Array.from(e).map(function(t){return Ye(t.toString(16),2,"0")}).join("");t?(this._localIdentifiers.set(t,r),this._keys.set(t,i)):this._keys.set(r,i)}else this._keys.set("unmarked",i)},e.prototype._handleShroudedKeyBag=function(t,e){var i=t[1]._getSequence()[0]._getSequence(),r=i[0]._getSequence(),n=i[1]._getOctetString(),s=this._getCryptographicData(r,n,e),a=yi(s)?new Oo:new Fo;a._fromBytes(s);var o,h=a._getSequence(),c=h[1]._getSequence()[0]._getObjectIdentifier().toString(),_=h[2]._getOctetString();if("1.2.840.113549.1.1.1"===c){var d=this._parsePrivateKey(_);o=this._createPrivateKey(d.modulus,d.publicExponent,d.privateExponent,d.prime1,d.prime2,d.exponent1,d.exponent2,d.coefficient)}var u=t[2],l=this._extractLocalIdentifiers(u),f=l.localIdentifier,p=l.localId;if(o){var g={privateKey:o,attributes:{}};this._storeKeyEntry(f,p,g)}},e.prototype._handleKeyBag=function(t){var e,i=t[1]._getSequence()[0]._getSequence(),r=i[1]._getSequence()[0]._getObjectIdentifier().toString(),n=i[2]._getOctetString();if("1.2.840.113549.1.1.1"===r){var s=this._parsePrivateKey(n);e=this._createPrivateKey(s.modulus,s.publicExponent,s.privateExponent,s.prime1,s.prime2,s.exponent1,s.exponent2,s.coefficient)}var a=t[2],o=this._extractLocalIdentifiers(a),h=o.localIdentifier,c=o.localId;if(e){var _={privateKey:e,attributes:{}};this._storeKeyEntry(h,c,_)}},e.prototype._processEncryptedData=function(t,e){for(var i=this._parseAndDecrypt(t,e),r=0,n=this._decodeDecryptedBytes(i);r<n.length;r++){var s=n[r],a=s._getSequence(),o=a[0]._getObjectIdentifier().toString();o===this._certificateBag?this._handleCertificateBag(s):o===this._shroudedKeyBag?this._handleShroudedKeyBag(a,e):o===this._keyBag&&this._handleKeyBag(a)}},e.prototype._createPrivateKey=function(t,e,i,r,n,s,a,o){var h=this._uint8ArrayToBigInt(t),c=this._uint8ArrayToBigInt(e),_=this._uint8ArrayToBigInt(i),d=this._uint8ArrayToBigInt(r),u=this._uint8ArrayToBigInt(n),l=this._uint8ArrayToBigInt(s),f=this._uint8ArrayToBigInt(a),p=this._uint8ArrayToBigInt(o);return this._validateValue("publicExponent",c),this._validateValue("p",d),this._validateValue("q",u),this._validateValue("dP",l),this._validateValue("dQ",f),this._validateValue("inverse",p),{modulus:h,publicExponent:c,privateExponent:_,p:d,q:u,dP:l,dQ:f,inverse:p,get PublicExponent(){return c},get P(){return d},get Q(){return u},get DP(){return l},get DQ(){return f},get QInv(){return p},get _isPrivate(){return!0},equals:function(t){return!!t&&(this.dP===t.dP&&this.dQ===t.dQ&&this.privateExponent===t.privateExponent&&this.modulus===t.modulus&&this.p===t.p&&this.q===t.q&&this.publicExponent===t.publicExponent&&this.inverse===t.inverse)},hashCode:function(){return this._extractLow32Bits(this.DP)^this._extractLow32Bits(this.DQ)^this._extractLow32Bits(this.privateExponent)^this._extractLow32Bits(this.modulus)^this._extractLow32Bits(this.P)^this._extractLow32Bits(this.Q)^this._extractLow32Bits(this.PublicExponent)^this._extractLow32Bits(this.QInv)}}},e.prototype._validateValue=function(t,e){if(null===e||void 0===e)throw new Error("RSA parameter '"+t+"' is null or undefined")},e.prototype._uint8ArrayToBigInt=function(t){for(var e=new So("0"),i=0;i<t.length;i++)e._multiply(),e._add(t[i]);return e},e.prototype._getPassword=function(t){for(var e=new Uint8Array(2*(t.length+1)),i=0;i<t.length;++i){var r=t.charCodeAt(i);e[2*i]=r>>8,e[2*i+1]=255&r}return e},e.prototype._getCryptographicData=function(t,e,i){var r=t[0]._getObjectIdentifier().toString(),n=t[1]._getSequence(),s=n[0]._getOctetString(),a=Number(n[1]._getInteger()),o=this._getPassword(i),h={"1.2.840.113549.1.12.1.1":{name:"PBEwithSHA-1and128bitRC4",keySize:16,ivSize:0,cipher:"RC4",hash:"sha1"},"1.2.840.113549.1.12.1.2":{name:"PBEwithSHA-1and40bitRC4",keySize:5,ivSize:0,cipher:"RC4",hash:"sha1"},"1.2.840.113549.1.12.1.3":{name:"PBEwithSHA-1and3-KeyTripleDES-CBC",keySize:24,ivSize:8,cipher:"DESEDE",hash:"sha1"},"1.2.840.113549.1.12.1.4":{name:"PBEwithSHA-1and3-KeyTripleDES-CBC",keySize:24,ivSize:8,cipher:"DESEDE",hash:"sha1"},"1.2.840.113549.1.12.1.5":{name:"PBEwithSHA-1and128bitRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.12.1.6":{name:"PBEwithSHA-1and40bitRC2-CBC",keySize:5,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.5.12":{name:"PBKDF2",keySize:0,ivSize:0,cipher:"AES",hash:"sha1"},"1.2.840.113549.1.5.3":{name:"pbeWithMD5AndDES-CBC",keySize:8,ivSize:8,cipher:"DES",hash:"md5"},"1.2.840.113549.1.5.10":{name:"pbeWithSHA1AndDES-CBC",keySize:8,ivSize:8,cipher:"DES",hash:"sha1"},"1.2.840.113549.1.12.1.8":{name:"PBEwithSHA-1and128bitRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.12.1.9":{name:"PBEwithSHA-1and40bitRC2-CBC",keySize:5,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.5.6":{name:"pbeWithMD5AndRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"md5"},"1.2.840.113549.1.5.11":{name:"pbeWithSHA1AndRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"sha1"}},c={sha1:{hash:function(t){return(new Ao)._hash(t,0,t.length)},u:20,v:64},md5:{hash:function(t){return(new Ra).hash(t,0,t.length)},u:16,v:64}};if(!(r in h))throw new Error("Unsupported oid: "+r);var _,d=h[r],u=c[d.hash],l=this._generateDerivedKey(o,s,1,a,d.keySize,u),f=d.ivSize>0?this._generateDerivedKey(o,s,2,a,d.ivSize,u):void 0,p=e;switch(d.cipher){case"AES":_=new Ia(l)._decryptBlock(p,!0,f);break;case"RC4":_=new Wa(l)._decryptBlock(p);break;case"DESEDE":var g=new Yo(l,!1);if(p.length%8!=0)throw new Error("3DES expects multiples of 8 bytes");for(var y=new Uint8Array(p.length),m=f.slice(),b=0;b<p.length;b+=g._blockSize){var v=p.slice(b,b+g._blockSize);g._processBlock(p,b,y,b);for(var w=0;w<g._blockSize;w++)y[b+w]^=m[w];m=v}_=y;break;case"RC2":_=new Ga(l,8*d.keySize)._decrypt(p,f);break;case"DES":if(p.length%8!=0)throw new Error("DES expects multiples of 8 bytes");for(var S=new Pa(l,!1),x=new Uint8Array(p.length),b=0;b<p.length;b+=8)S._processBlock(p,b,x,b);_=x}return _},e.prototype._generateDerivedKey=function(t,e,i,r,n,s){for(var a=s.u,o=s.v,h=new Uint8Array(o).fill(i),c=e.length?o*Math.ceil(e.length/o):0,_=new Uint8Array(c),d=0;d<c;++d)_[d]=e[d%e.length];for(var u=t.length?o*Math.ceil(t.length/o):0,l=new Uint8Array(u),d=0;d<u;++d)l[d]=t[d%t.length];var f=new Uint8Array(c+u);f.set(_,0),f.set(l,c);for(var p=Math.ceil(n/a),g=new Uint8Array(n),y=0,d=0;d<p;++d){var m=new Uint8Array(h.length+f.length);m.set(h),m.set(f,h.length);for(var b=s.hash(m),v=1;v<r;++v)b=s.hash(b);var w=Math.min(a,n-y);g.set(b.subarray(0,w),y),y+=w;for(var S=new Uint8Array(o),v=0;v<o;++v)S[v]=b[v%b.length];for(v=0;v<f.length/o;++v)this._adjust(f,v*o,S)}return g},e.prototype._adjust=function(t,e,i){var r=i[i.length-1]+t[e+i.length-1]+1;t[e+i.length-1]=255&r,r>>>=8;for(var n=i.length-2;n>=0;--n)r+=i[n]+t[e+n],t[e+n]=255&r,r>>>=8},e.prototype._getCertificate=function(t){var e=this._certificates._get(t);if(e&&e instanceof Wo)return e;var i=void 0;if(this._localIdentifiers.has(t)&&(i=this._localIdentifiers.get(t)),void 0!==i&&null!==i){var r=this._keyCertificates.get(i);if(r&&r instanceof Wo)return r}else{var n=t.toUpperCase().trim(),s=this._keyCertificates.get(n);if(s&&s instanceof Wo)return s}},e.prototype._parsePrivateKey=function(t){var e=yi(t)?new Oo:new Fo;e._fromBytes(t);var i=e._getSequence();return{version:new Uint8Array([i[0]._getInteger()]),modulus:i[1]._getValue(),publicExponent:i[2]._getValue(),privateExponent:i[3]._getValue(),prime1:i[4]._getValue(),prime2:i[5]._getValue(),exponent1:i[6]._getValue(),exponent2:i[7]._getValue(),coefficient:i[8]._getValue()}},e.prototype._getCertificateChain=function(e){if(!this._keys.has(e))return null;var i=this._getCertificate(e);if(!i)return null;for(var r=[],n=this;i;)!function(){var e,s=i._certificate._getExtension((new Co)._fromString("2.5.29.35"));if(s){var a=s._getValue(),o=new Fo;o._fromBytes(a);var h=o._getSequence().find(function(e){return e._tagClass===t._TagClassType.context&&0===e._getTagNumber()});if(h){var c=h._getOctetString();if(c){var _=new xo({id:c});n._chainCertificates.forEach(function(t,i){Be(i._identifier,_._identifier)&&(e=t)})}}}r.push(i),i=e&&e!==i?e:void 0}();return r.length>0?r:null},e}(),Zo=function(){function t(t,e){this._chains=[],this._objectIdentifierToAttributeMap={"2.5.4.3":"CN","2.5.4.6":"C","2.5.4.7":"L","2.5.4.8":"ST","2.5.4.10":"O","2.5.4.11":"OU"},t instanceof Uint8Array&&null!==e&&void 0!==e?this._initializePublicKeyCryptographyCertificate(t,e):t instanceof Ho&&this._loadDetailsFromCertificate(t)}return t.prototype._initializePublicKeyCryptographyCertificate=function(t,e){var i=new Qo(t,e);if(i){this._publicKeyCryptographyCertificate=i;var r="";i._keys.forEach(function(t,e){t&&""===r&&(r=e)});var n=i._getCertificate(r);n&&this._loadDetailsFromCertificate(n._certificate)}},t.prototype._loadDetailsFromCertificate=function(t){var e=t._structure._getSignedCertificate();this._issuerName=this._getUniqueAttributes(e._issuer,"CN"),""===this._issuerName&&(this._issuerName=this._getUniqueAttributes(e._issuer,"OU")),this._subjectName=this._getUniqueAttributes(e._subject,"CN"),this._validFrom=e._startDate._toDate(),this._validTo=e._endDate._toDate(),this._version=e._getVersion();var i=e._serialNumber;this._serialNumber=i,this._isPublicKeyCryptographyCertificate=!0},t.prototype._getUniqueAttributes=function(t,e){for(var i=this,r=Object.keys(this._objectIdentifierToAttributeMap).find(function(t){return i._objectIdentifierToAttributeMap[t]===e||t===e})||e,n=0;n<t._ordering.length;n++)if(t._ordering[n].toString()===r){var s=t._values[n];return s?s.trim():""}return""},t}(),$o=function(){function t(){this._secureHash256AlgorithmIdentifier={id:"2.16.840.1.101.3.4.2.1"},this._secureHash384AlgorithmIdentifier={id:"2.16.840.1.101.3.4.2.2"},this._secureHash512AlgorithmIdentifier={id:"2.16.840.1.101.3.4.2.3"},this._raceEvaluationMessageDigestAlgorithmIdentifier={id:"1.3.36.3.2.1"},this._digitalSignatureWithSecureHash256AlgorithmIdentifier={id:"2.16.840.1.101.3.4.3.2"},this._ronCipherWithRaceEvaluationAlgorithmIdentifier={id:"1.3.36.3.3.1.2"}}return t}(),th=function(){function t(){this._messageDigest5={id:"1.2.840.113549.2.5"},this._secureHash1WithRonCipherEncryption={id:"1.2.840.113549.1.1.5"},this._secureHash256WithRonCipherEncryption={id:"1.2.840.113549.1.1.11"},this._secureHash384WithRonCipherEncryption={id:"1.2.840.113549.1.1.12"},this._secureHash512WithRonCipherEncryption={id:"1.2.840.113549.1.1.13"},this._messageDigest2WithRonCipherEncryption={id:"1.2.840.113549.1.1.2"},this._raceEvaluationEncryption={id:"1.2.840.113549.1.1.1"}}return t}(),eh=function(){function t(){this._cryptographicData="1.2.840.113549.1.7.1",this._cryptographicSignedData="1.2.840.113549.1.7.2",this._rsaEncryption="1.2.840.113549.1.1.1",this._dsaSignature="1.2.840.10040.4.1",this._ecPublicKey="1.2.840.10045.2.1",this._contentType="1.2.840.113549.1.9.3",this._messageDigest="1.2.840.113549.1.9.4",this._signingCertificate="1.2.840.113549.1.9.16.2.47",this._revocation="1.2.840.113583.1.1.8"}return t}(),ih=function(){function t(){this._block=new Uint8Array(64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}return t.prototype._startChunkedConversion=function(t){return new La(this,t)},t.prototype._rotateLeft=function(t,e){return t<<e|t>>>32-e},t.prototype._fn1=function(t,e,i,r,n,s,a,o){return this._rotateLeft(t+(e^i^r)+s+a|0,o)+n|0},t.prototype._fn2=function(t,e,i,r,n,s,a,o){return this._rotateLeft(t+(e&i|~e&r)+s+a|0,o)+n|0},t.prototype._fn3=function(t,e,i,r,n,s,a,o){return this._rotateLeft(t+((e|~i)^r)+s+a|0,o)+n|0},t.prototype._fn4=function(t,e,i,r,n,s,a,o){return this._rotateLeft(t+(e&r|i&~r)+s+a|0,o)+n|0},t.prototype._fn5=function(t,e,i,r,n,s,a,o){return this._rotateLeft(t+(e^(i|~r))+s+a|0,o)+n|0},t.prototype._readInt32LE=function(t,e){return e>>>=0,t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24},t.prototype._writeUInt32LE=function(t,e,i){return e=+e,i>>>=0,t[i+3]=e>>>24,t[i+2]=e>>>16,t[i+1]=e>>>8,t[i]=255&e,i+4},t.prototype._writeInt32LE=function(t,e,i){return e=+e,i>>>=0,t[i]=255&e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24,i+4},t.prototype._update=function(){for(var t=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),e=new Uint8Array([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),i=new Uint8Array([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),r=new Uint8Array([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),n=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),s=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),a=new Array(16),o=0;o<16;++o)a[o]=this._readInt32LE(this._block,4*o);for(var h=0|this._a,c=0|this._b,_=0|this._c,d=0|this._d,u=0|this._e,l=0|this._a,f=0|this._b,p=0|this._c,g=0|this._d,y=0|this._e,m=0;m<80;m+=1){var b=void 0,v=void 0;m<16?(b=this._fn1(h,c,_,d,u,a[t[m]],n[0],i[m]),v=this._fn5(l,f,p,g,y,a[e[m]],s[0],r[m])):m<32?(b=this._fn2(h,c,_,d,u,a[t[m]],n[1],i[m]),v=this._fn4(l,f,p,g,y,a[e[m]],s[1],r[m])):m<48?(b=this._fn3(h,c,_,d,u,a[t[m]],n[2],i[m]),v=this._fn3(l,f,p,g,y,a[e[m]],s[2],r[m])):m<64?(b=this._fn4(h,c,_,d,u,a[t[m]],n[3],i[m]),v=this._fn2(l,f,p,g,y,a[e[m]],s[3],r[m])):(b=this._fn5(h,c,_,d,u,a[t[m]],n[4],i[m]),v=this._fn1(l,f,p,g,y,a[e[m]],s[4],r[m])),h=u,u=d,d=this._rotateLeft(_,10),_=c,c=b,l=y,y=g,g=this._rotateLeft(p,10),p=f,f=v}var w=this._b+_+g|0;this._b=this._c+d+y|0,this._c=this._d+u+l|0,this._d=this._e+h+f|0,this._e=this._a+c+p|0,this._a=w},t.prototype._hash=function(t,e,i){for(var r=0,n=[0,0,0,0],s=this._block;r+i-e>=64;){for(c=r;c<64;)s[c++]=t[e++];this._update(),r=0}for(;e<i;)s[r++]=t[e++];for(var a=0,o=8*i;o>0;++a)n[a]+=o,(o=n[a]/4294967296|0)>0&&(n[a]-=4294967296*o);this._block[r++]=128,r>56&&(this._block.fill(0,r,64),this._update(),r=0),this._block.fill(0,r,56),this._writeUInt32LE(this._block,n[0],56),this._writeUInt32LE(this._block,n[1],60),this._update();var h=new Uint8Array(20);this._writeInt32LE(h,this._a,0),this._writeInt32LE(h,this._b,4),this._writeInt32LE(h,this._c,8),this._writeInt32LE(h,this._d,12),this._writeInt32LE(h,this._e,16),this._block.fill(0),r=0;for(var c=0;c<4;++c)n[c]=0;return h},t}(),rh=function(){function t(){this._secureHash1="SHA-1",this._secureHash256="SHA-256",this._secureHash384="SHA-384",this._secureHash512="SHA-512",this._names=new Map,this._digests=new Map,this._algorithms=new Map,this._initializeNameMappings(),this._initializeDigestMappings(),this._initializeAlgorithmMappings()}return t.prototype._initializeNameMappings=function(){this._names.set("1.2.840.113549.2.5","MD5"),this._names.set("1.3.14.3.2.26","SHA1"),this._names.set("2.16.840.1.101.3.4.2.1","SHA256"),this._names.set("2.16.840.1.101.3.4.2.2","SHA384"),this._names.set("2.16.840.1.101.3.4.2.3","SHA512"),this._names.set("1.3.36.3.2.1","RIPEMD160"),this._names.set("1.2.840.113549.1.1.4","MD5"),this._names.set("1.2.840.113549.1.1.5","SHA1"),this._names.set("1.2.840.113549.1.1.11","SHA256"),this._names.set("1.2.840.113549.1.1.12","SHA384"),this._names.set("1.2.840.113549.1.1.13","SHA512"),this._names.set("1.2.840.10040.4.3","SHA1"),this._names.set("2.16.840.1.101.3.4.3.2","SHA256"),this._names.set("2.16.840.1.101.3.4.3.3","SHA384"),this._names.set("2.16.840.1.101.3.4.3.4","SHA512"),this._names.set("1.3.36.3.3.1.2","RIPEMD160")},t.prototype._initializeDigestMappings=function(){this._digests.set("MD5","1.2.840.113549.2.5"),this._digests.set("MD-5","1.2.840.113549.2.5"),this._digests.set("SHA1","1.3.14.3.2.26"),this._digests.set("SHA-1","1.3.14.3.2.26"),this._digests.set("SHA256","2.16.840.1.101.3.4.2.1"),this._digests.set("SHA-256","2.16.840.1.101.3.4.2.1"),this._digests.set("SHA384","2.16.840.1.101.3.4.2.2"),this._digests.set("SHA-384","2.16.840.1.101.3.4.2.2"),this._digests.set("SHA512","2.16.840.1.101.3.4.2.3"),this._digests.set("SHA-512","2.16.840.1.101.3.4.2.3"),this._digests.set("RIPEMD160","1.3.36.3.2.1"),this._digests.set("RIPEMD-160","1.3.36.3.2.1")},t.prototype._initializeAlgorithmMappings=function(){var t=new $o,e=new th;this._algorithms.set("SHA1","SHA-1"),this._algorithms.set("1.3.14.3.2.26","SHA-1"),this._algorithms.set("SHA256","SHA-256"),this._algorithms.set(t._secureHash256AlgorithmIdentifier.id,"SHA-256"),this._algorithms.set("SHA384","SHA-384"),this._algorithms.set(t._secureHash384AlgorithmIdentifier.id,"SHA-384"),this._algorithms.set("SHA512","SHA-512"),this._algorithms.set(t._secureHash512AlgorithmIdentifier.id,"SHA-512"),this._algorithms.set("MD5","MD5"),this._algorithms.set(e._messageDigest5.id,"MD5"),this._algorithms.set("RIPEMD-160","RIPEMD160"),this._algorithms.set("RIPEMD160","RIPEMD160"),this._algorithms.set(t._raceEvaluationMessageDigestAlgorithmIdentifier.id,"RIPEMD160")},t.prototype._getDigest=function(t){return t?this._names.get(t)||t:null},t.prototype._getAllowedDigests=function(t){var e,i=t.toLowerCase();return this._digests.forEach(function(t,r){void 0!==e&&null!==e||i!==r.toLowerCase()||(e=t)}),e},t.prototype._getMessageDigest=function(t){var e=t.toLowerCase(),i=e,r=!1;this._algorithms.forEach(function(t,n){!r&&n&&n.toLowerCase()===e&&(i=t,r=!0)});var n=i.toLowerCase();if("sha1"===n||"sha-1"===n||"sha_1"===n)return new Ao;if("sha256"===n||"sha-256"===n||"sha_256"===n)return new Ma;if("sha384"===n||"sha-384"===n||"sha_384"===n)return new Na;if("sha512"===n||"sha-512"===n||"sha_512"===n)return new Ea;if("ripemd160"===n||"ripemd-160"===n||"ripemd_160"===n)return new ih;throw new Error("Invalid message digest algorithm: "+t)},t.prototype._digest=function(t,e){return this._getMessageDigest(e)._hash(t,0,t.length)},t}(),nh=function(){function t(){}return t.prototype._getInputBlockSize=function(){return this._isEncryption?this._bitSize-1>>>3:this._bitSize+7>>>3},t.prototype._getOutputBlockSize=function(){return this._isEncryption?this._bitSize+7>>>3:this._bitSize-1>>>3},t.prototype._initialize=function(t,e){this._key=e,this._isEncryption=t,this._bitSize=this._key.modulus._bitLength()},t.prototype._convertInput=function(t,e,i){var r=t.subarray(e,e+i);if(r.length>this._getInputBlockSize()+1)throw new Error("Input data too large for RSA block.");var n=Me(r);if(n>=this._key.modulus)throw new Error("Input data is larger than modulus.");return n},t.prototype._convertOutput=function(t){var e=Ee(t);if(this._isEncryption){var i=this._getOutputBlockSize();if(e.length<i){var r=new Uint8Array(i);return r.set(e,i-e.length),r}}return e},t.prototype._processBlock=function(t){var e=ze(),i=this._key;if(i._isPrivate&&i.p&&i.q){var r=i.p._toBigInt(),n=i.q._toBigInt(),s=i.dP._toBigInt(),a=i.dQ._toBigInt(),o=i.inverse._toBigInt(),h=Le(t%r,s,r),c=Le(t%n,a,n),_=(h-c)*o;(_%=r)<e("0")&&(_+=r);var d=_*n;return d+=c}return Le(t,this._key.exponent,this._key.modulus)},t}(),sh=function(){function t(){this._rsaCoreEngine=new nh}return t.prototype._getAlgorithmName=function(){return"RSA"},t.prototype._getInputBlock=function(){return this._rsaCoreEngine._getInputBlockSize()},t.prototype._getOutputBlock=function(){return this._rsaCoreEngine._getOutputBlockSize()},t.prototype._initialize=function(t,e){this._rsaCoreEngine._initialize(t,e),this._key=e},t.prototype._processBlock=function(t,e,i){var r=ze();if(!this._key)throw new Error("RSA engine not initialized.");var n,s=this._rsaCoreEngine._convertInput(t,e,i),a=this._key;if(a._isPrivate&&a.publicExponent){var o=a.publicExponent._toBigInt(),h=this._key.modulus._toBigInt(),c=je(r(1),h-r(1)),_=Le(c,o,h)*s%h;n=this._rsaCoreEngine._processBlock(_)*Oe(c,h)%h}else n=this._rsaCoreEngine._processBlock(s);return this._rsaCoreEngine._convertOutput(n)},t}(),ah=function(){function t(t){this._cipher=t}return t.prototype._getAlgorithmName=function(){return this._cipher._getAlgorithmName()+"/PKCS1Padding"},t.prototype._getInputBlock=function(){return this._isEncryption?this._cipher._getInputBlock()-10:this._cipher._getInputBlock()},t.prototype._getOutputBlock=function(){return this._isEncryption?this._cipher._getOutputBlock():this._cipher._getOutputBlock()-10},t.prototype._initialize=function(t,e){this._cipher._initialize(t,e),this._isPrivateKey=e._isPrivate,this._isEncryption=t},t.prototype._processBlock=function(t,e,i){return this._isEncryption?this._encodeBlock(t,e,i):this._decodeBlock(t,e,i)},t.prototype._encodeBlock=function(t,e,i){if(i>this._getInputBlock())throw new Error("Input data too large for PKCS#1 padding.");var r=new Uint8Array(this._cipher._getInputBlock());if(this._isPrivateKey){r[0]=1;for(n=1;n<r.length-i-1;n++)r[n]=255}else{r[0]=2;for(var n=1;n<r.length-i-1;n++){var s=void 0;do{s=Math.floor(255*Math.random())+1}while(0===s);r[n]=s}}return r[r.length-i-1]=0,r.set(t.subarray(e,e+i),r.length-i),this._cipher._processBlock(r,0,r.length)},t.prototype._decodeBlock=function(t,e,i){var r=this._cipher._processBlock(t,e,i);if(r.length<this._getOutputBlock())throw new Error("Data block is truncated.");var n=r[0];if(1!==n&&2!==n)throw new Error("Invalid block type: "+n+".");for(var s=-1,a=1;a<r.length;a++){if(0===r[a]){s=a;break}if(1===n&&255!==r[a])throw new Error("Invalid PKCS#1 padding: bad padding byte.")}if(-1===s||s<9)throw new Error("Invalid PKCS#1 padding: separator not found or too short.");return r.subarray(s+1)},t}(),oh=function(){function t(t,e){this._algorithm=t,this._digest=e}return t.prototype._getUniqueEncoded=function(){var t=this._algorithm._getEncoded(),e=this._digest,i=t.length,r=e.length,n=i+r+1+this._getLengthBytes(r).length,s=[];s.push(48);var a=this._getLengthBytes(n);if(1===a.length)s.push(a[0]);else{s.push(128|a.length-1);for(h=1;h<a.length;h++)s.push(a[h])}s.push.apply(s,Array.from(t)),s.push(4);var o=this._getLengthBytes(r);if(1===o.length)s.push(o[0]);else{s.push(128|o.length-1);for(var h=1;h<o.length;h++)s.push(o[h])}return s.push.apply(s,Array.from(e)),new Uint8Array(s)},t.prototype._getLengthBytes=function(t){if(t<128)return[t];for(var e=[],i=t;i>0;)e.unshift(255&i),i=Math.floor(i/256);return[128|e.length].concat(e)},t}(),hh=function(){function t(t){this._isSigning=!1,this._algorithmName=t,this._digest=this._getDigest(t),this._output=new Ba,this._input=this._digest._startChunkedConversion(this._output),this._ronCipherEngine=new ah(new sh),this._id=this._getAlgorithmIdentifier(t)}return t.prototype._getMap=function(){return this._map||(this._map=new Map,this._initializeMap()),this._map},t.prototype._initializeMap=function(){this._map.set("sha1","1.3.14.3.2.26"),this._map.set("sha256","2.16.840.1.101.3.4.2.1"),this._map.set("sha384","2.16.840.1.101.3.4.2.2"),this._map.set("sha512","2.16.840.1.101.3.4.2.3"),this._map.set("md5","1.3.36.3.2.1")},t.prototype._getDigest=function(t){switch(t.toLowerCase()){case"sha1":case"sha-1":return new Ao;case"sha256":case"sha-256":return new Ma;case"sha384":case"sha-384":return new Na;case"sha512":case"sha-512":return new Ea;case"md5":case"md-5":return new ih;default:throw new Error("Invalid digest algorithm: "+t)}},t.prototype._getAlgorithmIdentifier=function(t){var e=t.toLowerCase(),i=this._getMap().get(e);if(!i)throw new Error("Unsupported digest: "+t);return new Oa(i)},t.prototype._initialize=function(t,e){if(this._isSigning=t,t&&e&&!e.privateExponent)throw new Error("Private key required for signing.");if(!t&&e&&e.privateExponent)throw new Error("Public key required for verification.");this._reset(),this._ronCipherEngine._initialize(t,e)},t.prototype._blockUpdate=function(t,e,i){var r=t.subarray(e,e+i);this._input._add(r)},t.prototype._generateSignature=function(){if(!this._isSigning)throw new Error("Invalid operation: not in signing mode");this._input._close();var t=this._output._getResult();if(!t||0===t.length)return null;var e=this._derEncode(t);return this._ronCipherEngine._processBlock(e,0,e.length)},t.prototype._derEncode=function(t){return this._id?this._id&&t&&t.length>0?new oh(this._id,t)._getUniqueEncoded():new Uint8Array(0):t},t.prototype._reset=function(){this._output=new Ba,this._input=this._digest._startChunkedConversion(this._output)},t.prototype._update=function(t){this._input._add(new Uint8Array([t]))},t.prototype._compareArrays=function(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0},t}(),ch=function(){function t(){this._algorithms=new Map,this._objectIdentifiers=new Map,this._initializeAlgorithmMappings(),this._initializeObjectIdentifierMappings()}return t.prototype._initializeAlgorithmMappings=function(){var t=new $o,e=new th;this._algorithms.set("MD2WITHRSA","MD2withRSA"),this._algorithms.set("MD2WITHRSAENCRYPTION","MD2withRSA"),this._algorithms.set(e._messageDigest2WithRonCipherEncryption.id,"MD2withRSA"),this._algorithms.set(e._raceEvaluationEncryption.id,"RSA"),this._algorithms.set("SHA1WITHRSA","SHA-1withRSA"),this._algorithms.set("SHA1WITHRSAENCRYPTION","SHA-1withRSA"),this._algorithms.set(e._secureHash1WithRonCipherEncryption.id,"SHA-1withRSA"),this._algorithms.set("SHA-1WITHRSA","SHA-1withRSA"),this._algorithms.set("SHA256WITHRSA","SHA-256withRSA"),this._algorithms.set("SHA256WITHRSAENCRYPTION","SHA-256withRSA"),this._algorithms.set(e._secureHash256WithRonCipherEncryption.id,"SHA-256withRSA"),this._algorithms.set("SHA-256WITHRSA","SHA-256withRSA"),this._algorithms.set("SHA384WITHRSA","SHA-384withRSA"),this._algorithms.set("SHA384WITHRSAENCRYPTION","SHA-384withRSA"),this._algorithms.set(e._secureHash384WithRonCipherEncryption.id,"SHA-384withRSA"),this._algorithms.set("SHA-384WITHRSA","SHA-384withRSA"),this._algorithms.set("SHA512WITHRSA","SHA-512withRSA"),this._algorithms.set("SHA-512WITHRSA","SHA-512withRSA"),this._algorithms.set(e._secureHash512WithRonCipherEncryption.id,"SHA-512withRSA"),this._algorithms.set("SHA1WITHRSAANDMGF1","SHA-1withRSAandMGF1"),this._algorithms.set("SHA-1WITHRSAANDMGF1","SHA-1withRSAandMGF1"),this._algorithms.set("SHA1WITHRSA/PSS","SHA-1withRSAandMGF1"),this._algorithms.set("SHA-1WITHRSA/PSS","SHA-1withRSAandMGF1"),this._algorithms.set("SHA256WITHRSAANDMGF1","SHA-256withRSAandMGF1"),this._algorithms.set("SHA-256WITHRSAANDMGF1","SHA-256withRSAandMGF1"),this._algorithms.set("SHA256WITHRSA/PSS","SHA-256withRSAandMGF1"),this._algorithms.set("SHA-256WITHRSA/PSS","SHA-256withRSAandMGF1"),this._algorithms.set("SHA384WITHRSAANDMGF1","SHA-384withRSAandMGF1"),this._algorithms.set("SHA-384WITHRSAANDMGF1","SHA-384withRSAandMGF1"),this._algorithms.set("SHA384WITHRSA/PSS","SHA-384withRSAandMGF1"),this._algorithms.set("SHA-384WITHRSA/PSS","SHA-384withRSAandMGF1"),this._algorithms.set("SHA512WITHRSAANDMGF1","SHA-512withRSAandMGF1"),this._algorithms.set("SHA-512WITHRSAANDMGF1","SHA-512withRSAandMGF1"),this._algorithms.set("SHA512WITHRSA/PSS","SHA-512withRSAandMGF1"),this._algorithms.set("SHA-512WITHRSA/PSS","SHA-512withRSAandMGF1"),this._algorithms.set("DSAWITHSHA256","SHA-256withDSA"),this._algorithms.set("DSAWITHSHA-256","SHA-256withDSA"),this._algorithms.set("SHA256/DSA","SHA-256withDSA"),this._algorithms.set("SHA-256/DSA","SHA-256withDSA"),this._algorithms.set("SHA256WITHDSA","SHA-256withDSA"),this._algorithms.set("SHA-256WITHDSA","SHA-256withDSA"),this._algorithms.set(t._digitalSignatureWithSecureHash256AlgorithmIdentifier.id,"SHA-256withDSA"),this._algorithms.set("RIPEMD160WITHRSA","RIPEMD160withRSA"),this._algorithms.set("RIPEMD160WITHRSAENCRYPTION","RIPEMD160withRSA"),this._algorithms.set(t._ronCipherWithRaceEvaluationAlgorithmIdentifier.id,"RIPEMD160withRSA")},t.prototype._initializeObjectIdentifierMappings=function(){var t=new $o,e=new th;this._objectIdentifiers.set("SHA-1withRSA",e._secureHash1WithRonCipherEncryption),this._objectIdentifiers.set("SHA-256withRSA",e._secureHash1WithRonCipherEncryption),this._objectIdentifiers.set("SHA-384withRSA",e._secureHash256WithRonCipherEncryption),this._objectIdentifiers.set("SHA-512withRSA",e._secureHash512WithRonCipherEncryption),this._objectIdentifiers.set("RIPEMD160withRSA",t._ronCipherWithRaceEvaluationAlgorithmIdentifier.id)},t.prototype._getSigner=function(t){var e=t.toLowerCase(),i=t,r=!1;if(this._algorithms.forEach(function(t,n){r||n.toLowerCase()!==e||(i=t,r=!0)}),"SHA-1withRSA"===i)return new hh("sha1");if("SHA-256withRSA"===i)return new hh("sha256");if("SHA-384withRSA"===i)return new hh("sha384");if("SHA-512withRSA"===i)return new hh("sha512");if("RIPEMD160withRSA"===i)return new hh("md5");throw new Error("Signer "+t+" not recognised.")},t}(),_h=function(){function t(t,e){this._key=e;var i=new rh,r=i._getAllowedDigests(t);if(this._hashAlgorithm=i._getDigest(r),e&&!this._isRonCipherKey(e))throw new Error("Invalid key type");this._encryptionAlgorithm="RSA"}return t.prototype._isRonCipherKey=function(t){return"modulus"in t&&"privateExponent"in t},t.prototype._sign=function(t){try{var e=this._hashAlgorithm+"with"+this._encryptionAlgorithm,i=(new ch)._getSigner(e);return i._initialize(!0,this._key),i._blockUpdate(t,0,t.length),i._generateSignature()}catch(t){return null}},t.prototype._getHashAlgorithm=function(){return this._hashAlgorithm},t.prototype._getEncryptionAlgorithm=function(){return this._encryptionAlgorithm},t}(),dh=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{h(r.next(t))}catch(t){s(t)}}function o(t){try{h(r.throw(t))}catch(t){s(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,o)}h((r=r.apply(t,e||[])).next())})},uh=function(t,e){function i(t){return function(e){return r([t,e])}}function r(i){if(n)throw new TypeError("Generator is already executing.");for(;h;)try{if(n=1,s&&(a=2&i[0]?s.return:i[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,i[1])).done)return a;switch(s=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return h.label++,{value:i[1],done:!1};case 5:h.label++,s=i[1],i=[0];continue;case 7:i=h.ops.pop(),h.trys.pop();continue;default:if(a=h.trys,!(a=a.length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){h=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){h.label=i[1];break}if(6===i[0]&&h.label<a[1]){h.label=a[1],a=i;break}if(a&&h.label<a[2]){h.label=a[2],h.ops.push(i);break}a[2]&&h.ops.pop(),h.trys.pop();continue}i=e.call(t,h)}catch(t){i=[6,t],s=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}var n,s,a,o,h={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o},lh=function(){function e(t,e,i,r){if(this._digestAlgorithm=new rh,this._hasTimeStamp=!1,this._isTimestampOnly=!1,!(t instanceof Uint8Array&&0===t.length||void 0===e||null===e))if(t instanceof Uint8Array&&"string"==typeof e)this._initializeCmsSigner(t,e);else{if(this._digestAlgorithm=new rh,this._digestAlgorithmObjectIdentifier=this._digestAlgorithm._getAllowedDigests(i),!this._digestAlgorithmObjectIdentifier)throw new Error("Unknown hash algorithm: "+i);if(this._version=1,this._signerVersion=1,this._digestObjectIdentifier=new Map,this._digestObjectIdentifier.set(this._digestAlgorithmObjectIdentifier,null),Array.isArray(e)&&e.every(function(t){return t instanceof Ho})?(this._certificates=e.slice(),this._signatureCertificate=this._certificates[0]):(this._certificates=[],this._signatureCertificate=null),t){if(!this._isRsaKey(t))throw new Error("Unknown key algorithm");var n=new eh;this._encryptionAlgorithmObjectIdentifier=n._rsaEncryption}r&&(this._rsaData=new Uint8Array(0))}}return e.prototype._initializeCmsSigner=function(t,e){var i=new Oo;i._fromBytes(t);var r=i._getSequence();if("1.2.840.113549.1.7.2"===r[0]._getObjectIdentifier()._getDotDelimitedNotation()){var n=r[1]._getInner()._getSequence()[4]._getSequence()[0]._getSequence(),s=n[2]._getSequence()[0]._getValue(),a=(new Co)._fromBytes(s);if(this._digestAlgorithmObjectIdentifier=a.toString(),"ETSI.RFC3161"!==e){var o=this._getSignatureTimeStampToken(n),h=o.hasTimeStamp,c=o.tokenBytes;this._hasTimeStamp=h,h&&c&&(this._timeStampTokenBytes=c)}else{var _=i._toBytes();this._isTimestampOnly=!0,this._hasTimeStamp=_.length>0,this._timeStampTokenBytes=_}}},e.prototype._getSignatureTimeStampToken=function(t){if(!t||t.length<=6)return{hasTimeStamp:!1};var e=t[6];if(!e._isTagged()||1!==e._getTagNumber()||!e._isConstructed())return{hasTimeStamp:!1};for(var i=0,r=this._getChildElement(e);i<r.length;i++){var n=r[i]._getSequence();if(n&&!(n.length<2)&&"1.2.840.113549.1.9.16.2.14"===n[0]._getObjectIdentifier()._getDotDelimitedNotation()){var s=this._getChildElement(n[1]);if(s&&0!==s.length){var a=s[0]._toBytes();return{hasTimeStamp:a.length>0,tokenBytes:a}}}}return{hasTimeStamp:!1}},e.prototype._getChildElement=function(t){var e=[];return t._getAbstractSetOf&&(e=t._getAbstractSetOf()),e&&0!==e.length||!t._getSequence||(e=t._getSequence()),e&&0!==e.length||(e=this._decodeChildrenFromContentOctets(t)),e},e.prototype._isRsaKey=function(t){return"modulus"in t&&"exponent"in t},e.prototype._getHashAlgorithm=function(){return this._hashAlgorithm||(this._hashAlgorithm=this._digestAlgorithm._getDigest(this._digestAlgorithmObjectIdentifier)),this._hashAlgorithm},e.prototype._getDigestAlgorithm=function(){return this._digestAlgorithm},e.prototype._getSequenceDataSet=function(e,i,r,n){var s=[],a=new Fo;a._tagClass=t._TagClassType.universal,a._construction=t._ConstructionType.primitive,a._setTagNumber(t._UniversalType.objectIdentifier),a._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.3"));var o=new Fo;o._tagClass=t._TagClassType.universal,o._construction=t._ConstructionType.primitive,o._setTagNumber(t._UniversalType.objectIdentifier),o._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.7.1"));var h=new Fo;h._tagClass=t._TagClassType.universal,h._construction=t._ConstructionType.constructed,h._setTagNumber(t._UniversalType.abstractSyntaxSet),h._setValue(this._encodeSequence([o]));var c=new Fo;c._tagClass=t._TagClassType.universal,c._construction=t._ConstructionType.constructed,c._setTagNumber(t._UniversalType.sequence),c._setValue(this._encodeSequence([a,h])),s.push(c);var _=new Fo;_._tagClass=t._TagClassType.universal,_._construction=t._ConstructionType.primitive,_._setTagNumber(t._UniversalType.objectIdentifier),_._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.4"));var d=new Fo;d._tagClass=t._TagClassType.universal,d._construction=t._ConstructionType.primitive,d._setTagNumber(t._UniversalType.octetString),d._setValue(e);var u=new Fo;u._tagClass=t._TagClassType.universal,u._construction=t._ConstructionType.constructed,u._setTagNumber(t._UniversalType.abstractSyntaxSet),u._setValue(this._encodeSequence([d]));var l=new Fo;if(l._tagClass=t._TagClassType.universal,l._construction=t._ConstructionType.constructed,l._setTagNumber(t._UniversalType.sequence),l._setValue(this._encodeSequence([_,u])),s.push(l),n===t.CryptographicStandard.cades&&this._signatureCertificate){var f=this._hashCertificate(this._signatureCertificate),p=new Fo;p._tagClass=t._TagClassType.universal,p._construction=t._ConstructionType.primitive,p._setTagNumber(t._UniversalType.octetString),p._setValue(f);var g=new Fo;g._tagClass=t._TagClassType.universal,g._construction=t._ConstructionType.primitive,g._setTagNumber(t._UniversalType.objectIdentifier),g._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.16.2.47"));var y=(new rh)._secureHash256,m=void 0;if(this._digestAlgorithmObjectIdentifier===this._digestAlgorithm._getAllowedDigests(y))(w=new Fo)._tagClass=t._TagClassType.universal,w._construction=t._ConstructionType.constructed,w._setTagNumber(t._UniversalType.sequence),w._setValue(this._encodeSequence([p])),(S=new Fo)._tagClass=t._TagClassType.universal,S._construction=t._ConstructionType.constructed,S._setTagNumber(t._UniversalType.sequence),S._setValue(this._encodeSequence([w])),(x=new Fo)._tagClass=t._TagClassType.universal,x._construction=t._ConstructionType.constructed,x._setTagNumber(t._UniversalType.sequence),x._setValue(this._encodeSequence([S])),(P=new Fo)._tagClass=t._TagClassType.universal,P._construction=t._ConstructionType.constructed,P._setTagNumber(t._UniversalType.abstractSyntaxSet),P._setValue(this._encodeSequence([x])),(m=new Fo)._tagClass=t._TagClassType.universal,m._construction=t._ConstructionType.constructed,m._setTagNumber(t._UniversalType.sequence),m._setValue(this._encodeSequence([g,P]));else{var b=new Fo;b._tagClass=t._TagClassType.universal,b._construction=t._ConstructionType.primitive,b._setTagNumber(t._UniversalType.objectIdentifier),b._setValue(this._encodeObjectIdentifier(this._digestAlgorithmObjectIdentifier));var v=new Fo;v._tagClass=t._TagClassType.universal,v._construction=t._ConstructionType.constructed,v._setTagNumber(t._UniversalType.sequence),v._setValue(this._encodeSequence([b]));var w=new Fo;w._tagClass=t._TagClassType.universal,w._construction=t._ConstructionType.constructed,w._setTagNumber(t._UniversalType.sequence),w._setValue(this._encodeSequence([v,p]));var S=new Fo;S._tagClass=t._TagClassType.universal,S._construction=t._ConstructionType.constructed,S._setTagNumber(t._UniversalType.sequence),S._setValue(this._encodeSequence([w]));var x=new Fo;x._tagClass=t._TagClassType.universal,x._construction=t._ConstructionType.constructed,x._setTagNumber(t._UniversalType.sequence),x._setValue(this._encodeSequence([S]));var P=new Fo;P._tagClass=t._TagClassType.universal,P._construction=t._ConstructionType.constructed,P._setTagNumber(t._UniversalType.abstractSyntaxSet),P._setValue(this._encodeSequence([x])),(m=new Fo)._tagClass=t._TagClassType.universal,m._construction=t._ConstructionType.constructed,m._setTagNumber(t._UniversalType.sequence),m._setValue(this._encodeSequence([g,P]))}s.push(m)}var A=new Fo;return A._tagClass=t._TagClassType.universal,A._construction=t._ConstructionType.constructed,A._setTagNumber(t._UniversalType.abstractSyntaxSet),A._setValue(this._encodeSequence(s)),this._encodeToUniqueElement(A)},e.prototype._createPrimitiveOid=function(e){var i=new Fo;return i._tagClass=t._TagClassType.universal,i._construction=t._ConstructionType.primitive,i._setTagNumber(t._UniversalType.objectIdentifier),i._setValue(this._encodeObjectIdentifier(e)),i},e.prototype._createPrimitiveOctet=function(e){var i=new Fo;return i._tagClass=t._TagClassType.universal,i._construction=t._ConstructionType.primitive,i._setTagNumber(t._UniversalType.octetString),i._setValue(e),i},e.prototype._createConstructed=function(e,i){var r=new Fo;return r._tagClass=t._TagClassType.universal,r._construction=t._ConstructionType.constructed,r._setTagNumber(e),r._setValue(this._encodeSequence(i)),r},e.prototype._encodeObjectIdentifier=function(t){var e=t.split(".").map(Number),i=[];i.push(40*e[0]+e[1]);for(var r=2;r<e.length;r++){var n=e[r];if(n<128)i.push(n);else{for(var s=[];n>0;)s.unshift(127&n),n>>>=7;for(var a=0;a<s.length-1;a++)s[a]|=128;i.push.apply(i,s)}}return new Uint8Array(i)},e.prototype._encodeSequence=function(t){for(var e=[],i=0,r=t;i<r.length;i++){var n=r[i],s=this._encodeToUniqueElement(n);e.push.apply(e,Array.from(s))}return new Uint8Array(e)},e.prototype._encodeToUniqueElement=function(e){var i=[],r=e._getTagNumber();e._construction===t._ConstructionType.constructed&&(r|=32),e._tagClass===t._TagClassType.context&&(r|=128),i.push(r);var n=e._getValue()?e._getValue().length:0;if(n<128)i.push(n);else{var s=this._encodeLength(n);i.push(128|s.length),i.push.apply(i,s)}return e._getValue()&&i.push.apply(i,Array.from(e._getValue())),new Uint8Array(i)},e.prototype._encodeLength=function(t){for(var e=[];t>0;)e.unshift(255&t),t>>>=8;return e},e.prototype._hashCertificate=function(t){var e=t._getEncoded();return this._digestAlgorithm._getMessageDigest(this._getHashAlgorithm())._hash(e,0,e.length)},e.prototype._setSignedData=function(t,e,i){if(this._signedData=t,this._signedRsaData=e,i)switch(i){case"RSA":this._encryptionAlgorithmObjectIdentifier=(new eh)._rsaEncryption;break;case"DSA":this._encryptionAlgorithmObjectIdentifier=(new eh)._dsaSignature;break;case"ECDSA":this._encryptionAlgorithmObjectIdentifier=(new eh)._ecPublicKey;break;default:throw new Error("Invalid algorithm: "+i)}},e.prototype._encodeCertificateSet=function(t){var e,i=t.reduce(function(t,e){return t+e.length},0);e=i<128?[i]:i<256?[129,i]:[130,i>>8&255,255&i];var r=new Uint8Array(1+e.length+i);r[0]=160,r.set(e,1);for(var n=1+e.length,s=0,a=t;s<a.length;s++){var o=a[s];r.set(o,n),n+=o.length}return r},e.prototype._createPrimitive=function(e,i){var r=new Fo;return r._tagClass=t._TagClassType.universal,r._construction=t._ConstructionType.primitive,r._setTagNumber(e),r._setValue(i),r},e.prototype._createAsn1Constructed=function(e,i){var r=new Fo;return r._tagClass=t._TagClassType.universal,r._construction=t._ConstructionType.constructed,r._setTagNumber(e),r._setSequence(i),r},e.prototype._createContextConstructed=function(e,i){var r=new Fo;return r._tagClass=t._TagClassType.context,r._construction=t._ConstructionType.constructed,r._setTagNumber(e),Array.isArray(i)?r._setSequence(i):r._setValue(i),r},e.prototype._sign=function(e,i,r,n,s,a){var o=this;this._signedData&&(this._digest=this._signedData,this._rsaData&&(this._rsaData=this._signedRsaData));var h=[];this._digestObjectIdentifier.forEach(function(e,i){var r=o._createPrimitive(t._UniversalType.objectIdentifier,o._encodeObjectIdentifier(i)),n=o._createPrimitive(t._UniversalType.nullValue,new Uint8Array(0));h.push(o._createAsn1Constructed(t._UniversalType.sequence,[r,n]))});var c=[this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier((new eh)._cryptographicData))];if(this._rsaData&&this._rsaData.length>0){var _=this._createPrimitive(t._UniversalType.octetString,this._rsaData);c.push(this._createContextConstructed(0,[_]))}var d=this._createAsn1Constructed(t._UniversalType.sequence,c),u=this._certificates.filter(function(t){return t}).map(function(t){var e=new Fo;return e._fromBytes(t._getEncodedString()),e}),l=[this._createPrimitive(t._UniversalType.integer,new Uint8Array([this._signerVersion]))];if(this._signatureCertificate){var f=[],p=this._signatureCertificate._getTobeSignedCertificate(),g=this._getIssuer(p);g&&f.push(g);var y=void 0,m=this._signatureCertificate._structure._getSignedCertificate();y=this._signatureCertificate._structure&&m&&m._serialNumber?m._serialNumber:new Uint8Array([1]);var b=this._createPrimitive(t._UniversalType.integer,y);f.push(b),l.push(this._createAsn1Constructed(t._UniversalType.sequence,f))}var v=this._createAsn1Constructed(t._UniversalType.sequence,[this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._digestAlgorithmObjectIdentifier)),this._createPrimitive(t._UniversalType.nullValue,new Uint8Array(0))]);if(l.push(v),e){var w=this._getSequenceDataSet(e,r,n,s);l.push(this._createContextImplicitFromTimestampValue(0,w))}var S=this._createAsn1Constructed(t._UniversalType.sequence,[this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._encryptionAlgorithmObjectIdentifier)),this._createPrimitive(t._UniversalType.nullValue,new Uint8Array(0))]);l.push(S),l.push(this._createPrimitive(t._UniversalType.octetString,this._digest||new Uint8Array(0)));var x=this._createAsn1Constructed(t._UniversalType.sequence,l),P=this._buildSignedDataBodyElements(this._version,h,d,u,x),A=this._concatAbstractSyntaxSequence(P),T=this._encodeObjectIdentifier((new eh)._cryptographicSignedData),C=this._createPrimitive(t._UniversalType.objectIdentifier,T),k=this._createContextConstructed(0,A);return this._createAsn1Constructed(t._UniversalType.sequence,[C,k])._toBytes()},e.prototype._buildSignedDataBodyElements=function(e,i,r,n,s){var a=[];a.push(this._createPrimitive(t._UniversalType.integer,new Uint8Array([e])));var o=new Fo;if(o._tagClass=t._TagClassType.universal,o._construction=t._ConstructionType.constructed,o._setTagNumber(t._UniversalType.abstractSyntaxSet),o._setAbstractSetValue(i),a.push(o),a.push(r),n.length>0){var h=new Fo;h._tagClass=t._TagClassType.context,h._construction=t._ConstructionType.constructed,h._setTagNumber(0),h._setAbstractSetValue(n),a.push(h)}var c=new Fo;return c._tagClass=t._TagClassType.universal,c._construction=t._ConstructionType.constructed,c._setTagNumber(t._UniversalType.abstractSyntaxSet),c._setAbstractSetValue([s]),a.push(c),a},e.prototype._concatAbstractSyntaxSequence=function(t){for(var e=[],i=0,r=t;i<r.length;i++){var n=r[i];if(n instanceof Uint8Array)e.push(n);else{if(!(n instanceof Fo))throw new Error("Element for PKCS#7 serialization must be distinguished element or Uint8Array");e.push(n._toBytes())}}var s,a=e.reduce(function(t,e){return t+e.length},0);s=a<128?[a]:a<256?[129,a]:[130,a>>8,255&a];var o=new Uint8Array(1+s.length+a);o[0]=48,o.set(s,1);for(var h=1+s.length,c=0,_=e;c<_.length;c++){var d=_[c];o.set(d,h),h+=d.length}return o},e.prototype._getIssuer=function(t){var e=new Fo;return e._fromBytes(t),e._getSequence()[3]},e.prototype._getTimestampAttributes=function(e){var i=new Fo;i._tagClass=t._TagClassType.universal,i._construction=t._ConstructionType.primitive,i._setTagNumber(t._UniversalType.objectIdentifier),i._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.16.2.14"));var r=new Fo;r._tagClass=t._TagClassType.universal,r._construction=t._ConstructionType.constructed,r._setTagNumber(t._UniversalType.abstractSyntaxSet),r._setValue(e);var n=new Fo;n._tagClass=t._TagClassType.universal,n._construction=t._ConstructionType.constructed,n._setTagNumber(t._UniversalType.sequence),n._setValue(this._encodeSequence([i,r]));var s=new Fo;return s._tagClass=t._TagClassType.universal,s._construction=t._ConstructionType.constructed,s._setTagNumber(t._UniversalType.abstractSyntaxSet),s._setValue(this._encodeToUniqueElement(n)),this._encodeToUniqueElement(s)},e.prototype._signAsync=function(e,i,r,n,s,a){return dh(this,void 0,void 0,function(){var o,h,c,_,d,u,l,f,p,g,y,m,b,v,w,S,x,P,A,T,C,k,R,F,I,D,B,L,O=this;return uh(this,function(M){switch(M.label){case 0:return this._signedData&&(this._digest=this._signedData,this._rsaData&&(this._rsaData=this._signedRsaData)),o=[],this._digestObjectIdentifier.forEach(function(e,i){var r=O._createPrimitive(t._UniversalType.objectIdentifier,O._encodeObjectIdentifier(i)),n=O._createPrimitive(t._UniversalType.nullValue,new Uint8Array(0));o.push(O._createAsn1Constructed(t._UniversalType.sequence,[r,n]))}),h=[this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier((new eh)._cryptographicData))],this._rsaData&&this._rsaData.length>0&&(c=this._createPrimitive(t._UniversalType.octetString,this._rsaData),h.push(this._createContextConstructed(0,[c]))),_=this._createAsn1Constructed(t._UniversalType.sequence,h),d=this._certificates.filter(function(t){return t}).map(function(t){var e=new Fo;return e._fromBytes(t._getEncodedString()),e}),u=[this._createPrimitive(t._UniversalType.integer,new Uint8Array([this._signerVersion]))],this._signatureCertificate&&(l=[],f=this._signatureCertificate._getTobeSignedCertificate(),(p=this._getIssuer(f))&&l.push(p),g=this._signatureCertificate._structure._getSignedCertificate(),y=void 0,y=g&&g._serialNumber?g._serialNumber:new Uint8Array([1]),l.push(this._createPrimitive(t._UniversalType.integer,y)),u.push(this._createAsn1Constructed(t._UniversalType.sequence,l))),m=this._createAsn1Constructed(t._UniversalType.sequence,[this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._digestAlgorithmObjectIdentifier)),this._createPrimitive(t._UniversalType.nullValue,new Uint8Array(0))]),u.push(m),e&&(b=this._getSequenceDataSet(e,n,s,a),v=this._createContextImplicitFromTimestampValue(0,b),u.push(v)),w=this._createAsn1Constructed(t._UniversalType.sequence,[this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._encryptionAlgorithmObjectIdentifier)),this._createPrimitive(t._UniversalType.nullValue,new Uint8Array(0))]),u.push(w),u.push(this._createPrimitive(t._UniversalType.octetString,this._digest||new Uint8Array(0))),r&&0!==r.length||!i?[3,3]:i._timestampCallback?(S=this._getObjectIdentifierName("SHA256").oid,x=this._digestAlgorithm._digest(this._digest,"SHA256"),P=this._createTimestampRequestWithAlgorithm(x,S),[4,i._timestampCallback(P)]):[3,2];case 1:return A=M.sent(),r=A&&A.data.length>0?this._reEncodeTimestampResponse(A.data):void 0,[3,3];case 2:r=void 0,M.label=3;case 3:return r&&r.length>0&&(T=this._buildTimestampUnsignedAttribute(r),C=this._createAsn1Constructed(t._UniversalType.abstractSyntaxSet,[T]),u.push(this._createContextImplicitFromTimestampValue(1,C._toBytes())),this._hasTimeStamp=!0),k=this._createAsn1Constructed(t._UniversalType.sequence,u),R=this._buildSignedDataBodyElements(this._version,o,_,d,k),F=this._concatAbstractSyntaxSequence(R),I=this._encodeObjectIdentifier((new eh)._cryptographicSignedData),D=this._createPrimitive(t._UniversalType.objectIdentifier,I),B=this._createContextConstructed(0,F),L=this._createAsn1Constructed(t._UniversalType.sequence,[D,B]),[2,L._toBytes()]}})})},e.prototype._getObjectIdentifierName=function(t){switch((t||"SHA256").toUpperCase()){case"SHA1":return{oid:"1.3.14.3.2.26",name:"SHA1"};case"SHA256":return{oid:"2.16.840.1.101.3.4.2.1",name:"SHA256"};case"SHA384":return{oid:"2.16.840.1.101.3.4.2.2",name:"SHA384"};case"SHA512":return{oid:"2.16.840.1.101.3.4.2.3",name:"SHA512"};default:return{oid:"2.16.840.1.101.3.4.2.1",name:"SHA256"}}},e.prototype._createTimestampRequestWithAlgorithm=function(e,i){var r=this._createPrimitive(t._UniversalType.integer,new Uint8Array([1])),n=this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier(i)),s=this._createPrimitive(t._UniversalType.nullValue,new Uint8Array(0)),a=this._createAsn1Constructed(t._UniversalType.sequence,[n,s]),o=this._createPrimitive(t._UniversalType.octetString,e),h=this._createAsn1Constructed(t._UniversalType.sequence,[a,o]),c=this._createPrimitive(t._UniversalType.integer,new Uint8Array([100])),_=this._createPrimitive(t._UniversalType.abstractSyntaxBoolean,new Uint8Array([255]));return this._createAsn1Constructed(t._UniversalType.sequence,[r,h,c,_])._toBytes()},e.prototype._reEncodeTimestampResponse=function(t){try{var e=new Fo;e._fromBytes(t);var i=e._getSequence();if(!i||i.length<2)return t;var r=i[1];if(!r)return t;var n=r._getSequence();return n&&0!==n.length?this._encodeTimeStampSequence(n):t}catch(e){return t}},e.prototype._encodeTimeStampSequence=function(e){var i=e.map(function(t){return t._toBytes()}),r=i.reduce(function(t,e){return t+e.length},0),n=32|t._UniversalType.sequence,s=this._encodeSequenceLength(r),a=new Uint8Array(1+s.length+r),o=0;a[o++]=n,a.set(s,o),o+=s.length;for(var h=0,c=i;h<c.length;h++){var _=c[h];a.set(_,o),o+=_.length}return a},e.prototype._encodeSequenceLength=function(t){if(t<128)return new Uint8Array([t]);for(var e=[];t>0;)e.unshift(255&t),t>>=8;return new Uint8Array([128|e.length].concat(e))},e.prototype._buildTimestampUnsignedAttribute=function(e){var i=this._createPrimitive(t._UniversalType.objectIdentifier,this._encodeObjectIdentifier("1.2.840.113549.1.9.16.2.14")),r=new Fo;r._fromBytes(e);var n=this._createAsn1Constructed(t._UniversalType.abstractSyntaxSet,[r]);return this._createAsn1Constructed(t._UniversalType.sequence,[i,n])},e.prototype._getEncodedTimestamp=function(t,e,i){return dh(this,void 0,void 0,function(){var r,n,s;return uh(this,function(a){switch(a.label){case 0:return r=this._getObjectIdentifierName(i).oid,n=this._createTimestampRequestWithAlgorithm(t,r),[4,e._timestampCallback(n)];case 1:if(!(s=a.sent())||0===s.data.length)throw new Error("Timestamp server returned empty response");return[2,this._reEncodeTimestampResponse(s.data)]}})})},e.prototype._createContextImplicitFromTimestampValue=function(e,i){var r=new Fo;return r._fromBytes(i),r._tagClass=t._TagClassType.context,r._setTagNumber(e),r},e.prototype._decodeChildrenFromContentOctets=function(t){for(var e=t._getValue(),i=[],r=0;r<e.length;){var n=new Oo,s=n._fromBytes(e.subarray(r));if(s<=0)break;i.push(n),r+=s}return i},e}(),fh=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{h(r.next(t))}catch(t){s(t)}}function o(t){try{h(r.throw(t))}catch(t){s(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,o)}h((r=r.apply(t,e||[])).next())})},ph=function(t,e){function i(t){return function(e){return r([t,e])}}function r(i){if(n)throw new TypeError("Generator is already executing.");for(;h;)try{if(n=1,s&&(a=2&i[0]?s.return:i[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,i[1])).done)return a;switch(s=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return h.label++,{value:i[1],done:!1};case 5:h.label++,s=i[1],i=[0];continue;case 7:i=h.ops.pop(),h.trys.pop();continue;default:if(a=h.trys,!(a=a.length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){h=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){h.label=i[1];break}if(6===i[0]&&h.label<a[1]){h.label=a[1],a=i;break}if(a&&h.label<a[2]){h.label=a[2],h.ops.push(i);break}a[2]&&h.ops.pop(),h.trys.pop();continue}i=e.call(t,h)}catch(t){i=[6,t],s=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}var n,s,a,o,h={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o},gh=function(){function e(t,e){if(this._dictionary=new Ts,this._transParam="TransformParams",this._signaturePermissionsDictionary="DocMDP",this._cryptographicFilterType="adbe.pkcs7.detached",this._advanceFilterType="ETSI.CAdES.detached",this._requestForCommentsFilterType="ETSI.RFC3161",this._estimatedSize=8192,!t)throw new Error("A valid argument must be provided.");if(!e)throw new Error("Argument signature is null or undefined.");t instanceof jh?(this._document=t,this._crossReference=t._crossReference):this._dictionary=t,this._signature=e,this._certificate=e._certificate}return e.prototype._parsePdfContents=function(t){var e;if(t instanceof Uint8Array)return t;if("string"==typeof t){var i=t.trim();if(i.startsWith("<")&&i.endsWith(">")){var r=i.slice(1,-1).replace(/[^0-9a-fA-F]/g,"");r.length%2!=0&&(r+="0"),e=new Uint8Array(r.length/2);for(n=0;n<r.length;n+=2)e[n/2]=parseInt(r.slice(n,n+2),16);return e}e=new Uint8Array(i.length);for(var n=0;n<i.length;n++)e[n]=255&i.charCodeAt(n);return e}return e},e.prototype._parseDigestAlgorithm=function(){var e;if(this._dictionary.has("Contents")){var i=this._dictionary.get("Contents"),r=this._parsePdfContents(i),n=r&&r.length>0&&r.every(function(t){return 0===t});if(r&&r.length>0&&!n){var s=(new Jo)._readCertificate(r,!0),a=new Zo(s);this._certificate=a,this._cmsSigner=new lh(r,this._dictionary.get("SubFilter").name),this._cmsSigner&&this._cmsSigner._hasTimeStamp&&this._cmsSigner._timeStampTokenBytes&&this._cmsSigner._timeStampTokenBytes.length>0&&(this._signature._hasTimeStamp=this._cmsSigner._hasTimeStamp,this._signature._timeStampTokenBytes=this._cmsSigner._timeStampTokenBytes,this._signature._isTimestampOnly=this._cmsSigner._isTimestampOnly)}}if(this._cmsSigner)switch(this._cmsSigner._getHashAlgorithm()){case"SHA512":e=t.DigestAlgorithm.sha512;break;case"SHA384":e=t.DigestAlgorithm.sha384;break;case"SHA1":e=t.DigestAlgorithm.sha1;break;case"RIPEMD160":e=t.DigestAlgorithm.ripemd160;break;default:e=t.DigestAlgorithm.sha256}return e},e.prototype._parseDirect=function(t){var e;return this._dictionary.has(t)&&(e=this._dictionary.get(t)),e},e.prototype._parseSignedDate=function(){var t;if(this._dictionary.has("M")){var e=this._dictionary.get("M");t=this._parsePdfDate(e)}return t},e.prototype._parsePdfDate=function(t){if("string"==typeof t&&0!==t.length){var e=t.trim();e.startsWith("D:")&&(e=e.slice(2));var i=Number(e.slice(0,4)),r=Number(e.slice(4,6)||"01"),n=Number(e.slice(6,8)||"01"),s=Number(e.slice(8,10)||"00"),a=Number(e.slice(10,12)||"00"),o=Number(e.slice(12,14)||"00"),h=0;if(e.length>14){var c=e.slice(14).replace(/'/g,"");"Z"!==c.toUpperCase()&&(h=(c.startsWith("-")?-1:1)*(60*Number(c.slice(1,3))+(c.length>=5?Number(c.slice(3,5)):0)))}var _=Date.UTC(i,r-1,n,s,a,o)-6e4*h,d=new Date(_);return isNaN(d.getTime())?void 0:d}},e.prototype._dictionarySave=function(t){if(!this._dictionary||t.length<=0)throw new Error("dictionary or writer is null.");this._signature&&(this._addRequiredItems(),this._addOptionalItems()),this._addContents(t),this._addRange(t),this._signature&&this._signature._certify&&this._addDigest(t)},e.prototype._addDigest=function(t){if(this._signature&&this._signature._certify&&this._allowMessageDigestProcessing()){var e=this._document._crossReference;e._writeString("/Reference[<</TransformParams<<\r\n/V /1.2\r\n/P "+this._signature._documentPermissions+"\r\n /Type /TransformParams\r\n>>\r\n/TransformMethod/DocMDP/Type/SigRef/DigestValue",t);var i=t.length+e._currentLength;e._writeString("<",t);for(n=0;n<32;n++)e._writeString("0",t);var r=this._document._catalog._catalogDictionary.objId.toString();e._writeString(">/DigestLocation["+i+" 34]/DigestMethod/MD5/Data "+r+" R>><</TransformParams<<\r\n/V /1.2\r\n/Fields [(Signature)]\r\n/Type /TransformParams\r\n/Action /Include\r\n>>\r\n/TransformMethod/FieldMDP/Type/SigRef/DigestValue",t),i=t.length+e._currentLength,e._writeString("<",t);for(var n=0;n<32;n++)e._writeString("0",t);e._writeString(">/DigestLocation["+i+" 34]/DigestMethod/MD5/Data "+r+" R>>]\r\n",t)}},e.prototype._addRequiredItems=function(){this._signature&&this._signature._certify&&this._allowMessageDigestProcessing()&&this._addReference(),this._addType(),this._addDate(),this._addFilter(),this._addSubFilter()},e.prototype._allowMessageDigestProcessing=function(){var t=this._document._catalog._catalogDictionary.get("Perms");if(void 0!==t&&null!==t){var e=t.get("DocMDP");if(e instanceof Ss){var i=this._document._crossReference._fetch(e);if(this._dictionary.has("Reference")||i.has("Reference"))return!1}else if(e instanceof Ts&&e.objId!==this._dictionary.objId)return!1}return!0},e.prototype._addOptionalItems=function(){if(this._signature&&(this._signature._reason&&this._dictionary.update("Reason",this._signature._reason),this._signature._locationInfo&&this._dictionary.update("Location",this._signature._locationInfo),this._signature._contactInfo&&this._dictionary.update("ContactInfo",this._signature._contactInfo),this._signature._signedName)){this._dictionary.update("Name",this._signature._signedName);var t=new Ts,e=new Ts;t.update("Name",this._signature._signedName);var i=this._document._crossReference._getNextReference();this._document._crossReference._cacheMap.set(i,t),e.update("App",i),i=this._document._crossReference._getNextReference(),this._document._crossReference._cacheMap.set(i,e),this._dictionary.update("Prop_Build",i)}},e.prototype._addReference=function(){var t=new Ts,e=new Ts,i=[];t.update("V",vs.get("1.2")),t.update("P",this._signature._documentPermissions),t.update("Type",vs.get(this._transParam)),e.update("TransformMethod",vs.get(this._signaturePermissionsDictionary)),e.update("Type",vs.get("SigRef")),e.update(this._transParam,t),e.update(this._transParam,t),i.push(e),this._dictionary.update("Reference",i)},e.prototype._addType=function(){this._signature&&this._signature._isTimestampOnly&&0===this._signature._externalChain.length?this._dictionary.update("Type",new vs("DocTimeStamp")):this._dictionary.update("Type",new vs("Sig"))},e.prototype._addDate=function(){var t=new Date;this._signature&&this._signature._signedDate&&(t=this._signature._signedDate);var e=t.getFullYear().toString(),i=Ye((t.getMonth()+1).toString(),2,"0"),r=Ye(t.getDate().toString(),2,"0"),n=Ye(t.getHours().toString(),2,"0"),s=Ye(t.getMinutes().toString(),2,"0"),a=Ye(t.getSeconds().toString(),2,"0"),o=t.getTimezoneOffset(),h=Ye(Math.floor(Math.abs(o)/60).toString(),2,"0"),c=Ye((Math.abs(o)%60).toString(),2,"0"),_=o>0?"-":"+";this._dictionary.update("M","D:"+e+i+r+n+s+a+_+h+"'"+c+"'")},e.prototype._addFilter=function(){this._dictionary.update("Filter",new vs("Adobe.PPKLite"))},e.prototype._addSubFilter=function(){this._signature&&this._signature._isTimestampOnly?this._dictionary.update("SubFilter",new vs(this._requestForCommentsFilterType)):this._signature&&this._signature._cryptographicStandard===t.CryptographicStandard.cades?this._dictionary.update("SubFilter",new vs(this._advanceFilterType)):this._dictionary.update("SubFilter",new vs(this._cryptographicFilterType))},e.prototype._getLength=function(){var t=0;if(this._crossReference._uint8Chunks.length>0)for(var e=0;e<this._crossReference._uint8Chunks.length;e++)t+=this._crossReference._uint8Chunks[e].length;return t},e.prototype._addContents=function(t){var e=this._getLength(),i=this._crossReference;i._writeString("/Contents ",t),this._firstRangeLength=this._crossReference._currentLength+t.length+e;var r=2*this._estimatedSize;this._signature&&this._certificate&&(r=this._estimatedSize,this._signature&&this._signature&&(r=this._estimatedSize+4192)),i._writeString("<"+" ".repeat(2*r)+">",t),this._secondRangeIndex=t.length+e+this._crossReference._currentLength,i._writeString("\r\n",t)},e.prototype._addRange=function(t){var e=this._getLength(),i=this._crossReference;i._writeString("/ByteRange [",t),this._startPositionByteRange=t.length+this._document._crossReference._currentLength+e;for(var r=0;r<32;r++)i._writeString(" ",t);i._writeString("]\r\n",t)},e.prototype._documentSaved=function(t){var e=t.length-this._secondRangeIndex,i=["0 ",this._firstRangeLength+" ",this._secondRangeIndex+" ",e.toString()],r=this._saveRangeItem(t,i[0],this._startPositionByteRange);r=this._saveRangeItem(t,i[1],r),r=this._saveRangeItem(t,i[2],r),this._saveRangeItem(t,i[3],r);var n=t.subarray(0,this._firstRangeLength),s=t.subarray(this._secondRangeIndex),a=new Uint8Array(n.length+s.length);a.set(n,0),a.set(s,n.length);var o=Qe(this._getCryptographicStandardContent(a)),h=this._firstRangeLength;t[h]=255&"<".charCodeAt(0);for(var c=0;c<o.length;c++)t[h+1+c]=255&o.charCodeAt(c);var _=h+1+o.length,d=this._secondRangeIndex-_-1;d>0&&t.fill(255&"0".charCodeAt(0),_,_+d),t[this._secondRangeIndex-1]=255&">".charCodeAt(0)},e.prototype._getCryptographicStandardContent=function(e){try{var i="",r=void 0,n=[];if(this._signature._externalSignatureCallback){if(!(this._signature._externalChain&&this._signature._externalChain.length>0))return(l=this._signature._externalSignatureCallback(e,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:t.CryptographicStandard.cms})).signedData;i=t.DigestAlgorithm[this._signature._digestAlgorithm],r=h=new _h(i),n.push.apply(n,this._signature._externalChain)}else{var s,a="";this._certificate._publicKeyCryptographyCertificate._keys.forEach(function(t,e){var i=t;i.privateKey&&(a=e,s=i)}),this._certificate._publicKeyCryptographyCertificate._getCertificateChain(a).forEach(function(t){n.push(t._certificate)});var o=t.DigestAlgorithm[this._signature._digestAlgorithm],h=new _h(o,s.privateKey);i=o,r=h}var c=new lh(null,n,i,!1),_=c._getDigestAlgorithm()._digest(e,i),d=c._getSequenceDataSet(_,void 0,void 0,this._signature._cryptographicStandard),u=void 0;if(this._signature._externalChain&&this._signature._externalChain.length>0){var l=this._signature._externalSignatureCallback(d,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:this._signature._cryptographicStandard});if(l&&l.signedData&&(u=l.signedData),!l.signedData)return new Uint8Array(this._estimatedSize).fill(0)}else u=r._sign(d);c._setSignedData(u,null,r._getEncryptionAlgorithm());var f=void 0;return f=this._signature&&this._signature._cryptographicStandard?this._signature._cryptographicStandard:t.CryptographicStandard.cms,c._sign(_,null,void 0,void 0,f,i)}catch(t){return new Uint8Array(this._estimatedSize).fill(0)}},e.prototype._saveRangeItem=function(t,e,i){for(var r=[],n=0;n<e.length;n++)r.push(255&e.charCodeAt(n));return t.set(r,i),i+e.length},e.prototype._documentSavedAsync=function(t){return fh(this,void 0,void 0,function(){var e,i,r,n,s,a,o,h,c,_,d,u;return ph(this,function(l){switch(l.label){case 0:return e=t.length-this._secondRangeIndex,i=["0 ",this._firstRangeLength+" ",this._secondRangeIndex+" ",e.toString()],r=this._saveRangeItem(t,i[0],this._startPositionByteRange),r=this._saveRangeItem(t,i[1],r),r=this._saveRangeItem(t,i[2],r),this._saveRangeItem(t,i[3],r),n=t.subarray(0,this._firstRangeLength),s=t.subarray(this._secondRangeIndex),(a=new Uint8Array(n.length+s.length)).set(n,0),a.set(s,n.length),this._signature&&this._signature._isTimestampOnly?[4,this._getCryptographicStandardTimestampContentAsync(a)]:[3,2];case 1:return o=l.sent(),[3,4];case 2:return[4,this._getCryptographicStandardContentAsync(a)];case 3:o=l.sent(),l.label=4;case 4:for(h=Qe(o),c=this._firstRangeLength,t[c]=255&"<".charCodeAt(0),_=0;_<h.length;_++)t[c+1+_]=255&h.charCodeAt(_);return d=c+1+h.length,(u=this._secondRangeIndex-d-1)>0&&t.fill(255&"0".charCodeAt(0),d,d+u),t[this._secondRangeIndex-1]=255&">".charCodeAt(0),[2]}})})},e.prototype._getCryptographicStandardContentAsync=function(e){return fh(this,void 0,void 0,function(){var i,r,n,s,a,o,h,c,_,d,u,l,f,p,g,y,m,b,v,w;return ph(this,function(S){switch(S.label){case 0:if(S.trys.push([0,6,,7]),r="",n=void 0,s=void 0,a=void 0,o=[],this._signature._externalSignatureCallback){if(!(this._signature._externalChain&&this._signature._externalChain.length>0))return b=this._signature._externalSignatureCallback(e,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:t.CryptographicStandard.cms}),[2,b.signedData];r=t.DigestAlgorithm[this._signature._digestAlgorithm],h=new _h(r),n=h,o.push.apply(o,this._signature._externalChain)}else c="",(d=this._certificate._publicKeyCryptographyCertificate._keys).forEach(function(t,e){t.privateKey&&(c=e,_=t)}),u=this._certificate._publicKeyCryptographyCertificate,(l=u._getCertificateChain(c)).forEach(function(t){return o.push(t._certificate)}),f=t.DigestAlgorithm[this._signature._digestAlgorithm],n=new _h(f,_.privateKey),r=f;return p=new lh(null,o,r,!1),g=p._getDigestAlgorithm()._digest(e,r),y=p._getSequenceDataSet(g,a,s,this._signature._cryptographicStandard),m=void 0,this._signature._externalChain&&this._signature._externalChain.length>0?[4,this._signature._externalSignatureCallback(y,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:this._signature._cryptographicStandard})]:[3,2];case 1:return(b=S.sent()).timestampData&&(i=b.timestampData),b.signedData?(m=b.signedData,[3,4]):[2,new Uint8Array(this._estimatedSize).fill(0)];case 2:return[4,Promise.resolve(n._sign(y))];case 3:m=S.sent(),S.label=4;case 4:return p._setSignedData(m,null,n._getEncryptionAlgorithm()),v=this._signature._cryptographicStandard?this._signature._cryptographicStandard:t.CryptographicStandard.cms,[4,p._signAsync(g,this._signature,i,a,s,v)];case 5:return[2,S.sent()];case 6:return w=S.sent(),[2,new Uint8Array(this._estimatedSize).fill(0)];case 7:return[2]}})})},e.prototype._getCryptographicStandardTimestampContentAsync=function(e){return fh(this,void 0,void 0,function(){var i,r,n,s,a,o,h;return ph(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),i=t.DigestAlgorithm[this._signature._digestAlgorithm]||"SHA256",r=new lh(null,[],i,!1),n=r._getDigestAlgorithm()._digest(e,i),s=new _h(i),r._setSignedData(n,null,s._getEncryptionAlgorithm()),a=void 0,this._signature?[4,r._getEncodedTimestamp(n,this._signature,i)]:[3,2];case 1:a=c.sent(),c.label=2;case 2:return(o=new Uint8Array(a.length)).set(a),[2,o];case 3:throw h=c.sent(),new Error(h.message);case 4:return[2]}})})},e}(),yh=function(){function i(){this._visible=!0,this._externalChain=[],this._isLocked=!1,this._signed=!1,this._appendCertificates=!1,this._hasTimeStamp=!1,this._isTimestampOnly=!1,this._digestAlgorithm=t.DigestAlgorithm.sha256,this._cryptographicStandard=t.CryptographicStandard.cms,this._documentPermissions=t.PdfCertificationFlags.forbidChanges}return i.create=function(t,r,n,s){var a=new i;if(e.initializeTelemetryFeature("DigitalSignature","PDFLibrary"),t instanceof Uint8Array||"string"==typeof t){if(!(d=t instanceof Uint8Array?t:R(t))||0===d.length)throw new Error("Certificate data is required.");var o=r;if(null===o||void 0===o||0===o.length)throw new Error("Password is required to open the certificate.");var h=new Zo(d,o);return a._certificate=h,a._certificateInfo={issuerName:h._issuerName,serialNumber:h._serialNumber,subjectName:h._subjectName,validFrom:h._validFrom,validTo:h._validTo,version:h._version},n&&a._applySignatureOptions(n),s&&"function"==typeof s&&(a._timestampCallback=s),a}if("function"==typeof t){if(a._externalSignatureCallback=t,Array.isArray(r)){for(var c=0,_=r;c<_.length;c++){var d=_[c];d&&d.length>0&&a._externalChain.push((new Jo)._readCertificate(d))}return n&&a._applySignatureOptions(n),s&&"function"==typeof s&&(a._timestampCallback=s),a}return r&&"object"==typeof r?(a._applySignatureOptions(r),n&&"function"==typeof n&&(a._timestampCallback=n),a):a}if(t&&"object"==typeof t&&!Array.isArray(t))return a._applySignatureOptions(t),r&&"function"==typeof r&&(a._timestampCallback=r),a._isTimestampOnly=!0,a;if((null===t||void 0===t)&&(null===r||void 0===r)&&n&&s&&"function"==typeof s)return a._applySignatureOptions(n),a._timestampCallback=s,a._isTimestampOnly=!0,a;throw new Error("Cannot create signature due to invalid arguments.")},i.prototype.getSignedDate=function(){return this._signedDate},i.prototype.getCertificateInformation=function(){return this._certificateInfo},i.prototype.getSignatureOptions=function(){return{cryptographicStandard:this._cryptographicStandard,digestAlgorithm:this._digestAlgorithm,contactInfo:this._contactInfo,reason:this._reason,locationInfo:this._locationInfo,certify:this._certify,documentPermissions:this._documentPermissions,signedName:this._signedName,isLocked:this._isLocked}},i.replaceEmptySignature=function(e,i,n,s,a,o,h){if(!(e instanceof Uint8Array&&(0!==e.length||n instanceof Uint8Array)&&0!==n.length))throw new Error("Invalid Uint8Array: Data is either not a Uint8Array or is empty.");if("string"!=typeof i&&""!==i)throw new Error("Signature field name is required");var c,_=[];if(c=o&&"string"!=typeof o?o:h,a&&Array.isArray(a))for(var d=0,u=a;d<u.length;d++){var l=u[d];l&&l.length>0&&_.push((new Jo)._readCertificate(l))}if(!Array.isArray(_)||0===_.length)throw new Error("Invalid certificate chain: Expected a non-empty array of Certificate.");var f,p;c?(f=new jh(e,c.password),p=void 0===c.skipSignatureEncoding||null===c.skipSignatureEncoding||!1===c.skipSignatureEncoding):(f=new jh(e),p=!0);try{for(var g=f.form,y=void 0,m=0;m<g.count;m++)if(g.fieldAt(m).name===i){y=g.fieldAt(m);break}if(!y)throw new Error("Signature field name not found.");var b=y._dictionary;if(b&&b.has("V")){var v=(b=b.get("V")).getArray("ByteRange");if(v.length>=4){var w=e.subarray(0,v[1]),S=e.subarray(v[2]),x=new Uint8Array(w.length+S.length);x.set(w,0),x.set(S,w.length);var P=void 0;if(p){var A="",T=void 0,C=void 0;_&&_.length>0&&(A=t.DigestAlgorithm[s],T=new _h(A),C=_);var k=new lh(null,C,A,!1),R=k._getDigestAlgorithm()._digest(x,A);k._setSignedData(n,null,T._getEncryptionAlgorithm());var F={"adbe.pkcs7.detached":t.CryptographicStandard.cms,"ETSI.CAdES.detached":t.CryptographicStandard.cades},I=t.CryptographicStandard.cms;if(b.has("SubFilter")){var D=b.get("SubFilter");(D.name?F[D.name]:void 0)===t.CryptographicStandard.cades&&(I=t.CryptographicStandard.cades)}P=k._sign(R,null,void 0,void 0,I,A)}var B=v[2]-v[1]-2;if(0!=(1&B))throw new Error("Allocated space was not enough");if((B=Math.floor(B/2))<P.length)throw new Error("Signature content space is not enough for signed bytes");var L=Qe(P),O=v[1];e[O]=255&"<".charCodeAt(0);for(m=0;m<L.length;m++)e[O+1+m]=255&L.charCodeAt(m);var M=O+1+L.length,E=v[2]-M-1;E>0&&e.fill(255&"0".charCodeAt(0),M,M+E),e[v[2]-1]=255&">".charCodeAt(0)}}if(!o||"string"!=typeof o)return e;r.Save.save(o,new Blob([e],{type:"application/pdf"}))}catch(t){throw new Error("Signing failed: "+t.message)}finally{f.destroy()}},i.prototype._applySignatureOptions=function(t){t&&(void 0!==t.cryptographicStandard&&null!==t.cryptographicStandard&&(this._cryptographicStandard=t.cryptographicStandard),void 0!==t.digestAlgorithm&&null!==t.digestAlgorithm&&(this._digestAlgorithm=t.digestAlgorithm),_e(t.contactInfo)&&(this._contactInfo=t.contactInfo),_e(t.reason)&&(this._reason=t.reason),_e(t.locationInfo)&&(this._locationInfo=t.locationInfo),void 0!==t.documentPermissions&&null!==t.documentPermissions&&(this._documentPermissions=t.documentPermissions),_e(t.signedName)&&(this._signedName=t.signedName),"boolean"==typeof t.certify&&(this._certify=t.certify),"boolean"==typeof t.isLocked&&(this._isLocked=t.isLocked))},i.prototype._initializeInternals=function(e,i){this._crossReference=i._crossReference,this._signed=!0,this._signatureField=i;var r={"adbe.pkcs7.detached":t.CryptographicStandard.cms,"ETSI.CAdES.detached":t.CryptographicStandard.cades};if(this._signatureDictionary=new gh(e,this),e.has("SubFilter")){var n=e.get("SubFilter");(n.name?r[n.name]:void 0)===t.CryptographicStandard.cades&&(this._cryptographicStandard=t.CryptographicStandard.cades)}if(e.has("Contents")&&(this._digestAlgorithm=this._signatureDictionary._parseDigestAlgorithm(),this._signatureDictionary._certificate)){var s=this._signatureDictionary._certificate;s&&(this._certificate=s,this._certificateInfo={issuerName:s._issuerName,serialNumber:s._serialNumber,subjectName:s._subjectName,validFrom:s._validFrom,validTo:s._validTo,version:s._version})}if(this._signedDate=this._signatureDictionary._parseSignedDate(),this._signedName=this._signatureDictionary._parseDirect("Name"),this._reason=this._signatureDictionary._parseDirect("Reason"),this._locationInfo=this._signatureDictionary._parseDirect("Location"),this._contactInfo=this._signatureDictionary._parseDirect("ContactInfo"),e.has("ByteRange")){var a=e.get("ByteRange"),o=this._toNumberArray(a);if(o&&o.length>0){var h=!1,c=this._crossReference._document._catalog._catalogDictionary;if(c&&c.has("Perms")){var _=c.get("Perms");if(_&&_.has("DocMDP")){var d=_.get("DocMDP");if(d&&d.has("ByteRange")){var u=d.get("ByteRange"),l=this._toNumberArray(u);l&&o&&l.length===o.length&&l.every(function(t,e){return t===o[e]})&&(h=!0)}}}if(h&&e.has("Reference")){var f=e.get("Reference");if(f&&Array.isArray(f)&&(f=f[0]),f&&f.has("TransformParams")){var p=f.get("TransformParams");p&&p.has("P")&&(this._documentPermissions=p.get("P"))}}}}if(i._dictionary&&i._dictionary.has("Lock"))(m=i._dictionary.get("Lock"))&&(this._isLocked=!0);else if(i._dictionary&&i._dictionary.has("Kids")&&this._crossReference){var g=i._dictionary.get("Kids"),y=this._crossReference._cacheMap.get(g[0]);if(y&&y.has("Lock")){var m=y.get("Lock");m&&(this._isLocked=!0)}}!this._certify&&this._crossReference._document._isLoaded&&this._crossReference._document._catalog&&(this._certify=this._checkCertificated(e.objId))},i.prototype._toNumberArray=function(t){if(t&&Array.isArray(t)){var e=t.map(function(t){return"number"==typeof t?t:Number(t)});return e.every(function(t){return Number.isFinite(t)})?e:void 0}},i.prototype._checkCertificated=function(t){var e=!1;if(this._crossReference&&this._crossReference._document){var i=this._crossReference._document;if(i._catalog&&i._catalog._catalogDictionary&&i._catalog._catalogDictionary.has("Perms")){var r=i._catalog._catalogDictionary.get("Perms");if(r&&r.has("DocMDP")){var n=r.get("DocMDP");n&&n.objId&&t&&n.objId===t&&(e=!0)}}}return e},i.prototype._catalogBeginSave=function(){if(this._certify){var t=this._signatureField._crossReference._document,e=t._catalog._catalogDictionary.get("Perms");if(void 0===e||null===e)(e=new Ts(this._crossReference)).update("DocMDP",this._reference),e._updated=!0,t._catalog._catalogDictionary.update("Perms",e),t._catalog._catalogDictionary._updated=!0;else if(!e.has("DocMDP")){var i=this._crossReference._getNextReference();this._signatureField._crossReference._cacheMap.set(i,this._signatureDictionary._dictionary),e.set("DocMDP",i),e._updated=!0}}},i.prototype._lockSignature=function(){var e=new Ts;if(e.update("Type",vs.get("SigFieldLock")),e.update("Action",vs.get("All")),e.update("P",t.PdfCertificationFlags.forbidChanges),this._signatureField&&this._signatureField._crossReference){var i=this._signatureField._crossReference._getNextReference();this._signatureField._crossReference._cacheMap.set(i,e),this._signatureField._dictionary.update("Lock",i)}},i.prototype._createDictionary=function(t,e){return new gh(t,e)},i}(),mh=function(){function t(t){this._xmp=t,this._properties=new Map}return t.prototype._setProperty=function(t,e){if(null!==e&&void 0!==e)if(e instanceof Date){var i=e.toISOString().replace(/\.\d{3}Z$/,"Z");this._properties.set(t,i)}else"boolean"==typeof e?this._properties.set(t,e?"True":"False"):this._properties.set(t,e)},t.prototype._getProperty=function(t){return this._properties.get(t)},t.prototype._getNamespaceUri=function(){switch(this._prefix){case"xap":return"http://ns.adobe.com/xap/1.0/";case"dc":return"http://purl.org/dc/elements/1.1/";case"pdf":return"http://ns.adobe.com/pdf/1.3/";case"xmpTPg":return"http://ns.adobe.com/xap/1.0/t/pg/";case"xmpRights":return"http://ns.adobe.com/xap/1.0/rights/";case"xmpBJ":return"http://ns.adobe.com/xap/1.0/bj/";default:return void 0!==this._customNamespaceUri&&null!==this._customNamespaceUri?this._customNamespaceUri:""}},t.prototype._writeXml=function(t){var e="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i=[];this._properties&&"function"==typeof this._properties.keys&&(i=Array.from(this._properties.keys()));for(var r=!0,n=0,s=i.sort();n<s.length;n++){var a=s[n],o=this._properties.get(a);if(null!==o&&void 0!==o){var h=a.indexOf(":"),c=h>=0?a.substring(h+1):a,_=h>=0?a.substring(0,h):"",d=r&&_?this._getNamespaceUriForPrefix(_):void 0;if(Array.isArray(o)){if(0===o.length)continue;t._writeStartElement(c,_,d);var u=this._getArrayType(a);t._writeStartElement(u,"rdf",e);for(var l=0,f=o;l<f.length;l++){var p=f[l];"xap:Thumbnails"===a&&this._isThumbnailStruct(p)?(t._writeStartElement("li","rdf",e),t._writeAttributeString("parseType","Resource","rdf",e),t._writeElementString("Width",String(p.width),"xap","http://ns.adobe.com/xap/1.0/"),t._writeElementString("Height",String(p.height),"xap","http://ns.adobe.com/xap/1.0/"),t._writeElementString("Format",String(p.format),"xap","http://ns.adobe.com/xap/1.0/"),t._writeElementString("Image",String(p.image),"xap","http://ns.adobe.com/xap/1.0/"),t._writeEndElement()):t._writeElementString("li",String(p),"rdf",e)}t._writeEndElement(),t._writeEndElement(),r=!1}else if(this._isLangArray(o)){t._writeStartElement(c,_,d),t._writeStartElement("Alt","rdf",e);for(var g=o,y=0,m=Object.keys(g);y<m.length;y++){var b=m[y];t._writeStartElement("li","rdf",e),t._writeAttributeString("lang",b,"xml","http://www.w3.org/XML/1998/namespace"),Object.prototype.hasOwnProperty.call(g,b)&&t._writeString(g[b]),t._writeEndElement()}t._writeEndElement(),t._writeEndElement(),r=!1}else t._writeElementString(c,String(o),_,d),r=!1}}},t.prototype._isLangArray=function(t){if(null===t||"object"!=typeof t||Array.isArray(t))return!1;var e=Object.keys(t);return 0!==e.length&&e.every(function(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(t,e)&&"string"==typeof t[e]})},t.prototype._isThumbnailStruct=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&("number"==typeof t.width&&"number"==typeof t.height&&"string"==typeof t.format&&"string"==typeof t.image)},t.prototype._getArrayType=function(t){var e=["dc:creator","dc:date","xmpTPg:PlateNames","xmpTPg:Colorants"];return["dc:contributor","dc:publisher","dc:relation","dc:subject","dc:type","xmpRights:Owner","xmpBJ:JobRef","xmpTPg:Fonts","xap:Thumbnails"].indexOf(t)>=0?"Bag":e.indexOf(t)>=0?"Seq":"Bag"},t.prototype._getNamespaceUriForPrefix=function(t){switch(t){case"xap":return"http://ns.adobe.com/xap/1.0/";case"dc":return"http://purl.org/dc/elements/1.1/";case"pdf":return"http://ns.adobe.com/pdf/1.3/";case"xmpRights":return"http://ns.adobe.com/xap/1.0/rights/";case"xmpBJ":return"http://ns.adobe.com/xap/1.0/bj/";default:return void 0!==this._customNamespaceUri&&null!==this._customNamespaceUri?this._customNamespaceUri:""}},t}(),bh=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)}}(),vh=function(e){function i(t){var i=e.call(this,t)||this;return i._prefix="xap",i._name="Basic",i}return bh(i,e),Object.defineProperty(i.prototype,"schemaType",{get:function(){return t.PdfXmpSchemaType.basic},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"creatorTool",{get:function(){return this._creatorTool||(this._creatorTool=this._getProperty("xap:CreatorTool")),this._creatorTool},set:function(t){this._creatorTool=t,this._setProperty("xap:CreatorTool",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"label",{get:function(){return this._label||(this._label=this._getProperty("xap:Label")),this._label},set:function(t){this._label=t,this._setProperty("xap:Label",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"nickname",{get:function(){return this._nickname||(this._nickname=this._getProperty("xap:Nickname")),this._nickname},set:function(t){this._nickname=t,this._setProperty("xap:Nickname",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"baseUrl",{get:function(){return this._baseUrl||(this._baseUrl=this._getProperty("xap:BaseURL")),this._baseUrl},set:function(t){this._baseUrl=t,this._setProperty("xap:BaseURL",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"createDate",{get:function(){return this._createDate||(this._createDate=this._getProperty("xap:CreateDate")),this._createDate},set:function(t){this._createDate=t,this._setProperty("xap:CreateDate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"modifyDate",{get:function(){return this._modifyDate||(this._modifyDate=this._getProperty("xap:ModifyDate")),this._modifyDate},set:function(t){this._modifyDate=t,this._setProperty("xap:ModifyDate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"metadataDate",{get:function(){return this._metadataDate||(this._metadataDate=this._getProperty("xap:MetadataDate")),this._metadataDate},set:function(t){this._metadataDate=t,this._setProperty("xap:MetadataDate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"advisory",{get:function(){return this._advisory||(this._advisory=this._getProperty("xap:Advisory")),this._advisory},set:function(t){this._advisory=t,this._setProperty("xap:Advisory",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"identifier",{get:function(){return this._identifier||(this._identifier=this._getProperty("xap:Identifier")),this._identifier},set:function(t){this._identifier=t,this._setProperty("xap:Identifier",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"thumbnails",{get:function(){return this._thumbnails||(this._thumbnails=this._getProperty("xap:Thumbnails")),this._thumbnails},set:function(t){this._thumbnails=t,this._setProperty("xap:Thumbnails",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rating",{get:function(){return this._rating?this._rating:(this._rating=this._getProperty("xap:Rating"),this._rating)},set:function(t){this._rating=t,this._setProperty("xap:Rating",t)},enumerable:!0,configurable:!0}),i}(mh),wh=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)}}(),Sh=function(e){function i(t){var i=e.call(this,t)||this;return i._prefix="dc",i._name="DublinCore",i}return wh(i,e),Object.defineProperty(i.prototype,"schemaType",{get:function(){return t.PdfXmpSchemaType.dublinCore},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"contributor",{get:function(){return this._contributor||(this._contributor=this._getProperty("dc:contributor")),this._contributor},set:function(t){this._contributor=t,this._setProperty("dc:contributor",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"creator",{get:function(){return this._creator||(this._creator=this._getProperty("dc:creator")),this._creator},set:function(t){this._creator=t,this._setProperty("dc:creator",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"date",{get:function(){return this._date||(this._date=this._getProperty("dc:date")),this._date},set:function(t){this._date=t,this._setProperty("dc:date",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"publisher",{get:function(){return this._publisher||(this._publisher=this._getProperty("dc:publisher")),this._publisher},set:function(t){this._publisher=t,this._setProperty("dc:publisher",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"relation",{get:function(){return this._relation||(this._relation=this._getProperty("dc:relation")),this._relation},set:function(t){this._relation=t,this._setProperty("dc:relation",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"subject",{get:function(){return this._subject||(this._subject=this._getProperty("dc:subject")),this._subject},set:function(t){this._subject=t,this._setProperty("dc:subject",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"type",{get:function(){return this._type||(this._type=this._getProperty("dc:type")),this._type},set:function(t){this._type=t,this._setProperty("dc:type",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"title",{get:function(){return this._title||(this._title=this._getProperty("dc:title")),this._title},set:function(t){this._title=t,this._setProperty("dc:title",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"description",{get:function(){return this._description||(this._description=this._getProperty("dc:description")),this._description},set:function(t){this._description=t,this._setProperty("dc:description",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rights",{get:function(){return this._rights||(this._rights=this._getProperty("dc:rights")),this._rights},set:function(t){this._rights=t,this._setProperty("dc:rights",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"coverage",{get:function(){return this._coverage||(this._coverage=this._getProperty("dc:coverage")),this._coverage},set:function(t){this._coverage=t,this._setProperty("dc:coverage",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"identifier",{get:function(){return this._identifier||(this._identifier=this._getProperty("dc:identifier")),this._identifier},set:function(t){this._identifier=t,this._setProperty("dc:identifier",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"source",{get:function(){return this._source||(this._source=this._getProperty("dc:source")),this._source},set:function(t){this._source=t,this._setProperty("dc:source",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"format",{get:function(){return this._format||(this._format=this._getProperty("dc:format")),this._format},set:function(t){this._format=t,this._setProperty("dc:format",t)},enumerable:!0,configurable:!0}),i}(mh),xh=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)}}(),Ph=function(e){function i(t){var i=e.call(this,t)||this;return i._prefix="pdf",i._name="PDF",i}return xh(i,e),Object.defineProperty(i.prototype,"schemaType",{get:function(){return t.PdfXmpSchemaType.pdf},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"keywords",{get:function(){return this._keywords||(this._keywords=this._getProperty("pdf:Keywords")),this._keywords},set:function(t){this._keywords=t,this._setProperty("pdf:Keywords",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pdfVersion",{get:function(){return this._pdfVersion||(this._pdfVersion=this._getProperty("pdf:PDFVersion")),this._pdfVersion},set:function(t){this._pdfVersion=t,this._setProperty("pdf:PDFVersion",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"producer",{get:function(){return this._producer||(this._producer=this._getProperty("pdf:Producer")),this._producer},set:function(t){this._producer=t,this._setProperty("pdf:Producer",t)},enumerable:!0,configurable:!0}),i}(mh),Ah=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)}}(),Th=function(e){function i(t){var i=e.call(this,t)||this;return i._prefix="xmpTPg",i._name="PagedText",i}return Ah(i,e),Object.defineProperty(i.prototype,"schemaType",{get:function(){return t.PdfXmpSchemaType.pagedText},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pageCount",{get:function(){return void 0!==this._pageCount?parseInt(this._pageCount,10):(this._pageCount=this._getProperty("xmpTPg:NPages"),void 0!==this._pageCount?parseInt(String(this._pageCount),10):0)},set:function(t){this._pageCount=String(t),this._setProperty("xmpTPg:NPages",String(t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxPageSize",{get:function(){return void 0!==this._MaxPageSize?this._MaxPageSize:this._getProperty("xmpTPg:MaxPageSize")},set:function(t){this._MaxPageSize=t,this._setProperty("xmpTPg:MaxPageSize",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fonts",{get:function(){return this._fonts||this._getProperty("xmpTPg:Fonts")||[]},set:function(t){this._fonts=t,this._setProperty("xmpTPg:Fonts",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"plateNames",{get:function(){return this._plateNames||this._getProperty("xmpTPg:PlateNames")||[]},set:function(t){this._plateNames=t,this._setProperty("xmpTPg:PlateNames",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"colorants",{get:function(){return this._Colorants||this._getProperty("xmpTPg:Colorants")||[]},set:function(t){this._Colorants=t,this._setProperty("xmpTPg:Colorants",t)},enumerable:!0,configurable:!0}),i.prototype._writeXml=function(t){var e="http://ns.adobe.com/xap/1.0/t/pg/",i="http://www.w3.org/1999/02/22-rdf-syntax-ns#",r="http://ns.adobe.com/xap/1.0/sType/Dimensions#";void 0!==this._MaxPageSize&&(t._writeStartElement("MaxPageSize","xmpTPg",e),t._writeStartElement("Description","rdf",i),t._writeNamespaceDeclaration("stDim",r),t._writeElementString("w",String(this._MaxPageSize.width),"stDim",r),t._writeElementString("h",String(this._MaxPageSize.height),"stDim",r),void 0!==this._MaxPageSize.unit&&t._writeElementString("unit",this._MaxPageSize.unit,"stDim",r),t._writeEndElement(),t._writeEndElement());var n=[];this._properties&&"function"==typeof this._properties.keys&&(n=Array.from(this._properties.keys()));for(var s=0,a=n.sort();s<a.length;s++){var o=a[s];if("xmpTPg:MaxPageSize"!==o){var h=this._properties.get(o);if(null!==h&&void 0!==h){var c=o.indexOf(":"),_=c>=0?o.substring(c+1):o,d=c>=0?o.substring(0,c):"";if(Array.isArray(h)){if(0===h.length)continue;t._writeStartElement(_,d,e);var u="xmpTPg:Colorants"===o||"xmpTPg:PlateNames"===o?"Seq":"Bag";t._writeStartElement(u,"rdf",i);for(var l=0,f=h;l<f.length;l++){var p=f[l];t._writeElementString("li",String(p),"rdf",i)}t._writeEndElement(),t._writeEndElement()}else t._writeElementString(_,String(h),d,e)}}}},i}(mh),Ch=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)}}(),kh=function(e){function i(t){var i=e.call(this,t)||this;return i._prefix="xmpBJ",i._name="BasicJobTicket",i}return Ch(i,e),Object.defineProperty(i.prototype,"schemaType",{get:function(){return t.PdfXmpSchemaType.basicJobTicket},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"jobRef",{get:function(){return void 0!==this._jobRef&&null!==this._jobRef?this._jobRef:(this._jobRef=this._getProperty("xmpBJ:JobRef"),this._jobRef?this._jobRef:[])},set:function(t){this._jobRef=t,this._setProperty("xmpBJ:JobRef",t)},enumerable:!0,configurable:!0}),i}(mh),Rh=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)}}(),Fh=function(e){function i(t){var i=e.call(this,t)||this;return i._prefix="xmpRights",i._name="RightsManagement",i}return Rh(i,e),Object.defineProperty(i.prototype,"schemaType",{get:function(){return t.PdfXmpSchemaType.rightsManagement},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"certificateUrl",{get:function(){return this._certificate||(this._certificate=this._getProperty("xmpRights:Certificate")),this._certificate},set:function(t){this._certificate=t,this._setProperty("xmpRights:Certificate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"webStatement",{get:function(){return this._webStatement||(this._webStatement=this._getProperty("xmpRights:WebStatement")),this._webStatement},set:function(t){this._webStatement=t,this._setProperty("xmpRights:WebStatement",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isMarked",{get:function(){if(void 0!==this._isMarked)return this._isMarked;var t=this._getProperty("xmpRights:Marked");return"string"==typeof t&&"True"===t},set:function(t){this._isMarked=t,this._setProperty("xmpRights:Marked",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"owners",{get:function(){return this._owner||this._getProperty("xmpRights:Owner")||[]},set:function(t){this._owner=t,this._setProperty("xmpRights:Owner",t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"usageTerms",{get:function(){return this._usageTerms||(this._usageTerms=this._getProperty("xmpRights:UsageTerms")),this._usageTerms},set:function(t){this._usageTerms=t,this._setProperty("xmpRights:UsageTerms",t)},enumerable:!0,configurable:!0}),i}(mh),Ih=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)}}(),Dh=function(e){function i(t,i,r){var n=e.call(this,t)||this;return n._namespace=i,n._namespaceUri=r,n._customNamespaceUri=r,n._prefix=i,n._name=r,n._customdata=new Map,n._xmp&&n._xmp._customSchemas.push(n),n}return Ih(i,e),Object.defineProperty(i.prototype,"schemaType",{get:function(){return t.PdfXmpSchemaType.custom},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"customData",{get:function(){return this._customdata},set:function(t){this._customdata=t},enumerable:!0,configurable:!0}),i.prototype._writeXml=function(t){var e=this;0!==this._customdata.size&&this._customdata.forEach(function(i,r){t._writeElementString(r,i,e._namespace,e._namespaceUri)})},i}(mh),Bh=function(){function t(){this._customSchemas=[],this._isUpdated=!1,this._namespaceRegistry=new Set}return Object.defineProperty(t.prototype,"dublinCoreSchema",{get:function(){return this._dublinCoreSchema||(this._dublinCoreSchema=new Sh(this)),this._dublinCoreSchema},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"basicSchema",{get:function(){return this._basicSchema||(this._basicSchema=new vh(this)),this._basicSchema},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pdfSchema",{get:function(){return this._pdfSchema||(this._pdfSchema=new Ph(this)),this._pdfSchema},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pagedTextSchema",{get:function(){return this._pagedTextSchema||(this._pagedTextSchema=new Th(this)),this._pagedTextSchema},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"basicJobTicketSchema",{get:function(){return this._basicJobTicketSchema||(this._basicJobTicketSchema=new kh(this)),this._basicJobTicketSchema},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightsManagementSchema",{get:function(){return this._rightsManagementSchema||(this._rightsManagementSchema=new Fh(this)),this._rightsManagementSchema},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customSchema",{get:function(){return this._customSchema||(this._customSchema=new Dh(this,"pdfx","http://ns.adobe.com/pdfx/1.3/")),this._customSchema},enumerable:!0,configurable:!0}),t.prototype._build=function(){var t=new Date;this._basicSchema&&void 0!==this._basicSchema._getProperty("xap:CreateDate")||(this.basicSchema.createDate=t),this._basicSchema&&void 0!==this._basicSchema._getProperty("xap:ModifyDate")||(this.basicSchema.modifyDate=t),this._dublinCoreSchema&&void 0!==this._dublinCoreSchema._getProperty("dc:format")||(this.dublinCoreSchema.format="application/pdf"),this._xmlWriter=new Ti,this._namespaceRegistry.clear(),this._xmlWriter._writeStartElement("xmpmeta","x","adobe:ns:meta/"),this._xmlWriter._writeStartElement("RDF","rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this._writeSchemas(this._xmlWriter),this._xmlWriter._writeEndElement(),this._xmlWriter._writeEndElement();var e=v(this._xmlWriter._save()),i='<?xml version="1.0" encoding="utf-8"?><?xpacket begin="\ufeff" id="W5M0MpCehiHzreSzNTczkc9d"?>'+(e=e.replace(/^<\?xml\s+version\s*=\s*["']1\.0["']\s+encoding\s*=\s*["']utf-8["']\s*\?>/,""))+'<?xpacket end="r"?>';return this._buffer=f(i.replace(/(>)(<)(\/*)/g,"$1\n$2$3")),this._buffer},t.prototype._writeSchemas=function(t){var e=[];if(this._basicSchema&&this._basicSchema._properties.size>0&&e.push(this._basicSchema),this._dublinCoreSchema&&this._dublinCoreSchema._properties.size>0&&e.push(this._dublinCoreSchema),this._pdfSchema&&this._pdfSchema._properties.size>0&&e.push(this._pdfSchema),this._pagedTextSchema&&this._pagedTextSchema._properties.size>0&&e.push(this._pagedTextSchema),this._basicJobTicketSchema&&this._basicJobTicketSchema._properties.size>0&&e.push(this._basicJobTicketSchema),this._rightsManagementSchema&&this._rightsManagementSchema._properties.size>0&&e.push(this._rightsManagementSchema),this._customSchemas&&this._customSchemas.length>0)for(var i=0,r=this._customSchemas;i<r.length;i++){var n=r[i];(n.customData instanceof Map?n.customData.size>0:n._properties&&n._properties.size>0)&&e.push(n)}for(var s=0,a=e;s<a.length;s++){var o=a[s];this._writeSchema(t,o)}},t.prototype._writeSchema=function(t,e){t._writeStartElement("Description","rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),t._writeAttributeString("about","","rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");var i=e._prefix,r=e._getNamespaceUri();this._namespaceRegistry.has(i)||(t._writeAttributeString(i,r,"xmlns","http://www.w3.org/2000/xmlns/"),this._namespaceRegistry.add(i)),e._writeXml(t),t._writeEndElement()},t.prototype._serializeToStream=function(){var t=this._build();this._xmpStream=new Fs(t),this.xmpStream=this._xmpStream.bytes},t.prototype._destroy=function(){this._xmlWriter=void 0,this._buffer=void 0,this._namespaceRegistry.clear(),this._dublinCoreSchema=void 0,this._basicSchema=void 0,this._pdfSchema=void 0,this._pagedTextSchema=void 0,this._basicJobTicketSchema=void 0,this._rightsManagementSchema=void 0,this._customSchema=void 0,this._xmpStream=void 0},t}(),Lh=function(){function t(){}return t.prototype._load=function(t){var e,i=(e=t instanceof Uint8Array?v(t):t).lastIndexOf("<?xpacket begin");if(-1===i)throw new Error("XMP metadata not found in PDF");var r=e.indexOf("<?xpacket end=",i);if(-1===r)throw new Error("XMP metadata not found in PDF");var n=e.substring(i,e.indexOf("?>",r)+2),s=new DOMParser;this._xmlDoc=s.parseFromString(n,"application/xml"),this._validate(this._xmlDoc)},t.prototype._validate=function(t){var e=t.querySelector("parsererror");if(e){var i=e.textContent||"Unknown parse error";throw new Error("Invalid XMP XML: "+i)}},t.prototype._parseXmp=function(){this._xmp=new Bh;for(var t=this._getRdfRoot().getElementsByTagNameNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"),e=0;e<t.length;e++)this._parseSchemaNode(t.item(e));return this._xmp},t.prototype._getRdfRoot=function(){if(!this._xmlDoc)throw new Error("XML document not loaded");var t=this._xmlDoc.getElementsByTagNameNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","RDF");if(0===t.length)throw new Error("rdf:RDF element not found in XMP metadata");return t[0]},t.prototype._parseSchemaNode=function(t){for(var e=t.attributes,i=0;i<e.length;i++){var r=e.item(i);if(r.name.startsWith("xmlns:")){var n=r.name.substring(6),s=r.value;this._mapSchema(n,s,t)}}},t.prototype._mapSchema=function(t,e,i){switch(e){case"http://purl.org/dc/elements/1.1/":this._parseDublinCore(i);break;case"http://ns.adobe.com/xap/1.0/":this._parseBasic(i);break;case"http://ns.adobe.com/pdf/1.3/":this._parsePdf(i);break;case"http://ns.adobe.com/xap/1.0/t/pg/":this._parsePagedText(i);break;case"http://ns.adobe.com/xap/1.0/rights/":this._parseRights(i);break;case"http://ns.adobe.com/xap/1.0/bj/":this._parseJobTicket(i);break;case"http://ns.adobe.com/pdfx/1.3/":this._parseInternalCustom(t,e,i);break;default:this._parseCustom(t,e,i)}},t.prototype._parseBasic=function(t){var e=this._xmp.basicSchema,i=this._getValue(t,"CreatorTool");i&&(e.creatorTool=i);var r=this._getValue(t,"Label");r&&(e.label=r);var n=this._getValue(t,"Nickname");n&&(e.nickname=n);var s=this._getValue(t,"BaseURL");s&&(e.baseUrl=s);var a=this._getDate(t,"CreateDate");a&&(e.createDate=a);var o=this._getDate(t,"ModifyDate");o&&(e.modifyDate=o);var h=this._getDate(t,"MetadataDate");h&&(e.metadataDate=h);var c=this._getArray(t,"Advisory");c.length>0&&(e.advisory=c);var _=this._getArray(t,"Identifier");_.length>0&&(e.identifier=_);var d=this._getThumbnails(t,"Thumbnails");d.length>0&&(e.thumbnails=d);var u=this._getArray(t,"Rating");u.length>0&&(e.rating=u.map(function(t){return parseFloat(t)}))},t.prototype._parseDublinCore=function(t){var e=this._xmp.dublinCoreSchema,i=this._getArray(t,"contributor");i.length>0&&(e.contributor=i);var r=this._getArray(t,"creator");r.length>0&&(e.creator=r);var n=this._getArray(t,"date");n.length>0&&(e.date=n);var s=this._getArray(t,"publisher");s.length>0&&(e.publisher=s);var a=this._getArray(t,"relation");a.length>0&&(e.relation=a);var o=this._getArray(t,"subject");o.length>0&&(e.subject=o);var h=this._getArray(t,"type");h.length>0&&(e.type=h);var c=this._getLangArray(t,"title");Object.keys(c).length>0&&(e.title=c);var _=this._getLangArray(t,"description");Object.keys(_).length>0&&(e.description=_);var d=this._getLangArray(t,"rights");Object.keys(d).length>0&&(e.rights=d);var u=this._getValue(t,"coverage");u&&(e.coverage=u);var l=this._getValue(t,"identifier");l&&(e.identifier=l);var f=this._getValue(t,"source");f&&(e.source=f);var p=this._getValue(t,"format");p&&(e.format=p)},t.prototype._parsePdf=function(t){var e=this._xmp.pdfSchema,i=this._getValue(t,"Keywords");i&&(e.keywords=i);var r=this._getValue(t,"Producer");r&&(e.producer=r);var n=this._getValue(t,"PDFVersion");n&&(e.pdfVersion=n)},t.prototype._parsePagedText=function(t){var e=this._xmp.pagedTextSchema,i=this._getValue(t,"NPages");i&&(e.pageCount=parseInt(i,10));var r=this._findChildElement(t,"MaxPageSize");if(r){var n=this._findDirectChild(r,"Description");if(n){var s=this._getValue(n,"w"),a=this._getValue(n,"h"),o=this._getValue(n,"unit");if(s&&a){var h={width:parseFloat(s),height:parseFloat(a)};o&&(h.unit=o),e.maxPageSize=h}}}var c=this._getArray(t,"Fonts");c.length>0&&(e.fonts=c);var _=this._getArray(t,"PlateNames");_.length>0&&(e.plateNames=_);var d=this._getArray(t,"Colorants");d.length>0&&(e.colorants=d)},t.prototype._parseRights=function(t){var e=this._xmp.rightsManagementSchema,i=this._getValue(t,"Certificate");i&&(e.certificateUrl=i);var r=this._getValue(t,"WebStatement");r&&(e.webStatement=r);var n=this._getValue(t,"Marked");n&&(e.isMarked="True"===n);var s=this._getArray(t,"Owner");s.length>0&&(e.owners=s);var a=this._getLangArray(t,"UsageTerms");Object.keys(a).length>0&&e._setProperty("xmpRights:UsageTerms",a)},t.prototype._parseJobTicket=function(t){var e=this._xmp.basicJobTicketSchema,i=this._getArray(t,"JobRef");i.length>0&&(e.jobRef=i)},t.prototype._parseInternalCustom=function(t,e,i){for(var r=new Dh(this._xmp,t,e),n=i.querySelectorAll("*"),s=0;s<n.length;s++){var a=n.item(s);if(a.prefix===t||a.localName.startsWith(t+":")){var o=a.localName.replace(t+":",""),h=a.textContent||"";r.customData.set(o,h)}}r.customData.size>0&&(this._xmp._customSchema=r)},t.prototype._parseCustom=function(t,e,i){for(var r=new Dh(this._xmp,t,e),n=i.querySelectorAll("*"),s=0;s<n.length;s++){var a=n.item(s);if(a.prefix===t||a.localName.startsWith(t+":")){var o=a.localName.replace(t+":",""),h=a.textContent||"";r.customData.set(o,h)}}},t.prototype._getValue=function(t,e){var i=this._findChildElement(t,e);if(i){var r=i.textContent?i.textContent.trim():"";if(r)return r}var n=t.getAttribute(this._getAttributeName(t,e));if(n)return n},t.prototype._getAttributeName=function(t,e){for(var i=t.attributes,r=0;r<i.length;r++){var n=i.item(r);if(n.localName===e)return n.name}return null},t.prototype._getDate=function(t,e){var i=this._getValue(t,e);if(i){var r=new Date(i);if(!isNaN(r.getTime()))return r}},t.prototype._getArray=function(t,e){var i=[],r=this._findChildElement(t,e);if(r){var n=this._findDirectChild(r,"Bag")||this._findDirectChild(r,"Seq");if(n)for(var s=0,a=this._findDirectChildren(n,"li");s<a.length;s++){var o=a[s].textContent;o&&i.push(o.trim())}}return i},t.prototype._getLangArray=function(t,e){var i={},r=this._findChildElement(t,e);if(r){var n=this._findDirectChild(r,"Alt");if(n)for(var s=0,a=this._findDirectChildren(n,"li");s<a.length;s++){var o=a[s],h=o.getAttribute("xml:lang"),c=o.textContent;h&&c&&"__proto__"!==h&&"constructor"!==h&&"prototype"!==h&&(i[String(h)]=c.trim())}}return i},t.prototype._getThumbnails=function(t,e){var i=[],r=this._findChildElement(t,e);if(r){var n=this._findDirectChild(r,"Bag");if(n)for(var s=0,a=this._findDirectChildren(n,"li");s<a.length;s++){var o=a[s],h=this._getValue(o,"width")||this._getValue(o,"Width"),c=this._getValue(o,"height")||this._getValue(o,"Height"),_=this._getValue(o,"format")||this._getValue(o,"Format"),d=this._getValue(o,"image")||this._getValue(o,"Image");if(h&&c&&_&&d){var u={width:parseInt(h,10),height:parseInt(c,10),format:_,image:d};i.push(u)}}}return i},t.prototype._findChildElement=function(t,e){for(var i=t.children,r=0;r<i.length;r++){var n=i.item(r);if(n.localName===e)return n}return null},t.prototype._findDirectChild=function(t,e){for(var i=t.children,r=0;r<i.length;r++){var n=i.item(r);if(n.localName===e)return n}return null},t.prototype._findDirectChildren=function(t,e){for(var i=[],r=t.children,n=0;n<r.length;n++){var s=r.item(n);s.localName===e&&i.push(s)}return i},t}(),Oh=function(){function t(){this._customData=new Map,this._standardKeys=new Set(["title","author","subject","keywords","creator","producer","language","creationDate","modificationDate"])}return t.prototype.set=function(t,e){if(void 0===t||null===t||void 0===e||null===e)throw new Error("Key and value should not be null");if(""===t||""===e)throw new Error("Key and value should not be empty");if(this._standardKeys.has(t.toLowerCase()))throw new Error("The Custom key cannot be a standard property");this._customData.set(t,e)},t.prototype.get=function(t){if(void 0===t||null===t)throw new Error("Key value should not be null");return this._customData.get(t)},t.prototype.has=function(t){if(void 0===t||null===t)throw new Error("Key value should not be null");return this._customData.has(t)},t.prototype.remove=function(t){if(void 0===t||null===t)throw new Error("Key value should not be null");this._customData.delete(t)},t}(),Mh=function(){return(Mh=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++){e=arguments[i];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)},Eh=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{h(r.next(t))}catch(t){s(t)}}function o(t){try{h(r.throw(t))}catch(t){s(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,o)}h((r=r.apply(t,e||[])).next())})},Nh=function(t,e){function i(t){return function(e){return r([t,e])}}function r(i){if(n)throw new TypeError("Generator is already executing.");for(;h;)try{if(n=1,s&&(a=2&i[0]?s.return:i[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,i[1])).done)return a;switch(s=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return h.label++,{value:i[1],done:!1};case 5:h.label++,s=i[1],i=[0];continue;case 7:i=h.ops.pop(),h.trys.pop();continue;default:if(a=h.trys,!(a=a.length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){h=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){h.label=i[1];break}if(6===i[0]&&h.label<a[1]){h.label=a[1],a=i;break}if(a&&h.label<a[2]){h.label=a[2],h.ops.push(i);break}a[2]&&h.ops.pop(),h.trys.pop();continue}i=e.call(t,h)}catch(t){i=[6,t],s=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}var n,s,a,o,h={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o},jh=function(){function i(i,r){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,this._isDuplicatePage=!1,this._isSplitDocument=!1,this._optionalContentDictionaries=[],this._order=[],this._on=[],this._off=[],this._as=[],this._printLayer=[],this._isLoaded=!0,this._isFormImport=!1,this._sections=[],this._backgroundLayers=new Map,this._templateRenderingStarted=!1,e.initializeTelemetry("PDFLibrary"),this._fontCollection=new Map,i){this._stream=new Fs("string"==typeof i?R(i):i),this._fileStructure=new po,this._crossReference=new Qa(this,r),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}else{this._isLoaded=!1,this._stream=new Fs([]),this._version="1.4",this._fileStructure=new po,this._fileStructure.isIncrementalUpdate=!1,this._crossReference=new Qa(this),this._crossReference._version=this._version,this._crossReference._nextReferenceNumber=1;var n=new Ts(this._crossReference);n.update("Type",vs.get("Catalog"));var s=this._crossReference._getNextReference();n.objId=s.objectNumber+" "+s.generationNumber,this._crossReference._cacheMap.set(s,n);var a=new Ts;a.update("Root",s),this._crossReference._trailer=a,this._crossReference._root=n;var o=new Ts(this._crossReference);o.update("Type",vs.get("Pages")),o.update("Kids",[]),o.update("Count",0);var h=this._crossReference._getNextReference();this._crossReference._cacheMap.set(h,o),n.update("Pages",h),this._catalog=new Ws(this._crossReference),this._pages=new Map}}return Object.defineProperty(i.prototype,"_allowImportCustomData",{get:function(){return this._allowCustomData},set:function(t){this._allowCustomData=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_linearization",{get:function(){if(!this._linear){var t=void 0;try{t=new ka(this._stream)}catch(t){}this._linear=t}return this._linear},enumerable:!0,configurable:!0}),Object.defineProperty(i.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(C(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(i.prototype,"isEncrypted",{get:function(){return this._isEncrypted},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isUserPassword",{get:function(){return this._isUserPassword},enumerable:!0,configurable:!0}),Object.defineProperty(i.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(i.prototype,"form",{get:function(){return void 0===this._form&&(this._form=new ro(this._catalog.acroForm,this._crossReference)),this._form},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),i.prototype._getDecompressedStreamBytes=function(t){if(t instanceof Hs){var e=t.bytes?t.bytes.length:t.bufferLength||0;return t.getBytes(e)}return t.bytes},i.prototype._getMetadataValue=function(){if(this._xmpMetadata)return this._xmpMetadata;if(this._catalog&&this._catalog._catalogDictionary.has("Metadata")){var t=this._catalog._catalogDictionary.getRaw("Metadata"),e=void 0;if(t instanceof Ss){var i=this._crossReference._fetch(t);(i instanceof Fs||i instanceof Hs)&&(e=i)}else(t instanceof Fs||t instanceof Hs)&&(e=t);if(e){var r=new Lh;return r._load(this._getDecompressedStreamBytes(e)),this._xmpMetadata=r._parseXmp(),this._xmpMetadata}}return this._xmpMetadata=new Bh,this._xmpMetadata},Object.defineProperty(i.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(i.prototype,"bookmarks",{get:function(){var t=this._catalog;if(t)if(t._catalogDictionary.has("Outlines")){i=t._catalogDictionary._get("Outlines");(e=t._catalogDictionary.get("Outlines"))&&(this._bookmarkBase=new ho(e,this._crossReference),this._bookmarkBase._reference=i,e.has("First")&&this._bookmarkBase._reproduceTree())}else{var e=new Ts(this._crossReference),i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,e),t._catalogDictionary.update("Outlines",i),this._crossReference._allowCatalog=!0,this._bookmarkBase=new ho(e,this._crossReference),this._bookmarkBase._reference=i}return this._bookmarkBase},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fileStructure",{get:function(){return this._fileStructure},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"layers",{get:function(){return this._layers||(this._layers=new vo(this)),this._layers},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"template",{get:function(){return this._isLoaded?this._template:(this._template||(this._template={}),this._template)},enumerable:!0,configurable:!0}),i.prototype.getRevisions=function(){var t=this;if(this._isLoaded){if(this._revisions)return this._revisions;var e=this._startXRefParsedCache?this._startXRefParsedCache.sort(function(t,e){return t-e}):[];if(0===e.length)return this._revisions=[];var i=new Uint8Array([37,37,69,79,70]),r=this._stream,n=[];return e.forEach(function(e){r.position=e;var s=r.end-r.position;if(!(s<i.length)&&t._find(r,i,s,!1)){var a=r.position+i.length;if(r.position=a,r.position<r.end){var o=r.getByte();13===o?(a++,r.position<r.end&&10===r.getByte()&&a++):10===o&&a++}n.push(a)}}),this._revisions=n}},i.prototype.embedFont=function(e,i,r,n){var s,a;if("string"==typeof e||e instanceof Uint8Array){var o="string"==typeof e?R(e):e;s=this._computeFontHash(o);var h=i,c=r;a=this._getOrCreateFontPrimitive(s,{type:"ttf",data:o}),this._fontCollection.set(s,a);var _=t.PdfFontStyle.regular;c&&c.shouldUnderline&&(_=t.PdfFontStyle.underline),c&&c.shouldStrikeout&&(_=t.PdfFontStyle.strikeout);var d=new Ar(o,h,_,a);return d._document=this,d}var u=e,l=r,f=i,p=!1;if("boolean"==typeof n&&(p=n),p){var g=u;s="cjk_"+g+"_"+l,a=this._getOrCreateFontPrimitive(s,{type:"cjk",family:g,style:l})}else{var y=u;s="standard_"+y+"_"+l,a=this._getOrCreateFontPrimitive(s,{type:"standard",family:y,style:l})}return this._createFontFromPrimitive(a,f,l)},i.prototype._getOrCreateFontPrimitive=function(e,i){if("string"==typeof e&&this._fontCollection.has(e))return this._fontCollection.get(e);var r,n=new Ts;switch(i.type){case"standard":s=Tr._getMetrics(i.family,i.style);n._updated=!0,n.set("Type",vs.get("Font")),n.set("Subtype",vs.get("Type1")),n.set("BaseFont",new vs(s._postScriptName)),i.family!==t.PdfFontFamily.symbol&&i.family!==t.PdfFontFamily.zapfDingbats&&n.set("Encoding",new vs("WinAnsiEncoding")),r={dictionary:n,metrices:s};break;case"cjk":var s=Cr._getMetrics(i.family,i.style);n._updated=!0,n.set("Type",vs.get("Font")),n.set("Subtype",vs.get("Type0")),n.set("BaseFont",new vs(s._postScriptName)),n.set("Encoding",qe(i.family)),n.set("DescendantFonts",Ge(i.family,i.style,s)),r={dictionary:n,metrices:s};break;case"ttf":var a=new pr(i.data);a._createInternals(),n=a._getInternals(),a._metrics._isUnicodeFont=!0,r={dictionary:n,metrices:a._metrics,fontInternal:a};break;default:throw new Error("Unsupported font type.")}return this._fontCollection.set(e,r),r},i.prototype._createFontFromPrimitive=function(t,e,i){var r,n=t.dictionary.get("Subtype").name,s=t.dictionary.get("BaseFont").name;switch(n){case"Type1":r=new xr(Xe(s),e,i,t);break;case"Type0":r=new Pr(Je(s),e,i,t);break;default:throw new Error("Unsupported font subtype: "+n)}return r.style=i,r._document=this,r},i.prototype._computeFontHash=function(t){return Qe((new Ra).hash(t,0,t.length))},i.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 zn(this._crossReference,t,i.dictionary,i.reference);return this._pages.set(t,a),a},i.prototype.addPage=function(t,e){var i,r;void 0!==e?(i=e,r=t,this._checkPageNumber(r)):void 0===t?(i=new Uh,r=this.pageCount):t instanceof Uh?(i=t,r=this.pageCount):(i=new Uh,r=t,this._checkPageNumber(r));var n=new Ts(this._crossReference);n.update("Type",vs.get("Pages")),n.update("Count",1),pe(n,i);var s=this._crossReference._getNextReference();this._crossReference._cacheMap.set(s,n),n.objId=s.toString();var a=new Ts(this._crossReference);a.update("Type",vs.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){if((_=this._catalog._catalogDictionary._get("Pages"))&&this._catalog._topPagesDictionary){var h=!1;this._catalog._topPagesDictionary.has("Kids")&&(u=this._catalog._topPagesDictionary.get("Kids"))&&(u.push(s),this._catalog._topPagesDictionary.update("Kids",u),h=!0),h||this._catalog._topPagesDictionary.update("Kids",[s]),this._catalog._topPagesDictionary.update("Count",1),n.update("Parent",_)}else this._catalog._catalogDictionary.update("Pages",s);this._pages=new Map,this._pageCount=1}else{var c=this.getPage(r===this.pageCount?r-1:r);if(c&&c._pageDictionary){var _=c._pageDictionary._get("Parent"),d=this._crossReference._fetch(_);if(d&&d.has("Kids")){var u=d.get("Kids");if(u){if(r===this.pageCount)u.push(s);else{var l=[];u.forEach(function(t){t===c._ref&&l.push(s),l.push(t)}),u=l,this._updatePageCache(r)}d.update("Kids",u),n.update("Parent",_),fe(d,1),this._pageCount=this.pageCount+1}}}}var f=new zn(this._crossReference,r,a,o);return f._pageSettings=i,f._isNew=!0,this._pages.set(r,f),f},i.prototype.addSection=function(t){var e;if(!this._isLoaded){var i=t||new Uh;e=new wo(this,i),this._sections.push(e)}return e},i.prototype.removePage=function(t){var e=t instanceof zn?t:this.getPage(t);this._removePage(e)},i.prototype.getDocumentInformation=function(t){void 0===t&&(t=!0);var e=this._getInfoDictionary(!1),i=this._catalog._catalogDictionary,r={};if(!e)return t||(r.xmpMetadata=this._getMetadataValue()),r.customMetadata=new Oh,r;r.title=this._readInfoString(e,"Title"),r.author=this._readInfoString(e,"Author"),r.subject=this._readInfoString(e,"Subject"),r.keywords=this._readInfoString(e,"Keywords"),r.creator=this._readInfoString(e,"Creator"),r.producer=this._readInfoString(e,"Producer"),r.language=this._readInfoString(i,"Lang");var n=this._readInfoString(e,"CreationDate");"string"==typeof n&&(r.creationDate=We(n));var s=this._readInfoString(e,"ModDate");"string"==typeof s&&(r.modificationDate=We(s)),t||(r.xmpMetadata=this._getMetadataValue());for(var a=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped"]),o=new Oh,h=0,c=Object.keys(e._map);h<c.length;h++){var _=c[h];if(!a.has(_)){var d=e.get(_);"string"==typeof d&&o.set(_,d)}}return r.customMetadata=o,r},i.prototype._readInfoString=function(t,e){if(!t||t.has(e)){var i=t.get(e);return"string"==typeof i?i:void 0}},i.prototype.setDocumentInformation=function(t){var e=this,i=this._getInfoDictionary(!0),r=this._catalog._catalogDictionary;if(this._writeInfoString(i,"Title",t.title),this._writeInfoString(i,"Author",t.author),this._writeInfoString(i,"Subject",t.subject),this._writeInfoString(i,"Keywords",t.keywords),this._writeInfoString(i,"Creator",t.creator),this._writeInfoString(i,"Producer",t.producer),this._writeInfoString(r,"Lang",t.language),this._writeInfoDate(i,"CreationDate",t.creationDate),this._writeInfoDate(i,"ModDate",t.modificationDate),t.customMetadata){var n,s=t.customMetadata._customData;this._xmpMetadata&&(n=this._xmpMetadata.customSchema.customData),s.forEach(function(t,r){"string"==typeof r&&"string"==typeof t&&e._writeInfoString(i,r,t),e._xmpMetadata&&(n.has(r)||n.set(r,t))}),this._xmpMetadata&&(this._xmpMetadata.customSchema.customData=n)}i._updated=!0},i.prototype._writeInfoString=function(t,e,i){null!==i&&"string"==typeof i&&t.update(e,i)},i.prototype._writeInfoDate=function(t,e,i){i&&i instanceof Date&&t.update(e,He(i))},i.prototype._getInfoDictionary=function(t){var e;if(this._crossReference&&this._crossReference._trailer&&(e=this._crossReference._trailer),e){if(e.has("Info")){var i=e.get("Info");if(i instanceof Ss)return this._crossReference._fetch(i);if(i instanceof Ts)return i}if(t){var r=new Ts(this._crossReference),n=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(n,r),r.objId=n.toString(),e.update("Info",n),r}}},i.prototype._checkPageNumber=function(t){if(t<0||t>this.pageCount)throw new Error("Index out of range")},i.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)},i.prototype._removePage=function(t){var e=this._parseBookmarkDestination();if(e&&e.has(t)){var i=e.get(t);i&&i.forEach(function(t){t&&t._dictionary&&t._dictionary&&(t._dictionary.has("A")&&t._dictionary.update("A",null),t._dictionary.update("Dest",null))})}this._removePageTemplates(t);for(var r=this.form.count-1;r>=0;--r){var n=this.form.fieldAt(r);n&&n.page===t&&this.form.removeFieldAt(r)}this._updatePageCache(t._pageIndex,!1),this._removeParent(t._ref,t._pageDictionary),this._crossReference._cacheMap.has(t._ref)&&(t._pageDictionary._updated=!1),0===this.pageCount&&this._catalog._topPagesDictionary.update("Kids",[])},i.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");_e(n)&&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),fe(r,-1))}}},i.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},i.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))},i.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 Ts(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)}}}},i.prototype._getUpdatedPageTemplates=function(t,e){if(t.length>0)for(var i=1;i<=t.length;i+=2){var r=t[i];if(r&&e._pageDictionary===r)return t.pop(),t.pop(),t}return t},i.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[s]);var a=[],o=new Map,h=this._catalog._catalogDictionary._get("Pages");if(i.forEach(function(t,i){var n=e.getPage(r.indexOf(t));n._pageIndex=i,o.set(i,n);var s=new Ts(e._crossReference);s.update("Type",vs.get("Pages")),s.update("Count",1),s.update("Parent",h);var c=e._crossReference._getNextReference();s.objId=c.toString(),s.update("Kids",[n._ref]),a.push(c);for(var _=n._pageDictionary.get("Parent");_&&"Pages"===_.get("Type").name&&(_.forEach(function(t,i){switch(t){case"Parent":case"Kids":case"Type":case"Count":break;case"Resources":e._cloneResources(_.get("Resources"),s);break;default:s.has(t)||s.update(t,i)}}),_.has("Parent"));)_=_.get("Parent");e._crossReference._cacheMap.set(c,s),e._crossReference._fetch(n._ref).update("Parent",c)}),this._pages=o,this._catalog){var c=this._catalog._topPagesDictionary;if(c&&c.has("Kids")){var _=c.get("Kids");_=a,c.update("Kids",_)}}},i.prototype._sortedArray=function(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),e},i.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)},i.prototype._cloneInnerResources=function(t,e,i){if(e instanceof Ts){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)}},i.prototype.save=function(t){if(this._isLoaded||0!==this.pageCount||this.addSection().addPage(),this._doPostProcess(this._flatten),e.validateLicense("pdf")||this._addWatermarkText(),"string"!=typeof t)return this._crossReference._save();r.Save.save(t,new Blob([this._crossReference._save()],{type:"application/pdf"}))},i.prototype.saveAsync=function(t){return Eh(this,void 0,void 0,function(){var e;return Nh(this,function(i){switch(i.label){case 0:return this._isLoaded||0!==this.pageCount||this.addSection().addPage(),[4,Promise.resolve(this._doPostProcess(this._flatten))];case 1:return i.sent(),"string"!=typeof t?[3,4]:[4,this._crossReference._saveAsync()];case 2:return e=i.sent(),[4,Promise.resolve(r.Save.save(t,new Blob([e],{type:"application/pdf"})))];case 3:return i.sent(),[3,6];case 4:return[4,this._crossReference._saveAsync()];case 5:return[2,i.sent()];case 6:return[2]}})})},i.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e){e({blobData:new Blob([t._crossReference._save()],{type:"application/pdf"})})})},i.prototype.exportAnnotations=function(i,n){e.initializeTelemetryFeature("Annotation","PDFLibrary"),this._isExport=!0,this._doPostProcessOnAnnotations();var s,a;if(i&&i instanceof Vh?a=i:n&&n instanceof Vh&&(a=n),a){if(a.dataFormat===t.DataFormat.xfdf)s=new Di;else if(a.dataFormat===t.DataFormat.json)s=new Oi;else{if(a.dataFormat!==t.DataFormat.fdf)return;s=new so}s.exportAppearance=a.exportAppearance}else s=new Di;var o=s._exportAnnotations(this);if(!i||"string"!=typeof i)return o;r.Save.save(i,new Blob([o],{type:"text/plain"}))},i.prototype.exportFormData=function(i,n){e.initializeTelemetryFeature("AcroForm","PDFLibrary"),this._doPostProcessOnFormFields();var s,a;if(i&&i instanceof zh?a=i:n&&n instanceof zh&&(a=n),a){if(a.dataFormat===t.DataFormat.xfdf)s=new Di(a.exportName);else if(a.dataFormat===t.DataFormat.json)s=new Oi(a.exportName);else if(a.dataFormat===t.DataFormat.fdf)s=new so(a.exportName);else{if(a.dataFormat!==t.DataFormat.xml)return;s=new fo(a.exportName)}s._asPerSpecification=a.asPerSpecification}else(s=new Di)._asPerSpecification=!1;if(!i||"string"!=typeof i)return s._exportFormFields(this);r.Save.save(i,new Blob([s._exportFormFields(this)],{type:"text/plain"}))},i.prototype.importAnnotations=function(i,r){e.initializeTelemetryFeature("Annotation","PDFLibrary"),r===t.DataFormat.xfdf?(new Di)._importAnnotations(this,"string"==typeof i?R(i):i):r===t.DataFormat.json?(new Oi)._importAnnotations(this,"string"==typeof i?R(i):i):r===t.DataFormat.fdf&&(new so)._importAnnotations(this,"string"==typeof i?R(i):i)},i.prototype.importFormData=function(i,r){e.initializeTelemetryFeature("AcroForm","PDFLibrary"),this._form&&this._form._requiresPostProcessing&&this._doPostProcessOnFormFields(),this._isFormImport=!0,this.form.count>0&&(r===t.DataFormat.xfdf?(new Di)._importFormData(this,"string"==typeof i?R(i):i):r===t.DataFormat.json?(new Oi)._importFormData(this,"string"==typeof i?R(i):i):r===t.DataFormat.fdf?(new so)._importFormData(this,"string"==typeof i?R(i):i):r===t.DataFormat.xml&&(new fo)._importFormData(this,"string"==typeof i?R(i):i))},i.prototype.destroy=function(){this._crossReference&&(this._crossReference._destroy(),this._crossReference=void 0),this._xmpMetadata&&this._xmpMetadata._destroy(),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&&(this._pages.clear(),this._pages=void 0),this._startXrefSignature=void 0,this._stream=void 0,this._form&&(this._form._fontCache=void 0,this._form=void 0),this._fontCollection.clear(),ei(),this._mergeHelperCache&&(this._mergeHelperCache.size>0&&this._mergeHelperCache.forEach(function(t){t&&t._objectDispose()}),this._mergeHelperCache.clear(),this._mergeHelperCache=void 0)},Object.defineProperty(i.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 uo(t,this._crossReference)}else this._namedDestinationCollection=new uo;return this._namedDestinationCollection},enumerable:!0,configurable:!0}),i.prototype._getLinearizationPage=function(t){var e=this,i=e._catalog,r=e._linearization,n=e._crossReference,s=Ss.get(r.objectNumberFirst,0);try{var a=n._fetch(s);if(a instanceof Ts&&(ii(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 ps("The Linearization dictionary does not point to a valid Page dictionary.")}catch(e){return i._getPageDictionary(t)}},i.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))}},i.prototype._parse=function(t){this._crossReference._parse(t),this._catalog=new Ws(this._crossReference),this._catalog.version&&(this._version=this._catalog.version)},i.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},i.prototype._doPostProcess=function(e){void 0===e&&(e=!1),this._renderDocumentTemplates(t.PdfTemplateLayerMode.background),this._renderDocumentTemplates(void 0),this._doPostProcessOnFormFields(e),this._doPostProcessOnAnnotations(e),this._addXmpMetadata(),this._renderDocumentTemplates(t.PdfTemplateLayerMode.foreground)},i.prototype._addXmpMetadata=function(){if(this._xmpMetadata&&!this._xmpMetadata._isUpdated){this._xmpMetadata._serializeToStream();var t=this._xmpMetadata._xmpStream;if(t){if(!t.dictionary){var e=new Ts(this._crossReference);e._updated=!0,t.dictionary=e}t.dictionary.update("Type",vs.get("Metadata")),t.dictionary.update("Subtype",vs.get("XML")),t._isCompress=!1;var i=this._crossReference._getNextReference();this._crossReference._cacheMap.set(i,t),this._catalog._catalogDictionary.update("Metadata",i),this._crossReference._allowCatalog=!0,this._xmpMetadata._isUpdated=!0}}},i.prototype._renderDocumentTemplates=function(t){var e=void 0!==this._template&&null!==this._template;if(!e&&this._sections)for(var i=0,r=this._sections;i<r.length;i++)if(r[i].template){e=!0;break}if(e)for(var n=0;n<this.pageCount;n++){var s=this.getPage(n),a=(n+1)%2==1;this._renderPageTemplates(s,a,t)}},i.prototype._renderPageTemplates=function(e,i,r){this._templateRenderingStarted=!0;for(var n,s=e._getSectionIndex(),a=0,o=[t._TemplateSide.top,t._TemplateSide.bottom,t._TemplateSide.left,t._TemplateSide.right];a<o.length;a++){var h=o[a],c=!1,_=void 0!==e._g&&null!==e._g&&!e._needInitializeGraphics,d=s>=0&&s<this._sections.length?this._getSectionTemplateForSide(this._sections[s],h,i):null,u=this._getTemplateForSide(h,i),l=[];u&&u.template&&l.push(u),d&&d.template&&l.push(d);for(var f=0,p=l;f<p.length;f++){var g=p[f];if(g&&g.template){var y=g.templateLayerMode;if(void 0!==y&&y===r||void 0===y&&void 0===r){var m=this._getTemplateAlignmentPosition(e,g.documentTemplate,g.alignment,h,i),b=void 0;void 0===g.alignment&&(b=this._templateSideToString(h));var v=_&&e._accessedBeforeTemplate&&!e._templatesRendered;if(y===t.PdfTemplateLayerMode.background){var w=this._backgroundLayers.get(e);w||(w=this.layers.add("_background"),this.layers.move(0,w),this._backgroundLayers.set(e,w));var S=w.createGraphics(e),x=S.save();S.setTransparency(.5),g.template._draw(S,m.x,m.y,m.width,m.height,b),S.restore(x)}else if(y===t.PdfTemplateLayerMode.foreground)e._contents&&0!==e._contents.length||(e.graphics.save(),e.graphics.restore()),this._drawForegroundTemplate(e,g.template._template,m);else if(v&&!c){if(e._templatesRendered=!0,c=!0,e._loadContents(),e._contents&&e._contents.length>0){var P=new Is([]),A=new Gn(e.size,P,this._crossReference,e);A._initializeCoordinates();var T=e._pageSettings.margins,C=[T.left,T.top,e.size.width-T.left-T.right,e.size.height-T.top-T.bottom];A._clipTranslateMargins(C),A.translateTransform({x:m.x,y:0}),g.template._draw(A,0,0,m.width,m.height,b),P._bytes=[32,113,32,10].concat(P._bytes,[32,81,32,10]);var k=this._crossReference._getNextReference();this._crossReference._cacheMap.set(k,P);var R=e._contents.length-1;e._contents.splice(R,0,k),e._pageDictionary.set("Contents",e._contents),e._pageDictionary._updated=!0}}else n||(n=e.graphics),g.template._draw(n,m.x,m.y,m.width,m.height,b)}}}}},i.prototype._getSectionIndexByPage=function(t){if(!this._sections||0===this._sections.length)return-1;for(var e=0;e<this._sections.length;e++){var i=this._sections[e];if(i&&i._reference===t)return e}return-1},i.prototype._drawForegroundTemplate=function(t,e,i){var r=new Is([]),n=new Wn(r);n._write("q");var s=new Kn;s._translate(i.x,-(i.y+i.height)),s._scale(i.width/e._size.width,i.height/e._size.height),n._modifyCtm(s);var a=t._pageDictionary.get("Resources");a||(a=new Ts(this._crossReference),t._pageDictionary.set("Resources",a)),r.dictionary.update("Resources",a);var o=a.get("XObject");o||(o=new Ts(this._crossReference),a.set("XObject",o)),e._key||(e._key=it());var h=vs.get(e._key),c=this._crossReference._getNextReference();this._crossReference._cacheMap.set(c,e._content),o.set(h.name,c),n._executeObject(h),n._write("Q"),t._loadContents();var _=this._crossReference._getNextReference();this._crossReference._cacheMap.set(_,r),t._contents.push(_)},i.prototype._getTemplateForSide=function(e,i,r){void 0===r&&(r=-1);var n=new Map([[t._TemplateSide.top,{odd:t._PdfDocumentTemplateKey.oddTop,even:t._PdfDocumentTemplateKey.evenTop,base:t._PdfDocumentTemplateKey.top}],[t._TemplateSide.bottom,{odd:t._PdfDocumentTemplateKey.oddBottom,even:t._PdfDocumentTemplateKey.evenBottom,base:t._PdfDocumentTemplateKey.bottom}],[t._TemplateSide.left,{odd:t._PdfDocumentTemplateKey.oddLeft,even:t._PdfDocumentTemplateKey.evenLeft,base:t._PdfDocumentTemplateKey.left}],[t._TemplateSide.right,{odd:t._PdfDocumentTemplateKey.oddRight,even:t._PdfDocumentTemplateKey.evenRight,base:t._PdfDocumentTemplateKey.right}]]).get(e);if(!n)return null;if(r>=0&&r<this._sections.length){var s=this._sections[r],a=this._getSectionTemplateForSide(s,e,i);if(a)return a}var o=i?n.odd:n.even,h=this._getTemplateByKey(o);if(h&&h.template)return{template:h.template,templateLayerMode:h.templateLayerMode,alignment:h.alignment,documentTemplate:this._template};var c=this._getTemplateByKey(n.base);return c&&c.template?{template:c.template,templateLayerMode:c.templateLayerMode,alignment:c.alignment,documentTemplate:this._template}:null},i.prototype._getTemplateByKey=function(e){if(this._template)switch(e){case t._PdfDocumentTemplateKey.top:return this._template.top;case t._PdfDocumentTemplateKey.bottom:return this._template.bottom;case t._PdfDocumentTemplateKey.left:return this._template.left;case t._PdfDocumentTemplateKey.right:return this._template.right;case t._PdfDocumentTemplateKey.evenTop:return this._template.evenTop;case t._PdfDocumentTemplateKey.evenBottom:return this._template.evenBottom;case t._PdfDocumentTemplateKey.evenLeft:return this._template.evenLeft;case t._PdfDocumentTemplateKey.evenRight:return this._template.evenRight;case t._PdfDocumentTemplateKey.oddTop:return this._template.oddTop;case t._PdfDocumentTemplateKey.oddBottom:return this._template.oddBottom;case t._PdfDocumentTemplateKey.oddLeft:return this._template.oddLeft;case t._PdfDocumentTemplateKey.oddRight:return this._template.oddRight;default:return}},i.prototype._getSectionTemplateForSide=function(e,i,r){var n=e.template,s=new Map([[t._TemplateSide.top,"top"],[t._TemplateSide.bottom,"bottom"],[t._TemplateSide.left,"left"],[t._TemplateSide.right,"right"]]).get(i);if(!s)return null;var a=s.charAt(0).toUpperCase()+s.slice(1),o="odd"+a,h="even"+a,c=void 0;return r&&n[o]?c=n[o]:!r&&n[h]&&(c=n[h]),!c&&n[s]&&(c=n[s]),c&&c.template?{template:c.template,alignment:c.alignment,templateLayerMode:c.templateLayerMode,documentTemplate:e.template}:null},i.prototype._getTemplateAlignmentPosition=function(e,i,r,n,s){var a,o,h=this._templateSideToString(n),c=h.charAt(0).toUpperCase()+h.slice(1),_="odd"+c,d="even"+c,u=h;if(!(o=s&&i[_]?i[_]:!s&&i[d]?i[d]:i[u]))return{x:0,y:0,width:0,height:0};var l=o.template;if(void 0!==r&&r!==t.PdfTemplateVerticalAlignment.none&&r!==t.PdfTemplateHorizontalAlignment.none)a=this._getAlignmentBounds(n,l,e,r);else{var f=this._templateSideToString(n);a=this._getTemplateDockBounds(e,l,f)}return a},i.prototype._getAlignmentBounds=function(t,e,i,r){var n=this._mapTemplateAlignmentStyle(t,r);return this._getTemplateAlignmentBounds(e,i,n,t)},i.prototype._templateSideToString=function(e){switch(e){case t._TemplateSide.top:return"top";case t._TemplateSide.bottom:return"bottom";case t._TemplateSide.left:return"left";case t._TemplateSide.right:return"right";default:return"top"}},i.prototype._normalizeTemplateSide=function(e){if(e===t._TemplateSide.top||e===t._TemplateSide.bottom||e===t._TemplateSide.left||e===t._TemplateSide.right)return e;switch(e){case t._PdfDocumentTemplateKey.top:case t._PdfDocumentTemplateKey.evenTop:case t._PdfDocumentTemplateKey.oddTop:return t._TemplateSide.top;case t._PdfDocumentTemplateKey.bottom:case t._PdfDocumentTemplateKey.evenBottom:case t._PdfDocumentTemplateKey.oddBottom:return t._TemplateSide.bottom;case t._PdfDocumentTemplateKey.left:case t._PdfDocumentTemplateKey.evenLeft:case t._PdfDocumentTemplateKey.oddLeft:return t._TemplateSide.left;case t._PdfDocumentTemplateKey.right:case t._PdfDocumentTemplateKey.evenRight:case t._PdfDocumentTemplateKey.oddRight:default:return t._TemplateSide.right}},i.prototype._mapTemplateAlignmentStyle=function(e,i){var r=this._normalizeTemplateSide(e);if(void 0===i||i===t.PdfTemplateHorizontalAlignment.none||i===t.PdfTemplateVerticalAlignment.none)switch(r){case t._TemplateSide.top:case t._TemplateSide.left:return t._PdfAlignmentStyle.topLeft;case t._TemplateSide.bottom:return t._PdfAlignmentStyle.bottomLeft;case t._TemplateSide.right:return t._PdfAlignmentStyle.topRight}if(r===t._TemplateSide.top||r===t._TemplateSide.bottom){var n=r===t._TemplateSide.top;switch(i){case t.PdfTemplateHorizontalAlignment.center:return n?t._PdfAlignmentStyle.topCenter:t._PdfAlignmentStyle.bottomCenter;case t.PdfTemplateHorizontalAlignment.right:return n?t._PdfAlignmentStyle.topRight:t._PdfAlignmentStyle.bottomRight;case t.PdfTemplateHorizontalAlignment.left:default:return n?t._PdfAlignmentStyle.topLeft:t._PdfAlignmentStyle.bottomLeft}}if(r===t._TemplateSide.left||r===t._TemplateSide.right){var s=r===t._TemplateSide.left;switch(i){case t.PdfTemplateVerticalAlignment.middle:return s?t._PdfAlignmentStyle.middleLeft:t._PdfAlignmentStyle.middleRight;case t.PdfTemplateVerticalAlignment.bottom:return s?t._PdfAlignmentStyle.bottomLeft:t._PdfAlignmentStyle.bottomRight;case t.PdfTemplateVerticalAlignment.top:default:return s?t._PdfAlignmentStyle.topLeft:t._PdfAlignmentStyle.topRight}}return t._PdfAlignmentStyle.topLeft},i.prototype._getTemplateAlignmentBounds=function(e,i,r,n){var s,a=e._bounds;if(i._isNew&&(s=i._getActualTemplateBounds(i._pageSettings)),s&&s.length>0){var o=e._bounds.x,h=e._bounds.y;switch(r){case t._PdfAlignmentStyle.topLeft:o=-s[0],h=n===t._TemplateSide.top?-s[1]:0;break;case t._PdfAlignmentStyle.topCenter:o=(s[2]-e._bounds.width)/2,h=-s[1];break;case t._PdfAlignmentStyle.topRight:o=s[2]+this._getRightIndentWidth(i,!1)-e._bounds.width,h=n===t._TemplateSide.top?-s[1]:0;break;case t._PdfAlignmentStyle.middleLeft:o=-s[0],h=(s[3]-e._bounds.height)/2;break;case t._PdfAlignmentStyle.middleCenter:o=(s[2]-e._bounds.width)/2,h=(s[3]-e._bounds.height)/2;break;case t._PdfAlignmentStyle.middleRight:o=s[2]+this._getRightIndentWidth(i,!1)-e._bounds.width,h=(s[3]-e._bounds.height)/2;break;case t._PdfAlignmentStyle.bottomLeft:o=-s[0],h=n===t._TemplateSide.bottom?s[3]+this._getBottomIndentHeight(i,!1)-e._bounds.height:s[3]-e._bounds.height;break;case t._PdfAlignmentStyle.bottomCenter:o=(s[2]-e._bounds.width)/2,h=s[3]+this._getBottomIndentHeight(i,!1)-e._bounds.height;break;case t._PdfAlignmentStyle.bottomRight:o=s[2]+this._getRightIndentWidth(i,!1)-e._bounds.width,h=n===t._TemplateSide.bottom?s[3]+this._getBottomIndentHeight(i,!1)-e._bounds.height:s[3]-e._bounds.height}a.x=o,a.y=h}return a},i.prototype._isNonReservingTemplate=function(e){return void 0!==e&&(e===t.PdfTemplateLayerMode.background||e===t.PdfTemplateLayerMode.foreground)},i.prototype._getLeftIndentWidth=function(t,e){var i=0;e&&(i+=t._pageSettings.margins.left);var r=t._crossReference._document.template;if(r){var n=((t._pageIndex?t._pageIndex:0)+1)%2==0,s=[];r.left&&!this._isNonReservingTemplate(r.left.templateLayerMode)&&s.push(r.left.template._bounds.width),n&&r.evenLeft&&!this._isNonReservingTemplate(r.evenLeft.templateLayerMode)&&s.push(r.evenLeft.template._bounds.width),n||!r.oddLeft||this._isNonReservingTemplate(r.oddLeft.templateLayerMode)||s.push(r.oddLeft.template._bounds.width),s.length>0&&(i+=Math.max.apply(Math,s))}return i},i.prototype._getTopIndentHeight=function(t,e){var i=0;e&&(i+=t._pageSettings.margins.top);var r=t._crossReference._document.template;if(r){var n=((t._pageIndex?t._pageIndex:0)+1)%2==0,s=[];r.top&&!this._isNonReservingTemplate(r.top.templateLayerMode)&&s.push(r.top.template._bounds.height),n&&r.evenTop&&!this._isNonReservingTemplate(r.evenTop.templateLayerMode)&&s.push(r.evenTop.template._bounds.height),n||!r.oddTop||this._isNonReservingTemplate(r.oddTop.templateLayerMode)||s.push(r.oddTop.template._bounds.height),s.length>0&&(i+=Math.max.apply(Math,s))}return i},i.prototype._getRightIndentWidth=function(t,e){var i=0;e&&(i+=t._pageSettings.margins.right);var r=t._crossReference._document.template;if(r){var n=((t._pageIndex?t._pageIndex:0)+1)%2==0,s=[];r.right&&!this._isNonReservingTemplate(r.right.templateLayerMode)&&s.push(r.right.template._bounds.width),n&&r.evenRight&&!this._isNonReservingTemplate(r.evenRight.templateLayerMode)&&s.push(r.evenRight.template._bounds.width),n||!r.oddRight||this._isNonReservingTemplate(r.oddRight.templateLayerMode)||s.push(r.oddRight.template._bounds.width),s.length>0&&(i+=Math.max.apply(Math,s))}return i},i.prototype._getBottomIndentHeight=function(t,e){var i=0;e&&(i+=t._pageSettings.margins.bottom);var r=t._crossReference._document.template;if(r){var n=((t._pageIndex?t._pageIndex:0)+1)%2==0,s=[];r.bottom&&!this._isNonReservingTemplate(r.bottom.templateLayerMode)&&s.push(r.bottom.template._bounds.height),n&&r.evenBottom&&!this._isNonReservingTemplate(r.evenBottom.templateLayerMode)&&s.push(r.evenBottom.template._bounds.height),n||!r.oddBottom||this._isNonReservingTemplate(r.oddBottom.templateLayerMode)||s.push(r.oddBottom.template._bounds.height),s.length>0&&(i+=Math.max.apply(Math,s))}return i},i.prototype._getTemplateDockBounds=function(t,e,i){var r,n,s=e._bounds;if(t._isNew&&(r=t._getActualTemplateBounds(t._pageSettings),n=t._pageSettings._getActualSize()),r&&r.length>0&&n&&n.length>0){var a=e._bounds.x,o=e._bounds.y,h=e._bounds.width,c=e._bounds.height,_=this._getTopIndentHeight(t,!1),d=this._getBottomIndentHeight(t,!1);switch(i){case"left":a=-r[0],o=_>0?_:0,h=e._bounds.width,c=r[3]-_-d;break;case"top":a=-r[0],o=-r[1],h=n[0],c=e._bounds.height,r[3]<0&&(o=-r[1]+n[1]);break;case"right":a=r[2]+this._getRightIndentWidth(t,!1)-e._bounds.width,o=_>0?_:0,h=e._bounds.width,c=r[3]-_-d;break;case"bottom":a=-r[0],o=r[3]+this._getBottomIndentHeight(t,!1)-e._bounds.height,h=n[0],c=e._bounds.height,r[3]<0&&(o-=n[1])}s={x:a,y:o,width:h,height:c}}return s},i.prototype._doPostProcessOnFormFields=function(t){if(void 0===t&&(t=!1),this._catalog._catalogDictionary.has("AcroForm")){if(this.form._doPostProcess(t),this.form._requiresPostProcessing=!1,t){var e=this._catalog._catalogDictionary.getRaw("AcroForm"),i=new Ts(this._crossReference);i._updated=!0,e instanceof Ss?this._crossReference._cacheMap.set(e,i):(this.form._dictionary=i,this._crossReference._allowCatalog=!0),this.form._clear()}this.form._isDefaultAppearance?this.form._dictionary.update("NeedAppearances",this.form._isDefaultAppearance):!this.form._isDefaultAppearance&&this.form._dictionary.has("NeedAppearances")&&this.form._isNeedAppearances?this.form._dictionary.update("NeedAppearances",!1):!this.form._isDefaultAppearance&&this.form._dictionary.has("NeedAppearances")&&this.form._dictionary.update("NeedAppearances",this.form.needAppearances)}},i.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())}},i.prototype._addWatermarkText=function(){for(var t=0;t<this.pageCount;t++)this._addLincenseWaterMark(this.getPage(t),0===t,t===this.pageCount-1)},i.prototype._addLincenseWaterMark=function(e,i,r){var n="Created with a trial version of Syncfusion PDF library.",s=new Ei(t.PdfTextAlignment.center,t.PdfVerticalAlignment.middle),a=14,o=e.graphics,h=o.clientSize;e.size.width<400&&(a=.035*e.size.width);var c=new xr(t.PdfFontFamily.helvetica,a,t.PdfFontStyle.regular);i?this._drawWatermarkOnPage(e,c,o,!1):r&&this._drawWatermarkOnPage(e,c,o,!0);var _=c.measureString(n,h.width),d=h.width/2,u=h.height/2;if(o.save(),e._isNew||e.rotation!==t.PdfRotationAngle.angle90?o.translateTransform({x:d,y:u}):o.translateTransform({x:u,y:d}),o.setTransparency(.5),e._isNew)switch(e.rotation){case t.PdfRotationAngle.angle90:o.rotateTransform(-135);break;case t.PdfRotationAngle.angle180:o.rotateTransform(-225);break;case t.PdfRotationAngle.angle270:o.rotateTransform(-315);break;default:o.rotateTransform(-45)}else o.rotateTransform(-45);var l=_.width/2,f=_.height/2,p=d-l;o.drawString(n,c,{x:-l,y:-f/2,width:h.width-(p+p),height:_.height},new Qn({r:255,g:0,b:0}),s),o.restore(),o.restore()},i.prototype._drawWatermarkOnPage=function(e,i,r,n){var s="Created with a trial version of Syncfusion PDF library or registered the wrong key in your application. To obtain the valid key, Click",a=e.rotation,o=!e._isNew||a!==t.PdfRotationAngle.angle270&&a!==t.PdfRotationAngle.angle90?{width:r.clientSize.width-70,height:r.clientSize.height}:{width:r.clientSize.width,height:r.clientSize.height-70};e._isNew||a!==t.PdfRotationAngle.angle270&&a!==t.PdfRotationAngle.angle90||(o={width:e.size.height-70,height:e.size.width});var h=new Ei;h._wordWrap=t._PdfWordWrapType.word;var c=new Qn({r:255,g:0,b:0}),_=new Qn({r:0,g:0,b:255}),d=i.measureString(s),u=i.measureString("here"),l=d.height,f=!e._isNew||a!==t.PdfRotationAngle.angle270&&a!==t.PdfRotationAngle.angle90?o.width:o.height,p=a===t.PdfRotationAngle.angle90&&e._isNew?-30:40,g=n?(!e._isNew||a!==t.PdfRotationAngle.angle270&&a!==t.PdfRotationAngle.angle90?o.height:o.width)-(e.orientation===t.PdfPageOrientation.landscape&&420===e.size.width||420===e.size.height?4*l:3*l)-10:10;e._isNew&&e.rotation!==t.PdfRotationAngle.angle0&&(r.save(),a===t.PdfRotationAngle.angle90?r.rotateTransform(-90):a===t.PdfRotationAngle.angle180?r.rotateTransform(-180):a===t.PdfRotationAngle.angle270&&r.rotateTransform(-270));var y=function(i){if(e._isNew){if(a===t.PdfRotationAngle.angle90)return{x:-(o.height-i.x),y:i.y,width:i.height-40,height:i.width};if(a===t.PdfRotationAngle.angle180)return{x:-(r.clientSize.width-i.x),y:-(o.height-i.y),width:i.width-40,height:i.height};if(a===t.PdfRotationAngle.angle270)return{x:i.x,y:-(o.width-i.y),width:i.height-40,height:i.width}}return i},m=y({x:p,y:g,width:o.width,height:o.height});r.drawString(s,i,m,c,h);var b=(new Gi)._layout(s,i,h,[m.width,m.height]),v=b._layoutLines;p+=v[v.length-1]._width+5,b._lineCount>=2&&(g+=b._lineHeight*(b._lineCount-1)),p+u.width>f&&(p=40,g+=b._lineHeight);var w={x:p,y:g,width:u.width,height:u.height},S=y(w);S.width+=70,r.drawString("here",i,S,_,h),S.width-=70;var x;if(e._isNew)switch(a){case t.PdfRotationAngle.angle0:x=Mh({},w);break;case t.PdfRotationAngle.angle90:x={x:w.y,y:o.height-w.x-w.width,width:w.height,height:w.width};break;case t.PdfRotationAngle.angle180:x={x:o.width-w.x+40,y:o.height-w.y-w.height,width:w.width,height:w.height};break;case t.PdfRotationAngle.angle270:x={x:o.width-w.y-w.height,y:w.x,width:w.height,height:w.width}}else switch(a){case t.PdfRotationAngle.angle0:x=Mh({},w);break;case t.PdfRotationAngle.angle90:x={x:w.y,y:e.size.height-w.x-w.width,width:w.height,height:w.width};break;case t.PdfRotationAngle.angle180:x={x:e.size.width-w.x-w.width,y:e.size.height-w.y-w.height,width:w.width,height:w.height};break;case t.PdfRotationAngle.angle270:x={x:e.size.width-w.y-w.height,y:w.x,width:w.height,height:w.width}}var P=new un(x,"http://www.syncfusion.com");P.border.width=0,P.border.hRadius=0,P.border.vRadius=0,e.annotations.add(P),P._doPostProcess(),e.rotation!==t.PdfRotationAngle.angle0&&e._isNew?r.restore():r.save()},i.prototype.importPageRange=function(t,e,i,r){if(e>i||e>=t.pageCount)throw new Error("The start index is greater then the end index, which might indicate the error in the program.");this._importPages(t,e,i,r)},i.prototype._importPages=function(t,i,r,n){e.initializeTelemetryFeature("MergePDF","PDFLibrary");var s,a,o=0;if(void 0!==n&&"number"==typeof n.targetIndex){if(n.targetIndex>this.pageCount)throw new Error("The target index is out of range.");this._targetIndex=n.targetIndex}var h=new Map;if(!this._isDuplicatePage)for(var c=Math.max(0,i),_=Math.min(r,t.pageCount-1),d=c;d<=_;d++){var u=t.getPage(d);h.set(u._pageDictionary,null)}var l;this._mergeHelperCache||(this._mergeHelperCache=new Map),t._uniqueID||(t._uniqueID=it()),this._mergeHelperCache.has(t._uniqueID)?l=this._mergeHelperCache.get(t._uniqueID):(l=new yo(this._crossReference,this,t,h,n),this._mergeHelperCache.set(t._uniqueID,l));var f=!1;t._catalog._catalogDictionary.has("OCProperties")&&(!this._isDuplicatePage||n&&!n.optimizeResources)&&(f=!0,s=t._catalog._catalogDictionary.get("OCProperties"),a=new Ts(this._crossReference),l._writeObject(t,a,s,s,"OCProperties",null,null),a._updated=!0);for(var p=t.flatten,g=t._isSplitDocument,y=i;y<=r;y++){var m=t.getPage(y);t.form._doPostProcess(p,m),m.annotations.count>0&&(m.annotations._doPostProcess(p),p&&(m._pageDictionary.has("Annots")&&(delete m._pageDictionary._map.Annots,m._pageDictionary._updated=!0),m.annotations._clear())),g?l._importPages(m,this._targetIndex,f,this._isDuplicatePage,n,g):l._importPages(m,this._targetIndex,f,this._isDuplicatePage,n),o++,"number"==typeof this._targetIndex&&++this._targetIndex}this._isDuplicatePage||l._fixDestinations(t),l._exportBookmarks(t,o),l._mergeFormFieldsWithDocument(),f&&(!this._isDuplicatePage||n&&!n.optimizeResources)&&l._importLayers(a,!0),l._objectDispose(),this._isDuplicatePage=!1},i.prototype.importPage=function(t,e,r){if("number"==typeof t)this._isDuplicatePage=!0,e instanceof go?this._importPages(this,t,t,e):this._importPages(this,t,t);else if(t instanceof zn&&e instanceof i){var n=t._pageIndex;this.importPageRange(e,n,n,r)}},i.prototype.split=function(){this.splitByFixedNumber(1)},i.prototype.splitByFixedNumber=function(t){var e=this.pageCount;if(!(this.splitEvent&&e>=t&&t>0))throw new Error("Invalid split number. Split number should be greater than zero and less than or equal to page count.");for(var i=0,r=0;r<e;r+=t){var n=Math.min(r+t-1,e-1),s=this._importDocumentPages(r,n);this._invokeSplitEvent(i,s),i++}},i.prototype.splitByPageRanges=function(t){var e=this,i=this.pageCount;if(this.splitEvent){var r=0;t.forEach(function(t){if(Array.isArray(t)&&t.length<2)throw new Error("Invalid page range. Start and end page indexes should be specified.");var n=t[0],s=t[1];if(n<0||s<0||n>=i||s>=i||n>s)throw new Error("Invalid page range: start ("+n+") and end ("+s+").");var a=e._importDocumentPages(n,s);e._invokeSplitEvent(r,a),r++})}},i.prototype._importDocumentPages=function(t,e){this._isSplitDocument=!0;for(var r=new i,n=t;n<=e;n++){var s=this.getPage(n);r.importPage(s,this)}var a=r.save();return r.destroy(),a},i.prototype._invokeSplitEvent=function(t,i){e.initializeTelemetryFeature("SplitPDF","PDFLibrary");var r=new Wh(t,i);this.splitEvent(this,r)},i.prototype._getSignature=function(t,e){var i=new yh;return i._initializeInternals(t,e),i},i.prototype._hasTemplateContent=function(){return!!this._template&&(null!==this._template.oddTop&&void 0!==this._template.oddTop||null!==this._template.evenTop&&void 0!==this._template.evenTop||null!==this._template.oddBottom&&void 0!==this._template.oddBottom||null!==this._template.evenBottom&&void 0!==this._template.evenBottom||null!==this._template.left&&void 0!==this._template.left||null!==this._template.oddLeft&&void 0!==this._template.oddLeft||null!==this._template.evenLeft&&void 0!==this._template.evenLeft||null!==this._template.right&&void 0!==this._template.right||null!==this._template.oddRight&&void 0!==this._template.oddRight||null!==this._template.evenRight&&void 0!==this._template.evenRight||null!==this._template.top&&void 0!==this._template.top||null!==this._template.bottom&&void 0!==this._template.bottom)},Object.defineProperty(i.prototype,"_hasTemplateContentValue",{get:function(){return this._hasTemplateContent()},enumerable:!0,configurable:!0}),i}(),Vh=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}(),zh=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}(),Uh=function(){function e(e){this._size={width:595,height:842},this._isOrientation=!1,e&&"orientation"in e&&null!==e.orientation&&void 0!==e.orientation?this.orientation=e.orientation:this._orientation=t.PdfPageOrientation.portrait,e&&"size"in e&&null!==e.size&&void 0!==e.size?this.size=e.size:this._size={width:595,height:842},e&&"margins"in e&&null!==e.margins&&void 0!==e.margins?this.margins=e.margins:this._margins=new Hh,e&&"rotation"in e&&null!==e.rotation&&void 0!==e.rotation?this.rotation=e.rotation: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;"number"!=typeof e&&"width"in e&&"height"in e&&void 0!==e.width&&void 0!==e.height?(i=this.orientation,r=e):(i=e,r=this._size),i===t.PdfPageOrientation.portrait?this._size={width:Math.min(r.width,r.height),height:Math.max(r.width,r.height)}:this._size={width:Math.max(r.width,r.height),height:Math.min(r.width,r.height)}},e.prototype._updateOrientation=function(){this._orientation=this._size.height>=this._size.width?t.PdfPageOrientation.portrait:t.PdfPageOrientation.landscape},e.prototype._getActualSize=function(){return[this._size.width-(this._margins._left+this._margins._right),this._size.height-(this._margins._top+this._margins._bottom)]},e}(),Hh=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}(),Wh=function(){function t(t,e){this._index=t,this._pdfData=e}return Object.defineProperty(t.prototype,"pdfData",{get:function(){return this._pdfData},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),t}(),qh=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}(),Gh=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)}}(),Kh=function(e){function i(t){var i=e.call(this)||this;return i._imageStatus=!0,i._initializeAsync(t),i}return Gh(i,e),i.prototype._initializeAsync=function(t){var e=new Uint8Array(t.length);null!==t&&void 0!==t&&"string"==typeof t?e=R(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 _s){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 _s){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",vs.get("DeviceCMYK"));break;case t._PdfColorSpace.grayScale:i.update("Decode",[0,1]),i.update("ColorSpace",vs.get("DeviceGray"));break;case t._PdfColorSpace.rgb:i.update("Decode",[0,1,0,1,0,1]),i.update("ColorSpace",vs.get("DeviceRGB"));break;case t._PdfColorSpace.indexed:i.update("ColorSpace",this._decoder._colorSpace)}},i}(qn),Xh=function(){function t(t){this._bounds={x:0,y:0,width:t.width,height:t.height}}return Object.defineProperty(t.prototype,"graphics",{get:function(){return this._template||(this._template=new Mi(this._bounds,this._page?this._page._crossReference:void 0)),this._template.graphics},enumerable:!0,configurable:!0}),t.prototype._draw=function(t,e,i,r,n){this._template&&t.drawTemplate(this._template,{x:e,y:i,width:r,height:n})},t}(),Jh=function(){function t(){}return t.prototype.draw=function(t,e){this._draw(t,e)},t.prototype._draw=function(t,e){this._bounds.x=e.x,this._bounds.y=e.y;var i=t.save();try{e&&t.translateTransform(e),this._drawInternal(t)}finally{t.restore(i)}},t}(),Yh=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)}}(),Qh=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Yh(i,e),i.prototype._initializeBase=function(t,e,i){null!==t&&void 0!==t&&(this._font=t),null!==e&&void 0!==e&&(this._brush=e),null!==i&&void 0!==i&&(this._stringFormat=i)},i.prototype._draw=function(t,e){this._performDraw(t,e)},i.prototype._performDraw=function(t,e){if(!this._bounds||0===this._bounds.width||0===this._bounds.height){var i=this._getValue(t),r=this._obtainFont(),n=this._stringFormat?this._stringFormat:new Ei,s=r.measureString(i,n);this._size={width:s.width,height:s.height}}},i.prototype._obtainSize=function(){var t=0,e=0;return this._bounds&&void 0!==this._bounds.width?t=this._bounds.width:this._size&&void 0!==this._size.width&&(t=this._size.width),this._bounds&&void 0!==this._bounds.height?e=this._bounds.height:this._size&&void 0!==this._size.height&&(e=this._size.height),{width:t,height:e}},i.prototype._drawInternal=function(t){var e=this._getValue(t),i=this._obtainFont(),r=this._obtainBrush(),n=this._obtainSize();t.drawString(e,i,{x:this._bounds.x,y:this._bounds.y,width:n.width,height:n.height},r)},i.prototype._obtainBrush=function(){return this._brush?this._brush:new Qn({r:0,g:0,b:0})},i.prototype._obtainFont=function(){return this._font?this._font:new xr(t.PdfFontFamily.helvetica,8)},i}(Jh),Zh=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)}}(),$h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Zh(e,t),e.prototype._initializeBase=function(e,i,r){t.prototype._initializeBase.call(this,e,i,r)},e.prototype._getPageFromGraphics=function(t){return t._page},e}(Qh),tc=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)}}(),ec=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._templateValueMap=new Map,e}return tc(e,t),e.prototype._initializeBase=function(e,i,r){t.prototype._initializeBase.call(this,e,i,r)},e.prototype._performDraw=function(e,i){t.prototype._performDraw.call(this,e,i);var r=this._getValue(e),n=this._templateValueMap.get(e);if(!n||n.value!==r){var s=this._obtainFont(),a=this._obtainBrush(),o=this._obtainSize(),h=new Mi({x:0,y:0,width:o.width,height:o.height});r&&h.graphics.drawString(r,s,{x:0,y:0,width:o.width,height:o.height},a),n={template:h,value:r},this._templateValueMap.set(e,n)}var c=this._obtainSize(),_={x:i.x,y:i.y,width:c.width,height:c.height};e.drawTemplate(n.template,_)},e.prototype._getValue=function(t){return""},e}($h),ic=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)}}(),rc=function(t){function e(e){var i=t.call(this)||this;return i._automaticFields=[],i._pattern="",e&&(i._initializeBase(e.font,e.brush,e.stringFormat),i._pattern=e.pattern||"",i._automaticFields=e.automaticFields||[]),i}return ic(e,t),Object.defineProperty(e.prototype,"automaticFields",{get:function(){return this._automaticFields},set:function(t){this._automaticFields=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pattern",{get:function(){return this._pattern},set:function(t){this._pattern=t},enumerable:!0,configurable:!0}),e.prototype._getValue=function(t){for(var e=[],i=0,r=this._automaticFields;i<r.length;i++){var n=r[i];e.push(n._getValue(t))}for(var s=this._pattern,a=0;a<e.length;a++)s=s.replace("{"+a+"}",e[a]);return s},e}(ec),nc=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)}}(),sc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nc(e,t),e.prototype._initializeBase=function(e,i,r){t.prototype._initializeBase.call(this,e,i,r)},e.prototype._performDraw=function(e,i){t.prototype._performDraw.call(this,e,i);var r=this._getValue(e),n=this._getPageFromGraphics(e),s=n&&n._crossReference?n._crossReference._document:null;if(!this._template||this._cachedValue!==r||this._cachedDocument!==s){var a=this._obtainFont(),o=this._obtainBrush(),h=this._obtainSize(),c=new Mi({x:0,y:0,width:h.width,height:h.height});c.graphics.drawString(r,a,{x:0,y:0,width:h.width,height:h.height},o),this._template=c,this._cachedValue=r,this._cachedDocument=s}var _=this._obtainSize(),d={x:i.x,y:i.y,width:_.width,height:_.height};e.drawTemplate(this._template,d)},e.prototype._getValue=function(t){return""},e}($h),ac=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)}}(),oc=function(t){function e(e){var i=t.call(this)||this;return i._formatString="yyyy/MM/dd HH:mm:ss",e&&(i._initializeBase(e.font,e.brush,e.stringFormat),e.dateFormat&&(i._formatString=e.dateFormat)),i}return ac(e,t),Object.defineProperty(e.prototype,"dateFormatString",{get:function(){return this._formatString},set:function(t){this._formatString=t},enumerable:!0,configurable:!0}),e.prototype._getValue=function(t){var e=this._getPageFromGraphics(t)._crossReference._document;if(e){var i=e.getDocumentInformation();if(i){var r=i.creationDate;return this._formatDate(r,this._formatString)}}return(new Date).toISOString()},e.prototype._formatDate=function(t,e){var i=t.getFullYear(),r=Ye(String(t.getMonth()+1),2,"0"),n=Ye(String(t.getDate()),2,"0"),s=Ye(String(t.getHours()),2,"0"),a=Ye(String(t.getMinutes()),2,"0"),o=Ye(String(t.getSeconds()),2,"0");return e.replace("yyyy",String(i)).replace("MM",r).replace("dd",n).replace("HH",s).replace("mm",a).replace("ss",o)},e}(sc),hc=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)}}(),cc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._hasRendered=!1,e}return hc(e,t),e.prototype._initializeBase=function(e,i,r){t.prototype._initializeBase.call(this,e,i,r)},e.prototype._performDraw=function(e,i){if(t.prototype._performDraw.call(this,e,i),!this._template){var r=this._getValue(e),n=this._obtainFont(),s=this._obtainBrush(),a=this._obtainSize(),o=new Mi({x:0,y:0,width:a.width,height:a.height});o.graphics.drawString(r,n,{x:0,y:0,width:a.width,height:a.height},s),this._template=o}var h=this._obtainSize(),c={x:i.x,y:i.y,width:h.width,height:h.height};e.drawTemplate(this._template,c)},e.prototype._getValue=function(t){return""},e}(Qh),_c=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)}}(),dc=function(t){function e(e){var i=t.call(this)||this;return i._formatString="yyyy/MM/dd",e&&i._initializeBase(e.font,e.brush,e.stringFormat),i._date=new Date,i}return _c(e,t),e.prototype._getValue=function(t){return this._formatDate(this._date,this._formatString)},e.prototype._formatDate=function(t,e){var i=t.getFullYear(),r=Ye(String(t.getMonth()+1),2,"0"),n=Ye(String(t.getDate()),2,"0");return e.replace("yyyy",String(i)).replace("MM",r).replace("dd",n)},e}(cc),uc=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)}}(),lc=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._numberStyle=t.PdfNumberStyle.numeric,i}return uc(i,e),i.prototype._initializeBase=function(t,i,r){e.prototype._initializeBase.call(this,t,i,r)},Object.defineProperty(i.prototype,"numberStyle",{get:function(){return this._numberStyle},set:function(t){this._numberStyle=t},enumerable:!0,configurable:!0}),i.prototype._getValue=function(t){return""},i}(ec),fc=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)}}(),pc=function(t){function e(e){var i=t.call(this)||this;return e&&(i._initializeBase(e.font,e.brush,e.stringFormat),e.numberStyle&&(i._numberStyle=e.numberStyle)),i}return fc(e,t),e.prototype._getValue=function(t){if(t){var e=this._getPageFromGraphics(t);if(e&&e._crossReference&&e._crossReference._document)return Ze(e._pageIndex+1,this._numberStyle)}return"1"},e.prototype._internalLoadedGetValue=function(t){return t?Ze(t._pageIndex+1,this._numberStyle):"1"},e}(lc),gc=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)}}(),yc=function(t){function e(e){var i=t.call(this,e)||this;return e&&e.page&&(i._page=e.page),i}return gc(e,t),Object.defineProperty(e.prototype,"page",{get:function(){return this._page},set:function(t){this._page=t},enumerable:!0,configurable:!0}),e.prototype._getValue=function(t){return this._page?this._internalLoadedGetValue(this._page):"1"},e}(pc),mc=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)}}(),bc=function(t){function e(e){var i=t.call(this)||this;return e&&i._initializeBase(e.font,e.brush,e.stringFormat),i}return mc(e,t),e.prototype._getValue=function(t){var e=this._getPageFromGraphics(t);if(e&&e._crossReference&&e._crossReference._document){var i=e._crossReference._document.getDocumentInformation();if(i&&i.author)return i.author}return""},e}(sc),vc=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)}}(),wc=function(e){function i(i){var r=e.call(this)||this;return r._numberStyle=t.PdfNumberStyle.numeric,i&&(r._initializeBase(i.font,i.brush,i.stringFormat),i.numberStyle&&(r._numberStyle=i.numberStyle)),r}return vc(i,e),Object.defineProperty(i.prototype,"numberStyle",{get:function(){return this._numberStyle},set:function(t){this._numberStyle=t},enumerable:!0,configurable:!0}),i.prototype._getValue=function(t){if(t){var e=this._getPageFromGraphics(t);if(e&&e._crossReference&&e._crossReference._document)return Ze(e._crossReference._document.pageCount,this._numberStyle)}return"1"},i}(sc),Sc=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)}}(),xc=function(t){function e(e){var i=t.call(this)||this;return e&&(i._initializeBase(e.font,e.brush,e.stringFormat),e.numberStyle&&(i._numberStyle=e.numberStyle)),i}return Sc(e,t),e.prototype._getValue=function(t){var e=this._getPageFromGraphics(t);if(e&&e._pageDictionary){var i=e._getSectionIndex();if(i>=0)return Ze(i+1,this._numberStyle)}return Ze(1,this._numberStyle)},e}(lc),Pc=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)}}(),Ac=function(t){function e(e){var i=t.call(this)||this;return e&&(i._initializeBase(e.font,e.brush,e.stringFormat),e.numberStyle&&(i._numberStyle=e.numberStyle)),i}return Pc(e,t),e.prototype._getValue=function(t){if(t){var e=this._getPageFromGraphics(t);if(!e)return Ze(1,this._numberStyle);var i=e._getSectionIndex();if(i<0)return Ze(1,this._numberStyle);var r=e._crossReference._document._sections[i];if(r)return Ze(r._pageCount,this._numberStyle)}return Ze(1,this._numberStyle)},e}(lc),Tc=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)}}(),Cc=function(t){function e(e){var i=t.call(this)||this;return e&&(i._initializeBase(e.font,e.brush,e.stringFormat),e.numberStyle&&(i._numberStyle=e.numberStyle)),i}return Tc(e,t),e.prototype._getValue=function(t){if(t){var e=this._getPageFromGraphics(t);if(!e||!e._pageDictionary)return Ze(1,this._numberStyle);var i=e._ref,r=e._pageDictionary.getRaw("Parent");if(!i||!r)return Ze(1,this._numberStyle);var n=e._crossReference._fetch(r);if(!n||!n.has("Kids"))return Ze(1,this._numberStyle);var s=n.get("Kids");if(!Array.isArray(s))return Ze(1,this._numberStyle);for(var a=0;a<s.length;a++){var o=s[a];if(o&&o.objectNumber===i.objectNumber)return Ze(a+1,this._numberStyle)}}return Ze(1,this._numberStyle)},e}(lc),kc=function(){function t(t,e){if(this._textIndent=0,null===t||void 0===t)throw new Error("Text cannot be null or undenfied.");this._text=t,e&&(e.font&&(this._font=e.font),e.format&&(this._stringFormat=e.format),e.pen&&(this._pen=e.pen),e.brush&&(this._brush=e.brush))}return Object.defineProperty(t.prototype,"brush",{get:function(){return this._brush},set:function(t){this._brush=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pen",{get:function(){return this._pen},set:function(t){this._pen=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stringFormat",{get:function(){return this._stringFormat},set:function(t){this._stringFormat=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textIndent",{get:function(){return this._textIndent},set:function(t){this._textIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subList",{get:function(){return this._subList},set:function(t){this._subList=t},enumerable:!0,configurable:!0}),t}(),Rc=function(){function t(t){var e=this;this._listItems||(this._listItems=[]),t&&t.forEach(function(t){e.add(new kc(t))})}return Object.defineProperty(t.prototype,"count",{get:function(){return this._listItems.length},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){if(!t)throw new Error("item should not be null");this._listItems.push(t),e&&(t.textIndent=e)},t.prototype.at=function(t){if(null===t)throw new Error("index should not be null");return this._listItems[t]},t.prototype.remove=function(t){if(!t)throw new Error("item should not be null");for(var e=!1,i=0;i<this._listItems.length;i++)if(this._listItems[i]===t){e=!0,this._listItems.splice(i,1);break}if(!e)throw new Error("item collection does not contain the given content")},t.prototype.removeAt=function(t){if(t<0||t>=this._listItems.length)throw new Error("The index should be less than items count or equal to 0");this._listItems.splice(t,1)},t.prototype.clear=function(){this._listItems=[]},t.prototype.insert=function(t,e,i){if(t<0||t>this._listItems.length)throw new Error("Index should be within the range of items count (inclusive).");if(!e)throw new Error("Item cannot be null.");i&&(e.textIndent=i),this._listItems.splice(t,0,e)},t.prototype.indexOf=function(t){if(!t)throw new Error("Item should be defined.");return this._listItems.indexOf(t)},t}(),Fc=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)}}(),Ic=function(){function e(){this._textIndent=5,this._indent=10,this._alignment=t.PdfListMarkerAlignment.left,this._delimiter=".",this._suffix=".",this._enableHierarchy=!1,this._currentIndex=0,this._size=[0,0],this._defaultFont=new xr(t.PdfFontFamily.helvetica,8)}return Object.defineProperty(e.prototype,"brush",{get:function(){return this._brush},set:function(t){this._brush=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pen",{get:function(){return this._pen},set:function(t){this._pen=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stringFormat",{get:function(){return this._stringFormat},set:function(t){this._stringFormat=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"indent",{get:function(){return this._indent},set:function(t){this._indent=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textIndent",{get:function(){return this._textIndent},set:function(t){this._textIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delimiter",{get:function(){return this._delimiter},set:function(t){this._delimiter=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"suffix",{get:function(){return this._suffix},set:function(t){this._suffix=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableHierarchy",{get:function(){return this._enableHierarchy},set:function(t){this._enableHierarchy=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this._alignment},set:function(t){this._alignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._itemCollection},set:function(t){this._itemCollection=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_markerRightToLeft",{get:function(){return this._alignment===t.PdfListMarkerAlignment.right},enumerable:!0,configurable:!0}),e.prototype.draw=function(t,e,i){if(t instanceof zn){if(t._isNew)return"width"in e&&void 0!==e.width&&"height"in e&&void 0!==e.height?this._drawInternal(t,e.x,e.y,e.width,e.height,i):this._drawInternal(t,e.x,e.y,0,0,i);new Oc(this).layout(t.graphics,[e.x,e.y,0,0])}else new Oc(this).layout(t,[e.x,e.y,0,0])},e.prototype._drawInternal=function(t,e,i,r,n,s){var a=new Vn;return a._page=t,null===r||void 0===r?(a._bounds=[e,i,0,0],a._format=new En):"number"==typeof r?(a._bounds=[e,i,r,n],a._format=s||new En):r instanceof En&&(a._bounds=[e,i,0,0],a._format=r),this._layout(a)},e.prototype._layout=function(t){return new Oc(this).layoutInternal(t)},e}(),Dc=function(e){function i(i,r){var n=e.call(this)||this;return n._startNumber=1,n._itemCollection=i||new Rc,r?(r.font&&(n._font=r.font),r.format&&(n._stringFormat=r.format),r.pen&&(n._pen=r.pen),r.brush&&(n._brush=r.brush),r.style?n._style=r.style:n._style=t.PdfNumberStyle.numeric,r.indent&&(n._indent=r.indent),r.textIndent&&(n._textIndent=r.textIndent),r.alignment&&(n._alignment=r.alignment),r.delimiter&&(n._delimiter=r.delimiter),r.suffix&&(n._suffix=r.suffix)):n._style=t.PdfNumberStyle.numeric,n}return Fc(i,e),Object.defineProperty(i.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"startNumber",{get:function(){return this._startNumber},set:function(t){if(t<=0)throw new Error("Start number should be greater than 0.");this._startNumber=t},enumerable:!0,configurable:!0}),i.prototype._getNumber=function(){return ae(this._startNumber+this._currentIndex,this._style)},i}(Ic),Bc=function(e){function i(i,r){var n=e.call(this)||this;return n._itemCollection=i||new Rc,r?(r.font&&(n._font=r.font),r.format&&(n._stringFormat=r.format),r.pen&&(n._pen=r.pen),r.brush&&(n._brush=r.brush),r.style?n._style=r.style:n._style=t.PdfUnorderedListStyle.disk,r.indent&&(n._indent=r.indent),r.textIndent&&(n._textIndent=r.textIndent),r.alignment&&(n._alignment=r.alignment),r.delimiter&&(n._delimiter=r.delimiter),r.suffix&&(n._suffix=r.suffix)):n._style=t.PdfUnorderedListStyle.disk,n}return Fc(i,e),Object.defineProperty(i.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),i.prototype._getStyledText=function(){switch(this._style){case t.PdfUnorderedListStyle.disk:return"l";case t.PdfUnorderedListStyle.square:return"n";case t.PdfUnorderedListStyle.asterisk:return"]";case t.PdfUnorderedListStyle.circle:return"m";default:return""}},i.prototype._draw=function(t,e,i,r,n){var s=new Mi([0,0,this._size[0],this._size[1]],t._crossReference),a={x:0,y:0,width:0,height:0};n&&(a.x=a.x+n._width,a.y=a.y+n._width),s.graphics.drawString(this._getStyledText(),this._unicodeFont,a,n,r),t.drawTemplate(s,{x:e,y:i,width:s.size.width,height:s.size.height})},i}(Ic),Lc=function(){function t(t,e,i){this._list=t,this._index=e,this._number=i}return t}(),Oc=function(){function e(t){this._indent=0,this._information=[],this._markerMaxWidth=0,this._finish=!1,this._usePaginateBounds=!0,this._resultHeight=0,this._size=[0,0],this._index=0,this._element=t}return e.prototype.layout=function(e,i){this._graphics=e;var r=new Vn;r._bounds=i,r._format=new En,r._format.layout=t.PdfLayoutType.onePage,this.layoutInternal(r)},e.prototype.layoutInternal=function(e){if(this._currentPage=e._page,this._bounds=e._bounds.slice(),this._currentPage){if(0===e._bounds[2]&&0===e._bounds[3]){this._currentPage.graphics._isLayouter=!0;n=this._currentPage.graphics.clientSize;this._bounds[2]=n.width-this._bounds[0],this._bounds[3]=n.height-this._bounds[1]}this._graphics=this._currentPage.graphics}var i=new jn;i.broken=!1,i.y=this._bounds[1],this._curList=this._element,this._indent=this._curList.indent,this._setCurrentParameters(this._curList),this._curList.brush||(this._currentBrush=new Qn({r:0,g:0,b:0})),this._curList.font||(this._currentFont=this._curList._defaultFont),this._curList instanceof Dc&&(this._markerMaxWidth=this._getMarkerMaxWidth(this._curList,this._information));for(var r=e._format.layout===t.PdfLayoutType.onePage;!this._finish&&(i.y=this._bounds[1],i=this._layoutOnPage(i),!r);){if(this._currentPage&&!this._finish&&(this._currentPage=this._getNextPage(this._currentPage)),this._graphics=this._currentPage.graphics,0===e._bounds[2]&&0===e._bounds[3]){this._currentPage.graphics._isLayouter=!0;var n=this._currentPage.graphics.clientSize;this._bounds[2]=n.width-this._bounds[0],this._bounds[3]=n.height-this._bounds[1]}if(e._format&&e._format.usePaginateBounds&&this._usePaginateBounds){var s=e._format._paginateBounds;this._bounds=[s.x,s.y,s.width,s.height]}}this._information=[];var a={x:this._bounds[0],y:i.y,width:this._bounds[2],height:this._resultHeight},o=new Nn(this._currentPage,a);return this._currentFormat&&(this._currentFormat._isList=!1),o},e.prototype._layoutOnPage=function(t){var e=0,i=0,r=this._bounds[1],n=this._bounds[0];for(this._size=[this._bounds[2]-this._indent,this._bounds[3]];;){for(;this._index<this._curList.items.count;++this._index){var s=this._curList.items.at(this._index),a=this._drawItem(t,n,this._curList,this._index,this._indent,this._information,s,e,r);if(t=a.pageResult,e=a.height,r=a.y,i+=e,t.broken)return t;if(t.markerWrote=!1,s.subList&&s.subList.items.count>0){if(this._curList instanceof Dc){var o=this._curList;o._currentIndex=this._index,(h=new Lc(this._curList,this._index,o._getNumber()))._brush=this._currentBrush,h._font=this._currentFont,h._format=this._currentFormat,h._pen=this._currentPen,h._markerWidth=this._markerMaxWidth,this._information.push(h)}else{var h=new Lc(this._curList,this._index);h._brush=this._currentBrush,h._font=this._currentFont,h._format=this._currentFormat,h._pen=this._currentPen,this._information.push(h)}this._curList=s.subList,this._curList instanceof Dc&&(this._markerMaxWidth=this._getMarkerMaxWidth(this._curList,this._information)),this._index=-1,this._indent+=this._curList.indent,this._size[0]=this._size[0]-this._curList.indent,this._setCurrentParameters(s),this._setCurrentParameters(this._curList)}}if(0===this._information.length){this._resultHeight=i,this._finish=!0;break}var c=this._information.pop();this._index=c._index+1,this._indent-=this._curList.indent,this._size[0]=this._size[0]+this._curList.indent,this._markerMaxWidth=c._markerWidth,this._currentBrush=c._brush,this._currentPen=c._pen,this._currentFont=c._font,this._currentFormat=c._format,this._curList=c._list}return t},e.prototype._drawItem=function(e,i,r,n,s,a,o,h,c){var _,d,u=new Gi,l=r.textIndent,f=h+c,p=s+i,g=0,y=this._size.slice(),m=o.text,b=this._currentBrush,v=0;o.brush&&(b=o.brush);var w=this._currentPen;o.pen&&(w=o.pen);var S=this._currentFont;o.font&&(S=o.font);var x=this._currentFormat;if(o.stringFormat&&(x=o.stringFormat),(this._size[0]<=0||this._size[0]<S.size)&&this._currentPage)throw new Error("There is not enough space to layout list.");this._size[1]=this._size[1]-h,e.broken&&(m=e.itemText,d=e.markerText);var P=!0,A=this._createMarkerResult(n,r,a,o);if(A?(r instanceof Dc?(p+=this._markerMaxWidth,e.markerWidth=this._markerMaxWidth):(p+=A._actualSize.width,e.markerWidth=A._actualSize.width),v=A._actualSize.height,this._currentPage&&(P=v<this._size[1]),A._empty&&(P=!1)):(p+=r._size[0],e.markerWidth=r._size[0],v=r._size[1],this._currentPage&&(P=v<this._size[1])),d&&""!==d||(P=!0),m&&P){if(y=this._size.slice(),y[0]=y[0]-e.markerWidth,0===o.textIndent?y[0]=y[0]-l:y[0]=y[0]-o.textIndent,(y[0]<=0||y[0]<S.size)&&this._currentPage)throw new Error("Not enough space to layout the text. The marker is too long or there is not enough space to draw it.");var T=p;r._markerRightToLeft?(T-=e.markerWidth,!x||x.alignment!==t.PdfTextAlignment.right&&x.alignment!==t.PdfTextAlignment.center||(T-=s)):0===o.textIndent?T+=l:T+=o.textIndent,!this._currentPage&&x&&((x=Object.assign({},x)).alignment=t.PdfTextAlignment.left),_=u._layout(m,S,x,y);var C=[T,f,y[0],y[1]];this._graphics._drawStringLayoutResult(_,S,w,b,C,x),c=f,g=_._actualSize.height}if(h=g<v?v:g,_&&_._remainder&&""!==_._remainder||A&&A._remainder&&""!==A._remainder||!P?(c=0,h=0,_?(e.itemText=_._remainder,_._remainder===o.text&&(P=!1)):e.itemText=P?void 0:o.text,e.markerText=A?A._remainder:void 0,e.broken=!0,e.y=0,this._bounds[1]=0):e.broken=!1,_){if(e.markerX=p,x)switch(x.alignment){case t.PdfTextAlignment.right:e.markerX=p+y[0]-_._actualSize.width;break;case t.PdfTextAlignment.center:e.markerX=p+y[0]/2-_._actualSize.width/2}r._markerRightToLeft&&(e.markerX+=_._actualSize.width,0===o.textIndent?e.markerX+=l:e.markerX+=o.textIndent,!x||x.alignment!==t.PdfTextAlignment.right&&x.alignment!==t.PdfTextAlignment.center||(e.markerX-=s))}return P&&!e.markerWrote&&(e.markerWrote=this._drawMarker(r,o,A,f,e.markerX),e.markerWidth=r instanceof Dc?A._actualSize.width:r._size[0]),{pageResult:e,height:h,y:c}},e.prototype._createMarkerResult=function(t,e,i,r){return e instanceof Dc?this._createOrderedMarkerResult(e,r,t,i,!1):this._createUnorderedMarkerResult(e,r)},e.prototype._drawMarker=function(t,e,i,r,n){return t instanceof Dc?t.font&&i&&(t.font.size>i._actualSize.height&&(r+=t.font.size/2-i._actualSize.height/2,i._actualSize.height=i._actualSize.height+r),this._drawOrderedMarker(t,i,e,n,r)):(t.font&&i&&t.font.size>i._actualSize.height&&(r+=t.font.size/2-i._actualSize.height/2,i._actualSize.height=i._actualSize.height+r),this._drawUnorderedMarker(t,i,e,n,r)),!0},e.prototype._drawUnorderedMarker=function(e,i,r,n,s){var a=this._getMarkerFont(e,r),o=this._getMarkerPen(e,r),h=this._getMarkerBrush(e,r);i?(e._size=[i._actualSize.width,i._actualSize.height],e._unicodeFont=new xr(t.PdfFontFamily.zapfDingbats,a.size),e._draw(this._graphics,n-i._actualSize.width,s,h,o)):(e._size=[a.size,a.size],e._draw(this._graphics,n-a.size,s,h,o))},e.prototype._drawOrderedMarker=function(t,e,i,r,n){var s=this._getMarkerFont(t,i),a=this._getMarkerPen(t,i),o=this._getMarkerBrush(t,i),h=[r-this._markerMaxWidth,n,this._markerMaxWidth,e._actualSize.height],c=this._setMarkerStringFormat(t,this._getMarkerFormat(t,i));this._graphics._drawStringLayoutResult(e,s,a,o,h,c)},e.prototype._setCurrentParameters=function(t){t.brush&&(this._currentBrush=t.brush),t.pen&&(this._currentPen=t.pen),t.font&&(this._currentFont=t.font),t.stringFormat&&(this._currentFormat=t.stringFormat,t instanceof Ic&&(this._currentFormat._isList=!0))},e.prototype._getMarkerMaxWidth=function(t,e){for(var i=-1,r=0;r<t.items.count;r++){var n=this._createOrderedMarkerResult(t,t.items.at(r),r+t.startNumber,e,!0);i<n._actualSize.width&&(i=n._actualSize.width)}return i},e.prototype._createUnorderedMarkerResult=function(e,i){var r=this._getMarkerFont(e,i),n=new Gi,s=new xr(t.PdfFontFamily.zapfDingbats,r.size),a=n._layout(e._getStyledText(),s,null,this._size);return e._size=[a._actualSize.width,a._actualSize.height],e.pen&&(a._size={width:a._actualSize.width+2*e.pen._width,height:a._actualSize.height+2*e.pen._width}),a},e.prototype._createOrderedMarkerResult=function(e,i,r,n,s){e._currentIndex=r;var a="";if(e.style!==t.PdfNumberStyle.none&&(a=e._getNumber()+e.suffix),e.enableHierarchy)for(var o=n.slice(),h=0;h<o.length;h++){var c=o[h],_=c._list;if(!(_&&_ instanceof Dc&&_.style!==t.PdfNumberStyle.none))break;if(a=c._number+_.delimiter+a,!_.enableHierarchy)break}var d=new Gi,u=this._getMarkerFont(e,i),l=this._getMarkerFormat(e,i),f=[0,0];return s||(f[0]=this._markerMaxWidth,l=this._setMarkerStringFormat(e,l)),d._layout(a,u,l,f)},e.prototype._setMarkerStringFormat=function(e,i){return i=i?Object.assign({},i):new Ei,e.stringFormat||(i.alignment=t.PdfTextAlignment.right,e._markerRightToLeft&&(i.alignment=t.PdfTextAlignment.left)),!this._currentPage&&i&&((i=Object.assign({},i)).alignment=t.PdfTextAlignment.left),i},e.prototype._getMarkerFont=function(t,e){var i=t.font;return i||(i=e.font)||(i=this._currentFont),t.font=i,i},e.prototype._getMarkerFormat=function(t,e){var i=t.stringFormat;return i||(i=e.stringFormat)||(i=this._currentFormat),i},e.prototype._getMarkerPen=function(t,e){var i=t.pen;return i||(i=e.pen)||(i=this._currentPen),i},e.prototype._getMarkerBrush=function(t,e){var i=t.brush;return i||(i=e.brush)||(i=this._currentBrush),i},e.prototype._getNextPage=function(t){var e=t._crossReference._document;return t._pageIndex<e.pageCount-1?e.getPage(t._pageIndex+1):e.addPage(t._pageSettings)},e}(),Mc=function(){function t(t,e){this._identification=t,this._stringValue=e}return t.prototype._toString=function(){return"CHARACTER STRING { identification "+this._identification._toString()+" dataValue "+Array.from(this._stringValue).map(function(t){return t.toString(16)}).join("")+" }"},t.prototype._toJson=function(){return{identification:this._identification._toJson(),dataValue:Array.from(this._stringValue).map(function(t){return t.toString(16)}).join("")}},t}(),Ec=function(){function t(t,e,i,r,n,s,a,o){if(void 0!==i&&null!==i&&(t||e||r||n||s||a))throw new Error("Duration equivalent may not combine week components and date-time components.");if(t&&mi("year",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",t),e&&mi("month",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",e),i&&mi("week",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",i),r&&mi("day",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",r),n&&mi("hour",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",n),s&&mi("minute",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",s),a&&mi("second",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",a),o&&!Number.isSafeInteger(o.fractionalValue))throw new Error("The fractional part of the duration is incorrectly formatted");this._years=t,this._months=e,this._weeks=i,this._days=r,this._hours=n,this._minutes=s,this._seconds=a,this._fractionalPart=o}return t.prototype._toString=function(){var t="DURATION { ";return void 0!==this._years&&null!==this._years&&(t+="years "+this._years+" "),void 0!==this._months&&null!==this._months&&(t+="months "+this._months+" "),void 0!==this._days&&null!==this._days&&(t+="days "+this._days+" "),void 0!==this._hours&&null!==this._hours&&(t+="hours "+this._hours+" "),void 0!==this._minutes&&null!==this._minutes&&(t+="minutes "+this._minutes+" "),void 0!==this._seconds&&null!==this._seconds&&(t+="seconds "+this._seconds+" "),t+="}"},t.prototype._toJson=function(){return{years:this._years,months:this._months,weeks:this._weeks,days:this._days,hours:this._hours,minutes:this._minutes,seconds:this._seconds,fractionalPart:this._fractionalPart?{numberOfDigits:this._fractionalPart.numberOfDigits,fractionalValue:this._fractionalPart.fractionalValue}:void 0}},t}(),Nc=function(){function t(t,e){if(!(t&&e&&e.length>0))throw new Error("Invalid constructor arguments: identification and non-empty dataValue are required.");this._identification=t,this._dataValue=e}return t.prototype._toString=function(){return"EMBEDDED PDV { identification "+this._identification.toString()+" dataValue "+Array.from(this._dataValue).map(function(t){return t.toString(16)}).join("")+" }"},t.prototype._toJson=function(){return{identification:this._identification._toJson(),dataValue:Array.from(this._dataValue).map(function(t){return t.toString(16)}).join("")}},t}(),jc=function(){function t(t,e,i,r){if(!(r&&t&&i&&e))throw new Error("Invalid constructor arguments");this._directReference=t,this._indirectReference=e,this._dataValueDescriptor=i,this._encoding=r}return t.prototype._toString=function(){var t="EXTERNAL { ";return this._directReference&&(t+="directReference "+this._directReference.toString()+" "),this._indirectReference&&(t+="indirectReference "+this._indirectReference.toString()+" "),this._dataValueDescriptor&&(t+="dataValueDescriptor '"+this._dataValueDescriptor+"' "),this._encoding instanceof Uint8Array?t+="octet-aligned "+Array.from(this._encoding).map(function(t){return t.toString(16)}).join("")+" ":this._encoding instanceof Uint8ClampedArray?t+="arbitrary "+this._encoding.toString()+" ":t+="single-ASN1-type "+this._encoding.toString()+" ",t+="}"},t.prototype._toJson=function(){var t;if(this._encoding instanceof Uint8Array)t=Array.from(this._encoding).map(function(t){return t.toString(16)}).join("");else if(this._encoding instanceof Uint8ClampedArray){var e=this._encoding;t={length:e.length,value:Array.from(li(e)).map(function(t){return t.toString(16)}).join("")}}return{directReference:this._directReference,indirectReference:this._indirectReference,dataValueDescriptor:this._dataValueDescriptor,encoding:t}},t}();return t.BaseException=fs,t.Dictionary=As,t.FormatError=ps,t.ParserEndOfFileException=gs,t.Pdf3DAnnotation=gn,t.PdfAction=Br,t.PdfAngleMeasurementAnnotation=hn,t.PdfAnnotation=Zr,t.PdfAnnotationBorder=In,t.PdfAnnotationCaption=kn,t.PdfAnnotationCollection=On,t.PdfAnnotationExportSettings=Vh,t.PdfAnnotationLineEndingStyle=Rn,t.PdfAppearance=Fr,t.PdfAttachmentAnnotation=pn,t.PdfAutomaticField=Qh,t.PdfBasicJobTicketSchema=kh,t.PdfBasicSchema=vh,t.PdfBitmap=Kh,t.PdfBookmark=co,t.PdfBookmarkBase=ho,t.PdfBorderEffect=Dn,t.PdfBrush=Qn,t.PdfButtonField=Vr,t.PdfCheckBoxField=zr,t.PdfCircleAnnotation=en,t.PdfCjkStandardFont=Pr,t.PdfComboBoxField=Wr,t.PdfComment=$r,t.PdfCompositeField=rc,t.PdfCreationDateField=oc,t.PdfCustomMetadata=Oh,t.PdfCustomSchema=Dh,t.PdfDateTimeField=dc,t.PdfDestination=Un,t.PdfDestinationPageNumberField=yc,t.PdfDocument=jh,t.PdfDocumentAuthorField=bc,t.PdfDocumentLinkAnnotation=ln,t.PdfDocumentSplitEventArgs=Wh,t.PdfDublinCoreSchema=Sh,t.PdfDynamicField=$h,t.PdfEllipseAnnotation=rn,t.PdfField=Nr,t.PdfFieldActions=Mr,t.PdfFileLinkAnnotation=dn,t.PdfFileStructure=po,t.PdfFont=Sr,t.PdfForm=ro,t.PdfFormFieldExportSettings=zh,t.PdfFreeTextAnnotation=wn,t.PdfGoToAction=Or,t.PdfGraphics=Gn,t.PdfGraphicsElement=Jh,t.PdfGraphicsState=Jn,t.PdfImage=qn,t.PdfInkAnnotation=cn,t.PdfInteractiveBorder=Fn,t.PdfJavaScriptAction=Lr,t.PdfLayer=bo,t.PdfLayerCollection=vo,t.PdfLayoutFormat=En,t.PdfLayoutResult=Nn,t.PdfLineAnnotation=tn,t.PdfList=Ic,t.PdfListBoxField=qr,t.PdfListField=Hr,t.PdfListFieldItem=Cn,t.PdfListItem=kc,t.PdfListItemCollection=Rc,t.PdfMargins=Hh,t.PdfMultipleNumberValueField=lc,t.PdfMultipleValueField=ec,t.PdfNamedDestination=_o,t.PdfOrderedList=Dc,t.PdfPage=zn,t.PdfPageCountField=wc,t.PdfPageImportOptions=go,t.PdfPageNumberField=pc,t.PdfPageSettings=Uh,t.PdfPageTemplateElement=Xh,t.PdfPagedTextSchema=Th,t.PdfPath=Ir,t.PdfPen=Zn,t.PdfPolyLineAnnotation=on,t.PdfPolygonAnnotation=an,t.PdfPopupAnnotation=_n,t.PdfPopupAnnotationCollection=Mn,t.PdfPredictorStream=Gs,t.PdfRadioButtonListField=Ur,t.PdfRadioButtonListItem=Tn,t.PdfRectangleAnnotation=sn,t.PdfRedactionAnnotation=Sn,t.PdfRichMediaAnnotation=xn,t.PdfRightsManagementSchema=Fh,t.PdfRubberStampAnnotation=bn,t.PdfSchema=Ph,t.PdfSection=wo,t.PdfSectionNumberField=xc,t.PdfSectionPageCountField=Ac,t.PdfSectionPageNumberField=Cc,t.PdfSignature=yh,t.PdfSignatureField=Gr,t.PdfSingleValueField=sc,t.PdfSoundAnnotation=vn,t.PdfSquareAnnotation=nn,t.PdfStandardFont=xr,t.PdfStateItem=An,t.PdfStaticField=cc,t.PdfStringFormat=Ei,t.PdfTemplate=Mi,t.PdfTextBoxField=jr,t.PdfTextMarkupAnnotation=yn,t.PdfTextWebLinkAnnotation=fn,t.PdfTrueTypeFont=Ar,t.PdfUnorderedList=Bc,t.PdfUriAnnotation=un,t.PdfWatermarkAnnotation=mn,t.PdfWidgetAnnotation=Pn,t.PdfXmpMetadata=Bh,t.PdfXmpSchema=mh,t._AdvancedEncryption=Ua,t._AdvancedEncryption128Cipher=Ia,t._AdvancedEncryption256Cipher=Da,t._AdvancedEncryptionBaseCipher=Sa,t._ArabicShape=yr,t._ArabicShapeRenderer=gr,t._BasicEncryption=za,t._Bidirectional=mr,t._BigEndianWriter=fr,t._Cipher=wa,t._CipherTransform=xa,t._CipherTwo=Ga,t._CjkDifferentWidth=qi,t._CjkSameWidth=Wi,t._CjkWidth=Hi,t._CjkWidthTable=Ui,t._ContentLexer=Jr,t._ContentParser=Xr,t._DataEncryptionStandardCipher=Pa,t._DecompressedOutput=ns,t._DeflateStream=hs,t._EncryptionKey=Va,t._ExportHelper=Ii,t._FdfDocument=so,t._FdfHelper=ao,t._FontStructure=Bi,t._HuffmanTree=as,t._ImageDecoder=ts,t._InBuffer=ss,t._Inflater=os,t._JpegDecoder=is,t._JsonDocument=Oi,t._LineInfo=Xi,t._Linearization=ka,t._MD5=Ra,t._Matrix=Xn,t._Namespace=Ci,t._NistObjectIdentifiers=$o,t._NormalCipherFour=Wa,t._NullCipher=qa,t._PageLayoutResult=jn,t._PaintParameter=Bn,t._PdfAbstractSyntaxElement=ko,t._PdfAlgorithms=Io,t._PdfArithmeticDecoder=ha,t._PdfAscii85Stream=ta,t._PdfAsciiHexStream=ia,t._PdfBaseStream=Rs,t._PdfBasicEncodingElement=Oo,t._PdfBigInt=So,t._PdfBitReader=ca,t._PdfCatalog=Ws,t._PdfCertificate=Zo,t._PdfCertificateIdentifier=xo,t._PdfCertificateTable=Po,t._PdfCharacterString=Mc,t._PdfCipherParameter=Eo,t._PdfCjkFontDescriptorFactory=kr,t._PdfCjkStandardFontMetricsFactory=Cr,t._PdfCommand=ws,t._PdfContentStream=Is,t._PdfContextCache=_a,t._PdfCopier=mo,t._PdfCrossReference=Qa,t._PdfCryptographicEncoding=ah,t._PdfCryptographicMessageSyntaxSigner=lh,t._PdfCryptographicObjectIdentifier=th,t._PdfDecodeStream=Ls,t._PdfDecodingContext=da,t._PdfDecryptStream=Ms,t._PdfDefaultAppearance=Kr,t._PdfDestinationHelper=Hn,t._PdfDictionary=Ts,t._PdfDigestInformation=oh,t._PdfDigitalIdentifiers=eh,t._PdfDurationEquivalent=Ec,t._PdfEmbeddedDataValue=Nc,t._PdfEncryptor=Ka,t._PdfExternal=jc,t._PdfFaxDecoder=ra,t._PdfFaxStream=sa,t._PdfFlateStream=Hs,t._PdfFontMetrics=ji,t._PdfHuffmanLine=la,t._PdfHuffmanTable=pa,t._PdfHuffmanTreeNode=fa,t._PdfJbig2Image=ya,t._PdfJbig2Stream=ba,t._PdfJpegStream=Xs,t._PdfJpxStream=Zs,t._PdfLayoutParameters=Vn,t._PdfLempelZivWelchStream=Ys,t._PdfLexicalOperator=Ta,t._PdfListInfo=Lc,t._PdfListLayouter=Oc,t._PdfMergeHelper=yo,t._PdfMessageDigestAlgorithms=rh,t._PdfName=vs,t._PdfNamedDestinationCollection=uo,t._PdfNativeAccumulatorSink=Ba,t._PdfNativeAlgorithmIdentifier=Oa,t._PdfNativeHashInput=La,t._PdfNull=Cs,t._PdfNullStream=Ds,t._PdfObjectIdentifier=Co,t._PdfPaddings=qh,t._PdfParser=Ca,t._PdfPublicKeyCryptographyCertificate=Qo,t._PdfPublicKeyInformation=Bo,t._PdfReader=ga,t._PdfRecord=Yr,t._PdfReference=Ss,t._PdfReferenceSet=xs,t._PdfReferenceSetCache=Ps,t._PdfRmdSigner=hh,t._PdfRonCipherParameter=No,t._PdfRsaAlgorithm=sh,t._PdfRsaCoreAlgorithm=nh,t._PdfRunLengthStream=oa,t._PdfSignatureDictionary=gh,t._PdfSignaturePrivateKey=_h,t._PdfSignedCertificate=Ko,t._PdfSignerUtilities=ch,t._PdfSimpleSegmentVisitor=ua,t._PdfStandardFontMetricsFactory=Tr,t._PdfStream=Fs,t._PdfStreamWriter=Wn,t._PdfStringLayoutResult=Ki,t._PdfStringLayouter=Gi,t._PdfSubjectKeyIdentifier=To,t._PdfTransformationMatrix=Kn,t._PdfUniqueBitString=Do,t._PdfUniqueEncodingElement=Fo,t._PdfUnitConvertor=$n,t._PdfX509Certificate=Ho,t._PdfX509CertificateParser=Jo,t._PdfX509CertificateStructure=Xo,t._PdfX509Certificates=Wo,t._PdfX509Extension=jo,t._PdfX509ExtensionBase=zo,t._PdfX509Extensions=Vo,t._PdfX509Name=qo,t._PdfX509Time=Go,t._PngDecoder=_s,t._RaceEvaluationMessageDigest=ih,t._RtlCharacters=br,t._RtlRenderer=vr,t._Sha1=Ao,t._Sha256=Ma,t._Sha384=Na,t._Sha512=Ea,t._StandardWidthTable=zi,t._StringTokenizer=Ji,t._TripleDataEncryptionStandardCipher=Yo,t._TrueTypeAppleCmapSubTable=sr,t._TrueTypeCmapSubTable=nr,t._TrueTypeCmapTable=rr,t._TrueTypeGlyph=dr,t._TrueTypeGlyphHeader=lr,t._TrueTypeHeadTable=ir,t._TrueTypeHorizontalHeaderTable=er,t._TrueTypeLocaTable=ur,t._TrueTypeLongHorMetric=_r,t._TrueTypeMetrics=cr,t._TrueTypeMicrosoftCmapSubTable=tr,t._TrueTypeNameRecord=hr,t._TrueTypeNameTable=$i,t._TrueTypeOS2Table=Qi,t._TrueTypePostTable=Zi,t._TrueTypeReader=or,t._TrueTypeTableInfo=Yi,t._TrueTypeTrimmedCmapSubTable=ar,t._UnicodeLine=Rr,t._UnicodeTrueTypeFont=pr,t._WidthTable=Vi,t._Word64=Xa,t._XfdfDocument=Di,t._XmlAttribute=Ri,t._XmlDocument=fo,t._XmlElement=ki,t._XmlReader=Lh,t._XmlWriter=Ti,t._addProcSet=et,t._annotationFlagsToString=d,t._appendChar=ce,t._arabicToLetter=he,t._arabicToRoman=oe,t._areArrayEqual=p,t._areNotEqual=m,t._arePointsEqual=g,t._arePointsNotEqual=b,t._areUint8ArraysEqual=Be,t._bigIntToBytes=Ee,t._bufferToInteger=ni,t._byteArrayToHexString=P,t._bytesToBigInt=Me,t._bytesToHex=Qe,t._bytesToString=v,t._calculateBounds=L,t._checkComment=Mt,t._checkField=ct,t._checkInkPoints=$t,t._checkReview=Ot,t._checkRotation=c,t._checkType=o,t._clearPrimitiveCaches=ei,t._compressStream=ue,t._convertBytesToText=gi,t._convertDateToString=He,t._convertNumber=ae,t._convertNumberArraysToPoints=U,t._convertNumberToPointArrays=z,t._convertPointToNumberArray=W,t._convertPointsToNumberArrays=H,t._convertStringToDate=We,t._convertToColor=N,t._convertToHex=be,t._convertToPoints=V,t._copyRange=a,t._createFontMetrics=Ht,t._createFontStream=ye,t._createRandomInRange=je,t._decode=R,t._decodeFontFamily=ve,t._decodeName=w,t._decodeSignedBigEndianInteger=ai,t._decodeText=ie,t._decodeUnicodeBytes=S,t._decodeUnsignedBigEndianInteger=oi,t._decodeUtf16Bytes=re,t._defaultToString=zt,t._defineLazyProperty=Ce,t._defineProperty=de,t._dissectFloat=hi,t._encode=I,t._encodeBigEndianSignedInteger=ci,t._encodeCodePointToUtf8=nt,t._encodeUnsignedBigEndianInteger=_i,t._encodeValue=Bt,t._encodeX690BinaryRealNumber=di,t._escapePdfName=rt,t._extractAttributes=De,t._findPage=ht,t._floatToString=tt,t._formatNumber=Ze,t._fromRectangle=M,t._getBezierArc=ot,t._getBigInt=ze,t._getBit=ui,t._getCenterX=ft,t._getCenterY=pt,t._getCjkDescendantFont=Ge,t._getCjkEncoding=qe,t._getCjkSystemInfo=Ke,t._getColorValue=ut,t._getCommentsOrReview=Lt,t._getDecoder=h,t._getFontFamily=qt,t._getFontFromDescriptor=Zt,t._getFontSize=Wt,t._getFontStyle=Gt,t._getInheritableProperty=D,t._getItemValue=_t,t._getLatinCharacter=Dt,t._getNewGuidString=it,t._getPageIndex=_,t._getSize=ne,t._getSpecialCharacter=It,t._getStateTemplate=dt,t._getUpdatedBounds=E,t._grayToRgba=Fe,t._handleExplicitConversion=Ve,t._hasSharedFontResource=Yt,t._hasUnicodeCharacters=ge,t._hexStringToByteArray=A,t._hexStringToString=T,t._integerToBuffer=si,t._isBasicEncodingElement=yi,t._isCommand=ri,t._isGeneralCharacter=bi,t._isGraphicCharacter=vi,t._isHexDigit=at,t._isLittleEndian=Ie,t._isName=ii,t._isNullOrUndefined=_e,t._isPointArray=j,t._isPrintableCharacter=wi,t._isRightToLeftCharacters=le,t._isUnicode=me,t._isWhiteSpace=C,t._log2=Te,t._mapAnnotationIntent=Rt,t._mapAnnotationState=At,t._mapAnnotationStateModel=Ct,t._mapAttachmentIcon=kt,t._mapBlendMode=$,t._mapBorderEffectStyle=K,t._mapBorderStyle=G,t._mapFont=Kt,t._mapGraphicsUnit=wt,t._mapHighlightMode=Y,t._mapLineEndingStyle=J,t._mapMarkupAnnotationType=bt,t._mapMeasurementUnit=mt,t._mapPopupIcon=xt,t._mapRubberStampIcon=St,t._mathClamp=ke,t._modInverse=Oe,t._modPow=Le,t._numberToString=y,t._obtainFontDetails=Ut,t._packBits=li,t._pad2=Ue,t._padStart=Ye,t._parseColor=q,t._parseRectangle=B,t._randomBigInt=Ne,t._readInteger8=Ae,t._readUnsignedInteger16=Se,t._readUnsignedInteger32=Pe,t._removeDuplicateFromResources=jt,t._removeDuplicateReference=Nt,t._removeReferences=Vt,t._resolveCjkFontFamily=Je,t._resolveStandardFontFamily=Xe,t._reverseMapAnnotationState=Pt,t._reverseMapAnnotationStateModel=Tt,t._reverseMapBlendMode=Z,t._reverseMapEndingStyle=X,t._reverseMapHighlightMode=Q,t._reverseMapPdfFontStyle=Ft,t._reverseMarkupAnnotationType=vt,t._setBit=fi,t._setBitInBase256=pi,t._setMatrix=lt,t._setRotateAngle=xe,t._stringToAnnotationFlags=u,t._stringToBigEndianBytes=se,t._stringToBytes=f,t._stringToPdfString=l,t._stringToStyle=yt,t._stringToUnicodeArray=x,t._styleToString=gt,t._toAlpha=ti,t._toHex2=st,t._toRectangle=O,t._toRoman=$e,t._toSigned16=s,t._toUnsigned=n,t._trimTailIfMatches=ee,t._tryParseFontStream=Qt,t._unreachable=Re,t._updateBounds=te,t._updateDashedBorderStyle=we,t._updatePageCount=fe,t._updatePageSettings=pe,t._updateVisibility=Et,t._validateDate=Si,t._validateDateTime=Pi,t._validateDateTimeComponent=mi,t._validateTime=xi,t.isNumericString=Ai,t}({},ej.base,ej.compression,ej.fileutils),this.ejs=ej;
//# sourceMappingURL=ej2-pdf.min.js.map