/*!
 * Nutrient Web SDK 1.16.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,()=>(()=>{var e={45369(e,t,n){var r=n(95350),o=n(89700),i=n(73146),a=o.DEFAULT_COMPARATOR,s=o.reverseComparator;function l(e,t,n,r){for(var o,i,a=t[r];r>n&&e(a,i=t[o=r-1>>1])<0;)t[r]=i,r=o;t[r]=a}function c(e,t,n){for(var r,o=t.length,i=n,a=t[n],s=2*n+1;s<o;)(r=s+1)<o&&e(t[s],t[r])>=0&&(s=r),t[n]=t[s],s=2*(n=s)+1;t[n]=a,l(e,t,i,n)}function u(e,t,n){t.push(n),l(e,t,0,t.length-1)}function p(e,t){var n=t.pop();if(0!==t.length){var r=t[0];return t[0]=n,c(e,t,0),r}return n}function f(e,t,n){if(0===t.length)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var r=t[0];return t[0]=n,c(e,t,0),r}function d(e,t,n){var r;return 0!==t.length&&e(t[0],n)<0&&(r=t[0],t[0]=n,n=r,c(e,t,0)),n}function h(e,t){for(var n=t.length>>1;--n>=0;)c(e,t,n)}function m(e,t){for(var n=t.length,r=0,o=new Array(n);r<n;)o[r++]=p(e,t);return o}function g(e){if(this.clear(),this.comparator=e||a,"function"!=typeof this.comparator)throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}function y(e){if(this.clear(),this.comparator=e||a,"function"!=typeof this.comparator)throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=s(this.comparator)}g.prototype.clear=function(){this.items=[],this.size=0},g.prototype.push=function(e){return u(this.comparator,this.items,e),++this.size},g.prototype.peek=function(){return this.items[0]},g.prototype.pop=function(){return 0!==this.size&&this.size--,p(this.comparator,this.items)},g.prototype.replace=function(e){return f(this.comparator,this.items,e)},g.prototype.pushpop=function(e){return d(this.comparator,this.items,e)},g.prototype.consume=function(){return this.size=0,m(this.comparator,this.items)},g.prototype.toArray=function(){return m(this.comparator,this.items.slice())},g.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:g,enumerable:!1}),e},"undefined"!=typeof Symbol&&(g.prototype[Symbol.for("nodejs.util.inspect.custom")]=g.prototype.inspect),y.prototype=g.prototype,g.from=function(e,t){var n,r=new g(t);return n=i.isArrayLike(e)?e.slice():i.toArray(e),h(r.comparator,n),r.items=n,r.size=n.length,r},y.from=function(e,t){var n,r=new y(t);return n=i.isArrayLike(e)?e.slice():i.toArray(e),h(r.comparator,n),r.items=n,r.size=n.length,r},g.siftUp=c,g.siftDown=l,g.push=u,g.pop=p,g.replace=f,g.pushpop=d,g.heapify=h,g.consume=m,g.nsmallest=function(e,t,n){2===arguments.length&&(n=t,t=e,e=a);var o,l,c,u,p=s(e),d=1/0;if(1===t){if(i.isArrayLike(n)){for(o=0,l=n.length;o<l;o++)c=n[o],(d===1/0||e(c,d)<0)&&(d=c);return(u=new n.constructor(1))[0]=d,u}return r(n,function(t){(d===1/0||e(t,d)<0)&&(d=t)}),[d]}if(i.isArrayLike(n)){if(t>=n.length)return n.slice().sort(e);for(u=n.slice(0,t),h(p,u),o=t,l=n.length;o<l;o++)p(n[o],u[0])>0&&f(p,u,n[o]);return u.sort(e)}var m=i.guessLength(n);return null!==m&&m<t&&(t=m),u=new Array(t),o=0,r(n,function(e){o<t?u[o]=e:(o===t&&h(p,u),p(e,u[0])>0&&f(p,u,e)),o++}),u.length>o&&(u.length=o),u.sort(e)},g.nlargest=function(e,t,n){2===arguments.length&&(n=t,t=e,e=a);var o,l,c,u,p=s(e),d=-1/0;if(1===t){if(i.isArrayLike(n)){for(o=0,l=n.length;o<l;o++)c=n[o],(d===-1/0||e(c,d)>0)&&(d=c);return(u=new n.constructor(1))[0]=d,u}return r(n,function(t){(d===-1/0||e(t,d)>0)&&(d=t)}),[d]}if(i.isArrayLike(n)){if(t>=n.length)return n.slice().sort(p);for(u=n.slice(0,t),h(e,u),o=t,l=n.length;o<l;o++)e(n[o],u[0])>0&&f(e,u,n[o]);return u.sort(p)}var m=i.guessLength(n);return null!==m&&m<t&&(t=m),u=new Array(t),o=0,r(n,function(n){o<t?u[o]=n:(o===t&&h(e,u),e(n,u[0])>0&&f(e,u,n)),o++}),u.length>o&&(u.length=o),u.sort(p)},g.MinHeap=g,g.MaxHeap=y,e.exports=g},89700(e,t){t.DEFAULT_COMPARATOR=function(e,t){return e<t?-1:e>t?1:0},t.DEFAULT_REVERSE_COMPARATOR=function(e,t){return e<t?1:e>t?-1:0},t.reverseComparator=function(e){return function(t,n){return e(n,t)}},t.createTupleComparator=function(e){return 2===e?function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:e[1]<t[1]?-1:e[1]>t[1]?1:0}:function(t,n){for(var r=0;r<e;){if(t[r]<n[r])return-1;if(t[r]>n[r])return 1;r++}return 0}}},73146(e,t,n){var r=n(95350),o=n(99232);function i(e){return"number"==typeof e.length?e.length:"number"==typeof e.size?e.size:void 0}t.isArrayLike=function(e){return Array.isArray(e)||o.isTypedArray(e)},t.guessLength=i,t.toArray=function(e){var t=i(e),n="number"==typeof t?new Array(t):[],o=0;return r(e,function(e){n[o++]=e}),n},t.toArrayWithIndices=function(e){var t=i(e),n="number"==typeof t?o.getPointerArray(t):Array,a="number"==typeof t?new Array(t):[],s="number"==typeof t?new n(t):[],l=0;return r(e,function(e){a[l]=e,s[l]=l++}),[a,s]}},99232(e,t){var n=Math.pow(2,8)-1,r=Math.pow(2,16)-1,o=Math.pow(2,32)-1,i=Math.pow(2,7)-1,a=Math.pow(2,15)-1,s=Math.pow(2,31)-1;t.getPointerArray=function(e){var t=e-1;if(t<=n)return Uint8Array;if(t<=r)return Uint16Array;if(t<=o)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(e){var t=e-1;return t<=i?Int8Array:t<=a?Int16Array:t<=s?Int32Array:Float64Array},t.getNumberType=function(e){return e===(0|e)?-1===Math.sign(e)?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var l={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(e,n){var r,o,i,a,s,c=null,u=0;for(a=0,s=e.length;a<s;a++)i=n?n(e[a]):e[a],o=t.getNumberType(i),(r=l[o.name])>u&&(u=r,c=o);return c},t.isTypedArray=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView(e)},t.concat=function(){var e,t,n,r=0;for(e=0,n=arguments.length;e<n;e++)r+=arguments[e].length;var o=new arguments[0].constructor(r);for(e=0,t=0;e<n;e++)o.set(arguments[e],t),t+=arguments[e].length;return o},t.indices=function(e){for(var n=new(t.getPointerArray(e))(e),r=0;r<e;r++)n[r]=r;return n}},95350(e,t,n){var r=n(63531),o=r.ARRAY_BUFFER_SUPPORT,i=r.SYMBOL_SUPPORT;e.exports=function(e,t){var n,r,a,s,l;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if("function"!=typeof t)throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||o&&ArrayBuffer.isView(e)||"string"==typeof e||"[object Arguments]"===e.toString())for(a=0,s=e.length;a<s;a++)t(e[a],a);else if("function"!=typeof e.forEach)if(i&&Symbol.iterator in e&&"function"!=typeof e.next&&(e=e[Symbol.iterator]()),"function"!=typeof e.next)for(r in e)e.hasOwnProperty(r)&&t(e[r],r);else for(n=e,a=0;!0!==(l=n.next()).done;)t(l.value,a),a++;else e.forEach(t)}},63531(e,t){t.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,t.SYMBOL_SUPPORT="undefined"!=typeof Symbol}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};return(()=>{"use strict";var e={};function t(e){return t="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},t(e)}function r(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.r(e),n.d(e,{default:()=>Ue});const i=Symbol("Comlink.proxy"),a=Symbol("Comlink.endpoint"),s=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.finalizer"),c=Symbol("Comlink.thrown"),u=e=>"object"==typeof e&&null!==e||"function"==typeof e,p=new Map([["proxy",{canHandle:e=>u(e)&&e[i],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),h(e))}],["throw",{canHandle:e=>u(e)&&c in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function f(e,t=globalThis,n=["*"]){t.addEventListener("message",function r(o){if(!o||!o.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,o.origin))return void console.warn(`Invalid origin '${o.origin}' for comlink proxy`);const{id:a,type:s,path:u}=Object.assign({path:[]},o.data),p=(o.data.argumentList||[]).map(S);let h;try{const t=u.slice(0,-1).reduce((e,t)=>e[t],e),n=u.reduce((e,t)=>e[t],e);switch(s){case"GET":h=n;break;case"SET":t[u.slice(-1)[0]]=S(o.data.value),h=!0;break;case"APPLY":h=n.apply(t,p);break;case"CONSTRUCT":h=function(e){return Object.assign(e,{[i]:!0})}(new n(...p));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),h=function(e,t){return E.set(e,t),e}(t,[t])}break;case"RELEASE":h=void 0;break;default:return}}catch(e){h={value:e,[c]:0}}Promise.resolve(h).catch(e=>({value:e,[c]:0})).then(n=>{const[o,i]=R(n);t.postMessage(Object.assign(Object.assign({},o),{id:a}),i),"RELEASE"===s&&(t.removeEventListener("message",r),d(t),l in e&&"function"==typeof e[l]&&e[l]())}).catch(e=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[c]:0});t.postMessage(Object.assign(Object.assign({},n),{id:a}),r)})}),t.start&&t.start()}function d(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function h(e,t){const n=new Map;return e.addEventListener("message",function(e){const{data:t}=e;if(!t||!t.id)return;const r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),T(e,n,[],t)}function m(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return w(e,new Map,{type:"RELEASE"}).then(()=>{d(e)})}const y=new WeakMap,b="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(y.get(e)||0)-1;y.set(e,t),0===t&&g(e)});function T(e,t,n=[],r=function(){}){let o=!1;const i=new Proxy(r,{get(r,a){if(m(o),a===s)return()=>{!function(e){b&&b.unregister(e)}(i),g(e),t.clear(),o=!0};if("then"===a){if(0===n.length)return{then:()=>i};const r=w(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(S);return r.then.bind(r)}return T(e,t,[...n,a])},set(r,i,a){m(o);const[s,l]=R(a);return w(e,t,{type:"SET",path:[...n,i].map(e=>e.toString()),value:s},l).then(S)},apply(r,i,s){m(o);const l=n[n.length-1];if(l===a)return w(e,t,{type:"ENDPOINT"}).then(S);if("bind"===l)return T(e,t,n.slice(0,-1));const[c,u]=A(s);return w(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},u).then(S)},construct(r,i){m(o);const[a,s]=A(i);return w(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},s).then(S)}});return function(e,t){const n=(y.get(t)||0)+1;y.set(t,n),b&&b.register(e,t,e)}(i,e),i}function A(e){const t=e.map(R);return[t.map(e=>e[0]),(n=t.map(e=>e[1]),Array.prototype.concat.apply([],n))];var n}const E=new WeakMap;function R(e){for(const[t,n]of p)if(n.canHandle(e)){const[r,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},o]}return[{type:"RAW",value:e},E.get(e)||[]]}function S(e){switch(e.type){case"HANDLER":return p.get(e.name).deserialize(e.value);case"RAW":return e.value}}function w(e,t,n,r){return new Promise(o=>{const i=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(i,o),e.start&&e.start(),e.postMessage(Object.assign({id:i},n),r)})}const v=function e(t){let n;return n=t instanceof Error?t:new Error(t),Object.setPrototypeOf(n,e.prototype),n};v.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const _=v;["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(",");new WeakMap;const{entries:I,setPrototypeOf:N,isFrozen:C,getPrototypeOf:O,getOwnPropertyDescriptor:k}=Object;let{freeze:x,seal:D,create:L}=Object,{apply:M,construct:P}="undefined"!=typeof Reflect&&Reflect;x||(x=function(e){return e}),D||(D=function(e){return e}),M||(M=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)}),P||(P=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 U=oe(Array.prototype.forEach),q=oe(Array.prototype.lastIndexOf),z=oe(Array.prototype.pop),F=oe(Array.prototype.push),B=oe(Array.prototype.splice),H=Array.isArray,j=oe(String.prototype.toLowerCase),W=oe(String.prototype.toString),G=oe(String.prototype.match),Y=oe(String.prototype.replace),Q=oe(String.prototype.indexOf),V=oe(String.prototype.trim),X=oe(Number.prototype.toString),$=oe(Boolean.prototype.toString),K="undefined"==typeof BigInt?null:oe(BigInt.prototype.toString),Z="undefined"==typeof Symbol?null:oe(Symbol.prototype.toString),J=oe(Object.prototype.hasOwnProperty),ee=oe(Object.prototype.toString),te=oe(RegExp.prototype.test),ne=(re=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return P(re,t)});var re;function oe(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 M(e,t,r)}}function ie(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:j;if(N&&N(e,null),!H(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(C(t)||(t[r]=e),o=e)}e[o]=!0}return e}function ae(e){for(let t=0;t<e.length;t++){J(e,t)||(e[t]=null)}return e}function se(e){const t=L(null);for(const[n,r]of I(e)){J(e,n)&&(H(r)?t[n]=ae(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=se(r):t[n]=r)}return t}function le(e,t){for(;null!==e;){const n=k(e,t);if(n){if(n.get)return oe(n.get);if("function"==typeof n.value)return oe(n.value)}e=O(e)}return function(){return null}}const ce=x(["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"]),ue=x(["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"]),pe=x(["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"]),fe=x(["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"]),de=x(["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"]),he=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),me=x(["#text"]),ge=x(["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"]),ye=x(["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"]),be=x(["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"]),Te=x(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ae=D(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ee=D(/<%[\w\W]*|[\w\W]*%>/gm),Re=D(/\$\{[\w\W]*/gm),Se=D(/^data-[\-\w.\u00B7-\uFFFF]+$/),we=D(/^aria-[\-\w]+$/),ve=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_e=D(/^(?:\w+script|data):/i),Ie=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ne=D(/^html$/i),Ce=D(/^[a-z][.\w]*(-[.\w]+)+$/i);var Oe=Object.freeze({__proto__:null,ARIA_ATTR:we,ATTR_WHITESPACE:Ie,CUSTOM_ELEMENT:Ce,DATA_ATTR:Se,DOCTYPE_NAME:Ne,ERB_EXPR:Ee,IS_ALLOWED_URI:ve,IS_SCRIPT_OR_DATA:_e,MUSTACHE_EXPR:Ae,TMPLIT_EXPR:Re});const ke=1,xe=3,De=7,Le=8,Me=9,Pe=function(){return"undefined"==typeof window?null:window};var Ue=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Pe();const n=t=>e(t);if(n.version="3.4.2",n.removed=[],!t||!t.document||t.document.nodeType!==Me||!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:p=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:d,trustedTypes:h}=t,m=c.prototype,g=le(m,"cloneNode"),y=le(m,"remove"),b=le(m,"nextSibling"),T=le(m,"childNodes"),A=le(m,"parentNode");if("function"==typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let E,R="";const{implementation:S,createNodeIterator:w,createDocumentFragment:v,getElementsByTagName:_}=r,{importNode:N}=o;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof I&&"function"==typeof A&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:k,TMPLIT_EXPR:D,DATA_ATTR:M,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:re,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:ae}=Oe;let{IS_ALLOWED_URI:Ae}=Oe,Ee=null;const Re=ie({},[...ce,...ue,...pe,...de,...me]);let Se=null;const we=ie({},[...ge,...ye,...be,...Te]);let _e=Object.seal(L(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}})),Ie=null,Ce=null;const Ue=Object.seal(L(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let qe=!0,ze=!0,Fe=!1,Be=!0,He=!1,je=!0,We=!1,Ge=!1,Ye=!1,Qe=!1,Ve=!1,Xe=!1,$e=!0,Ke=!1;const Ze="user-content-";let Je=!0,et=!1,tt={},nt=null;const rt=ie({},["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=ie({},["audio","video","img","source","image","track"]);let at=null;const st=ie({},["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 pt=ut,ft=!1,dt=null;const ht=ie({},[lt,ct,ut],W);let mt=ie({},["mi","mo","mn","ms","mtext"]),gt=ie({},["annotation-xml"]);const yt=ie({},["title","style","font","a","script"]);let bt=null;const Tt=["application/xhtml+xml","text/html"];let At=null,Et=null;const Rt=r.createElement("form"),St=function(e){return e instanceof RegExp||e instanceof Function},wt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Et&&Et===e)return;e&&"object"==typeof e||(e={}),e=se(e),bt=-1===Tt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,At="application/xhtml+xml"===bt?W:j,Ee=J(e,"ALLOWED_TAGS")&&H(e.ALLOWED_TAGS)?ie({},e.ALLOWED_TAGS,At):Re,Se=J(e,"ALLOWED_ATTR")&&H(e.ALLOWED_ATTR)?ie({},e.ALLOWED_ATTR,At):we,dt=J(e,"ALLOWED_NAMESPACES")&&H(e.ALLOWED_NAMESPACES)?ie({},e.ALLOWED_NAMESPACES,W):ht,at=J(e,"ADD_URI_SAFE_ATTR")&&H(e.ADD_URI_SAFE_ATTR)?ie(se(st),e.ADD_URI_SAFE_ATTR,At):st,ot=J(e,"ADD_DATA_URI_TAGS")&&H(e.ADD_DATA_URI_TAGS)?ie(se(it),e.ADD_DATA_URI_TAGS,At):it,nt=J(e,"FORBID_CONTENTS")&&H(e.FORBID_CONTENTS)?ie({},e.FORBID_CONTENTS,At):rt,Ie=J(e,"FORBID_TAGS")&&H(e.FORBID_TAGS)?ie({},e.FORBID_TAGS,At):se({}),Ce=J(e,"FORBID_ATTR")&&H(e.FORBID_ATTR)?ie({},e.FORBID_ATTR,At):se({}),tt=!!J(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?se(e.USE_PROFILES):e.USE_PROFILES),qe=!1!==e.ALLOW_ARIA_ATTR,ze=!1!==e.ALLOW_DATA_ATTR,Fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,He=e.SAFE_FOR_TEMPLATES||!1,je=!1!==e.SAFE_FOR_XML,We=e.WHOLE_DOCUMENT||!1,Qe=e.RETURN_DOM||!1,Ve=e.RETURN_DOM_FRAGMENT||!1,Xe=e.RETURN_TRUSTED_TYPE||!1,Ye=e.FORCE_BODY||!1,$e=!1!==e.SANITIZE_DOM,Ke=e.SANITIZE_NAMED_PROPS||!1,Je=!1!==e.KEEP_CONTENT,et=e.IN_PLACE||!1,Ae=function(e){try{return te(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ve,pt="string"==typeof e.NAMESPACE?e.NAMESPACE:ut,mt=J(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?se(e.MATHML_TEXT_INTEGRATION_POINTS):ie({},["mi","mo","mn","ms","mtext"]),gt=J(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?se(e.HTML_INTEGRATION_POINTS):ie({},["annotation-xml"]);const t=J(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?se(e.CUSTOM_ELEMENT_HANDLING):L(null);if(_e=L(null),J(t,"tagNameCheck")&&St(t.tagNameCheck)&&(_e.tagNameCheck=t.tagNameCheck),J(t,"attributeNameCheck")&&St(t.attributeNameCheck)&&(_e.attributeNameCheck=t.attributeNameCheck),J(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(_e.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),He&&(ze=!1),Ve&&(Qe=!0),tt&&(Ee=ie({},me),Se=L(null),!0===tt.html&&(ie(Ee,ce),ie(Se,ge)),!0===tt.svg&&(ie(Ee,ue),ie(Se,ye),ie(Se,Te)),!0===tt.svgFilters&&(ie(Ee,pe),ie(Se,ye),ie(Se,Te)),!0===tt.mathMl&&(ie(Ee,de),ie(Se,be),ie(Se,Te))),Ue.tagCheck=null,Ue.attributeCheck=null,J(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Ue.tagCheck=e.ADD_TAGS:H(e.ADD_TAGS)&&(Ee===Re&&(Ee=se(Ee)),ie(Ee,e.ADD_TAGS,At))),J(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Ue.attributeCheck=e.ADD_ATTR:H(e.ADD_ATTR)&&(Se===we&&(Se=se(Se)),ie(Se,e.ADD_ATTR,At))),J(e,"ADD_URI_SAFE_ATTR")&&H(e.ADD_URI_SAFE_ATTR)&&ie(at,e.ADD_URI_SAFE_ATTR,At),J(e,"FORBID_CONTENTS")&&H(e.FORBID_CONTENTS)&&(nt===rt&&(nt=se(nt)),ie(nt,e.FORBID_CONTENTS,At)),J(e,"ADD_FORBID_CONTENTS")&&H(e.ADD_FORBID_CONTENTS)&&(nt===rt&&(nt=se(nt)),ie(nt,e.ADD_FORBID_CONTENTS,At)),Je&&(Ee["#text"]=!0),We&&ie(Ee,["html","head","body"]),Ee.table&&(ie(Ee,["tbody"]),delete Ie.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=e.TRUSTED_TYPES_POLICY,R=E.createHTML("")}else void 0===E&&(E=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!==E&&"string"==typeof R&&(R=E.createHTML(""));x&&x(e),Et=e},vt=ie({},[...ue,...pe,...fe]),_t=ie({},[...de,...he]),It=function(e){F(n.removed,{element:e});try{A(e).removeChild(e)}catch(t){y(e)}},Nt=function(e,t){try{F(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){F(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Qe||Ve)try{It(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ct=function(e){let t=null,n=null;if(Ye)e="<remove></remove>"+e;else{const t=G(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===bt&&pt===ut&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=E?E.createHTML(e):e;if(pt===ut)try{t=(new d).parseFromString(o,bt)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(pt,"template",null);try{t.documentElement.innerHTML=ft?R:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),pt===ut?_.call(t,We?"html":"body")[0]:We?t.documentElement:i},Ot=function(e){return w.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 f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof p)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},xt=function(e){return"function"==typeof l&&e instanceof l};function Dt(e,t,r){U(e,e=>{e.call(n,t,r,Et)})}const Lt=function(e){let t=null;if(Dt(C.beforeSanitizeElements,e,null),kt(e))return It(e),!0;const r=At(e.nodeName);if(Dt(C.uponSanitizeElement,e,{tagName:r,allowedTags:Ee}),je&&e.hasChildNodes()&&!xt(e.firstElementChild)&&te(/<[/\w!]/g,e.innerHTML)&&te(/<[/\w!]/g,e.textContent))return It(e),!0;if(je&&e.namespaceURI===ut&&"style"===r&&xt(e.firstElementChild))return It(e),!0;if(e.nodeType===De)return It(e),!0;if(je&&e.nodeType===Le&&te(/<[/\w]/g,e.data))return It(e),!0;if(Ie[r]||!(Ue.tagCheck instanceof Function&&Ue.tagCheck(r))&&!Ee[r]){if(!Ie[r]&&Ut(r)){if(_e.tagNameCheck instanceof RegExp&&te(_e.tagNameCheck,r))return!1;if(_e.tagNameCheck instanceof Function&&_e.tagNameCheck(r))return!1}if(Je&&!nt[r]){const t=A(e)||e.parentNode,n=T(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const o=g(n[r],!0);t.insertBefore(o,b(e))}}}return It(e),!0}return e instanceof c&&!function(e){let t=A(e);t&&t.tagName||(t={namespaceURI:pt,tagName:"template"});const n=j(e.tagName),r=j(t.tagName);return!!dt[e.namespaceURI]&&(e.namespaceURI===ct?t.namespaceURI===ut?"svg"===n:t.namespaceURI===lt?"svg"===n&&("annotation-xml"===r||mt[r]):Boolean(vt[n]):e.namespaceURI===lt?t.namespaceURI===ut?"math"===n:t.namespaceURI===ct?"math"===n&&gt[r]:Boolean(_t[n]):e.namespaceURI===ut?!(t.namespaceURI===ct&&!gt[r])&&!(t.namespaceURI===lt&&!mt[r])&&!_t[n]&&(yt[n]||!vt[n]):!("application/xhtml+xml"!==bt||!dt[e.namespaceURI]))}(e)?(It(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!te(/<\/no(script|embed|frames)/i,e.innerHTML)?(He&&e.nodeType===xe&&(t=e.textContent,U([O,k,D],e=>{t=Y(t,e," ")}),e.textContent!==t&&(F(n.removed,{element:e.cloneNode()}),e.textContent=t)),Dt(C.afterSanitizeElements,e,null),!1):(It(e),!0)},Mt=function(e,t,n){if(Ce[t])return!1;if($e&&("id"===t||"name"===t)&&(n in r||n in Rt))return!1;const o=Se[t]||Ue.attributeCheck instanceof Function&&Ue.attributeCheck(t,e);if(ze&&!Ce[t]&&te(M,t));else if(qe&&te(P,t));else if(!o||Ce[t]){if(!(Ut(e)&&(_e.tagNameCheck instanceof RegExp&&te(_e.tagNameCheck,e)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(e))&&(_e.attributeNameCheck instanceof RegExp&&te(_e.attributeNameCheck,t)||_e.attributeNameCheck instanceof Function&&_e.attributeNameCheck(t,e))||"is"===t&&_e.allowCustomizedBuiltInElements&&(_e.tagNameCheck instanceof RegExp&&te(_e.tagNameCheck,n)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(n))))return!1}else if(at[t]);else if(te(Ae,Y(n,oe,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Q(n,"data:")||!ot[e]){if(Fe&&!te(re,Y(n,oe,"")));else if(n)return!1}else;return!0},Pt=ie({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ut=function(e){return!Pt[j(e)]&&te(ae,e)},qt=function(e){Dt(C.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||kt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:a,namespaceURI:s,value:l}=i,c=At(a),u=l;let p="value"===a?u:V(u);if(r.attrName=c,r.attrValue=p,r.keepAttr=!0,r.forceKeepAttr=void 0,Dt(C.uponSanitizeAttribute,e,r),p=r.attrValue,!Ke||"id"!==c&&"name"!==c||0===Q(p,Ze)||(Nt(a,e),p=Ze+p),je&&te(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,p)){Nt(a,e);continue}if("attributename"===c&&G(p,"href")){Nt(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Nt(a,e);continue}if(!Be&&te(/\/>/i,p)){Nt(a,e);continue}He&&U([O,k,D],e=>{p=Y(p,e," ")});const f=At(e.nodeName);if(Mt(f,c,p)){if(E&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(f,c)){case"TrustedHTML":p=E.createHTML(p);break;case"TrustedScriptURL":p=E.createScriptURL(p)}if(p!==u)try{s?e.setAttributeNS(s,a,p):e.setAttribute(a,p),kt(e)?It(e):z(n.removed)}catch(t){Nt(a,e)}}else Nt(a,e)}Dt(C.afterSanitizeAttributes,e,null)},zt=function(e){let t=null;const n=Ot(e);for(Dt(C.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)Dt(C.uponSanitizeShadowNode,t,null),Lt(t),qt(t),t.content instanceof a&&zt(t.content);Dt(C.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(ft=!e,ft&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xt(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return X(e);case"boolean":return $(e);case"bigint":return K?K(e):"0";case"symbol":return Z?Z(e):"Symbol()";case"undefined":default:return ee(e);case"function":case"object":{if(null===e)return ee(e);const t=e,n=le(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:ee(e)}return ee(e)}}}(e)))throw ne("dirty is not a string, aborting");if(!n.isSupported)return e;if(Ge||wt(t),n.removed=[],"string"==typeof e&&(et=!1),et){const t=e.nodeName;if("string"==typeof t){const e=At(t);if(!Ee[e]||Ie[e])throw ne("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Ct("\x3c!----\x3e"),i=r.ownerDocument.importNode(e,!0),i.nodeType===ke&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i);else{if(!Qe&&!He&&!We&&-1===e.indexOf("<"))return E&&Xe?E.createHTML(e):e;if(r=Ct(e),!r)return Qe?null:Xe?R:""}r&&Ye&&It(r.firstChild);const u=Ot(et?e:r);for(;s=u.nextNode();)Lt(s),qt(s),s.content instanceof a&&zt(s.content);if(et)return e;if(Qe){if(He){r.normalize();let e=r.innerHTML;U([O,k,D],t=>{e=Y(e,t," ")}),r.innerHTML=e}if(Ve)for(c=v.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(Se.shadowroot||Se.shadowrootmode)&&(c=N.call(o,c,!0)),c}let p=We?r.outerHTML:r.innerHTML;return We&&Ee["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&te(Ne,r.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+p),He&&U([O,k,D],e=>{p=Y(p,e," ")}),E&&Xe?E.createHTML(p):p},n.setConfig=function(){wt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ge=!0},n.clearConfig=function(){Et=null,Ge=!1},n.isValidAttribute=function(e,t,n){Et||wt({});const r=At(e),o=At(t);return Mt(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&F(C[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=q(C[e],t);return-1===n?void 0:B(C[e],n,1)[0]}return z(C[e])},n.removeHooks=function(e){C[e]=[]},n.removeAllHooks=function(){C={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"]);var qe=n(45369),ze=n.n(qe);class Fe{constructor(e,t,n){o(this,"queue",new(ze())((e,t)=>e.priority-t.priority)),o(this,"queuedRequests",new Map),o(this,"activeRequests",new Map),o(this,"isProcessing",!1),o(this,"renderCallbacks",new Map),o(this,"errorCallbacks",new Map),o(this,"latestViewportUpdateId",new Map),o(this,"maxConcurrentRequests",1),o(this,"activeRequestCount",0),this.renderChannel=e,this.maxConcurrentRequests=t,this.isServer=n}static async create(e){const t=await e.isServer();return new Fe(e,t?4:1,t)}setCallbacks(e,t,n){this.renderCallbacks.set(e,t),this.errorCallbacks.set(e,n)}enqueue(e,t){const n=Date.now();if(0===t.length)return;let r=this.latestViewportUpdateId.get(e)??-1/0;for(const e of t)e.viewportRenderUpdateId>r&&(r=e.viewportRenderUpdateId);const o=this.latestViewportUpdateId.get(e);void 0!==o&&r>o&&this.cancelStaleRequests(e,r),this.latestViewportUpdateId.set(e,r);for(const r of t){const t=this.activeRequests.get(r.id);if(t){if(!t.cancelled)continue;this.activeRequests.delete(r.id)}const o=this.queuedRequests.get(r.id);o&&(o.cancelled=!0,this.queuedRequests.delete(r.id));const i={request:r,sessionId:e,priority:this.calculatePriority(r),timestamp:n,cancelled:!1};this.queue.push(i),this.queuedRequests.set(r.id,i)}this.isProcessing||this.startProcessing()}cancel(e,t){for(const n of t){const t=this.queuedRequests.get(n);t&&t.sessionId===e&&(t.cancelled=!0);const r=this.activeRequests.get(n);r&&r.sessionId===e&&(r.cancelled=!0)}}cancelSession(e){for(const t of this.queuedRequests.values())t.sessionId===e&&(t.cancelled=!0);for(const t of this.activeRequests.values())t.sessionId===e&&(t.cancelled=!0);this.latestViewportUpdateId.delete(e)}async startProcessing(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.size>0||this.activeRequestCount>0;){for(;this.activeRequestCount<this.maxConcurrentRequests&&this.queue.size>0;){const e=this.getNextRequest();if(!e)break;this.activeRequestCount++,this.processRequest(e).finally(()=>{this.activeRequestCount--})}await new Promise(e=>setTimeout(e,0))}this.isProcessing=!1}}getNextRequest(){for(;this.queue.size>0;){const e=this.queue.pop();if(!e)break;if(this.queuedRequests.delete(e.request.id),!e.cancelled)return this.activeRequests.set(e.request.id,e),e}return null}async processRequest(e){const t=this.collectBatch(e);if(t.length>1)return void await this.processBatch(t);const{request:n,sessionId:r}=e;try{if(e.cancelled)return;const t=await this.renderTile(n);if(e.cancelled)return;const o=this.renderCallbacks.get(r);o&&o(r,n.id,t)}catch(t){if(console.error("[SharedRenderQueue] Error processing request:",t),!e.cancelled){const e=this.errorCallbacks.get(r);e&&e(r,n.id,t)}}finally{this.activeRequests.delete(n.id)}}collectBatch(e){if(this.isServer||this.maxConcurrentRequests>1)return[e];if(!("function"==typeof this.renderChannel.renderTiles))return[e];const{request:t,sessionId:n}=e;if(t.options.disableBatch)return[e];const r=[e],o=[],i=8-r.length;for(const e of this.queuedRequests.values()){if(o.length>=i)break;e.cancelled||e.sessionId!==n||this.canBatchWith(e,t)&&o.push(e)}for(const e of o)this.queuedRequests.delete(e.request.id),this.activeRequests.set(e.request.id,e),r.push(e);return r}canBatchWith(e,t){const{sourceInfo:n,options:r,viewportRenderUpdateId:o}=t,i=e.request,a=i.options;return i.viewportRenderUpdateId===o&&i.sourceInfo.pageIndex===n.pageIndex&&i.sourceInfo.pageSize.width===n.pageSize.width&&i.sourceInfo.pageSize.height===n.pageSize.height&&a.renderForPrinting===r.renderForPrinting&&a.renderText===r.renderText&&a.renderAnnotations===r.renderAnnotations&&Boolean(a.disableBatch)===Boolean(r.disableBatch)&&(a.priority||"high")===(r.priority||"high")}async processBatch(e){const[t]=e,{sessionId:n}=t;try{const t=await this.renderTiles(e.map(e=>e.request));if(t.length!==e.length)return console.warn(`[SharedRenderQueue] renderTiles returned ${t.length} results for ${e.length} requests; falling back to per-tile rendering.`),void await Promise.all(e.map(async e=>{if(!e.cancelled)try{const t=await this.renderTile(e.request),r=this.renderCallbacks.get(n);r&&r(n,e.request.id,t)}catch(t){if(!e.cancelled){const r=this.errorCallbacks.get(n);r&&r(n,e.request.id,t)}}finally{this.activeRequests.delete(e.request.id)}}));for(let r=0;r<e.length;r++){const o=e[r],i=t[r];if(o.cancelled)continue;const a=this.renderCallbacks.get(n);a&&a(n,o.request.id,i),this.activeRequests.delete(o.request.id)}}catch(t){console.error("[SharedRenderQueue] Error processing request batch:",t);for(const r of e){if(!r.cancelled){const e=this.errorCallbacks.get(n);e&&e(n,r.request.id,t)}this.activeRequests.delete(r.request.id)}}}async renderTile(e){const{sourceInfo:t,options:n}=e,r=await this.renderChannel.render(t.pageIndex,t.pageSize,t.tileRect,{renderForPrinting:n.renderForPrinting,renderText:n.renderText,priority:n.priority||"high"});return{buffer:r,format:n.format||"bitmap",width:r.width,height:r.height}}async renderTiles(e){const{sourceInfo:t,options:n}=e[0],r=e.map(e=>e.sourceInfo.tileRect);return(await this.renderChannel.renderTiles(t.pageIndex,t.pageSize,r,{renderForPrinting:n.renderForPrinting,renderText:n.renderText,priority:n.priority||"high"})).map(e=>({buffer:e,format:n.format||"bitmap",width:e.width,height:e.height}))}calculatePriority(e){let t=0;"high"===e.options.priority&&(t-=1e3),e.targetInfo.isVisible&&(t-=500),t-=10*e.viewportRenderUpdateId;return t+=100*Math.abs(e.targetInfo.scale-e.targetInfo.targetScale),t}cancelStaleRequests(e,t){for(const[n,r]of this.queuedRequests.entries())r.sessionId===e&&r.request.viewportRenderUpdateId<t&&(r.cancelled=!0,this.queuedRequests.delete(n));for(const n of this.activeRequests.values())n.sessionId===e&&n.request.viewportRenderUpdateId<t&&(n.cancelled=!0)}}f(new class{constructor(){o(this,"sharedRenderQueue",null),o(this,"sharedRenderQueuePromise",null),o(this,"sessionCallbacks",new Map),o(this,"sessionErrors",new Map),o(this,"renderChannel",null),o(this,"sessionCounter",0),o(this,"viewportUpdateCounter",0)}async setupRenderMessageChannel(e){this.renderChannel=h(e)}async getSharedRenderQueue(){this.sharedRenderQueuePromise||(!function(e,t){if(!e)throw new _(`Assertion failed: ${t||"Condition not met"}\n\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}(this.renderChannel,"Setup render channel first"),this.sharedRenderQueuePromise=Fe.create(this.renderChannel));const e=await this.sharedRenderQueuePromise;return this.sharedRenderQueue=e,e}async beginRenderer(e,t,n,r,o){const i=await this.getSharedRenderQueue(),a=`page-${e}-${this.sessionCounter++}`;return this.sessionCallbacks.set(a,r),this.sessionErrors.set(a,o),i.setCallbacks(a,this.handleTileReady.bind(this),this.handleTileError.bind(this)),a}async requestTiles(e,t){if(!this.sharedRenderQueue)return void console.warn("SharedRenderQueue not initialized");const n=++this.viewportUpdateCounter,r=t.map(e=>({id:e.id,viewportRenderUpdateId:n,sourceInfo:{pageIndex:e.pageIndex,pageSize:e.pageSize,tileRect:e.tileRect},targetInfo:{scale:e.mip,targetScale:e.mip,isVisible:!0,canvasRect:{left:0,top:0,width:e.tileRect.width,height:e.tileRect.height}},options:{renderAnnotations:e.options.renderAnnotations,renderText:e.options.renderText,format:"bitmap",priority:e.options.priority,disableBatch:e.options.disableBatch}}));this.sharedRenderQueue.enqueue(e,r)}async cancelTiles(e,t){this.sharedRenderQueue&&this.sharedRenderQueue.cancel(e,t)}async endRenderer(e){this.sessionCallbacks.delete(e),this.sessionErrors.delete(e),this.sharedRenderQueue?.cancelSession(e)}handleTileReady(e,t,n){const r=this.sessionCallbacks.get(e);r&&r(e,t,n)}handleTileError(e,t,n){const r=this.sessionErrors.get(e);r&&r(e,t,n)}})})(),{}})());