UNPKG

@nutrient-sdk/viewer

Version:

View and annotate PDF files in your web app. Full support for mobile and desktop. Runs in the browser using WASM.

13 lines 52.3 kB
/*! * Nutrient Web SDK 1.17.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],{79187(e,t,n){n.d(t,{default:()=>i});var r=n(37737),o=n.n(r);function i(){return o()('/*!\n * Nutrient Web SDK 1.17.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 e,t={},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.m=t,r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,n)=>(r.f[n](e,t),t),[])),r.u=e=>"nutrient-viewer-lib/chunk-"+e+"-7a12efd4e46c4579.worker.js",r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nutrient-web-sdk#webpack",e))),e),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={224:1};r.f.i=(t,n)=>{e[t]||importScripts(r.tu(r.p+r.u(t)))};var t=self.webpackChunkNutrientViewer=self.webpackChunkNutrientViewer||[],n=t.push.bind(t);t.push=t=>{var[o,i,a]=t;for(var s in i)r.o(i,s)&&(r.m[s]=i[s]);for(a&&a(r);o.length;)e[o.pop()]=1;n(t)}})();var o={};r.r(o),r.d(o,{default:()=>_e});const i=function e(t){let n;return n=t instanceof Error?t:new Error(t),Object.setPrototypeOf(n,e.prototype),n};i.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const a=i;function s(e,t){if(!e)throw new a(`Assertion failed: ${t||"Condition not met"}\\n\\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}function l(e){return"[object Object]"===Object.prototype.toString.call(e)}function c(){console.warn(...arguments)}["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 u(e){return u="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},u(e)}function f(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}function p(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}new WeakMap;const{entries:m,setPrototypeOf:d,isFrozen:h,getPrototypeOf:g,getOwnPropertyDescriptor:y}=Object;let{freeze:b,seal:w,create:T}=Object,{apply:S,construct:E}="undefined"!=typeof Reflect&&Reflect;b||(b=function(e){return e}),w||(w=function(e){return e}),S||(S=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),E||(E=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const _=W(Array.prototype.forEach),A=W(Array.prototype.lastIndexOf),v=W(Array.prototype.pop),N=W(Array.prototype.push),R=W(Array.prototype.splice),I=Array.isArray,D=W(String.prototype.toLowerCase),O=W(String.prototype.toString),k=W(String.prototype.match),C=W(String.prototype.replace),x=W(String.prototype.indexOf),L=W(String.prototype.trim),M=W(Number.prototype.toString),U=W(Boolean.prototype.toString),F="undefined"==typeof BigInt?null:W(BigInt.prototype.toString),P="undefined"==typeof Symbol?null:W(Symbol.prototype.toString),z=W(Object.prototype.hasOwnProperty),$=W(Object.prototype.toString),j=W(RegExp.prototype.test),H=(B=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return E(B,t)});var B;function W(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return S(e,t,r)}}function G(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:D;if(d&&d(e,null),!I(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(h(t)||(t[r]=e),o=e)}e[o]=!0}return e}function q(e){for(let t=0;t<e.length;t++){z(e,t)||(e[t]=null)}return e}function Y(e){const t=T(null);for(const[n,r]of m(e)){z(e,n)&&(I(r)?t[n]=q(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=Y(r):t[n]=r)}return t}function X(e,t){for(;null!==e;){const n=y(e,t);if(n){if(n.get)return W(n.get);if("function"==typeof n.value)return W(n.value)}e=g(e)}return function(){return null}}const K=b(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),V=b(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Z=b(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Q=b(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),J=b(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ee=b(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),te=b(["#text"]),ne=b(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),re=b(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),oe=b(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ie=b(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ae=w(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm),se=w(/<%[\\w\\W]*|[\\w\\W]*%>/gm),le=w(/\\$\\{[\\w\\W]*/gm),ce=w(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/),ue=w(/^aria-[\\-\\w]+$/),fe=w(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),pe=w(/^(?:\\w+script|data):/i),me=w(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),de=w(/^html$/i),he=w(/^[a-z][.\\w]*(-[.\\w]+)+$/i);var ge=Object.freeze({__proto__:null,ARIA_ATTR:ue,ATTR_WHITESPACE:me,CUSTOM_ELEMENT:he,DATA_ATTR:ce,DOCTYPE_NAME:de,ERB_EXPR:se,IS_ALLOWED_URI:fe,IS_SCRIPT_OR_DATA:pe,MUSTACHE_EXPR:ae,TMPLIT_EXPR:le});const ye=1,be=3,we=7,Te=8,Se=9,Ee=function(){return"undefined"==typeof window?null:window};var _e=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ee();const n=t=>e(t);if(n.version="3.4.2",n.removed=[],!t||!t.document||t.document.nodeType!==Se||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const o=r,i=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:f=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:h}=t,g=c.prototype,y=X(g,"cloneNode"),w=X(g,"remove"),S=X(g,"nextSibling"),E=X(g,"childNodes"),B=X(g,"parentNode");if("function"==typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let W,q="";const{implementation:ae,createNodeIterator:se,createDocumentFragment:le,getElementsByTagName:ce}=r,{importNode:ue}=o;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof m&&"function"==typeof B&&ae&&void 0!==ae.createHTMLDocument;const{MUSTACHE_EXPR:me,ERB_EXPR:he,TMPLIT_EXPR:_e,DATA_ATTR:Ae,ARIA_ATTR:ve,IS_SCRIPT_OR_DATA:Ne,ATTR_WHITESPACE:Re,CUSTOM_ELEMENT:Ie}=ge;let{IS_ALLOWED_URI:De}=ge,Oe=null;const ke=G({},[...K,...V,...Z,...J,...te]);let Ce=null;const xe=G({},[...ne,...re,...oe,...ie]);let Le=Object.seal(T(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Me=null,Ue=null;const Fe=Object.seal(T(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Pe=!0,ze=!0,$e=!1,je=!0,He=!1,Be=!0,We=!1,Ge=!1,qe=!1,Ye=!1,Xe=!1,Ke=!1,Ve=!0,Ze=!1;const Qe="user-content-";let Je=!0,et=!1,tt={},nt=null;const rt=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ot=null;const it=G({},["audio","video","img","source","image","track"]);let at=null;const st=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lt="http://www.w3.org/1998/Math/MathML",ct="http://www.w3.org/2000/svg",ut="http://www.w3.org/1999/xhtml";let ft=ut,pt=!1,mt=null;const dt=G({},[lt,ct,ut],O);let ht=G({},["mi","mo","mn","ms","mtext"]),gt=G({},["annotation-xml"]);const yt=G({},["title","style","font","a","script"]);let bt=null;const wt=["application/xhtml+xml","text/html"];let Tt=null,St=null;const Et=r.createElement("form"),_t=function(e){return e instanceof RegExp||e instanceof Function},At=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(St&&St===e)return;e&&"object"==typeof e||(e={}),e=Y(e),bt=-1===wt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Tt="application/xhtml+xml"===bt?O:D,Oe=z(e,"ALLOWED_TAGS")&&I(e.ALLOWED_TAGS)?G({},e.ALLOWED_TAGS,Tt):ke,Ce=z(e,"ALLOWED_ATTR")&&I(e.ALLOWED_ATTR)?G({},e.ALLOWED_ATTR,Tt):xe,mt=z(e,"ALLOWED_NAMESPACES")&&I(e.ALLOWED_NAMESPACES)?G({},e.ALLOWED_NAMESPACES,O):dt,at=z(e,"ADD_URI_SAFE_ATTR")&&I(e.ADD_URI_SAFE_ATTR)?G(Y(st),e.ADD_URI_SAFE_ATTR,Tt):st,ot=z(e,"ADD_DATA_URI_TAGS")&&I(e.ADD_DATA_URI_TAGS)?G(Y(it),e.ADD_DATA_URI_TAGS,Tt):it,nt=z(e,"FORBID_CONTENTS")&&I(e.FORBID_CONTENTS)?G({},e.FORBID_CONTENTS,Tt):rt,Me=z(e,"FORBID_TAGS")&&I(e.FORBID_TAGS)?G({},e.FORBID_TAGS,Tt):Y({}),Ue=z(e,"FORBID_ATTR")&&I(e.FORBID_ATTR)?G({},e.FORBID_ATTR,Tt):Y({}),tt=!!z(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?Y(e.USE_PROFILES):e.USE_PROFILES),Pe=!1!==e.ALLOW_ARIA_ATTR,ze=!1!==e.ALLOW_DATA_ATTR,$e=e.ALLOW_UNKNOWN_PROTOCOLS||!1,je=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,He=e.SAFE_FOR_TEMPLATES||!1,Be=!1!==e.SAFE_FOR_XML,We=e.WHOLE_DOCUMENT||!1,Ye=e.RETURN_DOM||!1,Xe=e.RETURN_DOM_FRAGMENT||!1,Ke=e.RETURN_TRUSTED_TYPE||!1,qe=e.FORCE_BODY||!1,Ve=!1!==e.SANITIZE_DOM,Ze=e.SANITIZE_NAMED_PROPS||!1,Je=!1!==e.KEEP_CONTENT,et=e.IN_PLACE||!1,De=function(e){try{return j(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:fe,ft="string"==typeof e.NAMESPACE?e.NAMESPACE:ut,ht=z(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?Y(e.MATHML_TEXT_INTEGRATION_POINTS):G({},["mi","mo","mn","ms","mtext"]),gt=z(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?Y(e.HTML_INTEGRATION_POINTS):G({},["annotation-xml"]);const t=z(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?Y(e.CUSTOM_ELEMENT_HANDLING):T(null);if(Le=T(null),z(t,"tagNameCheck")&&_t(t.tagNameCheck)&&(Le.tagNameCheck=t.tagNameCheck),z(t,"attributeNameCheck")&&_t(t.attributeNameCheck)&&(Le.attributeNameCheck=t.attributeNameCheck),z(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(Le.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),He&&(ze=!1),Xe&&(Ye=!0),tt&&(Oe=G({},te),Ce=T(null),!0===tt.html&&(G(Oe,K),G(Ce,ne)),!0===tt.svg&&(G(Oe,V),G(Ce,re),G(Ce,ie)),!0===tt.svgFilters&&(G(Oe,Z),G(Ce,re),G(Ce,ie)),!0===tt.mathMl&&(G(Oe,J),G(Ce,oe),G(Ce,ie))),Fe.tagCheck=null,Fe.attributeCheck=null,z(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Fe.tagCheck=e.ADD_TAGS:I(e.ADD_TAGS)&&(Oe===ke&&(Oe=Y(Oe)),G(Oe,e.ADD_TAGS,Tt))),z(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Fe.attributeCheck=e.ADD_ATTR:I(e.ADD_ATTR)&&(Ce===xe&&(Ce=Y(Ce)),G(Ce,e.ADD_ATTR,Tt))),z(e,"ADD_URI_SAFE_ATTR")&&I(e.ADD_URI_SAFE_ATTR)&&G(at,e.ADD_URI_SAFE_ATTR,Tt),z(e,"FORBID_CONTENTS")&&I(e.FORBID_CONTENTS)&&(nt===rt&&(nt=Y(nt)),G(nt,e.FORBID_CONTENTS,Tt)),z(e,"ADD_FORBID_CONTENTS")&&I(e.ADD_FORBID_CONTENTS)&&(nt===rt&&(nt=Y(nt)),G(nt,e.ADD_FORBID_CONTENTS,Tt)),Je&&(Oe["#text"]=!0),We&&G(Oe,["html","head","body"]),Oe.table&&(G(Oe,["tbody"]),delete Me.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw H(\'TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.\');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw H(\'TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.\');W=e.TRUSTED_TYPES_POLICY,q=W.createHTML("")}else void 0===W&&(W=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(h,i)),null!==W&&"string"==typeof q&&(q=W.createHTML(""));b&&b(e),St=e},vt=G({},[...V,...Z,...Q]),Nt=G({},[...J,...ee]),Rt=function(e){N(n.removed,{element:e});try{B(e).removeChild(e)}catch(t){w(e)}},It=function(e,t){try{N(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){N(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Ye||Xe)try{Rt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Dt=function(e){let t=null,n=null;if(qe)e="<remove></remove>"+e;else{const t=k(e,/^[\\r\\n\\t ]+/);n=t&&t[0]}"application/xhtml+xml"===bt&&ft===ut&&(e=\'<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>\'+e+"</body></html>");const o=W?W.createHTML(e):e;if(ft===ut)try{t=(new d).parseFromString(o,bt)}catch(e){}if(!t||!t.documentElement){t=ae.createDocument(ft,"template",null);try{t.documentElement.innerHTML=pt?q:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),ft===ut?ce.call(t,We?"html":"body")[0]:We?t.documentElement:i},Ot=function(e){return se.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},kt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof f)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(e){return"function"==typeof l&&e instanceof l};function xt(e,t,r){_(e,e=>{e.call(n,t,r,St)})}const Lt=function(e){let t=null;if(xt(pe.beforeSanitizeElements,e,null),kt(e))return Rt(e),!0;const r=Tt(e.nodeName);if(xt(pe.uponSanitizeElement,e,{tagName:r,allowedTags:Oe}),Be&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&j(/<[/\\w!]/g,e.innerHTML)&&j(/<[/\\w!]/g,e.textContent))return Rt(e),!0;if(Be&&e.namespaceURI===ut&&"style"===r&&Ct(e.firstElementChild))return Rt(e),!0;if(e.nodeType===we)return Rt(e),!0;if(Be&&e.nodeType===Te&&j(/<[/\\w]/g,e.data))return Rt(e),!0;if(Me[r]||!(Fe.tagCheck instanceof Function&&Fe.tagCheck(r))&&!Oe[r]){if(!Me[r]&&Ft(r)){if(Le.tagNameCheck instanceof RegExp&&j(Le.tagNameCheck,r))return!1;if(Le.tagNameCheck instanceof Function&&Le.tagNameCheck(r))return!1}if(Je&&!nt[r]){const t=B(e)||e.parentNode,n=E(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const o=y(n[r],!0);t.insertBefore(o,S(e))}}}return Rt(e),!0}return e instanceof c&&!function(e){let t=B(e);t&&t.tagName||(t={namespaceURI:ft,tagName:"template"});const n=D(e.tagName),r=D(t.tagName);return!!mt[e.namespaceURI]&&(e.namespaceURI===ct?t.namespaceURI===ut?"svg"===n:t.namespaceURI===lt?"svg"===n&&("annotation-xml"===r||ht[r]):Boolean(vt[n]):e.namespaceURI===lt?t.namespaceURI===ut?"math"===n:t.namespaceURI===ct?"math"===n&&gt[r]:Boolean(Nt[n]):e.namespaceURI===ut?!(t.namespaceURI===ct&&!gt[r])&&!(t.namespaceURI===lt&&!ht[r])&&!Nt[n]&&(yt[n]||!vt[n]):!("application/xhtml+xml"!==bt||!mt[e.namespaceURI]))}(e)?(Rt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!j(/<\\/no(script|embed|frames)/i,e.innerHTML)?(He&&e.nodeType===be&&(t=e.textContent,_([me,he,_e],e=>{t=C(t,e," ")}),e.textContent!==t&&(N(n.removed,{element:e.cloneNode()}),e.textContent=t)),xt(pe.afterSanitizeElements,e,null),!1):(Rt(e),!0)},Mt=function(e,t,n){if(Ue[t])return!1;if(Ve&&("id"===t||"name"===t)&&(n in r||n in Et))return!1;const o=Ce[t]||Fe.attributeCheck instanceof Function&&Fe.attributeCheck(t,e);if(ze&&!Ue[t]&&j(Ae,t));else if(Pe&&j(ve,t));else if(!o||Ue[t]){if(!(Ft(e)&&(Le.tagNameCheck instanceof RegExp&&j(Le.tagNameCheck,e)||Le.tagNameCheck instanceof Function&&Le.tagNameCheck(e))&&(Le.attributeNameCheck instanceof RegExp&&j(Le.attributeNameCheck,t)||Le.attributeNameCheck instanceof Function&&Le.attributeNameCheck(t,e))||"is"===t&&Le.allowCustomizedBuiltInElements&&(Le.tagNameCheck instanceof RegExp&&j(Le.tagNameCheck,n)||Le.tagNameCheck instanceof Function&&Le.tagNameCheck(n))))return!1}else if(at[t]);else if(j(De,C(n,Re,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!ot[e]){if($e&&!j(Ne,C(n,Re,"")));else if(n)return!1}else;return!0},Ut=G({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ft=function(e){return!Ut[D(e)]&&j(Ie,e)},Pt=function(e){xt(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||kt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:a,namespaceURI:s,value:l}=i,c=Tt(a),u=l;let f="value"===a?u:L(u);if(r.attrName=c,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,xt(pe.uponSanitizeAttribute,e,r),f=r.attrValue,!Ze||"id"!==c&&"name"!==c||0===x(f,Qe)||(It(a,e),f=Qe+f),Be&&j(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){It(a,e);continue}if("attributename"===c&&k(f,"href")){It(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){It(a,e);continue}if(!je&&j(/\\/>/i,f)){It(a,e);continue}He&&_([me,he,_e],e=>{f=C(f,e," ")});const p=Tt(e.nodeName);if(Mt(p,c,f)){if(W&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(p,c)){case"TrustedHTML":f=W.createHTML(f);break;case"TrustedScriptURL":f=W.createScriptURL(f)}if(f!==u)try{s?e.setAttributeNS(s,a,f):e.setAttribute(a,f),kt(e)?Rt(e):v(n.removed)}catch(t){It(a,e)}}else It(a,e)}xt(pe.afterSanitizeAttributes,e,null)},zt=function(e){let t=null;const n=Ot(e);for(xt(pe.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)xt(pe.uponSanitizeShadowNode,t,null),Lt(t),Pt(t),t.content instanceof a&&zt(t.content);xt(pe.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,s=null,c=null;if(pt=!e,pt&&(e="\\x3c!--\\x3e"),"string"!=typeof e&&!Ct(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return M(e);case"boolean":return U(e);case"bigint":return F?F(e):"0";case"symbol":return P?P(e):"Symbol()";case"undefined":default:return $(e);case"function":case"object":{if(null===e)return $(e);const t=e,n=X(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:$(e)}return $(e)}}}(e)))throw H("dirty is not a string, aborting");if(!n.isSupported)return e;if(Ge||At(t),n.removed=[],"string"==typeof e&&(et=!1),et){const t=e.nodeName;if("string"==typeof t){const e=Tt(t);if(!Oe[e]||Me[e])throw H("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Dt("\\x3c!----\\x3e"),i=r.ownerDocument.importNode(e,!0),i.nodeType===ye&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i);else{if(!Ye&&!He&&!We&&-1===e.indexOf("<"))return W&&Ke?W.createHTML(e):e;if(r=Dt(e),!r)return Ye?null:Ke?q:""}r&&qe&&Rt(r.firstChild);const u=Ot(et?e:r);for(;s=u.nextNode();)Lt(s),Pt(s),s.content instanceof a&&zt(s.content);if(et)return e;if(Ye){if(He){r.normalize();let e=r.innerHTML;_([me,he,_e],t=>{e=C(e,t," ")}),r.innerHTML=e}if(Xe)for(c=le.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(Ce.shadowroot||Ce.shadowrootmode)&&(c=ue.call(o,c,!0)),c}let f=We?r.outerHTML:r.innerHTML;return We&&Oe["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&j(de,r.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+r.ownerDocument.doctype.name+">\\n"+f),He&&_([me,he,_e],e=>{f=C(f,e," ")}),W&&Ke?W.createHTML(f):f},n.setConfig=function(){At(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ge=!0},n.clearConfig=function(){St=null,Ge=!1},n.isValidAttribute=function(e,t,n){St||At({});const r=Tt(e),o=Tt(t);return Mt(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&N(pe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=A(pe[e],t);return-1===n?void 0:R(pe[e],n,1)[0]}return v(pe[e])},n.removeHooks=function(e){pe[e]=[]},n.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();Symbol.for("nutrient.web.trustedTypesPolicy");new Set(["background-color","color","font-family","font-size","font-style","font-weight","text-align","text-decoration"]),new Set(["auto","aqua","black","block","blue","bold","both","bottom","brown","center","collapse","dashed","dotted","fuchsia","gray","green","!important","initial","italic","left","lime","maroon","medium","middle","none","navy","normal","nowrap","olive","pointer","purple","red","right","solid","silver","teal","top","transparent","underline","white","yellow"]);async function Ae(e){const t=(await async function(e){try{const t=await fetch(e).catch(t=>{throw new a(`Error fetching dynamic fonts file ${e}. ${t}`)});if(200!==t.status)throw new a(`Error fetching dynamic fonts file ${e}. Status code: ${t.status}`);return t}catch(e){throw e}}(e)).json().catch(t=>{throw new a(`Error parsing dynamic fonts file ${e}. ${t}`)});return t}let ve=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 Ne=/^data:([^;,]+)?;base64,(.*)$/i,Re=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(?:==)?|[A-Za-z0-9+/]{3}=?)?$/,Ie=new Set(["original","fixed","fit-width","fit-height","fit-max"]),De=new Set(["png","jpg","gif","bmp","tif"]),Oe={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tif","image/x-tiff":"tif"};async function ke(e){const t={urlImageReferences:[]},n=Ce(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))),n=new Map;for(const t of e){if(!t.preferredFormat)continue;const e=n.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 n.set(t.normalizedUrl,{format:t.preferredFormat,path:t.path})}const r=await Promise.all(t.map(e=>async function(e,t){let n;try{n=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(!n.ok)throw new Error(`Failed to fetch ${e}: ${n.status} ${n.statusText}.`);const r=new Uint8Array(await n.arrayBuffer()),o=n.headers.get("content-type");if(o?.toLowerCase().includes("image/svg+xml"))throw new Error("svg format is not supported in this release.");const i=function(e){if(!e)return;const t=e.toLowerCase().split(";")[0].trim();return Oe[t]}(o),a=function(e){try{const t=new URL(e).pathname,n=t.split(".").pop()?.toLowerCase();if(!n)return;return Ue(n)??void 0}catch(e){return}}(e),s=t??i??a;if(!s)throw new Error(`Failed to infer image format for ${e}. Provide "format" in the image object.`);return{normalizedUrl:e,base64Data:xe(r),format:s}}(e,n.get(e)?.format)));return new Map(r.map(e=>[e.normalizedUrl,e]))}(t.urlImageReferences);!function(e,t){for(const n of e){const e=t.get(n.normalizedUrl);n.image.source="base64",n.image.data=e.base64Data,null==n.image.format&&e.format&&(n.image.format=e.format),delete n.image.url,delete n.image.path}}(t.urlImageReferences,e)}const r=function(e){if(null==e)return{delimiter:{start:"{",end:"}"}};if(!l(e))throw new Error("$.config must be a valid object.");const t={...e},n=t.delimiter;return t.delimiter=function(e){if(null==e)return{start:"{",end:"}"};if(!l(e))throw new Error("$.config.delimiter must be a valid object.");const t={...e},{start:n,end:r,objectDelimiter:o}=t;if(null!=n&&"string"!=typeof n)throw new Error("$.config.delimiter.start must be a string.");if(null!=r&&"string"!=typeof r)throw new Error("$.config.delimiter.end must be a string.");if(null!=o&&"string"!=typeof o)throw new Error("$.config.delimiter.objectDelimiter must be a string.");return t.start="string"==typeof n?n:"{",t.end="string"==typeof r?r:"}",t}(n),t}(e.config);return{serializedData:JSON.stringify({config:r,model:n},null,2)}}function Ce(e,t,n){if(Array.isArray(e))return e.map((e,r)=>Ce(e,`${t}[${r}]`,n));if(!l(e))return e;if(function(e){return l(e)&&"image"===e._type}(e))return function(e,t,n){const r={...e},o=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}".`)}(r.source,t);r.source=o,function(e,t){if(void 0===e.sizing)return;if(!Ie.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":Me(e.width,`${t}.width`),Me(e.height,`${t}.height`);break;case"fit-width":Me(e.width,`${t}.width`);break;case"fit-height":Me(e.height,`${t}.height`)}}(r,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.`)}(r,t);const i=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 n=Ue(e);if(!n)throw new Error(`${t}.format must be one of "png", "jpg"/"jpeg", "gif", "bmp", "tif"/"tiff".`);return n}(r.format,t);i&&(r.format=i);switch(o){case"base64":{const e=r.data;if("string"!=typeof e||""===e.trim())throw new Error(`${t}.data must be a non-empty string.`);const n=function(e,t){const n=Ne.exec(e.trim());if(n){const e=(n[1]||"").toLowerCase(),r=n[2];if(!r)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 Le(r,t),{isDataUrl:!0}}return Le(e.trim(),t),{isDataUrl:!1}}(e,`${t}.data`);if(!n.isDataUrl&&!r.format)throw new Error(`${t}.format must be supplied when source is raw base64 data.`);break}case"url":{const e="string"==typeof r.url&&""!==r.url.trim()?r.url.trim():"string"==typeof r.path&&""!==r.path.trim()?r.path.trim():null;if(!e)throw new Error(`${t}.url must be supplied when source is "url".`);const o=function(e,t){let n;try{n=new URL(e.trim())}catch(e){throw new Error(`${t} must be a valid absolute URL.`)}if(!["http:","https:"].includes(n.protocol))throw new Error(`${t} must use http or https.`);return n.toString()}(e,`${t}.url`);r.url=o,n.urlImageReferences.push({path:t,image:r,normalizedUrl:o,preferredFormat:r.format});break}}return r}(e,t,n);const r={};for(const[o,i]of Object.entries(e))r[o]=Ce(i,`${t}${Fe(o)}`,n);return r}function xe(e){if("undefined"!=typeof Buffer)return Buffer.from(e).toString("base64");let t="";for(let n=0;n<e.length;n+=32768){const r=e.subarray(n,n+32768);t+=String.fromCharCode(...r)}return btoa(t)}function Le(e,t){const n=e.replace(/\\s+/g,"");if(""===n||!Re.test(n))throw new Error(`${t} must be valid base64 data.`)}function Me(e,t){if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error(`${t} must be a positive number.`)}function Ue(e){const t=e.toLowerCase().trim();return"jpeg"===t?"jpg":"tiff"===t?"tif":De.has(t)?t:null}function Fe(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`.${e}`:`[${JSON.stringify(e)}]`}const Pe=/^(?:[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 ze=function(e){return"string"==typeof e&&Pe.test(e)};const $e=function(e){if(!ze(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 je=[];for(let e=0;e<256;++e)je.push((e+256).toString(16).slice(1));function He(e,t=0){return(je[e[t+0]]+je[e[t+1]]+je[e[t+2]]+je[e[t+3]]+"-"+je[e[t+4]]+je[e[t+5]]+"-"+je[e[t+6]]+je[e[t+7]]+"-"+je[e[t+8]]+je[e[t+9]]+"-"+je[e[t+10]]+je[e[t+11]]+je[e[t+12]]+je[e[t+13]]+je[e[t+14]]+je[e[t+15]]).toLowerCase()}let Be;const We=new Uint8Array(16);function Ge(e){return 14+(e+64>>>9<<4)+1}function qe(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function Ye(e,t,n,r,o,i){return qe((a=qe(qe(t,e),qe(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function Xe(e,t,n,r,o,i,a){return Ye(t&n|~t&r,e,t,o,i,a)}function Ke(e,t,n,r,o,i,a){return Ye(t&r|n&~r,e,t,o,i,a)}function Ve(e,t,n,r,o,i,a){return Ye(t^n^r,e,t,o,i,a)}function Ze(e,t,n,r,o,i,a){return Ye(n^(t|~r),e,t,o,i,a)}const Qe=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(Ge(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,l=i,c=a;r=Xe(r,o,i,a,e[t],7,-680876936),a=Xe(a,r,o,i,e[t+1],12,-389564586),i=Xe(i,a,r,o,e[t+2],17,606105819),o=Xe(o,i,a,r,e[t+3],22,-1044525330),r=Xe(r,o,i,a,e[t+4],7,-176418897),a=Xe(a,r,o,i,e[t+5],12,1200080426),i=Xe(i,a,r,o,e[t+6],17,-1473231341),o=Xe(o,i,a,r,e[t+7],22,-45705983),r=Xe(r,o,i,a,e[t+8],7,1770035416),a=Xe(a,r,o,i,e[t+9],12,-1958414417),i=Xe(i,a,r,o,e[t+10],17,-42063),o=Xe(o,i,a,r,e[t+11],22,-1990404162),r=Xe(r,o,i,a,e[t+12],7,1804603682),a=Xe(a,r,o,i,e[t+13],12,-40341101),i=Xe(i,a,r,o,e[t+14],17,-1502002290),o=Xe(o,i,a,r,e[t+15],22,1236535329),r=Ke(r,o,i,a,e[t+1],5,-165796510),a=Ke(a,r,o,i,e[t+6],9,-1069501632),i=Ke(i,a,r,o,e[t+11],14,643717713),o=Ke(o,i,a,r,e[t],20,-373897302),r=Ke(r,o,i,a,e[t+5],5,-701558691),a=Ke(a,r,o,i,e[t+10],9,38016083),i=Ke(i,a,r,o,e[t+15],14,-660478335),o=Ke(o,i,a,r,e[t+4],20,-405537848),r=Ke(r,o,i,a,e[t+9],5,568446438),a=Ke(a,r,o,i,e[t+14],9,-1019803690),i=Ke(i,a,r,o,e[t+3],14,-187363961),o=Ke(o,i,a,r,e[t+8],20,1163531501),r=Ke(r,o,i,a,e[t+13],5,-1444681467),a=Ke(a,r,o,i,e[t+2],9,-51403784),i=Ke(i,a,r,o,e[t+7],14,1735328473),o=Ke(o,i,a,r,e[t+12],20,-1926607734),r=Ve(r,o,i,a,e[t+5],4,-378558),a=Ve(a,r,o,i,e[t+8],11,-2022574463),i=Ve(i,a,r,o,e[t+11],16,1839030562),o=Ve(o,i,a,r,e[t+14],23,-35309556),r=Ve(r,o,i,a,e[t+1],4,-1530992060),a=Ve(a,r,o,i,e[t+4],11,1272893353),i=Ve(i,a,r,o,e[t+7],16,-155497632),o=Ve(o,i,a,r,e[t+10],23,-1094730640),r=Ve(r,o,i,a,e[t+13],4,681279174),a=Ve(a,r,o,i,e[t],11,-358537222),i=Ve(i,a,r,o,e[t+3],16,-722521979),o=Ve(o,i,a,r,e[t+6],23,76029189),r=Ve(r,o,i,a,e[t+9],4,-640364487),a=Ve(a,r,o,i,e[t+12],11,-421815835),i=Ve(i,a,r,o,e[t+15],16,530742520),o=Ve(o,i,a,r,e[t+2],23,-995338651),r=Ze(r,o,i,a,e[t],6,-198630844),a=Ze(a,r,o,i,e[t+7],10,1126891415),i=Ze(i,a,r,o,e[t+14],15,-1416354905),o=Ze(o,i,a,r,e[t+5],21,-57434055),r=Ze(r,o,i,a,e[t+12],6,1700485571),a=Ze(a,r,o,i,e[t+3],10,-1894986606),i=Ze(i,a,r,o,e[t+10],15,-1051523),o=Ze(o,i,a,r,e[t+1],21,-2054922799),r=Ze(r,o,i,a,e[t+8],6,1873313359),a=Ze(a,r,o,i,e[t+15],10,-30611744),i=Ze(i,a,r,o,e[t+6],15,-1560198380),o=Ze(o,i,a,r,e[t+13],21,1309151649),r=Ze(r,o,i,a,e[t+4],6,-145523070),a=Ze(a,r,o,i,e[t+11],10,-1120210379),i=Ze(i,a,r,o,e[t+2],15,718787259),o=Ze(o,i,a,r,e[t+9],21,-343485551),r=qe(r,n),o=qe(o,s),i=qe(i,l),a=qe(a,c)}return Uint32Array.of(r,o,i,a)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(Ge(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 Je="6ba7b810-9dad-11d1-80b4-00c04fd430c8",et="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function tt(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?$e(r):r;if("string"==typeof r&&(r=$e(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(s),l.set(a,s.length),l=t(l),l[6]=15&l[6]|e,l[8]=63&l[8]|128,o){if((i=i||0)<0||i+16>o.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)o[i+e]=l[e];return o}return He(l)}function nt(e,t,n,r){return tt(48,Qe,e,t,n,r)}nt.DNS=Je,nt.URL=et;const rt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const ot=function(e,t,n){if(rt.randomUUID&&!t&&!e)return rt.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Be){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Be=crypto.getRandomValues.bind(crypto)}return Be(We)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return He(r)};function it(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 at(e,t){return e<<t|e>>>32-t}const st=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]=at(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let o=n[0],i=n[1],s=n[2],l=n[3],c=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),a=at(o,5)+it(n,i,s,l)+c+t[n]+r[e]>>>0;c=l,l=s,s=at(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]+l>>>0,n[4]=n[4]+c>>>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 lt(e,t,n,r){return tt(80,st,e,t,n,r)}lt.DNS=Je,lt.URL=et;function ct(){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=ot();return window.localStorage.setItem(e,t),t}catch{return null}}class ut{constructor(){p(this,"maxQueueSize",1e3),p(this,"flushTimer",null),p(this,"visibilityChangeHandler",null),p(this,"isFlushing",!1),p(this,"queue",[]),p(this,"allEvents",[])}static getInstance(){return ut.instance||(ut.instance=new ut),ut.instance}emit(e){this.collect(e)}configure(e){const{hmacSecret:t,endpoint:n,flushInterval:r,maxQueueSize:o,clientInfo:i}=e;this.clientInfo=i,this.hmacSecret=this.hexStringToHmacSecret(t),this.endpoint=n,void 0!==o&&(this.maxQueueSize=o),this.isE2E()||(this.flushTimer=setInterval(()=>this.flush(),r||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(){ut.instance&&(ut.instance.cleanup(),ut.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 t=await this.uploadBatch(e);this.requeue(t)}finally{this.isFlushing=!1}}async uploadBatch(e){try{const t=await this.prepareUpload(e);if(!t)return e;const n=`${this.endpoint}/proto/metrics`,r=await fetch(n,{method:"POST",headers:t.headers,body:t.body,keepalive:!0});return r.ok?[]:413===r.status?this.splitAndRetryBatch(e):e}catch(t){return e}}async splitAndRetryBatch(e){if(e.length<=1)return c("Dropping one analytics event: metrics endpoint rejected a single-event payload as too large (HTTP 413)."),[];const t=Math.floor(e.length/2),n=e.slice(0,t),r=e.slice(t);return[...await this.uploadBatch(n),...await this.uploadBatch(r)]}async prepareUpload(e){const{prepareUpload:t}=await r.e(943).then(r.bind(r,943));return t({clientInfo:{...this.clientInfo,tag:ct()??void 0},hmacSecret:this.hmacSecret},this.buildMetrics(e))}buildMetrics(e){return e.map(e=>({type:"counter",name:e.name,attributes:Object.fromEntries(Object.entries(e.attributes).map(e=>{let[t,n]=e;return[t,String(n)]})),timestamp:e.timestamp}))}requeue(e){const t=this.maxQueueSize-this.queue.length;if(t<=0)return;const n=e.slice(0,t);this.queue.unshift(...n)}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 ft(e){var t,n;t="convert|from|office",n={feature:"office_conversion",mime_type:e},ut.getInstance().emit({name:t,attributes:n??{},timestamp:Date.now()})}p(ut,"instance",void 0);const pt="/create.pdf",mt="/save.pdf",dt="/create.docx",ht="/save.docx",gt="/templateData.json",yt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let bt=null,wt=null;function Tt(e){let t;s(wt,"GdPicture WebAssembly is not loaded.");for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(const e of r)t=Object.assign(r[0],e);const i=JSON.stringify({type:e,...t}),a=JSON.parse(wt.CommandHandler(i));if(!a.success)throw new Error(a.errorReason+": "+a.errorMessage+"\\n"+a.error);return a}const St={allMarkup:0,simpleMarkup:1,noMarkup:2,original:3},Et=St.noMarkup,_t={documentMarkupMode:Et};function At(e){if(!e)return _t;if(!e.documentMarkupMode)return{...e,documentMarkupMode:Et};if(!(e.documentMarkupMode in St))throw new Error(`Invalid documentMarkupMode value: ${e.documentMarkupMode}. Allowed values are: ${Object.keys(St).join(", ")}`);return{...e,documentMarkupMode:St[e.documentMarkupMode]}}const vt={"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"},Nt=new class{_mountCustomFonts(e,t){s(bt,"WebAssembly module not loaded."),bt.FS.mkdir(t);{const n=yt?bt.FS.filesystems.WORKERFS:bt.FS.filesystems.MEMFS;bt.FS.mount(n,{blobs:e},t)}}async loadModule(e,t,n,r,o,i,a){const{Assemblies:s,Module:l}=await async function(e,t){if("string"==typeof e){const n="nutrient-viewer-lib/",r=`${n}gdpicture-f2b83f15/jit`,o=`${n}gdpicture-f2b83f15/aot`;let i,a;t?(i=`${e}${o}/initDotnet.js`,a=`${e}${o}`):(i=`${e}${r}/initDotnet.js`,a=`${e}${r}`);const{initDotnet:s}=await import(i);return s(a,(e,t,n,r,o)=>"blazor.boot.json"===t?fetch(n,{credentials:"same-origin"}):null)}throw new Error("GdPicture WASM loader not implemented")}(e,t);wt=s.GdPictureWasm.API,bt=l,Tt("gdpicture/setLicense",{origin:n},{licenseKey:r||"DEMO_PSPDFKIT_WEB"});const c=o?"/fonts":"";if(o&&!bt.FS.analyzePath(c).exists&&(this._mountCustomFonts(o,c),Tt("gdpicture/setFonts",{fontPaths:[c]})),i){const e=await Ae(i);Tt("gdpicture/setDynamicFontLoading",{baseUrl:i.split("/").slice(0,-1).join("/"),allowedFonts:e.availableFonts,v:1})}a&&Tt("gdpicture/setFontSubstitutions",{fontSubstitutions:a})}toPdf(e,t,n,r,o){let i=pt;if(o&&"pdf"!==o&&Object.values(vt).includes(o)){ft(Object.keys(vt).find(e=>vt[e].toLowerCase()===o.toLowerCase()).toLowerCase()),i+=`.${o}`}else if(r&&"application/pdf"!==r){const e=r.toLowerCase();ft(e);const t=vt.hasOwnProperty(e)&&vt[e];t&&(i+=`.${t}`)}bt.FS.writeFile(i,new Uint8Array(e),{canOwn:!0});const a={file:mt,format:"pdf",conformance:t&&t in ve?t:void 0,officeConversionSettings:At(n)};try{return Tt("gdpicture/process",{input:{file:i},output:a}),bt.FS.readFile(mt).buffer}finally{try{bt.FS.unlink(mt),bt.FS.unlink(i)}catch(e){}}}toOffice(e,t){bt.FS.writeFile(pt,new Uint8Array(e));const n=`/save.${t}`;try{return Tt("gdpicture/process",{input:{file:pt},output:{file:n,format:t}}),bt.FS.readFile(n).buffer}finally{try{bt.FS.unlink(n),bt.FS.unlink(pt)}catch(e){console.log(e.message)}}}async populateDocumentTemplate(e,t){bt.FS.writeFile(dt,new Uint8Array(e));const{serializedData:n}=await ke(t);bt.FS.writeFile(gt,n);try{return Tt("gdpicture/process-office-template",{inputFile:dt,modelAndConfigFile:gt,outputFile:ht})