/*!
 * Nutrient Web SDK 1.14.0-0ff9156 (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/
 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NutrientViewer=t():e.NutrientViewer=t()}(globalThis,()=>(()=>{"use strict";var e,t,r,n={},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,o),r.exports}o.m=n,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"nutrient-viewer-lib/chunk-"+e+"-"+{340:"51927a67ca845d1f",567:"ad4d86731adcbbe1"}[e]+".js",o.miniCssF=e=>{},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="NutrientViewer:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var s,u;if(void 0!==i)for(var f=document.getElementsByTagName("script"),c=0;c<f.length;c++){var l=f[c];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){s=l;break}}s||(u=!0,(s=document.createElement("script")).charset="utf-8",o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",t+i),s.src=o.tu(r)),e[r]=[n];var d=(t,n)=>{s.onerror=s.onload=null,clearTimeout(p);var i=e[r];if(delete e[r],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach(e=>e(n)),t)return t(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),u&&document.head.appendChild(s)}},o.tt=()=>(void 0===r&&(r={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(r=trustedTypes.createPolicy("nutrient-web-sdk#webpack",r))),r),o.tu=e=>o.tt().createScriptURL(e),o.p="",(()=>{var e={374:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,i)=>n=e[t]=[r,i]);r.push(n[2]=i);var a=o.p+o.u(t),s=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,n[1](s)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,s,u]=r,f=0;if(a.some(t=>0!==e[t])){for(n in s)o.o(s,n)&&(o.m[n]=s[n]);if(u)u(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();const a=function e(t){let r;return r=t instanceof Error?t:new Error(t),Object.setPrototypeOf(r,e.prototype),r};a.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const s=a;function u(e,t){if(!e)throw new s(`Assertion failed: ${t||"Condition not met"}\n\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}function f(e){return"[object Object]"===Object.prototype.toString.call(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 c(e){return c="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},c(e)}function l(e){var t=function(e,t){if("object"!=c(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==c(t)?t:t+""}function d(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}new WeakMap;async function p(e){const t=(await async function(e){try{const t=await fetch(e).catch(t=>{throw new s(`Error fetching dynamic fonts file ${e}. ${t}`)});if(200!==t.status)throw new s(`Error fetching dynamic fonts file ${e}. Status code: ${t.status}`);return t}catch(e){throw e}}(e)).json().catch(t=>{throw new s(`Error parsing dynamic fonts file ${e}. ${t}`)});return t}let m=function(e){return e[e.pdf_a_1a=0]="pdf_a_1a",e[e.pdf_a_1b=1]="pdf_a_1b",e[e.pdf_a_2a=2]="pdf_a_2a",e[e.pdf_a_2u=3]="pdf_a_2u",e[e.pdf_a_2b=4]="pdf_a_2b",e[e.pdf_a_3a=5]="pdf_a_3a",e[e.pdf_a_3u=6]="pdf_a_3u",e[e.pdf_a_3b=7]="pdf_a_3b",e[e.pdf_a_4=8]="pdf_a_4",e[e.pdf_a_4e=9]="pdf_a_4e",e[e.pdf_a_4f=10]="pdf_a_4f",e}({});const h=/^data:([^;,]+)?;base64,(.*)$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(?:==)?|[A-Za-z0-9+/]{3}=?)?$/,w=new Set(["original","fixed","fit-width","fit-height","fit-max"]),b=new Set(["png","jpg","gif","bmp","tif"]),y={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tif","image/x-tiff":"tif"};async function v(e){const t={urlImageReferences:[]},r=S(e.model,"$.model",t);if(t.urlImageReferences.length>0){const e=await async function(e){const t=Array.from(new Set(e.map(e=>e.normalizedUrl))),r=new Map;for(const t of e){if(!t.preferredFormat)continue;const e=r.get(t.normalizedUrl);if(e){if(e.format!==t.preferredFormat)throw new Error(`Conflicting image formats for URL "${t.normalizedUrl}" between ${e.path} and ${t.path}.`)}else r.set(t.normalizedUrl,{format:t.preferredFormat,path:t.path})}const n=await Promise.all(t.map(e=>async function(e,t){let r;try{r=await fetch(e)}catch(t){throw new Error(`Failed to fetch ${e}. 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 ${e}: ${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(e){if(!e)return;const t=e.toLowerCase().split(";")[0].trim();return y[t]}(i),a=function(e){try{const t=new URL(e).pathname,r=t.split(".").pop()?.toLowerCase();if(!r)return;return U(r)??void 0}catch(e){return}}(e),s=t??o??a;if(!s)throw new Error(`Failed to infer image format for ${e}. Provide "format" in the image object.`);return{normalizedUrl:e,base64Data:E(n),format:s}}(e,r.get(e)?.format)));return new Map(n.map(e=>[e.normalizedUrl,e]))}(t.urlImageReferences);!function(e,t){for(const r of e){const e=t.get(r.normalizedUrl);r.image.source="base64",r.image.data=e.base64Data,null==r.image.format&&e.format&&(r.image.format=e.format),delete r.image.url,delete r.image.path}}(t.urlImageReferences,e)}const n=function(e){if(null==e)return{start:"{",end:"}"};if(!f(e))throw new Error("$.config must be a valid object.");const t=e.delimiter;if(null==t)return{start:"{",end:"}"};if(!f(t))throw new Error("$.config.delimiter must be a valid object.");const{start:r,end:n}=t;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:"}"}}(e.config);return{serializedData:JSON.stringify({config:{delimiter:n},model:r},null,2)}}function S(e,t,r){if(Array.isArray(e))return e.map((e,n)=>S(e,`${t}[${n}]`,r));if(!f(e))return e;if(function(e){return f(e)&&"image"===e._type}(e))return function(e,t,r){const n={...e},i=function(e,t){if("string"!=typeof e)throw new Error(`${t}.source must be a string.`);if("dataUrl"===e)return"base64";if("base64"===e||"url"===e)return e;if("file"===e)throw new Error(`${t}.source "file" is not supported in public APIs. Use "base64" (or "dataUrl") or "url".`);throw new Error(`${t}.source must be one of "base64", "dataUrl", or "url". Received "${e}".`)}(n.source,t);n.source=i,function(e,t){if(void 0===e.sizing)return;if(!w.has(e.sizing))throw new Error(`${t}.sizing must be one of "original", "fixed", "fit-width", "fit-height", "fit-max".`);switch(e.sizing){case"fixed":case"fit-max":_(e.width,`${t}.width`),_(e.height,`${t}.height`);break;case"fit-width":_(e.width,`${t}.width`);break;case"fit-height":_(e.height,`${t}.height`)}}(n,t),function(e,t){if(void 0===e.pageNumber)return;if(!Number.isInteger(e.pageNumber)||e.pageNumber<=0)throw new Error(`${t}.pageNumber must be a positive integer.`)}(n,t);const o=function(e,t){if(void 0===e)return;if("string"!=typeof e)throw new Error(`${t}.format must be a string.`);if("svg"===e.toLowerCase().trim())throw new Error(`${t}.format svg is not supported in this release.`);const r=U(e);if(!r)throw new Error(`${t}.format must be one of "png", "jpg"/"jpeg", "gif", "bmp", "tif"/"tiff".`);return r}(n.format,t);o&&(n.format=o);switch(i){case"base64":{const e=n.data;if("string"!=typeof e||""===e.trim())throw new Error(`${t}.data must be a non-empty string.`);const r=function(e,t){const r=h.exec(e.trim());if(r){const e=(r[1]||"").toLowerCase(),n=r[2];if(!n)throw new Error(`${t} must contain non-empty base64 data.`);if("image/svg+xml"===e)throw new Error(`${t} does not support svg images in this release.`);return $(n,t),{isDataUrl:!0}}return $(e.trim(),t),{isDataUrl:!1}}(e,`${t}.data`);if(!r.isDataUrl&&!n.format)throw new Error(`${t}.format must be supplied when source is raw base64 data.`);break}case"url":{const e="string"==typeof n.url&&""!==n.url.trim()?n.url.trim():"string"==typeof n.path&&""!==n.path.trim()?n.path.trim():null;if(!e)throw new Error(`${t}.url must be supplied when source is "url".`);const i=function(e,t){let r;try{r=new URL(e.trim())}catch(e){throw new Error(`${t} must be a valid absolute URL.`)}if(!["http:","https:"].includes(r.protocol))throw new Error(`${t} must use http or https.`);return r.toString()}(e,`${t}.url`);n.url=i,r.urlImageReferences.push({path:t,image:n,normalizedUrl:i,preferredFormat:n.format});break}}return n}(e,t,r);const n={};for(const[i,o]of Object.entries(e))n[i]=S(o,`${t}${F(i)}`,r);return n}function E(e){if("undefined"!=typeof Buffer)return Buffer.from(e).toString("base64");let t="";for(let r=0;r<e.length;r+=32768){const n=e.subarray(r,r+32768);t+=String.fromCharCode(...n)}return btoa(t)}function $(e,t){const r=e.replace(/\s+/g,"");if(""===r||!g.test(r))throw new Error(`${t} must be valid base64 data.`)}function _(e,t){if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error(`${t} must be a positive number.`)}function U(e){const t=e.toLowerCase().trim();return"jpeg"===t?"jpg":"tiff"===t?"tif":b.has(t)?t:null}function F(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`.${e}`:`[${JSON.stringify(e)}]`}const A=/^(?:[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 k=function(e){return"string"==typeof e&&A.test(e)};const j=function(e){if(!k(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)};const x=[];for(let e=0;e<256;++e)x.push((e+256).toString(16).slice(1));function I(e,t=0){return(x[e[t+0]]+x[e[t+1]]+x[e[t+2]]+x[e[t+3]]+"-"+x[e[t+4]]+x[e[t+5]]+"-"+x[e[t+6]]+x[e[t+7]]+"-"+x[e[t+8]]+x[e[t+9]]+"-"+x[e[t+10]]+x[e[t+11]]+x[e[t+12]]+x[e[t+13]]+x[e[t+14]]+x[e[t+15]]).toLowerCase()}let C;const M=new Uint8Array(16);function T(e){return 14+(e+64>>>9<<4)+1}function P(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function L(e,t,r,n,i,o){return P((a=P(P(t,e),P(n,o)))<<(s=i)|a>>>32-s,r);var a,s}function O(e,t,r,n,i,o,a){return L(t&r|~t&n,e,t,i,o,a)}function D(e,t,r,n,i,o,a){return L(t&n|r&~n,e,t,i,o,a)}function R(e,t,r,n,i,o,a){return L(t^r^n,e,t,i,o,a)}function z(e,t,r,n,i,o,a){return L(r^(t|~n),e,t,i,o,a)}const N=function(e){return function(e){const t=new Uint8Array(4*e.length);for(let r=0;r<4*e.length;r++)t[r]=e[r>>2]>>>r%4*8&255;return t}(function(e,t){const r=new Uint32Array(T(t)).fill(0);r.set(e),r[t>>5]|=128<<t%32,r[r.length-1]=t,e=r;let n=1732584193,i=-271733879,o=-1732584194,a=271733878;for(let t=0;t<e.length;t+=16){const r=n,s=i,u=o,f=a;n=O(n,i,o,a,e[t],7,-680876936),a=O(a,n,i,o,e[t+1],12,-389564586),o=O(o,a,n,i,e[t+2],17,606105819),i=O(i,o,a,n,e[t+3],22,-1044525330),n=O(n,i,o,a,e[t+4],7,-176418897),a=O(a,n,i,o,e[t+5],12,1200080426),o=O(o,a,n,i,e[t+6],17,-1473231341),i=O(i,o,a,n,e[t+7],22,-45705983),n=O(n,i,o,a,e[t+8],7,1770035416),a=O(a,n,i,o,e[t+9],12,-1958414417),o=O(o,a,n,i,e[t+10],17,-42063),i=O(i,o,a,n,e[t+11],22,-1990404162),n=O(n,i,o,a,e[t+12],7,1804603682),a=O(a,n,i,o,e[t+13],12,-40341101),o=O(o,a,n,i,e[t+14],17,-1502002290),i=O(i,o,a,n,e[t+15],22,1236535329),n=D(n,i,o,a,e[t+1],5,-165796510),a=D(a,n,i,o,e[t+6],9,-1069501632),o=D(o,a,n,i,e[t+11],14,643717713),i=D(i,o,a,n,e[t],20,-373897302),n=D(n,i,o,a,e[t+5],5,-701558691),a=D(a,n,i,o,e[t+10],9,38016083),o=D(o,a,n,i,e[t+15],14,-660478335),i=D(i,o,a,n,e[t+4],20,-405537848),n=D(n,i,o,a,e[t+9],5,568446438),a=D(a,n,i,o,e[t+14],9,-1019803690),o=D(o,a,n,i,e[t+3],14,-187363961),i=D(i,o,a,n,e[t+8],20,1163531501),n=D(n,i,o,a,e[t+13],5,-1444681467),a=D(a,n,i,o,e[t+2],9,-51403784),o=D(o,a,n,i,e[t+7],14,1735328473),i=D(i,o,a,n,e[t+12],20,-1926607734),n=R(n,i,o,a,e[t+5],4,-378558),a=R(a,n,i,o,e[t+8],11,-2022574463),o=R(o,a,n,i,e[t+11],16,1839030562),i=R(i,o,a,n,e[t+14],23,-35309556),n=R(n,i,o,a,e[t+1],4,-1530992060),a=R(a,n,i,o,e[t+4],11,1272893353),o=R(o,a,n,i,e[t+7],16,-155497632),i=R(i,o,a,n,e[t+10],23,-1094730640),n=R(n,i,o,a,e[t+13],4,681279174),a=R(a,n,i,o,e[t],11,-358537222),o=R(o,a,n,i,e[t+3],16,-722521979),i=R(i,o,a,n,e[t+6],23,76029189),n=R(n,i,o,a,e[t+9],4,-640364487),a=R(a,n,i,o,e[t+12],11,-421815835),o=R(o,a,n,i,e[t+15],16,530742520),i=R(i,o,a,n,e[t+2],23,-995338651),n=z(n,i,o,a,e[t],6,-198630844),a=z(a,n,i,o,e[t+7],10,1126891415),o=z(o,a,n,i,e[t+14],15,-1416354905),i=z(i,o,a,n,e[t+5],21,-57434055),n=z(n,i,o,a,e[t+12],6,1700485571),a=z(a,n,i,o,e[t+3],10,-1894986606),o=z(o,a,n,i,e[t+10],15,-1051523),i=z(i,o,a,n,e[t+1],21,-2054922799),n=z(n,i,o,a,e[t+8],6,1873313359),a=z(a,n,i,o,e[t+15],10,-30611744),o=z(o,a,n,i,e[t+6],15,-1560198380),i=z(i,o,a,n,e[t+13],21,1309151649),n=z(n,i,o,a,e[t+4],6,-145523070),a=z(a,n,i,o,e[t+11],10,-1120210379),o=z(o,a,n,i,e[t+2],15,718787259),i=z(i,o,a,n,e[t+9],21,-343485551),n=P(n,r),i=P(i,s),o=P(o,u),a=P(a,f)}return Uint32Array.of(n,i,o,a)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(T(8*e.length)).fill(0);for(let r=0;r<e.length;r++)t[r>>2]|=(255&e[r])<<r%4*8;return t}(e),8*e.length))};const q="6ba7b810-9dad-11d1-80b4-00c04fd430c8",B="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function V(e,t,r,n,i,o){const a="string"==typeof r?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}(r):r,s="string"==typeof n?j(n):n;if("string"==typeof n&&(n=j(n)),16!==n?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);if(u.set(s),u.set(a,s.length),u=t(u),u[6]=15&u[6]|e,u[8]=63&u[8]|128,i){o=o||0;for(let e=0;e<16;++e)i[o+e]=u[e];return i}return I(u)}function H(e,t,r,n){return V(48,N,e,t,r,n)}H.DNS=q,H.URL=B;const W={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const K=function(e,t,r){if(W.randomUUID&&!t&&!e)return W.randomUUID();const n=(e=e||{}).random??e.rng?.()??function(){if(!C){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");C=crypto.getRandomValues.bind(crypto)}return C(M)}();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,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=n[e];return t}return I(n)};function G(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function Q(e,t){return e<<t|e>>>32-t}const Z=function(e){const t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128;const i=(e=n).length/4+2,o=Math.ceil(i/16),a=new Array(o);for(let t=0;t<o;++t){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];a[t]=r}a[o-1][14]=8*(e.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=a[e][t];for(let e=16;e<80;++e)n[e]=Q(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let i=r[0],o=r[1],s=r[2],u=r[3],f=r[4];for(let e=0;e<80;++e){const r=Math.floor(e/20),a=Q(i,5)+G(r,o,s,u)+f+t[r]+n[e]>>>0;f=u,u=s,s=Q(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]+u>>>0,r[4]=r[4]+f>>>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 J(e,t,r,n){return V(80,Z,e,t,r,n)}J.DNS=q,J.URL=B;function Y(){const e="nutrient-analytics-user-id";if(!window||!window.localStorage)return null;try{if(window.localStorage.getItem(e))return window.localStorage.getItem(e);const t=K();return window.localStorage.setItem(e,t),t}catch{return null}}class X{constructor(){d(this,"maxQueueSize",1e3),d(this,"flushTimer",null),d(this,"visibilityChangeHandler",null),d(this,"isFlushing",!1),d(this,"queue",[]),d(this,"allEvents",[])}static getInstance(){return X.instance||(X.instance=new X),X.instance}emit(e){this.collect(e)}configure(e){const{hmacSecret:t,endpoint:r,flushInterval:n,maxQueueSize:i,clientInfo:o}=e;this.clientInfo=o,this.hmacSecret=this.hexStringToHmacSecret(t),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(){X.instance&&(X.instance.cleanup(),X.instance=void 0)}shouldBeIgnored(e){switch(e.name){case"content|editor|save":return!!this.allEvents.find(t=>t.name===e.name&&Math.abs(t.timestamp-e.timestamp)<1e3);case"form|creator|field|add":return!this.allEvents.find(e=>"form|creator|enter"===e.name);case"annotation|edit":return!!this.allEvents.find(t=>t.name===e.name&&Math.abs(t.timestamp-e.timestamp)<100);default:return!1}}collect(e){if(this.isE2E()){const t=window;if(t.__PSPDFKIT_ANALYTICS_EVENTS__??=[],this.shouldBeIgnored(e))return;return this.allEvents.push(e),void t.__PSPDFKIT_ANALYTICS_EVENTS__.push(e)}this.shouldBeIgnored(e)||(this.allEvents.push(e),this.queue.length>=this.maxQueueSize&&this.queue.shift(),this.queue.push(e))}async flush(){if(this.isFlushing||this.isE2E()||0===this.queue.length)return;this.isFlushing=!0;const e=this.queue.splice(0,this.queue.length);try{const{prepareUpload:t}=await Promise.all([o.e(340),o.e(567)]).then(o.bind(o,23948)),r=e.map(e=>({type:"counter",name:e.name,attributes:Object.fromEntries(Object.entries(e.attributes).map(e=>{let[t,r]=e;return[t,String(r)]})),timestamp:e.timestamp})),n=await t({clientInfo:{...this.clientInfo,tag:Y()??void 0},hmacSecret:this.hmacSecret},r);if(!n)return void this.requeue(e);const i=`${this.endpoint}/proto/metrics`,a=await fetch(i,{method:"POST",headers:n.headers,body:n.body,keepalive:!0});if(!a.ok)throw new Error(`Analytics request failed with status ${a.status}`)}catch(t){this.requeue(e)}finally{this.isFlushing=!1}}requeue(e){const t=this.maxQueueSize-this.queue.length;if(t<=0)return;const r=e.slice(0,t);this.queue.unshift(...r)}isE2E(){return"undefined"!=typeof window&&Boolean(window.__E2E_TEST__)}hexStringToHmacSecret(e){if(128!==e.length)throw new Error(`Invalid hex string length: expected 128 characters, got ${e.length}`);return new Uint8Array(Array.from(e,e=>e.charCodeAt(0)))}}function ee(e){var t,r;t="convert|from|office",r={feature:"office_conversion",mimeType:e},X.getInstance().emit({name:t,attributes:r??{},timestamp:Date.now()})}d(X,"instance",void 0);const te="/create.pdf",re="/save.pdf",ne="/create.docx",ie="/save.docx",oe="/templateData.json",ae="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let se=null,ue=null;function fe(e){let t;u(ue,"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 e of n)t=Object.assign(n[0],e);const o=JSON.stringify({type:e,...t}),a=JSON.parse(ue.CommandHandler(o));if(!a.success)throw new Error(a.errorReason+": "+a.errorMessage+"\n"+a.error);return a}const ce={allMarkup:0,simpleMarkup:1,noMarkup:2,original:3},le=ce.noMarkup,de={documentMarkupMode:le};function pe(e){if(!e)return de;if(!e.documentMarkupMode)return{...e,documentMarkupMode:le};if(!(e.documentMarkupMode in ce))throw new Error(`Invalid documentMarkupMode value: ${e.documentMarkupMode}. Allowed values are: ${Object.keys(ce).join(", ")}`);return{...e,documentMarkupMode:ce[e.documentMarkupMode]}}const me={"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"},he=new class{_mountCustomFonts(e,t){u(se,"WebAssembly module not loaded."),se.FS.mkdir(t);{const r=ae?se.FS.filesystems.WORKERFS:se.FS.filesystems.MEMFS;se.FS.mount(r,{blobs:e},t)}}async loadModule(e,t,r,n,i,o,a){const{Assemblies:s,Module:u}=await async function(e,t){if("string"==typeof e){const r="nutrient-viewer-lib/",n=`${r}gdpicture-249e54e8/jit`,i=`${r}gdpicture-249e54e8/aot`;let o,a;t?(o=`${e}${i}/initDotnet.js`,a=`${e}${i}`):(o=`${e}${n}/initDotnet.js`,a=`${e}${n}`);const{initDotnet:s}=await import(o);return s(a,(e,t,r,n,i)=>"blazor.boot.json"===t?fetch(r,{credentials:"same-origin"}):null)}throw new Error("GdPicture WASM loader not implemented")}(e,t);ue=s.GdPictureWasm.API,se=u,fe("gdpicture/setLicense",{origin:r},{licenseKey:n||"DEMO_PSPDFKIT_WEB"});const f=i?"/fonts":"";if(i&&!se.FS.analyzePath(f).exists&&(this._mountCustomFonts(i,f),fe("gdpicture/setFonts",{fontPaths:[f]})),o){const e=await p(o);fe("gdpicture/setDynamicFontLoading",{baseUrl:o.split("/").slice(0,-1).join("/"),allowedFonts:e.availableFonts,v:1})}a&&fe("gdpicture/setFontSubstitutions",{fontSubstitutions:a})}toPdf(e,t,r,n,i){let o=te;if(i&&"pdf"!==i&&Object.values(me).includes(i)){ee(Object.keys(me).find(e=>me[e].toLowerCase()===i.toLowerCase()).toLowerCase()),o+=`.${i}`}else if(n&&"application/pdf"!==n){const e=n.toLowerCase();ee(e);const t=me.hasOwnProperty(e)&&me[e];t&&(o+=`.${t}`)}se.FS.writeFile(o,new Uint8Array(e),{canOwn:!0});const a={file:re,format:"pdf",conformance:t&&t in m?t:void 0,officeConversionSettings:pe(r)};try{return fe("gdpicture/process",{input:{file:o},output:a}),se.FS.readFile(re).buffer}finally{try{se.FS.unlink(re),se.FS.unlink(o)}catch(e){}}}toOffice(e,t){se.FS.writeFile(te,new Uint8Array(e));const r=`/save.${t}`;try{return fe("gdpicture/process",{input:{file:te},output:{file:r,format:t}}),se.FS.readFile(r).buffer}finally{try{se.FS.unlink(r),se.FS.unlink(te)}catch(e){console.log(e.message)}}}async populateDocumentTemplate(e,t){se.FS.writeFile(ne,new Uint8Array(e));const{serializedData:r}=await v(t);se.FS.writeFile(oe,r);try{return fe("gdpicture/process-office-template",{inputFile:ne,modelAndConfigFile:oe,outputFile:ie}),se.FS.readFile(ie).buffer}finally{try{se.FS.unlink(ie),se.FS.unlink(oe),se.FS.unlink(ne)}catch(e){console.log(e.message)}}}},ge=self;return ge.global=ge,ge.module={},ge.addEventListener("message",async e=>{let t,r,{data:n}=e;try{const e=await he[n.action](...n.args);if(t={id:n.id,result:e},Array.isArray(e)){const t=e.filter(e=>e instanceof ArrayBuffer);t.length>0&&(r=t)}e instanceof ArrayBuffer&&(r=[e])}catch(e){const i=[...n.args].filter(e=>e instanceof ArrayBuffer);i.length>0&&(r=i),t={id:n.id,error:e.message||e.toString(),callArgs:n.args}}ge.postMessage(t,r)}),{}})());