@nutrient-sdk/viewer 1.8.0-nightly.20250925 → 1.8.0-nightly.20250927
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -9
- package/dist/nutrient-viewer-lib/{chunk-848-42203e4f44c4d411.js → chunk-848-21cc4b359bbd885b.js} +1 -1
- package/dist/nutrient-viewer-lib/chunk-core-worker-63566e377e04fe83.js +13 -0
- package/dist/nutrient-viewer-lib/{chunk-gdpicture-72db4e087cdca172.js → chunk-gdpicture-706c1a3cc112a331.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-gdpicture-worker-f114fb04aa7c458e.js → chunk-gdpicture-worker-5d313e31bddaa12f.js} +2 -2
- package/dist/nutrient-viewer-lib/{chunk-lazy-sha-caee817b45ecf248.js → chunk-lazy-sha-ea98428957b7bc42.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-ar-415b45fb34b2a70b.js → chunk-locale-ar-af42fcec4d9ddb74.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-cs-8c15e28d05a1a3f3.js → chunk-locale-cs-bbe894b94edf53b6.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-cy-d494539becb113c6.js → chunk-locale-cy-038e0cbcf4ba1ea1.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-da-f7555b29bc061be8.js → chunk-locale-da-667476dee083dbbb.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-de-9a89cbb0b0804d3c.js → chunk-locale-de-3d158da6953ce84f.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-el-8a64d4043249b06e.js → chunk-locale-el-cc9c83448f39fd8d.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-en-GB-645171828e506263.js → chunk-locale-en-GB-1f291ca9fc995e10.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-es-4a4146f963d52b90.js → chunk-locale-es-9ee54a38cfab5ea7.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-fi-6660da60ff53fb48.js → chunk-locale-fi-7dcf036b93569c6d.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-fr-65b6418ae1a8c3ac.js → chunk-locale-fr-316b588864e00570.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-fr-CA-2e1b48520191f236.js → chunk-locale-fr-CA-4bd6cae5adfb7ea2.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-he-c329ec832787b524.js → chunk-locale-he-d7f8bc6d3d145d49.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-hr-86a7ff0b20a07004.js → chunk-locale-hr-546ad77e45eff2b7.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-id-e41afe0e60a94c65.js → chunk-locale-id-4453053f4a6afef2.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-it-5d686919c7d0f48c.js → chunk-locale-it-6bbbb005d47bf928.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-ja-d914bd6ef3387d78.js → chunk-locale-ja-1463e12667aebbdd.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-ko-9a6e3e5750f15e40.js → chunk-locale-ko-c2d48611b2adf2d5.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-ms-8882b5aa4cda74bd.js → chunk-locale-ms-720ba2afeb411404.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-nb-NO-1848a109150d597d.js → chunk-locale-nb-NO-f20fa1ac071df0fd.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-nl-2419908b0b22524c.js → chunk-locale-nl-5600509a4f14f654.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-pl-93c8a34e4fac7734.js → chunk-locale-pl-5ae1010166ff0031.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-pt-8e4941af7e97c757.js → chunk-locale-pt-6a2168aeda797f35.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-pt-PT-05c2711a9d6a28a6.js → chunk-locale-pt-PT-34e8b3fde9abd1db.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-ru-09a6b8db8556f8dd.js → chunk-locale-ru-76a37f4f095e1ae4.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-sk-da33b7d5ceba33e9.js → chunk-locale-sk-279344214dd55a09.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-sl-d2be309aa9a6df6b.js → chunk-locale-sl-1224ae2a9c2922c9.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-sv-eb043961828382cf.js → chunk-locale-sv-e192b66d8fe245da.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-th-e692aabf907d663d.js → chunk-locale-th-ecff4e70e24da4bd.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-tr-6300855b5b565ff4.js → chunk-locale-tr-9c3846c3c8fb890a.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-uk-152caba03e035e39.js → chunk-locale-uk-29c3a1b74ae80c8b.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-zh-Hans-d3c2cf31b50143b9.js → chunk-locale-zh-Hans-49656b87025245d8.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-locale-zh-Hant-5dc579633f3a4849.js → chunk-locale-zh-Hant-22a7f394ccba01ea.js} +1 -1
- package/dist/nutrient-viewer-lib/chunk-offscreen-renderer-worker-7b1779406ecd3d94.js +13 -0
- package/dist/nutrient-viewer-lib/{chunk-server-cac9d3ecd2c30e91.js → chunk-server-3fed53d0b55dbd74.js} +2 -2
- package/dist/nutrient-viewer-lib/{chunk-server-instant-203837e27462beea.js → chunk-server-instant-7f663196ff035564.js} +1 -1
- package/dist/nutrient-viewer-lib/{chunk-server-rest-8b5f8563762fa7cc.js → chunk-server-rest-8ca25e3336a6fd8c.js} +1 -1
- package/dist/nutrient-viewer-lib/chunk-standalone-d6b12d5de59999e3.js +13 -0
- package/dist/nutrient-viewer-lib/chunk-standalone-server-6a91ed83785af925.js +13 -0
- package/dist/nutrient-viewer-lib/core-worker.js +2 -2
- package/dist/nutrient-viewer-lib/dark-402cc98d3d69bff8.css +1 -1
- package/dist/nutrient-viewer-lib/gdpicture-worker.js +1 -1
- package/dist/nutrient-viewer-lib/{nutrient-viewer-1.8.0-a34512c.css → nutrient-viewer-1.8.0-f27b1f2.css} +1 -1
- package/dist/nutrient-viewer-lib/{nutrient-viewer-60b4b73186098a71.wasm → nutrient-viewer-89a95646cc8ccf12.wasm} +0 -0
- package/dist/nutrient-viewer-lib/{nutrient-viewer-471ea934f3321467.wasm.js → nutrient-viewer-cd5a9e0213658be5.wasm.js} +2 -2
- package/dist/nutrient-viewer-lib/offscreen-render-worker.js +2 -2
- package/dist/nutrient-viewer.js +2 -2
- package/package.json +1 -1
- package/dist/nutrient-viewer-lib/chunk-core-worker-649c223d0131f741.js +0 -13
- package/dist/nutrient-viewer-lib/chunk-offscreen-renderer-worker-f0d6c8e332f0bb1b.js +0 -13
- package/dist/nutrient-viewer-lib/chunk-standalone-105cee3f55149764.js +0 -13
- package/dist/nutrient-viewer-lib/chunk-standalone-server-e0ec887fc9f55365.js +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nutrient-sdk/viewer",
|
|
3
|
-
"version": "1.8.0-nightly.
|
|
3
|
+
"version": "1.8.0-nightly.20250927",
|
|
4
4
|
"description": "View and annotate PDF files in your web app. Full support for mobile and desktop. Runs in the browser using WASM.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pdf",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Nutrient Web SDK 1.8.0-a34512c (https://www.nutrient.io/sdk/web)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2016-2025 PSPDFKit GmbH. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
7
|
-
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
|
|
8
|
-
* UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
|
|
9
|
-
* This notice may not be removed from this file.
|
|
10
|
-
*
|
|
11
|
-
* PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/
|
|
12
|
-
*/
|
|
13
|
-
"use strict";(globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[]).push([[329],{11005:(e,t,n)=>{n.d(t,{default:()=>i});var r=n(55512),o=n.n(r);function i(){return o()('/*!\n * Nutrient Web SDK 1.8.0-a34512c (https://www.nutrient.io/sdk/web)\n *\n * Copyright (c) 2016-2025 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://www.nutrient.io/legal/acknowledgements/web-acknowledgements/\n */(()=>{var e={4601:(e,t,n)=>{"use strict";var r=n(8420),o=n(3838),i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not a function")}},3938:(e,t,n)=>{"use strict";var r=n(5335),o=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not an object")}},8186:(e,t,n)=>{"use strict";var r=n(5476),o=n(6539),i=n(3493),a=function(e){return function(t,n,a){var s=r(t),c=i(s);if(0===c)return!e&&-1;var u,l=o(a,c);if(e&&n!=n){for(;c>l;)if((u=s[l++])!=u)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},9609:(e,t,n)=>{"use strict";var r=n(281);e.exports=r([].slice)},8569:(e,t,n)=>{"use strict";var r=n(281),o=r({}.toString),i=r("".slice);e.exports=function(e){return i(o(e),8,-1)}},4361:(e,t,n)=>{"use strict";var r=n(6490),o=n(5816),i=n(7632),a=n(3610);e.exports=function(e,t,n){for(var s=o(t),c=a.f,u=i.f,l=0;l<s.length;l++){var d=s[l];r(e,d)||n&&r(n,d)||c(e,d,u(t,d))}}},7712:(e,t,n)=>{"use strict";var r=n(5077),o=n(3610),i=n(6843);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},6843:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},7485:(e,t,n)=>{"use strict";var r=n(8420),o=n(3610),i=n(8218),a=n(9430);e.exports=function(e,t,n,s){s||(s={});var c=s.enumerable,u=void 0!==s.name?s.name:t;if(r(n)&&i(n,u,s),s.global)c?e[t]=n:a(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}},9430:(e,t,n)=>{"use strict";var r=n(1301),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}},5077:(e,t,n)=>{"use strict";var r=n(2074);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},3262:(e,t,n)=>{"use strict";var r=n(1301),o=n(5335),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},290:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},4003:(e,t,n)=>{"use strict";var r=n(8340);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},620:(e,t,n)=>{"use strict";var r=n(7006);e.exports="NODE"===r},8340:(e,t,n)=>{"use strict";var r=n(1301).navigator,o=r&&r.userAgent;e.exports=o?String(o):""},1928:(e,t,n)=>{"use strict";var r,o,i=n(1301),a=n(8340),s=i.process,c=i.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&&a&&(!(r=a.match(/Edge\\/(\\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\\/(\\d+)/))&&(o=+r[1]),e.exports=o},7006:(e,t,n)=>{"use strict";var r=n(1301),o=n(8340),i=n(8569),a=function(e){return o.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===i(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},1605:(e,t,n)=>{"use strict";var r=n(1301),o=n(7632).f,i=n(7712),a=n(7485),s=n(9430),c=n(4361),u=n(4977);e.exports=function(e,t){var n,l,d,f,p,m=e.target,g=e.global,h=e.stat;if(n=g?r:h?r[m]||s(m,{}):r[m]&&r[m].prototype)for(l in t){if(f=t[l],d=e.dontCallGetSet?(p=o(n,l))&&p.value:n[l],!u(g?l:m+(h?".":"#")+l,e.forced)&&void 0!==d){if(typeof f==typeof d)continue;c(f,d)}(e.sham||d&&d.sham)&&i(f,"sham",!0),a(n,l,f,e)}}},2074:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9070:(e,t,n)=>{"use strict";var r=n(8823),o=Function.prototype,i=o.apply,a=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(i):function(){return a.apply(i,arguments)})},6885:(e,t,n)=>{"use strict";var r=n(3091),o=n(4601),i=n(8823),a=r(r.bind);e.exports=function(e,t){return o(e),void 0===t?e:i?a(e,t):function(){return e.apply(t,arguments)}}},8823:(e,t,n)=>{"use strict";var r=n(2074);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},2368:(e,t,n)=>{"use strict";var r=n(8823),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},2071:(e,t,n)=>{"use strict";var r=n(5077),o=n(6490),i=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=o(i,"name"),c=s&&"something"===function(){}.name,u=s&&(!r||r&&a(i,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},3091:(e,t,n)=>{"use strict";var r=n(8569),o=n(281);e.exports=function(e){if("Function"===r(e))return o(e)}},281:(e,t,n)=>{"use strict";var r=n(8823),o=Function.prototype,i=o.call,a=r&&o.bind.bind(i,i);e.exports=r?a:function(e){return function(){return i.apply(e,arguments)}}},6492:(e,t,n)=>{"use strict";var r=n(1301),o=n(8420);e.exports=function(e,t){return arguments.length<2?(n=r[e],o(n)?n:void 0):r[e]&&r[e][t];var n}},6457:(e,t,n)=>{"use strict";var r=n(4601),o=n(8406);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},1301:function(e,t,n){"use strict";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)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},6490:(e,t,n)=>{"use strict";var r=n(281),o=n(2612),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(o(e),t)}},7708:e=>{"use strict";e.exports={}},8890:(e,t,n)=>{"use strict";var r=n(6492);e.exports=r("document","documentElement")},7694:(e,t,n)=>{"use strict";var r=n(5077),o=n(2074),i=n(3262);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8664:(e,t,n)=>{"use strict";var r=n(281),o=n(2074),i=n(8569),a=Object,s=r("".split);e.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===i(e)?s(e,""):a(e)}:a},9965:(e,t,n)=>{"use strict";var r=n(281),o=n(8420),i=n(9310),a=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(e){return a(e)}),e.exports=i.inspectSource},9206:(e,t,n)=>{"use strict";var r,o,i,a=n(8369),s=n(1301),c=n(5335),u=n(7712),l=n(6490),d=n(9310),f=n(5904),p=n(7708),m="Object already initialized",g=s.TypeError,h=s.WeakMap;if(a||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 new g(m);return t.facade=e,y.set(e,t),t},o=function(e){return y.get(e)||{}},i=function(e){return y.has(e)}}else{var b=f("state");p[b]=!0,r=function(e,t){if(l(e,b))throw new g(m);return t.facade=e,u(e,b,t),t},o=function(e){return l(e,b)?e[b]:{}},i=function(e){return l(e,b)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(t)).type!==e)throw new g("Incompatible receiver, "+e+" required");return n}}}},8420:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},4977:(e,t,n)=>{"use strict";var r=n(2074),o=n(8420),i=/#|\\.prototype\\./,a=function(e,t){var n=c[s(e)];return n===l||n!==u&&(o(t)?r(t):!!t)},s=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},c=a.data={},u=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},8406:e=>{"use strict";e.exports=function(e){return null==e}},5335:(e,t,n)=>{"use strict";var r=n(8420);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},6926:e=>{"use strict";e.exports=!1},2328:(e,t,n)=>{"use strict";var r=n(6492),o=n(8420),i=n(7658),a=n(5225),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&i(t.prototype,s(e))}},3493:(e,t,n)=>{"use strict";var r=n(3747);e.exports=function(e){return r(e.length)}},8218:(e,t,n)=>{"use strict";var r=n(281),o=n(2074),i=n(8420),a=n(6490),s=n(5077),c=n(2071).CONFIGURABLE,u=n(9965),l=n(9206),d=l.enforce,f=l.get,p=String,m=Object.defineProperty,g=r("".slice),h=r("".replace),y=r([].join),b=s&&!o((function(){return 8!==m((function(){}),"length",{value:8}).length})),w=String(String).split("String"),v=e.exports=function(e,t,n){"Symbol("===g(p(t),0,7)&&(t="["+h(p(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||c&&e.name!==t)&&(s?m(e,"name",{value:t,configurable:!0}):e.name=t),b&&n&&a(n,"arity")&&e.length!==n.arity&&m(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&m(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return a(r,"source")||(r.source=y(w,"string"==typeof t?t:"")),e};Function.prototype.toString=v((function(){return i(this)&&f(this).source||u(this)}),"toString")},9830:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},3610:(e,t,n)=>{"use strict";var r=n(5077),o=n(7694),i=n(4491),a=n(3938),s=n(6032),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d="enumerable",f="configurable",p="writable";t.f=r?i?function(e,t,n){if(a(e),t=s(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&p in n&&!n[p]){var r=l(e,t);r&&r[p]&&(e[t]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:d in n?n[d]:r[d],writable:!1})}return u(e,t,n)}:u:function(e,t,n){if(a(e),t=s(t),a(n),o)try{return u(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7632:(e,t,n)=>{"use strict";var r=n(5077),o=n(2368),i=n(9304),a=n(6843),s=n(5476),c=n(6032),u=n(6490),l=n(7694),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 a(!o(i.f,e,t),e[t])}},4789:(e,t,n)=>{"use strict";var r=n(6347),o=n(290).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},8916:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},7658:(e,t,n)=>{"use strict";var r=n(281);e.exports=r({}.isPrototypeOf)},6347:(e,t,n)=>{"use strict";var r=n(281),o=n(6490),i=n(5476),a=n(8186).indexOf,s=n(7708),c=r([].push);e.exports=function(e,t){var n,r=i(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++])&&(~a(l,n)||c(l,n));return l}},9304:(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},9751:(e,t,n)=>{"use strict";var r=n(2368),o=n(8420),i=n(5335),a=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&o(n=e.toString)&&!i(s=r(n,e)))return s;if(o(n=e.valueOf)&&!i(s=r(n,e)))return s;if("string"!==t&&o(n=e.toString)&&!i(s=r(n,e)))return s;throw new a("Can\'t convert object to primitive value")}},5816:(e,t,n)=>{"use strict";var r=n(6492),o=n(281),i=n(4789),a=n(8916),s=n(3938),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(s(e)),n=a.f;return n?c(t,n(e)):t}},1229:(e,t,n)=>{"use strict";var r=n(8406),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can\'t call method on "+e);return e}},8827:(e,t,n)=>{"use strict";var r,o=n(1301),i=n(9070),a=n(8420),s=n(7006),c=n(8340),u=n(9609),l=n(6589),d=o.Function,f=/MSIE .\\./.test(c)||"BUN"===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 f?function(r,o){var s=l(arguments.length,1)>n,c=a(r)?r:d(r),f=s?u(arguments,n):[],p=s?function(){i(c,this,f)}:c;return t?e(p,o):e(p)}:e}},5904:(e,t,n)=>{"use strict";var r=n(2),o=n(665),i=r("keys");e.exports=function(e){return i[e]||(i[e]=o(e))}},9310:(e,t,n)=>{"use strict";var r=n(6926),o=n(1301),i=n(9430),a="__core-js_shared__",s=e.exports=o[a]||i(a,{});(s.versions||(s.versions=[])).push({version:"3.42.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})},2:(e,t,n)=>{"use strict";var r=n(9310);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},2072:(e,t,n)=>{"use strict";var r=n(1928),o=n(2074),i=n(1301).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!i(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},4922:(e,t,n)=>{"use strict";var r,o,i,a,s=n(1301),c=n(9070),u=n(6885),l=n(8420),d=n(6490),f=n(2074),p=n(8890),m=n(9609),g=n(3262),h=n(6589),y=n(4003),b=n(620),w=s.setImmediate,v=s.clearImmediate,_=s.process,O=s.Dispatch,S=s.Function,x=s.MessageChannel,F=s.String,E=0,I={},A="onreadystatechange";f((function(){r=s.location}));var j=function(e){if(d(I,e)){var t=I[e];delete I[e],t()}},D=function(e){return function(){j(e)}},P=function(e){j(e.data)},k=function(e){s.postMessage(F(e),r.protocol+"//"+r.host)};w&&v||(w=function(e){h(arguments.length,1);var t=l(e)?e:S(e),n=m(arguments,1);return I[++E]=function(){c(t,void 0,n)},o(E),E},v=function(e){delete I[e]},b?o=function(e){_.nextTick(D(e))}:O&&O.now?o=function(e){O.now(D(e))}:x&&!y?(a=(i=new x).port2,i.port1.onmessage=P,o=u(a.postMessage,a)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&r&&"file:"!==r.protocol&&!f(k)?(o=k,s.addEventListener("message",P,!1)):o=A in g("script")?function(e){p.appendChild(g("script"))[A]=function(){p.removeChild(this),j(e)}}:function(e){setTimeout(D(e),0)}),e.exports={set:w,clear:v}},6539:(e,t,n)=>{"use strict";var r=n(9328),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},5476:(e,t,n)=>{"use strict";var r=n(8664),o=n(1229);e.exports=function(e){return r(o(e))}},9328:(e,t,n)=>{"use strict";var r=n(9830);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},3747:(e,t,n)=>{"use strict";var r=n(9328),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},2612:(e,t,n)=>{"use strict";var r=n(1229),o=Object;e.exports=function(e){return o(r(e))}},874:(e,t,n)=>{"use strict";var r=n(2368),o=n(5335),i=n(2328),a=n(6457),s=n(9751),c=n(1602),u=TypeError,l=c("toPrimitive");e.exports=function(e,t){if(!o(e)||i(e))return e;var n,c=a(e,l);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||i(n))return n;throw new u("Can\'t convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6032:(e,t,n)=>{"use strict";var r=n(874),o=n(2328);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},3838:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},665:(e,t,n)=>{"use strict";var r=n(281),o=0,i=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+i,36)}},5225:(e,t,n)=>{"use strict";var r=n(2072);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},4491:(e,t,n)=>{"use strict";var r=n(5077),o=n(2074);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},6589:e=>{"use strict";var t=TypeError;e.exports=function(e,n){if(e<n)throw new t("Not enough arguments");return e}},8369:(e,t,n)=>{"use strict";var r=n(1301),o=n(8420),i=r.WeakMap;e.exports=o(i)&&/native code/.test(String(i))},1602:(e,t,n)=>{"use strict";var r=n(1301),o=n(2),i=n(6490),a=n(665),s=n(2072),c=n(5225),u=r.Symbol,l=o("wks"),d=c?u.for||u:u&&u.withoutSetter||a;e.exports=function(e){return i(l,e)||(l[e]=s&&i(u,e)?u[e]:d("Symbol."+e)),l[e]}},1857:(e,t,n)=>{"use strict";var r=n(1605),o=n(1301),i=n(4922).clear;r({global:!0,bind:!0,enumerable:!0,forced:o.clearImmediate!==i},{clearImmediate:i})},5417:(e,t,n)=>{"use strict";n(1857),n(9708)},9708:(e,t,n)=>{"use strict";var r=n(1605),o=n(1301),i=n(4922).set,a=n(8827),s=o.setImmediate?a(i,!1):i;r({global:!0,bind:!0,enumerable:!0,forced:o.setImmediate!==s},{setImmediate:s})},5480:()=>{},5920:e=>{e.exports="60b4b73186098a71"},1211:e=>{e.exports="471ea934f3321467"}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.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(5417);"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://www.nutrient.io/support/request`)}function o(e){console.log(e)}function i(){console.warn(...arguments)}function a(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)||!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: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=Symbol("Comlink.proxy"),d=Symbol("Comlink.endpoint"),f=Symbol("Comlink.releaseProxy"),p=Symbol("Comlink.finalizer"),m=Symbol("Comlink.thrown"),g=e=>"object"==typeof e&&null!==e||"function"==typeof e,h={canHandle:e=>g(e)&&e[l],serialize(e){const{port1:t,port2:n}=new MessageChannel;return b(e,t),[n,[n]]},deserialize:e=>(e.start(),function(e,t){const n=new Map;return e.addEventListener("message",(function(e){const{data:t}=e;if(!t||!t.id)return;const r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}})),x(e,n,[],t)}(e))},y=new Map([["proxy",h],["throw",{canHandle:e=>g(e)&&m in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function b(e,t=globalThis,n=["*"]){t.addEventListener("message",(function r(o){if(!o||!o.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,o.origin))return void console.warn(`Invalid origin \'${o.origin}\' for comlink proxy`);const{id:i,type:a,path:s}=Object.assign({path:[]},o.data),c=(o.data.argumentList||[]).map(A);let u;try{const t=s.slice(0,-1).reduce(((e,t)=>e[t]),e),n=s.reduce(((e,t)=>e[t]),e);switch(a){case"GET":u=n;break;case"SET":t[s.slice(-1)[0]]=A(o.data.value),u=!0;break;case"APPLY":u=n.apply(t,c);break;case"CONSTRUCT":u=function(e){return Object.assign(e,{[l]:!0})}(new n(...c));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;b(e,n),u=function(e,t){return E.set(e,t),e}(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[m]:0}}Promise.resolve(u).catch((e=>({value:e,[m]:0}))).then((n=>{const[o,s]=I(n);t.postMessage(Object.assign(Object.assign({},o),{id:i}),s),"RELEASE"===a&&(t.removeEventListener("message",r),w(t),p in e&&"function"==typeof e[p]&&e[p]())})).catch((e=>{const[n,r]=I({value:new TypeError("Unserializable return value"),[m]:0});t.postMessage(Object.assign(Object.assign({},n),{id:i}),r)}))})),t.start&&t.start()}function w(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function v(e){if(e)throw new Error("Proxy has been released and is not useable")}function _(e){return j(e,new Map,{type:"RELEASE"}).then((()=>{w(e)}))}const O=new WeakMap,S="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(O.get(e)||0)-1;O.set(e,t),0===t&&_(e)}));function x(e,t,n=[],r=function(){}){let o=!1;const i=new Proxy(r,{get(r,a){if(v(o),a===f)return()=>{!function(e){S&&S.unregister(e)}(i),_(e),t.clear(),o=!0};if("then"===a){if(0===n.length)return{then:()=>i};const r=j(e,t,{type:"GET",path:n.map((e=>e.toString()))}).then(A);return r.then.bind(r)}return x(e,t,[...n,a])},set(r,i,a){v(o);const[s,c]=I(a);return j(e,t,{type:"SET",path:[...n,i].map((e=>e.toString())),value:s},c).then(A)},apply(r,i,a){v(o);const s=n[n.length-1];if(s===d)return j(e,t,{type:"ENDPOINT"}).then(A);if("bind"===s)return x(e,t,n.slice(0,-1));const[c,u]=F(a);return j(e,t,{type:"APPLY",path:n.map((e=>e.toString())),argumentList:c},u).then(A)},construct(r,i){v(o);const[a,s]=F(i);return j(e,t,{type:"CONSTRUCT",path:n.map((e=>e.toString())),argumentList:a},s).then(A)}});return function(e,t){const n=(O.get(t)||0)+1;O.set(t,n),S&&S.register(e,t,e)}(i,e),i}function F(e){const t=e.map(I);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const E=new WeakMap;function I(e){for(const[t,n]of y)if(n.canHandle(e)){const[r,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},o]}return[{type:"RAW",value:e},E.get(e)||[]]}function A(e){switch(e.type){case"HANDLER":return y.get(e.name).deserialize(e.value);case"RAW":return e.value}}function j(e,t,n,r){return new Promise((o=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.set(i,o),e.start&&e.start(),e.postMessage(Object.assign({id:i},n),r)}))}const D="function"==typeof Buffer,P=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),k=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(P),C=/^(?:[A-Za-z\\d+\\/]{4})*?(?:[A-Za-z\\d+\\/]{2}(?:==)?|[A-Za-z\\d+\\/]{3}=?)?$/,T=String.fromCharCode.bind(String),N="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),$=e=>e.replace(/[^A-Za-z0-9\\+\\/]/g,""),M=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a<e.length;){if((n=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=P[t>>18&63]+P[t>>12&63]+P[t>>6&63]+P[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},U=e=>{if(e=e.replace(/\\s+/g,""),!C.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,r,o="";for(let i=0;i<e.length;)t=k[e.charAt(i++)]<<18|k[e.charAt(i++)]<<12|(n=k[e.charAt(i++)])<<6|(r=k[e.charAt(i++)]),o+=64===n?T(t>>16&255):64===r?T(t>>16&255,t>>8&255):T(t>>16&255,t>>8&255,255&t);return o},B="function"==typeof atob?e=>atob($(e)):D?e=>Buffer.from(e,"base64").toString("binary"):U,R=D?e=>N(Buffer.from(e,"base64")):e=>N(B(e).split("").map((e=>e.charCodeAt(0)))),L=e=>R(z(e)),z=e=>$(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),J=L;function W(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 q=n(5920),V=n.n(q),K=n(1211),G=n.n(K),H=n(5480),Y=n.n(H);let Z;Z="object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node?Y():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:i}=document;r(i),i.appendChild(o)})):(self.importScripts(e),Promise.resolve(self.PSPDFModuleInit))};const X=Z,Q="nutrient-viewer-lib/",ee=`${Q}nutrient-viewer${"-"+G()}.wasm.js`,te=`${Q}nutrient-viewer${"-"+V()}.wasm`;function ne(e,t){let n,r,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:globalThis;return new Promise((async c=>{n=function(e,t){let n;if("object"==typeof e){n=e.wasm;return{wasmBinaryFile:te,locateFile:e=>e,wasmBinary:n}}const r={wasmBinaryFile:e+te,locateFile:e=>e,wasmBinary:n};{const e=fetch(r.wasmBinaryFile,{credentials:"same-origin"}),n=14036211;e.then((e=>{const t=e.headers?.get("content-length");return t&&parseInt(t)>=n&&i("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://www.nutrient.io/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,i)=>((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 a(e.message),null;throw e})):d();let f=await c;null===f&&(a("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://www.nutrient.io/guides/web/current/troubleshooting/common-issues/#response-has-unsupported-mime-type-error."),f=await d()),!l&&u&&o(`Compilation and Instantiation complete, took: ${Date.now()-u}ms`),i(f.instance,f.module)})(),{})}return r}(e,t),"string"==typeof e&&(r=await X(`${e}${ee}`)),o("Using WASM method"),function(e){e.PSPDFLoggingServices={error(e,t){a(`[${e}] ${t}`)},warn(e,t){i(`[${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",Dz:"D",Dž:"D",Đ:"D",Ƌ:"D",DZ:"DZ",DŽ:"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",Lj:"L",Ł:"L",LJ:"LJ",Ḿ:"M",Ṁ:"M",Ṃ:"M",Ɱ:"M",Ń:"N",Ň:"N",Ņ:"N",Ṋ:"N",Ṅ:"N",Ṇ:"N",Ǹ:"N",Ɲ:"N",Ṉ:"N",Ƞ:"N",Nj:"N",Ñ:"N",NJ:"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:"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",dž:"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:"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:"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:"ff",ffi:"ffi",ffl:"ffl",fi:"fi",fl:"fl",ij:"ij",œ:"oe",st:"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 i=r.exec(e);for(;null!=i;)o.push([i.index,i[0].length]),i=r.exec(e);return o},exec:(e,t)=>new RegExp(e).exec(t)}}(s);c({nativeModule:await r(n)})}))}function re(e){if("arrayBuffer"in e)return e.arrayBuffer().then((e=>new Uint8Array(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 oe="text",ie="documentA",ae="documentB",se="result",ce=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const ue=function(e){return"string"==typeof e&&ce.test(e)};const le=function(e){if(!ue(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)},de=[];for(let e=0;e<256;++e)de.push((e+256).toString(16).slice(1));function fe(e,t=0){return(de[e[t+0]]+de[e[t+1]]+de[e[t+2]]+de[e[t+3]]+"-"+de[e[t+4]]+de[e[t+5]]+"-"+de[e[t+6]]+de[e[t+7]]+"-"+de[e[t+8]]+de[e[t+9]]+"-"+de[e[t+10]]+de[e[t+11]]+de[e[t+12]]+de[e[t+13]]+de[e[t+14]]+de[e[t+15]]).toLowerCase()}new Uint8Array(16);function pe(e){return 14+(e+64>>>9<<4)+1}function me(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function ge(e,t,n,r,o,i){return me((a=me(me(t,e),me(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function he(e,t,n,r,o,i,a){return ge(t&n|~t&r,e,t,o,i,a)}function ye(e,t,n,r,o,i,a){return ge(t&r|n&~r,e,t,o,i,a)}function be(e,t,n,r,o,i,a){return ge(t^n^r,e,t,o,i,a)}function we(e,t,n,r,o,i,a){return ge(n^(t|~r),e,t,o,i,a)}const ve=function(e){return function(e){const t=new Uint8Array(4*e.length);for(let n=0;n<4*e.length;n++)t[n]=e[n>>2]>>>n%4*8&255;return t}(function(e,t){const n=new Uint32Array(pe(t)).fill(0);n.set(e),n[t>>5]|=128<<t%32,n[n.length-1]=t,e=n;let r=1732584193,o=-271733879,i=-1732584194,a=271733878;for(let t=0;t<e.length;t+=16){const n=r,s=o,c=i,u=a;r=he(r,o,i,a,e[t],7,-680876936),a=he(a,r,o,i,e[t+1],12,-389564586),i=he(i,a,r,o,e[t+2],17,606105819),o=he(o,i,a,r,e[t+3],22,-1044525330),r=he(r,o,i,a,e[t+4],7,-176418897),a=he(a,r,o,i,e[t+5],12,1200080426),i=he(i,a,r,o,e[t+6],17,-1473231341),o=he(o,i,a,r,e[t+7],22,-45705983),r=he(r,o,i,a,e[t+8],7,1770035416),a=he(a,r,o,i,e[t+9],12,-1958414417),i=he(i,a,r,o,e[t+10],17,-42063),o=he(o,i,a,r,e[t+11],22,-1990404162),r=he(r,o,i,a,e[t+12],7,1804603682),a=he(a,r,o,i,e[t+13],12,-40341101),i=he(i,a,r,o,e[t+14],17,-1502002290),o=he(o,i,a,r,e[t+15],22,1236535329),r=ye(r,o,i,a,e[t+1],5,-165796510),a=ye(a,r,o,i,e[t+6],9,-1069501632),i=ye(i,a,r,o,e[t+11],14,643717713),o=ye(o,i,a,r,e[t],20,-373897302),r=ye(r,o,i,a,e[t+5],5,-701558691),a=ye(a,r,o,i,e[t+10],9,38016083),i=ye(i,a,r,o,e[t+15],14,-660478335),o=ye(o,i,a,r,e[t+4],20,-405537848),r=ye(r,o,i,a,e[t+9],5,568446438),a=ye(a,r,o,i,e[t+14],9,-1019803690),i=ye(i,a,r,o,e[t+3],14,-187363961),o=ye(o,i,a,r,e[t+8],20,1163531501),r=ye(r,o,i,a,e[t+13],5,-1444681467),a=ye(a,r,o,i,e[t+2],9,-51403784),i=ye(i,a,r,o,e[t+7],14,1735328473),o=ye(o,i,a,r,e[t+12],20,-1926607734),r=be(r,o,i,a,e[t+5],4,-378558),a=be(a,r,o,i,e[t+8],11,-2022574463),i=be(i,a,r,o,e[t+11],16,1839030562),o=be(o,i,a,r,e[t+14],23,-35309556),r=be(r,o,i,a,e[t+1],4,-1530992060),a=be(a,r,o,i,e[t+4],11,1272893353),i=be(i,a,r,o,e[t+7],16,-155497632),o=be(o,i,a,r,e[t+10],23,-1094730640),r=be(r,o,i,a,e[t+13],4,681279174),a=be(a,r,o,i,e[t],11,-358537222),i=be(i,a,r,o,e[t+3],16,-722521979),o=be(o,i,a,r,e[t+6],23,76029189),r=be(r,o,i,a,e[t+9],4,-640364487),a=be(a,r,o,i,e[t+12],11,-421815835),i=be(i,a,r,o,e[t+15],16,530742520),o=be(o,i,a,r,e[t+2],23,-995338651),r=we(r,o,i,a,e[t],6,-198630844),a=we(a,r,o,i,e[t+7],10,1126891415),i=we(i,a,r,o,e[t+14],15,-1416354905),o=we(o,i,a,r,e[t+5],21,-57434055),r=we(r,o,i,a,e[t+12],6,1700485571),a=we(a,r,o,i,e[t+3],10,-1894986606),i=we(i,a,r,o,e[t+10],15,-1051523),o=we(o,i,a,r,e[t+1],21,-2054922799),r=we(r,o,i,a,e[t+8],6,1873313359),a=we(a,r,o,i,e[t+15],10,-30611744),i=we(i,a,r,o,e[t+6],15,-1560198380),o=we(o,i,a,r,e[t+13],21,1309151649),r=we(r,o,i,a,e[t+4],6,-145523070),a=we(a,r,o,i,e[t+11],10,-1120210379),i=we(i,a,r,o,e[t+2],15,718787259),o=we(o,i,a,r,e[t+9],21,-343485551),r=me(r,n),o=me(o,s),i=me(i,c),a=me(a,u)}return Uint32Array.of(r,o,i,a)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(pe(8*e.length)).fill(0);for(let n=0;n<e.length;n++)t[n>>2]|=(255&e[n])<<n%4*8;return t}(e),8*e.length))};const _e="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Oe="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Se(e,t,n,r,o,i){const a="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,s="string"==typeof r?le(r):r;if("string"==typeof r&&(r=le(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+a.length);if(c.set(s),c.set(a,s.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,o){i=i||0;for(let e=0;e<16;++e)o[i+e]=c[e];return o}return fe(c)}function xe(e,t,n,r){return Se(48,ve,e,t,n,r)}xe.DNS=_e,xe.URL=Oe;"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);function Fe(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function Ee(e,t){return e<<t|e>>>32-t}const Ie=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const o=(e=r).length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let t=0;t<i;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];a[t]=n}a[i-1][14]=8*(e.length-1)/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=a[e][t];for(let e=16;e<80;++e)r[e]=Ee(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let o=n[0],i=n[1],s=n[2],c=n[3],u=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),a=Ee(o,5)+Fe(n,i,s,c)+u+t[n]+r[e]>>>0;u=c,c=s,s=Ee(i,30)>>>0,i=o,o=a}n[0]=n[0]+o>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+u>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])};function Ae(e,t,n,r){return Se(80,Ie,e,t,n,r)}Ae.DNS=_e,Ae.URL=Oe;const je="Maui_Android",De="Maui_iOS",Pe="Maui_MacCatalyst",ke="Maui_Windows",Ce="FlutterForWeb",Te="Electron",Ne="cms",$e="unableToShape",Me="requiresMoreFonts";async function Ue(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 Be(){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 Re(e,t){const n=new RegExp(` ${t}/(\\\\d+)\\\\.*`);let r;return(r=e.match(n))?Number(r[1]):0}function Le(){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"}Be();const ze=Le(),Je=(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis.navigator?.userAgent;switch(Be(e)){case"trident":return Re(e,"Trident");case"edge":return Re(e,"Edge");case"blink":return Re(e,"Chrome");case"webkit":return Re(e,"Version");case"gecko":return Re(e,"Firefox");default:;}}(),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Le(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be();"ios"===e||"android"===e||We(t)}(),"ios"===ze||We(),"ios"===ze);function We(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Be();return("undefined"==typeof window||!window.PSPDFKIT_PLAYWRIGHT_TEST)&&("webkit"===e&&"undefined"!=typeof TouchEvent)}let qe;"undefined"!=typeof window&&(window.addEventListener("mousemove",(function e(){qe=!1,window.removeEventListener("mousemove",e)})),window.addEventListener("pointermove",(function e(t){"mouse"!==t.pointerType&&"pen"!==t.pointerType||(qe=!1),window.removeEventListener("pointermove",e)})));/Mac/i.test(globalThis.navigator?.platform);function Ve(){return"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron/")>=0}const Ke="/create.pdf";function Ge(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function He(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var Ye=new WeakMap;class Ze{constructor(e){var t,n,r;Ge(this,Ye,void 0),n=this,r=e,(t=Ye).set(He(t,n),r)}async render(e){const t={type:"render_tile",...e},n=await(r=Ye,o=this,r.get(He(r,o))).dispatchCommand(JSON.stringify(t));var r,o;if(!n.success)throw new Error(`Render failed: ${n.message}`);const i=n.values[0],a=new Uint8ClampedArray(i.buffer,i.byteOffset,i.byteLength),s=new ImageData(a,e.bitmap_width,e.bitmap_height);return await createImageBitmap(s)}}const Xe="/save.pdf",Qe="/embedded.pdf",et="WebAssembly module not loaded.";let tt=null,nt=!1,rt=!1,ot=null;const it={password:void 0,initialPageIndex:void 0};let at=[],st=it,ct=null,ut=null;const lt=new Set,dt="/fonts";let ft="";const pt=new Set;let mt=!1;var gt=function(e){return e[e.Daemon=0]="Daemon",e[e.WASM=1]="WASM",e}(gt||{});const ht=[];const yt=["configurePDFJavaScriptSupport","closeDocument","setFormValues","openDocument","saveDocument","importXFDF","importInstantDocumentJSON"],bt={annotationsAndForms:"annotations_and_forms",assemble:"assemble",extract:"extract",extractAccessibility:"extract_accessibility",fillForms:"fill_forms",modification:"modification",printHighQuality:"print_high_quality",printing:"printing"};function wt(e){r(tt,"WebAssembly module not loaded."),mt&&performance.mark("exec");for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];const i=n.map((e=>function(e){return Array.isArray(e)&&0===e.length}(e)?JSON.stringify(e):e));yt.includes(e)&&Dt();const a=tt[e](...i)||\'{ "success": true }\',s=JSON.parse(a);if(mt&&ht.push({type:gt.WASM,name:e,args:i,time:performance.measure("exec - RECORD_CALLS","exec").duration}),!s.success)throw new Error(s.error);return s}const vt=["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","import_document_json"];function _t(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;r(tt,"WebAssembly module not loaded.");const o=JSON.stringify({type:e,...t});let i;if(mt&&performance.mark("daemonExec"),vt.includes(e)&&Dt(),n)try{const e="string"==typeof n?new Uint8Array((a=n,(new TextEncoder).encode(a).buffer)):new Uint8Array(n),t=tt.allocateMemory(e.byteLength);try{t.view.set(e);const n=tt.memoryHandleToVector(t);try{i=tt.dispatchCommandWithBinary(o,n)}finally{n.delete()}}finally{t.delete()}}catch(e){throw e}else i=tt.dispatchCommand(o);var a;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 mt&&ht.push({type:gt.Daemon,name:e,args:[o],time:performance.measure("daemonExec: RECORD_CALLS","daemonExec").duration}),i.delete(),s}function Ot(e){try{const t=(new TextDecoder).decode(e);return JSON.parse(t)}catch(e){throw e}}function St(e,t){return`${e}/${t}.pdf`}async function xt(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=St(n,r)):("dataFilePath"in e&&e.dataFilePath===r&&"applyInstantJson"===e.type||"dataFilePath"in e&&e.dataFilePath===r&&"applyXfdf"===e.type)&&(e.dataFilePath=St(n,r))})),{basename:r,buffer:await re(o)}})));return o.forEach((e=>{!function(e,t,n){r(tt,et),tt.FS.analyzePath(e).exists||tt.FS.mkdir(e),tt.FS.writeFile(St(e,t),n)}(n,e.basename,e.buffer)})),function(){o.forEach((e=>{!function(e,t){r(tt,et),tt.FS.unlink(St(e,t))}(n,e.basename)}))}}function Ft(){rt=!0;const e=wt("configurePDFJavaScriptSupport",!0);return r(e.success,"An error occurred while executing the document level JavaScript."),e.changes||[]}function Et(e,t){try{_t("edit_document",{save_path:t,operations:e})}catch(e){throw new Error(`Error applying operations to document: ${e.message}`)}}let It=null,At=!1,jt=!1;function Dt(){At||(It=null,jt=!1)}function Pt(e){At&&!e&&(At=!1,It&&Ct(It)),At=e}function kt(){return null===It&&(It=_t("read_form_json_objects",{include_line_height_factor:!1}),jt=!1),It}function Ct(e){if(At){if(null===e)throw At=!1,new Error("Error enqueuing form JSON objects: form fields JSON is null.");return It&&!jt&&(jt=!0),void(It=e)}if(jt||!At)try{Dt(),_t("apply_form_json_objects",{form_fields_with_widgets:e})}catch(e){throw new Error("Error applying form JSON objects to "+Ke+": "+e.message)}}function Tt(e,t,n,o,i,a,s){const c=$t(i,{width:n,height:o});if(r("number"==typeof e.pageIndex,"Annotation must have a pageIndex"),!lt.has(e.pdfObjectId))try{r("number"==typeof e.pdfObjectId,"Cannot call renderAnnotation() for an annotation without pdfObjectId.");const t=_t("render_annotation",{page:e.pageIndex,annotation_id:e.pdfObjectId,format:c,bitmap_width:n,bitmap_height:o,appearance_stream_type:a||"normal",render_form_highlight:s??!0});if("bitmap"===c)return t[0];{const e=new Blob([t[0]],{type:`image/${c}`});return URL.createObjectURL(e)}}catch(e){return void 0}}const Nt={SharePoint:"SPO",Salesforce:"SF",[De]:"MauiIOS",[je]:"MauiAndroid",[Pe]:"MauiMacCatalyst",[ke]:"MauiWindows",[Ce]:"FlutterForWeb",NodeJS:"NodeJS",Electron:"Electron"};function $t(e,t){let{width:n,height:r}=t;return"webp"===e&&(n>16383||r>16383)||Je&&n*r>16777216&&"bitmap"===e?"png":e}function Mt(e){return e.map((e=>bt[e]))}function Ut(e,t){return e.pdfObjectId===t.pdfObjectId}const Bt=new class{constructor(){u(this,"_pdfObjectIdsForIds",{}),u(this,"comparisonDocuments",{}),u(this,"lastOpenedComparisonDocument",null),u(this,"persistedOpenDocument",null),u(this,"persistedOpenDocumentConfiguration",it),u(this,"files",new Map),u(this,"fileDescriptor",0)}loadNativeModule(e,t){let{disableWebAssemblyStreaming:n,enableAutomaticLinkExtraction:r,overrideMemoryLimit:o}=t;return ct=Date.now(),nt=r,ot=o,ne(e,n).then((e=>{let{nativeModule:t}=e;tt=t;const n=wt("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=tt.allocateMemory(n.byteLength);let o=null,i=null;try{r.view.set(n),o=tt.corePBProtoBridge(e,t,r),i=o.result;const a={success:o.success,result:i.view.slice()};return Promise.resolve(a)}finally{r.delete(),o?.result?.delete(),o?.delete(),i?.delete()}}async writeFile(e,t){r(tt,et),tt.FS.writeFile(e,new Uint8Array(t))}async deleteFile(e){r(tt,et),tt.FS.unlink(e)}async readFile(e){return r(tt,et),tt.FS.readFile(e)}async renderLinearized(e){const t=tt.allocateMemory(e.byteLength);let n=null;try{return t.view.set(e),n=tt.renderLinearized(t),Promise.resolve(n.view.slice())}finally{t.delete(),n?.delete()}}async load(e,t,n){let i,{mainThreadOrigin:a,customFonts:s,dynamicFonts:c,productId:u,featureFlags:l}=n;r(tt,et);try{if(tt.FS.analyzePath(dt).exists||tt.FS.mkdir(dt),ft=s?`${dt}/custom-fonts`:"",s&&!tt.FS.analyzePath(ft).exists&&function(e,t){r(tt,et),tt.FS.analyzePath(t).exists||tt.FS.mkdir(t),tt.FS.mount(tt.FS.filesystems.WORKERFS,{blobs:e},t)}(s,ft),Ve()&&(r(null==u||u===Te,`PSPDFKit is running on Electron, but has been setup to be used with ${u}Please contact support to resolve the issue.`),u=Te),i=tt.initPSPDFKit(null==t?"":t,a,dt,"",u&&void 0!==Nt[u]?Nt[u]:"",JSON.stringify(l??[])),c){const e=await Ue(c);_t("dynamic_font_loading/set_metadata_file",void 0,await e.arrayBuffer()),ut=c.split("/").slice(0,-1).join("/")}}catch(e){throw e}const d=JSON.parse(i);if(ct&&o(`Native initialization complete, took: ${Date.now()-ct}ms`),!d.success)throw new Error("Failed to initialize PSPDFKit: "+d.error);return d}getNativeModule(){return tt}async openDocument(e,t){try{return r(tt,et),null!==ot&&wt("overrideMemoryLimit",ot),tt.FS.writeFile(Ke,new Uint8Array(e)),this.openAndReturnDocumentInfo(t??it)}finally{this._pdfObjectIdsForIds={}}}async openCreateFilePathDocument(e){try{return null!==ot&&wt("overrideMemoryLimit",ot),this.openAndReturnDocumentInfo(e??it)}finally{this._pdfObjectIdsForIds={}}}async getSuggestedLineHeightFactor(e,t){return _t("get_suggested_line_height_factor",{annotation_ids:[e],page:t})[0].line_height_factors[e.toString()]}async getAvailableFontFaces(e){if(!e)return[];const t=_t("get_available_font_faces");return t[0]?.font_faces.reduce(((t,n)=>{const r=e.find((e=>e.name===n.path.replace(`${ft}/`,"")));return r?t.concat({readableName:n.fullName,name:r.name}):t}),[])}async setFontSubstitutions(e){try{_t("set_font_substitutions",{substitutions:e})}catch(e){throw new Error("Error setting fonts substitutions: "+e.message)}}async getClosestSnapPoint(e,t){return _t("get_closest_snap",{q:[e,t]})[0]}async configureSnapper(e){_t("configure_snapper",{page:e})}async reloadDocument(){try{return Pt(!1),wt("closeDocument"),this.openAndReturnDocumentInfo(st)}finally{this._pdfObjectIdsForIds={}}}async openAndReturnDocumentInfo(e){st=e,wt("openDocument",Ke,JSON.stringify(e)),rt&&Ft(),_t(nt?"enable_automatic_link_extraction":"disable_automatic_link_extraction");const t=Ot(_t("document_info",{requested_info:["ID"]})[0]);if(t.pageCount<=0)return t;let n=[];if("number"==typeof e?.initialPageIndex){const r=await this.getPageInfo(e.initialPageIndex);for(let o=0;o<t.pageCount;o++){const t={...r,pageIndex:o,pageLabel:e.initialPageIndex===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=_t("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 a(`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 i=()=>"number"==typeof t&&"number"==typeof n?_t("dynamic_font_loading/preflight_annotation",{text:e,annotation_id:t,page:n})[0]:(r(o,`annotation not set: ${o}`),_t("dynamic_font_loading/preflight_annotation",{text:e,annotation_json:o})[0]);try{let e=i();e.preflight_result===Me&&(await this.addDynamicFonts(e.required_fonts),e=i()),"number"==typeof t&&(e.preflight_result===$e?lt.add(t):lt.delete(t))}catch(n){a(`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=>!pt.has(e)));!function(e){r(tt,et),e.forEach((e=>{tt.FS.analyzePath(`${dt}/${e.name}`).exists||tt.FS.writeFile(`${dt}/${e.name}`,new Uint8Array(e.data))}))}((await Promise.all(t.map((e=>fetch(`${ut}/${e}`).then((e=>e.arrayBuffer())))))).map(((e,n)=>({name:t[n],data:e})))),t.forEach((e=>{pt.add(e)}))}catch(e){t.forEach((e=>{pt.delete(e)})),a(`There was an error loading a font: ${e}`)}await _t("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=_t("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){a("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=_t("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]),i=JSON.parse(o);t.push(i.pageInfo)}catch(e){a(`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 Ft()}async runPDFFormattingScripts(e,t){let n;r(rt,"PDF Formatting Scripts can only run after JavaScript is enabled.");try{n=_t("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=_t("get_bookmarks");return r(1===e.length,"expected only one response for getBookmarks"),e[0].bookmarks||[]}async getFormJSON(){return _t("get_form_json")[0]}async getFormValues(){return _t("get_form_values")}async setFormValues(e){const t=kt();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&<.delete(e.pdfObjectId)})),n=!0,{...t,value:o.value}):t}));if(n){if(ut)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)}Ct(o)}}async setFormFieldValue(e){await this.setFormValues([e])}async applyOperations(e,t){const n=await xt(e,t);Et(e,Ke),n()}async exportPDFWithOperations(e,t){const n=await xt(e,t);let o;r(tt,et);try{Et(e,Xe),o=tt.FS.readFile(Xe).buffer}catch(e){throw new Error("Error applying operations: "+e.message)}return n(),o}async getSignaturesInfo(){try{return _t("get_signatures",{certificate_check_time:"current_time"})[0]}catch(e){throw new Error(`Error getting signatures info: ${e.message}`)}}async getComments(){try{return _t("get_comments")}catch(e){throw new Error(`Error getting comments: ${e.message}`)}}async applyComments(e){try{return _t("apply_comments",{comments:e})}catch(e){throw new Error(`Error applying comments: ${e.message}`)}}async prepareSign(e,t,n,o,i,a){let s;const c=!1,u=!1;try{s=_t("get_signatures",{certificate_check_time:"current_time"})[0];const e="not_signed"!==s.status;_t("save_document",{file_path:Xe,flatten_annotations:!1,save_incrementally:e,apply_redactions:c,save_for_printing:u,format:"pdf",preserve_change_tracker_state:!1}),wt("openDocument",Xe,JSON.stringify(st))}catch(e){throw new Error(`Error saving document backup for invisible signing: ${e}`)}try{const e=!n&&"not_signed"!==s.status;_t("save_document",{file_path:Ke,flatten_annotations:n,save_incrementally:e,apply_redactions:c,save_for_printing:u,format:"pdf",preserve_change_tracker_state:!1}),n&&(wt("openDocument",Ke,JSON.stringify(st)),rt&&Ft())}catch(e){throw new Error(`Error saving document for invisible signing: ${e}`)}let l;try{l=_t("prepare_sign",{signer_data_source:{...e,field_name:o,position:i,appearance:a,type:"pspdfkit/signer-data-source"},signature_metadata:{...t,type:"pspdfkit/signature-metadata"}})}catch(e){throw new Error(`Error preparing document for signing: ${e}`)}r(tt,et);let d=null;return e&&e?.signatureType!==Ne||(d=tt.FS.readFile(l[0].result.file_contents).buffer),tt.FS.unlink(l[0].result.file_contents),{file:l[0].result.file,hash:l[0].result.hash,signatureFormFieldName:l[0].result.signature_form_fqn,dataToBeSigned:l[0].result.data_to_be_signed,fileContents:d}}async getTimestampRequest(e,t){try{const[n]=_t("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 _t("get_revocation_http_requests",{signing_certificates:e})}catch(e){throw new Error(`Error getting revocations requests: ${e.message}`)}}async setSignaturesLTV(e){try{const t=_t("get_signatures",{certificate_check_time:"current_time",revocation_responses:e})[0];return _t("save_document",{file_path:Ke,flatten_annotations:!1,save_incrementally:!0,apply_redactions:!1,save_for_printing:!1,format:"pdf",preserve_change_tracker_state:!1}),t}catch(e){throw new Error(`Error getting signatures info: ${e.message}`)}}async sign(e,t,n,r,o,i,a,s,c){let u;try{let l;const d=J(o).buffer,f=a?"pkcs7"===a: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);f||(l=_t("create_signature",{signatureType:r,hash:n,signed_data:o,certificates:i,timestamp_response:s})),u=_t("sign",{password:st?.password,save_path:Ke,file_path:e,signature_form_fqn:t,pkcs7_container:l?.[0].result||o,revocation_responses:c??[]}),wt("openDocument",Ke,JSON.stringify(st)),rt&&Ft()}catch(e){throw new Error(`Error signing document: ${e}`)}return u[0].result}async restoreToOriginalState(){try{wt("openDocument",Xe,JSON.stringify(st)),rt&&Ft();const e="not_signed"!==_t("get_signatures",{certificate_check_time:"current_time"})[0].status;_t("save_document",{file_path:Ke,flatten_annotations:!1,save_incrementally:e,apply_redactions:!1,save_for_printing:!1,format:"pdf",preserve_change_tracker_state:!1}),wt("openDocument",Ke,JSON.stringify(st)),rt&&Ft()}catch(e){throw new Error(`Could not restore backup document: ${e}`)}}async evalFormValuesActions(e){const t=kt().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(ut)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=_t("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 kt()}async setFormJSONUpdateBatchMode(e){await Pt(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=_t("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 at=[],st={password:void 0,initialPageIndex:void 0},rt=!1,It=null,At=!1,jt=!1,wt("closeDocument")}finally{this._pdfObjectIdsForIds={}}}async renderAnnotation(e,t,n,r,o,i,a){return Tt({...e,pdfObjectId:this._getPdfObjectIdForObject(e)},t&&await re(t),n,r,o,i,a)}async renderPageAnnotations(e,t,n,r,o){return t.map(((t,i)=>Tt({pdfObjectId:t,pageIndex:e},0,n[i],r[i],$t(o,{width:n[i],height:r[i]}))))}async renderDetachedAnnotation(e,t,n,o,i){r(tt,et),!ut||"pspdfkit/stamp"!==e.type&&"pspdfkit/text"!==e.type||await this.preflightAnnotation(e,e.pdfObjectId);const a=t?await re(t):null,s=t?t.type:null;return _t("render_annotation",{annotation_json:{...e,pdfObjectId:this._getPdfObjectIdForObject(e),pageIndex:0},format:i,bitmap_width:n,bitmap_height:o,content_type:s||void 0},a?a.buffer:void 0)[0]}async loadCertificates(e){if(_t("load_certificates",{certificates:e}).length>0)throw new t("Internal error while loading certificates")}async getAttachment(e){let t,n;const r=await this.getEmbeddedFilesList(),o=r?.map((e=>e.id)),i=o?.includes(e);if(i)try{_t("extract_embedded_file",{id:e,file_path:Qe}),t=tt.FS.readFile(Qe).buffer}finally{tt.FS.analyzePath(Qe)?.exists&&tt.FS.unlink(Qe)}else{const r=_t("get_annotation_attachment",{attachment_id:e});n=r[0].encoding,t=r[1]}return[t,n]}async annotationsForPageIndex(e){try{const t=_t("get_annotations_for_page_index",{pageIndex:e})[0];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}catch(e){return[]}}async getTabOrder(e){return _t("get_annotation_tab_order",{page:e})[0].order.map((e=>{const t=Object.entries(this._pdfObjectIdsForIds).find((t=>{let[n,r]=t;return r===e}));return{id:t?.[0]||String(e),pdfObjectId:e}}))}async setTabOrder(e,t){_t("set_annotation_tab_order",{page:e,order:t.map((e=>this._getPdfObjectIdForObject(e)))})}async createAnnotation(e,t){r(tt,et),r("number"==typeof e.pageIndex,"Annotation must have a pageIndex");const n=e.pdfObjectId,o=t?await re(t):null;e&&this.canPreflightAnnotation(e)&&ut&&await this.preflightAnnotation(e,void 0),"pspdfkit/widget"===e.type&&(Pt(!1),Dt());const i=_t("add_annotation",{annotation:{...("pspdfkit/shape/ellipse"===e.type||"pspdfkit/shape/rectangle"===e.type)&&e.measurementScale?{...e,measurementBBox:e.bbox}:e,pdfObjectId:void 0}},o?o.buffer:void 0);"number"==typeof n&&"number"==typeof this._pdfObjectIdsForIds[n.toString()]&&delete this._pdfObjectIdsForIds[n.toString()];const a=i[0].annotation_id;return this._pdfObjectIdsForIds[e.id||a.toString()]=a,a}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=kt(),n="number"==typeof t.pdfObjectId?t.pdfObjectId.toString():t.id;Ct(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)&&ut&&await this.preflightAnnotation(e,t.pdfObjectId),_t("update_annotation",{annotation:t})}async updateButtonIcon(e,t,n){_t("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;Ct(kt().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 i=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!==i)),r.some((e=>e.value===o))||(o="")}const i=n.widgets.filter((e=>t!==e.id)),a=n.formField.annotationIds.filter((n=>n!==t&&n!==String(e.pdfObjectId)));return i.length>0&&a.length>0?{...n,formField:{...n.formField,annotationIds:a,...r?{options:r}:null},widgets:i,value:o}:null}return n})).filter(Boolean))}catch(e){throw e}else try{_t("remove_annotations",{annotation_ids:[this._getPdfObjectIdForObject(e)]})}catch(t){i(`Removing annotation failed for annotation: ${JSON.stringify(e)}`)}delete this._pdfObjectIdsForIds[e.id||e.pdfObjectId?.toString()],lt.delete(e.pdfObjectId)}async createFormField(e,t){const n=kt().concat([{type:"pspdfkit/form-field-with-widgets",formField:e,widgets:t}]),r=At;At&&Pt(!1),Ct(n);const o=kt();r&&Pt(!0);const i=o.find((t=>t.formField.name===e.name));if(!i)throw new Error(`Error creating new form field in ${Ke}: created form field not found. ${JSON.stringify({type:"pspdfkit/form-field-with-widgets",formField:e,widgets:t})}`);const a=i.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||i.formField.pdfObjectId.toString()]=i.formField.pdfObjectId,a}async updateFormField(e,t){let n={...e,pdfObjectId:this._pdfObjectIdsForIds[e.id]||this._getPdfObjectIdForObject(e)};const r=kt(),o=r.find((t=>Ut(t.formField,n)||t.formField.name===e.name));if(!o)throw new Error(`Error updating form field with name "${e.name}" in ${Ke}: form field not found. ${JSON.stringify(r)}`);const i=o.formField.name!==e.name;let a=null;if(i&&"pspdfkit/form-field/radio"===n.type){const o=e.name,i=r.find((e=>e.formField.name===o));i&&"pspdfkit/form-field/radio"===i.formField.type&&(n={...n,annotationIds:[...n.annotationIds,...i.formField.annotationIds],options:[...n.options,...i.formField.options]},t=[...t,...i.widgets],a=i)}Ct(r.map((r=>{if(a&&a.formField.pdfObjectId===r.formField.pdfObjectId)return null;if(Ut(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=kt().find((t=>t.formField.name===e.name));if(!s)throw new Error(`Error updating form field "${e.name}" in ${Ke}: 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=kt(),n=t.find((t=>t.formField.name===e.name));if(!n)return;Ct(t.filter((t=>t.formField.name!==e.name)));const r=kt().find((t=>t.formField.name===e.name));if(r)throw new Error(`Error deleting form field with name "${e.name}" in ${Ke}: form field still present. ${JSON.stringify(r)}`);n.widgets.forEach((e=>{delete this._pdfObjectIdsForIds[e.id]}))}async deleteFormFieldValue(e){Ct(kt().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}):lt.delete(t)}async preflightWidgetAnnotation(e,t,n){n||"number"!=typeof t?n&&await this.preflightRenderAnnotationText(n,t,e.pageIndex):lt.delete(t)}async createBookmark(e){try{_t("append_bookmarks",{bookmarks:[e]})}catch(e){throw new Error(`Error creating new bookmark in ${Ke}: ${e.message}`)}}async updateBookmark(e){try{_t("remove_bookmarks",{bookmarkIds:[e.id??e.pdfBookmarkId]}),_t("append_bookmarks",{bookmarks:[e]})}catch(e){throw new Error(`Error updating bookmark in ${Ke}: ${e.message}`)}}async deleteBookmark(e){try{_t("remove_bookmarks",{bookmarkIds:[e]})}catch(e){throw new Error(`Error deleting bookmark in ${Ke}: ${e.message}`)}}async getTextFromRects(e,t){return _t("get_text_from_rects",{page:e,rects:t.map((e=>[e.left,e.top,e.width,e.height]))})[0].text}async search(e,t,n,r){return _t("search",{query:e,start_index:t,limit:n,case_sensitive:r,search_type:arguments.length>4&&void 0!==arguments[4]?arguments[4]:oe})}async parseXFDF(e,t,n){try{return Ot(_t("convert_xfdf_to_instant_json",{ignore_page_rotation:t,rich_text_enabled:n},e)[0])}catch(e){throw e}}async getEmbeddedFilesList(){return _t("list_embedded_files")[0].embeddedFiles||null}async getMeasurementSnappingPoints(e){const t=_t("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 _t("get_secondary_measurement_unit")[0]||null}catch(e){throw new Error(`Error getting secondary measurement: ${e.message}`)}}async setSecondaryMeasurementUnit(e){try{_t("set_secondary_measurement_unit",e?{unitTo:e?.unitTo,precision:e?.precision}:null)}catch(e){i("Error setting secondary measurement unit")}}async getMeasurementScales(){try{return _t("get_measurement_content_formats")[0]||null}catch(e){throw new Error(`Error getting measurement scales: ${e.message}`)}}async removeMeasurementScale(e){try{_t("remove_measurement_content_format",{measurementContentFormat:W(e)})}catch(t){throw new Error(`Error removing ${e.name} measurement scale: ${t.message}`)}}async addMeasurementScale(e){try{_t("add_measurement_content_format",{measurementContentFormat:W(e)})}catch(t){throw new Error(`Error adding ${e.name} measurement scale: ${t.message}`)}}async getAnnotationsByScale(e){try{return _t("get_annotations_for_measurement_content_format",{measurementContentFormat:W(e)})||null}catch(e){throw e}}async exportFile(e,t,n,o,i,a,s,c){let u,l={mimeType:"application/pdf",extension:"pdf"};try{const r=!1;u=_t("save_document",{file_path:Ke,format:o,flatten_annotations:e,save_incrementally:t,apply_redactions:r,save_for_printing:n,remove_all_annotations:i,preserve_change_tracker_state:a,...s?{user_password:s.userPassword,owner_password:s.ownerPassword,document_permissions:Mt(s.documentPermissions)}:null}),c&&(c.forEach((e=>{let{pageIndex:t,id:n,pdfObjectId:r}=e;_t("electronic_signatures/flatten",{page:t,annotation_id:this._getPdfObjectIdForObject({id:n,pdfObjectId:r})})})),u=_t("save_document",{file_path:Xe,format:o,flatten_annotations:e,save_incrementally:t,apply_redactions:r,save_for_printing:n,remove_all_annotations:i,preserve_change_tracker_state:a,...s?{user_password:s.userPassword,owner_password:s.ownerPassword,document_permissions:Mt(s.documentPermissions)}:null}))}catch(e){throw new Error(`Error saving to ${Xe}: ${e.message}`)}const d=u[0];d.format&&(l={mimeType:d.format.mime_type,extension:d.format.extension}),r(tt,et);const f=tt.FS.readFile(c?Xe:Ke).buffer;return c&&(wt("closeDocument"),wt("openDocument",Ke,JSON.stringify(st))),[f,l]}async importXFDF(e,t,n,r){at.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"),_t("remove_all_annotations",{exclude_annotation_types:e,exclude_annotation_ids:t})}(),_t("import_xfdf",{ignore_page_rotation:n,rich_text_enabled:r},e)}async exportXFDF(e){const t=_t("export_xfdf",{ignore_page_rotation:e});return(new TextDecoder).decode(t[0])}async importInstantJSON(e){_t("import_document_json",void 0,JSON.stringify(e))}async exportInstantJSON(e){const t=At;At&&Pt(!1);const n=_t("export_document_json","number"==typeof e?{version:{annotations:e}}:void 0);return t&&Pt(!0),Ot(n[0])}async getDocumentOutline(){const e=_t("get_outline");return r(1===e.length,"expected only one response for getDocumentOutline"),e[0].outline||[]}async setDocumentOutline(e){return _t("set_outline",{outline:e})}async getPageGlyphs(e){return _t("get_glyphs",{page:e})[0].glyphs||[]}async onKeystrokeEvent(e){const t=_t("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 wt("PSPDFKitVersion").version}getImportedXFDF(){return at}async applyRedactions(){try{_t("save_document",{file_path:Ke,format:"pdf",flatten_annotations:!1,save_incrementally:!1,apply_redactions:!0,save_for_printing:!1,remove_all_annotations:!1})}catch(e){throw new Error(`Error applying redactions and saving to ${Ke}: ${e.message}`)}}async clearAPStreamCache(){wt("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===ie&&null===this.lastOpenedComparisonDocument&&this.persistedOpenDocument instanceof ArrayBuffer?null:(this.lastOpenedComparisonDocument=e,this.openDocument(this.comparisonDocuments[e],this.persistedOpenDocument===e?this.persistedOpenDocumentConfiguration:it))}async documentCompareAndOpen(e){r(this.comparisonDocuments[ie]&&this.comparisonDocuments[ae],"One or both comparison input documents are missing.");const t=`${ie}.pdf`,n=`${ae}.pdf`;tt.FS.writeFile(t,new Uint8Array(this.comparisonDocuments[ie])),tt.FS.writeFile(n,new Uint8Array(this.comparisonDocuments[ae]));return _t("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[se]=tt.FS.readFile("output.pdf").buffer,this.lastOpenedComparisonDocument=se,this.openDocument(this.comparisonDocuments[se],it)}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.persistedOpenDocumentConfiguration=st}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.persistedOpenDocumentConfiguration);return this.persistedOpenDocument=null,this.persistedOpenDocumentConfiguration=it,this.lastOpenedComparisonDocument=null,this.comparisonDocuments={},t}_getPdfObjectIdForObject(e){return"number"==typeof e.pdfObjectId?e.pdfObjectId:this._pdfObjectIdsForIds[e.id]}async getOCGs(){return _t("ocg/get_ocgs")[0].ocgs}async getOCGVisibilityState(){return{visibleLayerIds:_t("ocg/get_visibility_state")[0].state.visible}}async setOCGVisibilityState(e){return _t("ocg/set_visibility_state",{state:{visible:e.visibleLayerIds}})}async dispatchCommand(e){let t=null;mt&&performance.mark("dispatchCommand");try{if(t=await tt.dispatchCommand(e),null===t)throw Error("dispatchCommand returned null");if(t.hasError())return{success:!1,message:t.getErrorMessage(),code:t.getErrorReason()};const n={success:!0,values:[]};for(let e=0;e<t.getRepliesCount();e++)t.hasJSONReply(e)&&n.values.push(JSON.parse(t.getJSONReply(e))),t.hasBinaryReply(e)&&n.values.push(t.getBinaryReply(e).slice(0));if(mt){const t=JSON.parse(e);ht.push({type:gt.Daemon,name:t.type,args:t,time:performance.measure("dispatchCommand","dispatchCommand").duration})}return n}finally{t&&t.delete()}}async getCoreCallRecording(){return ht}async enableCoreCallRecording(e){mt=e}openFile(e,t){const n=tt.FS.open(e,t);return this.files.set(this.fileDescriptor,n),Promise.resolve(this.fileDescriptor++)}closeFile(e){const t=this.files.get(e);return t&&(tt.FS.close(t),this.files.delete(e)),Promise.resolve()}writeData(e,t,n){const r=this.files.get(e);if(!r)throw Error(`Trying to write to a file with descriptor ${e}, but the file is not open.`);return tt.FS.write(r,new Uint8Array(t),0,t.byteLength,n),Promise.resolve()}async setupRenderMessageChannel(e){b(new Ze(this),e)}recycle(){}destroy(){}},Rt=self;Rt.global=Rt,Rt.module={},Rt.onmessage=async e=>{let t,n,{data:r}=e;try{const e=await Bt[r.action](...r.args);if(t={id:r.id,result:e},Array.isArray(e)){const t=e.filter((e=>e instanceof ArrayBuffer||e instanceof MessagePort));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}}Rt.postMessage(t,n)}})()})();',"Worker",void 0,void 0)}},55512:e=>{e.exports=function(e,t,n,r){var o=self||window;try{try{var i;try{i=new o.Blob([e])}catch(t){(i=new(o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder)).append(e),i=i.getBlob()}var a=o.URL||o.webkitURL,s=a.createObjectURL(i),c=new o[t](s,n);return a.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)}}}}]);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Nutrient Web SDK 1.8.0-a34512c (https://www.nutrient.io/sdk/web)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2016-2025 PSPDFKit GmbH. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
7
|
-
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
|
|
8
|
-
* UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
|
|
9
|
-
* This notice may not be removed from this file.
|
|
10
|
-
*
|
|
11
|
-
* PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/
|
|
12
|
-
*/
|
|
13
|
-
"use strict";(globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[]).push([[861],{22292:(e,t,i)=>{i.d(t,{default:()=>n});var s=i(55512),r=i.n(s);function n(){return r()('/*!\n * Nutrient Web SDK 1.8.0-a34512c (https://www.nutrient.io/sdk/web)\n *\n * Copyright (c) 2016-2025 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://www.nutrient.io/legal/acknowledgements/web-acknowledgements/\n */(()=>{"use strict";function e(t){return e="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},e(t)}function t(t){var i=function(t,i){if("object"!=e(t)||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var r=s.call(t,i||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}(t,"string");return"symbol"==e(i)?i:i+""}function i(e,i,s){return(i=t(i))in e?Object.defineProperty(e,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[i]=s,e}const s=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),h=e=>"object"==typeof e&&null!==e||"function"==typeof e,l=new Map([["proxy",{canHandle:e=>h(e)&&e[s],serialize(e){const{port1:t,port2:i}=new MessageChannel;return c(e,t),[i,[i]]},deserialize:e=>(e.start(),u(e))}],["throw",{canHandle:e=>h(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function c(e,t=globalThis,i=["*"]){t.addEventListener("message",(function r(n){if(!n||!n.data)return;if(!function(e,t){for(const i of e){if(t===i||"*"===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}return!1}(i,n.origin))return void console.warn(`Invalid origin \'${n.origin}\' for comlink proxy`);const{id:h,type:l,path:u}=Object.assign({path:[]},n.data),p=(n.data.argumentList||[]).map(T);let f;try{const t=u.slice(0,-1).reduce(((e,t)=>e[t]),e),i=u.reduce(((e,t)=>e[t]),e);switch(l){case"GET":f=i;break;case"SET":t[u.slice(-1)[0]]=T(n.data.value),f=!0;break;case"APPLY":f=i.apply(t,p);break;case"CONSTRUCT":f=function(e){return Object.assign(e,{[s]:!0})}(new i(...p));break;case"ENDPOINT":{const{port1:t,port2:i}=new MessageChannel;c(e,i),f=function(e,t){return y.set(e,t),e}(t,[t])}break;case"RELEASE":f=void 0;break;default:return}}catch(e){f={value:e,[a]:0}}Promise.resolve(f).catch((e=>({value:e,[a]:0}))).then((i=>{const[s,n]=b(i);t.postMessage(Object.assign(Object.assign({},s),{id:h}),n),"RELEASE"===l&&(t.removeEventListener("message",r),d(t),o in e&&"function"==typeof e[o]&&e[o]())})).catch((e=>{const[i,s]=b({value:new TypeError("Unserializable return value"),[a]:0});t.postMessage(Object.assign(Object.assign({},i),{id:h}),s)}))})),t.start&&t.start()}function d(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e,t){const i=new Map;return e.addEventListener("message",(function(e){const{data:t}=e;if(!t||!t.id)return;const s=i.get(t.id);if(s)try{s(t)}finally{i.delete(t.id)}})),w(e,i,[],t)}function p(e){if(e)throw new Error("Proxy has been released and is not useable")}function f(e){return R(e,new Map,{type:"RELEASE"}).then((()=>{d(e)}))}const g=new WeakMap,m="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(g.get(e)||0)-1;g.set(e,t),0===t&&f(e)}));function w(e,t,i=[],s=function(){}){let o=!1;const a=new Proxy(s,{get(s,r){if(p(o),r===n)return()=>{!function(e){m&&m.unregister(e)}(a),f(e),t.clear(),o=!0};if("then"===r){if(0===i.length)return{then:()=>a};const s=R(e,t,{type:"GET",path:i.map((e=>e.toString()))}).then(T);return s.then.bind(s)}return w(e,t,[...i,r])},set(s,r,n){p(o);const[a,h]=b(n);return R(e,t,{type:"SET",path:[...i,r].map((e=>e.toString())),value:a},h).then(T)},apply(s,n,a){p(o);const h=i[i.length-1];if(h===r)return R(e,t,{type:"ENDPOINT"}).then(T);if("bind"===h)return w(e,t,i.slice(0,-1));const[l,c]=v(a);return R(e,t,{type:"APPLY",path:i.map((e=>e.toString())),argumentList:l},c).then(T)},construct(s,r){p(o);const[n,a]=v(r);return R(e,t,{type:"CONSTRUCT",path:i.map((e=>e.toString())),argumentList:n},a).then(T)}});return function(e,t){const i=(g.get(t)||0)+1;g.set(t,i),m&&m.register(e,t,e)}(a,e),a}function v(e){const t=e.map(b);return[t.map((e=>e[0])),(i=t.map((e=>e[1])),Array.prototype.concat.apply([],i))];var i}const y=new WeakMap;function b(e){for(const[t,i]of l)if(i.canHandle(e)){const[s,r]=i.serialize(e);return[{type:"HANDLER",name:t,value:s},r]}return[{type:"RAW",value:e},y.get(e)||[]]}function T(e){switch(e.type){case"HANDLER":return l.get(e.name).deserialize(e.value);case"RAW":return e.value}}function R(e,t,i,s){return new Promise((r=>{const n=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.set(n,r),e.start&&e.start(),e.postMessage(Object.assign({id:n},i),s)}))}class ${constructor(e){i(this,"queue",[]),i(this,"activeRequests",new Map),i(this,"isProcessing",!1),i(this,"renderCallbacks",new Map),i(this,"errorCallbacks",new Map),i(this,"maxConcurrentRequests",1),i(this,"activeRequestCount",0),this.renderChannel=e}setCallbacks(e,t,i){this.renderCallbacks.set(e,t),this.errorCallbacks.set(e,i)}enqueue(e,t){const i=Date.now();for(const s of t){if(this.activeRequests.has(s.id))continue;const t=this.queue.findIndex((e=>e.request.id===s.id));-1===t?this.queue.push({request:s,sessionId:e,priority:this.calculatePriority(s),timestamp:i,cancelled:!1}):this.queue[t].priority=this.calculatePriority(s)}this.sortQueue(),this.isProcessing||this.startProcessing()}cancel(e,t){const i=new Set(t);for(const t of this.queue)t.sessionId===e&&i.has(t.request.id)&&(t.cancelled=!0);for(const[t,s]of this.activeRequests)s.sessionId===e&&i.has(t)&&(s.cancelled=!0)}cancelSession(e){for(const t of this.queue)t.sessionId===e&&(t.cancelled=!0);for(const t of this.activeRequests.values())t.sessionId===e&&(t.cancelled=!0)}async startProcessing(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0||this.activeRequestCount>0;){for(;this.activeRequestCount<this.maxConcurrentRequests&&this.queue.length>0;){const e=this.getNextRequest();if(!e)break;this.activeRequestCount++,this.processRequest(e).finally((()=>{this.activeRequestCount--}))}await new Promise((e=>setTimeout(e,0)))}this.isProcessing=!1}}getNextRequest(){for(;this.queue.length>0;){const e=this.queue.shift();if(!e)break;if(!e.cancelled)return this.activeRequests.set(e.request.id,e),e}return null}async processRequest(e){const{request:t,sessionId:i}=e;try{if(e.cancelled)return;"undefined"!=typeof performance&&performance.mark&&performance.mark(`tile-render-start-${t.id}`);const s=await this.renderTile(t);if("undefined"!=typeof performance&&performance.mark&&(performance.mark(`tile-render-ready-${t.id}`),performance.measure))try{performance.measure(`tile-wasm-render-${t.id}`,`tile-render-start-${t.id}`,`tile-render-ready-${t.id}`)}catch(e){}if(e.cancelled)return;const r=this.renderCallbacks.get(i);r&&r(i,t.id,s)}catch(s){if(console.error("[SharedRenderQueue] Error processing request:",s),!e.cancelled){const e=this.errorCallbacks.get(i);e&&e(i,t.id,s)}}finally{this.activeRequests.delete(t.id)}}async renderTile(e){const{sourceInfo:t,options:i}=e,s={render_annotations:i.renderAnnotations??!0,print_rendering:i.renderForPrinting??!1,page:t.pageIndex,bitmap_width:t.tileRect.width,bitmap_height:t.tileRect.height,bitmap_x:t.tileRect.left,bitmap_y:t.tileRect.top,page_width:t.pageSize.width,page_height:t.pageSize.height,format:i.format||"bitmap",render_text:i.renderText??!0},r=await this.renderChannel.render(s);return{buffer:r,format:i.format||"bitmap",width:r.width,height:r.height}}calculatePriority(e){let t=0;"high"===e.options.priority&&(t-=1e3),e.targetInfo.isVisible&&(t-=500),t-=10*e.viewportRenderUpdateId;return t+=100*Math.abs(e.targetInfo.scale-e.targetInfo.targetScale),t}sortQueue(){this.queue.sort(((e,t)=>e.priority-t.priority))}}const x=function e(t){let i;return i=t instanceof Error?t:new Error(t),Object.setPrototypeOf(i,e.prototype),i};x.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const C=x;["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",\'[tabindex]:not([tabindex^="-"])\'].join(",");new WeakMap;const M=!1;function S(){M}function I(e,t){if(null===t)return!0;const i=e===t;return i||S("skipping render of outdated viewportUpdateId",e,"latest is",t),i}function E(e,t){return e.left<t.width&&e.left+e.width>0&&e.top<t.height&&e.top+e.height>0}class z{constructor(e,t,s,r,n,o,a){i(this,"viewport",null),i(this,"mipLevels",[]),i(this,"pendingTiles",new Map),i(this,"totalTilesForCurrentRender",0),i(this,"completedTilesForCurrentRender",0),i(this,"latestViewportUpdateId",0),i(this,"showTileBorders",M),i(this,"drawCallCounter",0),i(this,"scrollEventCounter",0),this.canvas=e,this.sessionId=t,this.sharedQueue=s,this.TILE_SIZE=n;const h=e.getContext("2d");!function(e,t){if(!e)throw new C(`Assertion failed: ${t||"Condition not met"}\\n\\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}(h,"OffscreenCanvasRenderingContext2D not available"),this.ctx=h,this.pageIndex=o,this.pageSize=a,this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high",this.tileCache=r,s.setCallbacks(t,this.handleTileReady.bind(this),this.handleTileError.bind(this))}updateViewport(e){const t=this.viewport;if(this.viewport=e,this.latestViewportUpdateId++,this.cancelStaleRequests(this.latestViewportUpdateId),t?.devicePixelRatio!==e.devicePixelRatio&&(this.mipLevels=function(e,t){const i=e*t,s=[];s.push(.5),s.push(1);let r=2;for(;r<=i;)s.push(r),r*=2;return!s.includes(i)&&i>s[s.length-1]&&s.push(i),s}(e.maxZoomLevel,e.devicePixelRatio)),t){const i=t.zoomLevel!==e.zoomLevel,s=t.viewportWidth!==e.viewportWidth||t.viewportHeight!==e.viewportHeight,r=t.scrollX!==e.scrollX||t.scrollY!==e.scrollY;this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),i||s?this.handleResize(this.latestViewportUpdateId):r&&this.handleScroll(e.scrollX-t.scrollX,e.scrollY-t.scrollY,this.latestViewportUpdateId)}else this.handleResize(this.latestViewportUpdateId)}cancelStaleRequests(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(0===this.pendingTiles.size)return;const i=[];for(const[s,r]of this.pendingTiles){e-r.latestNeededViewportId>t&&i.push(s)}if(i.length>0){this.sharedQueue.cancel(this.sessionId,i);for(const e of i)this.pendingTiles.delete(e);S(`Cancelled ${i.length} stale requests (age > ${t})`)}}handleScroll(e,t,i){this.viewport&&(this.scrollEventCounter++,S(`SCROLL #${this.scrollEventCounter}: delta(${e.toFixed(1)}, ${t.toFixed(1)}) scroll:(${this.viewport.scrollX.toFixed(1)}, ${this.viewport.scrollY.toFixed(1)}) canvas:${this.canvas.width}x${this.canvas.height}`),this.drawOptimized(i))}handleResize(e){if(!this.viewport)return;const t=(e,t)=>Math.round(e*Math.pow(10,t))/Math.pow(10,t),{viewportWidth:i,viewportHeight:s,zoomLevel:r,devicePixelRatio:n}=this.viewport,o=Math.ceil(i*r*n),a=Math.ceil(s*r*n);this.canvas.width===o&&this.canvas.height===a||(this.canvas.width=t(o,4),this.canvas.height=t(a,4)),this.drawOptimized(e)}drawOptimized(e){const t=this.calculateVisibleTiles(),i=new Set;this.drawCallCounter=0,S("-- drawOptimized --"),S("--- paintCachedTiles() ---"),this.paintCachedTiles(t,i,e),S("--- renderExposedAreas() ---"),this.renderExposedAreas(t,i,e),S(`--- draw complete: ${this.drawCallCounter} tiles drawn ---`)}paintCachedTiles(e,t,i){if(this.viewport)for(const s of e){const e=`${s.col},${s.row},${s.mip}`;if(t.has(e))continue;if(!E(this.getTileCanvasRect(s),this.canvas))continue;let r=this.tileCache.get(this.pageIndex,s.mip,s.col,s.row,0,s.tileSize);if(r)this.drawCachedTile(r,s,i),t.add(e);else{const e=s.rect;let n=!1;for(const o of this.mipLevels){if(o===s.mip)continue;const a=this.TILE_SIZE/o,h=Math.floor(e.left/a),l=Math.ceil((e.left+e.width)/a),c=Math.floor(e.top/a),d=Math.ceil((e.top+e.height)/a);for(let e=c;e<d;e++)for(let c=h;c<l;c++)if(r=this.tileCache.get(this.pageIndex,o,c,e,0,Math.round(a)),r){const h=`${c},${e},${o}`;if(!t.has(h)){E(this.getFallbackTileCanvasRect(c,e,a),this.canvas)&&(this.drawCachedTileWithClipping(r,c,e,o,a,s,i),t.add(h),n=!0)}}if(n)break}}}}renderExposedAreas(e,t,i){if(!this.viewport)return;const s=e.filter((e=>{const i=`${e.col},${e.row},${e.mip}`;if(t.has(i))return!1;return E(this.getTileCanvasRect(e),this.canvas)}));s.length>0&&this.requestTiles(s,i)}calculateVisibleTiles(){if(!this.viewport)return[];const{scrollX:e,scrollY:t,zoomLevel:i,viewportWidth:s,viewportHeight:r,devicePixelRatio:n}=this.viewport,o=function(e,t){for(const i of t)if(i>=e)return i;return t[t.length-1]||e}(i*n,this.mipLevels),a=this.TILE_SIZE/o,h=Math.min(.25*Math.min(s,r),a),l=Math.max(0,e-h),c=Math.max(0,t-h),d=Math.min(e+s+h,this.pageSize.width),u=Math.min(t+r+h,this.pageSize.height),p=Math.floor(l/a),f=Math.ceil(d/a),g=Math.floor(c/a),m=Math.ceil(u/a);S(`Tile grid: ${f-p}x${m-g} = ${(f-p)*(m-g)} tiles (gutter: ${h.toFixed(1)} page units)`);const w=[];for(let e=g;e<m;e++)for(let t=p;t<f;t++){const i=t*a,s=e*a;w.push({col:t,row:e,rect:{left:i,top:s,width:Math.min(a,this.pageSize.width-i),height:Math.min(a,this.pageSize.height-s)},mip:o,tileSize:Math.round(a)})}return w}drawImageBitmap(e,t,i,s,r,n){I(n,this.latestViewportUpdateId)&&(this.drawCallCounter++,this.ctx.drawImage(e,t,i,s,r))}getTileCanvasRect(e){if(!this.viewport)return{left:0,top:0,width:0,height:0};const{scrollX:t,scrollY:i,zoomLevel:s,devicePixelRatio:r}=this.viewport;return{left:(e.rect.left-t)*s*r,top:(e.rect.top-i)*s*r,width:e.rect.width*s*r,height:e.rect.height*s*r}}getFallbackTileCanvasRect(e,t,i){if(!this.viewport)return{left:0,top:0,width:0,height:0};const{scrollX:s,scrollY:r,zoomLevel:n,devicePixelRatio:o}=this.viewport;return{left:(e*i-s)*n*o,top:(t*i-r)*n*o,width:i*n*o,height:i*n*o}}requestTiles(e,t){if(!this.viewport)return;const i=[];for(const s of e){const e=this.generateTileCacheKey(this.pageIndex,s.mip,s.col,s.row,0,s.tileSize);if(this.pendingTiles.has(e)){const i=this.pendingTiles.get(e);i&&(i.latestNeededViewportId=Math.max(i.latestNeededViewportId,t));continue}const r=this.getTileCanvasRect(s),n=r.left<this.canvas.width&&r.left+r.width>0&&r.top<this.canvas.height&&r.top+r.height>0;this.pendingTiles.set(e,{tile:s,latestNeededViewportId:t}),i.push({id:e,viewportRenderUpdateId:t,sourceInfo:{pageIndex:this.pageIndex,pageSize:{width:Math.ceil(this.pageSize.width*s.mip),height:Math.ceil(this.pageSize.height*s.mip)},tileRect:{left:Math.floor(s.rect.left*s.mip),top:Math.floor(s.rect.top*s.mip),width:Math.ceil(s.rect.width*s.mip),height:Math.ceil(s.rect.height*s.mip)}},targetInfo:{scale:s.mip,targetScale:this.viewport.zoomLevel*this.viewport.devicePixelRatio,isVisible:!0,canvasRect:r},options:{renderAnnotations:!0,renderText:!0,format:"bitmap",priority:n?"high":"normal"}})}i.length>0?(this.totalTilesForCurrentRender=this.pendingTiles.size,this.completedTilesForCurrentRender=0,S(`REQUESTING ${i.length} new tiles from backend`),this.sharedQueue.enqueue(this.sessionId,i)):S("No new tiles to request - all visible tiles are cached")}generateTileCacheKey(e,t,i,s,r,n){return`${e}_${t}_${i}_${s}_${r}_${n}`}drawCachedTileWithClipping(e,t,i,s,r,n,o){if(!this.viewport)return;const{scrollX:a,scrollY:h,zoomLevel:l,devicePixelRatio:c}=this.viewport,d=(t*r-a)*l*c,u=(i*r-h)*l*c,p=l*c/s,f=e.width*p,g=e.height*p,m={left:d,top:u,width:f,height:g};E(m,this.canvas)?(S(`DRAW: clipped cached tile[${t},${i}] size:(${Math.round(e.width||-1)}x${Math.round(e.height||-1)}) at canvasPos:(${Math.round(d)},${Math.round(u)}) canvasRect:${JSON.stringify(m)} mip:${s}`),this.drawImageBitmap(e.imageData,d,u,f,g,o),this.showTileBorders&&this.drawTileBorder(n,m,o,"#00f")):S(`SKIP DRAW: cached tile[${t},${i}] at canvasPos:(${Math.round(d)},${Math.round(u)})`)}drawCachedTile(e,t,i){if(!this.viewport)return;const s=this.getTileCanvasRect(t),r=E(s,this.canvas);r?(S(`Draw #${this.drawCallCounter}: tile[${t.col},${t.row}] mip:${t.mip.toFixed(1)} visible:${r} canvasPos:(${Math.round(s.left)},${Math.round(s.top)}) size:${Math.round(s.width)}x${Math.round(s.height)}`),this.drawImageBitmap(e.imageData,s.left,s.top,s.width,s.height,i),this.showTileBorders&&this.drawTileBorder(t,s,i)):S(`SKIP DRAW: invisible tile[${t.col},${t.row}] at canvasPos:(${Math.round(s.left)},${Math.round(s.top)})`)}handleTileReady(e,t,i){if(e!==this.sessionId)return;const s=this.pendingTiles.get(t);if(!s||!this.viewport)return;const{tile:r,latestNeededViewportId:n}=s;this.pendingTiles.delete(t),this.tileCache.put(this.pageIndex,r.mip,r.col,r.row,i.buffer,i.format,0,r.tileSize,i.width,i.height),this.drawTile(i,r,n),this.completedTilesForCurrentRender++}drawTile(e,t,i){if(!this.viewport)return;if(!I(i,this.latestViewportUpdateId))return;const s=this.getTileCanvasRect(t),r=E(s,this.canvas);this.drawCallCounter++,S(`NEW TILE: tile[${t.col},${t.row}] mip:${t.mip.toFixed(1)} visible:${r} canvasPos:(${Math.round(s.left)},${Math.round(s.top)}) size:${Math.round(s.width)}x${Math.round(s.height)}`),"bitmap"===e.format&&(this.ctx.drawImage(e.buffer,s.left,s.top,s.width,s.height),this.showTileBorders&&this.drawTileBorder(t,s,i))}drawTileBorder(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#0f0";this.ctx.save(),this.ctx.strokeStyle=s,this.ctx.lineWidth=2,this.ctx.setLineDash([5,5]),this.ctx.strokeRect(t.left,t.top,t.width,t.height),this.ctx.fillStyle="rgba(0, 0, 0, 0.8)",this.ctx.fillRect(t.left,t.top,280,75),this.ctx.fillStyle=s,this.ctx.font="bold 15px monospace",this.ctx.fillText(`Tile ${i}: ${e.col},${e.row}`,t.left+5,t.top+15),this.ctx.fillText(`MIP: ${e.mip.toFixed(1)}`,t.left+5,t.top+30),this.ctx.fillText(`Canvas: ${Math.round(t.width)}×${Math.round(t.height)}px`,t.left+5,t.top+45);const r=Math.ceil(e.rect.width*e.mip),n=Math.ceil(e.rect.height*e.mip);this.ctx.fillText(`Bitmap: ${r}×${n}px`,t.left+5,t.top+60),this.ctx.restore()}handleTileError(e,t,i){e===this.sessionId&&(this.pendingTiles.delete(t),console.warn("Tile render failed:",t,i))}dispose(){this.sharedQueue.cancelSession(this.sessionId),this.pendingTiles.clear(),this.tileCache.clear()}}class P{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256;i(this,"cache",new Map),i(this,"hotQueue",new Set),i(this,"coldQueue",new Set),i(this,"pinnedTiles",new Set),i(this,"currentBytes",0),i(this,"hits",0),i(this,"misses",0),this.maxBytes=1024*e*1024}generateKey(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=arguments.length>5?arguments[5]:void 0;const o=Math.floor(i),a=Math.floor(s),h=Math.round(1e3*t)/1e3,l=Math.round(n);return 0!==r?`${e}/mip${h}/x${o}y${a}/rot${r}/ts${l}`:`${e}/mip${h}/x${o}y${a}/ts${l}`}get(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=arguments.length>5?arguments[5]:void 0;const o=this.generateKey(e,t,i,s,r,n),a=this.cache.get(o);return a?(this.hits++,a.lastAccessTime=Date.now(),a.accessCount++,this.coldQueue.has(o)&&a.accessCount>2&&(this.coldQueue.delete(o),this.hotQueue.add(o)),a):(this.misses++,null)}getCachedMipsForTile(e,t,i){let s=arguments.length>4?arguments[4]:void 0;const r=[];return this.cache.forEach((n=>{n.pageIndex===e&&n.tileX===t&&n.tileY===i&&Math.abs(n.tileSize-s)<1&&r.push(n.mip)})),r.sort(((e,t)=>e-t))}put(e,t,i,s,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"bitmap",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,a=arguments.length>7?arguments[7]:void 0,h=arguments.length>8?arguments[8]:void 0,l=arguments.length>9?arguments[9]:void 0;const c=this.generateKey(e,t,i,s,o,a),d=this.calculateTileMemorySize(h,l,n);this.ensureMemoryBudget(d);const u={key:c,pageIndex:e,mip:t,tileX:i,tileY:s,tileSize:a,imageData:r,format:n,width:h,height:l,byteSize:d,lastAccessTime:Date.now(),createdTime:Date.now(),accessCount:1,isPinned:!1},p=this.cache.get(c);p&&(this.currentBytes-=p.byteSize,this.hotQueue.delete(c),this.coldQueue.delete(c)),this.cache.set(c,u),this.hotQueue.add(c),this.currentBytes+=d}pin(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=arguments.length>5?arguments[5]:void 0;const o=this.generateKey(e,t,i,s,r,n),a=this.cache.get(o);a&&(this.pinnedTiles.add(o),a.isPinned=!0)}clearPage(e){const t=[];this.cache.forEach(((i,s)=>{i.pageIndex!==e||i.isPinned||t.push(s)})),t.forEach((e=>{this.removeTile(e)}))}clear(){const e=[];this.cache.forEach(((t,i)=>{t.isPinned||e.push(i)})),e.forEach((e=>{this.removeTile(e)}))}getStats(){const e=this.hits+this.misses>0?this.hits/(this.hits+this.misses):0;return{totalTiles:this.cache.size,totalBytes:this.currentBytes,hotTiles:this.hotQueue.size,coldTiles:this.coldQueue.size,pinnedTiles:this.pinnedTiles.size,hitRate:e}}ensureMemoryBudget(e){if(this.currentBytes+e<=this.maxBytes)return;const t=this.currentBytes+e-this.maxBytes;let i=0;const s=Date.now(),r=Array.from(this.hotQueue);for(const e of r){const t=this.cache.get(e);t&&!t.isPinned&&s-t.lastAccessTime>5e3&&(this.hotQueue.delete(e),this.coldQueue.add(e))}const n=Array.from(this.coldQueue).map((e=>({key:e,tile:this.cache.get(e)}))).filter((e=>e.tile&&!e.tile.isPinned)).sort(((e,t)=>(e.tile?.lastAccessTime??0)-(t.tile?.lastAccessTime??0)));for(const{key:e,tile:s}of n){if(i>=t||!s)break;i+=s.byteSize,this.removeTile(e)}if(i<t){const e=Array.from(this.hotQueue).map((e=>({key:e,tile:this.cache.get(e)}))).filter((e=>e.tile&&!e.tile.isPinned)).sort(((e,t)=>(e.tile?.lastAccessTime??0)-(t.tile?.lastAccessTime??0)));for(const{key:s,tile:r}of e){if(i>=t||!r)break;i+=r.byteSize,this.removeTile(s)}}}removeTile(e){const t=this.cache.get(e);t&&(t.imageData.close(),this.cache.delete(e),this.hotQueue.delete(e),this.coldQueue.delete(e),this.pinnedTiles.delete(e),this.currentBytes-=t.byteSize)}calculateTileMemorySize(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"bitmap";if("bitmap"===i)return e*t*4;const s=e*t;return"jpeg"===i?Math.ceil(4*s*.15):Math.ceil(4*s*.4)}}c(new class{constructor(){i(this,"offscreenRendererMap",new Map),i(this,"canvasSessionIdCounter",0),i(this,"sharedRenderQueue",null),i(this,"tileCache",new P(256)),i(this,"renderChannel",null)}async setupRenderMessageChannel(e){this.renderChannel=u(e)}async releaseRenderer(e){const t=this.offscreenRendererMap.get(e);t&&(t.dispose(),this.offscreenRendererMap.delete(e))}async beginRenderer(e,t,i,s){!function(e,t){if(!e)throw new C(`Assertion failed: ${t||"Condition not met"}\\n\\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}(this.renderChannel,"Setup render channel first"),this.sharedRenderQueue||(this.sharedRenderQueue=new $(this.renderChannel));const r=`page-${t}-${this.canvasSessionIdCounter++}`,n=new z(e,r,this.sharedRenderQueue,this.tileCache,i,t,s);return this.offscreenRendererMap.set(r,n),r}async updateViewport(e,t){const i=this.offscreenRendererMap.get(e);i?i.updateViewport(t):console.warn(`No renderer found for session ${e}`)}async endRenderer(e){const t=this.offscreenRendererMap.get(e);t?(t.dispose(),this.offscreenRendererMap.delete(e)):console.warn(`No renderer found for session ${e}`)}})})();',"Worker",void 0,void 0)}},55512:e=>{e.exports=function(e,t,i,s){var r=self||window;try{try{var n;try{n=new r.Blob([e])}catch(t){(n=new(r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder)).append(e),n=n.getBlob()}var a=r.URL||r.webkitURL,o=a.createObjectURL(n),h=new r[t](o,i);return a.revokeObjectURL(o),h}catch(s){return new r[t]("data:application/javascript,".concat(encodeURIComponent(e)),i)}}catch(e){if(!s)throw Error("Inline worker is not supported");return new r[t](s,i)}}}}]);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Nutrient Web SDK 1.8.0-a34512c (https://www.nutrient.io/sdk/web)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2016-2025 PSPDFKit GmbH. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
7
|
-
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
|
|
8
|
-
* UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
|
|
9
|
-
* This notice may not be removed from this file.
|
|
10
|
-
*
|
|
11
|
-
* PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/
|
|
12
|
-
*/
|
|
13
|
-
"use strict";(globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[]).push([[362],{63993:(e,t,s)=>{s.r(t),s.d(t,{corePool:()=>l.mG,customFontsPromiseRef:()=>_,default:()=>b,loadModule:()=>D,normalizeCoreOptions:()=>l.DO,validateStandaloneConfiguration:()=>l.mn});var n=s(49568),a=s(85409),i=s(96099),o=s(41204),r=s(85410),l=s(20873),u=s(37506),c=s(85553),d=s(89055),m=s(68322),h=s(13923),f=s(84318),p=s(33075);async function g(e,t){const s=await fetch(e,{credentials:"same-origin"}).finally((()=>{t?.()})),n=await s.arrayBuffer();return{isFullyAvailable:!0,fullDocument:n,contentType:s.headers?.get("Content-Type")||(0,p.oj)(n)}}async function y(e,t,s,n){if(e instanceof ArrayBuffer)return{isFullyAvailable:!0,fullDocument:e,contentType:(0,p.oj)(e)};(0,a.V1)("string"==typeof e,"Document is not a string");let o=!1;const{linearizedDocument:r,serverSupportsRangeRequests:l}=await(async()=>{if(s&&function(e){if(e.startsWith("/"))return!0;try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch(e){return!1}}(e)){const s=await t.openLinearizedDocument(i.EA);return(0,a.V1)(s,"Linearized document is not available"),{linearizedDocument:s,serverSupportsRangeRequests:await s.initialize(e)}}return{linearizedDocument:null,serverSupportsRangeRequests:!1}})();try{if(!l)return o=!0,g(e,n);(0,a.V1)(r,"Linearized document is not available"),r.startDownload();if(!await r.waitUntilIsLinearizedIsKnown())return r.destroy(),o=!0,g(e,n);n?.();const t=await r.waitUntilDocumentInfoAvailable();return t?(n?.(),{isFullyAvailable:!1,documentResponse:t,contentType:"application/pdf"}):(r.destroy(),o=!0,g(e,n))}catch(t){if(r?.destroy(),o)throw t;return g(e,n)}}let w;class b extends l.Ay{constructor(e){const t=e.baseUrl||(0,r.$_)(window.document),s=e.baseCoreUrl||t,n=e.baseProcessorEngineUrl||t,i={...e,baseUrl:t,baseCoreUrl:s,baseProcessorEngineUrl:n};if("string"!=typeof i.baseUrl)throw new a.uE("`baseUrl` is mandatory and must be a valid URL, e.g. `https://example.com/`");if("string"!=typeof i.document&&!(i.document instanceof ArrayBuffer))throw new a.uE("document must be either an URL to a supported document type (PDF and images), e.g. `https://example.com/document.pdf`, or an `ArrayBuffer`");if(w&&w!==i.licenseKey)throw new a.uE("Trying to re-use instance with a different licenseKey.\nUnfortunately we only allow one licenseKey per instance.\nPlease contact support for further assistance.");if("string"==typeof i.licenseKey&&i.licenseKey.startsWith("TRIAL-"))throw new a.uE("You're using the npm key instead of the license key. This key is used to download the Nutrient Web SDK package via the node package manager.\n\nLeave out the license key to activate as a trial.");super(i),this.destroyed=!1,this.activeConfiguration=e}async load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=.2;e.progressCallback&&e.progressCallback("loading",t),this._isPDFJavaScriptEnabled=e.isPDFJavaScriptEnabled,"string"==typeof this._state.document&&(0,p.XC)(this._state.baseUrl,this._state.document,this._state.productId);const s=await D(this.client,this._state).finally((()=>{t+=.3,e.progressCallback&&e.progressCallback("loading",t)})),i=y(this._state.document,this.corePDFDocument,this._state.allowLinearizedLoading,(()=>{t+=.3,e.progressCallback&&e.progressCallback("loading",t)}));(0,a.V1)(s);const{features:r,signatureFeatureAvailability:l,capabilities:u}=s;if(this._state.productId===m.v.SharePoint&&"string"==typeof this._state.document&&Array.isArray(s.afu)){const e=new URL(this._state.document,this._state.baseUrl);if(!s.afu.some((t=>e.hostname.match(t))))throw new a.uE(`The document origin ${e.hostname} is not authorized.`)}const f=l===c.g.ELECTRONIC_SIGNATURES&&(0,d.UX)(r)&&this._state.forceLegacySignaturesFeature?c.g.LEGACY_SIGNATURES:l;this._state=this._state.set("features",(0,n.B8)(r)).set("signatureFeatureAvailability",f),w=this._state.licenseKey;const g=await i;let b=null;if(g.isFullyAvailable){let t=g.fullDocument.slice(0),s=null;if((0,p.C5)(g.contentType)||!u.includes("GdPictureWASM"))try{this.destroyed?(t=null,b=await new Promise((()=>{}))):(b=await this.client.openDocument(g.fullDocument,{password:e.password,initialPageIndex:"number"==typeof e.initialPageIndex?e.initialPageIndex:0,formsConfiguration:this._formsConfiguration}),t=null)}catch(e){"INVALID_PASSWORD"===e.message&&this._state.document instanceof ArrayBuffer?this._state=this._state.set("document",e.callArgs[0]):"IMAGE_DOCUMENTS_NOT_LICENSED"===e.message?e.message="The image documents feature is not enabled for your license key. Please contact support or sales to purchase the UI module for your product.":u.includes("GdPictureWASM")||(e.message="File not in PDF format or corrupted."),s=e}if(u.includes("GdPictureWASM")&&(s instanceof a.uE&&s.message.includes("File not in PDF format or corrupted.")||!(0,p.C5)(g.contentType))){(0,a.V1)(t);let n,i=(0,h.jU)();try{i||(i=(0,h.NY)({baseUrl:this._state.baseProcessorEngineUrl,mainThreadOrigin:this._state.appName||(0,o.D5)()||window.location.origin,licenseKey:this._state.licenseKey||void 0,customFonts:this._state.customFonts||void 0,dynamicFonts:this._state.dynamicFonts||void 0,fontSubstitutions:this._state.fontSubstitutions,processorEngine:this._state.processorEngine}),(0,h.Pm)(i)),n=await i,(0,a.V1)(n);const s=await n.toPdf(t,null,e.officeConversionSettings);b=await this.client.openDocument(s,{password:e.password,initialPageIndex:"number"==typeof e.initialPageIndex?e.initialPageIndex:0,formsConfiguration:this._formsConfiguration})}catch(e){throw"INVALID_PASSWORD"===e.message&&this._state.document instanceof ArrayBuffer&&(this._state=this._state.set("document",s.callArgs[0])),"IMAGE_DOCUMENTS_NOT_LICENSED"===e.message&&(e.message="The image documents feature is not enabled for your license key. Please contact support or sales to purchase the UI module for your product."),e}finally{t=null,n?.destroy(),(0,h.Pm)(null)}}else if(s)throw s;(0,a.V1)(b),await this.afterDocumentLoaded(b)}else b=g.documentResponse;return this._state=this._state.set("documentResponse",b),{features:this._state.features,signatureFeatureAvailability:this._state.signatureFeatureAvailability,hasPassword:!!e.password,password:e.password,allowedTileScales:"all",evaluation:s.evaluation,linearizedLoading:!g.isFullyAvailable,documentResponse:b}}destroy(){this.destroyed=!0,super.destroy()}getCustomFontsPromise(){return _}async afterDocumentLoaded(e){if(this._isPDFJavaScriptEnabled&&(this._initialChanges=await this.client.enablePDFJavaScriptSupport()),this._XFDF&&await this.client.importXFDF(this._XFDF.source,this._XFDF.keepCurrentAnnotations,this._XFDF.ignorePageRotation,this._XFDF.richTextEnabled),this._instantJSON&&this._instantJSON.pdfId&&e.ID.permanent){const t=this._instantJSON.pdfId,s=e.ID;if(t.permanent!==s.permanent)throw new a.uE("Could not instantiate from Instant JSON: Permanent PDF ID mismatch.\nPlease use the same PDF document that was used to create this Instant JSON.\nFor more information, please visit: https://www.nutrient.io/guides/web/importing-exporting/instant-json/");if(t.changing!==s.changing)throw new a.uE("Could not instantiate from Instant JSON: Changing PDF ID mismatch.\nPlease use the same revision of this PDF document that was used to create this Instant JSON.\nFor more information, please visit: https://www.nutrient.io/guides/web/importing-exporting/instant-json/")}if(this._trustedCAsCallback)try{const e=await this._trustedCAsCallback();if(!Array.isArray(e))throw new a.uE("Certificates response must be an array");if(e.some((e=>!(e instanceof ArrayBuffer)&&"string"!=typeof e)))throw new a.uE("All certificates must be passed as ArrayBuffer (DER) or string (PEM)");await this.client.loadCertificates(e.map(u.PI))}catch(e){throw new a.uE(`Could not retrieve certificates for digital signatures validation: ${e.message}.`)}}async waitUntilFullyLoaded(e){return this.corePDFDocument.linearizedDocument.waitUntilDownloaded().then((async()=>{await this.corePDFDocument.normallyOpenLinearizedDocument(this,{password:e,initialPageIndex:0,formsConfiguration:this._formsConfiguration}),await this.afterDocumentLoaded(this._state.documentResponse)}))}async getDocumentBytes(){if(this._state.document instanceof ArrayBuffer)return this._state.document;if("string"==typeof this._state.document){const e=await fetch(this._state.document);if(!e.ok)throw new a.uE(`Failed to fetch document: ${e.statusText}`);return e.arrayBuffer()}throw new a.uE("Document bytes are not available")}}const _={current:void 0};async function D(e,t){_.current=_.current||(t.customFonts?(0,f.eY)(t.customFonts):void 0);const s=(0,r.f)(t.appName);return e.loadNativeModule(t.baseCoreUrl,{mainThreadOrigin:s,disableWebAssemblyStreaming:t.disableWebAssemblyStreaming,enableAutomaticLinkExtraction:t.enableAutomaticLinkExtraction,overrideMemoryLimit:t.overrideMemoryLimit,workerSpawnerFn:()=>(0,i.pj)(t.inlineWorkers)}).then((async()=>e.load(t.baseCoreUrl,t.licenseKey,{mainThreadOrigin:s,..._.current?{customFonts:await _.current}:null,dynamicFonts:t.dynamicFonts,productId:t.productId,featureFlags:(()=>{const e=[];return t.enableCoreUnifiedComments&&e.push("UnifiedComments"),t.enableCorePreservePDFAccessibility&&e.push("PreservePDFAccessibility"),e.length>0?e:void 0})()})))}}}]);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Nutrient Web SDK 1.8.0-a34512c (https://www.nutrient.io/sdk/web)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2016-2025 PSPDFKit GmbH. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
7
|
-
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
|
|
8
|
-
* UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
|
|
9
|
-
* This notice may not be removed from this file.
|
|
10
|
-
*
|
|
11
|
-
* PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/
|
|
12
|
-
*/
|
|
13
|
-
"use strict";(globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[]).push([[42],{96419:(e,t,n)=>{n.d(t,{N:()=>y});var a=n(46103),i=n(59501),s=n(85409),o=n(49568),r=n(89574),c=n(32784),l=n(9939),d=n(97881);function u(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function m(e,t){return e.get(p(e,t))}function h(e,t,n){return e.set(p(e,t),n),n}function p(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var f=new WeakMap,g=new WeakMap;class y{constructor(e,t){u(this,f,void 0),u(this,g,null),this.pdfLibrary=new a.T7.Qz(e),h(f,this,this.pdfLibrary.openDocument(t))}get rawDocument(){return m(f,this)}get linearizedDocument(){return(0,s.V1)(m(g,this),"Document is not linearized."),m(g,this)}async openLinearizedDocument(e){return h(g,this,await this.pdfLibrary.openLinarizedDocument(e)),h(f,this,m(g,this).document),m(g,this)}async normallyOpenLinearizedDocument(e,t){(0,s.V1)(m(g,this),"Document is not linearized."),m(g,this).destroy(),h(g,this,null),await e.client.openCreateFilePathDocument(t)}destroy(){(0,i.nl)(this.rawDocument.ctx)}renderTile(e,t,n,i,s,o){let c;o&&(c={annotations:o.annotations.filter(r.mH).map(d.eq).toJS().map((e=>({content:e}))),formFieldValues:o.formFieldValues.map(d.cA).toJS(),formFields:o.formFields.map(d.T7).toJS(),signatures:o.signatures||[],attachments:o.attachments});const u=this.rawDocument.renderer.renderTile(e,t,n,{renderForPrinting:i,renderText:s,priority:t.width===n.width&&t.height===n.height?a.MX.bx.High:a.MX.bx.Normal},c).then((e=>(0,l.vB)({buffer:e.buffer.buffer,width:n.width,height:n.height,format:e.format}).then((e=>{if(null===e)throw new Error("Image handle is null");return e}))));return{promise:u.promise,cancel:u.cancel}}renderTileRaw(e,t,n,i,s,o,c){let l,u;o&&(l={annotations:o.annotations.filter(r.mH).map(d.eq).toJS().map((e=>({content:e}))),formFieldValues:o.formFieldValues.map(d.cA).toJS(),formFields:o.formFields.map(d.T7).toJS(),signatures:o.signatures||[],attachments:o.attachments}),u="high"===c?a.MX.bx.High:"normal"===c?a.MX.bx.Normal:t.width===n.width&&t.height===n.height?a.MX.bx.High:a.MX.bx.Normal;const m=this.rawDocument.renderer.renderTile(e,t,n,{renderForPrinting:i,renderText:s,priority:u},l);return{promise:m.promise.then((e=>({buffer:e.buffer.buffer,format:e.format}))),cancel:m.cancel}}getTextLines(e){return this.rawDocument.text.getTextLines(e).then((t=>(0,c.K0)({textLines:t},e)))}getContentTree(e){return this.rawDocument.text.getContentTree(e).then((t=>{let n=[],a=0,i=0;return n=t.reduce(((t,n)=>{let{nodes:s}=n;const o=(0,c.l1)(s,e,t.length,a,i);return a+=o.reduce(((e,t)=>{let{content:n}=t;return e+(0,c.Y_)(n).size}),0),i+=o.reduce(((e,t)=>{let{content:n}=t;return e+(0,c.M3)(n).size}),0),t.concat(o)}),[]),(0,o.B8)(n)}))}compareText(e){const t={data:e.originalDocument.arrayBuffer,password:e.originalDocument.password,pageIndexes:e.originalDocument.pageIndexes},n={data:e.changedDocument.arrayBuffer,password:e.changedDocument.password,pageIndexes:e.changedDocument.pageIndexes},i={numberOfContextWords:e.comparisonOperation.options?.numberOfContextWords,wordLevel:e.comparisonOperation.options?.wordLevel};return a.MX.fu.compareText(this.rawDocument.ctx,t,n,i).then((e=>e))}}},72262:(e,t,n)=>{n.d(t,{K:()=>d});var a=n(67136),i=n(49568),s=n(85409),o=n(76117),r=n(89574),c=n(28650),l=n(69371);class d{constructor(){(0,a.A)(this,"attachmentsCache",(0,i.T5)()),(0,a.A)(this,"cachedAPStreams",(0,i.T5)()),(0,a.A)(this,"pageAPStreamsPromises",(0,i.T5)()),(0,a.A)(this,"annotationAPStreamPromises",(0,i.T5)()),(0,a.A)(this,"_cachedRenderedAnnotations",(0,i.uY)()),(0,a.A)(this,"_objectURLs",{}),(0,a.A)(this,"_makeEnqueuedRelease",((e,t)=>{if("IMG"===e?.element?.tagName){const n=e.element.src;if(!n)return;"number"==typeof this._objectURLs[n]?this._objectURLs[n]++:this._objectURLs[n]=1;const a=e.release;e.release=()=>{this._objectURLs[n]--,this._objectURLs[n]<=0&&(a?.(),this._cachedRenderedAnnotations.has(t)&&(this._cachedRenderedAnnotations=this._cachedRenderedAnnotations.delete(t)),delete this._objectURLs[n])}}})),(0,a.A)(this,"_cacheableRenderedAnnotationSetExpire",(e=>{const t=this._cachedRenderedAnnotations.get(e);(0,s.V1)(t),t.timeout&&clearTimeout(t.timeout);const n=setTimeout((()=>{this._cachedRenderedAnnotations.has(e)&&(this._cachedRenderedAnnotations=this._cachedRenderedAnnotations.delete(e))}),3e4);this._cachedRenderedAnnotations=this._cachedRenderedAnnotations.update(e,(e=>({...e,timeout:n})))})),(0,a.A)(this,"_addCachedRenderedAnnotation",((e,t)=>{let{width:n,height:a,noZoom:i,APStreamPromise:s}=t;if(this._cachedRenderedAnnotations.size>1e3){const e=this._cachedRenderedAnnotations.keySeq().first();e&&(this._cachedRenderedAnnotations=this._cachedRenderedAnnotations.delete(e))}this._cachedRenderedAnnotations=this._cachedRenderedAnnotations.set(e,{width:n,height:a,noZoom:i,APStreamPromise:s}),this._cacheableRenderedAnnotationSetExpire(e)}))}getAnnotationFormFieldAndValue(e){const t=this.provider;(0,s.V1)(t instanceof t.constructor,"Backend can only use backend annotation provider");const n=e instanceof o.sb?t._readStateCallbacks?.getFormFieldByName(e.formFieldName):null;return{formField:n,formFieldValue:!n||n instanceof o.Vw?null:new o.E2({name:n.name,value:void 0!==n.formattedValue?n.formattedValue:"string"==typeof n.value?n.value:n.values})}}getAnnotationAvailableVariants(e){const t=this.provider;(0,s.V1)(t instanceof t.constructor,"Backend can only use backend annotation provider");return[...t._readStateCallbacks?.getAvailableVariants(e)||[],"normal"]}cachedRenderAnnotation(e,t,n,a,i,o){const c=this.provider;(0,s.V1)(c instanceof c.constructor,"Backend can only use backend annotation provider");const{formField:l,formFieldValue:d}=this.getAnnotationFormFieldAndValue(e);if(!(0,r.lG)(e,l))return this.renderAnnotation(e,d,t,n,a,i,o);const u=this.getAnnotationAvailableVariants(e);let m=!1,h=()=>{m=!0};return{promise:new Promise((async(s,r)=>{const c=t=>{const n=this.annotationAPStreamPromises.get(e.id);n&&(this.annotationAPStreamPromises=this.annotationAPStreamPromises.delete(e.id),n(t))},l=this.annotationAPStreamPromises.get(e.id);this.annotationAPStreamPromises=this.annotationAPStreamPromises.set(e.id,s),l&&l(null);try{const r=this.pageAPStreamsPromises.get(e.pageIndex);if(!r){const t=new Promise((t=>{this.annotationAPStreamPromises=this.annotationAPStreamPromises.set(e.id,t)}));return void s(await t)}await r;const l=this.cachedAPStreams.get(e.pageIndex);if(l){const t=l?l.get(e.id):null;if(t)return void c(this.getAPStream(t,i))}const{promise:p,cancel:f}=this.renderAPStream(e,d,t,n,a,u,i,o);if(m)c(null);else if(h=f,u.length>1){const t=await Promise.all(p.map((e=>e.promise)));c(t[u.indexOf(i||"normal")]),t.some(Boolean)&&this.cacheAPStream(u.reduce(((e,n,a)=>t[a]?{...e,[n]:t[a]}:e),{}),e)}else{const t=await p,n=t?this.getAPStream(t,i):null;c(n),n&&this.cacheAPStream(t,e)}}catch(e){r(e)}})),cancel:h}}cacheAPStream(e,t){let n=this.cachedAPStreams.get(t.pageIndex);n||(this.cachedAPStreams=this.cachedAPStreams.set(t.pageIndex,(0,i.T5)()),n=this.cachedAPStreams.get(t.pageIndex)),this.cachedAPStreams=this.cachedAPStreams.setIn([t.pageIndex,t.id],e)}clearAllPageAPStreams(e){const t=this.cachedAPStreams.get(e);t&&(t.forEach((e=>{this.releaseAPStream(e)})),this.cachedAPStreams=this.cachedAPStreams.delete(e)),this.pageAPStreamsPromises=this.pageAPStreamsPromises.delete(e)}clearPageAPStreams(e,t){const n=this.cachedAPStreams.get(e);n&&(n.filter(((e,n)=>t.has(n))).forEach((e=>{this.releaseAPStream(e)})),this.cachedAPStreams=this.cachedAPStreams.updateIn([e],(0,l.C$)((e=>e.filter(((e,n)=>!t.has(n)))))))}getAPStream(e,t){return e instanceof c.A?e:e?.[t||"normal"]||null}renderAPStream(e,t,n,a,i,s,o,r){if(s.length>1){const o=s.map((s=>this.renderAnnotation(e,t,n,a,i,"normal"!==s?s:void 0,r)));return{promise:o,cancel:()=>{o.forEach((e=>{e.cancel()}))}}}return this.renderAnnotation(e,t,n,a,i,o,r)}releaseAPStream(e){e instanceof c.A?e.release():Object.values(e).forEach((e=>{e.release()}))}isVisuallyIdenticalAnnotationCached(e){let{annotation:t,providedVisualAnnotationIndex:n,width:a,height:i}=e;if(!(0,r.cu)(t))return!1;const o=n||(0,r.sS)(t);if(!this._cachedRenderedAnnotations.has(o))return!1;const c=this._cachedRenderedAnnotations.get(o);return(0,s.V1)(c),(0,r.Ab)({noZoom:c.noZoom&&t.noZoom,cachedRenderedAnnotationWidth:c.width,cachedRenderedAnnotationHeight:c.height,testAnnotationWidth:a,testAnnotationHeight:i})}cachedRenderedAnnotationDiscardablePromise(e,t){let{promise:n,resolve:a,reject:i}=t;const o=this._cachedRenderedAnnotations.get(e);return(0,s.V1)(o),o.APStreamPromise.then((t=>{let n;return t&&(n=new c.A(t.element.cloneNode(!0),t.release),this._makeEnqueuedRelease(n,e),this._cacheableRenderedAnnotationSetExpire(e)),a(n),n})).catch(i),{promise:n,cancel:()=>{}}}clearRenderedAnnotationsCache(){this._cachedRenderedAnnotations.forEach((e=>{let{APStreamPromise:t,timeout:n}=e;t.then((e=>{e?.release()})),n&&clearTimeout(n)})),this._cachedRenderedAnnotations=(0,i.T5)(),this._objectURLs={}}}},20873:(e,t,n)=>{n.d(t,{mG:()=>oe,Ay:()=>re,DO:()=>ce,mn:()=>le});var a=n(67136),i=n(96099),s=n(45646),o=n(85409),r=n(49568),c=n(80018),l=n(63097),d=n(37361),u=n(64337),m=n(20546),h=n(87374),p=n(68322),f=n(37094),g=n(95248),y=n(40927),b=n(76117),A=n(83145),S=n(83647),w=n(40527),_=n(70631),P=n(11587),F=n(44439),v=n(89574),k=n(25888),C=n(9939),D=n(15168),I=n(83720),R=n(14511),T=n(41204),V=n(77270),x=n(47159),O=n(13923),L=n(96419);class B{constructor(e,t){this.identifier=e,this.callback=t}request(){return this.callback()}}var E=n(41477),U=n(5293),N=n(97881),j=n(72262),z=n(7737),M=n(82987),q=n(78625),W=n(74111),$=n(78236);class J extends((0,r.mS)({alreadyLoadedPages:(0,r.T5)(),isLoaded:!1,isDestroyed:!1})){}const K={skippedPdfObjectIds:[],skippedPdfBookmarkIds:[],annotations:[],bookmarks:[],formFieldValues:[],formFields:[],attachments:{}};class G{constructor(e,t){(0,a.A)(this,"_state",new J),(0,a.A)(this,"_formFieldsLoadedPromise",null),(0,a.A)(this,"_objectCreationPromises",(0,r.T5)()),(0,a.A)(this,"_loadBookmarksPromise",null),(0,a.A)(this,"_commentsLoadedPromise",null),(0,a.A)(this,"canCreateBackendOrphanWidgets",!1),(0,a.A)(this,"updateTabOrderTimeout",null),(0,a.A)(this,"pagesTabOrderToUpdate",(0,r.NZ)()),this._core=e,this._json=t?(0,o.$y)(t):null,this._setReadStateCallbacksPromise=new Promise((e=>{this._setReadStateCallbacksPromiseResolve=e}))}async load(){if(this._state=this._state.set("isLoaded",!0),!this._formFieldCallbacks&&await this._loadFormFieldValues(),!this._json)return this;await this._core.importInstantJSON({...K,...this._json}),(0,o.V1)(this._json);const{annotations:e,attachments:t}=this._json;if(this._isDestroyed()||!t||0===Object.entries(t).length)return this;if(e)for(let n=0;n<e.length;n++){let a=null;const i=e[n];if("imageAttachmentId"in i&&i.imageAttachmentId){const e=t?t[i.imageAttachmentId]:null;if(e)try{a=(0,q.lj)(atob(e.binary),e.contentType),(0,o.V1)(this._annotationCallbacks),this._annotationCallbacks.createAttachment(i.imageAttachmentId,a)}catch(e){(0,o.pq)(`Skipped attachment with id ${i.imageAttachmentId} from payload because an error occurred while converting the binary image to blob.`),(0,o.pq)(e)}}}return this}destroy(){this._state=this._state.set("isDestroyed",!0),this._annotationCallbacks=null,this._readStateCallbacks=null,this._bookmarkCallbacks=null,this._formFieldCallbacks=null,this._formFieldValueCallbacks=null,this._commentCallbacks=null}setReadStateCallbacks(e){this._readStateCallbacks=e,this._setReadStateCallbacksPromiseResolve?.()}setAnnotationCallbacks(e){this._annotationCallbacks=e}setBookmarkCallbacks(e){this._bookmarkCallbacks=e}setFormFieldCallbacks(e){this._formFieldCallbacks=e}setFormFieldValueCallbacks(e){this._formFieldValueCallbacks=e}setCommentCallbacks(e){this._commentCallbacks=e}createComment(e,t,n){return this._core.applyComments(t.map((e=>X(e,n))).toArray())}updateComment(e,t,n){return this._core.applyComments(t.map((e=>X(e,n))).toArray())}deleteComment(e,t,n){return this._core.applyComments(t.map((e=>X(e,n))).toArray())}async loadComments(){return this._commentsLoadedPromise||(this._commentsLoadedPromise=this._loadComments()),this._commentsLoadedPromise}async _loadComments(){this._verifyLoaded();const e=await this._core.getComments()??[],t=(0,r.B8)(e.map((e=>{let t;return t=e.pdfObjectId?e.id||e.pdfObjectId?.toString():(0,v.K1)(),(0,N.XL)(t,e)})));await Promise.all(t.map((e=>"number"==typeof e.pageIndex&&this.loadAnnotationsForPageIndex(e.pageIndex))).filter(Boolean).toArray()),this._commentCallbacks?.createComments(t,$.n),this._commentsLoadedPromise=Promise.resolve()}async updateTabOrder(e){this.pagesTabOrderToUpdate=this.pagesTabOrderToUpdate.add(e),this.updateTabOrderTimeout&&clearTimeout(this.updateTabOrderTimeout),this.updateTabOrderTimeout=setTimeout((async()=>{const e=this.pagesTabOrderToUpdate.toArray();if(this.pagesTabOrderToUpdate=(0,r.NZ)(),this._isDestroyed())return;const t=await Promise.all(e.map((e=>this._core.getTabOrder(e))));this._isDestroyed()||((0,o.V1)(this._annotationCallbacks),(0,z.vA)((()=>{e.forEach(((e,n)=>{this._annotationCallbacks?.setPageTabOrder(e,t[n])}))})))}),1e3)}async setTabOrder(e,t){return this._core.setTabOrder(e,t)}async createAnnotation(e,t){this._verifyLoaded();const n=t.find(((t,n)=>((0,o.V1)("imageAttachmentId"in e,"Annotation must have imageAttachmentId."),n===e.imageAttachmentId))),a=await this._core.createAnnotation((0,N.eq)(e),n?n.data:null);"number"!=typeof a||"number"!=typeof e.pdfObjectId||e.pdfObjectId===a||this._isDestroyed()||((0,o.V1)(this._annotationCallbacks),this._annotationCallbacks.updateAnnotations((0,r.B8)([e.set("pdfObjectId",a)]))),await this.updateTabOrder(e.pageIndex)}async updateAnnotation(e){this._verifyLoaded(),await this._core.updateAnnotation((0,N.eq)(e)),await this.updateTabOrder(e.pageIndex)}deleteAnnotation(e){return this._verifyLoaded(),this._core.deleteAnnotation((0,N.eq)(e))}createBookmark(e){return this._verifyLoaded(),this._core.createBookmark((0,M.U)(e))}updateBookmark(e){return this._verifyLoaded(),this._core.updateBookmark((0,M.U)(e))}deleteBookmark(e){return this._verifyLoaded(),this._core.deleteBookmark(e)}createFormField(e){this._verifyLoaded(),(0,o.V1)(this._readStateCallbacks);const t=this._readStateCallbacks.getFormFieldWidgets(e);return this._core.createFormField((0,N.T7)(e),t.map((e=>(0,N.eq)(e))).toArray()).then((async e=>{(0,z.vA)((()=>{e.forEach(((e,n)=>{const a=t.get(n);(0,o.V1)(a),(0,o.V1)(this._annotationCallbacks),"number"!=typeof e||"number"!=typeof a.pdfObjectId||a.pdfObjectId===e||this._isDestroyed()||this._annotationCallbacks.updateAnnotations((0,r.B8)([a.set("pdfObjectId",e)]))}))}))}))}updateFormField(e){this._verifyLoaded(),(0,o.V1)(this._readStateCallbacks);const t=this._readStateCallbacks.getFormFieldWidgets(e);return this._core.updateFormField((0,N.T7)(e),t.map((e=>(0,N.eq)(e))).toArray())}deleteFormField(e){return this._verifyLoaded(),this._core.deleteFormField((0,N.T7)(e))}loadFormFields(){return this._formFieldsLoadedPromise||(this._formFieldsLoadedPromise=this._loadFormFields()),this._formFieldsLoadedPromise}async _loadFormFields(){this._verifyLoaded();const e=await this._core.readFormJSONObjects();if(this._isDestroyed())return;let t=(0,r.B8)(),n=(0,r.B8)().withMutations((n=>{e.forEach((e=>{const{formField:a,widgets:i,value:s}=e;try{let e;e=a.pdfObjectId?a.pdfObjectId.toString():(0,v.K1)();const r=(0,N.mh)(e,a);(0,o.V1)(this._readStateCallbacks),this._readStateCallbacks.isFormFieldInState(r.name)||n.push(r.set("value",s)),i.forEach((e=>{if(e.formFieldName!==r.name)return;let n;n=e.pdfObjectId?e.id||e.pdfObjectId.toString():(0,v.K1)(),(0,o.V1)(this._readStateCallbacks),t=t.push((0,N.h8)(n,e))}))}catch(e){(0,o.pq)(`Skipped creating form field #${a.pdfObjectId} from payload because an error occurred while deserializing.`),(0,o.pq)(e)}}))}));const a={},i={};t.forEach((e=>{i[e.id]||(i[e.id]=[]),i[e.id].push(e.pdfObjectId)})),t=t.map((e=>{if(i[e.id].filter((t=>t!==e.pdfObjectId)).length>0&&e.pdfObjectId?.toString()!==e.id||this._readStateCallbacks?.isAnnotationInState(e.id)){const t=(0,v.K1)();return a[e.formFieldName]?a[e.formFieldName].push({[e.id]:t}):a[e.formFieldName]=[{[e.id]:t}],n=n.map((n=>n.name===e.formFieldName?n.update("annotationIds",(n=>n?.map((n=>n===e.id?t:n)))):n)),e.set("id",t)}return e})),Object.keys(a).forEach((e=>{const a=n.find((t=>t.name===e));(0,o.V1)(a);const i=t.filter((t=>t.formFieldName===e)).toArray().map((e=>(0,N.eq)(e)));this._core.updateFormField((0,N.T7)(a),i)})),n.size>0&&!this._isDestroyed()&&((0,o.V1)(this._formFieldCallbacks),this._formFieldCallbacks.createFormFields(n,$.n)),await this._loadFormFieldValues(),t.size>0&&!this._isDestroyed()&&((0,o.V1)(this._annotationCallbacks),this._annotationCallbacks.createAnnotations(t,(0,r.T5)(),$.n)),this._formFieldsLoadedPromise=Promise.resolve()}createFormFieldValue(e){return this._verifyLoaded(),this.setFormFieldValue(e)}setFormFieldValue(e){return this._verifyLoaded(),this._core.setFormFieldValue((0,N.cA)(e))}deleteFormFieldValue(e){return this._verifyLoaded(),this._core.deleteFormFieldValue(e.replace("form-field-value/",""))}loadAnnotationsForPageIndex(e){const t=this._state.alreadyLoadedPages.get(e);if(t)return t;const n=this._loadAnnotationsForPageIndex(e);return this._state=this._state.setIn(["alreadyLoadedPages",e],n),n}async _loadAnnotationsForPageIndex(e){this._verifyLoaded();const[t,n]=await Promise.all([this._core.annotationsForPageIndex(e),this._core.getTabOrder(e)]);if(this._isDestroyed())return;const a=[],i=[],s=t.map((e=>{let{rollover:t,down:n,...s}=e;return t&&"number"==typeof s.pdfObjectId&&a.push(s.pdfObjectId),n&&"number"==typeof s.pdfObjectId&&i.push(s.pdfObjectId),s})).filter((e=>"number"==typeof e.pageIndex));this._formFieldCallbacks&&await this.loadFormFields();const c=(0,r.B8)().withMutations((e=>{s.filter((e=>!e.id||this._readStateCallbacks&&!this._readStateCallbacks.isAnnotationInState(e.id))).forEach((t=>{t.pdfObjectId;try{let n;n=function(e){return"pspdfkit/link"===e.type&&0===e.pdfObjectId}(t)?t.id||(0,v.K1)():t.id||t.pdfObjectId.toString(),(e.some((e=>e.id===n))||this._readStateCallbacks?.isAnnotationInState(n))&&(n=(0,v.K1)(),t.id=n,this._core.updateAnnotation(t));const a=(0,N.h8)(n,t);e.push(a)}catch(e){(0,o.pq)(`Skipped creating annotation #${t.pdfObjectId} from payload because an error occurred while deserializing.`),(0,o.pq)(e)}}))}));(0,z.vA)((()=>{(0,o.V1)(this._annotationCallbacks),c.size>0&&this._annotationCallbacks.createAnnotations(c,(0,r.T5)(),$.n),this._annotationCallbacks.setPageTabOrder(e,n),a.length>0&&this._annotationCallbacks.addAnnotationVariants("rollover",a),i.length>0&&this._annotationCallbacks.addAnnotationVariants("down",i)})),this._state=this._state.setIn(["alreadyLoadedPages",e],Promise.resolve())}async _loadFormFieldValues(){this._verifyLoaded();const e=await this._core.getFormValues();if(this._isDestroyed())return;const t=(0,r.B8)().withMutations((t=>{e.forEach((e=>{try{t.push((0,N.R5)(e))}catch(t){(0,o.pq)(`Skipped creating form field value #${e.pdfObjectId} from payload because an error occurred while deserializing.`),(0,o.pq)(t)}}))}));t.size>0&&!this._isDestroyed()&&((0,o.V1)(this._formFieldValueCallbacks),this._formFieldValueCallbacks.setFormFieldValues(t))}async loadBookmarks(){this._verifyLoaded();const e=await this._core.getBookmarks();if(this._isDestroyed())return;const t=(0,r.B8)().withMutations((t=>{e.forEach((e=>{let n;n=e.id?e.id:e.pdfBookmarkId?e.pdfBookmarkId:(0,W.z)();try{t.push((0,M.r)(n,e))}catch(e){(0,o.pq)(`Skipped creating bookmark #${n} from payload because an error occurred while deserializing.`),(0,o.pq)(e)}}))}));t.size>0&&!this._isDestroyed()&&((0,o.V1)(this._bookmarkCallbacks),this._bookmarkCallbacks.createBookmarks(t,$.n))}_verifyLoaded(){(0,o.V1)(this._state.isLoaded,"StandaloneProvider not properly initialized.")}_isDestroyed(){return this._state.isDestroyed}async syncChanges(){}}function X(e,t){(0,o.V1)(e.rootId,"A new comment must have `rootId` present");const n=t.get(e.rootId);return(0,o.V1)(n,"An annotation must be present linked to the comment to create"),(0,N.wG)(e,n.pdfObjectId?.toString()===n.id?parseInt(e.rootId):e.rootId)}function H(e){return"string"==typeof e?.serialNumber&&e.body instanceof ArrayBuffer}function Y(e){return e?.pkcs7 instanceof ArrayBuffer&&(!("ocspResponses"in e)||Array.isArray(e.ocspResponses)&&e.ocspResponses.every((e=>H(e))))}function Z(e){if(!e)return!1;const{signedData:t,timestampResponse:n,ocspResponses:a}=e;if(!(t instanceof ArrayBuffer))return!1;if(n&&!(n instanceof ArrayBuffer))return!1;if(a){if(!Array.isArray(a))return!1;if(!a.every((e=>H(e))))return!1}return!0}class Q{constructor(e){this.backend=e}async signDocumentAndReload(e,t){const n=e?.signingData,a=n?.certificates;(0,o.V1)(void 0===t||"function"==typeof t,"On a Standalone deployment, when `signaturePreparationData.signingData.privateKey` is not provided, `twoStepSignatureCallbackOrSigningServiceData` must be a function or `NutrientViewer.StandaloneSigningServiceData`."),(0,o.V1)(!n?.timestamp||"string"==typeof n?.timestamp?.url,"The `url` property of `signingData.timestamp` must be a string."),(0,o.V1)(!n?.timestamp||!n?.timestamp?.password||"string"==typeof n?.timestamp?.password,"The `password` property of `signingData.timestamp` must be a string."),(0,o.V1)(!n?.timestamp||!n?.timestamp?.username||"string"==typeof n?.timestamp?.username,"The `username` property of `signingData.timestamp` must be a string."),(0,o.V1)(void 0===n?.ltv||"boolean"==typeof n?.ltv,"The `ltv` property of `signingData` must be a boolean if set."),(0,o.V1)(void 0===n?.ltv||"boolean"==typeof n?.ltv,"The `ltv` property of `signingData` must be a boolean if set."),(0,o.V1)(!n||!n.signatureType||n.signatureType===S.D7.CMS||Array.isArray(a)&&a.length>0&&a.every((e=>Boolean(e instanceof ArrayBuffer&&e.byteLength>0||"string"==typeof e&&e.length>0))),"For signatures of type `NutrientViewer.SignatureType.CAdES` an `Array` of certificates must be provided in `signaturePreparationData.signingData.certificates`.");const i={signatureType:n?.signatureType||(Array.isArray(a)&&a.length>0?S.D7.CAdES:S.D7.CMS),...a&&{certificates:a.map((e=>e instanceof ArrayBuffer?c.o4.fromUint8Array(new Uint8Array(e)):c.o4.encode(e)))},...e?.placeholderSize?{estimatedSize:e.placeholderSize}:null};try{const{hash:a,signatureFormFieldName:s,file:r,fileContents:l,dataToBeSigned:d}=await this.backend.client.prepareSign((0,N.Y6)(i),e?.signatureMetadata?(0,N.sZ)(e.signatureMetadata):null,Boolean(e?.flatten),e?.formFieldName,(0,N.qN)(e?.position),await(0,N.z8)(e?.appearance)),u=function(e){const t=e.trim(),n=t.length/2,a=new Uint8Array(n);for(let e=0;e<n;e++)a[e]=parseInt(t.substr(2*e,2),16);return a}(d);let m,h,p;if(t){try{m=await t({hash:a,fileContents:l,dataToBeSigned:u})}catch(e){throw new o.uE(`\`twoStepSignatureCallback\` threw an error: ${e}`)}if(!(m instanceof ArrayBuffer||Y(m)||Z(m)))throw new o.uE(`The resolved value from \`twoStepSignatureCallback\` should be a an \`ArrayBuffer\`, \`SignatureCallbackResponsePkcs7\`, or \`SignatureCallbackResponseRaw\`, but is of type \`${typeof m}\` instead.`);p=m}else{if(!n?.privateKey)throw new o.uE("No `twoStepSignatureCallback` or `signingData.privateKey` was provided.");{const e={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"},modulusLength:2048,extractable:!1,publicExponent:new Uint8Array([1,0,1])},t=await globalThis.crypto.subtle.importKey("pkcs8",function(e){const t=e.split("\n");let n="";for(let e=0;e<t.length;e++){t[e].trim().length>0&&t[e].indexOf("-BEGIN RSA PRIVATE KEY-")<0&&t[e].indexOf("-BEGIN PRIVATE KEY-")<0&&t[e].indexOf("-BEGIN RSA PUBLIC KEY-")<0&&t[e].indexOf("-BEGIN CERTIFICATE-")<0&&t[e].indexOf("-END RSA PRIVATE KEY-")<0&&t[e].indexOf("-END PRIVATE KEY-")<0&&t[e].indexOf("-END RSA PUBLIC KEY-")<0&&t[e].indexOf("-END CERTIFICATE-")<0&&(n+=t[e].trim())}return c.o4.toUint8Array(n).buffer}(n.privateKey),e,!0,["sign"]);h=await globalThis.crypto.subtle.sign(e,t,u),p=h}}let f="",g=i.certificates||[];if(p instanceof ArrayBuffer)f=c.o4.fromUint8Array(new Uint8Array(p))||"";else if(Y(p)){const e=p;f=c.o4.fromUint8Array(new Uint8Array(e.pkcs7))||""}else if(Z(p)){const e=p;f=c.o4.fromUint8Array(new Uint8Array(e.signedData))||"",g=e.certificates.map((e=>e instanceof ArrayBuffer?c.o4.fromUint8Array(new Uint8Array(e)):c.o4.encode(e)))}let y=null,b=[];if(n?.ltv&&(p instanceof ArrayBuffer?b=await this.backend.getRevocationResponses(g):(Y(p)||Z(p))&&((0,o.V1)(null==p.ocspResponses||Array.isArray(p.ocspResponses)&&p.ocspResponses.every((e=>H(e))),"The `ocspResponses` property of `signatureData` must be a array of `OCSPResponses`."),b=p.ocspResponses?.map((e=>({response_code:200,body:c.o4.fromUint8Array(new Uint8Array(e.body)),token:e.serialNumber})))??[],b.length||((0,o.R8)("The `TwoStepSignatureCallback` didn't return certificate revocation responses; trying to fetch them online."),b=await this.backend.getRevocationResponses(g)))),Z(p)){const e=p;(0,o.V1)(null==e.timestampResponse||e.timestampResponse instanceof ArrayBuffer,"The `timestampResponse` property of `signatureData` must be an `ArrayBuffer`."),e.timestampResponse&&(y={response_code:200,body:c.o4.fromUint8Array(new Uint8Array(e.timestampResponse)),token:"1234"})}if(!y&&n?.timestamp&&p instanceof ArrayBuffer){const e=c.o4.toUint8Array(f).buffer;y=await this.backend.timestampData(e,n.timestamp)}const A=await this.backend.client.sign(r,s,a,N.xz[i.signatureType],f,g,Y(p)?"pkcs7":Z(p)?"raw":n?.signatureContainer?n.signatureContainer:null,y,b);return n?.ltv&&A.signature.certificateChainValidationStatus===S.k5.ok_but_could_not_check_revocation&&(0,o.R8)("Document signed, but couldn't add certificate revocation information so the signature may not be LTV-enabled."),await this.backend.reloadDocument(),s}catch(e){throw await this.backend.client.restoreToOriginalState(),e}}}var ee=n(64966);class te extends Q{constructor(e){super(e)}async signDocumentAndReload(e,t){t=(0,w.kJ)(t),(0,o.V1)(t,"`twoStepSignatureCallbackOrStandaloneSigningServiceData` must be a `NutrientViewer.StandaloneSigningServiceData` object when performing signing via a backend service.");const{jwt:n,signingToken:a}=t,i=this.resolveApiBasePath(t),s=this.resolveServerUrl(t),r=await this.getCertificates(s,n,`${i}get_certificates`,a),c=this.signatureCallbackFactory(s,n,r,e,t,`${i}sign_hash`);return await super.signDocumentAndReload({...e,signingData:{...e?.signingData,signatureType:e?.signingData?.signatureType||S.D7.CAdES,certificates:r}},c)}async getCertificates(e,t,n,a){let i;const s=`${e}${n}`;try{i=await fetch(s,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({signingToken:a})})}catch(e){throw new o.uE(`The signing service failed to retrieve certificates: Failed to fetch from ${s}`)}if(!i.ok)throw new o.uE(`The signing service failed to retrieve certificates: ${await i.json()}`);const r=(await i.json())?.data||{};return r.certificates.concat(r.ca_certificates).map((e=>c.o4.fromBase64(e)))}resolveApiBasePath(e){return(0,ee.i)(e.jwt).api_base_path||"/api/"}resolveServerUrl(e){const t=e.serverUrl||(0,ee.i)(e.jwt).server_url;return(0,o.V1)(t,"`twoStepSignatureCallbackOrStandaloneSigningServiceData.jwt` must contain claim `server_url` or the `twoStepSignatureCallbackOrStandaloneSigningServiceData.serverUrl` should be set"),t}signatureCallbackFactory(e,t,n,a,i,s){return async r=>{let l,{hash:d,dataToBeSigned:u}=r;try{l=await fetch(`${e}${s}`,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({dataToBeSigned:c.o4.fromUint8Array(u),hash:d,signatureType:a?.signingData?.signatureType||S.D7.CAdES,signingToken:i.signingToken,cadesLevel:a?.signingData?.padesLevel||S.sX.b_lt})})}catch(t){throw new o.uE(`The signing service failed to retrieve certificates: Failed to fetch from ${e}${s}`)}if(!l.ok)throw new o.uE(`The signing service failed to sign: ${await l.text()}`);const m=(await l.json())?.data||{};if(a?.signingData?.signatureContainer===S.Yj.pkcs7){const e={pkcs7:c.o4.toUint8Array(m.pkcs7).buffer};return m.ocspResponses&&(e.ocspResponses=m.ocspResponses.map((e=>({serialNumber:e.serialNumber,body:c.o4.toUint8Array(e.body).buffer})))),e}{const e={certificates:n,signedData:c.o4.toUint8Array(m.signedData).buffer,timestampResponse:c.o4.toUint8Array(m.timestampResponse).buffer};return m.ocspResponses&&(e.ocspResponses=m.ocspResponses.map((e=>({serialNumber:e.serialNumber,body:c.o4.toUint8Array(e.body).buffer})))),e}}}}var ne=n(30026),ae=n(85553);class ie extends(r.mS({baseUrl:null,baseCoreUrl:null,baseProcessorEngineUrl:null,licenseKey:null,document:null,backendPermissions:new ne.A,documentResponse:null,disableWebAssemblyStreaming:!1,enableAutomaticLinkExtraction:!1,overrideMemoryLimit:null,features:(0,r.B8)(),signatureFeatureAvailability:ae.g.NONE,documentHandle:null,trustedCAsCallback:null,signaturesInfoPromise:null,customFonts:null,fontSubstitutions:null,forceLegacySignaturesFeature:!1,forceAnnotationsRender:!1,appName:null,lazyLoadedPages:null,productId:null,processorEngine:null,dynamicFonts:null,inlineWorkers:!0,allowLinearizedLoading:!1,enableCoreUnifiedComments:!1,enableCorePreservePDFAccessibility:!1})){}let se;se=n(96099).Fe;const oe=new i.iy(se);class re extends j.K{constructor(e){super(),(0,a.A)(this,"type","STANDALONE"),(0,a.A)(this,"standaloneDocumentSigner",new Q(this)),(0,a.A)(this,"signingServiceDocumentSigner",new te(this)),(0,a.A)(this,"_XFDF",null),le(e);const{baseUrl:t,baseCoreUrl:n,baseProcessorEngineUrl:i,instantJSON:o,XFDF:r,enableAutomaticLinkExtraction:c,overrideMemoryLimit:l,trustedCAsCallback:u,electronAppName:m,appName:f,isSharePoint:g,isSalesforce:y,productId:b,processorEngine:A,dynamicFonts:S,inlineWorkers:w,formsConfiguration:_,allowLinearizedLoading:P,unifiedCommentsSupport:F,preservePDFAccessibility:v}=e;"string"==typeof r&&(this._XFDF={source:r,keepCurrentAnnotations:!0===e.XFDFKeepCurrentAnnotations,ignorePageRotation:!0===e.XFDFIgnorePageRotation,richTextEnabled:!0===e.XFDFRichTextEnabled}),o&&o.annotations&&(o.annotations=o.annotations.map((e=>(e.id=e.id?.toString(),e)))),this._instantJSON=o,this._formsConfiguration=_,"function"==typeof u&&(this._trustedCAsCallback=u);const{disableWebAssemblyStreaming:k,customFonts:C,fontSubstitutions:D}=e,{standaloneInstancesPoolSize:I}=e;void 0!==I&&(oe.size=I);const R=!!e.electronicSignatures&&Boolean(e.electronicSignatures.forceLegacySignaturesFeature);let T=b||null;!g&&!y||T||(T=g?p.v.SharePoint:p.v.Salesforce),this._state=new ie(ce({baseUrl:t,baseCoreUrl:n,baseProcessorEngineUrl:i,licenseKey:e.licenseKey,document:e.document,disableWebAssemblyStreaming:k,enableAutomaticLinkExtraction:c,overrideMemoryLimit:l,documentHandle:"0",customFonts:C,fontSubstitutions:D,forceLegacySignaturesFeature:R,appName:f||m,productId:T,processorEngine:A||h.j.fasterProcessing,dynamicFonts:S,inlineWorkers:w,allowLinearizedLoading:P,enableCoreUnifiedComments:F,enableCorePreservePDFAccessibility:v})),this._requestQueue=new s.L(d.z3);const{object:V,checkIn:x}=oe.checkOut();this.client=V,this.checkIn=x,this.corePDFDocument=new L.N({wasmClient:this.client},{type:"alreadyLoadedDocument"});const O=o?{annotations:o.annotations||[],formFields:o.formFields||[],formFieldValues:o.formFieldValues||[],skippedPdfObjectIds:o.skippedPdfObjectIds||[],skippedPdfFormFieldIds:o.skippedPdfFormFieldIds||[],attachments:o.attachments||{},bookmarks:o.bookmarks||[],skippedPdfBookmarkIds:o.skippedPdfBookmarkIds||[],comments:o.comments||void 0,skippedComments:o.skippedComments||void 0,format:o.format,...o.pdfId?{pdfId:o.pdfId}:null}:null;this.provider=new G(this.client,O)}isUsingInstantProvider(){return!1}hasClientsPresence(){return!1}async load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._isPDFJavaScriptEnabled=e.isPDFJavaScriptEnabled,{features:this._state.features,signatureFeatureAvailability:this._state.signatureFeatureAvailability,hasPassword:!!e.password,password:e.password,allowedTileScales:"all"}}async afterDocumentLoaded(e){}destroy(){this.corePDFDocument.destroy(),this.provider&&this.provider.destroy(),this._requestQueue&&this._requestQueue.destroy(),this.checkIn()}async documentInfo(){return this._state.documentResponse}async lazyLoadPages(){if(!this._state.lazyLoadedPages){const e=await this.client.getAllPageInfos(this._state.documentResponse.pageCount);this._state=this._state.set("lazyLoadedPages",e)}return this._state.lazyLoadedPages}getDocumentHandle(){return this._state.documentHandle}getFormJSON(){return this.client.getFormJSON()}permissions(){return Promise.resolve(this._state.backendPermissions)}textForPageIndex(e){return this.corePDFDocument.getTextLines(e)}getContentTreeForPageIndex(e){return this.corePDFDocument.getContentTree(e)}getTextFromRects(e,t){return this.client.getTextFromRects(e,t.toJS())}getAvailableFontFaces(e){return this.client.getAvailableFontFaces(e)}async getSuggestedLineHeightFactor(e){return"number"!=typeof e.pdfObjectId?1:"number"!=typeof e.pageIndex?((0,o.R8)("Annotation must have a pageIndex."),1):(e.lineHeightFactor&&(0,o.R8)(`Annotation ${e.id} already has a line height factor.`),this.client.getSuggestedLineHeightFactor(e.pdfObjectId,e.pageIndex))}async getClosestSnapPoint(e){const t=await this.client.getClosestSnapPoint(e.x,e.y);return t&&"number"==typeof t[0]&&"number"==typeof t[1]?new P.bR({x:t[0],y:t[1]}):e}configureSnapper(e){return this.client.configureSnapper(e)}renderAnnotation(e,t,n,a,i,s,o){if(0===Math.floor(a)||0===Math.floor(i))return{promise:Promise.resolve(void 0),cancel:()=>{}};const r=(0,V.yl)();let c;if((0,v.cu)(e)){if(c=(0,v.sS)(e),this.isVisuallyIdenticalAnnotationCached({annotation:e,providedVisualAnnotationIndex:c,width:a,height:i}))return this.cachedRenderedAnnotationDiscardablePromise(c,r);this._addCachedRenderedAnnotation(c,{width:a,height:i,noZoom:e.noZoom,APStreamPromise:r.promise})}const l=e.id,d=new B(l,(()=>this.client.renderAnnotation((0,N.eq)(e),n,a,i,(0,D.LG)(),s,o).then((e=>e?"string"==typeof e?(0,C.$3)(e):(0,C.vB)({buffer:e,width:a,height:i}):Promise.resolve(null))).then((t=>((0,v.cu)(e)&&this._makeEnqueuedRelease(t,c),r.resolve(t),t)))));return this._requestQueue.enqueue(d,!1)}async getMeasurementSnappingPoints(e){return this.client.getMeasurementSnappingPoints(e)}async getSecondaryMeasurementUnit(){return await this.client.getSecondaryMeasurementUnit()}async setSecondaryMeasurementUnit(e){return await this.client.setSecondaryMeasurementUnit(e)}async compareDocuments(e,t){const n={originalDocument:e.originalDocument,changedDocument:e.changedDocument,comparisonOperation:(0,g.c)(t)};return this.corePDFDocument.compareText(n).promise}async renderPageAnnotations(e,t,n){const a=this.provider,i=[],s=[],r=t.some((e=>e instanceof b.sb));r&&await a._setReadStateCallbacksPromise;const c=t.filter((e=>{const t=r?a._readStateCallbacks.getAnnotationWithFormField(e.id):null,n=t?.formField,o=(0,v.lG)(e,n);if(o&&n){i.find((e=>e.name===n.name))||(i.push((0,N.cA)((0,I.Af)(n))),s.push(n))}return o}));function l(e,t){if((0,v.uM)(e)){const n=s.find((t=>t.name===e.formFieldName)),a=t.find((t=>t.name===e.formFieldName));if(!(0,I.Ny)(n,a))return!1}return!0}const d=new Promise(((t,i)=>{const r=c.filter((e=>0!==Math.floor(e.boundingBox.width*n)&&0!==Math.floor(e.boundingBox.height*n)));this.client.renderPageAnnotations(e,r.map((e=>e.pdfObjectId)).toArray(),r.map((e=>e.boundingBox.width*n)).toArray(),r.map((e=>e.boundingBox.height*n)).toArray(),(0,D.LG)()).then((e=>{const i=s.map((e=>a._readStateCallbacks?.getFormFieldByName(e.name))).filter(Boolean),c=e.map(((e,t)=>{const a=r.get(t);return(0,o.V1)(a),l(a,i)&&a&&e?"string"==typeof e?(0,C.$3)(e):(0,C.vB)({buffer:e,width:a.boundingBox.width*n,height:a.boundingBox.height*n}):Promise.resolve(null)}));Promise.all(c).then((e=>{const i=s.map((e=>a._readStateCallbacks?.getFormFieldByName(e.name))).filter(Boolean);e.forEach(((e,t)=>{const a=r.get(t);if(a){const{formFieldValue:t}=this.getAnnotationFormFieldAndValue(a),s=this.getAnnotationAvailableVariants(a),o=this.annotationAPStreamPromises.get(a.id),r=l(a,i);if(o&&(this.annotationAPStreamPromises=this.annotationAPStreamPromises.delete(a.id),o(r?e:null)),s.length>1){const i={normal:e};e&&r&&this.cacheAPStream(i,a);const{promise:o}=this.renderAPStream(a,t,null,a.boundingBox.width*n,a.boundingBox.height*n,s);Promise.all(o.map((e=>e.promise))).then((e=>{e.some(Boolean)&&s.forEach(((t,n)=>{"normal"!==t&&e[n]&&(i[t]=e[n])}))}))}else e&&r&&this.cacheAPStream(e,a)}})),t()}))})).catch(i)}));return this.pageAPStreamsPromises=this.pageAPStreamsPromises.set(e,d),d}renderDetachedAnnotation(e,t,n,a){if(e.id)throw new o.uE(`Detached annotations should not have an \`id\`: ${e.id}`);const i=(0,V.yl)();let s;if((0,v.cu)(e)){if(s=(0,v.sS)(e),this.isVisuallyIdenticalAnnotationCached({annotation:e,providedVisualAnnotationIndex:s,width:n,height:a}))return this.cachedRenderedAnnotationDiscardablePromise(s,i);this._addCachedRenderedAnnotation(s,{width:n,height:a,noZoom:e.noZoom,APStreamPromise:i.promise})}const r=(0,l.Z0)(),c=new B(r,(()=>this.client.renderDetachedAnnotation((0,N.eq)(e),t,n,a,(0,D.LG)()).then((e=>e?(0,C.vB)({buffer:e,width:n,height:a}):Promise.resolve(null))).then((t=>((0,v.cu)(e)&&this._makeEnqueuedRelease(t,s),i.resolve(t),t))).catch((()=>{const e=this._cachedRenderedAnnotations.get(s);e&&e.timeout&&clearTimeout(e.timeout),this._cachedRenderedAnnotations.delete(s)})))),{promise:d,cancel:u}=this._requestQueue.enqueue(c,!1);return{promise:d,cancel:u}}async getAttachment(e){const[t,n]=await this.client.getAttachment(e);return new Blob([t],{type:n})}async parseXFDF(e,t,n){const{errors:a,formFieldValues:i,annotations:s}=await this.client.parseXFDF(e,t,n);return{errors:a?.map((e=>({errorMessage:e.error_message,type:e.type}))),formFieldValues:i?.reduce(((e,t)=>(e[t.fqdn]=t.values,e)),{}),annotations:(0,r.B8)(s?.map((e=>(0,N.h8)((0,v.K1)(),e)))||[])}}async search(e,t,n,a){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:f.n.TEXT;const o=await this.client.search(e,t,n,a,s);return(0,x.g)(o.filter((e=>i||!e.isAnnotation)))}async searchAndRedact(e,t,n){const{totalPages:a}=n,i=await this.client.search(e,t.startPageIndex??0,t.pageRange??a,t.caseSensitive,t.searchType);return(0,r.B8)(i.filter((e=>t.searchInAnnotations||!e.isAnnotation)).map((e=>{const a=e.isAnnotation?[e.annotationRect]:e.rectsOnPage,i=(0,r.B8)(a).map((e=>((0,o.V1)(e),(0,U.a)(e))));return new A.A({...(0,v.mN)(n),...t.annotationPreset,pageIndex:e.pageIndex,rects:i,boundingBox:F.A.union(i)})})))}async exportPDF(){let{flatten:e=!1,incremental:t,saveForPrinting:n=!1,format:a="pdf",excludeAnnotations:i=!1,preserveInstantJSONChanges:s=!0,permissions:r,outputFormat:c=!1,flattenElectronicSignatures:l=e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},d=arguments.length>1?arguments[1]:void 0;if(e&&!l)throw new o.uE("Cannot set `flattenElectronicSignatures` to `false` when `flatten` is set to `true`.");if(c&&"boolean"!=typeof c&&c.conformance&&(0,o.V1)(c.conformance&&Object.values(m.o).includes(c.conformance),"The supplied PDF/A Conformance type is not valid. Valid Conformance should be one of the following options NutrientViewer.Conformance."+Object.keys(m.o).join(", NutrientViewer.Conformance.")),void 0===t)if(this._state.features.includes(u.Y.DIGITAL_SIGNATURES)){const e=await this.getSignaturesInfo();t=!n&&Boolean("not_signed"!==e.status)}else t=!1;return this.client.exportFile(e,t,n,a,i,s,r,d).then((async e=>{let[t,n]=e;if(t.mimeType=n.mimeType,t.extension=n.extension,c){const e="boolean"!=typeof c&&c.conformance?c.conformance:m.o.PDFA_2B;let n;try{return n=await this._setupGdPictureClient(),await n.toPdf(t,e)}finally{n?.destroy(),(0,O.Pm)(null)}}return t}))}async exportOffice(e){let t,{format:n}=e;try{const[e]=await this.client.exportFile(!1,!1,!1,"pdf",!1,!0);return t=await this._setupGdPictureClient(),await t.toOffice(e,n)}catch(e){throw new o.uE(`Exporting to ${n} failed: ${e.message}.`)}finally{t?.destroy(),(0,O.Pm)(null)}}async _setupGdPictureClient(){let e=(0,O.jU)();return e||(e=(0,O.NY)({baseUrl:this._state.baseProcessorEngineUrl,mainThreadOrigin:this._state.appName||(0,T.D5)()||window.location.origin,licenseKey:this._state.licenseKey,processorEngine:this._state.processorEngine,customFonts:this._state.customFonts,dynamicFonts:this._state.dynamicFonts,fontSubstitutions:this._state.fontSubstitutions}),(0,O.Pm)(e)),e}exportXFDF(e){return this.client.exportXFDF(e)}exportInstantJSON(e){return this.client.exportInstantJSON(e)}getPDFURL(){let{includeComments:e=!0,saveForPrinting:t,excludeAnnotations:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.generatePDFObjectURL({includeComments:e,saveForPrinting:t,excludeAnnotations:n})}generatePDFObjectURL(){let e,{includeComments:t=!0,saveForPrinting:n,excludeAnnotations:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=!1;return{promise:new Promise((s=>{this.exportPDF({flatten:!0,includeComments:t,saveForPrinting:n,excludeAnnotations:a}).then((t=>{if(i)return;const n=new Blob([t],{type:t.mimeType});e=window.URL.createObjectURL(n),s(e)}))})),revoke:()=>{e&&window.URL.revokeObjectURL(e),i=!0}}}async getDocumentOutline(){const e=await this.client.getDocumentOutline();return(0,r.B8)(e.map(E.r))}async setDocumentOutline(e){return this.client.setDocumentOutline(e.map(E.U).toArray())}async getPageGlyphs(e){const t=await this.client.getPageGlyphs(e);return(0,N.Fj)(t)}async onKeystrokeEvent(e){return await this.client.onKeystrokeEvent(e)}async evalFormValuesActions(e){return this.client.evalFormValuesActions(e.map(N.cA).toJS())}async evalScript(e,t,n){return this.client.evalScript(e,t,n)}async setFormJSONUpdateBatchMode(e){return this.client.setFormJSONUpdateBatchMode(e)}async getMeasurementScales(){const e=await this.client.getMeasurementScales();return e?.measurementContentFormats}async addMeasurementScale(e){return await this.client.addMeasurementScale(e)}async removeMeasurementScale(e){return await this.client.removeMeasurementScale(e)}async getAnnotationsByScale(e){return await this.client.getAnnotationsByScale(e)}async applyOperationsAndReload(e){try{const{processedOperations:t,operationsDocuments:n}=await(0,k.t)(e);await this.client.applyOperations(t,n)}catch(e){throw new o.uE(`Applying operations failed: ${e}`)}return this.provider._state=this.provider._state.set("alreadyLoadedPages",(0,r.T5)()),this.reloadDocument()}async applyRedactionsAndReload(){try{await this.client.applyRedactions()}catch(e){throw new o.uE(`Applying redactions failed: ${e}`)}return this.reloadDocument()}async reloadDocument(){try{this.provider?.destroy(),this.provider=new G(this.client,null),this._state=this._state.set("lazyLoadedPages",null);const e=await this.client.reloadDocument();return this._state=this._state.set("documentResponse",e).set("documentHandle",(parseInt(this._state.documentHandle)+1).toString()).set("signaturesInfoPromise",null),this.clearRenderedAnnotationsCache(),{features:this._state.features,signatureFeatureAvailability:this._state.signatureFeatureAvailability,hasPassword:!1,password:void 0,allowedTileScales:"all"}}catch(e){throw new o.uE(`Reloading failed: ${e}`)}}async getEmbeddedFiles(){const e=await this.client.getEmbeddedFilesList();return(0,r.B8)(e.map((e=>{let{id:t,...n}=e;return(0,y.r)(t,n,!0)})))}async exportPDFWithOperations(e){try{const{processedOperations:t,operationsDocuments:n}=await(0,k.t)(e);return this.client.exportPDFWithOperations(t,n)}catch(e){throw new o.uE(`Exporting PDF with operations failed: ${e}`)}}async setSignaturesLTV(e){try{const t=(e??[]).map((e=>e instanceof ArrayBuffer?c.o4.fromUint8Array(new Uint8Array(e)):c.o4.encode(e))),n=await this.getRevocationResponses(t),a=await this.client.setSignaturesLTV(n).then((e=>(0,N.N5)(e)));if(a.signatures?.find((e=>e.certificateChainValidationStatus===S.k5.ok_but_could_not_check_revocation)))throw"Could not set LTV for all signatures. Check that the OCSP response is valid.";return this._state=this._state.set("signaturesInfoPromise",null),this.getSignaturesInfo()}catch(e){throw new o.uE(`Setting signatures LTV failed: ${e}`)}}getSignaturesInfo(){try{if(this._state.signaturesInfoPromise)return this._state.signaturesInfoPromise;const e=this.client.getSignaturesInfo().then((e=>(0,N.N5)(e)));return this._state=this._state.set("signaturesInfoPromise",e),e}catch(e){throw new o.uE(`Getting document signatures info: ${e}`)}}async refreshSignaturesInfo(){this._state=this._state.set("signaturesInfoPromise",null)}async loadCertificates(e){return this.client.loadCertificates(e)}async getRevocationResponses(e){const t=await this.client.getRevocationRequests(e);return await Promise.all(t.map((async e=>{let{method:t,url:n,content_type:a,request_data:i,token:s}=e;try{const e=await fetch(n,{method:t,headers:{"Content-Type":a??"application/ocsp-request"},body:c.o4.toUint8Array(i).buffer}),o=await e.arrayBuffer();return{response_code:e.status,body:c.o4.fromUint8Array(new Uint8Array(o)),token:s}}catch(e){return{response_code:0,body:"",token:s,error_message:e.message}}})))}async signDocumentAndReload(e,t){(0,o.V1)(void 0===t||"function"==typeof t||(0,w.kJ)(t),"On a Standalone deployment, `twoStepSignatureCallbackOrSigningServiceData` must be a function or `NutrientViewer.StandaloneSigningServiceData` if provided.");const n=(0,w.kJ)(t);return n?this.signingServiceDocumentSigner.signDocumentAndReload(e,n):this.standaloneDocumentSigner.signDocumentAndReload(e,t)}cancelRequests(){this._requestQueue.cancelAll()}async syncChanges(){}getDefaultGroup(){}isCollaborationPermissionsEnabled(){return!1}async clearAPStreamCache(){return this.client.clearAPStreamCache()}async setComparisonDocument(e,t){return this.client.setComparisonDocument(e,t)}async openComparisonDocument(e){return this._state=this._state.set("forceAnnotationsRender",!1),await this.client.closeDocument(),this._state=this._state.set("forceAnnotationsRender",!0),await this.client.openComparisonDocument(e)||this._state.documentResponse}async documentCompareAndOpen(e){return this.client.documentCompareAndOpen(e)}async persistOpenDocument(e){return this.client.persistOpenDocument(e)}async cleanupDocumentComparison(){return this.client.cleanupDocumentComparison()}async runPDFFormattingScripts(e,t){return this.client.runPDFFormattingScripts(e,t)}async runPDFFormattingScriptsFromWidgets(e,t,n){let a=[];if(this._isPDFJavaScriptEnabled){const{withAPStream:i,withoutAPStream:s}=e.reduce(((e,a)=>{if(a instanceof b.sb){const i=t?.get(a.formFieldName);if(i instanceof b.Vw)return e;n?.(a)?e.withAPStream.push(a.formFieldName):e.withoutAPStream.push(a.formFieldName)}return e}),{withAPStream:[],withoutAPStream:[]});let o=[];if(i.length&&!s.length)o=await this.runPDFFormattingScripts(i,!0);else if(!i.length&&s.length)o=await this.runPDFFormattingScripts(s,!1);else if(i.length&&s.length){const[e,t]=await Promise.all([this.runPDFFormattingScripts(i,!0),this.runPDFFormattingScripts(s,!1)]);o=e.concat(t)}a=(0,I.A5)(this._initialChanges,o)}return a}setFontSubstitutions(e){return this.client.setFontSubstitutions(e)}async contentEditorReload(){return(0,o.V1)(this.provider instanceof G,"Standalone can only use standalone annotation provider"),this.provider._state=this.provider._state.set("alreadyLoadedPages",(0,r.T5)()),this.reloadDocument()}getOCGs(){return this.client.getOCGs()}getOCGVisibilityState(){return this.client.getOCGVisibilityState()}setOCGVisibilityState(e){return this.client.setOCGVisibilityState(e)}updateButtonIcon(e,t,n){return this.client.updateButtonIcon((0,N.eq)(e),t,n)}async timestampData(e,t){const{url:n,username:a="",password:i=""}=t,s=c.o4.fromUint8Array(new Uint8Array(e));try{const e=await this.client.getTimestampRequest(s,{url:n,username:a,password:i}),t={method:e.method,headers:{"Content-Type":e.contentType||"application/timestamp-query"},body:c.o4.toUint8Array(e.requestData).buffer};(e.username||e.password)&&(t.headers.Authorization=`Basic ${btoa(`${e.username}:${e.password}`)}`);try{const n=await fetch(e.url,t),a=await n.arrayBuffer();return{response_code:n.status,body:c.o4.fromUint8Array(new Uint8Array(a)),token:e.token}}catch(t){return{response_code:400,body:"",token:e.token,error_message:t.message}}}catch(e){return{response_code:500,body:"",token:"",error_message:e.message}}}async waitUntilFullyLoaded(e){}}function ce(e){return{baseUrl:e.baseUrl,baseCoreUrl:e.baseCoreUrl,baseProcessorEngineUrl:e.baseProcessorEngineUrl,licenseKey:e.licenseKey,document:e.document,disableWebAssemblyStreaming:!!e.disableWebAssemblyStreaming,enableAutomaticLinkExtraction:!!e.enableAutomaticLinkExtraction,overrideMemoryLimit:"number"==typeof e.overrideMemoryLimit?e.overrideMemoryLimit:null,documentHandle:"number"==typeof e.documentHandle?e.documentHandle:"0",trustedCAsCallback:"function"==typeof e.trustedCAsCallback?e.trustedCAsCallback:null,customFonts:Array.isArray(e.customFonts)?e.customFonts.filter((e=>e instanceof _.A)):null,forceLegacySignaturesFeature:Boolean(e.forceLegacySignaturesFeature),appName:"string"==typeof e.appName?e.appName:null,productId:e.productId,processorEngine:e.processorEngine,dynamicFonts:e.dynamicFonts,fontSubstitutions:e.fontSubstitutions,inlineWorkers:e.inlineWorkers,allowLinearizedLoading:e.allowLinearizedLoading,enableCoreUnifiedComments:e.enableCoreUnifiedComments,enableCorePreservePDFAccessibility:e.enableCorePreservePDFAccessibility}}function le(e){const{licenseKey:t,instantJSON:n,XFDF:a,disableWebAssemblyStreaming:i,disableIndexedDBCaching:s,enableAutomaticLinkExtraction:r,overrideMemoryLimit:c,standaloneInstancesPoolSize:l,trustedCAsCallback:d,baseUrl:u,baseCoreUrl:m,baseProcessorEngineUrl:h,customFonts:p,isSharePoint:f,isSalesforce:g,dynamicFonts:y,inlineWorkers:b,formsConfiguration:A}=e;if((0,o.V1)("string"==typeof u,"`baseUrl` is mandatory and must be a valid URL, e.g. `https://example.com/"),(0,R.f4)(u),(0,o.V1)(!m||"string"==typeof m,"`baseCoreUrl` must be a valid URL if set, e.g. `https://example.com/"),m&&(0,R.Qo)(m),(0,o.V1)(!h||"string"==typeof h,"`baseProcessorEngineUrl` must be a valid URL if set, e.g. `https://example.com/"),h&&(0,R.hc)(h),(0,o.V1)(null==t||"string"==typeof t,"licenseKey must be a string value if provided. Please obtain yours from https://my.nutrient.io/."),"string"==typeof t&&(0,o.V1)(!t.startsWith("TRIAL-"),"You're using the npm key instead of the license key. This key is used to download the Nutrient Web SDK package via the node package manager.\n\nLeave out the license key to activate as a trial."),(0,o.V1)(void 0===a||"string"==typeof a,"XFDF must be a string"),n&&((0,o.yj)(n),(0,o.V1)(void 0===a,"Cannot import from both instantJSON and XFDF")),(0,o.V1)(void 0===i||"boolean"==typeof i,"disableWebAssemblyStreaming must be a boolean"),(0,o.V1)(void 0===r||"boolean"==typeof r,"enableAutomaticLinkExtraction must be a boolean"),(0,o.V1)(void 0===c||"number"==typeof c,"overrideMemoryLimit must be a number"),(0,o.V1)(void 0===l||"number"==typeof l&&l>=0,"standaloneInstancesPoolSize must be a non-negative number"),(0,o.V1)(void 0===d||"function"==typeof d,"trustedCAsCallback must be a function"),(0,o.V1)(void 0===p||Array.isArray(p)&&p.every((e=>e instanceof _.A)),"customFonts must be an array of NutrientViewer.Font instances"),(0,o.V1)(void 0===p||p.every((e=>e.callback)),"All NutrientViewer.Font instances specified on customFonts must have its callback property defined"),void 0!==s&&(0,o.t6)("disableIndexedDbCaching has been deprecated and it no longer has effect. It will be removed in a later version.\nBrowsers dropped IndexedDB serialization of Wasm modules in favor of regular HTTP caching."),(f||g)&&(0,o.t6)("isSharePoint and isSalesforce configuration properties are deprecated and will be removed in the next major release. Please use the new Configuration#productId property instead. For more information, please check the migration guide."),(0,o.V1)(!(f&&g),"You cannot enable both SharePoint and Salesforce integrations at the same time. Please set either isSharePoint or isSalesforce to true, but not both."),"string"==typeof y)try{new URL(y)}catch(e){throw new o.uE("dynamicFonts must be a valid URL to a JSON file containing the data for fonts to be dynamically loaded.")}(0,o.V1)(void 0===b||"boolean"==typeof b,"inlineWorkers must be a boolean"),A&&(0,o.V1)(void 0===A.export?.disableComboBoxArrow||"boolean"==typeof A.export?.disableComboBoxArrow,"formsConfiguration.export.disableComboBoxArrow must be a boolean")}},40927:(e,t,n)=>{n.d(t,{r:()=>o});var a=n(49568);class i extends(a.mS({id:"",attachmentId:"",description:null,fileName:null,fileSize:null,updatedAt:null})){}var s=n(46952);function o(e,t){return function(e,t){return t}(0,arguments.length>2&&void 0!==arguments[2]&&arguments[2])?new i({id:(0,s.A)(),description:t.fileDescription,attachmentId:e,fileName:t.fileName||null,fileSize:t.fileSize||null,updatedAt:t.modificationDate?new Date(t.modificationDate):null}):new i({id:e,description:t.description,attachmentId:t.fileAttachmentId,fileName:t.fileName||null,fileSize:t.fileSize||null,updatedAt:new Date(t.updatedAt)||null})}},41477:(e,t,n)=>{n.d(t,{U:()=>c,r:()=>l});var a=n(85409),i=n(49568),s=n(6085),o=n(16792),r=n(76117);function c(e){return{type:"pspdfkit/outline-element",children:e.children&&e.children.map((e=>c(e))).toJS(),title:e.title,color:e.color&&(0,o.J)(e.color),isBold:e.isBold,isItalic:e.isItalic,isExpanded:e.isExpanded,action:e.action&&(0,s.Ix)(e.action)}}function l(e){let t,n;(0,a.V1)("pspdfkit/outline-element"===e.type,"invalid outline element type."),(0,a.V1)(null==e.children||Array.isArray(e.children),"children must be an Array<OutlineElement>."),(0,a.V1)("string"==typeof e.title,"title must be a string."),(0,a.V1)(null==e.isBold||"boolean"==typeof e.isBold,"isBold must be a boolean."),(0,a.V1)(null==e.isItalic||"boolean"==typeof e.isItalic,"isItalic must be a boolean."),(0,a.V1)(null==e.isExpanded||"boolean"==typeof e.isExpanded,"isExpanded must be a boolean.");try{t=e.action&&(0,s._8)(e.action)}catch(t){(0,a.R8)(`PDF Action not supported ${JSON.stringify(e.action)})`)}try{n=e.color&&(0,o.p)(e.color)}catch(t){(0,a.R8)(`Invalid color:\n\n${e.color}`)}const c={title:e.title,color:n,isBold:!0===e.isBold,isItalic:!0===e.isItalic,isExpanded:!0===e.isExpanded,action:t,children:e.children&&e.children.length>0?(0,i.B8)(e.children.map(l)):(0,i.B8)()};return new r.LC(c)}},25888:(e,t,n)=>{n.d(t,{g:()=>i,t:()=>s});var a=n(85409);function i(e,t,n,a,i,s){let o;return e.has(n)?o=e.get(n):(o=i.toString(),t[o]=n,e.set(n,o)),{...a,[s]:o}}async function s(e){const t=new WeakMap,n={};return{processedOperations:await Promise.all(e.map((async(e,s)=>{if("importDocument"===e.type){const{document:o}=e;return(0,a.V1)(o instanceof File||o instanceof Blob,"Wrong `importDocument` operation `document` value: it must be a File or a Blob"),i(t,n,o,e,s,"document")}if("applyInstantJson"===e.type){const o=e.instantJson;(0,a.V1)("object"==typeof o&&null!==o,"Wrong `applyInstantJson` operation `instantJson` value: it must be an object");const r=JSON.stringify(o),c=new Blob([r],{type:"application/json"});return i(t,n,c,e,s,"dataFilePath")}if("applyXfdf"===e.type){const o=e.xfdf;(0,a.V1)("string"==typeof o,"Wrong `applyXfdf` operation `xfdf` value: it must be a string");const r=new Blob([o],{type:"application/vnd.adobe.xfdf"});return i(t,n,r,e,s,"dataFilePath")}return e}))),operationsDocuments:n}}},47159:(e,t,n)=>{n.d(t,{g:()=>r});var a=n(49568),i=n(85409),s=n(5293),o=n(3220);function r(e){return(0,i.V1)(Array.isArray(e),"Wrong `json` field"),(0,a.B8)(e.map((e=>((0,i.V1)("number"==typeof e.pageIndex,"Wrong `pageIndex` field"),(0,i.V1)("string"==typeof e.previewText,"Wrong `previewText` field"),(0,i.V1)(Array.isArray(e.rangeInPreview),"Wrong `rangeInPreview` field"),(0,i.V1)(Array.isArray(e.rectsOnPage),"Wrong `rectsOnPage` field"),new o.A({pageIndex:e.pageIndex,previewText:e.previewText,locationInPreview:e.rangeInPreview[0],lengthInPreview:e.rangeInPreview[1],rectsOnPage:(0,a.B8)(e.rectsOnPage).map((e=>(0,s.a)(e))),isAnnotation:!!e.isAnnotation,annotationRect:e.annotationRect?(0,s.a)(e.annotationRect):null})))).filter(Boolean))}}}]);
|