/*!
 * PSPDFKit for Web 2024.5.1 (https://pspdfkit.com/web)
 *
 * Copyright (c) 2016-2024 PSPDFKit GmbH. All rights reserved.
 *
 * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
 * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
 * This notice may not be removed from this file.
 *
 * PSPDFKit uses several open source third-party components: https://pspdfkit.com/acknowledgements/web/
 */
"use strict";(globalThis.webpackChunkPSPDFKit=globalThis.webpackChunkPSPDFKit||[]).push([[4132],{27425:(e,t,n)=>{n.d(t,{default:()=>a});var r=n(20477),o=n.n(r);function a(){return o()('/*!\n * PSPDFKit for Web 2024.5.1 (https://pspdfkit.com/web)\n *\n * Copyright (c) 2016-2024 PSPDFKit GmbH. All rights reserved.\n *\n * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW\n * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.\n * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.\n * This notice may not be removed from this file.\n *\n * PSPDFKit uses several open source third-party components: https://pspdfkit.com/acknowledgements/web/\n */(()=>{var e={9662:(e,t,n)=>{var r=n(614),o=n(6330),a=TypeError;e.exports=function(e){if(r(e))return e;throw a(o(e)+" is not a function")}},9670:(e,t,n)=>{var r=n(111),o=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw a(o(e)+" is not an object")}},1318:(e,t,n)=>{var r=n(5656),o=n(1400),a=n(6244),i=function(e){return function(t,n,i){var s,c=r(t),u=a(c),l=o(i,u);if(e&&n!=n){for(;u>l;)if((s=c[l++])!=s)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},206:(e,t,n)=>{var r=n(1702);e.exports=r([].slice)},4326:(e,t,n)=>{var r=n(1702),o=r({}.toString),a=r("".slice);e.exports=function(e){return a(o(e),8,-1)}},9920:(e,t,n)=>{var r=n(2597),o=n(3887),a=n(1236),i=n(3070);e.exports=function(e,t,n){for(var s=o(t),c=i.f,u=a.f,l=0;l<s.length;l++){var d=s[l];r(e,d)||n&&r(n,d)||c(e,d,u(t,d))}}},8880:(e,t,n)=>{var r=n(9781),o=n(3070),a=n(9114);e.exports=r?function(e,t,n){return o.f(e,t,a(1,n))}:function(e,t,n){return e[t]=n,e}},9114:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},8052:(e,t,n)=>{var r=n(614),o=n(3070),a=n(6339),i=n(3072);e.exports=function(e,t,n,s){s||(s={});var c=s.enumerable,u=void 0!==s.name?s.name:t;if(r(n)&&a(n,u,s),s.global)c?e[t]=n:i(t,n);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:o.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},3072:(e,t,n)=>{var r=n(7854),o=Object.defineProperty;e.exports=function(e,t){try{o(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},9781:(e,t,n)=>{var r=n(7293);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:e=>{var t="object"==typeof document&&document.all,n=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:n}},317:(e,t,n)=>{var r=n(7854),o=n(111),a=r.document,i=o(a)&&o(a.createElement);e.exports=function(e){return i?a.createElement(e):{}}},9363:e=>{e.exports="function"==typeof Bun&&Bun&&"string"==typeof Bun.version},6833:(e,t,n)=>{var r=n(8113);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},5268:(e,t,n)=>{var r=n(4326),o=n(7854);e.exports="process"==r(o.process)},8113:(e,t,n)=>{var r=n(5005);e.exports=r("navigator","userAgent")||""},7392:(e,t,n)=>{var r,o,a=n(7854),i=n(8113),s=a.process,c=a.Deno,u=s&&s.versions||c&&c.version,l=u&&u.v8;l&&(o=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&i&&(!(r=i.match(/Edge\\/(\\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\\/(\\d+)/))&&(o=+r[1]),e.exports=o},748:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:(e,t,n)=>{var r=n(7854),o=n(1236).f,a=n(8880),i=n(8052),s=n(3072),c=n(9920),u=n(4705);e.exports=function(e,t){var n,l,d,p,f,m=e.target,g=e.global,h=e.stat;if(n=g?r:h?r[m]||s(m,{}):(r[m]||{}).prototype)for(l in t){if(p=t[l],d=e.dontCallGetSet?(f=o(n,l))&&f.value:n[l],!u(g?l:m+(h?".":"#")+l,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&a(p,"sham",!0),i(n,l,p,e)}}},7293:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},2104:(e,t,n)=>{var r=n(4374),o=Function.prototype,a=o.apply,i=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?i.bind(a):function(){return i.apply(a,arguments)})},9974:(e,t,n)=>{var r=n(1470),o=n(9662),a=n(4374),i=r(r.bind);e.exports=function(e,t){return o(e),void 0===t?e:a?i(e,t):function(){return e.apply(t,arguments)}}},4374:(e,t,n)=>{var r=n(7293);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},6916:(e,t,n)=>{var r=n(4374),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},6530:(e,t,n)=>{var r=n(9781),o=n(2597),a=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,s=o(a,"name"),c=s&&"something"===function(){}.name,u=s&&(!r||r&&i(a,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},1470:(e,t,n)=>{var r=n(4326),o=n(1702);e.exports=function(e){if("Function"===r(e))return o(e)}},1702:(e,t,n)=>{var r=n(4374),o=Function.prototype,a=o.call,i=r&&o.bind.bind(a,a);e.exports=r?i:function(e){return function(){return a.apply(e,arguments)}}},5005:(e,t,n)=>{var r=n(7854),o=n(614),a=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?a(r[e]):r[e]&&r[e][t]}},8173:(e,t,n)=>{var r=n(9662),o=n(8554);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},7854:(e,t,n)=>{var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},2597:(e,t,n)=>{var r=n(1702),o=n(7908),a=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(o(e),t)}},3501:e=>{e.exports={}},490:(e,t,n)=>{var r=n(5005);e.exports=r("document","documentElement")},4664:(e,t,n)=>{var r=n(9781),o=n(7293),a=n(317);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},8361:(e,t,n)=>{var r=n(1702),o=n(7293),a=n(4326),i=Object,s=r("".split);e.exports=o((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"==a(e)?s(e,""):i(e)}:i},2788:(e,t,n)=>{var r=n(1702),o=n(614),a=n(5465),i=r(Function.toString);o(a.inspectSource)||(a.inspectSource=function(e){return i(e)}),e.exports=a.inspectSource},9909:(e,t,n)=>{var r,o,a,i=n(4811),s=n(7854),c=n(111),u=n(8880),l=n(2597),d=n(5465),p=n(6200),f=n(3501),m="Object already initialized",g=s.TypeError,h=s.WeakMap;if(i||d.state){var y=d.state||(d.state=new h);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw g(m);return t.facade=e,y.set(e,t),t},o=function(e){return y.get(e)||{}},a=function(e){return y.has(e)}}else{var b=p("state");f[b]=!0,r=function(e,t){if(l(e,b))throw g(m);return t.facade=e,u(e,b,t),t},o=function(e){return l(e,b)?e[b]:{}},a=function(e){return l(e,b)}}e.exports={set:r,get:o,has:a,enforce:function(e){return a(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(t)).type!==e)throw g("Incompatible receiver, "+e+" required");return n}}}},614:(e,t,n)=>{var r=n(4154),o=r.all;e.exports=r.IS_HTMLDDA?function(e){return"function"==typeof e||e===o}:function(e){return"function"==typeof e}},4705:(e,t,n)=>{var r=n(7293),o=n(614),a=/#|\\.prototype\\./,i=function(e,t){var n=c[s(e)];return n==l||n!=u&&(o(t)?r(t):!!t)},s=i.normalize=function(e){return String(e).replace(a,".").toLowerCase()},c=i.data={},u=i.NATIVE="N",l=i.POLYFILL="P";e.exports=i},8554:e=>{e.exports=function(e){return null==e}},111:(e,t,n)=>{var r=n(614),o=n(4154),a=o.all;e.exports=o.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:r(e)||e===a}:function(e){return"object"==typeof e?null!==e:r(e)}},1913:e=>{e.exports=!1},2190:(e,t,n)=>{var r=n(5005),o=n(614),a=n(7976),i=n(3307),s=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&a(t.prototype,s(e))}},6244:(e,t,n)=>{var r=n(7466);e.exports=function(e){return r(e.length)}},6339:(e,t,n)=>{var r=n(7293),o=n(614),a=n(2597),i=n(9781),s=n(6530).CONFIGURABLE,c=n(2788),u=n(9909),l=u.enforce,d=u.get,p=Object.defineProperty,f=i&&!r((function(){return 8!==p((function(){}),"length",{value:8}).length})),m=String(String).split("String"),g=e.exports=function(e,t,n){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\\(([^)]*)\\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||s&&e.name!==t)&&(i?p(e,"name",{value:t,configurable:!0}):e.name=t),f&&n&&a(n,"arity")&&e.length!==n.arity&&p(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?i&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=l(e);return a(r,"source")||(r.source=m.join("string"==typeof t?t:"")),e};Function.prototype.toString=g((function(){return o(this)&&d(this).source||c(this)}),"toString")},4758:e=>{var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},3070:(e,t,n)=>{var r=n(9781),o=n(4664),a=n(3353),i=n(9670),s=n(4948),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",f="writable";t.f=r?a?function(e,t,n){if(i(e),t=s(t),i(n),"function"==typeof e&&"prototype"===t&&"value"in n&&f in n&&!n.writable){var r=l(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:p in n?n.configurable:r.configurable,enumerable:d in n?n.enumerable:r.enumerable,writable:!1})}return u(e,t,n)}:u:function(e,t,n){if(i(e),t=s(t),i(n),o)try{return u(e,t,n)}catch(e){}if("get"in n||"set"in n)throw c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},1236:(e,t,n)=>{var r=n(9781),o=n(6916),a=n(5296),i=n(9114),s=n(5656),c=n(4948),u=n(2597),l=n(4664),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),l)try{return d(e,t)}catch(e){}if(u(e,t))return i(!o(a.f,e,t),e[t])}},8006:(e,t,n)=>{var r=n(6324),o=n(748).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},5181:(e,t)=>{t.f=Object.getOwnPropertySymbols},7976:(e,t,n)=>{var r=n(1702);e.exports=r({}.isPrototypeOf)},6324:(e,t,n)=>{var r=n(1702),o=n(2597),a=n(5656),i=n(1318).indexOf,s=n(3501),c=r([].push);e.exports=function(e,t){var n,r=a(e),u=0,l=[];for(n in r)!o(s,n)&&o(r,n)&&c(l,n);for(;t.length>u;)o(r,n=t[u++])&&(~i(l,n)||c(l,n));return l}},5296:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2140:(e,t,n)=>{var r=n(6916),o=n(614),a=n(111),i=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&o(n=e.toString)&&!a(s=r(n,e)))return s;if(o(n=e.valueOf)&&!a(s=r(n,e)))return s;if("string"!==t&&o(n=e.toString)&&!a(s=r(n,e)))return s;throw i("Can\'t convert object to primitive value")}},3887:(e,t,n)=>{var r=n(5005),o=n(1702),a=n(8006),i=n(5181),s=n(9670),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=a.f(s(e)),n=i.f;return n?c(t,n(e)):t}},4488:(e,t,n)=>{var r=n(8554),o=TypeError;e.exports=function(e){if(r(e))throw o("Can\'t call method on "+e);return e}},7152:(e,t,n)=>{"use strict";var r,o=n(7854),a=n(2104),i=n(614),s=n(9363),c=n(8113),u=n(206),l=n(8053),d=o.Function,p=/MSIE .\\./.test(c)||s&&((r=o.Bun.version.split(".")).length<3||0==r[0]&&(r[1]<3||3==r[1]&&0==r[2]));e.exports=function(e,t){var n=t?2:1;return p?function(r,o){var s=l(arguments.length,1)>n,c=i(r)?r:d(r),p=s?u(arguments,n):[],f=s?function(){a(c,this,p)}:c;return t?e(f,o):e(f)}:e}},6200:(e,t,n)=>{var r=n(2309),o=n(9711),a=r("keys");e.exports=function(e){return a[e]||(a[e]=o(e))}},5465:(e,t,n)=>{var r=n(7854),o=n(3072),a="__core-js_shared__",i=r[a]||o(a,{});e.exports=i},2309:(e,t,n)=>{var r=n(1913),o=n(5465);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.27.1",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.1/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:(e,t,n)=>{var r=n(7392),o=n(7293);e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},261:(e,t,n)=>{var r,o,a,i,s=n(7854),c=n(2104),u=n(9974),l=n(614),d=n(2597),p=n(7293),f=n(490),m=n(206),g=n(317),h=n(8053),y=n(6833),b=n(5268),w=s.setImmediate,v=s.clearImmediate,_=s.process,O=s.Dispatch,F=s.Function,S=s.MessageChannel,x=s.String,I=0,E={},A="onreadystatechange";try{r=s.location}catch(e){}var j=function(e){if(d(E,e)){var t=E[e];delete E[e],t()}},D=function(e){return function(){j(e)}},P=function(e){j(e.data)},k=function(e){s.postMessage(x(e),r.protocol+"//"+r.host)};w&&v||(w=function(e){h(arguments.length,1);var t=l(e)?e:F(e),n=m(arguments,1);return E[++I]=function(){c(t,void 0,n)},o(I),I},v=function(e){delete E[e]},b?o=function(e){_.nextTick(D(e))}:O&&O.now?o=function(e){O.now(D(e))}:S&&!y?(i=(a=new S).port2,a.port1.onmessage=P,o=u(i.postMessage,i)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&r&&"file:"!==r.protocol&&!p(k)?(o=k,s.addEventListener("message",P,!1)):o=A in g("script")?function(e){f.appendChild(g("script")).onreadystatechange=function(){f.removeChild(this),j(e)}}:function(e){setTimeout(D(e),0)}),e.exports={set:w,clear:v}},1400:(e,t,n)=>{var r=n(9303),o=Math.max,a=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):a(n,t)}},5656:(e,t,n)=>{var r=n(8361),o=n(4488);e.exports=function(e){return r(o(e))}},9303:(e,t,n)=>{var r=n(4758);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},7466:(e,t,n)=>{var r=n(9303),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},7908:(e,t,n)=>{var r=n(4488),o=Object;e.exports=function(e){return o(r(e))}},7593:(e,t,n)=>{var r=n(6916),o=n(111),a=n(2190),i=n(8173),s=n(2140),c=n(5112),u=TypeError,l=c("toPrimitive");e.exports=function(e,t){if(!o(e)||a(e))return e;var n,c=i(e,l);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||a(n))return n;throw u("Can\'t convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},4948:(e,t,n)=>{var r=n(7593),o=n(2190);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},6330:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},9711:(e,t,n)=>{var r=n(1702),o=0,a=Math.random(),i=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++o+a,36)}},3307:(e,t,n)=>{var r=n(6293);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:(e,t,n)=>{var r=n(9781),o=n(7293);e.exports=r&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8053:e=>{var t=TypeError;e.exports=function(e,n){if(e<n)throw t("Not enough arguments");return e}},4811:(e,t,n)=>{var r=n(7854),o=n(614),a=r.WeakMap;e.exports=o(a)&&/native code/.test(String(a))},5112:(e,t,n)=>{var r=n(7854),o=n(2309),a=n(2597),i=n(9711),s=n(6293),c=n(3307),u=o("wks"),l=r.Symbol,d=l&&l.for,p=c?l:l&&l.withoutSetter||i;e.exports=function(e){if(!a(u,e)||!s&&"string"!=typeof u[e]){var t="Symbol."+e;s&&a(l,e)?u[e]=l[e]:u[e]=c&&d?d(t):p(t)}return u[e]}},1091:(e,t,n)=>{var r=n(2109),o=n(7854),a=n(261).clear;r({global:!0,bind:!0,enumerable:!0,forced:o.clearImmediate!==a},{clearImmediate:a})},4633:(e,t,n)=>{n(1091),n(2986)},2986:(e,t,n)=>{var r=n(2109),o=n(7854),a=n(261).set,i=n(7152),s=o.setImmediate?i(a,!1):a;r({global:!0,bind:!0,enumerable:!0,forced:o.setImmediate!==s},{setImmediate:s})},2923:()=>{},1117:e=>{e.exports="4fba0e2d92d49d53"},5349:e=>{e.exports="91fc6676a4a3c1b9"}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(4633);"object"==typeof window&&(window._babelPolyfill=!1);const e=function e(t){let n;return n=t instanceof Error?t:new Error(t),Object.setPrototypeOf(n,e.prototype),n};e.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const t=e;function r(e,n){if(!e)throw new t(`Assertion failed: ${n||"Condition not met"}\\n\\nFor further assistance, please go to: https://pspdfkit.com/support/request`)}function o(e){console.log(e)}function a(){console.warn(...arguments)}function i(e){console.error(e)}["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",\'[tabindex]:not([tabindex^="-"])\'].join(",");function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function c(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}function u(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}new WeakMap;const l="function"==typeof Buffer,d=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),p=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(d),f=/^(?:[A-Za-z\\d+\\/]{4})*?(?:[A-Za-z\\d+\\/]{2}(?:==)?|[A-Za-z\\d+\\/]{3}=?)?$/,m=String.fromCharCode.bind(String),g="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),h=e=>e.replace(/[^A-Za-z0-9\\+\\/]/g,""),y=e=>{let t,n,r,o,a="";const i=e.length%3;for(let i=0;i<e.length;){if((n=e.charCodeAt(i++))>255||(r=e.charCodeAt(i++))>255||(o=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,a+=d[t>>18&63]+d[t>>12&63]+d[t>>6&63]+d[63&t]}return i?a.slice(0,i-3)+"===".substring(i):a},b=e=>{if(e=e.replace(/\\s+/g,""),!f.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,r,o="";for(let a=0;a<e.length;)t=p[e.charAt(a++)]<<18|p[e.charAt(a++)]<<12|(n=p[e.charAt(a++)])<<6|(r=p[e.charAt(a++)]),o+=64===n?m(t>>16&255):64===r?m(t>>16&255,t>>8&255):m(t>>16&255,t>>8&255,255&t);return o},w="function"==typeof atob?e=>atob(h(e)):l?e=>Buffer.from(e,"base64").toString("binary"):b,v=l?e=>g(Buffer.from(e,"base64")):e=>g(w(e).split("").map((e=>e.charCodeAt(0)))),_=e=>v(O(e)),O=e=>h(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),F=_;function S(e){return{name:e.name,scale:{unitFrom:e.scale.unitFrom,unitTo:e.scale.unitTo,from:Number(e.scale.fromValue),to:Number(e.scale.toValue)},precision:e.precision}}var x=n(1117),I=n.n(x),E=n(5349),A=n.n(E),j=n(2923),D=n.n(j);let P;P="object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node?D():function(e){return"object"==typeof window?new Promise(((t,n)=>{const o=document.createElement("script");o.type="text/javascript",o.async=!0,o.onload=()=>t(window.PSPDFModuleInit),o.onerror=n,o.src=e;const{documentElement:a}=document;r(a),a.appendChild(o)})):(self.importScripts(e),Promise.resolve(self.PSPDFModuleInit))};const k=P,T="pspdfkit-lib/",C=`${T}pspdfkit${"-"+A()}.wasm.js`,N=`${T}pspdfkit${"-"+I()}.wasm`;function B(e,t){let n;if("object"==typeof e){n=e.wasm;return{wasmBinaryFile:N,locateFile:e=>e,wasmBinary:n}}const r={wasmBinaryFile:e+N,locateFile:e=>e,wasmBinary:n};{const e=fetch(r.wasmBinaryFile,{credentials:"same-origin"}),n=13689907;e.then((e=>{const t=e.headers.get("content-length");return t&&parseInt(t)>=n&&a("The WASM binary file is being served without compression. Due to its size, it\'s recommended to configure the server so application/wasm files are served with compression.\\n\\nFind more details in our Standalone performance guides: https://pspdfkit.com/guides/web/best-practices/caching-on-the-web/#gzip-and-brotli"),e})).catch((e=>{throw new Error(`Failed to load WASM binary file: ${e}`)})),r.instantiateWasm=(n,a)=>((async()=>{o(`Start ${r.wasmBinaryFile} download.`);const s=Date.now();let c,u;const l=!t&&"function"==typeof WebAssembly.instantiateStreaming;function d(){return e.then((e=>{if(!e.ok)throw new Error(`Error loading ${r.wasmBinaryFile}: ${e.statusText}`);return e.arrayBuffer()})).then((e=>(u=Date.now(),o(`Download complete, took: ${u-s}ms`),WebAssembly.instantiate(new Uint8Array(e),n))))}c=l?WebAssembly.instantiateStreaming(e,n).then((e=>(u=Date.now(),o(`Download and Instantiation complete, took: ${Date.now()-s}ms`),e))).catch((e=>{if(/mime.*type/i.test(e.message))return i(e.message),null;throw e})):d();let p=await c;null===p&&(i("Streaming instantiation failed! Falling back to classic instantiation. This might result in slower initialization time therefore we highly recommend to follow the troubleshooting instructions in our guides to fix this error: https://pspdfkit.com/guides/web/current/troubleshooting/common-issues/#response-has-unsupported-mime-type-error."),p=await d()),!l&&u&&o(`Compilation and Instantiation complete, took: ${Date.now()-u}ms`),a(p.instance,p.module)})(),{})}return r}function $(e){e.PSPDFLoggingServices={error(e,t){i(`[${e}] ${t}`)},warn(e,t){a(`[${e}] ${t}`)},info(e,t){0},debug(e,t){0},trace(e,t){0}},e.PSPDFUnicodeServices={stripDiacritics(e){const t={Á:"A",Ă:"A",Ắ:"A",Ặ:"A",Ằ:"A",Ẳ:"A",Ẵ:"A",Ǎ:"A",Â:"A",Ấ:"A",Ậ:"A",Ầ:"A",Ẩ:"A",Ẫ:"A",Ä:"A",Ǟ:"A",Ȧ:"A",Ǡ:"A",Ạ:"A",Ȁ:"A",À:"A",Ả:"A",Ȃ:"A",Ā:"A",Ą:"A",Å:"A",Ǻ:"A",Ḁ:"A",Ⱥ:"A",Ã:"A",Ꜳ:"AA",Æ:"AE",Ǽ:"AE",Ǣ:"AE",Ꜵ:"AO",Ꜷ:"AU",Ꜹ:"AV",Ꜻ:"AV",Ꜽ:"AY",Ḃ:"B",Ḅ:"B",Ɓ:"B",Ḇ:"B",Ƀ:"B",Ƃ:"B",Ć:"C",Č:"C",Ç:"C",Ḉ:"C",Ĉ:"C",Ċ:"C",Ƈ:"C",Ȼ:"C",Ď:"D",Ḑ:"D",Ḓ:"D",Ḋ:"D",Ḍ:"D",Ɗ:"D",Ḏ:"D",ǲ:"D",ǅ:"D",Đ:"D",Ƌ:"D",Ǳ:"DZ",Ǆ:"DZ",É:"E",Ĕ:"E",Ě:"E",Ȩ:"E",Ḝ:"E",Ê:"E",Ế:"E",Ệ:"E",Ề:"E",Ể:"E",Ễ:"E",Ḙ:"E",Ë:"E",Ė:"E",Ẹ:"E",Ȅ:"E",È:"E",Ẻ:"E",Ȇ:"E",Ē:"E",Ḗ:"E",Ḕ:"E",Ę:"E",Ɇ:"E",Ẽ:"E",Ḛ:"E",Ꝫ:"ET",Ḟ:"F",Ƒ:"F",Ǵ:"G",Ğ:"G",Ǧ:"G",Ģ:"G",Ĝ:"G",Ġ:"G",Ɠ:"G",Ḡ:"G",Ǥ:"G",Ḫ:"H",Ȟ:"H",Ḩ:"H",Ĥ:"H",Ⱨ:"H",Ḧ:"H",Ḣ:"H",Ḥ:"H",Ħ:"H",Í:"I",Ĭ:"I",Ǐ:"I",Î:"I",Ï:"I",Ḯ:"I",İ:"I",Ị:"I",Ȉ:"I",Ì:"I",Ỉ:"I",Ȋ:"I",Ī:"I",Į:"I",Ɨ:"I",Ĩ:"I",Ḭ:"I",Ꝺ:"D",Ꝼ:"F",Ᵹ:"G",Ꞃ:"R",Ꞅ:"S",Ꞇ:"T",Ꝭ:"IS",Ĵ:"J",Ɉ:"J",Ḱ:"K",Ǩ:"K",Ķ:"K",Ⱪ:"K",Ꝃ:"K",Ḳ:"K",Ƙ:"K",Ḵ:"K",Ꝁ:"K",Ꝅ:"K",Ĺ:"L",Ƚ:"L",Ľ:"L",Ļ:"L",Ḽ:"L",Ḷ:"L",Ḹ:"L",Ⱡ:"L",Ꝉ:"L",Ḻ:"L",Ŀ:"L",Ɫ:"L",ǈ:"L",Ł:"L",Ǉ:"LJ",Ḿ:"M",Ṁ:"M",Ṃ:"M",Ɱ:"M",Ń:"N",Ň:"N",Ņ:"N",Ṋ:"N",Ṅ:"N",Ṇ:"N",Ǹ:"N",Ɲ:"N",Ṉ:"N",Ƞ:"N",ǋ:"N",Ñ:"N",Ǌ:"NJ",Ó:"O",Ŏ:"O",Ǒ:"O",Ô:"O",Ố:"O",Ộ:"O",Ồ:"O",Ổ:"O",Ỗ:"O",Ö:"O",Ȫ:"O",Ȯ:"O",Ȱ:"O",Ọ:"O",Ő:"O",Ȍ:"O",Ò:"O",Ỏ:"O",Ơ:"O",Ớ:"O",Ợ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ȏ:"O",Ꝋ:"O",Ꝍ:"O",Ō:"O",Ṓ:"O",Ṑ:"O",Ɵ:"O",Ǫ:"O",Ǭ:"O",Ø:"O",Ǿ:"O",Õ:"O",Ṍ:"O",Ṏ:"O",Ȭ:"O",Ƣ:"OI",Ꝏ:"OO",Ɛ:"E",Ɔ:"O",Ȣ:"OU",Ṕ:"P",Ṗ:"P",Ꝓ:"P",Ƥ:"P",Ꝕ:"P",Ᵽ:"P",Ꝑ:"P",Ꝙ:"Q",Ꝗ:"Q",Ŕ:"R",Ř:"R",Ŗ:"R",Ṙ:"R",Ṛ:"R",Ṝ:"R",Ȑ:"R",Ȓ:"R",Ṟ:"R",Ɍ:"R",Ɽ:"R",Ꜿ:"C",Ǝ:"E",Ś:"S",Ṥ:"S",Š:"S",Ṧ:"S",Ş:"S",Ŝ:"S",Ș:"S",Ṡ:"S",Ṣ:"S",Ṩ:"S",Ť:"T",Ţ:"T",Ṱ:"T",Ț:"T",Ⱦ:"T",Ṫ:"T",Ṭ:"T",Ƭ:"T",Ṯ:"T",Ʈ:"T",Ŧ:"T",Ɐ:"A",Ꞁ:"L",Ɯ:"M",Ʌ:"V",Ꜩ:"TZ",Ú:"U",Ŭ:"U",Ǔ:"U",Û:"U",Ṷ:"U",Ü:"U",Ǘ:"U",Ǚ:"U",Ǜ:"U",Ǖ:"U",Ṳ:"U",Ụ:"U",Ű:"U",Ȕ:"U",Ù:"U",Ủ:"U",Ư:"U",Ứ:"U",Ự:"U",Ừ:"U",Ử:"U",Ữ:"U",Ȗ:"U",Ū:"U",Ṻ:"U",Ų:"U",Ů:"U",Ũ:"U",Ṹ:"U",Ṵ:"U",Ꝟ:"V",Ṿ:"V",Ʋ:"V",Ṽ:"V",Ꝡ:"VY",Ẃ:"W",Ŵ:"W",Ẅ:"W",Ẇ:"W",Ẉ:"W",Ẁ:"W",Ⱳ:"W",Ẍ:"X",Ẋ:"X",Ý:"Y",Ŷ:"Y",Ÿ:"Y",Ẏ:"Y",Ỵ:"Y",Ỳ:"Y",Ƴ:"Y",Ỷ:"Y",Ỿ:"Y",Ȳ:"Y",Ɏ:"Y",Ỹ:"Y",Ź:"Z",Ž:"Z",Ẑ:"Z",Ⱬ:"Z",Ż:"Z",Ẓ:"Z",Ȥ:"Z",Ẕ:"Z",Ƶ:"Z",Ĳ:"IJ",Œ:"OE",ᴀ:"A",ᴁ:"AE",ʙ:"B",ᴃ:"B",ᴄ:"C",ᴅ:"D",ᴇ:"E",ꜰ:"F",ɢ:"G",ʛ:"G",ʜ:"H",ɪ:"I",ʁ:"R",ᴊ:"J",ᴋ:"K",ʟ:"L",ᴌ:"L",ᴍ:"M",ɴ:"N",ᴏ:"O",ɶ:"OE",ᴐ:"O",ᴕ:"OU",ᴘ:"P",ʀ:"R",ᴎ:"N",ᴙ:"R",ꜱ:"S",ᴛ:"T",ⱻ:"E",ᴚ:"R",ᴜ:"U",ᴠ:"V",ᴡ:"W",ʏ:"Y",ᴢ:"Z",á:"a",ă:"a",ắ:"a",ặ:"a",ằ:"a",ẳ:"a",ẵ:"a",ǎ:"a",â:"a",ấ:"a",ậ:"a",ầ:"a",ẩ:"a",ẫ:"a",ä:"a",ǟ:"a",ȧ:"a",ǡ:"a",ạ:"a",ȁ:"a",à:"a",ả:"a",ȃ:"a",ā:"a",ą:"a",ᶏ:"a",ẚ:"a",å:"a",ǻ:"a",ḁ:"a",ⱥ:"a",ã:"a",ꜳ:"aa",æ:"ae",ǽ:"ae",ǣ:"ae",ꜵ:"ao",ꜷ:"au",ꜹ:"av",ꜻ:"av",ꜽ:"ay",ḃ:"b",ḅ:"b",ɓ:"b",ḇ:"b",ᵬ:"b",ᶀ:"b",ƀ:"b",ƃ:"b",ɵ:"o",ć:"c",č:"c",ç:"c",ḉ:"c",ĉ:"c",ɕ:"c",ċ:"c",ƈ:"c",ȼ:"c",ď:"d",ḑ:"d",ḓ:"d",ȡ:"d",ḋ:"d",ḍ:"d",ɗ:"d",ᶑ:"d",ḏ:"d",ᵭ:"d",ᶁ:"d",đ:"d",ɖ:"d",ƌ:"d",ı:"i",ȷ:"j",ɟ:"j",ʄ:"j",ǳ:"dz",ǆ:"dz",é:"e",ĕ:"e",ě:"e",ȩ:"e",ḝ:"e",ê:"e",ế:"e",ệ:"e",ề:"e",ể:"e",ễ:"e",ḙ:"e",ë:"e",ė:"e",ẹ:"e",ȅ:"e",è:"e",ẻ:"e",ȇ:"e",ē:"e",ḗ:"e",ḕ:"e",ⱸ:"e",ę:"e",ᶒ:"e",ɇ:"e",ẽ:"e",ḛ:"e",ꝫ:"et",ḟ:"f",ƒ:"f",ᵮ:"f",ᶂ:"f",ǵ:"g",ğ:"g",ǧ:"g",ģ:"g",ĝ:"g",ġ:"g",ɠ:"g",ḡ:"g",ᶃ:"g",ǥ:"g",ḫ:"h",ȟ:"h",ḩ:"h",ĥ:"h",ⱨ:"h",ḧ:"h",ḣ:"h",ḥ:"h",ɦ:"h",ẖ:"h",ħ:"h",ƕ:"hv",í:"i",ĭ:"i",ǐ:"i",î:"i",ï:"i",ḯ:"i",ị:"i",ȉ:"i",ì:"i",ỉ:"i",ȋ:"i",ī:"i",į:"i",ᶖ:"i",ɨ:"i",ĩ:"i",ḭ:"i",ꝺ:"d",ꝼ:"f",ᵹ:"g",ꞃ:"r",ꞅ:"s",ꞇ:"t",ꝭ:"is",ǰ:"j",ĵ:"j",ʝ:"j",ɉ:"j",ḱ:"k",ǩ:"k",ķ:"k",ⱪ:"k",ꝃ:"k",ḳ:"k",ƙ:"k",ḵ:"k",ᶄ:"k",ꝁ:"k",ꝅ:"k",ĺ:"l",ƚ:"l",ɬ:"l",ľ:"l",ļ:"l",ḽ:"l",ȴ:"l",ḷ:"l",ḹ:"l",ⱡ:"l",ꝉ:"l",ḻ:"l",ŀ:"l",ɫ:"l",ᶅ:"l",ɭ:"l",ł:"l",ǉ:"lj",ſ:"s",ẜ:"s",ẛ:"s",ẝ:"s",ḿ:"m",ṁ:"m",ṃ:"m",ɱ:"m",ᵯ:"m",ᶆ:"m",ń:"n",ň:"n",ņ:"n",ṋ:"n",ȵ:"n",ṅ:"n",ṇ:"n",ǹ:"n",ɲ:"n",ṉ:"n",ƞ:"n",ᵰ:"n",ᶇ:"n",ɳ:"n",ñ:"n",ǌ:"nj",ó:"o",ŏ:"o",ǒ:"o",ô:"o",ố:"o",ộ:"o",ồ:"o",ổ:"o",ỗ:"o",ö:"o",ȫ:"o",ȯ:"o",ȱ:"o",ọ:"o",ő:"o",ȍ:"o",ò:"o",ỏ:"o",ơ:"o",ớ:"o",ợ:"o",ờ:"o",ở:"o",ỡ:"o",ȏ:"o",ꝋ:"o",ꝍ:"o",ⱺ:"o",ō:"o",ṓ:"o",ṑ:"o",ǫ:"o",ǭ:"o",ø:"o",ǿ:"o",õ:"o",ṍ:"o",ṏ:"o",ȭ:"o",ƣ:"oi",ꝏ:"oo",ɛ:"e",ᶓ:"e",ɔ:"o",ᶗ:"o",ȣ:"ou",ṕ:"p",ṗ:"p",ꝓ:"p",ƥ:"p",ᵱ:"p",ᶈ:"p",ꝕ:"p",ᵽ:"p",ꝑ:"p",ꝙ:"q",ʠ:"q",ɋ:"q",ꝗ:"q",ŕ:"r",ř:"r",ŗ:"r",ṙ:"r",ṛ:"r",ṝ:"r",ȑ:"r",ɾ:"r",ᵳ:"r",ȓ:"r",ṟ:"r",ɼ:"r",ᵲ:"r",ᶉ:"r",ɍ:"r",ɽ:"r",ↄ:"c",ꜿ:"c",ɘ:"e",ɿ:"r",ś:"s",ṥ:"s",š:"s",ṧ:"s",ş:"s",ŝ:"s",ș:"s",ṡ:"s",ṣ:"s",ṩ:"s",ʂ:"s",ᵴ:"s",ᶊ:"s",ȿ:"s",ɡ:"g",ᴑ:"o",ᴓ:"o",ᴝ:"u",ť:"t",ţ:"t",ṱ:"t",ț:"t",ȶ:"t",ẗ:"t",ⱦ:"t",ṫ:"t",ṭ:"t",ƭ:"t",ṯ:"t",ᵵ:"t",ƫ:"t",ʈ:"t",ŧ:"t",ᵺ:"th",ɐ:"a",ᴂ:"ae",ǝ:"e",ᵷ:"g",ɥ:"h",ʮ:"h",ʯ:"h",ᴉ:"i",ʞ:"k",ꞁ:"l",ɯ:"m",ɰ:"m",ᴔ:"oe",ɹ:"r",ɻ:"r",ɺ:"r",ⱹ:"r",ʇ:"t",ʌ:"v",ʍ:"w",ʎ:"y",ꜩ:"tz",ú:"u",ŭ:"u",ǔ:"u",û:"u",ṷ:"u",ü:"u",ǘ:"u",ǚ:"u",ǜ:"u",ǖ:"u",ṳ:"u",ụ:"u",ű:"u",ȕ:"u",ù:"u",ủ:"u",ư:"u",ứ:"u",ự:"u",ừ:"u",ử:"u",ữ:"u",ȗ:"u",ū:"u",ṻ:"u",ų:"u",ᶙ:"u",ů:"u",ũ:"u",ṹ:"u",ṵ:"u",ᵫ:"ue",ꝸ:"um",ⱴ:"v",ꝟ:"v",ṿ:"v",ʋ:"v",ᶌ:"v",ⱱ:"v",ṽ:"v",ꝡ:"vy",ẃ:"w",ŵ:"w",ẅ:"w",ẇ:"w",ẉ:"w",ẁ:"w",ⱳ:"w",ẘ:"w",ẍ:"x",ẋ:"x",ᶍ:"x",ý:"y",ŷ:"y",ÿ:"y",ẏ:"y",ỵ:"y",ỳ:"y",ƴ:"y",ỷ:"y",ỿ:"y",ȳ:"y",ẙ:"y",ɏ:"y",ỹ:"y",ź:"z",ž:"z",ẑ:"z",ʑ:"z",ⱬ:"z",ż:"z",ẓ:"z",ȥ:"z",ẕ:"z",ᵶ:"z",ᶎ:"z",ʐ:"z",ƶ:"z",ɀ:"z",ﬀ:"ff",ﬃ:"ffi",ﬄ:"ffl",ﬁ:"fi",ﬂ:"fl",ĳ:"ij",œ:"oe",ﬆ:"st",ₐ:"a",ₑ:"e",ᵢ:"i",ⱼ:"j",ₒ:"o",ᵣ:"r",ᵤ:"u",ᵥ:"v",ₓ:"x"};if(!e.normalize)return e;const n=e.replace(/[^A-Za-z0-9[\\] ]/g,(function(e){return t[e]||e}));return e.normalize("NFC").length==n.normalize("NFC").length?n:""},escapeRegExp:e=>e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&"),match(e,t,n){const r=new RegExp(t,n?"g":"gi"),o=[];let a=r.exec(e);for(;null!=a;)o.push([a.index,a[0].length]),a=r.exec(e);return o},exec:(e,t)=>new RegExp(e).exec(t)}}function M(e){const t=new FileReader;return new Promise(((n,r)=>{t.onerror=e=>{r(new Error(e))},t.onload=e=>{n(new Uint8Array(e.target?.result))},t.readAsArrayBuffer(e)}))}const J="text",R="documentA",U="documentB",L="result",z="Maui_Android",W="Maui_iOS",V="Maui_MacCatalyst",q="Maui_Windows",K="FlutterForWeb",G="Electron",Z="cms",H="unableToShape",Y="requiresMoreFonts";async function X(e){try{const n=await fetch(e).catch((n=>{throw new t(`Error fetching dynamic fonts file ${e}. ${n}`)}));if(200!==n.status)throw new t(`Error fetching dynamic fonts file ${e}. Status code: ${n.status}`);return n}catch(e){throw e}}function Q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis.navigator?.userAgent??"";return e.indexOf("Trident/")>-1?"trident":e.indexOf("Edge/")>-1?"edge":e.indexOf("Chrome/")>-1?"blink":e.indexOf("AppleWebKit/")>-1?"webkit":e.indexOf("Gecko/")>-1?"gecko":"unknown"}function ee(e,t){const n=new RegExp(` ${t}/(\\\\d+)\\\\.*`);let r;return(r=e.match(n))?Number(r[1]):0}function te(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis.navigator?.userAgent??"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:globalThis.navigator?.platform??"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:globalThis.navigator?.maxTouchPoints??0;return t.indexOf("MacIntel")>-1&&n>1?"ios":e.indexOf("Win")>-1?"windows":e.indexOf("iPhone")>-1||e.indexOf("iPad")>-1||"iPad"===t?"ios":e.indexOf("Mac")>-1?"macos":e.indexOf("Android")>-1?"android":e.indexOf("Linux")>-1?"linux":"unknown"}Q();const ne=te(),re=(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis.navigator?.userAgent;switch(Q(e)){case"trident":return ee(e,"Trident");case"edge":return ee(e,"Edge");case"blink":return ee(e,"Chrome");case"webkit":return ee(e,"Version");case"gecko":return ee(e,"Firefox");default:;}}(),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:te(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Q();"ios"===e||"android"===e||oe(t)}(),"ios"===ne||oe(),"ios"===ne);function oe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q();return("undefined"==typeof window||!window.PSPDFKIT_PLAYWRIGHT_TEST)&&("webkit"===e&&"undefined"!=typeof TouchEvent)}let ae;"undefined"!=typeof window&&(window.addEventListener("mousemove",(function e(){ae=!1,window.removeEventListener("mousemove",e)})),window.addEventListener("pointermove",(function e(t){"mouse"!==t.pointerType&&"pen"!==t.pointerType||(ae=!1),window.removeEventListener("pointermove",e)})));/Mac/i.test(globalThis.navigator?.platform);function ie(){return"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron/")>=0}const se="/create.pdf",ce="/save.pdf",ue="/embedded.pdf",le="WebAssembly module not loaded.";let de=null,pe=!1,fe=!1,me=null,ge=[],he=null,ye=null,be=null;const we=new Set,ve="/fonts";let _e;const Oe=new Set;let Fe=!1;var Se=function(e){return e[e.Daemon=0]="Daemon",e[e.WASM=1]="WASM",e}(Se||{});const xe=[];function Ie(e){return null!=e&&null!=e.length&&0===e.length}const Ee=["configurePDFJavaScriptSupport","closeDocument","setFormValues","openDocument","saveDocument","importXFDF","importInstantDocumentJSON"],Ae={annotationsAndForms:"annotations_and_forms",assemble:"assemble",extract:"extract",extractAccessibility:"extract_accessibility",fillForms:"fill_forms",modification:"modification",printHighQuality:"print_high_quality",printing:"printing"};function je(e){let t;r(de,"WebAssembly module not loaded."),Fe&&(t=performance.now());for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];const i=o.map((e=>Ie(e)?JSON.stringify(e):e));Ee.includes(e)&&Ue();const s=de[e](...i)||\'{ "success": true }\',c=JSON.parse(s);if(Fe&&xe.push({type:Se.WASM,name:e,args:i,time:performance.now()-t}),!c.success)throw new Error(c.error);return c}function De(e){let t;r(de,"WebAssembly module not loaded."),Fe&&(t=performance.now());for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];Ee.includes(e)&&Ue();const i=o.map((e=>Ie(e)?JSON.stringify(e):e)),s=de[e](...i);return Fe&&xe.push({type:Se.WASM,name:e,args:i,time:performance.now()-t}),s}const Pe=["run_pdf_formatting_scripts","run_pdf_javascript","set_form_values_get_script_changes","edit_document","prepare_sign","sign","on_keystroke_event","save_document","update_annotation"];function ke(e){const t=new ArrayBuffer(2*e.length),n=new Uint16Array(t);for(let t=0,r=e.length;t<r;t++)n[t]=e.charCodeAt(t);return t}function Te(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;r(de,"WebAssembly module not loaded.");const o=JSON.stringify({type:e,...t});let a,i;if(Fe&&(a=performance.now()),Pe.includes(e)&&Ue(),n)try{const e="string"==typeof n?new Uint8Array(ke(n)):new Uint8Array(n),t=de.allocateMemory(e.byteLength);try{t.view.set(e);const n=de.memoryHandleToVector(t);try{i=de.dispatchCommandWithBinary(o,n)}finally{n.delete()}}finally{t.delete()}}catch(e){throw e}else i=de.dispatchCommand(o);if(i.hasError()){const t=new Error(i.getErrorMessage()||"There was an error while executing the command: "+e);throw i.delete(),t}const s=[];for(let e=0;e<i.getRepliesCount();e++)i.hasJSONReply(e)&&s.push(JSON.parse(i.getJSONReply(e))),i.hasBinaryReply(e)&&s.push(i.getBinaryReply(e).slice(0));return Fe&&xe.push({type:Se.Daemon,name:e,args:[o],time:performance.now()-a}),i.delete(),s}function Ce(e,t){return`${e}/${t}.pdf`}async function Ne(e,t){const n=Math.random().toString(36).slice(-5),o=await Promise.all(Object.entries(t).map((async t=>{let[r,o]=t;return e.forEach((e=>{"document"in e&&e.document===r&&"importDocument"===e.type?(!1===e.treatImportedDocumentAsOnePage&&(e.treatImportedDocumentAsOnePage=void 0),e.document=Ce(n,r)):("dataFilePath"in e&&e.dataFilePath===r&&"applyInstantJson"===e.type||"dataFilePath"in e&&e.dataFilePath===r&&"applyXfdf"===e.type)&&(e.dataFilePath=Ce(n,r))})),{basename:r,buffer:await M(o)}})));return o.forEach((e=>{!function(e,t,n){r(de,le),de.FS.analyzePath(e).exists||de.FS.mkdir(e),de.FS.writeFile(Ce(e,t),n)}(n,e.basename,e.buffer)})),function(){o.forEach((e=>{!function(e,t){r(de,le),de.FS.unlink(Ce(e,t))}(n,e.basename)}))}}function Be(){fe=!0;const e=je("configurePDFJavaScriptSupport",!0);return r(e.success,"An error occurred while executing the document level JavaScript."),e.changes||[]}function $e(e,t){let n;try{n=Te("edit_document",{save_path:t,operations:e})}catch(e){throw new Error(`Error applying operations to document: ${e.message}`)}return n}let Me,Je=null,Re=!1;function Ue(){Re||(Je=null,Me=!1)}function Le(e){Re&&!e&&(Re=!1,Je&&We(Je)),Re=e}function ze(){return null===Je&&(Je=Te("read_form_json_objects",{include_line_height_factor:!1}),Me=!1),Je}function We(e){if(Re){if(null===e)throw Re=!1,new Error("Error enqueuing form JSON objects: form fields JSON is null.");return Je&&!Me&&(Me=!0),void(Je=e)}if(Me||!Re)try{Ue(),Te("apply_form_json_objects",{form_fields_with_widgets:e})}catch(e){throw new Error("Error applying form JSON objects to /create.pdf: "+e.message)}}function Ve(e,t,n,o,a,i){const s=Ke(a,{width:n,height:o});if(r("number"==typeof e.pageIndex,"Annotation must have a pageIndex"),!we.has(e.pdfObjectId))try{r("number"==typeof e.pdfObjectId,"Cannot call renderAnnotation() for an annotation without pdfObjectId.");const t=Te("render_annotation",{page:e.pageIndex,annotation_id:e.pdfObjectId,format:s,bitmap_width:n,bitmap_height:o,appearance_stream_type:i||"normal"});if("bitmap"===s)return t[0];{const e=new Blob([t[0]],{type:`image/${s}`});return URL.createObjectURL(e)}}catch(e){return void 0}}const qe={SharePoint:"SPO",Salesforce:"SF",[W]:"MauiIOS",[z]:"MauiAndroid",[V]:"MauiMacCatalyst",[q]:"MauiWindows",[K]:"FlutterForWeb",NodeJS:"NodeJS",Electron:"Electron"};function Ke(e,t){let{width:n,height:r}=t;return"webp"===e&&(n>16383||r>16383)||re&&n*r>16777216&&"bitmap"===e?"png":e}function Ge(e){const t=[];for(let n=0;n<e.length;n++)t.push(Ae[e[n]]);return t}function Ze(e,t){return e.pdfObjectId===t.pdfObjectId}const He=new class{constructor(){u(this,"_pdfObjectIdsForIds",{}),u(this,"comparisonDocuments",{}),u(this,"lastOpenedComparisonDocument",null),u(this,"persistedOpenDocument",null)}loadNativeModule(e,t){let{disableWebAssemblyStreaming:n,enableAutomaticLinkExtraction:r,overrideMemoryLimit:a}=t;return ye=Date.now(),pe=r,me=a,function(e,t){let n,r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:globalThis;return new Promise((async i=>{n=B(e,t),"string"==typeof e&&(r=await k(`${e}${C}`)),o("Using WASM method"),$(a),i({nativeModule:await r(n)})}))}(e,n).then((e=>{let{nativeModule:t}=e;de=t;const n=je("PSPDFKitVersion").version;if(1!==n)throw new Error(`Native version mismatch. Please update the dependencies. Expected 1 but got ${n}.`)}))}corePBProtoBridge(e,t,n){const r=de.allocateMemory(n.byteLength);let o;try{r.view.set(n),o=de.corePBProtoBridge(e,t,r);const a={success:o.success,result:o.result.view.slice()};return Promise.resolve(a)}finally{r.delete(),o&&o.result&&o.result.delete()}}async writeFile(e,t){r(de,le),de.FS.writeFile(e,new Uint8Array(t))}async readFile(e){return r(de,le),de.FS.readFile(e)}async load(e,t,n){let a,{mainThreadOrigin:i,customFonts:s,dynamicFonts:c,productId:u}=n;r(de,le);try{if(de.FS.analyzePath(ve).exists||de.FS.mkdir(ve),_e=s?"/fonts/custom-fonts":"",s&&!de.FS.analyzePath(_e).exists&&function(e,t){r(de,le),de.FS.analyzePath(t).exists||de.FS.mkdir(t),de.FS.mount(de.FS.filesystems.WORKERFS,{blobs:e},t)}(s,_e),ie()&&(r(null==u||u===G,`PSPDFKit is running on Electron, but has been setup to be used with ${u}Please contact support to resolve the issue.`),u=G),a=de.initPSPDFKit(null==t?"":t,i,ve,"",u&&void 0!==qe[u]?qe[u]:""),c){const e=await X(c);Te("dynamic_font_loading/set_metadata_file",void 0,await e.arrayBuffer()),be=c.split("/").slice(0,-1).join("/")}}catch(e){throw e}const l=JSON.parse(a);if(ye&&o(`Native initialization complete, took: ${Date.now()-ye}ms`),!l.success)throw new Error("Failed to initialize PSPDFKit: "+l.error);return l}getNativeModule(){return de}async openDocument(e,t,n){try{return r(de,le),null!==me&&je("overrideMemoryLimit",me),he=t,de.FS.writeFile(se,new Uint8Array(e)),this.openAndReturnDocumentInfo(n)}finally{this._pdfObjectIdsForIds={}}}async getSuggestedLineHeightFactor(e,t){return Te("get_suggested_line_height_factor",{annotation_ids:[e],page:t})[0].line_height_factors[e.toString()]}async getAvailableFontFaces(e){if(!e)return[];return Te("get_available_font_faces")[0]?.font_faces.reduce(((t,n)=>{const r=e.find((e=>e.name===n.path.replace(`${_e}/`,"")));return r?t.concat({readableName:n.fullName,name:r.name}):t}),[])}async setFontSubstitutions(e){try{Te("set_font_substitutions",{substitutions:e})}catch(e){throw new Error("Error setting fonts substitutions: "+e.message)}}async getClosestSnapPoint(e,t){return Te("get_closest_snap",{q:[e,t]})[0]}async configureSnapper(e){Te("configure_snapper",{page:e})}async reloadDocument(){try{return Le(!1),je("closeDocument"),this.openAndReturnDocumentInfo()}finally{this._pdfObjectIdsForIds={}}}async openAndReturnDocumentInfo(e){je("openDocument",se,JSON.stringify({password:he})),fe&&Be(),je("automaticLinkExtraction",pe);const t=je("getDocumentInfo").documentInfo;if(t.pageCount<=0)return t;let n=[];if("number"==typeof e){const r=await this.getPageInfo(e);for(let o=0;o<t.pageCount;o++){const t={...r,pageIndex:o,pageLabel:e===o?r.pageLabel:String(o+1)};n.push(t)}}else n=await this.getAllPageInfos(t.pageCount);return t.pages=n,t}async getPageInfo(e){try{const t=Te("page_info",{query:"page_info",page:e});r(1===t.length,"expected page_info result to return 1 result when specifying index.");const n=(new TextDecoder).decode(t[0]);return JSON.parse(n).pageInfo}catch(t){return i(`Dimensional information for page ${e} unavailable, page will not be displayed.`),{height:0,matrix:[0,0,0,0,0,0],pageLabel:"",reverseMatrix:[0,0,0,0,0,0],transformedBBox:[0,0,0,0],untransformedBBox:[0,0,0,0],width:0,pageIndex:e,rawPdfBoxes:{bleedBox:null,cropBox:null,mediaBox:null,trimBox:null}}}}async preflightRenderAnnotationText(e,t,n,o){const a=()=>"number"==typeof t&&"number"==typeof n?Te("dynamic_font_loading/preflight_annotation",{text:e,annotation_id:t,page:n})[0]:(r(o,`annotation not set: ${o}`),Te("dynamic_font_loading/preflight_annotation",{text:e,annotation_json:o})[0]);try{let e=a();e.preflight_result===Y&&(await this.addDynamicFonts(e.required_fonts),e=a()),"number"==typeof t&&(e.preflight_result===H?we.add(t):we.delete(t))}catch(n){i(`There was an error testing rendering for annotation ${t} of this text: ${e}: ${n.message}`)}}async addDynamicFonts(e){let t=[];try{t=e.filter((e=>!Oe.has(e)));!function(e){r(de,le),e.forEach((e=>{de.FS.analyzePath(`/fonts/${e.name}`).exists||de.FS.writeFile(`/fonts/${e.name}`,new Uint8Array(e.data))}))}((await Promise.all(t.map((e=>fetch(`${be}/${e}`).then((e=>e.arrayBuffer())))))).map(((e,n)=>({name:t[n],data:e})))),t.forEach((e=>{Oe.add(e)}))}catch(e){t.forEach((e=>{Oe.delete(e)})),i(`There was an error loading a font: ${e}`)}await Te("dynamic_font_loading/notify_fonts_added",{added_fonts:t.map((e=>({remote_file_path:e,local_file_name:e})))})}async getAllPageInfos(e){const t=[];try{const n=Te("page_info",{query:"page_info",page:"all"});r(n.length===e,"expected the same length of page info response to page count.");for(let e=0;e<n.length;e++){const r=(new TextDecoder).decode(n[e]),o=JSON.parse(r);t.push(o.pageInfo)}}catch(n){i("There was an error retrieving page information for all pages from core. Reverting to individual queries.");for(let n=0;n<e;n++)try{const e=Te("page_info",{query:"page_info",page:n});r(1===e.length,"expected page_info result to return 1 result when specifying index.");const o=(new TextDecoder).decode(e[0]),a=JSON.parse(o);t.push(a.pageInfo)}catch(e){i(`Dimensional information for page ${n} unavailable, page will not be displayed.`);const r={height:0,matrix:[0,0,0,0,0,0],pageLabel:"",reverseMatrix:[0,0,0,0,0,0],transformedBBox:[0,0,0,0],untransformedBBox:[0,0,0,0],width:0,pageIndex:n,rawPdfBoxes:{bleedBox:null,cropBox:null,mediaBox:null,trimBox:null}};t.push(r)}}return t}async enablePDFJavaScriptSupport(){return Be()}async runPDFFormattingScripts(e,t){let n;r(fe,"PDF Formatting Scripts can only run after JavaScript is enabled.");try{n=Te("run_pdf_formatting_scripts",{form_fqns:e,only_if_no_ap_stream:t})}catch(e){throw new Error("An error occurred while executing the document level JavaScript formatting.\\n\\n"+e.message)}return n[0].changes||[]}async openDocumentAt(){throw new Error("Should never be called")}async getBookmarks(){const e=Te("get_bookmarks");return r(1===e.length,"expected only one response for getBookmarks"),e[0].bookmarks||[]}async getFormJSON(){return je("getFormJSON").formJSON}async getFormValues(){return je("getFormValues").formValues}async setFormValues(e){const t=ze();let n=!1;const r=[],o=t.map((t=>{const o=e.find((e=>e.name===t.formField.name));return o?o.value===t.value||Array.isArray(o.value)&&Array.isArray(t.value)&&o.value.every(((e,n)=>e===t.value[n]))?t:("string"==typeof o.value&&o.value.length>0?r.push({widgets:t.widgets,text:o.value}):t.widgets.forEach((e=>{"number"==typeof e.pdfObjectId&&we.delete(e.pdfObjectId)})),n=!0,{...t,value:o.value}):t}));if(n){if(be)for(let e=0;e<r.length;e++){const t=r[e].widgets;for(let n=0;n<t.length;n++)await this.preflightWidgetAnnotation(t[n],t[n].pdfObjectId,r[e].text)}We(o)}}async setFormFieldValue(e){await this.setFormValues([e])}async applyOperations(e,t){const n=await Ne(e,t);$e(e,se),n()}async exportPDFWithOperations(e,t){const n=await Ne(e,t);let o;r(de,le);try{$e(e,ce),o=de.FS.readFile(ce).buffer}catch(e){throw new Error("Error applying operations: "+e.message)}return n(),o}async getSignaturesInfo(){try{return Te("get_signatures",{certificate_check_time:"current_time"})[0]}catch(e){throw new Error(`Error getting signatures info: ${e.message}`)}}async getComments(){try{return Te("get_comments")}catch(e){throw new Error(`Error getting comments: ${e.message}`)}}async applyComments(e){try{return Te("apply_comments",{comments:e})}catch(e){throw new Error(`Error applying comments: ${e.message}`)}}async prepareSign(e,t,n,o,a,i){let s;try{s=Te("get_signatures",{certificate_check_time:"current_time"})[0];const e="not_signed"!==s.status;je("saveDocument",ce,!1,e,false,false,"pdf",!1),je("openDocument",ce,JSON.stringify({password:he}))}catch(e){throw new Error(`Error saving document backup for invisible signing: ${e}`)}try{const e=!n&&"not_signed"!==s.status;je("saveDocument",se,n,e,false,false,"pdf",!1),n&&(je("openDocument",se,JSON.stringify({password:he})),fe&&Be())}catch(e){throw new Error(`Error saving document for invisible signing: ${e}`)}let c;try{c=Te("prepare_sign",{signer_data_source:{...e,field_name:o,position:a,appearance:i,type:"pspdfkit/signer-data-source"},signature_metadata:{...t,type:"pspdfkit/signature-metadata"}})}catch(e){throw new Error(`Error preparing document for signing: ${e}`)}r(de,le);let u=null;return e&&e?.signatureType!==Z||(u=de.FS.readFile(c[0].result.file_contents).buffer),de.FS.unlink(c[0].result.file_contents),{file:c[0].result.file,hash:c[0].result.hash,signatureFormFieldName:c[0].result.signature_form_fqn,dataToBeSigned:c[0].result.data_to_be_signed,fileContents:u}}async getTimestampRequest(e,t){try{const[n]=Te("get_timestamp_http_request",{timestamp_authority_info:{url:t.url,authenticationInfo:{username:t.username,password:t.password}},data_to_timestamp:e});return{url:n.url,method:n.method,requestData:n.request_data,contentType:n.content_type,token:n.token,username:n.user,password:n.password}}catch(e){throw new Error(`Error getting timestamp request: ${e.message}`)}}async getRevocationRequests(e){try{return Te("get_revocation_http_requests",{signing_certificates:e})}catch(e){throw new Error(`Error getting revocations requests: ${e.message}`)}}async setSignaturesLTV(e){try{const t=Te("get_signatures",{certificate_check_time:"current_time",revocation_responses:e})[0];return je("saveDocument",se,!1,!0,!1,!1,"pdf",!1),t}catch(e){throw new Error(`Error getting signatures info: ${e.message}`)}}async sign(e,t,n,r,o,a,i,s,c){let u;try{let l;const d=F(o).buffer,p=i?"pkcs7"===i:function(e){try{const t=new Uint8Array(e);return!!t.length&&48===t[0]}catch(e){throw new Error(`Error checking if the signature is in PKCS#7 format: ${e.message}`)}}(d);p||(l=Te("create_signature",{signatureType:r,hash:n,signed_data:o,certificates:a,timestamp_response:s})),u=Te("sign",{password:he,save_path:se,file_path:e,signature_form_fqn:t,pkcs7_container:l?.[0].result||o,revocation_responses:c??[]}),je("openDocument",se,JSON.stringify({password:he})),fe&&Be()}catch(e){throw new Error(`Error signing document: ${e}`)}return u[0].result}async restoreToOriginalState(){try{je("openDocument",ce,JSON.stringify({password:he})),fe&&Be();const e="not_signed"!==Te("get_signatures",{certificate_check_time:"current_time"})[0].status;je("saveDocument",se,!1,e,!1,!1,"pdf",!1),je("openDocument",se,JSON.stringify({password:he})),fe&&Be()}catch(e){throw new Error(`Could not restore backup document: ${e}`)}}async evalFormValuesActions(e){const t=ze().reduce(((t,n)=>e.find((e=>{let{name:t}=e;return n.formField.name===t}))&&"pspdfkit/form-field/text"===n.formField.type?t.concat(n):t),[]);if(be)for(let n=0;n<t.length;n++){const r=t[n].widgets;for(let n=0;n<r.length;n++)await this.preflightWidgetAnnotation(r[n],r[n].pdfObjectId,e.find((e=>t[n].formField.name===e.name))?.value)}const n=Te("set_form_values_get_script_changes",{form_values:e});return r(1===n.length,"expected only one response for evalFormValuesActions"),this._processChanges(n[0].changes)}async readFormJSONObjects(){return ze()}async setFormJSONUpdateBatchMode(e){await Le(e)}_processChanges(e){return e.map((e=>"pspdfkit/javascript/effects/importIcon"===e.object.type?{...e,object:{...e.object,id:Object.entries(this._pdfObjectIdsForIds).find((t=>{let[,n]=t;return n===e.object.annotationID}))?.[0]}}:e))}async evalScript(e,t,n){const o=Te("run_pdf_javascript",{pdf_javascript_contents:e,pdf_javascript_trigger_event:t,pdf_javascript_form_fqn:n});return r(1===o.length,"expected only one response for evalScript"),this._processChanges(o[0].changes)}async closeDocument(){try{return ge=[],he=null,fe=!1,Je=null,Re=!1,Me=!1,je("closeDocument")}finally{this._pdfObjectIdsForIds={}}}async renderAnnotation(e,t,n,r,o,a){return Ve({...e,pdfObjectId:this._getPdfObjectIdForObject(e)},t&&await M(t),n,r,o,a)}async renderPageAnnotations(e,t,n,r,o){return t.map(((t,a)=>Ve({pdfObjectId:t,pageIndex:e},0,n[a],r[a],Ke(o,{width:n[a],height:r[a]}))))}async renderDetachedAnnotation(e,t,n,o,a){r(de,le),!be||"pspdfkit/stamp"!==e.type&&"pspdfkit/text"!==e.type||await this.preflightAnnotation(e,e.pdfObjectId);const i=t?await M(t):null,s=t?t.type:null;let c,u;const l=new de.VectorUint8;try{if(null!=i)for(let e=0;e<i.byteLength;e++)l.push_back(i[e]);if(u=De("renderDetachedAnnotation",a,JSON.stringify({...e,pdfObjectId:this._getPdfObjectIdForObject(e),pageIndex:0}),0,n,o,l,s||""),u.hasError()||1!==u.getRepliesCount()){const e=u.getErrorMessage(),t=u.getErrorReason();throw new Error(t+": "+e)}c=u.getBinaryReply(0).slice(0)}finally{l&&l.delete(),u&&u.delete()}return c}async loadCertificates(e){if(Te("load_certificates",{certificates:e}).length>0)throw new t("Internal error while loading certificates")}async getAttachment(e){let t,n,r;const o=(await this.getEmbeddedFilesList())?.map((e=>e.id)),a=o?.includes(e);try{if(a)Te("extract_embedded_file",{id:e,file_path:ue}),t=de.FS.readFile(ue).buffer;else{if(n=De("getAnnotationAttachment",e),n.hasError()||1!==n.getRepliesCount()){const e=n.getErrorMessage(),t=n.getErrorReason();throw new Error("Error fetching attachment: "+t+", "+e)}r=JSON.parse(n.getJSONReply(0)).encoding,t=n.getBinaryReply(0).slice(0)}}finally{de.FS.analyzePath(ue)?.exists&&de.FS.unlink(ue),n&&n.delete()}return[t,r]}async annotationsForPageIndex(e){const t=je("annotationsForPageIndex",e);return["rollover","down"].forEach((e=>{t.apstream_variants?.[e]?.forEach((n=>{const r=t.annotations.find((e=>e.pdfObjectId===n));r?r[e]=!0:t.annotations.push({pdfObjectId:n,[e]:!0})}))})),t.annotations}async getTabOrder(e){return Te("get_annotation_tab_order",{page:e})[0].order.map((e=>({id:Object.entries(this._pdfObjectIdsForIds).find((t=>{let[n,r]=t;return r===e}))?.[0]||String(e),pdfObjectId:e})))}async setTabOrder(e,t){Te("set_annotation_tab_order",{page:e,order:t.map((e=>this._getPdfObjectIdForObject(e)))})}async createAnnotation(e,t){r(de,le),r("number"==typeof e.pageIndex,"Annotation must have a pageIndex");const n=e.pdfObjectId,o=t?await M(t):null;let a;const i=new de.VectorUint8;try{if(null!=o)for(let e=0;e<o.byteLength;e++)i.push_back(o[e]);"pspdfkit/widget"===e.type&&(Le(!1),Ue());const t=("pspdfkit/shape/ellipse"===e.type||"pspdfkit/shape/rectangle"===e.type)&&e.measurementScale?{...e,measurementBBox:e.bbox}:e;a=je("createAnnotation",JSON.stringify({...t,pdfObjectId:null}),i)}finally{i&&i.delete()}return"number"==typeof n&&"number"==typeof this._pdfObjectIdsForIds[n.toString()]&&delete this._pdfObjectIdsForIds[n.toString()],this._pdfObjectIdsForIds[e.id||a.pdfObjectId.toString()]=a.pdfObjectId,e&&this.canPreflightAnnotation(e)&&be&&await this.preflightAnnotation(e,a.pdfObjectId),a.pdfObjectId}async updateAnnotation(e){const t={...e,pdfObjectId:this._getPdfObjectIdForObject(e)};if(r(t.id,"Annotation must have an ID"),r("number"==typeof t.pageIndex,"Annotation must have a pageIndex"),"pspdfkit/widget"===t.type){const e=ze(),n="number"==typeof t.pdfObjectId?t.pdfObjectId.toString():t.id;We(e.map((e=>e.formField.annotationIds.includes(n)||e.formField.annotationIds.includes(String(t.pdfObjectId))?{...e,widgets:e.widgets.map((e=>e.id===n||String(e.pdfObjectId)===n?t:e))}:e)))}else e&&this.canPreflightAnnotation(e)&&be&&await this.preflightAnnotation(e,t.pdfObjectId),je("updateAnnotation",JSON.stringify(t),0,0)}async updateButtonIcon(e,t,n){Te("update_annotation",{annotation:{...e,pdfObjectId:this._getPdfObjectIdForObject(e),contentType:n}},t)}async deleteAnnotation(e){if(e.APStreamCache&&await this.updateAnnotation(e),"pspdfkit/widget"===e.type)try{const t=e.id;We(ze().map((n=>{if(n.formField.annotationIds.includes(t)||n.formField.annotationIds.includes(String(e.pdfObjectId))){let r,o=n.value;if(("pspdfkit/form-field/checkbox"===n.formField.type||"pspdfkit/form-field/radio"===n.formField.type)&&n.formField.options.length===n.formField.annotationIds.length){const a=n.formField.annotationIds.includes(t)?n.formField.annotationIds.indexOf(t):n.formField.annotationIds.indexOf(String(e.pdfObjectId));r=n.formField.options.filter(((e,t)=>t!==a)),r.some((e=>e.value===o))||(o="")}const a=n.widgets.filter((e=>t!==e.id)),i=n.formField.annotationIds.filter((n=>n!==t&&n!==String(e.pdfObjectId)));return a.length>0&&i.length>0?{...n,formField:{...n.formField,annotationIds:i,...r?{options:r}:null},widgets:a,value:o}:null}return n})).filter(Boolean))}catch(e){throw e}else try{Te("remove_annotations",{annotation_ids:[this._getPdfObjectIdForObject(e)]})}catch(t){a(`Removing annotation failed for annotation: ${JSON.stringify(e)}`)}delete this._pdfObjectIdsForIds[e.id||e.pdfObjectId?.toString()],we.delete(e.pdfObjectId)}async createFormField(e,t){const n=ze().concat([{type:"pspdfkit/form-field-with-widgets",formField:e,widgets:t}]),r=Re;Re&&Le(!1),We(n);const o=ze();r&&Le(!0);const a=o.find((t=>t.formField.name===e.name));if(!a)throw new Error(`Error creating new form field in /create.pdf: created form field not found. ${JSON.stringify({type:"pspdfkit/form-field-with-widgets",formField:e,widgets:t})}`);const i=a.widgets.map((e=>(this._pdfObjectIdsForIds[e.id]=e.pdfObjectId,e.pdfObjectId)));return"number"==typeof e.pdfObjectId&&"number"==typeof this._pdfObjectIdsForIds[e.pdfObjectId.toString()]&&delete this._pdfObjectIdsForIds[e.pdfObjectId.toString()],this._pdfObjectIdsForIds[e.id||a.formField.pdfObjectId.toString()]=a.formField.pdfObjectId,i}async updateFormField(e,t){let n={...e,pdfObjectId:this._pdfObjectIdsForIds[e.id]||this._getPdfObjectIdForObject(e)};const r=ze(),o=r.find((t=>Ze(t.formField,n)||t.formField.name===e.name));if(!o)throw new Error(`Error updating form field with name "${e.name}" in /create.pdf: form field not found. ${JSON.stringify(r)}`);const a=o.formField.name!==e.name;let i=null;if(a&&"pspdfkit/form-field/radio"===n.type){const o=e.name,a=r.find((e=>e.formField.name===o));a&&"pspdfkit/form-field/radio"===a.formField.type&&(n={...n,annotationIds:[...n.annotationIds,...a.formField.annotationIds],options:[...n.options,...a.formField.options]},t=[...t,...a.widgets],i=a)}We(r.map((r=>{if(i&&i.formField.pdfObjectId===r.formField.pdfObjectId)return null;if(Ze(r.formField,n)||r.formField.name===e.name){const o={type:"pspdfkit/form-field-with-widgets",formField:{...r.formField,...n},widgets:t.reduce(((e,t)=>[...e,{...r.widgets.find((e=>e.id===t.id||e.pdfObjectId===t.pdfObjectId)),...t}]),[]),...void 0!==r.value?{value:r.value}:null};return e.flags||delete o.formField.flags,o}return r})).filter(Boolean));const s=ze().find((t=>t.formField.name===e.name));if(!s)throw new Error(`Error updating form field "${e.name}" in /create.pdf: updated form field not found. ${JSON.stringify({type:"pspdfkit/form-field-with-widgets",formField:e,widgets:t})}`);s.formField.pdfObjectId!==n.pdfObjectId&&(this._pdfObjectIdsForIds[n.id]=s.formField.pdfObjectId),o?.widgets.forEach((e=>{t.some((t=>t.id===e.id))||delete this._pdfObjectIdsForIds[e.id]}))}async deleteFormField(e){const t=ze(),n=t.find((t=>t.formField.name===e.name));if(!n)return;We(t.filter((t=>t.formField.name!==e.name)));const r=ze().find((t=>t.formField.name===e.name));if(r)throw new Error(`Error deleting form field with name "${e.name}" in /create.pdf: form field still present. ${JSON.stringify(r)}`);n.widgets.forEach((e=>{delete this._pdfObjectIdsForIds[e.id]}))}async deleteFormFieldValue(e){We(ze().map((t=>t.formField.name===e?{formField:t.formField,widgets:t.widgets,type:t.type}:t)))}canPreflightAnnotation(e){return"pspdfkit/text"===e.type||"pspdfkit/stamp"===e.type}async preflightAnnotation(e,t){if(!this.canPreflightAnnotation(e))return;const n="pspdfkit/stamp"===e.type?e.title:e.text?.value;"number"!=typeof t||n?n&&await this.preflightRenderAnnotationText(n,t,e.pageIndex,{...e,pdfObjectId:this._getPdfObjectIdForObject(e),pageIndex:0}):we.delete(t)}async preflightWidgetAnnotation(e,t,n){n||"number"!=typeof t?n&&await this.preflightRenderAnnotationText(n,t,e.pageIndex):we.delete(t)}async createBookmark(e){try{Te("append_bookmarks",{bookmarks:[e]})}catch(e){throw new Error(`Error creating new bookmark in /create.pdf: ${e.message}`)}}async updateBookmark(e){try{Te("remove_bookmarks",{bookmarkIds:[e.id??e.pdfBookmarkId]}),Te("append_bookmarks",{bookmarks:[e]})}catch(e){throw new Error(`Error updating bookmark in /create.pdf: ${e.message}`)}}async deleteBookmark(e){try{Te("remove_bookmarks",{bookmarkIds:[e]})}catch(e){throw new Error(`Error deleting bookmark in /create.pdf: ${e.message}`)}}async getTextFromRects(e,t){return je("getTextFromRects",e,JSON.stringify(t.map((e=>[e.left,e.top,e.width,e.height])))).text}async search(e,t,n,r){return Te("search",{query:e,start_index:t,limit:n,case_sensitive:r,search_type:arguments.length>4&&void 0!==arguments[4]?arguments[4]:J})}async parseXFDF(e,t){try{return function(e){try{const t=(new TextDecoder).decode(e);return JSON.parse(t)}catch(e){throw e}}(Te("convert_xfdf_to_instant_json",{ignore_page_rotation:t},e)[0])}catch(e){throw e}}async getEmbeddedFilesList(){return Te("list_embedded_files")[0].embeddedFiles||null}async getMeasurementSnappingPoints(e){const t=Te("get_snapping_points",{page:e});return t[0].snappingPoints?function(e){const t=[...e.endpoints,...e.intersections,...e.midpoints],n=[];for(let e=0;e<t.length;e+=2){const r=[t[e],t[e+1]];n.push(r)}return n.sort(((e,t)=>e[0]==t[0]?e[1]-t[1]:e[0]-t[0]))}(t[0].snappingPoints):null}async getSecondaryMeasurementUnit(){try{return Te("get_secondary_measurement_unit")[0]||null}catch(e){throw new Error(`Error getting secondary measurement: ${e.message}`)}}async compareDocuments(e){try{r(e.originalDocument.arrayBuffer,"Original document arrayBuffer is missing"),r(e.changedDocument.arrayBuffer,"Changed document arrayBuffer is missing"),de.FS.writeFile("documentA.pdf",new Uint8Array(e.originalDocument.arrayBuffer)),de.FS.writeFile("documentB.pdf",new Uint8Array(e.changedDocument.arrayBuffer));const t={originalDocument:{...e.originalDocument,filePath:"documentA.pdf"},changedDocument:{...e.changedDocument,filePath:"documentB.pdf"},comparisons:[e.comparisonOperation]};return Te("document_comparison",t)||null}catch(e){throw new Error(`Error comparing documents: ${e.message}`)}}async setSecondaryMeasurementUnit(e){try{Te("set_secondary_measurement_unit",e?{unitTo:e?.unitTo,precision:e?.precision}:null)}catch(e){a("Error setting secondary measurement unit")}}async getMeasurementScales(){try{return Te("get_measurement_content_formats")[0]||null}catch(e){throw new Error(`Error getting measurement scales: ${e.message}`)}}async removeMeasurementScale(e){try{Te("remove_measurement_content_format",{measurementContentFormat:S(e)})}catch(t){throw new Error(`Error removing ${e.name} measurement scale: ${t.message}`)}}async addMeasurementScale(e){try{Te("add_measurement_content_format",{measurementContentFormat:S(e)})}catch(t){throw new Error(`Error adding ${e.name} measurement scale: ${t.message}`)}}async getAnnotationsByScale(e){try{return Te("get_annotations_for_measurement_content_format",{measurementContentFormat:S(e)})||null}catch(e){throw e}}async exportFile(e,t,n,o,a,i,s,c){let u,l={mimeType:"application/pdf",extension:"pdf"};try{const r=!1;u=Te("save_document",{file_path:se,format:o,flatten_annotations:e,save_incrementally:t,apply_redactions:r,save_for_printing:n,remove_all_annotations:a,preserve_change_tracker_state:i,...s?{user_password:s.userPassword,owner_password:s.ownerPassword,document_permissions:Ge(s.documentPermissions)}:null}),c&&(c.forEach((e=>{let{pageIndex:t,id:n,pdfObjectId:r}=e;Te("electronic_signatures/flatten",{page:t,annotation_id:this._getPdfObjectIdForObject({id:n,pdfObjectId:r})})})),u=Te("save_document",{file_path:ce,format:o,flatten_annotations:e,save_incrementally:t,apply_redactions:r,save_for_printing:n,remove_all_annotations:a,preserve_change_tracker_state:i,...s?{user_password:s.userPassword,owner_password:s.ownerPassword,document_permissions:Ge(s.documentPermissions)}:null}))}catch(e){throw new Error(`Error saving to /save.pdf: ${e.message}`)}const d=u[0];d.format&&(l={mimeType:d.format.mime_type,extension:d.format.extension}),r(de,le);const p=de.FS.readFile(c?ce:se).buffer;return c&&(je("closeDocument"),je("openDocument",se,JSON.stringify({password:he}))),[p,l]}async importXFDF(e,t,n){ge.push({source:e,keepCurrentAnnotations:t}),t||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.push("pspdfkit/widget"),je("removeAllAnnotations",JSON.stringify(e),JSON.stringify(t))}(),je("importXFDF",e,n)}async exportXFDF(e){return je("exportXFDF",[],[],e).XFDF}async importInstantJSON(e){je("importInstantDocumentJSON",JSON.stringify(e))}async exportInstantJSON(e){const t=Re;Re&&Le(!1);const n=je("exportInstantDocumentJSON","number"==typeof e?e:-1);return t&&Le(!0),JSON.parse(n.InstantDocumentJSON)}async getDocumentOutline(){const e=Te("get_outline");return r(1===e.length,"expected only one response for getDocumentOutline"),e[0].outline||[]}async setDocumentOutline(e){return Te("set_outline",{outline:e})}async getPageGlyphs(e){return Te("get_glyphs",{page:e})[0].glyphs||[]}async onKeystrokeEvent(e){const t=Te("on_keystroke_event",{pdf_javascript_event:e});r(1===t.length,"expected only one response for onKeystrokeEvent");const n=t[0].changes||[];return r(n.length>0&&4===n[0].change_type,"expected onKeystrokeEvent to return at least one JavaScript Event change."),n}async version(){return je("PSPDFKitVersion").version}getImportedXFDF(){return ge}async applyRedactions(){try{je("saveDocument",se,!1,!1,!0,!1,"pdf",!1)}catch(e){throw new Error(`Error applying redactions and saving to /create.pdf: ${e.message}`)}}async clearAPStreamCache(){je("clearAPStreamCache")}async setComparisonDocument(e,t){this.comparisonDocuments[e]=t||(await this.exportFile(!1,!1,!1,"pdf",!1,!1))[0]}async openComparisonDocument(e){return r(this.comparisonDocuments[e]),e===this.lastOpenedComparisonDocument||e===R&&null===this.lastOpenedComparisonDocument&&this.persistedOpenDocument instanceof ArrayBuffer?null:(this.lastOpenedComparisonDocument=e,this.openDocument(this.comparisonDocuments[e],this.persistedOpenDocument===e?this.persistedOpenDocumentPassword:void 0))}async documentCompareAndOpen(e){r(this.comparisonDocuments[R]&&this.comparisonDocuments[U],"One or both comparison input documents are missing.");const t=`${R}.pdf`,n=`${U}.pdf`;de.FS.writeFile(t,new Uint8Array(this.comparisonDocuments[R])),de.FS.writeFile(n,new Uint8Array(this.comparisonDocuments[U]));return Te("comparison",{documentA:{strokeColor:e.documentA.strokeColor,pageIndex:e.documentA.pageIndex,filePath:t},documentB:{strokeColor:e.documentB.strokeColor,pageIndex:e.documentB.pageIndex,filePath:n},options:{...e.options,outputFilePath:"output.pdf"}}),await this.closeDocument(),this.comparisonDocuments[L]=de.FS.readFile("output.pdf").buffer,this.lastOpenedComparisonDocument=L,this.openDocument(this.comparisonDocuments[L],void 0)}async persistOpenDocument(e){if(e)this.persistedOpenDocument=e;else try{this.persistedOpenDocument=(await this.exportFile(!1,!1,!1,"pdf",!1,!0))[0]}catch(e){throw new Error(`Error trying to persist a copy of the currently opened document: ${e.message}`)}this.persistedOpenDocumentPassword=he}async cleanupDocumentComparison(){r(this.persistedOpenDocument,"No persisted previous document key or array buffer is available.");const e=this.persistedOpenDocument instanceof ArrayBuffer?this.persistedOpenDocument:this.comparisonDocuments[this.persistedOpenDocument];r(e,"No persisted previous array buffer is available.");try{await this.closeDocument()}catch(e){throw new Error(`Error trying to close the current document: ${e.message}`)}const t=this.openDocument(e,this.persistedOpenDocumentPassword);return this.persistedOpenDocument=null,this.persistedOpenDocumentPassword=null,this.lastOpenedComparisonDocument=null,this.comparisonDocuments={},t}_getPdfObjectIdForObject(e){return"number"==typeof e.pdfObjectId?e.pdfObjectId:this._pdfObjectIdsForIds[e.id]}async getOCGs(){return Te("ocg/get_ocgs")[0].ocgs}async getOCGVisibilityState(){return{visibleLayerIds:Te("ocg/get_visibility_state")[0].state.visible}}async setOCGVisibilityState(e){return Te("ocg/set_visibility_state",{state:{visible:e.visibleLayerIds}})}async dispatchCommand(e){let t,n=null;Fe&&(t=performance.now());try{if(n=await de.dispatchCommand(e),null===n)throw Error("dispatchCommand returned null");if(n.hasError())return{success:!1,message:n.getErrorMessage(),code:n.getErrorReason()};const r={success:!0,values:[]};for(let e=0;e<n.getRepliesCount();e++)n.hasJSONReply(e)&&r.values.push(JSON.parse(n.getJSONReply(e))),n.hasBinaryReply(e)&&r.values.push(n.getBinaryReply(e).slice(0));if(Fe){const n=JSON.parse(e);xe.push({type:Se.Daemon,name:n.type,args:n,time:performance.now()-t})}return r}finally{n&&n.delete()}}async getCoreCallRecording(){return xe}async enableCoreCallRecording(e){Fe=e}recycle(){}destroy(){}},Ye=self;Ye.global=Ye,Ye.module={},Ye.onmessage=async e=>{let t,n,{data:r}=e;try{const e=await He[r.action](...r.args);if(t={id:r.id,result:e},Array.isArray(e)){const t=e.filter((e=>e instanceof ArrayBuffer));t.length>0&&(n=t)}e instanceof ArrayBuffer&&(n=[e])}catch(e){const o=[...r.args].filter((e=>e instanceof ArrayBuffer));o.length>0&&(n=o),t={id:r.id,error:e.message||e.toString(),callArgs:r.args}}Ye.postMessage(t,n)}})()})();',"Worker",void 0,void 0)}},20477:e=>{e.exports=function(e,t,n,r){var o=self||window;try{try{var a;try{a=new o.Blob([e])}catch(t){(a=new(o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder)).append(e),a=a.getBlob()}var i=o.URL||o.webkitURL,s=i.createObjectURL(a),c=new o[t](s,n);return i.revokeObjectURL(s),c}catch(r){return new o[t]("data:application/javascript,".concat(encodeURIComponent(e)),n)}}catch(e){if(!r)throw Error("Inline worker is not supported");return new o[t](r,n)}}}}]);