@pdftron/webviewer
Version:
[WebViewer](https://www.apryse.com/webviewer) is a powerful JavaScript Document SDK and UI Component Library that is a part of the [Apryse PDF SDK](https://www.apryse.com). It provides a slick, out-of-the-box responsive UI that interacts with the core lib
1 lines • 1.46 MB
JavaScript
(window.webpackJsonpWebViewerUI=window.webpackJsonpWebViewerUI||[]).push([[81],{1917:function(r,e,n){(function(e){r.exports=function r(e,n,t){function a(c,o){if(!n[c]){if(!e[c]){if(i)return i(c,!0);var s=new Error("Cannot find module '"+c+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[c]={exports:{}};e[c][0].call(u.exports,(function(r){return a(e[c][1][r]||r)}),u,u.exports,r,e,n,t)}return n[c].exports}for(var i=!1,c=0;c<t.length;c++)a(t[c]);return a}({1:[function(r,e,n){(function(n){(function(){"use strict";var t=r("stream"),a=r("fs"),i=r("zlib"),c=r("crypto-js"),o=r("fontkit"),s=r("events"),u=r("linebreak"),X=r("png-js");class l{toString(){throw new Error("Must be implemented by subclasses")}}class P{constructor(r={}){this._items={},this.limits="boolean"!=typeof r.limits||r.limits}add(r,e){return this._items[r]=e}get(r){return this._items[r]}toString(){const r=Object.keys(this._items).sort((r,e)=>this._compareKeys(r,e)),e=["<<"];if(this.limits&&r.length>1){const n=r[0],t=r[r.length-1];e.push(" /Limits "+h.convert([this._dataForKey(n),this._dataForKey(t)]))}e.push(` /${this._keysName()} [`);for(let n of r)e.push(` ${h.convert(this._dataForKey(n))} ${h.convert(this._items[n])}`);return e.push("]"),e.push(">>"),e.join("\n")}_compareKeys(){throw new Error("Must be implemented by subclasses")}_keysName(){throw new Error("Must be implemented by subclasses")}_dataForKey(){throw new Error("Must be implemented by subclasses")}}const K=(r,e)=>(Array(e+1).join("0")+r).slice(-e),m=/[\n\r\t\b\f()\\]/g,d={"\n":"\\n","\r":"\\r","\t":"\\t","\b":"\\b","\f":"\\f","\\":"\\\\","(":"\\(",")":"\\)"};class h{static convert(r,e=null){if("string"==typeof r)return"/"+r;if(r instanceof String){let t,a=r,i=!1;for(let r=0,e=a.length;r<e;r++)if(a.charCodeAt(r)>127){i=!0;break}return t=i?function(r){const e=r.length;if(1&e)throw new Error("Buffer length must be even");for(let n=0,t=e-1;n<t;n+=2){const e=r[n];r[n]=r[n+1],r[n+1]=e}return r}(n.from("\ufeff"+a,"utf16le")):n.from(a.valueOf(),"ascii"),a=e?e(t).toString("binary"):t.toString("binary"),a=a.replace(m,r=>d[r]),`(${a})`}if(n.isBuffer(r))return`<${r.toString("hex")}>`;if(r instanceof l||r instanceof P)return r.toString();if(r instanceof Date){let t="D:"+K(r.getUTCFullYear(),4)+K(r.getUTCMonth()+1,2)+K(r.getUTCDate(),2)+K(r.getUTCHours(),2)+K(r.getUTCMinutes(),2)+K(r.getUTCSeconds(),2)+"Z";return e&&(t=e(n.from(t,"ascii")).toString("binary"),t=t.replace(m,r=>d[r])),`(${t})`}if(Array.isArray(r))return`[${r.map(r=>h.convert(r,e)).join(" ")}]`;if("[object Object]"==={}.toString.call(r)){const n=["<<"];for(let t in r){const a=r[t];n.push(`/${t} ${h.convert(a,e)}`)}return n.push(">>"),n.join("\n")}return"number"==typeof r?h.number(r):""+r}static number(r){if(r>-1e21&&r<1e21)return Math.round(1e6*r)/1e6;throw new Error("unsupported number: "+r)}}class f extends l{constructor(r,e,n={}){super(),this.document=r,this.id=e,this.data=n,this.gen=0,this.compress=this.document.compress&&!this.data.Filter,this.uncompressedLength=0,this.buffer=[]}write(r){if(n.isBuffer(r)||(r=n.from(r+"\n","binary")),this.uncompressedLength+=r.length,null==this.data.Length&&(this.data.Length=0),this.buffer.push(r),this.data.Length+=r.length,this.compress)return this.data.Filter="FlateDecode"}end(r){return r&&this.write(r),this.finalize()}finalize(){this.offset=this.document._offset;const r=this.document._security?this.document._security.getEncryptFn(this.id,this.gen):null;this.buffer.length&&(this.buffer=n.concat(this.buffer),this.compress&&(this.buffer=i.deflateSync(this.buffer)),r&&(this.buffer=r(this.buffer)),this.data.Length=this.buffer.length),this.document._write(`${this.id} ${this.gen} obj`),this.document._write(h.convert(this.data,r)),this.buffer.length&&(this.document._write("stream"),this.document._write(this.buffer),this.buffer=[],this.document._write("\nendstream")),this.document._write("endobj"),this.document._refEnd(this)}toString(){return`${this.id} ${this.gen} R`}}const g={top:72,left:72,bottom:72,right:72},p={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],A0:[2383.94,3370.39],A1:[1683.78,2383.94],A2:[1190.55,1683.78],A3:[841.89,1190.55],A4:[595.28,841.89],A5:[419.53,595.28],A6:[297.64,419.53],A7:[209.76,297.64],A8:[147.4,209.76],A9:[104.88,147.4],A10:[73.7,104.88],B0:[2834.65,4008.19],B1:[2004.09,2834.65],B2:[1417.32,2004.09],B3:[1000.63,1417.32],B4:[708.66,1000.63],B5:[498.9,708.66],B6:[354.33,498.9],B7:[249.45,354.33],B8:[175.75,249.45],B9:[124.72,175.75],B10:[87.87,124.72],C0:[2599.37,3676.54],C1:[1836.85,2599.37],C2:[1298.27,1836.85],C3:[918.43,1298.27],C4:[649.13,918.43],C5:[459.21,649.13],C6:[323.15,459.21],C7:[229.61,323.15],C8:[161.57,229.61],C9:[113.39,161.57],C10:[79.37,113.39],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],EXECUTIVE:[521.86,756],FOLIO:[612,936],LEGAL:[612,1008],LETTER:[612,792],TABLOID:[792,1224]};class A{constructor(r,e={}){this.document=r,this.size=e.size||"letter",this.layout=e.layout||"portrait","number"==typeof e.margin?this.margins={top:e.margin,left:e.margin,bottom:e.margin,right:e.margin}:this.margins=e.margins||g;const n=Array.isArray(this.size)?this.size:p[this.size.toUpperCase()];this.width=n["portrait"===this.layout?0:1],this.height=n["portrait"===this.layout?1:0],this.content=this.document.ref(),this.resources=this.document.ref({ProcSet:["PDF","Text","ImageB","ImageC","ImageI"]}),this.dictionary=this.document.ref({Type:"Page",Parent:this.document._root.data.Pages,MediaBox:[0,0,this.width,this.height],Contents:this.content,Resources:this.resources}),this.markings=[]}get fonts(){const r=this.resources.data;return null!=r.Font?r.Font:r.Font={}}get xobjects(){const r=this.resources.data;return null!=r.XObject?r.XObject:r.XObject={}}get ext_gstates(){const r=this.resources.data;return null!=r.ExtGState?r.ExtGState:r.ExtGState={}}get patterns(){const r=this.resources.data;return null!=r.Pattern?r.Pattern:r.Pattern={}}get colorSpaces(){const r=this.resources.data;return r.ColorSpace||(r.ColorSpace={})}get annotations(){const r=this.dictionary.data;return null!=r.Annots?r.Annots:r.Annots=[]}get structParentTreeKey(){const r=this.dictionary.data;return null!=r.StructParents?r.StructParents:r.StructParents=this.document.createStructParentTreeNextKey()}maxY(){return this.height-this.margins.bottom}write(r){return this.content.write(r)}end(){return this.dictionary.end(),this.resources.end(),this.content.end()}}class v extends P{_compareKeys(r,e){return r.localeCompare(e)}_keysName(){return"Names"}_dataForKey(r){return new String(r)}}function y(r,e){if(r<e[0])return!1;let n=0,t=e.length/2;for(;n<=t;){const a=Math.floor((n+t)/2),i=2*a;if(r>=e[i]&&r<=e[i+1])return!0;r>e[i+1]?n=a+1:t=a-1}return!1}const C=[545,545,564,591,686,687,751,767,848,863,880,883,886,889,891,893,895,899,907,907,909,909,930,930,975,975,1015,1023,1159,1159,1231,1231,1270,1271,1274,1279,1296,1328,1367,1368,1376,1376,1416,1416,1419,1424,1442,1442,1466,1466,1477,1487,1515,1519,1525,1547,1549,1562,1564,1566,1568,1568,1595,1599,1622,1631,1774,1775,1791,1791,1806,1806,1837,1839,1867,1919,1970,2304,2308,2308,2362,2363,2382,2383,2389,2391,2417,2432,2436,2436,2445,2446,2449,2450,2473,2473,2481,2481,2483,2485,2490,2491,2493,2493,2501,2502,2505,2506,2510,2518,2520,2523,2526,2526,2532,2533,2555,2561,2563,2564,2571,2574,2577,2578,2601,2601,2609,2609,2612,2612,2615,2615,2618,2619,2621,2621,2627,2630,2633,2634,2638,2648,2653,2653,2655,2661,2677,2688,2692,2692,2700,2700,2702,2702,2706,2706,2729,2729,2737,2737,2740,2740,2746,2747,2758,2758,2762,2762,2766,2767,2769,2783,2785,2789,2800,2816,2820,2820,2829,2830,2833,2834,2857,2857,2865,2865,2868,2869,2874,2875,2884,2886,2889,2890,2894,2901,2904,2907,2910,2910,2914,2917,2929,2945,2948,2948,2955,2957,2961,2961,2966,2968,2971,2971,2973,2973,2976,2978,2981,2983,2987,2989,2998,2998,3002,3005,3011,3013,3017,3017,3022,3030,3032,3046,3059,3072,3076,3076,3085,3085,3089,3089,3113,3113,3124,3124,3130,3133,3141,3141,3145,3145,3150,3156,3159,3167,3170,3173,3184,3201,3204,3204,3213,3213,3217,3217,3241,3241,3252,3252,3258,3261,3269,3269,3273,3273,3278,3284,3287,3293,3295,3295,3298,3301,3312,3329,3332,3332,3341,3341,3345,3345,3369,3369,3386,3389,3396,3397,3401,3401,3406,3414,3416,3423,3426,3429,3440,3457,3460,3460,3479,3481,3506,3506,3516,3516,3518,3519,3527,3529,3531,3534,3541,3541,3543,3543,3552,3569,3573,3584,3643,3646,3676,3712,3715,3715,3717,3718,3721,3721,3723,3724,3726,3731,3736,3736,3744,3744,3748,3748,3750,3750,3752,3753,3756,3756,3770,3770,3774,3775,3781,3781,3783,3783,3790,3791,3802,3803,3806,3839,3912,3912,3947,3952,3980,3983,3992,3992,4029,4029,4045,4046,4048,4095,4130,4130,4136,4136,4139,4139,4147,4149,4154,4159,4186,4255,4294,4303,4345,4346,4348,4351,4442,4446,4515,4519,4602,4607,4615,4615,4679,4679,4681,4681,4686,4687,4695,4695,4697,4697,4702,4703,4743,4743,4745,4745,4750,4751,4783,4783,4785,4785,4790,4791,4799,4799,4801,4801,4806,4807,4815,4815,4823,4823,4847,4847,4879,4879,4881,4881,4886,4887,4895,4895,4935,4935,4955,4960,4989,5023,5109,5120,5751,5759,5789,5791,5873,5887,5901,5901,5909,5919,5943,5951,5972,5983,5997,5997,6001,6001,6004,6015,6109,6111,6122,6143,6159,6159,6170,6175,6264,6271,6314,7679,7836,7839,7930,7935,7958,7959,7966,7967,8006,8007,8014,8015,8024,8024,8026,8026,8028,8028,8030,8030,8062,8063,8117,8117,8133,8133,8148,8149,8156,8156,8176,8177,8181,8181,8191,8191,8275,8278,8280,8286,8292,8297,8306,8307,8335,8351,8370,8399,8427,8447,8507,8508,8524,8530,8580,8591,9167,9215,9255,9279,9291,9311,9471,9471,9748,9749,9752,9752,9854,9855,9866,9984,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10079,10080,10133,10135,10160,10160,10175,10191,10220,10223,11008,11903,11930,11930,12020,12031,12246,12271,12284,12287,12352,12352,12439,12440,12544,12548,12589,12592,12687,12687,12728,12783,12829,12831,12868,12880,12924,12926,13004,13007,13055,13055,13175,13178,13278,13279,13311,13311,19894,19967,40870,40959,42125,42127,42183,44031,55204,55295,64046,64047,64107,64255,64263,64274,64280,64284,64311,64311,64317,64317,64319,64319,64322,64322,64325,64325,64434,64466,64832,64847,64912,64913,64968,64975,65021,65023,65040,65055,65060,65071,65095,65096,65107,65107,65127,65127,65132,65135,65141,65141,65277,65278,65280,65280,65471,65473,65480,65481,65488,65489,65496,65497,65501,65503,65511,65511,65519,65528,65536,66303,66335,66335,66340,66351,66379,66559,66598,66599,66638,118783,119030,119039,119079,119081,119262,119807,119893,119893,119965,119965,119968,119969,119971,119972,119975,119976,119981,119981,119994,119994,119996,119996,120001,120001,120004,120004,120070,120070,120075,120076,120085,120085,120093,120093,120122,120122,120127,120127,120133,120133,120135,120137,120145,120145,120484,120487,120778,120781,120832,131069,173783,194559,195102,196605,196608,262141,262144,327677,327680,393213,393216,458749,458752,524285,524288,589821,589824,655357,655360,720893,720896,786429,786432,851965,851968,917501,917504,917504,917506,917535,917632,983037],b=r=>y(r,C),W=[173,173,847,847,6150,6150,6155,6155,6156,6156,6157,6157,8203,8203,8204,8204,8205,8205,8288,8288,65024,65024,65025,65025,65026,65026,65027,65027,65028,65028,65029,65029,65030,65030,65031,65031,65032,65032,65033,65033,65034,65034,65035,65035,65036,65036,65037,65037,65038,65038,65039,65039,65279,65279],B=[160,160,5760,5760,8192,8192,8193,8193,8194,8194,8195,8195,8196,8196,8197,8197,8198,8198,8199,8199,8200,8200,8201,8201,8202,8202,8203,8203,8239,8239,8287,8287,12288,12288],N=[128,159,1757,1757,1807,1807,6158,6158,8204,8204,8205,8205,8232,8232,8233,8233,8288,8288,8289,8289,8290,8290,8291,8291,8298,8303,65279,65279,65529,65532,119155,119162],x=[64976,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1114110,1114111],O=[0,31,127,127,832,832,833,833,8206,8206,8207,8207,8234,8234,8235,8235,8236,8236,8237,8237,8238,8238,8298,8298,8299,8299,8300,8300,8301,8301,8302,8302,8303,8303,12272,12283,55296,57343,57344,63743,65529,65529,65530,65530,65531,65531,65532,65532,65533,65533,917505,917505,917536,917631,983040,1048573,1048576,1114109],w=r=>y(r,B)||y(r,O)||y(r,N)||y(r,x),k=[1470,1470,1472,1472,1475,1475,1488,1514,1520,1524,1563,1563,1567,1567,1569,1594,1600,1610,1645,1647,1649,1749,1757,1757,1765,1766,1786,1790,1792,1805,1808,1808,1810,1836,1920,1957,1969,1969,8207,8207,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65020,65136,65140,65142,65276],T=r=>y(r,k),U=[65,90,97,122,170,170,181,181,186,186,192,214,216,246,248,544,546,563,592,685,688,696,699,705,720,721,736,740,750,750,890,890,902,902,904,906,908,908,910,929,931,974,976,1013,1024,1154,1162,1230,1232,1269,1272,1273,1280,1295,1329,1366,1369,1375,1377,1415,1417,1417,2307,2307,2309,2361,2365,2368,2377,2380,2384,2384,2392,2401,2404,2416,2434,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2494,2496,2503,2504,2507,2508,2519,2519,2524,2525,2527,2529,2534,2545,2548,2554,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2622,2624,2649,2652,2654,2654,2662,2671,2674,2676,2691,2691,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2752,2761,2761,2763,2764,2768,2768,2784,2784,2790,2799,2818,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2877,2878,2880,2880,2887,2888,2891,2892,2903,2903,2908,2909,2911,2913,2918,2928,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3006,3007,3009,3010,3014,3016,3018,3020,3031,3031,3047,3058,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3137,3140,3168,3169,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3262,3262,3264,3268,3271,3272,3274,3275,3285,3286,3294,3294,3296,3297,3302,3311,3330,3331,3333,3340,3342,3344,3346,3368,3370,3385,3390,3392,3398,3400,3402,3404,3415,3415,3424,3425,3430,3439,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3535,3537,3544,3551,3570,3572,3585,3632,3634,3635,3648,3654,3663,3675,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3792,3801,3804,3805,3840,3863,3866,3892,3894,3894,3896,3896,3902,3911,3913,3946,3967,3967,3973,3973,3976,3979,4030,4037,4039,4044,4047,4047,4096,4129,4131,4135,4137,4138,4140,4140,4145,4145,4152,4152,4160,4183,4256,4293,4304,4344,4347,4347,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,4961,4988,5024,5108,5121,5750,5761,5786,5792,5872,5888,5900,5902,5905,5920,5937,5941,5942,5952,5969,5984,5996,5998,6e3,6016,6070,6078,6085,6087,6088,6100,6106,6108,6108,6112,6121,6160,6169,6176,6263,6272,6312,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8206,8206,8305,8305,8319,8319,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8509,8511,8517,8521,8544,8579,9014,9082,9109,9109,9372,9449,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12588,12593,12686,12688,12727,12784,12828,12832,12867,12896,12923,12927,12976,12992,13003,13008,13054,13056,13174,13179,13277,13280,13310,13312,19893,19968,40869,40960,42124,44032,55203,55296,64045,64048,64106,64256,64262,64275,64279,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,66304,66334,66336,66339,66352,66378,66560,66597,66600,66637,118784,119029,119040,119078,119082,119142,119146,119154,119171,119172,119180,119209,119214,119261,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,12e4,120002,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120483,120488,120777,131072,173782,194560,195101,983040,1048573,1048576,1114109],_=r=>y(r,U),Y=r=>y(r,B),S=r=>y(r,W),R=r=>r.codePointAt(0);function E(r){const e=[],n=r.length;for(let t=0;t<n;t+=1){const a=r.charCodeAt(t);if(a>=55296&&a<=56319&&n>t+1){const n=r.charCodeAt(t+1);if(n>=56320&&n<=57343){e.push(1024*(a-55296)+n-56320+65536),t+=1;continue}}e.push(a)}return e}class L{static generateFileID(r={}){let e=r.CreationDate.getTime()+"\n";for(let n in r)r.hasOwnProperty(n)&&(e+=`${n}: ${r[n].valueOf()}\n`);return z(c.MD5(e))}static generateRandomWordArray(r){return c.lib.WordArray.random(r)}static create(r,e={}){return e.ownerPassword||e.userPassword?new L(r,e):null}constructor(r,e={}){if(!e.ownerPassword&&!e.userPassword)throw new Error("None of owner password and user password is defined.");this.document=r,this._setupEncryption(e)}_setupEncryption(r){switch(r.pdfVersion){case"1.4":case"1.5":this.version=2;break;case"1.6":case"1.7":this.version=4;break;case"1.7ext3":this.version=5;break;default:this.version=1}const e={Filter:"Standard"};switch(this.version){case 1:case 2:case 4:this._setupEncryptionV1V2V4(this.version,e,r);break;case 5:this._setupEncryptionV5(e,r)}this.dictionary=this.document.ref(e)}_setupEncryptionV1V2V4(r,e,n){let t,a;switch(r){case 1:t=2,this.keyBits=40,a=function(r={}){let e=-64;return r.printing&&(e|=4),r.modifying&&(e|=8),r.copying&&(e|=16),r.annotating&&(e|=32),e}(n.permissions);break;case 2:t=3,this.keyBits=128,a=D(n.permissions);break;case 4:t=4,this.keyBits=128,a=D(n.permissions)}const i=F(n.userPassword),o=n.ownerPassword?F(n.ownerPassword):i,s=function(r,e,n,t){let a=t,i=r>=3?51:1;for(let r=0;r<i;r++)a=c.MD5(a);const o=a.clone();o.sigBytes=e/8;let s=n;i=r>=3?20:1;for(let r=0;r<i;r++){const e=Math.ceil(o.sigBytes/4);for(let n=0;n<e;n++)o.words[n]=a.words[n]^(r|r<<8|r<<16|r<<24);s=c.RC4.encrypt(s,o).ciphertext}return s}(t,this.keyBits,i,o);let u;var X;this.encryptionKey=function(r,e,n,t,a,i){let o=t.clone().concat(a).concat(c.lib.WordArray.create([I(i)],4)).concat(c.lib.WordArray.create(n));const s=r>=3?51:1;for(let r=0;r<s;r++)o=c.MD5(o),o.sigBytes=e/8;return o}(t,this.keyBits,this.document._id,i,s,a),2===t?(X=this.encryptionKey,u=c.RC4.encrypt(F(),X).ciphertext):u=function(r,e){const n=e.clone();let t=c.MD5(F().concat(c.lib.WordArray.create(r)));for(let r=0;r<20;r++){const a=Math.ceil(n.sigBytes/4);for(let t=0;t<a;t++)n.words[t]=e.words[t]^(r|r<<8|r<<16|r<<24);t=c.RC4.encrypt(t,n).ciphertext}return t.concat(c.lib.WordArray.create(null,16))}(this.document._id,this.encryptionKey),e.V=r,r>=2&&(e.Length=this.keyBits),4===r&&(e.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV2",Length:this.keyBits/8}},e.StmF="StdCF",e.StrF="StdCF"),e.R=t,e.O=z(s),e.U=z(u),e.P=a}_setupEncryptionV5(r,e){this.keyBits=256;const n=D(e.permissions),t=V(e.userPassword),a=e.ownerPassword?V(e.ownerPassword):t;this.encryptionKey=(0,L.generateRandomWordArray)(32);const i=function(r,e){const n=e(8),t=e(8);return c.SHA256(r.clone().concat(n)).concat(n).concat(t)}(t,L.generateRandomWordArray),o=function(r,e,n){const t=c.SHA256(r.clone().concat(e)),a={mode:c.mode.CBC,padding:c.pad.NoPadding,iv:c.lib.WordArray.create(null,16)};return c.AES.encrypt(n,t,a).ciphertext}(t,c.lib.WordArray.create(i.words.slice(10,12),8),this.encryptionKey),s=function(r,e,n){const t=n(8),a=n(8);return c.SHA256(r.clone().concat(t).concat(e)).concat(t).concat(a)}(a,i,L.generateRandomWordArray),u=function(r,e,n,t){const a=c.SHA256(r.clone().concat(e).concat(n)),i={mode:c.mode.CBC,padding:c.pad.NoPadding,iv:c.lib.WordArray.create(null,16)};return c.AES.encrypt(t,a,i).ciphertext}(a,c.lib.WordArray.create(s.words.slice(10,12),8),i,this.encryptionKey),X=function(r,e,n){const t=c.lib.WordArray.create([I(r),4294967295,1415668834],12).concat(n(4)),a={mode:c.mode.ECB,padding:c.pad.NoPadding};return c.AES.encrypt(t,e,a).ciphertext}(n,this.encryptionKey,L.generateRandomWordArray);r.V=5,r.Length=this.keyBits,r.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV3",Length:this.keyBits/8}},r.StmF="StdCF",r.StrF="StdCF",r.R=5,r.O=z(s),r.OE=z(u),r.U=z(i),r.UE=z(o),r.P=n,r.Perms=z(X)}getEncryptFn(r,e){let n,t;if(this.version<5&&(n=this.encryptionKey.clone().concat(c.lib.WordArray.create([(255&r)<<24|(65280&r)<<8|r>>8&65280|255&e,(65280&e)<<16],5))),1===this.version||2===this.version){let r=c.MD5(n);return r.sigBytes=Math.min(16,this.keyBits/8+5),e=>z(c.RC4.encrypt(c.lib.WordArray.create(e),r).ciphertext)}t=4===this.version?c.MD5(n.concat(c.lib.WordArray.create([1933667412],4))):this.encryptionKey;const a=L.generateRandomWordArray(16),i={mode:c.mode.CBC,padding:c.pad.Pkcs7,iv:a};return r=>z(a.clone().concat(c.AES.encrypt(c.lib.WordArray.create(r),t,i).ciphertext))}end(){this.dictionary.end()}}function D(r={}){let e=-3904;return"lowResolution"===r.printing&&(e|=4),"highResolution"===r.printing&&(e|=2052),r.modifying&&(e|=8),r.copying&&(e|=16),r.annotating&&(e|=32),r.fillingForms&&(e|=256),r.contentAccessibility&&(e|=512),r.documentAssembly&&(e|=1024),e}function F(r=""){const e=n.alloc(32),t=r.length;let a=0;for(;a<t&&a<32;){const n=r.charCodeAt(a);if(n>255)throw new Error("Password contains one or more invalid characters.");e[a]=n,a++}for(;a<32;)e[a]=q[a-t],a++;return c.lib.WordArray.create(e)}function V(r=""){r=unescape(encodeURIComponent(function(r,e={}){if("string"!=typeof r)throw new TypeError("Expected string.");if(0===r.length)return"";const n=E(r).map(r=>Y(r)?32:r).filter(r=>!S(r)),t=String.fromCodePoint.apply(null,n).normalize("NFKC"),a=E(t);if(a.some(w))throw new Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3");if(!0!==e.allowUnassigned&&a.some(b))throw new Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5");const i=a.some(T),c=a.some(_);if(i&&c)throw new Error("String must not contain RandALCat and LCat at the same time, see https://tools.ietf.org/html/rfc3454#section-6");const o=T(R(t[0])),s=T(R((r=>r[r.length-1])(t)));if(i&&(!o||!s))throw new Error("Bidirectional RandALCat character must be the first and the last character of the string, see https://tools.ietf.org/html/rfc3454#section-6");return t}(r)));const e=Math.min(127,r.length),t=n.alloc(e);for(let n=0;n<e;n++)t[n]=r.charCodeAt(n);return c.lib.WordArray.create(t)}function I(r){return(255&r)<<24|(65280&r)<<8|r>>8&65280|r>>24&255}function z(r){const e=[];for(let n=0;n<r.sigBytes;n++)e.push(r.words[Math.floor(n/4)]>>8*(3-n%4)&255);return n.from(e)}const q=[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],{number:M}=h;class j{constructor(r){this.doc=r,this.stops=[],this.embedded=!1,this.transform=[1,0,0,1,0,0]}stop(r,e,n){if(null==n&&(n=1),e=this.doc._normalizeColor(e),0===this.stops.length)if(3===e.length)this._colorSpace="DeviceRGB";else if(4===e.length)this._colorSpace="DeviceCMYK";else{if(1!==e.length)throw new Error("Unknown color space");this._colorSpace="DeviceGray"}else if("DeviceRGB"===this._colorSpace&&3!==e.length||"DeviceCMYK"===this._colorSpace&&4!==e.length||"DeviceGray"===this._colorSpace&&1!==e.length)throw new Error("All gradient stops must use the same color space");return n=Math.max(0,Math.min(1,n)),this.stops.push([r,e,n]),this}setTransform(r,e,n,t,a,i){return this.transform=[r,e,n,t,a,i],this}embed(r){let e;const n=this.stops.length;if(0===n)return;this.embedded=!0,this.matrix=r;const t=this.stops[n-1];t[0]<1&&this.stops.push([1,t[1],t[2]]);const a=[],i=[],c=[];for(let r=0;r<n-1;r++)i.push(0,1),r+2!==n&&a.push(this.stops[r+1][0]),e=this.doc.ref({FunctionType:2,Domain:[0,1],C0:this.stops[r+0][1],C1:this.stops[r+1][1],N:1}),c.push(e),e.end();1===n?e=c[0]:(e=this.doc.ref({FunctionType:3,Domain:[0,1],Functions:c,Bounds:a,Encode:i}),e.end()),this.id="Sh"+ ++this.doc._gradCount;const o=this.shader(e);o.end();const s=this.doc.ref({Type:"Pattern",PatternType:2,Shading:o,Matrix:this.matrix.map(M)});if(s.end(),this.stops.some(r=>r[2]<1)){let r=this.opacityGradient();r._colorSpace="DeviceGray";for(let e of this.stops)r.stop(e[0],[e[2]]);r=r.embed(this.matrix);const e=[0,0,this.doc.page.width,this.doc.page.height],n=this.doc.ref({Type:"XObject",Subtype:"Form",FormType:1,BBox:e,Group:{Type:"Group",S:"Transparency",CS:"DeviceGray"},Resources:{ProcSet:["PDF","Text","ImageB","ImageC","ImageI"],Pattern:{Sh1:r}}});n.write("/Pattern cs /Sh1 scn"),n.end(e.join(" ")+" re f");const t=this.doc.ref({Type:"ExtGState",SMask:{Type:"Mask",S:"Luminosity",G:n}});t.end();const a=this.doc.ref({Type:"Pattern",PatternType:1,PaintType:1,TilingType:2,BBox:e,XStep:e[2],YStep:e[3],Resources:{ProcSet:["PDF","Text","ImageB","ImageC","ImageI"],Pattern:{Sh1:s},ExtGState:{Gs1:t}}});a.write("/Gs1 gs /Pattern cs /Sh1 scn"),a.end(e.join(" ")+" re f"),this.doc.page.patterns[this.id]=a}else this.doc.page.patterns[this.id]=s;return s}apply(r){const[e,n,t,a,i,c]=this.doc._ctm,[o,s,u,X,l,P]=this.transform,K=[e*o+t*s,n*o+a*s,e*u+t*X,n*u+a*X,e*l+t*P+i,n*l+a*P+c];this.embedded&&K.join(" ")===this.matrix.join(" ")||this.embed(K),this.doc._setColorSpace("Pattern",r);const m=r?"SCN":"scn";return this.doc.addContent(`/${this.id} ${m}`)}}class G extends j{constructor(r,e,n,t,a){super(r),this.x1=e,this.y1=n,this.x2=t,this.y2=a}shader(r){return this.doc.ref({ShadingType:2,ColorSpace:this._colorSpace,Coords:[this.x1,this.y1,this.x2,this.y2],Function:r,Extend:[!0,!0]})}opacityGradient(){return new G(this.doc,this.x1,this.y1,this.x2,this.y2)}}class J extends j{constructor(r,e,n,t,a,i,c){super(r),this.doc=r,this.x1=e,this.y1=n,this.r1=t,this.x2=a,this.y2=i,this.r2=c}shader(r){return this.doc.ref({ShadingType:3,ColorSpace:this._colorSpace,Coords:[this.x1,this.y1,this.r1,this.x2,this.y2,this.r2],Function:r,Extend:[!0,!0]})}opacityGradient(){return new J(this.doc,this.x1,this.y1,this.r1,this.x2,this.y2,this.r2)}}var H={PDFGradient:j,PDFLinearGradient:G,PDFRadialGradient:J};const Z=["DeviceCMYK","DeviceRGB"];var Q={PDFTilingPattern:class{constructor(r,e,n,t,a){this.doc=r,this.bBox=e,this.xStep=n,this.yStep=t,this.stream=a}createPattern(){const r=this.doc.ref();r.end();const[e,n,t,a,i,c]=this.doc._ctm,[o,s,u,X,l,P]=[1,0,0,1,0,0],K=[e*o+t*s,n*o+a*s,e*u+t*X,n*u+a*X,e*l+t*P+i,n*l+a*P+c],m=this.doc.ref({Type:"Pattern",PatternType:1,PaintType:2,TilingType:2,BBox:this.bBox,XStep:this.xStep,YStep:this.yStep,Matrix:K.map(r=>+r.toFixed(5)),Resources:r});return m.end(this.stream),m}embedPatternColorSpaces(){Z.forEach(r=>{const e=this.getPatternColorSpaceId(r);if(this.doc.page.colorSpaces[e])return;const n=this.doc.ref(["Pattern",r]);n.end(),this.doc.page.colorSpaces[e]=n})}getPatternColorSpaceId(r){return"CsP"+r}embed(){this.id||(this.doc._patternCount=this.doc._patternCount+1,this.id="P"+this.doc._patternCount,this.pattern=this.createPattern()),this.doc.page.patterns[this.id]||(this.doc.page.patterns[this.id]=this.pattern)}apply(r,e){this.embedPatternColorSpaces(),this.embed();const n=this.doc._normalizeColor(e);if(!n)throw Error(`invalid pattern color. (value: ${e})`);const t=this.getPatternColorSpaceId(this.doc._getColorSpace(n));this.doc._setColorSpace(t,r);const a=r?"SCN":"scn";return this.doc.addContent(`${n.join(" ")} /${this.id} ${a}`)}}};const{PDFGradient:$,PDFLinearGradient:rr,PDFRadialGradient:er}=H,{PDFTilingPattern:nr}=Q;var tr={initColor(){return this._opacityRegistry={},this._opacityCount=0,this._patternCount=0,this._gradCount=0},_normalizeColor(r){if("string"==typeof r)if("#"===r.charAt(0)){4===r.length&&(r=r.replace(/#([0-9A-F])([0-9A-F])([0-9A-F])/i,"#$1$1$2$2$3$3"));const e=parseInt(r.slice(1),16);r=[e>>16,e>>8&255,255&e]}else ar[r]&&(r=ar[r]);return Array.isArray(r)?(3===r.length?r=r.map(r=>r/255):4===r.length&&(r=r.map(r=>r/100)),r):null},_setColor(r,e){return r instanceof $?(r.apply(e),!0):Array.isArray(r)&&r[0]instanceof nr?(r[0].apply(e,r[1]),!0):this._setColorCore(r,e)},_setColorCore(r,e){if(!(r=this._normalizeColor(r)))return!1;const n=e?"SCN":"scn",t=this._getColorSpace(r);return this._setColorSpace(t,e),r=r.join(" "),this.addContent(`${r} ${n}`),!0},_setColorSpace(r,e){const n=e?"CS":"cs";return this.addContent(`/${r} ${n}`)},_getColorSpace:r=>4===r.length?"DeviceCMYK":"DeviceRGB",fillColor(r,e){return this._setColor(r,!1)&&this.fillOpacity(e),this._fillColor=[r,e],this},strokeColor(r,e){return this._setColor(r,!0)&&this.strokeOpacity(e),this},opacity(r){return this._doOpacity(r,r),this},fillOpacity(r){return this._doOpacity(r,null),this},strokeOpacity(r){return this._doOpacity(null,r),this},_doOpacity(r,e){let n,t;if(null==r&&null==e)return;null!=r&&(r=Math.max(0,Math.min(1,r))),null!=e&&(e=Math.max(0,Math.min(1,e)));const a=`${r}_${e}`;return this._opacityRegistry[a]?[n,t]=this._opacityRegistry[a]:(n={Type:"ExtGState"},null!=r&&(n.ca=r),null!=e&&(n.CA=e),n=this.ref(n),n.end(),t="Gs"+ ++this._opacityCount,this._opacityRegistry[a]=[n,t]),this.page.ext_gstates[t]=n,this.addContent(`/${t} gs`)},linearGradient(r,e,n,t){return new rr(this,r,e,n,t)},radialGradient(r,e,n,t,a,i){return new er(this,r,e,n,t,a,i)},pattern(r,e,n,t){return new nr(this,r,e,n,t)}},ar={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};let ir,cr,or,sr,ur,Xr;ir=cr=or=sr=ur=Xr=0;const lr={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0},Pr={M:(r,e)=>(ir=e[0],cr=e[1],or=sr=null,ur=ir,Xr=cr,r.moveTo(ir,cr)),m:(r,e)=>(ir+=e[0],cr+=e[1],or=sr=null,ur=ir,Xr=cr,r.moveTo(ir,cr)),C:(r,e)=>(ir=e[4],cr=e[5],or=e[2],sr=e[3],r.bezierCurveTo(...e)),c:(r,e)=>(r.bezierCurveTo(e[0]+ir,e[1]+cr,e[2]+ir,e[3]+cr,e[4]+ir,e[5]+cr),or=ir+e[2],sr=cr+e[3],ir+=e[4],cr+=e[5]),S:(r,e)=>(null===or&&(or=ir,sr=cr),r.bezierCurveTo(ir-(or-ir),cr-(sr-cr),e[0],e[1],e[2],e[3]),or=e[0],sr=e[1],ir=e[2],cr=e[3]),s:(r,e)=>(null===or&&(or=ir,sr=cr),r.bezierCurveTo(ir-(or-ir),cr-(sr-cr),ir+e[0],cr+e[1],ir+e[2],cr+e[3]),or=ir+e[0],sr=cr+e[1],ir+=e[2],cr+=e[3]),Q:(r,e)=>(or=e[0],sr=e[1],ir=e[2],cr=e[3],r.quadraticCurveTo(e[0],e[1],ir,cr)),q:(r,e)=>(r.quadraticCurveTo(e[0]+ir,e[1]+cr,e[2]+ir,e[3]+cr),or=ir+e[0],sr=cr+e[1],ir+=e[2],cr+=e[3]),T:(r,e)=>(null===or?(or=ir,sr=cr):(or=ir-(or-ir),sr=cr-(sr-cr)),r.quadraticCurveTo(or,sr,e[0],e[1]),or=ir-(or-ir),sr=cr-(sr-cr),ir=e[0],cr=e[1]),t:(r,e)=>(null===or?(or=ir,sr=cr):(or=ir-(or-ir),sr=cr-(sr-cr)),r.quadraticCurveTo(or,sr,ir+e[0],cr+e[1]),ir+=e[0],cr+=e[1]),A:(r,e)=>(Kr(r,ir,cr,e),ir=e[5],cr=e[6]),a:(r,e)=>(e[5]+=ir,e[6]+=cr,Kr(r,ir,cr,e),ir=e[5],cr=e[6]),L:(r,e)=>(ir=e[0],cr=e[1],or=sr=null,r.lineTo(ir,cr)),l:(r,e)=>(ir+=e[0],cr+=e[1],or=sr=null,r.lineTo(ir,cr)),H:(r,e)=>(ir=e[0],or=sr=null,r.lineTo(ir,cr)),h:(r,e)=>(ir+=e[0],or=sr=null,r.lineTo(ir,cr)),V:(r,e)=>(cr=e[0],or=sr=null,r.lineTo(ir,cr)),v:(r,e)=>(cr+=e[0],or=sr=null,r.lineTo(ir,cr)),Z:r=>(r.closePath(),ir=ur,cr=Xr),z:r=>(r.closePath(),ir=ur,cr=Xr)},Kr=function(r,e,n,t){const[a,i,c,o,s,u,X]=t,l=mr(u,X,a,i,o,s,c,e,n);for(let e of l){const n=dr(...e);r.bezierCurveTo(...n)}},mr=function(r,e,n,t,a,i,c,o,s){const u=c*(Math.PI/180),X=Math.sin(u),l=Math.cos(u);n=Math.abs(n),t=Math.abs(t),or=l*(o-r)*.5+X*(s-e)*.5,sr=l*(s-e)*.5-X*(o-r)*.5;let P=or*or/(n*n)+sr*sr/(t*t);P>1&&(P=Math.sqrt(P),n*=P,t*=P);const K=l/n,m=X/n,d=-X/t,h=l/t,f=K*o+m*s,g=d*o+h*s,p=K*r+m*e,A=d*r+h*e;let v=1/((p-f)*(p-f)+(A-g)*(A-g))-.25;v<0&&(v=0);let y=Math.sqrt(v);i===a&&(y=-y);const C=.5*(f+p)-y*(A-g),b=.5*(g+A)+y*(p-f),W=Math.atan2(g-b,f-C);let B=Math.atan2(A-b,p-C)-W;B<0&&1===i?B+=2*Math.PI:B>0&&0===i&&(B-=2*Math.PI);const N=Math.ceil(Math.abs(B/(.5*Math.PI+.001))),x=[];for(let r=0;r<N;r++){const e=W+r*B/N,a=W+(r+1)*B/N;x[r]=[C,b,e,a,n,t,X,l]}return x},dr=function(r,e,n,t,a,i,c,o){const s=o*a,u=-c*i,X=c*a,l=o*i,P=.5*(t-n),K=8/3*Math.sin(.5*P)*Math.sin(.5*P)/Math.sin(P),m=r+Math.cos(n)-K*Math.sin(n),d=e+Math.sin(n)+K*Math.cos(n),h=r+Math.cos(t),f=e+Math.sin(t),g=h+K*Math.sin(t),p=f-K*Math.cos(t);return[s*m+u*d,X*m+l*d,s*g+u*p,X*g+l*p,s*h+u*f,X*h+l*f]},{number:hr}=h,fr=(Math.sqrt(2)-1)/3*4;var gr={initVector(){return this._ctm=[1,0,0,1,0,0],this._ctmStack=[]},save(){return this._ctmStack.push(this._ctm.slice()),this.addContent("q")},restore(){return this._ctm=this._ctmStack.pop()||[1,0,0,1,0,0],this.addContent("Q")},closePath(){return this.addContent("h")},lineWidth(r){return this.addContent(hr(r)+" w")},_CAP_STYLES:{BUTT:0,ROUND:1,SQUARE:2},lineCap(r){return"string"==typeof r&&(r=this._CAP_STYLES[r.toUpperCase()]),this.addContent(r+" J")},_JOIN_STYLES:{MITER:0,ROUND:1,BEVEL:2},lineJoin(r){return"string"==typeof r&&(r=this._JOIN_STYLES[r.toUpperCase()]),this.addContent(r+" j")},miterLimit(r){return this.addContent(hr(r)+" M")},dash(r,e={}){const n=r;if(Array.isArray(r)||(r=[r,e.space||r]),!r.every(r=>Number.isFinite(r)&&r>0))throw new Error(`dash(${JSON.stringify(n)}, ${JSON.stringify(e)}) invalid, lengths must be numeric and greater than zero`);return r=r.map(hr).join(" "),this.addContent(`[${r}] ${hr(e.phase||0)} d`)},undash(){return this.addContent("[] 0 d")},moveTo(r,e){return this.addContent(`${hr(r)} ${hr(e)} m`)},lineTo(r,e){return this.addContent(`${hr(r)} ${hr(e)} l`)},bezierCurveTo(r,e,n,t,a,i){return this.addContent(`${hr(r)} ${hr(e)} ${hr(n)} ${hr(t)} ${hr(a)} ${hr(i)} c`)},quadraticCurveTo(r,e,n,t){return this.addContent(`${hr(r)} ${hr(e)} ${hr(n)} ${hr(t)} v`)},rect(r,e,n,t){return this.addContent(`${hr(r)} ${hr(e)} ${hr(n)} ${hr(t)} re`)},roundedRect(r,e,n,t,a){null==a&&(a=0);const i=(a=Math.min(a,.5*n,.5*t))*(1-fr);return this.moveTo(r+a,e),this.lineTo(r+n-a,e),this.bezierCurveTo(r+n-i,e,r+n,e+i,r+n,e+a),this.lineTo(r+n,e+t-a),this.bezierCurveTo(r+n,e+t-i,r+n-i,e+t,r+n-a,e+t),this.lineTo(r+a,e+t),this.bezierCurveTo(r+i,e+t,r,e+t-i,r,e+t-a),this.lineTo(r,e+a),this.bezierCurveTo(r,e+i,r+i,e,r+a,e),this.closePath()},ellipse(r,e,n,t){null==t&&(t=n);const a=n*fr,i=t*fr,c=(r-=n)+2*n,o=(e-=t)+2*t,s=r+n,u=e+t;return this.moveTo(r,u),this.bezierCurveTo(r,u-i,s-a,e,s,e),this.bezierCurveTo(s+a,e,c,u-i,c,u),this.bezierCurveTo(c,u+i,s+a,o,s,o),this.bezierCurveTo(s-a,o,r,u+i,r,u),this.closePath()},circle(r,e,n){return this.ellipse(r,e,n)},arc(r,e,n,t,a,i){null==i&&(i=!1);const c=2*Math.PI,o=.5*Math.PI;let s=a-t;Math.abs(s)>c?s=c:0!==s&&i!==s<0&&(s=(i?-1:1)*c+s);const u=Math.ceil(Math.abs(s)/o),X=s/u,l=X/o*fr*n;let P=t,K=-Math.sin(P)*l,m=Math.cos(P)*l,d=r+Math.cos(P)*n,h=e+Math.sin(P)*n;this.moveTo(d,h);for(let t=0;t<u;t++){const t=d+K,a=h+m;P+=X,d=r+Math.cos(P)*n,h=e+Math.sin(P)*n,K=-Math.sin(P)*l,m=Math.cos(P)*l;const i=d-K,c=h-m;this.bezierCurveTo(t,a,i,c,d,h)}return this},polygon(...r){this.moveTo(...r.shift()||[]);for(let e of r)this.lineTo(...e||[]);return this.closePath()},path(r){return class{static apply(r,e){!function(r,e){ir=cr=or=sr=ur=Xr=0;for(let n=0;n<r.length;n++){const t=r[n];"function"==typeof Pr[t.cmd]&&Pr[t.cmd](e,t.args)}}(function(r){let e;const n=[];let t=[],a="",i=!1,c=0;for(let o of r)if(null!=lr[o])c=lr[o],e&&(a.length>0&&(t[t.length]=+a),n[n.length]={cmd:e,args:t},t=[],a="",i=!1),e=o;else if([" ",","].includes(o)||"-"===o&&a.length>0&&"e"!==a[a.length-1]||"."===o&&i){if(0===a.length)continue;t.length===c?(n[n.length]={cmd:e,args:t},t=[+a],"M"===e&&(e="L"),"m"===e&&(e="l")):t[t.length]=+a,i="."===o,a=["-","."].includes(o)?o:""}else a+=o,"."===o&&(i=!0);return a.length>0&&(t.length===c?(n[n.length]={cmd:e,args:t},t=[+a],"M"===e&&(e="L"),"m"===e&&(e="l")):t[t.length]=+a),n[n.length]={cmd:e,args:t},n}(e),r)}}.apply(this,r),this},_windingRule:r=>/even-?odd/.test(r)?"*":"",fill(r,e){return/(even-?odd)|(non-?zero)/.test(r)&&(e=r,r=null),r&&this.fillColor(r),this.addContent("f"+this._windingRule(e))},stroke(r){return r&&this.strokeColor(r),this.addContent("S")},fillAndStroke(r,e,n){null==e&&(e=r);const t=/(even-?odd)|(non-?zero)/;return t.test(r)&&(n=r,r=null),t.test(e)&&(n=e,e=r),r&&(this.fillColor(r),this.strokeColor(e)),this.addContent("B"+this._windingRule(n))},clip(r){return this.addContent("W"+this._windingRule(r))},endPath(){return this.addContent("n")},transform(r,e,n,t,a,i){const c=this._ctm,[o,s,u,X,l,P]=c;c[0]=o*r+u*e,c[1]=s*r+X*e,c[2]=o*n+u*t,c[3]=s*n+X*t,c[4]=o*a+u*i+l,c[5]=s*a+X*i+P;const K=[r,e,n,t,a,i].map(r=>hr(r)).join(" ");return this.addContent(K+" cm")},translate(r,e){return this.transform(1,0,0,1,r,e)},rotate(r,e={}){let n;const t=r*Math.PI/180,a=Math.cos(t),i=Math.sin(t);let c=n=0;if(null!=e.origin){[c,n]=e.origin;const r=c*i+n*a;c-=c*a-n*i,n-=r}return this.transform(a,i,-i,a,c,n)},scale(r,e,n={}){let t;null==e&&(e=r),"object"==typeof e&&(n=e,e=r);let a=t=0;return null!=n.origin&&([a,t]=n.origin,a-=r*a,t-=e*t),this.transform(r,0,0,e,a,t)}};const pr={402:131,8211:150,8212:151,8216:145,8217:146,8218:130,8220:147,8221:148,8222:132,8224:134,8225:135,8226:149,8230:133,8364:128,8240:137,8249:139,8250:155,710:136,8482:153,338:140,339:156,732:152,352:138,353:154,376:159,381:142,382:158},Ar=" .notdef .notdef .notdef .notdef\n .notdef .notdef .notdef .notdef\n .notdef .notdef .notdef .notdef\n .notdef .notdef .notdef .notdef\n .notdef .notdef .notdef .notdef\n .notdef .notdef .notdef .notdef\n .notdef .notdef .notdef .notdef\n .notdef .notdef .notdef .notdef\n \n space exclam quotedbl numbersign\n dollar percent ampersand quotesingle\n parenleft parenright asterisk plus\n comma hyphen period slash\n zero one two three\n four five six seven\n eight nine colon semicolon\n less equal greater question\n \n at A B C\n D E F G\n H I J K\n L M N O\n P Q R S\n T U V W\n X Y Z bracketleft\n backslash bracketright asciicircum underscore\n \n grave a b c\n d e f g\n h i j k\n l m n o\n p q r s\n t u v w\n x y z braceleft\n bar braceright asciitilde .notdef\n \n Euro .notdef quotesinglbase florin\n quotedblbase ellipsis dagger daggerdbl\n circumflex perthousand Scaron guilsinglleft\n OE .notdef Zcaron .notdef\n .notdef quoteleft quoteright quotedblleft\n quotedblright bullet endash emdash\n tilde trademark scaron guilsinglright\n oe .notdef zcaron ydieresis\n \n space exclamdown cent sterling\n currency yen brokenbar section\n dieresis copyright ordfeminine guillemotleft\n logicalnot hyphen registered macron\n degree plusminus twosuperior threesuperior\n acute mu paragraph periodcentered\n cedilla onesuperior ordmasculine guillemotright\n onequarter onehalf threequarters questiondown\n \n Agrave Aacute Acircumflex Atilde\n Adieresis Aring AE Ccedilla\n Egrave Eacute Ecircumflex Edieresis\n Igrave Iacute Icircumflex Idieresis\n Eth Ntilde Ograve Oacute\n Ocircumflex Otilde Odieresis multiply\n Oslash Ugrave Uacute Ucircumflex\n Udieresis Yacute Thorn germandbls\n \n agrave aacute acircumflex atilde\n adieresis aring ae ccedilla\n egrave eacute ecircumflex edieresis\n igrave iacute icircumflex idieresis\n eth ntilde ograve oacute\n ocircumflex otilde odieresis divide\n oslash ugrave uacute ucircumflex\n udieresis yacute thorn ydieresis ".split(/\s+/);class vr{static open(r){return new vr(a.readFileSync(r,"utf8"))}constructor(r){this.contents=r,this.attributes={},this.glyphWidths={},this.boundingBoxes={},this.kernPairs={},this.parse(),this.charWidths=new Array(256);for(let r=0;r<=255;r++)this.charWidths[r]=this.glyphWidths[Ar[r]];this.bbox=this.attributes.FontBBox.split(/\s+/).map(r=>+r),this.ascender=+(this.attributes.Ascender||0),this.descender=+(this.attributes.Descender||0),this.xHeight=+(this.attributes.XHeight||0),this.capHeight=+(this.attributes.CapHeight||0),this.lineGap=this.bbox[3]-this.bbox[1]-(this.ascender-this.descender)}parse(){let r="";for(let c of this.contents.split("\n")){var e,n;if(e=c.match(/^Start(\w+)/))r=e[1];else if(e=c.match(/^End(\w+)/))r="";else switch(r){case"FontMetrics":var t=(e=c.match(/(^\w+)\s+(.*)/))[1],a=e[2];(n=this.attributes[t])?(Array.isArray(n)||(n=this.attributes[t]=[n]),n.push(a)):this.attributes[t]=a;break;case"CharMetrics":if(!/^CH?\s/.test(c))continue;var i=c.match(/\bN\s+(\.?\w+)\s*;/)[1];this.glyphWidths[i]=+c.match(/\bWX\s+(\d+)\s*;/)[1];break;case"KernPairs":(e=c.match(/^KPX\s+(\.?\w+)\s+(\.?\w+)\s+(-?\d+)/))&&(this.kernPairs[e[1]+"\0"+e[2]]=parseInt(e[3]))}}}encodeText(r){const e=[];for(let n=0,t=r.length;n<t;n++){let t=r.charCodeAt(n);t=pr[t]||t,e.push(t.toString(16))}return e}glyphsForString(r){const e=[];for(let n=0,t=r.length;n<t;n++){const t=r.charCodeAt(n);e.push(this.characterToGlyph(t))}return e}characterToGlyph(r){return Ar[pr[r]||r]||".notdef"}widthOfGlyph(r){return this.glyphWidths[r]||0}getKernPair(r,e){return this.kernPairs[r+"\0"+e]||0}advancesForGlyphs(r){const e=[];for(let n=0;n<r.length;n++){const t=r[n],a=r[n+1];e.push(this.widthOfGlyph(t)+this.getKernPair(t,a))}return e}}class yr{constructor(){}encode(){throw new Error("Must be implemented by subclasses")}widthOfString(){throw new Error("Must be implemented by subclasses")}ref(){return null!=this.dictionary?this.dictionary:this.dictionary=this.document.ref()}finalize(){if(!this.embedded&&null!=this.dictionary)return this.embed(),this.embedded=!0}embed(){throw new Error("Must be implemented by subclasses")}lineHeight(r,e){null==e&&(e=!1);const n=e?this.lineGap:0;return(this.ascender+n-this.descender)/1e3*r}}const Cr={Courier:()=>"StartFontMetrics 4.1\r\nComment Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.\r\nComment Creation Date: Thu May 1 17:27:09 1997\r\nComment UniqueID 43050\r\nComment VMusage 39754 50779\r\nFontName Courier\r\nFullName Courier\r\nFamilyName Courier\r\nWeight Medium\r\nItalicAngle 0\r\nIsFixedPitch true\r\nCharacterSet ExtendedRoman\r\nFontBBox -23 -250 715 805 \r\nUnderlinePosition -100\r\nUnderlineThickness 50\r\nVersion 003.000\r\nNotice Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.\r\nEncodingScheme AdobeStandardEncoding\r\nCapHeight 562\r\nXHeight 426\r\nAscender 629\r\nDescender -157\r\nStdHW 51\r\nStdVW 51\r\nStartCharMetrics 315\r\nC 32 ; WX 600 ; N space ; B 0 0 0 0 ;\r\nC 33 ; WX 600 ; N exclam ; B 236 -15 364 572 ;\r\nC 34 ; WX 600 ; N quotedbl ; B 187 328 413 562 ;\r\nC 35 ; WX 600 ; N numbersign ; B 93 -32 507 639 ;\r\nC 36 ; WX 600 ; N dollar ; B 105 -126 496 662 ;\r\nC 37 ; WX 600 ; N percent ; B 81 -15 518 622 ;\r\nC 38 ; WX 600 ; N ampersand ; B 63 -15 538 543 ;\r\nC 39 ; WX 600 ; N quoteright ; B 213 328 376 562 ;\r\nC 40 ; WX 600 ; N parenleft ; B 269 -108 440 622 ;\r\nC 41 ; WX 600 ; N parenright ; B 160 -108 331 622 ;\r\nC 42 ; WX 600 ; N asterisk ; B 116 257 484 607 ;\r\nC 43 ; WX 600 ; N plus ; B 80 44 520 470 ;\r\nC 44 ; WX 600 ; N comma ; B 181 -112 344 122 ;\r\nC 45 ; WX 600 ; N hyphen ; B 103 231 497 285 ;\r\nC 46 ; WX 600 ; N period ; B 229 -15 371 109 ;\r\nC 47 ; WX 600 ; N slash ; B 125 -80 475 629 ;\r\nC 48 ; WX 600 ; N zero ; B 106 -15 494 622 ;\r\nC 49 ; WX 600 ; N one ; B 96 0 505 622 ;\r\nC 50 ; WX 600 ; N two ; B 70 0 471 622 ;\r\nC 51 ; WX 600 ; N three ; B 75 -15 466 622 ;\r\nC 52 ; WX 600 ; N four ; B 78 0 500 622 ;\r\nC 53 ; WX 600 ; N five ; B 92 -15 497 607 ;\r\nC 54 ; WX 600 ; N six ; B 111 -15 497 622 ;\r\nC 55 ; WX 600 ; N seven ; B 82 0 483 607 ;\r\nC 56 ; WX 600 ; N eight ; B 102 -15 498 622 ;\r\nC 57 ; WX 600 ; N nine ; B 96 -15 489 622 ;\r\nC 58 ; WX 600 ; N colon ; B 229 -15 371 385 ;\r\nC 59 ; WX 600 ; N semicolon ; B 181 -112 371 385 ;\r\nC 60 ; WX 600 ; N less ; B 41 42 519 472 ;\r\nC 61 ; WX 600 ; N equal ; B 80 138 520 376 ;\r\nC 62 ; WX 600 ; N greater ; B 66 42 544 472 ;\r\nC 63 ; WX 600 ; N question ; B 129 -15 492 572 ;\r\nC 64 ; WX 600 ; N at ; B 77 -15 533 622 ;\r\nC 65 ; WX 600 ; N A ; B 3 0 597 562 ;\r\nC 66 ; WX 600 ; N B ; B 43 0 559 562 ;\r\nC 67 ; WX 600 ; N C ; B 41 -18 540 580 ;\r\nC 68 ; WX 600 ; N D ; B 43 0 574 562 ;\r\nC 69 ; WX 600 ; N E ; B 53 0 550 562 ;\r\nC 70 ; WX 600 ; N F ; B 53 0 545 562 ;\r\nC 71 ; WX 600 ; N G ; B 31 -18 575 580 ;\r\nC 72 ; WX 600 ; N H ; B 32 0 568 562 ;\r\nC 73 ; WX 600 ; N I ; B 96 0 504 562 ;\r\nC 74 ; WX 600 ; N J ; B 34 -18 566 562 ;\r\nC 75 ; WX 600 ; N K ; B 38 0 582 562 ;\r\nC 76 ; WX 600 ; N L ; B 47 0 554 562 ;\r\nC 77 ; WX 600 ; N M ; B 4 0 596 562 ;\r\nC 78 ; WX 600 ; N N ; B 7 -13 593 562 ;\r\nC 79 ; WX 600 ; N O ; B 43 -18 557 580 ;\r\nC 80 ; WX 600 ; N P ; B 79 0 558 562 ;\r\nC 81 ; WX 600 ; N Q ; B 43 -138 557 580 ;\r\nC 82 ; WX 600 ; N R ; B 38 0 588 562 ;\r\nC 83 ; WX 600 ; N S ; B 72 -20 529 580 ;\r\nC 84 ; WX 600 ; N T ; B 38 0 563 562 ;\r\nC 85 ; WX 600 ; N U ; B 17 -18 583 562 ;\r\nC 86 ; WX 600 ; N V ; B -4 -13 604 562 ;\r\nC 87 ; WX 600 ; N W ; B -3 -13 603 562 ;\r\nC 88 ; WX 600 ; N X ; B 23 0 577 562 ;\r\nC 89 ; WX 600 ; N Y ; B 24 0 576 562 ;\r\nC 90 ; WX 600 ; N Z ; B 86 0 514 562 ;\r\nC 91 ; WX 600 ; N bracketleft ; B 269 -108 442 622 ;\r\nC 92 ; WX 600 ; N backslash ; B 118 -80 482 629 ;\r\nC 93 ; WX 600 ; N bracketright ; B 158 -108 331 622 ;\r\nC 94 ; WX 600 ; N asciicircum ; B 94 354 506 622 ;\r\nC 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ;\r\nC 96 ; WX 600 ; N quoteleft ; B 224 328 387 562 ;\r\nC 97 ; WX 600 ;