/*!
 * Nutrient Web SDK 1.13.0 (https://www.nutrient.io/sdk/web)
 *
 * Copyright (c) 2016-2026 PSPDFKit GmbH. All rights reserved.
 *
 * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
 * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
 * This notice may not be removed from this file.
 *
 * PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/
 */
"use strict";(globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[]).push([[11],{55324(t,e,r){r.d(e,{default:()=>o});var n=r(37737),i=r.n(n);function o(){return i()('/*!\n * Nutrient Web SDK 1.13.0 (https://www.nutrient.io/sdk/web)\n *\n * Copyright (c) 2016-2026 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";var t,e={},r={};function n(t){var i=r[t];if(void 0!==i)return i.exports;var o=r[t]={exports:{}};return e[t](o,o.exports,n),o.exports}n.m=e,n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.f={},n.e=t=>Promise.all(Object.keys(n.f).reduce((e,r)=>(n.f[r](t,e),e),[])),n.u=t=>"nutrient-viewer-lib/chunk-"+t+"-b1110db3b2c407d3.worker.js",n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.tt=()=>(void 0===t&&(t={createScriptURL:t=>t},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(t=trustedTypes.createPolicy("nutrient-web-sdk#webpack",t))),t),n.tu=t=>n.tt().createScriptURL(t),n.p="",(()=>{var t={224:1};n.f.i=(e,r)=>{t[e]||importScripts(n.tu(n.p+n.u(e)))};var e=self.webpackChunkNutrientViewer=self.webpackChunkNutrientViewer||[],r=e.push.bind(e);e.push=e=>{var[i,o,a]=e;for(var s in o)n.o(o,s)&&(n.m[s]=o[s]);for(a&&a(n);i.length;)t[i.pop()]=1;r(e)}})();const i=function t(e){let r;return r=e instanceof Error?e:new Error(e),Object.setPrototypeOf(r,t.prototype),r};i.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const o=i;function a(t,e){if(!t)throw new o(`Assertion failed: ${e||"Condition not met"}\\n\\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}function s(t){return"[object Object]"===Object.prototype.toString.call(t)}["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 f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function u(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function c(t,e,r){return(e=u(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}new WeakMap;async function l(t){const e=(await async function(t){try{const e=await fetch(t).catch(e=>{throw new o(`Error fetching dynamic fonts file ${t}. ${e}`)});if(200!==e.status)throw new o(`Error fetching dynamic fonts file ${t}. Status code: ${e.status}`);return e}catch(t){throw t}}(t)).json().catch(e=>{throw new o(`Error parsing dynamic fonts file ${t}. ${e}`)});return e}let d=function(t){return t[t.pdf_a_1a=0]="pdf_a_1a",t[t.pdf_a_1b=1]="pdf_a_1b",t[t.pdf_a_2a=2]="pdf_a_2a",t[t.pdf_a_2u=3]="pdf_a_2u",t[t.pdf_a_2b=4]="pdf_a_2b",t[t.pdf_a_3a=5]="pdf_a_3a",t[t.pdf_a_3u=6]="pdf_a_3u",t[t.pdf_a_3b=7]="pdf_a_3b",t[t.pdf_a_4=8]="pdf_a_4",t[t.pdf_a_4e=9]="pdf_a_4e",t[t.pdf_a_4f=10]="pdf_a_4f",t}({});const p=/^data:([^;,]+)?;base64,(.*)$/i,m=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(?:==)?|[A-Za-z0-9+/]{3}=?)?$/,h=new Set(["original","fixed","fit-width","fit-height","fit-max"]),g=new Set(["png","jpg","gif","bmp","tif"]),w={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tif","image/x-tiff":"tif"};async function b(t){const e={urlImageReferences:[]},r=y(t.model,"$.model",e);if(e.urlImageReferences.length>0){const t=await async function(t){const e=Array.from(new Set(t.map(t=>t.normalizedUrl))),r=new Map;for(const e of t){if(!e.preferredFormat)continue;const t=r.get(e.normalizedUrl);if(t){if(t.format!==e.preferredFormat)throw new Error(`Conflicting image formats for URL "${e.normalizedUrl}" between ${t.path} and ${e.path}.`)}else r.set(e.normalizedUrl,{format:e.preferredFormat,path:e.path})}const n=await Promise.all(e.map(t=>async function(t,e){let r;try{r=await fetch(t)}catch(e){throw new Error(`Failed to fetch ${t}. This can happen when the URL is cross-origin without CORS headers. Configure CORS or pass base64/data URL instead.`)}if(!r.ok)throw new Error(`Failed to fetch ${t}: ${r.status} ${r.statusText}.`);const n=new Uint8Array(await r.arrayBuffer()),i=r.headers.get("content-type");if(i?.toLowerCase().includes("image/svg+xml"))throw new Error("svg format is not supported in this release.");const o=function(t){if(!t)return;const e=t.toLowerCase().split(";")[0].trim();return w[e]}(i),a=function(t){try{const e=new URL(t).pathname,r=e.split(".").pop()?.toLowerCase();if(!r)return;return E(r)??void 0}catch(t){return}}(t),s=e??o??a;if(!s)throw new Error(`Failed to infer image format for ${t}. Provide "format" in the image object.`);return{normalizedUrl:t,base64Data:v(n),format:s}}(t,r.get(t)?.format)));return new Map(n.map(t=>[t.normalizedUrl,t]))}(e.urlImageReferences);!function(t,e){for(const r of t){const t=e.get(r.normalizedUrl);r.image.source="base64",r.image.data=t.base64Data,null==r.image.format&&t.format&&(r.image.format=t.format),delete r.image.url,delete r.image.path}}(e.urlImageReferences,t)}const n=function(t){if(null==t)return{start:"{",end:"}"};if(!s(t))throw new Error("$.config must be a valid object.");const e=t.delimiter;if(null==e)return{start:"{",end:"}"};if(!s(e))throw new Error("$.config.delimiter must be a valid object.");const{start:r,end:n}=e;if(null!=r&&"string"!=typeof r)throw new Error("$.config.delimiter.start must be a string.");if(null!=n&&"string"!=typeof n)throw new Error("$.config.delimiter.end must be a string.");return{start:"string"==typeof r?r:"{",end:"string"==typeof n?n:"}"}}(t.config);return{serializedData:JSON.stringify({config:{delimiter:n},model:r},null,2)}}function y(t,e,r){if(Array.isArray(t))return t.map((t,n)=>y(t,`${e}[${n}]`,r));if(!s(t))return t;if(function(t){return s(t)&&"image"===t._type}(t))return function(t,e,r){const n={...t},i=function(t,e){if("string"!=typeof t)throw new Error(`${e}.source must be a string.`);if("dataUrl"===t)return"base64";if("base64"===t||"url"===t)return t;if("file"===t)throw new Error(`${e}.source "file" is not supported in public APIs. Use "base64" (or "dataUrl") or "url".`);throw new Error(`${e}.source must be one of "base64", "dataUrl", or "url". Received "${t}".`)}(n.source,e);n.source=i,function(t,e){if(void 0===t.sizing)return;if(!h.has(t.sizing))throw new Error(`${e}.sizing must be one of "original", "fixed", "fit-width", "fit-height", "fit-max".`);switch(t.sizing){case"fixed":case"fit-max":$(t.width,`${e}.width`),$(t.height,`${e}.height`);break;case"fit-width":$(t.width,`${e}.width`);break;case"fit-height":$(t.height,`${e}.height`)}}(n,e),function(t,e){if(void 0===t.pageNumber)return;if(!Number.isInteger(t.pageNumber)||t.pageNumber<=0)throw new Error(`${e}.pageNumber must be a positive integer.`)}(n,e);const o=function(t,e){if(void 0===t)return;if("string"!=typeof t)throw new Error(`${e}.format must be a string.`);if("svg"===t.toLowerCase().trim())throw new Error(`${e}.format svg is not supported in this release.`);const r=E(t);if(!r)throw new Error(`${e}.format must be one of "png", "jpg"/"jpeg", "gif", "bmp", "tif"/"tiff".`);return r}(n.format,e);o&&(n.format=o);switch(i){case"base64":{const t=n.data;if("string"!=typeof t||""===t.trim())throw new Error(`${e}.data must be a non-empty string.`);const r=function(t,e){const r=p.exec(t.trim());if(r){const t=(r[1]||"").toLowerCase(),n=r[2];if(!n)throw new Error(`${e} must contain non-empty base64 data.`);if("image/svg+xml"===t)throw new Error(`${e} does not support svg images in this release.`);return S(n,e),{isDataUrl:!0}}return S(t.trim(),e),{isDataUrl:!1}}(t,`${e}.data`);if(!r.isDataUrl&&!n.format)throw new Error(`${e}.format must be supplied when source is raw base64 data.`);break}case"url":{const t="string"==typeof n.url&&""!==n.url.trim()?n.url.trim():"string"==typeof n.path&&""!==n.path.trim()?n.path.trim():null;if(!t)throw new Error(`${e}.url must be supplied when source is "url".`);const i=function(t,e){let r;try{r=new URL(t.trim())}catch(t){throw new Error(`${e} must be a valid absolute URL.`)}if(!["http:","https:"].includes(r.protocol))throw new Error(`${e} must use http or https.`);return r.toString()}(t,`${e}.url`);n.url=i,r.urlImageReferences.push({path:e,image:n,normalizedUrl:i,preferredFormat:n.format});break}}return n}(t,e,r);const n={};for(const[i,o]of Object.entries(t))n[i]=y(o,`${e}${_(i)}`,r);return n}function v(t){if("undefined"!=typeof Buffer)return Buffer.from(t).toString("base64");let e="";for(let r=0;r<t.length;r+=32768){const n=t.subarray(r,r+32768);e+=String.fromCharCode(...n)}return btoa(e)}function S(t,e){const r=t.replace(/\\s+/g,"");if(""===r||!m.test(r))throw new Error(`${e} must be valid base64 data.`)}function $(t,e){if("number"!=typeof t||!Number.isFinite(t)||t<=0)throw new Error(`${e} must be a positive number.`)}function E(t){const e=t.toLowerCase().trim();return"jpeg"===e?"jpg":"tiff"===e?"tif":g.has(e)?e:null}function _(t){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}const U=/^(?:[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 F=function(t){return"string"==typeof t&&U.test(t)};const A=function(t){if(!F(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,255&e,(e=parseInt(t.slice(9,13),16))>>>8,255&e,(e=parseInt(t.slice(14,18),16))>>>8,255&e,(e=parseInt(t.slice(19,23),16))>>>8,255&e,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,255&e)};const I=[];for(let t=0;t<256;++t)I.push((t+256).toString(16).slice(1));function j(t,e=0){return(I[t[e+0]]+I[t[e+1]]+I[t[e+2]]+I[t[e+3]]+"-"+I[t[e+4]]+I[t[e+5]]+"-"+I[t[e+6]]+I[t[e+7]]+"-"+I[t[e+8]]+I[t[e+9]]+"-"+I[t[e+10]]+I[t[e+11]]+I[t[e+12]]+I[t[e+13]]+I[t[e+14]]+I[t[e+15]]).toLowerCase()}let k;const x=new Uint8Array(16);function M(t){return 14+(t+64>>>9<<4)+1}function C(t,e){const r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}function O(t,e,r,n,i,o){return C((a=C(C(e,t),C(n,o)))<<(s=i)|a>>>32-s,r);var a,s}function P(t,e,r,n,i,o,a){return O(e&r|~e&n,t,e,i,o,a)}function D(t,e,r,n,i,o,a){return O(e&n|r&~n,t,e,i,o,a)}function L(t,e,r,n,i,o,a){return O(e^r^n,t,e,i,o,a)}function R(t,e,r,n,i,o,a){return O(r^(e|~n),t,e,i,o,a)}const T=function(t){return function(t){const e=new Uint8Array(4*t.length);for(let r=0;r<4*t.length;r++)e[r]=t[r>>2]>>>r%4*8&255;return e}(function(t,e){const r=new Uint32Array(M(e)).fill(0);r.set(t),r[e>>5]|=128<<e%32,r[r.length-1]=e,t=r;let n=1732584193,i=-271733879,o=-1732584194,a=271733878;for(let e=0;e<t.length;e+=16){const r=n,s=i,f=o,u=a;n=P(n,i,o,a,t[e],7,-680876936),a=P(a,n,i,o,t[e+1],12,-389564586),o=P(o,a,n,i,t[e+2],17,606105819),i=P(i,o,a,n,t[e+3],22,-1044525330),n=P(n,i,o,a,t[e+4],7,-176418897),a=P(a,n,i,o,t[e+5],12,1200080426),o=P(o,a,n,i,t[e+6],17,-1473231341),i=P(i,o,a,n,t[e+7],22,-45705983),n=P(n,i,o,a,t[e+8],7,1770035416),a=P(a,n,i,o,t[e+9],12,-1958414417),o=P(o,a,n,i,t[e+10],17,-42063),i=P(i,o,a,n,t[e+11],22,-1990404162),n=P(n,i,o,a,t[e+12],7,1804603682),a=P(a,n,i,o,t[e+13],12,-40341101),o=P(o,a,n,i,t[e+14],17,-1502002290),i=P(i,o,a,n,t[e+15],22,1236535329),n=D(n,i,o,a,t[e+1],5,-165796510),a=D(a,n,i,o,t[e+6],9,-1069501632),o=D(o,a,n,i,t[e+11],14,643717713),i=D(i,o,a,n,t[e],20,-373897302),n=D(n,i,o,a,t[e+5],5,-701558691),a=D(a,n,i,o,t[e+10],9,38016083),o=D(o,a,n,i,t[e+15],14,-660478335),i=D(i,o,a,n,t[e+4],20,-405537848),n=D(n,i,o,a,t[e+9],5,568446438),a=D(a,n,i,o,t[e+14],9,-1019803690),o=D(o,a,n,i,t[e+3],14,-187363961),i=D(i,o,a,n,t[e+8],20,1163531501),n=D(n,i,o,a,t[e+13],5,-1444681467),a=D(a,n,i,o,t[e+2],9,-51403784),o=D(o,a,n,i,t[e+7],14,1735328473),i=D(i,o,a,n,t[e+12],20,-1926607734),n=L(n,i,o,a,t[e+5],4,-378558),a=L(a,n,i,o,t[e+8],11,-2022574463),o=L(o,a,n,i,t[e+11],16,1839030562),i=L(i,o,a,n,t[e+14],23,-35309556),n=L(n,i,o,a,t[e+1],4,-1530992060),a=L(a,n,i,o,t[e+4],11,1272893353),o=L(o,a,n,i,t[e+7],16,-155497632),i=L(i,o,a,n,t[e+10],23,-1094730640),n=L(n,i,o,a,t[e+13],4,681279174),a=L(a,n,i,o,t[e],11,-358537222),o=L(o,a,n,i,t[e+3],16,-722521979),i=L(i,o,a,n,t[e+6],23,76029189),n=L(n,i,o,a,t[e+9],4,-640364487),a=L(a,n,i,o,t[e+12],11,-421815835),o=L(o,a,n,i,t[e+15],16,530742520),i=L(i,o,a,n,t[e+2],23,-995338651),n=R(n,i,o,a,t[e],6,-198630844),a=R(a,n,i,o,t[e+7],10,1126891415),o=R(o,a,n,i,t[e+14],15,-1416354905),i=R(i,o,a,n,t[e+5],21,-57434055),n=R(n,i,o,a,t[e+12],6,1700485571),a=R(a,n,i,o,t[e+3],10,-1894986606),o=R(o,a,n,i,t[e+10],15,-1051523),i=R(i,o,a,n,t[e+1],21,-2054922799),n=R(n,i,o,a,t[e+8],6,1873313359),a=R(a,n,i,o,t[e+15],10,-30611744),o=R(o,a,n,i,t[e+6],15,-1560198380),i=R(i,o,a,n,t[e+13],21,1309151649),n=R(n,i,o,a,t[e+4],6,-145523070),a=R(a,n,i,o,t[e+11],10,-1120210379),o=R(o,a,n,i,t[e+2],15,718787259),i=R(i,o,a,n,t[e+9],21,-343485551),n=C(n,r),i=C(i,s),o=C(o,f),a=C(a,u)}return Uint32Array.of(n,i,o,a)}(function(t){if(0===t.length)return new Uint32Array;const e=new Uint32Array(M(8*t.length)).fill(0);for(let r=0;r<t.length;r++)e[r>>2]|=(255&t[r])<<r%4*8;return e}(t),8*t.length))};const z="6ba7b810-9dad-11d1-80b4-00c04fd430c8",N="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function q(t,e,r,n,i,o){const a="string"==typeof r?function(t){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}(r):r,s="string"==typeof n?A(n):n;if("string"==typeof n&&(n=A(n)),16!==n?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+a.length);if(f.set(s),f.set(a,s.length),f=e(f),f[6]=15&f[6]|t,f[8]=63&f[8]|128,i){o=o||0;for(let t=0;t<16;++t)i[o+t]=f[t];return i}return j(f)}function B(t,e,r,n){return q(48,T,t,e,r,n)}B.DNS=z,B.URL=N;const H={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const W=function(t,e,r){if(H.randomUUID&&!e&&!t)return H.randomUUID();const n=(t=t||{}).random??t.rng?.()??function(){if(!k){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");k=crypto.getRandomValues.bind(crypto)}return k(x)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){if((r=r||0)<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[r+t]=n[t];return e}return j(n)};function V(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:case 3:return e^r^n;case 2:return e&r^e&n^r&n}}function K(t,e){return t<<e|t>>>32-e}const G=function(t){const e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(t.length+1);n.set(t),n[t.length]=128;const i=(t=n).length/4+2,o=Math.ceil(i/16),a=new Array(o);for(let e=0;e<o;++e){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=t[64*e+4*n]<<24|t[64*e+4*n+1]<<16|t[64*e+4*n+2]<<8|t[64*e+4*n+3];a[e]=r}a[o-1][14]=8*(t.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const n=new Uint32Array(80);for(let e=0;e<16;++e)n[e]=a[t][e];for(let t=16;t<80;++t)n[t]=K(n[t-3]^n[t-8]^n[t-14]^n[t-16],1);let i=r[0],o=r[1],s=r[2],f=r[3],u=r[4];for(let t=0;t<80;++t){const r=Math.floor(t/20),a=K(i,5)+V(r,o,s,f)+u+e[r]+n[t]>>>0;u=f,f=s,s=K(o,30)>>>0,o=i,i=a}r[0]=r[0]+i>>>0,r[1]=r[1]+o>>>0,r[2]=r[2]+s>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+u>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])};function Q(t,e,r,n){return q(80,G,t,e,r,n)}Q.DNS=z,Q.URL=N;function Z(){const t="nutrient-analytics-user-id";if(!window||!window.localStorage)return null;try{if(window.localStorage.getItem(t))return window.localStorage.getItem(t);const e=W();return window.localStorage.setItem(t,e),e}catch{return null}}class J{constructor(){c(this,"maxQueueSize",1e3),c(this,"flushTimer",null),c(this,"visibilityChangeHandler",null),c(this,"isFlushing",!1),c(this,"queue",[]),c(this,"allEvents",[])}static getInstance(){return J.instance||(J.instance=new J),J.instance}emit(t){this.collect(t)}configure(t){const{hmacSecret:e,endpoint:r,flushInterval:n,maxQueueSize:i,clientInfo:o}=t;this.clientInfo=o,this.hmacSecret=this.hexStringToHmacSecret(e),this.endpoint=r,void 0!==i&&(this.maxQueueSize=i),this.isE2E()||(this.flushTimer=setInterval(()=>this.flush(),n||3e3),this.visibilityChangeHandler=()=>{"hidden"===document.visibilityState&&this.queue.length>0&&this.flush()},document.addEventListener("visibilitychange",this.visibilityChangeHandler))}cleanup(){null!==this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),null!==this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}static cleanup(){J.instance&&(J.instance.cleanup(),J.instance=void 0)}shouldBeIgnored(t){switch(t.name){case"content|editor|save":return!!this.allEvents.find(e=>e.name===t.name&&Math.abs(e.timestamp-t.timestamp)<1e3);case"form|creator|field|add":return!this.allEvents.find(t=>"form|creator|enter"===t.name);case"annotation|edit":return!!this.allEvents.find(e=>e.name===t.name&&Math.abs(e.timestamp-t.timestamp)<100);default:return!1}}collect(t){if(this.isE2E()){const e=window;if(e.__PSPDFKIT_ANALYTICS_EVENTS__??=[],this.shouldBeIgnored(t))return;return this.allEvents.push(t),void e.__PSPDFKIT_ANALYTICS_EVENTS__.push(t)}this.shouldBeIgnored(t)||(this.allEvents.push(t),this.queue.length>=this.maxQueueSize&&this.queue.shift(),this.queue.push(t))}async flush(){if(this.isFlushing||this.isE2E()||0===this.queue.length)return;this.isFlushing=!0;const t=this.queue.splice(0,this.queue.length);try{const{prepareUpload:e}=await n.e(825).then(n.bind(n,825)),r=t.map(t=>({type:"counter",name:t.name,attributes:Object.fromEntries(Object.entries(t.attributes).map(t=>{let[e,r]=t;return[e,String(r)]})),timestamp:t.timestamp})),i=await e({clientInfo:{...this.clientInfo,tag:Z()??void 0},hmacSecret:this.hmacSecret},r);if(!i)return void this.requeue(t);const o=`${this.endpoint}/proto/metrics`,a=await fetch(o,{method:"POST",headers:i.headers,body:i.body,keepalive:!0});if(!a.ok)throw new Error(`Analytics request failed with status ${a.status}`)}catch(e){this.requeue(t)}finally{this.isFlushing=!1}}requeue(t){const e=this.maxQueueSize-this.queue.length;if(e<=0)return;const r=t.slice(0,e);this.queue.unshift(...r)}isE2E(){return"undefined"!=typeof window&&Boolean(window.__E2E_TEST__)}hexStringToHmacSecret(t){if(128!==t.length)throw new Error(`Invalid hex string length: expected 128 characters, got ${t.length}`);return new Uint8Array(Array.from(t,t=>t.charCodeAt(0)))}}function Y(t){var e,r;e="convert|from|office",r={feature:"office_conversion",mimeType:t},J.getInstance().emit({name:e,attributes:r??{},timestamp:Date.now()})}c(J,"instance",void 0);const X="/create.pdf",tt="/save.pdf",et="/create.docx",rt="/save.docx",nt="/templateData.json",it="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let ot=null,at=null;function st(t){let e;a(at,"GdPicture WebAssembly is not loaded.");for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(const t of n)e=Object.assign(n[0],t);const o=JSON.stringify({type:t,...e}),s=JSON.parse(at.CommandHandler(o));if(!s.success)throw new Error(s.errorReason+": "+s.errorMessage+"\\n"+s.error);return s}const ft={allMarkup:0,simpleMarkup:1,noMarkup:2,original:3},ut=ft.noMarkup,ct={documentMarkupMode:ut};function lt(t){if(!t)return ct;if(!t.documentMarkupMode)return{...t,documentMarkupMode:ut};if(!(t.documentMarkupMode in ft))throw new Error(`Invalid documentMarkupMode value: ${t.documentMarkupMode}. Allowed values are: ${Object.keys(ft).join(", ")}`);return{...t,documentMarkupMode:ft[t.documentMarkupMode]}}const dt={"application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","text/plain":"txt"},pt=new class{_mountCustomFonts(t,e){a(ot,"WebAssembly module not loaded."),ot.FS.mkdir(e);{const r=it?ot.FS.filesystems.WORKERFS:ot.FS.filesystems.MEMFS;ot.FS.mount(r,{blobs:t},e)}}async loadModule(t,e,r,n,i,o,a){const{Assemblies:s,Module:f}=await async function(t,e){if("string"==typeof t){const r="nutrient-viewer-lib/",n=`${r}gdpicture-c414c4b9/jit`,i=`${r}gdpicture-c414c4b9/aot`;let o,a;e?(o=`${t}${i}/initDotnet.js`,a=`${t}${i}`):(o=`${t}${n}/initDotnet.js`,a=`${t}${n}`);const{initDotnet:s}=await import(o);return s(a,(t,e,r,n,i)=>"blazor.boot.json"===e?fetch(r,{credentials:"same-origin"}):null)}throw new Error("GdPicture WASM loader not implemented")}(t,e);at=s.GdPictureWasm.API,ot=f,st("gdpicture/setLicense",{origin:r},{licenseKey:n||"DEMO_PSPDFKIT_WEB"});const u=i?"/fonts":"";if(i&&!ot.FS.analyzePath(u).exists&&(this._mountCustomFonts(i,u),st("gdpicture/setFonts",{fontPaths:[u]})),o){const t=await l(o);st("gdpicture/setDynamicFontLoading",{baseUrl:o.split("/").slice(0,-1).join("/"),allowedFonts:t.availableFonts,v:1})}a&&st("gdpicture/setFontSubstitutions",{fontSubstitutions:a})}toPdf(t,e,r,n,i){let o=X;if(i&&"pdf"!==i&&Object.values(dt).includes(i)){Y(Object.keys(dt).find(t=>dt[t].toLowerCase()===i.toLowerCase()).toLowerCase()),o+=`.${i}`}else if(n&&"application/pdf"!==n){const t=n.toLowerCase();Y(t);const e=dt.hasOwnProperty(t)&&dt[t];e&&(o+=`.${e}`)}ot.FS.writeFile(o,new Uint8Array(t),{canOwn:!0});const a={file:tt,format:"pdf",conformance:e&&e in d?e:void 0,officeConversionSettings:lt(r)};try{return st("gdpicture/process",{input:{file:o},output:a}),ot.FS.readFile(tt).buffer}finally{try{ot.FS.unlink(tt),ot.FS.unlink(o)}catch(t){}}}toOffice(t,e){ot.FS.writeFile(X,new Uint8Array(t));const r=`/save.${e}`;try{return st("gdpicture/process",{input:{file:X},output:{file:r,format:e}}),ot.FS.readFile(r).buffer}finally{try{ot.FS.unlink(r),ot.FS.unlink(X)}catch(t){console.log(t.message)}}}async populateDocumentTemplate(t,e){ot.FS.writeFile(et,new Uint8Array(t));const{serializedData:r}=await b(e);ot.FS.writeFile(nt,r);try{return st("gdpicture/process-office-template",{inputFile:et,modelAndConfigFile:nt,outputFile:rt}),ot.FS.readFile(rt).buffer}finally{try{ot.FS.unlink(rt),ot.FS.unlink(nt),ot.FS.unlink(et)}catch(t){console.log(t.message)}}}},mt=self;mt.global=mt,mt.module={},mt.onmessage=async t=>{let e,r,{data:n}=t;try{const t=await pt[n.action](...n.args);if(e={id:n.id,result:t},Array.isArray(t)){const e=t.filter(t=>t instanceof ArrayBuffer);e.length>0&&(r=e)}t instanceof ArrayBuffer&&(r=[t])}catch(t){const i=[...n.args].filter(t=>t instanceof ArrayBuffer);i.length>0&&(r=i),e={id:n.id,error:t.message||t.toString(),callArgs:n.args}}mt.postMessage(e,r)}})();',"Worker",void 0,void 0)}},37737(t){function e(t){var e=function(){var t=self||window;if(void 0===t.trustedTypes)return null;try{return t.trustedTypes.createPolicy("nutrient-web-sdk#webpack-worker",{createScriptURL:function(t){return t}})}catch(e){return t.trustedTypes.defaultPolicy||null}}();return e?e.createScriptURL(t):t}t.exports=function(t,r,n,i){var o=self||window;try{try{var a,s="\n        // Trusted Types policy for worker context - use Webpack's policy naming\n        if (typeof trustedTypes !== 'undefined') {\n          try {\n            var workerPolicy = trustedTypes.createPolicy('nutrient-web-sdk#webpack-worker', {\n              createScriptURL: function(s) { return s; }\n            });\n            // Wrap importScripts to use Trusted Types\n            var originalImportScripts = importScripts;\n            importScripts = function() {\n              var args = Array.prototype.slice.call(arguments);\n              var trustedArgs = args.map(function(url) {\n                return workerPolicy.createScriptURL(url);\n              });\n              return originalImportScripts.apply(this, trustedArgs);\n            };\n          } catch (e) {\n            // Policy creation failed, continue without Trusted Types\n          }\n        }\n      "+t;try{a=new o.Blob([s])}catch(t){(a=new(o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder)).append(s),a=a.getBlob()}var u=o.URL||o.webkitURL,c=u.createObjectURL(a),f=e(c),l=new o[r](f,n);return u.revokeObjectURL(c),l}catch(i){var d=e("data:application/javascript,".concat(encodeURIComponent(t)));return new o[r](d,n)}}catch(t){if(!i)throw Error("Inline worker is not supported");var p=e(i);return new o[r](p,n)}}}}]);