@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 • 54.8 kB
JavaScript
/*!
* Nutrient Web SDK 1.20.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/
*/
!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,n,r={},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.m=r,i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,n)=>(i.f[n](e,t),t),[])),i.u=e=>"nutrient-viewer-lib/chunk-"+e+"-"+{340:"a45536507d7005ba",911:"25de6bb390df7f14"}[e]+".js",i.miniCssF=e=>{},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="NutrientViewer:",i.l=(n,r,o,a)=>{if(e[n])e[n].push(r);else{var s,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var f=c[u];if(f.getAttribute("src")==n||f.getAttribute("data-webpack")==t+o){s=f;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",t+o),s.src=i.tu(n)),e[n]=[r];var p=(t,r)=>{s.onerror=s.onload=null,clearTimeout(d);var o=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.tt=()=>(void 0===n&&(n={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(n=trustedTypes.createPolicy("nutrient-web-sdk#webpack",n))),n),i.tu=e=>i.tt().createScriptURL(e),i.p="",(()=>{var e={374:0};i.f.j=(t,n)=>{var r=i.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=e[t]=[n,o]);n.push(r[2]=o);var a=i.p+i.u(t),s=new Error;i.l(a,n=>{if(i.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",s.name="ChunkLoadError",s.type=o,s.request=a,r[1](s)}},"chunk-"+t,t)}};var t=(t,n)=>{var r,o,[a,s,l]=n,c=0;if(a.some(t=>0!==e[t])){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(l)l(i)}for(t&&t(n);c<a.length;c++)o=a[c],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},n=globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var a={},s={};i.r(s),i.d(s,{default:()=>Me});const l=function e(t){let n;return n=t instanceof Error?t:new Error(t),Object.setPrototypeOf(n,new.target&&new.target.prototype||e.prototype),n};l.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const c=l;function u(e,t){if(!e)throw new c(`Assertion failed: ${t||"Condition not met"}\n\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}function f(e){return"[object Object]"===Object.prototype.toString.call(e)}function p(){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 d(e){return d="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},d(e)}function m(e){var t=function(e,t){if("object"!=d(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==d(t)?t:t+""}function h(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}new WeakMap;function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const b=Object.entries,w=Object.setPrototypeOf,S=Object.isFrozen,T=Object.getPrototypeOf,E=Object.getOwnPropertyDescriptor;let v=Object.freeze,_=Object.seal,A=Object.create,N="undefined"!=typeof Reflect&&Reflect,O=N.apply,k=N.construct;v||(v=function(e){return e}),_||(_=function(e){return e}),O||(O=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)}),k||(k=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 I=X(Array.prototype.forEach),x=X(Array.prototype.lastIndexOf),C=X(Array.prototype.pop),D=X(Array.prototype.push),R=X(Array.prototype.splice),M=Array.isArray,U=X(String.prototype.toLowerCase),L=X(String.prototype.toString),F=X(String.prototype.match),P=X(String.prototype.replace),z=X(String.prototype.indexOf),$=X(String.prototype.trim),j=X(Number.prototype.toString),H=X(Boolean.prototype.toString),B="undefined"==typeof BigInt?null:X(BigInt.prototype.toString),W="undefined"==typeof Symbol?null:X(Symbol.prototype.toString),G=X(Object.prototype.hasOwnProperty),Y=X(Object.prototype.toString),q=X(RegExp.prototype.test),V=(K=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return k(K,t)});var K;function X(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 O(e,t,r)}}function Z(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:U;if(w&&w(e,null),!M(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(S(t)||(t[r]=e),o=e)}e[o]=!0}return e}function Q(e){for(let t=0;t<e.length;t++){G(e,t)||(e[t]=null)}return e}function J(e){const t=A(null);for(const r of b(e)){var n=y(r,2);const o=n[0],i=n[1];G(e,o)&&(M(i)?t[o]=Q(i):i&&"object"==typeof i&&i.constructor===Object?t[o]=J(i):t[o]=i)}return t}function ee(e,t){for(;null!==e;){const n=E(e,t);if(n){if(n.get)return X(n.get);if("function"==typeof n.value)return X(n.value)}e=T(e)}return function(){return null}}const te=v(["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"]),ne=v(["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"]),re=v(["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"]),oe=v(["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"]),ie=v(["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"]),ae=v(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),se=v(["#text"]),le=v(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),ce=v(["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"]),ue=v(["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"]),fe=v(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),pe=_(/{{[\w\W]*|^[\w\W]*}}/g),de=_(/<%[\w\W]*|^[\w\W]*%>/g),me=_(/\${[\w\W]*/g),he=_(/^data-[\-\w.\u00B7-\uFFFF]+$/),ge=_(/^aria-[\-\w]+$/),ye=_(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),be=_(/^(?:\w+script|data):/i),we=_(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Se=_(/^html$/i),Te=_(/^[a-z][.\w]*(-[.\w]+)+$/i),Ee=_(/<[/\w!]/g),ve=_(/<[/\w]/g),_e=_(/<\/no(script|embed|frames)/i),Ae=_(/\/>/i),Ne=1,Oe=3,ke=7,Ie=8,xe=9,Ce=11,De=function(){return"undefined"==typeof window?null:window},Re=function(e,t,n,r){return G(e,t)&&M(e[t])?Z(r.base?J(r.base):{},e[t],r.transform):n};var Me=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:De();const n=t=>e(t);if(n.version="3.4.11",n.removed=[],!t||!t.document||t.document.nodeType!==xe||!t.Element)return n.isSupported=!1,n;let r=t.document;const o=r,i=o.currentScript;t.DocumentFragment;const a=t.HTMLTemplateElement,s=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap;void 0===u&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const f=t.DOMParser,p=t.trustedTypes,d=l.prototype,m=ee(d,"cloneNode"),h=ee(d,"remove"),g=ee(d,"nextSibling"),y=ee(d,"childNodes"),w=ee(d,"parentNode"),S=ee(d,"shadowRoot"),T=ee(d,"attributes"),E=s&&s.prototype?ee(s.prototype,"nodeType"):null,N=s&&s.prototype?ee(s.prototype,"nodeName"):null;if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let O,k,K="",X=!1,Q=0;const Me=function(){if(Q>0)throw V('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ue=function(e){Me(),Q++;try{return O.createHTML(e)}finally{Q--}},Le=function(){return X||(k=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}}(p,i),X=!0),k},Fe=r,Pe=Fe.implementation,ze=Fe.createNodeIterator,$e=Fe.createDocumentFragment,je=Fe.getElementsByTagName,He=o.importNode;let Be={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof b&&"function"==typeof w&&Pe&&void 0!==Pe.createHTMLDocument;const We=pe,Ge=de,Ye=me,qe=he,Ve=ge,Ke=be,Xe=we,Ze=Te;let Qe=ye,Je=null;const et=Z({},[...te,...ne,...re,...ie,...se]);let tt=null;const nt=Z({},[...le,...ce,...ue,...fe]);let rt=Object.seal(A(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}})),ot=null,it=null;const at=Object.seal(A(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let st=!0,lt=!0,ct=!1,ut=!0,ft=!1,pt=!0,dt=!1,mt=!1,ht=null,gt=null,yt=!1,bt=!1,wt=!1,St=!1,Tt=!0,Et=!1;const vt="user-content-";let _t=!0,At=!1,Nt={},Ot=null;const kt=Z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let It=null;const xt=Z({},["audio","video","img","source","image","track"]);let Ct=null;const Dt=Z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",Mt="http://www.w3.org/2000/svg",Ut="http://www.w3.org/1999/xhtml";let Lt=Ut,Ft=!1,Pt=null;const zt=Z({},[Rt,Mt,Ut],L),$t=v(["mi","mo","mn","ms","mtext"]);let jt=Z({},$t);const Ht=v(["annotation-xml"]);let Bt=Z({},Ht);const Wt=Z({},["title","style","font","a","script"]);let Gt=null;const Yt=["application/xhtml+xml","text/html"];let qt=null,Vt=null;const Kt=r.createElement("form"),Xt=function(e){return e instanceof RegExp||e instanceof Function},Zt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Vt&&Vt===e)return;e&&"object"==typeof e||(e={}),e=J(e),Gt=-1===Yt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,qt="application/xhtml+xml"===Gt?L:U,Je=Re(e,"ALLOWED_TAGS",et,{transform:qt}),tt=Re(e,"ALLOWED_ATTR",nt,{transform:qt}),Pt=Re(e,"ALLOWED_NAMESPACES",zt,{transform:L}),Ct=Re(e,"ADD_URI_SAFE_ATTR",Dt,{transform:qt,base:Dt}),It=Re(e,"ADD_DATA_URI_TAGS",xt,{transform:qt,base:xt}),Ot=Re(e,"FORBID_CONTENTS",kt,{transform:qt}),ot=Re(e,"FORBID_TAGS",J({}),{transform:qt}),it=Re(e,"FORBID_ATTR",J({}),{transform:qt}),Nt=!!G(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?J(e.USE_PROFILES):e.USE_PROFILES),st=!1!==e.ALLOW_ARIA_ATTR,lt=!1!==e.ALLOW_DATA_ATTR,ct=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ut=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ft=e.SAFE_FOR_TEMPLATES||!1,pt=!1!==e.SAFE_FOR_XML,dt=e.WHOLE_DOCUMENT||!1,bt=e.RETURN_DOM||!1,wt=e.RETURN_DOM_FRAGMENT||!1,St=e.RETURN_TRUSTED_TYPE||!1,yt=e.FORCE_BODY||!1,Tt=!1!==e.SANITIZE_DOM,Et=e.SANITIZE_NAMED_PROPS||!1,_t=!1!==e.KEEP_CONTENT,At=e.IN_PLACE||!1,Qe=function(e){try{return q(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ye,Lt="string"==typeof e.NAMESPACE?e.NAMESPACE:Ut,jt=G(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?J(e.MATHML_TEXT_INTEGRATION_POINTS):Z({},$t),Bt=G(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?J(e.HTML_INTEGRATION_POINTS):Z({},Ht);const t=G(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?J(e.CUSTOM_ELEMENT_HANDLING):A(null);if(rt=A(null),G(t,"tagNameCheck")&&Xt(t.tagNameCheck)&&(rt.tagNameCheck=t.tagNameCheck),G(t,"attributeNameCheck")&&Xt(t.attributeNameCheck)&&(rt.attributeNameCheck=t.attributeNameCheck),G(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(rt.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),_(rt),ft&&(lt=!1),wt&&(bt=!0),Nt&&(Je=Z({},se),tt=A(null),!0===Nt.html&&(Z(Je,te),Z(tt,le)),!0===Nt.svg&&(Z(Je,ne),Z(tt,ce),Z(tt,fe)),!0===Nt.svgFilters&&(Z(Je,re),Z(tt,ce),Z(tt,fe)),!0===Nt.mathMl&&(Z(Je,ie),Z(tt,ue),Z(tt,fe))),at.tagCheck=null,at.attributeCheck=null,G(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?at.tagCheck=e.ADD_TAGS:M(e.ADD_TAGS)&&(Je===et&&(Je=J(Je)),Z(Je,e.ADD_TAGS,qt))),G(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?at.attributeCheck=e.ADD_ATTR:M(e.ADD_ATTR)&&(tt===nt&&(tt=J(tt)),Z(tt,e.ADD_ATTR,qt))),G(e,"ADD_URI_SAFE_ATTR")&&M(e.ADD_URI_SAFE_ATTR)&&Z(Ct,e.ADD_URI_SAFE_ATTR,qt),G(e,"FORBID_CONTENTS")&&M(e.FORBID_CONTENTS)&&(Ot===kt&&(Ot=J(Ot)),Z(Ot,e.FORBID_CONTENTS,qt)),G(e,"ADD_FORBID_CONTENTS")&&M(e.ADD_FORBID_CONTENTS)&&(Ot===kt&&(Ot=J(Ot)),Z(Ot,e.ADD_FORBID_CONTENTS,qt)),_t&&(Je["#text"]=!0),dt&&Z(Je,["html","head","body"]),Je.table&&(Z(Je,["tbody"]),delete ot.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=O;O=e.TRUSTED_TYPES_POLICY;try{K=Ue("")}catch(e){throw O=t,e}}else null===e.TRUSTED_TYPES_POLICY?(O=void 0,K=""):(void 0===O&&(O=Le()),O&&"string"==typeof K&&(K=Ue("")));v&&v(e),Vt=e},Qt=Z({},[...ne,...re,...oe]),Jt=Z({},[...ie,...ae]),en=function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:Lt,tagName:"template"});const n=U(e.tagName),r=U(t.tagName);return!!Pt[e.namespaceURI]&&(e.namespaceURI===Mt?function(e,t,n){return t.namespaceURI===Ut?"svg"===e:t.namespaceURI===Rt?"svg"===e&&("annotation-xml"===n||jt[n]):Boolean(Qt[e])}(n,t,r):e.namespaceURI===Rt?function(e,t,n){return t.namespaceURI===Ut?"math"===e:t.namespaceURI===Mt?"math"===e&&Bt[n]:Boolean(Jt[e])}(n,t,r):e.namespaceURI===Ut?function(e,t,n){return!(t.namespaceURI===Mt&&!Bt[n])&&!(t.namespaceURI===Rt&&!jt[n])&&!Jt[e]&&(Wt[e]||!Qt[e])}(n,t,r):!("application/xhtml+xml"!==Gt||!Pt[e.namespaceURI]))},tn=function(e){D(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){if(h(e),!w(e))throw V("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},nn=function(e){const t=y(e);if(t){const e=[];I(t,t=>{D(e,t)}),I(e,e=>{try{h(e)}catch(e){}})}const n=T(e);if(n)for(let t=n.length-1;t>=0;--t){const r=n[t],o=r&&r.name;if("string"==typeof o)try{e.removeAttribute(o)}catch(e){}}},rn=function(e,t){try{D(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){D(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(bt||wt)try{tn(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},on=function(e){const t=T(e);if(t)for(let n=t.length-1;n>=0;--n){const r=t[n],o=r&&r.name;if("string"==typeof o&&!tt[qt(o)])try{e.removeAttribute(o)}catch(e){}}},an=function(e){let t=null,n=null;if(yt)e="<remove></remove>"+e;else{const t=F(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Gt&&Lt===Ut&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=O?Ue(e):e;if(Lt===Ut)try{t=(new f).parseFromString(o,Gt)}catch(e){}if(!t||!t.documentElement){t=Pe.createDocument(Lt,"template",null);try{t.documentElement.innerHTML=Ft?K:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),Lt===Ut?je.call(t,dt?"html":"body")[0]:dt?t.documentElement:i},sn=function(e){return ze.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ln=function(e){return e=P(e,We," "),e=P(e,Ge," "),e=P(e,Ye," ")},cn=function(e){var t;e.normalize();const n=ze.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let r=n.nextNode();for(;r;)r.data=ln(r.data),r=n.nextNode();const o=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");o&&I(o,e=>{fn(e.content)&&cn(e.content)})},un=function(e){const t=N?N(e):null;return"string"==typeof t&&("form"===qt(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==T(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==E(e)||e.childNodes!==y(e)))},fn=function(e){if(!E||"object"!=typeof e||null===e)return!1;try{return E(e)===Ce}catch(e){return!1}},pn=function(e){if(!E||"object"!=typeof e||null===e)return!1;try{return"number"==typeof E(e)}catch(e){return!1}};function dn(e,t,r){0!==e.length&&I(e,e=>{e.call(n,t,r,Vt)})}const mn=function(e){if(dn(Be.beforeSanitizeElements,e,null),un(e))return tn(e),!0;const t=qt(N?N(e):e.nodeName);if(dn(Be.uponSanitizeElement,e,{tagName:t,allowedTags:Je}),function(e,t){return!!(pt&&e.hasChildNodes()&&!pn(e.firstElementChild)&&q(Ee,e.textContent)&&q(Ee,e.innerHTML))||!(!pt||e.namespaceURI!==Ut||"style"!==t||!pn(e.firstElementChild))||e.nodeType===ke||!(!pt||e.nodeType!==Ie||!q(ve,e.data))}(e,t))return tn(e),!0;if(ot[t]||!(at.tagCheck instanceof Function&&at.tagCheck(t))&&!Je[t])return function(e,t){if(!ot[t]&&yn(t)){if(rt.tagNameCheck instanceof RegExp&&q(rt.tagNameCheck,t))return!1;if(rt.tagNameCheck instanceof Function&&rt.tagNameCheck(t))return!1}if(_t&&!Ot[t]){const t=w(e),n=y(e);if(n&&t)for(let r=n.length-1;r>=0;--r){const o=At?n[r]:m(n[r],!0);t.insertBefore(o,g(e))}}return tn(e),!0}(e,t);if((E?E(e):e.nodeType)===Ne&&!en(e))return tn(e),!0;if(("noscript"===t||"noembed"===t||"noframes"===t)&&q(_e,e.innerHTML))return tn(e),!0;if(ft&&e.nodeType===Oe){const t=ln(e.textContent);e.textContent!==t&&(D(n.removed,{element:e.cloneNode()}),e.textContent=t)}return dn(Be.afterSanitizeElements,e,null),!1},hn=function(e,t,n){if(it[t])return!1;if(Tt&&("id"===t||"name"===t)&&(n in r||n in Kt))return!1;const o=tt[t]||at.attributeCheck instanceof Function&&at.attributeCheck(t,e);if(lt&&q(qe,t));else if(st&&q(Ve,t));else if(o)if(Ct[t]);else if(q(Qe,P(n,Xe,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==z(n,"data:")||!It[e]){if(ct&&!q(Ke,P(n,Xe,"")));else if(n)return!1}else;else if(!(yn(e)&&(rt.tagNameCheck instanceof RegExp&&q(rt.tagNameCheck,e)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(e))&&(rt.attributeNameCheck instanceof RegExp&&q(rt.attributeNameCheck,t)||rt.attributeNameCheck instanceof Function&&rt.attributeNameCheck(t,e))||"is"===t&&rt.allowCustomizedBuiltInElements&&(rt.tagNameCheck instanceof RegExp&&q(rt.tagNameCheck,n)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(n))))return!1;return!0},gn=Z({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),yn=function(e){return!gn[U(e)]&&q(Ze,e)},bn=function(e,t,n,r){if(O&&"object"==typeof p&&"function"==typeof p.getAttributeType&&!n)switch(p.getAttributeType(e,t)){case"TrustedHTML":return Ue(r);case"TrustedScriptURL":return function(e){Me(),Q++;try{return O.createScriptURL(e)}finally{Q--}}(r)}return r},wn=function(e,t,r,o){try{r?e.setAttributeNS(r,t,o):e.setAttribute(t,o),un(e)?tn(e):C(n.removed)}catch(n){rn(t,e)}},Sn=function(e){dn(Be.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||un(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:tt,forceKeepAttr:void 0};let r=t.length;const o=qt(e.nodeName);for(;r--;){const i=t[r],a=i.name,s=i.namespaceURI,l=i.value,c=qt(a),u=l;let f="value"===a?u:$(u);n.attrName=c,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,dn(Be.uponSanitizeAttribute,e,n),f=n.attrValue,!Et||"id"!==c&&"name"!==c||0===z(f,vt)||(rn(a,e),f=vt+f),pt&&q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)?rn(a,e):"attributename"===c&&F(f,"href")?rn(a,e):n.forceKeepAttr||(n.keepAttr&&(ut||!q(Ae,f))?(ft&&(f=ln(f)),hn(o,c,f)?(f=bn(o,c,s,f),f!==u&&wn(e,a,s,f)):rn(a,e)):rn(a,e))}dn(Be.afterSanitizeAttributes,e,null)},Tn=function(e){let t=null;const n=sn(e);for(dn(Be.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){dn(Be.uponSanitizeShadowNode,t,null),mn(t),Sn(t),fn(t.content)&&Tn(t.content);if((E?E(t):t.nodeType)===Ne){const e=S(t);fn(e)&&(En(e),Tn(e))}}dn(Be.afterSanitizeShadowDOM,e,null)},En=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){Tn(e.shadow);continue}const n=e.node,r=(E?E(n):n.nodeType)===Ne,o=y(n);if(o)for(let e=o.length-1;e>=0;--e)t.push({node:o[e],shadow:null});if(r){const e=N?N(n):null;if("string"==typeof e&&"template"===qt(e)){const e=n.content;fn(e)&&t.push({node:e,shadow:null})}}if(r){const e=S(n);fn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,a=null,s=null;if(Ft=!e,Ft&&(e="\x3c!--\x3e"),"string"!=typeof e&&!pn(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return j(e);case"boolean":return H(e);case"bigint":return B?B(e):"0";case"symbol":return W?W(e):"Symbol()";case"undefined":default:return Y(e);case"function":case"object":{if(null===e)return Y(e);const t=e,n=ee(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:Y(e)}return Y(e)}}}(e)))throw V("dirty is not a string, aborting");if(!n.isSupported)return e;mt?(Je=ht,tt=gt):Zt(t),(Be.uponSanitizeElement.length>0||Be.uponSanitizeAttribute.length>0)&&(Je=J(Je)),Be.uponSanitizeAttribute.length>0&&(tt=J(tt)),n.removed=[];const l=At&&"string"!=typeof e&&pn(e);if(l){const t=N?N(e):e.nodeName;if("string"==typeof t){const e=qt(t);if(!Je[e]||ot[e])throw V("root node is forbidden and cannot be sanitized in-place")}if(un(e))throw V("root node is clobbered and cannot be sanitized in-place");try{En(e)}catch(t){throw nn(e),t}}else if(pn(e))r=an("\x3c!----\x3e"),i=r.ownerDocument.importNode(e,!0),i.nodeType===Ne&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i),En(i);else{if(!bt&&!ft&&!dt&&-1===e.indexOf("<"))return O&&St?Ue(e):e;if(r=an(e),!r)return bt?null:St?K:""}r&&yt&&tn(r.firstChild);const c=sn(l?e:r);try{for(;a=c.nextNode();)mn(a),Sn(a),fn(a.content)&&Tn(a.content)}catch(t){throw l&&nn(e),t}if(l)return I(n.removed,e=>{e.element&&function(e){const t=[e];for(;t.length>0;){const e=t.pop();(E?E(e):e.nodeType)===Ne&&on(e);const n=y(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}}(e.element)}),ft&&cn(e),e;if(bt){if(ft&&cn(r),wt)for(s=$e.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(tt.shadowroot||tt.shadowrootmode)&&(s=He.call(o,s,!0)),s}let u=dt?r.outerHTML:r.innerHTML;return dt&&Je["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&q(Se,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),ft&&(u=ln(u)),O&&St?Ue(u):u},n.setConfig=function(){Zt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),mt=!0,ht=Je,gt=tt},n.clearConfig=function(){Vt=null,mt=!1,ht=null,gt=null,O=k,K=""},n.isValidAttribute=function(e,t,n){Vt||Zt({});const r=qt(e),o=qt(t);return hn(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&G(Be,e)&&D(Be[e],t)},n.removeHook=function(e,t){if(G(Be,e)){if(void 0!==t){const n=x(Be[e],t);return-1===n?void 0:R(Be[e],n,1)[0]}return C(Be[e])}},n.removeHooks=function(e){G(Be,e)&&(Be[e]=[])},n.removeAllHooks=function(){Be={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 Ue(e){const t=(await async function(e){try{const t=await fetch(e).catch(t=>{throw new c(`Error fetching dynamic fonts file ${e}. ${t}`)});if(200!==t.status)throw new c(`Error fetching dynamic fonts file ${e}. Status code: ${t.status}`);return t}catch(e){throw e}}(e)).json().catch(t=>{throw new c(`Error parsing dynamic fonts file ${e}. ${t}`)});return t}let Le=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 Fe=/^data:([^;,]+)?;base64,(.*)$/i,Pe=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(?:==)?|[A-Za-z0-9+/]{3}=?)?$/,ze=new Set(["original","fixed","fit-width","fit-height","fit-max"]),$e=new Set(["png","jpg","gif","bmp","tif"]),je={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tif","image/x-tiff":"tif"};async function He(e){const t={urlImageReferences:[]},n=Be(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 je[t]}(o),a=function(e){try{const t=new URL(e).pathname,n=t.split(".").pop()?.toLowerCase();if(!n)return;return qe(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:We(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(!f(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(!f(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 Be(e,t,n){if(Array.isArray(e))return e.map((e,r)=>Be(e,`${t}[${r}]`,n));if(!f(e))return e;if(function(e){return f(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(!ze.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":Ye(e.width,`${t}.width`),Ye(e.height,`${t}.height`);break;case"fit-width":Ye(e.width,`${t}.width`);break;case"fit-height":Ye(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=qe(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=Fe.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 Ge(r,t),{isDataUrl:!0}}return Ge(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]=Be(i,`${t}${Ve(o)}`,n);return r}function We(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 Ge(e,t){const n=e.replace(/\s+/g,"");if(""===n||!Pe.test(n))throw new Error(`${t} must be valid base64 data.`)}function Ye(e,t){if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error(`${t} must be a positive number.`)}function qe(e){const t=e.toLowerCase().trim();return"jpeg"===t?"jpg":"tiff"===t?"tif":$e.has(t)?t:null}function Ve(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`.${e}`:`[${JSON.stringify(e)}]`}const Ke=/^(?:[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 Xe=function(e){return"string"==typeof e&&Ke.test(e)};const Ze=function(e){if(!Xe(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 Qe=[];for(let e=0;e<256;++e)Qe.push((e+256).toString(16).slice(1));function Je(e,t=0){return(Qe[e[t+0]]+Qe[e[t+1]]+Qe[e[t+2]]+Qe[e[t+3]]+"-"+Qe[e[t+4]]+Qe[e[t+5]]+"-"+Qe[e[t+6]]+Qe[e[t+7]]+"-"+Qe[e[t+8]]+Qe[e[t+9]]+"-"+Qe[e[t+10]]+Qe[e[t+11]]+Qe[e[t+12]]+Qe[e[t+13]]+Qe[e[t+14]]+Qe[e[t+15]]).toLowerCase()}let et;const tt=new Uint8Array(16);function nt(e){return 14+(e+64>>>9<<4)+1}function rt(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function ot(e,t,n,r,o,i){return rt((a=rt(rt(t,e),rt(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function it(e,t,n,r,o,i,a){return ot(t&n|~t&r,e,t,o,i,a)}function at(e,t,n,r,o,i,a){return ot(t&r|n&~r,e,t,o,i,a)}function st(e,t,n,r,o,i,a){return ot(t^n^r,e,t,o,i,a)}function lt(e,t,n,r,o,i,a){return ot(n^(t|~r),e,t,o,i,a)}const ct=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(nt(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=it(r,o,i,a,e[t],7,-680876936),a=it(a,r,o,i,e[t+1],12,-389564586),i=it(i,a,r,o,e[t+2],17,606105819),o=it(o,i,a,r,e[t+3],22,-1044525330),r=it(r,o,i,a,e[t+4],7,-176418897),a=it(a,r,o,i,e[t+5],12,1200080426),i=it(i,a,r,o,e[t+6],17,-1473231341),o=it(o,i,a,r,e[t+7],22,-45705983),r=it(r,o,i,a,e[t+8],7,1770035416),a=it(a,r,o,i,e[t+9],12,-1958414417),i=it(i,a,r,o,e[t+10],17,-42063),o=it(o,i,a,r,e[t+11],22,-1990404162),r=it(r,o,i,a,e[t+12],7,1804603682),a=it(a,r,o,i,e[t+13],12,-40341101),i=it(i,a,r,o,e[t+14],17,-1502002290),o=it(o,i,a,r,e[t+15],22,1236535329),r=at(r,o,i,a,e[t+1],5,-165796510),a=at(a,r,o,i,e[t+6],9,-1069501632),i=at(i,a,r,o,e[t+11],14,643717713),o=at(o,i,a,r,e[t],20,-373897302),r=at(r,o,i,a,e[t+5],5,-701558691),a=at(a,r,o,i,e[t+10],9,38016083),i=at(i,a,r,o,e[t+15],14,-660478335),o=at(o,i,a,r,e[t+4],20,-405537848),r=at(r,o,i,a,e[t+9],5,568446438),a=at(a,r,o,i,e[t+14],9,-1019803690),i=at(i,a,r,o,e[t+3],14,-187363961),o=at(o,i,a,r,e[t+8],20,1163531501),r=at(r,o,i,a,e[t+13],5,-1444681467),a=at(a,r,o,i,e[t+2],9,-51403784),i=at(i,a,r,o,e[t+7],14,1735328473),o=at(o,i,a,r,e[t+12],20,-1926607734),r=st(r,o,i,a,e[t+5],4,-378558),a=st(a,r,o,i,e[t+8],11,-2022574463),i=st(i,a,r,o,e[t+11],16,1839030562),o=st(o,i,a,r,e[t+14],23,-35309556),r=st(r,o,i,a,e[t+1],4,-1530992060),a=st(a,r,o,i,e[t+4],11,1272893353),i=st(i,a,r,o,e[t+7],16,-155497632),o=st(o,i,a,r,e[t+10],23,-1094730640),r=st(r,o,i,a,e[t+13],4,681279174),a=st(a,r,o,i,e[t],11,-358537222),i=st(i,a,r,o,e[t+3],16,-722521979),o=st(o,i,a,r,e[t+6],23,76029189),r=st(r,o,i,a,e[t+9],4,-640364487),a=st(a,r,o,i,e[t+12],11,-421815835),i=st(i,a,r,o,e[t+15],16,530742520),o=st(o,i,a,r,e[t+2],23,-995338651),r=lt(r,o,i,a,e[t],6,-198630844),a=lt(a,r,o,i,e[t+7],10,1126891415),i=lt(i,a,r,o,e[t+14],15,-1416354905),o=lt(o,i,a,r,e[t+5],21,-57434055),r=lt(r,o,i,a,e[t+12],6,1700485571),a=lt(a,r,o,i,e[t+3],10,-1894986606),i=lt(i,a,r,o,e[t+10],15,-1051523),o=lt(o,i,a,r,e[t+1],21,-2054922799),r=lt(r,o,i,a,e[t+8],6,1873313359),a=lt(a,r,o,i,e[t+15],10,-30611744),i=lt(i,a,r,o,e[t+6],15,-1560198380),o=lt(o,i,a,r,e[t+13],21,1309151649),r=lt(r,o,i,a,e[t+4],6,-145523070),a=lt(a,r,o,i,e[t+11],10,-1120210379),i=lt(i,a,r,o,e[t+2],15,718787259),o=lt(o,i,a,r,e[t+9],21,-343485551),r=rt(r,n),o=rt(o,s),i=rt(i,l),a=rt(a,c)}return Uint32Array.of(r,o,i,a)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(nt(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 ut="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ft="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function pt(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?Ze(r):r;if("string"==typeof r&&(r=Ze(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 Je(l)}function dt(e,t,n,r){return pt(48,ct,e,t,n,r)}dt.DNS=ut,dt.URL=ft;const mt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const ht=function(e,t,n){if(mt.randomUUID&&!t&&!e)return mt.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!et){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");et=crypto.getRandomValues.bind(crypto)}return et(tt)}();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 Je(r)};function gt(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 yt(e,t){return e<<t|e>>>32-t}const bt=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]=yt(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=yt(o,5)+gt(n,i,s,l)+c+t[n]+r[e]>>>0;c=l,l=s,s=yt(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 wt(e,t,n,r){return pt(80,bt,e,t,n,r)}wt.DNS=ut,wt.URL=ft;function St(){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=ht();return window.localStorage.setItem(e,t),t}catch{return null}}class Tt{constructor(){h(this,"maxQueueSize",1e3),h(this,"flushTimer",null),h(this,"visibilityChangeHandler",null),h(this,"isFlushing",!1),h(this,"queue",[]),h(this,"allEvents",[])}static getInstance(){return Tt.instance||(Tt.instance=new Tt),Tt.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(){Tt.instance&&(Tt.instance.cleanup(),Tt.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 p("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 Promise.all([i.e(340),i.e(911)]).then(i.bind(i,31911));return t({clientInfo:{...this.clientInfo,tag:St()??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 Et(e){var t,n;t="convert|from|office",n={feature:"office_conversion",mime_type:e},Tt.getInstance().emit({name:t,attributes:n??{},timestamp:Date.now()})}h(Tt,"instance",void 0);const vt="/create.pdf",_t="/save.pdf",At="/create.docx",Nt="/save.docx",Ot="/templateData.json",kt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let It=null,xt=null;function Ct(e){let t;u(xt,"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(xt.CommandHandler(i));if(!a.success)throw new Error(a.errorReason+": "+a.errorMessage+"\n"+a.error);return a}const Dt={allMarkup:0,simpleMarkup:1,noMarkup:2,original:3},Rt=Dt.noMarkup,Mt={documentMarkupMode:Rt};function Ut(e){if(!e)return Mt;if(!e.documentMarkupMode)return{...e,documentMarkupMode:Rt};if(!(e.documentMarkupMode in Dt))throw new Error(`Invalid documentMarkupMode value: ${e.documentMarkupMode}. Allowed values are: ${Object.keys(Dt).join(", ")}`);return{...e,documentMarkupMode:Dt[e.documentMarkupMode]}}const Lt={"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"},Ft=new class{_mountCustomFonts(e,t){u(It,"WebAssembly module not loaded."),It.FS.mkdir(t);{const n=kt?It.FS.filesystems.WORKERFS:It.FS.filesystems.MEMFS;It.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-a7da9c10/jit`,o=`${n}gdpicture-a7da9c10/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);xt=s.GdPictureWasm.API,It=l,Ct("gdpicture/setLicense",{origin:n},{licenseKey:r||"DEMO_PSPDFKIT_WEB"});const c=o?"/fonts":"";if(o&&!It.FS.analyzePath(c).exists&&(this._mountCustomFonts(o,c),Ct("gdpicture/setFonts",{fontPaths:[c]})),i){const e=await Ue(i);Ct("gdpicture/setDynamicFontLoading",{baseUrl:i.split("/").slice(0,-1).join("/"),allowedFonts:e.availableFonts,v:1})}a&&Ct("gdpicture/setFontSubstitutions",{fontSubstitutions:a})}toPdf(e,t,n,r,o){let i=vt;if(o&&"pdf"!==o&&Object.values(Lt).includes(o)){Et(Object.keys(Lt).find(e=>Lt[e].toLowerCase()===o.toLowerCase()).toLowerCase()),i+=`.${o}`}else if(r&&"application/pdf"!==r){const e=r.toLowerCase();Et(e);const t=Lt.hasOwnProperty(e)&&Lt[e];t&&(i+=`.${t}`)}It.FS.writeFile(i,new Uint8Array(e),{canOwn:!0});const a={file:_t,format:"pdf",conformance:t&&t in Le?t:void 0,officeConversionSettings:Ut(n)};try{return Ct("gdpicture/process",{input:{file:i},output:a}),It.FS.readFile(_t).buffer}finally{try{It.FS.unlink(_t),It.FS.unlink(i)}catch{}}}toOffice(e,t){It.FS.writeFile(vt,new Uint8Array(e));const n=`/save.${t}`;try{return Ct("gdpicture/process",{input:{file:vt},output:{file:n,format:t}}),It.FS.readFile(n).buffer}finally{try{It.FS.unlink(n),It.FS.unlink(vt)}catch(e){console.log(e.message)}}}async populateDocumentTemplate(e,t){It.FS.writeFile(At,new Uint8Array(e));const{serializedData:n}=await He(t);It.FS.writeFile(Ot,n);try{return Ct("gdpicture/process-office-template",{inputFile:At,modelAndConfigFile:Ot,outputFile:Nt}),It.FS.readFile(Nt).buffer}finally{try{It.FS.unlink(Nt),It.FS.unlink(Ot),It.FS.unlink(At)}catch(e){console.log(e.message)}}}},Pt=self;return Pt.global=Pt,Pt.module={},Pt.addEventListener("message",async e=>{let t,n,{data:r}=e;try{const e=await Ft[r.action](...r.args);if(t={id:r.id,result:e},Array.isArray(e)){const t=e.filter(e=>e instanceof ArrayBuffer);t.length>0&&(n=t)}e instanceof ArrayBuffer&&(n=[e])}catch(e){const o=[...r.args].filter(e=>e instanceof ArrayBuffer);o.length>0&&(n=o),t={id:r.id,error:e.message||e.toString(),callArgs:r.args}}Pt.postMessage(t,n)}),a=a.default})());